Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
D, G = map(int, input().split())
P = []
C = []
A = []
for i in range(D):
  p, c = map(int, input().split())
  for j in range(p - 1):
    P.append((i + 1) * 100 * (j + 1))
    C.append(j + 1)
    A.append(i + 1)
  P.append((i + 1) * 100 * p + c)
  C.append(p)
  A.append(i + 1)
  
out = 1000
for i in range(2**len(P)):
  total = 0
  count = 0
  solved = []
  for j in range(len(P)):
    if i & (1 << j):
      if A[j] not in solved:
        total += P[j]
        count += C[j]
        solved.append(A[j])
  if total >= G:
    if count < out:
      out = count
print(out)

Fixed submission:
D, G = map(int, input().split())
P = []
C = []
for i in range(D):
  p, c = map(int, input().split())
  P.append(p)
  C.append(c)
  
out = 1000
for i in range(2**D):
  total = 0
  count = 0
  for j in range(D):
    p, c = P[j], C[j]
    if i & (1 << j):
      count += p
      total += p * 100 * (j + 1) + c
    else:
      k = j
      
  if total >= G:
    out = min(out, count) 
    continue
    
  p = P[k]
  for j in range(p):
    count += 1
    total += 100 * (k + 1)
    if total >= G:
      out = min(out, count)
      break

print(out)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = map(int, input().split()).sort()

Alice = 0
Bob = 0
for i, v in enumerate(A[::-1]):
	if i % 2 == 0:
      Alice += v
    else:
      Bob += v
print(Alice - Bob)

Fixed submission:
N = int(input())
A = [int(v) for v in input().split()]
A.sort()

Alice = 0
Bob = 0
for i, v in enumerate(A[::-1]):
  if i % 2 == 0:
    Alice += v
  else:
    Bob += v
print(Alice - Bob)
Buggy python submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = int(input())
X = int(input())

ret = 0
for i in range(X / A + 1):
  for j in range((X - i * 500) / B + 1):
    for k in range((X - i * 500 - j * 100) / C + 1):
      if i * 500 + j * 100 + k + 50 == x:
        ret += 1
print(ret)

Fixed submission:
A = int(input())
B = int(input())
C = int(input())
X = int(input())

ret = 0
for i in range(int(min(X / 500, A) + 1)):
  for j in range(int(min((X - i * 500) / 100, B) + 1)):
    for k in range(int(min((X - i * 500 - j * 100) / 50, C) + 1)):
      if i * 500 + j * 100 + k * 50 == X:
        ret += 1
print(ret)
Buggy python submission (verdict: Runtime Error):
N, A, B = map(int, input().split())
sum = 0
for 1 in range(N + 1):
  if i % 10 >= A and i % 10 <= B:
    sum += i
print(sum)

Fixed submission:
N, A, B = map(int, input().split())
ret = 0
for i in range(N + 1):
  v = sum(map(int, list(str(i))))
  if v >= A and v <= B:
    ret += i
print(ret)
Buggy python submission (verdict: Runtime Error):
X, Y = map(int, input().split())
count = 0
while True:
  count++
  X = X * 2
  if X > Y:
    break
print(count)

Fixed submission:
X, Y = map(int, input().split())
count = 0
while True:
  count = count + 1
  X = X * 2
  if X > Y:
    break
print(count)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))

ret = 0
flag = True
while(flag):
  for i in range(3):
    if(A[i] % 2 != 0):
      flag = False
    else:
      A[i] /= 2
  if(flag):
    ret += 1  
print(ret)

Fixed submission:
s1, s2, s3 = map(int, list(input()))
print(s1 + s2 + s3)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = map(int, input().split())

ret = 0
while(True):
  for(i=0; i<N; i++):
    if(A[i] % 2 != 0):
      break;
    else:
      A[i] /= 2
    ret += 1
print(ret)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))

ret = 0
flag = True
while(flag):
  for i in range(N):
    if(A[i] % 2 != 0):
      flag = False
    else:
      A[i] /= 2
  if(flag):
    ret += 1  
print(ret)
Buggy python submission (verdict: Runtime Error):
A = [int(v) for v in input()]

