buggy_code
stringlengths
11
625k
fixed_code
stringlengths
17
625k
bug_type
stringlengths
2
4.45k
language
int64
0
8
token_count
int64
5
200k
A,B,C,K = `dd`.split.map &:to_i p K <= A ? K : K <= A + B ? A : A - [C - (K - A - B), 0].min
A,B,C,K = `dd`.split.map &:to_i p K <= A ? K : K <= A + B ? A : A - [C, K - A - B].min
[["-", 75, 738, 12, 652, 486, 516, 0, 738, 17, 33], ["-", 12, 652, 486, 516, 0, 738, 12, 739, 0, 24], ["+", 75, 754, 75, 738, 12, 652, 486, 516, 0, 21], ["-", 12, 652, 486, 516, 0, 738, 12, 739, 0, 25], ["-", 75, 754, 75, 738, 12, 652, 486, 516, 0, 21], ["-", 75, 754, 75, 738, 12, 652, 486, 516, 0, 612]]
4
49
import sys a, b, c, k = map(int, input().split()) if a >= k: print(a) sys.exit() if a + b >= k: print(a) sys.exit() else: sum = a - (k - a - b) print(sum)
import sys a, b, c, k = map(int, input().split()) if a >= k: print(k) sys.exit() if a + b >= k: print(a) sys.exit() else: sum = a - (k - a - b) print(sum)
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
69
A,B,C,K = map(int,input().split()) xa = min(A,K) K1 = K -xa if K1 == 0: print(K) else: xb = min(B,K1) K2 = K1 -xb if K2 == 0: print(K) else: print(A-K2)
A,B,C,K = map(int,input().split()) xa = min(A,K) K1 = K -xa if K1 == 0: print(K) else: xb = min(B,K1) K2 = K1 -xb if K2 == 0: print(A) else: print(A-K2)
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
74
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; typedef long long ll; typedef struct data { long n; long c; } d; int main() { long k; d s[3]; int num = 1; rep(i, 3) { cin >> s[i].n; s[i].c = num--; } cin >> k; long sum = 0; rep(i, k) { ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; typedef long long ll; typedef struct data { long n; long c; } d; int main() { long k; d s[3]; int num = 1; rep(i, 3) { cin >> s[i].n; s[i].c = num--; } cin >> k; long sum = 0; rep(i, 3) { ...
[["-", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 25, 0, 35]]
1
183
A,B,C,K = list(map(int,input().split())) """ for n in range(1): n = list(map(int,input().split())) L.append(n) """ if K <= A: print(A) elif A < K <= A + B: print(A) elif A + B < K <= A + B + C: print(A - (K - A - B))
A,B,C,K = list(map(int,input().split())) """ for n in range(1): n = list(map(int,input().split())) L.append(n) """ if K <= A: print(K) elif A < K <= A + B: print(A) elif A + B < K <= A + B + C: print(A - (K - A - B))
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
73
a, b, c, k = map(int, input().split()) ans = 0 ans += min(a, k) k -= min(a,k) ans += min(b, k) * 0 k -= min(b,k) ans += min(c,k) + -1 k -= min(c,k) print(ans)
a, b, c, k = map(int, input().split()) ans = 0 ans += min(a, k) k -= min(a,k) ans += min(b, k) * 0 k -= min(b,k) ans += min(c,k) * -1 k -= min(c,k) print(ans)
[["-", 0, 656, 0, 1, 0, 677, 12, 657, 17, 72], ["+", 0, 656, 0, 1, 0, 677, 12, 657, 17, 48]]
5
80
temp = input() temp = temp.split() A = int(temp[0]) B = int(temp[1]) C = int(temp[2]) K = int(temp[3]) if K <= A or A<K<=A+B: print(A) else: print(2*A-K+B)
temp = input() temp = temp.split() A = int(temp[0]) B = int(temp[1]) C = int(temp[2]) K = int(temp[3]) if K <= A: print(K) elif A < K <= A+B: print(A) else: print(2*A-K+B)
[["-", 36, 36, 0, 656, 0, 57, 15, 679, 17, 354], ["+", 36, 36, 36, 36, 0, 656, 0, 57, 0, 102], ["+", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25], ["+", 36, 36, 0, 656, 0, 57, 75, 665, 0, 683]]
5
77
a, b, c, k = map(int, input().split()) if k <= a: print(k) elif a < k <= a+b: print(a) elif a+b < k <= a+b+c: print(a+b-c)
a, b, c, k = map(int, input().split()) if k <= a: print(k) elif a < k <= a+b: print(a) elif a+b < k <= a+b+c: print(2*a + b - k)
[["+", 3, 4, 0, 657, 31, 657, 31, 657, 31, 612], ["+", 3, 4, 0, 657, 31, 657, 31, 657, 17, 48], ["-", 0, 1, 0, 652, 3, 4, 0, 657, 12, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 12, 22]]
5
63
#include <algorithm> #include <functional> #include <iostream> #include <map> #include <math.h> #include <queue> #include <stack> #include <string> #include <vector> #define rep(i, n) for (ll i = 0; i < (n); i++) typedef long long ll; using namespace std; int main() { ll a, b, c; ll k; cin >> a >> b >> c >> k; ...
#include <algorithm> #include <functional> #include <iostream> #include <map> #include <math.h> #include <queue> #include <stack> #include <string> #include <vector> #define rep(i, n) for (ll i = 0; i < (n); i++) typedef long long ll; using namespace std; int main() { int a, b, c; ll k; cin >> a >> b >> c >> k;...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
115
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) #define ll long long int int main() { ll a, b, c, k; cin >> a >> b >> c >> k; if (a + b >= k) { cout << a << endl; } else { cout << a - (k - a - b) << endl; } return 0; }
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) #define ll long long int int main() { ll a, b, c, k; cin >> a >> b >> c >> k; if (a + b >= k) { cout << min(a, k) << endl; } else { cout << a - (k - a - b) << endl; } return 0; }
[["+", 0, 1, 0, 16, 31, 16, 12, 2, 63, 22], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 24], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 21], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 22], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 25]]
1
78
#include <bits/stdc++.h> #define ios ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0) #define debug freopen("in.txt", "r", stdin), freopen("out.txt", "w", stdout); #define fs first #define sc second #define pb push_back using namespace std; typedef long long ll; typedef pair<int, int> pii; const int maxn = 1e6 + 1...
#include <bits/stdc++.h> #define ios ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0) #define debug freopen("in.txt", "r", stdin), freopen("out.txt", "w", stdout); #define fs first #define sc second #define pb push_back using namespace std; typedef long long ll; typedef pair<int, int> pii; const int maxn = 1e6 + 1...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 57, 75, 76, 0, 95]]
1
128
// AUTHOR:: MOHAMMAD FAISAL #include <bits/stdc++.h> using namespace std; int main() { long long a, b, c, d; cin >> a >> b >> c >> d; long long sum = 0; if (d > a) sum += a, d -= a; else sum += d, d = 0; if (d > b) d -= b; else d = 0; if (d < c) sum -= d; cout << sum; return 0...
// AUTHOR:: MOHAMMAD FAISAL #include <bits/stdc++.h> using namespace std; int main() { long long a, b, c, d; cin >> a >> b >> c >> d; long long sum = 0; if (d > a) sum += a, d -= a; else sum += d, d = 0; if (d > b) d -= b; else d = 0; if (d <= c) sum -= d; cout << sum; return ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
94
#include <bits/stdc++.h> using namespace std; #define int long long #define double long double #define fo(a, b) for (int a = 0; a < b; a++) #define Sort(a) sort(a.begin(), a.end()) #define rev(a) reverse(a.begin(), a.end()) #define fi first #define se second #define bgn begin() #define sz size() #define en end() #defin...
#include <bits/stdc++.h> using namespace std; #define int long long #define double long double #define fo(a, b) for (int a = 0; a < b; a++) #define Sort(a) sort(a.begin(), a.end()) #define rev(a) reverse(a.begin(), a.end()) #define fi first #define se second #define bgn begin() #define sz size() #define en end() #defin...
[["+", 64, 1, 0, 16, 31, 16, 12, 2, 63, 22], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 24], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 21], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 22], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 25]]
1
2,508
a,b,c,k=gets.chomp.split(" ").map(&:to_i) puts a+b>=k ? [a,k].max : a-(k-a-b)
a,b,c,k=gets.chomp.split(" ").map(&:to_i) puts a+b>=k ? [a,k].min : a-(k-a-b)
[["-", 0, 652, 3, 4, 0, 754, 64, 652, 735, 22], ["+", 0, 652, 3, 4, 0, 754, 64, 652, 735, 22]]
4
48
a,b,c,k=map(int,input().split()) if a>=k: print(a) else: if a+b>=k: print(a) else: print(a-(k-a-b))
a,b,c,k=map(int,input().split()) if a>=k: print(k) else: if a+b>=k: print(a) else: print(a-(k-a-b))
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
56
A,B,C,K = map(int,input().split()) count = 0 if K <= A: count = A elif K - A <= B: count = A else: count = A - (K-A-B) print(count)
A,B,C,K = map(int,input().split()) count = 0 if K <= A: count = K elif K - A <= B: count = A else: count = A - (K-A-B) print(count)
[["-", 0, 57, 64, 196, 0, 1, 0, 662, 12, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 12, 22]]
5
58
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, k; scanf("%d%d%d%d", &a, &b, &c, &k); int x = min(a, k); int ans = x; k -= x; x = min(b, k); k -= b; x = min(c, k); ans -= x; printf("%d", ans); }
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, k; scanf("%d%d%d%d", &a, &b, &c, &k); int x = min(a, k); int ans = x; k -= x; x = min(b, k); k -= x; x = min(c, k); ans -= x; printf("%d", ans); }
[["-", 0, 14, 8, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 22]]
1
94
#include <bits/stdc++.h> #define ll long long int using namespace std; int main() { ll one, zero, nege; ll k; ll ans = 0; cin >> one >> zero >> nege >> k; if (k >= one) { k -= one; ans += one; } else { ans += k; k = 0; } if (k >= zero && k != 0) { k -= zero; } else k = 0; ans...
#include <bits/stdc++.h> #define ll long long int using namespace std; int main() { ll one, zero, nege; ll k; ll ans = 0; cin >> one >> zero >> nege >> k; if (k >= one) { k -= one; ans += one; } else { ans += k; k = 0; } if (k >= zero && k != 0) { k -= zero; } else k = 0; ans...
[["-", 0, 1, 0, 11, 12, 23, 0, 16, 17, 48], ["-", 0, 11, 12, 23, 0, 16, 12, 23, 0, 24], ["-", 0, 11, 12, 23, 0, 16, 12, 23, 0, 13], ["-", 8, 9, 0, 1, 0, 11, 12, 23, 0, 25]]
1
104
def resolve(): a, b,c,k = map(int, input().split()) ans = 0 used = min(k,a) ans += used * 1 k -= used used = min(k, b) k -= used ans += k*(-1) print(ans) if __name__ == "__main__": unittest.main()
def resolve(): a, b,c,k = map(int, input().split()) ans = 0 used = min(k,a) ans += used * 1 k -= used used = min(k, b) k -= used ans += k*(-1) print(ans) if __name__ == "__main__": resolve()
[["-", 64, 196, 0, 1, 0, 652, 63, 319, 500, 22], ["-", 64, 196, 0, 1, 0, 652, 63, 319, 0, 131], ["-", 64, 196, 0, 1, 0, 652, 63, 319, 319, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22]]
5
79
#include <algorithm> #include <iostream> using namespace std; int main(void) { int A, B, C, K; cin >> A >> B >> C >> K; cout << max(A, K) - max(K - A - B, 0) << endl; return 0; }
#include <algorithm> #include <iostream> using namespace std; int main(void) { int A, B, C, K; cin >> A >> B >> C >> K; cout << min(A, K) - max(K - A - B, 0) << endl; return 0; }
[["-", 0, 16, 31, 16, 12, 16, 31, 2, 63, 22], ["+", 0, 16, 31, 16, 12, 16, 31, 2, 63, 22]]
1
59
def main(): a, b, c, k = map(int, input().split()) if a + b >= k: print(max(a, k)) else: x = k - a - b print(a - x) main()
def main(): a, b, c, k = map(int, input().split()) if a + b >= k: print(min(a, k)) else: x = k - a - b print(a - x) main()
[["-", 0, 1, 0, 652, 3, 4, 0, 652, 63, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 652, 63, 22]]
5
59
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; if (a >= k) { cout << k << endl; } else if ((a + b) >= k) { cout << a << endl; } else { cout << a + b - c << endl; } }
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; if (a >= k) { cout << k << endl; } else if ((a + b) >= k) { cout << a << endl; } else { cout << (2 * a) + b - k << endl; } }
[["+", 31, 16, 12, 16, 31, 16, 31, 23, 0, 24], ["+", 12, 16, 31, 16, 31, 23, 0, 16, 31, 13], ["+", 12, 16, 31, 16, 31, 23, 0, 16, 17, 48], ["+", 31, 16, 12, 16, 31, 16, 31, 23, 0, 25], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 12, 22], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 22]]
1
77
#include <algorithm> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; typedef long long unsigned int ...
#include <algorithm> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; typedef long long unsigned int ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["-", 75, 76, 0, 9, 0, 1, 0, 11, 31, 22], ["+", 75, 76, 0, 9, 0, 1, 0, 11, 31, 22], ["-", 0, 9, 0, 1, 0, 11, 12, 16, 17, 72], ["-", 0, 9, 0, 1, 0, 11, 12, 16, 12, 22]]
1
196
def main(): inp = input() data = inp.split(" ") data = [int(i) for i in data] a = data[0] b = data[1] c = data[2] k = data[3] if a > k: print(a) return r = k - a score = a if b > r: print(score) return r = r - b if c > r: s...
def main(): inp = input() data = inp.split(" ") data = [int(i) for i in data] a = data[0] b = data[1] c = data[2] k = data[3] if a > k: print(k) return r = k - a score = a if b > r: print(score) return r = r - b if c > r: s...
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
116
a, b, c, k = [int(x) for x in input().split()] if k <= a: print(str(k)) elif k <= a + b: print(str(a)) else: print(str(a - k))
a, b, c, k = [int(x) for x in input().split()] if k <= a: print(str(k)) elif k <= a + b: print(str(a)) else: print(str(a - (k - a - b)))
[["+", 0, 652, 3, 4, 0, 657, 12, 23, 0, 24], ["+", 0, 657, 12, 23, 0, 657, 31, 657, 17, 33], ["+", 0, 657, 12, 23, 0, 657, 31, 657, 12, 22], ["+", 3, 4, 0, 657, 12, 23, 0, 657, 17, 33], ["+", 3, 4, 0, 657, 12, 23, 0, 657, 12, 22], ["+", 0, 652, 3, 4, 0, 657, 12, 23, 0, 25]]
5
61
#include <bits/stdc++.h> using namespace std; using i64 = int_fast64_t; #define rep(i, N) for (int i = 0; i < N; i++) int main() { i64 A, B, C, K; cin >> A >> B >> C >> K; i64 ans = min(A, K); K -= min(A, K); K -= (B, K); ans -= min(C, K); cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; using i64 = int_fast64_t; #define rep(i, N) for (int i = 0; i < N; i++) int main() { i64 A, B, C, K; cin >> A >> B >> C >> K; i64 ans = min(A, K); K -= min(A, K); K -= min(B, K); ans -= min(C, K); cout << ans << endl; }
[["+", 8, 9, 0, 1, 0, 11, 12, 2, 63, 22]]
1
86
# input A, B, C, K = map(int, input().split()) # check result_score = 0 for score, i in [(1, A), (0, B), (-1, C)]: if K <= 0: continue if K >= i: result_score =- score * i K -= i else: result_score =- score * K K = 0 prin...
# input A, B, C, K = map(int, input().split()) # check result_score = 0 for score, i in [(1, A), (0, B), (-1, C)]: if K <= 0: continue if K >= i: result_score += score * i K -= i else: result_score += score * K K = 0 print(result_...
[["-", 0, 57, 64, 196, 0, 1, 0, 662, 0, 32], ["-", 0, 1, 0, 662, 12, 657, 31, 664, 17, 33], ["+", 0, 57, 64, 196, 0, 1, 0, 677, 17, 107], ["-", 75, 76, 8, 196, 0, 1, 0, 662, 0, 32], ["+", 75, 76, 8, 196, 0, 1, 0, 677, 17, 107]]
5
86
a, b, c, k = map(int, input().split()) p = 0 if a >= k : p = a elif a + b >= k: p = a else: p = a - (k - a - b) print(p)
a, b, c, k = map(int, input().split()) p = 0 if a >= k: p = k elif a + b >= k: p = a else: p = a - (k - a - b) print(p)
[["-", 0, 57, 64, 196, 0, 1, 0, 662, 12, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 12, 22]]
5
58
a,b,c,k=(int(x) for x in input().split()) if a+b > k: print(a) else: print(a-k+a+b)
a,b,c,k=(int(x) for x in input().split()) if a+b >= k: print(min(k,a)) else: print(a-k+a+b)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20], ["+", 0, 1, 0, 652, 3, 4, 0, 652, 63, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 21], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
47
/** * code generated by JHelper * More info: https://github.com/AlexeyDmitriev/JHelper * @author */ #include <fstream> #include <iostream> #include <iostream> using namespace std; class BEasyLinearProgramming { public: void solve(std::istream &in, std::ostream &out) { int a, b, c, k; in >> a >> b >> c ...
/** * code generated by JHelper * More info: https://github.com/AlexeyDmitriev/JHelper * @author */ #include <fstream> #include <iostream> #include <iostream> using namespace std; class BEasyLinearProgramming { public: void solve(std::istream &in, std::ostream &out) { int a, b, c, k; in >> a >> b >> c ...
[["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 72], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 22]]
1
140
a,b,c,k=map(int,input().split()) if a>=k: ans-k elif a+b>=k: ans=a else: ans=a-(k-(a+b)) print(ans)
a,b,c,k=map(int,input().split()) if a>=k: ans=k elif a+b>=k: ans=a else: ans=a-(k-(a+b)) print(ans)
[["-", 0, 57, 64, 196, 0, 1, 0, 657, 17, 33], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 0, 32]]
5
57
a,b,c,k = map(int, input().split()) if a>=k: print(k) elif a+b>=k: print(a) else: l = k-a-b print(a - (c*l))
a,b,c,k = map(int, input().split()) if a>=k: print(k) elif a+b>=k: print(a) else: l = k-a-b print(a - l)
[["-", 0, 652, 3, 4, 0, 657, 12, 23, 0, 24], ["-", 3, 4, 0, 657, 12, 23, 0, 657, 31, 22], ["-", 3, 4, 0, 657, 12, 23, 0, 657, 17, 48], ["-", 0, 652, 3, 4, 0, 657, 12, 23, 0, 25]]
5
59
import sys A, B, C, K = map(int, sys.stdin.readline().split()) res = 0 res += min(A, K) K -= A if K > 0: K -= B if K > 0: res -= min(B, K) print(res)
import sys A, B, C, K = map(int, sys.stdin.readline().split()) res = 0 res += min(A, K) K -= A if K > 0: K -= B if K > 0: res -= min(C, K) print(res)
[["-", 0, 1, 0, 677, 12, 652, 3, 4, 0, 22], ["+", 0, 1, 0, 677, 12, 652, 3, 4, 0, 22]]
5
65
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, n) for (int i = 0; i < (int)(n); i++) template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, n) for (int i = 0; i < (int)(n); i++) template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; ...
[["-", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22], ["+", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22]]
1
205
package main import ( "bufio" "math" "os" "strconv" "strings" ) func main() { scanner := bufio.NewScanner(os.Stdin) scanner.Scan() params := strings.Split(scanner.Text(), " ") paramA, _ := strconv.ParseInt(params[0], 10, 64) paramB, _ := strconv.ParseInt(params[1], 10, 64) paramC, _ := strconv.ParseInt(par...
package main import ( "bufio" "fmt" "math" "os" "strconv" "strings" ) func main() { scanner := bufio.NewScanner(os.Stdin) scanner.Scan() params := strings.Split(scanner.Text(), " ") paramA, _ := strconv.ParseInt(params[0], 10, 64) paramB, _ := strconv.ParseInt(params[1], 10, 64) paramC, _ := strconv.Parse...
[["+", 0, 454, 0, 455, 0, 458, 136, 429, 0, 62], ["+", 36, 36, 0, 434, 0, 454, 0, 455, 0, 165], ["-", 0, 435, 8, 196, 0, 1, 0, 2, 63, 22], ["+", 8, 196, 0, 1, 0, 2, 63, 438, 439, 22], ["+", 8, 196, 0, 1, 0, 2, 63, 438, 0, 131], ["+", 8, 196, 0, 1, 0, 2, 63, 438, 119, 120], ["-", 0, 1, 0, 2, 3, 4, 0, 2, 63, 22], ["+", 0...
7
196
#include <stdio.h> int main() { long long int a, b, c, k; scanf("%lld %lld %lld %lld", &a, &b, &c, &k); long long int sum = 0; if (k <= a) { sum += a; } else { sum += a; k = k - (a + b); if (k > 0) { sum -= k; } } printf("%lld", sum); return 0; }
#include <stdio.h> int main() { long long int a, b, c, k; scanf("%lld %lld %lld %lld", &a, &b, &c, &k); long long int sum = 0; if (k <= a) { sum += k; } else { sum += a; k = k - a - b; if (k > 0) { sum -= k; } } printf("%lld", sum); return 0; }
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["-", 0, 1, 0, 11, 12, 16, 12, 23, 0, 24], ["-", 0, 11, 12, 16, 12, 23, 0, 16, 17, 72], ["+", 0, 9, 0, 1, 0, 11, 12, 16, 17, 33], ["-", 0, 1, 0, 11, 12, 16, 12, 23, 0, 25]]
0
98
#include <bits/stdc++.h> using namespace std; int main() { long long A, B, C, K, max; cin >> A >> B >> C >> K; ((A + B) > K) ? (max = A) : (max = (A * 2 + B - K)); cout << max << endl; }
#include <bits/stdc++.h> using namespace std; int main() { long long A, B, C, K, max; cin >> A >> B >> C >> K; ((A + B) > K) ? (max = min(A, K)) : (max = (A * 2LL + B - K)); cout << max << endl; }
[["+", 0, 1, 0, 41, 64, 23, 0, 2, 63, 22], ["+", 0, 41, 64, 23, 0, 2, 3, 4, 0, 24], ["+", 0, 41, 64, 23, 0, 2, 3, 4, 0, 21], ["+", 0, 41, 64, 23, 0, 2, 3, 4, 0, 22], ["+", 8, 9, 0, 1, 0, 41, 64, 23, 0, 25], ["-", 3, 4, 0, 16, 31, 16, 31, 16, 12, 13], ["+", 3, 4, 0, 16, 31, 16, 31, 16, 12, 13]]
1
70
a,b,c,k=map(int,input().split()) if k>a: ans=k elif k>a+b: ans=a else: d=k-a-b ans=a-d print(ans)
a,b,c,k=map(int,input().split()) if k<a: ans=k elif k<a+b: ans=a else: d=k-a-b ans=a-d print(ans)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 18], ["-", 0, 656, 0, 57, 75, 665, 15, 666, 667, 47], ["+", 0, 656, 0, 57, 75, 665, 15, 666, 667, 18]]
5
56
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, c, k; while (cin >> a >> b >> c >> k) { cout << (a >= k || a + b >= k ? a : a - (k - (a + b))) << endl; } return 0; }
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, c, k; while (cin >> a >> b >> c >> k) { cout << (a >= k || a + b >= k ? min(a, k) : a - (k - (a + b))) << endl; } return 0; }
[["+", 31, 16, 12, 23, 0, 41, 64, 2, 63, 22], ["+", 12, 23, 0, 41, 64, 2, 3, 4, 0, 24], ["+", 12, 23, 0, 41, 64, 2, 3, 4, 0, 21], ["+", 12, 23, 0, 41, 64, 2, 3, 4, 0, 22], ["+", 12, 23, 0, 41, 64, 2, 3, 4, 0, 25]]
1
69
#include <bits/stdc++.h> using namespace std; int main() { long long A, B, C, K; cin >> A >> B >> C >> K; long long ans = 0; if (K <= A) ans += A; else if (K <= A + B) ans += A; else ans = A - (K - A - B); cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; int main() { long long A, B, C, K; cin >> A >> B >> C >> K; long long ans = 0; if (K <= A) ans += K; else if (K <= A + B) ans += A; else ans = A - (K - A - B); cout << ans << endl; }
[["-", 8, 9, 0, 57, 64, 1, 0, 11, 12, 22], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 12, 22]]
1
80
#include <bits/stdc++.h> using namespace std; #define ll long long int main() { ll A, B, C, K; cin >> A >> B >> C >> K; if (A >= K) cout << K << "\n"; else if (B >= K - A) cout << A << "\n"; cout << A - (K - (A + B)) << "\n"; return 0; }
#include <bits/stdc++.h> using namespace std; #define ll long long int main() { ll A, B, C, K; cin >> A >> B >> C >> K; if (A >= K) cout << K << "\n"; else if (B >= K - A) cout << A << "\n"; else cout << A - (K - (A + B)) << "\n"; return 0; }
[["+", 0, 57, 75, 76, 0, 57, 75, 76, 0, 95]]
1
86
#include <iostream> #include <stdio.h> #include <string> typedef long long ll; #define debug(x) cerr << #x << ": " << x << "\n"; #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; int main() { ll A, B, C, K; cin >> A >> B >> C >> K; if (A >= K) { cout << A << endl; return 0; } if...
#include <iostream> #include <stdio.h> #include <string> typedef long long ll; #define debug(x) cerr << #x << ": " << x << "\n"; #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; int main() { ll A, B, C, K; cin >> A >> B >> C >> K; if (A >= K) { cout << K << endl; return 0; } if...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
106
#include <bits/stdc++.h> using namespace std; typedef long long llint; typedef long double ld; #define inf 1e18 #define mod 1000000007 priority_queue<llint, vector<llint>, greater<llint>> que; priority_queue<llint> q; template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; } retu...
#include <bits/stdc++.h> using namespace std; typedef long long llint; typedef long double ld; #define inf 1e18 #define mod 1000000007 priority_queue<llint, vector<llint>, greater<llint>> que; priority_queue<llint> q; template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; } retu...
[["-", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22], ["+", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22]]
1
160
a = list(map(int, input().split())) sum = 0 if a[0] >= a[3]: sum += -1 * a[3] else: sum += -1 * a[0] a[3] -= a[0] a[3] -= a[1] if a[3] > 0: if a[2] > a[3]: sum += -1 * a[3] else: sum += -1 * a[2] print(sum)
a = list(map(int, input().split())) sum = 0 if a[0] >= a[3]: sum += 1 * a[3] else: sum += 1 * a[0] a[3] -= a[0] a[3] -= a[1] if a[3] > 0: if a[2] > a[3]: sum += -1 * a[3] else: sum += -1 * a[2] print(sum)
[["-", 0, 1, 0, 677, 12, 657, 31, 664, 17, 33]]
5
112
/*---> 11 May 2020 <--- > 01:37:16 <---*/ // #pragma GCC optimize("Ofast") // #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") // #pragma GCC optimize("unroll-loops") // #pragma comment(linker, "/stack:200000000") #pragma GCC optimize("O3") //#pragma GCC target ("sse4") #include <bits/stdc+...
/*---> 11 May 2020 <--- > 01:37:16 <---*/ // #pragma GCC optimize("Ofast") // #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") // #pragma GCC optimize("unroll-loops") // #pragma comment(linker, "/stack:200000000") #pragma GCC optimize("O3") //#pragma GCC target ("sse4") #include <bits/stdc+...
[["+", 0, 14, 49, 65, 0, 53, 0, 42, 0, 40], ["+", 0, 14, 49, 65, 0, 53, 0, 42, 0, 22], ["+", 0, 14, 49, 65, 0, 53, 0, 42, 0, 32], ["+", 0, 14, 49, 65, 0, 53, 0, 42, 0, 35], ["-", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
483
a,b,c,k=map(int,input().split()) ans=min(a,k) k-=min(a,k) k-=min(b,k) ans+=min(c,k) print(ans)
a,b,c,k=map(int,input().split()) ans=min(a,k) k-=min(a,k) k-=min(b,k) ans-=min(c,k) print(ans)
[["-", 36, 36, 0, 656, 0, 1, 0, 677, 17, 107], ["+", 36, 36, 0, 656, 0, 1, 0, 677, 17, 110]]
5
56
import sys input = sys.stdin.readline # B - Easy Linear Programming a, b, c, k = map(int, input().split()) if a < k: print(k) elif a + b >= k: print(a) else: minus = k - (a + b) print(a - minus)
import sys input = sys.stdin.readline # B - Easy Linear Programming a, b, c, k = map(int, input().split()) if a > k: print(k) elif a + b >= k: print(a) else: minus = k - (a + b) print(a - minus)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 18], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47]]
5
67
a, b, c, k = map(int, input().split()) n = 0 n += min(a, k) k -= a k -= b if k - a - b <= 0: print(n) exit() n += k * (-1) print(n)
a, b, c, k = map(int, input().split()) n = 0 n += min(a, k) k -= a k -= b if k <= 0: print(n) exit() n += k * (-1) print(n)
[["-", 0, 57, 15, 666, 0, 657, 31, 657, 17, 33], ["-", 0, 57, 15, 666, 0, 657, 31, 657, 12, 22], ["-", 0, 656, 0, 57, 15, 666, 0, 657, 17, 33], ["-", 0, 656, 0, 57, 15, 666, 0, 657, 12, 22]]
5
65
#include <bits/stdc++.h> using namespace std; #define pb push_back #define ff first #define ss second #define ll long long int #define endl "\n" #define FASTIO \ ios_base::sync_with_stdio(false); \ cin.tie(NU...
#include <bits/stdc++.h> using namespace std; #define pb push_back #define ff first #define ss second #define ll long long int #define endl "\n" #define FASTIO \ ios_base::sync_with_stdio(false); \ cin.tie(NU...
[["+", 64, 9, 0, 1, 0, 16, 12, 2, 63, 22], ["+", 0, 1, 0, 16, 12, 2, 3, 4, 0, 24], ["+", 0, 1, 0, 16, 12, 2, 3, 4, 0, 22], ["+", 0, 1, 0, 16, 12, 2, 3, 4, 0, 21], ["+", 0, 1, 0, 16, 12, 2, 3, 4, 0, 25]]
1
160
#include <bits/stdc++.h> using namespace std; /*** Typedef ***/ typedef long long ll; typedef unsigned long long ull; typedef long double ld; typedef complex<ld> P; #define X real() #define Y imag() ld restant(P p) { return abs(p); } /// polar(x,y) mag=l,arg=y /// typedef unordered_set<ll> usll; /// typedef un...
#include <bits/stdc++.h> using namespace std; /*** Typedef ***/ typedef long long ll; typedef unsigned long long ull; typedef long double ld; typedef complex<ld> P; #define X real() #define Y imag() ld restant(P p) { return abs(p); } /// polar(x,y) mag=l,arg=y /// typedef unordered_set<ll> usll; /// typedef un...
[["+", 0, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["+", 0, 9, 0, 57, 64, 9, 0, 93, 0, 35]]
1
657
#include <bits/stdc++.h> using namespace std; #define F first #define S second #define PB push_back #define MP make_pair #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define read(x) \ int x; ...
#include <bits/stdc++.h> using namespace std; #define F first #define S second #define PB push_back #define MP make_pair #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define read(x) \ int x; ...
[["-", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22], ["+", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22]]
1
179
import io, sys, atexit, os import math as ma from sys import exit from decimal import Decimal as dec from itertools import permutations from itertools import combinations def li(): return list(map(int, sys.stdin.readline().split())) def num(): return map(int, sys.stdin.readline().split()) def nu(): re...
import io, sys, atexit, os import math as ma from sys import exit from decimal import Decimal as dec from itertools import permutations from itertools import combinations def li(): return list(map(int, sys.stdin.readline().split())) def num(): return map(int, sys.stdin.readline().split()) def nu(): re...
[["+", 0, 1, 0, 652, 3, 4, 0, 652, 63, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 21], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
205
a, b, c , k = [int(x) for x in input().split()] ans = min(a, k) k -= a k -= b ans -= k print(ans)
a, b, c, k = [int(x) for x in input().split()] ans = min(a, k) k -= a k -= b ans -= k if k > 0 else 0 print(ans)
[["+", 0, 656, 0, 1, 0, 677, 12, 41, 0, 121], ["+", 0, 1, 0, 677, 12, 41, 0, 666, 0, 22], ["+", 0, 1, 0, 677, 12, 41, 0, 666, 667, 47], ["+", 0, 1, 0, 677, 12, 41, 0, 666, 0, 612], ["+", 0, 656, 0, 1, 0, 677, 12, 41, 0, 95], ["+", 0, 656, 0, 1, 0, 677, 12, 41, 0, 612]]
5
45
def input_int_list(): return [int(thing) for thing in input().split(" ")] def int_input(): return int(input()) def print_ans(string): print(string) exit() def yes(): print("Yes") exit() def no(): print("No") exit() A,B,C,K=input_int_list() if K<=A: print_ans(A) else: if K<...
def input_int_list(): return [int(thing) for thing in input().split(" ")] def int_input(): return int(input()) def print_ans(string): print(string) exit() def yes(): print("Yes") exit() def no(): print("No") exit() A,B,C,K=input_int_list() if K<=A: print_ans(K) else: if K<...
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
123
a, b, c, k = map(int, input().split()) if a >= k: ans = a else: k -= a if b >= k: ans = a else: k -= b ans = a - k print(ans)
a, b, c, k = map(int, input().split()) if a >= k: ans = k else: k -= a if b >= k: ans = a else: k -= b ans = a - k print(ans)
[["-", 0, 57, 64, 196, 0, 1, 0, 662, 12, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 12, 22]]
5
55
a = input().rstrip().split(' ') A,B,C,K = int(a[0]),int(a[1]),int(a[2]),int(a[3]) s = 0 if K - A <= 0: print(A) else: K -= A if K - B <= 0: print(A) else: K -= B print(A-K)
a = input().rstrip().split(' ') A,B,C,K = int(a[0]),int(a[1]),int(a[2]),int(a[3]) s = 0 if K - A <= 0: print(K) else: K -= A if K - B <= 0: print(A) else: K -= B print(A-K)
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
96
a,b,c,k = map(int, input().split()) tmp = 0 if a >= k: tmp = a else: tmp = a k -= a if k > b: k -= b tmp -= k print(tmp)
a,b,c,k = map(int, input().split()) tmp = 0 if a >= k: tmp = k else: tmp = a k -= a if k > b: k -= b tmp -= k print(tmp)
[["-", 0, 57, 64, 196, 0, 1, 0, 662, 12, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 12, 22]]
5
54
a, b, c, k = map(int, input().split()) j = k-(a+b) j = 0 if j < 0 else j print(a-j)
a, b, c, k = map(int, input().split()) j = k-(a+b) j = 0 if j < 0 else j print(a-j if k > a else k)
[["+", 0, 1, 0, 652, 3, 4, 0, 41, 0, 121], ["+", 0, 652, 3, 4, 0, 41, 0, 666, 0, 22], ["+", 0, 652, 3, 4, 0, 41, 0, 666, 667, 47], ["+", 0, 1, 0, 652, 3, 4, 0, 41, 0, 95], ["+", 0, 1, 0, 652, 3, 4, 0, 41, 0, 22]]
5
44
#include <bits/stdc++.h> using namespace std; #define FOR(i, a, b) for (int i = a; i < b; i++) #define FORS(i, a, b, c) for (int i = a; i < b; i += c) #define FORN(i, a, b) for (int i = a; i <= b; i++) #define FORD(i, a, b) for (int i = a - 1; i >= b; i--) #define FORE(i, b) for (auto &i : b) #define REP(i, b) FOR(i, ...
#include <bits/stdc++.h> using namespace std; #define FOR(i, a, b) for (int i = a; i < b; i++) #define FORS(i, a, b, c) for (int i = a; i < b; i += c) #define FORN(i, a, b) for (int i = a; i <= b; i++) #define FORD(i, a, b) for (int i = a - 1; i >= b; i--) #define FORE(i, b) for (auto &i : b) #define REP(i, b) FOR(i, ...
[["+", 31, 16, 12, 23, 0, 41, 75, 2, 63, 22], ["+", 12, 23, 0, 41, 75, 2, 3, 4, 0, 24], ["+", 12, 23, 0, 41, 75, 2, 3, 4, 0, 22], ["+", 12, 23, 0, 41, 75, 2, 3, 4, 0, 21], ["+", 12, 23, 0, 41, 75, 2, 3, 4, 0, 25]]
1
390
# coding: utf-8 # Your code here! #標準入力で受け取り配列に入れる num_line = input().split() #配列から変数を取り出す num_one = int(num_line[0]) num_zero = int(num_line[1]) num_mini = int(num_line[2]) num_amount = int(num_line[3]) #num_oneから順に取っていく if num_one >= num_amount: print(num_amount) elif num_one + num_zero >= num_amount: prin...
# coding: utf-8 # Your code here! #標準入力で受け取り配列に入れる num_line = input().split() #配列から変数を取り出す num_one = int(num_line[0]) num_zero = int(num_line[1]) num_mini = int(num_line[2]) num_amount = int(num_line[3]) #num_oneから順に取っていく if num_one >= num_amount: print(num_amount) elif num_one + num_zero >= num_amount: prin...
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
88
a = list(map(int,input().split())) one = a[0] zero = a[1] mone = a[2] num = a[3] ans = 0 if one >= num: print(num) else: ans += one num -= one if zero >= num: print(ans) else: num -= zero print(num) print(one - num)
a = list(map(int,input().split())) one = a[0] zero = a[1] mone = a[2] num = a[3] ans = 0 if one >= num: print(num) else: ans += one num -= one if zero >= num: print(ans) else: num -= zero print(one - num)
[["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25], ["-", 75, 76, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24]]
5
85
#include <bits/stdc++.h> #include <string> using namespace std; using namespace std::chrono; // c++ templte for // help........................................................... //#define deb(x) cout<<#x<<" "<<x<<endl;/* for debuging printing variable with //name*/ #define debb(x,y) cout<<#x<<" "<<x<<" "<<#y<<" "<...
#include <bits/stdc++.h> #include <string> using namespace std; using namespace std::chrono; // c++ templte for // help........................................................... //#define deb(x) cout<<#x<<" "<<x<<endl;/* for debuging printing variable with //name*/ #define debb(x,y) cout<<#x<<" "<<x<<" "<<#y<<" "<...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 31, 22], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 17, 33]]
1
166
a,b,c,k =list(map(int, input().split())) if (a>=k): s=a else: if ((a+b)>=k): s=a else: s=a-(k-a-b) print(s)
a,b,c,k =list(map(int, input().split())) if (a>=k): s=k else: if ((a+b)>=k): s=a else: s=a-(k-a-b) print(s)
[["-", 0, 57, 64, 196, 0, 1, 0, 662, 12, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 12, 22]]
5
66
a, b, c, k = [int(x) for x in input().split()] if(a+b>=k): print(a) else: print(a-(k-(a+b)))
a, b, c, k = [int(x) for x in input().split()] if(a+b>=k): print(min(a,k)) else: print(a-(k-(a+b)))
[["+", 0, 1, 0, 652, 3, 4, 0, 652, 63, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 21], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
53
using namespace std; #include <bits/stdc++.h> #define int long long #define pb push_back #define IOS \ ios_base::sync_with_stdio(0); \ cin.tie(0); ...
using namespace std; #include <bits/stdc++.h> #define int long long #define pb push_back #define IOS \ ios_base::sync_with_stdio(0); \ cin.tie(0); ...
[["+", 64, 1, 0, 16, 31, 16, 12, 2, 63, 22], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 24], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 21], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 22], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 25]]
1
171
a, b, c, k = map(int, input().split()) if a >= k: print(a) exit() if k-a-b <= 0: print(a) exit() print(a-(k-a-b))
a, b, c, k = map(int, input().split()) if a >= k: print(k) exit() if k-a-b <= 0: print(a) exit() print(a-(k-a-b))
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
60
#!/usr/bin/env python3 import sys def solve(A: int, B: int, C: int, K: int): if K <= A+B: print(A) else: print(A - (K - (A+B))) return # Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools (tips: You use the default template now. You can remove this line by using your cust...
#!/usr/bin/env python3 import sys def solve(A: int, B: int, C: int, K: int): if K <= A+B: print(min(A,K)) else: print(A - (K - (A+B))) return # Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools (tips: You use the default template now. You can remove this line by using yo...
[["+", 0, 1, 0, 652, 3, 4, 0, 652, 63, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 21], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
145
A,B,C,K=map(int,input().split()) if (A+B)>=K and A<=K: print(A) elif (A+B)>=K and A>=K: print(K) elif (A+B)<K: print(max(A-(K-A-B),0))
A,B,C,K=map(int,input().split()) if (A+B)>=K and A<=K: print(A) elif (A+B)>=K and A>=K: print(K) elif (A+B)<K: print(A-(K-A-B))
[["-", 0, 1, 0, 652, 3, 4, 0, 652, 63, 22], ["-", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["-", 0, 652, 3, 4, 0, 657, 12, 23, 0, 25], ["-", 0, 652, 3, 4, 0, 652, 3, 4, 0, 21], ["-", 0, 652, 3, 4, 0, 652, 3, 4, 0, 612]]
5
80
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { int A, B, C, K; cin >> A >> B >> C >> K; int ans = 0; if (K < A) ans = A - K; else if (K <= A + B) ans = A; else ans = A - (K - A - B); cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { int A, B, C, K; cin >> A >> B >> C >> K; int ans = 0; if (K < A) ans = K; else if (K <= A + B) ans = A; else ans = A - (K - A - B); cout << ans << endl; }
[["-", 0, 57, 64, 1, 0, 11, 12, 16, 31, 22], ["-", 0, 57, 64, 1, 0, 11, 12, 16, 17, 33]]
1
86
S = list(map(int,input().split())) if S[0] + S[1] + S[2] >= 2 * 10 ** 9: print('Error') elif S[0] >= S[3]: print(S[3]) elif S[3] > S[0] and S[3] <= S[0] + S[1]: print(S[0]) elif S[3] > S[0] + S[1] and S[3] <= S[0] + S[1] + S[2]: print(-1 * (S[3] - S[0] - S[1]) + S[0]) else: print('Error')
S = list(map(int,input().split())) if S[0] + S[1] + S[2] > 2 * 10 ** 9: print('Error') elif S[0] >= S[3]: print(S[3]) elif S[3] > S[0] and S[3] <= S[0] + S[1]: print(S[0]) elif S[3] > S[0] + S[1] and S[3] <= S[0] + S[1] + S[2]: print(-1 * (S[3] - S[0] - S[1]) + S[0]) else: print('Error')
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47]]
5
167
A,B,C,K = gets.split.map(&:to_i) if A+B >= K puts A else puts A - (K-A-B) end
A,B,C,K = gets.split.map(&:to_i) if A+B >= K puts [A,K].min else puts A - (K-A-B) end
[["+", 0, 652, 3, 4, 0, 652, 486, 516, 0, 70], ["+", 0, 652, 3, 4, 0, 652, 486, 516, 0, 21], ["+", 0, 652, 3, 4, 0, 652, 486, 516, 0, 743], ["+", 0, 652, 3, 4, 0, 652, 486, 516, 0, 73], ["+", 64, 749, 0, 652, 3, 4, 0, 652, 17, 131], ["+", 64, 749, 0, 652, 3, 4, 0, 652, 735, 22]]
4
37
A, B, C, K = map(int, input().split()) S = max(A, K) - max(0, K-A-B) print(S)
A, B, C, K = map(int, input().split()) S = min(A, K) - max(0, K-A-B) print(S)
[["-", 0, 1, 0, 662, 12, 657, 31, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 657, 31, 652, 63, 22]]
5
43
a, b, c, k = map( int, input().split() ) if k <= a: print( k ) elif k > a: if b == 0: nc = k - a print( a - nc ) elif b != 0: nb = k - a if nb <= b: print( a ) elif nb > b: nc = nb - c print( a - nc )
a, b, c, k = map( int, input().split() ) if k <= a: print( k ) elif k > a: if b == 0: nc = k - a print( a - nc ) elif b != 0: nb = k - a if nb <= b: print( a ) elif nb > b: nc = nb - b print( a - nc )
[["-", 64, 196, 0, 1, 0, 662, 12, 657, 12, 22], ["+", 64, 196, 0, 1, 0, 662, 12, 657, 12, 22]]
5
85
#include <bits/stdc++.h> using namespace std; #define rep(i, a, b) for (int i = a; i < (b); ++i) #define all(x) begin(x), end(x) typedef long long ll; typedef pair<int, int> pii; const int inf = 1010001000; const ll INF = 1001000100010001000; const int mod = (int)1e9 + 7; int main() { ll a, b, c, k; cin >> a >> b...
#include <bits/stdc++.h> using namespace std; #define rep(i, a, b) for (int i = a; i < (b); ++i) #define all(x) begin(x), end(x) typedef long long ll; typedef pair<int, int> pii; const int inf = 1010001000; const ll INF = 1001000100010001000; const int mod = (int)1e9 + 7; int main() { ll a, b, c, k; cin >> a >> b...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
148
#include <bits/stdc++.h> using namespace std; #define rep(i, a, b) for (int i = a; i < (b); ++i) #define all(x) begin(x), end(x) typedef long long ll; typedef pair<int, int> pii; const int inf = 100100100; const ll INF = 1001000100010001000; const int mod = (int)1e9 + 7; int main() { ll a, b, c, k; cin >> a >> b ...
#include <bits/stdc++.h> using namespace std; #define rep(i, a, b) for (int i = a; i < (b); ++i) #define all(x) begin(x), end(x) typedef long long ll; typedef pair<int, int> pii; const int inf = 100100100; const ll INF = 1001000100010001000; const int mod = (int)1e9 + 7; int main() { ll a, b, c, k; cin >> a >> b ...
[["-", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22], ["+", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22]]
1
145
def solve(): a, b, c, k = map(int,input().split()) if k > a + b: ans = a - (k - a - b) print(ans) else: print(a) if __name__ == '__main__': solve()
def solve(): a, b, c, k = map(int, input().split()) if k > a + b: ans = a - (k - a - b) print(ans) else: print(min(k, a)) if __name__ == '__main__': solve()
[["+", 0, 1, 0, 652, 3, 4, 0, 652, 63, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 21], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
63
#include <bits/stdc++.h> #define ll long long int using namespace std; int main() { ll a, b, c, k; cin >> a >> b >> c >> k; if (k <= a) cout << 1 * a; else if (k > a && k <= a + b) cout << a; else if (k > a + b && k <= a + b + c) cout << (a + (k - (a + b)) * (-1)); }
#include <bits/stdc++.h> #define ll long long int using namespace std; int main() { ll a, b, c, k; cin >> a >> b >> c >> k; if (k <= a) cout << k; else if (k > a && k <= a + b) cout << a; else if (k > a + b && k <= a + b + c) cout << (a + ((k - (a + b)) * (-1))); }
[["-", 0, 57, 64, 1, 0, 16, 12, 16, 31, 13], ["-", 0, 57, 64, 1, 0, 16, 12, 16, 17, 48], ["-", 0, 57, 64, 1, 0, 16, 12, 16, 12, 22], ["+", 8, 9, 0, 57, 64, 1, 0, 16, 12, 22], ["+", 0, 16, 12, 23, 0, 16, 12, 23, 0, 24], ["+", 0, 16, 12, 23, 0, 16, 12, 23, 0, 25]]
1
100
a,b,c,k = map(int,input().split()) if a >= k: print(a) elif a < k and b >= k-a: print(a) else: print(a-(k-a-b))
a,b,c,k = map(int,input().split()) if a >= k: print(k) elif a < k and b >= k-a: print(a) else: print(a-(k-a-b))
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
58
#include <algorithm> #include <iostream> using namespace std; int main() { int A, B, C, K; cin >> A >> B >> C >> K; cout << (K <= A + B ? A : A - min(C, K - A - B)); }
#include <algorithm> #include <iostream> using namespace std; int main() { int A, B, C, K; cin >> A >> B >> C >> K; cout << (K <= A + B ? min(A, K) : A - min(C, K - A - B)); }
[["+", 0, 16, 12, 23, 0, 41, 64, 2, 63, 22], ["+", 12, 23, 0, 41, 64, 2, 3, 4, 0, 24], ["+", 12, 23, 0, 41, 64, 2, 3, 4, 0, 21], ["+", 12, 23, 0, 41, 64, 2, 3, 4, 0, 22], ["+", 12, 23, 0, 41, 64, 2, 3, 4, 0, 25]]
1
58
[A, B, C, K] = list(map(int, input().split())) if K <= A: print(K) if A< K <= A + B: print(A) else: print(2 * A - K + B)
[A, B, C, K] = list(map(int, input().split())) if K <= A: print(K) quit() if A< K <= A + B: print(A) quit() else: print(2 * A - K + B)
[["+", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
59
#include <algorithm> #include <cmath> //abs()かfabs()で少数絶対値 #include <cstdlib> //abs()で整数絶対値 #include <deque> #include <functional> //sort第三引数greater<型名>()で降順 #include <iomanip> //cout<<setw(数字) で空白による桁揃え #include <iostream> //cout<<right で右揃え #include <map> #include <queue> #include <string> #include <vector> u...
#include <algorithm> #include <cmath> //abs()かfabs()で少数絶対値 #include <cstdlib> //abs()で整数絶対値 #include <deque> #include <functional> //sort第三引数greater<型名>()で降順 #include <iomanip> //cout<<setw(数字) で空白による桁揃え #include <iostream> //cout<<right で右揃え #include <map> #include <queue> #include <string> #include <vector> u...
[["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 31, 22], ["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
123
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, c, k, ans = 0; cin >> a >> b >> c >> k; if (a > k) { cout << k << endl; } else if (a + b >= k) { ans = a; } else { ans = a - (k - (a + b)); } cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, c, k, ans = 0; cin >> a >> b >> c >> k; if (a > k) { ans = k; } else if (a + b >= k) { ans = a; } else { ans = a - (k - (a + b)); } cout << ans << endl; }
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 31, 22], ["-", 64, 9, 0, 1, 0, 16, 31, 16, 17, 151], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["-", 0, 57, 64, 9, 0, 1, 0, 16, 17, 151], ["-", 0, 57, 64, 9, 0, 1, 0, 16, 12, 22]]
1
88
a,b,c,k = map(int,input().split()) if a + b >= k: ans = a else: ans = a - (k-a-b) print(ans)
a,b,c,k = map(int,input().split()) if a + b >= k: ans = min(a,k) else: ans = a - (k-a-b) print(ans)
[["+", 64, 196, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 21], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25]]
5
47
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; int xa = min(a, k); k -= xa; int xb = min(b, k); k -= xb; int xc = k; int ans = xa - xb; cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; int xa = min(a, k); k -= xa; int xb = min(b, k); k -= xb; int xc = k; int ans = xa - xc; cout << ans << endl; }
[["-", 8, 9, 0, 43, 49, 50, 51, 16, 12, 22], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 12, 22]]
1
77
a, b, c, k = map(int, input().split()) if k <= a+b: print(a) else: print(2*a+b-k)
a, b, c, k = map(int, input().split()) if k <= a+b: print(min(a, k)) else: print(2*a+b-k)
[["+", 0, 1, 0, 652, 3, 4, 0, 652, 63, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 21], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
43
a,b,c,k = map(int,input().split()) ans = 0 if k > a: ans = ans + a k = k - a else: ans = ans + k k = 0 if k > b: k = k - b else: k = 0 if k > c: ans = ans - c else: ans = ans - k print(ans) print(ans)
a,b,c,k = map(int,input().split()) ans = 0 if k > a: ans = ans + a k = k - a else: ans = ans + k k = 0 if k > b: k = k - b else: k = 0 if k > c: ans = ans - c else: ans = ans - k print(ans)
[["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
88
#include <bits/stdc++.h> using namespace std; int main() { vector<int> a(3), x(3); for (int i = 0; i < 3; i++) { cin >> a[i]; } int k; cin >> k; for (int i = 0; i < 3; i++) { x[i] = min(k, a[i]); k -= a[i]; } cout << x[0] - x[2] << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { vector<int> a(3), x(3); for (int i = 0; i < 3; i++) { cin >> a[i]; } int k; cin >> k; for (int i = 0; i < 3; i++) { x[i] = min(k, a[i]); k -= x[i]; } cout << x[0] - x[2] << endl; return 0; }
[["-", 8, 9, 0, 1, 0, 11, 12, 69, 28, 22], ["+", 8, 9, 0, 1, 0, 11, 12, 69, 28, 22]]
1
111
#include <bits/stdc++.h> using namespace std; int main() { vector<int> a(3); int k; for (int i = 0; i < 3; i++) { cin >> a[i]; } cin >> k; if (k <= a[0]) cout << a[0] << endl; else if (k <= a[0] + a[1]) cout << a[0] << endl; else cout << 2 * a[0] + a[1] - k << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { vector<int> a(3); int k; for (int i = 0; i < 3; i++) { cin >> a[i]; } cin >> k; if (k <= a[0]) cout << k << endl; else if (k <= a[0] + a[1]) cout << a[0] << endl; else cout << 2 * a[0] + a[1] - k << endl; return 0; }
[["-", 64, 1, 0, 16, 31, 16, 12, 69, 28, 22], ["-", 0, 16, 31, 16, 12, 69, 341, 342, 0, 70], ["-", 0, 16, 31, 16, 12, 69, 341, 342, 0, 13], ["-", 0, 16, 31, 16, 12, 69, 341, 342, 0, 73], ["+", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22]]
1
115
#include <algorithm> #include <iostream> using namespace std; int main() { long A, B, C, K; cin >> A >> B >> C >> K; long ans = 0; if (A > K) { ans += K; } else { ans += A; K -= A; if (B <= K) { K -= B; if (C > K) { ans -= K; } } } cout << ans << endl; }
#include <algorithm> #include <iostream> using namespace std; int main() { long A, B, C, K; cin >> A >> B >> C >> K; long ans = 0; if (A >= K) { ans += K; } else { ans += A; K -= A; if (B < K) { K -= B; if (C >= K) { ans -= K; } } } cout << ans << endl; }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["-", 0, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["-", 64, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
91
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long a = sc.nextLong(), b = sc.nextLong(), c = sc.nextLong(), k = sc.nextLong(); long res = 0; if (k <= a) { System.out.println(k); } else if (k <= a + b) { ...
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long a = sc.nextLong(), b = sc.nextLong(), c = sc.nextLong(), k = sc.nextLong(); long res = 0; if (k <= a) { System.out.println(k); } else if (k <= a + b) { ...
[["+", 0, 492, 3, 4, 0, 16, 12, 23, 0, 24], ["+", 0, 16, 12, 23, 0, 16, 31, 16, 17, 33], ["+", 0, 16, 12, 23, 0, 16, 31, 16, 12, 22], ["+", 3, 4, 0, 16, 12, 23, 0, 16, 17, 33], ["+", 3, 4, 0, 16, 12, 23, 0, 16, 12, 22], ["+", 0, 492, 3, 4, 0, 16, 12, 23, 0, 25]]
3
124
a,b,c,k = map(int,input().split()) if a <= k: print(k) elif a + b >= k: print(a) else: print(a-(k-(a+b)))
ans = 0 a,b,c,k = map(int,input().split()) if a >= k: print(k) elif a + b >= k: print(a) else: print(a-(k-(a+b)))
[["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 19], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20]]
5
56
#include "bits/stdc++.h" #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <ext/rope> using namespace __gnu_pbds; using namespace __gnu_cxx; using namespace std; using ll = long long; #define eb emplace_back #define pb push_back #define mp make_pair #define ff first #define ss sec...
#include "bits/stdc++.h" #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <ext/rope> using namespace __gnu_pbds; using namespace __gnu_cxx; using namespace std; using ll = long long; #define eb emplace_back #define pb push_back #define mp make_pair #define ff first #define ss sec...
[["+", 0, 14, 8, 9, 0, 1, 0, 16, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 151], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
414
#include <algorithm> #include <cmath> #include <functional> //sortのgreater #include <iostream> #include <math.h> #include <numeric> //iota(整数列の生成),gcdとlcm(c++17) #include <string> //文字列 #include <vector> #define rep(i, n) for (int i = 0; i < n; i++) #define REP(i, n) for (int i = 1; i <= n; i++) using namespace std;...
#include <algorithm> #include <cmath> #include <functional> //sortのgreater #include <iostream> #include <math.h> #include <numeric> //iota(整数列の生成),gcdとlcm(c++17) #include <string> //文字列 #include <vector> #define rep(i, n) for (int i = 0; i < n; i++) #define REP(i, n) for (int i = 1; i <= n; i++) using namespace std;...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22]]
1
153
#define _USE_MATH_DEFINES #include "bits/stdc++.h" using namespace std; #define ll long long int #define str string #define ALL(a) (a).begin(), (a).end() #define P pair<ll, ll> using Graph = vector<vector<int>>; const int dy[] = {0, 0, 1, -1}, dx[] = {1, -1, 0, 0}; ll INFL = 1ll << 60, INF = 1 << 30, mod = 1e9 + 7, ...
#define _USE_MATH_DEFINES #include "bits/stdc++.h" using namespace std; #define ll long long int #define str string #define ALL(a) (a).begin(), (a).end() #define P pair<ll, ll> using Graph = vector<vector<int>>; const int dy[] = {0, 0, 1, -1}, dx[] = {1, -1, 0, 0}; ll INFL = 1ll << 60, INF = 1 << 30, mod = 1e9 + 7, ...
[["-", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22], ["+", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22]]
1
222
#include <stdio.h> int main() { int a, b, c, k, sum = 0; scanf("%d%d%d%d", &a, &b, &c, &k); if (k <= a) return 0 * printf("%d\n", a); if (k > a) sum += a, k -= a; if (k <= b) return 0 * printf("%d\n", sum); if (k > b) sum += 0, k -= b; return 0 * printf("%d\n", sum - k); return 0; }
#include <stdio.h> int main() { int a, b, c, k, sum = 0; scanf("%d%d%d%d", &a, &b, &c, &k); if (k <= a) return 0 * printf("%d\n", k); if (k > a) sum += a, k -= a; if (k <= b) return 0 * printf("%d\n", sum); if (k > b) sum += 0, k -= b; return 0 * printf("%d\n", sum - k); return 0; }
[["-", 64, 37, 0, 16, 12, 2, 3, 4, 0, 22], ["+", 64, 37, 0, 16, 12, 2, 3, 4, 0, 22]]
1
124
#include <iostream> using namespace std; int main() { int k, a, b, c; int answer = 0; cin >> k >> a >> b >> c; if (k <= a) answer = k; else if (k <= a + b) answer = a; else answer = 2 * a + b - k; cout << answer << endl; return 0; }
#include <iostream> using namespace std; int main() { int k, a, b, c; int answer = 0; cin >> a >> b >> c >> k; if (k <= a) answer = k; else if (k <= a + b) answer = a; else answer = 2 * a + b - k; cout << answer << endl; return 0; }
[["-", 0, 16, 31, 16, 31, 16, 31, 16, 12, 22], ["-", 0, 1, 0, 16, 31, 16, 31, 16, 17, 152], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22]]
1
79
#include <bits/stdc++.h> using namespace std; int main() { int A, B, C, K; cin >> A >> B >> C >> K; cout << min(A, K) - min(C, K - A - B) << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int A, B, C, K; cin >> A >> B >> C >> K; cout << min(A, K) - min(C, max(0, K - A - B)) << endl; }
[["+", 12, 16, 12, 2, 3, 4, 0, 2, 63, 22], ["+", 12, 2, 3, 4, 0, 2, 3, 4, 0, 24], ["+", 12, 2, 3, 4, 0, 2, 3, 4, 0, 13], ["+", 12, 2, 3, 4, 0, 2, 3, 4, 0, 21], ["+", 12, 2, 3, 4, 0, 2, 3, 4, 0, 25]]
1
53
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(10 ** 7) a, b, c, k = map(int, readline().split()) if a + b >= k: print(a) else: print(a - (k - a - b))
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(10 ** 7) a, b, c, k = map(int, readline().split()) if a + b >= k: print(min(a, k)) else: print(a - (k - a - b))
[["+", 0, 1, 0, 652, 3, 4, 0, 652, 63, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 21], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
82
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using p = pair<int, int>; int main() { ll a, b, c, k; cin >> a >> b >> c >> k; ll s = 0; if (a >= k) { s = a; } else if (a + b >= k) { s = a; } else { s = a - (k - a - b); } ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using p = pair<int, int>; int main() { ll a, b, c, k; cin >> a >> b >> c >> k; ll s = 0; if (a >= k) { s = k; } else if (a + b >= k) { s = a; } else { s = a - (k - a - b); } ...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22]]
1
111
#n=gets.chomp.split(" ").map(&:to_i); a,b,c,k=gets.chomp.split(" ").map(&:to_i); sum = 0 sum += [a,k].min k-=[a,k].min k-=[b,k].min sum -= [b,k].min puts sum
#n=gets.chomp.split(" ").map(&:to_i); a,b,c,k=gets.chomp.split(" ").map(&:to_i); sum = 0 sum += [a,k].min k-=[a,k].min k-=[b,k].min sum -= [c,k].min puts sum
[["-", 0, 493, 0, 755, 12, 652, 486, 516, 0, 22], ["+", 0, 493, 0, 755, 12, 652, 486, 516, 0, 22]]
4
67