prithivMLmods/Coder-Stat huggingface dataset:
Problem p02818 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
#define ll long long
using namespace std;

int main() {

  ios::sync_with_stdio(false);
  cin.tie(0);
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif

  ll a, b, k;
  cin >> a >> b >> k;

  if (k >= a) {
    k -= a;
    a = 0;
    if (k >= b) {
      k -= b;
      b = 0;
    } else
      b -= k;

  } else if (k < a) {
    a = a - k;
  }

  cout << a << " " << b << endl;
}

Fixed submission:
#include <bits/stdc++.h>
#define ll long long
using namespace std;

int main() {

  ios::sync_with_stdio(false);
  cin.tie(0);
  /*#ifndef ONLINE_JUDGE
  freopen ("input.txt", "r", stdin);
  freopen ("output.txt", "w", stdout);
    #endif
*/
  ll a, b, k;
  cin >> a >> b >> k;

  if (k >= a) {
    k -= a;
    a = 0;
    if (k >= b) {
      k -= b;
      b = 0;
    } else
      b -= k;

  } else if (k < a) {
    a = a - k;
  }

  cout << a << " " << b << endl;
}
Problem p02818 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;

int main() {

  long long A, B, K;
  cin >> A >> B >> K;

  while (K > 0) {
    if (A > 0) {
      A--;
    } else if (B > 0) {
      B--;
    }
    K--;
  }

  cout << A << " " << B << endl;
}

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

int main() {

  long long A, B, K;
  cin >> A >> B >> K;

  if (A >= K) {
    A = A - K;
  } else if (B >= K - A) {
    B = B - (K - A);
    A = 0;
  } else {
    A = 0;
    B = 0;
  }

  cout << A << " " << B << endl;
}
Problem p02818 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;

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

  while (K--) {
    if (A)
      A--;
    else if (B)
      B--;
  }

  cout << A << " " << B;
}

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

int main() {
  long long A, B, K;
  cin >> A >> B >> K;
  cout << max(0LL, A - K) << " " << (K - A < 0 ? B : max(0LL, B - (K - A)));
}
Problem p02818 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;

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

  for (long long i = 0; i < k; i++) {
    if (a >= 1)
      a--;
    else if (b >= 1)
      b--;
  }
  cout << a << " " << b;
}

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

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

  if (a >= k)
    cout << a - k << " " << b << endl;
  else if (a + b >= k)
    cout << 0 << " " << b - k + a << endl;
  else
    cout << 0 << " " << 0 << endl;
}
Problem p02818 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

long long a, b, k;
long long ans;

int main() {

  cin >> a >> b >> k;

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

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

long long a, b, k;
long long ans;

int main() {

  cin >> a >> b >> k;

  if ((a - k) <= 0) {
    if ((b - (k - a)) > 0) {
      cout << 0 << " " << b - (k - a) << endl;
    } else {
      cout << 0 << " " << 0 << endl;
    }
  } else {
    cout << a - k << " " << b << endl;
  }
  return 0;
}
Problem p02818 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int taka, ao, k;
  cin >> taka >> ao >> k;
  if (k >= ao + taka)
    cout << 0 << " " << 0;
  else {
    while (k > 0) {
      if (taka > 0)
        taka--;
      else {
        if (ao > 0)
          ao--;
      }
      k--;
      if (taka == 0) {
        if (ao == 0) {
          break;
        }
      }
    }
    cout << taka << " " << ao;
  }
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int taka, ao, k;
  cin >> taka >> ao >> k;
  if (k >= ao + taka)
    cout << 0 << " " << 0;
  else {
    if (k <= taka) {
      taka = taka - k;
    } else {
      k = k - taka;
      taka = 0;
      if (k >= ao) {
        ao = 0;
      } else
        ao = ao - k;
    }
    cout << taka << " " << ao;
  }
  return 0;
}
Problem p02818 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <map>
#include <string>
#include <vector>
using namespace std;

int main() {
  long long int A, B, K;
  cin >> A >> B >> K;
  for (long long int i = 0; i < K; i++) {
    if (A > 0) {
      A--;
    } else if (B > 0) {
      B--;
    }
  }

  cout << A << ' ' << B;
}

Fixed submission:
#include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <map>
#include <string>
#include <vector>
using namespace std;

int main() {
  long long int A, B, K;
  cin >> A >> B >> K; // 2 3 3
  if (A >= K) {
    A -= K;
  } else if (A + B >= K) {
    B -= K - A;
    A = 0;
  } else {
    A = 0;
    B = 0;
  }

  cout << A << ' ' << B;
}
Problem p02818 (Python)

Buggy submission (status: Time Limit Exceeded):
import sys

input = sys.stdin.readline

INF = float("inf")


def main():
    A, B, K = map(int, input().split())

    for _ in range(K):
        if A > 0:
            A -= 1
        elif B > 0:
            B -= 1
    print(A, B)


if __name__ == "__main__":
    main()


Fixed submission:
import sys

input = sys.stdin.readline

INF = float("inf")


def main():
    A, B, K = map(int, input().split())

    if A <= K:
        print(0, max(0, B - K + A))
    else:
        print(A - K, B)


if __name__ == "__main__":
    main()
Problem p02818 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <vector>
using namespace std;

int syc(long i, long Min, long Max) {
  if (Min <= i && i <= Max) {
    return 1;
  } else {
    exit(1);
    // return 0;
  }
}

int main() {
  long long a, b, k;
  long long x, y;
  cin >> a >> b >> k;
  syc(a, 1, 1000000000000);
  syc(b, 1, 1000000000000);
  syc(k, 1, 1000000000000);

  x = a - k;
  y = b;
  if (x < 0) {
    y = y + x;
    x = 0;
  }
  if (y < 0) {
    y = 0;
  }
  cout << x << " " << y << endl;
  return 0;
}


Fixed submission:
#include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <vector>
using namespace std;

int syc(long i, long Min, long Max) {
  if (Min <= i && i <= Max) {
    return 1;
  } else {
    exit(1);
    // return 0;
  }
}

