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()) ans = 0 if a < k: ans += a k -= a elif k <= a: ans += a print(ans) exit() if b < k: k -= b elif k <= b: print(ans) exit() ans += -1*k print(ans)
a, b, c, k = map(int, input().split()) ans = 0 if a < k: ans += a k -= a elif k <= a: print(k) exit() if b < k: k -= b elif k <= b: print(ans) exit() ans += -1*k print(ans)
[["-", 75, 665, 64, 196, 0, 1, 0, 677, 31, 22], ["-", 75, 665, 64, 196, 0, 1, 0, 677, 17, 107], ["-", 75, 665, 64, 196, 0, 1, 0, 677, 12, 22], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
79
# -*- coding: utf-8 -*- a, b, c, k = map(int, input().split()) result = 0 if 0 < k <= a: result += k k = 0 else: result += a k -= a if 0 < k <= b: k = 0 else: k -= b result -= k k= 0 print(result)
# -*- coding: utf-8 -*- a, b, c, k = map(int, input().split()) result = 0 if 0 < k <= a: result += k k = 0 else: result += a k -= a if 0 < k <= b: k = 0 elif b < k: k -= b result -= k k = 0 print(result)
[["-", 36, 36, 0, 656, 0, 57, 75, 76, 0, 95], ["+", 36, 36, 0, 656, 0, 57, 75, 665, 0, 683], ["+", 0, 656, 0, 57, 75, 665, 15, 666, 0, 22], ["+", 0, 656, 0, 57, 75, 665, 15, 666, 667, 18]]
5
70
import sys def S(): return sys.stdin.readline().rstrip() def I(): return int(sys.stdin.readline().rstrip()) def MI(): return map(int,sys.stdin.readline().rstrip().split()) def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) def LS(): return list(sys.stdin.readline().rstrip().split()) a,b,c,k = MI() ...
import sys def S(): return sys.stdin.readline().rstrip() def I(): return int(sys.stdin.readline().rstrip()) def MI(): return map(int,sys.stdin.readline().rstrip().split()) def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) def LS(): return list(sys.stdin.readline().rstrip().split()) a,b,c,k = MI() ...
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
163
a,b,c,k = map(int,input().split()) ans = 0 if k<=a: print(a) elif a<k and k<=a+b: print(a) else: print(a-min(k-a-b,c))
a,b,c,k = map(int,input().split()) ans = 0 if k<=a: print(k) elif a<k and k<=a+b: print(a) else: print(a-min(k-a-b,c))
[["-", 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 <bits/stdc++.h> #include <cmath> #include <iostream> #include <string> #include <unordered_map> #include <vector> using namespace std; signed main() { long long int A, B, C, K; cin >> A >> B >> C >> K; long long int ans = 0; if (K >= A) { ans += A; K -= A; } else { a...
#include <algorithm> #include <bits/stdc++.h> #include <cmath> #include <iostream> #include <string> #include <unordered_map> #include <vector> using namespace std; signed main() { long long int A, B, C, K; cin >> A >> B >> C >> K; long long int ans = 0; if (K >= A) { ans += A; K -= A; } else { a...
[["-", 0, 9, 0, 1, 0, 11, 12, 16, 31, 22], ["-", 0, 9, 0, 1, 0, 11, 12, 16, 17, 33]]
1
118
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) #define FOR(i, m, n) for (int i = (m); i < (n); i++) #define sz(x) ((int)(x).size()) #define all(x) (x).begin(), (x).end() #define SORT(x) sort((x).begin(), (x).end()) #define RSORT(x) sort((x).rbegin(), (x).rend()) #define ...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) #define FOR(i, m, n) for (int i = (m); i < (n); i++) #define sz(x) ((int)(x).size()) #define all(x) (x).begin(), (x).end() #define SORT(x) sort((x).begin(), (x).end()) #define RSORT(x) sort((x).rbegin(), (x).rend()) #define ...
[["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
893
#include <algorithm> #include <array> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <vector> using namespace std; #define int long long signed main() { cin.tie(0); ios::sync_with_stdio(0); int a, b, c, k; cin >> a >> b >> c >> k; if (a >= k)...
#include <algorithm> #include <array> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <vector> using namespace std; #define int long long signed main() { cin.tie(0); ios::sync_with_stdio(0); int a, b, c, k; cin >> a >> b >> c >> k; if (a >= k)...
[["-", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22], ["+", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22]]
1
106
#include <iostream> using namespace std; int main() { long long a, b, c, k; cin >> a >> b >> c >> k; if (a > k) { cout << (a - k) << endl; return 0; } if (a + b >= k) { cout << a << endl; return 0; } long long tmp = a - (k - (a + b)); cout << tmp << endl; return 0; }
#include <iostream> using namespace std; int main() { long long a, b, c, k; cin >> a >> b >> c >> k; if (a > k) { cout << k << endl; return 0; } if (a + b >= k) { cout << a << endl; return 0; } long long tmp = a - (k - (a + b)); cout << tmp << endl; return 0; }
[["-", 0, 1, 0, 16, 31, 16, 12, 23, 0, 24], ["-", 0, 16, 31, 16, 12, 23, 0, 16, 31, 22], ["-", 0, 16, 31, 16, 12, 23, 0, 16, 17, 33], ["-", 0, 1, 0, 16, 31, 16, 12, 23, 0, 25]]
1
97
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, c, k; cin >> a >> b >> c >> k; if (a >= k) { cout << a << endl; } else if (a + b >= k) { cout << a << endl; } else { cout << a - (k - a - b) << endl; } }
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, c, k; cin >> a >> b >> c >> k; if (a >= k) { cout << k << endl; } else if (a + b >= k) { cout << a << endl; } else { cout << a - (k - a - b) << endl; } }
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
80
A, B, C, K = map(int, input().split()) ans = 0 k = K ans += k if A >= k else A k -= A + B ans -= k print(ans)
A, B, C, K = map(int, input().split()) ans = 0 k = K ans += k if A >= k else A k -= A + B ans -= k if k > 0 else 0 print(ans)
[["+", 0, 656, 0, 1, 0, 677, 12, 41, 0, 121], ["+", 0, 1, 0, 677, 12, 41, 0, 666, 0, 22], ["+", 0, 1, 0, 677, 12, 41, 0, 666, 667, 47], ["+", 0, 1, 0, 677, 12, 41, 0, 666, 0, 612], ["+", 0, 656, 0, 1, 0, 677, 12, 41, 0, 95], ["+", 0, 656, 0, 1, 0, 677, 12, 41, 0, 612]]
5
47
import sys a,b,c,k=map(int,input().split()) cnt=0 if k<=a: print(k) sys.exit() if k<=(a+b): print(a) sys.exit() k-=(a+b) print(a-(c-k))
import sys a,b,c,k=map(int,input().split()) cnt=0 if k<=a: print(k) sys.exit() if k<=(a+b): print(a) sys.exit() k-=(a+b) print(a-k)
[["-", 0, 652, 3, 4, 0, 657, 12, 23, 0, 24], ["-", 3, 4, 0, 657, 12, 23, 0, 657, 31, 22], ["-", 3, 4, 0, 657, 12, 23, 0, 657, 17, 33], ["-", 0, 652, 3, 4, 0, 657, 12, 23, 0, 25]]
5
74
#include <bits/stdc++.h> #define MOD (10e9 + 7) using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); long long a, b, c, k; cin >> a >> b >> c >> k; if (k <= a + b) cout << k; else cout << a - (k - (a + b)); return 0; }
#include <bits/stdc++.h> #define MOD (10e9 + 7) using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); long long a, b, c, k; cin >> a >> b >> c >> k; if (k <= a + b) cout << min(a, k); else cout << a - (k - (a + b)); return 0; }
[["+", 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
79
A, B, C, K = map(int, input().split()) ans = 0 nokori = K if A >= K: print(A) exit() else: ans += A nokori = K - A if B >= nokori: print(ans) exit() else: nokori = nokori - B ans = ans - nokori print(ans)
A, B, C, K = map(int, input().split()) ans = 0 nokori = K if A >= K: print(K) exit() else: ans += A nokori = K - A if B >= nokori: print(ans) exit() else: nokori = nokori - B ans = ans - nokori print(ans)
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
76
#include <stdio.h> //#include <math.h> #define MIN(x, y) (((x) > (y)) ? (y) : (x)) #define ABS(x) ((x) >= 0 ? (x) : (-(x))) int main() { int a, b, c, k; scanf("%d%d%d%d", &a, &b, &c, &k); int rest = k; if (rest > a) { rest -= a; if (rest > b) { rest -= b; printf("%d", a - rest); } else {...
#include <stdio.h> //#include <math.h> #define MIN(x, y) (((x) > (y)) ? (y) : (x)) #define ABS(x) ((x) >= 0 ? (x) : (-(x))) int main() { int a, b, c, k; scanf("%d%d%d%d", &a, &b, &c, &k); int rest = k; if (rest > a) { rest -= a; if (rest > b) { rest -= b; printf("%d", a - rest); } else {...
[["-", 0, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 0, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
0
118
def ABC_167_B(): A,B,C,K = map(int, input().split()) if A>=K: print(A) elif A+B >= K: print(A) else: print(A-(K-A-B)) if __name__ == '__main__': ABC_167_B()
def ABC_167_B(): A,B,C,K = map(int, input().split()) if A>=K: print(K) elif A+B >= K: print(A) else: print(A-(K-A-B)) if __name__ == '__main__': ABC_167_B()
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
69
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) typedef long long ll; using namespace std; int main() { ll A, B, C, K; cin >> A >> B >> C >> K; if (A + B < K) { cout << A - 1 * (K - (A + B)) << endl; } else { cout << A << endl; } return 0; }
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) typedef long long ll; using namespace std; int main() { ll A, B, C, K; cin >> A >> B >> C >> K; if (A + B < K) { cout << A - 1 * (K - (A + B)) << endl; } else { cout << min(A, K) << 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, 21], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 22], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 25]]
1
84
a, b, c, k = map(int, input().split()) l = max(0, k - a) m = max(0, l - b) print(a - m)
a, b, c, k = map(int, input().split()) l = max(0, k - a) m = max(0, l - b) print(min(k, a) - m)
[["+", 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, 22], ["+", 3, 4, 0, 657, 31, 652, 3, 4, 0, 21], ["+", 3, 4, 0, 657, 31, 652, 3, 4, 0, 25]]
5
46
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; int maxa = a; if (k <= a + b) { cout << k; return 0; } int more = k - (a + b); if (more > c) more = c; cout << a - more; }
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; int maxa = a; if (k <= a + b) { cout << min(k, a); return 0; } int more = k - (a + b); if (more > c) more = c; cout << a - more; }
[["+", 64, 9, 0, 1, 0, 16, 12, 2, 63, 22], ["+", 0, 1, 0, 16, 12, 2, 3, 4, 0, 24], ["+", 0, 1, 0, 16, 12, 2, 3, 4, 0, 21], ["+", 0, 1, 0, 16, 12, 2, 3, 4, 0, 22], ["+", 0, 1, 0, 16, 12, 2, 3, 4, 0, 25]]
1
80
#include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define mk make_pair int main() { ll a, b, c, d; cin >> a >> b >> c >> d; if (a + b >= d && d > a) cout << a << endl; else if (a + b >= d && d < a) cout << d << endl; else if (a + b - d < 0) cout << a + (-1 * ...
#include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define mk make_pair int main() { ll a, b, c, d; cin >> a >> b >> c >> d; if (a + b >= d && d >= a) cout << a << endl; else if (a + b >= d && d <= a) cout << d << endl; else if (a + b - d < 0) cout << a + (-1 ...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 47], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 20], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 18], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 19]]
1
104
#include <bits/stdc++.h> using namespace std; #define fio ios_base::sync_with_stdio(false), cin.tie(NULL) #define ll long long #define int long long #define ull unsigned long long #define ld long double #define sb __builtin_popcount #define vi vector<int> #define vc vector<char> #define ii pair<int, int> #define pq pri...
#include <bits/stdc++.h> using namespace std; #define fio ios_base::sync_with_stdio(false), cin.tie(NULL) #define ll long long #define int long long #define ull unsigned long long #define ld long double #define sb __builtin_popcount #define vi vector<int> #define vc vector<char> #define ii pair<int, int> #define pq pri...
[["-", 8, 9, 0, 57, 64, 1, 0, 16, 12, 22], ["+", 8, 9, 0, 57, 64, 1, 0, 16, 12, 22]]
1
282
#include <bits/stdc++.h> using namespace std; #define all(x) (x).begin(), (x).end() using ll = long long; int main() { ll a, b, c, k, ans = 0; cin >> a >> b >> c >> k; ans += (a < k ? a : k); if (k > a + b) { ans -= c - (k - a - b); } cout << ans; return 0; }
#include <bits/stdc++.h> using namespace std; #define all(x) (x).begin(), (x).end() using ll = long long; int main() { ll a, b, c, k, ans = 0; cin >> a >> b >> c >> k; ans += (a < k ? a : k); if (k > a + b) { ans -= (k - a - b); } cout << ans; return 0; }
[["-", 64, 9, 0, 1, 0, 11, 12, 16, 31, 22], ["-", 64, 9, 0, 1, 0, 11, 12, 16, 17, 33]]
1
88
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { long long A, B, C; long long K; cin >> A >> B >> C >> K; if (K <= A) { cout << K << endl; } else if (K <= A + B) { cout << A << endl; } else { cout << A + B - (K - (A + B)) << endl; } return 0; ...
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { long long A, B, C; long long 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; }
[["-", 0, 16, 31, 16, 12, 16, 31, 16, 17, 72], ["-", 0, 16, 31, 16, 12, 16, 31, 16, 12, 22]]
1
93
a,b,c,k=map(int,input().split()) if a<k: if b<k-a: ans=a+(k-a-b)*(-1) else: ans=a else: ans=a print(ans)
a,b,c,k=map(int,input().split()) if a<k: if b<k-a: ans=a+(k-a-b)*(-1) else: ans=a else: ans=k print(ans)
[["-", 75, 76, 8, 196, 0, 1, 0, 662, 12, 22], ["+", 75, 76, 8, 196, 0, 1, 0, 662, 12, 22]]
5
62
a,b,c,k=map(int,input().split()) ans=0 if k>=a: k-=a ans+=a else: k=0 ans+=k if k>=b: k-=b else: k=0 if k>=c: ans-=c k-=c else: ans-=k k=0 print(ans)
a,b,c,k=map(int,input().split()) ans=0 if k>=a: k-=a ans+=a else: ans+=k k=0 if k>=b: k-=b else: k=0 if k>=c: ans-=c k-=c else: ans-=k k=0 print(ans)
[["-", 75, 76, 8, 196, 0, 1, 0, 662, 31, 22], ["-", 75, 76, 8, 196, 0, 1, 0, 662, 0, 32], ["-", 75, 76, 8, 196, 0, 1, 0, 662, 12, 612], ["+", 75, 76, 8, 196, 0, 1, 0, 677, 12, 22], ["+", 75, 76, 8, 196, 0, 1, 0, 662, 0, 32], ["+", 75, 76, 8, 196, 0, 1, 0, 662, 12, 612]]
5
78
#include <bits/stdc++.h> using namespace std; #define ms(s, n) memset(s, n, sizeof(s)) #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define FORd(i, a, b) for (int i = (a)-1; i >= (b); i--) #define FORall(it, a) \ for (__typeof((a).begin()) it = (a).beg...
#include <bits/stdc++.h> using namespace std; #define ms(s, n) memset(s, n, sizeof(s)) #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define FORd(i, a, b) for (int i = (a)-1; i >= (b); i--) #define FORall(it, a) \ for (__typeof((a).begin()) it = (a).beg...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22]]
1
762
#include <bits/stdc++.h> using namespace std; #define FIN \ ios_base::sync_with_stdio(false); \ cin.tie(0); \ cout.tie(0); typedef long lo...
#include <bits/stdc++.h> using namespace std; #define FIN \ ios_base::sync_with_stdio(false); \ cin.tie(0); \ cout.tie(0); typedef long lo...
[["-", 0, 1, 0, 11, 12, 2, 3, 4, 0, 22], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 22]]
1
92
#include <bits/stdc++.h> #define REP(i, m, n) for (int(i) = (m); (i) < (n); ++i) #define rep(i, n) REP(i, 0, n) #define all(x) (x).begin(), (x).end() using namespace std; using Graph = vector<vector<int>>; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }...
#include <bits/stdc++.h> #define REP(i, m, n) for (int(i) = (m); (i) < (n); ++i) #define rep(i, n) REP(i, 0, n) #define all(x) (x).begin(), (x).end() using namespace std; using Graph = vector<vector<int>>; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 33], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 12, 22], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22]]
1
286
#include <iostream> #include <string> using namespace std; typedef long long ll; int main() { ll a, b, c, k; cin >> a >> b >> c >> k; ll ans = 0; if (a >= k) { cout << a << endl; return 0; } else { ans += a; k -= a; } if (b >= k) { cout << a << endl; return 0; } else { ...
#include <iostream> #include <string> using namespace std; typedef long long ll; int main() { ll a, b, c, k; cin >> a >> b >> c >> k; ll ans = 0; if (a >= k) { cout << k << endl; return 0; } else { ans += a; k -= a; } if (b >= k) { cout << a << endl; return 0; } else { ...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
103
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; int main() { ll a, b, c, k; cin >> a >> b >> c >> k; if (k <= a) { cout << a << endl; } else { if (k - a > b) { cout << a - (k - a - b) << endl; } else...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; int main() { ll a, b, c, k; cin >> a >> b >> c >> k; if (k <= a) { cout << k << endl; } else { if (k - a > b) { cout << a - (k - a - b) << endl; } else...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
108
a,b,c,k=map(int,input().split()) if a>=k: d=k elif a<k and a+b>=k: d=k elif a+b<k: d=a-(k-a-b) print(d)
a,b,c,k=map(int,input().split()) if a>=k: d=k elif a<k and a+b>=k: d=a elif a+b<k: d=a-(k-a-b) print(d)
[["-", 75, 665, 64, 196, 0, 1, 0, 662, 12, 22], ["+", 75, 665, 64, 196, 0, 1, 0, 662, 12, 22]]
5
64
typedef long long ll; typedef long double ld; #include <bits/stdc++.h> using namespace std; int main() { ll a, b, c, k; std::cin >> a >> b >> c >> k; ll ans = 0; if (a >= k) { std::cout << a << std::endl; return 0; } ans += a; k -= a; if (b >= k) { std::cout << ans << std::endl; return ...
typedef long long ll; typedef long double ld; #include <bits/stdc++.h> using namespace std; int main() { ll a, b, c, k; std::cin >> a >> b >> c >> k; ll ans = 0; if (a >= k) { std::cout << k << std::endl; return 0; } ans += a; k -= a; if (b >= k) { std::cout << ans << std::endl; return ...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
114
import java.io.*; import java.util.*; public class Main { public static long Combination(long n, long r) { long A = 1; long B = 1; for (long i = 0; i < r; i++) { A = A * (n - i); B = B * (r - i); } if (A == 0) return 0; return A / B; } public static long solve(int i, i...
import java.io.*; import java.util.*; public class Main { public static long Combination(long n, long r) { long A = 1; long B = 1; for (long i = 0; i < r; i++) { A = A * (n - i); B = B * (r - i); } if (A == 0) return 0; return A / B; } public static long solve(int i, i...
[["-", 64, 196, 0, 1, 0, 492, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 492, 3, 4, 0, 22]]
3
438
#include <bits/stdc++.h> using namespace std; #define ll long long #define fio \ ios_base::sync_with_stdio(0); \ cin.tie(0); \ cout.tie...
#include <bits/stdc++.h> using namespace std; #define ll long long #define fio \ ios_base::sync_with_stdio(0); \ cin.tie(0); \ cout.tie...
[["-", 0, 57, 64, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 16, 12, 22]]
1
110
#include <algorithm> #include <cmath> #include <cstring> #include <deque> #include <iostream> #include <limits> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; using ll = long long; int main() { int a, b, c, k; cin >> a ...
#include <algorithm> #include <cmath> #include <cstring> #include <deque> #include <iostream> #include <limits> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; using ll = long long; int main() { int a, b, c, k; cin >> a ...
[["-", 0, 43, 49, 50, 51, 2, 3, 4, 0, 22], ["+", 0, 43, 49, 50, 51, 2, 3, 4, 0, 22]]
1
151
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound #include <bitset> // bitset #include <cctype> // isupper, islower, isdigit, toupper, tolower #include <cstdint> // int64_t, int*_t #include <cstdio> // printf #include <deque> // deque #include <functional> #include <iostream...
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound #include <bitset> // bitset #include <cctype> // isupper, islower, isdigit, toupper, tolower #include <cstdint> // int64_t, int*_t #include <cstdio> // printf #include <deque> // deque #include <functional> #include <iostream...
[["+", 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
173
#include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; int main() { ll a, b, c, k; std::cin >> a >> b >> c >> k; ll sum = 0; sum += min(k, a); k -= a; if (k > 0) { k -= b; if (k > 0) { sum -= min(k, a); } } std::cout << sum << std::endl;...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; int main() { ll a, b, c, k; std::cin >> a >> b >> c >> k; ll sum = 0; sum += min(k, a); k -= a; if (k > 0) { k -= b; if (k > 0) { sum -= min(k, c); } } std::cout << sum << std::endl;...
[["-", 0, 1, 0, 11, 12, 2, 3, 4, 0, 22], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 22]]
1
106
// I am so vegetable #pragma GCC optimize(2) #include <bits/stdc++.h> #define FIO ios::sync_with_stdio(false), cin.tie(0), cout.tie(0) #define PB push_back #define IN insert #define ER erase #define CT count #define EP empty #define _for(i, a, b) for (int i = (a); i < (b); ++i) #define _rfor(i, a, b) for (int i = (a); ...
// I am so vegetable #pragma GCC optimize(2) #include <bits/stdc++.h> #define FIO ios::sync_with_stdio(false), cin.tie(0), cout.tie(0) #define PB push_back #define IN insert #define ER erase #define CT count #define EP empty #define _for(i, a, b) for (int i = (a); i < (b); ++i) #define _rfor(i, a, b) for (int i = (a); ...
[["-", 31, 23, 0, 41, 64, 23, 0, 41, 75, 22], ["+", 31, 23, 0, 41, 64, 23, 0, 41, 75, 22]]
1
420
#include <bits/stdc++.h> // #include <ext/pb_ds/assoc_container.hpp> // #include <ext/pb_ds/tree_policy.hpp> // #include <ext/pb_ds/detail/standard_policies.hpp> // using namespace __gnu_pdbs; using namespace std; // typedef tree<int, null_type, less<int>, rb_tree_tag, // tree_order_statistics_node_update>...
#include <bits/stdc++.h> // #include <ext/pb_ds/assoc_container.hpp> // #include <ext/pb_ds/tree_policy.hpp> // #include <ext/pb_ds/detail/standard_policies.hpp> // using namespace __gnu_pdbs; using namespace std; // typedef tree<int, null_type, less<int>, rb_tree_tag, // tree_order_statistics_node_update>...
[["-", 31, 16, 12, 23, 0, 16, 31, 16, 31, 22], ["-", 31, 16, 12, 23, 0, 16, 31, 16, 17, 33], ["-", 0, 16, 31, 16, 12, 23, 0, 16, 17, 33], ["+", 31, 16, 12, 23, 0, 16, 31, 16, 17, 72], ["+", 0, 16, 31, 16, 12, 23, 0, 16, 17, 33], ["+", 0, 16, 31, 16, 12, 23, 0, 16, 12, 22]]
1
589
#include <bits/stdc++.h> typedef long long ll; using namespace std; ll MOD = 1e9 + 7; #define vec vector<int> #define vecll vector<ll> #define vec2 vector<vector<int>> #define vec2ll vector<vector<ll>> #define vpair vector<pair<int, int>> #define vpairll vector<pair<ll, ll>> #define vecst vector<string> #define vecb v...
#include <bits/stdc++.h> typedef long long ll; using namespace std; ll MOD = 1e9 + 7; #define vec vector<int> #define vecll vector<ll> #define vec2 vector<vector<int>> #define vec2ll vector<vector<ll>> #define vpair vector<pair<int, int>> #define vpairll vector<pair<ll, ll>> #define vecst vector<string> #define vecb v...
[["+", 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
286
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; #define floop(i, a, n) for (int i = a; i < n; i++) #define rfloop(i, a, n) for (int i = n - 1; i >= a; i--) #define mloop(it, x) for (it = x.begin(); it != x.end(); it+...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; #define floop(i, a, n) for (int i = a; i < n; i++) #define rfloop(i, a, n) for (int i = n - 1; i >= a; i--) #define mloop(it, x) for (it = x.begin(); it != x.end(); it+...
[["-", 8, 9, 0, 43, 49, 50, 51, 2, 63, 22], ["-", 0, 43, 49, 50, 51, 2, 3, 4, 0, 24], ["-", 3, 4, 0, 16, 12, 2, 3, 4, 0, 25], ["-", 0, 43, 49, 50, 51, 2, 3, 4, 0, 21], ["-", 0, 43, 49, 50, 51, 2, 3, 4, 0, 13]]
1
709
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
47
//#pragma GCC optimize("Ofast") //#pragma GCC optimize("unroll-loops") //#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #include <bits/stdc++.h> using namespace std; using ll = long long; using db = double; using ld = long double; template <typename T> using V = vector<T>; template <typen...
//#pragma GCC optimize("Ofast") //#pragma GCC optimize("unroll-loops") //#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #include <bits/stdc++.h> using namespace std; using ll = long long; using db = double; using ld = long double; template <typename T> using V = vector<T>; template <typen...
[["+", 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
585
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep2(i, a, b) for (int i = (int)(a); i < (int)(b); i++) #define FOR(i) for (cin >> i; i > 0; i--) #define elif else if #define pb push_back #define ll long long #define mp make_pair #define all(x) x.begin(), x.end() #define re(x) ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep2(i, a, b) for (int i = (int)(a); i < (int)(b); i++) #define FOR(i) for (cin >> i; i > 0; i--) #define elif else if #define pb push_back #define ll long long #define mp make_pair #define all(x) x.begin(), x.end() #define re(x) ...
[["-", 0, 2, 3, 4, 0, 16, 31, 16, 17, 72], ["-", 0, 2, 3, 4, 0, 16, 31, 16, 12, 22]]
1
123
#include <bits/stdc++.h> using namespace std; typedef pair<int, int> P; #define ll long long #define ld long double #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define PI 3.14159265358979323846 #define sz(x) ((int)(x).size()) #define chmin(x, y) x = min(x, y) #define chmax(x, y) x = max(x, y) const int INF =...
#include <bits/stdc++.h> using namespace std; typedef pair<int, int> P; #define ll long long #define ld long double #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define PI 3.14159265358979323846 #define sz(x) ((int)(x).size()) #define chmin(x, y) x = min(x, y) #define chmax(x, y) x = max(x, y) const int INF =...
[["-", 75, 76, 0, 9, 0, 1, 0, 11, 12, 22], ["+", 75, 76, 0, 9, 0, 1, 0, 11, 12, 22]]
1
170
import java.io.*; import java.nio.charset.StandardCharsets; import java.util.*; public class Main { public static void main(String[] args) throws IOException { InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8); BufferedReader in = new BufferedReader(reader); Mai...
import java.io.*; import java.nio.charset.StandardCharsets; import java.util.*; public class Main { public static void main(String[] args) throws IOException { InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8); BufferedReader in = new BufferedReader(reader); Mai...
[["-", 64, 196, 0, 1, 0, 492, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 492, 3, 4, 0, 22]]
3
246
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, k; scanf("%d%d%d%d", &a, &b, &c, &k); if (k <= a) printf("%d", a); else if (k <= a + b) printf("%d", a); else printf("%d", a + a + b - k); }
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, k; scanf("%d%d%d%d", &a, &b, &c, &k); if (k <= a) printf("%d", k); else if (k <= a + b) printf("%d", a); else printf("%d", a + a + b - k); }
[["-", 0, 57, 64, 1, 0, 2, 3, 4, 0, 22], ["+", 0, 57, 64, 1, 0, 2, 3, 4, 0, 22]]
1
89
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll a, b, c, k; cin >> a >> b >> c >> k; ll ans = 0; if (a >= k) { ans = a; } else { ans = a; k -= a; if (b < k) { k -= b; ans -= k; } } cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll a, b, c, k; cin >> a >> b >> c >> k; ll ans = 0; if (a >= k) { ans = k; } else { ans = a; k -= a; if (b < k) { k -= b; ans -= k; } } cout << ans << endl; }
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22]]
1
86
#include <algorithm> #include <bitset> #include <cassert> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> #define repr...
#include <algorithm> #include <bitset> #include <cassert> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> #define repr...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22]]
1
241
#include <bits/stdc++.h> #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) #define ll long long using namespace std; int main() { ll a, b, c, k; cin >> a >> b >> c >> k; if (a < k) { if (b < k - a) { cout << a + (k - a - b) * (-1) << endl; } else { cout << a << endl; } } else { co...
#include <bits/stdc++.h> #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) #define ll long long using namespace std; int main() { ll a, b, c, k; cin >> a >> b >> c >> k; if (a < k) { if (b < k - a) { cout << a + (k - a - b) * (-1) << endl; } else { cout << a << endl; } } else { co...
[["-", 0, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 0, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
96
#include <stdio.h> #include <stdlib.h> int main() { long long 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 { printf("%lld", a - (k - a - b)); } return 0; }
#include <stdio.h> #include <stdlib.h> int main() { long long 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 { printf("%lld", a - (k - a - b)); } return 0; }
[["-", 8, 9, 0, 57, 15, 23, 0, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 17, 19], ["-", 0, 57, 15, 23, 0, 16, 12, 16, 17, 18], ["+", 0, 57, 15, 23, 0, 16, 12, 16, 17, 19]]
0
105
A,B,C,K = map(int,input().split()) if A+B>=K: print(A) else: print(A+(A+B-K))
A,B,C,K = map(int,input().split()) if A+B>=K: print(min(A,K)) else: print(A+(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
45
#include <bits/stdc++.h> using namespace std; int main() { long long A, B, C, K, ans; cin >> A >> B >> C >> K; if (A >= K) ans = K; else if (A + B >= K) ans = A; else ans = A - (-1 * (K - B - C)); cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; int main() { long long A, B, C, K, ans; cin >> A >> B >> C >> K; if (A >= K) ans = K; else if (A + B >= K) ans = A; else ans = A + (-1 * (K - A - B)); cout << ans << endl; }
[["-", 75, 76, 0, 1, 0, 11, 12, 16, 17, 33], ["+", 75, 76, 0, 1, 0, 11, 12, 16, 17, 72], ["-", 0, 16, 12, 23, 0, 16, 31, 16, 12, 22], ["+", 0, 16, 12, 23, 0, 16, 31, 16, 12, 22], ["-", 12, 23, 0, 16, 12, 23, 0, 16, 12, 22], ["+", 12, 23, 0, 16, 12, 23, 0, 16, 12, 22]]
1
80
//#include <bits/stdc++.h> #include <algorithm> #include <assert.h> #include <bitset> #include <cmath> #include <cstdio> #include <cstdlib> #include <ctime> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <math.h> #include <numeric...
//#include <bits/stdc++.h> #include <algorithm> #include <assert.h> #include <bitset> #include <cmath> #include <cstdio> #include <cstdlib> #include <ctime> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <math.h> #include <numeric...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
149
a, b, c, k = gets.split.map(&:to_i) if a + b >= k puts a else puts a - (k - a - b) end
a, b, c, k = gets.split.map(&:to_i) if a + b >= k puts [a, k].min else puts a - (k - a - b) end
[["+", 0, 652, 3, 4, 0, 652, 486, 516, 0, 70], ["+", 0, 652, 3, 4, 0, 652, 486, 516, 0, 21], ["+", 0, 652, 3, 4, 0, 652, 486, 516, 0, 22], ["+", 0, 652, 3, 4, 0, 652, 486, 516, 0, 73], ["+", 64, 749, 0, 652, 3, 4, 0, 652, 17, 131], ["+", 64, 749, 0, 652, 3, 4, 0, 652, 735, 22]]
4
37
a,b,c,k=map(int,input().split()) x=0 y=0 if(a>k): x=k k=0 else: x=a k=k-a if(b>k): k=0 else: k=k-b if(c>k): y=k k=0 print(x-y)
a,b,c,k=map(int,input().split()) x=0 y=0 if(a>=k): x=k k=0 else: x=a k=k-a if(b>=k): k=0 else: k=k-b if(c>=k): y=k k=0 print(x-y)
[["-", 0, 656, 0, 57, 15, 23, 0, 666, 667, 47], ["+", 0, 656, 0, 57, 15, 23, 0, 666, 667, 20]]
5
85
#define _USE_MATH_DEFINES #include <bits/stdc++.h> using namespace std; #define ll long long #define vec vector<int> #define vecll vector<ll> #define vec2 vector<vector<int>> #define vec2ll vector<vector<ll>> #define vpair vector<pair<int, int>> #define vpairll vector<pair<ll, ll>> #define rep(i, n) for (ll i = (ll)0;...
#define _USE_MATH_DEFINES #include <bits/stdc++.h> using namespace std; #define ll long long #define vec vector<int> #define vecll vector<ll> #define vec2 vector<vector<int>> #define vec2ll vector<vector<ll>> #define vpair vector<pair<int, int>> #define vpairll vector<pair<ll, ll>> #define rep(i, n) for (ll i = (ll)0;...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
241
#include <algorithm> #include <array> #include <bitset> #include <cassert> #include <chrono> #include <cmath> #include <complex> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <random> #include <set> #include <stack> #include <st...
#include <algorithm> #include <array> #include <bitset> #include <cassert> #include <chrono> #include <cmath> #include <complex> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <random> #include <set> #include <stack> #include <st...
[["+", 0, 1, 0, 2, 3, 4, 0, 2, 63, 22], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 24], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 21], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 22], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 25]]
1
533
#include <bits/stdc++.h> #define lowbit(x) x &(-x) using namespace std; typedef long long ll; const int maxn = 1005; int main() { int a, b, c, k; cin >> a >> b >> c >> k; int ans = min(k, a); k -= min(k, a); k -= min(k, b); k -= min(k, c); ans -= min(k, c); cout << ans << endl; }
#include <bits/stdc++.h> #define lowbit(x) x &(-x) using namespace std; typedef long long ll; const int maxn = 1005; int main() { int a, b, c, k; cin >> a >> b >> c >> k; int ans = min(k, a); k -= min(k, a); k -= min(k, b); ans -= min(k, c); k -= min(k, c); cout << ans << endl; }
[["-", 0, 14, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 31, 22]]
1
100
import sys import os import math import bisect import collections import itertools import heapq ii = lambda: int(sys.stdin.buffer.readline().rstrip()) il = lambda: list(map(int, sys.stdin.buffer.readline().split())) fl = lambda: list(map(float, sys.stdin.buffer.readline().split())) iln = lambda n: [int(sys.stdin.buffe...
import sys import os import math import bisect import collections import itertools import heapq ii = lambda: int(sys.stdin.buffer.readline().rstrip()) il = lambda: list(map(int, sys.stdin.buffer.readline().split())) fl = lambda: list(map(float, sys.stdin.buffer.readline().split())) iln = lambda n: [int(sys.stdin.buffe...
[["-", 0, 652, 3, 4, 0, 657, 31, 652, 63, 22], ["+", 0, 652, 3, 4, 0, 657, 31, 652, 63, 22], ["-", 3, 4, 0, 657, 31, 652, 3, 4, 0, 612], ["-", 3, 4, 0, 657, 31, 652, 3, 4, 0, 21], ["+", 3, 4, 0, 657, 31, 652, 3, 4, 0, 21], ["+", 3, 4, 0, 657, 31, 652, 3, 4, 0, 22]]
5
301
#include <algorithm> #include <bits/stdc++.h> #include <iostream> using namespace std; //#define mp make_pair #define pb push_back #define int long long #define pi 3.141592653589793238462643383279502 #define M 998244353 #define F first #define S second #define pii pair<int, int> #define rep(i, n) for (int i = 0; i < n;...
#include <algorithm> #include <bits/stdc++.h> #include <iostream> using namespace std; //#define mp make_pair #define pb push_back #define int long long #define pi 3.141592653589793238462643383279502 #define M 998244353 #define F first #define S second #define pii pair<int, int> #define rep(i, n) for (int i = 0; i < n;...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
420
a, b, c, k = list(map(int, input().split())) if k<=b: print(k) elif b<k<=b+a: print(b) else: print(2*b-k+a)
a, b, c, k = list(map(int, input().split())) if k<=a: print(k) elif a<k<=b+a: print(a) else: print(2*a-k+b)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22], ["-", 0, 656, 0, 57, 75, 665, 15, 666, 0, 22], ["+", 0, 656, 0, 57, 75, 665, 15, 666, 0, 22], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 3, 4, 0, 657, 31, 657, 31, 657, 12, 22], ...
5
57
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define pii pair<int, int> #define _FastIO \ ios_base::sync_with_stdio(0); \ cin.tie(0); ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define pii pair<int, int> #define _FastIO \ ios_base::sync_with_stdio(0); \ cin.tie(0); ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22]]
1
132
#include <algorithm> #include <iostream> #include <map> #include <queue> #include <random> #include <set> #include <string> #include <vector> using namespace std; /* #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; tree<int, null_type, le...
#include <algorithm> #include <iostream> #include <map> #include <queue> #include <random> #include <set> #include <string> #include <vector> using namespace std; /* #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; tree<int, null_type, le...
[["+", 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, 13], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 21], ["+", 12, 2, 3, 4, 0, 2, 3, 4, 0, 25]]
1
135
#include <bits/stdc++.h> using namespace std; #define ll long long int #define int ll #define ff first #define ss second #define pb emplace_back #define mpair make_pair #define pii pair<int, int> #define vi vector<int> #define mii map<int, int> #define pqb priority_queue<int> #define pqs priority_queue<int, vi, greater...
#include <bits/stdc++.h> using namespace std; #define ll long long int #define int ll #define ff first #define ss second #define pb emplace_back #define mpair make_pair #define pii pair<int, int> #define vi vector<int> #define mii map<int, int> #define pqb priority_queue<int> #define pqs priority_queue<int, vi, greater...
[["+", 0, 14, 8, 9, 0, 57, 64, 9, 0, 45], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 14, 8, 9, 0, 57, 64, 9, 0, 46]]
1
439
a,b,c,k=map(int,input().split()) i=0 if k<=a: print(a) elif k<=a+b: print(a) else: print(a-(k-(a+b)))
a,b,c,k=map(int,input().split()) i=0 if k<=a: print(k) elif k<=a+b: print(a) else: print(a-(k-(a+b)))
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
59
#include <bits/stdc++.h> using namespace std; #define ll long long int #define pb push_back int main() { ll a, b, c, k, i; cin >> a >> b >> c >> k; if (a >= k) cout << k; else if (a + b <= k) cout << a; else { cout << a - (k - (a + b)); } }
#include <bits/stdc++.h> using namespace std; #define ll long long int #define pb push_back int main() { ll a, b, c, k, i; cin >> a >> b >> c >> k; if (a >= k) cout << k; else if (a + b >= k) cout << a; else { cout << a - (k - (a + b)); } }
[["-", 75, 76, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 75, 76, 0, 57, 15, 339, 51, 16, 17, 20]]
1
79
#include <algorithm> #include <iomanip> #include <iostream> #include <limits> #include <map> #include <math.h> #include <stdio.h> #include <utility> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) typedef pair<int, string> P; int main() { long long a, b, c, k; cin >> a >...
#include <algorithm> #include <iomanip> #include <iostream> #include <limits> #include <map> #include <math.h> #include <stdio.h> #include <utility> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) typedef pair<int, string> P; int main() { long long a, b, c, k; cin >> a >...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
130
A, B, C, K = map(int, input().split()) if K <= A: print(K) elif K > A: if K - A <= B: print(A) else: print(A - (K - A - B) * C)
A, B, C, K = map(int, input().split()) if K <= A: print(K) elif K > A: if K - A <= B: print(A) else: print(A - (K - A - B))
[["-", 0, 652, 3, 4, 0, 657, 12, 657, 17, 48], ["-", 0, 652, 3, 4, 0, 657, 12, 657, 12, 22]]
5
61
a,b,c,k = map(int, input().split()) sum = 0 if a >= k: sum += 1*k print(sum) elif a < k : sum += 1*k k = k - a if b >= k: print(sum) else : k = k - b sum += (-1)*k print(sum)
a,b,c,k = map(int, input().split()) sum = 0 if a >= k: sum += 1*k print(sum) elif a < k : sum += 1*a k = k - a if b >= k: print(sum) else : k = k - b sum += (-1)*k print(sum)
[["-", 64, 196, 0, 1, 0, 677, 12, 657, 12, 22], ["+", 64, 196, 0, 1, 0, 677, 12, 657, 12, 22]]
5
80
#include <bits/stdc++.h> using namespace std; #define ll long long int main() { ll a, b, c, k; cin >> a >> b >> c >> k; ll sum = a; if (k <= a) { cout << a; return 0; } k -= a; if (k <= b) { cout << sum; return 0; } k -= b; cout << sum - k; }
#include <bits/stdc++.h> using namespace std; #define ll long long int main() { ll a, b, c, k; cin >> a >> b >> c >> k; ll sum = a; if (k <= a) { cout << k; return 0; } k -= a; if (k <= b) { cout << sum; return 0; } k -= b; cout << sum - k; }
[["-", 0, 57, 64, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 16, 12, 22]]
1
83
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long a = sc.nextLong(); long b = sc.nextLong(); long c = sc.nextLong(); long k = sc.nextLong(); long ans = 0; if (a + b <= k) { ans = Math.min(a, k); } else { ...
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long a = sc.nextLong(); long b = sc.nextLong(); long c = sc.nextLong(); long k = sc.nextLong(); long ans = 0; if (a + b >= k) { ans = Math.min(a, k); } else { ...
[["-", 8, 196, 0, 57, 15, 15, 0, 16, 17, 19], ["+", 8, 196, 0, 57, 15, 15, 0, 16, 17, 20]]
3
121
#include <cstdio> #include <iostream> #include <string> using namespace std; int main() { int a, b, c, k; int sum; scanf("%d%d%d%d", &a, &b, &c, &k); if (a >= k) sum = a; else if (a + b >= k) sum = a; else sum = a - (k - a - b); cout << sum; return 0; }
#include <cstdio> #include <iostream> #include <string> using namespace std; int main() { int a, b, c, k; int sum; scanf("%d%d%d%d", &a, &b, &c, &k); if (a >= k) sum = k; else if (a + b >= k) sum = a; else sum = a - (k - a - b); cout << sum; return 0; }
[["-", 8, 9, 0, 57, 64, 1, 0, 11, 12, 22], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 12, 22]]
1
90
#include <algorithm> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <vector> using namespac...
#include <algorithm> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <vector> using namespac...
[["-", 0, 57, 64, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 16, 12, 22]]
1
245
#include <bits/stdc++.h> using namespace std; int main() { long long int a, b, c, k; cin >> a >> b >> c >> k; if (a + b >= k) cout << a << endl; else cout << a - (k - a - b) << endl; }
#include <bits/stdc++.h> using namespace std; int main() { long long int a, b, c, k; cin >> a >> b >> c >> k; if (a + b >= k) cout << min(a, k) << endl; else cout << a - (k - a - b) << endl; }
[["+", 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
62
// 10/05/2020 #include <bits/stdc++.h> #include <cmath> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; #define debug printf("Debug\n"); #define en '\n' #define ll long long #define ull unsigned long long #define pi acos(-1.0) #define mo...
// 10/05/2020 #include <bits/stdc++.h> #include <cmath> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; #define debug printf("Debug\n"); #define en '\n' #define ll long long #define ull unsigned long long #define pi acos(-1.0) #define mo...
[["+", 75, 76, 0, 9, 0, 1, 0, 11, 31, 22], ["+", 75, 76, 0, 9, 0, 1, 0, 11, 17, 110], ["+", 75, 76, 0, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 75, 76, 0, 9, 0, 1, 0, 35]]
1
726
#include <algorithm> #include <climits> #include <cmath> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <limits> #include <map> #include <numeric> #include <sstream> #include <string> #include <utility> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; ...
#include <algorithm> #include <climits> #include <cmath> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <limits> #include <map> #include <numeric> #include <sstream> #include <string> #include <utility> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; ...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22]]
1
129
#include <cstdio> #include <iostream> typedef long long ll; int main() { int a, b, c, k; scanf("%d%d%d%d", &a, &b, &c, &k); int ans = 0; if (k) ans += std::min(a, k), k -= std::min(a, k); if (k) k -= std::min(b, k); if (k) ans -= std::min(b, k), k -= std::min(c, k); printf("%d", ans); retu...
#include <cstdio> #include <iostream> typedef long long ll; int main() { int a, b, c, k; scanf("%d%d%d%d", &a, &b, &c, &k); int ans = 0; if (k) ans += std::min(a, k), k -= std::min(a, k); if (k) k -= std::min(b, k); if (k) ans -= std::min(c, k), k -= std::min(c, k); printf("%d", ans); retu...
[["-", 0, 34, 31, 11, 12, 2, 3, 4, 0, 22], ["+", 0, 34, 31, 11, 12, 2, 3, 4, 0, 22]]
1
127
a,b,c,k = map(int,input().split()) ans = 0 if a+b >= k: print(a) else: print(a-(k-(a+b)))
a,b,c,k = map(int,input().split()) ans = 0 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
50
#include <bits/stdc++.h> using namespace std; #define rep(i, x, y) for (int i = x; i < y; i++) #define print(A, x, n) \ rep(I, 0, n) { cout << (I ? " " : "") << A[I] x; } \ cout << endl; #define pprint(A, y, m, n) ...
#include <bits/stdc++.h> using namespace std; #define rep(i, x, y) for (int i = x; i < y; i++) #define print(A, x, n) \ rep(I, 0, n) { cout << (I ? " " : "") << A[I] x; } \ cout << endl; #define pprint(A, y, m, n) ...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
133
#include <algorithm> #include <iostream> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; const long long INF = 1LL << 60; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } tem...
#include <algorithm> #include <iostream> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; const long long INF = 1LL << 60; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } tem...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
212
#include <bits/stdc++.h> using namespace std; typedef long long int ll; #define pb push_back #define mp make_pair #define deb(x) cout << #x << " " << x << "\n"; #define INF 9223372036854775807 const ll mod = 1e9 + 7; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); ll a, b, c, k;...
#include <bits/stdc++.h> using namespace std; typedef long long int ll; #define pb push_back #define mp make_pair #define deb(x) cout << #x << " " << x << "\n"; #define INF 9223372036854775807 const ll mod = 1e9 + 7; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); ll a, b, c, k;...
[["+", 0, 43, 49, 50, 51, 16, 31, 2, 63, 22], ["+", 49, 50, 51, 16, 31, 2, 3, 4, 0, 24], ["+", 49, 50, 51, 16, 31, 2, 3, 4, 0, 22], ["+", 49, 50, 51, 16, 31, 2, 3, 4, 0, 21], ["+", 49, 50, 51, 16, 31, 2, 3, 4, 0, 25]]
1
106
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, c, n; cin >> a >> b >> c >> n; if (n <= a) cout << a; else { if (n - a <= b) cout << a; else cout << a - (n - a - b); } return 0; }
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, c, n; cin >> a >> b >> c >> n; if (n <= a) cout << n; else { if (n - a <= b) cout << a; else cout << a - (n - a - b); } return 0; }
[["-", 8, 9, 0, 57, 64, 1, 0, 16, 12, 22], ["+", 8, 9, 0, 57, 64, 1, 0, 16, 12, 22]]
1
73
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<ll, ll> P; int main() { ll A, B, C, K; cin >> A >> B >> C >> K; if (K - A < 0) { cout << A << endl; return 0; } else { if (K - (A + B) < 0) { cout << A << endl; return 0; ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<ll, ll> P; int main() { ll A, B, C, K; cin >> A >> B >> C >> K; if (K - A <= 0) { cout << K << endl; return 0; } else { if (K - (A + B) <= 0) { cout << A << endl; return 0;...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["-", 0, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
121
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; using ll = long long; int main() { ll a, b, c, k; cin >> a >> b >> c >> k; if (a >= k) cout << k << endl; else if (a + b >= k) cout << a + b << endl; else cout << a - (k - a - b) << endl; }
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; using ll = long long; int main() { ll a, b, c, k; cin >> a >> b >> c >> k; if (a >= k) cout << k << endl; else if (a + b >= k) cout << a << endl; else cout << a - (k - a - b) << endl; }
[["-", 64, 1, 0, 16, 31, 16, 12, 16, 17, 72], ["-", 64, 1, 0, 16, 31, 16, 12, 16, 12, 22]]
1
89
def main(): A,B,C,K = list(map(int, input().split(' '))) out = 0 if A > K: out = K return else: nokori = K-A if nokori <= B: out = A return out elif nokori > B: nokonkori = K - A - B out = A - nokonkori ...
def main(): A,B,C,K = list(map(int, input().split(' '))) out = 0 if A > K: out = K return out else: nokori = K-A if nokori <= B: out = A return out elif nokori > B: nokonkori = K - A - B out = A - nokonkori ...
[["+", 8, 196, 0, 57, 64, 196, 0, 37, 0, 22]]
5
88
#include <bits/stdc++.h> using namespace std; #define endl "\n" #define ll long long int #define f(i, n) for (ll i = 0; i < n; i++) #define ff(i, n) for (ll i = 1; i <= n; i++) #define MOD 1000000007 void yes() { cout << "YES" << endl; } void no() { cout << "NO" << endl; } int main() { ios_base::sync_with_stdio(f...
#include <bits/stdc++.h> using namespace std; #define endl "\n" #define ll long long int #define f(i, n) for (ll i = 0; i < n; i++) #define ff(i, n) for (ll i = 1; i <= n; i++) #define MOD 1000000007 void yes() { cout << "YES" << endl; } void no() { cout << "NO" << endl; } int main() { ios_base::sync_with_stdio(f...
[["-", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22], ["+", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22]]
1
171
#include <bits/stdc++.h> #define PI 2.0 * acos(0.0) #define ll long long int #define gcd(a, b) __gcd(a, b) #define lcm(a, b) ((a) * (b)) / gcd(a, b) #define MOD 1000000007 #define mx 123456789 using namespace std; int main() { ll a, b, c, d, e, f, n, m, i, j, k, l; cin >> a >> b >> c >> k; ll sum = a; if (k > 0...
#include <bits/stdc++.h> #define PI 2.0 * acos(0.0) #define ll long long int #define gcd(a, b) __gcd(a, b) #define lcm(a, b) ((a) * (b)) / gcd(a, b) #define MOD 1000000007 #define mx 123456789 using namespace std; int main() { ll a, b, c, d, e, f, n, m, i, j, k, l; cin >> a >> b >> c >> k; ll sum = min(a, k); i...
[["+", 8, 9, 0, 43, 49, 50, 51, 2, 63, 22], ["+", 0, 43, 49, 50, 51, 2, 3, 4, 0, 24], ["+", 0, 43, 49, 50, 51, 2, 3, 4, 0, 21], ["+", 0, 43, 49, 50, 51, 2, 3, 4, 0, 22], ["+", 0, 43, 49, 50, 51, 2, 3, 4, 0, 25]]
1
134
#include <bits/stdc++.h> using namespace std; // var int a, b, c, k, ans = 0; int main() { cin >> a >> b >> c >> k; if (a >= k) { cout << a << endl; return 0; } ans += a; k -= a; if (b >= k) { cout << ans << endl; return 0; } k -= b; ans -= k; cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; // var int a, b, c, k, ans = 0; int main() { cin >> a >> b >> c >> k; if (a >= k) { cout << k << endl; return 0; } ans += a; k -= a; if (b >= k) { cout << ans << endl; return 0; } k -= b; ans -= k; cout << ans << endl; }
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
92
a,b,c,k=input().split() a=int(a) b=int(b) c=int(c) k=int(k) if a>=k: print(k) else: if a+b>=k: print(a) else: s=k-a-b
a,b,c,k=input().split() a=int(a) b=int(b) c=int(c) k=int(k) if a>=k: print(k) else: if a+b>=k: print(a) else: s=k-a-b print(a-s)
[["+", 75, 76, 8, 196, 0, 1, 0, 652, 63, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 31, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 33], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 12, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
70
a,b,c,k = map(int, input().split()) if a>=k: print(a) elif a+b>=k: print(a) else: t = k - a - b print(a-t)
a,b,c,k = map(int, input().split()) if a>=k: print(k) elif a+b>=k: print(a) else: t = k - a - b print(a-t)
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
55
#include <bits/stdc++.h> #define _GLIBCXX_DEBUG #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() using namespace std; using ll = long long; using vpii = vector<pair<int, int>>; using vpll = vector<pair<ll, ll>>; // ceil() 切り上げ, floor() 切り捨て // next_permutation(all(x)) int main(void) { ...
#include <bits/stdc++.h> #define _GLIBCXX_DEBUG #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() using namespace std; using ll = long long; using vpii = vector<pair<int, int>>; using vpll = vector<pair<ll, ll>>; // ceil() 切り上げ, floor() 切り捨て // next_permutation(all(x)) int main(void) { ...
[["+", 8, 9, 0, 43, 49, 50, 51, 2, 63, 22], ["+", 0, 43, 49, 50, 51, 2, 3, 4, 0, 24], ["+", 0, 43, 49, 50, 51, 2, 3, 4, 0, 21], ["+", 0, 43, 49, 50, 51, 2, 3, 4, 0, 22], ["+", 0, 43, 49, 50, 51, 2, 3, 4, 0, 25]]
1
118
a,b,c,k = map(int, input().split()) if a >= k: ans = a elif a + b >= k: ans = a else: ans = a - (k-(a+b)) print(ans)
a,b,c,k = map(int, input().split()) if a >= k: ans = k elif a + b >= k: ans = a else: ans = a - (k-(a+b)) print(ans)
[["-", 0, 57, 64, 196, 0, 1, 0, 662, 12, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 12, 22]]
5
57
A,B,C,K = map(int,input().split()) ans = 0 if A > K: ans = K else: ans = K K -= A if B > K: pass else: ans -= K print(ans)
A,B,C,K = map(int,input().split()) ans = 0 if A > K: ans = K else: ans = A K -= A if B > K: pass else: K -= B ans -= K print(ans)
[["-", 75, 76, 8, 196, 0, 1, 0, 662, 12, 22], ["+", 75, 76, 8, 196, 0, 1, 0, 662, 12, 22], ["+", 75, 76, 8, 196, 0, 1, 0, 677, 31, 22], ["+", 75, 76, 8, 196, 0, 1, 0, 677, 17, 110], ["+", 75, 76, 8, 196, 0, 1, 0, 677, 12, 22]]
5
54
#!/usr/bin/env python3 import sys import pprint sys.setrecursionlimit(10 ** 6) class Logger: def __init__(self, debug): self.debug = debug def print(self, *args): if self.debug: pprint.pprint(args) def main(): log = Logger(1) a, b, c, k = map(int, sys.stdin.readline().split()) ans = 0 if k <= a: pri...
#!/usr/bin/env python3 import sys import pprint sys.setrecursionlimit(10 ** 6) class Logger: def __init__(self, debug): self.debug = debug def print(self, *args): if self.debug: pprint.pprint(args) def main(): log = Logger(1) a, b, c, k = map(int, sys.stdin.readline().split()) ans = 0 if k <= a: pri...
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
134
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, c, n; cin >> a >> b >> c >> n; long long sol = min(a, n); n -= min(a, n); n -= min(n, a); sol -= n; cout << sol; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, c, n; cin >> a >> b >> c >> n; long long sol = min(a, n); n -= min(a, n); n -= min(n, b); sol -= n; cout << sol; return 0; }
[["-", 0, 1, 0, 11, 12, 2, 3, 4, 0, 22], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 22]]
1
72
#include <bits/stdc++.h> using namespace std; typedef long long int ll; int main() { ll a, b, c, k; cin >> a >> b >> c >> k; ll ans; if (k <= a) ans = a; else if (k <= (a + b)) ans = a; else ans = a - (k - a - b); cout << ans; }
#include <bits/stdc++.h> using namespace std; typedef long long int ll; int main() { ll a, b, c, k; cin >> a >> b >> c >> k; ll ans; if (k <= a) ans = k; else if (k <= (a + b)) ans = a; else ans = a - (k - a - b); cout << ans; }
[["-", 8, 9, 0, 57, 64, 1, 0, 11, 12, 22], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 12, 22]]
1
82
def main(): A, B, C, K = map(int, input().split()) if A >= K: print(A) elif A + B >= K: print(A) else: print(A - (K - A - B)) main()
def main(): A, B, C, K = map(int, input().split()) if A > K: print(K) elif A + B >= K: print(A) else: print(A - (K - A - B)) main()
[["-", 0, 14, 8, 196, 0, 57, 15, 666, 667, 20], ["+", 0, 14, 8, 196, 0, 57, 15, 666, 667, 47], ["-", 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> #define ll long long #define rep(i, a, n) for (int i = a; i <= n; i++) #define per(i, n, a) for (int i = n; i >= a; i--) #define endl '\n' #define mem(a, b) memset(a, b, sizeof(a)) #define IO \ ios::sync_with_stdio(false); ...
#include <bits/stdc++.h> #define ll long long #define rep(i, a, n) for (int i = a; i <= n; i++) #define per(i, n, a) for (int i = n; i >= a; i--) #define endl '\n' #define mem(a, b) memset(a, b, sizeof(a)) #define IO \ ios::sync_with_stdio(false); ...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22]]
1
189
A,B,C,K = map(int,input().split()) if K <= A: print(A) else: K -= A if K <= B: print(A) else: K -= B print(A + K * -1)
A,B,C,K = map(int,input().split()) if K <= A: print(K) else: K -= A if K <= B: print(A) else: K -= B print(A + K * -1)
[["-", 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; using ll = long long; using P = pair<int, int>; int main() { int a, b, c, k; cin >> a >> b >> c >> k; int t = 0; if (a < k) { t += a; k -= a; if (b < k) { k -= b; t -= min(c, k); } } else { t = a; } cout << t << endl; }
#include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<int, int>; int main() { int a, b, c, k; cin >> a >> b >> c >> k; int t = 0; if (a < k) { t += a; k -= a; if (b < k) { k -= b; t -= min(c, k); } } else { t = min(a, k); } cout << t << endl; }
[["+", 0, 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
102