Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n, m = map(int,input().split())
if n%2 == 1:
    if m
    print(-1)
    exit()
else:
    if m >= n:
        print(-1)
        exit()

list1 = [0]*n
k = 2
for j in range(1,n):
    if j == len(list1)-j:
        list1[j] = 1
        break
    list1[j] = k
    list1[len(list1)-j] = k
    k = k+1

list2 = [0]*n
for j in range(1,n):
    if j == len(list2)-j:
        list2[j] = 1
        break
    list2[j] = k
    list2[len(list2)-j] = k
    k = k+1

li = list1 + list2

for i in range(len(li)):
    if li[i] == m:
        li[i] = 1
    elif li[i] == 1:
        li[i] = m
print(li)

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

if 2**m <= k:
    print(-1)
    exit()

if m == 1:
    if k == 0:
        print("0 0 1 1")
    if k == 1:
        print(-1)
    exit()

li = []
for i in range(2**m):
    if i != k:
        li.append(i)
li = li + [k] + list(reversed(li)) + [k]
print(" ".join(map(str, li)))

Buggy python submission (verdict: Runtime Error):
n, m = map(int,input().split())
if n%2 == 0:
    print(-1)
    exit()
else:
    if m >= n:
        print(-1)
        exit()

1/0

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

if 2**m <= k:
    print(-1)
    exit()

if m == 1:
    if k == 0:
        print("0 0 1 1")
    if k == 1:
        print(-1)
    exit()

li = []
for i in range(2**m):
    if i != k:
        li.append(i)
li = li + [k] + list(reversed(li)) + [k]
print(" ".join(map(str, li)))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

ans = 0
for i in range(1, 10**6+1):
    if n % i == n//i:
        ans += i

syou = n // 10**6

i = 10**6 + 1
while True:
    if syou != n//i:
        break
    else:
        if n % i == n//i:
            ans += i
    i += 1

syou = n//i

for i in range(1, syou+1):
    if (n-i) % i != 0:
        continue
    else:
        okiniiri = (n-i) // i
        if n % okiniiri == i:
            ans += okiniiri 

print(ans)

Fixed submission:
n = int(input())

ans = 0
for i in range(1, 10**6+1):
    if n % i == n//i:
        ans += i

if n <= 10**6:
    print(ans)
    exit()
  
syou = n // 10**6

i = 10**6 + 1
while True:
    if syou != n//i or i >= n:
        break
    else:
        if n % i == n//i:
            ans += i
    i += 1

syou = n//i

for i in range(1, syou+1):
    if (n-i) % i != 0:
        continue
    else:
        okiniiri = (n-i) // i
        if n % okiniiri == i:
            ans += okiniiri 

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import fractions
n = int(input())
a = list(map(int, input().split()))

new_ans = 0

for i in range(n):
    ans = a[0]
    if i == 0:
        ans = a[1]
        
    for j in range(n):
        if j == i:
            continue
        else:
            ans = fractions.gcd(ans,a[j])
            if new_ans > ans:
                break
    else:
        new_ans = ans
print(new_ans)

Fixed submission:
import fractions
n = int(input())
a = list(map(int, input().split()))

new_ans = 0
li = [0]*n
li2 = [0]*n

li[0] = a[0]
li2[n-1] = a[n-1]
for i in range(1,n):
    li[i] =fractions.gcd(li[i-1], a[i])

for i in range(1,n)[::-1]:
    li2[i-1] =fractions.gcd(li2[i], a[i-1])

ans =0
for i in range(1,n-1):
    tmp = fractions.gcd(li[i-1],li2[i+1])
    if ans < tmp:
        ans = tmp
ans = max(ans, li[n-2], li2[1])
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
x,y,z,k = map(int,input().split())

info = [list(map(int,input().split())) for i in range(3)]

li = []
ans = []
li_append = li.append 
ans_append = ans.append

for i in info[0]:
  for j in info[1]:
    li_append(i+j)
li = sorted(li,reverse=True)

for i in li[:3000]:
  for j in info[2]:
    ans_append(i+j)
ans = sorted(ans,reverse = True)

for i in range(k):
  print(ans[i])

Fixed submission:
x,y,z,k = map(int,input().split())

