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

Fixed submission:
import sys

sys.setrecursionlimit(1000000)

num_node = int(input())
relation = [[[], []] for i in range(num_node + 1)]
for i in range(num_node - 1):
    u, v, w = map(int, input().split())
    if w % 2 == 0:
        relation[u][0].append(v)
        relation[v][0].append(u)
    else:
        relation[u][1].append(v)
        relation[v][1].append(u)
colors = [None] * (num_node + 1)


def dfs(n: int, c: int):
    colors[n] = c
    # 偶数
    for even_idx in relation[n][0]:
        if colors[even_idx] is not None:
            continue
        else:
            dfs(even_idx, colors[n])
    # 奇数
    for odd_idx in relation[n][1]:
        if colors[odd_idx] is not None:
            continue
        else:
            dfs(odd_idx, 1 - colors[n])


if __name__ == '__main__':
    dfs(1, 0)
    for ans in list(map(int, colors[1:])):
        print(ans)

Buggy submission (verdict: Runtime Error):
import sys

sys.setrecursionlimit(1000000)

num_node = int(input())
relation = [[[], []] for i in range(num_node + 1)]
for i in range(num_node - 1):
    u, v, w = map(int, input().split())
    if w % 2 == 0:
        relation[u][0].append(v)
        relation[v][0].append(u)
    else:
        relation[u][1].append(v)
        relation[v][1].append(u)
colors = [None] * (num_node + 1)


def dfs(n: int):
    if n == 1:
        colors[n] = 0
    print(colors)
    # 偶数
    for even_idx in relation[n][0]:
        if colors[even_idx] is not None:
            continue
        else:
            colors[even_idx] = colors[n]
            dfs(even_idx)
    # 奇数
    for odd_idx in relation[n][1]:
        if colors[odd_idx] is not None:
            continue
        else:
            colors[odd_idx] = not colors[n]
            dfs(odd_idx)


if __name__ == '__main__':
    dfs(1)
    for ans in list(map(int, colors[1:])):
        print(ans)

Buggy submission (verdict: Runtime Error):
num_node = int(input())
relation = [[[], []] for i in range(num_node + 1)]
for i in range(num_node - 1):
    u, v, w = map(int, input().split())
    if w % 2 == 0:
        relation[u][0].append(v)
        relation[v][0].append(u)
    else:
        relation[u][1].append(v)
        relation[v][1].append(u)
colors = [None] * (num_node + 1)


def dfs(n: int):
    if n == 1:
        colors[n] = 0
    print(colors)
    # 偶数
    for even_idx in relation[n][0]:
        if colors[even_idx] is not None:
            continue
        else:
            colors[even_idx] = colors[n]
            dfs(even_idx)
    # 奇数
    for odd_idx in relation[n][1]:
        if colors[odd_idx] is not None:
            continue
        else:
            colors[odd_idx] = not colors[n]
            dfs(odd_idx)


if __name__ == '__main__':
    dfs(1)
    for ans in list(map(int, colors[1:])):
        print(ans)
Problem p03292 (python)

Fixed submission:
import numpy as np
a = list(map(int,input().split()))
a = np.array(a)
a = np.sort(a)[::-1]
sum = a[0]-a[2]
print (sum)

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())
a = list(map(int,input().split()))
a = np.array(a)
a = np.sort(a)[::-1]
MAX = np.abs(np.prod(a))
#print (MAX)
Flag = True
q = 0
add = a[0]
sum = 0
max = np.sum(a)-len(a)
n = a[0]*q+a[0]-1
while True:
    st = np.sum(n%a)
    if sum < st:
        sum = st
    if sum == max:
        break
    ind = np.where(a - n%a == 1)[0]
    #print (ind)
    c = a[ind]
    n += np.prod(c)
    if n > MAX:
        break
    #print (sum)
print (sum)

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())
a = list(map(int,input().split()))
a = np.array(a)
a = np.sort(a)[::-1]
MAX = np.abs(np.prod(a))
#print (MAX)
Flag = True
q = 0
add = a[0]
sum = 0
max = np.sum(a)-len(a)
n = a[0]*q+a[0]-1
while True:
    st = np.sum(n%a)
    if sum < st:
        sum = st
    if sum == max:
        break
    ind = np.where(a - n%a == 1)[0]
    #print (ind)
    c = a[ind]
    n += np.prod(c)
    if n > MAX:
        break
    #print (sum)
