Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
s = list(input())
Pflag = False
Dflag = False
if s[0] == "?":
  if s[1] == "D":
    s[0] = "P"
  if s[1] == "P":
    s[0] = "D"
  if s[1] == "?":
    s[0] = "P"
    s[1] = "D"
if s[-1] == "?":
  s[-1] = "D"
for index, i in enumerate(s):
  if i == "?":
    if s[index+1] == "?":
      s[index] = "P"
    if s[index-1] == "P":
      s[index] = "D"
    if s[index+1] == "D":
      s[index] = "P"
ans = "".join(s)
print(ans)

Fixed submission:
s = list(input())
for index, i in enumerate(s):
  if i == "?":
    s[index] = "D"
ans = "".join(s)
print(ans)

Buggy python submission (verdict: Runtime Error):
s = list(input())
Pflag = False
Dflag = False
if s[0] == "?":
  if s[1] == "D":
    s[0] = "P"
  if s[1] == "P":
    s[0] = "D"
  if s[1] == "?":
    s[0] = "P"
    s[1] = "D"
if s[-1] == "?":
  s[-1] = "D"
for index, i in enumerate(s):
  if i == "?":
    if s[index-1] == "P":
      s[index] = "D"
    if s[index+1] == "D":
      s[index] = "P"
    if s[index+1] == "?":
      s[index] = "P"
      s[index+1] = "D"
ans = "".join(s)
print(ans)

Fixed submission:
s = list(input())
for index, i in enumerate(s):
  if i == "?":
    s[index] = "D"
ans = "".join(s)
print(ans)

Buggy python submission (verdict: Runtime Error):
s = list(input())
Pflag = False
Dflag = False
if s[0] == "?":
  if s[1] == "D":
      s[0] = "P"
  if s[1] == "P":
      s[0] = "D"
  if s[1] == "?":
      s[0] = "P"
      s[1] = "D"
for index, i in enumerate(s):
  if i == "?":
    if s[index-1] == "P":
      s[index] = "D"
    if s[index+1] == "D":
      s[index] = "P"
    if s[index+1] == "?":
      s[index] = "P"
      s[index+1] = "D"
ans = "".join(s)
print(ans)

    

    

Fixed submission:
s = list(input())
for index, i in enumerate(s):
  if i == "?":
    s[index] = "D"
ans = "".join(s)
print(ans)
Buggy python submission (verdict: Runtime Error):
S = int(input())
T = int(input())

t = word.rstrip(T)

if S == T:
  print("Yes")
else:
  print("No")

Fixed submission:
S = input()
T = input()
 
t = T[:-1]
 
if S == t:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
X = int(input())

for i in range(X):
  if X == int(100 * (1.01 ** i)):
    print(i)
    break

Fixed submission:
X = int(input())
A = 100
c = 0
while(A < X):
  A = int(A * 1.01)
  c = c + 1
  
print(c)

Buggy python submission (verdict: Runtime Error):
import math
X = int(input())
c = 0

for i in range(10**18):
  n = 1.01**i
  if X == math.floor(n*100):
    print(i)
    break

Fixed submission:
X = int(input())
A = 100
c = 0
while(A < X):
  A = int(A * 1.01)
  c = c + 1
  
print(c)

Buggy python submission (verdict: Runtime Error):
import math
X = int(input())
A = 100
c = 0

for i in range(X):
  A = A * 1.01
  if math.floor(A) == X:
    c = c+1
    break
    
  c = c+1

print(c)

Fixed submission:
X = int(input())
A = 100
c = 0
while(A < X):
  A = int(A * 1.01)
  c = c + 1
  
print(c)
Buggy python submission (verdict: Runtime Error):
r = int(input())
a = 2 * pi * r
print(a)

Fixed submission:
r = int(input())
a = 2 * 3.1415 * r
print(a)
Buggy python submission (verdict: Runtime Error):
from collections import Counter
n = int(input())
a = list(map(int,input().split()))

ac = Counter(a)
ad = list(ac.values())
ad.sort()
for i in range(n-1):
  print(ad[i])


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