int main() {
  long long a, b, k;
  long long x, y;
  cin >> a >> b >> k;
  syc(a, 0, 1000000000000);
  syc(b, 0, 1000000000000);
  syc(k, 0, 1000000000000);

  x = a - k;
  y = b;
  if (x < 0) {
    y = y + x;
    x = 0;
  }
  if (y < 0) {
    y = 0;
  }
  cout << x << " " << y << endl;
  return 0;
}
Problem p02818 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#include <algorithm>
#include <bitset>
#include <cmath>
#include <iomanip>
#include <string>
#include <vector>
using ll = long long;

int main() {
  ll a, b, k;
  cin >> a >> b >> k;
  rep(i, k) {
    if (a >= 1)
      a -= 1;
    else if (b >= 1)
      b -= 1;
    else if (a == 0 && b == 0)
      break;
  }
  cout << a << " " << b;
}


Fixed submission:
#include <iostream>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#include <algorithm>
#include <bitset>
#include <cmath>
#include <iomanip>
#include <string>
#include <vector>
using ll = long long;

int main() {
  ll a, b, k;
  cin >> a >> b >> k;
  if (a >= k)
    cout << a - k << " " << b;
  else if (a < k && (a + b) > k)
    cout << "0 " << b + a - k;
  else
    cout << "0 0";

  return 0;
}
Problem p02818 (C++)

Buggy submission (status: Runtime Error):
// Nihal Mittal - nihal_47
// Strike First , Strike Hard , No Mercy !!

/**⠀⠀⠀⠀⠀⠀⣀⣤⣤⣄⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⣠⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⣀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⣰⣿⣿⣿⣿⠿⠿⣿⣿⣿⣿⣿⣿⣿⣧⢀⠀⠀⠀⠀
⠀⠀⠀⣿⣿⣿⠋⠀⠀⠀⠀⠀⠙⠀⠙⣿⣿⣿⣷⢳⢀⠀⠀⠀
⠀⠀⣠⣿⣿⣿⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⢀
⠀⠀⣸⣿⣿⣿⠸⠀⠀⠀⠒⠒⠒⠐⠀⠀⢿⣿⣿⣿⣿⣿⠀⠀
⠀⣴⣿⣿⣿⡿⠀⠒⣋⣙⡒⢰⠀⠤⣖⠒⢾⣿⣿⣿⣿⣧⠀⠀
⢺⣿⣿⣿⣿⢀⠀⠀⠉⠉⠉⠸⠀⡇⠉⠉⠀⢿⣿⣿⣿⣄⠀⠀
⠀⠙⣿⣿⣧⢻⠀⠀⠀⠀⠀⠠⠀⠰⠀⠀⠀⣸⠸⣿⣿⠿⠰⠀
⠀⠀⠀⠹⣿⣿⣿⣷⠀⡠⠙⣲⣔⣅⢡⣰⣷⣿⣿⣿⣧⠀⠀⠀
⠀⠀⠀⣼⣿⣿⣿⣿⠀⡿⠭⠭⠭⠭⢿⠀⣿⢻⣿⣿⠃⠀⠀⠀
⠀⠀⠀⠙⠛⣿⢻⠹⣿⠐⠙⠛⠟⠉⢀⣴⡟⢿⣿⡏⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⡟⠀⠀⠻⣦⣤⣶⠾⠋⠀⠀⠁⡦⢄⢀⠀⠀⠀
⠀⠀⠀⠀⡠⠁⡇⠑⢄⠀⠀⠀⠀⠀⠀⠔⠀⠀⠁⠀⠀⠀⠉⠁
⠀⠔⠊⠁⠀⠀⣇⠀⠀⠀⠑⡤⠤⢎⠁⠀⠀⡘⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⢢⠠⠀⡠⢆⠀⠀⡠⠙⢄⠀⡸⠀
**/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define l long
#define mk make_pair
#define pb push_back
#define in insert
#define se second
#define fi first
#define mod 1000000007
#define watch(x) cout << (#x) << " is " << (x) << "\n"
#define all(v) (v).begin(), (v).end()
#define fast                                                                   \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(NULL);                                                               \
  cout.tie(0);
#define pii pair<int, int>
#define maxn 100005
#define ordered_set                                                            \
  tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
using namespace std;
using namespace __gnu_pbds;

signed main() {
  fast;
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
  ll a, b, k;
  cin >> a >> b >> k;
  ll ha = min(a, k);
  a -= ha;
  k -= ha;
  if (k)
    b -= min(b, k);
  cout << a << " " << b;
}

Fixed submission:
// Nihal Mittal - nihal_47
// Strike First , Strike Hard , No Mercy !!

/**⠀⠀⠀⠀⠀⠀⣀⣤⣤⣄⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⣠⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⣀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⣰⣿⣿⣿⣿⠿⠿⣿⣿⣿⣿⣿⣿⣿⣧⢀⠀⠀⠀⠀
⠀⠀⠀⣿⣿⣿⠋⠀⠀⠀⠀⠀⠙⠀⠙⣿⣿⣿⣷⢳⢀⠀⠀⠀
⠀⠀⣠⣿⣿⣿⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⢀
⠀⠀⣸⣿⣿⣿⠸⠀⠀⠀⠒⠒⠒⠐⠀⠀⢿⣿⣿⣿⣿⣿⠀⠀
⠀⣴⣿⣿⣿⡿⠀⠒⣋⣙⡒⢰⠀⠤⣖⠒⢾⣿⣿⣿⣿⣧⠀⠀
⢺⣿⣿⣿⣿⢀⠀⠀⠉⠉⠉⠸⠀⡇⠉⠉⠀⢿⣿⣿⣿⣄⠀⠀
⠀⠙⣿⣿⣧⢻⠀⠀⠀⠀⠀⠠⠀⠰⠀⠀⠀⣸⠸⣿⣿⠿⠰⠀
⠀⠀⠀⠹⣿⣿⣿⣷⠀⡠⠙⣲⣔⣅⢡⣰⣷⣿⣿⣿⣧⠀⠀⠀
⠀⠀⠀⣼⣿⣿⣿⣿⠀⡿⠭⠭⠭⠭⢿⠀⣿⢻⣿⣿⠃⠀⠀⠀
⠀⠀⠀⠙⠛⣿⢻⠹⣿⠐⠙⠛⠟⠉⢀⣴⡟⢿⣿⡏⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⡟⠀⠀⠻⣦⣤⣶⠾⠋⠀⠀⠁⡦⢄⢀⠀⠀⠀
⠀⠀⠀⠀⡠⠁⡇⠑⢄⠀⠀⠀⠀⠀⠀⠔⠀⠀⠁⠀⠀⠀⠉⠁
⠀⠔⠊⠁⠀⠀⣇⠀⠀⠀⠑⡤⠤⢎⠁⠀⠀⡘⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⢢⠠⠀⡠⢆⠀⠀⡠⠙⢄⠀⡸⠀
**/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define l long
#define mk make_pair
#define pb push_back
#define in insert
#define se second
#define fi first
#define mod 1000000007
#define watch(x) cout << (#x) << " is " << (x) << "\n"
#define all(v) (v).begin(), (v).end()
#define fast                                                                   \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(NULL);                                                               \
  cout.tie(0);
