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

Fixed submission:
from math import ceil
H, A = list(map(int, input().split()))
print(ceil(H/A))

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
import sys


def solve(N: int, K: int, H: "List[int]"):
    if K >= N:
        return 0
    return sum(sorted(H, reverse=True)[K:])


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    H = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    print(solve(N, K, H))

if __name__ == '__main__':
    main()
Problem p02802 (python)

Fixed submission:
#!/usr/bin/env python3
import sys


def solve(N: int, M: int, p: "List[int]", S: "List[str]"):
    from collections import defaultdict
    ac = set()
    wcc = defaultdict(int)
    for pp, ss in zip(p, S):
        if pp in ac:
            continue
        if ss == 'WA':
            wcc[pp] += 1
        else:
            ac.add(pp)
    print(len(ac), sum((c for p, c in wcc.items() if p in ac), 0))


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    p = [int()] * (M)  # type: "List[int]"
    S = [str()] * (M)  # type: "List[str]"
    for i in range(M):
        p[i] = int(next(tokens))
        S[i] = next(tokens)
    solve(N, M, p, S)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
import sys


def solve(N: int, M: int, p: "List[int]", S: "List[str]"):
    from collections import defaultdict
    ac = set()
    wcc = defaultdict(int)
    for pp, ss in zip(p, S):
        if pp in ac:
            continue
        if ss == 'WA':
            wcc[pp] += 1
        else:
            ac.add(pp)
    print(len(ac), sum((c for p, c in wcc.items() if p in ac), 0))


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    p = [int()] * (M)  # type: "List[int]"
    S = [str()] * (M)  # type: "List[str]"
    for i in range(M):
        p[i] = int(next(tokens))
        S[i] = next(tokens)
    solve(N, M, p, S)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
import sys


def solve(N: int, M: int, p: "List[int]", S: "List[str]"):
    ac = set()
    wcc = 0
    for pp, ss in zip(p, S):
        if pp in ac:
            continue
        if ss == 'WA':
            wcc += 1
        else:
            ac.add(pp)
    print(len(ac), wcc)


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    p = [int()] * (M)  # type: "List[int]"
    S = [str()] * (M)  # type: "List[str]"
    for i in range(M):
        p[i] = int(next(tokens))
        S[i] = next(tokens)
    solve(N, M, p, S)

if __name__ == '__main__':
    main()
Problem p02845 (python)

Fixed submission:
#!/usr/bin/env python3
import sys

MOD = 1000000007  # type: int


def solve(N: int, A: "List[int]"):
    from functools import reduce
    xyz_list = [[0]*3]
    for a in A:
        xyz_list.append(xyz_list[-1][:])
        for i, v in enumerate(xyz_list[-1]):
            if v == a:
                xyz_list[-1][i] += 1
                break
    T = [xyz.count(a) for xyz, a in zip(xyz_list, A)]
    return reduce(lambda a,b: a*b%MOD, T)

# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    print(solve(N, A))

def test():
    import doctest
    doctest.testmod()

if __name__ == '__main__':
    #test()
    main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
import sys

MOD = 1000000007  # type: int


def solve(N: int, A: "List[int]"):
    from functools import reduce
    xyz_list = [[0]*3]
    for a in A:
        xyz_list.append(xyz_list[-1][:])
        xyz_list[-1][xyz_list[-1].index(a)] += 1
    T = [xyz.count(a) for xyz, a in zip(xyz_list, A)]
    return reduce(lambda a,b: a*b%MOD, T)

# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    print(solve(N, A))

def test():
    import doctest
    doctest.testmod()

if __name__ == '__main__':
    #test()
    main()
Problem p02850 (python)

Fixed submission:
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(200_000)

def solve(N: int, a: "List[int]", b: "List[int]"):
    from itertools import count
    edges = [[] for _ in range(N)]
    for i, (aa, bb) in enumerate(zip(a, b)):
        edges[aa-1].append((bb-1, i))
        edges[bb-1].append((aa-1, i))
    ans = [None] * (N-1)
    visited = set()
    def dfs(n, c):
        if n in visited:
            return
        visited.add(n)
        for (nn, i), cc in zip(filter(lambda x: x[0] not in visited, edges[n]),
                          filter(lambda y: y != c, count(1))):
            ans[i] = cc
            dfs(nn, cc)
    dfs(0, None)
    return [max(ans)] + ans

# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    a = [int()] * (N - 1)  # type: "List[int]"
    b = [int()] * (N - 1)  # type: "List[int]"
    for i in range(N - 1):
        a[i] = int(next(tokens))
        b[i] = int(next(tokens))
    print(*solve(N, a, b), sep="\n")

