Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
l = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

k = int(input())

k = k + 1

print(l[k])

Fixed submission:
l = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

k = int(input())

k = k - 1

print(l[k])

Buggy python submission (verdict: Runtime Error):
l = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

k = int(input())

print(l[k+1])

Fixed submission:
l = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

k = int(input())

k = k - 1

print(l[k])
Buggy python submission (verdict: Runtime Error):
H = input().split()
H = [int(i) for i in H]

if H[0] > H[1]:
    H[0] = H[0] - H[1]
    count+ = 0
else:
    count+ = 1
print(count)

Fixed submission:
H = input().split()
H = [int(i) for i in H]

count = 0

while True:
    if H[0] > H[1]:
        H[0] = H[0] - H[1]
        count+=1
    else:
        count = count + 1
        break
print(count)
Buggy python submission (verdict: Runtime Error):
X = int(input())

amari = X % 105

if 0 <= X <= 99 or 106 <= X <= 199 or 211 <= X <= 299 or 421 <= X <= 499 or 526 <= X <= 599 or 631 <= X <= 699 or 736 <= X <= 799 or 841 <= X <= 899 or 1 <= amari <= 44 #946 <= X <= 999 or 1051 <= X <= 1099 or 1156 <= X <= 1199:
    print(0)
else:
    print(1)




Fixed submission:
X = int(input())

if X >= 100:
    if X % 100 == 0:
        print(1)
        exit()
elif 0 <= X <= 99:
    print(0)
    exit()

a = X // 105
b = a * 105 + 1
c = str(a) + '9' * 2
c = int(c)

if b <= X <= c:
    print(0)
else:
    print(1)
Buggy python submission (verdict: Runtime Error):
S = {'MON':6, 'TUE':5, 'WED':4, 'THU':3, 'FRI':2, 'STA':1, 'SUN':7}

s = input()
print(S[s])

Fixed submission:
S = {'MON':6, 'TUE':5, 'WED':4, 'THU':3, 'FRI':2, 'SAT':1, 'SUN':7}

s = input()
print(S[s])

Buggy python submission (verdict: Runtime Error):
S = {'MON':6, 'TUE':5, 'WED':4, 'THU':3, 'FRI':2, 'STA':1, 'SUN':7}

s = (input())
print(S[s])

Fixed submission:
S = {'MON':6, 'TUE':5, 'WED':4, 'THU':3, 'FRI':2, 'SAT':1, 'SUN':7}

s = input()
print(S[s])

Buggy python submission (verdict: Runtime Error):
S = {'MON':6, 'TUE':5, 'WED':4, 'THU':3, 'FRI':2, 'STA':1, 'SUN':7}

s = str(input())
print = S[s]

Fixed submission:
S = {'MON':6, 'TUE':5, 'WED':4, 'THU':3, 'FRI':2, 'SAT':1, 'SUN':7}

s = input()
print(S[s])

Buggy python submission (verdict: Runtime Error):
S = {'MON':6, 'TUE':5, 'WED':4, 'THU':3, 'FRI':2, 'STA':1, 'SUN':7}

s = input()
print = S[s]

Fixed submission:
S = {'MON':6, 'TUE':5, 'WED':4, 'THU':3, 'FRI':2, 'SAT':1, 'SUN':7}

s = input()
print(S[s])
Buggy python submission (verdict: Runtime Error):
array = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

print(array[K-1])

Fixed submission:
import sys

input = sys.stdin.readline
K = int(input())

array = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

print(array[K-1])
Buggy python submission (verdict: Runtime Error):
import sys
 
input = sys.stdin.readline
H, W = list(map(int,input().split()))
 
if H==1 or W==1:
    print(1)

ans =(A*B+1)//2
print(ans)

Fixed submission:
import sys
 
input = sys.stdin.readline
H, W = list(map(int,input().split()))
 
if H==1 or W==1:
    print(1)
    exit(0)

