buggy_code
stringlengths
11
625k
fixed_code
stringlengths
17
625k
bug_type
stringlengths
2
4.45k
language
int64
0
8
token_count
int64
5
200k
a, b, c, k = map(int, input().split()) if (a >= k): print(a) 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
58
A, B, C, K = int(input().split()) if K<=A: print(K) elif A<K<=A+B: print(A) else: print(A-(K-A-B))
A, B, C, K = map(int, input().split()) if K<=A: print(K) elif A<K<=A+B: print(A) else: print(A-(K-A-B))
[["-", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 21]]
5
54
#include <bits/stdc++.h> #include <iostream> #include <string> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; int ans = 0; if (k >= a + b) { cout << a - (k - a - b) << endl; } else if (k < a) { cout << a << endl; } else { cout << k << endl; } }
#include <bits/stdc++.h> #include <iostream> #include <string> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; int ans = 0; if (k >= a + b) { cout << a - (k - a - b) << endl; } else if (k < a) { cout << k << endl; } else { cout << a << endl; } }
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["-", 0, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 0, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
88
#include <bits/stdc++.h> using namespace std; #define int long long #define pb push_back #define x first #define y second #define sz(v) (int)v.size() #define all(x) (x).begin(), (x).end() #define PI 3.14159265358979 #define N 200005 int solve() { int a, b, c, k; cin >> a >> b >> c >> k; if (k <= a + b) { cou...
#include <bits/stdc++.h> using namespace std; #define int long long #define pb push_back #define x first #define y second #define sz(v) (int)v.size() #define all(x) (x).begin(), (x).end() #define PI 3.14159265358979 #define N 200005 int solve() { int a, b, c, k; cin >> a >> b >> c >> k; if (k <= a + b) { cou...
[["-", 0, 16, 12, 2, 3, 4, 0, 16, 17, 72], ["-", 0, 16, 12, 2, 3, 4, 0, 16, 12, 22]]
1
149
a, b, c, k = gets.chomp.split(' ').map(&:to_i) s = 0 def calc(k, i, d, s) if k >= i k -= i s += d * i else s += d * k end return k, s end [[a, 1], [b, 0], [c, -1]].each do |arr| k, s = calc(k, arr[0], arr[1], s) break if k <= 0 end puts s
a, b, c, k = gets.chomp.split(' ').map(&:to_i) s = 0 def calc(k, i, d, s) if k >= i k -= i s += d * i else s += d * k k = 0 end return k, s end [[a, 1], [b, 0], [c, -1]].each do |arr| k, s = calc(k, arr[0], arr[1], s) break if k <= 0 end puts s
[["+", 8, 736, 0, 121, 75, 95, 0, 662, 31, 22], ["+", 8, 736, 0, 121, 75, 95, 0, 662, 0, 32], ["+", 8, 736, 0, 121, 75, 95, 0, 662, 12, 612]]
4
116
#include <bits/stdc++.h> using namespace std; int main() { int64_t a, b, c; cin >> a >> b >> c; int64_t k; cin >> k; if (k <= a) cout << k << endl; if (k <= a + b) cout << a << endl; else if (k <= a + b + c) cout << a - (k - a - b) << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int64_t a, b, c; cin >> a >> b >> c; int64_t k; cin >> k; if (k <= a) cout << k << endl; else if (k <= a + b) cout << a << endl; else if (k <= a + b + c) cout << a - (k - a - b) << endl; }
[["+", 0, 14, 8, 9, 0, 57, 75, 76, 0, 95]]
1
85
a,b,c,d=map(int,input().split()) ans=0 if not a<k: print(k) else: if not a+b<k: print(a) else: print(2*a+b-k)
a,b,c,d=map(int,input().split()) ans=0 if not a<d: print(d) else: if not a+b<d: print(a) else: print(2*a+b-d)
[["-", 0, 656, 0, 57, 15, 681, 28, 666, 0, 22], ["+", 0, 656, 0, 57, 15, 681, 28, 666, 0, 22], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 57, 15, 681, 28, 666, 0, 22], ["+", 8, 196, 0, 57, 15, 681, 28, 666, 0, 22], ["-", 0, 1, 0, 652, 3, 4, 0, 657, 12, 22], ["...
5
59
#include <algorithm> #include <iostream> #define rep(i, n) for (int i = 0; i < (n); i++) #define ll long long using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; if (a + b >= k) { cout << min(a, k) << endl; } else { cout << max(a - (k - a - b), 0) << endl; } }
#include <algorithm> #include <iostream> #define rep(i, n) for (int i = 0; i < (n); i++) #define ll long long using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; if (a + b >= k) { cout << min(a, k) << endl; } else { cout << a - (k - a - b) << endl; } }
[["-", 0, 1, 0, 16, 31, 16, 12, 2, 63, 22], ["-", 0, 16, 31, 16, 12, 2, 3, 4, 0, 24], ["-", 12, 2, 3, 4, 0, 16, 12, 23, 0, 25], ["-", 0, 16, 31, 16, 12, 2, 3, 4, 0, 21], ["-", 0, 16, 31, 16, 12, 2, 3, 4, 0, 13]]
1
87
#include <bits/stdc++.h> using namespace std; int main() { long long int a, b, c, k; cin >> a >> b >> c >> k; if (k <= 0) cout << k << endl; else if (k <= a + b) cout << a << endl; else cout << a - (k - a - b) << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { long long int a, b, c, k; cin >> a >> b >> c >> k; if (k <= a) cout << k << endl; else if (k <= a + b) cout << a << endl; else cout << a - (k - a - b) << endl; return 0; }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22]]
1
78
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; #define ff first #define ss second #define debug(x) cerr << #x << " : " << x << endl; #define dbg2(x, y) cerr << #x << " : " << x << " " << #y << " : " << y << endl; #define dbg3(x, y, z) ...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; #define ff first #define ss second #define debug(x) cerr << #x << " : " << x << endl; #define dbg2(x, y) cerr << #x << " : " << x << " " << #y << " : " << y << endl; #define dbg3(x, y, z) ...
[["-", 0, 1, 0, 16, 31, 16, 12, 16, 17, 72], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 33]]
1
338
def main(): a, b, c, k = map(int, input().split()) if a+b <= k: print(min(a, k)) else: print(a-(k-a-b)) if __name__ == "__main__": main()
def main(): a, b, c, k = map(int, input().split()) if a+b >= k: print(min(a, k)) else: print(a-(k-a-b)) if __name__ == "__main__": main()
[["-", 0, 14, 8, 196, 0, 57, 15, 666, 667, 19], ["+", 0, 14, 8, 196, 0, 57, 15, 666, 667, 20]]
5
65
a,b,c,k=map(int,input().split()) ans=0 tot=0 if a >= k: print(1*a) elif a+b >= k: print(1*a) else: print(1*a+(k-(a+b))*-1)
a,b,c,k=map(int,input().split()) ans=0 if a >= k: print(1*k) elif a+b >= k: print(1*a) else: print(1*a+(k-(a+b))*-1)
[["-", 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, 612], ["-", 0, 1, 0, 652, 3, 4, 0, 657, 12, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 12, 22]]
5
71
A,B,C,K = [int(x) for x in input().split()] if(A >= K): print(A) exit() K = K - A if(B >= K): print(A) exit() K = K - B print(A-K)
A,B,C,K = [int(x) for x in input().split()] if(A >= K): print(K) exit() K = K - A if(B >= K): print(A) exit() K = K - B print(A-K)
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
68
A, B, C, K = map(int, input().split()) if K <= A: print(K) elif K <= A + B: print(A) else: print(A - (K - A + B))
A, B, C, K = map(int, input().split()) if K <= A: print(K) elif K <= A + B: print(A) else: print(A - (K - A - B))
[["-", 3, 4, 0, 657, 12, 23, 0, 657, 17, 72], ["+", 3, 4, 0, 657, 12, 23, 0, 657, 17, 33]]
5
54
a, b, c, k = list(map(int, input().split(' '))) if k <= a + b: print(k) else: print(a - (k - (a + b)))
a, b, c, k = list(map(int, input().split(' '))) if k <= a + b: print(min(a, k)) else: print(a - (k - (a + b)))
[["+", 0, 1, 0, 652, 3, 4, 0, 652, 63, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 21], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
53
#include <algorithm> #include <bitset> #include <cassert> #include <complex> #include <cstdio> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_map> #include <vector> using namespace std;...
#include <algorithm> #include <bitset> #include <cassert> #include <complex> #include <cstdio> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_map> #include <vector> using namespace std;...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 19], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 12, 22]]
1
2,517
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; int main() { // 制約見て!!!デカかったらlong longにすること! int a, b, c, k; scanf("%d%d%d%d", &a, &b, &c, &k); if (k > a + b) printf("%d\n", a + b - (k - (a + b))); else if (k > a) printf("%d\n", a); ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; int main() { // 制約見て!!!デカかったらlong longにすること! int a, b, c, k; scanf("%d%d%d%d", &a, &b, &c, &k); if (k > a + b) printf("%d\n", a - (k - (a + b))); else if (k > a) printf("%d\n", a); el...
[["-", 0, 2, 3, 4, 0, 16, 31, 16, 17, 72], ["-", 0, 2, 3, 4, 0, 16, 31, 16, 12, 22]]
1
113
A,B,C,K=list(map(int,input().split())) if A >= K: print(K) elif A+B >= K: print(A) else: print(K-A-B)
A,B,C,K=list(map(int,input().split())) if A >= K: print(K) elif A+B >= K: print(A) else: print(2*A+B-K)
[["-", 0, 652, 3, 4, 0, 657, 31, 657, 31, 22], ["-", 0, 652, 3, 4, 0, 657, 31, 657, 17, 33], ["+", 3, 4, 0, 657, 31, 657, 31, 657, 31, 612], ["+", 3, 4, 0, 657, 31, 657, 31, 657, 17, 48], ["-", 0, 1, 0, 652, 3, 4, 0, 657, 17, 33], ["+", 0, 652, 3, 4, 0, 657, 31, 657, 17, 72], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 33], ...
5
53
def Ii():return int(sys.stdin.buffer.read()) def Mi():return map(int,sys.stdin.buffer.readline().split()) def Li():return list(map(int,sys.stdin.buffer.readline().split())) a,b,c,k = Mi() if k <= a: ans = k exit(0) ans = a k -= a if k > b: ans -= k-b print(ans)
import sys def Ii():return int(sys.stdin.buffer.read()) def Mi():return map(int,sys.stdin.buffer.readline().split()) def Li():return list(map(int,sys.stdin.buffer.readline().split())) a,b,c,k = Mi() if k <= a: print(k) exit(0) ans = a k -= a if k > b: ans -= k-b print(ans)
[["+", 36, 36, 36, 36, 0, 656, 0, 596, 0, 487], ["+", 36, 36, 0, 656, 0, 596, 141, 673, 0, 22], ["-", 0, 57, 64, 196, 0, 1, 0, 662, 31, 22], ["-", 0, 57, 64, 196, 0, 1, 0, 662, 0, 32], ["+", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
112
#include <bits/stdc++.h> using namespace std; typedef long long int ll; int main() { int a, b, c, k; cin >> a >> b >> c >> k; if (k <= a) cout << a << endl; else if (k <= (a + b)) cout << a << endl; else cout << a - (k - a - b) << endl; return 0; }
#include <bits/stdc++.h> using namespace std; typedef long long int ll; int main() { int a, b, c, k; cin >> a >> b >> c >> k; if (k <= a) cout << k << endl; else if (k <= (a + b)) cout << a << endl; else cout << a - (k - a - b) << endl; return 0; }
[["-", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22], ["+", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22]]
1
84
#include <bits/stdc++.h> #define l_ength size const int inf = (1 << 30); const int mod = 1000000007; // 998244353 using ll = long long; using namespace std; int main() { ll a, b, c, k; cin >> a >> b >> c >> k; if (k <= a + b) cout << a << endl; else cout << a - min(c, k - (a + b)) << endl; }
#include <bits/stdc++.h> #define l_ength size const int inf = (1 << 30); const int mod = 1000000007; // 998244353 using ll = long long; using namespace std; int main() { ll a, b, c, k; cin >> a >> b >> c >> k; if (k <= a + b) cout << min(k, a) << endl; else cout << a - min(c, 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, 22], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 21], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 25]]
1
91
// s.at(0) = toupper(s.at(0));//小文字なら大文字へ//大文字の場合はそのまま // s.at(i) = tolower(s.at(i));//大文字なら小文字へ//小文字の場合はそのまま // string s; // cin >> s; // cout << s.at(0) <<endl; // cout << s.at(0)-'0' <<endl; // Aが16? // cout << char(i+48) << // endl;//なぜかaは47と得る時がある。+48で出力もaにできる。 cout << char(97) << // endl;//アスキーコードでaを出力 ...
// s.at(0) = toupper(s.at(0));//小文字なら大文字へ//大文字の場合はそのまま // s.at(i) = tolower(s.at(i));//大文字なら小文字へ//小文字の場合はそのまま // string s; // cin >> s; // cout << s.at(0) <<endl; // cout << s.at(0)-'0' <<endl; // Aが16? // cout << char(i+48) << // endl;//なぜかaは47と得る時がある。+48で出力もaにできる。 cout << char(97) << // endl;//アスキーコードでaを出力 ...
[["-", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22], ["+", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22]]
1
139
A, B, C, K = map(int, input().split()) if(A >= K): print(A * 1) else: if(A + B >= K): print(A * 1 + B * 0) else: print(A - (K - A - B))
A, B, C, K = map(int, input().split()) if(A >= K): print(K * 1) else: if(A + B >= K): print(A * 1 + B * 0) else: print(A - (K - A - B))
[["-", 0, 1, 0, 652, 3, 4, 0, 657, 31, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 31, 22]]
5
68
#include <bits/stdc++.h> using namespace std; long A, B, C, K; int main(void) { cin >> A >> B >> C >> K; if (K <= A) { cout << A << endl; } else if (K <= A + B) { cout << A << endl; } else { cout << A - (K - A - B) << endl; } return 0; }
#include <bits/stdc++.h> using namespace std; long A, B, C, K; int main(void) { cin >> A >> B >> C >> K; if (K <= A) { cout << min(A, K) << endl; } else if (K <= A + B) { cout << A << endl; } else { cout << A - (K - A - B) << endl; } return 0; }
[["+", 0, 1, 0, 16, 31, 16, 12, 2, 63, 22], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 24], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 21], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 22], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 25]]
1
83
A, B, C, K = list(map(int, input().split())) if( A + B >= K ): if(A >= K): print(A) else: print(K) else: print(+1*A -1*(K-(A+B)))
A, B, C, K = list(map(int, input().split())) if( A + B >= K ): if(A >= K): print(K) else: print(A) else: print(+1*A -1*(K-(A+B)))
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
70
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; int main() { int a, b, c, k; cin >> a >> b >> c >> k; int ans; if (k <= a) { ans = k; } else if (k <= a + b) { ans = a; } else { ans = a - (c - b); } ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; int main() { int a, b, c, k; cin >> a >> b >> c >> k; int ans; if (k <= a) { ans = k; } else if (k <= a + b) { ans = a; } else { ans = a - (k - a - b); ...
[["-", 0, 11, 12, 16, 12, 23, 0, 16, 31, 22], ["+", 12, 16, 12, 23, 0, 16, 31, 16, 31, 22], ["+", 12, 16, 12, 23, 0, 16, 31, 16, 17, 33], ["+", 12, 16, 12, 23, 0, 16, 31, 16, 12, 22]]
1
105
A, B, C, K = map(int, input().split()) mai = A acc = A if mai < K: mai += B if mai < K: acc -= K - mai print(acc)
A, B, C, K = map(int, input().split()) mai = min(A, K) acc = mai if mai < K: mai += B if mai < K: acc -= K - mai print(acc)
[["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 21], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25], ["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 22]]
5
48
def maximum(): A,B,C,K = map(int,input().split()) num = 0 max = 0 if A <= K: max = A num = K - A if B <= num: num = num - B max -= num print(max) return else: print(max) return else: print...
def maximum(): A,B,C,K = map(int,input().split()) num = 0 max = 0 if A <= K: max = A num = K - A if B <= num: num = num - B max -= num print(max) return else: print(max) return else: print...
[["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
79
def resolve(): A, B, C, K = list(map(int, input().split())) if A >= K: print(A) return if A + B >= K: print(A) return print(A-(K - A - B)) return resolve()
def resolve(): A, B, C, K = list(map(int, input().split())) if A >= K: print(K) return if A + B >= K: print(A) return print(A-(K - A - B)) return resolve()
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
66
a,b,c,k=map(int,input().split()) if a+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
A, B, C, K = map( int, input().split()) ret = min( A, K ) if A < K: ret -= min( 0, K - A - B ) print( ret )
A, B, C, K = map( int, input().split()) ret = min( A, K ) if A < K: ret -= max( 0, K - A - B ) print( ret )
[["-", 64, 196, 0, 1, 0, 677, 12, 652, 63, 22], ["+", 64, 196, 0, 1, 0, 677, 12, 652, 63, 22]]
5
49
#include <bits/stdc++.h> #define ll u_int64_t #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; const double PI = acos(-1); using Graph = vector<vector<int>>; int main() { ll a, b, c, k; cin >> a >> b >> c >> k; ll sum = 0; if (a >= k) sum = k; else if (a + b >= k) sum = a; else ...
#include <bits/stdc++.h> #define ll long long #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; const double PI = acos(-1); using Graph = vector<vector<int>>; int main() { ll a, b, c, k; cin >> a >> b >> c >> k; ll sum = 0; if (a >= k) sum = k; else if (a + b >= k) sum = a; else ...
[["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59]]
1
110
a, b, c, k = map(int,input().split()) ans = 0 if k <= a: ans = k elif k <= (a+b): ans = a else: ans = (a-(k-(a+b)))
a, b, c, k = map(int,input().split()) ans = 0 if k <= a: ans = k elif k <= (a+b): ans = a else: ans = (a-(k-(a+b))) print(ans)
[["+", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
60
#pragma region Macros #include <bits/stdc++.h> using namespace std; using ll = long long; #define int ll using vi = vector<int>; using vvi = vector<vi>; #define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i) #define ALL(x) (x).begin(), (x).end() #define SIZE(x) ((ll)(x).size()) #define MAX(x) *max_elemen...
#pragma region Macros #include <bits/stdc++.h> using namespace std; using ll = long long; #define int ll using vi = vector<int>; using vvi = vector<vi>; #define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i) #define ALL(x) (x).begin(), (x).end() #define SIZE(x) ((ll)(x).size()) #define MAX(x) *max_elemen...
[["-", 8, 9, 0, 1, 0, 16, 12, 16, 31, 22], ["+", 8, 9, 0, 1, 0, 16, 12, 16, 31, 22]]
1
387
<?php $input = fgets(STDIN); $array = explode(' ', $input); $A = (int)$array[0]; $B = (int)$array[1]; $C = (int)$array[2]; $K = (int)$array[3]; $sum = 0; if ($A >= $K) { echo $A; } else { $sum += $A; if ($B < $K - $A) { if ($C >= $K - $A - $B) { $sum += ($K - $A - $B) * -1; } else { ...
<?php $input = fgets(STDIN); $array = explode(' ', $input); $A = (int)$array[0]; $B = (int)$array[1]; $C = (int)$array[2]; $K = (int)$array[3]; $sum = 0; if ($A >= $K) { echo $K; } else { $sum += $A; if ($B < $K - $A) { if ($C >= $K - $A - $B) { $sum += ($K - $A - $B) * -1; } else { ...
[["-", 0, 57, 8, 9, 0, 608, 0, 606, 0, 141], ["+", 0, 57, 8, 9, 0, 608, 0, 606, 0, 141]]
6
160
a,b,c,k=map(int,input().split()) ans=0 if a>=k: ans=k elif a+b>=k: ans=a else: ans=2*a+b-k
a,b,c,k=map(int,input().split()) ans=0 if a>=k: ans=k elif a+b>=k: ans=a else: ans=2*a+b-k print(ans)
[["+", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
52
a,b,c,k=map(int, input().split()) ans = 0 re=k if a <= re: ans += a re = k-a if b < re: re = re - b if c < re: ans -= c else: ans -= re else: ans = a-k print(ans)
a,b,c,k=map(int, input().split()) ans = 0 re=k if a <= re: ans += a re = k-a if b < re: re = re - b if c < re: ans -= c else: ans -= re else: ans = k print(ans)
[["-", 8, 196, 0, 1, 0, 662, 12, 657, 31, 22], ["-", 8, 196, 0, 1, 0, 662, 12, 657, 17, 33]]
5
73
A, B, C, K = map(int, input().split()) if A >= K: print(A) elif A < K <= A+B: print(A) elif A+B < K <= A+B+C: print(A-(K-A-B))
A, B, C, K = map(int, input().split()) if A >= K: print(K) elif A < K <= A+B: print(A) elif A+B < K <= A+B+C: 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
67
A,B,C,K=map(int,input().split()) print(min(K,A)-min(K-A-B,C))
A, B, C, K = map(int, input().split()) print(min(K, A)-max(0, K-A-B))
[["-", 0, 652, 3, 4, 0, 657, 12, 652, 63, 22], ["+", 0, 652, 3, 4, 0, 657, 12, 652, 63, 22], ["+", 3, 4, 0, 657, 12, 652, 3, 4, 0, 612], ["+", 3, 4, 0, 657, 12, 652, 3, 4, 0, 21], ["-", 3, 4, 0, 657, 12, 652, 3, 4, 0, 21], ["-", 3, 4, 0, 657, 12, 652, 3, 4, 0, 22]]
5
40
a, b, c, k = map(int, input().split()) if(k < a): pritn(k) elif(a <= k <= a + b): print(a) else: print(a - (k - (a + b)))
a, b, c, k = map(int, input().split()) if(k < a): print(k) elif(k <= a + b): print(a) else: print(a - (k - (a + b)))
[["-", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["-", 0, 57, 75, 665, 15, 23, 0, 666, 0, 22], ["-", 0, 57, 75, 665, 15, 23, 0, 666, 667, 19]]
5
62
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/detail/standard_policies.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; #define getbit(n, i) (((n) & (1LL << (i))) != 0) #define setbit0(n, i) ((n) & (~(1LL << (i)))) #define setbit1(n, i) (...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/detail/standard_policies.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; #define getbit(n, i) (((n) & (1LL << (i))) != 0) #define setbit0(n, i) ((n) & (~(1LL << (i)))) #define setbit1(n, i) (...
[["-", 0, 11, 12, 23, 0, 2, 3, 4, 0, 22], ["+", 0, 11, 12, 23, 0, 2, 3, 4, 0, 22]]
1
430
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int a, b, c, k; cin >> a >> b >> c >> k; int ans = 0; int o = min(a, k); ans += o; k -= o; o = min(b, k); b -= o; o = min(c, k); ...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int a, b, c, k; cin >> a >> b >> c >> k; int ans = 0; int o = min(a, k); ans += o; k -= o; o = min(b, k); k -= o; o = min(c, k); ...
[["-", 0, 14, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 31, 22], ["-", 0, 14, 8, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 22]]
1
121
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> ii; typedef vector<ii> vii; main() { ll a, b, c, k; cin >> a >> b >> c >> k; if (k <= a) cout << a; else { ll temp = (k - a); if (temp <= b) cout << a; else { temp -= b; cout << (a - tem...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> ii; typedef vector<ii> vii; main() { ll a, b, c, k; cin >> a >> b >> c >> k; if (k <= a) cout << k; else { ll temp = (k - a); if (temp <= b) cout << a; else { temp -= b; cout << (a - tem...
[["-", 8, 9, 0, 57, 64, 1, 0, 16, 12, 22], ["+", 8, 9, 0, 57, 64, 1, 0, 16, 12, 22]]
1
98
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define INF 1LL << 62 #define inf 1000000007 int main() { ll a, b, c, k; cin >> a >> b >> c >> k; ll ans = 0; ans += min(k, a); if (k <= a) { cout << ans; return 0; } k -= a; k -= b; if (k <= 0) { cout << ans; return ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define INF 1LL << 62 #define inf 1000000007 int main() { ll a, b, c, k; cin >> a >> b >> c >> k; ll ans = 0; ans += min(k, a); if (k <= a) { cout << ans; return 0; } k -= a; k -= b; if (k <= 0) { cout << ans; return ...
[["-", 0, 14, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 17, 110]]
1
111
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define INF 1LL << 62 #define inf 1000000007 int main() { ll a, b, c, k; cin >> a >> b >> c >> k; ll ans = a; k -= a; k -= b; if (k > 0) { ans -= k; } cout << ans; // your code goes here return 0; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define INF 1LL << 62 #define inf 1000000007 int main() { ll a, b, c, k; cin >> a >> b >> c >> k; ll ans = min(a, k); k -= a; k -= b; if (k > 0) { ans -= k; } cout << ans; // your code goes here 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
75
a,b,c,k=map(int,input().split()) if a>=k: print(a) exit() else: if k-a<=b: print(a) exit() else: c=k-a-b print(a-c)
a,b,c,k=map(int,input().split()) if a>=k: print(k) exit() else: if k-a<=b: print(a) exit() else: c=k-a-b print(a-c)
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
63
#include <bits/stdc++.h> using namespace std; int main() { int A, B, C, K; cin >> A >> B >> C >> K; int ans; if (K <= A) ans = K; else if (K > A + B) ans = A - (K - (A - B)); else ans = A; cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int A, B, C, K; cin >> A >> B >> C >> K; int ans; if (K <= A) ans = K; else if (K > A + B) ans = A - (K - (A + B)); else ans = A; cout << ans << endl; }
[["-", 12, 23, 0, 16, 12, 23, 0, 16, 17, 33], ["+", 12, 23, 0, 16, 12, 23, 0, 16, 17, 72]]
1
78
A, B, C, K = map(int,input().split()) if K < A: print(K) elif A <= K <= A+B: print(A) else: print(2*A-K-B)
A, B, C, K = map(int,input().split()) if K < A: print(K) elif A <= K <= A+B: print(A) else: print(2*A-K+B)
[["-", 0, 1, 0, 652, 3, 4, 0, 657, 17, 33], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 72]]
5
54
A, B, C, K = map(int, input().split()) ans = 0 if K<=A: print(K) elif K<=A+B: print(A) elif K<=A+B+C: ans == A-(K-A-B) print(ans)
A, B, C, K = map(int, input().split()) ans = 0 if K<=A: print(K) elif K<=A+B: print(A) elif K<=A+B+C: ans = A-(K-A-B) print(ans)
[["-", 75, 665, 64, 196, 0, 1, 0, 666, 667, 60], ["+", 75, 665, 64, 196, 0, 1, 0, 662, 0, 32]]
5
67
#include <algorithm> #include <bitset> #include <cassert> #include <climits> #include <cmath> #include <cstring> #include <fstream> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <string> #include <unordered_map> #include <unordered_s...
#include <algorithm> #include <bitset> #include <cassert> #include <climits> #include <cmath> #include <cstring> #include <fstream> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <string> #include <unordered_map> #include <unordered_s...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22]]
1
149
import itertools import math import string import collections from collections import Counter from collections import deque from operator import itemgetter import sys sys.setrecursionlimit(2*10**5) INF = 2**60 def readints(): return list(map(int, input().split())) def nCr(n, r): return math.factorial(n)//(m...
import itertools import math import string import collections from collections import Counter from collections import deque from operator import itemgetter import sys sys.setrecursionlimit(2*10**5) INF = 2**60 def readints(): return list(map(int, input().split())) def nCr(n, r): return math.factorial(n)//(m...
[["-", 0, 1, 0, 677, 12, 657, 31, 23, 0, 24], ["-", 0, 677, 12, 657, 31, 23, 0, 657, 31, 22], ["-", 0, 677, 12, 657, 31, 23, 0, 657, 17, 33], ["-", 0, 1, 0, 677, 12, 657, 31, 23, 0, 25]]
5
357
#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; ll ans = min(a, k); k -= a + b; if (k > 0) ans -= b - k; cout << ans << 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; ll ans = min(a, k); k -= a + b; if (k > 0) ans -= k; 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
81
a,b,c,k = map(int,input().split()) ans=0 if a>= k: print(k) elif a+b >= k: print(a) else: print(a-(c-(k-a)))
a,b,c,k = map(int,input().split()) ans=0 if a>= k: print(k) elif a+b >= k: print(a) else: print(a-((k-a-b)))
[["-", 3, 4, 0, 657, 12, 23, 0, 657, 31, 22], ["-", 3, 4, 0, 657, 12, 23, 0, 657, 17, 33], ["+", 0, 657, 12, 23, 0, 23, 0, 657, 17, 33], ["+", 0, 657, 12, 23, 0, 23, 0, 657, 12, 22]]
5
59
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; typedef tree<pair<int, int>, null_type, less<pair<int, int>>, rb_tree_tag, tree_order_statistics_node_update> oset; #define sim template <class c #defi...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; typedef tree<pair<int, int>, null_type, less<pair<int, int>>, rb_tree_tag, tree_order_statistics_node_update> oset; #define sim template <class c #defi...
[["+", 12, 83, 0, 42, 0, 83, 0, 42, 0, 38], ["+", 12, 83, 0, 42, 0, 83, 0, 42, 0, 35]]
1
449
#include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define PI 2 * acos(0.0) #define boost \ ios::sync_with_stdio(false); \ cin.tie(0) int main() { boost; ll a, b,...
#include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define PI 2 * acos(0.0) #define boost \ ios::sync_with_stdio(false); \ cin.tie(0) int main() { boost; ll a, b,...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
117
import sys a, b, c, k = map(int, input().split()) nokori = k - a if nokori <= 0: print(k + nokori) sys.exit() nokori = nokori - b if nokori <= 0: print(a) sys.exit() print(a - nokori)
import sys a, b, c, k = map(int, input().split()) nokori = k - a if nokori <= 0: print(k) sys.exit() nokori = nokori - b if nokori <= 0: print(a) sys.exit() print(a - nokori)
[["-", 0, 1, 0, 652, 3, 4, 0, 657, 17, 72], ["-", 0, 1, 0, 652, 3, 4, 0, 657, 12, 22]]
5
68
#include <bits/stdc++.h> using namespace std; int main(int argc, char const *argv[]) { int a, b, c, k; cin >> a >> b >> c >> k; int ans = 0; if (k <= a) { ans += k; } else if (a < k && k <= a + b) { ans += a; } else if (a + b < k && k <= a + b + c) { ans += a; ans -= (a + b + c) - k; } ...
#include <bits/stdc++.h> using namespace std; int main(int argc, char const *argv[]) { int a, b, c, k; cin >> a >> b >> c >> k; int ans = 0; if (k <= a) { ans += k; } else if (a < k && k <= a + b) { ans += a; } else if (a + b < k && k <= a + b + c) { ans += a; ans -= k - (a + b); } co...
[["+", 64, 9, 0, 1, 0, 11, 12, 16, 31, 22], ["+", 64, 9, 0, 1, 0, 11, 12, 16, 17, 33], ["-", 0, 11, 12, 16, 31, 23, 0, 16, 17, 72], ["-", 0, 11, 12, 16, 31, 23, 0, 16, 12, 22], ["-", 64, 9, 0, 1, 0, 11, 12, 16, 17, 33], ["-", 64, 9, 0, 1, 0, 11, 12, 16, 12, 22]]
1
120
#include <iostream> using namespace std; int main() { int A, B, C, K; cin >> A >> B >> C >> K; int ans = 0; if (K <= A) ans = K; else ans = A; K = K - A - B; if (K <= C) ans -= K; cout << ans << endl; return 0; }
#include <iostream> using namespace std; int main() { int A, B, C, K; cin >> A >> B >> C >> K; int ans = 0; if (K <= A) ans = K; else ans = A; K = K - A - B; if (K > 0) ans -= K; cout << ans << endl; return 0; }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
78
A,B,C,K=[int(i) for i in input().split()] if K<A: P=K else: P=A if A+B<K: P-=(K-A+B) print(P)
A,B,C,K=[int(i) for i in input().split()] if K<A: P=K else: P=A if A+B<K: P-=(K-(A+B)) print(P)
[["+", 0, 677, 12, 23, 0, 657, 12, 23, 0, 24], ["+", 0, 677, 12, 23, 0, 657, 12, 23, 0, 25]]
5
57
A,B,C,K =list(map(int,input().split())) if K < A: print(A) elif A <= K and B >= (K-A): print(A) else: print(A - (K-A-B))
A,B,C,K =list(map(int,input().split())) if K < A: print(K) elif A <= K and B >= (K-A): print(A) else: print(A - (K-A-B))
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
63
A, B, C, K = map(int,input().split()) if K <= A: print(A) elif K > A and B >= K-A: print(A) elif K > A and B < K-A: c = K-A-B print(A-c)
A, B, C, K = map(int,input().split()) if K <= A: print(K) elif K > A and B >= K-A: print(A) elif K > A and B < K-A: c = K-A-B print(A-c)
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
68
#include <bits/stdc++.h> #include <math.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep2(i, s, n) for (int i[] = (s); i < (int)(n); i++) using ll = long long; using vec = vector<int>; using vec2 = vector<vector<int>>; int main() { ll a, b, c, k; cin >> a >> b >> c >> k; i...
#include <bits/stdc++.h> #include <math.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep2(i, s, n) for (int i[] = (s); i < (int)(n); i++) using ll = long long; using vec = vector<int>; using vec2 = vector<vector<int>>; int main() { ll a, b, c, k; cin >> a >> b >> c >> k; i...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
142
a, b, c, k = map(int,input().split()) if a >= k: print(a) elif k > a and b >= k - a: print(a) elif k > a and k - a > b: print(a - (k - a - b))
a, b, c, k = map(int,input().split()) if a >= k: print(k) elif k > a and b >= k - a: print(a) elif k > a and k - a > b: print(a - (k - a - b))
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
67
a, b, c, k = map(int,input().split()) if a >= k: print(a) elif k > a and b >= k - a: print(a) elif k > a and k - a > b and a != 0: print(a - (k - a - b)) elif k > a and k - a > b and a == 0: print(0 - (k - b))
a, b, c, k = map(int,input().split()) if a >= k: print(k) elif k > a and b >= k - a: print(a) elif k > a and k - a > b and a != 0: print(a - (k - a - b)) elif k > a and k - a > b and a == 0: print(0 - (k - b))
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
96
a, b, c, k = map(int, input().split()) if a >= k: res = a elif a+b>=k:res = a else : res=a-(k-a-b) print(res)
a, b, c, k = map(int, input().split()) if a >= k: res = k elif a+b>=k:res = a else : res=a-(k-a-b) print(res)
[["-", 0, 57, 64, 196, 0, 1, 0, 662, 12, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 12, 22]]
5
55
A,B,C,K=map(int,input().split()) if K<=A: print(A) exit(0) else: if K<=A+B: print(A) exit(0) else: print(A-(K-A-B))
A,B,C,K=map(int,input().split()) if K<=A: print(K) exit(0) else: if K<=A+B: print(A) exit(0) else: print(A-(K-A-B))
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
64
#include <bits/stdc++.h> using namespace std; int main() { long long int a, b, c, k; cin >> a >> b >> c >> k; if (k <= a) { cout << k << endl; } else if (k > a && k <= a + b) { cout << a << endl; } else if (k > a + b) { cout << a - (k - a) << endl; } return 0; }
#include <bits/stdc++.h> using namespace std; int main() { long long int a, b, c, k; cin >> a >> b >> c >> k; if (k <= a) { cout << k << endl; } else if (k > a && k <= a + b) { cout << a << endl; } else if (k > a + b) { cout << a - (k - a - b) << endl; } return 0; }
[["+", 31, 16, 12, 16, 12, 23, 0, 16, 17, 33], ["+", 31, 16, 12, 16, 12, 23, 0, 16, 12, 22]]
1
94
// Sky's the limit :) #include <bits/stdc++.h> using namespace std; #define int long long signed main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int t = 1; // cin >> t; while (t--) { int a, b, c, k; cin >> a >> b >> c >> c; if (k <= a + b) cout << min(a, k) << '\n'; else ...
// Sky's the limit :) #include <bits/stdc++.h> using namespace std; #define int long long signed main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int t = 1; // cin >> t; while (t--) { int a, b, c, k; cin >> a >> b >> c >> k; if (k <= a + b) cout << min(a, k) << '\n'; else ...
[["-", 0, 52, 8, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 16, 12, 22]]
1
108
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(); if (k <= a) { System.out.println(k); } else if (k <= a + b) { S...
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(); if (k <= a) { System.out.println(k); } else if (k <= a + b) { S...
[["-", 0, 1, 0, 492, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 492, 3, 4, 0, 16, 17, 33]]
3
128
#include <bits/stdc++.h> using namespace std; int main() { long A, B, C, K; cin >> A >> B >> C >> K; long ans = 0; if (A > K) { cout << K << endl; return 0; } else { ans += A; K -= A; } if (B > K) { cout << K << endl; return 0; } else { K -= B; } ans -= K; cout << ans...
#include <bits/stdc++.h> using namespace std; int main() { long A, B, C, K; cin >> A >> B >> C >> K; long ans = 0; if (A > K) { cout << K << endl; return 0; } else { ans += A; K -= A; } if (B > K) { cout << ans << endl; return 0; } else { K -= B; } ans -= K; cout << ...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
98
#include <bits/stdc++.h> #define ll long long int #define F first #define S second const ll mod = 1e9 + 7; const ll INF = 922337203685477; #define pb push_back #define deb(x) cout << '>' << #x << ':' << x << endl; #define fastio \ ios_base::sync_with_std...
#include <bits/stdc++.h> #define ll long long int #define F first #define S second const ll mod = 1e9 + 7; const ll INF = 922337203685477; #define pb push_back #define deb(x) cout << '>' << #x << ':' << x << endl; #define fastio \ ios_base::sync_with_std...
[["+", 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
112
A, B, C, K = map(int, input().split()) ans = 0 if K <= A: print(K) elif K <= A+B: print(A) else: print(K-B-C)
A, B, C, K = map(int, input().split()) ans = 0 if K <= A: print(K) elif K <= A+B: print(A) else: print(2*A+B-K)
[["-", 0, 652, 3, 4, 0, 657, 31, 657, 31, 22], ["-", 0, 652, 3, 4, 0, 657, 31, 657, 17, 33], ["+", 3, 4, 0, 657, 31, 657, 31, 657, 31, 612], ["+", 3, 4, 0, 657, 31, 657, 31, 657, 17, 48], ["+", 3, 4, 0, 657, 31, 657, 31, 657, 12, 22], ["+", 0, 652, 3, 4, 0, 657, 31, 657, 17, 72], ["-", 0, 1, 0, 652, 3, 4, 0, 657, 12, 2...
5
53
a, b, c, k = map(int, input().split()) if k <= a: print(k) elif k <= a + b: print(a) else: print(k - (a + c))
a, b, c, k = map(int, input().split()) if k <= a: print(k) elif k <= a + b: print(a) else: print(2*a + b - k)
[["-", 0, 1, 0, 652, 3, 4, 0, 657, 31, 22], ["-", 0, 1, 0, 652, 3, 4, 0, 657, 17, 33], ["-", 0, 652, 3, 4, 0, 657, 12, 23, 0, 24], ["+", 3, 4, 0, 657, 31, 657, 31, 657, 31, 612], ["+", 3, 4, 0, 657, 31, 657, 31, 657, 17, 48], ["-", 3, 4, 0, 657, 12, 23, 0, 657, 12, 22], ["-", 0, 652, 3, 4, 0, 657, 12, 23, 0, 25], ["+",...
5
52
a,b,c,k = map(int,input().split()) if k ==0: print(k) elif k <= a : print(a) elif k <= a+b: print(a) else: print(((k-(a+b))*-1)+a)
a,b,c,k = map(int,input().split()) if k ==0: print(k) elif k <= a : print(k) elif k <= a+b: print(a) else: print(((k-(a+b))*-1)+a)
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
70
#include <stdio.h> #include <string.h> int main() { int a, b, c, k; int i, j; scanf("%d %d %d %d", &a, &b, &c, &k); if (a <= k) { printf("%d\n", k); } else if (a + b >= k && a + b + c < k) { printf("%d\n", a); } else { printf("%d\n", a + a + b - k); } return 0; }
#include <stdio.h> #include <string.h> int main() { int a, b, c, k; int i, j; scanf("%d %d %d %d", &a, &b, &c, &k); if (a >= k) { printf("%d\n", k); } else if (a + b >= k && a + b + c > k) { printf("%d\n", a); } else { printf("%d\n", a + a + b - k); } return 0; }
[["-", 8, 9, 0, 57, 15, 23, 0, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 17, 20], ["-", 0, 57, 15, 23, 0, 16, 12, 16, 17, 18], ["+", 0, 57, 15, 23, 0, 16, 12, 16, 17, 47]]
0
112
# -*- coding: utf-8 -*- def main(): a, b, c, k = map(int, input().split()) if k <= a: ans = k if k <= a+b: ans = a else: ans = a - (k - b - a) print(ans) main()
# -*- coding: utf-8 -*- def main(): a, b, c, k = map(int, input().split()) if k <= a: ans = k elif k <= a+b: ans = a else: ans = a - (k - b - a) print(ans) return main()
[["-", 0, 656, 0, 14, 8, 196, 0, 57, 0, 121], ["+", 0, 14, 8, 196, 0, 57, 75, 665, 0, 683], ["+", 0, 656, 0, 14, 8, 196, 0, 37, 0, 38]]
5
64
#include <iostream> using namespace std; int main() { unsigned long long 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 if (a + b + c >= k) { cout << a - (k - (a + b)) << endl; } return 0; }
#include <iostream> using namespace std; int main() { long long 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 if (a + b + c >= k) { cout << a - (k - (a + b)) << endl; } return 0; }
[["-", 0, 14, 8, 9, 0, 43, 39, 86, 0, 87]]
1
97
#include <bits/stdc++.h> #include <iostream> #include <string> typedef uint64_t u64; typedef int64_t i64; typedef uint32_t u32; typedef int32_t i32; typedef uint16_t u16; typedef int16_t i16; typedef uint8_t u8; typedef int8_t i8; using namespace std; #define REP(idx, N) for (u64 idx = 0; idx < N; idx++) int main(...
#include <bits/stdc++.h> #include <iostream> #include <string> typedef uint64_t u64; typedef int64_t i64; typedef uint32_t u32; typedef int32_t i32; typedef uint16_t u16; typedef int16_t i16; typedef uint8_t u8; typedef int8_t i8; using namespace std; #define REP(idx, N) for (u64 idx = 0; idx < N; idx++) int main(...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]]
1
121
#include <stdio.h> int main() { int a, b, c, k; scanf("%d%d%d%d", &a, &b, &c, &k); if (a >= k) printf("%d\n", a); else if (b >= k - a) printf("%d\n", a); else printf("%d\n", a - (k - a - b)); return 0; }
#include <stdio.h> int main() { int a, b, c, k; scanf("%d%d%d%d", &a, &b, &c, &k); if (a >= k) printf("%d\n", k); else if (b >= k - a) printf("%d\n", a); else printf("%d\n", a - (k - a - b)); return 0; }
[["-", 0, 57, 64, 1, 0, 2, 3, 4, 0, 22], ["+", 0, 57, 64, 1, 0, 2, 3, 4, 0, 22]]
0
93
#include <bits/stdc++.h> using namespace std; #define debug(n) cerr << #n << ':' << n << endl; #define dline cerr << __LINE__ << endl; using ll = long long; using ull = unsigned long long; template <class T, class U> using P = pair<T, U>; template <class T> using Heap = priority_queue<T>; template <class T> using he...
#include <bits/stdc++.h> using namespace std; #define debug(n) cerr << #n << ':' << n << endl; #define dline cerr << __LINE__ << endl; using ll = long long; using ull = unsigned long long; template <class T, class U> using P = pair<T, U>; template <class T> using Heap = priority_queue<T>; template <class T> using he...
[["-", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22], ["+", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22]]
1
342
#include <stdio.h> int main() { int a, b, c, k, ans = 0; scanf("%d %d %d %d", &a, &b, &c, &k); if (a < k) ans += a; else ans += k; k -= a; k -= b; if (k > 0) { if (a < k) ans -= c; else ans -= k; } printf("%d", ans); return 0; }
#include <stdio.h> int main() { int a, b, c, k, ans = 0; scanf("%d %d %d %d", &a, &b, &c, &k); if (a < k) ans += a; else ans += k; k -= a; k -= b; if (k > 0) { if (c < k) ans -= c; else ans -= k; } printf("%d", ans); return 0; }
[["-", 64, 9, 0, 57, 15, 23, 0, 16, 31, 22], ["+", 64, 9, 0, 57, 15, 23, 0, 16, 31, 22]]
0
98
a,b,c,k = map(int, input().split()) ans = 0 if k <= a: ans = k elif a < k < a+b: ans = a elif k > a+b: ans = 2 * a - k + b print(ans)
a,b,c,k = map(int, input().split()) ans = 0 if k <= a: ans = k elif a < k <= a+b: ans = a elif k > a+b: ans = 2 * a - k + b print(ans)
[["-", 0, 656, 0, 57, 75, 665, 15, 666, 667, 18], ["+", 0, 656, 0, 57, 75, 665, 15, 666, 667, 19]]
5
63
#include <bits/stdc++.h> #include <iostream> #include <string> using namespace std; int main(void) { int A, B, C, K; cin >> A >> B >> C >> K; // cout << K << endl; int ans = 0; if (K < A) ans = K; if (K <= A + B) ans = A; else ans = A - (K - A - B); cout << ans << endl; }
#include <bits/stdc++.h> #include <iostream> #include <string> using namespace std; int main(void) { int A, B, C, K; cin >> A >> B >> C >> K; // cout << K << endl; int ans = 0; if (K < A) ans = K; else if (K <= A + B) ans = A; else ans = A - (K - A - B); cout << ans << endl; }
[["+", 0, 14, 8, 9, 0, 57, 75, 76, 0, 95]]
1
83
a = list(map(int,input().split())) #K枚の優先順位を選ぶ #+1の枚数分だけ選択、KからAを引く、総和のリストにA枚分の+1を追加 # K<Aのとき、K枚分だけリストにAを追加、KからKを引く #0の枚数分だけ選択、KからBを引く、総和のリストにB枚分の0を追加 #・・・総和のリストないの総和を計算する sum_num = [] card_num = [1,0,-1] for i,card in enumerate(a[0:2]): if card > a[3]: sum_num.append(a[3] * card_num[i]) a[3] -= a[3] else:...
a = list(map(int,input().split())) #K枚の優先順位を選ぶ #+1の枚数分だけ選択、KからAを引く、総和のリストにA枚分の+1を追加 # K<Aのとき、K枚分だけリストにAを追加、KからKを引く #0の枚数分だけ選択、KからBを引く、総和のリストにB枚分の0を追加 #・・・総和のリストないの総和を計算する sum_num = [] card_num = [1,0,-1] for i,card in enumerate(a[0:3]): if card > a[3]: sum_num.append(a[3] * card_num[i]) a[3] -= a[3] else:...
[["-", 12, 652, 3, 4, 0, 206, 206, 663, 0, 612], ["+", 12, 652, 3, 4, 0, 206, 206, 663, 0, 612]]
5
108
def main(): a, b, c, k = map(int, input().split()) if k <= a: return k if a < k <= a+b: return a if a+b < k <= a+b+c: return a + (k - a-b)*(-1) main()
def main(): a, b, c, k = map(int, input().split()) if k <= a: return k if a < k <= a+b: return a if a+b < k <= a+b+c: return a + (k - a-b)*(-1) print(main())
[["+", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
74
# B A,B,C,K = map(int,input().split()) ans = 0 if K <= A: ans = K elif K <= A+B: ans = A elif K <= A+B+C: ans = A+B-(K-(A+B)) print(ans)
# B A,B,C,K = map(int,input().split()) ans = 0 if K <= A: ans = K elif K <= A+B: ans = A elif K <= A+B+C: ans = A-(K-(A+B)) print(ans)
[["-", 0, 1, 0, 662, 12, 657, 31, 657, 17, 72], ["-", 0, 1, 0, 662, 12, 657, 31, 657, 12, 22]]
5
70
a,b,c,k = map(int,input().split()) ans = 0 if a <= k: ans += a else: print(a) exit() k = k - a if b <= k: ans += 0 else: print(ans) exit() k = k - b ans += k*-1 print(ans)
a,b,c,k = map(int,input().split()) ans = 0 if a <= k: ans += a else: print(k) exit() k = k - a if b <= k: ans += 0 else: print(ans) exit() k = k - b ans += k*-1 print(ans)
[["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
77
#include "bits/stdc++.h" #define PI acos(-1) using namespace std; using ll = long long; using l = long; using vi = vector<int>; using vl = vector<l>; using vll = vector<ll>; using vvl = vector<vector<l>>; using vvll = vector<vector<ll>>; using pll = pair<ll, ll>; int main() { int a, b, c, res = 0, cu = 0; ll k; ...
#include "bits/stdc++.h" #define PI acos(-1) using namespace std; using ll = long long; using l = long; using vi = vector<int>; using vl = vector<l>; using vll = vector<ll>; using vvl = vector<vector<l>>; using vvll = vector<vector<ll>>; using pll = pair<ll, ll>; int main() { int a, b, c, res = 0, cu = 0; ll k; ...
[["-", 64, 9, 0, 1, 0, 11, 12, 16, 31, 22], ["-", 64, 9, 0, 1, 0, 11, 12, 16, 17, 48]]
1
205
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = Integer.parseInt(sc.next()); int b = Integer.parseInt(sc.next()); int c = Integer.parseInt(sc.next()); int k = Integer.parseInt(sc.next()); int ans = 0; if (a >=...
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = Integer.parseInt(sc.next()); int b = Integer.parseInt(sc.next()); int c = Integer.parseInt(sc.next()); int k = Integer.parseInt(sc.next()); int ans = 0; if (a >=...
[["-", 0, 57, 64, 196, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 11, 12, 22]]
3
151
#include <bits/stdc++.h> #define endl "\n" using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; if (k <= a) { cout << a << endl; } else if (k <= a + b) { cout << a << endl; } else { cout << a - (k - a - b) << endl; } }
#include <bits/stdc++.h> #define endl "\n" using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; if (k <= a) { cout << k << endl; } else if (k <= a + b) { cout << a << endl; } else { cout << a - (k - a - b) << endl; } }
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
82
#include "bits/stdc++.h" using namespace std; #define ASC(vec) vec.begin(), vec.end() // 昇順ソート 例:sort(ASC(vec)); #define DESC(vec) vec.rbegin(), vec.rend() // 降順ソート 例:sort(DESC(vec)); #define rep(i, n) for (int i = 0; i < (n); i++) #define Rep(i, n) for (int i = 1; i < n; i++) #define REP(i, vec) for (auto i = vec.beg...
#include "bits/stdc++.h" using namespace std; #define ASC(vec) vec.begin(), vec.end() // 昇順ソート 例:sort(ASC(vec)); #define DESC(vec) vec.rbegin(), vec.rend() // 降順ソート 例:sort(DESC(vec)); #define rep(i, n) for (int i = 0; i < (n); i++) #define Rep(i, n) for (int i = 1; i < n; i++) #define REP(i, vec) for (auto i = vec.beg...
[["-", 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, 13], ["-", 0, 16, 31, 16, 12, 2, 3, 4, 0, 21], ["-", 0, 16, 31, 16, 12, 2, 3, 4, 0, 25]]
1
452
import java.io.*; import java.math.*; import java.util.*; public class Main { public static void process() throws IOException { long a = nl(), b = nl(), c = nl(), k = nl(), res = 0l; res += Math.min(k, a); k = Math.max(0, k - a); k = Math.max(0, k - b); res -= Math.min(k, b); pn(res); }...
import java.io.*; import java.math.*; import java.util.*; public class Main { public static void process() throws IOException { long a = nl(), b = nl(), c = nl(), k = nl(), res = 0l; res += Math.min(k, a); k = Math.max(0, k - a); k = Math.max(0, k - b); res -= Math.min(k, c); pn(res); }...
[["-", 0, 1, 0, 11, 12, 492, 3, 4, 0, 22], ["+", 0, 1, 0, 11, 12, 492, 3, 4, 0, 22]]
3
644
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; long ans = 0; if (k <= a) { cout << k; return 0; } else if (a < k <= a + b) { cout << a; return 0; } else { ans = 2 * a + b - k; cout << ans; return 0; } }
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; long ans = 0; if (k <= a) { cout << k; return 0; } else if (k <= a + b) { cout << a; return 0; } else { ans = 2 * a + b - k; cout << ans; return 0; } }
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 18]]
1
91
#include <bits/stdc++.h> using namespace std; #define ll long long #define ar array #define vi vector<int> #define INF 1000000000 int main() { ios::sync_with_stdio(0); cin.tie(0); ll a, b, c, k; cin >> a >> b >> c >> k; if (k <= a) cout << a << endl; else if (k <= a + b) cout << a << endl; else...
#include <bits/stdc++.h> using namespace std; #define ll long long #define ar array #define vi vector<int> #define INF 1000000000 int main() { ios::sync_with_stdio(0); cin.tie(0); 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...
[["-", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22], ["+", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22]]
1
102
a, b, c, k = [int(i) for i in input().split()] if k-a>0: if k-a-b>0: ans=2*a+b-k else: ans=a else: ans=a print(ans)
a, b, c, k = [int(i) for i in input().split()] if k-a>0: if k-a-b>0: ans=2*a+b-k 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
63
A, B, C, K = list(map(int, input().split())) ans = 0 if K >= A: K = K-A ans += A if K >= B: K= K-B if K >= C: K = K-C ans -= C else: ans -= K K=0 else: K = 0 ans += K print(ans)
A, B, C, K = list(map(int, input().split())) ans = 0 if K >= A: K = K-A ans += A if K >= B: K= K-B if K >= C: K = K-C ans -= C else: ans -= K K=0 else: ans += K 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]]
5
82
A, B, C, K = map(int, input().split()) if K <= A: print(K) K -= A+B if K <= 0: print(A) else: print(A-K)
A, B, C, K = map(int, input().split()) if K <= A: print(K) exit() K -= A+B if K <= 0: print(A) else: print(A-K)
[["+", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
51
#include <bits/stdc++.h> using namespace std; int main() { int A, B, C, K; cin >> A >> B >> C >> K; int Ans; if (K <= A) { Ans = K; cout << Ans << endl; } else if (A < K && K <= A + B) { Ans = A; cout << Ans << endl; } else if (A + B < K && K <= A + B + C) { Ans = A - K * (K - A + B); ...
#include <bits/stdc++.h> using namespace std; int main() { int A, B, C, K; cin >> A >> B >> C >> K; int Ans; if (K <= A) { Ans = K; cout << Ans << endl; } else if (A < K && K <= A + B) { Ans = A; cout << Ans << endl; } else if (A + B < K && K <= A + B + C) { Ans = A - (K - A - B); c...
[["-", 0, 1, 0, 11, 12, 16, 12, 16, 31, 22], ["-", 0, 1, 0, 11, 12, 16, 12, 16, 17, 48], ["-", 12, 16, 12, 16, 12, 23, 0, 16, 17, 72], ["+", 0, 11, 12, 16, 12, 23, 0, 16, 17, 33]]
1
116
#include <algorithm> #include <complex> #include <cstdint> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <limits> #include <list> #include <map> #include <math.h> #include <queue> #include <regex> #include <set> #include <stack> #include <stdio.h> #include <string> #include <...
#include <algorithm> #include <complex> #include <cstdint> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <limits> #include <list> #include <map> #include <math.h> #include <queue> #include <regex> #include <set> #include <stack> #include <stdio.h> #include <string> #include <...
[["-", 75, 76, 0, 57, 15, 339, 51, 16, 31, 22], ["-", 75, 76, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 75, 76, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 75, 76, 0, 57, 15, 339, 51, 16, 12, 22]]
1
627
#include <bits/stdc++.h> 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 if (A + B < K && K <= A + B + C) { cout << A - C << endl; } }
#include <bits/stdc++.h> 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 if (A + B < K && K <= A + B + C) { cout << A * 2 - K + B << endl; } }
[["+", 31, 16, 12, 16, 31, 16, 31, 16, 17, 48], ["+", 31, 16, 12, 16, 31, 16, 31, 16, 12, 13], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 12, 22], ["+", 0, 16, 31, 16, 12, 16, 31, 16, 12, 22], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 72], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 22]]
1
93