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

Fixed submission:
N = int(input())
X = []
for _ in range(N):
    a, b = map(int, input().split())
    X.append((a, b))
mi = 1000
X = sorted(X)
for i in range(N):
    for j in range(i+1, N):
        p = X[j][0]-X[i][0]
        q = X[j][1]-X[i][1]
        if p == 0 and q == 0:
            continue
        if p < 0:
            p, q = -p, -q
        if p == 0 and q < 0:
            q = -q
        c = 0
        for k in range(N):
            for l in range(k):
                if X[l][0] == X[k][0] - p and X[l][1] == X[k][1] - q:
                    break
            else:
                c += 1
        mi = min(mi, c)
print(mi if mi < 1000 else 1)

Buggy submission (verdict: Runtime Error):
N = int(input())
X = []
for _ in range(N):
  a, b = map(int, input().split())
  X.append((a, b))
mi = 1000
X = sorted(X)
for i in range(N):
    for j in range(i+1, N):
        p = X[j][0]-X[i][0]
        q = X[j][1]-X[i][1]
        if p == 0 and q == 0:
            continue
        if p < 0:
            p, q = -p, -q
        Y = [0] * (p*q)
        c = 0
        for k in range(N):
            for l in range(k):
                if X[l][0] == X[k][0] - p and X[l][1] == X[k][1] - q:
                    break
            else:
                c += 1
        mi = min(mi, c)
print(mi)
Problem p03007 (python)

Fixed submission:
N = int(input())
A = [int(a) for a in input().split()]
B = [abs(a) for a in A]

for i in range(N):
    if A[i] > 0:
        po = i
        break
else:
    po = -1
for i in range(N):
    if A[i] < 0:
        ne = i
        break
else:
    ne = -1
mi = min(B)
for i in range(N):
    if B[i] == mi:
        mii = i
        break
else:
    mii = -1

if po >= 0 and ne >= 0:
    print(sum(B))
    t1, t2 = A[po], A[ne]
    if po > ne:
        po, ne = ne, po
    # print("pone =", po, ne)
    if po == ne:
        del A[ne]
        A = [0] + A
    else:
        del A[ne]
        del A[po]
        A = [t1, t2] + A
else:
    print(sum(B) - 2 * mi)
    t = A[mii]
    del A[mii]
    A = [t] + A
# print(A)
prev = A[0]
for i in range(1, N):
    a, b = max(prev, A[i]), min(prev, A[i])
    if i == N-1 or A[i+1] < 0:
        print(a, b)
        prev = a - b
    else:
        print(b, a)
        prev = b - a

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [int(a) for a in input().split()]
B = [abs(a) for a in A]

for i in range(N):
    if A[i] > 0:
        po = i
        break
else:
    po = -1
for i in range(N):
    if A[i] < 0:
        ne = i
        break
else:
    ne = -1
for i in range(N):
    if A[i] == 0:
        ze = i
        break
else:
    ze = -1
mi = min(B)
for i in range(N):
    if B[i] == mi:
        mii = i
        break
else:
    mii = -1

def aaa(i, j):
    t1, t2 = A[i], A[j]
    if t1 > t2:
        t1, t2 = t2, t1
    del A[t2]
    del A[t1]
    A = [t1, t2] + A
    
if po >= 0 and ne >= 0:
    aaa(po, ne)
else:
    print(sum(B) - 2 * mi)
    del A[mii]
    A = [mi] + A
# print(A)
prev = A[0]
for i in range(N-1):
    if i == N-2 or A[i+2] < 0:
        print(max(prev, A[i+1]), min(prev, A[i+1]))
        prev = max(prev, A[i+1]) - min(prev, A[i+1])
    else:
        print(min(prev, A[i+1]), max(prev, A[i+1]))
        prev = min(prev, A[i+1]) - max(prev, A[i+1])
Problem p03044 (python)

Fixed submission:
import sys
sys.setrecursionlimit(1000000)

N = int(input())
X = [[] for _ in range(N)]
for _ in range(N-1):
    u, v, w = map(int, input().split())
    X[u-1].append((v-1, w%2))
    X[v-1].append((u-1, w%2))

D = [-1] * N
def calc(i, c):
    D[i] = c
    for j, w in X[i]:
        if D[j] < 0:
            calc(j, D[i]^w)

calc(0, 0)
for d in D:
    print(d)

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(100)

N = int(input())
X = [[] for _ in range(N)]
for _ in range(N-1):
    u, v, w = map(int, input().split())
    X[u-1].append((v-1, w%2))
    X[v-1].append((u-1, w%2))

