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

Fixed submission:
import sys
input=sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
from itertools import accumulate
from itertools import permutations
from itertools import combinations
from collections import defaultdict
from collections import Counter
import fractions
import math
from collections import deque
from bisect import bisect_left
from bisect import insort_left
import itertools
from heapq import heapify
from heapq import heappop
from heapq import heappush
import heapq
import numpy as np
INF = float("inf")
#d = defaultdict(int)
#d = defaultdict(list)
#N = int(input())
#A = list(map(int,input().split()))
#S = list(input())
#S.remove("\n")
#N,M = map(int,input().split())
#S,T = map(str,input().split())
#A = [int(input()) for _ in range(N)]
#S = [input() for _ in range(N)]
#A = [list(map(int,input().split())) for _ in range(N)]
S = list(input())[:-1]
a = 10*int(S[0])+int(S[1])
b = 10*int(S[2])+int(S[3])
if (a > 12 or a == 0) and (b > 12 or b == 0):
    print("NA")
elif a > 12 or a == 0:
    print("YYMM")
elif b > 12 or b == 0:
    print("MMYY")
else:
    print("AMBIGUOUS")

Buggy submission (verdict: Runtime Error):
import sys
input=sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
from itertools import accumulate
from itertools import permutations
from itertools import combinations
from collections import defaultdict
from collections import Counter
import fractions
import math
from collections import deque
from bisect import bisect_left
from bisect import insort_left
import itertools
from heapq import heapify
from heapq import heappop
from heapq import heappush
import heapq
import numpy as np
INF = float("inf")
#d = defaultdict(int)
#d = defaultdict(list)
#N = int(input())
#A = list(map(int,input().split()))
#S = list(input())
#S.remove("\n")
#N,M = map(int,input().split())
#S,T = map(str,input().split())
#A = [int(input()) for _ in range(N)]
#S = [input() for _ in range(N)]
#A = [list(map(int,input().split())) for _ in range(N)]
S = list(input())[:-1]
a = 10*int(S[0])+int(S[1])
b = 10*int(S[2])+int(S[3])
    print("NA")
if (a > 12 or a == 0) and (b > 12 or b == 0):
    print("NA")
elif a > 12 or a == 0:
    print("YYMM")
elif b > 12 or b == 0:
    print("MMYY")
else:
    print("AMBIGUOUS")
Problem p02598 (python)

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

def is_ok(n):
    cnt = 0
    for a in A:
        if n >= a:
            continue
        cnt += a // n
    return cnt <= K

def meguru_bisect(ng, ok):
    while (abs(ok - ng) > 1):
        mid = (ok + ng) // 2
        if is_ok(mid):
            ok = mid
        else:
            ng = mid
    return ok

print(meguru_bisect(0, 10**9+1))

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
A = sorted(list(map(int, input().split())))
A = [i*-1 for i in A]

import heapq
heapq.heapify(A)

while K:
    a = heapq.heappop(A)
    b = heapq.heappop(A)
    a, b = a*-1, b*-1
    c = (b+1)//2
    d = a - c
    heapq.heappush(A, b*-1)
    heapq.heappush(A, c*-1)
    heapq.heappush(A, d*-1)
    K -= 1

print(sorted(A)[0]*-1)
Problem p02915 (python)

Fixed submission:
print(int(input())**3)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
s = input()
h = 0
for i in range(n-1):
    if s[i] == s[i+1]:
        h += 1
print(min(h + 2 * k, n - 1))
Problem p03013 (python)

Fixed submission:
N, M = map(int, input().split())
A = set([int(input()) for i in range(M)])
t = 10**9+7
import sys
sys.setrecursionlimit(500000)
from functools import lru_cache
@lru_cache(maxsize=None)
def fibo(n):
    if n in A:
        return 0
    elif n == 0 or n == 1:
        return 1
    return (fibo(n-2) + fibo(n-1)) % t
print(fibo(N) % t)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
A = [int(input()) for i in range(M)]

