Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N = int(input())
ans_lis = [[0　for k in range(9)] for i in range(9)]
for i in range(1,N+1):
  t = str(i)
  mae = int(t[0])
  ushiro = int(t[-1])
  if ushiro == 0:
    continue
  ans_lis[mae-1][ushiro-1] += 1
ans = 0
for i in range(9):
  for j in range(9):
    ans += ans_lis[i][j] * ans_lis[j][i]
print(ans)


Fixed submission:
N = int(input())
ans_lis = [[0] * 9 for i in range(9)]
for i in range(1,N+1):
  t = str(i)
  mae = int(t[0])
  ushiro = int(t[-1])
  if ushiro == 0:
    continue
  ans_lis[mae-1][ushiro-1] += 1
ans = 0
for i in range(9):
  for j in range(9):
    ans += ans_lis[i][j] * ans_lis[j][i]
print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
ans_lis = [[0] * 9 for i in range(9)]
for i in range(1,N+1):
  t = str(i)
  mae = int(t[0])
  ushiro = int(t[-1])
  if usiro == 0:
    continue
  ans_lis[mae-1][ushiro-1] += 1
ans = 0
for i in range(9):
  for j in range(9):
    ans += ans_lis[i][j] * ans_lis[j][i]
print(ans)


Fixed submission:
N = int(input())
ans_lis = [[0] * 9 for i in range(9)]
for i in range(1,N+1):
  t = str(i)
  mae = int(t[0])
  ushiro = int(t[-1])
  if ushiro == 0:
    continue
  ans_lis[mae-1][ushiro-1] += 1
ans = 0
for i in range(9):
  for j in range(9):
    ans += ans_lis[i][j] * ans_lis[j][i]
print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
ans_lis = [[0　for k in range(9)] for i in range(9)]
for i in range(1,N+1):
  t = str(i)
  mae = int(t[0])
  ushiro = int(t[-1])
  ans_lis[mae-1][ushiro-1] += 1
ans = 0
for i in range(9):
  for j in range(9):
    ans += ans_lis[i][j] * ans_lis[j][i]
print(ans)


Fixed submission:
N = int(input())
ans_lis = [[0] * 9 for i in range(9)]
for i in range(1,N+1):
  t = str(i)
  mae = int(t[0])
  ushiro = int(t[-1])
  if ushiro == 0:
    continue
  ans_lis[mae-1][ushiro-1] += 1
ans = 0
for i in range(9):
  for j in range(9):
    ans += ans_lis[i][j] * ans_lis[j][i]
print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
ans_lis = [[0　for _ in range(9)] for  i in range(9)]
for i in range(1,N+1):
  t = str(i)
  mae = int(t[0])
  ushiro = int(t[-1])
  ans_lis[mae-1][ushiro-1] += 1
ans = 0
for i in range(9):
  for j in range(9):
    ans += ans_lis[i][j] * ans_lis[j][i]
print(ans)

Fixed submission:
N = int(input())
ans_lis = [[0] * 9 for i in range(9)]
for i in range(1,N+1):
  t = str(i)
  mae = int(t[0])
  ushiro = int(t[-1])
  if ushiro == 0:
    continue
  ans_lis[mae-1][ushiro-1] += 1
ans = 0
for i in range(9):
  for j in range(9):
    ans += ans_lis[i][j] * ans_lis[j][i]
print(ans)
Buggy python submission (verdict: Runtime Error):
from intertools import chain
from collections import deque
H, W = map(int,input().split())
S = [list(map(str,input().split())) for _ in range(H)]
dhw = [[0,1],[0,-1],[1,0],[-1,0]]

