uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
01f75dbf-af76-43ef-93a5-18491b9e17e4 | Ayuanjanisuharsan/pratikum1 | besar kecil/besar_kecil.cpp | #include<iostream>
using namespace std;
int main(){
int angka1,angka2,besar,kecil;
cout << "masukan angka ke-1: ";
cin >> angka1;
cout << "masukan angka ke-2: ";
cin >> angka2;
besar= angka1 > angka2 ? angka1 : angka2;
kecil= angka1 < angka2 ? angka1 : angka2;
cout << endl;
cout... | ALGO | 0.999567 | 3.637108 |
95f90efd-a3ae-4ec0-94d0-7fb9de153158 | Shrutikatyal/Interview-Preparation | Linked List/Gfg/Delete N nodes after M nodes of a linked list.cpp | // { Driver Code Starts
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
using namespace std;
/* A linked list node */
void linkdelete(struct Node *head, int M, int N);
struct Node
{
int data;
struct Node *next;
Node(int x){
data = x;
next = NULL;
}
};
struct Node *s... | ALGO | 0.999605 | 4.949959 |
ddbfc364-ba7c-4dfa-8d9e-3e898920daac | willzunker/lammps_mdr | lib/atc/WeakEquationPoisson.cpp | #include "WeakEquationPoisson.h"
#include "Material.h"
#include <iostream>
#include <fstream>
namespace ATC {
//==============================================================
// Class WeakEquationPoisson
//==============================================================
// R = B^T flux + N source = 0
// 0 = B^T... | ALGO | 0.958765 | 5.10328 |
e03db907-7a85-4237-8e52-e48ecf857895 | salllman84/AllCodes | C++/DSA Data Structure and Algurithems/Array/subArray/PainterPartitionn.cpp | #include<iostream>
#include<vector>
#include<climits>
using namespace std;
// Function prototypes
bool IsValid(vector<int> &, int, int, int);
int MaxTimeToPaint(vector<int> &, int, int);
int main(){
vector<int> partition = {40, 20, 10, 30};
int TotalPaints = 4;
int painters = 3;
cout << "Max time to ... | ALGO | 0.999896 | 5.907366 |
3e1e85ad-8bab-4c80-8cfb-6908a88bba1f | huyaoyuegroup44num1/project | project5/merkleTree.cpp | #include <iostream>
#include <vector>
#include <string>
#include <chrono>
#include <iomanip>
#include <openssl/sha.h>
using namespace std;
string sha256(const string& str) {
unsigned char hash[SHA256_DIGEST_LENGTH];
SHA256_CTX sha256;
SHA256_Init(&sha256);
SHA256_Update(&sha256, str.c_str(), str.size(... | ALGO | 0.99976 | 6.584184 |
786e05f9-c36a-49f6-94bb-68348ad36d3a | pavittarx/codeforces | C_2_Skibidus_and_Fanum_Tax_hard_version.cpp | // 2065A: Skibidus and Fanum tax (Hard)
// Problem: https://codeforces.com/contest/2065/problem/C2
#include <iostream>
#include <limits>
#include <vector>
using namespace std;
int main() {
int cases;
cin >> cases;
cin.ignore();
while (cases != 0) {
int n, m;
cin >> n >> m;
if (n <= 1) {
co... | ALGO | 0.999942 | 4.180933 |
c71e95f6-47ff-48d9-a40d-3d45650f3695 | ZlataMoore/study_hse_1year | projects/image_processor/Blur.cpp | #include "Blur.h"
#include "iostream"
Blur::Blur(float s) : sigma(s) {}
float coeff(float x0, float y0, float x, float y, float sigma) {
float one = 1 / (sqrt(2 * M_PI * pow(sigma, 2)));
float degree = - (pow((x - x0), 2) + pow((y - y0), 2)) / (2 * pow(sigma, 2));
float result = one * pow(M_E, degree);
... | ALGO | 0.874624 | 5.346143 |
4e6bb0da-e748-44f8-a39b-8c302f325268 | Amrendra29/DSA-with-Cpp | DSA/ds/binary_search_tree/k.cpp | #include<iostream>
using namespace std;
int msum(int m,int ans,int n){
if(m>=n) return 2*ans;
ans+=m;
int k=m+m;
return msum(k,ans,n);
}
int differenceOfSums(int n, int m) {
int sum=(n*(n+1))/2;
int k=msum(m,0,n);
return sum-k;
}
int main(){
... | ALGO | 0.999914 | 4.322159 |
f9b0b8b6-ad01-4063-81c2-4ed7a614ebcc | vineethm1627/CPP | Interview Preparation/22 Graphs/single_source_shortest_path.cpp | /*
Single Source Shortest Path
Note:
For unweighted graph, distance calculation by level order traversal is the shortest distance.
The level of that node will be the shortest distance from the source node.
*/
#include <iostream>
#include <map>
#include <list>
#include <queue>
#include <climits... | ALGO | 0.999866 | 4.877385 |
59cbd260-8c2b-4834-8958-62f63f176272 | Sunny5130/leetCode_practice | 204-count-primes/count-primes.cpp | class Solution {
public:
int countPrimes(int n) {
if (n <= 2) return 0;
vector<bool> isPrime(n, true);
isPrime[0] = isPrime[1] = false;
int count = 0;
for (int i = 2; i < n; i++) {
if (isPrime[i]) {
count++;
for (long long j = (long lon... | ALGO | 0.999969 | 5.77848 |
822277f7-3b3d-441b-9ec4-8704ceead711 | stpatrickcoin/STPatrick | src/script.cpp | using namespace std;
using namespace boost;
#include "script.h"
#include "keystore.h"
#include "bignum.h"
#include "key.h"
#include "main.h"
#include "sync.h"
#include "util.h"
bool CheckSig(vector<unsigned char> vchSig, vector<unsigned char> vchPubKey, CScript scriptCode, const CTransaction& txTo, unsigned int nIn, ... | TOOL | 0.91463 | 6.503615 |
7206c7a2-04e0-4071-a227-03d620b38bb0 | niteshim0/DSA | 12_Binary_Tree/03_Vertical_Traversals/17_Bottom_View_of_Binary_Tree.cpp | class Solution {
public:
vector<int> bottomView(Node *root) {
vector<int> ans;
if(root == NULL) return ans;
queue<pair<Node*,int>> q;
map<int,int> mp;
q.push({root,0});
while(!q.empty()){
Node* node = q.front().first;
int line = q.front().sec... | ALGO | 0.99998 | 6.327603 |
728e0dbe-6653-4e9e-8aa2-4df60b10fedc | Vtuzhilkin/Algorithms | Algorithms/5.J AddNode.cpp | #ifndef REMOTE_JUDGE
struct Node {
int value;
Node* left = nullptr;
Node* right = nullptr;
Node(int value, Node* left, Node* right) : value(value), left(left), right(right) {}
};
#endif
#ifdef REMOTE_JUDGE
#include "solution.h"
#endif
#include <cmath>
#include <iostream>
#include <cassert>
Node* inser... | ALGO | 0.999989 | 5.517325 |
ad5cf7c2-a31c-4d09-85df-de0cd8099e6e | yeochaeeon/24Summer-DataStructure_Study | 0x03_Array/Prac/10808-알파벳_개수_sol.cpp | #include <bits/stdc++.h>
using namespace std;
int freq[26];
int main(void) {
ios::sync_with_stdio(0);
cin.tie(0);
string s;
cin >> s;
for(auto c : s)
freq[c-'a']++;
for(int i = 0; i < 26; i++)
cout << freq[i] << ' ';
} | ALGO | 0.999161 | 4.371891 |
a53786bd-4cb8-4c4d-b361-84580f8bb806 | rohitpmore/placementCodes | sherlockandthebeast.cpp | #include <iostream>
using namespace std;
int main(){
int T;
int a=3,b=5;
int x,y;
long int N;
cin >> T;
while(T--){
cin >> N;
x=y=0;
if(N < 3){
cout << -1 << endl;
continue;
}
x= N/a;
while(x > 0 && ((N-(x*a))%b) != 0){
x--;
}
y = (N - (a*x)) /b;
if((x*a + y*b ) == N){
cou... | ALGO | 0.999869 | 4.632717 |
e78cfac2-2a94-418c-a8e5-2005b4a935a2 | dipesh-m/Data-Structures-and-Algorithms | LeetCode Submissions/Sort Characters By Frequency.cpp | //BUCKET SORT SOLUTION - O(n) time and O(n) space
class Solution {
public:
string frequencySort(string s)
{
unordered_map<char, int> um;
for(auto z:s)
um[z]++;
string ans;
vector<vector<char>> bucket(s.size()+1);
for(auto z:um)
bucket.at(z.second... | ALGO | 0.999995 | 6.062428 |
7d12aaa0-4857-42bf-ac7a-a687a21da8d2 | ishandutta2007/codeforces | al3xstr33t/normal/1428/F.cpp | #include<bits/stdc++.h>
using namespace std;
const int maxN = 500009;
//const int maxN = 50;
int nr, N, l[2 * maxN], prv[2 * maxN], nxt[2 * maxN];
char sir[maxN];
long long ans;
vector < int > v[maxN];
long long segms (int N)
{
return 1LL * N * (N + 1) / 2;
}
long long sumSegms = 0, sumDs = 0, cntDs = 0;
void a... | ALGO | 0.999965 | 3.710524 |
11cf7481-7651-4f17-a353-04442041aa35 | karim-aboelazm/All_CodeForces_CPPTasks_Solutions | 1081A/definite-game.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int ans = (n == 2) ? 2 : 1;
cout << ans << endl;
return 0;
}
| ALGO | 0.999686 | 3.752412 |
10822534-19da-4855-a5a7-62619671bfc7 | sewbacca/Lizard-Old | src/bitboard_constants.cpp |
#include <cmath>
#include "def.h"
#include "bitboard_constants.h"
#include "bitboard.h"
bitboard squares[SQUARE_COUNT][SQUARE_COUNT] {};
bitboard rectangle(Square start, Square end)
{
return squares[start][end];
}
bitboard rank_bb(int rank)
{
const static bitboard ranks[] = {
RANK_1,
RANK_2,
RANK_3,
RANK... | CONFIG | 0.988927 | 6.096174 |
94da7c7e-12c7-4509-a2de-baf856451e80 | toor-de-force/mcsema-seahorn-testing | tests/src/recurse_v2.cpp | #include "test.hpp"
int func(int count) {
if (count==0) {
path_goal();
return 0;
}
return count+func(count-1);
}
int main() {
path_start();
int n = INT_RAND;
int sum = func(n);
if (sum < n) {
path_nongoal();
}
return sum;
}
| ALGO | 0.950873 | 3.867808 |
f05a9a89-5562-43c1-b47c-a7417f77aa6d | chrisdxie/rrtstar_and_trajopt | other_things/My_SST_Impl/point_robot/plot_sst.cpp | #include <iostream>
#include <boost/python.hpp>
#include <boost/python/numeric.hpp>
#include <boost/python/tuple.hpp>
#include <boost/numpy.hpp>
#include <boost/filesystem.hpp>
namespace py = boost::python;
namespace np = boost::numpy;
#include <eigen3/Eigen/Eigen>
using namespace Eigen;
#include <SetupObject.h>
#i... | ALGO | 0.989375 | 5.353849 |
6acd3a05-60f7-4f58-bed8-e00e902c99c1 | yanshui177/HandWritten-Analisys | 测试/单独功能测试/0-DLL测试(实际没有部署)/dll-goal完整版/OpenCV/cvaux/src/cvcorrespond.cpp | #include "_cvaux.h"
#include "_cvvm.h"
#include <stdlib.h>
#include <assert.h>
/*======================================================================================*/
CvStatus
icvDynamicCorrespond( int *first, /* first sequence of runs */
/* s0|w0|s1|w1|...|s(n-1)|w(n-1)|sn */
... | ALGO | 0.999688 | 4.223664 |
fddb3ab2-6c00-4cc2-b2fc-0f8af61d9108 | Chowdhury-DSP/Multiverse-ChowDSP_ChowTape | modules/chowdsp_core/JUCEHelpers/juce_FloatVectorOperations.cpp | #if JUCE_MINGW && ! defined(alloca)
#define alloca __builtin_alloca
#endif
#if JUCE_USE_SSE_INTRINSICS
#include <emmintrin.h>
#endif
#if (JUCE_MAC || JUCE_IOS) && JUCE_USE_VDSP_FRAMEWORK
#include <Accelerate/Accelerate.h>
#else
#undef JUCE_USE_VDSP_FRAMEWORK
#endif
#if JUCE_USE_ARM_NEON
#include <arm_neon.h>
#endif
... | TOOL | 0.946819 | 4.632577 |
5f5a217e-ec94-4228-987d-6770a2a2274c | kunchuntsai/cpp-challenges | src/cpp/stack/daily_temperatures.cpp | /*
* 739. Daily Temperatures (Medium)
* https://leetcode.com/problems/daily-temperatures/
*
* Problem:
* Given an array of integers temperatures represents the daily temperatures, return an array answer such that answer[i] is the number of days you have to wait after the ith day to get a warmer temperature. If the... | ALGO | 0.999872 | 7.415024 |
c5d3814a-8276-4c2f-93ae-22392212f665 | samisrana/Dense-Sparse-Matrix-Matrix-Multiplication | main.cpp | #include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
#include <stdexcept>
#include "matrix/multiplication.h"
#include "matrix/matrix_gen.h"
// Helper to ask for matrix dimensions
void get_matrix_size(int& rows, int& cols) {
std::cout << "Enter the number of rows: ";
std::cin >> rows;
... | TOOL | 0.980897 | 6.128686 |
4d0b1d05-0b0e-4977-8bf2-8f7bab1b4a10 | nvhiii/fw23 | cpp/notes_code/midterm_review/lec4_ch6/forLoopSmallest.cpp | #include <iostream>
int smallest(int, int);
using namespace std;
int main() {
int inputNum, min, count;
cout << "Please enter 10 numbers:" << endl;
cin >> inputNum;
min = inputNum;
for (count = 0; count < 10; count++) {
cin >> inputNum;
min = smallest(min, inputNum);
}
... | ALGO | 0.999215 | 3.937452 |
4dfd3e8f-59e9-40f0-aa5a-be4d9e581825 | zhangmb-git/rocketmq-cpp-client | thirdparty/boost_1_58_0/libs/numeric/ublas/benchmarks/bench3/bench33.cpp | #include "bench3.hpp"
template<class T, int N>
struct bench_c_matrix_prod {
typedef T value_type;
void operator () (int runs) const {
try {
static typename c_matrix_traits<T, N, N>::type m1, m2, m3;
initialize_c_matrix<T, N, N> () (m1);
initialize_c_matrix<T, N, N> ... | ALGO | 0.986124 | 5.382353 |
3844a3ae-072b-47da-a6ef-56077a5e153b | old-yan/leetcode-solutions | leetcode_solutions/weekly_contest/weekly_contest_s222/2.cpp | #include "utils.h"
class Solution {
public:
int countPairs(vector<int>& deliciousness) {
//M用来记录之前出现过的数的出现次数
unordered_map<int,int>M;
ll ans=0;
for(int a:deliciousness){
//sum遍历从1到2^21之间的2的幂
for(int sum=1;sum<=(1<<21);sum<<=1){
if(a<=sum){
... | ALGO | 0.999874 | 4.883893 |
b2d3be68-9512-4b25-ac88-222ebde81d8d | open-airlab/VTNMPC-Autonomous-Wind-Turbine-Inspection | WTI_catkin/NMPC_implementations/nmpc_pc_poseaware_learning/solver/nmpc_qpoases_interface.cpp | extern "C"
{
#include "nmpc_common.h"
}
#include "INCLUDE/QProblemB.hpp"
#if NMPC_COMPUTE_COVARIANCE_MATRIX == 1
#include "INCLUDE/EXTRAS/SolutionAnalysis.hpp"
#endif /* NMPC_COMPUTE_COVARIANCE_MATRIX */
static int nmpc_nWSR;
#if NMPC_COMPUTE_COVARIANCE_MATRIX == 1
static SolutionAnalysis nmpc_sa;
#endif /* NMPC_CO... | ALGO | 0.999754 | 4.797372 |
c0d1c992-b36d-452d-bb75-70fcf2d58787 | ssh352/CppPrimer-Learning | Chapter10/Exercise10.20.cpp | // Exercise10.20.cpp
// Ad
// Use count_if to rewrite the portion of our program that counted how many words are greater than length 6.
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
// -----------------------------------------------------------------------------
int main(int argc, char... | TOOL | 0.974989 | 5.81193 |
0f603648-22ca-466c-9c46-679794ef81b9 | Aniypon/DripC-Algo | алгосы/контест_11/3.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
struct Stop {
int station;
int time;
};
int32_t main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int N, E;
cin >> N >> E;
int M;
cin >> M;
vector<vector<Stop>> routes(M);
for (int i = 0; i < M; i++) {... | ALGO | 0.99995 | 4.974353 |
1ed8e730-2216-4b82-8c8e-b1b93e21820c | TD2106/Competitive-Programming | Hacker Earth/Prateekandtheories.cpp | #include <iostream>
#include <map>
using namespace std;
typedef long long ll;
int main (){
ll tc,n,t1,t2,sum,ans;
map<ll,ll> arr;
cin>>tc;
while(tc--){
sum=ans=0;
arr.clear();
cin>>n;
for(int i=0;i<n;i++){
cin>>t1>>t2;
arr[t1]++;
arr[t2]--;
}
for(map<ll,ll>::iterator itr=arr.begin();itr!=arr.en... | ALGO | 0.9999 | 4.415586 |
2d6f5a22-faca-4a50-8cf1-40aa3f5f1a82 | ludamad-test-org/xmodules-test | barretenberg/cpp/src/barretenberg/crypto/pedersen_commitment/pedersen_lookup.test.cpp | #include <gtest/gtest.h>
#include "barretenberg/numeric/bitop/get_msb.hpp"
#include "barretenberg/numeric/random/engine.hpp"
#include "./pedersen_lookup.hpp"
#include "../pedersen_hash/pedersen_lookup.hpp"
namespace {
auto& engine = numeric::random::get_debug_engine();
}
auto compute_expected(const grumpkin::fq expo... | TEST | 0.858478 | 7.560341 |
1b30010f-03bd-4afc-81db-8061c335f308 | debasish26/CP | 1000rated/errorr.cpp | #include <bits/stdc++.h>
using namespace std;
#define fast_io ios::sync_with_stdio(false); cin.tie(nullptr);
#define nl '\n'
using ll = long long;
using vi = vector<int>;
using pii = pair<int, int>;
const ll mod = 1e9 + 7;
void solve() {
// Your logic here
int n;
cin>>n;
vector<int> a(n);
for(i... | ALGO | 0.999969 | 5.379789 |
6850d50e-17aa-448a-8780-e2ba8c4d324a | AndanteKim/LeetCode_Practice | 3477-fruits-into-baskets-ii/3477-fruits-into-baskets-ii.cpp | class Solution {
public:
int numOfUnplacedFruits(vector<int>& fruits, vector<int>& baskets) {
int n = fruits.size(), ans = n;
for (int i = 0; i < n; ++i){
for (int j = 0; j < n; ++j){
if (fruits[i] <= baskets[j]){
--ans;
baskets[j]... | ALGO | 0.999942 | 5.737108 |
9273bbff-c34b-42f3-8c5d-5635c2251b67 | hazelchain/Hazelchain | src/main.cpp | #include <json.hpp>
#include <thread>
#include "storage/logging/Logger.h"
#include "constants.h"
#include "util/util.h"
#include "node/Server.h"
#ifdef _WIN32
#define mkdir(a, b) mkdir(a) // discard 2nd argument on windows
#endif // _WIN32
void loadSettings();
void sync();
void setupDirectories();
void generateDir... | WEB | 0.88983 | 5.085722 |
280a3d77-1b63-4b70-8e41-e16a878e5752 | Deborah-Digges/SDC-ND-term-2 | P5-Model-Predictive-Control/class-notes/CarND-MPC-Quizzes/mpc_to_line/src/Eigen-3.3/doc/examples/DenseBase_middleRows_int.cpp | #include <Eigen/Core>
#include <iostream>
using namespace Eigen;
using namespace std;
int main(void)
{
int const N = 5;
MatrixXi A(N,N);
A.setRandom();
cout << "A =\n" << A << '\n' << endl;
cout << "A(2..3,:) =\n" << A.middleRows(2,2) << endl;
return 0;
}
| ALGO | 0.874432 | 3.307581 |
3454c9a0-b8ea-4524-a975-adb2b5ec44a8 | Arthur-Henrique-Andrade-Farias/modelo-analise-de-curriculos | venv/lib/python3.10/site-packages/greenlet/PyModule.cpp | #ifndef PY_MODULE_CPP
#define PY_MODULE_CPP
#include "greenlet_internal.hpp"
#include "TGreenletGlobals.cpp"
#include "TMainGreenlet.cpp"
#include "TThreadStateDestroy.cpp"
using greenlet::LockGuard;
using greenlet::ThreadState;
#ifdef __clang__
# pragma clang diagnostic push
# pragma clang diagnostic ignored... | TOOL | 0.854472 | 7.019804 |
4515f31f-a650-4040-a150-39e022b9c4d2 | alexandraback/datacollection | solutions_2645486_0/C++/orbby/b.cpp | //FUCK
#include<stdio.h>
int dp[20][10];
int value[20];
void clear()
{
for(int i=0;i<20;i++)
{
for(int j=0;j<10;j++)
{
dp[i][j]=0;
}
value[i]=0;
}
}
int main()
{
freopen("b.in","r",stdin);
freopen("b.out","w",stdout);
int t,e,r,n;
scanf("%d",&t);
for(int tt=0;tt<t;tt++)
{
clear();
scanf("%... | ALGO | 0.999871 | 3.580193 |
c81afe81-21c3-4602-aa5a-e8e33cc67fd2 | WilderStill/C-Programs | 洛谷/主题库/P2286 [HNOI2004] 宠物收养场.cpp | #include<bits/stdc++.h>
using namespace std;
inline int read()
{
int x=0,f=1;
char ch=getchar();
while(!isdigit(ch))
{
if(ch=='-')f=-1;
ch=getchar();
}
while(isdigit(ch))
{
x=(x<<1)+(x<<3)+(ch^48);
ch=getchar();
}
return x*f;
}
inline void write(int x)
{
... | ALGO | 0.999588 | 3.680029 |
f338040d-7c89-4165-9390-3352c3c9834a | ghassanelgendy/competitive-programming-solutions | CodeForces/vjudge/1353B/41728445_AC_46ms_4kB.cpp | #include <iostream>
#include <algorithm>
using namespace std;
int main() {
int t;
cin >> t;
while (t--) {
int n, k;
cin >> n >> k;
int a[n], b[n];
for (int i = 0; i < n; i++) {
cin >> a[i];
}
for (int i = 0; i < n; i++) {
cin >> b[i];
... | ALGO | 0.99999 | 3.629005 |
beb785ab-0cd5-4b07-aa08-de26f0626e39 | Abhivic000/CF | A_Team.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
int cnt = 0;
while (n--){
int a,b,c;
cin>>a>>b>>c;
if((a==1 && b==1) || (b==1 && c==1) || (c==1 && a==1)){
cnt += 1;
}
}
cout<<cnt;
return 0;
} | ALGO | 0.999496 | 4.330441 |
9c05e4ae-2b53-4572-976f-0d7b5a375cf0 | SlashCoreProject/slash | src/wallet/rpcdump.cpp | #include "base58.h"
#include "chain.h"
#include "rpc/server.h"
#include "init.h"
#include "validation.h"
#include "script/script.h"
#include "script/standard.h"
#include "sync.h"
#include "util.h"
#include "utiltime.h"
#include "wallet.h"
#include <fstream>
#include <stdint.h>
#include <boost/algorithm/string.hpp>
#i... | WEB | 0.954586 | 5.71653 |
c1991c47-2397-4615-adcf-f8d1d0aaab2d | EnigmaZhang/MyHomeworkOfCppPrimer | 12.6.cpp | #include <iostream>
#include <vector>
#include <algorithm>
std::vector<int>* getVector();
std::vector<int>* fillVector(std::vector<int>& v);
std::vector<int>* printVector(std::vector<int>& v);
int main()
{
auto p{ getVector()};
p = fillVector(*p);
p = printVector(*p);
delete p;
p = nullptr;
return 0;
}
std::... | ALGO | 0.98914 | 4.987201 |
c2b81e59-0cba-4e8c-ae81-7b9cdd6cad06 | sanyamsinghai/DSA-practice | Difficulty: Easy/Minimum Number in a sorted rotated array/minimum-number-in-a-sorted-rotated-array.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution
{
public:
//Function to find the minimum element in sorted and rotated array.
int minNumber(int nums[], int low, int high)
{
// Your code here;
int mini=INT_MAX;
while(low<... | ALGO | 0.999971 | 6.313965 |
3c3a06e2-7407-448c-838b-31e8da80b53e | mkleesiek/google-codejam | 2020/Round1B/A-test.cpp | #include "testing.h"
#include "utilities.h"
#include "A.cpp"
using namespace std;
TEST( Round_2020_1B_A, MSB ){
ASSERT_EQ(msb(1), 0);
ASSERT_EQ(msb(-1), 0);
ASSERT_EQ(msb(2), 1);
ASSERT_EQ(msb(3), 1);
ASSERT_EQ(msb(8), 3);
ASSERT_EQ(msb(-8), 3);
}
TEST( Round_2020_1B_A, Basic ){
string r{};
r = {};
solve(... | ALGO | 0.999862 | 5.056847 |
37cf9a48-754c-4c61-b98f-6b3943796907 | jamesmtuck/ncstate_ece566_spring2024 | examples/review/review.cpp | #include <iostream>
#include <list>
using namespace std;
// make a struct for an instruction
struct instruction {
string opcode; // operation
string dest; // dest register
string src1; // source register 1
string src2; // source register 2
instruction(string op, string d, string s1, string s2)
:... | TOOL | 0.963499 | 4.795532 |
20c10d87-0fc1-4b7f-975c-8d9e6ea99e34 | Kshitij83/leetcode-solutions | 0019-remove-nth-node-from-end-of-list/0019-remove-nth-node-from-end-of-list.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
ListNode* removeNthFr... | ALGO | 0.999964 | 5.951237 |
84693a28-a7d0-4c7b-91ef-b8ff808ad87f | HKUST-Aerial-Robotics/LiDAR2BIM-Registration | Thirdparty/nanoflann/examples/pointcloud_example.cpp | #include <cstdlib>
#include <ctime>
#include <iostream>
#include <nanoflann.hpp>
#include <type_traits>
#include "utils.h"
template <typename num_t>
void kdtree_demo(const size_t N)
{
static_assert(
std::is_standard_layout<nanoflann::ResultItem<num_t, size_t>>::value,
"Unexpected memory layout for... | ALGO | 0.985421 | 7.535679 |
f2f16a70-ee80-427c-9aa1-1b2a3c54801a | UpsideDownRide/cppWne | huffmanNode.cpp | // Klasa HuffmanNode reprezentuje węzeł drzewa Huffmana.
#include "huffmanNode.h"
// Konstruktor klasy HuffmanNode przyjmujący znak i częstość występowania.
HuffmanNode::HuffmanNode(char character, size_t frequency) :
HuffmanNode(character, frequency, nullptr, nullptr) {}
// Przeciążony konstruktor klasy Huffman... | ALGO | 0.973344 | 4.644698 |
1475b463-b4c0-42e8-b950-549a85f26d62 | GuacheSuede/MSSubmission1234567890 | submission/rsi/boost_1_69_0/libs/msm/doc/PDF/examples/SimpleWithFunctors.cpp | #include <vector>
#include <iostream>
// back-end
#include <boost/msm/back/state_machine.hpp>
//front-end
#include <boost/msm/front/state_machine_def.hpp>
// functors
#include <boost/msm/front/functor_row.hpp>
#include <boost/msm/front/euml/common.hpp>
// for And_ operator
#include <boost/msm/front/euml/operator.hpp>
... | TOOL | 0.860453 | 6.584952 |
5f3b7cdd-af9f-467e-af12-877ff6008d5b | sistemaseltigre/flutter-nft-onchain-qn | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998784 | 6.761023 |
c981ac3c-ace1-4bb8-940b-886e7e69ddc4 | yasith/Problems | codejam/2012/1a/b/b.cpp | #include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cst... | ALGO | 0.999944 | 4.308187 |
6becb714-5d8c-458a-adcf-87ba45d00c00 | SrUnicornio/Primero-Ingenieria-Informatica | AyED/Ayed Practicas/Practica 1/rational_t.cpp | // AUTOR:
// FECHA: 14/02/2023
// EMAIL:
// VERSION: 1.0
// ASIGNATURA: Algoritmos y Estructuras de Datos
// PRÁCTICA Nº: 1
// COMENTARIOS: se indican entre [] las pautas de estilo aplicadas de
// "C++ Programming Style Guidelines"
// https://geosoft.no/development/cppstyle.html
// pauta de... | TOOL | 0.876358 | 4.64135 |
d2fdf320-3eaa-4571-b1b6-4b8ce1dec676 | 3bdo-Yahya/AtCoder-Solutions | B_Play_Snuke.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> v;
bool flag = false;
for (int i = 0; i < n; i++) {
int a, p, x;
cin >> a >> p >> x;
if(x - a > 0) { v.push_back(p); flag = true; }
}
if(fla... | ALGO | 0.999901 | 3.845429 |
e2989885-c646-4790-99ea-8fd5344f4e29 | tanaychaturvedi/-6Companies30days | Milestone 6 - Walmart/maximum height tree.cpp | int height(int N){
return (-1 + sqrt(1 + 8*N)) / 2;
} | ALGO | 0.999853 | 3.560288 |
331f7761-c568-4aa2-b285-2a1683a75e15 | SaiKrishna1207/DSA-Practice | Week-2/Day-10/cow.cpp | #include<bits/stdc++.h>
using namespace std;
int count1 = 0, count2 = 0, co = 0;
//1 1 1 1 0
//1 1 2 2
//4 4
int dfs(int* eaten, int* completed, vector<pair<int,int>> & flavours, int n)
{
int i, a, b, j, min = INT_MAX, flag = 0;
if(count1 == flavours.size())
{
for(i = 0;i < flavours.size(); i++... | ALGO | 0.999931 | 3.982131 |
ccc87b97-3d1b-40f6-9026-d13ef2732f0b | Pushpraj0812/C | C++ Programs/New/Continue algo.cpp | #include<iostream>
using namespace std;
int main() {
for(int i=1; i<100;i++){
if(i%2==0){
continue;
}
cout<<i<<endl;
}
}
| ALGO | 0.994035 | 3.255664 |
e4b2120c-fdad-4b43-9c15-a5c7edc21e48 | modriplanetdoo/osi_clp | Clp/examples/minimum.cpp | /* $Id$ */
#include "ClpSimplex.hpp"
int main(int argc, const char *argv[])
{
ClpSimplex model;
int status;
if (argc < 2) {
#if defined(SAMPLEDIR)
/*
SAMPLEDIR should "path/to/Data/Sample"
Include the quotes and final path separator.
*/
status = model.readMps(SAMPLEDIR "/p0033.mps", true)... | ALGO | 0.910335 | 4.787535 |
5c637c75-e095-439d-9cac-277653e8afbf | krishna4040/DSA | gfg_practice/searching/max_water.cpp | /*Given an integer array representing the heights of N buildings, the task is to delete N-2 buildings such that the water that can be trapped
between the remaining two building is maximum.
Note: The total water trapped between two buildings is gap between them (number of buildings removed) multiplied by height of the s... | ALGO | 0.999867 | 4.806014 |
2e899796-b8eb-4a2c-b55a-0bfbb95c15ea | yaofanghao/cpp | C++_Primer/ch11/ex11_12_13.cpp | //
// ex11_12_13.cpp
// Exercise 11.12 11.13
//
// Created by pezy on 12/15/14.
//
// Write a program to read a sequence of strings and ints,
// storing each into a pair. Store the pairs in a vector.
//
// There are at least three ways to create the pairs in the program for the previous exercise.
// Write three ... | TOOL | 0.927733 | 5.614144 |
43d09ffb-c2e1-41b2-9c27-fc11beb15051 | Jubair-Ahmed-Junjun/C | ReverseString#cpp#1/ReverseString#cpp#1.cpp | /*
Summary: Reverses a given string
*/
#include<iostream>
#include<conio.h>
#include<stdio.h>
using namespace std;
int main( )
{
clrscr();
char str[80];
int temp, l;
cout<<"Enter string :";
scanf("%79s",str);
for(l=0;str[l]!='\0';l++); //finding length of string
for(int i=0,j=l-1;i<l/2;i++,j--)
{
tem... | ALGO | 0.997769 | 3.821595 |
a90629e4-7211-4b3f-a054-d03e3c0246fd | RevaKaushal/cpp-codes | tut4.cpp | //MANUPILATORS IN C++ [ SETW()]
#include<iostream>
#include<iomanip>
using namespace std;
int main(){
int a=3, b=45, c=1234;
cout<<"value without setw is "<<a<<endl;
cout<<"value without setw is "<<b<<endl;
cout<<"value without setw is "<<c<<endl;
cout<<"value of a"<<setw(5)<<a<<endl;
cout<<"v... | TOOL | 0.885413 | 3.573968 |
a79beea5-af4e-481e-aa11-a62ff5e0c14c | ishandutta2007/codeforces | skydec/normal/399/B.cpp | #include<cstring>
#include<cstdlib>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<map>
#include<vector>
#define pb push_back
#define rep(i,j,k) for(int i=(j);i<=(int)k;i++)
#define per(i,j,k) for(int i=(j);i>=(int)k;i--)
#define lowbit(x) ((x)&(-(x)))
#define fi first
#define se second
#define pii pair<... | ALGO | 0.999879 | 3.255577 |
43aa8917-eb60-48ee-a28f-1554ae5b48df | bitslab/CompilerInterrupts | benchmarks/accuracy_and_overhead/parsec-benchmark/pkgs/libs/tbblib/src/examples/parallel_do/parallel_preorder/parallel_preorder.cpp | /* Example program that shows how to use parallel_do to do parallel preorder
traversal of a directed acyclic graph. */
#include "tbb/parallel_do.h"
#include "tbb/atomic.h"
#include <vector>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include "Graph.h"
using namespace std;
//! Number of trials. Can... | ALGO | 0.999154 | 6.43404 |
6b67f2c8-1fd3-475d-9627-35f01cb0bed2 | elkcl/tinkoff | lesson13-segtree/A13.cpp | #pragma GCC optimize("O3")
#include <iostream>
#include <vector>
#include <random>
#include <cmath>
#include <algorithm>
#include <functional>
#include <string>
using namespace std;
using ll = long long;
using ii = pair<int, int>;
using vi = vector<int>;
using vii = vector<ii>;
using vvi = vector<vi>;
using vc = vect... | ALGO | 0.999703 | 5.522833 |
a0f1eac1-f958-490f-b483-fcf1de1e7779 | theatapro/Atcoder | Practice/Algo_method/tree_all/algo1012.cpp | #include <bits/stdc++.h>
#define rep(i, l, r) for(int i = (l); i < (r); i++)
typedef long long ll;
using namespace std;
using T = tuple<int,int,int>;
// Union-Find
struct UnionFind {
vector<int> par, rank, siz;
// 構造体の初期化
UnionFind(int n) : par(n,-1), rank(n,0), siz(n,1) { }
// 根を求める
int root(in... | ALGO | 0.999915 | 4.083388 |
aa442a29-d90b-49b7-afc6-7d0e66283aef | Anupam-USP/Data-structures | Trees/BST1.cpp | #include <iostream>
using namespace std;
class Node{
public:
Node* lchild;
int data;
Node* rchild;
};
class BST{
private:
Node* root;
public:
BST(){ root = nullptr; }
Node* getRoot(){ return root; }
void iInsert(int key);
void Inorder(Node* p);
Node* iSearch(int key);
Node* r... | ALGO | 0.999966 | 4.841308 |
55f19629-a98a-4b43-a4da-ee5ec188b39b | Aryanvaniya007/practice | 67-add-binary/add-binary.cpp | class Solution {
public:
string addBinary(string a, string b) {
int i = a.size() - 1, j = b.size() - 1;
int carry = 0;
string result;
result.reserve(max(a.size(), b.size()) + 1); // Reserve space to improve performance
while (i >= 0 || j >= 0 || carry) {
if (i >=... | ALGO | 0.999972 | 7.030337 |
088d90c7-ca54-4df8-b906-3cf2bb84448a | InclinedScorpio/coding_ultimate_series | Top100/medium/linkedlist/reverse_linked_list.cpp | // https://leetcode.com/problems/reverse-linked-list/description
/**
* NOTE: Just 3 pointers game.
*
*/
class Solution {
public:
ListNode* reverseList(ListNode* head) {
if(!head) return NULL;
ListNode* l = NULL;
ListNode* r = head;
while(r) {
ListNode* n = r->next... | ALGO | 0.999813 | 5.543467 |
c2d78fb3-c8a1-4c8e-9d09-078d02f97ea8 | Mayank-MP05/CPP-Codes-Contests | Sorting/count-inversion-merge-sort.cpp | #include <bits/stdc++.h>
using namespace std;
void print(int arr[],int n){
for(int i = 0 ; i < n ; i++ ){
cout<<arr[i]<<" ";
}
cout<<endl;
}
void merge(int arr[],int l , int m ,int r,int count = 0){
int n1 = m - l + 1;
int n2 = r - m;
// Create temp arrays
int L[n1], R[n2];
// Copy data to t... | ALGO | 0.999961 | 5.06981 |
4ccb1056-7ba3-4939-9f3e-00d8c767df9e | Meh494/Coding-solutions | Sorting.cpp | //Thoughts: Just a really simple read input, sort, output program. Just remember the sorting algo for vectors/arrays.
//Meh494
#include <bits/stdc++.h>
using namespace std;
int main() {
cin.sync_with_stdio(0);
cin.tie(0);
int x,n;
cin>>n;
vector <int> arr;
for(int i = 0; i<n; i++){
... | ALGO | 0.999953 | 4.927742 |
7c1ccf3d-86b8-465b-b497-fcfa9d88ea52 | iamvinayvk/LeetCode | 1929-concatenation-of-array/1929-concatenation-of-array.cpp | class Solution {
public:
vector<int> getConcatenation(vector<int>& nums) {
vector<int> ans(2*nums.size());
for(int i=0;i<nums.size();i++)
{
ans[i]=ans[i+nums.size()]=nums[i];
}
return ans;
}
}; | ALGO | 0.998545 | 5.076248 |
e48470fc-bf78-4e72-b56b-d1a833d1ff8b | m1234d/build18 | slam/dependencies/eigen/bench/perf_monitoring/lazy_gemm.cpp | #include <iostream>
#include <fstream>
#include <vector>
#include <Eigen/Core>
#include "../../BenchTimer.h"
using namespace Eigen;
#ifndef SCALAR
#error SCALAR must be defined
#endif
typedef SCALAR Scalar;
template<typename MatA, typename MatB, typename MatC>
EIGEN_DONT_INLINE
void lazy_gemm(const MatA &A, const Ma... | TOOL | 0.970733 | 6.077229 |
dfecbb30-75c9-4535-8d69-aa819bd9b999 | Sabrina1528/OS-Labs | lab 12 (optimal).cpp | #include <stdio.h>
int main() {
int no_of_frames, no_of_pages;
int frames[10], pages[30], temp[10];
int flag1, flag2, flag3;
int i, j, k, pos, max, faults = 0;
printf("Enter number of frames: ");
scanf("%d", &no_of_frames);
printf("Enter number of pages: ");
scanf("%d", &no_of_pages);... | ALGO | 0.9996 | 5.41032 |
3a749457-6453-4c1e-9f25-7f61d434290d | ChenYangZuo/cpp_workspace | LeetCode/133.cpp | //
// Created by zuo-c on 2024/4/16.
//
#include <iostream>
#include <vector>
#include <unordered_map>
using namespace std;
class Node {
public:
int val;
vector<Node*> neighbors;
Node() {
val = 0;
neighbors = vector<Node*>();
}
Node(int _val) {
val = _val;
neighbors... | ALGO | 0.999483 | 5.931491 |
856c432d-c582-454e-abe9-3a194cfb54ab | ashishlakhani04/_CpToDo | DP/33_Frog2/example.cpp | // Solved
// Link: https://atcoder.jp/contests/dp/tasks/dp_b
#include <iostream>
#include <climits>
#include <set>
#include <vector>
#include <stdio.h>
#include <map>
#include <stack>
#include <algorithm>
#include <unordered_map>
#define ll long long int
#define fastio ios_base::sync_with_stdio(false)
#define fastcin c... | ALGO | 0.999982 | 4.089012 |
072930b2-f92a-4f98-a870-3cefa2b68945 | openjdk/jdk16u | src/hotspot/share/opto/reg_split.cpp | #include "precompiled.hpp"
#include "libadt/vectset.hpp"
#include "memory/allocation.inline.hpp"
#include "memory/resourceArea.inline.hpp"
#include "opto/addnode.hpp"
#include "opto/c2compiler.hpp"
#include "opto/callnode.hpp"
#include "opto/cfgnode.hpp"
#include "opto/chaitin.hpp"
#include "opto/loopnode.hpp"
#include... | ALGO | 0.994048 | 6.241786 |
b411bb7e-deec-49db-a1c1-1622be328c40 | KomiMoe/Arkari | clang-tools-extra/clang-tidy/readability/ContainerContainsCheck.cpp | #include "ContainerContainsCheck.h"
#include "clang/AST/ASTContext.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
using namespace clang::ast_matchers;
namespace clang::tidy::readability {
void ContainerContainsCheck::registerMatchers(MatchFinder *Finder) {
const auto HasContainsMatchingParamType = hasMethod(
... | TOOL | 0.866151 | 7.823418 |
2ae8e326-04a8-4955-bec0-bf260e0539be | nirvanafan205/leetcode | c++/max_product.cpp | /*
The product difference between two pairs (a, b) and (c, d) is defined as (a * b) - (c * d).
Given an integer array nums, choose four distinct indices w, x, y, and z
such that the product difference between pairs (nums[w], nums[x]) and (nums[y], nums[z]) is maximized.
*/
#include <iostream>
#include <algorithm>
#inc... | ALGO | 0.999802 | 5.191466 |
8128eea5-44d6-404f-8ea8-3cb718e98ef8 | rahulcode751/Leetcode-problems | leetcode_1984_.cpp | class Solution {
public:
int minimumDifference(vector<int>& nums, int k) {
sort(nums.begin(),nums.end());
--k;
int mindiff=100000;
for(int i=0; i<nums.size()-k; ++i)
mindiff=min(mindiff,nums[i+k]-nums[i]);
return mindiff;
}
};
| ALGO | 0.999975 | 5.221458 |
f8c2811e-9587-4f49-a3e8-77ffa28e5647 | HustDsy/LeetCode | 89. 格雷编码/89. 格雷编码/main.cpp | //
// main.cpp
// 89. 格雷编码
//
// Created by 董深育 on 2020/10/3.
//
#include <iostream>
#include<vector>
using namespace std;
class Solution {
public:
vector<int>ret;
int size;
bool dfs(int n,int cur,vector<int>&flag){
if(ret.size()==size){
return true;
}
for(int i=0;i... | ALGO | 0.999673 | 5.384829 |
0c68e9af-5565-4f3e-b42c-4f440e7f5bc4 | Agoli01/Competitive-Programming-solutions | c++/get sum A by adding number greater S.cpp | #include<bits/stdc++.h>
using namespace std;
long long mod=1e9+9;
long long solve(int a,int g){
long long ag[a+1]={0};
ag[0] = 1;
for(int i=g;i<=a;i++){
for(int j=i;j<=a;j++)
ag[j] = (ag[j] + ag[j-i])%mod;
}
return ag[a];
}
int main(){
int t ; cin>>t;
while(t--){
... | ALGO | 0.999858 | 4.698779 |
b4a9caea-9159-414f-a8ac-710deb9cfd3d | iitp-rakesh/codeforce | 1780b.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
int t;
cin >> t;
while (t--)
{
int n;
cin>>n;
int a[n];
int sum=0;
for(int i=0; i<n; i++){
cin>>a[i];
sum+=a[i];
}
cout<<sum;
... | ALGO | 0.999494 | 3.931997 |
efaa6b0e-98e6-4641-a348-28b45bdc15c4 | Pavan-B-N/DSA-with-C_plus_plus | StriverAtoZ/Arrays/MaximumSubArray_KadanesAlgo.cpp | // https://leetcode.com/problems/maximum-subarray/
#include <vector>
using namespace std;
class Solution
{
public:
int maxSubArray(vector<int> &nums)
{
// kadane's Algorithm
int maxSum = INT_MIN;
int currSum = 0;
for (int i = 0; i < nums.size(); i++)
{
currSu... | ALGO | 0.999651 | 6.591372 |
600eb61c-fe56-4978-bc45-4b3b98cc1b60 | suhas25/LC-Solutions | Stack/1249. Minimum Remove to Make Valid Parentheses.cpp | //
// Created by Suhas Reddy on 3/2/25.
//
/*
- 1. we need to keep track of closing parenthesis which appears unbalanced. ie (when count of '(' becomes more than count of ')' at any given time). we remove them
- 2. with help of open count ( we get all the open parenthesis count). Balance refers to number of unbalanced... | ALGO | 0.999281 | 6.636412 |
8e02ebe8-d3db-4a43-949f-2ff8fd5bc42b | Anildudy/cracking_the_coding_interview_book_solutions | moderate/24_pair_with_sum.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int n,k;
cin>>n>>k;
vector<int> v(n);
for(int i=0; i<n; i++)
cin>>v[i];
map<int,int>mp;
vector<pair<int,int>>res;
for(int i=0; i<n; i++){
if(mp[v[i]]>0){
res.push_back(make_pair(v[i],k-v[i]));
m... | ALGO | 0.999983 | 3.177012 |
0b15d38b-dee9-4e31-ad69-97c843818fe2 | NguyenTichDuy/DoAn | HumanAndDemon/cocos2d/cocos/math/MathUtil.cpp | #include "math/MathUtil.h"
#include "base/ccMacros.h"
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
#include <cpu-features.h>
#endif
//#define USE_NEON32 : neon 32 code will be used
//#define USE_NEON64 : neon 64 code will be used
//#define INCLUDE_NEON32 : neon 32 code included
//#define INCLUDE_N... | TOOL | 0.961745 | 6.360316 |
1199bd71-47af-4795-a0bd-49379bf91b22 | VishalJx/100-Days-of-Code | Day 21/CalculatePower.cpp | #include <bits/stdc++.h>
using namespace std;
int power(int base, int index){
if(index==0)
return 1;
if(index==1)
return base;
return base*power(base, index-1);
}
int main() {
int base, index;
base = 3;
index = 11;
cout<<power(base, index);
return 0;
} | ALGO | 0.999983 | 4.805438 |
cc133e8e-e3b9-40c6-b9ca-b582d598b60c | boomzero/XMOJ | 6000-6999/6095.cpp | #include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <unordered_map>
using namespace std;
typedef unsigned long long ull;
const int maxtot = 20005;
const int maxm = 4e6+5;
const int base = 131;
const int mod = 19260817;
string S[maxtot], T[maxtot];
int totalT, totalS, n, m;
int mid;
ul... | ALGO | 0.999891 | 4.573831 |
30357a20-4d93-4c8c-8f07-b38cf3f4c6f3 | gdemon/leetcode | algorithm/cpp/intersection_of_two_arrays_ii/intersection_of_two_arrays_ii.cpp | // Source :
// Author : Edgar Wu
// Date : 01/11/2021
// Rewrite by myself, but refer from https://github.com/haoel/leetcode
/**********************************************************************************
*
Given two arrays, write a function to compute their intersection.
Example 1:
Input: nums1 = [1,2,2,1]... | ALGO | 0.999762 | 5.666317 |
c879f6c1-beae-4297-bf8c-c37a363efaea | Kailash0529/DSA-Practice | main/leetcode/767ReorganizeString.cpp | class node{
public:
char data;
int count;
node(char d,int c)
{
data=d;
count=c;
}
};
class compare{
public:
bool operator()(node* a,node*b)
{
return a->count<b->count;
}
};
class Solution {
public:
string reorganizeString(string s) {
priority_queue<node*,vector<node*>,compare... | ALGO | 0.999999 | 5.73851 |
32cc9666-a76c-4b14-98a8-dca67c9a1b1b | ThisIsGagan19/daily_code_challenge | leetcode/2024_3_march/c++/30_subarrays_with_k_different_integers.cpp | // INTUITION
// Standard Sliding Window Problem
// CODE
class Solution {
public:
int solve(vector<int>& nums, int k) {
int n = nums.size(), res = 0;
int start = 0, end = 0;
unordered_map<int, int> count;
while(end < n) {
count[nums[end]]++;
while(count.... | ALGO | 0.999978 | 6.22315 |
c7149409-f1ed-47c2-89d0-3e65bfd89415 | lucelujiaming/mySoxTest | RaytraceGroundUp/Chapter27.8/Chapter27.8/MeshTriangle.cpp | // the copy constructor and assignment operator do not clone the mesh
#include "stdafx.h"
#include "Constants.h"
#include "MeshTriangle.h"
#include "Maths.h"
// ---------------------------------------------------------------- default constructor
MeshTriangle::MeshTriangle(void)
: GeometricObject(),
... | ALGO | 0.975923 | 6.071376 |
04e34db0-2f74-4d22-8af8-1649fa5bad38 | benjaminhuanghuang/ben-leetcode | 0231_Power_of_Two/solution.cpp | /*
231. Power of Two
Level: Easy
https://leetcode.com/problems/power-of-two
- 326. Power of Three # n % 3
- 342. Power of Four
*/
#include <vector>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include "common/ListNode.h"
#include "common/TreeNode.h"
using namespac... | ALGO | 0.996084 | 6.577354 |
1fadbe1d-4198-4c8c-a5d5-6fba1422ac19 | sakibul-shovon/cpp-practice | Topic Wise/Recursion/number.cpp | #include <bits/stdc++.h>
using namespace std;
void print(int n){
//base case
if(n==0){
return ;
}
print(n-1);
cout<<n<<endl;
}
int main(){
int n;
cin>>n;
print(n);
return 0;
}
| ALGO | 0.999923 | 4.621802 |
d47435a1-4c33-4c62-b343-62baefd4f6e3 | Xudong0722/Algorithm_template | LeetCode/LeetCode周赛/第221场周赛/b.cpp | typedef pair<int,int> PII;
class Solution {
public:
priority_queue<PII,vector<PII>,greater<PII> >h;
int eatenApples(vector<int>& app, vector<int>& d) {
int ans = 0;
int n = app.size();
for(int i = 0;i<=40000; i++){
if(i<n && app[i]){
h.push({... | ALGO | 0.999943 | 4.646469 |
f4d3ae94-46ff-4911-b79b-2e1f162c6c84 | BlueSu007/Luogu-codes | P1057 传球游戏.cpp | #include <iostream>
using namespace std;
int dp[101][101];
int main(){
int n,m;
cin>>n>>m;
dp[0][0]=1;
for(int j=1;j<=m;j++){
for(int i=0;i<n;i++){
dp[i][j]=dp[(i-1+n)%n][j-1]+dp[(i+1)%n][j-1];
}
}
cout<<dp[0][m]<<endl;
return 0;
}
| ALGO | 0.999967 | 3.708022 |
a4514bd9-4bc0-4d55-b102-1cb463cc3e02 | sef-computin/cpp-labs | 1 Семестр/lab11/lab11.cpp |
#include <iostream>
#include "math.h"
#include "conio.h"
using namespace std;
double func(double x)
{
double f = 2 * pow(x, 4) - (12 * pow(x, 3)) - (4 * pow(x, 2)) + 2;
return f;
}
int main()
{
double Xn[20];
int n = 0;
for (n = 0; n < 20; n += 1) {Xn[n] = -1.0+(0.1*n); }
double x = Xn[n];
double min = fu... | ALGO | 0.999978 | 3.612974 |
a3c3bdf7-44ab-4ebc-8e14-bd0c0683f151 | SpencerL-Y/SELO | regression/esbmc-cpp/algorithm/algorithm81/main.cpp | // transform algorithm example
#include <iostream>
#include <algorithm>
#include <vector>
#include <cassert>
using namespace std;
int op_increase (int i) { return ++i; }
int op_sum (int i, int j) { return i+j; }
int main () {
vector<int> first;
vector<int> second;
vector<int>::iterator it;
// set some values... | ALGO | 0.999061 | 4.346366 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.