#define pii pair<int, int>
#define maxn 100005
#define ordered_set                                                            \
  tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
using namespace std;
using namespace __gnu_pbds;

signed main() {
  fast;

  ll a, b, k;
  cin >> a >> b >> k;
  ll ha = min(a, k);
  a -= ha;
  k -= ha;
  if (k)
    b -= min(b, k);
  cout << a << " " << b;
}
Problem p02818 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>

using namespace std;

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

  for (long i = 0; i < k; i++) {
    if (a > 0) {
      a--;
    } else if (b > 0) {
      b--;
    }
  }

  cout << a << " " << b;

  return 0;
}


Fixed submission:
#include <iostream>

using namespace std;

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

  if (a < k) {
    k -= a;
    a = 0;
    b = (b < k) ? 0 : b - k;
  } else {
    a -= k;
  }

  cout << a << " " << b;

  return 0;
}
Problem p02818 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
int main() {
  long A, B, K;
  cin >> A >> B >> K;
  while (K > 0) {
    if (A > 0) {
      A--;
      K--;
      continue;
    } else if (B > 0) {
      B--;
      K--;
      continue;
    } else {
      break;
    }
  }
  cout << A << " " << B << endl;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  long A, B, K;
  cin >> A >> B >> K;
  if (A >= K) {
    A -= K;
  } else if (B >= K - A) {
    B -= K - A;
    A = 0;
  } else {
    A = 0;
    B = 0;
  }
  cout << A << " " << B << endl;
}
Problem p02818 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REP2(i, n) for (int i = 1; i <= (int)(n); i++)
#define FOR(i, m, n) for (int i = m; i n; i++)
#define SORT(x) sort(x.begin(), x.end())
#define REVE(x) reverse(x.begin(), x.end())
#define ALL(x) (x).begin(), (x).end()
#define SUM(x) accumulate(ALL(x));
struct initon {
  initon() {
    cin.tie(0);
    ios::sync_with_stdio(false);
  };
};
int k = 0, n = 0, m = 0, l = 0, a = 0, b = 0, c = 0, d = 0, e = 0, ans = 0,
    ans2 = 0, x = 0, y = 0;
