Problem:


Problem A: Vampirish Night

There is a vampire family of N members.  Vampires are also known as extreme gourmets.  Of course vampires' foods are human blood.  However, not all kinds of blood is acceptable for them.  Vampires drink blood that K blood types of ones are mixed, and each vampire has his/her favorite amount for each blood type.

You, cook of the family, are looking inside a fridge to prepare dinner.  Your first task is to write a program that judges if all family members' dinner can be prepared using blood in the fridge.

Input

Input file consists of a number of data sets.
One data set is given in following format:

N K
S1 S2 ... SK
B11 B12 ... B1K
B21 B22 ... B2K
:
BN1 BN2 ... BNK

N and K indicate the number of family members and the number of blood types respectively.

Si is an integer that indicates the amount of blood of the i-th blood type that is in a fridge.

Bij is an integer that indicates the amount of blood of the j-th blood type that the i-th vampire uses.

The end of input is indicated by a case where N = K = 0.  You should print nothing for this data set.

Output

For each set, print "Yes" if everyone's dinner can be prepared using blood in a fridge, "No" otherwise (without quotes). 

Constraints

Judge data includes at most 100 data sets.

1 ≤ N ≤ 100

1 ≤ K ≤ 100

0 ≤ Si ≤ 100000

0 ≤ Bij ≤ 1000

Sample Input

2 3
5 4 5
1 2 3
3 2 1
3 5
1 2 3 4 5
0 1 0 1 2
0 1 1 2 2
1 0 3 1 1
0 0

Output for the Sample Input

Yes
No



Sample input:
2 3
5 4 5
1 2 3
3 2 1
3 5
1 2 3 4 5
0 1 0 1 2
0 1 1 2 2
1 0 3 1 1
0 0


Sample output:
Yes
No

Submission status: Wrong Answer

Solution code:

while True:
    N, K = [int(n) for n in input().split()]

    if (N == 0 and K == 0):
        quit()

    fridge = [int(n) for n in input().split()]
    vampires = []

    for x in range(N):
        blood = [int(n) for n in input().split()]
        fridge = [fridge[i] - blood[i] for i in range(K)]

    if len([n for n in fridge if n < 0]) >= 1:
        print("NO")
    else:
        print("YES")

Submission status: Wrong Answer

Solution code:
while True:
    N, K = [int(n) for n in input().split()]

    if (N == 0 and K == 0):
        break

    fridge = [int(n) for n in input().split()]
    vampires = []

    for x in range(N):
        blood = [int(n) for n in input().split()]
        fridge = [fridge[i] - blood[i] for i in range(K)]

    if len([n for n in fridge if n < 0]) >= 1:
        print("NO")
    else:
        print("YES")

Submission status: Wrong Answer

Solution code:
while True:
	a,b = map(int,input().split())
	if a == 0:
		break
		
	data = []
	
	for i in range(0,a+1):
		data.append(list(map(int,input().split())))
		
	sum = []
	
	for i in range(0,b):
		sum.append(0)
		
	for x in data[1:]:
		for y in range(0,b):
			sum[y] += x[y]
	
	if all((data[0][x] > sum[x] for x in (0,len(sum)-1))):
		print("Yes")
	else:
		print("No")

Submission status: Wrong Answer

Solution code:
while True:
	a,b = map(int,input().split())
	if a == 0 and b == 0:
		break
		
	data = []
	
	for i in range(0,a+1):
		data.append(list(map(int,input().split())))
		
	sum = []
	
	for i in range(0,b):
		sum.append(0)
		
	for x in data[1:]:
		for y in range(0,b):
			sum[y] += x[y]
	
	if all((data[0][x] > sum[x] for x in (0,len(sum)-1))):
		print("Yes")
	else:
		print("No")

Submission status: Wrong Answer

Solution code:
[n,k],s=[map(int, raw_input().split()) for i in xrange(2)]
for i in xrange(n):
    b = map(int, raw_input().split())
    for j in xrange(k):
        s[j] -= b[j]
print "Yes" if len(filter(lambda x:x<0, s))==0 else "No"

Submission status: Accepted

