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

Fixed submission:
def main():
    n, *i = map(int, open(0).read().split())
    a = i[:n]
    _ = i[n]
    s = sum(a)

    m = [0] * (10 ** 5 + 1)
    for x in a:
        m[x] += 1

    ans = []
    for b, c in zip(*[iter(i[n + 1:])] * 2):
        m[c] += m[b]
        s += (c - b) * m[b]
        m[b] = 0
        ans.append(s)

    print(*ans, sep="\n")


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    from collections import Counter
    n, *i = map(int, open(0).read().split())
    a = i[:n]
    _ = i[n]
    d = Counter(a)
    s = sum(k * v for k, v in d.items())
    ans = []
    for b, c in zip(*[iter(i[n + 1:])] * 2):
        v, w = d.get(b), d.get(c)
        if v is not None:
            s += (c - b) * v
        ans.append(s)
        d[c] = v if w is None else v + w

    print(*ans, sep="\n")


if __name__ == '__main__':
    main()
Problem p02642 (python)

Fixed submission:
def main():
    n, *a = map(int, open(0).read().split())
    if n == 1:
        print(1)
        return

    m = max(a) + 1
    l = [0] * m
    for i in a:
        for j in range(i, m, i):
            l[j] += 2
        l[i] -= 1

    ans = l.count(1)
    print(ans)


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n, *a = map(int, open(0).read().split())
    if n == 1:
        print(1)
        return

    m = max(a) + 1
    l = [0] * m
    for i in a:
        for j in range(i, m, i):
            l[j] += 2
        l[i] -= 1

    ans = sum(a[i] == -1 for i in a)
    print(ans)


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    from collections import Counter
    n, *a = map(int, open(0).read().split())
    x = Counter(a)

    y = [k for k, v in x.items() if v == 1]
    if len(y) == 0:
        print(0)
        exit()

    z = sorted(y)

    if x.get(1) > 1:
        print(0)
        exit()
    if x.get(1) == 1:
        print(1)
        exit()

    l = z[-1]
    m = [0] * (l + 1)
    for i in z:
        if m[i] == 0:
            m[i] = 1
        j = l // i
        for k in range(2, j + 1):
            m[i * k] = -1

    ans = m.count(1)
    print(ans)


if __name__ == '__main__':
    main()
Problem p02684 (python)

Fixed submission:
def main():
    n, k, *a = map(int, open(0).read().split())
    a = [0] + a
    root = [1]
    visited = [False for _ in range(n+1)]
    nx = 1
    visited[1] = True

    step = 0
    while True:
        step += 1
        now = nx
        nx = a[now]
        if step == k:
            print(nx)
            break
        if visited[nx]:
            end = step
            start = root.index(nx)
            d = end - start
            r = k - step
            index = start + r % d
            print(root[index])
            break

        visited[nx] = True
        root.append(nx)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n, k, *a = map(int, open(0).read().split())
    a = [0] + a
    root = [1]
    now = 1
    count = 0
    roop_start = 0
    while count <= k:
        count += 1
        next = a[now]
        if next in root:
            roop_start = next
            break
        else:
            root.append(next)
            now = next
    else:
        print(now)

    root_end = now
    roop_end_index = count - 1
    roop_start_index = root.index(roop_start)

    left_count = k - count
    items = roop_end_index - roop_start_index + 1

    p, q = divmod(left_count, items)
    index = roop_start_index + q


    print(root[index])



if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n, k, *a = map(int, open(0).read().split())
    a = [0] + a
    root = [1]
    now = 1
    count = 0
    roop_start = 0
    while count <= k:
        count += 1
        next = a[now]
        if next in root:
            roop_start = next
            break
        else:
            root.append(next)
            now = next
    else:
        print(now)

    root_end = now
    roop_end_index = count - 1
    roop_start_index = root.index(roop_start)

    left_count = k - count
    items = roop_end_index - roop_start_index + 1

    p, q = divmod(left_count, items)
    index = roop_start_index + q


    print(root[index])



