Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p03274 (python)

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

zeroi = 0
while zeroi < N:
    if X[zeroi] >= 0:
        break
    zeroi += 1
if zeroi < N and X[zeroi] == 0:
    K -= 1
    N -= 1
    del X[zeroi]

xl = list(reversed(X[:zeroi]))
xr = list(X[zeroi:])

def solve():
    if K == 0:
        return 0
    minval = 2**60
    for i, x in enumerate(xl):
        r = K - (i+1)
        if r <= 0:
            d = -x
        elif r > len(xr):
            continue
        else:
            d = -x + 2 * xr[r-1]
        if minval > d:
            minval = d
    for i, x in enumerate(xr):
        l = K - (i+1)
        if l <= 0:
            d = x
        elif l > len(xl):
            continue
        else:
            d = x - 2 * xl[l-1]
        if minval > d:
            minval = d
    return minval

print(solve())

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
X = list(map(int, input().split()))

zeroi = 0
while zeroi < N:
    if X[zeroi] >= 0:
        break
    zeroi += 1
if X[zeroi] == 0:
    K -= 1
    del X[zeroi]


def solve():
    if not X:
        return 0
    minval = 2**60
    for i in range(max(zeroi-K, 0), min(zeroi+K+1, len(X))):
        if X[i] < 0:
            r = K + i
            if r >= len(X):
                continue
            d = -X[i]
            if r >= zeroi:
                d += 2 * X[r]
        else:
            r = i - K + 1
            if r < 0:
                continue
            d = X[i]
            if r < zeroi:
                d += -2 * X[r]
        minval = min(minval, d)
    return minval

print(solve())
Problem p03311 (python)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
B = sorted(A[i] - i - 1 for i in range(N))
def sad(b):
    return sum(abs(A[i] - i - 1 - b)for i in range(N))
