Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
def actual(r):
    return 2 * r * math.pi

r = int(input())
print(actual(r))

Fixed submission:
import math


def actual(r):
    return 2 * r * math.pi

r = int(input())
print(actual(r))
Buggy python submission (verdict: Runtime Error):
def actual(n, m, a_list):
    a_sum = sum(a_list)

    if n >= a_sum:
        return n - a_sum

    return -1

N, M = map(int, input().split())
a_list = map(int, input().split())

print(actual(n, m, a_list))

Fixed submission:
def actual(n, m, a_list):
    a_sum = sum(a_list)

    if n >= a_sum:
        return n - a_sum

    return -1

n, m = map(int, input().split())
a_list = map(int, input().split())

print(actual(n, m, a_list))
Buggy python submission (verdict: Time Limit Exceeded):
def actual(K, S):
    my_range = lambda n: range(n + 1)

    count = 0

    for x in my_range(K):
        for y in my_range(K):
            for z in my_range(K):
                if x + y + z == S:
                    count += 1

    return count
  
K, S = map(int, input().split())

print(actual(K, S))

Fixed submission:
def actual(K, S):
    my_range = lambda n: range(n + 1)

    count = 0

    for x in my_range(K):
        for y in my_range(K):
            z = S - (x + y)
            if 0 <= z <= K:
                count += 1
    return count

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

print(actual(K, S))
Buggy python submission (verdict: Runtime Error):
b = raw_input()
if b=="A":
	print("T")
elif b=="T":
	print("A")
elif b=="G":
	print("C")
elif b=="C":
	print("G")

Fixed submission:
b = raw_input()
if b=="A":
	print("T")
elif b=="T":
	print("A")
elif b=="G":
	print("C")
elif b=="C":
	print("G")

Buggy python submission (verdict: Runtime Error):
if b=="A":
	print("T")
elif b=="T":
	print("A")
elif b=="G":
	print("C")
elif b=="C":
	print("G")



Fixed submission:
b = raw_input()
if b=="A":
	print("T")
elif b=="T":
	print("A")
elif b=="G":
	print("C")
elif b=="C":
	print("G")

Buggy python submission (verdict: Runtime Error):
b = raw_input()
if b=="A":
	print("T")
elif b=="T":
	print("A")
elif b=="G":
	print("C")
elif b=="C":
	print("G")



Fixed submission:
b = raw_input()
if b=="A":
	print("T")
elif b=="T":
	print("A")
elif b=="G":
	print("C")
elif b=="C":
	print("G")

Buggy python submission (verdict: Runtime Error):
b = input()
if b=="A":
  print("T")
else if b=="T":
  print("A")
else if b=="G":
  print("C")
else if b=="c":
  print("G")


Fixed submission:
b = raw_input()
if b=="A":
	print("T")
elif b=="T":
	print("A")
elif b=="G":
	print("C")
elif b=="C":
	print("G")
Buggy python submission (verdict: Time Limit Exceeded):
# import sys
# input = sys.stdin.readline
# import re
import itertools

def main():
    n, k = input_list()
    p = input_list()

    pp = []
    for v in itertools.combinations(p, k):
        pp.append(sum(v))
    print(min(pp))

def count_tento(l, cur):
    count = 0
    for v in l:
        if v > cur:
            count += 1
    return count

def input_list():
    return list(map(int, input().split()))

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

if __name__ == '__main__':
    main()


Fixed submission:
# import sys
# input = sys.stdin.readline
# import re
import itertools

def main():
    n, k = input_list()
    p = input_list()

    p.sort()
    print(sum(p[:k]))

def count_tento(l, cur):
    count = 0
    for v in l:
        if v > cur:
            count += 1
    return count

def input_list():
    return list(map(int, input().split()))

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
# import sys
# input = sys.stdin.readline
import itertools
import collections
from decimal import Decimal
from functools import reduce


# 持っているビスケットを叩き、1枚増やす
# ビスケット A枚を 1円に交換する
# 1円をビスケット B枚に交換する
def main():
    n = int(input())
    numbers = input_list()
    ans = []
    for i in range(n):
        t = numbers[:]
        t.pop(i)
        ans.append(reduce(lambda a, b: a ^ b, t))
    print(*ans)

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a