def test():
    import doctest
    doctest.testmod()

if __name__ == '__main__':
    #test()
    main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
import sys


def solve(N: int, a: "List[int]", b: "List[int]"):
    from itertools import count
    edges = [[] for _ in range(N)]
    for i, (aa, bb) in enumerate(zip(a, b)):
        edges[aa-1].append((bb-1, i))
        edges[bb-1].append((aa-1, i))
    ans = [None] * (N-1)
    visited = set()
    def dfs(n, c):
        if n in visited:
            return
        visited.add(n)
        for (nn, i), cc in zip(filter(lambda x: x[0] not in visited, edges[n]),
                          filter(lambda y: y != c, count(1))):
            ans[i] = cc
            dfs(nn, cc)
    dfs(0, None)
    return [max(ans)] + ans

# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    a = [int()] * (N - 1)  # type: "List[int]"
    b = [int()] * (N - 1)  # type: "List[int]"
    for i in range(N - 1):
        a[i] = int(next(tokens))
        b[i] = int(next(tokens))
    print(*solve(N, a, b), sep="\n")

def test():
    import doctest
    doctest.testmod()

if __name__ == '__main__':
    #test()
    main()
Problem p02969 (python)

Fixed submission:
print(3 * int(input()) ** 2)

Buggy submission (verdict: Runtime Error):
print(3 * r ** 2)
Problem p02997 (python)

Fixed submission:
#!/usr/bin/env python3
import sys

def solve(N: int, K: int):
    k = (N - 1) * (N - 2) // 2
    if k < K:
        return None
    edges = [(1, i) for i in range(2, N+1)]
    def f():
        for i in range(2, N+1):
            for j in range(i+1, N+1):
                yield i, j
    it = f()
    while k > K:
        edges.append(next(it))
        k -= 1
    return edges

# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    edges = solve(N, K)
    if edges:
        print(len(edges))
        for e in edges:
            print(*e)
    else:
        print(-1)

def test():
    import doctest
    doctest.testmod()

if __name__ == '__main__':
    test()
    main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
import sys
from functools import lru_cache

@lru_cache(maxsize=None)
def g(N, K):
    if N == K == 0:
        return tuple()
    if K < 0 or N <= 0:
        return None
    # ノードの周りにi個のノードを生やす
    t = 0
    for i in range(1, N+1):
        # ノードをi個足すとcomb(i,2)個の最短距離2の頂点対ができる
        t += i
        # 足したノードの内の1つから更にノードを生やす
        res = g(N-i, K-t)
        if res is not None:
            return res + (i,)
    return None

def f(N, K):
    '''
    >>> f(5, 3)
    (1, 1, 1, 0)
    >>> f(5, 8) # return None
    >>> f(3, 1)
    (1, 0)
    >>> f(4, 2)
    (1, 1, 0)
    >>> f(4, 3)
    (2, 0)
    >>> f(5, 4)
    (2, 1, 0)
    >>> f(5, 6)
    (3, 0)
    '''
    # 始め、ノードは1つあった
    n = N - 1
    t = 0
    for i in range(1, N):
        # ノードをi個生やすとcomb(i-1,2)個の最短距離2の頂点対ができる
        t += i - 1
        # 足したノードの内の1つから更にノードを生やす
        res = g(n-i, K-t)
        if res is not None:
            return res + (i-1,)
    return res

def solve(N: int, K: int):
    from itertools import count
    edges = []
    res = f(N, K)
    if res is None:
        print(-1)
        return
    edges = []
    for i in range(len(res)):
        edges.append((i+1, i+2))
    c = count(len(res)+1)
    for p, n in enumerate(res, 1):
        for _ in range(n-1):
            edges((p, next(c)))
    print(len(edges))
    for u, v in edges:
        print(u, v)




# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    solve(N, K)

def test():
    import doctest
    doctest.testmod()

if __name__ == '__main__':
    test()
    main()
Problem p03152 (python)

Fixed submission:
MOD = 10 ** 9 + 7
N, M = list(map(int, input().split()))
A = sorted(map(int, input().split()), reverse=True) + [-1]
B = sorted(map(int, input().split()), reverse=True) + [-1]