# オブジェクトがハッシュ可能であるか判定する.
def hashable(x):
    try:
        hash(x)
        return True
    except TypeError:
        return False

# 関数を Memoize するデコレータ.
def memoize(callable):
    cache = {}
    def wrapper(*args, **kwargs):
        key = args + tuple(kwargs.items())
        if not hashable(key):
            return callable(*args, **kwargs)
        if key not in cache:
            cache[key] = callable(*args, **kwargs)
        return cache[key]
    return wrapper

# from functools import lru_cache
# @lru_cache(maxsize=None)
@memoize
def fibo(n):
    if n in A:
        return 0
    elif n == 0 or n == 1:
        return 1
    return fibo(n-2) + fibo(n-1)

print(fibo(N) % 1000000007)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
A = [int(input()) for i in range(M)]

from functools import lru_cache
@lru_cache(maxsize=None)
def fibo(n):
    if n in A:
        return 0
    elif n == 0 or n == 1:
        return 1
    return fibo(n-2) + fibo(n-1)

print(fibo(N) % 1000000007)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
A = [int(input()) for i in range(M)]

from functools import lru_cache
@lru_cache(maxsize=None)
def fibo(n):
    if n in A:
        return 0
    elif n == 0 or n == 1:
        return 1
    return fibo(n-1) + fibo(n-2)

print(fibo(N) % 1000000007)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
A = [int(input()) for i in range(M)]

from functools import lru_cache
@lru_cache(maxsize=None)
def fibo(n):
    if n in A:
        return 0
    elif n == 0 or n == 1:
        return 1
    return fibo(n-1) + fibo(n-2)

print(fibo(N) % 1_000_000_007)
Problem p03127 (python)

Fixed submission:
from fractions import gcd
N = int(input())
A = sorted(list(map(int, input().split())))
ans = A[0]
for i in range(1, N):
    ans = gcd(ans, A[i])
print(ans)

Buggy submission (verdict: Runtime Error):
from collections import deque
N = int(input())
A = sorted(list(map(int, input().split())))

d = deque(A)
ans = d[0]
while d:
    l = d.popleft()
    r = d.popleft()
    a = r % l
    if a == 0:
        d.appendleft(l)
    elif a == 1:
        ans = 1
        break
    else:
        ans = min(ans, a)
        d.appendleft(r)
        d.appendleft(a)
print(ans)
Problem p02623 (python)

Fixed submission:
import sys
import math
from bisect import bisect_left
def II():
	return int(sys.stdin.readline())

def LI():
	return list(map(int, sys.stdin.readline().split()))

def MI():
	return map(int, sys.stdin.readline().split())

def SI():
	return sys.stdin.readline().strip()
def bs(a,n,x): 
    i = bisect_left(a, x) 
    if i<n and a[i] == x:
    	return i
    elif i:
    	return (i-1) 
    else: 
        return -1
n,m,k = MI()
a = LI()
b = LI()
for i in range(1,n):
	a[i]+=a[i-1]
for i in range(1,m):
	b[i]+=b[i-1]
ans = max(bs(a,n,k),bs(b,m,k))+1
for i in range(n):
	if k<a[i]:
		break
	else:
		temp = i+1+bs(b,m,k-a[i])+1
		ans = max(ans,temp)
for i in range(m):
	if k<b[i]:
		break
	else:
		temp = i+1+bs(a,n,k-b[i])+1
		ans = max(ans,temp)
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
import math
from bisect import bisect_left
def II():
	return int(sys.stdin.readline())

def LI():
	return list(map(int, sys.stdin.readline().split()))

def MI():
	return map(int, sys.stdin.readline().split())

def SI():
	return sys.stdin.readline().strip()
def bs(a,n,x): 
    i = bisect_left(a, x) 
    if i<n and a[i] == x:
    	return i
    elif i:
    	return (i-1) 
    else: 
        return -1
n,m,k = MI()
a = LI()
b = LI()
for i in range(1,n):
	a[i]+=a[i-1]
for i in range(1,m):
	b[i]+=b[i-1]