string s, t, S;
signed main() {
  cin >> a >> b >> k;
  while (a > 0 && k > 0) {
    a--;
    k--;
  }
  cout << a << " ";
  while (b > 0 && k > 0) {
    b--;
    k--;
  }
  cout << b << endl;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REP2(i, n) for (int i = 1; i <= (int)(n); i++)
#define FOR(i, m, n) for (int i = m; i n; i++)
#define SORT(x) sort(x.begin(), x.end())
#define REVE(x) reverse(x.begin(), x.end())
#define ALL(x) (x).begin(), (x).end()
#define SUM(x) accumulate(ALL(x));
struct initon {
  initon() {
    cin.tie(0);
    ios::sync_with_stdio(false);
  };
};
int k = 0, n = 0, m = 0, l = 0, a = 0, b = 0, c = 0, d = 0, e = 0, ans = 0,
    ans2 = 0, x = 0, y = 0;
string s, t, S;
signed main() {
  cin >> a >> b >> k;
  if (k <= a)
    cout << a - k << ' ' << b << endl;
  else if (k <= a + b)
    cout << 0 << ' ' << b - (k - a) << endl;
  else
    cout << 0 << ' ' << 0 << endl;
}
Problem p02818 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
typedef long long unsigned int ll;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define rep(i, start, end) for (int i = start; i < (int)(end); ++i)

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

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
typedef long long unsigned int ll;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define rep(i, start, end) for (int i = start; i < (int)(end); ++i)

int main() {
  long long a, b, k;
  cin >> a >> b >> k;
  if (a <= k) {
    k -= a;
    a = 0;
    b = max(0ll, b - k);
  } else {
    a -= k;
  }
  cout << a << " " << b << endl;
  return 0;
}
Problem p02818 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
using namespace std;

int main() {
  long long a, b, k;

  cin >> a >> b >> k;

  for (long long count = 0; count < k; count++) {
    if (a > 0) {
      a--;
    } else if (b > 0) {
      b--;
    } else {
      break;
    }
  }

  cout << a << " " << b << endl;
  return 0;
}

Fixed submission:
#include <iostream>
using namespace std;

int main() {
  long long a, b, k;

  cin >> a >> b >> k;

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

  cout << a << " " << b << endl;
  return 0;
}
Problem p02818 (Python)

Buggy submission (status: Time Limit Exceeded):
a, b, k = map(int, input().split())
for _ in range(k):
    if a >= 1:
        a -= 1
    elif b >= 1:
        b -= 1
print(a, b)


Fixed submission:
a, b, k = map(int, input().split())
if k >= a:
    b -= k - a
    a = 0
else:
    a -= k
print(max(a, 0), max(b, 0))
Problem p02818 (Python)

Buggy submission (status: Runtime Error):
a, b, k = (int(i) for i in input().split())
takahashi = a - k
aoki = b + takahashi if takahashi < 0 else b
print(f"{max(takahashi, 0)} {max(aoki, 0)}")


Fixed submission:
a, b, k = (int(i) for i in input().split())
takahashi = a - k
aoki = b + takahashi if takahashi < 0 else b
print("{} {}".format(max(takahashi, 0), max(aoki, 0)))
Problem p02818 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <cmath>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <vector>

using namespace std;
#define LOCAL 1
#define UPLOAD 2
#define ll long long
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
template <class T = long long> T input() {
  T x;
  cin >> x;
  return x;
}
template <class T> void output(T x) { cout << x << endl; }
#define debug(x) cerr << #x << ": " << x << '\n';
#define debugBit(x, n) cerr << #x << ": " << std::bitset<n>(x) << '\n';

int main() {
#if ENVIRONMENT == LOCAL
  std::ifstream in("input.txt");
  std::cin.rdbuf(in.rdbuf());
#endif
  long A = input();
  long B = input();
  long K = input();

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

  cout << A << " " << B << endl;

  return 0;
}


Fixed submission:
#include <algorithm>
#include <cmath>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <vector>

using namespace std;
#define LOCAL 1
#define UPLOAD 2
#define ll long long
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
template <class T = long long> T input() {
  T x;
  cin >> x;
  return x;
}
template <class T> void output(T x) { cout << x << endl; }
#define debug(x) cerr << #x << ": " << x << '\n';
#define debugBit(x, n) cerr << #x << ": " << std::bitset<n>(x) << '\n';

int main() {
#if ENVIRONMENT == LOCAL
  std::ifstream in("input.txt");
  std::cin.rdbuf(in.rdbuf());
#endif
  long A = input();
  long B = input();
  long K = input();

  if (A <= K) {
    K -= A;
    A = 0;
    B -= K;
    B = max((long)0, B);
  } else {
    A -= K;
  }

  cout << A << " " << B << endl;

  return 0;
}
Problem p02818 (Python)

Buggy submission (status: Time Limit Exceeded):
def main():
    A, B, K = map(int, input().split())

    for i in range(K):
        if A >= 1:
            A -= 1
        elif B >= 1:
            B -= 1

    print(str(A) + " " + str(B))


if __name__ == "__main__":
    main()


Fixed submission:
def main():
    A, B, K = map(int, input().split())

    if A > K:
        A -= K
    else:
        K -= A
        A = 0
        B -= K
        if B <= 0:
            print("0 0")
            exit(0)

    print(str(A) + " " + str(B))


if __name__ == "__main__":
    main()
Problem p02818 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

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

  for (ll i = 0; i < k; i++) {
    if (a >= 1) {
      a--;
    } else if (b >= 1) {
      b--;
    }
  }
  cout << a << " " << b << endl;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

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

  ll copy = a;
  a = a - min(a, k);
  b = b - min(b, k - min(copy, k));

  cout << a << " " << b << endl;
}
Problem p02818 (Python)

Buggy submission (status: Runtime Error):
A, B, K = map(int, input().split())
a = max(0, A - K)
if K - A > 0:
    b = max(0, B - K + A)
print(a, b)


Fixed submission:
A, B, K = map(int, input().split())
a = max(0, A - K)
b = B
if K - A > 0:
    b = max(0, B - K + A)
print(a, b)
Problem p02818 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define PB push_back
#define PII pair<int, int>
#define MP make_pair
#define all(x) x.begin(), x.end()
#define REP(x, y, z) for (int x = (y); x <= (z); x++)
#define REPP(x, y, z) for (int x = (y); x >= (z); x--)
#define F first
#define S second
#define MSET(x, y) memset(x, y, sizeof(x))
#define EB emplace_back
#define maxn

// structure

// declaration

// functions

int main(void) {
#ifdef DBG
  freopen("in.in", "r", stdin);
  freopen("out.out", "w", stdout);
#endif

  ll a, b, n;

  cin >> a >> b >> n;

  while (n--) {
    if (a > 0)
      a--;
    else if (b > 0)
      b--;
  }

  cout << a << ' ' << b << '\n';
  return 0;
}

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

#define ll long long
#define PB push_back
#define PII pair<int, int>
#define MP make_pair
#define all(x) x.begin(), x.end()
#define REP(x, y, z) for (int x = (y); x <= (z); x++)
#define REPP(x, y, z) for (int x = (y); x >= (z); x--)
#define F first
#define S second
#define MSET(x, y) memset(x, y, sizeof(x))
#define EB emplace_back
#define maxn

// structure

// declaration

// functions

int main(void) {
#ifdef DBG
  freopen("in.in", "r", stdin);
  freopen("out.out", "w", stdout);
#endif

  ll a, b, n;

  cin >> a >> b >> n;

  if (a > n) {
    a -= n;
  } else {
    n -= a;
    a = 0;

    if (b > n) {
      b -= n;
    } else
      b = 0;
  }

  cout << a << ' ' << b << '\n';
  return 0;
}
Problem p02818 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

int main() {
  ll a, b, k;
  cin >> a >> b >> k;
  ll bla = k & 1;
  ll temp = 0;
  while (a || b || k) {
    temp = min(a, k / 2);
    temp = min(b, temp);
    a -= temp;
    b -= temp;
    k -= temp;
  }

  if (a)
    a -= k, k = 0;
  else if (b)
    b -= k, k = 0;
  cout << max(a, 0ll) << ' ' << max(b, 0ll) << endl;
}


Fixed submission:
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

int main() {
  ll a, b, k;
  cin >> a >> b >> k;
  ll bla = k & 1;
  ll temp = 0;
  temp = min(a, k);
  a -= temp;
  k -= temp;
  temp = min(b, k);
  b -= temp;
  cout << max(a, 0ll) << ' ' << max(b, 0ll) << endl;
}
Problem p02818 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <bits/stdc++.h>
#include <iostream>
#include <math.h>
#include <string>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)

