buggy_code
stringlengths
11
625k
fixed_code
stringlengths
17
625k
bug_type
stringlengths
2
4.45k
language
int64
0
8
token_count
int64
5
200k
#include <stdio.h> int main() { int A, B, C, K; int totyu = 0; int sai = 0; scanf("%d %d %d %d", &A, &B, &C, &K); if (A - K >= 0) { printf("%d\n", A); } else { if (A + B - K >= 0) { printf("%d\n", A); } else { totyu = K - A - B; sai = A - totyu; // printf("%d\n",totyu); ...
#include <stdio.h> int main() { int A, B, C, K; int totyu = 0; int sai = 0; scanf("%d %d %d %d", &A, &B, &C, &K); if (A - K >= 0) { printf("%d\n", K); } else { if (A + B - K >= 0) { printf("%d\n", A); } else { totyu = K - A - B; sai = A - totyu; // printf("%d\n",totyu); ...
[["-", 64, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 64, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
0
122
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int A, B, C, K; cin >> A >> B >> C >> K; ll ans = A; if (A >= K) { cout << ans << endl; return 0; } else { K -= A; if (B >= K) { cout << ans << endl; return 0; } else { K -= B; cout <<...
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int A, B, C, K; cin >> A >> B >> C >> K; ll ans = A; if (A >= K) { cout << K << endl; return 0; } else { K -= A; if (B >= K) { cout << ans << endl; return 0; } else { K -= B; cout << a...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
100
A,B,C,K = map(int,input().split()) answer = 0 if K <= A: print(K) elif K > A: answer = A K = K - A if K <= B and K > 0 : print(answer) elif K > B: K = K - B if K <= C and K > 0: answer = answer - K print(answer)
A,B,C,K = map(int,input().split()) answer = 0 if K <= A: print(K) K = 0 elif K > A: answer = A K = K - A if K <= B and K > 0 : print(answer) K = 0 elif K > B: K = K - B if K <= C and K > 0: answer = answer - K print(answer)
[["+", 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, 612]]
5
86
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, c, k; cin >> a >> b >> c >> k; long long ans = 0; if (k < a) ans = k; else if (k >= a && k < a + b) ans = a; else if (k >= a + b) ans = k - b; cout << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, c, k; cin >> a >> b >> c >> k; long long ans = 0; if (k < a) ans = k; else if (k >= a && k < a + b) ans = a; else if (k >= a + b) ans = a + a + b - k; cout << ans << endl; return 0; }
[["-", 0, 57, 64, 1, 0, 11, 12, 16, 31, 22], ["-", 0, 57, 64, 1, 0, 11, 12, 16, 17, 33], ["+", 0, 11, 12, 16, 31, 16, 31, 16, 31, 22], ["+", 0, 11, 12, 16, 31, 16, 31, 16, 17, 72], ["+", 0, 11, 12, 16, 31, 16, 31, 16, 12, 22], ["+", 64, 1, 0, 11, 12, 16, 31, 16, 17, 72], ["+", 0, 57, 64, 1, 0, 11, 12, 16, 17, 33], ["+"...
1
89
#include <bits/stdc++.h> using namespace std; int main() { long long A, B, C, K; cin >> A >> B >> C >> K; long long m = 0; if (K > A) { m += A; } else { m += K; cout << m << endl; return 0; } if (K - A < B) { cout << m << endl; return 0; } if (K - A - B - C > 0) { m -= K - ...
#include <bits/stdc++.h> using namespace std; int main() { long long A, B, C, K; cin >> A >> B >> C >> K; long long m = 0; if (K > A) { m += A; } else { m += K; cout << m << endl; return 0; } if (K - A <= B) { cout << m << endl; return 0; } if (K - A - B - C <= 0) { m -= K ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["-", 64, 9, 0, 1, 0, 11, 12, 16, 17, 33], ["-", 64, 9, 0, 1, 0, 11, 12, 16, 12, 22]]
1
115
a, b, c, k = map(int, input().split()) if a >= k: print(a) exit() else: k -= a k -= b if k > 0: print(a - k) else: print(a)
a, b, c, k = map(int, input().split()) if a >= k: print(k) exit() else: k -= a k -= b if k > 0: print(a - k) else: print(a)
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
57
a, b, c, k = map(int, input().split()) ans = 1 if k <= a: ans = k if k > a + b: ans = ans - (k - (a+b)) print(ans)
a, b, c, k = map(int, input().split()) ans = a if k < a: ans = k if k > a + b: ans = ans - (k - (a+b)) print(ans)
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 22], ["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 19], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 18]]
5
55
A,B,C,K=map(int,input().split()) if A>=K: print(A) else: x=K-A if x<=B: print(A) else: y=K-A-B print(A-y)
A,B,C,K=map(int,input().split()) if A>=K: print(K) else: x=K-A if x<=B: print(A) else: y=K-A-B print(A-y)
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
60
#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef tuple<ll, ll, ll> mytuple; const ll INF = 1e9; const ll MOD = 1000000007; const double pi = 3.141592653589793238; // a と b の最大公約数を返す関数 long long GCD(long long a, long long b) { if (b == 0) { return a; } else { ...
#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef tuple<ll, ll, ll> mytuple; const ll INF = 1e9; const ll MOD = 1000000007; const double pi = 3.141592653589793238; // a と b の最大公約数を返す関数 long long GCD(long long a, long long b) { if (b == 0) { return a; } else { ...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22]]
1
292
a,b,c,k= map(int, input().split()) if k<= a: print(k) elif k <= a+b: print(a) else: print(2*a-k)
a,b,c,k= map(int, input().split()) 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
50
a, b, c, k = map(int, input().split()) total=0 total+=a if k - a == 0: print(total) elif k - a < 0: print(total-k) else: k-=a if k - b <= 0: print(total) else: k-=b print(total-k)
a, b, c, k = map(int, input().split()) total=0 total+=a if k - a == 0: print(total) elif k - a < 0: print(k) else: k-=a if k - b <= 0: print(total) else: k-=b print(total-k)
[["-", 0, 1, 0, 652, 3, 4, 0, 657, 31, 22], ["-", 0, 1, 0, 652, 3, 4, 0, 657, 17, 33]]
5
77
#include <bits/stdc++.h> using namespace std; typedef long long Int; #define rep(i, n) for (int i = 0; i < (int)(n); i++) int main() { Int a, b, c, k; cin >> a >> b >> c >> k; Int ans = 0; if (a >= k) { cout << a << endl; return 0; } ans = a; k -= a; k -= b; if (k > 0) { ans -= k; } ...
#include <bits/stdc++.h> using namespace std; typedef long long Int; #define rep(i, n) for (int i = 0; i < (int)(n); i++) int main() { Int a, b, c, k; cin >> a >> b >> c >> k; Int ans = 0; if (a >= k) { cout << k << endl; return 0; } ans = a; k -= a; k -= b; if (k > 0) { ans -= k; } ...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
96
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, k; long long sum; sum = 0; cin >> a >> b >> c >> k; if (k >= a) { sum += a; k -= a; k -= b; if (k > 0) { sum -= k; } } else { sum += a; } cout << sum << "\n"; }
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, k; int sum; sum = 0; cin >> a >> b >> c >> k; if (k >= a) { sum += a; k -= a; k -= b; if (k > 0) { sum -= k; } } else { sum += k; } cout << sum << "\n"; }
[["-", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 75, 76, 0, 9, 0, 1, 0, 11, 12, 22], ["+", 75, 76, 0, 9, 0, 1, 0, 11, 12, 22]]
1
86
#include <bits/stdc++.h> using namespace std; int main() { int64_t A, B, C, K; cin >> A >> B >> C >> K; int64_t ans = 0; if (A >= K) { cout << A << endl; } else { ans += A; K -= A; if (B >= K) { cout << ans << endl; } else { K -= B; cout << ans - K << endl; } } }
#include <bits/stdc++.h> using namespace std; int main() { int64_t A, B, C, K; cin >> A >> B >> C >> K; int64_t ans = 0; if (A >= K) { cout << K << endl; } else { ans += A; K -= A; if (B >= K) { cout << ans << endl; } else { K -= B; cout << ans - K << endl; } } }
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
90
A,B,C,K = map(int,input().split()) if A >= K: print(K) elif A + B >= K: print(K) else: print(A - (K-(A+B)))
A,B,C,K = map(int,input().split()) if A >= K: print(K) elif A + B >= K: print(A) else: print(A - (K-(A+B)))
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
56
#include <iostream> using namespace std; int A, B, C, K; int main() { cin >> A >> B >> C >> K; if (A >= K) cout << A << endl; else if (A < K && A + B >= K) cout << A << endl; else cout << 2 * A - K + B << endl; return 0; }
#include <iostream> using namespace std; int A, B, C, K; int main() { cin >> A >> B >> C >> K; if (A >= K) cout << K << endl; else if (A < K && A + B >= K) cout << A << endl; else cout << 2 * A - K + 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
78
A,B,C,K = map(int,input().split()) if A>=K: print(A) elif (A+B)>=K: print(A) else: S = K-(A+B) print(A-S)
A,B,C,K = map(int,input().split()) if A>=K: print(K) elif A+B>=K: print(A) else: S = K-(A+B) print(A-S)
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 57, 75, 665, 15, 666, 0, 23, 0, 24], ["-", 0, 57, 75, 665, 15, 666, 0, 23, 0, 25]]
5
59
#include <bits/stdc++.h> #define all(x) (x).begin(), (x).end() using namespace std; typedef long long ll; const int MOD = 1e9 + 7; int main() { ll a, b, c, k; cin >> a >> b >> c >> k; if (a >= k) { cout << a << endl; } else { k -= a; if (b >= k) { cout << a << endl; } else { k -= b;...
#include <bits/stdc++.h> #define all(x) (x).begin(), (x).end() using namespace std; typedef long long ll; const int MOD = 1e9 + 7; int main() { ll a, b, c, k; cin >> a >> b >> c >> k; if (a >= k) { cout << k << endl; } else { k -= a; if (b >= k) { cout << a << endl; } else { k -= b;...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
103
#include <iostream> using namespace std; int main() { int A, B, C, K; int sum = 0; cin >> A >> B >> C >> K; if (A >= K) { sum = A; } else if (A + B >= K) { sum = A; } else { sum = A - (K - (A + B)); } cout << sum << endl; }
#include <iostream> using namespace std; int main() { int A, B, C, K; int sum = 0; cin >> A >> B >> C >> K; if (A > K) { sum = K; } else if ((A + B) >= K) { sum = A; } else { sum = A - (K - (A + B)); } cout << sum << endl; }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 75, 76, 0, 57, 15, 339, 0, 24], ["+", 0, 57, 15, 339, 51, 16, 31, 23, 0, 25]]
1
86
#include <bits/stdc++.h> using namespace std; int main() { long long A, B, C, K; cin >> A >> B >> C >> K; if (A >= K) { cout << K << endl; } else if (A < K) { if (B >= K - A) { cout << K - A << endl; } else { if (C >= K - A - B) { cout << A - K + A + B << endl; } else { ...
#include <bits/stdc++.h> using namespace std; int main() { long long A, B, C, K; cin >> A >> B >> C >> K; if (A >= K) { cout << K << endl; } else if (A < K) { if (B >= K - A) { cout << A << endl; } else { if (C >= K - A - B) { cout << A - K + A + B << endl; } else { ...
[["-", 0, 1, 0, 16, 31, 16, 12, 16, 31, 22], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 17, 33]]
1
113
require 'pp' a, b, c, k = gets.split.map(&:to_i) if a >= k puts a - k exit 0 end k -= a if b >= k puts a exit 0 end k -= b puts (a-k)
require 'pp' a, b, c, k = gets.split.map(&:to_i) if a >= k puts k exit 0 end k -= a if b >= k puts a exit 0 end k -= b puts (a-k)
[["-", 64, 749, 0, 652, 3, 4, 0, 738, 31, 22], ["-", 64, 749, 0, 652, 3, 4, 0, 738, 17, 33]]
4
53
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; int main() { ll 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 && K <= 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>; int main() { ll 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 && K <= A + B + C...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 47], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 18]]
1
113
#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 << 2 * A - K - 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 << 2 * A - K + B << endl; } }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 17, 33], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 72]]
1
77
#include <iostream> using namespace std; void solve(long long A, long long B, long long C, long long K) { int ans = 0; if (A < K) { K -= A; ans += A; } else { cout << A << endl; return; } if (B < K) { K -= B; } else { cout << ans << endl; return; } if (C < K) { cout <<...
#include <iostream> using namespace std; void solve(long long A, long long B, long long C, long long K) { int ans = 0; if (A < K) { K -= A; ans += A; } else { cout << K << endl; return; } if (B < K) { K -= B; } else { cout << ans << endl; return; } if (C < K) { cout <<...
[["-", 0, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 0, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
192
a,b,c,k=`dd`.split.map &:to_i if k<=a p k elsif a<k && k<=a+b p a else a-(k-(a+b)) end
a,b,c,k=`dd`.split.map &:to_i if k<=a p k elsif a<k && k<=a+b p a else p a-(k-(a+b)) end
[["+", 0, 121, 75, 759, 75, 95, 0, 652, 735, 22]]
4
48
import java.util.Scanner; 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(); if (a >= k) { System.out.println(a); } else if (a + b >= k) { ...
import java.util.Scanner; 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(); if (a >= k) { System.out.println(k); } else if (a + b >= k) { ...
[["-", 64, 196, 0, 1, 0, 492, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 492, 3, 4, 0, 22]]
3
127
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int MAX = 510000; const int MOD = 1000000007; int main() { ll a, b, c, k; cin >> a >> b >> c >> k; ll ans = 0; ll ct = 0; if (k >= a) { ans += min(a, k); } if (k >= 0) { k -= b; } if (k >= 0) { ans -= min(k, c); ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int MAX = 510000; const int MOD = 1000000007; int main() { ll a, b, c, k; cin >> a >> b >> c >> k; ll ans = 0; ll ct = 0; if (k >= 0) { ans += min(a, k); k -= a; } if (k >= 0) { k -= b; } if (k >= 0) { ans -= m...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 110], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22]]
1
108
a, b, c, k = map(int, input().split()) if k <= a: ans = a else: ans = a k = k - a # print("a") if k >= b: k = k - b ans += k * (-1) print(ans)
a, b, c, k = map(int, input().split()) if k <= a: ans = k else: ans = a k = k - a # print("a") if k >= b: k = k - b ans += k * (-1) print(ans)
[["-", 0, 57, 64, 196, 0, 1, 0, 662, 12, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 12, 22]]
5
61
a,b,c,k=map(int,(input().split())) if a >= k: print(a) else: if a + b > k: print(a) else: d = k -(a + b) print(a-d)
a,b,c,k=map(int,(input().split())) if a >= k: print(k) else: if a + b > k: print(a) else: d = k -(a + b) print(a-d)
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
61
from sys import stdin A, B, C, K = map(int, stdin.readline().rstrip().split()) res = int(0) def f(p, n, k, res): if (k - n) >= 0: return k - n, p * (k - n) + res else: return 0, p * k + res K, res = f(1, A, K, res) K, res = f(0, B, K, res) _, res = f(-1, C, K, res) print(res)
from sys import stdin A, B, C, K = map(int, stdin.readline().rstrip().split()) res = int(0) def f(p, n, k, res): if (k - n) >= 0: return k - n, p * n + res else: return 0, p * k + res K, res = f(1, A, K, res) K, res = f(0, B, K, res) _, res = f(-1, C, K, res) print(res)
[["-", 0, 432, 0, 657, 31, 657, 12, 23, 0, 24], ["-", 0, 657, 31, 657, 12, 23, 0, 657, 31, 22], ["-", 0, 657, 31, 657, 12, 23, 0, 657, 17, 33], ["-", 0, 432, 0, 657, 31, 657, 12, 23, 0, 25]]
5
128
A, B, C, K = map(int, input().split()) if A >= K: print(K) elif A+B >= K: print(A) else: print(A-(C-K+B))
A, B, C, K = map(int, input().split()) if A >= K: print(K) elif A+B >= K: print(A) else: print(A-(K-A-B))
[["-", 0, 657, 12, 23, 0, 657, 31, 657, 31, 22], ["-", 0, 657, 12, 23, 0, 657, 31, 657, 17, 33], ["-", 3, 4, 0, 657, 12, 23, 0, 657, 17, 72], ["+", 0, 657, 12, 23, 0, 657, 31, 657, 17, 33], ["+", 0, 657, 12, 23, 0, 657, 31, 657, 12, 22], ["+", 3, 4, 0, 657, 12, 23, 0, 657, 17, 33]]
5
54
a,b,c,k= (int(x) for x in input().split()) if a >= k: print(a) elif a+b >= k: print(a) elif a+b+c >= k: print(a - (k-(a+b))) else: print(0)
a,b,c,k= (int(x) for x in input().split()) if a >= k: print(k) elif a+b >= k: print(a) elif a+b+c >= k: print(a - (k-(a+b))) else: print(0)
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
73
#include <bits/stdc++.h> using namespace std; int main() { int A, B, C, K; cin >> A >> B >> C >> K; if (K <= A + B) { cout << A << endl; } else cout << (A - (K - (A + B))) << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int A, B, C, K; cin >> A >> B >> C >> K; if (K <= A + B) { cout << min(K, A) << endl; } else cout << (A - (K - (A + B))) << endl; }
[["+", 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
66
#include <stdio.h> int main() { int a, b, c, k; int total; scanf("%d %d %d %d", &a, &b, &c, &k); if (k <= a) { total = a; } if (k > a && k <= a + b) { total = a; } if (k > a + b) { total = a - (c - b); } printf("%d\n", total); return 0; }
#include <stdio.h> int main() { int a, b, c, k; int total; scanf("%d %d %d %d", &a, &b, &c, &k); if (k <= a) { total = k; } if (k > a && k <= a + b) { total = a; } if (k > a + b) { total = a - (k - a - b); } printf("%d\n", total); return 0; }
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["-", 0, 11, 12, 16, 12, 23, 0, 16, 31, 22], ["+", 12, 16, 12, 23, 0, 16, 31, 16, 31, 22], ["+", 12, 16, 12, 23, 0, 16, 31, 16, 17, 33], ["+", 12, 16, 12, 23, 0, 16, 31, 16, 12, 22]]
0
102
#include <stdio.h> /** * * 考え方 * 与えられたKの中でA, Bに割ける分は全部割く * どうしても余った分をCに割く **/ int main() { int A /* 1と書かれたカードの枚数 */, B /* 0と書かれたカードの枚数 */, C /* -1と書かれたカードの枚数 */, K /* 取る枚数 */; scanf("%d%d%d%d", &A, &B, &C, &K); int output; int rest; if (A <= K) { output = 1 * A; rest = K - A; if (rest...
#include <stdio.h> /** * * 考え方 * 与えられたKの中でA, Bに割ける分は全部割く * どうしても余った分をCに割く **/ int main() { int A /* 1と書かれたカードの枚数 */, B /* 0と書かれたカードの枚数 */, C /* -1と書かれたカードの枚数 */, K /* 取る枚数 */; scanf("%d%d%d%d", &A, &B, &C, &K); int output; int rest; if (A <= K) { output = 1 * A; rest = K - A; /* prin...
[["-", 0, 11, 12, 16, 12, 23, 0, 16, 12, 22], ["+", 0, 11, 12, 16, 12, 23, 0, 16, 12, 22]]
0
153
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, k, sum = 0; cin >> a >> b >> c >> k; if (a >= k) { cout << a << endl; return 0; } sum = a; k -= a; if (b >= k) { cout << sum << endl; return 0; } k -= b; cout << sum - min(k, c) << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, k, sum = 0; cin >> a >> b >> c >> k; if (a >= k) { cout << k << endl; return 0; } sum += a; k -= a; if (b >= k) { cout << sum << endl; return 0; } k -= b; cout << sum - min(k, c) << endl; return 0; }
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["-", 0, 14, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 17, 107]]
1
97
import sys import math def I():return int(sys.stdin.readline().replace("\n","")) def I2():return map(int,sys.stdin.readline().replace("\n","").split()) def S():return str(sys.stdin.readline().replace("\n","")) def L():return list(sys.stdin.readline().replace("\n","")) def intl():return [int(k) for k in sys.stdin.readli...
import sys import math def I():return int(sys.stdin.readline().replace("\n","")) def I2():return map(int,sys.stdin.readline().replace("\n","").split()) def S():return str(sys.stdin.readline().replace("\n","")) def L():return list(sys.stdin.readline().replace("\n","")) def intl():return [int(k) for k in sys.stdin.readli...
[["-", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
255
#pragma GCC optimize("Ofast") #include <bits/stdc++.h> #define all(x) x.begin(), x.end() #define sz(s) (int)s.size() #define pb push_back #define rc(x) return cout << x << "\n", 0 using namespace std; void solve() { long long a, b, c, k, ans = 0; cin >> a >> b >> c >> k; if (k <= a) cout << a; else if (a...
#pragma GCC optimize("Ofast") #include <bits/stdc++.h> #define all(x) x.begin(), x.end() #define sz(s) (int)s.size() #define pb push_back #define rc(x) return cout << x << "\n", 0 using namespace std; void solve() { long long a, b, c, k, ans = 0; cin >> a >> b >> c >> k; if (k <= a) cout << k; else if (a...
[["-", 8, 9, 0, 57, 64, 1, 0, 16, 12, 22], ["+", 8, 9, 0, 57, 64, 1, 0, 16, 12, 22]]
1
189
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef pair<ll, ll> P; #define REP(i, n) for (ll i = 0LL; i < (ll)(n); i++) #define REPR(i, n) for (ll i = n - 1; i >= 0LL; i--) #define FOR(i, n, m) for (ll i = n; i < (ll)(m); i++) #define PRINT(x) cout << x << endl #define ALL(v) v.begin(), v....
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef pair<ll, ll> P; #define REP(i, n) for (ll i = 0LL; i < (ll)(n); i++) #define REPR(i, n) for (ll i = n - 1; i >= 0LL; i--) #define FOR(i, n, m) for (ll i = n; i < (ll)(m); i++) #define PRINT(x) cout << x << endl #define ALL(v) v.begin(), v....
[["-", 64, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 64, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
1
260
package main import ( "bufio" "fmt" "os" "strconv" ) var sc = bufio.NewScanner(os.Stdin) func nextInt() int { sc.Scan() num, err := strconv.Atoi(sc.Text()) if err != nil { panic(err) } return num } func nextString() string { sc.Scan() return sc.Text() } func main() { sc.Split(bufio.ScanWords) a := ...
package main import ( "bufio" "fmt" "os" "strconv" ) var sc = bufio.NewScanner(os.Stdin) func nextInt() int { sc.Scan() num, err := strconv.Atoi(sc.Text()) if err != nil { panic(err) } return num } func nextString() string { sc.Scan() return sc.Text() } func main() { sc.Split(bufio.ScanWords) a := ...
[["-", 0, 57, 64, 196, 0, 37, 0, 432, 0, 22], ["+", 0, 57, 64, 196, 0, 37, 0, 432, 0, 22]]
7
195
#include <bits/stdc++.h> #define ll long long #define MODV 1000000007 #define INF INT_MAX // 2147483647 #define INFLL LLONG_MAX // 9223372036854775807 #define rep(i, n) for (ll i = 0, i##_len = (ll)(n); i < i##_len; i++) #define repf(i, n) for (ll i = 1, i##_len = (ll)(n + 1); i < i##_len; i++) #define per(i, n) fo...
#include <bits/stdc++.h> #define ll long long #define MODV 1000000007 #define INF INT_MAX // 2147483647 #define INFLL LLONG_MAX // 9223372036854775807 #define rep(i, n) for (ll i = 0, i##_len = (ll)(n); i < i##_len; i++) #define repf(i, n) for (ll i = 1, i##_len = (ll)(n + 1); i < i##_len; i++) #define per(i, n) fo...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
251
#include <bits/stdc++.h> #pragma gcc optimize("ofast") using namespace std; #define ll \ long long // data types used often, but you don't want to type them time by // time #define ull unsigned long long #define ui unsigned int #define m...
#include <bits/stdc++.h> #pragma gcc optimize("ofast") using namespace std; #define ll \ long long // data types used often, but you don't want to type them time by // time #define ull unsigned long long #define ui unsigned int #define m...
[["+", 64, 1, 0, 16, 31, 16, 12, 2, 63, 22], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 24], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 22], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 21], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 25]]
1
313
#include <stdio.h> int main() { int A, B, C, K; scanf("%d %d %d %d", &A, &B, &C, &K); // printf("%d %d %d %d",A,B,C,K); if (K <= A) { printf("%d", K); } else if ((A <= K) && (K < A + B)) { printf("%d", A); } else if ((A + B <= K) && (K < A + B + C)) { printf("%d", A - (K - (A + B))); } }
#include <stdio.h> int main() { int A, B, C, K; scanf("%d %d %d %d", &A, &B, &C, &K); // printf("%d %d %d %d",A,B,C,K); if (K <= A) { printf("%d", K); } else if ((A < K) && (K <= A + B)) { printf("%d", A); } else if ((A + B < K) && (K <= A + B + C)) { printf("%d", A - (K - (A + B))); } }
[["-", 15, 23, 0, 16, 31, 23, 0, 16, 17, 19], ["+", 15, 23, 0, 16, 31, 23, 0, 16, 17, 18], ["-", 15, 23, 0, 16, 12, 23, 0, 16, 17, 18], ["+", 15, 23, 0, 16, 12, 23, 0, 16, 17, 19]]
0
124
#include <iostream> #include <string> using namespace std; int main() { int A, B, C, N, n, i; cin >> A >> B >> C >> N; if (A < N) { if (A + B >= N) { cout << A << endl; } else if (A + B < N) { if (A + B + C >= N) { n = A + B + C - N; i = C - n; cout << A - i << endl; ...
#include <iostream> #include <string> using namespace std; int main() { int A, B, C, N, n, i; cin >> A >> B >> C >> N; if (A <= N) { if (A + B >= N) { cout << A << endl; } else if (A + B < N) { if (A + B + C >= N) { n = A + B + C - N; i = C - n; cout << A - i << endl; ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
134
#include <bits/stdc++.h> #define _GLIBCXX_DEBUG using namespace std; #define rep(i, n) for (ll i = 0; i < (int)(n); i++) #define REP(i, m, n) for (ll i = m; i < (int)(n); i++) 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, ...
#include <bits/stdc++.h> #define _GLIBCXX_DEBUG using namespace std; #define rep(i, n) for (ll i = 0; i < (int)(n); i++) #define REP(i, m, n) for (ll i = m; i < (int)(n); i++) 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, ...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
242
/** * Created by hiramekun at 20:39 on 2020-05-10. */ #include <bits/stdc++.h> using namespace std; using ll = long long; using vl = vector<ll>; using vvl = vector<vl>; using vb = vector<bool>; using P = pair<ll, ll>; template <typename T> using pq = priority_queue<T>; template <typename T> using minpq = priority_q...
/** * Created by hiramekun at 20:39 on 2020-05-10. */ #include <bits/stdc++.h> using namespace std; using ll = long long; using vl = vector<ll>; using vvl = vector<vl>; using vb = vector<bool>; using P = pair<ll, ll>; template <typename T> using pq = priority_queue<T>; template <typename T> using minpq = priority_q...
[["-", 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], ["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
482
import sys a,b,c,k = map(int, input().split()) n_sum = 0 if a >= k: n_sum += k print(n_sum) sys.exit() else: n_sum += a k -= a k -= b if k <=0: print(n_sum) sys.exit() if c >= k: n_sum -= c print(n_sum) sys.exit() else: n_sum -= k print(n_sum) sys.exit()
import sys a,b,c,k = map(int, input().split()) n_sum = 0 if a >= k: n_sum += k print(n_sum) sys.exit() else: n_sum += a k -= a k -= b if k <=0: print(n_sum) sys.exit() if c >= k: n_sum -= k print(n_sum) sys.exit() else: n_sum -= c print(n_sum) sys.exit()
[["-", 0, 57, 64, 196, 0, 1, 0, 677, 12, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 677, 12, 22], ["-", 75, 76, 8, 196, 0, 1, 0, 677, 12, 22], ["+", 75, 76, 8, 196, 0, 1, 0, 677, 12, 22]]
5
98
S = list(map(int, input().split())) Sum = 0 if S[0] > S[3]: Sum = S[3] if S[0] + S[1] >= S[3]: Sum = S[0] else: Sum = S[0]*2 - S[3] + S[1] print(Sum)
S = list(map(int, input().split())) Sum = 0 if S[0] >= S[3]: Sum = S[3] elif S[0] + S[1] >= S[3]: Sum = S[0] else: Sum = S[0]*2 - S[3] + S[1] print(Sum)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20], ["-", 36, 36, 36, 36, 0, 656, 0, 57, 0, 121], ["+", 36, 36, 0, 656, 0, 57, 75, 665, 0, 683]]
5
83
#include <iostream> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; if (k >= (a + b)) { int ans1 = a - (k - a - b); cout << ans1; } else if (a <= k < (a + b)) { int ans2 = a; cout << ans2; } else if (k < a) { int ans3 = k; cout << ans3; } return 0...
#include <iostream> using namespace std; int main() { int a, b, c, k; cin >> a >> b >> c >> k; if (k >= (a + b)) { int ans1 = a - (k - a - b); cout << ans1; } else if (a <= k) { int ans2 = a; cout << ans2; } else if (k < a) { int ans3 = k; cout << ans3; } return 0; }
[["-", 75, 76, 0, 57, 15, 339, 51, 16, 17, 18], ["-", 0, 57, 15, 339, 51, 16, 12, 23, 0, 24], ["-", 15, 339, 51, 16, 12, 23, 0, 16, 31, 22], ["-", 15, 339, 51, 16, 12, 23, 0, 16, 17, 72], ["-", 15, 339, 51, 16, 12, 23, 0, 16, 12, 22], ["-", 0, 57, 15, 339, 51, 16, 12, 23, 0, 25]]
1
105
A, B, C, K = map(int, input().split()) lst = [] sum = 0 if A <= K: sum += 1 * A else: sum += 1 * K k = K - (A + B) if (C <= k) and (k > 0): sum += -1 * C elif (c > k) and (k > 0): sum += -1 * k print(sum)
A, B, C, K = map(int, input().split()) lst = [] sum = 0 if A <= K: sum += 1 * A else: sum += 1 * K k = K - (A + B) if (C <= k) and (k > 0): sum += -1 * C elif (C > k) and k > 0: sum += -1 * k print(sum)
[["-", 75, 665, 15, 679, 31, 23, 0, 666, 0, 22], ["+", 75, 665, 15, 679, 31, 23, 0, 666, 0, 22], ["-", 0, 57, 75, 665, 15, 679, 12, 23, 0, 24], ["-", 0, 57, 75, 665, 15, 679, 12, 23, 0, 25]]
5
95
#include <bits/stdc++.h> using namespace std; int main() { int A, B, C, K; cin >> A >> B >> C >> K; if (K <= A) { cout << A << endl; } else if (K > A && K <= A + B) { 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 (K <= A) { cout << K << endl; } else if (K > A && K <= A + B) { cout << A << endl; } else { K = K - A - B; cout << A - K << 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 int a, b, c, k, tmp; cin >> a >> b >> c >> k; tmp = k; int pattern = 0; for (int i = 0; i < 3; i++) { switch (pattern) { case 0: tmp -= a; if (tmp > 0) { pattern++; } else if (tmp < 0) { cout << tmp << ...
#include <bits/stdc++.h> using namespace std; int main() { long int a, b, c, k, tmp; cin >> a >> b >> c >> k; tmp = k; int pattern = 0; for (int i = 0; i < 3; i++) { switch (pattern) { case 0: tmp -= a; if (tmp > 0) { pattern++; } else if (tmp < 0) { cout << k << en...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 12, 22], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 22]]
1
166
#include <bits/stdc++.h> using namespace std; #define int long long template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } #define rep(i, n) for...
#include <bits/stdc++.h> using namespace std; #define int long long template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } #define rep(i, n) for...
[["+", 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
263
#include <iostream> using namespace std; int main(void) { long long int A, B, C, K; cin >> A >> B >> C >> K; long long int sum = 0; if (A >= K) { sum = A; cout << sum << endl; return 0; } else { K -= A; sum += A; if (B >= K) { cout << sum << endl; return 0; } ...
#include <iostream> using namespace std; int main(void) { long long int A, B, C, K; cin >> A >> B >> C >> K; long long int sum = 0; if (A >= K) { sum = K; cout << sum << endl; return 0; } else { K -= A; sum += A; if (B >= K) { cout << sum << endl; return 0; } ...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22]]
1
113
#include <bits/stdc++.h> using namespace std; int main() { int A, B, C, K; cin >> A >> B >> C >> K; if (K <= A) cout << K << endl; else if (K <= A + B) cout << A << endl; else cout << A + B - C << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int A, B, C, K; cin >> A >> B >> C >> K; if (K <= A) cout << K << endl; else if (K <= A + B) cout << A << endl; else cout << 2 * A + B - K << endl; }
[["+", 31, 16, 12, 16, 31, 16, 31, 16, 31, 13], ["+", 31, 16, 12, 16, 31, 16, 31, 16, 17, 48], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 12, 22], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 22]]
1
69
#include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<int, int>; using vl = vector<ll>; using vvl = vector<vl>; #define mp make_pair #define pb push_back #define _overload3(_1, _2, _3, name, ...) name #define _rep(i, n) repi(i, 0, n) #define repi(i, a, b) for (int i = int(a); i < int(b); i+...
#include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<int, int>; using vl = vector<ll>; using vvl = vector<vl>; #define mp make_pair #define pb push_back #define _overload3(_1, _2, _3, name, ...) name #define _rep(i, n) repi(i, 0, n) #define repi(i, a, b) for (int i = int(a); i < int(b); i+...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 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
569
*a, k = map(int, input().split()) print(a, k) s = 0 b = [1, 0, -1] for i, j in enumerate(a): n = min(j, k) k -= n s = s + b[i]*n if k<=0: break print(s)
*a, k = map(int, input().split()) s = 0 b = [1, 0, -1] for i, j in enumerate(a): n = min(j, k) k -= n s = s + b[i]*n if k<=0: break print(s)
[["-", 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, 21], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
77
#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 << K << endl; } else { cout << 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 << 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], ["+", 31, 16, 12, 16, 31, 16, 31, 16, 31, 13], ["+", 31, 16, 12, 16, 31, 16, 31, 16, 17, 48], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 33], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 22]]
1
73
l = list(map(lambda x:int(x), input().split(" "))) a = l[0] b = l[1] c = l[2] k = l[3] if a >= k: print(a) elif a < k: if b >= k-a: print(a) elif b < k-a: print(a-(k-a-b))
l = list(map(lambda x:int(x), input().split(" "))) a = l[0] b = l[1] c = l[2] k = l[3] if a >= k: print(k) elif a < k: if b >= k-a: print(a) elif b < k-a: 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
94
#include <bits/stdc++.h> //#include <iostream> using namespace std; int main(void) { int A, B, C, K; cin >> A >> B >> C >> K; int point; point = A; K = K - A; if ((K == 0) || (K - B) <= 0) { cout << point << endl; } else { cout << point - K + B << endl; } return 0; }
#include <bits/stdc++.h> //#include <iostream> using namespace std; int main(void) { int A, B, C, K; cin >> A >> B >> C >> K; int point; point = min(A, K); K = K - A; if ((K == 0) || (K - B) <= 0) { cout << point << endl; } else { cout << point - K + B << 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
86
#include "iostream" #include "string" #include "vector" using namespace std; int main() { int A, B, C, K; int total; int leftN; cin >> A >> B >> C >> K; total = 0; leftN = K; if (A < K) { total += A; leftN -= A; } else { total = A; cout << total; return 0; } if (B < leftN) ...
#include "iostream" #include "string" #include "vector" using namespace std; int main() { int A, B, C, K; int total; int leftN; cin >> A >> B >> C >> K; total = 0; leftN = K; if (A < K) { total += A; leftN -= A; } else { total = leftN; cout << total; return 0; } if (B < lef...
[["-", 75, 76, 0, 9, 0, 1, 0, 11, 12, 22], ["+", 75, 76, 0, 9, 0, 1, 0, 11, 12, 22]]
1
133
#include "bits/stdc++.h" using namespace std; void Main() { long long A, B, C, K, cnt; long long minNum; cin >> A >> B >> C >> K; cnt = min(A, K); if (A + B < K) { cnt = cnt - min(C, (K - A + B)); } cout << cnt << endl; } int main() { std::cout << std::fixed << std::setprecision(15); Main(); }
#include "bits/stdc++.h" using namespace std; void Main() { long long A, B, C, K, cnt; long long minNum; cin >> A >> B >> C >> K; cnt = min(A, K); if (A + B < K) { cnt = cnt - min(C, (K - (A + B))); } cout << cnt << endl; } int main() { std::cout << std::fixed << std::setprecision(15); Main(); }
[["+", 3, 4, 0, 23, 0, 16, 12, 23, 0, 24], ["+", 3, 4, 0, 23, 0, 16, 12, 23, 0, 25]]
1
107
a, b, c, k = gets.split.map(&:to_i) puts (k <= a + b) ? a : 2 * a + b - k
a, b, c, k = gets.split.map(&:to_i) puts (k <= a + b) ? [a, k].min : 2 * a + b - k
[["+", 3, 4, 0, 754, 64, 652, 486, 516, 0, 70], ["+", 3, 4, 0, 754, 64, 652, 486, 516, 0, 21], ["+", 3, 4, 0, 754, 64, 652, 486, 516, 0, 22], ["+", 3, 4, 0, 754, 64, 652, 486, 516, 0, 73], ["+", 0, 652, 3, 4, 0, 754, 64, 652, 17, 131], ["+", 0, 652, 3, 4, 0, 754, 64, 652, 735, 22]]
4
35
#include <bits/stdc++.h> using namespace std; #define ll long long #define Inf 0x3f3f3f3f int main() { ll a, b, c, k; cin >> a >> b >> c >> k; ll count = 0; if (k <= a) { count = k; } else { if (k <= a + c) count = a; else count = a - 1 * (k - (a + c)); } cout << count << endl; ...
#include <bits/stdc++.h> using namespace std; #define ll long long #define Inf 0x3f3f3f3f int main() { ll a, b, c, k; // a:1;b:0;c:-1 cin >> a >> b >> c >> k; ll count = 0; if (k <= a) { count = k; } else { if (k <= a + b) count = a; else count = a - 1 * (k - (a + b)); } cout << c...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 12, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 22], ["-", 12, 23, 0, 16, 12, 23, 0, 16, 12, 22], ["+", 12, 23, 0, 16, 12, 23, 0, 16, 12, 22]]
1
95
s = input().split(" ") a = int(s[0]) b = int(s[1]) c = int(s[2]) k = int(s[3]) t = 0 if a >= k: print(a) else: t += a if b >= (k - a): print(a) else: if c <= (k - a -b): t -= c else: t -= (k - a -b) print(t)
s = input().split(" ") a = int(s[0]) b = int(s[1]) c = int(s[2]) k = int(s[3]) t = 0 if a >= k: print(k) else: t += a if b >= (k - a): print(a) else: if c <= (k - a -b): t -= c else: t -= (k - a -b) print(t)
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
109
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <fstream> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <tuple> #include <utility> #include <vector> using namespace std; typedef long long ll; typed...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <fstream> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <tuple> #include <utility> #include <vector> using namespace std; typedef long long ll; typed...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 0, 1, 0, 16, 31, 16, 12, 2, 63, 22], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 24], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 22], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 21], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 25]]
1
131
A, B, C, K = list(map(int,input().split())) if A >= K: print(A) elif A+B>=K and A<K: print(A) elif A+B+C>=K and A+B<K: print(2*A-K+B)
A, B, C, K = list(map(int,input().split())) if A >= K: print(K) elif A+B>=K and A<K: print(A) elif A+B+C>=K and A+B<K: print(2*A-K+B)
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
72
A, B, C, K = map(int, input().split()) if K <= A: print(A) elif K <= A + B: print(A) else: print(A - (K - (A + B)))
A, B, C, K = map(int, input().split()) if K <= A: print(K) elif K <= A + B: print(A) else: print(A - (K - (A + B)))
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
56
#include <algorithm> #include <bitset> #include <cmath> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <regex> #include <string> #include <tuple> #include <vector> using namespace std; template <typename T> bool chmax(T &a, const T b) { if (a <=...
#include <algorithm> #include <bitset> #include <cmath> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <regex> #include <string> #include <tuple> #include <vector> using namespace std; template <typename T> bool chmax(T &a, const T b) { if (a <=...
[["+", 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
2,181
import java.util.*; 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 = 0; if (k <= a) { ans = k; } else if (a < k & k <= a + b) { ans ...
import java.util.*; 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 = 0; if (k <= a) { ans = k; } else if (a < k & k <= a + b) { ans ...
[["-", 75, 57, 64, 196, 0, 1, 0, 11, 12, 22], ["+", 75, 57, 64, 196, 0, 1, 0, 11, 12, 22]]
3
146
<?php // Your code here! $temp = trim(fgets(STDIN)); list($c1,$c0,$c_1,$num) = explode(' ',$temp); //総数より1の数の方が多ければそれで終わり if($c1 >= $num){ echo $num; exit; } if(($c1 + $c0) >= $num ){ echo $num; exit; } $ans = $c1 - (1 * (min($c_1, $num - ($c1 + $c0)) ) ); echo $ans; ?>
<?php // Your code here! $temp = trim(fgets(STDIN)); list($c1,$c0,$c_1,$num) = explode(' ',$temp); //総数より1の数の方が多ければそれで終わり if($c1 >= $num){ echo $num; exit; } if(($c1 + $c0) >= $num ){ echo $c1; exit; } $ans = $c1 - (1 * (min($c_1, $num - ($c1 + $c0)) ) ); echo $ans; ?>
[["-", 0, 57, 8, 9, 0, 608, 0, 606, 0, 141], ["+", 0, 57, 8, 9, 0, 608, 0, 606, 0, 141]]
6
110
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; #define rep(i, n) for (int i = 0; i < (int)(n); ++i) #define rrep(i, n) for (int i = (int)(n); i >= 0; --i) struct fast_ios { fast_ios() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20);...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; #define rep(i, n) for (int i = 0; i < (int)(n); ++i) #define rrep(i, n) for (int i = (int)(n); i >= 0; --i) struct fast_ios { fast_ios() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20);...
[["-", 12, 41, 15, 23, 0, 16, 31, 16, 12, 22], ["+", 12, 41, 15, 23, 0, 16, 31, 16, 12, 22], ["-", 8, 9, 0, 1, 0, 11, 12, 41, 64, 22], ["+", 8, 9, 0, 1, 0, 11, 12, 41, 64, 22]]
1
145
def linear(A, B, C, K): s = 0 if K <= A: return K s += A K -= A if K <= B: return s return s - C if __name__ == "__main__": A, B, C, K = map(int, input().split()) print(linear(A, B, C, K))
def linear(A, B, C, K): s = 0 if K <= A: return K s += A K -= A if K <= B: return s K -= B return s - K if __name__ == "__main__": A, B, C, K = map(int, input().split()) print(linear(A, B, C, K))
[["+", 0, 14, 8, 196, 0, 1, 0, 677, 31, 22], ["+", 0, 14, 8, 196, 0, 1, 0, 677, 17, 110], ["+", 0, 14, 8, 196, 0, 1, 0, 677, 12, 22], ["-", 0, 14, 8, 196, 0, 37, 0, 657, 12, 22], ["+", 0, 14, 8, 196, 0, 37, 0, 657, 12, 22]]
5
79
A, B, C, K = map(int, input().split()) ans = 0 if A >= K: ans += A else: # A < K if B >= (K - A): ans += A else: # B< (K-A) if C >= (K - A - B): ans += A - (K-A-B) else: # C < (K - A - B) ans += A - C print(ans)
A, B, C, K = map(int, input().split()) ans = 0 if A >= K: ans += K else: # A < K if B >= (K - A): ans += A else: # B< (K-A) if C >= (K - A - B): ans += A - (K-A-B) else: # C < (K - A - B) ans += A - C print(ans)
[["-", 0, 57, 64, 196, 0, 1, 0, 677, 12, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 677, 12, 22]]
5
83
def create_union_answer(a, b, c, k): if a >= k: return a if a + b >= k: return a # can select type[c] card numbers. can_c = k - (a + b) if can_c > c : can_c = c return a - can_c values = input().split() a = int(values[0]) b = int(values[1]) c = int(values[2]) k = int(va...
def create_union_answer(a, b, c, k): if a >= k: return k if a + b >= k: return a # can select type[c] card numbers. can_c = k - (a + b) if can_c > c : can_c = c return a - can_c values = input().split() a = int(values[0]) b = int(values[1]) c = int(values[2]) k = int(va...
[["-", 8, 196, 0, 57, 64, 196, 0, 37, 0, 22], ["+", 8, 196, 0, 57, 64, 196, 0, 37, 0, 22]]
5
111
#include <bits/stdc++.h> using namespace std; #define gcd(a, b) __gcd(a, b) #define pb push_back #define sevensins \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); #define ll long long int #define mod 1000000...
#include <bits/stdc++.h> using namespace std; #define gcd(a, b) __gcd(a, b) #define pb push_back #define sevensins \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); #define ll long long int #define mod 1000000...
[["-", 8, 9, 0, 57, 64, 1, 0, 11, 12, 22], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 12, 22]]
1
138
#include <algorithm> #include <iostream> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define REP(i, n) for (int i = 1; i <= (int)(n); i++) using namespace std; int main() { long A, B, C, K; long sum = 0; cin >> A >> B >> C >> K; if (A >= K) { cout << A << en...
#include <algorithm> #include <iostream> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define REP(i, n) for (int i = 1; i <= (int)(n); i++) using namespace std; int main() { long A, B, C, K; long sum = 0; cin >> A >> B >> C >> K; if (A >= K) { cout << K << en...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
147
#include <stdio.h> int main() { long int A, B, C, K; scanf("%ld %ld %ld %ld", &A, &B, &C, &K); if (K - A <= 0) { printf("l%d", K); return 0; } else if (K - A - B <= 0) { printf("%ld", A); return 0; } else { printf("%ld", A - (K - A - B)); return 0; } }
#include <stdio.h> int main() { long int A, B, C, K; scanf("%ld %ld %ld %ld", &A, &B, &C, &K); if (K - A <= 0) { printf("%ld\n", K); return 0; } else if (K - A - B <= 0) { printf("%ld\n", A); return 0; } else { printf("%ld\n", A - (K - A - B)); return 0; } }
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
0
107
a,b,c,d=map(int,input().split()) ans=0 if d-a>0: d=d-a ans+=a if d-b>0: d-=b if d-c==0: ans-=c else: ans=ans-d else: ans=a-d print(ans)
a,b,c,d=map(int,input().split()) ans=0 if d-a>=0: d=d-a ans+=a if d-b>0: d-=b if d-c==0: ans-=c else: ans=ans-d else: ans+=d print(ans)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20], ["-", 75, 76, 8, 196, 0, 1, 0, 662, 0, 32], ["-", 8, 196, 0, 1, 0, 662, 12, 657, 31, 22], ["-", 8, 196, 0, 1, 0, 662, 12, 657, 17, 33], ["+", 75, 76, 8, 196, 0, 1, 0, 677, 17, 107]]
5
76
#include <algorithm> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <stdio.h> #include <string.h> #include <vector> #define MOD 1e9 + 7; #define INF 1e17 + 9; #define PI acos(-1); using namespace std; int main() { long long a, b, c, k; cin >> a >> b >> c >> k; if (a >= k) { ...
#include <algorithm> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <stdio.h> #include <string.h> #include <vector> #define MOD 1e9 + 7; #define INF 1e17 + 9; #define PI acos(-1); using namespace std; int main() { long long a, b, c, k; cin >> a >> b >> c >> k; if (a >= k) { ...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
125
A,B,C,K = map(int,input().split()) import sys ans = 0 ans = A K = K - A if K < 0: ans = ans + K print(ans) sys.exit(0) if K > 0: K = K - B print(K) if K > 0: ans = ans - K print(ans)
A,B,C,K = map(int,input().split()) import sys ans = 0 ans = A K = K - A if K < 0: ans = ans + K print(ans) sys.exit(0) if K > 0: K = K - B if K > 0: ans = ans - K 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
81
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <vector> #define rep(i, cc, n) for (int i = cc; i <= n; ++i) #define drep(i, cc, n) for (int i = cc; i >= n; --i) template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template <class ...
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <vector> #define rep(i, cc, n) for (int i = cc; i <= n; ++i) #define drep(i, cc, n) for (int i = cc; i >= n; --i) template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template <class ...
[["-", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22], ["+", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22], ["-", 0, 57, 75, 76, 0, 57, 75, 76, 0, 95]]
1
285
#include <bits/stdc++.h> using namespace std; #define fast_io \ ios_base::sync_with_stdio(false); \ cin.tie(nullptr) #define rep(i, x, y) \ for (decl...
#include <bits/stdc++.h> using namespace std; #define fast_io \ ios_base::sync_with_stdio(false); \ cin.tie(nullptr) #define rep(i, x, y) \ for (decl...
[["-", 0, 1, 0, 11, 12, 2, 3, 4, 0, 22], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 22]]
1
255
A,B,C,K = map(int,input().split()) if A >= K: print(A) elif A+B >=K: print(A) else: D = int(K-A-B) print(A-D)
A,B,C,K = map(int,input().split()) if A > K: print(K) elif A+B >= K: print(A) else: D = int(K-A-B) print(A-D)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
58
#include <stdio.h> int main() { int A, B, C, K, sum; scanf("%d %d %d %d", &A, &B, &C, &K); if (K <= A) { sum = A; } else if (K > A && K <= A + B) { sum = A; } else { sum = A - (K - A - B); } printf("%d\n", sum); return 0; }
#include <stdio.h> int main() { int A, B, C, K, sum; scanf("%d %d %d %d", &A, &B, &C, &K); if (K <= A) { sum = K; } else if (K > A && K <= A + B) { sum = A; } else { sum = A - (K - A - B); } printf("%d\n", sum); return 0; }
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22]]
0
97
a,b,c,k=[int(i) for i in input().split()] score=0 if k>=a: score=a k=k-a if k>=b: k=k-b if k>0: score-=1 else: score=k print(score)
a,b,c,k=[int(i) for i in input().split()] score=0 if k>=a: score=a k=k-a if k>=b: k=k-b if k>0: score-=k else: score=k print(score)
[["-", 0, 57, 64, 196, 0, 1, 0, 677, 12, 612], ["+", 0, 57, 64, 196, 0, 1, 0, 677, 12, 22]]
5
67
A, B, C, K = map(int, input().split()) ans = 0 if A > K: ans = K else: ans += A K -= A if B > K: ans = K else: ans += 0 K -= B ans -= K print(ans)
A, B, C, K = map(int, input().split()) ans = 0 if A > K: ans = K else: ans += A K -= A if B > K: ans += 0 else: ans += 0 K -= B ans -= K print(ans)
[["-", 0, 57, 64, 196, 0, 1, 0, 662, 0, 32], ["-", 0, 57, 64, 196, 0, 1, 0, 662, 12, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 677, 17, 107], ["+", 0, 57, 64, 196, 0, 1, 0, 677, 12, 612]]
5
62
a,b,c,k=map(int,input().split()) ans if(a>=k): ans=k else: if((a+b)>=k): ans=a else: x=k-a-b ans=a-x print(ans)
a,b,c,k=map(int,input().split()) ans=0 if(a>=k): ans=k else: if((a+b)>=k): ans=a else: x=k-a-b ans=a-x print(ans)
[["+", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612]]
5
65
#include <algorithm> #include <iostream> #include <string> #include <vector> #define _USE_MATH_DEFINES #include <assert.h> #include <bitset> #include <cmath> #include <deque> #include <functional> #include <iomanip> #include <iterator> #include <limits> #include <list> #include <map> #include <math.h> #include <numeric...
#include <algorithm> #include <iostream> #include <string> #include <vector> #define _USE_MATH_DEFINES #include <assert.h> #include <bitset> #include <cmath> #include <deque> #include <functional> #include <iomanip> #include <iterator> #include <limits> #include <list> #include <map> #include <math.h> #include <numeric...
[["+", 0, 57, 64, 1, 0, 11, 12, 2, 63, 22], ["+", 64, 1, 0, 11, 12, 2, 3, 4, 0, 24], ["+", 64, 1, 0, 11, 12, 2, 3, 4, 0, 22], ["+", 64, 1, 0, 11, 12, 2, 3, 4, 0, 21], ["+", 64, 1, 0, 11, 12, 2, 3, 4, 0, 25]]
1
1,518
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using ull = unsigned long long; #define all(x) x.begin(), x.end() template <typename T1, typename T2> inline void chkmin(T1 &x, const T2 &y) { if (x > y) x = y; } template <typename T1, typename T2> inline void chkmax(T1...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using ull = unsigned long long; #define all(x) x.begin(), x.end() template <typename T1, typename T2> inline void chkmin(T1 &x, const T2 &y) { if (x > y) x = y; } template <typename T1, typename T2> inline void chkmax(T1...
[["-", 0, 14, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 31, 22]]
1
246
// At Corder.cpp : このファイルには 'main' // 関数が含まれています。プログラム実行の開始と終了がそこで行われます。 // #include <algorithm> #include <iostream> using namespace std; #include <bits/stdc++.h> #include <math.h> #include <numeric> #include <vector> #define rep(i, n) for (int i = 0; i < (n); ++i) using ll = long long; using p = pair<int, int>; //<k...
// At Corder.cpp : このファイルには 'main' // 関数が含まれています。プログラム実行の開始と終了がそこで行われます。 // #include <algorithm> #include <iostream> using namespace std; #include <bits/stdc++.h> #include <math.h> #include <numeric> #include <vector> #define rep(i, n) for (int i = 0; i < (n); ++i) using ll = long long; using p = pair<int, int>; //<k...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 18], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 19], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 72], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 12, 22], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31,...
1
142
A,B,C,K = map(int,input().split()) tmp = K maxSum = 0 i = 0 if(tmp>A): maxSum+=A tmp-=A else: maxSum+=K tmp = 0 if(tmp>B): tmp-=B else: tmp = 0 if(tmp>C): maxSum-=C tmp-=C else: maxSum-=K-A-B tmp = 0 print(maxSum)
A,B,C,K = map(int,input().split()) tmp = K maxSum = 0 i = 0 if(tmp>A): maxSum+=A tmp-=A else: maxSum+=K tmp = 0 #print(str(tmp) + ' sum = ' + str(maxSum)) if(tmp>B): tmp-=B else: tmp = 0 #print(str(tmp) + ' sum = ' + str(maxSum)) if(tmp>C): maxSum-=C tmp-=C else: maxSum-=tmp tmp = 0 #print(str(tm...
[["-", 0, 1, 0, 677, 12, 657, 31, 657, 31, 22], ["-", 0, 1, 0, 677, 12, 657, 31, 657, 17, 33], ["-", 0, 1, 0, 677, 12, 657, 31, 657, 12, 22], ["-", 8, 196, 0, 1, 0, 677, 12, 657, 17, 33], ["-", 8, 196, 0, 1, 0, 677, 12, 657, 12, 22], ["+", 75, 76, 8, 196, 0, 1, 0, 677, 12, 22]]
5
94
A,B,C,K = map(int, input().split()) if A >= K: print(K) elif A+B >=K: print(A) else: print(A-(A+B-K))
A,B,C,K = map(int, input().split()) if A >= K: print(K) elif A+B >=K: print(A) else: print(A+(A+B-K))
[["-", 0, 1, 0, 652, 3, 4, 0, 657, 17, 33], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 72]]
5
54
# coding: utf-8 import sys info = input().split(' ') card_one = int(info[0]) card_zero = int(info[1]) card_minus = int(info[2]) number = int(info[3]) sumnum = 0 if (number >= card_one): number = number - card_one sumnum = sumnum + card_one else: print(card_one) sys.exit() if (number >= card_zero): ...
# coding: utf-8 import sys info = input().split(' ') card_one = int(info[0]) card_zero = int(info[1]) card_minus = int(info[2]) number = int(info[3]) sumnum = 0 if (number >= card_one): number = number - card_one sumnum = sumnum + card_one else: print(number) sys.exit() if (number >= card_zero): ...
[["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
132
a,b,c,k = map(int, input().split()) ans=0 if k-a <= 0: ans = a elif k-(a+b) <= 0: ans = a else: ans = a-(k-(a+b)) print(ans)
a,b,c,k = map(int, input().split()) ans=0 if k-a <= 0: ans = k elif k-(a+b) <= 0: 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
66
#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 != 0 and a <= k) { if (a <= k) { k = k - a; sum += a * 1; } else { long long int d = k; k -= d; sum += d * 1; } } if (k != 0) {...
#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 != 0) { if (a <= k) { k = k - a; sum += a * 1; } else { long long int d = k; k -= d; sum += d * 1; } } if (k != 0) { if (b ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 355], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 19], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 12, 22]]
1
174
A, B, C, K = map(int,input().split()) if A >= K: print(A) elif A+B >= K: print(A) else: print(A - min(K - A - B, C))
A, B, C, K = map(int,input().split()) if A >= K: print(K) elif A+B >= K: print(A) else: print(A - min(K - A - B, C))
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
57
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, c, k; cin >> a >> b >> c >> k; int sum = 0; k = k - a; if (k < 0) cout << k; else { k = k - b; if (k < 0) cout << a; else cout << a - k; } }
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, c, k; cin >> a >> b >> c >> k; long long z = k; k = k - a; if (k < 0) cout << z; else { k = k - b; if (k < 0) cout << a; else cout << a - k; } }
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 22], ["-", 8, 9, 0, 57, 64, 1, 0, 16, 12, 22], ["+", 8, 9, 0, 57, 64...
1
79
#include <bits/stdc++.h> using namespace std; #define sf(n) scanf("%d", &n) #define pd(n) printf("%.10lf", n) #define pf(n) printf("%d", n) #define p() printf("\n") #define ps() printf(" ") #define ll long long #define ull unsigned long long #define MAX 1e9 const int mod = 1000 * 1000 * 1000 + 7; #define ex 1e18 #def...
#include <bits/stdc++.h> using namespace std; #define sf(n) scanf("%d", &n) #define pd(n) printf("%.10lf", n) #define pf(n) printf("%d", n) #define p() printf("\n") #define ps() printf(" ") #define ll long long #define ull unsigned long long #define MAX 1e9 const int mod = 1000 * 1000 * 1000 + 7; #define ex 1e18 #def...
[["+", 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
259
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long int; using vec = vector<int>; using P = pair<int, int>; int main() { int a, b, c, k; cin >> a >> b >> c >> k; int ans = 0; if (a >= k) { ans = a; } else { k -= a; ans = a; if (b ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long int; using vec = vector<int>; using P = pair<int, int>; int main() { int a, b, c, k; cin >> a >> b >> c >> k; int ans = 0; if (a >= k) { ans = k; } else { k -= a; ans = a; if (b ...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22]]
1
117