Solution code:
while 1:
    n, k = map(int, raw_input().split())
    if n == 0: break
    l = map(int, raw_input().split())
    for _ in range(n):
        m = map(int, raw_input().split())
        for i in range(k):
            l[i] -= m[i]
    print "No" if min(l) < 0 else "Yes"

Submission status: Accepted

Solution code:
while True:
	n,k = map(int,raw_input().split())
	if n == 0 and k == 0:
		break
	
	fridge = map(int,raw_input().split())
	
	judge = False
	for i in xrange(n):
		uses = map(int,raw_input().split())
		for j in xrange(k):
			fridge[j] -= uses[j]
			if fridge[j] < 0:
				judge = True
				
	if judge:
		print "No"
	else:
		print "Yes"

Submission status: Accepted

Solution code:
while True:
    n, k = map(int, input().split())
    if n + k == 0: break

    s = list(map(int, input().split()))
    for _ in range(n):
        b = list(map(int, input().split()))
        for j, _b in enumerate(b):
            s[j] = s[j] - _b

    bool_list = list(map(lambda x: x >= 0,s))
    if False in bool_list:
        print('No')
    else:
        print('Yes')

Submission status: Accepted

Solution code:
while 1:
    n,k=map(int,input().split())
    if n==0:break
    a=[int(i) for i in input().split()]
    for _ in range(n):
        b=list(map(int,input().split()))
        for j,c in enumerate(b):
            a[j]-=c
    f=0
    for i in range(k):
        if a[i]<0:
            f=1
            break
    print('No' if f else 'Yes')

Submission status: Accepted

Solution code:
while True:
    N, K = map(int, input().split())
    if N == 0:
        break
    S = [0] + list(map(int, input().split()))
    flag = True
    for _ in range(N):
        B = list(map(int, input().split()))
        for i, b in enumerate(B):
            S[i+1] -= b
            if S[i+1] < 0:
                flag = False
                break
    print("Yes" if flag else "No")

Submission status: Accepted

Solution code:
def judge(stock, require):
	for i in range(0, len(stock)):
		if stock[i] < require[i]:
			return 'No'
	return 'Yes'

while True:
	inpt = map(int, raw_input().split())
	if inpt[0] == 0:
		break
	else:
		n = inpt[0]
		k = inpt[1]
		stock = map(int, raw_input().split())
		require = []
		for i in range(0, k):
			require.append(0)

		for i in range(0, n):
			blood = map(int, raw_input().split())
			for j in range(0, k):
				require[j] += blood[j]

		print judge(stock, require)

Submission status: Accepted

Solution code:
while True:
    n,k = map(int, input().split())
    if n == k == 0:
        break
    s = list(map(int, input().split()))
    for _ in range(n):
        b = list(map(int, input().split()))
        for i in range(k):
            s[i] -= b[i]
    print("Yes" if min(s) >= 0 else "No")

Submission status: Accepted

Solution code:
while True:
    n,k = map(int, input().split())
    if n == k == 0:
        break
    s = [int(x) for x in input().split()]
    for _ in range(n):
        b = [int(x) for x in input().split()]
        for i in range(k):
            s[i] -= b[i]
    print("Yes" if min(s) >= 0 else "No")

Submission status: Accepted

Solution code:
# AOJ 1019: Vampirish Night
# Python3 2018.7.4 bal4u

while True:
	n, k = map(int, input().split())
	if n == 0: break
	s = list(map(int, input().split()))
	b = [0]*k
	for i in range(n):
		a = list(map(int, input().split()))
		for j in range(k): b[j] += a[j]
	ans = True
	for i in range(k):
		if b[i] > s[i]:
			ans = False
			break
	print("Yes" if ans else "No")

Submission status: Accepted

Solution code:
while True:
    N,K=map(int,raw_input().split())
    if N==K==0:break
    S=map(int,raw_input().split())
    L=[0]*K
    for i in range(N):
        temp=map(int,raw_input().split())
        for j in range(K):
            L[j]+=temp[j]
    for i in range(K):
        if S[i]-L[i]<0:
            print "No"
            break
    else:
        print "Yes"

Submission status: Accepted

