This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <vector> | |
| #include <algorithm> | |
| using namespace std; | |
| int findMin(const vector<int>& v) { | |
| return *min_element(v.begin(), v.end()); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <fstream> | |
| #include <map> | |
| #include <string> | |
| #include <cctype> | |
| using namespace std; | |
| int main() { | |
| ifstream in("input.txt"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <vector> | |
| #include <unordered_map> | |
| using namespace std; | |
| int sumDigits(int x) { | |
| x = abs(x); | |
| int s = 0; | |
| while (x > 0) { | |
| s += x % 10; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <vector> | |
| #include <algorithm> | |
| using namespace std; | |
| struct FindMin { | |
| int operator()(const vector<int>& v) { | |
| return *min_element(v.begin(), v.end()); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <utility> | |
| #include <cstddef> | |
| template<typename T> | |
| class UniquePtr { | |
| T* ptr = nullptr; | |
| public: | |
| constexpr UniquePtr() noexcept = default; | |
| explicit UniquePtr(T* p) noexcept : ptr(p) {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| using namespace std; | |
| class Base { | |
| public: | |
| static int people_on_base; | |
| static int vehicles_on_base; | |
| static double petrol_on_base; | |
| static double goods_on_base; | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <stdexcept> | |
| #include <string> | |
| class ArraySizeException : public std::runtime_error { | |
| public: | |
| ArraySizeException(const std::string& msg) : std::runtime_error(msg) {} | |
| }; | |
| class ArrayDataException : public std::runtime_error { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <cstring> | |
| using namespace std; | |
| class Employer { | |
| public: | |
| virtual void Print() const = 0; | |
| virtual ~Employer() {} | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <string> | |
| using namespace std; | |
| class Pet { | |
| protected: | |
| string name; | |
| public: | |
| Pet(string n) : name(n) {} | |
| virtual void Sound() = 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <cstring> | |
| using namespace std; | |
| class Employer { | |
| public: | |
| virtual void Print() = 0; | |
| virtual ~Employer() {} | |
| }; |