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

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

if N % 2 == 1:
  print("No")
else:
  half = int(N/2)
  ans = "Yes"
  for i in range(half):
    if S[i] != S[i+half]:
      ans = "No"
      break
  print(ans)

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

if N % 2 == 1:
  print("No")
else:
  half = N/2
  ans = "Yes"
  for i in range(half):
    if S[i] != S[i+half]:
      ans = "No"
      break
  print(ans)
Problem p02951 (python)

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

if A-B >= C:
  print(0)
else:
    print(C-A+B)

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

if A-B >= C:
  print(0)
else::
    print(C-A+B)
Problem p02987 (python)

Fixed submission:
S = input()
sl = list(S)

if sl[0]==sl[1] and sl[2]==sl[3] and sl[0]!=sl[2]:
  print("Yes")
elif sl[0]==sl[2] and sl[1]==sl[3] and sl[0]!=sl[1]:
  print("Yes")
elif sl[0]==sl[3] and sl[1]==sl[2] and sl[0]!=sl[1]:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
S = input()
sl = [*S]

if sl[0]==sl[1] and sl[2]==sl[3] and sl[0]!=sl[2]:
  print("Yes")
elif sl[0]==sl[2] and sl[1]==sl[3] and sl[0]!=sl[1]:
  print("Yes")
elif sl[0]==sl[3] and sl[1]==sl[2] and sl[0]!=sl[1]:
  print("Yes")
else:
  print("No")
Problem p03012 (python)

Fixed submission:
N = int(input())
W = list(map(int, input().split()))
ww = []
for i in range(N):
  ww.append(sum(W[0:i+1]))
ans = [abs((2 * q) - ww[N-1]) for q in ww]
print(min(ans))

Buggy submission (verdict: Runtime Error):
N = int(input())
W = list(map(int, input().split()))
ans = [abs(W[0:i+1] - W[i+1:]) for i in range(N-1)]
print(min(ans))

Buggy submission (verdict: Runtime Error):
N = int(input())
W = list(map(int, input().split()))
ans = [abs(W[0:i+1] - W[i+1:]) for i in range(N)]
print(min(ans))

Buggy submission (verdict: Runtime Error):
N = int(input())
W = []
for i in range(N):
  w = int(input())
  if i == 0:
    W.append(w)
    continue
    
  W.append(w + W[i-1])
  
ans = [abs((2 * q) - W[N-1]) for q in W]
print(min(ans))
Problem p02659 (python)

Fixed submission:
import sys
from decimal import Decimal
A,B= map(str,input().split())

A = Decimal(A)
B = Decimal(B)


print(int(A*B))

Buggy submission (verdict: Runtime Error):
A,B = map(int,input().split())
print(int(A*B))
Problem p02695 (python)

Fixed submission:
import itertools

N,M,Q = map(int,input().split())
li = []

for i in range(Q):
  li.append(list(map(int,input().split())))
li.sort(key = lambda x:x[3])
num = [i for i in range(1,M+1)] 
l = list(itertools.combinations_with_replacement(num, N))
max_sum=-1
for i in range(len(l)):
  s = 0
  for j in range(Q):
    if l[i][li[j][1]-1] -  l[i][li[j][0]-1] == li[j][2]:
      s+= li[j][3]
      
  max_sum = max(max_sum,s)
print(max_sum)

Buggy submission (verdict: Runtime Error):
import itertools

N,M,Q = map(int,input().split())
li = []

for i in range(Q):
  li.append(list(map(int,input().split())))
li.sort(key = lambda x:x[3])
num = [i for i in range(1,M+1)] 
l = list(itertools.combinations_with_replacement(num, M))
max_sum=-1
for i in range(len(l)):
  s = 0
  for j in range(Q):
    if l[i][li[j][1]-1] -  l[i][li[j][0]-1] == li[j][2]:
      s+= li[j][3]
      
  max_sum = max(max_sum,s)
print(max_sum)
Problem p02701 (python)

Fixed submission:

N = int(input())
ss = []
for i in range(N):
  ss.append(input())
  
