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

Fixed submission:
def func(n):
  if n==1:return 1
  if n==0:return 1
  if dp[n]!=-1:return dp[n]
  f1=func(n-1) if n-1 not in a else 0
  f2=func(n-2) if n-2 not in a else 0
  tmp=(f1+f2)%1000000007
  dp[n]=tmp
  return tmp
import sys
sys.setrecursionlimit(1000000)
n,m=map(int,input().split())
a={int(input()) for i in range(m)}
dp=[-1]*(n+1)
print(func(n)%1000000007)

Buggy submission (verdict: Runtime Error):
def func(n):
  if n==1:return 1
  if n==0:return 1
  if dp[n]!=-1:return dp[n]
  f1=func(n-1) if n-1 not in a else 0
  f2=func(n-2) if n-2 not in a else 0
  tmp=(f1+f2)%1000000007
  dp[n]=tmp
  return tmp
import sys
sys.setrecursionlimit(1002)
n,m=map(int,input().split())
a=[int(input()) for i in range(m)]
dp=[-1]*(n+1)
print(func(n)%1000000007)

Buggy submission (verdict: Runtime Error):
def func(n):
  if n==1:return 1
  if n==0:return 1
  if dp[n]!=-1:return dp[n]
  f1=func(n-1) if n-1 not in a else 0
  f2=func(n-2) if n-2 not in a else 0
  dp[n]=f1+f2
  return f1+f2

n,m=map(int,input().split())
a=[int(input()) for i in range(m)]
dp=[-1]*(n+1)
print(func(n)%1000000007)
Problem p03041 (python)

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

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
s=list(input())
s[k]=s[k].lower()
s="".join(s)
print(s)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
s=list(input())
s[k]=s[k].lower()
for i in range(len(s)):
  print(s[i],end="")
print("\n")

Buggy submission (verdict: Runtime Error):
import numpy as np
n,k=map(int,input().split())
s=list(input())
s[k]=s[k].lower()
for i in range(len(s)):
  print(s[i],end="")
#print()

Buggy submission (verdict: Runtime Error):
import numpy as np
n,k=map(int,input().split())
s=list(input())
s[k]=s[k].lower()
for i in range(len(s)):
  print(s[i],end="")
print("")
Problem p02597 (python)

Fixed submission:
n = int(input())
c = list(input())
print(c[:c.count("R")].count("W"))

Buggy submission (verdict: Runtime Error):
n = int(input())
c = list(input())
c = c[::-1]
cou = 0
for i in range(len(c)/2):
    if c[i] == "R":
        cou += 1
print(cou)
Problem p02682 (python)

Fixed submission:
a,b,c,k=map(int,input().split())
h=k-a
h2=h-b
if a>k:
  print(k)
else:
  if h<=b:
    print(a)
  else:
    print(a+h2*(-1))

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
h=k-a
h2=h-b
if a>k:
  print(k)
else:
  if h<=b:
    print(a)
  else:
    print(a+h2*(-1))

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
h=k-a
h2=h-b
if a>k:print(k)
else:if h<=b:print(a)
     else: print(a+h2*(-1))
Problem p02689 (python)

Fixed submission:
n, m = map(int, input().split())
h = list(map(int, input().split()))
D = dict()
for i in range(1, n+1):
    D[i] = h[i-1]
L = [1 for i in range(n)]
for _ in range(m):
    a, b =map(int, input().split())
    if D[a] > D[b]:
        L[b-1] = 0
    elif D[a] == D[b]:
        L[a-1] = 0
        L[b-1] = 0
    else:
        L[a-1] = 0
ans = 0
for e in L:
    ans += e
print(ans)

Buggy submission (verdict: Runtime Error):
import copy
n, m = map(int, input().split())
s = [int(x) for x in input().split()]
s2 = copy.deepcopy(s)
for _ in range(m):
    a, b = map(int, input().split())

    a1=s[a-1]
    b1=s[b-1]
    if a1<b1:
        p=(a1 in s2)
        if p == False:
            f=1
        else:
            s2.remove(a1)
    elif a1>b1:
        p=(a1 in s2)
        if p == False:
            f=1
        else:
            s2.remove(b1)