Solution code:
while True:
    n,k=map(int, raw_input().split())
    if n==0 and k==0:
         break
    s = map(int, raw_input().split())
    for i in xrange(n):
        b = map(int, raw_input().split())
        for j in xrange(k):
            s[j] -= b[j]
    print "Yes" if len(filter(lambda x:x<0, s))==0 else "No"

Submission status: Accepted

Solution code:
while 1:
	N,K = map(int,raw_input().split())
	if N == 0: break
	S = map(int,raw_input().split())
	B = [map(int,raw_input().split()) for i in range(N)]
	for breed in B:
		for i in range(K):
			S[i] -= breed[i]
	print "Yes" if min(S) >= 0 else "No"

Submission status: Accepted

Solution code:
while True :
    N, K = map(int, input().split())
    if N == 0 and K == 0 :
        break
    
    S = list(map(int, input().split()))
    total_B = [0] * K
    for i in range(N) :
        B = list(map(int, input().split()))
        for j in range(K) :
            total_B[j] += B[j]
            
    ans = 'Yes'
    for i in range(K) :
        if S[i] < total_B[i] :
            ans = 'No'
            break
    print(ans)

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    while True:
        N, K = list(map(int, input().strip().split()))
        if N == 0 and K == 0:
            break

        lims = list(map(int, input().strip().split()))
        totals = [ 0 for _ in range(K) ]
        
        for _ in range(N):
            arr = list(map(int, input().strip().split()))
            for i in range(K):
                totals[i] += arr[i]
        
        tarimasu = True
        for i in range(K):
            if totals[i] > lims[i]:
                tarimasu = False
                break
        
        print("Yes" if tarimasu else "No")

Submission status: Accepted

Solution code:
while True:
  n, k = map(int, input().split())
  if n == 0:
    break

  s_list = list(map(int, input().split()))
  for _ in range(n):
    b_list = list(map(int, input().split()))
    for i in range(k):
      s_list[i] -= b_list[i]
  for s in s_list:
    if s < 0:
      print("No")
      break
  else:
    print("Yes")

Submission status: Runtime Error

Solution code:
import numpy as np

while True:
    N, K = [int(n) for n in input().split()]

    if (N == 0 and K == 0):
        quit()

    fridge = np.array([int(n) for n in input().split()])
    vampires = []

    for x in range(N):
        blood = np.array([int(n) for n in input().split()])
        fridge -= blood

    if len([n for n in fridge if n < 0]) >= 1:
        print("NO")
    else:
        print("YES")

Submission status: Runtime Error

Solution code:
ans = []
while True:
    tmp = raw_input()
    if tmp =='0 0':
        break
    tmp = tmp.split()
    n = int(tmp[0])
    m = int(tmp[1])
    p = 0
    blood = raw_input().split()
    for i in range(m):
        blood[i] = int(blood[i])
    flag = 0
    while p != n:
        if flag == 1:
            break
        tmp = raw_input().split()
        for i in range(m):
            blood[i] -= int(tmp[i])
            if blood[i] < 0:
                flag = 1
        p += 1
    if flag == 0:
        ans.append("Yes")
    else:
        ans.append("No")
for i in ans:
    print i

Submission status: Runtime Error

Solution code:
ans = []
while True:
    tmp = raw_input()
    if tmp =='0 0':
        break
    tmp = tmp.split()
    n = int(tmp[0])
    m = int(tmp[1])
    p = 0
    blood = raw_input().split()
    for i in range(m):
        blood[i] = int(blood[i])
    flag = 0
    while p != n:
        if flag == 1:
            break
        tmp = raw_input().split()
        for i in range(m):
            blood[i] -= int(tmp[i])
            if blood[i] < 0:
                flag = 1
        p += 1
    if flag == 0:
        ans.append("Yes")
    else:
        ans.append("No")

for i in ans:
    print i

Submission status: Runtime Error

Solution code:
while 1:
	N,K = map(int,raw_input().split())
	if N == 0: break
	S = map(int,raw_input().split())
	for j in range(N):
		B = map(int,raw_input().split())
		for i in range(K):
			S[i] -= B[i]
		if min(S) < 0: break
	print "Yes" if min(S) >= 0 else "No"