message
stringlengths
2
43.5k
message_type
stringclasses
2 values
message_id
int64
0
1
conversation_id
int64
853
107k
cluster
float64
24
24
__index_level_0__
int64
1.71k
214k
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp has a favorite sequence a[1 ... n] consisting of n integers. He wrote it out on the whiteboard as follows: * he wrote the number a_1 to the left side (at the beginning of the whitebo...
instruction
0
31,964
24
63,928
No
output
1
31,964
24
63,929
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp has a favorite sequence a[1 ... n] consisting of n integers. He wrote it out on the whiteboard as follows: * he wrote the number a_1 to the left side (at the beginning of the whitebo...
instruction
0
31,965
24
63,930
No
output
1
31,965
24
63,931
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp has a favorite sequence a[1 ... n] consisting of n integers. He wrote it out on the whiteboard as follows: * he wrote the number a_1 to the left side (at the beginning of the whitebo...
instruction
0
31,966
24
63,932
No
output
1
31,966
24
63,933
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp has a favorite sequence a[1 ... n] consisting of n integers. He wrote it out on the whiteboard as follows: * he wrote the number a_1 to the left side (at the beginning of the whitebo...
instruction
0
31,967
24
63,934
No
output
1
31,967
24
63,935
Provide tags and a correct Python 3 solution for this coding contest problem. You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring...
instruction
0
32,651
24
65,302
Tags: dp, greedy Correct Solution: ``` for _ in[0]*int(input()): s=input();i=0;r=[] while i<len(s): if'twone'==s[i:i+5]:r+=i+3,;i+=4 if s[i:i+3]in('one','two'):r+=i+2, i+=1 print(len(r),*r) ```
output
1
32,651
24
65,303
Provide tags and a correct Python 3 solution for this coding contest problem. You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring...
instruction
0
32,652
24
65,304
Tags: dp, greedy Correct Solution: ``` if __name__ == "__main__": for _ in range(int(input())): s = input() twone = [] one = [] two = [] n = len(s) for i in range(n - 5 + 1): if s[i : i + 5] == "twone": twone.append(i) for i in ...
output
1
32,652
24
65,305
Provide tags and a correct Python 3 solution for this coding contest problem. You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring...
instruction
0
32,653
24
65,306
Tags: dp, greedy Correct Solution: ``` for _ in range(int(input())): s = input() c = [] s = s.replace("twone", "tw+ne") s = s.replace("two", "t+o") s = s.replace("one", "o+e") for i in range(len(s)): if s[i] == '+': c.append(i+1) print(len(c)) print(*c) ...
output
1
32,653
24
65,307
Provide tags and a correct Python 3 solution for this coding contest problem. You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring...
instruction
0
32,654
24
65,308
Tags: dp, greedy Correct Solution: ``` def find(s, string): inds = [] for i in range(len(s)): if i + len(string) > len(s): break if s[i:i+len(string)] == string: inds.append(i) return set(inds) t = int(input()) for i in range(t): s = input() ones = find(s, "one") twos = find(s, ...
output
1
32,654
24
65,309
Provide tags and a correct Python 3 solution for this coding contest problem. You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring...
instruction
0
32,655
24
65,310
Tags: dp, greedy Correct Solution: ``` from sys import stdin from collections import deque mod = 10**9 + 7 # def rl(): # return [int(w) for w in stdin.readline().split()] from bisect import bisect_right from bisect import bisect_left from collections import defaultdict from math import sqrt,factorial,gcd,log2,inf,c...
output
1
32,655
24
65,311
Provide tags and a correct Python 3 solution for this coding contest problem. You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring...
instruction
0
32,656
24
65,312
Tags: dp, greedy Correct Solution: ``` t=int(input()) for _ in range(t): s=input()+" " i=0 ans=[] while i<len(s)-3: if s[i]=='o': if s[i+1]=='n': if s[i+2]=='e': ans.append(i+1) i+=2 else: i...
output
1
32,656
24
65,313
Provide tags and a correct Python 3 solution for this coding contest problem. You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring...
instruction
0
32,657
24
65,314
Tags: dp, greedy Correct Solution: ``` t = int(input()) for _ in range(t): s = input() i = 0 R = [] while i < len(s): # print(s[i:i+5]) if i+4<len(s) and s[i:i+5] == "twone": # print('paso') R.append(i+2+1) i+=5 elif i+2<len(s) and (s[i:i+3] ==...
output
1
32,657
24
65,315
Provide tags and a correct Python 3 solution for this coding contest problem. You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring...
instruction
0
32,658
24
65,316
Tags: dp, greedy Correct Solution: ``` from sys import stdin,stdout from collections import Counter for _ in range(int(stdin.readline())): # n=int(stdin.readline()) # a=list(map(int,stdin.readline().split())) s=list(input()) n=len(s) ans=[] for i in range(n-4): sub=s[i:i+5] if su...
output
1
32,658
24
65,317
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string ...
instruction
0
32,659
24
65,318
Yes
output
1
32,659
24
65,319
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string ...
instruction
0
32,660
24
65,320
Yes
output
1
32,660
24
65,321
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string ...
instruction
0
32,661
24
65,322
Yes
output
1
32,661
24
65,323
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string ...
instruction
0
32,662
24
65,324
Yes
output
1
32,662
24
65,325
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string ...
instruction
0
32,663
24
65,326
No
output
1
32,663
24
65,327
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string ...
instruction
0
32,664
24
65,328
No
output
1
32,664
24
65,329
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string ...
instruction
0
32,665
24
65,330
No
output
1
32,665
24
65,331
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string ...
instruction
0
32,666
24
65,332
No
output
1
32,666
24
65,333
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarpus is an amateur programmer. Now he is analyzing a friend's program. He has already found there the function rangeIncrement(l, r), that adds 1 to each element of some array a for all indexes in the segment [l, r]. In other words, thi...
instruction
0
32,787
24
65,574
Tags: data structures, greedy Correct Solution: ``` n = int(input()) big = 10 ** 5 last = (big + 1) * [ -1 ] data = list(map(int, input().split())) data.insert(0, 0) data.append(0) result = [] previous = 0 for pos, current in enumerate(data): if current > previous: for x in range(previous + 1, current + 1)...
output
1
32,787
24
65,575
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarpus is an amateur programmer. Now he is analyzing a friend's program. He has already found there the function rangeIncrement(l, r), that adds 1 to each element of some array a for all indexes in the segment [l, r]. In other words, thi...
instruction
0
32,788
24
65,576
Tags: data structures, greedy Correct Solution: ``` import re import sys exit=sys.exit from bisect import bisect_left as bsl,bisect_right as bsr from collections import Counter,defaultdict as ddict,deque from functools import lru_cache cache=lru_cache(None) from heapq import * from itertools import * from math import i...
output
1
32,788
24
65,577
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarpus is an amateur programmer. Now he is analyzing a friend's program. He has already found there the function rangeIncrement(l, r), that adds 1 to each element of some array a for all indexes in the segment [l, r]. In other words, thi...
instruction
0
32,789
24
65,578
Tags: data structures, greedy Correct Solution: ``` N = 100000 v = [] for i in range(0, N) : v.append([]) line = input() n = int(line) line = input() lineSplit = line.split() a = 0 for i in range(0, len(lineSplit)) : b = int(lineSplit[i]) if b > a : for j in range(a, b) : v[j].append([i, -1]) elif b < a : f...
output
1
32,789
24
65,579
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarpus is an amateur programmer. Now he is analyzing a friend's program. He has already found there the function rangeIncrement(l, r), that adds 1 to each element of some array a for all indexes in the segment [l, r]. In other words, thi...
instruction
0
32,790
24
65,580
Tags: data structures, greedy Correct Solution: ``` import re import sys exit=sys.exit from bisect import bisect_left as bsl,bisect_right as bsr from collections import Counter,defaultdict as ddict,deque from functools import lru_cache cache=lru_cache(None) from heapq import * from itertools import * from math import i...
output
1
32,790
24
65,581
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarpus is an amateur programmer. Now he is analyzing a friend's program. He has already found there the function rangeIncrement(l, r), that adds 1 to each element of some array a for all ind...
instruction
0
32,791
24
65,582
No
output
1
32,791
24
65,583
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarpus is an amateur programmer. Now he is analyzing a friend's program. He has already found there the function rangeIncrement(l, r), that adds 1 to each element of some array a for all ind...
instruction
0
32,792
24
65,584
No
output
1
32,792
24
65,585
Provide tags and a correct Python 3 solution for this coding contest problem. Tomorrow is a difficult day for Polycarp: he has to attend a lectures and b practical classes at the university! Since Polycarp is a diligent student, he is going to attend all of them. While preparing for the university, Polycarp wonders w...
instruction
0
33,436
24
66,872
Tags: math Correct Solution: ``` tests = int(input()) for _ in range(tests): a, b, c, d, k = map(int, input().split(' ')) import math a = math.ceil(a / c) b = math.ceil(b / d) if(a + b) > k: print(-1) else: print(a, b) ```
output
1
33,436
24
66,873
Provide tags and a correct Python 3 solution for this coding contest problem. Tomorrow is a difficult day for Polycarp: he has to attend a lectures and b practical classes at the university! Since Polycarp is a diligent student, he is going to attend all of them. While preparing for the university, Polycarp wonders w...
instruction
0
33,437
24
66,874
Tags: math Correct Solution: ``` from math import ceil t = int(input()) for i in range(t): nLectures, nPractical, nLecturesCap, nPracticalCap, pencilcaseSize = map(int, input().split()) necessaryPens = ceil(nLectures / nLecturesCap) necessaryPencils = ceil(nPractical / nPracticalCap) if (necessaryPe...
output
1
33,437
24
66,875
Provide tags and a correct Python 3 solution for this coding contest problem. Tomorrow is a difficult day for Polycarp: he has to attend a lectures and b practical classes at the university! Since Polycarp is a diligent student, he is going to attend all of them. While preparing for the university, Polycarp wonders w...
instruction
0
33,438
24
66,876
Tags: math Correct Solution: ``` t=int(input()) for i in range(t): a,b,c,d,k=map(int,input().split()) if(a%c==0): x=int(a/c) else: x=int((a/c)+1) if(b%d==0): y=int(b/d) else: y=int((b/d)+1) if(k>=(x+y)): print(x,y) else: print(-1) ```
output
1
33,438
24
66,877
Provide tags and a correct Python 3 solution for this coding contest problem. Tomorrow is a difficult day for Polycarp: he has to attend a lectures and b practical classes at the university! Since Polycarp is a diligent student, he is going to attend all of them. While preparing for the university, Polycarp wonders w...
instruction
0
33,439
24
66,878
Tags: math Correct Solution: ``` def main(a, b, c, d, k): if a < c: # print('hi') ac = 1 else: ac = int(a / c) if (a % c) != 0: ac = ac + 1 if b < d: bd = 1 else: bd = int(b / d) if (b % d) != 0: bd = bd + 1 # print(ac, ...
output
1
33,439
24
66,879
Provide tags and a correct Python 3 solution for this coding contest problem. Tomorrow is a difficult day for Polycarp: he has to attend a lectures and b practical classes at the university! Since Polycarp is a diligent student, he is going to attend all of them. While preparing for the university, Polycarp wonders w...
instruction
0
33,440
24
66,880
Tags: math Correct Solution: ``` from math import ceil t = int(input()) for i in range(t): a, b, a1, b1, k = [int(i) for i in input().split()] pen = ceil(a / a1) pencil = ceil(b / b1) if pen + pencil > k: print(-1) else: print(pen, pencil) ```
output
1
33,440
24
66,881
Provide tags and a correct Python 3 solution for this coding contest problem. Tomorrow is a difficult day for Polycarp: he has to attend a lectures and b practical classes at the university! Since Polycarp is a diligent student, he is going to attend all of them. While preparing for the university, Polycarp wonders w...
instruction
0
33,441
24
66,882
Tags: math Correct Solution: ``` # input t = int(input()) javab_pen = [] javab_pencil = [] for i in range(t): a, b, c, d, k = [int(x) for x in input().split()] if a % c != 0: # print(a//c + 1) javab_pen.append(a//c + 1) else: javab_pen.append(a//c) if b % d != 0: javab_pe...
output
1
33,441
24
66,883
Provide tags and a correct Python 3 solution for this coding contest problem. Tomorrow is a difficult day for Polycarp: he has to attend a lectures and b practical classes at the university! Since Polycarp is a diligent student, he is going to attend all of them. While preparing for the university, Polycarp wonders w...
instruction
0
33,442
24
66,884
Tags: math Correct Solution: ``` def main(): t = int(input()) for i in range(t): a,b,c,d,k = map(int, input().split()) aa = a//c if a%c != 0: aa += 1 bb = b//d if b%d != 0: bb +=1 if aa + bb > k: print("-1") else: ...
output
1
33,442
24
66,885
Provide tags and a correct Python 3 solution for this coding contest problem. Tomorrow is a difficult day for Polycarp: he has to attend a lectures and b practical classes at the university! Since Polycarp is a diligent student, he is going to attend all of them. While preparing for the university, Polycarp wonders w...
instruction
0
33,443
24
66,886
Tags: math Correct Solution: ``` t = (int(input())) for i in range(t): a,b,c,d,k = map(int,input().split()) x = -(-a//c) y = -(-b//d) if (x + y > k): print(-1) else: print(x,y) ```
output
1
33,443
24
66,887
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Tomorrow is a difficult day for Polycarp: he has to attend a lectures and b practical classes at the university! Since Polycarp is a diligent student, he is going to attend all of them. While p...
instruction
0
33,444
24
66,888
Yes
output
1
33,444
24
66,889
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Tomorrow is a difficult day for Polycarp: he has to attend a lectures and b practical classes at the university! Since Polycarp is a diligent student, he is going to attend all of them. While p...
instruction
0
33,445
24
66,890
Yes
output
1
33,445
24
66,891
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Tomorrow is a difficult day for Polycarp: he has to attend a lectures and b practical classes at the university! Since Polycarp is a diligent student, he is going to attend all of them. While p...
instruction
0
33,446
24
66,892
Yes
output
1
33,446
24
66,893
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Tomorrow is a difficult day for Polycarp: he has to attend a lectures and b practical classes at the university! Since Polycarp is a diligent student, he is going to attend all of them. While p...
instruction
0
33,447
24
66,894
Yes
output
1
33,447
24
66,895
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Tomorrow is a difficult day for Polycarp: he has to attend a lectures and b practical classes at the university! Since Polycarp is a diligent student, he is going to attend all of them. While p...
instruction
0
33,448
24
66,896
No
output
1
33,448
24
66,897
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Tomorrow is a difficult day for Polycarp: he has to attend a lectures and b practical classes at the university! Since Polycarp is a diligent student, he is going to attend all of them. While p...
instruction
0
33,449
24
66,898
No
output
1
33,449
24
66,899
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Tomorrow is a difficult day for Polycarp: he has to attend a lectures and b practical classes at the university! Since Polycarp is a diligent student, he is going to attend all of them. While p...
instruction
0
33,450
24
66,900
No
output
1
33,450
24
66,901
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Tomorrow is a difficult day for Polycarp: he has to attend a lectures and b practical classes at the university! Since Polycarp is a diligent student, he is going to attend all of them. While p...
instruction
0
33,451
24
66,902
No
output
1
33,451
24
66,903
Provide tags and a correct Python 3 solution for this coding contest problem. A PIN code is a string that consists of exactly 4 digits. Examples of possible PIN codes: 7013, 0000 and 0990. Please note that the PIN code can begin with any digit, even with 0. Polycarp has n (2 ≀ n ≀ 10) bank cards, the PIN code of the ...
instruction
0
34,398
24
68,796
Tags: greedy, implementation Correct Solution: ``` import sys input = sys.stdin.readline from collections import defaultdict for T in range(int(input())) : n = int(input()) arr = [] for i in range(n) : arr.append(list(input().strip())) count = 0 for i in range(n): if arr[i] in arr[...
output
1
34,398
24
68,797
Provide tags and a correct Python 3 solution for this coding contest problem. A PIN code is a string that consists of exactly 4 digits. Examples of possible PIN codes: 7013, 0000 and 0990. Please note that the PIN code can begin with any digit, even with 0. Polycarp has n (2 ≀ n ≀ 10) bank cards, the PIN code of the ...
instruction
0
34,399
24
68,798
Tags: greedy, implementation Correct Solution: ``` import sys from collections import defaultdict input = sys.stdin.readline def main(): t = int(input()) for _ in range(t): n = int(input()) d = defaultdict(lambda: []) mk = {} ans = [0] * n for i in range(n): ...
output
1
34,399
24
68,799
Provide tags and a correct Python 3 solution for this coding contest problem. A PIN code is a string that consists of exactly 4 digits. Examples of possible PIN codes: 7013, 0000 and 0990. Please note that the PIN code can begin with any digit, even with 0. Polycarp has n (2 ≀ n ≀ 10) bank cards, the PIN code of the ...
instruction
0
34,400
24
68,800
Tags: greedy, implementation Correct Solution: ``` t=int(input()) for i in range(t): n=int(input()) a=dict() b=[] for i in range(n): c=input() a[c]=a.get(c,-1)+1 b.append(c) print(sum(a.values())) rlb=range(len(b)) for i in rlb: v=b[i] if a.get(v,0)==0...
output
1
34,400
24
68,801
Provide tags and a correct Python 3 solution for this coding contest problem. A PIN code is a string that consists of exactly 4 digits. Examples of possible PIN codes: 7013, 0000 and 0990. Please note that the PIN code can begin with any digit, even with 0. Polycarp has n (2 ≀ n ≀ 10) bank cards, the PIN code of the ...
instruction
0
34,401
24
68,802
Tags: greedy, implementation Correct Solution: ``` import os import sys from io import BytesIO, IOBase import math from decimal import * getcontext().prec = 25 from itertools import permutations MOD = pow(10, 9) + 7 BUFSIZE = 8192 class FastIO(IOBase): newlines = 0 def __init__(self, file): self._f...
output
1
34,401
24
68,803
Provide tags and a correct Python 3 solution for this coding contest problem. A PIN code is a string that consists of exactly 4 digits. Examples of possible PIN codes: 7013, 0000 and 0990. Please note that the PIN code can begin with any digit, even with 0. Polycarp has n (2 ≀ n ≀ 10) bank cards, the PIN code of the ...
instruction
0
34,402
24
68,804
Tags: greedy, implementation Correct Solution: ``` def solve(): n = int(input()) pins = [] letters = [] for j in range(n): pin = input() pins.append(list(pin)) letters.append(pin[0]) res = 0 for a in range(len(pins)): if pins.count(pins[a]) >= 2: for j...
output
1
34,402
24
68,805
Provide tags and a correct Python 3 solution for this coding contest problem. A PIN code is a string that consists of exactly 4 digits. Examples of possible PIN codes: 7013, 0000 and 0990. Please note that the PIN code can begin with any digit, even with 0. Polycarp has n (2 ≀ n ≀ 10) bank cards, the PIN code of the ...
instruction
0
34,403
24
68,806
Tags: greedy, implementation Correct Solution: ``` for _ in range(int(input())): n = int(input()) pins= [] for i in range(n): pins.append(list(map(str,input()))) #print(pins) reslt = 0 i, j, k = 0, 0, 0 same = False while i < n: j = 0 while j < n: if i != j and pins[i] == pins[j]: same = True ...
output
1
34,403
24
68,807
Provide tags and a correct Python 3 solution for this coding contest problem. A PIN code is a string that consists of exactly 4 digits. Examples of possible PIN codes: 7013, 0000 and 0990. Please note that the PIN code can begin with any digit, even with 0. Polycarp has n (2 ≀ n ≀ 10) bank cards, the PIN code of the ...
instruction
0
34,404
24
68,808
Tags: greedy, implementation Correct Solution: ``` def changePins(): n = int(input()) arr, s = [], set() for i in range(n): arr.append(str(input())) s.add(arr[i]) done = [0] * n res = 0 for i in range(n): if done[i]: continue for j in range(i+1,n): ...
output
1
34,404
24
68,809
Provide tags and a correct Python 3 solution for this coding contest problem. A PIN code is a string that consists of exactly 4 digits. Examples of possible PIN codes: 7013, 0000 and 0990. Please note that the PIN code can begin with any digit, even with 0. Polycarp has n (2 ≀ n ≀ 10) bank cards, the PIN code of the ...
instruction
0
34,405
24
68,810
Tags: greedy, implementation Correct Solution: ``` import os, sys # copy unique numbers to new array # for each non-unique: # increment lowest digit (with starting from 0 if neccesary) until number becomes unique def solve(pins): new_pins = [ None ] * len(pins) used_pins = set() changed_digits = 0 for x in ...
output
1
34,405
24
68,811