diff --git a/solutions/aleidibio.cpp b/solutions/aleidibio.cpp new file mode 100644 index 0000000..00e65f2 --- /dev/null +++ b/solutions/aleidibio.cpp @@ -0,0 +1,147 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +/* clang-format off */ + +/* 1. TYPES */ +#define ll long long +#define pii pair +#define pll pair +#define vi vector +#define vc vector +#define vll vector +#define mii map +#define si set +#define sc set + +/* 2. FUNCTIONS */ +void read() {} +template +void read(T& first, Args&... args) { std::cin >> first; read(args...); } +#define f(i,s,e) for(long long int i=s;i +std::set U(const std::set& a, const std::set& b) { + std::set result; + std::set_union(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +template +std::set I(const std::set& a, const std::set& b) { + std::set result; + std::set_intersection(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +template +std::set D(const std::set& a, const std::set& b) { + std::set result; + std::set_difference(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +/* 4 CONVERSIONS */ +template +auto toset(const U& v) -> std::set { + return std::set(v.begin(), v.end()); +} + + +/* 5 PRINTS */ +// Type trait to check if a type is a container (has begin() and end()) +template struct is_container : std::false_type {}; +template +struct is_container< + T, typename std::enable_if< + !std::is_same::value && // Exclude std::string + !std::is_same::value && // Exclude C-style strings + std::is_same())), + decltype(std::end(std::declval()))>::value>::type> + : std::true_type {}; +// Base case: types that are not containers or strings +template +typename std::enable_if::value && + !std::is_same::value>::type +print(const T& x) {std::cout << x;} +// Overload for strings and C-style strings +void print(const std::string& s) { std::cout << s; } +void print(const char* s) { std::cout << s; } +// Overload for pairs +template void print(const std::pair& p) { std::cout << "(";print(p.first); std::cout << ", "; print(p.second);std::cout << ")";} +// Overload for containers +template +typename std::enable_if::value>::type print(const T& container) { std::cout << "[";bool first = true;for (const auto& element : container) {if (!first) std::cout << ", "; print(element); first = false; } std::cout << "]"; } +template +void print(const T& first, const Args&... args) { print(first); print(args...); } +/* 6. UTILS */ +#define MOD 1000000007 +#define PI 3.1415926535897932384626433832795 +#define NL "\n" +ll min(ll a,int b) { if (ab) return a; return b; } +ll max(int a,ll b) { if (a>b) return a; return b; } +ll gcd(ll a,ll b) { if (b==0) return a; return gcd(b, a%b); } +ll lcm(ll a,ll b) { return a/gcd(a,b)*b; } +string to_upper(string a) { for (int i=0;i<(int)a.size();++i) if (a[i]>='a' && a[i]<='z') a[i]-='a'-'A'; return a; } +string to_lower(string a) { for (int i=0;i<(int)a.size();++i) if (a[i]>='A' && a[i]<='Z') a[i]+='a'-'A'; return a; } +bool prime(ll a) { if (a==1) return 0; for (int i=2;i<=round(sqrt(a));++i) if (a%i==0) return 0; return 1; } +void yes() { cout<<"YES\n"; } +void no() { cout<<"NO\n"; } + +/* 7. All Required define Pre-Processors and typedef Constants */ +typedef long int int32; +typedef unsigned long int uint32; +typedef long long int int64; +typedef unsigned long long int uint64; +typedef string str; + +/* clang-format on */ +#define ONLINE_JUDGE 1 + +int main(int argc, char* argv[]) { + ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); +#ifndef ONLINE_JUDGE + freopen("input.txt", "r", stdin); // input.txt + freopen("output.txt", "w", stdout); // output.txt +#endif + ll mins_from_h_to_a, mins_from_a_to_c, minute_of_day_film_start; + read(mins_from_h_to_a, mins_from_a_to_c, minute_of_day_film_start); + + print(minute_of_day_film_start - mins_from_h_to_a - mins_from_a_to_c, NL); + + return 0; +} \ No newline at end of file diff --git a/solutions/autori.cpp b/solutions/autori.cpp new file mode 100644 index 0000000..047b743 --- /dev/null +++ b/solutions/autori.cpp @@ -0,0 +1,150 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +/* clang-format off */ + +/* 1. TYPES */ +#define ll long long +#define pii pair +#define pll pair +#define vi vector +#define vc vector +#define vs vector +#define vll vector +#define mii map +#define si set +#define sc set + +/* 2. FUNCTIONS */ +void read() {} +template +void read(T& first, Args&... args) { std::cin >> first; read(args...); } +#define f(i,s,e) for(long long int i=s;i +std::set U(const std::set& a, const std::set& b) { + std::set result; + std::set_union(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +template +std::set I(const std::set& a, const std::set& b) { + std::set result; + std::set_intersection(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +template +std::set D(const std::set& a, const std::set& b) { + std::set result; + std::set_difference(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +/* 4 CONVERSIONS */ +template +auto toset(const U& v) -> std::set { + return std::set(v.begin(), v.end()); +} + + +/* 5 PRINTS */ +// Type trait to check if a type is a container (has begin() and end()) +template struct is_container : std::false_type {}; +template +struct is_container< + T, typename std::enable_if< + !std::is_same::value && // Exclude std::string + !std::is_same::value && // Exclude C-style strings + std::is_same())), + decltype(std::end(std::declval()))>::value>::type> + : std::true_type {}; +// Base case: types that are not containers or strings +template +typename std::enable_if::value && + !std::is_same::value>::type +print(const T& x) {std::cout << x;} +// Overload for strings and C-style strings +void print(const std::string& s) { std::cout << s; } +void print(const char* s) { std::cout << s; } +// Overload for pairs +template void print(const std::pair& p) { std::cout << "(";print(p.first); std::cout << ", "; print(p.second);std::cout << ")";} +// Overload for containers +template +typename std::enable_if::value>::type print(const T& container) { std::cout << "[";bool first = true;for (const auto& element : container) {if (!first) std::cout << ", "; print(element); first = false; } std::cout << "]"; } +template +void print(const T& first, const Args&... args) { print(first); print(args...); } +/* 6. UTILS */ +#define MOD 1000000007 +#define PI 3.1415926535897932384626433832795 +#define NL "\n" +ll min(ll a,int b) { if (ab) return a; return b; } +ll max(int a,ll b) { if (a>b) return a; return b; } +ll gcd(ll a,ll b) { if (b==0) return a; return gcd(b, a%b); } +ll lcm(ll a,ll b) { return a/gcd(a,b)*b; } +string to_upper(string a) { for (int i=0;i<(int)a.size();++i) if (a[i]>='a' && a[i]<='z') a[i]-='a'-'A'; return a; } +string to_lower(string a) { for (int i=0;i<(int)a.size();++i) if (a[i]>='A' && a[i]<='Z') a[i]+='a'-'A'; return a; } +bool prime(ll a) { if (a==1) return 0; for (int i=2;i<=round(sqrt(a));++i) if (a%i==0) return 0; return 1; } +void yes() { cout<<"YES\n"; } +void no() { cout<<"NO\n"; } + +/* 7. All Required define Pre-Processors and typedef Constants */ +typedef long int int32; +typedef unsigned long int uint32; +typedef long long int int64; +typedef unsigned long long int uint64; +typedef string str; + +/* clang-format on */ +#define ONLINE_JUDGE 1 + +int main(int argc, char* argv[]) { + ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); +#ifndef ONLINE_JUDGE + freopen("input.txt", "r", stdin); // input.txt + freopen("output.txt", "w", stdout); // output.txt +#endif + str w; + read(w); + vc abbrvs; + abbrvs.pb(w[0]); + f(i, 0, w.length()) IF(w[i] == '-', abbrvs.pb(w[i + 1]), continue); + EACH(abbr, abbrvs) { print(abbr); } + return 0; +} diff --git a/solutions/bergmal.cpp b/solutions/bergmal.cpp new file mode 100644 index 0000000..e9dbdf6 --- /dev/null +++ b/solutions/bergmal.cpp @@ -0,0 +1,154 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +/* clang-format off */ + +/* 1. TYPES */ +#define ll long long +#define pii pair +#define pll pair +#define vi vector +#define vc vector +#define vll vector +#define mii map +#define si set +#define sc set + +/* 2. FUNCTIONS */ +void read() {} +template +void read(T& first, Args&... args) { std::cin >> first; read(args...); } +#define f(i,s,e) for(long long int i=s;i +std::set U(const std::set& a, const std::set& b) { + std::set result; + std::set_union(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +template +std::set I(const std::set& a, const std::set& b) { + std::set result; + std::set_intersection(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +template +std::set D(const std::set& a, const std::set& b) { + std::set result; + std::set_difference(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +/* 4 CONVERSIONS */ +template +auto toset(const U& v) -> std::set { + return std::set(v.begin(), v.end()); +} + + +/* 5 PRINTS */ +// Type trait to check if a type is a container (has begin() and end()) +template struct is_container : std::false_type {}; +template +struct is_container< + T, typename std::enable_if< + !std::is_same::value && // Exclude std::string + !std::is_same::value && // Exclude C-style strings + std::is_same())), + decltype(std::end(std::declval()))>::value>::type> + : std::true_type {}; +// Base case: types that are not containers or strings +template +typename std::enable_if::value && + !std::is_same::value>::type +print(const T& x) {std::cout << x;} +// Overload for strings and C-style strings +void print(const std::string& s) { std::cout << s; } +void print(const char* s) { std::cout << s; } +// Overload for pairs +template void print(const std::pair& p) { std::cout << "(";print(p.first); std::cout << ", "; print(p.second);std::cout << ")";} +// Overload for containers +template +typename std::enable_if::value>::type print(const T& container) { std::cout << "[";bool first = true;for (const auto& element : container) {if (!first) std::cout << ", "; print(element); first = false; } std::cout << "]"; } +template +void print(const T& first, const Args&... args) { print(first); print(args...); } +/* 6. UTILS */ +#define MOD 1000000007 +#define PI 3.1415926535897932384626433832795 +#define NL "\n" +ll min(ll a,int b) { if (ab) return a; return b; } +ll max(int a,ll b) { if (a>b) return a; return b; } +ll gcd(ll a,ll b) { if (b==0) return a; return gcd(b, a%b); } +ll lcm(ll a,ll b) { return a/gcd(a,b)*b; } +string to_upper(string a) { for (int i=0;i<(int)a.size();++i) if (a[i]>='a' && a[i]<='z') a[i]-='a'-'A'; return a; } +string to_lower(string a) { for (int i=0;i<(int)a.size();++i) if (a[i]>='A' && a[i]<='Z') a[i]+='a'-'A'; return a; } +bool prime(ll a) { if (a==1) return 0; for (int i=2;i<=round(sqrt(a));++i) if (a%i==0) return 0; return 1; } +void yes() { cout<<"YES\n"; } +void no() { cout<<"NO\n"; } + +/* 7. All Required define Pre-Processors and typedef Constants */ +typedef long int int32; +typedef unsigned long int uint32; +typedef long long int int64; +typedef unsigned long long int uint64; +typedef string str; + +/* clang-format on */ +#define ONLINE_JUDGE 1 + +int main(int argc, char* argv[]) { + ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); +#ifndef ONLINE_JUDGE + freopen("input.txt", "r", stdin); // input.txt + freopen("output.txt", "w", stdout); // output.txt +#endif + str a; + + for (int i = 0; i < 1000; i++) { + str temp; + read(temp); + a += temp; + a += " "; + } + + print(a); + + return 0; +} \ No newline at end of file diff --git a/solutions/bestagjofin.cpp b/solutions/bestagjofin.cpp new file mode 100644 index 0000000..1817396 --- /dev/null +++ b/solutions/bestagjofin.cpp @@ -0,0 +1,180 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +/* clang-format off */ + +/* 1. TYPES */ +#define ll long long +#define pii pair +#define pll pair +#define vi vector +#define vc vector +#define vs vector +#define vpsi vector> +#define vll vector +#define mii map +#define si set +#define sc set + +/* 2. FUNCTIONS */ +void read() {} +template +void read(T& first, Args&... args) { std::cin >> first; read(args...); } +#define f(i,s,e) for(long long int i=s;i + constexpr T&& operator()(T&& t) const noexcept { + return std::forward(t); + } +}; +template +auto argmin(Iterator begin, Iterator end, Func func = {}) { + auto it = std::min_element(begin, end, [&](const auto& a, const auto& b) { + return func(a) < func(b); + }); + return std::distance(begin, it); +} +template +auto argmax(Iterator begin, Iterator end, Func func = {}) { + auto it = std::max_element(begin, end, [&](const auto& a, const auto& b) { + return func(a) < func(b); + }); + return std::distance(begin, it); +} + +#define flr(x) floor(x) // Shortcut for floor +#define cl(x) ceil(x) // Shortcut for ceil + +template +std::set U(const std::set& a, const std::set& b) { + std::set result; + std::set_union(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +template +std::set I(const std::set& a, const std::set& b) { + std::set result; + std::set_intersection(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +template +std::set D(const std::set& a, const std::set& b) { + std::set result; + std::set_difference(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +/* 4 CONVERSIONS */ +template +auto toset(const U& v) -> std::set { + return std::set(v.begin(), v.end()); +} + + +/* 5 PRINTS */ +// Type trait to check if a type is a container (has begin() and end()) +template struct is_container : std::false_type {}; +template +struct is_container< + T, typename std::enable_if< + !std::is_same::value && // Exclude std::string + !std::is_same::value && // Exclude C-style strings + std::is_same())), + decltype(std::end(std::declval()))>::value>::type> + : std::true_type {}; +// Base case: types that are not containers or strings +template +typename std::enable_if::value && + !std::is_same::value>::type +print(const T& x) {std::cout << x;} +// Overload for strings and C-style strings +void print(const std::string& s) { std::cout << s; } +void print(const char* s) { std::cout << s; } +// Overload for pairs +template void print(const std::pair& p) { std::cout << "(";print(p.first); std::cout << ", "; print(p.second);std::cout << ")";} +// Overload for containers +template +typename std::enable_if::value>::type print(const T& container) { std::cout << "[";bool first = true;for (const auto& element : container) {if (!first) std::cout << ", "; print(element); first = false; } std::cout << "]"; } +template +void print(const T& first, const Args&... args) { print(first); print(args...); } +/* 6. UTILS */ +#define MOD 1000000007 +#define PI 3.1415926535897932384626433832795 +#define NL "\n" +ll min(ll a,int b) { if (ab) return a; return b; } +ll max(int a,ll b) { if (a>b) return a; return b; } +ll gcd(ll a,ll b) { if (b==0) return a; return gcd(b, a%b); } +ll lcm(ll a,ll b) { return a/gcd(a,b)*b; } +string to_upper(string a) { for (int i=0;i<(int)a.size();++i) if (a[i]>='a' && a[i]<='z') a[i]-='a'-'A'; return a; } +string to_lower(string a) { for (int i=0;i<(int)a.size();++i) if (a[i]>='A' && a[i]<='Z') a[i]+='a'-'A'; return a; } +bool prime(ll a) { if (a==1) return 0; for (int i=2;i<=round(sqrt(a));++i) if (a%i==0) return 0; return 1; } +void yes() { cout<<"YES\n"; } +void no() { cout<<"NO\n"; } + +/* 7. All Required define Pre-Processors and typedef Constants */ +typedef long int int32; +typedef unsigned long int uint32; +typedef long long int int64; +typedef unsigned long long int uint64; +typedef string str; + +/* clang-format on */ +#define ONLINE_JUDGE 1 + +int main(int argc, char* argv[]) { + ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); +#ifndef ONLINE_JUDGE + freopen("input.txt", "r", stdin); // input.txt + freopen("output.txt", "w", stdout); // output.txt +#endif + ll n; + read(n); + vpsi v; + + f(i, 0, n) { + str nm; + ll fun; + read(nm, fun); + v.pb({nm, fun}); + } + int idx = argmax(v.B, v.E, [](auto x) { return x.S; }); + print(v[idx].F, NL); + return 0; +} \ No newline at end of file diff --git a/solutions/bladra2.cpp b/solutions/bladra2.cpp new file mode 100644 index 0000000..9d01c18 --- /dev/null +++ b/solutions/bladra2.cpp @@ -0,0 +1,150 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +/* clang-format off */ + +/* 1. TYPES */ +#define ll long long +#define pii pair +#define pll pair +#define vi vector +#define vc vector +#define vll vector +#define mii map +#define si set +#define sc set + +/* 2. FUNCTIONS */ +void read() {} +template +void read(T& first, Args&... args) { std::cin >> first; read(args...); } +#define f(i,s,e) for(long long int i=s;i +std::set U(const std::set& a, const std::set& b) { + std::set result; + std::set_union(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +template +std::set I(const std::set& a, const std::set& b) { + std::set result; + std::set_intersection(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +template +std::set D(const std::set& a, const std::set& b) { + std::set result; + std::set_difference(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +/* 4 CONVERSIONS */ +template +auto toset(const U& v) -> std::set { + return std::set(v.begin(), v.end()); +} + + +/* 5 PRINTS */ +// Type trait to check if a type is a container (has begin() and end()) +template struct is_container : std::false_type {}; +template +struct is_container< + T, typename std::enable_if< + !std::is_same::value && // Exclude std::string + !std::is_same::value && // Exclude C-style strings + std::is_same())), + decltype(std::end(std::declval()))>::value>::type> + : std::true_type {}; +// Base case: types that are not containers or strings +template +typename std::enable_if::value && + !std::is_same::value>::type +print(const T& x) {std::cout << x;} +// Overload for strings and C-style strings +void print(const std::string& s) { std::cout << s; } +void print(const char* s) { std::cout << s; } +// Overload for pairs +template void print(const std::pair& p) { std::cout << "(";print(p.first); std::cout << ", "; print(p.second);std::cout << ")";} +// Overload for containers +template +typename std::enable_if::value>::type print(const T& container) { std::cout << "[";bool first = true;for (const auto& element : container) {if (!first) std::cout << ", "; print(element); first = false; } std::cout << "]"; } +template +void print(const T& first, const Args&... args) { print(first); print(args...); } +/* 6. UTILS */ +#define MOD 1000000007 +#define PI 3.1415926535897932384626433832795 +#define NL "\n" +ll min(ll a,int b) { if (ab) return a; return b; } +ll max(int a,ll b) { if (a>b) return a; return b; } +ll gcd(ll a,ll b) { if (b==0) return a; return gcd(b, a%b); } +ll lcm(ll a,ll b) { return a/gcd(a,b)*b; } +string to_upper(string a) { for (int i=0;i<(int)a.size();++i) if (a[i]>='a' && a[i]<='z') a[i]-='a'-'A'; return a; } +string to_lower(string a) { for (int i=0;i<(int)a.size();++i) if (a[i]>='A' && a[i]<='Z') a[i]+='a'-'A'; return a; } +bool prime(ll a) { if (a==1) return 0; for (int i=2;i<=round(sqrt(a));++i) if (a%i==0) return 0; return 1; } +void yes() { cout<<"YES\n"; } +void no() { cout<<"NO\n"; } + +/* 7. All Required define Pre-Processors and typedef Constants */ +typedef long int int32; +typedef unsigned long int uint32; +typedef long long int int64; +typedef unsigned long long int uint64; +typedef string str; + +/* clang-format on */ +#define ONLINE_JUDGE 1 + +int main(int argc, char* argv[]) { + ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); +#ifndef ONLINE_JUDGE + freopen("input.txt", "r", stdin); // input.txt + freopen("output.txt", "w", stdout); // output.txt +#endif + double v, a, t; + read(v, a, t); + + double d = (v * t) + 0.5 * a * pow(t, 2); + + print(d); + + return 0; +} \ No newline at end of file diff --git a/solutions/blandadbest.cpp b/solutions/blandadbest.cpp new file mode 100644 index 0000000..d55125b --- /dev/null +++ b/solutions/blandadbest.cpp @@ -0,0 +1,150 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +/* clang-format off */ + +/* 1. TYPES */ +#define ll long long +#define pii pair +#define pll pair +#define vi vector +#define vc vector +#define vs vector +#define vll vector +#define mii map +#define si set +#define sc set + +/* 2. FUNCTIONS */ +void read() {} +template +void read(T& first, Args&... args) { std::cin >> first; read(args...); } +#define f(i,s,e) for(long long int i=s;i +std::set U(const std::set& a, const std::set& b) { + std::set result; + std::set_union(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +template +std::set I(const std::set& a, const std::set& b) { + std::set result; + std::set_intersection(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +template +std::set D(const std::set& a, const std::set& b) { + std::set result; + std::set_difference(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +/* 4 CONVERSIONS */ +template +auto toset(const U& v) -> std::set { + return std::set(v.begin(), v.end()); +} + + +/* 5 PRINTS */ +// Type trait to check if a type is a container (has begin() and end()) +template struct is_container : std::false_type {}; +template +struct is_container< + T, typename std::enable_if< + !std::is_same::value && // Exclude std::string + !std::is_same::value && // Exclude C-style strings + std::is_same())), + decltype(std::end(std::declval()))>::value>::type> + : std::true_type {}; +// Base case: types that are not containers or strings +template +typename std::enable_if::value && + !std::is_same::value>::type +print(const T& x) {std::cout << x;} +// Overload for strings and C-style strings +void print(const std::string& s) { std::cout << s; } +void print(const char* s) { std::cout << s; } +// Overload for pairs +template void print(const std::pair& p) { std::cout << "(";print(p.first); std::cout << ", "; print(p.second);std::cout << ")";} +// Overload for containers +template +typename std::enable_if::value>::type print(const T& container) { std::cout << "[";bool first = true;for (const auto& element : container) {if (!first) std::cout << ", "; print(element); first = false; } std::cout << "]"; } +template +void print(const T& first, const Args&... args) { print(first); print(args...); } +/* 6. UTILS */ +#define MOD 1000000007 +#define PI 3.1415926535897932384626433832795 +#define NL "\n" +ll min(ll a,int b) { if (ab) return a; return b; } +ll max(int a,ll b) { if (a>b) return a; return b; } +ll gcd(ll a,ll b) { if (b==0) return a; return gcd(b, a%b); } +ll lcm(ll a,ll b) { return a/gcd(a,b)*b; } +string to_upper(string a) { for (int i=0;i<(int)a.size();++i) if (a[i]>='a' && a[i]<='z') a[i]-='a'-'A'; return a; } +string to_lower(string a) { for (int i=0;i<(int)a.size();++i) if (a[i]>='A' && a[i]<='Z') a[i]+='a'-'A'; return a; } +bool prime(ll a) { if (a==1) return 0; for (int i=2;i<=round(sqrt(a));++i) if (a%i==0) return 0; return 1; } +void yes() { cout<<"YES\n"; } +void no() { cout<<"NO\n"; } + +/* 7. All Required define Pre-Processors and typedef Constants */ +typedef long int int32; +typedef unsigned long int uint32; +typedef long long int int64; +typedef unsigned long long int uint64; +typedef string str; + +/* clang-format on */ +#define ONLINE_JUDGE 1 + +int main(int argc, char* argv[]) { + ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); +#ifndef ONLINE_JUDGE + freopen("input.txt", "r", stdin); // input.txt + freopen("output.txt", "w", stdout); // output.txt +#endif + ll a; + str w1, w2; + read(a, w1, w2); + + IF(a == 1, print(w1), print("blandad best")); + + return 0; +} \ No newline at end of file diff --git a/solutions/dagatal.cpp b/solutions/dagatal.cpp new file mode 100644 index 0000000..dde9c74 --- /dev/null +++ b/solutions/dagatal.cpp @@ -0,0 +1,152 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +/* clang-format off */ + +/* 1. TYPES */ +#define ll long long +#define pii pair +#define pll pair +#define vi vector +#define vc vector +#define vll vector +#define mii map +#define si set +#define sc set + +/* 2. FUNCTIONS */ +void read() {} +template +void read(T& first, Args&... args) { std::cin >> first; read(args...); } +#define f(i,s,e) for(long long int i=s;i +std::set U(const std::set& a, const std::set& b) { + std::set result; + std::set_union(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +template +std::set I(const std::set& a, const std::set& b) { + std::set result; + std::set_intersection(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +template +std::set D(const std::set& a, const std::set& b) { + std::set result; + std::set_difference(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +/* 4 CONVERSIONS */ +template +auto toset(const U& v) -> std::set { + return std::set(v.begin(), v.end()); +} + + +/* 5 PRINTS */ +// Type trait to check if a type is a container (has begin() and end()) +template struct is_container : std::false_type {}; +template +struct is_container< + T, typename std::enable_if< + !std::is_same::value && // Exclude std::string + !std::is_same::value && // Exclude C-style strings + std::is_same())), + decltype(std::end(std::declval()))>::value>::type> + : std::true_type {}; +// Base case: types that are not containers or strings +template +typename std::enable_if::value && + !std::is_same::value>::type +print(const T& x) {std::cout << x;} +// Overload for strings and C-style strings +void print(const std::string& s) { std::cout << s; } +void print(const char* s) { std::cout << s; } +// Overload for pairs +template void print(const std::pair& p) { std::cout << "(";print(p.first); std::cout << ", "; print(p.second);std::cout << ")";} +// Overload for containers +template +typename std::enable_if::value>::type print(const T& container) { std::cout << "[";bool first = true;for (const auto& element : container) {if (!first) std::cout << ", "; print(element); first = false; } std::cout << "]"; } +template +void print(const T& first, const Args&... args) { print(first); print(args...); } +/* 6. UTILS */ +#define MOD 1000000007 +#define PI 3.1415926535897932384626433832795 +#define NL "\n" +ll min(ll a,int b) { if (ab) return a; return b; } +ll max(int a,ll b) { if (a>b) return a; return b; } +ll gcd(ll a,ll b) { if (b==0) return a; return gcd(b, a%b); } +ll lcm(ll a,ll b) { return a/gcd(a,b)*b; } +string to_upper(string a) { for (int i=0;i<(int)a.size();++i) if (a[i]>='a' && a[i]<='z') a[i]-='a'-'A'; return a; } +string to_lower(string a) { for (int i=0;i<(int)a.size();++i) if (a[i]>='A' && a[i]<='Z') a[i]+='a'-'A'; return a; } +bool prime(ll a) { if (a==1) return 0; for (int i=2;i<=round(sqrt(a));++i) if (a%i==0) return 0; return 1; } +void yes() { cout<<"YES\n"; } +void no() { cout<<"NO\n"; } + +/* 7. All Required define Pre-Processors and typedef Constants */ +typedef long int int32; +typedef unsigned long int uint32; +typedef long long int int64; +typedef unsigned long long int uint64; +typedef string str; + +/* clang-format on */ +#define ONLINE_JUDGE 1 + +map month_to_days = {{1, 31}, {2, 28}, {3, 31}, {4, 30}, + {5, 31}, {6, 30}, {7, 31}, {8, 31}, + {9, 30}, {10, 31}, {11, 30}, {12, 31}}; + +int main(int argc, char* argv[]) { + ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); +#ifndef ONLINE_JUDGE + freopen("input.txt", "r", stdin); // input.txt + freopen("output.txt", "w", stdout); // output.txt +#endif + ll a; + read(a); + + print(month_to_days[a], NL); + + return 0; +} \ No newline at end of file diff --git a/solutions/digitswap.cpp b/solutions/digitswap.cpp new file mode 100644 index 0000000..7bdc3ff --- /dev/null +++ b/solutions/digitswap.cpp @@ -0,0 +1,147 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +/* clang-format off */ + +/* 1. TYPES */ +#define ll long long +#define pii pair +#define pll pair +#define vi vector +#define vc vector +#define vs vector +#define vll vector +#define mii map +#define si set +#define sc set + +/* 2. FUNCTIONS */ +void read() {} +template +void read(T& first, Args&... args) { std::cin >> first; read(args...); } +#define f(i,s,e) for(long long int i=s;i +std::set U(const std::set& a, const std::set& b) { + std::set result; + std::set_union(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +template +std::set I(const std::set& a, const std::set& b) { + std::set result; + std::set_intersection(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +template +std::set D(const std::set& a, const std::set& b) { + std::set result; + std::set_difference(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +/* 4 CONVERSIONS */ +template +auto toset(const U& v) -> std::set { + return std::set(v.begin(), v.end()); +} + + +/* 5 PRINTS */ +// Type trait to check if a type is a container (has begin() and end()) +template struct is_container : std::false_type {}; +template +struct is_container< + T, typename std::enable_if< + !std::is_same::value && // Exclude std::string + !std::is_same::value && // Exclude C-style strings + std::is_same())), + decltype(std::end(std::declval()))>::value>::type> + : std::true_type {}; +// Base case: types that are not containers or strings +template +typename std::enable_if::value && + !std::is_same::value>::type +print(const T& x) {std::cout << x;} +// Overload for strings and C-style strings +void print(const std::string& s) { std::cout << s; } +void print(const char* s) { std::cout << s; } +// Overload for pairs +template void print(const std::pair& p) { std::cout << "(";print(p.first); std::cout << ", "; print(p.second);std::cout << ")";} +// Overload for containers +template +typename std::enable_if::value>::type print(const T& container) { std::cout << "[";bool first = true;for (const auto& element : container) {if (!first) std::cout << ", "; print(element); first = false; } std::cout << "]"; } +template +void print(const T& first, const Args&... args) { print(first); print(args...); } +/* 6. UTILS */ +#define MOD 1000000007 +#define PI 3.1415926535897932384626433832795 +#define NL "\n" +ll min(ll a,int b) { if (ab) return a; return b; } +ll max(int a,ll b) { if (a>b) return a; return b; } +ll gcd(ll a,ll b) { if (b==0) return a; return gcd(b, a%b); } +ll lcm(ll a,ll b) { return a/gcd(a,b)*b; } +string to_upper(string a) { for (int i=0;i<(int)a.size();++i) if (a[i]>='a' && a[i]<='z') a[i]-='a'-'A'; return a; } +string to_lower(string a) { for (int i=0;i<(int)a.size();++i) if (a[i]>='A' && a[i]<='Z') a[i]+='a'-'A'; return a; } +bool prime(ll a) { if (a==1) return 0; for (int i=2;i<=round(sqrt(a));++i) if (a%i==0) return 0; return 1; } +void yes() { cout<<"YES\n"; } +void no() { cout<<"NO\n"; } + +/* 7. All Required define Pre-Processors and typedef Constants */ +typedef long int int32; +typedef unsigned long int uint32; +typedef long long int int64; +typedef unsigned long long int uint64; +typedef string str; + +/* clang-format on */ +#define ONLINE_JUDGE 1 + +int main(int argc, char* argv[]) { + ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); +#ifndef ONLINE_JUDGE + freopen("input.txt", "r", stdin); // input.txt + freopen("output.txt", "w", stdout); // output.txt +#endif + str a; + read(a); + print(a[1], a[0]); + return 0; +} \ No newline at end of file diff --git a/solutions/dragafra.cpp b/solutions/dragafra.cpp new file mode 100644 index 0000000..58803f2 --- /dev/null +++ b/solutions/dragafra.cpp @@ -0,0 +1,145 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +/* clang-format off */ + +/* 1. TYPES */ +#define ll long long +#define pii pair +#define pll pair +#define vi vector +#define vc vector +#define vll vector +#define mii map +#define si set +#define sc set + +/* 2. FUNCTIONS */ +void read() {} +template +void read(T& first, Args&... args) { std::cin >> first; read(args...); } +#define f(i,s,e) for(long long int i=s;i +std::set U(const std::set& a, const std::set& b) { + std::set result; + std::set_union(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +template +std::set I(const std::set& a, const std::set& b) { + std::set result; + std::set_intersection(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +template +std::set D(const std::set& a, const std::set& b) { + std::set result; + std::set_difference(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +/* 4 CONVERSIONS */ +template +auto toset(const U& v) -> std::set { + return std::set(v.begin(), v.end()); +} + + +/* 5 PRINTS */ +// Type trait to check if a type is a container (has begin() and end()) +template struct is_container : std::false_type {}; +template +struct is_container< + T, typename std::enable_if< + !std::is_same::value && // Exclude std::string + !std::is_same::value && // Exclude C-style strings + std::is_same())), + decltype(std::end(std::declval()))>::value>::type> + : std::true_type {}; +// Base case: types that are not containers or strings +template +typename std::enable_if::value && + !std::is_same::value>::type +print(const T& x) {std::cout << x;} +// Overload for strings and C-style strings +void print(const std::string& s) { std::cout << s; } +void print(const char* s) { std::cout << s; } +// Overload for pairs +template void print(const std::pair& p) { std::cout << "(";print(p.first); std::cout << ", "; print(p.second);std::cout << ")";} +// Overload for containers +template +typename std::enable_if::value>::type print(const T& container) { std::cout << "[";bool first = true;for (const auto& element : container) {if (!first) std::cout << ", "; print(element); first = false; } std::cout << "]"; } +template +void print(const T& first, const Args&... args) { print(first); print(args...); } +/* 6. UTILS */ +#define MOD 1000000007 +#define PI 3.1415926535897932384626433832795 +#define NL "\n" +ll min(ll a,int b) { if (ab) return a; return b; } +ll max(int a,ll b) { if (a>b) return a; return b; } +ll gcd(ll a,ll b) { if (b==0) return a; return gcd(b, a%b); } +ll lcm(ll a,ll b) { return a/gcd(a,b)*b; } +string to_upper(string a) { for (int i=0;i<(int)a.size();++i) if (a[i]>='a' && a[i]<='z') a[i]-='a'-'A'; return a; } +string to_lower(string a) { for (int i=0;i<(int)a.size();++i) if (a[i]>='A' && a[i]<='Z') a[i]+='a'-'A'; return a; } +bool prime(ll a) { if (a==1) return 0; for (int i=2;i<=round(sqrt(a));++i) if (a%i==0) return 0; return 1; } +void yes() { cout<<"YES\n"; } +void no() { cout<<"NO\n"; } + +/* 7. All Required define Pre-Processors and typedef Constants */ +typedef long int int32; +typedef unsigned long int uint32; +typedef long long int int64; +typedef unsigned long long int uint64; +typedef string str; + +/* clang-format on */ +#define ONLINE_JUDGE 1 + +int main(int argc, char* argv[]) { + ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); +#ifndef ONLINE_JUDGE + freopen("input.txt", "r", stdin); // input.txt + freopen("output.txt", "w", stdout); // output.txt +#endif + ll n, m; + read(n, m); + print(n - m, NL); + return 0; +} \ No newline at end of file diff --git a/solutions/echoechoecho.cpp b/solutions/echoechoecho.cpp new file mode 100644 index 0000000..62bb148 --- /dev/null +++ b/solutions/echoechoecho.cpp @@ -0,0 +1,147 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +/* clang-format off */ + +/* 1. TYPES */ +#define ll long long +#define pii pair +#define pll pair +#define vi vector +#define vc vector +#define vs vector +#define vll vector +#define mii map +#define si set +#define sc set + +/* 2. FUNCTIONS */ +void read() {} +template +void read(T& first, Args&... args) { std::cin >> first; read(args...); } +#define f(i,s,e) for(long long int i=s;i +std::set U(const std::set& a, const std::set& b) { + std::set result; + std::set_union(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +template +std::set I(const std::set& a, const std::set& b) { + std::set result; + std::set_intersection(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +template +std::set D(const std::set& a, const std::set& b) { + std::set result; + std::set_difference(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +/* 4 CONVERSIONS */ +template +auto toset(const U& v) -> std::set { + return std::set(v.begin(), v.end()); +} + + +/* 5 PRINTS */ +// Type trait to check if a type is a container (has begin() and end()) +template struct is_container : std::false_type {}; +template +struct is_container< + T, typename std::enable_if< + !std::is_same::value && // Exclude std::string + !std::is_same::value && // Exclude C-style strings + std::is_same())), + decltype(std::end(std::declval()))>::value>::type> + : std::true_type {}; +// Base case: types that are not containers or strings +template +typename std::enable_if::value && + !std::is_same::value>::type +print(const T& x) {std::cout << x;} +// Overload for strings and C-style strings +void print(const std::string& s) { std::cout << s; } +void print(const char* s) { std::cout << s; } +// Overload for pairs +template void print(const std::pair& p) { std::cout << "(";print(p.first); std::cout << ", "; print(p.second);std::cout << ")";} +// Overload for containers +template +typename std::enable_if::value>::type print(const T& container) { std::cout << "[";bool first = true;for (const auto& element : container) {if (!first) std::cout << ", "; print(element); first = false; } std::cout << "]"; } +template +void print(const T& first, const Args&... args) { print(first); print(args...); } +/* 6. UTILS */ +#define MOD 1000000007 +#define PI 3.1415926535897932384626433832795 +#define NL "\n" +ll min(ll a,int b) { if (ab) return a; return b; } +ll max(int a,ll b) { if (a>b) return a; return b; } +ll gcd(ll a,ll b) { if (b==0) return a; return gcd(b, a%b); } +ll lcm(ll a,ll b) { return a/gcd(a,b)*b; } +string to_upper(string a) { for (int i=0;i<(int)a.size();++i) if (a[i]>='a' && a[i]<='z') a[i]-='a'-'A'; return a; } +string to_lower(string a) { for (int i=0;i<(int)a.size();++i) if (a[i]>='A' && a[i]<='Z') a[i]+='a'-'A'; return a; } +bool prime(ll a) { if (a==1) return 0; for (int i=2;i<=round(sqrt(a));++i) if (a%i==0) return 0; return 1; } +void yes() { cout<<"YES\n"; } +void no() { cout<<"NO\n"; } + +/* 7. All Required define Pre-Processors and typedef Constants */ +typedef long int int32; +typedef unsigned long int uint32; +typedef long long int int64; +typedef unsigned long long int uint64; +typedef string str; + +/* clang-format on */ +#define ONLINE_JUDGE 1 + +int main(int argc, char* argv[]) { + ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); +#ifndef ONLINE_JUDGE + freopen("input.txt", "r", stdin); // input.txt + freopen("output.txt", "w", stdout); // output.txt +#endif + str w; + read(w); + f(i, 0, 3) { print(w, " "); } + return 0; +} \ No newline at end of file diff --git a/solutions/findingana.cpp b/solutions/findingana.cpp new file mode 100644 index 0000000..c49defa --- /dev/null +++ b/solutions/findingana.cpp @@ -0,0 +1,148 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +/* clang-format off */ + +/* 1. TYPES */ +#define ll long long +#define pii pair +#define pll pair +#define vi vector +#define vc vector +#define vs vector +#define vll vector +#define mii map +#define si set +#define sc set + +/* 2. FUNCTIONS */ +void read() {} +template +void read(T& first, Args&... args) { std::cin >> first; read(args...); } +#define f(i,s,e) for(long long int i=s;i +std::set U(const std::set& a, const std::set& b) { + std::set result; + std::set_union(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +template +std::set I(const std::set& a, const std::set& b) { + std::set result; + std::set_intersection(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +template +std::set D(const std::set& a, const std::set& b) { + std::set result; + std::set_difference(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +/* 4 CONVERSIONS */ +template +auto toset(const U& v) -> std::set { + return std::set(v.begin(), v.end()); +} + + +/* 5 PRINTS */ +// Type trait to check if a type is a container (has begin() and end()) +template struct is_container : std::false_type {}; +template +struct is_container< + T, typename std::enable_if< + !std::is_same::value && // Exclude std::string + !std::is_same::value && // Exclude C-style strings + std::is_same())), + decltype(std::end(std::declval()))>::value>::type> + : std::true_type {}; +// Base case: types that are not containers or strings +template +typename std::enable_if::value && + !std::is_same::value>::type +print(const T& x) {std::cout << x;} +// Overload for strings and C-style strings +void print(const std::string& s) { std::cout << s; } +void print(const char* s) { std::cout << s; } +// Overload for pairs +template void print(const std::pair& p) { std::cout << "(";print(p.first); std::cout << ", "; print(p.second);std::cout << ")";} +// Overload for containers +template +typename std::enable_if::value>::type print(const T& container) { std::cout << "[";bool first = true;for (const auto& element : container) {if (!first) std::cout << ", "; print(element); first = false; } std::cout << "]"; } +template +void print(const T& first, const Args&... args) { print(first); print(args...); } +/* 6. UTILS */ +#define MOD 1000000007 +#define PI 3.1415926535897932384626433832795 +#define NL "\n" +ll min(ll a,int b) { if (ab) return a; return b; } +ll max(int a,ll b) { if (a>b) return a; return b; } +ll gcd(ll a,ll b) { if (b==0) return a; return gcd(b, a%b); } +ll lcm(ll a,ll b) { return a/gcd(a,b)*b; } +string to_upper(string a) { for (int i=0;i<(int)a.size();++i) if (a[i]>='a' && a[i]<='z') a[i]-='a'-'A'; return a; } +string to_lower(string a) { for (int i=0;i<(int)a.size();++i) if (a[i]>='A' && a[i]<='Z') a[i]+='a'-'A'; return a; } +bool prime(ll a) { if (a==1) return 0; for (int i=2;i<=round(sqrt(a));++i) if (a%i==0) return 0; return 1; } +void yes() { cout<<"YES\n"; } +void no() { cout<<"NO\n"; } + +/* 7. All Required define Pre-Processors and typedef Constants */ +typedef long int int32; +typedef unsigned long int uint32; +typedef long long int int64; +typedef unsigned long long int uint64; +typedef string str; + +/* clang-format on */ +#define ONLINE_JUDGE 1 + +int main(int argc, char* argv[]) { + ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); +#ifndef ONLINE_JUDGE + freopen("input.txt", "r", stdin); // input.txt + freopen("output.txt", "w", stdout); // output.txt +#endif + str a; + read(a); + ll pos = a.find('a', 0); + print(a.substr(pos, a.length() - pos), NL); + return 0; +} \ No newline at end of file diff --git a/solutions/flatbokuveisla.cpp b/solutions/flatbokuveisla.cpp new file mode 100644 index 0000000..515d9f8 --- /dev/null +++ b/solutions/flatbokuveisla.cpp @@ -0,0 +1,146 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +/* clang-format off */ + +/* 1. TYPES */ +#define ll long long +#define pii pair +#define pll pair +#define vi vector +#define vc vector +#define vll vector +#define mii map +#define si set +#define sc set + +/* 2. FUNCTIONS */ +void read() {} +template +void read(T& first, Args&... args) { std::cin >> first; read(args...); } +#define f(i,s,e) for(long long int i=s;i +std::set U(const std::set& a, const std::set& b) { + std::set result; + std::set_union(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +template +std::set I(const std::set& a, const std::set& b) { + std::set result; + std::set_intersection(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +template +std::set D(const std::set& a, const std::set& b) { + std::set result; + std::set_difference(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +/* 4 CONVERSIONS */ +template +auto toset(const U& v) -> std::set { + return std::set(v.begin(), v.end()); +} + + +/* 5 PRINTS */ +// Type trait to check if a type is a container (has begin() and end()) +template struct is_container : std::false_type {}; +template +struct is_container< + T, typename std::enable_if< + !std::is_same::value && // Exclude std::string + !std::is_same::value && // Exclude C-style strings + std::is_same())), + decltype(std::end(std::declval()))>::value>::type> + : std::true_type {}; +// Base case: types that are not containers or strings +template +typename std::enable_if::value && + !std::is_same::value>::type +print(const T& x) {std::cout << x;} +// Overload for strings and C-style strings +void print(const std::string& s) { std::cout << s; } +void print(const char* s) { std::cout << s; } +// Overload for pairs +template void print(const std::pair& p) { std::cout << "(";print(p.first); std::cout << ", "; print(p.second);std::cout << ")";} +// Overload for containers +template +typename std::enable_if::value>::type print(const T& container) { std::cout << "[";bool first = true;for (const auto& element : container) {if (!first) std::cout << ", "; print(element); first = false; } std::cout << "]"; } +template +void print(const T& first, const Args&... args) { print(first); print(args...); } +/* 6. UTILS */ +#define MOD 1000000007 +#define PI 3.1415926535897932384626433832795 +#define NL "\n" +ll min(ll a,int b) { if (ab) return a; return b; } +ll max(int a,ll b) { if (a>b) return a; return b; } +ll gcd(ll a,ll b) { if (b==0) return a; return gcd(b, a%b); } +ll lcm(ll a,ll b) { return a/gcd(a,b)*b; } +string to_upper(string a) { for (int i=0;i<(int)a.size();++i) if (a[i]>='a' && a[i]<='z') a[i]-='a'-'A'; return a; } +string to_lower(string a) { for (int i=0;i<(int)a.size();++i) if (a[i]>='A' && a[i]<='Z') a[i]+='a'-'A'; return a; } +bool prime(ll a) { if (a==1) return 0; for (int i=2;i<=round(sqrt(a));++i) if (a%i==0) return 0; return 1; } +void yes() { cout<<"YES\n"; } +void no() { cout<<"NO\n"; } + +/* 7. All Required define Pre-Processors and typedef Constants */ +typedef long int int32; +typedef unsigned long int uint32; +typedef long long int int64; +typedef unsigned long long int uint64; +typedef string str; + +/* clang-format on */ +#define ONLINE_JUDGE 1 + +int main(int argc, char* argv[]) { + ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); +#ifndef ONLINE_JUDGE + freopen("input.txt", "r", stdin); // input.txt + freopen("output.txt", "w", stdout); // output.txt +#endif + ll slices, residents; + read(slices, residents); + + print(slices % residents, NL); + return 0; +} \ No newline at end of file diff --git a/solutions/hipphipphurra.cpp b/solutions/hipphipphurra.cpp new file mode 100644 index 0000000..4b4a6c5 --- /dev/null +++ b/solutions/hipphipphurra.cpp @@ -0,0 +1,149 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +/* clang-format off */ + +/* 1. TYPES */ +#define ll long long +#define pii pair +#define pll pair +#define vi vector +#define vc vector +#define vll vector +#define mii map +#define si set +#define sc set + +/* 2. FUNCTIONS */ +void read() {} +template +void read(T& first, Args&... args) { std::cin >> first; read(args...); } +#define f(i,s,e) for(long long int i=s;i +std::set U(const std::set& a, const std::set& b) { + std::set result; + std::set_union(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +template +std::set I(const std::set& a, const std::set& b) { + std::set result; + std::set_intersection(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +template +std::set D(const std::set& a, const std::set& b) { + std::set result; + std::set_difference(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +/* 4 CONVERSIONS */ +template +auto toset(const U& v) -> std::set { + return std::set(v.begin(), v.end()); +} + + +/* 5 PRINTS */ +// Type trait to check if a type is a container (has begin() and end()) +template struct is_container : std::false_type {}; +template +struct is_container< + T, typename std::enable_if< + !std::is_same::value && // Exclude std::string + !std::is_same::value && // Exclude C-style strings + std::is_same())), + decltype(std::end(std::declval()))>::value>::type> + : std::true_type {}; +// Base case: types that are not containers or strings +template +typename std::enable_if::value && + !std::is_same::value>::type +print(const T& x) {std::cout << x;} +// Overload for strings and C-style strings +void print(const std::string& s) { std::cout << s; } +void print(const char* s) { std::cout << s; } +// Overload for pairs +template void print(const std::pair& p) { std::cout << "(";print(p.first); std::cout << ", "; print(p.second);std::cout << ")";} +// Overload for containers +template +typename std::enable_if::value>::type print(const T& container) { std::cout << "[";bool first = true;for (const auto& element : container) {if (!first) std::cout << ", "; print(element); first = false; } std::cout << "]"; } +template +void print(const T& first, const Args&... args) { print(first); print(args...); } +/* 6. UTILS */ +#define MOD 1000000007 +#define PI 3.1415926535897932384626433832795 +#define NL "\n" +ll min(ll a,int b) { if (ab) return a; return b; } +ll max(int a,ll b) { if (a>b) return a; return b; } +ll gcd(ll a,ll b) { if (b==0) return a; return gcd(b, a%b); } +ll lcm(ll a,ll b) { return a/gcd(a,b)*b; } +string to_upper(string a) { for (int i=0;i<(int)a.size();++i) if (a[i]>='a' && a[i]<='z') a[i]-='a'-'A'; return a; } +string to_lower(string a) { for (int i=0;i<(int)a.size();++i) if (a[i]>='A' && a[i]<='Z') a[i]+='a'-'A'; return a; } +bool prime(ll a) { if (a==1) return 0; for (int i=2;i<=round(sqrt(a));++i) if (a%i==0) return 0; return 1; } +void yes() { cout<<"YES\n"; } +void no() { cout<<"NO\n"; } + +/* 7. All Required define Pre-Processors and typedef Constants */ +typedef long int int32; +typedef unsigned long int uint32; +typedef long long int int64; +typedef unsigned long long int uint64; +typedef string str; + +/* clang-format on */ +#define ONLINE_JUDGE 1 + +int main(int argc, char* argv[]) { + ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); +#ifndef ONLINE_JUDGE + freopen("input.txt", "r", stdin); // input.txt + freopen("output.txt", "w", stdout); // output.txt +#endif + str w; + ll lines; + read(w, lines); + + f(i, 0, lines) { print("Hipp hipp hurra, ", w, "!", NL); } + + return 0; +} \ No newline at end of file diff --git a/solutions/hradgreining.cpp b/solutions/hradgreining.cpp new file mode 100644 index 0000000..535bfc2 --- /dev/null +++ b/solutions/hradgreining.cpp @@ -0,0 +1,156 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +/* clang-format off */ + +/* 1. TYPES */ +#define ll long long +#define pii pair +#define pll pair +#define vi vector +#define vc vector +#define vll vector +#define mii map +#define si set +#define sc set + +/* 2. FUNCTIONS */ +void read() {} +template +void read(T& first, Args&... args) { std::cin >> first; read(args...); } +#define f(i,s,e) for(long long int i=s;i +std::set U(const std::set& a, const std::set& b) { + std::set result; + std::set_union(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +template +std::set I(const std::set& a, const std::set& b) { + std::set result; + std::set_intersection(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +template +std::set D(const std::set& a, const std::set& b) { + std::set result; + std::set_difference(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +/* 4 CONVERSIONS */ +template +auto toset(const U& v) -> std::set { + return std::set(v.begin(), v.end()); +} + + +/* 5 PRINTS */ +// Type trait to check if a type is a container (has begin() and end()) +template struct is_container : std::false_type {}; +template +struct is_container< + T, typename std::enable_if< + !std::is_same::value && // Exclude std::string + !std::is_same::value && // Exclude C-style strings + std::is_same())), + decltype(std::end(std::declval()))>::value>::type> + : std::true_type {}; +// Base case: types that are not containers or strings +template +typename std::enable_if::value && + !std::is_same::value>::type +print(const T& x) {std::cout << x;} +// Overload for strings and C-style strings +void print(const std::string& s) { std::cout << s; } +void print(const char* s) { std::cout << s; } +// Overload for pairs +template void print(const std::pair& p) { std::cout << "(";print(p.first); std::cout << ", "; print(p.second);std::cout << ")";} +// Overload for containers +template +typename std::enable_if::value>::type print(const T& container) { std::cout << "[";bool first = true;for (const auto& element : container) {if (!first) std::cout << ", "; print(element); first = false; } std::cout << "]"; } +template +void print(const T& first, const Args&... args) { print(first); print(args...); } +/* 6. UTILS */ +#define MOD 1000000007 +#define PI 3.1415926535897932384626433832795 +#define NL "\n" +ll min(ll a,int b) { if (ab) return a; return b; } +ll max(int a,ll b) { if (a>b) return a; return b; } +ll gcd(ll a,ll b) { if (b==0) return a; return gcd(b, a%b); } +ll lcm(ll a,ll b) { return a/gcd(a,b)*b; } +string to_upper(string a) { for (int i=0;i<(int)a.size();++i) if (a[i]>='a' && a[i]<='z') a[i]-='a'-'A'; return a; } +string to_lower(string a) { for (int i=0;i<(int)a.size();++i) if (a[i]>='A' && a[i]<='Z') a[i]+='a'-'A'; return a; } +bool prime(ll a) { if (a==1) return 0; for (int i=2;i<=round(sqrt(a));++i) if (a%i==0) return 0; return 1; } +void yes() { cout<<"YES\n"; } +void no() { cout<<"NO\n"; } + +/* 7. All Required define Pre-Processors and typedef Constants */ +typedef long int int32; +typedef unsigned long int uint32; +typedef long long int int64; +typedef unsigned long long int uint64; +typedef string str; + +/* clang-format on */ +#define ONLINE_JUDGE 1 + +int main(int argc, char* argv[]) { + ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); +#ifndef ONLINE_JUDGE + freopen("input.txt", "r", stdin); // input.txt + freopen("output.txt", "w", stdout); // output.txt +#endif + str word; + read(word); +#define DNA_STRING "COV" + int ok = 0; + + // Subtract last two letters, as they was checked in prev iteration, and + // cannot do substring with 3 in the end. + for (int i = 0; i < word.length() - 2; i++) { + ok |= word.substr(i, 3) == DNA_STRING; + } + + IF(ok, print("Veikur!"), print("Ekki veikur!")); + + return 0; +} \ No newline at end of file diff --git a/solutions/jackolanternjuxtaposition.cpp b/solutions/jackolanternjuxtaposition.cpp new file mode 100644 index 0000000..e54a692 --- /dev/null +++ b/solutions/jackolanternjuxtaposition.cpp @@ -0,0 +1,149 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +/* clang-format off */ + +/* 1. TYPES */ +#define ll long long +#define pii pair +#define pll pair +#define vi vector +#define vc vector +#define vs vector +#define vll vector +#define mii map +#define si set +#define sc set + +/* 2. FUNCTIONS */ +void read() {} +template +void read(T& first, Args&... args) { std::cin >> first; read(args...); } +#define f(i,s,e) for(long long int i=s;i +std::set U(const std::set& a, const std::set& b) { + std::set result; + std::set_union(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +template +std::set I(const std::set& a, const std::set& b) { + std::set result; + std::set_intersection(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +template +std::set D(const std::set& a, const std::set& b) { + std::set result; + std::set_difference(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +/* 4 CONVERSIONS */ +template +auto toset(const U& v) -> std::set { + return std::set(v.begin(), v.end()); +} + + +/* 5 PRINTS */ +// Type trait to check if a type is a container (has begin() and end()) +template struct is_container : std::false_type {}; +template +struct is_container< + T, typename std::enable_if< + !std::is_same::value && // Exclude std::string + !std::is_same::value && // Exclude C-style strings + std::is_same())), + decltype(std::end(std::declval()))>::value>::type> + : std::true_type {}; +// Base case: types that are not containers or strings +template +typename std::enable_if::value && + !std::is_same::value>::type +print(const T& x) {std::cout << x;} +// Overload for strings and C-style strings +void print(const std::string& s) { std::cout << s; } +void print(const char* s) { std::cout << s; } +// Overload for pairs +template void print(const std::pair& p) { std::cout << "(";print(p.first); std::cout << ", "; print(p.second);std::cout << ")";} +// Overload for containers +template +typename std::enable_if::value>::type print(const T& container) { std::cout << "[";bool first = true;for (const auto& element : container) {if (!first) std::cout << ", "; print(element); first = false; } std::cout << "]"; } +template +void print(const T& first, const Args&... args) { print(first); print(args...); } +/* 6. UTILS */ +#define MOD 1000000007 +#define PI 3.1415926535897932384626433832795 +#define NL "\n" +ll min(ll a,int b) { if (ab) return a; return b; } +ll max(int a,ll b) { if (a>b) return a; return b; } +ll gcd(ll a,ll b) { if (b==0) return a; return gcd(b, a%b); } +ll lcm(ll a,ll b) { return a/gcd(a,b)*b; } +string to_upper(string a) { for (int i=0;i<(int)a.size();++i) if (a[i]>='a' && a[i]<='z') a[i]-='a'-'A'; return a; } +string to_lower(string a) { for (int i=0;i<(int)a.size();++i) if (a[i]>='A' && a[i]<='Z') a[i]+='a'-'A'; return a; } +bool prime(ll a) { if (a==1) return 0; for (int i=2;i<=round(sqrt(a));++i) if (a%i==0) return 0; return 1; } +void yes() { cout<<"YES\n"; } +void no() { cout<<"NO\n"; } + +/* 7. All Required define Pre-Processors and typedef Constants */ +typedef long int int32; +typedef unsigned long int uint32; +typedef long long int int64; +typedef unsigned long long int uint64; +typedef string str; + +/* clang-format on */ +#define ONLINE_JUDGE 1 + +int main(int argc, char* argv[]) { + ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); +#ifndef ONLINE_JUDGE + freopen("input.txt", "r", stdin); // input.txt + freopen("output.txt", "w", stdout); // output.txt +#endif + ll a, b, c; + read(a, b, c); + a *= b; + a *= c; + print(a); + return 0; +} \ No newline at end of file diff --git a/solutions/kikiboba.cpp b/solutions/kikiboba.cpp new file mode 100644 index 0000000..c259244 --- /dev/null +++ b/solutions/kikiboba.cpp @@ -0,0 +1,165 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +/* clang-format off */ + +/* 1. TYPES */ +#define ll long long +#define pii pair +#define pll pair +#define vi vector +#define vc vector +#define vs vector +#define vll vector +#define mii map +#define si set +#define sc set + +/* 2. FUNCTIONS */ +void read() {} +template +void read(T& first, Args&... args) { std::cin >> first; read(args...); } +#define f(i,s,e) for(long long int i=s;i +std::set U(const std::set& a, const std::set& b) { + std::set result; + std::set_union(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +template +std::set I(const std::set& a, const std::set& b) { + std::set result; + std::set_intersection(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +template +std::set D(const std::set& a, const std::set& b) { + std::set result; + std::set_difference(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +/* 4 CONVERSIONS */ +template +auto toset(const U& v) -> std::set { + return std::set(v.begin(), v.end()); +} + + +/* 5 PRINTS */ +// Type trait to check if a type is a container (has begin() and end()) +template struct is_container : std::false_type {}; +template +struct is_container< + T, typename std::enable_if< + !std::is_same::value && // Exclude std::string + !std::is_same::value && // Exclude C-style strings + std::is_same())), + decltype(std::end(std::declval()))>::value>::type> + : std::true_type {}; +// Base case: types that are not containers or strings +template +typename std::enable_if::value && + !std::is_same::value>::type +print(const T& x) {std::cout << x;} +// Overload for strings and C-style strings +void print(const std::string& s) { std::cout << s; } +void print(const char* s) { std::cout << s; } +// Overload for pairs +template void print(const std::pair& p) { std::cout << "(";print(p.first); std::cout << ", "; print(p.second);std::cout << ")";} +// Overload for containers +template +typename std::enable_if::value>::type print(const T& container) { std::cout << "[";bool first = true;for (const auto& element : container) {if (!first) std::cout << ", "; print(element); first = false; } std::cout << "]"; } +template +void print(const T& first, const Args&... args) { print(first); print(args...); } +/* 6. UTILS */ +#define MOD 1000000007 +#define PI 3.1415926535897932384626433832795 +#define NL "\n" +ll min(ll a,int b) { if (ab) return a; return b; } +ll max(int a,ll b) { if (a>b) return a; return b; } +ll gcd(ll a,ll b) { if (b==0) return a; return gcd(b, a%b); } +ll lcm(ll a,ll b) { return a/gcd(a,b)*b; } +string to_upper(string a) { for (int i=0;i<(int)a.size();++i) if (a[i]>='a' && a[i]<='z') a[i]-='a'-'A'; return a; } +string to_lower(string a) { for (int i=0;i<(int)a.size();++i) if (a[i]>='A' && a[i]<='Z') a[i]+='a'-'A'; return a; } +bool prime(ll a) { if (a==1) return 0; for (int i=2;i<=round(sqrt(a));++i) if (a%i==0) return 0; return 1; } +void yes() { cout<<"YES\n"; } +void no() { cout<<"NO\n"; } + +/* 7. All Required define Pre-Processors and typedef Constants */ +typedef long int int32; +typedef unsigned long int uint32; +typedef long long int int64; +typedef unsigned long long int uint64; +typedef string str; + +/* clang-format on */ +#define ONLINE_JUDGE 1 + +int main(int argc, char* argv[]) { + ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); +#ifndef ONLINE_JUDGE + freopen("input.txt", "r", stdin); // input.txt + freopen("output.txt", "w", stdout); // output.txt +#endif + str a; + read(a); + ll b_cnt = 0, k_cnt = 0; + EACH(c, a) { + if (c == 'b') + b_cnt++; + else if (c == 'k') + k_cnt++; + } + if (b_cnt == 0 && k_cnt == 0) { + print("none"); + return 0; + } + if (b_cnt > k_cnt) { + print("boba"); + } else if (b_cnt < k_cnt) { + print("kiki"); + } else { + print("boki"); + } + + return 0; +} \ No newline at end of file diff --git a/solutions/kvedja.cpp b/solutions/kvedja.cpp new file mode 100644 index 0000000..c52f59e --- /dev/null +++ b/solutions/kvedja.cpp @@ -0,0 +1,145 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +/* clang-format off */ + +/* 1. TYPES */ +#define ll long long +#define pii pair +#define pll pair +#define vi vector +#define vc vector +#define vll vector +#define mii map +#define si set +#define sc set + +/* 2. FUNCTIONS */ +void read() {} +template +void read(T& first, Args&... args) { std::cin >> first; read(args...); } +#define f(i,s,e) for(long long int i=s;i +std::set U(const std::set& a, const std::set& b) { + std::set result; + std::set_union(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +template +std::set I(const std::set& a, const std::set& b) { + std::set result; + std::set_intersection(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +template +std::set D(const std::set& a, const std::set& b) { + std::set result; + std::set_difference(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +/* 4 CONVERSIONS */ +template +auto toset(const U& v) -> std::set { + return std::set(v.begin(), v.end()); +} + + +/* 5 PRINTS */ +// Type trait to check if a type is a container (has begin() and end()) +template struct is_container : std::false_type {}; +template +struct is_container< + T, typename std::enable_if< + !std::is_same::value && // Exclude std::string + !std::is_same::value && // Exclude C-style strings + std::is_same())), + decltype(std::end(std::declval()))>::value>::type> + : std::true_type {}; +// Base case: types that are not containers or strings +template +typename std::enable_if::value && + !std::is_same::value>::type +print(const T& x) {std::cout << x;} +// Overload for strings and C-style strings +void print(const std::string& s) { std::cout << s; } +void print(const char* s) { std::cout << s; } +// Overload for pairs +template void print(const std::pair& p) { std::cout << "(";print(p.first); std::cout << ", "; print(p.second);std::cout << ")";} +// Overload for containers +template +typename std::enable_if::value>::type print(const T& container) { std::cout << "[";bool first = true;for (const auto& element : container) {if (!first) std::cout << ", "; print(element); first = false; } std::cout << "]"; } +template +void print(const T& first, const Args&... args) { print(first); print(args...); } +/* 6. UTILS */ +#define MOD 1000000007 +#define PI 3.1415926535897932384626433832795 +#define NL "\n" +ll min(ll a,int b) { if (ab) return a; return b; } +ll max(int a,ll b) { if (a>b) return a; return b; } +ll gcd(ll a,ll b) { if (b==0) return a; return gcd(b, a%b); } +ll lcm(ll a,ll b) { return a/gcd(a,b)*b; } +string to_upper(string a) { for (int i=0;i<(int)a.size();++i) if (a[i]>='a' && a[i]<='z') a[i]-='a'-'A'; return a; } +string to_lower(string a) { for (int i=0;i<(int)a.size();++i) if (a[i]>='A' && a[i]<='Z') a[i]+='a'-'A'; return a; } +bool prime(ll a) { if (a==1) return 0; for (int i=2;i<=round(sqrt(a));++i) if (a%i==0) return 0; return 1; } +void yes() { cout<<"YES\n"; } +void no() { cout<<"NO\n"; } + +/* 7. All Required define Pre-Processors and typedef Constants */ +typedef long int int32; +typedef unsigned long int uint32; +typedef long long int int64; +typedef unsigned long long int uint64; +typedef string str; + +/* clang-format on */ +#define ONLINE_JUDGE 1 + +int main(int argc, char* argv[]) { + ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); +#ifndef ONLINE_JUDGE + freopen("input.txt", "r", stdin); // input.txt + freopen("output.txt", "w", stdout); // output.txt +#endif + str a; + read(a); + print("Kvedja,", NL, a, NL); + return 0; +} \ No newline at end of file diff --git a/solutions/leynithjonusta.cpp b/solutions/leynithjonusta.cpp new file mode 100644 index 0000000..170881f --- /dev/null +++ b/solutions/leynithjonusta.cpp @@ -0,0 +1,147 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +/* clang-format off */ + +/* 1. TYPES */ +#define ll long long +#define pii pair +#define pll pair +#define vi vector +#define vc vector +#define vs vector +#define vll vector +#define mii map +#define si set +#define sc set + +/* 2. FUNCTIONS */ +void read() {} +template +void read(T& first, Args&... args) { std::cin >> first; read(args...); } +#define f(i,s,e) for(long long int i=s;i +std::set U(const std::set& a, const std::set& b) { + std::set result; + std::set_union(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +template +std::set I(const std::set& a, const std::set& b) { + std::set result; + std::set_intersection(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +template +std::set D(const std::set& a, const std::set& b) { + std::set result; + std::set_difference(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +/* 4 CONVERSIONS */ +template +auto toset(const U& v) -> std::set { + return std::set(v.begin(), v.end()); +} + + +/* 5 PRINTS */ +// Type trait to check if a type is a container (has begin() and end()) +template struct is_container : std::false_type {}; +template +struct is_container< + T, typename std::enable_if< + !std::is_same::value && // Exclude std::string + !std::is_same::value && // Exclude C-style strings + std::is_same())), + decltype(std::end(std::declval()))>::value>::type> + : std::true_type {}; +// Base case: types that are not containers or strings +template +typename std::enable_if::value && + !std::is_same::value>::type +print(const T& x) {std::cout << x;} +// Overload for strings and C-style strings +void print(const std::string& s) { std::cout << s; } +void print(const char* s) { std::cout << s; } +// Overload for pairs +template void print(const std::pair& p) { std::cout << "(";print(p.first); std::cout << ", "; print(p.second);std::cout << ")";} +// Overload for containers +template +typename std::enable_if::value>::type print(const T& container) { std::cout << "[";bool first = true;for (const auto& element : container) {if (!first) std::cout << ", "; print(element); first = false; } std::cout << "]"; } +template +void print(const T& first, const Args&... args) { print(first); print(args...); } +/* 6. UTILS */ +#define MOD 1000000007 +#define PI 3.1415926535897932384626433832795 +#define NL "\n" +ll min(ll a,int b) { if (ab) return a; return b; } +ll max(int a,ll b) { if (a>b) return a; return b; } +ll gcd(ll a,ll b) { if (b==0) return a; return gcd(b, a%b); } +ll lcm(ll a,ll b) { return a/gcd(a,b)*b; } +string to_upper(string a) { for (int i=0;i<(int)a.size();++i) if (a[i]>='a' && a[i]<='z') a[i]-='a'-'A'; return a; } +string to_lower(string a) { for (int i=0;i<(int)a.size();++i) if (a[i]>='A' && a[i]<='Z') a[i]+='a'-'A'; return a; } +bool prime(ll a) { if (a==1) return 0; for (int i=2;i<=round(sqrt(a));++i) if (a%i==0) return 0; return 1; } +void yes() { cout<<"YES\n"; } +void no() { cout<<"NO\n"; } + +/* 7. All Required define Pre-Processors and typedef Constants */ +typedef long int int32; +typedef unsigned long int uint32; +typedef long long int int64; +typedef unsigned long long int uint64; +typedef string str; + +/* clang-format on */ +#define ONLINE_JUDGE 1 + +int main(int argc, char* argv[]) { + ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); +#ifndef ONLINE_JUDGE + freopen("input.txt", "r", stdin); // input.txt + freopen("output.txt", "w", stdout); // output.txt +#endif + str m; + read(m); + EACH(c, m) { IF(c == ' ', continue, print(c)); } + return 0; +} \ No newline at end of file diff --git a/solutions/lubbilaerir.cpp b/solutions/lubbilaerir.cpp new file mode 100644 index 0000000..622a210 --- /dev/null +++ b/solutions/lubbilaerir.cpp @@ -0,0 +1,145 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +/* clang-format off */ + +/* 1. TYPES */ +#define ll long long +#define pii pair +#define pll pair +#define vi vector +#define vc vector +#define vll vector +#define mii map +#define si set +#define sc set + +/* 2. FUNCTIONS */ +void read() {} +template +void read(T& first, Args&... args) { std::cin >> first; read(args...); } +#define f(i,s,e) for(long long int i=s;i +std::set U(const std::set& a, const std::set& b) { + std::set result; + std::set_union(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +template +std::set I(const std::set& a, const std::set& b) { + std::set result; + std::set_intersection(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +template +std::set D(const std::set& a, const std::set& b) { + std::set result; + std::set_difference(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +/* 4 CONVERSIONS */ +template +auto toset(const U& v) -> std::set { + return std::set(v.begin(), v.end()); +} + + +/* 5 PRINTS */ +// Type trait to check if a type is a container (has begin() and end()) +template struct is_container : std::false_type {}; +template +struct is_container< + T, typename std::enable_if< + !std::is_same::value && // Exclude std::string + !std::is_same::value && // Exclude C-style strings + std::is_same())), + decltype(std::end(std::declval()))>::value>::type> + : std::true_type {}; +// Base case: types that are not containers or strings +template +typename std::enable_if::value && + !std::is_same::value>::type +print(const T& x) {std::cout << x;} +// Overload for strings and C-style strings +void print(const std::string& s) { std::cout << s; } +void print(const char* s) { std::cout << s; } +// Overload for pairs +template void print(const std::pair& p) { std::cout << "(";print(p.first); std::cout << ", "; print(p.second);std::cout << ")";} +// Overload for containers +template +typename std::enable_if::value>::type print(const T& container) { std::cout << "[";bool first = true;for (const auto& element : container) {if (!first) std::cout << ", "; print(element); first = false; } std::cout << "]"; } +template +void print(const T& first, const Args&... args) { print(first); print(args...); } +/* 6. UTILS */ +#define MOD 1000000007 +#define PI 3.1415926535897932384626433832795 +#define NL "\n" +ll min(ll a,int b) { if (ab) return a; return b; } +ll max(int a,ll b) { if (a>b) return a; return b; } +ll gcd(ll a,ll b) { if (b==0) return a; return gcd(b, a%b); } +ll lcm(ll a,ll b) { return a/gcd(a,b)*b; } +string to_upper(string a) { for (int i=0;i<(int)a.size();++i) if (a[i]>='a' && a[i]<='z') a[i]-='a'-'A'; return a; } +string to_lower(string a) { for (int i=0;i<(int)a.size();++i) if (a[i]>='A' && a[i]<='Z') a[i]+='a'-'A'; return a; } +bool prime(ll a) { if (a==1) return 0; for (int i=2;i<=round(sqrt(a));++i) if (a%i==0) return 0; return 1; } +void yes() { cout<<"YES\n"; } +void no() { cout<<"NO\n"; } + +/* 7. All Required define Pre-Processors and typedef Constants */ +typedef long int int32; +typedef unsigned long int uint32; +typedef long long int int64; +typedef unsigned long long int uint64; +typedef string str; + +/* clang-format on */ +#define ONLINE_JUDGE 1 + +int main(int argc, char* argv[]) { + ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); +#ifndef ONLINE_JUDGE + freopen("input.txt", "r", stdin); // input.txt + freopen("output.txt", "w", stdout); // output.txt +#endif + str word; + read(word); + print(word[0]); + return 0; +} \ No newline at end of file diff --git a/solutions/metronome.cpp b/solutions/metronome.cpp new file mode 100644 index 0000000..52a6105 --- /dev/null +++ b/solutions/metronome.cpp @@ -0,0 +1,152 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +/* clang-format off */ + +/* 1. TYPES */ +#define ll long long +#define pii pair +#define pll pair +#define vi vector +#define vc vector +#define vll vector +#define mii map +#define si set +#define sc set + +/* 2. FUNCTIONS */ +void read() {} +template +void read(T& first, Args&... args) { std::cin >> first; read(args...); } +#define f(i,s,e) for(long long int i=s;i +std::set U(const std::set& a, const std::set& b) { + std::set result; + std::set_union(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +template +std::set I(const std::set& a, const std::set& b) { + std::set result; + std::set_intersection(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +template +std::set D(const std::set& a, const std::set& b) { + std::set result; + std::set_difference(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +/* 4 CONVERSIONS */ +template +auto toset(const U& v) -> std::set { + return std::set(v.begin(), v.end()); +} + + +/* 5 PRINTS */ +// Type trait to check if a type is a container (has begin() and end()) +template struct is_container : std::false_type {}; +template +struct is_container< + T, typename std::enable_if< + !std::is_same::value && // Exclude std::string + !std::is_same::value && // Exclude C-style strings + std::is_same())), + decltype(std::end(std::declval()))>::value>::type> + : std::true_type {}; +// Base case: types that are not containers or strings +template +typename std::enable_if::value && + !std::is_same::value>::type +print(const T& x) {std::cout << x;} +// Overload for strings and C-style strings +void print(const std::string& s) { std::cout << s; } +void print(const char* s) { std::cout << s; } +// Overload for pairs +template void print(const std::pair& p) { std::cout << "(";print(p.first); std::cout << ", "; print(p.second);std::cout << ")";} +// Overload for containers +template +typename std::enable_if::value>::type print(const T& container) { std::cout << "[";bool first = true;for (const auto& element : container) {if (!first) std::cout << ", "; print(element); first = false; } std::cout << "]"; } +template +void print(const T& first, const Args&... args) { print(first); print(args...); } +/* 6. UTILS */ +#define MOD 1000000007 +#define PI 3.1415926535897932384626433832795 +#define NL "\n" +ll min(ll a,int b) { if (ab) return a; return b; } +ll max(int a,ll b) { if (a>b) return a; return b; } +ll gcd(ll a,ll b) { if (b==0) return a; return gcd(b, a%b); } +ll lcm(ll a,ll b) { return a/gcd(a,b)*b; } +string to_upper(string a) { for (int i=0;i<(int)a.size();++i) if (a[i]>='a' && a[i]<='z') a[i]-='a'-'A'; return a; } +string to_lower(string a) { for (int i=0;i<(int)a.size();++i) if (a[i]>='A' && a[i]<='Z') a[i]+='a'-'A'; return a; } +bool prime(ll a) { if (a==1) return 0; for (int i=2;i<=round(sqrt(a));++i) if (a%i==0) return 0; return 1; } +void yes() { cout<<"YES\n"; } +void no() { cout<<"NO\n"; } + +/* 7. All Required define Pre-Processors and typedef Constants */ +typedef long int int32; +typedef unsigned long int uint32; +typedef long long int int64; +typedef unsigned long long int uint64; +typedef string str; + +/* clang-format on */ +#define ONLINE_JUDGE 1 + +int main(int argc, char* argv[]) { + ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); +#ifndef ONLINE_JUDGE + freopen("input.txt", "r", stdin); // input.txt + freopen("output.txt", "w", stdout); // output.txt +#endif + double n; + read(n); +#define TICKS 4 + double res = n / TICKS; + cout << std::fixed; + IF(fmod(res, 1.0) == 0.0, cout << setprecision(1), cout << setprecision(2)); + + print(res); + + return 0; +} \ No newline at end of file diff --git a/solutions/millifaersla.cpp b/solutions/millifaersla.cpp new file mode 100644 index 0000000..43a08cd --- /dev/null +++ b/solutions/millifaersla.cpp @@ -0,0 +1,168 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +/* clang-format off */ + +/* 1. TYPES */ +#define ll long long +#define pii pair +#define pll pair +#define vi vector +#define vc vector +#define vs vector +#define vll vector +#define mii map +#define si set +#define sc set + +/* 2. FUNCTIONS */ +void read() {} +template +void read(T& first, Args&... args) { std::cin >> first; read(args...); } +#define f(i,s,e) for(long long int i=s;i +int argmin(std::initializer_list args) { + auto it = std::min_element(args.begin(), args.end()); + return std::distance(args.begin(), it); +} +template +int argmax(std::initializer_list args) { + auto it = std::max_element(args.begin(), args.end()); + return std::distance(args.begin(), it); +} + +template +std::set U(const std::set& a, const std::set& b) { + std::set result; + std::set_union(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +template +std::set I(const std::set& a, const std::set& b) { + std::set result; + std::set_intersection(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +template +std::set D(const std::set& a, const std::set& b) { + std::set result; + std::set_difference(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +/* 4 CONVERSIONS */ +template +auto toset(const U& v) -> std::set { + return std::set(v.begin(), v.end()); +} + + +/* 5 PRINTS */ +// Type trait to check if a type is a container (has begin() and end()) +template struct is_container : std::false_type {}; +template +struct is_container< + T, typename std::enable_if< + !std::is_same::value && // Exclude std::string + !std::is_same::value && // Exclude C-style strings + std::is_same())), + decltype(std::end(std::declval()))>::value>::type> + : std::true_type {}; +// Base case: types that are not containers or strings +template +typename std::enable_if::value && + !std::is_same::value>::type +print(const T& x) {std::cout << x;} +// Overload for strings and C-style strings +void print(const std::string& s) { std::cout << s; } +void print(const char* s) { std::cout << s; } +// Overload for pairs +template void print(const std::pair& p) { std::cout << "(";print(p.first); std::cout << ", "; print(p.second);std::cout << ")";} +// Overload for containers +template +typename std::enable_if::value>::type print(const T& container) { std::cout << "[";bool first = true;for (const auto& element : container) {if (!first) std::cout << ", "; print(element); first = false; } std::cout << "]"; } +template +void print(const T& first, const Args&... args) { print(first); print(args...); } + +/* 6. UTILS */ +#define MOD 1000000007 +#define PI 3.1415926535897932384626433832795 +#define NL "\n" +ll min(ll a,int b) { if (ab) return a; return b; } +ll max(int a,ll b) { if (a>b) return a; return b; } +ll gcd(ll a,ll b) { if (b==0) return a; return gcd(b, a%b); } +ll lcm(ll a,ll b) { return a/gcd(a,b)*b; } +string to_upper(string a) { for (int i=0;i<(int)a.size();++i) if (a[i]>='a' && a[i]<='z') a[i]-='a'-'A'; return a; } +string to_lower(string a) { for (int i=0;i<(int)a.size();++i) if (a[i]>='A' && a[i]<='Z') a[i]+='a'-'A'; return a; } +bool prime(ll a) { if (a==1) return 0; for (int i=2;i<=round(sqrt(a));++i) if (a%i==0) return 0; return 1; } +void yes() { cout<<"YES\n"; } +void no() { cout<<"NO\n"; } + + +/* 7. All Required define Pre-Processors and typedef Constants */ +typedef long int int32; +typedef unsigned long int uint32; +typedef long long int int64; +typedef unsigned long long int uint64; +typedef string str; + +/* clang-format on */ +#define ONLINE_JUDGE 1 + +int main(int argc, char* argv[]) { + ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); +#ifndef ONLINE_JUDGE + freopen("input.txt", "r", stdin); // input.txt + freopen("output.txt", "w", stdout); // output.txt +#endif + ll a, b, c; + read(a, b, c); + + int idx = argmin({a, b, c}); + + if (idx == 0) { + print("Monnei", NL); + } else if (idx == 1) { + print("Fjee", NL); + } else { + print("Dolladollabilljoll", NL); + } + return 0; +} \ No newline at end of file diff --git a/solutions/nsum.cpp b/solutions/nsum.cpp new file mode 100644 index 0000000..a4affe9 --- /dev/null +++ b/solutions/nsum.cpp @@ -0,0 +1,153 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +/* clang-format off */ + +/* 1. TYPES */ +#define ll long long +#define pii pair +#define pll pair +#define vi vector +#define vc vector +#define vs vector +#define vll vector +#define mii map +#define si set +#define sc set + +/* 2. FUNCTIONS */ +void read() {} +template +void read(T& first, Args&... args) { std::cin >> first; read(args...); } +#define f(i,s,e) for(long long int i=s;i +std::set U(const std::set& a, const std::set& b) { + std::set result; + std::set_union(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +template +std::set I(const std::set& a, const std::set& b) { + std::set result; + std::set_intersection(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +template +std::set D(const std::set& a, const std::set& b) { + std::set result; + std::set_difference(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +/* 4 CONVERSIONS */ +template +auto toset(const U& v) -> std::set { + return std::set(v.begin(), v.end()); +} + + +/* 5 PRINTS */ +// Type trait to check if a type is a container (has begin() and end()) +template struct is_container : std::false_type {}; +template +struct is_container< + T, typename std::enable_if< + !std::is_same::value && // Exclude std::string + !std::is_same::value && // Exclude C-style strings + std::is_same())), + decltype(std::end(std::declval()))>::value>::type> + : std::true_type {}; +// Base case: types that are not containers or strings +template +typename std::enable_if::value && + !std::is_same::value>::type +print(const T& x) {std::cout << x;} +// Overload for strings and C-style strings +void print(const std::string& s) { std::cout << s; } +void print(const char* s) { std::cout << s; } +// Overload for pairs +template void print(const std::pair& p) { std::cout << "(";print(p.first); std::cout << ", "; print(p.second);std::cout << ")";} +// Overload for containers +template +typename std::enable_if::value>::type print(const T& container) { std::cout << "[";bool first = true;for (const auto& element : container) {if (!first) std::cout << ", "; print(element); first = false; } std::cout << "]"; } +template +void print(const T& first, const Args&... args) { print(first); print(args...); } +/* 6. UTILS */ +#define MOD 1000000007 +#define PI 3.1415926535897932384626433832795 +#define NL "\n" +ll min(ll a,int b) { if (ab) return a; return b; } +ll max(int a,ll b) { if (a>b) return a; return b; } +ll gcd(ll a,ll b) { if (b==0) return a; return gcd(b, a%b); } +ll lcm(ll a,ll b) { return a/gcd(a,b)*b; } +string to_upper(string a) { for (int i=0;i<(int)a.size();++i) if (a[i]>='a' && a[i]<='z') a[i]-='a'-'A'; return a; } +string to_lower(string a) { for (int i=0;i<(int)a.size();++i) if (a[i]>='A' && a[i]<='Z') a[i]+='a'-'A'; return a; } +bool prime(ll a) { if (a==1) return 0; for (int i=2;i<=round(sqrt(a));++i) if (a%i==0) return 0; return 1; } +void yes() { cout<<"YES\n"; } +void no() { cout<<"NO\n"; } + +/* 7. All Required define Pre-Processors and typedef Constants */ +typedef long int int32; +typedef unsigned long int uint32; +typedef long long int int64; +typedef unsigned long long int uint64; +typedef string str; + +/* clang-format on */ +#define ONLINE_JUDGE 1 + +int main(int argc, char* argv[]) { + ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); +#ifndef ONLINE_JUDGE + freopen("input.txt", "r", stdin); // input.txt + freopen("output.txt", "w", stdout); // output.txt +#endif + ll a; + read(a); + int sum = 0; + f(i, 0, a) { + int t; + read(t); + sum += t; + } + print(sum, NL); + return 0; +} \ No newline at end of file diff --git a/solutions/palindromes-custom-bitwise-op.cpp b/solutions/palindromes-custom-bitwise-op.cpp new file mode 100644 index 0000000..b1db3a5 --- /dev/null +++ b/solutions/palindromes-custom-bitwise-op.cpp @@ -0,0 +1,154 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +/* clang-format off */ + +/* 1. TYPES */ +#define ll long long +#define pii pair +#define pll pair +#define vi vector +#define vc vector +#define vll vector +#define mii map +#define si set +#define sc set + +/* 2. FUNCTIONS */ +void read() {} +template +void read(T& first, Args&... args) { std::cin >> first; read(args...); } +#define f(i,s,e) for(long long int i=s;i +std::set U(const std::set& a, const std::set& b) { + std::set result; + std::set_union(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +template +std::set I(const std::set& a, const std::set& b) { + std::set result; + std::set_intersection(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +template +std::set D(const std::set& a, const std::set& b) { + std::set result; + std::set_difference(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +/* 4 CONVERSIONS */ +template +auto toset(const U& v) -> std::set { + return std::set(v.begin(), v.end()); +} + + +/* 5 PRINTS */ +// Type trait to check if a type is a container (has begin() and end()) +template struct is_container : std::false_type {}; +template +struct is_container< + T, typename std::enable_if< + !std::is_same::value && // Exclude std::string + !std::is_same::value && // Exclude C-style strings + std::is_same())), + decltype(std::end(std::declval()))>::value>::type> + : std::true_type {}; +// Base case: types that are not containers or strings +template +typename std::enable_if::value && + !std::is_same::value>::type +print(const T& x) {std::cout << x;} +// Overload for strings and C-style strings +void print(const std::string& s) { std::cout << s; } +void print(const char* s) { std::cout << s; } +// Overload for pairs +template void print(const std::pair& p) { std::cout << "(";print(p.first); std::cout << ", "; print(p.second);std::cout << ")";} +// Overload for containers +template +typename std::enable_if::value>::type print(const T& container) { std::cout << "[";bool first = true;for (const auto& element : container) {if (!first) std::cout << ", "; print(element); first = false; } std::cout << "]"; } +template +void print(const T& first, const Args&... args) { print(first); print(args...); } +/* 6. UTILS */ +#define MOD 1000000007 +#define PI 3.1415926535897932384626433832795 +#define NL "\n" +ll min(ll a,int b) { if (ab) return a; return b; } +ll max(int a,ll b) { if (a>b) return a; return b; } +ll gcd(ll a,ll b) { if (b==0) return a; return gcd(b, a%b); } +ll lcm(ll a,ll b) { return a/gcd(a,b)*b; } +string to_upper(string a) { for (int i=0;i<(int)a.size();++i) if (a[i]>='a' && a[i]<='z') a[i]-='a'-'A'; return a; } +string to_lower(string a) { for (int i=0;i<(int)a.size();++i) if (a[i]>='A' && a[i]<='Z') a[i]+='a'-'A'; return a; } +bool prime(ll a) { if (a==1) return 0; for (int i=2;i<=round(sqrt(a));++i) if (a%i==0) return 0; return 1; } +void yes() { cout<<"YES\n"; } +void no() { cout<<"NO\n"; } + +/* 7. All Required define Pre-Processors and typedef Constants */ +typedef long int int32; +typedef unsigned long int uint32; +typedef long long int int64; +typedef unsigned long long int uint64; +typedef string str; + +/* clang-format on */ +#define ONLINE_JUDGE 1 + +int main(int argc, char* argv[]) { + ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); +#ifndef ONLINE_JUDGE + freopen("input.txt", "r", stdin); // input.txt + freopen("output.txt", "w", stdout); // output.txt +#endif + str word; + + read(word); + + int ok = 1; + for (int i = 0, j = word.length() - 1; i < word.length() && j >= 0; + i++, j--) { + ok &= word[i] == word[j]; + } + + IF(ok, yes(), no()); + + return 0; +} \ No newline at end of file diff --git a/solutions/quadrant.cpp b/solutions/quadrant.cpp new file mode 100644 index 0000000..6f6c808 --- /dev/null +++ b/solutions/quadrant.cpp @@ -0,0 +1,156 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +/* clang-format off */ + +/* 1. TYPES */ +#define ll long long +#define pii pair +#define pll pair +#define vi vector +#define vc vector +#define vs vector +#define vll vector +#define mii map +#define si set +#define sc set + +/* 2. FUNCTIONS */ +void read() {} +template +void read(T& first, Args&... args) { std::cin >> first; read(args...); } +#define f(i,s,e) for(long long int i=s;i +std::set U(const std::set& a, const std::set& b) { + std::set result; + std::set_union(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +template +std::set I(const std::set& a, const std::set& b) { + std::set result; + std::set_intersection(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +template +std::set D(const std::set& a, const std::set& b) { + std::set result; + std::set_difference(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +/* 4 CONVERSIONS */ +template +auto toset(const U& v) -> std::set { + return std::set(v.begin(), v.end()); +} + + +/* 5 PRINTS */ +// Type trait to check if a type is a container (has begin() and end()) +template struct is_container : std::false_type {}; +template +struct is_container< + T, typename std::enable_if< + !std::is_same::value && // Exclude std::string + !std::is_same::value && // Exclude C-style strings + std::is_same())), + decltype(std::end(std::declval()))>::value>::type> + : std::true_type {}; +// Base case: types that are not containers or strings +template +typename std::enable_if::value && + !std::is_same::value>::type +print(const T& x) {std::cout << x;} +// Overload for strings and C-style strings +void print(const std::string& s) { std::cout << s; } +void print(const char* s) { std::cout << s; } +// Overload for pairs +template void print(const std::pair& p) { std::cout << "(";print(p.first); std::cout << ", "; print(p.second);std::cout << ")";} +// Overload for containers +template +typename std::enable_if::value>::type print(const T& container) { std::cout << "[";bool first = true;for (const auto& element : container) {if (!first) std::cout << ", "; print(element); first = false; } std::cout << "]"; } +template +void print(const T& first, const Args&... args) { print(first); print(args...); } +/* 6. UTILS */ +#define MOD 1000000007 +#define PI 3.1415926535897932384626433832795 +#define NL "\n" +ll min(ll a,int b) { if (ab) return a; return b; } +ll max(int a,ll b) { if (a>b) return a; return b; } +ll gcd(ll a,ll b) { if (b==0) return a; return gcd(b, a%b); } +ll lcm(ll a,ll b) { return a/gcd(a,b)*b; } +string to_upper(string a) { for (int i=0;i<(int)a.size();++i) if (a[i]>='a' && a[i]<='z') a[i]-='a'-'A'; return a; } +string to_lower(string a) { for (int i=0;i<(int)a.size();++i) if (a[i]>='A' && a[i]<='Z') a[i]+='a'-'A'; return a; } +bool prime(ll a) { if (a==1) return 0; for (int i=2;i<=round(sqrt(a));++i) if (a%i==0) return 0; return 1; } +void yes() { cout<<"YES\n"; } +void no() { cout<<"NO\n"; } + +/* 7. All Required define Pre-Processors and typedef Constants */ +typedef long int int32; +typedef unsigned long int uint32; +typedef long long int int64; +typedef unsigned long long int uint64; +typedef string str; + +/* clang-format on */ +#define ONLINE_JUDGE 1 + +map xy_to_quadrant = { + {{1, 1}, 1}, + {{-1, 1}, 2}, + {{-1, -1}, 3}, + {{1, -1}, 4}, +}; + +int main(int argc, char* argv[]) { + ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); +#ifndef ONLINE_JUDGE + freopen("input.txt", "r", stdin); // input.txt + freopen("output.txt", "w", stdout); // output.txt +#endif + ll x, y; + read(x, y); + x /= abs(x); + y /= abs(y); + print(xy_to_quadrant[{x, y}]); + return 0; +} \ No newline at end of file diff --git a/solutions/reduplikation.cpp b/solutions/reduplikation.cpp new file mode 100644 index 0000000..49401eb --- /dev/null +++ b/solutions/reduplikation.cpp @@ -0,0 +1,147 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +/* clang-format off */ + +/* 1. TYPES */ +#define ll long long +#define pii pair +#define pll pair +#define vi vector +#define vc vector +#define vll vector +#define mii map +#define si set +#define sc set + +/* 2. FUNCTIONS */ +void read() {} +template +void read(T& first, Args&... args) { std::cin >> first; read(args...); } +#define f(i,s,e) for(long long int i=s;i +std::set U(const std::set& a, const std::set& b) { + std::set result; + std::set_union(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +template +std::set I(const std::set& a, const std::set& b) { + std::set result; + std::set_intersection(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +template +std::set D(const std::set& a, const std::set& b) { + std::set result; + std::set_difference(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +/* 4 CONVERSIONS */ +template +auto toset(const U& v) -> std::set { + return std::set(v.begin(), v.end()); +} + + +/* 5 PRINTS */ +// Type trait to check if a type is a container (has begin() and end()) +template struct is_container : std::false_type {}; +template +struct is_container< + T, typename std::enable_if< + !std::is_same::value && // Exclude std::string + !std::is_same::value && // Exclude C-style strings + std::is_same())), + decltype(std::end(std::declval()))>::value>::type> + : std::true_type {}; +// Base case: types that are not containers or strings +template +typename std::enable_if::value && + !std::is_same::value>::type +print(const T& x) {std::cout << x;} +// Overload for strings and C-style strings +void print(const std::string& s) { std::cout << s; } +void print(const char* s) { std::cout << s; } +// Overload for pairs +template void print(const std::pair& p) { std::cout << "(";print(p.first); std::cout << ", "; print(p.second);std::cout << ")";} +// Overload for containers +template +typename std::enable_if::value>::type print(const T& container) { std::cout << "[";bool first = true;for (const auto& element : container) {if (!first) std::cout << ", "; print(element); first = false; } std::cout << "]"; } +template +void print(const T& first, const Args&... args) { print(first); print(args...); } +/* 6. UTILS */ +#define MOD 1000000007 +#define PI 3.1415926535897932384626433832795 +#define NL "\n" +ll min(ll a,int b) { if (ab) return a; return b; } +ll max(int a,ll b) { if (a>b) return a; return b; } +ll gcd(ll a,ll b) { if (b==0) return a; return gcd(b, a%b); } +ll lcm(ll a,ll b) { return a/gcd(a,b)*b; } +string to_upper(string a) { for (int i=0;i<(int)a.size();++i) if (a[i]>='a' && a[i]<='z') a[i]-='a'-'A'; return a; } +string to_lower(string a) { for (int i=0;i<(int)a.size();++i) if (a[i]>='A' && a[i]<='Z') a[i]+='a'-'A'; return a; } +bool prime(ll a) { if (a==1) return 0; for (int i=2;i<=round(sqrt(a));++i) if (a%i==0) return 0; return 1; } +void yes() { cout<<"YES\n"; } +void no() { cout<<"NO\n"; } + +/* 7. All Required define Pre-Processors and typedef Constants */ +typedef long int int32; +typedef unsigned long int uint32; +typedef long long int int64; +typedef unsigned long long int uint64; +typedef string str; + +/* clang-format on */ +#define ONLINE_JUDGE 1 + +int main(int argc, char* argv[]) { + ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); +#ifndef ONLINE_JUDGE + freopen("input.txt", "r", stdin); // input.txt + freopen("output.txt", "w", stdout); // output.txt +#endif + str word; + ll a; + read(word, a); + f(i, 0, a) { print(word); } + print(NL); + return 0; +} \ No newline at end of file diff --git a/solutions/shortcuttowhat.cpp b/solutions/shortcuttowhat.cpp new file mode 100644 index 0000000..add2b95 --- /dev/null +++ b/solutions/shortcuttowhat.cpp @@ -0,0 +1,156 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +/* clang-format off */ + +/* 1. TYPES */ +#define ll long long +#define pii pair +#define pll pair +#define vi vector +#define vc vector +#define vs vector +#define vll vector +#define mii map +#define si set +#define sc set + +/* 2. FUNCTIONS */ +void read() {} +template +void read(T& first, Args&... args) { std::cin >> first; read(args...); } +#define f(i,s,e) for(long long int i=s;i +std::set U(const std::set& a, const std::set& b) { + std::set result; + std::set_union(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +template +std::set I(const std::set& a, const std::set& b) { + std::set result; + std::set_intersection(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +template +std::set D(const std::set& a, const std::set& b) { + std::set result; + std::set_difference(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +/* 4 CONVERSIONS */ +template +auto toset(const U& v) -> std::set { + return std::set(v.begin(), v.end()); +} + + +/* 5 PRINTS */ +// Type trait to check if a type is a container (has begin() and end()) +template struct is_container : std::false_type {}; +template +struct is_container< + T, typename std::enable_if< + !std::is_same::value && // Exclude std::string + !std::is_same::value && // Exclude C-style strings + std::is_same())), + decltype(std::end(std::declval()))>::value>::type> + : std::true_type {}; +// Base case: types that are not containers or strings +template +typename std::enable_if::value && + !std::is_same::value>::type +print(const T& x) {std::cout << x;} +// Overload for strings and C-style strings +void print(const std::string& s) { std::cout << s; } +void print(const char* s) { std::cout << s; } +// Overload for pairs +template void print(const std::pair& p) { std::cout << "(";print(p.first); std::cout << ", "; print(p.second);std::cout << ")";} +// Overload for containers +template +typename std::enable_if::value>::type print(const T& container) { std::cout << "[";bool first = true;for (const auto& element : container) {if (!first) std::cout << ", "; print(element); first = false; } std::cout << "]"; } +template +void print(const T& first, const Args&... args) { print(first); print(args...); } +/* 6. UTILS */ +#define MOD 1000000007 +#define PI 3.1415926535897932384626433832795 +#define NL "\n" +ll min(ll a,int b) { if (ab) return a; return b; } +ll max(int a,ll b) { if (a>b) return a; return b; } +ll gcd(ll a,ll b) { if (b==0) return a; return gcd(b, a%b); } +ll lcm(ll a,ll b) { return a/gcd(a,b)*b; } +string to_upper(string a) { for (int i=0;i<(int)a.size();++i) if (a[i]>='a' && a[i]<='z') a[i]-='a'-'A'; return a; } +string to_lower(string a) { for (int i=0;i<(int)a.size();++i) if (a[i]>='A' && a[i]<='Z') a[i]+='a'-'A'; return a; } +bool prime(ll a) { if (a==1) return 0; for (int i=2;i<=round(sqrt(a));++i) if (a%i==0) return 0; return 1; } +void yes() { cout<<"YES\n"; } +void no() { cout<<"NO\n"; } + +/* 7. All Required define Pre-Processors and typedef Constants */ +typedef long int int32; +typedef unsigned long int uint32; +typedef long long int int64; +typedef unsigned long long int uint64; +typedef string str; + +/* clang-format on */ +#define ONLINE_JUDGE 1 + +int main(int argc, char* argv[]) { + ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); +#ifndef ONLINE_JUDGE + freopen("input.txt", "r", stdin); // input.txt + freopen("output.txt", "w", stdout); // output.txt +#endif + ll n; + read(n); + + // The program should add five to n, then triple the value and finally + // subtract ten. + // You are welcome to simplify the formula if you can. + // OK i will lol. + //((n + 5) * 3) - 10; + // 3(n+5) - 10 + // 3n + 15 - 10 + // 3n + 5 + print(3 * n + 5, NL); + return 0; +} \ No newline at end of file diff --git a/solutions/skak.cpp b/solutions/skak.cpp new file mode 100644 index 0000000..9e047c6 --- /dev/null +++ b/solutions/skak.cpp @@ -0,0 +1,175 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +/* clang-format off */ + +/* 1. TYPES */ +#define ll long long +#define pii pair +#define pll pair +#define vi vector +#define vc vector +#define vs vector +#define vll vector +#define vpsi vector> +#define mii map +#define si set +#define sc set + +/* 2. FUNCTIONS */ +void read() {} +template +void read(T& first, Args&... args) { std::cin >> first; read(args...); } +#define f(i,s,e) for(long long int i=s;i + constexpr T&& operator()(T&& t) const noexcept { + return std::forward(t); + } +}; +#endif +template +auto argmin(Iterator begin, Iterator end, Func func = {}) { + auto it = std::min_element(begin, end, [&](const auto& a, const auto& b) { + return func(a) < func(b); + }); + return std::distance(begin, it); +} +template +auto argmax(Iterator begin, Iterator end, Func func = {}) { + auto it = std::max_element(begin, end, [&](const auto& a, const auto& b) { + return func(a) < func(b); + }); + return std::distance(begin, it); +} + +#define flr(x) floor(x) // Shortcut for floor +#define cl(x) ceil(x) // Shortcut for ceil + +template +std::set U(const std::set& a, const std::set& b) { + std::set result; + std::set_union(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +template +std::set I(const std::set& a, const std::set& b) { + std::set result; + std::set_intersection(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +template +std::set D(const std::set& a, const std::set& b) { + std::set result; + std::set_difference(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +/* 4 CONVERSIONS */ +template +auto toset(const U& v) -> std::set { + return std::set(v.begin(), v.end()); +} + +/* 5 PRINTS */ +// Type trait to check if a type is a container (has begin() and end()) +template struct is_container : std::false_type {}; +template +struct is_container< + T, typename std::enable_if< + !std::is_same::value && // Exclude std::string + !std::is_same::value && // Exclude C-style strings + std::is_same())), + decltype(std::end(std::declval()))>::value>::type> + : std::true_type {}; +// Base case: types that are not containers or strings +template +typename std::enable_if::value && + !std::is_same::value>::type +print(const T& x) {std::cout << x;} +// Overload for strings and C-style strings +void print(const std::string& s) { std::cout << s; } +void print(const char* s) { std::cout << s; } +// Overload for pairs +template void print(const std::pair& p) { std::cout << "(";print(p.first); std::cout << ", "; print(p.second);std::cout << ")";} +// Overload for containers +template +typename std::enable_if::value>::type print(const T& container) { std::cout << "[";bool first = true;for (const auto& element : container) {if (!first) std::cout << ", "; print(element); first = false; } std::cout << "]"; } +template +void print(const T& first, const Args&... args) { print(first); print(args...); } + +/* 6. UTILS */ +#define MOD 1000000007 +#define PI 3.1415926535897932384626433832795 +#define NL "\n" +ll min(ll a,int b) { if (ab) return a; return b; } +ll max(int a,ll b) { if (a>b) return a; return b; } +ll gcd(ll a,ll b) { if (b==0) return a; return gcd(b, a%b); } +ll lcm(ll a,ll b) { return a/gcd(a,b)*b; } +string to_upper(string a) { for (int i=0;i<(int)a.size();++i) if (a[i]>='a' && a[i]<='z') a[i]-='a'-'A'; return a; } +string to_lower(string a) { for (int i=0;i<(int)a.size();++i) if (a[i]>='A' && a[i]<='Z') a[i]+='a'-'A'; return a; } +bool prime(ll a) { if (a==1) return 0; for (int i=2;i<=round(sqrt(a));++i) if (a%i==0) return 0; return 1; } +void yes() { cout<<"YES\n"; } +void no() { cout<<"NO\n"; } + +/* 7. All Required define Pre-Processors and typedef Constants */ +typedef long int int32; +typedef unsigned long int uint32; +typedef long long int int64; +typedef unsigned long long int uint64; +typedef string str; + +/* clang-format on */ +#define ONLINE_JUDGE 1 + +int main(int argc, char* argv[]) { + ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); +#ifndef ONLINE_JUDGE + freopen("input.txt", "r", stdin); // input.txt + freopen("output.txt", "w", stdout); // output.txt +#endif + ll xr, yr, xp, yp, cnt = 0; + read(xr, yr, xp, yp); + cnt += xr != xp; + cnt += yr != yp; + print(cnt, NL); + return 0; +} \ No newline at end of file diff --git a/solutions/storafmaeli.cpp b/solutions/storafmaeli.cpp new file mode 100644 index 0000000..a70f167 --- /dev/null +++ b/solutions/storafmaeli.cpp @@ -0,0 +1,146 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +/* clang-format off */ + +/* 1. TYPES */ +#define ll long long +#define pii pair +#define pll pair +#define vi vector +#define vc vector +#define vll vector +#define mii map +#define si set +#define sc set + +/* 2. FUNCTIONS */ +void read() {} +template +void read(T& first, Args&... args) { std::cin >> first; read(args...); } +#define f(i,s,e) for(long long int i=s;i +std::set U(const std::set& a, const std::set& b) { + std::set result; + std::set_union(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +template +std::set I(const std::set& a, const std::set& b) { + std::set result; + std::set_intersection(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +template +std::set D(const std::set& a, const std::set& b) { + std::set result; + std::set_difference(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +/* 4 CONVERSIONS */ +template +auto toset(const U& v) -> std::set { + return std::set(v.begin(), v.end()); +} + + +/* 5 PRINTS */ +// Type trait to check if a type is a container (has begin() and end()) +template struct is_container : std::false_type {}; +template +struct is_container< + T, typename std::enable_if< + !std::is_same::value && // Exclude std::string + !std::is_same::value && // Exclude C-style strings + std::is_same())), + decltype(std::end(std::declval()))>::value>::type> + : std::true_type {}; +// Base case: types that are not containers or strings +template +typename std::enable_if::value && + !std::is_same::value>::type +print(const T& x) {std::cout << x;} +// Overload for strings and C-style strings +void print(const std::string& s) { std::cout << s; } +void print(const char* s) { std::cout << s; } +// Overload for pairs +template void print(const std::pair& p) { std::cout << "(";print(p.first); std::cout << ", "; print(p.second);std::cout << ")";} +// Overload for containers +template +typename std::enable_if::value>::type print(const T& container) { std::cout << "[";bool first = true;for (const auto& element : container) {if (!first) std::cout << ", "; print(element); first = false; } std::cout << "]"; } +template +void print(const T& first, const Args&... args) { print(first); print(args...); } +/* 6. UTILS */ +#define MOD 1000000007 +#define PI 3.1415926535897932384626433832795 +#define NL "\n" +ll min(ll a,int b) { if (ab) return a; return b; } +ll max(int a,ll b) { if (a>b) return a; return b; } +ll gcd(ll a,ll b) { if (b==0) return a; return gcd(b, a%b); } +ll lcm(ll a,ll b) { return a/gcd(a,b)*b; } +string to_upper(string a) { for (int i=0;i<(int)a.size();++i) if (a[i]>='a' && a[i]<='z') a[i]-='a'-'A'; return a; } +string to_lower(string a) { for (int i=0;i<(int)a.size();++i) if (a[i]>='A' && a[i]<='Z') a[i]+='a'-'A'; return a; } +bool prime(ll a) { if (a==1) return 0; for (int i=2;i<=round(sqrt(a));++i) if (a%i==0) return 0; return 1; } +void yes() { cout<<"YES\n"; } +void no() { cout<<"NO\n"; } + +/* 7. All Required define Pre-Processors and typedef Constants */ +typedef long int int32; +typedef unsigned long int uint32; +typedef long long int int64; +typedef unsigned long long int uint64; +typedef string str; + +/* clang-format on */ +#define ONLINE_JUDGE 1 + +int main(int argc, char* argv[]) { + ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); +#ifndef ONLINE_JUDGE + freopen("input.txt", "r", stdin); // input.txt + freopen("output.txt", "w", stdout); // output.txt +#endif + ll a; + read(a); + IF(a % 10 == 0, print("Jebb"), print("Neibb")); + return 0; +} \ No newline at end of file diff --git a/solutions/takkar.cpp b/solutions/takkar.cpp new file mode 100644 index 0000000..36693d7 --- /dev/null +++ b/solutions/takkar.cpp @@ -0,0 +1,153 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +/* clang-format off */ + +/* 1. TYPES */ +#define ll long long +#define pii pair +#define pll pair +#define vi vector +#define vc vector +#define vll vector +#define mii map +#define si set +#define sc set + +/* 2. FUNCTIONS */ +void read() {} +template +void read(T& first, Args&... args) { std::cin >> first; read(args...); } +#define f(i,s,e) for(long long int i=s;i +std::set U(const std::set& a, const std::set& b) { + std::set result; + std::set_union(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +template +std::set I(const std::set& a, const std::set& b) { + std::set result; + std::set_intersection(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +template +std::set D(const std::set& a, const std::set& b) { + std::set result; + std::set_difference(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +/* 4 CONVERSIONS */ +template +auto toset(const U& v) -> std::set { + return std::set(v.begin(), v.end()); +} + + +/* 5 PRINTS */ +// Type trait to check if a type is a container (has begin() and end()) +template struct is_container : std::false_type {}; +template +struct is_container< + T, typename std::enable_if< + !std::is_same::value && // Exclude std::string + !std::is_same::value && // Exclude C-style strings + std::is_same())), + decltype(std::end(std::declval()))>::value>::type> + : std::true_type {}; +// Base case: types that are not containers or strings +template +typename std::enable_if::value && + !std::is_same::value>::type +print(const T& x) {std::cout << x;} +// Overload for strings and C-style strings +void print(const std::string& s) { std::cout << s; } +void print(const char* s) { std::cout << s; } +// Overload for pairs +template void print(const std::pair& p) { std::cout << "(";print(p.first); std::cout << ", "; print(p.second);std::cout << ")";} +// Overload for containers +template +typename std::enable_if::value>::type print(const T& container) { std::cout << "[";bool first = true;for (const auto& element : container) {if (!first) std::cout << ", "; print(element); first = false; } std::cout << "]"; } +template +void print(const T& first, const Args&... args) { print(first); print(args...); } +/* 6. UTILS */ +#define MOD 1000000007 +#define PI 3.1415926535897932384626433832795 +#define NL "\n" +ll min(ll a,int b) { if (ab) return a; return b; } +ll max(int a,ll b) { if (a>b) return a; return b; } +ll gcd(ll a,ll b) { if (b==0) return a; return gcd(b, a%b); } +ll lcm(ll a,ll b) { return a/gcd(a,b)*b; } +string to_upper(string a) { for (int i=0;i<(int)a.size();++i) if (a[i]>='a' && a[i]<='z') a[i]-='a'-'A'; return a; } +string to_lower(string a) { for (int i=0;i<(int)a.size();++i) if (a[i]>='A' && a[i]<='Z') a[i]+='a'-'A'; return a; } +bool prime(ll a) { if (a==1) return 0; for (int i=2;i<=round(sqrt(a));++i) if (a%i==0) return 0; return 1; } +void yes() { cout<<"YES\n"; } +void no() { cout<<"NO\n"; } + +/* 7. All Required define Pre-Processors and typedef Constants */ +typedef long int int32; +typedef unsigned long int uint32; +typedef long long int int64; +typedef unsigned long long int uint64; +typedef string str; + +/* clang-format on */ +#define ONLINE_JUDGE 1 + +int main(int argc, char* argv[]) { + ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); +#ifndef ONLINE_JUDGE + freopen("input.txt", "r", stdin); // input.txt + freopen("output.txt", "w", stdout); // output.txt +#endif + ll t, k; + read(t, k); + + if (t > k) { + print("MAGA!"); + } else if (k > t) { + print("FAKE NEWS!"); + } else { + print("WORLD WAR 3!"); + } + return 0; +} \ No newline at end of file diff --git a/solutions/takkfyrirmig.cpp b/solutions/takkfyrirmig.cpp new file mode 100644 index 0000000..3e02474 --- /dev/null +++ b/solutions/takkfyrirmig.cpp @@ -0,0 +1,152 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +/* clang-format off */ + +/* 1. TYPES */ +#define ll long long +#define pii pair +#define pll pair +#define vi vector +#define vc vector +#define vs vector +#define vll vector +#define mii map +#define si set +#define sc set + +/* 2. FUNCTIONS */ +void read() {} +template +void read(T& first, Args&... args) { std::cin >> first; read(args...); } +#define f(i,s,e) for(long long int i=s;i +std::set U(const std::set& a, const std::set& b) { + std::set result; + std::set_union(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +template +std::set I(const std::set& a, const std::set& b) { + std::set result; + std::set_intersection(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +template +std::set D(const std::set& a, const std::set& b) { + std::set result; + std::set_difference(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +/* 4 CONVERSIONS */ +template +auto toset(const U& v) -> std::set { + return std::set(v.begin(), v.end()); +} + + +/* 5 PRINTS */ +// Type trait to check if a type is a container (has begin() and end()) +template struct is_container : std::false_type {}; +template +struct is_container< + T, typename std::enable_if< + !std::is_same::value && // Exclude std::string + !std::is_same::value && // Exclude C-style strings + std::is_same())), + decltype(std::end(std::declval()))>::value>::type> + : std::true_type {}; +// Base case: types that are not containers or strings +template +typename std::enable_if::value && + !std::is_same::value>::type +print(const T& x) {std::cout << x;} +// Overload for strings and C-style strings +void print(const std::string& s) { std::cout << s; } +void print(const char* s) { std::cout << s; } +// Overload for pairs +template void print(const std::pair& p) { std::cout << "(";print(p.first); std::cout << ", "; print(p.second);std::cout << ")";} +// Overload for containers +template +typename std::enable_if::value>::type print(const T& container) { std::cout << "[";bool first = true;for (const auto& element : container) {if (!first) std::cout << ", "; print(element); first = false; } std::cout << "]"; } +template +void print(const T& first, const Args&... args) { print(first); print(args...); } +/* 6. UTILS */ +#define MOD 1000000007 +#define PI 3.1415926535897932384626433832795 +#define NL "\n" +ll min(ll a,int b) { if (ab) return a; return b; } +ll max(int a,ll b) { if (a>b) return a; return b; } +ll gcd(ll a,ll b) { if (b==0) return a; return gcd(b, a%b); } +ll lcm(ll a,ll b) { return a/gcd(a,b)*b; } +string to_upper(string a) { for (int i=0;i<(int)a.size();++i) if (a[i]>='a' && a[i]<='z') a[i]-='a'-'A'; return a; } +string to_lower(string a) { for (int i=0;i<(int)a.size();++i) if (a[i]>='A' && a[i]<='Z') a[i]+='a'-'A'; return a; } +bool prime(ll a) { if (a==1) return 0; for (int i=2;i<=round(sqrt(a));++i) if (a%i==0) return 0; return 1; } +void yes() { cout<<"YES\n"; } +void no() { cout<<"NO\n"; } + +/* 7. All Required define Pre-Processors and typedef Constants */ +typedef long int int32; +typedef unsigned long int uint32; +typedef long long int int64; +typedef unsigned long long int uint64; +typedef string str; + +/* clang-format on */ +#define ONLINE_JUDGE 1 + +int main(int argc, char* argv[]) { + ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); +#ifndef ONLINE_JUDGE + freopen("input.txt", "r", stdin); // input.txt + freopen("output.txt", "w", stdout); // output.txt +#endif + ll a; + read(a); + vs names; + f(i, 0, a) { + str w; + read(w); + print("Takk ", w, NL); + } + return 0; +} \ No newline at end of file diff --git a/solutions/tolvunarfraedingartelja.cpp b/solutions/tolvunarfraedingartelja.cpp new file mode 100644 index 0000000..6bdb43e --- /dev/null +++ b/solutions/tolvunarfraedingartelja.cpp @@ -0,0 +1,145 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +/* clang-format off */ + +/* 1. TYPES */ +#define ll long long +#define pii pair +#define pll pair +#define vi vector +#define vc vector +#define vll vector +#define mii map +#define si set +#define sc set + +/* 2. FUNCTIONS */ +void read() {} +template +void read(T& first, Args&... args) { std::cin >> first; read(args...); } +#define f(i,s,e) for(long long int i=s;i +std::set U(const std::set& a, const std::set& b) { + std::set result; + std::set_union(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +template +std::set I(const std::set& a, const std::set& b) { + std::set result; + std::set_intersection(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +template +std::set D(const std::set& a, const std::set& b) { + std::set result; + std::set_difference(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +/* 4 CONVERSIONS */ +template +auto toset(const U& v) -> std::set { + return std::set(v.begin(), v.end()); +} + + +/* 5 PRINTS */ +// Type trait to check if a type is a container (has begin() and end()) +template struct is_container : std::false_type {}; +template +struct is_container< + T, typename std::enable_if< + !std::is_same::value && // Exclude std::string + !std::is_same::value && // Exclude C-style strings + std::is_same())), + decltype(std::end(std::declval()))>::value>::type> + : std::true_type {}; +// Base case: types that are not containers or strings +template +typename std::enable_if::value && + !std::is_same::value>::type +print(const T& x) {std::cout << x;} +// Overload for strings and C-style strings +void print(const std::string& s) { std::cout << s; } +void print(const char* s) { std::cout << s; } +// Overload for pairs +template void print(const std::pair& p) { std::cout << "(";print(p.first); std::cout << ", "; print(p.second);std::cout << ")";} +// Overload for containers +template +typename std::enable_if::value>::type print(const T& container) { std::cout << "[";bool first = true;for (const auto& element : container) {if (!first) std::cout << ", "; print(element); first = false; } std::cout << "]"; } +template +void print(const T& first, const Args&... args) { print(first); print(args...); } +/* 6. UTILS */ +#define MOD 1000000007 +#define PI 3.1415926535897932384626433832795 +#define NL "\n" +ll min(ll a,int b) { if (ab) return a; return b; } +ll max(int a,ll b) { if (a>b) return a; return b; } +ll gcd(ll a,ll b) { if (b==0) return a; return gcd(b, a%b); } +ll lcm(ll a,ll b) { return a/gcd(a,b)*b; } +string to_upper(string a) { for (int i=0;i<(int)a.size();++i) if (a[i]>='a' && a[i]<='z') a[i]-='a'-'A'; return a; } +string to_lower(string a) { for (int i=0;i<(int)a.size();++i) if (a[i]>='A' && a[i]<='Z') a[i]+='a'-'A'; return a; } +bool prime(ll a) { if (a==1) return 0; for (int i=2;i<=round(sqrt(a));++i) if (a%i==0) return 0; return 1; } +void yes() { cout<<"YES\n"; } +void no() { cout<<"NO\n"; } + +/* 7. All Required define Pre-Processors and typedef Constants */ +typedef long int int32; +typedef unsigned long int uint32; +typedef long long int int64; +typedef unsigned long long int uint64; +typedef string str; + +/* clang-format on */ +#define ONLINE_JUDGE 1 + +int main(int argc, char* argv[]) { + ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); +#ifndef ONLINE_JUDGE + freopen("input.txt", "r", stdin); // input.txt + freopen("output.txt", "w", stdout); // output.txt +#endif + ll a; + read(a); + print(a - 1, NL); + return 0; +} \ No newline at end of file diff --git a/solutions/triarea.cpp b/solutions/triarea.cpp new file mode 100644 index 0000000..74e7f99 --- /dev/null +++ b/solutions/triarea.cpp @@ -0,0 +1,177 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +/* clang-format off */ + +/* 1. TYPES */ +#define ll long long +#define pii pair +#define pll pair +#define vi vector +#define vc vector +#define vs vector +#define vll vector +#define vpsi vector> +#define mii map +#define si set +#define sc set + +/* 2. FUNCTIONS */ +void read() {} +template +void read(T& first, Args&... args) { std::cin >> first; read(args...); } +#define f(i,s,e) for(long long int i=s;i + constexpr T&& operator()(T&& t) const noexcept { + return std::forward(t); + } +}; +#endif + +template +auto argmin(Iterator begin, Iterator end, Func func = {}) { + auto it = std::min_element(begin, end, [&](const auto& a, const auto& b) { + return func(a) < func(b); + }); + return std::distance(begin, it); +} +template +auto argmax(Iterator begin, Iterator end, Func func = {}) { + auto it = std::max_element(begin, end, [&](const auto& a, const auto& b) { + return func(a) < func(b); + }); + return std::distance(begin, it); +} + +#define flr(x) floor(x) // Shortcut for floor +#define cl(x) ceil(x) // Shortcut for ceil + +template +std::set U(const std::set& a, const std::set& b) { + std::set result; + std::set_union(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +template +std::set I(const std::set& a, const std::set& b) { + std::set result; + std::set_intersection(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +template +std::set D(const std::set& a, const std::set& b) { + std::set result; + std::set_difference(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +/* 4 CONVERSIONS */ +template +auto toset(const U& v) -> std::set { + return std::set(v.begin(), v.end()); +} + +/* 5 PRINTS */ +// Type trait to check if a type is a container (has begin() and end()) +template struct is_container : std::false_type {}; +template +struct is_container< + T, typename std::enable_if< + !std::is_same::value && // Exclude std::string + !std::is_same::value && // Exclude C-style strings + std::is_same())), + decltype(std::end(std::declval()))>::value>::type> + : std::true_type {}; +// Base case: types that are not containers or strings +template +typename std::enable_if::value && + !std::is_same::value>::type +print(const T& x) {std::cout << x;} +// Overload for strings and C-style strings +void print(const std::string& s) { std::cout << s; } +void print(const char* s) { std::cout << s; } +// Overload for pairs +template void print(const std::pair& p) { std::cout << "(";print(p.first); std::cout << ", "; print(p.second);std::cout << ")";} +// Overload for containers +template +typename std::enable_if::value>::type print(const T& container) { std::cout << "[";bool first = true;for (const auto& element : container) {if (!first) std::cout << ", "; print(element); first = false; } std::cout << "]"; } +template +void print(const T& first, const Args&... args) { print(first); print(args...); } + +/* 6. UTILS */ +#define MOD 1000000007 +#define PI 3.1415926535897932384626433832795 +#define NL "\n" +ll min(ll a,int b) { if (ab) return a; return b; } +ll max(int a,ll b) { if (a>b) return a; return b; } +ll gcd(ll a,ll b) { if (b==0) return a; return gcd(b, a%b); } +ll lcm(ll a,ll b) { return a/gcd(a,b)*b; } +string to_upper(string a) { for (int i=0;i<(int)a.size();++i) if (a[i]>='a' && a[i]<='z') a[i]-='a'-'A'; return a; } +string to_lower(string a) { for (int i=0;i<(int)a.size();++i) if (a[i]>='A' && a[i]<='Z') a[i]+='a'-'A'; return a; } +bool prime(ll a) { if (a==1) return 0; for (int i=2;i<=round(sqrt(a));++i) if (a%i==0) return 0; return 1; } +void yes() { cout<<"YES\n"; } +void no() { cout<<"NO\n"; } + +/* 7. All Required define Pre-Processors and typedef Constants */ +typedef long int int32; +typedef unsigned long int uint32; +typedef long long int int64; +typedef unsigned long long int uint64; +typedef string str; + +/* clang-format on */ +#define ONLINE_JUDGE 1 + +int main(int argc, char* argv[]) { + ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); +#ifndef ONLINE_JUDGE + freopen("input.txt", "r", stdin); // input.txt + freopen("output.txt", "w", stdout); // output.txt +#endif + ll h, b; + read(h, b); + + print(static_cast(h * b) / 2); + + return 0; +} \ No newline at end of file diff --git a/solutions/twostones.cpp b/solutions/twostones.cpp new file mode 100644 index 0000000..cf2592b --- /dev/null +++ b/solutions/twostones.cpp @@ -0,0 +1,147 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +/* clang-format off */ + +/* 1. TYPES */ +#define ll long long +#define pii pair +#define pll pair +#define vi vector +#define vc vector +#define vs vector +#define vll vector +#define mii map +#define si set +#define sc set + +/* 2. FUNCTIONS */ +void read() {} +template +void read(T& first, Args&... args) { std::cin >> first; read(args...); } +#define f(i,s,e) for(long long int i=s;i +std::set U(const std::set& a, const std::set& b) { + std::set result; + std::set_union(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +template +std::set I(const std::set& a, const std::set& b) { + std::set result; + std::set_intersection(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +template +std::set D(const std::set& a, const std::set& b) { + std::set result; + std::set_difference(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +/* 4 CONVERSIONS */ +template +auto toset(const U& v) -> std::set { + return std::set(v.begin(), v.end()); +} + + +/* 5 PRINTS */ +// Type trait to check if a type is a container (has begin() and end()) +template struct is_container : std::false_type {}; +template +struct is_container< + T, typename std::enable_if< + !std::is_same::value && // Exclude std::string + !std::is_same::value && // Exclude C-style strings + std::is_same())), + decltype(std::end(std::declval()))>::value>::type> + : std::true_type {}; +// Base case: types that are not containers or strings +template +typename std::enable_if::value && + !std::is_same::value>::type +print(const T& x) {std::cout << x;} +// Overload for strings and C-style strings +void print(const std::string& s) { std::cout << s; } +void print(const char* s) { std::cout << s; } +// Overload for pairs +template void print(const std::pair& p) { std::cout << "(";print(p.first); std::cout << ", "; print(p.second);std::cout << ")";} +// Overload for containers +template +typename std::enable_if::value>::type print(const T& container) { std::cout << "[";bool first = true;for (const auto& element : container) {if (!first) std::cout << ", "; print(element); first = false; } std::cout << "]"; } +template +void print(const T& first, const Args&... args) { print(first); print(args...); } +/* 6. UTILS */ +#define MOD 1000000007 +#define PI 3.1415926535897932384626433832795 +#define NL "\n" +ll min(ll a,int b) { if (ab) return a; return b; } +ll max(int a,ll b) { if (a>b) return a; return b; } +ll gcd(ll a,ll b) { if (b==0) return a; return gcd(b, a%b); } +ll lcm(ll a,ll b) { return a/gcd(a,b)*b; } +string to_upper(string a) { for (int i=0;i<(int)a.size();++i) if (a[i]>='a' && a[i]<='z') a[i]-='a'-'A'; return a; } +string to_lower(string a) { for (int i=0;i<(int)a.size();++i) if (a[i]>='A' && a[i]<='Z') a[i]+='a'-'A'; return a; } +bool prime(ll a) { if (a==1) return 0; for (int i=2;i<=round(sqrt(a));++i) if (a%i==0) return 0; return 1; } +void yes() { cout<<"YES\n"; } +void no() { cout<<"NO\n"; } + +/* 7. All Required define Pre-Processors and typedef Constants */ +typedef long int int32; +typedef unsigned long int uint32; +typedef long long int int64; +typedef unsigned long long int uint64; +typedef string str; + +/* clang-format on */ +#define ONLINE_JUDGE 1 + +int main(int argc, char* argv[]) { + ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); +#ifndef ONLINE_JUDGE + freopen("input.txt", "r", stdin); // input.txt + freopen("output.txt", "w", stdout); // output.txt +#endif + ll a; + read(a); + IF(a % 2 == 0, print("Bob"), print("Alice")); + return 0; +} \ No newline at end of file diff --git a/solutions/twosum.cpp b/solutions/twosum.cpp new file mode 100644 index 0000000..c5463d4 --- /dev/null +++ b/solutions/twosum.cpp @@ -0,0 +1,147 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +/* clang-format off */ + +/* 1. TYPES */ +#define ll long long +#define pii pair +#define pll pair +#define vi vector +#define vc vector +#define vs vector +#define vll vector +#define mii map +#define si set +#define sc set + +/* 2. FUNCTIONS */ +void read() {} +template +void read(T& first, Args&... args) { std::cin >> first; read(args...); } +#define f(i,s,e) for(long long int i=s;i +std::set U(const std::set& a, const std::set& b) { + std::set result; + std::set_union(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +template +std::set I(const std::set& a, const std::set& b) { + std::set result; + std::set_intersection(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +template +std::set D(const std::set& a, const std::set& b) { + std::set result; + std::set_difference(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +/* 4 CONVERSIONS */ +template +auto toset(const U& v) -> std::set { + return std::set(v.begin(), v.end()); +} + + +/* 5 PRINTS */ +// Type trait to check if a type is a container (has begin() and end()) +template struct is_container : std::false_type {}; +template +struct is_container< + T, typename std::enable_if< + !std::is_same::value && // Exclude std::string + !std::is_same::value && // Exclude C-style strings + std::is_same())), + decltype(std::end(std::declval()))>::value>::type> + : std::true_type {}; +// Base case: types that are not containers or strings +template +typename std::enable_if::value && + !std::is_same::value>::type +print(const T& x) {std::cout << x;} +// Overload for strings and C-style strings +void print(const std::string& s) { std::cout << s; } +void print(const char* s) { std::cout << s; } +// Overload for pairs +template void print(const std::pair& p) { std::cout << "(";print(p.first); std::cout << ", "; print(p.second);std::cout << ")";} +// Overload for containers +template +typename std::enable_if::value>::type print(const T& container) { std::cout << "[";bool first = true;for (const auto& element : container) {if (!first) std::cout << ", "; print(element); first = false; } std::cout << "]"; } +template +void print(const T& first, const Args&... args) { print(first); print(args...); } +/* 6. UTILS */ +#define MOD 1000000007 +#define PI 3.1415926535897932384626433832795 +#define NL "\n" +ll min(ll a,int b) { if (ab) return a; return b; } +ll max(int a,ll b) { if (a>b) return a; return b; } +ll gcd(ll a,ll b) { if (b==0) return a; return gcd(b, a%b); } +ll lcm(ll a,ll b) { return a/gcd(a,b)*b; } +string to_upper(string a) { for (int i=0;i<(int)a.size();++i) if (a[i]>='a' && a[i]<='z') a[i]-='a'-'A'; return a; } +string to_lower(string a) { for (int i=0;i<(int)a.size();++i) if (a[i]>='A' && a[i]<='Z') a[i]+='a'-'A'; return a; } +bool prime(ll a) { if (a==1) return 0; for (int i=2;i<=round(sqrt(a));++i) if (a%i==0) return 0; return 1; } +void yes() { cout<<"YES\n"; } +void no() { cout<<"NO\n"; } + +/* 7. All Required define Pre-Processors and typedef Constants */ +typedef long int int32; +typedef unsigned long int uint32; +typedef long long int int64; +typedef unsigned long long int uint64; +typedef string str; + +/* clang-format on */ +#define ONLINE_JUDGE 1 + +int main(int argc, char* argv[]) { + ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); +#ifndef ONLINE_JUDGE + freopen("input.txt", "r", stdin); // input.txt + freopen("output.txt", "w", stdout); // output.txt +#endif + ll a, b; + read(a, b); + print(a + b, NL); + return 0; +} \ No newline at end of file diff --git a/solutions/umferd.cpp b/solutions/umferd.cpp new file mode 100644 index 0000000..455796d --- /dev/null +++ b/solutions/umferd.cpp @@ -0,0 +1,181 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +/* clang-format off */ + +/* 1. TYPES */ +#define ll long long +#define pii pair +#define pll pair +#define vi vector +#define vc vector +#define vs vector +#define vll vector +#define vpsi vector> +#define mii map +#define si set +#define sc set + +/* 2. FUNCTIONS */ +void read() {} +template +void read(T& first, Args&... args) { std::cin >> first; read(args...); } +#define f(i,s,e) for(long long int i=s;i + constexpr T&& operator()(T&& t) const noexcept { + return std::forward(t); + } +}; +#endif + +template +auto argmin(Iterator begin, Iterator end, Func func = {}) { + auto it = std::min_element(begin, end, [&](const auto& a, const auto& b) { + return func(a) < func(b); + }); + return std::distance(begin, it); +} +template +auto argmax(Iterator begin, Iterator end, Func func = {}) { + auto it = std::max_element(begin, end, [&](const auto& a, const auto& b) { + return func(a) < func(b); + }); + return std::distance(begin, it); +} + +#define flr(x) floor(x) // Shortcut for floor +#define cl(x) ceil(x) // Shortcut for ceil + +template +std::set U(const std::set& a, const std::set& b) { + std::set result; + std::set_union(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +template +std::set I(const std::set& a, const std::set& b) { + std::set result; + std::set_intersection(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +template +std::set D(const std::set& a, const std::set& b) { + std::set result; + std::set_difference(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +/* 4 CONVERSIONS */ +template +auto toset(const U& v) -> std::set { + return std::set(v.begin(), v.end()); +} + +/* 5 PRINTS */ +// Type trait to check if a type is a container (has begin() and end()) +template struct is_container : std::false_type {}; +template +struct is_container< + T, typename std::enable_if< + !std::is_same::value && // Exclude std::string + !std::is_same::value && // Exclude C-style strings + std::is_same())), + decltype(std::end(std::declval()))>::value>::type> + : std::true_type {}; +// Base case: types that are not containers or strings +template +typename std::enable_if::value && + !std::is_same::value>::type +print(const T& x) {std::cout << x;} +// Overload for strings and C-style strings +void print(const std::string& s) { std::cout << s; } +void print(const char* s) { std::cout << s; } +// Overload for pairs +template void print(const std::pair& p) { std::cout << "(";print(p.first); std::cout << ", "; print(p.second);std::cout << ")";} +// Overload for containers +template +typename std::enable_if::value>::type print(const T& container) { std::cout << "[";bool first = true;for (const auto& element : container) {if (!first) std::cout << ", "; print(element); first = false; } std::cout << "]"; } +template +void print(const T& first, const Args&... args) { print(first); print(args...); } + +/* 6. UTILS */ +#define MOD 1000000007 +#define PI 3.1415926535897932384626433832795 +#define NL "\n" +ll min(ll a,int b) { if (ab) return a; return b; } +ll max(int a,ll b) { if (a>b) return a; return b; } +ll gcd(ll a,ll b) { if (b==0) return a; return gcd(b, a%b); } +ll lcm(ll a,ll b) { return a/gcd(a,b)*b; } +string to_upper(string a) { for (int i=0;i<(int)a.size();++i) if (a[i]>='a' && a[i]<='z') a[i]-='a'-'A'; return a; } +string to_lower(string a) { for (int i=0;i<(int)a.size();++i) if (a[i]>='A' && a[i]<='Z') a[i]+='a'-'A'; return a; } +bool prime(ll a) { if (a==1) return 0; for (int i=2;i<=round(sqrt(a));++i) if (a%i==0) return 0; return 1; } +void yes() { cout<<"YES\n"; } +void no() { cout<<"NO\n"; } + +/* 7. All Required define Pre-Processors and typedef Constants */ +typedef long int int32; +typedef unsigned long int uint32; +typedef long long int int64; +typedef unsigned long long int uint64; +typedef string str; + +/* clang-format on */ +#define ONLINE_JUDGE 1 + +int main(int argc, char* argv[]) { + ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); +#ifndef ONLINE_JUDGE + freopen("input.txt", "r", stdin); // input.txt + freopen("output.txt", "w", stdout); // output.txt +#endif + double m, n; + read(m, n); + double cnt = 0; + f(i, 0, n) { + str lane; + read(lane); + EACH(c, lane) cnt += c == '.'; + } + + print(cnt / (m * n)); + return 0; +} \ No newline at end of file diff --git a/solutions/vidsnuningur.cpp b/solutions/vidsnuningur.cpp new file mode 100644 index 0000000..b3c0d1f --- /dev/null +++ b/solutions/vidsnuningur.cpp @@ -0,0 +1,151 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +/* clang-format off */ + +/* 1. TYPES */ +#define ll long long +#define pii pair +#define pll pair +#define vi vector +#define vc vector +#define vs vector +#define vll vector +#define mii map +#define si set +#define sc set + +/* 2. FUNCTIONS */ +void read() {} +template +void read(T& first, Args&... args) { std::cin >> first; read(args...); } +#define f(i,s,e) for(long long int i=s;i +std::set U(const std::set& a, const std::set& b) { + std::set result; + std::set_union(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +template +std::set I(const std::set& a, const std::set& b) { + std::set result; + std::set_intersection(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +template +std::set D(const std::set& a, const std::set& b) { + std::set result; + std::set_difference(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +/* 4 CONVERSIONS */ +template +auto toset(const U& v) -> std::set { + return std::set(v.begin(), v.end()); +} + + +/* 5 PRINTS */ +// Type trait to check if a type is a container (has begin() and end()) +template struct is_container : std::false_type {}; +template +struct is_container< + T, typename std::enable_if< + !std::is_same::value && // Exclude std::string + !std::is_same::value && // Exclude C-style strings + std::is_same())), + decltype(std::end(std::declval()))>::value>::type> + : std::true_type {}; +// Base case: types that are not containers or strings +template +typename std::enable_if::value && + !std::is_same::value>::type +print(const T& x) {std::cout << x;} +// Overload for strings and C-style strings +void print(const std::string& s) { std::cout << s; } +void print(const char* s) { std::cout << s; } +// Overload for pairs +template void print(const std::pair& p) { std::cout << "(";print(p.first); std::cout << ", "; print(p.second);std::cout << ")";} +// Overload for containers +template +typename std::enable_if::value>::type print(const T& container) { std::cout << "[";bool first = true;for (const auto& element : container) {if (!first) std::cout << ", "; print(element); first = false; } std::cout << "]"; } +template +void print(const T& first, const Args&... args) { print(first); print(args...); } +/* 6. UTILS */ +#define MOD 1000000007 +#define PI 3.1415926535897932384626433832795 +#define NL "\n" +ll min(ll a,int b) { if (ab) return a; return b; } +ll max(int a,ll b) { if (a>b) return a; return b; } +ll gcd(ll a,ll b) { if (b==0) return a; return gcd(b, a%b); } +ll lcm(ll a,ll b) { return a/gcd(a,b)*b; } +string to_upper(string a) { for (int i=0;i<(int)a.size();++i) if (a[i]>='a' && a[i]<='z') a[i]-='a'-'A'; return a; } +string to_lower(string a) { for (int i=0;i<(int)a.size();++i) if (a[i]>='A' && a[i]<='Z') a[i]+='a'-'A'; return a; } +bool prime(ll a) { if (a==1) return 0; for (int i=2;i<=round(sqrt(a));++i) if (a%i==0) return 0; return 1; } +void yes() { cout<<"YES\n"; } +void no() { cout<<"NO\n"; } + +/* 7. All Required define Pre-Processors and typedef Constants */ +typedef long int int32; +typedef unsigned long int uint32; +typedef long long int int64; +typedef unsigned long long int uint64; +typedef string str; + +/* clang-format on */ +#define ONLINE_JUDGE 1 + +int main(int argc, char* argv[]) { + ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); +#ifndef ONLINE_JUDGE + freopen("input.txt", "r", stdin); // input.txt + freopen("output.txt", "w", stdout); // output.txt +#endif + str word; + read(word); + + for (int i = word.length() - 1; i >= 0; i--) { + print(word[i]); + } + + return 0; +} \ No newline at end of file diff --git a/solutions/whichisgreater.cpp b/solutions/whichisgreater.cpp new file mode 100644 index 0000000..26e5522 --- /dev/null +++ b/solutions/whichisgreater.cpp @@ -0,0 +1,147 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +/* clang-format off */ + +/* 1. TYPES */ +#define ll long long +#define pii pair +#define pll pair +#define vi vector +#define vc vector +#define vs vector +#define vll vector +#define mii map +#define si set +#define sc set + +/* 2. FUNCTIONS */ +void read() {} +template +void read(T& first, Args&... args) { std::cin >> first; read(args...); } +#define f(i,s,e) for(long long int i=s;i +std::set U(const std::set& a, const std::set& b) { + std::set result; + std::set_union(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +template +std::set I(const std::set& a, const std::set& b) { + std::set result; + std::set_intersection(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +template +std::set D(const std::set& a, const std::set& b) { + std::set result; + std::set_difference(a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.begin())); + return result; +} + +/* 4 CONVERSIONS */ +template +auto toset(const U& v) -> std::set { + return std::set(v.begin(), v.end()); +} + + +/* 5 PRINTS */ +// Type trait to check if a type is a container (has begin() and end()) +template struct is_container : std::false_type {}; +template +struct is_container< + T, typename std::enable_if< + !std::is_same::value && // Exclude std::string + !std::is_same::value && // Exclude C-style strings + std::is_same())), + decltype(std::end(std::declval()))>::value>::type> + : std::true_type {}; +// Base case: types that are not containers or strings +template +typename std::enable_if::value && + !std::is_same::value>::type +print(const T& x) {std::cout << x;} +// Overload for strings and C-style strings +void print(const std::string& s) { std::cout << s; } +void print(const char* s) { std::cout << s; } +// Overload for pairs +template void print(const std::pair& p) { std::cout << "(";print(p.first); std::cout << ", "; print(p.second);std::cout << ")";} +// Overload for containers +template +typename std::enable_if::value>::type print(const T& container) { std::cout << "[";bool first = true;for (const auto& element : container) {if (!first) std::cout << ", "; print(element); first = false; } std::cout << "]"; } +template +void print(const T& first, const Args&... args) { print(first); print(args...); } +/* 6. UTILS */ +#define MOD 1000000007 +#define PI 3.1415926535897932384626433832795 +#define NL "\n" +ll min(ll a,int b) { if (ab) return a; return b; } +ll max(int a,ll b) { if (a>b) return a; return b; } +ll gcd(ll a,ll b) { if (b==0) return a; return gcd(b, a%b); } +ll lcm(ll a,ll b) { return a/gcd(a,b)*b; } +string to_upper(string a) { for (int i=0;i<(int)a.size();++i) if (a[i]>='a' && a[i]<='z') a[i]-='a'-'A'; return a; } +string to_lower(string a) { for (int i=0;i<(int)a.size();++i) if (a[i]>='A' && a[i]<='Z') a[i]+='a'-'A'; return a; } +bool prime(ll a) { if (a==1) return 0; for (int i=2;i<=round(sqrt(a));++i) if (a%i==0) return 0; return 1; } +void yes() { cout<<"YES\n"; } +void no() { cout<<"NO\n"; } + +/* 7. All Required define Pre-Processors and typedef Constants */ +typedef long int int32; +typedef unsigned long int uint32; +typedef long long int int64; +typedef unsigned long long int uint64; +typedef string str; + +/* clang-format on */ +#define ONLINE_JUDGE 1 + +int main(int argc, char* argv[]) { + ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); +#ifndef ONLINE_JUDGE + freopen("input.txt", "r", stdin); // input.txt + freopen("output.txt", "w", stdout); // output.txt +#endif + ll a, b; + read(a, b); + IF(a > b, print(1), print(0)); + return 0; +} \ No newline at end of file diff --git a/templates/template.cpp b/templates/template.cpp index e5cb657..2c8367c 100644 --- a/templates/template.cpp +++ b/templates/template.cpp @@ -54,12 +54,14 @@ void read(T& first, Args&... args) { std::cin >> first; read(args...); } #define IF(cond, true_expr, false_expr) do { if (cond) { true_expr; } else { false_expr; } } while(0) /* 3. MATH SHORTCUTS */ +#if __cplusplus < 202002L struct identity { template constexpr T&& operator()(T&& t) const noexcept { return std::forward(t); } }; +#endif template auto argmin(Iterator begin, Iterator end, Func func = {}) { auto it = std::min_element(begin, end, [&](const auto& a, const auto& b) {