int main() {
  long long a, b, k;
  cin >> a >> b >> k;
  while (k > 0) {
    if (a > 0) {
      a--;
    } else if (b > 0) {
      b--;
    }
    if (a == 0 && b == 0)
      break;
    k--;
  }
  cout << a << " " << b << endl;
}

Fixed submission:
#include <algorithm>
#include <bits/stdc++.h>
#include <iostream>
#include <math.h>
#include <string>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)

int main() {
  long long a, b, k;
  cin >> a >> b >> k;
  if (k < a) {
    a -= k;
  } else if (k >= a) {
    b -= (k - a);
    if (b < 0)
      b = 0;
    a = 0;
  }
  cout << a << " " << b << endl;
}
Problem p02818 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
#include <string>
using namespace std;

int main() {
  long a, b, k;
  cin >> a >> b >> k;
  while (k != 0) {
    if (a > 0)
      a--;
    else if (b > 0)
      b--;

    k--;
  }
  cout << a << " " << b << endl;
}

Fixed submission:
#include <iostream>
#include <string>
using namespace std;

int main() {
  long a, b, k;
  cin >> a >> b >> k;
  if (a > k)
    cout << a - k << " " << b << endl;
  else if (a <= k && b > k - a)
    cout << 0 << " " << b + a - k << endl;
  else
    cout << "0 0" << endl;
  return 0;
}
Problem p02818 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  ll a, b, k;
  cin >> a >> b >> k;

  /*
  vector<int> a(n);
  rep(i, n) cin >> a.at(i);
  */

  rep(i, k) {
    if (a > 0)
      a--;
    else if (b > 0)
      b--;
    else
      break;
  }

  cout << a << "\n" << b << "\n";
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  ll a, b, k;
  cin >> a >> b >> k;

  /*
  vector<int> a(n);
  rep(i, n) cin >> a.at(i);
  */

  if (k <= a)
    cout << a - k << "\n" << b << "\n";
  else if (k - a <= b)
    cout << 0 << "\n" << b + a - k << "\n";
  else if (a + b <= k)
    cout << 0 << "\n" << 0 << "\n";
}
Problem p02818 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;

int main() {
  ll a, b, k;
  cin >> a >> b >> k;
  for (int i = 0; i < k; i++) {
    if (1 <= a) {
      a--;
    } else if (1 <= b) {
      b--;
    } else {
      break;
    }
  }
  cout << a << " " << b << endl;
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;

int main() {
  ll a, b, k;
  cin >> a >> b >> k;
  cout << max(a - k, 0ll) << " " << flush;
  cout << max(b - max(k - a, 0ll), 0ll) << endl;
  return 0;
}
Problem p02818 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
int main() {
  int64_t a, b, c;
  cin >> a >> b >> c;
  while (c != 0) {
    if (a > 0) {
      a--;
    } else if (b > 0) {
      b--;
    } else {
      break;
    }
    c--;
  }
  cout << a << ' ' << b << endl;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  int64_t a, b, c;
  cin >> a >> b >> c;
  if (a > c)
    cout << a - c << ' ' << b << endl;
  else if (b > (c - a))
    cout << 0 << ' ' << b - (c - a) << endl;
  else
    cout << 0 << ' ' << 0 << endl;
}
Problem p02818 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
#include <stdio.h>
using namespace std;

int main() {
  long long A, B, K;
  cin >> A;
  cin >> B;
  cin >> K;
  for (int i = 0; i < K; i++) {
    if (A > 0) {
      A--;
    } else if (B > 0) {
      B--;
    } else {
      break;
    }
  }
  cout << A << " " << B << endl;
  return 0;
}

Fixed submission:
#include <iostream>
#include <stdio.h>
using namespace std;

int main() {
  long long A, B, K;
  cin >> A;
  cin >> B;
  cin >> K;
  /*for(int i = 0; i<K; i++){
      if(A>0){
          A--;
      }else if(B>0){
          B--;
      }else{
          break;
      }
  }*/
  if (A <= K) {
    B -= K - A;
    A = 0;
    if (B < 0)
      B = 0;
  } else {
    A -= K;
  }
  cout << A << " " << B << endl;
  return 0;
}
Problem p02818 (C++)

Buggy submission (status: Time Limit Exceeded):
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define ROOP(i, N) for (int i = 0; i < N; i++)
#define RVROOP(i, N) for (int i = N; i >= 0; i--)
#define INF 1e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main() {
  ll A, B, K;
  cin >> A >> B >> K;
  while (K > 0) {
    if (A >= 1) {
      A--;
      K--;
    } else if (B >= 1) {
      B--;
      K--;
    }
  }
  cout << A << " " << B << endl;
}

Fixed submission:
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define ROOP(i, N) for (int i = 0; i < N; i++)
#define RVROOP(i, N) for (int i = N; i >= 0; i--)
#define INF 1e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main() {
  ll A, B, K;
  cin >> A >> B >> K;
  if (A > K) {
    A = A - K;
  } else {
    B = max(B - (K - A), ll(0));
    A = 0;
  }
  cout << A << " " << B << endl;
}
Problem p02818 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
using namespace std;

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


Fixed submission:
#include <iostream>
using namespace std;

int main() {
  long long int a, b, k;
  cin >> a >> b >> k;
  if (a - k >= 0)
    cout << a - k << " " << b << endl;
  else if (b - (k - a) >= 0)
    cout << 0 << " " << b - (k - a) << endl;
  else
    cout << 0 << " " << 0 << endl;
  return 0;
}
Problem p02818 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
#include <stdio.h>
// #include <bits/stdc++.h>
#include <algorithm>
#include <map>
#include <math.h>
#include <set>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
#define INF 10000000;
#define rep(i, n) for (int i = 0; (i) < (int)(n); i++)
#define REP(i, a, b) for (int i = (int)(a); (i) <= (int)(b); i++)
#define VEC(type, c, n)                                                        \
  std::vector<type> c(n);                                                      \
  for (auto &i : c)                                                            \
    std::cin >> i;
