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

Fixed submission:
# Union find
# かっつぱさんの解説と公式のスライドみた
# https://www.youtube.com/watch?time_continue=916&v=zxor0DdwoXA&feature=emb_logo
# https://www.slideshare.net/chokudai/union-find-49066733

import sys
sys.setrecursionlimit(10 ** 9)

n, m = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(m)]

root = [-1]*n

def find(x):
    if root[x] < 0:
        return x
    else:
        root[x] = find(root[x])
        return root[x]

def unite(x, y):
    gx = find(x)
    gy = find(y)
    
    if gx == gy:
        return
      
    if root[gx] > root[gy]:
        gx, gy = gy, gx
        
    root[gx] += root[gy]
    root[gy] = gx

def size(x):
    x = find(x)
    return -root[x]

for a, b in AB:
    a -= 1
    b -= 1
    unite(a, b)

ans = 0
for i in range(n):
    ans = max(ans, size(i))
print(ans)

Buggy submission (verdict: Runtime Error):
# Union find
# かっつぱさんの解説と公式のスライドみた
# https://www.youtube.com/watch?time_continue=916&v=zxor0DdwoXA&feature=emb_logo
# https://www.slideshare.net/chokudai/union-find-49066733

import sys
sys.setrecursionlimit(10 ** 9)

n, m = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(m)]

root = [-1]*n

def find(x):
    if root[x] < 0:
        return x
    else:
        root[x] = find(root[x])
        return root[x]

def unite(x, y):
    gx = find(x)
    gy = find(y)
    
    if gx == gy:
        return
      
    if root[gx] > root[gy]:
        gx, gy = gy, gx
        
    root[gx] += root[gy]
    root[gy] = gx
    print(root)

def size(x):
    x = find(x)
    return -root[x]

for a, b in AB:
    a -= 1
    b -= 1
    unite(a, b)

ans = 0
for i in range(n):
    ans = max(ans, size(i))
print(ans)
Problem p02602 (python)

Fixed submission:
n, k = map(int, input().split())
A = list(map(int, input().split()))

for i in range(n-k):
    if A[i] < A[k+i]:
        print("Yes")
    else:
        print("No")

Buggy submission (verdict: Runtime Error):
import numpy as np

n, k = map(int, input().split())
A = np.array(list(map(int, input().split())))
S = A.cumprod().tolist()
#print(S)

tmp = S[k-1]
for i in range(n-k):
    if tmp*S[i] < S[k+i]:
        print("Yes")
    else:
        print("No")
    #print(tmp, S[k+i]/S[i])

    tmp = S[k+i]//S[i]

Buggy submission (verdict: Runtime Error):
import numpy as np

n, k = map(int, input().split())
A = np.array(list(map(int, input().split())))

S = A.cumprod().tolist()
#print(S)
tmp = S[k-1]
for i in range(n-k):
    if tmp < S[k+i]/S[i]:
        print("Yes")
    else:
        print("No")
    #print(tmp, S[k+i]/S[i])

    tmp = S[k+i]/S[i]

Buggy submission (verdict: Runtime Error):
import numpy as np

n, k = map(int, input().split())
A = np.array(list(map(int, input().split())))

S = A.cumprod().tolist()
#print(S)
tmp = S[k-1]
for i in range(k-1):
    if tmp < S[k+i]/S[i]:
        print("Yes")
    else:
        print("No")
    #print(tmp, S[k+i]/S[i])

    tmp = S[k+i]/S[i]
Problem p02608 (python)

Fixed submission:
n = int(input())

ANS = [0] * (n+1)
for x in range(1, 101):
    for y in range(1, 101):
        for z in range(1, 101):
            tmp = (x + y + z)**2 - z*(x + y) - (x*y)
            if tmp > n: continue
            ANS[tmp] += 1

for ans in ANS[1:]:
    print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())

ANS = [0] * (n)
for x in range(1, 101):
    for y in range(1, 101):
        for z in range(1, 101):
            tmp = (x + y + z)**2 - z*(x + y) - (x*y)
            if tmp > n: continue
            ANS[tmp] += 1