info = [list(map(int,input().split())) for i in range(3)]
info[0]=sorted(info[0],reverse=True)
info[1]=sorted(info[1],reverse=True)
info[2]=sorted(info[2],reverse=True)
li = []
ans = []
li_append = li.append 
ans_append = ans.append

for i in info[0]:
  for j in info[1]:
    li_append(i+j)
li = sorted(li,reverse=True)

for i in li[:3000]:
  for j in info[2]:
    ans_append(i+j)
ans = sorted(ans,reverse = True)

for i in range(k):
  print(ans[i])

Buggy python submission (verdict: Time Limit Exceeded):
x,y,z,k = map(int,input().split())

info = [list(map(int,input().split())) for i in range(3)]
info[0]=sorted(info[0],reverse=True)
info[1]=sorted(info[1],reverse=True)
info[2]=sorted(info[2],reverse=True)
li = []
ans = []
li_append = li.append 
ans_append = ans.append

for i in info[0]:
  for j in info[1]:
    li_append(i+j)
li = sorted(li,reverse=True)

for i in li[:3000]:
  for j in info[2]:
    ans_append(i+j)
ans = sorted(ans,reverse = True)

for i in range(k):
  print(ans[i])

Fixed submission:
x,y,z,k = map(int,input().split())

info = [list(map(int,input().split())) for i in range(3)]
info[0]=sorted(info[0],reverse=True)
info[1]=sorted(info[1],reverse=True)
info[2]=sorted(info[2],reverse=True)
li = []
ans = []
li_append = li.append 
ans_append = ans.append

for i in info[0]:
  for j in info[1]:
    li_append(i+j)
li = sorted(li,reverse=True)

for i in li[:3000]:
  for j in info[2]:
    ans_append(i+j)
ans = sorted(ans,reverse = True)

for i in range(k):
  print(ans[i])
Buggy python submission (verdict: Time Limit Exceeded):
n,q = map(int,input().split())
s = "0"+input()+"0"
info = [input().split() for i in range(q)]

def solve(pos):
  for i in range(q):
    if s[pos] == info[i][0]:
      if info[i][1] == "L":
        pos = pos - 1
      else:
        pos = pos + 1
    if pos == 0:
      return True
    elif pos == n+1:
      return False
  return False

def solve2(pos):
  for i in range(q):
    if s[pos] == info[i][0]:
      if info[i][1] == "R":
        pos = pos - 1
      else:
        pos = pos + 1
    if pos == 0:
      return True
    elif pos == n+1:
      return False
  return False
ans = n
ng = n+2
ok = 0
while abs(ng - ok) > 1:
  mid = (ng+ok)//2
  if solve(mid):
    ok = mid
  else:
    ng = mid

ans = ans - ok

s = s[::-1]

ng = n+2
ok = 0
while abs(ng - ok) > 1:
  mid = (ng+ok)//2
  if solve2(mid):
    ok = mid
  else:
    ng = mid

ans = ans - ok

print(ans)

Fixed submission:
n,q = map(int,input().split())
s = "0"+input()+"0"
info = [input().split() for i in range(q)]

def solve(pos):
  for i in range(q):
    if s[pos] == info[i][0]:
      if info[i][1] == "L":
        pos = pos - 1
      else:
        pos = pos + 1
    if pos == 0:
      return True
    elif pos == n+1:
      return False
  return False

def solve2(pos):
  for i in range(q):
    if s[pos] == info[i][0]:
      if info[i][1] == "R":
        pos = pos - 1
      else:
        pos = pos + 1
    if pos == 0:
      return True
    elif pos == n+1:
      return False
  return False
ans = n
ng = n+2
ok = 0
while abs(ng - ok) > 1:
  mid = (ng+ok)//2
  if solve(mid):
    ok = mid
  else:
    ng = mid

ans = ans - ok

s = s[::-1]

ng = n+2
ok = 0
while abs(ng - ok) > 1:
  mid = (ng+ok)//2
  if solve2(mid):
    ok = mid
  else:
    ng = mid

ans = ans - ok

print(ans)
Buggy python submission (verdict: Runtime Error):
n, x = map(int, input().split())
s = list(map(int, input().split()))
s = sorted(s)
MOD = 10**9 + 7

frac = [0]*(n+1)
frac[0] = 1
for i in range(0,n):
    frac[i+1] = (i+1) * frac[i]
    frac[i+1] %= MOD

