Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
s = list(input())
s = [int(i+j) for (i,j) in zip(s[::2],s[1::2])]

zero = int('{0:02d}'.format(0))

if zero <= s[0] <= 12:
  if zero <= s[1] <= 12:
    print("AMIGUOUS")
  else:
    print("MMYY")
else:
  if zero <= s[1] <= 12:
    print("YYMM")
  else:
    print("NA")

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

s[k-1] = s[k-1].swapcase()
print("".join(s))

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

print(join(s[k-1].swapcase()))

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

s[k-1] = s[k-1].swapcase()
print("".join(s))

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

print(s[k-1].swapcase)

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

s[k-1] = s[k-1].swapcase()
print("".join(s))
Buggy python submission (verdict: Runtime Error):
s = list(map(str, input()))
a = s.count(+)
b = s.count(-)
print(a - b)


Fixed submission:
s = list(input())
a = s.count("+")
b = s.count("-")
print(a - b)

Buggy python submission (verdict: Runtime Error):
s = map(int, input().split(1))
a = s.count(+)
b = s.count(-)
print(a - b)

Fixed submission:
s = list(input())
a = s.count("+")
b = s.count("-")
print(a - b)
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = sum(map(int, list(str(n)))

if n % s == 0:
  print("Yes")
else:
  print("No")


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

if n % s == 0:
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
n = int(input())
s = sum(map(int,(list(str(n))))

if n % s == 0:
  print("Yes")
else:
  print("No")


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

if n % s == 0:
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
n = int(input())
s = sum(int(list(str(n))))

if n % s == 0:
  print("Yes")
else:
  print("No")


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

if n % s == 0:
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
n = int(input())
s = sum(list(n))

if n % s == 0:
  print("Yes")
else:
  print("No")


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

if n % s == 0:
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
n = int(input())
s = list(n)

if n % sum(s) == 0:
  print("Yes")
else:
  print("No")


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

if n % s == 0:
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
n = int(input())
s = list(n)

if n % sum(s):
  print("Yes")
else:
  print("No")

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

if n % s == 0:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
if a <= 8 and b <= 8:
  print("Yay!")
elif:
  print(":(")


Fixed submission:
a, b = map(int, input().split())
if a <= 8 and b <= 8:
  print("Yay!")
else:
  print(":(")

Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
if a <= 8 or b <= 8:
  print("Yay!")
elif:
  print(":(")


Fixed submission:
a, b = map(int, input().split())
if a <= 8 and b <= 8:
  print("Yay!")
else:
  print(":(")

Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
if a > 8 or b > 8:
  print(":(")
elif:
  print("Yay!")


Fixed submission:
a, b = map(int, input().split())
if a <= 8 and b <= 8:
  print("Yay!")
else:
  print(":(")

Buggy python submission (verdict: Runtime Error):
a, b = int(input().split())
if a > 8 or b > 8:
  print(":(")
elif:
  print("Yay!")

Fixed submission:
a, b = map(int, input().split())
if a <= 8 and b <= 8:
  print("Yay!")
else:
  print(":(")
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))

for i in a:
  count += bin(i).rfind("1") - 1

print(count)

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

count = 0
for i in a:
  count += len(bin(i)) - bin(i).rfind("1") - 1

print(count)

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

for i in a:
  count += bin(i).rfind("1") - 1

  print(count)

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

count = 0
for i in a:
  count += len(bin(i)) - bin(i).rfind("1") - 1

print(count)

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

count = 0
for i in range(n+1):
  b = a[i].rfind(1) - 1
  count += b

print(count)

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

count = 0
for i in a:
  count += len(bin(i)) - bin(i).rfind("1") - 1

print(count)
Buggy python submission (verdict: Runtime Error):
money = int(input())
while money > 1000
    money -= 1000
print(1000 - money)

Fixed submission:
money = int(input())
while money > 1000 :
    money -= 1000
print(1000 - money)
Buggy python submission (verdict: Runtime Error):
a = input()
if a.islower():
  ptint('a')
else:
  print('A')

Fixed submission:
ch = input()
if ch == 'a' or ch == 'b' or ch == 'c' or ch == 'd' or ch == 'e' or ch == 'f' or ch == 'g' or ch == 'h':
  print('a')
elif ch == 'i' or ch == 'j' or ch == 'k' or ch == 'l' or ch == 'm' or ch == 'n' or ch == 'o':
  print('a')
elif ch == 'p' or ch == 'q' or ch == 'r' or ch == 's' or ch == 't' or ch == 'u' or ch == 'v':
  print('a')