lis = [0] * n
for i in A:
  lis[i-1] += 1

for j in range(len(lis)):
  print(lis[j])

Buggy python submission (verdict: Runtime Error):
from collections import Counter
n = int(input())
a = list(map(int,input().split()))

ac = Counter(a)
ad = list(ac.values())
ad.sort()
for i in range(n):
  print(ad[i])


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

lis = [0] * n
for i in A:
  lis[i-1] += 1

for j in range(len(lis)):
  print(lis[j])

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))

for i in range(n):
    b = a.count(i+1)
    print(b)
    del a[:b]
    


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

lis = [0] * n
for i in A:
  lis[i-1] += 1

for j in range(len(lis)):
  print(lis[j])

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))

for i in range(n):
    b = a.count(i+1)
    print(b)
    


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

lis = [0] * n
for i in A:
  lis[i-1] += 1

for j in range(len(lis)):
  print(lis[j])

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

for i in range(n):
    print(i.count(a))
    


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

lis = [0] * n
for i in A:
  lis[i-1] += 1

for j in range(len(lis)):
  print(lis[j])

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

for i in range(n):
    print(a.count(a)\n)
    


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

lis = [0] * n
for i in A:
  lis[i-1] += 1

for j in range(len(lis)):
  print(lis[j])

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

for i in range(n):
  for range(len(a)):
    if i in a:
      count++
    print(count\n)
    


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

lis = [0] * n
for i in A:
  lis[i-1] += 1

for j in range(len(lis)):
  print(lis[j])
Buggy python submission (verdict: Runtime Error):
n = input()
print(n ** 2)

Fixed submission:
n = int(input())
a = pow(n,3)
print(a)