#define vec(type, n) vector<type>(n)
#define vvec(m, n) vector<vector<int>>(int(m), vector<int>(n))

int main() {
  long a, b, k;
  cin >> a >> b >> k;
  for (int i = 0; i < k; i++) {
    if (a)
      a--;
    else if (b)
      b--;
    else
      break;
  }
  cout << a << " " << b;
}

Fixed submission:
#include <iostream>
#include <stdio.h>
// #include <bits/stdc++.h>
#include <algorithm>
#include <map>
#include <math.h>
#include <set>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
#define INF 10000000;
#define rep(i, n) for (int i = 0; (i) < (int)(n); i++)
#define REP(i, a, b) for (int i = (int)(a); (i) <= (int)(b); i++)
#define VEC(type, c, n)                                                        \
  std::vector<type> c(n);                                                      \
  for (auto &i : c)                                                            \
    std::cin >> i;
#define vec(type, n) vector<type>(n)
#define vvec(m, n) vector<vector<int>>(int(m), vector<int>(n))

int main() {
  long a, b, k;
  cin >> a >> b >> k;
  long res1 = min(a, k);
  k -= res1;
  res1 = a - res1;

  long res2 = min(b, k);
  res2 = b - res2;

  cout << res1 << " " << res2;
}
Problem p02818 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;

using ll = long long;

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

  cin >> A >> B >> K;

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

  cout << A << ' ' << B << endl;

  return 0;
}


Fixed submission:
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;

using ll = long long;

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

  cin >> A >> B >> K;

  A -= K;
  if (A < 0) {
    B += A;
    A = 0;
  }
  if (B < 0) {
    B = 0;
  }

  cout << A << ' ' << B << endl;

  return 0;
}
Problem p02818 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
int main() {
  int64_t a, b, k;
  cin >> a >> b >> k;
  int64_t i;
  for (i = 0; i < k; i++) {
    if (a > 0) {
      a--;
    } else if (b > 0) {
      b--;
    } else {
      break;
    }
  }
  cout << a << " " << b << endl;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  int64_t a, b, k;
  cin >> a >> b >> k;
  if (a + b <= k) {
    a = 0;
    b = 0;
  } else if (a >= k) {
    a -= k;
  } else {
    b = b - (k - a);
    a = 0;
  }
  cout << a << " " << b << endl;
}
Problem p02818 (C++)

Buggy submission (status: Time Limit Exceeded):

#include <algorithm>
#include <iostream>
#include <queue>

using namespace std;

int main() {
  long A, B;
  long K;
  cin >> A >> B >> K;
  for (long i = 0; i < K; i++) {
    if (A > 0) {
      A--;
    } else if (B > 0) {
      B--;
    }
  }
  cout << A << " " << B << endl;
}

Fixed submission:

#include <algorithm>
#include <iostream>
#include <queue>

using namespace std;

int main() {
  long A, B;
  long K;
  cin >> A >> B >> K;
  if (K >= A + B) {
    A = 0;
    B = 0;
  } else if (K >= A) {
    B -= K - A;
    A = 0;
  } else {
    A -= K;
  }
  cout << A << " " << B << endl;
}
Problem p02818 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
#define PI 3.141592653589
#define ll long long
using namespace std;

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

  if (a + b <= k) {
    a = 0;
    b = 0;
  }

  else if (a + b > k) {
    for (ll i = 0; i < k; ++i) {
      if (a > 0)
        a--;
      else if (a == 0 && b > 0)
        b--;
    }
  }
  cout << a << " " << b;
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
#define PI 3.141592653589
#define ll long long
using namespace std;

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

  if (a + b <= k) {
    a = 0;
    b = 0;
  }

  else if (a + b > k) {
    if (a - k >= 0)
      a -= k;
    else if (a - k < 0) {
      b = b - k + a;
      a = 0;
    }
  }
  cout << a << " " << b;
  return 0;
}
Problem p02818 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

#define int long long
using pii = pair<int, int>;
const int MOD = 1e9 + 7;
const int INF = 1 << 29;
const int N = 1e6 + 10;

struct IOsetup {
  IOsetup() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cout << fixed << setprecision(20);
  }
} IO;

int32_t main() {
  int a, b, k;
  cin >> a >> b >> k;
  if (k >= a + b)
    cout << 0 << " " << 0 << endl;
  else {
    cout << a / k << " " << (a + b) % k << endl;
  }
}

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

#define int long long
using pii = pair<int, int>;
const int MOD = 1e9 + 7;
const int INF = 1 << 29;
const int N = 1e6 + 10;

struct IOsetup {
  IOsetup() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cout << fixed << setprecision(20);
  }
} IO;

int32_t main() {
  int a, b, k;
  cin >> a >> b >> k;
  int curr = min(a, k);
  k -= curr, a -= curr;
  int curr1 = min(k, b);
  k -= curr1, b -= curr1;
  cout << a << " " << b << endl;
}
Problem p02818 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;

#define REP(i, n) for (int64_t i = 0; i < n; i++)
#define REPR(i, n) for (int64_t i = n; i >= 0; i--)
#define FOR(i, m, n) for (int64_t i = m; i < n; i++)
#define FORR(i, m, n) for (int64_t i = m; i >= n; i--)
#define ALL(v) v.begin(), v.end()
typedef long long ll;
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
  fill((T *)array, (T *)(array + N), val);
}
template <class T> inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T> inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
const ll INF = 1ll << 60;
const ll MOD = 1000000007;
double EPS = 1e-10;
//----------------------------------------------------------

ll A, B, K;

int main() {
  cin >> A >> B >> K;
  REP(i, K) {
    if (A >= 1)
      A--;
    else if (B >= 1)
      B--;
    else if (A == 0 && B == 0)
      ;
  }
  cout << A << " " << B << endl;
  return 0;
}

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