if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n, k, *a = map(int, open(0).read().split())
    a = [0] + a
    root = [1]
    start = a[1]
    root.append(start)
    now = start
    roop = 0
    while True:
        next = a[now]
        if next in root:
            roop = next
            break
        else:
            root.append(next)
            now = next

    if roop == 0:
        ans = root[k]
    else:
        roop_start = root.index(roop)
        step = roop_start + 1
        if k <= step:
            ans = ans[k]
        else:
            m = len(root) - roop_start
            p, q = divmod(k - step + 1, m)
            index = roop_start + q
            ans = root[index]
    print(ans)


if __name__ == '__main__':
    main()
Problem p02690 (python)

Fixed submission:
def main():
    x = int(input())
    for i in range(150, 0, -1):
        for j in range(i, -150, -1):
            cal = i ** 5 - j ** 5
            if cal == x:
                print(i, j)
                exit()


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    x = int(input())

    i = 0
    while True:
        j = i ** 5
        a1, a2 = x + j, x - j

        p = a1 ** (1 / 5)
        if int(p) == p:
            p = int(p)
            print(p, j)
            break
        if a2 >= 0:
            p = a2 ** (1 / 5)
            if int(p) == p:
                p = int(p)
                print(p, -1 * j)
                break
        else:
            p = abs(b2) ** (1 / 5) * -1
            if int(p) == p:
                p = int(p)
                print(p, -1 * j)
                break
        i += 1


if __name__ == '__main__':
    main()
Problem p02702 (python)

