Buggy python submission (verdict: Runtime Error):
# ABC044C - 高橋君とカード / Tak and Cards (ARC060C)
from collections import defaultdict


def main():
    N, A = tuple(map(int, input().split()))
    X = tuple(map(int, input().split()))
    Y = [i - A for i in X]
    D = defaultdict(int)
    D[0] = 1
    for i in Y:
        for j, k in D.items():
            D[i + j] += k
    print(D[0] - 1)


if __name__ == "__main__":
    main()

Fixed submission:
# ABC044C - 高橋君とカード / Tak and Cards (ARC060C)
def main():
    N, A = tuple(map(int, input().rstrip().split()))
    X = tuple(map(int, input().rstrip().split()))
    x = max(X)
    # dp[i][j][k] := patterns to make k by j cards from X1, X2, ..., Xi
    dp = [[[0] * (N * 50 + 1) for _ in range(N + 1)] for _ in range(N + 1)]
    dp[0][0][0] = 1
    for i in range(N):
        for j in range(N):
            for k in range(N * 50 + 1):
                if dp[i][j][k]:
                    dp[i + 1][j][k] += dp[i][j][k]
                    dp[i + 1][j + 1][k + X[i]] += dp[i][j][k]
    ans = sum(dp[N][i][i * A] for i in range(1, N + 1))
    print(ans)


if __name__ == "__main__":
    main()

Buggy python submission (verdict: Runtime Error):
# ABC044C - 高橋君とカード / Tak and Cards (ARC060C)
import sys
sys.setrecursionlimit(10 ** 9)


def main():
    N, A = tuple(map(int, input().rstrip().split()))
    X = tuple(map(int, input().rstrip().split()))
    x = max(X)
    # dp[i][j][k] := patterns to make k by j cards from X1, X2, ..., Xi
    dp = [[[0] * (N * x + 1) for _ in range(N + 1)] for _ in range(N + 1)]
    dp[0][0][0] = 1
    for i in range(N):
        for j in range(N):
            for k in range(N * x + 1):
                if dp[i][j][k]:
                    dp[i + 1][j][k] += dp[i][j][k]
                    dp[i + 1][j + 1][k + X[i]] += dp[i][j][k]
    ans = sum(dp[N][i][i * A] for i in range(1, N + 1))
    print(ans)


if __name__ == "__main__":
    main()

Fixed submission:
# ABC044C - 高橋君とカード / Tak and Cards (ARC060C)
def main():
    N, A = tuple(map(int, input().rstrip().split()))
    X = tuple(map(int, input().rstrip().split()))
    x = max(X)
    # dp[i][j][k] := patterns to make k by j cards from X1, X2, ..., Xi
    dp = [[[0] * (N * 50 + 1) for _ in range(N + 1)] for _ in range(N + 1)]
    dp[0][0][0] = 1
    for i in range(N):
        for j in range(N):
            for k in range(N * 50 + 1):
                if dp[i][j][k]:
                    dp[i + 1][j][k] += dp[i][j][k]
                    dp[i + 1][j + 1][k + X[i]] += dp[i][j][k]
    ans = sum(dp[N][i][i * A] for i in range(1, N + 1))
    print(ans)


if __name__ == "__main__":
    main()

Buggy python submission (verdict: Runtime Error):
# ABC044C - 高橋君とカード / Tak and Cards (ARC060C)
import sys
sys.setrecursionlimit(10 ** 9)


def main():
    N, A = tuple(map(int, input().rstrip().split()))
    X = tuple(map(int, input().rstrip().split()))
    x = max(X)
    # dp[i][j][k] := patterns to make k by j cards from X1, X2, ..., Xi
    dp = [[[0] * (N * x + 1) for _ in range(N + 1)] for _ in range(N + 1)]
    dp[0][0][0] = 1
    for i in range(N):
        for j in range(N):
            for k in range(N * x + 1):
                if dp[i][j][k]:
                    dp[i + 1][j][k] += dp[i][j][k]
                    dp[i + 1][j + 1][k + X[i]] += dp[i][j][k]
    ans = sum(dp[N][i][i * A] for i in range(1, N + 1))
    print(ans)


if __name__ == "__main__":
    main()

Fixed submission:
# ABC044C - 高橋君とカード / Tak and Cards (ARC060C)
def main():
    N, A = tuple(map(int, input().rstrip().split()))
    X = tuple(map(int, input().rstrip().split()))
    x = max(X)
    # dp[i][j][k] := patterns to make k by j cards from X1, X2, ..., Xi
    dp = [[[0] * (N * 50 + 1) for _ in range(N + 1)] for _ in range(N + 1)]
    dp[0][0][0] = 1
    for i in range(N):
        for j in range(N):
            for k in range(N * 50 + 1):
                if dp[i][j][k]:
                    dp[i + 1][j][k] += dp[i][j][k]
                    dp[i + 1][j + 1][k + X[i]] += dp[i][j][k]
    ans = sum(dp[N][i][i * A] for i in range(1, N + 1))
    print(ans)