#define REP(i, n) for (int64_t i = 0; i < n; i++)
#define REPR(i, n) for (int64_t i = n; i >= 0; i--)
#define FOR(i, m, n) for (int64_t i = m; i < n; i++)
#define FORR(i, m, n) for (int64_t i = m; i >= n; i--)
#define ALL(v) v.begin(), v.end()
typedef long long ll;
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
  fill((T *)array, (T *)(array + N), val);
}
template <class T> inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T> inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
const ll INF = 1ll << 60;
const ll MOD = 1000000007;
double EPS = 1e-10;
//----------------------------------------------------------

ll A, B, K;

int main() {
  cin >> A >> B >> K;
  if (K >= A) {
    K -= A;
    A = 0;
    if (K >= B) {
      B = 0;
    } else {
      B = B - K;
    }
  } else {
    A = A - K;
  }
  cout << A << " " << B << endl;
  return 0;
}
Problem p02818 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;

int main(void) {
  int64_t a, b, k;
  cin >> a >> b >> k;
  if (a + b > k) {
    for (int64_t i = 0; i <= a + b; i++) {
      if (a > 0)
        a--;
      else if (a == 0 && b > 0)
        b--;
      else if (a == 0 && b == 0)
        break;
    }
    cout << a << " " << b << endl;
  } else {
    cout << 0 << " " << 0 << endl;
  }
}

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

int main(void) {
  int64_t a, b, k;
  cin >> a >> b >> k;
  if (a >= k) {
    a = a - k;
    cout << a << " " << b << endl;
  } else if (a + b >= k) {
    b = b - (k - a);
    a = 0;
    cout << a << " " << b << endl;
  } else {
    cout << 0 << " " << 0 << endl;
  }
}
Problem p02818 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
#ifndef ONLINE_JUDGE
  freopen("input.txt", "rt", stdin);
  freopen("output.txt", "wt", stdout);
#endif
  ll a, b, k;
  cin >> a >> b >> k;
  cout << max(0LL, a - k) << " " << max(0LL, b - max(0LL, k - a)) << endl;
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll a, b, k;
  cin >> a >> b >> k;
  cout << max(0LL, a - k) << " " << max(0LL, b - max(0LL, k - a)) << endl;
  return 0;
}
Problem p02818 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>

#define NREP() for (ll i = 0; i < n; i++)
#define REP(i, n) for (ll i = 0; i < n; i++)
#define ALL(x) (x).begin(), (x).end()
#define MSG(x) cout << x << endl;
#define IPT(x)                                                                 \
  ll t;                                                                        \
  cin >> t;                                                                    \
  x.push_back(t);
#define YN(x) x ? cout << "YES" << endl : cout << "NO" << endl;
#define Yn(x) x ? cout << "Yes" << endl : cout << "No" << endl;
#define yn(x) x ? cout << "yes" << endl : cout << "no" << endl;

using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<string> vs;
typedef vector<string> vvs;

const static ll MOD = 1e9 + 7;

int main(int argc, char *argv[]) {
  ll a, b, k;
  cin >> a >> b >> k;
  REP(i, k) {
    if (a > 0)
      a--;
    else if (b > 0)
      b--;
    else
      break;
  }
  cout << to_string(a) << " " << to_string(b) << endl;
}


Fixed submission:
#include <bits/stdc++.h>

#define NREP() for (ll i = 0; i < n; i++)
#define REP(i, n) for (ll i = 0; i < n; i++)
#define ALL(x) (x).begin(), (x).end()
#define MSG(x) cout << x << endl;
#define IPT(x)                                                                 \
  ll t;                                                                        \
  cin >> t;                                                                    \
  x.push_back(t);
#define YN(x) x ? cout << "YES" << endl : cout << "NO" << endl;
#define Yn(x) x ? cout << "Yes" << endl : cout << "No" << endl;
#define yn(x) x ? cout << "yes" << endl : cout << "no" << endl;

using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<string> vs;
typedef vector<string> vvs;

const static ll MOD = 1e9 + 7;

int main(int argc, char *argv[]) {
  ll a, b, k;
  cin >> a >> b >> k;
  if (a >= k)
    a -= k;
  else if (a + b >= k) {
    b -= k - a;
    a = 0;
  } else {
    a = 0;
    b = 0;
  }
  cout << to_string(a) << " " << to_string(b) << endl;
}
Problem p02818 (C++)

Buggy submission (status: Runtime Error):
#include <iostream>
using namespace std;
int main() {
  long long N, A, B;
  cin >> N >> A >> B;
  long long times = N / (A + B);
  long long rest = N % (A + B);
  long long opai;
  if (rest >= A)
    opai = A;
  if (rest < A)
    opai = rest;
  cout << times * A + opai << endl;
}

Fixed submission:
#include <iostream>
using namespace std;
int main() {
  long long A, B, K;
  cin >> A >> B >> K;
  long long t = A - K;
  long long u = 0;
  if (t >= 0)
    u = B;
  else {
    u = B + t;
    t = 0;
  }
  if (u <= 0)
    u = 0;
  cout << t << " " << u << endl;
}
Problem p02818 (Python)

Buggy submission (status: Time Limit Exceeded):
a, b, k = map(int, input().split())

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

print(a, b)


Fixed submission:
a, b, k = map(int, input().split())

a_ans = max(a - k, 0)
b_ans = max(b - max(k - a, 0), 0)
print(a_ans, b_ans)
Problem p02818 (Python)

Buggy submission (status: Time Limit Exceeded):
a, b, k = map(int, input().split())

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

print(a, b)


Fixed submission:
a, b, k = map(int, input().split())

if a > k:
    print(a - k, b)
elif a + b > k:
    print(0, a + b - k)
else:
    print(0, 0)
Problem p02818 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <bits/stdc++.h>
#include <functional>
#include <stdlib.h>
#include <string>
#include <vector>

using namespace std;

int main(void) {
  unsigned long int A = 0, B = 0, K = 0;
  cin >> A >> B >> K;

  while (A > 0 && K > 0) {
    A--;
    K--;
  }
  while (B > 0 && K > 0) {
    B--;
    K--;
  }
  cout << A << " " << B << endl;
  return 0;
}