Buggy python submission (verdict: Runtime Error):
n = int(input())
pow(n,3)
print(n

Fixed submission:
n = int(input())
a = pow(n,3)
print(a)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

def divisor(n): 
    i = 1
    num = 0
    while i * i <= n:
        if n%i == 0:
            num+=2
            if i==n//i:
                num-=1
        i += 1
    return num

ans=0
for c in range(1, n):
    ab = n-c
    ans+=divisor(ab)

print(ans)

Fixed submission:
n = int(input())
ans=0
for a in range(1, n):
    b=(n-1)//a
    ans+=b
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
ii = lambda : int(input())

n = ii()

ans = n+1
for i in range(1, n+1):
    if n%i==0 and i+n//i < ans:
        ans = i+n//i


print(ans-2)

Fixed submission:
ii = lambda : int(input())
mi = lambda : map(int, input().split())
li = lambda : list(map(int, input().split()))

import numpy as np
import math

n = ii()

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

ans = n+1
for i in range(1, sq+1):
    if n%i==0 and i+n//i < ans:
        ans = i+n//i


print(ans-2)
Buggy python submission (verdict: Time Limit Exceeded):
ii = lambda : int(input())
mi = lambda : map(int, input().split())
li = lambda : list(map(int, input().split()))

import numpy as np
n,k,q = mi()
a=np.array([int(input()) for i in range(q)])

point = np.array([k for i in range(n)])

for i in range(q):
    point -= 1
    b = a[i]-1
    point[b] += 1

for i in range(n):
    if point[i]>0:
        print("Yes")
    else:
        print("No")

Fixed submission:
ii = lambda : int(input())
mi = lambda : map(int, input().split())
li = lambda : list(map(int, input().split()))

import numpy as np
n,k,q = mi()
a=[int(input()) for i in range(q)]

point = np.array([k-q for i in range(n)])

for i in a:
    point[i-1] += 1

ans = np.where(point>0, 'Yes', 'No')

print('\n'.join(ans))
Buggy python submission (verdict: Runtime Error):
n = ii()
m = int(((n-1)*n)/2)
print(m)

Fixed submission:
n = int(input())
m = int(((n-1)*n)//2)
print(m)

Buggy python submission (verdict: Runtime Error):
n = ii()

print(int(((n+1)*n)/2-n))

Fixed submission:
n = int(input())
m = int(((n-1)*n)//2)
print(m)

Buggy python submission (verdict: Runtime Error):
n = ii()

print((n+1)*n/2-n)

Fixed submission:
n = int(input())
m = int(((n-1)*n)//2)
print(m)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

m=0
for i in range(n):
    m += i
print(m)


Fixed submission:
n = int(input())
m = int(((n-1)*n)//2)
print(m)
Buggy python submission (verdict: Time Limit Exceeded):
mi = lambda : map(int, input().split())

l, r = mi()

ans = 2018
for i in range(l, r+1):
    for j in range(l, r+1):
        if i<j and ans>(i*j)%2019:
            ans = (i*j)%2019
print(ans)

Fixed submission:
mi = lambda : map(int, input().split())

l, r = mi()

if r-l>2019:
    r = l+2019

ans = 2018
for i in range(l, r+1):
    for j in range(l, r+1):
        if i<j and ans>(i*j)%2019:
            ans = (i*j)%2019
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
def f(N):
  i=2
  ans=dict()
  div_sum=1
  n=N
  while i*i <=N:
    while n%i==0:
      n=n//i
      if i in ans:
        ans[i]+=1
      else:
        ans[i]=1
    i+=1
  if n!=1:
    ans[n]=1
  ans_list=list(ans.items())
  for j in ans_list:
    div_sum*=j[1]+1
  return div_sum


N = int(input())
 
ans = 0
for C in range(1,N):
  ans += f(N-C)
  C += 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):
import math
def num_divisors_trial_division(n):
    num = 0
    for i in range(1, int(math.sqrt(n) + 1e-9) + 1):
        if n % i == 0:
            num += 1
            if n != i**2:
                num += 1
    
    return num


N = int(input())

ans = 0
for C in range(1,N):
  ans += num_divisors_trial_division(N-C)
  C += 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())

#約数を列挙する関数
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]


#print(len(make_divisors(8)))

ans = 0
for C in range(1,N):
  ans += len(make_divisors(N-C))
  C += 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())
l = len(str(n))

s = 0
while n != 0:
  r = n % 10
  s = (s + r) % 9
  n = n // 10

if s % 9 == 0:
  print('Yes')
else:
  print('No')

Fixed submission:
n = list(map(int,input()))

s = sum(n)

if s % 9 == 0:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Time Limit Exceeded):
def digits_of (n): # nの桁の数字のリストを出力する関数｡ nは自然数
    digits = [] # nの桁の数字を入れるリスト
    while n != 0:
        r = n % 10 # 10で割った余り
        digits.append(r) # リストに加える
        n = n // 10 # nを10で割った整数に置き換える
    return digits

def is_multiple_of_9 (n): # nは自然数
    sum = 0 # 各桁の数字の合計をもとめる
    for i in digits_of (n):
        sum += i
    return sum % 9 == 0 # もし合計が9の倍数ならTrue, そうでないならFalse
  
n = int(input())

print('Yes' if is_multiple_of_9 (n) == True else 'No')

Fixed submission:
n = list(map(int,input()))

s = sum(n)

if s % 9 == 0:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Time Limit Exceeded):
def digits_of (n): # nの桁の数字のリストを出力する関数｡ nは自然数
    digits = [] # nの桁の数字を入れるリスト
    while n != 0:
        r = n % 10 # 10で割った余り
        digits.append(r) # リストに加える
        n = n // 10 # nを10で割った整数に置き換える
    return digits

def is_multiple_of_9 (n): # nは自然数
    sum = 0 # 各桁の数字の合計をもとめる
    for i in digits_of (n):
        sum += i
    return sum % 9 == 0 # もし合計が9の倍数ならTrue, そうでないならFalse
  
n = int(input())

print('Yes' if is_multiple_of_9 (n) == True else 'No')

Fixed submission:
n = list(map(int,input()))

s = sum(n)

if s % 9 == 0:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Time Limit Exceeded):
X,K,D = map(int,input().split())

c = X

for i in range(K):
  if c >= 0:
    if abs(c-D) <= abs(c):
      c = c - D
    else:
      c = c + D
  if c < 0:
    if abs(c+D) <= abs(c):
      c = c + D
    else:
      c = c - D
  i += 1


