buggy_code
stringlengths
11
625k
fixed_code
stringlengths
17
625k
bug_type
stringlengths
2
4.45k
language
int64
0
8
token_count
int64
5
200k
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef vector<int> vint; typedef vector<double> vdbl; typedef vector<ll> vll; typedef vector<string> vstr; typedef vector<vector<int>> vvint; typedef vector<pair<int, int>> vpii; typedef vector<pa...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef vector<int> vint; typedef vector<double> vdbl; typedef vector<ll> vll; typedef vector<string> vstr; typedef vector<vector<int>> vvint; typedef vector<pair<int, int>> vpii; typedef vector<pa...
[["+", 0, 9, 0, 1, 0, 11, 12, 16, 17, 85], ["+", 0, 9, 0, 1, 0, 11, 12, 16, 12, 22]]
1
487
a,b,n=map(int,input().split()) if b<=n: print(int((a*(b)/b))) else: print(int((a*(n)/b)))
a,b,n=map(int,input().split()) if b<=n: print(int((a*(b-1)/b))) else: print(int((a*(n)/b)))
[["+", 0, 657, 31, 657, 12, 23, 0, 657, 17, 33], ["+", 0, 657, 31, 657, 12, 23, 0, 657, 12, 612]]
5
55
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long A = sc.nextLong(); long B = sc.nextLong(); long N = sc.nextLong(); long x = Math.min(N, B); System.out.println(A * x / B + A * (x / B)); sc.close(); } }
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long A = sc.nextLong(); long B = sc.nextLong(); long N = sc.nextLong(); long x = Math.min(N, B - 1); System.out.println(A * x / B + A * (x / B)); sc.close(); } ...
[["+", 49, 200, 51, 492, 3, 4, 0, 16, 17, 33], ["+", 49, 200, 51, 492, 3, 4, 0, 16, 12, 499]]
3
101
#include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <cerrno> #include <cfloat> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctype.h> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> ...
#include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <cerrno> #include <cfloat> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctype.h> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> ...
[["+", 49, 50, 51, 16, 31, 74, 51, 23, 0, 24], ["+", 49, 50, 51, 16, 31, 74, 51, 23, 0, 25]]
1
1,055
#include <algorithm> #include <cmath> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <stdio.h> #include <string> #include <vector> using namespace std; int main() { long long a, b, n; cin >> a >> b >> n; long long x; long long pre, las; if (b >= n) { x = n;...
#include <algorithm> #include <cmath> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <stdio.h> #include <string> #include <vector> using namespace std; int main() { long long a, b, n; cin >> a >> b >> n; long long x; long long pre, las; if (b > n) { x = n; ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47]]
1
104
def main(): a,b,n=map(int,input().split()) if n>=b-1: print((a*(b-1))//b) else: print((a*(n-1)//b)) if __name__=='__main__': main()
def main(): a,b,n=map(int,input().split()) if n>=b-1: print((a*(b-1))//b) else: print((a*n)//b) if __name__=='__main__': main()
[["-", 0, 23, 0, 657, 31, 657, 12, 23, 0, 24], ["-", 0, 657, 31, 657, 12, 23, 0, 657, 17, 33], ["-", 0, 657, 31, 657, 12, 23, 0, 657, 12, 612], ["-", 0, 1, 0, 652, 3, 4, 0, 23, 0, 25]]
5
70
# D inp = input().split(' ') A, B, N = int(inp[0]), int(inp[1]), int(inp[2]) alpha, beta = math.floor(A/B), A%B if B-1 < N: x = B-1 else: x = N print(math.floor(A*x/B) - A * math.floor(x/B))
# D import math inp = input().split(' ') A, B, N = int(inp[0]), int(inp[1]), int(inp[2]) alpha, beta = math.floor(A/B), A%B if B-1 < N: x = B-1 else: x = N print(math.floor(A*x/B) - A * math.floor(x/B))
[["+", 36, 36, 36, 36, 0, 656, 0, 596, 0, 487], ["+", 36, 36, 0, 656, 0, 596, 141, 673, 0, 22]]
5
99
#include <bits/stdc++.h> using namespace std; int floor(float x) { int a = x; return a; } int main() { int64_t A, B, N; cin >> A >> B >> N; int64_t x; if (B < N) { x = B - 1; } else { x = N; } int64_t inner = A * floor(x / B); int64_t outer = floor(A * x / B); cout << outer - inner <...
#include <bits/stdc++.h> using namespace std; int floor(float x) { int64_t a = x; return a; } int main() { int64_t A, B, N; cin >> A >> B >> N; int64_t x; if (B <= N) { x = B - 1; } else { x = N; } int64_t inner = A * floor(x / B); int64_t outer = floor(A * x / B); cout << outer - in...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
99
import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); long a = scanner.nextLong(); long b = scanner.nextLong(); long n = scanner.nextLong(); if (b < n) { System.out.println(a * (b - 1) / b...
import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); long a = scanner.nextLong(); long b = scanner.nextLong(); long n = scanner.nextLong(); if (b <= n) { System.out.println(a * (b - 1) / ...
[["-", 8, 196, 0, 57, 15, 15, 0, 16, 17, 18], ["+", 8, 196, 0, 57, 15, 15, 0, 16, 17, 19]]
3
110
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; i < (n); i++) int main() { int64_t A, B, N; cin >> A >> B >> N; if (N > B) N = B - 1; int64_t C = floor(A * N) / B, D = A * floor(N / B); cout << C - D << endl; }
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; i < (n); i++) int main() { int64_t A, B, N; cin >> A >> B >> N; if (N >= B) N = B - 1; int64_t C = (A * N) / B, D = A * (N / B); cout << C - D << endl; }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["-", 0, 43, 49, 50, 51, 16, 31, 2, 63, 22], ["-", 0, 43, 49, 50, 51, 16, 12, 2, 63, 22]]
1
84
#include <algorithm> #include <bitset> #include <cassert> #include <chrono> #include <cmath> #include <cstdio> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <random> #include <set> #include <vector> #define pb push_back #define mk make_pair #define eb emplace_back #d...
#include <algorithm> #include <bitset> #include <cassert> #include <chrono> #include <cmath> #include <cstdio> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <random> #include <set> #include <vector> #define pb push_back #define mk make_pair #define eb emplace_back #d...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["-", 64, 9, 0, 1, 0, 11, 12, 16, 31, 22], ["+", 64, 9, 0, 1, 0, 11, 12, 16, 31, 22]]
1
192
a, b, n = map(int, input().split()) if b <= n: print((b- 1 * a) // b - a * (b - 1 // b)) else: print((n * a) // b - a * (n // b))
a, b, n = map(int, input().split()) if b <= n: print(((b- 1) * a) // b - a * ((b - 1) // b)) else: print((n * a) // b - a * (n // b))
[["+", 31, 657, 31, 23, 0, 657, 31, 23, 0, 24], ["+", 31, 657, 31, 23, 0, 657, 31, 23, 0, 25], ["+", 3, 4, 0, 657, 12, 657, 12, 23, 0, 24], ["+", 12, 657, 12, 23, 0, 657, 31, 23, 0, 25]]
5
65
#include <bits/stdc++.h> using namespace std; #define fs first #define sc second #define pb push_back #define mp make_pair #define eb emplace_back #define ALL(A) A.begin(), A.end() #define RALL(A) A.rbegin(), A.rend() typedef long long ll; typedef pair<ll, ll> P; const ll mod = 1000000007; const ll LINF = 1LL << 60; co...
#include <bits/stdc++.h> using namespace std; #define fs first #define sc second #define pb push_back #define mp make_pair #define eb emplace_back #define ALL(A) A.begin(), A.end() #define RALL(A) A.rbegin(), A.rend() typedef long long ll; typedef pair<ll, ll> P; const ll mod = 1000000007; const ll LINF = 1LL << 60; co...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47]]
1
223
#include <bits/stdc++.h> using namespace std; int main() { long long A, B, N; cin >> A >> B >> N; if (N < B) { cout << floor(A * N / B) - A * floor(N / B); } else { cout << floor(A * (N - 1.0) / B) - A * floor((N - 1.0) / B); } }
#include <bits/stdc++.h> using namespace std; int main() { long long A, B, N; cin >> A >> B >> N; if (N < B) { cout << floor(A * N / B) - A * floor(N / B); } else { cout << floor(A * (B - 1.0) / B) - A * floor((B - 1.0) / B); } }
[["-", 0, 16, 31, 16, 12, 23, 0, 16, 31, 22], ["+", 0, 16, 31, 16, 12, 23, 0, 16, 31, 22], ["-", 3, 4, 0, 16, 31, 23, 0, 16, 31, 22], ["+", 3, 4, 0, 16, 31, 23, 0, 16, 31, 22]]
1
87
#include <bits/stdc++.h> using namespace std; void solve() { long long a, b, n; cin >> a >> b >> n; if (n <= b) cout << (a * n / b); else cout << (a * (b - 1) / b); } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); solve(); return 0; }
#include <bits/stdc++.h> using namespace std; void solve() { long long a, b, n; cin >> a >> b >> n; if (n < b) cout << (a * n / b); else cout << (a * (b - 1) / b); } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); solve(); return 0; }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18]]
1
93
A, B, N = gets.split(' ').map(&:to_i) x = 0 if B - N == 1 x = N else x = N - 1 end puts (A * x / B).floor - A * (x / B).floor
A, B, N = gets.split(' ').map(&:to_i) x = 0 if B > N x = N else x = B - 1 end puts (A * x / B).floor - A * (x / B).floor
[["-", 0, 493, 0, 121, 15, 738, 31, 738, 17, 33], ["+", 36, 36, 0, 493, 0, 121, 15, 738, 17, 47], ["-", 36, 36, 0, 493, 0, 121, 15, 738, 17, 60], ["-", 36, 36, 0, 493, 0, 121, 15, 738, 12, 612], ["-", 0, 121, 75, 95, 0, 662, 12, 738, 31, 743], ["+", 0, 121, 75, 95, 0, 662, 12, 738, 31, 743]]
4
59
A, B, N = gets.split(' ').map(&:to_i) x = 0 if B - N == 1 x = N elsif N > B x = B - 1 else x = N - 1 end puts (A * x / B).floor - A * (x / B).floor
A, B, N = gets.split(' ').map(&:to_i) x = 0 if B > N x = N elsif N > B x = B - 1 else x = N - 1 end puts (A * x / B).floor - A * (x / B).floor
[["-", 0, 493, 0, 121, 15, 738, 31, 738, 17, 33], ["+", 36, 36, 0, 493, 0, 121, 15, 738, 17, 47], ["-", 36, 36, 0, 493, 0, 121, 15, 738, 17, 60], ["-", 36, 36, 0, 493, 0, 121, 15, 738, 12, 612]]
4
68
a, b, n = map(int, input().split()) import math c = math.floor(a*n/b) d = math.floor(n/b) e = a*d f = math.floor(a*(b-1)/b) g = math.floor((b-1)/b) h = a*g if n <= b: print(c - e) else: print(f - h)
a, b, n = map(int, input().split()) import math c = math.floor(a*n/b) d = math.floor(n/b) e = a*d f = math.floor(a*(b-1)/b) g = math.floor((b-1)/b) h = a*g if n < b: print(c - e) else: print(f - h)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 19], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 18]]
5
101
A, B, N = map(int, input().split()) if A == 1 or B == 1: print(0) elif N > B: print(A * (B-1) // B) else: print(A * N // B)
A, B, N = map(int, input().split()) if A == 1 or B == 1: print(0) elif N >= B: print(A * (B-1) // B) else: print(A * N // B)
[["-", 0, 656, 0, 57, 75, 665, 15, 666, 667, 47], ["+", 0, 656, 0, 57, 75, 665, 15, 666, 667, 20]]
5
58
#include <bits/stdc++.h> #define MODNum 1000000007 #define REP(type, i, a, b) for (type i = a; i < b; i++) typedef long long ll; using namespace std; int main(void) { ll A, B, N, ans; cin >> A >> B >> N; // N のとき Max if (N <= A - 1) { ans = A * N / B; } else { ans = A * (A - 1) / B; } cout << an...
#include <bits/stdc++.h> #define MODNum 1000000007 #define REP(type, i, a, b) for (type i = a; i < b; i++) typedef long long ll; using namespace std; int main(void) { ll A, B, N, ans; cin >> A >> B >> N; // N のとき Max if (N <= B - 1) { ans = (A * N) / B; } else { ans = (A * (B - 1)) / B; } cout <...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 24], ["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 25], ["-", 12, 16, 31, 16, 12, 23, 0, 16, 31, 22], ["+", 31, 23, 0, 16, 12, 23, 0, 16, 31, 22], ["+", 12, 16, 31, 23, 0, 16, 12, 23, 0, 25]]
1
93
# input A, B, N = map(int, input().split()) # process x = 0 if B <= N: x = B-1 else: x = N # output print(x) print(A*x//B - A*(x//B))
# input A, B, N = map(int, input().split()) # process x = 0 if B <= N: x = B-1 else: x = N # output print(A*x//B - A*(x//B))
[["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25], ["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24]]
5
59
from math import floor A, B, N = map(int, input().split()) print(floor((A*min(N, B))/B) - A * floor(min(N,B)/B))
from math import floor A, B, N = map(int, input().split()) print(floor((A*min(N, B-1))/B) - A * floor(min(N,B-1)/B))
[["+", 0, 657, 12, 652, 3, 4, 0, 657, 17, 33], ["+", 0, 657, 12, 652, 3, 4, 0, 657, 12, 612], ["+", 0, 657, 31, 652, 3, 4, 0, 657, 17, 33], ["+", 0, 657, 31, 652, 3, 4, 0, 657, 12, 612]]
5
54
import math a,b,n = map(int,input().split()) if n <= b-1: print(math.floor(a*n/b)) else: print(math.floor(a*(n-1)/b))
import math a,b,n = map(int,input().split()) if n <= b-1: print(math.floor(a*n/b)) else: print(math.floor(a*(b-1)/b))
[["-", 0, 657, 31, 657, 12, 23, 0, 657, 31, 22], ["+", 0, 657, 31, 657, 12, 23, 0, 657, 31, 22]]
5
59
import math a,b,n = map(int, input().split()) if b > n: c = n-1 else: c = b-1 ans = math.floor(a * c /b) - a * math.floor(c/b) print(ans)
import math a,b,n = map(int, input().split()) if b > n: c = n else: c = b-1 ans = math.floor(a * c /b) - a * math.floor(c/b) print(ans)
[["-", 64, 196, 0, 1, 0, 662, 12, 657, 17, 33], ["-", 64, 196, 0, 1, 0, 662, 12, 657, 12, 612]]
5
64
import math a, b, n = (int(x) for x in input().split()) if b > n: print(math.floor(b * n / b) - a * math.floor(n / b)) else: print(math.floor(a * (b -1) / b) - a * math.floor((b -1) / b))
import math a, b, n = (int(x) for x in input().split()) if b > n: print(math.floor(a * n / b) - a * math.floor(n / b)) else: print(math.floor(a * (b -1) / b) - a * math.floor((b -1) / b))
[["-", 31, 652, 3, 4, 0, 657, 31, 657, 31, 22], ["+", 31, 652, 3, 4, 0, 657, 31, 657, 31, 22]]
5
87
def fn(x): return ((a*x)//b) - a*(x//b) a,b,n = map(int, input().split()) ans = 0 if b <= n: ans = b else: ans = n print(fn(ans))
def fn(x): return ((a*x)//b) - a*(x//b) a,b,n = map(int, input().split()) ans = 0 if b <= n: ans = b-1 else: ans = n print(fn(ans))
[["+", 64, 196, 0, 1, 0, 662, 12, 657, 17, 33], ["+", 64, 196, 0, 1, 0, 662, 12, 657, 12, 612]]
5
65
def f(a,b,x): return (a*x)//b - a*(x//b) a,b,n=map(int,input().split()) res=0 if n<=b: res=f(a,b,n) print(res) else: res=f(a,b,b-1) if n%b==0: res=max(res,f(a,b,n-1)) print(res) else: res=max(res,f(a,b,(n//b)-1)) print(res)
def f(a,b,x): return (a*x)//b - a*(x//b) a,b,n=map(int,input().split()) res=0 if n<b: res=f(a,b,n) print(res) else: res=f(a,b,b-1) if n%b==0: res=max(res,f(a,b,n-1)) print(res) else: res=max(res,f(a,b,(n//b)-1)) print(res)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 19], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 18]]
5
135
a, b, n = map(int, input().split()) x = b - 1 if 0 <= b - 1 <= n else n - 1 print(a*x//b - a * (x // b))
a, b, n = map(int, input().split()) x = b - 1 if 0 <= b - 1 <= n else n print(a*x//b - a * (x // b))
[["-", 0, 1, 0, 662, 12, 41, 0, 657, 17, 33], ["-", 0, 1, 0, 662, 12, 41, 0, 657, 12, 612]]
5
51
/*author : Yashvardhan Saturday, May 02, 2020 6:24 PM */ #include <bits/stdc++.h> using namespace std; using ll = long long; #define int ll #define pb push_back #define vi vector<int> #define pi pair<int, int> #define vpi vector<pi> #define ff first #define ss second #define mp make_pair #define endl '\n' #define al...
/*author : Yashvardhan Saturday, May 02, 2020 6:24 PM */ #include <bits/stdc++.h> using namespace std; using ll = long long; #define int ll #define pb push_back #define vi vector<int> #define pi pair<int, int> #define vpi vector<pi> #define ff first #define ss second #define mp make_pair #define endl '\n' #define al...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 33], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]]
1
633
a, b, n = map(int, input().split()) def val(x): global a, b, n return int((a*x)//b - a*(x//b)) if n >= b: print(val(b-0.001)) else: print(val(n))
a, b, n = map(int, input().split()) def val(x): global a, b, n return int((a*x)//b - a*(x//b)) if n >= b: print(val(b-1)) else: print(val(n))
[["-", 3, 4, 0, 652, 3, 4, 0, 657, 12, 531], ["+", 3, 4, 0, 652, 3, 4, 0, 657, 12, 612]]
5
72
#include <bits/stdc++.h> using namespace std; #define fastio \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL); #define pb pu...
#include <bits/stdc++.h> using namespace std; #define fastio \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL); #define pb pu...
[["-", 8, 9, 0, 1, 0, 11, 12, 16, 31, 22], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 31, 22]]
1
190
A,B,N=map(int,input().split()) C=min(B,N) print(int(A*C/B))
A,B,N=map(int,input().split()) C=min(B-1,N) print(int(A*C/B))
[["+", 0, 662, 12, 652, 3, 4, 0, 657, 17, 33], ["+", 0, 662, 12, 652, 3, 4, 0, 657, 12, 612]]
5
37
import math a, b , n = map(int, input().split()) s1 = math.floor(a * n / b) - a * math.floor(n / b) if n <= b: print(s1) exit() ans = 0 for i in range(b, b - 10*3, -1): ans = max(math.floor(a * (b-1) / b) - a * math.floor((b-1) / b), ans) print(ans)
import math a, b , n = map(int, input().split()) s1 = math.floor(a * n / b) - a * math.floor(n / b) if n < b: print(s1) exit() ans = 0 for i in range(b, b - 10*3, -1): ans = max(math.floor(a * (b-1) / b) - a * math.floor((b-1) / b), ans) print(ans)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 19], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 18]]
5
115
#include <iostream> #include <math.h> #include <string> #include <unordered_map> #include <unordered_set> #include <utility> #include <vector> using namespace std; int main() { long long a, b, c; cin >> a >> b >> c; if (c > b) c = b - 1; cout << (long long)((1.0 * c / b) * a) << endl; }
#include <iostream> #include <math.h> #include <string> #include <unordered_map> #include <unordered_set> #include <utility> #include <vector> using namespace std; int main() { long long a, b, c; cin >> a >> b >> c; if (c >= b) c = b - 1; cout << (long long)((1.0 * c / b) * a) << endl; }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
72
a,b,n=map(int,input().split()) if n<b: ans=int(a*n/b)-a*int(n/b) else : ans=int(a*(n-1)/b)-a*int((n-1)/b) print(ans)
a,b,n=map(int,input().split()) if n<b: ans=int(a*n/b)-a*int(n/b) else: ans=int(a*(b-1)/b)-a*int((b-1)/b) print(ans)
[["-", 0, 657, 31, 657, 12, 23, 0, 657, 31, 22], ["+", 0, 657, 31, 657, 12, 23, 0, 657, 31, 22], ["-", 3, 4, 0, 657, 31, 23, 0, 657, 31, 22], ["+", 3, 4, 0, 657, 31, 23, 0, 657, 31, 22]]
5
75
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> P; const ll mod = 1000000007; const ll INF = mod * mod; #define rep(i, n) for (int i = 0; i < n; i++) #define per(i, n) for (int i = n - 1; i >= 0; i--) #define Rep(i, sta, n) for (int i = sta; i < n; i++) #define rep1(i, n) for ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> P; const ll mod = 1000000007; const ll INF = mod * mod; #define rep(i, n) for (int i = 0; i < n; i++) #define per(i, n) for (int i = n - 1; i >= 0; i--) #define Rep(i, sta, n) for (int i = sta; i < n; i++) #define rep1(i, n) for ...
[["-", 64, 9, 0, 1, 0, 11, 12, 16, 17, 72], ["+", 64, 9, 0, 1, 0, 11, 12, 16, 17, 33], ["-", 8, 9, 0, 1, 0, 11, 12, 16, 17, 72], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 33]]
1
194
package main import ( "bufio" "fmt" "math" "os" "strconv" ) func main() { A := nextInt64() B := nextInt64() N := nextInt64() var x int64 if B >= N { // Rが最大になるのは x == Nのとき x = N } else { // Rは全ての値を取ることができる。最大になるのは B-1のとき x = B - 1 } fmt.Println(divfloor(A*x, B) - A*divfloor(x, B)) } func divflo...
package main import ( "bufio" "fmt" "math" "os" "strconv" ) func main() { A := nextInt64() B := nextInt64() N := nextInt64() var x int64 if B > N { // Rが最大になるのは x == Nのとき x = N } else { // Rは全ての値を取ることができる。最大になるのは B-1のとき x = B - 1 } fmt.Println(divfloor(A*x, B) - A*divfloor(x, B)) } func divfloo...
[["-", 0, 435, 8, 196, 0, 57, 15, 16, 17, 20], ["+", 0, 435, 8, 196, 0, 57, 15, 16, 17, 47]]
7
295
#include <algorithm> #include <cmath> #include <cstdio> #include <iomanip> #include <iostream> #include <iterator> #include <limits> #include <numeric> #include <sstream> #include <string> #include <utility> #include <vector> using namespace std; #define repd(i, a, b) for (int i = (a); i < (b); ++i) #define rep(i, n)...
#include <algorithm> #include <cmath> #include <cstdio> #include <iomanip> #include <iostream> #include <iterator> #include <limits> #include <numeric> #include <sstream> #include <string> #include <utility> #include <vector> using namespace std; #define repd(i, a, b) for (int i = (a); i < (b); ++i) #define rep(i, n)...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
142
import math A, B, N = [int(x) for x in input().split()] if B >= N: x = N else: x = B - 1 print(math.floor(A*x/B)-A*math.floor(x/B))
import math A, B, N = [int(x) for x in input().split()] if B > N: x = N else: x = B - 1 print(math.floor(A*x/B)-A*math.floor(x/B))
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47]]
5
63
#include <algorithm> #include <iostream> #include <math.h> #include <queue> #include <string> #include <tuple> #include <vector> #include <map> #include <set> #include <stack> #include <unordered_map> using namespace std; #define rep(i, n) for (int(i) = 0; (i) < (n); (i)++) #define all(x) (x).begin(), (x).end() usin...
#include <algorithm> #include <iostream> #include <math.h> #include <queue> #include <string> #include <tuple> #include <vector> #include <map> #include <set> #include <stack> #include <unordered_map> using namespace std; #define rep(i, n) for (int(i) = 0; (i) < (n); (i)++) #define all(x) (x).begin(), (x).end() usin...
[["+", 12, 16, 31, 23, 0, 16, 12, 23, 0, 24], ["+", 12, 16, 31, 23, 0, 16, 12, 23, 0, 25]]
1
214
str1 = str(input(' ')) l = str1.split(' ') a = int(l[0]) b = int(l[1]) n = int(l[2]) if n<=b: print((a*n)//b - a*(n//b)) else: print((a*(b-1)//b) - a*((b-1)//b))
str1 = str(input(' ')) l = str1.split(' ') a = int(l[0]) b = int(l[1]) n = int(l[2]) if n<b: print((a*(n))//b - a*((n)//b)) else: print((a*(b-1)//b) - a*((b-1)//b))
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 19], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 18], ["+", 31, 657, 31, 23, 0, 657, 12, 23, 0, 24], ["+", 31, 657, 31, 23, 0, 657, 12, 23, 0, 25], ["+", 3, 4, 0, 657, 12, 657, 12, 23, 0, 24], ["+", 12, 657, 12, 23, 0, 657, 31, 23, 0, 25]]
5
99
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; int main() { ll a, b, n; cin >> a >> b >> n; ll max; if (b < n) { ll k = n / b; ll o = b * k - 1; max = a * o / b - a * (o / b); } else max = a * n / b - a * (n / b); cout << max << endl; }
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; int main() { ll a, b, n; cin >> a >> b >> n; ll max; if (b <= n) { ll k = n / b; ll o = b * k - 1; max = a * o / b - a * (o / b); } else max = a * n / b - a * (n / b); cout << max << endl; }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
105
a, b, n = map(int, input().split()) if n >= b: print(int(a*(b-1)/b) - a*int(b-1/b)) else: print(int(a*n/b) - a*int(n/b))
a, b, n = map(int, input().split()) if n >= b: print(int(a*(b-1)/b) - a*int((b-1)/b)) else: print(int(a*n/b) - a*int(n/b))
[["+", 12, 652, 3, 4, 0, 657, 31, 23, 0, 24], ["+", 12, 652, 3, 4, 0, 657, 31, 23, 0, 25]]
5
71
import math A,B,N = map(int,input().split()) if N <=B: print(math.floor(A*N/B)) else: print(math.floor(A*(B-1)/B))
import math A,B,N = map(int,input().split()) if N < B: print(math.floor(A*N/B)) else: print(math.floor(A*(B-1)/B))
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 19], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 18]]
5
57
#include <algorithm> #include <bitset> #include <complex> #include <deque> #include <exception> #include <fstream> #include <functional> #include <iomanip> #include <ios> #include <iosfwd> #include <iostream> #include <istream> #include <iterator> #include <limits> #include <list> #include <locale> #include <map> #incl...
#include <algorithm> #include <bitset> #include <complex> #include <deque> #include <exception> #include <fstream> #include <functional> #include <iomanip> #include <ios> #include <iosfwd> #include <iostream> #include <istream> #include <iterator> #include <limits> #include <list> #include <locale> #include <map> #incl...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 16, 31, 23, 0, 16, 12, 23, 0, 24], ["+", 0, 16, 31, 23, 0, 16, 12, 23, 0, 25]]
1
145
import numpy as np a,b,n=list(map(int,input().split())) def func(a,b,x): return int(a*x/b)-a*int(x/b) if n>b: print(func(a,b,b-1)) else: print(func(a,b,n))
import numpy as np a,b,n=list(map(int,input().split())) def func(a,b,x): return int(a*x/b)-a*int(x/b) if n>=b: print(func(a,b,b-1)) else: print(func(a,b,n))
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20]]
5
84
#include <stdio.h> int main() { int a; double b, n; scanf("%d%lld%lld", &a, &b, &n); if (n >= b) { printf("%lld\n", (long long)(a * (b - 1) / b)); } else { printf("%lld\n", (long long)(a * n / b)); } return 0; }
#include <stdio.h> int main() { int a; long long b, n; scanf("%d%lld%lld", &a, &b, &n); if (n >= b) { printf("%lld\n", (long long)(a * (b - 1) / b)); } else { printf("%lld\n", (long long)(a * n / b)); } return 0; }
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]]
1
90
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <iostream> #include <map> #include <queue> #include <string> #include <vector> #define int long long #define R register #define IL inline #define Rf(a, b, c) for (R int(a) = (b); (a) <= (c); ++(a)) #...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <iostream> #include <map> #include <queue> #include <string> #include <vector> #define int long long #define R register #define IL inline #define Rf(a, b, c) for (R int(a) = (b); (a) <= (c); ++(a)) #...
[["+", 0, 43, 49, 50, 51, 16, 31, 16, 17, 48], ["+", 0, 43, 49, 50, 51, 16, 31, 16, 12, 22], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 17, 33], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 12, 13]]
1
352
import math a, b, n = list(map(int, input().split())) x = min(b, n) print(math.floor(a * x / b) - a * math.floor(x / b))
import math a, b, n = list(map(int, input().split())) x = min(b-1, n) print(math.floor(a * x / b) - a * math.floor(x / b))
[["+", 0, 662, 12, 652, 3, 4, 0, 657, 17, 33], ["+", 0, 662, 12, 652, 3, 4, 0, 657, 12, 612]]
5
55
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll a, b, n; int main() { cin >> a >> b >> n; if (n > b) { ll ans = (a * (b - 1)) / b; printf("%lld\n", ans); } else { ll ans = (a * (n)) / b; printf("%lld\n", ans); } }
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll a, b, n; int main() { cin >> a >> b >> n; if (n >= b) { ll ans = (a * (b - 1)) / b; printf("%lld\n", ans); } else { ll ans = (a * (n)) / b; printf("%lld\n", ans); } }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
91
import math A,B,N= map(int, input().split()) ans = 0 if N>B: i = B-1 else: i = N d = (math.floor((A*i)/B) - A *math.floor(i/B)) print(d)
import math A,B,N= map(int, input().split()) ans = 0 if N>=B: i = B-1 else: i = N d = (math.floor((A*i)/B) - A *math.floor(i/B)) print(d)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20]]
5
69
#include <algorithm> #include <cmath> #include <iostream> #include <set> #include <string> #include <vector> using namespace std; int main() { long long A, B, N; cin >> A >> B >> N; long long m = floor(A * min(N, B) / B) - A * floor(min(N, B) / B); cout << m << endl; }
#include <algorithm> #include <cmath> #include <iostream> #include <set> #include <string> #include <vector> using namespace std; int main() { long long A, B, N; cin >> A >> B >> N; long long m = floor(A * min(N, B - 1) / B) - A * floor(min(N, B - 1) / B); cout << m << endl; }
[["+", 31, 16, 12, 2, 3, 4, 0, 16, 17, 33], ["+", 31, 16, 12, 2, 3, 4, 0, 16, 12, 13], ["+", 0, 16, 31, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 16, 31, 2, 3, 4, 0, 16, 12, 13]]
1
76
#include "bits/stdc++.h" #define endl '\n' using namespace std; long long int A, B, N; int main() { cin >> A; cin >> B; cin >> N; if (N > B) cout << A * (B - 1) / B - A * (((B - 1) / B)); else cout << A * N / B - A * (N / B); return 0; }
#include "bits/stdc++.h" #define endl '\n' using namespace std; long long int A, B, N; int main() { cin >> A; cin >> B; cin >> N; if (N >= B) cout << A * (B - 1) / B - A * (((B - 1) / B)); else cout << A * N / B - A * (N / B); return 0; }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
90
a=list(map(int, input().split())) A=a[0] B=a[1] N=a[2] if B<N: i=int(A*(B-1)/B)-A*int((B-1)/B) else: i=int(A*N/B)-A*int(N/B) print(i)
a=list(map(int, input().split())) A=a[0] B=a[1] N=a[2] if B-1<N: i=int(A*(B-1)/B)-A*int((B-1)/B) else: i=int(A*N/B)-A*int(N/B) print(i)
[["+", 0, 656, 0, 57, 15, 666, 0, 657, 17, 33], ["+", 0, 656, 0, 57, 15, 666, 0, 657, 12, 612]]
5
92
a,b,n = map(int,input().split()) x = b-1 if b > n: res = int(a/b) else : res = int((a/b)*(b-1)) print(res)
a,b,n = map(int,input().split()) x = b-1 if b > n: res = int((a/b)*n) else : res = int((a/b)*(b-1)) print(res)
[["+", 12, 652, 3, 4, 0, 657, 31, 23, 0, 24], ["+", 12, 652, 3, 4, 0, 657, 31, 23, 0, 25], ["+", 0, 662, 12, 652, 3, 4, 0, 657, 17, 48], ["+", 0, 662, 12, 652, 3, 4, 0, 657, 12, 22]]
5
58
#include <stdio.h> int main() { long long int A, B, N; scanf("%lld %lld %lld", &A, &B, &N); if (N >= B - 1) { printf("%lld", ((A * (B - 1)) / B)); } else { printf("%lld", A * N, (A * N) / B); } }
#include <stdio.h> int main() { long long int A, B, N; scanf("%lld %lld %lld", &A, &B, &N); if (N >= B - 1) { printf("%lld", ((A * (B - 1)) / B)); } else { printf("%lld", (A * N) / B); } }
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 48], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 22], ["-", 0, 9, 0, 1, 0, 2, 3, 4, 0, 21]]
1
86
import java.io.IOException; import java.io.InputStream; import java.util.NoSuchElementException; public class Main { public static void main(String[] args) { FastScanner sc = new FastScanner(); int A = sc.nextInt(); int B = sc.nextInt(); int N = sc.nextInt(); long x = Math.min(N, B - 1); l...
import java.io.IOException; import java.io.InputStream; import java.util.NoSuchElementException; public class Main { public static void main(String[] args) { FastScanner sc = new FastScanner(); long A = sc.nextLong(); long B = sc.nextLong(); long N = sc.nextLong(); long x = Math.min(N, B - 1);...
[["-", 0, 195, 8, 196, 0, 503, 39, 506, 0, 507], ["+", 0, 195, 8, 196, 0, 503, 39, 506, 0, 96], ["-", 8, 196, 0, 503, 49, 200, 51, 492, 141, 22], ["+", 8, 196, 0, 503, 49, 200, 51, 492, 141, 22]]
3
656
import math A,B,N = map(int,input().split()) if B-1>N: print(math.floor((A*N)/B)-A*math.floor(N/B)) else: print(math.floor((A*B-1)/B)-A*math.floor(B-1/B))
import math A,B,N = map(int,input().split()) if B-1>N: print(math.floor((A*N)/B)-A*math.floor(N/B)) else: print(math.floor((A*(B-1))/B)-A*math.floor((B-1)/B))
[["+", 0, 657, 31, 23, 0, 657, 12, 23, 0, 24], ["+", 0, 657, 31, 23, 0, 657, 12, 23, 0, 25], ["+", 0, 657, 12, 657, 12, 652, 3, 4, 0, 24], ["+", 12, 652, 3, 4, 0, 657, 31, 23, 0, 25]]
5
85
a,b,n = map(int,input().split()) x = math.floor(a*n/b)-( a*math.floor(n/b)) y = math.floor(a*b/b)-( a*math.floor(b/b)) z = math.floor(a*(b-1)/b)-( a*math.floor((b-1)/b)) if b == 1: print(0) elif n < b: print(x) else: print(z)
import math a,b,n = map(int,input().split()) x = math.floor(a*n/b)-( a*math.floor(n/b)) y = math.floor(a*b/b)-( a*math.floor(b/b)) z = math.floor(a*(b-1)/b)-( a*math.floor((b-1)/b)) if b == 1: print(0) elif n < b: print(x) else: print(z)
[["+", 36, 36, 36, 36, 0, 656, 0, 596, 0, 487], ["+", 36, 36, 0, 656, 0, 596, 141, 673, 0, 22]]
5
125
A,B,N = map(int,input().split()) if N > B: print(int(A*(B-1)/B) - A * int((B-1)/B)) else: print(int(A*N/B) - A*int(N/B))
A,B,N = map(int,input().split()) if N >= B: print(int(A*(B-1)/B) - A * int((B-1)/B)) else: print(int(A*N/B) - A*int(N/B))
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20]]
5
73
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, n) for (ll i = 0, i##_len = (n); i < i##_len; i++) #define reps(i, s, n) for (ll i = (s), i##_len = (n); i < i##_len; i++) #define rrep(i, n) for (ll i = (n)-1; i >= 0; i--) #define rreps(i, e, n) for (ll i = (n)-1; i >= (e); i--) #defin...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, n) for (ll i = 0, i##_len = (n); i < i##_len; i++) #define reps(i, s, n) for (ll i = (s), i##_len = (n); i < i##_len; i++) #define rrep(i, n) for (ll i = (n)-1; i >= 0; i--) #define rreps(i, e, n) for (ll i = (n)-1; i >= (e); i--) #defin...
[["+", 0, 1, 0, 16, 31, 16, 12, 2, 63, 22], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 21], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 22], ["+", 31, 16, 12, 2, 3, 4, 0, 16, 31, 22]]
1
182
import math a, b, n = [int(i) for i in input().split(' ')] if n > b: x = b - 1 else: x = n f = math.floor(a * x / b) - a * math.floor(x / b) print(f)
import math a, b, n = [int(i) for i in input().split(' ')] if n >= b: x = b - 1 else: x = n f = math.floor(a * x / b) - a * math.floor(x / b) print(f)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20]]
5
69
a,b,n=map(int,input().split()) def f(x,a=a,b=b): return (a*x//b) -a*(x//b) print(f(b-1) if b<n else f(n))
a,b,n=map(int,input().split()) def f(x,a=a,b=b): return (a*x//b) -a*(x//b) print(f(b-1) if b<=n else f(n))
[["-", 0, 652, 3, 4, 0, 41, 0, 666, 667, 18], ["+", 0, 652, 3, 4, 0, 41, 0, 666, 667, 19]]
5
66
#include <bits/stdc++.h> using namespace std; int main() { int64_t A, B, X; cin >> A >> B >> X; int64_t temp; if (X < B) { temp = X; cout << (int)((A * temp) / B) - (A * (int)(temp / B)) << endl; } else { temp = X - 1; cout << (int)((A * temp) / B) - (A * (int)(temp / B)) << endl; } r...
#include <bits/stdc++.h> using namespace std; int main() { int64_t A, B, X; cin >> A >> B >> X; int64_t temp; if (X < B) { temp = X; cout << (int)((A * temp) / B) - (A * (int)(temp / B)) << endl; } else { temp = B - 1; cout << (int)((A * temp) / B) - (A * (int)(temp / B)) << endl; } r...
[["-", 0, 9, 0, 1, 0, 11, 12, 16, 31, 22], ["+", 0, 9, 0, 1, 0, 11, 12, 16, 31, 22]]
1
114
#include <algorithm> #include <cassert> #include <cmath> #include <complex> #include <cstring> #include <functional> #include <iostream> #include <map> #include <queue> #include <random> #include <regex> #include <set> #include <stack> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(...
#include <algorithm> #include <cassert> #include <cmath> #include <complex> #include <cstring> #include <functional> #include <iostream> #include <map> #include <queue> #include <random> #include <regex> #include <set> #include <stack> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(...
[["+", 49, 50, 51, 2, 3, 4, 0, 16, 17, 33], ["+", 49, 50, 51, 2, 3, 4, 0, 16, 12, 13]]
1
433
#!/usr/bin/env python3 import sys import math # from decimal import * from fractions import * def solve(A: int, B: int, N: int): def kansuu(x): # return math.floor(A*x/B) - A * math.floor(x/B) left = math.floor(Fraction(A) * Fraction(x) * Fraction(1, B)) right = Fraction(A) * math.floor(Fr...
#!/usr/bin/env python3 import sys import math # from decimal import * from fractions import * def solve(A: int, B: int, N: int): def kansuu(x): # return math.floor(A*x/B) - A * math.floor(x/B) left = math.floor(Fraction(A) * Fraction(x) * Fraction(1, B)) right = Fraction(A) * math.floor(Fr...
[["-", 0, 14, 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, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
203
#include <bits/stdc++.h> using namespace std; //#pragma GCC optimize("Ofast") #define rep(i, n) for (long long i = 0; i < (long long)(n); i++) #define REP(i, k, n) for (long long i = k; i < (long long)(n); i++) #define all(a) a.begin(), a.end() #define eb emplace_back #define lb(v, k) (lower_bound(all(v), k) - v.begin(...
#include <bits/stdc++.h> using namespace std; //#pragma GCC optimize("Ofast") #define rep(i, n) for (long long i = 0; i < (long long)(n); i++) #define REP(i, k, n) for (long long i = k; i < (long long)(n); i++) #define all(a) a.begin(), a.end() #define eb emplace_back #define lb(v, k) (lower_bound(all(v), k) - v.begin(...
[["+", 0, 16, 31, 23, 0, 16, 12, 23, 0, 24], ["+", 0, 16, 31, 23, 0, 16, 12, 23, 0, 25]]
1
701
# Problem D - Floor Function import math # input A, B, N = map(int, input().split()) # initialization ans = 0 if N<=B: ans = math.floor(A*N/B) - A * math.floor(N/B) else: ans = math.floor(A*(B-1)/B) - A * math.floor((B-1)/B) # output print(ans)
# Problem D - Floor Function import math # input A, B, N = map(int, input().split()) # initialization ans = 0 if N<B: ans = math.floor(A*N/B) - A * math.floor(N/B) else: ans = math.floor(A*(B-1)/B) - A * math.floor((B-1)/B) # output print(ans)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 19], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 18]]
5
92
#include <bits/stdc++.h> using namespace std; #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; #define fast \ { \ i...
#include <bits/stdc++.h> using namespace std; #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; #define fast \ { \ i...
[["-", 64, 9, 0, 1, 0, 16, 12, 5, 0, 6], ["+", 64, 9, 0, 1, 0, 16, 12, 5, 0, 6]]
1
737
import math A, B, N = map(int, input().split()) solved_flag = False if B==1: ans = 0 solved_flag = True else: if B < N: x = B-1 else: x = N if not solved_flag: ans = math.floor(A*x/B) - A*math.floor(x/B) print(ans)
import math A, B, N = map(int, input().split()) solved_flag = False if B==1: ans = 0 solved_flag = True else: if B <= N: x = B-1 else: x = N if not solved_flag: ans = math.floor(A*x/B) - A*math.floor(x/B) print(ans)
[["-", 75, 76, 8, 196, 0, 57, 15, 666, 667, 18], ["+", 75, 76, 8, 196, 0, 57, 15, 666, 667, 19]]
5
82
#include <bits/stdc++.h> using namespace std; int main() { int64_t A, B, N; cin >> A >> B >> N; cout << (A * min(N, B)) / B << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int64_t A, B, N; cin >> A >> B >> N; cout << (A * min(N, B - 1)) / B << endl; }
[["+", 0, 16, 12, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 16, 12, 2, 3, 4, 0, 16, 12, 13]]
1
44
import math A, B, N = list(map(int, input().split())) if B >= N: ans = int(A*(N/B-N//B)) else: ans = int(A*(B-1)/B) print(ans)
import math A, B, N = list(map(int, input().split())) if B > N: ans = int(A*(N/B-N//B)) else: ans = int(A*(B-1)/B) print(ans)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47]]
5
64
import math s = list(map(int,input().split())) a = s[0] b = s[1] n = s[2] x = 0 if b-1 <= n: x = b-1 ans = math.floor(a*x/b)-n*math.floor(x/b) else: x = n-1 ans = math.floor(a*x/b)-n*math.floor(x/b) print(ans)
import math s = list(map(int,input().split())) a = s[0] b = s[1] n = s[2] x = 0 if b-1 <= n: x = b-1 ans = math.floor(a*x/b)-n*math.floor(x/b) else: x = n ans = math.floor(a*x/b)-n*math.floor(x/b) print(ans)
[["-", 8, 196, 0, 1, 0, 662, 12, 657, 17, 33], ["-", 8, 196, 0, 1, 0, 662, 12, 657, 12, 612]]
5
109
a, b, n = map(int, input().split()) if b<n: i = b-1 ans = (a*i//b) - a*(i//b) else: i = n ans = (a*i//b) - a*(i//b) # ans = [(a*i//b) - a*(i//b) for i in range(1, min(b, n)+1)] # print(max(ans)) print(ans)
a, b, n = map(int, input().split()) if b<=n: i = b-1 ans = (a*i//b) - a*(i//b) else: i = n ans = (a*i//b) - a*(i//b) print(ans)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 18], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 19]]
5
73
#include <iostream> #include <list> #include <queue> #include <vector> using namespace std; #define MIN(x, y) x < y ? x : y #define MAX(x, y) x < y ? y : x #define ABS(x, y) x < y ? (y - x) : (x - y) typedef long long Long; int main() { Long a, b, n; Long p, q; Long ans = 0; cin >> a >> b >> n; Long x =...
#include <iostream> #include <list> #include <queue> #include <vector> using namespace std; #define MIN(x, y) x < y ? x : y #define MAX(x, y) x < y ? y : x #define ABS(x, y) x < y ? (y - x) : (x - y) typedef long long Long; int main() { Long a, b, n; Long p, q; Long ans = 0; cin >> a >> b >> n; Long x =...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
136
A, B, N = map(int, input().split()) if (N <= B): print(((A * (N)) // B) - (A * ((N) // B))) elif(N > B): print(((A * (B - 1)) // B) - (A * ((B - 1) // B)))
A, B, N = map(int, input().split()) if (N < B): print(((A * (N)) // B) - (A * ((N) // B))) elif(N >= B): print(((A * (B - 1)) // B) - (A * ((B - 1) // B)))
[["-", 0, 656, 0, 57, 15, 23, 0, 666, 667, 19], ["+", 0, 656, 0, 57, 15, 23, 0, 666, 667, 18], ["-", 0, 57, 75, 665, 15, 23, 0, 666, 667, 47], ["+", 0, 57, 75, 665, 15, 23, 0, 666, 667, 20]]
5
88
a, b, n = map(int, input().split()) ans1 = -111111 if n > b: ans1 = (a * (b-1))//b - a*((b-1)//b) ans2 = (a * n)//b - a*(n//b) print(max(ans1, ans2))
a, b, n = map(int, input().split()) ans1 = -111111 if n >= b: ans1 = (a * (b-1))//b - a*((b-1)//b) ans2 = (a * n)//b - a*(n//b) print(max(ans1, ans2))
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20]]
5
78
import math A,B,N=map(int,input().split()) result=0 if B<=N: x=(N//B)*B-1 result=math.floor(A*x/B)-A*math.floor(N/B) if B>N: result=math.floor(A*N/B)-A*math.floor(N/B) if B==1: print(0) else: print(result)
import math A,B,N=map(int,input().split()) result=0 if B<=N: x=(N//B)*B-1 result=math.floor(A*x/B)-A*math.floor(x/B) if B>N: result=math.floor(A*N/B)-A*math.floor(N/B) if B==1: print(0) else: print(result)
[["-", 12, 657, 12, 652, 3, 4, 0, 657, 31, 22], ["+", 12, 657, 12, 652, 3, 4, 0, 657, 31, 22]]
5
105
#include <bits/stdc++.h> using namespace std; int main() { int64_t a, b, n; cin >> a >> b >> n; int y = 0; if (n > b && b != 1) n = b - 1; y = (a * n) / b; cout << y << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int64_t a, b, n; cin >> a >> b >> n; int y = 0; if (n >= b) n = b - 1; y = (a * n) / b; cout << y << endl; }
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 47], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 12, 22], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 79], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]]
1
64
a, b, n = gets.chomp.split.map(&:to_i) x = (b < n) ? (b - 1) : n puts (a * x / b) - (a * (x / b))
a, b, n = gets.chomp.split.map(&:to_i) x = (b <= n) ? (b - 1) : n puts (a * x / b) - (a * (x / b))
[["-", 0, 662, 12, 754, 15, 739, 0, 738, 17, 18], ["+", 0, 662, 12, 754, 15, 739, 0, 738, 17, 19]]
4
50
import java.util.*; import java.util.stream.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long a = sc.nextLong(), b = sc.nextLong(), n = sc.nextLong(); long x = 0; if (n < b) { x = n; } else if (n > b) { x = b - 1; } else { ...
import java.util.*; import java.util.stream.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long a = sc.nextLong(), b = sc.nextLong(), n = sc.nextLong(); long x = 0; if (n < b) { x = n; } else if (n > b) { x = b - 1; } else { ...
[["-", 0, 57, 64, 196, 0, 1, 0, 11, 17, 110], ["-", 0, 57, 64, 196, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 11, 17, 32], ["+", 0, 57, 64, 196, 0, 1, 0, 11, 12, 499]]
3
148
#include <bits/stdc++.h> using namespace std; #define endl '\n' #define rep(i, n) \ ; \ for (long long i = 0; i < (n); i++) using ll = long long; using P = pair<long long, long lon...
#include <bits/stdc++.h> using namespace std; #define endl '\n' #define rep(i, n) \ ; \ for (long long i = 0; i < (n); i++) using ll = long long; using P = pair<long long, long lon...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
199
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, n, t; cin >> a >> b >> n; if (n > b) t = b - 1; else t = n; cout << (a * t / b) - a * (t / b); return 0; }
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, n, t; cin >> a >> b >> n; if (n >= b) t = b - 1; else t = n; cout << (a * t / b) - a * (t / b); return 0; }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
68
#include <algorithm> #include <climits> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <utility> #include <vector> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long int; template ...
#include <algorithm> #include <climits> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <utility> #include <vector> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long int; template ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 31, 16, 12, 16, 31, 16, 31, 23, 0, 24], ["+", 31, 16, 12, 16, 31, 16, 31, 23, 0, 25]]
1
225
#include <cmath> #include <iostream> #include <map> #include <set> #include <vector> typedef long long int ll; using namespace std; long double a, b, c, n, m, q, aa[100000], bb[100000]; bool ra, rb, rc; vector<ll> va(20), vb; #define CE cout << endl #define C cout << #define E << endl int main() { cin >> a >> b ...
#include <cmath> #include <iostream> #include <map> #include <set> #include <vector> typedef long long int ll; using namespace std; long double a, b, c, n, m, q, aa[100000], bb[100000]; bool ra, rb, rc; vector<ll> va(20), vb; #define CE cout << endl #define C cout << #define E << endl int main() { cin >> a >> b ...
[["+", 64, 1, 0, 11, 12, 16, 31, 23, 0, 24], ["+", 64, 1, 0, 11, 12, 16, 31, 23, 0, 25], ["-", 8, 9, 0, 57, 75, 76, 0, 1, 0, 35], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22], ["-", 0, 14, 8, 9, 0, 43, 0, 42, 0, 22]]
1
133
#!/usr/bin/env python3 import math a, b, n = map(int, input().split()) if n > b: print(math.floor((a * (b - 1)) / b) - a * math.floor((b - 1) / b)) else: print(math.floor((a * n / b) - a * math.floor(n / b)))
#!/usr/bin/env python3 import math a, b, n = map(int, input().split()) if n >= b: print(math.floor((a * (b - 1)) / b) - a * math.floor((b - 1) / b)) else: print(math.floor((a * n / b) - a * math.floor(n / b)))
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20]]
5
88
#include <bits/stdc++.h> using namespace std; #define fast \ ios::sync_with_stdio(false); \ cin.tie(0); \ cout.tie(0) int main() { l...
#include <bits/stdc++.h> using namespace std; #define fast \ ios::sync_with_stdio(false); \ cin.tie(0); \ cout.tie(0) int main() { l...
[["-", 0, 1, 0, 16, 31, 16, 12, 16, 17, 72], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 33]]
1
64
#include <bits/stdc++.h> #define forn(i, n) for (int i = 0; i < int(n); ++i) #define for1(i, n) for (int i = 1; i <= int(n); ++i) #define ms(a, x) memset(a, x, sizeof(a)) #define F first #define S second #define all(x) (x).begin(), (x).end() using namespace std; typedef long long ll; typedef pair<int, int> pii; const...
#include <bits/stdc++.h> #define forn(i, n) for (int i = 0; i < int(n); ++i) #define for1(i, n) for (int i = 1; i <= int(n); ++i) #define ms(a, x) memset(a, x, sizeof(a)) #define F first #define S second #define all(x) (x).begin(), (x).end() using namespace std; typedef long long ll; typedef pair<int, int> pii; const...
[["+", 49, 50, 51, 2, 3, 4, 0, 16, 17, 33], ["+", 49, 50, 51, 2, 3, 4, 0, 16, 12, 13]]
1
205
import math A,B,N = map(int, input().split()) if B < N: print(math.floor( (A*(B-1))/B )) else: print(math.floor( (A*N)/B ))
import math A,B,N = map(int, input().split()) if B <= N: print(math.floor( (A*(B-1))/B )) else: print(math.floor( (A*N)/B ))
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 18], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 19]]
5
61
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < (n); i++) #define REP1(i, n) for (int i = 1; i <= (n); i++) #define REPD(i, a, b) for (int i = (a); i < (b); i++) #define ALL(v) (v).begin(), (v).end() using namespace std; typedef long long ll; typedef vector<string> vs; typedef vector<int> vi; typedef vec...
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < (n); i++) #define REP1(i, n) for (int i = 1; i <= (n); i++) #define REPD(i, a, b) for (int i = (a); i < (b); i++) #define ALL(v) (v).begin(), (v).end() using namespace std; typedef long long ll; typedef vector<string> vs; typedef vector<int> vi; typedef vec...
[["-", 75, 76, 0, 9, 0, 1, 0, 11, 12, 22], ["+", 75, 76, 0, 9, 0, 1, 0, 11, 12, 22]]
1
333
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, n; scanf("%lld%lld%lld", &a, &b, &n); printf("%lld", (long long)floor(a * min(b, n) / b)); return 0; }
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, c; scanf("%lld%lld%lld", &a, &b, &c); printf("%lld", (long long)floor(a * min(b - 1, c) / b)); return 0; }
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22], ["-", 0, 1, 0, 2, 3, 4, 0, 66, 28, 22], ["+", 0, 1, 0, 2, 3, 4, 0, 66, 28, 22], ["+", 31, 16, 12, 2, 3, 4, 0, 16, 17, 33], ["+", 31, 16, 12, 2, 3, 4, 0, 16, 12, 13], ["-", 0, 16, 31, 16, 12, 2, 3, 4, 0, 22], ["+", 0, 16, 31, 16, 12, 2,...
1
64
from math import floor A,B,N = map(int, input().split()) m = A//B a = A%B x = max(N,B-1) print(m*x+floor(a*x/B))
from math import floor A,B,N = map(int, input().split()) m = A//B a = A%B x = min(N,B-1) print(m*x+floor(a*x/B))
[["-", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22]]
5
57
A,B,N=map(int,input().split()) if B<=N: print(A*(B-1)/B) else: print(int(A*N/B))
A,B,N=map(int,input().split()) if B<=N: print(int(A*(B-1)/B)) else: print(int(A*N/B))
[["+", 0, 1, 0, 652, 3, 4, 0, 652, 63, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
48
import math A, B, N = map(int, input().split()) if B - 1 <= N: x = B - 1 else: x = N print('h') ans = math.floor(A * x / B) - A * math.floor(x / B) print(ans)
import math A, B, N = map(int, input().split()) if B - 1 <= N: x = B - 1 else: x = N ans = math.floor(A * x / B) - A * math.floor(x / B) print(ans)
[["-", 75, 76, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 654], ["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6], ["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 655], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
70
import math A,B,N = map(int,input().split()) m = min(B,N) num = math.floor((A*m)/B) - A * math.floor(m / B) print(num)
import math A,B,N = map(int,input().split()) m = min(B-1,N) num = math.floor((A*m)/B) - A * math.floor(m / B) print(num)
[["+", 0, 662, 12, 652, 3, 4, 0, 657, 17, 33], ["+", 0, 662, 12, 652, 3, 4, 0, 657, 12, 612]]
5
57
import math A,B,N = list(map(int, input().split())) if N <= B: print(math.floor(A*N/B)) else: print(math.floor(A*(B-1)/B))
import math A,B,N = list(map(int, input().split())) if N < B: print(math.floor(A*N/B)) else: print(math.floor(A*(B-1)/B))
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 19], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 18]]
5
60
A,B,N = map(int,input().split()) if N<= B-1: ans = (N*A)//B else: ((B-1)*A)//B print(ans)
A,B,N = map(int,input().split()) if N<= B-1: ans = (N*A)//B else: ans = ((B-1)*A)//B print(ans)
[["+", 75, 76, 8, 196, 0, 1, 0, 662, 31, 22], ["+", 75, 76, 8, 196, 0, 1, 0, 662, 0, 32]]
5
51
#include <bits/stdc++.h> using namespace std; int main() { long long int A, B, N; cin >> A >> B >> N; if (N < B) cout << A * N / B - A * (N / B) << endl; else cout << A - 1 << endl; }
#include <bits/stdc++.h> using namespace std; int main() { long long int A, B, N; cin >> A >> B >> N; if (N < B) cout << A * N / B - A * (N / B) << endl; else cout << A * (B - 1) / B << endl; }
[["+", 0, 16, 31, 16, 12, 16, 31, 16, 17, 48], ["+", 31, 16, 12, 16, 31, 16, 12, 23, 0, 24], ["+", 12, 16, 31, 16, 12, 23, 0, 16, 31, 22], ["+", 31, 16, 12, 16, 31, 16, 12, 23, 0, 25], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 85], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 22]]
1
62
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) #define rep1(i, n) for (int i = 1; i <= n; i++) #define fr(i, x, n) for (int i = x; i <= n; i++) #define rf(i, n, x) for (int i = n; i >= x; i--) #define mst(x, i) memset(x, i, sizeof(x)) #define IOS ios::sync_with_stdio(false), cin.tie(0) #define P...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) #define rep1(i, n) for (int i = 1; i <= n; i++) #define fr(i, x, n) for (int i = x; i <= n; i++) #define rf(i, n, x) for (int i = n; i >= x; i--) #define mst(x, i) memset(x, i, sizeof(x)) #define IOS ios::sync_with_stdio(false), cin.tie(0) #define P...
[["-", 31, 23, 0, 16, 12, 23, 0, 16, 31, 22], ["+", 31, 23, 0, 16, 12, 23, 0, 16, 31, 22]]
1
235
#include <bits/stdc++.h> #define IOS \ ios::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0); #define ll long long int #define endl...
#include <bits/stdc++.h> #define IOS \ ios::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0); #define ll long long int #define endl...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 0, 57, 75, 76, 0, 1, 0, 11, 12, 13], ["+", 0, 57, 75, 76, 0, 1, 0, 11, 12, 22]]
1
214