print (sum)
Problem p03294 (python)

Fixed submission:
import numpy as np
N = int(input())
a = list(map(int,input().split()))
print (np.sum(a)-len(a))

Buggy submission (verdict: Runtime Error):
import numpy as np
from math import gcd
from functools import reduce
def lcm_base(x, y):
    return (x * y) // gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
N = int(input())
a = list(map(int,input().split()))
a = np.array(a)
a = np.sort(a)[::-1]
MAX = lcm_list(a)
#print (MAX)
Flag = True
q = 0
add = a[0]
sum = 0
max = np.sum(a)-len(a)
#print (max)
n = a[0]*q+a[0]-1
while True:
    st = np.sum(n%a)
    if st == max:
        sum = st
        break
    if st > MAX:
        break
    ind = np.where(a - n%a == 1)[0]
    #print (ind)
    c = a[ind]
    n += np.prod(c)
    #print (sum)
print (sum)
Problem p03471 (python)

Fixed submission:
N, Y = map(int, input().split())
for x in range(N + 1):
    for y in range(N + 1):
        if (N - x - y >= 0) and (10000 * x + 5000 * y + 1000 * (N - x - y) == Y):
            print(x, y, N - x - y)
            break
    else:
        if x == N and y == N:
            print(-1, -1, -1)
        continue
    break

Buggy submission (verdict: Runtime Error):
N, Y = input().split()

for x in range(1, N):
    for y in range(1, N):
        if (N - x - y < 0) and (10000 * x + 5000 * y + 1000(N - x - y)) == Y:
            print(x, y, N - x - y)
Problem p03695 (python)

Fixed submission:
import numpy as np
N = int(input())
a = [int(_) for _ in input().split()]
a = np.array(a)
a = np.sort(a)
min = 0
max = 100

for i in range(8):
    set_1 = set(np.where(i*400<=a)[0])
    set_2 = set(np.where(a<(i+1)*400)[0])
    match = list(set_1 & set_2)
    if len(match)>0:
        min+=1
if min==0:
    min=1
    max = N
else:
    if len(np.where(a>=3200)[0])==0:
        max = min
    else:
        max = min + len(np.where(a>=3200)[0])
print (min, max)

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())
a = [int(_) for _ in input().split()]
a = np.array(a)
a = np.sort(a)
min = 0
max = 0
m = 0

for i in range(8):
    set_1 = set(np.where(i*400<=a)[0])
    set_2 = set(np.where(a<(i+1)*400)[0])
    match = list(set_1 & set_2)
    if len(match)>0:
        min+=1
if min=0:
    min=1
    if N>8:
	max = 8
    else:
	max = N
else:
    if len(np.where(a>=3200)[0])==0:
        max = min
    else:
        max = min + len(np.where(a>=3200)[0])
    	if max>8:
            max = 8
print (min, max)

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())
a = [int(_) for _ in input().split()]
a = np.array(a)
a = np.sort(a)
min = 0
max = 0
m = 0

for i in range(8):
    set_1 = set(np.where(i*400<=a)[0])
    set_2 = set(np.where(a<(i+1)*400)[0])
    match = list(set_1 & set_2)
    if len(match)>0:
        min+=1
if min=0:
    min=1
    if N>8:
	max = 8
    else:
	max = N
else:
    if len(np.where(a>=3200)[0])==0:
        max = min
    else:
        max = min + len(np.where(a>=3200)[0])
    	if max>8:
            max = 8
print (min, max)
Problem p03721 (python)

Fixed submission:
import numpy as np

N,K = list(map(int,input().split()))

a = []
for i in range(N):
    a.append(list(map(int,input().split())))
a = sorted(a,key = lambda i:i[0])
sum = 0
b = 0
#print (a)
for i in range(N):
    sum += a[i][1]
    b = a[i][0]
    if sum >= K:
        break

