Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

N, A=map(int, input().split())
x=list(map(int, input().split()))

dp=[[[0]*2501 for j in range(N+1)] for i in range(N)]

dp[0][0][0]=1
dp[0][1][x[0]]=1
for i in range(1, N):
  dp[i][0][0]=1
  for j in range(1, i+2):
    for k in range(2501):
      if k-x[i]>=0:
        dp[i][j][k]=dp[i-1][j-1][k-x[i]]+dp[i-1][j][k]
      else:
        dp[i][j][k]=dp[i-1][j][k]
        
print(sum([dp[-1][j][A*j] for j in range(1, N+1)]))

### FIXED CODE ###

N, A=map(int, input().split())
x=list(map(int, input().split()))

dp=[[[0]*2501 for j in range(N+1)] for i in range(N)]

dp[0][0][0]=1
dp[0][1][x[0]]=1
for i in range(1, N):
  dp[i][0][0]=1
  for j in range(1, i+2):
    for k in range(2501):
      if k-x[i]>=0:
        dp[i][j][k]=dp[i-1][j-1][k-x[i]]+dp[i-1][j][k]
      else:
        dp[i][j][k]=dp[i-1][j][k]
        
print(sum([dp[-1][j][A*j] for j in range(1, N+1)]))
### BUGGY CODE ###

def main():
	total = input()
	a = list(int(x) for x in input().split())
	a.sort()
	cntItem = 0
	cntRem = 0
	i = 0

	while i < int(total):
		cntItem = a.count(a[i])
		if a[i] < cntItem:
			cntRem+= cntItem - a[i]
		elif a[i] > cntItem:
			cntRem+= cntItem
		i+= cntItem
    
	print(cntRem)


if __name__=='__main__':
    main()

### FIXED CODE ###

import collections

#文字列を一文字ずつ取得したいとき
def inputStrOnebyOne():
    s = list(input())
    return s

#整数を一つずつリストに入れる
def inputOnebyOne_Int():
    a = list(int(x) for x in input().split())
    return a

def main():
	n = input()
	a = list(map(int,input().split()))
	c = collections.Counter(a)
	cntRem = 0

	for key, val in c.items():
		if key < val:
			cntRem+= val - key
		elif key > val:
			cntRem+= val
	print(cntRem)

if __name__=='__main__':
    main()
### BUGGY CODE ###

from numba import jit

@jit
def gcd(a,b):
    if b == 0: return a
    else: return gcd(b, a % b)

K = int(input())

ans = 0
for i in range(1,K+1):
    for j in range(1,K+1):
        for k in range(1,K+1):
            ans += gcd(gcd(i,j),k)
print(ans)

### FIXED CODE ###

from numba import jit

@jit
def gcd(a,b):
    if b == 0: return a
    else: return gcd(b, a % b)

@jit
def main2(K):
    ans = 0
    for i in range(1,K+1):
        for j in range(1,K+1):
            tmp = gcd(i,j)
            for k in range(1,K+1):
                ans += gcd(tmp,k)
    return ans    


K = int(input())
print(main2(K))
### BUGGY CODE ###

# fp = open("input/21")
# input = fp.readline
n,s = [int(c) for c in input().split()]
a = [int(c) for c in input().split()]
# t[i][j] : 0<=r<...,<l=iについて和がsになるようなf(r,l)の和
t = [[0]*(s+1) for _ in range(n)]
if a[0]<=s:
    t[0][a[0]] = 1
for i in range(n):
    t[i][0] = i+2
for i in range(1,n):
    for j in range(1,s+1):
        tt = t[i-1][j]
        if j-a[i]>=0:
            tt += t[i-1][j-a[i]]
        t[i][j] = tt
print(sum(t[i][s] for i in range(n))%998244353)

### FIXED CODE ###



n, s = list(map(int, input().split()))
a = list(map(int, input().split()))
dp = [[None] * (s+1) for _ in range(n+1)]
M = 998244353


for j in range(s+1):
    dp[0][j] = 0
for i in range(n+1):
    dp[i][0] = i+1

for i in range(1,n+1):
    for j in range(1, s+1):
        dp[i][j] = dp[i-1][j]
        if j-a[i-1]>=0:
            dp[i][j] += dp[i-1][j-a[i-1]]
        dp[i][j] %= M