ans = 0
for h in range(H):
  for w in range(W):
    d = deque([h,w])
    maze = [[-1] * W for _ in range(H)]
    if S[h][w] == '#':
      continue
    maze[h][w] = 0
    while d:
      ht , hw = d.popleft()
      for dh, dw in dhw:
        nh = ht + dh
        nw = wt + dw
        if 0 <= nh < H and 0 <= nw < W:
          if maze[nh][nw] == -1 and S[nh][nw] == '.':
            d.append([nh,nw])
            maze[nh][nw] = maze[ht][wt] + 1
    ans = max(ans,max(chain(*maze))
print(ans)


Fixed submission:
C = input()
k = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
for i in range(len(k)):
  if C == k[i]:
    print(k[i+1])

Buggy python submission (verdict: Runtime Error):
C = input()
k = [a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z]
for i in range(len(k)):
  if C == k[i]:
    print(k[i+1])


Fixed submission:
C = input()
k = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
for i in range(len(k)):
  if C == k[i]:
    print(k[i+1])

Buggy python submission (verdict: Runtime Error):
C = input()
k = [a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,g]
for i in range(len(k)):
  if C == k[i]:
    print(k[i+1])

Fixed submission:
C = input()
k = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
for i in range(len(k)):
  if C == k[i]:
    print(k[i+1])
Buggy python submission (verdict: Runtime Error):
N = int(input())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
lis1 = [i for i in range(1,N+1)]
lis2 = [i for i in range(1,N+1)]
def number(a, lis):
  total_order = 1
  for i in range(N):
    tmp_order = lis.index(a[i])
    lis.remove(a[i])
    total_order += tmp_order * math.factorial(len(lis))
  return total_order
print(abs(number(P, lis1) - number(Q, lis2)))


Fixed submission:
import math
N = int(input())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
lis1 = [i for i in range(1,N+1)]
lis2 = [i for i in range(1,N+1)]
def number(a, lis):
  total_order = 1
  for i in range(N):
    tmp_order = lis.index(a[i])
    lis.remove(a[i])
    total_order += tmp_order * math.factorial(len(lis))
  return total_order
print(abs(number(P, lis1) - number(Q, lis2)))

Buggy python submission (verdict: Runtime Error):
import math
N = int(input())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
lis1 = [i for i in range(1,N+1)]
lis2 = [i for i in range(1,N+1)]
def number(a, lis):
  total_order = 1
  for i in range(N):
    tmp_order = lis.index(a[i])
    lis.pop(a[i])
    total_order += tmp_order * math.factorial(len(lis))
  return total_order
print(abs(number(P, lis1) - number(Q, lis2)))


Fixed submission:
import math
N = int(input())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
lis1 = [i for i in range(1,N+1)]
lis2 = [i for i in range(1,N+1)]
def number(a, lis):
  total_order = 1
  for i in range(N):
    tmp_order = lis.index(a[i])
    lis.remove(a[i])
    total_order += tmp_order * math.factorial(len(lis))
  return total_order
print(abs(number(P, lis1) - number(Q, lis2)))
Buggy python submission (verdict: Runtime Error):
X = int(input())
def isPrime(N):
  for i in range(2, ceil(N ** (1/2)):
    if N % i == 0:
      return False
  return True
while isPrime(X) == False:
  X += 1
print(X)

Fixed submission:
import math
X = int(input())
def isPrime(N):
  for i in range(2, math.ceil(math.sqrt(X))):
    if N % i == 0:
      return False
  return True
while isPrime(X) == False:
  X += 1
print(X)

Buggy python submission (verdict: Runtime Error):
X = int(input())
def sosu(n):
  for i in range(0,n//2):
    if X % i == 0:
      return False
    return True
if sosu(X) == True :
  print(X)
else:
  while sosu(X) == False:
    X += 1
  print(X)

Fixed submission:
import math
X = int(input())
def isPrime(N):
  for i in range(2, math.ceil(math.sqrt(X))):
    if N % i == 0:
      return False
  return True
while isPrime(X) == False:
  X += 1
print(X)
Buggy python submission (verdict: Runtime Error):
N = int(input())
a = list(map(int,input().split()))
k = 0
for i in range(N):
  if a[i] = k + 1 :
    k += 1
if k == 0:
  print(-1)
else:
  print(N-k)

Fixed submission:
N = int(input())
a = list(map(int,input().split()))
k = 0
for i in range(N):
  if a[i] == k + 1 :
    k += 1
if k == 0:
  print(-1)
else:
  print(N-k)
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = input()
n = N // 2
if S[:n] == S[n:]:
    print('Yes')
else:s
    print('No')


Fixed submission:
N = int(input())
S = input()
n = N // 2
if S[:n] == S[n:]:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
N = int(input())
S = input()
if N%2 == 1:
  print('No')
else:
  for i in range(N/2):
    if S[i] != S[N/2 + i]:
      print('No')
      break
  print('Yes')
  


Fixed submission:
N = int(input())
S = input()
n = N // 2
if S[:n] == S[n:]:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
N = int(input())
S = input()
if N%2 = 1:
  print('No')
else:
  for i in range(N//2):
    if S[i] != S[N//2 + i]:
      print('No')
      break
  print('Yes')
  

Fixed submission:
N = int(input())
S = input()
n = N // 2
if S[:n] == S[n:]:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
X, Y = map(int, input().split())
import math
a = 2*Y -X
b = 2*X -Y
if a % 3 == 0 and b % 3 == 0 and a > 0 and b > 0:
  k = a // 3
  l = b // 3
  c = max(k, l)
  d = min(k, l)
  sita = math.factorial(d)
  ue = 1
  for i in range(c + 1, c + d + 1):
    ue * = i
  total = ue // sita
  print(total % (7 + 10 ** 9))
else:
  print(0)


Fixed submission:
X, Y = map(int, input().split())
import math
mod = pow(10,9) + 7
a = 2*Y -X
b = 2*X -Y
if a % 3 == 0 and b % 3 == 0 and a >= 0 and b >= 0:
  k = a // 3
  l = b // 3
  c = max(k, l)
  d = min(k, l)
  bunshi = 1
  bunbo = 1
  for i in range(c+1,c+d+1):
    bunshi = bunshi * i % mod
  for i in range(1,d+1):
    bunbo = bunbo * i % mod
  ans = bunshi * pow(bunbo, mod-2, mod) % mod
  print(ans)
else:
  print(0)

Buggy python submission (verdict: Runtime Error):
X, Y = map(int, input().split())
import math
a = 2*Y -X
b = 2*X -Y
if a % 3 == 0 and b % 3 == 0:
  k = a // 3
  l = b // 3
  ue = math.factorial(k+l)
  sita_1 = math.factorial(k)
  sita_2 = math.factorial(l)
  total = ue // (sita_1 * sita_2)
  print(total % (7 + 10 ** 9))
else:
  print(0)


Fixed submission:
X, Y = map(int, input().split())
import math
mod = pow(10,9) + 7
a = 2*Y -X
b = 2*X -Y
if a % 3 == 0 and b % 3 == 0 and a >= 0 and b >= 0:
  k = a // 3
  l = b // 3
  c = max(k, l)
  d = min(k, l)
  bunshi = 1
  bunbo = 1
  for i in range(c+1,c+d+1):
    bunshi = bunshi * i % mod
  for i in range(1,d+1):
    bunbo = bunbo * i % mod
  ans = bunshi * pow(bunbo, mod-2, mod) % mod
  print(ans)
else:
  print(0)

Buggy python submission (verdict: Runtime Error):
X, Y = map(int, input().split())
import math
if (2 * Y - X ) % 3 == 0 and (2 * X -  Y) % 3 == 0:
  k = (2 * Y - X) // 3
  l = (2 * X - Y) // 3
  ue = math.factorial(k+l)
  sita_1 = math.factorial(k)
  sita_2 = math.factorial(l)
  total = ue //(sita_1 * sita_2)
  print(total % (7 + 10 ** 9))
else:
  print(0)


Fixed submission:
X, Y = map(int, input().split())
import math
mod = pow(10,9) + 7
a = 2*Y -X
b = 2*X -Y
if a % 3 == 0 and b % 3 == 0 and a >= 0 and b >= 0:
  k = a // 3
  l = b // 3
  c = max(k, l)
  d = min(k, l)
  bunshi = 1
  bunbo = 1
  for i in range(c+1,c+d+1):
    bunshi = bunshi * i % mod
  for i in range(1,d+1):
    bunbo = bunbo * i % mod
  ans = bunshi * pow(bunbo, mod-2, mod) % mod
  print(ans)
else:
  print(0)
Buggy python submission (verdict: Runtime Error):
S = input()
kei = 0
k = []
l = []
if S[0] == '<':
  k.append(0)
for i in range(len(S)-1):
  if S[i] == '>' and S[i+1] == '<':
    k.append(i+1)
  elif S[i] == '<' and S[i+1] == '>':
    l.append(i+1)
if S[len(S)] == '>':
  k.append(len(S)+1)
def summ(m):
  s = 0
  if m != 0:
    for j in range(1,m+1):
      s += j
  return s
for p in range(len(k)-1):
  if k[p+1] - l[p] > l[p] - k[p]:
    kei += summ(k[p+1] - l[p]) + summ(l[p]-k[p] - 1)
  else:
    kei += summ(k[p+1] - l[p] - 1) + summ(l[p]-k[p])
print(kei)   
  
  
  
  
  
  
  
  

Fixed submission:
s = input()
N = len(s) + 1
l = [0]*N #からのリストN個
for i in range(N-1):
  if s[i] == '<':
    l[i+1] = l[i] + 1
for k in range(N-2,-1,-1):#後ろから逆順で一ずつ降る
  if s[k] == '>':
    l[k] = max(l[k], l[k+1] + 1)
print(sum(l))
Buggy python submission (verdict: Runtime Error):
N = int(input())
a = 1
while a * a <= N:
  if N % a = 0:
    k = a
  a += 1
b = N //k
print(b + k - 2)


Fixed submission:
N = int(input())
a = 1
while a * a <= N:
  if N % a == 0:
    k = a
  a += 1
b = N //k
print(b + k - 2)

Buggy python submission (verdict: Runtime Error):
N = int(input())
a = 1
while a * a <= N:
  if N % a = 0:
    k = a
  a += 1
print(k + (N // k) - 2)


Fixed submission:
N = int(input())
a = 1
while a * a <= N:
  if N % a == 0:
    k = a
  a += 1
b = N //k
print(b + k - 2)

Buggy python submission (verdict: Runtime Error):
N = int(input())
a = 1
while a * a <= N:
  if N % a = 0:
    k = a
  a += 1
print(k + (N/k) - 2)


Fixed submission:
N = int(input())
a = 1
while a * a <= N:
  if N % a == 0:
    k = a
  a += 1
b = N //k
print(b + k - 2)

Buggy python submission (verdict: Runtime Error):
N = int(input())
a = 1
while a * a <= N:
  if N % a = 0:
    k = a
  a += 1
print(k + (N//k) -2)


Fixed submission:
N = int(input())
a = 1
while a * a <= N:
  if N % a == 0:
    k = a
  a += 1
b = N //k
print(b + k - 2)

Buggy python submission (verdict: Runtime Error):
N = int(input())
a = 2
while a * a <= N:
  if N % a = 0:
    k = a
  a += 1
print(k + N//k -2)


Fixed submission:
N = int(input())
a = 1
while a * a <= N:
  if N % a == 0:
    k = a
  a += 1
b = N //k
print(b + k - 2)
Buggy python submission (verdict: Runtime Error):
import bisect
n =int(input())
l =list(map(int, input().split()))
l.sort()
total = 0
for i in range(n-2):
  for j in range(i+1, n-1):
    tmp = bisect.bisect_left(l,l[i]+L[j])
    total += tmp - j - 1
print(total)

Fixed submission:
import bisect
n =int(input())
l =list(map(int, input().split()))
l.sort()
total = 0
for i in range(n-2):
  for j in range(i+1, n-1):
    tmp = bisect.bisect_left(l,l[i]+l[j])
    total += tmp - j - 1
print(total)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
L = list(map(int, input().split()))
l =sorted(L)
t = 0
for i in range(N-2):
  for k in range(i+1,N-1):
    for m in range(k+1, N):
      if l[m] < l[k] + l[i]:
        t += 1
      else:
        break
print(t)
      

Fixed submission:
import bisect
n =int(input())
l =list(map(int, input().split()))
l.sort()
total = 0
for i in range(n-2):
  for j in range(i+1, n-1):
    tmp = bisect.bisect_left(l,l[i]+l[j])
    total += tmp - j - 1
print(total)

Buggy python submission (verdict: Runtime Error):
N = int(input())
L = list(map(int, input().split()))
l =sorted(L)
t = 0
for i in range(N-2):
  if i > 0 and l[i] = l[i-1]:
    break
  else:
    for k in range(i+1,N-1):
      for m in range(k+1, N):
        if l[m] < l[k] + l[i]:
          t += 1
        else:
          break
print(t)
      

Fixed submission:
import bisect
n =int(input())
l =list(map(int, input().split()))
l.sort()
total = 0
for i in range(n-2):
  for j in range(i+1, n-1):
    tmp = bisect.bisect_left(l,l[i]+l[j])
    total += tmp - j - 1
print(total)
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
h = list(map(int,input().split()))
num = 0
for i in range(n):
  if h[i] >= k:
    m += 1
print(m)

Fixed submission:
n, k = map(int, input().split())
h = list(map(int,input().split()))
num = 0
for i in range(n):
  if h[i] >= k:
    num += 1
print(num)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
for i in range(1, N + 1):
    print(A.index(i) + 1 , end = ' ')

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
B = [0]* N
for i in range(N):
    B[A[i]-1] = i + 1
print(*B)

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
k=[]
for i in range(1, n + 1):
  k.append(a.index[i] + 1)
print(k[l] for l in range(n). end =' ')
    


Fixed submission:
N = int(input())
A = list(map(int, input().split()))
B = [0]* N
for i in range(N):
    B[A[i]-1] = i + 1
print(*B)

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
k=[]
for i in range(1, n + 1):
  k.append(a.index(i) + 1)
print(k[l] for l in range(n). end =' ')
    


Fixed submission:
N = int(input())
A = list(map(int, input().split()))
B = [0]* N
for i in range(N):
    B[A[i]-1] = i + 1
print(*B)

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
k=[]
for i in range(1, n + 1):
  k.insert(0, a.index(i) + 1)
print(k[l] for l in range(n). end =' ')
    


Fixed submission:
N = int(input())
A = list(map(int, input().split()))
B = [0]* N
for i in range(N):
    B[A[i]-1] = i + 1
print(*B)

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
k=[]
for i in range(1, n + 1):
  k.insert(0, a.index(i) + 1)
print(k[l] for i in range(n). end =' ')
    

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
B = [0]* N
for i in range(N):
    B[A[i]-1] = i + 1
print(*B)
Buggy python submission (verdict: Runtime Error):
#標準入力からソートまで
import numpy as np
N, M = map(int, input().split())
A = list(map(lambda x : int(x) * (-1), input().split()))
#Aの中で一番でかいのをdiscountしてまた並び替え
#優先度付きqueuemを使う
import heapq
heapq.heapify(A)
for i in range(M):
    tmp = (-1) * heapq.heapop(A) // 2
    heapq.heappush(A, tmp * (-1))
print(-sum(A))

Fixed submission:
#標準入力からソートまで
N, M = map(int, input().split())
A = list(map(lambda x : int(x) * (-1), input().split()))
#Aの中で一番でかいのをdiscountしてまた並び替え
#優先度付きqueuemを使う
import heapq
heapq.heapify(A)
for i in range(M):
    tmp = (-1) * heapq.heappop(A) // 2
    heapq.heappush(A, tmp * (-1))
print(-sum(A))

Buggy python submission (verdict: Runtime Error):
#標準入力からソートまで
import numpy as np
N, M = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
#Aの中で一番でかいのをdiscountしてまた並び替え
import bisect
for i in range(M):
    tmp = A.pop(N-1) // 2
    if A[N-2] <= tmp:
        A.append(tmp)
    else:
        bisect.insort_left(A, tmp)
print(sum(A))

Fixed submission:
#標準入力からソートまで
N, M = map(int, input().split())
A = list(map(lambda x : int(x) * (-1), input().split()))
#Aの中で一番でかいのをdiscountしてまた並び替え
#優先度付きqueuemを使う
import heapq
heapq.heapify(A)
for i in range(M):
    tmp = (-1) * heapq.heappop(A) // 2
    heapq.heappush(A, tmp * (-1))
print(-sum(A))

Buggy python submission (verdict: Runtime Error):
#標準入力からソートまで
import numpy as np
N, M = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
A = np.array(A)
#Aの中で一番でかいのをdiscountしてまた並び替え
import bisect
for i in range(M):
    tmp = A.pop(N-1) // 2
    if A[N-2] <= tmp:
        A.append(tmp)
    else:
        bisect.insort_left(A, tmp)
print(sum(A))

Fixed submission:
#標準入力からソートまで
N, M = map(int, input().split())
A = list(map(lambda x : int(x) * (-1), input().split()))
#Aの中で一番でかいのをdiscountしてまた並び替え
#優先度付きqueuemを使う
import heapq
heapq.heapify(A)
for i in range(M):
    tmp = (-1) * heapq.heappop(A) // 2
    heapq.heappush(A, tmp * (-1))
print(-sum(A))

Buggy python submission (verdict: Time Limit Exceeded):
#標準入力からソートまで
N, M = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
#Aの中で一番でかいのをdiscountしてまた並び替え
import bisect
for i in range(M):
    tmp = A.pop(N-1) // 2
    bisect.insort_left(A, tmp)
print(sum(A))

Fixed submission:
#標準入力からソートまで
N, M = map(int, input().split())
A = list(map(lambda x : int(x) * (-1), input().split()))
#Aの中で一番でかいのをdiscountしてまた並び替え
#優先度付きqueuemを使う
import heapq
heapq.heapify(A)
for i in range(M):
    tmp = (-1) * heapq.heappop(A) // 2
    heapq.heappush(A, tmp * (-1))
print(-sum(A))
Buggy python submission (verdict: Runtime Error):
N = int(input())
a = list(map(int, input().split()))
ans = [0] * N
for i in range(N):
    tmp = N - i
    kosuu = N // tmp
    if kosuu == 1:
        if a[tmp-1] == 1:
            ans[tmp-1] = 1
    else:
        for j in range(kosuu-1):
            sub_sum += ans[tmp * (j + 2) -1]
            if a[tmp-1] != sub_sum % 2:
                ans[tmp-1] = 1

print(sum(ans))
print(*ans)

Fixed submission:
N = int(input())
a = list(map(int, input().split()))
ans = [0] * N
for i in range(N):
    tmp = N - i
    kosuu = N // tmp
    if kosuu == 1:
        if a[tmp-1] == 1:
            ans[tmp-1] = 1
    else:
        sub_sum = 0
        for j in range(kosuu-1):
            sub_sum += ans[tmp * (j + 2) -1]
        if a[tmp-1] != sub_sum % 2:
            ans[tmp-1] = 1
            
true_ans = []
for i in range(N):
    if ans[i] == 1:
        true_ans.append(i + 1)
print(sum(ans))
print(*true_ans)
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
mod = 10 ** 9 + 7
for i in range(1, K+1):
    if i > N - K + 1:
        print(0)
    else:
        ans = 1
        for j in range(K - i):
            ans = ans * (K - 1 - j )% mod
            ans = ans * pow(K - i - j, mod-2, mod) % mod
        for k in range(N - K - i + 1):
            ans = ans * (N - K + 1 - k) % mod
            ans = ans * pow(N - K - i + 1 - k, mod - 2, mod) % mod
        print(ans)

Fixed submission:
N, K = map(int, input().split())
mod = 10 ** 9 + 7
for i in range(1, K+1):
    if i > N - K + 1:
        print(0)
    else:
        ans = 1
        tmp = 1
        for j in range(K - i):
            ans = ans * (K - 1 - j )% mod
            tmp = tmp * (K - i - j) % mod
        for k in range(N - K - i + 1):
            ans = ans * (N - K + 1 - k) % mod
            tmp = tmp * (N - K - i + 1 - k) % mod
        ans = ans % mod * pow(tmp, mod - 2, mod) % mod
        print(ans)

Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
mod = 10 ** 9 + 7
for i in range(1, K+1):
    if i > N - K + 1
        print(0)
    else:
        ans = 1
        for j in range(K - i):
            ans = ans * (K - 1 - j )% mod
            ans = ans * pow(K - i - j, mod-2, mod) % mod
        for k in range(N - K - i + 1):
            ans = ans * (N - K + 1 - k) % mod
            ans = ans * pow(N - K - i + 1 - k, mod - 2, mod) % mod
        print(ans)

Fixed submission:
N, K = map(int, input().split())
mod = 10 ** 9 + 7
for i in range(1, K+1):
    if i > N - K + 1:
        print(0)
    else:
        ans = 1
        tmp = 1
        for j in range(K - i):
            ans = ans * (K - 1 - j )% mod
            tmp = tmp * (K - i - j) % mod
        for k in range(N - K - i + 1):
            ans = ans * (N - K + 1 - k) % mod
            tmp = tmp * (N - K - i + 1 - k) % mod
        ans = ans % mod * pow(tmp, mod - 2, mod) % mod
        print(ans)
Buggy python submission (verdict: Runtime Error):
import math
A, B, C, D = map(int, input().split())
lcm = C * D // math.gcd(C,D)
wari_A = (A-1) - ((A-1) // C + (A-1) // D - (A-1)//lcm)
wari_B = B - (B// C + B // D - B//lcm)
print(wari_B -wari_A)


Fixed submission:
import fractions
A, B, C, D = map(int, input().split())
lcm = C * D // fractions.gcd(C,D)
wari_A = (A-1) - ((A-1) // C + (A-1) // D - (A-1)//lcm)
wari_B = B - (B// C + B // D - B//lcm)
print(wari_B -wari_A)

Buggy python submission (verdict: Runtime Error):
import math
A, B, C, D = map(int, input().split())
cd = gcd(C,D)
wari_A = (A-1) - ((A-1) // C + (A-1) // D - (A-1)//cd)
wari_B = B - (B// C + B // D - B//cd)
print(wari_B -wari_A)


Fixed submission:
import fractions
A, B, C, D = map(int, input().split())
lcm = C * D // fractions.gcd(C,D)
wari_A = (A-1) - ((A-1) // C + (A-1) // D - (A-1)//lcm)
wari_B = B - (B// C + B // D - B//lcm)
print(wari_B -wari_A)

Buggy python submission (verdict: Runtime Error):
import math
A, B, C, D = map(int, input().split())
cd = math.gcd(C,D)
wari_A = (A-1) - ((A-1) // C + (A-1) // D - (A-1)//cd)
wari_B = B - (B// C + B // D - B//cd)
print(wari_B -wari_A)


Fixed submission:
import fractions
A, B, C, D = map(int, input().split())
lcm = C * D // fractions.gcd(C,D)
wari_A = (A-1) - ((A-1) // C + (A-1) // D - (A-1)//lcm)
wari_B = B - (B// C + B // D - B//lcm)
print(wari_B -wari_A)
Buggy python submission (verdict: Runtime Error):
N, X = map(int, input().split())
L = list(map(int, input().split()))
bound = 1
D = 0
i = 0
while X >= D + L[i] and i < N:
    bound += 1
    D = D + L[i]
    i += 1
print(bound)

Fixed submission:
N, X = map(int, input().split())
L = list(map(int, input().split()))
bound = 1
D = 0
i = 0
for i in range(N):
    if X >= D + L[i]:
        bound += 1
        D = D + L[i]
    else:
        break
print(bound)

Buggy python submission (verdict: Runtime Error):
N, X = map(int, input().split())
L = list(map(int, input().split()))
bound = 0
D = 0
i = 0
while D =< X and i < N:
    bound += 1
    D = D + L[i]
    i += 1
print(bound)

Fixed submission:
N, X = map(int, input().split())
L = list(map(int, input().split()))
bound = 1
D = 0
i = 0
for i in range(N):
    if X >= D + L[i]:
        bound += 1
        D = D + L[i]
    else:
        break
print(bound)