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 <algorithm> #include <iostream> using namespace std; int main() { long long int a, b, c, k, ans = 0; cin >> a >> b >> c >> k; if (a >= k) { ans += a; } else { ans += a; k -= a; if (b < k) { k -= b; ans -= k; } } cout << ans; }
#include <algorithm> #include <iostream> using namespace std; int main() { long long int a, b, c, k, ans = 0; cin >> a >> b >> c >> k; if (a >= k) { ans += k; } else { ans += a; k -= a; if (b < k) { k -= b; ans -= k; } } cout << ans; }
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22]]
1
82
#include <iostream> #include <string> using namespace std; int main() { long long int a, b, c, k, ans = 0; cin >> a >> b >> c >> k; if (a < k) { ans += a; k -= a; } else { cout << k; return 0; } if (b < k) k -= b; else { cout << ans; return 0; } cout << ans - c; }
#include <iostream> #include <string> using namespace std; int main() { long long int a, b, c, k, ans = 0; cin >> a >> b >> c >> k; if (a < k) { ans += a; k -= a; } else { cout << k; return 0; } if (b < k) k -= b; else { cout << ans; return 0; } cout << ans - k; }
[["-", 8, 9, 0, 1, 0, 16, 12, 16, 12, 22], ["+", 8, 9, 0, 1, 0, 16, 12, 16, 12, 22]]
1
91
import sys input=sys.stdin.readline def main(): a,b,c,k = map(int, input().split()) if a >= k: print(a) else: # aより多い k -= a if b >= k: print(a) else: k -= b print(a-k) if __name__=="__main__": main()
import sys input=sys.stdin.readline def main(): a,b,c,k = map(int, input().split()) if a >= k: print(k) else: # aより多い k -= a if b >= k: print(a) else: k -= b print(a-k) if __name__=="__main__": main()
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
79
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))
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, 666, 667, 19], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20], ["-", 0, 656, 0, 57, 75, 665, 15, 666, 667, 19], ["+", 0, 656, 0, 57, 75, 665, 15, 666, 667, 20]]
5
54
A, B, C, K = map(int, input().split()) D = A + B if D >= K: print(A) else: K -= D print(A-K)
A, B, C, K = map(int, input().split()) D = A + B if D >= K: print(min(K,A)) else: K -= D print(A-K)
[["+", 0, 1, 0, 652, 3, 4, 0, 652, 63, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 21], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
45
a, b, c, k = list(map(int, input().split())) if k <= a or 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))
[["-", 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
52
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, a, b) for (int i = a; i < b; i++) ll a, b, c, k; int main() { cin >> a >> b >> c >> k; ll ans = 0; if (k >= a) { ans += a; k -= a; } else { ans += k; k = 0; } // cout << k << endl; if (k >= b) { k -= ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, a, b) for (int i = a; i < b; i++) ll a, b, c, k; int main() { cin >> a >> b >> c >> k; ll ans = 0; if (k >= a) { ans += a; k -= a; } else { ans += k; k = 0; } // cout << k << endl; if (k >= b) { k -= ...
[["-", 64, 9, 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], ["-", 64, 9, 0, 1, 0, 11, 12, 23, 0, 25]]
1
135
#In[]: a,b,c,k = map(int,input().split()) ans = 0 ans += min(a,k) k -= min(a,k) ans += min(b,k) k -= min(b,k) ans += min(c,k) k -= min(c,k) print(ans)
#In[]: a,b,c,k = map(int,input().split()) ans = 0 ans += min(a,k) k -= min(a,k) ans += min(b,k) * 0 k -= min(b,k) ans += min(c,k) * -1 k -= min(c,k) print(ans)
[["+", 0, 656, 0, 1, 0, 677, 12, 657, 17, 48], ["+", 0, 656, 0, 1, 0, 677, 12, 657, 12, 612], ["+", 0, 1, 0, 677, 12, 657, 12, 664, 17, 33], ["+", 0, 1, 0, 677, 12, 657, 12, 664, 28, 612]]
5
76
#include <bits/stdc++.h> using namespace std; #define Hello \ ios_base::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0); #define endl '\n...
#include <bits/stdc++.h> using namespace std; #define Hello \ ios_base::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0); #define endl '\n...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22], ["+", 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
74
#include <bits/stdc++.h> using namespace std; #define IOS \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL); #define rep(i...
#include <bits/stdc++.h> using namespace std; #define IOS \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL); #define rep(i...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40]]
1
299
#!/usr/bin/env python3 # Generated by https://github.com/kyuridenamida/atcoder-tools from typing import * import itertools import math import sys INF = float('inf') def solve(A: int, B: int, C: int, K: int): return A - max(K-A-B, 0) def main(): sys.setrecursionlimit(10 ** 6) def iterate_tokens(): ...
#!/usr/bin/env python3 # Generated by https://github.com/kyuridenamida/atcoder-tools from typing import * import itertools import math import sys INF = float('inf') def solve(A: int, B: int, C: int, K: int): return min(K, A) - max(K-A-B, 0) def main(): sys.setrecursionlimit(10 ** 6) def iterate_token...
[["+", 8, 196, 0, 37, 0, 657, 31, 652, 63, 22], ["+", 0, 37, 0, 657, 31, 652, 3, 4, 0, 24], ["+", 0, 37, 0, 657, 31, 652, 3, 4, 0, 22], ["+", 0, 37, 0, 657, 31, 652, 3, 4, 0, 21], ["+", 0, 37, 0, 657, 31, 652, 3, 4, 0, 25]]
5
157
import sys ans=0 A, B, C, K = (int(x) for x in input().split()) if A>K: print(K) sys.exit(0) else: K-=A ans+=A if B>K: print(K) sys.exit(0) else:K-=B if C>K: print(ans-K) sys.exit() else: ans-=C print(ans)
import sys ans=0 A, B, C, K = (int(x) for x in input().split()) if A>K: print(K) sys.exit(0) else: K-=A ans+=A if B>K: print(ans) sys.exit(0) else:K-=B if C>K: print(ans-K) sys.exit() else: ans-=C print(ans)
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
97
a,b,c,k = map(int,input().split()) s=0 s += a s -= (k-a-b) if k > a+b else 0 print(s)
a,b,c,k = map(int,input().split()) s=0 s += k if a > k else a s -= (k-a-b) if k > a+b else 0 print(s)
[["+", 0, 656, 0, 1, 0, 677, 12, 41, 0, 22], ["+", 0, 656, 0, 1, 0, 677, 12, 41, 0, 121], ["+", 0, 1, 0, 677, 12, 41, 0, 666, 0, 22], ["+", 0, 1, 0, 677, 12, 41, 0, 666, 667, 47], ["+", 0, 656, 0, 1, 0, 677, 12, 41, 0, 95]]
5
47
a,b,c,k-map(inat,input().split()) ans=0 ans+=min(k,a) k-=min(k,a) k-=min(k,b) ans-=min(k,c) print(ans)
a,b,c,k=map(int,input().split()) ans=0 ans+=min(k,a) k-=min(k,a) k-=min(k,b) ans-=min(k,c) print(ans)
[["-", 36, 36, 0, 656, 0, 1, 0, 657, 17, 33], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32], ["-", 0, 1, 0, 657, 12, 652, 3, 4, 0, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22]]
5
59
#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() { int a, b, c, k, ans = 0; cin >> a >> b >> c >> k; if (k > a) { k -= a; ans += a; } else { cout << a << endl; return 0; } if (k <= b) {...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; using ll = long long; using P = pair<int, int>; int main() { int a, b, c, k, ans = 0; cin >> a >> b >> c >> k; if (k > a) { k -= a; ans += a; } else { cout << k << endl; return 0; } if (k <= b) {...
[["-", 0, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 0, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
119
#include <bits/stdc++.h> using namespace std; int main(void) { int a, b, c, k; cin >> a >> b >> c >> k; int ca = a; int cc = max(0, k - a - b); int result = ca - cc; cout << result << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main(void) { int a, b, c, k; cin >> a >> b >> c >> k; int ca = min(a, k); int cc = max(0, k - a - b); int result = ca - cc; cout << result << endl; return 0; }
[["+", 8, 9, 0, 43, 49, 50, 51, 2, 63, 22], ["+", 0, 43, 49, 50, 51, 2, 3, 4, 0, 24], ["+", 0, 43, 49, 50, 51, 2, 3, 4, 0, 21], ["+", 0, 43, 49, 50, 51, 2, 3, 4, 0, 22], ["+", 0, 43, 49, 50, 51, 2, 3, 4, 0, 25]]
1
67
a, b, c, k = map(int, input().split()) count = 0 if a < k: count += a if a+b < k: count -= k-a-b else: count = a print(count)
a, b, c, k = map(int, input().split()) count = 0 if a < k: count += a if a+b < k: count -= k-a-b else: count = k print(count)
[["-", 75, 76, 8, 196, 0, 1, 0, 662, 12, 22], ["+", 75, 76, 8, 196, 0, 1, 0, 662, 12, 22]]
5
54
#include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> int main(void) { long A, B, C, K; scanf("%ld", &A); scanf("%ld", &B); scanf("%ld", &C); scanf("%ld", &K); if (K <= A) { printf("%ld\n", A); } else if (K > A && K <= (A + B)) { printf("%ld\n", A); } else { printf(...
#include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> int main(void) { long A, B, C, K; scanf("%ld", &A); scanf("%ld", &B); scanf("%ld", &C); scanf("%ld", &K); if (K < A) { printf("%ld\n", K); } else if (K >= A && K <= (A + B)) { printf("%ld\n", A); } else { printf(...
[["-", 8, 9, 0, 57, 15, 23, 0, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 17, 18], ["-", 64, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 64, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["-", 0, 57, 15, 23, 0, 16, 31, 16, 17, 47], ["+", 0, 57, 15, 23, 0, 16, 31, 16, 17, 20]]
0
135
#include <bits/stdc++.h> using namespace std; long long A, B, C, K; int main() { cin >> A >> B >> C >> K; if (A + B >= K) { cout << K << endl; } else { cout << A - (K - (A + B)) << endl; } }
#include <bits/stdc++.h> using namespace std; long long A, B, C, K; int main() { cin >> A >> B >> C >> K; if (A + B >= K) { cout << min(A, K) << endl; } else { cout << A - (K - (A + B)) << 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, 22], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 21], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 25]]
1
67
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(); if (K >= A && A + B >= K) { System.out.println(A); } else if (K < A) { ...
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(); if (K >= A && A + B >= K) { System.out.println(A); } else if (K < A) { ...
[["+", 0, 492, 3, 4, 0, 16, 12, 23, 0, 24], ["+", 0, 492, 3, 4, 0, 16, 12, 23, 0, 25]]
3
130
a, b, c, k = [int(i) in input().split(" ")] print(min(a, k) - max(0, k-a-b))
a, b, c, k = [int(i) for i in input().split(" ")] print(min(a, k) - max(0, k-a-b))
[["+", 0, 1, 0, 662, 12, 658, 0, 659, 0, 88], ["+", 0, 1, 0, 662, 12, 658, 0, 659, 31, 22]]
5
45
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(); int total = 0; if (a <= k) { total += a; } else { total += k; } ...
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(); int total = 0; if (a <= k) { total += a; } else { total += k; } ...
[["-", 0, 1, 0, 11, 12, 16, 31, 16, 17, 33], ["-", 0, 1, 0, 11, 12, 16, 31, 16, 12, 22], ["-", 64, 196, 0, 1, 0, 11, 12, 16, 17, 33], ["-", 64, 196, 0, 1, 0, 11, 12, 16, 12, 22]]
3
146
#include <iostream> #include <vector> using namespace std; int main() { int a, b, c, d, count = 0, x = 0; cin >> a >> b >> c >> d; if (a > d) { cout << d; } if ((a + b) >= d) { cout << a; } else { cout << a - (d - (a + b)); } }
#include <iostream> #include <vector> using namespace std; int main() { int a, b, c, d, count = 0, x = 0; cin >> a >> b >> c >> d; if (a > d) { cout << d; } else if ((a + b) >= d) { cout << a; } else { cout << a - (d - (a + b)); } }
[["+", 0, 14, 8, 9, 0, 57, 75, 76, 0, 95]]
1
86
a,b,c,k = map(int, input().split()) l = 0 if a >= k: print(a) else: l = a k -= a if b >= k: print(l) else: k -= b print(l-k)
a,b,c,k = map(int, input().split()) l = 0 if a >= k: print(k) else: l = a k -= a if b >= k: print(l) else: k -= b print(l-k)
[["-", 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 = map(int, input().split()) ans = 0 if a >= k: print(a) exit() ans += a k -= a if b >= k: print(ans) exit() k -= b ans -= k print(ans)
a, b, c, k = map(int, input().split()) ans = 0 if a >= k: print(k) exit() ans += a k -= a if b >= k: print(ans) exit() k -= b ans -= k print(ans)
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
63
#include <stdio.h> int main(void) { long a, b, c, k; long ans = 0; scanf("%ld%ld%ld%ld", &a, &b, &c, &k); if (a > k) { ans = k; k = 0; } else { ans = a; k -= a; } if (k > 0) { if (b > k) { k = 0; } else { k -= b; } } if (k > 0) { ans -= c; } printf("%l...
#include <stdio.h> int main(void) { long a, b, c, k; long ans = 0; scanf("%ld%ld%ld%ld", &a, &b, &c, &k); if (a > k) { ans = k; k = 0; } else { ans = a; k -= a; } if (k > 0) { if (b > k) { k = 0; } else { k -= b; } } if (k > 0) ans -= k; printf("%ld", an...
[["-", 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, 1, 0, 11, 12, 22], ["-", 0, 14, 8, 9, 0, 57, 64, 9, 0, 46]]
0
120
#include <bits/stdc++.h> int main() { long long A, B, C, K; std::cin >> A >> B >> C >> K; if (A >= K) { std::cout << A << std::endl; return 0; } else if (K > A && K <= (A + B)) { std::cout << A << std::endl; return 0; } else if (K > (A + B) && K <= (A + B + C)) { std::cout << A - (K - A ...
#include <bits/stdc++.h> int main() { long long A, B, C, K; std::cin >> A >> B >> C >> K; if (A >= K) { std::cout << K << std::endl; return 0; } else if (K > A && K <= (A + B)) { std::cout << A << std::endl; return 0; } else if (K > (A + B) && K <= (A + B + C)) { std::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
128
import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.List; import java.util.NoSuchElementException; public class Main { public static void main(String[] args) { new Main().solve(); pw.close(); } /** ...
import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.List; import java.util.NoSuchElementException; public class Main { public static void main(String[] args) { new Main().solve(); pw.close(); } /** ...
[["-", 8, 196, 0, 1, 0, 11, 12, 492, 141, 22], ["+", 8, 196, 0, 1, 0, 11, 12, 492, 141, 22]]
3
2,404
#include <bits/stdc++.h> using namespace std; int main() { long long int p, q, r, k; cin >> p >> q >> r >> k; if (k <= p) cout << p << endl; else if (k <= (p + q)) cout << p << endl; else cout << p - (k - p - q) << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { long long int p, q, r, k; cin >> p >> q >> r >> k; if (k <= p) cout << k << endl; else if (k <= (p + q)) cout << p << endl; else cout << p - (k - p - q) << endl; return 0; }
[["-", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22], ["+", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22]]
1
80
def main(): a, b, c, k = map(int, input().split()) sum = 0 n = k-a if n <= 0: sum = k print(sum) exit() else: sum = a n =- b if n <= 0: print(sum) exit() n =- c if n <= 0: sum =- (k-a-b) print(sum) exit() ...
def main(): a, b, c, k = map(int, input().split()) sum = 0 n = k-a if n <= 0: sum = k print(sum) exit() else: sum = a n = n-b if n <= 0: print(sum) exit() n = n-c if n <= 0: sum = sum - (k-(a+b)) print(sum) ...
[["+", 8, 196, 0, 1, 0, 662, 12, 657, 31, 22], ["+", 64, 196, 0, 1, 0, 662, 12, 657, 31, 22], ["+", 12, 657, 12, 23, 0, 657, 12, 23, 0, 24], ["-", 0, 662, 12, 664, 28, 23, 0, 657, 17, 33], ["+", 12, 23, 0, 657, 12, 23, 0, 657, 17, 72], ["+", 12, 657, 12, 23, 0, 657, 12, 23, 0, 25]]
5
98
A, B, C, K = map(int, input().split()) if A >= K: print(A) elif A+B >= K and A < K: print(A) elif A+B < K: print(A - (K-A-B))
A, B, C, K = map(int, input().split()) if A >= K: print(K) elif A+B >= K and A < K: print(A) elif A+B < 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
63
A, B, C, K = map(int, input().split()) total = 0 if K <= A: print(A) else: total += A K = K - A if K <= B: print(total) else: K = K - B if K <= C: total -= K print(total) else: total -= C print(total)
A, B, C, K = map(int, input().split()) total = 0 if K <= A: print(K) else: total += A K = K - A if K <= B: print(total) else: K = K - B if K <= C: total -= K print(total) else: total -= C print(total)
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
79
#include <bits/stdc++.h> using namespace std; int main() { int A, B, C, K; cin >> A >> B >> C >> K; if (K <= A) cout << A; else if (K <= A + B) cout << A; else cout << A - (K - A - B); }
#include <bits/stdc++.h> using namespace std; int main() { int A, B, C, K; cin >> A >> B >> C >> K; if (K <= A) cout << K; else if (K <= A + B) cout << A; else cout << A - (K - A - B); }
[["-", 8, 9, 0, 57, 64, 1, 0, 16, 12, 22], ["+", 8, 9, 0, 57, 64, 1, 0, 16, 12, 22]]
1
67
a,b,c,k = map(int,input().split()) ans=0 if a>=k: ans=a else: k-=a if b>=k: ans=a else: k-=b ans=a-k print(ans)
a,b,c,k = map(int,input().split()) ans=0 if a>=k: ans=k else: k-=a if b>=k: ans=a else: k-=b ans=a-k print(ans)
[["-", 0, 57, 64, 196, 0, 1, 0, 662, 12, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 12, 22]]
5
58
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll solve(ll a, ll b, ll c, ll k) { if (k <= a) return a; ll kk = k - a; ll points = a; if (kk <= b) return a; kk -= b; return points - kk; } int main() { ll a, b, c, k; cin >> a >> b >> c >> k; cout << solve(a, b, c, k); }
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll solve(ll a, ll b, ll c, ll k) { if (k <= a) return k; ll kk = k - a; ll points = a; if (kk <= b) return points; kk -= b; return points - kk; } int main() { ll a, b, c, k; cin >> a >> b >> c >> k; cout << solve(a, b, c, ...
[["-", 0, 14, 8, 9, 0, 57, 64, 37, 0, 22], ["+", 0, 14, 8, 9, 0, 57, 64, 37, 0, 22]]
1
105
if __name__ == '__main__': a,b,c,k = map(int,input().split()) ans = 0 if k >= a: k -= a ans += a else: ans += k print(ans) exit() if k >= b: k -= b else: print(ans) exit() if k >= c: ans += c else: ...
if __name__ == '__main__': a,b,c,k = map(int,input().split()) ans = 0 if k >= a: k -= a ans += a else: ans += k print(ans) exit() if k >= b: k -= b else: print(ans) exit() if k >= c: ans += c * (-1) else:...
[["+", 64, 196, 0, 1, 0, 677, 12, 657, 17, 48], ["+", 0, 1, 0, 677, 12, 657, 12, 23, 0, 24], ["+", 0, 677, 12, 657, 12, 23, 0, 664, 17, 33], ["+", 0, 677, 12, 657, 12, 23, 0, 664, 28, 612], ["+", 0, 1, 0, 677, 12, 657, 12, 23, 0, 25]]
5
92
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, c, k; scanf("%lld %lld %lld %lld", &a, &b, &c, &k); long long ans = min(a, k); k -= a; k = k - b; if (k) { ans -= k; } printf("%lld\n", ans); return 0; }
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, c, k; scanf("%lld %lld %lld %lld", &a, &b, &c, &k); long long ans = min(a, k); k -= a; k = k - b; if (k > 0) { ans -= k; } printf("%lld\n", ans); return 0; }
[["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
85
a,b,c,k = map(int,input().split()) if k <= a : print(k) else : m = min(k,a) k -= a if k <= b : print(k) else : n = min(k,b) k -= b l = k print(1*m+(-1)*l)
a,b,c,k = map(int,input().split()) if k <= a : print(k) else : m = min(k,a) k -= a if k <= b : print(a) else : n = min(k,b) k -= b l = k print(1*m+(-1)*l)
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
80
A,B,C,K = list(map(int,input().split())) ans = 0 if A >= 0: ans += A * 1 else: ans += 0 if K - A - B >= 0: ans += (K - A - B) * (-1) else: ans += 0 print(ans)
A,B,C,K = list(map(int,input().split())) ans = 0 if A > K: ans += K * 1 else: ans += A * 1 if K - A - B >= 0: ans += (K - A - B) * (-1) else: ans += 0 print(ans)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20], ["-", 36, 36, 0, 656, 0, 57, 15, 666, 0, 612], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22], ["-", 64, 196, 0, 1, 0, 677, 12, 657, 31, 22], ["+", 64, 196, 0, 1, 0, 677, 12, 657, 31, 22], ["-", 75, 76, 8, 196, 0, 1, 0, 677, ...
5
73
#include "bits/stdc++.h" using namespace std; const int MAX = 700000; const int MOD = 1000000007; long long fac[MAX], finv[MAX], inv[MAX]; // テーブルを作る前処理 void COMinit() { fac[0] = fac[1] = 1; finv[0] = finv[1] = 1; inv[1] = 1; for (int i = 2; i < MAX; i++) { fac[i] = fac[i - 1] * i % MOD; inv[i] = MOD ...
#include "bits/stdc++.h" using namespace std; const int MAX = 700000; const int MOD = 1000000007; long long fac[MAX], finv[MAX], inv[MAX]; // テーブルを作る前処理 void COMinit() { fac[0] = fac[1] = 1; finv[0] = finv[1] = 1; inv[1] = 1; for (int i = 2; i < MAX; i++) { fac[i] = fac[i - 1] * i % MOD; inv[i] = MOD ...
[["-", 12, 16, 12, 16, 12, 2, 3, 4, 0, 22], ["+", 12, 16, 12, 16, 12, 2, 3, 4, 0, 22]]
1
706
A,B,C,K=map(int,input().split()) if A>=K: print(K) elif A+B>=K: print(A) else: print(A+B-1*(K-A-B))
A,B,C,K=map(int,input().split()) if A>=K: print(K) elif B>=K-A: print(A) else: print(A-1*(K-A-B))
[["-", 0, 57, 75, 665, 15, 666, 0, 657, 31, 22], ["-", 0, 57, 75, 665, 15, 666, 0, 657, 17, 72], ["+", 0, 57, 75, 665, 15, 666, 0, 657, 17, 33], ["+", 0, 57, 75, 665, 15, 666, 0, 657, 12, 22], ["-", 0, 652, 3, 4, 0, 657, 31, 657, 17, 72], ["-", 0, 652, 3, 4, 0, 657, 31, 657, 12, 22]]
5
58
#ABC167B a,b,c,d,k = map(int,input().split()) print(min(a,k)-max(k-a-b,0))
#ABC167B a,b,c,k = map(int,input().split()) print(min(a,k)-max(k-a-b,0))
[["-", 0, 656, 0, 1, 0, 662, 31, 684, 0, 22], ["-", 0, 656, 0, 1, 0, 662, 31, 684, 0, 21]]
5
43
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <random> #include <se...
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <random> #include <se...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 64, 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
159
//============================================================================ /* "There is nothing that can take the pain away. But eventually you will find a way to live with it. There will be nightmares. And every day when you wake up, it will be the first thing you...
//============================================================================ /* "There is nothing that can take the pain away. But eventually you will find a way to live with it. There will be nightmares. And every day when you wake up, it will be the first thing you...
[["-", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22], ["+", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22]]
1
1,071
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define inf (ll)(1e18) #define mod 1000000007 int main() { int t = 1; // cin>>t; while (t--) { ll a, b, c, k; cin >> a >> b >> c >> k; if (k <= a) cout << a; else if (k <= a + b) cout << a; else { ll ans =...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define inf (ll)(1e18) #define mod 1000000007 int main() { int t = 1; // cin>>t; while (t--) { ll a, b, c, k; cin >> a >> b >> c >> k; if (k <= a) cout << k; else if (k <= a + b) cout << a; else { ll ans =...
[["-", 8, 9, 0, 57, 64, 1, 0, 16, 12, 22], ["+", 8, 9, 0, 57, 64, 1, 0, 16, 12, 22]]
1
103
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; if (k - a >= 0) cout << k << endl; else if (k - a - b <= 0) cout << a << 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 (k - a <= 0) cout << k << endl; else if (k - a - b <= 0) cout << a << endl; else cout << a - (k - a - b) << endl; }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
77
#include <bits/stdc++.h> using namespace std; template <typename T> void drop(const T &x) { cout << x << '\n'; exit(0); } void solve() { int a, b, c, k; cin >> a >> b >> c >> k; int x, y, z; y = a; x = k - a; z = x - b; if (a >= k) drop(y); if (b >= x) drop(y); cout << y - z << '\n'; } ...
#include <bits/stdc++.h> using namespace std; template <typename T> void drop(const T &x) { cout << x << '\n'; exit(0); } void solve() { int a, b, c, k; cin >> a >> b >> c >> k; int x, y, z; y = a; x = k - a; z = x - b; if (a >= k) drop(k); if (b >= x) drop(y); cout << y - z << '\n'; } ...
[["-", 0, 57, 64, 1, 0, 2, 3, 4, 0, 22], ["+", 0, 57, 64, 1, 0, 2, 3, 4, 0, 22]]
1
152
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c; int k; cin >> a >> b >> c >> k; int x, z; x = k - a; z = x - b; if (k <= a) { cout << k; } else if (x <= b) { cout << a; } else if (z > 0) { cout << k + (-1 * z); } else { cout << k; } }
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c; int k; cin >> a >> b >> c >> k; int x, z; x = k - a; z = x - b; if (k <= a) { cout << k; } else if (x <= b) { cout << a; } else if (z > 0) { cout << a + (-1 * z); } else { cout << a; } }
[["-", 64, 9, 0, 1, 0, 16, 12, 16, 31, 22], ["+", 64, 9, 0, 1, 0, 16, 12, 16, 31, 22], ["-", 75, 76, 0, 9, 0, 1, 0, 16, 12, 22], ["+", 75, 76, 0, 9, 0, 1, 0, 16, 12, 22]]
1
100
#include <iostream> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; if (a + b + c >= k) cout << a - (k - a - b); else if (a <= k) cout << a; else cout << k; }
#include <iostream> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; if (a + b <= k) cout << a - (k - a - b); else if (a <= k) cout << a; else cout << k; }
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 72], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 12, 22], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
69
#include <stdio.h> #pragma warning(disable : 4996) int main() { long long A, B, C, K; (void)scanf("%lld%lld%lld%lld", &A, &B, &C, &K); if (A < K) { K -= A; if (B < K) { K -= B; } else { K = 0; } } else { K = 0; } printf("%lld", A - K); }
#include <stdio.h> #pragma warning(disable : 4996) int main() { long long A, B, C, K; (void)scanf("%lld%lld%lld%lld", &A, &B, &C, &K); if (A < K) { K -= A; if (B < K) { K -= B; } else { K = 0; } } else { A = K; K = 0; } printf("%lld", A - K); }
[["+", 75, 76, 0, 9, 0, 1, 0, 11, 31, 22], ["+", 75, 76, 0, 9, 0, 1, 0, 11, 17, 32], ["+", 75, 76, 0, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 75, 76, 0, 9, 0, 1, 0, 35]]
1
91
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, c, k, k1; cin >> a >> b >> c >> k; long long ans; k1 = k; k -= a; if (k <= 0) { ans = a; cout << ans << endl; return 0; } k1 -= a; k -= b; if (k <= 0) { ans = a + b * 0; cout << ans << endl; return 0; ...
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, c, k, k1; cin >> a >> b >> c >> k; long long ans; k1 = k; k -= a; if (k <= 0) { ans = k1; cout << ans << endl; return 0; } k1 -= a; k -= b; if (k <= 0) { ans = a + k1 * 0; 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], ["-", 0, 1, 0, 11, 12, 16, 12, 16, 31, 22], ["+", 0, 1, 0, 11, 12, 16, 12, 16, 31, 22]]
1
135
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, n; cin >> a >> b >> c >> n; if (n <= a) cout << n << endl; if (n > a && n <= a + b) cout << a << endl; if (n > a + b) cout << a - (n - a + b) << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, n; cin >> a >> b >> c >> n; if (n <= a) cout << n << endl; if (n > a && n <= a + b) cout << a << endl; if (n > a + b) cout << a - (n - a - b) << endl; }
[["-", 31, 16, 12, 16, 12, 23, 0, 16, 17, 72], ["+", 31, 16, 12, 16, 12, 23, 0, 16, 17, 33]]
1
83
#include <bits/stdc++.h> using namespace std; long long A, B, C, K; void input() { cin >> A >> B >> C >> K; } int main() { input(); if (A >= K) { cout << A << endl; } else if (A + B >= K) { cout << A << endl; } else { cout << 2 * A + B - K << endl; } }
#include <bits/stdc++.h> using namespace std; long long A, B, C, K; void input() { cin >> A >> B >> C >> K; } int main() { input(); if (A >= K) { cout << K << endl; } else if (A + B >= K) { cout << A << endl; } else { cout << 2 * A + B - K << endl; } }
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
88
A, B, C, K = map(int, input().split()) if A >= K: print(K) exit() temp = K - A if temp >= B: print(A) exit() temp = temp - B print(A - temp)
A, B, C, K = map(int, input().split()) if A >= K: print(K) exit() temp = K - A if B >= temp: print(A) exit() temp = temp - B print(A - temp)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22], ["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22]]
5
60
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) typedef long long ll; int main() { ll a, b, c, k, ans; cin >> a >> b >> c >> k; ans = a; k = k - a - b; if (k > 0) ans -= k; cout << ans; }
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) typedef long long ll; int main() { ll a, b, c, k, ans; cin >> a >> b >> c >> k; ans = min(a, k); k = k - a - b; if (k > 0) ans -= k; cout << ans; }
[["+", 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
72
a, b, c, k = map(int, input().split()) if k - a <= 0: print(k) elif k - a > 0 and k - a - b <= 0: print(a) else: s = k - a print(s - c)
a, b, c, k = map(int, input().split()) if k - a <= 0: print(k) elif k - a > 0 and k - a - b <= 0: print(a) else: s = k - a - b print(a - s)
[["+", 8, 196, 0, 1, 0, 662, 12, 657, 17, 33], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 12, 22], ["-", 0, 1, 0, 652, 3, 4, 0, 657, 31, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 31, 22], ["-", 0, 1, 0, 652, 3, 4, 0, 657, 12, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 12, 22]]
5
63
#include <algorithm> #include <iostream> #include <map> #include <math.h> #include <string> #include <vector> using namespace std; void b_easy_linear_programming(void) { long long a, b, c, k; cin >> a >> b >> c >> k; long long sum = 0; if (k >= a) { sum = a; k -= a; } else { sum += (a - k); ...
#include <algorithm> #include <iostream> #include <map> #include <math.h> #include <string> #include <vector> using namespace std; void b_easy_linear_programming(void) { long long a, b, c, k; cin >> a >> b >> c >> k; long long sum = 0; if (k >= a) { sum = a; k -= a; } else { sum += k; cout...
[["-", 0, 9, 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], ["-", 0, 9, 0, 1, 0, 11, 12, 23, 0, 25]]
1
134
a,b,c,k = map(int,input().split()) if k<=a+b: print(a) else: c = k-a-b print(int(a-c))
a,b,c,k = map(int,input().split()) if k<=a+b: print(min(a,k)) else: c = k-a-b print(int(a-c))
[["+", 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
#include <stdio.h> int main() { int a, b, c, k; scanf("%d %d %d %d", &a, &b, &c, &k); if (a > k) { printf("%d\n", a); return 0; } // k <= a + b + c // k - (a + b) <= c int minC = 0; if (a + b < k) { minC = k - (a + b); } printf("%d\n", a - minC); return 0; }
#include <stdio.h> int main() { int a, b, c, k; scanf("%d %d %d %d", &a, &b, &c, &k); if (a >= k) { printf("%d\n", k); return 0; } // k <= a + b + c // k - (a + b) <= c int minC = 0; if (a + b < k) { minC = k - (a + b); } printf("%d\n", a - minC); return 0; }
[["-", 8, 9, 0, 57, 15, 23, 0, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 17, 20], ["-", 64, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 64, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
0
99
#include <stdio.h> int main() { int a, b, c, k; scanf("%f %d %d %d", &a, &b, &c, &k); // k <= a + b + c // k - (a + b) <= c int minC = 0; if (a + b < k) { minC = k - (a + b); } int maxA = a; if (a > k) { maxA = k; } printf("%d\n", maxA - minC); return 0; }
#include <stdio.h> int main() { int a, b, c, k; scanf("%d %d %d %d", &a, &b, &c, &k); // k <= a + b + c // k - (a + b) <= c int minC = 0; if (a + b < k) { minC = k - (a + b); } int maxA = a; if (a > k) { maxA = k; } printf("%d\n", maxA - minC); return 0; }
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
95
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; if (a >= k) cout << a << endl; else if (a + b >= k) cout << a << 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; }
[["-", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22], ["+", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22]]
1
73
A, B, C, K = map(int, input().split()) ret = 0 for numberOfCards, point in [(A, 1), (B, 0), (C, -1)]: if K >= numberOfCards: K -= numberOfCards ret += numberOfCards * point else: ret += numberOfCards * point break print(ret)
A, B, C, K = map(int, input().split()) ret = 0 for numberOfCards, point in [(A, 1), (B, 0), (C, -1)]: if K >= numberOfCards: K -= numberOfCards ret += numberOfCards * point else: ret += K * point break print(ret)
[["-", 8, 196, 0, 1, 0, 677, 12, 657, 31, 22], ["+", 8, 196, 0, 1, 0, 677, 12, 657, 31, 22]]
5
74
#!/usr/bin/env python3 # -*- coding: utf-8 -*- a,b,c,k = map(int, input().split()) if a+b >= k: print(a) else: print(a-(k-a-b))
#!/usr/bin/env python3 # -*- coding: utf-8 -*- a,b,c,k = map(int, input().split()) if a+b >= k: print(min(a,k)) else: print(a-(k-a-b))
[["+", 0, 1, 0, 652, 3, 4, 0, 652, 63, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 21], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
47
a,b,c,k = map(int,input().split()) if a >= k : print(a) elif a + b >= k: print(a) else: d = k - (a + b) print(a - d)
a,b,c,k = map(int,input().split()) if a >= k : print(k) elif a + b >= k: print(a) else: d = k - (a + b) print(a - d)
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
57
#include <bits/stdc++.h> using namespace std; int main() { long long int a, b, c, k; cin >> a >> b >> c >> k; if (a == k) cout << a; else if (a > k) cout << a - k; else { if (a + b == k) cout << a; else if (a + b + c >= k) { int ans = 0; for (int i = 0; i < k - a - b; ...
#include <bits/stdc++.h> using namespace std; int main() { long long int a, b, c, k; cin >> a >> b >> c >> k; if (a == k) cout << a; else if (a > k) cout << k; else { if (a + b == k) cout << a; else if (a + b + c >= k) { int ans = 0; for (int i = 0; i < k - a - b; i++)...
[["-", 0, 57, 64, 1, 0, 16, 12, 16, 31, 22], ["-", 0, 57, 64, 1, 0, 16, 12, 16, 17, 33]]
1
122
a,b,c,k=map(int,input().split()) ans=0 ans=min(k,a) k-=min(k,a) ans+=min(k,b)*0 k-=min(k,b) ans-=min(k,c)*(-1) print(ans)
a,b,c,k=map(int,input().split()) ans=0 ans=min(k,a) k-=min(k,a) ans+=min(k,b)*0 k-=min(k,b) ans+=min(k,c)*(-1) print(ans)
[["-", 36, 36, 0, 656, 0, 1, 0, 677, 17, 110], ["+", 36, 36, 0, 656, 0, 1, 0, 677, 17, 107]]
5
74
a,b,c,k=map(int,input().split()) if a>=k: print(a) elif a<k: if k-a<=b: print(a) elif k-a >b: print(a-(k-a-b))
a,b,c,k=map(int,input().split()) if a>=k: print(k) elif a<k: if k-a<=b: print(a) elif 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
64
#include <algorithm> #include <bitset> #include <deque> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> #include <limits.h> #include <math.h> #include <stdlib.h> #include <string.h> const int INF = 0x7fffffff; us...
#include <algorithm> #include <bitset> #include <deque> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> #include <limits.h> #include <math.h> #include <stdlib.h> #include <string.h> const int INF = 0x7fffffff; us...
[["-", 75, 76, 0, 9, 0, 1, 0, 11, 12, 22], ["+", 75, 76, 0, 9, 0, 1, 0, 11, 12, 22]]
1
190
const main = stdin => { const [A, B, C, K] = stdin.trim().split(' ').reduce((acc, value) => { acc.push(parseInt(value)) return acc }, []) if (A >= K) { console.log(A) } else if (B >= K - A) { console.log(A) } else { console.log(A - (K - A - B)) } } // 標準入力...
const main = stdin => { const [A, B, C, K] = stdin.trim().split(' ').reduce((acc, value) => { acc.push(parseInt(value)) return acc }, []) if (A >= K) { console.log(K) } else if (B >= K - A) { console.log(A) } else { console.log(A - (K - A - B)) } } // 標準入力...
[["-", 64, 556, 0, 1, 0, 2, 3, 3, 0, 22], ["+", 64, 556, 0, 1, 0, 2, 3, 3, 0, 22]]
2
125
A,B,C,K=map(int,input().split()) x =K-A y =x-B z =y-C if x<=0: print(K) else: if y<=0: print(A) else: print(A-z)
A,B,C,K=map(int,input().split()) x =K-A y =x-B if x<=0: print(K) else: if y<=0: print(A) else: print(A-y)
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["-", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32], ["-", 0, 656, 0, 1, 0, 662, 12, 657, 31, 22], ["-", 0, 656, 0, 1, 0, 662, 12, 657, 17, 33], ["-", 0, 656, 0, 1, 0, 662, 12, 657, 12, 22], ["-", 0, 1, 0, 652, 3, 4, 0, 657, 12, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 12, 22]]
5
63
A, B, C, K = input().split() IA = int(A) IB = int(B) IC = int(C) IK = int(K) ALL = IA + IB + IC cn = 0 if IA <= IK: cn = cn + IA D = IK - IA if IB <= D: E = D - IB cn = cn - E print(cn) else: print(cn) else: print(IA)
A, B, C, K = input().split() IA = int(A) IB = int(B) IC = int(C) IK = int(K) ALL = IA + IB + IC cn = 0 if IA <= IK: cn = cn + IA D = IK - IA if IB <= D: E = D - IB cn = cn - E print(cn) else: print(cn) else: print(IK)
[["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
95
def resolve(): A, B, C, K = list(map(int, input().split())) print(A - max(0, K-(A+B))) if '__main__' == __name__: resolve()
def resolve(): A, B, C, K = list(map(int, input().split())) print(min(A, K) - max(0, K-(A+B))) if '__main__' == __name__: resolve()
[["+", 0, 652, 3, 4, 0, 657, 31, 652, 63, 22], ["+", 3, 4, 0, 657, 31, 652, 3, 4, 0, 24], ["+", 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
55
#include <bits/stdc++.h> using namespace std; using ll = long long; #define fast_io \ ios_base::sync_with_stdio(false); \ cin.tie(0); \ cout.t...
#include <bits/stdc++.h> using namespace std; using ll = long long; #define fast_io \ ios_base::sync_with_stdio(false); \ cin.tie(0); \ cout.t...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22]]
1
125
a,b,c,k = map(int,input().split()) if a>=k: m=k elif k>=a+b: m=a else: m=a-(k-a-b) print(m)
a,b,c,k = map(int,input().split()) if a>=k: m=k elif a+b>=k: m=a else: m=a-(k-a-b) print(m)
[["-", 0, 656, 0, 57, 75, 665, 15, 666, 0, 22], ["-", 0, 656, 0, 57, 75, 665, 15, 666, 667, 20], ["+", 0, 656, 0, 57, 75, 665, 15, 666, 667, 20], ["+", 0, 656, 0, 57, 75, 665, 15, 666, 0, 22]]
5
55
A,B,C,K=map(int,input().split()) print(min(A,K)-min(C,K-A-B))
A,B,C,K=map(int,input().split()) print(min(A,K)-max(min(C,K-A-B),0))
[["+", 0, 652, 3, 4, 0, 657, 12, 652, 63, 22], ["+", 3, 4, 0, 657, 12, 652, 3, 4, 0, 24], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 25], ["+", 3, 4, 0, 657, 12, 652, 3, 4, 0, 21], ["+", 3, 4, 0, 657, 12, 652, 3, 4, 0, 612]]
5
40
#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 << K - 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; }
[["+", 0, 1, 0, 16, 31, 16, 12, 16, 31, 22], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 33], ["+", 0, 16, 31, 16, 12, 16, 12, 23, 0, 24], ["+", 12, 16, 12, 23, 0, 16, 31, 16, 17, 33], ["+", 12, 16, 12, 23, 0, 16, 31, 16, 12, 22], ["+", 0, 16, 31, 16, 12, 16, 12, 23, 0, 25]]
1
68
a,b,c,k = map(int,input().split()) if k < a: ans = k elif a <= k <= a+b: ans = a elif a+b < k < a+b+c: ans = a-(k-a-b) elif a+b+c <= k: ans = a+b-c print(ans)
a,b,c,k = map(int,input().split()) if k < a: ans = k if a <= k <= a+b: ans = a if a+b < k < a+b+c: ans = a-(k-a-b) if a+b+c <= k: ans = a-c print(ans)
[["-", 36, 36, 0, 656, 0, 57, 75, 665, 0, 683], ["+", 36, 36, 36, 36, 0, 656, 0, 57, 0, 121], ["-", 0, 1, 0, 662, 12, 657, 31, 657, 17, 72], ["-", 0, 1, 0, 662, 12, 657, 31, 657, 12, 22]]
5
84
a, b, c, k = map(int,input().split()) if a > k: print(k) elif a < k <= a + b: print(a) elif a + b <= k: print(a*2 - k + b)
a, b, c, k = map(int,input().split()) if k <= a: print(k) elif a < k <= a + b: print(a) elif a + b <= k: print(a*2 - k + b)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22], ["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 19], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22]]
5
59
a, b, c, k = gets.split.map(&:to_i) if k<=a puts k elsif k <= a+b puts k else puts a-(k-a-b) end
a, b, c, k = gets.split.map(&:to_i) if k<=a puts k elsif k <= a+b puts a else puts a-(k-a-b) end
[["-", 75, 759, 64, 749, 0, 652, 3, 4, 0, 22], ["+", 75, 759, 64, 749, 0, 652, 3, 4, 0, 22]]
4
43
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); long long int a, b, c, k; cin >> a >> b >> c >> k; long long int result = 0; if (k <= a) result = k * 1; else if (k <= (a + b)) result = k * 1; else { int temp = k; temp =...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); long long int a, b, c, k; cin >> a >> b >> c >> k; long long int result = 0; if (k <= a) result = k * 1; else if (k <= (a + b)) result = a * 1; else { int temp = k; temp =...
[["-", 0, 57, 64, 1, 0, 11, 12, 16, 31, 22], ["+", 0, 57, 64, 1, 0, 11, 12, 16, 31, 22]]
1
123
#include <bits/stdc++.h> using namespace std; //型名省略 typedef long long ll; typedef vector<long long> vl; typedef vector<vector<long long>> vll; typedef vector<char> vc; typedef vector<vector<char>> vcc; typedef vector<string> vs; //マクロ #define rep(i, n) for (ll i = 0; i < (ll)n; i++) #define rep2(i, x, n) for (ll i = (...
#include <bits/stdc++.h> using namespace std; //型名省略 typedef long long ll; typedef vector<long long> vl; typedef vector<vector<long long>> vll; typedef vector<char> vc; typedef vector<vector<char>> vcc; typedef vector<string> vs; //マクロ #define rep(i, n) for (ll i = 0; i < (ll)n; i++) #define rep2(i, x, n) for (ll i = (...
[["-", 0, 1, 0, 16, 31, 16, 12, 16, 17, 72], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 33]]
1
198
a, b, c, k = map(int, input().split()) ans = 0 ans += max(a, k) k -= max(a, k) ans += max(b, k) * 0 k -= max(b, k) ans += max(c, k) * -1 k -= max(c, k) print(ans)
a, b, c, k = map(int, input().split()) ans = 0 ans += min(a, k) k -= min(a, k) ans += min(b, k) * 0 k -= min(b, k) ans += min(c, k) * -1 k -= min(c, k) print(ans)
[["-", 0, 656, 0, 1, 0, 677, 12, 652, 63, 22], ["+", 0, 656, 0, 1, 0, 677, 12, 652, 63, 22], ["-", 0, 1, 0, 677, 12, 657, 31, 652, 63, 22], ["+", 0, 1, 0, 677, 12, 657, 31, 652, 63, 22]]
5
80
#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 ALL(v) v.begin(), v.end() #define RALL(v) v.rbegin(), v.rend() #define EPS (1e-7) #define INF (1e9) #define PI (acos(-1)) using namespace std; typedef long long ll; typedef pair<ll, ll> P; cons...
#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 ALL(v) v.begin(), v.end() #define RALL(v) v.rbegin(), v.rend() #define EPS (1e-7) #define INF (1e9) #define PI (acos(-1)) using namespace std; typedef long long ll; typedef pair<ll, ll> P; cons...
[["+", 0, 16, 31, 16, 12, 16, 12, 2, 63, 22], ["+", 31, 16, 12, 16, 12, 2, 3, 4, 0, 13], ["+", 31, 16, 12, 16, 12, 2, 3, 4, 0, 21]]
1
442
#include <bits/stdc++.h> using namespace std; int main() { long long int N = 0, A, B, C, K; string S; cin >> A >> B >> C >> K; if (K <= A) cout << K << endl; else if (K <= A + B) cout << A << endl; else cout << K - B - C << endl; }
#include <bits/stdc++.h> using namespace std; int main() { long long int N = 0, A, B, C, K; string S; cin >> A >> B >> C >> K; if (K <= A) cout << K << endl; else if (K <= A + B) cout << A << endl; else cout << 2 * A + B - K << endl; }
[["-", 0, 16, 31, 16, 12, 16, 31, 16, 31, 22], ["-", 0, 16, 31, 16, 12, 16, 31, 16, 17, 33], ["+", 31, 16, 12, 16, 31, 16, 31, 16, 31, 13], ["+", 31, 16, 12, 16, 31, 16, 31, 16, 17, 48], ["+", 31, 16, 12, 16, 31, 16, 31, 16, 12, 22], ["+", 0, 16, 31, 16, 12, 16, 31, 16, 17, 72], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 12, 2...
1
78
r=input().split() A=int(r[0]) B=int(r[1]) C=int(r[2]) K=int(r[3]) if K<=A: print(K) elif K<=A+B: print(A) else: print(2*A-K-B)
r=input().split() A=int(r[0]) B=int(r[1]) C=int(r[2]) K=int(r[3]) if K<=A: print(K) elif K<=A+B: 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
77
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll a, b, c, k; cin >> a >> b >> c >> k; ll ans = 0; ll tmp = k; if (tmp <= a) { cout << k << endl; return 0; } tmp -= a; if (tmp <= b) { cout << a << endl; return 0; } tmp -= b; if (k <= c) { ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll a, b, c, k; cin >> a >> b >> c >> k; ll tmp = k; if (tmp <= a) { cout << k << endl; return 0; } tmp -= a; if (tmp <= b) { cout << a << endl; return 0; } tmp -= b; if (tmp <= c) { cout << ...
[["-", 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, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22]]
1
116
A,B,C,K = map(int,input().split()) point = 0 if K-A >=0: point += A if K-A-B > 0: point -= K-A-B print(point)
A,B,C,K = map(int,input().split()) point = 0 if K-A >=0: point += A else: point += K if K-A-B > 0: point -= K-A-B print(point)
[["+", 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, 677, 31, 22], ["+", 75, 76, 8, 196, 0, 1, 0, 677, 17, 107], ["+", 75, 76, 8, 196, 0, 1, 0, 677, 12, 22]]
5
53
a, b, c, k = map(int,input().split()) if (k <= a): print(k) elif (k <= a + b): print(k) else: x = a + b + c - k y = c - x ans = a - y print(ans)
a, b, c, k = map(int,input().split()) if (k <= a): print(k) elif (k <= a + b): print(a) else: x = a + b + c - k y = c - x ans = a - y print(ans)
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
69
#include <algorithm> #include <iostream> #include <math.h> #include <string> #include <vector> using namespace std; #define rep(i, n) for (int i = 1; i < (int)(n); i++) #define invrep(i, n) for (int i = (int)(n); i > 0; i++) using ll = long long; int main() { ll a, b, c, k; cin >> a >> b >> c >> k; if (a >= k) ...
#include <algorithm> #include <iostream> #include <math.h> #include <string> #include <vector> using namespace std; #define rep(i, n) for (int i = 1; i < (int)(n); i++) #define invrep(i, n) for (int i = (int)(n); i > 0; i++) using ll = long long; int main() { ll a, b, c, k; cin >> a >> b >> c >> k; if (a >= k) ...
[["-", 31, 16, 12, 16, 12, 23, 0, 16, 12, 22], ["+", 12, 16, 12, 23, 0, 16, 12, 23, 0, 24], ["+", 12, 23, 0, 16, 12, 23, 0, 16, 31, 22], ["+", 12, 23, 0, 16, 12, 23, 0, 16, 17, 72], ["+", 12, 23, 0, 16, 12, 23, 0, 16, 12, 22], ["+", 12, 16, 12, 23, 0, 16, 12, 23, 0, 25]]
1
129
#pragma region header #include <assert.h> #include <bitset> #include <cassert> #include <cctype> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdint> #include <cstdio> #include <ctime> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream>...
#pragma region header #include <assert.h> #include <bitset> #include <cassert> #include <cctype> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdint> #include <cstdio> #include <ctime> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream>...
[["+", 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
620
#include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define mp make_pair #define pl pair<ll, ll> #define fastIO \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); #define ...
#include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define mp make_pair #define pl pair<ll, ll> #define fastIO \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); #define ...
[["-", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22], ["+", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22], ["-", 0, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 17, 47]]
1
121
a,b,c,k = map(int, input().split()) if a > k: print(a) else: if b > k-a: print(a) else: print(2*a+b-k)
a,b,c,k = map(int, input().split()) if a > k: print(k) else: if b > k-a: print(a) else: 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
54
A,B,C,K = map(int,input().split()) if K-A > 0: if K-A-B > 0: print(A-(K-A-B)) else: print(K) else: print(K)
A,B,C,K = map(int,input().split()) if K-A > 0: if K-A-B > 0: 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
60
a, b, c, k = map(int, input().split()) if a >= k or k <= a + b : print(a) else : print( a + ( k - a - b ) * (-1) )
a, b, c, k = map(int, input().split()) if a >= k : print(k) elif k <= a + b : print(a) else : print( a + ( k - a - b ) * (-1) )
[["-", 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
54
#include <stdio.h> int main() { int a, b, c, k, s = 0; scanf("%d%d%d%d", &a, &b, &c, &k); if (k <= a) printf("%d", a - k); else if (k <= a + b) printf("%d", a); else printf("%d", a - (k - a - b)); return 0; }
#include <stdio.h> int main() { int a, b, c, k, s = 0; scanf("%d%d%d%d", &a, &b, &c, &k); if (k <= a) printf("%d", k); else if (k <= a + b) printf("%d", a); else printf("%d", a - (k - a - b)); return 0; }
[["-", 64, 1, 0, 2, 3, 4, 0, 16, 31, 22], ["-", 64, 1, 0, 2, 3, 4, 0, 16, 17, 33]]
0
96
A,B,C,K = map(int,input().split()) ans = 0 if A >= K: ans = K elif A < K and A+B >= K: ans = A else: ans = A - (K-A)*(1) print(ans)
A,B,C,K = map(int,input().split()) ans = 0 if A >= K: ans = K elif A < K and A+B >= K: ans = A else: ans = A - (K-A-B)*(1) print(ans)
[["+", 12, 657, 12, 657, 31, 23, 0, 657, 17, 33], ["+", 12, 657, 12, 657, 31, 23, 0, 657, 12, 22]]
5
64
A,B,C,K=map(int,input().split()) if A>=K: print(A) else: if A+B>=K: print(A) else: print(A-1*(K-A-B))
A,B,C,K=map(int,input().split()) if A>=K: print(1*K) else: if A+B>=K: print(A) else: print(A-1*(K-A-B))
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 31, 612], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 48], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 12, 22]]
5
58
A,B,C,K=map(int,input().split()) count=0 if K<=A or K<=A+B: print(A) else: m=K-A-B print(A-m)
A,B,C,K=map(int,input().split()) count=0 if K<=A: print(K) elif K<=A+B: print(A) else: m=K-A-B print(A-m)
[["-", 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
53
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; if (a + b >= k) { cout << a << 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 + b >= k) { cout << min(a, k) << endl; } else { cout << a - (k - a - b) << 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
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
64