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
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; typedef long long ll; typedef long double lld; typedef long long int lli; using namespace std; const int N = 1000001; const int MOD = 1e9 + 7; const bool DEBUG = 1; #define sd(x) scanf("%d ...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; typedef long long ll; typedef long double lld; typedef long long int lli; using namespace std; const int N = 1000001; const int MOD = 1e9 + 7; const bool DEBUG = 1; #define sd(x) scanf("%d ...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
924
#include <bits/stdc++.h> using namespace std; int main() { int A, B, C, K; cin >> A >> B >> C >> K; int sum = 0; int taken = 0; if (K > A) { taken += A; sum = A; } else { taken = K; sum += K; } if (taken < K) { int take = min(K - taken, B); taken += take; sum += 0; } ...
#include <bits/stdc++.h> using namespace std; int main() { int A, B, C, K; cin >> A >> B >> C >> K; int sum = 0; int taken = 0; if (K > A) { taken += A; sum += A; } else { taken = K; sum += K; } if (taken < K) { int take = min(K - taken, B); taken += take; sum += 0; }...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 107], ["+", 64, 9, 0, 1, 0, 11, 12, 16, 31, 22], ["+", 64, 9, 0, 1, 0, 11, 12, 16, 17, 48]]
1
130
#include <iostream> using namespace std; int main() { int64_t A, B, C, K; cin >> A >> B >> C >> K; int64_t count = 0; if (K <= A) count = A; else if (K <= A + B) count = A; else { int64_t res = K - A - B; count = A - res; } cout << count; }
#include <iostream> using namespace std; int main() { int64_t A, B, C, K; cin >> A >> B >> C >> K; int64_t count = 0; if (K <= A) count = K; else if (K <= A + B) count = A; else { int64_t res = K - A - B; count = A - res; } cout << count; }
[["-", 8, 9, 0, 57, 64, 1, 0, 11, 12, 22], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 12, 22]]
1
81
a,b,c,k = map(int,input().split()) p = 0 if a >= k: print(k) exit(0) else: p = p + a k = k - a if b >= k: print(p) exit(0) else: p = p + b k = k - b if c >= k: print(p - k) exit(0) else: p = p - c print(p)
a,b,c,k = map(int,input().split()) p = 0 if a >= k: print(k) exit(0) else: p = p + a k = k - a if b >= k: print(p) exit(0) else: k = k - b if c >= k: print(p - k) exit(0) else: p = p - c print(p)
[["-", 75, 76, 8, 196, 0, 1, 0, 662, 31, 22], ["-", 75, 76, 8, 196, 0, 1, 0, 662, 0, 32], ["-", 8, 196, 0, 1, 0, 662, 12, 657, 31, 22], ["-", 8, 196, 0, 1, 0, 662, 12, 657, 17, 72], ["-", 8, 196, 0, 1, 0, 662, 12, 657, 12, 22]]
5
99
A, B, C, K = map(int, input().split()) if (K <= A): print(1 * K) K1 = K - (A + B) if (K1 <= 0): print(1 * A) else: print(1 * A + (-1 * K1))
A, B, C, K = map(int, input().split()) if (K <= A): print(1 * K) else: K1 = K - (A + B) if (K1 <= 0): print(1 * A) else: print(1 * A + (-1 * K1))
[["+", 36, 36, 0, 656, 0, 57, 75, 76, 0, 95], ["+", 36, 36, 0, 656, 0, 57, 75, 76, 0, 102]]
5
70
A,B,C,K=map(int,input().split()) ans=0 if K>=A: ans+=A K-=A else: print(ans) exit() if K>=B: K-=B else: print(ans) exit() print(ans-K)
A,B,C,K=map(int,input().split()) ans=0 if K>=A: ans+=A K-=A else: print(K) exit() if K>=B: K-=B else: print(ans) exit() print(ans-K)
[["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
66
a,b,c,k=[int(x) for x in input().split()] count=0 if a>=k: count+=a print(count) else: count+=a k-=a if b>=k: print(count) else: k-=b count-=k print(count)
a,b,c,k=[int(x) for x in input().split()] count=0 if a>=k: count+=k print(count) else: count+=a k-=a if b>=k: print(count) else: k-=b count-=k print(count)
[["-", 0, 57, 64, 196, 0, 1, 0, 677, 12, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 677, 12, 22]]
5
68
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int A = sc.nextInt(); int B = sc.nextInt(); int C = sc.nextInt(); int K = sc.nextInt(); int ans = 0; int K1 = 0; int K2 = 0; if (K >= A) { ans = ans ...
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int A = sc.nextInt(); int B = sc.nextInt(); int C = sc.nextInt(); int K = sc.nextInt(); int ans = 0; int K1 = 0; int K2 = 0; if (K > A) { ans = ans ...
[["-", 8, 196, 0, 57, 15, 15, 0, 16, 17, 20], ["+", 8, 196, 0, 57, 15, 15, 0, 16, 17, 47], ["-", 0, 1, 0, 11, 12, 16, 31, 16, 31, 22], ["-", 0, 1, 0, 11, 12, 16, 31, 16, 17, 72]]
3
202
A,B,C,K=map(int,input().split()) if A>=K: print(K) exit() elif A+B>=K: print(A) exit() else: print(A+(K-A-B)) exit()
A,B,C,K=map(int,input().split()) if A>=K: print(K) exit() elif A+B>=K: print(A) exit() else: print(A-(K-A-B)) exit()
[["-", 0, 1, 0, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 33]]
5
63
cards = gets.split(' ').map!(&:to_i) # i = 1 # max = 0 # a = cards[0] + cards[1] # while i <= cards[0] && i <= cards[3] # max = max + 1 # i = i + 1 # end # while i <= cards[0] + cards[1] && i <= cards[3] # i = i + 1 # end # while i <= cards[0] + cards[1] + cards[2] && i <= cards[3] # max = max - 1 # ...
cards = gets.split(' ').map!(&:to_i) # i = 1 # max = 0 # a = cards[0] + cards[1] # while i <= cards[0] && i <= cards[3] # max = max + 1 # i = i + 1 # end # while i <= cards[0] + cards[1] && i <= cards[3] # i = i + 1 # end # while i <= cards[0] + cards[1] + cards[2] && i <= cards[3] # max = max - 1 # ...
[["-", 8, 749, 0, 652, 3, 4, 0, 742, 0, 612], ["+", 8, 749, 0, 652, 3, 4, 0, 742, 0, 612]]
4
106
A, B, C, K = map(int, input().split()) print(A if K <= A + B else A - (K - A - B))
A, B, C, K = map(int, input().split()) print(K if K < A else A if K <= A + B else A - (K - A - B))
[["+", 0, 1, 0, 652, 3, 4, 0, 41, 0, 22], ["+", 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, 18], ["+", 0, 1, 0, 652, 3, 4, 0, 41, 0, 95]]
5
40
import java.util.*; class Main { private static Scanner sc; public static void main(final String[] args) { sc = new Scanner(System.in); long a = sc.nextLong(), b = sc.nextLong(), c = sc.nextLong(), k = sc.nextLong(), ans; if (k <= a) ans = k; else if (k > a && k - a <= b) ans ...
import java.util.*; class Main { private static Scanner sc; public static void main(final String[] args) { sc = new Scanner(System.in); long a = sc.nextLong(), b = sc.nextLong(), c = sc.nextLong(), k = sc.nextLong(), ans; if (k <= a) ans = k; else if (k > a && k - a <= b) ans ...
[["-", 0, 11, 12, 16, 12, 23, 0, 16, 12, 22], ["+", 12, 16, 12, 23, 0, 16, 31, 16, 12, 22], ["+", 0, 11, 12, 16, 12, 23, 0, 16, 17, 33], ["+", 0, 11, 12, 16, 12, 23, 0, 16, 12, 22]]
3
121
#include <bits/stdc++.h> using namespace std; int main() { int A, B, C, K; cin >> A >> B >> C >> K; int ans; int X, Y, Z; X = K - A; Y = X - B; if (X < 0) { ans = K; } else if (X < B) { ans = A; } else if (Y < C) { ans = A - Y; } cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int A, B, C, K; cin >> A >> B >> C >> K; int ans; int X, Y; X = K - A; Y = X - B; if (X < 0) { ans = K; } else if (X <= B) { ans = A; } else if (Y <= C) { ans = A - Y; } cout << ans << endl; }
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 21], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22], ["-", 75, 76, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 75, 76, 0, 57, 15, 339, 51, 16, 17, 19]]
1
99
a , b, c, k = map(int, input().split()) if(k<=a+b): print(a) else: print(a-(k-(a+b)))
a , b, c, k = map(int, input().split()) if(k<=a+b): 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
49
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int num1 = Integer.parseInt(sc.next()); int num0 = Integer.parseInt(sc.next()); int numMinus1 = Integer.parseInt(sc.next()); int numToSelect = Integer.parseInt(sc.next()); ...
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int num1 = Integer.parseInt(sc.next()); int num0 = Integer.parseInt(sc.next()); int numMinus1 = Integer.parseInt(sc.next()); int numToSelect = Integer.parseInt(sc.next()); ...
[["-", 8, 196, 0, 57, 15, 15, 0, 16, 17, 18], ["+", 8, 196, 0, 57, 15, 15, 0, 16, 17, 19], ["-", 75, 57, 15, 15, 0, 16, 12, 16, 17, 18], ["+", 75, 57, 15, 15, 0, 16, 12, 16, 17, 19], ["-", 75, 57, 75, 57, 15, 15, 0, 16, 17, 19], ["+", 75, 57, 75, 57, 15, 15, 0, 16, 17, 18]]
3
210
#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(void) { int a, b, c, k; cin >> a >> b >> c >> k; if (a >= k) cout << k; else if (b >= k - a) cout << k; else cout << a - (k - a - b); return 0; ...
#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(void) { int a, b, c, k; cin >> a >> b >> c >> k; if (a >= k) cout << k; else if (b >= k - a) cout << a; else cout << a - (k - a - b); return 0; ...
[["-", 75, 76, 0, 57, 64, 1, 0, 16, 12, 22], ["+", 75, 76, 0, 57, 64, 1, 0, 16, 12, 22]]
1
95
a, b, c, k = map(int, input().split()) def actual(a, b, c, k): if a >= k: return a else: k -= a if b >= k: return a else: k -= b return a - k print(actual(a, b, c, k))
a, b, c, k = map(int, input().split()) def actual(a, b, c, k): if a >= k: return k else: k -= a if b >= k: return a else: k -= b return a - k print(actual(a, b, c, k))
[["-", 8, 196, 0, 57, 64, 196, 0, 37, 0, 22], ["+", 8, 196, 0, 57, 64, 196, 0, 37, 0, 22]]
5
73
A, B, C, K = map(int, input().split()) score = 0 if K - (A + B) > 0: # C を取る score = A - (K - (A + B)) else: # C を取らない score = max(K, A) print(score)
A, B, C, K = map(int, input().split()) score = 0 if K - (A + B) > 0: # C を取る score = A - (K - (A + B)) else: # C を取らない score = min(K, A) print(score)
[["-", 8, 196, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 8, 196, 0, 1, 0, 662, 12, 652, 63, 22]]
5
63
A, B, C, K = map(int,input().split()) step1 = K-A step2 = step1 - B step3 = step2 - C if step1 <= 0: print(K) elif step2 <= 0: print(K) else: print(A-step2)
A, B, C, K = map(int,input().split()) step1 = K-A step2 = step1 - B step3 = step2 - C if step1 <= 0: print(K) elif step2 <= 0: print(A) else: print(A-step2)
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
61
a,b,c,k=map(int,input().split()) print(2*a-k+b if a+b<k else a)
a,b,c,k=map(int,input().split()) print(2*a-k+b if a+b<k else a if a<k else k) #a-(k-(a+b)) = a-(k-a-b) = a-k+a+b
[["+", 0, 652, 3, 4, 0, 41, 0, 41, 0, 121], ["+", 3, 4, 0, 41, 0, 41, 0, 666, 0, 22], ["+", 3, 4, 0, 41, 0, 41, 0, 666, 667, 18], ["+", 0, 652, 3, 4, 0, 41, 0, 41, 0, 95], ["+", 0, 652, 3, 4, 0, 41, 0, 41, 0, 22]]
5
38
a,b,c,k=map(int,input().split()) if k <= a: print(k) elif k <= a+b: print(0) else: print(2*a-k+b)
a,b,c,k=map(int,input().split()) if k <= a: print(k) elif k <= a+b: print(a) else: print(2*a-k+b)
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 612], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
52
#include <bits/stdc++.h> using namespace std; #define ll long long int main() { ll a, b, c, k; cin >> a >> b >> c >> k; if (k <= a) { cout << (ll)k; } else if (k <= a + b) { cout << (ll)k; } else { cout << (ll)(a - (k - a - b)); } }
#include <bits/stdc++.h> using namespace std; #define ll long long int main() { ll a, b, c, k; cin >> a >> b >> c >> k; if (k <= a) { cout << (ll)k; } else if (k <= a + b) { cout << (ll)a; } else { cout << (ll)(a - (k - a - b)); } }
[["-", 64, 9, 0, 1, 0, 16, 12, 74, 51, 22], ["+", 64, 9, 0, 1, 0, 16, 12, 74, 51, 22]]
1
87
a,b,c,k = map(int,input().split()) if k <= a: print(a) if k-a <= b and k > a: print(a) if k > a + b: print(2*a+b-k)
a,b,c,k = map(int,input().split()) if k <= a: print(k) if k-a <= b and k > a: print(a) if k > a + b: print(2*a+b-k)
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
61
#include <bits/stdc++.h> #define fastio \ ios_base::sync_with_stdio(false); \ cin.tie(0); \ cout.tie(0); #define ll long long int #define pb p...
#include <bits/stdc++.h> #define fastio \ ios_base::sync_with_stdio(false); \ cin.tie(0); \ cout.tie(0); #define ll long long int #define pb p...
[["-", 8, 9, 0, 57, 64, 1, 0, 16, 12, 22], ["+", 8, 9, 0, 57, 64, 1, 0, 16, 12, 22], ["-", 75, 76, 0, 9, 0, 1, 0, 11, 31, 22], ["-", 75, 76, 0, 9, 0, 1, 0, 11, 17, 32], ["-", 0, 9, 0, 1, 0, 11, 12, 16, 17, 33], ["+", 75, 76, 0, 9, 0, 1, 0, 11, 17, 110]]
1
165
A,B,C,K=map(int,input().split()) flag_A=False flag_B=False flag_C=False if K<=A: flag_A=True elif A<K and K<=A+B: flag_B=True elif A+B<K and K<=A+B+C: flag_C=True if flag_A==True or flag_B==True: print(A) elif flag_C==True: print(A-(K-A-B))
A,B,C,K=map(int,input().split()) flag_A=False flag_B=False flag_C=False if K<=A: flag_A=True elif A<K and K<=A+B: flag_B=True elif A+B<K and K<=A+B+C: flag_C=True if flag_A==True: print(K) elif flag_B==True: print(A) elif flag_C==True: print(A-(K-A-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
99
A,B,C,K = map(int,input().split()) ans = 0 if K <= A: ans = A elif K <= A+B: ans = A else: ans = A-(K-A-B) print(ans)
A,B,C,K = map(int,input().split()) ans = 0 if K <= A: ans = K elif K <= A+B: ans = A else: ans = A-(K-A-B) print(ans)
[["-", 0, 57, 64, 196, 0, 1, 0, 662, 12, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 12, 22]]
5
58
function Main(input) { const arr = input.split(' ').map(Number); const num = arr[3] - arr[0]; if (num >= 0) { let K = num - arr[1]; console.log(K > 0 ? arr[0] - K : arr[0]) } else { console.log(arr[0] + arr[3]); } } Main(require("fs").readFileSync("/dev/stdin", "utf8"));
function Main(input) { const arr = input.split(' ').map(Number); const num = arr[3] - arr[0]; if (num >= 0) { let K = num - arr[1]; console.log(K > 0 ? arr[0] - K : arr[0]); } else { console.log(arr[3]); } } Main(require("fs").readFileSync("/dev/stdin", "utf8"));
[["+", 8, 556, 0, 57, 64, 556, 0, 1, 0, 35], ["-", 0, 2, 3, 3, 0, 16, 31, 69, 500, 22], ["-", 0, 2, 3, 3, 0, 16, 31, 69, 0, 70], ["-", 0, 2, 3, 3, 0, 16, 31, 69, 71, 555], ["-", 0, 2, 3, 3, 0, 16, 31, 69, 0, 73], ["-", 0, 1, 0, 2, 3, 3, 0, 16, 17, 72]]
2
114
function Main(input) { const arr = input.split(' ').map(Number); let K = arr[3]; if (K >= arr[0]) { K -= (arr[0] + arr[1]); console.log(K > 0 ? arr[0] - K : arr[0]) } else { console.log(arr[0] + K); } } Main(require("fs").readFileSync("/dev/stdin", "utf8"));
function Main(input) { const arr = input.split(' ').map(Number); let K = arr[3]; if (K >= arr[0]) { K -= (arr[0] + arr[1]); console.log(K > 0 ? arr[0] - K : arr[0]) } else { console.log(K); } } Main(require("fs").readFileSync("/dev/stdin", "utf8"));
[["-", 0, 2, 3, 3, 0, 16, 31, 69, 500, 22], ["-", 0, 2, 3, 3, 0, 16, 31, 69, 0, 70], ["-", 0, 2, 3, 3, 0, 16, 31, 69, 71, 555], ["-", 0, 2, 3, 3, 0, 16, 31, 69, 0, 73], ["-", 0, 1, 0, 2, 3, 3, 0, 16, 17, 72]]
2
113
function Main(input) { const arr = input.split(' ').map(Number); let K = arr[3]; let total = 0; if (K >= arr[0]) { total += arr[0]; K -= arr[0] + arr[1]; console.log(K > 0 ? total - K : total); } else { console.log(total); } } Main(require("fs").readFileSync("/dev/stdin", "utf8"));
function Main(input) { const arr = input.split(' ').map(Number); let K = arr[3]; let total = 0; if (K >= arr[0]) { total += arr[0]; K -= (arr[0] + arr[1]); console.log(K > 0 ? total - K : total) } else { console.log(total + K); } } Main(require("fs").readFileSync("/dev/stdin", "utf8"));
[["+", 64, 556, 0, 1, 0, 564, 12, 23, 0, 24], ["+", 64, 556, 0, 1, 0, 564, 12, 23, 0, 25], ["-", 8, 556, 0, 57, 64, 556, 0, 1, 0, 35], ["+", 0, 1, 0, 2, 3, 3, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 3, 0, 16, 12, 22]]
2
113
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep2(i, s, n) for (int i = (s); i < (int)(n); i++) long long a, b, c, k; void solve() { if (a >= k) { cout << a << endl; } else if ((a + b) >= k) { cout << a << endl; } else { cout << a - (k - a ...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep2(i, s, n) for (int i = (s); i < (int)(n); i++) long long a, b, c, k; void solve() { if (a >= k) { cout << k << endl; } else if ((a + b) >= k) { cout << a << endl; } else { cout << a - (k - a ...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
113
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, d; cin >> a >> b >> c >> d; int e = a + b; if (e >= d) { cout << a << endl; } else { cout << a - d + e << endl; } }
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, d; cin >> a >> b >> c >> d; int e = a + b; if (e >= d) { cout << min(a, d) << endl; } else { cout << a - d + e << endl; } }
[["+", 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
65
def main(): a, b, c, k = map(int, input().split()) res = 0 if k-a >= 0: res += a # if k-a-b >= 0: # res += 0 if k-a-b > 0: res += (k-a-b)*-1 print(res) if __name__ == '__main__': main()
def main(): a, b, c, k = map(int, input().split()) res = 0 if k-a >= 0: res += a else: res += k # if k-a-b >= 0: # res += 0 if k-a-b > 0: res += (k-a-b)*-1 print(res) if __name__ == '__main__': main()
[["+", 0, 14, 8, 196, 0, 57, 75, 76, 0, 95], ["+", 0, 14, 8, 196, 0, 57, 75, 76, 0, 102], ["+", 75, 76, 8, 196, 0, 1, 0, 677, 31, 22], ["+", 75, 76, 8, 196, 0, 1, 0, 677, 17, 107], ["+", 75, 76, 8, 196, 0, 1, 0, 677, 12, 22]]
5
75
a, b, c, k = map(int, input().split()) out = 0 if k < a: out = k elif k > a: out = a if k > (a + b): out += (k - a - b) * (-1) print(out)
a, b, c, k = map(int, input().split()) out = 0 if k < a: out = k elif k >= a: out = a if k > (a + b): out += (k - a - b) * (-1) print(out)
[["-", 0, 656, 0, 57, 75, 665, 15, 666, 667, 47], ["+", 0, 656, 0, 57, 75, 665, 15, 666, 667, 20]]
5
66
A,B,C,K = map(int, input().split()) total = K if total <= A: print(total) else: if K-A <= B: print(total) else: print(total - (K-A-B))
A,B,C,K = map(int, input().split()) total = K if total <= A: print(total) else: if K-A <= B: 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], ["-", 0, 1, 0, 652, 3, 4, 0, 657, 31, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 31, 22]]
5
59
#include <bits/stdc++.h> using namespace std; using lli = long long int; using ll = long long; using ld = long double; using d = double; bool isPrime(ll n) { if (n < 2) return false; for (ll i = 2; i * i <= n; ++i) { if (n % i == 0) { return false; } } return true; } int main() { ll a, b,...
#include <bits/stdc++.h> using namespace std; using lli = long long int; using ll = long long; using ld = long double; using d = double; bool isPrime(ll n) { if (n < 2) return false; for (ll i = 2; i * i <= n; ++i) { if (n % i == 0) { return false; } } return true; } int main() { ll a, b,...
[["+", 0, 57, 64, 1, 0, 16, 12, 2, 63, 22], ["+", 64, 1, 0, 16, 12, 2, 3, 4, 0, 24], ["+", 64, 1, 0, 16, 12, 2, 3, 4, 0, 21], ["+", 64, 1, 0, 16, 12, 2, 3, 4, 0, 22], ["+", 64, 1, 0, 16, 12, 2, 3, 4, 0, 25]]
1
134
/** * code generated by JHelper * More info: https://github.com/AlexeyDmitriev/JHelper * @author yosiiii */ #include <bits/stdc++.h> using namespace std; #define rep(i, n) for (long long int i = 0; i < (n); ++i) typedef long long int ll; class BEasyLinearProgramming { public: void solve(std::istream &in, std::o...
/** * code generated by JHelper * More info: https://github.com/AlexeyDmitriev/JHelper * @author yosiiii */ #include <bits/stdc++.h> using namespace std; #define rep(i, n) for (long long int i = 0; i < (n); ++i) typedef long long int ll; class BEasyLinearProgramming { public: void solve(std::istream &in, std::o...
[["-", 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, 22], ["-", 0, 16, 31, 16, 12, 2, 3, 4, 0, 21], ["-", 0, 16, 31, 16, 12, 2, 3, 4, 0, 25]]
1
154
#include <bits/stdc++.h> using namespace std; long int a, b, c, k; long int ans = 0; int main() { cin >> a >> b >> c >> k; if (a >= k) { cout << a << endl; } else if (a + b >= k) { cout << a << endl; } else if (a + b + c >= k) { cout << a - (k - a - b) << endl; } }
#include <bits/stdc++.h> using namespace std; long int a, b, c, k; long int ans = 0; int main() { cin >> a >> b >> c >> k; if (a >= k) { cout << k << endl; } else if (a + b >= k) { cout << a << endl; } else if (a + b + c >= k) { cout << a - (k - a - b) << endl; } }
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
96
#include <stdio.h> int main() { int a, b, c, k; int sum = 0; scanf("%d %d %d %d", &a, &b, &c, &k); int k1 = k - a; int k2 = k1 - b; if (k1 < 0) sum = k1; else if (k2 < 0) sum = a; else sum = a - k2; printf("%d", sum); return 0; }
#include <stdio.h> int main() { int a, b, c, k; int sum = 0; scanf("%d %d %d %d", &a, &b, &c, &k); int k1 = k - a; int k2 = k1 - b; if (k1 < 0) sum = k; else if (k2 < 0) sum = a; else sum = a - k2; printf("%d", sum); return 0; }
[["-", 8, 9, 0, 57, 64, 1, 0, 11, 12, 22], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 12, 22]]
0
95
a,b,c,k = map(int,input().split()) print(a if k <= a+b else a-(k-a-b))
a,b,c,k = map(int,input().split()) print(min(a,k) if k <= a+b else a-(k-a-b))
[["+", 0, 652, 3, 4, 0, 41, 0, 652, 63, 22], ["+", 3, 4, 0, 41, 0, 652, 3, 4, 0, 24], ["+", 3, 4, 0, 41, 0, 652, 3, 4, 0, 21], ["+", 3, 4, 0, 41, 0, 652, 3, 4, 0, 22], ["+", 3, 4, 0, 41, 0, 652, 3, 4, 0, 25]]
5
40
a,b,c,k=map(int,input().split()) if a>=k: print(a) else: if a+b>=k: print(a) else: if a+b+c>=k: 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: if a+b+c>=k: 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
67
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) #define rep1(i, n) for (int i = 1; i <= n; i++) #define deb(x) cerr << #x << ": " << x << '\n'; #define ios \ ios_base::sync_with_stdio(false); ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) #define rep1(i, n) for (int i = 1; i <= n; i++) #define deb(x) cerr << #x << ": " << x << '\n'; #define ios \ ios_base::sync_with_stdio(false); ...
[["-", 0, 57, 64, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 16, 12, 22], ["-", 64, 9, 0, 1, 0, 16, 12, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 12, 16, 12, 22], ["-", 75, 76, 0, 1, 0, 16, 12, 16, 12, 22], ["+", 75, 76, 0, 1, 0, 16, 12, 16, 12, 22]]
1
136
#include <algorithm> #include <bitset> #include <cassert> #include <chrono> #include <climits> #include <cmath> #include <cstdio> #include <cstring> #include <ctime> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <random> #include <set> #include <stack> #include <string...
#include <algorithm> #include <bitset> #include <cassert> #include <chrono> #include <climits> #include <cmath> #include <cstdio> #include <cstring> #include <ctime> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <random> #include <set> #include <stack> #include <string...
[["-", 0, 1, 0, 16, 12, 16, 31, 16, 17, 72], ["-", 0, 1, 0, 16, 12, 16, 31, 16, 12, 22]]
1
487
list1 = list(map(int, input().split())) if list1[3] <= list1[0]: print(list1[0]) else: a = list1[3] - list1[0] if a <= list1[1]: print(list1[0]) else: b = a - list1[1] c = (-1)*b + list1[0] print(c)
list1 = list(map(int, input().split())) if list1[3] <= list1[0]: print(list1[3]) else: a = list1[3] - list1[0] if a <= list1[1]: print(list1[0]) else: b = a - list1[1] c = (-1)*b + list1[0] print(c)
[["-", 0, 1, 0, 652, 3, 4, 0, 206, 206, 612], ["+", 0, 1, 0, 652, 3, 4, 0, 206, 206, 612]]
5
90
def calc(K,d,p): sum = 0 if(K > d): sum = p * d else: sum = p * K return sum,d def resolve(): data = [int(i) for i in input().split()] sum = 0 K = data[3] for i in range(3): add,count= calc(K,data[i],1 - i) sum += add K -= count if(K...
def calc(K,d,p): sum = 0 if(K > d): sum = p * d else: sum = p * K return sum,d def resolve(): data = [int(i) for i in input().split()] sum = 0 K = data[3] for i in range(3): add,count= calc(K,data[i],1 - i) sum += add K -= count if(K...
[["-", 8, 196, 0, 57, 15, 23, 0, 666, 667, 60], ["+", 8, 196, 0, 57, 15, 23, 0, 666, 667, 19]]
5
114
#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 { k = k - (a + b); int ans = a + b - k; cout << ans << 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 { k = k - (a + b); int ans = a - k; cout << ans << endl; } }
[["-", 0, 43, 49, 50, 51, 16, 31, 16, 17, 72], ["-", 0, 43, 49, 50, 51, 16, 31, 16, 12, 22]]
1
92
A, B, C, K = map(int,input().split()) min(A, K) + min(0, (A + B) - K )
A, B, C, K = map(int,input().split()) print(min(A, K) + min(0, (A + B) - K ))
[["+", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 3, 4, 0, 657, 12, 652, 3, 4, 0, 25]]
5
39
#include <bits/stdc++.h> #define this ->tt #define long long ll using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; if (k <= a) cout << a << endl; else if (k <= a + b) cout << a << endl; else cout << a - (k - a - b); return 0; } /* ▀█████████▄ ▄████████ ▄████████ ...
#include <bits/stdc++.h> #define this ->tt #define long long ll using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; if (k <= a) cout << k << endl; else if (k <= a + b) cout << a << endl; else cout << a - (k - a - b); return 0; } /* ▀█████████▄ ▄████████ ▄████████ ...
[["-", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22], ["+", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22]]
1
81
def main(): A, B, C, K = map(int, input().split()) if K <= A: return A elif K <= A+B: return A else: return A - (K-A-B) if __name__ == '__main__': print(main())
def main(): A, B, C, K = map(int, input().split()) if K <= A: return K elif K <= A+B: return A else: return A - (K-A-B) if __name__ == '__main__': print(main())
[["-", 8, 196, 0, 57, 64, 196, 0, 37, 0, 22], ["+", 8, 196, 0, 57, 64, 196, 0, 37, 0, 22]]
5
66
#ABC168-B a, b, c, k = map(int, input().split()) if k <= a: print(k) elif k <= a + b: print(a) else: print(a - c)
#ABC168-B a, b, c, k = map(int, input().split()) if k <= a: print(k) elif k <= a + b: print(a) else: 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, 652, 3, 4, 0, 657, 31, 657, 17, 72], ["+", 0, 652, 3, 4, 0, 657, 31, 657, 12, 22], ["-", 0, 1, 0, 652, 3, 4, 0, 657, 12, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 12, 22]]
5
49
a,b,c,k = map(int,input().split()) if a > k : print(k) elif a+b>=k: print(a) else : print(a+c-k)
a,b,c,k = map(int,input().split()) if a > k : print(k) elif a+b>=k: print(a) else : print(a*2+b-k)
[["+", 3, 4, 0, 657, 31, 657, 31, 657, 17, 48], ["+", 3, 4, 0, 657, 31, 657, 31, 657, 12, 612], ["-", 0, 652, 3, 4, 0, 657, 31, 657, 12, 22], ["+", 0, 652, 3, 4, 0, 657, 31, 657, 12, 22]]
5
50
a, b, c, k = map(int, input().split()) if a + b >= k: if a >= k: print(k) else: print(a) elif a + b < k: print(a-(k-a))
a, b, c, k = map(int, input().split()) if a + b >= k: if a >= k: print(k) else: print(a) elif a + b < k: print(a-(k-(a+b)))
[["+", 0, 657, 12, 23, 0, 657, 12, 23, 0, 24], ["+", 12, 23, 0, 657, 12, 23, 0, 657, 17, 72], ["+", 12, 23, 0, 657, 12, 23, 0, 657, 12, 22], ["+", 0, 657, 12, 23, 0, 657, 12, 23, 0, 25]]
5
59
a,b,c,k = map(int, input().split()) ans=0 if a>=k: print(a) elif a<k and k-a<=b: print(a) elif a<k and k-a>b: print(a-(k-a-b))
a,b,c,k = map(int, input().split()) ans=0 if a>=k: print(k) elif a<k and k-a<=b: print(a) elif a<k and k-a>b: 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
70
a, b, c, k = map(int, input().split()) ans = 0 ans += min(a, k) ans -= min(c, k - a - b) print(ans)
a, b, c, k = map(int, input().split()) ans = 0 ans += min(a, k) ans -= max(0, k - a - b) print(ans)
[["-", 0, 656, 0, 1, 0, 677, 12, 652, 63, 22], ["+", 0, 656, 0, 1, 0, 677, 12, 652, 63, 22], ["-", 0, 1, 0, 677, 12, 652, 3, 4, 0, 22], ["+", 0, 1, 0, 677, 12, 652, 3, 4, 0, 612]]
5
47
#include <bits/stdc++.h> #define FAST_IO \ ios::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0) #define int long long int using names...
#include <bits/stdc++.h> #define FAST_IO \ ios::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0) #define int long long int using names...
[["-", 0, 16, 31, 16, 12, 2, 3, 4, 0, 22], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 22]]
1
114
package main import "fmt" func main() { var a, b, c, k int fmt.Scanf("%d %d %d %d", &a, &b, &c, &k) if a >= k { fmt.Println(a) } else if a+b >= k { fmt.Println(a) } else { fmt.Println(a - (k - a - b)) } }
package main import "fmt" func main() { var a, b, c, k int fmt.Scanf("%d %d %d %d", &a, &b, &c, &k) if a >= k { fmt.Println(k) } else if a+b >= k { fmt.Println(a) } else { fmt.Println(a - (k - a - b)) } }
[["-", 64, 196, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 36, 36, 36, 36, 36, 36, 0, 434, 0, 165]]
7
93
numbers = input().split(" ") a = int(numbers[0]) b = int(numbers[1]) c = int(numbers[2]) k = int(numbers[3]) ans = 0 if k > a and k-a > b: ans = a + (k - a - b) * -1 elif k >= a: ans = a else: ans = a-k print(ans)
numbers = input().split(" ") a = int(numbers[0]) b = int(numbers[1]) c = int(numbers[2]) k = int(numbers[3]) ans = 0 if k > a and k-a > b: ans = a + (k - a - b) * -1 elif k >= a: ans = a else: ans = k print(ans)
[["-", 8, 196, 0, 1, 0, 662, 12, 657, 31, 22], ["-", 8, 196, 0, 1, 0, 662, 12, 657, 17, 33]]
5
95
#include <bits/stdc++.h> using namespace std; using namespace __detail; typedef long long ll; #define ar array #define vi vector<int> #define vvi vector<vector<int>> #define vll vector<long long> #define fork(i, n) for (ll i = 0; i < (n); i++) #define forn for (ll i = 0; i < (n); i++) #define fori(i, k, n) for (ll i =...
#include <bits/stdc++.h> using namespace std; using namespace __detail; typedef long long ll; #define ar array #define vi vector<int> #define vvi vector<vector<int>> #define vll vector<long long> #define fork(i, n) for (ll i = 0; i < (n); i++) #define forn for (ll i = 0; i < (n); i++) #define fori(i, k, n) for (ll i =...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
441
#include <bits/stdc++.h> using namespace std; using namespace __detail; typedef long long ll; #define ar array #define vi vector<int> #define vvi vector<vector<int>> #define vll vector<long long> #define fork(i, n) for (ll i = 0; i < (n); i++) #define forn for (ll i = 0; i < (n); i++) #define fori(i, k, n) for (ll i =...
#include <bits/stdc++.h> using namespace std; using namespace __detail; typedef long long ll; #define ar array #define vi vector<int> #define vvi vector<vector<int>> #define vll vector<long long> #define fork(i, n) for (ll i = 0; i < (n); i++) #define forn for (ll i = 0; i < (n); i++) #define fori(i, k, n) for (ll i =...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["-", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22], ["+", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22]]
1
429
a, b, c, k = 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 = map(int, input().split()) if k <= a: print(k) elif a < k <= (a + b): print(a) else: print(2*a-k+b)
[["-", 36, 36, 36, 36, 0, 656, 0, 57, 0, 121], ["+", 36, 36, 0, 656, 0, 57, 75, 665, 0, 683]]
5
56
a, b, c, k = map(int,input().split()) if a <= k <= a + b: print(a) elif 0 <= k < a: print(k) else: print(a - k * (a + b))
a, b, c, k = map(int,input().split()) if a <= k <= a + b: print(a) elif 0 <= k < a: print(k) else: print(2 * a + b - k)
[["-", 0, 1, 0, 652, 3, 4, 0, 657, 31, 22], ["-", 0, 1, 0, 652, 3, 4, 0, 657, 17, 33], ["-", 0, 652, 3, 4, 0, 657, 12, 657, 31, 22], ["+", 3, 4, 0, 657, 31, 657, 31, 657, 31, 612], ["-", 3, 4, 0, 657, 12, 657, 12, 23, 0, 24], ["-", 3, 4, 0, 657, 12, 657, 12, 23, 0, 25], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 33], ["+", ...
5
58
A, B, C, K = map(int, input().split()) if K <= A: print(A) elif K <= A+B: print(A) elif K <= A+B+C: print(A-(K-A-B))
A, B, C, K = map(int, input().split()) if K <= A: print(K) elif K <= A+B: print(A) elif 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
61
#include <bits/stdc++.h> using namespace std; using ll = long long; #define debug(x) cerr << "[(" << __LINE__ << ") " << (#x) << "]: " << x << endl; int main() { ios::sync_with_stdio(0); cin.tie(0); int a, b, c, k; cin >> a >> b >> c >> k; if (k <= a + b) cout << a << "\n"; else cout << a - (k - ...
#include <bits/stdc++.h> using namespace std; using ll = long long; #define debug(x) cerr << "[(" << __LINE__ << ") " << (#x) << "]: " << x << endl; int main() { ios::sync_with_stdio(0); cin.tie(0); int a, b, c, k; cin >> a >> b >> c >> k; if (k <= a + b) cout << min(a, k) << "\n"; else cout << a...
[["+", 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
90
a, b, c, k = map(int, input().split()) if a >= k: print(k) elif a + b >= k: print(a) else: print(2*a - k - b)
a, b, c, k = map(int, input().split()) if a >= k: print(k) elif a + b >= k: print(a) else: print(2*a - k + b)
[["-", 0, 1, 0, 652, 3, 4, 0, 657, 17, 33], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 72]]
5
52
#include <bits/stdc++.h> using namespace std; #define pii pair<int, int> #define vi vector<int> #define pb push_back #define eb emplace_back #define mp make_pair #define x first #define y second #define sz(x) (x).size() #define all(x) (x).begin(), (x).end() // Forward traversal #define rall(x) (x).rbegin, (x).rend() ...
#include <bits/stdc++.h> using namespace std; #define pii pair<int, int> #define vi vector<int> #define pb push_back #define eb emplace_back #define mp make_pair #define x first #define y second #define sz(x) (x).size() #define all(x) (x).begin(), (x).end() // Forward traversal #define rall(x) (x).rbegin, (x).rend() ...
[["-", 64, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
840
A, B, C, K = map(int, input().split()) print(A+B-max(0, K-A-B))
A, B, C, K = map(int, input().split()) print(min(A, K)-max(0, K-A-B))
[["+", 0, 652, 3, 4, 0, 657, 31, 652, 63, 22], ["+", 3, 4, 0, 657, 31, 652, 3, 4, 0, 24], ["-", 0, 652, 3, 4, 0, 657, 31, 657, 17, 72], ["-", 0, 652, 3, 4, 0, 657, 31, 657, 12, 22], ["+", 3, 4, 0, 657, 31, 652, 3, 4, 0, 21], ["+", 3, 4, 0, 657, 31, 652, 3, 4, 0, 22], ["+", 3, 4, 0, 657, 31, 652, 3, 4, 0, 25]]
5
37
a,b,c,k = (int(x) for x in input().split()) answer = 0 answer += min(a,k) k = k - min(a,k) k = k - min(b-k) answer -= min(c,k) print(answer)
a,b,c,k = (int(x) for x in input().split()) answer = 0 answer += min(a,k) k = k - min(a,k) k = k - min(b,k) answer -= min(c,k) print(answer)
[["-", 12, 657, 12, 652, 3, 4, 0, 657, 17, 33], ["+", 0, 662, 12, 657, 12, 652, 3, 4, 0, 21]]
5
67
#include <algorithm> #include <array> #include <cmath> #include <iomanip> #include <iostream> #include <iterator> #include <map> #include <queue> #include <set> #include <string> typedef long long int ll; using namespace std; #define maxN 200005 #define mod 1000000007 #define pi 3.14159265358979323846264338327950 void...
#include <algorithm> #include <array> #include <cmath> #include <iomanip> #include <iostream> #include <iterator> #include <map> #include <queue> #include <set> #include <string> typedef long long int ll; using namespace std; #define maxN 200005 #define mod 1000000007 #define pi 3.14159265358979323846264338327950 void...
[["-", 0, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 0, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
177
#B A,B,C,K = map(int,input().split()) if A >= K: print(A) else: if B >= K - A: print(A) else: print(A - (K - A - B)) ##A #S = input() #T = input()
#B A,B,C,K = map(int,input().split()) if A >= K: print(K) else: if B >= K - A: print(A) else: print(A - (K - A - B)) ##A #S = input() #T = input()
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
60
a, b, c, k = gets.split(" ").map(&:to_i) if a >= k puts a elsif a + b >= k puts a else puts a - (k - (a + b)) end
a, b, c, k = gets.split(" ").map(&:to_i) if a >= k puts k elsif a + b >= k puts a else puts a - (k - (a + b)) end
[["-", 0, 121, 64, 749, 0, 652, 3, 4, 0, 22], ["+", 0, 121, 64, 749, 0, 652, 3, 4, 0, 22]]
4
50
a, b, c, k = map(int,input().split()) if k < a : print(k) elif k > a and k <= a+b : print(a) else : print(2*a + b - k)
a, b, c, k = map(int,input().split()) if k <= a : print(k) elif k > a and k <= a+b : print(a) else : print(2*a + b - k)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 18], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 19]]
5
56
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); long int a, b, c, k; cin >> a >> b >> c >> k; if (k <= a + b) { cout << k * a << "\n"; } else { cout << a + ((k - a - b) * -1) << "\n"; } return 0; }
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); long int a, b, c, k; cin >> a >> b >> c >> k; if (k <= a + b) { cout << min(k, a) << "\n"; } else { cout << a + ((k - a - b) * -1) << "\n"; } return 0; }
[["+", 0, 1, 0, 16, 31, 16, 12, 2, 63, 22], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 24], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 17, 48], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 21], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 25]]
1
99
A, B, C, K = map(int, input().split()) out = min(A, K) - max(K-A-B, 0)
A, B, C, K = map(int, input().split()) out = min(A, K) - max(K-A-B, 0) print(out)
[["+", 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
39
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner stdIn = new Scanner(System.in); int A = stdIn.nextInt(); int B = stdIn.nextInt(); int C = stdIn.nextInt(); int K = stdIn.nextInt(); int counter = 0; if (A > K) { counter += K; } else ...
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner stdIn = new Scanner(System.in); int A = stdIn.nextInt(); int B = stdIn.nextInt(); int C = stdIn.nextInt(); int K = stdIn.nextInt(); int counter = 0; if (A >= K) { counter += K; } else...
[["-", 8, 196, 0, 57, 15, 15, 0, 16, 17, 47], ["+", 8, 196, 0, 57, 15, 15, 0, 16, 17, 20]]
3
144
#include <algorithm> #include <bits/stdc++.h> using namespace std; typedef long long LL; typedef pair<int, int> pii; typedef pair<LL, LL> pll; typedef pair<string, string> pss; typedef vector<int> vi; typedef vector<string> vs; typedef vector<vi> vvi; typedef vector<pii> vii; typedef vector<LL> vl; typedef vector<vl> ...
#include <algorithm> #include <bits/stdc++.h> using namespace std; typedef long long LL; typedef pair<int, int> pii; typedef pair<LL, LL> pll; typedef pair<string, string> pss; typedef vector<int> vi; typedef vector<string> vs; typedef vector<vi> vvi; typedef vector<pii> vii; typedef vector<LL> vl; typedef vector<vl> ...
[["-", 0, 57, 75, 76, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 75, 76, 0, 1, 0, 11, 12, 22]]
1
459
#include <bits/stdc++.h> using namespace std; int main() { int A, B, C, K; cin >> A >> B >> C >> K; int B1 = K - A; int C1 = K - B - A; if (B1 < 0) { B1 = 0; } if (C1 < 0) { C1 = 0; } cout << K - C1 << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int A, B, C, K; cin >> A >> B >> C >> K; int B1 = K - A; int C1 = K - B - A; if (B1 < 0) { B1 = 0; } if (C1 < 0) { C1 = 0; } cout << min(A, K) - C1 << endl; return 0; }
[["+", 0, 16, 31, 16, 12, 16, 31, 2, 63, 22], ["+", 31, 16, 12, 16, 31, 2, 3, 4, 0, 24], ["+", 31, 16, 12, 16, 31, 2, 3, 4, 0, 22], ["+", 31, 16, 12, 16, 31, 2, 3, 4, 0, 21], ["+", 31, 16, 12, 16, 31, 2, 3, 4, 0, 25]]
1
82
#include <iomanip> #include <iostream> #include <math.h> #include <string> using namespace std; #define PI 3.14159265358979323846264338327950L int res; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); int A, B, C, K; cin >> A >> B >> C >> K; if (K <= A) { res = A; } else { if (K - A <...
#include <iomanip> #include <iostream> #include <math.h> #include <string> using namespace std; #define PI 3.14159265358979323846264338327950L int res; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); int A, B, C, K; cin >> A >> B >> C >> K; if (K <= A) { res = K; } else { if (K - A <...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22]]
1
119
// コンパイラオプション // インクルード #include <iostream> #include <string> // 名前空間省略 using namespace std; // メイン関数 int main() { // 標準入出力 高速化 ios::sync_with_stdio(false); cin.tie(nullptr); long a, b, c, k; long sum = 0; cin >> a >> b >> c >> k; if (k < a) sum += k; else { sum += a; k -= a; k -= ...
// コンパイラオプション // インクルード #include <iostream> #include <string> // 名前空間省略 using namespace std; // メイン関数 int main() { // 標準入出力 高速化 ios::sync_with_stdio(false); cin.tie(nullptr); long a, b, c, k; long sum = 0; cin >> a >> b >> c >> k; if (k < a) sum += k; else { sum += a; k -= a; k -= ...
[["-", 75, 76, 0, 1, 0, 11, 12, 23, 0, 24], ["-", 0, 1, 0, 11, 12, 23, 0, 16, 31, 22], ["-", 0, 1, 0, 11, 12, 23, 0, 16, 17, 33], ["-", 75, 76, 0, 1, 0, 11, 12, 23, 0, 25]]
1
117
In = list(map(int,input().split())) if In[3]-In[0] <= 0: print(In[0]) elif In[3] - (In[0]+In[1]) <= 0: print(In[0]) else: print(In[0]-(In[3]-In[0]-In[1]))
In = list(map(int,input().split())) if In[3]-In[0] <= 0: print(In[3]) elif In[3] - (In[0]+In[1]) <= 0: print(In[0]) else: print(In[0]-(In[3]-In[0]-In[1]))
[["-", 0, 1, 0, 652, 3, 4, 0, 206, 206, 612], ["+", 0, 1, 0, 652, 3, 4, 0, 206, 206, 612]]
5
90
a = input() A, B, C, K = map(int, a.split()) if A >= K: print(K) elif A + B >= K > A: print(A) else: print(- B - C +K)
a = input() A, B, C, K = map(int, a.split()) if A >= K: print(K) elif A + B >= K > A: print(A) else: print(2 * A + B - K)
[["-", 3, 4, 0, 657, 31, 657, 31, 664, 17, 33], ["+", 3, 4, 0, 657, 31, 657, 31, 657, 31, 612], ["+", 3, 4, 0, 657, 31, 657, 31, 657, 17, 48], ["+", 3, 4, 0, 657, 31, 657, 31, 657, 12, 22], ["+", 0, 652, 3, 4, 0, 657, 31, 657, 17, 72], ["-", 0, 652, 3, 4, 0, 657, 31, 657, 12, 22], ["-", 0, 1, 0, 652, 3, 4, 0, 657, 17, ...
5
56
#include <iostream> using namespace std; int main() { unsigned long long int a, b, c, k; cin >> a >> b >> c >> k; if ((k - a) <= 0) cout << k; else { if ((k - a - b) <= 0) cout << a; else cout << a - (k - a - b); } return 0; }
#include <iostream> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; if ((k - a) <= 0) cout << k; else { if ((k - a - b) <= 0) cout << a; else cout << a - (k - a - b); } return 0; }
[["-", 0, 14, 8, 9, 0, 43, 39, 86, 0, 87], ["-", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]]
1
83
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <vector> using namespace std; typedef long long ll; int main() { ll a, b, c, d; cin >> a >> b >> c >> d; if (a >= d) { cout << a << endl; } else { if (a + b >= d) { ...
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <vector> using namespace std; typedef long long ll; int main() { ll a, b, c, d; cin >> a >> b >> c >> d; if (a >= d) { cout << d << endl; } else { if (a + b >= d) { ...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
104
#include <algorithm> #include <iostream> #include <string.h> using namespace std; int main() { int A, B, C, K, sum = 0; cin >> A >> B >> C >> K; if (A >= K) sum = A; else if (A < K) { sum = A; K = K - A; if (B < K) { K = K - B; sum = sum - K; } } cout << sum; }
#include <algorithm> #include <iostream> #include <string.h> using namespace std; int main() { long long A, B, C, K, sum = 0; cin >> A >> B >> C >> K; if (A >= K) sum = K; else if (A < K) { sum = A; K = K - A; if (B < K) { K = K - B; sum = sum - K; } } cout << sum; }
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 8, 9, 0, 57, 64, 1, 0, 11, 12, 22], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 12, 22]]
1
92
a,b,c,k=map(int,input().split()) if k<=a: print(k) elif k>a and k<=a+b: print(a) else: print(2*a+b-4)
a,b,c,k=map(int,input().split()) if k<=a: print(k) elif k>a and k<=a+b: print(a) else: print(2*a+b-k)
[["-", 0, 1, 0, 652, 3, 4, 0, 657, 12, 612], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 12, 22]]
5
56
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, k, n = 0; cin >> a >> b >> c >> k; if (k > a) { n += a; k -= a; if (k >= b) { k -= b; if (k != 0) { n -= k; } } } else { n += a; } cout << n; }
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, k, n = 0; cin >> a >> b >> c >> k; if (k > a) { n += a; k -= a; if (k >= b) { k -= b; if (k != 0) { n -= k; } } } else { n += k; } cout << n; }
[["-", 75, 76, 0, 9, 0, 1, 0, 11, 12, 22], ["+", 75, 76, 0, 9, 0, 1, 0, 11, 12, 22]]
1
86
a, b, c, k = map(int, input().split()) if a >= k: ans = a elif a < k and a + b >= k: ans = a elif a + b < k and a + b + c >= k: ans = a - (k - a - b) else: ans = a - c print(ans)
a, b, c, k = map(int, input().split()) if a >= k: ans = k elif a < k and a + b >= k: ans = a elif a + b < k and a + b + c >= k: ans = a - (k - a - b) else: ans = a - c print(ans)
[["-", 0, 57, 64, 196, 0, 1, 0, 662, 12, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 12, 22]]
5
79
n = list(map(int,input().split())) if n[0] >= n[3]: print(n[3]) elif n[0]+n[1] >= n[3]: print(n[3]) else: print(n[0] - (n[3]-(n[0]+n[1])))
n = list(map(int,input().split())) if n[0] >= n[3]: print(n[3]) elif n[0]+n[1] >= n[3]: print(n[0]) else: print(n[0] - (n[3]-(n[0]+n[1])))
[["-", 0, 1, 0, 652, 3, 4, 0, 206, 206, 612], ["+", 0, 1, 0, 652, 3, 4, 0, 206, 206, 612]]
5
86
#include <bits/stdc++.h> using namespace std; #define DBG(x) \ (void)(cout << "L" << __LINE__ << ": " << #x << " = " << (x) << '\n') typedef long long ll; const int INF = 0x3f3f3f3f; const int maxn = 110000; int main() { ios::sync_with_stdio(false); ...
#include <bits/stdc++.h> using namespace std; #define DBG(x) \ (void)(cout << "L" << __LINE__ << ": " << #x << " = " << (x) << '\n') typedef long long ll; const int INF = 0x3f3f3f3f; const int maxn = 110000; int main() { ios::sync_with_stdio(false); ...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
143
a,b,c,k=(map(int,input().split())) if k>=a: if b>=(k-a): print(a) else: rem=k-(a+b) print(a-rem)
a,b,c,k=(map(int,input().split())) if k>=a: if b>=(k-a): print(a) else: rem=k-(a+b) print(a-rem) else: print(k)
[["+", 36, 36, 0, 656, 0, 57, 75, 76, 0, 95], ["+", 36, 36, 0, 656, 0, 57, 75, 76, 0, 102], ["+", 75, 76, 8, 196, 0, 1, 0, 652, 63, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
57
A,B,C,K = map(int, input().split()) if A >= K or A+B >= K: print(A) else: print(A - (K - A - B))
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, 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
49
A, B, C, K = map(int, input().split()) print(min(A, K) - min(0, K - A - B))
A, B, C, K =map(int, input().split()) print(min(A, K) - max(0, K - A - B))
[["-", 0, 652, 3, 4, 0, 657, 12, 652, 63, 22], ["+", 0, 652, 3, 4, 0, 657, 12, 652, 63, 22]]
5
40
<?php fscanf(STDIN, "%d %d %d %d", $a, $b, $c, $k); if ($k <= $a) { echo $k.PHP_EOL; } elseif ($k <= $a + $b) { echo $a.PHP_EOL; } else { echo $a - ($k - $a - $c).PHP_EOL; }
<?php fscanf(STDIN, "%d %d %d %d", $a, $b, $c, $k); if ($k <= $a) { echo $k.PHP_EOL; } elseif ($k <= $a + $b) { echo $a.PHP_EOL; } else { echo $a - ($k - $a - $b).PHP_EOL; }
[["-", 31, 16, 12, 23, 0, 16, 12, 606, 0, 141], ["+", 31, 16, 12, 23, 0, 16, 12, 606, 0, 141]]
6
77
A, B, C, K = input().split() A, B, C, K = int(A), int(B), int(C), int(K) if K >= A: Anum = A N = K - A else: Anum = K if N >= B: Bnum = B N = N - B else: Bnum = N Cnum = N Total = Anum * 1 + Bnum * 0 + Cnum * (-1) print(Total)
A, B, C, K = input().split() A, B, C, K = int(A), int(B), int(C), int(K) if K >= A: Anum = A N = K - A else: Anum = K N = 0 if N >= B: Bnum = B N = N - B else: Bnum = N N = 0 Cnum = N Total = Anum * 1 + Bnum * 0 + Cnum * (-1) print(Total)
[["+", 75, 76, 8, 196, 0, 1, 0, 662, 31, 22], ["+", 75, 76, 8, 196, 0, 1, 0, 662, 0, 32], ["+", 75, 76, 8, 196, 0, 1, 0, 662, 12, 612], ["+", 75, 76, 8, 196, 0, 1, 0, 662, 12, 22]]
5
101
#include "bits/stdc++.h" using namespace std; const long long inf = 1e9; #define ll long long #define fr(i, a, n) for (int i = a; i < n; i++) #define rfr(i, n, a) for (int i = n; i >= a; i--) #define mp make_pair #define pb push_back #define pii pair<int, int> #define pll pair<ll, ll> #define endl "\n" typedef vector...
#include "bits/stdc++.h" using namespace std; const long long inf = 1e9; #define ll long long #define fr(i, a, n) for (int i = a; i < n; i++) #define rfr(i, n, a) for (int i = n; i >= a; i--) #define mp make_pair #define pb push_back #define pii pair<int, int> #define pll pair<ll, ll> #define endl "\n" typedef vector...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22]]
1
188
# -*- coding:utf-8 -*- def solve(): A, B, C, K = list(map(int, input().split())) if A >= K: print(A) return total = A K -= A if B >= K: print(total) return K -= B total += -K print(total) if __name__ == "__main__": solve()
# -*- coding:utf-8 -*- def solve(): A, B, C, K = list(map(int, input().split())) if A >= K: print(K) return total = A K -= A if B >= K: print(total) return K -= B total += -K print(total) if __name__ == "__main__": solve()
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
76
A, B, C, K = map(int, input().split()) ans = A print(ans - max(K - A - B, 0))
A, B, C, K = map(int, input().split()) ans = min(A, K) print(ans - max(K - A - B, 0))
[["+", 0, 656, 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
38
process.stdin.resume(); process.stdin.setEncoding("utf8"); process.stdin.on("data", input => { const inputs = input.split(" "); const a = Number(inputs[0]); const b = Number(inputs[1]); const c = Number(inputs[2]); const k = Number(inputs[3]); const result = getResult(a, b, c, k); console.log(result); });...
process.stdin.resume(); process.stdin.setEncoding("utf8"); process.stdin.on("data", input => { const inputs = input.split(" "); const a = Number(inputs[0]); const b = Number(inputs[1]); const c = Number(inputs[2]); const k = Number(inputs[3]); const result = getResult(a, b, c, k); console.log(result); });...
[["-", 8, 556, 0, 57, 64, 556, 0, 37, 0, 22], ["+", 8, 556, 0, 57, 64, 556, 0, 37, 0, 22]]
2
169
#include <algorithm> #include <fstream> #include <iostream> #include <iterator> #include <map> #include <math.h> #include <queue> #include <set> #include <string> using namespace std; const int maxn = 2e5 + 5; #define ll long long int main() { int a, b, c, k; cin >> a >> b >> c >> k; ll ans = 0; if (k >= a) { ...
#include <algorithm> #include <fstream> #include <iostream> #include <iterator> #include <map> #include <math.h> #include <queue> #include <set> #include <string> using namespace std; const int maxn = 2e5 + 5; #define ll long long int main() { int a, b, c, k; cin >> a >> b >> c >> k; ll ans = 0; if (k >= a) { ...
[["-", 0, 14, 8, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 22]]
1
123
#include <iostream> #include <queue> #include <string> #include <vector> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; if (k > a + b) { cout << a - (k - a - b) << endl; } else { cout << a << endl; } }
#include <iostream> #include <queue> #include <string> #include <vector> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; if (k > a + b) { cout << a - (k - a - b) << endl; } else { cout << min(a, k) << endl; } }
[["+", 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
70
#include <algorithm> #include <cmath> #include <cstdlib> #include <cstring> #include <ctime> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <vector> // #include <ext/pb_ds/assoc_container.hpp> // #include <ext/pb_ds/tree_policy.hpp> // #define ordered_set...
#include <algorithm> #include <cmath> #include <cstdlib> #include <cstring> #include <ctime> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <vector> // #include <ext/pb_ds/assoc_container.hpp> // #include <ext/pb_ds/tree_policy.hpp> // #define ordered_set...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
272
#include <iostream> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int a, b, c, d; cin >> a >> b >> c >> d; int ans = 0; if (d <= a + b) ans = a; else ans = a - (d - a - b); cout << ans << endl; return 0; }
#include <iostream> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int a, b, c, d; cin >> a >> b >> c >> d; int ans = 0; if (d <= a + b) ans = min(a, d); else ans = a - (d - a - b); cout << ans << endl; return 0; }
[["+", 0, 57, 64, 1, 0, 11, 12, 2, 63, 22], ["+", 64, 1, 0, 11, 12, 2, 3, 4, 0, 24], ["+", 64, 1, 0, 11, 12, 2, 3, 4, 0, 21], ["+", 64, 1, 0, 11, 12, 2, 3, 4, 0, 22], ["+", 64, 1, 0, 11, 12, 2, 3, 4, 0, 25]]
1
91