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()) print(A - max(0, (K - A - B)))
A, B, C, K = map(int, input().split()) print(min(K, A - max(0, 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, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 21], ["-", 0, 657, 12, 652, 3, 4, 0, 23, 0, 24]]
5
37
a,b,c,k = map(int,input().split()) if a+b >= k: print(a) else: print(a-abs(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], ["-", 0, 652, 3, 4, 0, 657, 12, 652, 63, 22]]
5
46
/* Jai Shree Krishna !! Radhe Radhe !! उद्यमेन हि सिद्ध्यन्ति कार्याणि न मनोरथैः। नहि सुप्तस्य सिंहस्य मुखे प्रविशन्ति मृगाः।। */ #include <bits/stdc++.h> using namespace std; #define int long long typedef long long ll; #define loop(i, ...
/* Jai Shree Krishna !! Radhe Radhe !! उद्यमेन हि सिद्ध्यन्ति कार्याणि न मनोरथैः। नहि सुप्तस्य सिंहस्य मुखे प्रविशन्ति मृगाः।। */ #include <bits/stdc++.h> using namespace std; #define int long long typedef long long ll; #define loop(i, ...
[["-", 31, 16, 12, 16, 12, 2, 3, 4, 0, 22], ["+", 31, 16, 12, 16, 12, 2, 3, 4, 0, 22]]
1
207
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { ll a, b, c, k, ans = 0; cin >> a >> b >> c >> k; if (a > k) ans = a - k; else if (a + b >= k) ans = a; else { ll minus = k - (a + b); ans = a - minus; } cout << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { ll a, b, c, k, ans = 0; cin >> a >> b >> c >> k; if (a > k) ans = k; else if (a + b >= k) ans = a; else { ll minus = k - (a + b); ans = a - minus; } cout << ans << endl; return 0; }
[["-", 0, 57, 64, 1, 0, 11, 12, 16, 31, 22], ["-", 0, 57, 64, 1, 0, 11, 12, 16, 17, 33]]
1
95
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { ll a, b, c, k, ans = 0; cin >> a >> b >> c >> k; if (a > k) { ans = a - k; cout << ans << endl; return 0; } if (a + b >= k) ans = a; else { ll minus = k - (a + b); ans = a - minus; } cout << ans << ...
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { ll a, b, c, k, ans = 0; cin >> a >> b >> c >> k; if (a > k) { ans = k; cout << ans << endl; return 0; } if (a + b >= k) ans = a; else { ll minus = k - (a + b); ans = a - minus; } cout << ans << endl...
[["-", 64, 9, 0, 1, 0, 11, 12, 16, 31, 22], ["-", 64, 9, 0, 1, 0, 11, 12, 16, 17, 33]]
1
105
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; int sum = 0; if (k <= a) { cout << a; return 0; } k -= a; sum += a; if (k <= b) { cout << sum; return 0; } k -= b; if (k <= c) { cout << (sum - k); } else { cout << (s...
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; int sum = 0; if (k <= a) { cout << k; return 0; } k -= a; sum += a; if (k <= b) { cout << sum; return 0; } k -= b; if (k <= c) { cout << (sum - k); } else { cout << (s...
[["-", 0, 57, 64, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 16, 12, 22]]
1
108
#include <iostream> using std::cin; using std::cout; using std::endl; int main() { int64_t A, B, C, K; cin >> A >> B >> C >> K; int64_t ans(0); if (A >= K) { cout << K << endl; return 0; } int64_t tmp = A + B; if (tmp >= K) { cout << K << endl; return 0; } ans = A - (K - A - B); ...
#include <iostream> using std::cin; using std::cout; using std::endl; int main() { int64_t A, B, C, K; cin >> A >> B >> C >> K; int64_t ans(0); if (A >= K) { cout << K << endl; return 0; } int64_t tmp = A + B; if (tmp >= K) { cout << A << endl; return 0; } ans = A - (K - A - B); ...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
107
s=input().split() a=int(s[0]) b=int(s[1]) c=int(s[2]) k=int(s[3]) if a+b>=k : print(a) else : print(2*a-k+b)
s=input().split() a=int(s[0]) b=int(s[1]) c=int(s[2]) k=int(s[3]) if a+b>=k : print(min(a,k)) else : print(2*a-k+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
68
A, B, C, K = map(int, input().split()) if A >= K: print(K) if K <= A+B: print(A) else: print(A - (K-(A+B)))
A, B, C, K = map(int, input().split()) if A >= K: print(K) elif K <= A+B: print(A) else: print(A - (K-(A+B)))
[["-", 36, 36, 36, 36, 0, 656, 0, 57, 0, 121], ["+", 36, 36, 0, 656, 0, 57, 75, 665, 0, 683]]
5
56
A,B,C,K=map(int,input().split()) if A>=K: print(K) elif (A+B)>=K: print(A) else: print(A-(K-A))
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))
[["+", 3, 4, 0, 657, 12, 23, 0, 657, 17, 33], ["+", 3, 4, 0, 657, 12, 23, 0, 657, 12, 22]]
5
54
a, b, c, k = [int(x) for x in input().split()] d = k - a if k <= a: print(a) elif b >= d: print(a) else: print(a + (d - b))
a, b, c, k = [int(x) for x in input().split()] d = k - a if k <= a: print(k) elif b >= d: print(a) else: print(a - (d - b))
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 1, 0, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 33]]
5
59
#include <stdio.h> int main(void) { int a, b, c, d, e, f; scanf("%d %d %d %d\n", &a, &b, &c, &d); if (a >= d) { printf("%d\n", d); } else if ((a + b) >= d) { printf("%d\n", d); } else { f = a - (d - (a + b)); printf("%d\n", f); } return 0; }
#include <stdio.h> int main(void) { int a, b, c, d, e, f; scanf("%d %d %d %d", &a, &b, &c, &d); if (a >= d) { printf("%d\n", d); } else if ((a + b) >= d) { printf("%d\n", a); } else { f = a - (d - (a + b)); printf("%d\n", f); } return 0; }
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44], ["-", 64, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 64, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
0
113
#include <algorithm> #include <climits> #include <cmath> #include <cstdint> #include <cstdlib> #include <ctime> #include <iomanip> #include <iostream> #include <limits> #include <math.h> #include <queue> #include <random> #include <stdio.h> #include <string> #include <tuple> #include <vector> using namespace std; tem...
#include <algorithm> #include <climits> #include <cmath> #include <cstdint> #include <cstdlib> #include <ctime> #include <iomanip> #include <iostream> #include <limits> #include <math.h> #include <queue> #include <random> #include <stdio.h> #include <string> #include <tuple> #include <vector> using namespace std; tem...
[["-", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["-", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["-", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 31, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 17, 151], ["+", 64, 9, 0, ...
1
1,081
A,B,C,K =map(int,input().split()) if A >= K: print(A) elif A + B >= K: print(A) elif A + B < K: c = -1 * (K-(A+B)) #print(c) #print(A) cc = A + c print(cc)
A,B,C,K =map(int,input().split()) if A >= K: print(K) elif A + B >= K: print(A) elif A + B < K: c = -1 * (K-(A+B)) #print(c) #print(A) cc = A + c print(cc)
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
72
a, b, c, k = map(int, input().split()) if k <= (a + b): print(a) else: print(a - min(c, (k - a - b)))
a, b, c, k = map(int, input().split()) if k <= (a + b): print(min(a, k)) else: print(a - min(c, (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
52
#include <bits/stdc++.h> using namespace std; int main(void) { long long a, b, c, k; cin >> a >> b >> c >> k; if (k < a) { cout << k << endl; } else if (a <= k || k <= (a + b)) { cout << a << endl; } else { int ans = 2 * a + b - k; cout << ans << endl; } }
#include <bits/stdc++.h> using namespace std; int main(void) { long long a, b, c, k; cin >> a >> b >> c >> k; if (k <= a) { cout << k << endl; } else if (a < k && k <= (a + b)) { cout << a << endl; } else { int ans = 2 * a + b - k; cout << ans << endl; } }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 19], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 18], ["-", 75, 76, 0, 57, 15, 339, 51, 16, 17, 106], ["+", 75, 76, 0, 57, 15, 339, 51, 16, 17, 98]]
1
90
#include <bits/stdc++.h> using namespace std; int main() { long long A, B, C, K; cin >> A >> B >> C >> K; long long ans = 0; if (K <= A) { ans = A; } else if (K <= (A + B)) { ans = A; } else { ans = A + A + B - K; } cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; int main() { long long A, B, C, K; cin >> A >> B >> C >> K; long long ans = 0; if (K <= A) { ans = K; } else if (K <= (A + B)) { ans = A; } else { ans = 2 * A + B - K; } cout << ans << endl; }
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["-", 0, 11, 12, 16, 31, 16, 31, 16, 31, 22], ["-", 0, 11, 12, 16, 31, 16, 31, 16, 17, 72], ["+", 0, 11, 12, 16, 31, 16, 31, 16, 31, 13], ["+", 0, 11, 12, 16, 31, 16, 31, 16, 17, 48]]
1
86
from sys import stdin A,B,C,K=list(map(int,(stdin.readline().strip().split()))) if A>=K: print(A) exit() if A+B>=K: print(A) exit() K=K-(A+B) print(A+(K*-1)) exit()
from sys import stdin A,B,C,K=list(map(int,(stdin.readline().strip().split()))) if A>=K: print(K) exit() if A+B>=K: print(A) exit() K=K-(A+B) print(A+(K*-1)) exit()
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
84
package main import ( "bufio" "fmt" "os" "strconv" ) var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout) func scanString() string { sc.Scan(); return sc.Text() } func scanRunes() []rune { return []rune(scanString()) } func scanInt() int { a, _ := strconv.Atoi(scanString()); return a ...
package main import ( "bufio" "fmt" "os" "strconv" ) var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout) func scanString() string { sc.Scan(); return sc.Text() } func scanRunes() []rune { return []rune(scanString()) } func scanInt() int { a, _ := strconv.Atoi(scanString()); return a ...
[["-", 0, 436, 12, 432, 0, 2, 3, 4, 0, 22], ["+", 0, 436, 12, 432, 0, 2, 3, 4, 0, 22]]
7
436
#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 << endl; } else { ll d = 2 * a - b -...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; using ll = long long; using P = pair<int, int>; int main() { ll a, b, c, k; cin >> a >> b >> c >> k; if (k < a) { cout << k << endl; } else if (k < a + b) { cout << a << endl; } else { ll d = 2 * a + b -...
[["-", 0, 43, 49, 50, 51, 16, 31, 16, 17, 33], ["+", 0, 43, 49, 50, 51, 16, 31, 16, 17, 72]]
1
109
#include <bits/stdc++.h> using namespace std; #pragma GCC target("avx") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define REP(i, n) for (int i = 1; i <= (int)(n); i++) #define repi(i, s, n) for (int i = (s); i < (int)(n); i++) #define all(x) (...
#include <bits/stdc++.h> using namespace std; #pragma GCC target("avx") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define REP(i, n) for (int i = 1; i <= (int)(n); i++) #define repi(i, s, n) for (int i = (s); i < (int)(n); i++) #define all(x) (...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
198
a, b, c, k = map(int, input().split()) ans = 0 if k <= a+b: ans = a else: ans = a-(k-a-b) print(ans)
a, b, c, k = map(int, input().split()) ans = 0 if k <= a+b: ans = min(a, k) else: ans = a-(k-a-b) print(ans)
[["+", 64, 196, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 21], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25]]
5
50
#include <bits/stdc++.h> #define rep(i, n) for (int(i) = 0; (i) < (n); i++) #define ll long long using namespace std; int main() { ll A = 0, B = 0, C = 0, K = 0, x = 0; cin >> A >> B >> C >> K; if (A >= K) { cout << A; return 0; } if (A + B >= K) { cout << A; return 0; } else { x = K - A...
#include <bits/stdc++.h> #define rep(i, n) for (int(i) = 0; (i) < (n); i++) #define ll long long using namespace std; int main() { ll A = 0, B = 0, C = 0, K = 0, x = 0; cin >> A >> B >> C >> K; if (A >= K) { cout << K; return 0; } if (A + B >= K) { cout << A; return 0; } else { x = K - A...
[["-", 0, 57, 64, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 16, 12, 22]]
1
103
n = list(map(int,input().split())) sum = 0 num = 0 nm = [1,0,-1] c = n[3] cu =0 for i in n: print(sum) if c == 0: break if i > c: sum+= nm[num]*c break if i <= c: sum += nm[num] * i c-=i num+=1 print(sum)
n = list(map(int,input().split())) sum = 0 num = 0 nm = [1,0,-1] c = n[3] cu =0 for i in n: if c == 0: break if i > c: sum+= nm[num]*c break if i <= c: sum += nm[num] * i c-=i num+=1 print(sum)
[["-", 0, 7, 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
94
A,B,C,K = map(int, input().split()) D = 0 if K-A-B > 0: D = K-A-B if K == A: ans = A - D else: ans = K print(ans)
A,B,C,K = map(int, input().split()) D = 0 if K-A-B > 0: D = K-A-B if K >= A: ans = A - D else: ans = K print(ans)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 60], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20]]
5
58
#include <bits/stdc++.h> #define ll long long using namespace std; int main() { ll aa, bb, cc, kk; cin >> aa >> bb >> cc >> kk; ll ans = 0; ans += min(aa, kk); kk -= min(aa, kk); kk = max(0ll, kk); // ans += min(bb, kk); kk -= min(bb, kk); kk = max(0ll, kk); ans += min(cc, kk); cout << ans; }
#include <bits/stdc++.h> #define ll long long using namespace std; int main() { ll aa, bb, cc, kk; cin >> aa >> bb >> cc >> kk; ll ans = 0; ans += min(aa, kk); kk -= min(aa, kk); kk = max(0ll, kk); // ans += min(bb, kk); kk -= min(bb, kk); kk = max(0ll, kk); ans -= min(cc, kk); cout << ans; }
[["-", 0, 14, 8, 9, 0, 1, 0, 11, 17, 107], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 17, 110]]
1
98
#include <stdio.h> int main() { int n[3], i, max = 0; int x[3] = {1, 0, -1}; long k; for (i = 0; i < 4; i++) { if (i == 3) { scanf("%ld", &k); } else scanf("%d", &n[i]); max += n[i]; } if (n[0] >= k) printf("%d", k); else if (n[0] + n[1] >= k) { printf("%d", n[0]); }...
#include <stdio.h> int main() { int n[3], i, max = 0; int x[3] = {1, 0, -1}; long k; for (i = 0; i < 4; i++) { if (i == 3) { scanf("%ld", &k); } else scanf("%d", &n[i]); max += n[i]; } if (n[0] >= k) printf("%d", k); else if (n[0] + n[1] >= k) { printf("%d", n[0]); }...
[["-", 3, 4, 0, 16, 31, 16, 31, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 2, 3, 4, 0, 16, 12, 23, 0, 24], ["-", 3, 4, 0, 16, 31, 16, 12, 69, 71, 13], ["+", 12, 23, 0, 16, 31, 16, 12, 69, 71, 13], ["+", 0, 2, 3, 4, 0, 16, 12, 23, 0, 25]]
0
168
a,b,c,k=map(int,input().split()) ans=0 if a>=k: ans=a print(ans) exit() else: ans=a k=k-a if b>=k: print(ans) exit() else: k=k-b print(ans-k)
a,b,c,k=map(int,input().split()) ans=0 if a>=k: ans=k print(ans) exit() else: ans=a k=k-a if b>=k: print(ans) exit() else: k=k-b print(ans-k)
[["-", 0, 57, 64, 196, 0, 1, 0, 662, 12, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 12, 22]]
5
73
#include <algorithm> #include <cmath> #include <iostream> using namespace std; using ll = long long; using ld = long double; #ifdef EBUG #define debug(x) cout << "\033[31m" << #x << ": " << x << "\033[0m\n"; #else #define debug(x) #endif #define rep(i, n) for (int i = 0; i < (int)(n); i++) ll a, b, c, k, sum; int...
#include <algorithm> #include <cmath> #include <iostream> using namespace std; using ll = long long; using ld = long double; #ifdef EBUG #define debug(x) cout << "\033[31m" << #x << ": " << x << "\033[0m\n"; #else #define debug(x) #endif #define rep(i, n) for (int i = 0; i < (int)(n); i++) ll a, b, c, k, sum; int...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
128
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))
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))
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
56
#!/usr/bin/env python3 # -*- coding: utf-8 -*- a,b,c,k = map(int, input().split()) if a + b >= k: if a >= k: print(a) else: print(k) else: print(a - (k - (a + b)))
#!/usr/bin/env python3 # -*- coding: utf-8 -*- a,b,c,k = map(int, input().split()) if a + b >= k: if a <= k: print(a) else: print(k) else: print(a - (k - (a + b)))
[["-", 0, 57, 64, 196, 0, 57, 15, 666, 667, 20], ["+", 0, 57, 64, 196, 0, 57, 15, 666, 667, 19]]
5
60
#include <stdio.h> int main(void) { int a, b, c, k, x; scanf("%d %d %d %d", &a, &b, &c, &k); x = k - a; if (x <= 0) { printf("%d", a); } else if (b >= x) { printf("%d", a); } else { printf("%d", 2 * a + b - k); } return 0; }
#include <stdio.h> int main(void) { int a, b, c, k, x; scanf("%d %d %d %d", &a, &b, &c, &k); x = k - a; if (x <= 0) { printf("%d", k); } else if (b >= x) { printf("%d", a); } else { printf("%d", 2 * a + b - k); } return 0; }
[["-", 64, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 64, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
0
101
A, B, C, K = map(int, input().split()) if K - A <= 0: print(A) elif K - A - B <= 0: print(A) else: print(A - (K - (A + B)))
A, B, C, K = map(int, input().split()) if K - A <= 0: print(K) elif K - A - B <= 0: print(A) else: print(A - (K - (A + B)))
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
60
A, B, C, K = map(int, input().split()) if A >= K: x = A else: if A + B >= K: x = A else: x = 2 * A + B - K print(x)
A, B, C, K = map(int, input().split()) if A >= K: x = K else: if A + B >= K: x = A else: x = 2 * A + B - K print(x)
[["-", 0, 57, 64, 196, 0, 1, 0, 662, 12, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 12, 22]]
5
55
#include <bits/stdc++.h> using namespace std; #define fast \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL) typedef long l...
#include <bits/stdc++.h> using namespace std; #define fast \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL) typedef long l...
[["-", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22], ["+", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 23, 0, 24], ["+", 0, 57, 15, 339, 51, 16, 12, 23, 0, 25], ["-", 0, 1, 0, 16, 31, 16, 12, 23, 0, 24], ["+", 12, 16, 12, 23, 0, 16, 12, 23, 0, 24], ["-", 12, 23, 0, 16, 12, 23, 0, 16, 17, 33], ["+", ...
1
130
a,b,c,k=map(int,input().split()) if k<=a+b: print(a) else: print(a-(k-(a+b)))
a,b,c,k=map(int,input().split()) if k<=a+b: print(min(k,a)) 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, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 21], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
47
#include <bits/stdc++.h> using namespace std; int main() { long long A, B, C, K, ans; cin >> A >> B >> C >> K; if (A + B > K) { ans = max(A, K); } else { ans = A - (K - A - B); } cout << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { long long A, B, C, K, ans; cin >> A >> B >> C >> K; if (A + B > K) { ans = min(A, K); } else { ans = A - (K - A - B); } cout << ans << endl; return 0; }
[["-", 64, 9, 0, 1, 0, 11, 12, 2, 63, 22], ["+", 64, 9, 0, 1, 0, 11, 12, 2, 63, 22]]
1
77
a, b, c, k = map(int, input().split()) chk1 = k-a chk2 = k-a-b if chk1 <= 0: ans = a else: if chk2 > 0: ans = a -1*chk2 else: ans = a print(ans)
a, b, c, k = map(int, input().split()) chk1 = k-a chk2 = k-a-b if chk1 <= 0: ans = k else: if chk2 > 0: ans = a -1*chk2 else: ans = a print(ans)
[["-", 0, 57, 64, 196, 0, 1, 0, 662, 12, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 12, 22]]
5
63
a,b,c,k = map(int,input().split()) if k == 0: print(0) elif a > k: print(a-k) elif a+b >= k: print(a) else: ab = a+b ans = a - (k-ab) print(ans)
a,b,c,k = map(int,input().split()) aa=a if k == 0: print(0) elif a > k: print(k) elif a+b >= k: print(a) else: ab = a+b ans = aa-(k-ab) print(ans)
[["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 22], ["-", 0, 1, 0, 652, 3, 4, 0, 657, 31, 22], ["-", 0, 1, 0, 652, 3, 4, 0, 657, 17, 33], ["-", 8, 196, 0, 1, 0, 662, 12, 657, 31, 22], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 31, 22]]
5
71
a,b,c,k=map(int,input().split()) print(2*a+b-k if a+b<k else a)
a,b,c,k=map(int,input().split()) print(2*a+b-k if a+b<k else min(a,k))
[["+", 0, 652, 3, 4, 0, 41, 0, 652, 63, 22], ["+", 3, 4, 0, 41, 0, 652, 3, 4, 0, 24], ["+", 3, 4, 0, 41, 0, 652, 3, 4, 0, 21], ["+", 3, 4, 0, 41, 0, 652, 3, 4, 0, 22], ["+", 3, 4, 0, 41, 0, 652, 3, 4, 0, 25]]
5
38
#include <stdio.h> int main() { long long a, b, c, k, sum; scanf("%lld %lld %lld %lld", &a, &b, &c, &k); if (k <= a) { sum = a; } else if (k <= a + b) { sum = a; } else { sum = a - (k - a - b); } printf("%lld", sum); return 0; }
#include <stdio.h> int main() { long long a, b, c, k, sum; scanf("%lld %lld %lld %lld", &a, &b, &c, &k); if (k <= a) { sum = k; } else if (k <= a + b) { sum = a; } else { sum = a - (k - a - b); } printf("%lld", sum); return 0; }
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22]]
1
93
#include <iostream> #include <set> using namespace std; int main() { int A, B, C, K; int ans; cin >> A >> B >> C >> K; if (A >= K) ans = K; else if (A + B >= K) ans = A; else ans = A + (K - A - B * (-1)); cout << ans << endl; }
#include <iostream> #include <set> using namespace std; int main() { int A, B, C, K; int ans; cin >> A >> B >> C >> K; if (A >= K) ans = K; else if (A + B >= K) ans = A; else ans = A + (K - A - B) * (-1); cout << ans << endl; }
[["+", 0, 11, 12, 16, 12, 16, 31, 23, 0, 25], ["-", 12, 23, 0, 16, 12, 16, 12, 23, 0, 25]]
1
82
#include <algorithm> #include <bits/stdc++.h> #include <vector> #define ll long long int #define vi vector<int> using namespace std; int main() { ll i, j, n, a, b, c, k; cin >> a >> b >> c >> k; if (k <= a + b) { cout << a; } else { i = a * 1 + b * 0; cout << ((k - (a + b)) * (-1)) + i; } }
#include <algorithm> #include <bits/stdc++.h> #include <vector> #define ll long long int #define vi vector<int> using namespace std; int main() { ll i, j, n, a, b, c, k; cin >> a >> b >> c >> k; if (k <= a + b) { cout << min(a, k); } else { i = a * 1 + b * 0; cout << ((k - (a + b)) * (-1)) + i; } ...
[["+", 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
94
#include <stdio.h> int main(void) { long long int A, B, C, K, sum; scanf("%lld%lld%lld%lld", &A, &B, &C, &K); if (A > K) { printf("%lld", A); } else if (A + B > K) { printf("%lld", A); } else { printf("%lld", A - K + A + B); } return 0; }
#include <stdio.h> int main(void) { long long int A, B, C, K, sum; scanf("%lld%lld%lld%lld", &A, &B, &C, &K); if (A > K) { printf("%lld", K); } else if (A + B > K) { printf("%lld", A); } else { printf("%lld", A - K + A + B); } return 0; }
[["-", 64, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 64, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
0
99
a, b, c, k = map(int, input().split()) if a >= k: print(a) else: if k - a - b >= 0: print(a - k + a + b) else: print(a)
a, b, c, k = map(int, input().split()) if a >= k: print(k) else: if k - a - b >= 0: print(a - k + a + b) else: print(a)
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
56
a, b, c, k = gets.chomp.split.map(&:to_i) ans = 0 if a >= k ans += a puts ans exit elsif a < k ans += a k -= a end if b >= k puts ans exit elsif b < k k -= b end ans -= k puts ans
a, b, c, k = gets.chomp.split.map(&:to_i) ans = 0 if a >= k ans += k puts ans exit elsif a < k ans += a k -= a end if b >= k puts ans exit elsif b < k k -= b end ans -= k puts ans
[["-", 0, 493, 0, 121, 64, 749, 0, 755, 12, 22], ["+", 0, 493, 0, 121, 64, 749, 0, 755, 12, 22]]
4
63
#include <bits/stdc++.h> #include <climits> #include <cmath> #include <cstring> #define int long long #define umitr unordered_map<int, int>::iterator #define usitr unordered_set<int>::iterator #define fast \ ios_base::sync_with_stdio(false); ...
#include <bits/stdc++.h> #include <climits> #include <cmath> #include <cstring> #define int long long #define umitr unordered_map<int, int>::iterator #define usitr unordered_set<int>::iterator #define fast \ ios_base::sync_with_stdio(false); ...
[["+", 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
175
#include <iostream> using namespace std; int main() { long int A, B, C, K; cin >> A >> B >> C >> K; long int sum = 0LL; if (K <= (A + B)) { if (K > A) { sum = A; } if (K < A) { sum = K; } } else if (K > (A + B)) { K = K - A - B; sum = A - K; } cout << sum; }
#include <iostream> using namespace std; int main() { long int A, B, C, K; cin >> A >> B >> C >> K; long int sum = 0LL; if (K <= (A + B)) { if (K > A) { sum = A; } if (K <= A) { sum = K; } } else if (K > (A + B)) { K = K - A - B; sum = A - K; } cout << sum; }
[["-", 64, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
105
l = list(map(int,input().split())) a = l[0] b = l[1] c = l[2] k = l[3] if (k-a-b) >0: print(a-1*(k-a-b)) else: print(a)
l = list(map(int,input().split())) a = l[0] b = l[1] c = l[2] k = l[3] if (k-a-b) >0: print(a-1*(k-a-b)) else: print(min(a,k))
[["+", 0, 1, 0, 652, 3, 4, 0, 652, 63, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 21], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
72
def main(): A,B,C,K=map(int,input().split()) if K <= (A+B): print(A) else: print(A-(K-A-B)) main()
def main(): A,B,C,K=map(int,input().split()) if K <= (A+B): print(min(K,A)) else: print(A-(K-A-B)) main()
[["+", 0, 1, 0, 652, 3, 4, 0, 652, 63, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 21], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
55
#include <algorithm> #include <iostream> #include <map> #include <set> #include <vector> using namespace std; int main() { long A, B, C, K; cin >> A >> B >> C >> K; if (A >= K) cout << K << endl; if (B >= K - A) cout << A << endl; else cout << A - (K - A - B) << endl; return 0; }
#include <algorithm> #include <iostream> #include <map> #include <set> #include <vector> using namespace std; int main() { long A, B, C, K; cin >> A >> B >> C >> K; if (A >= K) cout << K << endl; else if (B >= K - A) cout << A << endl; else cout << A - (K - A - B) << endl; return 0; }
[["+", 0, 14, 8, 9, 0, 57, 75, 76, 0, 95]]
1
83
#include <iostream> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; int sum = 0; int a1, a2, a3; if (k >= a) { sum = sum + (a * 1); k = k - a; // printf(" %d %d\n",k,sum); } else if (k < a && k > 0) { sum = sum + (k * (a)); k = 0; // printf("%d %d\n",k,sum...
#include <iostream> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; int sum = 0; int a1, a2, a3; if (k >= a) { sum = sum + (a * 1); k = k - a; // printf(" %d %d\n",k,sum); } else if (k < a && k > 0) { sum = sum + (k * (1)); k = 0; // printf("%d %d\n",k,sum...
[["-", 12, 16, 12, 23, 0, 16, 12, 23, 0, 22], ["+", 12, 16, 12, 23, 0, 16, 12, 23, 0, 13]]
1
215
package main import "fmt" func main() { var a, b, c, k int fmt.Scanf("%d %d %d %d", &a, &b, &c, &k) aCount := min(a, k) bCount := min(b, k-aCount) cCount := min(b, k-aCount-bCount) fmt.Println(aCount - cCount) } func min(first, second int) int { if first < second { return first } return second }
package main import "fmt" func main() { var a, b, c, k int fmt.Scanf("%d %d %d %d", &a, &b, &c, &k) aCount := min(a, k) bCount := min(b, k-aCount) cCount := min(c, k-aCount-bCount) fmt.Println(aCount - cCount) } func min(first, second int) int { if first < second { return first } return second }
[["-", 0, 431, 12, 432, 0, 2, 3, 4, 0, 22], ["+", 0, 431, 12, 432, 0, 2, 3, 4, 0, 22]]
7
113
#include <bits/stdc++.h> #define int long long using namespace std; int32_t main() { ios_base::sync_with_stdio(0); cout.tie(0); cin.tie(0); int a, b, c, k; cin >> a >> b >> c >> k; if (a >= k) { cout << k; } if (a <= k && a + b >= k) { cout << a; } else { cout << 2 * a + b - k; } }
#include <bits/stdc++.h> #define int long long using namespace std; int32_t main() { ios_base::sync_with_stdio(0); cout.tie(0); cin.tie(0); int a, b, c, k; cin >> a >> b >> c >> k; if (a >= k) { cout << k; } else if (a <= k && a + b >= k) { cout << a; } else { cout << 2 * a + b - k; } }
[["+", 0, 14, 8, 9, 0, 57, 75, 76, 0, 95]]
1
98
#include <stdio.h> int main() { int a, b, c, d, k; scanf("%d %d %d %d", &a, &b, &c, &k); if (a >= k) { printf("%d\n", a); } else { d = k - a; if (b >= d) { printf("%d\n", a); } else { printf("%d\n", a - (k - a - b)); } } return 0; }
#include <stdio.h> int main() { int a, b, c, d, k; scanf("%d %d %d %d", &a, &b, &c, &k); if (a >= k) { printf("%d\n", k); } else { d = k - a; if (b >= d) { printf("%d\n", a); } else { printf("%d\n", a - (k - a - b)); } } return 0; }
[["-", 64, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 64, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
0
107
#include <bits/stdc++.h> #define int long long using namespace std; using Graph = vector<vector<int>>; signed main() { int A, B, C, K; cin >> A >> B >> C >> K; if (A + B >= K) { cout << A << endl; } else { K -= A + B; cout << A - K << endl; } }
#include <bits/stdc++.h> #define int long long using namespace std; using Graph = vector<vector<int>>; signed main() { int A, B, C, K; cin >> A >> B >> C >> K; if (A + B >= K) { cout << min(A, K) << endl; } else { K -= A + B; cout << A - K << endl; } }
[["+", 0, 1, 0, 16, 31, 16, 12, 2, 63, 22], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 24], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 21], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 22], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 25]]
1
78
import sys input = sys.stdin.readline A,B,C,K=(int(x) for x in input().rstrip('\n').split()) res = A if A<K: K-=A if B<K: K -= B res -= K print(res)
import sys input = sys.stdin.readline A,B,C,K=(int(x) for x in input().rstrip('\n').split()) res = A if A<K: K-=A if B<K: K -= B res -= K else: res =K print(res)
[["+", 36, 36, 0, 656, 0, 57, 75, 76, 0, 95], ["+", 36, 36, 0, 656, 0, 57, 75, 76, 0, 102], ["+", 75, 76, 8, 196, 0, 1, 0, 662, 31, 22], ["+", 75, 76, 8, 196, 0, 1, 0, 662, 0, 32], ["+", 75, 76, 8, 196, 0, 1, 0, 662, 12, 22]]
5
66
a,b,c,k=map(int,input().split()) n=0 if (k-a)>=0: n+=a*1 if (k-a-b)>0: if(k-a-b-c)>=0: n-=c*-1 else: n-=(k-a-b)*1 else: pass else: n+=k*1 print(n)
a,b,c,k=map(int,input().split()) n=0 if (k-a)>=0: n+=a*1 if (k-a-b)>0: if(k-a-b-c)>=0: n-=c*1 else: n-=(k-a-b)*1 else: pass else: n+=k*1 print(n)
[["-", 0, 1, 0, 677, 12, 657, 12, 664, 17, 33]]
5
94
A,B,C,K = list(map(int, input().split())) sum = 0 if A <= K: sum += A K -= A else: sum += K K = 0 if B < K: sum += 0 K -= B else: sum += 0 if K > 0: sum -= K else: sum += 0 print(sum)
A,B,C,K = list(map(int, input().split())) sum = 0 if A <= K: sum += A K -= A else: sum += K K = 0 if B < K: sum += 0 K -= B else: sum += 0 K = 0 if K > 0: sum -= K else: sum += 0 print(sum)
[["+", 75, 76, 8, 196, 0, 1, 0, 662, 31, 22], ["+", 75, 76, 8, 196, 0, 1, 0, 662, 0, 32], ["+", 75, 76, 8, 196, 0, 1, 0, 662, 12, 612]]
5
78
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using vi = vector<int>; using vvi = vector<vector<int>>; using pi = pair<int, int>; using mp = map<int, int>; using ump = unordered_map<int, int>; #define MOD 1000000007 #include <ext/pb_ds/assoc_container.hpp> using namespace ...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using vi = vector<int>; using vvi = vector<vector<int>>; using pi = pair<int, int>; using mp = map<int, int>; using ump = unordered_map<int, int>; #define MOD 1000000007 #include <ext/pb_ds/assoc_container.hpp> using namespace ...
[["-", 0, 11, 12, 16, 31, 23, 0, 16, 31, 22], ["-", 0, 11, 12, 16, 31, 23, 0, 16, 17, 33]]
1
308
A, B, C, K = [int(i) for i in input().split(" ")] N = [A, B, C] for i in range(len(N)): K -= N[i] if K == 0: if i == 0: N[i+1] = 0 N[i+2] = 0 elif i == 1: N[i+1] = 0 break elif K < 0: if i == 0: N[i+1] = 0 N[i+2] = 0...
A, B, C, K = [int(i) for i in input().split(" ")] N = [A, B, C] for i in range(len(N)): K -= N[i] if K == 0: if i == 0: N[i+1] = 0 N[i+2] = 0 elif i == 1: N[i+1] = 0 break elif K < 0: if i == 0: N[i+1] = 0 N[i+2] = 0...
[["-", 0, 1, 0, 677, 31, 206, 206, 657, 17, 33], ["-", 0, 1, 0, 677, 31, 206, 206, 657, 12, 612]]
5
157
#include <algorithm> #include <bitset> #include <cmath> #include <ctime> #include <iostream> #include <list> #include <map> #include <math.h> #include <numeric> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < (n); i++) #define...
#include <algorithm> #include <bitset> #include <cmath> #include <ctime> #include <iostream> #include <list> #include <map> #include <math.h> #include <numeric> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < (n); i++) #define...
[["+", 64, 1, 0, 16, 31, 16, 12, 2, 63, 22], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 24], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 22], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 21], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 25]]
1
333
#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 - K << endl; } else if (A < K && A + B >= K) { cout << A << endl; } else if (A < K && A + B < K) { 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 < K && A + B >= K) { cout << A << endl; } else if (A < K && A + B < K) { cout << A - (K - (A + B)) << endl; } }
[["-", 0, 1, 0, 16, 31, 16, 12, 16, 31, 22], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 17, 33]]
1
100
#include <bits/stdc++.h> //{ START using namespace std; #define int int64_t #define rep(i, a, n) for (int i = (a); i < (n); ++i) #define reps(i, a, n) for (int i = (a); i > (n); --i) #define arep(i, x) for (auto &&i : (x)) #define irep(i, x) for (auto i = (x).begin(); i != (x).end(); ++i) //降順はgreater<T>() #define all...
#include <bits/stdc++.h> //{ START using namespace std; #define int int64_t #define rep(i, a, n) for (int i = (a); i < (n); ++i) #define reps(i, a, n) for (int i = (a); i > (n); --i) #define arep(i, x) for (auto &&i : (x)) #define irep(i, x) for (auto i = (x).begin(); i != (x).end(); ++i) //降順はgreater<T>() #define all...
[["+", 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
488
import java.util.*; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int A = scanner.nextInt(); int B = scanner.nextInt(); int C = scanner.nextInt(); int K = scanner.nextInt(); if (A >= K) { System.out.println(A); } else if (A ...
import java.util.*; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int A = scanner.nextInt(); int B = scanner.nextInt(); int C = scanner.nextInt(); int K = scanner.nextInt(); if (A >= K) { System.out.println(K); } else if (A ...
[["-", 64, 196, 0, 1, 0, 492, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 492, 3, 4, 0, 22]]
3
140
// Bismillah hirrahmanir Rahim #include <bits/stdc++.h> #define corret 1 #define ll long long #define pb push_back #define dbug printf("I am here\n"); #define Fast \ ios_base::sync_with_stdio(false); \ cin.t...
// Bismillah hirrahmanir Rahim #include <bits/stdc++.h> #define corret 1 #define ll long long #define pb push_back #define dbug printf("I am here\n"); #define Fast \ ios_base::sync_with_stdio(false); \ cin.t...
[["-", 0, 1, 0, 11, 12, 2, 3, 4, 0, 22], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 22], ["-", 0, 43, 49, 50, 51, 2, 3, 4, 0, 22], ["+", 0, 43, 49, 50, 51, 2, 3, 4, 0, 22]]
1
138
#include <bits/stdc++.h> using namespace std; int main() { int A, B, C, K; cin >> A >> B >> C >> K; int x = A + B; int y = A + B + C; if (K <= A) { cout << K << endl; } else if (A < K && K <= x) { cout << A << endl; } else if (x < K && K < y) { cout << (A + A + B) - K << endl; } else if (K >...
#include <bits/stdc++.h> using namespace std; int main() { int A, B, C, K; cin >> A >> B >> C >> K; int x = A + B; int y = A + B + C; if (K <= A) { cout << K << endl; } else if (A < K && K <= x) { cout << A << endl; } else if (x < K && K <= y) { cout << (A + A + B) - K << endl; } else if (K ...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 18], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 19]]
1
124
#include <bits/stdc++.h> using namespace std; int main() { int A, B, C, K; cin >> A >> B >> C >> K; if (A >= K) { cout << K << endl; } else if (A + B >= K) { cout << A << endl; } else { cout << A + C * (K - A - B) * -1 << endl; } }
#include <bits/stdc++.h> using namespace std; int main() { int A, B, C, K; cin >> A >> B >> C >> K; if (A >= K) { cout << K << endl; } else if (A + B >= K) { cout << A << endl; } else { cout << A + (K - A - B) * -1 << endl; } }
[["-", 31, 16, 12, 16, 12, 16, 31, 16, 31, 22], ["-", 31, 16, 12, 16, 12, 16, 31, 16, 17, 48]]
1
83
A,B,C,K = map(int,input().split()) if K > A: if K > A + B: print(A-(K-A-B)) else: print(K) else: print(A)
A,B,C,K = map(int,input().split()) if K > A: if K > A + B: print(A-(K-A-B)) else: print(A) else: print(K)
[["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
56
#include <stdio.h> int main() { long long a, b, c, k, sum, x; scanf("%lld %lld %lld %lld", &a, &b, &c, &k); if (k <= a) { sum = a; } else if (k <= (a + b)) { sum = a; } else if (k <= (a + b + c)) { x = k - (a + b); sum = a - x; } printf("%lld\n", sum); return 0; }
#include <stdio.h> int main() { long long a, b, c, k, sum, x; scanf("%lld %lld %lld %lld", &a, &b, &c, &k); if (k <= a) { sum = k; } else if (k <= (a + b)) { sum = a; } else if (k <= (a + b + c)) { x = k - (a + b); sum = a - x; } printf("%lld\n", sum); return 0; }
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22]]
0
114
#include <bits/stdc++.h> using namespace std; int main() { long long int a, b = 0, c, k, p = 0, q = 0; cin >> a >> b >> c >> k; p = k - a; q = k - a - b; if (a >= k) cout << a << endl; else if (b + a >= k && k > a) cout << a << endl; else if (c + a + b >= k && k > a + b) cout << a + q * (-1) <...
#include <bits/stdc++.h> using namespace std; int main() { long long int a, b = 0, c, k, p = 0, q = 0; cin >> a >> b >> c >> k; p = k - a; q = k - a - b; if (a >= k) cout << k << endl; else if (b + a >= k && k > a) cout << a << endl; else if (c + a + b >= k && k > a + b) cout << a + q * (-1) <...
[["-", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22], ["+", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22]]
1
120
a, b, c, k = map(int, input().split()) ans = 0 if(k <= a): print(a) elif(k <= a + b): print(a) else: ans = k - (a + b) print(a - ans)
a, b, c, k = map(int, input().split()) ans = 0 if(k <= a): print(k) elif(k <= a + b): print(a) else: ans = k - (a + b) print(a - ans)
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
64
#include <iostream> using namespace std; int main(void) { int A, B, C, K; cin >> A >> B >> C >> K; if (A >= K) printf("%d", K); else if (A + B >= K) printf("%d", A); else printf("%d", 2 * A - K - B); return 0; }
#include <iostream> using namespace std; int main(void) { int A, B, C, K; cin >> A >> B >> C >> K; if (A >= K) printf("%d", K); else if (A + B >= K) printf("%d", A); else printf("%d", A - (K - A - B)); return 0; }
[["-", 3, 4, 0, 16, 31, 16, 31, 16, 31, 13], ["-", 3, 4, 0, 16, 31, 16, 31, 16, 17, 48], ["+", 0, 2, 3, 4, 0, 16, 12, 23, 0, 24], ["+", 0, 16, 12, 23, 0, 16, 31, 16, 17, 33], ["+", 0, 16, 12, 23, 0, 16, 31, 16, 12, 22], ["+", 0, 2, 3, 4, 0, 16, 12, 23, 0, 25]]
1
84
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll inf = 9999999999999999; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); ll a, b, c, k, ans; cin >> a >> b >> c >> k; if (a >= k) { ans = k; } else if (a + b >= k) { ans = a; } else { ans = k - b; } cout <<...
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll inf = 9999999999999999; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); ll a, b, c, k, ans; cin >> a >> b >> c >> k; if (a >= k) { ans = k; } else if (a + b >= k) { ans = a; } else { ans = 2 * a + b - k; } ...
[["-", 0, 9, 0, 1, 0, 11, 12, 16, 31, 22], ["-", 0, 9, 0, 1, 0, 11, 12, 16, 17, 33], ["+", 0, 11, 12, 16, 31, 16, 31, 16, 31, 13], ["+", 0, 11, 12, 16, 31, 16, 31, 16, 17, 48], ["+", 0, 11, 12, 16, 31, 16, 31, 16, 12, 22], ["+", 0, 1, 0, 11, 12, 16, 31, 16, 17, 72], ["+", 0, 9, 0, 1, 0, 11, 12, 16, 17, 33], ["+", 0, 9,...
1
104
a,b,c,k=(int(x) for x in input().split()) score=0 if a>=k: score=k print(score) else: score+=a k-=a if b>=k : print(score) else: k-=b if c>=k and k>0: score-=c print(score) else: print(score)
a,b,c,k=(int(x) for x in input().split()) score=0 if a>=k: score=k print(score) else: score+=a k-=a if b>=k : print(score) else: k-=b if c>=k and k>0: score-=k print(score) else: print(score)
[["-", 0, 57, 64, 196, 0, 1, 0, 677, 12, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 677, 12, 22]]
5
83
A,B,C,K=map(int,input().split()) ans=0 if A<=K: K-=A ans=A if B<=K: K-=B if C<=K: ans-=C else: B=K-B else: ans=K print(ans)
A,B,C,K=map(int,input().split()) ans=0 if A<=K: K-=A ans=A if B<=K: K-=B if C<=K: ans-=C else: ans-=K else: B=K-B else: ans=K print(ans)
[["+", 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], ["+", 0, 57, 64, 196, 0, 57, 75, 76, 0, 95], ["+", 0, 57, 64, 196, 0, 57, 75, 76, 0, 102]]
5
66
#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; else if ((A + B) >= K) cout << A; else cout << A - (K - A - B); return 0; }
#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; else if ((A + B) >= K) cout << A; else cout << A - (K - 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
A, B, C, K = map(int,input().split()) if K <= A: print(K) elif K <= A+B: print(A) else: print(A + C*-1*(K-A-B))
A, B, C, K = map(int,input().split()) if K <= A: print(K) elif K <= A + B: print(A) else: print(A + -1*(K-A-B))
[["-", 3, 4, 0, 657, 12, 657, 31, 657, 31, 22], ["-", 3, 4, 0, 657, 12, 657, 31, 657, 17, 48]]
5
59
A, B, C, K = map(int, input().split()) if A >= K: print(A) exit() ans = A K -= A if B >= K: print(ans) exit() K -= B if C >= K: print(ans - K) else: print(ans - C)
A, B, C, K = map(int, input().split()) if A >= K: print(K) exit() ans = A K -= A if B >= K: print(ans) exit() K -= B if C >= K: print(ans - K) else: print(ans - C)
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
72
#include <algorithm> #include <cmath> #include <cstring> #include <functional> #include <iostream> #include <numeric> #include <string> #include <vector> #define roop(i, n) for (int i = 0; i < n; i++) #define DIV 1000000007 using namespace std; using ll = long long int; using ull = unsigned long long; float myPower(...
#include <algorithm> #include <cmath> #include <cstring> #include <functional> #include <iostream> #include <numeric> #include <string> #include <vector> #define roop(i, n) for (int i = 0; i < n; i++) #define DIV 1000000007 using namespace std; using ll = long long int; using ull = unsigned long long; float myPower(...
[["-", 31, 16, 12, 16, 12, 23, 0, 16, 12, 22], ["+", 12, 16, 12, 23, 0, 16, 31, 16, 12, 22], ["+", 31, 16, 12, 16, 12, 23, 0, 16, 17, 33], ["+", 31, 16, 12, 16, 12, 23, 0, 16, 12, 22]]
1
537
#include <iostream> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; if (k <= a) cout << k << endl; else if (a < k && k <= a + b) cout << a << endl; else cout << a - (k - a + b) << endl; return 0; }
#include <iostream> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; if (k <= a) cout << k << endl; else if (a < k && k <= a + b) cout << a << endl; else cout << a - (k - a - b) << endl; return 0; }
[["-", 31, 16, 12, 16, 12, 23, 0, 16, 17, 72], ["+", 31, 16, 12, 16, 12, 23, 0, 16, 17, 33]]
1
80
a,b,c,k = map(int,input().split()) ans = 0 if k<=a: ans += a elif k>a and k<=(a+b): ans += a elif k>a and 0<=(k-a-b)<c: ans += a + (k-a-b)*(-1) elif k>a and (k-a-b)>=c: ans += a + c*(-1) print(ans)
a,b,c,k = map(int,input().split()) ans = 0 if k<=a: ans += k elif k>a and k<=(a+b): ans += a elif k>a and 0<(k-a-b)<c: ans += a + (k-a-b)*(-1) elif k>a and (k-a-b)>=c: ans += a + c*(-1) print(ans)
[["-", 0, 57, 64, 196, 0, 1, 0, 677, 12, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 677, 12, 22], ["-", 0, 57, 75, 665, 15, 679, 12, 666, 667, 19], ["+", 0, 57, 75, 665, 15, 679, 12, 666, 667, 18]]
5
109
#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; return 0; } else if (a + b >= k) { cout << a; return 0; } else { int d = k - (a + b); cout << a - d; return 0; } return 0; }
#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; return 0; } else if (a + b >= k) { cout << a; return 0; } else { int d = k - (a + b); cout << a - d; return 0; } return 0; }
[["-", 0, 57, 64, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 16, 12, 22]]
1
91
#include <algorithm> #include <bits/stdc++.h> #include <climits> #include <cmath> #include <cstdio> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <utility> #include <vector> using namespace std; using ll = long long int; #define REP(i, n) for (ll i = ...
#include <algorithm> #include <bits/stdc++.h> #include <climits> #include <cmath> #include <cstdio> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <utility> #include <vector> using namespace std; using ll = long long int; #define REP(i, n) for (ll i = ...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
560
a,b,c,k=map(int,input().split()) printmin((a-max(k-a-b,0)),k)
a,b,c,k=map(int,input().split()) print(min((a-max(k-a-b,0)),k))
[["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 652, 63, 22], ["+", 3, 4, 0, 652, 3, 4, 0, 23, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
39
a = list(map(int, input().split())) n = a[0] m = a[1] l = a[2] k = a[3] if 0 < k <= n: print(k) elif n < k <= n + m: print(n) elif n+m <= k < n+m+l: print(n -1*(k - (n+m))) elif n+m+l < k : print(n - l) else: print(0)
a = list(map(int, input().split())) n = a[0] m = a[1] l = a[2] k = a[3] if 0 < k <= n: print(k) elif n < k <= n + m: print(n) elif n+m <= k < n+m+l: print(n -1*(k -n -m)) elif n+m+l <= k: print(n - l) else: print(0)
[["-", 12, 657, 12, 23, 0, 657, 12, 23, 0, 24], ["-", 12, 23, 0, 657, 12, 23, 0, 657, 17, 72], ["+", 0, 657, 12, 657, 12, 23, 0, 657, 17, 33], ["-", 12, 657, 12, 23, 0, 657, 12, 23, 0, 25], ["-", 0, 656, 0, 57, 75, 665, 15, 666, 667, 18], ["+", 0, 656, 0, 57, 75, 665, 15, 666, 667, 19]]
5
115
#define _USE_MATH_DEFINES #include <iostream> #include <math.h> #include <string> #include <vector> using namespace std; int main() { int A, B, C, K; int mainasu; int total; cin >> A >> B >> C >> K; if (A >= K) { cout << A; } else if (A + B >= K) { cout << A; } else { mainasu = K - (A + B...
#define _USE_MATH_DEFINES #include <iostream> #include <math.h> #include <string> #include <vector> using namespace std; int main() { int A, B, C, K; int mainasu; int total; cin >> A >> B >> C >> K; if (A >= K) { cout << K; } else if (A + B >= K) { cout << A; } else { mainasu = K - (A + B...
[["-", 0, 57, 64, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 16, 12, 22]]
1
98
#include <iostream> #include <vector> using namespace std; int main() { int64_t a, b, c, k; cin >> a >> b >> c >> k; if ((a + b) >= k) { if (a < k) cout << a << endl; else { cout << a - k << endl; } return 0; } int64_t d = k - (a + b); if (c < d) cout << a - c << endl; ...
#include <iostream> #include <vector> using namespace std; int main() { int64_t a, b, c, k; cin >> a >> b >> c >> k; if ((a + b) >= k) { if (a < k) cout << a << endl; else { cout << k << endl; } return 0; } int64_t d = k - (a + b); if (c < d) cout << a - c << endl; else...
[["-", 0, 1, 0, 16, 31, 16, 12, 16, 31, 22], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 17, 33]]
1
108
from sys import stdin def get_result(data): A, B, C, K = data if (A + B) >= K: return A else: return A - (K-(A+B)) if __name__ == '__main__': data = list(map(int, stdin.readline().rstrip().split(' '))) result = get_result(data) print(result)
from sys import stdin def get_result(data): A, B, C, K = data if (A + B) >= K: return K if A > K else A else: return A - (K-(A+B)) if __name__ == '__main__': data = list(map(int, stdin.readline().rstrip().split(' '))) result = get_result(data) print(result)
[["+", 0, 57, 64, 196, 0, 37, 0, 41, 0, 22], ["+", 0, 57, 64, 196, 0, 37, 0, 41, 0, 121], ["+", 64, 196, 0, 37, 0, 41, 0, 666, 0, 22], ["+", 64, 196, 0, 37, 0, 41, 0, 666, 667, 47], ["+", 0, 57, 64, 196, 0, 37, 0, 41, 0, 95]]
5
87
#include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<ll, ll>; int main() { cin.tie(0); ios::sync_with_stdio(false); ll A, B, C, K; cin >> A >> B >> C >> K; ll sum = A; K -= (A + B); if (K > 0) { sum -= K; } cout << sum << endl; return 0; }
#include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<ll, ll>; int main() { cin.tie(0); ios::sync_with_stdio(false); ll A, B, C, K; cin >> A >> B >> C >> K; ll sum = min(A, K); K -= (A + B); if (K > 0) { sum -= K; } cout << sum << endl; return 0; }
[["+", 8, 9, 0, 43, 49, 50, 51, 2, 63, 22], ["+", 0, 43, 49, 50, 51, 2, 3, 4, 0, 24], ["+", 0, 43, 49, 50, 51, 2, 3, 4, 0, 21], ["+", 0, 43, 49, 50, 51, 2, 3, 4, 0, 22], ["+", 0, 43, 49, 50, 51, 2, 3, 4, 0, 25]]
1
95
#B A, B, C, K = [int(x) for x in input().split(" ")] if (K-A) > 0: if (K-A-B) > 0: print(A-(K-A-B)) else: print(A) else: print(A)
#B A, B, C, K = [int(x) for x in input().split(" ")] if (K-A) > 0: if (K-A-B) > 0: print(A-(K-A-B)) else: print(A) else: print(K)
[["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
72
#include <bits/stdc++.h> #define rep(i, n) for (int(i) = 0; (i) < (n); i++) #define ll long long using namespace std; int main() { ll a, b, c, k; cin >> a >> b >> c >> k; ll ans = 0; if (a > k) { ans = k; } if (a + b >= k) { ans = a; } else { ans = (2 * a) + b - k; } cout << ans << endl; ...
#include <bits/stdc++.h> #define rep(i, n) for (int(i) = 0; (i) < (n); i++) #define ll long long using namespace std; int main() { ll a, b, c, k; cin >> a >> b >> c >> k; ll ans = 0; if (a > k) { ans = k; } else if (a + b >= k) { ans = a; } else { ans = (2 * a) + b - k; } cout << ans << end...
[["+", 0, 14, 8, 9, 0, 57, 75, 76, 0, 95]]
1
94
a,b,c,k=map(int,input().split()) s=0 import sys if k>=a: k=k-a s=s+a*1 else: s=s+k*1 print(s) sys.exit() if k>=b: k=k-b s=s+b*0 else: s=s+k*0 print(s) sys.exit() if k>=c: k=k-c s=s+c*(-1) else: s=s+k*(-1) sys.exit() print(s)
a,b,c,k=map(int,input().split()) s=0 import sys if k>=a: k=k-a s=s+a*1 else: s=s+k*1 print(s) sys.exit() if k>=b: k=k-b s=s+b*0 else: s=s+k*0 print(s) sys.exit() if k>=c: k=k-c s=s+c*(-1) else: s=s+k*(-1) print(s) sys.exit() print(s)
[["+", 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, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
136
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll a, b, c, k; cin >> a >> b >> c >> k; ll sum = 0; if (a >= k) cout << k << endl; else if (a + b >= k) cout << a << endl; else if (a + b + c >= k) { cout << a + k - c << 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 sum = 0; if (a >= k) cout << k << endl; else if (a + b >= k) cout << a << endl; else if (a + b + c >= k) { cout << a - (k - a - b) << endl; } }
[["-", 0, 16, 31, 16, 12, 16, 31, 16, 17, 72], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 33], ["+", 0, 16, 31, 16, 12, 16, 12, 23, 0, 24], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 12, 22], ["+", 12, 16, 12, 23, 0, 16, 31, 16, 12, 22], ["+", 31, 16, 12, 16, 12, 23, 0, 16, 17, 33], ["+", 31, 16, 12, 16, 12, 23, 0, 16, 12, 22], ["...
1
91
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define INX(x) (cin >> x) #define OUTX(x) (cout << x << endl) #define ADD emplace_back #define MP make_pair int main() { ll A, B, C, K; cin >> A >> B >> C >> K; ll result = 0; if (A >= K) { result = A; } else { result += A; K ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define INX(x) (cin >> x) #define OUTX(x) (cout << x << endl) #define ADD emplace_back #define MP make_pair int main() { ll A, B, C, K; cin >> A >> B >> C >> K; ll result = 0; if (A >= K) { result = K; } else { result += A; K ...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22]]
1
109
#include <bits/stdc++.h> using namespace std; #define LL long long int main() { LL A, B, C, K; cin >> A >> B >> C >> K; if (A >= K) { cout << K << endl; } if (A < K, A + B >= K) { cout << A << endl; } else { cout << A - (K - A - B) << endl; } }
#include <bits/stdc++.h> using namespace std; #define LL long long int main() { LL A, B, C, K; cin >> A >> B >> C >> K; if (A >= K) { cout << K << endl; } else if (A < K && A + B >= K) { cout << A << endl; } else { cout << A - (K - A - B) << endl; } }
[["+", 0, 14, 8, 9, 0, 57, 75, 76, 0, 95], ["-", 8, 9, 0, 57, 15, 339, 51, 34, 0, 21], ["+", 75, 76, 0, 57, 15, 339, 51, 16, 17, 98]]
1
85
#include <iostream> #define rep(i, cc, n) for (int i = cc; i <= n; ++i) using namespace std; int main() { int A, B, C, K; cin >> A >> B >> C >> K; int ans = 0; if (K <= A) { ans = A; } else if (K <= A + B) { ans = A; } else { ans = A - (K - A - B); } cout << ans << endl; return 0; }
#include <iostream> #define rep(i, cc, n) for (int i = cc; i <= n; ++i) 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 + B) { ans = A; } else { ans = A - (K - A - B); } cout << ans << endl; return 0; }
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22]]
1
97
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main(int argc, char const *argv[]) { int a, b, c, k; scanf("%d%d%d%d", &a, &b, &c, &k); printf("%d\n", min(a, k) - max(0, a - (k - a - b))); return 0; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main(int argc, char const *argv[]) { int a, b, c, k; scanf("%d%d%d%d", &a, &b, &c, &k); printf("%d\n", min(a, k) - max(0, k - a - b)); return 0; }
[["-", 0, 16, 12, 2, 3, 4, 0, 16, 31, 22], ["-", 0, 16, 12, 2, 3, 4, 0, 16, 17, 33], ["-", 12, 2, 3, 4, 0, 16, 12, 23, 0, 24], ["-", 12, 2, 3, 4, 0, 16, 12, 23, 0, 25]]
1
87
X, Y, Z, K = map(int, input().split()) if X >= K: print(X) elif X+Y >= K: print(X) elif X+Y+Z >= K: print(X-(K-X-Y))
X, Y, Z, K = map(int, input().split()) if X >= K: print(K) elif X+Y >= K: print(X) elif X+Y+Z >= K: print(X-(K-X-Y))
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
61
#include <bits/stdc++.h> using namespace std; typedef unsigned long long ull; typedef long long ll; #define ll long long #define dd double #define MOD 1000000007 #define nl cout << bl #define rt ll Q[100005] = {0} #define mp make_pair #define test() \ ul...
#include <bits/stdc++.h> using namespace std; typedef unsigned long long ull; typedef long long ll; #define ll long long #define dd double #define MOD 1000000007 #define nl cout << bl #define rt ll Q[100005] = {0} #define mp make_pair #define test() \ ul...
[["-", 75, 76, 0, 9, 0, 1, 0, 11, 12, 22], ["+", 75, 76, 0, 9, 0, 1, 0, 11, 12, 22]]
1
354