buggy_code
stringlengths
11
625k
fixed_code
stringlengths
17
625k
bug_type
stringlengths
2
4.45k
language
int64
0
8
token_count
int64
5
200k
a, b, n = map(int, input().split()) if n >= b: x = b - 7 else: x = n d1 = a*x // b d2 = x // b res = d1 - (a * d2) print(res)
a, b, n = map(int, input().split()) if n >= b: x = b - 1 else: x = n d1 = a*x // b d2 = x // b res = d1 - (a * d2) print(res)
[["-", 64, 196, 0, 1, 0, 662, 12, 657, 12, 612], ["+", 64, 196, 0, 1, 0, 662, 12, 657, 12, 612]]
5
58
/*input 1 1 */ /* ______________ | ) | ) / |______/ ...
/*input 1 1 */ /* ______________ | ) | ) / |______/ ...
[["+", 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], ["+", 3, 4, 0, 2, 3, 4, 0, 16, 31, 22], ["+", 51, 2, 3, 4, 0, 2, 3, 4, 0, 25]]
1
616
A, B, N = map(int,input().split()) if N >= B: print(A * (B - 1) // B - A * (B - 1) // B) else: print(A * N // B - A * (N // B))
A, B, N = map(int,input().split()) if N >= B - 1: print(A * (B - 1) // B - A * ((B - 1) // B)) else: print(A * N // B - A * (N // B))
[["+", 0, 656, 0, 57, 15, 666, 0, 657, 17, 33], ["+", 0, 656, 0, 57, 15, 666, 0, 657, 12, 612], ["+", 3, 4, 0, 657, 12, 657, 12, 23, 0, 24], ["+", 3, 4, 0, 657, 12, 657, 12, 23, 0, 25]]
5
63
A, B, N = map(int, input().split()) if N < B: ans = A * N // B - N // B * A else: ans = A * (B-1) // B - B-1 // B * A print(ans)
A, B, N = map(int, input().split()) if N < B: ans = A * N // B - N // B * A else: ans = A * (B-1) // B - (B-1) // B * A print(ans)
[["+", 12, 657, 12, 657, 31, 657, 31, 23, 0, 24], ["+", 12, 657, 12, 657, 31, 657, 31, 23, 0, 25]]
5
61
#include <bits/stdc++.h> using namespace std; #define int long long #define double long double #define SZ(x) ((int)(x).size()) #define rep(i, n) for (int i = 0; i < (n); ++i) #define fore(i, a) for (auto &i : a) #define min(...) min({__VA_ARGS__}) #define max(...) max({__VA_ARGS__}) #define Yes cout << "Yes" << endl; #...
#include <bits/stdc++.h> using namespace std; #define int long long #define double long double #define SZ(x) ((int)(x).size()) #define rep(i, n) for (int i = 0; i < (n); ++i) #define fore(i, a) for (auto &i : a) #define min(...) min({__VA_ARGS__}) #define max(...) max({__VA_ARGS__}) #define Yes cout << "Yes" << endl; #...
[["+", 31, 16, 12, 2, 3, 4, 0, 16, 17, 33], ["+", 31, 16, 12, 2, 3, 4, 0, 16, 12, 13]]
1
254
#include <algorithm> #include <array> #include <bitset> #include <cassert> #include <cmath> #include <complex> #include <cstdint> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <regex> #include ...
#include <algorithm> #include <array> #include <bitset> #include <cassert> #include <cmath> #include <complex> #include <cstdint> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <regex> #include ...
[["+", 31, 16, 31, 2, 3, 4, 0, 16, 17, 33], ["+", 31, 16, 31, 2, 3, 4, 0, 16, 12, 13]]
1
1,072
a, b, n = gets.split(" ").map(&:to_i) n = b if n > b puts ((a*n)/b).floor - a*(n/b).floor
a, b, n = gets.split(" ").map(&:to_i) n = b-1 if n >= b puts ((a*n)/b).floor - a*(n/b).floor
[["+", 0, 493, 0, 751, 8, 662, 12, 738, 17, 33], ["+", 0, 493, 0, 751, 8, 662, 12, 738, 12, 612], ["-", 36, 36, 0, 493, 0, 751, 15, 738, 17, 47], ["+", 36, 36, 0, 493, 0, 751, 15, 738, 17, 20]]
4
49
#include <bits/stdc++.h> using namespace std; #define int long long int32_t main() { ios::sync_with_stdio(false); cin.tie(nullptr); int a, b, n; cin >> a >> b >> n; if (b < n) { cout << ((a * (b - 1)) / b); } else { cout << ((a * (n)) / b) - a * (n / b); } return 0; } // b < n ans at i = b-1...
#include <bits/stdc++.h> using namespace std; #define int long long int32_t main() { ios::sync_with_stdio(false); cin.tie(nullptr); int a, b, n; cin >> a >> b >> n; if (b <= n) { cout << ((a * (b - 1)) / b); } else { cout << ((a * (n)) / b) - a * (n / b); } return 0; } // b < n ans at i = b-...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
98
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, n; cin >> a >> b >> n; long long k, l, s; k = a / b; l = a % b; if (n >= b) s = n - 1; else s = n; cout << k * s + l * s / b << endl; }
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, n; cin >> a >> b >> n; long long k, l, s; k = a / b; l = a % b; if (n >= b) s = b - 1; else s = n; cout << k * s + l * s / b << endl; }
[["-", 0, 57, 64, 1, 0, 11, 12, 16, 31, 22], ["+", 0, 57, 64, 1, 0, 11, 12, 16, 31, 22]]
1
79
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <numeric> #include <string> #include <vector> using namespace std; typedef long long ll; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); ll a, b, n; cin >> a >> b >> n; ll x; if (n / b == 0) x = n; else ...
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <numeric> #include <string> #include <vector> using namespace std; typedef long long ll; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); ll a, b, n; cin >> a >> b >> n; ll x; if (n / b == 0) x = n; else ...
[["-", 0, 57, 75, 76, 0, 1, 0, 16, 17, 60], ["-", 75, 76, 0, 1, 0, 16, 12, 16, 31, 22], ["+", 0, 57, 75, 76, 0, 1, 0, 11, 17, 32], ["+", 75, 76, 0, 1, 0, 11, 12, 16, 31, 22]]
1
96
#define _USE_MATH_DEFINES #include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef pair<ll, ll> P; #define INF 10000000000000 #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) #define rep1(i, n) for (ll i = 1; i < (ll)(n); i++) #define repN_1(i, n) for (ll i = 0; i < (ll)(n - 1); i++) #define ...
#define _USE_MATH_DEFINES #include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef pair<ll, ll> P; #define INF 10000000000000 #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) #define rep1(i, n) for (ll i = 1; i < (ll)(n); i++) #define repN_1(i, n) for (ll i = 0; i < (ll)(n - 1); i++) #define ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18]]
1
245
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) #define rep2(i, x, n) for (int i = x; i < (n); i++) #define all(n) begin(n), end(n) struct cww { cww() { ios::sync_with_stdio(false); cin.tie(0); } } star; const long long INF = numeric_limits<long long>::max(); ty...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) #define rep2(i, x, n) for (int i = x; i < (n); i++) #define all(n) begin(n), end(n) struct cww { cww() { ios::sync_with_stdio(false); cin.tie(0); } } star; const long long INF = numeric_limits<long long>::max(); ty...
[["+", 3, 4, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 3, 4, 0, 2, 3, 4, 0, 16, 12, 13]]
1
417
#include <bits/stdc++.h> #define _GLIBCXX_DEBUG using namespace std; #define REP(i, m, n) for (ll i = (ll)(m); i < (ll)(n); ++i) #define rep(i, n) REP(i, 0, n) #define square(x) pow(x 2.0) #define all(x) (x).begin(), (x).end() #define F first #define S second #define max_queue(x) priority_queue<x> #define min_queue(x) ...
#include <bits/stdc++.h> #define _GLIBCXX_DEBUG using namespace std; #define REP(i, m, n) for (ll i = (ll)(m); i < (ll)(n); ++i) #define rep(i, n) REP(i, 0, n) #define square(x) pow(x 2.0) #define all(x) (x).begin(), (x).end() #define F first #define S second #define max_queue(x) priority_queue<x> #define min_queue(x) ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
224
#include <bits/stdc++.h> using namespace std; #define MOD 1000000007 int main() { long long A, B, X; cin >> A >> B >> X; long long num = X / B; if (num > 1) { cout << (A * (B - 1) / B) << endl; } else { cout << (A * X / B) - A * (X / B) << endl; } }
#include <bits/stdc++.h> using namespace std; #define MOD 1000000007 int main() { long long A, B, X; cin >> A >> B >> X; long long num = X / B; if (num >= 1) { cout << (A * (B - 1) / B) << endl; } else { cout << (A * X / B) - A * (X / B) << endl; } }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
86
#include <bits/stdc++.h> #include <unordered_map> using namespace std; #define ll long long #define all(x) (x).begin(), (x).end() #define rep(i, n) for (ll i = 0; i < n; i++) const ll INF = 1LL << 60; ll combination(ll n, ll r) { if (n < r) return 0; if (r == 0 || r == n) return 1; else if (r == 1) r...
#include <bits/stdc++.h> #include <unordered_map> using namespace std; #define ll long long #define all(x) (x).begin(), (x).end() #define rep(i, n) for (ll i = 0; i < n; i++) const ll INF = 1LL << 60; ll combination(ll n, ll r) { if (n < r) return 0; if (r == 0 || r == n) return 1; else if (r == 1) r...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18]]
1
224
#include <bits/stdc++.h> using namespace std; #define INF 1000000000 #define INFLL 0x3f3f3f3f3f3f3f3fLL #define EPS 10e-9 #define MOD 1000000007 #define mp make_pair #define mt make_tuple #define pb push_back #define st first #define nd second #define sz(v) int(v.size()) #define all(X) (X).begin(), (X).end() #define ...
#include <bits/stdc++.h> using namespace std; #define INF 1000000000 #define INFLL 0x3f3f3f3f3f3f3f3fLL #define EPS 10e-9 #define MOD 1000000007 #define mp make_pair #define mt make_tuple #define pb push_back #define st first #define nd second #define sz(v) int(v.size()) #define all(X) (X).begin(), (X).end() #define ...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["-", 31, 16, 12, 2, 3, 4, 0, 16, 31, 22], ["+", 31, 16, 12, 2, 3, 4, 0, 16, 31, 22]]
1
228
A,B,N = map(int,input().split()) ans = ((A*N)//B) - A * (N//B) if B-1 >= N: tmp = ((A*(B-1))//B) - A * ((B-1)//B) ans = max(ans,tmp) print(ans)
A,B,N = map(int,input().split()) ans = ((A*N)//B) - A * (N//B) if B-1 <= N: tmp = ((A*(B-1))//B) - A * ((B-1)//B) ans = max(ans,tmp) print(ans)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 19]]
5
83
#include <bits/stdc++.h> using namespace std; typedef long long int li; typedef long double ld; typedef vector<li> vi; typedef pair<li, li> pi; #define PB push_back #define MP make_pair #define F first #define S second #define B begin() #define E end() #define f(i, l, r) for (li i = l; i <= r; ++i) #define fr(i, l, r...
#include <bits/stdc++.h> using namespace std; typedef long long int li; typedef long double ld; typedef vector<li> vi; typedef pair<li, li> pi; #define PB push_back #define MP make_pair #define F first #define S second #define B begin() #define E end() #define f(i, l, r) for (li i = l; i <= r; ++i) #define fr(i, l, r...
[["+", 49, 50, 51, 2, 3, 4, 0, 16, 17, 33], ["+", 49, 50, 51, 2, 3, 4, 0, 16, 12, 13]]
1
214
#include "bits/stdc++.h" using namespace std; int main() { long long int A, B, N, P, a; cin >> A >> B >> N; ; P = min(B, N); a = A * P / B; cout << a << endl; }
#include "bits/stdc++.h" using namespace std; int main() { long long int A, B, N, P, a; cin >> A >> B >> N; ; P = min(B - 1, N); a = A * P / B; cout << a << endl; }
[["+", 0, 11, 12, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 11, 12, 2, 3, 4, 0, 16, 12, 13]]
1
59
#include <bits/stdc++.h> using namespace std; int main() { long long int A, B, N; cin >> A >> B >> N; long long int result1, result2, result3; result1 = (A * N) / B; // result2 = (A*N)/B-A*(N/B); result3 = (A * (B - 1)) / B; cout << max(result1, result3) << endl; }
#include <bits/stdc++.h> using namespace std; int main() { long long int A, B, N; cin >> A >> B >> N; long long int result1, result2, result3; result1 = (A * N) / B; // result2 = (A*N)/B-A*(N/B); result3 = (A * (B - 1)) / B; cout << min(result1, result3) << endl; }
[["-", 0, 1, 0, 16, 31, 16, 12, 2, 63, 22], ["+", 0, 1, 0, 16, 31, 16, 12, 2, 63, 22]]
1
74
A,B,N=$<.read.split.map(&:to_i) if N < B x = N else x = N/B - 1 end ret = (A*x)/B - A*(x/B) puts ret
A,B,N=$<.read.split.map(&:to_i) if N < B x = N else x = N/B*B-1 end ret = (A*x)/B - A*(x/B) puts ret
[["+", 75, 95, 0, 662, 12, 738, 31, 738, 17, 48], ["+", 75, 95, 0, 662, 12, 738, 31, 738, 12, 743]]
4
52
a,b,n=map(int,input().split()) x=min(b-1,x) print(a*x//b)
a,b,n=map(int,input().split()) x=min(b-1,n) print(a*x//b)
[["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22]]
5
36
#include <bits/stdc++.h> using namespace std; void __print(int x) { cerr << x; } void __print(long x) { cerr << x; } void __print(long long x) { cerr << x; } void __print(unsigned x) { cerr << x; } void __print(unsigned long x) { cerr << x; } void __print(unsigned long long x) { cerr << x; } void __print(float x) { c...
#include <bits/stdc++.h> using namespace std; void __print(int x) { cerr << x; } void __print(long x) { cerr << x; } void __print(long long x) { cerr << x; } void __print(unsigned x) { cerr << x; } void __print(unsigned long x) { cerr << x; } void __print(unsigned long long x) { cerr << x; } void __print(float x) { c...
[["+", 49, 50, 51, 2, 3, 4, 0, 16, 17, 33], ["+", 49, 50, 51, 2, 3, 4, 0, 16, 12, 13]]
1
600
#include <bits/stdc++.h> using namespace std; #define ll long long int #define pb push_back #define rep(i, j, n) for (ll i = j; i < n; i++) #define per(i, j, n) for (ll i = j; i >= n; i--) int main() { ll a, b, n; cin >> a >> b >> n; if (n > b) cout << ((a * (b - 1)) / b) - (a * ((b - 1) / b)); else c...
#include <bits/stdc++.h> using namespace std; #define ll long long int #define pb push_back #define rep(i, j, n) for (ll i = j; i < n; i++) #define per(i, j, n) for (ll i = j; i >= n; i--) int main() { ll a, b, n; cin >> a >> b >> n; if (n > b - 1) cout << ((a * (b - 1)) / b) - (a * ((b - 1) / b)); else ...
[["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 33], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]]
1
116
a, b, n = map(int, input().split()) if n > b: print(((a*(-1))//b) - (a*((-1)//b))) else: print(((a*n)//b) - (a*(n//b)))
a, b, n = map(int, input().split()) if n >= b: print(((a*(-1))//b) - (a*((-1)//b))) else: print(((a*n)//b) - (a*(n//b)))
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20]]
5
75
import math A,B,N=list(map(int,input().split())) maxi=max(B-1,N) print(math.floor((A*maxi)/B)-A*math.floor(maxi/B))
import math A,B,N=list(map(int,input().split())) maxi=min(B-1,N) print(math.floor((A*maxi)/B)-A*math.floor(maxi/B))
[["-", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22]]
5
59
# -*- coding: utf-8 -*- A,B,N = map(int, input().split()) if N > B: x = B - 1 z = (A * x) // B - A * (x // B) else: x = N z = (A * x) // B - A * (x // B) print(int(z))
# -*- coding: utf-8 -*- A,B,N = map(int, input().split()) if N >= B: x = B - 1 z = (A * x) // B - A * (x // B) else: x = N z = (A * x) // B - A * (x // B) print(int(z))
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20]]
5
75
#include <bits/stdc++.h> using namespace std; typedef float fl; typedef long long ll; int A; ll B, N; ll f(ll x) { ll ans = (A * x) / B - A * (x / B); return ans; } int main() { cin >> A >> B >> N; // if(B > N){ // cout << f(N) << endl; // }else{ // cout << f(B-1) << endl; // } cout << f(min...
#include <bits/stdc++.h> using namespace std; typedef float fl; typedef long long ll; int A; ll B, N; ll f(ll x) { ll ans = (A * x) / B - A * (x / B); return ans; } int main() { cin >> A >> B >> N; // if(B > N){ // cout << f(N) << endl; // }else{ // cout << f(B-1) << endl; // } cout << f(min...
[["-", 3, 4, 0, 2, 3, 4, 0, 16, 17, 33], ["-", 3, 4, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 3, 4, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 3, 4, 0, 2, 3, 4, 0, 16, 12, 13]]
1
91
#include <bits/stdc++.h> using namespace std; typedef float fl; typedef long long ll; int A; ll B, N; int f(int x) { ll ans = (A * x) / B - A * (x / B); return ans; } int main() { cin >> A >> B >> N; if (B >= N) { cout << f(N) << endl; } else { cout << f(B - 1) << endl; } return 0; }
#include <bits/stdc++.h> using namespace std; typedef float fl; typedef long long ll; int A; ll B, N; ll f(ll x) { ll ans = (A * x) / B - A * (x / B); return ans; } int main() { cin >> A >> B >> N; if (B > N) { cout << f(N) << endl; } else { cout << f(B - 1) << endl; } return 0; }
[["-", 36, 36, 36, 36, 0, 30, 0, 14, 39, 40], ["+", 36, 36, 36, 36, 0, 30, 0, 14, 39, 78], ["-", 0, 14, 49, 53, 54, 55, 0, 56, 39, 40], ["+", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47]]
1
101
#include <cmath> #include <iostream> using namespace std; int main() { long int a, b, n; long int max = 0; cin >> a >> b >> n; if (b - 1 < n) { cout << floor(a * (b - 1 / b)) - a * floor((b - 1) / b) << endl; } else { cout << floor(a * n / b) - a * floor(n / b) << endl; } return 0; }
#include <cmath> #include <iostream> using namespace std; int main() { long int a, b, n; long int max = 0; cin >> a >> b >> n; if (b - 1 < n) { cout << floor(a * (b - 1) / b) - a * floor((b - 1) / b) << endl; } else { cout << floor(a * n / b) - a * floor(n / b) << endl; } return 0; }
[["+", 3, 4, 0, 16, 31, 16, 12, 23, 0, 25], ["-", 31, 2, 3, 4, 0, 16, 12, 23, 0, 25]]
1
104
#include <algorithm> #include <iostream> using namespace std; int main() { long long int a, b, n, ans = 0; cin >> a >> b >> n; if (b - 1 < n) { cout << (((a * b - 1) / b) - a * ((b - 1) / b)) << endl; } else { cout << (((a * n) / b) - a * (n / b)) << endl; } return 0; }
#include <algorithm> #include <iostream> using namespace std; int main() { long long int a, b, n, ans = 0; cin >> a >> b >> n; if (b - 1 < n) { cout << (((a * (b - 1)) / b) - a * ((b - 1) / b)) << endl; } else { cout << (((a * n) / b) - a * (n / b)) << endl; } return 0; }
[["+", 0, 16, 31, 23, 0, 16, 12, 23, 0, 24], ["+", 0, 16, 31, 23, 0, 16, 12, 23, 0, 25]]
1
105
A,B,N = map(int,input().split()) def func(x): return int((A*x)/B) - A * int(x/B) if N < B: print(func(N)) else: print(B-1)
A,B,N = map(int,input().split()) def func(x): return int((A*x)/B) - A * int(x/B) if N < B: print(func(N)) else: print(func(B-1))
[["+", 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
64
#include <bits/stdc++.h> using namespace std; /***** MAIN *****/ signed main() { long long a, b, n; cin >> a >> b >> n; cout << a / b * min(n, b - 1) << endl; return 0; } /***** MAIN *****/
#include <bits/stdc++.h> using namespace std; signed main() { long long a, b, n; cin >> a >> b >> n; cout << a * min(n, b - 1) / b << endl; return 0; }
[["-", 0, 16, 31, 16, 12, 16, 31, 16, 17, 85], ["-", 0, 16, 31, 16, 12, 16, 31, 16, 12, 22], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 85], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 22]]
1
50
a,b,n=map(int,input().split()) nmax = (a*n)//b - a*(n//b) x = b-1 xmax = (a*x)//b - a*(x//b) print(max(nmax,xmax))
a,b,n=map(int,input().split()) nmax = (a*n)//b - a*(n//b) x = b-1 xmax = (a*x)//b - a*(x//b) print(max(nmax,xmax) if x < n else nmax)
[["+", 0, 1, 0, 652, 3, 4, 0, 41, 0, 121], ["+", 0, 652, 3, 4, 0, 41, 0, 666, 0, 22], ["+", 0, 652, 3, 4, 0, 41, 0, 666, 667, 18], ["+", 0, 1, 0, 652, 3, 4, 0, 41, 0, 95], ["+", 0, 1, 0, 652, 3, 4, 0, 41, 0, 22]]
5
66
a,b,n = map(int,input().split()) i = max(b-1,n) ans = a*i//b - a*(i//b) print(ans)
a,b,n = map(int,input().split()) i = min(b-1,n) ans = a*i//b - a*(i//b) print(ans)
[["-", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22]]
5
47
import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map.Entry; import java.util.PriorityQueue; import java.util.Scanner; class Main { stat...
import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map.Entry; import java.util.PriorityQueue; import java.util.Scanner; class Main { stat...
[["+", 0, 57, 15, 15, 0, 16, 31, 16, 17, 33], ["+", 0, 57, 15, 15, 0, 16, 31, 16, 12, 499]]
3
269
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, n, ans = 0; cin >> a >> b >> n; if (n < b) ans = a * n / b; else ans = a * (b - 1); cout << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, n, ans = 0; cin >> a >> b >> n; if (n < b) ans = a * n / b; else ans = a * (b - 1) / b; cout << ans << endl; return 0; }
[["+", 75, 76, 0, 1, 0, 11, 12, 16, 17, 85], ["+", 75, 76, 0, 1, 0, 11, 12, 16, 12, 22]]
1
66
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long int; using vec = vector<int>; using P = pair<int, int>; int main() { ll a, b, n; cin >> a >> b >> n; ll ans; if (b > n) { ans = a * n / b; } else { ans = a - 1; } cout << ans << en...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long int; using vec = vector<int>; using P = pair<int, int>; int main() { ll a, b, n; cin >> a >> b >> n; ll ans; if (b > n) { ans = a * n / b; } else { ans = a * (b - 1) / b; } cout <<...
[["+", 0, 1, 0, 11, 12, 16, 31, 16, 17, 48], ["+", 0, 11, 12, 16, 31, 16, 12, 23, 0, 24], ["+", 12, 16, 31, 16, 12, 23, 0, 16, 31, 22], ["+", 0, 11, 12, 16, 31, 16, 12, 23, 0, 25], ["+", 0, 9, 0, 1, 0, 11, 12, 16, 17, 85], ["+", 0, 9, 0, 1, 0, 11, 12, 16, 12, 22]]
1
94
import math a,b,n=map(int,input().split()) max=-2 if n<b: max=math.floor(a*n/b) else: #b<=n max=math.floor(a*b-1/b) #s2=math.floor(a*((1/b)-i//b)) print(max)
import math a,b,n=map(int,input().split()) max=-2 if n<b: max=math.floor(a*n/b) else: #b<=n max=math.floor(a*(b-1)/b) print(max)
[["+", 3, 4, 0, 657, 31, 657, 12, 23, 0, 24], ["+", 3, 4, 0, 657, 31, 657, 12, 23, 0, 25]]
5
63
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 1e5 + 100; int main() { ll a, b, c; cin >> a >> b >> c; c = min(c, b); cout << a * c / b - a * (c / b) << endl; return 0; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 1e5 + 100; int main() { ll a, b, c; cin >> a >> b >> c; c = min(c, b - 1); cout << a * c / b - a * (c / b) << endl; return 0; }
[["+", 0, 11, 12, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 11, 12, 2, 3, 4, 0, 16, 12, 13]]
1
70
import math A,B,N=map(int,input().split()) x=min(B-1,N) ans=math.ceil(A*x/B)-A*math.ceil(x/B) print(int(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(int(ans))
[["-", 0, 662, 12, 657, 31, 652, 63, 319, 319, 22], ["+", 0, 662, 12, 657, 31, 652, 63, 319, 319, 22], ["-", 12, 657, 12, 657, 12, 652, 63, 319, 319, 22], ["+", 12, 657, 12, 657, 12, 652, 63, 319, 319, 22]]
5
60
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; i < (int)(n); i++) typedef pair<int, int> P; int main() { ll a, b, n; cin >> a >> b >> n; ll x = (n, b - 1); cout << floor((a * x) / b) - a * floor(x / b) << endl; }
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; i < (int)(n); i++) typedef pair<int, int> P; int main() { ll a, b, n; cin >> a >> b >> n; ll x = min(n, b - 1); cout << floor((a * x) / b) - a * floor(x / b) << endl; }
[["+", 8, 9, 0, 43, 49, 50, 51, 2, 63, 22]]
1
85
#include <bits/stdc++.h> #define inf 0x3f3f3f3f using namespace std; typedef unsigned long long ull; typedef long long ll; typedef double dd; const int N = 1e5 + 5; const dd eps = 1e-8; const int mod = 1e9 + 7; ll a, b, n; ll cal(ll x) { return ((a * x) / b) - a * (x / b); } int main() { ios::sync_with_stdio(false...
#include <bits/stdc++.h> #define inf 0x3f3f3f3f using namespace std; typedef unsigned long long ull; typedef long long ll; typedef double dd; const int N = 1e5 + 5; const dd eps = 1e-8; const int mod = 1e9 + 7; ll a, b, n; ll cal(ll x) { return ((a * x) / b) - a * (x / b); } int main() { ios::sync_with_stdio(false...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47]]
1
134
a,b,n=list(map(int,input().split())) ans=0 #for x in range(n+1): if a==b==n: x=n-1 else: x=b-1 if n-1>=b else n ans=int(a*x/b)-a*int(x/b) print(ans) #print(x,int(a*x/b),int(x/b)*a,ans)
a,b,n=list(map(int,input().split())) ans=0 #for x in range(n+1): if b==n: x=n-1 else: x=b-1 if n-1>=b else n ans=int(a*x/b)-a*int(x/b) print(ans) #print(x,int(a*x/b),int(x/b)*a,ans)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22], ["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 60]]
5
76
def n0():return int(input()) def n1():return [int(x) for x in input().split()] def n2(n):return [int(input()) for _ in range(n)] def n3(n):return [[int(x) for x in input().split()] for _ in range(n)] a,b,n=n1() import math if b<=n: i=b-1 else: i=n m=math.floor((a*i)/b)-a*math.floor(i//b) print(i,m)
def n0():return int(input()) def n1():return [int(x) for x in input().split()] def n2(n):return [int(input()) for _ in range(n)] def n3(n):return [[int(x) for x in input().split()] for _ in range(n)] a,b,n=n1() import math if b<=n: i=b-1 else: i=n m=math.floor((a*i)/b)-a*math.floor(i/b) print(m)
[["-", 12, 657, 12, 652, 3, 4, 0, 657, 17, 676], ["+", 12, 657, 12, 652, 3, 4, 0, 657, 17, 85], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 21]]
5
145
def n0():return int(input()) def n1():return [int(x) for x in input().split()] def n2(n):return [int(input()) for _ in range(n)] def n3(n):return [[int(x) for x in input().split()] for _ in range(n)] a,b,n=n1() import math if b<=n: i=b-1 else: i=n m=math.floor((a*i)/b)-a*math.floor(i//b) print(i,m)
def n0():return int(input()) def n1():return [int(x) for x in input().split()] def n2(n):return [int(input()) for _ in range(n)] def n3(n):return [[int(x) for x in input().split()] for _ in range(n)] a,b,n=n1() import math if b<=n: i=b-1 else: i=n m=math.floor((a*i)/b)-a*math.floor(i//b) print(m)
[["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 21]]
5
145
def n0():return int(input()) def n1():return [int(x) for x in input().split()] def n2(n):return [int(input()) for _ in range(n)] def n3(n):return [[int(x) for x in input().split()] for _ in range(n)] a,b,n=n1() if b<=n: i=b else: i=n m=(a*i)//b-a*(i//b) print(m)
def n0():return int(input()) def n1():return [int(x) for x in input().split()] def n2(n):return [int(input()) for _ in range(n)] def n3(n):return [[int(x) for x in input().split()] for _ in range(n)] a,b,n=n1() if b<=n: i=b-1 else: i=n m=(a*i)//b-a*(i//b) print(m)
[["+", 64, 196, 0, 1, 0, 662, 12, 657, 17, 33], ["+", 64, 196, 0, 1, 0, 662, 12, 657, 12, 612]]
5
131
import math a,b,n = map(int,input().split()) c = 0 ans = -1 for i in range(1,n//b+1) : x = b*i-1 if x > n : x = n c = 1 if ans >= math.floor((a*x)/b)-a*math.floor(x/b) : break ans = math.floor((a*x)/b)-a*math.floor(x/b) if c == 1 : break print(ans)
import math a,b,n = map(int,input().split()) c = 0 ans = -1 for i in range(1,n//b+2) : x = b*i-1 if x > n : x = n c = 1 if ans >= math.floor((a*x)/b)-a*math.floor(x/b) : break ans = math.floor((a*x)/b)-a*math.floor(x/b) if c == 1 : break print(ans)
[["-", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
122
def solve(): if n > b: print((b-1)*a//b) else: print((a*n)//b- a*(n//b)) return # n = int(input()) a, b, n = [int(s) for s in input().split(" ")] solve()
def solve(): if n >= b: print((b-1)*a//b) else: print((a*n)//b- a*(n//b)) return # n = int(input()) a, b, n = [int(s) for s in input().split(" ")] solve()
[["-", 0, 14, 8, 196, 0, 57, 15, 666, 667, 47], ["+", 0, 14, 8, 196, 0, 57, 15, 666, 667, 20]]
5
72
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (ll i = 0; i < n; i++) #define all(v) v.begin(), v.end() #define vec vector /* <<bit全探索>> for (int tmp = 0; tmp < (1 << ビット数); tmp++) { bitset<ビット数> s(tmp); } */ /* <<stringで読み込んだ数列を一桁ずつint型へ変換>> string str; int N[桁数]; ...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (ll i = 0; i < n; i++) #define all(v) v.begin(), v.end() #define vec vector /* <<bit全探索>> for (int tmp = 0; tmp < (1 << ビット数); tmp++) { bitset<ビット数> s(tmp); } */ /* <<stringで読み込んだ数列を一桁ずつint型へ変換>> string str; int N[桁数]; ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22], ["+", 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, 18]...
1
128
A,B,N=map(int,input().split()) def f(x): return int(A*x/B)-A*int(x/B) print(f(max(N,B-1)))
A,B,N=map(int,input().split()) def f(x): return int(A*x/B)-A*int(x/B) print(f(min(N,B-1)))
[["-", 3, 4, 0, 652, 3, 4, 0, 652, 63, 22], ["+", 3, 4, 0, 652, 3, 4, 0, 652, 63, 22]]
5
56
#include <cmath> #include <iostream> using namespace std; long A, B, N; long f(double x) { return floor((A * x) / B) - A * floor(x / B); } int main() { cin >> A >> B >> N; long min = N > B - 1 ? B - 1 : N; cout << f(B - 1) << endl; return 0; }
#include <cmath> #include <iostream> using namespace std; long A, B, N; long f(double x) { return floor((A * x) / B) - A * floor(x / B); } int main() { cin >> A >> B >> N; long min = N > B - 1 ? B - 1 : N; cout << f(min) << endl; return 0; }
[["-", 31, 16, 12, 2, 3, 4, 0, 16, 31, 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]]
1
87
A,B,N = map(int,input().split()) if B-1 >= N: print(((A*B)-A)//B) else: print((A*N)//B - A*(N//B))
A,B,N = map(int,input().split()) if B <= N: print(((A*B)-A)//B) else: print((A*N)//B - A*(N//B))
[["-", 0, 656, 0, 57, 15, 666, 0, 657, 17, 33], ["-", 0, 656, 0, 57, 15, 666, 0, 657, 12, 612], ["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 19]]
5
59
import math a,b,n=map(int, input().split()) max = 0 tmp = 0 if n >= b: max = math.floor(a * (b + 1) / b) - a * math.floor((b + 1) / b) else: max = math.floor(a * n / b) - a * math.floor(n / b) print(max)
import math a,b,n=map(int, input().split()) max = 0 tmp = 0 if n >= b: max = math.floor(a * (b - 1) / b) - a * math.floor((b - 1) / b) else: max = math.floor(a * n / b) - a * math.floor(n / b) print(max)
[["-", 0, 657, 31, 657, 12, 23, 0, 657, 17, 72], ["+", 0, 657, 31, 657, 12, 23, 0, 657, 17, 33], ["-", 3, 4, 0, 657, 31, 23, 0, 657, 17, 72], ["+", 3, 4, 0, 657, 31, 23, 0, 657, 17, 33]]
5
91
import math a, b, n = map(int,input().split()) x = min(b, n) print(int(math.floor(a*x/b) - a * math.floor(x/b)))
import math a, b, n = map(int,input().split()) x = min(b-1, n) print(int(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; #define REP(i, n) for (int i = 0; i < (n); i++) typedef long long ll; int main(int argc, char const *argv[]) { cin.tie(0); ios::sync_with_stdio(false); ll A, B, N; cin >> A >> B >> N; cout << floor(A * max(N, (B - 1)) / B) - A * floor(max(N, (B - 1)) / B) ...
#include <bits/stdc++.h> using namespace std; #define REP(i, n) for (int i = 0; i < (n); i++) typedef long long ll; int main(int argc, char const *argv[]) { cin.tie(0); ios::sync_with_stdio(false); ll A, B, N; cin >> A >> B >> N; cout << floor(A * min(N, (B - 1)) / B) - A * floor(min(N, (B - 1)) / B) ...
[["-", 3, 4, 0, 16, 31, 16, 12, 2, 63, 22], ["+", 3, 4, 0, 16, 31, 16, 12, 2, 63, 22], ["-", 12, 2, 3, 4, 0, 16, 31, 2, 63, 22], ["+", 12, 2, 3, 4, 0, 16, 31, 2, 63, 22]]
1
106
#!/usr/bin/env python # -*- coding: utf-8 -*- a, b, n = map(int, input().split()) if n >= b: x = b-1 else: x = b print(a*x//b-a*(x//b))
#!/usr/bin/env python # -*- coding: utf-8 -*- a, b, n = map(int, input().split()) if n >= b: x = b-1 else: x = n print(a*x//b-a*(x//b))
[["-", 75, 76, 8, 196, 0, 1, 0, 662, 12, 22], ["+", 75, 76, 8, 196, 0, 1, 0, 662, 12, 22]]
5
51
import sys from math import sqrt, floor input = sys.stdin.readline sys.setrecursionlimit(10 ** 6) def I(): return int(input()) def MI(): return map(int, input().split()) def main(): a, b, n = MI() if b < n: print((a * (b - 1)) // b) else: print((a * n) // b) if __name__ == ...
import sys from math import sqrt, floor input = sys.stdin.readline sys.setrecursionlimit(10 ** 6) def I(): return int(input()) def MI(): return map(int, input().split()) def main(): a, b, n = MI() if b - 1 <= n: print((a * (b - 1)) // b) else: print((a * n) // b) if __name_...
[["-", 0, 14, 8, 196, 0, 57, 15, 666, 667, 18], ["+", 8, 196, 0, 57, 15, 666, 0, 657, 17, 33], ["+", 8, 196, 0, 57, 15, 666, 0, 657, 12, 612], ["+", 0, 14, 8, 196, 0, 57, 15, 666, 667, 19]]
5
108
import math A, B, N = map(int, input().split()) x = max(B-1, N) print(math.floor((A*x)/B)-A*(x//B))
import math A, B, N = map(int, input().split()) x = min(B-1, N) print(math.floor((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
53
#include <bits/stdc++.h> using namespace std; #define _GLIBCXX_DEBUG #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define ll long long #define all(x) (x).begin(), (x).end() template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } template <class T> bool ...
#include <bits/stdc++.h> using namespace std; #define _GLIBCXX_DEBUG #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define ll long long #define all(x) (x).begin(), (x).end() template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } template <class T> bool ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 0, 57, 64, 1, 0, 11, 12, 16, 17, 33], ["+", 0, 57, 64, 1, 0, 11, 12, 16, 12, 13]]
1
157
def d(): import math a, b, n = map(int, input().split()) # x <= n x = min(b, n) print(math.floor(a*x/b) - a * math.floor(x/b)) ########## if __name__ == "__main__": d()
def d(): import math a, b, n = map(int, input().split()) # x <= n x = min(b-1, n) print(math.floor(a*x/b) - a * math.floor(x/b)) ########## if __name__ == "__main__": d()
[["+", 0, 662, 12, 652, 3, 4, 0, 657, 17, 33], ["+", 0, 662, 12, 652, 3, 4, 0, 657, 12, 612]]
5
69
a, b, n = map(int, input().split()) x = min(b-1, n) ans = max(int((a*x)/b) - a*int(x/b)) print(ans)
a, b, n = map(int, input().split()) x = min(b-1, n) ans = int((a*x)/b) - a*int(x/b) print(ans)
[["-", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["-", 0, 657, 12, 657, 12, 652, 3, 4, 0, 25]]
5
56
import math a,b,n=map(int, input().split()) if n>b: print(math.floor(a*(b-1)/b)) else: print(math.floor(a*n/b))
import math a,b,n=map(int, input().split()) if n>b-1: print(math.floor(a*(b-1)/b)) else: print(math.floor(a*n/b))
[["+", 0, 656, 0, 57, 15, 666, 0, 657, 17, 33], ["+", 0, 656, 0, 57, 15, 666, 0, 657, 12, 612]]
5
57
A, B, N = map(int,input().split()) def fl(i): return ((A * i) // B) - (A * (i // B)) if B <= N: print(int(fl(B / A * (A - 1)))) else: print(int(fl(N)))
A, B, N = map(int,input().split()) def fl(i): return ((A * i) // B) - (A * (i // B)) if B <= N: print(int(fl(B - 1))) else: print(int(fl(N)))
[["-", 0, 652, 3, 4, 0, 657, 31, 657, 17, 85], ["-", 0, 652, 3, 4, 0, 657, 31, 657, 12, 22], ["-", 3, 4, 0, 652, 3, 4, 0, 657, 17, 48], ["-", 0, 652, 3, 4, 0, 657, 12, 23, 0, 24], ["-", 3, 4, 0, 657, 12, 23, 0, 657, 31, 22], ["-", 0, 652, 3, 4, 0, 657, 12, 23, 0, 25]]
5
79
#include <bits/stdc++.h> using namespace std; typedef long long ll; void solve(long long A, long long B, long long N) { ll mae, ato; ll x, ans; if (N >= B) x = B; else { x = N; } mae = (A * x) / B; ato = A * ll(x / B); ans = ll(mae) - ll(ato); cout << ans << endl; } int main() { long long...
#include <bits/stdc++.h> using namespace std; typedef long long ll; void solve(long long A, long long B, long long N) { ll mae, ato; ll x, ans; if (N >= B) x = B - 1; else { x = N; } mae = (A * x) / B; ato = A * ll(x / B); ans = ll(mae) - ll(ato); cout << ans << endl; } int main() { long ...
[["+", 0, 57, 64, 1, 0, 11, 12, 16, 17, 33], ["+", 0, 57, 64, 1, 0, 11, 12, 16, 12, 13]]
1
154
#pragma region RegionDefs #include <bits/stdc++.h> #define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i) #define reps(i, l, r) for (int i = (l), i##_len = (r); i < i##_len; ++i) #define all(x) begin(x), end(x) using namespace std; const int INF = 1e9; template <class T = int> using V = vector<T>; template ...
#pragma region RegionDefs #include <bits/stdc++.h> #define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i) #define reps(i, l, r) for (int i = (l), i##_len = (r); i < i##_len; ++i) #define all(x) begin(x), end(x) using namespace std; const int INF = 1e9; template <class T = int> using V = vector<T>; template ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
383
A,B,N = map(int,input().split()) if B >= N - 1: print(A * N // B) else: print(A * (B-1) // B)
A,B,N = map(int,input().split()) if B >= N + 1: print(A * N // B) else: print(A * (B-1) // B)
[["-", 0, 656, 0, 57, 15, 666, 0, 657, 17, 33], ["+", 0, 656, 0, 57, 15, 666, 0, 657, 17, 72]]
5
47
N, M = map(int, input().split()) if N % 2 == 1: for a in range(1, M + 1): print(a, N - a + 1) else: for a in range(1, M + 1): if a <= M // 2: print(a, N - a + 1) else: print(a, N - a)
N, M = map(int, input().split()) if N % 2 == 1: for a in range(1, M + 1): print(a, N - a + 1) else: for a in range(1, M + 1): if a < -(-M // 2) + 1: print(a, N - a + 1) else: print(a, N - a)
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 19], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 18], ["+", 0, 57, 15, 666, 0, 657, 31, 664, 17, 33], ["+", 15, 666, 0, 657, 31, 664, 28, 23, 0, 24], ["+", 31, 664, 28, 23, 0, 657, 31, 664, 17, 33], ["+", 15, 666, 0, 657, 31, 664, 28, 23, 0, 25], ["+", 8, 196, 0, 57, 15, 666, 0, 6...
5
86
#include <iostream> using namespace std; #include <algorithm> #include <iomanip> #include <map> #include <queue> #include <set> #include <string> #include <vector> vector<long long int> v; long long int ans[214514] = {}; bool f[214514] = {}; vector<long long int> a; vector<vector<long long int>> d; void kansu(long l...
#include <iostream> using namespace std; #include <algorithm> #include <iomanip> #include <map> #include <queue> #include <set> #include <string> #include <vector> vector<long long int> v; long long int ans[214514] = {}; bool f[214514] = {}; vector<long long int> a; vector<vector<long long int>> d; void kansu(long l...
[["-", 49, 50, 51, 16, 31, 2, 63, 343, 141, 22], ["+", 49, 50, 51, 16, 31, 2, 63, 343, 141, 22]]
1
524
#include <bits/stdc++.h> using namespace std; #define ff first #define ss second #define PI acos(-1) #define pb push_back #define int long long #define ld long double #define sp fixed << setprecision #define bp __builtin_popcountll #define all(x) x.begin(), x.end() #define pii pair<long long, long long> #define FAST ...
#include <bits/stdc++.h> using namespace std; #define ff first #define ss second #define PI acos(-1) #define pb push_back #define int long long #define ld long double #define sp fixed << setprecision #define bp __builtin_popcountll #define all(x) x.begin(), x.end() #define pii pair<long long, long long> #define FAST ...
[["-", 0, 43, 49, 50, 51, 2, 63, 118, 119, 120], ["+", 0, 43, 49, 50, 51, 2, 63, 118, 119, 120], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["+", 0, 14, 8, 9, 0, 1, 0, 27, 28, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 27, 17, 29]]
1
343
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < int(n); i++) using namespace std; using ll = long long; const int INF = (1 << 30) - 1; const long long LINF = (1LL << 62) - 1; const int dx[] = {-1, 0, 1, 0}; const int dy[] = {0, 1, 0, -1}; template <class T> inline bool chmax(T &a, T b) { if (a < b) { ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < int(n); i++) using namespace std; using ll = long long; const int INF = (1 << 30) - 1; const long long LINF = (1LL << 62) - 1; const int dx[] = {-1, 0, 1, 0}; const int dy[] = {0, 1, 0, -1}; template <class T> inline bool chmax(T &a, T b) { if (a < b) { ...
[["-", 8, 9, 0, 43, 49, 50, 51, 2, 63, 22], ["+", 8, 9, 0, 43, 49, 50, 51, 2, 63, 22]]
1
433
#include <algorithm> #include <bitset> #include <cmath> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <vector> using namespace std; #define REP(i, n) for (ll(i) = (0); (i) < (n); ++i) #define REV(i, n) for (ll(i)...
#include <algorithm> #include <bitset> #include <cmath> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <vector> using namespace std; #define REP(i, n) for (ll(i) = (0); (i) < (n); ++i) #define REV(i, n) for (ll(i)...
[["-", 0, 43, 49, 50, 51, 16, 31, 2, 63, 22], ["+", 0, 43, 49, 50, 51, 16, 31, 2, 63, 22]]
1
395
#include <bits/stdc++.h> #define pb push_back #define fi first #define se second #define eb emplace_back #define mid ((l + r) >> 1) const int N = 1000007, inf = 0x3f3f3f3f; using namespace std; typedef long long ll; typedef pair<int, int> ii; int seg[4 * N]; void update(int p, int l, int r, int j, int x) { if (r <...
#include <bits/stdc++.h> #define pb push_back #define fi first #define se second #define eb emplace_back #define mid ((l + r) >> 1) const int N = 1000007, inf = 0x3f3f3f3f; using namespace std; typedef long long ll; typedef pair<int, int> ii; int seg[4 * N]; void update(int p, int l, int r, int j, int x) { if (r <...
[["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["-", 8, 1, 0, 16, 31, 16, 12, 69, 28, 22], ["+", 8, 1, 0, 16, 31, 16, 12, 69, 28, 22]]
1
669
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef pair<int, int> pii; #define PB push_back #define MP make_pair #define FOR(prom, a, b) for (int prom = (a); prom < (b); prom++) #define FORDE(prom, a, b) for (int prom = (a); prom >= (b); prom--) #define R1(a) ...
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef pair<int, int> pii; #define PB push_back #define MP make_pair #define FOR(prom, a, b) for (int prom = (a); prom < (b); prom++) #define FORDE(prom, a, b) for (int prom = (a); prom >= (b); prom--) #define R1(a) ...
[["+", 0, 2, 3, 4, 0, 2, 63, 118, 28, 22], ["+", 0, 2, 3, 4, 0, 2, 63, 118, 17, 131], ["+", 0, 2, 3, 4, 0, 2, 63, 118, 119, 120], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 24], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 25]]
1
371
#include <bits/stdc++.h> using namespace std; #define ll long long #define db double #define pii pair<int, int> #define pli pair<ll, int> #define pil pair<int, ll> #define pll pair<ll, ll> #define mat vector<vector<int>> const int inf = 1 << 30; const ll linf = 1e18; const db EPS = 1e-7; template <class T> void chmin(T...
#include <bits/stdc++.h> using namespace std; #define ll long long #define db double #define pii pair<int, int> #define pli pair<ll, int> #define pil pair<int, ll> #define pll pair<ll, ll> #define mat vector<vector<int>> const int inf = 1 << 30; const ll linf = 1e18; const db EPS = 1e-7; template <class T> void chmin(T...
[["-", 51, 16, 31, 2, 3, 4, 0, 16, 17, 72], ["-", 51, 16, 31, 2, 3, 4, 0, 16, 12, 13]]
1
766
#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll maxs = 1e5 + 5; const ll lmaxs = 20; ll mod = 1e9 + 7; ll oo = 1e15; #define IOS \ ios_base::sync_with_stdio(false); \ cin.tie(...
#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll maxs = 2e5 + 5; const ll lmaxs = 20; ll mod = 1e9 + 7; ll oo = 1e15; #define IOS \ ios_base::sync_with_stdio(false); \ cin.tie(...
[["-", 0, 30, 0, 43, 49, 50, 51, 16, 31, 13], ["+", 0, 30, 0, 43, 49, 50, 51, 16, 31, 13], ["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
374
#define _USE_MATH_DEFINES #include <iomanip> #include <iostream> #include <stdio.h> #include <algorithm> #include <cmath> #include <complex> #include <iterator> #include <sstream> #include <bitset> #include <cstring> #include <string> #include <vector> #include <list> #include <map> #include <queue> #include <set> ...
#define _USE_MATH_DEFINES #include <iomanip> #include <iostream> #include <stdio.h> #include <algorithm> #include <cmath> #include <complex> #include <iterator> #include <sstream> #include <bitset> #include <cstring> #include <string> #include <vector> #include <list> #include <map> #include <queue> #include <set> ...
[["-", 8, 9, 0, 43, 49, 50, 51, 2, 63, 22], ["+", 8, 9, 0, 43, 49, 50, 51, 2, 63, 22]]
1
641
#include <bits/stdc++.h> using namespace std; #define int long long #define rep(i, n) for (int i = 0; i < n; i++) #define all(a) a.begin(), a.end() #define mod 1000000007 #define MOD 998244353 #define INF 40000000000000000 int dx8[8] = {-1, 0, 1, 1, 1, 0, -1, -1}; int dy8[8] = {1, 1, 1, 0, -1, -1, -1, 0}; int dx4[4] = ...
#include <bits/stdc++.h> using namespace std; #define int long long #define rep(i, n) for (int i = 0; i < n; i++) #define all(a) a.begin(), a.end() #define mod 1000000007 #define MOD 998244353 #define INF 40000000000000000 int dx8[8] = {-1, 0, 1, 1, 1, 0, -1, -1}; int dy8[8] = {1, 1, 1, 0, -1, -1, -1, 0}; int dx4[4] = ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
462
#include <bits/stdc++.h> using namespace std; typedef signed long long ll; #undef _P #define _P(...) (void)printf(__VA_ARGS__) #define FOR(x, to) for (x = 0; x < (to); x++) #define FORR(x, arr) for (auto &x : arr) #define ITR(x, c) for (__typeof(c.begin()) x = c.begin(); x != c.end(); x++) #define ALL(a) (a.begin()), ...
#include <bits/stdc++.h> using namespace std; typedef signed long long ll; #undef _P #define _P(...) (void)printf(__VA_ARGS__) #define FOR(x, to) for (x = 0; x < (to); x++) #define FORR(x, arr) for (auto &x : arr) #define ITR(x, c) for (__typeof(c.begin()) x = c.begin(); x != c.end(); x++) #define ALL(a) (a.begin()), ...
[["-", 51, 16, 31, 2, 3, 4, 0, 16, 17, 72], ["-", 51, 16, 31, 2, 3, 4, 0, 16, 12, 13]]
1
449
// Date: 2020-05-02 #include <bits/stdc++.h> using namespace std; typedef long long LL; typedef long double LD; typedef vector<int> VI; typedef pair<LL, LL> pll; typedef pair<int, int> pii; #define IO \ freopen("in.txt", "r", stdin); ...
// Date: 2020-05-02 #include <bits/stdc++.h> using namespace std; typedef long long LL; typedef long double LD; typedef vector<int> VI; typedef pair<LL, LL> pll; typedef pair<int, int> pii; #define IO \ freopen("in.txt", "r", stdin); ...
[["+", 0, 1, 0, 2, 3, 4, 0, 69, 28, 22], ["+", 0, 2, 3, 4, 0, 69, 341, 342, 0, 70], ["+", 0, 2, 3, 4, 0, 69, 341, 342, 0, 73]]
1
785
#include <algorithm> #include <cassert> #include <complex> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <string.h> #include <string> #include <unordered_map> #include <utility> #include <vector> using namespace std; typedef long l...
#include <algorithm> #include <cassert> #include <complex> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <string.h> #include <string> #include <unordered_map> #include <utility> #include <vector> using namespace std; typedef long l...
[["-", 0, 43, 49, 50, 51, 16, 31, 2, 63, 22], ["+", 0, 43, 49, 50, 51, 16, 31, 2, 63, 22]]
1
332
#include <bits/stdc++.h> #ifdef LOCAL_DEBUG #define DEBUG 1 #define CERR \ if (DEBUG) \ cerr #define MACRO(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, NAME, ...) NAME #define pr(...) ...
#include <bits/stdc++.h> #ifdef LOCAL_DEBUG #define DEBUG 1 #define CERR \ if (DEBUG) \ cerr #define MACRO(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, NAME, ...) NAME #define pr(...) ...
[["-", 0, 11, 12, 2, 3, 4, 0, 16, 31, 22], ["-", 0, 11, 12, 2, 3, 4, 0, 16, 17, 72], ["-", 0, 11, 12, 2, 3, 4, 0, 16, 12, 13], ["+", 12, 2, 3, 4, 0, 2, 63, 118, 28, 22], ["+", 12, 2, 3, 4, 0, 2, 63, 118, 17, 131], ["+", 12, 2, 3, 4, 0, 2, 63, 118, 119, 120], ["+", 12, 2, 3, 4, 0, 2, 3, 4, 0, 24], ["+", 12, 2, 3, 4, 0, ...
1
1,526
import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Deque; import java.util.List; public class Main { private static void solve() { int n = ni(); int[] a = na(n); int[] from = new int[n - 1]; int[] to = new int[n - 1]; for (int i = 0; i < n - 1; i++) { from[i] = ni(...
import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Deque; import java.util.List; public class Main { private static void solve() { int n = ni(); int[] a = na(n); int[] from = new int[n - 1]; int[] to = new int[n - 1]; for (int i = 0; i < n - 1; i++) { from[i] = ni(...
[["-", 0, 195, 8, 196, 0, 503, 49, 200, 51, 499], ["+", 8, 196, 0, 503, 49, 200, 51, 91, 17, 33], ["+", 8, 196, 0, 503, 49, 200, 51, 91, 439, 499]]
3
1,246
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <set> #include <string> #include <unordered_map> #include <unordered_set> #include <vector> using namespace std; #define int long long vector<int> a; vector<vector<int>> g; vector<int> ans; struct seg_tree_max { vector<int> tree; ...
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <set> #include <string> #include <unordered_map> #include <unordered_set> #include <vector> using namespace std; #define int long long vector<int> a; vector<vector<int>> g; vector<int> ans; struct seg_tree_max { vector<int> tree; ...
[["-", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13]]
1
964
#include <bits/stdc++.h> using namespace std; #define FAST ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0); #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; #define ordered_set \ tree<int, nu...
#include <bits/stdc++.h> using namespace std; #define FAST ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0); #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; #define ordered_set \ tree<int, nu...
[["-", 0, 30, 0, 43, 49, 50, 51, 16, 12, 13], ["+", 0, 30, 0, 43, 49, 50, 51, 16, 12, 13], ["+", 3, 4, 0, 69, 341, 342, 0, 69, 28, 22], ["+", 0, 69, 341, 342, 0, 69, 341, 342, 0, 70], ["+", 0, 69, 341, 342, 0, 69, 341, 342, 0, 73]]
1
1,457
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using P = pair<ll, ll>; #define rep(i, n) for (int(i) = 0; (i) < (n); (i)++) #define rep2(i, m, n) for (int(i) = (m); (i) < (n); (i)++) #define ALL(obj) (obj).begin(), (obj).end() #define rALL(obj) (obj).rbegin(), (obj).rend() c...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using P = pair<ll, ll>; #define rep(i, n) for (int(i) = 0; (i) < (n); (i)++) #define rep2(i, m, n) for (int(i) = (m); (i) < (n); (i)++) #define ALL(obj) (obj).begin(), (obj).end() #define rALL(obj) (obj).rbegin(), (obj).rend() c...
[["-", 8, 9, 0, 43, 49, 50, 51, 2, 63, 22], ["+", 8, 9, 0, 43, 49, 50, 51, 2, 63, 22]]
1
382
// Author :: ABHINAV3010 :: #include <bits/stdc++.h> using namespace std; #define fi first #define se second #define pb push_back #define endl "\n" #define all(x) (x).begin(), (x).end() #define fast \ ios_base::sync_with_stdio(false); ...
// Author :: ABHINAV3010 :: #include <bits/stdc++.h> using namespace std; #define fi first #define se second #define pb push_back #define endl "\n" #define all(x) (x).begin(), (x).end() #define fast \ ios_base::sync_with_stdio(false); ...
[["-", 49, 53, 54, 55, 0, 56, 39, 344, 141, 78], ["+", 49, 53, 54, 55, 0, 56, 39, 344, 141, 78], ["-", 0, 14, 8, 9, 0, 43, 39, 344, 141, 78], ["+", 0, 14, 8, 9, 0, 43, 39, 344, 141, 78]]
1
608
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define drep(i, n) for (int i = (n)-1; i >= 0; --i) #define srep(i, s, t) for (int i = s; i < t; ++i) using namespace std; typedef long long int ll; typedef pair<int, int> P; #define yn ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define drep(i, n) for (int i = (n)-1; i >= 0; --i) #define srep(i, s, t) for (int i = s; i < t; ++i) using namespace std; typedef long long int ll; typedef pair<int, int> P; #define yn ...
[["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
1
488
#define _USE_MATH_DEFINES #include <bits/stdc++.h> using namespace std; typedef long long LL; typedef long double LD; typedef pair<int, int> PII; typedef pair<LL, LL> PLL; typedef pair<LD, LD> PDD; #define all(x) (x).begin(), (x).end() #define sz(x) (int)(x).size() #define dbl(k, x) fixed << setprecision(k) << (x) t...
#define _USE_MATH_DEFINES #include <bits/stdc++.h> using namespace std; typedef long long LL; typedef long double LD; typedef pair<int, int> PII; typedef pair<LL, LL> PLL; typedef pair<LD, LD> PDD; #define all(x) (x).begin(), (x).end() #define sz(x) (int)(x).size() #define dbl(k, x) fixed << setprecision(k) << (x) t...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18]]
1
593
/* [abc165] F - LIS on Tree */ #include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef pair<int, int> pii; typedef pair<ll, int> pli; typedef pair<ll, ll> pll; #define ALL(c) (c).begin(), (c).end() const int MAX_N = 2e5; const int INF = 1e9 + 7; int N; int a[MAX_N]; vector<int> g[MAX_N]; int ...
/* [abc165] F - LIS on Tree */ #include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef pair<int, int> pii; typedef pair<ll, int> pli; typedef pair<ll, ll> pll; #define ALL(c) (c).begin(), (c).end() const int MAX_N = 2e5; const int INF = 1e9 + 7; int N; int a[MAX_N]; vector<int> g[MAX_N]; int ...
[["-", 0, 43, 49, 50, 51, 16, 31, 2, 63, 22], ["+", 0, 43, 49, 50, 51, 16, 31, 2, 63, 22]]
1
352
/*input 10 1 2 5 3 4 6 7 3 2 4 1 2 2 3 3 4 4 5 3 6 6 7 1 8 8 9 9 10 */ /* ______________ | ) | ) / ...
/*input 10 1 2 5 3 4 6 7 3 2 4 1 2 2 3 3 4 4 5 3 6 6 7 1 8 8 9 9 10 */ /* ______________ | ) | ) / ...
[["-", 3, 4, 0, 83, 0, 69, 341, 342, 0, 22], ["+", 3, 4, 0, 83, 0, 69, 341, 342, 0, 22]]
1
935
#include <bits/stdc++.h> using namespace std; #define li long long int #define rep(i, to) for (li i = 0; i < ((li)(to)); i++) #define repp(i, start, to) for (li i = (li)(start); i < ((li)(to)); i++) #define pb push_back #define sz(v) ((li)(v).size()) #define bgn(v) ((v).begin()) #define eend(v) ((v).end()) #define all...
#include <bits/stdc++.h> using namespace std; #define li long long int #define rep(i, to) for (li i = 0; i < ((li)(to)); i++) #define repp(i, start, to) for (li i = (li)(start); i < ((li)(to)); i++) #define pb push_back #define sz(v) ((li)(v).size()) #define bgn(v) ((v).begin()) #define eend(v) ((v).end()) #define all...
[["-", 0, 1, 0, 2, 3, 4, 0, 69, 28, 22], ["-", 0, 2, 3, 4, 0, 69, 341, 342, 0, 70], ["-", 0, 2, 3, 4, 0, 69, 341, 342, 0, 22], ["-", 0, 2, 3, 4, 0, 69, 341, 342, 0, 73], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["-", 0, 43, 49, 50, 51, 4, 0, 16, 17, 72], ["+", 0, 43, 49, 50, 51, 4, 0, 16, 17, 48]]
1
1,159
#include <stdio.h> #include <stdlib.h> #define INF 1111111111 #define KI_MAX (1 << 18) /* 262144 */ int ki[KI_MAX * 2 - 1]; void ki_set(int idx, int value) { int pos = KI_MAX - 1 + idx; ki[pos] = value; do { pos = (pos - 1) / 2; ki[pos] = ki[pos * 2 + 1] < ki[pos * 2 + 2] ? ki[pos * 2 + 1] : k...
#include <stdio.h> #include <stdlib.h> #define INF 1111111111 #define KI_MAX (1 << 18) /* 262144 */ int ki[KI_MAX * 2 - 1]; void ki_set(int idx, int value) { int pos = KI_MAX - 1 + idx; ki[pos] = value; do { pos = (pos - 1) / 2; ki[pos] = ki[pos * 2 + 1] < ki[pos * 2 + 2] ? ki[pos * 2 + 1] : k...
[["-", 0, 14, 8, 9, 0, 1, 0, 11, 12, 22], ["+", 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, 22], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 25]]
0
718
/// 11:57 AM 02/05/20 /// Author: t_bone_289 (An Immature Programmer.... I'm still developing !!) #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/trie_policy.hpp> using namespace std; using namespace __gnu_pbds; #define pll pair<ll, ll> #define fi first #define se second #define m...
/// 11:57 AM 02/05/20 /// Author: t_bone_289 (An Immature Programmer.... I'm still developing !!) #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/trie_policy.hpp> using namespace std; using namespace __gnu_pbds; #define pll pair<ll, ll> #define fi first #define se second #define m...
[["-", 36, 36, 36, 36, 0, 30, 0, 134, 49, 78], ["+", 36, 36, 36, 36, 0, 30, 0, 134, 49, 78], ["-", 49, 53, 54, 55, 0, 56, 39, 344, 141, 78], ["+", 49, 53, 54, 55, 0, 56, 39, 344, 141, 78], ["-", 0, 14, 8, 9, 0, 43, 39, 344, 141, 78], ["+", 0, 14, 8, 9, 0, 43, 39, 344, 141, 78]]
1
743
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <iostream> #include <map> #include <queue> #include <string> #include <tuple> #include <vector> using namespace std; #define int long long #define rep(i, n) for (int i = 0; i < n; ++i) #define rep1(i, n) for (int i = 1; i <= n; ++i) #de...
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <iostream> #include <map> #include <queue> #include <string> #include <tuple> #include <vector> using namespace std; #define int long long #define rep(i, n) for (int i = 0; i < n; ++i) #define rep1(i, n) for (int i = 1; i <= n; ++i) #de...
[["-", 64, 9, 0, 43, 49, 50, 51, 2, 63, 22], ["+", 64, 9, 0, 43, 49, 50, 51, 2, 63, 22]]
1
686
from bisect import bisect from sys import setrecursionlimit setrecursionlimit(10000000) N = int(input()) A = tuple(map(int,input().split())) adj = [list() for _ in range(N)] for _ in range(N-1): a,b = map(int,input().split()) a,b = a-1,b-1 adj[a].append(b) adj[b].append(a) res = [None]*N dp = [float...
from bisect import bisect from sys import setrecursionlimit setrecursionlimit(10000000) N = int(input()) A = tuple(map(int,input().split())) adj = [list() for _ in range(N)] for _ in range(N-1): a,b = map(int,input().split()) a,b = a-1,b-1 adj[a].append(b) adj[b].append(a) res = [None]*N dp = [float...
[["+", 0, 662, 12, 652, 3, 4, 0, 657, 17, 33], ["+", 0, 662, 12, 652, 3, 4, 0, 657, 12, 612]]
5
226
#include <bits/stdc++.h> using namespace std; #define MAX 200005 int val[MAX], ans[MAX]; vector<int> adj[MAX]; int n; vector<int> v; vector<pair<int, int>> change; void update(int x) { int sz = (int)v.size(); if (sz == 0 || x > v[sz - 1]) { v.push_back(x); change.push_back(make_pair(-1, -1)); return;...
#include <bits/stdc++.h> using namespace std; #define MAX 200005 int val[MAX], ans[MAX]; vector<int> adj[MAX]; int n; vector<int> v; vector<pair<int, int>> change; void update(int x) { int sz = (int)v.size(); if (sz == 0 || x > v[sz - 1]) { v.push_back(x); change.push_back(make_pair(-1, -1)); return;...
[["-", 0, 43, 49, 50, 51, 16, 31, 2, 63, 22], ["+", 0, 43, 49, 50, 51, 16, 31, 2, 63, 22], ["+", 8, 9, 0, 7, 15, 16, 12, 74, 0, 24], ["+", 0, 7, 15, 16, 12, 74, 39, 77, 39, 40], ["+", 8, 9, 0, 7, 15, 16, 12, 74, 0, 25]]
1
446
import sys input = sys.stdin.buffer.readline sys.setrecursionlimit(10 ** 7) from heapq import heappush, heappop from bisect import bisect_left, bisect_right from collections import deque, defaultdict from itertools import combinations, permutations from itertools import accumulate from math import ceil, sqrt, pi def...
import sys input = sys.stdin.buffer.readline sys.setrecursionlimit(10 ** 7) from heapq import heappush, heappop from bisect import bisect_left, bisect_right from collections import deque, defaultdict from itertools import combinations, permutations from itertools import accumulate from math import ceil, sqrt, pi def...
[["+", 0, 656, 0, 14, 8, 196, 0, 57, 0, 121], ["+", 0, 656, 0, 14, 8, 196, 0, 57, 15, 22], ["+", 0, 656, 0, 14, 8, 196, 0, 57, 0, 102]]
5
362
#include "bits/stdc++.h" using namespace std; using LL = long long; constexpr int N = 2e5 + 5; int n; int a[N]; vector<int> E[N]; int before[N]; int ans[N]; set<int> st; void dfs(int x, int p = -1) { auto it = st.lower_bound(a[x]); if (it == st.end()) { before[x] = -1; } else { before[x] = *it; ...
#include "bits/stdc++.h" using namespace std; using LL = long long; constexpr int N = 2e5 + 5; int n; int a[N]; vector<int> E[N]; int before[N]; int ans[N]; set<int> st; void dfs(int x, int p = -1) { auto it = st.lower_bound(a[x]); if (it == st.end()) { before[x] = -1; } else { before[x] = *it; ...
[["+", 0, 1, 0, 2, 3, 4, 0, 69, 28, 22], ["+", 0, 2, 3, 4, 0, 69, 341, 342, 0, 70], ["+", 0, 2, 3, 4, 0, 69, 341, 342, 0, 73]]
1
320
#include <bits/stdc++.h> using namespace std; #define fi first #define se second #define all(x) (x).begin(), (x).end() #define endl '\n' typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef pair<double, int> pdi; const ll INF = 2e18; const int MOD = 1e9 + 7; const int MAXN = 2e5 + 5; ...
#include <bits/stdc++.h> using namespace std; #define fi first #define se second #define all(x) (x).begin(), (x).end() #define endl '\n' typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef pair<double, int> pdi; const ll INF = 2e18; const int MOD = 1e9 + 7; const int MAXN = 2e5 + 5; ...
[["-", 12, 2, 3, 4, 0, 69, 341, 342, 0, 22], ["+", 12, 2, 3, 4, 0, 69, 341, 342, 0, 22]]
1
641