print (b)

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

N,K = list(map(int,input().split()))

a = []
array = np.array([])
for i in range(N):
    a = list(map(int,input().split()))
    array = np.concatenate((array,a[0]*np.ones(a[1])))
print (array)
array = np.sort(array)

print (int(array[K-1]))
Problem p03759 (python)

Fixed submission:
a,b,c = map(int, raw_input().split())

if b-a == c-b:
    print 'YES'
else:
    print 'NO'

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

n = input()
s = []
for i in range(n):
    s.append(raw_input())
for i in range(n):
    s[i] = list(s[i])
    s[i].sort()
print s
#print s[0][1] in s[1]
#print len(s[0])
#print s[0][1]
#print s[2]
count = 0
answer = []
for j in range(len(s[0])):
    for k in range(1,n):
        if ''.join(s[k]).find(s[0][j]) != -1:
            count += 1
    if count == n-1:
        answer.append(s[0][j])
    print count
    count = 0
print ''.join(answer)
Problem p02767 (python)

Fixed submission:
import math

N = input()
xs = [int(i) for i in input().split()]
p = round(sum(xs)/len(xs))

print(int(sum(math.pow(x-p, 2) for x in xs)))

Buggy submission (verdict: Runtime Error):
import math

N = input()
xs = [int(i) for i in input().split()]
p = round(sum(xs)/len(xs))

print(sum(math.pow(x-p) for x in xs))
Problem p02922 (python)

Fixed submission:
a, b = [int(i) for i in input().split()]
if b == 1:
    print(0)
    exit()
n = int((b-2) / (a-1))
print(n+1)

Buggy submission (verdict: Runtime Error):
a, b = [int(i) for i in input().split()]
if b == 1:
    print(0)
    return
n = (b-2) / (a-1)
print(n+1)
Problem p03085 (python)

Fixed submission:
b = input().strip()
 
if b == 'A':
  print('T')
elif b == 'T':
  print('A')
elif b == 'C':
  print('G')
else:
  print('C')

Buggy submission (verdict: Runtime Error):
b = input().strip()

if b == 'A':
  return 'T'
elif b == 'T':
  return 'A'
elif b == 'C':
  return 'G'
else:
  return 'C'
Problem p03086 (python)

Fixed submission:
S = input()
 
len = 0
ans = 0
for ch in S:
    if ch in 'ACGT':
        len += 1
        ans = max(ans, len)
    else:
        len = 0
print(ans)

Buggy submission (verdict: Runtime Error):
s = input().strip()
enki = set('ATCG')
count = 0
maxlen = 0
for i in range(len(s)):
    if s[i] in enki:
        count += 1
    else:
        maxlen = max(maxlen, count)
        count = 0

return maxlen
Problem p02657 (python)

Fixed submission:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    a, b = map(int, input().split())
    print(a * b)
    

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    a, b = map(int, input().split())
    print(a * b)
    

if __name__ == '__main__':
    main()
                                          ￿
Problem p02741 (python)