print(abs(c))

Fixed submission:
X,K,D = map(int,input().split())

# 絶対値を取れば正の座標だけ考えれば済む
X = abs(X)

# D>Xなら移動1回だけで原点飛び越える
if D > X:
  #偶数の場合はそのままで奇数の場合はD-X
  if K % 2 == 0:
    print(X)
  else:
    print(abs(D-X))
    
# K回移動してもまだ正のときは最後の座標
else:
  if X//D >= K:
    print(X - K*D)
# その後の移動の検討
  else:
    tmp = X - (X//D)*D
    if (K - X//D) % 2 == 0:
      print(tmp)
    else:
      print(min(abs(tmp-D),tmp+D))
Buggy python submission (verdict: Time Limit Exceeded):
a,b,c = map(int, input().split())
k = int(input())
 
i = 0
while i < k:
  if a < b < c:
    break
  elif a >= b:
    b = b * 2
    i += 1
    if c >= b:
      c = c * 2
      i += 1
 
if a < b < c:
  print('Yes')
else:
  print('No')

Fixed submission:
a,b,c = map(int, input().split())
k = int(input())
 
i = 0
while a >= b:
  b = b * 2
  i += 1

j = 0
while b >= c:
  c = c * 2
  j += 1
  
if i + j <= k:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Time Limit Exceeded):
a,b,c = map(int, input().split())
k = int(input())

i = 0
while i < k:
  if a >= b:
    b = b * 2
    i += 1
  if c >= b:
    c = c * 2
    i += 1

if a < b < c:
  print('Yes')
else:
  print('No')

Fixed submission:
a,b,c = map(int, input().split())
k = int(input())
 
i = 0
while a >= b:
  b = b * 2
  i += 1

j = 0
while b >= c:
  c = c * 2
  j += 1
  
if i + j <= k:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())
a = list(map(int,input().split()))

for i in range(k,n+1):
  if a[i] > a[i-k]:
    print('Yes')
  else:
    print('No')

Fixed submission:
n,k = map(int,input().split())
a = list(map(int,input().split()))

for i in range(k,n):
  if a[i] > a[i-k]:
    print('Yes')
  else:
    print('No')

Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
a = list(map(int,input().split()))

rl = []

for i in range(k-1,n):
  r = 1
  for j in range(k):
    r *= a[i-j]
    j += 1
  rl.append(r)
  i += 1

for m in range(n-k):
  if rl[m+1] > rl[m]:
    print('Yes')
  else:
    print('No')

Fixed submission:
n,k = map(int,input().split())
a = list(map(int,input().split()))

for i in range(k,n):
  if a[i] > a[i-k]:
    print('Yes')
  else:
    print('No')

Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
a = list(map(int,input().split()))

rl = []

for i in range(k-1,n):
  r = 1
  for j in range(k):
    r = r * a[i-j]
    j += 1
  rl.append(r)
  i += 1

for m in range(n-k):
  if rl[m+1] > rl[m]:
    print('Yes')
  else:
    print('No')

Fixed submission:
n,k = map(int,input().split())
a = list(map(int,input().split()))

for i in range(k,n):
  if a[i] > a[i-k]:
    print('Yes')
  else:
    print('No')

Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
a = list(map(int,input().split()))

rl = []

for i in range(k-1,n):
  j = 0
  r = 1
  for j in range(k):
    r = r * a[i-j]
    j += 1
  rl.append(r)
  i += 1

for m in range(n-k):
  if rl[m+1] > rl[m]:
    print('Yes')
  else:
    print('No')

Fixed submission:
n,k = map(int,input().split())
a = list(map(int,input().split()))

for i in range(k,n):
  if a[i] > a[i-k]:
    print('Yes')
  else:
    print('No')

Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
a = list(map(int,input().split()))

rl = []

for i in range(k-1,n):
  j = 0
  r = 1
  while j < k:
    r = r * a[i-j]
    j += 1
  rl.append(r)
  i += 1



for m in range(n-k):
  if rl[m+1] > rl[m]:
    print('Yes')
  else:
    print('No')

Fixed submission:
n,k = map(int,input().split())
a = list(map(int,input().split()))

for i in range(k,n):
  if a[i] > a[i-k]:
    print('Yes')
  else:
    print('No')
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input()))

money = 1000
stock = 0

for i in range(n-1):
  if a[i+1] > a[i]:
    stock = money // a[i]
    money = money - stock*a[i] + stock*a[i+1]

print(money)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
 
money = 1000
stock = 0
 
for i in range(n-1):
  if a[i+1] > a[i]:
    stock = money // a[i]
    money = money - stock*a[i] + stock*a[i+1]
 
print(money)
Buggy python submission (verdict: Runtime Error):
a,b,c,d,e = map(int, input().split())
r = o
if a = 0:
  r = a
  else if b = 0:
    r = b
  else if c = 0:
    r = c
  else if d = 0:
    r = d
  else if e = 0:
    r = e
print(r)

Fixed submission:
num_list = list(map(int, input().split()))


if num_list[0] == 0:
  print(1)
elif num_list[1] == 0:
  print(2)
elif num_list[2] == 0:
  print(3)
elif num_list[3] == 0:
  print(4)
elif num_list[4] == 0:
  print(5)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))

ans = 1

if 0 in A:
  ans = 0
else:
  for i in range(N):
    ans *= A[i]
    i += 1
    if ans > 10**18:
      ans = -1
      break

print(ans)


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

Buggy python submission (verdict: Runtime Error):
a,b = int(input())
r = a * b
print(r)

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

Buggy python submission (verdict: Runtime Error):
print(A*B)

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

Buggy python submission (verdict: Runtime Error):
r = int(input())
r = A * B
print(r)

Fixed submission:
a,b = map(int, input().split())
r = a * b
print(r)
Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)
  

K = int(input())
ans = 0

for a in range(1,K+1):
  for b in range(1,K+1):
    for c in range(1,K+1):
      ans += gcd(a,b,c)
      

print(ans)

Fixed submission:
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)
  

K = int(input())
ans = 0

for a in range(1,K+1):
  for b in range(1,K+1):
    for c in range(1,K+1):
      ans += gcd(a,b,c)
      

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

def p(m, n):
    k = 1
    for i in range(n):
        k = (k * m) % (10**9 + 7)
    return k

x = p(10, n) - 2*p(9, n) + p(8, n)
while x < 0:
    x += 10 ** 9 + 7
elif x == 10 ** 9 + 7:
    x = 0
print(x)

Fixed submission:
n = int(input())

def p(m, n):
    k = 1
    for i in range(n):
        k = (k * m) % (10**9 + 7)
    return k

x = p(10, n) - 2*p(9, n) + p(8, n)
while x < 0:
    x += 10 ** 9 + 7
if x == 10 ** 9 + 7:
    x = 0
print(x)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

s = 0
for i in range(n - 1):
    for j in range(i + 1, n):
        s += a[i] * a[j]
        s %= 10 ** 9 + 7

print(s)

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

s = 0
for i in range(n):
    s += a[i]

tr = 0
for i in range(n):
    tr += a[i] ** 2

a2 = s ** 2 - tr
a = a2 // 2
a %= 10 ** 9 + 7

print(a)
Buggy python submission (verdict: Runtime Error):
n = int(input())
ln = list(str(n))
from collections import Counter
nc = dict(Counter(ln))
s = 0
if n != 0:
    for i in range(1, 10):
        s += i * nc[str(i)]
if s % 9 == 0:
    print('Yes')
else:
    print('No')

Fixed submission:
n = int(input())
ln = list(str(n))
from collections import Counter
nc = dict(Counter(ln))
s = 0
if n != 0:
    for i in range(1, 10):
        if str(i) in nc:
            s += i * nc[str(i)]
if s % 9 == 0:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
n = int(input())
ln = list(str(n))
from collections import Counter
nc = dict(Counter(ln))
s = 0
for i in range(1, 10):
    s += i * nc[str(i)]
if s % 9 == 0:
    print('Yes')
else:
    print('No')

Fixed submission:
n = int(input())
ln = list(str(n))
from collections import Counter
nc = dict(Counter(ln))
s = 0
if n != 0:
    for i in range(1, 10):
        if str(i) in nc:
            s += i * nc[str(i)]
if s % 9 == 0:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = 0
for i in range(len(str(n))):
    r = n % 10
    s += r
    s %= 9
    n //= 10
if s % 9 == 0:
    print('Yes')
else:
    print('No')

Fixed submission:
n = int(input())
ln = list(str(n))
from collections import Counter
nc = dict(Counter(ln))
s = 0
if n != 0:
    for i in range(1, 10):
        if str(i) in nc:
            s += i * nc[str(i)]
if s % 9 == 0:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = 0
while n > 0:
    r = n % 10
    s += r
    s %= 9
    n //= 10
if s % 9 == 0:
    print('Yes')
else:
    print('No')

Fixed submission:
n = int(input())
ln = list(str(n))
from collections import Counter
nc = dict(Counter(ln))
s = 0
if n != 0:
    for i in range(1, 10):
        if str(i) in nc:
            s += i * nc[str(i)]
if s % 9 == 0:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = 0
while n > 0:
    r = n % 10
    s += r
    n //= 10
if s % 9 == 0:
    print('Yes')
else:
    print('No')

Fixed submission:
n = int(input())
ln = list(str(n))
from collections import Counter
nc = dict(Counter(ln))
s = 0
if n != 0:
    for i in range(1, 10):
        if str(i) in nc:
            s += i * nc[str(i)]
if s % 9 == 0:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = 0
while n > 0:
    r = n % 10
    s += r
    n //= 10
if s % 9 == 0:
    print('Yes')
else:
    print('No')

Fixed submission:
n = int(input())
ln = list(str(n))
from collections import Counter
nc = dict(Counter(ln))
s = 0
if n != 0:
    for i in range(1, 10):
        if str(i) in nc:
            s += i * nc[str(i)]
if s % 9 == 0:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
s = 1
for i in range(N):
    s *= A[i]
    i += 1
if s > 10**18:
    print(-1)
else:
    print(s)

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()))
s = 1
for i in range(N):
    s = s * A[i]
    i += 1
if s > 10**18:
    print(-1)
else:
    print(s)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
s = 1
for i in range(N):
    if A[i] == 0:
        s = 0
        i += 1
if s == 0:
    print(0)
else:
    for i in range(N):
        s = s * A[i]
        if s > 10**18:
            break
        i += 1
    if s > 10**18:
        print(-1)
    else:
        print(s)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
s = 1
for i in range(N):
    s *= A[i]
    i += 1
if s > 10**18:
    print(-1)
else:
    print(s)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
s = 1
for i in range(N):
    if A[i] == 0:
        s = 0
        i += 1
if s == 0:
    print(0)
else:
    for i in range(N):
        s = s * A[i]
        if s > 10**18:
            break
        i += 1
    if s > 10**18:
        print(-1)
    else:
        print(s)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
s = 1
for i in range(N):
    s *= A[i]
    i += 1
if s > 10**18:
    print(-1)
else:
    print(s)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
s = 1
for i in range(N):
    if A[i] == 0:
        s = 0
        i += 1
if s == 0:
    print(0)
else:
    for i in range(N):
        s = s * A[i]
        if s > 10**18:
            break
        i += 1
    if s > 10**18:
        print(-1)
    else:
        print(s)
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
a = list(map(int, input().split()))

route ={1}
cur = 1
for i in range(k):
    goto = a[cur - 1]
    x = len(route)
    route.add(goto)
    y = len(route)
    if x == y:
        route = list(route)
        pre_goto = route.index(goto)
        dif = len(route) - pre_goto
        rest_step = (k - pre_goto) % dif
        print(route[pre_goto + rest_step])
        break
    cur = goto
else:
    print(route[k])


Fixed submission:
S = input()
T = input()

if (len(S) == len(T) - 1) & (S == T[:-1]):
    print('Yes')
else:
    print('No')