for ans in ANS[1:]:
    print(ans)
Problem p02614 (python)

Fixed submission:
#bit全探索
#解説AC

H, W, K = map(int, input().split())
C = [list(map(str, input())) for _ in range(H)]

ans = 0
#1<<n : 2^n
for i in range(1<<H):
    for j in range(1<<W):
      cnt = 0
      for h in range(H):
        for w in range(W):
          #1>>n : 下からn桁目(0 index)
          if (i>>h & 1): continue
          if (j>>w & 1): continue
          cnt += C[h][w] == '#'

      if cnt == K: ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
h, w, k = map(int, input().split())
C = [list(map(str, input())) for _ in range(h)]

n = h + w
tmp = [0] * (n)
for idx, ch in enumerate(C):
    tmp[idx] = ch.count("#")
    for i, c in enumerate(ch):
        if c == "#": tmp[i + 2] += 1

if k > w:
    cnt = 1
    for i in range(n):
        if tmp[i] == k: cnt += 1

else:
    cnt = 0
    for i in range(n):
        if tmp[i] == k: cnt += 1
        for j in range(n - i):
            if i == j: continue
            if (tmp[i] + tmp[j]) == k: cnt += 1
print(cnt)
Problem p02642 (python)

Fixed submission:
n = int(input())
A = list(map(int, input().split()))

MAX_N = max(A)+1
cnt = [0] * MAX_N 

for a in A:
  for i in range(a, MAX_N, a):
    if cnt[i] <= 2: cnt[i] += 1

ans = 0
for a in A:
  if cnt[a] == 1: ans += 1
print(ans)

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

MAX_N = max(A)+1
cnt = [0] * MAX_N 

for a in A:
  for i in range(1, MAX_N):
    if cnt[a] <= 2: 
      tmp = a * i
      if tmp > MAX_N: break
      cnt[tmp] += 1
ans = 0
for a in tuple(set(A)):
  if cnt[a] == 1:
    ans += 1
print(ans)
Problem p02658 (python)

Fixed submission:
def main():
  ## IMPORT MODULE
  #import sys

  #sys.setrecursionlimit(100000)
  #input=lambda :sys.stdin.readline().rstrip()

  #f_inf=float("inf")
  #MOD=10**9+7
  
  if 'get_ipython' in globals(): 
    ## SAMPLE INPUT
    n = 2
    A = [1000000000, 1000000000]

  else:
    ##INPUT 
    n = input()
    A = list(map(int, input().split()))

  ## SUBMITION CODES HERE
  if 0 in A:
    print(0)
    exit()
  
  ans = 1
  for a in A:
    ans *= a
    if ans > 10**18:
      ans = -1
      break
  
  print(ans)
    
main()

Buggy submission (verdict: Runtime Error):
import math
a, b = map(float, input().split())
print(math.floor(a*b))
Problem p02660 (python)

Fixed submission:
from collections import Counter

def prime_fact(n):
    P= []
    for i in range(2, int(n ** 0.5) + 1):
        while n % i == 0:
            P.append(i)
            n //= i
    if n != 1:
        P.append(n)
    return P

n = int(input())
cnt = Counter(prime_fact(n))

ans = 0
for c in cnt.values():
  tmp = 1
  while c >= tmp:
    c -= tmp
    ans += 1
    tmp += 1
print(ans)

Buggy submission (verdict: Runtime Error):
def main():
  ## IMPORT MODULE
  #import sys
  from collections import Counter

  #sys.setrecursionlimit(100000)
  #input=lambda :sys.stdin.readline().rstrip()

  #f_inf=float("inf")
  #MOD=10**9+7
  
  if 'get_ipython' in globals(): 
    ## SAMPLE INPUT
    n = 64

  else:
    ##INPUT 
    n = input()
    #a, b = map(int, input().split())

  ## SUBMITION CODES HERE
  def prime_fact(n):
    P= []
    for i in range(2, int(n ** 0.5) + 1):
        while n % i == 0:
            P.append(i)
            n //= i
    if n != 1:
        P.append(n)
    return P

  cnt = Counter(prime_fact(n))

  ans = 0
  for c in cnt.values():
    tmp = 1
    while c >= tmp:
      c -= tmp
      ans += 1
      tmp += 1
    
  print(ans)
    
