Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
T = 10**9+7

N, B = list(map(int, input().split()))
R = N - B
for i in range(1, B+1):
    if i > R + 1:
        print(0)
    else:
        print((nCr(R+1, i) % T) * (nCr(B-1, i-1) % T) % T)

def factorial(n, s):
    f = 1
    for i in range(s, n+1):
        f *= i
    return f

def nCr(n, r):
    if n == r:
        return 1
    else:
        return factorial(n, r+1) // factorial(n - r, 1)


Fixed submission:
def factorial(n, s):
    f = 1
    for i in range(s, n + 1):
        f *= i
    return f


def nCr(n, r):
    if n == r:
        return 1
    else:
        return factorial(n, r + 1) // factorial(n - r, 1)


T = 10 ** 9 + 7
N, B = list(map(int, input().split()))
R = N - B
for i in range(1, B + 1):
    if i > R + 1:
        print(0)
    else:
        print((nCr(R + 1, i) % T) * (nCr(B - 1, i - 1) % T) % T)
Buggy python submission (verdict: Runtime Error):
S = list(input())
for i in range(0, 3):
    if S[i] == S[i + 1]:
        print("Bad")
        return
print("Good")


Fixed submission:
S = list(input())
for i in range(0, 3):
    if S[i] == S[i + 1]:
        print("Bad")
        break
else:
    print("Good")
Buggy python submission (verdict: Runtime Error):
N, K = list(map(int, input().split()))
a = list(map(int, input().split()))
a.insert(0, 0)
C = 0
s = 0
t = 1
for i in range(1, N + 1):
    for l in range(t, N + 1):
        s += a[l]
        if s >= K:
            C += N - l + 1
            s -= a[i] + a[l]
            t = l
            break
    else:
        break
print(C)

Fixed submission:
X, A = list(map(int, input().split()))
print(0 if X < A else 10)
Buggy python submission (verdict: Runtime Error):
H, W = list(map(int, input().split()))
M = [['.' for w in range(W)] for h in range(H)]
for h in range(0, H):
    M[h] = list(input())

Yoko = [[0 for w in range(W)] for h in range(H)]
Tate = [[0 for w in range(W)] for h in range(H)]
for h in range(0, H):
    for w in range(0, W):
        if M[h][w] != '#':
            if w >= 0 and M[h][w - 1] != '#':
                Yoko[h][w] = Yoko[h][w - 1]
            else:
                c = 0
                for d in range(w, W):
                    if M[h][d] == '#':
                        break
                    c += 1
                Yoko[h][w] = c
for w in range(0, W):
    for h in range(0, H):
        if M[h][w] != '#':
            if h >= 0 and Tate[h - 1][w] > 0:
                Tate[h][w] = Tate[h - 1][w]
            else:
                c = 0
                for d in range(h, H):
                    if M[d][w] == '#':
                        break
                    c += 1
                Tate[h][w] = c
mx = 0
for w in range(0, W):
    for h in range(0, H):
        if M[h][w] != '#':
            c = Yoko[h][w] + Tate[h][w] - 1
            if c > mx:
                mx = c
print(mx)

Fixed submission:
P, Q, R = list(map(int, input().split()))
print(min([P + Q, Q + R, R + P]))
Buggy python submission (verdict: Runtime Error):
N, M = list(map(int, input().split()))
a = []
for i in range(0, M):
    a.append(int(input()))
a.sort()
T = 10 ** 9 + 7

r = [0 for _ in range(N + 1)]
r[0] = 1
r[1] = 1


def fib(n):
    if r[n] > 0:
        return r[n]
    else:
        r[n] = fib(n - 1) + fib(n - 2)
        return r[n]


for i in range(0, M - 1):
    if a[i] + 1 == a[i + 1]:
        print(0)
        break
else:
    now = 0
    c = 1
    for i in range(0, M):
        c *= fib(a[i] - now - 1) % T
        c %= T
        now = a[i] + 1
    c *= fib(N - now)
    print(c % T)

