Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
123456789012 123456789012

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

# 2進数のn桁目の0からxまでの和が偶数か奇数かを返す
def even_odd(x, n):
    if n == 1:
        if x % 4 == 1 or x % 4 == 2:
            return 1
        else:
            return 0

    num = (x % (2 ** n)) - 2 ** (n - 1)
    if num < 0:
        return 0
    elif num % 2 == 0:
        return 1
    else:
        return 0

# 10 ** 12 => 2 ** 40
s = 0
for i in range(1, 41):
    if (even_odd(B, i) + even_odd(A-1, i)) % 2 == 1:
        s += 2 ** (i - 1)
print(s)
Buggy python submission (verdict: Runtime Error):
n = int(input())
v = list(map(int, input().split()))

even_dict = {}
odd_dict = {}
for i, value in enumerate(v):
    if i % 2:
        even_dict[value] = 1 if value not in even_dict else even_dict[value] + 1
    else:
        odd_dict[value] = 1 if value not in odd_dict else odd_dict[value] + 1

counter = 0
even = sorted(even_dict.items(), key=lambda x: x[1], reverse=True)
odd = sorted(odd_dict.items(), key=lambda x: x[1], reverse=True)

if even[0][0] == odd[0][0]:
    if even[0][1] - even[1][1] > odd[0][1] - odd[1][1]:
        counter += sum([x[1] for x in even[1:]])
        counter += sum([x[1] for x in odd[2:] + [odd[0]]])
    else:
        counter += sum([x[1] for x in odd[1:]])
        counter += sum([x[1] for x in even[2:] + [even[0]]])
else:
    counter += sum([x[1] for x in even[1:]])
    counter += sum([x[1] for x in odd[1:]])

print(counter)

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

even_dict = {}
odd_dict = {}
for i, value in enumerate(v):
    if i % 2:
        even_dict[value] = 1 if value not in even_dict else even_dict[value] + 1
    else:
        odd_dict[value] = 1 if value not in odd_dict else odd_dict[value] + 1

counter = 0
even = sorted(even_dict.items(), key=lambda x: x[1], reverse=True)
odd = sorted(odd_dict.items(), key=lambda x: x[1], reverse=True)

if even[0][0] == odd[0][0]:
    even_second = 0 if len(even) < 2 else even[1][1]
    odd_second = 0 if len(odd) < 2 else odd[1][1]
    if even[0][1] - even_second > odd[0][1] - odd_second:
        counter += sum([x[1] for x in even[1:]])
        counter += sum([x[1] for x in odd[2:] + [odd[0]]])
    else:
        counter += sum([x[1] for x in odd[1:]])
        counter += sum([x[1] for x in even[2:] + [even[0]]])
else:
    counter += sum([x[1] for x in even[1:]])
    counter += sum([x[1] for x in odd[1:]])

print(counter)
Buggy python submission (verdict: Runtime Error):
S = input()
K = int(input())

if S[0] == '1':
    print(S[1])
else:
    print(S[0])

Fixed submission:
S = input()
K = int(input())

if S[0] == '1':
    counter = 1
    for s in S:
        if s != '1' or counter >= K:
            print(s)
            break
        counter += 1 
else:
    print(S[0])
Buggy python submission (verdict: Runtime Error):
import math
N = int(input())
a = list(map(int, input().split()))

# mはaの(最小公倍数 - 1)
lcm = a[0]
for item in a[1:]:
    lcm = (lcm * item) // math.gcd(lcm, item)
f = 0
for item in a:
    f += (lcm - 1) % item
print(f)

Fixed submission:
import fractions
N = int(input())
a = list(map(int, input().split()))

lcm = a[0]
for item in a[1:]:
    lcm = (lcm * item) // fractions.gcd(lcm, item)
f = 0
for item in a:
    f += (lcm - 1) % item
print(f)
Buggy python submission (verdict: Runtime Error):
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long ll;

const double PI = acos(-1);