main()

Buggy submission (verdict: Runtime Error):
def main():
  ## IMPORT MODULE
  #import sys
  from collections import Counter

  #sys.setrecursionlimit(100000)
  #input=lambda :sys.stdin.readline().rstrip()

  #f_inf=float("inf")
  #MOD=10**9+7
  
  if 'get_ipython' in globals(): 
    ## SAMPLE INPUT
    n = 64

  else:
    ##INPUT 
    n = input()
    #a, b = map(int, input().split())

  ## SUBMITION CODES HERE
  def prime_fact(n):
    P= []
    for i in range(2, int(n ** 0.5) + 1):
        while n % i == 0:
            P.append(i)
            n //= i
    if n != 1:
        P.append(n)
    return P

  cnt = Counter(prime_fact(n))

  ans = 0
  for c in cnt.values():
    tmp = 1
    while c >= tmp:
      c -= tmp
      ans += 1
      tmp += 1
    
  print(ans)
    
main()
Problem p02675 (python)

Fixed submission:
n = input()
if n[-1] == "3":
    print("bon")
elif n[-1] == "0" or n[-1] == "1" or n[-1] == "6" or n[-1] == "8":
    print("pon")
else:
    print("hon")

Buggy submission (verdict: Runtime Error):
import pandas as pd

df1 = pd.Dataframe([1,2])
df2 = pd.Dataframe([3,4])

print(pd.merge(df1, df2))
Problem p02681 (python)

Fixed submission:
S = input()
T = input()
for i in range(len(S)):
    if S[i] != T[i]:
        print("No")
        exit()
        
print("Yes")

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

Town = []
#まだ訪れていない町は-1
rec = [-1] * (n+1)
idx = 1
#すべての町を訪れるまで
while (rec[idx] == -1):
    rec[idx] = len(Town)
    Town.append(idx)
    idx = A[idx-1]

Exce = rec.index(idx)
Cycl = len(Town) - Exce

if Cycl > k:
    print(Town[k])
else:
    k -= Exce
    k %= Cycl
    print(Town[Exce+k])
Problem p02684 (python)

Fixed submission:
n, k = map(int, input().split())
A = list(map(int, input().split()))

Town = []
#まだ訪れていない町は-1
rec = [-1] * (n+1)
idx = 1
#周期までループをまわす
while (rec[idx] == -1):
    rec[idx] = len(Town)
    Town.append(idx)
    idx = A[idx-1]

#周期前
Exce = rec[idx]
#周期内
Cycl = len(Town) - Exce

if Exce > k:
    print(Town[k])
else:
    Warp = (k - Exce) % Cycl
    print(Town[Exce+Warp])

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

D = 60 #10**18は60桁なので2の59乗まで見る
MAX_N = 2*10**5+5 #頂点番号
to = [[0 for _ in range(D)] for _ in range(MAX_N)]

#to[i][j]:jから2^i個先の頂点
for i in range(n):
    to[0][i] = A[i]
    to[0][i] -= 1

#ダブリングの表
for i in range(D-1):
    for j in range(n):
        to[i+1][j] = to[i][to[i][j]]

v = 0
for i in range(D-1, -1, -1):
    l = 1<<i #2^i個先を見る
    if l <= k:
        v = to[i][v]
        k -= l

print(v+1)

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

Town = []
#まだ訪れていない町はTrue
rec = [True] * (n+1)
idx = 1
#周期までループをまわす
while rec[idx]:
    rec[idx] = False
    Town.append(idx)
    idx = A[idx-1]

#周期前
Exce = Town.index(idx)
#周期内
Cycl = len(Town) - Exce

if Cycl >= k:
    print(Town[k])
