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

Fixed submission:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n, m = map(int, readline().split())
a = list(map(int, readline().split()))
sum_a = sum(a)
cnt = 0
for i in range(n):
    if a[i] / sum_a >= 1 / (4 * m):
        cnt += 1
if cnt >= m:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

import itertools

n, m = map(int, readline().split())
a = list(map(int, readline().split()))
sum_a = sum(a)
cumsum = list(itertools.accumulate(a))
ans = [0] * n
cnt = 0
if cumsum[m] / sum_a >= 1 / (n * m):
    cnt += 1
for i in range(1, n - m + 1):
    if (cumsum[m + i - 1] - cumsum[i - 1]) / sum_a >= 1 / (n * m):
        cnt += 1
    if cnt >= m:
        print('Yes')
        exit()
if cnt >= m:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

import itertools

n, m = map(int, readline().split())
a = list(map(int, readline().split()))
sum_a = sum(a)
cumsum = list(itertools.accumulate(a))
ans = [0] * n
cnt = 0
if cumsum[m] / sum_a < 1 / (n * m):
    for i in range(m):
        ans[i] -= 1
for i in range(1, n - m + 1):
    if (cumsum[m + i - 1] - cumsum[i - 1]) / sum_a < 1 / (n * m):
        for j in range(i, m + 1):
            ans[j] -= 1
for i in range(n):
    if ans[i] == 0:
        cnt += 1
if cnt >= m:
    print('Yes')
else:
    print('No')
Problem p02727 (python)

Fixed submission:
import sys
input = sys.stdin.readline

x, y, a, b, c = map(int, input().split())
p = sorted(map(int, input().split()), reverse=True)
q = sorted(map(int, input().split()), reverse=True)
r = list(map(int, input().split()))

C = p[:x] + q[:y] + r
C.sort(reverse=True)

print(sum(C[:x + y]))

Buggy submission (verdict: Runtime Error):
for i in range(c):
    # print(p[x - 1 - cnt_p], q[y - 1 - cnt_q], cnt_q, cnt_p, cumsum_q, cumsum_p)
    if x - 1 - cnt_p < 0 and y - 1 - cnt_q < 0:
        break
    if x - 1 - cnt_p < 0:
        if r[i] >= q[y - 1 - cnt_q]:
            cumsum_q[y - 1] += r[i] - q[y - 1 - cnt_q]
            cnt_q += 1
        else:
            break
    if y - 1 - cnt_q < 0:
        if r[i] >= q[y - 1 - cnt_q]:
            cumsum_q[y - 1] += r[i] - q[y - 1 - cnt_q]
            cnt_q += 1
        else:
            break
    if p[x - 1 - cnt_p] > q[y - 1 - cnt_q]:
        if r[i] >= q[y - 1 - cnt_q]:
            cumsum_q[y - 1] += r[i] - q[y - 1 - cnt_q]
            cnt_q += 1
        else:
            break
    else:
        if r[i] >= p[x - 1 - cnt_p]:
            cumsum_p[x - 1] += r[i] - p[x - 1 - cnt_p]
            cnt_p += 1
        else:
            break
print(cumsum_p[x - 1] + cumsum_q[y - 1])
Problem p02732 (python)

Fixed submission:
import sys
import collections
input = sys.stdin.readline

n = int(input())
a = list(map(int, input().split()))
count = collections.Counter(a)
sm = {}
sm2 = {}
for key, value in count.items():
    sm[key] = value * (value - 1) // 2
    sm2[key] = (value - 1) * (value - 2) // 2
total = sum(sm.values())

for num in a:
    print(total - sm[num] + sm2[num])

Buggy submission (verdict: Runtime Error):
import sys
import collections
import bisect
input = sys.stdin.readline

n = int(input())
a = list(map(int, input().split()))
ab = sorted(a)
memo = collections.Counter(ab)
memo_key = list(memo.keys())
memo_v = list(memo.values())
len_v = len(memo_v)
max = max(memo_v)
cnt = [0] * max
cnt_sum = 0
ans_memo = [0] * len_v
for i in range(1, max):
    cnt[i] = cnt[i - 1] + i