for i in range(2):
  total = A[0]
  if i == 0:
    total += A[1]
  else:
    total -= A[1]
  for j in range(2):
    if j == 0:
      total += A[2]
    else:
      total -= A[2]
    for k in range(2):
      if k == 0:
        total += A[3]
      else:
        total -= A[3]
      if total == 7:
        print(A[0], end='')
        if i == 0:
          print('+{}'.format(A[1]), end='')
        else:
          print('-{}'.format(A[1]), end='')
        if j == 0:
          print('+{}'.format(A[2]), end='')
        else:
          print('-{}'.format(A[2]), end='')
        if k == 0:
          print('+{}=7'.format(A[3]))
        else:
          print('-{}=7'.format(A[3]))
        return

Fixed submission:
A = [int(v) for v in input()]

flag = False
for i in range(2):
  if flag:
    break
  total = A[0]
  if i == 0:
    total += A[1]
  else:
    total -= A[1]
  for j in range(2):
    if flag:
      break
    total2 = total
    if j == 0:
      total2 += A[2]
    else:
      total2 -= A[2]
    for k in range(2):
      total3 = total2
      if k == 0:
        total3 += A[3]
      else:
        total3 -= A[3]
      if total3 == 7:
        print(A[0], end='')
        if i == 0:
          print('+{}'.format(A[1]), end='')
        else:
          print('-{}'.format(A[1]), end='')
        if j == 0:
          print('+{}'.format(A[2]), end='')
        else:
          print('-{}'.format(A[2]), end='')
        if k == 0:
          print('+{}=7'.format(A[3]))
        else:
          print('-{}=7'.format(A[3]))
        flag = True
        break
Buggy python submission (verdict: Runtime Error):
S = input()
T = input()

for i in range(len(S) - len(T), -1, -1):
  flag = True
  for j in range(len(T)):
    if S[i+j] != '?' and S[i+j] != T[j]:
      flag = False
      break
  if flag:
    break
if flag:
  U = S[:i] + T + S[i+len(T):]
  U = U.replace('?', 'a')
  print(U)
else:
  print('UNRESTORABLE')

Fixed submission:
S = input()
T = input()

flag = False
for i in range(len(S) - len(T), -1, -1):
  flag = True
  for j in range(len(T)):
    if S[i+j] != '?' and S[i+j] != T[j]:
      flag = False
      break
  if flag:
    break
if flag:
  U = S[:i] + T + S[i+len(T):]
  U = U.replace('?', 'a')
  print(U)
else:
  print('UNRESTORABLE')

Buggy python submission (verdict: Runtime Error):
S = input()
T = input()

for i in range(len(S) - len(T), -1, -1):
  flag = True
  for j in range(len(T)):
    if S[i+j] != '?' and S[i+j] != T[j]:
      flag = False
      break
  if flag:
    break
if flag:
  U = S[:i] + T + S[i+len(T):]
  U = U.replace('?', 'a')
  print(U)
else:
  print('UNRESTORABLE')

Fixed submission:
S = input()
T = input()

flag = False
for i in range(len(S) - len(T), -1, -1):
  flag = True
  for j in range(len(T)):
    if S[i+j] != '?' and S[i+j] != T[j]:
      flag = False
      break
  if flag:
    break
if flag:
  U = S[:i] + T + S[i+len(T):]
  U = U.replace('?', 'a')
  print(U)
else:
  print('UNRESTORABLE')
Buggy python submission (verdict: Runtime Error):
import numpy as np

H, W = map(int, input().split())
A = []
for i in range(H):
  A.append(input())
  
for i in range(H):
  for j in range(W):
    if A[i][j] == '#':
      print('#', end='')
    count = 0
    for k in range(min(0, i-1), max(i+1, H-1)+1):
      for l in range(min(0, j-1), max(j+1, W-1)+1):
        if A[k][l] == '#':
          count += 1
    print(count, end='')
  print()

Fixed submission:
H, W = map(int, input().split())
A = []
for i in range(H):
  A.append(input())
  