def solve():
    su = 1
    h, w = 0, 0
    for i, n in enumerate(range(N*M, 0, -1)):
        #print("h={}, w={}, i={}, n={}, su={}".format(h, w, i, n, su))
        if su == 0:
            return su
        nh, nw = h, w
        if A[h] >= n:
            nh = h + 1
        if B[w] >= n:
            nw = w + 1
        if A[h] == B[w] and B[w] == n:
            #print(1)
            pass
        elif A[h] == n:
            #print(2)
            su = (su * nw) % MOD
        elif B[w] == n:
            #print(3)
            su = (su * nh) % MOD
        else:
            #print(4)
            su = (su * ((nh * nw - i) % MOD)) % MOD
        h = nh
        w = nw
    return su
        
            
if any(any(x1 == x2 for x1, x2 in zip(X, X[1:])) for X in [A, B]):
    print(0)
else:
    print(solve())

Buggy submission (verdict: Runtime Error):
MOD = 10 ** 9 + 7
N, M = list(map(int, input().split()))
A = sorted(map(int, input().split()), reverse=True) + [-1]
B = sorted(map(int, input().split()), reverse=True) + [-1]

def solve():
    su = 1
    h, w = 0, 0
    for i, n in enumerate(range(N*M, 0, -1)):
        #print("h={}, w={}, i={}, n={}, su={}".format(h, w, i, n, su))
        if su == 0:
            return su
        if A[h] >= n:
            nh = h + 1
        if B[w] >= n:
            nw = w + 1
        if A[h] == B[w] and B[w] == n:
            #print(1)
            pass
        elif A[h] == n:
            #print(2)
            su = (su * nw) % MOD
        elif B[w] == n:
            #print(3)
            su = (su * nh) % MOD
        else:
            #print(4)
            su = (su * (nh * nw - i)) % MOD
        h = nh
        w = nw
    return su
        
            
if any(any(x1 == x2 for x1, x2 in zip(X, X[1:])) for X in [A, B]):
    print(0)
else:
    print(solve())

Buggy submission (verdict: Runtime Error):
MOD = 10 ** 9 + 7
N, M = list(map(int, input().split()))
A = sorted(map(int, input().split()), reverse=True) + [-1]
B = sorted(map(int, input().split()), reverse=True) + [-1]

if any(any(x1 == x2 for x1, x2 in zip(X, X[1:])) for X in [A, B]):
    import sys
    print(0)
    sys.exit()

#print(A)
#print()

def solve():
    su = 1
    h, w = 0, 0
    for i, n in enumerate(range(N*M, 0, -1)):
        #print("h={}, w={}, i={}, n={}, su={}".format(h, w, i, n, su))
        if A[h] >= n:
            nh = h + 1
        if B[w] >= n:
            nw = w + 1
        if A[h] == B[w] and B[w] == n:
            #print(1)
            pass
        elif A[h] == n:
            #print(2)
            su = (su * nw) % MOD
        elif B[w] == n:
            #print(3)
            su = (su * nh) % MOD
        else:
            #print(4)
            su = (su * (nh * nw - i)) % MOD
        h = nh
        w = nw
    return su
        
            
if __name__ == "__main__":
    print(solve())
Problem p03282 (python)

Fixed submission:
#!/usr/bin/env python3
import sys


def solve(S: int, K: int):
    for i, s in enumerate(str(S)[:K]):
        if s != '1':
            return s
    return 1

# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    print(solve(S, K))

def test():
    import doctest
    doctest.testmod()

if __name__ == '__main__':
    #test()
    main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
import sys


def solve(S: int, K: int):
    for i, s in enumerate(str(S)):
        if s != '1':
            return s
        if K == i:
            return s
    raise

# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    print(solve(S, K))

def test():
    import doctest
    doctest.testmod()

if __name__ == '__main__':
    #test()
    main()
Problem p03311 (python)

Fixed submission:
#!/usr/bin/env python3
import sys