print(len(set(ss)))

Buggy submission (verdict: Runtime Error):

import  numpy as np

arr = np.array([])
N = int(input())
for _ in range(N):
  arr = np.append(arr,input())
  
print(len(np.unique(arr)))
Problem p02771 (python)

Fixed submission:
a,b,c=input().split()
if a == b:
    if a != c:
        print('Yes')
    else:
        print("No")
elif a == c:
    if a != b:
        print('Yes')
    else:
        print("No")
elif b == c:
    if b != a:
        print('Yes')
    else:
        print("No")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
a,b,c=int(input().splot())
if a == b:
    if a != c:
        print('yes')
    else:
        print("no")
elif a == c:
    if a != b:
        print('yes')
    else:
        print("no")
else:
    print("no")

Buggy submission (verdict: Runtime Error):
a,b,c=int(input().splot())
if a == b:
    if a != c:
        print('yes')
    else:
        print("no")
elif a == c:
    if (a != b:
        print('yes')
    else:
        print("no")
else:
    print("no")
Problem p02773 (python)

Fixed submission:
import collections
import sys
input = sys.stdin.readline
num = int(input())
word_list = []
for i in range(num):
    word_list.append(input())
word_dict = collections.Counter(word_list)
most_common = word_dict.most_common()[0][1]
word_list = [k for k,v in word_dict.items() if v == most_common]
word_list.sort()
for word in word_list:
    print(word)

Buggy submission (verdict: Runtime Error):
import collections

num = int(input())
word_list = []
for i in range(num):
    word_list.append(input())
word_dict = collections.Counter(word_list)
word_list = [k for k,v in word_dict.items() if v == word_dict.most_common()[1][1]]
word_list.sort()
for word in word_list:
    print(word)
Problem p03207 (python)

Fixed submission:
N=int(input())
products=[int(input()) for i in range(N)]
print(sum(products)-max(products)//2)

Buggy submission (verdict: Runtime Error):
N=input()
products=[int(input()) for i in range(N)]
print(sum(products)-max(products)//2)
Problem p03315 (python)

Fixed submission:
s=input()
print(s.count('+')-s.count('-'))

Buggy submission (verdict: Runtime Error):
s=input()
print(s.count('+')-s.count.('-'))
Problem p03834 (python)

Fixed submission:
a, b, c = input().split(",")
print(a, b, c)

Buggy submission (verdict: Runtime Error):
a,b,c=input().sprit(',')
print(a,b,c)

Buggy submission (verdict: Runtime Error):
a,b,c=input().sprit(",")
print(a,b,c)
Problem p03835 (python)

Fixed submission:
K,S=map(int,input().split())
ans=0
for i in range(S+1):
  for j in range(S+1-i):
    if 0<=i<=K and 0<=j<=K and 0<=S-i-j<=K:
      ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
K,S=map(int,input().split())
ans=0
for i in range(S+1):
  for j in range(S+1-i):
    if 0<=i,j,S-i-j<=K:
      ans+=1
print(ans)
Problem p02693 (python)

Fixed submission:
K = int(input())
A, B = map(int, input().split())
for i in range(A,B+1):
  if i % K ==0:
    print("OK")
    exit()
else:
  print ("NG")

Buggy submission (verdict: Runtime Error):
K = int(input())
A, B = map(int, input().split())
for i in range(A:B+1):
  if i % K ==0:
    print("OK")
    exit()
else:
  print ("NG")
Problem p02659 (python)

Fixed submission:
from decimal import Decimal

a, b = input().split()
a = Decimal(a)
b = Decimal(b)
print(int(a*b))

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

print(int(a*b))
Problem p02659 (python)

Fixed submission:
from math import floor

a, b = input().split()
a = int(a)
b = round(float(b) * 100)
print(a * b // 100)

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

a, b = input().split()
a = int(a)
b = round(float(b) * 100)
print(a * b // 100)
Problem p02831 (python)

Fixed submission:
a, b =  list(map(int, input().split()))
def lcm(a):
    from fractions import gcd
    x = a[0]
    for i in range(1, len(a)):
        x = (x * a[i]) // gcd(x, a[i])
    return x

print(lcm([a,b]))  # 実行結果: 12

Buggy submission (verdict: Runtime Error):
a, b = list(map(int, input().split()))
import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
print(lcm(a,b))
Problem p03011 (python)

Fixed submission:
x = list(map(int, input().split()))
x.sort()
print(x[0]+x[1])

Buggy submission (verdict: Runtime Error):
s = list(map(int, input().split()))
n,m = s[0],s[1]
a = [int(input()) for i in range(m)]



if n == 1:
    print(1)

elif n == 2:
    if m == 0:
        print(2)
    elif m == 1:
        if a[0] == 2:
            print(0)
        else:
            print(1)
        
    
elif n == a[-1]:
    print(0)
    
else:
    if m == 0:
        t = -1
    else:
        c = 0
        t = a[c]-1
    x, y = 0, 1
    for i in range(n):
        if x == 0 and y == 0:
            break
        elif i == t:
            x, y = y, 0
            if a[c]-1 == a[-1]-1:
                continue
            else:
                c += 1
                t = a[c]-1
        else:
            x, y = y, x + y
    print(y%1000000007)
Problem p03075 (python)

Fixed submission:
x = [int(input()) for i in range(6)]
if x[4] - x[0] <= x[-1]: print("Yay!")
else: print(":(")

Buggy submission (verdict: Runtime Error):
x = list(map(int, input()))
if x[4] - x[0] < x[-1]:
    print("Yay!")
else:
    print(":(")

Buggy submission (verdict: Runtime Error):
x = list(map(int, input().split()))
if x[4] - x[0] < x[-1]:
    print("Yay!")
else:
    print(":(")
Problem p02987 (python)

Fixed submission:
s = input()

if len(set(s)) == 2 and s.count(s[0]) == 2:
  print('Yes')
else:
  print('No')

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

if len(set(s)) == 2 and l.count(s[0]) == 2:
  print('Yes')
else:
  print('No')
Problem p03053 (python)

Fixed submission:
from scipy import ndimage
import numpy as np

 
H, W = map(int, input().split())
 
A_array = np.array(
    [[0 if s == "#" else 1 for s in input()] for i in range(H)])
# print(A_array)
 
# print(A_array)
b = ndimage.morphology.distance_transform_cdt(
    A_array, metric="taxicab")
print(np.max(b))

Buggy submission (verdict: Runtime Error):
from scipy import ndimage
import numpy as np
import sys
 
H, W = map(int, input().split())
 
A_array = np.array(
    [[0 if s == "#" else 1 for s in input()[:-1]] for i in range(H)])
# print(A_array)
 
 
# print(A_array)
b = ndimage.morphology.distance_transform_cdt(
    A_array, metric="taxicab")
print(np.max(b))

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

 
H, W = map(int, input().split())
 
A_array = np.array(
    [[0 if s == "#" else 1 for s in input()[:-1]] for i in range(H)])
# print(A_array)
 
# print(A_array)
b = ndimage.morphology.distance_transform_cdt(
    A_array, metric="taxicab")
print(np.max(b))

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

 
H, W = map(int, input().split())
 
A_array = np.array(
    [[0 if s == "#" else 1 for s in input()[:-1]] for i in range(H)])
# print(A_array)

print(A_array)
 
# print(A_array)
b = ndimage.morphology.distance_transform_cdt(
    A_array, metric="taxicab")
print(np.max(b))
Problem p02833 (python)

Fixed submission:
n = int(input())

ans = 0
i = 0
while True:
    if n%2 == 1:
        break
    i += 1
    ans += n//2//(5**i)
    if n//2//(5**i) == 0:
        break

print(ans)

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

ans = 0
i = 0
while True:
    if n//2 = 1:
        break
    i += 1
    ans += n//2//(5**i)
    if n//2//(5**i) == 0:
        break

print(ans)
Problem p02711 (python)

Fixed submission:
xs = input()

if "7" in xs:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
def main():
  xs <- input().split("")

  if "7" in xs:
    print("Yes")
  else:
    print("No")
    
if __name__ == '__main__':
  main()
Problem p03834 (python)

Fixed submission:
sentence = input()
print(sentence.replace(",", " "))

Buggy submission (verdict: Runtime Error):
k = int(input())
s = int(input())

ans = 0

for x in range(k+1):
  for y in range(k+1):
    r = s - (x + y)
    if r >= 0 and r <= k:
      ans += 1

print(ans)
Problem p03835 (python)

Fixed submission:
k, s = map(int, input().split(" "))

 
ans = 0
 
for x in range(k+1):
  for y in range(k+1):
    r = s - (x + y)
    if r >= 0 and r <= k:
      ans += 1
 
print(ans)

Buggy submission (verdict: Runtime Error):
k = int(input())
s = int(input())

ans = 0

for x in range(k+1):
  for y in range(k+1):
    r = s - (x + y)
    if r >= 0 and r <= k:
      ans += 1

print(ans
Problem p02831 (python)

Fixed submission:
import fractions

def lcm(x, y):
    ans = (x * y)// fractions.gcd(x, y)

    return ans

A, B = [int(i) for i in input().split()]

print(lcm(A, B))

Buggy submission (verdict: Runtime Error):
import math

def lcm(x, y):
    ans = (x * y)// math.gcd(x, y)

    return ans

A, B = [int(i) for i in input().split()]

print(lcm(A, B))
Problem p02833 (python)

Fixed submission:
N = int(input())
"""
f = [0]*(N + 1)
f[0] = 1
f[1] = 1
for i in range(2, N + 1):
    f[i] = i * f[i - 2]

count = 0
while f[N] % 10 == 0:
    count += 1
    f[N] = f[N] // 10
    #print(count, f[N])

print(count)
"""
if N % 2 == 1:
    print(0)
if N % 2 == 0:
    five_count = 0
    while N >= 5**five_count:
        five_count += 1
    
    num_5 = list()
    for i in range(1, five_count + 1):
        num = N // (5**i)

        num_5.append(num//2)
        
    sum_5 = sum(num_5)
    print(sum_5)

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

f = [0]*(N + 1)
f[0] = 1
f[1] = 1
for i in range(2, N + 1):
    f[i] = i * f[i - 2]

count = 0
while f[N] % 10 == 0:
    count += 1
    f[N] = f[N] // 10
    #print(count, f[N])

print(count)

if N % 2 == 1:
    print(0)
if N % 2 == 0:
    N_keta = len(str(N)) - 1

    num_10 = list()
    num_50 = list()
    for i in range(1, N_keta + 1):
        num_10.append(N // (10**i))
    sum_10 = sum(num_10)
    
    for i in range(1, N_keta + 1):
        num_50.append((N // (5 * (10**i))))

    print(num_50)
    for i in range(0, len(num_10) - 1):
        num_50[i] -= num_10[i+1]
    

    print(num_50)
    sum_50 = sum(num_50)
    print(sum_10 + sum_50)
Problem p02880 (python)

Fixed submission:
N = int(input())

flag = 0
for i in range(1, 10):
    if N % i == 0:
        a = N // i
        if a <= 9:
            flag = 1

if flag == 0:
    print("No")
else:
    print("Yes")

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

flag = 0
for i in range(10):
    if N % i == 0:
        a = N // i
        if a <= 9:
            print("Yes")
            flag = 1

if flag == 0:
    print("No")
Problem p03137 (python)

Fixed submission:
import numpy as np
n, m = map(int, input().split())
x = list(map(int, input().split()))

x = sorted(x)
diff = np.asarray([x[i + 1] - x[i] for i in range(len(x) - 1)])
argsort = diff.argsort()[::-1][:n - 1]

start = 0
sum_length = 0
for split_idx in argsort:
    sum_length += x[split_idx] - x[start]
    start = split_idx + 1
sum_length += x[-1] - x[start]

print(sum_length)

Buggy submission (verdict: Runtime Error):
import numpy as np
n, m = map(int, input().split())
x = list(map(int, input().split()))

x = sorted(x)
diff = np.asarray([x[i + 1] - x[i] for i in range(len(x) - 1)])
argsort = diff.argsort()[::-1][:n - 1]

x_list = []
start = 0
for split_idx in argsort:
    x_list.append(x[start:split_idx+1])
    start = split_idx+1
x_list.append(x[start:])

sum_length = 0
for cur_x in x_list:
    sum_length += cur_x[-1] - cur_x[0]

print(sum_length)
Problem p02682 (python)

Fixed submission:
abcx = input().split(" ")
a = int(abcx[0])
b = int(abcx[1])
x = int(abcx[3])
if x <= a:
    print(x)
elif x <= a + b:
    print(a)
else:
    print(2 * a + b - x)

Buggy submission (verdict: Runtime Error):
abcx = input().split(" ")
a = int(abcd[0])
b = int(abcd[1])
c = int(abcd[2])
x = int(abcd[3])
if x <= a:
    print(x)
elif x <= a + b:
    print(a)
else:
    print(2*a + b - x)
Problem p02701 (python)

Fixed submission:
a = int(input())
b = []
for i in range(a):
    b.append(input())
print(len(set(b)))

Buggy submission (verdict: Runtime Error):
a = int(input())
b = []
for i in range(a):
    c = input()
    if c not in b == True:
        b.append(c)
print(ren(b))
Problem p02725 (python)

Fixed submission:
a=input().split(' ')
b=input().split(' ')
c=0
for i in range(int(a[1])):
    if i != int(a[1])-1:
        if int(b[i+1]) - int(b[i]) > c:
            c = int(b[i+1]) - int(b[i])
    else:
        if int(a[0]) - int(b[-1])+ int(b[0]) > c:
            c = int(a[0]) - int(b[-1])+ int(b[0])
print(int(a[0])-c)

Buggy submission (verdict: Runtime Error):
a=input().split(' ')
b=input().split(' ')
c=0
for i in int(a[1]):
    if i != int(a[1])-1:
        if int(b[i+1]) - int(b[i]) > c:
            c = int(b[i+1]) - int(b[i])
    else:
        if int(a[0]) - int(b[-1])+ int(b[0]) > c:
            c = int(a[0]) - int(b[-1])+ int(b[0])
print(int(a[0])-c)

Buggy submission (verdict: Runtime Error):
a=input().split(' ')
b=input().split(' ')
c=0
for i in int(a[1]):
    if i != a[1]-1:
        if int(b[i+1]) - int(b[i]) > c:
            c = int(b[i+1]) - int(b[i])
    else:
        if int(a[0]) - int(b[-1])+ int(b[0]) > c:
            c = int(a[0]) - int(b[-1])+ int(b[0])
print(int(a[0])-c)
Problem p02754 (python)

Fixed submission:
a = input().split(" ")
n = int(a[0])
b = int(a[1])
r = int(a[2])
c = n // (b + r)
bb = c * b
d = n % (b + r)
if d >= b:
	bb += b
else:
	bb += d 
print(bb)

Buggy submission (verdict: Runtime Error):
a = input().split(" ")
n = int(a[0])
b = int(a[1])
r = int(a[2])
c = a // (b + r)
bb = c * b
d = a % (b + r)
if d >= b:
	bb += b
else:
	bb += d 
print(bb)
Problem p02759 (python)

Fixed submission:
n = int(input())
print(n//2 + (1 if n % 2 else 0))

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

ans = [-1]*n
a = 0
for i in range(m):
    s, c = map(int, input().split())
    if s == 1 and c == 0 and n != 1:
        a = -1
    elif ans[s-1] not in [-1, c]:
        a = -1
    else:
        ans[s-1] = c

if a == -1:
    print(a)
else:
    b = ""
    if ans[0] == -1 and n != 1:
        ans[0] = 1
    for x in ans:
        if x == -1:
            b += "0"
        else:
            b += str(x)
    print(b)
Problem p03805 (python)

Fixed submission:
from itertools import permutations
n, m = map(int, input().split())
v = [set(map(int, input().split())) for _ in range(m)]

ans = 0
x = [i for i in range(2, n+1)]
cand = permutations(x)
for i in cand:
    crnt = 1
    for nxt in i:
        if set([crnt, nxt]) in v:
            crnt = nxt
        else:
            break
    else:
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
color = [0] * n 
path = [[] for _ in range(m)]

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

print(path)
def rec(c, p, crnt, d):
    d += 1
    if c[crnt] == 1:
        if len(list(filter(lambda x: x == 1, c))) == m and d == m+1:
            return 1
        else:
            return 0
    elif c[crnt] > 1:
        return 0
    else:
        c[crnt] += 1
        sm = 0
        for i in p[crnt]:
            sm += rec(c, p, i-1, d)
        return sm

print(rec(color, path, 0, 0))

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
color = [0] * n 
path = [[] for _ in range(m)]

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

def rec(c, p, crnt, d):
    d += 1
    if c[crnt]:
        if len(list(filter(lambda x: x == 1, c))) == m and d == m+1:
            return 1
        else:
            return 0
    else:
        c[crnt] = 1
        sm = 0
        for i in p[crnt]:
            sm += rec(c, p, i-1, d)
        return sm

print(rec(color, path, 0, 0))
Problem p02954 (python)

Fixed submission:
# -*- coding: utf-8 -*-
#ABC136D
import copy
import sys
import math

s = input()
n = len(s)

ans=[]
for i in range(0,n):
	ans.append(0)

count=0
for i in range(0,n):
	if(s[i]=="R"):
		count+=1
	else:
		ans[i]+=count//2
		ans[i-1]+=(count-1)//2+1
		count=0

count=0
for i in range(0,n):
	t=n-i-1
	if(s[t]=="L"):
		count+=1
	else:
		ans[t]+=count//2
		ans[t+1]+=(count-1)//2+1
		count=0

res=str(ans[0])
for i in range(1,n):
	res+=" "
	res+=(str(ans[i]))
print(res)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
#ABC136C
import copy
import sys
import math

n = int(input())
tmp = input().split()
hoge = list(map(lambda a: int(a), tmp))
minhoge=hoge[n-1]
for i in range(1,n):
	t=n-1-i
	if(hoge[t]>minhoge+1):
		print("No")
		sys.exit()
	elif(hoge[t]<minhoge):
		minhoge=hoge[t]
	if(t==0):
		print("Yes")
		sys.exit()
print("Yes")
Problem p03107 (python)

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

import sys
#import math

hoge = input()
n = len(hoge)

sum=0
i=0

while(1):
#	print(i)
	if(i>=n-1):
		break
	if(hoge[i]!=hoge[i+1]):
#		print("hoge:{} i:{} {} {}".format(hoge,i,hoge[i],hoge[i+1]))
		newhoge=hoge[0:i]+hoge[i+2:n]
		hoge=newhoge
		i-=1
		if(i<0):
			i=0
		n-=2
#		n=len(hoge)
		sum+=2
	else:
		i+=1


#	print(i)
#	print("---")


print(sum)

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

import sys
#import math

hoge = input()
#hoge=[]
#for i in range(0,len(tmp)):
#	hoge.append(tmp[i])
#hoge = list(map(lambda a: int(a), tmp))

n = len(hoge)

sum=0
i=0
while(1):
#	print(i)
	if(hoge[i]!=hoge[i+1]):
#		print("hoge:{} i:{} {} {}".format(hoge,i,hoge[i],hoge[i+1]))
		newhoge=hoge[0:i]+hoge[i+2:n]
		hoge = newhoge
		i=max(i-2,-1)
		n=len(hoge)
		sum+=2
#	print(i)
#	print("---")
	i+=1
	if(i>=n-1):
		break


print(sum)

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

import sys
#import math

hoge = input()
#hoge=[]
#for i in range(0,len(tmp)):
#	hoge.append(tmp[i])
#hoge = list(map(lambda a: int(a), tmp))

n = len(hoge)

sum=0
i=0
while(1):
#	print(i)
	if(hoge[i]!=hoge[i+1]):
#		print("hoge:{} i:{} {} {}".format(hoge,i,hoge[i],hoge[i+1]))
		newhoge=hoge[0:i]+hoge[i+2:n]
		hoge = newhoge
		i=max(i-2,-1)
		n=len(hoge)
		sum+=2
#	print(i)
#	print("---")
	i+=1
	if(i>=n-2):
		break


print(sum)

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

import sys
#import math

hoge = input()
#hoge=[]
#for i in range(0,len(tmp)):
#	hoge.append(tmp[i])
#hoge = list(map(lambda a: int(a), tmp))

n = len(hoge)

sum=0
i=0
while(1):
#	print(i)
	if(hoge[i]!=hoge[i+1]):
#		print("hoge:{} i:{} {} {}".format(hoge,i,hoge[i],hoge[i+1]))
		newhoge=hoge[0:i]+hoge[i+2:n]
		hoge = newhoge
		i=max(i-2,-1)
		n=len(hoge)
		sum+=2
#	print(i)
#	print("---")
	i+=1
	if(i>=n-1):
		break


print(sum)
Problem p03137 (python)

Fixed submission:
# -*- coding: utf-8 -*-
#ABC116C
import sys

tmp = input().split()
hoge = list(map(lambda a: int(a), tmp))
n=hoge[0]
m=hoge[1]

tmp = input().split()
hoge = list(map(lambda a: int(a), tmp))

hoge.sort()
#print(hoge)
x=[]
sum=0
for i in range(0,m-1):
	x.append(hoge[i+1]-hoge[i])
	sum+=hoge[i+1]-hoge[i]
x.sort(reverse=True)

#print(x)

sc=0
for i in range(0,min(n-1,len(x))):
	sc+=x[i]

print(sum-sc)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
#ABC116C
import sys

tmp = input().split()
hoge = list(map(lambda a: int(a), tmp))
n=hoge[0]
m=hoge[1]

tmp = input().split()
hoge = list(map(lambda a: int(a), tmp))

hoge.sort()
#print(hoge)
x=[]
sum=0
for i in range(0,m-1):
	x.append(hoge[i+1]-hoge[i])
	sum+=hoge[i+1]-hoge[i]
x.sort(reverse=True)

#print(x)

sc=0
for i in range(0,n-1):
	sc+=x[i]

print(sum-sc)
Problem p03775 (python)

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

n = int(input())
#tmp = input().split()
#hoge = list(map(lambda a: int(a), tmp))

tmp= math.ceil(math.sqrt(n))
#print(n)
#print(tmp)
for i in range(0,tmp):
	if(n%(tmp-i)==0):
		break

#print(tmp-i)
ansn=n//(tmp-i)
#print(ansn)
#print(math.log10(ansn))
#print(max(ansn,tmp-i))
#print(math.floor(0.9))
ans=math.floor(math.log10(max(ansn,tmp-i))) + 1

print(ans)

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

n = int(input())
#tmp = input().split()
#hoge = list(map(lambda a: int(a), tmp))

tmp= math.ceil(math.sqrt(n))

for i in range(0,tmp):
	if(n%(tmp-i)==0):
		break

#print(tmp-i)
ansn=n//(tmp-i)
#print(ansn)
ans=math.floor(math.log10(ansn-1)) + 1

print(ans)

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

n = int(input())
#tmp = input().split()
#hoge = list(map(lambda a: int(a), tmp))

tmp= math.ceil(math.sqrt(n))

for i in range(0,tmp):
	if(n%(tmp-i)==0):
		break

#print(tmp-i)
ansn=n//(tmp-i)
#print(ansn)
ans=math.floor(math.log10(ansn-1)) + 1

print(ans)

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

n = int(input())
#tmp = input().split()
#hoge = list(map(lambda a: int(a), tmp))


tmp= math.ceil(math.sqrt(n))

for i in range(0,n):
	if(n%(tmp+i)==0):
		break

#print(tmp+i)
print(math.floor(math.log10(tmp+i-1) + 1))