def bfs(H, W, black_cells, dist):
    d = 0
    while black_cells:
        h, w = black_cells.popleft()
        d = dist[h][w]
        for dy, dx in ((1, 0), (0, 1), (-1, 0), (0, -1)):
            new_h = h + dy
            new_w = w + dx
            if new_h < 0 or H <= new_h or new_w < 0 or W <= new_w:
                continue
            if dist[new_h][new_w] == -1:
                dist[new_h][new_w] = d + 1
                black_cells.append((new_h, new_w))
    return d


def input_list():
    return list(map(int, input().split()))


def input_list_str():
    return list(map(str, input().split()))


if __name__ == "__main__":
    main()


Fixed submission:
# import sys
# input = sys.stdin.readline
import itertools
import collections
from decimal import Decimal
from functools import reduce


# 持っているビスケットを叩き、1枚増やす
# ビスケット A枚を 1円に交換する
# 1円をビスケット B枚に交換する
def main():
    n = int(input())
    numbers = input_list()
    ans = []
    s = reduce(lambda a, b: a ^ b, numbers)
    for i in range(n):
        ans.append(s ^ numbers[i])
    print(*ans)


def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a


def bfs(H, W, black_cells, dist):
    d = 0
    while black_cells:
        h, w = black_cells.popleft()
        d = dist[h][w]
        for dy, dx in ((1, 0), (0, 1), (-1, 0), (0, -1)):
            new_h = h + dy
            new_w = w + dx
            if new_h < 0 or H <= new_h or new_w < 0 or W <= new_w:
                continue
            if dist[new_h][new_w] == -1:
                dist[new_h][new_w] = d + 1
                black_cells.append((new_h, new_w))
    return d


def input_list():
    return list(map(int, input().split()))


def input_list_str():
    return list(map(str, input().split()))


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
def count_section_by_zero(data):
  count = 0
  flg = False
  start = 0
  for i, d in enumerate(data):
    if flg is False and d != 0:
      count += 1
      flg = True
      
    if d == 0:
      flg = False
  return count

def input_list():
  return list(map(int, input().split()))

def input_list_str():
  return list(map(str, input().split()))

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

def gcd(*numbers):
    return reduce(fractions.gcd, numbers)

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

# 2で割り切れる回数
def divide_two(arg):
  c = 0
  while True:
    if c >= 2:
      break
    if arg % 2 != 0:
      break
    arg //= 2
    c += 1
  return c

# 素因数分解
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

def main():
  n = int(input())
  l = 0
  for a in range(1, n+1):
     for b in range(1, n+1):
        for c in range(1, n+1):
          l += gcd_list([a,b,c])
  print(l)
import math
import fractions
import collections
import itertools
from functools import reduce
main()


Fixed submission:
def simple_gcd(x, y):
  if y == 0:
    return x;
  else:
    return simple_gcd(y, x % y)

def main():
  n = int(input())
  l = 0
  for a in range(1, n+1):
     for b in range(1, n+1):
        d = simple_gcd(a,b)
        for c in range(1, n+1):
          l += simple_gcd(d,c)
  print(l)
main()
Buggy python submission (verdict: Runtime Error):
def main():
  a = []
  n = int(input())
  for x in range(1, n+1):
    for y in range(1, n+1):
      z = n - (x+y)
      if z <= 0:
        continue
      a.append(x*y*z)
  print(max(a))
          
  
def count_section_by_zero(data):
  count = 0
  flg = False
  start = 0
  for i, d in enumerate(data):
    if flg is False and d != 0:
      count += 1
      flg = True
      
    if d == 0:
      flg = False
  return count

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def input_list():
  return list(map(int, input().split()))

def input_list_str():
  return map(str, input().split())

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

def gcd(*numbers):
    return reduce(fractions.gcd, numbers)

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

# 2で割り切れる回数
def divide_two(arg):
  c = 0
  while True:
    if c >= 2:
      break
    if arg % 2 != 0:
      break
    arg //= 2
    c += 1
  return c

# 素因数分解
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

import math
import fractions
import collections
from functools import reduce
main()

Fixed submission:
def main():
  a = []
  n = int(input())
  print((n/3)**3)

  
def count_section_by_zero(data):
  count = 0
  flg = False
  start = 0
  for i, d in enumerate(data):
    if flg is False and d != 0:
      count += 1
      flg = True
      
    if d == 0:
      flg = False
  return count

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def input_list():
  return list(map(int, input().split()))

def input_list_str():
  return map(str, input().split())

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

def gcd(*numbers):
    return reduce(fractions.gcd, numbers)

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

# 2で割り切れる回数
def divide_two(arg):
  c = 0
  while True:
    if c >= 2:
      break
    if arg % 2 != 0:
      break
    arg //= 2
    c += 1
  return c

# 素因数分解
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

import math
import fractions
import collections
from functools import reduce
main()
Buggy python submission (verdict: Runtime Error):
n = int(input())
x = list(map(int, input().split()))

max_x = max(x)
min_x = min(x)

ans = []
for i in range(min_x, max_x):
  a = 0
  for xi in x:
    a += (xi - (i+1))*(xi - (i+1))
  ans.append(a)
  
print(min(ans))

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

max_x = max(x)
min_x = min(x)

ans = []
for i in range(1, 101):
  a = 0
  for xi in x:
    a += (xi - i)*(xi - i)
  ans.append(a)
  
print(min(ans))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
P = list(map(int, input().split()))

ans = 1
for i in range(2, N+1):
  if min(P[:i-1]) < P[i-1]:
    pass
  else:
    ans += 1
print(ans)


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

MIN = P[0]
ans = 1
for i in range(2, N+1):
  if MIN < P[i-1]:
    pass
  else:
    ans += 1
    
  if MIN > P[i-1]:
    MIN = P[i-1]
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
def solve():
    ans = 1
    N = int(input())
    s = input()
    ans = 0
    for i in range(1000):
        t = str(i).zfill(3)
        t_index = 0 
        for s_index in range(N):
            if s[s_index] == t[t_index]:
                t_index += 1
                if t_index == 3:
                    break
        if t_index == 3:
            ans += 1
    print(ans)
solve()

Fixed submission:
n = int(input())
a = input()

r = 0
for i in range(10):
  s = a.find(str(i))
  if s == -1:
    continue
  for j in range(10):
    s2 = a.find(str(j), s + 1)
    if s2 == -1:
      continue
    for k in range(10):
      if a.find(str(k), s2 + 1) != -1:
        r += 1
print(r)

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(input())

r = 0
for i in range(1000):
  t = str(i).zfill(3)
  ti = 0
  if t[ti] > a[0]:
    a = a[1:]
  for si in range(len(a)):
    if a[si] == t[ti]:
      ti += 1
      if ti == 3:
        break
  if ti == 3:
    r += 1

print(r)
  

Fixed submission:
n = int(input())
a = input()

r = 0
for i in range(10):
  s = a.find(str(i))
  if s == -1:
    continue
  for j in range(10):
    s2 = a.find(str(j), s + 1)
    if s2 == -1:
      continue
    for k in range(10):
      if a.find(str(k), s2 + 1) != -1:
        r += 1
print(r)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(input())

r = 0
for i in range(1000):
  t = str(i).zfill(3)
  ti = 0
  for si in range(n):
    if a[si] == t[ti]:
      ti += 1
      if ti == 3:
        break
  if ti == 3:
    r += 1
print(r)
  

Fixed submission:
n = int(input())
a = input()

r = 0
for i in range(10):
  s = a.find(str(i))
  if s == -1:
    continue
  for j in range(10):
    s2 = a.find(str(j), s + 1)
    if s2 == -1:
      continue
    for k in range(10):
      if a.find(str(k), s2 + 1) != -1:
        r += 1
print(r)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, list(input())))

b = ''
for ai in range(len(a)):
  b += '1'

bi = int(b, 2)
del_num = n - 3

kinds = []
for i in range(bi):
  bin_list = list(format(i, '0'+str(len(a))+'b'))
  if bin_list.count('0') != del_num:
    continue
  k = ''
  for index, s in enumerate(bin_list):
    if s == '1':
      k += str(a[index])
  kinds.append(k)

print(len(set(kinds)))
  

Fixed submission:
n = int(input())
a = input()

r = 0
for i in range(10):
  s = a.find(str(i))
  if s == -1:
    continue
  for j in range(10):
    s2 = a.find(str(j), s + 1)
    if s2 == -1:
      continue
    for k in range(10):
      if a.find(str(k), s2 + 1) != -1:
        r += 1
print(r)
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
s = input()

happy_count = 0
pre = ''
for index, si in enumerate(list(s)):
  if index == 0:
    continue
  if list(s)[index - 1] == si:
    happy_count += 1

print(min(happy_count + (2 * k), n-1))


Fixed submission:
n, k = map(int, input().split())
s = input()

happy_count = 0
pre = ''
for index in range(n - 1):
  if s[index + 1] == s[index]:
    happy_count += 1

print(min(happy_count + (2 * k), n-1))
Buggy python submission (verdict: Runtime Error):
n, q = map(int, input().split())

tree_index = [[] for _ in range(n)]
for i in range(n-1):
  a, b = map(int, input().split())
  a -= 1
  b -= 1
  tree_index[a].append(b)
  tree_index[b].append(a)

ans = [0] * n
for i in range(q):
  p, x = map(int, input().split())
  ans[p-1] += x

def dfs(cur, par):
  for child in tree_index[cur]:
    if child == par:
      continue
    ans[child] += ans[cur]
    dfs(child, cur)
dfs(0, -1)
print(*ans)

Fixed submission:
import collections

n,q=map(int,input().split())
cnt=[0]*(n+1)
g=[[] for _ in range(n+1)]
for _ in range(n-1): #木グラフの隣接リストを作成
  a,b=map(int,input().split())
  g[a].append(b)
  g[b].append(a)
for _ in range(q): #各頂点についてcount[v]を計算
  v,val=map(int,input().split())
  cnt[v]+=val
q=collections.deque()
q.append(1) #DFSのスタックによる実装、まずスタックに始点1を積む
checked=[0]*(n+1) #各頂点を見たかどうかのフラグを持っておく
while q:
  v=q.pop()
  checked[v]=1 #頂点を見たかどうかのフラグを更新す
  for u in g[v]:
    if checked[u]==1: #vの子ノードuについて、まだ見ていない頂点であればcount[u]をcount[u]+=count[v]として更新する
      continue
    cnt[u]+=cnt[v]
    q.append(u) #スタックに子ノードuを積む
print(*cnt[1:]) #各頂点のcountが答えとなる

Buggy python submission (verdict: Runtime Error):
n, q = map(int, input().split())

tree_index = [[] for _ in range(n)]
for i in range(n-1):
  a, b = map(int, input().split())
  a -= 1
  b -= 1
  tree_index[a].append(b)
  tree_index[b].append(a)

ans = [0] * n
for i in range(q):
  p, x = map(int, input().split())
  ans[p-1] += x

def dfs(cur, par):
  for child in tree_index[cur]:
    if child == par:
      continue
    ans[child] += ans[cur]
    dfs(child, cur)
dfs(0, -1)
print(*ans)

Fixed submission:
import collections

n,q=map(int,input().split())
cnt=[0]*(n+1)
g=[[] for _ in range(n+1)]
for _ in range(n-1): #木グラフの隣接リストを作成
  a,b=map(int,input().split())
  g[a].append(b)
  g[b].append(a)
for _ in range(q): #各頂点についてcount[v]を計算
  v,val=map(int,input().split())
  cnt[v]+=val
q=collections.deque()
q.append(1) #DFSのスタックによる実装、まずスタックに始点1を積む
checked=[0]*(n+1) #各頂点を見たかどうかのフラグを持っておく
while q:
  v=q.pop()
  checked[v]=1 #頂点を見たかどうかのフラグを更新す
  for u in g[v]:
    if checked[u]==1: #vの子ノードuについて、まだ見ていない頂点であればcount[u]をcount[u]+=count[v]として更新する
      continue
    cnt[u]+=cnt[v]
    q.append(u) #スタックに子ノードuを積む
print(*cnt[1:]) #各頂点のcountが答えとなる
Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
import math


# 持っているビスケットを叩き、1枚増やす
# ビスケット A枚を 1円に交換する
# 1円をビスケット B枚に交換する
def main():
    s = input()
    n = len(s)
    cnt = 0
    ans = [0] * n
    for i, moji in enumerate(s):
        if moji == "R":
            cnt += 1
            continue
        else:
            even_num = cnt//2
            odd_num = cnt - even_num
            ans[i] += even_num
            ans[i-1] += odd_num
            cnt = 0

    cnt = 0
    for i in range(n-1, -1, -1):
        if s[i] == "L":
            cnt += 1
            continue
        else:
            even_num = cnt // 2
            odd_num = cnt - even_num
            ans[i] += even_num
            ans[i+1] += odd_num
            cnt = 0
    print(*ans)

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)


def input_list():
    return list(map(int, input().split()))


def input_list_str():
    return list(map(str, input().split()))


if __name__ == "__main__":
    main()


Fixed submission:
def count_section_by_zero(data):
  count = 0
  flg = False
  start = 0
  for i, d in enumerate(data):
    if flg is False and d != 0:
      count += 1
      flg = True
      
    if d == 0:
      flg = False
  return count

