Harryxun/stf_run huggingface dataset:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby, combinations_with_replacement
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
A = [INT() for _ in range(N)]
A.sort()
T = A.copy()
T = deque(T)

l = deque([])
l.append(T.popleft())

while T:
	l.appendleft(T.pop())
	if not T:
		break
	l.append(T.pop())
	if not T:
		break
	l.appendleft(T.popleft())
	if not T:
		break
	l.append(T.popleft())

l = list(l)
ans = 0
for i in range(1, N):
	ans += abs(l[i-1]-l[i])

T = A.copy()
T = deque(T)
l = deque([])
l.append(T.pop())
while T:
	l.appendleft(T.popleft())
	if not T:
		break
	l.append(T.popleft())
	if not T:
		break
	l.appendleft(T.pop())
	if not T:
		break
	l.append(T.pop())

l = list(l)
tmp = 0
for i in range(1, N):
	tmp += abs(l[i-1]-l[i])

ans = max(ans, tmp)
print(ans)


### FIXED CODE ###

import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby, combinations_with_replacement
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
A = [INT() for _ in range(N)]
A.sort()
T = deepcopy(A)
T = deque(T)

l = deque([])
l.append(T.popleft())

while T:
	l.appendleft(T.pop())
	if not T:
		break
	l.append(T.pop())
	if not T:
		break
	l.appendleft(T.popleft())
	if not T:
		break
	l.append(T.popleft())

l = list(l)
ans = 0
for i in range(1, N):
	ans += abs(l[i-1]-l[i])

T = deepcopy(A)
T = deque(T)
l = deque([])
l.append(T.pop())
while T:
	l.appendleft(T.popleft())
	if not T:
		break
	l.append(T.popleft())
	if not T:
		break
	l.appendleft(T.pop())
	if not T:
		break
	l.append(T.pop())

l = list(l)
tmp = 0
for i in range(1, N):
	tmp += abs(l[i-1]-l[i])

ans = max(ans, tmp)
print(ans)
a = input().split(',')
ans = ""
for i in a:
  ans += a[i] + " "
ans -= " "
print(ans)

### FIXED CODE ###

a = input().replace(",", " ")
print(a)
N = input()
print(N*N*N)

### FIXED CODE ###

a = int(input())
print(pow(a,3))
Q = int(input())

ls = [list(map(int,input().split())) for i in range(Q)]
n_max = max(ls)[1]

prime = []
data = [i for i in range(2,n_max+1)]
limit = n_max**(1/2)
while True:
    p = data[0]
    if limit<=p:
        break
    prime.append(p)
    data = [i for i in data if i%p!=0]
prime = prime +data

ans_ls = [0]*(1+n_max)
for i in range(1,n_max+1):
    if i in prime:
        if (i+1)//2 in prime:
            ans_ls[i] =ans_ls[i-1] + 1
        else:
            ans_ls[i] = ans_ls[i-1]
    else:
        ans_ls[i] = ans_ls[i - 1]

for l,r in ls:
    print(ans_ls[r]-ans_ls[l-1])




### FIXED CODE ###

Q = int(input())

ls = [list(map(int,input().split())) for i in range(Q)]

n_max = 10**5

prime = []
data = [i for i in range(2,n_max+1)]
limit = n_max**(1/2)

while True:
    p = data[0]
    if limit<=p:
        break
    prime.append(p)
    data = [i for i in data if i%p!=0]

prime = prime +data

ans_ls = [0]*(1+n_max)
for i in prime:
    if (i + 1) // 2 in prime:
        ans_ls[i] = 1

ans_cs = [0]*(1+n_max)
for i in range(n_max):
    ans_cs[i+1] = ans_cs[i]+ans_ls[i+1]
    
for l,r in ls:
    print(ans_cs[r]-ans_cs[l-1])
import math

A, B = map(int, input().split())

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

print(lcm(A,B))

### FIXED CODE ###

import fractions

A, B = map(int, input().split())

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

print(lcm(A,B))
import numpy as np
a,b,n=map(int,input().split())

