alexjercan/bugnet huggingface dataset:
Problem p02682 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c, k, s = 0;
  scanf("%d%d%d%d", &a, &b, &c, &k);
  if (a < k) {
    s += a;
    k -= a;

    if (b < k) {
      k -= b;
      s -= k;
    }
  } else
    s = k;
  printf("%d\\n", s);
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c, d, s = 0;
  scanf("%d%d%d%d", &a, &b, &c, &d);
  for (d; d > 0; d--) {
    if (a != 0) {
      s++;
      a--;
    } else if (b != 0) {
      b--;
    } else {
      s--;
      c--;
    }
  }
  printf("%d\\n", s);
}
Problem p02682 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <queue>
#include <vector>
using namespace std;
int main(void) {
  int A, B, C, K;
  cin >> A >> B >> C >> K;
  int ans = 0;
  if (A > 0) {
    if (K >= A) {
      ans += A;
      K -= A;
    } else {
      ans += K;
      K = 0;
    }
  }
  if (B > 0) {
    if (K >= B) {
      K -= B;
    } else {
      K = 0;
    }
  }

  ans -= K;

  cout << ans;
}

Error: TLE

Fixed submission:

#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <queue>
#include <vector>
using namespace std;
int main(void) {
  int A, B, C, K;
  cin >> A >> B >> C >> K;
  int ans = 0;
  for (int i = 0; i < K; i++) {
    if (A > 0) {
      ans++;
      A--;
    } else if (B > 0) {
      B--;
    } else {
      ans--;
    }
  }
  cout << ans;
}
Problem p02682 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>

#define ll long long int
#define pb push_back
#define ppb pop_back
#define ff first
#define ss second
#define vvi vector<vector<ll>>
#define vi vector<ll>
#define all(a) (a).begin(), (a).end()
#define pii pair<ll, ll>
#define rep(x, n) for (ll i = x; i < n; ++i)
#define repd(x, n) for (ll i = x - 1; i >= n; --i)
#define repn(x, n) for (ll j = x; j < n; ++j)
#define repnd(x, n) for (ll j = x - 1; j >= n; --j)
#define endl '\\n'
#define M 1000000007
const ll INF = 1ll << 60;

using namespace std;

ll fact(ll n) {
  ll p = 1;
  rep(1, n + 1) { p *= i; }
  return p;
}

bool isprime(ll a) {
  if (a == 2) {
    return 1;
  }
  if (!(a & 1)) {
    return 0;
  }
  for (ll i = 3; i * i <= a; i += 2) {
    if (a % i == 0) {
      return 0;
    }
  }
  return 1;
}

ll fast_power(long long base, long long power) // for(2^100)
{
  long long result = 1;
  while (power > 0) {
    if (power & 1) {
      result = (result * base) % M;
    }
    base = (base * base) % M;
    power >>= 1;
  }
  return result;
}

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  ll a, b, c, k;
  cin >> a >> b >> c >> k;
  ll ans = 0;
  if (a >= k)
    cout << min(a, k) << endl;
  else if (a + b >= k)
    cout << a << endl;
  else if (a + b + c >= k) {
    ll f = (k - a - b);
    cout << a - f << endl;
  }
  //    cout<<ans<<endl;

  return 0;
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>

#define ll long long int
#define pb push_back
#define ppb pop_back
#define ff first
#define ss second
#define vvi vector<vector<ll>>
#define vi vector<ll>
#define all(a) (a).begin(), (a).end()
#define pii pair<ll, ll>
#define rep(x, n) for (ll i = x; i < n; ++i)
#define repd(x, n) for (ll i = x - 1; i >= n; --i)
#define repn(x, n) for (ll j = x; j < n; ++j)
#define repnd(x, n) for (ll j = x - 1; j >= n; --j)
#define endl '\\n'
#define M 1000000007
const ll INF = 1ll << 60;

using namespace std;

ll fact(ll n) {
  ll p = 1;
  rep(1, n + 1) { p *= i; }
  return p;
}

bool isprime(ll a) {
  if (a == 2) {
    return 1;
  }
  if (!(a & 1)) {
    return 0;
  }
  for (ll i = 3; i * i <= a; i += 2) {
    if (a % i == 0) {
      return 0;
    }
  }
  return 1;
}

