Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p02642 (python)

Fixed submission:
import collections

n = int(input())
a = list(map(int, input().split()))
a = sorted(a)
c = collections.Counter(a)
data = sorted(list(set(a)))
max_ = max(a)+1
prime_bool = [True]*max_
prime_bool[0] = False

for i in range(len(data)):
  p = data[i]
  if prime_bool[p]:
    #print(p)
    k = 2
    while k*p < max_:
      prime_bool[k*p] = False
      k += 1

count = 0
for i in range(len(prime_bool)):
  if prime_bool[i]:
    if c[i] == 1:
      count += 1
print(count)
#print(prime_bool)

Buggy submission (verdict: Runtime Error):
import collections

n = int(input())
a = list(map(int, input().split()))
a = sorted(a)
c = collections.Counter(a)
data = sorted(list(set(a)))
max_ = max(a)+1
prime_bool = [True]*max_
prime_bool[0] = False

for i in range(len(data)):
  p = data[i]
  if prime_bool[p]:
    #print(p)
    k = 2
    while k*p <= max_:
      prime_bool[k*p] = False
      k += 1

count = 0
for i in range(len(prime_bool)):
  if prime_bool[i]:
    if c[i] == 1:
      count += 1
print(count)
#print(prime_bool)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
c = {}
#for i in range(n):
 # c[a[i]] = c.get(a[i], 0) + 1

prime_bool = [True]*(max(a)+1)
prime_bool[0] = False
count = 0
for p in sorted(a):
  if prime_bool[p]:
    if c[p] == 1:
      count += 1
    #print(p)
    for j in range(2*p, max(a)+1, p):
      prime_bool[j] = False

print(count)

Buggy submission (verdict: Runtime Error):

n = int(input())
a = list(map(int, input().split()))
d = {}
for i in range(n):
  d[a[i]] = d.get(a[i], 0) + 1
data = sorted(list(set(a)))
prime_bool = [True]*(max(a)+1)
prime_bool[0] = False
count = 0
for i in range(len(data)):
  p = data[i]
  if prime_bool[p]:
    if c[p] == 1:
      count += 1
    #print(p)
    for j in range(2*p, max(a)+1, p):
      prime_bool[j] = False

print(count)

Buggy submission (verdict: Runtime Error):


n = int(input())
a = list(map(int, input().split()))
d = {}
for i in range(n):
  d.get(a[i], 0) += 1
data = sorted(list(set(a)))
prime_bool = [True]*(max(a)+1)
prime_bool[0] = False
count = 0
for i in range(len(data)):
  p = data[i]
  if prime_bool[p]:
    if c[p] == 1:
      count += 1
    #print(p)
    for j in range(2*p, max(a)+1, p):
      prime_bool[j] = False

print(count)
Problem p02683 (python)

Fixed submission:
import itertools
n,m,x = map(int, input().split())
book = []
for i in range(n):
  b = list(map(int, input().split()))
  book.append(b)
book = sorted(book, key=lambda x:x[0])
junretu = itertools.permutations(range(n))
max_ = 2**n
min_nedan = 10**9
for j in range(max_):
  bit = format(j, "0"+str(n)+"b")
  count_list = [0]*m
  nedan = 0
  for b in range(n):
    if bit[b] == "1":
      naiyou = book[b]
      nedan += naiyou[0]
      for i in range(1, m+1):
        count_list[i-1] += naiyou[i]
  if min(count_list)>=x:
    if nedan < min_nedan:
      min_nedan = nedan
if min_nedan == 10**9:
  print(-1)
else:
  print(min_nedan)

Buggy submission (verdict: Runtime Error):
import itertools
n,m,x = map(int, input().split())
book = []
for i in range(n):
  b = list(map(int, input().split()))
  book.append(b)
book = sorted(book, key=lambda x:x[0])
junretu = itertools.permutations(range(n))
max_ = 2**n
min_nedan = 10**9
for j in range(max_):
  bit = format(j, "0"+str(n)+"b")
  count_list = [0]*m
  nedan = 0
  for b in range(n):
    if bit[b] == "1":
      naiyou = book[b]
      nedan += naiyou[0]
      for i in range(1, m+1):
        count_list[i-1] += naiyou[i]
  if min(count_list)>=x:
    if nedan a< min_nedan:
      min_nedan = nedan