elif ch == 'w' or ch == 'x' or ch == 'y' or ch == 'z':
  print('a')
else:
 print('A')

Buggy python submission (verdict: Runtime Error):
ch = input()
if ch == a or ch == b or ch == c or ch == d or ch == e or ch == f or ch == g or ch == h:
  print(a)
elif ch == i or ch == j or ch == k or ch == l or ch == m or ch == n or ch == o:
  print(a)
elif ch == p or ch == q or ch == r or ch == s or ch == t or ch == u or ch == v:
  print(a)
elif ch == w or ch == x or ch == y or ch == z:
  print(a)
else
 print(b)

Fixed submission:
ch = input()
if ch == 'a' or ch == 'b' or ch == 'c' or ch == 'd' or ch == 'e' or ch == 'f' or ch == 'g' or ch == 'h':
  print('a')
elif ch == 'i' or ch == 'j' or ch == 'k' or ch == 'l' or ch == 'm' or ch == 'n' or ch == 'o':
  print('a')
elif ch == 'p' or ch == 'q' or ch == 'r' or ch == 's' or ch == 't' or ch == 'u' or ch == 'v':
  print('a')
elif ch == 'w' or ch == 'x' or ch == 'y' or ch == 'z':
  print('a')
else:
 print('A')
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

N = W = 0
g = []
MAX_V = 100100


def get_input():
    global N, W, g
    N, W = map(int, input().split())
    g = []
    for _ in range(N):
        g.append([int(x) for x in input().split()])


def dpcalc():
    global N, W, g
    # 動的計画法のテーブルを初期化
    dp = np.full((N + 1, MAX_V + 1), 10 ** 11)
    # dp = [[10 ** 11] * (MAX_V + 1) for _ in range(N + 1)]

    # テーブルをiの小さい方から順に計算してゆく
    for i in range(1, N + 1):
        for j in range(MAX_V + 1):
            w, v = g[i - 1]
            if j - v > 0:
                dp[i][j] = min(dp[i - 1][j - v]  +  w, dp[i - 1][j])
            else:
                dp[i][j] = min(dp[i - 1][j], w)

    for i in range(MAX_V, -1, -1):
        if dp[N][i] <= W:
            return i
    return 0


get_input()
print(dpcalc())


Fixed submission:
import numpy as np

N = W = 0
g = []
MAX_V = 100100


def get_input():
    global N, W, g
    N, W = map(int, input().split())
    g = []
    for _ in range(N):
        g.append([int(x) for x in input().split()])


def dpcalc():
    global N, W, g
    # 動的計画法のテーブルを初期化
    dp = np.full((N + 1, MAX_V + 1), 10 ** 11)
    # dp = [[10 ** 11] * (MAX_V + 1) for _ in range(N + 1)]

    # テーブルをiの小さい方から順に計算してゆく
    r = 1
    for i in range(1, N + 1):
        w, v = g[i - 1]
        dp[i][:v + 1] = np.minimum(dp[i - 1][:v + 1], w)
        dp[i][v + 1:v + r] = np.minimum(dp[i - 1][1: r] + w, dp[i - 1][v + 1:v + r] )
        
        r += v
        
    for i in range(MAX_V, -1, -1):
        if dp[N][i] <= W:
            return i
    return 0


get_input()
print(dpcalc())

Buggy python submission (verdict: Time Limit Exceeded):
N = W = 0
g = []
MAX_V = 100100


def get_input():
    global N, W, g
    N, W = map(int, input().split())
    g = []
    for _ in range(N):
        g.append([int(x) for x in input().split()])


def dpcalc():
    global N, W, g
    # 動的計画法のテーブルを初期化
    dp = [[10 ** 11] * (MAX_V + 1) for _ in range(N + 1)]

    # テーブルをiの小さい方から順に計算してゆく
    for i in range(1, N + 1):
        for j in range(MAX_V + 1):
            w, v = g[i - 1]
            if j - v > 0:
                dp[i][j] = min(dp[i - 1][j - v]  +  w, dp[i - 1][j])
            else:
                dp[i][j] = min(dp[i - 1][j], w)

    for i in range(MAX_V, -1, -1):
        if dp[N][i] <= W:
            return i
    return 0


get_input()
print(dpcalc())


Fixed submission:
import numpy as np

N = W = 0
g = []
MAX_V = 100100


