output stringlengths 52 181k | instruction stringlengths 296 182k |
|---|---|
#include <bits/stdc++.h>
using namespace std;
template <class T>
bool uin(T &a, T b) {
return a > b ? (a = b, true) : false;
}
template <class T>
bool uax(T &a, T b) {
return a < b ? (a = b, true) : false;
}
const int N = 200010;
char s[N];
int n, k;
bool d;
int id;
int main() {
cin >> n >> k;
for (int i = 0; i... | ### Prompt
Construct a Cpp code solution to the problem outlined:
Efim just received his grade for the last test. He studies in a special school and his grade can be equal to any positive decimal fraction. First he got disappointed, as he expected a way more pleasant result. Then, he developed a tricky plan. Each sec... |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, t;
cin >> n >> t;
string s;
string s1;
cin >> s;
int array[n + 1];
array[0] = 0;
int temp = 0;
for (int i = 1; i <= n; i++) {
if (s[i - 1] == '.') {
array[i] = -1;
temp = i;
} else
array[i] = s[i - 1] - '0';
... | ### Prompt
Your challenge is to write a CPP solution to the following problem:
Efim just received his grade for the last test. He studies in a special school and his grade can be equal to any positive decimal fraction. First he got disappointed, as he expected a way more pleasant result. Then, he developed a tricky p... |
#include <bits/stdc++.h>
using namespace std;
int flag[222222];
int s[222222];
char ss[222222];
int ls, k;
int main() {
int i, j, st;
cin >> ls >> k;
cin >> ss;
for (i = 0; i < ls; i++)
if (ss[i] == '.')
s[i] = -1;
else
s[i] = ss[i] - '0';
st = -1;
int fdot = 0, pdot;
for (i = 0; i < l... | ### Prompt
Generate a CPP solution to the following problem:
Efim just received his grade for the last test. He studies in a special school and his grade can be equal to any positive decimal fraction. First he got disappointed, as he expected a way more pleasant result. Then, he developed a tricky plan. Each second, ... |
#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 200000 + 10;
void addOne(string dec) {
int i = dec.length() - 1;
for (; i >= 0; i--) {
if (dec[i] != '9') {
dec[i] += 1;
break;
}
dec[i] = '0';
}
if (i < 0) {
dec = "1" + dec;
}
printf("%s\n", dec.c_str());
}
int mai... | ### Prompt
Your challenge is to write a Cpp solution to the following problem:
Efim just received his grade for the last test. He studies in a special school and his grade can be equal to any positive decimal fraction. First he got disappointed, as he expected a way more pleasant result. Then, he developed a tricky p... |
#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool read(T& x) {
char ch = ' ';
bool sgn;
while (ch != '-' && (ch < '0' || ch > '9'))
if (ch = getchar(), ch == EOF) return false;
sgn = (ch == '-');
x = (ch == '-') ? 0 : (ch - '0');
while (ch = getchar(), ch >= '0' && ch <= '9') ... | ### Prompt
Generate a cpp solution to the following problem:
Efim just received his grade for the last test. He studies in a special school and his grade can be equal to any positive decimal fraction. First he got disappointed, as he expected a way more pleasant result. Then, he developed a tricky plan. Each second, ... |
#include <bits/stdc++.h>
const long long mod = 1000000007;
const long long Inf = 1e9;
using namespace std;
int main() {
ios::sync_with_stdio(false);
int n, t;
cin >> n >> t;
int ans = 0;
vector<char> s(n);
int pos;
for (int(i) = 0; (i) < n; (i)++) {
cin >> s[i];
if (s[i] == '.') pos = i;
}
if ... | ### Prompt
Your task is to create a Cpp solution to the following problem:
Efim just received his grade for the last test. He studies in a special school and his grade can be equal to any positive decimal fraction. First he got disappointed, as he expected a way more pleasant result. Then, he developed a tricky plan.... |
#include <bits/stdc++.h>
const int N = 200000 + 5;
int n, t;
char s[N];
int point, first_five;
inline void round_int() {
s[0] = '0';
int i = point;
s[i] = '\0';
--i;
++s[i];
while (s[i] > '9') {
s[i] = '0';
++s[i - 1];
--i;
}
if (s[0] != '0')
puts(s);
else
puts(s + 1);
}
int main()... | ### Prompt
Your task is to create a Cpp solution to the following problem:
Efim just received his grade for the last test. He studies in a special school and his grade can be equal to any positive decimal fraction. First he got disappointed, as he expected a way more pleasant result. Then, he developed a tricky plan.... |
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int MAX = 2e5 + 5;
const int INF = 1e9 + 10;
int dp[MAX];
string add(int v, string s) {
int i = s.size() - 1;
int carry = v;
while (carry != 0 && i >= 0) {
int d = s[i] - '0';
d += carry;
carry = d / 10;
d %= 10;
s[i]... | ### Prompt
In Cpp, your task is to solve the following problem:
Efim just received his grade for the last test. He studies in a special school and his grade can be equal to any positive decimal fraction. First he got disappointed, as he expected a way more pleasant result. Then, he developed a tricky plan. Each secon... |
#include <bits/stdc++.h>
const int N = 200005;
using namespace std;
int a[N], b[N];
int main() {
int n, i, j, t, l, lb;
scanf("%d%d", &n, &t);
getchar();
char c;
for (i = 0; i < n; i++) {
c = getchar();
if (c == '.') break;
b[i] = c - '0';
}
lb = i;
l = n - i - 1;
for (i++; i < n; i++) {
... | ### Prompt
Generate a cpp solution to the following problem:
Efim just received his grade for the last test. He studies in a special school and his grade can be equal to any positive decimal fraction. First he got disappointed, as he expected a way more pleasant result. Then, he developed a tricky plan. Each second, ... |
#include <bits/stdc++.h>
using namespace std;
int l[200009];
int r[200009];
int ls, rs;
void go() {
while (rs) {
int x = r[rs - 1];
if (x == 9) {
rs--;
} else {
r[rs - 1]++;
return;
}
}
}
bool go2() {
if (ls == 0) return 1;
for (int i = ls - 1; i >= 0; i--) {
if (l[i] == 9)... | ### Prompt
Your task is to create a CPP solution to the following problem:
Efim just received his grade for the last test. He studies in a special school and his grade can be equal to any positive decimal fraction. First he got disappointed, as he expected a way more pleasant result. Then, he developed a tricky plan.... |
#include <bits/stdc++.h>
using namespace std;
int n, k;
char str[200005];
void add(int x) {
if (str[x] == '.') x = x - 1;
if (str[x] == '9') {
str[x] = '0';
add(x - 1);
} else
str[x]++;
}
int main() {
scanf("%d%d", &n, &k);
scanf("%s", str + 1);
str[0] = '0';
int l = 0, r = n;
for (int i = 1... | ### Prompt
Your challenge is to write a cpp solution to the following problem:
Efim just received his grade for the last test. He studies in a special school and his grade can be equal to any positive decimal fraction. First he got disappointed, as he expected a way more pleasant result. Then, he developed a tricky p... |
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e6 + 5;
char str[MAXN];
set<int> se;
int main() {
int n, m;
while (~scanf("%d%d", &n, &m)) {
scanf("%s", str);
se.clear();
int dot = 0;
for (int i = 0; i < n; i++) {
if (str[i] == '.') {
dot = i + 1;
break;
}... | ### Prompt
Your challenge is to write a Cpp solution to the following problem:
Efim just received his grade for the last test. He studies in a special school and his grade can be equal to any positive decimal fraction. First he got disappointed, as he expected a way more pleasant result. Then, he developed a tricky p... |
#include <bits/stdc++.h>
using namespace std;
char s[1000000];
bool sym[1000000];
int n, t;
set<int> se;
int main() {
scanf("%d%d", &n, &t);
scanf("%s", s);
int start, l = strlen(s);
for (int i = 0;; i++) {
if (s[i] == '.') {
start = i;
break;
}
}
for (int i = start + 1; i < l; i++)
... | ### Prompt
Generate a cpp solution to the following problem:
Efim just received his grade for the last test. He studies in a special school and his grade can be equal to any positive decimal fraction. First he got disappointed, as he expected a way more pleasant result. Then, he developed a tricky plan. Each second, ... |
#include <bits/stdc++.h>
using namespace std;
long long delbit(long long a, long long k) { return a & (~(1 << k)); }
bool getbit(long long a, long long k) { return 1 & (a >> k); }
long long setbit(long long a, long long k) { return a |= (1 << k); }
inline long long mulmod(long long first, long long n, long long _mod) {... | ### Prompt
In cpp, your task is to solve the following problem:
Efim just received his grade for the last test. He studies in a special school and his grade can be equal to any positive decimal fraction. First he got disappointed, as he expected a way more pleasant result. Then, he developed a tricky plan. Each secon... |
#include <bits/stdc++.h>
using namespace std;
string s;
bool needone;
int t, point, lasttoprint, n;
int main() {
ios::sync_with_stdio(false);
cin >> n >> t >> s;
for (int i = 0; i < n; i++)
if (s[i] == '.') point = i;
needone = false;
lasttoprint = n - 1;
for (int i = point + 1; i < n; i++)
if (s[i]... | ### Prompt
Please formulate a Cpp solution to the following problem:
Efim just received his grade for the last test. He studies in a special school and his grade can be equal to any positive decimal fraction. First he got disappointed, as he expected a way more pleasant result. Then, he developed a tricky plan. Each ... |
#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
set<int> s;
int n, t;
char a[maxn];
int pos;
int main() {
register int i, tail, g;
scanf("%d%d", &n, &t);
scanf("%s", a + 1);
for (i = 1; i <= n; i++)
if (a[i] == '.') {
pos = i;
break;
}
g = pos;
for (i = pos; i <=... | ### Prompt
Please create a solution in Cpp to the following problem:
Efim just received his grade for the last test. He studies in a special school and his grade can be equal to any positive decimal fraction. First he got disappointed, as he expected a way more pleasant result. Then, he developed a tricky plan. Each ... |
#include <bits/stdc++.h>
using namespace std;
void solve();
int main() {
solve();
return 0;
}
void solve() {
int n, t, first = -1, point = -1;
cin >> n >> t;
string num;
cin >> num;
for (int i = 0; i < n; i++) {
if (num[i] == '.') point = i;
if (point != -1 && num[i] >= '5') {
first = i;
... | ### Prompt
Your task is to create a Cpp solution to the following problem:
Efim just received his grade for the last test. He studies in a special school and his grade can be equal to any positive decimal fraction. First he got disappointed, as he expected a way more pleasant result. Then, he developed a tricky plan.... |
#include <bits/stdc++.h>
using namespace std;
int A[200009], D[200009], imp;
bool add;
void solve(int &d) {
if (D[1] >= 5) {
d = 0;
add = 1;
return;
}
for (long long int i = (long long int)imp; i <= (long long int)imp; i++)
if (D[i] >= 5) {
D[i - 1]++;
d = i - 1;
int a = i - 1;
... | ### Prompt
Your challenge is to write a Cpp solution to the following problem:
Efim just received his grade for the last test. He studies in a special school and his grade can be equal to any positive decimal fraction. First he got disappointed, as he expected a way more pleasant result. Then, he developed a tricky p... |
#include <bits/stdc++.h>
const double pi = acos(1.0 * (-1));
using namespace std;
const int INF = 2147483647;
const long long mod = 1000000007;
int a[202222];
int b[202222];
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n, t;
cin >> n >> t;
char ch;
int flag = 0;
int n1 = 0, n2 = 0;
for (int... | ### Prompt
Develop a solution in cpp to the problem described below:
Efim just received his grade for the last test. He studies in a special school and his grade can be equal to any positive decimal fraction. First he got disappointed, as he expected a way more pleasant result. Then, he developed a tricky plan. Each ... |
#include <bits/stdc++.h>
using namespace std;
int n, t, k;
string s;
string res(int l);
string solve(string& s);
int main() {
ios_base::sync_with_stdio(false);
cin >> n >> t >> s;
cout << solve(s) << endl;
return 0;
}
string solve(string& s) {
k = 0;
while (s[k] != '.') ++k;
bool fl = true;
for (int i =... | ### Prompt
Generate a CPP solution to the following problem:
Efim just received his grade for the last test. He studies in a special school and his grade can be equal to any positive decimal fraction. First he got disappointed, as he expected a way more pleasant result. Then, he developed a tricky plan. Each second, ... |
#include <bits/stdc++.h>
using namespace std;
void addOne(string &s, long long loc) {
if (loc < 0) {
string temp = "1";
temp += s;
s = temp;
return;
}
if (s.at(loc) == '9') {
s.at(loc) = '0';
addOne(s, loc - 1);
return;
}
s.at(loc) = ((s.at(loc) - '0') + 1) + '0';
}
int main() {
... | ### Prompt
Please formulate a Cpp solution to the following problem:
Efim just received his grade for the last test. He studies in a special school and his grade can be equal to any positive decimal fraction. First he got disappointed, as he expected a way more pleasant result. Then, he developed a tricky plan. Each ... |
#include <bits/stdc++.h>
char sir[200000 + 5];
int nr[2];
int main() {
int n, t;
scanf("%d %d", &n, &t);
scanf("%s", sir);
int pos = 0;
while (sir[pos] != '.') {
++pos;
}
int i = pos + 1;
while (i < n && sir[i] < '5') {
++i;
}
if (i < n) {
int runda = 1;
while (1) {
if (sir[i -... | ### Prompt
Generate a Cpp solution to the following problem:
Efim just received his grade for the last test. He studies in a special school and his grade can be equal to any positive decimal fraction. First he got disappointed, as he expected a way more pleasant result. Then, he developed a tricky plan. Each second, ... |
#include <bits/stdc++.h>
using namespace std;
void redondear(string &s, int pto, int idx) {
if (idx == (int)(s.size())) {
cout << s << endl;
return;
}
s.resize(idx);
bool unoAdelante = false;
for (int i = (idx)-1; i >= (int)(0); i--) {
if (i == pto) {
continue;
}
if (i == 0 && s[i] =... | ### Prompt
Generate a Cpp solution to the following problem:
Efim just received his grade for the last test. He studies in a special school and his grade can be equal to any positive decimal fraction. First he got disappointed, as he expected a way more pleasant result. Then, he developed a tricky plan. Each second, ... |
#include <bits/stdc++.h>
using namespace std;
char s[200009];
int a[200009];
int main() {
int n, t;
scanf("%d%d", &n, &t);
scanf("%s", s);
a[n] = t + 1000;
int p;
for (int i = n - 1; i >= 0; i--) {
if (s[i] == '.') {
p = i;
break;
}
if (s[i] >= '5')
a[i] = 1;
else if (s[i] ... | ### Prompt
In Cpp, your task is to solve the following problem:
Efim just received his grade for the last test. He studies in a special school and his grade can be equal to any positive decimal fraction. First he got disappointed, as he expected a way more pleasant result. Then, he developed a tricky plan. Each secon... |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, t;
ios_base::sync_with_stdio(false);
cin >> n >> t;
string c;
cin >> c;
int dot;
for (dot = 0; c[dot] != '.'; ++dot)
;
int p = dot;
for (; p < c.length() && c[p] < '5'; ++p)
;
while (p != c.length() && p >= dot && t > 0) {
... | ### Prompt
In CPP, your task is to solve the following problem:
Efim just received his grade for the last test. He studies in a special school and his grade can be equal to any positive decimal fraction. First he got disappointed, as he expected a way more pleasant result. Then, he developed a tricky plan. Each secon... |
#include <bits/stdc++.h>
using namespace std;
vector<int> G[2 * 100000 + 5];
string gen(string S, int x) {
int carry = 1;
for (int i = x; carry > 0 and i >= 0; i--) {
if (S[i] == '.') continue;
int sum = carry + (S[i] - '0');
S[i] = char('0' + sum % 10);
carry = sum / 10;
}
string temp = "";
w... | ### Prompt
Develop a solution in Cpp to the problem described below:
Efim just received his grade for the last test. He studies in a special school and his grade can be equal to any positive decimal fraction. First he got disappointed, as he expected a way more pleasant result. Then, he developed a tricky plan. Each ... |
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e6 + 5;
char str[MAXN];
set<int> se;
int main() {
int n, m;
while (~scanf("%d%d", &n, &m)) {
scanf("%s", str);
se.clear();
int dot = 0;
for (int i = 0; i < n; i++) {
if (str[i] == '.') {
dot = i + 1;
break;
}... | ### Prompt
Create a solution in cpp for the following problem:
Efim just received his grade for the last test. He studies in a special school and his grade can be equal to any positive decimal fraction. First he got disappointed, as he expected a way more pleasant result. Then, he developed a tricky plan. Each second... |
#include <bits/stdc++.h>
using namespace std;
int n;
int t;
deque<int> dq;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cin >> n >> t;
string s;
cin >> s;
bool b = false;
int id = 0, p;
for (int i = 0; i < (int)s.size(); i++) {
if (s[i] == '.') b = true, p = i;
id++;
if (b && (s[i]... | ### Prompt
In Cpp, your task is to solve the following problem:
Efim just received his grade for the last test. He studies in a special school and his grade can be equal to any positive decimal fraction. First he got disappointed, as he expected a way more pleasant result. Then, he developed a tricky plan. Each secon... |
#include <bits/stdc++.h>
using namespace std;
char str[220000];
bool cz[220000];
char cal(char c) {
c++;
if (c > '9')
return '0';
else
return c;
}
void init() { memset(cz, 0, sizeof(cz)); }
int main() {
int n, t;
while (scanf("%d %d", &n, &t) != EOF) {
init();
scanf("%s", str);
int len = s... | ### Prompt
Create a solution in cpp for the following problem:
Efim just received his grade for the last test. He studies in a special school and his grade can be equal to any positive decimal fraction. First he got disappointed, as he expected a way more pleasant result. Then, he developed a tricky plan. Each second... |
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int n, t, i, j;
cin >> n >> t;
string arr, a;
cin >> arr;
for (i = 0; i < n; i++) {
if (arr[i] == '.') break;
}
if (i == n - 1) {
cout << arr << endl;
return 0;
}
for (j = i + 1; j < n; j++)... | ### Prompt
Generate a cpp solution to the following problem:
Efim just received his grade for the last test. He studies in a special school and his grade can be equal to any positive decimal fraction. First he got disappointed, as he expected a way more pleasant result. Then, he developed a tricky plan. Each second, ... |
#include <bits/stdc++.h>
using namespace std;
int n, t;
int ans;
char str[200005];
int main() {
cin >> n >> t;
cin >> str;
int len = strlen(str);
int dot_pos = 0, pos = 0;
int flag = 0;
int last = len;
for (int i = 0; i < len; i++) {
if (str[i] == '.') {
dot_pos = i;
flag = 1;
}
if... | ### Prompt
Construct a cpp code solution to the problem outlined:
Efim just received his grade for the last test. He studies in a special school and his grade can be equal to any positive decimal fraction. First he got disappointed, as he expected a way more pleasant result. Then, he developed a tricky plan. Each sec... |
#include <bits/stdc++.h>
using namespace std;
struct Pair {
int index;
int value;
Pair(int index, int value) : index(index), value(value) {}
bool operator<(const Pair &other) const { return value < other.value; }
bool operator>(const Pair &other) const { return value > other.value; }
};
struct Tuple {
int a... | ### Prompt
Create a solution in CPP for the following problem:
Efim just received his grade for the last test. He studies in a special school and his grade can be equal to any positive decimal fraction. First he got disappointed, as he expected a way more pleasant result. Then, he developed a tricky plan. Each second... |
#include <bits/stdc++.h>
using namespace std;
int ni() {
int val;
scanf("%i", &val);
return val;
}
string ns() {
static char buf[1 << 20];
scanf("%s", &buf);
return buf;
}
int main() {
int len = ni(), steps = ni();
string number = ns();
number = "0" + number;
auto dt = number.find_first_of('.');
f... | ### Prompt
Please formulate a cpp solution to the following problem:
Efim just received his grade for the last test. He studies in a special school and his grade can be equal to any positive decimal fraction. First he got disappointed, as he expected a way more pleasant result. Then, he developed a tricky plan. Each ... |
#include <bits/stdc++.h>
using namespace std;
int main() {
long long i, k, pos, n, t, p, ans;
std::ios::sync_with_stdio(false);
while (cin >> n >> t) {
string s;
cin >> s;
bool change = false;
bool decimal = false;
long long dot = -1, last;
for (i = 0; i < n; i++) {
if (s[i] == '.')
... | ### Prompt
In CPP, your task is to solve the following problem:
Efim just received his grade for the last test. He studies in a special school and his grade can be equal to any positive decimal fraction. First he got disappointed, as he expected a way more pleasant result. Then, he developed a tricky plan. Each secon... |
#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 100;
char str[maxn], pre[maxn];
int main() {
memset(str, 0, sizeof(str));
int len, k;
scanf("%d %d", &len, &k);
scanf("%s", str + 1);
int vis = -1;
bool ok = false;
int point;
for (int i = 1; i <= len; i++) {
if (str[i] == '.') {
... | ### Prompt
Develop a solution in cpp to the problem described below:
Efim just received his grade for the last test. He studies in a special school and his grade can be equal to any positive decimal fraction. First he got disappointed, as he expected a way more pleasant result. Then, he developed a tricky plan. Each ... |
#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const int mod = 10007;
const int M = 20;
string s;
double a[105], b[105];
int main() {
int i, j, t, n, p;
while (~scanf("%d%d", &n, &t)) {
cin >> s;
int len = s.length();
for (i = 0; i < len; ++i) {
if (s[i] == '.') break;
... | ### Prompt
Please formulate a Cpp solution to the following problem:
Efim just received his grade for the last test. He studies in a special school and his grade can be equal to any positive decimal fraction. First he got disappointed, as he expected a way more pleasant result. Then, he developed a tricky plan. Each ... |
#include <bits/stdc++.h>
using namespace std;
const int Maxn = 200010;
int s1[Maxn], s2[Maxn];
int n, t, l1, l2;
int _max(int x, int y) { return x > y ? x : y; }
int _min(int x, int y) { return x < y ? x : y; }
void pplus() {
s1[1]++;
for (int i = 1; i <= l1; i++) {
if (s1[i] >= 10) {
s1[i] -= 10;
s... | ### Prompt
Construct a Cpp code solution to the problem outlined:
Efim just received his grade for the last test. He studies in a special school and his grade can be equal to any positive decimal fraction. First he got disappointed, as he expected a way more pleasant result. Then, he developed a tricky plan. Each sec... |
#include <bits/stdc++.h>
using namespace std;
int T, n;
int len;
string mark;
string oneStr = "";
int dotPos;
void CleanFrom(int pos) { mark = mark.substr(0, pos); }
void addOne() {
bool needAdd = true;
for (int i = mark.length() - 1; i >= 0; i--) {
if (mark[i] < '9') {
needAdd = false;
mark[i] = ma... | ### Prompt
Construct a Cpp code solution to the problem outlined:
Efim just received his grade for the last test. He studies in a special school and his grade can be equal to any positive decimal fraction. First he got disappointed, as he expected a way more pleasant result. Then, he developed a tricky plan. Each sec... |
#include <bits/stdc++.h>
using namespace std;
int rem;
int add1flag = 0;
string s;
void inc(int i) {
rem = i;
if (s[i] == '.')
inc(i - 1);
else if (s[i] != '9') {
if (i == 0 && s[i] == '9') add1flag = 1;
s[i]++;
} else {
if (i == 0 && s[i] == '9') add1flag = 1;
s[i] = '0';
inc(i - 1);
... | ### Prompt
Your task is to create a cpp solution to the following problem:
Efim just received his grade for the last test. He studies in a special school and his grade can be equal to any positive decimal fraction. First he got disappointed, as he expected a way more pleasant result. Then, he developed a tricky plan.... |
#include <bits/stdc++.h>
using namespace std;
bool dot;
int main() {
ios_base::sync_with_stdio(false);
vector<int> v;
string s;
vector<int> t;
int n, time;
cin >> n >> time >> s;
for (int i = 0; i < s.size(); i++) {
if (dot) {
v.push_back(s[i] - '0');
if (v.back() >= 5) break;
}
if... | ### Prompt
Develop a solution in CPP to the problem described below:
Efim just received his grade for the last test. He studies in a special school and his grade can be equal to any positive decimal fraction. First he got disappointed, as he expected a way more pleasant result. Then, he developed a tricky plan. Each ... |
#include <bits/stdc++.h>
using namespace std;
int n, t, decimal;
char ch;
char a[200010 + 20];
int main() {
cin >> n >> t;
cin.get();
for (int i = 1; i <= n; i++) {
cin >> ch;
if (ch == '.')
decimal = true, a[i] = '.';
else if (!decimal)
a[i] = ch;
else if (ch >= '5' && t)
if (a[... | ### Prompt
Please formulate a Cpp solution to the following problem:
Efim just received his grade for the last test. He studies in a special school and his grade can be equal to any positive decimal fraction. First he got disappointed, as he expected a way more pleasant result. Then, he developed a tricky plan. Each ... |
#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
const double PI = acos(-1.0);
const long long mod = 1e9 + 7;
long long po(long long a, long long b, long long mod) {
long long res = 1;
a %= mod;
for (; b; b >>= 1) {
if (b & 1) res = res * a % mod;
a = a * a % mod;
}
return res;
... | ### Prompt
Generate a cpp solution to the following problem:
Efim just received his grade for the last test. He studies in a special school and his grade can be equal to any positive decimal fraction. First he got disappointed, as he expected a way more pleasant result. Then, he developed a tricky plan. Each second, ... |
#include <bits/stdc++.h>
using namespace std;
int main() {
long long int n, a, b, c;
cin >> n >> a >> b >> c;
int i, j;
j = n % 4;
if (j == 1) {
cout << min(min(3 * a, b + a), c);
} else if (j == 2) {
cout << min(min(2 * a, b), 2 * c) << endl;
} else if (j == 3) {
cout << min(min(a, 3 * c), b ... | ### Prompt
In CPP, your task is to solve the following problem:
Little girl Alyona is in a shop to buy some copybooks for school. She study four subjects so she wants to have equal number of copybooks for each of the subjects. There are three types of copybook's packs in the shop: it is possible to buy one copybook f... |
#include <bits/stdc++.h>
using namespace std;
long long cmp(long long a, long long b, long long c) {
long long tmp;
if (a < b)
tmp = a;
else
tmp = b;
if (tmp < c)
return tmp;
else
return c;
}
int main() {
long long n, a, b, c;
cin >> n >> a >> b >> c;
int m = n % 4;
if (m == 0) {
c... | ### Prompt
In cpp, your task is to solve the following problem:
Little girl Alyona is in a shop to buy some copybooks for school. She study four subjects so she wants to have equal number of copybooks for each of the subjects. There are three types of copybook's packs in the shop: it is possible to buy one copybook f... |
#include <bits/stdc++.h>
using namespace std;
const long long nmax = (long long)2e5 + 20;
signed main() {
ios_base ::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
long long n, a, b, c;
cin >> n >> a >> b >> c;
long long rem = n % 4;
long long ans = 0;
if (rem > 0) {
rem = 4 - rem;
if (rem == ... | ### Prompt
Construct a Cpp code solution to the problem outlined:
Little girl Alyona is in a shop to buy some copybooks for school. She study four subjects so she wants to have equal number of copybooks for each of the subjects. There are three types of copybook's packs in the shop: it is possible to buy one copybook... |
#include <bits/stdc++.h>
using namespace std;
template <class T>
T power(T a, T b) {
T x;
if (b == 0)
x = 1;
else
x = a;
for (size_t i = 1; i < b; i++) x *= a;
return x;
}
long long int gcd(long long int a, long long int b) {
return b == 0 ? a : gcd(b, a % b);
}
long long int n, m, a, b, c, ab, ba, ... | ### Prompt
Please provide a CPP coded solution to the problem described below:
Little girl Alyona is in a shop to buy some copybooks for school. She study four subjects so she wants to have equal number of copybooks for each of the subjects. There are three types of copybook's packs in the shop: it is possible to buy... |
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
long long n, a, b, c;
cin >> n >> a >> b >> c;
switch ((4 - n % 4) % 4) {
case 1:
cout << min(a, min(b + c, 3 * c));
break;
case 2:
cout << min(2 * a, min(b, 2 * c));
break;
case 3:
... | ### Prompt
Generate a cpp solution to the following problem:
Little girl Alyona is in a shop to buy some copybooks for school. She study four subjects so she wants to have equal number of copybooks for each of the subjects. There are three types of copybook's packs in the shop: it is possible to buy one copybook for ... |
#include <bits/stdc++.h>
using namespace std;
template <class T>
bool umin(T& a, T b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
template <class T>
bool umax(T& a, T b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
int main() {
long long n, a, b, c;
scanf("%lld%lld%lld%lld", &n, &a, &... | ### Prompt
Create a solution in Cpp for the following problem:
Little girl Alyona is in a shop to buy some copybooks for school. She study four subjects so she wants to have equal number of copybooks for each of the subjects. There are three types of copybook's packs in the shop: it is possible to buy one copybook fo... |
#include <bits/stdc++.h>
using namespace std;
int main() {
long long int n, a, b, c;
cin >> n >> a >> b >> c;
if (n % 4LL == 0LL)
cout << "0\n";
else if (n % 4LL == 1LL)
cout << min(min(c, 3LL * a), b + a) << "\n";
else if (n % 4LL == 2LL)
cout << min(min(2LL * a, b), 2 * c) << "\n";
else if (n ... | ### Prompt
Please formulate a Cpp solution to the following problem:
Little girl Alyona is in a shop to buy some copybooks for school. She study four subjects so she wants to have equal number of copybooks for each of the subjects. There are three types of copybook's packs in the shop: it is possible to buy one copyb... |
#include <bits/stdc++.h>
using namespace std;
long long n, m, i, j, k, t;
long long num[5];
int main() {
while (cin >> n >> num[1] >> num[2] >> num[3]) {
long long min = 1;
long long ans = n % 4;
if (ans == 0) {
ans = 0;
} else {
ans = 4 - ans;
switch (ans) {
case 1: {
... | ### Prompt
Please create a solution in CPP to the following problem:
Little girl Alyona is in a shop to buy some copybooks for school. She study four subjects so she wants to have equal number of copybooks for each of the subjects. There are three types of copybook's packs in the shop: it is possible to buy one copyb... |
#include <bits/stdc++.h>
using namespace std;
int n, a, b, c;
long long ans, f[25];
int main() {
memset(f, 0, sizeof(f));
scanf("%d%d%d%d", &n, &a, &b, &c);
ans = 0x3f3f3f3f;
for (int i = 0; i < 20; i++) {
if (i >= 1) f[i] = f[i - 1] + a;
if (i >= 2) f[i] = min(f[i], f[i - 2] + b);
if (i >= 3) f[i] ... | ### Prompt
Generate a cpp solution to the following problem:
Little girl Alyona is in a shop to buy some copybooks for school. She study four subjects so she wants to have equal number of copybooks for each of the subjects. There are three types of copybook's packs in the shop: it is possible to buy one copybook for ... |
#include <bits/stdc++.h>
using namespace std;
int main() {
std::ios_base::sync_with_stdio(0);
long long cases, caseno = 0, n, i, j, k, cnt, sum;
cin >> n >> i >> j >> k;
n = (4 - (n % 4)) % 4;
if (n == 0)
sum = 0;
else if (n == 1)
sum = min(min(i, j + k), k + k + k);
else if (n == 2)
sum = min... | ### Prompt
Develop a solution in cpp to the problem described below:
Little girl Alyona is in a shop to buy some copybooks for school. She study four subjects so she wants to have equal number of copybooks for each of the subjects. There are three types of copybook's packs in the shop: it is possible to buy one copyb... |
#include <bits/stdc++.h>
#pragma gcc optimize("Ofast,no-stack-protector,tune=native")
#pragma gcc optimize("sse,sse2,sse3,sse4,ssse3")
#pragma gcc optimize("abm,mmx,avx,avx2,unroll-loops,fast-math,section-anchors")
using namespace std;
signed main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
long ... | ### Prompt
Generate a Cpp solution to the following problem:
Little girl Alyona is in a shop to buy some copybooks for school. She study four subjects so she wants to have equal number of copybooks for each of the subjects. There are three types of copybook's packs in the shop: it is possible to buy one copybook for ... |
#include <bits/stdc++.h>
using namespace std;
int main() {
long long n, a[10], x;
cin >> n >> a[1] >> a[2] >> a[3];
if (n % 4 == 0) {
cout << "0\n";
return 0;
}
x = 4 - (n % 4);
if (x == 1) {
cout << min(a[1], min(a[2] + a[3], 3 * a[3])) << "\n";
} else if (x == 2) {
cout << min(a[2], min(... | ### Prompt
Your challenge is to write a cpp solution to the following problem:
Little girl Alyona is in a shop to buy some copybooks for school. She study four subjects so she wants to have equal number of copybooks for each of the subjects. There are three types of copybook's packs in the shop: it is possible to buy... |
#include <bits/stdc++.h>
using namespace std;
long long a, b, c, n, ans1, ans2, ans3, ans;
int main() {
cin >> n >> a >> b >> c;
long x = 4 - n % 4;
if (x == 1) {
ans1 = a;
ans2 = 3 * c;
ans3 = c + b;
ans = min(ans1, min(ans2, ans3));
} else if (x == 2) {
ans1 = 2 * a;
ans2 = b;
ans3... | ### Prompt
Please formulate a CPP solution to the following problem:
Little girl Alyona is in a shop to buy some copybooks for school. She study four subjects so she wants to have equal number of copybooks for each of the subjects. There are three types of copybook's packs in the shop: it is possible to buy one copyb... |
#include <bits/stdc++.h>
using namespace std;
const int N = 3500;
const int Mod = 1e9 + 7;
long long f[N];
int main() {
long long n, a, b, c;
while (cin >> n >> a >> b >> c) {
long long ans = 1e18;
for (int i = 1; i < N; i++) f[i] = 1e18;
f[0] = 0;
for (int i = 1; i < N; i++) {
if (i >= 1) f[i... | ### Prompt
Your challenge is to write a Cpp solution to the following problem:
Little girl Alyona is in a shop to buy some copybooks for school. She study four subjects so she wants to have equal number of copybooks for each of the subjects. There are three types of copybook's packs in the shop: it is possible to buy... |
#include <bits/stdc++.h>
using namespace std;
long long f[4], c[4];
int n;
int main() {
scanf("%d", &n);
n = (4 - (n % 4)) % 4;
for (int i = 1; i <= 3; i++) scanf("%d", &c[i]);
f[0] = 0;
f[1] = f[2] = f[3] = 1ll << 60;
for (int i = 1; i <= 3; i++) {
for (int j = 1; j <= 12; j++) {
if (j < i) conti... | ### Prompt
Your task is to create a cpp solution to the following problem:
Little girl Alyona is in a shop to buy some copybooks for school. She study four subjects so she wants to have equal number of copybooks for each of the subjects. There are three types of copybook's packs in the shop: it is possible to buy one... |
#include <bits/stdc++.h>
using namespace std;
long long n, cont = 1 << 30;
long long a, b, c;
int main() {
scanf("%I64d%I64d%I64d%I64d", &n, &a, &b, &c);
if (n % 4 == 0) {
cont = 0;
printf("%I64d\n", cont);
return 0;
}
for (int i = 0; i <= 3; i++) {
for (int j = 0; j <= 3; j++) {
for (int ... | ### Prompt
Develop a solution in cpp to the problem described below:
Little girl Alyona is in a shop to buy some copybooks for school. She study four subjects so she wants to have equal number of copybooks for each of the subjects. There are three types of copybook's packs in the shop: it is possible to buy one copyb... |
#include <bits/stdc++.h>
int main() {
long long int n = 0, a = 0, b = 0, c = 0;
std::cin >> n >> a >> b >> c;
long long int result = n % 4;
if (result == 0)
std::cout << 0;
else if (result == 1)
std::cout << std::min(c, std::min(a + b, a + a + a));
else if (result == 2)
std::cout << std::min(b, ... | ### Prompt
Develop a solution in Cpp to the problem described below:
Little girl Alyona is in a shop to buy some copybooks for school. She study four subjects so she wants to have equal number of copybooks for each of the subjects. There are three types of copybook's packs in the shop: it is possible to buy one copyb... |
#include <bits/stdc++.h>
using namespace std;
long long min(long long a, long long b, long long c) {
return min(min(a, b), c);
}
int main() {
long long n, a, b, c;
cin >> n >> a >> b >> c;
a = min(a, c + b, 3 * c);
b = min(2 * a, b, 2 * c);
c = min(3 * a, a + b, c);
switch (4 - n % 4) {
case 1:
... | ### Prompt
Construct a cpp code solution to the problem outlined:
Little girl Alyona is in a shop to buy some copybooks for school. She study four subjects so she wants to have equal number of copybooks for each of the subjects. There are three types of copybook's packs in the shop: it is possible to buy one copybook... |
#include <bits/stdc++.h>
using namespace std;
int main() {
long long n, a, b, c;
cin >> n >> a >> b >> c;
if (n % 4 == 0) {
cout << 0;
return 0;
} else if (n % 4 == 1) {
cout << min(min(3 * a, a + b), c);
return 0;
} else if (n % 4 == 2) {
cout << min(min(2 * a, b), 2 * c);
} else if (n ... | ### Prompt
Please create a solution in CPP to the following problem:
Little girl Alyona is in a shop to buy some copybooks for school. She study four subjects so she wants to have equal number of copybooks for each of the subjects. There are three types of copybook's packs in the shop: it is possible to buy one copyb... |
#include <bits/stdc++.h>
using namespace std;
int main() {
long long N, A, B, C;
cin >> N >> A >> B >> C;
long long K = (4 - N % 4) % 4;
if (K == 0) {
printf("0\n");
} else if (K == 3) {
long long ans = A + A + A;
ans = min(ans, A + B);
ans = min(ans, C);
cout << ans << endl;
} else if (... | ### Prompt
Please create a solution in Cpp to the following problem:
Little girl Alyona is in a shop to buy some copybooks for school. She study four subjects so she wants to have equal number of copybooks for each of the subjects. There are three types of copybook's packs in the shop: it is possible to buy one copyb... |
#include <bits/stdc++.h>
using namespace std;
int main() {
long long n, a, b, c;
while (~scanf("%lld%lld%lld%lld", &n, &a, &b, &c)) {
if (n % 4 == 0) {
printf("0\n");
} else {
n = 4 - n % 4;
if (n == 1) {
printf("%lld\n", min(b + c, min(a, 3 * c)));
} else if (n == 2) {
... | ### Prompt
In cpp, your task is to solve the following problem:
Little girl Alyona is in a shop to buy some copybooks for school. She study four subjects so she wants to have equal number of copybooks for each of the subjects. There are three types of copybook's packs in the shop: it is possible to buy one copybook f... |
#include <bits/stdc++.h>
using namespace std;
long long ans = 1e17;
long long n, a, b, c;
void dfs(long long n, long long sum, int x, int y, int z) {
if (x > 3 || y > 3 || z > 3) return;
if (sum > ans) return;
if (n % 4 == 0) {
ans = min(sum, ans);
return;
}
dfs(n + 1, sum + a, x + 1, y, z);
dfs(n +... | ### Prompt
Generate a Cpp solution to the following problem:
Little girl Alyona is in a shop to buy some copybooks for school. She study four subjects so she wants to have equal number of copybooks for each of the subjects. There are three types of copybook's packs in the shop: it is possible to buy one copybook for ... |
#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T bigmod(T p, T e, T M) {
long long ret = 1;
for (; e > 0; e >>= 1) {
if (e & 1) ret = (ret * p) % M;
p = (p * p) % M;
}
return (T)ret;
}
template <class T>
inline T gcd(T a, T b) {
if (b == 0) return a;
return gcd(b, a % b);
}
... | ### Prompt
Construct a Cpp code solution to the problem outlined:
Little girl Alyona is in a shop to buy some copybooks for school. She study four subjects so she wants to have equal number of copybooks for each of the subjects. There are three types of copybook's packs in the shop: it is possible to buy one copybook... |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
const int MAXDIST = 1e9;
ll n, a, b, c;
int main() {
cin >> n >> a >> b >> c;
if (n % 4 == 0) cout << 0;
if (n % 4 == 1) cout << min(min(3 * a, b + a), c);
if (n % 4 == 2) cout << min(min(2 * a, b), 2 * c);
if (n %... | ### Prompt
Create a solution in cpp for the following problem:
Little girl Alyona is in a shop to buy some copybooks for school. She study four subjects so she wants to have equal number of copybooks for each of the subjects. There are three types of copybook's packs in the shop: it is possible to buy one copybook fo... |
#include <bits/stdc++.h>
using namespace std;
const long long mod = 998244353;
int32_t main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
long long n;
cin >> n;
long long a, b, c;
cin >> a >> b >> c;
long long ans = 1e10;
for (long long i = 0; i < (long long)5; ++i) {
... | ### Prompt
Construct a Cpp code solution to the problem outlined:
Little girl Alyona is in a shop to buy some copybooks for school. She study four subjects so she wants to have equal number of copybooks for each of the subjects. There are three types of copybook's packs in the shop: it is possible to buy one copybook... |
#include <bits/stdc++.h>
using namespace std;
long long dp[181], n, a, b, c, i, ans;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cin >> n >> a >> b >> c;
n %= 4;
for (i = 1; i <= 150; i++) dp[i] = 1000000000000000000;
dp[n] = 0;
for (i = n; i <= 100; i++) {
dp[i + 1] = min(dp[i + 1], dp[i] + a);... | ### Prompt
In cpp, your task is to solve the following problem:
Little girl Alyona is in a shop to buy some copybooks for school. She study four subjects so she wants to have equal number of copybooks for each of the subjects. There are three types of copybook's packs in the shop: it is possible to buy one copybook f... |
#include <bits/stdc++.h>
using namespace std;
const int N = 1000 + 24;
const int M = 1000 + 24;
const long long INF = 1e15;
int n, m, t;
long long a, b, c;
int main() {
while (scanf("%d%lld%lld%lld", &n, &a, &b, &c) != EOF) {
long long MAX = INF;
m = n % 4;
for (int i = 0; i <= 4; i++)
for (int j = ... | ### Prompt
Your task is to create a Cpp solution to the following problem:
Little girl Alyona is in a shop to buy some copybooks for school. She study four subjects so she wants to have equal number of copybooks for each of the subjects. There are three types of copybook's packs in the shop: it is possible to buy one... |
#include <bits/stdc++.h>
using namespace std;
long long int n, a, b, c;
long long int cost(long long int t) {
if (t < 0) {
return INT_MAX;
}
if (t == 0) {
return 0;
}
return min(min(cost(t - 1) + a, cost(t - 2) + b), cost(t - 3) + c);
}
int main() {
cin >> n >> a >> b >> c;
if (n % 4 == 0) {
c... | ### Prompt
Your task is to create a Cpp solution to the following problem:
Little girl Alyona is in a shop to buy some copybooks for school. She study four subjects so she wants to have equal number of copybooks for each of the subjects. There are three types of copybook's packs in the shop: it is possible to buy one... |
#include <bits/stdc++.h>
using namespace std;
int main() {
long long int n, a, b, c, d, ans = 0, i, j, k;
cin >> n >> a >> b >> c;
if (n % 4 == 0)
cout << 0 << endl;
else if (n % 4 == 1) {
i = min((3 * a), c);
j = a + b;
ans = min(i, j);
cout << ans << endl;
} else if (n % 4 == 2) {
i ... | ### Prompt
Please create a solution in cpp to the following problem:
Little girl Alyona is in a shop to buy some copybooks for school. She study four subjects so she wants to have equal number of copybooks for each of the subjects. There are three types of copybook's packs in the shop: it is possible to buy one copyb... |
#include <bits/stdc++.h>
using namespace std;
long long n, a, b, c;
long long k;
int main() {
cin >> n >> a >> b >> c;
(n / 4 == 0) ? k = (4 - n) : k = ((n / 4) + 1) * 4 - n;
if (k % 4 == 0) {
cout << "0";
exit(0);
}
if (k == 1) {
cout << min(min(a, 3 * c), c + b);
exit(0);
}
if (k == 2) {... | ### Prompt
Please formulate a cpp solution to the following problem:
Little girl Alyona is in a shop to buy some copybooks for school. She study four subjects so she wants to have equal number of copybooks for each of the subjects. There are three types of copybook's packs in the shop: it is possible to buy one copyb... |
#include <bits/stdc++.h>
long long n, a, b, c, ans;
using namespace std;
int main(void) {
cin >> n >> a >> b >> c;
ans = -1;
if (n % 4 == 0)
ans = 0;
else {
for (long long i = 0; i < 30; i++)
for (long long j = 0; j < 30; j++)
for (long long k = 0; k < 30; k++)
if ((n + i * 1 + j... | ### Prompt
Construct a CPP code solution to the problem outlined:
Little girl Alyona is in a shop to buy some copybooks for school. She study four subjects so she wants to have equal number of copybooks for each of the subjects. There are three types of copybook's packs in the shop: it is possible to buy one copybook... |
#include <bits/stdc++.h>
using namespace std;
long long dp[1005];
const long long inf = 1e18;
int main() {
long long n;
long long a[5];
cin >> n;
for (int i = 1; i <= 3; i++) cin >> a[i];
dp[0] = 0;
for (int i = 1; i <= 1000; i++) dp[i] = inf;
for (int i = 1; i <= 3; i++)
for (int j = i; j <= 1000; j+... | ### Prompt
Please provide a Cpp coded solution to the problem described below:
Little girl Alyona is in a shop to buy some copybooks for school. She study four subjects so she wants to have equal number of copybooks for each of the subjects. There are three types of copybook's packs in the shop: it is possible to buy... |
#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9;
const long long INF = 1e18;
long long n, a, b, c;
int main() {
scanf("%lld%lld%lld%lld", &n, &a, &b, &c);
if (n % 4 == 0)
cout << 0;
else if (4 - n % 4 == 1)
cout << min(c + b, min(a, c + c + c));
else if (4 - n % 4 == 2)
cout << min... | ### Prompt
Your challenge is to write a Cpp solution to the following problem:
Little girl Alyona is in a shop to buy some copybooks for school. She study four subjects so she wants to have equal number of copybooks for each of the subjects. There are three types of copybook's packs in the shop: it is possible to buy... |
#include <bits/stdc++.h>
int dx[4] = {-1, 0, 1, 0};
int dy[4] = {0, 1, 0, -1};
using namespace std;
int main() {
long long n, a, b, c;
cin >> n >> a >> b >> c;
if (n % 4 == 0) {
cout << 0;
return 0;
}
if (n % 4 == 1) {
cout << min(min(3 * a, c), a + b);
return 0;
}
if (n % 4 == 2) {
co... | ### Prompt
Develop a solution in CPP to the problem described below:
Little girl Alyona is in a shop to buy some copybooks for school. She study four subjects so she wants to have equal number of copybooks for each of the subjects. There are three types of copybook's packs in the shop: it is possible to buy one copyb... |
#include <bits/stdc++.h>
using namespace std;
long long menor = LONG_LONG_MAX;
long long n, a, b, c;
int go(long long nn, long long sum) {
if ((nn % 4) == 0) menor = min(menor, sum);
if (nn > 4 * n) return 0;
go(nn + 1, sum + a);
go(nn + 2, sum + b);
go(nn + 3, sum + c);
return 0;
}
int main() {
cin >> n ... | ### Prompt
Please formulate a Cpp solution to the following problem:
Little girl Alyona is in a shop to buy some copybooks for school. She study four subjects so she wants to have equal number of copybooks for each of the subjects. There are three types of copybook's packs in the shop: it is possible to buy one copyb... |
#include <bits/stdc++.h>
using namespace std;
int main() {
long long n, a, b, c;
cin >> n >> a >> b >> c;
n = n % 4;
if (n == 0)
cout << 0;
else if (n == 1) {
cout << min(3 * a, min(a + b, c));
} else if (n == 2) {
cout << min(2 * a, min(b, 2 * c));
} else {
cout << min(a, min(b + c, 3 * c... | ### Prompt
In cpp, your task is to solve the following problem:
Little girl Alyona is in a shop to buy some copybooks for school. She study four subjects so she wants to have equal number of copybooks for each of the subjects. There are three types of copybook's packs in the shop: it is possible to buy one copybook f... |
#include <bits/stdc++.h>
using namespace std;
const int N = 3500;
const int Mod = 1e9 + 7;
long long f[N];
int main() {
long long n, a, b, c;
while (cin >> n >> a >> b >> c) {
long long ans = 1e18;
for (int i = 1; i < N; i++) f[i] = 1e18;
f[0] = 0;
for (int i = 1; i <= 12; i++) {
if (i >= 1) f... | ### Prompt
Please formulate a cpp solution to the following problem:
Little girl Alyona is in a shop to buy some copybooks for school. She study four subjects so she wants to have equal number of copybooks for each of the subjects. There are three types of copybook's packs in the shop: it is possible to buy one copyb... |
#include <bits/stdc++.h>
using namespace std;
int main() {
long long int n, a, b, c, k, l, m, n1, o;
vector<long long int> s;
cin >> n >> a >> b >> c;
if (n % 4 == 0) {
cout << "0" << endl;
} else {
l = ((n / 4) + 1) * 4;
k = l - n;
m = k * a;
if (k == 1) {
n1 = min(m, min(b + c, c *... | ### Prompt
Develop a solution in cpp to the problem described below:
Little girl Alyona is in a shop to buy some copybooks for school. She study four subjects so she wants to have equal number of copybooks for each of the subjects. There are three types of copybook's packs in the shop: it is possible to buy one copyb... |
#include <bits/stdc++.h>
using namespace std;
long long int n, a, b, c, extra, ans = 0;
int main() {
scanf("%lld%lld%lld%lld", &n, &a, &b, &c);
extra = n % 4;
if (extra == 0) {
printf("0");
return 0;
} else if (extra == 1) {
ans += min((3 * a), min(c, (a + b)));
} else if (extra == 2) {
ans +=... | ### Prompt
Construct a Cpp code solution to the problem outlined:
Little girl Alyona is in a shop to buy some copybooks for school. She study four subjects so she wants to have equal number of copybooks for each of the subjects. There are three types of copybook's packs in the shop: it is possible to buy one copybook... |
#include <bits/stdc++.h>
using namespace std;
int main() {
long long int n, a, b, c;
cin >> n >> a >> b >> c;
n %= 4;
if (n == 1)
cout << min(3 * a, min(b + a, c)) << endl;
else if (n == 2)
cout << min(2 * c, min(b, 2 * a)) << endl;
else if (n == 3)
cout << min(min(a, 3 * c), b + c) << endl;
e... | ### Prompt
Construct a cpp code solution to the problem outlined:
Little girl Alyona is in a shop to buy some copybooks for school. She study four subjects so she wants to have equal number of copybooks for each of the subjects. There are three types of copybook's packs in the shop: it is possible to buy one copybook... |
#include <bits/stdc++.h>
using namespace std;
int main() {
long long n, a, b, c;
cin >> n >> a >> b >> c;
int k = n % 4;
switch (k) {
case 0:
cout << "0\n";
break;
case 1:
cout << min(min(c, 3 * a), a + b) << '\n';
break;
case 2:
cout << min(min(b, 2 * a), 2 * c) << '\n... | ### Prompt
In Cpp, your task is to solve the following problem:
Little girl Alyona is in a shop to buy some copybooks for school. She study four subjects so she wants to have equal number of copybooks for each of the subjects. There are three types of copybook's packs in the shop: it is possible to buy one copybook f... |
#include <bits/stdc++.h>
using namespace std;
inline long long read() {
long long num = 0, neg = 1;
char c = getchar();
while (!isdigit(c)) {
if (c == '-') neg = -1;
c = getchar();
}
while (isdigit(c)) {
num = (num << 3) + (num << 1) + c - '0';
c = getchar();
}
return num * neg;
}
long lon... | ### Prompt
Create a solution in Cpp for the following problem:
Little girl Alyona is in a shop to buy some copybooks for school. She study four subjects so she wants to have equal number of copybooks for each of the subjects. There are three types of copybook's packs in the shop: it is possible to buy one copybook fo... |
#include <bits/stdc++.h>
using namespace std;
long long n, m, k, cnt, ans, a, b, sum, c, mn, mn1;
char ch;
const long long mod = 1e9 + 7;
map<long long, long long> mp;
string s, s1;
int main() {
ios_base::sync_with_stdio(0);
cin >> n >> a >> b >> c;
if (n % 4 == 0) return cout << 0, 0;
n = n % 4;
if (n == 1) ... | ### Prompt
Construct a Cpp code solution to the problem outlined:
Little girl Alyona is in a shop to buy some copybooks for school. She study four subjects so she wants to have equal number of copybooks for each of the subjects. There are three types of copybook's packs in the shop: it is possible to buy one copybook... |
#include <bits/stdc++.h>
using namespace std;
long long ans = ((long long)(1 << 31) * (long long)(1 << 31)), n, a, b, c;
long long dfs(long long k) {
if (k > 11) return ((long long)(1 << 31) * (long long)(1 << 31));
if ((n + k) % 4 == 0) return 0;
return min({a + dfs(k + 1), b + dfs(k + 2), c + dfs(k + 3)});
}
in... | ### Prompt
Generate a cpp solution to the following problem:
Little girl Alyona is in a shop to buy some copybooks for school. She study four subjects so she wants to have equal number of copybooks for each of the subjects. There are three types of copybook's packs in the shop: it is possible to buy one copybook for ... |
#include <bits/stdc++.h>
using namespace std;
long long min(long long a, long long b, long long c) {
a = a < b ? a : b;
return a < c ? a : c;
}
int main() {
long long n, a, b, c;
int k;
long long mins;
cin >> n >> a >> b >> c;
n = n % 4;
if (n == 4)
printf("0\n");
else {
if (n == 3) mins = min... | ### Prompt
Please provide a CPP coded solution to the problem described below:
Little girl Alyona is in a shop to buy some copybooks for school. She study four subjects so she wants to have equal number of copybooks for each of the subjects. There are three types of copybook's packs in the shop: it is possible to buy... |
#include <bits/stdc++.h>
using namespace std;
int main() {
long long int n, a, b, c;
cin >> n >> a >> b >> c;
if (n % 4 == 0) {
cout << 0 << '\n';
return 0;
}
if (n % 4 == 3) {
long long int ans = a;
ans = min(ans, b + c);
ans = min(ans, 3 * c);
cout << ans << '\n';
return 0;
}
... | ### Prompt
Your challenge is to write a cpp solution to the following problem:
Little girl Alyona is in a shop to buy some copybooks for school. She study four subjects so she wants to have equal number of copybooks for each of the subjects. There are three types of copybook's packs in the shop: it is possible to buy... |
#include <bits/stdc++.h>
using namespace std;
int main() {
long long n, a, b, c, s = 0, k = 1;
cin >> n >> a >> b >> c;
vector<long long> v;
s = 4 - (n % 4);
if (s == 1) {
cout << min(a, min(b + c, 3 * c));
} else if (s == 2) {
cout << min(b, min(2 * a, 2 * c));
} else if (s == 3) {
cout << mi... | ### Prompt
Please provide a CPP coded solution to the problem described below:
Little girl Alyona is in a shop to buy some copybooks for school. She study four subjects so she wants to have equal number of copybooks for each of the subjects. There are three types of copybook's packs in the shop: it is possible to buy... |
#include <bits/stdc++.h>
using namespace std;
int main() {
long long int n, a, b, c, m = 0, l = 0, p, q, r, s, ans;
long double ara[3];
cin >> n >> a >> b >> c;
if (n % 4 == 0)
cout << "0";
else {
if (n % 2 == 0) {
while (n % 4 != 0) {
l++;
n = n + 3;
}
ans = min(2 * ... | ### Prompt
Your challenge is to write a cpp solution to the following problem:
Little girl Alyona is in a shop to buy some copybooks for school. She study four subjects so she wants to have equal number of copybooks for each of the subjects. There are three types of copybook's packs in the shop: it is possible to buy... |
#include <bits/stdc++.h>
using namespace std;
struct node {
long long num;
long long cost;
};
int32_t main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
long long n, a, b, c;
cin >> n >> a >> b >> c;
queue<node> q;
node to;
to.num = n;
to.cost = 0;
q.push(to);
long long minx = 1e18;
whi... | ### Prompt
In Cpp, your task is to solve the following problem:
Little girl Alyona is in a shop to buy some copybooks for school. She study four subjects so she wants to have equal number of copybooks for each of the subjects. There are three types of copybook's packs in the shop: it is possible to buy one copybook f... |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
long long a, b, c;
scanf("%d %lld %lld %lld\n", &n, &a, &b, &c);
long long res = 0;
switch (n % 4) {
case 1:
res = min(c, min(a + b, a * 3));
break;
case 2:
res = min(b, min(c * 2, a * 2));
break;
case 3:
... | ### Prompt
Your challenge is to write a cpp solution to the following problem:
Little girl Alyona is in a shop to buy some copybooks for school. She study four subjects so she wants to have equal number of copybooks for each of the subjects. There are three types of copybook's packs in the shop: it is possible to buy... |
#include <bits/stdc++.h>
using namespace std;
signed main() {
long long n, a, b, c;
cin >> n >> a >> b >> c;
if (n % 4 == 0)
cout << "0" << endl;
else if (n % 4 == 3) {
long long ans = min(a, min(b + c, 3 * c));
cout << ans << endl;
} else if (n % 4 == 2) {
long long ans = min(2 * a, min(b, 2 ... | ### Prompt
Please create a solution in Cpp to the following problem:
Little girl Alyona is in a shop to buy some copybooks for school. She study four subjects so she wants to have equal number of copybooks for each of the subjects. There are three types of copybook's packs in the shop: it is possible to buy one copyb... |
#include <bits/stdc++.h>
signed main() {
std::ios_base::sync_with_stdio(false);
std::cin.tie(nullptr);
int64_t n, a, b, c;
std::cin >> n >> a >> b >> c;
n = (4 - (n % 4)) % 4;
if (n == 0) {
std::cout << 0 << '\n';
}
if (n == 1) {
std::cout << std::min({a, c * 3, c + b}) << '\n';
}
if (n == 2... | ### Prompt
Please provide a Cpp coded solution to the problem described below:
Little girl Alyona is in a shop to buy some copybooks for school. She study four subjects so she wants to have equal number of copybooks for each of the subjects. There are three types of copybook's packs in the shop: it is possible to buy... |
#include <bits/stdc++.h>
using namespace std;
int main() {
long long int n, a, b, c;
int x;
scanf(
"%I64d"
"%I64d"
"%I64d"
"%I64d",
&n, &a, &b, &c);
if (n % 4 == 0)
x = 0;
else
x = 4 * ((n / 4) + 1) - n;
if (x == 0)
printf("0");
else if (x == 1) {
int p = (a <... | ### Prompt
Construct a CPP code solution to the problem outlined:
Little girl Alyona is in a shop to buy some copybooks for school. She study four subjects so she wants to have equal number of copybooks for each of the subjects. There are three types of copybook's packs in the shop: it is possible to buy one copybook... |
#include <bits/stdc++.h>
using namespace std;
int main() {
long long n, a, b, c;
while (cin >> n >> a >> b >> c) {
long long x = 0x3f3f3f3f;
long long data[100];
memset(data, 0x3f3f3f3f, sizeof(data));
double f = a, g = b, h = c;
int d = n % 4;
if (d == 0) {
cout << "0" << endl;
} ... | ### Prompt
Develop a solution in Cpp to the problem described below:
Little girl Alyona is in a shop to buy some copybooks for school. She study four subjects so she wants to have equal number of copybooks for each of the subjects. There are three types of copybook's packs in the shop: it is possible to buy one copyb... |
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
long long n, a, b, c;
cin >> n >> a >> b >> c;
long long ans = 0;
if (n % 4 == 3) {
ans = min(min(a, 3 * c), min(b + c, a + 2 * b));
} else if ((n) % 4 == 2) {
ans = min(2 * a, m... | ### Prompt
Construct a CPP code solution to the problem outlined:
Little girl Alyona is in a shop to buy some copybooks for school. She study four subjects so she wants to have equal number of copybooks for each of the subjects. There are three types of copybook's packs in the shop: it is possible to buy one copybook... |
#include <bits/stdc++.h>
using namespace std;
int main() {
long long n, a, b, c;
scanf("%lld%lld%lld%lld", &n, &a, &b, &c);
int r = n % 4;
if (r == 0)
printf("0\n");
else if (r == 1)
printf("%lld\n", min(a * 3, min(a + b, c)));
else if (r == 2)
printf("%lld\n", min(2 * min(a, c), b));
else if ... | ### Prompt
Your challenge is to write a CPP solution to the following problem:
Little girl Alyona is in a shop to buy some copybooks for school. She study four subjects so she wants to have equal number of copybooks for each of the subjects. There are three types of copybook's packs in the shop: it is possible to buy... |
#include <bits/stdc++.h>
using namespace std;
int main() {
long long int n, a, b, c;
cin >> n >> a >> b >> c;
if (n % 4 == 0) {
cout << 0 << endl;
} else if (n % 4 == 1) {
cout << min(min(3 * a, a + b), c) << endl;
} else if (n % 4 == 3) {
cout << min(min(a, b + c), 3 * c) << endl;
} else {
... | ### Prompt
Please provide a Cpp coded solution to the problem described below:
Little girl Alyona is in a shop to buy some copybooks for school. She study four subjects so she wants to have equal number of copybooks for each of the subjects. There are three types of copybook's packs in the shop: it is possible to buy... |
#include <bits/stdc++.h>
using namespace std;
int main() {
int a;
cin >> a;
a = a % 4;
long long b, c, d;
long long ile[3];
cin >> b >> c >> d;
if (a == 0) {
cout << 0 << endl;
exit(0);
}
if (a == 1) {
ile[0] = 3 * b;
ile[1] = b + c;
ile[2] = d;
sort(ile, ile + 3);
cout << ... | ### Prompt
Your challenge is to write a cpp solution to the following problem:
Little girl Alyona is in a shop to buy some copybooks for school. She study four subjects so she wants to have equal number of copybooks for each of the subjects. There are three types of copybook's packs in the shop: it is possible to buy... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.