Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = [set() for _ in range(N)]

for i in range(N):
    id = int(input()) - 1
    a[id].add(i)

step = -1
already = a[1]
now = a[1]
next = set()
for i in range(N-1):
    already = already.union(now)
    if 0 in now:
        step = i+1
        break
    for j in now:
        next = next.union(a[j])
    now = next
    next = set()

print(step)

Fixed submission:
N = int(input())
a = [set() for _ in range(N)]

for i in range(N):
    id = int(input()) - 1
    a[id].add(i)

step = -1
#already = a[1]
now = a[1]
next = set()
for i in range(N-1):
    #already = already.union(now)
    if 0 in now:
        step = i+1
        break
    for j in now:
        next = next.union(a[j])
    now = next
    next = set()

print(step)
Buggy python submission (verdict: Time Limit Exceeded):
X = input()

idx = 0

while idx < len(X)-1:
    if X[idx] == 'S':
        if X[idx+1] == 'T':
            X = X[:idx] + X[idx+2:]
            idx = max(-1, idx-2)
    idx += 1

print(len(X))

Fixed submission:
X = input()

s, t = 0, len(X)//2
cnt = 0
used = 0
for x in X:
    if x == 'S':
        s += 1
        if t-used > 0:
            cnt += 1
            used += 1
    else:
        used = max(0, used-1)
        t -= 1

print(len(X)-cnt*2)

Buggy python submission (verdict: Runtime Error):
X = input()

idx = 0

while idx < len(X):
    print(idx, X)
    if X[idx] == 'S':
        if idx+1 < len(X) and X[idx+1] == 'T':
            X = X[:idx] + X[idx+2:]
            idx = max(-1, idx-2)
    idx += 1

print(len(X))

Fixed submission:
X = input()

s, t = 0, len(X)//2
cnt = 0
used = 0
for x in X:
    if x == 'S':
        s += 1
        if t-used > 0:
            cnt += 1
            used += 1
    else:
        used = max(0, used-1)
        t -= 1

print(len(X)-cnt*2)
Buggy python submission (verdict: Runtime Error):
class UnionFind:
  par = None
  
  def __init__(self, n):
    self.par = [0] * n
    
  def root(self, x):
    if(self.par[x] == 0):
      return x
    else:
      self.par[x] = self.root(self.par[x])
      return self.root(self.par[x])
  
  def unite(self, x, y):
    if(self.root(x) != self.root(y)):
      self.par[self.root(x)] = self.root(y)
      
  def same(self, x, y):
    return self.root(x) == self.root(y)
  
N, M = list(map(int, input().split()))
UF = UnionFind(N)
for i in range(M):
  print(UF.par)
  A, B = list(map(int, input().split()))
  UF.unite(A - 1, B - 1) 
ans = 0
for i in range(N):
  if(UF.par[i] == 0):
    ans += 1
print(UF.par)
print(ans - 1)  


Fixed submission:
class UnionFind:
  par = None
  
  def __init__(self, n):
    self.par = [0] * n
    
  def root(self, x):
    if(self.par[x] == 0):
      return x
    else:
      self.par[x] = self.root(self.par[x])
      return self.root(self.par[x])
  
  def unite(self, x, y):
    if(self.root(x) != self.root(y)):
      self.par[self.root(x)] = self.root(y)
      
  def same(self, x, y):
    return self.root(x) == self.root(y)
  
N, M = list(map(int, input().split()))
UF = UnionFind(N)
for i in range(M):
  A, B = list(map(int, input().split()))
  UF.unite(A - 1, B - 1) 
ans = 0
for i in range(N):
  if(UF.par[i] == 0):
    ans += 1
print(ans - 1)

Buggy python submission (verdict: Runtime Error):
class UnionFind:
  par = None
  
  def __init__(self, N):
    self.par = list(range(N))
    
  def root(self, x):
    if(self.par[x] == x):
      return x
    else:
      self.par[x] = self.root(self.par[x])
      return self.par[x]
  
  def unite(self, x, y):
    if(self.root(x) != self.root(y)):
      self.par[x] = self.root(y)
  
N, M = list(map(int, input().split()))
UF = UnionFind(N)
for i in range(M):
  print(UF.par)
  A, B = list(map(int, input().split()))
  UF.unite(A - 1, B - 1) 