ans = max(bs(a,n,k),bs(b,m,k))+1
for i in range(n):
	if k<a[i]:
		break
	else:
		temp = i+1+bs(b,m,k-a[i])+1
		ans = max(ans,temp)
for j in range(m):
	if k<b[i]:
		break
	else:
		temp = i+1+bs(a,n,k-b[i])+1
		ans = max(ans,temp)
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
import math
from bisect import bisect_left
def II():
	return int(sys.stdin.readline())

def LI():
	return list(map(int, sys.stdin.readline().split()))

def MI():
	return map(int, sys.stdin.readline().split())

def SI():
	return sys.stdin.readline().strip()
def bs(a,n,x): 
    i = bisect_left(a, x) 
    if i<n and a[i] == x:
    	return i
    elif i:
    	return (i-1) 
    else: 
        return -1
n,m,k = MI()
a = LI()
b = LI()
for i in range(1,n):
	a[i]+=a[i-1]
for i in range(1,m):
	b[i]+=b[i-1]
ans = max(bs(a,n,k),bs(b,m,k))+1
for i in range(n):
	if k<a[i]:
		break
	else:
		temp = i+1+bs(b,m,k-a[i])+1
		ans = max(ans,temp)
for j in range(m):
	if k<b[i]:
		break
	else:
		temp = i+1+bs(a,n,k-b[i])+1
print(ans)
Problem p02627 (python)

Fixed submission:
import sys
import math
def II():
	return int(sys.stdin.readline())

def LI():
	return list(map(int, sys.stdin.readline().split()))

def MI():
	return map(int, sys.stdin.readline().split())

def SI():
	return sys.stdin.readline().strip()
s = SI()
if s.islower():
	print("a")
else:
	print("A")

Buggy submission (verdict: Runtime Error):
import sys
import math
def II():
	return int(sys.stdin.readline())

def LI():
	return list(map(int, sys.stdin.readline().split()))

def MI():
	return map(int, sys.stdin.readline().split())

def SI():
	return sys.stdin.readline().strip()
s = SI()
if s.isLower():
	print("a")
else:
	print("A")
Problem p03013 (python)

Fixed submission:
N, M = list(map(int, input().split()))
a = []
for _ in range(M):
    a.append(int(input()))
a = sorted(list(set(a)))
if len(a)>0:
    dif = [a[0]-1]
    dif.extend([(a[i]-1)-(a[i-1]+1) for i in range(1,len(a))])
    dif.extend([N-a[-1]-1])
else:
    dif = [N]
max_dif = max(dif)
Fiblist = {-1:0,0:1,1:1,2:2}
for n in range(3,max_dif+1):
    Fiblist[n]=Fiblist[n-1]+Fiblist[n-2]
ans = 1
for part in dif:
    ans= ans*Fiblist[part]%1000000007
print(ans)

Buggy submission (verdict: Runtime Error):
N, M = list(map(int, input().split()))
a = []
for _ in range(M):
    a.append(int(input()))
a = list(set(a))
if len(a)>0:
    dif = [a[0]-1]
    dif.extend([(a[i]-1)-(a[i-1]+1) for i in range(1,len(a))])
    dif.extend([N-a[-1]-1])
else:
    dif = [N]
max_dif = max(dif)
Fiblist = {-1:0,0:1,1:1,2:2}
for n in range(3,max_dif+1):
    Fiblist[n]=Fiblist[n-1]+Fiblist[n-2]
ans = 1
for part in dif:
    ans= ans*Fiblist[part]%1000000007
print(ans)

Buggy submission (verdict: Runtime Error):
N, M = list(map(int, input().split()))
a = []
for _ in range(M):
    a.append(int(input()))
a = sorted(list(set(a)))
dif = [a[0]-1]
dif.extend([(a[i]-1)-(a[i-1]+1) for i in range(1,len(a))])
dif.extend([N-a[-1]-1])
max_dif = max(dif)
Fiblist = {-1:0,0:1,1:1,2:2}
for n in range(3,max_dif+1):
    Fiblist[n]=Fiblist[n-1]+Fiblist[n-2]