int main() {
  int a, b, h, m;
  cin >> a >> b >> h >> m;
  double th = double(h * 60 + m) / 720 * 2 * PI;
  double tm = double(m) / 60 * 2 * PI;
  double xh = a * cos(th), yh = a * sin(th);
  double xm = b * cos(tm), ym = b * sin(tm);
  // 2乗するので絶対値を取る必要はない
  double dx = xh - xm, dy = yh - ym;
  double ans = sqrt(dx * dx + dy * dy);
  printf("%.10f\n", ans);
  return 0;
}


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

rad = math.pi * 2 * (h/12.0 + m/60.0 / 12.0 - m/60.0)
ans = math.sqrt(a**2 + b**2 - 2*a*b*math.cos(rad))
print(ans)
Buggy python submission (verdict: Runtime Error):
6 727202214173249351
6 5 2 5 3 2
n, k = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
s = []
o = [-1] * (n + 1)  # ord 訪れた箇所, v が1スタートなので注意
c, l = 1, 0  # 周期, 例外

v = 1
while o[v] == -1:
    o[v] = len(s)
    s.append(v)
    v = a[v-1]
c = len(s) - o[v]
l = o[v]

if k < l:
    print(s[k])
else:
    k -= l
    k %= c
    print(s[l + k])


Fixed submission:
n, k = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
s = []
o = [-1] * (n + 1)  # ord 訪れた箇所, v が1スタートなので注意
c, l = 1, 0  # 周期, 例外

v = 1
while o[v] == -1:
    o[v] = len(s)
    s.append(v)
    v = a[v-1]
c = len(s) - o[v]
l = o[v]

if k < l:
    print(s[k])
else:
    k -= l
    k %= c
    print(s[l + k])
Buggy python submission (verdict: Time Limit Exceeded):
S = input()
l = len(S)
ans = 0
for i in range(l - 4):
    for j in range(4, l - i + 1):
        x = int(S[i:i + j])
        if x % 2019 == 0:
            ans += 1
print(ans)


Fixed submission:
from collections import Counter

S = input()
mods = [0]
num, ten = 0, 1
for n in S[::-1]:
    num += int(n) * ten
    num %= 2019
    mods.append(num)
    ten *= 10
    ten %= 2019

c = Counter(mods)
ans = 0
for v in c.values():
    ans += v * (v - 1) // 2
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
S = input()
ans = 0
for i in range(len(S) - 4):
    for j in range(4, len(S) - i + 1):
        x = int(S[i:i + j])
        if x < 2019:
            continue

        if x % 2019 == 0:
            ans += 1
print(ans)


Fixed submission:
from collections import Counter

S = input()
mods = [0]
num, ten = 0, 1
for n in S[::-1]:
    num += int(n) * ten
    num %= 2019
    mods.append(num)
    ten *= 10
    ten %= 2019

c = Counter(mods)
ans = 0
for v in c.values():
    ans += v * (v - 1) // 2
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(i)for i in input().split()]
for i in range(1, n + 1):
    print(a.count(i))


Fixed submission:
from collections import Counter
n = int(input())
a = [int(i)for i in input().split()]
c = Counter(a)
ans = [0] * n
for i in range(1, 1 + n):
    print(c[i])
Buggy python submission (verdict: Runtime Error):
n, a, b = [int(i) for i in input().split()]
if a == 0:
    print(0)