def solve(x, cnt, visited):
    ans = 0
    flag = False
    if cnt == n:
        return x
    for i in range(n):
        if not visited[i]:
            if s[i] <= x:
                if not flag:
                    ans += (x % s[i]) * frac[n - (cnt + 1)]
                    flag = True
                else:
                    tmp_visited = visited[0:]
                    tmp_visited[i] = True
                    ans += solve(x % s[i], cnt + 1, tmp_visited) % MOD
                    ans %= MOD
            else:
                tmp_visited = visited[0:]
                tmp_cnt = 0
                for j in range(i, n):
                    if not tmp_visited[j]:
                        tmp_visited[j] = True
                        tmp_cnt += 1
                ans += solve(x, cnt + tmp_cnt, tmp_visited) * frac[tmp_cnt] % MOD
                ans %= MOD
                break
    return ans
    
    
print(solve(x, 0, visited = [False]*n) % MOD)

Fixed submission:
n, x = map(int, input().split())
s = list(map(int, input().split()))
MOD = 10 ** 9 + 7

s = sorted(s, reverse=True)
max_ = max(s[0], x)
dp = [[0] * (max_ + 1) for i in range(n + 1)]
dp[0][x] = 1

for i in range(n):
    for val in range(max_ + 1):
        dp[i + 1][val % s[i]] += dp[i][val]
        dp[i + 1][val % s[i]] %= MOD
        dp[i + 1][val] += dp[i][val] * (n - i - 1)
        dp[i + 1][val] %= MOD

ans = 0
for i, num in enumerate(dp[-1]):
    ans += num * i
    ans %= MOD
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
from fractions import Fraction

class Combination:
    '''計算量：階乗・逆元テーブルの作成O(N)
       nCkを求めるO(1)'''

    def __init__(self, n, MOD):
        self.fact = [1]
        for i in range(1, n + 1):
            self.fact.append(self.fact[-1] * i % MOD)
        self.inv_fact = [pow(self.fact[i] ,MOD - 2 ,MOD) for i in range(n + 1)]
        self.MOD = MOD

    def factorial(self, k):
        '''k!を求める'''
        return self.fact[k]

    def inverse_factorial(self, k):
        '''k!の逆元を求める'''
        return self.inv_fact[k]

    def combination(self, k, r):
        '''kCrを求める'''
        return (self.fact[k] * self.inv_fact[k - r] * self.inv_fact[r]) % self.MOD


b, w = map(int,input().split())
MOD = 10**9 + 7
comb = Combination(b+w, MOD)

#黒が(b+w-i)個残る確率 := pb
#白が(b+w-i)個残る確率 := pw
pb = [0]*(b+w+1)
pw = [0]*(b+w+1)

for i in range(b+w):
    if b+w-i > b:
        pb[b+w-i] = 0
        result_b = Fraction(0)
    else:
        result_b = Fraction(pb[b+w-i+1]) \
                 + Fraction(1, pow(2, i, MOD)) * Fraction(comb.combination(i-1, w-1) % MOD)
        pb[b+w-i] = Fraction(result_b.numerator % MOD, result_b.denominator % MOD)
        
    if b+w-i > w:
        pw[b+w-i] = 0
        result_w = Fraction(0)
    else:
        result_w = Fraction(pw[b+w-i+1]) \
                 + Fraction(1, pow(2, i, MOD)) * Fraction(comb.combination(i-1, b-1) % MOD)
        pw[b+w-i] = Fraction(result_w.numerator % MOD, result_w.denominator % MOD)
        
    ans = Fraction(result_b) \
          + Fraction(1, 2) * (Fraction(1) - Fraction(result_b) - Fraction(result_w))
    y = ans.numerator % MOD
    x = ans.denominator % MOD
    
    print((y * pow(x, MOD-2, MOD)) % MOD)
        

Fixed submission:
from fractions import Fraction

class Combination:
    '''計算量：階乗・逆元テーブルの作成O(N)
       nCkを求めるO(1)'''

    def __init__(self, n, MOD):
        self.fact = [1]
        for i in range(1, n + 1):
            self.fact.append(self.fact[-1] * i % MOD)
        self.inv_fact = [pow(self.fact[i] ,MOD - 2 ,MOD) for i in range(n + 1)]
        self.MOD = MOD

    def factorial(self, k):
        '''k!を求める'''
        return self.fact[k]

    def inverse_factorial(self, k):
        '''k!の逆元を求める'''
        return self.inv_fact[k]

    def combination(self, k, r):
        '''kCrを求める'''
        return (self.fact[k] * self.inv_fact[k - r] * self.inv_fact[r]) % self.MOD


