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
S
1
S
2
...
S
K
B
11
B
12
...
B
1
K
B
21
B
22
...
B
2
K
:
B
N
1
B
N
2
...
B
NK
N
and
K
indicate the number of family members and the number of blood types respectively.
S
i
is an integer that indicates the amount of blood of the
i
-th blood type that is in a fridge.
B
ij
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 ≤
S
i
≤ 100000
0 ≤
B
ij
≤ 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

Submitted solutions:

code_snippet: #include <stdio.h>
int s[200],b[200][200],sum[200];
int main()
{
    int i,j,n,k;
    bool flag;
    while(scanf("%d%d",&n,&k)==2)
    {
        if(n==0&&k==0)break;
        for(i=1;i<=k;i++)
        {
            scanf("%d",&s[i]);
        }
        flag=1;
        for(i=1;i<=k;i++)sum[i]=0;
        for(i=1;i<=n;i++)
        {
            for(j=1;j<=k;j++)
            {
                scanf("%d",&b[i][j]);
                sum[j]+=b[i][j];
            }

        }
        for(i=1;i<=k;i++)
        if(sum[i]>s[i]) flag=0;
        if(flag)printf("Yes\n");
        else printf("No\n");
    }
    return 0;
}
accuracy: 1
time_ms: 10
memory_kb: 2940
final_rank: 2

code_snippet: #include<bits/stdc++.h>
using namespace std;
int main(){
    
    int n, k, b, s[110];
    
    while(cin >> n >> k, n){
        vector<int> sum;
        string ans = "Yes";
        for(int i=0;i<k;i++) cin >> s[i];
        for(int i=0;i<n;i++){
            for(int j=0;j<k;j++){
                cin >> b;
                s[j] -= b;
                if(s[j]<0) ans = "No";
            }
        }
        cout << ans << endl;
    }
    
    return(0);
}
accuracy: 1
time_ms: 30
memory_kb: 3056
final_rank: 15

code_snippet: #include <iostream>
using namespace std;

const int MAX_K = 1000;

int main() {
  int N, K, i, j, S[MAX_K], B, a;

  while (a = 1, cin >> N >> K, N || K) {
    for (i = K; i--;)
      cin >> S[i];
    for (i = 0; i < N; ++i)
      for (j = K; j--;)
        cin >> B, S[j] -= B, S[j] < 0 ? a = 0 : 0;
    cout << (a ? "Yes" : "No") << endl;
  }

  return 0;
}
accuracy: 1
time_ms: 30
memory_kb: 3000
final_rank: 9

code_snippet: #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
  ios_base::sync_with_stdio(false);
  int N, K, B;
  while (cin >> N >> K, N || K) {
    vector<int> S(K);
    for (int i = K; i--;)
      cin >> S[i];
    for (int i = 0; i < N; ++i)
      for (int j = K; j--;)
        cin >> B, S[j] -= B;
    cout << (*min_element(S.begin(), S.end()) < 0 ? "No" : "Yes") << endl;
  }
  return 0;
}
accuracy: 1
time_ms: 10
memory_kb: 3164
final_rank: 6

code_snippet: #include <iostream>
#include <vector>

int main() {
  std::ios_base::sync_with_stdio(false);

  int N, K, i, j, B;
  bool a;

  while (true) {
    std::cin >> N >> K;
    if (N == 0 && K == 0) {
      break;
    }

    std::vector<int> S(K);
    for (i = 0; i < K; ++i) {
      std::cin >> S[i];
    }

    a = true;
    for (i = 0; i < N; ++i) {
      for (j = 0; j < K; ++j) {
        std::cin >> B;
        S[j] -= B;
        if (S[j] < 0) {
          a = false;
        }
      }
    }

    std::cout << (a ? "Yes" : "No") << std::endl;
  }

  return 0;
}
accuracy: 1
time_ms: 10
memory_kb: 3124
final_rank: 4

code_snippet: #include <iostream>
#include <vector>
using namespace std;

int main() {
  int N, K, i, j, B;
  bool a;
  while (a = true, cin >> N >> K, N || K) {
    vector<int> S(K); // Use std::vector instead of dynamic memory allocation

    for (i = 0; i < K; ++i) // Use a range-based for loop to read values into S
      cin >> S[i];

    for (i = 0; i < N; ++i) {
      for (j = 0; j < K; ++j) {
        cin >> B;
        S[j] -= B;
      }

      // Check if any value in S is negative
      for (j = 0; j < K; ++j) {
        if (S[j] < 0) {
          a = false;
          break;
        }
      }
    }

    cout << (a ? "Yes" : "No") << endl;
  }

  return 0;
}
accuracy: 1
time_ms: 30
memory_kb: 3076
final_rank: 17

