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; 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 << k << endl; else cout << a - (k - (a + b)) << endl; }
#include <bits/stdc++.h> using namespace std; int main() { long long int a, b, c, k; cin >> a >> b >> c >> k; if (k <= a) cout << k << endl; else if (k <= (a + b)) cout << a << endl; else 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
79
#include <algorithm> #include <climits> #include <cmath> #include <cstdio> #include <iomanip> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <utility> #include <vector> u...
#include <algorithm> #include <climits> #include <cmath> #include <cstdio> #include <iomanip> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <utility> #include <vector> u...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22]]
1
229
// This program is written by Brian Peng. #pragma GCC optimize("Ofast", "inline", "no-stack-protector") #include <bits/stdc++.h> using namespace std; #define int long long #define Rd(a) (a = rd()) #define Gc(a) (a = getchar()) #define Pc(a) putchar(a) int rd() { int x; char c(getchar()); bool k; while (!isdigit...
// This program is written by Brian Peng. #pragma GCC optimize("Ofast", "inline", "no-stack-protector") #include <bits/stdc++.h> using namespace std; #define int long long #define Rd(a) (a = rd()) #define Gc(a) (a = getchar()) #define Pc(a) putchar(a) int rd() { int x; char c(getchar()); bool k; while (!isdigit...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
356
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int maxn = 1e6 + 5; vector<ll> V; int pre[maxn], a[maxn], b[maxn]; int main() { int a, b, c, k; 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; typedef long long ll; const int maxn = 1e6 + 5; vector<ll> V; int pre[maxn], a[maxn], b[maxn]; int main() { int a, b, c, k; cin >> a >> b >> c >> k; if (k <= a + b) { cout << min(a, k) << 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
104
def main(): import sys input = sys.stdin.readline A, B, C, K = map(int, input().split()) if K <= A+B: print(A) else: print(A-(K-A-B)) if __name__ == '__main__': main()
def main(): import sys input = sys.stdin.readline A, B, C, K = map(int, input().split()) if K <= A+B: print(min(A,K)) else: print(A-(K-A-B)) if __name__ == '__main__': main()
[["+", 0, 1, 0, 652, 3, 4, 0, 652, 63, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 21], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
69
# -*- coding: utf-8 -*- A, B, C, K = [int(i) for i in input().split()] if K <= A: print(K) elif k <= A+B: print(A) else: print((K-(A+B))*(-1)+A)
# -*- coding: utf-8 -*- A, B, C, K = [int(i) for i in input().split()] if K <= A: print(K) elif K <= A+B: print(A) else: print((K-(A+B))*(-1)+A)
[["-", 0, 656, 0, 57, 75, 665, 15, 666, 0, 22], ["+", 0, 656, 0, 57, 75, 665, 15, 666, 0, 22]]
5
66
#include <bits/stdc++.h> using namespace std; #define li long long int #define rep(i, to) for (li i = 0; i < ((li)(to)); i++) #define repp(i, start, to) for (li i = (li)(start); i < ((li)(to)); i++) #define pb push_back #define sz(v) ((li)(v).size()) #define bgn(v) ((v).begin()) #define eend(v) ((v).end()) #define all...
#include <bits/stdc++.h> using namespace std; #define li long long int #define rep(i, to) for (li i = 0; i < ((li)(to)); i++) #define repp(i, start, to) for (li i = (li)(start); i < ((li)(to)); i++) #define pb push_back #define sz(v) ((li)(v).size()) #define bgn(v) ((v).begin()) #define eend(v) ((v).end()) #define all...
[["+", 0, 14, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 17, 110], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
423
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; i < (n); i++) #define rrep(i, n) for (int i = (n - 1); i >= 0; i--) #define all(n) n.begin(), n.end() #define print(n) cout << n << endl ll mods = 1000000007; int main() { cin.tie(0); ios_base::sync_with_stdio(fa...
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; i < (n); i++) #define rrep(i, n) for (int i = (n - 1); i >= 0; i--) #define all(n) n.begin(), n.end() #define print(n) cout << n << endl ll mods = 1000000007; int main() { cin.tie(0); ios_base::sync_with_stdio(fa...
[["-", 0, 57, 64, 1, 0, 2, 3, 4, 0, 22], ["+", 0, 57, 64, 1, 0, 2, 3, 4, 0, 22]]
1
127
#include <bits/stdc++.h> using namespace std; #define mp make_pair #define pb(x) push_back(x) #define vi vector<int> #define vs vector<string> #define vll vector<long long> #define vc vector<char> #define vs vector<string> #define pii pair<int, int> #define pll pair<long long, long long> #define pil pair<int, long long...
#include <bits/stdc++.h> using namespace std; #define mp make_pair #define pb(x) push_back(x) #define vi vector<int> #define vs vector<string> #define vll vector<long long> #define vc vector<char> #define vs vector<string> #define pii pair<int, int> #define pll pair<long long, long long> #define pil pair<int, long long...
[["+", 0, 1, 0, 16, 31, 16, 12, 2, 63, 22], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 24], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 22], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 21], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 25]]
1
276
#include <algorithm> #include <bitset> #include <cmath> #include <cstring> #include <ctime> #include <deque> #include <fstream> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <random> #include <set> #include <stack> #include <unordered_map> #include <unordered_set> //#include <ext/pb_ds...
#include <algorithm> #include <bitset> #include <cmath> #include <cstring> #include <ctime> #include <deque> #include <fstream> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <random> #include <set> #include <stack> #include <unordered_map> #include <unordered_set> //#include <ext/pb_ds...
[["+", 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, 21], ["+", 64, 1, 0, 16, 12, 2, 3, 4, 0, 22], ["+", 64, 1, 0, 16, 12, 2, 3, 4, 0, 25]]
1
341
def main(): a,b,c,k = map(int,input().split()) if a>=k: print(a) else: k = k-a if b>=k: print(a) else: k = k-b print(a-k) if __name__ == "__main__": main()
def main(): a,b,c,k = map(int,input().split()) if a>=k: print(k) else: k = k-a if b>=k: print(a) else: k = k-b print(a-k) 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
73
A,B,C,K = map(int,input().split(' ')) cnt=0 if K < A : cnt=A*K elif K < A+B: cnt=A else: cnt=A-(K-(A+B)) print(cnt)
A,B,C,K = map(int,input().split(' ')) cnt=0 if K < A : cnt=K elif K < A+B: cnt=A else: cnt=A-(K-(A+B)) print(cnt)
[["-", 64, 196, 0, 1, 0, 662, 12, 657, 31, 22], ["-", 64, 196, 0, 1, 0, 662, 12, 657, 17, 48]]
5
65
#include <algorithm> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; #define mod 1000000007 #define ten5 100005 #define ten52 200005 #define ten6 1000005 #define PI 3.14159...
#include <algorithm> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; #define mod 1000000007 #define ten5 100005 #define ten52 200005 #define ten6 1000005 #define PI 3.14159...
[["-", 8, 9, 0, 57, 64, 1, 0, 16, 12, 22], ["+", 8, 9, 0, 57, 64, 1, 0, 16, 12, 22]]
1
200
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <set> #include <vector> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; long long ans = 0; if (k >= a) { k -= a; ans += a; } else { ans += k; k = 0; } if (k >= b) { k -= b; ...
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <set> #include <vector> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; long long ans = 0; if (k >= a) { k -= a; ans += a; } else { ans += k; k = 0; } if (k >= b) { k -= b; ...
[["+", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 110], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35]]
1
122
a, b, c, k = map(int,input().split()) score = 0 if a >= k: score = k if a + b >= k: score = a if a + b < k: score = a - (k - (a + b)) print(score)
a, b, c, k = map(int,input().split()) score = 0 if a >= k: score = k elif a + b >= k: score = a elif a + b < k: score = a - (k - (a + b)) print(score)
[["-", 36, 36, 36, 36, 0, 656, 0, 57, 0, 121], ["+", 36, 36, 0, 656, 0, 57, 75, 665, 0, 683]]
5
65
//--- pB ---// import java.io.*; import java.lang.*; import java.util.*; public class Main { public static void main(String[] args) throws java.lang.Exception { new Solution(); } } class Solution { Reader reader; PrintWriter out; public Solution() { reader = new Reader(); out = new PrintWriter(Sys...
//--- pB ---// import java.io.*; import java.lang.*; import java.util.*; public class Main { public static void main(String[] args) throws java.lang.Exception { new Solution(); } } class Solution { Reader reader; PrintWriter out; public Solution() { reader = new Reader(); out = new PrintWriter(Sys...
[["-", 0, 57, 64, 196, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 11, 12, 22]]
3
426
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (ll i = 0; i < n; i++) #define all(v) v.begin(), v.end() typedef long long ll; typedef pair<ll, ll> P; typedef vector<ll> vec; typedef vector<vec> mat; int main() { ll a, b, c, k; cin >> a >> b >> c >> k; ll ans = 0; ans += min(a, k); k -= a;...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (ll i = 0; i < n; i++) #define all(v) v.begin(), v.end() typedef long long ll; typedef pair<ll, ll> P; typedef vector<ll> vec; typedef vector<vec> mat; int main() { ll a, b, c, k; cin >> a >> b >> c >> k; ll ans = 0; ans += min(a, k); k -= a;...
[["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
112
A, B, C, K = map(int, input().split()) if(K <= A): print(A) elif(K <= A+B): print(A) else: print(A-(K-A-B))
A, B, C, K = map(int, input().split()) if(K <= A): print(K) elif(K <= A+B): print(A) else: print(A-(K-A-B))
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
58
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> P; #define rep(i, n) for (int i = 0; i < (int)(n); ++i) #define all(x) (x).begin(), (x).end() template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } template <class T> i...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> P; #define rep(i, n) for (int i = 0; i < (int)(n); ++i) #define all(x) (x).begin(), (x).end() template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } template <class T> i...
[["-", 8, 9, 0, 57, 64, 1, 0, 11, 12, 22], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 12, 22]]
1
192
/* ---------- STL Libraries ---------- */ // IO library #include <cstdio> #include <fstream> #include <iomanip> #include <ios> #include <iostream> // algorithm library #include <algorithm> #include <cassert> #include <cmath> #include <cstring> #include <numeric> #include <random> // container library #include <arra...
/* ---------- STL Libraries ---------- */ // IO library #include <cstdio> #include <fstream> #include <iomanip> #include <ios> #include <iostream> // algorithm library #include <algorithm> #include <cassert> #include <cmath> #include <cstring> #include <numeric> #include <random> // container library #include <arra...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
310
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) #define rrep(i, n) for (int i = n - 1; i >= 0; i--) using namespace std; using Graph = vector<vector<int>>; #define MOD 1000000007 #define MOD2 998244353 #define INF ((1 << 30) - 1) #define LINF (1LL << 60) #define EPS (1e-10) typedef long long ll; ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) #define rrep(i, n) for (int i = n - 1; i >= 0; i--) using namespace std; using Graph = vector<vector<int>>; #define MOD 1000000007 #define MOD2 998244353 #define INF ((1 << 30) - 1) #define LINF (1LL << 60) #define EPS (1e-10) typedef long long ll; ...
[["+", 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, 21], ["+", 64, 1, 0, 11, 12, 2, 3, 4, 0, 22], ["+", 64, 1, 0, 11, 12, 2, 3, 4, 0, 25]]
1
126
#include <bits/stdc++.h> using namespace std; #define REP(i, start, count) for (int i = (start); i < (int)(count); ++i) #define rep(i, count) REP(i, 0, count) #define ALLOF(c) (c).begin(), (c).end() typedef long long ll; typedef unsigned long long ull; typedef vector<int> veci; typedef vector<long long> vecll; typede...
#include <bits/stdc++.h> using namespace std; #define REP(i, start, count) for (int i = (start); i < (int)(count); ++i) #define rep(i, count) REP(i, 0, count) #define ALLOF(c) (c).begin(), (c).end() typedef long long ll; typedef unsigned long long ull; typedef vector<int> veci; typedef vector<long long> vecll; typede...
[["-", 0, 11, 12, 16, 12, 2, 3, 4, 0, 22], ["+", 0, 11, 12, 16, 12, 2, 3, 4, 0, 22]]
1
152
#include <bits/stdc++.h> #define ll long long #define F first #define FF first.first #define FS first.second #define S second #define pb push_back using namespace std; const int N = 1000006, INF = 1e16; ll n, q = 1, m, a[N], b[N], f[N], o, k, t, x, y, z, u, h, mx, mn, ans, Ans; pair<ll, ll> p[N]; string s, S; vector<i...
#include <bits/stdc++.h> #define ll long long #define F first #define FF first.first #define FS first.second #define S second #define pb push_back using namespace std; const int N = 1000006, INF = 1e16; ll n, q = 1, m, a[N], b[N], f[N], o, k, t, x, y, z, u, h, mx, mn, ans, Ans; pair<ll, ll> p[N]; string s, S; vector<i...
[["+", 64, 9, 0, 1, 0, 16, 12, 2, 63, 22], ["+", 0, 1, 0, 16, 12, 2, 3, 4, 0, 24], ["+", 0, 1, 0, 16, 12, 2, 3, 4, 0, 21], ["+", 0, 1, 0, 16, 12, 2, 3, 4, 0, 22], ["+", 0, 1, 0, 16, 12, 2, 3, 4, 0, 25]]
1
183
import bisect,collections,copy,heapq,itertools,math,string import sys def S(): return sys.stdin.readline().rstrip() def M(): return map(int,sys.stdin.readline().rstrip().split()) def I(): return int(sys.stdin.readline().rstrip()) def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) def LS(): return lis...
import bisect,collections,copy,heapq,itertools,math,string import sys def S(): return sys.stdin.readline().rstrip() def M(): return map(int,sys.stdin.readline().rstrip().split()) def I(): return int(sys.stdin.readline().rstrip()) def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) def LS(): return lis...
[["-", 75, 76, 8, 196, 0, 1, 0, 662, 12, 22], ["+", 75, 76, 8, 196, 0, 1, 0, 662, 12, 22]]
5
177
#include <bits/stdc++.h> using namespace std; #define int long long #define rep(i, n) for (int i = 0; i < (n); ++i) #define REP(i, d, n) for (int i = (d); i < (n); ++i) #define all(v) v.begin(), v.end() using P = pair<int, int>; signed main() { int a, b, c, k; cin >> a >> b >> c >> k; if (k <= a) { cout <<...
#include <bits/stdc++.h> using namespace std; #define int long long #define rep(i, n) for (int i = 0; i < (n); ++i) #define REP(i, d, n) for (int i = (d); i < (n); ++i) #define all(v) v.begin(), v.end() using P = pair<int, int>; signed main() { int a, b, c, k; cin >> a >> b >> c >> k; if (k <= a) { cout <<...
[["-", 31, 16, 12, 16, 12, 23, 0, 16, 12, 22], ["+", 12, 16, 12, 23, 0, 16, 12, 23, 0, 24], ["+", 12, 23, 0, 16, 12, 23, 0, 16, 31, 22], ["+", 12, 23, 0, 16, 12, 23, 0, 16, 17, 72], ["+", 12, 23, 0, 16, 12, 23, 0, 16, 12, 22], ["+", 12, 16, 12, 23, 0, 16, 12, 23, 0, 25]]
1
117
A, B, C, K = [int(x) for x in input().split()] if K <= A + B: print(A) else: numC = K - A - B print(A - numC)
A, B, C, K = [int(x) for x in input().split()] if K <= A + B: print(min(K, A)) else: numC = K - A - B print(A - numC)
[["+", 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
50
#B a,b,c,k = map(int,input().split()) cnt = 0 if a <= k: cnt += a k -= a if b <= k: k -= b if k > 0: cnt -= k else: cnt += a print(cnt)
#B a,b,c,k = map(int,input().split()) cnt = 0 if a <= k: cnt += a k -= a if b <= k: k -= b if k > 0: cnt -= k else: cnt += k print(cnt)
[["-", 75, 76, 8, 196, 0, 1, 0, 677, 12, 22], ["+", 75, 76, 8, 196, 0, 1, 0, 677, 12, 22]]
5
60
#include <iostream> using namespace std; using ll = long long; int main() { ll a, b, c, k; cin >> a >> b >> c >> k; if (k <= a) cout << a; else if (k <= a + b) cout << a; else cout << a - (k - a - b); return 0; }
#include <iostream> using namespace std; using ll = long long; int main() { ll a, b, c, k; cin >> a >> b >> c >> k; if (k <= a) cout << k; else if (k <= a + b) cout << a; else cout << a - (k - a - b); return 0; }
[["-", 8, 9, 0, 57, 64, 1, 0, 16, 12, 22], ["+", 8, 9, 0, 57, 64, 1, 0, 16, 12, 22]]
1
76
#include <bits/stdc++.h> #define int long long #define f first #define s second using namespace std; int32_t main() { ios::sync_with_stdio(0), cin.tie(0); int a, b, c, k; cin >> a >> b >> c >> k; int sum = 0; sum += min(a, k); k -= min(a, k); sum += 0 * min(a, k); k -= min(a, k); sum += -1 * min(a, k)...
#include <bits/stdc++.h> #define int long long #define f first #define s second using namespace std; int32_t main() { ios::sync_with_stdio(0), cin.tie(0); int a, b, c, k; cin >> a >> b >> c >> k; int sum = 0; sum += min(a, k); k -= min(a, k); sum += 0 * min(b, k); k -= min(b, k); sum += -1 * min(c, k)...
[["-", 0, 11, 12, 16, 12, 2, 3, 4, 0, 22], ["+", 0, 11, 12, 16, 12, 2, 3, 4, 0, 22], ["-", 0, 1, 0, 11, 12, 2, 3, 4, 0, 22], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 22]]
1
121
#include <algorithm> #include <bitset> #include <cctype> #include <cmath> #include <cstdio> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <vector> using namespace std; #define REP(i, n) for (int i = 0; i < (int)(n); i++) #define RREP(...
#include <algorithm> #include <bitset> #include <cctype> #include <cmath> #include <cstdio> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <vector> using namespace std; #define REP(i, n) for (int i = 0; i < (int)(n); i++) #define RREP(...
[["-", 0, 1, 0, 11, 12, 2, 3, 4, 0, 22], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 22]]
1
346
#include <bits/stdc++.h> #include <math.h> using namespace std; long long inf = 1000000007; int main() { long long a, b, c, k; cin >> a >> b >> c >> k; long long ans = 0; if (a >= k) { ans += a; } else { ans += a; k -= a; if (b >= k) { } else { k -= b; ans -= k; } } ...
#include <bits/stdc++.h> #include <math.h> using namespace std; long long inf = 1000000007; int main() { long long a, b, c, k; cin >> a >> b >> c >> k; long long ans = 0; if (a >= k) { ans += k; } else { ans += a; k -= a; if (b >= k) { } else { k -= b; ans -= k; } } ...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22]]
1
97
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) #define rrep(i, n) for (int i = (n)-1; i >= 0; i--) #define rep1(i, n) for (int i = 1; i <= (n); i++) #define rrep1(i, n) for (int i = (n); i > 0; i--) #define ll long long #define pi pair<int, int> #define pll pair<ll, ll> #define MOD 10000000...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) #define rrep(i, n) for (int i = (n)-1; i >= 0; i--) #define rep1(i, n) for (int i = 1; i <= (n); i++) #define rrep1(i, n) for (int i = (n); i > 0; i--) #define ll long long #define pi pair<int, int> #define pll pair<ll, ll> #define MOD 10000000...
[["-", 75, 76, 0, 57, 64, 1, 0, 16, 12, 22], ["+", 75, 76, 0, 57, 64, 1, 0, 16, 12, 22]]
1
144
#include <bits/stdc++.h> using namespace std; typedef long long int ll; const int INF = 1 << 30; const long long LINF = 1LL << 60; const long long MOD = (long long)1e9 + 7; int main() { int a, b, c, k, ans = 0; cin >> a >> b >> c >> k; if (a + b >= k) { ans = a; } else { ans = a - (k - (a + b)); } ...
#include <bits/stdc++.h> using namespace std; typedef long long int ll; const int INF = 1 << 30; const long long LINF = 1LL << 60; const long long MOD = (long long)1e9 + 7; int main() { int a, b, c, k, ans = 0; cin >> a >> b >> c >> k; if (a + b >= k) { ans = min(a, k); } else { ans = a - (k - (a + b...
[["+", 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
111
a,b,c,k=(int(i) for i in input().split()) if k<=a+b: print(a) else: print(a-(k-a-b))
a,b,c,k=(int(i) for i in 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, 21], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
49
a, b, c, k = map(int, input().split()) if a >= k: print(a) else: if a + b >= k: print(a) else: t = k - (a + b) print(a - t)
a, b, c, k = map(int, input().split()) if a >= k: print(k) else: if a + b >= k: print(a) else: t = k - (a + b) print(a - t)
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
59
#include <bits/stdc++.h> using namespace std; #define _overload3(_1, _2, _3, name, ...) name #define _rep(i, n) repi(i, 0, n) #define repi(i, a, b) for (int i = int(a); i < int(b); ++i) #define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__) typedef long long ll; typedef pair<ll, ll> P; const ll INF = 1LL...
#include <bits/stdc++.h> using namespace std; #define _overload3(_1, _2, _3, name, ...) name #define _rep(i, n) repi(i, 0, n) #define repi(i, a, b) for (int i = int(a); i < int(b); ++i) #define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__) typedef long long ll; typedef pair<ll, ll> P; const ll INF = 1LL...
[["+", 0, 16, 31, 16, 12, 16, 31, 2, 63, 22], ["+", 31, 16, 12, 16, 31, 2, 3, 4, 0, 24], ["+", 31, 16, 12, 16, 31, 2, 3, 4, 0, 21], ["+", 31, 16, 12, 16, 31, 2, 3, 4, 0, 22], ["+", 31, 16, 12, 16, 31, 2, 3, 4, 0, 25]]
1
290
// Created by ... #include <bits/stdc++.h> #define db1(x) cout << #x << "=" << x << '\n' #define db2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << '\n' #define db3(x, y, z) \ cout << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z ...
// Created by ... #include <bits/stdc++.h> #define db1(x) cout << #x << "=" << x << '\n' #define db2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << '\n' #define db3(x, y, z) \ cout << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z ...
[["+", 64, 9, 0, 1, 0, 16, 12, 2, 63, 22], ["+", 0, 1, 0, 16, 12, 2, 3, 4, 0, 24], ["+", 0, 1, 0, 16, 12, 2, 3, 4, 0, 21], ["+", 0, 1, 0, 16, 12, 2, 3, 4, 0, 22], ["+", 0, 1, 0, 16, 12, 2, 3, 4, 0, 25]]
1
348
#include <bits/stdc++.h> using namespace std; #define fast \ ios_base::sync_with_stdio(0); \ cin.tie(NULL); \ cout.tie(NULL); #define fr(i,...
#include <bits/stdc++.h> using namespace std; #define fast \ ios_base::sync_with_stdio(0); \ cin.tie(NULL); \ cout.tie(NULL); #define fr(i,...
[["+", 0, 1, 0, 16, 31, 16, 12, 2, 63, 22], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 24], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 22], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 21], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 25]]
1
297
a, b, c, k = map(int,input().split()) if k <= a: print(k) elif k <= a + b: print(a) else: print(a-(c-(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, 31, 22], ["-", 3, 4, 0, 657, 12, 23, 0, 657, 17, 33], ["-", 0, 657, 12, 23, 0, 657, 12, 23, 0, 24], ["-", 0, 657, 12, 23, 0, 657, 12, 23, 0, 25]]
5
58
#include <bits/stdc++.h> using namespace std; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } long long a, b, c, k; int main() { cin >...
#include <bits/stdc++.h> using namespace std; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } long long a, b, c, k; int main() { cin >...
[["-", 0, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 0, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
193
#include <bits/stdc++.h> #include <math.h> #include <stdio.h> using namespace std; using vi = vector<int>; using vll = vector<long long int>; using vb = vector<bool>; using vvi = vector<vector<int>>; using vvll = vector<vector<long long int>>; using ll = long long int; int main() { ll A, B, C, K; cin >> A >> B >> ...
#include <bits/stdc++.h> #include <math.h> #include <stdio.h> using namespace std; using vi = vector<int>; using vll = vector<long long int>; using vb = vector<bool>; using vvi = vector<vector<int>>; using vvll = vector<vector<long long int>>; using ll = long long int; int main() { ll A, B, C, K; cin >> A >> B >> ...
[["-", 0, 57, 64, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 16, 12, 22]]
1
134
#define _CRT_SECURE_NO_WARNINGS #include <bits/stdc++.h> #include <chrono> #include <random> //#include <ext/pb_ds/tree_policy.hpp> //#include <ext/pb_ds/assoc_container.hpp> #define _ << " " << #define all(v) v.begin(), v.end() #define sp(n) fixed << setprecision(n) #define ff first #define ss second using namespace...
#define _CRT_SECURE_NO_WARNINGS #include <bits/stdc++.h> #include <chrono> #include <random> //#include <ext/pb_ds/tree_policy.hpp> //#include <ext/pb_ds/assoc_container.hpp> #define _ << " " << #define all(v) v.begin(), v.end() #define sp(n) fixed << setprecision(n) #define ff first #define ss second using namespace...
[["+", 0, 16, 31, 16, 12, 16, 31, 2, 63, 22], ["+", 31, 16, 12, 16, 31, 2, 3, 4, 0, 24], ["+", 31, 16, 12, 16, 31, 2, 3, 4, 0, 21], ["+", 31, 16, 12, 16, 31, 2, 3, 4, 0, 22], ["+", 31, 16, 12, 16, 31, 2, 3, 4, 0, 25], ["-", 31, 16, 12, 16, 12, 23, 0, 16, 17, 72], ["+", 31, 16, 12, 16, 12, 23, 0, 16, 17, 33]]
1
167
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; i++) #define RFOR(i, a, n) for (ll i = (ll)n - 1; i >= (ll)a; i--) #define rep(i, n) FOR(i, 0, n) #define rrep(i, n) RFOR(i, 0, n) #define ALL(v) v.begin(), v.end() #define bra(first, second) '(' << fi...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; i++) #define RFOR(i, a, n) for (ll i = (ll)n - 1; i >= (ll)a; i--) #define rep(i, n) FOR(i, 0, n) #define rrep(i, n) RFOR(i, 0, n) #define ALL(v) v.begin(), v.end() #define bra(first, second) '(' << fi...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
216
#include <iostream> using namespace std; int main() { int A, B, C, K; cin >> A >> B >> C >> K; if (A >= K) cout << A << endl; else { if (A + B >= K) cout << A << endl; else cout << A - (K - A - B) << endl; } }
#include <iostream> using namespace std; int main() { int A, B, C, K; cin >> A >> B >> C >> K; if (A >= K) cout << K << endl; else { if (A + B >= K) cout << A << endl; else cout << A - (K - A - B) << endl; } }
[["-", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22], ["+", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22]]
1
75
#include <bits/stdc++.h> #define _GLIBCXX_DEBUG #define rng(i, a, b) for (int i = int(a); i < int(b); i++) #define rep(i, b) rng(i, 0, b) #define gnr(i, a, b) for (int i = int(b) - 1; i >= int(a); i--) #define per(i, b) gnr(i, 0, b) #define bg begin() #define ed end() #define all(x) x.bg, x.ed #define pb push_back #def...
#include <bits/stdc++.h> #define _GLIBCXX_DEBUG #define rng(i, a, b) for (int i = int(a); i < int(b); i++) #define rep(i, b) rng(i, 0, b) #define gnr(i, a, b) for (int i = int(b) - 1; i >= int(a); i--) #define per(i, b) gnr(i, 0, b) #define bg begin() #define ed end() #define all(x) x.bg, x.ed #define pb push_back #def...
[["-", 0, 43, 49, 50, 51, 2, 3, 4, 0, 22], ["+", 0, 43, 49, 50, 51, 2, 3, 4, 0, 22]]
1
448
#include "bits/stdc++.h" /* Properties of modulo: (a/b)%m ,where m is prime = (a%m) * (b^(m-2))%m */ /*ROLLING HASH Rabin-Karp algorithm for pattern matching in a string in O(n) time Calculating the number of different substrings of a string in O(n2logn) Calculating the number of palindromic substrings in a st...
#include "bits/stdc++.h" /* Properties of modulo: (a/b)%m ,where m is prime = (a%m) * (b^(m-2))%m */ /*ROLLING HASH Rabin-Karp algorithm for pattern matching in a string in O(n) time Calculating the number of different substrings of a string in O(n2logn) Calculating the number of palindromic substrings in a st...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["-", 75, 76, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 75, 76, 0, 57, 15, 339, 51, 16, 17, 20]]
1
359
#include <algorithm> #include <array> #include <bitset> #include <cassert> #include <cfloat> #include <climits> #include <cmath> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_map> #inclu...
#include <algorithm> #include <array> #include <bitset> #include <cassert> #include <cfloat> #include <climits> #include <cmath> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_map> #inclu...
[["-", 0, 1, 0, 11, 12, 2, 3, 4, 0, 22], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 22], ["-", 0, 14, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 31, 22]]
1
2,678
#include <bits/stdc++.h> using namespace std; #define FAST \ ios::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0); typedef long lo...
#include <bits/stdc++.h> using namespace std; #define FAST \ ios::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0); typedef long lo...
[["-", 0, 1, 0, 11, 12, 2, 3, 4, 0, 22], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 22]]
1
298
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using P = pair<ll, ll>; #define rep(i, n) for (int(i) = 0; (i) < (n); (i)++) #define rep2(i, m, n) for (int(i) = (m); (i) < (n); (i)++) #define ALL(obj) (obj).begin(), (obj).end() #define rALL(obj) (obj).rbegin(), (obj).rend() c...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using P = pair<ll, ll>; #define rep(i, n) for (int(i) = 0; (i) < (n); (i)++) #define rep2(i, m, n) for (int(i) = (m); (i) < (n); (i)++) #define ALL(obj) (obj).begin(), (obj).end() #define rALL(obj) (obj).rbegin(), (obj).rend() c...
[["+", 64, 9, 0, 1, 0, 16, 12, 2, 63, 22], ["+", 0, 1, 0, 16, 12, 2, 3, 4, 0, 24], ["+", 0, 1, 0, 16, 12, 2, 3, 4, 0, 22], ["+", 0, 1, 0, 16, 12, 2, 3, 4, 0, 21], ["+", 0, 1, 0, 16, 12, 2, 3, 4, 0, 25]]
1
145
/* Simplicity and Goodness */ #include <bits/stdc++.h> using namespace std; #define scn(n) scanf("%d", &n) #define lscn(n) scanf("%lld", &n) #define lpri(n) printf("%lld ", n) #define pri(n) printf("%d ", (int)n) #define prin(n) printf("%d\n", (int)n) #define lprin(n) printf("%lld\n", n) #define deb(x) cout << #x << '...
/* Simplicity and Goodness */ #include <bits/stdc++.h> using namespace std; #define scn(n) scanf("%d", &n) #define lscn(n) scanf("%lld", &n) #define lpri(n) printf("%lld ", n) #define pri(n) printf("%d ", (int)n) #define prin(n) printf("%d\n", (int)n) #define lprin(n) printf("%lld\n", n) #define deb(x) cout << #x << '...
[["+", 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
181
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int a, b, c, k; cin >> a >> b >> c >> k; if (k <= a) { cout << a; return 0; } if (k <= a + b) { cout << a; return 0; } cout << a - (k - b - a); ...
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int a, b, c, k; cin >> a >> b >> c >> k; if (k <= a) { cout << k; return 0; } if (k <= a + b) { cout << a; return 0; } cout << a - (k - b - a); ...
[["-", 0, 57, 64, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 16, 12, 22]]
1
105
#include <bits/stdc++.h> // edit by  (xcode) using namespace std; #define int long long #define ll long long #define double long double #define pb push_back #define in insert #define mp make_pair #define f first #define s second //#define x first //#define y second #define all(el) el.begin(), el...
#include <bits/stdc++.h> // edit by  (xcode) using namespace std; #define int long long #define ll long long #define double long double #define pb push_back #define in insert #define mp make_pair #define f first #define s second //#define x first //#define y second #define all(el) el.begin(), el...
[["+", 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
202
#include <bits/stdc++.h> using namespace std; typedef long long int ll; const ll mod = 1e9 + 7; const ll mod1 = 998244353; const ll inf = 9e18 + 5; #define rep(i, a, b) for (ll i = a; i < b; i++) void swap(ll &a, ll &b) { ll t = a; a = b; b = t; } ll min(ll a, ll b) { if (a < b) return a; return b; } l...
#include <bits/stdc++.h> using namespace std; typedef long long int ll; const ll mod = 1e9 + 7; const ll mod1 = 998244353; const ll inf = 9e18 + 5; #define rep(i, a, b) for (ll i = a; i < b; i++) void swap(ll &a, ll &b) { ll t = a; a = b; b = t; } ll min(ll a, ll b) { if (a < b) return a; return b; } l...
[["+", 0, 9, 0, 1, 0, 16, 12, 2, 63, 22], ["+", 0, 1, 0, 16, 12, 2, 3, 4, 0, 24], ["+", 0, 1, 0, 16, 12, 2, 3, 4, 0, 21], ["+", 0, 1, 0, 16, 12, 2, 3, 4, 0, 22], ["+", 0, 1, 0, 16, 12, 2, 3, 4, 0, 25]]
1
1,158
# frozen_string_literal: true a, b, c, k = gets.split.map(&:to_i) if a + b >= k puts a else puts a - (k - a - b) end
# frozen_string_literal: true a, b, c, k = gets.split.map(&:to_i) if a + b >= k puts [k, a].min else puts a - (k - a - b) end
[["+", 0, 652, 3, 4, 0, 652, 486, 516, 0, 70], ["+", 0, 652, 3, 4, 0, 652, 486, 516, 0, 22], ["+", 0, 652, 3, 4, 0, 652, 486, 516, 0, 21], ["+", 0, 652, 3, 4, 0, 652, 486, 516, 0, 73], ["+", 64, 749, 0, 652, 3, 4, 0, 652, 17, 131], ["+", 64, 749, 0, 652, 3, 4, 0, 652, 735, 22]]
4
38
#include <bits/stdc++.h> #define FAST \ ios_base::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0); using namespace std; // long long int...
#include <bits/stdc++.h> #define FAST \ ios_base::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0); using namespace std; // long long int...
[["+", 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
282
A, B, C, K = map(int, input().split()) if A >= K: print(A) elif B >= K-A: print(A) else: print(A-(K-A-B))
A, B, C, K = map(int, input().split()) if A >= K: print(K) elif 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
54
def ma(): return map(int,input().split()) y="Yes" t="No" a,b,c,k=ma() if a+b<=k: print(min(a,k)) else: print(a-(k-a-b))
def ma(): return map(int,input().split()) y="Yes" t="No" a,b,c,k=ma() if a+b>=k: print(min(a,k)) else: print(a-(k-a-b))
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 19], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20]]
5
69
#include <bits/stdc++.h> #define MOD 1000000007 // #define INF 1000000000000 using namespace std; typedef unsigned long long ull; typedef long long ll; template <class T> ostream &operator<<(ostream &o, const vector<T> &obj) { o << "["; for (int i = 0; i < (int)obj.size(); ++i) o << (i > 0 ? ", " : "") << ob...
#include <bits/stdc++.h> #define MOD 1000000007 // #define INF 1000000000000 using namespace std; typedef unsigned long long ull; typedef long long ll; template <class T> ostream &operator<<(ostream &o, const vector<T> &obj) { o << "["; for (int i = 0; i < (int)obj.size(); ++i) o << (i > 0 ? ", " : "") << ob...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
708
/* これを入れて実行 g++ code.cpp ./a.out */ #include <algorithm> #include <bitset> #include <cmath> #include <cstring> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <string> #include <...
/* これを入れて実行 g++ code.cpp ./a.out */ #include <algorithm> #include <bitset> #include <cmath> #include <cstring> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <string> #include <...
[["+", 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
491
#include <algorithm> #include <climits> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <vector> using namespace std; typedef long long ll; int main() { ll a, b, c, k; cin >> a >> b >> c >> k; if (k <= a + b) { cout << a << endl...
#include <algorithm> #include <climits> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <vector> using namespace std; typedef long long ll; int main() { ll a, b, c, k; cin >> a >> b >> c >> k; if (k <= a + b) { cout << min(a, k)...
[["+", 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
87
A,B,C,K=map(int,input().split()) print(A if A+B>=K else A-(K-A-B))
A,B,C,K=map(int,input().split()) print(min(A,K) if A+B>=K else A-(K-A-B))
[["+", 0, 652, 3, 4, 0, 41, 0, 652, 63, 22], ["+", 3, 4, 0, 41, 0, 652, 3, 4, 0, 24], ["+", 3, 4, 0, 41, 0, 652, 3, 4, 0, 21], ["+", 3, 4, 0, 41, 0, 652, 3, 4, 0, 22], ["+", 3, 4, 0, 41, 0, 652, 3, 4, 0, 25]]
5
40
#include <bits/stdc++.h> using namespace std; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<bool> vb; typedef vector<vb> vvb; typedef vector<string> vs; typedef long long int ll; typedef unsigned long long int ull; typedef pair<int, int> pii; typedef vector<ll> vll; typedef vector<vll> vvll; typedef ve...
#include <bits/stdc++.h> using namespace std; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<bool> vb; typedef vector<vb> vvb; typedef vector<string> vs; typedef long long int ll; typedef unsigned long long int ull; typedef pair<int, int> pii; typedef vector<ll> vll; typedef vector<vll> vvll; typedef ve...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
385
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int a, b, c, k; cin >> a >> b >> c >> k; if (k <= a) { cout << a << '\n'; return 0; } int sum = a; k -= a; if (k <= b) { cout << sum << '\n'; return 0; } k -= b; sum -= k; cout...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int a, b, c, k; cin >> a >> b >> c >> k; if (k <= a) { cout << k << '\n'; return 0; } int sum = a; k -= a; if (k <= b) { cout << sum << '\n'; return 0; } k -= b; sum -= k; cout...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
108
import math, sys from bisect import bisect_left, bisect_right from collections import Counter, defaultdict, deque from copy import deepcopy from functools import lru_cache from heapq import heapify, heappop, heappush from itertools import accumulate, combinations, permutations input = sys.stdin.readline mod = 10**9 + 7...
import math, sys from bisect import bisect_left, bisect_right from collections import Counter, defaultdict, deque from copy import deepcopy from functools import lru_cache from heapq import heapify, heappop, heappush from itertools import accumulate, combinations, permutations input = sys.stdin.readline mod = 10**9 + 7...
[["+", 64, 196, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 21], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25]]
5
171
/* このコード、と~おれ! Be accepted! ∧_∧  (。・ω・。)つ━☆・*。 ⊂   ノ    ・゜+.  しーJ   °。+ *´¨)          .· ´¸.·*´¨) ¸.·*¨)           (¸.·´ (¸.·'* ☆ */ #include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <complex> #include <cstdio> #include <cstring> #include <functional> #include <ioma...
/* このコード、と~おれ! Be accepted! ∧_∧  (。・ω・。)つ━☆・*。 ⊂   ノ    ・゜+.  しーJ   °。+ *´¨)          .· ´¸.·*´¨) ¸.·*¨)           (¸.·´ (¸.·'* ☆ */ #include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <complex> #include <cstdio> #include <cstring> #include <functional> #include <ioma...
[["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
496
import sys def input(): return sys.stdin.readline().strip() sys.setrecursionlimit(20000000) def main(): A, B, C, K = map(int, input().split()) answer = 0 if K >= A: answer += A K -= A if K >= B: K -= B if K > 0: answer -= K else: ...
import sys def input(): return sys.stdin.readline().strip() sys.setrecursionlimit(20000000) def main(): A, B, C, K = map(int, input().split()) answer = 0 if K >= A: answer += A K -= A if K >= B: K -= B if K > 0: answer -= K else: ...
[["-", 75, 76, 8, 196, 0, 1, 0, 677, 12, 22], ["+", 75, 76, 8, 196, 0, 1, 0, 677, 12, 22]]
5
99
// Problem : B - Easy Linear Programming // Contest : AtCoder - AtCoder Beginner Contest 167 // URL : https://atcoder.jp/contests/abc167/tasks/abc167_b // Memory Limit : 1024 MB // Time Limit : 2000 ms // Powered by CP Editor (https://github.com/cpeditor/cpeditor) #include <bits/stdc++.h> using namespace std; typedef...
// Problem : B - Easy Linear Programming // Contest : AtCoder - AtCoder Beginner Contest 167 // URL : https://atcoder.jp/contests/abc167/tasks/abc167_b // Memory Limit : 1024 MB // Time Limit : 2000 ms // Powered by CP Editor (https://github.com/cpeditor/cpeditor) #include <bits/stdc++.h> using namespace std; typedef...
[["+", 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, 21], ["+", 64, 1, 0, 11, 12, 2, 3, 4, 0, 22], ["+", 64, 1, 0, 11, 12, 2, 3, 4, 0, 25]]
1
275
#include <bits/stdc++.h> using namespace std; #define fast \ ios_base::sync_with_stdio(false); \ cin.tie(0); \ cout.tie(0) #include <ext/pb_...
#include <bits/stdc++.h> using namespace std; #define fast \ ios_base::sync_with_stdio(false); \ cin.tie(0); \ cout.tie(0) #include <ext/pb_...
[["-", 0, 16, 31, 16, 12, 16, 31, 16, 17, 72], ["-", 0, 16, 31, 16, 12, 16, 31, 16, 12, 22]]
1
150
#include <iostream> using namespace std; int main() { long long A, B, C, K; cin >> A >> B >> C >> K; if (A <= K) cout << K << endl; else if (A + B <= K) cout << A << endl; else cout << 2 * A + B - K << endl; }
#include <iostream> using namespace std; int main() { long long A, B, C, K; cin >> A >> B >> C >> K; if (A >= K) cout << K << endl; else if (A + B >= K) cout << A << endl; else cout << 2 * A + B - K << endl; }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["-", 75, 76, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 75, 76, 0, 57, 15, 339, 51, 16, 17, 20]]
1
72
from sys import stdin, setrecursionlimit setrecursionlimit(10 ** 9) INF = 1 << 60 def input(): return stdin.readline().strip() def main(): A, B, C, K = map(int, input().split()) if K <= A: print(A) elif K <= A + B: print(A) else: print(A - (K - (A + B))) return if...
from sys import stdin, setrecursionlimit setrecursionlimit(10 ** 9) INF = 1 << 60 def input(): return stdin.readline().strip() def main(): 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))) return if...
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
104
#pragma GCC optimize("O2") #include <algorithm> #include <bitset> #include <cmath> #include <ctime> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <unordered_set> #include <vector> using namespace std; typedef long long ll; typedef long double ld; #define fastInp ...
#pragma GCC optimize("O2") #include <algorithm> #include <bitset> #include <cmath> #include <ctime> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <unordered_set> #include <vector> using namespace std; typedef long long ll; typedef long double ld; #define fastInp ...
[["-", 0, 14, 8, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 22]]
1
147
#include <bits/stdc++.h> #define IO_OP \ std::ios::sync_with_stdio(0); \ std::cin.tie(0); #define F first #define S second #define V vector #define PB push_back #define MP make_pair #define EB emplace_bac...
#include <bits/stdc++.h> #define IO_OP \ std::ios::sync_with_stdio(0); \ std::cin.tie(0); #define F first #define S second #define V vector #define PB push_back #define MP make_pair #define EB emplace_bac...
[["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 48], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 13], ["-", 8, 9, 0, 1, 0, 11, 12, 16, 17, 48], ["-", 8, 9, 0, 1, 0, 11, 12, 16, 12, 13]]
1
167
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> typedef long long ll; #define rep(i, n) for (int i = 0; i < (n); i++) #define pb push_back #define sz(a) (int)a.size() using namespace std; in...
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> typedef long long ll; #define rep(i, n) for (int i = 0; i < (n); i++) #define pb push_back #define sz(a) (int)a.size() using namespace std; in...
[["-", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22], ["+", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22]]
1
113
#include <algorithm> #include <cstdlib> #include <iostream> #include <queue> #include <string> #include <vector> using namespace std; #define rep(i, n) for (long int i = 0; i < n; i++) int main() { int a, b, c, k; cin >> a >> b >> c >> k; if (a < k && a + b >= k) cout << min(a, k) << endl; else cout ...
#include <algorithm> #include <cstdlib> #include <iostream> #include <queue> #include <string> #include <vector> using namespace std; #define rep(i, n) for (long int i = 0; i < n; i++) 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...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 18], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 12, 22], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["-", 15, 339, 51, 16, 12, 16, 31, 16, 31, 22]]
1
87
#include "bits/stdc++.h" using namespace std; #define rep(i, n) for (int(i) = 0; (i) < (n); (i)++) #define rep3(i, m, n) for (int(i) = m; (i) <= (n); (i)++) #define rep3rev(i, m, n) for (int(i) = m; (i) >= (n); (i)--) #define all(a) (a.begin()), (a.end()) #define rall(a) (a.rbegin()), (a.rend()) #define fi first #defi...
#include "bits/stdc++.h" using namespace std; #define rep(i, n) for (int(i) = 0; (i) < (n); (i)++) #define rep3(i, m, n) for (int(i) = m; (i) <= (n); (i)++) #define rep3rev(i, m, n) for (int(i) = m; (i) >= (n); (i)--) #define all(a) (a.begin()), (a.end()) #define rall(a) (a.rbegin()), (a.rend()) #define fi first #defi...
[["+", 31, 16, 12, 16, 12, 23, 0, 16, 17, 33], ["+", 31, 16, 12, 16, 12, 23, 0, 16, 12, 22]]
1
209
#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; #define rep(i, x) for (ll i = 0; i < (ll)(x); i++) #define rrep(i, x) for (ll i = (ll)(x)-1; 0 <= i; i--) #define reps(i, x) for (ll i = 1; i < (ll)(x) + 1; i++) #define rreps(i, x) for (ll i = (ll)(x); 1 <= i; i--) #define debug(x) cerr << #x << ": "...
#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; #define rep(i, x) for (ll i = 0; i < (ll)(x); i++) #define rrep(i, x) for (ll i = (ll)(x)-1; 0 <= i; i--) #define reps(i, x) for (ll i = 1; i < (ll)(x) + 1; i++) #define rreps(i, x) for (ll i = (ll)(x); 1 <= i; i--) #define debug(x) cerr << #x << ": "...
[["-", 8, 9, 0, 57, 64, 1, 0, 11, 12, 22], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 12, 22]]
1
229
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <random> #include <set> #include <vector> using namespace std; #define FAST_IO \ ios_base::sync_wit...
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <random> #include <set> #include <vector> using namespace std; #define FAST_IO \ ios_base::sync_wit...
[["-", 0, 14, 8, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 22], ["-", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22]]
1
190
A,B,C,K = map(int,input().split()) S = 0 S+=1*min(A,K) K-=A K-=B S-=1*min(C,K) print(S)
A,B,C,K = map(int,input().split()) S = 0 S+=1*min(A,K) K-=A K-=B S-=1*min(C,max(K,0)) print(S)
[["+", 12, 657, 12, 652, 3, 4, 0, 652, 63, 22], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 21], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 612], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
53
a, b, c, k = map(int, input().split()) ans = 0 if k >= a: k -= a ans += a if k >= b: k -= b if k >= c: k -= c ans -= c print(ans) else: print(ans - k) else: print(ans) else: print(a)
a, b, c, k = map(int, input().split()) ans = 0 if k >= a: k -= a ans += a if k >= b: k -= b if k >= c: k -= c ans -= c print(ans) else: print(ans - k) else: print(ans) else: print(k)
[["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
77
a, b, c, k = map(int, input().split()) ans = a - max(0, k - a - b) print(ans)
a, b, c, k = map(int, input().split()) ans = min(a, k) - max(0, k - a - b) print(ans)
[["+", 0, 1, 0, 662, 12, 657, 31, 652, 63, 22], ["+", 0, 662, 12, 657, 31, 652, 3, 4, 0, 24], ["+", 0, 662, 12, 657, 31, 652, 3, 4, 0, 21], ["+", 0, 662, 12, 657, 31, 652, 3, 4, 0, 22], ["+", 0, 662, 12, 657, 31, 652, 3, 4, 0, 25]]
5
38
a, b, c, k = map(int, input().split()) b, c = a + b, a + b + c if k <= a: print(a) elif a <= k <= b: print(a) else: print(a - (k - b))
a, b, c, k = map(int, input().split()) b, c = a + b, a + b + c if k <= a: print(k) elif a <= k <= b: print(a) else: print(a - (k - b))
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
65
#include <bits/stdc++.h> #define DAU \ ios::sync_with_stdio(false); \ cin.tie(0); \ cout.tie(0); #define PLEC return 0; using namespac...
#include <bits/stdc++.h> #define DAU \ ios::sync_with_stdio(false); \ cin.tie(0); \ cout.tie(0); #define PLEC return 0; using namespac...
[["-", 75, 76, 0, 9, 0, 1, 0, 16, 12, 22], ["+", 75, 76, 0, 9, 0, 1, 0, 16, 12, 22]]
1
100
/* UTF-8 */ #include <algorithm> #include <array> #include <deque> #include <iostream> #include <limits> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <tuple> #include <type_traits> #include <unordered_map> #include <unor...
/* UTF-8 */ #include <algorithm> #include <array> #include <deque> #include <iostream> #include <limits> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <tuple> #include <type_traits> #include <unordered_map> #include <unor...
[["-", 0, 1, 0, 11, 12, 2, 3, 4, 0, 22], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 22]]
1
400
#include <bits/stdc++.h> using namespace std; using ll = long long; void solve(long long A, long long B, long long C, long long K) { ll ans = 0; if (K <= A) { cout << A << endl; return; } else { ans += A; K -= A; } if (K <= B) { cout << ans << endl; return; } else { K -= B; } ...
#include <bits/stdc++.h> using namespace std; using ll = long long; void solve(long long A, long long B, long long C, long long K) { ll ans = 0; if (K <= A) { cout << K << endl; return; } else { ans += A; K -= A; } if (K <= B) { cout << ans << endl; return; } else { K -= B; } ...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
172
def printend(t): print(t) exit() A,B,C,K = [int(hoge) for hoge in input().split()] if A>K: printend(A) elif A+B>K: printend(A) else: printend(A - (K-A-B))
def printend(t): print(t) exit() A,B,C,K = [int(hoge) for hoge in input().split()] if A>K: printend(K) elif A+B>K: printend(A) else: printend(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
71
#include <bits/stdc++.h> #define endl '\n' #define pb push_back #define fr first #define sc second #define ll long long int #define bit(idx) idx &(-idx) #define bin(x, a) bitset<a>(x) #define all(A) A.begin(), A.end() #define debug(x) cout << #x << " = " << x << endl; using namespace std; int main() { ios_base::sync...
#include <bits/stdc++.h> #define endl '\n' #define pb push_back #define fr first #define sc second #define ll long long int #define bit(idx) idx &(-idx) #define bin(x, a) bitset<a>(x) #define all(A) A.begin(), A.end() #define debug(x) cout << #x << " = " << x << endl; using namespace std; int main() { ios_base::sync...
[["-", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22], ["+", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22]]
1
150
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; #define F first #define S second #define pb push_back mt19937 rnd; int main() { ios_base::sync_with_stdio(0); cin.tie(0); #ifdef LOCAL freopen("input.txt", "r", stdin); #endif ll a, b, c, k; cin >> a >> b >> c >>...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; #define F first #define S second #define pb push_back mt19937 rnd; int main() { ios_base::sync_with_stdio(0); cin.tie(0); #ifdef LOCAL freopen("input.txt", "r", stdin); #endif ll a, b, c, k; cin >> a >> b >> c >>...
[["-", 0, 1, 0, 16, 31, 16, 12, 16, 17, 72], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 33]]
1
151
a,b,c,d=map(int,input().split()) if a+1+b>d: print(a) else: print(a-(d-a-b))
a,b,c,d=map(int,input().split()) if a+1+b>d: print(min(a,d)) else: print(a-(d-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
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); ll a, b, c, k; cin >> a >> b >> c >> k; ll res = min(k, a); k -= min(k, a); k -= min(k, b); res -= min(k, b); cout << res << '\n'; return 0; }
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); ll a, b, c, k; cin >> a >> b >> c >> k; ll res = min(k, a); k -= min(k, a); k -= min(k, b); res -= min(k, c); cout << res << '\n'; return 0; }
[["-", 0, 1, 0, 11, 12, 2, 3, 4, 0, 22], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 22]]
1
99
a, b, c, k = [int(i) for i in input().split(' ')] if k <= a: print(1 * k) elif k <= a + b: print(1 * a) else: print(1 * a + k * -1)
a, b, c, k = [int(i) for i in input().split(' ')] if k <= a: print(1 * k) elif k <= a + b: print(1 * a) else: print(1 * a + (k - a - b) * -1)
[["+", 3, 4, 0, 657, 12, 657, 31, 23, 0, 24], ["+", 12, 657, 31, 23, 0, 657, 31, 657, 17, 33], ["+", 12, 657, 31, 23, 0, 657, 31, 657, 12, 22], ["+", 0, 657, 12, 657, 31, 23, 0, 657, 17, 33], ["+", 0, 657, 12, 657, 31, 23, 0, 657, 12, 22], ["+", 3, 4, 0, 657, 12, 657, 31, 23, 0, 25]]
5
64
#include <bits/stdc++.h> using namespace std; using int32 = int_fast32_t; using int64 = int_fast64_t; const int32 INF = 1e9; const int32 MOD = 1e9 + 7; const int64 LLINF = 1e18; #define YES(n) cout << ((n) ? "YES\n" : "NO\n") #define Yes(n) cout << ((n) ? "Yes\n" : "No\n") #define POSSIBLE cout << ((n) ? "POSSIBLE\n...
#include <bits/stdc++.h> using namespace std; using int32 = int_fast32_t; using int64 = int_fast64_t; const int32 INF = 1e9; const int32 MOD = 1e9 + 7; const int64 LLINF = 1e18; #define YES(n) cout << ((n) ? "YES\n" : "NO\n") #define Yes(n) cout << ((n) ? "Yes\n" : "No\n") #define POSSIBLE cout << ((n) ? "POSSIBLE\n...
[["+", 0, 30, 0, 14, 8, 9, 0, 57, 0, 121], ["+", 0, 14, 8, 9, 0, 57, 15, 339, 0, 24], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 57, 15, 339, 0, 25]]
1
181
/* * Welcome to my code! *---------------------------------------------* * author : lynmisakura(twitter : @andoreiji11) */ #include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <...
/* * Welcome to my code! *---------------------------------------------* * author : lynmisakura(twitter : @andoreiji11) */ #include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <...
[["-", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22], ["+", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22]]
1
437
#include <stdio.h> int main() { int a, b, c, k; scanf("%d %d %d %d", &a, &b, &c, &k); if (k < a) printf("%d\n", k); else if (k < a + b) 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 (k < a) printf("%d\n", k); else if (k < a + b) printf("%d\n", a); else printf("%d\n", a - k + a + b); return 0; }
[["-", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
91
#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 pb push_back #define mp make_pair #define pii pair<int, int> #define vi vector<int> #define mii map<int, int> #define pqb priority_queue<in...
#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 pb push_back #define mp make_pair #define pii pair<int, int> #define vi vector<int> #define mii map<int, int> #define pqb priority_queue<in...
[["+", 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
195
//#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; #define endl '\n' #define lfs cout << fixed << setprecision(10) #define ALL(a) (a).begin(), (a).end() #define ALLR(a) (a).rbegin(), (a).rend() #define spa << " " << #define fi first #define se second #define MP make_pair #define MT make_tuple #def...
//#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; #define endl '\n' #define lfs cout << fixed << setprecision(10) #define ALL(a) (a).begin(), (a).end() #define ALLR(a) (a).rbegin(), (a).rend() #define spa << " " << #define fi first #define se second #define MP make_pair #define MT make_tuple #def...
[["+", 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
905
#include <iostream> 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 << K << endl; } else { cout << K - (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 (K <= A) { cout << K << endl; } else if (K <= A + B) { cout << A << endl; } else { cout << A - (K - A - B) << endl; } return 0; }
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 31, 22], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 31, 22]]
1
84
#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...
[["+", 0, 1, 0, 2, 3, 4, 0, 2, 63, 22], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 24], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 22], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 21], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 25]]
1
438
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); int x = sc.nextInt(); int c[] = new int[n]; int a[][] = new int[n][m]; for (int i = 0; i < n; ++i) { c[i] = sc.nextInt();...
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); int x = sc.nextInt(); int c[] = new int[n]; int a[][] = new int[n][m]; for (int i = 0; i < n; ++i) { c[i] = sc.nextInt();...
[["-", 15, 15, 0, 16, 31, 23, 0, 16, 31, 22], ["+", 15, 15, 0, 16, 31, 23, 0, 16, 31, 499], ["-", 31, 23, 0, 16, 12, 23, 0, 16, 31, 499], ["-", 31, 23, 0, 16, 12, 23, 0, 16, 17, 151], ["+", 31, 23, 0, 16, 12, 23, 0, 16, 31, 22], ["+", 31, 23, 0, 16, 12, 23, 0, 16, 17, 152], ["-", 8, 196, 0, 57, 15, 15, 0, 16, 12, 499],...
3
327
n, m, x = map(int, input().split()) ca = [list(map(int, input().split())) for _ in range(n)] # 購買する全パターンを回す most_row_price = 10**10 for i in range(2**n): comb = str(bin(i)[2:]).zfill(n) # 購買パターン毎の購入金額と理解度を算出する money_per_pattern = [0] * n # 購買パターン毎の金額の初期化 total_money = 0 # 合計購入金額の初期化 for j in r...
n, m, x = map(int, input().split()) ca = [list(map(int, input().split())) for _ in range(n)] # 購買する全パターンを回す most_row_price = 10**10 for i in range(2**n): comb = str(bin(i)[2:]).zfill(n) # 購買パターン毎の購入金額と理解度を算出する understanding = [0] * m # 理解度の初期化 total_money = 0 # 合計購入金額の初期化 for j in range(n): ...
[["-", 0, 7, 8, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 7, 8, 196, 0, 1, 0, 662, 31, 22], ["-", 8, 196, 0, 1, 0, 662, 12, 657, 12, 22], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 12, 22]]
5
189
N,M,X=map(int,input().split()) C=[list(map(int,input().split())) for _ in range(N)] ans=inf=float('inf') def dfs(idx,tt,l): global ans for i in range(idx,N): ntt=tt+C[i][0] nl=[l[j]+C[i][j+1] for j in range(M)] ok=False for x in nl: if x<X: ok=True ...
N,M,X=map(int,input().split()) C=[list(map(int,input().split())) for _ in range(N)] ans=inf=float('inf') def dfs(idx,tt,l): global ans for i in range(idx,N): ntt=tt+C[i][0] nl=[l[j]+C[i][j+1] for j in range(M)] ok=True for x in nl: if x<X: ok=False ...
[["-", 0, 7, 8, 196, 0, 1, 0, 662, 12, 147], ["+", 0, 7, 8, 196, 0, 1, 0, 662, 12, 146], ["-", 0, 57, 64, 196, 0, 1, 0, 662, 12, 146], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 12, 147]]
5
175