for i in range(len_v):
    cnt_sum += cnt[memo_v[i] - 1]
for i in range(len_v):
    ans_memo[i] = cnt[memo_v[i] - 2] + cnt_sum - cnt[memo_v[i] - 1]
for i in range(n):
    ans = ans_memo[bisect.bisect_left(memo_key, a[i])]
    print(ans)
Problem p02761 (python)

Fixed submission:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n, m = map(int, readline().split())
if m == 0:
    if n == 1:
        print(0)
    else:
        print('1' + '0' * (n - 1))
    exit()
sc = [list(map(int, readline().split())) for i in range(m)]
sc.sort()
memo = sc[0]
if sc[0] == [1, 0] and n != 1:
    print(-1)
    exit()
for i in range(1, m):
    if memo[0] == sc[i][0]:
        if memo[1] != sc[i][1]:
            print(-1)
            exit()
    else:
        memo = sc[i]
ans = ''
for i in range(n):
    for j in range(m):
        if i + 1 == sc[j][0]:
            ans += str(sc[j][1])
            break
    if len(ans) != i + 1:
        if len(ans) == 0:
            ans += '1'
        else:
            ans += '0'
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n, m = map(int, readline().split())
if m == 0:
    if n == 1:
        print(0)
    else:
        print('1' + '0' * (n - 1))
sc = [list(map(int, readline().split())) for i in range(m)]
sc.sort()
memo = sc[0]
if sc[0] == [1, 0] and n != 1:
    print(-1)
    exit()
for i in range(1, m):
    if memo[0] == sc[i][0]:
        if memo[1] != sc[i][1]:
            print(-1)
            exit()
    else:
        memo = sc[i]
ans = ''
for i in range(n):
    for j in range(m):
        if i + 1 == sc[j][0]:
            ans += str(sc[j][1])
            break
    if len(ans) != i + 1:
        if len(ans) == 0:
            ans += '1'
        else:
            ans += '0'
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n, m = map(int, readline().split())
sc = [list(map(int, readline().split())) for i in range(m)]
sc.sort()
memo = sc[0]
if sc[0] == [1, 0] and n != 1:
    print(-1)
    exit()
for i in range(1, m):
    if memo[0] == sc[i][0]:
        if memo[1] != sc[i][1]:
            print(-1)
            exit()
    else:
        memo = sc[i]
ans = ''
for i in range(n):
    for j in range(m):
        if i + 1 == sc[j][0]:
            ans += str(sc[j][1])
            break
    if len(ans) != i + 1:
        if len(ans) == 0:
            ans += '1'
        else:
            ans += '0'
print(ans)
Problem p02814 (python)

Fixed submission:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

from fractions import gcd

n, m = map(int, readline().split())
a = list(map(int, readline().split()))
for i in range(n):
    a[i] //= 2
lcm_memo = 1
for i in range(n):
    lcm_memo *= a[i] // gcd(lcm_memo, a[i])
    if lcm_memo > m:
        print(0)
        exit()