Fixed submission:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    n = int(input().strip())
    a_list = [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(a_list[n - 1])


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    n = int(input().strip())
    a_list = [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(a_list[n])


if __name__ == '__main__':
    main()
Problem p02647 (python)

Fixed submission:
import numpy as np
from numba import njit

N,K = map(int, input().split())

A_list = np.array([0]+list(map(int, input().split())))

@njit
def update(A_list):

  for j in range(min(K,46)):
    new_A=np.zeros(N+2,dtype=np.int64)
    for i in range(1,N+1):
      #print(new_A)
      mi=i-A_list[i]
      ma=i+A_list[i]
      if mi<0:
        mi=0
      if ma>N:
        ma=N
      #new_A[mi:ma+1]+=1
      new_A[mi]+=1
      new_A[ma+1]-=1

    A_list=np.cumsum(new_A)
    #if sum(A_list[1:N+1])==N*N:
    #  return(A_list)    
    #  break
      
  return(A_list)

A_list=update(A_list)
for i in range(1,N+1):
  print(A_list[i],end=" ")

Buggy submission (verdict: Runtime Error):
import numpy as np
N,K = map(int, input().split())

A_list = np.array([0]+list(map(int, input().split())))
#print(A_np)


for j in range(min(K,46):
  new_A=np.zeros(N+2,dtype=np.int64)
  for i in range(1,N+1):
    #print(new_A)
    mi=i-A_list[i]
    ma=i+A_list[i]
    if mi<0:
      mi=0
    if ma>N:
      ma=N
    #new_A[mi:ma+1]+=1
    new_A[mi]+=1
    new_A[ma+1]-=1

  A_list=np.cumsum(new_A)
  #if A_list[1:N+1])==N*N:
  #  break
    
for i in range(1,N+1):
  print(A_list[i],end=" ")

Buggy submission (verdict: Runtime Error):
import numpy as np
N,K = map(int, input().split())

A_list = np.array([0]+list(map(int, input().split())))
#print(A_np)

new_A=np.array([0]*(N+2))
for j in range(1):
  for i in range(1,N+1):
    print(new_A)
    mi=i-A_list[i]
    ma=i+A_list[i]
    if mi<0:
      mi=0
    if ma>N+1:
      ma=N+1
    #new_A[mi:ma+1]+=1
    new_A[mi]+=1
    new_A[ma+1]-=1

  A_list=np.cumsum(new_A)
  if sum(A_list[1:N+1])==N*N:
    break
    
for i in range(1,N+1):
  print(A_list[i],end=" ")

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

A_list = [0]+list(map(int, input().split()))
A_np=np.array(A_list)
#print(A_np)

for j in range(K):
  new_A=[0]*(N+1)
  for i in range(1,N+1):
    #print(A_np)
    mi=i-A_np[i]
    ma=i+A_np[i]
    if mi<0:
      mi=0
    if ma>N:
      ma=N
    new_A_np[mi:ma+1]=1
  A_np=new_A_np
  if sum(A_np[1:N+1])==N*N:
    break
    
for i in range(1,N+1):
  print(A_np[i],end=" ")
Problem p02973 (python)

Fixed submission:
import bisect
n=int(input())
A=[]
for i in range(n):
  A.append(int(input()))
Ans=[A[-1]]
for i in reversed(range(n-1)):
  a=A[i]
  if a>=Ans[-1]:
    Ans.append(a)
  else:

    Ans[bisect.bisect_right(Ans,a)]=a

print(len(Ans))

Buggy submission (verdict: Runtime Error):
import bisect

n = int(input())

a_list=[]
for i in range(n):
  a_list.append(int(input()))

ans_head=[a_list[-1]]

for i in range(n-2,-1,-1):
  a=a_list[i]
  if a>ans_head[-1]:
    ans_head.append(a)
  else:
    insert_index = bisect.bisect_right(ans_head,a)
    ans_head[insert_index]=a

  #print(ans_head)
print(len(ans_head))

Buggy submission (verdict: Runtime Error):
import bisect

n = int(input())

a_list=[]
for i in range(n):
  a_list.append(int(input()))

ans_head=[a_list[-1]]

for i in range(n-2,0,-1):
  a=a_list[i]
  if a>ans_head[-1]:
    ans_head.append(a)
  else:
    insert_index = bisect.bisect_right(ans_head,a)
    ans_head[insert_index]=a

  #print(ans_head)
print(len(ans_head))

Buggy submission (verdict: Runtime Error):
import bisect

n = int(input())

a_list=[]
for i in range(n):
  a_list.append(int(input()))

ans_head=[99999]

for i in range(n-1,0,-1):
  a=a_list[i]
  if a>ans_head[-1]:
    ans_head.append(a)
  else:
    insert_index = bisect.bisect_right(ans_head,a)
    ans_head[insert_index]=a

  #print(ans_head)
print(len(ans_head))

Buggy submission (verdict: Runtime Error):
import bisect

n = int(input())
ans_head=[-1]

a_list=[]
for i in range(n):
  a_list.append(int(input()))

for i in range(n):
  a=a_list[i]
  if ans_head[0]>=a:
    ans_head=[a].append(ans_head)
  else:
    insert_index = bisect.bisect_left(ans_head,a)
    ans_head[insert_index-1]=a

  #print(ans_head)
print(len(ans_head))
Problem p02983 (python)

Fixed submission:
def baisuaru(l,r,m):
  if l//m < r//m:
    return True
  elif l%m==0:
    return True
  else:
    return False
    

l,r = map(int, input().split())


if baisuaru(l,r,2019):
  print(0)
else:
  if baisuaru(l,r,3) and baisuaru(l,r,673):
    print(0)
  else:
    a=l%2019
    b=r%2019
    ans=99999999
    for i in range(a,b+1):
      for j in range(i+1,b+1):
        tmpans=(i*j)%2019
        if ans>tmpans:
          ans=tmpans
    print(ans)

Buggy submission (verdict: Runtime Error):
l,r = map(int, input().split())


a=l%2019
b=r%2019
ans=99999999
for i in range(a,b+1):
  for j in range(i+1,b+1):
  tmpans=(i*j)%2019
  if ans>tmpans:
    ans=tmpans
print(ans)
Problem p03006 (python)

Fixed submission:
n = int(input())

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

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

balls.sort()  
sorted(balls, key=lambda x: x[1])

hyo={}

for i in range(n):
  for j in range(i+1,n):
    difx=balls[j][0]-balls[i][0]
    dify=balls[j][1]-balls[i][1]
    if (difx,dify) in hyo.keys():
      hyo[(difx,dify)] +=1
    else:
      hyo[(difx,dify)] =1

#print(hyo)
p,q=max(hyo,key=hyo.get)

chk=[1]*n

for i in range(n-1,-1,-1):
  x=balls[i][0]-p
  y=balls[i][1]-q
  if [x,y] in balls:
    chk[i]=0
#print(balls)
#print(chk)
print(sum(chk))

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

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

balls.sort()  
sorted(balls, key=lambda x: x[1])

hyo={}

for i in range(n):
  for j in range(i+1,n):
    difx=balls[j][0]-balls[i][0]
    dify=balls[j][1]-balls[i][1]
    if (difx,dify) in hyo.keys():
      hyo[(difx,dify)] +=1
    else:
      hyo[(difx,dify)] =1

#print(hyo)
p,q=max(hyo,key=hyo.get)

chk=[1]*n

for i in range(n-1,-1,-1):
  x=balls[i][0]-p
  y=balls[i][1]-q
  if [x,y] in balls:
    chk[i]=0
#print(balls)
#print(chk)
print(sum(chk))
Problem p03007 (python)

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

tasug=[]
hikug=[]
for i in range(n):
  if a[i]<0:
    hikug.append(a[i])
  else:
    tasug.append(a[i])

if len(hikug)==0:
  tasug.sort()
  ans=sum(tasug)-2*tasug[0]
  print(ans)
  for i in range(len(tasug)-1):
    if i ==0:
      print(tasug[0],tasug[1])
      a=tasug[0]-tasug[i]
    elif i==1:
      continue
    else:
      print(a,tasug[i])
      a=a-tasug[i]
  if not n==2:
    print(tasug[len(tasug)-1],a)
  
  
elif len(tasug)==0:
  hikug.sort()
  ans=-sum(hikug)+2*hikug[n-1]
  print(ans)
  for i in range(n-1):
    if i ==0:
      a=hikug[n-1]

    print(a,hikug[i])
    a=a-hikug[i]

else:
  ans=sum(tasug)-sum(hikug)
  print(ans)
  if len(tasug)==1:
    for i in range(len(hikug)):
      if i ==0:
        print(tasug[0],hikug[i])
        a=tasug[0]-hikug[i]
      else:
        print(a,hikug[i])
        a=a-hikug[i]
  else:
    for i in range(len(tasug)-1):
      if i ==0:
        print(hikug[0],tasug[i])
        a=hikug[0]-tasug[i]
      else:
        print(a,tasug[i])
        a=a-tasug[i]

    print(tasug[len(tasug)-1],a)
    a=tasug[len(tasug)-1]-a
  
    for i in range(1,len(hikug)):
      print(a,hikug[i])
      a=a-hikug[i]

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

tasug=[]
hikug=[]
for i in range(n):
  if a[i]<0:
    hikug.append(a[i])
  else:
    tasug.append(a[i])

if len(hikug)==0:
  tasug.sort()
  ans=sum(tasug)-2*tasug[0]
  print(ans)
  for i in range(len(tasug)-1):
    if i ==0:
      print(tasug[0],tasug[1])
      a=tasug[0]-tasug[i]
    elif i==1:
      continue
    else:
      print(a,tasug[i])
      a=a-tasug[i]
  if not n==2:
    print(tasug[len(tasug)-1],a)
  
  
elif len(tasug)==0:
  hikug.sort()
  ans=-sum(hikug)+2*hikug[n-1]
  print(ans)
  for i in range(n-1):
    if i ==0:
      a=hikug[n-1]

    print(a,hikug[i])
    a=a-hikug[i]

else:
  ans=sum(tasug)-sum(hikug)
  print(ans)
  for i in range(len(tasug)-1):
    if i ==0:
      print(hikug[0],tasug[i])
      a=hikug[0]-tasug[i]
    else:
      print(a,tasug[i])
      a=a-tasug[i]

  print(tasug[len(tasug)-1],a)
  a=tasug[len(tasug)-1]-a

  for i in range(1,len(hikug)):
    print(a,hikug[i])
    a=a-hikug[i]
Problem p03078 (python)

Fixed submission:
x,y,z,k = map(int, input().split())
a= list(map(int, input().split()))
b= list(map(int, input().split()))
c= list(map(int, input().split()))

a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)

ansListab=[]
for i in range(x):
  for j in range(y):
    ansListab.append(a[i]+b[j])

ansListab.sort(reverse= True)

if len(ansListab)>k:
  ansListab=ansListab[0:k]

ansList=[]

for i in c:
  for j in ansListab:
    ansList.append(i+j)

ansList.sort(reverse= True)

for i in range(k):
  print(ansList[i])

Buggy submission (verdict: Runtime Error):
x,y,z,k = map(int, input().split())
a= list(map(int, input().split()))
b= list(map(int, input().split()))
c= list(map(int, input().split()))

if x>50:
  a.sort()
  a.reverse()
  a=a[0:50]

if y>50:
  b.sort()
  b.reverse()
  b=b[0:50]

if z>50:
  c.sort()
  c.reverse()
  c=c[0:50]

ansList=[]
for m in range(50):
  for n in range(50):
    for o in range(50):
      ansList.append(a[m]+b[n]+c[o])

ansList.sort()
ansList.reverse()

for i in range(k):
  print(ansList[i])

Buggy submission (verdict: Runtime Error):
x,y,z,k = map(int, input().split())
a= list(map(int, input().split()))
b= list(map(int, input().split()))
c= list(map(int, input().split()))

if x>200:
  a.sort()
  a.reverse()
  a=a[0:200]

if y>200:
  b.sort()
  b.reverse()
  b=b[0:200]

if z>200:
  c.sort()
  c.reverse()
  c=c[0:200]

ansList=[]
for m in range(x):
  for n in range(y):
    for o in range(z):
      ansList.append(a[m]+b[n]+c[o])

ansList.sort()
ansList.reverse()

for i in range(k):
  print(ansList[i])
Problem p03192 (python)

Fixed submission:
n=input()

ans=0
for i in range(len(n)):
  if n[i]=="2":
    ans+=1
print(ans)

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

if n==1:
  print(p)
else:
  ans=1
  for i in range(1,int(p**(1/n))+2):
    tmp=i**n
    if (p>=tmp) and (p%tmp == 0):
     ans=i
    if(p<tmp):
      break
  print(ans)
Problem p03200 (python)

Fixed submission:
s=list(input())

ima=0
wNum=0
for i in range(len(s)):
  if s[i]=="W":
    ima += i
    wNum += 1

def kasan(n):
  if n==0:
    return 0
  else:
    return kasan(n-1) + n

saigo = ((wNum-1)+0)*wNum//2
print(ima-saigo)

Buggy submission (verdict: Runtime Error):
s=list(input())

ima=0
wNum=0
for i in range(len(s)):
  if s[i]=="W":
    ima += i
    wNum += 1

def kasan(n):
  if n==0:
    return 0
  else:
    return kasan(n-1) + n
if wNum==0:
  print(0)
else:
  saigo = kasan(wNum-1)
  print(ima-saigo)
Problem p03241 (python)

Fixed submission:
import math

n,m = map(int, input().split())

x=int(math.sqrt(m))

ans=1
for i in range(1,x+1):
  if m%i==0:
    if i*n<=m:
      ans=max(ans,i)
    if int(m/i)*n<=m:
      ans=max(ans,int(m/i))
print(ans)

Buggy submission (verdict: Runtime Error):
import math

n,m = map(int, input().split())

x=int(math.sqrt(m))

ans=1
for i in range(1,x+1):
  if i*n<=m:
    if i <= y:
      ans=max(ans,i)
    if (m/i)*n<=m:
      ans=max(ans,m/i)
print(ans)

Buggy submission (verdict: Runtime Error):
import math

n,m = map(int, input().split())

x=math.floor(m/n)

ans=[]
for i in range(2,x+1):
  if(m % i==0):
    ans.append(i)

ans.sort()
ans.reverse()
print(ans[0])
Problem p03244 (python)

Fixed submission:
import collections

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

gusuList=[]
kisuList=[]

for i in range(n):
  if(i % 2==0):
    gusuList.append(vList[i])
  else:
    kisuList.append(vList[i])
#print(gusuList)
#print(kisuList)

g = collections.Counter(gusuList)
gStatus=g.most_common()

k = collections.Counter(kisuList)
kStatus=k.most_common()

ans=-100
if(not gStatus[0][0]==kStatus[0][0]):
    ans=(n/2-gStatus[0][1])+(n/2-kStatus[0][1])
else:
    ans1=-101
    ans2=-102
    if(not len(kStatus)==1):
      ans1=(n/2-gStatus[0][1])+(n/2-kStatus[1][1])
    else:
      ans1=(n/2-gStatus[0][1])+n/2

    if(not len(gStatus)==1):
      ans2=(n/2-gStatus[1][1])+(n/2-kStatus[0][1])
    else:
      ans2=n/2+(n/2-kStatus[0][1])

    ans=min(ans1,ans2)

print(int(ans))

Buggy submission (verdict: Runtime Error):
import collections


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

gusuList=[]
kisuList=[]

for i in range(n):
  if(i % 2==0):
    gusuList.append(vList[i])
  else:
    kisuList.append(vList[i])
#print(gusuList)
#print(kisuList)

g = collections.Counter(gusuList)
gStatus=g.most_common()

k = collections.Counter(kisuList)
kStatus=k.most_common()

ans=-100

if(not gStatus[0][0]==kStatus[0][0]):
    ans=(n/2-gStatus[0][1])+(n/2-kStatus[0][1])
else:
  if(gStatus[0][1]>kStatus[0][1]):
    if(not len(kStatus)==1):
      ans=(n/2-gStatus[0][1])+(n/2-kStatus[1][1])
    else:
      ans=(n/2-gStatus[0][1])+n/2
  elif(gStatus[0][1]<kStatus[0][1]):
    if(not len(gStatus)==1):
      ans=(n/2-gStatus[1][1])+(n/2-kStatus[0][1])
    else:
      ans=n/2+(n/2-kStatus[0][1])
  elif(gStatus[0][1]==kStatus[0][1]):
      if(gStatus[1][1]>=kStatus[1][1]):
        if(not len(kStatus)==2):
          ans=(n/2-gStatus[0][1])+(n/2-kStatus[2][1])
        else:
          ans=(n/2-gStatus[0][1])+(n/2-kStatus[1][1])
      elif(gStatus[0][1]<kStatus[0][1]):
        if(not len(gStatus)==2):
          ans=(n/2-gStatus[2][1])+(n/2-kStatus[0][1])
        else:
          ans=(n/2-gStatus[1][1])+(n/2-kStatus[0][1])
      
    
    
print(int(ans))