message
stringlengths
2
59.7k
message_type
stringclasses
2 values
message_id
int64
0
1
conversation_id
int64
37
108k
cluster
float64
20
20
__index_level_0__
int64
74
217k
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The problem of hiding a part of a formula and searching for the hidden number is called verbal arithmetic. This time, I'm dealing with an expression in which some numbers in the expression are hidden by X. Enter the following formula and create a program that outputs the result. Formula * A simple one-line addition expression in the form of "number string + number string = number string". * A "number sequence" is a sequence of numbers 0-9 and the letter X. * It is assumed that the leftmost number in the "number string" with two or more digits is not 0. * X must be at least one in the entire formula. result * The answer to the verbal arithmetic. It is one of 0 to 9 with a value of X such that the formula holds. Suppose there are no more than one answer. * If there is no answer, the result should be “NA”. Input Given multiple datasets. For each dataset, an addition expression containing one or more Xs (a string of up to 126 characters without spaces) is given on one line. The number of datasets does not exceed 150. Output For each data set, output the result of the verbal arithmetic on one line. Print the numbers 0-9 or NA. Example Input 123+4X6=X79 12X+4X6=X79 XX22+89=X2XX Output 5 NA 1 Submitted Solution: ``` inputs=[] while True: try: inputs.append(input()) except EOFError: break for i in inputs: a,c=i.split("=") a,b=a.split("+") # a+b=c for x in range(0,10): if x==0: if (a[0]=="X" and len(a)==1)or(b[0]=="X" and len(b)==1)or(c[0]=="X" and len(c)==1): next A=a.replace("X",str(x)) B=b.replace("X",str(x)) C=c.replace("X",str(x)) if int(A)+int(B)==int(C): print(x) break if x == 9: print("NA") ```
instruction
0
37,665
20
75,330
No
output
1
37,665
20
75,331
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The problem of hiding a part of a formula and searching for the hidden number is called verbal arithmetic. This time, I'm dealing with an expression in which some numbers in the expression are hidden by X. Enter the following formula and create a program that outputs the result. Formula * A simple one-line addition expression in the form of "number string + number string = number string". * A "number sequence" is a sequence of numbers 0-9 and the letter X. * It is assumed that the leftmost number in the "number string" with two or more digits is not 0. * X must be at least one in the entire formula. result * The answer to the verbal arithmetic. It is one of 0 to 9 with a value of X such that the formula holds. Suppose there are no more than one answer. * If there is no answer, the result should be “NA”. Input Given multiple datasets. For each dataset, an addition expression containing one or more Xs (a string of up to 126 characters without spaces) is given on one line. The number of datasets does not exceed 150. Output For each data set, output the result of the verbal arithmetic on one line. Print the numbers 0-9 or NA. Example Input 123+4X6=X79 12X+4X6=X79 XX22+89=X2XX Output 5 NA 1 Submitted Solution: ``` import sys t='X' for e in sys.stdin: for i in'0123456789'[(e[0]==t)*(e[1]!='+')or('+X'in e)*('+X='not in e)or('=X'in e)*(e[-2]!='='):]: if eval(e.replace(t,i).replace('=','==')):print(i);break else:print('NA') ```
instruction
0
37,666
20
75,332
No
output
1
37,666
20
75,333
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The problem of hiding a part of a formula and searching for the hidden number is called verbal arithmetic. This time, I'm dealing with an expression in which some numbers in the expression are hidden by X. Enter the following formula and create a program that outputs the result. Formula * A simple one-line addition expression in the form of "number string + number string = number string". * A "number sequence" is a sequence of numbers 0-9 and the letter X. * It is assumed that the leftmost number in the "number string" with two or more digits is not 0. * X must be at least one in the entire formula. result * The answer to the verbal arithmetic. It is one of 0 to 9 with a value of X such that the formula holds. Suppose there are no more than one answer. * If there is no answer, the result should be “NA”. Input Given multiple datasets. For each dataset, an addition expression containing one or more Xs (a string of up to 126 characters without spaces) is given on one line. The number of datasets does not exceed 150. Output For each data set, output the result of the verbal arithmetic on one line. Print the numbers 0-9 or NA. Example Input 123+4X6=X79 12X+4X6=X79 XX22+89=X2XX Output 5 NA 1 Submitted Solution: ``` def restore(sec, x): return int(sec.replace("X", str(x))) while True: try: s = input() p_ind = s.index("+") e_ind = s.index("=") sec1 = s[:p_ind] sec2 = s[p_ind + 1:e_ind] sec3 = s[e_ind + 1:] for x in range(10): if not (not x and (sec1[0] == "X" and len(sec1) == 1 or sec2[0] == "X" and len(sec2) == 1 or sec3[0] == "X" and len(sec3) == 1)): if restore(sec1, x) + restore(sec2, x) == restore(sec3, x): print(x) break else: print("NA") except EOFError: break ```
instruction
0
37,667
20
75,334
No
output
1
37,667
20
75,335
Provide tags and a correct Python 3 solution for this coding contest problem. Pari has a friend who loves palindrome numbers. A palindrome number is a number that reads the same forward or backward. For example 12321, 100001 and 1 are palindrome numbers, while 112 and 1021 are not. Pari is trying to love them too, but only very special and gifted people can understand the beauty behind palindrome numbers. Pari loves integers with even length (i.e. the numbers with even number of digits), so she tries to see a lot of big palindrome numbers with even length (like a 2-digit 11 or 6-digit 122221), so maybe she could see something in them. Now Pari asks you to write a program that gets a huge integer n from the input and tells what is the n-th even-length positive palindrome number? Input The only line of the input contains a single integer n (1 ≤ n ≤ 10100 000). Output Print the n-th even-length palindrome number. Examples Input 1 Output 11 Input 10 Output 1001 Note The first 10 even-length palindrome numbers are 11, 22, 33, ... , 88, 99 and 1001.
instruction
0
38,143
20
76,286
Tags: constructive algorithms, math Correct Solution: ``` a=list(input()) print(''.join(a+a[::-1])) ```
output
1
38,143
20
76,287
Provide tags and a correct Python 3 solution for this coding contest problem. Pari has a friend who loves palindrome numbers. A palindrome number is a number that reads the same forward or backward. For example 12321, 100001 and 1 are palindrome numbers, while 112 and 1021 are not. Pari is trying to love them too, but only very special and gifted people can understand the beauty behind palindrome numbers. Pari loves integers with even length (i.e. the numbers with even number of digits), so she tries to see a lot of big palindrome numbers with even length (like a 2-digit 11 or 6-digit 122221), so maybe she could see something in them. Now Pari asks you to write a program that gets a huge integer n from the input and tells what is the n-th even-length positive palindrome number? Input The only line of the input contains a single integer n (1 ≤ n ≤ 10100 000). Output Print the n-th even-length palindrome number. Examples Input 1 Output 11 Input 10 Output 1001 Note The first 10 even-length palindrome numbers are 11, 22, 33, ... , 88, 99 and 1001.
instruction
0
38,144
20
76,288
Tags: constructive algorithms, math Correct Solution: ``` n = input().strip() print(n + n[::-1]) ```
output
1
38,144
20
76,289
Provide tags and a correct Python 3 solution for this coding contest problem. Pari has a friend who loves palindrome numbers. A palindrome number is a number that reads the same forward or backward. For example 12321, 100001 and 1 are palindrome numbers, while 112 and 1021 are not. Pari is trying to love them too, but only very special and gifted people can understand the beauty behind palindrome numbers. Pari loves integers with even length (i.e. the numbers with even number of digits), so she tries to see a lot of big palindrome numbers with even length (like a 2-digit 11 or 6-digit 122221), so maybe she could see something in them. Now Pari asks you to write a program that gets a huge integer n from the input and tells what is the n-th even-length positive palindrome number? Input The only line of the input contains a single integer n (1 ≤ n ≤ 10100 000). Output Print the n-th even-length palindrome number. Examples Input 1 Output 11 Input 10 Output 1001 Note The first 10 even-length palindrome numbers are 11, 22, 33, ... , 88, 99 and 1001.
instruction
0
38,145
20
76,290
Tags: constructive algorithms, math Correct Solution: ``` # your code goes here string =str(input()) print(string,end="") strina=string[::-1] print(strina,end="") ```
output
1
38,145
20
76,291
Provide tags and a correct Python 3 solution for this coding contest problem. Pari has a friend who loves palindrome numbers. A palindrome number is a number that reads the same forward or backward. For example 12321, 100001 and 1 are palindrome numbers, while 112 and 1021 are not. Pari is trying to love them too, but only very special and gifted people can understand the beauty behind palindrome numbers. Pari loves integers with even length (i.e. the numbers with even number of digits), so she tries to see a lot of big palindrome numbers with even length (like a 2-digit 11 or 6-digit 122221), so maybe she could see something in them. Now Pari asks you to write a program that gets a huge integer n from the input and tells what is the n-th even-length positive palindrome number? Input The only line of the input contains a single integer n (1 ≤ n ≤ 10100 000). Output Print the n-th even-length palindrome number. Examples Input 1 Output 11 Input 10 Output 1001 Note The first 10 even-length palindrome numbers are 11, 22, 33, ... , 88, 99 and 1001.
instruction
0
38,146
20
76,292
Tags: constructive algorithms, math Correct Solution: ``` ##n = int(input()) ##a = list(map(int, input().split())) ##print(" ".join(map(str, res))) s = list(input()) r = ['']*len(s) for i in range(len(s)): r[len(s)-1-i] = s[i] res = s+r print(''.join(map(str, res))) ```
output
1
38,146
20
76,293
Provide tags and a correct Python 3 solution for this coding contest problem. Pari has a friend who loves palindrome numbers. A palindrome number is a number that reads the same forward or backward. For example 12321, 100001 and 1 are palindrome numbers, while 112 and 1021 are not. Pari is trying to love them too, but only very special and gifted people can understand the beauty behind palindrome numbers. Pari loves integers with even length (i.e. the numbers with even number of digits), so she tries to see a lot of big palindrome numbers with even length (like a 2-digit 11 or 6-digit 122221), so maybe she could see something in them. Now Pari asks you to write a program that gets a huge integer n from the input and tells what is the n-th even-length positive palindrome number? Input The only line of the input contains a single integer n (1 ≤ n ≤ 10100 000). Output Print the n-th even-length palindrome number. Examples Input 1 Output 11 Input 10 Output 1001 Note The first 10 even-length palindrome numbers are 11, 22, 33, ... , 88, 99 and 1001.
instruction
0
38,147
20
76,294
Tags: constructive algorithms, math Correct Solution: ``` x = input() print (x + ''.join(reversed(x))) ```
output
1
38,147
20
76,295
Provide tags and a correct Python 3 solution for this coding contest problem. Pari has a friend who loves palindrome numbers. A palindrome number is a number that reads the same forward or backward. For example 12321, 100001 and 1 are palindrome numbers, while 112 and 1021 are not. Pari is trying to love them too, but only very special and gifted people can understand the beauty behind palindrome numbers. Pari loves integers with even length (i.e. the numbers with even number of digits), so she tries to see a lot of big palindrome numbers with even length (like a 2-digit 11 or 6-digit 122221), so maybe she could see something in them. Now Pari asks you to write a program that gets a huge integer n from the input and tells what is the n-th even-length positive palindrome number? Input The only line of the input contains a single integer n (1 ≤ n ≤ 10100 000). Output Print the n-th even-length palindrome number. Examples Input 1 Output 11 Input 10 Output 1001 Note The first 10 even-length palindrome numbers are 11, 22, 33, ... , 88, 99 and 1001.
instruction
0
38,148
20
76,296
Tags: constructive algorithms, math Correct Solution: ``` num = str(input()) print(str(num)+str(num)[::-1]) ```
output
1
38,148
20
76,297
Provide tags and a correct Python 3 solution for this coding contest problem. Pari has a friend who loves palindrome numbers. A palindrome number is a number that reads the same forward or backward. For example 12321, 100001 and 1 are palindrome numbers, while 112 and 1021 are not. Pari is trying to love them too, but only very special and gifted people can understand the beauty behind palindrome numbers. Pari loves integers with even length (i.e. the numbers with even number of digits), so she tries to see a lot of big palindrome numbers with even length (like a 2-digit 11 or 6-digit 122221), so maybe she could see something in them. Now Pari asks you to write a program that gets a huge integer n from the input and tells what is the n-th even-length positive palindrome number? Input The only line of the input contains a single integer n (1 ≤ n ≤ 10100 000). Output Print the n-th even-length palindrome number. Examples Input 1 Output 11 Input 10 Output 1001 Note The first 10 even-length palindrome numbers are 11, 22, 33, ... , 88, 99 and 1001.
instruction
0
38,149
20
76,298
Tags: constructive algorithms, math Correct Solution: ``` a = list(input()) b = list(reversed(a)) print("".join(a)+"".join(b)) ```
output
1
38,149
20
76,299
Provide tags and a correct Python 3 solution for this coding contest problem. Pari has a friend who loves palindrome numbers. A palindrome number is a number that reads the same forward or backward. For example 12321, 100001 and 1 are palindrome numbers, while 112 and 1021 are not. Pari is trying to love them too, but only very special and gifted people can understand the beauty behind palindrome numbers. Pari loves integers with even length (i.e. the numbers with even number of digits), so she tries to see a lot of big palindrome numbers with even length (like a 2-digit 11 or 6-digit 122221), so maybe she could see something in them. Now Pari asks you to write a program that gets a huge integer n from the input and tells what is the n-th even-length positive palindrome number? Input The only line of the input contains a single integer n (1 ≤ n ≤ 10100 000). Output Print the n-th even-length palindrome number. Examples Input 1 Output 11 Input 10 Output 1001 Note The first 10 even-length palindrome numbers are 11, 22, 33, ... , 88, 99 and 1001.
instruction
0
38,150
20
76,300
Tags: constructive algorithms, math Correct Solution: ``` n = input() n1="" for i in range(len(n)): n1+=n[len(n)-i-1] print(n, n1, sep="") ```
output
1
38,150
20
76,301
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Pari has a friend who loves palindrome numbers. A palindrome number is a number that reads the same forward or backward. For example 12321, 100001 and 1 are palindrome numbers, while 112 and 1021 are not. Pari is trying to love them too, but only very special and gifted people can understand the beauty behind palindrome numbers. Pari loves integers with even length (i.e. the numbers with even number of digits), so she tries to see a lot of big palindrome numbers with even length (like a 2-digit 11 or 6-digit 122221), so maybe she could see something in them. Now Pari asks you to write a program that gets a huge integer n from the input and tells what is the n-th even-length positive palindrome number? Input The only line of the input contains a single integer n (1 ≤ n ≤ 10100 000). Output Print the n-th even-length palindrome number. Examples Input 1 Output 11 Input 10 Output 1001 Note The first 10 even-length palindrome numbers are 11, 22, 33, ... , 88, 99 and 1001. Submitted Solution: ``` n=int(input()) n=(str)(n) a=n[-1::-1] print(n+a) ```
instruction
0
38,151
20
76,302
Yes
output
1
38,151
20
76,303
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Pari has a friend who loves palindrome numbers. A palindrome number is a number that reads the same forward or backward. For example 12321, 100001 and 1 are palindrome numbers, while 112 and 1021 are not. Pari is trying to love them too, but only very special and gifted people can understand the beauty behind palindrome numbers. Pari loves integers with even length (i.e. the numbers with even number of digits), so she tries to see a lot of big palindrome numbers with even length (like a 2-digit 11 or 6-digit 122221), so maybe she could see something in them. Now Pari asks you to write a program that gets a huge integer n from the input and tells what is the n-th even-length positive palindrome number? Input The only line of the input contains a single integer n (1 ≤ n ≤ 10100 000). Output Print the n-th even-length palindrome number. Examples Input 1 Output 11 Input 10 Output 1001 Note The first 10 even-length palindrome numbers are 11, 22, 33, ... , 88, 99 and 1001. Submitted Solution: ``` n = input() rn = n[::-1] print(n+rn) ```
instruction
0
38,152
20
76,304
Yes
output
1
38,152
20
76,305
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Pari has a friend who loves palindrome numbers. A palindrome number is a number that reads the same forward or backward. For example 12321, 100001 and 1 are palindrome numbers, while 112 and 1021 are not. Pari is trying to love them too, but only very special and gifted people can understand the beauty behind palindrome numbers. Pari loves integers with even length (i.e. the numbers with even number of digits), so she tries to see a lot of big palindrome numbers with even length (like a 2-digit 11 or 6-digit 122221), so maybe she could see something in them. Now Pari asks you to write a program that gets a huge integer n from the input and tells what is the n-th even-length positive palindrome number? Input The only line of the input contains a single integer n (1 ≤ n ≤ 10100 000). Output Print the n-th even-length palindrome number. Examples Input 1 Output 11 Input 10 Output 1001 Note The first 10 even-length palindrome numbers are 11, 22, 33, ... , 88, 99 and 1001. Submitted Solution: ``` n=input() s=n for i in range(len(n)): s=s+n[len(n)-1-i] print(s) ```
instruction
0
38,153
20
76,306
Yes
output
1
38,153
20
76,307
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Pari has a friend who loves palindrome numbers. A palindrome number is a number that reads the same forward or backward. For example 12321, 100001 and 1 are palindrome numbers, while 112 and 1021 are not. Pari is trying to love them too, but only very special and gifted people can understand the beauty behind palindrome numbers. Pari loves integers with even length (i.e. the numbers with even number of digits), so she tries to see a lot of big palindrome numbers with even length (like a 2-digit 11 or 6-digit 122221), so maybe she could see something in them. Now Pari asks you to write a program that gets a huge integer n from the input and tells what is the n-th even-length positive palindrome number? Input The only line of the input contains a single integer n (1 ≤ n ≤ 10100 000). Output Print the n-th even-length palindrome number. Examples Input 1 Output 11 Input 10 Output 1001 Note The first 10 even-length palindrome numbers are 11, 22, 33, ... , 88, 99 and 1001. Submitted Solution: ``` import sys, string #sys.stdin = open("apples.in","r") #sys.stdout = open("apples.out","w") n = sys.stdin.readline().strip() sys.stdout.write(str(n + n[::-1])) #sys.stdin.close() #sys.stdout.close() ```
instruction
0
38,154
20
76,308
Yes
output
1
38,154
20
76,309
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Pari has a friend who loves palindrome numbers. A palindrome number is a number that reads the same forward or backward. For example 12321, 100001 and 1 are palindrome numbers, while 112 and 1021 are not. Pari is trying to love them too, but only very special and gifted people can understand the beauty behind palindrome numbers. Pari loves integers with even length (i.e. the numbers with even number of digits), so she tries to see a lot of big palindrome numbers with even length (like a 2-digit 11 or 6-digit 122221), so maybe she could see something in them. Now Pari asks you to write a program that gets a huge integer n from the input and tells what is the n-th even-length positive palindrome number? Input The only line of the input contains a single integer n (1 ≤ n ≤ 10100 000). Output Print the n-th even-length palindrome number. Examples Input 1 Output 11 Input 10 Output 1001 Note The first 10 even-length palindrome numbers are 11, 22, 33, ... , 88, 99 and 1001. Submitted Solution: ``` n=int(input()) n=str(n) s=len(n) if(s==1): print('11') elif(s%2==0): s=s+1 r=10**s print(r+1) elif(s%2!=0): r=10**s print(r+1) ```
instruction
0
38,155
20
76,310
No
output
1
38,155
20
76,311
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Pari has a friend who loves palindrome numbers. A palindrome number is a number that reads the same forward or backward. For example 12321, 100001 and 1 are palindrome numbers, while 112 and 1021 are not. Pari is trying to love them too, but only very special and gifted people can understand the beauty behind palindrome numbers. Pari loves integers with even length (i.e. the numbers with even number of digits), so she tries to see a lot of big palindrome numbers with even length (like a 2-digit 11 or 6-digit 122221), so maybe she could see something in them. Now Pari asks you to write a program that gets a huge integer n from the input and tells what is the n-th even-length positive palindrome number? Input The only line of the input contains a single integer n (1 ≤ n ≤ 10100 000). Output Print the n-th even-length palindrome number. Examples Input 1 Output 11 Input 10 Output 1001 Note The first 10 even-length palindrome numbers are 11, 22, 33, ... , 88, 99 and 1001. Submitted Solution: ``` x = int(input()) g = 9 ans = 1 while x - g > 0: x -= g g = 10 * g + 9 ans *= 10 x -= 1 ans += x print(ans, end='') while ans > 0: print(ans % 10, end='') ans = ans // 10 print() ```
instruction
0
38,156
20
76,312
No
output
1
38,156
20
76,313
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Pari has a friend who loves palindrome numbers. A palindrome number is a number that reads the same forward or backward. For example 12321, 100001 and 1 are palindrome numbers, while 112 and 1021 are not. Pari is trying to love them too, but only very special and gifted people can understand the beauty behind palindrome numbers. Pari loves integers with even length (i.e. the numbers with even number of digits), so she tries to see a lot of big palindrome numbers with even length (like a 2-digit 11 or 6-digit 122221), so maybe she could see something in them. Now Pari asks you to write a program that gets a huge integer n from the input and tells what is the n-th even-length positive palindrome number? Input The only line of the input contains a single integer n (1 ≤ n ≤ 10100 000). Output Print the n-th even-length palindrome number. Examples Input 1 Output 11 Input 10 Output 1001 Note The first 10 even-length palindrome numbers are 11, 22, 33, ... , 88, 99 and 1001. Submitted Solution: ``` from math import ceil def solve(): n = int(input()) if n <= 9: return 2 * str(n) level = ceil((n-9)/18) idx = (n-9) if (n-9) % 18 == 0 else (n-9)%18 # print(level, idx) on_edge = ceil(idx/2) if idx % 2 == 0: return (level*2+2) * str(on_edge) return f'{on_edge}{level*2 * "0"}{on_edge}' print(solve()) ```
instruction
0
38,157
20
76,314
No
output
1
38,157
20
76,315
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Pari has a friend who loves palindrome numbers. A palindrome number is a number that reads the same forward or backward. For example 12321, 100001 and 1 are palindrome numbers, while 112 and 1021 are not. Pari is trying to love them too, but only very special and gifted people can understand the beauty behind palindrome numbers. Pari loves integers with even length (i.e. the numbers with even number of digits), so she tries to see a lot of big palindrome numbers with even length (like a 2-digit 11 or 6-digit 122221), so maybe she could see something in them. Now Pari asks you to write a program that gets a huge integer n from the input and tells what is the n-th even-length positive palindrome number? Input The only line of the input contains a single integer n (1 ≤ n ≤ 10100 000). Output Print the n-th even-length palindrome number. Examples Input 1 Output 11 Input 10 Output 1001 Note The first 10 even-length palindrome numbers are 11, 22, 33, ... , 88, 99 and 1001. Submitted Solution: ``` n =input() l = len(n) a="" if n==n[::-1] and l%2==0: print(n) # elif n==n[::-1] and l%2==1: # # a+=n # a+=n[-1] # print(a) else: a+=n a+=n[::-1] print(a) ```
instruction
0
38,158
20
76,316
No
output
1
38,158
20
76,317
Provide tags and a correct Python 3 solution for this coding contest problem. Petya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Petya has a number consisting of n digits without leading zeroes. He represented it as an array of digits without leading zeroes. Let's call it d. The numeration starts with 1, starting from the most significant digit. Petya wants to perform the following operation k times: find the minimum x (1 ≤ x < n) such that dx = 4 and dx + 1 = 7, if x is odd, then to assign dx = dx + 1 = 4, otherwise to assign dx = dx + 1 = 7. Note that if no x was found, then the operation counts as completed and the array doesn't change at all. You are given the initial number as an array of digits and the number k. Help Petya find the result of completing k operations. Input The first line contains two integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 109) — the number of digits in the number and the number of completed operations. The second line contains n digits without spaces representing the array of digits d, starting with d1. It is guaranteed that the first digit of the number does not equal zero. Output In the single line print the result without spaces — the number after the k operations are fulfilled. Examples Input 7 4 4727447 Output 4427477 Input 4 2 4478 Output 4478 Note In the first sample the number changes in the following sequence: 4727447 → 4427447 → 4427477 → 4427447 → 4427477. In the second sample: 4478 → 4778 → 4478.
instruction
0
38,737
20
77,474
Tags: strings Correct Solution: ``` import sys input=sys.stdin.readline from math import * n,m=map(int,input().split()) s=list(input().rstrip()) for i in range(n-1): if m==0: break if i>0: if s[i-1]=='4' and s[i]=='4' and s[i+1]=='7' and i%2==1: if m%2==1: s[i]='7' break if s[i]=='4' and s[i+1]=='7': if i%2==0: s[i]='4' s[i+1]='4' else: s[i]='7' m-=1 #print(s) print("".join(s)) ```
output
1
38,737
20
77,475
Provide tags and a correct Python 3 solution for this coding contest problem. Petya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Petya has a number consisting of n digits without leading zeroes. He represented it as an array of digits without leading zeroes. Let's call it d. The numeration starts with 1, starting from the most significant digit. Petya wants to perform the following operation k times: find the minimum x (1 ≤ x < n) such that dx = 4 and dx + 1 = 7, if x is odd, then to assign dx = dx + 1 = 4, otherwise to assign dx = dx + 1 = 7. Note that if no x was found, then the operation counts as completed and the array doesn't change at all. You are given the initial number as an array of digits and the number k. Help Petya find the result of completing k operations. Input The first line contains two integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 109) — the number of digits in the number and the number of completed operations. The second line contains n digits without spaces representing the array of digits d, starting with d1. It is guaranteed that the first digit of the number does not equal zero. Output In the single line print the result without spaces — the number after the k operations are fulfilled. Examples Input 7 4 4727447 Output 4427477 Input 4 2 4478 Output 4478 Note In the first sample the number changes in the following sequence: 4727447 → 4427447 → 4427477 → 4427447 → 4427477. In the second sample: 4478 → 4778 → 4478.
instruction
0
38,738
20
77,476
Tags: strings Correct Solution: ``` #------------------------------warmup---------------------------- import os import sys import math from io import BytesIO, IOBase from fractions import Fraction BUFSIZE = 8192 class FastIO(IOBase): newlines = 0 def __init__(self, file): self._fd = file.fileno() self.buffer = BytesIO() self.writable = "x" in file.mode or "r" not in file.mode self.write = self.buffer.write if self.writable else None def read(self): while True: b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE)) if not b: break ptr = self.buffer.tell() self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr) self.newlines = 0 return self.buffer.read() def readline(self): while self.newlines == 0: b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE)) self.newlines = b.count(b"\n") + (not b) ptr = self.buffer.tell() self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr) self.newlines -= 1 return self.buffer.readline() def flush(self): if self.writable: os.write(self._fd, self.buffer.getvalue()) self.buffer.truncate(0), self.buffer.seek(0) class IOWrapper(IOBase): def __init__(self, file): self.buffer = FastIO(file) self.flush = self.buffer.flush self.writable = self.buffer.writable self.write = lambda s: self.buffer.write(s.encode("ascii")) self.read = lambda: self.buffer.read().decode("ascii") self.readline = lambda: self.buffer.readline().decode("ascii") sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout) input = lambda: sys.stdin.readline().rstrip("\r\n") #-------------------game starts now---------------------------------------------------- import sys input=sys.stdin.readline from math import * n,m=map(int,input().split()) s=list(input().rstrip()) for i in range(n-1): if m==0: break if i>0: if s[i-1]=='4' and s[i]=='4' and s[i+1]=='7' and i%2==1: if m%2==1: s[i]='7' break if s[i]=='4' and s[i+1]=='7': if i%2==0: s[i]='4' s[i+1]='4' else: s[i]='7' m-=1 #print(s) print("".join(s)) ```
output
1
38,738
20
77,477
Provide tags and a correct Python 3 solution for this coding contest problem. Petya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Petya has a number consisting of n digits without leading zeroes. He represented it as an array of digits without leading zeroes. Let's call it d. The numeration starts with 1, starting from the most significant digit. Petya wants to perform the following operation k times: find the minimum x (1 ≤ x < n) such that dx = 4 and dx + 1 = 7, if x is odd, then to assign dx = dx + 1 = 4, otherwise to assign dx = dx + 1 = 7. Note that if no x was found, then the operation counts as completed and the array doesn't change at all. You are given the initial number as an array of digits and the number k. Help Petya find the result of completing k operations. Input The first line contains two integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 109) — the number of digits in the number and the number of completed operations. The second line contains n digits without spaces representing the array of digits d, starting with d1. It is guaranteed that the first digit of the number does not equal zero. Output In the single line print the result without spaces — the number after the k operations are fulfilled. Examples Input 7 4 4727447 Output 4427477 Input 4 2 4478 Output 4478 Note In the first sample the number changes in the following sequence: 4727447 → 4427447 → 4427477 → 4427447 → 4427477. In the second sample: 4478 → 4778 → 4478.
instruction
0
38,739
20
77,478
Tags: strings Correct Solution: ``` n, k = map(int, input().split()) s = list(input()) for i in range(10): s.append('0') i = 0 while i < n and k: if s[i] == '4' and s[i+1] == '7' and s[i+2] == '7' and not (i & 1): k %= 2 if k and s[i] == '4' and s[i+1] == '7': if i & 1: s[i] = s[i+1] else: s[i+1] = s[i] i -= 2 k -= 1 i += 1 ans = '' for i in range(n): ans += s[i] print(ans) ```
output
1
38,739
20
77,479
Provide tags and a correct Python 3 solution for this coding contest problem. Petya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Petya has a number consisting of n digits without leading zeroes. He represented it as an array of digits without leading zeroes. Let's call it d. The numeration starts with 1, starting from the most significant digit. Petya wants to perform the following operation k times: find the minimum x (1 ≤ x < n) such that dx = 4 and dx + 1 = 7, if x is odd, then to assign dx = dx + 1 = 4, otherwise to assign dx = dx + 1 = 7. Note that if no x was found, then the operation counts as completed and the array doesn't change at all. You are given the initial number as an array of digits and the number k. Help Petya find the result of completing k operations. Input The first line contains two integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 109) — the number of digits in the number and the number of completed operations. The second line contains n digits without spaces representing the array of digits d, starting with d1. It is guaranteed that the first digit of the number does not equal zero. Output In the single line print the result without spaces — the number after the k operations are fulfilled. Examples Input 7 4 4727447 Output 4427477 Input 4 2 4478 Output 4478 Note In the first sample the number changes in the following sequence: 4727447 → 4427447 → 4427477 → 4427447 → 4427477. In the second sample: 4478 → 4778 → 4478.
instruction
0
38,740
20
77,480
Tags: strings Correct Solution: ``` from math import * from collections import deque from copy import deepcopy import sys def inp(): return sys.stdin.readline().rstrip("\r\n") #for fast input def multi(): return map(int,input().split()) def strmulti(): return map(str, inp().split()) def lis(): return list(map(int, inp().split())) def lcm(a,b): return (a*b)//gcd(a,b) def ncr(n,r): return factorial(n) // (factorial(r) * factorial(max(n - r, 1))) def stringlis(): return list(map(str, inp().split())) def out(var): sys.stdout.write(str(var)) #for fast output, always take string def printlist(a) : print(' '.join(str(a[i]) for i in range(len(a)))) def isPrime(n) : if (n <= 1) : return False if (n <= 3) : return True if (n % 2 == 0 or n % 3 == 0) : return False i = 5 while(i * i <= n) : if (n % i == 0 or n % (i + 2) == 0) : return False i = i + 6 return True #copied functions end #start coding n,k=multi() s=inp() a=list(s) count=0 for i in range(1,len(a)): if(i>1): if(a[i-2]=='4' and (a[i-1]=='4' and a[i]=='7' and count<k)): if((k-count)%2!=0): if(i%2==0): a[i-2]='4' a[i-1]='7' a[i]='7' break if(i%2==0): break if(a[i-1]=='4' and a[i]=='7' and count<k): count+=1 if((i)%2!=0): a[i-1]=a[i]='4' else: a[i-1]=a[i]='7' continue for i in a: print(i,end="") ```
output
1
38,740
20
77,481
Provide tags and a correct Python 3 solution for this coding contest problem. Petya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Petya has a number consisting of n digits without leading zeroes. He represented it as an array of digits without leading zeroes. Let's call it d. The numeration starts with 1, starting from the most significant digit. Petya wants to perform the following operation k times: find the minimum x (1 ≤ x < n) such that dx = 4 and dx + 1 = 7, if x is odd, then to assign dx = dx + 1 = 4, otherwise to assign dx = dx + 1 = 7. Note that if no x was found, then the operation counts as completed and the array doesn't change at all. You are given the initial number as an array of digits and the number k. Help Petya find the result of completing k operations. Input The first line contains two integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 109) — the number of digits in the number and the number of completed operations. The second line contains n digits without spaces representing the array of digits d, starting with d1. It is guaranteed that the first digit of the number does not equal zero. Output In the single line print the result without spaces — the number after the k operations are fulfilled. Examples Input 7 4 4727447 Output 4427477 Input 4 2 4478 Output 4478 Note In the first sample the number changes in the following sequence: 4727447 → 4427447 → 4427477 → 4427447 → 4427477. In the second sample: 4478 → 4778 → 4478.
instruction
0
38,741
20
77,482
Tags: strings Correct Solution: ``` """ Author - Satwik Tiwari . 2nd NOV , 2020 - Monday """ #=============================================================================================== #importing some useful libraries. from __future__ import division, print_function from fractions import Fraction import sys import os from io import BytesIO, IOBase from functools import cmp_to_key # from itertools import * from heapq import * from math import gcd, factorial,floor,ceil,sqrt from copy import deepcopy from collections import deque from bisect import bisect_left as bl from bisect import bisect_right as br from bisect import bisect #============================================================================================== #fast I/O region BUFSIZE = 8192 class FastIO(IOBase): newlines = 0 def __init__(self, file): self._fd = file.fileno() self.buffer = BytesIO() self.writable = "x" in file.mode or "r" not in file.mode self.write = self.buffer.write if self.writable else None def read(self): while True: b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE)) if not b: break ptr = self.buffer.tell() self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr) self.newlines = 0 return self.buffer.read() def readline(self): while self.newlines == 0: b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE)) self.newlines = b.count(b"\n") + (not b) ptr = self.buffer.tell() self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr) self.newlines -= 1 return self.buffer.readline() def flush(self): if self.writable: os.write(self._fd, self.buffer.getvalue()) self.buffer.truncate(0), self.buffer.seek(0) class IOWrapper(IOBase): def __init__(self, file): self.buffer = FastIO(file) self.flush = self.buffer.flush self.writable = self.buffer.writable self.write = lambda s: self.buffer.write(s.encode("ascii")) self.read = lambda: self.buffer.read().decode("ascii") self.readline = lambda: self.buffer.readline().decode("ascii") def print(*args, **kwargs): """Prints the values to a stream, or to sys.stdout by default.""" sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout) at_start = True for x in args: if not at_start: file.write(sep) file.write(str(x)) at_start = False file.write(kwargs.pop("end", "\n")) if kwargs.pop("flush", False): file.flush() if sys.version_info[0] < 3: sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout) else: sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout) # inp = lambda: sys.stdin.readline().rstrip("\r\n") #=============================================================================================== ### START ITERATE RECURSION ### from types import GeneratorType def iterative(f, stack=[]): def wrapped_func(*args, **kwargs): if stack: return f(*args, **kwargs) to = f(*args, **kwargs) while True: if type(to) is GeneratorType: stack.append(to) to = next(to) continue stack.pop() if not stack: break to = stack[-1].send(to) return to return wrapped_func #### END ITERATE RECURSION #### #=============================================================================================== #some shortcuts def inp(): return sys.stdin.readline().rstrip("\r\n") #for fast input def out(var): sys.stdout.write(str(var)) #for fast output, always take string def lis(): return list(map(int, inp().split())) def stringlis(): return list(map(str, inp().split())) def sep(): return map(int, inp().split()) def strsep(): return map(str, inp().split()) # def graph(vertex): return [[] for i in range(0,vertex+1)] def zerolist(n): return [0]*n def nextline(): out("\n") #as stdout.write always print sring. def testcase(t): for pp in range(t): solve(pp) def printlist(a) : for p in range(0,len(a)): out(str(a[p]) + ' ') def google(p): print('Case #'+str(p)+': ',end='') def lcm(a,b): return (a*b)//gcd(a,b) def power(x, y, p) : y%=(p-1) #not so sure about this. used when y>p-1. if p is prime. res = 1 # Initialize result x = x % p # Update x if it is more , than or equal to p if (x == 0) : return 0 while (y > 0) : if ((y & 1) == 1) : # If y is odd, multiply, x with result res = (res * x) % p y = y >> 1 # y = y/2 x = (x * x) % p return res def ncr(n,r): return factorial(n) // (factorial(r) * factorial(max(n - r, 1))) def isPrime(n) : if (n <= 1) : return False if (n <= 3) : return True if (n % 2 == 0 or n % 3 == 0) : return False i = 5 while(i * i <= n) : if (n % i == 0 or n % (i + 2) == 0) : return False i = i + 6 return True inf = pow(10,20) mod = 10**9+7 #=============================================================================================== # code here ;)) def solve(case): n,m = sep() a = list(inp()) for i in range(n): a[i] = int(a[i]) # ind = -1 # for i in range(n-2): # if(a[i] == 4 and a[i+1] == 4 and a[i+2] == 7): # ind = i # break for i in range(n-1): if(m==0): break if(a[i] == 4 and a[i+1] == 7): if(i>0 and a[i-1] == 4 and i%2==1): if(m%2==1): a[i] = 7 break if(i%2==0): a[i+1] = 4 m-=1 else: a[i] = 7 m-=1 print(''.join(str(a[i]) for i in range(n))) testcase(1) # testcase(int(inp())) ```
output
1
38,741
20
77,483
Provide tags and a correct Python 3 solution for this coding contest problem. Petya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Petya has a number consisting of n digits without leading zeroes. He represented it as an array of digits without leading zeroes. Let's call it d. The numeration starts with 1, starting from the most significant digit. Petya wants to perform the following operation k times: find the minimum x (1 ≤ x < n) such that dx = 4 and dx + 1 = 7, if x is odd, then to assign dx = dx + 1 = 4, otherwise to assign dx = dx + 1 = 7. Note that if no x was found, then the operation counts as completed and the array doesn't change at all. You are given the initial number as an array of digits and the number k. Help Petya find the result of completing k operations. Input The first line contains two integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 109) — the number of digits in the number and the number of completed operations. The second line contains n digits without spaces representing the array of digits d, starting with d1. It is guaranteed that the first digit of the number does not equal zero. Output In the single line print the result without spaces — the number after the k operations are fulfilled. Examples Input 7 4 4727447 Output 4427477 Input 4 2 4478 Output 4478 Note In the first sample the number changes in the following sequence: 4727447 → 4427447 → 4427477 → 4427447 → 4427477. In the second sample: 4478 → 4778 → 4478.
instruction
0
38,742
20
77,484
Tags: strings Correct Solution: ``` n, k = map(int, input().split()) t = list(input()) i = 0 while k and i < n - 1: if t[i] == '4' and t[i + 1] == '7': k -= 1 if i & 1 == 0: t[i + 1] = '4' else: if i > 0 and t[i - 1] == '4': if k & 1 == 0: t[i] = '7' break t[i] = '7' i -= 2 i += 1 print(''.join(t)) # Made By Mostafa_Khaled ```
output
1
38,742
20
77,485
Provide tags and a correct Python 3 solution for this coding contest problem. Petya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Petya has a number consisting of n digits without leading zeroes. He represented it as an array of digits without leading zeroes. Let's call it d. The numeration starts with 1, starting from the most significant digit. Petya wants to perform the following operation k times: find the minimum x (1 ≤ x < n) such that dx = 4 and dx + 1 = 7, if x is odd, then to assign dx = dx + 1 = 4, otherwise to assign dx = dx + 1 = 7. Note that if no x was found, then the operation counts as completed and the array doesn't change at all. You are given the initial number as an array of digits and the number k. Help Petya find the result of completing k operations. Input The first line contains two integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 109) — the number of digits in the number and the number of completed operations. The second line contains n digits without spaces representing the array of digits d, starting with d1. It is guaranteed that the first digit of the number does not equal zero. Output In the single line print the result without spaces — the number after the k operations are fulfilled. Examples Input 7 4 4727447 Output 4427477 Input 4 2 4478 Output 4478 Note In the first sample the number changes in the following sequence: 4727447 → 4427447 → 4427477 → 4427447 → 4427477. In the second sample: 4478 → 4778 → 4478.
instruction
0
38,743
20
77,486
Tags: strings Correct Solution: ``` n, k = map(int, input().split()) s = [i for i in input()] flag = False for i in range(len(s)-1): if k == 0: break if s[i] == "4" and s[i+1] == "7": if i % 2 == 0: s[i] = "4" s[i+1] = "4" k -= 1 else: if i != 0 and s[i-1] == "4": k %= 2 if k == 1: s[i] = "7" k -= 1 else: s[i] = "7" s[i+1] = "7" k -= 1 print(*s, sep="") ```
output
1
38,743
20
77,487
Provide tags and a correct Python 3 solution for this coding contest problem. Petya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Petya has a number consisting of n digits without leading zeroes. He represented it as an array of digits without leading zeroes. Let's call it d. The numeration starts with 1, starting from the most significant digit. Petya wants to perform the following operation k times: find the minimum x (1 ≤ x < n) such that dx = 4 and dx + 1 = 7, if x is odd, then to assign dx = dx + 1 = 4, otherwise to assign dx = dx + 1 = 7. Note that if no x was found, then the operation counts as completed and the array doesn't change at all. You are given the initial number as an array of digits and the number k. Help Petya find the result of completing k operations. Input The first line contains two integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 109) — the number of digits in the number and the number of completed operations. The second line contains n digits without spaces representing the array of digits d, starting with d1. It is guaranteed that the first digit of the number does not equal zero. Output In the single line print the result without spaces — the number after the k operations are fulfilled. Examples Input 7 4 4727447 Output 4427477 Input 4 2 4478 Output 4478 Note In the first sample the number changes in the following sequence: 4727447 → 4427447 → 4427477 → 4427447 → 4427477. In the second sample: 4478 → 4778 → 4478.
instruction
0
38,744
20
77,488
Tags: strings Correct Solution: ``` n, k = map(int, input().split()) t = list(input()) i, m = 0, n // 2 if k > m: k = m + ((m + k) & 1) while k and i < n - 1: if t[i] == '4' and t[i + 1] == '7': k -= 1 if i & 1 == 0: t[i + 1] = '4' else: t[i] = '7' i -= 2 i += 1 print(''.join(t)) ```
output
1
38,744
20
77,489
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Petya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Petya has a number consisting of n digits without leading zeroes. He represented it as an array of digits without leading zeroes. Let's call it d. The numeration starts with 1, starting from the most significant digit. Petya wants to perform the following operation k times: find the minimum x (1 ≤ x < n) such that dx = 4 and dx + 1 = 7, if x is odd, then to assign dx = dx + 1 = 4, otherwise to assign dx = dx + 1 = 7. Note that if no x was found, then the operation counts as completed and the array doesn't change at all. You are given the initial number as an array of digits and the number k. Help Petya find the result of completing k operations. Input The first line contains two integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 109) — the number of digits in the number and the number of completed operations. The second line contains n digits without spaces representing the array of digits d, starting with d1. It is guaranteed that the first digit of the number does not equal zero. Output In the single line print the result without spaces — the number after the k operations are fulfilled. Examples Input 7 4 4727447 Output 4427477 Input 4 2 4478 Output 4478 Note In the first sample the number changes in the following sequence: 4727447 → 4427447 → 4427477 → 4427447 → 4427477. In the second sample: 4478 → 4778 → 4478. Submitted Solution: ``` def b3_lucky_transformation(n, k, s): i = 1 while k and i < n: if s[i] == '4' and s[i+1] == '7': if s[i-1] == '4' and i % 2 == 0: if k % 2 == 1: s[i] = '7' k = 0 else: if i % 2 == 0: s[i] = '7' i += 2 k -= 1 else: s[i+1] = '4' i +=1 k -=1 else: i +=1 return s if __name__ == "__main__": [n, k] = map(int, input().split()) s = input() s = ' ' + s s = list(s) result = b3_lucky_transformation(n, k, s) for i in range (1,n+1): print(result[i],end='') ```
instruction
0
38,745
20
77,490
Yes
output
1
38,745
20
77,491
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Petya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Petya has a number consisting of n digits without leading zeroes. He represented it as an array of digits without leading zeroes. Let's call it d. The numeration starts with 1, starting from the most significant digit. Petya wants to perform the following operation k times: find the minimum x (1 ≤ x < n) such that dx = 4 and dx + 1 = 7, if x is odd, then to assign dx = dx + 1 = 4, otherwise to assign dx = dx + 1 = 7. Note that if no x was found, then the operation counts as completed and the array doesn't change at all. You are given the initial number as an array of digits and the number k. Help Petya find the result of completing k operations. Input The first line contains two integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 109) — the number of digits in the number and the number of completed operations. The second line contains n digits without spaces representing the array of digits d, starting with d1. It is guaranteed that the first digit of the number does not equal zero. Output In the single line print the result without spaces — the number after the k operations are fulfilled. Examples Input 7 4 4727447 Output 4427477 Input 4 2 4478 Output 4478 Note In the first sample the number changes in the following sequence: 4727447 → 4427447 → 4427477 → 4427447 → 4427477. In the second sample: 4478 → 4778 → 4478. Submitted Solution: ``` n , k = map(int, input().split()) p = input() v = [0] for i in p: v.append(int(i)) # print(v) for i in range(1, n+1): if k == 0: break if i != n and v[i] == 4 and v[i+1] == 7: # loop infinito # print("oi") if v[i-1] == 4 and i%2 == 0: if k % 2 == 0: k = 0 break else: v[i] = 7 v[i+1] = 7 k = 0 break else: if i%2 == 0: v[i] = 7 v[i+1] = 7 k-=1 elif i%2 == 1: v[i] = 4 v[i+1] = 4 k-=1 for i in range(1,n+1): print(v[i], end='') print() ```
instruction
0
38,746
20
77,492
Yes
output
1
38,746
20
77,493
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Petya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Petya has a number consisting of n digits without leading zeroes. He represented it as an array of digits without leading zeroes. Let's call it d. The numeration starts with 1, starting from the most significant digit. Petya wants to perform the following operation k times: find the minimum x (1 ≤ x < n) such that dx = 4 and dx + 1 = 7, if x is odd, then to assign dx = dx + 1 = 4, otherwise to assign dx = dx + 1 = 7. Note that if no x was found, then the operation counts as completed and the array doesn't change at all. You are given the initial number as an array of digits and the number k. Help Petya find the result of completing k operations. Input The first line contains two integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 109) — the number of digits in the number and the number of completed operations. The second line contains n digits without spaces representing the array of digits d, starting with d1. It is guaranteed that the first digit of the number does not equal zero. Output In the single line print the result without spaces — the number after the k operations are fulfilled. Examples Input 7 4 4727447 Output 4427477 Input 4 2 4478 Output 4478 Note In the first sample the number changes in the following sequence: 4727447 → 4427447 → 4427477 → 4427447 → 4427477. In the second sample: 4478 → 4778 → 4478. Submitted Solution: ``` n, k = map(int, input().split()) s, x = list(input()), 0 for i in range(k): while x < n - 1 and not(s[x] == '4' and s[x+1] == '7'): x += 1 if x == n - 1: break if x % 2: if s[x-1] == '4' and (k + i + 1) % 2: break s[x], x = '7', x - 1 else: if x < n - 2 and s[x+2] == '7' and (k + i + 1) % 2: break s[x+1], x = '4', x + 1 print(''.join(s)) ```
instruction
0
38,747
20
77,494
Yes
output
1
38,747
20
77,495
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Petya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Petya has a number consisting of n digits without leading zeroes. He represented it as an array of digits without leading zeroes. Let's call it d. The numeration starts with 1, starting from the most significant digit. Petya wants to perform the following operation k times: find the minimum x (1 ≤ x < n) such that dx = 4 and dx + 1 = 7, if x is odd, then to assign dx = dx + 1 = 4, otherwise to assign dx = dx + 1 = 7. Note that if no x was found, then the operation counts as completed and the array doesn't change at all. You are given the initial number as an array of digits and the number k. Help Petya find the result of completing k operations. Input The first line contains two integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 109) — the number of digits in the number and the number of completed operations. The second line contains n digits without spaces representing the array of digits d, starting with d1. It is guaranteed that the first digit of the number does not equal zero. Output In the single line print the result without spaces — the number after the k operations are fulfilled. Examples Input 7 4 4727447 Output 4427477 Input 4 2 4478 Output 4478 Note In the first sample the number changes in the following sequence: 4727447 → 4427447 → 4427477 → 4427447 → 4427477. In the second sample: 4478 → 4778 → 4478. Submitted Solution: ``` n,k=map(int,input().split()) s = list(input()) i=0 while i<n-1 and k>0: if s[i]=='4' and s[i+1]=='7': k-=1 if (i%2)==0: s[i]='4' s[i+1]='4' else: s[i]='7' if i-1>=0 and s[i-1]=='4': i -= 2 k = k%2 i+=1 print (''.join(s)) ```
instruction
0
38,748
20
77,496
Yes
output
1
38,748
20
77,497
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Petya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Petya has a number consisting of n digits without leading zeroes. He represented it as an array of digits without leading zeroes. Let's call it d. The numeration starts with 1, starting from the most significant digit. Petya wants to perform the following operation k times: find the minimum x (1 ≤ x < n) such that dx = 4 and dx + 1 = 7, if x is odd, then to assign dx = dx + 1 = 4, otherwise to assign dx = dx + 1 = 7. Note that if no x was found, then the operation counts as completed and the array doesn't change at all. You are given the initial number as an array of digits and the number k. Help Petya find the result of completing k operations. Input The first line contains two integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 109) — the number of digits in the number and the number of completed operations. The second line contains n digits without spaces representing the array of digits d, starting with d1. It is guaranteed that the first digit of the number does not equal zero. Output In the single line print the result without spaces — the number after the k operations are fulfilled. Examples Input 7 4 4727447 Output 4427477 Input 4 2 4478 Output 4478 Note In the first sample the number changes in the following sequence: 4727447 → 4427447 → 4427477 → 4427447 → 4427477. In the second sample: 4478 → 4778 → 4478. Submitted Solution: ``` n, k = map(int, input().split()) s, x = list(input()), 0 for i in range(k): while x < n - 1 and not(s[x] == '4' and s[x+1] == '7'): x += 1 if x == n - 1: break if x % 2: if s[x-1] == '4' and (k + i + 1) % 2: break s[x], x = '7', x - 1 else: if x < n - 2 and s[x+2] == '7' and (k + i + 1) % 2: break x, s[x+1] = x + 1, '4' print(''.join(s)) ```
instruction
0
38,749
20
77,498
No
output
1
38,749
20
77,499
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Petya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Petya has a number consisting of n digits without leading zeroes. He represented it as an array of digits without leading zeroes. Let's call it d. The numeration starts with 1, starting from the most significant digit. Petya wants to perform the following operation k times: find the minimum x (1 ≤ x < n) such that dx = 4 and dx + 1 = 7, if x is odd, then to assign dx = dx + 1 = 4, otherwise to assign dx = dx + 1 = 7. Note that if no x was found, then the operation counts as completed and the array doesn't change at all. You are given the initial number as an array of digits and the number k. Help Petya find the result of completing k operations. Input The first line contains two integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 109) — the number of digits in the number and the number of completed operations. The second line contains n digits without spaces representing the array of digits d, starting with d1. It is guaranteed that the first digit of the number does not equal zero. Output In the single line print the result without spaces — the number after the k operations are fulfilled. Examples Input 7 4 4727447 Output 4427477 Input 4 2 4478 Output 4478 Note In the first sample the number changes in the following sequence: 4727447 → 4427447 → 4427477 → 4427447 → 4427477. In the second sample: 4478 → 4778 → 4478. Submitted Solution: ``` from math import * from collections import deque from copy import deepcopy import sys def inp(): return sys.stdin.readline().rstrip("\r\n") #for fast input def multi(): return map(int,input().split()) def strmulti(): return map(str, inp().split()) def lis(): return list(map(int, inp().split())) def lcm(a,b): return (a*b)//gcd(a,b) def ncr(n,r): return factorial(n) // (factorial(r) * factorial(max(n - r, 1))) def stringlis(): return list(map(str, inp().split())) def out(var): sys.stdout.write(str(var)) #for fast output, always take string def printlist(a) : print(' '.join(str(a[i]) for i in range(len(a)))) def isPrime(n) : if (n <= 1) : return False if (n <= 3) : return True if (n % 2 == 0 or n % 3 == 0) : return False i = 5 while(i * i <= n) : if (n % i == 0 or n % (i + 2) == 0) : return False i = i + 6 return True #copied functions end #start coding n,k=multi() s=inp() a=list(s) count=0 for i in range(1,len(a)): if(i!=0): if(a[i-2]=='4' and (a[i-1]=='4' and a[i]=='7' and count<k) and i%2==0): if((k-count)%2!=0): if(i%2==0): a[i-2]='4' a[i-1]='7' a[i]='7' else: a[i - 2] = '4' a[i - 1] = '4' a[i] = '7' break if(a[i-1]=='4' and a[i]=='7' and count<k): count+=1 if((i)%2!=0): a[i-1]=a[i]='4' else: a[i-1]=a[i]='7' continue for i in a: print(i,end="") ```
instruction
0
38,750
20
77,500
No
output
1
38,750
20
77,501
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Petya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Petya has a number consisting of n digits without leading zeroes. He represented it as an array of digits without leading zeroes. Let's call it d. The numeration starts with 1, starting from the most significant digit. Petya wants to perform the following operation k times: find the minimum x (1 ≤ x < n) such that dx = 4 and dx + 1 = 7, if x is odd, then to assign dx = dx + 1 = 4, otherwise to assign dx = dx + 1 = 7. Note that if no x was found, then the operation counts as completed and the array doesn't change at all. You are given the initial number as an array of digits and the number k. Help Petya find the result of completing k operations. Input The first line contains two integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 109) — the number of digits in the number and the number of completed operations. The second line contains n digits without spaces representing the array of digits d, starting with d1. It is guaranteed that the first digit of the number does not equal zero. Output In the single line print the result without spaces — the number after the k operations are fulfilled. Examples Input 7 4 4727447 Output 4427477 Input 4 2 4478 Output 4478 Note In the first sample the number changes in the following sequence: 4727447 → 4427447 → 4427477 → 4427447 → 4427477. In the second sample: 4478 → 4778 → 4478. Submitted Solution: ``` n, k = map(int, input().split()) s = [i for i in input()] flag = False for i in range(len(s)-1): if k == 0: break if s[i] == "4" and s[i+1] == "7": if i % 2 == 0: s[i] = "4" s[i+1] = "4" k -= 1 else: if i != 0 and s[i-1] == "4": k %= 2 if k == 1: s[i] = "7" else: s[i] = "7" s[i+1] = "7" k -= 1 print(*s, sep="") ```
instruction
0
38,751
20
77,502
No
output
1
38,751
20
77,503
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Petya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Petya has a number consisting of n digits without leading zeroes. He represented it as an array of digits without leading zeroes. Let's call it d. The numeration starts with 1, starting from the most significant digit. Petya wants to perform the following operation k times: find the minimum x (1 ≤ x < n) such that dx = 4 and dx + 1 = 7, if x is odd, then to assign dx = dx + 1 = 4, otherwise to assign dx = dx + 1 = 7. Note that if no x was found, then the operation counts as completed and the array doesn't change at all. You are given the initial number as an array of digits and the number k. Help Petya find the result of completing k operations. Input The first line contains two integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 109) — the number of digits in the number and the number of completed operations. The second line contains n digits without spaces representing the array of digits d, starting with d1. It is guaranteed that the first digit of the number does not equal zero. Output In the single line print the result without spaces — the number after the k operations are fulfilled. Examples Input 7 4 4727447 Output 4427477 Input 4 2 4478 Output 4478 Note In the first sample the number changes in the following sequence: 4727447 → 4427447 → 4427477 → 4427447 → 4427477. In the second sample: 4478 → 4778 → 4478. Submitted Solution: ``` import sys input=sys.stdin.readline from math import * n,m=map(int,input().split()) s=list(input().rstrip()) for i in range(n-1): if i>0: if s[i-1]=='4' and s[i]=='4' and s[i+1]=='7' and i%2==1: if m%2==1: s[i]='7' break elif s[i]=='4' and s[i+1]=='7': if i%2==0: s[i]='4' s[i+1]='4' else: s[i]='7' m-=1 print("".join(s)) ```
instruction
0
38,752
20
77,504
No
output
1
38,752
20
77,505
Provide tags and a correct Python 3 solution for this coding contest problem. Top-model Izabella participates in the competition. She wants to impress judges and show her mathematical skills. Her problem is following: for given string, consisting of only 0 and 1, tell if it's possible to remove some digits in such a way, that remaining number is a representation of some positive integer, divisible by 64, in the binary numerical system. Input In the only line given a non-empty binary string s with length up to 100. Output Print «yes» (without quotes) if it's possible to remove digits required way and «no» otherwise. Examples Input 100010001 Output yes Input 100 Output no Note In the first test case, you can get string 1 000 000 after removing two ones which is a representation of number 64 in the binary numerical system. You can read more about binary numeral system representation here: <https://en.wikipedia.org/wiki/Binary_system>
instruction
0
39,291
20
78,582
Tags: implementation Correct Solution: ``` s = input() ko = 0 kek = 0 d = "" for i in range(len(s)): if s[i] == "1" and kek == 0 or kek == 1: kek = 1 d+=s[i] for i in range(len(d)): if d[i] == '0': ko += 1 if ko >= 6: print("yes") else: print("no") ```
output
1
39,291
20
78,583
Provide tags and a correct Python 3 solution for this coding contest problem. Top-model Izabella participates in the competition. She wants to impress judges and show her mathematical skills. Her problem is following: for given string, consisting of only 0 and 1, tell if it's possible to remove some digits in such a way, that remaining number is a representation of some positive integer, divisible by 64, in the binary numerical system. Input In the only line given a non-empty binary string s with length up to 100. Output Print «yes» (without quotes) if it's possible to remove digits required way and «no» otherwise. Examples Input 100010001 Output yes Input 100 Output no Note In the first test case, you can get string 1 000 000 after removing two ones which is a representation of number 64 in the binary numerical system. You can read more about binary numeral system representation here: <https://en.wikipedia.org/wiki/Binary_system>
instruction
0
39,292
20
78,584
Tags: implementation Correct Solution: ``` s = input() count = 0 have = False for i in range(0, len(s)): if s[i] == '0' and have: count += 1 if s[i] == '1': have = True if count >= 6: print("yes") else: print("no") ```
output
1
39,292
20
78,585
Provide tags and a correct Python 3 solution for this coding contest problem. Top-model Izabella participates in the competition. She wants to impress judges and show her mathematical skills. Her problem is following: for given string, consisting of only 0 and 1, tell if it's possible to remove some digits in such a way, that remaining number is a representation of some positive integer, divisible by 64, in the binary numerical system. Input In the only line given a non-empty binary string s with length up to 100. Output Print «yes» (without quotes) if it's possible to remove digits required way and «no» otherwise. Examples Input 100010001 Output yes Input 100 Output no Note In the first test case, you can get string 1 000 000 after removing two ones which is a representation of number 64 in the binary numerical system. You can read more about binary numeral system representation here: <https://en.wikipedia.org/wiki/Binary_system>
instruction
0
39,293
20
78,586
Tags: implementation Correct Solution: ``` # Main maut ko takiya, aur kafan ko chaadar banakar audhta hoon! s=input() d=s.find('1') if d!=-1 and s[d+1:].count('0')>=6: print("yes") else: print("no") ```
output
1
39,293
20
78,587
Provide tags and a correct Python 3 solution for this coding contest problem. Top-model Izabella participates in the competition. She wants to impress judges and show her mathematical skills. Her problem is following: for given string, consisting of only 0 and 1, tell if it's possible to remove some digits in such a way, that remaining number is a representation of some positive integer, divisible by 64, in the binary numerical system. Input In the only line given a non-empty binary string s with length up to 100. Output Print «yes» (without quotes) if it's possible to remove digits required way and «no» otherwise. Examples Input 100010001 Output yes Input 100 Output no Note In the first test case, you can get string 1 000 000 after removing two ones which is a representation of number 64 in the binary numerical system. You can read more about binary numeral system representation here: <https://en.wikipedia.org/wiki/Binary_system>
instruction
0
39,294
20
78,588
Tags: implementation Correct Solution: ``` x = input() index=x.find("1") str=x[index:] a= str.count('0') if ( a >=6 ): print("YES") else: print("NO") ```
output
1
39,294
20
78,589
Provide tags and a correct Python 3 solution for this coding contest problem. Top-model Izabella participates in the competition. She wants to impress judges and show her mathematical skills. Her problem is following: for given string, consisting of only 0 and 1, tell if it's possible to remove some digits in such a way, that remaining number is a representation of some positive integer, divisible by 64, in the binary numerical system. Input In the only line given a non-empty binary string s with length up to 100. Output Print «yes» (without quotes) if it's possible to remove digits required way and «no» otherwise. Examples Input 100010001 Output yes Input 100 Output no Note In the first test case, you can get string 1 000 000 after removing two ones which is a representation of number 64 in the binary numerical system. You can read more about binary numeral system representation here: <https://en.wikipedia.org/wiki/Binary_system>
instruction
0
39,295
20
78,590
Tags: implementation Correct Solution: ``` ch=input() if ch[ch.find("1"):].count("0")>=6: print('yes') else: print("no") ```
output
1
39,295
20
78,591
Provide tags and a correct Python 3 solution for this coding contest problem. Top-model Izabella participates in the competition. She wants to impress judges and show her mathematical skills. Her problem is following: for given string, consisting of only 0 and 1, tell if it's possible to remove some digits in such a way, that remaining number is a representation of some positive integer, divisible by 64, in the binary numerical system. Input In the only line given a non-empty binary string s with length up to 100. Output Print «yes» (without quotes) if it's possible to remove digits required way and «no» otherwise. Examples Input 100010001 Output yes Input 100 Output no Note In the first test case, you can get string 1 000 000 after removing two ones which is a representation of number 64 in the binary numerical system. You can read more about binary numeral system representation here: <https://en.wikipedia.org/wiki/Binary_system>
instruction
0
39,296
20
78,592
Tags: implementation Correct Solution: ``` s = input() c = 0 bl = False for i in s: if bl and i == "0": c+=1 elif not bl and i == "1": bl = True if c>=6: print("yes") else: print("no") ```
output
1
39,296
20
78,593
Provide tags and a correct Python 3 solution for this coding contest problem. Top-model Izabella participates in the competition. She wants to impress judges and show her mathematical skills. Her problem is following: for given string, consisting of only 0 and 1, tell if it's possible to remove some digits in such a way, that remaining number is a representation of some positive integer, divisible by 64, in the binary numerical system. Input In the only line given a non-empty binary string s with length up to 100. Output Print «yes» (without quotes) if it's possible to remove digits required way and «no» otherwise. Examples Input 100010001 Output yes Input 100 Output no Note In the first test case, you can get string 1 000 000 after removing two ones which is a representation of number 64 in the binary numerical system. You can read more about binary numeral system representation here: <https://en.wikipedia.org/wiki/Binary_system>
instruction
0
39,297
20
78,594
Tags: implementation Correct Solution: ``` a=input() x=len(a) if x<7: print('no') elif a.count('1')==0: print('no') else: c=0 for i in range(a.index('1'),x): if a[i]=='0': c+=1 if c>=6: print('yes') else: print('no') ```
output
1
39,297
20
78,595
Provide tags and a correct Python 3 solution for this coding contest problem. Top-model Izabella participates in the competition. She wants to impress judges and show her mathematical skills. Her problem is following: for given string, consisting of only 0 and 1, tell if it's possible to remove some digits in such a way, that remaining number is a representation of some positive integer, divisible by 64, in the binary numerical system. Input In the only line given a non-empty binary string s with length up to 100. Output Print «yes» (without quotes) if it's possible to remove digits required way and «no» otherwise. Examples Input 100010001 Output yes Input 100 Output no Note In the first test case, you can get string 1 000 000 after removing two ones which is a representation of number 64 in the binary numerical system. You can read more about binary numeral system representation here: <https://en.wikipedia.org/wiki/Binary_system>
instruction
0
39,298
20
78,596
Tags: implementation Correct Solution: ``` n=list(input()) if "1" in n: p=n.index("1") if n[p+1:].count("0")>=6 and p!=len(n)-1: print("YES") else: print("No") else: print("No") ```
output
1
39,298
20
78,597
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Top-model Izabella participates in the competition. She wants to impress judges and show her mathematical skills. Her problem is following: for given string, consisting of only 0 and 1, tell if it's possible to remove some digits in such a way, that remaining number is a representation of some positive integer, divisible by 64, in the binary numerical system. Input In the only line given a non-empty binary string s with length up to 100. Output Print «yes» (without quotes) if it's possible to remove digits required way and «no» otherwise. Examples Input 100010001 Output yes Input 100 Output no Note In the first test case, you can get string 1 000 000 after removing two ones which is a representation of number 64 in the binary numerical system. You can read more about binary numeral system representation here: <https://en.wikipedia.org/wiki/Binary_system> Submitted Solution: ``` s=input() a=0 if(len(s)<7): print("no") exit(0) l=list(s) n=s.find('1') if(n!=-1): for i in range(n,len(l)): if(l[i]=='0'): a+=1 if(a>=6): print("yes") exit(0) print("no") ```
instruction
0
39,299
20
78,598
Yes
output
1
39,299
20
78,599
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Top-model Izabella participates in the competition. She wants to impress judges and show her mathematical skills. Her problem is following: for given string, consisting of only 0 and 1, tell if it's possible to remove some digits in such a way, that remaining number is a representation of some positive integer, divisible by 64, in the binary numerical system. Input In the only line given a non-empty binary string s with length up to 100. Output Print «yes» (without quotes) if it's possible to remove digits required way and «no» otherwise. Examples Input 100010001 Output yes Input 100 Output no Note In the first test case, you can get string 1 000 000 after removing two ones which is a representation of number 64 in the binary numerical system. You can read more about binary numeral system representation here: <https://en.wikipedia.org/wiki/Binary_system> Submitted Solution: ``` bi=(input()+'1').strip('0') if bi.count('0')>=6 : print ("YES") else : print("NO") ```
instruction
0
39,300
20
78,600
Yes
output
1
39,300
20
78,601
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Top-model Izabella participates in the competition. She wants to impress judges and show her mathematical skills. Her problem is following: for given string, consisting of only 0 and 1, tell if it's possible to remove some digits in such a way, that remaining number is a representation of some positive integer, divisible by 64, in the binary numerical system. Input In the only line given a non-empty binary string s with length up to 100. Output Print «yes» (without quotes) if it's possible to remove digits required way and «no» otherwise. Examples Input 100010001 Output yes Input 100 Output no Note In the first test case, you can get string 1 000 000 after removing two ones which is a representation of number 64 in the binary numerical system. You can read more about binary numeral system representation here: <https://en.wikipedia.org/wiki/Binary_system> Submitted Solution: ``` s = input() one = s.find('1') if one == -1: print("no") else: zeros = s.count('0', one) if zeros >= 6: print("yes") else: print("no") ```
instruction
0
39,301
20
78,602
Yes
output
1
39,301
20
78,603
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Top-model Izabella participates in the competition. She wants to impress judges and show her mathematical skills. Her problem is following: for given string, consisting of only 0 and 1, tell if it's possible to remove some digits in such a way, that remaining number is a representation of some positive integer, divisible by 64, in the binary numerical system. Input In the only line given a non-empty binary string s with length up to 100. Output Print «yes» (without quotes) if it's possible to remove digits required way and «no» otherwise. Examples Input 100010001 Output yes Input 100 Output no Note In the first test case, you can get string 1 000 000 after removing two ones which is a representation of number 64 in the binary numerical system. You can read more about binary numeral system representation here: <https://en.wikipedia.org/wiki/Binary_system> Submitted Solution: ``` s = input() try: print(['no', 'yes'][int(s[s.index('1'):].count('0') >= 6)]) except: print('no') ```
instruction
0
39,302
20
78,604
Yes
output
1
39,302
20
78,605
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Top-model Izabella participates in the competition. She wants to impress judges and show her mathematical skills. Her problem is following: for given string, consisting of only 0 and 1, tell if it's possible to remove some digits in such a way, that remaining number is a representation of some positive integer, divisible by 64, in the binary numerical system. Input In the only line given a non-empty binary string s with length up to 100. Output Print «yes» (without quotes) if it's possible to remove digits required way and «no» otherwise. Examples Input 100010001 Output yes Input 100 Output no Note In the first test case, you can get string 1 000 000 after removing two ones which is a representation of number 64 in the binary numerical system. You can read more about binary numeral system representation here: <https://en.wikipedia.org/wiki/Binary_system> Submitted Solution: ``` n = input() for i in range(len(n)): if n[i] == 1: if n[i:].count('0') >= 6 : print('yes') else: print('no') else: continue ```
instruction
0
39,303
20
78,606
No
output
1
39,303
20
78,607
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Top-model Izabella participates in the competition. She wants to impress judges and show her mathematical skills. Her problem is following: for given string, consisting of only 0 and 1, tell if it's possible to remove some digits in such a way, that remaining number is a representation of some positive integer, divisible by 64, in the binary numerical system. Input In the only line given a non-empty binary string s with length up to 100. Output Print «yes» (without quotes) if it's possible to remove digits required way and «no» otherwise. Examples Input 100010001 Output yes Input 100 Output no Note In the first test case, you can get string 1 000 000 after removing two ones which is a representation of number 64 in the binary numerical system. You can read more about binary numeral system representation here: <https://en.wikipedia.org/wiki/Binary_system> Submitted Solution: ``` a = input() s = 6 ind = 0 for i in range(len(a)): if a[i] == "1": ind = i break for i in range(ind,len(a)): if s == 0: break elif a[i] == "0": s -= 1 if s == 0: print("yes") else: print("no") ```
instruction
0
39,304
20
78,608
No
output
1
39,304
20
78,609
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Top-model Izabella participates in the competition. She wants to impress judges and show her mathematical skills. Her problem is following: for given string, consisting of only 0 and 1, tell if it's possible to remove some digits in such a way, that remaining number is a representation of some positive integer, divisible by 64, in the binary numerical system. Input In the only line given a non-empty binary string s with length up to 100. Output Print «yes» (without quotes) if it's possible to remove digits required way and «no» otherwise. Examples Input 100010001 Output yes Input 100 Output no Note In the first test case, you can get string 1 000 000 after removing two ones which is a representation of number 64 in the binary numerical system. You can read more about binary numeral system representation here: <https://en.wikipedia.org/wiki/Binary_system> Submitted Solution: ``` def check(s): if s.__len__() <= 3: return False; for i in range(0, 4): if s[-i] == '1': return False return True; a = input(); cnt = 0 len = a.__len__() if len <= 3: print("no") else: print("yes") ```
instruction
0
39,305
20
78,610
No
output
1
39,305
20
78,611