def get_input():
    global N, W, g
    N, W = map(int, input().split())
    g = []
    for _ in range(N):
        g.append([int(x) for x in input().split()])


def dpcalc():
    global N, W, g
    # 動的計画法のテーブルを初期化
    dp = np.full((N + 1, MAX_V + 1), 10 ** 11)
    # dp = [[10 ** 11] * (MAX_V + 1) for _ in range(N + 1)]

    # テーブルをiの小さい方から順に計算してゆく
    r = 1
    for i in range(1, N + 1):
        w, v = g[i - 1]
        dp[i][:v + 1] = np.minimum(dp[i - 1][:v + 1], w)
        dp[i][v + 1:v + r] = np.minimum(dp[i - 1][1: r] + w, dp[i - 1][v + 1:v + r] )
        
        r += v
        
    for i in range(MAX_V, -1, -1):
        if dp[N][i] <= W:
            return i
    return 0


get_input()
print(dpcalc())
Buggy python submission (verdict: Time Limit Exceeded):
# atcoder 動的計画法
# I Coins

def get_inputs():
    # N コインの枚数
    # ps 各コインが表となる確率の配列(リスト)
    
    N = int(input())
    
    ps = list(map(float, input().split()))
    
    return N, ps

# 動的計画法の基づきテーブルを作成する
# dp[i][j] : i番目までのコインを投げた時に、j枚が表である確率
# 漸化式は下のようになる
# dp[i + 1][j + 1] = dp[i + 1][j + 1] + dp[i][j] * p(i + 1)
# dp[i + 1][j] = dp[i + 1][j] + dp[i][j] * (1 - p(i + 1))
#
# 0相対で考えて 0<= i < N, 0 <= j <= N  

N, ps = get_inputs()

dp = [[0.0] * (N + 1) for _ in range(N)]

dp[0][0] = 1 - ps[0]
dp[0][1] = ps[0]

for i in range(N - 1):
    for j in range(i + 2):
        dp[i + 1][j] = dp[i + 1][j] + dp[i][j] * (1 - ps[i + 1])
        dp[i + 1][j + 1] = dp[i + 1][j + 1] + dp[i][j] * ps[i + 1]