def solve(N: int, A: "List[int]"):
    A = sorted(a - i for i, a in enumerate(A))
    m = A[N//2]
    return sum(abs(a-m) for a in A)


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    print(solve(N, A))

def test():
    import doctest
    doctest.testmod()

if __name__ == '__main__':
    #test()
    main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
import sys

def solve(N: int, A: "List[int]"):
    from scipy.optimize import dual_annealing
    A = [a-i for i, a in enumerate(A, 1)]
    def f(b):
        return sum(abs(a-b) for a in A)
    res = dual_annealing(f, [[min(A), max(A)]], maxiter=500)
    # print(res)
    b = res.x[0]
    return min(f(int(round(b))), f(int(round(b+1))))

# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"    
    print(solve(N, A))

def test():
    import doctest
    doctest.testmod()

if __name__ == '__main__':
    #test()
    main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
import sys

def solve(N: int, A: "List[int]"):
    from scipy.optimize import dual_annealing
    A = [a-i for i, a in enumerate(A, 1)]
    def f(b):
        return sum(abs(a-b) for a in A)
    res = dual_annealing(f, [[min(A), max(A)]], maxiter=1000)
    # print(res)
    b = res.x[0]
    return min(f(int(round(b))), f(int(round(b+1))))

# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"    
    print(solve(N, A))

def test():
    import doctest
    doctest.testmod()

if __name__ == '__main__':
    #test()
    main()
Problem p03342 (python)

Fixed submission:
#!/usr/bin/env python3
import sys
MOD = 1000000007

def solve(N: int, A: "List[int]"):
    l, r = 0, 1
    sux, su, ans = A[0], A[0], 0
    while l < len(A):
        while r < len(A) and (sux ^ A[r]) == (su + A[r]):
            sux ^= A[r]
            su += A[r]
            r += 1
        ans += r - l
        sux ^= A[l]
        su -= A[l]
        l += 1
    return ans

# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    print(solve(N, A))

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
import sys
MOD = 1000000007

def solve(N: int, A: "List[int]"):
    l, r = 0, 1
    sux, su, ans = A[0], A[0], 0
    while l < len(A):
        while r < len(A) and (sux ^ A[r]) == (su + A[r]):
            sux ^= A[r]
            su += A[r]
            r += 1
        ans += r - l
        sux ^= A[l]
        su -= A[l]
        l += 1
    return ans

# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    print(solve(N, A))

if __name__ == '__main__':
    main()
Problem p03364 (python)

Fixed submission:
#!/usr/bin/env python3
import sys
import numpy as np

def gen_check(N: int, S: "List[str]"):
    tmp = [tuple(s)+tuple(s) for s in S]
    S = np.array(tmp+tmp)
    def check(a, b):
        s = S[a:a+N,b:b+N]
        return np.array_equal(s, s.T)
    return check

def solve(N: int, S: "List[str]"):
    ans = 0
    check = gen_check(N, S)
    for a in range(N):
        if check(a, 0):
            ans += N
    return ans

# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    S = [next(tokens) for _ in range(N)]  # type: "List[str]"
    print(solve(N, S))

def test():
    import doctest
    doctest.testmod()

if __name__ == '__main__':
    #test()
    main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
import sys
import numpy as np

def gen_check(N: int, S: "List[str]"):
    tmp = [tuple(s)+tuple(s) for s in S]
    S = np.array(tmp+tmp)
    def check(a, b):
        s = S[a:a+N,b:b+N]
        return np.array_equal(s, s.T)
    return check

def solve(N: int, S: "List[str]"):
    ans = 0
    check = gen_check(N, S)
    for a in range(N):
        if check(a, 0):
            ans += N
    return ans

# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    S = [next(tokens) for _ in range(N)]  # type: "List[str]"
    print(solve(N, S))

def test():
    import doctest
    doctest.testmod()

if __name__ == '__main__':
    #test()
    main()
Problem p03486 (python)

Fixed submission:
S = sorted(input())
T = sorted(input(), reverse=True)
print("Yes" if T > S else "No")

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
import sys


def solve(H: int, W: int, A: "List[List[int]]", B: "List[List[int]]"):
    from itertools import chain
    dp = [[set() for _ in range(W+1)] for _ in range(H+1)]
    dp[0][0].add(0)
    for h in range(H):
        for w in range(W):
            d = A[h][w] - B[h][w]
            for v in dp[h][w]:
                dp[h+1][w].add(v+d)
                dp[h+1][w].add(v-d)
                dp[h][w+1].add(v+d)                                            
                dp[h][w+1].add(v-d)
    return min(map(abs, chain(dp[H-1][W], dp[H][W-1])))

# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    H = int(next(tokens))  # type: int
    W = int(next(tokens))  # type: int
    A = [[int(next(tokens)) for _ in range(W)] for _ in range(H)]  # type: "List[List[int]]"
    B = [[int(next(tokens)) for _ in range(W)] for _ in range(H)]  # type: "List[List[int]]"
    print(solve(H, W, A, B))

def test():
    import doctest
    doctest.testmod()

if __name__ == '__main__':
    #test()
    main()
Problem p03644 (python)

Fixed submission:
N = int(input())
print(max(2 ** i if 2 ** i <= N else 0 for i in range(10)))

Buggy submission (verdict: Runtime Error):
N = int(input())
print(max(i if 2 ** i <= N else 0 for i in range(10))