buggy_code
stringlengths
11
625k
fixed_code
stringlengths
17
625k
bug_type
stringlengths
2
4.45k
language
int64
0
8
token_count
int64
5
200k
import sys sys.setrecursionlimit(10 ** 6) from itertools import combinations_with_replacement def check(abcd, pattern): result = 0 for a,b,c,d in abcd: if (pattern[b-1] - pattern[a-1]) == c: result += d return result def main(): N, M, Q = map(int, input().split()) abcd = [list(...
import sys sys.setrecursionlimit(10 ** 6) from itertools import combinations_with_replacement def check(abcd, pattern): result = 0 for a,b,c,d in abcd: if (pattern[b-1] - pattern[a-1]) == c: result += d return result def main(): N, M, Q = map(int, input().split()) abcd = [list(...
[["-", 12, 652, 3, 4, 0, 652, 3, 4, 0, 612], ["+", 3, 4, 0, 652, 3, 4, 0, 657, 31, 22], ["+", 3, 4, 0, 652, 3, 4, 0, 657, 17, 72], ["+", 3, 4, 0, 652, 3, 4, 0, 657, 12, 612]]
5
154
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define all(x) (x).begin(), (x).end() typedef long long ll; typedef pair<ll, ll> P; const ll mod = 1000000007; //出力は (ans % mod + mod) % mod (負の剰余を正にする) const int inf = 1e9; const long long INF = 1LL << 60; // INF = 115...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define all(x) (x).begin(), (x).end() typedef long long ll; typedef pair<ll, ll> P; const ll mod = 1000000007; //出力は (ans % mod + mod) % mod (負の剰余を正にする) const int inf = 1e9; const long long INF = 1LL << 60; // INF = 115...
[["-", 64, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 17, 18]]
1
305
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int(i) = 0; (i) < (n); (i)++) #define ll long long #define pp pair<ll, ll> #define ld long double #define all(a) (a).begin(), (a).end() #define mk make_pair ll mod = 998244353; int inf = 1000001000; ll INF = 1e18 + 5; ll MOD = 1000000007; int main() ...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int(i) = 0; (i) < (n); (i)++) #define ll long long #define pp pair<ll, ll> #define ld long double #define all(a) (a).begin(), (a).end() #define mk make_pair ll mod = 998244353; int inf = 1000001000; ll INF = 1e18 + 5; ll MOD = 1000000007; int main() ...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["-", 75, 76, 0, 9, 0, 7, 15, 16, 17, 19], ["+", 75, 76, 0, 9, 0, 7, 15, 16, 17, 18]]
1
352
import itertools N, M, Q = map(int,input().split()) ABCD = [tuple(map(int, input().split())) for _ in range(Q)] ans = 0 for s in itertools.combinations_with_replacement(range(1,N+1),N): temp = 0 for i in range(Q): if s[ABCD[i][1]-1] - s[ABCD[i][0]-1] == ABCD[i][2]: temp += ABCD[i][3] ans...
import itertools N, M, Q = map(int,input().split()) ABCD = [tuple(map(int, input().split())) for _ in range(Q)] ans = 0 for s in itertools.combinations_with_replacement(range(1,M+1),N): temp = 0 for i in range(Q): if s[ABCD[i][1]-1] - s[ABCD[i][0]-1] == ABCD[i][2]: temp += ABCD[i][3] ans...
[["-", 3, 4, 0, 652, 3, 4, 0, 657, 31, 22], ["+", 3, 4, 0, 652, 3, 4, 0, 657, 31, 22]]
5
135
import itertools N, M, Q = map(int,input().split()) L = [] for _ in range(Q): L.append(list(map(int,input().split()))) A = itertools.combinations_with_replacement([i for i in range(1,M+1)], N) count = [] for a in A: temp = 0 for l in l: if a[l[1]-1] - a[l[0]-1] == l[2]: temp += l[3] ...
import itertools N, M, Q = map(int,input().split()) L = [] for _ in range(Q): L.append(list(map(int,input().split()))) A = itertools.combinations_with_replacement([i for i in range(1,M+1)], N) count = [] for a in A: temp = 0 for l in L: if a[l[1]-1] - a[l[0]-1] == l[2]: temp += l[3] ...
[["-", 0, 656, 0, 7, 8, 196, 0, 7, 12, 22], ["+", 0, 656, 0, 7, 8, 196, 0, 7, 12, 22]]
5
137
#include <bits/stdc++.h> using namespace std; #define SZ(x) (int)(x.size()) #define REP(i, n) for (int i = 0; i < (n); ++i) #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define RREP(i, n) for (int i = (int)(n)-1; i >= 0; --i) #define RFOR(i, a, b) for (int i = (int)(b)-1; i >= (a); --i) #define ALL(a) a.begin()...
#include <bits/stdc++.h> using namespace std; #define SZ(x) (int)(x.size()) #define REP(i, n) for (int i = 0; i < (n); ++i) #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define RREP(i, n) for (int i = (int)(n)-1; i >= 0; --i) #define RFOR(i, a, b) for (int i = (int)(b)-1; i >= (a); --i) #define ALL(a) a.begin()...
[["-", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13]]
1
720
import itertools N, M, Q = map(int, input().split()) A = [] for i in range(0, Q): a, b, c, d = map(int,input().split()) A.append([a,b,c,d]) nums = [] for i in range(1, M+1): nums.append(i) ans_l = [0] for A_n in itertools.combinations(nums, N): ans = 0 for i in range(0, Q): ...
import itertools N, M, Q = map(int, input().split()) A = [] for i in range(0, Q): a, b, c, d = map(int,input().split()) A.append([a,b,c,d]) nums = [] for i in range(1, M+1): nums.append(i) ans_l = [0] for A_n in itertools.combinations_with_replacement(nums, N): # print(A_n) ans...
[["-", 0, 656, 0, 7, 12, 652, 63, 319, 319, 22], ["+", 0, 656, 0, 7, 12, 652, 63, 319, 319, 22], ["-", 0, 7, 8, 196, 0, 57, 15, 23, 0, 24], ["-", 0, 7, 8, 196, 0, 57, 15, 23, 0, 25]]
5
183
#include <algorithm> #include <cstdlib> #include <iostream> #include <vector> using namespace std; void allpat(long long *max, int k, int N, int M, int Q, vector<int> &A, vector<long long> a, vector<long long> b, vector<long long> c, vector<long long> d) { if (k == N) { // if(A[] > M) re...
#include <algorithm> #include <cstdlib> #include <iostream> #include <vector> using namespace std; void allpat(long long *max, int k, int N, int M, int Q, vector<int> &A, vector<long long> a, vector<long long> b, vector<long long> c, vector<long long> d) { if (k == N) { // if(A[] > M) re...
[["-", 75, 76, 0, 9, 0, 43, 49, 50, 51, 13], ["+", 75, 76, 0, 9, 0, 43, 49, 50, 51, 13]]
1
380
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys import itertools def input(): return sys.stdin.readline() def resolve(): n, m, q = map(int, input().split()) a_d_list = [] for i in range(q): a_d_list.append(list(map(int,input().split()))) l = [i for i in range(1, m)] combi_l...
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys import itertools def input(): return sys.stdin.readline() def resolve(): n, m, q = map(int, input().split()) a_d_list = [] for i in range(q): a_d_list.append(list(map(int,input().split()))) l = [i for i in range(1, m+1)] combi...
[["+", 0, 659, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 659, 12, 652, 3, 4, 0, 657, 12, 612]]
5
205
import itertools N, M, Q = map(int, input().split()) int_tuple_list = list() for i in range(Q): int_tuple_list.append(tuple(map(int, input().split()))) m_list = [i for i in range(1, M + 1)] # print(m_list) all_sequence_list = list() score_list = list() for sequence in itertools.combinations(m_list, N): # pri...
import itertools N, M, Q = map(int, input().split()) int_tuple_list = list() for i in range(Q): int_tuple_list.append(tuple(map(int, input().split()))) m_list = [i for i in range(1, M + 1)] # print(m_list) all_sequence_list = list() score_list = list() for sequence in itertools.combinations_with_replacement(m...
[["-", 0, 656, 0, 7, 12, 652, 63, 319, 319, 22], ["+", 0, 656, 0, 7, 12, 652, 63, 319, 319, 22]]
5
141
import sys import itertools sys.setrecursionlimit(10 ** 7) read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines N, M, Q = map(int, input().split()) ABCD = [list(map(int, input().split())) for _ in range(Q)] ans = 0 for lst in itertools.combinations_with_replacem...
import sys import itertools sys.setrecursionlimit(10 ** 7) read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines N, M, Q = map(int, input().split()) ABCD = [list(map(int, input().split())) for _ in range(Q)] ans = 0 for lst in itertools.combinations_with_replacem...
[["-", 3, 4, 0, 652, 3, 4, 0, 657, 31, 22], ["+", 3, 4, 0, 652, 3, 4, 0, 657, 31, 22]]
5
153
#include <stdio.h> int n, m, q, max = 0; int A[15]; int a[55], b[55], c[55], d[55]; int check() { int ans = 0; for (int i = 1; i <= q; i++) if (A[b[i]] - A[a[i]] == c[i]) ans += d[i]; return ans; } void make(int i, int t) { if (i == t + 1) { int x = check(); if (x > max) max = x; ret...
#include <stdio.h> int n, m, q, max = 0; int A[15]; int a[55], b[55], c[55], d[55]; int check() { int ans = 0; for (int i = 1; i <= q; i++) if (A[b[i]] - A[a[i]] == c[i]) ans += d[i]; return ans; } void make(int i, int t) { if (i == n + 1) { int x = check(); if (x > max) max = x; ret...
[["-", 0, 57, 15, 23, 0, 16, 12, 16, 31, 22], ["+", 0, 57, 15, 23, 0, 16, 12, 16, 31, 22]]
0
257
def INT(): return int(input()) def MAP(): return map(int, input().split()) def LIST(): return list(map(int, input().split())) import itertools N, M, Q = MAP() a, b, c, d = [], [], [], [] for _ in range(Q): ai, bi, ci, di = MAP() a.append(ai-1); b.append(bi-1); c.append(ci); d.append(di) def solve(lst): a...
def INT(): return int(input()) def MAP(): return map(int, input().split()) def LIST(): return list(map(int, input().split())) import itertools N, M, Q = MAP() a, b, c, d = [], [], [], [] for _ in range(Q): ai, bi, ci, di = MAP() a.append(ai-1); b.append(bi-1); c.append(ci); d.append(di) def solve(lst): a...
[["-", 12, 652, 3, 4, 0, 652, 3, 4, 0, 612], ["+", 3, 4, 0, 652, 3, 4, 0, 657, 31, 22], ["+", 3, 4, 0, 652, 3, 4, 0, 657, 17, 72], ["+", 3, 4, 0, 652, 3, 4, 0, 657, 12, 612]]
5
213
import itertools n, m, q = map(int, input().split()) I = list(range(1, m + 1)) A = list(map(list, itertools.combinations(I, n))) l = len(A) ans = [0 for i in range(l)] for _ in range(q): a, b, c, d = map(int, input().split()) for i in range(l): if A[i][b - 1] - A[i][a - 1] == c: ans[i] += d...
import itertools n, m, q = map(int, input().split()) I = list(range(1, m + 1)) A = list(map(list, itertools.combinations_with_replacement(I, n))) l = len(A) ans = [0 for i in range(l)] for _ in range(q): a, b, c, d = map(int, input().split()) for i in range(l): if A[i][b - 1] - A[i][a - 1] == c: ...
[["-", 0, 652, 3, 4, 0, 652, 63, 319, 319, 22], ["+", 0, 652, 3, 4, 0, 652, 63, 319, 319, 22]]
5
141
n, m, q = map(int, input().split()) a = [0] * q b = [0] * q c = [0] * q d = [0] * q for i in range(q): a[i], b[i], c[i], d[i] = map(int,input().split()) A_list = [] for p in itertools.combinations_with_replacement(range(1,m+1),n): A_list.append(p) # print(A_list) ans = 0 for v in A_list: cur_score = 0 ...
import itertools n, m, q = map(int, input().split()) a = [0] * q b = [0] * q c = [0] * q d = [0] * q for i in range(q): a[i], b[i], c[i], d[i] = map(int,input().split()) A_list = [] for p in itertools.combinations_with_replacement(range(1,m+1),n): A_list.append(p) # print(A_list) ans = 0 for v in A_list: c...
[["+", 36, 36, 36, 36, 0, 656, 0, 596, 0, 487], ["+", 36, 36, 0, 656, 0, 596, 141, 673, 0, 22]]
5
179
# 2020/05/02 # AtCoder Beginner Contest 165 - C a = list() def mkArray(in_list, sav_val, cnt): if cnt >= m: a.append(in_list) return 0 else: for x in range(sav_val, m + 1): wk_list = list() wk_list.extend(in_list) wk_list.append(x) mkArray...
# 2020/05/02 # AtCoder Beginner Contest 165 - C a = list() def mkArray(in_list, sav_val, cnt): if cnt >= n: a.append(in_list) return 0 else: for x in range(sav_val, m + 1): wk_list = list() wk_list.extend(in_list) wk_list.append(x) mkArray...
[["-", 0, 14, 8, 196, 0, 57, 15, 666, 0, 22], ["+", 0, 14, 8, 196, 0, 57, 15, 666, 0, 22]]
5
231
N,M,Q = list(map(int, input().split())) C = [] for i in range(Q): C.append(list(map(int, input().split()))) import itertools res = 0 ls=list(range(1,M+1)) for a in itertools.combinations_with_replacement(ls, N): p = 0 for c in C: if a[c[1]]-a[c[0]]==c[2]: p += c[3] res = max...
N,M,Q = list(map(int, input().split())) C = [] for i in range(Q): C.append(list(map(int, input().split()))) import itertools res = 0 ls=list(range(1,M+1)) for a in itertools.combinations_with_replacement(ls, N): p = 0 for c in C: if a[c[1]-1]-a[c[0]-1]==c[2]: p += c[3] res =...
[["+", 15, 666, 0, 657, 31, 206, 206, 657, 17, 33], ["+", 15, 666, 0, 657, 31, 206, 206, 657, 12, 612], ["+", 15, 666, 0, 657, 12, 206, 206, 657, 17, 33], ["+", 15, 666, 0, 657, 12, 206, 206, 657, 12, 612]]
5
131
import itertools N, M, Q = map(int, input().split()) x1 = [0]*Q x2 = [0]*Q x3 = [0]*Q x4 = [0]*Q for i in range(Q): x1[i], x2[i], x3[i], x4[i] = map(int, input().split()) score = 0 tmp = 0 lis = range(1, M+1) A = [] for i in itertools.combinations(lis, N): A.append(list(i)) for i in range(len(A)): for ...
import itertools N, M, Q = map(int, input().split()) x1 = [0]*Q x2 = [0]*Q x3 = [0]*Q x4 = [0]*Q for i in range(Q): x1[i], x2[i], x3[i], x4[i] = map(int, input().split()) score = 0 tmp = 0 lis = range(1, M+1) A = [] for i in itertools.combinations_with_replacement(lis, N): A.append(list(i)) for i in range(l...
[["-", 0, 656, 0, 7, 12, 652, 63, 319, 319, 22], ["+", 0, 656, 0, 7, 12, 652, 63, 319, 319, 22], ["-", 8, 196, 0, 57, 15, 23, 0, 666, 667, 47], ["+", 8, 196, 0, 57, 15, 23, 0, 666, 667, 20]]
5
205
import sys sys.setrecursionlimit(10 ** 6) int1 = lambda x: int(x) - 1 p2D = lambda x: print(*x, sep="\n") def II(): return int(sys.stdin.readline()) def MI(): return map(int, sys.stdin.readline().split()) def LI(): return list(map(int, sys.stdin.readline().split())) def LLI(rows_number): return [LI() for _ in range(ro...
import sys sys.setrecursionlimit(10 ** 6) int1 = lambda x: int(x) - 1 p2D = lambda x: print(*x, sep="\n") def II(): return int(sys.stdin.readline()) def MI(): return map(int, sys.stdin.readline().split()) def LI(): return list(map(int, sys.stdin.readline().split())) def LLI(rows_number): return [LI() for _ in range(ro...
[["-", 3, 4, 0, 652, 3, 4, 0, 634, 0, 612], ["+", 3, 4, 0, 652, 3, 4, 0, 634, 0, 612]]
5
254
import itertools N, M, Q = map(int, input().split()) a = [None] * Q b = [None] * Q c = [None] * Q d = [None] * Q for i in range(Q): num = list(map(int, input().split())) a[i], b[i], c[i], d[i] = num[0] - 1, num[1] - 1, num[2], num[3] A = [i for i in range(1, M + 1)] max_v = 0 for v in itertools.combination...
import itertools N, M, Q = map(int, input().split()) a = [None] * Q b = [None] * Q c = [None] * Q d = [None] * Q for i in range(Q): num = list(map(int, input().split())) a[i], b[i], c[i], d[i] = num[0] - 1, num[1] - 1, num[2], num[3] A = [i for i in range(1, M + 1)] max_v = 0 for v in itertools.combinatio...
[["-", 0, 656, 0, 7, 12, 652, 63, 319, 319, 22], ["+", 0, 656, 0, 7, 12, 652, 63, 319, 319, 22]]
5
198
import itertools N,M,Q = map(int,input().split()) num = [[0 for i in range(4)] for j in range(Q)] test = list() k = 1 for i in range(M): test.append(k) k += 1 k = 0 for i in range(Q): num[k][0], num[k][1], num[k][2], num[k][3] = map(int,input().split()) k += 1 k = 0 score = 0 maxscore = 0 for list i...
import itertools N,M,Q = map(int,input().split()) num = [[0 for i in range(4)] for j in range(Q)] test = list() k = 1 for i in range(M): test.append(k) k += 1 k = 0 for i in range(Q): num[k][0], num[k][1], num[k][2], num[k][3] = map(int,input().split()) k += 1 k = 0 score = 0 maxscore = 0 for list i...
[["-", 0, 656, 0, 7, 12, 652, 63, 319, 319, 22], ["+", 0, 656, 0, 7, 12, 652, 63, 319, 319, 22]]
5
218
import itertools s=list(map(int,input().split())) t=[list(map(int,input().split())) for i in range(s[2])] li=[x for x in range(1,s[0]+1)] lity=list(itertools.combinations_with_replacement(li,s[0])) ans=0 for k in lity: vmax=0 for l in t: if k[l[1]-1]-k[l[0]-1]==l[2]: vmax+=l[3] ans=max(ans,vmax) print(a...
import itertools s=list(map(int,input().split())) t=[list(map(int,input().split())) for i in range(s[2])] li=[x for x in range(1,s[1]+1)] lity=list(itertools.combinations_with_replacement(li,s[0])) ans=0 for k in lity: vmax=0 for l in t: if k[l[1]-1]-k[l[0]-1]==l[2]: vmax+=l[3] ans=max(ans,vmax) print(a...
[["-", 12, 652, 3, 4, 0, 657, 31, 206, 206, 612], ["+", 12, 652, 3, 4, 0, 657, 31, 206, 206, 612]]
5
143
#include <bits/stdc++.h> using namespace std; vector<vector<int64_t>> generate(vector<int64_t>::iterator begin, vector<int64_t>::iterator end, int64_t s) { int64_t count = distance(begin, end); if (s == 1) { vector<vector<int64_t>> result; for (auto it = begin; it != end; +...
#include <bits/stdc++.h> using namespace std; vector<vector<int64_t>> generate(vector<int64_t>::iterator begin, vector<int64_t>::iterator end, int64_t s) { int64_t count = distance(begin, end); if (s == 1) { vector<vector<int64_t>> result; for (auto it = begin; it != end; +...
[["-", 49, 50, 51, 2, 3, 4, 0, 2, 63, 22], ["-", 51, 2, 3, 4, 0, 2, 3, 4, 0, 24], ["-", 51, 2, 3, 4, 0, 2, 3, 4, 0, 21], ["-", 51, 2, 3, 4, 0, 2, 3, 4, 0, 13], ["-", 51, 2, 3, 4, 0, 2, 3, 4, 0, 25]]
1
487
#include <iostream> using namespace std; typedef long long ll; #define MAXQ 50 int main() { cin.tie(NULL); ios::sync_with_stdio(false); int n, m, q; cin >> n >> m >> q; int a[MAXQ]; int b[MAXQ]; int c[MAXQ]; int d[MAXQ]; int A[92378][10]; int score = 0; int i; for (int p = 0; p < q; ++p)...
#include <iostream> using namespace std; typedef long long ll; #define MAXQ 50 int main() { cin.tie(NULL); ios::sync_with_stdio(false); int n, m, q; cin >> n >> m >> q; int a[MAXQ]; int b[MAXQ]; int c[MAXQ]; int d[MAXQ]; int A[92378][10]; int score = 0; int i; for (int p = 0; p < q; ++p)...
[["+", 31, 16, 31, 69, 341, 342, 0, 16, 17, 33], ["+", 31, 16, 31, 69, 341, 342, 0, 16, 12, 13], ["+", 31, 16, 12, 69, 341, 342, 0, 16, 17, 33], ["+", 31, 16, 12, 69, 341, 342, 0, 16, 12, 13]]
1
468
#include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <complex> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <numeric> #include <queue> #include <random> #include <set> #include <stack> #include <string> #include <time.h> #include ...
#include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <complex> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <numeric> #include <queue> #include <random> #include <set> #include <stack> #include <string> #include <time.h> #include ...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
607
#include <bits/stdc++.h> #define all(vec) vec.begin(), vec.end() #define pb push_back #define eb emplace_back #define fi first #define se second using namespace std; using ll = long long; using P = pair<ll, ll>; template <class T> using V = vector<T>; constexpr ll INF = (1LL << 30) - 1LL; constexpr ll MOD = 1e9 + 7; co...
#include <bits/stdc++.h> #define all(vec) vec.begin(), vec.end() #define pb push_back #define eb emplace_back #define fi first #define se second using namespace std; using ll = long long; using P = pair<ll, ll>; template <class T> using V = vector<T>; constexpr ll INF = (1LL << 30) - 1LL; constexpr ll MOD = 1e9 + 7; co...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
554
#include <bits/stdc++.h> #define int long long int using namespace std; int32_t main() { int a, b, n; cin >> a >> b >> n; if (n < b) { n = b - 1; cout << floor((a * n) / b); } else { int x = n; cout << floor((a * x) / b) - a * floor(x / b); } }
#include <bits/stdc++.h> #define int long long int using namespace std; int32_t main() { int a, b, n; cin >> a >> b >> n; if (n >= b) { n = b - 1; cout << floor((a * n) / b); } else { int x = n; cout << floor((a * x) / b) - a * floor(x / b); } }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
87
/* lib.cpp */ #include <algorithm> #include <bitset> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <deque> #include <iomanip> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <vector> #define overload4(_1, _2, _3, _4, name...
/* lib.cpp */ #include <algorithm> #include <bitset> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <deque> #include <iomanip> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <vector> #define overload4(_1, _2, _3, _4, name...
[["-", 12, 23, 0, 16, 31, 2, 3, 4, 0, 25], ["+", 31, 16, 12, 23, 0, 2, 3, 4, 0, 25]]
1
3,177
#include <cmath> #include <iostream> #include <map> #define ll long long using namespace std; int main() { ll a, b, n; cin >> a >> b >> n; ll M; if ((b - 1) > n) { M = floor((a * (n - 1)) / b) - a * floor((n - 1) / b); } else { M = floor((a * (b - 1)) / b) - a * floor((b - 1) / b); } cout << M; ...
#include <cmath> #include <iostream> #include <map> #define ll long long using namespace std; int main() { ll a, b, n; cin >> a >> b >> n; ll M; if ((b - 1) >= n) { M = floor((a * (n)) / b) - a * floor((n) / b); } else { M = floor((a * (b - 1)) / b) - a * floor((b - 1) / b); } cout << M; retur...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["-", 31, 23, 0, 16, 12, 23, 0, 16, 17, 33], ["-", 31, 23, 0, 16, 12, 23, 0, 16, 12, 13], ["-", 3, 4, 0, 16, 31, 23, 0, 16, 17, 33], ["-", 3, 4, 0, 16, 31, 23, 0, 16, 12, 13]]
1
119
#include <bits/stdc++.h> using namespace std; #define int long long signed main() { #ifdef LOCAL freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif int a, b, n; cin >> a >> b >> n; if (n - 1 >= b) { cout << a * (b - 1) / b - a * ((b - 1) / b); } else { cout << a * n / ...
#include <bits/stdc++.h> using namespace std; #define int long long signed main() { #ifdef LOCAL freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif int a, b, n; cin >> a >> b >> n; if (n >= b - 1) { cout << a * (b - 1) / b - a * ((b - 1) / b); } else { cout << a * n / ...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 33], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 33], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]]
1
115
#include <bits/stdc++.h> using namespace std; using ll = long long; const int inf = 1e9 + 7; const ll longinf = 5LL << 60; const ll mod = 1e9 + 7; int main() { ll A, B, N; cin >> A >> B >> N; ll tmp = min(N, B - 1); cout << (A * tmp) / B - A * (tmp / B) << "n"; }
#include <bits/stdc++.h> using namespace std; using ll = long long; const int inf = 1e9 + 7; const ll longinf = 5LL << 60; const ll mod = 1e9 + 7; int main() { ll A, B, N; cin >> A >> B >> N; ll tmp = min(N, B - 1); cout << (A * tmp) / B - A * (tmp / B) << "\n"; }
[["-", 8, 9, 0, 1, 0, 16, 12, 5, 0, 6], ["+", 8, 9, 0, 1, 0, 16, 12, 5, 0, 44]]
1
91
def main(): a, b, n = map(int, input().split()) x = min(b, n) floor1 = int(a * x / b) floor2 = int(x / b) print(floor1 - floor2) if __name__ == '__main__': main()
def main(): a, b, n = map(int, input().split()) x = min(b - 1, n) floor1 = int(a * x / b) floor2 = int(x / b) print(floor1 - floor2) if __name__ == '__main__': main()
[["+", 0, 662, 12, 652, 3, 4, 0, 657, 17, 33], ["+", 0, 662, 12, 652, 3, 4, 0, 657, 12, 612]]
5
65
a, b, n = map(int, input().split()) print(int((a*(max(n,b-1)%b)-(a*max(n,b-1))%b)/b))
a, b, n = map(int, input().split()) print(int((a*(min(n,b-1)%b)-(a*min(n,b-1))%b)/b))
[["-", 31, 657, 12, 23, 0, 657, 31, 652, 63, 22], ["+", 31, 657, 12, 23, 0, 657, 31, 652, 63, 22], ["-", 12, 657, 31, 23, 0, 657, 12, 652, 63, 22], ["+", 12, 657, 31, 23, 0, 657, 12, 652, 63, 22]]
5
57
A,B,N=map(int,input().split()) f=lambda x:(A*x)//B-A*(x//B) print(f(B-1 if B-1>=N else N))
A,B,N=map(int,input().split()) f=lambda x:(A*x)//B-A*(x//B) print(f(B-1 if B-1<=N else N))
[["-", 0, 652, 3, 4, 0, 41, 0, 666, 667, 20], ["+", 0, 652, 3, 4, 0, 41, 0, 666, 667, 19]]
5
55
a,b,n = map(int,input().split()) x=max(n,b-1) ans = (int(a*x/b) - a * int(x/b)) print(ans)
a,b,n = map(int,input().split()) x=min(n,b-1) ans = (int(a*x/b) - a * int(x/b)) print(ans)
[["-", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22]]
5
53
#include <algorithm> #include <cassert> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <random> #include <set> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; typedef long long int ll; const ll INF = 10000000000...
#include <algorithm> #include <cassert> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <random> #include <set> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; typedef long long int ll; const ll INF = 10000000000...
[["-", 75, 76, 0, 1, 0, 11, 12, 16, 31, 22], ["+", 75, 76, 0, 1, 0, 11, 12, 16, 31, 22]]
1
124
A,B,N=map(int,input().split()) if N<=B: print(int(((A*N)/B)-((A*N)/B)%1-A*(N/B-(N/B)%1))) else: print(int(((A*(B-1))/B)-((A*(B-1))/B)%1-A*((B-1)/B-((B-1)/B)%1)))
A,B,N=map(int,input().split()) if N<B: print(int(((A*N)/B)-((A*N)/B)%1-A*(N/B-(N/B)%1))) else: print(int(((A*(B-1))/B)-((A*(B-1))/B)%1-A*((B-1)/B-((B-1)/B)%1)))
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 19], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 18]]
5
127
///_________________________________ B I S M I L L A H I R R A H M A N I R R A ///H I M __________________________________________________ #include <bits/stdc++.h> using namespace std; typedef bool boo; typedef int li; typedef long il; typedef unsigned long ul; typedef long long int ll; typedef unsigned long long u...
///_________________________________ B I S M I L L A H I R R A H M A N I R R A ///H I M __________________________________________________ #include <bits/stdc++.h> using namespace std; typedef bool boo; typedef int li; typedef long il; typedef unsigned long ul; typedef long long int ll; typedef unsigned long long u...
[["+", 49, 50, 51, 2, 3, 4, 0, 16, 17, 33], ["+", 49, 50, 51, 2, 3, 4, 0, 16, 12, 13], ["-", 31, 23, 0, 16, 12, 23, 0, 16, 17, 33], ["-", 31, 23, 0, 16, 12, 23, 0, 16, 12, 13], ["-", 12, 23, 0, 16, 31, 23, 0, 16, 17, 33], ["-", 12, 23, 0, 16, 31, 23, 0, 16, 12, 13]]
1
377
def resolve(): A, B, N = list(map(int, input().split())) x = min(B, N) import math print(math.floor(A*x/B)) if '__main__' == __name__: resolve()
def resolve(): A, B, N = list(map(int, input().split())) x = min(B-1, N) import math print(math.floor(A*x/B)) if '__main__' == __name__: resolve()
[["+", 0, 662, 12, 652, 3, 4, 0, 657, 17, 33], ["+", 0, 662, 12, 652, 3, 4, 0, 657, 12, 612]]
5
59
import sys def input(): return sys.stdin.readline().rstrip() def main(): a,b,n=map(int, input().split()) if b<n: n=b-1 print(((a*n)//b) - (a*(n//b))) if __name__ == '__main__': main()
import sys def input(): return sys.stdin.readline().rstrip() def main(): a,b,n=map(int, input().split()) if b<=n: n=b-1 print(((a*n)//b) - (a*(n//b))) if __name__ == '__main__': main()
[["-", 0, 14, 8, 196, 0, 57, 15, 666, 667, 18], ["+", 0, 14, 8, 196, 0, 57, 15, 666, 667, 19]]
5
84
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll a, b, n; cin >> a >> b >> n; cout << a * max(b - 1, n) / b; return 0; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll a, b, n; cin >> a >> b >> n; cout << a * min(b - 1, n) / b; return 0; }
[["-", 0, 16, 12, 16, 31, 16, 12, 2, 63, 22], ["+", 0, 16, 12, 16, 31, 16, 12, 2, 63, 22]]
1
50
#include <algorithm> #include <bitset> #include <iostream> #include <map> #include <math.h> #include <numeric> #include <stack> #include <stdio.h> #include <string> #include <vector> //#include <bits/stdc++.h> using namespace std; typedef long long int lli; #define urept(soeji, start, n) for (int soeji = start; soeji <...
#include <algorithm> #include <bitset> #include <iostream> #include <map> #include <math.h> #include <numeric> #include <stack> #include <stdio.h> #include <string> #include <vector> //#include <bits/stdc++.h> using namespace std; typedef long long int lli; #define urept(soeji, start, n) for (int soeji = start; soeji <...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 33], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["-", 31, 23, 0, 16, 12, 23, 0, 16, 17, 33], ["-", 31, 23, 0, 16, 12, 23, 0, 16, 12, 13]]
1
196
A,B,N=map(int,input().split()) if N>B: print((A*N)//B-A*(N//B)) else: print((A*(B-1)//B-A*((B-1)//B)))
A,B,N=map(int,input().split()) if B>N: 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, 0, 22], ["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22]]
5
69
A, B, N = map(int, input().split()) x = min(B, N) ans = (A * x // B) - A * (x // B) print(ans)
A, B, N = map(int, input().split()) x = min(B-1, N) ans = (A * x // B) - A * (x // B) print(ans)
[["+", 0, 662, 12, 652, 3, 4, 0, 657, 17, 33], ["+", 0, 662, 12, 652, 3, 4, 0, 657, 12, 612]]
5
47
import math a, b, n = map(int, input().split()) x = min(b, n) ans = math.floor(a * x / b) - a * math.floor(x / b) print(ans)
import math a, b, n = map(int, input().split()) x = min(b - 1, n) ans = math.floor(a * x / b) - a * math.floor(x / b) print(ans)
[["+", 0, 662, 12, 652, 3, 4, 0, 657, 17, 33], ["+", 0, 662, 12, 652, 3, 4, 0, 657, 12, 612]]
5
55
a,b,n=map(int,input().split()) max=0 if b>=n: x=n ans=(a*x)//b -a*(x//b) else: x=b-1 ans=(a*x)//b -a*(x//b) print(ans)
# a,b,n=map(int,input().split()) # max=0 # for i in range(1,n+1): # if a%b*i%b<i%b: # ans=a*i//b -a*(i//b) # if max<ans: # max=ans # print(max) a,b,n=map(int,input().split()) max=0 if b>n: x=n ans=(a*x)//b -a*(x//b) else: x=b-1 ans=(a*x)//b -a*(x//b) print(ans)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47]]
5
74
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll a, b, n; cin >> a >> b >> n; cout << (a * min(n, b - 1)) / n << endl; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll a, b, n; cin >> a >> b >> n; cout << (a * min(n, b - 1)) / b << endl; }
[["-", 0, 1, 0, 16, 31, 16, 12, 16, 12, 22], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 22]]
1
51
A, B, N = map(int, input().split()) x = B-1 if B-1 > N else N-1 print(A*x//B-A*(x//B))
A, B, N = map(int, input().split()) x = N if B-1 > N else B-1 print(A*x//B-A*(x//B))
[["-", 0, 1, 0, 662, 12, 41, 0, 657, 31, 22], ["-", 0, 1, 0, 662, 12, 41, 0, 657, 17, 33], ["-", 0, 1, 0, 662, 12, 41, 0, 657, 12, 612], ["+", 0, 656, 0, 1, 0, 662, 12, 41, 0, 22], ["+", 0, 1, 0, 662, 12, 41, 0, 657, 31, 22]]
5
49
#include <iostream> #include <vector> #define rep(i, n) for (int(i) = 0; (i) < (n); (i)++) using namespace std; int main() { long long int a, b, n; cin >> a >> b >> n; long long int x; if (b < n) x = b; else x = n; cout << a * x / b << endl; return 0; }
#include <iostream> #include <vector> #define rep(i, n) for (int(i) = 0; (i) < (n); (i)++) using namespace std; int main() { long long int a, b, n; cin >> a >> b >> n; long long int x; if (b - 1 <= n) x = b - 1; else x = n; cout << a * x / b << endl; return 0; }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 33], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 0, 57, 64, 1, 0, 11, 12, 16, 17, 33], ["+", 0, 57, 64, 1, 0, 11, 12, 16, 12, 13]]
1
72
#include <iostream> using namespace std; int main() { long long a, b, n; cin >> a >> b >> n; if (n >= b) cout << a * (b - 1) << endl; else cout << a * n << endl; }
#include <iostream> using namespace std; int main() { long long a, b, n; cin >> a >> b >> n; if (n >= b) cout << a * (b - 1) / b << endl; else cout << a * n / b << endl; // n < b }
[["+", 64, 1, 0, 16, 31, 16, 12, 16, 17, 85], ["+", 64, 1, 0, 16, 31, 16, 12, 16, 12, 22], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 85], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 22]]
1
55
// 問題の URL を書いておく // #include <algorithm> #include <array> #include <bitset> #include <cmath> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <vector> using namespace std; //#define ENABLE_PRINT #if defined(ENABLE_PRINT) #define Print(v) ...
// 問題の URL を書いておく // #include <algorithm> #include <array> #include <bitset> #include <cmath> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <vector> using namespace std; //#define ENABLE_PRINT #if defined(ENABLE_PRINT) #define Print(v) ...
[["-", 36, 36, 0, 30, 0, 360, 39, 77, 39, 40], ["+", 36, 36, 0, 30, 0, 360, 39, 77, 39, 40], ["+", 8, 9, 0, 43, 49, 50, 51, 2, 63, 22], ["+", 0, 43, 49, 50, 51, 2, 3, 4, 0, 24], ["+", 0, 43, 49, 50, 51, 2, 3, 4, 0, 21], ["+", 0, 43, 49, 50, 51, 2, 3, 4, 0, 22], ["+", 0, 43, 49, 50, 51, 2, 3, 4, 0, 25]]
1
193
a,b,n = map(int, input().split()) if n<=b-1: x=n else: x=b print((a*x)//b)
a,b,n = map(int, input().split()) if n<b-1: x=n else: x=b-1 print((a*x)//b)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 19], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 18], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 17, 33], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 12, 612]]
5
43
#include <algorithm> #include <bitset> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <memory> #include <queue> #inc...
#include <algorithm> #include <bitset> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <memory> #include <queue> #inc...
[["+", 31, 16, 12, 16, 12, 16, 31, 23, 0, 24], ["+", 12, 16, 31, 23, 0, 16, 31, 16, 17, 72], ["+", 12, 16, 31, 23, 0, 16, 31, 16, 12, 22], ["+", 12, 16, 12, 16, 31, 23, 0, 16, 17, 33], ["+", 12, 16, 12, 16, 31, 23, 0, 16, 12, 13], ["+", 31, 16, 12, 16, 12, 16, 31, 23, 0, 25]]
1
1,602
#include <bits/stdc++.h> #define int long long #define rep(i, n) for (int i = 0; i < (int)n; i++) #define repa(i, s, n) for (int i = s; i < (int)n; i++) using namespace std; using ll = long long; typedef vector<int> vi; typedef pair<int, int> P; #define rrep(i, a, b) for (int i = a; i >= b; i--) signed main() { int ...
#include <bits/stdc++.h> #define int long long #define rep(i, n) for (int i = 0; i < (int)n; i++) #define repa(i, s, n) for (int i = s; i < (int)n; i++) using namespace std; using ll = long long; typedef vector<int> vi; typedef pair<int, int> P; #define rrep(i, a, b) for (int i = a; i >= b; i--) signed main() { int ...
[["-", 0, 43, 49, 50, 51, 2, 3, 4, 0, 22], ["+", 0, 43, 49, 50, 51, 2, 3, 4, 0, 22]]
1
112
#include <bits/stdc++.h> #include <iostream> using namespace std; #define int long long #define double long double #define endl "\n" #define pb push_back #define PI 3.1415926535897932384626433832795l #define F first #define S second #define mp make_pair #define f(i, n) for (int i = 0; i < n; i++) #define fastio ...
#include <bits/stdc++.h> #include <iostream> using namespace std; #define int long long #define double long double #define endl "\n" #define pb push_back #define PI 3.1415926535897932384626433832795l #define F first #define S second #define mp make_pair #define f(i, n) for (int i = 0; i < n; i++) #define fastio ...
[["-", 31, 23, 0, 16, 12, 23, 0, 16, 17, 33], ["-", 31, 23, 0, 16, 12, 23, 0, 16, 12, 13]]
1
198
#include <bits/stdc++.h> using namespace std; typedef long long LL; typedef pair<LL, LL> PII; // chmax, chmin template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; } retur...
#include <bits/stdc++.h> using namespace std; typedef long long LL; typedef pair<LL, LL> PII; // chmax, chmin template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; } retur...
[["+", 0, 14, 8, 9, 0, 57, 75, 76, 0, 95]]
1
600
// Mahir Ratanpara (DA-IICT) #include <bits/stdc++.h> using namespace std; #define Ff(i, a, n) for (i = a; i < n; i++) #define Fr(i, a, n) for (i = a; i > n; i--) #define ll long long #define FAST ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0); #define pb push_back #define mp make_pair #define ff first #defi...
// Mahir Ratanpara (DA-IICT) #include <bits/stdc++.h> using namespace std; #define Ff(i, a, n) for (i = a; i < n; i++) #define Fr(i, a, n) for (i = a; i > n; i--) #define ll long long #define FAST ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0); #define pb push_back #define mp make_pair #define ff first #defi...
[["+", 75, 76, 0, 9, 0, 1, 0, 11, 31, 22], ["+", 75, 76, 0, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 9, 0, 1, 0, 11, 12, 16, 31, 22], ["+", 0, 9, 0, 1, 0, 11, 12, 16, 17, 33], ["+", 0, 9, 0, 1, 0, 11, 12, 16, 12, 13], ["+", 0, 57, 75, 76, 0, 9, 0, 1, 0, 35]]
1
419
/*BISMILLAH THE WHITE WOLF NO DREAM IS TOO BIG AND NO DREAMER IS TOO SMALL*/ #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<int, int> pii; typedef vector<long long> vll; typedef vector<int> vi; #define io ios_base::sync_with_stdio(false) #define pb pus...
/*BISMILLAH THE WHITE WOLF NO DREAM IS TOO BIG AND NO DREAMER IS TOO SMALL*/ #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<int, int> pii; typedef vector<long long> vll; typedef vector<int> vi; #define io ios_base::sync_with_stdio(false) #define pb pus...
[["-", 8, 9, 0, 43, 49, 50, 51, 2, 63, 22], ["+", 8, 9, 0, 43, 49, 50, 51, 2, 63, 22]]
1
201
#include <iostream> #include <math.h> using namespace std; typedef long long ll; int main() { ll a, b, n; cin >> a >> b >> n; ll m; if (n < b) { m = n; } else { m = b; } ll ans = m * a / b; cout << ans; return 0; }
#include <iostream> #include <math.h> using namespace std; typedef long long ll; int main() { ll a, b, n; cin >> a >> b >> n; ll m; if (n < b) { m = n; } else { m = b - 1; } ll ans = m * a / b; cout << ans; return 0; }
[["+", 0, 9, 0, 1, 0, 11, 12, 16, 17, 33], ["+", 0, 9, 0, 1, 0, 11, 12, 16, 12, 13]]
1
72
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define printVec(v) \ printf("{"); \ for (const auto &i : v) { \ ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define printVec(v) \ printf("{"); \ for (const auto &i : v) { \ ...
[["+", 0, 9, 0, 1, 0, 11, 12, 16, 17, 33], ["+", 0, 9, 0, 1, 0, 11, 12, 16, 12, 13]]
1
188
#include <bits/stdc++.h> using namespace std; #define ALL(v) v.begin(), v.end() #define V vector #define P pair typedef long double ld; typedef long long ll; const int MOD = 1000000007; const int IINF = INT_MAX; const ll INF = 1LL << 60; int main() { ll a, b, n; cin >> a >> b >> n; if (n < b) { cout << (a *...
#include <bits/stdc++.h> using namespace std; #define ALL(v) v.begin(), v.end() #define V vector #define P pair typedef long double ld; typedef long long ll; const int MOD = 1000000007; const int IINF = INT_MAX; const ll INF = 1LL << 60; int main() { ll a, b, n; cin >> a >> b >> n; if (n < b) { cout << (a *...
[["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 85], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 22]]
1
109
#include <functional> #include <stdio.h> using namespace std; typedef long long llong; #define MAX const llong mod = 1000000000 + 7; int main() { llong A, B, N; scanf("%lld &lld %lld", &A, &B, &N); llong x = min(B - 1, N); printf("%lld\n", (A * x) / B); return 0; }
#include <functional> #include <stdio.h> using namespace std; typedef long long llong; #define MAX const llong mod = 1000000000 + 7; int main() { llong A, B, N; scanf("%lld %lld %lld", &A, &B, &N); llong x = min(B - 1, N); printf("%lld\n", (A * x) / B); return 0; }
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
83
A,B,N=map(int,input().split()) if B>N: print(A*N//B) else: print(A*(B-1)*N)
A,B,N=map(int,input().split()) if B>N: print(A*N//B) else: print(A*(B-1)//B)
[["-", 0, 1, 0, 652, 3, 4, 0, 657, 17, 48], ["-", 0, 1, 0, 652, 3, 4, 0, 657, 12, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 676], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 12, 22]]
5
45
A, B, N = map(int, input().split()) x = min(N,B-1) return A*x//B-A*(x//B)
A, B, N = map(int, input().split()) x = min(N,B-1) print(A*x//B-A*(x//B))
[["-", 36, 36, 36, 36, 0, 656, 0, 37, 0, 38], ["+", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 3, 4, 0, 657, 12, 657, 12, 23, 0, 25]]
5
42
A, B, N = map(int, input().split()) x = max(N, B-1) print((A*x//B) - A*(x//B))
A, B, N = map(int, input().split()) x = min(N, B-1) print((A*x//B) - A*(x//B))
[["-", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22]]
5
46
a,b,n = map(int,input().split()) if b < n: k = b-1 else: k = n m = int(k*a/b) - a*int(k/b) print(m)
a,b,n = map(int,input().split()) if b <= n: k = b-1 else: k = n m = int(k*a/b) - a*int(k/b) print(m)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 18], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 19]]
5
56
#include <cmath> #include <iostream> #include <vector> using namespace std; typedef long long ll; int main() { ll A, B, N; cin >> A >> B >> N; ll ans = 0; if (B == 1) { ans = 0; } else if (N <= B) { ll a = floor(A * N / B); ll b = floor(N / B); ans = a - A * b; } else { ll a = floor(...
#include <cmath> #include <iostream> #include <vector> using namespace std; typedef long long ll; int main() { ll A, B, N; cin >> A >> B >> N; ll ans = 0; if (B == 1) { ans = 0; } else if (N < B) { ll a = floor(A * N / B); ll b = floor(N / B); ans = a - A * b; } else { ll a = floor(A ...
[["-", 75, 76, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 75, 76, 0, 57, 15, 339, 51, 16, 17, 18]]
1
140
import sys input = sys.stdin.readline from math import floor A, B, N = map(int, input().split()) if N<=B: print(floor(A/B*N)) else: print(floor(A/B*(B-1)))
import sys input = sys.stdin.readline from math import floor A, B, N = map(int, input().split()) if N<B: print(floor(A/B*N)) else: print(floor(A/B*(B-1)))
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 19], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 18]]
5
64
a, b, n = map(int,input().split()) x = min(n,b-1) print(int(b*(x%b) / b))
a, b, n = map(int,input().split()) x = min(n,b-1) print(int(a*(x%b) / b))
[["-", 0, 652, 3, 4, 0, 657, 31, 657, 31, 22], ["+", 0, 652, 3, 4, 0, 657, 31, 657, 31, 22]]
5
43
a, b, n = map(int, input().split()) c = int(a*n/b) - a*int(n/b) if n < b: print(c) else: c = int(a*(n-1)/b) - a*int((n-1)/b) print(c)
a, b, n = map(int, input().split()) c = int(a*n/b) - a*int(n/b) if n < b: print(c) else: c = int(a*(b-1)/b) - a*int((b-1)/b) print(c)
[["-", 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
79
#include <bits/stdc++.h> using namespace std; typedef long long ll; int mod = 1e9 + 7; ll p = 5e5 + 100; int main() { vector<ll> com(p + 1); vector<ll> inv(p + 1); vector<ll> mul(p + 1); com[0] = 1; for (ll i = 1; i <= p; ++i) { com[i] = (com[i - 1] * i) % mod; } inv[0] = 1; inv[1] = 1; for (ll...
#include <bits/stdc++.h> using namespace std; typedef long long ll; int mod = 1e9 + 7; ll p = 5e5 + 100; int main() { vector<ll> com(p + 1); vector<ll> inv(p + 1); vector<ll> mul(p + 1); com[0] = 1; for (ll i = 1; i <= p; ++i) { com[i] = (com[i - 1] * i) % mod; } inv[0] = 1; inv[1] = 1; for (ll...
[["+", 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
246
import sys sys.stdin.readline A, B, N = map(int, input().split()) ans = 0 if N >= B: ans = B-1 else: ans = N print(A * N //B)
import sys sys.stdin.readline A, B, N = map(int, input().split()) ans = 0 if N >= B: ans = B-1 else: ans = N print(A * ans //B)
[["-", 0, 652, 3, 4, 0, 657, 31, 657, 12, 22], ["+", 0, 652, 3, 4, 0, 657, 31, 657, 12, 22]]
5
51
a,b,n=map(int,input().split()) if n>=b: x=b-1 fl1=a*x//b fl2=a*(x//b) else: fl1=a*(n//b) fl2=a*(n//b) ans = fl1-fl2 print(ans)
a,b,n=map(int,input().split()) if n>=b: x=b-1 fl1=a*x//b fl2=a*(x//b) else: fl1=a*n//b fl2=a*(n//b) ans = fl1-fl2 print(ans)
[["-", 0, 1, 0, 662, 12, 657, 12, 23, 0, 24], ["-", 0, 1, 0, 662, 12, 657, 12, 23, 0, 25]]
5
73
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> P; ll a, b, n; ll func(ll x) { ll num1 = a * x; ll num2 = x / b; ll num3 = num1 / b; ll num4 = num2 * a; return num3 - num4; } int main() { cin >> a >> b >> n; cout << func(min(b, n - 1)) << endl; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> P; ll a, b, n; ll func(ll x) { ll num1 = a * x; ll num2 = x / b; ll num3 = num1 / b; ll num4 = num2 * a; return num3 - num4; } int main() { cin >> a >> b >> n; cout << func(min(b - 1, n)) << endl; }
[["-", 12, 2, 3, 4, 0, 2, 3, 4, 0, 21], ["-", 3, 4, 0, 2, 3, 4, 0, 16, 31, 22], ["+", 12, 2, 3, 4, 0, 2, 3, 4, 0, 21], ["+", 12, 2, 3, 4, 0, 2, 3, 4, 0, 22]]
1
98
#include <bits/stdc++.h> #define ll long long #define ld long double #define fs first #define sc second #define task "tst" using namespace std; const ll N = 5e3 + 9; const ll inf = 1e9 + 7; typedef pair<ll, ll> LL; ll a, b, n; ll cal(ll x) { return floor((ld)(a * x) / b) - a * floor((ld)x / b); } int main() { ios_ba...
#include <bits/stdc++.h> #define ll long long #define ld long double #define fs first #define sc second #define task "tst" using namespace std; const ll N = 5e3 + 9; const ll inf = 1e9 + 7; typedef pair<ll, ll> LL; ll a, b, n; ll cal(ll x) { return floor((ld)(a * x) / b) - a * floor((ld)x / b); } int main() { ios_ba...
[["+", 49, 50, 51, 2, 3, 4, 0, 16, 17, 33], ["+", 49, 50, 51, 2, 3, 4, 0, 16, 12, 13]]
1
171
A, B, N = list(map(int,input().split())) def f(x): return math.floor(A * x / B) - A * math.floor(x / B) if B - 1 <= N: ans = f(B - 1) else: ans = f(N) print(ans)
import math A, B, N = list(map(int,input().split())) def f(x): return math.floor(A * x / B) - A * math.floor(x / B) if B - 1 <= N: ans = f(B - 1) else: ans = f(N) print(ans)
[["+", 36, 36, 36, 36, 0, 656, 0, 596, 0, 487], ["+", 36, 36, 0, 656, 0, 596, 141, 673, 0, 22]]
5
76
a, b, n = [int(x) for x in input().split()] def f(x): return a*x//b - a *(x//b) print(f(min(b, n - 1)))
a, b, n = [int(x) for x in input().split()] def f(x): return a*x//b - a *(x//b) print(f(min(b - 1, n)))
[["-", 0, 652, 3, 4, 0, 652, 3, 4, 0, 21], ["-", 3, 4, 0, 652, 3, 4, 0, 657, 31, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 21], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 22]]
5
56
import math A, B, N = map(int, input().split()) if B > N: x = N else: x = B print(math.floor(A * x / B) - A * math.floor(x/B))
import math A, B, N = map(int, input().split()) if B > N: x = N else: x = B - 1 print(math.floor(A * x / B) - A * math.floor(x/B))
[["+", 8, 196, 0, 1, 0, 662, 12, 657, 17, 33], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 12, 612]]
5
57
import math import collections def f(a,b,x): return math.floor((a*x)/b) - a*math.floor(x/b) a,b,n=map(int, input().split()) dd = collections.defaultdict(int) print(f(a,b,min(b-1,x)))
import math import collections def f(a,b,x): return math.floor((a*x)/b) - a*math.floor(x/b) a,b,n=map(int, input().split()) dd = collections.defaultdict(int) print(f(a,b,min(b-1,n)))
[["-", 0, 652, 3, 4, 0, 652, 3, 4, 0, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 22]]
5
82
import math a, b, n = map(int,input().split()) # N = int(input()) # al = list(map(int,input().split())) lst = [] if b >= n: x = n else: x = b-1 ans = math.floor(a * x / b) - a * math.floor(x / b) print(ans)
import math a, b, n = map(int,input().split()) # N = int(input()) # al = list(map(int,input().split())) lst = [] if b > n: x = n else: x = b-1 ans = math.floor(a * x / b) - a * math.floor(x / b) print(ans)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47]]
5
68
#define _GLIBCXX_DEBUG #include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) #define all(v) v.begin(), v.end() #define dec(n) cout << fixed << setprecision(n); using namespace std; using ll = long long; using P = pair<ll, ll>; using vl = vector<ll>; using vvl = vector<vl>; ll gcd(ll a, ll b) { if ...
#define _GLIBCXX_DEBUG #include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) #define all(v) v.begin(), v.end() #define dec(n) cout << fixed << setprecision(n); using namespace std; using ll = long long; using P = pair<ll, ll>; using vl = vector<ll>; using vvl = vector<vl>; ll gcd(ll a, ll b) { if ...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 72], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]]
1
203
#include <bits/stdc++.h> #define ll long long using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); ll a, b, n; cin >> a >> b >> n; ll x = b - 1; if (x > n) x = n - 1; ll ans = a * x; ans /= b; ans -= a * (x / b); cout << ans << endl; return 0; }
#include <bits/stdc++.h> #define ll long long using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); ll a, b, n; cin >> a >> b >> n; ll x = b - 1; if (x > n) x = n; ll ans = a * x; ans /= b; ans -= a * (x / b); cout << ans << endl; return 0; }
[["-", 0, 57, 64, 1, 0, 11, 12, 16, 17, 33], ["-", 0, 57, 64, 1, 0, 11, 12, 16, 12, 13]]
1
93
import sys import math def IL(): return map(int,sys.stdin.readline().rstrip().split()) def Main(): a,b,n = IL() x = min(b,n) print(math.floor(a*x/b)-a*math.floor(x/b)) return if __name__=='__main__': Main()
import sys import math def IL(): return map(int,sys.stdin.readline().rstrip().split()) def Main(): a,b,n = IL() x = min(b-1,n) print(math.floor(a*x/b)-a*math.floor(x/b)) return if __name__=='__main__': Main()
[["+", 0, 662, 12, 652, 3, 4, 0, 657, 17, 33], ["+", 0, 662, 12, 652, 3, 4, 0, 657, 12, 612]]
5
87
#include <bits/stdc++.h> #define int unsigned long long #pragma GCC optimize("O3,Ofast,no-stack-protector,unroll-loops,fast-math") #pragma GCC target("avx,avx2,sse") using namespace std; int calc(int a, int b, int x) { return ((a * x) / b) - (a * (x / b)); } signed main() { ios_base::sync_with_stdio(false); cin.t...
#include <bits/stdc++.h> #define int long long #pragma GCC optimize("O3,Ofast,no-stack-protector,unroll-loops,fast-math") #pragma GCC target("avx,avx2,sse") using namespace std; int calc(int a, int b, int x) { return ((a * x) / b) - (a * (x / b)); } signed main() { ios_base::sync_with_stdio(false); cin.tie(0); ...
[["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 31, 16, 12, 2, 3, 4, 0, 2, 63, 22], ["+", 12, 2, 3, 4, 0, 2, 3, 4, 0, 24], ["+", 12, 2, 3, 4, 0, 2, 3, 4, 0, 22], ["+", 12, 2, 3, 4, 0, 2, 3, 4, 0, 21], ["+", 12, 2, 3, 4, 0, 2, 3, 4, 0, 25]]
1
115
a,b,n=map(int,input().split()) def f(a,b,x): return (a*x)//b - a*(x//b) print(f(min(b-1,n)))
a,b,n=map(int,input().split()) def f(x): return (a*x)//b - a*(x//b) print(f(min(b-1,n)))
[["-", 36, 36, 0, 656, 0, 14, 54, 54, 0, 22], ["-", 36, 36, 0, 656, 0, 14, 54, 54, 0, 21]]
5
58
// BISMILLAH #include <bits/stdc++.h> using namespace std; #define ll long long int main() { ll a, b, n, x, flag = 0, res, choto, boro, lower; cin >> a >> b >> n; if (n < b) // ei x er jonnoi max value pabo, eitai x er amon man j b er kacher // choto value { cout << floor(a * n / b) - a * floor...
// BISMILLAH #include <bits/stdc++.h> using namespace std; #define ll long long int main() { ll a, b, n, x, flag = 0, res, choto, boro, lower; cin >> a >> b >> n; if (n < b - 1) // ei x er jonnoi max value pabo, eitai x er amon man j b er // kacher choto value { cout << floor(a * n / b) - a...
[["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 33], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 33], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13]]
1
143
from math import floor def main(): A, B, N = map(int, input().split()) x = max(B - 1, N) print(floor(A*x/B) - A*floor(x/B)) if __name__ == "__main__": main()
from math import floor def main(): A, B, N = map(int, input().split()) x = min(B - 1, N) print(floor(A*x/B) - A*floor(x/B)) if __name__ == "__main__": main()
[["-", 8, 196, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 8, 196, 0, 1, 0, 662, 12, 652, 63, 22]]
5
67
#include <algorithm> #include <bitset> #include <cassert> #include <cfloat> #include <cmath> #include <cstdio> #include <cstring> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <limits.h> #include <list> #include <map> #include <math.h> #include <numeric> #incl...
#include <algorithm> #include <bitset> #include <cassert> #include <cfloat> #include <cmath> #include <cstdio> #include <cstring> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <limits.h> #include <list> #include <map> #include <math.h> #include <numeric> #incl...
[["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 33], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["+", 0, 57, 64, 1, 0, 11, 12, 16, 17, 33], ["+", 0, 57, 64, 1, 0, 11, 12, 16, 12, 13]]
1
1,525
import math A,B,N = [int(x) for x in input().split(' ')] if N/B >= 1: print(int(A-math.floor(-float(A)/float(B)))) else: print(int(math.floor(float(N)*float(A)/float(B))))
import math A,B,N = [int(x) for x in input().split(' ')] if N/B >= 1: print(int(A+math.floor(-float(A)/float(B)))) else: print(int(math.floor(float(N)*float(A)/float(B))))
[["-", 3, 4, 0, 652, 3, 4, 0, 657, 17, 33], ["+", 3, 4, 0, 652, 3, 4, 0, 657, 17, 72]]
5
84
#include <stdio.h> int main(void) { long long a, b, n, x; scanf("%lld %lld %lld", &a, &b, &n); if (b != n) { x = n; } else { x = n - 1; } printf("%lld\n", ((a * x) / b) - (a * (x / b))); return 0; }
#include <stdio.h> int main(void) { long long a, b, n, x; scanf("%lld %lld %lld", &a, &b, &n); if (b > n) { x = n; } else { x = b - 1; } printf("%lld\n", ((a * x) / b) - (a * (x / b))); return 0; }
[["-", 8, 9, 0, 57, 15, 23, 0, 16, 17, 79], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 17, 47], ["-", 0, 9, 0, 1, 0, 11, 12, 16, 31, 22], ["+", 0, 9, 0, 1, 0, 11, 12, 16, 31, 22]]
0
87
import math A, B, N = map(int,input().split(' ')) def f(x): return math.floor(A*x/B)-A*math.floor(x/B) def main(): if N > B: print(f(B-1)) else: print(f(N)) if __name__ == "__main__": main()
import math A, B, N = map(int,input().split(' ')) def f(x): return math.floor(A*x/B)-A*math.floor(x/B) def main(): if N >= B: print(f(B-1)) else: print(f(N)) if __name__ == "__main__": main()
[["-", 0, 14, 8, 196, 0, 57, 15, 666, 667, 47], ["+", 0, 14, 8, 196, 0, 57, 15, 666, 667, 20]]
5
89
#include <iostream> #include <vector> int main() { int64_t A, B, N; std::cin >> A >> B >> N; auto maxX = std::min(B, N); std::cout << (A * maxX / B) - A * (maxX / B) << std::endl; }
#include <iostream> #include <vector> int main() { int64_t A, B, N; std::cin >> A >> B >> N; auto maxX = std::min(B - 1, N); std::cout << (A * maxX / B) - A * (maxX / B) << std::endl; }
[["+", 49, 50, 51, 2, 3, 4, 0, 16, 17, 33], ["+", 49, 50, 51, 2, 3, 4, 0, 16, 12, 13]]
1
63
function Main(input) { input = input.split(' ').map(x => BigInt(x)); var a = input[0]; var b = input[1]; var n = input[2]; if (b == 1) { var max = a * n } else if (n < b) { var max = a * n / b - a * (n / b); } else { var border = (n + 1n) / b; var t = 1n; var max = 0n; for (let t =...
function Main(input) { input = input.split(' ').map(x => BigInt(x)); var a = input[0]; var b = input[1]; var n = input[2]; if (b == 1) { var max = 0n; } else if (n < b) { var max = a * n / b - a * (n / b); } else { var border = (n + 1n) / b; var t = 1n; var max = 0n; for (let t = 1...
[["-", 64, 556, 0, 198, 0, 200, 51, 16, 31, 22], ["-", 64, 556, 0, 198, 0, 200, 51, 16, 17, 48], ["-", 64, 556, 0, 198, 0, 200, 51, 16, 12, 22], ["+", 0, 57, 64, 556, 0, 198, 0, 200, 51, 555], ["+", 8, 556, 0, 57, 64, 556, 0, 198, 0, 35]]
2
204
#include <bits/stdc++.h> #define PI 3.14159265359 #define rep(i, a, n) for (int i = a; i < (int)n; ++i) #define SZ(x) ((int)(x).size()) // size() unsigned -> int #define descSort(a) sort(a.begin(), a.end(), std::greater<int>()) using namespace std; typedef long long ll; const ll INF = 1e9 + 7; ll gcd(ll x, ll y) { ...
#include <bits/stdc++.h> #define PI 3.14159265359 #define rep(i, a, n) for (int i = a; i < (int)n; ++i) #define SZ(x) ((int)(x).size()) // size() unsigned -> int #define descSort(a) sort(a.begin(), a.end(), std::greater<int>()) using namespace std; typedef long long ll; const ll INF = 1e9 + 7; ll gcd(ll x, ll y) { ...
[["+", 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
156
import sys import itertools if sys.platform =='ios': sys.stdin=open('input_file.txt') a,b,n=map(int,input().split()) cnt=0 if n//b>0: print(a*(b-1)//b-a*((b-1)//b)) else: print(a*(n-1)//b-a*((n-1)//b))
import sys import itertools if sys.platform =='ios': sys.stdin=open('input_file.txt') a,b,n=map(int,input().split()) cnt=0 if n//b>0: print(a*(b-1)//b-a*((b-1)//b)) else: print(a*(n)//b-a*((n)//b))
[["-", 31, 657, 31, 657, 12, 23, 0, 657, 17, 33], ["-", 31, 657, 31, 657, 12, 23, 0, 657, 12, 612], ["-", 12, 23, 0, 657, 31, 23, 0, 657, 17, 33], ["-", 12, 23, 0, 657, 31, 23, 0, 657, 12, 612]]
5
101
#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; int main() { long long int a, b, n, x, q; double s; cin >> a >> b >> n; (n > b ? x = b - 1 : x = n); q = floor((a * x) / b) - a * (floor(x / b)); cout << q; }
#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; int main() { long long int a, b, n, x, q; cin >> a >> b >> n; (n >= b ? x = b - 1 : x = n); q = floor((a * x) / b) - a * (floor(x / b)); cout << q; }
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["-", 0, 1, 0, 23, 0, 41, 15, 16, 17, 47], ["+", 0, 1, 0, 23, 0, 41, 15, 16, 17, 20]]
1
82
A, B, N = map(int, input().split()) x = min(B - 1, N) ans = int(a * x / b) print(ans)
A, B, N = map(int, input().split()) x = min(B - 1, N) ans = int(A * x / B) print(ans)
[["-", 12, 652, 3, 4, 0, 657, 31, 657, 31, 22], ["+", 12, 652, 3, 4, 0, 657, 31, 657, 31, 22], ["-", 0, 662, 12, 652, 3, 4, 0, 657, 12, 22], ["+", 0, 662, 12, 652, 3, 4, 0, 657, 12, 22]]
5
42
# N>=x>=0 # return max(floor(A*x/B)-A*floor(x/B)) # floor(t) は実数t以下の最大の整数 # x = Nの時が最大 # x/Bが一の直前になるようにとってみる A, B, N = [int(i) for i in input().split()] x = 0 if N > B: x = B-1 else: x = N y = (A * x)// B - A * (x//B) print(y)
# N>=x>=0 # return max(floor(A*x/B)-A*floor(x/B)) # floor(t) は実数t以下の最大の整数 # x = Nの時が最大 # x/Bが一の直前になるようにとってみる A, B, N = [int(i) for i in input().split()] x = 0 if N >= B: x = B-1 else: x = N y = (A * x)// B - A * (x//B) print(y)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20]]
5
66
A, B, N = [int(i) for i in input().split(' ')] if B > N: x = N else: X = B - 1 m = int(A * x / B) - A * int(x / B) print(m)
A, B, N = [int(i) for i in input().split(' ')] if B > N: x = N else: x = B - 1 m = int(A * x / B) - A * int(x / B) print(m)
[["-", 75, 76, 8, 196, 0, 1, 0, 662, 31, 22], ["+", 75, 76, 8, 196, 0, 1, 0, 662, 31, 22]]
5
63
package main import ( "fmt" ) func main() { var a, b, n int fmt.Scanf("%d %d %d", &a, &b, &n) answer := maxFloor(a, b, n) fmt.Println(answer) } func maxFloor(a, b, n int) int { if n/b > 1 { return floor(a, b, b-1) } return floor(a, b, n) // m := min(b-1, n) // return floor(a, b, m) } func floor(a, b, x ...
package main import ( "fmt" ) func main() { var a, b, n int fmt.Scanf("%d %d %d", &a, &b, &n) answer := maxFloor(a, b, n) fmt.Println(answer) } func maxFloor(a, b, n int) int { if n/b >= 1 { return floor(a, b, b-1) } return floor(a, b, n) // m := min(b-1, n) // return floor(a, b, m) } func floor(a, b, x...
[["-", 0, 435, 8, 196, 0, 57, 15, 16, 17, 47], ["+", 0, 435, 8, 196, 0, 57, 15, 16, 17, 20]]
7
171