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 = map(int, input().split()) x = k - a if x <= 0: print(k) else: y = x - b if y <= 0: print(a) else: print(a + ((k - b) * (-1)))
a,b,c,k = map(int, input().split()) x = k - a if x <= 0: print(k) else: y = x - b if y <= 0: print(a) else: print(a + ((k - (a + b)) * (-1)))
[["+", 0, 657, 31, 23, 0, 657, 12, 23, 0, 24], ["+", 31, 23, 0, 657, 12, 23, 0, 657, 31, 22], ["+", 31, 23, 0, 657, 12, 23, 0, 657, 17, 72], ["+", 0, 657, 31, 23, 0, 657, 12, 23, 0, 25]]
5
69
# -*- coding: utf-8 -*- 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-c) else: print(a-(k-(a+b)))
# -*- coding: utf-8 -*- 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-c) 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
76
#include <iostream> using namespace std; int main(void) { int A, B, C, K; cin >> A >> B >> C >> K; if (A >= K) { cout << A << endl; return 0; } if ((A + B) >= K) { cout << A << endl; return 0; } K -= (A + B); cout << A - K << endl; return 0; }
#include <iostream> using namespace std; int main(void) { long long A, B, C, K; cin >> A >> B >> C >> K; if (A >= K) { cout << K << endl; return 0; } if ((A + B) >= K) { cout << A << endl; return 0; } K -= (A + B); cout << A - K << endl; return 0; }
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
89
#include <bits/stdc++.h> using namespace std; #define fast \ ios_base::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0); #define ll long...
#include <bits/stdc++.h> using namespace std; #define fast \ ios_base::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0); #define ll long...
[["+", 0, 57, 64, 9, 0, 1, 0, 16, 12, 22], ["+", 64, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["+", 64, 9, 0, 1, 0, 11, 12, 16, 31, 22], ["+", 64, 9, 0, 1, 0, 11, 12, 16, 17, 33]]
1
135
#include <iostream> using namespace std; int main(int argc, const char *argv[]) { // insert code here... long a, b, c, k; cin >> a >> b >> c >> k; if (k < a) { // All a cout << a << endl; } else // k - a > 0 { // a = a if (k - a <= b) { b = k - a; c = 0; } else // k - a > ...
#include <iostream> using namespace std; int main(int argc, const char *argv[]) { // insert code here... long a, b, c, k; cin >> a >> b >> c >> k; if (k < a) { // All a cout << k << endl; return 0; } else // k - a > 0 { // a = a if (k - a <= b) { b = k - a; c = 0; } el...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["+", 8, 9, 0, 57, 64, 9, 0, 37, 0, 38], ["+", 8, 9, 0, 57, 64, 9, 0, 37, 0, 13]]
1
106
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, c, k, ans = 0; cin >> a >> b >> c >> k; long long total = a + b + c; if (k >= total) cout << a - c << endl; else { int some = 0; some = k - a; if (some > 0) { ans = a; for (long long i = 0; i < some; i++) {...
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, c, k, ans = 0; cin >> a >> b >> c >> k; long long total = a + b + c; if (k >= total) cout << a - c << endl; else { int some = 0; some = k - a; if (some > 0) { ans = a; for (long long i = 0; i < some; i++) {...
[["-", 0, 57, 75, 76, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 75, 76, 0, 1, 0, 11, 12, 22]]
1
142
a = list(map(int,input().split())) sum = 0 a_3 = a[3] a_0 = a[0] a_1 = a[1] a_2 = a[2] if a_3 <= a_0: print (a_3) elif a_3 > a_0 and a_3 <= (a_0 + a_1): print (a_0) else: sum = a_0 - (a_2 - a_1) print(sum)
a = list(map(int,input().split())) sum = 0 a_3 = a[3] a_0 = a[0] a_1 = a[1] a_2 = a[2] if a_3 <= a_0: print (a_3) elif a_3 > a_0 and a_3 <= (a_0 + a_1): print (a_0) else: sum = a_0 - (a_3 - a_0 - a_1) print(sum)
[["-", 0, 662, 12, 657, 12, 23, 0, 657, 31, 22], ["+", 12, 657, 12, 23, 0, 657, 31, 657, 31, 22], ["+", 12, 657, 12, 23, 0, 657, 31, 657, 17, 33], ["+", 12, 657, 12, 23, 0, 657, 31, 657, 12, 22]]
5
85
#include <bits/stdc++.h> #define ln '\n' #define all(dat) dat.begin(), dat.end() #define loop(i, to) for (int i = 0; i < to; ++i) #define cont(i, to) for (int i = 1; i <= to; ++i) #define circ(i, fm, to) for (int i = fm; i <= to; ++i) #define foreach(i, dat) \ f...
#include <bits/stdc++.h> #define ln '\n' #define all(dat) dat.begin(), dat.end() #define loop(i, to) for (int i = 0; i < to; ++i) #define cont(i, to) for (int i = 1; i <= to; ++i) #define circ(i, fm, to) for (int i = fm; i <= to; ++i) #define foreach(i, dat) \ f...
[["+", 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
116
a, b, c, k = map(int, input().split()) a_times = 0 b_times = 0 c_times = 0 if a <= k: a_times = a # print('a_times = ', a_times) if a_times + b <= k: b_times = b # print('if - b_times = ', b_times) else: b_times = k - a_times - b # print('else - b_times = ', b_times) ...
a, b, c, k = map(int, input().split()) a_times = 0 b_times = 0 c_times = 0 if a <= k: a_times = a # print('a_times = ', a_times) if a_times + b <= k: b_times = b # print('if - b_times = ', b_times) else: b_times = k - a_times # print('else - b_times = ', b_times) if...
[["-", 8, 196, 0, 1, 0, 662, 12, 657, 17, 33], ["-", 8, 196, 0, 1, 0, 662, 12, 657, 12, 22]]
5
102
#include <bits/stdc++.h> #define rep(i, a, b) for (int i = a; i < b; i++) #define rrep(i, a, b) for (int i = a; i >= b; i--) // #define fore(i,a) for(auto &i:a) // #define all(x) (x).begin(),(x).end() // #pragma GCC optimize ("-O3") // using namespace std; void _main(); int main() { cin.tie(0); // ios::sync_with_stdio(...
#include <bits/stdc++.h> #define rep(i, a, b) for (int i = a; i < b; i++) #define rrep(i, a, b) for (int i = a; i >= b; i--) // #define fore(i,a) for(auto &i:a) // #define all(x) (x).begin(),(x).end() // #pragma GCC optimize ("-O3") // using namespace std; void _main(); int main() { cin.tie(0); // ios::sync_with_stdio(...
[["-", 75, 76, 0, 9, 0, 1, 0, 11, 12, 22], ["+", 75, 76, 0, 9, 0, 1, 0, 11, 12, 22]]
1
137
A, B, C, K = map(int, input().split()) if A >= K: print(A) exit() else: K -= A if B >= K: print(A) exit() else: K -= B if K <= C: A -= 1*K print(A)
A, B, C, K = map(int, input().split()) if A >= K: print(K) exit() else: K -= A if B >= K: print(A) exit() else: K -= B if K <= C: A -= 1*K print(A)
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
68
/// Coded by Dhiman Sarker Bappi (Dhimanda) - RMSTU #include <bits/stdc++.h> using namespace std; #define ll long long void dhimanda(); int main() { ll a, b, c, k; cin >> a >> b >> c >> k; if (k <= a) cout << k << endl; else { if (a + b >= k) cout << a << endl; else { ll r = k - (a + b);...
/// Coded by Dhiman Sarker Bappi (Dhimanda) - RMSTU #include <bits/stdc++.h> using namespace std; #define ll long long void dhimanda(); int main() { ll a, b, c, k; cin >> a >> b >> c >> k; if (k <= a) cout << k << endl; else { if (a + b >= k) cout << a << endl; else { ll r = k - (a + b);...
[["-", 0, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
112
import java.util.*; 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(); if (a >= k) { System.out.println(a); } else if (a + b >= k) { System....
import java.util.*; 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(); if (a >= k) { System.out.println(k); } else if (a + b >= k) { System....
[["-", 64, 196, 0, 1, 0, 492, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 492, 3, 4, 0, 22]]
3
137
A, B, C, K= map(int, input().split()) if K-A<=0: print(A) elif K-(A+B)<=0: print(A) elif K-(A+B+C)<=0: print(A-(K-A-B))
A, B, C, K= map(int, input().split()) if K-A<=0: print(K) elif K-(A+B)<=0: print(A) elif K-(A+B+C)<=0: 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
71
import sys A, B, C, K = map(int, input().split()) ans = 0 if K > A: ans = ans + A K = K - A if K > B: K = K - B ans = ans - K print(ans) sys.exit() else: print(ans) sys.exit() else: print(A) sys.exit()
import sys A, B, C, K = map(int, input().split()) ans = 0 if K > A: ans = ans + A K = K - A if K > B: K = K - B ans = ans - K print(ans) sys.exit() else: print(ans) sys.exit() else: print(K) sys.exit()
[["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
86
a,b,c,k=map(int,input().split()) if k<a: print(1*k) elif a<=k<=a+b: print(1*a+0*(k-a)) elif a+b<=k<a+b+c: print(1*a+0*b+(k-a-b)*-1)
a,b,c,k=map(int,input().split()) if k<=a: print(1*k) elif a<=k<=a+b: print(1*a+0*(k-a)) elif a+b<=k<=a+b+c: print(1*a+0*b+(k-a-b)*-1)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 18], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 19], ["-", 0, 656, 0, 57, 75, 665, 15, 666, 667, 18], ["+", 0, 656, 0, 57, 75, 665, 15, 666, 667, 19]]
5
88
#include <iostream> using namespace std; int main() { unsigned int a = 0, b = 0, c = 0; unsigned int k = 1; unsigned int max = 0; cin >> a >> b >> c >> k; if (k >= a) { max = 1 * a; } else { max = 1 * k; } if (k - a >= 0) { max = max + 0 * (k - a); } if (k - a - b >= 0) { max = m...
#include <iostream> using namespace std; int main() { int a = 0, b = 0, c = 0; int k = 1; int max = 0; cin >> a >> b >> c >> k; if (k >= a) { max = 1 * a; } else { max = 1 * k; } if (k - a >= 0) { max = max + 0 * (k - a); } if (k - a - b >= 0) { max = max + (-1) * (k - a - b); ...
[["-", 0, 14, 8, 9, 0, 43, 39, 86, 0, 87]]
1
127
#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 << K << endl; } else { cout << A - K + A + B << 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 << 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
77
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; if (a < k) { if (b < k - a) { cout << a - (k - a - b) << endl; } else { cout << a; } } else { cout << a << endl; } }
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; if (a < k) { if (b < k - a) { cout << a - (k - a - b) << endl; } else { cout << a << endl; } } else { cout << k << endl; } }
[["+", 75, 76, 0, 9, 0, 1, 0, 16, 17, 151], ["+", 75, 76, 0, 9, 0, 1, 0, 16, 12, 22], ["-", 0, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 0, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
79
A = list(map(int, input().split())) if A[0]>=A[3]: print(A[0]) else: if A[0]+A[1]>=A[3]: print(A[0]) else: print(A[0]-A[3]+A[0]+A[1])
A = list(map(int, input().split())) if A[0]>=A[3]: print(A[3]) else: if A[0]+A[1]>=A[3]: print(A[0]) else: print(A[0]-A[3]+A[0]+A[1])
[["-", 0, 1, 0, 652, 3, 4, 0, 206, 206, 612], ["+", 0, 1, 0, 652, 3, 4, 0, 206, 206, 612]]
5
84
A, B, C, K = list(map(int, input().split())) if K < A: print("1: ", K) elif A <= K <= (A+B): print(A) elif (A+B) < K: print(A - (K - A - B))
A, B, C, K = list(map(int, input().split())) if K < A: print(K) elif A <= K <= (A+B): print(A) elif (A+B) < K: print(A - (K - A - B))
[["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 654], ["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6], ["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 655], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 21]]
5
72
a,b,c,k = map(int,input().split()) k1 = 0 if a >= k: print(k) elif a+b >=k: print(a) elif a+b+c>k: k1 = k - (a+b) print(k1*(-1)+a)
a,b,c,k = map(int,input().split()) k1 = 0 if a >= k: print(k) elif a+b >=k: print(a) elif a+b+c>=k: k1 = k - (a+b) print(k1*(-1)+a)
[["-", 0, 656, 0, 57, 75, 665, 15, 666, 667, 47], ["+", 0, 656, 0, 57, 75, 665, 15, 666, 667, 20]]
5
72
A,B,C,K = list(map(int,input().split())) if K <= A: print(A) elif K <= A+B: print(A) else: print(A-(K-A-B))
A,B,C,K = list(map(int,input().split())) if K <= A: print(K) elif 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]]
5
57
#include <stdio.h> int main() { long long a, b, c, k, output = 0; scanf("%lld%lld%lld%lld", &a, &b, &c, &k); if (a >= k) output = a; else { output += a; if (b >= (k - a)) output += 0; else output -= k - a - b; } printf("%lld", output); return 0; }
#include <stdio.h> int main() { long long a, b, c, k, output = 0; scanf("%lld%lld%lld%lld", &a, &b, &c, &k); if (a >= k) output += k; else { output += a; if (b >= (k - a)) output += 0; else output -= k - a - b; } printf("%lld", output); return 0; }
[["-", 8, 9, 0, 57, 64, 1, 0, 11, 17, 32], ["-", 8, 9, 0, 57, 64, 1, 0, 11, 12, 22], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 17, 107], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 12, 22]]
0
93
#include <stdio.h> int main() { long int A = 0, B = 0, C = 0, K = 0; scanf("%ld %ld %ld %ld", &A, &B, &C, &K); if (K > A) { K = K - A; } else { printf("%ld \n", A); K = 0; } if (K != 0) { if (K > B) { K = K - B; A = A - K; printf("%ld \n", A); } else { printf...
#include <stdio.h> int main() { long int A = 0, B = 0, C = 0, K = 0; scanf("%ld %ld %ld %ld", &A, &B, &C, &K); if (K > A) { K = K - A; } else { printf("%ld \n", K); K = 0; } if (K != 0) { if (K > B) { K = K - B; A = A - K; printf("%ld \n", A); } else { printf...
[["-", 0, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 0, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
0
130
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; int ans = a; int l = k - a - b; if (l > 0) { ans -= l; } cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; int ans = k < a ? k : a; int l = k - a - b; if (l > 0) { ans -= l; } cout << ans << endl; }
[["+", 0, 43, 49, 50, 51, 41, 15, 16, 31, 22], ["+", 0, 43, 49, 50, 51, 41, 15, 16, 17, 18], ["+", 0, 43, 49, 50, 51, 41, 15, 16, 12, 22], ["+", 8, 9, 0, 43, 49, 50, 51, 41, 0, 101], ["+", 8, 9, 0, 43, 49, 50, 51, 41, 64, 22], ["+", 8, 9, 0, 43, 49, 50, 51, 41, 0, 102]]
1
63
#!/usr/bin/env python3 def main(): a, b, c, k = map(int, input().split()) ans = a num = a + b if k >= a: print(k) elif num < k: ans -= k - num print(ans) if __name__ == "__main__": main()
#!/usr/bin/env python3 def main(): a, b, c, k = map(int, input().split()) ans = a num = a + b if k <= a: print(int(k)) return elif num < k: ans -= k - num print(ans) if __name__ == "__main__": main()
[["-", 0, 14, 8, 196, 0, 57, 15, 666, 667, 20], ["+", 0, 14, 8, 196, 0, 57, 15, 666, 667, 19], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 652, 3, 4, 0, 652, 63, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25], ["+", 8, 196, 0, 57, 64, 196, 0, 37, 0, 38]]
5
67
a, b, c, k = gets.chomp.split(" ").to_i if a >= k puts k elsif a < k && a + b > k puts a else puts a - ( k - a - b ) end
a, b, c, k = gets.chomp.split(" ").map(&:to_i) if a >= k puts k elsif a < k && a + b > k puts a else puts a - ( k - a - b ) end
[["-", 36, 36, 0, 493, 0, 662, 12, 652, 735, 22], ["+", 36, 36, 0, 493, 0, 662, 12, 652, 735, 22], ["+", 0, 493, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 662, 12, 652, 3, 4, 0, 752, 0, 67], ["+", 0, 662, 12, 652, 3, 4, 0, 752, 0, 753], ["+", 0, 493, 0, 662, 12, 652, 3, 4, 0, 25]]
4
50
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) using ll = long long; #define _GLIBCXX_DEBUG int main() { ll a, b, c, k, ans = 0; cin >> a >> b >> c >> k; if (a < k) { k -= a; ans += a; if (b < k) { k -= b; ans -= k; } } else a...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) using ll = long long; #define _GLIBCXX_DEBUG int main() { ll a, b, c, k, ans = 0; cin >> a >> b >> c >> k; /* if (a >= k) cout << a << endl; else if (a+b >= k) cout << a << endl; else cout << a - (k - ...
[["-", 0, 57, 75, 76, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 75, 76, 0, 1, 0, 11, 12, 22]]
1
94
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); long long int a, b, c, k, ans = 0; cin >> a >> b >> c >> k; if (k >= a) { ans += a; k -= a; if (k >= b) { k -= b; if (k >= 0) ans -= k; } } else { cout << a; ret...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); long long int a, b, c, k, ans = 0; cin >> a >> b >> c >> k; if (k >= a) { ans += a; k -= a; if (k >= b) { k -= b; if (k >= 0) ans -= k; } } else { cout << k; ret...
[["-", 75, 76, 0, 9, 0, 1, 0, 16, 12, 22], ["+", 75, 76, 0, 9, 0, 1, 0, 16, 12, 22]]
1
103
#include <bits/stdc++.h> #define rep(i, s, n) for (int i = s; i < n; ++i) #define drep(i, s, n) for (int i = n; i >= s; --i) #define all(x) (x).begin(), (x).end() #define RALL(a) (a).rbegin(), (a).rend() #define print(x) cout << (x) << endl using namespace std; typedef long long ll; int gcd(int a, int b) { if (a % b...
#include <bits/stdc++.h> #define rep(i, s, n) for (int i = s; i < n; ++i) #define drep(i, s, n) for (int i = n; i >= s; --i) #define all(x) (x).begin(), (x).end() #define RALL(a) (a).rbegin(), (a).rend() #define print(x) cout << (x) << endl using namespace std; typedef long long ll; int gcd(int a, int b) { if (a % b...
[["-", 0, 57, 64, 1, 0, 2, 3, 4, 0, 22], ["+", 0, 57, 64, 1, 0, 2, 3, 4, 0, 22]]
1
389
a, b, c, k = list(map(int, input().split())) s = 0 if k >= a: s = a if (k - a - b) >= 0: s -= k - a - b print(s)
a, b, c, k = list(map(int, input().split())) s = 0 if k >= a: s = a else: s = k if (k - a - b) >= 0: s -= k - a - b print(s)
[["+", 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, 662, 31, 22], ["+", 75, 76, 8, 196, 0, 1, 0, 662, 0, 32], ["+", 75, 76, 8, 196, 0, 1, 0, 662, 12, 22]]
5
56
#include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <cerrno> #include <cfloat> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctype.h> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> ...
#include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <cerrno> #include <cfloat> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctype.h> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> ...
[["+", 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, 22], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 21], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 25]]
1
979
#include <bits/stdc++.h> #define ll long long int using namespace std; int main() { ll n, t, a, b, c, k; cin >> a >> b >> c >> k; if (k <= a) cout << k; else if (k <= a + b) cout << a; else if (k <= a + b + c) cout << a + (k - a - b); else cout << a + c; return 0; }
#include <bits/stdc++.h> #define ll long long int using namespace std; int main() { ll n, t, a, b, c, k; cin >> a >> b >> c >> k; if (k <= a) cout << k; else if (k <= a + b) cout << a; else if (k <= a + b + c) cout << a - (k - a - b); else cout << a + c; return 0; }
[["-", 0, 57, 64, 1, 0, 16, 12, 16, 17, 72], ["+", 0, 57, 64, 1, 0, 16, 12, 16, 17, 33]]
1
94
#include <stdio.h> #include <stdlib.h> int main() { int A, B, C, K; scanf("%i %i %i %i", &A, &B, &C, &K); if (K <= A) { printf("%i\n", (A * 1)); } else if ((K >= A) && (K <= A + B)) { printf("%i\n", ((A * 1) + (K - A) * 0)); } else if ((K >= A + B) && (K <= A + B + C)) { printf("%i\n", ((A * 1) ...
#include <stdio.h> #include <stdlib.h> int main() { int A, B, C, K; scanf("%i %i %i %i", &A, &B, &C, &K); if (K <= A) { printf("%i\n", (K * 1)); } else if ((K >= A) && (K <= A + B)) { printf("%i\n", ((A * 1) + (K - A) * 0)); } else if ((K >= A + B) && (K <= A + B + C)) { printf("%i\n", ((A * 1) ...
[["-", 0, 2, 3, 4, 0, 23, 0, 16, 31, 22], ["+", 0, 2, 3, 4, 0, 23, 0, 16, 31, 22]]
0
165
a,b,c,k = map(int,input().split()) ans = 0 kk=k-a for i in range(1): if kk<0: ans=a k=-1 break else: ans = a k=k-a kk = k-b if kk<0: k=-1 break else: k=k-b kk = k-c if kk<0: ans=ans-k elif kk>=0: ans=ans-c...
a,b,c,k = map(int,input().split()) ans = 0 kk=k-a for i in range(1): if kk<0: ans=k k=-1 break else: ans = a k=k-a kk = k-b if kk<0: k=-1 break else: k=k-b kk = k-c if kk<0: ans=ans-k elif kk>=0: ans=ans-c...
[["-", 0, 57, 64, 196, 0, 1, 0, 662, 12, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 12, 22]]
5
110
#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 - K << 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; }
[["+", 0, 16, 31, 16, 12, 16, 31, 16, 17, 72], ["+", 0, 16, 31, 16, 12, 16, 31, 16, 12, 22]]
1
69
#include <iostream> int main() { unsigned int ABC[3]; unsigned int K; for (int i = 0; i < 3; ++i) { std::cin >> ABC[i]; } std::cin >> K; if (K <= 0) { std::cout << 0 << "\n"; return 0; } int mulNum[3]; mulNum[0] = 1; mulNum[1] = 0; mulNum[2] = -1; unsigned int answer = 0; for (in...
#include <iostream> int main() { int ABC[3]; int K; for (int i = 0; i < 3; ++i) { std::cin >> ABC[i]; } std::cin >> K; if (K <= 0) { std::cout << 0 << "\n"; return 0; } int mulNum[3]; mulNum[0] = 1; mulNum[1] = 0; mulNum[2] = -1; int answer = 0; for (int i = 0; i < 3; ++i) { ...
[["-", 0, 14, 8, 9, 0, 43, 39, 86, 0, 87]]
1
204
a, b, c, k = map(int,input().split()) if a >= k: print(k) else: if k - a >= b: print(a) else: sa = k - a - b ans = a - sa print(ans)
a, b, c, k = map(int,input().split()) if a >= k: print(k) else: if k - a <= b: print(a) else: sa = k - a - b ans = a - sa print(ans)
[["-", 75, 76, 8, 196, 0, 57, 15, 666, 667, 20], ["+", 75, 76, 8, 196, 0, 57, 15, 666, 667, 19]]
5
60
#include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back int main() { int t, n, i, j, c, a, b, k, ss = 0, l, m; cin >> a >> b >> c >> k; if ((k - a) < 0) { ss += (k * 1); cout << ss << endl; return 0; } else { if ((k - a) >= 0) ss += (a * 1); k -= a; ...
#include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back int main() { int t, n, i, j, c, a, b, k, ss = 0, l, m; cin >> a >> b >> c >> k; if ((k - a) < 0) { ss += (k * 1); cout << ss << endl; return 0; } else { if ((k - a) >= 0) ss += (a * 1); k -= a; ...
[["+", 0, 57, 75, 76, 0, 9, 0, 57, 0, 121], ["+", 75, 76, 0, 9, 0, 57, 15, 339, 0, 24], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 75, 76, 0, 9, 0, 57, 15, 339, 0, 25]]
1
128
line1 = input().split() a = int(line1[0]) b = int(line1[1]) c = int(line1[2]) k = int(line1[3]) if a >= k: print(a) elif a + b >= k: print(a) else: print(a - (k - (a + b)))
line1 = input().split() a = int(line1[0]) b = int(line1[1]) c = int(line1[2]) k = int(line1[3]) if a >= k: print(k) elif 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
81
A, B, C, K = map(int, input().split()) if K <= A: print(A) elif K <= A + B: print(A) elif K <= A + B + C: ans = A - (K - A - B) print(str(ans)) else: print(0) # # https://atcoder.jp/contests/abs/tasks/abc081_b # N = int(input()) # A = map(int, input().split()) # min_count = 1000000000000 # fo...
A, B, C, K = map(int, input().split()) if K <= A: print(K) elif K <= A + B: print(A) elif K <= A + B + C: ans = A - (K - A - B) print(str(ans)) else: print(0) # # https://atcoder.jp/contests/abs/tasks/abc081_b # N = int(input()) # A = map(int, input().split()) # min_count = 1000000000000 # fo...
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
86
A,B,C,K = map(int, input().split()) if A>K: print(1*K) elif A<K and B>(K-A): print (1*A) else: print(1*A-1*(K-A-B))
A,B,C,K = map(int, input().split()) if A>=K: print(1*K) elif A<K and B>=(K-A): print (1*A) else: print(1*A-1*(K-A-B))
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20], ["-", 0, 57, 75, 665, 15, 679, 12, 666, 667, 47], ["+", 0, 57, 75, 665, 15, 679, 12, 666, 667, 20]]
5
68
A,B,C,K= map(int, input().split()) if A >= K: print(K) else: ans = A if B >= K-A: print(A) else: print(A-(K-(K-A)))
A,B,C,K= map(int, input().split()) if A >= K: print(K) #print("a") else: ans = A if B >= K-A: print(A) #print("b") else: print(A-(K-(A+B))) #print("c")
[["-", 12, 23, 0, 657, 12, 23, 0, 657, 31, 22], ["-", 12, 23, 0, 657, 12, 23, 0, 657, 17, 33], ["+", 12, 23, 0, 657, 12, 23, 0, 657, 17, 72], ["+", 12, 23, 0, 657, 12, 23, 0, 657, 12, 22]]
5
61
#include <algorithm> #include <functional> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; /* int main(void){ long N,K; vector<int> A; cin >> N >> K; int a...
#include <algorithm> #include <functional> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; /* int main(void){ long N,K; vector<int> A; cin >> N >> K; int a...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
130
#include <bits/stdc++.h> using namespace std; typedef long long ll; using P = pair<ll, ll>; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep1(i, n) for (int i = 1; i <= (int)(n); i++) #define all(x) (x).begin(), (x).end() const ll INF = ll(1e18) + 1; int main() { cin.tie(0); ios::sync_with_stdio(fa...
#include <bits/stdc++.h> using namespace std; typedef long long ll; using P = pair<ll, ll>; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep1(i, n) for (int i = 1; i <= (int)(n); i++) #define all(x) (x).begin(), (x).end() const ll INF = ll(1e18) + 1; int main() { cin.tie(0); ios::sync_with_stdio(fa...
[["-", 75, 76, 0, 9, 0, 1, 0, 11, 12, 22], ["+", 75, 76, 0, 9, 0, 1, 0, 11, 12, 22]]
1
163
a,b,c,k = map(int,input().split()) if a<k: if b<k-a: print(a-(k-a-b)) else: print(k) else: print(k)
a,b,c,k = map(int,input().split()) if a<k: if b<k-a: print(a-(k-a-b)) else: print(a) else: print(k)
[["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
56
#include <bits/stdc++.h> 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 && k - a < b) { cout << a << endl; } else if (k > a + b && k - a - b < c) { cout << a - (k - a - b) << endl; } return 0; }
#include <bits/stdc++.h> using namespace std; int main() { long long int a, b, c, k; cin >> a >> b >> c >> k; if (k <= a) { cout << k << endl; } else if (k > a && k - a <= b) { cout << a << endl; } else if (k > a + b && k - a - b <= c) { cout << a - (k - a - b) << endl; } return 0; }
[["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 18], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 19]]
1
102
def solve(a, b, c, k): point = a more = k - a if more > 0: more -= b if more > 0: point -= more print(point) a, b, c, k = map(int, open(0).read().split()) solve(a, b, c, k)
def solve(a, b, c, k): point = min(a, k) more = k - a if more > 0: more -= b if more > 0: point -= more print(point) a, b, c, k = map(int, open(0).read().split()) solve(a, b, c, k)
[["+", 8, 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
75
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; if (k <= a) cout << k << endl; if (a < k && k <= a + b) cout << a << endl; if (a + b < k && k < a + b + c) cout << a + a + b - k << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; if (k <= a) cout << k << endl; if (a < k && k <= a + b) cout << a << endl; if (a + b < k && k <= a + b + c) cout << a + a + b - k << endl; }
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 18], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 19]]
1
89
#include <bits/stdc++.h> #define ll long long #define MOD 10e9 + 7 #define pb push_back #define vll vector<long long> #define vi vector<int> #define vl vector<long> #define pii pair<int, int> #define all(a) (a).begin(), (a).end() #define rep(i, a, b) for (int i = a; i < b; i++) #define MAX 100002 #define ios ...
#include <bits/stdc++.h> #define ll long long #define MOD 10e9 + 7 #define pb push_back #define vll vector<long long> #define vi vector<int> #define vl vector<long> #define pii pair<int, int> #define all(a) (a).begin(), (a).end() #define rep(i, a, b) for (int i = a; i < b; i++) #define MAX 100002 #define ios ...
[["-", 8, 9, 0, 57, 64, 1, 0, 16, 12, 22], ["+", 8, 9, 0, 57, 64, 1, 0, 16, 12, 22]]
1
128
body_1,body_2,body_3,cards=map(int,input().split()) total=0 sa=cards-body_1-body_2 if body_1>=cards: total=body_1 elif body_1<cards: if (body_1+body_2)>=cards: total=body_1 else: total=body_1-sa print(total)
body_1,body_2,body_3,cards=map(int,input().split()) total=0 sa=cards-body_1-body_2 if body_1>=cards: total=cards elif body_1<cards: if (body_1+body_2)>=cards: total=body_1*1 else: total=body_1-sa print(total)
[["-", 0, 57, 64, 196, 0, 1, 0, 662, 12, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 12, 22], ["+", 64, 196, 0, 1, 0, 662, 12, 657, 17, 48], ["+", 64, 196, 0, 1, 0, 662, 12, 657, 12, 612]]
5
66
#include <bits/stdc++.h> #define ll long long #define max(a, b) (a > b ? a : b) #define min(a, b) (a < b ? a : b) #define endl '\n' #define FAST \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); ...
#include <bits/stdc++.h> #define ll long long #define max(a, b) (a > b ? a : b) #define min(a, b) (a < b ? a : b) #define endl '\n' #define FAST \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); ...
[["+", 0, 14, 8, 9, 0, 57, 64, 9, 0, 45], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 14, 8, 9, 0, 57, 64, 9, 0, 46]]
1
123
a,b,c,k=map(int,input().split()) if int(a) >= int(k): print(int(a)) elif int(a + b) >= int(k): print(int(a)) else: print(int(a - (k-a-b)))
a,b,c,k=map(int,input().split()) if int(a) >= int(k): print(int(k)) elif int(a + b) >= int(k): print(int(a)) else: print(int(a - (k-a-b)))
[["-", 0, 652, 3, 4, 0, 652, 3, 4, 0, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 22]]
5
75
#include <bits/stdc++.h> using namespace std; int main() { long long 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; int main() { long long 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; }
[["+", 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
64
from sys import stdin A, B, C, K = [int(x) for x in stdin.readline().rstrip().split()] if K-A == 0: print(A) elif K-A > 0: if K-A-B <= 0: print(A) else: print(int(A+(K-A-B)*-1))
from sys import stdin A, B, C, K = [int(x) for x in stdin.readline().rstrip().split()] if K-A <= 0: print(K) elif K-A > 0: if K-A-B <= 0: print(A) else: print(int(A+(K-A-B)*-1))
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 60], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 19], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
85
#include <bits/stdc++.h> using namespace std; inline int read() { int n = 0; bool b = 0; char c = getchar(); while (c < '0' || c > '9') { if (c == '-') b = 1; c = getchar(); } while (c >= '0' && c <= '9') n = (n << 3) + (n << 1) + (c ^ 48), c = getchar(); return b ? -n : n; } int a, b, c...
#include <bits/stdc++.h> using namespace std; inline int read() { int n = 0; bool b = 0; char c = getchar(); while (c < '0' || c > '9') { if (c == '-') b = 1; c = getchar(); } while (c >= '0' && c <= '9') n = (n << 3) + (n << 1) + (c ^ 48), c = getchar(); return b ? -n : n; } int a, b, c...
[["-", 12, 2, 3, 4, 0, 16, 31, 16, 12, 22], ["+", 12, 2, 3, 4, 0, 16, 31, 16, 12, 22], ["-", 12, 16, 12, 2, 3, 4, 0, 16, 12, 22], ["+", 12, 16, 12, 2, 3, 4, 0, 16, 12, 22]]
1
179
#include <algorithm> #include <cmath> #include <iostream> #include <string> #include <vector> using namespace std; int main() { long long A, B, C, K; 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) { K -= (A + B); ...
#include <algorithm> #include <cmath> #include <iostream> #include <string> #include <vector> using namespace std; int main() { long long A, B, C, K; 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) { K -= (A + B); ...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
100
import java.util.Scanner; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); int N = Integer.parseInt(sc.next()); int N2 = Integer.parseInt(sc.next()); int N3 = Integer.parseInt(sc.next()); int N4 = Integer.parseInt(sc.next()); i...
import java.util.Scanner; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); int N = Integer.parseInt(sc.next()); int N2 = Integer.parseInt(sc.next()); int N3 = Integer.parseInt(sc.next()); int N4 = Integer.parseInt(sc.next()); i...
[["-", 0, 1, 0, 492, 3, 4, 0, 16, 31, 22], ["+", 0, 1, 0, 492, 3, 4, 0, 16, 31, 22]]
3
169
#include <bits/stdc++.h> using namespace std; using ll = long long; #define MOD_NUMBER 1000000007 // ベクトル要素の列挙 template <class T> void vector_print(vector<T> vec) { for (unsigned int i = 0; i < vec.size(); i++) { cout << vec.at(i); if (i < vec.size() - 1) { cout << " "; } else if (i == vec.size(...
#include <bits/stdc++.h> using namespace std; using ll = long long; #define MOD_NUMBER 1000000007 // ベクトル要素の列挙 template <class T> void vector_print(vector<T> vec) { for (unsigned int i = 0; i < vec.size(); i++) { cout << vec.at(i); if (i < vec.size() - 1) { cout << " "; } else if (i == vec.size(...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
285
a, b, c, k = map(int, input().split()) if a > k: a = k b = 0 c = 0 if a < k and a+b > k: c = 0 if a+b < k: c = k - a - b sum_a = 1 * a sum_c = -1 * c print(sum_a + sum_c)
a, b, c, k = map(int, input().split()) if a >= k: a = k b = 0 c = 0 if a < k and a+b >= k: c = 0 if a+b < k: c = k - a - b sum_a = 1 * a sum_c = -1 * c print(sum_a + sum_c)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20], ["-", 0, 656, 0, 57, 15, 679, 12, 666, 667, 47], ["+", 0, 656, 0, 57, 15, 679, 12, 666, 667, 20]]
5
79
A, B, C, K = map(int, input().split()) if K <= A: print(A) exit() else: K = K - A if K <= B: print(A) exit() else: K = K - B print(A-K) exit()
A, B, C, K = map(int, input().split()) if K <= A: print(K) exit() else: K = K - A if K <= B: print(A) exit() else: K = K - B print(A-K) exit()
[["-", 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> using namespace std; /// File input & output ///// #define fRead(x) freopen("x.txt", "r", stdin) #define fWrite(x) freopen("x.txt", "w", stdout) #define mt make_tuple #define ld long double #define ll long long #define ull unsigned long long #define ff first #define ss second #define pb push_...
#include <bits/stdc++.h> using namespace std; /// File input & output ///// #define fRead(x) freopen("x.txt", "r", stdin) #define fWrite(x) freopen("x.txt", "w", stdout) #define mt make_tuple #define ld long double #define ll long long #define ull unsigned long long #define ff first #define ss second #define pb push_...
[["+", 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
365
a, b, c, k = gets.split.map(&:to_i) total = 0 if a <= k total += a k -= a else total += k puts total exit end if k == 0 || k <= b puts total exit else k -= b end if b == 0 puts total exit end total -= k puts total
a, b, c, k = gets.split.map(&:to_i) total = 0 if a <= k total += a k -= a else total += k puts total exit end if k == 0 || k <= b puts total exit else k -= b end if k == 0 puts total exit end total -= k puts total
[["-", 36, 36, 0, 493, 0, 121, 15, 738, 31, 22], ["+", 36, 36, 0, 493, 0, 121, 15, 738, 31, 22]]
4
67
'use strict' const Main = (input) => { const tmp = input.trim().split(' ') const A = parseInt(tmp[0]) const B = parseInt(tmp[1]) const C = parseInt(tmp[2]) let K = parseInt(tmp[3]) let ans = 0 if (K - A >= 0) { K = K - A ans += 1 * A } else if...
'use strict' const Main = (input) => { const tmp = input.trim().split(' ') const A = parseInt(tmp[0]) const B = parseInt(tmp[1]) const C = parseInt(tmp[2]) let K = parseInt(tmp[3]) let ans = 0 if (K - A >= 0) { K = K - A ans += 1 * A } else if...
[["-", 0, 1, 0, 564, 12, 23, 0, 16, 12, 22], ["+", 0, 1, 0, 564, 12, 23, 0, 16, 12, 22], ["+", 64, 556, 0, 1, 0, 564, 12, 23, 0, 24], ["+", 64, 556, 0, 1, 0, 564, 12, 23, 0, 25]]
2
233
A, B, C, K = map(int,input().split()) n_a = 0 n_b = 0 n_c = 0 if K > A: n_a = A if K-A > B: n_b = B n_c = K-A-B if K-A == 0: n_b = B n_c = 0 if K-A < B: n_b = K-A n_c = 0 if K == A: n_a == K if K < A: n_a == K print(n_a+(-1)*n_c)
A, B, C, K = map(int,input().split()) n_a = 0 n_b = 0 n_c = 0 if K > A: n_a = A if K-A > B: n_b = B n_c = K-A-B if K-A == B: n_b = B n_c = 0 if K-A < B: n_b = K-A n_c = 0 if K == A: n_a = K if K < A: n_a = K print(n_a+(-1)*n_c)
[["-", 0, 57, 64, 196, 0, 57, 15, 666, 0, 612], ["+", 0, 57, 64, 196, 0, 57, 15, 666, 0, 22], ["-", 0, 57, 64, 196, 0, 1, 0, 666, 667, 60], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 0, 32]]
5
109
A,B,C,K=map(int,input().split()) ans=0 if K >= A: ans+=A K-=A A=0 else: ans=A-K*1 K=0 if K >= B: K-=B B=0 else: K=0 if K >= C: ans-=C K-=C C=0 else: ans=ans+K*(-1) C=0 print(ans)
A,B,C,K=map(int,input().split()) ans=0 if K >= A: ans+=A K-=A A=0 else: ans=K*1 K=0 if K >= B: K-=B B=0 else: K=0 if K >= C: ans-=C K-=C C=0 else: ans=ans+K*(-1) C=0 print(ans)
[["-", 8, 196, 0, 1, 0, 662, 12, 657, 31, 22], ["-", 8, 196, 0, 1, 0, 662, 12, 657, 17, 33]]
5
98
#include <bits/stdc++.h> using namespace std; using ll = long long; using ull = long long; int main() { ll A, B, C, K; cin >> A >> B >> C >> K; ll ans = 0; ans += A; K -= A; K -= B; if (K > 0) { ans -= K; } cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; using ll = long long; using ull = long long; int main() { ll A, B, C, K; cin >> A >> B >> C >> K; ll ans = 0; ans += min(A, K); K -= A; K -= B; if (K > 0) { ans -= K; } cout << ans << endl; }
[["+", 8, 9, 0, 1, 0, 11, 12, 2, 63, 22], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 24], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 21], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 22], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 25]]
1
78
#include <stdio.h> int main(void) { int a, b, c, k; int max = 0; scanf("%d %d %d %d", &a, &b, &c, &k); if (k <= a) { max = a; } else if (k <= a + b) { max = a; } else { max = a - (k - (a + b)); } printf("%d\n", max); return 0; }
#include <stdio.h> int main(void) { int a, b, c, k; int max = 0; scanf("%d %d %d %d", &a, &b, &c, &k); if (k <= a) { max = k; } else if (k <= a + b) { max = a; } else { max = a - (k - (a + b)); } printf("%d\n", max); return 0; }
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22]]
0
99
A, B, C, K = map(int, input().split()) if K <= A: print(K) elif A < K <= A + B: print(A) else: print(A+B-C)
A, B, C, K = map(int, input().split()) if K <= A: print(K) elif A < 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, 1, 0, 652, 3, 4, 0, 657, 12, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 12, 22]]
5
52
package main import ( "bufio" "fmt" "log" "os" "strconv" ) func out(x ...interface{}) { fmt.Println(x...) } var sc = bufio.NewScanner(os.Stdin) func getInt() int { sc.Scan() i, e := strconv.Atoi(sc.Text()) if e != nil { log.Fatal(e) } return i } func getString() string { sc.Scan() return sc.Text() }...
package main import ( "bufio" "fmt" "log" "os" "strconv" ) func out(x ...interface{}) { fmt.Println(x...) } var sc = bufio.NewScanner(os.Stdin) func getInt() int { sc.Scan() i, e := strconv.Atoi(sc.Text()) if e != nil { log.Fatal(e) } return i } func getString() string { sc.Scan() return sc.Text() }...
[["+", 3, 4, 0, 16, 31, 16, 12, 16, 31, 433], ["+", 3, 4, 0, 16, 31, 16, 12, 16, 17, 48]]
7
234
#include <bits/stdc++.h> using namespace std; int main(void) { // Your code here! int a, b, c, k; int max = 0; cin >> a >> b >> c >> k; if (a >= k) max = a; else { k -= a; max += a; k -= b; if (k > 0) { max -= min(c, k); } } cout << max << endl; }
#include <bits/stdc++.h> using namespace std; int main(void) { int a, b, c, k; int max = 0; cin >> a >> b >> c >> k; if (a >= k) max = k; else { k -= a; // cout << k << endl; max += a; k -= b; // cout << k << endl; if (k > 0) { max -= min(c, k); // cout << min(c,k) << e...
[["-", 8, 9, 0, 57, 64, 1, 0, 11, 12, 22], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 12, 22]]
1
86
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/detail/standard_policies.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; typedef long long int ll; typedef unsigned long long int ull; typedef tree<int, null_type, less<int>, rb_tree_tag, ...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/detail/standard_policies.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; typedef long long int ll; typedef unsigned long long int ull; typedef tree<int, null_type, less<int>, rb_tree_tag, ...
[["+", 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
261
#include <bits/stdc++.h> #define ll long long int #define ul unsigned long long int #define va vector<long long int> a #define vb vector<long long int> b #define M 1000000007 using namespace std; ll t; void fast() { cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0); } ll power(ll x, ul y, ll p) { ll res = 1...
#include <bits/stdc++.h> #define ll long long int #define ul unsigned long long int #define va vector<long long int> a #define vb vector<long long int> b #define M 1000000007 using namespace std; ll t; void fast() { cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0); } ll power(ll x, ul y, ll p) { ll res = 1...
[["-", 0, 14, 8, 9, 0, 57, 64, 37, 0, 22], ["+", 0, 14, 8, 9, 0, 57, 64, 37, 0, 22]]
1
219
#include <iostream> #include <stdio.h> using namespace std; int main(void) { unsigned long A, B, C, K, i, N; cin >> A; cin >> B; cin >> C; cin >> K; if (A >= K) { N = K; } else { K = K - A; N = A; if (B < K) { N = N - (K - B); } } cout << N; return 0; }
#include <iostream> #include <stdio.h> using namespace std; int main(void) { long long A, B, C, K, i, N; cin >> A; cin >> B; cin >> C; cin >> K; if (A >= K) { N = K; } else { K = K - A; N = A; if (B < K) { N = N - (K - B); } } cout << N; return 0; }
[["-", 0, 14, 8, 9, 0, 43, 39, 86, 0, 87], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]]
1
95
A, B, C, K = map(int, input().split()) P = 0 S = 0 while S==0: P += A K -= A if K < 0: P = K break elif K == 0: break K -= B if K <= 0: break P -= C K -= C if K <= 0: P += abs(K) break S=1 print(P)
A, B, C, K = map(int, input().split()) P = 0 S = 0 while S==0: P += A K -= A if K < 0: P -= abs(K) break elif K == 0: break K -= B if K <= 0: break P -= C K -= C if K <= 0: P += abs(K) break S=1 print(P)
[["-", 0, 57, 64, 196, 0, 1, 0, 662, 0, 32], ["+", 0, 57, 64, 196, 0, 1, 0, 677, 17, 110], ["+", 64, 196, 0, 1, 0, 677, 12, 652, 63, 22], ["+", 0, 1, 0, 677, 12, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 677, 12, 652, 3, 4, 0, 25]]
5
86
abck=list(map(int,input().split())) a=abck[0] b=abck[1] c=abck[2] k=abck[3] if a>=k: print(a) elif a<k: if a+b>=k: print(a) else: print(a-(k-a-b))
abck=list(map(int,input().split())) a=abck[0] b=abck[1] c=abck[2] k=abck[3] if a>=k: print(k) elif a<k: 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
80
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); long long a, b, c, k; cin >> a >> b >> c >> k; if (k <= a + b) { cout << a; return 0; } long long rem = k - a - b; cout << a - rem; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); long long a, b, c, k; cin >> a >> b >> c >> k; if (k <= a + b) { cout << min(a, k); return 0; } long long rem = k - a - b; cout << a - rem; return 0; }
[["+", 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, 21], ["+", 0, 1, 0, 16, 12, 2, 3, 4, 0, 22], ["+", 0, 1, 0, 16, 12, 2, 3, 4, 0, 25]]
1
82
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, c, k; long long ans = 0; cin >> a >> b >> c >> k; if (k <= a) { ans = a; } else if (k <= a + b) { ans = a; } else { ans = a - (k - (a + b)); } cout << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, c, k; long long ans = 0; cin >> a >> b >> c >> k; if (k <= a) { ans = k; } else if (k <= a + b) { ans = a; } else { ans = a - (k - (a + b)); } cout << ans << endl; return 0; }
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22]]
1
91
a,b,c,k = map(int,input().split()) def function(a,b,c,k): count =0 if a>=k: return a else: count =a k =k-a a=0 if b>=k: return count else: k-=b b=0 count-=k return count print(function(a,b,c,k))
a,b,c,k = map(int,input().split()) def function(a,b,c,k): count =0 if a>=k: return k else: count =a k =k-a a=0 if b>=k: return count else: k-=b b=0 count-=k return count print(function(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
88
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, c, k; cin >> a >> b >> c >> k; if (k < a) cout << k; else if (k < a + b) cout << a; else cout << a + b; }
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, c, k; cin >> a >> b >> c >> k; if (k < a) cout << k; else if (k < a + b) cout << a; else cout << 2 * a - k + b; }
[["+", 0, 16, 12, 16, 31, 16, 31, 16, 31, 13], ["+", 0, 16, 12, 16, 31, 16, 31, 16, 17, 48], ["+", 0, 1, 0, 16, 12, 16, 31, 16, 17, 33], ["+", 0, 1, 0, 16, 12, 16, 31, 16, 12, 22]]
1
62
import bisect,collections,copy,heapq,itertools,math,numpy,string import sys from bisect import bisect_left, bisect_right, insort def S(): return sys.stdin.readline().rstrip() def I(): return int(sys.stdin.readline().rstrip()) def MI(): return map(int,sys.stdin.readline().rstrip().split()) def MS(): return map(str,sys.s...
import bisect,collections,copy,heapq,itertools,math,numpy,string import sys from bisect import bisect_left, bisect_right, insort def S(): return sys.stdin.readline().rstrip() def I(): return int(sys.stdin.readline().rstrip()) def MI(): return map(int,sys.stdin.readline().rstrip().split()) def MS(): return map(str,sys.s...
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22], ["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20], ["-", 36, 36, 36, 36, 0, 656, 0, 57, 0, 102], ["-", 0, 656, 0, 57, 64, 196, 0, 57, 0, 121]]
5
222
#include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> typedef long long ll; int main() { ll a, b, c; ll sum = 0; ll k, t; scanf("%lld %lld %lld %lld", &a, &b, &c, &k); if (a >= k) { printf("%lld\n", a); } else { k = k - a; if (b >= k) { printf("%lld\n", a); ...
#include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> typedef long long ll; int main() { ll a, b, c; ll sum = 0; ll k, t; scanf("%lld %lld %lld %lld", &a, &b, &c, &k); if (a >= k) { printf("%lld\n", k); } else { k = k - a; if (b >= k) { printf("%lld\n", a); ...
[["-", 64, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 64, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
0
124
#include <bits/stdc++.h> 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 && K - A <= B) { cout << K << endl; } else { cout << 2 * A - K + B << endl; } }
#include <bits/stdc++.h> 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 && K - A <= B) { cout << A << endl; } else { cout << 2 * A - K + B << endl; } }
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
81
#include <bits/stdc++.h> using namespace std; int main() { long long 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) << endl; } }
#include <bits/stdc++.h> using namespace std; int main() { long long 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) << endl; } }
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
80
#include <bits/stdc++.h> using namespace std; using ll = long long int; using ld = long double; using VI = vector<ll>; using VD = vector<ld>; using VVI = vector<VI>; using VC = vector<char>; using VVC = vector<VC>; using VS = vector<string>; using PLL = pair<ll, ll>; using PLD = pair<ld, ld>; using VPLL = vector<PLL>; ...
#include <bits/stdc++.h> using namespace std; using ll = long long int; using ld = long double; using VI = vector<ll>; using VD = vector<ld>; using VVI = vector<VI>; using VC = vector<char>; using VVC = vector<VC>; using VS = vector<string>; using PLL = pair<ll, ll>; using PLD = pair<ld, ld>; using VPLL = vector<PLL>; ...
[["-", 8, 9, 0, 57, 64, 1, 0, 11, 12, 22], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 12, 22]]
1
593
a, b, c, k = gets.split.map(&:to_i) sum = 0 count = k if count-(a+b)>0 sum=a sum= sum+(count-(a+b))*(-1) else if count-a>0 sum=a elsif count-a==0 sum=a else sum=a end end puts sum
a, b, c, k = gets.split.map(&:to_i) sum = 0 count = k if count-(a+b)>0 sum=a sum= sum+(count-(a+b))*(-1) else if count-a>0 sum=a elsif count-a==0 sum=a else sum=k end end puts sum
[["-", 0, 121, 75, 759, 75, 95, 0, 662, 12, 22], ["+", 0, 121, 75, 759, 75, 95, 0, 662, 12, 22]]
4
81
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; int i = k - a - b; if (a <= k) { cout << k << endl; } else if (a + b >= k) { cout << a << endl; } else { cout << a - i << endl; } return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; int i = k - a - b; if (a >= k) { cout << k << endl; } else if (a + b >= k) { cout << a << endl; } else { cout << a - i << endl; } return 0; }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
85
#include <bits/stdc++.h> #include <iostream> using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; i < n; i++) using P = pair<int, int>; int main() { int64_t a, b, c, k; cin >> a >> b >> c >> k; if (a >= k) { cout << a << endl; } else { if (b >= k - a) { cout << a << endl; ...
#include <bits/stdc++.h> #include <iostream> using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; i < n; i++) using P = pair<int, int>; int main() { int64_t a, b, c, k; cin >> a >> b >> c >> k; if (a >= k) { cout << k << endl; } else { if (b >= k - a) { cout << a << endl; ...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
105
import sys input = sys.stdin.readline import numpy as np A, B, C, K= map(int, input().split()) ans = 0 if A <= K: ans += A K -= A else: ans += K K -= K if (K != 0) and (B <= K): K -= B else: K -= K if (K != 0) and (C <= K): K -= C K -= C else: ans -= K K -= K print(ans)
import sys input = sys.stdin.readline import numpy as np A, B, C, K= map(int, input().split()) ans = 0 if A < K: ans += A K -= A else: ans += K K -= K if (K != 0) and (B < K): K -= B else: K -= K if (K != 0) and (C < K): K -= C K -= C else: ans -= K K -= K print(ans)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 19], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 18], ["-", 0, 57, 15, 679, 12, 23, 0, 666, 667, 19], ["+", 0, 57, 15, 679, 12, 23, 0, 666, 667, 18]]
5
107
#include <stdio.h> int main() { int a, b, c, k; scanf("%d %d %d %d", &a, &b, &c, &k); int d = a + b; int e = k - d; if (k <= a) printf("%d", k); else if (d >= k) printf("%d", a); else printf(a - e); return 0; }
#include <stdio.h> int main() { int a, b, c, k; scanf("%d %d %d %d", &a, &b, &c, &k); int d = a + b; int e = k - d; if (k <= a) printf("%d", k); else if (d >= k) printf("%d", a); else printf("%d", a - e); return 0; }
[["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 62], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 75, 76, 0, 1, 0, 2, 3, 4, 0, 21]]
0
92
a,b,c,k=map(int,input().split()) sm=0 if k<=a: sm=a else: sm+=a k=k-a if k>=b: k=k-b if k!=0: sm-=k print(sm)
a,b,c,k=map(int,input().split()) sm=0 if k<=a: sm=k else: sm+=a k=k-a if k>=b: k=k-b if k!=0: sm-=k print(sm)
[["-", 0, 57, 64, 196, 0, 1, 0, 662, 12, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 12, 22]]
5
63
#include <bits/stdc++.h> using namespace std; int main() { int A, B, C, K; int sum = 0; vector<int> S; cin >> A >> B >> C >> K; if (K > A + B + C) { sum = A - (K - A - B); } else if (K > A + B) sum = A; else sum = K; cout << sum << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int A, B, C, K; int sum = 0; vector<int> S; cin >> A >> B >> C >> K; if (K > A + B) { sum = A - (K - A - B); } else if (K > A) sum = A; else sum = K; cout << sum << endl; }
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 72], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 12, 22]]
1
90
#include <bits/stdc++.h> using namespace std; int main() { long A, B, C, K; cin >> A >> B >> C >> K; int nokori = 0; int owari = 0; nokori = K; if ((nokori - A <= 0) && (owari == 0)) { cout << A << endl; owari = 1; } nokori -= A; if ((nokori - B <= 0) && (owari == 0)) { cout << A << end...
#include <bits/stdc++.h> using namespace std; int main() { int A, B, C, K; cin >> A >> B >> C >> K; int nokori = 0; int owari = 0; nokori = K; if ((nokori - A <= 0) && (owari == 0)) { cout << min(A, nokori) << endl; owari = 1; } nokori -= A; if ((nokori - B <= 0) && (owari == 0)) { cout...
[["-", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 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
131
#include <algorithm> #include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; ++i) #define all(obj) (obj).begin(), (obj).end() using namespace std; typedef long long ll; int main() { ll A, B, C, K; cin >> A >> B >> C >> K; if (A >= K) { cout << A << endl; } else if (A + B >= K) { cout << A << ...
#include <algorithm> #include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; ++i) #define all(obj) (obj).begin(), (obj).end() using namespace std; typedef long long ll; int main() { ll A, B, C, K; cin >> A >> B >> C >> K; if (A >= K) { cout << K << endl; } else if (A + B >= K) { cout << A << ...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
123
(A, B, C, K) = list(map(int, input().split())) items = [ (A, 1), (B, 0), (C, -1) ] _sum = 0 k = K for num_cards, val in items: if num_cards <= k: num = num_cards k -= num_cards else: num = k _sum += (val * num) if k == 0: break print(_sum)
(A, B, C, K) = list(map(int, input().split())) items = [ (A, 1), (B, 0), (C, -1) ] _sum = 0 k = K for num_cards, val in items: if num_cards <= k: num = num_cards k -= num_cards else: num = k k = 0 _sum += (val * num) if k == 0: break print(_sum)
[["+", 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]]
5
93
a,b,c,k=map(int,input().split()) if k<=a: print(1*a) else: if k-a<=b: print(1*a) else: print(1*a-1*(k-a-b))
a,b,c,k=map(int,input().split()) if k<=a: print(1*k) else: if k-a<=b: print(1*a) else: print(1*a-1*(k-a-b))
[["-", 0, 1, 0, 652, 3, 4, 0, 657, 12, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 12, 22]]
5
64
A, B, C, K = map(int, input().split()) if A >= K: print(A) elif A < K and 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 < K and 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
58
def q2(): A, B, C, K = (int(i) for i in input().split()) ans = 0 if K <= A: ans += A return ans else: K -= A ans += A if K <= B: return ans else: K -= B if K <= C: ans -= K return ans else: ans -= C return...
def q2(): A, B, C, K = (int(i) for i in input().split()) ans = 0 if K <= A: ans += K return ans else: K -= A ans += A #print(K, ans) if K <= B: return ans else: K -= B #print(K, ans) if K <= C: ans -= K return ans ...
[["-", 0, 57, 64, 196, 0, 1, 0, 677, 12, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 677, 12, 22]]
5
92
A, B, C, K = map(int,input().split()) if K < A: print(K) elif A < 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 A < 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
54