ll fast_power(long long base, long long power) // for(2^100)
{
  long long result = 1;
  while (power > 0) {
    if (power & 1) {
      result = (result * base) % M;
    }
    base = (base * base) % M;
    power >>= 1;
  }
  return result;
}

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  ll a, b, c, k;
  cin >> a >> b >> c >> k;
  ll ans = 0;
  while (k--) {
    if (a > 0) {
      ans += 1;
      a--;
    } else if (b > 0) {
      b--;
    } else {
      ans -= 1;
      c--;
    }
  }
  cout << ans << endl;

  return 0;
}
Problem p02682 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
using namespace std;
int main() {
  long long a, b, c, k;
  cin >> a >> b >> c >> k;
  if (k <= a)
    cout << k << endl;
  else if (a < k && k <= a + b)
    cout << a << endl;
  else
    cout << a - (k - (a + b));
}

Error: WA

Fixed submission:

#include <iostream>
using namespace std;
int main() {
  int a, b, c, k, i, j, d;
  cin >> a >> b >> c >> k;
  int y[a + b + c];
  for (i = 0; i < a; i++) {
    y[i] = 1;
  }
  for (j = 0; j < b; j++) {
    y[i + j] = 0;
  }
  for (d = 0; d < c; d++) {
    y[i + j + d] = -1;
  }
  for (i = 0; i < k; i++) {
    a += y[i];
  }
  cout << y;
}
Problem p02682 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>

int main() {
  int A, B, C, K;
  std::cin >> A >> B >> C >> K;

  int count = 0;
  if (K > A) {
    count = A;
    for (int i = 0; i < K - A - B; i++)
      count--;
  } else
    count = K;

  std::cout << count << std::endl;
}

Error: TLE

Fixed submission:

#include <iostream>

int main() {
  int A, B, C, K;
  std::cin >> A >> B >> C >> K;

  int count = 0;
  for (int i = 0; i < K; i++) {
    if (A > 0) {
      ++count;
      --A;
    } else if (B > 0)
      --B;
    else
      --count;
  }
  std::cout << count << std::endl;
}
Problem p02682 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);

  int a, b, c, d;
  cin >> a >> b >> c >> d;
  int ans = 0;
  int x = min(a, d);
  ans += x;
  a -= x;
  d -= x;
  if (d) {
    int y = min(b, d);
    b -= y;
    d -= y;
  }
  if (d) {
    ans -= d;
  }
  cout << ans;
  return 0;
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);

  int a, b, c, d;
  cin >> a >> b >> c >> d;
  int ans = 0;
  for (int i = 0; i < d; i++) {
    if (a) {
      a--;
      ans++;
    } else if (b) {
      b--;
    } else {
      c--;
      ans--;
    }
  }
  cout << ans;
  return 0;
}
Problem p02682 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;

int main() {
  long long a, b, c, k;
  cin >> a >> b >> c >> k;
  long long max = 0;
  long long i;
  for (i = 0; i < a; i++) {
    if (i == k) {
      cout << max << endl;
      return 0;
    }
    max++;
  }

  for (i = a; i < a + b; i++) {
    if (i == k) {
      cout << max << endl;
      return 0;
    }
  }

  for (i = a + b; i < a + b + c; i++) {
    if (i == k) {
      cout << max << endl;
      return 0;
    }
    max--;
  }

  cout << max << endl;
  return 0;
}

Error: 0

Fixed submission:

#include <bits/stdc++.h>
using namespace std;

int main() {
  long long a, b, c, k, sum;
  cin >> a >> b >> c >> k;
  int box[a + b + c];
  long long max = 0;
  for (int i = 0; i < a; i++)
    box[i] = 1;
  for (int i = a; i < a + b; i++)
    box[i] = 0;
  for (int i = a + b; i < a + b + c; i++)
    box[i] = -1;
  for (int i = 0; i < k; i++) {
    max += box[i];
  }
  cout << max << endl;
  return 0;
}
Problem p02682 (C++) — buggy submission, verdict: Time Limit Exceeded

// @prefix atcoder
// @description atcoder template

#include <bits/stdc++.h>
using namespace std;
#define int long long

// typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;