b, w = map(int,input().split())
MOD = 10**9 + 7
comb = Combination(b+w, MOD)

#黒が(b+w-i)個残る確率 := pb
#白が(b+w-i)個残る確率 := pw
pb = [0]*(b+w+1)
pw = [0]*(b+w+1)

for i in range(b+w):
    if b+w-i > b:
        pb[b+w-i] = 0
        result_b = 0
    else:
        result_b = pb[b+w-i+1] + pow(pow(2, i, MOD), MOD-2, MOD) * comb.combination(i-1, w-1)
        result_b %= MOD
        pb[b+w-i] = result_b
        
    if b+w-i > w:
        pw[b+w-i] = 0
        result_w = 0
    else:
        result_w = pw[b+w-i+1] + pow(pow(2, i, MOD), MOD-2, MOD) * comb.combination(i-1, b-1)
        result_w %= MOD
        pw[b+w-i] = result_w
        
    ans = result_b + pow(2, MOD-2, MOD) * (1 - result_b - result_w)
    print(ans % MOD)
Buggy python submission (verdict: Time Limit Exceeded):
import itertools
n = int(input())
s = input()

memo = {}
for i in range(len(s)):
  if s[i] not in memo:
    memo[s[i]] = 1
  else:
    memo[s[i]] += 1
 
li = []
for i in memo.values() :
  li.append(i)

ans = -1
for i in itertools.product(range(2),repeat=len(li)):
#  print(i)
  tmp = 1
  for j in range(len(li)):
    if i[j] != 0:
      tmp = tmp * li[j]
  ans = ans + tmp
  ans = ans%1000000007
print(ans%1000000007)

Fixed submission:
import itertools
n = int(input())
s = input()

memo = {}
for i in range(len(s)):
  if s[i] not in memo:
    memo[s[i]] = 1
  else:
    memo[s[i]] += 1
 
li = []
for i in memo.values() :
  li.append(i)

ans = 1
for i in li:
  ans = (ans*(i+1))%1000000007
print((ans-1)%1000000007)

Buggy python submission (verdict: Time Limit Exceeded):
import itertools
n = int(input())
s = input()

memo = {}
for i in range(len(s)):
  if s[i] not in memo:
    memo[s[i]] = 1
  else:
    memo[s[i]] += 1
 
li = []
for i in memo.values() :
  li.append(i)

ans = 0
for i in itertools.product(range(2),repeat=len(li)):
#  print(i)
  tmp = 1
  for j in range(len(li)):
    if i[j] != 0:
      tmp = tmp * li[j]
  ans = ans + tmp
print((ans-1)%1000000007)

Fixed submission:
import itertools
n = int(input())
s = input()

memo = {}
for i in range(len(s)):
  if s[i] not in memo:
    memo[s[i]] = 1
  else:
    memo[s[i]] += 1
 
li = []
for i in memo.values() :
  li.append(i)

ans = 1
for i in li:
  ans = (ans*(i+1))%1000000007
print((ans-1)%1000000007)
Buggy python submission (verdict: Runtime Error):
#UnionFindクラス
class UnionFind:

  def __init__(self,n):
    self.par =  [i for i in range(n)]
    self.rank = [1 for _ in range(n)]

  # xの根を返す
  def find(self, x):
    if self.par[x] == x:
      return x
    else:
      self.par[x] = self.find(self.par[x])
      return self.par[x]
  
  # xとyの根を結合させる
  def union(self, x, y):
    x = self.find(x)
    y = self.find(y)
    if x != y:
      if self.rank[x] > self.rank[y]:
        x, y = y, x
      self.rank[x] += self.rank[y]
      self.par[y] = x
  
  # x,yの根が同じかどうかを返す（根が同じ:True、根が異なる:False）
  def is_same(self, x, y):
    return self.find(x) == self.find(y)

  # xが含まれる木の要素数を返す
  def size(self, x):
    return self.rank[self.find(x)]
    
n,m = map(int,input().split())
info = [list(map(int,input().split())) for i in range(m)]
uf = UnionFind(n)
okisa = [1]*(n)
ans = [0]*(m)
ans_=0
for i in range(n):
  ans_ = ans_+i
  
ans[m-1]= ans_
for i in range(1,m)[::-1]:
  if uf.is_same(info[i][0]-1,info[i][1]-1):
    ans[i-1] = ans[i] 
  else:
    ans[i-1] = ans[i]-uf.size(info[i][0]-1)*uf.size(info[i][1]-1)
    uf.union(info[i][0]-1,info[i][1]-1)
for i in range(m):
  print(ans[i])


Fixed submission:
#UnionFindクラス
class UnionFind(object):

  def __init__(self, n=1):
    self.par =  [i for i in range(n)]
    self.rank = [1 for _ in range(n)]

  def find(self, x):
    if self.par[x] == x:
      return x
    else:
      self.par[x] = self.find(self.par[x])
      return self.par[x]
  
  # xとyの根を結合させる
  def union(self, x, y):
    x = self.find(x)
    y = self.find(y)
    if x != y:
      if self.rank[x] < self.rank[y]:
        x, y = y, x
      self.rank[x] += self.rank[y]
      self.par[y] = x

  
  # x,yの根が同じかどうかを返す（根が同じ:True、根が異なる:False）
  def is_same(self, x, y):
    return self.find(x) == self.find(y)
    
n,m = map(int,input().split())
info = [list(map(int,input().split())) for i in range(m)]
uf = UnionFind(n)
okisa = [1]*(n)
ans = [0]*(m)
ans_=0
for i in range(n):
  ans_ = ans_+i
  
ans[m-1]= ans_
for i in range(1,m)[::-1]:
  if uf.is_same(info[i][0]-1,info[i][1]-1):
    ans[i-1] = ans[i] 
  else:
    ans[i-1] = ans[i]-uf.rank[uf.find(info[i][0]-1)]*uf.rank[uf.find(info[i][1]-1)]
    uf.union(info[i][0]-1,info[i][1]-1)
for i in range(m):
  print(ans[i])
Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())
a = sorted(list(map(int,input().split())), reverse=True)
match = [[0,0], [1,2], [2,5], [3,5], [4,4], [5,5], [6,6], [7,3], [8,7], [9,6]]

value = []
cost = []
for i in range(len(a)):
        value.append(a[i])
        cost.append(match[a[i]][1])

dp = [-1]*(n+1)
dp[0] = ""
for i in range(1,n+1):
    for j in range(len(value)):
        tmp_dp_i = 0
        if i - cost[j] >= 0:
            if i - cost[j] == 0 or (i - cost[j] > 0 and dp[i - cost[j]] != -1):
                tmp_dp_i = str(value[j]) + dp[i-cost[j]]
                tmp_dp_i = int(tmp_dp_i)
                if int(dp[i]) < tmp_dp_i:
                    dp[i] = str(tmp_dp_i)
print(dp[n])

Fixed submission:
n,m = map(int,input().split())
a = sorted(list(map(int,input().split())), reverse=True)
match = [[0,0], [1,2], [2,5], [3,5], [4,4], [5,5], [6,6], [7,3], [8,7], [9,6]]

value = []
cost = []
for i in range(len(a)):
        value.append(a[i])
        cost.append(match[a[i]][1])

dp = ["0"]*(n+1)
dp[0] = ""
for i in range(1,n+1):
    for j in range(len(value)):
        tmp_dp_i = 0
        if i - cost[j] >= 0:
            if i - cost[j] >= 0 and dp[i - cost[j]] != "0":
                tmp_dp_i = str(value[j]) + dp[i-cost[j]]
                if len(dp[i]) < len(tmp_dp_i):
                    dp[i] = tmp_dp_i
                elif dp[i] < tmp_dp_i:
                    dp[i] = tmp_dp_i
print(dp[n])

Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())
a = sorted(list(map(int,input().split())), reverse=True)
match = [[0,0], [1,2], [2,5], [3,5], [4,4], [5,5], [6,6], [7,3], [8,7], [9,6]]

value = []
cost = []
for i in range(len(a)):
        value.append(a[i])
        cost.append(match[a[i]][1])

dp = [-1]*(n+1)
dp[0] = ""
for i in range(1,n+1):
    for j in range(len(value)):
        tmp_dp_i = 0
        if i - cost[j] >= 0:
            if i - cost[j] == 0 or (i - cost[j] > 0 and dp[i - cost[j]] != -1):
                tmp_dp_i = str(value[j]) + dp[i-cost[j]]
                tmp_dp_i = int(tmp_dp_i)
                if int(dp[i]) < tmp_dp_i:
                    dp[i] = str(tmp_dp_i)
print(dp[n])

Fixed submission:
n,m = map(int,input().split())
a = sorted(list(map(int,input().split())), reverse=True)
match = [[0,0], [1,2], [2,5], [3,5], [4,4], [5,5], [6,6], [7,3], [8,7], [9,6]]

value = []
cost = []
for i in range(len(a)):
        value.append(a[i])
        cost.append(match[a[i]][1])

dp = ["0"]*(n+1)
dp[0] = ""
for i in range(1,n+1):
    for j in range(len(value)):
        tmp_dp_i = 0
        if i - cost[j] >= 0:
            if i - cost[j] >= 0 and dp[i - cost[j]] != "0":
                tmp_dp_i = str(value[j]) + dp[i-cost[j]]
                if len(dp[i]) < len(tmp_dp_i):
                    dp[i] = tmp_dp_i
                elif dp[i] < tmp_dp_i:
                    dp[i] = tmp_dp_i
print(dp[n])
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
MOD = 998244353
cnt_r = []
cnt_b = []
for i in s:
    cnt_r.append(2-int(i))
    cnt_b.append(int(i))
cursum_cnt_r = [0]*(len(s)+1)
cursum_cnt_b = [0]*(len(s)+1)
for i in range(len(s)):
    cursum_cnt_r[i+1] = cursum_cnt_r[i] + cnt_r[i]
    cursum_cnt_b[i+1] = cursum_cnt_b[i] + cnt_b[i]
cursum_cnt_r = cursum_cnt_r + [cursum_cnt_r[-1]]*len(s)
cursum_cnt_b = cursum_cnt_b + [cursum_cnt_b[-1]]*len(s)

#dp[ni][ri]:nこのボールを並べたときに赤色のボールがri個含まれるときの並べ方総数
dp = [[0]*(2*len(s)+1) for i in range(2*len(s)+1)]
dp[0][0] = 1
for ni in range(1,2*len(s)+1):
    for ri in range(0,ni+1):
        if ri == 0:
            if 0 <= ni <= cursum_cnt_b[ni]:
                #青色を選ぶ
                dp[ni][ri] = dp[ni-1][ri]
        elif ri == ni:
            if 0 <= ri <= cursum_cnt_r[ni]:
                #赤色を選ぶ
                dp[ni][ri] = dp[ni-1][ri-1]
        else:
            if 0 <= ri <= cursum_cnt_r[ni] and 0 <= ni-ri <= cursum_cnt_b[ni]:
                dp[ni][ri] += dp[ni-1][ri]
                dp[ni][ri] += dp[ni-1][ri-1]
        dp[ni][ri] %= MOD 

print(max(dp[2*len(s)]))

Fixed submission:
s = input()
MOD = 998244353
cnt_r = []
cnt_b = []
for i in s:
    cnt_r.append(2-int(i))
    cnt_b.append(int(i))
cursum_cnt_r = [0]*(len(s)+1)
cursum_cnt_b = [0]*(len(s)+1)
for i in range(len(s)):
    cursum_cnt_r[i+1] = cursum_cnt_r[i] + cnt_r[i]
    cursum_cnt_b[i+1] = cursum_cnt_b[i] + cnt_b[i]
cursum_cnt_r = cursum_cnt_r + [cursum_cnt_r[-1]]*len(s)
cursum_cnt_b = cursum_cnt_b + [cursum_cnt_b[-1]]*len(s)