if min_nedan == 10**9:
  print(-1)
else:
  print(min_nedan)
Problem p02721 (python)

Fixed submission:
n, k, c = map(int, input().split())
s = input()
s2 = s
s += "x"*c
s2 = "x"*c+s2
k2 = k
kans = k
left = []
i = 0
while i < n:
  if s[i] == "o":
    left.append(i+1)
    i += c
  i += 1

right = []
i = len(s2)-1
while i >= c:
  if k2 == 0:
    break
  if s2[i] == "o":
    right.append(i+1-c)
    k2 -= 1
    i -= c
  i -= 1
if len(left) == kans:
  ans = sorted(list(set(left) & set(right)))
  for i in ans:
    print(i)
else:
  exit()

Buggy submission (verdict: Runtime Error):
def muri(k, c, s):
  if k > s.count("o"):
    return True
  for j in range(len(s)):
    if s[j] == "o":
      return muri(k-1, c, s[j+c+1:])
  return False

n, k, c = map(int, input().split())
s = input()
s += "x"*c

for i in range(len(s)):
  if s[i] == "o":
    if muri(k, c, s[:i]+"x"+s[i+1:]):
      print(i+1)

Buggy submission (verdict: Runtime Error):
def muri(k, c, s):
  for j in range(len(s)):
    if s[j] == "o":
      return muri(k-1, c, s[j+c+1:])
    elif j == len(s) -1 and k > 0:
      return True
  return False

n, k, c = map(int, input().split())
s = input()
s += "x"*c

for i in range(len(s)):
  if s[i] == "o":
    if muri(k, c, s[:i]+"x"+s[i+1:]):
      print(i+1)
Problem p02730 (python)

Fixed submission:
s = input()
n = len(s)
mae = (n-1)//2
usiro = (n+3)//2

for i in range(mae):
  if s[i] != s[mae-1-i] or s[i] != s[usiro-1+i]:
    print("No")
    exit()
    
for i in range(usiro-1, n):
  if s[i] != s[n-1+usiro-1-i]:
    print("No")
    exit()
print("Yes")

Buggy submission (verdict: Runtime Error):
s = input()
n = len(s)
mae = (n-1)//2
usiro = (n+3)//2

for i in range(mae):
  if s[i] != s[mae-1-i]:
    print("No")
    exit()
    
for i in range(usiro-1, n):
  if s[i] != s[n-1+usiro-i]:
    print("No")
    exit()
print("Yes")
Problem p02760 (python)

Fixed submission:
mat = [[False]*3 for i in range(3)]
a_mat = []
for i in range(3):
  a_list = list(map(int, input().split()))
  a_mat.append(a_list)
n = int(input())
for i in range(n):
  b = int(input())
  for x in range(3):
    for y in range(3):
      if a_mat[x][y] == b:
        mat[x][y] = True

if mat[0][0] and mat[0][1] and mat[0][2] \
or mat[1][0] and mat[1][1] and mat[1][2] \
or mat[2][0] and mat[2][1] and mat[2][2] \
or mat[0][0] and mat[1][0] and mat[2][0] \
or mat[0][1] and mat[1][1] and mat[2][1] \
or mat[0][2] and mat[1][2] and mat[2][2] \
or mat[0][0] and mat[1][1] and mat[2][2] \
or mat[0][2] and mat[1][1] and mat[2][0]:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
mat = [[False]*3 for i in range(3)]
a_mat = []
for i in range(3):
  a_list = list(map(int, input().split()))
  a_mat.append(a_list)
n = int(input())
for i in range(n):
  b = int(input())
  for x in range(3):
    for y in range(3):
      if a_mat[x][y] == b:
        mat[x][y] = True

if mat[0][0] and mat[0][1] and mat[0][2] ¥
or mat[1][0] and mat[1][1] and mat[1][2] ¥
or mat[2][0] and mat[2][1] and mat[2][2] ¥
or mat[0][0] and mat[1][0] and mat[2][0] ¥
or mat[0][1] and mat[1][1] and mat[2][1] ¥
or mat[0][2] and mat[1][2] and mat[2][2] ¥
or mat[0][0] and mat[1][1] and mat[2][2] ¥
or mat[0][2] and mat[1][1] and mat[2][0]:
  print("Yes")