Fixed submission:
def main():
    from collections import Counter
    s = input()

    n = 2019
    l = [0]
    t = 1
    for i, x in enumerate(s[::-1]):
        t = t * 10 % n
        y = (l[-1] + int(x) * t) % n
        l.append(y)

    c = Counter(l)
    ans = sum([v * (v - 1) // 2 for v in c.values()])
    print(ans)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    s = input()
    m = int(s) // 2019 / 10 ** 5
    l = [0 for _ in range(len(s))]
    for i in range(1, len(s) + 1):
        x = int(s[-i:])
        l[-i] = x % 2019
    ans = 0
    for i in range(4, len(s) + 1, 1):
        for j in range(0, i - 3, 1):
            if j == 0:
                x = l[-i]
            else:
                x = l[-i] - l[-j]
            if x % 2019 == 0:
                ans += 1

    print(ans)


if __name__ == '__main__':
    main()
Problem p02714 (python)

Fixed submission:
def main():
    n, s = int(input()), input()
    r, g, b = s.count('R'), s.count('G'), s.count('B')
    ans = r * g * b
    v = {'R', 'G', 'B'}
    for i in range(n - 2):
        for j in range(n // 2 + 1):
            if i + j + j < n:
                if v == {s[i], s[i + j], s[i + j + j]}:
                    ans -= 1
    print(ans)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    from collections import Counter
    n, s = int(input()), input()
    c = Counter(s)
    d = list(c.values())

    ans = d[0] * d[1] * d[2]
    rgb = {"R", "G", "B"}
    for i in range(1, n // 2 + 1):
        for j in range(i):
            x = s[j::i]
            for a, b, c in zip(x, x[1:], x[2:]):
                g = {a, b, c}
                if g == rgb:
                    ans -= 1

    print(ans)


if __name__ == '__main__':
    main()
Problem p02721 (python)

Fixed submission:
def main():
    from itertools import groupby
    n, k, c = map(int, input().split())
    s = list(input())

    if c == 0:
        a = [i + 1 for i, c in enumerate(s) if c == 'o']
        if len(a) == k:
            print(*a, sep='\n')
        else:
            print()
        exit()

    check_f = []
    x = 0
    for i, j in enumerate(s, 1):
        if x:
            x -= 1
            continue
        if j == 'o':
            x = c
            check_f.append(i)
        if len(check_f) == k:
            break

    check_b = []
    x = 0
    for i, j in enumerate(s[::-1]):
        if x:
            x -= 1
            continue
        if j == 'o':
            x = c
            check_b.append(n - i)
        if len(check_b) == k:
            break

    ans = list(set(check_f) & set(check_b))
    ans.sort()
    ans = '\n'.join(map(str, ans))
    print(ans)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    from itertools import groupby
    n, k, c = map(int, input().split())
    s = list(input())

    if c == 0:
        if s.count('o') == k:
            ans = '\n'.join(map(str,range(1,n+1)))
            print(ans)
            return
        else:
            return

       check_f = []
    x = 0
    for i, j in enumerate(s, 1):
        if x:
            x -= 1
            continue
        if j == 'o':
            x = c
            check_f.append(i)
        if len(check_f) == k:
            break

    check_b = []
    x = 0
    for i, j in enumerate(s[::-1]):
        if x:
            x -= 1
            continue
        if j == 'o':
            x = c
            check_b.append(n - i)
        if len(check_b) == k:
            break

    ans = list(set(check_f) & set(check_b))
    ans.sort()
    ans = '\n'.join(map(str,ans))
    print(ans)

if __name__ == '__main__':
    main()
Problem p02743 (python)

Fixed submission:
def main():
    from decimal import Decimal

    a,b,c = map(int, input().split())
    a,b,c = Decimal(a) ,Decimal(b), Decimal(c)
    f = a.sqrt() + b.sqrt() < c.sqrt()
    print("Yes" if f else "No")

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    from decimal import Decimal

    a,b,c = map(int, input().split())
    a,b,c = Decimal(a) ,Decimal(b), Decimal(c)
    f = a**.5 + b**.5 < c**.5
    print("Yes" if f else "No")

if __name__ == '__main__':
    main()
Problem p02789 (python)

Fixed submission:
a,b = map(int,input().split())

if a == b:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
def main():
    お寿司, 食べたい = map(int, input().split())
    築地 = [[] for _ in range(お寿司)]
    for _ in range(食べたい):
        鮪, 蛸 = map(lambda x: int(x) - 1, input().split())
        築地[鮪].append(蛸)
        築地[蛸].append(鮪)

    やってるかい = [False] * お寿司
    寿司くいねぇ = おなかすいた(0, 築地, やってるかい, 0)

    print(寿司くいねぇ)


def おなかすいた(市場, 築地, やってるかい, お勘定):
    やってるかい[市場] = True
    if all(やってるかい):
        return お勘定 + 1

    for 豪遊 in 築地[市場]:
        if やってるかい[豪遊]:
            continue
        お勘定 = おなかすいた(豪遊, 築地, やってるかい, お勘定)
        やってるかい[豪遊] = False

    return お勘定


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):

def main():


    from collections import deque


    h ,w = map(int, input().split())
    a = [ list(input())  for _ in range(h)]

    q = deque()

    if a[0][0]=='.':
        q.appendleft((0,0,0))
    else:
        q.appendleft((0,0,1))

    while(True):
        f = q.popleft()
        x, y, c = f[0], f[1], f[2]
        if (x,y) == (w-1,h-1):
            print(c)
            break

        for u, v in [(1,0), (0,1)]:
            if x + u <= w - 1 and y + v<= h - 1:
                n = a[x+u][y+v]=='.'
                if n:
                    q.appendleft((x + u, y + v, c + 0))
                else:
                    q.append((x + u, y + v, c + 1))



if __name__=='__main__':
    main()
Problem p02795 (python)

Fixed submission:
h = int(input())
w = int(input())
n = int(input())

m = max(h,w)
a = n // m
b = n % m
if b == 0:
  print(a)
else:
  print(a+1)

Buggy submission (verdict: Runtime Error):
n = int(input())
l = []
for _ in range(n):
  x,y = map(int, input().split())
  l.append([x+y,x-y])
l.sort()

temp = l[0][1]
count = n
i = 1
for i in range(1,n):
  if temp <= l[i][1]:
    pass
  else:
    temp = min(temp,l[i][1])
    count -= 1
print(count)

Buggy submission (verdict: Runtime Error):
n = int(input())
l = []
for _ in range(n):
  A = list(map(int, input().split()))
  l.append(A)
  
l = sorted(l)
count = 0
count1 = 0
count2 = 0
for i in range(n-2):
  j = i + 1
  a = l[j][0]-l[j][1]
  b = l[j][0]+l[j][1]
  
  if l[j-1][0]+l[j-1][1] <= a and b <= l[j+1][0]-l[j+1][1]:
    count = count + 1
  if l[j-1][0]+l[j-1][1] >= a and b >= l[j+1][0]-l[j+1][1]:
    count1 = count1 + 1
  else:
    count2 = count2 + 1 

sum = count + count2/2
print(count+count1-1)

Buggy submission (verdict: Runtime Error):
n = int(input())
l = []
for _ in range(n):
  A = list(map(int, input().split()))
  l.append(A)
  
l = sorted(l)

x0,l0 = l[0][0],l[0][1]
y = x0 + l0
count = 1
for i in range(n-1):
  x,d = l[i+1][0],l[i+1][1]
  z = x - d
  
  if z > y:
    y = x + d
    count = count + 1
  else:
    continue
print(count)
Problem p02802 (python)

Fixed submission:
n,m=map(int,input().split())
l=[0]*(n+1)
p=0
for _ in range(m):
  a,b=list(input().split())
  if str(b)=="AC" and l[int(a)]!=-1:
    p+=l[int(a)]
    l[int(a)]=-1
  elif str(b)=="WA" and l[int(a)]!=-1:
    l[int(a)]+=1
print(l.count(-1),p)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
l=[[0][0] for _ in range(n+1)]
p=0
for _ in range(m):
  a,b=list(input().split())
  if str(b)=="AC" and l[int(a)][0]==0:
    l[int(a)][0]=1
    p+=l[int(a)][1]
  elif str(b)=="WA" and l[int(a)]==0:
    l[int(a)][1]+=1
print(l.count(1),p)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
l = [input().split() for _ in range(m)]

o = [l[i][0] for i in range(m)]
p = list(set(o))

t = 0
f = 0

for i in p:
  q = [l[j][1] for j in range(m) if l[j][0] == i ]
  tf = q.count("AC")
  if tf != 0:
    t = t + 1
  d = q.index("AC")
  f = f + d
print(t,f)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
l = [input().split() for _ in range(m)]

t = 0
f = 0
for i in range(n):
  q = [l[j][1] for j in range(m) if l[j][0] == str(i+1)]
  if q.count("AC") != 0:
    t = t + 1
  a = q.index("AC")
  f = f + q[0:a].count("WA")
print(t,f)
Problem p02806 (python)

Fixed submission:
from sys import stdin
n = int(stdin.readline().rstrip())
a = [stdin.readline().rstrip().split() for _ in range(n)]
x = [stdin.readline().rstrip() for _ in range(n)][0]

k = 0
for i in range(len(a)):
  name = a[i][0]
  time = a[i][1]
  if name == x:
    k = i
  else:
    pass
s = 0 
for i in range(len(a)):
  if i <= k:
    pass
  else:
    s = s + int(a[i][1])
print(s)

Buggy submission (verdict: Runtime Error):
import numpy as np
n = int(stdin.readline().rstrip())
a = np.array([stdin.readline().rstrip().split() for _ in range(n)])
x = [stdin.readline().rstrip() for _ in range(n)][0]

i = np.where(a[:,0] == x)[0][0]
b = a[i+1:,1]
b = [int(i) for i in b]
print(sum(b))
Problem p02812 (python)

Fixed submission:
n=int(input())
s=str(input())
print(s.count("ABC"))

Buggy submission (verdict: Runtime Error):
n=int(input())
s=str(input())
for _ in range(n-1):
  s = s + str(input())
n=s.count("ABC")
print(n)
Problem p02814 (python)

Fixed submission:
def main():
    from fractions import gcd
    from math import ceil

    n, m, *a = map(int, open(0).read().split())
    b = [0 for _ in range(n)]
    a.sort()

    for i, j in enumerate(a):
        c = 0
        while j % 2 == 0:
            c += 1
            j = j // 2
        a[i] = j
        b[i] = c

    if len(set(b)) > 1:
        print(0)
        exit()

    lcm = 1
    for i in a:
        lcm = (lcm * i) // gcd(lcm, i)

    k = b[0] - 1
    ans = ceil(m // 2 ** k // lcm / 2)
    print(ans)


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    from math import gcd, ceil

    n, m, *a = map(int, open(0).read().split())
    b = [0 for _ in range(n)]
    a.sort()

    for i, j in enumerate(a):
        c = 0
        while j % 2 == 0:
            c += 1
            j = j // 2
        a[i] = j
        b[i] = c

    if len(set(b)) > 1:
        print(0)
        exit()

    lcm = 1
    for i in a:
        lcm = (lcm * i) // gcd(lcm, i)

    k = b[0] - 1
    ans = ceil(m // 2 ** k // lcm / 2)
    print(ans)


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

Fixed submission:
a,b = map(str,input().split())
print(b+a)

Buggy submission (verdict: Runtime Error):
a, b = map(input())
print(a+b)
Problem p02818 (python)

Fixed submission:
a,b,k = map(int,input().split())
if a+b-k <= 0:
  print(0,0)
elif a-k <= 0:
  print(0,b+a-k)
else:
  print(a-k,b)

Buggy submission (verdict: Runtime Error):
a,b,k = map(int,input().split())
if a+b-k =< 0;
	print(0)
else ;
	print(a+b-k)

Buggy submission (verdict: Runtime Error):
a,b,k = map(int,input().split())
if a-k >= 0;
	print(a)
elif  a+b-k=< 0;
	print(0)
else;
	print(0)

Buggy submission (verdict: Runtime Error):
a,b,k = map(int,input().split())
if a-k >= 0;
  print(a)
elif  a+b-k=< 0;
	print(0)
else;
	print(0)
Problem p02841 (python)

Fixed submission:
a,b=map(int,input().split())
c,d=map(int,input().split())
print("0" if a==c else "1")

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split()),map(int,input().split())
print("0" if a==c else "1")
Problem p02843 (python)

Fixed submission:
x=int(input())
if x<100:
  print(0)
  exit()
elif 100<=x<=105:
  print(1)
  exit()
else:
  DP=[False]*(x+1)
  for i in range(x+1):
    coin=list(range(100,106,1))
    if i in coin:
      DP[i]=True
      continue
    DP[i]=True if any(DP[i-m] for m in coin) else False
  print(1 if DP[x]==True else 0)

Buggy submission (verdict: Runtime Error):
x=int(input())
if x<100:
  print(0)
  exit()
DP=[False]*(x+1)
for i in range(x+1):
  coin=list(range(100,106,1))
  if i in coin:
    DP[i]=True
    continue
  DP[i]=True if any(DP[i-m] for m in coin) else False
print(1 if DP[x]==True else 0)

Buggy submission (verdict: Runtime Error):
x=int(input())
DP=[False]*(x+1)
for i in range(x+1):
  coin=list(range(100,106,1))
  if i in coin:
    DP[i]=True
    continue
  DP[i]=True if any(DP[i-m] for m in coin) else False
print(1 if DP[x]==True else 0)
Problem p02854 (python)

Fixed submission:
def main():
    import sys
    from itertools import accumulate

    n = int(input())
    a = list(map(int, sys.stdin.readline().split()))

    b = list(accumulate(a))
    diff = b[-1]
    total = b[-1]
    for x in b:
        diff = min(diff, abs(total - 2 * x))
    print(diff)

if __name__ == '__main__':
     main()

Buggy submission (verdict: Runtime Error):
def main():
    import sys
    import bisect


    n = int(input())
    a = list(map(int, sys.stdin.readline().split()))

    b = list(accumulate(a))
    l = b[-1]
    i = bisect.bisect(b, l // 2)
    ans = min(abs(l - 2 * b[i - 1]), abs(l - 2 * b[i]))
    print(ans)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    import sys
    import bisect
    from itertools import accumulate

    n = int(input())
    a = list(map(int, sys.stdin.readline().split()))

    b = list(accumulate(a))
    l = b[-1]
    i = bisect.bisect_left(b, l // 2)
    ans = min(abs(l - 2 * b[i]), abs(l - 2 * b[i + 1]))
    print(ans)


if __name__ == '__main__':
    main()
Problem p02866 (python)

Fixed submission:
def main():
  import sys
  n,*d=map(int,sys.stdin.buffer.read().split())
  e=[0]*n
  
  for i in d:
    e[i]+=1
  
  a=e[0]
  
  for i in d[1:]:
    a=a*e[i-1]%998244353
    
  print(a)
  
if __name__=="__main__":
  main()

Buggy submission (verdict: Runtime Error):
def main():
  import sys
  n,*d=map(int,sys.stdin.buffer.read().split())
  e=[0]*n
  
  for i in d
  e[i]+=1
  
  a=e[0]
  
  for i in d[1:]:
    a=a*e[i-1]%998244353
    
  print(a)

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

Fixed submission:
def p(n):
    i = 2
    t = []
    while i * i <= n:
        while n % i == 0:
            n //= i
            t.append(i)
        i += 1
    if n > 1:
        t.append(n)
    return t


def main():
    from fractions import gcd
    a, b = map(int, input().split())
    g = gcd(a, b)
    print(len(set(p(g))) + 1)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def p(n):
    i = 2
    t = []
    while i * i <= n:
        while n % i == 0:
            n //= i
            t.append(i)
        i += 1
    if n > 1:
        t.append(n)
    return t


def main():
    from math import gcd
    a, b = map(int, input().split())
    g = gcd(a, b)
    print(len(set(p(g))) + 1)


if __name__ == '__main__':
    main()
Problem p02921 (python)

Fixed submission:
s,t=list(input()),list(input())
print(sum(x==y for x,y in zip(s,t)))

Buggy submission (verdict: Runtime Error):
s,t=list(input()),list(input())
print(sum(s==t))
Problem p02928 (python)

Fixed submission:
def main():
  
  n,k=map(int,input().split())
  a=list(map(int,input().split()))
  
  count=lambda arr,now:sum(element<now for element in arr)
  b=[[count(a[:i],a[i]),count(a[i+1:],a[i])] for i in range(n)]

  ans=0
  prime=10**9+7
  
  for x in b:
    left=x[0]
    right=x[1]
    res=(k-1)*k//2*(right+left)+right*k
    ans+=res%prime
    
  print(ans%prime)

if __name__=="__main__":
  main()

Buggy submission (verdict: Runtime Error):
def main():
  
  n,k=map(int,input().split())
  a=list(map(int,input().split()))
  
  count=lambda arr,now:sum(element<now for element in arr)
  b=[[count(a[:i],a[i]),count(a[i+1:],a[i])] for i in range(n)]

  ans=0
  prime=10**9+7
  
  for x in b:
    left=x[0]
    right=x[1]
    res=(k-1)*k//2*(right+left)+right*k
    ans+=res%prime
    
  print(ans%prime)

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

Fixed submission:
n=int(input())
l = list(map(int,input().split()))
b = sum([1/x for x in l])
print(1/b)

Buggy submission (verdict: Runtime Error):
n=int(input())
b=0
for _ in range(n):
  b+=1/int(input())
print(1/b)
Problem p02952 (python)

Fixed submission:
n=str(input())
l=len(n)
ans=0
while(l>0):
  if l%2==1 and l==len(n):
    ans+=int(n)-10**(l-1)+1
  elif l%2==1:
    ans+=9*10**(l-1)
  l-=1
print(ans)

Buggy submission (verdict: Runtime Error):
n=str(input())
l=len(n)
ans=0
while(l>0):
  if l%2==1 and l==len(n):
    ans+=n-10**(l-1)+1
  elif l%2==1:
    ans+=9*10**(l-1)
  l-=1
print(ans)
Problem p02957 (python)

Fixed submission:
a,b=map(int,input().split())
print((a+b)//2 if (a+b)%2==0 else "IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
print((a+b)//2 if (a+b)%2=0 else "IMPOSSIBLE")
Problem p02958 (python)

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

Buggy submission (verdict: Runtime Error):
n=int(input())
l=list(map(int,input().split()))
m=sum([i!=l[i] for i in range(1,n+1)])
print("YES" if m==0 or m==2 else "NO")
Problem p02972 (python)

Fixed submission:
def solve():
    N, *a_l = map(int, open(0).read().split())
    a_l = [0] + a_l

    for i in range(N//2, 0, -1):
        a_l[i] = sum(a_l[i::i]) % 2

    b_l = [i for i, x in enumerate(a_l) if x]

    print(len(b_l))
    if len(b_l) != 0:
        print(' '.join(map(str, b_l)))


if __name__ == '__main__':
    solve()

Buggy submission (verdict: Runtime Error):
def main():
    n, *a = map(int, open(0).read().split())
    m = [0] * (n + 1)
    res = []
    for i in range(n, 0, -1):
        x = a[i - 1] % 2
        y = m[i] % 2
        if x != y:
            res.append(i)
            c = i // 2
            j = 1
            while j < c:
                if i % j == 0:
                    res[j] += 1
                j += 1

    m = len(res)
    print(m)
    if m == 1:
        print(res[0])
    elif m > 1:
        l = ' '.join(map(str, res))
        print(l[::-1])


if __name__ == '__main__':
    main()