#dp[ni][ri]:nこのボールを並べたときに赤色のボールがri個含まれるときの並べ方総数
dp = [[0]*(2*len(s)+1) for i in range(2*len(s)+1)]
dp[0][0] = 1
for ni in range(1,2*len(s)+1):
    for ri in range(0,ni+1):
        if ri == 0:
            if 0 <= ni <= cursum_cnt_b[ni]:
                #青色を選ぶ
                dp[ni][ri] = dp[ni-1][ri]
        elif ri == ni:
            if 0 <= ri <= cursum_cnt_r[ni]:
                #赤色を選ぶ
                dp[ni][ri] = dp[ni-1][ri-1]
        else:
            if 0 <= ri <= cursum_cnt_r[ni] and 0 <= ni-ri <= cursum_cnt_b[ni]:
                dp[ni][ri] += dp[ni-1][ri]
                dp[ni][ri] += dp[ni-1][ri-1]
        dp[ni][ri] %= MOD 

print(max(dp[2*len(s)]))
Buggy python submission (verdict: Runtime Error):
a,b,c= (int,input().split())
print(a*b/2)

Fixed submission:
a,b,c= map(int,input().split())
print(a*b//2)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(1000000)
 
N = int(input())
h = list(map(int,input().split()))
 
N -= 1
 
def step(i):
  if i == 0:
    return 0
  elif i == 1:
    return abs(h[1]-h[0])
  elif step(i-1)+abs(h[i-1]-h[i]) <= step(i-2)+abs(h[i-2]-h[i]):
    return step(i-1) + abs(h[i-1]-h[i])
  else:
    return step(i-2) + abs(h[i-2]-h[i])
  
print(step(N))



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

dp = [0]*N

dp[0] = 0
dp[1] = abs(h[1]-h[0])

for i in range(2,N):
  dp[i] = min(dp[i-2]+abs(h[i]-h[i-2]),dp[i-1]+abs(h[i]-h[i-1]))

print(dp[N-1])

Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(1000000)
 
N = int(input())
h = list(map(int,input().split()))
 
N -= 1
 
def step(i):
  if i == 0:
    return 0
  elif i == 1:
    return abs(h[1]-h[0])
  elif step[i-1]+abs(h[i-1]-h[i]) <= step[i-2]+abs(h[i-2]-h[i]):
    return step(i-1) + abs(h[i-1]-h[i])
  else:
    return step(i-2) + abs(h[i-2]-h[i])
  
print(step(N))

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

dp = [0]*N

dp[0] = 0
dp[1] = abs(h[1]-h[0])

for i in range(2,N):
  dp[i] = min(dp[i-2]+abs(h[i]-h[i-2]),dp[i-1]+abs(h[i]-h[i-1]))

print(dp[N-1])

Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(100000)

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

N -= 1
 
def step(i):
  if i == 0:
    return 0
  elif i == 1:
    return abs(h[1]-h[0])
  elif abs(h[i-1]-h[i]) <= abs(h[i-2]-h[i]):
    return step(i-1) + abs(h[i-1]-h[i])
  else:
    return step(i-2) + abs(h[i-2]-h[i])
  
print(step(N))

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

dp = [0]*N

dp[0] = 0
dp[1] = abs(h[1]-h[0])

for i in range(2,N):
  dp[i] = min(dp[i-2]+abs(h[i]-h[i-2]),dp[i-1]+abs(h[i]-h[i-1]))

print(dp[N-1])

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

N -= 1

def step(i):
  if i == 0:
    return 0
  elif i == 1:
    return abs(h[1]-h[0])
  elif abs(h[i-1]-h[i]) <= abs(h[i-2]-h[i]):
    return step(i-1) + abs(h[i-1]-h[i])
  else:
    return step(i-2) + abs(h[i-2]-h[i])
  
print(step(N))

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

dp = [0]*N

dp[0] = 0
dp[1] = abs(h[1]-h[0])

for i in range(2,N):
  dp[i] = min(dp[i-2]+abs(h[i]-h[i-2]),dp[i-1]+abs(h[i]-h[i-1]))

print(dp[N-1])

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

N -= 1

def step(i):
  if i == 0:
    return 0
  elif i == 1:
    return abs(h[1]-h[0])
  elif abs(h[i-1]-h[i]) <= abs(h[i-2]-h[i]):
    return step(i-1) + abs(h[i-1]-h[i])
  else:
    return step(i-2) + abs(h[i-2]-h[i])
  
print(step(N))


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

dp = [0]*N

dp[0] = 0
dp[1] = abs(h[1]-h[0])

for i in range(2,N):
  dp[i] = min(dp[i-2]+abs(h[i]-h[i-2]),dp[i-1]+abs(h[i]-h[i-1]))

print(dp[N-1])