def input_list():
  return list(map(int, input().split()))

def input_list_str():
  return list(map(str, input().split()))

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

def gcd(*numbers):
    return reduce(fractions.gcd, numbers)

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

# 2で割り切れる回数
def divide_two(arg):
  c = 0
  while True:
    if c >= 2:
      break
    if arg % 2 != 0:
      break
    arg //= 2
    c += 1
  return c

# 素因数分解
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

def main():
  s = input()
  n = len(s)
  ans = [1]*n
  for i in range(0, n-2):
    if s[i] == "R" and s[i+1] == "R":
      ans[i+2] += ans[i]
      ans[i] = 0
  for i in range(n-1, -1, -1):
    if s[i] == "L" and s[i-1] == "L":
      ans[i-2] += ans[i]
      ans[i] = 0
  print(*ans)
  
import math
import fractions
import collections
import itertools
from functools import reduce
main()
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
a = []
for _ in range(m):
  a.append(int(input()))
  
dp = [0]*(n+1)
dp[0] = 1

for i in range(1, n+1):
  if i in a:
    dp[i] = 0
    continue
  dp[i] = dp[i-1] + dp[i-2]

mod = 1000000007
print(dp[-1]%mod)

Fixed submission:
n, m = map(int, input().split())

safe = [True] * (n + 1)
for _ in range(m):
  safe[int(input())] = False
dp = [0] * (n + 1)

dp[0] = 1
if safe[1]:
  dp[1] = 1

for i in range(2, n + 1):
  if safe[i - 1]:
    dp[i] += dp[i - 1]
  if safe[i - 2]:
    dp[i] += dp[i - 2]
  dp[i] %= 1000000007
 
print(dp.pop())

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
a = []
for _ in range(m):
  a.append(int(input()))
  
dp = [0]*(n+1)
dp[0] = 1

for i in range(1, n+1):
  if i in a:
    dp[i] = 0
    continue
  dp[i] = dp[i-1]
  if i > 1:
    dp[i] = dp[i-1] + dp[i-2]

mod = 1000000007
print(dp[-1]%mod)

Fixed submission:
n, m = map(int, input().split())

safe = [True] * (n + 1)
for _ in range(m):
  safe[int(input())] = False
dp = [0] * (n + 1)

dp[0] = 1
if safe[1]:
  dp[1] = 1

for i in range(2, n + 1):
  if safe[i - 1]:
    dp[i] += dp[i - 1]
  if safe[i - 2]:
    dp[i] += dp[i - 2]
  dp[i] %= 1000000007
 
print(dp.pop())

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())

broken = []
for _ in range(m):
  broken.append(int(input()))
  
dp = [0] * (n + 1)

dp[0] = 1
if 1 not in broken:
  dp[1] = 1

for i in range(2, n + 1):
  if i - 1 not in broken:
    dp[i] += dp[i - 1]
  if i - 2 not in broken:
    dp[i] += dp[i - 2]
  dp[i] %= 1000000007
 
print(dp.pop())

Fixed submission:
n, m = map(int, input().split())

safe = [True] * (n + 1)
for _ in range(m):
  safe[int(input())] = False
dp = [0] * (n + 1)

dp[0] = 1
if safe[1]:
  dp[1] = 1

for i in range(2, n + 1):
  if safe[i - 1]:
    dp[i] += dp[i - 1]
  if safe[i - 2]:
    dp[i] += dp[i - 2]
  dp[i] %= 1000000007
 
print(dp.pop())
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
MINUS = 0
B = []

for i in A:
  if i < 0:
    MINUS += 1
  else:
    B.append(i)
  
if min(A) > 0:
  print(sum(A))
  exit(0)
  
ans = 0
if MINUS % 2 == 0:
  for a in A:
    ans += abs(a)
else:
  mb = min(B)
  mb_flag = True
  for a in A:
    if mb_flag and a == mb:
      mb_flag = False
      continue
    ans += abs(a)
  ans -= mb

print(ans)
  
  


Fixed submission:
N = int(input())
A = list(map(int, input().split()))
MIN_A = min(map(abs, A))
MINUS = 0

for i in A:
  if i < 0:
    MINUS += 1

if min(A) > 0:
  print(sum(A))
  exit(0)
  
ans = 0
if MINUS % 2 == 0:
  for a in A:
    ans += abs(a)
else:
  for a in A:
    ans += abs(a)
  ans -= MIN_A * 2

print(ans)