Fixed submission:
N, M = list(map(int, input().split()))
As = set()
for i in range(0, M):
    As.add(int(input()))
C = 10 ** 9 + 7

dp = [0 for _ in range(N + 1)]
dp[0] = 1
dp[1] = 0 if 1 in As else 1

for i in range(2, N + 1):
    if i in As:
        dp[i] = 0
    else:
        dp[i] = (dp[i - 1] + dp[i - 2]) % C

print(dp[N])

Buggy python submission (verdict: Runtime Error):
N, M = list(map(int, input().split()))
a = []
for i in range(0, M):
    a.append(int(input()))
a.sort()
T = 10 ** 9 + 7

r = [0 for _ in range(N + 1)]
r[0] = 1
r[1] = 1


def fib(n):
    if r[n] > 0:
        return r[n]
    else:
        return fib(n - 1) + fib(n - 2)


for i in range(0, M - 1):
    if a[i] + 1 == a[i + 1]:
        print(0)
        break
else:
    now = 0
    c = 1
    for i in range(0, M):
        c *= fib(a[i] - now - 1) % T
        c %= T
        now = a[i] + 1
    c *= fib(N - now)
    print(c % T)

Fixed submission:
N, M = list(map(int, input().split()))
As = set()
for i in range(0, M):
    As.add(int(input()))
C = 10 ** 9 + 7

dp = [0 for _ in range(N + 1)]
dp[0] = 1
dp[1] = 0 if 1 in As else 1

for i in range(2, N + 1):
    if i in As:
        dp[i] = 0
    else:
        dp[i] = (dp[i - 1] + dp[i - 2]) % C

print(dp[N])

Buggy python submission (verdict: Runtime Error):
N, M = list(map(int, input().split()))
a = []
for i in range(0, M):
    a.append(int(input()))
a.sort()
T = 10 ** 9 + 7

r = [0 for _ in range(N + 1)]
r[0] = 1
r[1] = 1


def fib(n):
    if r[n] > 0:
        return r[n]
    else:
        return fib(n - 1) + fib(n - 2)


for i in range(0, M - 1):
    if a[i] + 1 == a[i + 1]:
        print(0)
        break
else:
    now = 0
    c = 1
    for i in range(0, M):
        c *= fib(a[i] - now - 1)
        c %= T
        now = a[i] + 1
    c *= fib(N - now)
    print(c % T)

Fixed submission:
N, M = list(map(int, input().split()))
As = set()
for i in range(0, M):
    As.add(int(input()))
C = 10 ** 9 + 7

dp = [0 for _ in range(N + 1)]
dp[0] = 1
dp[1] = 0 if 1 in As else 1

for i in range(2, N + 1):
    if i in As:
        dp[i] = 0
    else:
        dp[i] = (dp[i - 1] + dp[i - 2]) % C

print(dp[N])
Buggy python submission (verdict: Time Limit Exceeded):
H, W = list(map(int, input().split()))
M = [[True for w in range(W)] for h in range(H)]
for h in range(0, H):
    Col = list(input())
    for w in range(0, W):
        if Col[w] == '#':
            M[h][w] = False
mx = 0
for h in range(0, H):
    for w in range(0, W):
        if not M[h][w]:
            continue
        c = 1
        for d in range(w - 1, -1, -1):
            if not M[h][d]:
                break
            c += 1
        for d in range(w + 1, W):
            if not M[h][d]:
                break
            c += 1
        for d in range(h - 1, -1, -1):
            if not M[d][w]:
                break
            c += 1
        for d in range(h + 1, H):
            if not M[d][w]:
                break
            c += 1
        if c > mx:
            mx = c
print(mx)

Fixed submission:
H, W = list(map(int, input().split()))
M = [['.' for w in range(W)] for h in range(H)]
for h in range(0, H):
    M[h] = list(input())

