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> //sort,二分探索,など #include <bitset> //固定長bit集合 #include <cmath> //pow,logなど #include <complex> //複素数 #include <deque> //両端アクセスのキュー #include <functional> //sortのgreater #include <iomanip> //setprecision(浮動小数点の出力の誤差) #include <iostream> //入出力 #include <iter...
#include <algorithm> //sort,二分探索,など #include <bitset> //固定長bit集合 #include <cmath> //pow,logなど #include <complex> //複素数 #include <deque> //両端アクセスのキュー #include <functional> //sortのgreater #include <iomanip> //setprecision(浮動小数点の出力の誤差) #include <iostream> //入出力 #include <iter...
[["+", 8, 9, 0, 1, 0, 11, 12, 2, 63, 22], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 24], ["+", 12, 2, 3, 4, 0, 2, 3, 4, 0, 25], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 21], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 13]]
1
148
#include <stdio.h> #include <string.h> int main() { int sum = 0, a, b, c, k; scanf("%d%d%d%d", &a, &b, &c, &k); if (a >= k) { sum += a; printf("%d", sum); return 0; } else { sum += a; k -= a; } if (b >= k) { printf("%d", sum); return 0; } else { k -= b; } if (c >= k) { ...
#include <stdio.h> #include <string.h> int main() { int sum = 0, a, b, c, k; scanf("%d%d%d%d", &a, &b, &c, &k); if (a >= k) { sum += k; printf("%d", sum); return 0; } else { sum += a; k -= a; } if (b >= k) { printf("%d", sum); return 0; } else { k -= b; } if (c >= k) { ...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22]]
1
131
#include <bits/stdc++.h> using namespace std; int main() { int A, B, C, K; cin >> A >> B >> C >> K; if (A >= K) return cout << K << endl, 0; if (A + B >= K) return cout << A << endl, 0; if (A + B + C >= K) return cout << 2 * A - K << endl, 0; }
#include <bits/stdc++.h> using namespace std; int main() { int A, B, C, K; cin >> A >> B >> C >> K; if (A >= K) return cout << K << endl, 0; if (A + B >= K) return cout << A << endl, 0; if (A + B + C >= K) return cout << 2 * A + B - K << endl, 0; }
[["+", 31, 16, 31, 16, 12, 16, 31, 16, 17, 72], ["+", 31, 16, 31, 16, 12, 16, 31, 16, 12, 22]]
1
86
#include <iostream> using namespace std; int main() { int a, b, c, d; cin >> a >> b >> c >> d; if (a + b >= d) cout << a << endl; else { d = d - a - b; cout << a - min(d, c) << endl; } return 0; }
#include <iostream> using namespace std; int main() { int a, b, c, d; cin >> a >> b >> c >> d; if (a + b >= d) cout << min(a, d) << endl; else { d = d - a - b; cout << a - min(d, c) << endl; } return 0; }
[["+", 64, 1, 0, 16, 31, 16, 12, 2, 63, 22], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 24], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 21], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 22], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 25]]
1
72
A, B, C, K = list(map(int, input().split())) cards = 0 ans = 0 if A >= K: ans += A else: ans += A cards += A if cards + B >= K: pass else: cards += B ans += -1 * (K - cards) print(ans)
A, B, C, K = list(map(int, input().split())) cards = 0 ans = 0 if A >= K: ans = K else: ans += A cards += A if cards + B >= K: pass else: cards += B ans += -1 * (K - cards) print(ans)
[["-", 0, 57, 64, 196, 0, 1, 0, 677, 17, 107], ["-", 0, 57, 64, 196, 0, 1, 0, 677, 12, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 0, 32], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 12, 22]]
5
72
#include <bits/stdc++.h> #ifdef ONLINE_JUDGE #define endl "\n" #endif using namespace std; typedef long long LL; typedef vector<int> VI; typedef pair<int, int> PII; #define yes cout << "YES\n"; #define no cout << "NO\n"; #define yesno(f) \ if (f) ...
#include <bits/stdc++.h> #ifdef ONLINE_JUDGE #define endl "\n" #endif using namespace std; typedef long long LL; typedef vector<int> VI; typedef pair<int, int> PII; #define yes cout << "YES\n"; #define no cout << "NO\n"; #define yesno(f) \ if (f) ...
[["+", 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
158
import java.util.*; public class Main { public static void main(String[] args) { Scanner s = new Scanner(System.in); long a = s.nextLong(); long b = s.nextLong(); long c = s.nextLong(); long k = s.nextLong(); long ans = 0; if (k > (a + b)) { ans = k - (a + b) - a; } else if (k >=...
import java.util.*; public class Main { public static void main(String[] args) { Scanner s = new Scanner(System.in); long a = s.nextLong(); long b = s.nextLong(); long c = s.nextLong(); long k = s.nextLong(); long ans = 0; if (k >= (a + b)) { ans = a - (k - (a + b)); } else if (k...
[["-", 8, 196, 0, 57, 15, 15, 0, 16, 17, 47], ["+", 8, 196, 0, 57, 15, 15, 0, 16, 17, 20], ["+", 64, 196, 0, 1, 0, 11, 12, 16, 31, 22], ["+", 64, 196, 0, 1, 0, 11, 12, 16, 17, 33], ["+", 0, 1, 0, 11, 12, 16, 12, 23, 0, 24], ["-", 64, 196, 0, 1, 0, 11, 12, 16, 17, 33], ["-", 64, 196, 0, 1, 0, 11, 12, 16, 12, 22], ["+", ...
3
129
l = list(map(int,input().split(' '))) x_1 = l[0] x_0 = l[1] x_neg = l[2] K = l[3] if (K<=x_1): print(x_1) elif (K-x_1<=x_0): print(x_1) else : print(x_1 -(K-x_1-x_0))
l = list(map(int,input().split(' '))) x_1 = l[0] x_0 = l[1] x_neg = l[2] K = l[3] if (K<=x_1): print(K) elif (K-x_1<=x_0): print(x_1) else : print(x_1 -(K-x_1-x_0))
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
82
# abc167 b a, b, c, k = [int(i) for i in input().split()] ans = 0 if k < a: ans = 0 elif k < a + b: ans = a else: ans = a - (k-(a+b)) print(ans)
# abc167 b a, b, c, k = [int(i) for i in input().split()] ans = 0 if k <= a: ans = k elif k <= a + b: ans = a else: ans = a - (k-(a+b)) print(ans)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 18], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 19], ["-", 0, 57, 64, 196, 0, 1, 0, 662, 12, 612], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 12, 22], ["-", 0, 656, 0, 57, 75, 665, 15, 666, 667, 18], ["+", 0, 656, 0, 57, 75, 665, 15, 666, 667, 19]]
5
65
#include <bits/stdc++.h> using namespace std; int main() { long long int a, b, c, k, ans; cin >> a >> b >> c >> k; if (a >= k) { cout << k; return 0; } else { k -= a; if (b >= k) { cout << a; return 0; } else { k -= b; cout << a + b - k; return 0; } } re...
#include <bits/stdc++.h> using namespace std; int main() { long long int a, b, c, k, ans; cin >> a >> b >> c >> k; if (a >= k) { cout << k; return 0; } else { k -= a; if (b >= k) { cout << a; return 0; } else { k -= b; cout << a - k; return 0; } } return...
[["-", 0, 1, 0, 16, 12, 16, 31, 16, 17, 72], ["-", 0, 1, 0, 16, 12, 16, 31, 16, 12, 22]]
1
93
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; int ans = 0; if (k <= a) ans = k; else if (k > a && k <= (a + b)) ans = a; else if (k > a && k > (a + b) && k <= (a + b + c)) ans = a - c; cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; int ans = 0; if (k <= a) ans = k; else if (k > a && k <= (a + b)) ans = a; else if (k > a && k > (a + b) && k <= (a + b + c)) 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], ["+", 64, 1, 0, 11, 12, 16, 31, 16, 17, 72], ["+", 64, 1, 0, 11, 12, 16, 31, 16, 12, 22], ["-", 0, 57, 64, 1, 0, 11, 12, 16, 12, 22], ["+", 0, 57, 64, 1, 0, 11, 12, 16, 12, 22]]
1
102
a,b,c,k = map(int,input()) if k<a: print(k) elif k < a+b: print(a) else: print(2*a+b-k)
a,b,c,k = map(int,input().split()) if k<a: print(k) elif k < a+b: print(a) else: print(2*a+b-k)
[["+", 12, 652, 3, 4, 0, 652, 63, 319, 0, 131], ["+", 12, 652, 3, 4, 0, 652, 63, 319, 319, 22], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25]]
5
48
a,b,c,k = map(int,list(input().split())) if k<=a: result = k elif k<=a+b: result = a elif k<=a+b+c: result = a-k print(result)
a,b,c,k = map(int,list(input().split())) if k<=a: result = k elif k<=a+b: result = a elif k<=a+b+c: result = a-(k-a-b) print(result)
[["+", 0, 1, 0, 662, 12, 657, 12, 23, 0, 24], ["+", 12, 657, 12, 23, 0, 657, 31, 657, 17, 33], ["+", 12, 657, 12, 23, 0, 657, 31, 657, 12, 22], ["+", 0, 662, 12, 657, 12, 23, 0, 657, 17, 33], ["+", 0, 662, 12, 657, 12, 23, 0, 657, 12, 22], ["+", 0, 1, 0, 662, 12, 657, 12, 23, 0, 25]]
5
59
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String line = sc.nextLine(); String column[] = line.split(" "); int card1 = Integer.parseInt(column[0]); int card0 = Integer.parseInt(column[1]); int draw = Integer.pars...
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String line = sc.nextLine(); String column[] = line.split(" "); int card1 = Integer.parseInt(column[0]); int card0 = Integer.parseInt(column[1]); int draw = Integer.pars...
[["-", 64, 196, 0, 1, 0, 492, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 492, 3, 4, 0, 22]]
3
154
A, B, C, K = map(int, input().split()) print(A - max(K - A - B, 0))
A, B, C, K = map(int, input().split()) print(min(A, K) - max(K - A - B, 0))
[["+", 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
35
A,B,C,K=[int(x) for x in input().split()] S=A K-=A if K>0: K-=B if K>0: S-=K print(S)
A,B,C,K=[int(x) for x in input().split()] S=min(K,A) K-=A if K>0: K-=B if K>0: S-=K print(S)
[["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 21], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25]]
5
50
#include <bits/stdc++.h> using namespace std; using lint = long long; const lint inf = 1LL << 60; const lint mod = 1000000007; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); lint a, b, c, k; cin >> a >> b >> c >> k; if (k <= a) cout << a << "\n"; else if (k <= a + b) cout << a << "\n";...
#include <bits/stdc++.h> using namespace std; using lint = long long; const lint inf = 1LL << 60; const lint mod = 1000000007; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); lint a, b, c, k; cin >> a >> b >> c >> k; if (k <= a) cout << k << "\n"; else if (k <= a + b) cout << a << "\n";...
[["-", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22], ["+", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22]]
1
116
a,b,c,k = map(int, input().split()) if k<=a: print(a) elif a < k <= a+b: print(a) elif a+b < k <= a+b+c: print(a-(k-a-b)) elif a+b+c < k: print(a-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(a-(k-a-b)) elif a+b+c < k: print(a-c)
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
82
#include <bits/stdc++.h> using namespace std; #define rep(i, a, n) for (int i = a; i < n; i++) #define sz(A) (int)(A.size()) #define all(x) (x).begin(), (x).end() #define get(c, x) (lower_bound(c.begin(), c.end(), x) - c.begin()) typedef long long ll; typedef pair<int, int> PII; typedef vector<int> VI; void solve() { ...
#include <bits/stdc++.h> using namespace std; #define rep(i, a, n) for (int i = a; i < n; i++) #define sz(A) (int)(A.size()) #define all(x) (x).begin(), (x).end() #define get(c, x) (lower_bound(c.begin(), c.end(), x) - c.begin()) typedef long long ll; typedef pair<int, int> PII; typedef vector<int> VI; void solve() { ...
[["+", 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
167
A, B, C, K = map(int, input().split()) if K <= A: print(A) elif K <= A + B: print(A) else: print(2 * A + B - K)
A, B, C, K = map(int, input().split()) if K <= A: print(K) elif K <= A + B: 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
52
#include <bits/stdc++.h> #include <iostream> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) int main() { int A, B, C, K; cin >> A >> B >> C >> K; if (K <= A) cout << K << endl; else if (K <= A + B) cout << A << endl; else cout << A - (K = A - B) << endl; return 0; }
#include <bits/stdc++.h> #include <iostream> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) int main() { int A, B, C, K; cin >> A >> B >> C >> K; if (K <= A) cout << K << endl; else if (K <= A + B) cout << A << endl; else cout << A - (K - A - B) << endl; return 0; }
[["-", 31, 16, 12, 16, 12, 23, 0, 42, 0, 32], ["+", 12, 16, 12, 23, 0, 16, 31, 16, 17, 33]]
1
86
#include <stdio.h> int main() { long a, b, c, k; scanf("%ld%ld%ld%ld", &a, &b, &c, &k); if (k <= a) { printf("%ld", a); } else if (k > a && k <= a + b) { printf("%ld", a); } else { printf("%ld", a - (k - a - b)); } }
#include <stdio.h> int main() { long a, b, c, k; scanf("%ld%ld%ld%ld", &a, &b, &c, &k); if (k <= a) { printf("%ld", k); } else if (k > a && k <= a + b) { printf("%ld", a); } else { printf("%ld", a - (k - a - b)); } }
[["-", 64, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 64, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
0
97
src = list(map(lambda x : int(x), input().split(' '))) dst = 0 k = src[3] dst += (src[0] if src[0] <= k else k) k -= dst if k != 0: k -= (src[1] if src[1] <= k else k) if k != 0: dst -= (src[1] if src[1] <= k else k) print(dst)
src = list(map(lambda x : int(x), input().split(' '))) dst = 0 k = src[3] dst += (src[0] if src[0] <= k else k) k -= dst if k != 0: k -= (src[1] if src[1] <= k else k) if k != 0: dst -= (src[2] if src[2] <= k else k) print(dst)
[["-", 0, 677, 12, 23, 0, 41, 0, 206, 206, 612], ["+", 0, 677, 12, 23, 0, 41, 0, 206, 206, 612], ["-", 12, 23, 0, 41, 0, 666, 0, 206, 206, 612], ["+", 12, 23, 0, 41, 0, 666, 0, 206, 206, 612]]
5
103
#include <bits/stdc++.h> using namespace std; #define ll long long #define pll pair<ll, ll> #define vpll vector<pll> #define pb push_back #define f(i, a, n) for (ll i = a; i < n; i++) const ll N = 2e5; int main() { ll a, b, c, k; cin >> a >> b >> c >> k; if (a >= k) cout << a; else if ((a + b) >= k) co...
#include <bits/stdc++.h> using namespace std; #define ll long long #define pll pair<ll, ll> #define vpll vector<pll> #define pb push_back #define f(i, a, n) for (ll i = a; i < n; i++) const ll N = 2e5; int main() { ll a, b, c, k; cin >> a >> b >> c >> k; if (a >= k) cout << k; else if ((a + b) >= k) co...
[["-", 8, 9, 0, 57, 64, 1, 0, 16, 12, 22], ["+", 8, 9, 0, 57, 64, 1, 0, 16, 12, 22]]
1
100
#include <algorithm> #include <iostream> #include <map> #include <queue> #include <vector> #define rep(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; using ll = long long; using P = pair<int, int>; using pq = priority_queue<int>; using q = queue<int>; int main() { int a, b, c, k; cin >> a >> b >> c ...
#include <algorithm> #include <iostream> #include <map> #include <queue> #include <vector> #define rep(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; using ll = long long; using P = pair<int, int>; using pq = priority_queue<int>; using q = queue<int>; int main() { int a, b, c, k; cin >> a >> b >> c ...
[["-", 0, 14, 8, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 22]]
1
128
import java.util.Scanner; public class Main { public static void main(String args[]) { Scanner in = new Scanner(System.in); long A = in.nextLong(); long B = in.nextLong(); long C = in.nextLong(); long K = in.nextLong(); //[1,2,3] K=4 if (K < A) { System.out.println(K); } els...
import java.util.Scanner; public class Main { public static void main(String args[]) { Scanner in = new Scanner(System.in); long A = in.nextLong(); long B = in.nextLong(); long C = in.nextLong(); long K = in.nextLong(); //[1,2,3] K=4 if (K < A) { System.out.println(K); } els...
[["-", 3, 4, 0, 16, 12, 23, 0, 16, 17, 72], ["+", 3, 4, 0, 16, 12, 23, 0, 16, 17, 33]]
3
149
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
61
#include <algorithm> #include <complex> #include <cstdlib> #include <ctime> #include <iomanip> #include <iostream> #include <limits> #include <locale> #include <map> #include <math.h> #include <numeric> #include <queue> #include <random> #include <set> #include <sstream> #include <stack> #include <string> #include <tim...
#include <algorithm> #include <complex> #include <cstdlib> #include <ctime> #include <iomanip> #include <iostream> #include <limits> #include <locale> #include <map> #include <math.h> #include <numeric> #include <queue> #include <random> #include <set> #include <sstream> #include <stack> #include <string> #include <tim...
[["-", 0, 14, 8, 9, 0, 1, 0, 11, 17, 110], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 24], ["+", 0, 11, 12, 2, 3, 4, 0, 16, 31, 22], ["+", 0, 11, 12, 2, 3, 4, 0, 16, 17, 33], ["+", 12, 2, 3, 4, 0, 16, 12, 23, 0, 25]]
1
227
a,b,c,k = map(int, input().split()) r = min(a,k) k = k - a if k > 0: k = k - b if k > 0: r -= min(r,k) print(r)
a,b,c,k = map(int, input().split()) r = min(a,k) k = k - a if k > 0: k = k - b if k > 0: r -= min(c,k) print(r)
[["-", 0, 1, 0, 677, 12, 652, 3, 4, 0, 22], ["+", 0, 1, 0, 677, 12, 652, 3, 4, 0, 22]]
5
60
package main import ( "fmt" ) func main(){ var A,B,C,K int fmt.Scan(&A,&B,&C,&K) if A >= K { fmt.Println(K) return } else if(A+B >= K) { fmt.Println(A) return }else if(A+B+C >= K) { fmt.Println(A + (K - B - C)) return } }
package main import ( "fmt" ) func main(){ var A,B,C,K int fmt.Scan(&A,&B,&C,&K) if A >= K { fmt.Println(K) return } else if(A+B >= K) { fmt.Println(A) return }else if(A+B+C >= K) { fmt.Println(A - (K - A - B)) return } }
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["-", 0, 16, 12, 23, 0, 16, 31, 16, 12, 22], ["+", 0, 16, 12, 23, 0, 16, 31, 16, 12, 22], ["-", 3, 4, 0, 16, 12, 23, 0, 16, 12, 22], ["+", 3, 4, 0, 16, 12, 23, 0, 16, 12, 22]]
7
111
a, b, c, k = [int(i) for i in input().split()] if a >= k or a + b >= k: print(a) else: print(a - (k - a - b))
a, b, c, k = [int(i) for i in input().split()] if a >= k: print(k) elif a + b >= k: print(a) else: print(a - (k - a - b))
[["-", 36, 36, 0, 656, 0, 57, 15, 679, 17, 354], ["+", 36, 36, 36, 36, 0, 656, 0, 57, 0, 102], ["+", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25], ["+", 36, 36, 0, 656, 0, 57, 75, 665, 0, 683]]
5
53
a,b,c,k=map(int,input().split()) if k>(a+b): print(a-1*(k-(a+b))) elif k<=(a+b): print(a) else: print(k)
a,b,c,k=map(int,input().split()) if k>(a+b): print(a-1*(k-(a+b))) elif a<k and k<=(a+b): print(a) else: print(k)
[["+", 0, 57, 75, 665, 15, 679, 31, 666, 0, 22], ["+", 0, 57, 75, 665, 15, 679, 31, 666, 667, 18], ["+", 0, 656, 0, 57, 75, 665, 15, 679, 17, 355]]
5
64
a, b, c, k = list(map(int, input().split())) maxim=0 if a < k: maxim+=a k-=a else: print(a) exit() if b < k: k-=b else: print(maxim) exit() print(maxim-k)
a, b, c, k = list(map(int, input().split())) maxim=0 if a < k: maxim+=a k-=a else: print(k) exit() if b < k: k-=b else: print(maxim) exit() print(maxim-k)
[["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
69
i = input() j = i.split(" ") a = int(j[0]) b = int(j[1]) c = int(j[2]) k = int(j[3]) s = 0 if a < k : s += a if b < k-a : s -= k-a-c print(s) elif b == k-a : print(s) else : print(s) elif a == k : s += a print(s) else : s += k ...
i = input() j = i.split(" ") a = int(j[0]) b = int(j[1]) c = int(j[2]) k = int(j[3]) s = 0 if a < k : s += a if b < k-a : s -= k-a-b print(s) elif b == k-a : print(s) else : print(s) elif a == k : s += a print(s) else : s += k ...
[["-", 64, 196, 0, 1, 0, 677, 12, 657, 12, 22], ["+", 64, 196, 0, 1, 0, 677, 12, 657, 12, 22]]
5
118
A,B,C,K = int(input().split(' ')) out = 0 if A>K: print(K) else: out += A K -= A if B > K: print(out) else: K -= B out -= K print(out)
A,B,C,K = map(int,input().split(' ')) out = 0 if A>K: print(K) else: out += A K -= A if B > K: print(out) else: K -= B out -= K print(out)
[["-", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 21]]
5
62
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; int output = 0; if (a >= k) { output = k; } else { if (b + a >= k) { output = a; } else { output = a + (k - a - b); } } cout << output << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; int output = 0; if (a >= k) { output = k; } else { if (b + a >= k) { output = a; } else { output = a - (k - a - b); } } cout << output << endl; return 0; }
[["-", 0, 9, 0, 1, 0, 11, 12, 16, 17, 72], ["+", 0, 9, 0, 1, 0, 11, 12, 16, 17, 33]]
1
89
#include <bits/stdc++.h> using namespace std; #define endl '\n' #define rep(n) for (int i = 0; i < n; i++) #define all(a) a.begin(), a.end() #define NumofDigits(n) ((long long)log10(n) + 1) #define Unique(n) (n).erase(unique(all(n)), (n).end()) typedef long long ll; /* PANDA ...
#include <bits/stdc++.h> using namespace std; #define endl '\n' #define rep(n) for (int i = 0; i < n; i++) #define all(a) a.begin(), a.end() #define NumofDigits(n) ((long long)log10(n) + 1) #define Unique(n) (n).erase(unique(all(n)), (n).end()) typedef long long ll; /* PANDA ...
[["-", 64, 9, 0, 37, 0, 34, 31, 16, 12, 22], ["+", 64, 9, 0, 37, 0, 34, 31, 16, 12, 22]]
1
208
a,b,c,k=map(int,input().split()) if a>=k: print(k) else: s=k-a if a+b>=s: print(a) else: t=k-a-b print(a-t)
a,b,c,k=map(int,input().split()) if a>=k: print(k) else: s=k-a if b>=s: print(a) else: t=k-a-b print(a-t)
[["-", 8, 196, 0, 57, 15, 666, 0, 657, 31, 22], ["-", 8, 196, 0, 57, 15, 666, 0, 657, 17, 72]]
5
62
# coding: utf-8 # Your code here! A, B, C, K = map(int, input().split()) ans = 0 if A > K: ans = K elif A + B >= K: ans = A else: ans = A - (K - C) print(ans)
# coding: utf-8 # Your code here! A, B, C, K = map(int, input().split()) ans = 0 if A > K: ans = K elif A + B >= K: 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
58
A, B, C, K = (int(x) for x in input().split()) if A >= K: ans = A else: ans = A tmp = K - A if B >= tmp: pass else: tmp = tmp - B ans += tmp * (-1) print(ans)
A, B, C, K = (int(x) for x in input().split()) if A >= K: ans = K else: ans = A tmp = K - A if B >= tmp: pass else: tmp = tmp - B ans += tmp * (-1) print(ans)
[["-", 0, 57, 64, 196, 0, 1, 0, 662, 12, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 12, 22]]
5
67
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, c, k; cin >> a >> b >> c >> k; if (k <= a + b) { cout << k << endl; } else { //拿了k-a-b张c cout << 2 * a - k + b << endl; } return 0; }
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, c, k; cin >> a >> b >> c >> k; if (k <= a + b) { cout << min(a, k) << endl; } else { cout << 2 * a - k + b << endl; } return 0; }
[["+", 0, 1, 0, 16, 31, 16, 12, 2, 63, 22], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 24], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 22], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 21], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 25]]
1
67
a, b, c, k = map(int, input().split()) print(a - ((k-a-b) if k-a-b > 0 else 0))
a, b, c, k = map(int, input().split()) print(min(a - ((k-a-b) if k-a-b > 0 else 0), 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, 657, 12, 23, 0, 25], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 21], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 22]]
5
44
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> // Common file #include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update using namespace std; using namespace __gnu_pbds; using ll = long long; using _TYPE = int; typedef tree<_TYPE, null_type, less<_TYPE>, rb_tree_tag, ...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> // Common file #include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update using namespace std; using namespace __gnu_pbds; using ll = long long; using _TYPE = int; typedef tree<_TYPE, null_type, less<_TYPE>, rb_tree_tag, ...
[["+", 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, 22], ["+", 64, 1, 0, 16, 12, 2, 3, 4, 0, 21], ["+", 64, 1, 0, 16, 12, 2, 3, 4, 0, 25]]
1
104
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #define line cout << endl using namespace std; int a, b, c, k; int main() { cin >> a >> b >> c >> k; if (k <= a) cout << k; else if (k <= a + b) cout << k; else cout << a - (k - (a + b)); line; return ...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #define line cout << endl using namespace std; int a, b, c, k; int main() { cin >> a >> b >> c >> k; if (k <= a) cout << k; else if (k <= a + b) cout << a; else cout << a - (k - (a + b)); line; return ...
[["-", 75, 76, 0, 57, 64, 1, 0, 16, 12, 22], ["+", 75, 76, 0, 57, 64, 1, 0, 16, 12, 22]]
1
85
a,b,c,k= map(int,input().split()) if a+b>=k: print(a) else: print(2*a+b-k)
a,b,c,k= map(int,input().split()) if a+b>=k: print(min(a,k)) else: print(2*a+b-k)
[["+", 0, 1, 0, 652, 3, 4, 0, 652, 63, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 21], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
43
a, b, c, k = map(int, input().split(" ")) """ print(a) print(b) print(c) print(k) """ if a >= k: print(a) elif (a + b) >= k: print(a) else: print(a - (k - a - b))
a, b, c, k = map(int, input().split(" ")) """ print(a) print(b) print(c) print(k) """ 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
62
#include <bits/stdc++.h> using namespace std; int main() { int A, B, C, N; cin >> A >> B >> C >> N; int answer = 0; if (A >= N) { answer += N; } else { answer += A; if (B >= N - A) { answer += 0; } else { answer -= C; } } cout << answer << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int A, B, C, N; cin >> A >> B >> C >> N; int answer = 0; if (A >= N) { answer += N; } else { answer += A; if (B >= N - A) { answer += 0; } else { answer -= N - A - B; } } cout << answer << endl; }
[["-", 75, 76, 0, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 1, 0, 11, 12, 16, 31, 16, 31, 22], ["+", 0, 1, 0, 11, 12, 16, 31, 16, 17, 33], ["+", 0, 1, 0, 11, 12, 16, 31, 16, 12, 22], ["+", 0, 9, 0, 1, 0, 11, 12, 16, 17, 33], ["+", 0, 9, 0, 1, 0, 11, 12, 16, 12, 22]]
1
82
#include <bits/stdc++.h> using namespace std; void solve() { long long a, b, c, k; cin >> a >> b >> c >> k; if (k <= a + b) { cout << a; } else { cout << a - (k - a - b); } } int main() { int t; t = 1; while (t--) { solve(); } }
#include <bits/stdc++.h> using namespace std; void solve() { long long a, b, c, k; cin >> a >> b >> c >> k; if (k <= a + b) { cout << min(k, a); } else { cout << a - (k - a - b); } } int main() { int t; t = 1; while (t--) { solve(); } }
[["+", 64, 9, 0, 1, 0, 16, 12, 2, 63, 22], ["+", 0, 1, 0, 16, 12, 2, 3, 4, 0, 24], ["+", 0, 1, 0, 16, 12, 2, 3, 4, 0, 22], ["+", 0, 1, 0, 16, 12, 2, 3, 4, 0, 21], ["+", 0, 1, 0, 16, 12, 2, 3, 4, 0, 25]]
1
85
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; int xa = min(a, k); k -= xa; int xb = min(b, k); k -= xb; int xc = k; cout << xa + xc << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; int xa = min(a, k); k -= xa; int xb = min(b, k); k -= xb; int xc = k; cout << xa - xc << endl; return 0; }
[["-", 0, 1, 0, 16, 31, 16, 12, 16, 17, 72], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 33]]
1
75
#include <stdio.h> int main(void) { int a, b, c, k; scanf("%d%d%d%d", &a, &b, &c, &k); if (k <= a) { printf("%d", k); return 0; } if (k > a && k <= a + b) { printf("%d", a); return 0; } if (a + b < k && k <= a + b + c) { printf("%d", 2 * a - b - k); return 0; } }
#include <stdio.h> int main(void) { int a, b, c, k; scanf("%d%d%d%d", &a, &b, &c, &k); if (k <= a) { printf("%d", k); return 0; } if (k > a && k <= a + b) { printf("%d", a); return 0; } if (a + b < k && k <= a + b + c) { printf("%d", 2 * a + b - k); return 0; } }
[["-", 0, 2, 3, 4, 0, 16, 31, 16, 17, 33], ["+", 0, 2, 3, 4, 0, 16, 31, 16, 17, 72]]
0
119
# -*- coding: utf-8 -*- """ Created on Sun May 10 20:54:25 2020 @author: Kanaru Sato """ a,b,c,k = list(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)
# -*- coding: utf-8 -*- """ Created on Sun May 10 20:54:25 2020 @author: Kanaru Sato """ a,b,c,k = list(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
65
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(); K = K - A; if (K < 0) { System.out.println(K); } else { K = ...
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(); K = K - A; if (K <= 0) { System.out.println(K + A); } else { ...
[["-", 8, 196, 0, 57, 15, 15, 0, 16, 17, 18], ["+", 8, 196, 0, 57, 15, 15, 0, 16, 17, 19], ["+", 0, 1, 0, 492, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 492, 3, 4, 0, 16, 12, 22], ["-", 75, 196, 0, 57, 15, 15, 0, 16, 17, 18], ["+", 75, 196, 0, 57, 15, 15, 0, 16, 17, 19]]
3
134
#include <bits/stdc++.h> using namespace std; int a, b, c, k, mx; int main() { ios::sync_with_stdio(0); cin >> a >> b >> c >> k; if (k > a) { mx += a; k -= a; } else { cout << a << endl; return 0; } if (k > b) { k -= b; } else { cout << mx << endl; return 0; } mx -= k; co...
#include <bits/stdc++.h> using namespace std; int a, b, c, k, mx; int main() { ios::sync_with_stdio(0); cin >> a >> b >> c >> k; if (k >= a) { mx += a; k -= a; } else { cout << k << endl; return 0; } if (k >= b) { k -= b; } else { cout << mx << endl; return 0; } mx -= k; ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["-", 0, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 0, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
102
#include <bits/stdc++.h> using namespace std; int a, b, c, k, ans; int main() { cin >> a >> b >> c >> k; if (k <= a) { cout << k << endl; return 0; } if (k > a && k <= a + b) { cout << a << endl; return 0; } cout << a + (a - k) << endl; }
#include <bits/stdc++.h> using namespace std; int a, b, c, k, ans; int main() { cin >> a >> b >> c >> k; if (k <= a) { cout << k << endl; return 0; } if (k > a && k <= a + b) { cout << a << endl; return 0; } cout << a + (a + b - k) << endl; }
[["+", 12, 16, 12, 23, 0, 16, 31, 16, 17, 72], ["+", 12, 16, 12, 23, 0, 16, 31, 16, 12, 22]]
1
85
#include <stdio.h> int main() { long long int A, B, C, K; scanf("%lld %lld %lld %lld", &A, &B, &C, &K); if (K <= A) { printf("%lld", A); } else if (K > A && K <= A + B) { printf("%lld", A); } else if (K > A + B) { printf("%lld", 2 * A - K + B); } else { printf("-1"); } }
#include <stdio.h> int main() { long long int A, B, C, K; scanf("%lld %lld %lld %lld", &A, &B, &C, &K); if (K <= A) { printf("%lld", K); } else if (K > A && K <= A + B) { printf("%lld", A); } else if (K > A + B) { printf("%lld", 2 * A - K + B); } else { printf("-1"); } }
[["-", 64, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 64, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
1
115
package main import ( "fmt" ) func main(){ var A,B,C,K int count := 0 fmt.Scan(&A,&B,&C,&K) if A<K{ count+=A K-=A }else{ count+=A fmt.Println(count) return } if B<K{ K-=B count-=K fmt.Println(count) return }else{ fmt.Println(count) return } }
package main import ( "fmt" ) func main(){ var A,B,C,K int count := 0 fmt.Scan(&A,&B,&C,&K) if A<K{ count+=A K-=A }else{ fmt.Println(K) return } if B<K{ K-=B count-=K fmt.Println(count) return }else{ fmt.Println(count) return } }
[["-", 0, 57, 75, 196, 0, 436, 31, 432, 0, 22], ["-", 8, 196, 0, 57, 75, 196, 0, 436, 17, 107], ["-", 0, 57, 75, 196, 0, 436, 12, 432, 0, 22], ["-", 0, 435, 8, 196, 0, 57, 75, 196, 0, 165], ["-", 75, 196, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 75, 196, 0, 1, 0, 2, 3, 4, 0, 22]]
7
115
#include <stdio.h> int main() { long long int A; long long int B; long long int C; long long int K, amari, sum; scanf("%lld %lld %lld %lld", &A, &B, &C, &K); if (A >= K) { printf("%lld", K); return 0; } else { amari = K - A; sum = A; if (B >= amari) { printf("%lld", sum); ...
#include <stdio.h> int main() { long long int A; long long int B; long long int C; long long int K, amari, sum; scanf("%lld %lld %lld %lld", &A, &B, &C, &K); if (A >= K) { printf("%lld", K); return 0; } else { amari = K - A; sum = A; if (B >= amari) { printf("%lld", sum); ...
[["-", 0, 9, 0, 1, 0, 11, 12, 16, 31, 22], ["-", 0, 9, 0, 1, 0, 11, 12, 16, 17, 33], ["+", 0, 9, 0, 1, 0, 11, 12, 16, 17, 33], ["+", 0, 9, 0, 1, 0, 11, 12, 16, 12, 22]]
0
127
def main(): a,b,c,k = map(int,input().split()) if k <= a: print(k) exit if k - a <= b: print(a) exit print(a - (k - a - b)) if __name__ == "__main__": main()
def main(): a,b,c,k = map(int,input().split()) if k <= a: print(k) exit() if k - a <= b: print(a) exit () print(a - (k - a - b)) if __name__ == "__main__": main()
[["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
69
a,b,c,k = map(int,input().split()) ans = 0 k -= a if k <= 0: ans = a print(ans) exit() else: ans += a k -= b if k <= 0: print(ans) exit() ans -= k print(ans)
a,b,c,k = map(int,input().split()) ans = 0 k -= a if k <= 0: ans = a + k print(ans) exit() else: ans += a k -= b if k <= 0: print(ans) exit() ans -= k print(ans)
[["+", 64, 196, 0, 1, 0, 662, 12, 657, 17, 72], ["+", 64, 196, 0, 1, 0, 662, 12, 657, 12, 22]]
5
68
#include <bits/stdc++.h> using namespace std; int main() { long int A, B, C; long int K; cin >> A >> B >> C >> K; if (K <= A) cout << K << endl; else if (K <= A + B) cout << K << endl; else if (K <= A + B + C) cout << A - (K - A - B) << endl; else cout << A - C << endl; }
#include <bits/stdc++.h> using namespace std; int main() { long int A, B, C; long int K; cin >> A >> B >> C >> K; if (K <= A) cout << K << endl; else if (K <= A + B) cout << A << endl; else if (K <= A + B + C) cout << A - (K - A - B) << endl; else cout << A - C << endl; }
[["-", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22], ["+", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22]]
1
95
a, b, c, k = map(int, input().split()) if k <= a: print(a) elif a < k and k <= a + b: print(a) else: 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) else: print(a-(k-a-b))
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
58
def test(a,b,c,k): if k<=a: return k elif k<= a+b: return k else: return a-(k-a-b) a,b,c,k = list(map(int, input().split(" "))) print(test(a,b,c,k))
def test(a,b,c,k): if k<=a: return k elif k<= a+b: return a else: return a-(k-a-b) a,b,c,k = list(map(int, input().split(" "))) print(test(a,b,c,k))
[["-", 0, 57, 75, 665, 64, 196, 0, 37, 0, 22], ["+", 0, 57, 75, 665, 64, 196, 0, 37, 0, 22]]
5
79
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = sc.nextInt(); int b = sc.nextInt(); int c = sc.nextInt(); int k = sc.nextInt(); if (k < a) { System.out.println(k); return; } else if (a <= k && 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(); if (k < a) { System.out.println(k); return; } else if (a <= k && k <= ...
[["-", 3, 4, 0, 16, 12, 23, 0, 16, 17, 72], ["+", 3, 4, 0, 16, 12, 23, 0, 16, 17, 33]]
3
134
#include <stdio.h> int main() { int a, b, c, k, n1, n2, sum = 0; scanf("%d %d %d %d", &a, &b, &c, &k); if (a >= k) sum = a; else { if (b >= k - a) sum = a; else { sum = a - (k - (a + b)); } } printf("%d", sum); return 0; }
#include <stdio.h> int main() { int a, b, c, k, n1, n2, sum; scanf("%d %d %d %d", &a, &b, &c, &k); if (a >= k) sum = k; else { if (b >= k - a) sum = a; else { sum = a - (k - (a + b)); } } printf("%d", sum); return 0; }
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 8, 9, 0, 57, 64, 1, 0, 11, 12, 22], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 12, 22]]
0
98
def resolve(): A, B, C, K= map(int, input().split()) if A < K: if B < (K-A): print(A - (K-A-B)) else: print(A) else: print(A) if __name__ == "__main__": resolve()
def resolve(): A, B, C, K= map(int, input().split()) if A < K: if B < (K-A): print(A - (K-A-B)) else: print(A) else: print(K) if __name__ == "__main__": resolve()
[["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
73
// Apparat : drobucs, aleonov, vit_72 #include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <string> #include <unordered_map> #include <vector> // pragma warning(disable : 4996) //#pragma GCC optimize("O3") #define nptr ...
// Apparat : drobucs, aleonov, vit_72 #include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <string> #include <unordered_map> #include <vector> // pragma warning(disable : 4996) //#pragma GCC optimize("O3") #define nptr ...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
196
#include <stdio.h> int main() { int k, a, b, c, t; scanf("%d %d %d %d", &a, &b, &c, &k); if (k <= a) { t = k; } else if (k <= a + b) { t = k; } else { t = a - (k - a - b); } printf("%d", t); return 0; }
#include <stdio.h> int main() { int k, a, b, c, t; scanf("%d %d %d %d", &a, &b, &c, &k); if (k <= a) { t = k; } else if (k <= a + b) { t = a; } else { t = a - (k - a - b); } printf("%d", t); return 0; }
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22]]
0
92
a, b, c, k = gets.chomp.split.map(&:to_i) if a >= k puts a elsif a < k && k < a + b puts a else puts a - (k - a - b) end
a, b, c, k = gets.chomp.split.map(&:to_i) if a >= k puts k elsif a < k && k < a + b puts a else puts a - (k - a - b) end
[["-", 0, 121, 64, 749, 0, 652, 3, 4, 0, 22], ["+", 0, 121, 64, 749, 0, 652, 3, 4, 0, 22]]
4
49
#include <stdio.h> int main(int argc, const char *argv[]) { int a, b, c, k; scanf("%d %d %d %d", &a, &b, &c, &k); if (a >= k) { printf("%d", k); } else if (a < k && k <= a + b) { k = a; printf("%d", k); } else { k = a - (k - (b + c)); printf("%d", k); } return 0; }
#include <stdio.h> int main(int argc, const char *argv[]) { int a, b, c, k; scanf("%d %d %d %d", &a, &b, &c, &k); if (a >= k) { printf("%d", k); } else if (a < k && k <= a + b) { k = a; printf("%d", k); } else { k = a - (k - (a + b)); printf("%d", k); } return 0; }
[["-", 12, 23, 0, 16, 12, 23, 0, 16, 31, 22], ["+", 12, 23, 0, 16, 12, 23, 0, 16, 31, 22], ["-", 12, 23, 0, 16, 12, 23, 0, 16, 12, 22], ["+", 12, 23, 0, 16, 12, 23, 0, 16, 12, 22]]
0
119
import java.util.Scanner; 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 count = 0; if (A >= K) { count = K; } else if (A < K && A + B >= K) {...
import java.util.Scanner; 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 count = 0; if (A >= K) { count = K; } else if (A < K && A + B >= K) {...
[["-", 75, 57, 64, 196, 0, 1, 0, 11, 12, 22], ["+", 75, 57, 64, 196, 0, 1, 0, 11, 12, 22]]
3
138
package main import ( "bufio" "fmt" "os" "strconv" "strings" ) var sc = bufio.NewScanner(os.Stdin) func main() { ints := readIntArray() a, b, c, k := ints[0], ints[1], ints[2], ints[3] max := 0 if a >= k { max = k } if a+b >= k { max = a } if a+b+c >= k { max = a - (k - a - b) } fmt.Println(max...
package main import ( "bufio" "fmt" "os" "strconv" "strings" ) var sc = bufio.NewScanner(os.Stdin) func main() { ints := readIntArray() a, b, c, k := ints[0], ints[1], ints[2], ints[3] max := 0 if a >= k { max = k }else if a+b >= k { max = a }else if a+b+c >= k { max = a - (k - a - b) } fmt.Print...
[["-", 36, 36, 0, 434, 0, 435, 8, 196, 0, 165], ["+", 0, 434, 0, 435, 8, 196, 0, 57, 0, 95], ["+", 0, 435, 8, 196, 0, 57, 75, 57, 0, 95]]
7
299
#include <stdio.h> int main(void) { int k; long long int a, b, c; scanf("%lld%lld%lld%d", &a, &b, &c, &k); if (k - a <= 0) printf("%lld\n", a); else { if (k - a - b <= 0) printf("%lld\n", a); else printf("%lld\n", a - (k - a - b)); } return 0; }
#include <stdio.h> int main(void) { int k; long long int a, b, c; scanf("%lld%lld%lld%d", &a, &b, &c, &k); if (k - a <= 0) printf("%lld\n", k); else { if (k - a - b <= 0) printf("%lld\n", a); else printf("%lld\n", a - (k - a - b)); } return 0; }
[["-", 0, 57, 64, 1, 0, 2, 3, 4, 0, 22], ["+", 0, 57, 64, 1, 0, 2, 3, 4, 0, 22]]
0
103
A, B, C, K = map(int, input().split()) ret = 0 if A >= K: ret = K else: ret = A K -= A if B >= K: pass else: K -= B ret -= C print(ret)
A, B, C, K = map(int, input().split()) ret = 0 if A >= K: ret = K else: ret = A K -= A if B >= K: pass else: K -= B ret -= K print(ret)
[["-", 75, 76, 8, 196, 0, 1, 0, 677, 12, 22], ["+", 75, 76, 8, 196, 0, 1, 0, 677, 12, 22]]
5
57
a, b, c, k = map(int, input().split()) if a+b >= k: print(a) else: print(a-k+(a+b))
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
45
a,b,c,k=map(int,input().split()) ans=0 if(a>=k): print(k) elif((a+b)>=k): print(k) else: print(a-(k-a-b))
a,b,c,k=map(int,input().split()) ans=0 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
63
#include <bits/stdc++.h> using namespace std; typedef long ll; int main() { ll a, b, c; cin >> a >> b >> c; ll k; cin >> k; ll ans = a; if (k <= a) { ans = k; cout << ans << endl; return 0; } k = k - a; if (k <= b) { cout << ans << endl; return 0; } k = k - a - b; ans = an...
#include <bits/stdc++.h> using namespace std; typedef long ll; int main() { ll a, b, c; cin >> a >> b >> c; ll k; cin >> k; ll ans = a; if (k <= a) { ans = k; cout << ans << endl; return 0; } k = k - a; if (k <= b) { cout << ans << endl; return 0; } k = k - b; ans = ans - ...
[["-", 0, 1, 0, 11, 12, 16, 31, 16, 12, 22], ["-", 8, 9, 0, 1, 0, 11, 12, 16, 17, 33]]
1
110
A,B,C,K = list(map(int,input().split())) if A >= K: print(A*K) elif A < K and A + B >= K: print(1 * A + (K-A) * 0) elif A<K and A+B<K and A+B+C>=K: print(1*A + B * 0 + (K-A-B) * -1)
A,B,C,K = list(map(int,input().split())) if A >= K: print(1*K) elif A < K and A + B >= K: print(1 * A + (K-A) * 0) elif A<K and A+B<K and A+B+C>=K: print(1*A + B * 0 + (K-A-B) * -1)
[["-", 0, 1, 0, 652, 3, 4, 0, 657, 31, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 31, 612]]
5
99
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; cout << a - max(k - a - b, 0) << "\n"; }
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; cout << min(a, k) - max(k - a - b, 0) << "\n"; }
[["+", 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
50
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) int main() { int A, B, C, K; cin >> A >> B >> C >> K; cout << min(K, A) - min(K - A - B, C) << endl; }
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) int main() { int A, B, C, K; cin >> A >> B >> C >> K; cout << min(K, A) - max(K - A - B, 0) << endl; }
[["-", 0, 16, 31, 16, 12, 16, 12, 2, 63, 22], ["+", 0, 16, 31, 16, 12, 16, 12, 2, 63, 22], ["-", 31, 16, 12, 16, 12, 2, 3, 4, 0, 22], ["+", 31, 16, 12, 16, 12, 2, 3, 4, 0, 13]]
1
61
a, b, b, k = map(int, input().split()) p = min(a, k) s = p k -= p q = min(b, k) k -= q s -= k r = min(c, k) k -= r s -= k print(s)
a, b, c, k = map(int, input().split()) p = min(a, k) s = p k -= p q = min(b, k) k -= q s -= k r = min(c, k) k -= r s -= k print(s)
[["-", 0, 656, 0, 1, 0, 662, 31, 684, 0, 22], ["+", 0, 656, 0, 1, 0, 662, 31, 684, 0, 22]]
5
66
a, b, c, k = gets.split.map(&:to_i) ans = -10000000 if k <= a ans = a elsif (k - a) <= b ans = a else ans = a + (k-a-b) end puts ans
a, b, c, k = gets.split.map(&:to_i) ans = -10000000 if k <= a ans = k elsif (k - a) <= b ans = a else ans = a - (k - a - b) end puts ans
[["-", 0, 493, 0, 121, 64, 749, 0, 662, 12, 22], ["+", 0, 493, 0, 121, 64, 749, 0, 662, 12, 22], ["-", 75, 759, 75, 95, 0, 662, 12, 738, 17, 72], ["+", 75, 759, 75, 95, 0, 662, 12, 738, 17, 33]]
4
54
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; int xa, xb, xc; xa = min(a, k); xb = k - xa; xc = k - xb - xa; int ans = 0; ans = xa - xc; cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; int xa, xb, xc; xa = min(a, k); xb = min(k - xa, b); xc = k - xb - xa; int ans = 0; ans = xa - xc; cout << ans << endl; }
[["+", 8, 9, 0, 1, 0, 11, 12, 2, 63, 22], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 24], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 21], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 22], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 25]]
1
78
A,B,C,K = list(map(int,input().split())) if A >= K: print(A) elif A+B >= K: print(A) else: print(A-(K-A-B))
A,B,C,K = list(map(int,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
57
#include <algorithm> #include <cmath> #include <iostream> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; typedef long long LL; typedef long double LD; int main(void) { ios::sync_with_stdio(false); cin.tie(nullptr); LL a, b, c, k; cin >> a >> b >> c >>...
#include <algorithm> #include <cmath> #include <iostream> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; typedef long long LL; typedef long double LD; int main(void) { ios::sync_with_stdio(false); cin.tie(nullptr); LL a, b, c, k; cin >> a >> b >> c >>...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22]]
1
125
#include <bits/stdc++.h> #define lint long long #define st first #define nd second using namespace std; // int t; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); // cin>>t; // while(t--){} lint a, b, c, k; cin >> a >> b >> c >> k; lint ans = 0; if (k <= a) { cout <...
#include <bits/stdc++.h> #define lint long long #define st first #define nd second using namespace std; // int t; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); // cin>>t; // while(t--){} lint a, b, c, k; cin >> a >> b >> c >> k; lint ans = 0; if (k <= a) { cout <...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
123
#!/usr/bin/env python3 import sys def solve(A: int, B: int, C: int, K: int): if K <= A + B: print(A) else: print(A - (K - A - B)) return # Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools (tips: You use the default template now. You can remove this line by using your cu...
#!/usr/bin/env python3 import sys def solve(A: int, B: int, C: int, K: int): if K <= A + B: print(min(A, K)) else: print(A - (K - A - B)) return # Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools (tips: You use the default template now. You can remove this line by using...
[["+", 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
143
A, B, C, K = list(map(int, input().split(' '))) if K <= A: print(K) elif K <= A + B: print(A) else: a = min(C, K-A-B) ans = max(A- a, 0) print(ans)
A, B, C, K = list(map(int, input().split(' '))) if K <= A: print(K) elif K <= A + B: print(A) else: a = min(C, K-A-B) ans = A- a print(ans)
[["-", 8, 196, 0, 1, 0, 662, 12, 652, 63, 22], ["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 21], ["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 612], ["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25]]
5
74
/* 特徴 */ /* 教訓 */ #include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using pint = pair<int, int>; using pll = pair<ll, ll>; using pld = pair<ld, ld>; const int INF = 1e9 + 7; const ll LINF = 9223372036854775807; const ll MOD = 1e9 + 7; const ld PI = acos(-1); cons...
/* 特徴 */ /* 教訓 */ #include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using pint = pair<int, int>; using pll = pair<ll, ll>; using pld = pair<ld, ld>; const int INF = 1e9 + 7; const ll LINF = 9223372036854775807; const ll MOD = 1e9 + 7; const ld PI = acos(-1); cons...
[["+", 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
967
#include <iostream> using namespace std; int main() { int A, B, C, K; int sum = 0; cin >> A >> B >> C >> K; if (A >= K) { sum = A; } else if ((A + B >= K)) { sum = A; } else { sum = A - (K - A - B); } cout << sum << endl; return 0; }
#include <iostream> using namespace std; int main() { int A, B, C, K; int sum = 0; cin >> A >> B >> C >> K; if (A >= K) { sum = K; } else if ((A + B >= K)) { sum = A; } else { sum = A - (K - A - B); } cout << sum << endl; return 0; }
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22]]
1
89
A,B,C,K = input().split() a = int(A) b = int(B) k = int(K) B_number = 0 C_number = 0 A_number = min(a,k) k1 = k - a if k1 > 0: B_number = min(b,k1) k2 = k1 - b if k2 > 0: C_number = min(c,k2) print(A_number-C_number)
A,B,C,K = input().split() a = int(A) b = int(B) c = int(C) k = int(K) B_number = 0 C_number = 0 A_number = min(a,k) k1 = k - a if k1 > 0: B_number = min(b,k1) k2 = k1 - b if k2 > 0: C_number = min(c,k2) print(A_number-C_number)
[["+", 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, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25]]
5
89
A, B, C, K = map(int, input().split()) if (K - A) <= 0: print(A) else: if (K - A - B) <= 0: print(A) else: print(2*A - K + B)
A, B, C, K = map(int, input().split()) if (K - A) <= 0: print(K) else: if (K - A - B) <= 0: print(A) else: print(2*A - K + B)
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
62
A, B, C, K = list(map(int,input().split())) if K <= A: print(K) elif K <= (A + B): print(A) elif K <= (A + B + C): print(K - B) else: print(A + B - C)
A, B, C, K = list(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 - C)
[["-", 0, 1, 0, 652, 3, 4, 0, 657, 31, 22], ["-", 0, 1, 0, 652, 3, 4, 0, 657, 17, 33], ["+", 3, 4, 0, 657, 31, 657, 31, 657, 31, 612], ["+", 3, 4, 0, 657, 31, 657, 31, 657, 17, 48], ["+", 3, 4, 0, 657, 31, 657, 31, 657, 12, 22], ["+", 0, 652, 3, 4, 0, 657, 31, 657, 17, 72], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 33], ["...
5
72
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; if (k - a <= 0) { cout << a << endl; } else { if (k - a - b <= 0) { cout << a << endl; } else { cout << (a - (k - a - b)) << endl; } } return 0; }
#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; } } return 0; }
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
90
#define _CRT_SECURE_NO_WARNINGS #define REL #pragma GCC target("avx2") #pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <complex> #include <cstdint> #include <cstdio> #include <cstring> #include <deque> #include <iom...
#define _CRT_SECURE_NO_WARNINGS #define REL #pragma GCC target("avx2") #pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <complex> #include <cstdint> #include <cstdio> #include <cstring> #include <deque> #include <iom...
[["+", 0, 14, 8, 9, 0, 1, 0, 16, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 151], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
648
#include <algorithm> #include <iostream> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; cout << a - min(max(0, k - a - b), c) << endl; return 0; }
#include <algorithm> #include <iostream> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; cout << min(a, k) - min(max(0, k - a - b), c) << endl; return 0; }
[["+", 0, 16, 31, 16, 12, 16, 31, 2, 63, 22], ["+", 31, 16, 12, 16, 31, 2, 3, 4, 0, 24], ["+", 31, 16, 12, 16, 31, 2, 3, 4, 0, 21], ["+", 31, 16, 12, 16, 31, 2, 3, 4, 0, 22], ["+", 31, 16, 12, 16, 31, 2, 3, 4, 0, 25]]
1
58
def a(): s = input() t = input() if s == t[0:-1]: print('Yes') else: print('No') def b(): a, b, c, k = map(int, input().split()) xa = min(k, a) k1 = k - xa xb = min(k1, b) k2 = k1 - xb print(xa - k2) print(sum) # def c(): # def d(): b()
def a(): s = input() t = input() if s == t[0:-1]: print('Yes') else: print('No') def b(): a, b, c, k = map(int, input().split()) xa = min(k, a) k1 = k - xa xb = min(k1, b) k2 = k1 - xb print(xa - k2) # def c(): # def d(): b()
[["-", 0, 14, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
106
#include <bits/stdc++.h> using namespace std; #define watch(x) cout << (#x) << " is " << (x) << endl; #define mod 1000000007 #define pb push_back #define endl '\n' #define mp make_pair #define all(x) x.begin(), x.end() int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(0); int a, b, c, k;...
#include <bits/stdc++.h> using namespace std; #define watch(x) cout << (#x) << " is " << (x) << endl; #define mod 1000000007 #define pb push_back #define endl '\n' #define mp make_pair #define all(x) x.begin(), x.end() int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(0); int a, b, c, k;...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22]]
1
129
t=int(input().split()) l=[1,0,-1] k=t[3] s=0 i=0 while(k!=0): if(k>t[i]): s+=l[i]*t[i] k-=t[i] else: s+=l[i]*k k=0 i+=1 print(s)
t=list(map(int,input().split())) l=[1,0,-1] k=t[3] s=0 i=0 while(k!=0): if(k>t[i]): s+=l[i]*t[i] k-=t[i] else: s+=l[i]*k k=0 i+=1 print(s)
[["-", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 662, 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, 22], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 21], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
88
#include <bits/stdc++.h> using namespace std; #define repd(i, a, b) for (int i = a; i < int(b); i++) #define rep(i, n) repd(i, 0, n) using ll = long long; using ld = long double; #define int ll #define double ld #define VARNAME(v) #v using P = pair<int, int>; constexpr int MOD = 1000000007; // constexpr int MOD = 9982...
#include <bits/stdc++.h> using namespace std; #define repd(i, a, b) for (int i = a; i < int(b); i++) #define rep(i, n) repd(i, 0, n) using ll = long long; using ld = long double; #define int ll #define double ld #define VARNAME(v) #v using P = pair<int, int>; constexpr int MOD = 1000000007; // constexpr int MOD = 9982...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["-", 75, 76, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 75, 76, 0, 57, 15, 339, 51, 16, 17, 20]]
1
1,722
a, b, c, k = map(int, input().split()) ans = 0 if k >= a: ans = a k -= a else: print(k) exit() if k >= b: k -= b else: print(ans) if k >= c: ans -= c print(ans) else: ans -= k print(ans)
a, b, c, k = map(int, input().split()) ans = 0 if k >= a: ans = a k -= a else: print(k) exit() if k >= b: k -= b else: print(ans) exit() if k >= c: ans -= c print(ans) else: ans -= k print(ans)
[["+", 75, 76, 8, 196, 0, 1, 0, 652, 63, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
78