print(sum((dp[i][s] for i in range(n+1)))%M)
### BUGGY CODE ###

#!/usr/bin/env python3
import sys
import itertools as it

d = {}
def _gcd(a,b):
    a, b = max(a,b), min(a,b)
    while b:
        if d.get((a, b), False):
            return d[(a, b)]
        else:
            a, b = b, a%b

    d[(a, b)] = a
    return a

# def _gcd(a,b):
#     a, b = max(a,b), min(a,b)
#     if b == 0:
#         d[(a, b)] = a
#         return a
#     elif d.get((a, b), False):
#         return d[(a, b)]
#     else:
#         ans = _gcd(b, a%b)
#         d[(a, b)] = ans
#         return ans

def gcd(a,b,c):
    return _gcd(a, _gcd(b,c))

def solve(K: int):
    ans = 0
    r = range(1, K+1)
    for (a,b,c) in it.product(r,r,r):
        ans += gcd(a,b,c)
    print(ans)
    return


# 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()
    K = int(next(tokens))  # type: int
    solve(K)

if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys
import itertools as it
import numpy as np
from collections import Counter
d = {}
def _gcd(a,b):
    a, b = max(a,b), min(a,b)
    while b:
        if d.get((a, b), False):
            return d[(a, b)]
        else:
            a, b = b, a%b

    d[(a, b)] = a
    return a

# def _gcd(a,b):
#     a, b = max(a,b), min(a,b)
#     if b == 0:
#         d[(a, b)] = a
#         return a
#     elif d.get((a, b), False):
#         return d[(a, b)]
#     else:
#         ans = _gcd(b, a%b)
#         d[(a, b)] = ans
#         return ans

def gcd(a,b,c):
    return _gcd(a, _gcd(b,c))

def solve(K: int):
    # val_arr = np.zeros(201,201)
    # cnt_arr = np.zeros(201,201)
    r = range(1, K+1)

    arr = []
    for (a,b) in it.product(r,r):
        arr.append(_gcd(a,b))
        # val_arr[a,b] += _gcd(a,b)
        # cnt_arr[a,b] += 1

    ans = 0
    cnt_dict = Counter(arr)
    for i in r:
        for key, cnt in cnt_dict.items():
            ans += _gcd(i,key)*cnt

    print(ans)
    return


# 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()
    K = int(next(tokens))  # type: int
    solve(K)

if __name__ == '__main__':
    main()
### BUGGY CODE ###


class BIT:
    # 1-indexed
    def __init__(self, n):
        self.size = n + 1
        self.bit = [0] * self.size

    def add(self, i, x):
        # Add x to a[i]
        while i < self.size:
            self.bit[i] += x
            i += i & -i

    def sumup(self, i):
        # Sum a[1]~a[i]
        res = 0
        while i > 0:
            res += self.bit[i]
            i -= i & -i
        return res

    def query(self, i, j):
        # Sum a[i]~a[j]
        return self.sumup(j) - self.sumup(i - 1)


N, Q = map(int, input().split())
C = list(map(int, input().split()))
X = [list(map(int, input().split())) for _ in range(Q)]

ans = [0] * Q
bit = BIT(N + 1)
last = [0] * (N + 1)
k = 0
for i, (l, r) in sorted(enumerate(X), key=lambda x: x[1][1]):
    for j in range(k + 1, r + 1):
        if last[C[j - 1]] > 0:
            bit.add(last[C[j - 1]], -1)

        bit.add(j, 1)
        last[C[j - 1]] = j

    k = r

    # Answer query
    ans[i] = bit.query(l, r)

print(*ans, sep="\n")


### FIXED CODE ###

class BIT:
    # 1-indexed
    def __init__(self, n):
        self.size = n + 1
        self.bit = [0] * self.size

    def add(self, i, x):
        """Add x to a[i]."""
        while i < self.size:
            self.bit[i] += x
            i += i & -i

    def sumup(self, i):
        """Sum a[1]~a[i]."""
        res = 0
        while i > 0:
            res += self.bit[i]
            i -= i & -i
        return res

    def query(self, i, j):
        """Sum a[i]~a[j]."""
        return self.sumup(j) - self.sumup(i - 1)


N, Q = map(int, input().split())
C = list(map(int, input().split()))
X = [list(map(int, input().split())) for _ in range(Q)]