ans = 1
for part in dif:
    ans= ans*Fiblist[part]%1000000007
print(ans)

Buggy submission (verdict: Runtime Error):
N, M = list(map(int, input().split()))
a = []
for _ in range(M):
    a.append(int(input()))
a = list(set(a))
dif = [a[0]-1]
dif.extend([(a[i]-1)-(a[i-1]+1) for i in range(1,len(a))])
dif.extend([N-a[-1]-1])
max_dif = max(dif)
Fiblist = {-1:0,0:1,1:1,2:2}
for n in range(3,max_dif+1):
    Fiblist[n]=Fiblist[n-1]+Fiblist[n-2]
ans = 1
for part in dif:
    ans= ans*Fiblist[part]%1000000007
print(ans)

Buggy submission (verdict: Runtime Error):
N, M = list(map(int, input().split()))
a = []
for _ in range(M):
    a.append(int(input()))
dif = [a[0]-1]
dif.extend([(a[i]-1)-(a[i-1]+1) for i in range(1,len(a))])
dif.extend([N-a[-1]-1])
max_dif = max(dif)
Fiblist = {-1:0,0:1,1:1,2:2}
for n in range(3,max_dif+1):
    Fiblist[n]=Fiblist[n-1]+Fiblist[n-2]
ans = 1
for part in dif:
    ans= ans*Fiblist[part]%1000000007
print(ans)

Buggy submission (verdict: Runtime Error):
N, M = list(map(int, input().split()))
a = []
for _ in range(M):
    a.append(int(input()))
dif = [a[0]-1]
dif.extend([(a[i]-1)-(a[i-1]+1) for i in range(1,len(a))])
dif.extend([N-a[-1]-1])
max_dif = max(dif)
Fiblist = {-1:0,0:1,1:1,2:2}
for n in range(3,max_dif+1):
    Fiblist[n]=Fiblist[n-1]+Fiblist[n-2]
ans = 1
for part in dif:
    ans*=Fiblist[part]
print(ans%1000000007)

Buggy submission (verdict: Runtime Error):
N, M = list(map(int, input().split()))
a = []
for _ in range(M):
    a.append(int(input()))

dif = [a[0]-1]
dif.extend([(a[i]-1)-(a[i-1]+1) for i in range(1,len(a))])
dif.extend([N-a[-1]-1])
max_dif = max(dif)
print(dif, max_dif)

Fiblist = {-1:0,0:1,1:1,2:2}
for n in range(3,max_dif+1):
    Fiblist[n]=Fiblist[n-1]+Fiblist[n-2]
print(Fiblist)
ans = 1
for part in dif:
    ans*=Fiblist[part]
print(ans%1000000007)
Problem p03805 (python)

Fixed submission:
N, M = list(map(int, input().split()))
ab = {i:[] for i in range(N)}
for _ in range(M):
    a, b = list(map(int, input().split()))
    ab[a-1].append(b-1)
    ab[b-1].append(a-1)
    
cand = [[0]+[one] for one in ab[0]]
while len(cand)>0 and len(cand[0])<N:
    tmp_cand = []
    for c in cand:
        last = c[-1]
        n = []
        for nc in ab[last]:
            if nc not in c:
                n.append(c+[nc])
        tmp_cand.extend(n)
    cand = tmp_cand
print(len(cand))

Buggy submission (verdict: Runtime Error):
N, M = list(map(int, input().split()))
ab = {i:[] for i in range(N)}
for _ in range(M):
    a, b = list(map(int, input().split()))
    ab[a-1].append(b-1)
    ab[b-1].append(a-1)
    
cand = [[0]+[one] for one in ab[0]]
while len(cand)>0:
    tmp_cand = []
    for c in cand:
        last = c[-1]
        n = []
        for nc in ab[last]:
            if nc not in c:
                n.append(c+[nc])
        tmp_cand.extend(n)
    cand = tmp_cand
    if len(cand[0])==N:
        break
print(len(cand))
Problem p02771 (python)