for i in range(H):
  for j in range(W):
    if A[i][j] == '#':
      print('#', end='')
    else:
      count = 0
      for k in range(max(0, i-1), min(i+1, H-1)+1):
        for l in range(max(0, j-1), min(j+1, W-1)+1):
          if A[k][l] == '#':
            count += 1
      print(count, end='')
  print()
Buggy python submission (verdict: Runtime Error):
A, B, C, D = map(int, input())
s = max(A, C)
e = min(B, D)
span = max(0, e - s)
print(span)

Fixed submission:
A, B, C, D = map(int, input().split())
s = max(A, C)
e = min(B, D)
span = max(0, e - s)
print(span)
Buggy python submission (verdict: Runtime Error):
from collections import deque

N, M = list(map(int, input().split()))
G = [[] for _ in range(N)]
for _ in range(M):
  a, b = list(map(int, input().split()))
  G[a-1].append(b-1)
  G[b-1].append(a-1)
  
ans = 0
v = 0
s = 1
l = 1
q = deque()
q.append((v, s, l))

while q:
  v, s, l = q.popleft()
  if l == N:
    ans += 1
    continue
  for nv in G[v]:
    if s&(1<<n) == 0:
      q.append((nv, s|(1<<n), l+1))
print(ans)

Fixed submission:
from collections import deque

N, M = list(map(int, input().split()))
G = [[] for _ in range(N)]
for _ in range(M):
  a, b = list(map(int, input().split()))
  G[a-1].append(b-1)
  G[b-1].append(a-1)
  
ans = 0
v = 0
s = 1
l = 1
q = deque()
q.append((v, s, l))

while q:
  v, s, l = q.popleft()
  if l == N:
    ans += 1
    continue
  for nv in G[v]:
    if s&(1<<nv) == 0:
      q.append((nv, s|(1<<nv), l+1))
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
K, S = map(int, input().split())
count = 0
for i in range(K + 1):
  for j in range(K + 1):
    for k in range(K + 1):
      if i + j + k == S:
        count += 1
print(count)

Fixed submission:
K, S = map(int, input().split())
count = 0
for i in range(K + 1):
  for j in range(K + 1):
      if i + j <= S and i + j >= S - K:
        count += 1
print(count)
Buggy python submission (verdict: Runtime Error):
N = int(input())

edges = [[] for _ in range(N)]
for i in range(N-1):
    u, v, w = map(int, input().split())
    edges[u-1].append((v-1, w))
    edges[v-1].append((u-1, w))

dist = [0 for _ in range(N)]
def measure(src):
    """
    srcを根とした木に対し、根から各頂点までの距離を求める
    """
    for v, w in edges[src]:
        dist[v] = dist[src] + w
        measure(v) 
measure(0)

for i in range(N):
    if dist[i] % 2:
        print(1)
    else:
        print(0)


Fixed submission:
import sys
sys.setrecursionlimit(100000)

N = int(input())

edges = [[] for _ in range(N)]
for i in range(N-1):
    u, v, w = map(int, input().split())
    edges[u-1].append((v-1, w))
    edges[v-1].append((u-1, w))

dist = [-1 for _ in range(N)]
def measure(src):
    """
    srcを根とした木に対し、根から各頂点までの距離を求める
    """
    for v, w in edges[src]:
        if dist[v] == -1:
            dist[v] = dist[src] + w
            measure(v)

dist[0] = 0
measure(0)

for i in range(N):
    if dist[i] % 2:
        print(1)
    else:
        print(0)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))

# 2進数のカウンターを使って全探索する

ans = 0
cnt = 0 # カウンター

def get_value(b):
    """
    バイナリ値bを受け取り、X-Yを計算する
    """
    X = 0
    Y = 0
    for i in range(N):
        if b[i] == "1":
            X += V[i]
            Y += C[i]
    return X - Y

while cnt < 2 ** N:
    b = bin(cnt)[2:]
    ans = max(ans, get_value("0" * (N - len(b)) + b))
    cnt += 1

print(ans)

Fixed submission:
N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))

# V_i > C_iなら選ぶ

ans = 0 # 価値の合計

for i in range(N):
	if V[i] > C[i]:
		ans += V[i] - C[i]

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
S = input()