print(min(sad(B[N//2]),sad(B[min(N//2+1,N-1)])))

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
B = sorted(A[i] - i - 1 for i in range(N))
def sad(b):
    return sum(abs(A[i] - i - 1 - b)for i in range(N))
print(min(sad(B[N//2]),sad(B[N//2+1])))
Problem p03420 (python)

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

ans = 0
for b in range(K + 1, N + 1):
    p = N // b
    q = p * (b - K) + max(N % b - K + 1, 0)
    ans += q if K > 0 else q-1

print(ans)

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split());print(sum(N//b*(b-K)+max(N%b+1-K,0)-(K<1)for b in range(N+1)))
Problem p03471 (python)

Fixed submission:
#!/usr/bin/env python3
import sys
import collections

sys.setrecursionlimit(10 ** 8)
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N, Y = map(int, readline().split())
assert Y % 1000 == 0
Y //= 1000


def solve2():
    for x1 in range(N + 1):
        for x2 in range(N - x1 + 1):
            x3 = N - x1 - x2
            if 10 * x1 + 5 * x2 + 1 * x3 == Y:
                print(x1, x2, x3)
                return
    print(-1, -1, -1)



if __name__ == "__main__":
    solve2()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
import sys
import collections

sys.setrecursionlimit(10 ** 8)
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N, Y = map(int, readline().split())
assert Y % 1000 == 0
Y //= 1000


def solve2():
    for x1 in range(N + 1):
        for x2 in range(N - x1 + 1):
            x3 = N - x1 - x2
            if 10 * x1 + 5 * x2 + 1 * x3 == Y:
                print(x1, x2, x3)
                return
    print(-1, -1, -1)


def solve():
    path = [[None] * (Y + 1) for _ in range(N + 1)]
    path[0][0] = -1
    for i in range(1, N + 1):
        for y in range(Y + 1):
            if path[i - 1][y] is None:
                continue
            for b in [1, 5, 10]:
                if y + b > Y:
                    continue
                path[i][y + b] = b

    if path[N][Y] is None:
        print(-1, -1, -1)
        return
    res = collections.Counter()
    m = Y
    for i in range(N, 0, -1):
        b = path[i][m]
        # print(f"path[{i}][{m}] ={b}", file=sys.stderr)
        if b is None:
            raise ValueError(f"path[{i}][{m}] is None")
        res[b] += 1
        m -= b
    print(res[10], res[5], res[1])


if __name__ == "__main__":
    solve2()
Problem p03488 (python)

Fixed submission:
"""Knapsack"""
import sys

sys.setrecursionlimit(10 ** 9)
input = sys.stdin.readline
s = input().rstrip()
gx, gy = map(int, input().split())
rx, ry = 0, 0
head, inst = 0, []
while head < len(s) and s[head] == "F":
    head += 1
    rx += 1

xlist, ylist = [], []
heading_x = True
while head < len(s):
    tcnt = 0
    while head < len(s) and s[head] == "T":
        tcnt += 1
        head += 1
    if head == len(s):
        break
    fcnt = 0
    while head < len(s) and s[head] == "F":
        fcnt += 1
        head += 1
    if ((tcnt % 2) == 1) ^ heading_x:
        heading_x = True
        xlist.append(fcnt)
    else:
        heading_x = False
        ylist.append(fcnt)


def fill(fs, goal_offset):
    f_total = sum(fs)
    if f_total < goal_offset:
        return False
    if f_total == goal_offset:
        return True
    f_diff = f_total - goal_offset
    if f_diff % 2 == 1:
        return False
    f_diff //= 2
    diffs = {0}
    for f in fs:
        for d in list(diffs):
            d2 = f + d
            if d2 > f_diff:
                continue
            if d2 == f_diff:
                return True
            diffs.add(d2)
    return False


if fill(xlist, abs(gx - rx)) and fill(ylist, abs(gy - ry)):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
"""Knapsack"""
import sys

sys.setrecursionlimit(10 ** 9)
input = sys.stdin.readline
s = input().rstrip()
gx, gy = map(int, input().split())
rx, ry = 0, 0
head, inst = 0, []
while head < len(s) and s[head] == "F":
    head += 1
    rx += 1

xlist, ylist = [], []
heading_x = True
while head < len(s):
    tcnt = 0
    while head < len(s) and s[head] == "T":
        tcnt += 1
        head += 1
    if head == len(s):
        break
    fcnt = 0
    while head < len(s) and s[head] == "F":
        fcnt += 1
        head += 1
    if ((tcnt % 2) == 1) ^ heading_x:
        heading_x = True
        xlist.append(fcnt)
    else:
        heading_x = False
        ylist.append(fcnt)


def fill(fs, goal_offset):
    f_total = sum(fs)
    if f_total < goal_offset:
        return False
    if f_total == goal_offset:
        return True
    f_diff = f_total - goal_offset
    diffs = {0}
    for f in fs:
        for d in list(diffs):
            d2 = f + d
            if d2 > f_diff:
                continue
            if d2 == f_diff:
                return True
            diffs.append(d2)
    return False


if fill(xlist, abs(gx - rx)) and fill(ylist, abs(gy - ry)):
    print("Yes")
else:
    print("No")
Problem p03559 (python)

Fixed submission:
import bisect
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort()
B.sort()
C.sort()

bc = [None]*(N+1)
bc[N] = 0
for i in range(N-1, -1, -1):
    bc[i] = bc[i+1] + N - bisect.bisect_right(C, B[i])
ans = 0
for i in range(N):
    ans += bc[bisect.bisect_right(B, A[i])]
print(ans)

Buggy submission (verdict: Runtime Error):
from bisect import*
r=lambda:sorted(map(int,input().split()))
N=r()[0]
A,B,C,w,s=r(),r(),r(),[0]*N,0
for i in range(N-1,-1,-1):s=w[i]=s+N-bisect(C,B[i])
print(sum(w[bisect(B,A[i])]for i in range(N)))
Problem p03651 (python)

Fixed submission:
from fractions import gcd

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

def gcd_all():
    x = A[0]
    for i in range(1, N):
        x = gcd(x, A[i])
    return x

def solve():
    if K > A[-1]:
        return False
    return K % gcd_all() == 0

print('POSSIBLE' if solve() else 'IMPOSSIBLE')

Buggy submission (verdict: Runtime Error):
from fractions import gcd
N,K = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
g = A[0]
for i in range(1, N):
    g = gcd(g, A[i])
print('POSSIBLE' if (K <= A[-1] and K % gcd_all() == 0) else 'IMPOSSIBLE')
Problem p03762 (python)

Fixed submission:
import sys

sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()

MOD = 10 ** 9 + 7
N, M = inm()
X = inl()
Y = inl()
assert len(X) == N
assert len(Y) == M


def solve():
    xsum = [0] * N
    xsum[N - 1] = (X[N - 1] - X[N - 2]) % MOD
    for k in range(2, N):
        xsum[N - k] = xsum[N - k + 1] + k * (X[N - k] - X[N - k - 1])
        xsum[N - k] %= MOD

    ysum = [0] * M
    ysum[M - 1] = (Y[M - 1] - Y[M - 2]) % MOD
    for k in range(2, M + 1):
        ysum[M - k] = ysum[M - k + 1] + k * (Y[M - k] - Y[M - k - 1])
        ysum[M - k] %= MOD

    return sum(xsum[1:]) % MOD * (sum(ysum[1:]) % MOD) % MOD


print(solve())

Buggy submission (verdict: Runtime Error):
import sys

sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
dbg = lambda *args, **kwargs: print(*args, **kwargs, file=sys.stderr)

MOD = 10 ** 9 + 7
N, M = inm()
X = inl()
Y = inl()
assert len(X) == N
assert len(Y) == M


def solve():
    xsum = [0] * N
    xsum[N - 1] = (X[N - 1] - X[N - 2]) % MOD
    for k in range(2, N):
        xsum[N - k] = xsum[N - k + 1] + k * (X[N - k] - X[N - k - 1])
        xsum[N - k] %= MOD

    # for i in range(N):
    #     dbg(f"> {i=} {xsum[i]=}")

    ysum = [0] * M
    ysum[M - 1] = (Y[M - 1] - Y[M - 2]) % MOD
    for k in range(2, M + 1):
        ysum[M - k] = ysum[M - k + 1] + k * (Y[M - k] - Y[M - k - 1])
        ysum[M - k] %= MOD

    # for j in range(M):
    #     dbg(f"> {j=} {ysum[j]=}")

    return sum(xsum[1:]) % MOD * (sum(ysum[1:]) % MOD) % MOD


print(solve())
Problem p03862 (python)

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

eat = 0
for i in range(1, N):
    cur = candies[i] + candies[i - 1]
    if cur <= x:
        continue
    eat_i = cur - x
    c = min(eat_i, candies[i])
    candies[i] -= c
    eat += eat_i
print(eat)

Buggy submission (verdict: Runtime Error):
n,x,*a=map(int,open(0).read().split());r=0
for i in range(1,N):e=max(a[i]+a[i-1]-x,0);a[i]-=min(e,a[i]);r+=e
print(r)
Problem p02853 (python)

Fixed submission:
X, Y = map(int,input().split())

def get_money(X):
    if X == 1:
        return 300000
    elif X == 2:
        return 200000
    elif X == 3:
        return 100000
    else:
        return 0

def double_money(X, Y):
    if X == 1 and Y == 1:
        return 400000
    else:
        return 0

sum = get_money(X) + get_money(Y) +double_money(X, Y)

print(sum)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))

def func(A):
    A_inf = 0
    A_sup = 0
    N_inf = 0
    N_sup = 0
    L = sum(A)

    for a in A:
        if A_inf + a <= L/2:
            A_inf += a
            A_sup += a
            N_inf += 1
            N_sup += 1

        if A_sup <= L/2 and A_sup + a > L/2:
            A_sup += a
            N_sup += 1

    if A_inf == A_sup:
        return 0
    x = sum(A) - 2*A_inf
    y = 2*A_sup - sum(A)
    result = min(x,y)

    if A_sup - y < N_sup:
        return x
    else:
        return result

print(func(A))
Problem p02865 (python)

Fixed submission:
N = int(input())
if N % 2 == 0:
    print(int(N/2 -1))
else:
    print(int((N+1)/2-1))

Buggy submission (verdict: Runtime Error):
from collections import defaultdict

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

if D[0] != 0:
    print(0)
else:
    count = defaultdict(int)
    for d in D:
        count[d] += 1
    if count[0] != 1:
        print(0)
    else:
        maxcount = max(count)
        S = 1
        for i in range(1, maxcount+1):
            S *= count[i-1]**count[i]
        M = int(S % 998244353)
        print(M)
Problem p02934 (python)

Fixed submission:
N = int(input())
A = list(map(int,input().rstrip().split(' ')))
sum = 0
for a in A:
    sum += 1/a
print(1/sum)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = input().rstrip().split(' ')
sum = 0
for a in A:
    sum += 1/a
print(1/sum)
Problem p02939 (python)

Fixed submission:
s = str(input().rstrip())
l=0
r=1
tmp =''
li = list()
while(r<=len(s)):
  if(s[l:r]!=tmp):
    li.append(s[l:r])
    tmp=s[l:r]
    l=r
    r+=1      
  else:
    r+=1

print(len(li))

Buggy submission (verdict: Runtime Error):
from collections import defaultdict
d = defaultdict(bool,False)
s = str(input().rstrip())
l=0
r=1
while(r<len(s)):
	if(d[s[l:r]]==False):
      d[s[l:r]]=True
      l=r
      r+=1      
    else:
      r+=1

ans=0
for key,val in d.items():
  if(val==True):ans+=1

print(ans)
Problem p02958 (python)

Fixed submission:
n = int(input())
A = list(map(int,input().split()))
B = sorted(A)
dif = 0
for i in range(n):
  if A[i]!=B[i]:
    dif+=1
if dif==0 or dif==2:
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
n = int(intput())
A = list(map(int,input().split()))
B = A.sorted()
dif = 0
for i in range(n):
  if A[i]!=B[i]:
    dif+=1
if dif==0 or dif==2:
  print("YES")
else:
  print("NO")
Problem p02994 (python)

Fixed submission:
N,L = map(int,input().split())
A = list()
for i in range(N):
  A.append(L+i)
A.sort()
S = sum(A)
if min(A)*max(A)<=0:
  print(S)
else:
  if L>=0:
    print(S-min(A))
  else:
    print(S-max(A))

Buggy submission (verdict: Runtime Error):
N,L = map(int,input())
A = list()
for i in range(N):
  A.append(L+i)
A.sort()
S = sum(A)
if min(A)*max(A)<=0:
  print(S)
else:
  if L>=0:
    print(S-min(A))
  else:
    print(S-max(A))
Problem p02999 (python)

Fixed submission:
x,a = map(int,input().split())
if x<a:
  print(0)
else:
  print(10)

Buggy submission (verdict: Runtime Error):
x,a = map(int,input())
if x<a:
  print(0)
else:
  print(10)
Problem p03005 (python)

Fixed submission:
n,k = map(int,input().split())
if k==1:
  print(0)
else:
  print(n-k)

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
if k==1:
  print(0)
else
  print(n-k)
Problem p03037 (python)

Fixed submission:
n,m=map(int,input().rstrip().split(' '))
maxL=0
minR=n+1
for i in range(m):
  l,r=map(int,input().rstrip().split(' '))
  maxL = max(maxL,l)
  minR = min(minR,r)
print(max(minR-maxL+1,0))

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().rstrip().split(' '))
maxL=0,minR=n+1
for i in range(m):
  l,r=map(int,input().rstrip().split(' '))
  maxL = max(maxL,l)
  minR = min(minR,r)
print(max(minR-maxL+1,0))
Problem p03059 (python)

Fixed submission:
a,b,t = map(int,input().split())
ans = 0
T = a
while(T<=t):
  ans += b
  T += a
print(ans)

Buggy submission (verdict: Runtime Error):
a,b,t = map(int,input().split())
ans = 0
T = A
while(T<=t):
  ans += B
  T += A
print(ans)
Problem p03071 (python)

Fixed submission:
a,b = map(int,input().split())
if a==b:
  print(2*b)
else:
  x = max(a,b)
  print(2*x-1)

Buggy submission (verdict: Runtime Error):
a,b = map(int,input())
if a==b:
  print(2*b)
else:
  x = max(a,b)
  print(2*x-1)
Problem p03079 (python)

Fixed submission:
A = list(map(int,input().split()))
A.sort()
if (A[0] == A[1]) and (A[1] == A[2]):
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
A = list(map(int,input().split()))
sort(A)
if A[0]+A[1] > A[2]:
  print('Yes')
else:
  print('No')
Problem p03103 (python)

Fixed submission:
# coding: utf-8
import os
from sys import stdin
from functools import total_ordering

# __dirname = os.path.dirname(__file__)
# __basename = os.path.splitext(os.path.basename(__file__))[0]
# __targetname = './input/' + __basename + '.txt'
# target_path = os.path.join(__dirname, __targetname)
# stdin = open(target_path)

@total_ordering
class struct(object):
    def __init__(self,a,b):
        self.a=a
        self.b=b
    def __lt__	(self,other):
        return self.a < other.a
    def __eq__	(self,other):
        return self.a == other.a

def main():
    # st = struct(10,1)
    # print(st.a)
    input_line = stdin.readline().rstrip().split(' ')
    N, M = map(int, input_line)
    A = list()
    for _ in range(N):
        input_line = stdin.readline().rstrip().split(' ')
        a,b=map(int, input_line)
        st=struct(a,b)
        A.append(st)
    A.sort()
    ans=0
    time=0
    for x in A:
        # print(x.a,x.b)
        if(time>M):
            continue
        if((time+x.b)<=M):
            ans += x.a*x.b
            time += x.b
        else:
            ans += x.a*(M-time)
            time = M
    print(ans)



if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
# coding: utf-8
import os
from sys import stdin
from functools import total_ordering

__dirname = os.path.dirname(__file__)
__basename = os.path.splitext(os.path.basename(__file__))[0]
__targetname = './input/' + __basename + '.txt'
target_path = os.path.join(__dirname, __targetname)
stdin = open(target_path)

@total_ordering
class struct(object):
    def __init__(self,a,b):
        self.a=a
        self.b=b
    def __lt__	(self,other):
        return self.a < other.a
    def __eq__	(self,other):
        return self.a == other.a

def main():
    # st = struct(10,1)
    # print(st.a)
    input_line = stdin.readline().rstrip().split(' ')
    N, M = map(int, input_line)
    A = list()
    for _ in range(N):
        input_line = stdin.readline().rstrip().split(' ')
        a,b=map(int, input_line)
        st=struct(a,b)
        A.append(st)
    A.sort()
    ans=0
    time=0
    for x in A:
        # print(x.a,x.b)
        if(time>M):
            continue
        if((time+x.b)<=M):
            ans += x.a*x.b
            time += x.b
        else:
            ans += x.a*(M-time)
            time = M
    print(ans)



if __name__ == "__main__":
    main()
Problem p03285 (python)

Fixed submission:
buy = [False]*1000
buy[0] = True
for i in range(100):
  if buy[i]:
    buy[i+4] = True
    buy[i+7] = True
    
n = int(input())
if buy[n]:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
buy = [false]*1000
buy[0] = true
for i in range(100):
  if buy[i]:
    buy[i+4] = true
    buy[i+7] = true
    
n = int(input())
if buy[n]:
  print("Yes")
else:
  print("No")
Problem p03294 (python)

Fixed submission:
import fractions
n = int(input())
A = list(map(int,input().rstrip().split(' ')))
def lcm(a,b):
  return int(a*b//fractions.gcd(a,b))
L=1
for x in A:
  L=lcm(L,x)
L-=1
ans=0
for x in A:
  ans+=L%x
print(ans)

Buggy submission (verdict: Runtime Error):
import math
n = int(input())
A = list(map(int,input().rstrip().split(' ')))
def lcm(a,b):
  return int(a*b//math.gcd(a,b))
L=1
for x in A:
  L=lcm(L,x)
L-=1
ans=0
for x in A:
  ans+=L%x
print(ans)

Buggy submission (verdict: Runtime Error):
import math
n = int(input())
a = list(map(int,input().rstrip().split(' ')))
def lcm(a,b):
  return int(a*b//math.gcd(a,b))
L=1
for x in a:
  L=lcm(L,x)
L-=1
ans=0
for x in a:
  ans+=L%a
print(ans)
Problem p03303 (python)

Fixed submission:
S = str(input())
w = int(input())
idx = 0
ans = ""
while idx < len(S):
  ans += S[idx]
  idx += w
print(ans)

Buggy submission (verdict: Runtime Error):
S = str(input())
w = int(input())
idx = 0
ans = ""
while idx <= len(S):
  ans += S[idx]
  idx += w
print(ans)

Buggy submission (verdict: Runtime Error):
S = str(input())
w = int(input())
idx = w
ans = ""
while idx <= len(S):
  ans += S[idx]
  idx += w
print(ans)
Problem p03352 (python)

Fixed submission:
import math
x = int(input())
if x==1:
  print(1)
  exit()

used = {}
for b in range(2,int(math.sqrt(x))+1):
  p=2
  while(b**p<=x):
    used[b**p]=True
    p+=1

ans=0
for key in used.keys():
  ans = max(ans,key)

print(ans)

Buggy submission (verdict: Runtime Error):
import math
x = int(input())
if x==1:
  print(1)
  exit()

used = dictionary()
for b in range(2,int(math.sqrt(x))+1):
  p=2
  while(b**p<=x):
    used[b**p]=True
    p+=1

ans=0
for key,itm in used:
  ans = max(ans,key)

print(ans)

Buggy submission (verdict: Runtime Error):
x = int(input())
if x==1:
  print(1)
  exit()

used = dictionary()
for b in range(2,sqrt(x)):
  p=2
  while(b**p<=x):
    used[b**p]=True
    p+=1
ans=0
for key,itm in used:
  ans = max(ans,key)

print(ans)
Problem p03359 (python)

Fixed submission:
a,b = map(int,input().split())
ans = a-1
if a<=b:
  ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
a,b = map(int,input())
ans = (a-1)
if a<=b:
  ans+=1
print(ans)
Problem p03420 (python)

Fixed submission:
N,K=map(int,input().split())
ans=0
for b in range(1,N+1):
  p = N//b
  r = N%b
  ans+=p*max(0,b-K)
  ans+=max(0,r-K+1)
if(K==0):
  ans-=N
print(ans)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
ans=0
for b in range(1,N+1):
  p = N//b
  r = N%b
  ans+=p*max(0,b-K)
  ans+=max(0,r-K+1)
print(ans)
Problem p03427 (python)

Fixed submission:
n = str(int(input().rstrip())+1)
ans = (len(n)-1)*9
ans += (int(n[0])-1)
print(ans)

Buggy submission (verdict: Runtime Error):
n = str(input().rstrip()+1)
ans = len(n)*9
ans += int(n[0])-1
print(ans)
Problem p03469 (python)

Fixed submission:
S = list(str(input()))
S[3] = '8'
print("".join(S))

Buggy submission (verdict: Runtime Error):
S = str(input())
S[3] = 8
print(S)
Problem p03485 (python)

Fixed submission:
a,b = map(int,input().split())
x = (a+b+1)//2
print(x)

Buggy submission (verdict: Runtime Error):
a,b = map(int,input())
x = (a+b)//2
print(x)
Problem p03544 (python)

Fixed submission:
n = int(input().rstrip())
L = [0]*(n+1)
L[0]=2
L[1]=1
for i in range(2,n+1):
	L[i]=L[i-1]+L[i-2]
print(L[n])

Buggy submission (verdict: Runtime Error):
n = int(input())
L = [0]*(n+1)
L[1]=2
L[2]=1
for i in range(3,n+1);
	L[i]=L[i-1]+L[i-2]
print(L[n])
Problem p03555 (python)

Fixed submission:
x = str(input())
y = str(input())
if x==y[::-1]:
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
x = str(input())
y = str(input())
z = x.reversed()
w = y.reversed()
if x==w and y==z:
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
x = str(input())
y = str(input())
z = x.sorted()
w = y.sorted()
if x==w and y==z:
  print("YES")
else:
  print("NO")
Problem p03556 (python)

Fixed submission:
import math
n = int(input())
x = int(math.sqrt(n))
print(x**2)

Buggy submission (verdict: Runtime Error):
n = int(input())
x = int(sqrt(n))
print(x**2)
Problem p03611 (python)

Fixed submission:
from collections import defaultdict
n = int(input())
a = list(map(int,input().rstrip().split()))
dic = defaultdict(int)
for x in a:
  dic[x-1]+=1
  dic[x]+=1
  dic[x+1]+=1
m=0
for v in dic.values():
  m = max(m,v)   
print(m)

Buggy submission (verdict: Runtime Error):
from collections import defaultdict
n = int(input())
a = list(map(int,input().rstrip().split()))
dic = defaultdict(int)
for x in a:
  dic[x-1]+=1
  dic[x]+=1
  dic[x+1]+=1

k=0
m=0
for key,item in dic.item():
  if(item>m):
    m=item
    k=key
    
print(k)
Problem p03612 (python)

Fixed submission:
n = int(input())
A = list(map(int,input().split()))
A.append(0)
T = []

ans = 0
for i in range(n+1):
  if A[i]==(i+1):
    T.append(1)
  else:
    T.append(0)    
for i in range(n+1):
  if T[i]:
    ans+=1
    T[i+1]=0

print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
A = list(map(int,input().split().rstrip()))
A.append(0)
ans = 0
for i in range(n):
  if A[i]==(i+1):
    ans += 1
    if A[i+1]==(i+2):
      ans -= 1
Problem p03644 (python)

Fixed submission:
n=int(input())
ans=1
while(2*ans<=n):
	ans*=2
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
ans=0
while(n%2==0):
  ans++
  n/=2
print(ans)
Problem p03699 (python)

Fixed submission:
n = int(input())
a=list()
sum=0
for i in range(n):
  x = int(input())
  sum+=x
  if(x%10!=0):
    a.append(x)

if(sum%10==0 and len(a)>0):
  sum-=min(a)

if(sum%10==0):
  print(0)
else:
  print(sum)

Buggy submission (verdict: Runtime Error):
n = int(input())
a=list()
sum=0
for i in range(n):
  x = int(input())
  sum+=x
  if(x%10!=0):
    a.append(x)

if(sum%10==0):
  sum-=min(a)

if(sum%10==0):
  print(0)
else:
  print(sum)