else:
    k -= Exce
    k %= Cycl
    print(Town[Exce+k])

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

Town = []
#まだ訪れていない町は-1
rec = [-1] * (n+1)
idx = 1
#周期までループをまわす
while (rec[idx] == -1):
    rec[idx] = len(Town)
    Town.append(idx)
    idx = A[idx-1]

#周期前
Exce = Town.index(idx)
#周期内
Cycl = len(Town) - Exce

if Cycl >= k:
    print(Town[k])
else:
    k -= Exce
    k %= Cycl
    print(Town[Exce+k])

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

Town = []
#まだ訪れていない町は-1
rec = [-1] * (n+1)
idx = 1
#すべての町を訪れるまで
while (rec[idx] == -1):
    rec[idx] = len(Town)
    Town.append(idx)
    idx = A[idx-1]

Exce = rec.index(idx)
Cycl = len(Town) - Exce

if Cycl > k:
    print(Town[k])
else:
    k -= Exce
    k %= Cycl
    print(Town[Exce+k])

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

Town = []
#まだ訪れていない町は-1
rec = [-1] * (n+1)
idx = 1
#すべての町を訪れるまで
while (rec[idx] == -1):
    rec[idx] = len(Town)
    Town.append(idx)
    idx = A[idx-1]

Exce = rec[idx]
Cycl = len(Town) - Exce

if Cycl >= k:
    print(Town[k])
else:
    print(Town[Exce+(k-Exce)%Cycl])

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

Town = []
#まだ訪れていない町は-1
rec = [-1] * (n+1)
idx = 1
#すべての町を訪れるまで
while rec[idx] == -1:
    rec[idx] = len(Town)
    Town.append(idx)
    idx = A[idx-1]

Exce = rec[idx]
Cycl = len(Town) - Exce

if Cycl >= k:
    print(Town[k])
else:
    k -= Exce
    k %= Cycl
    print(Town[k+Exce])
Problem p02686 (python)

Fixed submission:
def CNT(A):
    tmp, Min = 0, 0
    for a in A:
        if a == '(': tmp += 1
        else: tmp -= 1
        Min = min(Min, tmp)
    return (-Min, tmp-Min)

N = int(input())
S = [input() for _ in range(N)]
T = [CNT(s) for s in S]

pls = []
mis = []
for l, r in T:
    if l <= r: pls.append((l, r))
    else: mis.append((l, r))

pls.sort(key=lambda a: a[0])
mis.sort(key=lambda a: a[1], reverse=True)
totl= pls + mis

levl = 0
for l, r in totl:
    levl -= l
    if levl < 0:
        print('No')
        exit()
    levl += r

print('Yes' if levl==0 else 'No')

Buggy submission (verdict: Runtime Error):
def main():
  ## IMPORT MODULE
  #import sys

  #sys.setrecursionlimit(100000)
  #input=lambda :sys.stdin.readline().rstrip()

  #f_inf=float("inf")
  #MOD=10**9+7
  
  if 'get_ipython' in globals(): 
    ## SAMPLE INPUT
    n = 4
    S= ['((()))', '((((((', '))))))', '()()()']

  else:
    ##INPUT 
    n = input()
    #a, b = map(int, input().split())
    S = [input() for _ in range(n)]

  ## SUBMITION CODES HERE
  def CNT(A):
    tmp, Min = 0, 0
    for a in A:
        if a == '(': tmp += 1
        else: -1
        Min = min(Min, tmp)
    return (-Min, tmp-Min)
  
  T = [CNT(s) for s in S]

  pls = []
  mis = []
  for l, r in T:
    if l <= r: pls.append((l, r))
    else: mis.append((l, r))

  pls.sort(key=lambda a: a[0])
  mis.sort(key=lambda a: a[1], reverse=True)
  total = pls + mis

  levl = 0
  for l, r in total:
    levl -= l
    if levl < 0:
        print('No')
        exit()
    levl += r

  print('Yes' if levl == 0 else 'No')
    