n = []
t = 1
c = 0
for i in range(0, N):
    if (S[i] == str(t)):
        c += 1
    else:
        n.append(c)
        t = 1 - t
        c = 1
if c != 0:
    n.append(c) 

# 1で始まって1で終わるように調節
if len(n) % 2 == 0:
    n.append(0)   

s = 2 * K + 1
a = 0
for i in range(0, len(n), 2):
    tmp = 0 

    l = i 
    r = min(i + s, len(n))
    for j in range(l, r):
        tmp += n[j]

    a = max(a, tmp)

print(a)

Fixed submission:
def shaktori(n, tmp=0, l_s=0, r_s=0, l=0, r=0):
    while l_s > l:
        tmp -= n[l]
        l += 1
    while r_s > r:
        tmp += n[r] 
        r += 1 
    return (tmp, l, r)

N, K = map(int, input().split())
S = input()

n = []
t = 1
c = 0
for i in range(0, N):
    if (S[i] == str(t)):
        c += 1
    else:
        n.append(c)
        t = 1 - t
        c = 1
if c != 0:
    n.append(c) 

# 1で始まって1で終わるように調節
if len(n) % 2 == 0:
    n.append(0)   

s = 2 * K + 1
a = 0
tmp = 0
l, r = 0, 0
for i in range(0, len(n), 2):
    l_s = i 
    r_s = min(i + s, len(n))
    tmp, l, r = shaktori(n, tmp, l_s, r_s, l, r)

    a = max(a, tmp)

print(a)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
abcde = [int(input()) for _ in range(5)]

# 移動者の状態
transferee = [N] + [0 for _ in range(5)]

# 毎ターンできる限りの人を次の都市に輸送
time = 0 # 現在時刻
while transferee[-1] != N:
    for i in range(0, 5)[::-1]:
        if transferee[i] - abcde[i] >= 0:
            transferee[i+1] += abcde[i]
            transferee[i] -= abcde[i]
        else:
            transferee[i+1] += transferee[i]
            transferee[i] = 0

    time += 1

print(time)

Fixed submission:
import math

N = int(input())
abcde = [int(input()) for _ in range(5)]

# 交通機関のうち、最初の輸送可能乗客数を持つものに合わせる
X = min(abcde)
print(math.ceil(N / X) - 1 + 5)
Buggy python submission (verdict: Runtime Error):
S = input() 

if len(S) == 0:
    print(0)

else:
    # 見つけ次第消していく
    c = 0 # 消したキューブの数
    i = 1
    while i < len(S):
        if int(S[i-1]) + int(S[i]) == 1:
            S = S[:i-1] + S[i+1:]
            i -= 1
            c += 2
        else:
            i += 1

    print(c)


Fixed submission:
S = input()

if len(S) == 0:
    print(0)

else:
    # 1の数
    s = 0
    for i in range(len(S)):
        s += int(S[i])

    print(min(s, len(S)-s)*2)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))

# 最大公約数が答え

import math
import functools

print(functools.reduce(math.gcd, A))

Fixed submission:
N = int(input())
A = list(map(int, input().split()))

# 最大公約数が答え

import fractions
import functools

print(functools.reduce(fractions.gcd, A))
Buggy python submission (verdict: Runtime Error):
# coding=utf-8
S = int(input())

# 0と1の個数のうち、大きい方
cnt = 0
for i in range(len(S)):
    if S[i] == "0":
        cnt += 1
cnt = max(cnt, len(S) - cnt)
print(cnt)


Fixed submission:
S = input()

ans = len(S)
for i in range(1, len(S)):
    if S[i-1] != S[i]:
        ans = min(ans, max(i, len(S)-i))

print(ans)
Buggy python submission (verdict: Runtime Error):
S = input()
T = input()

# Tが当てはまる？
s = 0 # Tが当てはまる最初のインデックス
for i in range(len(S)-len(T)+1):
    flag = 1
    for j in range(len(T)):
        if S[i+j] != "?" and S[i+j] != T[j]:
            flag = 0
    if flag:
        s = i
        break

if not flag:
    print("UNRESTORABLE")
else: # Tが当てはまった場合
    S = S[:s] + T + S[s+len(T):]
    # "?"を"a"で埋める
    S = S.replace("?", "a")
    print(S)