print(len(s2))
Problem p02699 (python)

Fixed submission:
a,b=map(int,input().split())
if a<=b:
    print("unsafe")
else:
    print("safe")

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
if a=<b:
    print("unsafe")
else:
    print("safe")

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split)
if a=<b:
    print("unsafe")
else:
    print("safe")
Problem p02711 (python)

Fixed submission:
s=str(input())
h=1
for i in s:
    if i=='7':
        h=0
if h==0:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
s=int(input().split())
for i in s:
    if i==7:
        print("Yes")
print("No")
Problem p02753 (python)

Fixed submission:
a,b,c=input()
if a==b==c:
    print("No")
else:
    print("Yes")

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
if b!=0:
    k=a//(b+c)
    h=k*b
    t=a-b*k-c*k
    print(t+h)
else:
    print(0)
Problem p03804 (python)

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

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

b = []
for i in range(m):
   b.append(input())

def func(base, target):
   for i in range(n-m+1):
      check = base[i:i+m]
      for j in range(n-m+1):
         check2 = [line[j:j+m] for line in check]
         if check2 == target:
            return print('Yes')
   return print('No')

func(a,b)

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

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

b = []
for i in range(m):
   b.append(input())

def func(base, target):
       for i in range(n-m+1):
        check = base[i:i+m]
        for j in range(n-m+1):
            check2 = [line[j:j+m] for line in check]
            if check2 == target:
                return print('Yes')
    return print('No')

func(a,b)
Problem p03805 (python)

Fixed submission:
n, m = map(int, input().split())
g = [[] for i in range(n)]

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

def dfs(v):
   if (len(v) == n):
      return 1

   ans = 0
   for u in set(g[v[-1]]) - set(v):
      ans += dfs(v + [u])

   return ans

print(dfs([0]))

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
edge = [[0] * n for _ in range(n)]
for i in range(n):
   a, b = map(int, input().split())
   edge[a-1][b-1] = 1
   edge[b-1][a-1] = 1

# depth-first search
def dfs(now, visited):
   if (False not in visited):
      return(1)

   ans = 0
   for i in range(1, n+1):
      if (edge[now-1][i-1] == 1  and visited[i-1] == False):
         visited[i-1] = True
         # recursive
         ans += dfs(i, visited)
         visited[i-1] = False

   return(ans)

visited = [False] * n
visited[0] = True
print(dfs(1, visited))

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
edge = [[0] * n for _ in range(n)]
for i in range(n):
   a, b = map(int, input().split())
   edge[a-1][b-1] = 1
   edge[b-1][a-1] = 1

def dfs(now, visited):
   if (False not in visited):
      return(1)

   ans = 0
   for i in range(n):
      if (edge[now-1][i-1] == 1  and visited[i-1] == False):
         visited[i-1] = True
         ans += dfs(i, visited)
         visited[i-1] = False

   return(ans)

visited = [False] * n
visited[0] = True
print(dfs(1, visited))
Problem p03834 (python)

Fixed submission:
s = input()
print(s.replace(',', ' '))

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

count = 0
for x in range(0, k+1):
   for y in range(0, k+1):
         z = s - (x + y)
         if (z >= 0 and z <= k):
            count += 1
print(count)
Problem p02723 (python)

Fixed submission:
s=input()
if s[2]==s[3] and s[4]==s[5]:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
s=input()
if s[2]==s[3] and s[4]=s[5]:
    print("Yes")
else:
    print("NO")
Problem p02859 (python)

Fixed submission:
r=int(input())
print(r**2)

Buggy submission (verdict: Runtime Error):
x,y=map(int,input().split())
def cal(number,mod):
    m=mod-2
    mod2=""
    while m!=0:
        if m%2==0:
            mod2="0"+mod2
        else:
            mod2="1"+mod2
        m=m//2
    two=[]
    for i in range(len(mod2)):
        if mod2[len(mod2)-1-i]=="1":
            two.append(i)
    ret=1
    for i in two:
        v=i
        retsub=number
        while v>0:
            retsub=retsub**2
            retsub=retsub%mod
            v-=1
        ret*=retsub
    ret=ret%mod
    return ret