main()
Problem p02690 (python)

Fixed submission:
x = int(input())
for a in range(200, -200, -1):
  for b in range(-200, 200, 1):
    if x==a**5-b**5:
      print(a, b)
      exit()

Buggy submission (verdict: Runtime Error):
x = int(input())
for a in range(101. -101, -1):
  for b in range(-101, 101, 1):
    if x==a**5-b**5:
      print(a, b)
      exit()

Buggy submission (verdict: Runtime Error):
import math
x = int(input())
y = int(math.pow(x, 1/5))
x - (y)**5 = z
print(x, y)
Problem p02732 (python)

Fixed submission:
import sys
input = lambda: sys.stdin.readline().rstrip()

def choose2(n):
    return n*(n-1)//2

n = int(input())
A = list(map(int, input().split()))
A = [a-1 for a in A]
  
Cnt = [0]*n
for i in range(n):
  Cnt[A[i]] += 1
    
tot = 0
for i in range(n):
    tot += choose2(Cnt[i])

for i in range(n):
    ans = tot
    ans -= choose2(Cnt[A[i]])
    ans += choose2(Cnt[A[i]]-1)
    print(ans)

Buggy submission (verdict: Runtime Error):
import sys
input = lambda: sys.stdin.readline().rstrip()

def choose2(n):
    return n*(n-1)//2

n = int(input())
A = list(map(int, input().split()))

Cnt = [(a-1) for a in A]

tot = 0
for i in range(n):
    tot += choose2(Cnt[i])

for i in range(n):
    ans = tot
    ans -= choose2(Cnt[A[i]])
    ans += choose2(Cnt[A[i]]-1)
    print(ans)
Problem p02784 (python)

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

if sum(A) >= h:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
211 5
31 41 59 26 53
Problem p02885 (python)

Fixed submission:
A, B = input().split()
A = int(A)
B = int(B)

if (B*2) >= A:
    print(0)
else:
    print(A-(B*2))

Buggy submission (verdict: Runtime Error):
import copy
def warshall_floyd(dist):
    #d[i][j]: iからjへの最短距離
    for k in range(n):
        for i in range(n):
            for j in range(n):
                dist[i][j] = min(dist[i][j],
                              dist[i][k] + dist[k][j])
    return dist

n, m, l = map(int, input().split()) #N:頂点数　M:辺の数 L:容量
dist = [[float("inf") for i in range(n)] for j in range(n)]
dist2 = copy.deepcopy(dist) 
for i in range(n):
    dist[i][i] = 0

for i in range(m):
    a, b, c = map(int, input().split())
    dist[a-1][b-1] = c
    dist[b-1][a-1] = c

warshall_floyd(dist)


for i in range(n):
    for j in range(n):
        if dist[i][j] <= l:
            dist2[i][j] = 1

warshall_floyd(dist2)
q = int(input())
for i in range(q):
    s, t = map(int, input().split())
    ans = dist2[s-1][t-1]-1
    if dist2[s-1][t-1] == float("inf"):
        ans = -1
    print(ans)

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

sum_num = 0
for i in range(N-1):
    for j in range(i+1, N):
        sum_num += d_list[i] * d_list[j]

print(sum_num)

Buggy submission (verdict: Runtime Error):
N = int(input())
d_list = list(map(int, input().split()))
sum_num = 0
for i in range(N-1):
    for j in range(i+1, N):
        sum_num += d_list[i] * d_list[j]

print(sum_num)
Problem p02887 (python)

Fixed submission:
N = int(input())
S = input()

checklist = []

for i in range(N-1):
    j = i+1
    if S[i] != S[j]:
        checklist.append(S[i])
print(len(checklist)+1)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input().split()
count = 1
for i in range(N-1):
    j = i+1
    if S[i] != S[j]:
        count += 1
print(count)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input().split()

count = 0
for i in range(N-1):
    j = i+1
    if S[i] != S[j]:
        count += 1
print(count+1)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input().split()
count = 0
for i in range(N-1):
    j = i+1
    if S[i] != S[j]:
        count += 1