code_snippet: #include <iostream>
using namespace std;
int main() {
  int N, K, i, j, S[1000], B, a = 1;
  while (cin >> N >> K, N || K) {
    for (i = K; i--;)
      cin >> S[i];
    for (i = 0; i < N; ++i)
      for (j = K; j--;)
        cin >> B, S[j] -= B, S[j] < 0 ? a = 0 : 0;
    cout << (a ? "Yes" : "No") << endl;
    a = 1; // Reset the flag for next iteration
  }
  return 0;
}
accuracy: 1
time_ms: 30
memory_kb: 2980
final_rank: 8

code_snippet: #include <iostream>
#include <vector>
using namespace std;
int main() {
  int N, K;
  while (cin >> N >> K, N || K) {
    int a = 1;
    vector<int> S(K);
    for (int i = K; i--;)
      cin >> S[i];
    for (int i = 0; i < N; ++i)
      for (int j = K; j--;) {
        int B;
        cin >> B;
        S[j] -= B;
        if (S[j] < 0) a = 0;
      }
    cout << (a ? "Yes" : "No") << endl;
  }
}
accuracy: 1
time_ms: 30
memory_kb: 3052
final_rank: 14

code_snippet: #include <iostream>
using namespace std;

const int MAX_K = 1e6; // assuming K does not exceed 1 million
int S[MAX_K];

int main() {
    int N, K, B;
    while (cin >> N >> K, N || K) {
        int a = 1;
        for (int i = K; i--;)
            cin >> S[i];
        for (int i = 0; i < N; ++i)
            for (int j = K; j--;) {
                cin >> B;
                S[j] -= B;
                if (S[j] < 0) a = 0;
            }
        cout << (a ? "Yes" : "No") << endl;
    }
}
accuracy: 1
time_ms: 30
memory_kb: 3004
final_rank: 11

code_snippet: #include <cstdio>
const int MAX_K = 1000; // Replace 1000 with maximum possible K
int main() {
  int N, K, i, j, S[MAX_K], B, a;
  while (scanf("%d %d", &N, &K), N || K) {
    a = 1;
    for (i = 0; i < K; ++i)
      scanf("%d", &S[i]);
    for (i = 0; i < N; ++i)
      for (j = 0; j < K; ++j) {
        scanf("%d", &B);
        S[j] -= B;
      }
    for (j = 0; j < K; ++j)
      if (S[j] < 0) {
        a = 0;
        break;
      }
    printf("%s\n", (a ? "Yes" : "No"));
  }
  return 0;
}
accuracy: 1
time_ms: 10
memory_kb: 2504
final_rank: 1

code_snippet: #include <iostream>
#include <vector>
using namespace std;

int main() {
    int N, K, i, j, B, a;
    while (a = 1, cin >> N >> K, N || K) {
        vector<int> S(K);
        for (i = K; i--;)
            cin >> S[i];
        for (i = 0; i < N; ++i)
            for (j = K; j--;)
                cin >> B, S[j] -= B, S[j] < 0 ? a = 0 : 0;
        cout << (a ? "Yes" : "No") << endl;
    }
    return 0;
}
accuracy: 1
time_ms: 30
memory_kb: 3076
final_rank: 17

code_snippet: #include <iostream>
using namespace std;
int main() {
  int N, K, i, j, *S, B;
  bool result;
  while (cin >> N >> K, N) {
    S = new int[K];
    for (i = K; i--;)
      cin >> S[i];
    result = true;
    for (i = 0; i < N; ++i)
      for (j = K; j--;)
        cin >> B, S[j] -= B, result = result && S[j] >= 0;
    cout << (result ? "Yes" : "No") << endl;
    delete[] S;
  }
}
accuracy: 1
time_ms: 30
memory_kb: 3068
final_rank: 16

