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

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

if n == 0:
    print(x)
    exit()

cnt = [0] *10001
ans1 = 0
ans2 = 0

for _p in p:
    cnt[_p] += 1

for i in range(x, 1000):
    if not i in p:
        ans1 = i
        break

for i in range(x-1, -1000, -1):
    if not i in p:
        ans2 = i
        break

if abs(ans1 - x) < abs(ans2 - x):
    print(ans1)
elif abs(ans1 - x) >= abs(ans2 - x):
    print(ans2)

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

if n == 0:
    print(x)
    exit()

cnt = [0] *101
ans1 = 0
ans2 = 0

for _p in p:
    cnt[_p] += 1

for i in range(x, 1000):
    if cnt[i] == 0:
        ans1 = i
        break

for i in range(x-1, -1000, -1):
    if cnt[i] == 0:
        ans2 = i
        break

if abs(ans1 - x) < abs(ans2 - x):
    print(ans1)
elif abs(ans1 - x) >= abs(ans2 - x):
    print(ans2)
Problem p02664 (python)

Fixed submission:
s = list(input())
n = len(s)

for i in range(n):
    # if i == 0 and s[i] == "?":
    #     if s[i+1] == "D" or s[i+1] == "?":
    #         s[i] = "P"
    #     else:
    #         if s[i+1] == "P":
    #             s[i] = "D"
    # elif i != 0 and s[i] == "?":
    #     if s[i-1] == "P":
    #         s[i] = "D"
    #     elif s[i-1] == "D":
    #         s[i] = "P"
    if s[i] == "?":
        s[i] = "D"

print("".join(s))

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

for i in range(n):
    if i == 0 and s[i] == "?":
        if s[i+1] == "D" or s[i+1] == "?":
            s[i] = "P"
        else:
            if s[i+1] == "P":
                s[i] = "D"
    elif i != 0 and s[i] == "?":
        if s[i-1] == "P":
            s[i] = "D"
        elif s[i-1] == "D":
            s[i] = "P"

print("".join(s))

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

for i in range(n):
    if i == 0:
        if s[i+1] == "D" or s[i+1] == "?":
            s[i] = "P"
        else:
            if s[i+1] == "P":
                s[i] = "D"
    else:
        if s[i-1] == "P":
            s[i] = "D"
        elif s[i-1] == "D":
            s[i] = "P"

print("".join(s))
Problem p02761 (python)

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

# 条件の整理
cnt = [0]*4
for i in range(m):
    cnt[sc[i][0]] += 1
    # 最上位桁が0
    # if sc[i][0] == 1 and sc[i][0] == 0 and n > 1:
    #     print(-1)
    #     exit()
    # 同じ桁に違う数字指定
    if cnt[sc[i][0]] > 1:
        
        val = []
        
        for j in range(m):
            if sc[j][0] == sc[i][0]:
                val.append(sc[j][1])
        
        if len(list(set(val))) > 1:
            print(-1)
            exit()


# 全探索
ans = []
for i in range(1000):
    if len(str(i)) == n:
        flg = True
        for j in range(m):
            digit = sc[j][0]
            val = sc[j][1]
            if int(str(i)[digit-1]) != val:
                flg = False
                break
        if flg == True:
            ans.append(i)

if len(ans) == 0:
    print(-1)
    exit()
print(min(ans))

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
num = [0] * m
for i in range(m):
    s, c = map(int, input().split())
    if num[s-1] != 0 and num[s-1] != c:
        print(-1)
        exit()
    num[s-1] = c

if 1 < n and num[0] == 0:
    print(-1)
    exit()

for i in range(1000):
    ok = True
    string = str(i)
    if len(string) == n:
        for j in range(n):
            if len(string) <= j or len(num) <= j:
                continue
            if num[j] == 0:
                continue
            elif string[j] != str(num[j]):
                ok = False
                break
        if ok:
            print(i)
            exit()