else:
    x = (n // (a + b)) + 1
    balls = []
    for i in range(x):
        balls += list("b" * a) + list("r" * b)
    ans = 0
    for i in range(n):
        if balls[i] == "b":
            ans += 1
    print(ans)


Fixed submission:
n, a, b = [int(i) for i in input().split()]
ans = (n // (a + b)) * a
rem = n % (a + b)
ans += min(rem, a)
print(ans)

Buggy python submission (verdict: Runtime Error):
n, a, b = [int(i) for i in input().split()]
if a == 0:
    print(0)
else:
    x = (n // (a + b)) + 1
    balls = []
    for i in range(x):
        balls += list("b" * a) + list("r" * b)
    ans = 0
    for i in range(n):
        if balls[i] == "b":
            ans += 1
    print(ans)


Fixed submission:
n, a, b = [int(i) for i in input().split()]
ans = (n // (a + b)) * a
rem = n % (a + b)
ans += min(rem, a)
print(ans)

Buggy python submission (verdict: Runtime Error):
n, a, b = [int(i) for i in input().split()]
if a == 0:
    print(0)
else:
    x = (n // (a + b)) + 1
    balls = [*["b"] * a, *["r"] * b] * x
    ans = 0
    for i in range(n):
        if balls[i] == "b":
            ans += 1
    print(ans)


Fixed submission:
n, a, b = [int(i) for i in input().split()]
ans = (n // (a + b)) * a
rem = n % (a + b)
ans += min(rem, a)
print(ans)

Buggy python submission (verdict: Runtime Error):
n, a, b = [int(i) for i in input().split()]
if a == 0:
    print(0)
else:
    x = (n // (a + b)) + 1
    balls = [*["b"] * a, *["r"] * b] * x
    ans = 0
    for i in range(n):
        if balls[i] == "b":
            ans += 1
    print(ans)


Fixed submission:
n, a, b = [int(i) for i in input().split()]
ans = (n // (a + b)) * a
rem = n % (a + b)
ans += min(rem, a)
print(ans)

Buggy python submission (verdict: Runtime Error):
n, a, b = [int(i) for i in input().split()]
if a == 0:
    print(0)
else:
    x = (n // (a + b)) + 1
    balls = [*["b"] * a, *["r"] * b] * x
    ans = 0
    for i in range(n):
        if balls[i] == "b":
            ans += 1
    print(ans)


Fixed submission:
n, a, b = [int(i) for i in input().split()]
ans = (n // (a + b)) * a
rem = n % (a + b)
ans += min(rem, a)
print(ans)

Buggy python submission (verdict: Runtime Error):
n, a, b = [int(i) for i in input().split()]
x = (n // (a + b)) + 1
balls = [*["b"] * a, *["r"] * b] * x
ans = 0
for i in range(n):
    if balls[i] == "b":
        ans += 1
print(ans)


Fixed submission:
n, a, b = [int(i) for i in input().split()]
ans = (n // (a + b)) * a
rem = n % (a + b)
ans += min(rem, a)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
q = int(input())
ans = s
for i in range(q):
    t = input().split()
    if t[0] == "1":
        ans = ans[::-1]
    elif t[0] == "2":
        _, f, c = t
        if f == "1":
            ans = c + ans
        elif f == "2":
            ans += c
print(ans)


Fixed submission:
from collections import deque

s = input()
q = int(input())
r = 1
top = deque()
top.append(s)
for _ in range(q):
    inp = input()
    if inp[0] == "1":
        r *= -1
    else:
        _, f, c = inp.split()
        if f == "1" and r == -1 or f == "2" and r == 1:
            top.append(c)
        else:
            top.appendleft(c)
ans = "".join(top)
print(ans if r == 1 else ans[::-1])

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
q = int(input())
ans = s
for i in range(q):
    t = input().split()
    if t[0] == "1":
        ans = ans[::-1]
    elif t[0] == "2":
        _, f, c = t
        if f == "1":
            ans = c + ans
        elif f == "2":
            ans += c
print(ans)


Fixed submission:
from collections import deque

s = input()
q = int(input())
r = 1
top = deque()
top.append(s)
for _ in range(q):
    inp = input()
    if inp[0] == "1":
        r *= -1
    else:
        _, f, c = inp.split()
        if f == "1" and r == -1 or f == "2" and r == 1:
            top.append(c)
        else:
            top.appendleft(c)
ans = "".join(top)
print(ans if r == 1 else ans[::-1])
Buggy python submission (verdict: Time Limit Exceeded):
from itertools import combinations

n, k = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
products = []
for i in combinations(a, 2):
    products.append(i[0] * i[1])
print(sorted(products)[k - 1])


Fixed submission:
import numpy as np

n, k = [int(i) for i in input().split()]
a = np.array(sorted([int(i) for i in input().split()]))
posi = a[a > 0]
zero = a[a == 0]
nega = a[a < 0]

# 2分探索, mid より小さいものを数える
l = -10 ** 18 - 1
r = 10 ** 18 + 1
while r - l > 1:
    mid = (r + l) // 2
    cnt = 0
    if mid >= 0:
        cnt += len(zero) * n

    cnt += a.searchsorted(mid // posi, side="right").sum()
    cnt += (n - a.searchsorted(-(-mid // nega), side="left")).sum()
    cnt -= np.count_nonzero(a * a <= mid)
    cnt //= 2
    if cnt >= k:
        r = mid
    else:
        l = mid
print(r)

Buggy python submission (verdict: Runtime Error):
n, k = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
b = []
for i in range(n):
    for j in range(i + 1, n):
        print(a[i], a[j])
        b.append(a[i] * a[j])
ans = list(sorted(b))
print(ans[k])


Fixed submission:
import numpy as np

n, k = [int(i) for i in input().split()]
a = np.array(sorted([int(i) for i in input().split()]))
posi = a[a > 0]
zero = a[a == 0]
nega = a[a < 0]

# 2分探索, mid より小さいものを数える
l = -10 ** 18 - 1
r = 10 ** 18 + 1
while r - l > 1:
    mid = (r + l) // 2
    cnt = 0
    if mid >= 0:
        cnt += len(zero) * n

    cnt += a.searchsorted(mid // posi, side="right").sum()
    cnt += (n - a.searchsorted(-(-mid // nega), side="left")).sum()
    cnt -= np.count_nonzero(a * a <= mid)
    cnt //= 2
    if cnt >= k:
        r = mid
    else:
        l = mid
print(r)
Buggy python submission (verdict: Time Limit Exceeded):
def f(i):
    return (i + 1) / 2


n, k = [int(i) for i in input().split()]
p = [f(int(i)) for i in input().split()]
ans = sum(p[0:k])
for i in range(1, n - 2):
    ans = max(ans, sum(p[i : i + k]))
print(ans)


Fixed submission:
def f(x):
    return (x + 1) / 2


n, k = [int(i) for i in input().split()]
p = [f(int(i)) for i in input().split()]
ans = sum(p[:k])
a = ans
for i in range(k, n):
    a = a + p[i] - p[i - k]
    ans = max(ans, a)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
def f(i):
    return sum(range(1, i + 1)) / i


n, k = [int(i) for i in input().split()]
p = [f(int(i)) for i in input().split()]
ans = sum(p[0:k])
for i in range(1, n - 2):
    ans = max(ans, sum(p[i : i + k]))
print(ans)


Fixed submission:
def f(x):
    return (x + 1) / 2


n, k = [int(i) for i in input().split()]
p = [f(int(i)) for i in input().split()]
ans = sum(p[:k])
a = ans
for i in range(k, n):
    a = a + p[i] - p[i - k]
    ans = max(ans, a)
print(ans)
Buggy python submission (verdict: Runtime Error):
N, M = [int(i) for i in input().split()]
l = max(N, M)
WA, AC = [0] * l, [False] * l
wa, ac = 0, 0
for i in range(M):
    inp = input().split()
    P, S = int(inp[0]), inp[1]
    if not AC[P] and S == "AC":
        AC[P] = True
        ac += 1
        wa += WA[P]
    elif S == "WA":
        WA[P] += 1
print(ac, wa)


Fixed submission:
N, M = [int(i) for i in input().split()]

ac, wa = 0, 0
hist_ac, hist_wa = [0] * N, [0] * N
for i in range(M):
    p, s = input().split()
    p = int(p) - 1
    if hist_ac[p] == 0:
        if s == "AC":
            hist_ac[p] = 1
            ac += 1
            wa += hist_wa[p]
        else:
            hist_wa[p] += 1
print(ac, wa)

Buggy python submission (verdict: Runtime Error):
N, M = [int(i) for i in input().split()]
WA, AC = [0] * M, [False] * M
wa, ac = 0, 0
for i in range(M):
    inp = input().split()
    P, S = int(inp[0]), inp[1]
    if S == "AC":
        AC[P] = True
        ac += 1
        wa += WA[P]
    elif S == "WA":
        WA[P] += 1
print(ac, wa)


Fixed submission:
N, M = [int(i) for i in input().split()]

ac, wa = 0, 0
hist_ac, hist_wa = [0] * N, [0] * N
for i in range(M):
    p, s = input().split()
    p = int(p) - 1
    if hist_ac[p] == 0:
        if s == "AC":
            hist_ac[p] = 1
            ac += 1
            wa += hist_wa[p]
        else:
            hist_wa[p] += 1
print(ac, wa)
Buggy python submission (verdict: Runtime Error):
import math


def f(x):
    res = 0
    while x % 2 == 0:
        x /= 2
        res += 1
    return res


def lcm(a, b):
    return a * b // math.gcd(a, b)


N, M = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]


# a -> a'
for i in range(N):
    A[i] = A[i] // 2

# a' -> a''
t = f(A[0])
for i in range(N):
    if f(A[i]) != t:
        print(0)
        exit()
    A[i] >>= t  # A[i] /= 2^t
M >>= t

L = 1
for i in range(N):
    L = lcm(L, A[i])
    if L > M:
        print(0)
        exit()

M /= L
ans = math.ceil(M / 2)
print(ans)


Fixed submission:
from fractions import gcd
from functools import reduce

N, M = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]

A = [i >> 1 for i in A]


def applied_lcm(x, y):
    g = gcd(x, y)
    x //= g
    y //= g
    if x % 2 == 0 or y % 2 == 0:
        return 0
    n = x * y * g
    if n >> 10 ** 9:
        return 0

    return n


p = reduce(applied_lcm, A)
if p == 0:
    ans = 0
else:
    ans = (M // p) - (M // (p + p))
print(ans)

Buggy python submission (verdict: Runtime Error):
def ans(s, set_arr):
    if len(set_arr) == 1:
        return s.intersection(set_arr[0])
    return ans(s, set_arr[1:])


N, M = [int(i) for i in input().split()]
A = list(set([int(i) for i in input().split()]))
set_list = list()
for a in A:
    s = set()
    a_max = M // a
    for i in range(1, a_max):
        x = int(a * (i + 0.5))
        s.add(a * (i + 0.5))
    set_list.append(s)
print(len(ans(set_list[0], set_list[1:])))


Fixed submission:
from fractions import gcd
from functools import reduce

N, M = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]

A = [i >> 1 for i in A]


def applied_lcm(x, y):
    g = gcd(x, y)
    x //= g
    y //= g
    if x % 2 == 0 or y % 2 == 0:
        return 0
    n = x * y * g
    if n >> 10 ** 9:
        return 0

    return n


p = reduce(applied_lcm, A)
if p == 0:
    ans = 0
else:
    ans = (M // p) - (M // (p + p))
print(ans)
Buggy python submission (verdict: Runtime Error):
a = A - 1
b = N - B
if a == b:
    print(a)
else:
    ans = (a if a < b else b) + 1
    print(ans)


Fixed submission:
def is_even(num):
    return num % 2 == 0


N, A, B = [int(i) for i in input().split()]
#  N, A, B = [5, 2, 4]
#  N, A, B = [5, 2, 3]
#  N, A, B = [10, 2, 3]
#  N, A, B = [10, 7, 8]
#  N, A, B = [5, 2, 5]
#  N, A, B = [10, 2, 8]
#  N, A, B = [2, 1, 2]
#  N, A, B = [2, 1, 1]
is_even_a = is_even(A)
is_even_b = is_even(B)
if (is_even_a == True and is_even_b == True) or (
    is_even_a == False and is_even_b == False
):
    print((B - A) // 2)
else:
    print(min(A - 1, N - B) + 1 + ((B - A - 1) // 2))
Buggy python submission (verdict: Runtime Error):
def judge(bit, n, v):
    # i 人目の証言を検証する
    for i in range(n):
        # 1人目が「不親切」だったら証言はすべて無視
        if not (bit & (1 << i)):
            continue

        x, y = v[i]
        # y == 1 なのに「不親切」だったらダメ
        if y == 1 and not (bit & (1 << x)):
            return False

        # y == 0 なのに「正直者」だったらダメ
        if y == 0 and (bit & (1 << x)):
            return False
    return True


n = int(input())
v = []
for i in range(n):
    for j in range(int(input())):
        x, y = [int(i) for i in input().split()]
        x -= 1
        v.append((x, y))

ans = 0
for bit in range(1 << n):
    if not judge(bit, n, v):
        continue

    # bit に含まれる人数を数える
    cnt = 0
    for i in range(n):
        if bit & (1 << i):
            cnt += 1
    ans = max(ans, cnt)
print(ans)


Fixed submission:
def judge(bit, n, v):
    # i 人目の証言を検証する
    for i in range(n):
        # 1人目が「不親切」だったら証言はすべて無視
        if not (bit & (1 << i)):
            continue

        for x, y in v[i]:
            # y == 1 なのに「不親切」だったらダメ
            if y == 1 and not (bit & (1 << x)):
                return False

            # y == 0 なのに「正直者」だったらダメ
            if y == 0 and (bit & (1 << x)):
                return False
    return True


n = int(input())
v = [[] for _ in range(n)]
for i in range(n):
    for j in range(int(input())):
        x, y = [int(i) for i in input().split()]
        v[i].append((x - 1, y))

ans = 0
for bit in range(1 << n):
    if not judge(bit, n, v):
        continue

    # bit に含まれる人数を数える
    cnt = 0
    for i in range(n):
        if bit & (1 << i):
            cnt += 1
    ans = max(ans, cnt)
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = int(input())
if N % 2 != 0:
    print("No")
else:
    arr = list(S)
    s_len = len(arr) // 2
    if arr[s_len:] == arr[:s_len]:
        print("Yes")
    else:
        print("No")


Fixed submission:
N = int(input())
S = input()
if N % 2 != 0:
    print("No")
else:
    arr = list(S)
    s_len = len(arr) // 2
    if arr[s_len:] == arr[:s_len]:
        print("Yes")
    else:
        print("No")
Buggy python submission (verdict: Runtime Error):
import math

N = int(input())
xy_list = [0] * N
for i in range(N):
    xy_list.append(input().split())
result = 0
for i in range(N):
    for j in range(N):
        if i == j:
            continue
        city1 = math.pow(xy_list[i][0] - xy_list[j][0], 2)
        city2 = math.pow(xy_list[i][1] - xy_list[j][1], 2)
        result += math.sqrt(city1 + city2)
print("{:.10f}".format(result / N))


Fixed submission:
import math

N = int(input())
xy_list = []
for i in range(N):
    xy_list.append([int(i) for i in input().split()])
result = 0
for i in range(N):
    for j in range(N):
        if i == j:
            continue
        city1 = math.pow(xy_list[i][0] - xy_list[j][0], 2)
        city2 = math.pow(xy_list[i][1] - xy_list[j][1], 2)
        result += math.sqrt(city1 + city2)
print("{:.10f}".format(result / N))

Buggy python submission (verdict: Runtime Error):
import math

N = int(input())
xy_list = [0] * N
for i in range(N):
    xy_list.append(input().split())
result = 0
for i in range(N):
    for j in range(N):
        if i == j:
            continue
        city1 = math.pow(xy_list[i][0] - xy_list[j][0], 2)
        city2 = math.pow(xy_list[i][1] - xy_list[j][1], 2)
        result += math.sqrt(city1 + city2)
print(result / N)


Fixed submission:
import math

N = int(input())
xy_list = []
for i in range(N):
    xy_list.append([int(i) for i in input().split()])
result = 0
for i in range(N):
    for j in range(N):
        if i == j:
            continue
        city1 = math.pow(xy_list[i][0] - xy_list[j][0], 2)
        city2 = math.pow(xy_list[i][1] - xy_list[j][1], 2)
        result += math.sqrt(city1 + city2)
print("{:.10f}".format(result / N))
Buggy python submission (verdict: Runtime Error):
N = int(input())
ret = []
for i in range(1, N):
    for j in range(i, N):
        if i * j == N:
            ret.append(i + j - 2)
print(min(ret))


Fixed submission:
from math import sqrt

N = int(input())

for i in range(int(sqrt(N) + 1), -1, -1):
    if N % i == 0:
        print((i - 1) + (N // i - 1))
        break
Buggy python submission (verdict: Runtime Error):
A, B = [int(i) for i in input().split())]
ret = A - B*2
print(ret if ret > 0 else 0)


Fixed submission:
A, B = [int(i) for i in input().split()]
ret = A - B*2
print(ret if ret > 0 else 0)
Buggy python submission (verdict: Runtime Error):
N = int(input())
nums = filter(lambda x: x % 2 != 0, range(1, N + 1))
print(len(nums) / float(N))


Fixed submission:
N = int(input())
odds = list(filter(lambda x: x % 2 != 0, range(1, N + 1)))
print("{:.10f}".format(len(odds) / float(N)))
Buggy python submission (verdict: Time Limit Exceeded):
def update_points(points, current_ansewr):
    return list(
        map(
            lambda x: x[1] if (x[0] + 1) == current_ansewr else x[1] - 1,
            enumerate(points),
        )
    )


N, K, Q = [int(i) for i in input().split()]
points = [K] * N
for _ in range(Q):
    answer = int(input())
    points = update_points(points, answer)
for p in points:
    print("Yes" if p > 0 else "No")


Fixed submission:
N, K, Q = [int(i) for i in input().split()]
points = [(K - Q)] * N
for _ in range(Q):
    answer = int(input())
    points[answer - 1] += 1
for p in points:
    print("Yes" if p > 0 else "No")
Buggy python submission (verdict: Runtime Error):
N = int(input())
B = [int(i) for i in input().split()][::-1]
#  N = 6
#  B = [0, 153, 10, 10, 23]
#  N = 3
#  B = [2, 5]
ans = 0
ans += B[1]  # A[1]
for i in range(0, N - 1):
    ans += min(B[i - 1], B[i])
print(ans)


Fixed submission:
N = int(input())
B = [int(i) for i in input().split()][::-1]
ret = B[0] + B[N - 2]
for i in range(1, N - 1):
    ret += min(B[i - 1], B[i])
print(ret)
Buggy python submission (verdict: Runtime Error):
N = int(input())
H = [(int) i for i in input().split()]
moves = []
for i in range(N - 1):
    move = 0
    for j in range(i, N - 1):
        if H[j] >= H[j + 1]:
            move += 1
        else:
            break
    moves.append(move)


Fixed submission:
N = int(input())
H = [int(i) for i in input().split()]
ans, prev, cnt = 0, 0, 0
for h in H:
    if h <= prev:
        cnt += 1
    else:
        ans = max(ans, cnt)
        cnt = 0
    prev = h
print(max(ans, cnt))
Buggy python submission (verdict: Runtime Error):
K, X = [int(i) for i in input().split()]
ans = " ".join([str(i) for i in list(range(X - l, X + l + 1))])
print(ans)


Fixed submission:
K, X = [int(i) for i in input().split()]
l = K - 1
ans = " ".join([str(i) for i in list(range(X - l, X + l + 1))])
print(ans)
Buggy python submission (verdict: Runtime Error):
N = [int(i) for i in input().split()]
S = []
d = {}
for i in range(N):
    S.append(input())
for s in S:
    new_s = "".join((sorted(s)))
    if new_s in d:
        d[new_s] += d[new_s]
    else:
        d[new_s] = 1
print(max(d.values()))


Fixed submission:
N = int(input())
S = [input() for _ in range(N)]
d = {}
ans = 0
for s in S:
    ss = "".join(sorted(s))
    if ss in d:
        d[ss] += 1
        ans += d[ss]
    else:
        d[ss] = 0
print(ans)