ans =int((H*W+1) // 2)
print(ans)

Buggy python submission (verdict: Runtime Error):
import sys
 
input = sys.stdin.readline
H, W = list(map(int,input().split()))
 
if H==1 of W==1:
    print(1)

ans =(A*B+1)//2
print(ans)

Fixed submission:
import sys
 
input = sys.stdin.readline
H, W = list(map(int,input().split()))
 
if H==1 or W==1:
    print(1)
    exit(0)

ans =int((H*W+1) // 2)
print(ans)
Buggy python submission (verdict: Runtime Error):
import math
N = int(input())
flag = 0
while flag == 0:
  lst = []
  for i in range(1, math.ceil(N**0.5)):
    if N%i == 0:
      if i**2 = N:
        lst.append(i)
      else:
        lst.append(i)
        lst.append(N//i)
  if len(lst) == 2:
    flag = 1
  else:
    N += 1
print(N)

Fixed submission:
import math
N = int(input())
flag = 0
while flag == 0:
  lst = []
  for i in range(1, math.ceil(N**0.5)):
    if N%i == 0:
      if i**2 == N:
        lst.append(i)
      else:
        lst.append(i)
        lst.append(N//i)
  if len(lst) == 2:
    flag = 1
  else:
    N += 1
print(N)
Buggy python submission (verdict: Runtime Error):
N = int(input())

proof = [[] for _ in range(N)]
for i in range(N):
    for j in range(int(input())):
        x, y = map(int, input().split())
        proof[i].append([x-1, y])

ans = 0
for i in range(1, 2**N):
    flag = 0
    for j in range(N):
        if (i>>j) & 1 == 1:
            for x, y in proof[j]:
                if (i>>x)&1 != state:
                    flag = 1
                    break
    if flag == 0:
        ans = max(ans, bin(i)[2:].count('1'))
print(ans)

Fixed submission:
N = int(input())

proof = [[] for _ in range(N)]
for i in range(N):
    for j in range(int(input())):
        x, y = map(int, input().split())
        proof[i].append([x-1, y])

ans = 0
for i in range(1, 2**N):
    flag = 0
    for j in range(N):
        if (i>>j) & 1 == 1:
            for x, y in proof[j]:
                if (i>>x)&1 != y:
                    flag = 1
                    break
    if flag == 0:
        ans = max(ans, bin(i)[2:].count('1'))
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = str(input())
x = '000'
ans = 0
while int(x) < 1000:
  st = 0
  cnt = 0
  if x[0] in S:
    for i in range(N):
      if x[0] == S[i]:
        st = i+1
        cnt += 1
        break
  if x[1] in S[st:]:
    for j in range(st, N):
      if x[1] == S[j]:
        st = j+1
        cnt += 1
        break
  if x[2] in S[st:]:
    for k in range(st, N):
      if x[2] == S[k]:
        st = k+1
        cnt += 1
        break
                
  if cnt == 3:
    ans += 1
  x = '{:03d}'.format(int(x)+1)
print(ans)

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

Buggy python submission (verdict: Runtime Error):
N = int(input())
S = str(input())
x = '000'
ans = 0
while int(x) < 1000:
  st = 0
  cnt = 0
  if x[0] in S:
    for i in range(N):
      if x[0] == S[i]:
        st = i+1
        cnt += 1
        break
  if x[1] in S[st:]:
    for j in range(st, N):
      if x[1] == S[j]:
        st = j+1
        cnt += 1
        break
  if x[2] in S[st:]:
    for k in range(st, N):
      if x[2] == S[k]:
        st = k+1
        cnt += 1
        break
                
  if cnt == 3:
    ans += 1
  x = '{:03d}'.format(int(x)+1)
print(ans)

Fixed submission:
a, b = map(int, input().split())
c, d = map(int, input().split())
if a != c:
  print(1)
else:
  print(0)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N = int(input())
S = np.array(list(str(input())))
x = '000'
ans = 0
while int(x) < 1000:
  st = 0
  cnt = 0
  if x[0] in S:
    for i in range(N):
      if x[0] == S[i]:
        st = i+1
        cnt += 1
        break
  if x[1] in S[st:]:
    for j in range(st, N):
      if x[1] == S[j]:
        st = j+1
        cnt += 1
        break
  if x[2] in S[st:]:
    for k in range(st, N):
      if x[2] == S[k]:
        st = k+1
        cnt += 1
        break
                
  if cnt == 3:
    ans += 1
  x = '{:03d}'.format(int(x)+1)
print(ans)

Fixed submission:
N = int(input())
S = str(input())
x = '000'
ans = 0
while int(x) < 1000:
  st = 0
  cnt = 0
  if x[0] in S:
    for i in range(N):
      if x[0] == S[i]:
        st = i+1
        cnt += 1
        break
  if x[1] in S[st:]:
    for j in range(st, N):
      if x[1] == S[j]:
        st = j+1
        cnt += 1
        break
  if x[2] in S[st:]:
    for k in range(st, N):
      if x[2] == S[k]:
        st = k+1
        cnt += 1
        break
                
  if cnt == 3:
    ans += 1
  x = '{:03d}'.format(int(x)+1)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = str(input())
x = '000'
ans = 0
while int(x) < 1000:
  st = 0
  cnt = 0
  if x[0] in S:
    for i in range(N):
      if x[0] == S[i]:
        st = i+1
        cnt += 1
        break
  if x[1] in S[st:]:
    for j in range(st, N):
      if x[1] == S[j]:
        st = j+1
        cnt += 1
        break
  if x[2] in S[st:]:
    for k in range(st, N):
      if x[2] == S[k]:
        st = k+1
        cnt += 1
        break
                
  if cnt == 3:
    ans += 1
  x = '{:03d}'.format(int(x)+1)
print(ans)

Fixed submission:
N = int(input())
S = str(input())
x = '000'
ans = 0
while int(x) < 1000:
  st = 0
  cnt = 0
  if x[0] in S:
    for i in range(N):
      if x[0] == S[i]:
        st = i+1
        cnt += 1
        break
  if x[1] in S[st:]:
    for j in range(st, N):
      if x[1] == S[j]:
        st = j+1
        cnt += 1
        break
  if x[2] in S[st:]:
    for k in range(st, N):
      if x[2] == S[k]:
        st = k+1
        cnt += 1
        break
                
  if cnt == 3:
    ans += 1
  x = '{:03d}'.format(int(x)+1)
print(ans)
Buggy python submission (verdict: Runtime Error):
import math
a, b, x = map(int, input().split())
if a*a*b == x:
    print(0)
    exit()
if x <= (a*a*b)/2:
    n = (2*x)/(a*b)
    s = (n**2 + b**2)**0.5
    print(math.degrees(math.asin(b/s)))
elif 
    n = (2*x) / (a**2) - b
    a = (a*n) / (b-n) + a
    s = (a**2 + b**2)**0.5
    print(math.degrees(math.asin(b/s)))

Fixed submission:
import math
a, b, x = map(int, input().split())
if a*a*b == x:
    print(0)
    exit()
if x <= (a*a*b)/2:
    n = (2*x)/(a*b)
    s = (n**2 + b**2)**0.5
    print(math.degrees(math.asin(b/s)))
else: 
    n = (2*x) / (a**2) - b
    a = (a*n) / (b-n) + a
    s = (a**2 + b**2)**0.5
    print(math.degrees(math.asin(b/s)))

Buggy python submission (verdict: Runtime Error):
import math
a, b, x = map(int, input().split())
if x <= (a*a*b)/2:
    n = (2*x)/(a*b)
    s = (n**2 + b**2)**0.5
    print(math.degrees(math.asin(b/s)))
else:
    n = (2*x) / (a**2) - b
    a = (a*n) / (b-n) + a
    s = (a**2 + b**2)**0.5
    print(math.degrees(math.asin(b/s)))

Fixed submission:
import math
a, b, x = map(int, input().split())
if a*a*b == x:
    print(0)
    exit()
if x <= (a*a*b)/2:
    n = (2*x)/(a*b)
    s = (n**2 + b**2)**0.5
    print(math.degrees(math.asin(b/s)))
else: 
    n = (2*x) / (a**2) - b
    a = (a*n) / (b-n) + a
    s = (a**2 + b**2)**0.5
    print(math.degrees(math.asin(b/s)))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
lst = list(map(int, input().split()))
lst.sort()
lst.append(10**10)
total = 0
for i in range(N-1):
    for j in range(i+1, N-1):
        cnt = 0
        k = j+1
        while lst[j]+lst[i] > lst[k]:
            cnt += 1
            k += 1
        total += cnt
print(total)


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

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
lst = list(map(int, input().split()))
lst.sort()
lst.append(10**10)
total = 0
for i in range(N-1):
    for j in range(i+1, N-1):
        cnt = 0
        k = j+1
        while lst[j]+lst[i] > lst[k]:
            cnt += 1
            k += 1
        total += cnt
print(total)

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

Buggy python submission (verdict: Time Limit Exceeded):
import itertools
N = int(input())
L = list(map(int, input().split()))
lst = list(itertools.combinations(L, 3))
cnt = 0
for i in lst:
    if i[0]+i[1] > i[2] and i[1]+i[2] > i[0] and i[0]+i[2] > i[1]:
        cnt += 1
print(cnt)

Fixed submission:
import bisect
N = int(input())
lst = list(map(int, input().split()))
lst.sort()
total = 0
for i in range(N-1):
    for j in range(i+1, N-1):
        x = bisect.bisect_left(lst, lst[i]+lst[j])
        total += x-j-1
print(total)
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = list(map(int, input().split()))
S = S[::-1]
S.append(S[-1])

for i in range(1, N):
    if S[i] <= S[i-1]:
        cnt += S[i]
    else:
        cnt += S[i-1]
        S[i] = S[i-1]

print(sum(S))



Fixed submission:
N = int(input())
S = list(map(int, input().split()))
S = [10**5+1] + S + [10**5+1]
ans = []
for i in range(1, N+1):
    ans.append(min(S[i-1], S[i]))
print(sum(ans))
Buggy python submission (verdict: Runtime Error):
N = int(input())
print(int((N+1)*N/2))

Fixed submission:
S = list(input())
T = list(input())
cnt = 0
for i in range(3):
    if S[i] == T[i]:
        cnt += 1
print(cnt)
Buggy python submission (verdict: Runtime Error):
N = int(input())
M = [0]*N
for i in range(N-1):
    M[i+1] = M[i] + i + 1
print(M[-1])

Fixed submission:
from decimal import *
N = int(input())

print(int(Decimal(Decimal(N-1)/2*Decimal(N))))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
m = 0
for i in range(1, N):
    m = m + i
print(m)

Fixed submission:
from decimal import *
N = int(input())

print(int(Decimal(Decimal(N-1)/2*Decimal(N))))
Buggy python submission (verdict: Runtime Error):
N, Q = map(int, input().split())
lst = []
cnt = []
ans = [0]*N
for i in range(N-1):
    lst.append(sorted(list(map(int, input().split()))))
lst = sorted(lst)
print(lst)
for j in range(Q):
    cnt.append(list(map(int, input().split())))
               
for k in cnt:
    ans[k[0]-1] += k[1]
for i in lst:
    ans[i[1]-1] += ans[i[0]-1]
for a in ans:
    print(a, end=" ")

Fixed submission:
a = int(input())
s = str(input())

if a >= 3200:
  print(s)
else:
  print('red')
Buggy python submission (verdict: Time Limit Exceeded):
import itertools
N = int(input())
lst = []
cnt = 0
for i in range(N):
    s = str(input())
    lst.append(sorted(s))
ans = itertools.combinations(lst, 2)
for j in ans:
    if j[0] == j[1]:
        cnt += 1
print(cnt)

Fixed submission:
N = int(input())
dic = {}
sum = 0
for i in range(N):
    s = ''.join(sorted(str(input())))
    if s in dic:
      dic[s] += 1
    else:
      dic[s] = 1
for i in dic.values():
    if i > 1:
        sum += i*(i-1)/2
print(int(sum))
Buggy python submission (verdict: Runtime Error):
N = int(input())
lst = list(map(int, input().split()))
cnt = 0
for i in lst:
    if lst[i]-1 != i:
        cnt += 1
if cnt > 2:
    print('NO')
else:
    print('YES')

Fixed submission:
N = int(input())
lst = list(map(int, input().split()))
cnt = 0
for i in range(N):
    if lst[i]-1 != i:
        cnt += 1
if cnt > 2:
    print('NO')
else:
    print('YES')
Buggy python submission (verdict: Runtime Error):
L, R = map(int, input().split())
small1 = L % 2019
small2 = R % 2019
for i in range(L, R+1):
    ans = i % 2019
    if  ans < small1:
        small2 = small1
        small1 = ans
    elif ans < small2:
        small2 = ans
    if small1 == 0:
        break
print(small1 * small2)

Fixed submission:
N, A, B = map(int, input().split())
print(min(N*A, B))
Buggy python submission (verdict: Runtime Error):
N = int(input())
lst = list(map(int, input().split()))
mid = N/2 - 1
lst = sorted(lst)
if lst[mid] == lst[mid+1]:
    print(0)
elif lst[mid] < lst[mid+1]:
    print(lst[mid+1]-lst[mid]+1)

Fixed submission:
N = int(input())
lst = list(map(int, input().split()))
mid = int(N/2 - 1)
lst = sorted(lst)
if lst[mid] == lst[mid+1]:
    print(0)
elif lst[mid] < lst[mid+1]:
    print(lst[mid+1]-lst[mid])
Buggy python submission (verdict: Runtime Error):
lst = list(int(input()))
flag = 0
for i in range(3):
    if lst[i] == lst[i+1]:
        flag += 1
if flag == 0:
    print('Good')
else:
    print('Bad')

Fixed submission:
lst = list(str(input()))
flag = 0
for i in range(3):
    if lst[i] == lst[i+1]:
        flag += 1
if flag == 0:
    print('Good')
else:
    print('Bad')
Buggy python submission (verdict: Runtime Error):
a, b, c, d = map(int, input().split())
i, j = c, d
def gcd(i, j):
    return i if j == 0 else GCD(j, i%j)
lcm = int(c//gcd(c, d)*d)

def cont(x):
    cnt1 = x//c 
    cnt2 = x//d
    ans = x - cnt1 - cnt2 + x//lcm
    return int(ans)

print(cont(b) - cont(a-1))

Fixed submission:
a, b, c, d = map(int, input().split())
i, j = c, d
def gcd(i, j):
    return i if j == 0 else gcd(j, i%j)
lcm = int(c//gcd(c, d)*d)

def cont(x):
    cnt1 = x//c 
    cnt2 = x//d
    ans = x - cnt1 - cnt2 + x//lcm
    return int(ans)

print(cont(b) - cont(a-1))

Buggy python submission (verdict: Time Limit Exceeded):
a, b, c, d = map(int, input().split())
lst = []
cnt = 0
for i in range(a, b+1):
    if i%c != 0:
        lst.append(i)
for j in lst:
    if j%d != 0:
        cnt += 1
print(cnt)

Fixed submission:
a, b, c, d = map(int, input().split())
i, j = c, d
def gcd(i, j):
    return i if j == 0 else gcd(j, i%j)
lcm = int(c//gcd(c, d)*d)

def cont(x):
    cnt1 = x//c 
    cnt2 = x//d
    ans = x - cnt1 - cnt2 + x//lcm
    return int(ans)

print(cont(b) - cont(a-1))

Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
c, d = map(int, input().split())
lst = []
cnt = 0
for i in range(a, b+1):
    if i%c != 0:
        lst.append(i)
for j in lst:
    if j%d != 0:
        cnt += 1
print(cnt)

Fixed submission:
a, b, c, d = map(int, input().split())
i, j = c, d
def gcd(i, j):
    return i if j == 0 else gcd(j, i%j)
lcm = int(c//gcd(c, d)*d)

def cont(x):
    cnt1 = x//c 
    cnt2 = x//d
    ans = x - cnt1 - cnt2 + x//lcm
    return int(ans)

print(cont(b) - cont(a-1))
Buggy python submission (verdict: Runtime Error):
#131d
N = int(input())
lst = []
for i in range(N):
    a, b = map(int, input())
    lst.append([b, a])
lst = sorted(lst)

lim = 0
time = 0
flag = 0
for i in lst:
    lim = i[0]
    if time + i[1] <= lim:
        time += i[1]
    else:
        flag = 1
        break
if flag == 0:
    print('Yes')
else:
    print('No')

Fixed submission:
#131d
N = int(input())
lst = []
for i in range(N):
    a, b = map(int, input().split())
    lst.append([b, a])
lst = sorted(lst)

lim = 0
time = 0
flag = 0
for i in lst:
    lim = i[0]
    if time + i[1] <= lim:
        time += i[1]
    else:
        flag = 1
        break
if flag == 0:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
h, w = map(int, input().split())
lst = []
for i in range(h):
    lst.append(list(input()))

R = [[0]*w for _ in range(h)]
L = [[0]*w for _ in range(h)]
U = [[0]*w for _ in range(h)]
D = [[0]*w for _ in range(h)]

for i in range(h):
    for j in range(w):
        if lst[i][j] == '.':
            if j == 0:
                L[i][j] = 1
            else:
                L[i][j] = L[i][j-1] + 1
        

for i in range(h):
    for j in range(w-1, -1, -1):
        if lst[i][j] == '.':
            if j == w-1:
                R[i][j] = 1
            else:
                R[i][j] = R[i][j+1] + 1            


for i in range(h):
    for j in range(w):
        if lst[i][j] == '.':
            if i == 0:
                U[i][j] = 1
            else:
                U[i][j] = U[i-1][j] + 1

for i in range(h-1, -1, -1):
    for j in range(w):
        if lst[i][j] == '.':
            if i == h-1:
                D[i][j] = 1
            else:
                D[i][j] = D[i+1][j] + 1

ans = 0
x = [[0]*w for _ in range(h)]
for i in range (h):
    for j in range(w):
        x[i][j] = L[i][j] + R[i][j] + U[i][j] + D[i][j] - 3
        ans = max(ans, max(x[i]))
print(ans) 

Fixed submission:
lst = list(map(int, input().split()))
lst = sorted(lst)
print(lst[0] + lst[1])
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
s = []
for i in range(M):
    s.append(list(map(int, input().split())))
p = list(map(int, input().split()))

switch = [['0'], ['1']]

for i in range(N-1):
    tmp = []
    for j in switch:
        tmp.append(j+['0'])
        tmp.append(j+['1'])
    switch = tmp #スイッチのonoffのマップ化

ans = 0

for i in switch:
    false = 0
    for j in range(M):
        cnt = 0 #onの個数
        for k in range(s[j][0]):
            if i[s[j][1+k]-1] == '1':
                cnt += 1
            if cnt%2 != p[j]:
                false += 1 #条件に合っていなかったらfalseに加算する
        if false == 0:
            ans += 1 #全て条件を満たしていたらansに加算する
print(ans)

Fixed submission:
a, p = map(int, input().split())
print((3*a+p)//2)
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
s = []
for i in range(M):
    s.append(list(map(int, input().split())))
p = list(map(int, input().split()))

switch = [['0'], ['1']]

for i in range(n-1):
    tmp = []
    for j in switch:
        tmp.append(j+['0'])
        tmp.append(j+['1'])
    switch = tmp　#スイッチのonoffのマップ化

ans = 0

for i in switch:
    false = 0
    for j in range(M):
        cnt = 0 #onの個数
        for k in range(s[i][0]):
            if i[s[j][1+k]-1] == '1':
                cnt += 1
            if cnt%2 != p[j]:
                false += 1 #条件に合っていなかったらfalseに加算する
        if false == 0:
            ans += 1 #全て条件を満たしていたらansに加算する
print(ans)

Fixed submission:
N, M = map(int, input().split())
s = []
for i in range(M):
    s.append(list(map(int, input().split())))
p = list(map(int, input().split()))

switch = [['0'], ['1']]

for i in range(N-1):
    tmp = []
    for j in switch:
        tmp.append(j+['0'])
        tmp.append(j+['1'])
    switch = tmp #スイッチのonoffのマップ化

ans = 0

for i in switch:
    false = 0
    for j in range(M):
        cnt = 0 #onの個数
        for k in range(s[j][0]):
            if i[s[j][1+k]-1] == '1':
                cnt += 1
        if cnt%2 != p[j]:
            false += 1 #条件に合っていなかったらfalseに加算する
    if false == 0:
        ans += 1 #全て条件を満たしていたらansに加算する
print(ans)
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
lst = list(map(int, input().split()))
ans = 0
for l in range(K+1):
    for r in range(K+1-l):
        if l + r > N:
            break
        get = lst[:l]
        get.extend(lst[N-r:])
        cnt = sum(get)
        get.sort()
        for i in range(min(K-l-r, l+r)):
            if get[i] >= 0:
                break
            tmp -= get[i]
        ans = max(ans, tmp)
print(ans)

Fixed submission:
N, K = map(int, input().split())
lst = list(map(int, input().split()))
ans = 0
for l in range(K+1):
    for r in range(K+1-l):
        if l + r > N:
            break
        get = lst[:l]
        get.extend(lst[N-r:])
        cnt = sum(get)
        get.sort()
        for i in range(min(K-l-r, l+r)):
            if get[i] >= 0:
                break
            cnt -= get[i]
        ans = max(ans, cnt)
print(ans)
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
A = list(map(int, input().split()))

for i in range(M):
    b, c = map(int, input().split())
    A.extend([c]*b)
A.sort(reverse=True)
ans = A[:N]
print(sum(ans))

Fixed submission:
A, B = map(int, input().split())
if A >= 13:
    print(int(B))
elif A <= 12 and A >= 6:
    print(int(B / 2))
else:
    print(0)