TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: An adult game master and N children are playing a game on an ice rink. The game consists of K rounds. In the i-th round, the game master announces:    * Form groups consisting of A_i children each!  Then the children who are still in the game form as many groups of A_i children as possible. One child may belong to at most one group. Those who are left without a group leave the game. The others proceed to the next round. Note that it's possible that nobody leaves the game in some round.  In the end, after the K-th round, there are exactly two children left, and they are declared the winners.  You have heard the values of A_1, A_2, ..., A_K. You don't know N, but you want to estimate it.  Find the smallest and the largest possible number of children in the game before the start, or determine that no valid values of N exist.

Submission attempts (in order):
import copy
def ketanowa(p):
    ans=0
    p=str(p)
    for i in p:
        ans+=int(i)
    return ans

def main():
    n=int(input())
    temp=input().split(" ")
    nums=list(map(int,temp))
    nums_o=copy.copy(nums)
    nums.reverse()
    for i in range(len(nums)-1):
        if nums[i]>nums[i+1]:
            p=int(nums[i]/nums[i+1])
            nums[i+1]*=(p+1)
    nums.reverse()
    imp =True
    min=nums[0]
    max=nums[0]+nums_o[0]-1

    test=min
    for i in range(len(nums)):
        test-=test%nums_o[i]
        if test<=0:
            imp=True
            break
    if test!=2:
        imp=True
    test=max
    for i in range(len(nums)):
        test-=test%nums_o[i]
        if test<=0:
            imp=True
            break
    if test!=2:
        imp=True


    if imp:
        print("-1")
    else:
        print(str(min)+" "+str(max))        




if __name__ == '__main__':
    main()


import copy
import math


def main():
    n=int(input())
    temp=input().split(" ")
    nums=list(map(int,temp))
    nums.reverse()
    l=2 # min 
    r=2 # max
    for num in nums:
       # if num<=l and num>=r:
        r=(int(r/num)+1)*(num)-1
        l= math.ceil(l/num)*num
        
        if l>r:
             print("-1")
             return 0
    print(str(l)+" "+str(r))      
    



if __name__ == '__main__':
    main()


Verdicts: Wrong Answer

Accepted
Problem: An adult game master and N children are playing a game on an ice rink. The game consists of K rounds. In the i-th round, the game master announces:    * Form groups consisting of A_i children each!  Then the children who are still in the game form as many groups of A_i children as possible. One child may belong to at most one group. Those who are left without a group leave the game. The others proceed to the next round. Note that it's possible that nobody leaves the game in some round.  In the end, after the K-th round, there are exactly two children left, and they are declared the winners.  You have heard the values of A_1, A_2, ..., A_K. You don't know N, but you want to estimate it.  Find the smallest and the largest possible number of children in the game before the start, or determine that no valid values of N exist.

Submission attempts (in order):
k = int(input())
a = list(map(int, input().split()))
def solve():

    if a[k-1] != 2:
        print(-1)
        return

    if k == 1:
        print(2, 3)
        return

    mi = 0
    mx = 0

    for i in range(k):

        if i==0:
            mi = 2
            mx = 2
        # elif i > 1 and i != k-1:
        #     if a[k-i-1] == a[k-(i-1)-1]:
        #         continue

        mx = mx + a[k-i-1] - 1
        print(mi, mx)

        if i == k-1:
            pass
        else:
            j = i+1
            if mx < a[k-j-1]:
                print(-1)
                return

            if mi%a[k-j-1] != 0:
                mi = mi + (a[k-j-1] - mi%a[k-j-1])
            if mx%a[k-j-1] != 0:
                mx = mx - mx % a[k-j-1]
        print(mi, mx)
    print(mi, mx)
solve()


k = int(input())
a = list(map(int, input().split()))
def solve():

    if a[k-1] != 2:
        print(-1)
        return

    mi = 2
    mx = 2

    for i in range(k):
        j = k-i-1

        mx = mx + a[j] - 1

        if j == 0:
            pass
        else:
            na = a[j-1]
            
            if mx % na != 0 and mi % na != 0 and ((mx % na) - (mi % na)) == (mx - mi):
                print(-1)
                return

            if mi%na != 0:
                mi = mi + (na - mi%na)

            if mx%na != 0:
                mx = mx - (mx % na)

    print(mi, mx)
solve()


Verdicts: Wrong Answer

Accepted
Problem: An adult game master and N children are playing a game on an ice rink. The game consists of K rounds. In the i-th round, the game master announces:    * Form groups consisting of A_i children each!  Then the children who are still in the game form as many groups of A_i children as possible. One child may belong to at most one group. Those who are left without a group leave the game. The others proceed to the next round. Note that it's possible that nobody leaves the game in some round.  In the end, after the K-th round, there are exactly two children left, and they are declared the winners.  You have heard the values of A_1, A_2, ..., A_K. You don't know N, but you want to estimate it.  Find the smallest and the largest possible number of children in the game before the start, or determine that no valid values of N exist.

Submission attempts (in order):
K = int(input())
A = list(map(int,input().split()))

if A[-1] != 2:
	print(-1)
	exit(0)