if __name__ == "__main__":
    main()

Buggy python submission (verdict: Runtime Error):
# ABC044C - 高橋君とカード / Tak and Cards (ARC060C)
def main():
    N, A = tuple(map(int, input().rstrip().split()))
    X = tuple(map(int, input().rstrip().split()))
    x = max(X)
    # dp[i][j][k] := patterns to make k by j cards from X1, X2, ..., Xi
    dp = [[[0] * (N * x + 1) for _ in range(N + 1)] for _ in range(N + 1)]
    dp[0][0][0] = 1
    for i in range(N):
        for j in range(N):
            for k in range(N * x + 1):
                if dp[i][j][k]:
                    dp[i + 1][j][k] += dp[i][j][k]
                    dp[i + 1][j + 1][k + X[i]] += dp[i][j][k]
    ans = sum(dp[N][i][i * A] for i in range(1, N + 1))
    print(ans)


if __name__ == "__main__":
    main()

Fixed submission:
# ABC044C - 高橋君とカード / Tak and Cards (ARC060C)
def main():
    N, A = tuple(map(int, input().rstrip().split()))
    X = tuple(map(int, input().rstrip().split()))
    x = max(X)
    # dp[i][j][k] := patterns to make k by j cards from X1, X2, ..., Xi
    dp = [[[0] * (N * 50 + 1) for _ in range(N + 1)] for _ in range(N + 1)]
    dp[0][0][0] = 1
    for i in range(N):
        for j in range(N):
            for k in range(N * 50 + 1):
                if dp[i][j][k]:
                    dp[i + 1][j][k] += dp[i][j][k]
                    dp[i + 1][j + 1][k + X[i]] += dp[i][j][k]
    ans = sum(dp[N][i][i * A] for i in range(1, N + 1))
    print(ans)


if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
# ARC060C - 高橋君とカード / Tak and Cards (ABC044C)
from itertools import combinations


def ans(i, A, lst):
    comb = tuple(combinations(lst, i))
    return sum(1 for i in comb if sum(i) == A)


def main():
    n, a = list(map(int, input().rstrip().split()))
    lst = tuple(map(int, input().rstrip().split()))
    cnt = 0
    for i in range(1, n + 1):
        cnt += ans(i, i * a, lst)
    print(cnt)


if __name__ == "__main__":
    main()

Fixed submission:
# ABC044C - 高橋君とカード / Tak and Cards (ARC060C)
def main():
    N, A = tuple(map(int, input().rstrip().split()))
    X = tuple(map(int, input().rstrip().split()))
    x = max(X)
    # dp[i][j][k] := patterns to make k by j cards from X1, X2, ..., Xi
    dp = [[[0] * (N * 50 + 1) for _ in range(N + 1)] for _ in range(N + 1)]
    dp[0][0][0] = 1
    for i in range(N):
        for j in range(N):
            for k in range(N * 50 + 1):
                if dp[i][j][k]:
                    dp[i + 1][j][k] += dp[i][j][k]
                    dp[i + 1][j + 1][k + X[i]] += dp[i][j][k]
    ans = sum(dp[N][i][i * A] for i in range(1, N + 1))
    print(ans)


if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
# ARC060C - 高橋君とカード / Tak and Cards (ABC044C)
from itertools import combinations


def ans(i, A, lst):
    comb = tuple(combinations(lst, i))
    return sum(1 for i in comb if sum(i) == A)


def main():
    n, a = list(map(int, input().rstrip().split()))
    lst = tuple(map(int, input().rstrip().split()))
    cnt = 0
    for i in range(1, n + 1):
        cnt += ans(i, i * a, lst)
    print(cnt)


if __name__ == "__main__":
    main()

Fixed submission:
# ABC044C - 高橋君とカード / Tak and Cards (ARC060C)
def main():
    N, A = tuple(map(int, input().rstrip().split()))
    X = tuple(map(int, input().rstrip().split()))
    x = max(X)
    # dp[i][j][k] := patterns to make k by j cards from X1, X2, ..., Xi
    dp = [[[0] * (N * 50 + 1) for _ in range(N + 1)] for _ in range(N + 1)]
    dp[0][0][0] = 1
    for i in range(N):
        for j in range(N):
            for k in range(N * 50 + 1):
                if dp[i][j][k]:
                    dp[i + 1][j][k] += dp[i][j][k]
                    dp[i + 1][j + 1][k + X[i]] += dp[i][j][k]
    ans = sum(dp[N][i][i * A] for i in range(1, N + 1))
    print(ans)


if __name__ == "__main__":
    main()