ans = 0
for i in range(N):
  ans += (UF.par[i] == i)
print(UF.par)
print(ans - 1)  

Fixed submission:
class UnionFind:
  par = None
  
  def __init__(self, n):
    self.par = [0] * n
    
  def root(self, x):
    if(self.par[x] == 0):
      return x
    else:
      self.par[x] = self.root(self.par[x])
      return self.root(self.par[x])
  
  def unite(self, x, y):
    if(self.root(x) != self.root(y)):
      self.par[self.root(x)] = self.root(y)
      
  def same(self, x, y):
    return self.root(x) == self.root(y)
  
N, M = list(map(int, input().split()))
UF = UnionFind(N)
for i in range(M):
  A, B = list(map(int, input().split()))
  UF.unite(A - 1, B - 1) 
ans = 0
for i in range(N):
  if(UF.par[i] == 0):
    ans += 1
print(ans - 1)
Buggy python submission (verdict: Runtime Error):
X, K, D = list(map(int, input().split()))
X = abs(X)
if(X >= K * D):
  print(X - K * D)
  return
else:
  q = X // D
  r = X // D
  if((K - q) % 2 == 0):
    print(r)
    return
  else:
    print(abs(r - D))
    return

Fixed submission:
X, K, D = list(map(int, input().split()))
X = abs(X)
if(X >= K * D):
  print(X - K * D)
else:
  q = X // D
  r = X % D
  if((K - q) % 2 == 0):
    print(r)
  else:
    print(abs(r - D))

Buggy python submission (verdict: Runtime Error):
from math import abs
X, K, D = list(map(int, input().split()))
X = abs(X)
if(X >= K * D):
  print(X - K * D)
  return
else:
  q = X // D
  r = X // D
  if((K - q) % 2 == 0):
    print(r)
    return
  else:
    print(abs(r - D))
    return

Fixed submission:
X, K, D = list(map(int, input().split()))
X = abs(X)
if(X >= K * D):
  print(X - K * D)
else:
  q = X // D
  r = X % D
  if((K - q) % 2 == 0):
    print(r)
  else:
    print(abs(r - D))
Buggy python submission (verdict: Runtime Error):
H, W, K, = list(map(int, input().split()))
C = [0] * H
for i in range(H):
  C[i] = input()
  C[i] = [1 if(C[i][j] == "#") else 0 for j in range(W)]
h = 2 ** H
w = 2 ** W
ans = 0
cnt = 0
for i in range(2 ** H):
  w = 2 ** W
  for j in range(2 ** W):
    cnt = 0
    for k in range(H):
      for l in range(W):
        if(bin(h)[k + 3] == "0" and bin(w)[l + 3] == "0"):
          cnt += D[k][l]
    ans += (cnt == K)
    w += 1
  h += 1
print(ans)


Fixed submission:
import copy
H, W, K, = list(map(int, input().split()))
C = [0] * H
for i in range(H):
  C[i] = input()
  C[i] = [1 if(C[i][j] == "#") else 0 for j in range(W)]
h = 2 ** H
w = 2 ** W
ans = 0
for i in range(2 ** H):
  w = 2 ** W
  for j in range(2 ** W):
    D = copy.deepcopy(C)
    for k in range(H):
      for l in range(W):
        if(bin(h)[k + 3] == "1" or bin(w)[l + 3] == "1"):
          D[k][l] = 0
    ans += (sum(map(sum, D)) == K)
    w += 1
  h += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
from math import log2
N = int(input())
a = list(map(int, input().split()))
Maxa = max(a)
J = int(log2(Maxa)) + 1
A = [format(x, 'b').zfill(J) for x in a]
S = [0] * J
for j in range(J):
  for i in range(N):
    S[j] += int(A[i][j])
  S[j] %= 2
  
X = [""] * N
for i in range(N):
  for j in range(J):
    X[i] += str(int((int(A[i][j]) != S[j])))
  print(int(X[i], 2), end = " ")

Fixed submission:
from math import log2
N = int(input())
a = list(map(int, input().split()))
Maxa = max(a)
if(Maxa == 0):
  for i in range(N):
    print(0, end = " ")