for i in range(n):
    if (lcm_memo // a[i]) % 2 == 0:
        print(0)
        exit()
print(1 + (m - lcm_memo) // (lcm_memo * 2))

Buggy submission (verdict: Runtime Error):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

from math import gcd, floor

n, m = map(int, readline().split())
a = list(map(int, readline().split()))
cumsum = a[0]
for i in range(1, n):
    cumsum = gcd(cumsum, a[i])
for i in range(n):
    a[i] //= cumsum
lcm_memo = a[0]
for i in range(1, n):
    lcm_memo = lcm_memo * a[i] // gcd(lcm_memo, a[i])
print(floor(m / lcm_memo) - floor(m / (lcm_memo * 2)))
Problem p02845 (python)

Fixed submission:
import sys
input = sys.stdin.readline

n = int(input())
a = list(map(int, input().split()))
rbg = [-1, -1, -1]
ans = 1
mod = 10 ** 9 + 7

for A in a:
    ans *= rbg.count(A - 1)
    ans %= mod
    for i in range(3):
        if rbg[i] == A - 1:
            rbg[i] = A
            break

print(ans)

Buggy submission (verdict: Runtime Error):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n, *a = map(int, read().split())
ans = 1
mod = 10 ** 9 + 7
memo = [0, 0, 0]
for check in a:
    ans *= memo.count(check)
    ans %= mod
    memo[memo.index(check)] += 1
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

n = int(input())
a = list(map(int, input().split()))
rbg = [-1, -1, -1]
ans = 1
mod = 10 ** 9 + 7

for A in a:
    ans *= rbg.count(A - 1)
    ans %= mod
    rbg[rbg.index(A - 1)] = A

print(ans)
Problem p02850 (python)

Fixed submission:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n = int(readline())
ab = [list(map(int, readline().split())) for i in range(n - 1)]
gragh = [[] for j in range(n + 1)]
for a, b in ab:
    gragh[a].append(b)
    gragh[b].append(a)
root = 1
parent = [0] * (n + 1)
stack = [root]
order = []

while stack:
    x = stack.pop()
    order.append(x)
    for y in gragh[x]:
        if y == parent[x]:
            continue
        parent[y] = x
        stack.append(y)
color = [-1] * (n + 1)

for x in order:
    ng = color[x]
    cnt = 1
    for y in gragh[x]:
        if y == parent[x]:
            continue
        if cnt == ng:
            cnt += 1
        color[y] = cnt
        cnt += 1

ans = []
append = ans.append
for a, b in ab:
    if parent[a] == b:
        append(color[a])
    else:
        append(color[b])
print(max(ans))
print('\n'.join(map(str, ans)))

Buggy submission (verdict: Runtime Error):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

from math import floor

a, b, x = map(int, readline().split())
memo = floor(x / a) - 1
if memo >= 10 ** 9:
    print(10 ** 9)
    exit()
elif memo < 0:
    print(0)
    exit()
dg = len(str(memo))
for i in range(memo + 10 ** 5, 0, -1):
    if x - a * i >= b * dg:
        print(i)
        exit()
print(0)
Problem p02903 (python)

Fixed submission:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

h, w, a, b = map(int, readline().split())
ans_1 = '1' * a + '0' * (w - a)
ans_2 = '0' * a + '1' * (w - a)
for i in range(b):
    print(ans_1)
for i in range(h - b):
    print(ans_2)

Buggy submission (verdict: Runtime Error):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

h, w, a, b = map(int, readline().split())
x_cnt = [0] * h
y_cnt = [0] * w
ans = [''] * h
if h == 1:
    print('1' * a + '0' * (w - a))
elif w == 1:
    for i in range(b):
        print('1')
    for i in range(h - b):
        print('0')
else:
    for i in range(h):
        for j in range(w):
            print(ans)
            if y_cnt[j] < b and x_cnt[i] < a:
                y_cnt[j] += 1
                x_cnt[i] += 1
                ans[i] += '1'
            else:
                ans[i] += '0'
        if a != 0:
            if x_cnt[i] != a:
                print('No')
                exit()
    if b != 0:
        for i in range(w):
            if y_cnt[i] != b:
                print('No')
                exit()
    for i in range(h):
        print(ans[i])
Problem p02913 (python)

Fixed submission:
def Z_algo(S):
    n = len(S)
    LCP = [0] * n
    c = 0  # 最も末尾側までLCPを求めたインデックス
    for i in range(1, n):
        # i番目からのLCPが以前計算したcからのLCPに含まれている場合
        if i + LCP[i - c] < c + LCP[c]:
            LCP[i] = LCP[i - c]
        else:
            j = max(0, c + LCP[c] - i)
            while i + j < n and S[j] == S[i + j]:
                j += 1
            LCP[i] = j
            c = i
    LCP[0] = n
    return LCP


n = int(input())
s = input()
ans = 0
for i in range(n):
    lcp = Z_algo(s[i:])
    for j, p in enumerate(lcp):
        tmp = min(j, p)
        ans = max(ans, tmp)
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)


def Z_algo(S):
    LCP = [0] * n
    c = 0  # 最も末尾側までLCPを求めたインデックス
    for i in range(1, n):
        # i番目からのLCPが以前計算したcからのLCPに含まれている場合
        if i + LCP[i - c] < c + LCP[c]:
            LCP[i] = LCP[i - c]
        else:
            j = max(0, c + LCP[c] - i)
            while i + j < n and S[j] == S[i + j]:
                j += 1
            LCP[i] = j
            c = i
    LCP[0] = n
    return LCP


n = int(readline())
s = read().rstrip().decode()
ans = 0
for i in range(n):
    m = Z_algo(s[i:])[1:] + [0] * 1
    ans = max(ans, max(m[n // 2 - i:]))
print(ans)
Problem p02939 (python)

Fixed submission:
s = input()
memo = ''
len_s = len(s)
cnt = 0
ans = 0

for i in range(2 * 10 ** 5):
    ans += 1
    if memo == s[cnt]:
        if cnt == len_s - 1:
            ans -= 1
        memo = s[cnt:cnt + 2]
        cnt += 2
    else:
        memo = s[cnt]
        cnt += 1
    if cnt > len_s - 1:
        break

print(ans)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

n = int(input())
w = list(input().split())
ans = ['TAKAHASHIKUN', 'Takahashikun', 'takahashikun']
cnt = 0
w[n - 1] = w[n - 1].rstrip('.')
for i in range(n):
    if len(w[i]) == 12 and w[i] in ans:
        cnt += 1

print(cnt)
Problem p02963 (python)

Fixed submission:
import sys
import math
input = sys.stdin.readline

s = int(input())
if s == 10**18:
    print(0, 0, 0, 10**9, 10**9, 0)
    sys.exit()
t = math.floor(math.sqrt(s))
if t*(t+1) < s:
    x1 = t+1
    y2 = t+1
else:
    x1 = t
    y2 = t+1
x2 = 1
y1 = x1*y2 - s

print(0, 0, x1, y1, x2, y2)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
cheak = 10**18
match = 0

def make_divisors(n):
    divisors = []
    ans = 1
    i_box = []
    for i in range(1, int(n**0.5)+1):
        if n%i == 0:
            i_box.append(i)
            ans *= i
            if ans >= int(n**0.5):
                for i in range(len(i_box)):
                    for j in range(len(i_box)):
                        cheak = ans // i_box[j]
                        if cheak < 10**9 and n//cheak < 10**9:
                            match = 1
                            break
                        cheak = ans
                    if match == 1:
                        break
                divisors.append(cheak)
                divisors.append(n//cheak)
                break
    return divisors

s = int(input())
if s%2 == 0:
    s_1 = make_divisors(s)
    x_2 = 0
    y_1 = 0
else:
    s_1 = make_divisors(s+1)
    x_2 = 1
    y_1 = 1
x_1 = s_1[0]
y_2 = s_1[1]
x_3 = 0
y_3 = 0
print(str(x_1), str(y_1), str(x_2), str(y_2), str(x_3), str(y_3))

Buggy submission (verdict: Runtime Error):
import sys
import math
input = sys.stdin.readline

s = it(input())
x_1 = 2
y_2 = math.ceil(s/2)
if s%2 == 0:
    x_2 = 0
    y_1 = 0
else:
    x_2 = 1
    y_1 = 1
x_3 = 0
y_3 = 0
print(x_1, y_1, x_2, y_2, x_3, y_3)
Problem p03006 (python)

Fixed submission:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

from collections import defaultdict

n = int(readline())
xy = [tuple(map(int, readline().split())) for _ in range(n)]
dict = defaultdict(int)
dict[0] = 0
for i, check in enumerate(xy):
    for dxy in xy[i + 1:]:
        y, x = check[0], check[1]
        dy, dx = dxy[0], dxy[1]
        dict[(y - dy, x - dx)] += 1
        dict[(dy - y, dx - x)] += 1
print(n - max(dict.values()))

Buggy submission (verdict: Runtime Error):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

from collections import defaultdict

n = int(readline())
xy = [list(map(int, readline().split())) for _ in range(n)]
dict = defaultdict(int)
for i, check in enumerate(xy):
    for dxy in xy[i + 1:]:
        y, x = check[0], check[1]
        dy, dx = dxy[0], dxy[1]
        dict[(y - dy, x - dx)] += 1
print(n - max(dict.values()))
Problem p03007 (python)

Fixed submission:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

from bisect import bisect_right

n = int(readline())
a = list(map(int, readline().split()))
a.sort()
if a[0] <= 0 and a[-1] >= 0:
    print(sum(map(lambda x: abs(int(x)), a)))
    idx = bisect_right(a, 0)
    idx -= 1 if idx == n else 0
    x = a[0]
    y = a[idx]
    for aa in a[1:idx]:
        print(y, aa)
        y -= aa
    for aa in a[idx + 1:]:
        print(x, aa)
        x -= aa
    print(y, x)
else:
    if a[0] < 0:
        print(-sum(a) + 2 * a[-1])
        a = a[::-1]
    else:
        print(sum(a) - 2 * a[0])
    x = a[0]
    y = a[-1]
    for aa in a[1:-1]:
        print(x, aa)
        x -= aa
    if a[0] < 0:
        y, x = x, y
    print(y, x)

Buggy submission (verdict: Runtime Error):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

from bisect import bisect_right

n = int(readline())
a = list(map(int, readline().split()))
a.sort()
if a[0] <= 0 and a[-1] >= 0:
    print(sum(map(lambda x: abs(int(x)), a)))
    idx = bisect_right(a, 0)
    x = a[0]
    y = a[idx]
    for aa in a[1:idx]:
        print(y, aa)
        y -= aa
    for aa in a[idx + 1:]:
        print(x, aa)
        x -= aa
    print(y, x)
else:
    if a[0] < 0:
        print(-sum(a) + 2 * a[-1])
        a = a[::-1]
    else:
        print(sum(a) - 2 * a[0])
    x = a[0]
    y = a[-1]
    for aa in a[1:-1]:
        print(x, aa)
        x -= aa
    if a[0] < 0:
        y, x = x, y
    print(y, x)
Problem p03061 (python)

Fixed submission:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

from fractions import gcd

n, *a = map(int, read().split())
b = a[::-1]
cumsum_m = [0] * (n - 1)
cumsum_p = [0] * (n - 1)
cumsum_m[0] = b[0]
cumsum_p[0] = a[0]
for i in range(1, n - 1):
    cumsum_p[i] = gcd(cumsum_p[i - 1], a[i])
    cumsum_m[i] = gcd(cumsum_m[i - 1], b[i])
ans = max(cumsum_m.pop(), cumsum_p.pop())
for p, m in zip(cumsum_p, cumsum_m[::-1]):
    v = gcd(p, m)
    if ans < v:
        ans = v
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

from math import gcd

n = int(readline())
a = list(map(int, readline().split()))
b = a[::-1]
cumsum_m = [0] * (n - 1)
cumsum_p = [0] * (n - 1)
cumsum_m[0] = b[0]
cumsum_p[0] = a[0]
for i in range(1, n - 1):
    cumsum_p[i] = gcd(cumsum_p[i - 1], a[i])
    cumsum_m[i] = gcd(cumsum_m[i - 1], b[i])
ans = max(cumsum_m.pop(), cumsum_p.pop())
for p, m in zip(cumsum_p, cumsum_m[::-1]):
    v = gcd(p, m)
    if ans < v:
        ans = v
print(ans)

Buggy submission (verdict: Runtime Error):
import fraction
from functools import reduce

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

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

for i in range(n):
    max = gcd_list(a[-i])
    if max > ans:
        ans = max
        
print(ans)

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce

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

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

for i in range(n):
    max = gcd_list(a[-i])
    if max > ans:
        ans = max
        
print(ans)
Problem p03068 (python)

Fixed submission:
N = int(input())
S = input()
K = int(input()) - 1
s = S[K]
ans = ''

for i in S:
    if i == s:
        ans += i
    else:
        ans += '*'

print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()
K = int(input())

ans = ''
for i in S:
    if i == S[K]:
        ans += i
    else:
        ans += '*'

print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()
K = int(input())

ans = ''
for i in S:
    if i == S[K]
        ans += i
    else:
        ans += '*'

print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()
K = int(input())

s = str(S[K])
ans = ''
for i in range(N):
    if (S[i] in s) == 'True':
        ans += s
    else:
        ans += '*'

print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()
K = int(input())

s = S[K]
for i in range(N):
    if (S[i] in s) == 'True':
        pass
    else:
        S[i].replace(s,'*')

print(S)
Problem p03076 (python)

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

for x in a:
    if x % 10 != 0:
        t = 10 - x % 10
    else:
        t = 0
        
    ans += x + t
    n = max(n, t)
    
print(ans - n)

Buggy submission (verdict: Runtime Error):
a = [int(input()) for i in range(5)]
n = 0
ans = 0

for x in a:
    if x % 10 != 0:
        t = 10 - x % 10
    else:
        t = 0
        
    res += x + t
    n = max(n, t)
    
print(ans - n)
Problem p03079 (python)

Fixed submission:
A,B,C= input().split()

if (A==B) and (B==C):
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
A,B,C= input().split()

if (A==B) and (B==C):
    print(‘Yes’)
else:
    print(‘No’)
Problem p03085 (python)

Fixed submission:
b = input()

if b.find('A') == 0:
    ac = b.replace('A','T')
elif b.find('T') == 0:
    ac = b.replace('T','A')
elif b.find('G') == 0:
    ac = b.replace('G','C')
elif b.find('C') == 0:
    ac = b.replace('C','G')

print(ac)

Buggy submission (verdict: Runtime Error):
b= input()

if b=='A':
  b='T'
elif b=='T':
  b='A'
elif b=='G':
  b='C':
elif b=='C':
  b='G'
print(b)
Problem p03086 (python)

Fixed submission:
S = input()
n = 0
atgc = [0] * len(S)

for i in S:
    if ('A' in i) or ('C' in i) or ('G' in i) or ('T' in i):
        atgc[n] += 1
    else:
        n += 1
        
ans = max(atgc)
print(ans)

Buggy submission (verdict: Runtime Error):
s = input()
ans = []
cnt = 0

for i in range(len(s)):
    for j in range(2, len(s) + 1):
        memo = s[i:j]
        for k in range(len(memo)):
            if memo[k] == 'A' or memo[k] == 'C' or memo[k] == 'T' or memo[k] == 'G':
                cnt += 1
            else:
                break

        ans.append(cnt)
        cnt = 0

print(max(ans))
Problem p03087 (python)

Fixed submission:
import sys
input = sys.stdin.readline

n, q = map(int, input().split())
s = input()
memo = [0] * n
cnt = 0

for i in range(1, n):
    if s[i - 1] == 'A' and s[i] == 'C':
        cnt += 1
    memo[i] = cnt

for i in range(q):
    l, r = map(int, input().split())
    print(memo[r - 1] - memo[l - 1])

Buggy submission (verdict: Runtime Error):
def counts(s, l, r):
    ans = s[l-1:r].count('AC')
    print(ans)

n, q = map(int, input().split())
s = input()
for i in xrange(q):
    l, r = map(int, input().split())
    counts(s, l, r)