D = [-1] * N
def calc(i, c):
    D[i] = c
    for j, w in X[i]:
        if D[j] < 0:
            calc(j, D[i]^w)

calc(0, 0)
for d in D:
    print(d)
Problem p03068 (python)

Fixed submission:
N = int(input())
S = input()
K = int(input())
ans = ""
for i in range(N):
    ans += "*" if S[i] != S[K-1] else S[i]
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()
K = int(input())
ans = ""
for i in range(N):
    ans += "*" S[i] != S[K-1] else S[i]
print(ans)
Problem p03071 (python)

Fixed submission:
A, B = map(int, input().split())
print(max(A*2-1,A+B,B*2-1))

Buggy submission (verdict: Runtime Error):
def rec(n):
    if n == 1:
        return 1
    return rec(n-1) + 1

print(rec(2000))

Buggy submission (verdict: Runtime Error):
def rec(n):
    if n == 1:
        return 1
    return rec(n-1) + 1

print(rec(2000))

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(1000000000)

def rec(n):
    if n == 1:
        return 1
    return rec(n-1) + 1


print(rec(800000))

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(1000000000)

def rec(n):
    if n == 1:
        return 1
    return rec(n-1) + 1


print(rec(1000000))

Buggy submission (verdict: Runtime Error):
import random
A, B = map(int, input().split())
r = random.randrange(5)
if r == 0:
    print(1/0)
elif r == 1:
    print(A+B)
elif r == 2:
    while True:
        B += 1
elif r == 3:
    print(999)
else:
    X = [[0] * 10**4 for _ in range(10**5)]

Buggy submission (verdict: Runtime Error):
import random
A, B = map(int, input().split())
r = random.randrange(5)
if r == 0:
    print(1/0)
elif r == 1:
    print(A+B)
elif r == 2:
    while True:
        B += 1
else:
    X = [0] * (10**9)

Buggy submission (verdict: Runtime Error):
import random
A, B = map(int, input().split())
r = random.randrange(5)
if r == 0:
    print(1/0)
elif r == 1:
    print(A+B)
elif r == 2:
    while True:
        B += 1
else:
    X = []
    for i in range(10**6):
	    X += [a for a in range(1000)]

Buggy submission (verdict: Runtime Error):
import random
A, B = map(int, input().split())
r = random.randrange(5)
if r == 0:
    print(1/0)
elif r == 1:
    print(A+B)
elif r == 2:
    while True:
        B += 1
elif r == 3:
    print(999)
else:
    X = [0] * 10**9
Problem p03091 (python)

Fixed submission:
N, M = map(int, input().split())
c = 0
d = 0
for _ in range(min(M, 1000)):
    a, b = map(int, input().split())
    d += a * 5 + b * 7
    c += a * 2 + b * 3
    d %= 100
    c %= 100
if c * 100 + d in [15, 238, 639, 1008, 1870, 2773, 3072, 3622, 4911, 4939, 5062, 5915, 6158, 6669, 7997, 8237, 8289, 9023, 9120, 9182, 9863, 9992]:
    print("No")
else:
    print("Yes")

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
c = 0
d = 0
for _ in range(100):
    a, b = map(int, input().split())
print("No")

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
X = [0] * N
for _ in range(M):
    a, b = map(int, input().split())
    X[a-1] += 1
    X[b-1] += 1
    
for x in X:
    if x % 2 > 0:
        print("No")
        break
else:
    c = 0
    for x in X:
        if x == 4:
            c += 1
        if x >= 6:
            c = 3
            break
    if c >= 3:
        print("Yes")
    elif c == 2:
        print(1/0)
    else:
        print("No")

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
X = [0] * N
for _ in range(M):
    a, b = map(int, input().split())
    X[a-1] += 1
    X[b-1] += 1
    
for x in X:
    if x % 2 > 0:
        print("No")
        break
else:
    c = 0
    for x in X:
        if x == 4:
            c += 1
        if x >= 6:
            c = 2
            break
    if c >= 3:
        print("Yes")
    elif c == 2:
        print(1/0)
    else:
        print("No")
Problem p03138 (python)

Fixed submission:
N, K = map(int, input().split())
A = sorted([int(a) for a in input().split()])

X = [0] * 45
for i in range(N):
    b = bin((1<<45)+A[i])
    # print(b)
    for j in range(45):
        if b[-j-1] == "1":
            X[j] += 1