ans = [0] * Q
last_appeared = [0] * (N + 1)
bit = BIT(N + 1)
rm = 0
for i, (l, r) in sorted(enumerate(X), key=lambda x: x[1][1]):
    for j in range(rm + 1, r + 1):
        if last_appeared[C[j - 1]] > 0:
            bit.add(last_appeared[C[j - 1]], -1)
        last_appeared[C[j - 1]] = j
        bit.add(j, 1)

    rm = r
    ans[i] = bit.query(l, r)

print(*ans, sep="\n")
### BUGGY CODE ###

N = int(input())
a = list(map(int, input().split()))
cnt = 0
ans = 0
for x in range(min(a),max(a)+1):
    cnt = 0
    for i in a:
        if abs(i-x) == 0:
            cnt += 1
        elif abs(i-x) == 1:
            cnt += 1
    ans = max(cnt, ans)
print(ans)

### FIXED CODE ###

N = int(input())
a = list(map(int, input().split()))
cnt = [0]*(10**7)
for i in a:
    cnt[i-1] += 1
    cnt[i] += 1
    cnt[i+1] += 1
print(max(cnt))
### BUGGY CODE ###

import sys
N=int(input())

if 100<=N<=105:
    print(1)
    sys.exit()

min_=N//105
max_= N//100 + 1
#print(min_,max_)
count=0
for m in range(min_,max_):
    X = N - 100*m
    for i in range(0,X+1):
        for j in range(0,(X-i)//2 +1):
            for k in range(0,(X-i-2*j)//3 +1):
                for l in range(0,(X-i-2*j-3*k)//4 +1):
                    count+=1
                    if count >= 10**8:
                        print(0)
                        sys.exit()
                    temp = (X-i-2*j-3*k-4*l)
                    if (temp % 5 == 0) and (m-i-j-k-l-temp//5>=0):
                        a=m-i-j-k-l-temp//5
                        t=temp // 5
                        print(1)
                        #print(N,m,a,i,j,k,l,t,100*a+101*i+102*j+103*k+104*l+105*t)
                        sys.exit()
else:
    print(0)

### FIXED CODE ###

import sys
N=int(input())

if 100<=N<=105:
    print(1)
    sys.exit()

min_=N//105
max_= N//100 + 1
#print(min_,max_)
count=0
for m in range(min_,max_):
    X = N - 100*m
    for i in range(0,X+1):
        for j in range(0,(X-i)//2 +1):
            for k in range(0,(X-i-2*j)//3 +1):
                for l in range(0,(X-i-2*j-3*k)//4 +1):
                    count+=1
                    if count >= 5*10**7:
                        print(1)
                        sys.exit()
                    temp = (X-i-2*j-3*k-4*l)
                    if (temp % 5 == 0) and (m-i-j-k-l-temp//5>=0):
                        a=m-i-j-k-l-temp//5
                        t=temp // 5
                        print(1)
                        #print(N,m,a,i,j,k,l,t,100*a+101*i+102*j+103*k+104*l+105*t)
                        sys.exit()
else:
    print(0)
### BUGGY CODE ###

def main():
    n, k = map(int, input().split())
    tmp = list(map(int, input().split()))
    h = [0]
    for v in tmp:
        h.append(v)
    dp = [[float("inf")]*(n-k+1) for i in range(n+1)]
    dp[0][0] = 0
    for i in range(1, n+1):
        for j in range(1, n-k+1):
            tmp = float("inf")
            for l in range(i):
                p = max(0, h[i] - h[l])
                if tmp > dp[l][j-1] + p:
                    tmp = dp[l][j-1] + p
            dp[i][j] = tmp
    ans = float("inf")
    for i in range(n+1):
        if ans > dp[i][n-k]:
            ans = dp[i][n-k]
    print(ans)

if __name__ == "__main__":
    main()

### FIXED CODE ###

def main():
    n, k = map(int, input().split())
    tmp = list(map(int, input().split()))
    h = [0]
    for v in tmp:
        h.append(v)
    dp = [[float("inf")]*(n-k+1) for i in range(n+1)]
    dp[0][0] = 0
    for i in range(1, n+1):
        for j in range(1, n-k+1):
            tmp = float("inf")
            for l in range(i):
                p = max(0, h[i] - h[l])
                if tmp > dp[l][j-1] + p:
                    tmp = dp[l][j-1] + p
            dp[i][j] = tmp
    ans = float("inf")
    for i in range(n+1):
        if ans > dp[i][n-k]:
            ans = dp[i][n-k]
    print(ans)

if __name__ == "__main__":
    main()
### BUGGY CODE ###

n,m=map(int,input().split())

if m==0:
    print(0,0)
    import sys
    sys.exit()

correct=[]
data={}

for i in [list(input().split()) for _ in range(m)]:
    if i[0] in correct:
        continue
    else:
        if i[0] in data.keys():
            if i[1]=='WA': 
                data[i[0]]+=1
            else:
                correct.append(i[0])
        else:
            if i[1]=='WA':
                data[i[0]]=1
            else:
                data[i[0]]=0
                correct.append(i[0])
                
print(len(correct),sum([data[i] for i in correct]))

### FIXED CODE ###

n,m=map(int,input().split())

if m==0:
    print(0,0)
    import sys
    sys.exit()

p=[list(input().split()) for _ in range(m)]
correct=set([p[i][0] for i in range(m) if p[i][1]=='AC'])

s=set()
sum_wa=0

for i in [p[j] for j in range(m) if p[j][0] in correct]:
    if i[0] in s:
        continue
    else:
        if i[1]=='WA':
            sum_wa+=1
        else:
            s.add(i[0])

print(len(correct),sum_wa)
### BUGGY CODE ###

h, n = list(map(int,(input().split())))
a = list(map(int,(input().split())))
import sys
sys.setrecursionlimit(10 ** 9) #再帰用

a.sort()

if h >= n and n !=0 :
  for i in range(n):
    a.pop()
    ans = sum(a)
elif n ==0:
  ans = sum(a)
else:
  ans = 0
  
print(ans)

### FIXED CODE ###

h, n = list(map(int,(input().split())))
a = list(map(int,(input().split())))
import sys
sys.setrecursionlimit(10 ** 9) #再帰用

a.sort(reverse=True)

if h >= n and n !=0 :
  a = a[n:]
  ans = sum(a)
elif n ==0:
  ans = sum(a)
else:
  ans = 0
  
print(ans)
### BUGGY CODE ###

import numpy as np
N,M=map(int, input().split())
A=np.array(list(map(int, input().split())))
for i in range(M):
    A[A.argmax()]=A[A.argmax()]//2
print(sum(A))

### FIXED CODE ###

import heapq

N,M = map(int, input().split())
A = list(-int(i) for i in input().split()) 

heapq.heapify(A)

for i in range(M):
    x=heapq.heappop(A)//(-2)
    heapq.heappush(A, -x)

print(-sum(A))
### BUGGY CODE ###

import copy
def main():
    h, w = map(int, input().split())
    a = [list(map(int, input().split())) for _ in range(h)]
    b = [list(map(int, input().split())) for _ in range(h)]
    m = 3000
    dp = [[False]*(m+1) for _ in range(w)]
    c = [0]*w
    dp[0][abs(a[0][0] - b[0][0])] = True
    c[0] = abs(a[0][0] - b[0][0])
    for i in range(1, w):
        x = abs(a[0][i] - b[0][i])
        for j in range(min(c[i-1], m)+1):
            if dp[i-1][j]:
                if j+x <= m:
                    dp[i][j+x] = True
                    c[i] = max(c[i], j+x)
                dp[i][abs(j-x)] = True
    for i in range(1, h):
        for j in range(w):
            buf = [False]*(m+1)
            x = abs(a[i][j] - b[i][j])
            z = 0
            if 0 < j:
                z = min(max(c[j], c[j-1]), m)
            else:
                z = min(c[j], m)
            for k in range(z+1):
                f = False
                if j == 0:
                    if dp[0][k]:
                        f = True
                else:
                    if dp[j-1][k] or dp[j][k]:
                        f = True
                if f:
                    if k+x <= m:
                        buf[k+x] = True
                        c[j] = max(c[j], k+x)
                    buf[abs(k-x)] = True
            dp[j] = copy.deepcopy(buf)
    for i in range(m+1):
        if dp[w-1][i]:
            print(i)
            break

if __name__ == "__main__":
    main()

### FIXED CODE ###

import numpy as np
def main():
    h, w = map(int, input().split())
    a = [list(map(int, input().split())) for _ in range(h)]
    b = [list(map(int, input().split())) for _ in range(h)]
    n = 80*(80+80) + 10
    m = n//2
    dp = [[None]*w for i in range(h)]
    for i in range(h):
        for j in range(w):
            dp[i][j] = np.zeros(n, np.bool)
    dp[0][0][m+abs(a[0][0] - b[0][0])] = True
    dp[0][0][m-abs(a[0][0] - b[0][0])] = True
    for i in range(h):
        for j in range(w):
            x = abs(a[i][j] - b[i][j])
            if 0 < i and 0 < h:
                dp[i][j][x:] |= dp[i-1][j][:n-x]
                dp[i][j][:n-x] |= dp[i-1][j][x:]
                dp[i][j][x:] |= dp[i][j-1][:n-x]
                dp[i][j][:n-x] |= dp[i][j-1][x:]
            elif 0 < i:
                dp[i][j][x:] |= dp[i-1][j][:n-x]
                dp[i][j][:n-x] |= dp[i-1][j][x:]
            elif 0 < j:
                dp[i][j][x:] |= dp[i][j-1][:n-x]
                dp[i][j][:n-x] |= dp[i][j-1][x:]
    ans = float("inf")
    for i in range(m-80-1, m+80+2):
        if dp[h-1][w-1][i]:
            ans = min(ans, abs(m-i))
    print(ans)

if __name__ == "__main__":
    main()
### BUGGY CODE ###

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

for i in range(c):
    if a >= 1:
        a -= 1
    elif b >= 1:
        b -= 1

print(a, b)

### FIXED CODE ###

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

if a >= c:
    a = a - c
else:
    c = c - a
    a = 0
    b = b - c
    if b < 0:
        b = 0

print(a, b)
### BUGGY CODE ###

N = int(input())
A = [int(i) for i in input().split()]
A.sort()

def calc(a, b):
    while(a != b):
        largeNum = max(a, b)
        smallNum = min(a, b)
        largeNum -= smallNum
        a = largeNum
        b = smallNum
    return a

ans = 1
for i in range(0, N - 1):
    a = calc(A[i], A[i+1])
    A[i], A[i+1] = a, a
    if a == 1:
        break
else:
    ans = min(A)

print(ans)

### FIXED CODE ###

N = int(input())
A = [int(i) for i in input().split()]
A.sort(reverse = True)

def calc(a, b):
    largeNum = max(a, b)
    smallNum = min(a, b)
    while(largeNum != 0 and smallNum != 0):
        largeNum %= smallNum
        x = largeNum
        largeNum = smallNum
        smallNum = x
    return max(smallNum, largeNum)

ans = 1
for i in range(0, N - 1):
    a = calc(A[i], A[i+1])
    A[i], A[i+1] = a, a
    if a == 1:
        break
else:
    ans = min(A)

print(ans)
### BUGGY CODE ###

class Combination:
    def __init__(self,N):
        self.fact = [0 for _ in range(N+1)]
        self.N = N
        self.init_fact()
    
    def init_fact(self):
        self.fact[0] = 1
        self.fact[1] = 1
        for i in range(2,N + 1):
            self.fact[i] = self.fact[i-1] * i

    def calc(self,n,k):
        return self.fact[n] / (self.fact[k] * self.fact[n-k])

N = int(input())

A_num = [0 for _ in range(N + 1)]
A = []
comb = Combination(N)
ans = 0

for i in input().split(" "):
    A_num[int(i)] += 1
    A.append(int(i))

for i in A_num:
    if i < 2:
         continue
    else:
        ans += comb.calc(i,2)

for i in A:
    ans_tmp = ans - comb.calc(A_num[i],2)
    if (A_num[i] - 1) < 2:
        print(int(ans_tmp))
        continue
    else:
        ans_tmp += comb.calc(A_num[i] -1, 2)
        print(int(ans_tmp))
        continue

    print(int(ans))
    A_num[i] += 1

### FIXED CODE ###

class Combination:
    def __init__(self):
        self.fact = [0 for _ in range(100001)]
        self.init_fact()
    
    def init_fact(self):
        self.fact[0] = 1
        self.fact[1] = 1
        for i in range(2,100001):
            self.fact[i] = self.fact[i-1] * i
            print(self.fact[i])

    def calc(self,n,k):
        return int(self.fact[n] / (self.fact[k] * self.fact[n-k]))

N = int(input())

A_num = [0 for _ in range(N + 1)]
A = []
ans = 0

for i in input().split(" "):
    A_num[int(i)] += 1
    A.append(int(i))

for i in A_num:
    if i < 2:
         continue
    else:
        ans += i * (i - 1) // 2

for i in A:
    x = A_num[i]
    ans_tmp = ans - (x * (x - 1) // 2 )
    if (A_num[i] - 1) < 2:
        print(int(ans_tmp))
        continue
    else:
        ans_tmp += ((x - 1) * (x - 2) // 2 )
        print(int(ans_tmp))
        continue

    print(int(ans))
    A_num[i] += 1
### BUGGY CODE ###

n,m=map(int,input().split())
lst=[int(input()) for i in range(m)]
DP=[0]*(n+1)
temp=0
DP[0]=1
for i in range(1, n+1):
  if i==1 and i not in lst:
    DP[i]=1
  elif i==1 and i in lst:
    DP[i]=0
  elif i in lst:
    DP[i]=0
  else:
    DP[i]=(DP[i-1]+DP[i-2])%(10**9+7)
print(DP[n])

### FIXED CODE ###

N,M=map(int,input().split())
br=set([int(input()) for _ in range(M)])
dp=[0]*(N+1)
dp[0]=1
if not 1 in br:
    dp[1]=1
for i in range(2,N+1):
    if not i in br:
        dp[i]+=(dp[i-1]+dp[i-2])%1000000007
print(dp[-1])
### BUGGY CODE ###

"""
dp[t][v] = 時刻tに速度vで走っている時の今までの走行距離の最大値
dp[0][0] = 0, dp[0][i] = -inf(i>0)
条件を考える
  dp[t][v]について、時刻tにおける速度の最大値をM(t)とすると、
  v >  M[t] -> dp[v][t] = -inf
  v <= M[t] -> dp[v][t] = max(dp[t-1][v+1]+(2*v+1)/2, dp[t-1][v]+v, dp[t-1][v-1]+(2*v-1)/2)
ans = max(dp[sum(T)])
"""
from itertools import accumulate
U = 300
n = int(input())
T = [0] + list(map(lambda x:int(x)*2, input().split()))
V = list(map(lambda x:int(x)*2, input().split())) + [0]
S = sum(T)
M = [0]*(S+1)
K = list(accumulate(T))
for i in range(n):
  for j in range(K[i]+1, K[i+1]):
    M[j] = V[i]
  M[K[i+1]] = min(V[i], V[i+1])
dp = [[-float("inf")]*(U+1) for _ in range(S+1)]
dp[0][0] = 0
for t in range(1, S+1):
  for v in range(U+1):
    if v > M[t]:
      continue
    dp[t][v] = dp[t-1][v] + v
    if v > 0:
      dp[t][v] = max(dp[t][v], dp[t-1][v-1]+(2*v-1)/2)
    if v < U:
      dp[t][v] = max(dp[t][v], dp[t-1][v+1]+(2*v+1)/2)
ans = max(dp[S]) / 4
print(ans)

### FIXED CODE ###

"""
dp[t][v] = 時刻tに速度vで走っている時の今までの走行距離の最大値
dp[0][0] = 0, dp[0][i] = -inf(i>0)
条件を考える
  dp[t][v]について、時刻tにおける速度の最大値をM(t)とすると、
  v >  M[t] -> dp[v][t] = -inf
  v <= M[t] -> dp[v][t] = max(dp[t-1][v+1]+(2*v+1)/2, dp[t-1][v]+v, dp[t-1][v-1]+(2*v-1)/2)
ans = max(dp[sum(T)])
"""
from itertools import accumulate
U = 300
n = int(input())
T = [0] + list(map(lambda x:int(x)*2, input().split()))
V = list(map(lambda x:int(x)*2, input().split())) + [0]
S = sum(T)
M = [0]*(S+1)
K = list(accumulate(T))
for i in range(n):
  for j in range(K[i]+1, K[i+1]):
    M[j] = V[i]
  M[K[i+1]] = min(V[i], V[i+1])
dp = [[-float("inf")]*(U+1) for _ in range(S+1)]
dp[0][0] = 0
for t in range(1, S+1):
  for v in range(U+1):
    if v > M[t]:
      continue
    dp[t][v] = dp[t-1][v] + v
    if v > 0:
      dp[t][v] = max(dp[t][v], dp[t-1][v-1]+(2*v-1)/2)
    if v < U:
      dp[t][v] = max(dp[t][v], dp[t-1][v+1]+(2*v+1)/2)
ans = max(dp[S]) / 4
print(ans)
### BUGGY CODE ###

class UnionFind:
	def __init__(self, n):
		self.n = n
		self.root = [-1]*(n+1)
		self.rnk = [0]*(n+1)
		self.Maxroot = -1

	def Find_Root(self, x):
		if (self.root[x] < 0):
			return x
		else:
			self.root[x] = self.Find_Root(self.root[x])
			return self.root[x]

	def Unite(self, x, y):
		x = self.Find_Root(x)
		y = self.Find_Root(y)
		if x == y:
			return 
		elif self.rnk[x] > self.rnk[y]:
			self.root[x] += self.root[y]
			if self.root[x] < self.Maxroot:
				self.Maxroot = self.root[x]
			self.root[y] = x
		else:
			self.root[y] += self.root[x]
			if self.root[y] < self.Maxroot:
				self.Maxroot = self.root[y]
			self.root[x] = y
			if self.rnk[x] == self.rnk[y]:
				self.rnk[y] += 1

	def isSameGroup(self, x, y):
		return self.Find_Root(x) == self.Find_Root(y)

	def Count(self, x):
		return self.root[self.Find_Root(x)] * (-1)

N, M, K = map(int, input().split())

solve = UnionFind(N)
cntF = [0] * (N)
cntB = [0] * (N)
flg = [[0] * (N) for _ in range(N)]

for _ in range(M):
	ta,tb = map(int, input().split())
	ta -= 1
	tb -= 1
	cntF[ta] += 1
	cntF[tb] += 1
	solve.Unite(ta,tb)

	flg[ta][tb] = 1
	flg[tb][ta] = 1

for _ in range(K):
	tc,td = map(int, input().split())
	tc -= 1
	td -= 1
	if solve.isSameGroup(tc,td):
		cntF[tc] += 1
		cntF[td] += 1

ans = []
for i in range(N):
	ans.append(solve.Count(i) - cntF[i] - 1)
print(*ans)



### FIXED CODE ###

class UnionFind:
	def __init__(self, n):
		self.n = n
		self.root = [-1]*(n+1)
		self.rnk = [0]*(n+1)
		self.Maxroot = -1

	def Find_Root(self, x):
		if (self.root[x] < 0):
			return x
		else:
			self.root[x] = self.Find_Root(self.root[x])
			return self.root[x]

	def Unite(self, x, y):
		x = self.Find_Root(x)
		y = self.Find_Root(y)
		if x == y:
			return 
		elif self.rnk[x] > self.rnk[y]:
			self.root[x] += self.root[y]
			if self.root[x] < self.Maxroot:
				self.Maxroot = self.root[x]
			self.root[y] = x
		else:
			self.root[y] += self.root[x]
			if self.root[y] < self.Maxroot:
				self.Maxroot = self.root[y]
			self.root[x] = y
			if self.rnk[x] == self.rnk[y]:
				self.rnk[y] += 1

	def isSameGroup(self, x, y):
		return self.Find_Root(x) == self.Find_Root(y)

	def Count(self, x):
		return self.root[self.Find_Root(x)] * (-1)

N, M, K = map(int, input().split())

solve = UnionFind(N)
cntF = [0] * (N)

for _ in range(M):
	ta,tb = map(int, input().split())
	ta -= 1
	tb -= 1
	cntF[ta] += 1
	cntF[tb] += 1
	solve.Unite(ta,tb)

for _ in range(K):
	tc,td = map(int, input().split())
	tc -= 1
	td -= 1
	if solve.isSameGroup(tc,td):
		cntF[tc] += 1
		cntF[td] += 1

ans = []
for i in range(N):
	ans.append(solve.Count(i) - cntF[i] - 1)
print(*ans)