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. Petya loves hockey very much. One day, as he was watching a hockey match, he fell asleep. Petya dreamt of being appointed to change a hockey team's name. Thus, Petya was given the original team name w and the collection of forbidden substrin...
instruction
0
46,813
6
93,626
Tags: implementation, strings Correct Solution: ``` import sys from math import * def minp(): return sys.stdin.readline().strip() def mint(): return int(minp()) def mints(): return map(int, minp().split()) def same(a, b): return a.lower() == b.lower() n = mint() w = [] for i in range(n): w.append(minp().low...
output
1
46,813
6
93,627
Provide tags and a correct Python 3 solution for this coding contest problem. Petya loves hockey very much. One day, as he was watching a hockey match, he fell asleep. Petya dreamt of being appointed to change a hockey team's name. Thus, Petya was given the original team name w and the collection of forbidden substrin...
instruction
0
46,814
6
93,628
Tags: implementation, strings Correct Solution: ``` import sys f = sys.stdin #f = open("input.txt") n = int(f.readline()) fbs = [] for i in range(n): fbs.append(f.readline().strip()) s = f.readline().strip() ch = f.readline().strip() bChange = [0] * len(s) for i in range(n): idx = s.lower().find(fbs[i].lower(...
output
1
46,814
6
93,629
Provide tags and a correct Python 3 solution for this coding contest problem. Petya loves hockey very much. One day, as he was watching a hockey match, he fell asleep. Petya dreamt of being appointed to change a hockey team's name. Thus, Petya was given the original team name w and the collection of forbidden substrin...
instruction
0
46,815
6
93,630
Tags: implementation, strings Correct Solution: ``` n=int(input()) s=[] for _ in range(n): s.append(input()) w=input() l=input() x=[] ans=w for i in range(n): ts=w li=len(s[i]) for j in range(len(w)-li+1): if ts[j:j+li].lower()==s[i].lower(): p='' for e in range(j,j+li): ...
output
1
46,815
6
93,631
Provide tags and a correct Python 3 solution for this coding contest problem. You are given an n Γ— m rectangular table consisting of lower case English letters. In one operation you can completely remove one column from the table. The remaining parts are combined forming a new table. For example, after removing the se...
instruction
0
47,430
6
94,860
Tags: brute force, constructive algorithms, implementation Correct Solution: ``` n,m=map(int,input().split()) ans=0 st=[input() for i in range(n)] new=['']*n for i in range(m): newstr=[new[j]+st[j][i] for j in range(n)] if(newstr==sorted(newstr)): new=newstr else: ans+=1 print(ans) ```
output
1
47,430
6
94,861
Provide tags and a correct Python 3 solution for this coding contest problem. You are given an n Γ— m rectangular table consisting of lower case English letters. In one operation you can completely remove one column from the table. The remaining parts are combined forming a new table. For example, after removing the se...
instruction
0
47,431
6
94,862
Tags: brute force, constructive algorithms, implementation Correct Solution: ``` ### NOT FINISHED # I really need to make it go from line to line: # first, the first 2 lines should be corrected # then, the third, and so on. def issorted(l): return all(l[i] <= l[i+1] for i in range(len(l)-1)) def mainX(n,m,t): ...
output
1
47,431
6
94,863
Provide tags and a correct Python 3 solution for this coding contest problem. You are given an n Γ— m rectangular table consisting of lower case English letters. In one operation you can completely remove one column from the table. The remaining parts are combined forming a new table. For example, after removing the se...
instruction
0
47,432
6
94,864
Tags: brute force, constructive algorithms, implementation Correct Solution: ``` # from itertools import combinations # from bisect import bisect_left # from functools import * # from collections import Counter I = lambda: list(map(int, input().split())) n, m = I() ans = 0 columns = list(zip(*[input() for i in range(n...
output
1
47,432
6
94,865
Provide tags and a correct Python 3 solution for this coding contest problem. You are given an n Γ— m rectangular table consisting of lower case English letters. In one operation you can completely remove one column from the table. The remaining parts are combined forming a new table. For example, after removing the se...
instruction
0
47,433
6
94,866
Tags: brute force, constructive algorithms, implementation Correct Solution: ``` def main(): n, m = map(int, input().split()) a = [input() for x in range(n)] s = ['']*n ans = 0 for i in range(m): ts = [s[j] + a[j][i] for j in range(n)] if(ts == sorted(ts)): s = ts ...
output
1
47,433
6
94,867
Provide tags and a correct Python 3 solution for this coding contest problem. You are given an n Γ— m rectangular table consisting of lower case English letters. In one operation you can completely remove one column from the table. The remaining parts are combined forming a new table. For example, after removing the se...
instruction
0
47,434
6
94,868
Tags: brute force, constructive algorithms, implementation Correct Solution: ``` def remove(p, a): for i in range(len(a)): a[i] = a[i][: p] + a[i][p + 1: ] n, m = [int(x) for x in input().split()] a = [] for i in range(n): a.append(input()) removed = 0 for i in range(m): i -= removed for j in range(n - 1): if ...
output
1
47,434
6
94,869
Provide tags and a correct Python 3 solution for this coding contest problem. You are given an n Γ— m rectangular table consisting of lower case English letters. In one operation you can completely remove one column from the table. The remaining parts are combined forming a new table. For example, after removing the se...
instruction
0
47,435
6
94,870
Tags: brute force, constructive algorithms, implementation Correct Solution: ``` # cook your dish here from sys import stdin,stdout from collections import Counter from itertools import permutations import bisect import math I=lambda: map(int,stdin.readline().split()) I1=lambda: stdin.readline() n,m=I() i...
output
1
47,435
6
94,871
Provide tags and a correct Python 3 solution for this coding contest problem. You are given an n Γ— m rectangular table consisting of lower case English letters. In one operation you can completely remove one column from the table. The remaining parts are combined forming a new table. For example, after removing the se...
instruction
0
47,436
6
94,872
Tags: brute force, constructive algorithms, implementation Correct Solution: ``` n, m = map(int,input().split()) table = [input() for i in range(n)] ans = 0 ar = [1] * n for i in range(m): ar2 = [ar[i] for i in range(n)] flag = 1 for j in range(1,n): if ar[j]: if table[j][i] > table[j - ...
output
1
47,436
6
94,873
Provide tags and a correct Python 3 solution for this coding contest problem. You are given an n Γ— m rectangular table consisting of lower case English letters. In one operation you can completely remove one column from the table. The remaining parts are combined forming a new table. For example, after removing the se...
instruction
0
47,437
6
94,874
Tags: brute force, constructive algorithms, implementation Correct Solution: ``` from operator import itemgetter n, m = map(int, input().strip().split()) table = [] bad_cols = [False] * m for _ in range(n): table.append(input().strip()) for j in range(m): indices = [idx for idx in range(j + 1) if not bad_c...
output
1
47,437
6
94,875
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given an n Γ— m rectangular table consisting of lower case English letters. In one operation you can completely remove one column from the table. The remaining parts are combined forming ...
instruction
0
47,438
6
94,876
Yes
output
1
47,438
6
94,877
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given an n Γ— m rectangular table consisting of lower case English letters. In one operation you can completely remove one column from the table. The remaining parts are combined forming ...
instruction
0
47,439
6
94,878
Yes
output
1
47,439
6
94,879
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given an n Γ— m rectangular table consisting of lower case English letters. In one operation you can completely remove one column from the table. The remaining parts are combined forming ...
instruction
0
47,440
6
94,880
Yes
output
1
47,440
6
94,881
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given an n Γ— m rectangular table consisting of lower case English letters. In one operation you can completely remove one column from the table. The remaining parts are combined forming ...
instruction
0
47,441
6
94,882
Yes
output
1
47,441
6
94,883
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given an n Γ— m rectangular table consisting of lower case English letters. In one operation you can completely remove one column from the table. The remaining parts are combined forming ...
instruction
0
47,442
6
94,884
No
output
1
47,442
6
94,885
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given an n Γ— m rectangular table consisting of lower case English letters. In one operation you can completely remove one column from the table. The remaining parts are combined forming ...
instruction
0
47,443
6
94,886
No
output
1
47,443
6
94,887
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given an n Γ— m rectangular table consisting of lower case English letters. In one operation you can completely remove one column from the table. The remaining parts are combined forming ...
instruction
0
47,444
6
94,888
No
output
1
47,444
6
94,889
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given an n Γ— m rectangular table consisting of lower case English letters. In one operation you can completely remove one column from the table. The remaining parts are combined forming ...
instruction
0
47,445
6
94,890
No
output
1
47,445
6
94,891
Provide tags and a correct Python 3 solution for this coding contest problem. Little Nastya has a hobby, she likes to remove some letters from word, to obtain another word. But it turns out to be pretty hard for her, because she is too young. Therefore, her brother Sergey always helps her. Sergey gives Nastya the wor...
instruction
0
47,577
6
95,154
Tags: binary search, greedy, strings Correct Solution: ``` s = (input()) p = (input()) a = [i-1 for i in list(map(int,input().split()))] left = 0 right = len(s) while right - left > 1: d = list(s) mid = int((left + right)/2) for i in range(mid): d[a[i]] = '' j = 0 for i in range(len(s)): ...
output
1
47,577
6
95,155
Provide tags and a correct Python 3 solution for this coding contest problem. Little Nastya has a hobby, she likes to remove some letters from word, to obtain another word. But it turns out to be pretty hard for her, because she is too young. Therefore, her brother Sergey always helps her. Sergey gives Nastya the wor...
instruction
0
47,578
6
95,156
Tags: binary search, greedy, strings Correct Solution: ``` def good(t, p, b, k): j = 0 for i in range(len(t)): if b[i] >= k and t[i] == p[j]: j += 1 if j == len(p): return True return False def solve(t, p, a): b = [0] * len(a) for i in range(len(a))...
output
1
47,578
6
95,157
Provide tags and a correct Python 3 solution for this coding contest problem. Little Nastya has a hobby, she likes to remove some letters from word, to obtain another word. But it turns out to be pretty hard for her, because she is too young. Therefore, her brother Sergey always helps her. Sergey gives Nastya the wor...
instruction
0
47,579
6
95,158
Tags: binary search, greedy, strings Correct Solution: ``` def possible(t,p,a,n): s = '' check = [True]*len(t) for i in range(n): check[a[i]] = False for i in range(len(check)): if check[i]: s += t[i] m = len(s) lp = len(p) c = 0 for i in range(m): ...
output
1
47,579
6
95,159
Provide tags and a correct Python 3 solution for this coding contest problem. Little Nastya has a hobby, she likes to remove some letters from word, to obtain another word. But it turns out to be pretty hard for her, because she is too young. Therefore, her brother Sergey always helps her. Sergey gives Nastya the wor...
instruction
0
47,580
6
95,160
Tags: binary search, greedy, strings Correct Solution: ``` s = input() t = input() a = list(map(int, input().split())) def ok(n): bad = set() for i in range(n): bad.add(a[i] - 1) pt = 0 ps = 0 while pt < len(t) and ps < len(s): if ps in bad: ps += 1 else: ...
output
1
47,580
6
95,161
Provide tags and a correct Python 3 solution for this coding contest problem. Little Nastya has a hobby, she likes to remove some letters from word, to obtain another word. But it turns out to be pretty hard for her, because she is too young. Therefore, her brother Sergey always helps her. Sergey gives Nastya the wor...
instruction
0
47,581
6
95,162
Tags: binary search, greedy, strings Correct Solution: ``` s = input() t = input() a = [int(x) - 1 for x in input().split()] def ok(n): bad = set(a[:n]) it = (a for i, a in enumerate(s) if i not in bad) return all(c in it for c in t) low = 0 high = len(s) while low < high: mid = (high + low + 1) // 2 ...
output
1
47,581
6
95,163
Provide tags and a correct Python 3 solution for this coding contest problem. Little Nastya has a hobby, she likes to remove some letters from word, to obtain another word. But it turns out to be pretty hard for her, because she is too young. Therefore, her brother Sergey always helps her. Sergey gives Nastya the wor...
instruction
0
47,582
6
95,164
Tags: binary search, greedy, strings Correct Solution: ``` b = input() s = input() i = [int(x)-1 for x in input().split()] def viable(x): ind = 0 ok = [0]*len(b) for j in range(0,x): ok[i[j]] = 1 for j in range(0,len(b)): if s[ind] == b[j] and ok[j] != 1: ind += 1 ...
output
1
47,582
6
95,165
Provide tags and a correct Python 3 solution for this coding contest problem. Little Nastya has a hobby, she likes to remove some letters from word, to obtain another word. But it turns out to be pretty hard for her, because she is too young. Therefore, her brother Sergey always helps her. Sergey gives Nastya the wor...
instruction
0
47,583
6
95,166
Tags: binary search, greedy, strings Correct Solution: ``` #########################################################################################################\ ######################################################################################################### ###################################The_Apurv_Rat...
output
1
47,583
6
95,167
Provide tags and a correct Python 3 solution for this coding contest problem. Little Nastya has a hobby, she likes to remove some letters from word, to obtain another word. But it turns out to be pretty hard for her, because she is too young. Therefore, her brother Sergey always helps her. Sergey gives Nastya the wor...
instruction
0
47,584
6
95,168
Tags: binary search, greedy, strings Correct Solution: ``` s = input() t = input() a = [int(x) - 1 for x in input().split()] def ok(n): bad = set(a[:n]) it = (a for i, a in enumerate(s) if i not in bad) return all(c in it for c in t) low = 0 high = len(s) while low <= high: mid = (high + low) // 2 ...
output
1
47,584
6
95,169
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Little Nastya has a hobby, she likes to remove some letters from word, to obtain another word. But it turns out to be pretty hard for her, because she is too young. Therefore, her brother Sergey...
instruction
0
47,585
6
95,170
Yes
output
1
47,585
6
95,171
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Little Nastya has a hobby, she likes to remove some letters from word, to obtain another word. But it turns out to be pretty hard for her, because she is too young. Therefore, her brother Sergey...
instruction
0
47,586
6
95,172
Yes
output
1
47,586
6
95,173
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Little Nastya has a hobby, she likes to remove some letters from word, to obtain another word. But it turns out to be pretty hard for her, because she is too young. Therefore, her brother Sergey...
instruction
0
47,587
6
95,174
Yes
output
1
47,587
6
95,175
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Little Nastya has a hobby, she likes to remove some letters from word, to obtain another word. But it turns out to be pretty hard for her, because she is too young. Therefore, her brother Sergey...
instruction
0
47,588
6
95,176
Yes
output
1
47,588
6
95,177
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Little Nastya has a hobby, she likes to remove some letters from word, to obtain another word. But it turns out to be pretty hard for her, because she is too young. Therefore, her brother Sergey...
instruction
0
47,589
6
95,178
No
output
1
47,589
6
95,179
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Little Nastya has a hobby, she likes to remove some letters from word, to obtain another word. But it turns out to be pretty hard for her, because she is too young. Therefore, her brother Sergey...
instruction
0
47,590
6
95,180
No
output
1
47,590
6
95,181
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Little Nastya has a hobby, she likes to remove some letters from word, to obtain another word. But it turns out to be pretty hard for her, because she is too young. Therefore, her brother Sergey...
instruction
0
47,591
6
95,182
No
output
1
47,591
6
95,183
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Little Nastya has a hobby, she likes to remove some letters from word, to obtain another word. But it turns out to be pretty hard for her, because she is too young. Therefore, her brother Sergey...
instruction
0
47,592
6
95,184
No
output
1
47,592
6
95,185
Provide tags and a correct Python 3 solution for this coding contest problem. The ancient Berlanders believed that the longer the name, the more important its bearer is. Thus, Berland kings were famous for their long names. But long names are somewhat inconvenient, so the Berlanders started to abbreviate the names of ...
instruction
0
48,183
6
96,366
Tags: dp Correct Solution: ``` import sys import math from heapq import *; input = sys.stdin.readline from functools import cmp_to_key; def pi(): return(int(input())) def pl(): return(int(input(), 16)) def ti(): return(list(map(int,input().split()))) def ts(): s = input() return(list(s[:len(s) - 1]...
output
1
48,183
6
96,367
Provide tags and a correct Python 3 solution for this coding contest problem. The ancient Berlanders believed that the longer the name, the more important its bearer is. Thus, Berland kings were famous for their long names. But long names are somewhat inconvenient, so the Berlanders started to abbreviate the names of ...
instruction
0
48,184
6
96,368
Tags: dp Correct Solution: ``` from sys import stdin n=int(stdin.readline().strip()) s=[stdin.readline().strip() for i in range(n)] dp=[[0 for i in range(26)] for j in range(26)] now=1 last=0 for i in range(n): a,b=ord(s[i][0])-97,ord(s[i][-1])-97 for j in range(26): if dp[j][a]>0: dp[j][b]=...
output
1
48,184
6
96,369
Provide tags and a correct Python 3 solution for this coding contest problem. The ancient Berlanders believed that the longer the name, the more important its bearer is. Thus, Berland kings were famous for their long names. But long names are somewhat inconvenient, so the Berlanders started to abbreviate the names of ...
instruction
0
48,185
6
96,370
Tags: dp Correct Solution: ``` from sys import stdin input = stdin.readline n = int(input()) s = list(input().strip() for _ in range(n)) dp = [[0 for i in range(28)] for j in range(28)] for i in range(n): a, b = ord(s[i][0]) - ord('a'), ord(s[i][-1]) - ord('a') for j in range(26): if dp[j][a] > 0: ...
output
1
48,185
6
96,371
Provide tags and a correct Python 3 solution for this coding contest problem. The ancient Berlanders believed that the longer the name, the more important its bearer is. Thus, Berland kings were famous for their long names. But long names are somewhat inconvenient, so the Berlanders started to abbreviate the names of ...
instruction
0
48,186
6
96,372
Tags: dp Correct Solution: ``` from sys import stdin, stdout fst = 97 sze = 26 values = [[0 for i in range(sze)] for j in range(sze)] n = int(stdin.readline()) challengers = [] for i in range(n): s = stdin.readline().strip() challengers.append((ord(s[0]) - fst, ord(s[-1]) - fst)) for i in range(sze)...
output
1
48,186
6
96,373
Provide tags and a correct Python 3 solution for this coding contest problem. After the contest in comparing numbers, Shapur's teacher found out that he is a real genius and that no one could possibly do the calculations faster than him even using a super computer! Some days before the contest, the teacher took a ver...
instruction
0
48,366
6
96,732
Tags: strings Correct Solution: ``` #Hard Work s = [] for i in range(3): tmp = input() s.append(tmp) for i in range(3): tmp = "" for ch in s[i]: if ch != '-' and ch != ';' and ch != '_': tmp += ch s[i] = tmp.lower() res = [] for i in range(3): for j in range(3): tm...
output
1
48,366
6
96,733
Provide tags and a correct Python 3 solution for this coding contest problem. After the contest in comparing numbers, Shapur's teacher found out that he is a real genius and that no one could possibly do the calculations faster than him even using a super computer! Some days before the contest, the teacher took a ver...
instruction
0
48,367
6
96,734
Tags: strings Correct Solution: ``` def foo(s): s=''.join(s.split('-')) s=''.join(s.split(';')) s=''.join(s.split('_')) return s.lower() s1=foo(input()) s2=foo(input()) s3=foo(input()) n=int(input()) arr=[s1+s2+s3,s1+s3+s2,s2+s1+s3,s2+s3+s1,s3+s1+s2,s3+s2+s1] for _ in range(n): if foo(input()) in ar...
output
1
48,367
6
96,735
Provide tags and a correct Python 3 solution for this coding contest problem. After the contest in comparing numbers, Shapur's teacher found out that he is a real genius and that no one could possibly do the calculations faster than him even using a super computer! Some days before the contest, the teacher took a ver...
instruction
0
48,368
6
96,736
Tags: strings Correct Solution: ``` import string a = input() b = input() c = input() t = [] s = "" s0 = "" s1 = "" reponse = "" for i in range(len(a)): if a[i] not in string.punctuation : s = s + a[i] for i in range(len(b)): if b[i] not in string.punctuation : s0 = s0 + b[i] for i in range(len(c)): if c...
output
1
48,368
6
96,737
Provide tags and a correct Python 3 solution for this coding contest problem. After the contest in comparing numbers, Shapur's teacher found out that he is a real genius and that no one could possibly do the calculations faster than him even using a super computer! Some days before the contest, the teacher took a ver...
instruction
0
48,369
6
96,738
Tags: strings Correct Solution: ``` from sys import stdin, stdout def changing(s): return s.replace('_', '').replace('-', '').replace(';', '').lower() s1 = changing(stdin.readline().strip()) s2 = changing(stdin.readline().strip()) s3 = changing(stdin.readline().strip()) n = int(stdin.readline()) for i in range...
output
1
48,369
6
96,739
Provide tags and a correct Python 3 solution for this coding contest problem. After the contest in comparing numbers, Shapur's teacher found out that he is a real genius and that no one could possibly do the calculations faster than him even using a super computer! Some days before the contest, the teacher took a ver...
instruction
0
48,370
6
96,740
Tags: strings Correct Solution: ``` from itertools import permutations import sys u=input l=[u(),u(),u()] #print(l) d={';':'' , '-':'', '_':''} for _ in range(3): l[_]=''.join(d[s] if s in d else s for s in l[_]) l[_]=l[_].lower(); #print(l) n=int(u()) for i in range(n): s=u().lower() b=0 s=''.join(d[p] if p in d ...
output
1
48,370
6
96,741
Provide tags and a correct Python 3 solution for this coding contest problem. After the contest in comparing numbers, Shapur's teacher found out that he is a real genius and that no one could possibly do the calculations faster than him even using a super computer! Some days before the contest, the teacher took a ver...
instruction
0
48,371
6
96,742
Tags: strings Correct Solution: ``` import re def sub(s): return re.sub('[-_;]', '', s).lower() s1, s2, s3, n, a = sub(input()), sub(input()), sub(input()), int(input()), [] possible = [s1+s2+s3, s1+s3+s2, s2+s1+s3, s2+s3+s1, s3+s1+s2, s3+s2+s1] for i in range(n): print('ACC' if sub(input()) in possible else 'WA') ...
output
1
48,371
6
96,743
Provide tags and a correct Python 3 solution for this coding contest problem. After the contest in comparing numbers, Shapur's teacher found out that he is a real genius and that no one could possibly do the calculations faster than him even using a super computer! Some days before the contest, the teacher took a ver...
instruction
0
48,372
6
96,744
Tags: strings Correct Solution: ``` from collections import Counter def SomRas(s): return "".join([item.lower() for item in s if item.isalpha()]) naradmuni = SomRas(input()) vedvyas = SomRas(input()) RishiMuni = SomRas(input()) n = int(input()) for test in range(n): koi_dikkat = SomRas(input(...
output
1
48,372
6
96,745
Provide tags and a correct Python 3 solution for this coding contest problem. After the contest in comparing numbers, Shapur's teacher found out that he is a real genius and that no one could possibly do the calculations faster than him even using a super computer! Some days before the contest, the teacher took a ver...
instruction
0
48,373
6
96,746
Tags: strings Correct Solution: ``` import re lib = [] #clean sign trong lib, lower for i in range(3): temp = input() temp = re.sub('[\\_\\-\\;]', '', temp) lib.append(temp.lower()) answers = int(input()) #thisis; if remove is before it will remove 'is' in this lib = sorted(lib,key=len,reverse=True) ...
output
1
48,373
6
96,747
Provide tags and a correct Python 3 solution for this coding contest problem. The ship crashed into a reef and is sinking. Now the entire crew must be evacuated. All n crew members have already lined up in a row (for convenience let's label them all from left to right with positive integers from 1 to n) and await furt...
instruction
0
48,382
6
96,764
Tags: implementation, sortings, strings Correct Solution: ``` n = int(input()) man = [] womanchildren = [] captain = [] for i in range(n): n, r = map(str, input().split()) if r == 'rat': print(n) elif r == 'man': man.append(n) elif r == 'woman' or r == 'child': womanchildren.appe...
output
1
48,382
6
96,765
Provide tags and a correct Python 3 solution for this coding contest problem. The ship crashed into a reef and is sinking. Now the entire crew must be evacuated. All n crew members have already lined up in a row (for convenience let's label them all from left to right with positive integers from 1 to n) and await furt...
instruction
0
48,383
6
96,766
Tags: implementation, sortings, strings Correct Solution: ``` crew_members = [input().split() for _ in range(int(input()))] for status_values in ('rat', ('woman', 'child'), 'man', 'captain'): for name, status in crew_members: if status in status_values: print(name) ```
output
1
48,383
6
96,767
Provide tags and a correct Python 3 solution for this coding contest problem. The ship crashed into a reef and is sinking. Now the entire crew must be evacuated. All n crew members have already lined up in a row (for convenience let's label them all from left to right with positive integers from 1 to n) and await furt...
instruction
0
48,384
6
96,768
Tags: implementation, sortings, strings Correct Solution: ``` import sys def main(): crew = { 'rat' : [], 'woman_child' : [], 'man' : [], 'captain' : [] } x = input.readline() n = int(x) for i in range(n): member = input.readline() name = member.split...
output
1
48,384
6
96,769