print(sum(dp[N - 1][(N + 1)//2:]))


Fixed submission:
# atcoder 動的計画法
# I Coins

import numpy as np


def get_inputs():
    # N コインの枚数
    # ps 各コインが表となる確率の配列(リスト)

    N = int(input())

    ps = list(map(float, input().split()))

    return N, ps


# 動的計画法の基づきテーブルを作成する
# dp[i][j] : i番目までのコインを投げた時に、j枚が表である確率
# 集める漸化式は下のようになる
# dp[i ][j ] = dp[i -1][j ]  *  (1 - p[i])  + dp[i - 1][j - 1] * p[i]
#
#

N, ps = get_inputs()

# dp = [[0.0] * (N + 1) for _ in range(N)]
dp = np.zeros((N, N + 1), dtype=float)

dp[0][1] = float(ps[0])
dp[0][0] = float(1.0 - ps[0])

for i in range(1, N):
    dp[i][:i + 2] = dp[i - 1][:i + 2] * (1 - ps[i])
    dp[i][1:i + 2] = dp[i - 1][:i + 1] * ps[i] + dp[i][1:i + 2]

print(sum(dp[N - 1][(N + 1) // 2:]))
Buggy python submission (verdict: Time Limit Exceeded):
def calcdp(i,j):
    global dp, A, BIG_INT
    
    if dp[i][j] != -1:
        return dp[i][j]
    
    if i + 1== j:
        dp[i][j] = 0
        return dp[i][j]
    
    elif i + 2== j:
        dp[i][j] = A[i] + A[i + 1]
        return dp[i][j]
    
    else:
        m = BIG_INT
        for k in range(i + 1, j):
            m = min(calcdp(i, k) + calcdp(k, j), m)
        m += sum(A[i:j])
        dp[i][j] = m
        return dp[i][j]

    
BIG_INT = 10**12
N = int(input())
A = [int(x) for x in input().split()]
dp = [[-1] * (N + 1) for _ in range(N)] 

print(calcdp(0, N))

Fixed submission:
def calcdp(i,j):
    global dp, A, BIG_INT
    
    if dp[i][j] != -1:
        return dp[i][j]
    
    if i + 1== j:
        dp[i][j] = 0
        return dp[i][j]
    
    elif i + 2== j:
        dp[i][j] = A[i] + A[i + 1]
        return dp[i][j]
    
    else:
        m = BIG_INT
        for k in range(i + 1, j):
            m = min(calcdp(i, k) + calcdp(k, j), m)
        m += sum(A[i:j])
        dp[i][j] = m
        return dp[i][j]

    
BIG_INT = 10**30
N = int(input())
A = [int(x) for x in input().split()]
dp = [[-1] * (N + 1) for _ in range(N)] 

print(calcdp(0, N))
Buggy python submission (verdict: Time Limit Exceeded):
def calcdp(i, s):
    # i番目の男性まで評価しときに、女性のマッチング状態がsとなる組み合わせの数
    global dp, MOD, N, A
    if dp[i][s] != -1:
        return dp[i][s]
    
    r = 0
    for j in range(N):
        if A[i-1][j] and s & (1 << j):
            r += calcdp(i - 1, s ^ (1 << j))
    
    r = r % MOD
    dp[i][s] = r
    return r


N = int(input())
A = [[int(x) for x in input().split()] for _ in range(N)]
MOD = 10**9 + 7

dp = [[-1] * 2**N for _ in range(N+1)]
dp[0][0] = 1

print(calcdp(N, 2**N-1))


                

Fixed submission:
def calcdp(i, s):
    # i番目の男性まで評価しときに、女性のマッチング状態がsとなる組み合わせの数
    global dp, MOD, N, A
    if dp[i][s] != -1:
        return dp[i][s]
    
    r = 0
    for j in range(N):
        if A[i-1][j] and s & (1 << j):
            r += calcdp(i - 1, s ^ (1 << j))
    
    dp[i][s] = r = r % MOD
    return r


N = int(input())
A = [[int(x) for x in input().split()] for _ in range(N)]
MOD = 10**9 + 7

dp = [[-1] * 2**N for _ in range(N+1)]
dp[0][0] = 1

print(calcdp(N, 2**N-1))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

p = 1
for i in range(1, N+1):
  p = p * i
 
print(p % (10**9 + 7))

Fixed submission:
N = int(input())
MOD = 10**9 + 7

p = 1
for i in range(1, N+1):
  p = (p * i) % MOD
 
print(p)
Buggy python submission (verdict: Runtime Error):
a、b=map(int, input(),split())
x =a+b
y =a-b
z =a*b
print(max(x,y,z))

Fixed submission:
A, B = map(int, input().split())
print(max(A + B, A - B, A * B))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
print(*[A.index(n+1)+1 for n in range(N)]) # TLE?

Fixed submission:
import numpy as np
N = int(input())
A = list(map(int, input().split()))
print(*[i+1 for i in np.argsort(A)])
Buggy python submission (verdict: Time Limit Exceeded):
N, K, Q = map(int, input().split())

A = []
for i in range(Q):
    A.append(input())

points = [K] * N
for correct in A:
    for i in range(N):
        if i != int(correct) - 1:
            points[i] -= 1

for p in points:
    if p > 0:
        print("Yes")
    else:
        print("No")


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

answer_count = [0] * N
for i in range(Q):
    answer_count[int(input())-1] += 1

for a in answer_count:
    if K - (Q - a) > 0:
        print("Yes")
    else:
        print("No")
Buggy python submission (verdict: Runtime Error):
n = int(input())
L = list(map(int,input().split()))
L.sort()
ans = 0
for i in range(n):
  for j in range(i+1, n):
    for k in range(j+1, n):
      if i < l < k and L[i] + L[j] > L[k] :
        ans += 1
print(ans) 
      


Fixed submission:
n = int(input())
L = list(map(int,input().split()))
L.sort()
ans = 0
for i in range(n):
  for j in range(i+1, n):
    for k in range(j+1, n):
      if L[i] < L[j] < L[k] and L[i] + L[j] > L[k] :
        ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
AC = 0
WA = 0
TLE = 0
RE = 0
for _ in range(n):
  a = input()
  if a = "AC":
    AC += 1
  elif a = "WA":
    WA += 1
  elif a = "TLE":
    TLE += 1
  else:
    RE += 1
  
print("AC x "+ AC)
print("WA x "+ WA)
print("TLE x "+ TLE)
print("RE x "+ RE)


Fixed submission:
n = int(input())
A = [input() for _ in range(n)]

print("AC x " + str(A.count("AC")))
print("WA x " + str(A.count("WA")))
print("TLE x " + str(A.count("TLE")))
print("RE x " + str(A.count("RE")))

Buggy python submission (verdict: Runtime Error):
n = int(input())
A = [input().split() for _ in range(n)]
print("AC x "+ A.count("AC"))
print("WA x "+ A.count("WA"))
print("TLE x "+ A.count("TLE"))
print("RE x "+ A.count("RE"))


Fixed submission:
n = int(input())
A = [input() for _ in range(n)]

print("AC x " + str(A.count("AC")))
print("WA x " + str(A.count("WA")))
print("TLE x " + str(A.count("TLE")))
print("RE x " + str(A.count("RE")))

Buggy python submission (verdict: Runtime Error):
n = int(input())
A = [input() for _ in range(n)]
print("AC x "+ A.count("AC"))
print("WA x "+ A.count("WA"))
print("TLE x "+ A.count("TLE"))
print("RE x "+ A.count("RE"))


Fixed submission:
n = int(input())
A = [input() for _ in range(n)]

print("AC x " + str(A.count("AC")))
print("WA x " + str(A.count("WA")))
print("TLE x " + str(A.count("TLE")))
print("RE x " + str(A.count("RE")))
Buggy python submission (verdict: Runtime Error):
a = str(input())
if a.isupper():
  print("A")
else:
  peint("a")


Fixed submission:
a = input()
if a.isupper():
  print("A")
else:
  print("a")

Buggy python submission (verdict: Runtime Error):
a = input()
if a.isupper():
  print("A")
else:
  peint("a")


Fixed submission:
a = input()
if a.isupper():
  print("A")
else:
  print("a")

Buggy python submission (verdict: Runtime Error):
a = input()
if a == a.upper():
  print(a)
else:
  peint(a.lower())

Fixed submission:
a = input()
if a.isupper():
  print("A")
else:
  print("a")
Buggy python submission (verdict: Runtime Error):
h,n = [int(x) for x in input().split()]

# dp[i] = min magic points to decrease i health points
maxmax = 99999999
dp = [maxmax for x in range(h+1)]
dp[0] = 0
for x in range(n):
    a,b = [int(r) for r in input().split()]
    
    for j in range(h):
        dp[min(j+a, h)] = min(dp[min(j+a, h)], dp[j]+b)

print(dp[h])


Fixed submission:
import math
a,b = [int(x) for x in input().split()]

print(math.ceil(a/b))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ans = n
s = []
for i in range(n):
    temp = input()
    if temp in s:
        ans -= 1
    else:
        s.append(temp)
print(ans)


Fixed submission:
n = int(input())
ans = n
s = set()
for i in range(n):
    s.add(input())
print(len(s))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ans = n
s = []
for i in range(n):
    temp = input()
    if temp in s:
        ans = ans - 1
    else:
        s.append(temp)
print(ans)


Fixed submission:
n = int(input())
ans = n
s = set()
for i in range(n):
    s.add(input())
print(len(s))
Buggy python submission (verdict: Time Limit Exceeded):
k, s = map(int, input().split())
cnt = 0
for x in range(k+1):
    for y in range(k+1):
        if x+y > s:
            break
        for z in range(k+1):
            if x+y+z == s:
                cnt += 1
            elif x+y+z > s:
                break
print(cnt)


Fixed submission:
k, s = map(int, input().split())
cnt = 0
for x in range(k+1):
    for y in range(k+1):
        if (0 <= s-x-y) and (s-x-y <= k):
            cnt += 1
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
k, s = map(int, input().split())
cnt = 0
for x in range(k+1):
    for y in range(k+1):
        for z in range(k+1):
            if x+y+z == s:
                cnt += 1
            elif x+y+z > s:
                continue
print(cnt)


Fixed submission:
k, s = map(int, input().split())
cnt = 0
for x in range(k+1):
    for y in range(k+1):
        if (0 <= s-x-y) and (s-x-y <= k):
            cnt += 1
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
k, s = map(int, input().split())
cnt = 0
for x in range(k+1):
    for y in range(k+1):
        for z in range(k+1):
            if x+y+z == s:
                cnt += 1
print(cnt)


Fixed submission:
k, s = map(int, input().split())
cnt = 0
for x in range(k+1):
    for y in range(k+1):
        if (0 <= s-x-y) and (s-x-y <= k):
            cnt += 1
print(cnt)
Buggy python submission (verdict: Runtime Error):
n=int(input())
 
ans=[0]*(n+1)
 
for x in range(1,101):
    for y in range(1,101):
        for z in range(1,101):
            f= x**2 + y**2 + z**2 + x*y + y*z + z*x
            if f<=n:
                ans[f]+=1
 
for i in range(1,n+1):
    print(ans[i])

Fixed submission:
L, R, d = map(int, input().split())

a = 1
cnt = 0
while 1:
    s = d*a
    if (L<=s)and(R>=s):
        cnt += 1
    elif R<s:
        break
    a += 1
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
T = list(input())

s = T.count('?')

for i in range(s):
    T[T.index('?')] = 'D'
print(''.join(T))

Fixed submission:
T = input()

T = T.replace('?', 'D')
	
print(''.join(T))

Buggy python submission (verdict: Time Limit Exceeded):
T = list(input())

s = T.count('?')

for i in range(s):
    a = T.index('?')
    T[a] = 'D'
print(''.join(T))

Fixed submission:
T = input()

T = T.replace('?', 'D')
	
print(''.join(T))

Buggy python submission (verdict: Runtime Error):
T = list(input())

s = T.count('?')

for i in range(s):
    a = T.index('?')
    if a == 0:
        if T[a+1] == 'D':
            T[a] = 'P'
        else:
            T[a] = 'D'
    else:
        T[a] = 'D'
print(''.join(T))

Fixed submission:
T = input()

T = T.replace('?', 'D')
	
print(''.join(T))

Buggy python submission (verdict: Runtime Error):
T = list(input())

s = T.count('?')

for i in range(s):
    a = T.index('?')
    if a == 0:
        if T[T.index('?')+1] == 'D':
            T[a] = 'P'
        else:
            T[a] = 'D'
    else:
        T[a] = 'D'
print(''.join(T))

Fixed submission:
T = input()

T = T.replace('?', 'D')
	
print(''.join(T))

Buggy python submission (verdict: Time Limit Exceeded):
T = list(input())

s = T.count('?')

for i in range(s):
    a = T[T.index('?')]
    if a == 0:
        if T[T.index('?')+1] == 'D':
            T[T.index('?')] = 'P'
        else:
            T[T.index('?')] = 'D'
    else:
        T[T.index('?')] = 'D'
print(''.join(T))

Fixed submission:
T = input()

T = T.replace('?', 'D')
	
print(''.join(T))

Buggy python submission (verdict: Time Limit Exceeded):
T = list(input())

s = T.count('?')

for i in range(s):
    a = T[T.index('?')]
    if a == 0:
        if T[T.index('?')+1] == 'D':
            T[T.index('?')] = 'P'
        else:
            T[T.index('?')] = 'D'
    else:
        T[T.index('?')] = 'D'
print(''.join(T))

Fixed submission:
T = input()

T = T.replace('?', 'D')
	
print(''.join(T))

Buggy python submission (verdict: Runtime Error):
T = list(input())

s = T.count('?')

for i in range(s):
    a = T[T.index('?')]
    if a == 0:
        if T[T.index('?')+1] == 'D':
            T[T.index('?')] = 'P'
        else:
            T[T.index('?')] = 'D'
    elif a == len(T):
         T[T.index('?')] = 'D'
    else:
        if T[T.index('?')-1] == 'P':
            T[T.index('?')] = 'D'
        elif T[T.index('?')+1] == 'P':
            T[T.index('?')] = 'D'
        else:
            T[T.index('?')] = 'P'
print(''.join(T))

Fixed submission:
T = input()

T = T.replace('?', 'D')
	
print(''.join(T))
Buggy python submission (verdict: Time Limit Exceeded):
a,b,c,k = map(int, input().split())
cnt = 0
import sys
if a==k:
    cnt = a
    print(cnt)
    sys.exit(0)
for i in range(k):
    if a>0:
        cnt += 1
        a -= 1
    elif b>0:
        cnt += 0
        b -= 1
    elif c>0:
        cnt -= 1
        c -= 1

print(cnt)

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

if a>=k:
    cnt += k
else:
    k -= a
    cnt += a
    if k>0:
        k -= b
        if k>0:
            cnt -= k

print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
K = int(input())
cnt = 0
import math
from functools import reduce

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

for i in range(1,K+1):
    for j in range(1,K+1):
        for k in range(1,K+1):

            cnt += gcd_list([i,j,k])
print(cnt)

Fixed submission:
K = int(input())
cnt = 0
import math
from functools import reduce
 
def gcd_list(numbers):
    return reduce(math.gcd, numbers)
 
for i in range(1,K+1):
    for j in range(1,K+1):
        for k in range(1,K+1):
 
            cnt += gcd_list([i,j,k])
print(cnt)