minval = 2
maxval = 3
for i in range(K-1,-1,-1):
	if maxval < A[i] or (minval > A[i] and ((maxval - (maxval % A[i]) < minval)):
		print(-1)
		exit(0)

	if minval > A[i]:
		if minval % A[i] != 0:
			minval = minval + (A[i] - (minval % A[i]))

		maxval = (maxval - (maxval % A[i]) + A[i] - 1)

	else:
		maxval = A[i] + (A[i] - 1)
		minval = A[i]
		

print(str(minval) + " " + str(maxval))


K = int(input())
A = list(map(int,input().split()))

if A[-1] != 2:
	print(-1)
	exit(0)

minval = 2
maxval = 3
for i in range(K-1,-1,-1):
	if maxval < A[i] or (minval > A[i] and ((maxval - (maxval % A[i]) < minval))):
		print(-1)
		exit(0)

	if minval > A[i]:
		if minval % A[i] != 0:
			minval = minval + (A[i] - (minval % A[i]))

		maxval = (maxval - (maxval % A[i]) + A[i] - 1)

	else:
		maxval = A[i] + (A[i] - 1)
		minval = A[i]
		

print(str(minval) + " " + str(maxval))


Verdicts: Runtime Error

Accepted
Problem: An adult game master and N children are playing a game on an ice rink. The game consists of K rounds. In the i-th round, the game master announces:    * Form groups consisting of A_i children each!  Then the children who are still in the game form as many groups of A_i children as possible. One child may belong to at most one group. Those who are left without a group leave the game. The others proceed to the next round. Note that it's possible that nobody leaves the game in some round.  In the end, after the K-th round, there are exactly two children left, and they are declared the winners.  You have heard the values of A_1, A_2, ..., A_K. You don't know N, but you want to estimate it.  Find the smallest and the largest possible number of children in the game before the start, or determine that no valid values of N exist.

Submission attempts (in order):
import sys
readline = sys.stdin.readline

K = int(readline())
A = list(map(int,readline().split()))[::-1] 


cur = 2

if A[0] != 2: 
  print(-1)
  exit(0)

#print(A)

def getMinVal(c,a):
  
  return (((c- 1) // a) + 1) * a

def getMaxVal(minval,a):
  
  return minval + a - 1


for i in range(len(A)):
  
  minpos = getMinVal(cur,A[i])
  maxpos = getMaxVal(minpos,A[i])
  
  if A[i] < minpos or maxpos < A[i]:
    print(-1)
    exit(0)

  
  if i + 1 < len(A):
    if minpos % A[i + 1] != 0:
      cur = getMinVal(minpos,A[i + 1])
    else:
      cur = minpos
  else:
    cur = minpos
  

ans = [0] * 2
ans[0] = cur
  
def getNextMax(c,a):
  
  return (c // a) * a
 
cur = 2

for i in range(len(A)):
  
#  print("i",i,"A[i]",A[i])
  minpos = getMinVal(cur,A[i])
  maxpos = getMaxVal(minpos,A[i])

  if cur * 2 < A[i]:
    print(-1)
    exit(0)
  
  
  if i + 1 < len(A):
    if maxpos % A[i + 1] != 0:
      cur = getNextMax(maxpos,A[i + 1])
    else:
      cur = maxpos
  else:
    cur = maxpos
#  print("cur",cur)
    
ans[1] = cur

print(*ans)





import sys
readline = sys.stdin.readline

K = int(readline())
A = list(map(int,readline().split()))[::-1] 

mincur = 2
maxcur = 2

def get_min_val(c,a): 
  return ((c - 1)//a + 1) * a

def get_max_val(c,a): 
  return (c // a) * a

if A[0] != 2:
  print(-1)
  exit(0)
  
for i in range(len(A)):
  mincur = mincur
  maxcur = maxcur + A[i] - 1
  if i + 1 < len(A):
    mincur = get_min_val(mincur,A[i + 1])
    maxcur = get_max_val(maxcur,A[i + 1])
    if mincur > maxcur:
      print(-1)
      exit(0)
print(mincur,maxcur)


Verdicts: Wrong Answer

Accepted
Problem: You are given N integers A_1, A_2, ..., A_N.  Consider the sums of all non-empty subsequences of A. There are 2^N - 1 such sums, an odd number.  Let the list of these sums in non-decreasing order be S_1, S_2, ..., S_{2^N - 1}.  Find the median of this list, S_{2^{N-1}}.

Submission attempts (in order):
n = int(input())
a = list(map(int,input().split()))
s = sum(a)
a.sort()
b = 1
for i in a:
  b |= b<<i
  
b &= 2**(s+1)-2**((s-1)//2)
t = b&(-b)
print(t.bit_length()-1)

n = int(input())
a = list(map(int,input().split()))
s = sum(a)
a.sort()
b = 1
for i in a:
  b |= b<<i
  
b &= 2**(s+1)-2**((s+1)//2)
t = b&(-b)
print(t.bit_length()-1)

Verdicts: Wrong Answer

Accepted
Problem: You are given N integers A_1, A_2, ..., A_N.  Consider the sums of all non-empty subsequences of A. There are 2^N - 1 such sums, an odd number.  Let the list of these sums in non-decreasing order be S_1, S_2, ..., S_{2^N - 1}.  Find the median of this list, S_{2^{N-1}}.

Submission attempts (in order):
n = int(input())
arr = list(map(int, input().split()))
dp = 1

for a in arr:
    dp |= dp << a

ts = 1 << ((dp.bit_length() + 1) // 2 - 1)
while not dp & ts:
    ts <<= 1

print(ts.bit_length())


n = int(input())
arr = list(map(int, input().split()))
dp = 1

for a in arr:
    dp |= dp << a

ts = 1 << (dp.bit_length() - 1)
while not dp & ts:
    ts <<= 1

print(ts.bit_length())


n, arr, dp = int(input()), list(map(int, input().split())), 1
for a in arr:
    dp |= dp << a
ofs = (sum(arr) + 1) // 2
dp >>= ofs
print((dp & -dp).bit_length() + ofs - 1)


Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Let f(A, B), where A and B are positive integers, be the string satisfying the following conditions:    * f(A, B) has length A + B;   * f(A, B) contains exactly A letters `A` and exactly B letters `B`;   * The length of the longest substring of f(A, B) consisting of equal letters (ex., `AAAAA` or `BBBB`) is as small as possible under the conditions above;   * f(A, B) is the lexicographically smallest string satisfying the conditions above.  For example, f(2, 3) = `BABAB`, and f(6, 4) = `AABAABAABB`.  Answer Q queries: find the substring of f(A_i, B_i) from position C_i to position D_i (1-based).

Submission attempts (in order):
for t in range(int(input())):
  a,b,c,d=map(int,input().split(' '));l,x,y,o=(a+b)//(min(a,b)+1),0,0,""
	if a*l<=b:y=a+b
	elif b*l<=a:x=a+b
	else:x,y=(a*l-b)//(l-1),(b*l-a)//(l-1)
	for i in range(c,d+1):o+="AB"[i%(l+1)==0] if i<=x else "BA"[(a+b-i+1)%(l+1)==0] if a+b-i+1<=y else "AB"[a-x+x//(l+1)-y//(l+1)==0]
	print(o)

for t in range(int(input())):
	a,b,c,d=map(int,input().split(' '));l,x,y,o=(a+b)//(min(a,b)+1),0,0,""
	if a*l<=b:y=a+b
	elif b*l<=a:x=a+b
	else:x,y=(a*l-b)//(l-1),(b*l-a)//(l-1)
	for i in range(c,d+1):o+="AB"[i%(l+1)==0] if i<=x else "BA"[(a+b-i+1)%(l+1)==0] if a+b-i+1<=y else "AB"[a-x+x//(l+1)-y//(l+1)==0]
	print(o)

Verdicts: Runtime Error

Accepted
Problem: Let f(A, B), where A and B are positive integers, be the string satisfying the following conditions:    * f(A, B) has length A + B;   * f(A, B) contains exactly A letters `A` and exactly B letters `B`;   * The length of the longest substring of f(A, B) consisting of equal letters (ex., `AAAAA` or `BBBB`) is as small as possible under the conditions above;   * f(A, B) is the lexicographically smallest string satisfying the conditions above.  For example, f(2, 3) = `BABAB`, and f(6, 4) = `AABAABAABB`.  Answer Q queries: find the substring of f(A_i, B_i) from position C_i to position D_i (1-based).

Submission attempts (in order):
for t in range(int(input())):
	a,b,c,d=map(int,input().split(' '));l,x,y,o=(a+b)//(min(a,b)+1),(a*l-b)//(l-1),(b*l-a)//(l-1),""
	if a*l<=b:x,y=0,a+b
	elif b*l<=a:x,y=a+b,0
	for i in range(c,d+1):o+="AB"[i%(l+1)==0] if i<=x else "BA"[(a+b-i+1)%(l+1)==0] if a+b-i+1<=y else "AB"[a-x+x//(l+1)-y//(l+1)==0]
	print(o)

for t in range(int(input())):
	a,b,c,d=map(int,input().split(' '));l,o=(a+b)//(min(a,b)+1),"";x,y=(a*l-b)//(l-1),(b*l-a)//(l-1)
	if a*l<=b:x,y=0,a+b
	elif b*l<=a:x,y=a+b,0
	for i in range(c,d+1):o+="AB"[i%(l+1)==0] if i<=x else "BA"[(a+b-i+1)%(l+1)==0] if a+b-i+1<=y else "AB"[a-x+x//(l+1)-y//(l+1)==0]
	print(o)

for t in range(int(input())):
	a,b,c,d=map(int,input().split(' '));l,x,y,o=(a+b)//(min(a,b)+1),a+b,0,""
	if a*l<=b:x,y=0,a+b
	elif b*l>a:x,y=(a*l-b)//(l-1),(b*l-a)//(l-1)
	for i in range(c,d+1):o+="AB"[i%(l+1)==0] if i<=x else "BA"[(a+b-i+1)%(l+1)==0] if a+b-i+1<=y else "AB"[a-x+x//(l+1)-y//(l+1)==0]
	print(o)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: Let f(A, B), where A and B are positive integers, be the string satisfying the following conditions:    * f(A, B) has length A + B;   * f(A, B) contains exactly A letters `A` and exactly B letters `B`;   * The length of the longest substring of f(A, B) consisting of equal letters (ex., `AAAAA` or `BBBB`) is as small as possible under the conditions above;   * f(A, B) is the lexicographically smallest string satisfying the conditions above.  For example, f(2, 3) = `BABAB`, and f(6, 4) = `AABAABAABB`.  Answer Q queries: find the substring of f(A_i, B_i) from position C_i to position D_i (1-based).

Submission attempts (in order):
#!/usr/bin/env python3
import math
import bisect
Q = int(input())
for _ in range(Q):
    A, B, C, D = map(int, input().split())
    K = math.ceil(max(A, B) / (min(A, B) + 1))
    xs = ((A - i + 1) * K < B - max(0, (i - 1) // K) for i in range(A + 1))
    p = bisect.bisect(list(xs), False)
    f = ''
    for i in range(C - 1, D):
        na = p
        nb = max(0, (na - 1) // K)
        if i < nb * (K + 1):
            f += ('A', 'B')[i % (K + 1) == K]
        elif i < na + nb:
            f += 'A'
        else:
            j = A + B - i - 1
            nb = B - nb
            na = max(0, (nb - 1) // K)
            if j < na * (K + 1):
                f += ('B', 'A')[j % (K + 1) == K]
            else:
                f += 'B'
    print(f)


#!/usr/bin/env python3
import math
Q = int(input())
num = lambda x: (x, max(0, (x - 1) // K))
sub = lambda xs, ys: [x - y for (x, y) in zip(xs, ys)]
for _ in range(Q):
    A, B, C, D = map(int, input().split())
    K = math.ceil(max(A, B) / (min(A, B) + 1))
    l, r = 0, A + 1
    while r - l > 1:
        m = (l + r) // 2
        rA, rB = sub((A, B), num(m))
        l, r = ((m, r), (l, m))[(rA + 1) * K < rB]

    f = ''
    for i in range(C - 1, D):
        na, nb = num(l)
        if i < na + nb:
            f += ('A', 'B')[i % (K + 1) == K] if i < nb * (K + 1) else 'A'
        else:
            nb, na = num(B - nb)
            j = A + B - i - 1
            f += ('B', 'A')[j % (K + 1) == K] if j < na * (K + 1) else 'B'
    print(f)


Verdicts: Wrong Answer

Accepted
Problem: As a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence A needs to satisfy the conditions below:    * A consists of integers between X and Y (inclusive).   * For each 1\leq i \leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i.  Find the maximum possible length of the sequence.

Submission attempts (in order):
x, y = map(int, input().split())
cnt = 1;
while x < y:
    x *= 2
    cnt += 1
print(cnt)

x, y = map(int, input().split())
cnt = 0;
while x <= y:
    cnt += 1
    x *= 2
print(cnt)

Verdicts: Wrong Answer

Accepted
Problem: As a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence A needs to satisfy the conditions below:    * A consists of integers between X and Y (inclusive).   * For each 1\leq i \leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i.  Find the maximum possible length of the sequence.

Submission attempts (in order):
import math
X, Y = map(int, input().split())
r = 0
while X < Y:
  Y //= X
  r += 1
print(int(math.log2(r)) + 1)

import math
X, Y = map(int, input().split())
r = 0
R = Y // X
while R >= 2:
  R //= 2
  r += 1
print(r + 1)

Verdicts: Runtime Error

Accepted
Problem: As a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence A needs to satisfy the conditions below:    * A consists of integers between X and Y (inclusive).   * For each 1\leq i \leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i.  Find the maximum possible length of the sequence.

Submission attempts (in order):
x, y = map(int, input().split())
count = 0
ans = []
x_copy = x
while x_copy < y:
    x_copy = x
    x_copy *= 2 ** count
    ans.append(x_copy)
    count += 1
print(len(ans))


x, y = map(int, input().split())

for i in range(1, 101):
    if x > y:
        ans = i - 1
        break
    x *= 2

print(ans)


Verdicts: Wrong Answer

Accepted
Problem: As a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence A needs to satisfy the conditions below:    * A consists of integers between X and Y (inclusive).   * For each 1\leq i \leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i.  Find the maximum possible length of the sequence.

Submission attempts (in order):
X,Y = map(int,input().split())
ans = 0
while X <= Y:
	ans += 1
	X * = 2
print(ans)

X,Y = map(int,input())
ans = 0
while X <= Y:
	ans += 1
	X *= 2
print(ans)

X,Y = map(int,input().split())
ans = 0
while X <= Y:
	ans += 1
	X *= 2
print(ans)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: As a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence A needs to satisfy the conditions below:    * A consists of integers between X and Y (inclusive).   * For each 1\leq i \leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i.  Find the maximum possible length of the sequence.

Submission attempts (in order):
X,Y = map(int,input().split())
ans = 0
while True:
  X *= 2
  if X<=Y:
    ans += 1
  else:
    break
print(ans)

X,Y = map(int,input().split())
ans = 1
while True:
  X *= 2
  if X<=Y:
    ans += 1
  else:
    break
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: As a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence A needs to satisfy the conditions below:    * A consists of integers between X and Y (inclusive).   * For each 1\leq i \leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i.  Find the maximum possible length of the sequence.

Submission attempts (in order):
3 20

x,y=map(int,input().split())
i=1
while x*2<=y:
  i+=1
  x*=2
print(i)

Verdicts: Runtime Error

Accepted
Problem: As a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence A needs to satisfy the conditions below:    * A consists of integers between X and Y (inclusive).   * For each 1\leq i \leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i.  Find the maximum possible length of the sequence.

Submission attempts (in order):
import math;print((lambda l:math.floor(math.log2(l[1]/l[0])+1e9)+1)(list(map(int,input().split()))))

import math;print((lambda l:math.floor(math.log2(l[1]/l[0]))+1+1e-9)(list(map(int,input().split()))))

import math;print(int((lambda l:math.floor(1e-5+math.log2(l[1]/l[0]))+1))(list(map(int,input().split()))))


import math;print(int((lambda l:math.floor(1e-9+math.log2(l[1]/l[0]))+1))(list(map(int,input().split()))))

print(((lambda l:len([0 for i in range(0,100) if l[0]*(2**i)<=l[1]]))(list(map(int,input().split())))))

Verdicts: Wrong Answer

Wrong Answer

Runtime Error

Runtime Error

Accepted
Problem: As a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence A needs to satisfy the conditions below:    * A consists of integers between X and Y (inclusive).   * For each 1\leq i \leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i.  Find the maximum possible length of the sequence.

Submission attempts (in order):
a = list(map(int,input().split()))
x = a[0]
y = a[1]

n = a[0]
count =1

while n <= y:
  n = n * 2
  count += 1
  
print(str(count))

a = list(map(int,input().split()))
x = a[0]
y = a[1]

n = a[0]
count = 0

while n <= y:
  n = n << 1
  count += 1
  
print(str(count))

Verdicts: Wrong Answer

Accepted
Problem: As a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence A needs to satisfy the conditions below:    * A consists of integers between X and Y (inclusive).   * For each 1\leq i \leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i.  Find the maximum possible length of the sequence.

Submission attempts (in order):
# -*- coding: utf-8 -*-

X, Y = map(int, raw_input().split())
cnt = 0
num = X
while num <= Y:
    cnt += 1
    num = num*2

print(cnt)


# -*- coding: utf-8 -*-

import math
X, Y = map(int, raw_input().split())
cnt = 0
num = X
while num <= Y:
    cnt += 1
    num = num*2

print(cnt)


# -*- coding: utf-8 -*-

X, Y = map(int, input().split())
cnt = 0
num = X
while num <= Y:
    cnt += 1
    num = num*2

print(cnt)


Verdicts: Runtime Error

Runtime Error

Accepted
Problem: As a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence A needs to satisfy the conditions below:    * A consists of integers between X and Y (inclusive).   * For each 1\leq i \leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i.  Find the maximum possible length of the sequence.

Submission attempts (in order):
x,y=map(int,input().split())
import math
p=math.log(y/x,2)+10**(-18)
print(int(p)+1

x,y=map(int,input().split())
ans=1
for i in range(1000):
	if x*2>y:
		print(ans)
		exit()
	else:
		ans+=1
		x*=2

Verdicts: Runtime Error

Accepted
Problem: As a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence A needs to satisfy the conditions below:    * A consists of integers between X and Y (inclusive).   * For each 1\leq i \leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i.  Find the maximum possible length of the sequence.

Submission attempts (in order):
def getAns(x,y):
    num=int(y/x)
    res=1
    while num>1:
        num/=2
        res+=1
    return res

x,y=map(int,input().split())
print getAns(x,y)

x,y=map(int,input().split())
ans=0
while x<=y:
    x = x*2
    ans +=1
print(ans)

Verdicts: Runtime Error

Accepted
Problem: As a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence A needs to satisfy the conditions below:    * A consists of integers between X and Y (inclusive).   * For each 1\leq i \leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i.  Find the maximum possible length of the sequence.

Submission attempts (in order):
# coding: utf-8


def main():
    X, Y = map(int, input().split())
    ans = 0
    while (X <= Y){
        x *= 2
        ans += 1
    }
    print(ans)

if __name__ == "__main__":
    main()


# coding: utf-8


def main():
    X, Y = map(int, input().split())
    ans = 0
    while X <= Y:
        X *= 2
        ans += 1

    print(ans)

if __name__ == "__main__":
    main()


Verdicts: Runtime Error

Accepted
Problem: As a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence A needs to satisfy the conditions below:    * A consists of integers between X and Y (inclusive).   * For each 1\leq i \leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i.  Find the maximum possible length of the sequence.

Submission attempts (in order):
def myAnswer(X:int,Y:int) -> int:
   if(X*2 > Y): return 1
   ans = X
   total = 1
   while True:
      print(ans)
      ans *= 2
      if(ans > Y):
         break
      else:
         total += 1
   return total


def modelAnswer():
   tmp=1
def main():
   X, Y = map(int,input().split())
   print(myAnswer(X,Y))
if __name__ == '__main__':
   main()


def myAnswer(X:int,Y:int) -> int:
   if(X*2 > Y): return 1
   ans = X
   total = 1
   while True:
      ans *= 2
      if(ans > Y):
         break
      else:
         total += 1
   return total


def modelAnswer():
   tmp=1
def main():
   X, Y = map(int,input().split())
   print(myAnswer(X,Y))
if __name__ == '__main__':
   main()

Verdicts: Wrong Answer

Accepted
Problem: As a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence A needs to satisfy the conditions below:    * A consists of integers between X and Y (inclusive).   * For each 1\leq i \leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i.  Find the maximum possible length of the sequence.

Submission attempts (in order):
import math
X, Y = map(int, input().split())

ans = int(math.log2(Y)) - int(math.log2(X))
print(ans+1)

#import math
X, Y = map(int, input().split())
cnt = 0


#print(ans+1)
while X <= Y:
  X *= 2
  cnt += 1
print(cnt)

Verdicts: Wrong Answer

Accepted
Problem: As a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence A needs to satisfy the conditions below:    * A consists of integers between X and Y (inclusive).   * For each 1\leq i \leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i.  Find the maximum possible length of the sequence.

Submission attempts (in order):
x,y = [int(x) for x in input().split()]

count = 1

while True:
    if x * 2 <= y:
        x = x * 2
        count += 1
    else:
	break

print(count)

x,y = [int(x) for x in input().split()]

count = 1

while True:
    if x * 2 <= y:
        x = x * 2
        count += 1
    else:
        break

print(count)

Verdicts: Runtime Error

Accepted
Problem: As a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence A needs to satisfy the conditions below:    * A consists of integers between X and Y (inclusive).   * For each 1\leq i \leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i.  Find the maximum possible length of the sequence.

Submission attempts (in order):
314159265 358979323846264338

x,y=list(map(int,input().split()))
c=0
while(True):
    if(x<=y):
        x=x*2
        c+=1
    else:
        break

print(c)

Verdicts: Runtime Error

Accepted
Problem: As a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence A needs to satisfy the conditions below:    * A consists of integers between X and Y (inclusive).   * For each 1\leq i \leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i.  Find the maximum possible length of the sequence.

Submission attempts (in order):
import math
x, y = map(int, input().split())
ans = 0



while y > x:
    x = x * 2
    ans += 1

print(ans + 1)

import math
x, y = map(int, input().split())
ans = 0



while y >= x:
    x = x * 2
    ans += 1

print(ans)

Verdicts: Wrong Answer

Accepted
Problem: As a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence A needs to satisfy the conditions below:    * A consists of integers between X and Y (inclusive).   * For each 1\leq i \leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i.  Find the maximum possible length of the sequence.

Submission attempts (in order):
x,y = map(int,input().split())
z = x
j = 1

while z < y:
    z += x ** j
    j += 1

if z == y:
    print(j+1)
else:
    print(j)

x,y = map(int,input().split())
i = 1
while x *(2 ** i) <= y:
    i += 1

print(i)

Verdicts: Wrong Answer

Accepted
Problem: As a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence A needs to satisfy the conditions below:    * A consists of integers between X and Y (inclusive).   * For each 1\leq i \leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i.  Find the maximum possible length of the sequence.

Submission attempts (in order):
x, y = map(int, input().split())
print(len(str(bin(y//x))[2:]+1)

x, y = map(int, input().split())
print(len(bin(y//x)[2:]))

Verdicts: Runtime Error

Accepted
Problem: As a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence A needs to satisfy the conditions below:    * A consists of integers between X and Y (inclusive).   * For each 1\leq i \leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i.  Find the maximum possible length of the sequence.

Submission attempts (in order):
X,Y=map(int,input().split())
import math
print(round(math.log2(Y/X))+1)

X,Y=map(int,input().split())
i=0
while 2**i*X<=Y:
    i+=1
print(i)

Verdicts: Wrong Answer

Accepted
Problem: As a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence A needs to satisfy the conditions below:    * A consists of integers between X and Y (inclusive).   * For each 1\leq i \leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i.  Find the maximum possible length of the sequence.

Submission attempts (in order):
X,Y = map(int,input().split())
y_end = Y - Y%X
count = 0

while X <= y_end:
  print(X)
  count += 1
  X *= 2
print(count)

X,Y = map(int,input().split())
y_end = Y - Y%X
count = 0

while X <= y_end:
  count += 1
  X *= 2
print(count)

Verdicts: Wrong Answer

Accepted
Problem: As a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence A needs to satisfy the conditions below:    * A consists of integers between X and Y (inclusive).   * For each 1\leq i \leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i.  Find the maximum possible length of the sequence.

Submission attempts (in order):
a, b = map(int,input().split())

if b < 2*a:
  print(1)
else:
  print((b-a)//a+1)

a, b = map(int,input().split())
count = 1
# if b < 2*a:
#   print(1)
# else:
while True:
  if 2*a<=b:
    count+=1
    a *= 2
  else:
    break
print(count)

Verdicts: Wrong Answer

Accepted
Problem: As a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence A needs to satisfy the conditions below:    * A consists of integers between X and Y (inclusive).   * For each 1\leq i \leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i.  Find the maximum possible length of the sequence.

Submission attempts (in order):
X, Y = map(int, input().split())
cnt = 0
while X <= Y
  cnt += 1
  X *= 2
print(cnt)

X, Y = map(int, input().split())
cnt = 0
while X <= Y:
  cnt += 1
  X *= 2
print(cnt)

Verdicts: Runtime Error

Accepted
Problem: As a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence A needs to satisfy the conditions below:    * A consists of integers between X and Y (inclusive).   * For each 1\leq i \leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i.  Find the maximum possible length of the sequence.

Submission attempts (in order):
X, Y = map(int, input().split())

cnt = 0
while X <= Y:
  cnt += 1
  X *= X
print(cnt)


X, Y = map(int, input().split())

cnt = 0
while X <= Y:
  cnt += 1
  X *= 2
print(cnt)


Verdicts: Wrong Answer

Accepted
Problem: As a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence A needs to satisfy the conditions below:    * A consists of integers between X and Y (inclusive).   * For each 1\leq i \leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i.  Find the maximum possible length of the sequence.

Submission attempts (in order):
a,b= map(int,input().split())
c = b//a
ans = 0
for i in range(10000):
    if 2**i <= c < 2**(i+1) :
        ans += i
print(a,b,c,ans +1)

a,b= map(int,input().split())
c = b//a
ans = 0
for i in range(10000):
    if 2**i <= c < 2**(i+1) :
        ans += i
print(ans +1)

Verdicts: Wrong Answer

Accepted
Problem: As a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence A needs to satisfy the conditions below:    * A consists of integers between X and Y (inclusive).   * For each 1\leq i \leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i.  Find the maximum possible length of the sequence.

Submission attempts (in order):
'''input
100000000
'''

def list_input():
    return list(map(int,input().split()))
def map_input():
    return map(int,input().split())
def map_string():
    return input().split()
    
s = input()
n = len(s)
cnt = 0
for i in s:
	if i == '0': cnt += 1
print(cnt)	

'''input
010
'''

def list_input():
    return list(map(int,input().split()))
def map_input():
    return map(int,input().split())
def map_string():
    return input().split()
    
s = input()
n = len(s)
cnt = 0
for i in s:
	if i == '0': cnt += 1
print(cnt)	

'''input
010
'''

def list_input():
    return list(map(int,input().split()))
def map_input():
    return map(int,input().split())
def map_string():
    return input().split()
    
s = input()
n = len(s)
l = (n-1)//2
r = n//2
ans = n//2
cur = s[l]
while l >= 0:
	if s[l] == s[r] and s[l] == cur:
		ans += 1
		l -= 1
		r += 1
	else: break
print(ans)		    

'''input
3 20
'''

def list_input():
    return list(map(int,input().split()))
def map_input():
    return map(int,input().split())
def map_string():
    return input().split()
    
x,y = map_input()
ans = 0
while x <= y:
	x *= 2
	ans += 1
print(ans)	

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: As a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence A needs to satisfy the conditions below:    * A consists of integers between X and Y (inclusive).   * For each 1\leq i \leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i.  Find the maximum possible length of the sequence.

Submission attempts (in order):
x,y=map(int,input().split())
c=0
while x<y:
  c+=1
  x*2
print(c)

x,y=map(int,input().split())
c=0
while x<=y:
  c+=1
  x=x*2
print(c)

Verdicts: Wrong Answer

Accepted
Problem: As a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence A needs to satisfy the conditions below:    * A consists of integers between X and Y (inclusive).   * For each 1\leq i \leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i.  Find the maximum possible length of the sequence.

Submission attempts (in order):
x,y=map(int,input().split())
ans=0
while x<=y:
  x*=2
  if x>y:
    break
  ans+=1
print(ans)


x,y=map(int,input().split())
ans=0
while x<=y:
  if 2*x>y:
    break
  ans+=1
print(ans)

x,y=map(int,input().split())
ans=1
while x<=y:
  x*=2
  if x>y:
    break
  ans+=1
print(ans)


Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: As a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence A needs to satisfy the conditions below:    * A consists of integers between X and Y (inclusive).   * For each 1\leq i \leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i.  Find the maximum possible length of the sequence.

Submission attempts (in order):
def solve():
    a,y = map(int,input().split())
    ans = 1
    while(a<=y):
        a*=2
        ans+=1
    print(ans)
if __name__ == "__main__":
    solve()

def solve():
    a,y = map(int,input().split())
    ans = 1
    while(a<=y){
        a*=2
        ans+=1
    }
    print(ans)
if __name__ == "__main__":
    solve()

def solve():
    x,y = map(int,input().split())
    cnt = 0
    while x<=y:
        x*=2
        cnt+=1
    print(cnt)
if __name__=='__main__':
    solve()

Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: As a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence A needs to satisfy the conditions below:    * A consists of integers between X and Y (inclusive).   * For each 1\leq i \leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i.  Find the maximum possible length of the sequence.

Submission attempts (in order):
x,y = tuple(map(int,input().split()))

for i in range(1,10*4):
  x<<=1
  if x>y:
    print(i)

x,y = tuple(map(int,input().split()))

for i in range(1,10*4):
  x<<=1
  if x>y:
    print(i)
	break

x,y = tuple(map(int,input().split()))

for i in range(1,10**18):
  x<<=1
  if x>y:
    print(i)
    break


Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: As a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence A needs to satisfy the conditions below:    * A consists of integers between X and Y (inclusive).   * For each 1\leq i \leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i.  Find the maximum possible length of the sequence.

Submission attempts (in order):
X,Y = map(int,input().split())

if X == Y:
  print('1')
  
else:
  for i in range(Y//X+1):
    print(X*2**i)
    if X*(2**i) > Y:
      print(i)
      exit()

X,Y = map(int,input().split())

if X == Y:
  print('1')
  
else:
  for i in range(Y//X+1):
    if X*(2**i) > Y:
      print(i)
      exit()

Verdicts: Wrong Answer

Accepted
Problem: As a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence A needs to satisfy the conditions below:    * A consists of integers between X and Y (inclusive).   * For each 1\leq i \leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i.  Find the maximum possible length of the sequence.

Submission attempts (in order):
import math
x,y = map(int,input().rstrip().split(' '))
n = int(math.log2(y/x))
print(n)

import math
x,y = map(int,input().rstrip().split(' '))
n = int(math.log2(y//x))
print(n)


import math
x,y = map(int, input().rstrip().split(' '))
# n = int(math.log2(y/x))
# print(n+1)

for i in range(100):
  a = x*(2**i)
  if(a<=y):
    continue
  else:
    print(i)
    break


Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: As a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence A needs to satisfy the conditions below:    * A consists of integers between X and Y (inclusive).   * For each 1\leq i \leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i.  Find the maximum possible length of the sequence.

Submission attempts (in order):
X,Y = map(int,input())
ans = 0
while X <= Y:
	ans += 1
	X * = 2
print(ans)

X, Y = map(int, input().split())
score = 1
A = X
while 1:
    A *= 2
    if(A <= Y):
        score += 1
    else:
        print(score)
        break

Verdicts: Runtime Error

Accepted
Problem: As a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence A needs to satisfy the conditions below:    * A consists of integers between X and Y (inclusive).   * For each 1\leq i \leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i.  Find the maximum possible length of the sequence.

Submission attempts (in order):
from math import frexp
a, b = map(int, input().split())
print(frexp(b)-frexp(a)+1)

from math import frexp
a, b = map(int, input().split())
print(frexp(b)[1]-frexp(a)[1]+1)

  from math import frexp
  a, b = map(int, input().split())
  print(frexp(b)[1]-frexp(a)[1]+1)

x, y = list(map(int, input().split()))
a = x
ans = 0
while a <= y:
    a = a << 1
    ans += 1
print(ans)


Verdicts: Runtime Error

Wrong Answer

Runtime Error

Accepted
Problem: As a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence A needs to satisfy the conditions below:    * A consists of integers between X and Y (inclusive).   * For each 1\leq i \leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i.  Find the maximum possible length of the sequence.

Submission attempts (in order):
X,Y = map(int, input().split())

ans = X
count = 0
while(ans < Y):
  if(ans*2>Y):
    exit()
  else:
    ans = ans * 2
    count += 1
    
print(ans)
    

X,Y = map(int, input().split())

ans = X
count = 0

while(ans < Y):
  if(ans*2>Y):
    break
  else:
    ans = ans * 2
    count = count + 1
    
print(count + 1)

Verdicts: Wrong Answer

Accepted
Problem: You are given a string S consisting of `0` and `1`. Find the maximum integer K not greater than |S| such that we can turn all the characters of S into `0` by repeating the following operation some number of times.    * Choose a contiguous segment [l,r] in S whose length is at least K (that is, r-l+1\geq K must be satisfied). For each integer i such that l\leq i\leq r, do the following: if S_i is `0`, replace it with `1`; if S_i is `1`, replace it with `0`.

Submission attempts (in order):
S = list(map(int, list(input())))

zero = 1000000
one = 1000000
current_zero = 0
current_one = 0

for i in range(len(S)- 1):
	if S[i] == 0:
		current_zero += 1
	else:
		current_one += 1
	if S[i] != S[i+1]:
		if S[i] == 0 and current_zero < zero:
			zero = current_zero
		elif S[i] == 1 and current_one < one:
			one = current_one
		current_zero = 0
		current_one = 0
	elif i == len(S) - 2:
		if S[i] == 0:
			current_zero += 1
			if current_zero < zero:
				zero = current_zero
		else:
			current_one += 1
			if current_one < one:
				one = current_one
print(zero, one)
print(max(2, max(zero, one)))

S = list(map(int, list(input())))
n = len(S)

if len(set(S)) == 1:
	print(len(S))
else:
	ans = 1000000
	for i in range(n-1):
		if S[i] != S[i+1]:
			m = max(n - i - 1, i + 1)
			if m < ans:
				ans = m

	print(ans)

Verdicts: Wrong Answer

Accepted
Problem: You are given a string S consisting of `0` and `1`. Find the maximum integer K not greater than |S| such that we can turn all the characters of S into `0` by repeating the following operation some number of times.    * Choose a contiguous segment [l,r] in S whose length is at least K (that is, r-l+1\geq K must be satisfied). For each integer i such that l\leq i\leq r, do the following: if S_i is `0`, replace it with `1`; if S_i is `1`, replace it with `0`.

Submission attempts (in order):
s = input()

l = len(s)
count = 0
for i,x in enumerate(s):
    if i == 0:
        pass
    else:
        if x != s[i-1]:
            count += 1
        else:
            if count % 2 == 0:
                a = count + 1
                if a < l:
                    l = a
            else:
                a = count
                if a < l:
                    l = a
            count = 0

print((count+1)//2)

s = input()

l = len(s)

for i,x in enumerate(s):
    if i == 0:
        pass
    else:
        if x != s[i-1]:
            count += 1
        else:
            if count % 2 == 0:
                a = count -1
                if a <= l:
                    l = a
            else:
                a = count
                if a <= l:
                    l = a
            count = 0

print((count+1)//2)

s = input()

l = len(s)
count = 0
for i,x in enumerate(s):
    if i == 0:
        pass
    else:
        if x != s[i-1]:
            count += 1
        else:
            if count % 2 == 0:
                a = count -1
                if a <= l:
                    l = a
            else:
                a = count
                if a <= l:
                    l = a
            count = 0

print((count+1)//2)

s = input()

l = len(s)

t = l

for i,x in enumerate(s):
    if i == 0:
        pass
    else:
        if x != s[i-1]:
            a = max(i,l-i)
            t = min(t,a)

print(t)

Verdicts: Wrong Answer

Runtime Error

Wrong Answer

Accepted
Problem: You are given a string S consisting of `0` and `1`. Find the maximum integer K not greater than |S| such that we can turn all the characters of S into `0` by repeating the following operation some number of times.    * Choose a contiguous segment [l,r] in S whose length is at least K (that is, r-l+1\geq K must be satisfied). For each integer i such that l\leq i\leq r, do the following: if S_i is `0`, replace it with `1`; if S_i is `1`, replace it with `0`.

Submission attempts (in order):
'''input
010
'''

def list_input():
    return list(map(int,input().split()))
def map_input():
    return map(int,input().split())
def map_string():
    return input().split()
    
s = input()
n = len(s)
cnt = 0
for i in s:
	if i == '0': cnt += 1
print(max(cnt,n-cnt)-1)	

'''input
010
'''

def list_input():
    return list(map(int,input().split()))
def map_input():
    return map(int,input().split())
def map_string():
    return input().split()
    
s = input()
n = len(s)
l = (n-1)//2
r = n//2
ans = n//2
cur = s[l]
while l >= 0:
	if s[l] == s[r] and s[l] == cur:
		ans += 1
		l -= 1
		r += 1
	else: break
print(ans)		    

Verdicts: Wrong Answer

Accepted
Problem: You are given a string S consisting of `0` and `1`. Find the maximum integer K not greater than |S| such that we can turn all the characters of S into `0` by repeating the following operation some number of times.    * Choose a contiguous segment [l,r] in S whose length is at least K (that is, r-l+1\geq K must be satisfied). For each integer i such that l\leq i\leq r, do the following: if S_i is `0`, replace it with `1`; if S_i is `1`, replace it with `0`.

Submission attempts (in order):
s = list(input())
n = len(s)
ans = 10**5
for i in range(n-1):
    if s[i] != s[i+1]:
        v = max(i,n-i-1)
        ans = min(ans,v)
print(ans)

s = list(input())
n = len(s)
ans = n
for i in range(n-1):
    if s[i] != s[i+1]:
        v = max(i+1,n-i-1)
        ans = min(ans,v)
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: You are given a string S consisting of `0` and `1`. Find the maximum integer K not greater than |S| such that we can turn all the characters of S into `0` by repeating the following operation some number of times.    * Choose a contiguous segment [l,r] in S whose length is at least K (that is, r-l+1\geq K must be satisfied). For each integer i such that l\leq i\leq r, do the following: if S_i is `0`, replace it with `1`; if S_i is `1`, replace it with `0`.

Submission attempts (in order):
import sys
#import numpy as np

stdin = sys.stdin

ri = lambda: int(rs())
rl = lambda: list(map(int, stdin.readline().split()))  # applies to numbers only
rs = lambda: stdin.readline().rstrip()  

S = list(input())
N = len(S)
answer = (N+1)//2
streak = 1
cur = None
result = 0
for x in S:
    if cur == x:
        streak += 1
    else:
        cur = x
        streak = 1
    if streak > result:
        result = streak

while answer < N:
    S2 = S[-answer-1:answer+1]
    print(S2)
    if len(set(S2)) == 1:
        answer += 1
        continue
    else:
        break

print(answer)


import sys
#import numpy as np

stdin = sys.stdin

ri = lambda: int(rs())
rl = lambda: list(map(int, stdin.readline().split()))  # applies to numbers only
rs = lambda: stdin.readline().rstrip()  

S = list(input())
N = len(S)
answer = (N+1)//2

if len(set(S)) == 1:
    print(N)
    exit()
right = N
left = answer

while right > left + 1:
    mid = (right + left) // 2
    S2 = S[-mid:mid]
    if len(set(S2)) == 1:
        left = mid
    else:
        right = mid

print(left)


Verdicts: Wrong Answer

Accepted