Fixed submission:
S = input()
T = input()

# Tが当てはまる？
s = 0 # Tが当てはまる最初のインデックス
for i in range(len(S)-len(T)+1)[::-1]:
    flag = 1
    for j in range(len(T)):
        if S[i+j] != "?" and S[i+j] != T[j]:
            flag = 0
            break
    if flag:
        s = i
        break

if len(S) < len(T) or not flag:
    print("UNRESTORABLE")
else: # Tが当てはまった場合
    S = S[:s] + T + S[s+len(T):]
    # "?"を"a"で埋める
    S = S.replace("?", "a")
    print(S)
Buggy python submission (verdict: Runtime Error):
class nnDigitSum:
	def dfs(self,b,n):
		if n<b:
			return n
		return self.dfs(b,n/b)+n%b
	def returnMinimumB(self,n,s):
		i=2
		while i*i<=n:
			if self.dfs(i,n)==s: return i
			i+=1
		cands=[]
		i=1
		while i*i<=n-2:
			if not (n-s)%i: cands.append((n-s)/i+1)
			i+=1
		cands=sorted(cands)
		for cand in cands:
			if self.dfs(cand,n)==s: return cand
		if n==s:
			return n+1
		elif s==1:
			return n
		return -1
if __name__ == "__main__":
	N = int(raw_input())
	s = int(raw_input())
	d = nnDigitSum()
	print d.returnMinimumB(N,s)

Fixed submission:
class nnDigitSum:
	def dfs(self,b,n):
		if n<b:
			return n
		return self.dfs(b,n/b)+n%b
	def returnMinimumB(self,n,s):
		if n<s: return -1
		if n==s: return n+1
		i=2
		while i*i<=n:
			if self.dfs(i,n)==s: return i
			i+=1
		cands=[]
		i=1
		while i*i<=n-2:
			if not (n-s)%i: cands.append((n-s)/i+1)
			i+=1
		cands=sorted(cands)
		for cand in cands:
			if self.dfs(cand,n)==s: return cand
		if s==1: return n
		return -1
if __name__ == "__main__":
	N = int(raw_input())
	s = int(raw_input())
	d = nnDigitSum()
	print d.returnMinimumB(N,s)
Buggy python submission (verdict: Time Limit Exceeded):
class Unbalanced:
	def searchStrings(self,s):
		words=[[[0 for j in range(26)] for i in range(len(s)-1)]for k in range(len(s))]
		for k in range(len(s)):
			for i in range(0,k+1):
				words[k][i][ord(s[i])-97]+=1
				for j in range(i+1,k+1):
					words[k][i][ord(s[j])-97]+=1
					if max(words[k][i])>=len(s[i:j+1])/2+1:
						print i+1,j+1
						return
		print -1,-1

if __name__ == "__main__":
	s=raw_input()
	u=Unbalanced()
	u.searchStrings(s)

Fixed submission:
class nUnbalanced:
	def searchStrings(self,s):
		if len(s)==2:
			x_f=s[0]; x_s=s[1]
			if x_f==x_s: print 1,2; return
			else: print -1,-1; return
		for base in range(len(s)-2):
			x_f=s[base]; x_s=s[base+1]; x_t=s[base+2]
			if x_f==x_s or x_s==x_t or x_f==x_t: print base+1,base+3; return
		print -1,-1

if __name__ == "__main__":
	s=raw_input()
	u=nUnbalanced()
	u.searchStrings(s)

Buggy python submission (verdict: Time Limit Exceeded):
class Unbalanced:
	def searchStrings(self,s):
		words=[[[0 for j in range(26)] for i in range(len(s)-1)]for k in range(len(s))]
		for k in range(len(s)):
			for i in range(0,len(s)-1):
				words[k][i][ord(s[i])-97]+=1
				for j in range(i+1,len(s)):
					words[k][i][ord(s[j])-97]+=1
					if max(words[k][i])>=len(s[i:j+1])/2+1:
						print i+1,j+1
						return
		print -1,-1

if __name__ == "__main__":
	s=raw_input()
	u=Unbalanced()
	u.searchStrings(s)

