output stringlengths 52 181k | instruction stringlengths 296 182k |
|---|---|
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const long long EPS = 0;
template <class T>
struct cplx {
T x, y;
cplx() {
x = 0.0;
y = 0.0;
}
cplx(T nx, T ny = 0) {
x = nx;
y = ny;
}
cplx operator+(const cplx& c) const { return {x + c.x, y ... | ### Prompt
Your task is to create a Cpp solution to the following problem:
After the war, the supersonic rocket became the most common public transportation.
Each supersonic rocket consists of two "engines". Each engine is a set of "power sources". The first engine has n power sources, and the second one has m power... |
#include <bits/stdc++.h>
using namespace std;
template <typename T>
pair<T, T> operator-(pair<T, T> a, pair<T, T> b) {
return make_pair(a.first - b.first, a.second - b.second);
}
template <typename T>
T cross(pair<T, T> a, pair<T, T> b) {
return a.first * b.second - a.second * b.first;
}
template <typename T>
T dis... | ### Prompt
Your challenge is to write a CPP solution to the following problem:
After the war, the supersonic rocket became the most common public transportation.
Each supersonic rocket consists of two "engines". Each engine is a set of "power sources". The first engine has n power sources, and the second one has m p... |
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target( \
"sse,sse2,sse3,ssse3,sse4,sse4.1,sse4.2,popcnt,abm,mmx,avx,tune=native")
using namespace std;
const int MOD = 1000000007;
const int UNDEF = -1;
const int INF = 1 << 30;
template <typename T>
inline bool chkmax(T &aa, T bb) {
return aa < ... | ### Prompt
Please formulate a cpp solution to the following problem:
After the war, the supersonic rocket became the most common public transportation.
Each supersonic rocket consists of two "engines". Each engine is a set of "power sources". The first engine has n power sources, and the second one has m power sourc... |
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 2;
const int INF = 1e9 + 7;
const double EPS = 1e-10;
struct Point {
int x, y;
Point() {}
Point(int x, int y) : x(x), y(y) {}
friend Point operator-(Point p1, Point p2) {
return Point(p1.x - p2.x, p1.y - p2.y);
}
friend bool operator<(Poi... | ### Prompt
Your challenge is to write a CPP solution to the following problem:
After the war, the supersonic rocket became the most common public transportation.
Each supersonic rocket consists of two "engines". Each engine is a set of "power sources". The first engine has n power sources, and the second one has m p... |
#include <bits/stdc++.h>
using namespace std;
struct dn {
int x, y;
} a[100001], b[100001];
dn operator-(dn u, dn v) { return (dn){u.x - v.x, u.y - v.y}; }
long long operator*(dn u, dn v) { return 1ll * u.x * v.y - 1ll * v.x * u.y; }
long long cd(dn u, dn v) { return 1ll * u.x * v.x + 1ll * u.y * v.y; }
bool cmp(dn u... | ### Prompt
Your challenge is to write a cpp solution to the following problem:
After the war, the supersonic rocket became the most common public transportation.
Each supersonic rocket consists of two "engines". Each engine is a set of "power sources". The first engine has n power sources, and the second one has m p... |
#include <bits/stdc++.h>
using namespace std;
const int N = (int)1e5 + 100;
struct Point {
long long x, y;
Point() {}
Point(long long _x, long long _y) : x(_x), y(_y) {}
Point operator+(const Point &a) const { return Point(x + a.x, y + a.y); }
Point operator-(const Point &a) const { return Point(x - a.x, y - ... | ### Prompt
Develop a solution in CPP to the problem described below:
After the war, the supersonic rocket became the most common public transportation.
Each supersonic rocket consists of two "engines". Each engine is a set of "power sources". The first engine has n power sources, and the second one has m power sourc... |
#include <bits/stdc++.h>
using namespace std;
struct coord_t {
long long x, y;
coord_t() = default;
coord_t(long long x, long long y) : x(x), y(y) {}
bool operator<(const coord_t& that) const {
return x < that.x || (x == that.x && y < that.y);
}
bool operator==(const coord_t& that) const {
return x ... | ### Prompt
Your challenge is to write a Cpp solution to the following problem:
After the war, the supersonic rocket became the most common public transportation.
Each supersonic rocket consists of two "engines". Each engine is a set of "power sources". The first engine has n power sources, and the second one has m p... |
#include <bits/stdc++.h>
using ul = std::uint32_t;
using li = std::int32_t;
using ull = std::uint64_t;
using ll = std::int64_t;
using vul = std::vector<ul>;
using vvul = std::vector<vul>;
using vb = std::vector<bool>;
using vvb = std::vector<vb>;
using vvvb = std::vector<vvb>;
using vull = std::vector<ull>;
using vvull... | ### Prompt
Construct a Cpp code solution to the problem outlined:
After the war, the supersonic rocket became the most common public transportation.
Each supersonic rocket consists of two "engines". Each engine is a set of "power sources". The first engine has n power sources, and the second one has m power sources.... |
#include <bits/stdc++.h>
using namespace std;
int n, m;
struct tuhla {
long long x, y;
tuhla() { x = y = 0; }
tuhla(long long _x, long long _y) {
x = _x;
y = _y;
}
};
bool cmp(tuhla p1, tuhla p2) {
if (p1.x == p2.x) {
return (p1.y < p2.y);
}
return (p1.x < p2.x);
}
vector<tuhla> a, b;
vector<t... | ### Prompt
Develop a solution in cpp to the problem described below:
After the war, the supersonic rocket became the most common public transportation.
Each supersonic rocket consists of two "engines". Each engine is a set of "power sources". The first engine has n power sources, and the second one has m power sourc... |
#include <bits/stdc++.h>
using namespace std;
long long disll(pair<int, int> a, pair<int, int> b) {
return 1LL * (a.first - b.first) * (a.first - b.first) +
1LL * (a.second - b.second) * (a.second - b.second);
}
long long ccw(pair<int, int> i, pair<int, int> j, pair<int, int> k) {
return 1LL * (j.first - i... | ### Prompt
Develop a solution in Cpp to the problem described below:
After the war, the supersonic rocket became the most common public transportation.
Each supersonic rocket consists of two "engines". Each engine is a set of "power sources". The first engine has n power sources, and the second one has m power sourc... |
#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 7;
const long long INFL = 1e18 + 123;
const double PI = atan2(0, -1);
mt19937 tw(960172);
long long rnd(long long x, long long y) {
static uniform_int_distribution<long long> d;
return d(tw) % (y - x + 1) + x;
}
struct point {
int x, y;
point(i... | ### Prompt
Create a solution in CPP for the following problem:
After the war, the supersonic rocket became the most common public transportation.
Each supersonic rocket consists of two "engines". Each engine is a set of "power sources". The first engine has n power sources, and the second one has m power sources. A ... |
#include <bits/stdc++.h>
using namespace std;
long long sgn(long long a) {
if (a < 0)
return -1;
else
return 1;
}
struct pt {
long long x;
long long y;
pt(long long x, long long y) : x(x), y(y) {}
pt() {}
pt operator+(const pt& other) const {
return pt(this->x + other.x, this->y + other.y);
... | ### Prompt
Please provide a Cpp coded solution to the problem described below:
After the war, the supersonic rocket became the most common public transportation.
Each supersonic rocket consists of two "engines". Each engine is a set of "power sources". The first engine has n power sources, and the second one has m p... |
#include <bits/stdc++.h>
using namespace std;
long long n, m, p1 = 131, p2 = 1000000007, pr[500005];
pair<long long, long long> coa[500005], cob[500005];
pair<pair<long long, long long>, long long> ugha[500005], ughb[500005];
long long crs(pair<long long, long long> a, pair<long long, long long> b,
pair<l... | ### Prompt
Please formulate a Cpp solution to the following problem:
After the war, the supersonic rocket became the most common public transportation.
Each supersonic rocket consists of two "engines". Each engine is a set of "power sources". The first engine has n power sources, and the second one has m power sourc... |
#include <bits/stdc++.h>
using namespace std;
const int N_MAX = 1e5 + 5;
const int INF = 1e9 + 5;
struct point {
int x, y;
point(int _x = 0, int _y = 0) : x(_x), y(_y) {}
point &operator+=(const point &other) {
x += other.x;
y += other.y;
return *this;
}
point &operator-=(const point &other) {
... | ### Prompt
Your task is to create a CPP solution to the following problem:
After the war, the supersonic rocket became the most common public transportation.
Each supersonic rocket consists of two "engines". Each engine is a set of "power sources". The first engine has n power sources, and the second one has m power... |
#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 123, inf = 1e9, mod = 1e9 + 7;
const double eps = 1e-9;
struct pt {
int x, y;
};
bool cmp(pt a, pt b) { return a.x < b.x || a.x == b.x && a.y < b.y; }
bool cw(pt a, pt b, pt c) {
return 1ll * a.x * (b.y - c.y) + 1ll * b.x * (c.y - a.y) +
... | ### Prompt
Please create a solution in Cpp to the following problem:
After the war, the supersonic rocket became the most common public transportation.
Each supersonic rocket consists of two "engines". Each engine is a set of "power sources". The first engine has n power sources, and the second one has m power sourc... |
#include <bits/stdc++.h>
using namespace std;
using namespace placeholders;
template <class T>
void mini(T& l, T r) {
l = min(l, r);
}
template <class T>
void maxi(T& l, T r) {
l = max(l, r);
}
template <class TH>
void _dbg(const char* sdbg, TH h) {
cerr << sdbg << "=" << h << "\n";
}
template <class TH, class...... | ### Prompt
Please provide a CPP coded solution to the problem described below:
After the war, the supersonic rocket became the most common public transportation.
Each supersonic rocket consists of two "engines". Each engine is a set of "power sources". The first engine has n power sources, and the second one has m p... |
#include <bits/stdc++.h>
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
void JIZZ(string output = "") {
cout << output;
exit(0);
}
const long double PI = 3.14159265358979323846264338327950288;
const long double eps = 1e-13;
long long mods[] = {1000000000 + 7, 1... | ### Prompt
Please create a solution in CPP to the following problem:
After the war, the supersonic rocket became the most common public transportation.
Each supersonic rocket consists of two "engines". Each engine is a set of "power sources". The first engine has n power sources, and the second one has m power sourc... |
#include <bits/stdc++.h>
using namespace std;
const double pi = 3.1415926535897;
const double eps = 1e-8;
inline int read() {
int x = 0, sgn = 1;
char ch = getchar();
for (; !isdigit(ch); ch = getchar())
if (ch == '-') sgn = -1;
for (; isdigit(ch); ch = getchar()) x = (x << 1) + (x << 3) + (ch ^ 48);
retu... | ### Prompt
In CPP, your task is to solve the following problem:
After the war, the supersonic rocket became the most common public transportation.
Each supersonic rocket consists of two "engines". Each engine is a set of "power sources". The first engine has n power sources, and the second one has m power sources. A... |
#include <bits/stdc++.h>
using namespace std;
const long double EPS = 1e-6;
struct Point {
long long x, y;
Point(long long int x, long long int y) : x(x), y(y) {}
Point() {}
Point operator-(Point p) { return {x - p.x, y - p.y}; }
Point operator+(Point p) { return {x + p.x, y + p.y}; }
};
long long cross(Point... | ### Prompt
Construct a Cpp code solution to the problem outlined:
After the war, the supersonic rocket became the most common public transportation.
Each supersonic rocket consists of two "engines". Each engine is a set of "power sources". The first engine has n power sources, and the second one has m power sources.... |
#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9;
const double eps = 1e-6;
const double pi = acos(-1.0);
double radToDeg(double theta) { return theta * 180.0 / pi; }
pair<double, double> toVec(pair<double, double>& a, pair<double, double>& b) {
return pair<double, double>(b.first - a.first, b.second ... | ### Prompt
Develop a solution in cpp to the problem described below:
After the war, the supersonic rocket became the most common public transportation.
Each supersonic rocket consists of two "engines". Each engine is a set of "power sources". The first engine has n power sources, and the second one has m power sourc... |
#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3F3F3F3F;
const int MOD = 1e9 + 7;
const int MAX = 1e5 + 5;
int N, M;
pair<int, int> pts1[MAX], pts2[MAX];
stack<pair<int, int> > h1, h2;
vector<double> hull1, hull2;
int lps[2 * MAX];
inline long long int orientation(pair<int, int> a, pair<int, int> b,
... | ### Prompt
Create a solution in CPP for the following problem:
After the war, the supersonic rocket became the most common public transportation.
Each supersonic rocket consists of two "engines". Each engine is a set of "power sources". The first engine has n power sources, and the second one has m power sources. A ... |
#include <bits/stdc++.h>
using namespace std;
const long long N = 100007;
bool cmp(pair<long long, long long> x, pair<long long, long long> y) {
if (x.first < y.first) return 1;
if (x.first > y.first) return 0;
return x.second < y.second;
}
long long Area(pair<long long, long long> a, pair<long long, long long> b... | ### Prompt
Please formulate a Cpp solution to the following problem:
After the war, the supersonic rocket became the most common public transportation.
Each supersonic rocket consists of two "engines". Each engine is a set of "power sources". The first engine has n power sources, and the second one has m power sourc... |
#include <bits/stdc++.h>
int sgn(const long long &x) { return x < 0 ? -1 : x > 0; }
int cmp(const long long &x, const long long &y) { return sgn(x - y); }
long long sqr(const long long &x) { return x * x; }
struct point {
long long x, y;
explicit point(const long long &x = 0, const long long &y = 0) : x(x), y(y) {}... | ### Prompt
Please formulate a cpp solution to the following problem:
After the war, the supersonic rocket became the most common public transportation.
Each supersonic rocket consists of two "engines". Each engine is a set of "power sources". The first engine has n power sources, and the second one has m power sourc... |
#include <bits/stdc++.h>
using namespace std;
template <typename T>
using maxHeap = priority_queue<T, vector<T>, less<T>>;
template <typename T>
using minHeap = priority_queue<T, vector<T>, greater<T>>;
template <typename Iter>
ostream& _out(ostream& s, Iter b, Iter e) {
s << "[";
for (auto it = b; it != e; it++) s... | ### Prompt
Please formulate a CPP solution to the following problem:
After the war, the supersonic rocket became the most common public transportation.
Each supersonic rocket consists of two "engines". Each engine is a set of "power sources". The first engine has n power sources, and the second one has m power sourc... |
#include <bits/stdc++.h>
using namespace std;
using lld = int64_t;
struct PT {
lld x, y;
PT() : x(0), y(0) {}
PT(lld a, lld b) : x(a), y(b) {}
PT operator-(const PT& a) const { return PT(x - a.x, y - a.y); }
};
lld dot(const PT& a, const PT& b) { return a.x * b.x + a.y * b.y; }
lld cross(const PT& a, const PT& ... | ### Prompt
Create a solution in cpp for the following problem:
After the war, the supersonic rocket became the most common public transportation.
Each supersonic rocket consists of two "engines". Each engine is a set of "power sources". The first engine has n power sources, and the second one has m power sources. A ... |
#include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
using namespace std;
clock_t timeStart, timeFinish;
void timeBegin() { timeStart = clock(); }
void timeEnd() { timeFinish = clock(); }
void timeDuration() {
timeEnd();
double time_taken = doub... | ### Prompt
Create a solution in Cpp for the following problem:
After the war, the supersonic rocket became the most common public transportation.
Each supersonic rocket consists of two "engines". Each engine is a set of "power sources". The first engine has n power sources, and the second one has m power sources. A ... |
#include <bits/stdc++.h>
using namespace std;
struct Point {
long long x, y;
Point() {}
Point(long long x, long long y) : x(x), y(y) {}
Point operator-(const Point &o) const { return {x - o.x, y - o.y}; }
bool operator<(const Point &o) const { return tie(x, y) < tie(o.x, o.y); }
bool operator==(const Point ... | ### Prompt
Develop a solution in cpp to the problem described below:
After the war, the supersonic rocket became the most common public transportation.
Each supersonic rocket consists of two "engines". Each engine is a set of "power sources". The first engine has n power sources, and the second one has m power sourc... |
#include <bits/stdc++.h>
using namespace std;
const long long N = 1e5 + 5;
struct data {
long long len, dot, cross;
data() {}
data(long long len, long long dot, long long cross)
: len(len), dot(dot), cross(cross) {}
bool operator==(const data &d) const {
return (len == d.len && dot == d.dot && cross =... | ### Prompt
Construct a CPP code solution to the problem outlined:
After the war, the supersonic rocket became the most common public transportation.
Each supersonic rocket consists of two "engines". Each engine is a set of "power sources". The first engine has n power sources, and the second one has m power sources.... |
#include <bits/stdc++.h>
using namespace std;
const long long B = 5051;
const long long M = 1e9 + 9;
long long n, m;
vector<pair<long long, long long> > p, q;
pair<long long, long long> operator-(pair<long long, long long> a,
pair<long long, long long> b) {
return make_pair(a.firs... | ### Prompt
Develop a solution in CPP to the problem described below:
After the war, the supersonic rocket became the most common public transportation.
Each supersonic rocket consists of two "engines". Each engine is a set of "power sources". The first engine has n power sources, and the second one has m power sourc... |
#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e5 + 10;
const int MOD = 1e9 + 7;
struct Point {
long long x, y;
void show() { cout << "(" << x << "," << y << ")" << endl; }
} a[MAX], b[MAX], A[MAX], B[MAX];
Point operator+(Point A, Point B) { return (Point){A.x + B.x, A.y + B.y}; }
Point operator-(P... | ### Prompt
Your challenge is to write a Cpp solution to the following problem:
After the war, the supersonic rocket became the most common public transportation.
Each supersonic rocket consists of two "engines". Each engine is a set of "power sources". The first engine has n power sources, and the second one has m p... |
#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:256000000")
using namespace std;
const long double PI = 3.14159265358979323846;
const long double eps = 1e-5;
const int INF = numeric_limits<int>::max();
const long long LINF = numeric_limits<long long>::max();
const long long mod = 1000 * 1000 * 1000 + 7;
bool c... | ### Prompt
Please create a solution in cpp to the following problem:
After the war, the supersonic rocket became the most common public transportation.
Each supersonic rocket consists of two "engines". Each engine is a set of "power sources". The first engine has n power sources, and the second one has m power sourc... |
#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-10;
bool dcmp(double x, double y = 0) { return fabs(x - y) <= EPS; }
double add(double a, double b) {
if (abs(a + b) < EPS * (abs(a) + abs(b))) return 0;
return a + b;
}
struct P {
double x, y;
P() {}
P(double x, double y) : x(x), y(y) {}
P... | ### Prompt
Your challenge is to write a Cpp solution to the following problem:
After the war, the supersonic rocket became the most common public transportation.
Each supersonic rocket consists of two "engines". Each engine is a set of "power sources". The first engine has n power sources, and the second one has m p... |
#include <bits/stdc++.h>
using namespace std;
void doRoutine() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
}
const long long INF = 2000000000000000000;
pair<long long, long long> foot;
pair<long long, long long> vec(pair<long long, long long> a,
pair<long long, long... | ### Prompt
Please provide a CPP coded solution to the problem described below:
After the war, the supersonic rocket became the most common public transportation.
Each supersonic rocket consists of two "engines". Each engine is a set of "power sources". The first engine has n power sources, and the second one has m p... |
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,fast-math")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma comment(linker, "/STACK:16777216")
using namespace std;
using matrix = vector<vector<long long>>;
void FAST_IO() {
ios_base::sync_with_... | ### Prompt
Your challenge is to write a cpp solution to the following problem:
After the war, the supersonic rocket became the most common public transportation.
Each supersonic rocket consists of two "engines". Each engine is a set of "power sources". The first engine has n power sources, and the second one has m p... |
#include <bits/stdc++.h>
using namespace std;
struct R2vec {
int x, y;
R2vec() {}
R2vec(int x, int y) : x(x), y(y) {}
inline R2vec operator+(const R2vec &w) { return R2vec(x + w.x, y + w.y); }
inline R2vec operator-(const R2vec &w) { return R2vec(x - w.x, y - w.y); }
inline R2vec operator-() { return R2vec(... | ### Prompt
Create a solution in cpp for the following problem:
After the war, the supersonic rocket became the most common public transportation.
Each supersonic rocket consists of two "engines". Each engine is a set of "power sources". The first engine has n power sources, and the second one has m power sources. A ... |
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const long double EPS = 1e-7;
long double cp(const complex<long double>& a, const complex<long double>& b) {
return imag(conj(a) * b);
}
long double dp(const complex<long double>& a, const complex<long double>& b) {
r... | ### Prompt
Create a solution in CPP for the following problem:
After the war, the supersonic rocket became the most common public transportation.
Each supersonic rocket consists of two "engines". Each engine is a set of "power sources". The first engine has n power sources, and the second one has m power sources. A ... |
#include <bits/stdc++.h>
using namespace std;
struct Point {
long long x, y;
Point() = default;
Point(long long x, long long y) : x(x), y(y) {}
Point operator-(Point other) const { return Point(x - other.x, y - other.y); }
bool operator<(Point other) const {
return make_pair(x, y) < make_pair(other.x, oth... | ### Prompt
Create a solution in Cpp for the following problem:
After the war, the supersonic rocket became the most common public transportation.
Each supersonic rocket consists of two "engines". Each engine is a set of "power sources". The first engine has n power sources, and the second one has m power sources. A ... |
#include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
using namespace std;
const double pi =
3.1415926535897932384626433832795028841971693993751058209749445... | ### Prompt
Your task is to create a cpp solution to the following problem:
After the war, the supersonic rocket became the most common public transportation.
Each supersonic rocket consists of two "engines". Each engine is a set of "power sources". The first engine has n power sources, and the second one has m power... |
#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-9;
const long long INFF = 1e18;
const int INF = 1e9;
const int mod = 1e9 + 7;
const int MAX = 1e5 + 7;
struct Point {
long long x, y;
Point(){};
Point(long long _x, long long _y) { x = _x, y = _y; }
void read() { scanf("%lld %lld", &x, &y); }
... | ### Prompt
Please provide a Cpp coded solution to the problem described below:
After the war, the supersonic rocket became the most common public transportation.
Each supersonic rocket consists of two "engines". Each engine is a set of "power sources". The first engine has n power sources, and the second one has m p... |
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using std::abs;
using std::cerr;
using std::cin;
using std::cout;
using std::map;
using std::max;
using std::min;
using std::pair;
using std::set... | ### Prompt
In CPP, your task is to solve the following problem:
After the war, the supersonic rocket became the most common public transportation.
Each supersonic rocket consists of two "engines". Each engine is a set of "power sources". The first engine has n power sources, and the second one has m power sources. A... |
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using pi = pair<int, int>;
lint ccw(pi a, pi b, pi c) {
int dx1 = b.first - a.first;
int dy1 = b.second - a.second;
int dx2 = c.first - a.first;
int dy2 = c.second - a.second;
return 1ll * dx1 * dy2 - 1ll * dy1 * dx2;
}
lint dist(pi a, pi b... | ### Prompt
Please provide a Cpp coded solution to the problem described below:
After the war, the supersonic rocket became the most common public transportation.
Each supersonic rocket consists of two "engines". Each engine is a set of "power sources". The first engine has n power sources, and the second one has m p... |
#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
struct Point {
long long x, y;
Point(long long x = 0, long long y = 0) : x(x), y(y) {}
Point operator-(const Point& r) const { return Point(x - r.x, y - r.y); }
bool operator<(const Point& r) const { return x == r.x ? y < r.y : x < r.x; }
};
se... | ### Prompt
Please formulate a cpp solution to the following problem:
After the war, the supersonic rocket became the most common public transportation.
Each supersonic rocket consists of two "engines". Each engine is a set of "power sources". The first engine has n power sources, and the second one has m power sourc... |
#include <bits/stdc++.h>
using namespace std;
const int inf = 0x7fffffff;
const double eps = 1e-10;
const double pi = acos(-1.0);
inline int read() {
int x = 0, f = 1;
char ch;
ch = getchar();
while (ch < '0' || ch > '9') {
if (ch == '-') f = 0;
ch = getchar();
}
while (ch >= '0' && ch <= '9') {
... | ### Prompt
Your challenge is to write a CPP solution to the following problem:
After the war, the supersonic rocket became the most common public transportation.
Each supersonic rocket consists of two "engines". Each engine is a set of "power sources". The first engine has n power sources, and the second one has m p... |
#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-9;
struct hh {
double x;
long long y;
bool operator==(const hh& b) const { return fabs(x - b.x) < eps && y == b.y; }
bool operator!=(const hh& b) const { return !((*this) == b); }
} a[100010 * 2], b[100010];
int n, m;
inline bool eq(int a, int ... | ### Prompt
Your challenge is to write a CPP solution to the following problem:
After the war, the supersonic rocket became the most common public transportation.
Each supersonic rocket consists of two "engines". Each engine is a set of "power sources". The first engine has n power sources, and the second one has m p... |
#include <bits/stdc++.h>
using namespace std;
struct Point {
double x, y;
Point(double x = 0, double y = 0) : x(x), y(y){};
} p[100010], q[100010];
Point operator-(Point A, Point B) { return Point(A.x - B.x, A.y - B.y); }
double operator*(Point A, Point B) { return A.x * B.x + A.y * B.y; }
bool operator==(Point A, ... | ### Prompt
Please formulate a Cpp solution to the following problem:
After the war, the supersonic rocket became the most common public transportation.
Each supersonic rocket consists of two "engines". Each engine is a set of "power sources". The first engine has n power sources, and the second one has m power sourc... |
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100005;
int n, m, top;
pair<int, int> c[MAXN];
pair<int, int> stk[MAXN];
long long MUL[MAXN << 2], MOD;
long long H[MAXN << 2];
long long mul[4] = {5767169, 23068673, 167772161, 1000000007};
long long prime[4] = {7340033, 104857601, 469762049, 1004535809};
... | ### Prompt
Please provide a Cpp coded solution to the problem described below:
After the war, the supersonic rocket became the most common public transportation.
Each supersonic rocket consists of two "engines". Each engine is a set of "power sources". The first engine has n power sources, and the second one has m p... |
#include <bits/stdc++.h>
using namespace std;
const int N = 400005;
long long read() {
long long x = 0;
char ch = getchar();
while (!isdigit(ch)) ch = getchar();
while (isdigit(ch)) x = (x << 1) + (x << 3) + ch - 48, ch = getchar();
return x;
}
int n, m;
struct Point {
int x, y;
} p1[N], p2[N], O;
long long... | ### Prompt
Please create a solution in Cpp to the following problem:
After the war, the supersonic rocket became the most common public transportation.
Each supersonic rocket consists of two "engines". Each engine is a set of "power sources". The first engine has n power sources, and the second one has m power sourc... |
#include <bits/stdc++.h>
using namespace std;
const int max_n = 100111, inf = 1000111222;
struct point {
int x, y;
point() { x = y = 0; }
point(int x, int y) : x(x), y(y) {}
void read() { scanf("%d%d", &x, &y); }
void write(string s = "") { printf("%d %d%s", x, y, s.c_str()); }
void write_point(string s = "... | ### Prompt
Please formulate a Cpp solution to the following problem:
After the war, the supersonic rocket became the most common public transportation.
Each supersonic rocket consists of two "engines". Each engine is a set of "power sources". The first engine has n power sources, and the second one has m power sourc... |
#include <bits/stdc++.h>
using namespace std;
struct pt {
long long x, y;
};
long long S(pt a, pt b, pt c) {
return a.x * (b.y - c.y) + b.x * (c.y - a.y) + c.x * (a.y - b.y);
}
bool cmp(pt a, pt b) { return a.x < b.x || a.x == b.x && a.y < b.y; }
bool cw(pt a, pt b, pt c) {
return a.x * (b.y - c.y) + b.x * (c.y -... | ### Prompt
Please formulate a cpp solution to the following problem:
After the war, the supersonic rocket became the most common public transportation.
Each supersonic rocket consists of two "engines". Each engine is a set of "power sources". The first engine has n power sources, and the second one has m power sourc... |
#include <bits/stdc++.h>
using namespace std;
struct Pt {
long long x, y;
Pt() {}
Pt(long long _x, long long _y) : x(_x), y(_y) {}
Pt operator+(const Pt &p) const { return Pt(x + p.x, y + p.y); }
Pt operator-(const Pt &p) const { return Pt(x - p.x, y - p.y); }
Pt operator*(long long c) const { return Pt(x *... | ### Prompt
Construct a cpp code solution to the problem outlined:
After the war, the supersonic rocket became the most common public transportation.
Each supersonic rocket consists of two "engines". Each engine is a set of "power sources". The first engine has n power sources, and the second one has m power sources.... |
#include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
const long double eps = 1e-12;
long double crossp(complex<long double> a, complex<long double> b) {
return (conj(a) * b)... | ### Prompt
Your challenge is to write a CPP solution to the following problem:
After the war, the supersonic rocket became the most common public transportation.
Each supersonic rocket consists of two "engines". Each engine is a set of "power sources". The first engine has n power sources, and the second one has m p... |
#include <bits/stdc++.h>
using namespace std;
const int N = 1E5 + 10;
struct Point {
int x, y;
Point(int _x = 0, int _y = 0) : x(_x), y(_y){};
bool operator<(const Point &other) const {
if (x != other.x) return x < other.x;
return y < other.y;
}
Point operator-(const Point &other) {
return Point(x... | ### Prompt
Develop a solution in CPP to the problem described below:
After the war, the supersonic rocket became the most common public transportation.
Each supersonic rocket consists of two "engines". Each engine is a set of "power sources". The first engine has n power sources, and the second one has m power sourc... |
#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-6;
struct point {
double x, y;
point() {}
point(double x, double y) : x(x), y(y) {}
};
point operator-(point a, point b) { return point(a.x - b.x, a.y - b.y); }
int dcmp(double x) { return fabs(x) < EPS ? 0 : (x > 0 ? 1 : -1); }
double Cross(poin... | ### Prompt
Please create a solution in cpp to the following problem:
After the war, the supersonic rocket became the most common public transportation.
Each supersonic rocket consists of two "engines". Each engine is a set of "power sources". The first engine has n power sources, and the second one has m power sourc... |
#include <bits/stdc++.h>
using namespace std;
template <typename T>
T getint() {
T x = 0, p = 1;
char ch;
do {
ch = getchar();
} while (ch <= ' ');
if (ch == '-') p = -1, ch = getchar();
while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
return x * p;
}
mt19937 gen(chrono::system_cl... | ### Prompt
Develop a solution in CPP to the problem described below:
After the war, the supersonic rocket became the most common public transportation.
Each supersonic rocket consists of two "engines". Each engine is a set of "power sources". The first engine has n power sources, and the second one has m power sourc... |
#include <bits/stdc++.h>
using namespace std;
const double eps = 0.0000000000001;
const int mod = 1000000007;
int n, m;
vector<double> cra;
vector<double> crb;
struct P {
long long x;
long long y;
P() {}
P(long long _x, long long _y) {
x = _x;
y = _y;
}
P operator-(const P &b) const { return P(x - b... | ### Prompt
Create a solution in cpp for the following problem:
After the war, the supersonic rocket became the most common public transportation.
Each supersonic rocket consists of two "engines". Each engine is a set of "power sources". The first engine has n power sources, and the second one has m power sources. A ... |
#include <bits/stdc++.h>
using namespace std;
typedef long long Di;
typedef double D;
int DEFAULT_PREC = 6;
const D EPS = 1e-9, PI = acos((D)-1.0);
const Di INF = 1010101010101010101ll;
inline int cmp(double a) { return a > EPS ? 1 : a >= -EPS ? 0 : -1; }
inline int cmp(long double a) { return a > EPS ? 1 : a >= -EPS ?... | ### Prompt
Your challenge is to write a Cpp solution to the following problem:
After the war, the supersonic rocket became the most common public transportation.
Each supersonic rocket consists of two "engines". Each engine is a set of "power sources". The first engine has n power sources, and the second one has m p... |
#include <bits/stdc++.h>
using namespace std;
template <class T>
T abs(T x) {
return x > 0 ? x : -x;
}
template <class T>
T gcd(T a, T b) {
return a ? gcd(b % a, a) : b;
}
template <class T>
T sqr(T a) {
return a * a;
}
template <class T>
T sgn(T a) {
return a > 0 ? 1 : (a < 0 ? -1 : 0);
}
const double pi = aco... | ### Prompt
Generate a cpp solution to the following problem:
After the war, the supersonic rocket became the most common public transportation.
Each supersonic rocket consists of two "engines". Each engine is a set of "power sources". The first engine has n power sources, and the second one has m power sources. A po... |
#include <bits/stdc++.h>
using namespace std;
const long long linf = 1LL << 62;
const int iinf = 1000000009;
const double dinf = 1e15;
const int Mod = 1e9 + 9;
const int maxn = 500005;
int dcmp(double x) {
if (fabs(x) <= 1e-15) return 0;
return x < 0 ? -1 : 1;
}
struct Point {
double x, y;
Point(double x = 0, d... | ### Prompt
Your challenge is to write a cpp solution to the following problem:
After the war, the supersonic rocket became the most common public transportation.
Each supersonic rocket consists of two "engines". Each engine is a set of "power sources". The first engine has n power sources, and the second one has m p... |
#include <bits/stdc++.h>
using namespace std;
struct pt {
long long x, y;
void scan() { scanf("%lld%lld", &x, &y); }
pt operator-(const pt &p) const { return {x - p.x, y - p.y}; }
pt operator+(pt &p) { return {x + p.x, y + p.y}; }
long long operator*(pt p) { return x * p.y - y * p.x; }
long long operator%(p... | ### Prompt
Your task is to create a Cpp solution to the following problem:
After the war, the supersonic rocket became the most common public transportation.
Each supersonic rocket consists of two "engines". Each engine is a set of "power sources". The first engine has n power sources, and the second one has m power... |
#include <bits/stdc++.h>
using namespace std;
const long long linf = 1LL << 62;
const int iinf = 1000000009;
const double dinf = 1e15;
const int Mod = 1e9 + 9;
const int maxn = 500005;
int dcmp(double x) {
if (fabs(x) <= 1e-15) return 0;
return x < 0 ? -1 : 1;
}
struct Point {
double x, y;
Point(double x = 0, d... | ### Prompt
Construct a cpp code solution to the problem outlined:
After the war, the supersonic rocket became the most common public transportation.
Each supersonic rocket consists of two "engines". Each engine is a set of "power sources". The first engine has n power sources, and the second one has m power sources.... |
#include <bits/stdc++.h>
using namespace std;
typedef long long Di;
typedef double D;
int DEFAULT_PREC = 6;
const D EPS = 1e-9, PI = acos((D)-1.0);
const Di INF = 1010101010101010101ll;
inline int cmp(double a) { return a > EPS ? 1 : a >= -EPS ? 0 : -1; }
inline int cmp(long double a) { return a > EPS ? 1 : a >= -EPS ?... | ### Prompt
Your task is to create a CPP solution to the following problem:
After the war, the supersonic rocket became the most common public transportation.
Each supersonic rocket consists of two "engines". Each engine is a set of "power sources". The first engine has n power sources, and the second one has m power... |
#include <bits/stdc++.h>
using namespace std;
inline bool eq(long long a, long long b) { return a == b; }
inline bool lt(long long a, long long b) { return a < b; }
inline bool le(long long a, long long b) { return a <= b; }
inline int sign(long long x) { return eq(x, 0) ? 0 : (x < 0 ? -1 : 1); }
struct point {
long ... | ### Prompt
Develop a solution in Cpp to the problem described below:
After the war, the supersonic rocket became the most common public transportation.
Each supersonic rocket consists of two "engines". Each engine is a set of "power sources". The first engine has n power sources, and the second one has m power sourc... |
#include <bits/stdc++.h>
using namespace std;
const int mod = (1e9) + 7;
const double eps = 1e-6;
const int siz = 1e5 + 5, siz2 = 1e5 + 5;
long long mul(long long a, long long b) { return a * b; }
struct point {
int x, y, i;
point min(point &p) {
if (x != p.x) {
if (x < p.x) {
return *this;
... | ### Prompt
Your task is to create a Cpp solution to the following problem:
After the war, the supersonic rocket became the most common public transportation.
Each supersonic rocket consists of two "engines". Each engine is a set of "power sources". The first engine has n power sources, and the second one has m power... |
#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-6;
struct Point {
int x, y;
Point() {}
Point(int _x, int _y) { x = _x, y = _y; }
};
long long Dot(Point a, Point b) { return 1LL * a.x * b.x + 1LL * a.y * b.y; }
long long Cross(Point a, Point b) { return 1LL * a.x * b.y - 1LL * a.y * b.x; }
bool... | ### Prompt
Generate a CPP solution to the following problem:
After the war, the supersonic rocket became the most common public transportation.
Each supersonic rocket consists of two "engines". Each engine is a set of "power sources". The first engine has n power sources, and the second one has m power sources. A po... |
#include <bits/stdc++.h>
using namespace std;
bool cw(const pair<pair<long long, long long>, int> &a,
const pair<pair<long long, long long>, int> &b,
const pair<pair<long long, long long>, int> &c) {
return (b.first.first - a.first.first) * (c.first.second - a.first.second) -
(b.first.sec... | ### Prompt
Generate a cpp solution to the following problem:
After the war, the supersonic rocket became the most common public transportation.
Each supersonic rocket consists of two "engines". Each engine is a set of "power sources". The first engine has n power sources, and the second one has m power sources. A po... |
#include <bits/stdc++.h>
using namespace std;
long long read() {
long long x = 0, y = 0, c = getchar();
while (!isdigit(c)) y = c, c = getchar();
while (isdigit(c)) x = x * 10 + (c ^ '0'), c = getchar();
return y == '-' ? -x : x;
}
void print(long long x) {
if (x < 0) {
putchar('-');
x = -x;
}
if ... | ### Prompt
Generate a cpp solution to the following problem:
After the war, the supersonic rocket became the most common public transportation.
Each supersonic rocket consists of two "engines". Each engine is a set of "power sources". The first engine has n power sources, and the second one has m power sources. A po... |
#include <bits/stdc++.h>
using namespace std;
struct Point {
long long x, y;
Point() {}
Point(long long x, long long y) : x(x), y(y) {}
Point(const Point &p) : x(p.x), y(p.y) {}
Point operator+(const Point &p) const { return Point(x + p.x, y + p.y); }
Point operator-(const Point &p) const { return Point(x -... | ### Prompt
In Cpp, your task is to solve the following problem:
After the war, the supersonic rocket became the most common public transportation.
Each supersonic rocket consists of two "engines". Each engine is a set of "power sources". The first engine has n power sources, and the second one has m power sources. A... |
#include <bits/stdc++.h>
using namespace std;
void re(long long &x) {
x = 0;
int b = 0;
char ch = getchar();
while (ch < '0' || ch > '9') {
if (ch == '-') b = -1;
ch = getchar();
}
while (ch >= '0' && ch <= '9') {
x = (x << 1) + (x << 3) + ch - '0';
ch = getchar();
}
if (b == -1) x *= -1... | ### Prompt
In cpp, your task is to solve the following problem:
Monocarp has decided to buy a new TV set and hang it on the wall in his flat. The wall has enough free space so Monocarp can buy a TV set with screen width not greater than a and screen height not greater than b. Monocarp is also used to TV sets with a c... |
#include <bits/stdc++.h>
using namespace std;
long long a, b, x, y;
long long gcd(long long p, long long q) {
if (q == 0)
return p;
else
return gcd(q, p % q);
}
int main() {
cin >> a >> b >> x >> y;
long long p = gcd(x, y);
x /= p;
y /= p;
long long u = a / x, v = b / y;
cout << min(u, v);
ret... | ### Prompt
Please formulate a CPP solution to the following problem:
Monocarp has decided to buy a new TV set and hang it on the wall in his flat. The wall has enough free space so Monocarp can buy a TV set with screen width not greater than a and screen height not greater than b. Monocarp is also used to TV sets wit... |
#include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int a, long long int b) {
if (a == 0 && b != 0) return b;
if (a != 0 && b == 0) return a;
if (a == b) return a;
if (a > b) return gcd(a % b, b);
return gcd(a, b % a);
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
... | ### Prompt
Your task is to create a Cpp solution to the following problem:
Monocarp has decided to buy a new TV set and hang it on the wall in his flat. The wall has enough free space so Monocarp can buy a TV set with screen width not greater than a and screen height not greater than b. Monocarp is also used to TV se... |
#include <bits/stdc++.h>
using namespace std;
long long GCD(long long m, long long n);
int main() {
long long i, j, k, m, n, val, t = 0, cnt = 0, test;
cin >> n >> m >> j >> k;
val = GCD(j, k);
j /= val;
k /= val;
cout << min(n / j, m / k) << endl;
return 0;
}
long long GCD(long long m, long long n) {
l... | ### Prompt
Please provide a cpp coded solution to the problem described below:
Monocarp has decided to buy a new TV set and hang it on the wall in his flat. The wall has enough free space so Monocarp can buy a TV set with screen width not greater than a and screen height not greater than b. Monocarp is also used to T... |
#include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int a, long long int b) {
if (b == 0) return a;
return gcd(b, a % b);
}
int main() {
long long int i, j, k, n, ans = 0, t, a, b, x, y;
cin >> a >> b >> x >> y;
j = gcd(x, y);
x = x / j;
y = y / j;
cout << min(a / x, b / y);
}
| ### Prompt
Generate a Cpp solution to the following problem:
Monocarp has decided to buy a new TV set and hang it on the wall in his flat. The wall has enough free space so Monocarp can buy a TV set with screen width not greater than a and screen height not greater than b. Monocarp is also used to TV sets with a cert... |
#include <bits/stdc++.h>
using namespace std;
long long x, y, a, b;
long long gcd(long long m, long long n) {
if (n == 0) return m;
return gcd(n, m % n);
}
int main(void) {
cin >> a >> b >> x >> y;
long long gxy = gcd(x, y);
x /= gxy;
y /= gxy;
long long rt = min(a / x, b / y);
if (rt < 0) rt = 0;
cou... | ### Prompt
Your task is to create a cpp solution to the following problem:
Monocarp has decided to buy a new TV set and hang it on the wall in his flat. The wall has enough free space so Monocarp can buy a TV set with screen width not greater than a and screen height not greater than b. Monocarp is also used to TV se... |
#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
int main() {
long long a, b, x, y, d;
cin >> a >> b >> x >> y;
d = gcd(x, y);
x /= d;
y /= d;
cout << min(a / x, b / y);
}
| ### Prompt
Create a solution in Cpp for the following problem:
Monocarp has decided to buy a new TV set and hang it on the wall in his flat. The wall has enough free space so Monocarp can buy a TV set with screen width not greater than a and screen height not greater than b. Monocarp is also used to TV sets with a ce... |
#include <bits/stdc++.h>
using namespace std;
long long a, b, x, y;
long long gcd(long long x, long long y) {
return (min(x, y) == 0 ? max(x, y) : gcd(min(x, y), max(x, y) % min(x, y)));
}
int main() {
cin >> a >> b >> x >> y;
long long k = gcd(x, y);
x = x / k;
y = y / k;
long long u = a / x;
long long v... | ### Prompt
Please provide a CPP coded solution to the problem described below:
Monocarp has decided to buy a new TV set and hang it on the wall in his flat. The wall has enough free space so Monocarp can buy a TV set with screen width not greater than a and screen height not greater than b. Monocarp is also used to T... |
#include <bits/stdc++.h>
using namespace std;
long long a, b, x, y;
long long cmmdc(long long a, long long b) {
long long c;
while (b) {
c = a % b;
a = b;
b = c;
}
return a;
}
int main() {
cin >> a >> b >> x >> y;
long long gcd = cmmdc(x, y);
x /= gcd;
y /= gcd;
cout << min(a / x, b / y);
... | ### Prompt
Generate a CPP solution to the following problem:
Monocarp has decided to buy a new TV set and hang it on the wall in his flat. The wall has enough free space so Monocarp can buy a TV set with screen width not greater than a and screen height not greater than b. Monocarp is also used to TV sets with a cert... |
#include <bits/stdc++.h>
using namespace std;
const int LIM = 1e5;
const int INF = 1e9;
const long long INF64 = 1e18;
const int MOD = INF + 7;
const double EPS = 1e-9;
long long gcd(long long a, long long b) {
while (a) {
b %= a;
swap(a, b);
}
return b;
}
int main() {
ios_base::sync_with_stdio(false);
... | ### Prompt
Please create a solution in cpp to the following problem:
Monocarp has decided to buy a new TV set and hang it on the wall in his flat. The wall has enough free space so Monocarp can buy a TV set with screen width not greater than a and screen height not greater than b. Monocarp is also used to TV sets wit... |
#include <bits/stdc++.h>
using namespace std;
struct compare {
bool operator()(const int64_t& a, const int64_t& b) { return a > b; }
};
bool customS(pair<int, int> a, pair<int, int> b) {
if (a.first == b.first) return a.second > b.second;
return a.first < b.first;
}
bool customS2(pair<int, int> a, pair<int, int> ... | ### Prompt
Your task is to create a CPP solution to the following problem:
Monocarp has decided to buy a new TV set and hang it on the wall in his flat. The wall has enough free space so Monocarp can buy a TV set with screen width not greater than a and screen height not greater than b. Monocarp is also used to TV se... |
#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
int main() {
long long a, b, x, y;
cin >> a >> b >> x >> y;
cout << min(a / (x / gcd(x, y)), b / (y / gcd(x, y)));
return 0;
}
| ### Prompt
Your challenge is to write a CPP solution to the following problem:
Monocarp has decided to buy a new TV set and hang it on the wall in his flat. The wall has enough free space so Monocarp can buy a TV set with screen width not greater than a and screen height not greater than b. Monocarp is also used to T... |
#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const long long linf = 1e18;
const int N = 100000 + 1;
const double eps = 1e-5;
const int mo = 1e9 + 7;
long long a, b, x, y;
long long gcd(long long a, long long b) {
if (b == 0)
return a;
else
return gcd(b, a % b);
}
int main() {
... | ### Prompt
Your challenge is to write a cpp solution to the following problem:
Monocarp has decided to buy a new TV set and hang it on the wall in his flat. The wall has enough free space so Monocarp can buy a TV set with screen width not greater than a and screen height not greater than b. Monocarp is also used to T... |
#include <bits/stdc++.h>
using namespace std;
long long a, b, x, y;
long long gcd;
long long GCD(long long a, long long b) {
if (b == 0)
return a;
else
return GCD(b, a % b);
}
int main() {
cin >> a >> b >> x >> y;
gcd = GCD(x, y);
x = x / gcd;
y = y / gcd;
cout << min(a / x, b / y) << endl;
retu... | ### Prompt
Please provide a Cpp coded solution to the problem described below:
Monocarp has decided to buy a new TV set and hang it on the wall in his flat. The wall has enough free space so Monocarp can buy a TV set with screen width not greater than a and screen height not greater than b. Monocarp is also used to T... |
#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
long long gcd(long long a, long long b) {
if (b == 0)
return a;
else
return gcd(b, a % b);
}
int main() {
long long a, b, x, y;
cin >> a >> b >> x >> y;
long long kk = gcd(x, y);
x = x / kk;
y = y / kk;
long long ans = min(a ... | ### Prompt
Develop a solution in Cpp to the problem described below:
Monocarp has decided to buy a new TV set and hang it on the wall in his flat. The wall has enough free space so Monocarp can buy a TV set with screen width not greater than a and screen height not greater than b. Monocarp is also used to TV sets wit... |
#include <bits/stdc++.h>
using namespace std;
long long n, m;
int gcd(long long a, long long b) {
if (!b) return a;
return gcd(b, a % b);
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
long long a, b = 0, c = 0, t, lj = 0, k = 0, r = 0, l = 0, sum = 0, rr,
mn = LLONG_... | ### Prompt
Please provide a Cpp coded solution to the problem described below:
Monocarp has decided to buy a new TV set and hang it on the wall in his flat. The wall has enough free space so Monocarp can buy a TV set with screen width not greater than a and screen height not greater than b. Monocarp is also used to T... |
#include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int a, long long int b) {
if (b == 0) return a;
return gcd(b, a % b);
}
int main() {
long long int a, b, x, y, n1, n2, m;
cin >> a >> b >> x >> y;
long long int g = gcd(x, y);
if (g == 0) return 0;
x = x / g;
y = y / g;
n1 = a /... | ### Prompt
Please create a solution in Cpp to the following problem:
Monocarp has decided to buy a new TV set and hang it on the wall in his flat. The wall has enough free space so Monocarp can buy a TV set with screen width not greater than a and screen height not greater than b. Monocarp is also used to TV sets wit... |
#include <bits/stdc++.h>
using namespace std;
long long x, y, w, h;
inline long long read() {
long long s = 0, f = 1;
char c = getchar();
while (!isdigit(c)) {
if (c == '-') f = -1;
c = getchar();
}
while (isdigit(c)) {
s = s * 10 + c - '0';
c = getchar();
}
return f * s;
}
inline void wri... | ### Prompt
Please create a solution in cpp to the following problem:
Monocarp has decided to buy a new TV set and hang it on the wall in his flat. The wall has enough free space so Monocarp can buy a TV set with screen width not greater than a and screen height not greater than b. Monocarp is also used to TV sets wit... |
#include <bits/stdc++.h>
using namespace std;
const long long mod = (long long)1e9 + 7;
long long gcd(long long x, long long y) {
if (y == 0) return x;
if (x > y) swap(y, x);
y %= x;
return gcd(x, y);
}
int main() {
ios_base ::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
;
long long a, b, x, y;
cin ... | ### Prompt
Create a solution in cpp for the following problem:
Monocarp has decided to buy a new TV set and hang it on the wall in his flat. The wall has enough free space so Monocarp can buy a TV set with screen width not greater than a and screen height not greater than b. Monocarp is also used to TV sets with a ce... |
#include <bits/stdc++.h>
using namespace std;
const double PI = 3.141592654;
long long gcd(long long a, long long b) { return !b ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return (a / gcd(a, b)) * b; }
long long fib(int n) {
return (((1 / sqrt(5)) * (pow((1 + sqrt(5)) / 2, n)) -
((1 /... | ### Prompt
Your challenge is to write a CPP solution to the following problem:
Monocarp has decided to buy a new TV set and hang it on the wall in his flat. The wall has enough free space so Monocarp can buy a TV set with screen width not greater than a and screen height not greater than b. Monocarp is also used to T... |
#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e9 + 7;
const long long N = 3e5 + 5;
long long n, k, id = 0;
long long A[N];
long long in[N], f[N];
inline long long gcd(long long a, long long b) {
long long r;
while (b) {
r = a % b;
a = b;
b = r;
}
return a;
}
void solve() {
l... | ### Prompt
Develop a solution in Cpp to the problem described below:
Monocarp has decided to buy a new TV set and hang it on the wall in his flat. The wall has enough free space so Monocarp can buy a TV set with screen width not greater than a and screen height not greater than b. Monocarp is also used to TV sets wit... |
#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
long long gcd(long long a, long long b) {
if (a == 0) return b;
return gcd(b % a, a);
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int t;
t = 1;
while (t--) {
long long a, b, x, y;... | ### Prompt
Develop a solution in cpp to the problem described below:
Monocarp has decided to buy a new TV set and hang it on the wall in his flat. The wall has enough free space so Monocarp can buy a TV set with screen width not greater than a and screen height not greater than b. Monocarp is also used to TV sets wit... |
#include <bits/stdc++.h>
using namespace std;
inline void read(int &x) {
char ch;
bool flag = false;
for (ch = getchar(); !isdigit(ch); ch = getchar())
if (ch == '-') flag = true;
for (x = 0; isdigit(ch); x = x * 10 + ch - '0', ch = getchar())
;
x = flag ? -x : x;
}
long long gcd(long long a, long lon... | ### Prompt
Your challenge is to write a Cpp solution to the following problem:
Monocarp has decided to buy a new TV set and hang it on the wall in his flat. The wall has enough free space so Monocarp can buy a TV set with screen width not greater than a and screen height not greater than b. Monocarp is also used to T... |
#include <bits/stdc++.h>
using namespace std;
long long hcf(long long a, long long b) { return b == 0 ? a : hcf(b, a % b); }
int main() {
long long a, b, x, y;
cin >> a >> b >> x >> y;
long long k = hcf(x, y);
x = x / k;
y = y / k;
cout << min(a / x, b / y);
}
| ### Prompt
Construct a cpp code solution to the problem outlined:
Monocarp has decided to buy a new TV set and hang it on the wall in his flat. The wall has enough free space so Monocarp can buy a TV set with screen width not greater than a and screen height not greater than b. Monocarp is also used to TV sets with a... |
#include <bits/stdc++.h>
using namespace std;
long long int a, b, x, y, w, h;
long long int gcd(long long int a, long long int b) {
if (!b)
return a;
else
return gcd(b, a % b);
}
int main() {
ios::sync_with_stdio(false);
while (cin >> a >> b >> x >> y) {
long long int temp = gcd(x, y);
long long... | ### Prompt
Create a solution in CPP for the following problem:
Monocarp has decided to buy a new TV set and hang it on the wall in his flat. The wall has enough free space so Monocarp can buy a TV set with screen width not greater than a and screen height not greater than b. Monocarp is also used to TV sets with a ce... |
#include <bits/stdc++.h>
using namespace std;
int n;
const int maxn = 1e5 + 1;
const int mod = 1e9 + 7;
void init() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
}
long long gcd(long long a0, long long b0) {
while (a0 > 0 && b0 > 0) {
if (a0 > b0)
a0 %= b0;
else
b0 %= a0;
}
... | ### Prompt
Please create a solution in cpp to the following problem:
Monocarp has decided to buy a new TV set and hang it on the wall in his flat. The wall has enough free space so Monocarp can buy a TV set with screen width not greater than a and screen height not greater than b. Monocarp is also used to TV sets wit... |
#include <bits/stdc++.h>
using namespace std;
long long a, b, x, y;
long long gcd(long long c, long long d) {
if (d == 0)
return c;
else
return gcd(d, c % d);
}
int main() {
scanf("%lld %lld %lld %lld", &a, &b, &x, &y);
long long k = gcd(x, y);
x /= k;
y /= k;
long long ans = min(a / x, b / y);
... | ### Prompt
Please formulate a cpp solution to the following problem:
Monocarp has decided to buy a new TV set and hang it on the wall in his flat. The wall has enough free space so Monocarp can buy a TV set with screen width not greater than a and screen height not greater than b. Monocarp is also used to TV sets wit... |
#include <bits/stdc++.h>
using namespace std;
long long int gsd(long long int n1, long long int n2) {
int k;
if (n1 == 1 || n2 == 1) return 1;
if (n1 % n2 == 0) return n2;
if (n2 % n1 == 0) return n1;
while (n1 != n2) {
if (n1 > n2)
n1 -= (n1 / n2) * n2;
else
n2 -= (n2 / n1) * n1;
if (... | ### Prompt
Generate a Cpp solution to the following problem:
Monocarp has decided to buy a new TV set and hang it on the wall in his flat. The wall has enough free space so Monocarp can buy a TV set with screen width not greater than a and screen height not greater than b. Monocarp is also used to TV sets with a cert... |
#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
if (a % b)
return gcd(b, a % b);
else
return b;
}
int main() {
long long a, b, c, d;
cin >> a >> b >> c >> d;
long long g = gcd(c, d);
c /= g;
d /= g;
long long a1 = a / c, a2 = b / d;
cout << (a1 < a2 ? a1... | ### Prompt
Create a solution in cpp for the following problem:
Monocarp has decided to buy a new TV set and hang it on the wall in his flat. The wall has enough free space so Monocarp can buy a TV set with screen width not greater than a and screen height not greater than b. Monocarp is also used to TV sets with a ce... |
#include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int a, long long int b) {
if (a == 0) return b;
return gcd(b % a, a);
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
long long int a, b, x, y, g, ans;
cin >> a >> b >> x >> y;
g = gcd(x, y);
ans = min(a / (x / g),... | ### Prompt
Please create a solution in CPP to the following problem:
Monocarp has decided to buy a new TV set and hang it on the wall in his flat. The wall has enough free space so Monocarp can buy a TV set with screen width not greater than a and screen height not greater than b. Monocarp is also used to TV sets wit... |
#include <bits/stdc++.h>
using namespace std;
long long int power(long long int a, long long int b, long long int m) {
if (b == 0) return (1);
long long int sol = power(a, b / 2, m);
sol = (sol * sol) % m;
if (b % 2 == 1) sol = (sol * a) % m;
return (sol);
}
long long int hcf(long long int a, long long int b)... | ### Prompt
In CPP, your task is to solve the following problem:
Monocarp has decided to buy a new TV set and hang it on the wall in his flat. The wall has enough free space so Monocarp can buy a TV set with screen width not greater than a and screen height not greater than b. Monocarp is also used to TV sets with a c... |
#include <bits/stdc++.h>
using namespace std;
const int mod = 256;
const int maxn = 1e4 + 7;
const int M = 3e5;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
int main() {
long long a, b, x, y;
scanf("%lld%lld%lld%lld", &a, &b, &x, &y);
long long g = gcd(x, y);
x /= g;
y /= g;
... | ### Prompt
Generate a Cpp solution to the following problem:
Monocarp has decided to buy a new TV set and hang it on the wall in his flat. The wall has enough free space so Monocarp can buy a TV set with screen width not greater than a and screen height not greater than b. Monocarp is also used to TV sets with a cert... |
#include <bits/stdc++.h>
using namespace std;
const int maxn = 200005;
vector<long long> vec;
long long ans, sum1, sum2, sum;
long long gcd(long long a, long long b) {
if (b == 0) return a;
return gcd(b, a % b);
}
int main() {
long long n, m, x, y, g, x1, y1;
scanf("%lld%lld%lld%lld", &n, &m, &x, &y);
g = gcd... | ### Prompt
Please formulate a CPP solution to the following problem:
Monocarp has decided to buy a new TV set and hang it on the wall in his flat. The wall has enough free space so Monocarp can buy a TV set with screen width not greater than a and screen height not greater than b. Monocarp is also used to TV sets wit... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.