buggy_code
stringlengths
11
625k
fixed_code
stringlengths
17
625k
bug_type
stringlengths
2
4.45k
language
int64
0
8
token_count
int64
5
200k
A, B, C, K = map(int, input().split()) count = 0 second = K-A-B if A >= K: count = K else: count = A if second: count -= second print(count)
A, B, C, K = map(int, input().split()) count = 0 second = K-A-B if A >= K: count = K else: count = A if second > 0: count -= second print(count)
[["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 0, 612]]
5
53
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (long long i = 0; i < (long long)(n); i++) int main() { long long A, B, C, K; cin >> A >> B >> C >> K; long long sum = 0; if (A > K) { sum = A; } else { sum += A; if ((K - A) > B) { rep(i, K - A - B) { sum -= 1; } } ...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (long long i = 0; i < (long long)(n); i++) int main() { long long A, B, C, K; cin >> A >> B >> C >> K; long long sum = 0; if (A > K) { sum = K; } else { sum += A; if ((K - A) > B) { rep(i, K - A - B) { sum -= 1; } } ...
[["-", 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 k <= a: print(k) elif k <= a + b: print(a) else: print(2*a - k - b)
a,b,c,k = map(int, input().split()) if k <= a: print(k) elif k <= a + b: print(a) else: print(2*a - k + b)
[["-", 0, 1, 0, 652, 3, 4, 0, 657, 17, 33], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 72]]
5
52
#include <stdio.h> int main() { int a, b, c, k; scanf("%d%d%d%d", &a, &b, &c, &k); if (a >= k) { printf("%d\n", a); return 0; } else { if (a + b >= k) { printf("%d\n", a); return 0; } else { printf("%d\n", a - (k - a - b)); return 0; } } }
#include <stdio.h> int main() { int a, b, c, k; scanf("%d%d%d%d", &a, &b, &c, &k); if (a >= k) { printf("%d\n", k); return 0; } else { if (a + b >= k) { printf("%d\n", a); return 0; } 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
107
A, B, C, K = map(int,input().split()) if K < A: print(K) if A <= K < A + B: print(A) if A + B <= K < A + B + C: print(2*A + B - K)
A, B, C, K = map(int,input().split()) if K < A: print(K) if A <= K < A + B: print(A) if A + B <= K <= A + B + C: print(2*A + B - K)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 18], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 19]]
5
65
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <vector> using namespace std; typedef long long ll; typedef long double ld; int main() { ll a, b, c, k; cin >> a >> b >> c >> k; if ((a + b) >= k) { if (a > k) { cout << ...
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <vector> using namespace std; typedef long long ll; typedef long double ld; int main() { ll a, b, c, k; cin >> a >> b >> c >> k; if ((a + b) >= k) { if (a > k) { cout << ...
[["-", 64, 9, 0, 1, 0, 16, 12, 16, 31, 22], ["-", 64, 9, 0, 1, 0, 16, 12, 16, 17, 33]]
1
103
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, c, k; cin >> a >> b >> c >> k; if (k > a) { if (k > a + b) { cout << a - (k - a - b) << endl; } else { cout << a << endl; } } else { cout << a << endl; } }
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, c, k; cin >> a >> b >> c >> k; if (k > a) { if (k > a + b) { cout << a - (k - a - b) << endl; } else { cout << a << endl; } } else { cout << k << endl; } }
[["-", 0, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 0, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
82
a,b,c,k=list(map(int,input().split())) if a>k: print(k) elif a+b>=k and k>a: print(a) else: k-=a+b print(a-k)
a,b,c,k=list(map(int,input().split())) if a>=k: print(k) elif a+b>=k and k>a: print(a) else: k-=a+b print(a-k)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20]]
5
60
#include <iostream> #include <string> using namespace std; int main() { int A, B, C, K; cin >> A >> B >> C >> K; if (A > K) { cout << A << endl; } else { if (K < A + B) { cout << A << endl; } else { cout << A - (K - (A + B)) << endl; } } return 0; }
#include <iostream> #include <string> using namespace std; int main() { int A, B, C, K; cin >> A >> B >> C >> K; if (A > K) { cout << K << endl; } else { if (K < A + B) { cout << A << endl; } else { cout << A - (K - (A + B)) << endl; } } return 0; }
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
88
#include <bits/stdc++.h> using namespace std; int main() { long long int a, b, c, k; cin >> a >> b >> c >> k; if (a >= k) { cout << a - k << "\n"; return 0; } else { if (b >= k - a) { cout << a << "\n"; return 0; } else { cout << a - (k - a - b) << "\n"; } } return 0; }
#include <bits/stdc++.h> using namespace std; int main() { long long int a, b, c, k; cin >> a >> b >> c >> k; if (a >= k) { cout << k << "\n"; return 0; } else { if (b >= k - a) { cout << a << "\n"; return 0; } 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, 17, 33]]
1
100
#include <iostream> using namespace std; int main() { int a, b, c, d; scanf("%d%d%d%d", &a, &b, &c, &d); if (d <= a) printf("%d", d); else if (d <= a + b) printf("%d", b); else printf("%d", (2 * a + b - d)); return 0; }
#include <iostream> using namespace std; int main() { int a, b, c, d; scanf("%d%d%d%d", &a, &b, &c, &d); if (d <= a) printf("%d", d); else if (d <= a + b) printf("%d", a); else printf("%d", (2 * a + b - d)); return 0; }
[["-", 0, 57, 64, 1, 0, 2, 3, 4, 0, 22], ["+", 0, 57, 64, 1, 0, 2, 3, 4, 0, 22]]
1
94
a,b,c,k = list(map(int,input().split(' '))) s = 0 s += a k -=a k -=b s -= max(k , 0) print(s )
a,b,c,k = list(map(int,input().split(' '))) s = 0 s += min( a , k) k -=a k -=b s -= max(k , 0) print(s)
[["+", 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, 21], ["+", 0, 1, 0, 677, 12, 652, 3, 4, 0, 22], ["+", 0, 1, 0, 677, 12, 652, 3, 4, 0, 25]]
5
50
A,B,C,K = map(int, input().split()) s = K - A m = 0 if s >= 0: m += A else: print(K) if s - B >= 0: s -= B else: print(m) if s - C >= 0: print(m + (-C)) else: print(m - s)
A,B,C,K = map(int, input().split()) s = K - A m = 0 if s >= 0: m += A else: print(K) exit() if s - B >= 0: s -= B else: print(m) exit() if s - C >= 0: print(m + (-C)) else: print(m - s)
[["+", 75, 76, 8, 196, 0, 1, 0, 652, 63, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
82
#include <bits/stdc++.h> using namespace std; int main() { int A, B, C, K; int sum = 0; cin >> A >> B >> C >> K; if (A > K) cout << A << endl; else if (A + B > K) cout << A << endl; else cout << 2 * A + B - K << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int A, B, C, K; int sum = 0; cin >> A >> B >> C >> K; if (A > K) cout << K << endl; else if (A + B > K) cout << A << endl; else cout << 2 * A + B - K << endl; }
[["-", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22], ["+", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22]]
1
76
#include <algorithm> #include <cmath> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <set> #include <string> #include <vector> #define FOR(i, a, n) for (long long i = (a); i < (n); i++) #define REP(i, n) for (long long i = 0; i < (n); i++) #define ALL(obj) (obj)....
#include <algorithm> #include <cmath> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <set> #include <string> #include <vector> #define FOR(i, a, n) for (long long i = (a); i < (n); i++) #define REP(i, n) for (long long i = 0; i < (n); i++) #define ALL(obj) (obj)....
[["+", 75, 76, 0, 9, 0, 1, 0, 11, 31, 22], ["+", 75, 76, 0, 9, 0, 1, 0, 11, 17, 32], ["+", 75, 76, 0, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 57, 75, 76, 0, 9, 0, 1, 0, 35]]
1
292
package main import "fmt" func main() { var a,b,c,k int fmt.Scan(&a,&b,&c,&k) switch { case a >= k: fmt.Println(k) case a+b >= k && a < k: fmt.Println(a) case k > a+b: fmt.Println(a+b-(k-a-b)) } }
package main import "fmt" func main() { var a,b,c,k int fmt.Scan(&a,&b,&c,&k) switch { case a >= k: fmt.Println(k) case a+b >= k && a < k: fmt.Println(a) case k > a+b: fmt.Println(a-(k-a-b)) } }
[["-", 0, 2, 3, 4, 0, 16, 31, 16, 17, 72], ["-", 0, 2, 3, 4, 0, 16, 31, 16, 12, 22]]
7
99
#include "bits/stdc++.h" using namespace std; int main() { int A, B, C, K, minas; cin >> A >> B >> C >> K; minas = K - A - B; if (K <= A) { cout << A << endl; } else if (K > A && K <= A + B) { cout << A << endl; } else if (K > A && K > A + B) { cout << A - minas << endl; } }
#include "bits/stdc++.h" using namespace std; int main() { int A, B, C, K, minas; cin >> A >> B >> C >> K; minas = K - A - B; if (K <= A) { cout << K << endl; } else if (K > A && K <= A + B) { cout << A << endl; } else if (K > A && K > A + B) { cout << A - minas << endl; } }
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
101
#include <bits/stdc++.h> using namespace std; int main() { int A, B, C, K; cin >> A >> B >> C >> K; if (K <= A) cout << K << endl; if (A < K <= A + B) cout << A << endl; if (A + B < K) cout << A - (K - A - B) << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int A, B, C, K; cin >> A >> B >> C >> K; if (K <= A) cout << K << endl; if (A < K && K <= A + B) cout << A << endl; if (A + B < K) cout << A - (K - A - B) << endl; }
[["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22]]
1
81
import java.util.Scanner; public class Main { public static void main(String[] args) throws Exception { // File file = new File("test.txt"); // Scanner sc = new Scanner(file); Scanner sc = new Scanner(System.in); long A = sc.nextLong(); long B = sc.nextLong(); long C = sc.nextLong()...
import java.util.Scanner; public class Main { public static void main(String[] args) throws Exception { // File file = new File("test.txt"); // Scanner sc = new Scanner(file); Scanner sc = new Scanner(System.in); long A = sc.nextLong(); long B = sc.nextLong(); long C = sc.nextLong()...
[["-", 0, 57, 64, 196, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 11, 12, 22]]
3
186
#include <algorithm> #include <cstdio> #include <stdlib.h> using namespace std; int main() { double A, B, C, K; scanf("%lf %lf %lf %lf", &A, &B, &C, &K); int point = A; if (K > A + B) { point -= K - A - B; } printf("%d\n", point); }
#include <algorithm> #include <cstdio> #include <stdlib.h> using namespace std; int main() { double A, B, C, K; scanf("%lf %lf %lf %lf", &A, &B, &C, &K); int point = min(A, K); if (K > A + B) { point -= K - A - B; } printf("%d\n", point); }
[["+", 8, 9, 0, 43, 49, 50, 51, 2, 63, 22], ["+", 0, 43, 49, 50, 51, 2, 3, 4, 0, 24], ["+", 0, 43, 49, 50, 51, 2, 3, 4, 0, 21], ["+", 0, 43, 49, 50, 51, 2, 3, 4, 0, 22], ["+", 0, 43, 49, 50, 51, 2, 3, 4, 0, 25]]
1
77
import java.util.Scanner; public class Main { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); long a = sc.nextLong(); long b = sc.nextLong(); long c = sc.nextLong(); long k = sc.nextLong(); if (a < k) { long somme = a...
import java.util.Scanner; public class Main { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); long a = sc.nextLong(); long b = sc.nextLong(); long c = sc.nextLong(); long k = sc.nextLong(); if (a < k) { long somme = a...
[["-", 75, 196, 0, 1, 0, 492, 3, 4, 0, 22], ["+", 75, 196, 0, 1, 0, 492, 3, 4, 0, 22]]
3
142
#include <iostream> #include <string> using namespace std; int main() { int a, b, c, k; int i, sum = 0, count = 0; cin >> a >> b >> c >> k; if (a - k >= 0) { cout << a << endl; } else { count = k - a; if (b - count >= 0) { cout << a << endl; } else { count -= b; cout << a -...
#include <iostream> #include <string> using namespace std; int main() { int a, b, c, k; int i, sum = 0, count = 0; cin >> a >> b >> c >> k; if (a - k >= 0) { cout << k << endl; } else { count = k - a; if (b - count >= 0) { cout << a << endl; } else { count -= b; cout << a -...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
103
#include <bits/stdc++.h> using namespace std; int main() { long long int a, b, c, k; scanf("%lld %lld %lld %lld", &a, &b, &c, &k); if (k <= a) { printf("%lld", a); } else if (k <= a + b) { printf("%lld", a); } else { printf("%lld", a - (k - (a + b))); } return 0; }
#include <bits/stdc++.h> using namespace std; int main() { long long int a, b, c, k; scanf("%lld %lld %lld %lld", &a, &b, &c, &k); if (k <= a) { printf("%lld", k); } else if (k <= a + b) { printf("%lld", a); } else { printf("%lld", a - (k - (a + b))); } return 0; }
[["-", 64, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 64, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
1
104
#include <algorithm> #include <cmath> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <set> #include <vector> typedef long long ll; using namespace std; int main() { ll a, b, c, k; cin >> a >> b >> c >> k; if (a >= k) cout << a << endl; else if (a + b >= k) cout << ...
#include <algorithm> #include <cmath> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <set> #include <vector> typedef long long ll; using namespace std; int main() { ll a, b, c, k; cin >> a >> b >> c >> k; if (a >= k) cout << k << endl; else if (a + b >= k) cout << ...
[["-", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22], ["+", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22]]
1
114
a,b,c,k = gets.split.map(&:to_i) sum = 0 def main(a, b, c, k, sum) pulsA = a > k ? k : a k = k-a sum = sum + a if k <= 0 print sum return end k = k-b if k <= 0 print sum return end pulsC = c > k ? k :c sum = sum - pulsC print sum end main(...
a,b,c,k = gets.split.map(&:to_i) sum = 0 def main(a, b, c, k, sum) pulsA = a > k ? k : a k = k-pulsA sum = sum + pulsA if k <= 0 print sum return end k = k-b if k <= 0 print sum return end pulsC = c > k ? k : c sum = sum - pulsC print sum en...
[["-", 0, 735, 8, 736, 0, 662, 12, 738, 12, 22], ["+", 0, 735, 8, 736, 0, 662, 12, 738, 12, 22]]
4
102
#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>; using Graph = vector<vector<int>>; // header area int main() { int A, B, C, K; cin >> A >> B >> C >> K; // int sum = 0; if (K > A) { sum += A; // A+Bを超えてCに入る...
#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>; using Graph = vector<vector<int>>; // header area int main() { int A, B, C, K; cin >> A >> B >> C >> K; // int sum = 0; if (K > A) { sum += A; // A+Bを超えてCに入る...
[["-", 0, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 0, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
137
#define _CRT_SECURE_NO_WARNINGS #define _USE_MATH_DEFINES #pragma comment(linker, "/STACK:268435456") #pragma warning(disable : 6031) #pragma warning(disable : 4244) #pragma warning(disable : 26451) #ifndef _MSC_VER #pragma GCC target("sse4.2") #endif #ifdef _MSC_VER #include <intrin.h> #define __builtin_popcount __pop...
#define _CRT_SECURE_NO_WARNINGS #define _USE_MATH_DEFINES #pragma comment(linker, "/STACK:268435456") #pragma warning(disable : 6031) #pragma warning(disable : 4244) #pragma warning(disable : 26451) #ifndef _MSC_VER #pragma GCC target("sse4.2") #endif #ifdef _MSC_VER #include <intrin.h> #define __builtin_popcount __pop...
[["+", 8, 9, 0, 43, 49, 50, 51, 2, 63, 22], ["+", 0, 43, 49, 50, 51, 2, 3, 4, 0, 24], ["+", 0, 43, 49, 50, 51, 2, 3, 4, 0, 21], ["+", 0, 43, 49, 50, 51, 2, 3, 4, 0, 22], ["+", 0, 43, 49, 50, 51, 2, 3, 4, 0, 25]]
1
372
# ABC167 B def main(): a, b, c, k = map(int, input().split()) total = 0 if a >= k: print(a) elif a+b >= k: print(a) else: print(a - (k - a - b)) if __name__ == '__main__': main()
# ABC167 B def main(): a, b, c, k = map(int, input().split()) total = 0 if a >= k: print(k) elif a+b >= k: 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
73
A, B, C, K = map(int,input().split()) if k <= A: print(K) if A < K <= A + B: print(A) if A + B < K <= A + B + C: print(2*A + B - K)
A, B, C, K = map(int,input().split()) if K <= A: print(K) if A < K <= A + B: print(A) if A + B < K <= A + B + C: print(2*A + B - K)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22]]
5
65
a,b,c,d=map(int,input().split()) h=k-a h2=h-b if a>k: print(k) else: if h<=b: print(a) else: print(a+h2*(-1))
a,b,c,k=map(int,input().split()) h=k-a h2=h-b if a>k: print(k) else: if h<=b: print(a) else: print(a+h2*(-1))
[["-", 0, 656, 0, 1, 0, 662, 31, 684, 0, 22], ["+", 0, 656, 0, 1, 0, 662, 31, 684, 0, 22]]
5
63
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <string.h> using namespace std; int main() { long long a, b, c, d; cin >> a >> b >> c >> d; if (a >= d) { cout << a << endl; return 0; } else if (a + b >= d) { cout << a << endl; return 0; } else { cout <...
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <string.h> using namespace std; int main() { long long a, b, c, d; cin >> a >> b >> c >> d; if (a >= d) { cout << d << endl; return 0; } else if (a + b >= d) { cout << a << endl; return 0; } else { cout <...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
97
#include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> #include <unistd.h> long long int ans = 0; #define ll long long //最大公約数 long long int getgcd(long long n, long long m) { int r; if (n > m) { long long t = m; m = n; n = t; } while ((r = m % n) != 0) { ...
#include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> #include <unistd.h> long long int ans = 0; #define ll long long //最大公約数 long long int getgcd(long long n, long long m) { int r; if (n > m) { long long t = m; m = n; n = t; } while ((r = m % n) != 0) { ...
[["-", 0, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 0, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
0
322
A,B,C,K = map(int,input().split()) num = 0 if K <= A: print(A) else: tmp1 = K-A num = A if tmp1 <= B: print(A) else: tmp2 = tmp1-B print(A+tmp2*(-1))
A,B,C,K = map(int,input().split()) if K <= A: print(K) else: tmp1 = K-A num = A if tmp1 <= B: print(A) else: tmp2 = tmp1-B print(A+tmp2*(-1))
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["-", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32], ["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
69
#include <bits/stdc++.h> using namespace std; int main() { long A, B, C, K; cin >> A >> B >> C >> K; cout << ((A > K) ? K : A) + ((C >= K - A - B) ? -(K - A - B) : 0) << endl; }
#include <bits/stdc++.h> using namespace std; int main() { long A, B, C, K; cin >> A >> B >> C >> K; cout << ((A > K) ? K : A) + ((K - A - B > 0) ? -(K - A - B) : 0) << endl; }
[["-", 12, 23, 0, 41, 15, 23, 0, 16, 31, 22], ["-", 12, 23, 0, 41, 15, 23, 0, 16, 17, 20], ["+", 12, 23, 0, 41, 15, 23, 0, 16, 17, 47], ["+", 12, 23, 0, 41, 15, 23, 0, 16, 12, 13]]
1
70
#include <bits/stdc++.h> using namespace std; int main() { long A, B, C, K; cin >> A >> B >> C >> K; cout << ((A >= K) ? K : A) + ((C >= K - A - B) ? -(K - A - B) : 0) << endl; }
#include <bits/stdc++.h> using namespace std; int main() { long A, B, C, K; cin >> A >> B >> C >> K; cout << ((A >= K) ? K : A) + ((K - A - B > 0) ? -(K - A - B) : 0) << endl; }
[["-", 12, 23, 0, 41, 15, 23, 0, 16, 31, 22], ["-", 12, 23, 0, 41, 15, 23, 0, 16, 17, 20], ["+", 12, 23, 0, 41, 15, 23, 0, 16, 17, 47], ["+", 12, 23, 0, 41, 15, 23, 0, 16, 12, 13]]
1
70
#include <iostream> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); long long A, B, C, K, sum = 0; cin >> A >> B >> C >> K; if (K <= A) { sum = A; } else { sum = A; K -= A; if (K > B) sum -= (K - B); } cout << sum << "\n"; return 0; }
#include <iostream> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); long long A, B, C, K, sum = 0; cin >> A >> B >> C >> K; if (K <= A) { sum = K; } else { sum = A; K -= A; if (K > B) sum -= (K - B); } cout << sum << "\n"; return 0; }
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22]]
1
98
#include <bits/stdc++.h> #include <cstdlib> #include <iostream> #include <string> using namespace std; typedef long long ll; #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() int main() { ll a, b, c, k; cin >> a >> b >>...
#include <bits/stdc++.h> #include <cstdlib> #include <iostream> #include <string> using namespace std; typedef long long ll; #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() int main() { ll a, b, c, k; cin >> a >> b >>...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
170
a,b,c,k = [int(i) for i in input().split()] if k<=a: print(k) elif a<k and k<=a+b: s = a print(s) elif a+b<k<=a+c: s = 2*a+b-k print(s)
a,b,c,k = [int(i) for i in input().split()] if k<=a: print(k) elif a<k and k<=a+b: s = a print(s) elif a+b<k<=a+b+c: s = 2*a+b-k print(s)
[["+", 75, 665, 15, 666, 0, 657, 31, 657, 12, 22], ["+", 0, 57, 75, 665, 15, 666, 0, 657, 17, 72]]
5
75
#include <algorithm> #include <iostream> #include <string> using namespace std; //#define rep(i, n) for (ll i = 0; i < (ll)(n); i++) #include <cmath> #include <iomanip> #include <map> #include <numeric> #include <queue> #include <vector> using ll = long long; #define PI 3.14159265358979 #define rep(i, init, n) for (ll ...
#include <algorithm> #include <iostream> #include <string> using namespace std; //#define rep(i, n) for (ll i = 0; i < (ll)(n); i++) #include <cmath> #include <iomanip> #include <map> #include <numeric> #include <queue> #include <vector> using ll = long long; #define PI 3.14159265358979 #define rep(i, init, n) for (ll ...
[["-", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22], ["+", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22]]
1
162
a, b, c, k = (int(x) for x in input().split()) ans = 0 if a <= k: ans += a k -= a else: ans += k k = 0 k -= b if k > 0: ans -= (b - k) print(ans)
a, b, c, k = (int(x) for x in input().split()) ans = 0 if a <= k: ans += a k -= a else: ans += k k = 0 k -= b if k > 0: ans -= k print(ans)
[["-", 64, 196, 0, 1, 0, 677, 12, 23, 0, 24], ["-", 0, 1, 0, 677, 12, 23, 0, 657, 31, 22], ["-", 0, 1, 0, 677, 12, 23, 0, 657, 17, 33], ["-", 64, 196, 0, 1, 0, 677, 12, 23, 0, 25]]
5
65
def main(): abck = list(map(int, input().split())) count = abck[3] r = 0 r += min(abck[0], count) count -= min(abck[0], count) count -= min(abck[1], count) count -= min(abck[2], count) r -= min(abck[2], count) print(r) if __name__ == '__main__': main()
def main(): abck = list(map(int, input().split())) count = abck[3] r = 0 r += min(abck[0], count) count -= min(abck[0], count) count -= min(abck[1], count) r -= min(abck[2], count) count -= min(abck[2], count) print(r) if __name__ == '__main__': main()
[["-", 0, 14, 8, 196, 0, 1, 0, 677, 31, 22], ["+", 0, 14, 8, 196, 0, 1, 0, 677, 31, 22]]
5
100
A,B,C,D = map(int,input().split()) count = 0 point = 0 if D-A <= 0: point = A D -= A if D-B <= 0: D -= B if D-C <= 0: point -= C print(point) else: point -= D print(point) else: print(point) else: point = D print(po...
A,B,C,D = map(int,input().split()) count = 0 point = 0 if D-A >= 0: point = A D -= A if D-B >= 0: D -= B if D-C >= 0: point -= C print(point) else: point -= D print(point) else: print(point) else: point = D print(po...
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 19], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20], ["-", 0, 57, 64, 196, 0, 57, 15, 666, 667, 19], ["+", 0, 57, 64, 196, 0, 57, 15, 666, 667, 20]]
5
87
#include <cmath> #include <cstdio> #include <iostream> typedef long long LL; using namespace std; int main() { LL a, b, c, k; LL sum = 0; cin >> a >> b >> c >> k; if (k <= a) printf("%lld\n", a); else if (k > a) { if (k <= (a + b)) printf("%lld\n", a); else printf("%lld\n", a - (k -...
#include <cmath> #include <cstdio> #include <iostream> typedef long long LL; using namespace std; int main() { LL a, b, c, k; LL sum = 0; cin >> a >> b >> c >> k; if (k <= a) printf("%lld\n", k); else if (k > a) { if (k <= (a + b)) printf("%lld\n", a); else printf("%lld\n", a - (k -...
[["-", 0, 57, 64, 1, 0, 2, 3, 4, 0, 22], ["+", 0, 57, 64, 1, 0, 2, 3, 4, 0, 22]]
1
112
#include <stdio.h> int main(void) { long long a; long long b; long long c; long long k; long long t; long long u; long long v; long long i; scanf("%lld %lld %lld %lld", &a, &b, &c, &k); t = k - a; if (t < 0) { printf("%lld", a); return (0); } else { u = t - b; if (u < 0) { ...
#include <stdio.h> int main(void) { long long a; long long b; long long c; long long k; long long t; long long u; long long v; long long i; scanf("%lld %lld %lld %lld", &a, &b, &c, &k); t = k - a; if (t < 0) { printf("%lld", k); return (0); } else { u = t - b; if (u < 0) { ...
[["-", 64, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 64, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
0
170
A,B,C,K = map(int,input().split()) if K <= A: print(str(A)) else: if K <= A + B: print(str(A)) else: print(str(A-(K-A-B)))
A,B,C,K = map(int,input().split()) if K <= A: print(str(K)) else: if K <= A + B: print(str(A)) else: print(str(A-(K-A-B)))
[["-", 0, 652, 3, 4, 0, 652, 3, 4, 0, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 22]]
5
65
#include <algorithm> #include <complex> #include <cstdlib> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <string> #include <typeinfo> #include <unordered_map> #include <vector> using namespace std; using ll = long long int; const int mod = 1e9 + 7; #define rep(i, a, b) for (ll i = a; i...
#include <algorithm> #include <complex> #include <cstdlib> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <string> #include <typeinfo> #include <unordered_map> #include <vector> using namespace std; using ll = long long int; const int mod = 1e9 + 7; #define rep(i, a, b) for (ll i = a; i...
[["-", 75, 76, 0, 9, 0, 1, 0, 11, 12, 22], ["+", 75, 76, 0, 9, 0, 1, 0, 11, 12, 22]]
1
156
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 = Intege...
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 = Intege...
[["-", 64, 196, 0, 1, 0, 492, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 492, 3, 4, 0, 22], ["+", 75, 196, 0, 503, 49, 200, 51, 16, 31, 22], ["+", 75, 196, 0, 503, 49, 200, 51, 16, 17, 33], ["+", 0, 503, 49, 200, 51, 16, 12, 23, 0, 24], ["-", 75, 196, 0, 503, 49, 200, 51, 16, 12, 22], ["+", 49, 200, 51, 16, 12, 23, 0, 16, 1...
3
185
#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 << a << endl; } else { cout << a - (k - (a + b)) << endl; } return 0; }
#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) << endl; } else { cout << a - (k - (a + b)) << endl; } return 0; }
[["+", 0, 1, 0, 16, 31, 16, 12, 2, 63, 22], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 24], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 21], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 22], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 25]]
1
70
a,b,c,k=map(int,input().split()) if k<=a: print(a) else: if k<=a+b: print(a) else: print(2*a+b-k)
a,b,c,k=map(int,input().split()) if k<=a: print(k) else: if k<=a+b: 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
# S = input() # N = int(input()) # A, B = map(int, input().split(' ')) # A = list(map(int, input().split(' '))) A, B, C, K = map(int, input().split(' ')) result = 0 if A < K: result += A K -= A else: result = A K -= A if K > 0: if B < K: K -= B else: K -= B if K > 0: if C < K: result -= C ...
# S = input() # N = int(input()) # A, B = map(int, input().split(' ')) # A = list(map(int, input().split(' '))) A, B, C, K = map(int, input().split(' ')) result = 0 if A < K: result += A K -= A else: result = K K -= A if K > 0: if B < K: K -= B else: K -= B if K > 0: if C < K: result -= C ...
[["-", 75, 76, 8, 196, 0, 1, 0, 662, 12, 22], ["+", 75, 76, 8, 196, 0, 1, 0, 662, 12, 22]]
5
92
#include <bits/stdc++.h> using namespace std; #define ll long long int main() { ll a, b, c, k; cin >> a >> b >> c >> k; ll n = k; ll res = 0; if (a > k) { cout << a - k; return 0; } if (a <= k) { res += a; k -= a; } if (k > 0) { if (b > 0) { k -= b; } } if (k > 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 n = k; ll res = 0; if (a > k) { cout << k; return 0; } if (a <= k) { res += a; k -= a; } if (k > 0) { if (b > 0) { k -= b; } } if (k > 0) { r...
[["-", 64, 9, 0, 1, 0, 16, 12, 16, 31, 22], ["-", 64, 9, 0, 1, 0, 16, 12, 16, 17, 33]]
1
119
#include <bits/stdc++.h> using namespace std; typedef unsigned long long ll; const long double PI = (acos(-1)); const long long MOD = 1000000007; long long modpow(long long a, long long n, long long m) { long long ans = 1; while (n) { if (n & 1) { ans = (ans * a) % m; } a = (a * a) % m; n >>=...
#include <bits/stdc++.h> using namespace std; typedef long long ll; const long double PI = (acos(-1)); const long long MOD = 1000000007; long long modpow(long long a, long long n, long long m) { long long ans = 1; while (n) { if (n & 1) { ans = (ans * a) % m; } a = (a * a) % m; n >>= 1; } ...
[["-", 36, 36, 0, 30, 0, 134, 39, 86, 0, 87], ["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
1,209
#include <algorithm> #include <iostream> #include <queue> #include <vector> using namespace std; using Graph = vector<vector<int>>; typedef long long ll; int dx[] = {0, 1, 0, -1}; int dy[] = {1, 0, -1, 0}; int main() { ll a, b, c, k; cin >> a >> b >> c >> k; if (a >= k) cout << k << endl; if (a + b >= k) ...
#include <algorithm> #include <iostream> #include <queue> #include <vector> using namespace std; using Graph = vector<vector<int>>; typedef long long ll; int dx[] = {0, 1, 0, -1}; int dy[] = {1, 0, -1, 0}; int main() { ll a, b, c, k; cin >> a >> b >> c >> k; if (a >= k) cout << k << endl; else if (a + b >=...
[["+", 0, 14, 8, 9, 0, 57, 75, 76, 0, 95]]
1
124
#include <algorithm> //辞書順=next_permutation #include <cmath> #include <complex> #include <iomanip> #include <iostream> #include <locale> #include <math.h> #include <queue> #include <random> #include <set> #include <sstream> #include <stdio.h> #include <string.h> #include <string> //char 小文字のほうが32大きい #include <time.h> #...
#include <algorithm> //辞書順=next_permutation #include <cmath> #include <complex> #include <iomanip> #include <iostream> #include <locale> #include <math.h> #include <queue> #include <random> #include <set> #include <sstream> #include <stdio.h> #include <string.h> #include <string> //char 小文字のほうが32大きい #include <time.h> #...
[["+", 0, 14, 8, 9, 0, 57, 75, 76, 0, 95]]
1
729
#!/usr/bin/env python3 import sys # import math # from string import ascii_lowercase, ascii_upper_case, ascii_letters, digits, hexdigits # import re # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s) # from operator import itemgette...
#!/usr/bin/env python3 import sys # import math # from string import ascii_lowercase, ascii_upper_case, ascii_letters, digits, hexdigits # import re # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s) # from operator import itemgette...
[["+", 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
234
import sys def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) A,B,C,K = LI() ans = A if A+B<=K: ans -= K-(A+B) print(ans)
import sys def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) A,B,C,K = LI() ans = min(A,K) if A+B<K: ans -= K-(A+B) print(ans)
[["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 21], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25], ["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 19], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 18]]
5
65
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <math.h> #include <queue> #include <stdio.h> #include <vector> using namespace std; #define int long long #define double long double #define rep(s, i, n) for (int i = s; i < n; i++) #define c(n) cout << n << endl; #define ic(n) ...
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <math.h> #include <queue> #include <stdio.h> #include <vector> using namespace std; #define int long long #define double long double #define rep(s, i, n) for (int i = s; i < n; i++) #define c(n) cout << n << endl; #define ic(n) ...
[["-", 0, 57, 64, 1, 0, 2, 3, 4, 0, 22], ["+", 0, 57, 64, 1, 0, 2, 3, 4, 0, 22]]
1
2,061
#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; int main() { long long A, B, C, K; cin >> A >> B >> C >> K; if (K < A) { cout << K << endl; } if (K <= A + B) { cout << A << endl; } else { cout << A - (K - A - B) << endl; } }
#define _GLIBCXX_DEBUG #include <bits/stdc++.h> 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 { cout << A - (K - A - B) << endl; } }
[["+", 0, 14, 8, 9, 0, 57, 75, 76, 0, 95]]
1
81
#include <stdio.h> int main(void) { long a, b, c, k; scanf("%ld %ld %ld %ld", &a, &b, &c, &k); if (a >= k) { printf("%ld\n", a); return 0; } else if (a + b >= k) { printf("%ld\n", a); return 0; } else { printf("%ld\n", a - (k - a - b)); return 0; } return 0; }
#include <stdio.h> int main(void) { long a, b, c, k; scanf("%ld %ld %ld %ld", &a, &b, &c, &k); if (a >= k) { printf("%ld\n", k); return 0; } else if (a + b >= k) { printf("%ld\n", a); return 0; } else { printf("%ld\n", a - (k - a - b)); return 0; } return 0; }
[["-", 64, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 64, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
0
109
A, B, C, K = map(int, input().split(" ")) ans = 0 if K - A >= 0: ans += A K -= A elif K < A: ans += A - K K = 0 if K - B >= 0: K -= B elif K < B: K = 0 if K > 0: ans -= K print(ans)
A, B, C, K = map(int, input().split(" ")) ans = 0 if K - A >= 0: ans += A K -= A elif K < A: ans += K K = 0 if K - B >= 0: K -= B elif K < B: K = 0 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
82
def input_from_console(): a, b, c, k = map(int, input().split()) return a, b, c, k def solve(a, b, c, k): sum = 0 if k < a: return k else: k = k - a sum = a if k < b: return k else: k = k - b sum -= k return sum def main(): a, b, c, k = ...
def input_from_console(): a, b, c, k = map(int, input().split()) return a, b, c, k def solve(a, b, c, k): sum = 0 if k < a: return k else: k = k - a sum = a if k < b: return sum else: k = k - b sum -= k return sum def main(): a, b, c, k...
[["-", 8, 196, 0, 57, 64, 196, 0, 37, 0, 22], ["+", 8, 196, 0, 57, 64, 196, 0, 37, 0, 22]]
5
138
A, B, C, K = map(int, input().split()) total = 0 if K <= A: print(A) exit() else: total += A K -= A if K <= B: print(A) exit() else: K -= B if K <= C: total -= K else: total -= C print(total)
A, B, C, K = map(int, input().split()) total = 0 if K <= A: print(K) exit() else: total += A K -= A if K <= B: print(A) exit() else: K -= B if K <= C: total -= K else: total -= C print(total)
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
77
a = gets.split.map(&:to_i) S = 0 n = 0 if a[3] > a[0] S += a[0] n = a[3] - a[0] if n <= a[1] puts S else puts S - (n - a[1]) end else puts a[0] end
a = gets.split.map(&:to_i) S = 0 n = 0 if a[3] > a[0] S += a[0] n = a[3] - a[0] if n <= a[1] puts S else puts S - (n - a[1]) end else puts a[3] end
[["-", 75, 95, 0, 652, 3, 4, 0, 742, 0, 612], ["+", 75, 95, 0, 652, 3, 4, 0, 742, 0, 612]]
4
73
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = sc.nextInt(); int b = sc.nextInt(); int c = sc.nextInt(); int k = sc.nextInt(); int ans; if (a >= k) { ans = k; } else if (a + b <= k) { ans = a; ...
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = sc.nextInt(); int b = sc.nextInt(); int c = sc.nextInt(); int k = sc.nextInt(); int ans; if (a >= k) { ans = k; } else if (a + b >= k) { ans = a; ...
[["-", 0, 57, 75, 57, 15, 15, 0, 16, 17, 19], ["+", 0, 57, 75, 57, 15, 15, 0, 16, 17, 20]]
3
125
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, c, k; cin >> a >> b >> c >> k; long long s = 0; if (k <= a) cout << a; else { k -= a; s += a; if (k <= b) cout << s; else { k -= b; s += 0; cout << s - k; } } }
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, c, k; cin >> a >> b >> c >> k; long long s = 0; if (k <= a) cout << a - (a - k); else { k -= a; s += a; if (k <= b) cout << s; else { k -= b; s += 0; cout << s - k; } } }
[["+", 0, 57, 64, 1, 0, 16, 12, 16, 17, 33], ["+", 64, 1, 0, 16, 12, 16, 12, 23, 0, 24], ["+", 0, 16, 12, 16, 12, 23, 0, 16, 31, 22], ["+", 0, 16, 12, 16, 12, 23, 0, 16, 17, 33], ["+", 0, 16, 12, 16, 12, 23, 0, 16, 12, 22], ["+", 64, 1, 0, 16, 12, 16, 12, 23, 0, 25]]
1
86
X=input().split(" ") A=int(X[0]) B=int(X[1]) C=int(X[2]) K=int(X[3]) if K<=A: print(K) elif K<=A+B: print(A) else: print(2*A-K)
X=input().split(" ") A=int(X[0]) B=int(X[1]) C=int(X[2]) K=int(X[3]) if K<=A: print(K) elif K<=A+B: print(A) else: print(2*A+B-K)
[["+", 0, 652, 3, 4, 0, 657, 31, 657, 17, 72], ["+", 0, 652, 3, 4, 0, 657, 31, 657, 12, 22]]
5
78
#include <bits/stdc++.h> using namespace std; #define lli long long int #define forz(i, n) for (lli i = 0; i < n; i++) #define pb push_back #define fi first #define se second #define mp make_pair #define pll pair<lli, lli> #define vll vector<lli> #define deci(n) fixed << setprecision(n) #define high(n) __builtin_po...
#include <bits/stdc++.h> using namespace std; #define lli long long int #define forz(i, n) for (lli i = 0; i < n; i++) #define pb push_back #define fi first #define se second #define mp make_pair #define pll pair<lli, lli> #define vll vector<lli> #define deci(n) fixed << setprecision(n) #define high(n) __builtin_po...
[["-", 8, 9, 0, 57, 64, 1, 0, 16, 12, 22], ["+", 8, 9, 0, 57, 64, 1, 0, 16, 12, 22]]
1
702
A,B,C,K = map(int,input().split()) if K <= A: print(A) elif K > A 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 K > A 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
60
A,B,C,K=map(int,input().split()) ans=0 if A>=K: ans=A elif B>=(K-A): 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 B>=(K-A): 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
60
# -*- coding: utf-8 -*- a, b, c, k = map(int, input().split()) max = 0 if a < k: max = a k -= a if 0 < k: k -= b if 0 < k: max -= k else: max = a print(max)
# -*- coding: utf-8 -*- a, b, c, k = map(int, input().split()) max = 0 if a < k: max = a k -= a if 0 < k: k -= b if 0 < k: max -= k else: max = k print(max)
[["-", 75, 76, 8, 196, 0, 1, 0, 662, 12, 22], ["+", 75, 76, 8, 196, 0, 1, 0, 662, 12, 22]]
5
60
import sys, re from math import ceil, floor, sqrt, pi, factorial, gcd from copy import deepcopy from collections import Counter, deque from heapq import heapify, heappop, heappush from itertools import accumulate, product, combinations, combinations_with_replacement from bisect import bisect, bisect_left from functools...
import sys, re from math import ceil, floor, sqrt, pi, factorial, gcd from copy import deepcopy from collections import Counter, deque from heapq import heapify, heappop, heappush from itertools import accumulate, product, combinations, combinations_with_replacement from bisect import bisect, bisect_left from functools...
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
361
def input_n gets.to_i # 単一整数 end def input_s gets.chomp # 文字列。chompを付けないと改行文字がついてくる end def input_a gets.split.map(&:to_i) # スペースで区切られた複数の整数 end def input_o(num) num.times.map { gets.to_i } # 縦に並んだ複数の整数。たまにある end def output_f(num) puts sprintf("%.12f", num) end a, b, c, k = i...
def input_n gets.to_i # 単一整数 end def input_s gets.chomp # 文字列。chompを付けないと改行文字がついてくる end def input_a gets.split.map(&:to_i) # スペースで区切られた複数の整数 end def input_o(num) num.times.map { gets.to_i } # 縦に並んだ複数の整数。たまにある end def output_f(num) puts sprintf("%.12f", num) end a, b, c, k = i...
[["-", 0, 121, 64, 749, 0, 652, 3, 4, 0, 22], ["+", 0, 121, 64, 749, 0, 652, 3, 4, 0, 22]]
4
104
a, b, c, d = map(int, input().split()) goukei = 0 if a == d: print(a) elif d == (a+b): print(a) else: goukei = (a - (d - a - b)) print(goukei)
a, b, c, d = map(int, input().split()) goukei = 0 if a >= d: print(d) elif d <= (a+b): print(a) else: goukei = a - (d - a - b) print(goukei)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 60], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 57, 75, 665, 15, 666, 667, 60], ["+", 0, 656, 0, 57, 75, 665, 15, 666, 667, 19], ["-", 8, 196, 0, 1, 0, 662, 12, 23, 0, ...
5
64
#include <algorithm> #include <bits/stdc++.h> using namespace std; #define rep(i, n) for (ll i = 0; i < (n); i++) #define repd(i, a, b) for (ll i = (a); i < (b); i++) #define INF LLONG_MAX #define mod 1000000007 typedef long long ll; int main(void) { int A, B, C, K; int sum = 0; cin >> A >> B >> C >> K; if (A <...
#include <algorithm> #include <bits/stdc++.h> using namespace std; #define rep(i, n) for (ll i = 0; i < (n); i++) #define repd(i, a, b) for (ll i = (a); i < (b); i++) #define INF LLONG_MAX #define mod 1000000007 typedef long long ll; int main(void) { int A, B, C, K; int sum = 0; cin >> A >> B >> C >> K; if (A >...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["-", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22], ["+", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22]]
1
115
A,B,C,K = map(int,input().split()) ans=0 sum_AB = A+B if K>=A: ans += A else: ans+=K print(ans) if sum_AB<=K: ans-=K-A-B print(ans)
A,B,C,K = map(int,input().split()) ans=0 sum_AB = A+B if K>=A: ans += A else: ans+=K if sum_AB<=K: ans-=K-A-B print(ans)
[["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
61
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; int sum = 0; if (a > k) { sum = a; cout << sum << '\n'; return 0; } k -= a; sum += a; if (b > k) { cout << sum << '\n'; return 0; } k -= b; sum -= k; cout << sum << '\n...
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; int sum = 0; if (a > k) { sum = k; cout << sum << '\n'; return 0; } k -= a; sum += a; if (b > k) { cout << sum << '\n'; return 0; } k -= b; sum -= k; cout << sum << '\n...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22]]
1
105
#include <bits/stdc++.h> using namespace std; #define ff first #define ss second #define ll long long #define pb push_back #define mp make_pair #define pii pair<int, int> #define vi vector<int> #define mii map<int, int> #define pqb priority_queue<int> #define pqs priority_queue<int, vi, greater<int>> #define setbits(x)...
#include <bits/stdc++.h> using namespace std; #define ff first #define ss second #define ll long long #define pb push_back #define mp make_pair #define pii pair<int, int> #define vi vector<int> #define mii map<int, int> #define pqb priority_queue<int> #define pqs priority_queue<int, vi, greater<int>> #define setbits(x)...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22]]
1
186
#include <bits/stdc++.h> #define ll long long using namespace std; int solve(int a, int b, int c, int k) { return min(0, a + b - k) + a; } int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int a, b, c, k; cin >> a >> b >> c >> k; cout << solve(a, b, c, k) << "\n"; }
#include <bits/stdc++.h> #define ll long long using namespace std; int solve(int a, int b, int c, int k) { return min(0, a + b - k) + min(a, k); } int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int a, b, c, k; cin >> a >> b >> c >> k; cout << solve(a, b, c, k) << "\n"; }
[["+", 8, 9, 0, 37, 0, 16, 12, 2, 63, 22], ["+", 0, 37, 0, 16, 12, 2, 3, 4, 0, 24], ["+", 0, 37, 0, 16, 12, 2, 3, 4, 0, 21], ["+", 0, 37, 0, 16, 12, 2, 3, 4, 0, 22], ["+", 0, 37, 0, 16, 12, 2, 3, 4, 0, 25]]
1
96
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) using ll = long long; const ll MOD = 1000000007; int main() { ll A, B, C, K; cin >> A >> B >> C >> K; ll ans; if (K <= A) { ans = K; } if (A < K <= A + B) { ans = A; } if (A + B < K) { ans = 2 * A ...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) using ll = long long; const ll MOD = 1000000007; int main() { ll A, B, C, K; cin >> A >> B >> C >> K; ll ans; if (K <= A) { ans = K; } if (A < K && K <= A + B) { ans = A; } if (A + B < K) { ans = 2...
[["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22]]
1
111
mNum = map(int, input().split()) lNum = list(mNum) weight = [1, 0, -1] sumAns = 0 for i in range(3): sumAns += lNum[i] * weight[i] if lNum[i] <= lNum[3] else lNum[3] * weight[i] lNum[3] -= lNum[i] if(lNum[i] <= 0): break print(sumAns)
mNum = map(int, input().split()) lNum = list(mNum) weight = [1, 0, -1] sumAns = 0 for i in range(3): sumAns += lNum[i] * weight[i] if lNum[i] <= lNum[3] else lNum[3] * weight[i] lNum[3] -= lNum[i] if(lNum[3] <= 0): break print(sumAns)
[["-", 0, 57, 15, 23, 0, 666, 0, 206, 206, 22], ["+", 0, 57, 15, 23, 0, 666, 0, 206, 206, 612]]
5
96
#include <iostream> int main() { std::size_t A, B, C, K; std::cin >> A >> B >> C >> K; if (K <= A) { std::cout << K << std::endl; } else if (K <= A + B) { std::cout << A << std::endl; } else { std::cout << A - (K - A - B) << std::endl; } return 0; }
#include <iostream> int main() { std::int64_t A, B, C, K; std::cin >> A >> B >> C >> K; if (K <= A) { std::cout << K << std::endl; } else if (K <= A + B) { std::cout << A << std::endl; } else { std::cout << A - (K - A - B) << std::endl; } return 0; }
[["-", 0, 14, 8, 9, 0, 43, 39, 343, 141, 78], ["+", 0, 14, 8, 9, 0, 43, 39, 343, 141, 78]]
1
94
#include <bits/stdc++.h> typedef uint64_t u64; typedef int64_t i64; typedef uint32_t u32; typedef int32_t i32; #define MAX_NUM (1000000000 + 7) using namespace std; template <typename T> static inline void ArrayInput(vector<T> &A) { for (auto itr = A.begin(); itr < A.end(); ++itr) cin >> *itr; } template <ty...
#include <bits/stdc++.h> typedef uint64_t u64; typedef int64_t i64; typedef uint32_t u32; typedef int32_t i32; #define MAX_NUM (1000000000 + 7) using namespace std; template <typename T> static inline void ArrayInput(vector<T> &A) { for (auto itr = A.begin(); itr < A.end(); ++itr) cin >> *itr; } template <ty...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
663
#include <bits/stdc++.h> using namespace std; typedef long int li; typedef long long ll; int main() { ios::sync_with_stdio(false); cin.tie(0); ll a, b, c, k; cin >> a >> b >> c >> k; if (a < k) { if (b < (k - a)) { cout << a - (k - a - b) << "\n"; return 0; } else { cout << a << ...
#include <bits/stdc++.h> using namespace std; typedef long int li; typedef long long ll; int main() { ios::sync_with_stdio(false); cin.tie(0); ll a, b, c, k; cin >> a >> b >> c >> k; if (a < k) { if (b < (k - a)) { cout << a - (k - a - b) << "\n"; return 0; } else { cout << a << ...
[["-", 75, 76, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 75, 76, 0, 1, 0, 16, 31, 16, 12, 22]]
1
120
A, B, C, K = map(int, input().split()) sum = 0 if K >= A: sum = A K -= A if K > B: K -= B sum -= K print(sum) else: print(sum) else: sum = A - K print(sum)
A, B, C, K = map(int, input().split()) sum = 0 if K >= A: sum = A K -= A if K > B: K -= B sum -= K print(sum) else: print(sum) else: sum = K print(sum)
[["-", 8, 196, 0, 1, 0, 662, 12, 657, 31, 22], ["-", 8, 196, 0, 1, 0, 662, 12, 657, 17, 33]]
5
66
#include <bits/stdc++.h> using namespace std; int a, b, c, k; int main() { scanf("%d%d%d%d", &a, &b, &c, &k); if (k <= a) { printf("%d", a); } else { int sum = a; k -= a; if (k <= b) { printf("%d", sum); } else { k -= b; printf("%d", sum - k); } } return 0; }
#include <bits/stdc++.h> using namespace std; int a, b, c, k; int main() { scanf("%d%d%d%d", &a, &b, &c, &k); if (k <= a) { printf("%d", k); } else { int sum = a; k -= a; if (k <= b) { printf("%d", sum); } else { k -= b; printf("%d", sum - k); } } return 0; }
[["-", 64, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 64, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
1
107
import java.util.Scanner; public class Main { public static void main(final String[] args) { final Scanner scanner = new Scanner(System.in); final int A = scanner.nextInt(); final int B = scanner.nextInt(); final int C = scanner.nextInt(); final int K = scanner.nextInt(); if (A >= K) { ...
import java.util.Scanner; public class Main { public static void main(final String[] args) { final Scanner scanner = new Scanner(System.in); final int A = scanner.nextInt(); final int B = scanner.nextInt(); final int C = scanner.nextInt(); final int K = scanner.nextInt(); if (A >= K) { ...
[["-", 64, 196, 0, 1, 0, 492, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 492, 3, 4, 0, 22]]
3
137
#include <bits/stdc++.h> using namespace std; int main() { long a, b, c, k, ans = 0; cin >> a >> b >> c >> k; if (a + b >= k) ans = a; else ans = a - (k - a - b); cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; int main() { long a, b, c, k, ans = 0; cin >> a >> b >> c >> k; if (a + b >= k) ans = min(a, k); else ans = a - (k - a - b); cout << ans << endl; }
[["+", 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
66
#include <iostream> #include <set> #include <string> #include <vector> using namespace std; int main() { uint32_t a, b, c; int 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; ...
#include <iostream> #include <set> #include <string> #include <vector> using namespace std; int main() { int32_t a, b, c; int 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; }
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40]]
1
91
#include <algorithm> #include <bits/stdc++.h> #include <cstdlib> #include <iostream> #include <math.h> #include <queue> #include <stdio.h> #include <string> #include <vector> using namespace std; int main() { long long a, b, c, k; cin >> a >> b >> c >> k; long long sum = 0; if (a >= k) { sum = a; } else ...
#include <algorithm> #include <bits/stdc++.h> #include <cstdlib> #include <iostream> #include <math.h> #include <queue> #include <stdio.h> #include <string> #include <vector> using namespace std; int main() { long long a, b, c, k; cin >> a >> b >> c >> k; long long sum = 0; if (a >= k) { sum = k; } else ...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22]]
1
108
a,b,c,k=list(map(int,input().split())) if a>=k: print(k) else: if a+b>=k: print(a) else: print(a-(k-c))
a,b,c,k=list(map(int,input().split())) if a>=k: print(k) else: if a+b>=k: print(a) else: print(a-(k-a-b))
[["-", 3, 4, 0, 657, 12, 23, 0, 657, 12, 22], ["+", 0, 657, 12, 23, 0, 657, 31, 657, 12, 22], ["+", 3, 4, 0, 657, 12, 23, 0, 657, 17, 33], ["+", 3, 4, 0, 657, 12, 23, 0, 657, 12, 22]]
5
57
#include <algorithm> #include <bits/stdc++.h> #include <cmath> #include <cstdlib> #include <map> #define _GLIBCXX_DEBUG #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; typedef long long ll; ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } ll lcm(ll a, ll b) { return a / gcd(a, b) * b; } int mai...
#include <algorithm> #include <bits/stdc++.h> #include <cmath> #include <cstdlib> #include <map> #define _GLIBCXX_DEBUG #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; typedef long long ll; ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } ll lcm(ll a, ll b) { return a / gcd(a, b) * b; } int mai...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
164
A, B, C, K = map(int, input().split()) if( K <= A ): print(K) elif( K > A and K <= A + B): print(A) else: print(A - ( K - C))
A, B, C, K = map(int, input().split()) if( K <= A ): print(K) elif( K > A and K <= A + B): print(A) else: print(A - ( K - (A + B)))
[["-", 3, 4, 0, 657, 12, 23, 0, 657, 12, 22], ["+", 0, 657, 12, 23, 0, 657, 12, 23, 0, 24], ["+", 12, 23, 0, 657, 12, 23, 0, 657, 31, 22], ["+", 12, 23, 0, 657, 12, 23, 0, 657, 17, 72], ["+", 12, 23, 0, 657, 12, 23, 0, 657, 12, 22], ["+", 0, 657, 12, 23, 0, 657, 12, 23, 0, 25]]
5
60
A, B, C, K = map(int, input().split()) num = K score = 0 if A >= num: score = A else: num -= A score += A if B >= num: pass else: num -= B score -= num print(score)
A, B, C, K = map(int, input().split()) num = K score = 0 if A >= num: score = K else: num -= A score += A if B >= num: pass else: num -= B score -= num print(score)
[["-", 0, 57, 64, 196, 0, 1, 0, 662, 12, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 12, 22]]
5
60
A, B, C, K = list(map(int, input().split())) number_of_A = min(A, K) remainder = K - number_of_A number_of_B = min(B, remainder) remainder = remainder - B number_of_C = remainder total = (number_of_A * 1) + \ (number_of_B * 0) + \ (number_of_C * -1) print(total)
A, B, C, K = list(map(int, input().split())) number_of_A = min(A, K) remainder = K - number_of_A number_of_B = min(B, remainder) remainder = remainder - number_of_B number_of_C = remainder total = (number_of_A * 1) + \ (number_of_B * 0) + \ (number_of_C * -1) print(total)
[["-", 0, 656, 0, 1, 0, 662, 12, 657, 12, 22], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 12, 22]]
5
78
def readinput(): a,b,c,k = list(map(int,input().split())) return a,b,c,k def main(a,b,c,k): if(a>=k): return a k2=k-a if(b>=k2): return a k3=k2-b return a-k3 if __name__=='__main__': a,b,c,k=readinput() ans=main(a,b,c,k) print(ans)
def readinput(): a,b,c,k = list(map(int,input().split())) return a,b,c,k def main(a,b,c,k): if(a>=k): return k k2=k-a if(b>=k2): return a k3=k2-b return a-k3 if __name__=='__main__': a,b,c,k=readinput() ans=main(a,b,c,k) print(ans)
[["-", 8, 196, 0, 57, 64, 196, 0, 37, 0, 22], ["+", 8, 196, 0, 57, 64, 196, 0, 37, 0, 22]]
5
114
a,b,c,k = map(int,input().split()) if(a>=k): print(a) else: if(a+b>=k): print(a) else: print(a-(k-(a+b)))
a,b,c,k = map(int,input().split()) if(a>=k): print(k) else: if(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
62
#include <bits/stdc++.h> using namespace std; typedef long long ll; //マクロ // forループ関係 //引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか // Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる #define REP(i, n) for (ll i = 0; i < (ll)(n); i++) #define REPD(i, n) for (ll i = n - 1; i >= 0; i--) #define FOR(i, a, b) for...
#include <bits/stdc++.h> using namespace std; typedef long long ll; //マクロ // forループ関係 //引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか // Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる #define REP(i, n) for (ll i = 0; i < (ll)(n); i++) #define REPD(i, n) for (ll i = n - 1; i >= 0; i--) #define FOR(i, a, b) for...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
176
A, B, C, K = map(int,input().split()) if K - A <= 0: print(A * 1) elif K - A - B <= 0: print(A * 1) else: temp = K - A - B print(A * 1 + temp * -1)
A, B, C, K = map(int,input().split()) if K - A <= 0: print(K * 1) elif K - A - B <= 0: print(A * 1) else: temp = K - A - B print(A * 1 + temp * -1)
[["-", 0, 1, 0, 652, 3, 4, 0, 657, 31, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 31, 22]]
5
68
#include <bits/stdc++.h> #define rep(i, n) for (long long int i = 0; i < n; i++) #define _rep(i, m, n) for (long long int i = m; i < n; i++) using namespace std; typedef long long ll; typedef pair<int, int> P; const int N = 1000000; const ll mod = 1000000007; using Graph = vector<vector<int>>; const int dx[4] = {1, 0, ...
#include <bits/stdc++.h> #define rep(i, n) for (long long int i = 0; i < n; i++) #define _rep(i, m, n) for (long long int i = m; i < n; i++) using namespace std; typedef long long ll; typedef pair<int, int> P; const int N = 1000000; const ll mod = 1000000007; using Graph = vector<vector<int>>; const int dx[4] = {1, 0, ...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
250
#!/usr/bin/env python3 a, b, c, k = map(int, input().split()) ans = min(a, k)*1 + min(b, k-a)*0 + min(c, k-a-b)*(-1) print(ans)
#!/usr/bin/env python3 a, b, c, k = map(int, input().split()) ans = min(a, k)*1 + min(b, k-a)*0 + max(k-a-b,0)*(-1) print(ans)
[["-", 0, 662, 12, 657, 12, 657, 31, 652, 63, 22], ["+", 0, 662, 12, 657, 12, 657, 31, 652, 63, 22], ["-", 12, 657, 12, 657, 31, 652, 3, 4, 0, 22], ["-", 12, 657, 12, 657, 31, 652, 3, 4, 0, 21], ["+", 12, 657, 12, 657, 31, 652, 3, 4, 0, 21], ["+", 12, 657, 12, 657, 31, 652, 3, 4, 0, 612]]
5
62