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

Fixed submission:
m = list(map(int, input().split()))
A = m[0]
B = m[1]
K = m[2]

ans = []

for v in range(A, min(A+K, B)):
    ans.append(v)
for v in range(max(B-K+1, A), B+1):
    ans.append(v)

ans = sorted(list(set(ans)))
for v in ans:
    print(v)

Buggy submission (verdict: Runtime Error):
m = list(map(int, input().split()))
A = m[0]
B = m[1]
K = m[2]

g = list(range(A, B+1))

if len(g) <= 2*K:
    for v in g:
        print(v)
else:
    for i in range(K):
        print(g[i])
    for i in range(len(g)-K, len(g)):
        print(g[i])

Buggy submission (verdict: Runtime Error):
m = list(map(int, input().split()))
A = m[0]
B = m[1]
K = m[2]

g = list(range(A, B+1))
print(g)

if len(g) <= 2*K:
    for v in g:
        print(v)
else:
    for i in range(K):
        print(g[i])
    for i in range(len(g)-K, len(g)):
        print(g[i])
Problem p03338 (python)

Fixed submission:
N = int(input())
str = input()
str_list=list(str)
ans_list=[]
for i in range (N):
  str_first = str_list[0:i+1]
  str_second = str_list[i+1:]
  answer = len(list(set(str_first) & set(str_second)))
  ans_list.append(answer)
  
print(max(ans_list))

Buggy submission (verdict: Runtime Error):
N = input()
str = input()
str_list=list(str)
ans_list=[]
for i in range N:
  str_first = str_list[0:i+1]
  str_second = str_list[i:]
  answer = set(str_first) & set(str_second)
  ans_list.append(answer)
  
print(max(ans_list))
Problem p03339 (python)

Fixed submission:
N = int(input())
str = input()
str_list=list(str)
num_list=[]
ans_list=[]
num=0
for i in range (N):
  if str_list[i]=="E":
    num=num+1
    num_list.append(num)
  else:
    num_list.append(num)
   
for i in range (N):
  if i==0:
    ans=num_list[N-1]-num_list[i]
    ans_list.append(ans)
  else:
    ans=num_list[N-1]-num_list[i]+i-num_list[i-1]
    ans_list.append(ans)

print(min(ans_list))

Buggy submission (verdict: Runtime Error):
N = int(input())
str = input()
str_list=list(str)
pre_list=[]
length_list=[]
answer_list=[]
answer_first=0
answer_second=0
for i in range (N-1):
  if str_list[i] != str_list[i+1]:
    pre_list.append(i)
    if pre_list == []:
      print("0")
      sys.exit()
    lenlen=len(pre_list)
for i in range (lenlen-1):
  length_list.append(pre_list[i+1]-pre_list[i])
  if lenlen=1:
    for i in range (N):
      if str_list[i] == "E":
        seki = -1
        else:
          seki = 1
          point = (i-pre_list[0])*seki
          if point<0:
            answer_first = answer_first+1
    print(answer_first)
    sys.exit()
basyo = length_list.index(max(length_list))
basyo2_kouho1 = pre_list[basyo]
basyo2_kouho2 = pre_list[basyo+1]
for i in range (N):
  if str_list[i] == "E":
    seki = -1
  else:
    seki = 1
  point = (i-basyo2_kouho1)*seki
  if point<0:
    answer_first = answer_first+1
for i in range (N):
  if str_list[i] == "E":
    seki = -1
  else:
    seki = 1
  point = (i-basyo2_kouho2)*seki
  if point<0:
    answer_second = answer_second+1
if answer_first>=answer_second:
  print(answer_second)
else:
  print(answer_first)

Buggy submission (verdict: Runtime Error):
N = int(input())
str = input()
str_list=list(str)
pre_list=[]
length_list=[]
answer_list=[]
answer_first=0
answer_second=0
for i in range (N-1):
  if str_list[i] != str_list[i+1]:
    pre_list.append(i)
    lenlen=len(pre_list)