# print(X)
ans = 0
for i in range(45):
    if 1<<i > K:
        break
    ans += max(X[i], N - X[i]) << i
    
def intlog2(n):
    if n <= 0:
        return -1
    i = 0
    while 2**i <= n:
        i += 1
    return i-1
def calc(k, t):
    # print(k, t)
    if t<0:
        return 0
    if k == 0 or intlog2(k) < t:
        return X[t] * (2**t) + calc(k, t-1)
        
    a = k+1
    while a%2==0:
        a//=2
    if a == 1:
        ret = 0
        for i in range(45):
            if 1<<i > k:
                break
            ret += max(X[i], N - X[i]) << i
            # print(max(X[i], N - X[i]) << i, "=>", ret)
        return ret
    else:
        ll = intlog2(k)
        kk = 2**ll
        ret = kk * X[ll] + calc(kk-1, t-1)
        if X[ll] < N - X[ll]:
            ret2 = kk * (N - X[ll]) + calc(k-kk, t-1)
            ret = max(ret, ret2)
            
        return ret
        
if K == 0:
    print(sum(A))
else:
    print(calc(K, 44))

Buggy submission (verdict: Runtime Error):
import math
N, K = map(int, input().split())
A = sorted([int(a) for a in input().split()])

X = [0] * 45
for i in range(N):
    b = bin((1<<45)+A[i])
    # print(b)
    for j in range(45):
        if b[-j-1] == "1":
            X[j] += 1

# print(X)
ans = 0
for i in range(45):
    if 1<<i > K:
        break
    ans += max(X[i], N - X[i]) << i
    
def calc(k, t):
    # print(k, t)
    if t<0:
        return 0
    if k == 0 or int(math.log2(k)) < t:
        return X[t] * (2**t) + calc(k, t-1)
        
    a = k+1
    while a%2==0:
        a//=2
    if a == 1:
        ret = 0
        for i in range(45):
            if 1<<i > k:
                break
            ret += max(X[i], N - X[i]) << i
            # print(max(X[i], N - X[i]) << i, "=>", ret)
        return ret
    else:
        ll = int(math.log2(k))
        kk = 2**ll
        ret = kk * X[ll] + calc(kk-1, t-1)
        if X[ll] < N - X[ll]:
            ret2 = kk * (N - X[ll]) + calc(k-kk, t-1)
            ret = max(ret, ret2)
            
        return ret
        
if K == 0:
    print(sum(A))
else:
    print(calc(K, 2**(int(math.log2(K)))))
Problem p03142 (python)

Fixed submission:
import sys
sys.setrecursionlimit(300000)

N, M = map(int, input().split())
A = []
B = []
P = [[] for _ in range(N)]
C = [[] for _ in range(N)]
for i in range(N-1+M):
    a, b = map(int, input().split())
    C[a-1].append(b-1)
    P[b-1].append(a-1)


# print(P)
# print(C)

dp = [-1] * N
def calc(i):
    if dp[i] >= 0:
        return dp[i]
    if not P[i]:
        dp[i] = 0
        return 0
    ma = -1
    for p in P[i]:
        ma = max(ma, calc(p))
    dp[i] = ma+1
    return ma+1

for i in range(N):
    calc(i)

for i in range(N):
    if dp[i] == 0:
        print(0)
    else:
        for p in P[i]:
            if dp[p] == dp[i] - 1:
                print(p+1)
                break

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
A = []
B = []
P = [[] for _ in range(N)]
C = [[] for _ in range(N)]
for i in range(N-1+M):
    a, b = map(int, input().split())
    C[a-1].append(b-1)
    P[b-1].append(a-1)


# print(P)
# print(C)

dp = [-1] * N
def calc(i):
    if dp[i] >= 0:
        return dp[i]
    if not P[i]:
        dp[i] = 0
        return 0
    ma = -1
    for p in P[i]:
        ma = max(ma, calc(p))
    dp[i] = ma+1
    return ma+1

for i in range(N):
    calc(i)

for i in range(N):
    if dp[i] == 0:
        print(0)
    else:
        for p in P[i]:
            if dp[p] == dp[i] - 1:
                print(p+1)
                break
Problem p03163 (python)

Fixed submission:
N, W = map(int, input().split())
X = [0] + [-1] * W

for i in range(N):
    w, v = map(int, input().split())
    
    for j in range(W - w, -1, -1):
        if X[j] >= 0:
            X[j+w] = max(X[j+w], X[j]+v)

print(max(X))

Buggy submission (verdict: Runtime Error):
N, W = map(int, input().split())
X = [0] + [-1] * W