else:
  J = int(log2(Maxa)) + 1
  A = [format(x, 'b').zfill(J) for x in a]
  S = [0] * J
  for j in range(J):
    for i in range(N):
      S[j] += int(A[i][j])
    S[j] %= 2

  X = [""] * N
  for i in range(N):
    for j in range(J):
      X[i] += str(int((int(A[i][j]) != S[j])))
    print(int(X[i], 2), end = " ")
Buggy python submission (verdict: Runtime Error):
X, Y, A ,B, C = list(map(int, input().split()))
P = list(map(int, input().split()))
P.sort(reverse = True)
P = P[:X]
Q = list(map(int, input().split()))
Q.sort(reverse = True)
Q = Q[:Y]
R = list(map(int, input().split()))
R.sort(reverse = True)
ans = 0
for i in range(C):
  if(P[-1] < Q[-1]):
    if(P[-1] < R[i]):
      ans += R[i]
      P.pop()
  else:
    if(Q[-1] < R[i]):
      ans += R[i]
      Q.pop()
    else:
      break
ans += sum(P) + sum(Q)
print(ans)

Fixed submission:
X, Y, A ,B, C = list(map(int, input().split()))
P = sorted(list(map(int, input().split())), reverse = True)[:X]
Q = sorted(list(map(int, input().split())), reverse = True)[:Y]
R = sorted(list(map(int, input().split())), reverse = True)
ans = 0
for i in range(C):
  if(len(P) == 0):
    if(len(Q) == 0):
      break
    elif(Q[-1] < R[i]):
      Q.pop()
      ans += R[i]
    else:
      break
  elif(len(Q) == 0):
    if(P[-1] < R[i]):
      P.pop()
      ans += R[i]
    else:
      break
  else:
    if(P[-1] < Q[-1] and P[-1] < R[i]):
      P.pop()
      ans += R[i]
    elif(Q[-1] <= P[-1] and Q[-1] < R[i]):
      Q.pop()
      ans += R[i]
    else:
      break
ans += sum(P) + sum(Q)
print(ans)
Buggy python submission (verdict: Runtime Error):
N, M = list(map(int, input().split()))
AC = [0] * N
WA = [0] * N
for i in range(M):
  p, S = input().split()
  p = int(p)
  if(S == "AC"):
    AC[p-1] = 1
  elif(AC[p-1] == 0):
    WA[p-1] += 1
for i in range(M):
  if(AC[i] == 0):
    WA[i] = 0
print(sum(AC), sum(WA))

Fixed submission:
N, M = list(map(int, input().split()))
AC = [0] * N
WA = [0] * N
for i in range(M):
  p, S = input().split()
  p = int(p)
  if(S == "AC"):
    AC[p-1] = 1
  elif(AC[p-1] == 0):
    WA[p-1] += 1
for i in range(N):
  if(AC[i] == 0):
    WA[i] = 0
print(sum(AC), sum(WA))

Buggy python submission (verdict: Runtime Error):
N, M = list(map(int, input().split()))
AC = [0] * N
WA = [0] * N
for i in range(M):
  p, S = input().split()
  p = int(p)
  if(S == "AC"):
    AC[p-1] = 1
  elif(AC[p] == 0):
    WA[p-1] += 1
print(sum(AC), sum(WA))

Fixed submission:
N, M = list(map(int, input().split()))
AC = [0] * N
WA = [0] * N
for i in range(M):
  p, S = input().split()
  p = int(p)
  if(S == "AC"):
    AC[p-1] = 1
  elif(AC[p-1] == 0):
    WA[p-1] += 1
for i in range(N):
  if(AC[i] == 0):
    WA[i] = 0
print(sum(AC), sum(WA))

Buggy python submission (verdict: Runtime Error):
N, M = list(map(int, input().split()))
AC = [0] * N
WA = [0] * N
for i in range(M):
  p, S = input().split()
  p = int(p)
  if(S == "AC"):
    AC[p] = 1
  elif(AC[p] == 0):
    WA[p] += 1
print(sum(AC), sum(WA))

Fixed submission:
N, M = list(map(int, input().split()))
AC = [0] * N
WA = [0] * N
for i in range(M):
  p, S = input().split()
  p = int(p)
  if(S == "AC"):
    AC[p-1] = 1
  elif(AC[p-1] == 0):
    WA[p-1] += 1
for i in range(N):
  if(AC[i] == 0):
    WA[i] = 0
