Skip to content

Instantly share code, notes, and snippets.

@talentestors
Last active December 6, 2024 08:34
Show Gist options
  • Select an option

  • Save talentestors/13329d2bf53dff7592c4db9535d3f8cc to your computer and use it in GitHub Desktop.

Select an option

Save talentestors/13329d2bf53dff7592c4db9535d3f8cc to your computer and use it in GitHub Desktop.
For OI/ACM & CodeForces/LeetCode/LuoGu/AtCoder/nowcoder
using ll = long long;
using ld = long double;
using ull = unsigned long long;
cmake_minimum_required(VERSION 3.30)
project(linuxC VERSION 1.1.0 DESCRIPTION "For ACM" LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 23)
add_compile_options(-Wall)
set(CMAKE_C_FLAGS -static-libgcc)
set(CMAKE_CXX_FLAGS -static-libstdc++)
# Configure ccache if available
find_program(CCACHE_FOUND ccache)
if (CCACHE_FOUND)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
endif (CCACHE_FOUND)
# for math.h in the linux
LINK_LIBRARIES(m)
add_executable(linuxC main.cpp)
add_executable(test test.cpp)
add_executable(record record.cpp)
add_executable(hack hack.cpp)
add_executable(template template.cpp)
add_executable(format format.cpp)
# add -DONLINE_JUDGE for Online Judge
if (${CMAKE_BUILD_TYPE} STREQUAL "Debug")
add_compile_definitions(ONLINE_JUDGE=localhost)
endif (${CMAKE_BUILD_TYPE} STREQUAL "Debug")
// mp.reserve(1024), mp.max_load_factor(0.75);
struct custom_hash {
static uint64_t splitmix64(uint64_t x) {
// http://xorshift.di.unimi.it/splitmix64.c
x += 0x9e3779b97f4a7c15;
x = (x ^ x >> 30) * 0xbf58476d1ce4e5b9;
x = (x ^ x >> 27) * 0x94d049bb133111eb;
return x ^ x >> 31;
}
size_t operator()(const uint64_t x) const {
static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
return splitmix64(x + FIXED_RANDOM);
}
};
// format.cpp -- format [x, x] to {x, x} for Leetcode test data
#include <iostream>
#include <fstream>
#include <string>
const std::string inFILE = "../in.txt";
const std::string outFILE = "../out.txt";
int main() {
// start
std::cout << "Formatting..." << std::endl;
// open input file
std::cout << "openning input file: \t" << inFILE;
std::ifstream in(inFILE);
if (in.fail()) {
std::cerr << "Error opening input file." << inFILE << std::endl;
exit(EIO);
}
std::cout << "\tSucceeded." << std::endl;
// open output file
std::cout << "opening output file: \t" << outFILE;
std::ofstream out(outFILE);
if (out.fail()) {
std::cerr << "Error opening output file." << outFILE << std::endl;
exit(EIO);
}
std::cout << "\tSucceeded." << std::endl;
std::cout << "\nStarting formatting..." << std::endl;
char c;
while (in.get(c)) {
if (c == '[') out.put('{');
else if (c == ']') out.put('}');
else out.put(c);
}
in.close();
out.close();
std::cout << "Done" << std::endl;
return 0;
}
// Used only for basic types, pair and tuple.
// mp.reserve(1024), mp.max_load_factor(0.75);
template<typename T>
struct custom_hash_base {
size_t operator()(const T& x) const {
static const size_t seed = chrono::steady_clock::now().time_since_epoch().count();
return _Hash_bytes(&x, sizeof(x), seed);
}
};
// https://www.cnblogs.com/Lskkkno1/p/12667149.html
struct custom_hash {
static uint64_t splitmix64(uint64_t x) {
x ^= x << 13;
x ^= x >> 7;
x ^= x << 17;
return x;
}
size_t operator()(const uint64_t x) const {
static uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count(); // 时间戳
return splitmix64(x + FIXED_RANDOM);
}
};
#define _USE_MATH_DEFINES // To use the definition of cmath
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
// mp.reserve(1024), mp.max_load_factor(0.75);
// Used only for basic types, pair and tuple.
template<typename T>
struct custom_hash_base {
size_t operator()(const T& x) const {
static const size_t seed = chrono::steady_clock::now().time_since_epoch().count();
return _Hash_bytes(&x, sizeof(x), seed);
}
};
static const auto _ = []() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
#ifndef ONLINE_JUDGE
freopen("../in.txt", "r", stdin);
freopen("../out.txt", "w", stdout);
#endif
return nullptr;
}();
inline void solve() {
string s;
cin.ignore();
getline(cin, s);
cout << s << endl;
}
int main() {
int T = 1;
cin >> T;
while (T--) {
solve();
}
return 0;
}
#define _USE_MATH_DEFINES // To use the definition of cmath
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/hash_policy.hpp>
using namespace std;
using __gnu_pbds::cc_hash_table; // cc_hash_table是拉链法
using __gnu_pbds::gp_hash_table; // gp_hash_table是查探法
using ll = long long;
using ld = long double;
using ull = unsigned long long;
// mp.reserve(1024), mp.max_load_factor(0.75);
struct custom_hash {
static uint64_t splitmix64(uint64_t x) {
// http://xorshift.di.unimi.it/splitmix64.c
x += 0x9e3779b97f4a7c15;
x = (x ^ x >> 30) * 0xbf58476d1ce4e5b9;
x = (x ^ x >> 27) * 0x94d049bb133111eb;
return x ^ x >> 31;
}
size_t operator()(const uint64_t x) const {
static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
return splitmix64(x + FIXED_RANDOM);
}
};
// Used only for basic types, pair and tuple.
template<typename T>
struct custom_hash_base {
size_t operator()(const T& x) const {
static const size_t seed = chrono::steady_clock::now().time_since_epoch().count();
return _Hash_bytes(&x, sizeof(x), seed);
}
};
static const auto _ = []() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
#ifndef ONLINE_JUDGE
freopen("../in.txt", "r", stdin);
freopen("../out.txt", "w", stdout);
#endif
return nullptr;
}();
inline void solve() {
string s;
cin.ignore(numeric_limits<std::streamsize>::max(), '\n');
getline(cin, s);
cout << s << endl;
}
int main() {
int T;
for (cin >> T; T > 0; --T) {
solve();
}
return 0;
}
static const auto _ = []() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
#ifndef ONLINE_JUDGE
freopen("../in.txt", "r", stdin);
freopen("../out.txt", "w", stdout);
#endif
return nullptr;
}();
#define _USE_MATH_DEFINES // To use the definition of cmath
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment