Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
p = list(map(int, input().split())).sort()

print(sum(p[:k]))

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

p = sorted(p)

print(sum(p[:k]))

Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
p = list(map(int, input().split()).sort()
print(sum(p[:k]))


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

p = sorted(p)

print(sum(p[:k]))

Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
p = sorted(list(map(int, input().split())))
print(sum[:k])

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

p = sorted(p)

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

for i in range(q):
  # 数値の変換
  for j in range(n):
    if a[j] == bc[i][0]:
      a[j] = bc[i][1]
  print(sum(a))

Fixed submission:
import collections

n  = int(input())
a  = list(map(int, input().split()))
q  = int(input())
bc = [list(map(int, input().split())) for i in range(q)]

# aの中の各要素のカウント
c = collections.Counter(a)

ans = sum(a)
for i in range(q):
  ans += (bc[i][1] - bc[i][0]) * c[bc[i][0]]
  c[bc[i][1]] += c[bc[i][0]]
  c[bc[i][0]]  = 0
  print(ans)
Buggy python submission (verdict: Runtime Error):
import sys

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

ans = 1
for i in range(n):
  ans = ans*As[i]
  	if ans > 10**18:
      print(-1)
      sys.exit()

print(ans)

Fixed submission:
import sys

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

Flag = True
ans = 1

if (0 in As):
  print(0)
  sys.exit()


for i in range(n):
  ans = ans * As[i]
  if (ans > 10**18):
    if (Flag):
      print(-1)
      Flag = False
      sys.exit()
  
if (Flag):
  print(ans)

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

ans = 1
for i in range(n):
  ans = ans * As[i]
  if (ans > 10**18):
    print(-1)
    sys.exit()
  
print(ans)

Fixed submission:
import sys

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

Flag = True
ans = 1

if (0 in As):
  print(0)
  sys.exit()


for i in range(n):
  ans = ans * As[i]
  if (ans > 10**18):
    if (Flag):
      print(-1)
      Flag = False
      sys.exit()
  
if (Flag):
  print(ans)

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

ans = 1
for i in range(n):
  ans = ans * As[i]
  
if (ans > 10**18):
  print(-1)
else:
  print(ans)

Fixed submission:
import sys

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

Flag = True
ans = 1

if (0 in As):
  print(0)
  sys.exit()


for i in range(n):
  ans = ans * As[i]
  if (ans > 10**18):
    if (Flag):
      print(-1)
      Flag = False
      sys.exit()
  
if (Flag):
  print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
x = int(input())

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

divisors = make_divisors(x)

for divisor in divisors:
  for a in range(100000):
    b = a - divisor
    if (a**5 - b**5 == x):
      print(a, b)
      break

Fixed submission:
x = int(input())

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

divisors = make_divisors(x)

for divisor in divisors:
  for a in range(1000):
    b = a - divisor
    if (a**5 - b**5 == x):
      print(a, b)
      break
Buggy python submission (verdict: Runtime Error):
k = int(input())
a, b = int(map(int, input().split()))

if (a%k == 0 or b%k == 0):
  print('Yes')
elif (a//k != b//k):
  print('Yes')
else:
  print('No')

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

ans = 'NG'
for i in range(a, b+1):
  if ((i)%k == 0):
    ans = 'OK'
    
if (k == 1):
  ans = 'OK'
    
print(ans)
Buggy python submission (verdict: Runtime Error):
n = input()

if ('7' in n):
  print('Yes')
else:
  pritn('No')

Fixed submission:
n = input()

if ('7' in n):
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
import numpy as np

k = int(input())

cnt = 0
for a in range(k):
  for b in range(k):
    for c in range(k):
      cnt += np.gcd.reduce([a+1, b+1, c+1])

print(cnt)

Fixed submission:
import math

k = int(input())

cnt = 0
for a in range(1, k+1):
  for b in range(1, k+1):
    for c in range(1, k+1):
      cnt += math.gcd(math.gcd(a, b), c)

print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
import collections

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

ans = {}
# 全てのキーに対して処理を実施
for k in c.keys():
  cnt = 0
  for l in c.keys():
    if (k == l):
      cnt += int((c[l]-1)*(c[l]-2)/2)
    else:
      cnt += int(c[l]*(c[l]-1)/2)
  ans[k] = cnt

for i in range(n):
  print(ans[a[i]])

Fixed submission:
import collections

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

ans = {}
comb = 0
# 全てのキーに対して処理を実施
for k in c.keys():
  comb += int(c[k]*(c[k]-1)/2)
for k in c.keys():
  ans[k] = comb-(c[k]-1)

for i in range(n):
  print(ans[a[i]])

Buggy python submission (verdict: Time Limit Exceeded):
import collections

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

for i in range(n):
  ans = 0
  # 全てのキーに対して処理を実施
  for k in c.keys():
    if (k == a[i]):
      ans += int((c[k]-1)*(c[k]-2)/2)
    else:
      ans += int(c[k]*(c[k]-1)/2)
  print(ans)

Fixed submission:
import collections

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

ans = {}
comb = 0
# 全てのキーに対して処理を実施
for k in c.keys():
  comb += int(c[k]*(c[k]-1)/2)
for k in c.keys():
  ans[k] = comb-(c[k]-1)

for i in range(n):
  print(ans[a[i]])
Buggy python submission (verdict: Runtime Error):
a, b, c = map(long, input().split())

if( 4*a*b < (c-a-b)**2 ) :
  print('Yes')
else:
  print('No')

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

if(c-a-b < 0):
  print('No')
elif( 4*a*b < (c-a-b)**2 ) :
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
n = int(input())
x = list(map(int, input().split()))

ans = []
for p in range(min(x), max(x)):
  sigma = 0
  for i in x:
    sigma += (p-i)**2
  ans.append(sigma)

print(min(ans))

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

if (len(set(x)) == 1):
  print(0)
else:
  ans = []
  for p in range(min(x), max(x)):
    sigma = 0
    for i in x:
      sigma += (p-i)**2
    ans.append(sigma)
  print(min(ans))
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = [input() for i in range(n)]

s_unique   = []
s_cnt      = [0]*n
unique_num = 0
for i in range(n):
  # 新しい文字列の場合は配列に加える
  if (not(s[i] in s_unique)):
  	s_unique.append(s[i])
  else:
    s_cnt[s_unique.index(s[i])] += 1

# 最大カウントの要素で再構成
cnt_max = max(s_cnt)
s_max = []
for i in range(n):
  if (s_cnt[i] == cnt_max):
    s_max.append(s_unique[i])

s_max = sorted(s_max)
for s in s_max:
  print(s)

Fixed submission:
a, b, c  = map(int, input().split())
abc = len(set([a, b, c]))

if ( abc == 2):
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
ps = list(map(int, input().split()))

pnmax = 0
for i in range(0, n-k+1):
  pn = 0
  for j in range(k):
  	pn = pn + ps[i+j]
  pnmax = max(pnmax, pn)

print((pnmax+k)/2)

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

ans = sum(p[:k])

psum = [0] * n
psum[0] = p[0]
for i in range(1, n):
  psum[i] = psum[i-1] + p[i]

anss = [0] * n
for i in range(n-k):
  anss[i] = psum[i+k] - psum[i]

print((max(ans, max(anss))+k)/2)

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

p = [ (p+1)/2 for p in ps]

pn_max = 0
for i in range(0, n-k+1):
  pn = 0
  for j in range(k):
  	pn += p[i+j]
  pn_max = max(pn_max, pn)

print(pn_max)

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

ans = sum(p[:k])

psum = [0] * n
psum[0] = p[0]
for i in range(1, n):
  psum[i] = psum[i-1] + p[i]

anss = [0] * n
for i in range(n-k):
  anss[i] = psum[i+k] - psum[i]

print((max(ans, max(anss))+k)/2)

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

p = [ (p+1)/2 for p in ps]

pn_max = 0
for i in range(0, n-2):
  pn = 0
  for j in range(k):
  	pn += ps[i+j]
  pn_max = max(pn_max, pn)

print((pn_max+k)/2)

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

ans = sum(p[:k])

psum = [0] * n
psum[0] = p[0]
for i in range(1, n):
  psum[i] = psum[i-1] + p[i]

anss = [0] * n
for i in range(n-k):
  anss[i] = psum[i+k] - psum[i]

print((max(ans, max(anss))+k)/2)
Buggy python submission (verdict: Runtime Error):
h, n = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(n)]

# 最強の魔法の特定
a_max = max(a for a, b in ab)
# 動的計画法用の配列の定義及び初期化
dp = [0]*(h + a_max)

for i in range(h + a_max):
	dp[i] = min(dp[i - a] + b for a, b in ab)

print(min(dp[h:]))

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

q   = h // a
mod = h % a

if(mod == 0):
  ans = q
else:
  ans = q + 1

print(ans)
Buggy python submission (verdict: Runtime Error):
h, n = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(n)]

# 最強の魔法の特定
a_max = max(a for a, b in ab)
# 動的計画法用の配列の定義及び初期化
dp = [0]*(h + a_max)

for i in range(h + a_max):
  if i > 0:
	dp[i] = min(dp[i - a] + b for a, b in ab)

print(min(dp[h:]))

Fixed submission:
n,m=map(int, input().split())
s=[list(map(int, input().split())) for i in range(m)]
x=max(a for a,b in s)
dp=[0]*(n+x)
for i in range(0,n+x):
  if i>0:
    dp[i]=min(dp[i-a]+b for a,b in s)
print(min(dp[n:]))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ls = list(map(int, input().split()))

ans = 0
for i in range(n):
  if(ls[i] == min(ls[:i+1])):
    ans += 1

print(ans)

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

# 初期化
cnt = 1
min = p[0]
# カウント処理
for i in range(1, n):
  if(p[i] <= min):
    cnt += 1
    min = p[i]

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

points    = [0] * n
penalties = [0] * n

for i in range(m):
  q, ans = input().split()
  # まだ正解が出ていない場合
  if(int(q) == 0):
    continue:
  if(points[int(q) - 1] == 0):
    # 正解の場合
    if(ans == 'AC'):
      points[int(q) - 1] = 1
    # 不正解の場合
    else:
      penalties[int(q) - 1] += 1

print(sum(points), sum(penalties))

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

points    = [0] * n
penalty   = [0] * n
penalties = 0

for i in range(m):
  q, ans = input().split()
  q = int(q) - 1
  # まだ正解が出ていない場合
  if(points[q] == 0):
    # 正解の場合
    if(ans == 'AC'):
      points[q] = 1
      penalties += penalty[q]
    # 不正解の場合
    else:
      penalty[q] += 1

print('{} {}'.format(sum(points), penalties))

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

points    = 0
penalties = 0

# 答えのリストの作成
input_lists = []
question_numbers = []
for i in range(m):
  qn, ans = input().split()
  input_list = [int(qn), ans]
  question_numbers.append(int(qn))
  input_lists.append(input_list)

# 問題番号の重複排除
question_numbers = list(set(question_numbers))

# カウント
for qn in question_numbers:
  # print(qn)
  # 問題番号毎に処理
  answers = []
  for input_list in input_lists:
    if(qn == input_list[0]):
      answers.append(input_list[1])
  # print(answers)
  # 配列にACが含まれていればpointsをインクリメント
  if('AC' in answers):
    points = points + 1
  	# ペナルティのカウント
    for answer in answers:
      if(answer == 'WA'):
        penalties = penalties + 1
      else:
        break

print(points, penalties)

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

points    = [0] * n
penalty   = [0] * n
penalties = 0

for i in range(m):
  q, ans = input().split()
  q = int(q) - 1
  # まだ正解が出ていない場合
  if(points[q] == 0):
    # 正解の場合
    if(ans == 'AC'):
      points[q] = 1
      penalties += penalty[q]
    # 不正解の場合
    else:
      penalty[q] += 1

print('{} {}'.format(sum(points), penalties))

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

points    = 0
penalties = 0

# 答えのリストの作成
input_lists = []
question_numbers = []
for i in range(m):
  qn, ans = input().split()
  input_list = [int(qn), ans]
  question_numbers.append(int(qn))
  input_lists.append(input_list)

# 問題番号の重複排除
question_numbers = list(set(question_numbers))

# カウント
for qn in question_numbers:
  # print(qn)
  # 問題番号毎に処理
  answers = []
  for input_list in input_lists:
    if(qn == input_list[0]):
      answers.append(input_list[1])
  # print(answers)
  # 配列にACが含まれていればpointsをインクリメント
  if('AC' in answers):
    points = points + 1
  	# ペナルティのカウント
    for answer in answers:
      if(answer == 'WA'):
        penalties = penalties + 1
      else:
        break

print(points, penalties)

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

points    = [0] * n
penalty   = [0] * n
penalties = 0

for i in range(m):
  q, ans = input().split()
  q = int(q) - 1
  # まだ正解が出ていない場合
  if(points[q] == 0):
    # 正解の場合
    if(ans == 'AC'):
      points[q] = 1
      penalties += penalty[q]
    # 不正解の場合
    else:
      penalty[q] += 1

print('{} {}'.format(sum(points), penalties))
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    [N, M] = [int(num) for num in input().split()]
    A = [int(num) for num in input().split()]

    for i in range(M):
        expensive = max(A)
        A[A.index(expensive)] = expensive / 2

    A = [a//1 for a in A]
    print(int(sum(A)))

if __name__ == '__main__':
    main()


Fixed submission:
import heapq

def main():
    [N, M] = [int(num) for num in input().split()]
    A = [int(num) for num in input().split()]
    hp = []

    for a in A:
        heapq.heappush(hp, - a)

    for i in range(M):
        expensive = heapq.heappop(hp)
        heapq.heappush(hp, expensive / 2)

    hp = [int(- a // 1) for a in hp]
    print(sum(hp))


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    N = int(input())
    S = input()
    ans = 0
    index = 0

    for i in range(N):
        s2 = S[i+1:N]
        for j in range(i+1-index):
            s1 = S[index+j:i+1]
            if len(s1) < ans:
                break
            if s1 in s2:
                index = index+j
                ans = len(s1)
                break
        if len(s2) <= ans:
            break

    print(ans)

if __name__ == '__main__':
    main()


Fixed submission:
def main():
    N = int(input())
    S = input()
    ans = 0
    index = 0

    for i in range(N):
        s1 = S[index:i+1]
        s2 = S[i+1:]
        if s1 in s2:
            ans = len(s1)
        else:
            index += 1

    print(ans)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
def main():
    N = int(input())
    print(int((N*(N-1))//2))

if __name__ == '__main__':
    main()


Fixed submission:
def main():
    S = input()
    T = input()
    ans = 0
    for i in range(3):
        if S[i] == T[i]:
            ans += 1
    print(ans)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
def get_max(n):
    if n==1:
        return 0
    if n % 2 == 0:
        return (n/2+(n-1))*n/2/2-1 + get_max((n-1)/2)
    else:
        return ((n-1)/2+(n-1))*(n+1)/2/2 + get_max((n-1)/2)

def main():
    N = int(input())
    print(int(get_max(N)))


if __name__ == '__main__':
    main()


Fixed submission:
def main():
    N = int(input())
    print(int((N*(N-1))//2))

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
def get_max(n):
    if n==1:
        return 0:
    if n % 2 == 0:
        return n*(n-1)/2
    else:
        return ((n+1)/2+n)*(n+1)/2/2 + get_max((n-1)/2)

def main():
    N = int(input())
    print(int(get_max(N)))


if __name__ == '__main__':
    main()


Fixed submission:
def main():
    N = int(input())
    print(int((N*(N-1))//2))

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
def main():
    N = input()
    ans = 0
    for i in range(N):
        ans += i
    print(ans)

if __name__ == '__main__':
    main()


Fixed submission:
def main():
    N = int(input())
    print(int((N*(N-1))//2))

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
def alphas(key):
    value = {}
    for char in key:
        if value.get(char) is None:
            value[char] = 1
        else:
            value[char] += 1
    return value

def main():
    N = int(input())
    anagrams = []
    for i in range(N):
        s = input()
        anagrams.append(s)
    ans = 0
    json = {}
    for key in anagrams:
        value = alphas(key)
        for json_key in json.keys():
            if json[json_key] == value:
                ans += 1
        json[key] = value

    print(ans)

if __name__ == '__main__':
    main()


Fixed submission:
def alphas(key):
    value = {}
    for char in key:
        if value.get(char) is None:
            value[char] = 1
        else:
            value[char] += 1
    return value

def main():
    N = int(input())
    anagrams = []
    for i in range(N):
        s = input()
        anagrams.append(s)
    ans = 0
    dict = {}
    for key in anagrams:
        value = alphas(key)
        dict_key = str(sorted(value.items()))
        if dict.get(dict_key) is None:
            dict[dict_key] = 1
        else:
            dict[dict_key] += 1
        """
        for json_key in json.keys():
            if json[json_key] == value:
                ans += 1
                continue
        json[key] = value
        """
    for value in dict.values():
        ans += value * (value - 1) / 2
    print(int(ans))

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
def main():
    s = input()
    [a, b, c] = [int(number) for number in s.split()]

    if b + c <= a:
        print(0)
    else:
        print(b + c - a)

if __name__ == '__main__':20
    """
    main()

Fixed submission:
def main():
    s = input()
    [a, b, c] = [int(number) for number in s.split()]

    if b + c <= a:
        print(0)
    else:
        print(b + c - a)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python
"""M-SOLUTIONS プロコンオープン 2020: C - Marks
https://atcoder.jp/contests/m-solutions2020/tasks/m_solutions2020_c
"""


def main():
    N, K = list(map(int, input().split()))
    As = list(map(int, input().split()))

    # N, K = [3, 2]
    # As = [1001, 869120, 1001]

    # N, K = [15, 7]
    # As = [3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5, 8, 9, 7, 9]
    prev_score = 0
    for i in range(N-(K-1)):
        # print('i:{}({})'.format(i, i+K))
        score = 1
        e = i + (K-1)
        s = i + ((K-1)-(K-1))
        # print('  {} => {}'.format(s, e+1))
        for j in range(s, e+1):
            score *= As[j]
        # print('score:{}'.format(score))
        # print('prev_score:{}'.format(prev_score))
        if prev_score == 0:
            prev_score = score
        else:
            # print('{} => {}'.format(prev_score, score))
            if prev_score < score:
                print('Yes')
            else:
                print('No')
            prev_score = score


if __name__ == '__main__':
    main()


Fixed submission:
#!/usr/bin/env python
"""M-SOLUTIONS プロコンオープン 2020: C - Marks
https://atcoder.jp/contests/m-solutions2020/tasks/m_solutions2020_c
"""


def main():
    N, K = list(map(int, input().split()))
    As = list(map(int, input().split()))

    # N, K = [5, 3]
    # As = [96, 98, 95, 100, 20]

    # N, K = [3, 2]
    # As = [1001, 869120, 1001]

    # N, K = [15, 7]
    # As = [3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5, 8, 9, 7, 9]
    for i in range(0, N-K):
        # print('i:{}({})'.format(i, i+K))
        prev_score = As[i]
        score = As[K + i]
        # print('{} => {}'.format(prev_score, score))
        if prev_score < score:
            print('Yes')
        else:
            print('No')


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python
"""AtCoder nomura 2020: B - Postdocs - 
https://atcoder.jp/contests/nomura2020/tasks/nomura2020_b
"""

__author__ = 'bugttle <bugttle@gmail.com>'

def calc(t):
    d = list(t).count('D')
    pd = list(t.replace('PD', '?')).count('?')
    return d + pd

def main():
    T = input()

    max_t = ''
    max_count = 0
    n = list(T).count('?')
    for i in range(2 ** n):
        t = T
        for j in range(n):
            if ((i >> j) & 1):
                t = t.replace('?', 'D', 1)
            else:
                t = t.replace('?', 'P', 1)
        point = calc(t)
        if max_count < point:
            max_count = point
            max_t = t

    print(max_t)

if __name__ == '__main__':
    main()


Fixed submission:
#!/usr/bin/env python
"""AtCoder nomura 2020: B - Postdocs - 
https://atcoder.jp/contests/nomura2020/tasks/nomura2020_b
"""

__author__ = 'bugttle <bugttle@gmail.com>'

def main():
    T = input()

    # S = T.replace('??', 'DD').replace('?D', 'DD').replace('D?', 'DD').replace('P?', 'PD').replace('?P', 'DP')
    S = T.replace('?', 'D')
    print(S)


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python
"""AtCoder Beginner Contest 167: C
https://atcoder.jp/contests/abc167/tasks/abc167_c
"""
import sys
import itertools

__author__ = 'bugttle <bugttle@gmail.com>'


def main():
    [N, M, X] = list(map(int, input().split()))

    l = []
    for n in range(N):
        l.append(list(map(int, input().split())))
    # print(l)

    status = [0]*M
    for n in range(N):
        for m in range(M):
            status[m] += l[n][m + 1]
    for v in status:
        if v < X:
            print(-1)
            return
    
    min_cost = sys.maxsize
    for p in itertools.permutations(range(N)):
        # print(p)
        cost = 0
        status = [0]*M
        for n in p:
            cost += l[n][0]
            if min_cost < cost:
                break
            isCompleted = True
            for m in range(M):
                status[m] += l[n][m + 1]
                if status[m] < X:
                    isCompleted = False
            # print(status)
            if isCompleted:
                # print('fin')
                # print(cost)
                if cost < min_cost:
                    min_cost = cost
                break
    if min_cost == sys.maxsize:
        print(-1)
    else:
        print(min_cost)
            
                    

                # status[m] += l[n][m]
    # for n in range(N):
    #     for m in range(M):
    #         print([n, m])
    # cost = 0
    # status = [[0]*M]*N
    # for n in range(N):
    #     for m in range(M):
    #         print(l[n][m + 1])
    #         # status[n][m] = l[n][m + 1]
    # print(status)

    


if __name__ == '__main__':
    main()


Fixed submission:
#!/usr/bin/env python
"""AtCoder Beginner Contest 167: A - 
https://atcoder.jp/contests/abc167/tasks/abc167_a
"""

__author__ = 'bugttle <bugttle@gmail.com>'


def main():
    S = input()
    T = input()

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


if __name__ == '__main__':
    main()