problem_id stringlengths 6 6 | language stringclasses 2 values | original_status stringclasses 3 values | original_src stringlengths 19 243k | changed_src stringlengths 19 243k | change stringclasses 3 values | i1 int64 0 8.44k | i2 int64 0 8.44k | j1 int64 0 8.44k | j2 int64 0 8.44k | error stringclasses 270 values | stderr stringlengths 0 226k |
|---|---|---|---|---|---|---|---|---|---|---|---|
p02817 | Python | Runtime Error | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)
s, t = map(str, input().split())
print(f"{t}{s}")
| import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)
s, t = map(str, input().split())
print("{}{}".format(t, s))
| replace | 9 | 10 | 9 | 10 | 0 | |
p02817 | Python | Runtime Error | S, T = map(str, input().split())
print(T + S).split("")
| S, T = input().split()
print(T + S)
| replace | 0 | 2 | 0 | 2 | AttributeError: 'NoneType' object has no attribute 'split' | Traceback (most recent call last):
File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02817/Python/s359614518.py", line 2, in <module>
print(T + S).split('')
AttributeError: 'NoneType' object has no attribute 'split'
|
p02817 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i, n, k) for (ll i = (n); i < (k); i++)
#define ALL(a) (a).begin(), (a).end()
string n, m, ans = 0;
void Main() {
cin >> n >> m;
cout << m << n << endl;
}
int main() {
Main();
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i, n, k) for (ll i = (n); i < (k); i++)
#define ALL(a) (a).begin(), (a).end()
string n, m;
void Main() {
cin >> n >> m;
cout << m << n << endl;
}
int main() {
Main();
return 0;
}
| replace | 5 | 6 | 5 | 6 | -6 | terminate called after throwing an instance of 'std::logic_error'
what(): basic_string: construction from null is not valid
|
p02817 | Python | Runtime Error | s, t = map(int, input().split())
print(s + t)
| s, t = input().split()
print(t + s)
| replace | 0 | 2 | 0 | 2 | ValueError: invalid literal for int() with base 10: 'oder' | Traceback (most recent call last):
File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02817/Python/s795282831.py", line 1, in <module>
s, t = map(int, input().split())
ValueError: invalid literal for int() with base 10: 'oder'
|
p02817 | C++ | Runtime Error | #include <stdio.h>
int main() {
char nama1[9];
char nama2[13];
scanf("%s", &nama1);
scanf("%s", &nama2);
printf("%s%s", nama2, nama1);
return 0;
} | #include <stdio.h>
int main() {
char S[100], T[100];
scanf("%s %s", &S, &T);
printf("%s%s\n", T, S);
return 0;
} | replace | 3 | 11 | 3 | 6 | 0 | |
p02817 | C++ | Runtime Error | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
void delete_space(char *x) {
while (*x != '\0') {
if (*x == '\n') {
*x = '\0';
}
x++;
}
}
int main() {
char s[100], t[200];
scanf("%s %s", &s, &t);
delete_space(s);
delete_space(t);
strcat(t, s);
printf("%s", t);
return 0;
}
| #include <stdio.h>
#include <stdlib.h>
#include <string.h>
void delete_space(char *x) {
while (*x != '\0') {
if (*x == '\n') {
*x = '\0';
}
x++;
}
}
int main() {
char s[256], t[256];
scanf("%s %s", &s, &t);
delete_space(s);
delete_space(t);
strcat(t, s);
printf("%s", t);
return 0;
}
| replace | 14 | 15 | 14 | 15 | 0 | |
p02817 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define FIO ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define forn(i, n) for (int i = 0; i < (int)n; ++i)
#define for1(i, n) for (int i = 1; i <= (int)n; ++i)
#define forr(i, n) for (int i = (int)n - 1; i >= 0; --i)
#define forre(i, a, b) for (int i = (int)b; i >= (int)a; --i)
#define fore(i, a, b) for (int i = (int)a; i <= (int)b; ++i)
#define input(arr, n) \
for (int i = 0; i < n; i++) \
cin >> arr[i]
#define output(arr, n) \
for (int i = 0; i < n; i++) \
cout << arr[i] << " "
#define for_each(arr) \
for (auto &it : arr) \
cout << it << " "
#define ff first
#define ss second
#define PI acos(-1.0)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Unique(a) sort(all(a)), a.erase(unique(all(a)), a.end())
#define pb(x) push_back(x)
#define eb(x) emplace_back(x)
#define ppb(x) pop_back(x)
#define pf(x) push_front(x)
#define ppf(x) pop_front(x)
#define in(x, y) insert({x, y})
#define Sort(a) sort(a.begin(), a.end())
#define mem(arr, a) memset(arr, a, sizeof arr)
#define ins(a) insert(a)
#define max2(a, b) max(a, b)
#define max3(a, b, c) max(a, max(b, c))
#define max4(a, b, c, d) max(a, max3(b, c, d))
#define min2(a, b) min(a, b)
#define min3(a, b, c) min(a, min(b, c))
#define min4(a, b, c, d) min(a, min3(b, c, d))
typedef long long ll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<char> vc;
typedef vector<double> vd;
/*inline int two(int n) { return 1 << n; }
inline int test(int n, int b) { return (n>>b)&1; }
inline void Set(int & n, int b) { n |= two(b); }
inline void Reset(int & n, int b) { n &= ~two(b); }
inline int last_bit(int n) { return n & (-n); }
inline int ones(int n) { int res = 0; while(n && ++res) n-=n&(-n); return res;
}*/
/*int fx[]= {0,0,1,-1,-1,1,-1,1};
int fy[]= {1,-1,0,0,-1,1,1,-1};
int fx1[]={0,1,1,1,0,-1,-1,-1};
int fy1[]={1,1,0,-1,-1,-1,0,1};*/
ll a, b, c, n, ans, cn1, cn2, cn3, t;
string s, s1, s2;
int main() {
FIO;
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
// freopen("output.txt","w",stdout);
#endif
cin >> s >> s1;
cout << s1 + s << endl;
#ifdef ONLINE_JUDGE
cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << "s.\n";
#endif
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
#define FIO ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define forn(i, n) for (int i = 0; i < (int)n; ++i)
#define for1(i, n) for (int i = 1; i <= (int)n; ++i)
#define forr(i, n) for (int i = (int)n - 1; i >= 0; --i)
#define forre(i, a, b) for (int i = (int)b; i >= (int)a; --i)
#define fore(i, a, b) for (int i = (int)a; i <= (int)b; ++i)
#define input(arr, n) \
for (int i = 0; i < n; i++) \
cin >> arr[i]
#define output(arr, n) \
for (int i = 0; i < n; i++) \
cout << arr[i] << " "
#define for_each(arr) \
for (auto &it : arr) \
cout << it << " "
#define ff first
#define ss second
#define PI acos(-1.0)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Unique(a) sort(all(a)), a.erase(unique(all(a)), a.end())
#define pb(x) push_back(x)
#define eb(x) emplace_back(x)
#define ppb(x) pop_back(x)
#define pf(x) push_front(x)
#define ppf(x) pop_front(x)
#define in(x, y) insert({x, y})
#define Sort(a) sort(a.begin(), a.end())
#define mem(arr, a) memset(arr, a, sizeof arr)
#define ins(a) insert(a)
#define max2(a, b) max(a, b)
#define max3(a, b, c) max(a, max(b, c))
#define max4(a, b, c, d) max(a, max3(b, c, d))
#define min2(a, b) min(a, b)
#define min3(a, b, c) min(a, min(b, c))
#define min4(a, b, c, d) min(a, min3(b, c, d))
typedef long long ll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<char> vc;
typedef vector<double> vd;
/*inline int two(int n) { return 1 << n; }
inline int test(int n, int b) { return (n>>b)&1; }
inline void Set(int & n, int b) { n |= two(b); }
inline void Reset(int & n, int b) { n &= ~two(b); }
inline int last_bit(int n) { return n & (-n); }
inline int ones(int n) { int res = 0; while(n && ++res) n-=n&(-n); return res;
}*/
/*int fx[]= {0,0,1,-1,-1,1,-1,1};
int fy[]= {1,-1,0,0,-1,1,1,-1};
int fx1[]={0,1,1,1,0,-1,-1,-1};
int fy1[]={1,1,0,-1,-1,-1,0,1};*/
ll a, b, c, n, ans, cn1, cn2, cn3, t;
string s, s1, s2;
int main() {
FIO;
#ifndef ONLINE_JUDGE
// freopen("input.txt","r",stdin);
// freopen("output.txt","w",stdout);
#endif
cin >> s >> s1;
cout << s1 + s << endl;
#ifdef ONLINE_JUDGE
cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << "s.\n";
#endif
return 0;
}
| replace | 66 | 67 | 66 | 67 | 0 | |
p02817 | C++ | Runtime Error | #include <iostream>
#include <string.h>
using namespace std;
void function(char *s, char *t) {
strcat(t, s);
cout << t << endl;
}
int main() {
char s[50];
char t[50];
cin >> s;
cin >> t;
function(s, t);
return 0;
}
| #include <iostream>
#include <string.h>
using namespace std;
void function(char *s, char *t) {
strcat(t, s);
cout << t << endl;
}
int main() {
char s[500];
char t[500];
cin >> s;
cin >> t;
function(s, t);
return 0;
}
| replace | 10 | 12 | 10 | 12 | 0 | |
p02817 | C++ | Runtime Error | #include <bits/stdc++.h>
#include <iostream>
#include <string>
#define UB upper_bound
#define LB lower_bound
#define BS binary_search
#define IN insert
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define NL cout << endl
#define ll long long int
#define ld long double
#define vl vector<ll>
#define sl set<ll>
#define ml map<ll, ll>
#define sc set<char>
#define li list<ll>
#define vp vector<pair<ll, ll>>
#define vs vector<string>
#define ss set<string>
#define REP(i, a, b) for (ll i = a; i < b; i++)
#define REPI(i, a, b) for (ll i = b - 1; i >= a; i--)
#define REPIT(it, a) for (auto it = a.begin(); it != a.end(); it++)
#define N (ll) pow(2, 32) - 1
#define mod (ll)1000000007
using namespace std;
vl f;
void sieve(ll m) {
REP(i, 1, sqrt(m) + 1) {
if (m % i == 0) {
f.PB(i);
if (m / i != i)
f.PB(m / i);
}
}
}
int main() {
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
ios::sync_with_stdio(0);
cin.tie(0);
ll t = 1;
// cin>>t;
while (t--) {
string s, t, a = "";
cin >> s >> t;
a += t;
a += s;
cout << a << endl;
}
return 0;
} | #include <bits/stdc++.h>
#include <iostream>
#include <string>
#define UB upper_bound
#define LB lower_bound
#define BS binary_search
#define IN insert
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define NL cout << endl
#define ll long long int
#define ld long double
#define vl vector<ll>
#define sl set<ll>
#define ml map<ll, ll>
#define sc set<char>
#define li list<ll>
#define vp vector<pair<ll, ll>>
#define vs vector<string>
#define ss set<string>
#define REP(i, a, b) for (ll i = a; i < b; i++)
#define REPI(i, a, b) for (ll i = b - 1; i >= a; i--)
#define REPIT(it, a) for (auto it = a.begin(); it != a.end(); it++)
#define N (ll) pow(2, 32) - 1
#define mod (ll)1000000007
using namespace std;
vl f;
void sieve(ll m) {
REP(i, 1, sqrt(m) + 1) {
if (m % i == 0) {
f.PB(i);
if (m / i != i)
f.PB(m / i);
}
}
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
ll t = 1;
// cin>>t;
while (t--) {
string s, t, a = "";
cin >> s >> t;
a += t;
a += s;
cout << a << endl;
}
return 0;
} | replace | 38 | 42 | 38 | 39 | 0 | |
p02817 | C++ | Runtime Error | //* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
//* vamsicool007 You are never wrong to do the right thing vamsicool007 *
//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
#include <bits/stdc++.h>
using namespace std;
#define flash \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define endl "\n"
#define int long long
typedef long long ll;
typedef long double ld;
const int mod = 1000000007;
bool isPrime(ll n) {
for (ll i = 2; i * i <= n; ++i) {
if (n % i == 0) {
return false;
}
}
return true;
}
ll factorial(ll n) { return (n == 1 || n == 0) ? 1 : n * factorial(n - 1); }
ll power(ll x, ll y) {
ll res = 1;
x = x;
while (y > 0) {
if (y & 1)
res = (res * x) % mod;
y = y >> 1;
x = (x * x) % mod;
}
return res % mod;
}
ll ncr(ll n, ll r) {
ll res = 1;
if (r > n)
return 0;
if (r > n - r)
r = n - r;
for (ll i = 0; i < r; i++) {
res *= (n - i);
res /= (i + 1);
}
return res;
}
ll gcd(ll a, ll b) {
if (a == 0)
return b;
return gcd(b % a, a);
}
ll lcm(ll a, ll b) { return (a / gcd(a, b) * b); }
ll max(ll a, ll b) {
ll ans = a > b ? a : b;
return ans;
}
ll min(ll a, ll b) {
ll ans = a < b ? a : b;
return ans;
}
signed main() {
flash;
#ifndef ONLINE_JUDGE
freopen("infile.txt", "r", stdin);
freopen("oufile.txt", "w", stdout);
#endif
int t = 1;
// cin>>t;
while (t--) {
string s, t;
cin >> s >> t;
t.append(s);
cout << t;
}
return 0;
}
| //* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
//* vamsicool007 You are never wrong to do the right thing vamsicool007 *
//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
#include <bits/stdc++.h>
using namespace std;
#define flash \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define endl "\n"
#define int long long
typedef long long ll;
typedef long double ld;
const int mod = 1000000007;
bool isPrime(ll n) {
for (ll i = 2; i * i <= n; ++i) {
if (n % i == 0) {
return false;
}
}
return true;
}
ll factorial(ll n) { return (n == 1 || n == 0) ? 1 : n * factorial(n - 1); }
ll power(ll x, ll y) {
ll res = 1;
x = x;
while (y > 0) {
if (y & 1)
res = (res * x) % mod;
y = y >> 1;
x = (x * x) % mod;
}
return res % mod;
}
ll ncr(ll n, ll r) {
ll res = 1;
if (r > n)
return 0;
if (r > n - r)
r = n - r;
for (ll i = 0; i < r; i++) {
res *= (n - i);
res /= (i + 1);
}
return res;
}
ll gcd(ll a, ll b) {
if (a == 0)
return b;
return gcd(b % a, a);
}
ll lcm(ll a, ll b) { return (a / gcd(a, b) * b); }
ll max(ll a, ll b) {
ll ans = a > b ? a : b;
return ans;
}
ll min(ll a, ll b) {
ll ans = a < b ? a : b;
return ans;
}
signed main() {
flash;
int t = 1;
// cin>>t;
while (t--) {
string s, t;
cin >> s >> t;
t.append(s);
cout << t;
}
return 0;
}
| delete | 68 | 73 | 68 | 68 | 0 | |
p02817 | C++ | Runtime Error | #include <stdio.h>
#include <string.h>
int main(void) {
char S[110];
char T[110];
scanf("%s", S);
scanf("%s", T);
printf("%s\n", strcat(T, S));
return 0;
} | #include <stdio.h>
#include <string.h>
int main(void) {
char S[110];
char T[110];
scanf("%s", S);
scanf("%s", T);
printf("%s%s\n", T, S);
return 0;
} | replace | 8 | 9 | 8 | 9 | 0 | |
p02817 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main() {
string S, T;
cin >> S >> T;
for (int i = 0; i < S.size(); i++) {
cout << T.at(i) << S.at(i);
}
cout << endl;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
string S, T;
cin >> S >> T;
cout << T << S << endl;
}
| replace | 6 | 10 | 6 | 7 | -6 | terminate called after throwing an instance of 'std::out_of_range'
what(): basic_string::at: __n (which is 3) >= this->size() (which is 3)
|
p02817 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define ll long long int
int main() {
/*ll t;
cin>>t;
while(t--)*/
char s[101], t[101];
cin >> s >> t;
strcat(t, s);
cout << t;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
#define ll long long int
int main() {
/*ll t;
cin>>t;
while(t--)*/
char s[101], t[203];
cin >> s >> t;
strcat(t, s);
cout << t;
return 0;
}
| replace | 7 | 8 | 7 | 8 | 0 | |
p02817 | C++ | Runtime Error | #include <stdio.h>
#include <string.h>
int main() {
char s[100], t[100];
scanf("%s%s", s, t);
strcat(t, s);
printf("%s", t);
return 0;
} | #include <stdio.h>
#include <string.h>
int main() {
char s[100], t[100];
scanf("%s%s", s, t);
// strcat(t, s);
printf("%s%s", t, s);
return 0;
} | replace | 6 | 8 | 6 | 8 | 0 | |
p02817 | C++ | Runtime Error | #include <algorithm>
#include <cmath>
#include <cstring>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
using namespace std;
int main() {
char s[200], t[200];
cin >> s >> t;
cout << strcat(t, s) << endl;
}
| #include <algorithm>
#include <cmath>
#include <cstring>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
using namespace std;
int main() {
char s[205], t[205];
cin >> s >> t;
cout << strcat(t, s) << endl;
}
| replace | 12 | 13 | 12 | 13 | 0 | |
p02817 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main() {
char s[200], t[200];
scanf("%s%s", &s, &t);
strcat(t, s);
printf("%s", t);
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
char s[200], t[200];
scanf("%s%s", &s, &t);
printf("%s%s", t, s);
return 0;
} | replace | 6 | 8 | 6 | 7 | 0 | |
p02817 | C++ | Runtime Error | #include <stdio.h>
int main() {
char stringa[20];
char stringb[15];
scanf("%s %s", &stringa, &stringb);
printf("%s%s", stringb, stringa);
return 0;
} | #include <stdio.h>
int main() {
char stringa[120];
char stringb[120];
scanf("%s %s", &stringa, &stringb);
printf("%s%s", stringb, stringa);
return 0;
} | replace | 3 | 5 | 3 | 5 | 0 | |
p02817 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(0);
char s[105], t[105];
cin >> s >> t;
strcat(t, s);
cout << t << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(0);
char s[105], t[210];
cin >> s >> t;
strcat(t, s);
cout << t << endl;
return 0;
} | replace | 7 | 8 | 7 | 8 | 0 | |
p02817 | C++ | Runtime Error | #include <stdio.h>
#include <string.h>
int main() {
char S[100], T[100];
scanf("%s%s", &S, &T);
strcat(T, S);
printf("%s", T);
return 0;
} | #include <stdio.h>
#include <string.h>
int main() {
char S[255], T[255];
scanf("%s%s", S, T);
strcat(T, S);
printf("%s", T);
return 0;
} | replace | 4 | 6 | 4 | 6 | 0 | |
p02817 | C++ | Runtime Error | // #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
using llint = long long;
using vint = vector<int>;
using vvint = vector<vector<int>>;
const int INF = 1e9;
const llint llINF = 1e18;
int main() {
char s[120], t[120];
cin >> s >> t;
strcat(t, s);
cout << t << endl;
return 0;
} | // #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
using llint = long long;
using vint = vector<int>;
using vvint = vector<vector<int>>;
const int INF = 1e9;
const llint llINF = 1e18;
int main() {
char s[400], t[400];
cin >> s >> t;
strcat(t, s);
cout << t << endl;
return 0;
} | replace | 14 | 15 | 14 | 15 | 0 | |
p02817 | C++ | Runtime Error | // AnkitCode99
#include <bits/stdc++.h>
#define endl "\n"
#define ll long long int
#define MOD 1000000007
#define mp make_pair
#define pb push_back
#define all(v) (v.begin(), v.end())
#define fast \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0)
#define rep(i, a, b) for (long long int i = a; i < b; i++)
#define nrep(i, a, b) for (long long int i = a; i >= b; i--)
using namespace std;
int main() {
fast;
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
string s, t;
cin >> t >> s;
cout << s + t << endl;
} | // AnkitCode99
#include <bits/stdc++.h>
#define endl "\n"
#define ll long long int
#define MOD 1000000007
#define mp make_pair
#define pb push_back
#define all(v) (v.begin(), v.end())
#define fast \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0)
#define rep(i, a, b) for (long long int i = a; i < b; i++)
#define nrep(i, a, b) for (long long int i = a; i >= b; i--)
using namespace std;
int main() {
fast;
string s, t;
cin >> t >> s;
cout << s + t << endl;
} | delete | 17 | 21 | 17 | 17 | 0 | |
p02817 | C++ | Runtime Error | #include <cstring>
#include <iostream>
using namespace std;
int main() {
char a[100], b[100];
cin >> a >> b;
printf(strcat(b, a));
} | #include <cstring>
#include <iostream>
using namespace std;
int main() {
char a[10000], b[10000];
cin >> a >> b;
printf(strcat(b, a));
} | replace | 4 | 5 | 4 | 5 | 0 | |
p02817 | C++ | Runtime Error | #include <stdio.h>
#include <string.h>
#define N 105
int main() {
char S[N], T[N];
while (scanf("%s%s", S, T) != EOF) {
strcat(T, S);
printf("%s\n", T);
}
return 0;
} | #include <stdio.h>
#include <string.h>
#define N 105
int main() {
char S[N], T[210];
while (scanf("%s%s", S, T) != EOF) {
strcat(T, S);
printf("%s\n", T);
}
return 0;
} | replace | 4 | 5 | 4 | 5 | 0 | |
p02817 | C++ | Runtime Error | #include <stdio.h>
#include <string.h>
int main() {
char S[200], T[200];
scanf("%s %s", S, T);
// strcat(T, S);
printf("%s", strcat(T, S));
return 0;
}
| #include <stdio.h>
#include <string.h>
int main() {
char S[205], T[205];
scanf("%s %s", S, T);
// strcat(T, S);
printf("%s", strcat(T, S));
return 0;
}
| replace | 3 | 4 | 3 | 4 | 0 | |
p02817 | C++ | Runtime Error | #include <stdio.h>
int main() {
char name[20];
char list[20];
scanf("%s %s", &name, &list);
printf("%s%s", list, name);
return 0;
} | #include <stdio.h>
int main() {
char S[101];
char T[101];
scanf("%s %s", &S, &T);
printf("%s%s", T, S);
return 0;
} | replace | 2 | 6 | 2 | 6 | 0 | |
p02817 | C++ | Runtime Error | #include <stdio.h>
int main() {
char s[10];
char t[10];
scanf("%s %s", s, t);
printf("%s%s\n", t, s);
return 0;
} | #include <stdio.h>
int main() {
char s[105];
char t[105];
scanf("%s %s", &s, &t);
printf("%s%s\n", t, s);
return 0;
} | replace | 2 | 5 | 2 | 6 | 0 | |
p02817 | C++ | Runtime Error | #include <stdio.h>
int main() {
char S[88], T[88];
scanf("%s %s", S, T);
printf("%s %S\n", S, T);
return 0;
} | #include <stdio.h>
int main() {
char S[150];
char T[150];
scanf("%s", &S);
scanf("%s", &T);
printf("%s", T);
printf("%s", S);
return 0;
} | replace | 2 | 6 | 2 | 8 | 0 | |
p02817 | C++ | Runtime Error | #include <algorithm>
#include <cstring>
#include <iostream>
#include <stack>
using namespace std;
typedef long long ll;
int main() {
char s[101], t[101];
scanf("%s", s);
scanf("%s", t);
printf("%s", strcat(t, s));
}
| #include <algorithm>
#include <cstring>
#include <iostream>
#include <stack>
using namespace std;
typedef long long ll;
int main() {
char s[101], t[101];
scanf("%s", s);
scanf("%s", t);
printf("%s%s", t, s);
}
| replace | 12 | 13 | 12 | 13 | 0 | |
p02817 | C++ | Runtime Error | /*
*
* Bismillah Hir Rahman Nir Raheem
* Name: Jaied Al Sabid
*
*/
#include <bits/stdc++.h>
#include <iostream>
#include <string>
using namespace std;
int main() {
string s, t, r;
cin >> s >> t;
r += t[0];
r += t[1];
r += t.substr(2);
r += s;
cout << r << endl;
return 0;
}
| /*
*
* Bismillah Hir Rahman Nir Raheem
* Name: Jaied Al Sabid
*
*/
#include <bits/stdc++.h>
#include <iostream>
#include <string>
using namespace std;
int main() {
string s, t, r;
cin >> s >> t;
cout << t << s << endl;
return 0;
}
| replace | 18 | 24 | 18 | 19 | 0 | |
p02817 | C++ | Runtime Error | #include <bits/stdc++.h>
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
string s, t;
cin >> s >> t;
cout << t + s << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
string s, t;
cin >> s >> t;
cout << t + s << endl;
} | delete | 5 | 12 | 5 | 5 | 0 | |
p02817 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main() {
string strN, strM;
cin >> strN >> strM;
for (int i = 0; i < 100; i++) {
cout << strM.at(i) << strN.at(i);
}
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
string strN, strM;
cin >> strN >> strM;
cout << strM << strN;
}
| replace | 6 | 9 | 6 | 7 | -6 | terminate called after throwing an instance of 'std::out_of_range'
what(): basic_string::at: __n (which is 3) >= this->size() (which is 3)
|
p02817 | Python | Runtime Error | s, t = list(input().split().rstrip())
print(t + s)
| s, t = input().rstrip().split()
print(t + s)
| replace | 0 | 1 | 0 | 1 | AttributeError: 'list' object has no attribute 'rstrip' | Traceback (most recent call last):
File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02817/Python/s248204703.py", line 1, in <module>
s, t = list(input().split().rstrip())
AttributeError: 'list' object has no attribute 'rstrip'
|
p02817 | Python | Runtime Error | In = list(map(int, input().split()))
sin = set(In)
print("Yes" if len(sin) == 2 else "No")
| S, T = input().split()
print(T + S)
| replace | 0 | 3 | 0 | 2 | ValueError: invalid literal for int() with base 10: 'oder' | Traceback (most recent call last):
File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02817/Python/s961214447.py", line 1, in <module>
In = list(map(int, input().split()))
ValueError: invalid literal for int() with base 10: 'oder'
|
p02817 | Python | Runtime Error | S = input()
T = input()
print(T + S)
| s, t = input().split()
ans = t + s
print(ans)
| replace | 0 | 3 | 0 | 3 | EOFError: EOF when reading a line | Traceback (most recent call last):
File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02817/Python/s790047642.py", line 2, in <module>
T = input()
EOFError: EOF when reading a line
|
p02818 | C++ | Time Limit Exceeded | #include <bits/extc++.h>
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define FAST \
ios::sync_with_stdio(0); \
cin.tie(0);
#define _ << ' ' <<
using ll = long long int;
signed main() {
FAST ll A, B, K;
cin >> A >> B >> K;
for (ll i = 0; i < K; i++) {
if (!A && !B)
break;
if (A > 0)
A--;
else
B--;
}
cout << A _ B << endl;
} | #include <bits/extc++.h>
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define FAST \
ios::sync_with_stdio(0); \
cin.tie(0);
#define _ << ' ' <<
using ll = long long int;
signed main() {
FAST ll A, B, K;
cin >> A >> B >> K;
ll tmp = 0;
if (K >= A) {
tmp = K - A;
A = 0;
} else
A -= K;
B -= tmp;
if (B < 0)
B = 0;
cout << A _ B << endl;
} | replace | 13 | 21 | 13 | 23 | TLE | |
p02818 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
int main() {
long A, B, K;
cin >> A >> B >> K;
for (long i = 0; i < K; i++) {
if (A >= 1) {
A -= 1;
} else if (B >= 1) {
B -= 1;
}
}
cout << A << " " << B << "\n";
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
long A, B, K;
cin >> A >> B >> K;
long temp = A;
if (K >= A) {
A = 0;
} else if (K < A) {
A -= K;
}
if (A == 0) {
B -= (K - temp);
}
if (B < 0) {
B = 0;
}
cout << A << " " << B << "\n";
return 0;
} | replace | 6 | 12 | 6 | 17 | TLE | |
p02818 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
int main() {
int64_t A, B, K;
cin >> A >> B >> K;
for (int i = 0; i < K; i++) {
if (A > 0) {
--A;
} else if (A == 0 && B > 0) {
--B;
} else if (A == 0 && B == 0) {
break;
}
}
cout << A << " " << B << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int64_t A, B, K;
cin >> A >> B >> K;
if (A > K) {
A = A - K;
} else if (A + B <= K) {
A = 0;
B = 0;
} else {
B -= K - A;
A = 0;
}
cout << A << " " << B << endl;
} | replace | 6 | 14 | 6 | 14 | TLE | |
p02818 | Python | Time Limit Exceeded | A, B, K = [int(_) for _ in input().split()]
for i in range(K):
if A >= 1:
A -= 1
elif B >= 1:
B -= 1
print(A, B)
| A, B, K = [int(_) for _ in input().split()]
if A >= K:
print(A - K, B)
else:
print(0, max(0, B - (K - A)))
| replace | 1 | 7 | 1 | 5 | TLE | |
p02818 | Python | Runtime Error | a, b, k = list(map(int, input().split()))
a_ans = a - min(a, k)
if a_ans == 0:
b_ans = b - min(b, k - a)
print("{} {}".format(a_ans, b_ans))
| a, b, k = list(map(int, input().split()))
a_ans = a - min(a, k)
if a_ans == 0:
b_ans = b - min(b, k - a)
else:
b_ans = b
print("{} {}".format(a_ans, b_ans))
| insert | 4 | 4 | 4 | 6 | 0 | |
p02818 | Python | Runtime Error | a, b, k = input().split()
print(max(a - k, 0), b - max(k - a, 0))
| a, b, k = map(int, input().split())
print(max(a - k, 0), max(b - max(k - a, 0), 0))
| replace | 0 | 2 | 0 | 2 | TypeError: unsupported operand type(s) for -: 'str' and 'str' | Traceback (most recent call last):
File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02818/Python/s417489568.py", line 2, in <module>
print(max(a - k, 0), b - max(k - a, 0))
TypeError: unsupported operand type(s) for -: 'str' and 'str'
|
p02818 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> II;
typedef vector<II> VII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef long long int LL;
typedef unsigned long long int ULL;
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(a) (int)(a.size())
#define ALL(a) a.begin(), a.end()
#define SET(a, b) memset(a, b, sizeof(a))
#define LET(x, a) __typeof(a) x(a)
#define rep(i, begin, end) \
for (__typeof(end) i = (begin) - ((begin) > (end)); \
i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
// Works for forward as well as backward iteration
#define gu getchar
#define pu putchar
#define si(n) scanf("%d", &n)
#define dout(n) printf("%d\n", n)
#define sll(n) scanf("%lld", &n)
#define lldout(n) printf("%lld\n", n)
#define DRT() \
int t; \
si(t); \
while (t--)
#define PlUSWRAP(index, n) \
index = (index + 1) % n // index++; if(index>=n) index=0
#define MINUSWRAP(index, n) \
index = (index + n - 1) % n // index--; if(index<0) index=n-1
#define ROUNDOFFINT(d) \
d = (int)((double)d + 0.5) // Round off d to nearest integer
#define FLUSHN while (gu() != '\n')
#define FLUSHS while (gu() != ' ')
#define TRACE
#ifdef TRACE
#define trace1(x) cerr << #x << ": " << x << endl;
#define trace2(x, y) \
cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z) \
cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " \
<< z << endl;
#define trace4(a, b, c, d) \
cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " \
<< c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e) \
cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " \
<< c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) \
cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " \
<< c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " \
<< #f << ": " << f << endl;
#else
#define trace1(x)
#define trace2(x, y)
#define trace3(x, y, z)
#define trace4(a, b, c, d)
#define trace5(a, b, c, d, e)
#define trace6(a, b, c, d, e, f)
#endif
#define off \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0)
// set_name.find_by_order(k) It returns to an iterator to the kth element
// (counting from zero) in the set in O(logn) time set_name.order_of_key(k) It
// returns to the number of items that are strictly smaller than our item k in
// O(logn) time.
/*string operations :
str.substr (x,y) : returns a substring str[x],str[x+1],...str[x+y-1]
str.substr (x) : returns a substring str[x],... end of string
str.find(qtr) : returns the first occurenece of qtr in str */
int main() {
#ifndef ONLINE_JUDGE
freopen("../input.txt", "r", stdin);
freopen("../output.txt", "w", stdout);
#endif
srand(chrono::steady_clock::now().time_since_epoch().count());
off;
LL a, b, k;
cin >> a >> b >> k;
LL z = 0;
LL diff = max(z, k - a);
a = max(z, a - k);
// cout<<diff<<"\n";
b = max(z, b - diff);
cout << a << " " << b;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> II;
typedef vector<II> VII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef long long int LL;
typedef unsigned long long int ULL;
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(a) (int)(a.size())
#define ALL(a) a.begin(), a.end()
#define SET(a, b) memset(a, b, sizeof(a))
#define LET(x, a) __typeof(a) x(a)
#define rep(i, begin, end) \
for (__typeof(end) i = (begin) - ((begin) > (end)); \
i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
// Works for forward as well as backward iteration
#define gu getchar
#define pu putchar
#define si(n) scanf("%d", &n)
#define dout(n) printf("%d\n", n)
#define sll(n) scanf("%lld", &n)
#define lldout(n) printf("%lld\n", n)
#define DRT() \
int t; \
si(t); \
while (t--)
#define PlUSWRAP(index, n) \
index = (index + 1) % n // index++; if(index>=n) index=0
#define MINUSWRAP(index, n) \
index = (index + n - 1) % n // index--; if(index<0) index=n-1
#define ROUNDOFFINT(d) \
d = (int)((double)d + 0.5) // Round off d to nearest integer
#define FLUSHN while (gu() != '\n')
#define FLUSHS while (gu() != ' ')
#define TRACE
#ifdef TRACE
#define trace1(x) cerr << #x << ": " << x << endl;
#define trace2(x, y) \
cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z) \
cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " \
<< z << endl;
#define trace4(a, b, c, d) \
cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " \
<< c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e) \
cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " \
<< c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) \
cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " \
<< c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " \
<< #f << ": " << f << endl;
#else
#define trace1(x)
#define trace2(x, y)
#define trace3(x, y, z)
#define trace4(a, b, c, d)
#define trace5(a, b, c, d, e)
#define trace6(a, b, c, d, e, f)
#endif
#define off \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0)
// set_name.find_by_order(k) It returns to an iterator to the kth element
// (counting from zero) in the set in O(logn) time set_name.order_of_key(k) It
// returns to the number of items that are strictly smaller than our item k in
// O(logn) time.
/*string operations :
str.substr (x,y) : returns a substring str[x],str[x+1],...str[x+y-1]
str.substr (x) : returns a substring str[x],... end of string
str.find(qtr) : returns the first occurenece of qtr in str */
int main() {
// #ifndef ONLINE_JUDGE
// freopen("../input.txt", "r", stdin);
// freopen("../output.txt", "w", stdout);
// #endif
srand(chrono::steady_clock::now().time_since_epoch().count());
off;
LL a, b, k;
cin >> a >> b >> k;
LL z = 0;
LL diff = max(z, k - a);
a = max(z, a - k);
// cout<<diff<<"\n";
b = max(z, b - diff);
cout << a << " " << b;
return 0;
} | replace | 89 | 93 | 89 | 93 | 0 | |
p02818 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define chinko long long
using namespace std;
int main() {
chinko a, b, k;
cin >> a >> b >> k;
for (chinko i = 0; i < k; i++) {
if (a > 0)
a--;
else if (b > 0)
b--;
else
break;
}
cout << a << " " << b << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define chinko long long
using namespace std;
int main() {
chinko 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;
} | replace | 12 | 21 | 12 | 20 | TLE | |
p02818 | C++ | 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;
} | #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;
} | replace | 8 | 13 | 8 | 13 | 0 | |
p02818 | C++ | 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;
} | #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;
}
| replace | 8 | 15 | 8 | 16 | TLE | |
p02818 | C++ | 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;
} | #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)));
} | replace | 6 | 15 | 6 | 7 | TLE | |
p02818 | C++ | 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;
} | #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;
} | replace | 7 | 14 | 7 | 13 | TLE | |
p02818 | C++ | 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;
} | #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;
} | replace | 10 | 11 | 10 | 11 | 0 | |
p02818 | C++ | 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;
} | #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;
} | replace | 8 | 21 | 8 | 17 | TLE | |
p02818 | C++ | 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;
} | #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;
} | replace | 11 | 18 | 11 | 20 | TLE | |
p02818 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define MOD 1000000007LL
#define rep(i, n) for (ll(i) = 0LL; (i) < (ll)(n); (i)++)
#define rep2(i, s, e) for (ll(i) = (ll)(s); (i) < (ll)(e); (i)++)
#define repi(i, n) for (ll(i) = 0LL; (i) <= (ll)(n); (i)++)
#define repi2(i, s, e) for (ll(i) = (ll)(s); (i) <= (ll)(e); (i)++)
#define per(i, n) for (ll(i) = (ll)(n)-1LL; (i) >= 0LL; (i)--)
#define per2(i, s, e) for (ll(i) = (ll)(s)-1LL; (i) >= (ll)(e); (i)--)
#define peri(i, n) for (ll(i) = (ll)(n); (i) >= 0LL; (i)--)
#define peri2(i, s, e) for (ll(i) = (ll)(s); (i) >= (ll)(e); (i)--)
#define iter(i, it) for (auto &(i) : (it))
template <typename T, typename U>
ostream &operator<<(ostream &s, const pair<T, U> m) {
cout << "(" << m.first << ", " << m.second << ")";
return s;
}
template <typename T, typename U>
ostream &operator<<(ostream &s, const map<T, U> m) {
ll c = 0;
cout << "{ ";
iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
cout << "}";
return s;
}
template <typename T> ostream &operator<<(ostream &s, const vector<T> &v) {
cout << "{ ";
rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
cout << "}";
return s;
}
template <typename T> ostream &operator<<(ostream &s, const list<T> &v) {
ll c = 0;
cout << "{ ";
iter(i, v) cout << i << (c++ == v.size() - 1 ? " " : ", ");
cout << "}";
return s;
}
int main(void) {
ll A, B, K;
cin >> A >> B >> K;
rep(i, K) {
if (A >= 1)
A--;
else if (B >= 1)
B--;
}
cout << A << ' ' << B << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define MOD 1000000007LL
#define rep(i, n) for (ll(i) = 0LL; (i) < (ll)(n); (i)++)
#define rep2(i, s, e) for (ll(i) = (ll)(s); (i) < (ll)(e); (i)++)
#define repi(i, n) for (ll(i) = 0LL; (i) <= (ll)(n); (i)++)
#define repi2(i, s, e) for (ll(i) = (ll)(s); (i) <= (ll)(e); (i)++)
#define per(i, n) for (ll(i) = (ll)(n)-1LL; (i) >= 0LL; (i)--)
#define per2(i, s, e) for (ll(i) = (ll)(s)-1LL; (i) >= (ll)(e); (i)--)
#define peri(i, n) for (ll(i) = (ll)(n); (i) >= 0LL; (i)--)
#define peri2(i, s, e) for (ll(i) = (ll)(s); (i) >= (ll)(e); (i)--)
#define iter(i, it) for (auto &(i) : (it))
template <typename T, typename U>
ostream &operator<<(ostream &s, const pair<T, U> m) {
cout << "(" << m.first << ", " << m.second << ")";
return s;
}
template <typename T, typename U>
ostream &operator<<(ostream &s, const map<T, U> m) {
ll c = 0;
cout << "{ ";
iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
cout << "}";
return s;
}
template <typename T> ostream &operator<<(ostream &s, const vector<T> &v) {
cout << "{ ";
rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
cout << "}";
return s;
}
template <typename T> ostream &operator<<(ostream &s, const list<T> &v) {
ll c = 0;
cout << "{ ";
iter(i, v) cout << i << (c++ == v.size() - 1 ? " " : ", ");
cout << "}";
return s;
}
int main(void) {
ll A, B, K;
cin >> A >> B >> K;
ll temp = min(A, K);
A -= temp;
B = max(0LL, B - (K - temp));
cout << A << ' ' << B << endl;
return 0;
}
| replace | 49 | 55 | 49 | 52 | TLE | |
p02818 | Python | 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()
| 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()
| replace | 10 | 16 | 10 | 14 | TLE | |
p02818 | C++ | 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;
}
| #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;
}
| replace | 21 | 24 | 21 | 24 | 0 | |
p02818 | C++ | 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;
}
| #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;
}
| replace | 14 | 23 | 14 | 22 | TLE | |
p02818 | C++ | 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;
} | // 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;
} | replace | 46 | 50 | 46 | 47 | 0 | |
p02818 | C++ | 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;
}
| #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;
}
| replace | 8 | 14 | 8 | 14 | TLE | |
p02818 | C++ | 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;
}
| #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;
}
| replace | 5 | 17 | 5 | 13 | TLE | |
p02818 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
#define int long long int
#define fi first
#define se second
#define pb push_back
#define soo(v) sort(v.rbegin(), v.rend())
#define so(v) sort(v.begin(), v.end())
#define lb(v, x) lower_bound(v.begin(), v.end(), x)
#define ub(v, x) upper_bound(v.begin(), v.end(), x)
#define endl '\n'
#define dbv(v) \
cout << endl; \
cout << #v << "-->> "; \
for (auto it : v) { \
cout << it << " "; \
} \
cout << endl;
#define dbm(m) \
cout << endl; \
cout << #m << "-->> "; \
for (auto it : m) { \
cout << it.fi << " " << it.se << endl; \
}
#define dbs(s) \
cout << endl; \
cout << #s << "-->> "; \
for (auto it : s) { \
cout << it << " "; \
} \
cout << endl;
#define mod 2019
#define db1(x) cout << #x << "=" << x << endl;
#define db2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl;
#define db3(x, y, z) \
cout << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z \
<< endl;
#define mx 1e18
#define mxe(v) *max_element(v.begin(), v.end())
#define mne(v) *min_element(v.begin(), v.end())
#define double long double
#define re(s) reverse(s.begin(), s.end())
#define io \
std::ios::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL);
int powe(int x, int n) {
if (n == 0)
return 1;
if (n % 2 == 0)
return powe((x % mod * x % mod) % mod, n / 2) % mod;
return (x % mod * powe((x % mod * x % mod) % mod, (n - 1) / 2)) % mod;
}
int gcd(int A, int B) {
if (B == 0)
return A;
return gcd(B, A % B);
}
int32_t main() {
io int a, b, k;
cin >> a >> b >> k;
while (k > 0 && a > 0) {
a--;
k--;
}
while (k > 0 && b > 0) {
b--;
k--;
}
cout << a << " " << b << endl;
} | #include <bits/stdc++.h>
using namespace std;
#define int long long int
#define fi first
#define se second
#define pb push_back
#define soo(v) sort(v.rbegin(), v.rend())
#define so(v) sort(v.begin(), v.end())
#define lb(v, x) lower_bound(v.begin(), v.end(), x)
#define ub(v, x) upper_bound(v.begin(), v.end(), x)
#define endl '\n'
#define dbv(v) \
cout << endl; \
cout << #v << "-->> "; \
for (auto it : v) { \
cout << it << " "; \
} \
cout << endl;
#define dbm(m) \
cout << endl; \
cout << #m << "-->> "; \
for (auto it : m) { \
cout << it.fi << " " << it.se << endl; \
}
#define dbs(s) \
cout << endl; \
cout << #s << "-->> "; \
for (auto it : s) { \
cout << it << " "; \
} \
cout << endl;
#define mod 2019
#define db1(x) cout << #x << "=" << x << endl;
#define db2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl;
#define db3(x, y, z) \
cout << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z \
<< endl;
#define mx 1e18
#define mxe(v) *max_element(v.begin(), v.end())
#define mne(v) *min_element(v.begin(), v.end())
#define double long double
#define re(s) reverse(s.begin(), s.end())
#define io \
std::ios::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL);
int powe(int x, int n) {
if (n == 0)
return 1;
if (n % 2 == 0)
return powe((x % mod * x % mod) % mod, n / 2) % mod;
return (x % mod * powe((x % mod * x % mod) % mod, (n - 1) / 2)) % mod;
}
int gcd(int A, int B) {
if (B == 0)
return A;
return gcd(B, A % B);
}
int32_t main() {
io int a, b, k;
cin >> a >> b >> k;
int kk = a;
a = max(a - k, (int)0);
k -= min(k, kk);
b = max(b - k, (int)0);
cout << a << " " << b << endl;
} | replace | 62 | 70 | 62 | 66 | TLE | |
p02818 | C++ | 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;
} | #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;
} | replace | 21 | 31 | 21 | 27 | TLE | |
p02818 | C++ | 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;
} | #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;
} | replace | 11 | 17 | 11 | 17 | TLE | |
p02818 | C++ | 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;
} | #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;
} | replace | 8 | 16 | 8 | 16 | TLE | |
p02818 | Python | 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)
| 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))
| replace | 1 | 7 | 1 | 7 | TLE | |
p02818 | Python | 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)}")
| 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)))
| replace | 3 | 4 | 3 | 4 | 0 | |
p02818 | C++ | 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;
}
| #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;
}
| replace | 31 | 39 | 31 | 38 | TLE | |
p02818 | Python | 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()
| 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()
| replace | 3 | 8 | 3 | 12 | TLE | |
p02818 | C++ | 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;
}
| #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;
} | replace | 8 | 15 | 8 | 12 | TLE | |
p02818 | Python | 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)
| 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)
| insert | 2 | 2 | 2 | 3 | 0 | |
p02818 | C++ | 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;
} | #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;
}
| replace | 32 | 37 | 32 | 42 | TLE | |
p02818 | C++ | 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;
}
| #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;
}
| replace | 10 | 22 | 10 | 15 | TLE | |
p02818 | C++ | 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;
} | #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;
} | replace | 12 | 21 | 12 | 19 | TLE | |
p02818 | C++ | 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;
} | #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;
} | replace | 7 | 16 | 7 | 14 | TLE | |
p02818 | C++ | 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";
}
| #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";
}
| replace | 17 | 27 | 17 | 23 | TLE | |
p02818 | C++ | 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;
} | #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;
} | replace | 8 | 18 | 8 | 10 | TLE | |
p02818 | C++ | 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;
} | #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;
} | replace | 5 | 16 | 5 | 11 | TLE | |
p02818 | C++ | 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;
} | #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;
} | replace | 9 | 17 | 9 | 25 | TLE | |
p02818 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
inline int toInt(string s) {
int v;
istringstream sin(s);
sin >> v;
return v;
}
template <class T> inline string toString(T x) {
ostringstream sout;
sout << x;
return sout.str();
}
template <class T> inline T sqr(T x) { return x * x; }
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long ll;
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i, c) \
for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(v, n) sort(v, v + n)
#define VSORT(v) sort(v.begin(), v.end())
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORR(i, m, n) for (int i = m; i >= n; i--)
#define INF 999999999
const double EPS = 1e-10;
const double PI = acos(-1.0);
#define CLR(a) memset((a), 0, sizeof(a))
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x) \
cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
<< " " << __FILE__ << endl;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
ll a, b, k;
cin >> a >> b >> k;
for (ll i = 0; i < k; i++) {
if (a > 0)
a--;
else if (b > 0)
b--;
}
cout << a << " " << b << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
inline int toInt(string s) {
int v;
istringstream sin(s);
sin >> v;
return v;
}
template <class T> inline string toString(T x) {
ostringstream sout;
sout << x;
return sout.str();
}
template <class T> inline T sqr(T x) { return x * x; }
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long ll;
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i, c) \
for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(v, n) sort(v, v + n)
#define VSORT(v) sort(v.begin(), v.end())
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORR(i, m, n) for (int i = m; i >= n; i--)
#define INF 999999999
const double EPS = 1e-10;
const double PI = acos(-1.0);
#define CLR(a) memset((a), 0, sizeof(a))
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x) \
cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
<< " " << __FILE__ << endl;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
ll a, b, k;
cin >> a >> b >> k;
if (a < k) {
k -= a;
a = 0;
} else {
a -= k;
k = 0;
}
b -= k;
if (0 > b) {
b = 0;
}
cout << a << " " << b << endl;
return 0;
} | replace | 47 | 52 | 47 | 59 | TLE | |
p02818 | C++ | 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;
} | #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;
} | replace | 11 | 19 | 11 | 16 | TLE | |
p02818 | C++ | 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;
}
| #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;
}
| replace | 6 | 13 | 6 | 12 | TLE | |
p02818 | C++ | 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;
} | #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;
} | replace | 24 | 33 | 24 | 32 | TLE | |
p02818 | C++ | 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;
}
| #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;
}
| replace | 13 | 22 | 13 | 20 | TLE | |
p02818 | C++ | 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;
} | #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;
} | replace | 5 | 14 | 5 | 13 | TLE | |
p02818 | C++ | 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;
} |
#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;
} | replace | 11 | 17 | 11 | 19 | TLE | |
p02818 | C++ | 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;
} | #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;
} | replace | 15 | 20 | 15 | 20 | TLE | |
p02818 | C++ | 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;
}
} | #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;
} | replace | 21 | 26 | 21 | 26 | 0 | |
p02818 | C++ | 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;
} | #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;
} | replace | 36 | 43 | 36 | 46 | TLE | |
p02818 | C++ | 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;
}
} | #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;
}
} | replace | 6 | 15 | 6 | 12 | TLE | |
p02818 | C++ | 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;
} | #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;
} | delete | 6 | 10 | 6 | 6 | 0 | |
p02818 | C++ | 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;
}
| #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;
}
| replace | 26 | 33 | 26 | 34 | TLE | |
p02818 | C++ | 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;
} | #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;
} | replace | 3 | 13 | 3 | 16 | 0 | |
p02818 | Python | 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)
| 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)
| replace | 2 | 9 | 2 | 5 | TLE | |
p02818 | Python | 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)
| 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)
| replace | 2 | 9 | 2 | 8 | TLE | |
p02818 | C++ | 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;
} | #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;
} | replace | 13 | 20 | 13 | 23 | TLE | |
p02818 | C++ | 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;
} | #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;
} | replace | 9 | 24 | 9 | 15 | TLE | |
p02818 | C++ | 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;
} | #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;
} | replace | 7 | 14 | 7 | 20 | TLE | |
p02818 | C++ | 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;
}
| #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;
}
| replace | 21 | 28 | 21 | 25 | TLE | |
p02818 | C++ | Runtime Error | #include <algorithm>
#include <bits/stdc++.h>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(X, S, E) for (int(X) = (S); (X) < (E); ++(X))
#define rrep(X, S, E) for (int(X) = (E)-1; (X) >= (S); --(X))
#define itrep(X, Y) for (auto(X) = (Y).begin(); (X) != (Y).end(); (X)++)
#define all(X) (X).begin(), (X).end()
#define sortDecending(X) sort(all(X), greater<ll>()) // 降順
#define sortAscending(X) sort(all(X)) // 昇順
#define pb push_back
#define mp make_pair
#define fi first
#define sc second
#define print(x) cout << x << endl
#define printDouble(x) cout << fixed << setprecision(13) << x << endl
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef priority_queue<ll, vl> decendingQueue; // 降順
typedef priority_queue<ll, vl, greater<ll>> ascendingQueue; // 昇順
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll INF = 9 * 1e18;
const ll MOD = 1e9 + 7;
long long gcd(long long m, long long n) {
if (m < n)
return gcd(n, m);
if (n == 0)
return m;
return gcd(n, m % n);
}
long long lcm(long long m, long long n) {
// m * nでlong型のオーバフローを発生させないため、先に割り算から行う
return m * (n / gcd(m, n));
}
// a + bをprimeで割った値を返す
long long addMod(long long a, long long b) { return (a + b) % MOD; }
long long minusMod(long long a, long long b) { return (a + MOD - b) % MOD; }
long long multipleMod(long long a, long long b) {
return ((a % MOD) * (b % MOD)) % MOD;
}
vector<long long> SieveOfEratosthenes(int max) {
vector<long long> sieve;
vector<long long> primes;
for (int i = 1; i < max + 1; ++i) {
sieve.push_back(i);
}
sieve[0] = 0;
for (int i = 2; i < max + 1; ++i) {
if (sieve[i - 1] != 0) {
primes.push_back(sieve[i - 1]);
for (int j = 2 * sieve[i - 1]; j < max + 1; j += sieve[i - 1]) {
sieve[j - 1] = 0;
}
}
}
return primes;
}
class Combination {
private:
vector<long long> fac_;
vector<long long> finv_;
vector<long long> inv_;
long long prime_;
public:
Combination(long long n, long long prime) {
fac_ = vector<long long>(n + 1);
finv_ = vector<long long>(n + 1);
inv_ = vector<long long>(n + 1);
prime_ = prime;
fac_[0] = fac_[1] = 1;
finv_[0] = finv_[1] = 1;
inv_[1] = 1;
for (long long i = 2; i <= n; i++) {
fac_[i] = fac_[i - 1] * i % prime_;
inv_[i] = prime_ - inv_[prime_ % i] * (prime_ / i) % prime_;
finv_[i] = finv_[i - 1] * inv_[i] % prime_;
}
}
// nCk
long long getCombination(long long n, long long k) {
if (n < k)
return 0;
if (n < 0 || k < 0)
return 0;
return fac_[n] * (finv_[k] * finv_[n - k] % prime_) % prime_;
}
};
class UnionFindTree {
private:
vector<int> par;
vector<int> rnk;
vector<int> siz;
public:
UnionFindTree(int n) {
par.assign(n, -1);
rnk.assign(n, -1);
siz.assign(n, -1);
for (int i = 0; i < n; ++i) {
par[i] = i;
rnk[i] = 0;
siz[i] = 1;
}
}
int find(int x) {
if (par[x] == x)
return x;
else
return par[x] = find(par[x]);
}
bool same(int x, int y) { return find(x) == find(y); }
void unite(int x, int y) {
x = find(x);
y = find(y);
if (x == y)
return;
if (rnk[x] < rnk[y]) {
par[x] = y;
siz[y] += siz[x];
} else {
par[y] = x;
siz[x] += siz[y];
if (rnk[x] == rnk[y])
++rnk[x];
}
}
int size(int x) {
x = find(x);
return siz[x];
}
};
class Edge {
public:
ll from;
ll to;
ll cost;
Edge() {}
Edge(ll from, ll to, ll cost) {
this->from = from;
this->to = to;
this->cost = cost;
}
bool operator<(const Edge &edge) const {
return cost < edge.cost; // 昇順
}
};
class Graph {
public:
ll nodes; // ノード数
vector<Edge> edges;
Graph() {}
Graph(ll nodes) { this->nodes = nodes; }
void addEdge(ll from, ll to, ll cost) {
this->edges.push_back(Edge(from, to, cost));
}
};
// クラスカル法
// 連結グラフの最小全域木を求める
class Kruskal {
private:
Graph graph;
vector<Edge> MinimumSpanningTree;
ll minimumCost;
void searchMinimumSpanningTree() {
UnionFindTree uf(graph.nodes);
sort(all(graph.edges));
itrep(edge, graph.edges) {
if (!uf.same(edge->from, edge->to)) {
uf.unite(edge->from, edge->to);
MinimumSpanningTree.push_back(*edge);
}
}
}
public:
Kruskal(Graph graph) { this->graph = graph; }
ll getMinimumSpanningTreeCost() {
searchMinimumSpanningTree();
ll cost = 0;
itrep(it, MinimumSpanningTree) { cost += it->cost; }
return cost;
}
};
// ダイクストラ法 O((E+V)logV)
// 最小経路問題を解くためのアルゴリズム。辺の重みに負数を含む場合は利用不可
// 無向グラフ
class Dijkstra {
private:
Graph graph;
map<ll, vector<Edge>> fromPaths;
vl distances;
vl srcs;
public:
Dijkstra(Graph graph) {
this->graph = graph;
itrep(edge, graph.edges) {
fromPaths[edge->from].push_back(*edge);
fromPaths[edge->to].push_back(Edge(edge->to, edge->from, edge->cost));
}
}
void searchMinimumPathFrom(ll src) {
// 複数回呼ばれる度に計算する
this->distances = vl(graph.nodes + 1, INF);
this->srcs = vl(graph.nodes + 1, INF);
priority_queue<ll> pq;
distances[src] = 0;
srcs[src] = -1;
pq.push(src);
while (!pq.empty()) {
int u = pq.top();
pq.pop();
itrep(edge, fromPaths[u]) {
int v = edge->to;
int w = edge->cost;
if (distances[v] > distances[u] + w) {
distances[v] = distances[u] + w;
srcs[v] = u;
pq.push(v);
}
}
}
};
ll getDistance(ll n) { return this->distances[n]; }
ll getFrom(ll n) { return this->srcs[n]; }
};
// ベルマンフォード O(|V||E|)
// 負コストが含まれていても最短経路問題を解くためのアルゴリズム。閉路の検出も可能
// 有向グラフ
class BellmanFord {
private:
Graph graph;
// 閉路が含まれるかは個々のノードごとに管理する必要あり
vector<bool> hasNegativeCycles;
vector<ll> distances;
public:
BellmanFord(Graph graph) {
this->graph = graph;
this->distances = vector<ll>(this->graph.nodes + 1, INF);
this->hasNegativeCycles = vector<bool>(this->graph.nodes + 1, false);
}
void searchMinimumPathFrom(ll src) {
this->distances[src] = 0;
for (ll i = 0; i < graph.nodes - 1; i++) {
itrep(edge, graph.edges) {
ll u = edge->from;
ll v = edge->to;
ll w = edge->cost;
if (this->distances[u] != INF) {
chmin(this->distances[v], this->distances[u] + w);
}
}
}
itrep(edge, graph.edges) {
ll u = edge->from;
ll v = edge->to;
ll w = edge->cost;
if (this->distances[u] == INF) {
continue;
}
if (this->distances[u] + w < this->distances[v]) {
this->hasNegativeCycles[v] = true;
}
}
for (ll i = 0; i < graph.nodes; i++) {
itrep(edge, graph.edges) {
ll u = edge->from;
ll v = edge->to;
ll w = edge->cost;
if (this->distances[u] == INF) {
continue;
}
chmin(this->distances[v], this->distances[u] + w);
if (this->hasNegativeCycles[u] == true) {
this->hasNegativeCycles[v] = true;
}
}
}
}
ll getDistance(ll n) { return this->distances[n]; }
bool hasNegativeCycle(ll n) { return this->hasNegativeCycles[n]; }
};
// O(V^3) 有向グラフ
class WarshallFloyd {
private:
Graph graph;
int nodes = this->graph.nodes + 1;
vector<vector<ll>> distances;
public:
WarshallFloyd(Graph graph) {
this->graph = graph;
nodes = this->graph.nodes + 1;
this->distances = vector<vector<ll>>(nodes, vector<ll>(nodes, INF));
itrep(edge, graph.edges) {
int from = edge->from;
int to = edge->to;
int cost = edge->cost;
distances[from][to] = cost;
}
}
void searchMinimumPath() {
for (int k = 0; k < nodes; k++) {
for (int i = 0; i < nodes; i++) {
for (int j = 0; j < nodes; j++) {
if (distances[i][k] == INF || distances[k][j] == INF) {
continue;
}
if (distances[i][k] + distances[k][j] < distances[i][j]) {
distances[i][j] = distances[i][k] + distances[k][j];
}
}
}
}
}
ll getDistance(int from, int to) { return distances[from][to]; }
};
void solve(long long A, long long B, long long K) {
ll rest = A - K;
if (rest >= 0) {
print(rest + " " + B);
return;
}
rest = max(0ll, B + rest);
print("0 " << rest);
}
int main() {
long long A;
scanf("%lld", &A);
long long B;
scanf("%lld", &B);
long long K;
scanf("%lld", &K);
solve(A, B, K);
return 0;
}
| #include <algorithm>
#include <bits/stdc++.h>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(X, S, E) for (int(X) = (S); (X) < (E); ++(X))
#define rrep(X, S, E) for (int(X) = (E)-1; (X) >= (S); --(X))
#define itrep(X, Y) for (auto(X) = (Y).begin(); (X) != (Y).end(); (X)++)
#define all(X) (X).begin(), (X).end()
#define sortDecending(X) sort(all(X), greater<ll>()) // 降順
#define sortAscending(X) sort(all(X)) // 昇順
#define pb push_back
#define mp make_pair
#define fi first
#define sc second
#define print(x) cout << x << endl
#define printDouble(x) cout << fixed << setprecision(13) << x << endl
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef priority_queue<ll, vl> decendingQueue; // 降順
typedef priority_queue<ll, vl, greater<ll>> ascendingQueue; // 昇順
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll INF = 9 * 1e18;
const ll MOD = 1e9 + 7;
long long gcd(long long m, long long n) {
if (m < n)
return gcd(n, m);
if (n == 0)
return m;
return gcd(n, m % n);
}
long long lcm(long long m, long long n) {
// m * nでlong型のオーバフローを発生させないため、先に割り算から行う
return m * (n / gcd(m, n));
}
// a + bをprimeで割った値を返す
long long addMod(long long a, long long b) { return (a + b) % MOD; }
long long minusMod(long long a, long long b) { return (a + MOD - b) % MOD; }
long long multipleMod(long long a, long long b) {
return ((a % MOD) * (b % MOD)) % MOD;
}
vector<long long> SieveOfEratosthenes(int max) {
vector<long long> sieve;
vector<long long> primes;
for (int i = 1; i < max + 1; ++i) {
sieve.push_back(i);
}
sieve[0] = 0;
for (int i = 2; i < max + 1; ++i) {
if (sieve[i - 1] != 0) {
primes.push_back(sieve[i - 1]);
for (int j = 2 * sieve[i - 1]; j < max + 1; j += sieve[i - 1]) {
sieve[j - 1] = 0;
}
}
}
return primes;
}
class Combination {
private:
vector<long long> fac_;
vector<long long> finv_;
vector<long long> inv_;
long long prime_;
public:
Combination(long long n, long long prime) {
fac_ = vector<long long>(n + 1);
finv_ = vector<long long>(n + 1);
inv_ = vector<long long>(n + 1);
prime_ = prime;
fac_[0] = fac_[1] = 1;
finv_[0] = finv_[1] = 1;
inv_[1] = 1;
for (long long i = 2; i <= n; i++) {
fac_[i] = fac_[i - 1] * i % prime_;
inv_[i] = prime_ - inv_[prime_ % i] * (prime_ / i) % prime_;
finv_[i] = finv_[i - 1] * inv_[i] % prime_;
}
}
// nCk
long long getCombination(long long n, long long k) {
if (n < k)
return 0;
if (n < 0 || k < 0)
return 0;
return fac_[n] * (finv_[k] * finv_[n - k] % prime_) % prime_;
}
};
class UnionFindTree {
private:
vector<int> par;
vector<int> rnk;
vector<int> siz;
public:
UnionFindTree(int n) {
par.assign(n, -1);
rnk.assign(n, -1);
siz.assign(n, -1);
for (int i = 0; i < n; ++i) {
par[i] = i;
rnk[i] = 0;
siz[i] = 1;
}
}
int find(int x) {
if (par[x] == x)
return x;
else
return par[x] = find(par[x]);
}
bool same(int x, int y) { return find(x) == find(y); }
void unite(int x, int y) {
x = find(x);
y = find(y);
if (x == y)
return;
if (rnk[x] < rnk[y]) {
par[x] = y;
siz[y] += siz[x];
} else {
par[y] = x;
siz[x] += siz[y];
if (rnk[x] == rnk[y])
++rnk[x];
}
}
int size(int x) {
x = find(x);
return siz[x];
}
};
class Edge {
public:
ll from;
ll to;
ll cost;
Edge() {}
Edge(ll from, ll to, ll cost) {
this->from = from;
this->to = to;
this->cost = cost;
}
bool operator<(const Edge &edge) const {
return cost < edge.cost; // 昇順
}
};
class Graph {
public:
ll nodes; // ノード数
vector<Edge> edges;
Graph() {}
Graph(ll nodes) { this->nodes = nodes; }
void addEdge(ll from, ll to, ll cost) {
this->edges.push_back(Edge(from, to, cost));
}
};
// クラスカル法
// 連結グラフの最小全域木を求める
class Kruskal {
private:
Graph graph;
vector<Edge> MinimumSpanningTree;
ll minimumCost;
void searchMinimumSpanningTree() {
UnionFindTree uf(graph.nodes);
sort(all(graph.edges));
itrep(edge, graph.edges) {
if (!uf.same(edge->from, edge->to)) {
uf.unite(edge->from, edge->to);
MinimumSpanningTree.push_back(*edge);
}
}
}
public:
Kruskal(Graph graph) { this->graph = graph; }
ll getMinimumSpanningTreeCost() {
searchMinimumSpanningTree();
ll cost = 0;
itrep(it, MinimumSpanningTree) { cost += it->cost; }
return cost;
}
};
// ダイクストラ法 O((E+V)logV)
// 最小経路問題を解くためのアルゴリズム。辺の重みに負数を含む場合は利用不可
// 無向グラフ
class Dijkstra {
private:
Graph graph;
map<ll, vector<Edge>> fromPaths;
vl distances;
vl srcs;
public:
Dijkstra(Graph graph) {
this->graph = graph;
itrep(edge, graph.edges) {
fromPaths[edge->from].push_back(*edge);
fromPaths[edge->to].push_back(Edge(edge->to, edge->from, edge->cost));
}
}
void searchMinimumPathFrom(ll src) {
// 複数回呼ばれる度に計算する
this->distances = vl(graph.nodes + 1, INF);
this->srcs = vl(graph.nodes + 1, INF);
priority_queue<ll> pq;
distances[src] = 0;
srcs[src] = -1;
pq.push(src);
while (!pq.empty()) {
int u = pq.top();
pq.pop();
itrep(edge, fromPaths[u]) {
int v = edge->to;
int w = edge->cost;
if (distances[v] > distances[u] + w) {
distances[v] = distances[u] + w;
srcs[v] = u;
pq.push(v);
}
}
}
};
ll getDistance(ll n) { return this->distances[n]; }
ll getFrom(ll n) { return this->srcs[n]; }
};
// ベルマンフォード O(|V||E|)
// 負コストが含まれていても最短経路問題を解くためのアルゴリズム。閉路の検出も可能
// 有向グラフ
class BellmanFord {
private:
Graph graph;
// 閉路が含まれるかは個々のノードごとに管理する必要あり
vector<bool> hasNegativeCycles;
vector<ll> distances;
public:
BellmanFord(Graph graph) {
this->graph = graph;
this->distances = vector<ll>(this->graph.nodes + 1, INF);
this->hasNegativeCycles = vector<bool>(this->graph.nodes + 1, false);
}
void searchMinimumPathFrom(ll src) {
this->distances[src] = 0;
for (ll i = 0; i < graph.nodes - 1; i++) {
itrep(edge, graph.edges) {
ll u = edge->from;
ll v = edge->to;
ll w = edge->cost;
if (this->distances[u] != INF) {
chmin(this->distances[v], this->distances[u] + w);
}
}
}
itrep(edge, graph.edges) {
ll u = edge->from;
ll v = edge->to;
ll w = edge->cost;
if (this->distances[u] == INF) {
continue;
}
if (this->distances[u] + w < this->distances[v]) {
this->hasNegativeCycles[v] = true;
}
}
for (ll i = 0; i < graph.nodes; i++) {
itrep(edge, graph.edges) {
ll u = edge->from;
ll v = edge->to;
ll w = edge->cost;
if (this->distances[u] == INF) {
continue;
}
chmin(this->distances[v], this->distances[u] + w);
if (this->hasNegativeCycles[u] == true) {
this->hasNegativeCycles[v] = true;
}
}
}
}
ll getDistance(ll n) { return this->distances[n]; }
bool hasNegativeCycle(ll n) { return this->hasNegativeCycles[n]; }
};
// O(V^3) 有向グラフ
class WarshallFloyd {
private:
Graph graph;
int nodes = this->graph.nodes + 1;
vector<vector<ll>> distances;
public:
WarshallFloyd(Graph graph) {
this->graph = graph;
nodes = this->graph.nodes + 1;
this->distances = vector<vector<ll>>(nodes, vector<ll>(nodes, INF));
itrep(edge, graph.edges) {
int from = edge->from;
int to = edge->to;
int cost = edge->cost;
distances[from][to] = cost;
}
}
void searchMinimumPath() {
for (int k = 0; k < nodes; k++) {
for (int i = 0; i < nodes; i++) {
for (int j = 0; j < nodes; j++) {
if (distances[i][k] == INF || distances[k][j] == INF) {
continue;
}
if (distances[i][k] + distances[k][j] < distances[i][j]) {
distances[i][j] = distances[i][k] + distances[k][j];
}
}
}
}
}
ll getDistance(int from, int to) { return distances[from][to]; }
};
void solve(long long A, long long B, long long K) {
ll rest = A - K;
if (rest >= 0) {
print(rest << " " << B);
return;
}
rest = max(0ll, B + rest);
print("0 " << rest);
}
int main() {
long long A;
scanf("%lld", &A);
long long B;
scanf("%lld", &B);
long long K;
scanf("%lld", &K);
solve(A, B, K);
return 0;
}
| replace | 379 | 380 | 379 | 380 | 0 | |
p02818 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
using uint = unsigned;
using pcc = pair<char, char>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pdd = pair<double, double>;
using tuplis = array<ll, 3>;
template <class T> using pq = priority_queue<T, vector<T>, greater<T>>;
const ll LINF = 0x1fffffffffffffff;
const ll MINF = 0x7fffffffffff;
const ll LPLMT = 10000000; // O(n)のloop上限
const ll NLGLMT =
200000; // O(NlogN)のloop上限(これで指定されたfor文の中にO(logN)の処理を書く)
const ll N2LMT = 3000; // O(n^2)のloop上限
const ll N3LMT = 100; // O(n^3)のloop上限
const ll N4LMT = 50; // O(n^4)のloop上限
const ll TNLMT =
20; // O(2^n)のloop上限(実際この計算量になるのは全探索くらいなので,この値自体を使うことはなさそう)(オーダの参考程度に)
const int INF = 0x3fffffff;
const int MOD = 1000000007;
const int MODD = 998244353;
const ld DINF = numeric_limits<ld>::infinity();
const ld EPS = 1e-9;
const ld PI = 3.1415926535897932;
const ll dx[] = {0, 1, 0, -1, 1, -1, 1, -1};
const ll dy[] = {1, 0, -1, 0, 1, 1, -1, -1};
#define overload4(_1, _2, _3, _4, name, ...) name
#define overload3(_1, _2, _3, name, ...) name
/*繰り返し*/
#define rep1(n) for (ll i = 0; i < n; ++i) // n回repeat
#define rep2(i, n) for (ll i = 0; i < n; ++i) // n回repeat(変数指定)
#define rep3(i, a, b) for (ll i = a; i < b; ++i) // a-bまでrepeat
#define rep4(i, a, b, c) \
for (ll i = a; i < b; i += c) // a-bまで公差cでrepeat(等差数列で使えそう)
#define rep(...) \
overload4(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__) // repeatまとめ
#define rrep1(n) for (ll i = (n); i--;)
#define rrep2(i, n) for (ll i = (n); i--;)
#define rrep3(i, a, b) for (ll i = (b); i-- > (a);)
#define rrep4(i, a, b, c) for (ll i = a + (b - a - 1) / c * c; i >= a; i -= c)
#define rrep(...) \
overload4(__VA_ARGS__, rrep4, rrep3, rrep2, \
rrep1)(__VA_ARGS__) // 逆repeatまとめ
#define each1(i, a) for (auto &&i : a)
#define each2(x, y, a) for (auto &&[x, y] : a)
#define each3(x, y, z, a) for (auto &&[x, y, z] : a)
#define each(...) \
overload4(__VA_ARGS__, each3, each2, \
each1)(__VA_ARGS__) // 配列の各要素の読み出し
#define all1(i) begin(i), end(i)
#define all2(i, a) begin(i), begin(i) + a
#define all3(i, a, b) begin(i) + a, begin(i) + b
#define all(...) \
overload3(__VA_ARGS__, all3, all2, \
all1)(__VA_ARGS__) // vectorの始めと終わりの読み取り
#define rall1(i) (i).rbegin(), (i).rend()
#define rall2(i, k) (i).rbegin(), (i).rbegin() + k
#define rall3(i, a, b) (i).rbegin() + a, (i).rbegin() + b
#define rall(...) \
overload3(__VA_ARGS__, rall3, rall2, \
rall1)(__VA_ARGS__) // 逆イテレータの取得(rbegin:末尾,rend:頭)
#define sum(...) \
accumulate( \
all(__VA_ARGS__), \
0LL) // vectorの合計(int形で受け付けてしまうので,小数で扱いたい場合はdsumを使う)
#define dsum(...) \
accumulate(all(__VA_ARGS__), 0.0L) // 小数で扱う(long long doubleなど)
#define elif else if
#define unless(a) if (!(a))
#define mp make_pair
#define mt make_tuple
/*標準入力*/
#define INT(...) \
int __VA_ARGS__; \
in(__VA_ARGS__) // int型標準入力受付,以下LDまで同様
#define LL(...) \
ll __VA_ARGS__; \
in(__VA_ARGS__)
#define ULL(...) \
ull __VA_ARGS__; \
in(__VA_ARGS__)
#define STR(...) \
string __VA_ARGS__; \
in(__VA_ARGS__)
#define CHR(...) \
char __VA_ARGS__; \
in(__VA_ARGS__)
#define DBL(...) \
double __VA_ARGS__; \
in(__VA_ARGS__)
#define LD(...) \
ld __VA_ARGS__; \
in(__VA_ARGS__)
/*vector操作*/
#define Sort(a) sort(all(a)) // 昇順ソート
#define RSort(vec) sort(vec.begin(), vec.end(), greater<ll>()) // 降順ソート
#define Rev(a) reverse(all(a)) // 逆順
#define Uniq(a) \
sort(all(a)); \
a.erase(unique(all(a)), end(a))
#define vec(type, name, ...) vector<type> name(__VA_ARGS__) // type型vectorの定義
#define VEC(type, name, size) \
vector<type> name(size); \
in(name) // type型vector(size指定)標準入力受付
#define vv(type, name, h, ...) \
vector<vector<type>> name(h, vector<type>(__VA_ARGS__))
#define VV(type, name, h, w) \
vector<vector<type>> name(h, vector<type>(w)); \
in(name)
#define IV(type, name, size) \
vector<pair<int, int>> name; \
for (int i = 0; i < size; i++) { \
int a_i; \
cin >> a_i; \
name.emplace_back(a_i, i); \
} // Indexつきvector(pair型Vector,(data,index))
#define vvv(type, name, h, w, ...) \
vector<vector<vector<type>>> name( \
h, vector<vector<type>>(w, vector<type>(__VA_ARGS__)))
template <class T> auto min(const T &a) { return *min_element(all(a)); }
template <class T> auto max(const T &a) { return *max_element(all(a)); }
inline ll popcnt(ull a) { return __builtin_popcountll(a); }
ll gcd(ll a, ll b) {
while (b) {
ll c = b;
b = a % b;
a = c;
}
return a;
}
ll lcm(ll a, ll b) {
if (!a || !b)
return 0;
return a * b / gcd(a, b);
}
ll intpow(ll a, ll b) {
ll ans = 1;
while (b) {
if (b & 1)
ans *= a;
a *= a;
b /= 2;
}
return ans;
}
ll modpow(ll a, ll b, ll p) {
ll ans = 1;
while (b) {
if (b & 1)
(ans *= a) %= p;
(a *= a) %= p;
b /= 2;
}
return ans;
}
template <class T, class U> bool chmin(T &a, const U &b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
template <class T, class U> bool chmax(T &a, const U &b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
vector<ll> iota(ll n) {
vector<ll> a(n);
iota(a.begin(), a.end(), 0);
return a;
}
vector<pll> factor(ull x) {
vector<pll> ans;
for (ull i = 2; i * i <= x; i++)
if (x % i == 0) {
ans.push_back({i, 1});
while ((x /= i) % i == 0)
ans.back().second++;
}
if (x != 1)
ans.push_back({x, 1});
return ans;
}
map<ll, ll> factor_map(ull x) {
map<ll, ll> ans;
for (ull i = 2; i * i <= x; i++)
if (x % i == 0) {
ans[i] = 1;
while ((x /= i) % i == 0)
ans[i]++;
}
if (x != 1)
ans[x] = 1;
return ans;
}
vector<ll> divisor(ull x) {
vector<ll> ans;
for (ull i = 1; i * i <= x; i++)
if (x % i == 0)
ans.push_back(i);
rrep(ans.size() - (ans.back() * ans.back() == x)) ans.push_back(x / ans[i]);
return ans;
}
template <class T> unordered_map<T, ll> press(vector<T> &a) {
auto b = a;
sort(all(b));
b.erase(unique(all(b)), b.end());
unordered_map<T, ll> ans;
rep(b.size()) ans[b[i]] = i;
each(i, a) i = ans[i];
return ans;
}
template <class T> map<T, ll> press_map(vector<T> &a) {
auto b = a;
sort(all(b));
b.erase(unique(all(b)), b.end());
map<T, ll> ans;
rep(b.size()) ans[b[i]] = i;
each(i, a) i = ans[i];
return ans;
}
int scan() { return getchar(); }
void scan(int &a) { scanf("%d", &a); }
void scan(unsigned &a) { scanf("%u", &a); }
void scan(long &a) { scanf("%ld", &a); }
void scan(long long &a) { scanf("%lld", &a); }
void scan(unsigned long long &a) { scanf("%llu", &a); }
void scan(char &a) {
do {
a = getchar();
} while (a == ' ' || a == '\n');
}
void scan(float &a) { scanf("%f", &a); }
void scan(double &a) { scanf("%lf", &a); }
void scan(long double &a) { scanf("%Lf", &a); }
void scan(vector<bool> &a) {
for (unsigned i = 0; i < a.size(); i++) {
int b;
scan(b);
a[i] = b;
}
}
void scan(char a[]) { scanf("%s", a); }
void scan(string &a) { cin >> a; }
template <class T> void scan(vector<T> &);
template <class T, size_t size> void scan(array<T, size> &);
template <class T, class L> void scan(pair<T, L> &);
template <class T, size_t size> void scan(T (&)[size]);
template <class T> void scan(vector<T> &a) {
for (auto &&i : a)
scan(i);
}
template <class T> void scan(deque<T> &a) {
for (auto &&i : a)
scan(i);
}
template <class T, size_t size> void scan(array<T, size> &a) {
for (auto &&i : a)
scan(i);
}
template <class T, class L> void scan(pair<T, L> &p) {
scan(p.first);
scan(p.second);
}
template <class T, size_t size> void scan(T (&a)[size]) {
for (auto &&i : a)
scan(i);
}
template <class T> void scan(T &a) { cin >> a; }
void in() {}
template <class Head, class... Tail> void in(Head &head, Tail &...tail) {
scan(head);
in(tail...);
}
void print() { putchar(' '); }
void print(bool a) { printf("%d", a); }
void print(int a) { printf("%d", a); }
void print(unsigned a) { printf("%u", a); }
void print(long a) { printf("%ld", a); }
void print(long long a) { printf("%lld", a); }
void print(unsigned long long a) { printf("%llu", a); }
void print(char a) { printf("%c", a); }
void print(char a[]) { printf("%s", a); }
void print(const char a[]) { printf("%s", a); }
void print(float a) { printf("%.15f", a); }
void print(double a) { printf("%.15f", a); }
void print(long double a) { printf("%.15Lf", a); }
void print(const string &a) {
for (auto &&i : a)
print(i);
}
template <class T> void print(const vector<T> &);
template <class T, size_t size> void print(const array<T, size> &);
template <class T, class L> void print(const pair<T, L> &p);
template <class T, size_t size> void print(const T (&)[size]);
template <class T> void print(const vector<T> &a) {
if (a.empty())
return;
print(a[0]);
for (auto i = a.begin(); ++i != a.end();) {
putchar(' ');
print(*i);
}
}
template <class T> void print(const deque<T> &a) {
if (a.empty())
return;
print(a[0]);
for (auto i = a.begin(); ++i != a.end();) {
putchar(' ');
print(*i);
}
}
template <class T, size_t size> void print(const array<T, size> &a) {
print(a[0]);
for (auto i = a.begin(); ++i != a.end();) {
putchar(' ');
print(*i);
}
}
template <class T, class L> void print(const pair<T, L> &p) {
print(p.first);
putchar(' ');
print(p.second);
}
template <class T, size_t size> void print(const T (&a)[size]) {
print(a[0]);
for (auto i = a; ++i != end(a);) {
putchar(' ');
print(*i);
}
}
template <class T> void print(const T &a) { cout << a; }
int out() {
putchar('\n');
return 0;
}
template <class T> int out(const T &t) {
print(t);
putchar('\n');
return 0;
} // cout<<t<<endl
template <class Head, class... Tail>
int out(const Head &head, const Tail &...tail) {
print(head);
putchar(' ');
out(tail...);
return 0;
}
#ifdef DEBUG
inline ll __lg(ull __n) {
return sizeof(ull) * __CHAR_BIT__ - 1 - __builtin_clzll(__n);
}
#define debug(...) \
{ \
print(#__VA_ARGS__); \
print(":"); \
out(__VA_ARGS__); \
}
#else
#define debug(...) void(0)
#endif
/*判定出力*/
int first(bool i = true) {
return out(i ? "first" : "second");
} // iがfirstか判断,以下同様
int yes(bool i = true) { return out(i ? "yes" : "no"); }
int Yes(bool i = true) { return out(i ? "Yes" : "No"); }
int No() { return out("No"); }
int YES(bool i = true) { return out(i ? "YES" : "NO"); }
int NO() { return out("NO"); }
int Yay(bool i = true) { return out(i ? "Yay!" : ":("); }
int possible(bool i = true) { return out(i ? "possible" : "impossible"); }
int Possible(bool i = true) { return out(i ? "Possible" : "Impossible"); }
int POSSIBLE(bool i = true) { return out(i ? "POSSIBLE" : "IMPOSSIBLE"); }
void Case(ll i) { printf("Case #%lld: ", i); }
/*vector探索*/
#define bSearch(v, k) \
binary_search(all(v), k) // ソートされた配列vの中の要素にkがあるか(boolean)
#define lowB(v, k) \
lower_bound(all(v), \
k) // ソートされた配列vの中の要素のうちk以上かつ最小のイテレータ
#define DLbetB(v, k) lowB(v, k) - v.begin() // 先頭からの距離
#define DLbetE(v, k) v.end() - lowB(v, k) // 末尾からの距離
#define uppB(v, k) \
upper_bound( \
all(v), \
k) // ソートされた配列vの中の要素のうちkより大きいかつ最小のイテレータ
#define DUbetB(v, k) uppB(v, k) - v.begin() // 先頭からの距離
#define DUbetE(v, k) v.end() - uppB(v, k) // 末尾からの距離
#define Cnt(v, k) count(all(v), k) // 配列vの中で要素kが何個あるかを返す(size_t)
#define CntIf(v, l) \
count_if(all(v), \
l) // 配列vの中で条件式(lambda式)を満たす個数を返す(ex.int num =
// count_if(v.begin(), v.end(), [](int i){return i % 3 == 0;});)
#define Sort2D(myVec, i) \
sort(myVec.begin(), myVec.end(), \
[](const vector<ll> &alpha, const vector<ll> &beta) { \
return alpha[i] < beta[i]; \
}); // i列めでソート
/*最大公約数*/
template <class T> T vgcd(T m, T n) { return gcd(m, n); }
template <class T, class... Args> T vgcd(T a, Args... args) {
return vgcd(a, vgcd(args...));
}
/*階乗*/
ll facctorialMethod(ll k) {
ll sum = 1;
for (ll i = 1; i <= k; ++i) {
sum *= i;
// sum%=MOD;//あまりを出力せよ問題の時はこれもやる
}
return sum;
}
/*組み合わせnCk*/
ll comb(const ll N, const ll K) {
vector<vector<long long int>> v(N + 1, vector<long long int>(N + 1, 0));
for (int i = 0; i < v.size(); i++) {
v[i][0] = 1;
v[i][i] = 1;
}
for (int k = 1; k < v.size(); k++) {
for (int j = 1; j < k; j++) {
v[k][j] = (v[k - 1][j - 1] + v[k - 1][j]);
}
}
return v[N][K];
}
/*逆元 あまりの割り算をするときにこいつをかける(a/b→a*modinv(b))*/
// mod. m での a の逆元 a^{-1} を計算する
ll modinv(ll a, ll m) {
long long b = m, u = 1, v = 0;
while (b) {
long long t = a / b;
a -= t * b;
swap(a, b);
u -= t * v;
swap(u, v);
}
u %= m;
if (u < 0)
u += m;
return u;
}
/*ダブリング*/
/*
参考:http://satanic0258.hatenablog.com/entry/2017/02/23/222647
使える場所:1回遷移した先が明確にわかる時
目的:
・ある数XのQ乗を求める
・根付き木において、ある頂点vのQ個上の親を知る
・ある地点からQ回進んだ先を求める
*/
// int N; // 全体の要素数
// int Q;//試行回数
ll doubling(
const ll N, const ll Q,
vector<ll> a) { // cin>>N>>Q;//標準入力から要素数と試行回数を受け取る場合
ll LOG_Q = floor(log2(Q)) + 1;
// next[k][i]で、i番目の要素の「2^k個次の要素」を指す
// (なお、i番目の要素に対して「2^k個次の要素」が存在しないとき、
// next[k][i]が指し示す要素番号を-1とします)
std::vector<std::vector<ll>> next(LOG_Q + 1, std::vector<ll>(N));
// ll a[N];//各要素の次の行き先
// next[0]を計算
for (int i = 0; i < N; ++i) {
next[0][i] = a[i];
}
// nextを計算
for (ll k = 0; k < LOG_Q; ++k) {
for (int i = 0; i < N; ++i) {
if (next[k][i] == -1) {
// 2^k個次に要素が無い時、当然2^(k+1)個次にも要素はありません
next[k + 1][i] = -1;
} else {
// 「2^k個次の要素」の2^k個次の要素は、2^(k+1)個次の要素です
next[k + 1][i] = next[k][next[k][i]];
}
}
}
// ----ここまで準備----
// p番目の要素の「Q個次の要素」を求めることを考えます
ll p = 0;
for (ll k = LOG_Q - 1; k >= 0; --k) {
if (p == -1) {
// pがすでに存在しない要素を指していたら、
// それ以降で存在する要素を指すことはないためループを抜けます
break;
}
if ((Q >> k) & 1) { // ex(Q=5)5=101(2)であり,2^2+2^0回進むことを表す
// Qを二進展開した際、k番目のビットが立っていたら、
// pの位置を2^kだけ次にずらします
p = next[k][p];
}
}
return p; // ここでのpが最終的な答えになる
}
/*素数判定*/
bool IsPrime(ll num) {
if (num < 2)
return false;
else if (num == 2)
return true;
else if (num % 2 == 0)
return false; // 偶数はあらかじめ除く
double sqrtNum = sqrt(num);
for (int i = 3; i <= sqrtNum; i += 2) {
if (num % i == 0) {
// 素数ではない
return false;
}
}
// 素数である
return true;
}
/*ページのソースを表示->command+F->問題文 で問題文コピペする
*/
// ceil()//切り上げ
// floor()//切り捨て
// round()//四捨五入
// deque<ll> deq;//両端キュー使う,先頭と末尾へのアクセスが早い
// using std::map;
// map<string,ll>memo;//<キー,その要素>,キーの検索が早い,キーは昇順にソートされる
signed main() {
/*以下コード*/
LL(a, b, k);
rep(k) {
if (a)
a--;
else if (b)
b--;
}
cout << a << ' ' << b << endl;
}
| #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
using uint = unsigned;
using pcc = pair<char, char>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pdd = pair<double, double>;
using tuplis = array<ll, 3>;
template <class T> using pq = priority_queue<T, vector<T>, greater<T>>;
const ll LINF = 0x1fffffffffffffff;
const ll MINF = 0x7fffffffffff;
const ll LPLMT = 10000000; // O(n)のloop上限
const ll NLGLMT =
200000; // O(NlogN)のloop上限(これで指定されたfor文の中にO(logN)の処理を書く)
const ll N2LMT = 3000; // O(n^2)のloop上限
const ll N3LMT = 100; // O(n^3)のloop上限
const ll N4LMT = 50; // O(n^4)のloop上限
const ll TNLMT =
20; // O(2^n)のloop上限(実際この計算量になるのは全探索くらいなので,この値自体を使うことはなさそう)(オーダの参考程度に)
const int INF = 0x3fffffff;
const int MOD = 1000000007;
const int MODD = 998244353;
const ld DINF = numeric_limits<ld>::infinity();
const ld EPS = 1e-9;
const ld PI = 3.1415926535897932;
const ll dx[] = {0, 1, 0, -1, 1, -1, 1, -1};
const ll dy[] = {1, 0, -1, 0, 1, 1, -1, -1};
#define overload4(_1, _2, _3, _4, name, ...) name
#define overload3(_1, _2, _3, name, ...) name
/*繰り返し*/
#define rep1(n) for (ll i = 0; i < n; ++i) // n回repeat
#define rep2(i, n) for (ll i = 0; i < n; ++i) // n回repeat(変数指定)
#define rep3(i, a, b) for (ll i = a; i < b; ++i) // a-bまでrepeat
#define rep4(i, a, b, c) \
for (ll i = a; i < b; i += c) // a-bまで公差cでrepeat(等差数列で使えそう)
#define rep(...) \
overload4(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__) // repeatまとめ
#define rrep1(n) for (ll i = (n); i--;)
#define rrep2(i, n) for (ll i = (n); i--;)
#define rrep3(i, a, b) for (ll i = (b); i-- > (a);)
#define rrep4(i, a, b, c) for (ll i = a + (b - a - 1) / c * c; i >= a; i -= c)
#define rrep(...) \
overload4(__VA_ARGS__, rrep4, rrep3, rrep2, \
rrep1)(__VA_ARGS__) // 逆repeatまとめ
#define each1(i, a) for (auto &&i : a)
#define each2(x, y, a) for (auto &&[x, y] : a)
#define each3(x, y, z, a) for (auto &&[x, y, z] : a)
#define each(...) \
overload4(__VA_ARGS__, each3, each2, \
each1)(__VA_ARGS__) // 配列の各要素の読み出し
#define all1(i) begin(i), end(i)
#define all2(i, a) begin(i), begin(i) + a
#define all3(i, a, b) begin(i) + a, begin(i) + b
#define all(...) \
overload3(__VA_ARGS__, all3, all2, \
all1)(__VA_ARGS__) // vectorの始めと終わりの読み取り
#define rall1(i) (i).rbegin(), (i).rend()
#define rall2(i, k) (i).rbegin(), (i).rbegin() + k
#define rall3(i, a, b) (i).rbegin() + a, (i).rbegin() + b
#define rall(...) \
overload3(__VA_ARGS__, rall3, rall2, \
rall1)(__VA_ARGS__) // 逆イテレータの取得(rbegin:末尾,rend:頭)
#define sum(...) \
accumulate( \
all(__VA_ARGS__), \
0LL) // vectorの合計(int形で受け付けてしまうので,小数で扱いたい場合はdsumを使う)
#define dsum(...) \
accumulate(all(__VA_ARGS__), 0.0L) // 小数で扱う(long long doubleなど)
#define elif else if
#define unless(a) if (!(a))
#define mp make_pair
#define mt make_tuple
/*標準入力*/
#define INT(...) \
int __VA_ARGS__; \
in(__VA_ARGS__) // int型標準入力受付,以下LDまで同様
#define LL(...) \
ll __VA_ARGS__; \
in(__VA_ARGS__)
#define ULL(...) \
ull __VA_ARGS__; \
in(__VA_ARGS__)
#define STR(...) \
string __VA_ARGS__; \
in(__VA_ARGS__)
#define CHR(...) \
char __VA_ARGS__; \
in(__VA_ARGS__)
#define DBL(...) \
double __VA_ARGS__; \
in(__VA_ARGS__)
#define LD(...) \
ld __VA_ARGS__; \
in(__VA_ARGS__)
/*vector操作*/
#define Sort(a) sort(all(a)) // 昇順ソート
#define RSort(vec) sort(vec.begin(), vec.end(), greater<ll>()) // 降順ソート
#define Rev(a) reverse(all(a)) // 逆順
#define Uniq(a) \
sort(all(a)); \
a.erase(unique(all(a)), end(a))
#define vec(type, name, ...) vector<type> name(__VA_ARGS__) // type型vectorの定義
#define VEC(type, name, size) \
vector<type> name(size); \
in(name) // type型vector(size指定)標準入力受付
#define vv(type, name, h, ...) \
vector<vector<type>> name(h, vector<type>(__VA_ARGS__))
#define VV(type, name, h, w) \
vector<vector<type>> name(h, vector<type>(w)); \
in(name)
#define IV(type, name, size) \
vector<pair<int, int>> name; \
for (int i = 0; i < size; i++) { \
int a_i; \
cin >> a_i; \
name.emplace_back(a_i, i); \
} // Indexつきvector(pair型Vector,(data,index))
#define vvv(type, name, h, w, ...) \
vector<vector<vector<type>>> name( \
h, vector<vector<type>>(w, vector<type>(__VA_ARGS__)))
template <class T> auto min(const T &a) { return *min_element(all(a)); }
template <class T> auto max(const T &a) { return *max_element(all(a)); }
inline ll popcnt(ull a) { return __builtin_popcountll(a); }
ll gcd(ll a, ll b) {
while (b) {
ll c = b;
b = a % b;
a = c;
}
return a;
}
ll lcm(ll a, ll b) {
if (!a || !b)
return 0;
return a * b / gcd(a, b);
}
ll intpow(ll a, ll b) {
ll ans = 1;
while (b) {
if (b & 1)
ans *= a;
a *= a;
b /= 2;
}
return ans;
}
ll modpow(ll a, ll b, ll p) {
ll ans = 1;
while (b) {
if (b & 1)
(ans *= a) %= p;
(a *= a) %= p;
b /= 2;
}
return ans;
}
template <class T, class U> bool chmin(T &a, const U &b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
template <class T, class U> bool chmax(T &a, const U &b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
vector<ll> iota(ll n) {
vector<ll> a(n);
iota(a.begin(), a.end(), 0);
return a;
}
vector<pll> factor(ull x) {
vector<pll> ans;
for (ull i = 2; i * i <= x; i++)
if (x % i == 0) {
ans.push_back({i, 1});
while ((x /= i) % i == 0)
ans.back().second++;
}
if (x != 1)
ans.push_back({x, 1});
return ans;
}
map<ll, ll> factor_map(ull x) {
map<ll, ll> ans;
for (ull i = 2; i * i <= x; i++)
if (x % i == 0) {
ans[i] = 1;
while ((x /= i) % i == 0)
ans[i]++;
}
if (x != 1)
ans[x] = 1;
return ans;
}
vector<ll> divisor(ull x) {
vector<ll> ans;
for (ull i = 1; i * i <= x; i++)
if (x % i == 0)
ans.push_back(i);
rrep(ans.size() - (ans.back() * ans.back() == x)) ans.push_back(x / ans[i]);
return ans;
}
template <class T> unordered_map<T, ll> press(vector<T> &a) {
auto b = a;
sort(all(b));
b.erase(unique(all(b)), b.end());
unordered_map<T, ll> ans;
rep(b.size()) ans[b[i]] = i;
each(i, a) i = ans[i];
return ans;
}
template <class T> map<T, ll> press_map(vector<T> &a) {
auto b = a;
sort(all(b));
b.erase(unique(all(b)), b.end());
map<T, ll> ans;
rep(b.size()) ans[b[i]] = i;
each(i, a) i = ans[i];
return ans;
}
int scan() { return getchar(); }
void scan(int &a) { scanf("%d", &a); }
void scan(unsigned &a) { scanf("%u", &a); }
void scan(long &a) { scanf("%ld", &a); }
void scan(long long &a) { scanf("%lld", &a); }
void scan(unsigned long long &a) { scanf("%llu", &a); }
void scan(char &a) {
do {
a = getchar();
} while (a == ' ' || a == '\n');
}
void scan(float &a) { scanf("%f", &a); }
void scan(double &a) { scanf("%lf", &a); }
void scan(long double &a) { scanf("%Lf", &a); }
void scan(vector<bool> &a) {
for (unsigned i = 0; i < a.size(); i++) {
int b;
scan(b);
a[i] = b;
}
}
void scan(char a[]) { scanf("%s", a); }
void scan(string &a) { cin >> a; }
template <class T> void scan(vector<T> &);
template <class T, size_t size> void scan(array<T, size> &);
template <class T, class L> void scan(pair<T, L> &);
template <class T, size_t size> void scan(T (&)[size]);
template <class T> void scan(vector<T> &a) {
for (auto &&i : a)
scan(i);
}
template <class T> void scan(deque<T> &a) {
for (auto &&i : a)
scan(i);
}
template <class T, size_t size> void scan(array<T, size> &a) {
for (auto &&i : a)
scan(i);
}
template <class T, class L> void scan(pair<T, L> &p) {
scan(p.first);
scan(p.second);
}
template <class T, size_t size> void scan(T (&a)[size]) {
for (auto &&i : a)
scan(i);
}
template <class T> void scan(T &a) { cin >> a; }
void in() {}
template <class Head, class... Tail> void in(Head &head, Tail &...tail) {
scan(head);
in(tail...);
}
void print() { putchar(' '); }
void print(bool a) { printf("%d", a); }
void print(int a) { printf("%d", a); }
void print(unsigned a) { printf("%u", a); }
void print(long a) { printf("%ld", a); }
void print(long long a) { printf("%lld", a); }
void print(unsigned long long a) { printf("%llu", a); }
void print(char a) { printf("%c", a); }
void print(char a[]) { printf("%s", a); }
void print(const char a[]) { printf("%s", a); }
void print(float a) { printf("%.15f", a); }
void print(double a) { printf("%.15f", a); }
void print(long double a) { printf("%.15Lf", a); }
void print(const string &a) {
for (auto &&i : a)
print(i);
}
template <class T> void print(const vector<T> &);
template <class T, size_t size> void print(const array<T, size> &);
template <class T, class L> void print(const pair<T, L> &p);
template <class T, size_t size> void print(const T (&)[size]);
template <class T> void print(const vector<T> &a) {
if (a.empty())
return;
print(a[0]);
for (auto i = a.begin(); ++i != a.end();) {
putchar(' ');
print(*i);
}
}
template <class T> void print(const deque<T> &a) {
if (a.empty())
return;
print(a[0]);
for (auto i = a.begin(); ++i != a.end();) {
putchar(' ');
print(*i);
}
}
template <class T, size_t size> void print(const array<T, size> &a) {
print(a[0]);
for (auto i = a.begin(); ++i != a.end();) {
putchar(' ');
print(*i);
}
}
template <class T, class L> void print(const pair<T, L> &p) {
print(p.first);
putchar(' ');
print(p.second);
}
template <class T, size_t size> void print(const T (&a)[size]) {
print(a[0]);
for (auto i = a; ++i != end(a);) {
putchar(' ');
print(*i);
}
}
template <class T> void print(const T &a) { cout << a; }
int out() {
putchar('\n');
return 0;
}
template <class T> int out(const T &t) {
print(t);
putchar('\n');
return 0;
} // cout<<t<<endl
template <class Head, class... Tail>
int out(const Head &head, const Tail &...tail) {
print(head);
putchar(' ');
out(tail...);
return 0;
}
#ifdef DEBUG
inline ll __lg(ull __n) {
return sizeof(ull) * __CHAR_BIT__ - 1 - __builtin_clzll(__n);
}
#define debug(...) \
{ \
print(#__VA_ARGS__); \
print(":"); \
out(__VA_ARGS__); \
}
#else
#define debug(...) void(0)
#endif
/*判定出力*/
int first(bool i = true) {
return out(i ? "first" : "second");
} // iがfirstか判断,以下同様
int yes(bool i = true) { return out(i ? "yes" : "no"); }
int Yes(bool i = true) { return out(i ? "Yes" : "No"); }
int No() { return out("No"); }
int YES(bool i = true) { return out(i ? "YES" : "NO"); }
int NO() { return out("NO"); }
int Yay(bool i = true) { return out(i ? "Yay!" : ":("); }
int possible(bool i = true) { return out(i ? "possible" : "impossible"); }
int Possible(bool i = true) { return out(i ? "Possible" : "Impossible"); }
int POSSIBLE(bool i = true) { return out(i ? "POSSIBLE" : "IMPOSSIBLE"); }
void Case(ll i) { printf("Case #%lld: ", i); }
/*vector探索*/
#define bSearch(v, k) \
binary_search(all(v), k) // ソートされた配列vの中の要素にkがあるか(boolean)
#define lowB(v, k) \
lower_bound(all(v), \
k) // ソートされた配列vの中の要素のうちk以上かつ最小のイテレータ
#define DLbetB(v, k) lowB(v, k) - v.begin() // 先頭からの距離
#define DLbetE(v, k) v.end() - lowB(v, k) // 末尾からの距離
#define uppB(v, k) \
upper_bound( \
all(v), \
k) // ソートされた配列vの中の要素のうちkより大きいかつ最小のイテレータ
#define DUbetB(v, k) uppB(v, k) - v.begin() // 先頭からの距離
#define DUbetE(v, k) v.end() - uppB(v, k) // 末尾からの距離
#define Cnt(v, k) count(all(v), k) // 配列vの中で要素kが何個あるかを返す(size_t)
#define CntIf(v, l) \
count_if(all(v), \
l) // 配列vの中で条件式(lambda式)を満たす個数を返す(ex.int num =
// count_if(v.begin(), v.end(), [](int i){return i % 3 == 0;});)
#define Sort2D(myVec, i) \
sort(myVec.begin(), myVec.end(), \
[](const vector<ll> &alpha, const vector<ll> &beta) { \
return alpha[i] < beta[i]; \
}); // i列めでソート
/*最大公約数*/
template <class T> T vgcd(T m, T n) { return gcd(m, n); }
template <class T, class... Args> T vgcd(T a, Args... args) {
return vgcd(a, vgcd(args...));
}
/*階乗*/
ll facctorialMethod(ll k) {
ll sum = 1;
for (ll i = 1; i <= k; ++i) {
sum *= i;
// sum%=MOD;//あまりを出力せよ問題の時はこれもやる
}
return sum;
}
/*組み合わせnCk*/
ll comb(const ll N, const ll K) {
vector<vector<long long int>> v(N + 1, vector<long long int>(N + 1, 0));
for (int i = 0; i < v.size(); i++) {
v[i][0] = 1;
v[i][i] = 1;
}
for (int k = 1; k < v.size(); k++) {
for (int j = 1; j < k; j++) {
v[k][j] = (v[k - 1][j - 1] + v[k - 1][j]);
}
}
return v[N][K];
}
/*逆元 あまりの割り算をするときにこいつをかける(a/b→a*modinv(b))*/
// mod. m での a の逆元 a^{-1} を計算する
ll modinv(ll a, ll m) {
long long b = m, u = 1, v = 0;
while (b) {
long long t = a / b;
a -= t * b;
swap(a, b);
u -= t * v;
swap(u, v);
}
u %= m;
if (u < 0)
u += m;
return u;
}
/*ダブリング*/
/*
参考:http://satanic0258.hatenablog.com/entry/2017/02/23/222647
使える場所:1回遷移した先が明確にわかる時
目的:
・ある数XのQ乗を求める
・根付き木において、ある頂点vのQ個上の親を知る
・ある地点からQ回進んだ先を求める
*/
// int N; // 全体の要素数
// int Q;//試行回数
ll doubling(
const ll N, const ll Q,
vector<ll> a) { // cin>>N>>Q;//標準入力から要素数と試行回数を受け取る場合
ll LOG_Q = floor(log2(Q)) + 1;
// next[k][i]で、i番目の要素の「2^k個次の要素」を指す
// (なお、i番目の要素に対して「2^k個次の要素」が存在しないとき、
// next[k][i]が指し示す要素番号を-1とします)
std::vector<std::vector<ll>> next(LOG_Q + 1, std::vector<ll>(N));
// ll a[N];//各要素の次の行き先
// next[0]を計算
for (int i = 0; i < N; ++i) {
next[0][i] = a[i];
}
// nextを計算
for (ll k = 0; k < LOG_Q; ++k) {
for (int i = 0; i < N; ++i) {
if (next[k][i] == -1) {
// 2^k個次に要素が無い時、当然2^(k+1)個次にも要素はありません
next[k + 1][i] = -1;
} else {
// 「2^k個次の要素」の2^k個次の要素は、2^(k+1)個次の要素です
next[k + 1][i] = next[k][next[k][i]];
}
}
}
// ----ここまで準備----
// p番目の要素の「Q個次の要素」を求めることを考えます
ll p = 0;
for (ll k = LOG_Q - 1; k >= 0; --k) {
if (p == -1) {
// pがすでに存在しない要素を指していたら、
// それ以降で存在する要素を指すことはないためループを抜けます
break;
}
if ((Q >> k) & 1) { // ex(Q=5)5=101(2)であり,2^2+2^0回進むことを表す
// Qを二進展開した際、k番目のビットが立っていたら、
// pの位置を2^kだけ次にずらします
p = next[k][p];
}
}
return p; // ここでのpが最終的な答えになる
}
/*素数判定*/
bool IsPrime(ll num) {
if (num < 2)
return false;
else if (num == 2)
return true;
else if (num % 2 == 0)
return false; // 偶数はあらかじめ除く
double sqrtNum = sqrt(num);
for (int i = 3; i <= sqrtNum; i += 2) {
if (num % i == 0) {
// 素数ではない
return false;
}
}
// 素数である
return true;
}
/*ページのソースを表示->command+F->問題文 で問題文コピペする
*/
// ceil()//切り上げ
// floor()//切り捨て
// round()//四捨五入
// deque<ll> deq;//両端キュー使う,先頭と末尾へのアクセスが早い
// using std::map;
// map<string,ll>memo;//<キー,その要素>,キーの検索が早い,キーは昇順にソートされる
signed main() {
/*以下コード*/
LL(a, b, k);
if (a > k)
a -= k;
else if (a + b > k) {
b -= k - a;
a = 0;
} else {
a = 0;
b = 0;
}
cout << a << ' ' << b << endl;
}
| replace | 545 | 550 | 545 | 553 | TLE | |
p02818 | C++ | 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;
}
| #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;
}
| replace | 11 | 16 | 11 | 19 | TLE | |
p02818 | C++ | 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;
} | #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;
} | replace | 6 | 11 | 6 | 15 | TLE | |
p02818 | C++ | 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;
} | #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;
} | replace | 21 | 28 | 21 | 24 | TLE | |
p02818 | C++ | 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;
} | #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;
} | replace | 6 | 14 | 6 | 12 | TLE |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.