print(-1)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
num = [0] * m
for i in range(m):
    s, c = map(int, input().split())
    if num[s-1] != 0 and num[s-1] != c:
        print(-1)
        exit()
    num[s-1] = c

if 1 < n and num[0] == 0:
    print(-1)
    exit()

for i in range(1000):
    ok = True
    string = str(i)
    if len(string) == n:
        for j in range(n):
            if num[j] == 0:
                continue
            elif string[j] != str(num[j]):
                ok = False
                break
        if ok:
            print(i)
            exit()
print(-1)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
num = [0] * m
for i in range(m):
    s, c = map(int, input().split())
    if num[s-1] != 0 and num[s-1] != c:
        print(-1)
        exit()
    num[s-1] = c

if 1 < n and num[0] == 0:
    print(-1)
    exit()

for i in range(1000):
    ok = True
    string = str(i)
    if len(string) == n:
        for j in range(m):
            if num[j] == 0:
                continue
            elif string[j] != str(num[j]):
                ok = False
                # print(i)
                # print(j)
                break
        if ok:
            print(i)
            exit()
print(-1)
Problem p02843 (python)

Fixed submission:
x = int(input())

quot = x//100
rem = x%100

if rem <= quot*5:
    print(1)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
x = int(input())

dp = [0] * (10**5+1)
dp[0] = 1

for i in range(x):
    if dp[i] == 1:
        dp[i+101] = 1
        dp[i+102] = 1
        dp[i+103] = 1
        dp[i+104] = 1
        dp[i+105] = 1

print(dp[x])

Buggy submission (verdict: Runtime Error):
x = int(input())

dp = [0] * 10**5
dp[0] = 1

for i in range(x):
    if dp[i] == 1:
        dp[i+101] = 1
        dp[i+102] = 1
        dp[i+103] = 1
        dp[i+104] = 1
        dp[i+105] = 1
        dp[i+106] = 1

print(dp[x])
Problem p02866 (python)

Fixed submission:
from collections import Counter
import math
n = int(input())
d = list(map(int, input().split()))

for i in range(1, n):
        if d[i] == 0:
                print(0)
                exit()

ans = 1
setD = list(set(d))
# setD.sort()



if d[0] > 0:
        print(0)
else:
        c = Counter(d)
        
        # for _d in d:
        #         if _d != 0:
        #                 # print(_d - 1)
        #                 print(c[_d - 1])
        #                 # print("---------------")
        #                 ans *= c[_d - 1]

        for _d in setD:
                if _d != 0:
                        ans *= c[_d - 1] ** c[_d]

        print(ans%998244353)

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

for i in range(1, n):
        if d[i] == 0:
                print(0)
                exit(9)

ans = 1
setD = list(set(d))
# setD.sort()



if d[0] > 0:
        print(0)
else:
        c = Counter(d)
        
        # for _d in d:
        #         if _d != 0:
        #                 # print(_d - 1)
        #                 print(c[_d - 1])
        #                 # print("---------------")
        #                 ans *= c[_d - 1]

        for _d in setD:
                if _d != 0:
                        ans *= c[_d - 1] ** c[_d]

        print(ans%998244353)

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

setD = list(set(d))
setD.sort()
ans = 1
nodeMulti = 1

if d[0] > 0:
        print(0)
        exit()
else:
        #グラフ作れるかチェック
        for i in range(len(setD)-1):
                c[setD[i]]
        c = Counter(d)
        for s in setD:
                ans *= math.factorial(c[s])
                nodeMulti *= c[s]
        nodeMulti //= setD[-1]
        # ans *= nodeMulti
        print(ans%998244353)
Problem p02995 (python)

Fixed submission:
import fractions

