buggy_code
stringlengths
11
625k
fixed_code
stringlengths
17
625k
bug_type
stringlengths
2
4.45k
language
int64
0
8
token_count
int64
5
200k
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef long double ld; typedef unsigned long long int ull; typedef pair<ll, ll> pll; typedef pair<int, int> pii; #define N 100010 #define M 200010 #define endl "\n" #define mod 1000000007 int main() { ios_base::sync_with_stdio(0); cin.tie...
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef long double ld; typedef unsigned long long int ull; typedef pair<ll, ll> pll; typedef pair<int, int> pii; #define N 100010 #define M 200010 #define endl "\n" #define mod 1000000007 int main() { ios_base::sync_with_stdio(0); cin.tie...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["-", 0, 57, 75, 76, 0, 9, 0, 43, 39, 40], ["+", 0, 57, 75, 76, 0, 9, 0, 43, 39, 78]]
1
160
A, B, C, K = map(int, input().split()) if A >= K: print(A) else: if (A + B) >= K: print(A) else: if (A + B + C) >= K: print(A - (K - (A + B))) else: print(A - C)
A, B, C, K = map(int, input().split()) if A >= K: print(K) else: if (A + B) >= K: print(A) else: if (A + B + C) >= K: print(A - (K - (A + B))) else: print(A - C)
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
79
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { int a, b, c, k; cin >> a >> b >> c >> k; int sum = 0; sum += min(k, a); if (k < a) { cout << sum << endl; return 0; } k -= a; if (k < b) { cout << sum << endl; return 0; } k -= b; sum -= min(k, a); ...
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { int a, b, c, k; cin >> a >> b >> c >> k; int sum = 0; sum += min(k, a); if (k < a) { cout << sum << endl; return 0; } k -= a; if (k < b) { cout << sum << endl; return 0; } k -= b; sum -= min(k, c); ...
[["-", 0, 1, 0, 11, 12, 2, 3, 4, 0, 22], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 22]]
1
122
a,b,c,k= map(int,input.split(' ')) if a>=k: print(k) elif a+b>=k: print(a) elif a+b+c>=k: print(a-(k-a-b))
a,b,c,k= map(int,input().split()) if a>=k: print(k) elif a+b>=k: print(a) elif a+b+c>=k: print(a-(k-a-b))
[["+", 0, 652, 63, 319, 500, 652, 3, 4, 0, 24], ["+", 0, 652, 63, 319, 500, 652, 3, 4, 0, 25], ["-", 3, 4, 0, 652, 3, 4, 0, 557, 0, 654], ["-", 3, 4, 0, 652, 3, 4, 0, 557, 0, 6], ["-", 3, 4, 0, 652, 3, 4, 0, 557, 0, 655]]
5
62
#include <iostream> #include <vector> using namespace std; using ll = long long; using Graph = vector<vector<int>>; int main() { ll a, b, c, k, ans; cin >> a >> b >> c >> k; if (a >= k) { ans = a; } else if ((a + b) >= k) { ans = a; } else { ans = a - (k - (a + b)); } cout << ans << endl; ...
#include <iostream> #include <vector> using namespace std; using ll = long long; using Graph = vector<vector<int>>; int main() { 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 = a - (k - (a + b)); } cout << ans << endl; ...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22]]
1
107
#include <bits/stdc++.h> using namespace std; typedef vector<int> vi; typedef vector<vi> vvi; typedef pair<int, int> ii; #define ll long long #define sz(a) int((a).size()) #define pb push_back #define all(c) (c).begin(), (c).end() #define tr(c, i) for (typeof((c)).begin() i = (c).begin(); i != (c).end(); i++) #define...
#include <bits/stdc++.h> using namespace std; typedef vector<int> vi; typedef vector<vi> vvi; typedef pair<int, int> ii; #define ll long long #define sz(a) int((a).size()) #define pb push_back #define all(c) (c).begin(), (c).end() #define tr(c, i) for (typeof((c)).begin() i = (c).begin(); i != (c).end(); i++) #define...
[["-", 0, 11, 12, 16, 12, 23, 0, 16, 12, 22], ["+", 12, 16, 12, 23, 0, 16, 31, 16, 12, 22], ["+", 0, 11, 12, 16, 12, 23, 0, 16, 17, 33], ["+", 0, 11, 12, 16, 12, 23, 0, 16, 12, 22]]
1
156
#include <bits/stdc++.h> #include <iostream> #define lli long long using namespace std; int main() { lli a, b, c, d; cin >> a >> b >> c >> d; if (d <= (a + b)) cout << a << endl; else { a -= (d - (a + b)); cout << a << endl; } }
#include <bits/stdc++.h> #include <iostream> #define lli long long using namespace std; int main() { lli a, b, c, d; cin >> a >> b >> c >> d; if (d <= (a + b)) cout << min(a, d) << endl; else { a -= (d - (a + b)); cout << a << endl; } }
[["+", 64, 1, 0, 16, 31, 16, 12, 2, 63, 22], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 24], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 21], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 22], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 25]]
1
73
#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 (k > a && k <= a + b) cout << k << endl; else if (k > a + b && k <= a + b + c) cout << a - (k - a - b) << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; if (k <= a) cout << k << endl; else if (k > a && k <= a + b) cout << a << endl; else if (k > a + b && k <= a + b + c) cout << a - (k - a - b) << endl; }
[["-", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22], ["+", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22]]
1
93
#include <bits/stdc++.h> using namespace std; using LL = long long int; #define incID(i, l, r) for (int i = (l); i < (r); ++i) #define decID(i, l, r) for (int i = (r)-1; i >= (l); --i) #define incII(i, l, r) for (int i = (l); i <= (r); ++i) #define decII(i, l, r) for (int i = (r); i >= (l); --i) #define inc(i, n) incID...
#include <bits/stdc++.h> using namespace std; using LL = long long int; #define incID(i, l, r) for (int i = (l); i < (r); ++i) #define decID(i, l, r) for (int i = (r)-1; i >= (l); --i) #define incII(i, l, r) for (int i = (l); i <= (r); ++i) #define decII(i, l, r) for (int i = (r); i >= (l); --i) #define inc(i, n) incID...
[["+", 75, 16, 12, 23, 0, 16, 12, 23, 0, 24], ["+", 75, 16, 12, 23, 0, 16, 12, 23, 0, 25]]
1
453
ABCK = list(map(int, input().split())) if (ABCK[0] >= ABCK[3]): print(ABCK[3]) elif (ABCK[0] + ABCK[1] >= ABCK[3]): print(ABCK[0]) else: s = ABCK[2] - (ABCK[3] - ABCK[0] - ABCK[0]) print(ABCK[0] - s)
ABCK = list(map(int, input().split())) if (ABCK[0] >= ABCK[3]): print(ABCK[3]) elif (ABCK[0] + ABCK[1] >= ABCK[3]): print(ABCK[0]) else: s = (ABCK[3] - ABCK[0] - ABCK[1]) print(ABCK[0] - s)
[["-", 0, 1, 0, 662, 12, 657, 31, 206, 51, 22], ["-", 0, 1, 0, 662, 12, 657, 31, 206, 0, 70], ["-", 0, 1, 0, 662, 12, 657, 31, 206, 206, 612], ["-", 0, 1, 0, 662, 12, 657, 31, 206, 0, 73], ["-", 8, 196, 0, 1, 0, 662, 12, 657, 17, 33], ["-", 12, 657, 12, 23, 0, 657, 12, 206, 206, 612], ["+", 0, 662, 12, 23, 0, 657, 12, ...
5
96
N = [int(e) for e in input().split()] if(N[3] - N[0] > 0): N[3] -= N[0] if(N[3] - N[1] > 0): N[3] -= N[1] ans = N[0] - N[3] else: ans = N[0] else: ans = N[0] print(ans)
N = [int(e) for e in input().split()] if(N[3] - N[0] > 0): N[3] -= N[0] if(N[3] - N[1] > 0): N[3] -= N[1] ans = N[0] - N[3] else: ans = N[0] else: ans = N[3] print(ans)
[["-", 8, 196, 0, 1, 0, 662, 12, 206, 206, 612], ["+", 8, 196, 0, 1, 0, 662, 12, 206, 206, 612]]
5
97
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define MIN(a, b) ((a) > (b) ? (b) : (a)) #define MAX(a, b) ((a) < (b) ? (b) : (a)) const long long INF = 1LL << 60; typedef unsigned long long ll; const long long MOD = 1000000000 + 7; // For DP template <class T> i...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define MIN(a, b) ((a) > (b) ? (b) : (a)) #define MAX(a, b) ((a) < (b) ? (b) : (a)) const long long INF = 1LL << 60; typedef long long ll; const long long MOD = 1000000000 + 7; // For DP template <class T> inline boo...
[["-", 36, 36, 0, 30, 0, 134, 39, 86, 0, 87], ["-", 0, 16, 31, 16, 12, 16, 12, 2, 63, 22], ["-", 31, 16, 12, 16, 12, 2, 3, 4, 0, 24], ["-", 31, 16, 12, 16, 12, 2, 3, 4, 0, 22], ["-", 31, 16, 12, 16, 12, 2, 3, 4, 0, 21], ["-", 31, 16, 12, 16, 12, 2, 3, 4, 0, 25]]
1
387
#include <bits/stdc++.h> using namespace std; int main() { long long int A, B, C, K; cin >> A >> B >> C >> K; if (A >= K) { cout << K << endl; } else if (A + B >= K) { cout << A << endl; } else { cout << A - (K - B) << endl; } }
#include <bits/stdc++.h> using namespace std; int main() { long long int A, B, C, K; cin >> A >> B >> C >> K; if (A >= K) { cout << K << endl; } else if (A + B >= K) { cout << A << endl; } else { cout << A - (K - A - B) << endl; } }
[["+", 12, 16, 12, 23, 0, 16, 31, 16, 12, 22], ["+", 31, 16, 12, 16, 12, 23, 0, 16, 17, 33]]
1
79
abck = input('') a = int(abck.split(' ')[0]) b = int(abck.split(' ')[1]) c = int(abck.split(' ')[2]) k = int(abck.split(' ')[3]) cnt=0 left=k #A if a > k: left=0 cnt=a else: left-=a cnt+=a if left>0: left-=b if left>0: cnt-=left print(cnt)
abck = input('') a = int(abck.split(' ')[0]) b = int(abck.split(' ')[1]) c = int(abck.split(' ')[2]) k = int(abck.split(' ')[3]) cnt=0 left=k #A if a > k: left=0 cnt=k else: left=k-a cnt=a if left>0: left-=b if left>0: cnt-=left print(cnt)
[["-", 0, 57, 64, 196, 0, 1, 0, 662, 12, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 12, 22], ["-", 75, 76, 8, 196, 0, 1, 0, 677, 17, 110], ["+", 75, 76, 8, 196, 0, 1, 0, 662, 0, 32], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 31, 22], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 17, 33], ["-", 75, 76, 8, 196, 0, 1, 0, 677, 17, 107]]
5
117
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(); long sum = 0; if (A >= K) { System.out.println(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(); long sum = 0; if (A >= K) { System.out.println(K);...
[["-", 64, 196, 0, 1, 0, 492, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 492, 3, 4, 0, 22]]
3
141
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int A = sc.nextInt(); int B = sc.nextInt(); int C = sc.nextInt(); int D = sc.nextInt(); int plus = D - A; int zero = plus - B; int sum = 0; if (plus > 0)...
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int A = sc.nextInt(); int B = sc.nextInt(); int C = sc.nextInt(); int D = sc.nextInt(); int plus = D - A; int zero = plus - B; int sum = 0; if (plus > 0)...
[["-", 0, 57, 64, 196, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 11, 12, 22]]
3
153
import numpy as np A, B, C, K = (int(i) for i in input().split()) ans = 0 if A <= K: ans += A if K > A + B: ans -= (K - A - B) print(ans)
import numpy as np A, B, C, K = (int(i) for i in input().split()) ans = 0 if A <= K: ans += A if K > A + B: ans -= (K - A - B) else: ans = K print(ans)
[["+", 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
59
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<bool> vb; typedef vector<int> vi; typedef vector<ll> vl; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef map<int, int> mii; typedef map<ll, ll> mll; typedef vector<pii> vii; typedef vector<pll> vll; #define fi first #define...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<bool> vb; typedef vector<int> vi; typedef vector<ll> vl; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef map<int, int> mii; typedef map<ll, ll> mll; typedef vector<pii> vii; typedef vector<pll> vll; #define fi first #define...
[["-", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22], ["+", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22]]
1
280
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstdlib> #include <ctime> #include <deque> #include <fstream> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string.h> #include <string> #include <u...
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstdlib> #include <ctime> #include <deque> #include <fstream> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string.h> #include <string> #include <u...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["-", 75, 76, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 75, 76, 0, 57, 15, 339, 51, 16, 17, 20]]
1
142
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) elif A + B + C >= K: print(A - (K -(A + B))) elif K == 0: print(0)
A, B, C, K = map(int, input().split()) if K == 0: print(0) elif A >= K: print(K) elif A + B >= K: print(A) elif A + B + C >= K: print(A - (K -(A + B))) elif K == 0: print(0)
[["-", 0, 1, 0, 652, 3, 4, 0, 657, 31, 22], ["-", 0, 1, 0, 652, 3, 4, 0, 657, 17, 33]]
5
83
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int A, B, C, K; cin >> A >> B >> C >> K; ll ans = 0; if (A + B < K) { ans = A; ans -= (K - A - B); } else { ans = A; } cout << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int A, B, C, K; cin >> A >> B >> C >> K; ll ans = 0; if (A + B < K) { ans = A; ans -= (K - A - B); } else { ans = min(A, K); } cout << ans << endl; return 0; }
[["+", 0, 9, 0, 1, 0, 11, 12, 2, 63, 22], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 24], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 21], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 22], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 25]]
1
81
A, B, C, K = map(int, input().split()) if K<=A: print(K) elif (A<=K)&(A+B<=K): print(A) else: print(A-(K-B-A))
A, B, C, K = map(int, input().split()) if K<=A: print(K) elif (A<=K)&(K<=A+B): print(A) else: print(A-(K-B-A))
[["+", 75, 665, 15, 657, 12, 23, 0, 666, 0, 22], ["+", 75, 665, 15, 657, 12, 23, 0, 666, 667, 19], ["-", 75, 665, 15, 657, 12, 23, 0, 666, 667, 19], ["-", 75, 665, 15, 657, 12, 23, 0, 666, 0, 22]]
5
62
num = gets.split.map(&:to_i) a = num[0] b = num[1] c = num[2] k = num[3] if a >= k puts a elsif a + b >= k puts a else puts a - (k - a - b) end
num = gets.split.map(&:to_i) a = num[0] b = num[1] c = num[2] k = num[3] if a >= k puts k elsif a + b >= k puts a else puts a - (k - a - b) end
[["-", 0, 121, 64, 749, 0, 652, 3, 4, 0, 22], ["+", 0, 121, 64, 749, 0, 652, 3, 4, 0, 22]]
4
61
#include <bits/stdc++.h> using namespace std; #define fio \ ios_base::sync_with_stdio(0); \ cin.tie(NULL); \ cout.tie(NULL); #define Mod 1...
#include <bits/stdc++.h> using namespace std; #define fio \ ios_base::sync_with_stdio(0); \ cin.tie(NULL); \ cout.tie(NULL); #define Mod 1...
[["+", 12, 16, 12, 2, 3, 4, 0, 2, 63, 22], ["+", 12, 2, 3, 4, 0, 2, 3, 4, 0, 24], ["+", 12, 2, 3, 4, 0, 2, 3, 4, 0, 13], ["+", 12, 2, 3, 4, 0, 2, 3, 4, 0, 21], ["+", 12, 2, 3, 4, 0, 2, 3, 4, 0, 25]]
1
316
#include <bits/stdc++.h> //#include <ext/pb_ds/assoc_container.hpp> // using namespace __gnu_pbds; using namespace std; #define ff first #define ss second #define int long long #define ll long long #define pb push_back #define pii pair<int, int> #define vi vector<int> #define mii map<int, int> #define pqb priority_que...
#include <bits/stdc++.h> //#include <ext/pb_ds/assoc_container.hpp> // using namespace __gnu_pbds; using namespace std; #define ff first #define ss second #define int long long #define ll long long #define pb push_back #define pii pair<int, int> #define vi vector<int> #define mii map<int, int> #define pqb priority_que...
[["-", 8, 9, 0, 57, 64, 1, 0, 16, 12, 22], ["+", 8, 9, 0, 57, 64, 1, 0, 16, 12, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 18], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 22], ["+", 75, 76, 0, 57, 15, 339, 51, 16, 17, 98]]
1
374
def main(): a, b, c, k = map(int, input().split()) if a >= k or a + b >= k: print(a) elif a+b<k: print(2*a+b-k) if __name__ == '__main__': main()
def main(): a, b, c, k = map(int, input().split()) if a >= k: print(k) elif a + b >= k: print(a) elif a+b<k: print(2*a+b-k) if __name__ == '__main__': main()
[["-", 0, 14, 8, 196, 0, 57, 15, 679, 17, 354], ["+", 0, 656, 0, 14, 8, 196, 0, 57, 0, 102], ["+", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25], ["+", 0, 14, 8, 196, 0, 57, 75, 665, 0, 683]]
5
67
#include <algorithm> #include <cmath> #include <deque> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <sstream> #include <stack> #include <stdio.h> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; typedef long lo...
#include <algorithm> #include <cmath> #include <deque> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <sstream> #include <stack> #include <stdio.h> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; typedef long lo...
[["+", 64, 9, 0, 1, 0, 11, 12, 2, 63, 22], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 24], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 21], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 22], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 25]]
1
116
import sys read = sys.stdin.buffer.read # 全読み込み readline = sys.stdin.buffer.readline # 一行読み込み readlines = sys.stdin.buffer.readlines # 一行ずつ全読み込み sys.setrecursionlimit(10**7) # 再帰限界変更(デフォルトは1000) """ # 文字列(数値変換も含む) n = readline().rstrip() # 1行に1文字列のみ lis = readline().rstrip().split() # # 1行に複数の文字列 # 数値(文字変換も含む) n = ...
import sys read = sys.stdin.buffer.read # 全読み込み readline = sys.stdin.buffer.readline # 一行読み込み readlines = sys.stdin.buffer.readlines # 一行ずつ全読み込み sys.setrecursionlimit(10**7) # 再帰限界変更(デフォルトは1000) """ # 文字列(数値変換も含む) n = readline().rstrip() # 1行に1文字列のみ lis = readline().rstrip().split() # # 1行に複数の文字列 # 数値(文字変換も含む) n = ...
[["+", 0, 656, 0, 57, 75, 665, 15, 666, 0, 22], ["+", 0, 656, 0, 57, 75, 665, 15, 666, 667, 18], ["+", 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, 12, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 12, 22]]
5
94
#include <bits/stdc++.h> #define ull unsigned long long #define lli long long int #define ll long long #define db double #define ldb long double #define vi vector<int> #define vull vector<ull> #define vll vector<ll> #define pb push_back #define si set<int> #define sll set<ll> #define ins insert #define vpp vector<pair<...
#include <bits/stdc++.h> #define ull unsigned long long #define lli long long int #define ll long long #define db double #define ldb long double #define vi vector<int> #define vull vector<ull> #define vll vector<ll> #define pb push_back #define si set<int> #define sll set<ll> #define ins insert #define vpp vector<pair<...
[["+", 8, 9, 0, 1, 0, 11, 12, 2, 63, 22], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 24], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 21], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 22], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 25]]
1
154
a, b, c, k = map(int, input().split()) ans = 0 if a > k: print(k) exit() if a + b == k: print(a) else: k = ((k - (a + b)) * -1) print(a + k)
a, b, c, k = map(int, input().split()) ans = 0 if a >= k: print(k) exit() if a + b >= k: print(a) else: k = ((k - (a + b)) * -1) print(a + k)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20], ["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 60]]
5
70
a, b, c, k = map(int, input().split()) ans = 0 if a >= k: ans = k elif a + b >= k: ans = a else: ans = a - (k - c) print(ans)
a, b, c, k = map(int, input().split()) ans = 0 if a >= k: ans = k elif a + b >= k: ans = a else: ans = a - (k - (a+b)) print(ans)
[["-", 0, 662, 12, 657, 12, 23, 0, 657, 12, 22], ["+", 12, 657, 12, 23, 0, 657, 12, 23, 0, 24], ["+", 12, 23, 0, 657, 12, 23, 0, 657, 31, 22], ["+", 12, 23, 0, 657, 12, 23, 0, 657, 17, 72], ["+", 12, 23, 0, 657, 12, 23, 0, 657, 12, 22], ["+", 12, 657, 12, 23, 0, 657, 12, 23, 0, 25]]
5
56
#include <bits/stdc++.h> using namespace std; int main() { int64_t A, B, C, K; cin >> A >> B >> C >> K; int64_t max_sum; if (A >= K) max_sum = A; else if (B >= (K - A)) max_sum = A; else max_sum = A - (K - A - B); cout << max_sum << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int64_t A, B, C, K; cin >> A >> B >> C >> K; int64_t max_sum = 0; if (A >= K) max_sum = K; else if (B >= (K - A)) max_sum = A; else max_sum = A - (K - A - B); cout << max_sum << endl; return 0; }
[["+", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 8, 9, 0, 57, 64, 1, 0, 11, 12, 22], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 12, 22]]
1
81
a,b,c,k = map(int,input().split()) ans = 0 if k <= a: ans = a elif k <= a+b: ans = a else: ans = 2*a+b-k print(ans)
a,b,c,k = map(int,input().split()) ans = 0 if k <= a: ans = k elif k <= a+b: ans = a else: ans = 2*a+b-k print(ans)
[["-", 0, 57, 64, 196, 0, 1, 0, 662, 12, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 12, 22]]
5
56
a,b,c,k = map(int, input().split()) ans = 0 if k <= a: ans += k elif a < k <= a+b: ans += a elif a+b < k <=a+b+c: ans += a-(k-1-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 a+b < k <=a+b+c: ans += a-(k-a-b) print(ans)
[["-", 12, 657, 12, 23, 0, 657, 31, 657, 12, 612], ["+", 12, 657, 12, 23, 0, 657, 31, 657, 12, 22]]
5
71
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; int s = 0; if (k >= a) { k -= a; s += a; } else { k = 0; s += k; cout << s; return 0; } if (k >= b) { k -= b; } else { cout << s; return 0; } s -= k; cout << s; ...
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; int s = 0; if (k > a) { k -= a; s += a; } else { s += k; cout << s; return 0; } if (k > b) { k -= b; } else { cout << s; return 0; } s -= k; cout << s; return 0; }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["-", 75, 76, 0, 9, 0, 1, 0, 11, 31, 22], ["-", 75, 76, 0, 9, 0, 1, 0, 11, 17, 32], ["-", 75, 76, 0, 9, 0, 1, 0, 11, 12, 13], ["-", 0, 57, 75, 76, 0, 9, 0, 1, 0, 35]]
1
103
#include <algorithm> #include <cmath> #include <iostream> #include <limits> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; template <class T> class Input { public: auto operator()() const { T v; c...
#include <algorithm> #include <cmath> #include <iostream> #include <limits> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; template <class T> class Input { public: auto operator()() const { T v; c...
[["-", 0, 1, 0, 11, 12, 2, 3, 4, 0, 22], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 22]]
1
762
using namespace std; #include <algorithm> #include <cmath> #include <cstdint> #include <cstdio> #include <cstring> #include <iostream> #include <queue> #include <stack> #include <string> #include <vector> int main() { cin.tie(0); ios::sync_with_stdio(false); long int A = 0; long int B = 0; long int C = 0; ...
using namespace std; #include <algorithm> #include <cmath> #include <cstdint> #include <cstdio> #include <cstring> #include <iostream> #include <queue> #include <stack> #include <string> #include <vector> int main() { cin.tie(0); ios::sync_with_stdio(false); long int A = 0; long int B = 0; long int C = 0; ...
[["+", 64, 9, 0, 1, 0, 11, 12, 2, 63, 22], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 24], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 22], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 21], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 25]]
1
138
import sys a,b,c,k=list(map(int,input().split())) sum=0 if(a>=k): print(a) sys.exit() else: sum=a if(b>=k-a): print(a) sys.exit() else: sum=sum-(k-a-b) print(sum)
import sys a,b,c,k=list(map(int,input().split())) sum=0 if(a>=k): print(k) sys.exit() else: sum=a if(b>=k-a): print(a) sys.exit() else: sum=sum-(k-a-b) print(sum)
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
84
#define _GLIBCXX_DEBUG #include <bits/stdc++.h> #define rep(i, n) for (ll i = 0; i < (n); ++i) #define FOR(i, m, n) for (ll i = m; i < (n); i++) #define all(x) (x).begin(), (x).end() using namespace std; typedef long long ll; using vi = vector<int>; using vii = vector<vi>; using pii = pair<int, int>; using vl = vector<...
#define _GLIBCXX_DEBUG #include <bits/stdc++.h> #define rep(i, n) for (ll i = 0; i < (n); ++i) #define FOR(i, m, n) for (ll i = m; i < (n); i++) #define all(x) (x).begin(), (x).end() using namespace std; typedef long long ll; using vi = vector<int>; using vii = vector<vi>; using pii = pair<int, int>; using vl = vector<...
[["-", 75, 76, 0, 9, 0, 1, 0, 11, 12, 22], ["+", 75, 76, 0, 9, 0, 1, 0, 11, 12, 22]]
1
206
A, B, C, K = list(map(int, input().split())) if K <= A: print(A) else: val = K val -= A ans = A if val <= B: print(ans) else: val -= B print(ans-val)
A, B, C, K = list(map(int, input().split())) if K <= A: print(K) else: val = K val -= A ans = A if val <= B: print(ans) else: val -= B print(ans-val)
[["-", 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 a >= k: print(k) elif a + b >= k: print(k) else: print(2*a + b - k)
a,b,c,k =map(int,input().split()) if a >= k: print(k) elif a + b >= k: print(a) else: print(2*a + b - k)
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
52
import itertools from collections import deque,defaultdict,Counter from itertools import accumulate import bisect from heapq import heappop,heappush,heapify import math from copy import deepcopy import queue #import sympy as syp(素因数分解とか) Mod = 1000000007 def sieve_of_eratosthenes(n): if not isinstance(n,int): ...
import itertools from collections import deque,defaultdict,Counter from itertools import accumulate import bisect from heapq import heappop,heappush,heapify import math from copy import deepcopy import queue #import sympy as syp(素因数分解とか) Mod = 1000000007 def sieve_of_eratosthenes(n): if not isinstance(n,int): ...
[["-", 8, 196, 0, 57, 75, 665, 15, 666, 667, 18], ["+", 8, 196, 0, 57, 75, 665, 15, 666, 667, 19]]
5
406
A,B,C,K=map(int,input().split()) Max=0 if(A>=K): Max+=A elif (A+B>=K): Max=A else:#if (A+B+C>=K): Max=A-(K-A-B) print(Max)
A,B,C,K=map(int,input().split()) Max=0 if(A>=K): Max+=K elif (A+B>=K): Max=A else:#if (A+B+C>=K): Max=A-(K-A-B) print(Max)
[["-", 0, 57, 64, 196, 0, 1, 0, 677, 12, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 677, 12, 22]]
5
63
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) typedef long long ll; using namespace std; int main() { ll a, b, c, k; cin >> a >> b >> c >> k; ll ans = 0; if (a >= k) { std::cout << a << endl; return 0; } else { ans = a; } k -= a; if (b >= k) { cout << ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) typedef long long ll; using namespace std; int main() { ll a, b, c, k; cin >> a >> b >> c >> k; ll ans = 0; if (a >= k) { std::cout << k << endl; return 0; } else { ans = a; } k -= a; if (b >= k) { cout << ...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
113
def main(): a,b,c,k = map(int,input().split()) sum = 0 if a >= k: print(a) else: sum += a k -= a if b >= k: print(sum) else: k -= b print(sum - k) if __name__ == "__main__": main()
def main(): a,b,c,k = map(int,input().split()) sum = 0 if a >= k: print(k) else: sum += a k -= a if b >= k: print(sum) else: k -= b print(sum - k) if __name__ == "__main__": main()
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
75
A, B, C, K = map(int, input().split()) count = 0 if K > A: count += A K -= A if K > B: K -= B if K > 0: count -= K else: count += K
A, B, C, K = map(int, input().split()) count = 0 if K > A: count += A K -= A if K > B: K -= B if K > 0: count -= K else: count += K print(count)
[["+", 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
55
#include <bits/stdc++.h> using namespace std; typedef long long ll; // const int INF = 2e9; // const ll INF = 9e18; int main() { ios::sync_with_stdio(false); cin.tie(0); int A, B, C; int K; cin >> A >> B >> C >> K; int ans = 0; if (A > K) { ans = A; } else { K -= A; if (B > K) { ans ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; // const int INF = 2e9; // const ll INF = 9e18; int main() { ios::sync_with_stdio(false); cin.tie(0); int A, B, C; int K; cin >> A >> B >> C >> K; int ans = 0; if (A >= K) { ans = K; } else { K -= A; if (B >= K) { an...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["-", 0, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
110
#include <stdio.h> int main() { int A, B, C, K; scanf("%d", &A); scanf("%d", &B); scanf("%d", &C); scanf("%d", &K); if (K < A) printf("%d", K); if (K <= A + B && K >= A) printf("%d", A); else printf("%d", A - (K - A - B)); }
#include <stdio.h> int main() { int A, B, C, K; scanf("%d", &A); scanf("%d", &B); scanf("%d", &C); scanf("%d", &K); if (K < A) printf("%d", K); else if (K <= A + B && K >= A) printf("%d", A); else printf("%d", A - (K - A - B)); }
[["+", 0, 14, 8, 9, 0, 57, 75, 76, 0, 95]]
0
111
#include <bits/stdc++.h> using ll = long long; using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; int ans; if (k <= a) ans = a; else if (k <= a + b) ans = a; else ans = a - (k - (a + b)); cout << ans << endl; return 0; }
#include <bits/stdc++.h> using ll = long long; 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; else ans = a - (k - (a + b)); cout << ans << endl; return 0; }
[["-", 8, 9, 0, 57, 64, 1, 0, 11, 12, 22], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 12, 22]]
1
87
A,B,C,K=map(int, input().split()) if A >= K: maxnum = A elif A<K and A+B>=K: maxnum = A else: maxnum = A - (K-A-B) print(maxnum)
A,B,C,K=map(int, input().split()) if A >= K: maxnum = K elif A<K and A+B>=K: maxnum = A else: maxnum = A - (K-A-B) print(maxnum)
[["-", 0, 57, 64, 196, 0, 1, 0, 662, 12, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 12, 22]]
5
59
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll a, b, c, k; cin >> a >> b >> c >> k; ll max = 0; if (k < a) { max = a; k = 0; } else { max = a; k = k - a; } if (k > 0) { if (k < b) { k = 0; } else { k = k - b; } } if (k > 0) ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll a, b, c, k; cin >> a >> b >> c >> k; ll max = 0; if (k < a) { max = k; k = 0; } else { max = a; k = k - a; } if (k > 0) { if (k < b) { k = 0; } else { k = k - b; } } if (k > 0) ...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22]]
1
120
a,b,c,k=map(int,input().split()) o=a+b if a>=k: print(a) elif a+b>=k: print(a) else: l=k-o print(a-l)
a,b,c,k=map(int,input().split()) o=a+b if a>=k: print(k) elif a+b>=k: print(a) else: l=k-o print(a-l)
[["-", 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=map(int,input().split()) ans=0 if a<k: ans+=a k-=a else: ans+=a k=0 if b>k and k>0: k=0 else: k-=b if k>0: ans-=k print(ans)
a,b,c,k=map(int,input().split()) ans=0 if a<k: ans+=a k-=a else: ans+=k k=0 if b>k and k>0: k=0 else: k-=b if k>0: ans-=k print(ans)
[["-", 75, 76, 8, 196, 0, 1, 0, 677, 12, 22], ["+", 75, 76, 8, 196, 0, 1, 0, 677, 12, 22]]
5
71
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++) #define VL vector<ll> #define VS vector<string> #define VB vector<bool> #define VP vector<pair<ll, ll>> #define VVL vector<vector<ll>> #define VVP vector<vector<pair<ll, ll>>...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++) #define VL vector<ll> #define VS vector<string> #define VB vector<bool> #define VP vector<pair<ll, ll>> #define VVL vector<vector<ll>> #define VVP vector<vector<pair<ll, ll>>...
[["+", 64, 9, 0, 1, 0, 11, 12, 2, 63, 22], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 24], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 21], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 22], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 25]]
1
146
/* ID: wangjun30 LANG: C++11 TASK: */ #include <algorithm> #include <array> #include <bitset> #include <climits> #include <cmath> #include <cstdio> #include <cstring> #include <iomanip> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <unordered_map> #include ...
/* ID: wangjun30 LANG: C++11 TASK: */ #include <algorithm> #include <array> #include <bitset> #include <climits> #include <cmath> #include <cstdio> #include <cstring> #include <iomanip> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <unordered_map> #include ...
[["+", 0, 14, 8, 9, 0, 1, 0, 16, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 151], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
180
# -*- coding: utf-8 -*- import numpy as np a, b, c, k = map(int, input().split()) if k <= a: ans = a else: if k <= a + b: ans = a else: ans = a - (k - a - b) print(ans)
# -*- coding: utf-8 -*- import numpy as np a, b, c, k = map(int, input().split()) if k <= a: ans = k else: if k <= a + b: ans = a else: ans = a - (k - a - b) print(ans)
[["-", 0, 57, 64, 196, 0, 1, 0, 662, 12, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 12, 22]]
5
62
#include <bits/stdc++.h> using namespace std; #define int long long int #define endl "\n" const int mod = 1e9 + 7; const int INF = LONG_LONG_MAX; inline int gcd(int a, int b) { if (a == 0) return b; return gcd(b % a, a); } inline int pow(int a, int n, int mod) { if (n == 0) return 1; int p = pow(a, n / ...
#include <bits/stdc++.h> using namespace std; #define int long long int #define endl "\n" const int mod = 1e9 + 7; const int INF = LONG_LONG_MAX; inline int gcd(int a, int b) { if (a == 0) return b; return gcd(b % a, a); } inline int pow(int a, int n, int mod) { if (n == 0) return 1; int p = pow(a, n / ...
[["+", 64, 1, 0, 16, 31, 16, 12, 2, 63, 22], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 24], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 21], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 22], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 25]]
1
208
#include <iostream> using namespace std; int main() { int a, b, c, k; int ans = 0; cin >> a >> b >> c >> k; if (k > a) { ans += a; k -= a; if (k > b) { k -= b; ans -= k; } } else { ans = a; } cout << ans << endl; }
#include <iostream> using namespace std; int main() { int a, b, c, k; int ans = 0; cin >> a >> b >> c >> k; if (k > a) { ans += a; k -= a; if (k > b) { k -= b; ans -= k; } } else { ans += k; } cout << ans << endl; }
[["-", 75, 76, 0, 9, 0, 1, 0, 11, 17, 32], ["-", 75, 76, 0, 9, 0, 1, 0, 11, 12, 22], ["+", 75, 76, 0, 9, 0, 1, 0, 11, 17, 107], ["+", 75, 76, 0, 9, 0, 1, 0, 11, 12, 22]]
1
81
A,B,C,K = list(map(int, input().split())) if A > K: print(A) elif(A + B >= K): print(A) else: print(A - (K -A-B))
A,B,C,K = list(map(int, input().split())) if A > K: print(K) elif(A + B > K): print(A) else: print(A - (K -A-B))
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 57, 75, 665, 15, 23, 0, 666, 667, 20], ["+", 0, 57, 75, 665, 15, 23, 0, 666, 667, 47]]
5
59
import sys def input(): return sys.stdin.readline().strip() def resolve(): a,b,c,k=map(int, input().split()) l=[] if k<=a: print(k) elif a<k<=a+b: print(a) else: print(max(0,a-(k-(a+b)))) resolve()
import sys def input(): return sys.stdin.readline().strip() def resolve(): a,b,c,k=map(int, input().split()) l=[] if k<=a: print(k) elif a<k<=a+b: print(a) else: print(a-(k-(a+b))) resolve()
[["-", 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, 612], ["-", 0, 652, 3, 4, 0, 652, 3, 4, 0, 21], ["-", 0, 657, 12, 23, 0, 657, 12, 23, 0, 25]]
5
94
A, B, C, K = map(int, input().split()) ans = 0 if A >= K: print(A) elif A+B >= K: print(A) elif A+B+C >= K: print(A-(K-A-B))
A, B, C, K = map(int, input().split()) ans = 0 if A >= K: print(K) elif A+B >= K: print(A) elif A+B+C >= K: print(A-(K-A-B))
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
64
a, b, c, k = map(int, input().split()) ans = 0 if k <= a: print(a) else: k -= a ans += a if k <= b: print(ans) else: k -= b ans += -1 * k print(ans)
a, b, c, k = map(int, input().split()) ans = 0 if k <= a: print(k) else: k -= a ans += a if k <= b: print(ans) else: k -= b ans += -1 * k print(ans)
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
64
#include <stdio.h> #include <stdlib.h> #include <string.h> int main(void) { int a, b, c, k; scanf("%d%d%d%d", &a, &b, &c, &k); int ans = 0; if (a >= k) { ans = a; } else { ans = a; if (a + b < k) { ans -= (k - a - b); } } printf("%d\n", ans); return 0; }
#include <stdio.h> #include <stdlib.h> #include <string.h> int main(void) { int a, b, c, k; scanf("%d%d%d%d", &a, &b, &c, &k); int ans = 0; if (a >= k) { ans = k; } else { ans = a; if (a + b < k) { ans -= (k - a - b); } } printf("%d\n", ans); return 0; }
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22]]
0
98
A, B, C, K = map(int,input().split()) if(A >= K): print(K) if(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))
[["-", 36, 36, 36, 36, 0, 656, 0, 57, 0, 121], ["+", 36, 36, 0, 656, 0, 57, 75, 665, 0, 683]]
5
58
A, B, C, K = map(int, input().split()) ans = 0 if A < K and K > 0: ans += A K -= A elif A >= K and K > 0: ans += K K = 0 if B < K and K > 0: K -= B elif A >= K and K > 0: K = 0 if C < K and K > 0: ans -= C K -= C elif A >= K and K > 0: ans -= K K = 0 print(ans)
A, B, C, K = map(int, input().split()) ans = 0 if A < K and K > 0: ans += A K -= A elif A >= K and K > 0: ans += K K = 0 if B < K and K > 0: K -= B elif B >= K and K > 0: K = 0 if C < K and K > 0: ans -= C K -= C elif C >= K and K > 0: ans -= K K = 0 print(ans)
[["-", 0, 57, 75, 665, 15, 679, 31, 666, 0, 22], ["+", 0, 57, 75, 665, 15, 679, 31, 666, 0, 22]]
5
111
#include <bits/stdc++.h> #define _GLIBCXX_DEBUG using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; int sum = a; if (k <= a) sum = a; else if (a < k && k <= a + b) sum = a; else if (a + b < k && k <= a + b + c) sum = a - (k - a - b); cout << sum << endl; }
#include <bits/stdc++.h> #define _GLIBCXX_DEBUG using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; int sum = a; if (k <= a) sum = k; else if (a < k && k <= a + b) sum = a; else if (a + b < k && k <= a + b + c) sum = a - (k - a - b); cout << sum << endl; }
[["-", 8, 9, 0, 57, 64, 1, 0, 11, 12, 22], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 12, 22]]
1
100
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; if (a >= k) { cout << k << endl; } else if (a < k && a + b >= k) { cout << a << endl; } else if (a + b < k && a + b + c > k) { cout << a - (k - a - b) << endl; } else { cout << k - c << end...
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; if (a >= k) { cout << k << endl; } else if (a < k && a + b >= k) { cout << a << endl; } else if (a + b < k && a + b + c > k) { cout << a - (k - a - b) << endl; } else { cout << a - c << end...
[["-", 0, 1, 0, 16, 31, 16, 12, 16, 31, 22], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 31, 22]]
1
110
#include <bits/stdc++.h> using namespace std; #define fi first #define se second #define mp make_pair #define pb push_back #define rep(i, a, b) for (int i = (a); i < (b); i++) #define per(i, a, b) for (int i = (b)-1; i >= (a); i--) #define sz(a) (int)a.size() #define de(a) cout << #a << " = " << a << endl #define dd(a)...
#include <bits/stdc++.h> using namespace std; #define fi first #define se second #define mp make_pair #define pb push_back #define rep(i, a, b) for (int i = (a); i < (b); i++) #define per(i, a, b) for (int i = (b)-1; i >= (a); i--) #define sz(a) (int)a.size() #define de(a) cout << #a << " = " << a << endl #define dd(a)...
[["-", 0, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 0, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
204
n = list(map(int,input().split())) a = n[0] b = n[1] c = n[2] k = n[3] an = 0 if a>=k: an=a elif a+b>=k: an=a else: an=a-(k-a-b) print(an)
n = list(map(int,input().split())) a = n[0] b = n[1] c = n[2] k = n[3] an = 0 if a>=k: an=k elif a+b>=k: an=a else: an=a-(k-a-b) print(an)
[["-", 0, 57, 64, 196, 0, 1, 0, 662, 12, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 12, 22]]
5
79
#include <bits/stdc++.h> using namespace std; #define ll long long int #define fast \ ios_base::sync_with_stdio(0); \ cin.tie(0); \ cout...
#include <bits/stdc++.h> using namespace std; #define ll long long int #define fast \ ios_base::sync_with_stdio(0); \ cin.tie(0); \ cout...
[["-", 64, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["-", 75, 76, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 75, 76, 0, 1, 0, 16, 31, 16, 12, 22]]
1
112
#include <bits/stdc++.h> #define MAX (int)(8000 + 5) #define PB push_back #define MP make_pair #define ll long long #define pll pair<long long, long long> #define pii pair<int, int> #define sz(a) (int)a.size() #define sl(a) scanf("%lld", &a) #define sll(a, b) scanf("%lld%lld", &a, &b) #define si(a) scanf("%d", &a) #def...
#include <bits/stdc++.h> #define MAX (int)(8000 + 5) #define PB push_back #define MP make_pair #define ll long long #define pll pair<long long, long long> #define pii pair<int, int> #define sz(a) (int)a.size() #define sl(a) scanf("%lld", &a) #define sll(a, b) scanf("%lld%lld", &a, &b) #define si(a) scanf("%d", &a) #def...
[["-", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22], ["+", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22]]
1
205
#include <bits/stdc++.h> using namespace std; /////////////////////////////////////////// const long long int INF = 1LL << 60; const long long int Mod = 1000000007; using ll = long long int; using ci = const int; using vi = vector<int>; using Vi = vector<long long int>; using P = pair<int, int>; using PLL = pair<ll, ll...
#include <bits/stdc++.h> using namespace std; /////////////////////////////////////////// const long long int INF = 1LL << 60; const long long int Mod = 1000000007; using ll = long long int; using ci = const int; using vi = vector<int>; using Vi = vector<long long int>; using P = pair<int, int>; using PLL = pair<ll, ll...
[["-", 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, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22]]
1
444
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> VI; ll mm = 1000000000; ll MM = mm + 7; #define rep(i, n) for (int i = 0; i < n; i++) int main() { int a, b, c, k; cin >> a >> b >> c >> k; int ans; if (k <= a) ans = a; else if (k <= a + b) ans = a; else { ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> VI; ll mm = 1000000000; ll MM = mm + 7; #define rep(i, n) for (int i = 0; i < n; i++) int main() { ll a, b, c, k; cin >> a >> b >> c >> k; ll ans; if (k <= a) ans = k; else if (k <= a + b) ans = a; else { l...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 8, 9, 0, 57, 64, 1, 0, 11, 12, 22], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 12, 22], ["-", 0, 57, 75, 76, 0, 9, 0, 43, 39, 40], ["+", 0, 57, 75, 76, 0, 9, 0, 43, 39, 78]]
1
113
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) 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 - b) << endl; } }
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) 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; } }
[["+", 12, 16, 12, 23, 0, 16, 31, 16, 12, 22], ["+", 31, 16, 12, 16, 12, 23, 0, 16, 17, 33]]
1
85
#include <bits/stdc++.h> using namespace std; int a, b, c, k, ans; int main() { scanf("%d%d%d%d", &a, &b, &c, &k); if (k <= a + b) ans = a; else ans = a - (k - (a + b)); printf("%d\n", ans); return 0; }
#include <bits/stdc++.h> using namespace std; int a, b, c, k, ans; int main() { scanf("%d%d%d%d", &a, &b, &c, &k); if (k <= a + b) ans = min(k, a); else ans = a - (k - (a + b)); printf("%d\n", ans); return 0; }
[["+", 0, 57, 64, 1, 0, 11, 12, 2, 63, 22], ["+", 64, 1, 0, 11, 12, 2, 3, 4, 0, 24], ["+", 64, 1, 0, 11, 12, 2, 3, 4, 0, 22], ["+", 64, 1, 0, 11, 12, 2, 3, 4, 0, 21], ["+", 64, 1, 0, 11, 12, 2, 3, 4, 0, 25]]
1
82
A, B, C, K = map(int, input().split()) if A>=K: print(K) elif A+B>=K: print(K) else: print(A-(K-A-B))
A, B, C, K = map(int, input().split()) 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
54
#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll INF = 1e18; const ll mod = 1e9 + 7; #define rep(i, n) for (int i = 0; i < n; i++) int main() { int a, b, c, k; cin >> a >> b >> c >> k; if (k <= a) cout << a << endl; else if (k <= a + b) cout << a << endl; else cout << ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll INF = 1e18; const ll mod = 1e9 + 7; #define rep(i, n) for (int i = 0; i < n; i++) int main() { int a, b, c, k; cin >> a >> b >> c >> k; if (k <= a) cout << k << endl; else if (k <= a + b) cout << a << endl; else cout << ...
[["-", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22], ["+", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22]]
1
103
#include <bits/stdc++.h> //--------------------------------------------------------------- #define ll long long #define ld long double #define mod 1000000007 #define MAX 100005 #define pi 3.141592653589793238 // shortcut keys #define pb push_back #define mp make_pair #define all(x) x.begin(), x.end() #define fast ...
#include <bits/stdc++.h> //--------------------------------------------------------------- #define ll long long #define ld long double #define mod 1000000007 #define MAX 100005 #define pi 3.141592653589793238 // shortcut keys #define pb push_back #define mp make_pair #define all(x) x.begin(), x.end() #define fast ...
[["+", 0, 14, 8, 9, 0, 57, 75, 76, 0, 95]]
1
103
#include <stdio.h> int main() { long a, b, c, k, ans; scanf("%ld %ld %ld %ld", &a, &b, &c, &k); if (k > a) { ans = a; k -= a; } else { printf("%ld\n", a); return 0; } if (k > b) k -= b; else { printf("%ld\n", ans); return 0; } if (k > c) printf("%ld\n", ans - c); el...
#include <stdio.h> int main() { long a, b, c, k, ans; scanf("%ld %ld %ld %ld", &a, &b, &c, &k); if (k > a) { ans = a; k -= a; } else { printf("%ld\n", k); return 0; } if (k > b) k -= b; else { printf("%ld\n", ans); return 0; } if (k > c) printf("%ld\n", ans - c); el...
[["-", 0, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 0, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
0
130
#include <bits/stdc++.h> using namespace std; #define E "\n" #define int long long #define f(i, l, n) for (int i = l; i < n; i++) int solve() { int a, b, c, k; cin >> a >> b >> c >> k; if (k <= a + b) cout << a << E; else { int temp = a; k -= a + b; cout << temp - k << E; } return 0; } ...
#include <bits/stdc++.h> using namespace std; #define E "\n" #define int long long #define f(i, l, n) for (int i = l; i < n; i++) int solve() { int a, b, c, k; cin >> a >> b >> c >> k; if (k <= a + b) cout << min(a, k) << E; else { int temp = a; k -= a + b; cout << temp - k << E; } retur...
[["+", 64, 1, 0, 16, 31, 16, 12, 2, 63, 22], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 24], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 21], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 22], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 25]]
1
109
#include <bits/stdc++.h> using namespace std; long long a, b, c, k; int main() { cin >> a >> b >> c >> k; if (k <= a + b) cout << a << endl; else cout << a - (k - (a + b)) << endl; return 0; }
#include <bits/stdc++.h> using namespace std; long long a, b, c, k; int main() { cin >> a >> b >> c >> k; if (k <= a + b) cout << min(k, a) << endl; else cout << a - (k - (a + b)) << endl; return 0; }
[["+", 64, 1, 0, 16, 31, 16, 12, 2, 63, 22], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 24], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 22], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 21], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 25]]
1
66
A,B,C,K=map(int,input().split()) ans=0 ans=A K-=A def chk(k): if k>0: return True else: return False if not chk(K): print(ans) exit() K-=B if not chk(K): print(ans) exit() ans=ans-K print(ans)
A,B,C,K=map(int,input().split()) ans=0 ans=K K-=A def chk(k): if k>0: return True else: return False if not chk(K): print(ans) exit() ans=A K-=B if not chk(K): print(ans) exit() ans=ans-K print(ans)
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32]]
5
86
import java.util.*; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); long a = scanner.nextLong(); long b = scanner.nextLong(); long c = scanner.nextLong(); long k = scanner.nextLong(); long sum = 0; long calc = k; if (calc < a)...
import java.util.*; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); long a = scanner.nextLong(); long b = scanner.nextLong(); long c = scanner.nextLong(); long k = scanner.nextLong(); long sum = 0; long calc = k; if (calc < a)...
[["-", 0, 1, 0, 492, 3, 4, 0, 16, 31, 22], ["+", 0, 1, 0, 492, 3, 4, 0, 16, 31, 22]]
3
246
#include <stdio.h> #include <string.h> int main(void) { long long int a, b, c, k; scanf("%lld %lld %lld %lld", &a, &b, &c, &k); if (a >= k) { printf("%lld\n", a); } else if (a + b >= k) { printf("%lld\n", a); } else { printf("%lld\n", a - k + a + b); } return 0; }
#include <stdio.h> #include <string.h> int main(void) { long long int a, b, c, k; scanf("%lld %lld %lld %lld", &a, &b, &c, &k); if (a >= k) { printf("%lld\n", k); } else if (a + b >= k) { printf("%lld\n", a); } else { printf("%lld\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]]
1
102
from collections import deque from heapq import heapify,heappop,heappush,heappushpop from copy import copy,deepcopy from itertools import product,permutations,combinations,combinations_with_replacement from collections import defaultdict,Counter from bisect import bisect_left,bisect_right # from math import gcd,ceil,fl...
from collections import deque from heapq import heapify,heappop,heappush,heappushpop from copy import copy,deepcopy from itertools import product,permutations,combinations,combinations_with_replacement from collections import defaultdict,Counter from bisect import bisect_left,bisect_right # from math import gcd,ceil,fl...
[["-", 0, 57, 64, 196, 0, 1, 0, 662, 12, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 12, 22]]
5
502
#include <algorithm> #include <array> #include <bitset> #include <cassert> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <limits> #include <list> #incl...
#include <algorithm> #include <array> #include <bitset> #include <cassert> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <limits> #include <list> #incl...
[["-", 8, 9, 0, 57, 64, 9, 0, 37, 0, 22], ["+", 8, 9, 0, 57, 64, 9, 0, 37, 0, 22]]
1
264
// Author: kaiyu #include <algorithm> #include <climits> #include <cmath> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <vector> using namespace std...
// Author: kaiyu #include <algorithm> #include <climits> #include <cmath> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <vector> using namespace std...
[["+", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["+", 64, 9, 0, 1, 0, 11, 12, 16, 31, 22], ["+", 64, 9, 0, 1, 0, 11, 12, 16, 17, 72], ["+", 64, 9, 0, 1, 0, 11, 12, 16, 12, 22], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35]]
1
432
def max_num(): a, b, c, k = input().split() if k <= a: print(k) if a < k <= a + b: print(a) if a+b<k<=a+b+c: print(a-(k-a-b)) max_num()
def max_num(): a, b, c, k = map(int, input().split()) if k <= a: print(k) if a < k <= a + b: print(a) if a+b<k<=a+b+c: print(a-(k-a-b)) max_num()
[["+", 8, 196, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 21], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
70
# abc167 B a, b, c, k = gets.split.map(&:to_i) if a >= k p a else if a + b >= k p a else p a - (k - a - b) end end
# abc167 B a, b, c, k = gets.split.map(&:to_i) if a >= k p k else if a + b >= k p a else p a - ( k - (a+b) ) end end
[["-", 0, 121, 64, 749, 0, 652, 3, 4, 0, 22], ["+", 0, 121, 64, 749, 0, 652, 3, 4, 0, 22], ["+", 0, 738, 12, 739, 0, 738, 12, 739, 0, 24], ["-", 3, 4, 0, 738, 12, 739, 0, 738, 17, 33], ["+", 12, 739, 0, 738, 12, 739, 0, 738, 17, 72], ["+", 0, 738, 12, 739, 0, 738, 12, 739, 0, 25]]
4
46
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> #define ll long long #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; static const int MAXN = 100000; static const int MAX = 1000000000; int ...
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> #define ll long long #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; static const int MAXN = 100000; static const int MAX = 1000000000; int ...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22]]
1
126
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; if (k <= a) { cout << k << "\n"; } else if (k <= b + a) { cout << k << "\n"; } else { cout << a - (k - a - b) << "\n"; } }
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; if (k <= a) { cout << k << "\n"; } else if (k <= b + a) { cout << a << "\n"; } else { cout << a - (k - a - b) << "\n"; } }
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
85
a, b, c, k = map(int,input().split()) value = 0 if a >= k: value = a print(value) else: value = a if k <= a + b: print(value) else: value += (k-a-b) * (-1) print(value)
a, b, c, k = map(int,input().split()) value = 0 if a >= k: value = k print(value) else: value = a if k <= a + b: print(value) else: value += (k-a-b) * (-1) print(value)
[["-", 0, 57, 64, 196, 0, 1, 0, 662, 12, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 12, 22]]
5
71
A,B,C,K=map(int,input().split()) ans = 0 if(K<=A): ans = A if(K>A and K<=A+B): ans = A if(K>A+B): ans = A - (K-A-B) print(ans)
A,B,C,K = map(int,input().split()) ans = 0 if(K<=A): ans = K if(K>A and K<=A+B): ans = A if(K>A+B): ans = A - (K-A-B) print(ans)
[["-", 0, 57, 64, 196, 0, 1, 0, 662, 12, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 12, 22]]
5
73
# coding: utf-8 def main(): a, b, c, k = map(int, input().split()) if k <= a: print(a) elif k <= a + b: print(a) else: print(a * 2 + b - k) if __name__ == "__main__": main()
# coding: utf-8 def main(): a, b, c, k = map(int, input().split()) if k <= a: print(k) elif k <= a + b: print(a) else: print(a * 2 + b - k) if __name__ == "__main__": main()
[["-", 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(a) elif k > a: if k-a <= b: print(a) elif k-a > b: print(a-1*(k-a-b))
a, b, c, k = map(int, input().split()) if k <= a: print(k) elif k > a: if k-a <= b: print(a) elif k-a > b: print(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]]
5
66
#include <algorithm> #include <bitset> #include <complex> #include <deque> #include <exception> #include <fstream> #include <functional> #include <iomanip> #include <ios> #include <iosfwd> #include <iostream> #include <istream> #include <iterator> #include <limits> #include <list> #include <locale> #include <map> #incl...
#include <algorithm> #include <bitset> #include <complex> #include <deque> #include <exception> #include <fstream> #include <functional> #include <iomanip> #include <ios> #include <iosfwd> #include <iostream> #include <istream> #include <iterator> #include <limits> #include <list> #include <locale> #include <map> #incl...
[["-", 64, 1, 0, 16, 31, 16, 12, 2, 63, 22], ["+", 64, 1, 0, 16, 31, 16, 12, 2, 63, 22]]
1
146
A, B, C, K = map(int, input().split()) X = K - A Y = K - A - B Z = 0 if X >= 0: Z += A if Y > 0: Z -= Y print(Z)
A, B, C, K = map(int, input().split()) X = K - A Y = K - A - B Z = 0 if X >= 0: Z += A if Y > 0: Z -= Y else: Z += K print(Z)
[["+", 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, 677, 31, 22], ["+", 75, 76, 8, 196, 0, 1, 0, 677, 17, 107], ["+", 75, 76, 8, 196, 0, 1, 0, 677, 12, 22]]
5
55
#include <bits/stdc++.h> using namespace std; #define endl '\n' #define fastIO \ ios::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0)...
#include <bits/stdc++.h> using namespace std; #define endl '\n' #define fastIO \ ios::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0)...
[["-", 0, 9, 0, 1, 0, 11, 12, 16, 31, 22], ["-", 0, 9, 0, 1, 0, 11, 12, 16, 17, 33], ["-", 8, 9, 0, 1, 0, 11, 12, 16, 31, 22], ["-", 8, 9, 0, 1, 0, 11, 12, 16, 17, 33]]
1
243
import sys import math from collections import Counter import itertools import fractions #from functools import reduce # 入力を整数に変換して受け取る def II(): return int(sys.stdin.readline()) def MI(): return map(int, sys.stdin.readline().split()) # 入力全てを整数に変換したものの配列を受け取る def LI(): return list(map(int, sys.stdin.readline().split()...
import sys import math from collections import Counter import itertools import fractions #from functools import reduce # 入力を整数に変換して受け取る def II(): return int(sys.stdin.readline()) def MI(): return map(int, sys.stdin.readline().split()) # 入力全てを整数に変換したものの配列を受け取る def LI(): return list(map(int, sys.stdin.readline().split()...
[["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
240
a,b,c,k=map(int, input().split()) sum = 0 end = False if a < k: sum+=a k-=a else: sum=a end=True if end==False and b < k: k-=b else: end=True if end==False: sum-=k print(sum)
a,b,c,k=map(int, input().split()) sum = 0 end = False if a < k: sum+=a k-=a else: sum=k end=True if end==False and b < k: k-=b else: end=True if end==False: sum-=k print(sum)
[["-", 75, 76, 8, 196, 0, 1, 0, 662, 12, 22], ["+", 75, 76, 8, 196, 0, 1, 0, 662, 12, 22]]
5
74