x=np.arange(1,n+1)

s1=np.floor((a/b)*x)
s2=a*np.floor(x/b)
s=s1-s2
print(int(np.max(s)))

### FIXED CODE ###

a, b, n = list(map(int, input().split()))
x = min(b - 1, n) # b-1がいいけど、上限 nの制約あり
ans = int(a * x / b)
print(ans)
import sys
n,m=map(int,input().split())
tmp=[0]*n
if m==0:
    print(-1)
for _ in range(m):
    s,c=map(int,input().split())
    if tmp[s-1]==0:
        tmp[s-1]=c
    elif s-1==0 and c==0:
        print(-1)
    else:
        if tmp[s-1]==c:
            continue
        else:
            print(-1)
        sys.exit()
print(100*tmp[0]+10*tmp[1]+tmp[2])

### FIXED CODE ###

import sys
n,m=map(int,input().split())
tmp=[-1]*n
for _ in range(m):
    s,c=map(int,input().split())
    s-=1
    if tmp[s]<0:
        tmp[s]=c
    if tmp[s]!=c:
        print(-1)
        sys.exit()
if tmp[0]==0 and n>1:
    print(-1)
    sys.exit()
if tmp[0]<0 and n>1:
    tmp[0]=1
if n==1 and tmp[0]==-1:
    tmp[0]=0
for i in range(1,n):
    if tmp[i]<0:
        tmp[i]=0
for i in tmp:
    print(i,end='')
color = [0 for i in range(8)]

n = int(input())
al = list(map(int,input().split()))