Fixed submission:
class nUnbalanced:
	def searchStrings(self,s):
		if len(s)==2:
			x_f=s[0]; x_s=s[1]
			if x_f==x_s: print 1,2; return
			else: print -1,-1; return
		for base in range(len(s)-2):
			x_f=s[base]; x_s=s[base+1]; x_t=s[base+2]
			if x_f==x_s or x_s==x_t or x_f==x_t: print base+1,base+3; return
		print -1,-1

if __name__ == "__main__":
	s=raw_input()
	u=nUnbalanced()
	u.searchStrings(s)

Buggy python submission (verdict: Time Limit Exceeded):
class Unbalanced:
	def serchStrings(self,s):
		words=[0 for i in range(26)]
		for i in range(0,len(s)-1):
			words[ord(s[i])-97]+=1
			for j in range(i+1,len(s)):
				words[ord(s[j])-97]+=1
				if max(words)>=len(s[i:j+1])/2+1:
					print i+1,j+1
					return
			words=[0 for i in range(26)]
		print -1,-1

if __name__ == "__main__":
	s=raw_input()
	u=Unbalanced()
	u.serchStrings(s)

Fixed submission:
class nUnbalanced:
	def searchStrings(self,s):
		if len(s)==2:
			x_f=s[0]; x_s=s[1]
			if x_f==x_s: print 1,2; return
			else: print -1,-1; return
		for base in range(len(s)-2):
			x_f=s[base]; x_s=s[base+1]; x_t=s[base+2]
			if x_f==x_s or x_s==x_t or x_f==x_t: print base+1,base+3; return
		print -1,-1

if __name__ == "__main__":
	s=raw_input()
	u=nUnbalanced()
	u.searchStrings(s)
Buggy python submission (verdict: Time Limit Exceeded):
import fractions
import itertools as it

N = int(input())
a = list(map(int, input().split()))
ccb = it.combinations(a, int(N-1))

tmp = []
for element in ccb:
	tmp.append((element))

ans = 0

for i in tmp:
    hoge = list(i)
    pairgcd = hoge[0]
    for k in range(len(hoge)):
        pairgcd = fractions.gcd(pairgcd, hoge[k])
    if pairgcd > ans:
        ans = pairgcd

print(ans)

Fixed submission:
import fractions

N = int(input())
a = list(map(int,input().split()))

ans = 0

lf = [0]*N
rf = [0]*N

for i in range(1,N):
    lf[i] = fractions.gcd(lf[i-1],a[i-1])
    rf[i] = fractions.gcd(rf[i-1],a[-i])

ans = 0
for i in range(N):
    ans = max(ans,fractions.gcd(lf[i],rf[-i-1]))

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N, K = list(map(int, input().split()))
S = list(map(int,input()))

# Sに登場する文字1, 0を左から順にまとめる
array = []
count = 1
for i in range(N+1):
    if i == 0:
        continue
    if i == N:
        # 終了処理
        array.append([S[i-1], count])
        count = 1
        continue
    if S[i-1] == S[i]:
        # カウンターを回す
        count += 1
        continue
    if not S[i-1] == S[i]:
        # ブロック作成
        array.append([S[i-1], count])
        count = 1

maxhito = 0
hito = 0
maxcount = 0

for l in range(len(array)):
    if array[l][0] == 0:
        maxcount += 1

K = min(K, maxcount)

if array[0][0] == 0:
    start = 0
else:
    start = 1

for i in range(start, len(array) - K + 1, 2):
    if i == 0:
        hito = 0
    else:
        hito = array[i-1][1]

    for j in range(i, min(len(array), i+2*K), 1):
        hito += array[j][1]

    if hito > maxhito:
        maxhito = hito

print(maxhito)

Fixed submission:
def main():
    N, K = map(int, input().split())
    S = input()

    countlist = [0]
    if S[0] == "0":
        countlist.append(0)
    last_char = S[0]
    for s in S:
        if s == last_char:
            countlist[-1] += 1
        else:
            countlist.append(1)
            last_char = s

    if S[-1] == "0":
        countlist.append(0)

    l, r = 0, K * 2 + 1
    maxhito = last_count = sum(countlist[l:r])
    while True:
        l, r = l + 2, r + 2
        if len(countlist) < r:
            break
        count = last_count - (countlist[l - 1] + countlist[l - 2]) + (countlist[r - 1] + countlist[r - 2])
        maxhito = max(maxhito, count)
        last_count = count
    print(maxhito)