def x(k, c, d):
    rl1 = k
    lcm = c*d // fractions.gcd(c,d)
    ccount = rl1 // c
    dcount = rl1 // d
    cdcount = rl1 // lcm
    # if lcm != 0:
    #     cdcount = int(rl1 // lcm)
    # else:
    #     cdcount = 0

    return rl1 - ccount - dcount + cdcount

a, b, C, D = map(int, input().split())
print(x(b, C, D) - x(a-1, C, D))

Buggy submission (verdict: Runtime Error):
from fractions import gcd

def x(k, c, d):
    rl1 = k
    lcm = c*d / math.gcd(c,d)
    ccount = int(rl1 // c)
    dcount = int(rl1 // d)
    if lcm != 0:
        cdcount = int(rl1 // lcm)
    else:
        cdcount = 0

    return int(rl1 - ccount - dcount + cdcount)

a, b, C, D = map(int, input().split())
print(x(b, C, D) - x(a-1, C, D))

Buggy submission (verdict: Runtime Error):
import math

a, b, C, D = map(int, input().split())

def x(k, c, d):
    rl1 = k
    lcm = c*d / math.gcd(c,d)
    ccount = int(rl1 // c)
    dcount = int(rl1 // d)
    if lcm != 0:
        cdcount = int(rl1 // lcm)
    else:
        cdcount = 0

    return int(rl1 - ccount - dcount + cdcount)

print(x(b, C, D) - x(a-1, C, D))

Buggy submission (verdict: Runtime Error):
import math

def x(k, c, d):
    rl1 = k
    lcm = c*d / math.gcd(c,d)
    ccount = int(rl1 // c)
    dcount = int(rl1 // d)
    if lcm != 0:
        cdcount = int(rl1 // lcm)
    else:
        cdcount = 0

    return int(rl1 - ccount - dcount + cdcount)

a, b, C, D = map(int, input().split())
print(x(b, C, D) - x(a-1, C, D))

Buggy submission (verdict: Runtime Error):
import math

def x(k, c, d):
    rl1 = k
    lcm = c*d / math.gcd(c,d)
    ccount = int(rl1 // c)
    dcount = int(rl1 // d)
    if lcm != 0:
        cdcount = int(rl1 // lcm)
    else:
        cdcount = 0
        

    return int(rl1 - ccount - dcount + cdcount)

a, b, C, D = map(int, input().split())

print(x(b, C, D) - x(a-1, C, D))

Buggy submission (verdict: Runtime Error):
import math

def x(k, c, d):
    rl1 = k
    lcm = c*d / math.gcd(c,d)
    ccount = int(rl1 // c)
    dcount = int(rl1 // d)
    cdcount = int(rl1 // lcm)

    return int(rl1 - ccount - dcount + cdcount)

a, b, C, D = map(int, input().split())

print(x(b, C, D) - x(a-1, C, D))
Problem p03087 (python)

Fixed submission:
import numpy as np
n, q = map(int, input().split())
s = input()
lr = []
for i in range(q):
        l,r = map(int, input().split())
        lr.append([l,r])

n = len(s)
L = 0
R = 1
cntAC = [0] * n

for i in range(n-1):
    if s[i]=="A" and s[i+1]=="C":
        cntAC[i] += 1

# 累積和
cSum = np.cumsum(cntAC)


for _lr in lr:
    if _lr[L] == 1:
        print(cSum[_lr[R]-2])
    else:
        print(cSum[_lr[R]-2] - cSum[_lr[L]-2])
        

"""
ACACTACG
"""

Buggy submission (verdict: Runtime Error):
import numpy as np
n, q = map(int, input().split())
s = input()
lr = []
for i in range(q):
        l,r = map(int, input().split())
        lr.append([l,r])

n = len(s)
L = 0
R = 1
cntAC = [0] * n

for i in range(n-1):
    if s[i]=="A" and s[i+1]=="C":
        cntAC[i] += 1

# 累積和
cSum = np.cumsum(cntAC)


for _lr in lr:
    if _lr[L] == 1:
        print(cSum[-1])
    else:
        print(cSum[_lr[R]-2] - cSum[_lr[L]-2])
        

"""
ACACTACG
"""

Buggy submission (verdict: Runtime Error):
import numpy as np
n, q = map(int, input().split())
s = input()
lr = []
for i in range(q):
        l,r = map(int, input().split())
        lr.append([l,r])

n = len(s)
L = 0
R = 1
cntAC = [0] * n

for i in range(n-1):
    if s[i]=="A" and s[i+1]=="C":
        cntAC[i] += 1

# 累積和
cSum = np.cumsum(cntAC)
print(cSum)

for _lr in lr:
    if _lr[L] == 1:
        print(cSum[-1])
    else:
        print(cSum[_lr[R]-2] - cSum[_lr[L]-2])
        

"""
ACACTACG
"""
Problem p03106 (python)

Fixed submission:
import sys

a, b, k = map(int, input().split())
l = []

for i in range(1, max(a,b)+1):
    if a%i == 0 and b%i == 0:
        l.append(i)
if l == []:
    print(1)
    sys.exit()
l.sort(reverse=True)
print(l[k-1])

Buggy submission (verdict: Runtime Error):
import sys

a, b, k = map(int, input().split())
l = []

for i in range(1, max(a,b)):
    if a%i == 0 and b%i == 0:
        l.append(i)
if l == []:
    print(1)
    sys.exit()
l.sort(reverse=True)
print(l[k-1])

Buggy submission (verdict: Runtime Error):
import sys

a, b, k = map(int, input().split())
l = []

for i in range(1, max(a,b)):
    if a%i == 0 and b%i == 0:
        l.append(i)
if l == []:
  print(1)
  sys.exit()
l.sort(reverse=True)
print(l[k-1])
Problem p03282 (python)

Fixed submission:
s=input()
k=int(input())
for i in range(len(s)):
        if s[i] == "1" and (k-1)==i:
                print(1)
                exit()
        elif s[i] == "1" and (k-1) != i:
                continue
        else:
                print(s[i])
                exit()

Buggy submission (verdict: Runtime Error):
A=5*10**15
s=input()
k=int(input())
l=0

for i in range(len(s)):
        l+=int(s[i])**A
        if k<l:
                print(int(s[i]))
                exit()
Problem p03311 (python)

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

for i in range(n):
    x[i] -= i+1

x.sort()
x_ = []
b = 0
if x.count(0) <= n//2:
    for i in range(n):
        if x[i] != 0:
             x_.append(x[i])

    b = statistics.median(x_)

ans = 0
for i in range(n):
    ans += abs(x[i] - b)

print(int(ans))

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

for i in range(n):
    x[i] -= i+1

x.sort()
x_ = []
b = 0
if x.count(0) <= n//2:
    for i in range(n):
        if x[i] != 0:
             x_.append(x[i])

    n_ = len(x_)
    if n_%2 == 0:
        b = x_[n_//2]
    else:
        b = x_[n_//2 + 1]

ans = 0
for i in range(n):
    ans += abs(x[i] - b)

print(ans)
Problem p03324 (python)

Fixed submission:
d,n=map(int, input().split())
if d == 0 and n == 100:
    print(101)
elif d == 1 and n == 100:
    print(10100)
elif d == 2 and n == 100:
    print(1010000)
else:
    print(100**d * n)

Buggy submission (verdict: Runtime Error):
d,n=map(int, input().split())
if d == 0 and n == 100:
    print(101)
elif d == 1 and n == 100
    print(10001)
elif d == 2 and n == 100
    print(1000001)
else:
    print(100**d * n)
Problem p03474 (python)

Fixed submission:
import re
a, b = map(int, input().split())
s = input()
p1 = r"\d{"+ str(a) +"}"
p2 = r"\d{"+ str(b) +"}"
if s[a] == "-" and re.fullmatch(p1, s[0:a]) != None and re.fullmatch(p2, s[a+1:]) != None:
        print("Yes")
else:
        print("No")

Buggy submission (verdict: Runtime Error):
import re
a, b = map(int, input().split())
s = input()
p1 = "\d{"+ str(a) +"}"
p2 = "\d{"+ str(b) +"}"
if s[a] == "-" and re.fullmatch(p1, s[0:a]) != None and re.fullmatch(p2, s[a+1:]) != None:
        print("Yes")
else:
        print("No")
Problem p03607 (python)

Fixed submission:
from collections import Counter

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

# count = [0] * (max(a)+1)

c = Counter(a)
ans = 0

for _a in list(set(a)):
    if c[_a]%2 != 0:
        ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = []
for i in range(n):
    a.append(int(input()))

count = [0] * (max(a)+1)

for _a in a:
    if count[_a] == 0:
        count[_a] = 1
    elif count[_a] == 1:
        count[_a] = 0

print(sum(count))
Problem p03625 (python)

Fixed submission:
from collections import Counter
n = int(input())
A = list(map(int, input().split()))

C = Counter(A)

rec = []
squ = []

for a in A:
    if 2 <= C[a]:
        rec.append(a)
    if 4 <= C[a]:
        squ.append(a)
rec = list(set(rec))
squ = list(set(squ))
# print(rec)
# print(squ)

s = 0
if len(squ) != 0:
    s = max(squ)**2

if len(rec) < 2:
    print(s)
else:
    rec.sort(reverse=True)
    print(max(s, rec[0]*rec[1]))

Buggy submission (verdict: Runtime Error):
n = int(input())
A = list(map(int, input().split()))
A.sort()
hst = [0] * (max(A) + 1)
for a in A:
    hst[a] += 1

rec = []
squ = []
A_ = list(set(A))
for a in A_:
    if hst[a] > 1:
        rec.append(a)
    if hst[a] >= 4:
        squ.append(a)

# print(rec)
# print(squ)

s = 0
if len(squ) != 0:
    s = squ[-1]**2

if len(rec) < 2:
    print(s)
else:
    print(max(s, rec[-1]*rec[-2]))

Buggy submission (verdict: Runtime Error):
n = int(input())
A = list(map(int, input().split()))
A.sort()
hst = [0] * (max(A) + 1)
for a in A:
    hst[a] += 1

rec = []
squ = []
for a in list(set(A)):
    if hst[a] > 1:
        rec.append(a)
    if hst[a] >= 4:
        squ.append(a)

# print(rec)
# print(squ)

s = 0
if len(squ) != 0:
    s = squ[-1]**2

if len(rec) < 2:
    print(s)
else:
    print(max(s, rec[-1]*rec[-2]))

Buggy submission (verdict: Runtime Error):
n = int(input())
A = list(map(int, input().split()))
A.sort()
hst = [0] * (max(A) + 1)
for a in A:
    hst[a] += 1

rec = []
squ = []
for a in list(set(A)):
    if hst[a] > 1:
        rec.append(a)
    if hst[a] >= 4:
        squ.append(a)

# print(rec)
# print(squ)

s = 0
if len(squ) != 0:
    s = squ[-1]**2

if len(rec) < 2:
    print(s)
else:
    print(max(s, rec[-1]*rec[-2]))

Buggy submission (verdict: Runtime Error):
n = int(input())
A = list(map(int, input().split()))
A.sort()
hst = [0] * (max(A) + 1)
for a in A:
    hst[a] += 1

rec = []
squ = []
for a in list(set(A)):
    if hst[a] > 1:
        rec.append(a)
    if hst[a] >= 4:
        squ.append(a)

# print(rec)
# print(squ)

s = 0
if len(squ) != 0:
    s = squ[-1]**2

if len(rec) < 2 and s == 0:
    print(0)
else:
    print(max(s, rec[-1]*rec[-2]))

Buggy submission (verdict: Runtime Error):
n = int(input())
A = list(map(int, input().split()))
A.sort()
hst = [0] * (A[-1] + 1)
for a in A:
    hst[a] += 1

rec = []
squ = []
for a in list(set(A)):
    if hst[a] > 1:
        rec.append(a)
    if hst[a] >= 4:
        squ.append(a)

# print(rec)
# print(squ)

s = 0
if len(squ) != 0:
    s = squ[-1]**2

if len(rec) <= 1 and len(squ) < 1:
    print(0)
else:
    print(max(s, rec[-1]*rec[-2]))
Problem p04025 (python)

Fixed submission:
"""
1 2 3 4 5
1 1 1 1 9   4 4 4 4 36=53 | 1 1 1 1 49
"""
import math
n = int(input())
a = list(map(int, input().split()))

ave1 = math.ceil(sum(a)/n)
ave2 = math.floor(sum(a)/n)
ans1 = 0
ans2 = 0

for _a in a:
    ans1 += (_a - ave1)**2

for _a in a:
    ans2 += (_a - ave2)**2

print(min(ans1, ans2))

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

ave = round(sum(a)/n)
ans = 0

for _a in a:
    ans += (_a - ave)**2

print(ans1)
Problem p02947 (python)

Fixed submission:
import math

n = int(input())
di = dict()
answer = 0

for i in range(n):
    tmp = str(sorted(input()))
    if di.get(tmp, 0) == 0:
        di[tmp] = 1
    else:
        answer += di[tmp]
        di[tmp] += 1

print(answer)

Buggy submission (verdict: Runtime Error):
import math

n = int(input())
di = dict()
answer = 0

for i in range(n):
    tmp = str(sorted(input()))
    if di.get(tmp, 0) == 0:
        di[tmp] = 1
    else:
        di[tmp] += 1

for v in di.values():
    if v > 1:
        answer += int(math.factorial(v) / 2)
print(answer)

Buggy submission (verdict: Runtime Error):
import math

n = int(input())
di = dict()
answer = 0

for i in range(n):
    tmp = str(sorted(input()))
    if di.get(tmp, 0) == 0:
        di[tmp] = 1
    else:
        di[tmp] += 1

for v in di.values():
    if v > 1:
        answer += (math.factorial(v) / 2)
print(answer)

Buggy submission (verdict: Runtime Error):
import math

n = int(input())
di = dict()
answer = 0

for i in range(n):
    tmp = str(sorted(input()))
    if di.get(tmp, 0) == 0:
        di[tmp] = 1
    else:
        di[tmp] += 1

for v in di.values():
    if v > 1:
        answer += int(math.factorial(v) / 2)
print(answer)
Problem p03076 (python)

Fixed submission:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())


ar = [t % 10 for t in [a, b, c, d, e] if t % 10 != 0]
if len(ar) == 0:
    ar.append(0)
mi = min(ar)


# print(mi)

# print([wt + (10 - (wt % 10)) if wt % 10 != 0 else wt for wt in [a, b, c, d, e]])
w = sum([wt + (10 - (wt % 10)) if wt % 10 != 0 else wt for wt in [a, b, c, d, e]])

if mi > 0:
    w = w - 10 + mi
print(w)

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

mi = min(t % 10 for t in [a, b, c, d, e] if t % 10 != 0)
# print(mi)

# print([wt + (10 - (wt % 10)) if wt % 10 != 0 else wt for wt in [a, b, c, d, e]])
print(sum([wt + (10 - (wt % 10)) if wt % 10 != 0 else wt for wt in [a, b, c, d, e]]) - 10 + mi)
Problem p03087 (python)

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

li_flg = [0] * len(s)

for i in range(q):
    li_lr.append(list(map(int, input().split())))


for idx, v in enumerate(s):
    if v == 'C' and idx != 0 and s[idx - 1] == 'A':
        li_flg[idx] = li_flg[idx - 1] + 1
    else:
        li_flg[idx] = li_flg[idx - 1]

for l in li_lr:
    print(li_flg[l[1] - 1] - li_flg[l[0] - 1])

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

li_flg = [0] * len(s)

for i in range(q):
    li_lr.append(list(map(int, input().split())))


for idx, v in enumerate(s):
    if v == 'A':
        if idx != len(s) and s[idx + 1] == 'C':
            li_flg[idx] = 1


for l in li_lr:
    li_w = li_flg[l[0] - 1: l[1]]
    if li_w[-1] == 1:
        print(sum(li_w) - 1)
    else:
        print(sum(li_w))
Problem p03324 (python)

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

print([i * (100 ** d) for i in range(1, 102) if i != 100][n - 1])

Buggy submission (verdict: Runtime Error):
int_n = int(input())

bin_number = format(int_n, 'b')

bin_sum = sum(list(map(int, list(str(bin_number)))))

if int_n % bin_sum == 0:
    print("Yes")
else:
    print("No")
Problem p03386 (python)

Fixed submission:
int_a, int_b, int_k = map(int, input().split())

minset = set(range(int_a, int_a + int_k))
maxset = set(range(int_b - int_k + 1, int_b + 1))

result = list(minset | maxset)
result.sort()
for i in result:
    if int_a <= i <= int_b:
        print(i)

Buggy submission (verdict: Runtime Error):
int_a, int_b, int_k = map(int, input().split())

ar = list(range(int_a, int_b + 1))

minset = set(range(int_a, int_a + int_k))
maxset = set(range(int_b - int_k + 1, int_b + 1))

result = list(minset | maxset)
result.sort()
for i in result:
    if int_a <= i <= int_b:
        print(i)

Buggy submission (verdict: Runtime Error):
int_a, int_b, int_k = map(int, input().split())

ar = list(range(int_a, int_b + 1))

minset = set(range(int_a, int_a + int_k + 1))
maxset = set(range(int_b - int_k + 1, int_b + 1))

result = list(minset | maxset)
result.sort()
for i in result:
    if int_a <= i <= int_b:
        print(i)

Buggy submission (verdict: Runtime Error):
int_a, int_b, int_k = map(int, input().split())

ar = list(range(int_a, int_b + 1))

minset = set(ar[:int_k])
maxset = set(ar[int_k * -1:])

result = list(minset | maxset)
result.sort()
for i in result:
    print(i)

Buggy submission (verdict: Runtime Error):
int_a, int_b, int_k = map(int, input().split())

ar = list(range(int_a, int_b + 1))

minset = set(ar[:int_k])
maxset = set(ar[int_k * -1:])

result = list(minset | maxset)
result.sort()
print(result)
Problem p03565 (python)

Fixed submission:
sd = input()
t = input()
li_answer = list()
c_loop = len(sd) - len(t) + 1

for i in range(c_loop):
    if all((w_sd == "?" or w_sd == w_t) for w_sd, w_t in zip(sd[i:i + len(t) + 1], t)):
        s_tmp = str(sd[0:i] + t + sd[i + len(t):]).replace("?", "a")
        li_answer.append(s_tmp)

if li_answer:
    print(sorted(li_answer)[0])
else:
    print("UNRESTORABLE")

Buggy submission (verdict: Runtime Error):
sd = input()
t = input()
li_answer = list()
c_loop = len(sd) - len(t) + 1

for i in range(c_loop):
    if all((w_sd == "?" or w_sd == w_t) for w_sd, w_t in zip(sd[i:i + len(t) + 1], t)):
        s_tmp = str(sd[0:i] + t + sd[i + len(t):]).replace("?", "a")
        li_answer.append(s_tmp)

if li_answer:
    print(sorted(li_answer)[0])
else:
    print("UNRESTORABLE")


                                            ｋ