Yoko = [[0 for w in range(W)] for h in range(H)]
Tate = [[0 for w in range(W)] for h in range(H)]
for h in range(0, H):
    for w in range(0, W):
        if M[h][w] != '#':
            if w > 0 and M[h][w - 1] != '#':
                Yoko[h][w] = Yoko[h][w - 1]
            else:
                c = 0
                for d in range(w, W):
                    if M[h][d] == '#':
                        break
                    c += 1
                Yoko[h][w] = c
for w in range(0, W):
    for h in range(0, H):
        if M[h][w] != '#':
            if h > 0 and Tate[h - 1][w] > 0:
                Tate[h][w] = Tate[h - 1][w]
            else:
                c = 0
                for d in range(h, H):
                    if M[d][w] == '#':
                        break
                    c += 1
                Tate[h][w] = c
mx = 0
for w in range(0, W):
    for h in range(0, H):
        c = Yoko[h][w] + Tate[h][w] - 1
        if c > mx:
            mx = c
print(mx)
Buggy python submission (verdict: Runtime Error):
N = int(input())

Ls = set()
for i in range(1, N + 1):
    for j in range(i + 1, N + 1):
        Ls.add((i, j))

K = N - (N % 2)
for i in range(1, K):
    Ls.remove((i, K - i + 1))

print(len(Ls))
for l in Ls:
    print("%d %d" % l)

Fixed submission:
N = int(input())

Ls = set()
for i in range(1, N + 1):
    for j in range(i + 1, N + 1):
        Ls.add((i, j))