for i in range (lenlen-1):
  length_list.append(pre_list[i+1]-pre_list[i])
basyo = length_list.index(max(length_list))
basyo2_kouho1 = pre_list[basyo]
basyo2_kouho2 = pre_list[basyo+1]
for i in range (N):
  if str_list[i] == "E":
    seki = -1
  else:
    seki = 1
  point = (i-basyo2_kouho1)*seki
  if point<0:
    answer_first = answer_first+1
for i in range (N):
  if str_list[i] == "E":
    seki = -1
  else:
    seki = 1
  point = (i-basyo2_kouho2)*seki
  if point<0:
    answer_second = answer_second+1
if answer_first>=answer_second:
  print(answer_second)
else:
  print(answer_first)
Problem p03370 (python)

Fixed submission:
sum = 0
a, b = (int(i) for i in input().split())  
t = [int(input()) for j in range(a)] 
for k in range (a):
    b = b - t[k]
    sum = sum + 1
t.sort()
if b < t[0]:
    print(sum)
else:
    z = b // t[0]
    sum = sum + z
    print(sum)

Buggy submission (verdict: Runtime Error):
sum = 0
answer = 900
a, b = (int(i) for i in input().split())  
t = [int(input()) for j in range(a)] 
for k in range a:
    b = b - t[k]
    sum = sum + 1
t = t.sort()
z = b % t[0]
sum = sum + z
print(sum)
Problem p03377 (python)

Fixed submission:
A,B,C=map(int, input().split())
if C>=A and A+B>=C:
    print("YES")
else:
    print("NO")

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

Buggy submission (verdict: Runtime Error):
A,B,C=map(int, iput().split())
if C>A && A+B>C:
    print("YES")
else:
    print("NO")
Problem p03434 (python)

Fixed submission:
n = input()
lst = sorted([int(x) for x in input().split()], reverse=True)
alice = 0
bob = 0
for i in range(len(lst)):
    if i%2:
        bob += lst[i]
    else:
        alice += lst[i]
print(alice-bob)

Buggy submission (verdict: Runtime Error):
n = input()
lst = sorted([int(x) for x in input().split()], reverse=True)
alice = 0
bob = 0
for i in range(len(lst)):
    if i%2:
        bob += lst[I]
    else:
        alice += lst[i]
print(alice-bob)

Buggy submission (verdict: Runtime Error):
n = input()
lst = sorted([int(x) for x in input().split()], reverse=True)
alice = 0
bob = 0
while len(lst)>0:
    alice += lst.pop(0)
    bob += lst.pop(0)
print(alice-bob)

Buggy submission (verdict: Runtime Error):
n = input()
lst = [int(x) for x in input().split()].sort()
alice = 0
bob = 0
while len(lst)>0:
    alice += lst.pop(0)
    bob += lst.pop(0)
print(alice-bob)

Buggy submission (verdict: Runtime Error):
n = input()
lst = [int(x) for x in input().split()].sort()
alice = 0
bob = 0
while len(lst):
    alice += lst.pop(0)
    bob += lst.pop(0)
print(alice-bob)
Problem p03455 (python)

Fixed submission:
a, b = map(int, input().split())
if (a*b) % 2:
  print('Odd')
else:
  print('Even')

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split)
if (a*b)%2==0:
  print('Even')
else:
  print('Odd')
Problem p03470 (python)

Fixed submission:
n = int(input())
print(len(set([int(input()) for x in range(n)])))

Buggy submission (verdict: Runtime Error):
n = int(input())
lst = [int(input()) for x in range(n)]
if n==1:
    print(1)
    break
else:
    split_info = [0] + [i for i in range(1, n) if lst[i-1]<=lst[i]] + [n-1]
    if len(split_info)==2:
        print(n)
        break
    result = [len(lst[split_info[i]:split_info[i+1]]) for i in range(len(split_info)-1)]
print(max(result))
Problem p03478 (python)

