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
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int a = scanner.nextInt(); int b = scanner.nextInt(); int c = scanner.nextInt(); int k = scanner.nextInt(); int sum = 0; if (a <= k) { sum += a; k ...
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int a = scanner.nextInt(); int b = scanner.nextInt(); int c = scanner.nextInt(); int k = scanner.nextInt(); int sum = 0; if (a <= k) { sum += a; k ...
[["-", 0, 195, 8, 196, 0, 1, 0, 11, 12, 22], ["-", 8, 498, 0, 195, 8, 196, 0, 1, 0, 35], ["-", 0, 195, 8, 196, 0, 1, 0, 11, 31, 22], ["-", 0, 195, 8, 196, 0, 1, 0, 11, 17, 32], ["-", 8, 196, 0, 1, 0, 11, 12, 16, 17, 33], ["-", 8, 196, 0, 1, 0, 11, 12, 16, 12, 22]]
3
197
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long A = sc.nextLong(); long B = sc.nextLong(); long C = sc.nextLong(); long K = sc.nextLong(); sc.close(); long aCount = 0; long bCount = 0; long cCount = 0; ...
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long A = sc.nextLong(); long B = sc.nextLong(); long C = sc.nextLong(); long K = sc.nextLong(); sc.close(); long aCount = 0; long bCount = 0; long cCount = 0; ...
[["+", 0, 57, 75, 196, 0, 1, 0, 11, 31, 22], ["+", 0, 57, 75, 196, 0, 1, 0, 11, 17, 110], ["+", 0, 57, 75, 196, 0, 1, 0, 11, 12, 22], ["+", 75, 196, 0, 57, 75, 196, 0, 1, 0, 35]]
3
156
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pi; void solve() { ll a, b, c, k; cin >> a >> b >> c >> k; if (a <= k) { cout << a << "\n"; } else if (k <= a + b) { cout << a << "\n"; } else { cout << a - (k - a - b) << "\n"; } } int main() { ios::...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pi; void solve() { ll a, b, c, k; cin >> a >> b >> c >> k; if (k <= a) { cout << k << "\n"; } else if (k <= a + b) { cout << a << "\n"; } else { cout << a - (k - a - b) << "\n"; } } int main() { ios::...
[["-", 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], ["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
126
#include <bits/stdc++.h> #define ff \ { \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); ...
#include <bits/stdc++.h> #define ff \ { \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); ...
[["+", 0, 14, 8, 9, 0, 57, 75, 76, 0, 95], ["+", 0, 57, 75, 76, 0, 1, 0, 11, 31, 22], ["+", 0, 57, 75, 76, 0, 1, 0, 11, 17, 32], ["+", 0, 57, 75, 76, 0, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 57, 75, 76, 0, 1, 0, 35]]
1
127
#include <iostream> using namespace std; #define li long long int int main() { int a, b, c, k, sum = 0; cin >> a >> b >> c >> k; if (k <= a) cout << a << endl; else if (k <= a + b) cout << a << endl; else cout << a - (k - a - b) << endl; return 0; }
#include <iostream> using namespace std; #define li long long int int main() { int a, b, c, k, sum = 0; cin >> a >> b >> c >> k; if (k <= a) cout << k << endl; else if (k <= a + b) cout << a << endl; else cout << a - (k - a - b) << endl; return 0; }
[["-", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22], ["+", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22]]
1
83
a, b, c, k = map(int, input().split()) if k >= a: r = k - a if r >= b: r = r - b print(a-r) else: print(a) else: print(a)
a, b, c, k = map(int, input().split()) if k >= a: r = k - a if r >= b: r = r - b print(a-r) else: print(a) else: print(k)
[["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
58
#include <algorithm> #include <cstdio> #include <iomanip> #include <iostream> #include <list> #include <map> #include <math.h> #include <numeric> #include <sstream> #include <stack> #include <stdio.h> #include <string> #include <unordered_map> #include <vector> typedef long long ll; #define pi 3.14159265358979323846 #...
#include <algorithm> #include <cstdio> #include <iomanip> #include <iostream> #include <list> #include <map> #include <math.h> #include <numeric> #include <sstream> #include <stack> #include <stdio.h> #include <string> #include <unordered_map> #include <vector> typedef long long ll; #define pi 3.14159265358979323846 #...
[["-", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22], ["+", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22]]
1
544
// I SELL YOU...! #include <algorithm> #include <chrono> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <vector> using namespace std; using ll = long long; using P = pair<ll, ll>; using TP = tuple<ll, ll, ll>; void init_io() { cin.tie(0); ios::sy...
// I SELL YOU...! #include <algorithm> #include <chrono> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <vector> using namespace std; using ll = long long; using P = pair<ll, ll>; using TP = tuple<ll, ll, ll>; void init_io() { cin.tie(0); ios::sy...
[["-", 0, 1, 0, 11, 12, 2, 3, 4, 0, 22], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 22]]
1
169
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, c, k; cin >> a >> b >> c >> k; if (a + b >= k) cout << k; else cout << a - (k - a - b); }
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, c, k; cin >> a >> b >> c >> k; if (a + b >= k) cout << min(a, k); else cout << a - (k - a - b); }
[["+", 0, 57, 64, 1, 0, 16, 12, 2, 63, 22], ["+", 64, 1, 0, 16, 12, 2, 3, 4, 0, 24], ["+", 64, 1, 0, 16, 12, 2, 3, 4, 0, 22], ["+", 64, 1, 0, 16, 12, 2, 3, 4, 0, 21], ["+", 64, 1, 0, 16, 12, 2, 3, 4, 0, 25]]
1
57
a,b,c,k = map(int, input().split()) s = 0 if k < a: s += k k = 0 else: s += a k -= a k -= b if k < c and k > 0: s -= k print(s)
a,b,c,k = map(int, input().split()) s = 0 if k < a: s += k k = 0 else: s += a k -= a k -= b if k <= c and k > 0: s -= k print(s)
[["-", 0, 656, 0, 57, 15, 679, 31, 666, 667, 18], ["+", 0, 656, 0, 57, 15, 679, 31, 666, 667, 19]]
5
61
/* * ~ AtCoder Botay ~ * code by kazalika */ #include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int a, b, c, k; cin >> a >> b >> c >> k; if (k <= a + b) cout << k; else cout << a - (k - (a + b)); }
/* * ~ AtCoder Botay ~ * code by kazalika */ #include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int a, b, c, k; cin >> a >> b >> c >> k; if (k <= a + b) cout << min(a, k); else cout << a - (k - (a + b)); }
[["+", 0, 57, 64, 1, 0, 16, 12, 2, 63, 22], ["+", 64, 1, 0, 16, 12, 2, 3, 4, 0, 24], ["+", 64, 1, 0, 16, 12, 2, 3, 4, 0, 22], ["+", 64, 1, 0, 16, 12, 2, 3, 4, 0, 21], ["+", 64, 1, 0, 16, 12, 2, 3, 4, 0, 25]]
1
73
A,B,C,K=map(int,input().split()) cntC=K-(A+B) if A >= K or A+B >= K: max=A else: max = A - (cntC) print(max)
A,B,C,K=map(int,input().split()) cntC=K-(A+B) if A >= K: max = K elif A+B >= K: max=A else: max = A - (cntC) print(max)
[["-", 36, 36, 0, 656, 0, 57, 15, 679, 17, 354], ["+", 36, 36, 36, 36, 0, 656, 0, 57, 0, 102], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 0, 32], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 12, 22], ["+", 36, 36, 0, 656, 0, 57, 75, 665, 0, 683]]
5
56
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define rep2(i, s, n) for (int i = (s); i < (int)(n); i++) using namespace std; int main() { int a, b, c, k, sum = 0; cin >> a >> b >> c >> k; // cout << a << b << c << k << endl; int xa = min(k, a); k -= xa; sum += xa; if (k > 0)...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define rep2(i, s, n) for (int i = (s); i < (int)(n); i++) using namespace std; int main() { int a, b, c, k, sum = 0; cin >> a >> b >> c >> k; // cout << a << b << c << k << endl; int xa = min(k, a); k -= xa; sum += xa; if (k > 0)...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
115
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int one = Integer.parseInt(sc.next()); int zero = Integer.parseInt(sc.next()); int min = Integer.parseInt(sc.next()); int count = Integer.parseInt(sc.next()); int time ...
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int one = Integer.parseInt(sc.next()); int zero = Integer.parseInt(sc.next()); int min = Integer.parseInt(sc.next()); int count = Integer.parseInt(sc.next()); int time ...
[["-", 64, 196, 0, 1, 0, 492, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 492, 3, 4, 0, 22], ["-", 75, 196, 0, 1, 0, 492, 3, 4, 0, 22], ["+", 75, 196, 0, 1, 0, 492, 3, 4, 0, 22]]
3
176
#include <iostream> using namespace std; int a, b, c, k; void input() { cin >> a >> b >> c >> k; } int max() { int ans = 0, tmp = 0; if (a >= k) ans = a; else { tmp = a; k -= a; if (b >= k) ans = tmp; else { tmp += 0; k -= b; ans = tmp - k; } } return ans; }...
#include <iostream> using namespace std; int a, b, c, k; void input() { cin >> a >> b >> c >> k; } int max() { int ans = 0, tmp = 0; if (a >= k) ans = k; else { tmp = a; k -= a; if (b >= k) ans = tmp; else { tmp += 0; k -= b; ans = tmp - k; } } return ans; }...
[["-", 8, 9, 0, 57, 64, 1, 0, 11, 12, 22], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 12, 22]]
1
118
a, b, c, k = map(int, input().split()) if a >= k: print(k) elif a + b >= k: print(a) else: print(2*a-k)
a, b, c, k = map(int, input().split()) if a >= k: print(k) elif a + b >= k: print(a) else: print(2*a+b-k)
[["+", 0, 652, 3, 4, 0, 657, 31, 657, 17, 72], ["+", 0, 652, 3, 4, 0, 657, 31, 657, 12, 22]]
5
50
import sys readmi = lambda: map(int, sys.stdin.readline().split()) A, B, C, K = readmi() # result var max_sum = 0 # check 1 max_sum = min(A, K) K = K - max_sum # check 0 if K > 0: K = K - min(B, K) # check - 1 if K > 0: max_sum = max_sum - min(K, B) # print result print(max_sum)
import sys readmi = lambda: map(int, sys.stdin.readline().split()) A, B, C, K = readmi() # result var max_sum = 0 # check 1 max_sum = min(A, K) K = K - max_sum # check 0 if K > 0: K = K - min(B, K) # check - 1 if K > 0: max_sum = max_sum - min(K, C) # print result print(max_sum)
[["-", 0, 662, 12, 657, 12, 652, 3, 4, 0, 22], ["+", 0, 662, 12, 657, 12, 652, 3, 4, 0, 22]]
5
88
A,B,C,K=map(int,input().split()) ans=0 if A>=K: ans=A elif A<K and K<=A+B: ans=A else : ans=A-(K-A-B) print(ans)
A,B,C,K=map(int,input().split()) ans=0 if A>=K: ans=K elif A<K and K<=A+B: ans=A else : ans=A-(K-A-B) print(ans)
[["-", 0, 57, 64, 196, 0, 1, 0, 662, 12, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 12, 22]]
5
62
a, b, c, k = map(int, input().split()) ans = 0 if a > k: ans += 1*k k = 0 else: ans += 1*a k -= a if b > k: ans += 0*k k = 0 else: ans += 0*b k -= b if c > k: ans += 0*k k = 0 else: ans += 0*c k -= c print(ans)
a, b, c, k = map(int, input().split()) ans = 0 if a > k: ans += 1*k k = 0 else: ans += 1*a k -= a if b > k: ans += 0*k k = 0 else: ans += 0*b k -= b if c > k: ans += -1*k k = 0 else: ans += -1*c k -= c print(ans)
[["-", 64, 196, 0, 1, 0, 677, 12, 657, 31, 612], ["+", 0, 1, 0, 677, 12, 657, 31, 664, 17, 33], ["+", 0, 1, 0, 677, 12, 657, 31, 664, 28, 612], ["-", 8, 196, 0, 1, 0, 677, 12, 657, 31, 612]]
5
96
A, B, C, K = map(int, input().split()) def solve(A,B,C,K): if K <= A: return K elif A < K < A + B: return A else: return K - 2*A - B print(solve(A,B,C,K))
A, B, C, K = map(int, input().split()) def solve(A,B,C,K): if K <= A: return K elif A < K <= A + B: return A else: return 2*A + B - K print(solve(A,B,C,K))
[["-", 8, 196, 0, 57, 75, 665, 15, 666, 667, 18], ["+", 8, 196, 0, 57, 75, 665, 15, 666, 667, 19], ["-", 8, 196, 0, 37, 0, 657, 31, 657, 31, 22], ["-", 8, 196, 0, 37, 0, 657, 31, 657, 17, 33], ["-", 75, 76, 8, 196, 0, 37, 0, 657, 17, 33], ["+", 8, 196, 0, 37, 0, 657, 31, 657, 17, 72], ["+", 75, 76, 8, 196, 0, 37, 0, 65...
5
73
#include <bits/stdc++.h> typedef long long ll; using namespace std; int main() { ll a, b, c, k; cin >> a >> b >> c >> k; ll ans = 0; if (k <= a) cout << a << endl; else if (k <= a + b) cout << a << endl; else cout << a - (k - a - b) << endl; }
#include <bits/stdc++.h> typedef long long ll; using namespace std; int main() { ll a, b, c, k; cin >> a >> b >> c >> k; if (k <= a) cout << k << endl; else if (k <= a + b) cout << a << endl; else cout << a - (k - a - b) << endl; }
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["-", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22], ["+", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22]]
1
83
#include <iostream> using namespace std; int main() { long long a, b, c, k; cin >> a >> b >> c >> k; if (k <= a) cout << a << endl; else if (k <= a + b) cout << a << endl; else if (k <= a + b + c) cout << a - (k - a - b) << endl; return 0; }
#include <iostream> using namespace std; int main() { long long a, b, c, k; cin >> a >> b >> c >> k; if (k <= a) cout << k << endl; else if (k <= a + b) cout << a << endl; else if (k <= a + b + c) cout << a - (k - a - b) << endl; return 0; }
[["-", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22], ["+", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22]]
1
87
l = [int(i) for i in input().split()] num = [1,0,-1] c = 0 s = 0 k = l[-1] for i in range(3): if c + l[i] > k: s += num[i] *(k-c) else: s += l[i] * num[i] c+=l[i] print(s)
l = [int(i) for i in input().split()] num = [1,0,-1] c = 0 s = 0 k = l[-1] for i in range(3): if c + l[i] > k: s += num[i] *(k-c) break else: s += l[i] * num[i] c+=l[i] print(s)
[["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94]]
5
94
#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 << a << endl; } else if (a < k && k <= a + b) { cout << a << endl; } else { cout << 2 * a + b - k << 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 (a < k && k <= a + b) { cout << a << endl; } else { cout << 2 * a + b - k << endl; } }
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
83
#include <iostream> int main() { int a, b, c, k, i; scanf("%d %d d %d", &a, &b, &c, &k); if (k <= a) { printf("%d", k); } else if (k <= a + b) { printf("%d", a); } else { c = k - (a + b); i = a - c; printf("%d", i); } }
#include <iostream> int main() { int a, b, c, k, i; scanf("%d %d %d %d", &a, &b, &c, &k); if (k <= a) { printf("%d", k); } else if (k <= a + b) { printf("%d", a); } else { c = k - (a + b); i = a - c; printf("%d", i); } }
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
103
#include <bits/stdc++.h> #define pb push_back #define FAST_IO ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL) typedef long long ll; using namespace std; int main() { FAST_IO; int a, b, c, k; cin >> a >> b >> c >> k; if (k <= a) { cout << k << endl; } if (k <= (a + b)) { cout << a ...
#include <bits/stdc++.h> #define pb push_back #define FAST_IO ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL) typedef long long ll; using namespace std; int main() { FAST_IO; int a, b, c, k; cin >> a >> b >> c >> k; if (k <= a) { cout << k << endl; } else if (k <= (a + b)) { cout <<...
[["+", 0, 14, 8, 9, 0, 57, 75, 76, 0, 95]]
1
98
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = 0; int b = 0; int c = 0; int d = 0; int score = 0; a = sc.nextInt(); b = sc.nextInt(); c = sc.nextInt(); d = sc.nextInt(); if (d - a - b <=...
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = 0; int b = 0; int c = 0; int d = 0; int score = 0; a = sc.nextInt(); b = sc.nextInt(); c = sc.nextInt(); d = sc.nextInt(); if (d - a - b <=...
[["-", 0, 57, 64, 196, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 11, 12, 22]]
3
174
nums = [int(e) for e in input().split()] if nums[0]<nums[3]: max=nums[0] if nums[0]+nums[1]<nums[3]: max -= (nums[3]- nums[0]+nums[1]) else: max=nums[3] print(max)
nums = [int(e) for e in input().split()] if nums[0]<nums[3]: max=nums[0] if nums[0]+nums[1]<nums[3]: max -= (nums[3]- (nums[0]+nums[1])) else: max=nums[3] print(max)
[["+", 0, 677, 12, 23, 0, 657, 12, 23, 0, 24], ["+", 0, 677, 12, 23, 0, 657, 12, 23, 0, 25]]
5
81
a, b, c, k = map(int, input().split()) max_total = 0 if k <= a: print(k) elif k <= a+b: print(a) else: print(2 * a - k)
a, b, c, k = map(int, input().split()) max_total = 0 if k <= a: print(k) elif k <= a+b: print(a) else: print(2 * a - k + b)
[["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 12, 22]]
5
53
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; if (k <= a) cout << a; if (k > a && k <= a + b) cout << a; if (k > a + b) cout << a - (k - (a + b)); return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; if (k <= a) cout << k; if (k > a && k <= a + b) cout << a; if (k > a + b) 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
82
A,B,C,K=map(int,input().split()) if A>=K: print(K) elif A+B>=K: print(A) elif A+B+C>K: print(A+(K-A-B)*(-1))
A,B,C,K=map(int,input().split()) if A>=K: print(K) elif A+B>=K: print(A) elif A+B+C>=K: print(A+(K-A-B)*(-1))
[["-", 0, 656, 0, 57, 75, 665, 15, 666, 667, 47], ["+", 0, 656, 0, 57, 75, 665, 15, 666, 667, 20]]
5
66
#include <bits/stdc++.h> using namespace std; #define ll long long int main() { ll a, b, c, k; cin >> a >> b >> c >> k; ll ans = 0; ans = a; k -= a; if (k > 0) { k -= b; } if (k > 0) { ans -= k; } cout << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; #define ll long long int main() { ll a, b, c, k; cin >> a >> b >> c >> k; ll ans = 0; ans = min(a, k); k -= a; if (k > 0) { k -= b; } if (k > 0) { ans -= k; } cout << ans << endl; return 0; }
[["+", 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
80
#include <bits/stdc++.h> #define _GLIBCXX_DEBUG #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; int main() { ll a, b, c, k, ans; cin >> a >> b >> c >> k; /*ans=min(a,k); k-=min(a,k); k-=min(b,k); ans-=min(c,k); cout<<ans<<endl;*/ if...
#include <bits/stdc++.h> #define _GLIBCXX_DEBUG #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; int main() { ll a, b, c, k, ans; cin >> a >> b >> c >> k; /*ans=min(a,k); k-=min(a,k); k-=min(b,k); ans-=min(c,k); cout<<ans<<endl;*/ if...
[["+", 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
113
#include <bits/stdc++.h> using namespace std; void solve(long long A, long long B, long long C, long long K) { if (A >= K) cout << A << endl; else if ((A + B >= K) && (A < K)) cout << A << endl; else if ((A + B + C >= K) && (A + B < K)) cout << A - (K - B - A) << endl; } int main() { long long A; ...
#include <bits/stdc++.h> using namespace std; void solve(long long A, long long B, long long C, long long K) { if (A >= K) cout << K << endl; else if ((A + B >= K) && (A < K)) cout << A << endl; else if ((A + B + C >= K) && (A + B < K)) cout << A - (K - B - A) << endl; } int main() { long long A; ...
[["-", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22], ["+", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22]]
1
173
#include <bits/stdc++.h> 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; } } return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; if (a >= k) { cout << k << endl; } else { if (a + b >= k) { cout << a << endl; } else { cout << a - (k - a - b) << endl; } } return 0; }
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
84
#include <iostream> using namespace std; long a, b, c, k, ans; int main() { cin >> a >> b >> c >> k; cout << (min(a, k) - min(c, k - a - b)); }
#include <iostream> using namespace std; long a, b, c, k, ans; int main() { cin >> a >> b >> c >> k; cout << (min(a, k) - min(c, max(0L, k - a - b))); }
[["+", 0, 16, 12, 2, 3, 4, 0, 2, 63, 22], ["+", 12, 2, 3, 4, 0, 2, 3, 4, 0, 24], ["+", 12, 2, 3, 4, 0, 2, 3, 4, 0, 13], ["+", 12, 2, 3, 4, 0, 2, 3, 4, 0, 21], ["+", 12, 2, 3, 4, 0, 2, 3, 4, 0, 25]]
1
55
#include <algorithm> #include <bitset> #include <cmath> #include <complex> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <utilit...
#include <algorithm> #include <bitset> #include <cmath> #include <complex> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <utilit...
[["-", 0, 57, 64, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 16, 12, 22]]
1
189
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) const int INF = 1001001001; int main() { long long int a, b, c, k; cin >> a >> b >> c >> k; if (k <= a) { cout << a << endl; } else { if (k <= a + b) { cout << a << endl; } else { long lon...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) const int INF = 1001001001; 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 { long lon...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
102
#include <iostream> using namespace std; int main() { long long A, B, C, K, ans = 0; cin >> A >> B >> C >> K; if (K > A) { K -= A; ans += A; if (K > B) { K -= B; ans -= K; } } else { ans = A; } cout << ans; }
#include <iostream> using namespace std; int main() { long long A, B, C, K, ans = 0; cin >> A >> B >> C >> K; if (K > A) { K -= A; ans += A; if (K > B) { K -= B; ans -= K; } } else { ans = K; } cout << ans; }
[["-", 75, 76, 0, 9, 0, 1, 0, 11, 12, 22], ["+", 75, 76, 0, 9, 0, 1, 0, 11, 12, 22]]
1
79
#include <iostream> using namespace std; int main() { long a, b, c, k; cin >> a >> b >> c >> k; long sum; long thre1 = a, thre2 = a + b; if (k <= thre1) sum = a; else if (thre1 < k && k <= thre2) sum = a; else sum = a - (k - a - b); cout << sum << endl; }
#include <iostream> using namespace std; int main() { long a, b, c, k; cin >> a >> b >> c >> k; long sum; long thre1 = a, thre2 = a + b; if (k <= thre1) sum = k; else if (thre1 < k && k <= thre2) sum = a; else sum = a - (k - a - b); cout << sum << endl; }
[["-", 8, 9, 0, 57, 64, 1, 0, 11, 12, 22], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 12, 22]]
1
89
#include <iostream> int main() { int A, B, C, K, ans; std::cin >> A >> B >> C >> K; if (A >= K) { ans = A; } else { // A < K if (A + B >= K) { ans = A; } else // A+B < K, K-(A+B) cards from C { ans = A - (K - (A + B)); } } std::cout << ans << std::endl; return 0; }
#include <iostream> int main() { int A, B, C, K, ans; std::cin >> A >> B >> C >> K; if (A >= K) { ans = K; } else { // A < K if (A + B >= K) { ans = A; } else // A+B < K, K-(A+B) cards from C { ans = A - (K - (A + B)); } } std::cout << ans << std::endl; return 0; }
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22]]
1
92
import sys A, B, C, K = map(int, input().split()) c = 0 if K <= A: c += A print(c) sys.exit() else: c += A K -= A if K <= B: print(c) sys.exit() else: K -= B c -= K print(c)
import sys A, B, C, K = map(int, input().split()) c = 0 if K <= A: c += K print(c) sys.exit() else: c += A K -= A if K <= B: print(c) sys.exit() else: K -= B c -= K print(c)
[["-", 0, 57, 64, 196, 0, 1, 0, 677, 12, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 677, 12, 22]]
5
76
A,B,C,K = map(int,input().split()) if A >= K: print(K) elif A+B >= K: print(A) else: print(2*A-B-K)
A,B,C,K = map(int,input().split()) if A >= K: print(K) elif A+B >= K: print(A) else: print(2*A+B-K)
[["-", 0, 652, 3, 4, 0, 657, 31, 657, 17, 33], ["+", 0, 652, 3, 4, 0, 657, 31, 657, 17, 72]]
5
52
#include <bits/stdc++.h> using namespace std; int main(int argc, char const *argv[]) { ios::sync_with_stdio(0); cin.tie(0); int arr[3], k; for (int i = 0; i < 3; i++) cin >> arr[i]; cin >> k; int count = 0; for (int i = 0; i < 3; i++) { if (k <= 0) break; if (k - arr[i] >= 0) { if...
#include <bits/stdc++.h> using namespace std; int main(int argc, char const *argv[]) { ios::sync_with_stdio(0); cin.tie(0); int arr[3], k; for (int i = 0; i < 3; i++) cin >> arr[i]; cin >> k; int count = 0; for (int i = 0; i < 3; i++) { if (k <= 0) break; if (k - arr[i] >= 0) { if...
[["-", 64, 1, 0, 11, 12, 16, 31, 69, 28, 22], ["-", 0, 11, 12, 16, 31, 69, 341, 342, 0, 70], ["-", 0, 11, 12, 16, 31, 69, 341, 342, 0, 22], ["-", 0, 11, 12, 16, 31, 69, 341, 342, 0, 73], ["-", 0, 57, 64, 1, 0, 11, 12, 16, 17, 33]]
1
188
A, B, C, K = map(int, input().split()) a = min(A, K) K -= a b = min(a, K) K -= b c = K print(a-c)
A, B, C, K = map(int, input().split()) a = min(A, K) K -= a b = min(B, K) K -= b c = K print(a-c)
[["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22]]
5
51
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) elif a <= k<= a+b: print(a) else: print(a-(k-a-b))
[["-", 36, 36, 36, 36, 0, 656, 0, 57, 0, 121], ["+", 36, 36, 0, 656, 0, 57, 75, 665, 0, 683]]
5
56
a,b,c,k= map(int,input().split()) if k>a: if k>a+b: print(a-k+a+b) else: print(a) else: print(a)
a,b,c,k= map(int,input().split()) if k>a: if k>a+b: print(a-k+a+b) else: print(a) else: print(k)
[["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
54
data = input().split() a = int(data[0]) b = int(data[1]) c = int(data[2]) k = int(data[3]) ans = 0 ans += min(k, a) k -= a + b if k > 0: ans -= c - k print(ans)
data = input().split() a = int(data[0]) b = int(data[1]) c = int(data[2]) k = int(data[3]) ans = 0 ans += min(k, a) k -= a + b if k > 0: ans -= k print(ans)
[["-", 64, 196, 0, 1, 0, 677, 12, 657, 31, 22], ["-", 64, 196, 0, 1, 0, 677, 12, 657, 17, 33]]
5
75
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String str[] = br.readLine().split(" "); int A = Integer....
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String str[] = br.readLine().split(" "); int A = Integer...
[["-", 0, 57, 75, 57, 15, 15, 0, 16, 17, 47], ["+", 0, 57, 75, 57, 15, 15, 0, 16, 17, 20], ["-", 75, 57, 75, 57, 15, 15, 0, 16, 17, 47], ["+", 75, 57, 75, 57, 15, 15, 0, 16, 17, 20]]
3
194
#include <iostream> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; int answer = min(a, k) - min(b, max(0, k - a - b)); cout << answer << endl; }
#include <iostream> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; int answer = min(a, k) - min(c, max(0, k - a - b)); cout << answer << endl; }
[["-", 49, 50, 51, 16, 12, 2, 3, 4, 0, 22], ["+", 49, 50, 51, 16, 12, 2, 3, 4, 0, 22]]
1
63
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; if (k <= a) { cout << k << "\n"; } else if (k <= a + b) { cout << a << "\n"; } else { cout << k - (k - a - b) << "\n"; } return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; if (k <= a) { cout << k << "\n"; } else if (k <= a + b) { cout << a << "\n"; } else { cout << a - (k - a - b) << "\n"; } return 0; }
[["-", 0, 1, 0, 16, 31, 16, 12, 16, 31, 22], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 31, 22]]
1
88
a, b, c, d = [int(tmp) for tmp in input().split()] if k <= a : print(k) elif k <= a+b : print(a) else : print(a-(k-a-b))
a, b, c, k = [int(tmp) for tmp in input().split()] if k <= a : print(k) elif k <= a+b : print(a) else : print(a-(k-a-b))
[["-", 0, 656, 0, 1, 0, 662, 31, 684, 0, 22], ["+", 0, 656, 0, 1, 0, 662, 31, 684, 0, 22]]
5
58
#include <bits/stdc++.h> using namespace std; /** ******************* Author:Bisnu sarkar **************************** **/ /* #pragma GCC target ("avx2") #pragma GCC optimization ("O3") #pragma GCC optimization ("unroll-loops") */ #define fRead(x) freopen(x, "r", stdin) #define fWrite(x) freopen(x, "w", stdout) #defin...
#include <bits/stdc++.h> using namespace std; /** ******************* Author:Bisnu sarkar **************************** **/ /* #pragma GCC target ("avx2") #pragma GCC optimization ("O3") #pragma GCC optimization ("unroll-loops") */ #define fRead(x) freopen(x, "r", stdin) #define fWrite(x) freopen(x, "w", stdout) #defin...
[["-", 0, 1, 0, 11, 12, 2, 3, 4, 0, 22], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 22]]
1
594
#include <iostream> using namespace std; int main() { int a; int b; int c; int k; int sum; cin >> a >> b >> c >> k; if (a >= k) { sum = a; } else { sum = a; if (a + b >= k) { sum = a; } else { sum = sum - (k - a - b); } } cout << sum; }
#include <iostream> using namespace std; int main() { int a; int b; int c; int k; int sum; cin >> a >> b >> c >> k; if (a >= k) { sum = k; } else { sum = a; if (a + b >= k) { sum = a; } else { sum = sum - (k - a - b); } } cout << sum; }
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22]]
1
89
#include <stdio.h> int main(void) { int a, b, c, k, sum; scanf("%d %d %d %d", &a, &b, &c, &k); if (a >= k) { sum = a; printf("%d\n", sum); } else { if ((a + b) >= k) { sum = a; printf("%d\n", sum); } else { sum = a - (k - a - b); printf("%d\n", sum); } } return...
#include <stdio.h> int main(void) { int a, b, c, k, sum; scanf("%d %d %d %d", &a, &b, &c, &k); if (a >= k) { sum = k; printf("%d\n", sum); } else { if ((a + b) >= k) { sum = a; printf("%d\n", sum); } else { sum = a - (k - a - b); printf("%d\n", sum); } } return...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22]]
0
118
A, B, C, K = map(int, input().split()) if A - K >= 0: print(A) elif A + B - K >= 0: print(A) else: print(-(K-(A+B))+A)
A, B, C, K = map(int, input().split()) if A - K >= 0: print(K) elif A + B - K >= 0: print(A) else: print(-(K-(A+B))+A)
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
61
A,B,C,K = map(int, input().split()) if A >= K: print(K) return K -= A if B >= K: print(A) return K -= B print(A - K)
A,B,C,K = map(int, input().split()) if A >= K: print(K) exit() K -= A if B >= K: print(A) exit() K -= B print(A - K)
[["-", 0, 656, 0, 57, 64, 196, 0, 37, 0, 38], ["+", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
52
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { ll A, B, C, K; cin >> A >> B >> C >> K; ll res; if (K <= A) { res = A; } else if (A < K && K <= (A + B)) { res = A; } else if ((A + B) < K && K <= (A + B + C)) { res = A - (K - A - B); } else { res = A - C;...
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { ll A, B, C, K; cin >> A >> B >> C >> K; ll res; if (K <= A) { res = K; } else if (A < K && K <= (A + B)) { res = A; } else if ((A + B) < K && K <= (A + B + C)) { res = A - (K - A - B); } else { res = A - C;...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22]]
1
126
a,b,c,k = map(int, input().split()) if k <= a + b: print(min(a, k)) elif k >= a + b + c: print(a - b) else: print(a - (k - a - b))
a,b,c,k = map(int, input().split()) if k <= a + b: print(min(a, k)) elif k >= a + b + c: print(a - c) else: print(a - (k - a - b))
[["-", 0, 1, 0, 652, 3, 4, 0, 657, 12, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 12, 22]]
5
65
a,b,c,k=map(int,input().split()) if(k>a+b): print(A-min(k-a-b,c)) elif(k>=a): print(a) else: print(k)
a,b,c,k=map(int,input().split()) if(k>a+b): print(a-min(k-a-b,c)) elif(k>=a): print(a) else: print(k)
[["-", 0, 1, 0, 652, 3, 4, 0, 657, 31, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 31, 22]]
5
61
#include <iostream> #include <math.h> #include <string.h> #include <vector> using namespace std; int main() { long int A = 0; long int B = 0; long int C = 0; long int K = 0; cin >> A >> B >> C >> K; if (K <= A) { cout << K; } else if (K <= (A + B)) { cout << A; } else { cout << A + (-1 * (K...
#include <iostream> #include <math.h> #include <string.h> #include <vector> using namespace std; int main() { long int A = 0; long int B = 0; long int C = 0; long int K = 0; cin >> A >> B >> C >> K; if (K <= A) { cout << K; } else if (K <= (A + B)) { cout << A; } else { cout << A + (-1 * (K...
[["+", 12, 23, 0, 16, 12, 23, 0, 16, 17, 33], ["+", 12, 23, 0, 16, 12, 23, 0, 16, 12, 22]]
1
101
#include <iostream> using namespace std; int main() { long long a, b, c, k; cin >> a >> b >> c >> k; cout << (k <= a ? k : (k <= a + b ? a : a + b - k)) << endl; }
#include <iostream> using namespace std; int main() { long long a, b, c, k; cin >> a >> b >> c >> k; cout << (k <= a ? k : (k <= a + b ? a : 2 * a + b - k)) << endl; }
[["+", 0, 41, 75, 16, 31, 16, 31, 16, 31, 13], ["+", 0, 41, 75, 16, 31, 16, 31, 16, 17, 48]]
1
60
#include <algorithm> #include <iostream> #include <map> #include <vector> using namespace std; const long MOD = 1000000007; typedef pair<int, int> P; typedef long long ll; int main() { int A, B, C, K; cin >> A >> B >> C >> K; int ans = 0; int rest = K; if (rest > A) { rest -= A; ans += A; } else...
#include <algorithm> #include <iostream> #include <map> #include <vector> using namespace std; const long MOD = 1000000007; typedef pair<int, int> P; typedef long long ll; int main() { int A, B, C, K; cin >> A >> B >> C >> K; int ans = 0; int rest = K; if (rest > A) { rest -= A; ans += A; } else...
[["-", 0, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 0, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
136
#include <bits/stdc++.h> #define endl "\n" #define pb push_back #define ll long long #define d1(x) cerr << #x << "--> " << x << endl #define d2(x, y) cerr << #x << "--> " << x << " | " << #y << "--> " << y << endl #define d3(x, y, z) \ cerr << #x << "--> " <<...
#include <bits/stdc++.h> #define endl "\n" #define pb push_back #define ll long long #define d1(x) cerr << #x << "--> " << x << endl #define d2(x, y) cerr << #x << "--> " << x << " | " << #y << "--> " << y << endl #define d3(x, y, z) \ cerr << #x << "--> " <<...
[["+", 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
344
#include <bits/stdc++.h> using namespace std; #define pfi(a) printf("%d", a); #define pfl(a) printf("%lld ", a); #define pfin(a) printf("%d\n", a); #define pfln(a) printf("%lld\n", a); #define sfi(a) scanf("%d", &a); #define sfl(a) scanf("%lld", &a); #define pb push_back #define f first #define s second #define vi vect...
#include <bits/stdc++.h> using namespace std; #define pfi(a) printf("%d", a); #define pfl(a) printf("%lld ", a); #define pfin(a) printf("%d\n", a); #define pfln(a) printf("%lld\n", a); #define sfi(a) scanf("%d", &a); #define sfl(a) scanf("%lld", &a); #define pb push_back #define f first #define s second #define vi vect...
[["-", 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, 13], ["-", 0, 2, 3, 4, 0, 2, 3, 4, 0, 21], ["-", 0, 16, 12, 23, 0, 16, 12, 23, 0, 25]]
1
260
a,b,c,k=map(int,input().split()) if k <= a: print(k) elif k <= a+b: print(a) else: print(a-(k-(a*b)))
a,b,c,k=map(int,input().split()) if k <= a: print(k) elif k <= a+b: print(a) else: print(a-(k-(a+b)))
[["-", 12, 23, 0, 657, 12, 23, 0, 657, 17, 48], ["+", 12, 23, 0, 657, 12, 23, 0, 657, 17, 72]]
5
56
#include <algorithm> #include <iostream> using namespace std; int a, b, c, k, i, x; int main() { cin >> a >> b >> c >> k; if (k == 0) { cout << 0; return 0; } if (k >= a + b) { x = a; k = k - a - b; } else if (k >= a) { cout << a; return 0; } else { cout << a - k; return 0; ...
#include <algorithm> #include <iostream> using namespace std; int a, b, c, k, i, x; int main() { cin >> a >> b >> c >> k; if (k == 0) { cout << 0; return 0; } if (k >= a + b) { x = a; k = k - a - b; } else if (k >= a) { cout << a; return 0; } else { cout << k; return 0; } ...
[["-", 0, 9, 0, 1, 0, 16, 12, 16, 31, 22], ["-", 0, 9, 0, 1, 0, 16, 12, 16, 17, 33]]
1
124
#include <bits/stdc++.h> using namespace std; #define sz(x) int(x.size()) #define pii pair<int, int> #define All(x) (x).begin(), (x).end() #define mp make_pair #define Task "abc" typedef long long ll; const int maxn = 2e5 + 10; const ll mod = 1e9 + 7; int main() { ios_base::sync_with_stdio(0); cin.tie(NULL); /...
#include <bits/stdc++.h> using namespace std; #define sz(x) int(x.size()) #define pii pair<int, int> #define All(x) (x).begin(), (x).end() #define mp make_pair #define Task "abc" typedef long long ll; const int maxn = 2e5 + 10; const ll mod = 1e9 + 7; int main() { ios_base::sync_with_stdio(0); cin.tie(NULL); /...
[["+", 0, 1, 0, 16, 12, 16, 31, 2, 63, 22], ["+", 0, 16, 12, 16, 31, 2, 3, 4, 0, 24], ["+", 0, 16, 12, 16, 31, 2, 3, 4, 0, 21], ["+", 0, 16, 12, 16, 31, 2, 3, 4, 0, 22], ["+", 0, 16, 12, 16, 31, 2, 3, 4, 0, 25]]
1
111
package main import ( "fmt" "strconv" // Reader "bufio" "os" "strings" ) func main() { s := nextLine() a, _ := strconv.Atoi(s[0]) b, _ := strconv.Atoi(s[1]) c, _ := strconv.Atoi(s[2]) k, _ := strconv.Atoi(s[3]) var r int switch { case k <= a : r = k case k <= (a + b) : r = a case k < (a + b + c)...
package main import ( "fmt" "strconv" // Reader "bufio" "os" "strings" ) func main() { s := nextLine() a, _ := strconv.Atoi(s[0]) b, _ := strconv.Atoi(s[1]) c, _ := strconv.Atoi(s[2]) k, _ := strconv.Atoi(s[3]) var r int switch { case k <= a : r = k case k <= (a + b) : r = a case k < (a + b + c)...
[["+", 0, 436, 12, 432, 0, 16, 31, 16, 17, 72], ["+", 0, 436, 12, 432, 0, 16, 31, 16, 12, 22]]
7
300
#include <stdio.h> #include <stdlib.h> #include <string.h> int max(int a, int b) { return a > b ? a : b; } int min(int a, int b) { return a < b ? a : b; } int main(void) { int a, b, c, k; scanf("%d %d %d %d", &a, &b, &c, &k); if (k >= a + b) printf("%d", a - (k - a - b)); else if (k >= a && a + b > k) ...
#include <stdio.h> #include <stdlib.h> #include <string.h> int max(int a, int b) { return a > b ? a : b; } int min(int a, int b) { return a < b ? a : b; } int main(void) { int a, b, c, k; scanf("%d %d %d %d", &a, &b, &c, &k); if (k >= a + b) printf("%d", a - (k - a - b)); else if (k >= a && a + b > k) ...
[["-", 0, 57, 64, 1, 0, 2, 3, 4, 0, 22], ["+", 0, 57, 64, 1, 0, 2, 3, 4, 0, 22]]
0
144
a,b,c,k = map(int, input().split()) ans=0 if a>=k: print(a) exit() k-=a if b>=k: print(a) exit() k-=b print(a-k)
a,b,c,k = map(int, input().split()) ans=0 if a>=k: print(k) exit() k-=a if b>=k: print(a) exit() k-=b print(a-k)
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
59
a,b,c,k = map(int,input().split()) if k <= a: print(a) elif a < k and k <= a+b: print(a) else: print(a-k+a+b)
a,b,c,k = map(int,input().split()) if k <= a: print(k) elif a < k and 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
56
function main(input) { const args = input.split(' ') const a = Number(args[0]) const b = Number(args[1]) const c = Number(args[2]) const k = Number(args[3]) let t = k t -= a if (t <= 0) { if (a <= k) { console.log(a) } else { console.log(k) } } else { t -= b if (t <= ...
function main(input) { const args = input.split(' ') const a = Number(args[0]) const b = Number(args[1]) const c = Number(args[2]) const k = Number(args[3]) let t = k t -= a if (t <= 0) { if (a <= k) { console.log(a) } else { console.log(k) } } else { t -= b if (t <= ...
[["-", 64, 556, 0, 1, 0, 2, 3, 3, 0, 22], ["+", 64, 556, 0, 1, 0, 2, 3, 3, 0, 22]]
2
166
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); } ll lcm(ll a, ll b) { return a * (b / gcd(a, b)); } #define endl '\n' #define max3(a, b, c) max(a, max(b, c)) #define min3(a, b, c) min(a, min(b, c)) #define FOR(i, a, n,...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); } ll lcm(ll a, ll b) { return a * (b / gcd(a, b)); } #define endl '\n' #define max3(a, b, c) max(a, max(b, c)) #define min3(a, b, c) min(a, min(b, c)) #define FOR(i, a, n,...
[["+", 0, 1, 0, 11, 12, 41, 15, 16, 17, 18], ["+", 0, 1, 0, 11, 12, 41, 15, 16, 12, 22], ["+", 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, 22]]
1
179
#include <iostream> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; if (k <= a) cout << k << endl; else if (k <= a + b) cout << a - k + 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 (k <= a) cout << k << endl; else if (k <= a + b) cout << a << endl; else cout << a - (k - (a + b)) << endl; }
[["-", 0, 16, 31, 16, 12, 16, 31, 16, 17, 33], ["-", 0, 16, 31, 16, 12, 16, 31, 16, 12, 22], ["-", 64, 1, 0, 16, 31, 16, 12, 16, 17, 72], ["-", 64, 1, 0, 16, 31, 16, 12, 16, 12, 22]]
1
79
#include <bits/stdc++.h> using namespace std; typedef long long ll; template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; } template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; } #define all(x) (x).beg...
#include <bits/stdc++.h> using namespace std; typedef long long ll; template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; } template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; } #define all(x) (x).beg...
[["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22]]
1
229
a,b,c,k = map(int,input().split()) if a>=k : print(k) elif a<k and k-a <=b: print(a) else: print(a-(c-b))
a,b,c,k = map(int,input().split()) if a>=k : print(k) elif a<k and k-a <=b: print(a) else: print(2*a-k+b)
[["+", 3, 4, 0, 657, 31, 657, 31, 657, 31, 612], ["+", 3, 4, 0, 657, 31, 657, 31, 657, 17, 48], ["-", 0, 1, 0, 652, 3, 4, 0, 657, 17, 33], ["-", 0, 652, 3, 4, 0, 657, 12, 23, 0, 24], ["-", 3, 4, 0, 657, 12, 23, 0, 657, 31, 22], ["+", 0, 652, 3, 4, 0, 657, 31, 657, 12, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 72], ["-...
5
56
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, c; long long k; cin >> a >> b >> c >> k; long long sum = 0; while (k != 0) { if (k <= a) { sum = sum + k; k = 0; } else { if (k <= (a + b)) { sum = sum + k; k = 0; } else { if (k ...
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, c; long long k; cin >> a >> b >> c >> k; long long sum = 0; while (k != 0) { if (k <= a) { sum = sum + k; k = 0; } else { if (k <= (a + b)) { sum = sum + a; k = 0; } else { if (k ...
[["-", 64, 9, 0, 1, 0, 11, 12, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 11, 12, 16, 12, 22]]
1
137
// Author: Fuadul Hasan(fuadul202@gmail.com) // BSMRSTU,Gopalganj #include <bits/stdc++.h> using namespace std; int tc = 1; #define happy ios::sync_with_stdio(false); #define coding cin.tie(0); #define mp make_pair #define ll long long #define Pi atan(1) * 4 #define pb push_back #define vpr vector<pr> #define pr pair<i...
// Author: Fuadul Hasan(fuadul202@gmail.com) // BSMRSTU,Gopalganj #include <bits/stdc++.h> using namespace std; int tc = 1; #define happy ios::sync_with_stdio(false); #define coding cin.tie(0); #define mp make_pair #define ll long long #define Pi atan(1) * 4 #define pb push_back #define vpr vector<pr> #define pr pair<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, 21], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 22], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 25]]
1
199
a,b,c,k = list(map(input(),split())) if a+b >= k: print(min(a,k)) else: print(a-(k-a-b))
a,b,c,k = list(map(int,input().split())) if a+b >= k: print(min(a,k)) else: print(a-(k-a-b))
[["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 22], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 21], ["-", 12, 652, 3, 4, 0, 652, 3, 4, 0, 21], ["+", 0, 652, 3, 4, 0, 652, 63, 319, 0, 131]]
5
51
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; int sum = 0; if (k <= a) { cout << a; return 0; } sum += a; k -= a; if (k <= b) { cout << sum; return 0; } k -= b; sum -= k; cout << sum; }
#include <bits/stdc++.h> using namespace std; int main() { long long int a, b, c, k; cin >> a >> b >> c >> k; long long int sum = 0; if (k <= a) { cout << k; return 0; } sum += a; k -= a; if (k <= b) { cout << sum; return 0; } k -= b; sum -= k; cout << sum; }
[["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 0, 57, 64, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 16, 12, 22]]
1
86
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; if (a >= k) cout << k << endl; else if (a + b >= k) cout << k << endl; else cout << a - (k - (a + b)) << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; if (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
A, B, C, K = list(map(int, input().split())) if A + B >= K: print(A) else: print(A - (K - A - B))
A, B, C, K = list(map(int, input().split())) if A + B >= K: print(min(A, K)) else: print(A - (K - A - B))
[["+", 0, 1, 0, 652, 3, 4, 0, 652, 63, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 21], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
48
A,B,C,K = map(int,input().split()) m=0 if K<=A: m=A else: if K-A <=B: m=A else: m = 2*A-K+B print(m)
A,B,C,K = map(int,input().split()) m=0 if K<=A: m=K else: if K-A <=B: m=A else: m = 2*A-K+B print(m)
[["-", 0, 57, 64, 196, 0, 1, 0, 662, 12, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 12, 22]]
5
58
def main(): A,B,C,K=map(int,input().split()) cal=0 if K<=A: cal=K print(cal) return cal+=A K-=A if K<=B: print(cal) return K-=B print(cal-C) return main()
def main(): A,B,C,K=map(int,input().split()) cal=0 if K<=A: cal=K print(cal) return cal+=A K-=A if K<=B: print(cal) return K-=B print(cal-K) return main()
[["-", 0, 1, 0, 652, 3, 4, 0, 657, 12, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 12, 22]]
5
70
#include <bits/stdc++.h> #define pb push_back #define pf push_front #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define sz(x) (long long)(x).size() #define sqr(x) (x) * (x) #define sof sizeof #define resz resize #define ins insert #define lowerB lower_bound #define upperB upper_bound ...
#include <bits/stdc++.h> #define pb push_back #define pf push_front #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define sz(x) (long long)(x).size() #define sqr(x) (x) * (x) #define sof sizeof #define resz resize #define ins insert #define lowerB lower_bound #define upperB upper_bound ...
[["+", 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
838
inp = list(map(int,input().split())) res = 0 if inp[3] <= inp[0] : res = inp[3] elif inp[3] <= (inp[0] + inp[1]) : res = inp[0] elif inp[3] > (inp[0] + inp[1] + inp[2]) : res = inp[0] - (inp[3] - inp[0] - inp[1]) elif inp[3] == (inp[0] + inp[1] + inp[2]) : res = inp[0] - inp[2] print(res)
inp = list(map(int,input().split())) res = 0 if inp[3] <= inp[0] : res = inp[3] elif inp[3] <= (inp[0] + inp[1]) : res = inp[0] elif inp[3] < (inp[0] + inp[1] + inp[2]) : res = inp[0] - (inp[3] - inp[0] - inp[1]) elif inp[3] == (inp[0] + inp[1] + inp[2]) : res = inp[0] - inp[2] print(res)
[["-", 0, 656, 0, 57, 75, 665, 15, 666, 667, 47], ["+", 0, 656, 0, 57, 75, 665, 15, 666, 667, 18]]
5
145
#include <stdio.h> int main(void) { 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) { printf("%d\n", A); } else { printf("%d\n", A - (K - (A + B))); } return 0; }
#include <stdio.h> int main(void) { 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) { printf("%d\n", A); } else { printf("%d\n", A - (K - (A + B))); } return 0; }
[["-", 64, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 64, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
0
104
#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 if (a + b >= k) ans = k; else { ans = a - (k - a + b); } 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; if (a >= k) ans = k; else if (a + b >= k) ans = a; else ans = a - (k - a - b); cout << ans; return 0; }
[["-", 75, 76, 0, 57, 64, 1, 0, 11, 12, 22], ["+", 75, 76, 0, 57, 64, 1, 0, 11, 12, 22], ["-", 75, 76, 0, 57, 75, 76, 0, 9, 0, 45], ["-", 0, 11, 12, 16, 12, 23, 0, 16, 17, 72], ["+", 0, 11, 12, 16, 12, 23, 0, 16, 17, 33], ["-", 75, 76, 0, 57, 75, 76, 0, 9, 0, 46]]
1
81
A, B, C, K = map(int, input().split()) ans = 0 if K <= A: ans = K elif K <= A + B: ans = A else: ans = A - (K - C) print(ans)
A, B, C, K = map(int, input().split()) ans = 0 if K <= A: ans = K elif K <= A + B: ans = A else: ans = A - (K - A - B) #rest = K - A - B print(ans)
[["-", 0, 662, 12, 657, 12, 23, 0, 657, 12, 22], ["+", 12, 657, 12, 23, 0, 657, 31, 657, 12, 22], ["+", 0, 662, 12, 657, 12, 23, 0, 657, 17, 33], ["+", 0, 662, 12, 657, 12, 23, 0, 657, 12, 22]]
5
56
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> P; typedef vector<int> VI; template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template <class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return 1; }...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> P; typedef vector<int> VI; template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template <class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return 1; }...
[["-", 0, 16, 31, 16, 12, 16, 31, 16, 17, 72], ["-", 0, 16, 31, 16, 12, 16, 31, 16, 12, 22]]
1
223
#include <stdio.h> int main(void) { int max = 0, a, b, c, k; scanf("%d%d%d%d", &a, &b, &c, &k); if (a >= k) max = a; else if (a + b >= k) max = a; else if (a + b < k) max = 2 * a + b - k; printf("%d", max); return 0; }
#include <stdio.h> int main(void) { int max = 0, a, b, c, k; scanf("%d%d%d%d", &a, &b, &c, &k); if (a >= k) max = k; else if (a + b >= k) max = a; else if (a + b < k) max = 2 * a + b - k; printf("%d", max); return 0; }
[["-", 8, 9, 0, 57, 64, 1, 0, 11, 12, 22], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 12, 22]]
0
95
#include <bits/stdc++.h> using namespace std; //#define LOCAL int main() { #ifdef LOCAL freopen("inputb.txt", "r", stdin); #endif int 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 <bits/stdc++.h> using namespace std; //#define LOCAL int main() { #ifdef LOCAL freopen("inputb.txt", "r", stdin); #endif int 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
87
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; if (a + b >= k) cout << a << endl; else { k = k - a - b; cout << a - k << endl; } return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; if (a + b >= k) cout << min(a, k) << endl; else { k = k - a - b; cout << a - k << endl; } return 0; }
[["+", 64, 1, 0, 16, 31, 16, 12, 2, 63, 22], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 24], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 21], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 22], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 25]]
1
67
A, B, C, K = map(int, input().split()) if K <= A: print(A) exit() if (K - A) <= B: print(A) exit() if (K- A -B) <= C: print(A - (K - A -B)) exit()
A, B, C, K = map(int, input().split()) if K <= A: print(K) exit() if (K - A) <= B: print(A) exit() if (K- A -B) <= C: print(A - (K - A -B)) exit()
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
74
#include <bits/stdc++.h> #define mod 1000000007 #define all(x) x.begin(), x.end() #define fast \ std::ios::sync_with_stdio(false); \ cin.tie(NULL); #define int long long using namespace std; signed main() {...
#include <bits/stdc++.h> #define mod 1000000007 #define all(x) x.begin(), x.end() #define fast \ std::ios::sync_with_stdio(false); \ cin.tie(NULL); #define int long long using namespace std; signed main() {...
[["-", 75, 76, 0, 9, 0, 1, 0, 11, 12, 22], ["+", 75, 76, 0, 9, 0, 1, 0, 11, 12, 22]]
1
125
#include <bits/stdc++.h> using namespace std; int main() { long long int a, b, c, n, d; cin >> a >> b >> c >> d; if ((a + b) - d >= 0) { cout << a; } else { cout << ((2 * a) + b - d); } return 0; }
#include <bits/stdc++.h> using namespace std; int main() { long long int a, b, c, n, d; cin >> a >> b >> c >> d; if ((a + b) - d >= 0) { cout << min(a, d); } else { cout << ((2 * a) + b - d); } return 0; }
[["+", 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
73
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, c, k; cin >> a >> b >> c >> k; long long suma = 0; if (k > a) { suma += a; k -= a; } else { cout << a << endl; return 0; } if (k > b) { k -= b; } else { cout << suma << endl; return 0; } if (k <=...
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, c, k; cin >> a >> b >> c >> k; long long suma = 0; if (k > a) { suma += a; k -= a; } else { cout << k << endl; return 0; } if (k > b) { k -= b; } else { cout << a << endl; return 0; } if (k <= c)...
[["-", 0, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 0, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
112
#include <bits/stdc++.h> using namespace std; #define ll long long int int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); ll a, b, c, k; cin >> a >> b >> c >> k; if (k <= a + b) cout << a << endl; else cout << 2 * a + b - k << endl; return 0; }
#include <bits/stdc++.h> using namespace std; #define ll long long int int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); ll a, b, c, k; cin >> a >> b >> c >> k; if (k <= a + b) cout << min(a, k) << endl; else cout << 2 * a + b - k << endl; return 0; }
[["+", 64, 1, 0, 16, 31, 16, 12, 2, 63, 22], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 24], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 21], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 22], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 25]]
1
78
import sys input = sys.stdin.readline #read=sys.stdin.buffer.read #n = int(input()) #l = list(map(int, input().split())) ''' A=[] B=[] for i in range(): a, b = map(int, input().split()) A.append(a) B.append(b)''' a, b, c, k = map(int, input().split()) if (a+b)>=k: print(a) else: print(a-(k-a-b))
import sys input = sys.stdin.readline #read=sys.stdin.buffer.read #n = int(input()) #l = list(map(int, input().split())) ''' A=[] B=[] for i in range(): a, b = map(int, input().split()) A.append(a) B.append(b)''' a, b, c, k = map(int, input().split()) if (a+b) >= k: print(min(k,a)) else: print(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
62