Fixed submission:
#include <algorithm>
#include <bits/stdc++.h>
#include <functional>
#include <stdlib.h>
#include <string>
#include <vector>

using namespace std;

int main(void) {
  unsigned long int A = 0, B = 0, K = 0;
  cin >> A >> B >> K;

  if (A > K) {
    A -= K;
  } else {
    K -= A;
    A = 0;
    if (B > K) {
      B -= K;
    } else {
      B = 0;
    }
  }
  cout << A << " " << B << endl;
  return 0;
}
Problem p02818 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>

#define ll long long
using namespace std;

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

  if (a + b <= k) {
    cout << 0 << ' ' << 0;
    return 0;
  }

  while (k--) {
    if (a >= 1)
      a--;
    else if (b >= 1)
      b--;
    else
      break;
  }

  cout << a << ' ' << b;
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>

#define ll long long
using namespace std;

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

  if (k <= a)
    cout << a - k << ' ' << b << endl;
  else if (k <= a + b)
    cout << 0 << ' ' << b - (k - a) << endl;
  else
    cout << 0 << ' ' << 0 << endl;
  return 0;
}
Problem p02818 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
#include <string>
using namespace std;

int main() {
  long long A, B, K;
  cin >> A >> B >> K;
  while (K > 0) {
    if (A > 0) {
      A--;
    } else if (B > 0) {
      B--;
    }
    K--;
  }
  cout << A << " " << B << endl;
}

Fixed submission:
#include <iostream>
#include <string>
using namespace std;

int main() {
  long long A, B, K;
  cin >> A >> B >> K;
  if (A > K) {
    A -= K;
    K = 0;
  } else {
    K -= A;
    A = 0;
  }
  if (B > K) {
    B -= K;
    K = 0;
  } else {
    K -= B;
    B = 0;
  }
  cout << A << " " << B << endl;
}
Problem p02818 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>

using namespace std;
typedef long long int lli;
typedef vector<int> iv;
typedef vector<bool> bv;
typedef vector<string> sv;
typedef vector<long long int> llv;
typedef vector<double> dv;
#define debug_ printf("OK\n")

#define sor_(vec) sort(vec.begin(), vec.end())
#define rev_(vec) reverse(vec.begin(), vec.end())
#define rep(i, n) for (int i = 0; i < static_cast<int>(n); i++)
#define reps(i, n, s)                                                          \
  for (int i = static_cast<int>(s); i < static_cast<int>(n); i++)
#define isposi(num) if (num > 0)

const long long mod = 1000000007;

void solve(lli a, lli b, lli k) {
  for (lli i = 0; i < k; i++) {
    if (a > 0)
      a--;
    else if (b > 0)
      b--;
  }
  std::cout << a << " " << b;
}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  lli a, b, k;
  std::cin >> a >> b >> k;
  if (k >= a + b)
    std::cout << "0 0";
  else
    solve(a, b, k);
  return 0;
}


Fixed submission:
#include <bits/stdc++.h>

using namespace std;
typedef long long int lli;
typedef vector<int> iv;
typedef vector<bool> bv;
typedef vector<string> sv;
typedef vector<long long int> llv;
typedef vector<double> dv;
#define debug_ printf("OK\n")

#define sor_(vec) sort(vec.begin(), vec.end())
#define rev_(vec) reverse(vec.begin(), vec.end())
#define rep(i, n) for (int i = 0; i < static_cast<int>(n); i++)
#define reps(i, n, s)                                                          \
  for (int i = static_cast<int>(s); i < static_cast<int>(n); i++)
#define isposi(num) if (num > 0)

const long long mod = 1000000007;

void solve(lli a, lli b, lli k) {
  if (k >= a)
    std::cout << "0 " << b - (k - a);
  else
    std::cout << a - k << " " << b;
}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  lli a, b, k;
  std::cin >> a >> b >> k;
  if (k >= a + b)
    std::cout << "0 0";
  else
    solve(a, b, k);
  return 0;
}
Problem p02818 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>

using namespace std;

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

  long long int a, b, k;
  cin >> a >> b >> k;

  while (k--) {
    if (a > 0)
      a--;
    else if (b > 0)
      b--;
  }

  cout << a << " " << b << "\n";

  return 0;
}


Fixed submission:
#include <bits/stdc++.h>

using namespace std;

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

  long long int a, b, k;
  cin >> a >> b >> k;

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

  cout << a << " " << b << "\n";

  return 0;
}
Problem p02818 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;

int main() {
  int64_t A, B, K;
  cin >> A >> B >> K;
  for (int64_t i = 0; i < K; i++) {
    if (A > 0) {
      A--;
    } else if (B > 0) {
      B--;
    }
  }
  cout << A << " " << B << endl;
}

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

int main() {
  int64_t A, B, K;
  cin >> A >> B >> K;
  if (A >= K) {
    A -= K;
  } else {
    K -= A;
    A = 0;
    if (B >= K) {
      B -= K;
    } else {
      B = 0;
    }
  }
  cout << A << " " << B << endl;
}
Problem p02818 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <cctype>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <math.h>
#include <stdio.h>
#include <string>
#include <vector>

using namespace std;

const int mod = 1000000007;
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))
#define ll long long

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

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

  cout << A << endl;
  cout << B << endl;
  return 0;
}

Fixed submission:
#include <algorithm>
#include <cctype>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <math.h>
#include <stdio.h>
#include <string>
#include <vector>

using namespace std;

const int mod = 1000000007;
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))
#define ll long long

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

  ll remain = max(K - A, (ll)0);
  A = max(A - K, (ll)0);
  B = max(B - remain, (ll)0);

  cout << A << endl;
  cout << B << endl;
  return 0;
}
Problem p02818 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;

int main() {
  long long a, b, k;
  cin >> a >> b >> k;
  while (k > 0) {
    if (a > 0)
      a--;
    else if (b > 0)
      b--;
    k--;
  }
  cout << a << " " << b << endl;
}

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

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