p = 0
for a in al:
    if a < 3200:
        color[a//400] = 1
    else:
        p += 1
print(max(sum(color), 1))
print(min(sum(color) + p))

### FIXED CODE ###

color = [0 for i in range(8)]

n = int(input())
al = list(map(int,input().split()))

p = 0
for a in al:
    if a < 3200:
        color[a//400] = 1
    else:
        p += 1
print(max(sum(color), 1))
print(sum(color) + p)
a=list(input())
for i in range(len(a)-1):
	if a[i]==a[i+1]:
		print("Good")
        break
else:print("Bad")


### FIXED CODE ###

a=list(input())
for i in range(len(a)-1):
	if a[i]==a[i+1]:
		print("Bad")
		break
else:print("Good")
n, k, l = list(map(int, input().split()))

def get_groups(n, m):
    road = [[] for _ in range(n+1)]
    for _ in range(m):
        p, q = list(map(int, input().split()))
        road[p].append(q)
        road[q].append(p)

    groups = [0]*(n+1)
    group_idx = 1
    for i in range(1, n+1):
        if groups[i] == 0:
            groups[i] = group_idx
            connect = [i]
            while len(connect) > 0:
                cnct = connect[0]
                connect = connect[1:]
                for c in road[cnct]:
                    if groups[c] == 0:
                        groups[c] = group_idx
                        connect.append(c)
            group_idx += 1
            
    return groups

road_groups = get_groups(n, k)
train_groups = get_groups(n, l)
# print(road_groups, train_groups)
pairs = {}
for c in range(1, n+1):
    key = (road_groups[c], train_groups[c])
    if not key in pairs.keys():
        pairs[key] = 1
    else:
        pairs[key] += 1

ans = ''
for c in range(1, n+1):
    key = (road_groups[c], train_groups[c])
    ans += f'{pairs[key]} '
print(ans)


### FIXED CODE ###

from collections import deque

n, k, l = list(map(int, input().split()))

def get_groups(n, m):
    road = [[] for _ in range(n+1)]
    for _ in range(m):
        p, q = list(map(int, input().split()))
        road[p].append(q)
        road[q].append(p)

    groups = [0]*(n+1)
    group_idx = 1
    connect = deque()
    for i in range(1, n+1):
        if groups[i] == 0:
            groups[i] = group_idx
            connect.clear()
            connect.append(i)
            while len(connect) > 0:
                cnct = connect.popleft()
                for c in road[cnct]:
                    if groups[c] == 0:
                        groups[c] = group_idx
                        connect.append(c)
            group_idx += 1
            
    return groups

road_groups = get_groups(n, k)
train_groups = get_groups(n, l)
# print(road_groups, train_groups)
pairs = {}
for c in range(1, n+1):
    key = (road_groups[c], train_groups[c])
    if not key in pairs.keys():
        pairs[key] = 1
    else:
        pairs[key] += 1

ans = []
for c in range(1, n+1):
    key = (road_groups[c], train_groups[c])
    ans.append(str(pairs[key]))
print(' '.join(ans))
n = int(input())
l = 0
r = 0
cntl = 0
cntr = 0
fl = 0
fr = 0
exl = 0
exr = 0
only_r = 0
only_l = 0
maxl = 0
maxr = 0
exlr = []
for i in range(n):
    s = input()
    templ = 0
    tempr = 0
    temp_exl = 0
    temp_exr = 0
    fl = 0
    fr = 0
    for i in s:
        if i == "(":
            tempr += 1
        elif i == ")":
            tempr -= 1
            if tempr < 0:
                tempr = 0
                templ += 1
                fl = 1
    temp_exl += templ
    if tempr > 0:
        temp_exr += tempr
        fr = 1
    if fl == 1 and fr == 0:
        only_l += temp_exl
    elif fr == 1 and fl == 0:
        only_r += temp_exr
    elif temp_exl + temp_exr > 0:
        exl += temp_exl
        exr += temp_exr
        exlr.append([temp_exl-temp_exr, temp_exl,temp_exr])
    # maxl = max(maxl,temp_exl)
    # maxr = max(maxr,temp_exr)
# print (exr,exl,only_r,only_l)
a = only_r
b = 0
exlr.sort()
exlr.sort(key=lambda x: x[1])

# print(exlr)
for i in range(len(exlr)):
    if exlr[i][1] <= a:
        a -= i[0]
        exlr[i] = [0,0,0]
for i in exlr:
    a -= i[1]
    if a<0:
        print("No")
        exit()
    a += i[2]
if exl+only_l == exr+only_r and exl-exr == only_r-only_l and only_l > 0 and only_r > 0:
    print("Yes")
elif exr+exl+only_l+only_r == 0:
    print("Yes")
else:
    print("No")

    





### FIXED CODE ###

n = int(input())
l = 0
r = 0
cntl = 0
cntr = 0
fl = 0
fr = 0
exl = 0
exr = 0
only_r = 0
only_l = 0
maxl = 0
maxr = 0
exlr = []
for i in range(n):
    s = input()
    templ = 0
    tempr = 0
    temp_exl = 0
    temp_exr = 0
    fl = 0
    fr = 0
    for i in s:
        if i == "(":
            tempr += 1
        elif i == ")":
            tempr -= 1
            if tempr < 0:
                tempr = 0
                templ += 1
                fl = 1
    temp_exl += templ
    if tempr > 0:
        temp_exr += tempr
        fr = 1
    if fl == 1 and fr == 0:
        only_l += temp_exl
    elif fr == 1 and fl == 0:
        only_r += temp_exr
    elif temp_exl + temp_exr > 0:
        exl += temp_exl
        exr += temp_exr
        exlr.append([temp_exl-temp_exr, temp_exl,temp_exr])
    # maxl = max(maxl,temp_exl)
    # maxr = max(maxr,temp_exr)
# print (exr,exl,only_r,only_l)
a = only_r
b = only_l
exlr.sort()
# exlr.sort(key=lambda x: x[1])

# print(exlr)
for i in range(len(exlr)):
    if exlr[i][1] <= a and exlr[i][0] <= 0:
        a -= exlr[i][0]
        exlr[i] = [0,0,0]
# print(exlr)
for i in exlr:
    a -= i[1]
    if a<0:
        print("No")
        exit()
    a += i[2]
if a-b == 0:
    print("Yes")
else:
    print("No")
# if exl+only_l == exr+only_r and exl-exr == only_r-only_l and only_l > 0 and only_r > 0:
#     print("Yes")
# elif exr+exl+only_l+only_r == 0:
#     print("Yes")
# else:
#     print("No")
import sys
sys.setrecursionlimit(10**9)
n=int(input())
h=list(map(int,input().split()))
def cst(n):
    if n==1:
        return 0
    elif n==2:
        return abs(h[1]-h[0])
    else:
        return min(cst(n-1)+abs(h[n-1]-h[n-2]),cst(n-2)+abs(h[n-1]-h[n-3]))
n=int(input())
h=list(map(int,input().split()))
A=cst(n)
print(A)

### FIXED CODE ###

n=int(input())
h=list(map(int,input().split()))
D=[10**0 for i in range(n)]

for i in range(n):
    if i==0:
        D[i]=0
    elif i==1:
        D[i]=abs(h[1]-h[0])  
    else:
        D[i]=min(D[i-1]+abs(h[i]-h[i-1]),D[i-2]+abs(h[i]-h[i-2]))
print(D[n-1])
from fractions import gcd


def p_c():
    from sys import stdin
    input = stdin.readline
    n = int(input())
    *a, = map(int, input().split())
    L = [0] * n
    R = [0] * n
    for i in range(1, n):
        L[i] = gcd(L[i - 1], a[i])
        R[n - 1 - i] = gcd(R[(n - i) % n], a[n - 1 - i])
    ans = [gcd(L[i - 1], R[i + 1] % n) for i in range(n)]
    print(max(ans))

p_c()

### FIXED CODE ###

from fractions import gcd


def p_c():
    n = int(input())
    *a, = map(int, input().split())
    L = [0] * n
    R = [0] * n
    for i in range(n - 1):
        L[i] = gcd(L[i - 1], a[i])
        R[n - 1 - i] = gcd(R[(n - i) % n], a[n - 1 - i])
    ans = [gcd(L[i - 1], R[(i + 1) % n]) for i in range(n)]
    print(max(ans))

p_c()
n = int(input())
a = [int(x) for x in input().split()]

t = max(a)
b = []

for i in range(n):
  u = abs(n / 2 - a[i])
  b.append(u)

v = a[u.index(min(b))]
print(t, v)

### FIXED CODE ###

n = int(input())
a = [int(x) for x in input().split()]

t = max(a)
b = []

for i in range(n):
  if t != a[i]:
    u = abs(t / 2 - a[i])
    b.append(u)
  else:
    b.append(t)

v = a[b.index(min(b))]
print(t, v)
import sys
n = int(input())
graph = [[] for _ in range(n)]
for _ in range(n-1):
    a, b, c = map(int, input().split())
    a-=1
    b-=1
    graph[a].append((b, c))
    graph[b].append((a, c))
q, k = map(int, input().split())
k -= 1
xy = []
for _ in range(q):
    x, y = map(int, input().split())
    x-=1
    y-=1
    xy.append((x, y))

def DFS(node, p_node, length):
    l[node] = length
    for i, j in graph[node]:
        if i==p_node:
            continue
        DFS(i, node, length+j)
sys.setrecursionlimit(2 * N)
l = [0]*n
DFS(k, -1, 0)
for x, y in xy:
    print(l[x]+l[y])


### FIXED CODE ###

import sys
n = int(input())
graph = [[] for _ in range(n)]
for _ in range(n-1):
    a, b, c = map(int, input().split())
    a-=1
    b-=1
    graph[a].append((b, c))
    graph[b].append((a, c))
q, k = map(int, input().split())
k -= 1
xy = []
for _ in range(q):
    x, y = map(int, input().split())
    x-=1
    y-=1
    xy.append((x, y))

def DFS(node, p_node, length):
    l[node] = length
    for i, j in graph[node]:
        if i==p_node:
            continue
        DFS(i, node, length+j)
sys.setrecursionlimit(2 * n)
l = [0]*n
DFS(k, -1, 0)
for x, y in xy:
    print(l[x]+l[y])
A, B, C = [int(input()) for _ in range(3)]
if A + B == C or B + C == A or C + A == B:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

candy= sorted(map(int,input().split()))
print("Yes" if candy[0]+candy[1]== candy[2] else "No")
S=input()
S=S.replace("10","3")
S=S.replace("01","3")
res=0
res+=S.count(3)
print(S.replace("3",""))

### FIXED CODE ###

S=input()
if S.count("1")>=S.count("0"):
  print(S.count("0")*2)
else:
  print(S.count("1")*2)
while 1:
 n,s=map(int,input().split())
 if n:print(len([1 for i in range(0,8)for j in range(i+1,9)if j<s-i-j<=9]))


### FIXED CODE ###

import itertools
for e in iter(input,'0 0'):
 n,s=map(int,e.split())
 print(sum(s==sum(p)for p in itertools.combinations(range(10),n)))
N = input()


count = 0
for i in range(N):
    if N % 15 == 0:
        continue
    elif N % 3:
        continue
    elif N % 5:
        continue
    else:
        count += i
print(count)

### FIXED CODE ###

N = int(input())


c = 0
for i in range(1,N+1):
    if i % 15 == 0:
        continue
    elif i % 5 == 0:
        continue
    elif i % 3 == 0:
        continue
    else:
        c += i

print(c)
def get_count(li,c):
    m=(li[0][c],1)
    h={}
    h[li[0][c]]=1
    for i in li[1:]:
        if(i[c] in h):
            h[i[c]]+=1
        else:
            h[i[c]]=1
        if(m[1]<h[i[c]]):
            m=(i[c],h[i[c]])
    return m


h,w,n=list(map(int,input().split()))
li=[]
for i in range(n):
    li.append(tuple(map(int,input().split())))
li=list(set(li))

r=get_count(li,0)
c=get_count(li,1)
# print(r,c)
s=0
if(r[1]>c[1]):
    temp=[]
    for i in li:
        if(i[0]!=r[0]):
            temp.append(i)
    s+=r[1]+get_count(temp,1)[1]
else:
    temp=[]
    for i in li:
        if(i[1]!=c[0]):
            temp.append(i)
    s+=c[1]+get_count(temp,0)[1]

print(s)



### FIXED CODE ###


def get_count(li,c):
    if(li==[]):
        return ((0,0))
    m=(li[0][c],1)
    h={}
    h[li[0][c]]=1
    for i in li[1:]:
        if(i[c] in h):
            h[i[c]]+=1
        else:
            h[i[c]]=1
        if(m[1]<h[i[c]]):
            m=(i[c],h[i[c]])
    return m


h,w,n=list(map(int,input().split()))

if(h==1 or w==1 or n<=1):
    li = []
    for i in range(n):
        li.append(tuple(map(int, input().split())))
    print(n)
else:
    li=[]
    for i in range(n):
        li.append(tuple(map(int,input().split())))
    li=list(set(li))
    r=get_count(li,0)
    c=get_count(li,1)
    # print(r,c)
    s=0
    if(r[1]>c[1]):
        temp=[]
        for i in li:
            if(i[0]!=r[0]):
                temp.append(i)
        s+=r[1]+get_count(temp,1)[1]
    else:
        temp=[]
        for i in li:
            if(i[1]!=c[0]):
                temp.append(i)
        s+=c[1]+get_count(temp,0)[1]

    print(s)
import sys
sys.setrecursionlimit(200_000)

n = int(input())
edge = [[] for _ in range(n)]
for i in range(n - 1):
    u, v, w = map(int, input().split())
    u -= 1
    v -= 1
    edge[u].append((v, w))
    edge[v].append((u, w))


visited = [0] * n
ans = [0] * n
def dfs(u, d):
    for i in range(len(edge[u])):
        v, w = edge[u][i]
        if visited[v] == 0:
            ans[v] = (d + w) % 2
            visited[v] = 1
            dfs(v, d + w)


visited[0] = 1
dfs(0, 0)
for a in ans:
    print(a)


### FIXED CODE ###

import sys
sys.setrecursionlimit(200000)

n = int(input())
edge = [[] for _ in range(n)]
for i in range(n - 1):
    u, v, w = map(int, input().split())
    u -= 1
    v -= 1
    edge[u].append((v, w))
    edge[v].append((u, w))


visited = [0] * n
ans = [0] * n
def dfs(u, d):
    for i in range(len(edge[u])):
        v, w = edge[u][i]
        if visited[v] == 0:
            ans[v] = (d + w) % 2
            visited[v] = 1
            dfs(v, d + w)


visited[0] = 1
dfs(0, 0)
for a in ans:
    print(a)
import math

a,b,C = map(int, raw_input())
c = math.sqrt(a*a + b*b - 2*a*b*math.cos(math.radians(C)))

S = (a * b * math.sin(math.radians(C))) / 2
L = a + b + c
h = (S * 2) / a

print("%f" % (S, ))
print("%f" % (L, ))
print("%f" % (h, ))


### FIXED CODE ###

import math
e=map(float,raw_input().split())
a=e[0]
b=e[1]
C=math.radians(e[2])
c=(a**2+b**2-2*a*b*math.cos(C))**0.5
h=b*math.sin(C)
S=h*a*0.5
L=a+b+c
print S
print L
print h
a,b=int(print())
if (a+b)%2==0:
  print((a+b)/2)
if (a+b)%2==1:
  print((a+b+1)/2)

### FIXED CODE ###

a,b=map(int,input().split())
if (a+b)%2==0:
  print(int((a+b)/2))
else:
  print(int((1+a+b)/2))
import statistics
import math

MOD = 10**9+7


def main():
    n = int(input())
    x = list(map(int, input().split()))

    c = 0
    t = 0
    for i in range(n-1):
        c += 1/(i+1) % MOD
        t += c * (x[i+1]-x[i])
        t %= MOD

    print(int(t * math.factorial(n-1) % MOD))


main()


### FIXED CODE ###

import statistics
import math

MOD = 10**9+7


def main():
    n = int(input())
    x = list(map(int, input().split()))

    c = 0
    t = 0
    for i in range(n-1):
        c += pow(i+1, MOD-2, MOD)
        t += c * (x[i+1]-x[i])
        t %= MOD

    fact = math.factorial(n-1) % MOD
    print(t * fact % MOD)


main()
S = input()
count = 0
list = []

for c in S:
  if c == 'A' or c == 'C' or c == 'G' or c == 'T':
    count+=1
  else:
    list.append(count)
    count = 0

print(max(list))
    

### FIXED CODE ###

S = input()
count = 0
list = []

for c in S:
  if c == 'A' or c == 'C' or c == 'G' or c == 'T':
    count+=1
  else:
    list.append(count)
    count = 0
list.append(count)

if len(list)==0:
    print('0')
else:
    print(max(list))
s = input() 
t = input()

ans = 0

for i in range(3){
	if s[i]=t[i]
		ans += ans

print(ans)

### FIXED CODE ###

s = input()
t = input()

ans = 0

for i in range(3):
	if s[i]==t[i]:
		ans += 1
print(ans)
n = int(input())

divisors = []
for i in range(1, int(n**0.5)+1):
    if n % i == 0:
        divisors.append(i)
        if i != n // i:
            divisors.append(n // i)
a = divisors[-1]
b = divisors[-2]
print(a + b - 2)

### FIXED CODE ###

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

if 1 <= a <= 9:
    if 1 <= b <= 9:
        print(a * b)
        exit()
print("-1")
import sys
import math

lines = str(sys.stdin.read()).strip().split("\n")

for line in lines:
    line = int(line)
    pList = []
    sList = list(reversed(list(range(3, line + 1))[::2]))
    while sList[-1] < math.ceil(math.sqrt(line)) + 1 :
        pList.append(sList.pop())
        for p in pList:
            sList = list(filter(lambda i: i % p != 0, sList))
    print(len(sList) + len(pList) + 1)

### FIXED CODE ###

import sys
import math


LIMIT = 1000000
p = 2
pList = [True] * (LIMIT + 1)


while p ** 2 <= LIMIT:
    if(pList[p]):
        for i in range(p * 2, LIMIT + 1 , p):
            pList[i] = False
    p += 1

# print(pList)


lines = str(sys.stdin.read()).strip().split("\n")

for line in lines:
    line = int(line)
    count = 0
    for i in range(2, line + 1):
        if pList[i]:
            count += 1
    print(count)
import math
a, b, x = map(int, input().split())
h = x / (a ** 2)
s = x / s
if h > b / 2:
    ans = math.atan((b - h) * 2 / a)
    print(math.degrees(ans))
else:
    ans = math.atan(b ** 2 / (2 * s))
    print(math.degrees(ans))

### FIXED CODE ###

import math
a, b, x = map(int, input().split())
h = x / (a ** 2)
s = x / a
if h > b / 2:
    ans = math.atan((b - h) * 2 / a)
    print(math.degrees(ans))
else:
    ans = math.atan(b ** 2 / (2 * s))
    print(math.degrees(ans))
from bisect import bisect_left


def main():
    n, m, k = map(int, input().split())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    for i in range(1, n):
        a[i] += a[i - 1]
    for i in range(1, m):
        b[i] += b[i - 1]
    answer = 0
    if a[-1] + b[-1] <= k:
        print(n + m)
    else:
        for i in range(n):
            l = bisect_left(b, k - a[i])
            diff = 1 if b[l] == k - a[i] else 0
            answer = max(answer, i + 1 + l + diff)
        print(answer)


if __name__ == '__main__':
    main()



### FIXED CODE ###

from bisect import bisect_right


def main():
    n, m, k = map(int, input().split())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    answer = 0
    is_changed = False
    if a[0] <= k or b[0] <= k:
        answer = 1
    elif a[0] + b[0] <= k:
        answer = 2
    for i in range(1, n):
        a[i] += a[i - 1]
        if k < a[i] and not is_changed:
            answer = i
            is_changed = True
    if a[-1] <= k:
        answer = n
    is_changed = False
    for i in range(1, m):
        b[i] += b[i - 1]
        if k < b[i] and not is_changed:
            answer = max(answer, i)
            is_changed = True
    if b[-1] <= k:
        answer = max(answer, m)
    if a[-1] + b[-1] <= k:
        answer = n + m
    elif all(k < x for x in [a[0], b[0], a[0] + b[0]]):
        answer = 0
    else:
        for i in range(n):
            l = bisect_right(b, k - a[i])
            if l == 0 or (l == m and b[l - 1] + a[i] > k):
                continue
            answer = max(answer, i + 1 + l)
    print(answer)


if __name__ == '__main__':
    main()
import sys
sys.setrecursionlimit(10 ** 7)

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N,M = map(int,readline().split())
A = [True] * (N+10)
MOD = 10 ** 9 + 7
for _ in range(M):
  x = int(readline())
  A[x] = False


DP = [0] * (N+1)
DP[0] = 1

for i in range(N):
  if not A[i]:
    continue
  
  if A[i+1]:
    DP[i+1] += DP[i]
    DP[i+1] %= MOD
  if A[i+2]:
    DP[i+2] += DP[i]
    DP[i+2]: %= MOD
       
print(DP[N]%MOD)
      
  




### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 7)

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N,M = map(int,readline().split())
A = [True] * (N+10)
MOD = 10 ** 9 + 7
for _ in range(M):
  x = int(readline())
  A[x] = False


DP = [0] * (N+10)
DP[0] = 1

for i in range(N):
  if not A[i]:
    continue
  
  if A[i+1]:
    DP[i+1] += DP[i]
    DP[i+1] %= MOD
  if A[i+2]:
    DP[i+2] += DP[i]
    DP[i+2] %= MOD
       
print(DP[N]%MOD)