Fixed submission:
n, a, b = [int(x) for x in input().split()]
count = 0
for i in range(a, n+1):
    if a <= sum([int(x) for x in list(str(i))]) <= b:
        count += i
print(count)

Buggy submission (verdict: Runtime Error):
n, a, b = [int(x) for x in input().split()]
count = 0
for i in range(a, n+1):
	  if sum([int(x) for x in list(str(i))]) > b:
      	continue
      count += 1
print(count)

Buggy submission (verdict: Runtime Error):
n, a, b = [int(x) for x in input().split()]
count = 0
for i in range(a, n+1):
	  if sum(list(str(i))) > b:
      	continue
      i += 1
print(i)
Problem p03493 (python)

Fixed submission:
lst = [int(x) for x in list(input())]
print(sum(lst))

Buggy submission (verdict: Runtime Error):
lst = list(input())
print(sum(lst))
Problem p03331 (python)

Fixed submission:
n = list(map(int, list(input())))
 
if n[0] == 1 and sum(n)  == 1:
    print(10)
else:
    print(sum(n))

Buggy submission (verdict: Runtime Error):
digit(num):
    sum = 0
    while(num > 0):
        sum += num % 10
        num = int(num / 10)
    return sum
 
 
for a in range(2,n):
    sum_A =sum_digit(a)
    sum_B =sum_digit(n-a)
    all=min(all,(sum_A + sum_B))

print(all)
Problem p03448 (python)

Fixed submission:
a, b, c, x = map(int, [input() for i in range(4)])
ans = 0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if i * 500 + j * 100 + k * 50 == x:
                ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
a,b,c,x = map(int,[input() for i in range(4)]):
ans = 0
  
for i in range(a+1):
  for j in range(b+1):
    for f in range(c+1):
      if i*500 + j*100 + f*50 == x:
        ans +=1:
            
print(ans)

Buggy submission (verdict: Runtime Error):
a,b,c,x = map(int,[input() for i in range(4)]):
ans = 0
  
  for i in range(a+1):
    for j in range(b+1):
      for f in range(c+1):
        if i*500 + j*100 + f*50 == x:
          ans +=1:
            
print(ans)

Buggy submission (verdict: Runtime Error):
a,b,c,x = map(int,[input() for i in range(4)]):
ans = 0:
  
  for i in range(a+1):
    for j in range(b+1):
      for f in range(c+1):
        if i*500 + j*100 + f*50 == x:
          ans +=1:
            
print(ans):

Buggy submission (verdict: Runtime Error):
a,b,c,x = map(int,[input() for i in range(4)]):
ans = 0:
  
  for i in range(a+1):
    for i in range(b+1):
      for i in range(c+1):
        if a*500 + b*100 + c*50 == x:
          ans +=1:
            
print(ans):
Problem p03478 (python)

Fixed submission:
n, a, b = map(int, input().split())
ans = 0
for i in range(n+1):
    if a <= sum(list(map(int, list(str(i))))) <= b:
        ans += i
print(ans)

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