main()
Buggy python submission (verdict: Runtime Error):
N = int(input())

sosuu = 1
for i in range(1,int(math.sqrt(N+1))):
    if N % i == 0:
        sosuu = i
        B = N // i

print(len(str(max(sosuu, B))))


Fixed submission:
import math

N = int(input())

sosuu = 1
B = 1
for i in range(1,int(math.sqrt(N)+1)):
    if N % i == 0:
        sosuu = i
        B = N // i

print(len(str(max(sosuu, B))))

Buggy python submission (verdict: Runtime Error):
import math

N = int(input())

sosuu = 1
for i in range(1,int(math.sqrt(N))):
    if N % i == 0:
        sosuu = i
        B = N // i

print(len(str(max(sosuu, B))))


Fixed submission:
import math

N = int(input())

sosuu = 1
B = 1
for i in range(1,int(math.sqrt(N)+1)):
    if N % i == 0:
        sosuu = i
        B = N // i

print(len(str(max(sosuu, B))))
Buggy python submission (verdict: Runtime Error):

(A, B, T) = (int, input().split())

biscuit = 0

for i in range(0, A*10, T*10 + 5):
    biscuit += B

print(B)
    


Fixed submission:

(A, B, T) = map(int, input().split(" "))

biscuit = 0

for i in range(A * 10, T*10 + 5, A * 10):
    biscuit += B

print(biscuit)
Buggy python submission (verdict: Runtime Error):

(N, K) = map(int, input().split(" "))
S = input()

nowOn = S[0]
count = 0
serialList = []

for i in S:

    if(nowOn == i):
        count += 1

    else:
        serialList.append(count)
        count = 1
        nowOn = i

serialList.append(count)

T = 2 * K + 1
A = 0

#serialList -> ["1", "0", "1", "0", ...]
if S[0] == "0":
    serialList.insert(0, 0)
    
#exception
# --???

maxA = 0
for i in range(T):
    A += serialList[i]
    maxA = A
    
for i in range(T, len(serialList), 2):
    A -= serialList[i - T]
    A -= serialList[i - T + 1]
    A += serialList[i]

    if(i+1 < len(serialList)):
        A += serialList[i + 1]

    if maxA < A:
        maxA = A
        
print(maxA)



Fixed submission:
import sys

(N, K) = map(int, input().split(" "))
S = input()

nowOn = S[0]
count = 0
serialList = []

for i in S:

    if(nowOn == i):
        count += 1

    else:
        serialList.append(count)
        count = 1
        nowOn = i

serialList.append(count)

T = 2 * K + 1
A = 0

#serialList -> ["1", "0", "1", "0", ...]
if S[0] == "0":
    serialList.insert(0, 0)
    
#exception
if int(len(serialList) / 2) < K:
    print(len(S))
    sys.exit()

maxA = 0
for i in range(T):
    A += serialList[i]
    maxA = A
    
for i in range(T, len(serialList), 2):
    A -= serialList[i - T]
    A -= serialList[i - T + 1]
    A += serialList[i]

    if(i+1 < len(serialList)):
        A += serialList[i + 1]

    if maxA < A:
        maxA = A
        
print(maxA)
Buggy python submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
if a == b and b == c:
  return True
return False

Fixed submission:
a, b, c = map(int, input().split())
if a == b and b == c:
	print('Yes')
else:
	print('No')
Buggy python submission (verdict: Runtime Error):
N = map(int, input())
s = input()
for char in s:
  if char == 'R':
    cnt += 1
  if cnt > N / 2:
    print('Yes')
 	break
else:
  print('No')

Fixed submission:
N = int(input())
s = input()
cnt = 0
for char in s:
  if char == 'R':
    cnt += 1
  if cnt > N / 2:
    print('Yes')
    break
else:
  print('No')