Fixed submission:
a=input()
b=a[2]
c=a[4]
a=a[0]
if(a==b and a == c):
  print("No")
elif(a != b and b == c):
  print("Yes")
elif(a != b and a == c):
  print("Yes")
elif(a!=c and a == b):
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a=input()
b=input()
c=input()
if(a==b and a == c):
  print("No")
elif(a != b and b == c):
  print("Yes")
elif(a != b and a == c):
  print("Yes")
elif(a!=c and a == b):
  print("Yes")
else:
  print("No")
Problem p02771 (python)

Fixed submission:
a,b,c=map(int,input().split())
d=set([a,b,c])
if len(d)==2:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
import itertools
n,k=map(int,input().split())
a=list(map(int,input().split()))
b=sorted([x[0]*x[1] for x in itertools.combinations(a,2)],reverse=False)
print(b[k-1])
Problem p02777 (python)

Fixed submission:
s,t=map(str,input().split())
a,b=map(int,input().split())
u=str(input())
if u==s:
  print(a-1,b)
else:
  print(a,b-1)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
p=tuple(map(float,input().split()))
exp=tuple([(pi+1)/2 for pi in p])
ans=0
for i in range(0,n-k+1):
  ans=max(ans,sum(exp[i:i+k]))
print(ans)
Problem p02790 (python)

Fixed submission:
a,b = map(int,input().split())
c,d = min(a,b),max(a,b)
e = str(c) * d
print(e)

Buggy submission (verdict: Runtime Error):
def main():
  import sys
  n,k=map(int,input().split())
  a=tuple(map(int,sys.stdin.readline().split()))
  
  def count(arr,now):
    return sum(element<now for element in arr)
  
  ans=0
  prime=10**9+7
  k=k%prime
  for i in range(n):
    left=count(a[:i],a[i])
    right=count(a[i+1:],a[i])
    res=(k-1)*k//2*(right+left)+right*k
    ans+=res%prime
    
  print(ans%prime)

if __name__=="__main__":
  main()
Problem p02819 (python)

Fixed submission:
x = int(input())
a = False
while a == False:
  b = list(range(1,x) ) 
  c = [x/c for c in b]
  d = [d.is_integer() for d in c[1:-1]]
  if not any(d):
    a = True
    break    
  else:
    x = x + 1
print(x)

Buggy submission (verdict: Runtime Error):
x = int(input())
a = False
while a = True:
  b = range(x) + 1
  c = x/b
  d = [d.is_integer() for d in c[1:-1]]
  if not any(d):
    a = True
    break    
  else:
    x = x + 1
print(x)

Buggy submission (verdict: Runtime Error):
x = int(input())
a = False
while a = True:
  b = range(x) + 1
  c = x/b
  d = [d.is_integer() for d in c[1:-1]]
  if any(d):
    x = x + 1
  else:
    a = True
    break
print(x)

Buggy submission (verdict: Runtime Error):
x = int(input())
a = False
while a = True:
  b = range(x) + 1
  c = x/b
  d = [d.is_integer() for d in c[1:-1]]
  if any(d):
    a = True
    break
  x = x + 1
print(x)
Problem p02831 (python)