print(count+1)
Problem p02898 (python)

Fixed submission:
N, K = map(int, input().split())
h = list(map(int, input().split()))
count = [i for i in h if i >= K]
print(len(count))

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(1000000000) 
N, K = input().strip().split()
h = list(map(int, input().split()))
count = 0
for i in range(N):
    if h[i] >= K:
        count += 1
print(count)

Buggy submission (verdict: Runtime Error):
N, K = input().strip().split()
h = list(map(int, input().split()))
count = 0
for i in range(N):
    if h[i] >= K:
        count += 1
print(count)

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

count = 0
for i in h:
    if i >= K:
        count += 1
print(count)

Buggy submission (verdict: Runtime Error):
N, K = input().split()
h = list(map(int, input().split()))
count = [i for i in h if i >= K]
print(len(count))

Buggy submission (verdict: Runtime Error):
N, K = input().strip().split()
h = list(map(int, input().split()))
count = [i for i in h if i >= K]
print(len(count))

Buggy submission (verdict: Runtime Error):
N, K = input().strip().split()
h = list(map(int, input().split()))
count = 0

for i in h:
    if i >= K:
        count += 1
print(count)
Problem p02899 (python)

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

values = [i for i in range(1, N+1)]
dic = dict(zip(keys, values))
keys.sort()
for i in range(1, N+1):
    value = dic[i]
    print('{} '.format(value), end='')

Buggy submission (verdict: Runtime Error):
N, K = input().strip().split()
N = int(N)
K = int(K)

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

count = 0
for i in range(N):
    if h[i] >= K:
        count += 1
print(count)
Problem p02921 (python)

Fixed submission:
S = input()
T = input()

n = len(S)
cont = 0
for i in range(n):
    if S[i] == T[i]:
        cont += 1
print(cont)

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
if a <= b:
    print(1)
else:
    for i in range(20):
        if (a * i - 1) >= b:
            break
    print(i)

Buggy submission (verdict: Runtime Error):
"""
'S'=晴
'C'=曇
'R'=雨
3日間で天気予報が的中した日が何日あるかを出力せよ。

入力
CSS
CSR

出力
2
"""

#S= ['C', 'S', 'S']
#T= ['C', 'S', 'R']

S= input()
T= input()

S_list = []
T_list = []
def split_lint(text, list):
    words=text.split()
    for word in words:
        list.append(word)
split_lint(S, S_list)
split_lint(T, T_list)

count=0
for i in range(3):
    if S_list[i] == T_list[i]:
       count += 1
print(count)

Buggy submission (verdict: Runtime Error):
cout =0
S= map(str, input().split())
T= map(str, input().split())

count=0
for i in range(3):
    if S[i] == T[i]:
       count += 1
print(count)

Buggy submission (verdict: Runtime Error):
cout =0
S= map(input().split())
T= map(input().split())

count=0
for i in range(3):
    if S[i] == T[i]:
       count += 1
print(count)
Problem p03240 (python)

Fixed submission:
n = int(input())
XYH = [list(map(int, input().split())) for _ in range(n)]
#print(XYH)

for x1, y1, h1 in XYH:
    if h1 > 0:
        for Cx in range(101):
            for Cy in range(101):
                H = h1 + abs(x1 - Cx) + abs(y1 - Cy)
                # print(Cx, Cy, H)
                if all(h == max(H - abs(x - Cx) - abs(y - Cy), 0) for x, y, h in XYH):
                  print(Cx, Cy, H)
                  exit()

Buggy submission (verdict: Runtime Error):
n = int(input())
XYH = [list(map(int, input().split())) for _ in range(n)]
x1, y1, h1 = XYH[0]
# print(x1, y1, h1)