ans=0
M=10**9+7
if (2*x-y)%3==0:
    n=(x+y)//3
    r=(2*x-y)//3
    if n<r:
        print(0)
        exit()
    l=[1]
    num=1
    for i in range(1,n+1):
        p=(num*i)%(M)
        l.append(p)
        num=p
    a=l[n]
    b=cal(l[n-r],M)
    c=cal(l[r],M)
    ans=(a*b*c)%M
print(ans)
Problem p02933 (python)

Fixed submission:
a=int(input())
s=input()
if a>=3200:
    print(s)
else:
    print("red")

Buggy submission (verdict: Runtime Error):
n,q=map(int,input().split())
ans=[0]*(n+1)
score=[0]*(n+1)
g=[[] for _ in range(n+1)]
for i in range(n-1):
    a,b=map(int,input().split())
    g[a].append(b)
for j in range(q):
    p,x=map(int,input().split())
    score[p]+=x
visited=set()
visited.add(1)
def dfs(v):
    global ans
    global score
    ans[v]+=score[v]
    for i in range(len(g[v])):
        if not g[v][i] in visited:
            ans[g[v][i]]+=ans[v]
            dfs(g[v][i])
dfs(1)
ans_chr=""
for i in range(1,n+1):
    ans_chr=ans_chr+str(ans[i])+" "
print(ans_chr)
Problem p03017 (python)

Fixed submission:
n,a,b,c,d=map(int,input().split())
s=input()
if s[a-1:max(c,d)].count("##")>0:
    print("No")
elif c<d:
    print("Yes")
else:
    if "..." in s[b-2:d+1]:
        print("Yes")
    else:
        print("No")

Buggy submission (verdict: Runtime Error):
n,a,b,c,d=map(int,input().split())
s=input()
if s[:max(c,d)].count("##")>0:
    print("No")
elif c<d:
    print("Yes")
else:
    if s[b-1:d+1].count("...")=0:
        print("No")
    else:
        print("Yes")
Problem p03104 (python)