else:
  print("No")
Problem p02761 (python)

Fixed submission:
n,m=map(int,input().split())
a = [-1]*(n+1)

ans = 0
for i in range(m):
  s,c=map(int,input().split())
  if a[s] == -1 or a[s] == c:
    a[s] = c
  else:
    print(-1)
    exit()
if n == 1:
  print(max(0, a[1]))
  exit()
if a[1] == 0:
  if n>1:
    print(-1)
    exit()
  else:
    print(ans)
else:
  ans = max(1, a[1])
  for i in range(2, n+1):
    ans = ans*10+max(0, a[i])
print(ans)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
a = [-1]*(n+1)

ans = 0
for i in range(m):
  s,c=map(int,input().split())
  if a[s] == -1 or a[s] == c:
    a[s] = c
  else:
    print(-1)
    exit()
if n == 1:
  print(max(0, a[i]))
  exit()
if a[1] == 0:
  if n>1:
    print(-1)
    exit()
  else:
    print(ans)
else:
  ans = max(1, a[1])
  for i in range(2, n+1):
    ans = ans*10+max(0, a[i])
print(ans)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
a = [-1]*(n+1)

ans = 0
for i in range(m):
  s,c=map(int,input().split())
  if a[s] == -1 or a[s] == c:
    a[s] = c
  else:
    print(-1)
    exit()

if a[1] == 0:
  if n>1:
    print(-1)
    exit()
  else:
    print(ans)
else:
  ans = max(1, a[1])
  for i in range(2, n+1)
    ans = ans*10+max(0, a[i])
print(ans)
Problem p02765 (python)

Fixed submission:
import math
def I():
  return input()
def II():
  return int(input())
def MII():
  return map(int, input().split())
def LMII():
  return list(map(int, input().split()))

n, r = MII()
print(r+100*max((10-n), 0))

Buggy submission (verdict: Runtime Error):
import math
I() = input()
II() = int(input())
MII() = map(int, input().split())
LMII() = list(map(int, input().split()))

n, r = MII()
print(r+100*max((10-k), 0))
Problem p02768 (python)