for i in range(n+1):
    if a<= sum(list(map(int,list(str(i))) <=b:
        ans += i
print(ans)

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

for i in range(n+1):
    if a<= sum(list(map(int,list(str(i))) <=b:
        ans += i
print(ans)

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

for i in range(n+1):
    if a<= sum(map(int,list(str(i))) <=b:
        ans += i
print(ans)

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

for i in range(n+1):
    if a<= sum(list(map(int,list(str(i))) <=b
        ans += i
print(ans)

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

for i in range(n+1):
    if a<= sum(map(int,list(str(i))) <=b
        ans += i
print(ans)


n, a, b = map(int, input().split())
ans = 0
for i in range(n+1):
    if a <= sum(list(map(int, list(str(i))))) <= b:
        ans += i
print(ans)

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

for i in range(n+1):
    if a<= sun(list(map(int,list(str(i)))) <=b
        ans += i
print(ans)

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

for i in range(n+1):
    if a<= sun(map(int,list(str(i))) <=b
        ans += i
print(ans)

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

for i in range(n+1):
    if a<= sun(map(int,list(str(i))) <=b:
        ans += i
print(ans)
Problem p03658 (python)

Fixed submission:
k = int(input().split()[1])
sticks = sorted(list(map(int,input().split())),reverse=True)

total = 0

for i in range(k):
    total += sticks[i]

print(total)

Buggy submission (verdict: Runtime Error):
k = int(input().split('')[1])
sticks = sorted(list(map(int,input().split())),reverse=True)

total = 0

for i in range(k):
    total += sticks[i]

print(total)

Buggy submission (verdict: Runtime Error):
k = input().split('')[1]
sticks = sorted(list(map(int,input().split(''))),reverse=True)

total = 0

for i in range(k):
    total += sticks[i]

print(total)

Buggy submission (verdict: Runtime Error):
n = input().split('')[0]
k = input().split('')[1]

sticks = sorted(map(int,input().split('')),reverse=True)

total = 0

for i in range(k):
    total += sticks[i]

print(total)
Problem p03470 (python)

Fixed submission:
n = int(input())
print(len(set(map(int, [input() for i in range(n)]))))

Buggy submission (verdict: Runtime Error):
N = int(input())
ds = list(int(input().split('\n')))

num = set(ds).length()

print(num)
Problem p03471 (python)

Fixed submission:
n, y = map(int, input().split())
for i in range(n + 1):
    for j in range(n - i + 1):
        if i * 10000 + j * 5000 + (n - i - j) * 1000 == y:
            print(i, j, n - i - j)
            exit()
print("-1 -1 -1")

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

for i in range(n + 1):
    for f in range(n - i + 1):
        if i *10000 + j * 5000 * (n-i-j) * 1000 == y:
            print(i, j, n-i-j)
            exit()
print("-1 -1 -1")
Problem p03651 (python)

Fixed submission:
def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a % b)

def solve():
    n, k = list(map(int, input().strip().split()))
    a = list(map(int, input().strip().split()))

    m = a[0]
    maxx = a[0]
    for i in range(1, n):
        m = gcd(m, a[i])
        if a[i] > maxx:
            maxx = a[i]

    if k % m == 0 and k <= maxx:
        return "POSSIBLE"
    else:
        return "IMPOSSIBLE"

print(solve())

Buggy submission (verdict: Runtime Error):
from math import gcd

def solve():
    n, k = list(map(int, input().strip().split()))
    a = list(map(int, input().strip().split()))

    m = a[0]
    maxx = a[0]
    for i in range(1, n):
        m = gcd(m, a[i])
        if a[i] > maxx:
            maxx = a[i]

    if k % m == 0 and k <= maxx:
        return "POSSIBLE"
    else:
        return "IMPOSSIBLE"

print(solve())

Buggy submission (verdict: Runtime Error):
from math import gcd

def solve():
    n, k = list(map(int, input().strip().split()))
    a = list(map(int, input().strip().split()))

    m = a[0]
    maxx = a[0]
    for i in range(1, n):
        m = gcd(m, a[i])
        if a[i] > maxx:
            maxx = a[i]

    if k % m == 0 and k <= maxx:
        return "POSSIBLE"
    else:
        return "IMPOSSIBLE"

print(solve())
Problem p03385 (python)

Fixed submission:
S = input()
T = "abc" 
ans = "Yes"
for t in T:
    if t in S:
        continue
    else:
        ans = "No"
        break
print(ans)

Buggy submission (verdict: Runtime Error):
S = input()
ans = "Yes"
for s in S:
    if s in "abc":
        
    else:
        ans = "No"
        break:
print(ans)
Problem p03419 (python)

Fixed submission:
N,M = map(int, input().split())
if N==1 and M==1:
    print(1)
elif N<3 and M<3:
    print(0)
elif N==1 or M==1:
    print(max(N-2,M-2))
elif N==2 or M==2:
    print(0)
else:
    print(max(N-2,1)*max(M-2,1))

Buggy submission (verdict: Runtime Error):
N = int(input())
a,b,c,d = [0]*N,[0]*N,[0]*N,[0]*N
for i in range(N):
    a[i],b[i] = map(int,input().split())
for i in range(N):
    c[i],d[i] = map(int,input().split())

e = [(0,"")]*2*N
for i in range(N):
    e[a[i]] = (b[i],"R")
    e[c[i]] = (d[i],"B")

ans,p = 0,0
for i in range(2*N):
    n,c = e[i]
    if c == "R":
        p += 1
        if p > 0:
            ans += 1
    else:
        p -= 1

print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
a,b,c,d = [0]*N,[0]*N,[0]*N,[0]*N
for i in range(N):
    a[i],b[i] = map(int,input().split())
for i in range(N):
    c[i],d[i] = map(int,input().split())

ans=0
for k in range(N):
    for i in range(N):
        if a[i] == k or b[i] == k:
            ans += 1
            a.pop(i)
            b.pop(i)
            break
        elif c[i] == k or d[i] == k:
            c.pop(i)
            d.pop(i)

print(ans)
Problem p03427 (python)

Fixed submission:
N = int(input())
l = len(str(N))-1
print(l*9 + ((N+1)//(10**l)-1))

Buggy submission (verdict: Runtime Error):
N = input()
l = len(str(N))-1
print(l*9 + (N//(10**l)-1))
Problem p03673 (python)

Fixed submission:
n = int(input())
a = input().split()
if n%2 == 0:
    s = a[::-2]+a[::2]
else:
    s = a[::-2]+a[1::2]
print(" ".join(s))

Buggy submission (verdict: Runtime Error):
n - int(input())
a = input().split()
s = a[::-2]+a[::2]
print(" ".join(s))
Problem p03371 (python)

Fixed submission:
A, B, C, X, Y = list(map(int, input().split()))
a, b, c = 0, 0, 0
if(A + B <= 2*C):
    a, b = X, Y
else:
    c = min(X, Y) * 2
    if(X > Y):
        if(A > 2*C):
            c += (X - Y) * 2
        else:
            a = (X - Y)
    else:
        if(B > 2*C):
            c += (Y - X) * 2
        else:
            b = (Y - X)


price = a*A + b*B + c*C
print(price)

Buggy submission (verdict: Runtime Error):
A, B, C, X, Y = list(map(int, input().split()))
if(A + B <= 2*C):
    a, b = X, Y
else:
    c = min(X, Y) * 2
    if(X > Y):
        if(A > 2*C):
            c += (X - Y) * 2
        else:
            a = (X - Y)
    else:
        if(B > 2*C):
            c += (Y - X) * 2
        else:
            b = (Y - X)


price = a*A + b*B + c*C
print(price)
Problem p03407 (python)

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

if a + b >= c:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
a, b, c = list(map(int, input().split))
 
if a + b >= c:
  print('Yes')
else:
  print('No')

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

if a + b > c:
  print('Yes')
else:
  print('No')
Problem p03425 (python)

Fixed submission:
N = int(input())

name_capital = {
    'M': 0,
    'A': 0,
    'R': 0,
    'C': 0,
    'H': 0,
}
name_list = ['M', 'A', 'R', 'C', 'H']
for _ in range(N):
    name = input()
    for word in name_list:
        if name[0] == word:
            name_capital[word] += 1
            break

nv = list(name_capital.values())
N2 = len(nv)
answer = 0
for i in range(N2-2):
    for j in range(i+1, N2-1):
        for k in range(j+1, N2):
            answer += nv[i] * nv[j] * nv[k]

print(answer)

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

name_capital = {
    'M': 0,
    'A': 0,
    'R': 0,
    'C': 0,
    'H': 0,
}
name_list = ['M', 'A', 'R', 'C', 'H']
for _ in range(N):
    name = input()
    for word in name_list:
        if name[0] == word:
            name_capital[word] += 1
            break

nv = list(name_capital.values())
answer = 0
for i in range(N-2):
    for j in range(i+1, N-1):
        for k in range(j+1, N):
            answer += nv[i] * nv[j] * nv[k]

print(answer)
Problem p03435 (python)

Fixed submission:
import numpy as np

grid = np.array([])
for _ in range(3):
    list1 = list(map(int, input().split()))
    grid = np.append(grid, list1)

grid = grid.reshape(3, 3)
grid2 = np.vstack((grid[1:3, :], grid[0, :]))
judge = grid - grid2
judge = judge.transpose()
judge2 = np.copy(judge)
judge2 = np.vstack((judge2[1:3, :], judge2[0, :]))
new_judge = judge - judge2

if np.allclose(new_judge, np.zeros_like(new_judge)):
    print('Yes')
else:
    print('No')

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

grid = np.array([])
for _ in range(3):
    list1 = list(map(int, input().split()))
    grid = np.append(grid, list1)

grid = grid.reshape(3, 3)
grid2 = np.vstack((grid[1:3, :], grid[0, :]))
judge = grid - grid2
judge = judge.transpose()
judge2 = np.copy(judge)
judge2 = np.vstack((judge2[1:3, :], judge2[0, :]))
new_judge = judge - judge2

if new_judge == np.zeros(3, 3):
    print('Yes')
else:
    print('No')
Problem p03583 (python)

Fixed submission:
def main():
    N = input()

    for h in range(1, 3501):
        for n in range(1, 3501):
            r1 = h * n * N
            r2 = 4 * h * n - h * N - n * N
            if r2 > 0 and r1 % r2 == 0:
                print "%d %d %d" % (h, n, r1 / r2)
                return

main()

Buggy submission (verdict: Runtime Error):
def main():
    N = input()

    for h in range(1, 3501):
        for n in range(1, 3501):
            r1 = h * n * N
            r2 = 4 * h * n - h * N - n * N
            if r2 > 0 and r1 % r2 == 0:
                print "%d %d %d" % (h, n, r1 / r2)
                return

main()

Buggy submission (verdict: Runtime Error):
def main():
    N = input()

    for h in range(1, 3501):
        for n in range(1, 3501):
            r1 = h * n * N
            r2 = 4 * h * n - h * N - n * N
            if r2 > 0 and r1 % r2 == 0:
                print("{} {} {}".format(h, n, r1 // r2))
                return

main()
Problem p03643 (python)

Fixed submission:
a=input()
b='ABC'
print(b + a)

Buggy submission (verdict: Runtime Error):
a=input()
print('ABC'　+a)

Buggy submission (verdict: Runtime Error):
a=input()
print('ABC'a)

Buggy submission (verdict: Runtime Error):
a=input()
print(ABC)
print(a)

Buggy submission (verdict: Runtime Error):
a=imput()
print(ABC)
print(a)
Problem p03337 (python)

Fixed submission:
li = list(map(int,input().split()))
ans = [li[0]+li[1],li[0]-li[1],li[0]*li[1]]
ans.sort()
print(ans[2])

Buggy submission (verdict: Runtime Error):
n = int(input())
li = list(input())
ans = 0
for i in range(n):
  fi = li[:i-1]
  se = li[i+1:]
  hoge = fi.count('E') + se.count('W')
  if ans < hoge:
    ans = hoge
 
print(n - ans - 1)

Buggy submission (verdict: Runtime Error):
num = int(input())
li = list(input())
ans = 0
for i in range(num):
  fi = set(li[:i])
  se = set(li[i:])
  hoge = len(list(fi & se))
  if hoge > ans:
    ans = hoge
 
print(ans)

Buggy submission (verdict: Runtime Error):
num = int(input())
li = list(input())
i = int(num/2)
while(i<int((num/2)+1)):
  fi = set(li[:i])
  se = set(li[i:])
  ans = len(list(fi & se))
  if i < ans:
    i = ans
  else:
    i = i+1    
 
print(i)

Buggy submission (verdict: Runtime Error):
num = int(input())
li = list(input())
i = int(num/2)
while(i<int(num/2)+1):
  fi = set(li[:i])
  se = set(li[i:])
  ans = len(list(fi & se))
  if i < ans:
    i = ans
  else:
    i = i+1    
 
print(i)

Buggy submission (verdict: Runtime Error):
num = int(input())
li = list(input())
i = int(num/2)
while(i>num/2):
  fi = set(li[:i])
  se = set(li[i:])
  ans = len(list(fi & se))
  if i < ans:
    i = ans
  else:
    i = i+1    
 
print(i)

Buggy submission (verdict: Runtime Error):
li = list(map(int,input().split()))
ans = [li[0]+li[1],li[0]-li[1],li[0]*li[1]]
ans.sort()
print(ans[3])

Buggy submission (verdict: Runtime Error):
li = list(map(int,input().split()))
ans = [li[0]+li[1],li[0]-li[1],li[1]-li[0],li[0]*li[1]].sort()
print(ans[3])

Buggy submission (verdict: Runtime Error):
li = input().split()
ans = [li[0]+li[1],li[0]-li[1],li[1]-li[0],li[0]*li[1]].sort()
print(ans[3])
Problem p03338 (python)

Fixed submission:
num = int(input())
li = list(input())
ans = 0
for i in range(num):
  fi = set(li[:i])
  se = set(li[i:])
  hoge = len(list(fi & se))
  if hoge > ans:
    ans = hoge
 
print(ans)

Buggy submission (verdict: Runtime Error):
num = int(input())
li = list(input())
i = int(num/2)]
ans = 0
for i in range(num):
  fi = set(li[:i])
  se = set(li[i:])
  hoge = len(list(fi & se))
  if hoge > ans:
    hoge = ans
 
print(hoge)
Problem p03339 (python)

Fixed submission:
#https://qiita.com/minemine0505/items/9aeae0f651f19f2ac1e2
N = int(input())
S = input()
min = S[1:N].count("E") #最小値を保存しておく
now = S[1:N].count("E") #i-1 を見ているときのそっぽ向いてる子の数

for i in range (1,N):
    if S[i-1] == "E" and S[i] == "E":
        now -= 1
    if S[i-1] == "W" and S[i] == "W":
        now += 1
    if now < min:
        min = now
print(min)

Buggy submission (verdict: Runtime Error):
//https://qiita.com/minemine0505/items/9aeae0f651f19f2ac1e2
N = int(input())
S = input()
min = S[1:N].count("E") #最小値を保存しておく
now = S[1:N].count("E") #i-1 を見ているときのそっぽ向いてる子の数

for i in range (1,N):
    if S[i-1] == "E" and S[i] == "E":
        now -= 1
    if S[i-1] == "W" and S[i] == "W":
        now += 1
    if now < min:
        min = now
print(min)
Problem p03339 (python)

Fixed submission:
def opt(N, S):
    if N == 1:
        return 0
    else:
        split = int(N/2)
        return min(opt(split,S[:split])+S[split:].count('E'),S[:split].count('W')+opt(N - split,S[split:]))

Num = int(raw_input())
Str = str(raw_input())
print(opt(Num, Str))

Buggy submission (verdict: Runtime Error):
N = int(raw_input())
S = str(raw_input())
opt_cnt = N
for i in range(N):
    first = S[:i]
    second = S[i+1:]
    cnt = 0
    for f in first:
        if f is not 'E':
            cnt = cnt + 1
        if cnt >= opt_cnt
            break
    for s in second:
        if s is not 'W':
            cnt = cnt + 1
        if cnt >= opt_cnt
            break
    if opt_cnt > cnt:
        opt_cnt = cnt
print(opt_cnt)