for i in range(N):
    w, v = map(int, input().split())
    
    for j in range(W - j, -1, -1):
        if X[j] >= 0:
            X[j+w] = max(X[j+w], X[j]+v)

print(max(X))
Problem p03164 (python)

Fixed submission:
N, W = map(int, input().split())
X = [0] + [-1] * 110000
ma = 0
for i in range(N):
    w, v = map(int, input().split())
    
    for j in range(len(X))[::-1]:
        if X[j] >= 0:
            if X[j] + w <= W:
                if X[j+v] < 0:
                    X[j+v] = X[j]+w
                    ma = max(ma, j+v)
                else:
                    X[j+v] = min(X[j+v], X[j]+w)

print(ma)

Buggy submission (verdict: Runtime Error):
N, W = map(int, input().split())
X = [0] + [-1] * 110000
ma = 0
for i in range(N):
    w, v = map(int, input().split())
    
    for j in range(len(X))[::-1]:
        if X[j] >= 0:
            if X[j] + w <= W:
                if j + v > 100000:
                    break
                if X[j+v] < 0:
                    # print(j+v, "->", X[j]+w)
                    X[j+v] = X[j]+w
                    ma = max(ma, j+v)
                else:
                    X[j+v] = min(X[j+w], X[j]+w)
                # print(X[:100])

print(ma)

Buggy submission (verdict: Runtime Error):
N, W = map(int, input().split())
X = [0] + [-1] * 110000
ma = 0
for i in range(N):
    w, v = map(int, input().split())
    
    for j in range(len(X)-1, -1, -1):
        if X[j] >= 0:
            if X[j] + w <= W:
                if X[j+v] < 0:
                    # print(j+v, "->", X[j]+w)
                    X[j+v] = X[j]+w
                    ma = max(ma, j+v)
                else:
                    X[j+v] = min(X[j+w], X[j]+w)
                # print(X[:100])

print(ma)

Buggy submission (verdict: Runtime Error):
N, W = map(int, input().split())
X = [0] + [-1] * 110000
ma = 0
for i in range(N):
    w, v = map(int, input().split())
    
    for j in range(len(X)-1, -1, -1):
        if X[j] >= 0:
            if X[j] + w <= W:
                if X[j+v] < 0:
                    # print(j+v, "->", X[j]+w)
                    X[j+v] = X[j]+w
                    ma = max(ma, j+v)
                else:
                    X[j+v] = min(X[j+w], X[j]+w)
                # print(X[:100])

print(ma)

Buggy submission (verdict: Runtime Error):
N, W = map(int, input().split())
X = [0] + [-1] * W

for i in range(N):
    w, v = map(int, input().split())
    
    for j in range(W, -1, -1):
        if j + w > W:
            continue
        if X[j] >= 0:
            X[j+w] = max(X[j+w], X[j]+v)

print(max(X))
Problem p03170 (python)

Fixed submission:
N, K = map(int, input().split())
A = [int(a) for a in input().split()]
X = [0] * (K + 1) # 後手必勝のところが1

X[K] = 1
for i in range(K)[::-1]:
    for a in A:
        if i + a <= K:
            if X[i+a] == 1:
                break
    else:
        X[i] = 1
        
print(["First", "Second"][X[0]])

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
A = [int(a) for a in input().split()]
X = [0] * (N*2+100) # 後手必勝のところが1

X[K] = 1
for i in range(K)[::-1]:
    for a in A:
        if X[i+a] == 1:
            break
    else:
        X[i] = 1
        
print(["First", "Second"][X[0]])

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
A = [int(a) for a in input().split()]
X = [0] * (N+K+1000) # 後手必勝のところが1

X[K] = 1
for i in range(K)[::-1]:
    for a in A:
        if X[i+a] == 1:
            break
    else:
        X[i] = 1
        
print(["First", "Second"][X[0]])

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
A = [int(a) for a in input().split()]
X = [0] * (N+K+1) # 後手必勝のところが1

X[K] = 1
for i in range(K)[::-1]:
    for a in A:
        if X[i+a] == 1:
            break
    else:
        X[i] = 1
        
print(["First", "Second"][X[0]])
Problem p03175 (python)

Fixed submission:
import sys
sys.setrecursionlimit(1000000)

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

X = [[] for _ in range(N)]

for _ in range(N-1):
    x, y = map(int, input().split())
    X[x-1].append(y-1)
    X[y-1].append(x-1)
    
P = [-1] * N
def dfs(i):
    for j in X[i]:
        if j != 0 and P[j] < 0:
            P[j] = i
            dfs(j)