code_snippet: #include <iostream>
#include <vector>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N, K, B, a;
  while (a = 1, cin >> N >> K, N || K) {
    vector<int> S(K);
    for (int i = K; i--;)
      cin >> S[i];
    for (int i = 0; i < N; ++i)
      for (int j = K; j--;)
        cin >> B, S[j] -= B, S[j] < 0 ? a = 0 : 0;
    cout << (a ? "Yes" : "No") << '\n';
  }
}
accuracy: 1
time_ms: 10
memory_kb: 3124
final_rank: 4

code_snippet: #include <iostream>
using namespace std;
int main() {
  int N, K, i, j, *S, B, a;
  while (a = 1, cin >> N >> K, N || K) {
    S = new int[K];
    for (i = K; i--;)
      cin >> S[i];
    for (i = N; i--;)
      for (j = K; j--;)
        cin >> B, S[j] -= B, S[j] < 0 ? a = 0 : 0;
    cout << (a ? "Yes" : "No") << endl;
  }
}
accuracy: 1
time_ms: 30
memory_kb: 3000
final_rank: 9

code_snippet: #include <iostream>
using namespace std;
int main() {
  int N, K, i, j, *S, B, a;
  while (a = 1, cin >> N >> K, N || K) {
    S = new int[K];
    for (i = K; i--;)
      cin >> S[i];
    for (i = 0; i < N; ++i)
      for (j = K; j--;)
        cin >> B, S[j] -= B, S[j] < 0 ? a = 0 : 0;
    cout << (a ? "Yes" : "No") << endl;
  }
}
accuracy: 1
time_ms: 30
memory_kb: 3004
final_rank: 11

code_snippet: #include <bits/stdc++.h>
using namespace std;
int main() {
  int N, K, i, j, *S, B, a;
  while (a = 1, cin >> N >> K, N || K) {
    S = new int[K];
    for (i = K; i--;)
      cin >> S[i];
    for (i = 0; i < N; ++i)
      for (j = K; j--;)
        cin >> B, S[j] -= B, S[j] < 0 ? a = 0 : 0;
    cout << (a ? "Yes" : "No") << endl;
  }
}
accuracy: 1
time_ms: 30
memory_kb: 3084
final_rank: 19

code_snippet: #include <iostream>
using namespace std;
int main() {
  int N, K, i, j, *S, B, a;
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  while (a = 1, cin >> N >> K, N || K) {
    S = new int[K];
    for (i = K; i--;)
      cin >> S[i];
    for (i = 0; i < N; ++i)
      for (j = K; j--;)
        cin >> B, S[j] -= B, S[j] < 0 ? a = 0 : 0;
    cout << (a ? "Yes" : "No") << endl;
    delete[] S; // free memory
  }
}
accuracy: 1
time_ms: 10
memory_kb: 3032
final_rank: 3

code_snippet: #include <iostream>
using namespace std;
int main() {
  int N, K, i, j, B, a;
  while (a = 1, cin >> N >> K, N || K) {
    int S[K];
    for (i = 0; i < K; ++i)
      cin >> S[i];
    for (i = 0; i < N; ++i)
      for (j = 0; j < K; ++j)
        cin >> B, S[j] -= B, S[j] < 0 ? a = 0 : 0;
    cout << (a ? "Yes" : "No") << endl;
  }
}
accuracy: 1
time_ms: 30
memory_kb: 3092
final_rank: 20

code_snippet: #include <iostream>
using namespace std;
int main() {
  int N, K, i, j, B, a;
  while (a = 1, cin >> N >> K, N || K) {
    int S[K];
    for (i = K; i--;)
      cin >> S[i];
    for (i = 0; i < N; ++i)
      for (j = K; j--;)
        cin >> B, S[j] -= B, S[j] < 0 ? a = 0 : 0;
    cout << (a ? "Yes" : "No") << endl;
  }
}
accuracy: 1
time_ms: 30
memory_kb: 3028
final_rank: 13

code_snippet: #include <iostream>
using namespace std;
int main() {
  int N, K, i, j, *S, B, a;
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  while (a = 1, cin >> N >> K, N || K) {
    S = new int[K];
    for (i = K; i--;)
      cin >> S[i];
    for (i = 0; i < N; ++i)
      for (j = K; j--;)
        cin >> B, S[j] -= B, S[j] < 0 ? a = 0 : 0;
    cout << (a ? "Yes" : "No") << endl;
    delete[] S;
  }
}
accuracy: 1
time_ms: 10
memory_kb: 3180
final_rank: 7