Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
i,o,t,j,l,s,z=map(int,input().split())
a=(i//2+j//2+l//2)*2
print([a,max(a,((i-1)//2+(j-1)//2+(l-1)//2)*2+3)][i and j and l]+o)

Fixed submission:
i,o,t,j,l,s,z=map(int,input().split())
a=(i//2+j//2+l//2)*2
print([a,max(a,((i-1)//2+(j-1)//2+(l-1)//2)*2+3)][not(not(i and j and l))]+o)

Buggy python submission (verdict: Runtime Error):
i,o,t,j,l,s,z=map(int,input().split())
a=(i//2+j//2+l//2)*2
print([a,max(a,((i-1)//2+(j-1)//2+(l-1)//2)*2+3)][i and j and l]+o)

Fixed submission:
i,o,t,j,l,s,z=map(int,input().split())
a=(i//2+j//2+l//2)*2
print([a,max(a,((i-1)//2+(j-1)//2+(l-1)//2)*2+3)][not(not(i and j and l))]+o)
Buggy python submission (verdict: Runtime Error):
print'A%sC'%input()[8]

Fixed submission:
print'A%sC'%raw_input()[8]
Buggy python submission (verdict: Runtime Error):
from functools import lru_cache
@lru_cache(maxsize=None)
def search(i,j):
  global s,h,w
  if i==h-1and j==w-1:return 1
  r=0
  if i<h-1and s[i+1][j]=='#':r|=search(i+1,j)
  else if j<w-1and s[i][j+1]=='#':r|=search(i,j+1)
  if i>0and s[i-1][j]=='#':r=0
  if j>0and s[i][j-1]=='#':r=0
  return r
h,w=map(int,input().split())
s=[input()for _ in[0]*h]
print(('P'*search(0,0)or'Imp')+'ossible')

Fixed submission:
h,w=map(int,input().split())
s=[input()for _ in[0]*h]
a=[['..','..'],['.#','..'],['..','#.'],['##','..'],['..','##'],['#.','#.'],['.#','.#'],['##','.#'],['#.','##']]
for i in range(h-1):
  for j in range(w-1):
    t=s[i][j:j+2]
    u=s[i+1][j:j+2]
    for b in a:
      if t==b[0]and u==b[1]:
        break
    else:
      print('Impossible')
      exit()
print('Possible')
Buggy python submission (verdict: Runtime Error):
*a=map(int,input().split());print('YNeos'[sum(a)/2!=max(a)::2])

Fixed submission:
*a,=map(int,input().split());print('YNeos'[sum(a)/2!=max(a)::2])
Buggy python submission (verdict: Time Limit Exceeded):
n,t,a,*u=map(int,open(0).read().split())
for u,b in zip(u[::2],u[1::2]):
    v,c=u,b
    while v<t or c<a:
        v+=u
        c+=b
    t,a=v,c
print(t+a)

Fixed submission:
n,t,a,*u=map(int,open(0).read().split())
for u,b in zip(u[::2],u[1::2]):
    x=0-min(-t//u,-a//b)
    t,a=u*x,b*x
print(t+a)

Buggy python submission (verdict: Time Limit Exceeded):
n,t,a,*u=map(int,open(0).read().split())
for u,b in zip(u[::2],u[1::2]):
    while t*b!=a*u:
        if t*b<a*u:t+=1
        else:a+=1
print(t+a)

Fixed submission:
n,t,a,*u=map(int,open(0).read().split())
for u,b in zip(u[::2],u[1::2]):
    x=0-min(-t//u,-a//b)
    t,a=u*x,b*x
print(t+a)
Buggy python submission (verdict: Runtime Error):
import difflib;print(difflib.SequenceMatcher(None,'CODEFESTIVAL2016',input())*100//16)

Fixed submission:
s=list('CODEFESTIVAL2016');t=list(input());print(sum([1 for i in range(16) if s[i]!=t[i]]))
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = map(int, input().split())
c = 0
for i in range(n):
  if a[a[i]] == i:
    c++
print(c)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
c = 0
for i in range(n):
  if a[a[i] - 1] - 1 == i:
    c += 1
print(c // 2)
Buggy python submission (verdict: Time Limit Exceeded):
def main():
  n,a,*x=map(int,open(0).read().split())
  x=[0]+x
  dp=[[[0]*(50*n+1)for j in range(n+1)]for i in range(n+1)]
  dp[0][0][0]=1
  for i in range(1,n+1):
    dp[i][0]=dp[i-1][0]
    for j in range(1,n+1):
      for k in range(1,50*n+1):
        dp[i][j][k]=dp[i-1][j][k]
        if k-x[i]>=0:
          dp[i][j][k]+=dp[i-1][j-1][k-x[i]]
  ans=0
  for i in range(1,n+1):
    j=i*a
    if j<50*n+2:
      ans+=dp[-1][i][j]
  print(ans)
if __name__=='__main__':
  main()

Fixed submission:
n,a,*x=map(int,open(0).read().split())
x=[0]+x
dp=[[[0]*(50*n+1)for j in range(n+1)]for i in range(n+1)]
dp[0][0][0]=1
for i in range(1,n+1):
  dp[i][0]=dp[i-1][0]
  for j in range(1,n+1):
    for k in range(1,50*n+1):
      dp[i][j][k]=dp[i-1][j][k]
      if k-x[i]>=0:
        dp[i][j][k]+=dp[i-1][j-1][k-x[i]]
ans=0
for i in range(1,n+1):
  j=i*a
  if j<50*n+2:
    ans+=dp[-1][i][j]
print(ans)

Buggy python submission (verdict: Runtime Error):
def main():
  n,a,*x=map(int,open(0).read().split())
  x=[0]+x
  dp=[[[0]*(50*n+1)for j in range(n+1)]for i in range(n+1)]
  dp[0][0][0]=1
  for i in range(1,n+1):
    dp[i][0]=dp[i-1][0]
    for j in range(1,n+1):
      for k in range(1,50*n+1):
        dp[i][j][k]=dp[i-1][j][k]
        if k-x[i]>=0:
          dp[i][j][k]+=dp[i-1][j-1][k-x[i]]
  ans=0
  for i in range(1,n+1):
    j=i*a
    if j<50*n+2:
      ans+=dp[-1][i][j]
  print(ans)
def __name__=='__main__':
  main()

Fixed submission:
n,a,*x=map(int,open(0).read().split())
x=[0]+x
dp=[[[0]*(50*n+1)for j in range(n+1)]for i in range(n+1)]
dp[0][0][0]=1
for i in range(1,n+1):
  dp[i][0]=dp[i-1][0]
  for j in range(1,n+1):
    for k in range(1,50*n+1):
      dp[i][j][k]=dp[i-1][j][k]
      if k-x[i]>=0:
        dp[i][j][k]+=dp[i-1][j-1][k-x[i]]
ans=0
for i in range(1,n+1):
  j=i*a
  if j<50*n+2:
    ans+=dp[-1][i][j]
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n,a,*x=map(int,open(0).read().split())
x=[0]+x
dp=[[[0]*(50*n+1)for j in range(n+1)]for i in range(n+1)]
dp[0][0][0]=1
for i in range(1,n+1):
  dp[i][0]=dp[i-1][0]
  for j in range(1,n+1):
    for k in range(1,50*n+1):
      dp[i][j][k]=dp[i-1][j][k]
      if k-x[i]>=0:
        dp[i][j][k]+=dp[i-1][j-1][k-x[i]]
ans=0
for i in range(1,n+1):
  j=i*a
  if j<50*n+2:
    ans+=dp[-1][i][j]
print(ans)

Fixed submission:
n,a,*x=map(int,open(0).read().split())
x=[0]+x
dp=[[[0]*(50*n+1)for j in range(n+1)]for i in range(n+1)]
dp[0][0][0]=1
for i in range(1,n+1):
  dp[i][0]=dp[i-1][0]
  for j in range(1,n+1):
    for k in range(1,50*n+1):
      dp[i][j][k]=dp[i-1][j][k]
      if k-x[i]>=0:
        dp[i][j][k]+=dp[i-1][j-1][k-x[i]]
ans=0
for i in range(1,n+1):
  j=i*a
  if j<50*n+2:
    ans+=dp[-1][i][j]
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n,a,*x=map(int,open(0).read().split())
x=[0]+x
dp=[[[0]*(50*n+1)for j in range(n+1)]for i in range(n+1)]
dp[0][0][0]=1
for i in range(1,n+1):
  dp[i][0]=dp[i-1][0]
  for j in range(1,n+1):
    for k in range(1,50*n+1):
      dp[i][j][k]=dp[i-1][j][k]
      if k-x[i]>=0:
        dp[i][j][k]+=dp[i-1][j-1][k-x[i]]
ans=0
for i in range(1,n+1):
  j=i*a
  if j<50*n+2:
    ans+=dp[-1][i][j]
print(ans)

Fixed submission:
n,a,*x=map(int,open(0).read().split())
x=[0]+x
dp=[[[0]*(50*n+1)for j in range(n+1)]for i in range(n+1)]
dp[0][0][0]=1
for i in range(1,n+1):
  dp[i][0]=dp[i-1][0]
  for j in range(1,n+1):
    for k in range(1,50*n+1):
      dp[i][j][k]=dp[i-1][j][k]
      if k-x[i]>=0:
        dp[i][j][k]+=dp[i-1][j-1][k-x[i]]
ans=0
for i in range(1,n+1):
  j=i*a
  if j<50*n+2:
    ans+=dp[-1][i][j]
print(ans)
Buggy python submission (verdict: Runtime Error):
s=t=0
for _ in[0]*int(input()):a=int(input());s+=(a+t)//2;t=(a+t)%2&(i>0)
print(s)

Fixed submission:
t=c=0
for _ in[0]*input():i=input();c+=(i+t)/2;t=(i+t)%2&(i>0)
print c

Buggy python submission (verdict: Time Limit Exceeded):
t=c=0
for _ in[0]*input():i=input();c+=(i+t)/2;t=(i+t)%2&(i>0)
print c

Fixed submission:
t=c=0
for _ in[0]*input():i=input();c+=(i+t)/2;t=(i+t)%2&(i>0)
print c

Buggy python submission (verdict: Time Limit Exceeded):
t=c=0
for _ in[0]*input():
 i=input()
 if i:t+=i 
 else:c+=t/2;t=0
print c+t/2

Fixed submission:
t=c=0
for _ in[0]*input():i=input();c+=(i+t)/2;t=(i+t)%2&(i>0)
print c
Buggy python submission (verdict: Runtime Error):
s=input()
n=len(s)
for i in range(n-1):
  if s[i]==s[i+1]:
    print(i+1,i+2)
    break
  elif i<n-1 and s[i]==s[i+2]:
    print(i+1,i+3)
    break
else:
  print(-1,-1)

Fixed submission:
s=input()
n=len(s)
for i in range(n-1):
  if s[i]==s[i+1]:
    print(i+1,i+2)
    break
  elif i<n-2 and s[i]==s[i+2]:
    print(i+1,i+3)
    break
else:
  print(-1,-1)

Buggy python submission (verdict: Runtime Error):
s=input()
n=len(s)
for i in range(n-1):
  if s[i]==s[i+1]:
    print(i,i+1)
    break
  elif i<n-1 and s[i]==s[i+2]:
    print(i,i+2)
    break
else:
  print(-1,-1)

Fixed submission:
s=input()
n=len(s)
for i in range(n-1):
  if s[i]==s[i+1]:
    print(i+1,i+2)
    break
  elif i<n-2 and s[i]==s[i+2]:
    print(i+1,i+3)
    break
else:
  print(-1,-1)
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split());print('NPeogsaittiivvee'[a>0or(b-a)%2::2]*(a*b>0)or'Zero')

Fixed submission:
a,b=map(int,input().split());print('Zero'*(a+b==0or abs(a+b)<abs(a)+abs(b))or'NPeogsaittiivvee'[a>0or(b-a)%2::2])

Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split());print('NPeogsaittiivvee'[a>0or(b-a)%2::2]*(a*b>0)or'Zero')

Fixed submission:
a,b=map(int,input().split());print('Zero'*(a+b==0or abs(a+b)<abs(a)+abs(b))or'NPeogsaittiivvee'[a>0or(b-a)%2::2])

Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split());print('Zero'*(a*b<=0)or'NPeogsaittiivvee'[b>=0or(b-a)%2::2])

Fixed submission:
a,b=map(int,input().split());print('Zero'*(a+b==0or abs(a+b)<abs(a)+abs(b))or'NPeogsaittiivvee'[a>0or(b-a)%2::2])

Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split());print('Zero'*(a+b==0or abs(a+b)<abs(a)+abs(b))or'NPeogsaittiivvee'[a>0or(b-a)%2::2])

Fixed submission:
a,b=map(int,input().split());print('Zero'*(a+b==0or abs(a+b)<abs(a)+abs(b))or'NPeogsaittiivvee'[a>0or(b-a)%2::2])
Buggy python submission (verdict: Runtime Error):
n=int(input()[:4]);a=set(input())
while a&set(str(n)):n+=1
print(n)

Fixed submission:
n=int(input().split()[0]);a=set(input())
while a&set(str(n)):n+=1
print(n)

Buggy python submission (verdict: Runtime Error):
n=int(input()[:5]);a=set(input())
while a&set(str(n)):n+=1
print(n)

Fixed submission:
n=int(input().split()[0]);a=set(input())
while a&set(str(n)):n+=1
print(n)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ans = 0
for a in range(1,n+1):
  for b in range(1,n+1):
    for c in range(1,n):
      if a*b+c == n:
        ans += 1
print(ans)

Fixed submission:
n = int(input())
ans = 0
for a in range(1,n):
  ans += (n-1)//a
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
b = 10**9+7
s = 0
for i in range(n-1):
  c = 0
  for j in range(i+1,n):
    c += a[j]
  s += a[i] * c
print(s % b)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
s = 0
c = sum(a)
for i in range(n-1):
  c -= a[i]
  s += a[i] * c
print(s % (10**9+7))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
b = 10**9+7
s = 0
for i in range(n-1):
  s += a[i] * sum(a[i+1:])
print(s % b)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
s = 0
c = sum(a)
for i in range(n-1):
  c -= a[i]
  s += a[i] * c
print(s % (10**9+7))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
b = 10**9+7
sum = 0
for i in range(n):
  for j in range(i+1,n):
    sum += a[i] * a[j] % b
print(sum % b)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
s = 0
c = sum(a)
for i in range(n-1):
  c -= a[i]
  s += a[i] * c
print(s % (10**9+7))
Buggy python submission (verdict: Runtime Error):
a, b = map(int, intput().split())
print(a * b)

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

Buggy python submission (verdict: Runtime Error):
a, b = map(int, intpu().split())
print(a * b)

Fixed submission:
a, b = map(int, input().split())
print(a * b)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
ans = 1
for x in a:
  ans *= x
if ans > 10**18:
  print(-1)
else:
  print(ans)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
if 0 in a:
  print(0)
  exit(0)
ans = 1
for x in a:
  ans *= x
  if ans > 10**18:
    ans = -1
    break
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(input()) for _ in range(n)]
for i in range(n):
  print(max(a[:i]+a[i+1:]))

Fixed submission:
n = int(input())
a = [0]
for i in range(n):
  a.append(int(input()))
a.append(0)

l = [0] * (n+2)
l[0] = 0
for i in range(1,n+1):
  l[i] = max(l[i-1], a[i])

r = [0] * (n+2)
r[n] = 0
for i in range(n,0,-1):
  r[i] = max(r[i+1], a[i])

for i in range(1,n+1):
  print(max(l[i-1],r[i+1]))
Buggy python submission (verdict: Time Limit Exceeded):
l, r = map(int, input().split())
ans = 2*10**9
for i in range(l,r):
  for j in range(i+1,r+1):
    ans = min(ans, i*j%2019)
print(ans)

Fixed submission:
l, r = map(int, input().split())
ans = 2017*2018
for i in range(l,r):
  for j in range(i+1,r+1):
    ans = min(ans, i*j%2019)
    if ans == 0:
      print(ans)
      exit()
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce

def gcd(list):
  return reduce(math.gcd, list)

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

ans = 0
for i in range(n):
  ans = max(ans, gcd(a[:i]+a[i+1:]))

print(ans)

Fixed submission:
from math import *

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

l = [a[0]]
for i in range(1, n-1):
  l.append(gcd(a[i], l[i-1]))

ans = l[n-2]
r = a[n-1]
for i in range(n-2,0,-1):
  r = gcd(r, a[i+1])
  ans = max(ans, gcd(l[i-1], r))
ans = max(ans, gcd(r,a[1]))
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n, q = map(int, input().split())
s = input()
a = [list(map(int, input().split())) for i in range(q)]

c = [0]
for i in range(n-1):
  c.append(s[i:i+2]=='AC') 
    
for x in a:
  print(sum(c[x[0]:x[1]]))

Fixed submission:
n, q = map(int, input().split())
s = input()
a = [list(map(int, input().split())) for i in range(q)]

c = [0] * n
for i in range(1,n):
  c[i] = c[i-1] + (s[i-1]+s[i] == 'AC')

for x in a:
  print(c[x[1]-1]-c[x[0]-1])

Buggy python submission (verdict: Time Limit Exceeded):
n, q = map(int, input().split())
s = input()
a = [list(map(int, input().split())) for i in range(q)]

for x in a:
  cnt = 0
  for i in range(x[0]-1, x[1]-1):
    if s[i:i+2] == 'AC':
      cnt += 1
  print(cnt)

Fixed submission:
n, q = map(int, input().split())
s = input()
a = [list(map(int, input().split())) for i in range(q)]

c = [0] * n
for i in range(1,n):
  c[i] = c[i-1] + (s[i-1]+s[i] == 'AC')

for x in a:
  print(c[x[1]-1]-c[x[0]-1])

Buggy python submission (verdict: Time Limit Exceeded):
n, q = map(int, input().split())
s = input()
a = [list(map(int, input().split())) for i in range(q)]

for x in a:
  print(s[x[0]-1:x[1]].count('AC'))

Fixed submission:
n, q = map(int, input().split())
s = input()
a = [list(map(int, input().split())) for i in range(q)]

c = [0] * n
for i in range(1,n):
  c[i] = c[i-1] + (s[i-1]+s[i] == 'AC')

for x in a:
  print(c[x[1]-1]-c[x[0]-1])
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
l = len(s)
t = s.replace('01','').replace('10','')
while s != t:
  s = t
  t = s.replace('01','').replace('10','')
print(l-len(t))

Fixed submission:
s = input()
print(len(s)-abs(s.count('1')-s.count('0')))
Buggy python submission (verdict: Runtime Error):
from decimal import Decimal
n = int(input())
a = list(map(Decimal, input().split()))
cnt = 0
hal = True
while hal:
  hal = False
  for i in range(n):
    if hal == False and a[i] % 2 == 0:
      a[i] /= 2
      hal = True
    else:
      a[i] *= 3
  if hal:
    cnt += 1
print(cnt)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
c = 0
for i in range(n):
  while a[i] % 2 == 0:
    a[i] /= 2
    c += 1
print(c)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = []
for i in range(n):
  b = int(input())
  if b in a:
    a.remove(b)
  else:
    a.append(b)
print(len(a))

Fixed submission:
from collections import Counter
n = int(input())
a = [int(input()) for i in range(n)]
b = Counter(a).values()
c = [x for x in b if x % 2 != 0]
print(len(c))
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(m)]

c = [i for i in range(2, n + 1)]
b = []
for x in itertools.permutations(c):
  b.append([1] + list(x))
  
cnt = 0
for x in b:
  exist = True
  for i in range(n-1):
    if not sorted(x[i:i+2]) in a:
      exist = False
      break
  if exist:
    cnt += 1

print(cnt)

Fixed submission:
import itertools

n, m = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(m)]

c = [i for i in range(2, n + 1)]
b = []
for x in itertools.permutations(c):
  b.append([1] + list(x))
  
cnt = 0
for x in b:
  exist = True
  for i in range(n-1):
    if not sorted(x[i:i+2]) in a:
      exist = False
      break
  if exist:
    cnt += 1

print(cnt)
Buggy python submission (verdict: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

int main() {
  string s;
  cin >> s;
  for (char c = 97; c <= 122; c++) {
    if (count(s.begin(), s.end(), c) % 2 != 0) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;

  return 0;
}

Fixed submission:
s = list(input())
if all(s.count(x) % 2 == 0 for x in set(s)):
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Time Limit Exceeded):
import math

n=int(input())
c=0
for i in range (1,n):
    d=0
    for j in range (1,int(math.sqrt(i))+1):
        if i%j==0:
            d+=1
            if j*j!=i:
                d+=1
    c+=d
print(c)

Fixed submission:
import math
 
n = int(input())
cnt = 0
for i in range(1, n):
    cnt += (n-1) // i
print(cnt)
Buggy python submission (verdict: Runtime Error):
n,x,t=map(int,input().split())
r=math.ceil(n/x)*t
print(r)

Fixed submission:
import math
n,x,t=map(int,input().split())
r=math.ceil(n/x)*t
print(r)
Buggy python submission (verdict: Runtime Error):
n=int(input())
r=math.ceil(Fraction(360,n))
print(r)

Fixed submission:
import math
n=int(input())
if 360%n==0:
    print(360//n)
else:
    r=360*n//math.gcd(360,n)
    r//=n
    print(r)
Buggy python submission (verdict: Runtime Error):
n,k=map(float,input().split())
p=n*k
p=math.floor(p)
print(p)

Fixed submission:
from fractions import Fraction
n,k=map(str,input().split())
a=int(n)
b=int(k[len(k)-2:])
c=int(k[:len(k)-3])
ans=a*c
t=Fraction(a*b,100)
ans+=int(t)
print(ans)

Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
p=n*k
p=p//1
print(p)

Fixed submission:
from fractions import Fraction
n,k=map(str,input().split())
a=int(n)
b=int(k[len(k)-2:])
c=int(k[:len(k)-3])
ans=a*c
t=Fraction(a*b,100)
ans+=int(t)
print(ans)
Buggy python submission (verdict: Runtime Error):
n=int(input())
p=2
c=0
while n%p==0:
    c+=1
    n//=p
    p*=2
for i in range (3,int(math.sqrt(n))+1,2):
    p=i
    while n%p==0:
        c+=1
        n//=p
        p*=i
t=0
for i in range (2,int(math.sqrt(n))+1):
    if n%i==0:
        t=1
if t==0:
    c+=1
print(c)

Fixed submission:
import math
n=int(input())
p=2
c=0
curr=0
while n%p==0:
    curr+=1
    n//=p
j=0
j=(math.sqrt(1+8*curr)-1)//2
c+=int(j)
#print(j)
for i in range (3,int(math.sqrt(n))+1,2):
    p=i
    curr=0
    while n%p==0:
        curr+=1
        n//=p
    j=0
    j=(math.sqrt(1+8*curr)-1)//2
    c+=int(j)
    #print(j)
if n>2:
    c+=1
print(c)
Buggy python submission (verdict: Runtime Error):
s=input()
n=len(s)
r=""
c=0
for i in range (n):
    if s[i]=='?':
        r.append('D')
    else:
        r.append(s[i])
print(r)

Fixed submission:
s=input()
print(s.replace("?", "D"))

Buggy python submission (verdict: Time Limit Exceeded):
s=input()
n=len(s)
r=""
c=0
for i in range (n):
    if s[i]=='?':
        r+="D"
    else:
        r+=s[i]
print(r)

Fixed submission:
s=input()
print(s.replace("?", "D"))

Buggy python submission (verdict: Time Limit Exceeded):
a="PD"*100000+"P"
s=input()
n=len(s)
r=""
c=0
for i in range (n):
    if s[i]=='?':
        r+="D"
    else:
        r+=s[i]
print(r)

Fixed submission:
s=input()
print(s.replace("?", "D"))
Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin, stdout, setrecursionlimit
from collections import deque, defaultdict, Counter
from heapq import heappush, heappop
from functools import lru_cache
import math

#setrecursionlimit(10**6)
rl = lambda: stdin.readline()
rll = lambda: stdin.readline().split()
rli = lambda: map(int, stdin.readline().split())
rlf = lambda: map(float, stdin.readline().split())

INF, NINF = float('inf'), float('-inf')
MOD = 10**9 + 7

def main():
	n = int(rl())
	tot = 0
	while n:
		n, d = divmod(n, 10)
		tot += d 
	if tot % 9 == 0:
		print("Yes")
	else:
		print("No")
	stdout.close()

if __name__ == "__main__":
	main()

Fixed submission:
from sys import stdin, stdout, setrecursionlimit
from collections import deque, defaultdict, Counter
from heapq import heappush, heappop
from functools import lru_cache
import math

#setrecursionlimit(10**6)
rl = lambda: stdin.readline()
rll = lambda: stdin.readline().split()
rli = lambda: map(int, stdin.readline().split())
rlf = lambda: map(float, stdin.readline().split())

INF, NINF = float('inf'), float('-inf')
MOD = 10**9 + 7

def main():
	n = str(int(rl()))
	tot = 0
	for c in n:
		tot += int(c)
	if tot % 9 == 0:
		print("Yes")
	else:
		print("No")

if __name__ == "__main__":
	main()
Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin, stdout, setrecursionlimit
from collections import deque, defaultdict, Counter
from heapq import heappush, heappop
import math

rl = lambda: stdin.readline()
rll = lambda: stdin.readline().split()	
rli = lambda: map(int, stdin.readline().split())
rlf = lambda: map(float, stdin.readline().split())

INF, NINF = float('inf'), float('-inf')

def main():
	n, k = rli()
	A = list(rli())
	prev, score = 1, 1
	for i, a in enumerate(A):
		prev = score
		score *= a 
		if i >= k:
			score //= A[i-k]
			if score > prev:
				print("Yes")
			else:
				print("No")
	stdout.close()

if __name__ == "__main__":
	main()

Fixed submission:
from sys import stdin, stdout, setrecursionlimit
from collections import deque, defaultdict, Counter
from heapq import heappush, heappop
import math

rl = lambda: stdin.readline()
rll = lambda: stdin.readline().split()	
rli = lambda: map(int, stdin.readline().split())
rlf = lambda: map(float, stdin.readline().split())

INF, NINF = float('inf'), float('-inf')

def main():
	n, k = rli()
	A = list(math.log(x) for x in rli())
	prev, score = 1, 1
	for i, a in enumerate(A):
		prev = score
		score += a 
		if i >= k:
			score -= A[i-k]
			if score > prev:
				print("Yes")
			else:
				print("No")
	stdout.close()

if __name__ == "__main__":
	main()
Buggy python submission (verdict: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 29;

typedef long long ll;
typedef long double ld;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;

char tochr(int n){return (char)('a' + n);}
int tonum(char c){return (int)(c) - 97;}

int main(){
	ll n;
	cin >> n; 
	deque<int> ans;
	while(n){
		n --;
		ll dig = n % 26;
		n /= 26;
		ans.push_front(dig);
	}
	for(int n: ans){
		cout << tochr(n % 26);
	}
}


Fixed submission:
from sys import stdin, stdout, setrecursionlimit
from collections import deque, defaultdict, Counter
import math

rl = lambda: stdin.readline()
rll = lambda: stdin.readline().split()
rli = lambda: map(int, stdin.readline().split())
rlf = lambda: map(float, stdin.readline().split())

INF, NINF = float('inf'), float('-inf')

tonum = lambda c: ord(c) - 97
tochr = lambda num: chr(num + 97)

def to26(n):
	ans = deque()
	while n:
		n -= 1
		n, dig = divmod(n, 26)
		ans.appendleft(dig)
	return ans

def main():
	n = int(rl())
	ans = [tochr(x) for x in to26(n)]
	print("".join(x for x in ans))
	stdout.close()

if __name__ == "__main__":
	main()