dfs(0)

for i in range(N):
    if i != 0:
        X[i].remove(P[i])

ans = 0
B = [0] * N
W = [0] * N

def dfs2(i):
    _ansb = 1
    _answ = 1
    for j in X[i]:
        __ansb, __answ = dfs2(j)
        _ansb *= __answ
        _answ *= (__ansb+__answ)
        _ansb %= MOD
        _answ %= MOD
    
    return (_ansb, _answ)

print(sum(dfs2(0)) % MOD)

Buggy submission (verdict: Runtime Error):
MOD = 10**9+7
N = int(input())

X = [[] for _ in range(N)]

for _ in range(N-1):
    x, y = map(int, input().split())
    X[x-1].append(y-1)
    X[y-1].append(x-1)
    
P = [-1] * N
def dfs(i):
    for j in X[i]:
        if j != 0 and P[j] < 0:
            P[j] = i
            dfs(j)

dfs(0)

for i in range(N):
    if i != 0:
        X[i].remove(P[i])

ans = 0
B = [0] * N
W = [0] * N

def dfs2(i):
    _ansb = 1
    _answ = 1
    for j in X[i]:
        __ansb, __answ = dfs2(j)
        _ansb *= __answ
        _answ *= (__ansb+__answ)
        _ansb %= MOD
        _answ %= MOD
    
    return (_ansb, _answ)

print(sum(dfs2(0)) % MOD)

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

X = [[] for _ in range(N)]

for _ in range(N-1):
    x, y = map(int, input().split())
    X[x-1].append(y-1)
    X[y-1].append(x-1)
    
P = [-1] * N
def dfs(i):
    for j in X[i]:
        if j != 0 and P[j] < 0:
            P[j] = i
            dfs(j)

dfs(0)

for i in range(N):
    if i != 0:
        X[i].remove(P[i])

ans = 0
B = [0] * N
W = [0] * N

def dfs2(i):
    _ansb = 1
    _answ = 1
    for j in X[i]:
        __ansb, __answ = dfs2(j)
        _ansb *= __answ
        _answ *= (__ansb+__answ)
    
    return (_ansb, _answ)

print(sum(dfs2(0)))
Problem p03187 (python)

Fixed submission:
L, N = map(int, input().split())
X = []
for i in range(N):
    X.append(int(input()))

X = sorted(X)