// rep
//------------------------------------------
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) (x).begin(), (x).end()
#define DEBUG(x) cerr << #x << ": " << x << '\\n'
#define DEBUGP(x) cerr << #x << ": " << x.first << " \\t" << x.second << '\\n'
#define INF (1ll << 60)

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
const int MOD = 1e9 + 7;

int a, b, c, k;

signed main() {
  cin >> a >> b >> c >> k;

  int res = 0;
  if (k <= a) {
    res = k;
  } else if (k <= a + b) {
    res = a;
  } else {
    res = a - (c - (a + b + c - k));
  }

  cout << res << endl;
  return 0;
}


Error: TLE

Fixed submission:

// @prefix atcoder
// @description atcoder template

#include <bits/stdc++.h>
using namespace std;
#define int long long

// typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;

// rep
//------------------------------------------
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) (x).begin(), (x).end()
#define DEBUG(x) cerr << #x << ": " << x << '\\n'
#define DEBUGP(x) cerr << #x << ": " << x.first << " \\t" << x.second << '\\n'
#define INF (1ll << 60)

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
const int MOD = 1e9 + 7;

int a, b, c, k;

signed main() {
  cin >> a >> b >> c >> k;

  int res = 0;
  REP(i, k) {
    if (k <= a) {
      res = k;
    } else if (k <= a + b) {
      res = a;
    } else {
      res = a - (c - (a + b + c - k));
    }
  }

  cout << res << endl;
  return 0;
}
Problem p02682 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a, b, c, k;
  cin >> a >> b >> c >> k;
  // long long count=0;
  if (k <= a) {
    cout << k << "\\n";
  } else if (k <= (a + b)) {
    cout << a << "\\n";
  } else {
    long long r = k - (a + b);
    cout << (-r + a) << "\\n";
  }
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a, b, c, k;
  cin >> a >> b >> c >> k;
  long long count = 0;
  while (a-- > 0 && k-- > 0) {
    count += 1;
  }
  while (b-- > 0 && k-- > 0) {
    count += 0;
  }
  while (c-- > 0 && k-- > 0) {
    count += -1;
  }
  cout << count << endl;
}
Problem p02682 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>

using namespace std;