Fixed submission:
a,b=map(int,input().split())
a+=1
b+=1
s=0
for i in range(1,42):
    k=b-(b//(2**i))*(2**i)
    if k>=2**(i-1):
        x=(b//(2**i))*(2**(i-1))+(k%(2**(i-1)))
    else:
        x=(b//(2**i))*(2**(i-1))
    j=(a-1)-((a-1)//(2**i))*(2**i)
    if j>=2**(i-1):
        y=((a-1)//(2**i))*(2**(i-1))+(j%(2**(i-1)))
    else:
        y=((a-1)//(2**i))*(2**(i-1))
    if x!=0 and (x-y)%2!=0:
        s+=2**(i-1)
print(s)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
s=0
for i in range(1,42):
    if (b//2**i)*(2**(i-1))+(b%(2*i-1))-(((a-1)//2**i)*(2**(i-1))+((a-1)%(2*i-1))%2!=0:
        s=s+2**(i-1)
print(s)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
s=0
for i in range(1,42):
    if (b//2**i)*(2**(i-1))+(b%(2*i-1))-(((a-1)//2**i)*(2**(i-1))+((a-1)%(2*i-1))%2!=0
        s=s+2**(i-1)
print(s)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
s=0
for i in range(1,42):
    if (b//2**i)*(2**(i-1))+(b%(2*i-1))-(((a-1)//2**i)*(2**(i-1))+((a-1)%(2*i-1))%2!=0
        s+=2**(i-1)
print(s)
Problem p03127 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
b=list(set(a))   
if len(b)==1:
    print(b[0])
    exit()
else:
    c=sorted(b)
    x=1
    while x>0:
        v=c[0]
        for i in range(len(c)):
            if i!=0:
                c[i]=c[i]%v
        while 0 in c:
            c.remove(0)
        c=sorted(list(set(c)))
        if len(c)==1:
            print(c[0])
            exit()
        if c[0]==1:
            x=0
print(1)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
b=list(set(a))   
if len(b)==1:
    print(b[0])
    exit()
else:
    c=sorted(b)
    x=1
    while x>0:
        v=c[0]
        for i in range(len(c)):
            if i!=0:
                c[i]=c[i]%v
        c.remove(0)
        c=sorted(list(set(c)))
        if len(c)==1:
            print(c[0])
            exit()
        if c[0]==1:
            x=0
print(1)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
b=list(set(a))   
if len(b)==1:
    print(b[0])
    exit()
else:
    c=sorted(b)
    x=1
    while x>0:
        v=c[0]
        for i in range(len(c)):
            if i!=0:
                c[i]=c[i]%v
        c.removed(0)
        c=sorted(list(set(c)))
        if len(c)==1:
            print(c[0])
            exit()
        if c[0]==1:
            x=0
print(1)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
b=list(set(a))   
if len(b)==1:
    print(b[0])
    exit()
else: 
    x=1
    while x>0:
        c=sorted(b)
        c[1]=c[1]-c[0]
        c=sorted(list(set(c)))
        if c[0]==1:
            x=0
        if len(c)==1:
            print(2):
            exit()
print(1)
Problem p03242 (python)

Fixed submission:
n=input()
ans=""
for i in range(len(n)):
    if n[i]=="1":
        ans+="9"
    else:
        ans+="1"
print(ans)

Buggy submission (verdict: Runtime Error):
n=input()
for i in range(len(n)):
    if n[i]=="1":
        n[i]="9"
    else:
        n[i]="1"
print(n)
Problem p03631 (python)

Fixed submission:
n=input()
for i in range(len(n)//2):
    if n[i]!=n[-1-i]:
        print("No")
        exit()
print("Yes")

Buggy submission (verdict: Runtime Error):
n=input()
for i in range(len(n)//2)
    if n[i]!=n[-1-i]:
        print("No")
        exit()
print("Yes")
Problem p03705 (python)

Fixed submission:
n,a,b=map(int,input().split())
if a>b:
    print(0)
    exit()
elif n==1 and a!=b:
    print(0)
    exit()
print((b-a)*(n-2)+1)

Buggy submission (verdict: Runtime Error):
n,a,b=map(int,input().split())
if a>b:
    print(0)
    exit()
elif n=1 and a!=b:
    print(0)
    exit()
print((b-a)*(n-2)+1)
Problem p03774 (python)

Fixed submission:
n,m=map(int,input().split())
h=[]
p=[]
def man(a,c,b,d):
    s=abs(a-c)+abs(b-d)
    return s
for i in range(n):
    h.append(list(map(int,input().split())))
for j in range(m):
    p.append(list(map(int,input().split())))
for k in range(n):
    l=float("inf")
    for v in range(m):
        x=man(h[k][0],p[v][0],h[k][1],p[v][1])
        if x<l:
            l=x
            y=v+1
    print(y)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
h=[]
p=[]
def man(a,c,b,d):
    s=abs(a-b)+abs(c-d)
    return s
for i in range(n):
    h.append(list(map(int,input().split())))
for j in range(m):
    p.append(list(map(int,input().split())))
for k in range(n):
    l=float(inf)
    for v in range(m):
        x=man(h[k][0],p[v][0],h[k][1],p[v][1])
        if x<l:
            l=x
    print(l)
Problem p03834 (python)

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

Buggy submission (verdict: Runtime Error):
a,b,c=input().split(,)
print(a+" "+b+" "+c)
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 = int(input())
b =list(input().split())

c = 0
for i in range(a):
  if i>0:
    if (int(b[i-1]) - int(b[i])>1):
      c=1
if c==1:
  print("No")
else:
  print("Yes")
Problem p02970 (python)

Fixed submission:
import math
n, d = map(int,input().split())
print(math.ceil(n/(2*d+1)))

Buggy submission (verdict: Runtime Error):
n, d = map(int,input().split())
print(math.ceil(n/(2*d+1)))
Problem p03011 (python)

Fixed submission:
print(sum(sorted(list(map(int,input().split())))[:2]))

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
a = set(int(input()) for _ in range(m))
#for i in range(m):
#  a.append(int(input()))
b=[0 for x in range(n+1)]
b[0]=1
for i in range(1,n+1):
  if i in a:
    continue
  x=b[i-1]
  if i>1:x+=b[i-2]
  b[i]=x
print(b[n]%(10**9+7))

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=[]
for i in range(m):
  a.append(int(input()))
b=[0 for x in range(n+1)]
b[0]=1
for i in range(1,n+1):
  if i in a:
    b[i]=0
  else:
    b[i]+=b[i-1]
    if i>1:b[i]+=b[i-2]
print(b[n]%=(10**9+7))
Problem p03013 (python)

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

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=[]
for i in range(m):
  a.append(int(input()))
b=[0 for x in range(n+1)]
b[0]=1
for i in range(1,n+1):
  if i in a:
    b[i]=0
  else:
    b[i]+=b[i-1]
    if i>1:b[i]+=b[i-2]
print(b[n]%=(10**9+7))
Problem p03075 (python)

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

Buggy submission (verdict: Runtime Error):
a = [int(input()) for i in range 6]
print("Yay!" if a[4]-a[0]<=a[5] else ":(")
Problem p02623 (python)

Fixed submission:
def main2():
    n, m, k = list(map(int, input().split()))
    a_books = list(map(int, input().split()))
    b_books = list(map(int, input().split()))

    a, b = [0], [0]
    
    for i in range(len(a_books)):
        a.append(a[i] + a_books[i])

    for i in range(len(b_books)):
        b.append(b[i] + b_books[i])
    ans, j  = 0, len(b_books)
    
    for i in range(len(a)):
        if a[i] > k :
            break
        while b[j] > k - a[i]:
            j -= 1
        ans = max(ans, i+j)
    print(ans)


if __name__ == '__main__':
    main2()

Buggy submission (verdict: Runtime Error):
def main():
    n, m, k = list(map(int, input().split()))
    a_books = list(map(int, input().split()))
    b_books = list(map(int, input().split()))

    sumbooks = sum(a_books) + sum(b_books)
    count = len(a_books) + len(b_books)
    if a_books[0] > k and b_books[0] > k:
        print(0)
        exit()
    elif sumbooks <= k:
        print(len(a_books) + len(b_books))
        exit()

    while sumbooks > k:
        if len(a_books) and a_books[-1] >= b_books[-1]:
            sumbooks -= a_books.pop(-1)
        elif len(b_books) and b_books[-1] >= a_books[-1]:
            sumbooks -= b_books.pop(-1)

        if sumbooks <= k:
            break
        count -= 1
    print(count)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):

def main():
    n, m, k = list(map(int, input().split()))
    a_books = list(map(int, input().split()))
    b_books = list(map(int, input().split()))

    sumbooks = sum(a_books) + sum(b_books)
    count = len(a_books) + len(b_books)
    if a_books[0] > k and b_books[0] > k:
        print(0)
        exit()
    elif sumbooks <= k:
        print(len(a_books) + len(b_books))
        exit()

    while sumbooks > k:
        if len(a_books) and a_books[-1] >= b_books[-1]:
            sumbooks -= a_books.pop(-1)
        elif len(b_books) and b_books[-1] >= a_books[-1]:
            sumbooks -= b_books.pop(-1)

        if sumbooks <= k:
            break
        count -= 1
    print(count)


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

Fixed submission:

url = "https://atcoder.jp//contests/abc159/tasks/abc159_a"

def main():
    e, v = list(map(int, input().split()))
    lis = []
    for i in range(e):
        lis.append(1)
    for i in range(v):
        lis.append(2)
    count = 0
    for i in range(len(lis)):
        for j in range(i + 1, len(lis)):
            # print(lis[i], lis[j])
            if (lis[i] + lis[j]) % 2 == 0:
                count += 1
    print(count)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    input()
    t = list(map(int, input().split()))
    col = collections.Counter(t)
    com = {}
    al = 0
    for key in col:
        com[key] = combinations_count(col[key], 2)
        al += com[key]
    for v in t:
        c = col[v] - 1
        if c <= 1:
            c = 0
        else:
            c = combinations_count(c, 2)
        tmp = (al - com[v]) + c
        print(tmp)


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

Fixed submission:
import fractions


def main():
    n, m = list(map(int, input().split()))
    print((n * m) // fractions.gcd(n, m))


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import math

def main():
    n, m = list(map(int, input().split()))
    print((n * m) // math.gcd(n, m))


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

Fixed submission:
import math

def main():
    n = int(input())
    m = math.sqrt(n)
    ans = []
    for i in range(1, int(m) + 1):
        div = n / i
        if not float.is_integer(div):
            continue
        ans.append((div+i)-2)

    print(int(min(ans)))


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import math

def main():
    n = int(input())
    m = math.sqrt(n)
    m = int(m) if float.is_integer(m) else math.floor(m) - 1
    div = n // m
    # print(m, div)
    print(m-1 + div-1)


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

Fixed submission:
import heapq
def main():
    n, m = list(map(int, input().split()))
    t = list(map(int, input().split()))
    t = list(map(lambda x: x*(-1), t))
    heapq.heapify(t)
    while m > 0:
        v = heapq.heappop(t) * -1
        heapq.heappush(t, (v // 2)* -1)
        m -= 1

    print(sum(t)*-1)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n, m = list(map(int, input().split()))
    t = list(map(int, input().split()))
    t = list(map(lambda x: x*(-1), t))
    heapq.heapify(t)
    while m > 0:
        v = heapq.heappop(t) * -1
        heapq.heappush(t, (v // 2)* -1)
        m -= 1

    print(sum(t)*-1)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n, m = list(map(int, input().split()))
    t = list(map(int, input().split()))
    while m > 0:
        idx = 0
        t.sort(reverse=True)
        # print(t)
        t[0] //= 2
        m -= 1
        if m != 0:
            if t[0] > t[1]:
                t[0] //= 2
            else:
                t[1] //= 2
            m -= 1

    print(sum(t))


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

Fixed submission:

url = "https://atcoder.jp//contests/abc057/tasks/abc057_c"
def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]


def main():
    n = int(input())
    ans = 10000000000000000
    ns = make_divisors(n)
    for i in range(0, (len(ns)//2) + 1):
        tmp = max(len(str(ns[i])), len(str(ns[len(ns)-i-1])))
        ans = tmp if tmp < ans else ans
    if len(ns) % 2 != 0:
            tmp = len(str(ns[len(ns) // 2]))
            ans = tmp if tmp < ans else ans
    print(ans)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sympy
url = "https://atcoder.jp//contests/abc057/tasks/abc057_c"

def main():
    n = int(input())
    ans = 10000000000000000
    ns = sympy.divisors(n)
    for i in range(0, (len(ns)//2) + 1):
        tmp = max(len(str(ns[i])), len(str(ns[len(ns)-i-1])))
        ans = tmp if tmp < ans else ans
    if len(ns) % 2 != 0:
            tmp = len(str(ns[len(ns) // 2]))
            ans = tmp if tmp < ans else ans
    print(ans)

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

Fixed submission:
print('a' if input().islower() else 'A')

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
l = sorted([int(x) for x in input().split()])

print(sum(l[:k]))
Problem p02836 (python)

Fixed submission:
S = list(input())
Sinv = S[::-1]

cnt = 0
for i in range(len(S)//2):
    if S[i] != Sinv[i]:
        S[i] = Sinv[i]
        cnt += 1
print(cnt)

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

count = 0
for i in range(len(s)):
  if s[i] != rev_s[i]:
    count += 1
    
print(count)
Problem p02880 (python)

Fixed submission:
s = {x*y for x in range(1, 10) for y in range(1, 10)}

print("Yes" if int(input()) in s else "No")

Buggy submission (verdict: Runtime Error):
n = int(input())
s = set(filter(lambda x : n % x == 0 and n / x < 10, [x for x in range(1, 10)])

print("Yes" if len(s) == 0 in s else "No")
Problem p02916 (python)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
ttl = sum(b)
for i in range(n-1):
    if a[i]+1 == a[i+1]:
        ttl += c[a[i]-1]
print(ttl)

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

m = max(a)

print(sum(b) + c[m - 1])