buggy_code
stringlengths
11
625k
fixed_code
stringlengths
17
625k
bug_type
stringlengths
2
4.45k
language
int64
0
8
token_count
int64
5
200k
a, b, c, k = gets.split.map(&:to_i) sum = 0 sum += [a, k].min k -= a k -= b sum -= [c, k].min puts sum
a, b, c, k = gets.split.map(&:to_i) sum = 0 sum += [a, k].min k -= a k -= b sum -= [c, k].min if k >= 0 puts sum
[["+", 36, 36, 36, 36, 0, 493, 0, 751, 0, 121], ["+", 36, 36, 0, 493, 0, 751, 15, 738, 31, 22], ["+", 36, 36, 0, 493, 0, 751, 15, 738, 17, 20], ["+", 36, 36, 0, 493, 0, 751, 15, 738, 12, 612]]
4
46
#pragma GCC optimize("O3") #pragma GCC target("sse4") #include <bits/stdc++.h> using namespace std; typedef long long ll; const double PI = acos(-1.0); #define t1(x) cerr << #x << "=" << x << endl #define t2(x, y) cerr << #x << "=" << x << " " << #y << "=" << y << endl #define t3(x, y, z) ...
#pragma GCC optimize("O3") #pragma GCC target("sse4") #include <bits/stdc++.h> using namespace std; typedef long long ll; const double PI = acos(-1.0); #define t1(x) cerr << #x << "=" << x << endl #define t2(x, y) cerr << #x << "=" << x << " " << #y << "=" << y << endl #define t3(x, y, z) ...
[["+", 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
235
#include <bits/stdc++.h> using namespace std; #define int long long #define double long double #define SZ(x) ((int)(x).size()) #define rep(i, n) for (int i = 0; i < (n); ++i) #define fore(i, a) for (auto &i : a) #define min(...) min({__VA_ARGS__}) #define max(...) max({__VA_ARGS__}) #define Yes cout << "Yes" << endl; #...
#include <bits/stdc++.h> using namespace std; #define int long long #define double long double #define SZ(x) ((int)(x).size()) #define rep(i, n) for (int i = 0; i < (n); ++i) #define fore(i, a) for (auto &i : a) #define min(...) min({__VA_ARGS__}) #define max(...) max({__VA_ARGS__}) #define Yes cout << "Yes" << endl; #...
[["+", 0, 16, 31, 16, 12, 16, 12, 2, 63, 22], ["+", 31, 16, 12, 16, 12, 2, 3, 4, 0, 24], ["+", 12, 2, 3, 4, 0, 2, 3, 4, 0, 21], ["+", 12, 2, 3, 4, 0, 2, 3, 4, 0, 13], ["+", 12, 2, 3, 4, 0, 2, 3, 4, 0, 25]]
1
345
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, c, k; cin >> a >> b >> c >> k; long long ans = 0; if (k <= a) { cout << k << endl; } else if (k > a and k <= a + b) { cout << k << endl; } else { ans = a; k -= a; k -= b; ans = a - k; cout << ans << endl;...
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, c, k; cin >> a >> b >> c >> k; long long ans = 0; if (k <= a) { cout << k << endl; } else if (k > a and k <= a + b) { cout << a << endl; } else { ans = a; k -= a; k -= b; ans = a - k; cout << ans << endl;...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
100
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) #define rep_bit(n) for (int bit = 0; bit < (1 << n); ++bit) #define all(x) (x).begin(), (x).end() #define ll long long #define ld long double #define CYES cout << "Yes" << endl #define CNO cout << "No" << endl #define SP << " " << #define CST(x) cou...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) #define rep_bit(n) for (int bit = 0; bit < (1 << n); ++bit) #define all(x) (x).begin(), (x).end() #define ll long long #define ld long double #define CYES cout << "Yes" << endl #define CNO cout << "No" << endl #define SP << " " << #define CST(x) cou...
[["-", 8, 9, 0, 57, 64, 1, 0, 11, 12, 22], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 12, 22]]
1
205
a,b,c,k=map(int,input().split()) if(k<=a): print(k) elif(k<=(a+b)): print(a) else: x=k-(a+b) print(z-x)
a,b,c,k=map(int,input().split()) if(k<=a): print(k) elif(k<=(a+b)): print(a) else: x=k-(a+b) print(a-x)
[["-", 0, 1, 0, 652, 3, 4, 0, 657, 31, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 31, 22]]
5
63
#include <bits/stdc++.h> using namespace std; #define ll long long #define mod 1000000007 int main() { int t = 1; // cin>>t; while (t--) { ll a, b, c, k; cin >> a >> b >> c >> k; if ((a + b) >= k) cout << a << "\n"; else cout << a - (k - (a + b)) << "\n"; } }
#include <bits/stdc++.h> using namespace std; #define ll long long #define mod 1000000007 int main() { int t = 1; // cin>>t; while (t--) { ll a, b, c, k; cin >> a >> b >> c >> k; if ((a + b) >= k) cout << min(a, k) << "\n"; else cout << a - (k - (a + b)) << "\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
87
#include <bits/stdc++.h> #define INF 1e9 #define llINF 1e18 #define MOD 1000000007 #define pb push_back #define mp make_pair #define F first #define S second #define ll long long #define vi vector<ll> #define vvi vector<vi> #define BITLE(n) (1LL << ((ll)n)) #define SHIFT_LEFT(n) (1LL << ((ll)n)) #define SUBS(s, f, t) (...
#include <bits/stdc++.h> #define INF 1e9 #define llINF 1e18 #define MOD 1000000007 #define pb push_back #define mp make_pair #define F first #define S second #define ll long long #define vi vector<ll> #define vvi vector<vi> #define BITLE(n) (1LL << ((ll)n)) #define SHIFT_LEFT(n) (1LL << ((ll)n)) #define SUBS(s, f, t) (...
[["-", 0, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 0, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
171
n=input().split(' ') for i in range(len(n)): n[i]=int(n[i]) k=n[3] sum=0 if k > n[0]: sum+=n[0] k-=n[0] else: print(k) k-=n[1] if 0 < k: sum-=k print(sum)
n=input().split(' ') for i in range(len(n)): n[i]=int(n[i]) k=n[3] sum=0 if k > n[0]: sum+=n[0] k-=n[0] else: sum=k k=0 k-=n[1] if 0 < k: sum-=k print(sum)
[["-", 75, 76, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 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], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25], ["+", 75, 76, 8, 196, 0, 1, 0, 662, 12, 612]]
5
88
a,b,c,k=map(int,input().split()) if k<=a: ans=a elif k<=a+b: ans=a else: ans=a-k+a+b print(ans)
a,b,c,k=map(int,input().split()) if k<=a: ans=k elif 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
53
#include <algorithm> #include <cassert> #include <climits> #include <cmath> #include <cstring> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <unordered_map> #include <vector> #define _(x) \ ...
#include <algorithm> #include <cassert> #include <climits> #include <cmath> #include <cstring> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <unordered_map> #include <vector> #define _(x) \ ...
[["+", 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
129
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <tuple> #include <utility> #include <vector> using namespace ...
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <tuple> #include <utility> #include <vector> using namespace ...
[["-", 49, 50, 51, 23, 0, 41, 75, 16, 31, 22], ["-", 49, 50, 51, 23, 0, 41, 75, 16, 17, 33]]
1
309
#include <bits/stdc++.h> using namespace std; #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define REP(i, n) FOR(i, 0, n) #define ALL(a) (a).begin(), (a).end() #define VI vector<int> #define MOD 1000000007 using ll = long long int; using P = pair<int, int>; template <class T> bool chmax(T &a, const T &b) { ...
#include <bits/stdc++.h> using namespace std; #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define REP(i, n) FOR(i, 0, n) #define ALL(a) (a).begin(), (a).end() #define VI vector<int> #define MOD 1000000007 using ll = long long int; using P = pair<int, int>; template <class T> bool chmax(T &a, const T &b) { ...
[["+", 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
200
#include <algorithm> #include <bits/stdc++.h> #include <climits> #include <cmath> #include <iomanip> #include <iostream> #include <iterator> #include <map> #include <numeric> #include <set> #include <string> #include <utility> #include <vector> using namespace std; #define ll long long int #define M 1000000007 int mai...
#include <algorithm> #include <bits/stdc++.h> #include <climits> #include <cmath> #include <iomanip> #include <iostream> #include <iterator> #include <map> #include <numeric> #include <set> #include <string> #include <utility> #include <vector> using namespace std; #define ll long long int #define M 1000000007 int mai...
[["-", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22], ["+", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22]]
1
121
A, B, C, K = map(int, input().split()) if K <= A: print(max(A, K)) elif K <= A + B: print(A) else: remain_K = K - (A + B) print(A - remain_K)
A, B, C, K = map(int, input().split()) if K <= A: print(K) elif K <= A + B: print(A) else: remain_K = K - (A + B) print(A - remain_K)
[["-", 0, 1, 0, 652, 3, 4, 0, 652, 63, 22], ["-", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["-", 0, 652, 3, 4, 0, 652, 3, 4, 0, 22], ["-", 0, 652, 3, 4, 0, 652, 3, 4, 0, 21], ["-", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
62
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define X first #define Y second #define for0 for (int i = 0; i < n; i++) int main() { long long a, b, c, k; cin >> a >> b >> c; if (k <= a) cout << k; else if (k > a && k <= a + b) cout << a; else if (k > a + b && k <= a + b + c) ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define X first #define Y second #define for0 for (int i = 0; i < n; i++) int main() { long long a, b, c, k; cin >> a >> b >> c >> k; if (k <= a) cout << k; else if (k > a && k <= a + b) cout << a; else if (k > a + b && k <= a + b + c...
[["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22]]
1
100
package main import "fmt" func main() { var a, b, c, k int fmt.Scan(&a, &b, &c, &k) var sum int if a >= k { fmt.Println(a) return } else { sum += a k = k - a } if b >= k { fmt.Println(a) return } else { k = k - b } fmt.Println(sum - k) }
package main import "fmt" func main() { var a, b, c, k int fmt.Scan(&a, &b, &c, &k) var sum int if a >= k { fmt.Println(k) return } else { sum += a k = k - a } if b >= k { fmt.Println(sum) return } else { k = k - b } fmt.Println(sum - k) }
[["-", 64, 196, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 2, 3, 4, 0, 22]]
7
109
#include <bits/stdc++.h> using namespace std; int main() { long long int a, b, c, k; cin >> a >> b >> c >> k; long long int ans = 0; ans += min(a, k); k -= a; k -= c; if (k > 0) ans -= min(k, b); cout << ans; }
#include <bits/stdc++.h> using namespace std; int main() { long long int a, b, c, k; cin >> a >> b >> c >> k; long long int ans = 0; ans += min(a, k); k -= a; k -= b; if (k > 0) ans -= min(k, c); cout << ans; }
[["-", 0, 14, 8, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 22], ["-", 64, 1, 0, 11, 12, 2, 3, 4, 0, 22], ["+", 64, 1, 0, 11, 12, 2, 3, 4, 0, 22]]
1
76
#include <bits/stdc++.h> using namespace std; int main(void) { int a, b, c, k; cin >> a >> b >> c >> k; int e; long long int ans = 0; e = k - a; ans += e > 0 ? a : k; e -= b; ans -= e; cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; int main(void) { int a, b, c, k; cin >> a >> b >> c >> k; int e; long long int ans = 0; e = k - a; ans += e > 0 ? a : k; e -= b; ans -= e > 0 ? e : 0; cout << ans << endl; }
[["+", 0, 1, 0, 11, 12, 41, 15, 16, 17, 47], ["+", 0, 1, 0, 11, 12, 41, 15, 16, 12, 13], ["+", 8, 9, 0, 1, 0, 11, 12, 41, 0, 101], ["+", 8, 9, 0, 1, 0, 11, 12, 41, 64, 22], ["+", 8, 9, 0, 1, 0, 11, 12, 41, 0, 102], ["+", 8, 9, 0, 1, 0, 11, 12, 41, 75, 13]]
1
72
# coding:utf-8 import sys import math import time #import numpy as np import collections from collections import deque from collections import Counter import queue import copy import bisect import heapq import itertools #sys.setrecursionlimit(10**7) #N, Q = map(int, input().split()) #G = [list(input()) for i in ran...
# coding:utf-8 import sys import math import time #import numpy as np import collections from collections import deque from collections import Counter import queue import copy import bisect import heapq import itertools #sys.setrecursionlimit(10**7) #N, Q = map(int, input().split()) #G = [list(input()) for i in ran...
[["-", 0, 57, 64, 196, 0, 1, 0, 677, 12, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 677, 12, 22]]
5
107
#include <bits/stdc++.h> #include <iterator> #include <set> using namespace std; // using namespace __gnu_pbds; #define f first #define s second #define pb push_back #define all(x) x.begin(), x.end() #define ll long long int #define vi vector<int> #define vii vector<pair<int, int>> #define pii pair<int, int> #define...
#include <bits/stdc++.h> #include <set> #include <iterator> using namespace std; // using namespace __gnu_pbds; #define f first #define s second #define pb push_back #define all(x) x.begin(), x.end() #define ll long long int #define vi vector<int> #define vii vector<pair<int, int>> #define pii pair<int, int> #define...
[["-", 36, 36, 36, 36, 0, 30, 0, 135, 136, 137], ["-", 36, 36, 36, 36, 0, 30, 0, 135, 0, 138], ["+", 36, 36, 36, 36, 0, 30, 0, 135, 0, 138], ["+", 36, 36, 36, 36, 0, 30, 0, 135, 136, 137], ["-", 75, 76, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 75, 76, 0, 57, 15, 339, 51, 16, 17, 19]]
1
334
def main(): a,b,c,k = map(int,input().split()) cnt = 0 res = 0 if a <= (k-cnt): res += a cnt += a else: res += (k-cnt) cnt += (k-cnt) if b <= (k-cnt): cnt += b else: cnt += (k-cnt) if c <= (k-cnt): cnt += c res -= c else...
def main(): a,b,c,k = map(int,input().split()) cnt = 0 res = 0 if a <= (k-cnt): res += a cnt += a else: res += (k-cnt) cnt += (k-cnt) if b <= (k-cnt): cnt += b else: cnt += (k-cnt) if c <= (k-cnt): cnt += c res -= c else...
[["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 21], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
130
#include <cmath> #include <iostream> #include <vector> using namespace std; int main() { uint64_t A, B, C, K; cin >> A >> B >> C >> K; uint64_t temp; if (A >= K) { temp = K; } else if (A + B >= K) { temp = A; } else { temp = A - (K - A - B); } cout << temp << endl; }
#include <cmath> #include <iostream> #include <vector> using namespace std; int main() { int64_t A, B, C, K; cin >> A >> B >> C >> K; int64_t temp; if (A >= K) { temp = K; } else if (A + B >= K) { temp = A; } else { temp = A - (K - A - B); } cout << temp << endl; }
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40]]
1
86
import math #def main(S, b): if __name__ == '__main__': a, b, c, k = map(int, input().split()) # x = int(input()) #a, b = map(int, input().split()) # a = list(map(int, input().split())) # s = input() # t = input() if (a >= k): print(a) elif (a + b >= k): print(a) ...
import math #def main(S, b): if __name__ == '__main__': a, b, c, k = map(int, input().split()) if (a >= k): print(k) elif (a + b >= k): print(a) else: print(a - (k - a - b)) # if (s == t[:(len(s))] and len(t) == len(s) + 1): # print("Yes") # else: # pri...
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
78
<?php list($A,$B,$C,$K)=sscanf(trim(fgets(STDIN)),"%d %d %d %d"); $amari = $K - $A; if($amari <= 0){ print($A); exit; } $amari -= $B; if($amari <= 0){ print($A); exit; } print($A - $amari);
<?php list($A,$B,$C,$K)=sscanf(trim(fgets(STDIN)),"%d %d %d %d"); $amari = $K - $A; if($amari <= 0){ print($K); exit; } $amari -= $B; if($amari <= 0){ print($A); exit; } print($A - $amari);
[["-", 0, 1, 0, 619, 0, 23, 0, 606, 0, 141], ["+", 0, 1, 0, 619, 0, 23, 0, 606, 0, 141]]
6
89
abck = input().split() a = int(abck[0]) b = int(abck[1]) c = int(abck[2]) k = int(abck[3]) if k <= a: print(k) elif k <= a+b: print(k) else: print(a - (k-(a+b)))
abck = input().split() a = int(abck[0]) b = int(abck[1]) c = int(abck[2]) k = int(abck[3]) 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
81
#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; } }
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
81
#include <ctype.h> #include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> // qsort int compare_int(const void *a, const void *b) { return *(int *)a - *(int *)b; } //比較 int max(int a, int b) { if (a > b) return a; else return b; } int min(int a, int b) { if (a > b) return b; ...
#include <ctype.h> #include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> // qsort int compare_int(const void *a, const void *b) { return *(int *)a - *(int *)b; } //比較 int max(int a, int b) { if (a > b) return a; else return b; } int min(int a, int b) { if (a > b) return b; ...
[["-", 64, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 64, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
0
201
// VU TRUONG AN #include <bits/stdc++.h> #define FORX(i, x, y) for (int i = x; i <= y; ++i) #define FORN(i, x, y) for (int i = x; i >= y; --i) #define reset(x, y) memset(x, y, sizeof(x)) #define bp(i) (1 << i) #define F first #define S second #define maxn 100001 #define MOD 1000000007 #define mp make_pair #define pb pu...
// VU TRUONG AN #include <bits/stdc++.h> #define FORX(i, x, y) for (int i = x; i <= y; ++i) #define FORN(i, x, y) for (int i = x; i >= y; --i) #define reset(x, y) memset(x, y, sizeof(x)) #define bp(i) (1 << i) #define F first #define S second #define maxn 100001 #define MOD 1000000007 #define mp make_pair #define pb pu...
[["-", 0, 57, 64, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 16, 12, 22]]
1
301
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <string> #include <vector> using namespace std; const long long INF = (long long)(1e18) + 1; int main() { long long a, b, c, k; cin >> a >> b >> c >> k; long long ans = 0; if (a >= k) { ans += a; cout << ans << endl; ...
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <string> #include <vector> using namespace std; const long long INF = (long long)(1e18) + 1; int main() { long long a, b, c, k; cin >> a >> b >> c >> k; long long ans = 0; if (a >= k) { ans += k; cout << ans << endl; ...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22]]
1
117
/** * code generated by JHelper * More info: https://github.com/AlexeyDmitriev/JHelper * @author zjsdut */ #ifndef ALGO_UTILS #define ALGO_UTILS #include <algorithm> #include <cassert> #include <queue> #include <vector> template <typename A, typename B> bool chkmin(A &a, const B &b) { if (b < a) { a = b; ...
/** * code generated by JHelper * More info: https://github.com/AlexeyDmitriev/JHelper * @author zjsdut */ #ifndef ALGO_UTILS #define ALGO_UTILS #include <algorithm> #include <cassert> #include <queue> #include <vector> template <typename A, typename B> bool chkmin(A &a, const B &b) { if (b < a) { a = b; ...
[["+", 3, 4, 0, 16, 12, 23, 0, 16, 17, 33], ["+", 3, 4, 0, 16, 12, 23, 0, 16, 12, 22]]
1
1,078
#include <algorithm> #include <iostream> #include <math.h> #include <queue> #include <string> #include <tuple> #include <vector> #include <map> #include <set> #include <stack> #include <unordered_map> using namespace std; #define rep(i, n) for (int(i) = 0; (i) < (n); (i)++) #define all(x) (x).begin(), (x).end() usin...
#include <algorithm> #include <iostream> #include <math.h> #include <queue> #include <string> #include <tuple> #include <vector> #include <map> #include <set> #include <stack> #include <unordered_map> using namespace std; #define rep(i, n) for (int(i) = 0; (i) < (n); (i)++) #define all(x) (x).begin(), (x).end() usin...
[["+", 0, 57, 64, 1, 0, 11, 12, 16, 17, 72], ["+", 0, 57, 64, 1, 0, 11, 12, 16, 12, 22]]
1
222
#include <bits/stdc++.h> #include <iostream> using namespace std; int main() { uint64_t a, b, c, k; cin >> a >> b >> c >> k; uint64_t total = 0; if (a >= k) { total += k; } else { k -= a; total += a; if (b < k) { k -= b; total -= k; } } cout << total << endl; return 0; }...
#include <bits/stdc++.h> #include <iostream> using namespace std; int main() { int64_t a, b, c, k; cin >> a >> b >> c >> k; int64_t total = 0; if (a >= k) { total += k; } else { k -= a; total += a; if (b < k) { k -= b; total -= k; } } cout << total << endl; return 0; }
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40]]
1
86
#pragma GCC optimize("Ofast") #include <bits/stdc++.h> using namespace std; typedef long long int lld; const lld N = 200043; const lld MOD = 1000000007; lld add(lld x, lld y) { x += y; while (x >= MOD) x -= MOD; while (x < 0) x += MOD; return x; } lld mul(lld x, lld y) { return (x * 1ll * y) % MOD; }...
#pragma GCC optimize("Ofast") #include <bits/stdc++.h> using namespace std; typedef long long int lld; const lld N = 200043; const lld MOD = 1000000007; lld add(lld x, lld y) { x += y; while (x >= MOD) x -= MOD; while (x < 0) x += MOD; return x; } lld mul(lld x, lld y) { return (x * 1ll * y) % MOD; }...
[["-", 0, 11, 12, 16, 12, 2, 3, 4, 0, 22], ["+", 0, 11, 12, 16, 12, 2, 3, 4, 0, 22]]
1
330
import sys A, B, C, K = map(int, input().split()) ans = min(A, K) K -= A if K <= 0: print(ans) sys.exit() K -= B if K <= 0: print(ans) sys.exit() ans -= min(A, K) print(ans)
import sys A, B, C, K = map(int, input().split()) ans = min(A, K) K -= A if K <= 0: print(ans) sys.exit() K -= B if K <= 0: print(ans) sys.exit() ans -= K print(ans)
[["-", 0, 656, 0, 1, 0, 677, 12, 652, 63, 22], ["-", 0, 1, 0, 677, 12, 652, 3, 4, 0, 24], ["-", 0, 1, 0, 677, 12, 652, 3, 4, 0, 22], ["-", 0, 1, 0, 677, 12, 652, 3, 4, 0, 21], ["-", 0, 1, 0, 677, 12, 652, 3, 4, 0, 25]]
5
76
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; int a, b, c, k, ans = 0; int main() { cin >> a >> b >> c >> k; if (k <= a) { ans = a; k = 0; } else { ans = a; k -= a; } if (k > b) { k -= b; if (k > c) ans -= c; else a...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; int a, b, c, k, ans = 0; int main() { cin >> a >> b >> c >> k; if (k <= a) { ans = k; k = 0; } else { ans = a; k -= a; } if (k > b) { k -= b; if (k > c) ans -= c; else a...
[["-", 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> #define pb push_back using namespace std; using ll = long long; using ull = unsigned long long; typedef vector<ll> vl; typedef vector<int> vi; typedef vector<string> vs; typedef vector<vector<ll>> vvl; typedef vector<vector<string>> vvs; typedef vector<bool> vb; const ll md = 1000000007; vector...
#include <bits/stdc++.h> #define pb push_back using namespace std; using ll = long long; using ull = unsigned long long; typedef vector<ll> vl; typedef vector<int> vi; typedef vector<string> vs; typedef vector<vector<ll>> vvl; typedef vector<vector<string>> vvs; typedef vector<bool> vb; const ll md = 1000000007; vector...
[["+", 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
981
A,B,C,K=list(map(int,input().split())) now = K a = min(A,now) now -= a if now < 0: now = 0 b = min(B,now) now -= b if now < 0: now = 0 c = now print(a-c*now)
A,B,C,K=list(map(int,input().split())) now = K a = min(A,now) now -= a if now < 0: now = 0 b = min(B,now) now -= b if now < 0: now = 0 c = now print(a-now)
[["-", 0, 652, 3, 4, 0, 657, 12, 657, 31, 22], ["-", 0, 652, 3, 4, 0, 657, 12, 657, 17, 48]]
5
75
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <limits> #include <list> #include <map> #include <queue> #include ...
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <limits> #include <list> #include <map> #include <queue> #include ...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22]]
1
714
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, c, k, ans; cin >> a >> b >> c >> k; ans = min(k, a); k -= a; if (k > 0) { k -= b; } if (k > 0) { ans -= min(k, b); } cout << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, c, k, ans; cin >> a >> b >> c >> k; ans = min(k, a); k -= a; if (k > 0) { k -= b; } if (k > 0) { ans -= min(k, c); } cout << ans << endl; return 0; }
[["-", 0, 1, 0, 11, 12, 2, 3, 4, 0, 22], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 22]]
1
85
#include <bits/stdc++.h> using namespace std; #define ll long long #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define REP(i, n) for (int i = (0); i < (n); ++i) #define ALL(obj) (obj).begin(), (obj).end() #define DEBUG(val) cout << #val << " : " << val << endl #define MOD 1000000007 int main() { ll a, b, c,...
#include <bits/stdc++.h> using namespace std; #define ll long long #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define REP(i, n) for (int i = (0); i < (n); ++i) #define ALL(obj) (obj).begin(), (obj).end() #define DEBUG(val) cout << #val << " : " << val << endl #define MOD 1000000007 int main() { ll a, b, c,...
[["+", 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
109
#include <bits/stdc++.h> using namespace std; typedef long long LL; typedef pair<int, int> PII; template <class A, class B> ostream &operator<<(ostream &out, const pair<A, B> &p) { return out << "(" << p.first << ", " << p.second << ")"; } template <typename T, size_t N> ostream &operator<<(ostream &out, const array<...
#include <bits/stdc++.h> using namespace std; typedef long long LL; typedef pair<int, int> PII; template <class A, class B> ostream &operator<<(ostream &out, const pair<A, B> &p) { return out << "(" << p.first << ", " << p.second << ")"; } template <typename T, size_t N> ostream &operator<<(ostream &out, const array<...
[["+", 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
915
#define _DEBUG #include "bits/stdc++.h" #define CHOOSE(a) CHOOSE2 a #define CHOOSE2(a0, a1, a2, a3, a4, x, ...) x #define debug_1(x1) cout << #x1 << ": " << x1 << endl #define debug_2(x1, x2) \ cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << endl #define d...
#define _DEBUG #include "bits/stdc++.h" #define CHOOSE(a) CHOOSE2 a #define CHOOSE2(a0, a1, a2, a3, a4, x, ...) x #define debug_1(x1) cout << #x1 << ": " << x1 << endl #define debug_2(x1, x2) \ cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << endl #define d...
[["-", 0, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 0, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
1
335
a, b, c, k = map(int, input().split()) ans = 0 ans += min(a, k) - min(c, k-a-b) print(ans)
a, b, c, k = map(int, input().split()) ans = 0 ans += min(a, k) - min(c, max(0, k-a-b)) print(ans)
[["+", 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, 612], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 21], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
46
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <tuple> #include <vector> using namespace s...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <tuple> #include <vector> using namespace s...
[["-", 8, 9, 0, 57, 64, 1, 0, 11, 12, 22], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 12, 22]]
1
328
#include "bits/stdc++.h" typedef long long ll; #define all(x) (x).begin(), (x).end() // sortなどの引数を省略 #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) #define max3(x, y, z) max(x, max(y, z)) #define min3(x, y, z) min(x, min(y, z)) #ifdef _MSC_FULL_VER //デバッグ出力 #define dout cout #define debug() if (true) #define chec...
#include "bits/stdc++.h" typedef long long ll; #define all(x) (x).begin(), (x).end() // sortなどの引数を省略 #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) #define max3(x, y, z) max(x, max(y, z)) #define min3(x, y, z) min(x, min(y, z)) #ifdef _MSC_FULL_VER //デバッグ出力 #define dout cout #define debug() if (true) #define chec...
[["-", 0, 16, 12, 16, 31, 16, 31, 16, 31, 22], ["-", 0, 16, 12, 16, 31, 16, 31, 16, 17, 33], ["+", 0, 9, 0, 1, 0, 16, 12, 16, 17, 33], ["+", 0, 1, 0, 16, 12, 16, 12, 23, 0, 24], ["+", 12, 16, 12, 23, 0, 16, 31, 16, 31, 22], ["+", 0, 1, 0, 16, 12, 16, 12, 23, 0, 25]]
1
164
#include <bits/stdc++.h> using namespace std; #define FOR(i, n) for (int i = 0; i < n; i++) #define v(a, n) vector<int> a(n, 0) #define s(a, n) vector<string> a(n, "") #define lb(v, x) lower_bound(v.begin(), v.end(), x) #define ub(v, x) upper_bound(v.begin(), v.end(), x) #define ull unsigned long long #define pb push_b...
#include <bits/stdc++.h> using namespace std; #define FOR(i, n) for (int i = 0; i < n; i++) #define v(a, n) vector<int> a(n, 0) #define s(a, n) vector<string> a(n, "") #define lb(v, x) lower_bound(v.begin(), v.end(), x) #define ub(v, x) upper_bound(v.begin(), v.end(), x) #define ull unsigned long long #define pb push_b...
[["+", 31, 16, 12, 16, 31, 16, 31, 16, 12, 22], ["+", 0, 16, 31, 16, 12, 16, 31, 16, 17, 72]]
1
173
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) #define INF 1000000007 using namespace std; int main() { long a, b, c, k; cin >> a >> b >> c >> k; if (a <= k) cout << k; else if (a < k && k <= a + b) cout << a; else cout << a + (a + b - k); return 0; }
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) #define INF 1000000007 using namespace std; int main() { long a, b, c, k; cin >> a >> b >> c >> k; if (k <= a) cout << k; else if (a < k && k <= a + b) cout << a; else cout << a + (a + b - k); return 0; }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22]]
1
85
//#include <bits/stdc++.h> #include "bits/stdc++.h" using namespace std; typedef long long ll; //#include "boost/multiprecision/cpp_int.hpp" // typedef boost::multiprecision::cpp_int LL; typedef long double dd; #define i_7 (ll)(1E9 + 7) //#define i_7 998244353 #define i_5 i_7 - 2 ll mod(ll a) { ll c = a % i_7; if (...
//#include <bits/stdc++.h> #include "bits/stdc++.h" using namespace std; typedef long long ll; //#include "boost/multiprecision/cpp_int.hpp" // typedef boost::multiprecision::cpp_int LL; typedef long double dd; #define i_7 (ll)(1E9 + 7) //#define i_7 998244353 #define i_5 i_7 - 2 ll mod(ll a) { ll c = a % i_7; if (...
[["+", 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
391
#include <bits/stdc++.h> #define pb push_back #define mod 1000000007 #define mkp make_pair #define fi first #define se second #define ll long long #define scan(n) \ ll a[n]; \ for (ll i...
#include <bits/stdc++.h> #define pb push_back #define mod 1000000007 #define mkp make_pair #define fi first #define se second #define ll long long #define scan(n) \ ll a[n]; \ for (ll i...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 18], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 19]]
1
211
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; int main() { ios::sync_with_stdio(false); cin.tie(0); ll a, b, c, k; cin >> a >> b >> c >> k; if (a + b >= k) cout << a << endl; else cout << a - (k - b - a)...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; int main() { ios::sync_with_stdio(false); cin.tie(0); ll a, b, c, k; cin >> a >> b >> c >> k; if (a + b >= k) cout << min(a, k) << endl; else cout << a - (k ...
[["+", 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
101
// skip until line 65 #include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <istream> #include <iterator> #include <list> #include <map> #include <numeric> #include <ostream>...
// skip until line 65 #include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <istream> #include <iterator> #include <list> #include <map> #include <numeric> #include <ostream>...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
584
if __name__ == '__main__': from sys import stdin # from collections import defaultdict # from collections import deque # from collections import Counter # import math # import random input = stdin.readline a, b, c, k = map(int, input().split()) if k <= a: print(k) if k ...
if __name__ == '__main__': from sys import stdin # from collections import defaultdict # from collections import deque # from collections import Counter # import math # import random input = stdin.readline a, b, c, k = map(int, input().split()) if k <= a: print(k) elif ...
[["-", 0, 656, 0, 57, 64, 196, 0, 57, 0, 121], ["+", 0, 57, 64, 196, 0, 57, 75, 665, 0, 683]]
5
77
a, b, c, k = map(int, input().split()) if a >= k: print(a) else: ans = a k -= a if b >= k: print(ans) else: k -= b print(ans - k)
a, b, c, k = map(int, input().split()) if a >= k: print(k) else: ans = a k -= a if b >= k: print(ans) else: k -= b print(ans - k)
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
57
a,b,c,k = gets.split.map &:to_i if a >= k then puts a elsif a + b >= k then puts a else puts a - (k - a - b) end
a,b,c,k = gets.split.map &:to_i if a >= k then puts k elsif a + b >= k then 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
43
A,B,C,K = map(int,input().split()) ans = 0 count =0 if A<K-count: ans += A count += A else: ans +=K-count count += K-count if B<K-count: count += B else: count += K-count if A<K-count: ans -= C count += C else: ans -=K-count count += K-count print(ans)
A,B,C,K = map(int,input().split()) ans = 0 count =0 if A<K-count: ans += A count += A else: ans +=K-count count += K-count if B<K-count: count += B else: count += K-count if C<K-count: ans -= C count += C else: ans -=K-count count += K-count print(ans)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22]]
5
97
A,B,C,K=map(int,input().split()) ans=0 if K<=A: print(A) elif K<=A+B: print(A) else: print(A-(K-A-B))
A,B,C,K=map(int,input().split()) ans=0 if K<=A: print(K) elif K<=A+B: print(A) else: print(A-(K-A-B))
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
57
a,b,c,k = map(int,input().split()) if a>=k: print(a) else: if a+b>=k: print(a) else: print(2*a+b-k)
a,b,c,k = map(int,input().split()) if a>=k: print(k) else: if 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
54
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; int ans = 0; ans += min(a, k); k -= min(a, k); k -= min(b, k); ans -= min(b, k); cout << ans; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; int ans = 0; ans += min(a, k); k -= min(a, k); k -= min(b, k); ans -= min(c, k); cout << ans; return 0; }
[["-", 0, 1, 0, 11, 12, 2, 3, 4, 0, 22], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 22]]
1
79
#include <algorithm> #include <climits> #include <cmath> #include <cstdio> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <vector>...
#include <algorithm> #include <climits> #include <cmath> #include <cstdio> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <vector>...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
208
#include <bits/stdc++.h> using namespace std; #define ll long long #define rep(i, n) for (int i = 0; i < n; i++) #define all(v) v.begin(), v.end() int main() { long long a, b, c, k; cin >> a >> b >> c >> k; long long ans = 0; if (k <= a) { ans = a; } else if (k <= a + b) { ans = a; } else if (k >...
#include <bits/stdc++.h> using namespace std; #define ll long long #define rep(i, n) for (int i = 0; i < n; i++) #define all(v) v.begin(), v.end() int main() { long long a, b, c, k; cin >> a >> b >> c >> k; long long ans = 0; if (k <= a) { ans = k; } else if (k <= a + b) { ans = a; } else if (k >...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22]]
1
120
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; int ans = 0; if (a >= k) { ans = a; } else { k = k - a; if (b >= k) { ans = a; } else { k = k - b; ans = a - min(c, k); } } cout << ans << "\n"; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; int ans = 0; if (a >= k) { ans = k; } else { k = k - a; if (b >= k) { ans = a; } else { k = k - b; ans = a - min(c, k); } } cout << ans << "\n"; return 0; }
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22]]
1
100
A,B,C,K=map(int,input().split()) if A>=K: print(K) if A<K<=A+B: print(A) else: print(A-(K-A-B))
A,B,C,K=map(int,input().split()) if A>=K: print(K) if A<K<=A+B: print(A) if K>A+B: print(A-(K-A-B))
[["-", 36, 36, 0, 656, 0, 57, 75, 76, 0, 95], ["+", 36, 36, 36, 36, 0, 656, 0, 57, 0, 121], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47], ["+", 0, 656, 0, 57, 15, 666, 0, 657, 31, 22], ["+", 0, 656, 0, 57, 15, 666, 0, 657, 17, 72], ["+", 0, 656, 0, 57, 15, 666, 0, 657, 12...
5
56
ii = lambda : int(input()) mi = lambda : map(int,input().split()) li = lambda : list(map(int,input().split())) a,b,c,k = mi() ima = k if a >= k: print(a) exit() ima = k - a if b >= ima: print(a) exit() ima = ima - b nokori = min(c,ima) print(a-nokori)
ii = lambda : int(input()) mi = lambda : map(int,input().split()) li = lambda : list(map(int,input().split())) a,b,c,k = mi() ima = k if a >= k: print(k) exit() ima = k - a if b >= ima: print(a) exit() ima = ima - b nokori = min(c,ima) print(a-nokori)
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
107
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Main { public static void main(final String[] args) { final FastScanner scanner = new FastScanner(System.in); final long a = scanner.nextInt...
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Main { public static void main(final String[] args) { final FastScanner scanner = new FastScanner(System.in); final long a = scanner.nextLon...
[["-", 8, 196, 0, 503, 49, 200, 51, 492, 141, 22], ["+", 8, 196, 0, 503, 49, 200, 51, 492, 141, 22], ["-", 64, 196, 0, 1, 0, 492, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 492, 3, 4, 0, 22]]
3
364
#include <stdio.h> #include <string.h> int main() { int a, b, c, k; scanf("%d%d%d%d", &a, &b, &c, &k); if (a >= k) { printf("%d\n", a); } else if (a + b - k >= 0) { printf("%d\n", a); } else { printf("%d\n", a + (a + b - k)); } return 0; }
#include <stdio.h> #include <string.h> int main() { int a, b, c, k; scanf("%d%d%d%d", &a, &b, &c, &k); if (a >= k) { printf("%d\n", k); } else if (a + b - k >= 0) { printf("%d\n", a); } else { printf("%d\n", a + (a + b - k)); } return 0; }
[["-", 64, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 64, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
0
103
#include <bits/stdc++.h> using namespace std; #define int long long int #define loop for (int i = 0; i < n; i++) #define pb push_back int32_t main() { int k, a, b, c; cin >> a >> b >> c >> k; if (k <= a) cout << k << endl; else if (k <= (a + b)) cout << a << endl; else cout << (k - (a + b)) - a <<...
#include <bits/stdc++.h> using namespace std; #define int long long int #define loop for (int i = 0; i < n; i++) #define pb push_back int32_t main() { int k, a, b, c; 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)) <<...
[["+", 0, 1, 0, 16, 31, 16, 12, 16, 31, 22], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 33], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 17, 33], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 12, 22]]
1
86
#include <algorithm> #include <assert.h> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iostream> #include <map> #include <memory> #include <queue> #include <set> #include <sstream> #include <stack> #includ...
#include <algorithm> #include <assert.h> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iostream> #include <map> #include <memory> #include <queue> #include <set> #include <sstream> #include <stack> #includ...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
208
#include <bits/stdc++.h> #define repi(i, a, b) for (int i = (int)(a); i < (int)(b); ++i) #define rrepi(i, a, b) for (int i = ((int)(b)-1); i >= (a); --i) #define rep(i, n) repi(i, 0, n) #define rrep(i, n) rrepi(i, 0, n) #define ALL(x) (x).begin(), (x).end() #define SZ(x) ((int)(x).size()) #define ZERO(x) memset(x, 0, s...
#include <bits/stdc++.h> #define repi(i, a, b) for (int i = (int)(a); i < (int)(b); ++i) #define rrepi(i, a, b) for (int i = ((int)(b)-1); i >= (a); --i) #define rep(i, n) repi(i, 0, n) #define rrep(i, n) rrepi(i, 0, n) #define ALL(x) (x).begin(), (x).end() #define SZ(x) ((int)(x).size()) #define ZERO(x) memset(x, 0, s...
[["+", 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
608
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; if (k <= a + b) { cout << min(a, k); } else { cout << (a + b - k); } return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; if (k <= a + b) { cout << min(a, k); } else { cout << (a * 2 + b - k); } return 0; }
[["+", 12, 23, 0, 16, 31, 16, 31, 16, 17, 48], ["+", 12, 23, 0, 16, 31, 16, 31, 16, 12, 13]]
1
66
#include <bits/stdc++.h> using namespace std; #define MOD 1000000007 //#define MOD 998244353 #define INF 1000000010 #define EPS 1e-9 #define F first #define S second #define debug(x) cout << x << endl; #define repi(i, x, n) for (int i = x; i < n; i++) #define rep(i, n) repi(i, 0, n) #define lp(i, n) repi(i, 0, n) #def...
#include <bits/stdc++.h> using namespace std; #define MOD 1000000007 //#define MOD 998244353 #define INF 1000000010 #define EPS 1e-9 #define F first #define S second #define debug(x) cout << x << endl; #define repi(i, x, n) for (int i = x; i < n; i++) #define rep(i, n) repi(i, 0, n) #define lp(i, n) repi(i, 0, n) #def...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
196
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) typedef long long ll; typedef vector<int> vec; //配列の添字ズレに注意 int main() { ll a, b, c, k, ans; cin >> a >> b >> c >> k; // if(k<=a)ans=a; if (k <= a + b) ans = a; else ans = 2 * a - k + b; cout << ans << endl...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) typedef long long ll; typedef vector<int> vec; //配列の添字ズレに注意 int main() { ll a, b, c, k, ans; cin >> a >> b >> c >> k; // if(k<=a)ans=a; if (k <= a + b) ans = min(k, a); else ans = 2 * a - k + b; cout << ans...
[["+", 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
84
#include <bits/stdc++.h> using namespace std; int i, j, k, x, y, z, l, m, n, count1 = 0, count2 = 0; int gcd(int, int); void A(void); void B(void); void C(void); void D(void); void E(void); void F(void); int main(void) { B(); } void B() { int a, b, c; cin >> a >> b >> c >> k; if (k <= a) cout << k << endl; ...
#include <bits/stdc++.h> using namespace std; int i, j, k, x, y, z, l, m, n, count1 = 0, count2 = 0; int gcd(int, int); void A(void); void B(void); void C(void); void D(void); void E(void); void F(void); int main(void) { B(); } void B() { int a, b, c; cin >> a >> b >> c >> k; if (k <= a) cout << k << endl; ...
[["-", 31, 16, 12, 16, 12, 23, 0, 16, 12, 22], ["+", 12, 16, 12, 23, 0, 16, 31, 16, 12, 22], ["+", 31, 16, 12, 16, 12, 23, 0, 16, 17, 33], ["+", 31, 16, 12, 16, 12, 23, 0, 16, 12, 22]]
1
153
A,B,C,K=map(int,input().split()) diff=K-(A+B) if diff>0: print(A-diff) else: print(A)
A,B,C,K=map(int,input().split()) diff=K-(A+B) if diff>0: print(A-diff) else: print(min(K,A))
[["+", 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
46
a,b,c,k = gets.chomp.split(' ').map(&:to_i) if (k > (a+b)) puts a - (k-a-b) else puts a end
a,b,c,k = gets.chomp.split(' ').map(&:to_i) if (k > (a+b)) puts a - (k-a-b) else puts [a,k].min end
[["+", 0, 652, 3, 4, 0, 652, 486, 516, 0, 70], ["+", 0, 652, 3, 4, 0, 652, 486, 516, 0, 21], ["+", 0, 652, 3, 4, 0, 652, 486, 516, 0, 22], ["+", 0, 652, 3, 4, 0, 652, 486, 516, 0, 73], ["+", 75, 95, 0, 652, 3, 4, 0, 652, 17, 131], ["+", 75, 95, 0, 652, 3, 4, 0, 652, 735, 22]]
4
48
import sys sys.setrecursionlimit(10**8) 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())) def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)] def dp2(ini, i, j): return [[ini]*i...
import sys sys.setrecursionlimit(10**8) 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())) def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)] def dp2(ini, i, j): return [[ini]*i...
[["+", 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
209
a, b, c, k = [int(i) for i in input().split()] if a + b <= k: print(a - (k - a - b)) else: print(max(a, k))
a, b, c, k = [int(i) for i in input().split()] if a + b <= k: print(a - (k - a - b)) else: print(min(a, k))
[["-", 0, 1, 0, 652, 3, 4, 0, 652, 63, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 652, 63, 22]]
5
54
a, b, c, k = list(map(int, input().split())) if k <= a + b: print(a) else: print(a - (k - a - b))
a, b, c, k = list(map(int, input().split())) if k <= a + b: print(min(k, a)) else: print(a - (k - a - b))
[["+", 0, 1, 0, 652, 3, 4, 0, 652, 63, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 21], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
48
a, b, c, k = list(map(int, input().split())) print(a - max((k - (a + b), 0)))
a, b, c, k = list(map(int, input().split())) print(min(a, k) - max((k - (a + b), 0)))
[["+", 0, 652, 3, 4, 0, 657, 31, 652, 63, 22], ["+", 3, 4, 0, 657, 31, 652, 3, 4, 0, 24], ["+", 3, 4, 0, 657, 31, 652, 3, 4, 0, 21], ["+", 3, 4, 0, 657, 31, 652, 3, 4, 0, 22], ["+", 3, 4, 0, 657, 31, 652, 3, 4, 0, 25]]
5
42
#include <bits/stdc++.h> #include <cstdint> #include <vector> #define FOR(i, l, r) for (int i = (l); i < (r); ++i) #define RFOR(i, l, r) for (int i = (l); i >= (int)(r); i--) #define rep(i, n) FOR(i, 0, n) #define rrep(i, n) RFOR(i, n - 1, 0) #define int long long using namespace std; const int MX = 1e6; const int inf...
#include <bits/stdc++.h> #include <cstdint> #include <vector> #define FOR(i, l, r) for (int i = (l); i < (r); ++i) #define RFOR(i, l, r) for (int i = (l); i >= (int)(r); i--) #define rep(i, n) FOR(i, 0, n) #define rrep(i, n) RFOR(i, n - 1, 0) #define int long long using namespace std; const int MX = 1e6; const int inf...
[["+", 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
146
A, B, C, K = gets.split.map{|i|i.to_i} puts([A, K].min - [C, K - A - B].min)
A, B, C, K = gets.split.map{|i|i.to_i} puts([A, K].min - [0, K - A - B].max)
[["-", 3, 4, 0, 738, 12, 652, 486, 516, 0, 743], ["+", 3, 4, 0, 738, 12, 652, 486, 516, 0, 612], ["-", 0, 652, 3, 4, 0, 738, 12, 652, 735, 22], ["+", 0, 652, 3, 4, 0, 738, 12, 652, 735, 22]]
4
43
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pii> vii; #define F first #define S second #define sz(x) (int)x.size() #define db(x) cerr << #x << ": " << x << "\n"; int main() { ios::sync_with_stdio(false); cin.tie(0); int ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pii> vii; #define F first #define S second #define sz(x) (int)x.size() #define db(x) cerr << #x << ": " << x << "\n"; int main() { ios::sync_with_stdio(false); cin.tie(0); ll A...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 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
124
#include <bits/stdc++.h> using namespace std; int main() { int A, B, C, K; cin >> A >> B >> C >> K; int ans = 0; ans += min(A, K); ans -= K - A - B; cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int A, B, C, K; cin >> A >> B >> C >> K; int ans = 0; ans += min(A, K); ans -= max(0, K - A - B); cout << ans << endl; }
[["+", 8, 9, 0, 1, 0, 11, 12, 2, 63, 22], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 24], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 13], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 21], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 25]]
1
59
#include <algorithm> #include <array> #include <bitset> #include <cmath> #include <complex> #include <cstdio> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <limits> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vec...
#include <algorithm> #include <array> #include <bitset> #include <cmath> #include <complex> #include <cstdio> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <limits> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vec...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
316
#include <bits/stdc++.h> using namespace std; #define ll long long #define ld long double int main() { ll a, b, c, k; cin >> a >> b >> c >> k; if (k < a) { cout << k; return 0; } else if (k < (a + b)) { cout << a; return 0; } else if (k < (a + b + c)) { cout << a - (k - (a + b)); retur...
#include <bits/stdc++.h> using namespace std; #define ll long long #define ld long double int main() { ll a, b, c, k; cin >> a >> b >> c >> k; if (k < a) { cout << k; return 0; } else if (k < (a + b)) { cout << a; return 0; } else if (k < (a + b + c)) { cout << a - (k - (a + b)); retur...
[["-", 0, 9, 0, 1, 0, 16, 12, 16, 31, 22], ["+", 0, 9, 0, 1, 0, 16, 12, 16, 31, 22]]
1
113
// This code wrote by chtholly_micromaker(MicroMaker) #include <bits/stdc++.h> #define reg register #define int long long using namespace std; template <class t> inline void read(t &s) { s = 0; reg int f = 1; reg char c = getchar(); while (!isdigit(c)) { if (c == '-') f = -1; c = getchar(); } ...
// This code wrote by chtholly_micromaker(MicroMaker) #include <bits/stdc++.h> #define reg register #define int long long using namespace std; template <class t> inline void read(t &s) { s = 0; reg int f = 1; reg char c = getchar(); while (!isdigit(c)) { if (c == '-') f = -1; c = getchar(); } ...
[["+", 8, 9, 0, 57, 75, 76, 0, 57, 0, 121], ["+", 0, 57, 75, 76, 0, 57, 15, 339, 0, 24], ["+", 75, 76, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 75, 76, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 75, 76, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 0, 57, 75, 76, 0, 57, 15, 339, 0, 25]]
1
192
#include <stdio.h> #define ll long long int main() { ll k, a, b, c; scanf("%lld%lld%lld%lld", &a, &b, &c, &k); ll ans; if (k <= a) { ans = a; } else { if (k < a + b) { ans = a; } else { ll p = k - a - b; ans = a - p; } } printf("%lld\n", ans); return 0; }
#include <stdio.h> #define ll long long int main() { ll k, a, b, c; scanf("%lld%lld%lld%lld", &a, &b, &c, &k); ll ans; if (k <= a) { ans = k; } else { if (k < a + b) { ans = a; } else { ll p = k - a - b; ans = a - p; } } printf("%lld\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
102
#include <algorithm> #include <cmath> #include <iostream> #include <vector> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; int r = 0; if (k < a) { r = k; } else if (k <= a + b) { r = a; } else { r = a - (r - a + b); } cout << r << endl; return 0; }
#include <algorithm> #include <cmath> #include <iostream> #include <vector> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; int r = 0; if (k <= a) { r = k; } else if (k <= a + b) { r = a; } else { r = a - (k - a - b); } cout << r << endl; return 0; }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["-", 12, 16, 12, 23, 0, 16, 31, 16, 31, 22], ["+", 12, 16, 12, 23, 0, 16, 31, 16, 31, 22], ["-", 0, 11, 12, 16, 12, 23, 0, 16, 17, 72], ["+", 0, 11, 12, 16, 12, 23, 0, 16, 17, 33]]
1
93
//#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; i < (n); i++) #define all(v) v.begin(), v.end() #define allr(v) v.rbegin(), v.rend() int main() { int a, b, c, k; cin >> a >> b >> c >> k; if (k <= a + b) { cout << a << endl; re...
//#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; i < (n); i++) #define all(v) v.begin(), v.end() #define allr(v) v.rbegin(), v.rend() int main() { ll a, b, c, k; cin >> a >> b >> c >> k; if (k <= a + b) { cout << min(k, a) << endl;...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 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
94
#include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; using st = string; using ch = char; using db = double; using bl = bool; using vll = vector<long long>; using vdb = vector<db>; using vst = vector<st>; using vch = vector<char>; using vbl = vector<bl>; using vvll = vecto...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; using st = string; using ch = char; using db = double; using bl = bool; using vll = vector<long long>; using vdb = vector<db>; using vst = vector<st>; using vch = vector<char>; using vbl = vector<bl>; using vvll = vecto...
[["-", 0, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 0, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
318
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]]
5
59
#include <bits/stdc++.h> #define MOD (long long)(1E9 + 7) #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 (a >= k) { cout << a << endl; } else { k -= a + b; if (k < 0) cout << a << endl; else cout << a - k ...
#include <bits/stdc++.h> #define MOD (long long)(1E9 + 7) #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 (a >= k) { cout << k << endl; } else { k -= a + b; if (k < 0) cout << a << endl; else cout << a - k ...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
86
#include <bits/stdc++.h> #define ll long long #define IOS \ std::ios::sync_with_stdio(false); \ cin.tie(0); #define rep(i, init, n) for (int i = init; i < n; i++) #define pb push_back #define mp make_pair #...
#include <bits/stdc++.h> #define ll long long #define IOS \ std::ios::sync_with_stdio(false); \ cin.tie(0); #define rep(i, init, n) for (int i = init; i < n; i++) #define pb push_back #define mp make_pair #...
[["-", 75, 76, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 75, 76, 0, 57, 15, 339, 51, 16, 17, 19]]
1
330
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, a, b) for (int i = a; i < (int)(b); i++) #define all(v) v.begin(), v.end() const int MOD = 1e9 + 7; const int INF = 1e9; //'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122 int main() { ll a, b, c, k; cin >> a >> b >> c >> k; ll ans = 0; ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, a, b) for (int i = a; i < (int)(b); i++) #define all(v) v.begin(), v.end() const int MOD = 1e9 + 7; const int INF = 1e9; //'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122 int main() { ll a, b, c, k; cin >> a >> b >> c >> k; ll ans = 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, 21], ["+", 64, 1, 0, 11, 12, 2, 3, 4, 0, 22], ["+", 64, 1, 0, 11, 12, 2, 3, 4, 0, 25]]
1
108
// We only fail when we stop trying #include <bits/stdc++.h> using namespace std; #define pb push_back #define mp make_pair #define endl '\n' #define D(x) cerr << #x << " = " << (x) << '\n' #define sz(x) ((int)(x).size()) #define all(x) (x).begin(), (x).end() typedef long long ll; int main() { int a, b, c, k; cin ...
// We only fail when we stop trying #include <bits/stdc++.h> using namespace std; #define pb push_back #define mp make_pair #define endl '\n' #define D(x) cerr << #x << " = " << (x) << '\n' #define sz(x) ((int)(x).size()) #define all(x) (x).begin(), (x).end() typedef long long ll; int main() { int a, b, c, k; cin ...
[["-", 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()) t = min(k,a) k -= min(k,a) if k: k -= b if k > 0: t -= min(k) print(t)
a,b,c,k = map(int, input().split()) t = min(k,a) k -= min(k,a) if k: k -= b if k > 0: t -= k print(t)
[["-", 64, 196, 0, 1, 0, 677, 12, 652, 63, 22], ["-", 0, 1, 0, 677, 12, 652, 3, 4, 0, 24], ["-", 0, 1, 0, 677, 12, 652, 3, 4, 0, 25]]
5
57
#include <bits/stdc++.h> #include <chrono> using namespace std; using ll = long long; using ld = long double; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define repl(i, n) for (ll i = 0; i < (ll)(n); i++) #define rep2(i, s, n) for (int i = (s); i < (int)(n); i++) #define rep2l(i, s, n) for (ll i = (ll)(s); i ...
#include <bits/stdc++.h> #include <chrono> using namespace std; using ll = long long; using ld = long double; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define repl(i, n) for (ll i = 0; i < (ll)(n); i++) #define rep2(i, s, n) for (int i = (s); i < (int)(n); i++) #define rep2l(i, s, n) for (ll i = (ll)(s); i ...
[["+", 0, 16, 31, 16, 12, 16, 31, 16, 17, 72], ["+", 0, 16, 31, 16, 12, 16, 31, 16, 12, 22]]
1
145
A, B, C, K = map(int, input().split()) if K <= A: print(A) elif K <= A+B: print(A) elif K > A+B: print(A-(K-(A+B)))
A, B, C, K = map(int, input().split()) if K <= A: print(K) elif K <= A+B: print(A) elif K > A+B: print(A-(K-(A+B)))
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
61
#include <algorithm> #include <iostream> #include <map> #include <set> #include <utility> #include <vector> #define N (1000000000 + 7) using namespace std; typedef long long ll; typedef pair<int, ll> P; int main(void) { ll a, b, c, k; cin >> a >> b >> c >> k; if (a >= k) cout << a << endl; else { ll an...
#include <algorithm> #include <iostream> #include <map> #include <set> #include <utility> #include <vector> #define N (1000000000 + 7) using namespace std; typedef long long ll; typedef pair<int, ll> P; int main(void) { ll a, b, c, k; cin >> a >> b >> c >> k; if (a >= k) cout << k << endl; else { ll an...
[["-", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22], ["+", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22]]
1
113
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)) if __name__ == "__main__": main()
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)) 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
69