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()) if a>=k: print(a*1) else: if b>=k-a: print(a*1) else: print(a*1 + (k-a-b)*(-1))
a, b, c, k = map(int, input().split()) if a>=k: print(k*1) else: if b>=k-a: print(a*1) else: print(a*1 + (k-a-b)*(-1))
[["-", 0, 1, 0, 652, 3, 4, 0, 657, 31, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 31, 22]]
5
67
import sys sys.setrecursionlimit(10**6) def main(input, print): a, b, c, k = map(int, input().split()) ans = 0 if a >= k: print(a) return k -= a if b >= k: print(a) return k -= b print(a-k) if __name__ == '__main__': main(sys.stdin.readline, print)
import sys sys.setrecursionlimit(10**6) def main(input, print): a, b, c, k = map(int, input().split()) ans = 0 if a >= k: print(k) return k -= a if b >= k: print(a) return k -= b print(a-k) if __name__ == '__main__': main(sys.stdin.readline, print)
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
90
import java.util.*; class Main { final Scanner sc = new Scanner(System.in); public static void main(String[] args) { new Main().run(); } private void run() { long a = sc.nextLong(); long b = sc.nextLong(); long c = sc.nextLong(); long k = sc.nextLong(); long ans = 0; if (k < a) { ...
import java.util.*; class Main { final Scanner sc = new Scanner(System.in); public static void main(String[] args) { new Main().run(); } private void run() { long a = sc.nextLong(); long b = sc.nextLong(); long c = sc.nextLong(); long k = sc.nextLong(); long ans = 0; if (k < a) { ...
[["-", 0, 57, 64, 196, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 11, 12, 22]]
3
160
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <vector> typedef long long ll; #define PI 3.14159265359 #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) #define mp make_pair #define all(v) v.begin...
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <vector> typedef long long ll; #define PI 3.14159265359 #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) #define mp make_pair #define all(v) v.begin...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22]]
1
915
#include <algorithm> #include <iostream> #include <stdio.h> #include <string> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; int ans = 0; if (k > a) { ans += a; k -= a; } else { ans += a; cout << ans << endl; return 0; } if (k <= b) { cout << ans << end...
#include <algorithm> #include <iostream> #include <stdio.h> #include <string> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; int ans = 0; if (k > a) { ans += a; k -= a; } else { ans += k; cout << ans << endl; return 0; } if (k <= b) { cout << ans << end...
[["-", 75, 76, 0, 9, 0, 1, 0, 11, 12, 22], ["+", 75, 76, 0, 9, 0, 1, 0, 11, 12, 22]]
1
108
a, b, c, k = map(int, input().split()) if a >= k: sum = 1 * a else: if b >= k - a: sum = 1 * a + 0 * (k-a) else: if c >= k - a - b: sum = 1 * a + 0 * b - 1 * (k-a-b) else: sum = 1 * a + 0 * b - 1 * c print(sum)
a, b, c, k = map(int, input().split()) if a >= k: sum = 1 * k else: if b >= k - a: sum = 1 * a + 0 * (k-a) else: if c >= k - a - b: sum = 1 * a + 0 * b - 1 * (k-a-b) else: sum = 1 * a + 0 * b - 1 * c print(sum)
[["-", 64, 196, 0, 1, 0, 662, 12, 657, 12, 22], ["+", 64, 196, 0, 1, 0, 662, 12, 657, 12, 22]]
5
101
#include <bits/stdc++.h> using namespace std; typedef long long int ll; const ll mod = 1000000007; #define Sort(a) sort(a.begin(), a.end()) int main() { cin.tie(0); ios_base::sync_with_stdio(false); int a, b, c, k; cin >> a >> b >> c >> k; int count = 0; count = k - a; if (count < 0) { cout << a << '...
#include <bits/stdc++.h> using namespace std; typedef long long int ll; const ll mod = 1000000007; #define Sort(a) sort(a.begin(), a.end()) int main() { cin.tie(0); ios_base::sync_with_stdio(false); int a, b, c, k; cin >> a >> b >> c >> k; int count = 0; count = k - a; if (count < 0) { cout << k << '...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
135
#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 { long long int total = a; k = k - a; if (k > b) k = k - b; else k = 0; total -= k; cout << total; } }
#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 << k; else { long long int total = a; k = k - a; if (k > b) k = k - b; else k = 0; total -= k; cout << total; } }
[["-", 8, 9, 0, 57, 64, 1, 0, 16, 12, 22], ["+", 8, 9, 0, 57, 64, 1, 0, 16, 12, 22]]
1
84
#include <iostream> #include <stdio.h> using namespace std; int main(void) { int A, B, C, K; cin >> A >> B >> C >> K; if (K < A) { cout << A << endl; } else if (K < A + B) { cout << A << endl; } else { cout << A - (K - A - B) << endl; } return 0; }
#include <iostream> #include <stdio.h> using namespace std; int main(void) { int A, B, C, K; cin >> A >> B >> C >> K; if (K < A) { cout << K << endl; } else if (K < A + B) { cout << A << endl; } else { cout << A - (K - A - B) << endl; } return 0; }
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
85
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; typedef long long ll; typedef long long int lli; ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } //最大公約数(Greatest Common Divisor) ll lcm(ll a, ll b) { return a / gcd(a, b) * b; } //最小公倍数(Least Common Multiple) long lo...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; typedef long long ll; typedef long long int lli; ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } //最大公約数(Greatest Common Divisor) ll lcm(ll a, ll b) { return a / gcd(a, b) * b; } //最小公倍数(Least Common Multiple) long lo...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22]]
1
197
import sys readline = sys.stdin.readline sys.setrecursionlimit(10**6) def main(): A, B, C, K = map(int, readline().split()) if A + B >= K: print(A) else: tmp = K - A - B print(A-tmp) if __name__ == "__main__": main()
import sys readline = sys.stdin.readline sys.setrecursionlimit(10**6) def main(): A, B, C, K = map(int, readline().split()) if A + B >= K: print(min(A,K)) else: tmp = K - A - B print(A-tmp) if __name__ == "__main__": main()
[["+", 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
78
A, B, C, K = map(int, input().split()) count = 0 if K >= A: count += A K -= A else: count = A K = 0 if K != 0: if K>=B: K -= B else: K= 0 if K != 0: count -= K print(count)
A, B, C, K = map(int, input().split()) count = 0 if K >= A: count += A K -= A else: count = K K = 0 if K != 0: if K>=B: K -= B else: K= 0 if K != 0: 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
72
#include <bits/stdc++.h> using namespace std; #define bip(a) __builtin_popcount(a) #define ull unsigned long long #define ll long long #define u unsigned #define pb push_back #define pf push_front /// for list #define mp make_pair #define is insert #define ff first #define ss second #define vi vector<int> #define vl v...
#include <bits/stdc++.h> using namespace std; #define bip(a) __builtin_popcount(a) #define ull unsigned long long #define ll long long #define u unsigned #define pb push_back #define pf push_front /// for list #define mp make_pair #define is insert #define ff first #define ss second #define vi vector<int> #define vl v...
[["-", 0, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 12, 22]]
1
306
[a,b,c,k] = [int(x) for x in input().split()] if a >= k: print(a) elif a+b >= k: print(a) else: print(a-(k-a-b))
[a,b,c,k] = [int(x) for x in input().split()] 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
60
#include <algorithm> #include <cassert> #include <cmath> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <random> #include <set> #include <string> #include <unordered_map> #include <unordered_set> #include <vector> using namespace std; typedef lo...
#include <algorithm> #include <cassert> #include <cmath> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <random> #include <set> #include <string> #include <unordered_map> #include <unordered_set> #include <vector> using namespace std; typedef lo...
[["+", 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
245
A, B, C, K = (int(x) for x in input().split()) total = 0 if A >= K: total = A elif B >= (K-A): total = A elif C >= (K-A-B): total = A-(K-A-B) print(total)
A, B, C, K = (int(x) for x in input().split()) total = 0 if A >= K: total = K elif B >= (K-A): total = A elif C >= (K-A-B): total = A-(K-A-B) print(total)
[["-", 0, 57, 64, 196, 0, 1, 0, 662, 12, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 12, 22]]
5
73
#include <iostream> #include <string> using namespace std; int main() { long long a, b, c, k; cin >> a >> b >> c >> k; long long sum = 0; if (k >= a) { sum += a; k -= a; } else { cout << a << "\n"; return 0; } if (k >= b) { k -= b; } else { cout << a << "\n"; return 0; } ...
#include <iostream> #include <string> using namespace std; int main() { long long a, b, c, k; cin >> a >> b >> c >> k; long long sum = 0; if (k >= a) { sum += a; k -= a; } else { cout << k << "\n"; return 0; } if (k >= b) { k -= b; } else { cout << sum << "\n"; return 0; }...
[["-", 0, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 0, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
132
#include <bits/stdc++.h> using namespace std; int main() { int A, B, C, K; cin >> A >> B >> C >> K; int sum = A + B; int max; if (sum >= K) { if (A >= K) { max = A; } else if (A < K) { max = K; } } else if (sum < K) { max = A - (K - sum); } cout << max << endl; return ...
#include <bits/stdc++.h> using namespace std; int main() { int A, B, C, K; cin >> A >> B >> C >> K; int sum = A + B; int max; if (sum >= K) { if (A >= K) { max = K; } else if (A < K) { max = A; } } else if (sum < K) { max = A - (K - sum); } cout << max << endl; return ...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22]]
1
102
#include <bits/stdc++.h> using namespace std; int main() { int A, B, C, K, D, E, F, G, H; cin >> A >> B >> C >> K; if (A < K) { D = K - A; if (B < D) { E = K - D; if (C < E) { cout << A - C; } else { cout << A - (K - A - B); } } else { cout << A; } }...
#include <bits/stdc++.h> using namespace std; int main() { int A, B, C, K, D, E, F, G, H; cin >> A >> B >> C >> K; if (A < K) { D = K - A; if (B < D) { E = D - B; if (C < E) { cout << A - C; } else { cout << A - (K - A - B); } } else { cout << A; } }...
[["-", 64, 9, 0, 1, 0, 11, 12, 16, 31, 22], ["-", 64, 9, 0, 1, 0, 11, 12, 16, 17, 33], ["+", 64, 9, 0, 1, 0, 11, 12, 16, 17, 33], ["+", 64, 9, 0, 1, 0, 11, 12, 16, 12, 22], ["-", 75, 76, 0, 9, 0, 1, 0, 16, 12, 22], ["+", 75, 76, 0, 9, 0, 1, 0, 16, 12, 22]]
1
112
A,B,C,K = $stdin.read.chomp.split(" ").map(&:to_i) k = K if A >= k puts A exit end k -= A if B >= k puts A exit end k -= B puts A - [0, k].max
A,B,C,K = $stdin.read.chomp.split(" ").map(&:to_i) k = K if A >= k puts k exit end k -= A if B >= k puts A exit end k -= B puts A - [0, k].max
[["-", 0, 121, 64, 749, 0, 652, 3, 4, 0, 743], ["+", 0, 121, 64, 749, 0, 652, 3, 4, 0, 22]]
4
61
a,b,c,k = map(int,input().split()) ans = 0 if k <= a: ans = k elif k <= b+a: ans = a else: ans = a - (k-c) print(ans)
a,b,c,k = map(int,input().split()) ans = 0 if k <= a: ans = k elif k <= b+a: ans = a else: ans = a - (k-(a+b)) print(ans)
[["-", 0, 662, 12, 657, 12, 23, 0, 657, 12, 22], ["+", 12, 657, 12, 23, 0, 657, 12, 23, 0, 24], ["+", 12, 23, 0, 657, 12, 23, 0, 657, 31, 22], ["+", 12, 23, 0, 657, 12, 23, 0, 657, 17, 72], ["+", 12, 23, 0, 657, 12, 23, 0, 657, 12, 22], ["+", 12, 657, 12, 23, 0, 657, 12, 23, 0, 25]]
5
56
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; template <typename X> ostream &operator<<(ostream &x, const vector<X> &v) { for (ll i = 0; i < v.size(); ++i) x << v[i] << " "; return x; } template <typename X> ostream &operator<<(ostream &x, const set<X> &v) { for (...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; template <typename X> ostream &operator<<(ostream &x, const vector<X> &v) { for (ll i = 0; i < v.size(); ++i) x << v[i] << " "; return x; } template <typename X> ostream &operator<<(ostream &x, const set<X> &v) { for (...
[["-", 0, 1, 0, 11, 12, 2, 3, 4, 0, 22], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 22]]
1
480
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound #include <iostream> // cout, endl, cin #include <string> // string, to_string, stoi #include <vector> // vector using namespace std; int main() { int A, B, C, K, ans; cin >> A >> B >> C >> K; if (K <= A) { cout << K << end...
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound #include <iostream> // cout, endl, cin #include <string> // string, to_string, stoi #include <vector> // vector using namespace std; int main() { int A, B, C, K, ans; cin >> A >> B >> C >> K; if (K <= A) { cout << K << end...
[["-", 8, 9, 0, 57, 75, 76, 0, 9, 0, 45], ["+", 0, 57, 75, 76, 0, 57, 75, 76, 0, 95], ["-", 75, 76, 0, 9, 0, 57, 64, 9, 0, 46]]
1
102
#include <algorithm> #include <iostream> using namespace std; int main() { int A, B, C, K; cin >> A >> B >> C >> K; long long ans = 0; if (K - A >= 0) { K -= A; ans += A; } else { ans += A; cout << ans << endl; return 0; } if (K - B >= 0) { K -= B; } else { cout << ans << en...
#include <algorithm> #include <iostream> using namespace std; int main() { long long A, B, C, K; cin >> A >> B >> C >> K; long long ans = 0; if (K - A >= 0) { K -= A; ans += A; } else { ans += K; cout << ans << endl; return 0; } if (K - B >= 0) { K -= B; } else { cout << ans...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 75, 76, 0, 9, 0, 1, 0, 11, 12, 22], ["+", 75, 76, 0, 9, 0, 1, 0, 11, 12, 22]]
1
109
A, B, C, K = map(int,input().split()) sum = 0 n = 0 if K - A > 0: sum = A*1 n = K - A if B > n: n = n - B sum += (-1) * n else: sum = K*1 print(sum)
A, B, C, K = map(int,input().split()) sum = 0 n = 0 if K - A > 0: sum = A n = K - A if B < n: n = n - B sum += (-1) * n else: sum = K print(sum)
[["-", 64, 196, 0, 1, 0, 662, 12, 657, 17, 48], ["-", 64, 196, 0, 1, 0, 662, 12, 657, 12, 612], ["-", 0, 57, 64, 196, 0, 57, 15, 666, 667, 47], ["+", 0, 57, 64, 196, 0, 57, 15, 666, 667, 18], ["-", 8, 196, 0, 1, 0, 662, 12, 657, 17, 48], ["-", 8, 196, 0, 1, 0, 662, 12, 657, 12, 612]]
5
72
if __name__ == "__main__": a,b,c, k = map(int, input().split()) if a >= k: print(a) else: if b >=k - a: print(a) else: minus = k - (a + b) print(a - minus)
if __name__ == "__main__": a,b,c, k = map(int, input().split()) if a >= k: print(k) else: if b >=k - a: print(a) else: minus = k - (a + b) print(a - minus)
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
66
A,B,C,K = map(int, input().split()) if A >= K: print(A) else: K = K - A if B >= K: print(A) else: K = K - B print(A-K)
A,B,C,K = map(int, input().split()) if A >= K: print(K) else: K = K - A if B >= K: print(A) else: K = K - B print(A-K)
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
58
from sys import stdin a, b, c, k = [int(_) for _ in stdin.readline().rstrip().split()] if a > k: print(k) elif a < k and a+b > k: print(a) else: print(a - (k-a-b))
from sys import stdin a, b, c, k = [int(_) for _ in stdin.readline().rstrip().split()] if a >= k: print(k) elif a < k and a+b >= k: print(a) else: print(a - (k-a-b))
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20], ["-", 0, 57, 75, 665, 15, 679, 12, 666, 667, 47], ["+", 0, 57, 75, 665, 15, 679, 12, 666, 667, 20]]
5
72
A,B,C,K=map(int,input().split()) if K<=A+B: print(A) else: print(A-(K-A-B))
A,B,C,K=map(int,input().split()) if K<=A+B: print(min(A,K)) else: print(A-(K-A-B))
[["+", 0, 1, 0, 652, 3, 4, 0, 652, 63, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 21], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
45
#include <iostream> #include <stdio.h> #include <string.h> using namespace std; long long a, b, c, k; int main() { scanf("%lld%lld%lld%lld", &a, &b, &c, &k); if (k == 0) { puts("0"); return 0; } if (k <= (a + b)) { printf("%lld\n", max(k, a)); return 0; } else { printf("%lld\n", a + a + b ...
#include <iostream> #include <stdio.h> #include <string.h> using namespace std; long long a, b, c, k; int main() { scanf("%lld%lld%lld%lld", &a, &b, &c, &k); if (k == 0) { puts("0"); return 0; } if (k <= (a + b)) { printf("%lld\n", min(k, a)); return 0; } else { printf("%lld\n", a + a + b ...
[["-", 0, 1, 0, 2, 3, 4, 0, 2, 63, 22], ["+", 0, 1, 0, 2, 3, 4, 0, 2, 63, 22]]
1
118
A, B, C, K = map(int, input().split()) if (A+B) == K: print(A) elif (A+B) > K: if a > K: print(K) else: print(A) elif (A+B) < K: print(A - (K - (A+B)))
A, B, C, K = map(int, input().split()) if (A+B) == K: print(A) elif (A+B) > K: if A > K: print(K) else: print(A) elif (A+B) < K: print(A - (K - (A+B)))
[["-", 75, 665, 64, 196, 0, 57, 15, 666, 0, 22], ["+", 75, 665, 64, 196, 0, 57, 15, 666, 0, 22]]
5
80
A,B,C,K = map(int,input().split()) if K <= A: print(A * 1) else: c = A * 1 if K <= A + B: pass else: if K <= A + B + C: c += (K - A - B) * -1 else: c += C * -1 print(c)
A,B,C,K = map(int,input().split()) if K <= A: print(K * 1) else: c = A * 1 if K <= A + B: pass else: if K <= A + B + C: c += (K - A - B) * -1 else: c += C * -1 print(c)
[["-", 0, 1, 0, 652, 3, 4, 0, 657, 31, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 31, 22]]
5
81
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; typedef long long int ll; ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } ll lcm(ll a, ll b) { return a / gcd(a, b) ...
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; typedef long long int ll; ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } ll lcm(ll a, ll b) { return a / gcd(a, b) ...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22]]
1
303
#include <stdio.h> int main() { int a, b, c; long long int k; scanf("%d%d%d%lld", &a, &b, &c, &k); int sum = 0; if (k < a) sum = k; else if ((k > a) && (k <= a + b)) sum = a; else if ((k > (a + b)) && (k < (a + b + c))) sum = a - (k - a - b); else if (k == a + b + c) sum = a - c; print...
#include <stdio.h> int main() { int a, b, c; long long int k; scanf("%d%d%d%lld", &a, &b, &c, &k); int sum; if (k <= a) sum = k; else if ((k > a) && (k <= a + b)) sum = a; else if ((k > (a + b)) && (k < (a + b + c))) sum = a - (k - a - b); else if (k == a + b + c) sum = a - c; printf("...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 8, 9, 0, 57, 15, 23, 0, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 17, 19]]
0
141
#include <bits/stdc++.h> #define _USE_MATH_DEFINES #define reb(i, b, n) for (int i = (int)(b); i < (int)(n); i++) #define rep(i, n) reb(i, 0, n) #define each(it, v) \ for (__typeof((v).begin()) it = (v).begin(); it != (v).end(); it++) #define reach(it, v) ...
#include <bits/stdc++.h> #define _USE_MATH_DEFINES #define reb(i, b, n) for (int i = (int)(b); i < (int)(n); i++) #define rep(i, n) reb(i, 0, n) #define each(it, v) \ for (__typeof((v).begin()) it = (v).begin(); it != (v).end(); it++) #define reach(it, v) ...
[["-", 12, 23, 0, 16, 31, 2, 3, 4, 0, 22], ["+", 12, 23, 0, 16, 31, 2, 3, 4, 0, 22]]
1
354
#include <bits/stdc++.h> #include <cmath> #include <numeric> using namespace std; #define rep(i, a, b) for (int64_t i = (a); i < (b); ++i) // a ≦ i < b #define Rrep(i, a, b) \ for (int64_t i = (a); i >= (b); --i) // reverse repeat. a から b まで減少. #define ALL(a) (...
#include <bits/stdc++.h> #include <cmath> #include <numeric> using namespace std; #define rep(i, a, b) for (int64_t i = (a); i < (b); ++i) // a ≦ i < b #define Rrep(i, a, b) \ for (int64_t i = (a); i >= (b); --i) // reverse repeat. a から b まで減少. #define ALL(a) (...
[["+", 64, 1, 0, 16, 31, 16, 12, 2, 63, 22], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 24], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 21], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 22], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 25]]
1
230
a,b,c,k = gets.chomp.split(" ").map(&:to_i) if k < a puts a - k elsif k < a + b puts a else puts a + (k - a - b) * (-1) end
a,b,c,k = gets.chomp.split(" ").map(&:to_i) if k < a puts k elsif k < a + b puts a else puts a + (k - a - b) * (-1) end
[["-", 64, 749, 0, 652, 3, 4, 0, 738, 31, 22], ["-", 64, 749, 0, 652, 3, 4, 0, 738, 17, 33]]
4
57
a, b, c, k = map(int, input().split()) num = 0 if k >= a: num += a k -= a if k >= b: k -= b if k > 0: num -= k else: num += a print(num)
a, b, c, k = map(int, input().split()) num = 0 if k >= a: num += a k -= a if k >= b: k -= b if k > 0: num -= k else: num += k print(num)
[["-", 75, 76, 8, 196, 0, 1, 0, 677, 12, 22], ["+", 75, 76, 8, 196, 0, 1, 0, 677, 12, 22]]
5
59
#include "bits/stdc++.h" using namespace std; #define fast_cin() \ ios_base::sync_with_stdio(false); \ cin.tie(NULL) #define rep(i, x, n) for (int i = x; i < n; i++) #define all(x) x.begin(), x.end() #define pb ...
#include "bits/stdc++.h" using namespace std; #define fast_cin() \ ios_base::sync_with_stdio(false); \ cin.tie(NULL) #define rep(i, x, n) for (int i = x; i < n; i++) #define all(x) x.begin(), x.end() #define pb ...
[["+", 0, 14, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["-", 0, 57, 75, 76, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 75, 76, 0, 1, 0, 11, 12, 22]]
1
172
a,b,c,k = map(int,input().split()) if k<=a: print(a) else: x = k-a if x<=b: print(a) else: print(a-(x-b))
a,b,c,k = map(int,input().split()) if k<=a: print(k) else: x = k-a if x<=b: print(a) else: print(a-(x-b))
[["-", 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 a, b, c, k, ans = 0; cin >> a >> b >> c >> k; if (a >= k) { cout << a << endl; return 0; } else { k -= a; ans += a; if (b >= k) { cout << ans << endl; return 0; } else { k -= b; ans -= k; ...
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, c, k, ans = 0; cin >> a >> b >> c >> k; if (a >= k) { cout << k << endl; return 0; } else { k -= a; ans += a; if (b >= k) { cout << ans << endl; return 0; } else { k -= b; ans -= k; ...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
101
#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 << 2 * A + B - 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; } }
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
79
A,B,C,A,B,C,K=map(int,input().split()) if K<=A: print(K) elif A<K<=A+B: print(A) elif A+B<K<=A+B+C: print(2*A+B-K)
A,B,C,K=map(int,input().split()) if K<=A: print(K) elif A<K<=A+B: print(A) elif A+B<K<=A+B+C: print(2*A+B-K)
[["-", 0, 656, 0, 1, 0, 662, 31, 684, 0, 22], ["-", 0, 656, 0, 1, 0, 662, 31, 684, 0, 21]]
5
71
// g++ -std=gnu++14 a.cpp #include <algorithm> #include <bitset> #include <complex> #include <deque> #include <iomanip> #include <iostream> #include <istream> #include <iterator> #include <map> #include <math.h> #include <queue> #include <random> #include <set> #include <stack> #include <string> #include <tuple> #inclu...
// g++ -std=gnu++14 a.cpp #include <algorithm> #include <bitset> #include <complex> #include <deque> #include <iomanip> #include <iostream> #include <istream> #include <iterator> #include <map> #include <math.h> #include <queue> #include <random> #include <set> #include <stack> #include <string> #include <tuple> #inclu...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 19], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 18]]
1
225
A, B, C ,K = map(int, input().split()) score = 0 if A >= K : print(A) else: score += A K = K - A if B >= K : print(score) else: K = K - B print(score - K)
A, B, C ,K = map(int, input().split()) score = 0 if A >= K : print(K) else: score += A K = K - A if B >= K : print(score) else: K = K - B print(score - K)
[["-", 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 <iostream> #include <string> using namespace std; int main() { int a, b, c, k, numa = 0, numb = 0, ans = 0; cin >> a >> b >> c >> k; int flag = 0; if (a < k) { ans = ans + a; k = k - a; } else { ans = ans + k; flag = 1; } if (flag == 0) { if (b < k) { ...
#include <algorithm> #include <iostream> #include <string> using namespace std; int main() { int a, b, c, k, numa = 0, numb = 0, ans = 0; cin >> a >> b >> c >> k; int flag = 0; if (a < k) { ans = ans + a; k = k - a; } else { ans = ans + k; flag = 1; } if (flag == 0) { if (b < k) { ...
[["-", 64, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 31, 22]]
1
155
#!/usr/bin/env python3 import sys import math from bisect import bisect_right as br from bisect import bisect_left as bl sys.setrecursionlimit(2147483647) from heapq import heappush, heappop,heappushpop from collections import defaultdict from itertools import accumulate from collections import Counter from collection...
#!/usr/bin/env python3 import sys import math from bisect import bisect_right as br from bisect import bisect_left as bl sys.setrecursionlimit(2147483647) from heapq import heappush, heappop,heappushpop from collections import defaultdict from itertools import accumulate from collections import Counter from collection...
[["+", 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
147
#include <bits/stdc++.h> //g++-9で実行(gcc version 9.3.0),g++だとデフォルトのclang using namespace std; //#define int long long //intでオーバフローした時の切り替え用 #define debug(x) \ cerr << #x << ": " << x << endl //エラー出力として変数名と変数の中身表示 #define DEBUG_VEC(v) ...
#include <bits/stdc++.h> //g++-9で実行(gcc version 9.3.0),g++だとデフォルトのclang using namespace std; //#define int long long //intでオーバフローした時の切り替え用 #define debug(x) \ cerr << #x << ": " << x << endl //エラー出力として変数名と変数の中身表示 #define DEBUG_VEC(v) ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["-", 0, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 0, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
206
#include <bits/stdc++.h> using namespace std; using ll = long long; 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; using ll = long long; 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
79
a,b,c,k = map(int,input().split()) if k <= a: print(a) elif a < k and k <= a + b: print(a) elif a + b < k: print(a - (k - a - b))
a,b,c,k = map(int,input().split()) if k <= a: print(k) elif a < k and k <= a + b: 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
#include <cstring> //c #include <iostream> //cout #include <vector> //vector using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) int main() { long A, B, C, K; cin >> A >> B >> C >> K; if (A >= K) { // A cout << A << endl; } else if (A + B >= K) { // A+B cout << A << endl; } ...
#include <cstring> //c #include <iostream> //cout #include <vector> //vector using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) int main() { long A, B, C, K; cin >> A >> B >> C >> K; if (A >= K) { // A cout << K << endl; } else if (A + B >= K) { // A+B cout << A << endl; } ...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
97
a, b, c, k = map(int, input().split()) if k <= a: print(k) elif k <= a + b: print(a) elif k < a+b+c: print(2*a+b-k) else: print(a-b)
a, b, c, k = map(int, input().split()) if k <= a: print(k) elif k <= a + b: print(a) elif k < a+b+c: print(2*a+b-k) else: print(a-c)
[["-", 0, 1, 0, 652, 3, 4, 0, 657, 12, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 12, 22]]
5
67
def solve(): A, B, C, K = map(int, input().split()) if A >= K: print(K) elif A + B >= K: print(A) else: print(A - (K-B)) solve()
def solve(): A, B, C, K = map(int, input().split()) if A >= K: print(K) elif A + B >= K: print(A) else: print(A - (K-B-A)) solve()
[["+", 3, 4, 0, 657, 12, 23, 0, 657, 17, 33], ["+", 3, 4, 0, 657, 12, 23, 0, 657, 12, 22]]
5
60
A, B, C, K = map(int, input().split()) print(min(A, K)-min(K-A-B, C))
A, B, C, K = map(int, input().split()) print(min(A, K)-min(max(0, K-A-B), C))
[["+", 0, 657, 12, 652, 3, 4, 0, 652, 63, 22], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 612], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 21], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
40
#include <bits/stdc++.h> using namespace std; using l1 = long long; #define rep(i, n) for (int i = 0, i < (n); ++i) int main() { l1 a, b, c, k; cin >> a >> b >> c >> k; l1 ans = 0; if (a >= k) { cout << a; return 0; } else { ans += a; k -= a; } if (b >= k) { cout << ans; return 0;...
#include <bits/stdc++.h> using namespace std; using l1 = long long; #define rep(i, n) for (int i = 0, i < (n); ++i) int main() { l1 a, b, c, k; cin >> a >> b >> c >> k; l1 ans = 0; if (a >= k) { cout << k; return 0; } else { ans += a; k -= a; } if (b >= k) { cout << ans; return 0;...
[["-", 0, 57, 64, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 16, 12, 22]]
1
107
x = list(map(int, input().split())) a = x[0] b = x[1] c = x[2] k = x[3] if a >= k: print(a) else: count = k - a if b >= count: print(a) else: count = k - a - b ans = a - count print(ans)
x = list(map(int, input().split())) a = x[0] b = x[1] c = x[2] k = x[3] if a >= k: print(k) else: count = k - a if b >= count: print(a) else: count = k - a - b ans = a - count print(ans)
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
84
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; int sum = 0; if (a >= k) { sum = a; } else if (a + b >= k) { sum = a; } else { sum = 2 * a + b - k; } cout << sum << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; int sum = 0; if (a >= k) { sum = k; } else if (a + b >= k) { sum = a; } else { sum = 2 * a + b - k; } cout << sum << endl; }
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22]]
1
82
import itertools import numpy as np A,B,C,K = map(int,input().split()) if A+B>=K: print(A) else: print(A-(K-A-B))
import itertools import numpy as np 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
51
#include <bits/stdc++.h> using namespace std; #define fi first #define se second #define all(a) a.begin(), a.end() #define pb push_back #define mp make_pair typedef long long ll; typedef pair<ll, ll> P; typedef pair<ll, int> pli; typedef pair<int, int> pii; #define rep(i, a, b) for (ll i = a; i < b; i++) #define qrep(q...
#include <bits/stdc++.h> using namespace std; #define fi first #define se second #define all(a) a.begin(), a.end() #define pb push_back #define mp make_pair typedef long long ll; typedef pair<ll, ll> P; typedef pair<ll, int> pli; typedef pair<int, int> pii; #define rep(i, a, b) for (ll i = a; i < b; i++) #define qrep(q...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22]]
1
829
#include <cmath> #include <iostream> #include <stdio.h> #include <string.h> using namespace std; int main() { long long a, b, c, k, sum; cin >> a >> b >> c >> k; if (a > k) sum = a; else if (a + b > k) sum = a; else sum = -1 * (k - a - b) + a; cout << sum << endl; }
#include <cmath> #include <iostream> #include <stdio.h> #include <string.h> using namespace std; int main() { long long a, b, c, k, sum; cin >> a >> b >> c >> k; if (a >= k) sum = k; else if (a + b >= k) sum = a; else sum = -1 * (k - a - b) + a; cout << sum << endl; }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["-", 8, 9, 0, 57, 64, 1, 0, 11, 12, 22], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 12, 22], ["-", 75, 76, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 75, 76, 0, 57, 15, 339, 51, 16, 17, 20]]
1
84
import sys A,B,C,K = map(int,(input().split())) point = 0 if(K<=A): point=A print(point) sys.exit() else: point+=A K-=A if(K<=B): print(point) sys.exit() else: K-=B point-=K print(point)
import sys A,B,C,K = map(int,(input().split())) point = 0 if(K<=A): point=K print(point) sys.exit() else: point+=A K-=A if(K<=B): print(point) sys.exit() else: K-=B point-=K print(point)
[["-", 0, 57, 64, 196, 0, 1, 0, 662, 12, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 12, 22]]
5
82
A, B, C, K = map(int, input().split()) if K <= A: print(A) elif A < K <= A+B: print(A) else: K -= (A+B) print(A-K)
A, B, C, K = map(int, input().split()) if K <= A: print(K) elif A < K <= A+B: print(A) else: K -= (A+B) print(A-K)
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
57
#include <algorithm> #include <cmath> #include <cstdlib> #include <iostream> #include <numeric> #include <set> #include <string> #include <unordered_map> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) typedef pair<int, int> P; #define REP(i, n) for (int i = 0, i##_len = (n)...
#include <algorithm> #include <cmath> #include <cstdlib> #include <iostream> #include <numeric> #include <set> #include <string> #include <unordered_map> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) typedef pair<int, int> P; #define REP(i, n) for (int i = 0, i##_len = (n)...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18]]
1
181
A, B, C, K = map(int, input().split()) total = 0 if K <= A: total = A*1 elif A < K and K <= A+B: total = A*1 + (K - A)*0 else: total = A*1 + B*0 + (K - A - B)*(-1) print(total)
A, B, C, K = map(int, input().split()) total = 0 if K <= A: total = K*1 elif A < K and K <= A+B: total = A*1 + (K - A)*0 else: total = A*1 + B*0 + (K - A - B)*(-1) print(total)
[["-", 64, 196, 0, 1, 0, 662, 12, 657, 31, 22], ["+", 64, 196, 0, 1, 0, 662, 12, 657, 31, 22]]
5
85
a, b, c, k = map(int, input().split()) for i in range(3): if i == 0: if k <= a: print(k) break else: k -= a elif i == 1: if k <= b: print(a) break else: k -= b elif i == 2: if k < c: ...
a, b, c, k = map(int, input().split()) for i in range(3): if i == 0: if k <= a: print(k) break else: k -= a elif i == 1: if k <= b: print(a) break else: k -= b elif i == 2: if k <= c: ...
[["-", 75, 665, 64, 196, 0, 57, 15, 666, 667, 18], ["+", 75, 665, 64, 196, 0, 57, 15, 666, 667, 19]]
5
97
#include <bits/stdc++.h> #define rep(i, start, end) for (long long i = start; i < end; ++i) #define srt(x) sort((x).begin(), (x).end()); #define rsrt(x) sort((x).rbegin(), (x).rend()); #define deb(x) cout << #x << " = " << (x) << " (L" << LINE << ")" << endl; #define vdeb(x) ...
#include <bits/stdc++.h> #define rep(i, start, end) for (long long i = start; i < end; ++i) #define srt(x) sort((x).begin(), (x).end()); #define rsrt(x) sort((x).rbegin(), (x).rend()); #define deb(x) cout << #x << " = " << (x) << " (L" << LINE << ")" << endl; #define vdeb(x) ...
[["+", 0, 14, 8, 9, 0, 57, 75, 76, 0, 95], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 22], ["+", 75, 76, 0, 57, 15, 339, 51, 16, 17, 355], ["+", 0, 57, 75, 76, 0, 57, 75, 76, 0, 95]]
1
249
a, b, c, k = gets.split.map(&:to_i) ans = k if k > a k -= a + b ans -= k if k > 0 end puts ans
a, b, c, k = gets.split.map(&:to_i) ans = k if k > a ans = a k -= a + b ans -= k if k > 0 end puts ans
[["+", 0, 493, 0, 121, 64, 749, 0, 662, 31, 22], ["+", 0, 493, 0, 121, 64, 749, 0, 662, 0, 32], ["+", 0, 493, 0, 121, 64, 749, 0, 662, 12, 22]]
4
39
#define _USE_MATH_DEFINES #include <algorithm> #include <cstdlib> #include <iomanip> #include <iostream> #include <math.h> #include <numeric> #include <stdio.h> #include <vector> using namespace std; typedef long long ll; #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) int main() { ll A, B, C, K; cin >> A >>...
#define _USE_MATH_DEFINES #include <algorithm> #include <cstdlib> #include <iomanip> #include <iostream> #include <math.h> #include <numeric> #include <stdio.h> #include <vector> using namespace std; typedef long long ll; #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) int main() { ll A, B, C, K; cin >> A >>...
[["-", 8, 9, 0, 57, 64, 1, 0, 11, 12, 22], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 12, 22]]
1
111
#pragma GCC optimize("O2") #include <algorithm> #include <functional> #include <iostream> #include <numeric> #include <vector> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); long long a, b, c, k; cin >> a >> b >> c >> k; if (a + b >= k) cout << a + b * 0 << "\n"; else cout <...
#pragma GCC optimize("O2") #include <algorithm> #include <functional> #include <iostream> #include <numeric> #include <vector> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); long long a, b, c, k; cin >> a >> b >> c >> k; if (a + b >= k) cout << min(a, k) + b * 0 << "\n"; else ...
[["+", 0, 16, 31, 16, 12, 16, 31, 2, 63, 22], ["+", 31, 16, 12, 16, 31, 2, 3, 4, 0, 24], ["+", 31, 16, 12, 16, 31, 2, 3, 4, 0, 21], ["+", 31, 16, 12, 16, 31, 2, 3, 4, 0, 22], ["+", 31, 16, 12, 16, 31, 2, 3, 4, 0, 25]]
1
100
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) int main() { int64_t a, b, c, k; cin >> a >> b >> c >> k; if (a >= k) { cout << a << endl; return 0; } else if (a < k && b >= (k - a)) { cout << a << endl; return 0; } else if (a + b < k) { ...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) int main() { int64_t a, b, c, k; cin >> a >> b >> c >> k; if (a >= k) { cout << k << endl; return 0; } else if (a < k && b >= (k - a)) { cout << a << endl; return 0; } else if (a + b < k) { ...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
108
#include <iostream> using namespace std; using ll = long long int; int main() { ll a, b, c, k; cin >> a >> b >> c >> k; ll score = 0; if (k <= a) { score += k; } else score += a; if (k > (a + b) || k <= (a + b + c)) { score -= (k - a - b); } cout << score << endl; return 0; }
#include <iostream> using namespace std; using ll = long long int; int main() { ll a, b, c, k; cin >> a >> b >> c >> k; ll score = 0; if (k <= a) { score += k; } else score += a; if (k > (a + b) && k <= (a + b + c)) { score -= (k - a - b); } cout << score << endl; return 0; }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 106], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98]]
1
101
a,b,c,d=[int(x) for x in input().split()] count=a sum=a if count==d: print(a) else: count=count+b if count<d: if d-count<=c: print(sum+((d-count)*-1)) else: print(sum+(c*-1)) else: print(sum)
a,b,c,d=[int(x) for x in input().split()] count=a sum=a if count>=d: print(d) else: count=count+b if count<d: if d-count<=c: print(sum+((d-count)*-1)) else: print(sum+(c*-1)) else: print(sum)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 60], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
92
a,b,c,k=map(int,input().split()) if a>=k: print(max(a,k)) elif a+b>=k: print(a) else: x=k-a-b print(a-x)
a,b,c,k=map(int,input().split()) if a>=k: print(min(a,k)) elif a+b>=k: print(a) else: x=k-a-b print(a-x)
[["-", 0, 1, 0, 652, 3, 4, 0, 652, 63, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 652, 63, 22]]
5
60
#include <algorithm> #include <array> #include <bitset> #include <cassert> #include <cfloat> #include <chrono> #include <climits> #include <cmath> #include <cstdio> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <random> #include <set> #include <sstre...
#include <algorithm> #include <array> #include <bitset> #include <cassert> #include <cfloat> #include <chrono> #include <climits> #include <cmath> #include <cstdio> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <random> #include <set> #include <sstre...
[["-", 0, 11, 12, 16, 12, 2, 3, 4, 0, 22], ["+", 0, 11, 12, 16, 12, 2, 3, 4, 0, 22], ["-", 0, 1, 0, 11, 12, 2, 3, 4, 0, 22], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 22]]
1
568
# coding:utf-8 a, b, c, k = map(int, input().split()) point = 0 if k <= a: point += a elif k > a and (k - a) <= b: point += a elif k > a and (k - a) > b: point = a + (-1) * (k - a - b) print(point)
# coding:utf-8 a, b, c, k = map(int, input().split()) point = 0 if k <= a: point += k elif k > a and (k - a) <= b: point += a elif k > a and (k - a) > b: point = a + (-1) * (k - a - b) print(point)
[["-", 0, 57, 64, 196, 0, 1, 0, 677, 12, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 677, 12, 22]]
5
81
#include <math.h> #include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; #define PI 3.14159265359 #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define SIZE_OF_ARRAY(array) (sizeof(array) / sizeof(array[0])) int main() { int A, B, C, K; cin >> A >> B >> C >> K; ...
#include <math.h> #include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; #define PI 3.14159265359 #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define SIZE_OF_ARRAY(array) (sizeof(array) / sizeof(array[0])) int main() { int A, B, C, K; cin >> A >> B >> C >> K; ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47]]
1
103
A, B, C, K = map(int, input().split()) if A + B < K: print(A - (K - (A + B))) else: print(A)
A, B, C, K = map(int, input().split()) if A + B < K: print(A - (K - (A + B))) else: print(min(K, A))
[["+", 0, 1, 0, 652, 3, 4, 0, 652, 63, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 21], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
47
#include <bits/stdc++.h> using namespace std; #include <cstdlib> #define rep(i, n) for (int(i) = 0; (i) < (n); (i)++) int main() { int64_t a, b, c, k; cin >> a >> b >> c >> k; if (a >= k) cout << a; else if (a + b >= k) cout << a; else cout << a - (k - a - b); }
#include <bits/stdc++.h> using namespace std; #include <cstdlib> #define rep(i, n) for (int(i) = 0; (i) < (n); (i)++) int main() { int64_t a, b, c, k; cin >> a >> b >> c >> k; if (a >= k) cout << k; else if (a + b >= k) 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
77
#include <bits/stdc++.h> #define int long long const int INF = 1e18L + 5; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep2(i, s, n) for (int i = (s); i < (int)(n); i++) using namespace std; signed main() { cin.tie(0); ios_base::sync_with_stdio(false); int a, b, c, k; cin >> a >> b >> c >> k;...
#include <bits/stdc++.h> #define int long long const int INF = 1e18L + 5; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep2(i, s, n) for (int i = (s); i < (int)(n); i++) using namespace std; signed main() { cin.tie(0); ios_base::sync_with_stdio(false); int a, b, c, k; cin >> a >> b >> c >> k;...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22]]
1
129
#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 < K <= A + B) { 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 < K && K <= A + B) { cout << A << endl; } else { cout << A - (K - (A + B)) << endl; } }
[["+", 75, 76, 0, 57, 15, 339, 51, 16, 17, 98], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22]]
1
83
/* oj d https://atcoder.jp/contests/abc167/tasks/abc167_b g++ B.cpp oj t oj s https://atcoder.jp/contests/abc167/tasks/abc167_b B.cpp */ #include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll A, B, C, K; cin >> A >> B >> C >> K; if (K <= A + B) { cout << A << end...
/* oj d https://atcoder.jp/contests/abc167/tasks/abc167_b g++ B.cpp oj t oj s https://atcoder.jp/contests/abc167/tasks/abc167_b B.cpp */ #include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll A, B, C, K; cin >> A >> B >> C >> K; if (K <= A + B) { cout << min(K, A...
[["+", 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], ["-", 0, 57, 75, 76, 0, 9, 0, 43, 39, 40], ["+", 0, 57, 75, 76, 0, 9, 0, 43, 39, 78]]
1
75
// Author - Abhishek giri #include <bits/stdc++.h> using namespace std; #define ll long long int #define pb push_back #define mp make_pair #define mod 100000000007 #define V(type) vector<type> #define all(c) ((c).begin(), (c).end()) #define in(var) cin >> (var) #define out(var) cout << (var) #define on(var) cout << va...
// Author - Abhishek giri #include <bits/stdc++.h> using namespace std; #define ll long long int #define pb push_back #define mp make_pair #define mod 100000000007 #define V(type) vector<type> #define all(c) ((c).begin(), (c).end()) #define in(var) cin >> (var) #define out(var) cout << (var) #define on(var) cout << va...
[["-", 0, 57, 64, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 16, 12, 22]]
1
216
#include <bits/stdc++.h> #define rep(i, x) for (int i = 0; i < (int)(x); i++) #define PI 3.14159265359 using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; int ans = 0, i = 0; if (k < a) { cout << k; return 0; } ans += a; k -= a; k -= b; if (k > 0) ans -= (b - k); ...
#include <bits/stdc++.h> #define rep(i, x) for (int i = 0; i < (int)(x); i++) #define PI 3.14159265359 using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; int ans = 0, i = 0; if (k <= a) { cout << k; return 0; } ans += a; k -= a; k -= b; if (k > 0) ans -= k; cout ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["-", 0, 57, 64, 1, 0, 11, 12, 23, 0, 24], ["-", 64, 1, 0, 11, 12, 23, 0, 16, 31, 22], ["-", 64, 1, 0, 11, 12, 23, 0, 16, 17, 33], ["-", 0, 57, 64, 1, 0, 11, 12, 23, 0, 25]]
1
102
#include <bits/stdc++.h> using namespace std; #define pb push_back #define all(v) v.begin(), v.end() #define mem(arr) memset(arr, 0, sizeof(arr)) #define ff first #define ss second #define int long long int const int MOD = 1e9 + 7; const int INF = 1e18; const int N = 1e6 + 20; vector<int> g[N]; vector<int> vis(N); int3...
#include <bits/stdc++.h> using namespace std; #define pb push_back #define all(v) v.begin(), v.end() #define mem(arr) memset(arr, 0, sizeof(arr)) #define ff first #define ss second #define int long long int const int MOD = 1e9 + 7; const int INF = 1e18; const int N = 1e6 + 20; vector<int> g[N]; vector<int> vis(N); int3...
[["+", 0, 1, 0, 16, 31, 16, 12, 16, 31, 22]]
1
171
a,b,c,k = map(int,input().split()) if k <= a: print(k) else: if k>a and k <= a+b: print(a) else: print(k-a)
a,b,c,k = map(int,input().split()) if k <= a: print(k) else: if k>a and k <= a+b: print(a) else: print(a-(k-a-b))
[["+", 0, 1, 0, 652, 3, 4, 0, 657, 31, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 33], ["+", 0, 652, 3, 4, 0, 657, 12, 23, 0, 24], ["+", 3, 4, 0, 657, 12, 23, 0, 657, 17, 33], ["+", 3, 4, 0, 657, 12, 23, 0, 657, 12, 22], ["+", 0, 652, 3, 4, 0, 657, 12, 23, 0, 25]]
5
54
a, b, c, k = list(map(int, input().split())) score = 0 if k >= a: score += a k -= a if k >= b: k -= b if k >= c: score -= c else: score -= k else: score = a print(score)
a, b, c, k = list(map(int, input().split())) score = 0 if k >= a: score += a k -= a if k >= b: k -= b if k >= c: score -= c else: score -= k else: score += k print(score)
[["-", 75, 76, 8, 196, 0, 1, 0, 662, 0, 32], ["-", 75, 76, 8, 196, 0, 1, 0, 662, 12, 22], ["+", 75, 76, 8, 196, 0, 1, 0, 677, 17, 107], ["+", 75, 76, 8, 196, 0, 1, 0, 677, 12, 22]]
5
67
a,b,c,k = map(int,input().split()) if a >= k: print(a) elif a + b >= k: print(a) else: print(a-((a+b)-k)*-1)
a,b,c,k = map(int,input().split()) if a >= k: print(k) elif a + b >= k: print(a) else: print(a-((a+b)-k)*-1)
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
59
/*“proffeser,berlin,rio,arjun,kabirsingh,carry”*/ #include <bits/stdc++.h> #define ll long long int #define ld long double #define pb push_back #define pob pop_back #define vi vector<ll> #define mp make_pair #define sz size() #define rep1(i, n) for (ll i = 1; i <= n; i++) #define rep(i, n) for (ll i = 0; i < n; i++) #...
/*“proffeser,berlin,rio,arjun,kabirsingh,carry”*/ #include <bits/stdc++.h> #define ll long long int #define ld long double #define pb push_back #define pob pop_back #define vi vector<ll> #define mp make_pair #define sz size() #define rep1(i, n) for (ll i = 1; i <= n; i++) #define rep(i, n) for (ll i = 0; i < n; i++) #...
[["-", 0, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 0, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35]]
1
243
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; int ans = a; k -= a; if (k <= 0) cout << k << endl; else { k -= b; if (k <= 0) cout << a << endl; else cout << ans - k << endl; } return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; int ans = a; k -= a; if (k <= 0) cout << k + a << endl; else { k -= b; if (k <= 0) cout << a << endl; else cout << ans - k << endl; } return 0; }
[["+", 64, 1, 0, 16, 31, 16, 12, 16, 17, 72], ["+", 64, 1, 0, 16, 31, 16, 12, 16, 12, 22]]
1
83
#include <iostream> using namespace std; int main() { int a, b, c, k; cin >> a >> c >> k; if (a > k) { cout << k; } else if (a + b > k) { cout << a; } else { cout << a - (k - a - b); } return 0; }
#include <iostream> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; if (a > k) { cout << k; } else if (a + b > k) { cout << a; } else { cout << a - (k - a - b); } return 0; }
[["+", 0, 1, 0, 16, 31, 16, 31, 16, 12, 22], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 17, 152]]
1
74
#include <bits/stdc++.h> #include <bitset> #include <iostream> #include <stdio.h> #include <stdlib.h> #include <string> //#include <boost/multiprecision/cpp_dec_float.hpp> //#include <boost/multiprecision/cpp_int.hpp> // namespace mp = boost::multiprecision; //// 任意長整数型 // using Bint = mp::cpp_int; //// 仮数部が1024ビットの浮動...
#include <bits/stdc++.h> #include <bitset> #include <iostream> #include <stdio.h> #include <stdlib.h> #include <string> //#include <boost/multiprecision/cpp_dec_float.hpp> //#include <boost/multiprecision/cpp_int.hpp> // namespace mp = boost::multiprecision; //// 任意長整数型 // using Bint = mp::cpp_int; //// 仮数部が1024ビットの浮動...
[["-", 12, 16, 12, 16, 12, 23, 0, 16, 12, 22], ["+", 12, 16, 12, 23, 0, 16, 31, 16, 12, 22], ["+", 12, 16, 12, 16, 12, 23, 0, 16, 17, 33], ["+", 12, 16, 12, 16, 12, 23, 0, 16, 12, 22]]
1
140
#include <bits/stdc++.h> using namespace std; main() { int a, b, c, k; cin >> a >> b >> c >> k; if (k <= a) { cout << a << endl; } else if (k <= (a + b)) { cout << a << endl; } else { cout << a - (k - (a + b)) << endl; } }
#include <bits/stdc++.h> using namespace std; main() { int a, b, c, k; cin >> a >> b >> c >> k; if (k <= a) { cout << k << endl; } else if (k <= (a + b)) { cout << a << endl; } else { cout << a - (k - (a + b)) << endl; } }
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
82
# n = int(input()) a, b, c, k = map(int, input().split()) # l = list(map(int, input().split())) if k <= a: print(k) elif a < k <= a+b: print(a) elif a+b < k <= a+b+c: # print(a - (k - a)) print(a-(c - b))
# n = int(input()) a, b, c, k = map(int, input().split()) # l = list(map(int, input().split())) if k <= a: print(k) elif a < k <= a+b: print(a) elif a+b < k <= a+b+c: # print(a - (k - a)) print(a-(k - a - b))
[["-", 3, 4, 0, 657, 12, 23, 0, 657, 31, 22], ["+", 0, 657, 12, 23, 0, 657, 31, 657, 31, 22], ["+", 0, 657, 12, 23, 0, 657, 31, 657, 17, 33], ["+", 0, 657, 12, 23, 0, 657, 31, 657, 12, 22]]
5
68
#include <bits/stdc++.h> using namespace std; int main() { long int a, b, c, k; cin >> a >> b >> c >> k; long int ans = 0; if (a >= k) ans = k; else if (a + b >= k) ans = a; else ans = a + c - k; cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; int main() { long int a, b, c, k; cin >> a >> b >> c >> k; long int ans = 0; if (a >= k) ans = k; else if (a + b >= k) ans = a; else ans = 2 * a + b - k; cout << ans << endl; }
[["+", 0, 11, 12, 16, 31, 16, 31, 16, 31, 13], ["+", 0, 11, 12, 16, 31, 16, 31, 16, 17, 48], ["-", 0, 1, 0, 11, 12, 16, 31, 16, 12, 22], ["+", 0, 1, 0, 11, 12, 16, 31, 16, 12, 22]]
1
76
A, B, C, K = map(int, input().split()) if K < A: print(K) elif A <= K <= A + B: print(A) else: print(A - (K - A))
A, B, C, K = map(int, input().split()) if K < A: print(K) elif A <= K <= A + B: print(A) else: print(A - (K - A - B))
[["+", 3, 4, 0, 657, 12, 23, 0, 657, 17, 33], ["+", 3, 4, 0, 657, 12, 23, 0, 657, 12, 22]]
5
54
#include <iostream> using namespace std; int main() { long long A, B, C, K; cin >> A >> B >> C >> K; long long ans = 0; if (K >= A) { ans = A; K = K - A; } else { ans = K; cout << ans << endl; return 0; } if (K == 0) { cout << ans << endl; return 0; } if (K >= B) { K -...
#include <iostream> using namespace std; int main() { long long A, B, C, K; cin >> A >> B >> C >> K; long long ans = 0; if (K >= A) { ans = A; K = K - A; } else { ans = K; cout << ans << endl; return 0; } if (K == 0) { cout << ans << endl; return 0; } if (K >= B) { K -...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["-", 0, 57, 64, 9, 0, 1, 0, 11, 17, 110], ["-", 64, 9, 0, 1, 0, 11, 12, 16, 17, 33], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 110]]
1
173
a, b, c, k = map(int, input().split()) sum = 0 if k > a: sum = a if k-a <= b: sum = a else: sum = 2*a+b-k print(sum)
a, b, c, k = map(int, input().split()) sum = k if k > a: sum = a if k-a <= b: sum = a else: sum = 2*a+b-k print(sum)
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 22]]
5
56
a = [int(i) for i in input().split()] k = a.pop() ans = 0 for i in range(3): if i==0: if k<=a[i]: ans = k break else: ans += a[i] k -= a[i] elif i==1: if k<a[i]: break else: k -= a[i] continue ...
a = [int(i) for i in input().split()] k = a.pop() ans = 0 for i in range(3): if i==0: if k<=a[i]: ans = k break else: ans += a[i] k -= a[i] elif i==1: if k<a[i]: break else: k -= a[i] continue ...
[["-", 75, 76, 8, 196, 0, 57, 15, 666, 667, 18], ["+", 75, 76, 8, 196, 0, 57, 15, 666, 667, 19]]
5
112
a,b,c,k=map(int,input().split()) if k <= a: print(k) if k <= a+b and k>a: print(a) else: print(a-(k-a-b))
a,b,c,k=map(int,input().split()) if k <= a: print(k) if k <= a+b and k>a: print(a) if k > a+b: print(a-(k-a-b))
[["-", 36, 36, 0, 656, 0, 57, 75, 76, 0, 95], ["+", 36, 36, 36, 36, 0, 656, 0, 57, 0, 121], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47], ["+", 0, 656, 0, 57, 15, 666, 0, 657, 31, 22], ["+", 0, 656, 0, 57, 15, 666, 0, 657, 17, 72], ["+", 0, 656, 0, 57, 15, 666, 0, 657, 12...
5
58
a,b,c,k = map(int,input().split()) i = k - a if i <= 0: print(a) exit() else: j= i - b if j <= 0: print(a) exit() else: print(a - j)
a,b,c,k = map(int,input().split()) i = k - a if i <= 0: print(k) exit() else: j= i - b if j <= 0: print(a) exit() else: print(a - j)
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
64