Fixed submission:
import math
MOD = 10**9+7
def modpow(a, n, p):
  if n == 1:
    return a % p 
  elif n % 2 == 1:
    return a * modpow(a, n-1, p) % p
  else:
    return modpow(a, n//2, p) **2 % p

def I():
  return input()
def II():
  return int(input())
def MII():
  return map(int, input().split())
def LMII():
  return list(map(int, input().split()))
n,a,b = MII()
fact_a = 1
fact_n_a = 1
fact_b = 1
fact_n_b = 1
for i in range(a):
    fact_a = fact_a * (i+1) % MOD
    fact_n_a = fact_n_a * (n-a+1+i) % MOD
cmb_a = fact_n_a * modpow(fact_a, MOD-2, MOD) % MOD
for i in range(b):
    fact_b = fact_b * (i+1) % MOD
    fact_n_b = fact_n_b * (n-b+1+i) % MOD
cmb_b = fact_n_b * modpow(fact_b, MOD-2, MOD) % MOD

print((modpow(2, n, MOD)-1-cmb_a-cmb_b)%MOD)

Buggy submission (verdict: Runtime Error):
import math
import scipy
def I():
  return input()
def II():
  return int(input())
def MII():
  return map(int, input().split())
def LMII():
  return list(map(int, input().split()))
n,a,b = MII()
print(2**n-1-scipy.misc.comb(n,a)-scipy.misc.comb(n,b))
Problem p02780 (python)

Fixed submission:
n,k = map(int,input().split())
a = list(map(int,input().split()))
e = [0]*n
b = [0]*(n-(k-1))
for i in range(n):
  e[i] = (1+a[i])/2

b[0] = sum(e[0:k])
for i in range(1, len(b)):
  b[i] = e[i+k-1] + b[i-1] - e[i-1]
print(max(b))

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
a = list(map(int,input().split()))
e = [0]*n
b = [0]*n-(k-1)
for i in range(n):
  e[i] = (1+a[i])/2

b[0] = sum(e[0:k])
for i in range(1, len(b)):
  b[i] = e[i] + b[i-1] - e[i-1]
print(max(b))
Problem p02802 (python)

Fixed submission:
n,m = map(int, input().split())
ac_list = [False]*(n+1)
pena_count = [0]*(n+1)
for i in range(m):
  p, s = input().split()
  p = int(p)
  if not ac_list[p]:
    if s == "AC":
      ac_list[p] = True
    else:
      pena_count[p] += 1
ac_count = 0
pena_c = 0
for i in range(1, n+1):
  if ac_list[i]:
    ac_count += 1
    pena_c += pena_count[i]
print(ac_count, pena_c)

Buggy submission (verdict: Runtime Error):
n,m = map(int, input().split())
ac_list = [False]*(n+1)
pena_count = [0]*(n+1)
for i in range(m):
  p, s = map(int, input().split())
  if not ac_list[p]:
    if s == "AC":
      ac_list[p] = True
    else:
      pena_count[p] += 1
ac_count = 0
pena_c = 0
for i in range(1, n+1):
  if ac_list[i]:
    ac_count += 1
    pena_c += pena_count[i]
print(ac_count, pena_c)
Problem p02813 (python)

Fixed submission:
n = int(input())
p = tuple(map(int, input().split()))
q = tuple(map(int, input().split()))

import itertools
a = list(itertools.permutations([i for i in range(1, n+1)]))
print(abs(a.index(p)-a.index(q)))

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

import itertools
a = list(itertools.permutations([i for i in range(1, n+1)]))
print(abs(a.index(p)-a.index(q)))
Problem p02814 (python)

Fixed submission:
import fractions
n, m = map(int, input().split())
a = list(map(int, input().split()))
for i in range(n):
  a[i] = a[i] //2
def count_2(k):
  c = 0
  while k % 2 == 0:
    k = k // 2
    c+=1
  return c
count = count_2(a[0])
for i in range(n):
  if count != count_2(a[i]):
    print(0)
    exit()
ans = a[0]
for i in range(1, n):
    ans = ans * a[i] // fractions.gcd(ans, a[i])
print((m // ans +1)//2)

Buggy submission (verdict: Runtime Error):
import fractions
n, m = map(int, input().split())
a = list(map(int, input().split()))
ans = a[0]
for i in range(1, N):
    ans = ans * a[i] // fractions.gcd(ans, a[i])
print((m // (ans//2)+1)//2)
Problem p02817 (python)

Fixed submission:
s,t = input().split()
print(t+s)

Buggy submission (verdict: Runtime Error):
s，t = input().split()
print(t+s)
Problem p02838 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
c1_list = [0]*60
for i in range(n):
  b = format(a[i], '060b')

  for j in range(len(b)):
    if b[j] == "1":
      c1_list[j] += 1
count = 0
for i in range(60):
  count = (count + c1_list[i]*(n-c1_list[i])*2**(59-i)) % 1000000007
print(count)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
c1_list = [0]*n
for i in range(n):
  b = format(a[i], '060b')
  for j in b:
    if j == "1":
      c1_list[j] += 1
count = 0
for i in range(n):
  count = (count + c1_list[i]*(n-c1_list[i])*2**(60-i)) % 1000000007
print(count)
Problem p02850 (python)

Fixed submission:
n = int(input())
g = [[] for i in range(n+1)]
d = {}
l = [-1] * (n-1)
max_idx = 0
for i in range(n-1):
  u,v = map(int, input().split())
  d[(u,v)] = i
  d[(v,u)] = i
  g[u].append((u,v))
  g[v].append((v,u))
  if len(g[max_idx]) < len(g[u]):
    max_idx = u
  if len(g[max_idx]) < len(g[v]):
    max_idx = v
m = len(g[max_idx])
stack = []
count = m
while len(g[1]) > 0:
  u2, v2 = g[1].pop()
  l[d[(u2, v2)]] = count
  count -= 1
  stack.append((u2, v2))

while len(stack) > 0:
  u, v = stack.pop()
  #print(u,v)
  if len(g[v]) > 0:
    count = m
    while len(g[v]) > 0:
      u2, v2 = g[v].pop()
      if count == l[d[(u, v)]]:
        count -= 1
      if l[d[(u2, v2)]] == -1:
        l[d[(u2, v2)]] = count
        count -= 1
        stack.append((u2, v2))
print(m)
for i in range(n-1):
  print(l[i])

Buggy submission (verdict: Runtime Error):
n = int(input())
g = [[] for i in range(n+1)]
d = {}
l = [-1] * (n-1)
max_idx = 0
for i in range(n-1):
  u,v = map(int, input().split())
  d[(u,v)] = i
  g[u].append((u,v))
  g[v].append((v,u))
  if len(g[max_idx]) < len(g[u]):
    max_idx = u
  if len(g[max_idx]) < len(g[v]):
    max_idx = v
m = len(g[max_idx])
stack = []
while len(g[1]) > 0:
  stack.append(g[1].pop())
while len(stack) > 0:
  u, v = stack.pop()
  if len(g[v]) > 0:
    count = m
    while len(g[v]) > 0:
      u2, v2 = g[v].pop()
      if count == l[d[(u, v)]]:
        count -= 1
      l[d[(u2, v2)]] = count
      count -= 1
      stack.append((u2, v2))
print(m)
for i in range(n-1):
  print(l[i])
Problem p02861 (python)

Fixed submission:
n = int(input())
a = []
for i in range(n):
  x,y=map(int,input().split())
  a.append((x,y))
s = 0
import itertools
import math
import fractions
for l in itertools.permutations(range(n)):

  for i in range(n-1):
    s += math.sqrt((a[l[i]][0]-a[l[i+1]][0])**2 + (a[l[i]][1]-a[l[i+1]][1])**2)
print(s/math.factorial(n))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = []
for i in range(n):
  x,y=map(int,input().split())
  a.append((x,y))
s = 0
import itertools
import math
for l in itertools.permutations(range(n)):
  for i in l:
    s += math.sqrt((a[l[i]][0]-a[l[i+1]][0])**2 + (a[l[i]][1]-a[l[i+1]][1])**2)
print(s/n)
Problem p02898 (python)

Fixed submission:
n, k = map(int, input().split())
a = list(map(int, input().split()))
print(len([e for e in a if e >= k]))

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
a = list(map(int, input().split()))
print(a.count(a >= k))
Problem p02899 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
b = [i+1 for i in range(n)]
c = list(zip(a, b))
c = sorted(c)
s = " ".join(map(lambda x: str(x[1]), c))
print(s)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
b = [i+1 for i in range(n)]
c = list(zip(a, b))
c = sorted(c)
s = " ".join(map(lambda x: x[1], c))
print(s)
Problem p02946 (python)

Fixed submission:
k,x=map(int, input().split())
print(" ".join([str(i) for i in range(x-(k-1), x+(k-1)+1)]))

Buggy submission (verdict: Runtime Error):
k,x=map(int, input().split())
print(" ".join([i for i in range(x-(k-1), x+(k-1)+1)]))
Problem p02957 (python)

Fixed submission:
a,b=map(int,input().split())
if ((a+b)/2).is_integer():
  print((a+b)//2)
else:
  print("IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
if (a+b)/2.is_integer():
  print((a+b)//2)
else:
  print("IMPOSSIBLE")
Problem p02983 (python)

Fixed submission:
l,r = map(int, input().split())
if r-l >= 2019:
  print(0)
  exit()
else:
  m = 2018
  for i in range(l, r):
    for j in range(i+1, r+1):
      if i*j % 2019 < m:
        m = i*j % 2019

print(m)

Buggy submission (verdict: Runtime Error):
l,r = map(int, input().split())
if r-l >= 2019:
  print(0)
else:
  m = 2018
  for i in range(l, r+1):
    for j in range(i+1, r+1):
      if i*j % 2019 < m:
        m = i*j % 2019

print(m)

Buggy submission (verdict: Runtime Error):
l,r = map(int, input().split())
if r-l >= 2019:
  print(0)
else:
  m = 2018
  for i in range(l, r):
    for j in range(i+1, r+1):
      if i*j % 2019 < m:
        m = i*j % 2019

print(m)
Problem p02991 (python)

Fixed submission:
from collections import deque
def bfs():
  while len(q) > 0:
    p = q.popleft()
    for e in g[p]:
      if d[e] < 0:
        q.append(e)
        d[e] = d[p] + 1
        f[e] = p
      elif d[e] > d[p] + 1:
        d[e] = d[p] + 1
        f[e] = p       

  
  
n, m = map(int, input().split())
g = [[] for i in range(3 * (n+1))]
for i in range(m):
  u, v = map(int, input().split())
  g[3*u].append(3*v+1)
  g[3*u+1].append(3*v+2)
  g[3*u+2].append(3*v)

s, t = map(int, input().split())

d = [-1] * (3 * (n+1))
f = [-1] * (3 * (n+1))
d[3*s] = 0
f[3*s] = 0
q = deque([3*s])
bfs()
c = 0
if f[3*t] == -1:
  print(-1)
  exit()

t = 3 * t
while f[t] > 0:
  c += 1
  t = f[t]
  
print(c // 3)

Buggy submission (verdict: Runtime Error):
def dfs():
  while len(q) > 0:
  	p = q.pop()
  	for e in g[p]:
      if d[e] < 0 or d[e] > d[p] + 1:
        d[e] = d[p] + 1
        q.append(e)
  
  
n, m = map(int, input().split())
g = [[] for i in range(3 * (n+1))]
for i in range(m):
  u, v = map(int, input().split())
  g[3*u].append(3*v+1)
  g[3*u+1].append(3*v+2)
  g[3*u+2].append(3*v)

s, t = map(int, input().split())

d = [-1] * (3 * (n+1))
d[3*s] = 0

q = [3*s]
dfs()
print(d[3*t])
Problem p03005 (python)

Fixed submission:
n, k = map(int, input().split())
if k == 1:
  print(0)
else:
  print(n-k)

Buggy submission (verdict: Runtime Error):
n, k = map(iht, input().split())
if k == 1:
  print(0)
else:
  print(n-k)
Problem p03006 (python)

Fixed submission:
n = int(input())
point_list = []
for i in range(n):
  x, y = map(int, input().split())
  point_list.append((x, y))

sabun_dict = {}

if n == 1:
  print(1)
  exit()

for i in range(n):
  for j in range(n):
    x = point_list[i][0] - point_list[j][0]
    y = point_list[i][1] - point_list[j][1]
    if x == 0 and y == 0:
      continue
    if (x, y) in sabun_dict:
      sabun_dict[(x, y)] = sabun_dict[(x, y)] + 1
    else:
      sabun_dict[(x, y)] = 1

max_v = max(sabun_dict.values())

print(n - max_v)

Buggy submission (verdict: Runtime Error):
n = int(input())
point_list = []
for i in range(n):
  x, y = map(int, input().split())
  point_list.append((x, y))

sabun_dict = {}

for i in range(1, n):
  for j in range(i):
    x = point_list[i][0] - point_list[j][0]
    y = point_list[i][1] - point_list[j][1]
    if (x, y) in sabun_dict:
      sabun_dict[(x, y)] = sabun_dict[(x, y)] + 1
    else:
      sabun_dict[(x, y)] = 1

max_v = max(sabun_dict.values())

print(n - max_v)
Problem p03035 (python)

Fixed submission:
a,b=map(int,input().split())
print(b//(13//min(a+1, 14)+1)*min(1, a//6))

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
print(b//(12//min(a, 13)+1)*min(1, a//6))

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
print(b//(12//min(a, 13)+1)*(min(1, a//6))

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
print(max(b//(7//min(a-5, 8)+1), 0))
Problem p03044 (python)

Fixed submission:
n = int(input())
tree = [[] for i in range(n)]
d_list = [0]*n

stack = []
for i in range(n-1):
  u,v,w = map(int,input().split())
  tree[u-1].append((u-1,v-1,w))
  tree[v-1].append((v-1,u-1,w))
while len(tree[0]) > 0:
  e = tree[0].pop()
  stack.append(e)
#print(stack)
while len(stack) > 0:
  u,v, w = stack.pop()
  if d_list[v] == 0:
    d_list[v] = d_list[u]+w
  while len(tree[v]) > 0:
    e = tree[v].pop()
    stack.append(e)
  #print(stack)
for v in d_list:
  if v % 2 == 0:
    print(0)
  else:
    print(1)

Buggy submission (verdict: Runtime Error):
n = int(input())
tree = [[] for i in range(n-1)]
d_list = [0]*n

stack = []
for i in range(n-1):
  u,v,w = map(int,input().split())
  tree[u-1].append((u-1,v-1,w))
while len(tree[0]) > 0:
  stack.append(tree[0].pop())
while len(stack) > 0:
  u,v, w = stack.pop()
  d_list[v] = d_list[u]+w
  while len(tree[v]) > 0:
    stack.append(tree[v].pop())
    
for v in d_list:
  if v % 2 == 0:
    print(0)
  else:
    print(1)

Buggy submission (verdict: Runtime Error):
n = int(input())
tree = [[] for i in range(n)]
d_list = [-1]*n
d_list[0] = 0
stack = []
for i in range(n):
  u,v,w = map(int,input().split())
  tree[u-1].append((u-1,v-1,w))
for e in tree[0]:
  stack.append(e)
while len(stack) > 0:
  u,v, w = stack.pop()
  d_list[v] = d_list[u]+w
  for e in tree[v]:
    stack.append(e)
    
for v in d_list:
  if v % 2 == 0:
    print(0)
  else:
    print(1)
Problem p03087 (python)

Fixed submission:
n, q = map(int, input().split())
s = input()
ac_list = [0]*len(s)

'''while True:
    ac_index = s[i:].find("AC")
    if ac_index == -1:
        break
    else:
        ac_list[ac_index+i] = 1
        i = ac_index + i + 2'''

for i in range(len(s)-1):
    if s[i:i+2] == 'AC':
        ac_list[i+1] = ac_list[i] + 1
    else:
        ac_list[i+1] = ac_list[i]
# print(ac_list)
for _ in range(q):
    l, r = map(int, input().split())
    print(ac_list[r-1] - ac_list[l-1])

Buggy submission (verdict: Runtime Error):
n, q = map(int, input().split())
s = input()
ac_list = [0]*len(s)
i = 0
'''while True:
    ac_index = s[i:].find("AC")
    if ac_index == -1:
        break
    else:
        ac_list[ac_index+i] = 1
        i = ac_index + i + 2'''

for i in range(len(s-1)):
    if s[i] == 'A' and s[i+1] == 'C':
        ac_list[i] = 1
        
for _ in range(q):
    lr = tuple(map(int, input().split()))
    print(sum(ac_list[lr[0]-1:lr[1]-1]))
Problem p03101 (python)

Fixed submission:
import math
def I():
  return input()
def II():
  return int(input())
def MII():
  return map(int, input().split())
def LMII():
  return list(map(int, input().split()))
def P(s):
  return print(s)

a,b = MII()
h,w=MII()
P((a-h)*(b-w))

Buggy submission (verdict: Runtime Error):
import math
def I():
  return input()
def II():
  return int(input())
def MII():
  return map(int, input().split())
def LMII():
  return list(map(int, input().split()))
def P(s):
  return print(s)

import math
a, b , h, m = map(int, input().split())
xa = a * math.sin(h/6*math.pi)
ya = a * math.cos(h/6*math.pi)
xb = b * math.sin(m/30*math.pi)
yb = b * math.cos(m/30*math.pi)
print(math.sqrt((xa-xb)**2 + (ya-yb)**2))
a,b = MII()
h,w = MII()
print((a-h)*(b-w))
Problem p03110 (python)

Fixed submission:
n = int(input())
c = 0
for i in range(n):
  x,u = input().split()
  if u == "JPY":
    c += int(x)
  else:
    c += float(x)*380000
print(c)

Buggy submission (verdict: Runtime Error):
n = int(input())
c = 0
for i in range(n):
  x,u = map(int,input().split())
  if u == "JPY":
    c += x
  else:
    c += x*380000
print(c)