int main() {
  long a, b, c, k, res = 0, xa, xb, xc, k1, k2, k3;
  cin >> a >> b >> c >> k;
  xa = min(k, a);
  k1 = k - xa;
  xb = min(k1, b);
  k2 = k1 - xb;
  xc = min(k2, c);
  k3 = k2 - xc;
  res = xa * 1 + xb * 0 + xc * (-1);
  cout << res << endl;
  return 0;
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>

using namespace std;

int main() {
  long a, b, c, k, res = 0;
  cin >> a >> b >> c >> k;
  for (int i = 0;; i++) {

    for (int j = 0;; j++) {
      for (int l = 0;; l++) {
        if (k <= 0 || a <= 0)
          break;
        else {
          if (k - a >= 0) {
            k = k - a;

            res += a * 1;
            a = 0;
          } else {
            k--;
            a--;
            res++;
          }
        }
      }
      if (k <= 0 || b <= 0)
        break;
      else {
        if (k - b >= 0) {
          k = k - b;
          b = 0;
          // res = a*1;
        } else {
          k--;
          b--;
        }
      }
    }
    if (k <= 0 || c <= 0)
      break;
    else {
      if (k - c >= 0) {
        k = k - c;

        res += c * (-1);
        c = 0;
      } else {
        k--;
        c--;
        res--;
      }
    }
  }
  cout << res << endl;
  return 0;
}
Problem p02682 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;

int main() {
  int A, B, C, K;

  cin >> A >> B >> C >> K;

  int sum = 0;

  if (A >= K) {
    cout << K << endl;
    return 0;
  } else {
    if (B >= K - A) {
      cout << A << endl;
    } else {
      cout << A - (K - A - B) << endl;
    }
  }
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;

int main() {
  int A, B, C, K;

  cin >> A >> B >> C >> K;

  int sum = 0;

  if (A >= K) {
    cout << K << endl;
    return 0;
  }

  for (int i = 1; i <= K; i++) {
    if (A > 0) {
      sum++;
      A--;
      continue;
    }
    if (B > 0) {
      B--;
      continue;
    }
    if (C > 0) {
      sum--;
      C--;
    }
  }

  cout << sum << endl;
}
Problem p02682 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;

typedef long long LL;
typedef long double LD;

int main(void) {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  LL a, b, c, k;
  cin >> a >> b >> c >> k;
  LL ans = 0;
  if (a >= k) {
    ans = k;
  } else if (a + b >= k) {
    ans = a;
  } else {
    ans = a - (k - a - b);
  }
  cout << ans << endl;
}

Error: TLE

Fixed submission:

#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;

typedef long long LL;
typedef long double LD;

int main(void) {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  LL a, b, c, k;
  cin >> a >> b >> c >> k;
  LL ans = 0;
  while (k != 0) {
    if (a != 0) {
      a--;
      ans++;
    } else if (b != 0) {
      b--;
    } else {
      ans--;
      c--;
    }
    k--;
  }
  cout << ans << endl;
}
Problem p02682 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
#define rep(i, ini, n) for (int i = ini; i < n; i++)
#define _rep(i, ini, n) for (int i = ini; i >= n; i--)
#define ToEnd(a) a.begin(), a.end()
uint64_t MOD = 1000000007;

int main() {
  int64_t A, B, C, K;
  cin >> A >> B >> C >> K;

  int64_t ans = 0;
  ans += min(A, K);
  if (A < K) {
    K -= A;
    K -= B;

    if (K > 0)
      ans -= K;
  }

  cout << ans << endl;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define rep(i, ini, n) for (int i = ini; i < n; i++)
#define _rep(i, ini, n) for (int i = ini; i >= n; i--)
#define ToEnd(a) a.begin(), a.end()
uint64_t MOD = 1000000007;

int main() {
  int64_t A, B, C, K;
  cin >> A >> B >> C >> K;

  int64_t ans = 0, n = 0;
  while (n < K) {
    if (A > 0) {
      A--;
      ans++;
    } else if (B > 0) {
      B--;
    } else if (C > 0) {
      C--;
      ans--;
    }

    n++;
  }

  cout << ans << endl;
}
Problem p02682 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;

int main() {
  long long a, b, c, k;
  cin >> a >> b >> c >> k;
  long long ans = 0;
  if (k <= a)
    cout << k << endl;
  else if (k <= a + b)
    cout << a << endl;
  else
    cout << a - (k - a - b) << endl;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;

int main() {
  long long a, b, c, k;
  cin >> a >> b >> c >> k;
  long long ans = 0;
  for (int i = 0; i < k; i++) {
    if (a > 0) {
      a--;
      ans++;
    } else if (b > 0) {
      b--;
    } else {
      c--;
      ans--;
    }
  }
  cout << ans << endl;
}
Problem p02682 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>

using namespace std;

int main() {
  int a, b, c, k;
  cin >> a >> b >> c >> k;

  if (a > k)
    cout << k;
  else if (a <= k && (a + b) > k)
    cout << a;
  else if ((a + b) <= k && (a + b + c) > k)
    cout << a - (k - a - b);
  else
    cout << a - c;
  return 0;
}


Error: TLE

Fixed submission:

#include <iostream>

using namespace std;

int main() {
  int a, b, c, k;
  int count = 0;
  cin >> a >> b >> c >> k;
  for (int i = 0; i < a; i++) {
    count++;
    k--;
    if (k == 0)
      cout << count;
  }

  for (int i = 0; i < b; i++) {
    k--;
    if (k == 0)
      cout << count;
  }

  for (int i = 0; i < c; i++) {
    count--;
    k--;
    if (k == 0)
      cout << count;
  }

  return 0;
}
Problem p02682 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;

int main() {
  int a, b, c, k;
  cin >> a >> b >> c >> k;

  if (a >= k) {
    cout << k << endl;
  } else {
    if (b >= k - a) {
      cout << a << endl;
    } else {
      cout << a - (k - a - b) << endl;
    }
  }
}


Error: WA

Fixed submission:

#include <bits/stdc++.h>
using namespace std;

int main() {
  int a, b, c, k;
  cin >> a >> b >> c >> k;
  int r1 = k % a;
  int r2 = r1 % b;
  int r3 = r2 % b;
  cout << r1 - r3 << endl;
}
Problem p02682 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
using namespace std;
int main(void) {
  int a, b, c, k;
  int ans = 0;
  cin >> a >> b >> c >> k;
  if (k > a) {
    k -= a;
    ans += a;
    if (k > b) {
      k -= b;
      ans -= k;
    }
  } else
    ans = k;
  cout << ans << endl;
  return 0;
}


Error: TLE

Fixed submission:

#include <iostream>
using namespace std;
int main(void) {
  int a, b, c, k;
  int ans = 0;
  cin >> a >> b >> c >> k;
  for (int i = 0; i < k; i++) {
    if (a > 0) {
      a--;
      ans++;
    } else if (b > 0) {
      b--;
    } else {
      ans--;
    }
  }
  cout << ans << endl;
  return 0;
}
Problem p02682 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;

int main() {
  int a, b, c, k;
  int ans = 0;
  cin >> a >> b >> c >> k;
  ans += min(a, k);
  k = k - (a + b);
  if (k > 0)
    ans -= k;
  cout << ans << endl;
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;

int main() {
  int a, b, c, k;
  int ans = 0;
  cin >> a >> b >> c >> k;
  for (int i = 0; i < k; ++i) {
    if (a > 0) {
      ans += 1;
      --a;
    } else if (b > 0) {
      --b;
    } else {
      ans -= 1;
    }
  }
  cout << ans << endl;
}
Problem p02682 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
using namespace std;
int main(void) {
  // Your code here!
  int a;
  int b;
  int c;
  int k;
  cin >> a >> b >> c >> k;

  int max = 0;

  if (k <= a) {
    max += k;
    k = 0;
  } else if (k > a) {
    max += a;
    k -= a;
  }

  if (k >= b) {
    k -= b;
  }
  if (k > 0) {
    max -= k;
  }
  cout << max;
}

Error: TLE

Fixed submission:

#include <iostream>
using namespace std;
int main(void) {
  // Your code here!
  int a;
  int b;
  int c;
  int k;
  cin >> a >> b >> c >> k;

  int max = 0;

  for (int i = 0; i < k; i++) {

    if (a != 0) {
      max += 1;
      a -= 1;
    } else if (b != 0) {
      b -= 1;
    } else {
      max -= 1;
    }
    /*cout << max;
    cout <<"\\n";*/
  }
  cout << max;
}
Problem p02682 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;

int main() {
  int A, B, C, K;
  int sum = 0;
  cin >> A >> B >> C >> K;

  if (A > K)
    cout << K << endl;
  else if (A + B > K)
    cout << A << endl;
  else
    cout << 2 * A + B - K << endl;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;

int main() {
  int A, B, C, K;
  int sum = 0;
  cin >> A >> B >> C >> K;
  for (int i = K; i > 0; i--) {
    if (A > 0) {
      sum++;
      A--;
    } else if (A == 0 && B > 0)
      B--;
    else
      sum--;
  }
  cout << sum << endl;
}
Problem p02683 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
int i, j, k, x, y, z, l, m, n, count1 = 0, count2 = 0;
int gcd(int, int);
void A(void);
void B(void);
void C(void);
void D(void);
void E(void);
void F(void);

int main(void) { C(); }

void C() {
  int minv = -1, sum = 0;
  cin >> n >> m >> x;
  vector<int> c(n);
  vector<vector<int>> a(n, vector<int>(m, 0));
  for (i = 0; i < n; i++) {
    cin >> c[i];
    for (j = 0; j < m; j++) {
      cin >> a[i][j];
    }
  }
  for (i = 0; i < (1 << n); i++) {
    vector<int> suma(m, 0);
    bitset<12> bit(i);
    for (j = 0; j < n; j++) {
      if (bit.test(j)) {
        sum += c[j];
        for (k = 0; k < m; k++) {
          suma[k] += a[j][k];
        }
      }
    }
    for (k = 0; k < m; k++) {
      if (suma[k] >= x)
        count1++;
    }
    if (count1 == m) {
      if (minv == -1)
        minv = sum;
      else
        minv = min(minv, sum);
    }
    sum = 0;
    count1 = 0;
  }
  cout << minv << endl;
}

Error: WA

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
int i, j, k, x, y, z, l, m, n, count1 = 0, count2 = 0;
int gcd(int, int);
void A(void);
void B(void);
void C(void);
void D(void);
void E(void);
void F(void);

int main(void) { C(); }

void C() {
  int minv = -1, sum = 0;
  cin >> n >> m >> x;
  vector<int> c(n);
  int a[n][m];
  for (i = 0; i < n; i++) {
    cin >> c[i];
    for (j = 0; j < m; j++) {
      cin >> a[i][j];
    }
  }
  for (i = 0; i < (1 << n); i++) {
    vector<int> suma(m, 0);
    bitset<12> bit(i);
    for (j = 0; j < n; j++) {
      if (bit.test(j)) {
        sum += c[j];
        for (k = 0; k < m; k++) {
          suma[k] += a[i][k];
        }
      }
    }
    for (k = 0; k < m; k++) {
      if (suma[k] >= x)
        count1++;
    }
    if (count1 == m) {
      if (minv == -1)
        minv = sum;
      else
        minv = min(minv, sum);
    }
    sum = 0;
    count1 = 0;
  }
  cout << minv << endl;
}
Problem p02683 (C++) — buggy submission, verdict: Runtime Error

#include <algorithm>
#include <cmath>
#include <cstring>
#include <iostream>
#include <iterator>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;
#define mems(p) memset(p, 0, sizeof(p))
#define mp make_pair

void fast() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
}

int n, m, x;
int c[12];
int a[12][12];

pair<int, bool> minim(int idx, vector<int> und) {
  bool bb = true;
  if (idx == n) {
    for (int unn : und) {
      if (unn < x) {
        bb = false;
        break;
      }
    }
    return mp(0, bb);
  }
  pair<int, int> aa = minim(idx + 1, und);
  vector<int> cund(m);
  for (int i = 0; i < m; ++i) {
    cund[i] = und[i] + a[idx][i];
  }
  pair<int, int> aaa = minim(idx + 1, cund);
  if (aa.second && aa.first < aaa.first + c[idx]) {
    // cout << idx<<" first\\n";
    return aa;
  } else if (aaa.second) {
    // cout << idx<<" second\\n";
    return mp(aaa.first + c[idx], aaa.second);
  }
  return aa;
}

int main() {

  cin >> n >> m >> x;
  for (int i = 0; i < n; ++i) {
    cin >> c[i];
    for (int j = 0; j < m; ++j) {
      cin >> a[i][j];
    }
  }

  vector<int> und(m, 0);

  pair<int, int> aa = minim(0, und);
  if (aa.second) {
    cout << aa.first << endl;
  } else {
    cout << -1 << endl;
  }
}


Error: WA

Fixed submission:

#include <algorithm>
#include <cmath>
#include <cstring>
#include <iostream>
#include <iterator>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;
#define mems(p) memset(p, 0, sizeof(p))
#define mp make_pair

void fast() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
}

int n, m, x;
int c[12];
int a[12][12];

pair<int, bool> minim(int idx, vector<int> und) {
  bool bb = true;
  if (idx == n) {
    for (int unn : und) {
      if (unn < x) {
        bb = false;
        break;
      }
    }
    return mp(0, bb);
  }
  pair<int, int> aa = minim(idx + 1, und);
  vector<int> cund(m);
  for (int i = 0; i < m; ++i) {
    cund[i] = und[i] + a[idx][i];
  }
  pair<int, int> aaa = minim(idx + 1, cund);
  if (aa.second && aa.first < aaa.first + c[idx]) {
    // cout << idx<<" first\\n";
    return aa;
  } else if (aaa.second) {
    // cout << idx<<" second\\n";
    return mp(aaa.first + c[idx], aaa.second);
  } else if (aa.second) {
    return aa;
  }
}

int main() {

  cin >> n >> m >> x;
  for (int i = 0; i < n; ++i) {
    cin >> c[i];
    for (int j = 0; j < m; ++j) {
      cin >> a[i][j];
    }
  }

  vector<int> und(m, 0);

  pair<int, int> aa = minim(0, und);
  if (aa.second) {
    cout << aa.first << endl;
  } else {
    cout << -1 << endl;
  }
}