print(sum(AC), sum(WA))
Buggy python submission (verdict: Runtime Error):
from math import log2
N = int(input())
ans = 0
for i in range(int(log2(N))):
  ans += (N // 5 ** (i+1)) // 2
if(N % 2 == 0):
  print(ans)
else:
  print(0)

Fixed submission:
from math import log2
N = int(input())
ans = 0
if(N % 2 == 0 and N != 0):
  for i in range(int(log2(N))):
    ans += (N // 5 ** (i+1)) // 2
  print(ans)
else:
  print(0)
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = input()
ans = 0
for i in range(10):
  l = 0
  while(True):
    if(i == int(S[l])):
      for j in range(10):
        m = l + 1
        while(True):
          if(j == int(S[m])):
            for k in range(10):
              for n in range(m+1, N):
                if(k == int(S[n])):
                  ans += 1
                  break
          m += 1
          if(m >= N - 1 or j == int(S[m - 1])):
             break
    l += 1
    if(l >= N - 2 or i == int(S[l - 1])):
      break
print(ans)

Fixed submission:
M1, D1 = input().split()
M2, D2 = input().split()
if(M1 != M2):print(1)
else: print(0)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()
ans = 0
for i in range(10):
  l = 0
  while(True):
    if(i == int(S[l])):
      for j in range(10):
        m = l + 1
        while(True):
          if(j == int(S[m])):
            for k in range(10):
              for n in range(m+1, N):
                if(k == int(S[n])):
                  ans += 1
                  break
          m += 1
          if(m >= N - 1 or j == int(S[m - 1])):
             break
    l += 1
    if(l >= N - 2 or i == int(S[l - 1])):
      break
print(ans)

Fixed submission:
N = int(input())
S = input()
ans = 0
for i in range(10):
  l = 0
  while(True):
    if(i == int(S[l])):
      for j in range(10):
        m = l + 1
        while(True):
          if(j == int(S[m])):
            for k in range(10):
              for n in range(m+1, N):
                if(k == int(S[n])):
                  ans += 1
                  break
          m += 1
          if(m >= N - 1 or j == int(S[m - 1])):
             break
    l += 1
    if(l >= N - 2 or i == int(S[l - 1])):
      break
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()
ans = 0
for i in range(10):
  l = 0
  while(True):
    if(i == int(S[l])):
      for j in range(10):
        m = l + 1
        while(True):
          if(j == int(S[m])):
            for k in range(10):
              for n in range(m+1, N):
                if(k == int(S[n])):
                  ans += 1
                  break
          m += 1
          if(m >= N - 1 or j == int(S[m - 1])):
             break
    l += 1
    if(l >= N - 2 or i == int(S[l - 1])):
      break
print(ans)

Fixed submission:
N = int(input())
S = input()
ans = 0
for i in range(10):
  l = 0
  while(True):
    if(i == int(S[l])):
      for j in range(10):
        m = l + 1
        while(True):
          if(j == int(S[m])):
            for k in range(10):
              for n in range(m+1, N):
                if(k == int(S[n])):
                  ans += 1
                  break
          m += 1
          if(m >= N - 1 or j == int(S[m - 1])):
             break
    l += 1
    if(l >= N - 2 or i == int(S[l - 1])):
      break
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
for i in range(int(N ** 0.5),0,-1):
  if(N % i == 0):
    print(i - 1 + N // i - 1): 
    break

Fixed submission:
N = int(input())
for i in range(int(N ** 0.5),0,-1):
  if(N % i == 0):
    print(i - 1 + N // i - 1)
    break
Buggy python submission (verdict: Runtime Error):
S = input()
if(S == "Sunny"):
  print("Cloudy")
if(S = "Cloudy"):
  print("Rainy")
if(S == "Rainy"):
  print("Sunny")

Fixed submission:
S = input()
if(S == "Sunny"):
  print("Cloudy")
if(S == "Cloudy"):
  print("Rainy")
if(S == "Rainy"):
  print("Sunny")
Buggy python submission (verdict: Runtime Error):
import heapq
N, M = list(map(int,input()))
h = []
for x in input().split():
  heappush(h, x)
print(heappop(h))
print(heappop(h))

Fixed submission:
import heapq
N, M = list(map(int,input().split()))
h = []
for x in input().split():
  heapq.heappush(h, -int(x))
for i in range(M):
  x = -heapq.heappop(h)
  x //= 2
  heapq.heappush(h,-x)
print(-sum(h))

Buggy python submission (verdict: Time Limit Exceeded):
N ,M = list(map(int,input().split()))
A = [int(x) for x in input().split()]
for i in range(M):
  A[A.index(max(A))] //= 2
print(sum(A))

Fixed submission:
import heapq
N, M = list(map(int,input().split()))
h = []
for x in input().split():
  heapq.heappush(h, -int(x))
for i in range(M):
  x = -heapq.heappop(h)
  x //= 2
  heapq.heappush(h,-x)
print(-sum(h))
Buggy python submission (verdict: Runtime Error):
from math import gcd 
N, X = list(map(int, input().split()))
x = list(map(int, input().split()))
ans = gcd(abs(x[0] - X), abs(x[1] - X))
for i in range(2, N):
  ans = gcd(ans, abs(x[i] - X)
print(ans)

Fixed submission:
from math import gcd 
N, X = list(map(int, input().split()))
x = list(map(int, input().split()))
if(N == 1): print(abs(x[0] - X))
else:
  ans = gcd(abs(x[0] - X), abs(x[1] - X))
  for i in range(2, N):
  	ans = gcd(ans, abs(x[i] - X))
    
  print(ans)

Buggy python submission (verdict: Runtime Error):
from math import gcd 
N, X = list(map(int, input().split()))
x = list(map(int, input().split()))
ans = gcd(abs(x[0] - X), abs(x[1] - X))
for i in range(2, N):
  ans = gcd(ans, X[i])
print(ans)

Fixed submission:
from math import gcd 
N, X = list(map(int, input().split()))
x = list(map(int, input().split()))
if(N == 1): print(abs(x[0] - X))
else:
  ans = gcd(abs(x[0] - X), abs(x[1] - X))
  for i in range(2, N):
  	ans = gcd(ans, abs(x[i] - X))
    
  print(ans)
Buggy python submission (verdict: Runtime Error):
import queue
H , W = list(map(int, input().split()))
S = [input() for _ in range(H)]
Sum = 0
for i in range(H):
  for j in range(W):
    Sum += (S[i][j] == '#')
start = [1, 1, 1]
visited = [[0] * W for _ in range(H)]
visited[0][0] = 1
Q = queue.Queue()
Q.put(start)
now = start
while(now[:2] != [H, W] and not Q.empty()):
  now = Q.get()
  for i in range(2):
    for j in range(2):
      h = now[0] + ((-1) ** i + (-1) ** j) // 2
      w = now[1] + ((-1) ** i - (-1) ** j) // 2
      if(1 <= h and h <= H and 1 <= w and w <= W and visited[h - 1][w - 1] == 0 and S[h - 1][w - 1] == '.'):
        visited[h - 1][w - 1] = 1
        Q.put([h, w, now[2] + 1])
if(now[:2] == [H, W]):
  print(H * W - Sum - now[2])
else:
  print(-1)
      h = now[0] + (-1) ** i
      w = now[1] + (-1) ** j
      if(1 <= h and h <= H and 1 <= w and w <= W and visited[h - 1][w - 1] == 0):
        visited[h - 1][w - 1] = 1
        Q.put([h, w, now[2] + 1])
if(now[:2] == [H, W]):
  print(H * W - Sum - now[2])
else:
  print(-1)

Fixed submission:
import queue
H , W = list(map(int, input().split()))
S = [input() for _ in range(H)]
Sum = 0
for i in range(H):
  for j in range(W):
    Sum += (S[i][j] == '#')
start = [1, 1, 1]
visited = [[0] * W for _ in range(H)]
visited[0][0] = 1
Q = queue.Queue()
Q.put(start)
now = start
while(now[:2] != [H, W] and not Q.empty()):
  now = Q.get()
  for i in range(2):
    for j in range(2):
      h = now[0] + ((-1) ** i + (-1) ** j) // 2
      w = now[1] + ((-1) ** i - (-1) ** j) // 2
      if(1 <= h and h <= H and 1 <= w and w <= W and visited[h - 1][w - 1] == 0 and S[h - 1][w - 1] == '.'):
        visited[h - 1][w - 1] = 1
        Q.put([h, w, now[2] + 1])
if(now[:2] == [H, W]):
  print(H * W - Sum - now[2])
else:
  print(-1)
Buggy python submission (verdict: Runtime Error):
S = input()
num = 0
bits = format(num , 'b').zfill(len(S) - 1)
ans = 0
for i in range(2 ** (len(S) - 1)):
  index = 0
  for j in range(len(S) - 1):
    if(bits[i] == 1):
      ans += int(S[:i])
      index = i + 1
    ans += int(S[index:])
  num += 1
  bits = format(num , 2).zfill(len(S) - 1)
print(ans)

Fixed submission:
S = input()
num = 0
bits = format(num , 'b').zfill(len(S) - 1)
ans = 0
for i in range(2 ** (len(S) - 1)):
  index = 0
  for j in range(len(S) - 1):
    if(bits[j] == "1"):
      ans += int(S[index:j + 1])
      index = j + 1
  ans += int(S[index:])
  num += 1
  bits = format(num , 'b').zfill(len(S) - 1)
print(ans)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
from sys import stdin
import numpy as np
input = stdin.readline
N = int(input())
A = list(map(int,input().split()))
np_A = np.array(A)
ans = np_A[0]

2
for i in range(1, N, 1):
    ans = ans*np_A[i]
    if ans > 10**18:
        flag = False
        break


if flag == False:
    print(-1)

else:
    print(ans)


Fixed submission:
# -*- coding: utf-8 -*-
from sys import stdin
from decimal import *
import numpy as np
input = stdin.readline
N = int(input())
A = list(map(Decimal,input().split()))
np_A = np.array(A)
ans = np_A[0]

zero_flag = False
if 0 in A:
    zero_flag = True

flag = True

for i in range(1, N, 1):
    ans = Decimal(ans)*Decimal(np_A[i])
    #print(ans)
    if ans > 10**18:
        flag = False
        break


if zero_flag == True:
    print(0)


else:
    if flag == False:
        print(-1)

    else:
        print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
from sys import stdin
input = stdin.readline
N = int(input())
A = list(map(int,input().split()))
ans = A[0]


for i in range(1, N, 1):
    ans = ans*A[i]



if ans > 10**18:
    print(-1)

else:
    print(ans)



Fixed submission:
# -*- coding: utf-8 -*-
from sys import stdin
from decimal import *
import numpy as np
input = stdin.readline
N = int(input())
A = list(map(Decimal,input().split()))
np_A = np.array(A)
ans = np_A[0]

zero_flag = False
if 0 in A:
    zero_flag = True

flag = True

for i in range(1, N, 1):
    ans = Decimal(ans)*Decimal(np_A[i])
    #print(ans)
    if ans > 10**18:
        flag = False
        break


if zero_flag == True:
    print(0)


else:
    if flag == False:
        print(-1)

    else:
        print(ans)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
from decimal import *

a, b, c = map(int, input().split())

a = Decimal(a)
b = Decimal(b)
c = Decimal(c)

if a**(1/2) + b**(1/2) < c**(1/2):
    print("Yes")

else:
    print("No")

Fixed submission:
# -*- coding: utf-8 -*-

K=[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]

a = int(input())

num = a-1
print(K[num])

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

H, W = map(int, input().split())

if H%2 == 0:
    ans = H//2 * W

else:
    ans = ((H//2)+1)*W - (W//2)

print(ans)

Fixed submission:
# -*- coding: utf-8 -*-

K=[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]

a = int(input())

num = a-1
print(K[num])

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

K=[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]

a = input()

num = a-1
print(K[num])

Fixed submission:
# -*- coding: utf-8 -*-

K=[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]

a = int(input())

num = a-1
print(K[num])
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(x) for x in input().split()]

MOD = 10**9 + 7

result = 0
for i in range(N):
    for j in range(i+1, N):
        add_target = (A[i] * A[j]) % MOD
        result = (result + add_target) % MOD

print(result)


Fixed submission:
from itertools import accumulate

N = int(input())
A = list([int(x) for x in input().split()])
check = list(accumulate(A))

MOD = 10**9 + 7

result = 0
for i in range(N):
    result += (A[i] * (check[N-1] - check[i]))
    result %= MOD

print(result)