K = N - (N % 2)
for i in range(1, K // 2 + 1):
    Ls.remove((i, K - i + 1))

print(len(Ls))
for l in Ls:
    print("%d %d" % l)
Buggy python submission (verdict: Runtime Error):
import sys

sys.setrecursionlimit(10 ** 5 * 2)
input = sys.stdin.readline()
N, M = map(int, input().split())
Ps = [[] for _ in range(N)]
for i in range(M):
    x, y = map(int, input().split())
    Ps[x - 1].append(y - 1)

mem = [-1] * N


def rec(n):
    if mem[n] > -1:
        return mem[n]
    elif len(Ps[n]) == 0:
        mem[n] = 0
        return mem[n]
    else:
        mem[n] = max([rec(Ps[n][i]) for i in range(len(Ps[n]))]) + 1
        return mem[n]


for i in range(N):
    rec(i)
print(max(mem))

Fixed submission:
import sys

sys.setrecursionlimit(10 ** 5 * 2)
N, M = map(int, input().split())
Ps = [[] for _ in range(N)]
for i in range(M):
    x, y = map(int, input().split())
    Ps[x - 1].append(y - 1)

mem = [-1] * N


def rec(n):
    if mem[n] > -1:
        return mem[n]
    elif len(Ps[n]) == 0:
        mem[n] = 0
        return mem[n]
    else:
        mem[n] = max([rec(Ps[n][i]) for i in range(len(Ps[n]))]) + 1
        return mem[n]


for i in range(N):
    rec(i)
print(max(mem))

Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
Ps = [[] for _ in range(N)]
for i in range(M):
    x, y = map(int, input().split())
    Ps[x - 1].append(y - 1)

mem = [-1] * N


def rec(n):
    if mem[n] > -1:
        return mem[n]
    elif len(Ps[n]) == 0:
        mem[n] = 0
        return mem[n]
    else:
        mem[n] = max([rec(Ps[n][i]) for i in range(len(Ps[n]))]) + 1
        return mem[n]


for i in range(N):
    rec(i)
print(max(mem))

Fixed submission:
import sys

sys.setrecursionlimit(10 ** 5 * 2)
N, M = map(int, input().split())
Ps = [[] for _ in range(N)]
for i in range(M):
    x, y = map(int, input().split())
    Ps[x - 1].append(y - 1)

mem = [-1] * N


def rec(n):
    if mem[n] > -1:
        return mem[n]
    elif len(Ps[n]) == 0:
        mem[n] = 0
        return mem[n]
    else:
        mem[n] = max([rec(Ps[n][i]) for i in range(len(Ps[n]))]) + 1
        return mem[n]


for i in range(N):
    rec(i)
print(max(mem))
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
Bs = [[] for _ in range(N + 1)]
for _ in range(M):
    a, b = map(int, input().split())
    Bs[a].append(b)
    Bs[b].append(a)
import heapq

st = []
heapq.heappush(st, (1, {1: True}))
c = 0
while len(st) > 0:
    (node, log) = heapq.heappop(st)
    for b in Bs[node]:
        if b in log:
            continue
        elif len(log) == N - 1:
            c += 1
        else:
            newlog = log.copy()
            newlog[b] = True
            heapq.heappush(st, (b, newlog))
print(c)

Fixed submission:
N, M = map(int, input().split())
Bs = [[] for _ in range(N + 1)]
for _ in range(M):
    a, b = map(int, input().split())
    Bs[a].append(b)
    Bs[b].append(a)
import heapq
import copy

st = []
ap = [{1: True}]
heapq.heappush(st, (1, 0))
c = 0
while len(st) > 0:
    (node, log) = heapq.heappop(st)
    for b in Bs[node]:
        if b in ap[log]:
            continue
        elif len(ap[log]) == N - 1:
            c += 1
        else:
            heapq.heappush(st, (b, len(ap)))
            newlog = copy.copy(ap[log])
            newlog[b] = True
            ap.append(newlog)
print(c)
Buggy python submission (verdict: Runtime Error):
a = int(input())
f = False
for i in range(1,10):
    if a % i == 0 and a/i < 10:
        f = True
        break
if f:
    print "Yes"
else:
    print "No"

Fixed submission:
n = int(input())

for i in range(1,10):
    for j in range(1, 10):
        if i * j == n:
            print("Yes")
            exit()
print("No")

Buggy python submission (verdict: Runtime Error):
a = input()
f = False
for i in range(1,10):
    if a % i == 0 and a/i < 10:
        f = True
        break
if f:
    print "Yes"
else:
    print "No"

Fixed submission:
n = int(input())

for i in range(1,10):
    for j in range(1, 10):
        if i * j == n:
            print("Yes")
            exit()
print("No")
Buggy python submission (verdict: Time Limit Exceeded):
num = int(input())

def function(a,b):
    return (max(len(str(a)),len(str(b))))

d = len(str(num))

for i in range(1,num+1):
    if num % i == 0:
        b = int(num // i)
        c = function(i,b)
        if d >= c:
            d = c
        else:
            print(d)
            exit()
print(d)

Fixed submission:
num = int(input())

digits = len(str(num))

ans = digits

for i in range(1,10 ** (digits // 2 + 1)):
    if num % i == 0:
        target = max(len(str(i)), len(str(num//i)))
        if ans >= target:
            ans = target
        else:
            print(ans)
            exit()
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
num = int(input())

def function(a,b):
    return (max(len(str(a)),len(str(b))))

d = len(str(num))

for i in range(1,num+1):
    if num % i == 0:
        b = int(num // i)
        c = function(i,b)
        if d >= c:
            d = c
        else:
            print(d)
            exit()
print(d)

Fixed submission:
num = int(input())

digits = len(str(num))

ans = digits

for i in range(1,10 ** (digits // 2 + 1)):
    if num % i == 0:
        target = max(len(str(i)), len(str(num//i)))
        if ans >= target:
            ans = target
        else:
            print(ans)
            exit()
print(ans)
Buggy python submission (verdict: Runtime Error):
# -*- coding:utf-8 -*-


H, W = int(raw_input()).split()

for i in range(H):
    for j in range(W):
        row = raw_input()
        print(row)
        print(row)


Fixed submission:
# -*- coding:utf-8 -*-


H, W = list(map(int,input().split()))

for i in range(H):
    row = input()
    print(row)
    print(row)

Buggy python submission (verdict: Runtime Error):
# -*- coding:utf-8 -*-


H, W = int(raw_input()).split()

for i in range(H):
    for j in range(W):
        row = raw_input()
        print(row)
        print(row)


Fixed submission:
# -*- coding:utf-8 -*-


H, W = list(map(int,input().split()))

for i in range(H):
    row = input()
    print(row)
    print(row)

Buggy python submission (verdict: Runtime Error):
# -*- coding:utf-8 -*-


H, W = int(raw_input().split())

for i in range(H):
    for j in range(W):
        row = raw_input()
        print(row)
        print(row)


Fixed submission:
# -*- coding:utf-8 -*-


H, W = list(map(int,input().split()))

for i in range(H):
    row = input()
    print(row)
    print(row)

Buggy python submission (verdict: Runtime Error):
# -*- coding:utf-8 -*-


H, W = list(raw_input())

for i in range(H):
    for j in range(W):
        row = list(raw_input())
        print(row)
        print(row)


Fixed submission:
# -*- coding:utf-8 -*-


H, W = list(map(int,input().split()))

for i in range(H):
    row = input()
    print(row)
    print(row)
Buggy python submission (verdict: Runtime Error):
# -*- coding:utf-8 -*-

a, b, x = map(int, input().split())

count = 0

for i in range(a, b+1):
    if i % x == 0:
        count = count + 1

print(count)


Fixed submission:
# -*- coding:utf-8 -*-

AtCoder, s, Contest = input().split()

print("A" + s[0] + "C")
Buggy python submission (verdict: Runtime Error):
# -*- coding:utf-8 -*-


if __name__ == "__main__":
    # input
    a = raw_input()
    b = raw_input()
    c = raw_input()

    a_index = 0
    b_index = 0
    c_index = 0

    next_user = a[a_index]
    a_index += 1

    while(True):
        if next_user == 'a':
            next_user = a[a_index]
            a_index = a_index + 1
            if len(a) == a_index:
                print 'A'
                break
        elif next_user == 'b':
            next_user = b[b_index]
            b_index = b_index + 1
            if len(b) == b_index:
                print 'B'
                break

        else:
            next_user = c[c_index]
            c_index = c_index + 1
            if len(c) == c_index:
                print 'C'
                break


Fixed submission:
# -*- coding:utf-8 -*-


# input
a = list(raw_input())
b = list(raw_input())
c = list(raw_input())

user = 'a'
while(True):
    if user == 'a':
        if len(a) == 0:
            print 'A'
            break
        user = a.pop(0)

    if user == 'b':
        if len(b) == 0:
            print 'B'
            break
        user = b.pop(0)

    if user == 'c':
        if len(c) == 0:
            print 'C'
            break
        user = c.pop(0)
Buggy python submission (verdict: Runtime Error):
    N, L = map(int, input().split())
    data = []
    for _ in range(N):
        input_data = input()
        data.append(input_data)
    print(data)
    data.sort()
    print(''.join(data))


Fixed submission:
N, L = map(int, input().split())
data = []
for _ in range(N):
    input_data = input()
    data.append(input_data)
data.sort()
print(''.join(data))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()

counter = 0
for i in range(10):
    str_i = str(i)
    for j in range(10):
        str_j = str(j)
        for k in range(10):
            str_k = str(k)

            ok_i = False
            ok_j = False

            for _s in s:
                if not ok_i:
                    if _s == str_i:
                        ok_i = True
                else:
                    if not ok_j:
                        if _s == str_j:
                            ok_j = True
                    else:
                        if _s == str_k:
                            counter += 1
                            break

print(counter)

Fixed submission:
n = int(input())
s = input()

counter = 0
for i in range(10):
    str_i = str(i)
    i_dig = s.find(str_i)
    if i_dig == -1:
        continue

    for j in range(10):
        str_j = str(j)
        j_dig = s.find(str_j, i_dig+1)
        if j_dig == -1:
            continue
        
        for k in range(10):
            str_k = str(k)
            k_dig = s.find(str_k, j_dig+1)
            if k_dig != -1:
                counter += 1

print(counter)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()

digit_numbers = [v for v in range(len(s))]
num_set = set()

import itertools
for p in itertools.permutations(digit_numbers, 3):
    p = sorted(list(p))
    num = s[p[0]] + s[p[1]] + s[p[2]]
    num_set.add(num)
print(len(num_set))

Fixed submission:
n = int(input())
s = input()

counter = 0
for i in range(10):
    str_i = str(i)
    i_dig = s.find(str_i)
    if i_dig == -1:
        continue

    for j in range(10):
        str_j = str(j)
        j_dig = s.find(str_j, i_dig+1)
        if j_dig == -1:
            continue
        
        for k in range(10):
            str_k = str(k)
            k_dig = s.find(str_k, j_dig+1)
            if k_dig != -1:
                counter += 1

print(counter)
Buggy python submission (verdict: Runtime Error):
n = input()
count = 0
for i in range(n+1):
  if len(i)%2 == 1:
    count += 1
    
print(count)


Fixed submission:
n = int(input())
count = 0
for i in range(1,n+1):
  if len(str(i))%2 == 1:
    count += 1
    
print(count)

Buggy python submission (verdict: Runtime Error):
n = int(input())
count = 0
for i in range(n+1):
  if len(i)%2 == 1:
    count += 1
    
print(count)

Fixed submission:
n = int(input())
count = 0
for i in range(1,n+1):
  if len(str(i))%2 == 1:
    count += 1
    
print(count)
Buggy python submission (verdict: Runtime Error):
abk = [int(i) for i in input().split()]
a = abk[0]
b = abk[1]
k = abk[2]

anss = []
for i in range(1,min(a,b)+1):
  if a%i==0 and b%i==0:
    anss.append(i)
    
anns.sort(reverse=True)
print(anss[k-1])


Fixed submission:
abk = [int(i) for i in input().split()]
a = abk[0]
b = abk[1]
k = abk[2]

anss = []
for i in range(1,min(a,b)+1):
  if a%i==0 and b%i==0:
    anss.append(i)
    
anss.sort(reverse=True)
print(anss[k-1])
Buggy python submission (verdict: Runtime Error):
input_int = lambda:int(input())
input_ints = lambda:map(int,input().split())
input_ints_list = lambda:list(input_ints())
input_str = lambda:input()
input_strs = lambda:input().split()
input_lines = lambda n,f:[f() for _ in range(n)]

import functools,fractions
import numpy as np
gcd = lambda a:functools.reduce(fractions.gcd,a) # 最大公約数（リスト）
lcm_base = lambda a,b:(a*b)//fractions.gcd(a,b) # 最小公倍数(2値)
lcm = lambda a:functools.reduce(lcm_base,a,1) # 最小公倍数(リスト)

init_dp = lambda v,n:[v]*(n)

import math
# 四捨五入はround
ceil = lambda a:math.ceil(a) # 切り上げ
floor = lambda a:math.floor(a) # 切り捨て

def solution():
    N,M = input_ints()
    As = input_ints_list()
    w = [0,2,5,5,4,5,6,3,7,6]

    dp = init_dp(-1,N+1)
    dp[0] = 0
    for i in range(N+1):
        for v in As:
            if i+w[v] < N+1:
                dp[i+w[v]] = max(dp[i+w[v]],dp[i]*10+v)
    print(dp[N])
    
if __name__ == '__main__':
    solution()

Fixed submission:
# 入力
input_int = lambda:int(input())
input_ints = lambda:map(int,input().split())
input_str = lambda:input()
input_strs = lambda:input().split()
input_lines = lambda n,f:[f() for _ in range(n)]

import functools,fractions
import numpy as np
gcd = lambda a:functools.reduce(fractions.gcd,a) # 最大公約数（リスト）
lcm_base = lambda a,b:(a*b)//fractions.gcd(a,b) # 最小公倍数(2値)
lcm = lambda a:functools.reduce(lcm_base,a,1) # 最小公倍数(リスト)

def solution():
    N = input_int()
    As = input_ints()
    ans = gcd(As)
    print(ans)

if __name__ == '__main__':
    solution()