for Cx in range(101):
    for Cy in range(101):
        H = h1 + abs(x1-Cx) + abs(y1-Cy)
        # print(Cx, Cy, H)
        if all(h == max(H-abs(x-Cx)-abs(y-Cy), 0) for x, y, h in XYH:
            print(Cx, Cy, H)
            exit()
Problem p03254 (python)

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

cont = 0

for i in sorted(a):
    x -= i
    if x >= 0:
        cont += 1
    else:
        break

if x > 0:
    cont -= 1

print(cont)

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

cont = 0

for i in sorted(a):
    x -= i
    if x >= 0:
        cont += 1
    else:
        break

if x > 0:
    cont -= 1

print(cont)
Problem p03331 (python)

Fixed submission:
n = int(input())

def Checker(sum, x):
    sum =  0
    while x > 0:
        sum += x % 10
        x = x // 10
    return sum

sum_list = []
for a in range(1, n):
    b = n - a
    sum_a = 0
    sum_b = 0
    
    y = Checker(sum_a, a)+ Checker(sum_b, b)
    sum_list.append(y)

print(min(sum_list))

Buggy submission (verdict: Runtime Error):
n = int(input())

def Checker(sum, x):
    sum =  0
    while x > 0:
        sum += x % 10
        x = x // 10
    return sum

sum_list = []
for a in range(2, n):
    b = n - a
    sum_a = 0
    sum_b = 0
    y = 0

    y = Checker(sum_a, a)+ Checker(sum_b, b)
    sum_list.append(y)

print(min(sum_list))

Buggy submission (verdict: Runtime Error):
n = int(input())

def Checker(sum, x):
    sum =  0
    while x > 0:
        sum += x % 10
        x = x // 10
    return sum

sum_list = []
for a in range(2, n):
    b = n - a
    sum_a = 0
    sum_b = 0

    y = Checker(sum_a, a)+ Checker(sum_b, b)
    sum_list.append(y)

print(min(sum_list))
Problem p03352 (python)

Fixed submission:
x = int(input())

ans = 0
tmp = 1
for i in range(1, int(x**0.5)+1):
    for j in range(2, x):
      tmp = pow(i, j)
      if tmp > x:
          tmp = pow(i, j-1)
          #print(tmp, i, j)
          break

    ans = max(tmp, ans)

print(ans)

Buggy submission (verdict: Runtime Error):
x = int(input())

ans = 0
for i in range(1, int(x**0.5)+1):
    for j in range(2, x):
        tmp = i ** j
        #tmp = pow(i, j)
        if tmp > x:
            tmp = i ** (j-1)
            #tmp = pow(i, j-1)
            #print(tmp, i, j)
            break
    ans = max(tmp, ans)

print(ans)

Buggy submission (verdict: Runtime Error):
x = int(input())

ans = 0
for i in range(1, int(x**0.5)+1):
    for j in range(2, x):
        tmp = pow(i, j)
        if tmp > x:
            tmp = pow(i, j-1)
            #print(tmp, i, j)
            break
    ans = max(tmp, ans)

print(ans)
Problem p03407 (python)

Fixed submission:
a, b, c = map(int, input().split())
if a+b < c:
    print("No")
else:
    print("Yes")

Buggy submission (verdict: Runtime Error):
import collections

n = int(input())
s = [input() for _ in range(n)]
m = int(input())
t = [input() for _ in range(m)]

S = collections.Counter(s)
T = collections.Counter(t)

ans = [0]
for key, cont in S:
    if cont > T[key]:
        ans.append(cont - T[key])
print(max(ans))
Problem p03408 (python)

Fixed submission:
import collections
n = int(input())
s = [input() for _ in range(n)]
m = int(input())
t = [input() for _ in range(m)]

S = collections.Counter(s)
T = collections.Counter(t)


ans = [0]
for key, cont in S.most_common():
  if cont > T[key]:
    ans.append(cont-T[key])
print(max(ans))

Buggy submission (verdict: Runtime Error):
import collections

n = int(input())
s = [input() for _ in range(n)]
m = int(input())
t = [input() for _ in range(m)]

S = collections.Counter(s)
T = collections.Counter(t)

ans = [0]
for key, cont in S:
    if cont > T[key]:
        ans.append(cont - T[key])
print(max(ans))