Fixed submission:
import fractions
a,b=map(int,input().split())
gcd=fractions.gcd(a,b)
print(a*b//gcd)

Buggy submission (verdict: Runtime Error):
import math
a,b=map(int,input().split())
gcd=math.gcd(a,b)
print(a*b//gcd)

Buggy submission (verdict: Runtime Error):
import math
a,b=print(input().split())
gcd=math.gcd(a,b)
print(a*b//gcd)
Problem p02835 (python)

Fixed submission:
s = sum(list(map(int,input().split())))
print("bust" if s>21 else "win")

Buggy submission (verdict: Runtime Error):
s = sum(list(map(int,input().split())))
print("bust" if s s>21 else "win")
Problem p02879 (python)

Fixed submission:
a,b=map(int,input().split())
f= 0<a<10 and 0<b<10
print(a*b if f is True else "-1")

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
print("1" if 1<=a,b<=9 else "-1")
Problem p02959 (python)

Fixed submission:
def main():
  import sys
  n = int(input())
  a = list(map(int,sys.stdin.readline().split()))
  b = list(map(int,sys.stdin.readline().split()))
  
  count=0
  
  for i in range(n):
    c1 = a[i] 
    c2 = a[i+1]
    h = b[i]
    count+=min(c1,h)  
    if h>c1:
        count+=min(h-c1,c2)
        a[i+1]=max(0,c2-(h-c1))
 
  print(count)
  
if __name__=="__main__":
  main()

Buggy submission (verdict: Runtime Error):
def main():
  import sys
  n = int(input())
  a = list(map(int.sys.stdin.readline().split()))
  b = list(map(int.sys.stdin.readline().split()))
  
  count=0
  
  for i in range(n):
    c1 = a[i] 
    c2 = a[i+1]
    h = b[i]
    ans+=min(c1,h)  
    if h>c1:
        ans+=min(h-c1,c2)
        a[i+1]=max(0,c2-(h-c1))

  print(ans)
  
if __name__=="__main__":
  main()
Problem p03013 (python)

Fixed submission:
n,m=map(int,input().split())
x=set([int(input()) for _ in range(m)])
f=[0]*(n+1)
f[0]=1
for i in range(1,n+1):
  f[i]=f[i-1]+f[i-2]
  if i in x:
    f[i]=0
print(f[n]%(10**9+7))

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
x=set(int(input()) for _ in range(m)
f=[0]*(n+1)
f[0]=1
for i in range(1,n+1):
  f[i]=(f[i-1]+f[i-2])%(10**9+7)
  if i in x:
    f[i]=0
print(f[n]%(10**9+7))
Problem p03041 (python)

Fixed submission:
a,b=map(int,input().split())
s=list(input())
s[b-1]=(s[b-1]).lower()
print("".join(s))

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
s=str(input())
s[b-1]=s[b-1].lower()
print(s)
Problem p03072 (python)

Fixed submission:
n=int(input())
h=list(map(int,input().split()))
c=sum(max(h[:i])<=h[i] for i in range(1,n))+1
print(c)

Buggy submission (verdict: Runtime Error):
n=int(input())
h=list(map(int,input().split()))
c=sum(max(h[:i])<=h[i] for i in range(n))
print(c)
Problem p03108 (python)

Fixed submission:
def find(i, m):
    if m[i] < 0:
        return i
    return find(m[i], m)


def count(i, m):
    if m[i] < 0:
        return abs(m[i])
    return count(m[i], m)


def main():
    n, m, *ab = map(int, open(0).read().split())
    ab = ab[::-1]
    tmp = n * (n - 1) // 2
    utl = []
    par = [-1] * (n + 1)

    for u, v in zip(ab[::2], ab[1::2]):
        if find(u, par) == find(v, par):
            utl.append(tmp)
        else:
            i, j = find(u, par), find(v, par)
            utl.append(tmp)
            tmp -= par[i] * par[j]
            if par[i] > par[j]:
                i, j = j, i
            par[i] += par[j]
            par[j] = i

    ans = '\n'.join(map(str, utl[::-1]))
    print(ans)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def find(i, m):
    if m[i] < 0:
        return i
    return find(m[i], m)


def count(i, m):
    if m[i] < 0:
        return abs(m[i])
    return count(m[i], m)


def union(i, j, m):
    pi, pj = find(i, m), find(j, m)
    if pi != pj:
        m[pj] += m[pi]
        m[pi] = pj

    return m


def main():
    n, m, *ab = map(int, open(0).read().split())
    ab = ab[::-1]
    tmp = n * (n - 1) // 2
    utl = []
    par = [-1] * (n + 1)
    for u, v in zip(ab[::2], ab[1::2]):
        if find(u, par) == find(v, par):
            utl.append(tmp)
        else:
            i, j = count(u, par), count(v, par)
            utl.append(tmp)
            tmp -= i * j
            par = union(u, v, par)

    ans = '\n'.join(map(str, utl[::-1]))
    print(ans)


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

Fixed submission:
n = int(input())
l = [int(input()) for _ in range(n)]
print(sum(l)-int(max(l)/2))

Buggy submission (verdict: Runtime Error):
n = input()
l = [int(input()) for _ in range(n)]
print(sum(l)-max(l)/2)
Problem p03250 (python)

Fixed submission:
a,b,c = sorted(map(int,input().split()))
print(10*c+b+a)

Buggy submission (verdict: Runtime Error):
l = sorted(list(str,input().split()))
m = int(l[0]) + int(l[2]+l[1])
print(m)
Problem p03329 (python)

Fixed submission:
def main():
    n = int(input())
    m = [10 ** 5 for _ in range(n + 1)]
    m[0] = 0
    for i in range(1, n + 1):
        j = 0
        while i - 6 ** j >= 0:
            m[i] = min(1 + m[i - 6 ** j], m[i])
            j += 1
        j = 0
        while i - 9 ** j >= 0:
            m[i] = min(1 + m[i - 9 ** j], m[i])
            j += 1

    print(m[-1])


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
n = int(input())
c9 = 0
m = n
while(m>1):
  m = m//9
  if m !== 0: 
  	pass
  else:
    c9 += 1
m = n - 9**c9

c6 = 0
while(m>1):
  m = m//9
  if m !== 0: 
  	pass
  else:
    c6 += 1
    
c1 = n - (9**c9+c6**c6)
print(c9+c6+c1)
Problem p03426 (python)

Fixed submission:
def main():
    from itertools import accumulate
    h, w, d = map(int, input().split())

    a = [0] * (h * w + 1)
    b = [0] * (h * w + 1)
    for i in range(1, h + 1):
        l = map(int, input().split())
        for j, k in enumerate(l, 1):
            a[k] = i
            b[k] = j

    c = [0] * (h * w + 1)
    for i in range(d + 1, h * w + 1):
        c[i] = c[i - d] + abs(a[i] - a[i - d]) + abs(b[i] - b[i - d])

    q = int(input())
    res = []
    for _ in range(q):
        l, r = map(int, input().split())
        res.append(c[r] - c[l])

    ans = '\n'.join(map(str, res))
    print(ans)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    import sys
    sys.setrecursionlimit(10000)
    h, w, d = map(int, input().split())
    p = []
    for i in range(1, h + 1):
        l = map(int, input().split())
        for j, k in enumerate(l, 1):
            p.append((k, (i, j)))
    p.sort(key=lambda x: x[0])

    q = int(input())

    dist = [0] * (w * h + 1)

    def Q(i, c, x, y):
        if i + d > w * h:
            return
        _, (nx, ny) = p[i + d - 1]
        nc = c + abs(nx - x) + abs(ny - y)
        dist[i + d] = nc
        Q(i + d, nc, nx, ny)

    for i in range(d):
        n, (x, y) = p[i]
        Q(n, 0, x, y)

    res = []
    for _ in range(q):
        l, r = map(int, input().split())
        res.append(dist[r] - dist[l])

    ans = '\n'.join(map(str, res))
    print(ans)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    from itertools import accumulate
    h, w, d = map(int, input().split())
    p = []
    for i in range(1, h + 1):
        l = map(int, input().split())
        for j, k in enumerate(l, 1):
            p.append((k, (i, j)))
    p.sort(key=lambda x: x[0])

    q = int(input())

    dist = [0] * (w * h + 1)

    def Q(i, c, x, y):
        if i + d > w * h:
            return
        _, (nx, ny) = p[i + d - 1]
        nc = c + abs(nx - x) + abs(ny - y)
        dist[i + d] = nc
        Q(i + d, nc, nx, ny)

    for i in range(d):
        n, (x, y) = p[i]
        Q(n, 0, x, y)

    res = []
    for _ in range(q):
        l, r = map(int, input().split())
        res.append(dist[r] - dist[l])

    ans = '\n'.join(map(str, res))
    print(ans)


if __name__ == '__main__':
    main()