ma = 0
for k in range(2):
    if k == 1:
        X = [L-X[-i] for i in range(1, N+1)]
    s = X[0]
    for i in range(1, N):
        if i % 2 == 1:
            s += L - X[-(i//2)-1] + X[i//2]
        else:
            s += X[i//2] + (L - X[-(i//2)])

    ma = max(ma, s)
    lt = (N-1) // 2 if N % 2 == 1 else -N//2
    for i in range(1, N):
        if lt > 0:
            if N % 2 == 1:
                s += X[lt] - X[i-1]*2 - (L - X[lt + 1])
            else:
                s += X[lt] - X[i-1] * 2 - (L - X[lt + 1])
            lt = 1 + lt - N
            ma = max(ma, s)
        else:
            if N % 2 == 1:
                s += X[lt] - X[i-1] * 2 - (L - X[lt])
            else:
                s += X[lt]*2 - L - X[i-1] * 2
            lt = N + lt
            ma = max(ma, s)

print(ma)

Buggy submission (verdict: Runtime Error):
L, N = map(int, input().split())
if N > 2000:
    print(1/0)
X = [0, L]
for i in range(N):
    X.append(int(input()))

X = sorted(X)
dpl = [[0]*(N+1) for i in range(N+1)]
dpr = [[0]*(N+1) for i in range(N+1)]

for k in range(1, N+1):
    for l in range(k + 1):
        r = k - l
        if l > 0:
            dpl[l][r] = max(dpl[l-1][r] + X[l]-X[l-1], dpr[l-1][r] + X[l] + L - X[-r-1])
        if r > 0:
            dpr[l][r] = max(dpr[l][r-1] + X[-r-1]-X[-r], dpl[l][r-1] + X[l] + L - X[-r-1])
        
ma = 0
for l in range(N+1):
    ma = max(ma, dpl[l][N-l], dpr[l][N-l])

print(ma)

Buggy submission (verdict: Runtime Error):
L, N = map(int, input().split())
if N > 2000:
    print(1/0)
X = [0, L]
for i in range(N):
    X.append(int(input()))

X = sorted(X)
dpl = [[0]*(N+1) for i in range(N+1)]
dpr = [[0]*(N+1) for i in range(N+1)]

for k in range(1, N+1):
    for l in range(k + 1):
        r = k - l
        if l > 0:
            dpl[l][r] = max(dpl[l-1][r] + X[l]-X[l-1], dpr[l-1][r] + X[l] + L - X[-r-1])
        if r > 0:
            dpr[l][r] = max(dpr[l][r-1] + X[-r-1]-X[-r], dpl[l][r-1] + X[l] + L - X[-r-1])
        
ma = 0
for l in range(N+1):
    ma = max(ma, dpl[l][N-l], dpr[l][N-l])

print(ma)
Problem p03200 (python)

Fixed submission:
s = input()
n = len(s)
a = 0
b = 0
for i in range(n):
    if s[i] == "W":
        a += 1
        b += i
        
print(b - a*(a-1)//2)

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

X = [[] for i in range(N)]
P = [-1] * N

for i in range(N-1):
    x, y = map(int, input().split())
    X[x-1].append(y-1)
    X[y-1].append(x-1)


def set_parent(i):
    # print(i)
    for a in X[i]:
        if a != P[i]:
            P[a] = i
            # print(a)
            X[a].remove(i)
            set_parent(a)
    
set_parent(0)

B = [-1] * N
def set_block(i):
    for a in X[i]:
        B[a] = max(i, B[i])
        set_block(a)

B_id = [-1] * N
B_id_cnt = [0] * N
def BID(i):
    for a in X[i]:
        if a > B[i]:
            B_id[a] = a
        else:
            B_id[a] = B_id[i]
            
        # print(a, B_id)
        B_id_cnt[B_id[a]] += 1
        BID(a)
        
Ans = [1] * N
def flow(i):
    for a in X[i]:
        if B_id[a] == B_id[i]:
            Ans[a] = Ans[i]
        else:
            Ans[a] = Ans[i] + B_id_cnt[a]
        flow(a)

set_block(0)


# print("X=", X) # 子リスト
# print("P=", P) # 親
# print("B=", B) # Block
# print(B_id) # BlockのID
# print(B_id_cnt) # BlockのID
# print(Ans)
print(" ".join(map(str, Ans[1:])))
Problem p03206 (python)

Fixed submission:
D = int(input())
if D == 25:
    print("Christmas")
elif D == 24:
    print("Christmas Eve")
elif D == 23:
    print("Christmas Eve Eve")
else:
    print("Christmas Eve Eve Eve")

Buggy submission (verdict: Runtime Error):
A = 25 - int(input()) # 0,1,2,3
X = [0] * (10 ** 8 * (2**A))

Buggy submission (verdict: Runtime Error):
A = 25 - int(input()) # 0,1,2,3
X = [0] * (10 ** 8 * (A*2+1))

Buggy submission (verdict: Runtime Error):
A = 25 - int(input()) # 0,1,2,3
X = [0] * (10 ** 8 * (A*2+2))

Buggy submission (verdict: Runtime Error):
A = 25 - int(input()) # 0,1,2,3
X = [0] * (10 ** 8 * (A*2+2))

Buggy submission (verdict: Runtime Error):
A = 25 - int(input()) # 0,1,2,3
X = [0] * (10 ** 8 * (A*2+2))

Buggy submission (verdict: Runtime Error):
A = 25 - int(input()) # 0,1,2,3
X = [0] * (10 ** 8 * (A*2+2))

Buggy submission (verdict: Runtime Error):
A = 25 - int(input()) # 0,1,2,3
X = [0] * 10 ** (A+8)
Problem p03215 (python)

Fixed submission:
N, K = map(int, input().split())
A = [0] + [int(a) for a in input().split()]
for i in range(N):
    A[i+1] += A[i]
S = []
for i in range(1, N+1):
    for j in range(i):
        S.append(A[i] - A[j])
l, r = 0, 1 << 50
while r - l > 1:
    m = (l+r) // 2
    if len([1 for i in range(len(S)) if S[i] & m == m]) >= K:
        l = m
    else:
        r = m
print(l)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
A = [0] + [int(a) for a in input().split()]
for i in range(N):
    A[i+1] += A[i]
S = []
for i in range(1, N+1):
    for j in range(i):
        S.append(A[i] - A[j])
l, r = 0, 1 << 50
while r - l > 1:
    m = (l+r) // 2
    if len([1 for i in range(len(S)) if S[i] & m == m]) >= K:
        l = m
    else:
        r = m
print(l)