uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
73e2082a-db4b-4b32-9c1d-9cbe33074694 | P0L3NARUBA/roblox-2016-source-code | Contribs/boost_1_56_0/libs/graph_parallel/test/distributed_queue_test.cpp | // Authors: Douglas Gregor
// Andrew Lumsdaine
#include <boost/graph/use_mpi.hpp>
#include <boost/config.hpp>
#include <boost/throw_exception.hpp>
#include <boost/graph/distributed/queue.hpp>
#include <boost/test/minimal.hpp>
#include <boost/graph/distributed/mpi_process_group.hpp>
#include <boost/pending/qu... | TEST | 0.97519 | 5.441686 |
91c4d5a2-68fb-42a9-a3d0-97eaba5ab60c | itlezy/eMule-mods-archive | eMule-0.50a-MorphXT_v12.3_src_and_libs/cryptopp/rc6.cpp | // rc6.cpp - written and placed in the public domain by Sean Woods
// based on Wei Dai's RC5 code.
#include "pch.h"
#include "rc6.h"
#include "misc.h"
NAMESPACE_BEGIN(CryptoPP)
void RC6::Base::UncheckedSetKey(const byte *k, unsigned int keylen, const NameValuePairs ¶ms)
{
AssertValidKeyLength(keylen);
r = Get... | ALGO | 0.989342 | 7.341525 |
16fa961e-997b-436f-8641-bb2db3c89d5a | andreaswanninger/Kratos_conservative_levelset-contact_line | applications/PfemSolidMechanicsApplication/custom_constitutive/custom_yield_criteria/cam_clay_yield_criterion.cpp | //
// Project Name: KratosPfemSolidMechanicsApplication $
// Created by: $Author: LMonforte $
// Last modified by: $Co-Author: $
// Date: $Date: July 2015 $
// Revision: $Revision: 0.0... | ALGO | 0.98216 | 5.885318 |
812ace1f-e6a4-4ff8-a758-990197292b9c | kc356/ray-tracer | ray-tracer/metal.cpp | #include "metal.h"
bool metal::scatter(const ray& r_in, const hit_record& rec, color& attenuation, ray& scattered) const
{
vec3 reflected = reflect(unit_vector(r_in.direction()), rec.normal);
scattered = ray(rec.p, reflected + fuzz * random_in_unit_sphere());
attenuation = albedo;
return (dot(scattered... | ALGO | 0.940429 | 4.835322 |
f59fbb2b-f069-404d-a99f-d834d2eb0933 | alohaeee/UniversityTasks | Computer-Workshop/Lab4-MakeFile/Lab1-GCC_FLAGS/2/source/funArray.cpp | #include "funArray.h"
#include <malloc.h>
int countSum(int* arr, int N)
{
int sum = 0;
for(int i = 0; i < N; i++)
{
sum += arr[i];
}
return sum;
}
int deleteFirstNegative(int* arr, int& N)
{
for(int i = 0 ; i < N; i++)
{
if(arr[i] < 0)
{
int re = arr[i];... | ALGO | 0.999124 | 3.853064 |
7132dad5-9773-4b30-880a-5a15a4a1ba9f | VixenLights/Vixen | src/Vixen.Modules/Analysis/QMLibrary/QMFiles/dsp/onsets/DetectionFunction.cpp | /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
#include "DetectionFunction.h"
#include <cstring>
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
DetectionFunction:... | ALGO | 0.98344 | 6.172834 |
e13c83bd-84d8-4cd9-b430-ccecf0ce4864 | xuqianmamba/Tribase | third_party/faiss/faiss/impl/ProductAdditiveQuantizer.cpp | #include <faiss/impl/ProductAdditiveQuantizer.h>
#include <cstddef>
#include <cstdio>
#include <cstring>
#include <memory>
#include <random>
#include <algorithm>
#include <faiss/clone_index.h>
#include <faiss/impl/AuxIndexStructures.h>
#include <faiss/impl/FaissAssert.h>
#include <faiss/utils/distances.h>
#include <... | ALGO | 0.99699 | 6.592031 |
b03ebde0-784f-4f7d-8209-dc3aace89a30 | eungi-aiza/BasicAlgorithm | jihoon/Coding_test (1)/Algorithms/Sorting_alg/mergesort/mergesort.cpp | #include <iostream>
#include <vector>
using namespace std;
vector<int> slicing(vector<int>& arr, int X, int Y)
{
auto start = arr.begin() + X;
auto end = arr.begin() + Y;
vector<int> result(Y - X);
copy(start, end, result.begin());
return result;
}
vector<int> slicing2(vector<int>& arr, int X, int... | ALGO | 0.999974 | 4.753125 |
b5d22ae9-5dc0-458f-9544-273432ce1f2a | ishandutta2007/codeforces | krijgertje/normal/1622/E.cpp | #include <algorithm>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <cstring>
#include <list>
#include <cassert>
#include <climits>
#inclu... | ALGO | 0.999633 | 3.575958 |
54ec4334-26b0-41c1-bb60-2c328ea23d36 | CoryZGithub/Operating-System-Trace-Simulator | lru.cpp | #include <algorithm>
#include <fstream>
#include <iostream>
#include <queue>
void LRU(int number_of_frames, const char *trace_file, bool debug) {
// Check if trace file exists
std::ifstream tracefile(trace_file);
if (!tracefile) {
std::cerr << "Error: failed to open tracefile.\n";
return;
}
// Initi... | ALGO | 0.963834 | 4.564228 |
58f3bf1b-c6ea-479b-8782-9f57d17006f2 | marcinmajkowski/SPOJ | WI_DATY.cpp | #include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cctype>
#include <algorithm>
// dorobic sprawdzanie poprawnosci r,m,d (przestepne itp)
using namespace std;
class Date
{
public:
string dosfat();
string iso();
int dosfat(string);
int iso(string);
enum month
{
JANUARY = 1,
... | ALGO | 0.993641 | 5.067581 |
50bcac26-e768-4471-a9a2-cf01513c2568 | quietwave00/algorithm-cpp | programmers/P1844.cpp | // #include <iostream>
// #include <vector>
// #include <queue>
// using namespace std;
// vector<vector<int>> maps = {{1, 0, 1, 1, 1}, {1, 0, 1, 0, 1}, {1, 0, 1, 1, 1}, {1, 1, 1, 0, 1}, {0, 0, 0, 0, 1}};
// vector<vector<bool>> visited;
// vector<int> dx = {0, 0, 1, -1};
// vector<int> dy = {1, -1, 0, 0};
// int N, M... | ALGO | 0.999736 | 5.395882 |
61150432-fa33-4bab-aa1a-bbecefee8f18 | Web3Expert47/faceRecognition | src/main/resources/opencv/sources/modules/stitching/perf/perf_estimators.cpp | #include "perf_precomp.hpp"
#include "opencv2/imgcodecs.hpp"
#include "opencv2/opencv_modules.hpp"
using namespace std;
using namespace cv;
using namespace perf;
using std::tr1::tuple;
using std::tr1::get;
typedef TestBaseWithParam<tuple<string, string> > bundleAdjuster;
#ifdef HAVE_OPENCV_XFEATURES2D
#define TEST_D... | TEST | 0.856315 | 6.641992 |
a0e55ca0-34b7-4091-9ae0-d6c8f71fa65a | BoHauHuang/PCCA-exercise | 2019 Summer Training/Contest/2015 ACM Amman Collegiate Programming Contest/A.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long lol;
#define MAX 1510
struct team {
int ac, p;
string nam;
bool operator < (const team& rhs) const {
if (ac != rhs.ac) return ac > rhs.ac;
return p < rhs.p;
}
} a[MAX];
int n;
int main() {
cin.tie(0), cout.sync_w... | ALGO | 0.998601 | 4.175977 |
6995ecb4-546c-49bc-a668-b99f4d3b376e | ggaier/cpptutorial | source/program_structure_3_funtions.cpp | #include <iostream>
using namespace std;
int addition(int a, int b);
int subtraction(int a, int b);
void duplicate(int& a, int& b, int& c)
{
a*=2;
b*=2;
c*=2;
}
/*
inline 只是告诉编译器对齐方法是优先考虑的方案. 尽管编译器可能不会对齐.
*/
inline string concatenate(const string &a, const string &b)
{
return a + b;
}
inline int di... | ALGO | 0.899968 | 3.610875 |
e067c2f8-bf67-4233-a8f4-161f9673b4ac | RahulScripted/CodeChef | CodeChef-Problems/Rating 1000 To 1400/Rating 1200 To 1400/ChefChick.cpp | // Chef Chick loves to jump a lot. Once, it realised that it was on an infinitely long road, and decided to travel along this road by jumping. Let's view the road as the x-axis in a 1D coordinate system. Initially, Chef Chick is at the coordinate x = 0, and it wants to move only in the positive x-direction. Moreover, C... | ALGO | 0.999219 | 3.411709 |
89aeeba1-3477-49fa-95d6-0187ea8380f0 | Actinium-project/Actinium | src/crypto/scrypt.cpp | #include <crypto/scrypt.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <openssl/sha.h>
static inline uint32_t be32dec(const void *pp)
{
const uint8_t *p = (uint8_t const *)pp;
return ((uint32_t)(p[3]) + ((uint32_t)(p[2]) << 8) +
((uint32_t)(p[1]) << 16) + ((uint32_t)(p[0]) << 24));
}
... | ALGO | 0.991162 | 5.193688 |
5b229ad3-c099-4ad2-b454-62078ae1533f | aseandude/Koinon | src/primitives/block.cpp | #include "primitives/block.h"
#include "hash.h"
#include "tinyformat.h"
#include "utilstrencodings.h"
#include "crypto/common.h"
#include "komodo_defs.h"
// default hash algorithm for block
uint256 (CBlockHeader::*CBlockHeader::hashFunction)() const = &CBlockHeader::GetSHA256DHash;
uint256 CBlockHeader::GetSHA256DHa... | ALGO | 0.975933 | 7.279976 |
43373076-6aac-4c65-85a9-b96f4d6cd3df | tlund80/RoboVision3D | src/reconstruction/structured_light_scanner/src/Reconstruction3D.cpp | /********************************************************************************************************************
*
* Copyright (c) 2013
*
* Danish Technological Institute (DTI)
*
*-------------------------------------------------------------------------------------------------------------------
*
* @file ... | ALGO | 0.997247 | 4.41219 |
e0119104-fa08-4fa9-8431-9db7cb927911 | KresimirSecan/SPA2Zadace22-23 | zadaca2/program2Secan.cpp | #include <iostream>
#include <vector>
#include <cmath>
using namespace std;
class hashfunk{
vector<int> hashvec;
int size;
public:
//konstruktor
hashfunk(int size) {
hashvec = vector<int>(size, 0);
this->size = size;
}
//hash1
int h1(string s){
unsigned long long ... | ALGO | 0.998366 | 4.891088 |
3514f0c4-5a6c-4d2c-8da6-ef96860b7cb2 | omerbar97/KNN-Server-Classification | src/Distance/Chebyshev.cpp |
#include "Chebyshev.h"
double Chebyshev::operator()(std::vector<double> v1, std::vector<double> v2) {
if(!Distance::checkVectors(v1, v2)) {
return -1; // in case the vector not in the same size.
}
std::vector<double> vec = absVector(v1 ,v2);
double max = vec[0];
for (double d : vec) {
... | ALGO | 0.999057 | 5.278975 |
b0adbbb6-4374-4896-a2b1-eee3703a067d | ranchoy/Leetcode-Algorithms | 40.组合总和II[重复训练].cpp | // https://leetcode-cn.com/problems/combination-sum-ii/submissions/
// DFSݣעظԪأͬԪء
class Solution {
public:
vector<vector<int>> res;
vector<vector<int>> combinationSum2(vector<int> &nums, int target) {
vector<int> temp;
sort(nums.begin(), nums.end(), less<int>{});
dfs(nums, temp, 0, targ... | ALGO | 0.999992 | 6.251374 |
6ee4d9d8-d53b-4313-a58b-7475c86f4719 | maparham/flow_update | boost_1_65_1/libs/graph/example/print-adjacent-vertices.cpp | using namespace boost;
template < typename Graph, typename VertexNamePropertyMap > void
read_graph_file(std::istream & graph_in, std::istream & name_in,
Graph & g, VertexNamePropertyMap name_map)
{
typedef typename graph_traits < Graph >::vertices_size_type size_type;
size_type n_vertices;
typena... | ALGO | 0.941006 | 5.819862 |
c117fb1e-7e5a-4c05-8727-f863f22ff93c | Coder-Vippro/Code | Archived/GiaHung/tinhtuoi.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
freopen("tinhtuoi.inp","r",stdin);
freopen("tinhtuoi.out","w",stdout);
int n,b,c;
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>b>>c;
if(b-c<19 || c <=0 || b<c ) cout<<"False";
else if(b==2*c) cout<<"The current father's a... | ALGO | 0.998047 | 3.376172 |
ba8101e2-1bff-4342-bc04-3a52d92b440d | jmarko02/LeetCode | LinkedLists/287FindDuplicateNumber.cpp | #include<vector>
class Solution {
public:
int findDuplicate(std::vector<int>& nums) {
int slow = 0, fast = 0;
while(true){
slow = nums[slow];
fast = nums[nums[fast]];
if ( slow == fast) break;
}
int slow2 = 0;
while(true){
s... | ALGO | 0.9999 | 5.811734 |
768f68be-495d-43ea-9496-419b4acd4eaa | king258436/algorithm | baekjoon/A와 B A와 B.cpp | #include<iostream>
#include<string>
#include<algorithm>
using namespace std;
string s1;
string s2;
int main() {
cin >> s1 >> s2;
while (s2.size() != s1.size()) {
if (s2[s2.size() - 1] == 'A') {
s2.erase(s2.size() - 1, 1);
} else if (s2[s2.size() - 1] == 'B') {
s2.erase(... | ALGO | 0.999993 | 4.091369 |
b8126cc8-34e6-4e9c-9d19-c977ee03f669 | raincross7/code-similarity | codes/train_code/problem370/problem370_340.cpp | #include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <map>
#include <deque>
#include <string.h>
using namespace std;
#define REP(i,n) for(int i = 0; i < n; i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
typedef pair<int,int> pi;
typedef p... | ALGO | 0.999997 | 4.693083 |
52fd4c1b-bafd-495b-baa1-be032e7d3715 | ROSETEA-lab/POLIMIcontrol-lib | continuous_ss.cpp | #include "continuous_ss.h"
#include <iostream>
#include <stdexcept>
continuous_ss::continuous_ss(const Eigen::MatrixXd& A, const Eigen::MatrixXd& B, const Eigen::MatrixXd& C, const Eigen::MatrixXd& D, const double sampling_time, const Eigen::VectorXd initial_state)
{
// Check parameter consistency
if (((A.row... | ALGO | 0.997451 | 6.415319 |
c8f2ed15-615a-4c2b-9a14-f18fd052a83e | raincross7/code-similarity | codes/train_code/problem236/problem236_496.cpp | #include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rep1(i, n) for (ll i = 1; i <= (n); ++i)
#define rrep(i, n) for (ll i = (n - 1); i >= 0; --i)
#define perm(c) sort(ALL(c));for(bool c##p=1;c##p;c##p=next_permutation(ALL(c)))
#define ALL(obj) (obj).begin(), (obj).end()
#define pb push_back
... | ALGO | 0.999931 | 3.975435 |
0e3d59a2-b174-406e-b7c8-67338d0a8bb7 | ansh-d23/Leet-Code | 0138-copy-list-with-random-pointer/0138-copy-list-with-random-pointer.cpp | /*
// Definition for a Node.
class Node {
public:
int val;
Node* next;
Node* random;
Node(int _val) {
val = _val;
next = NULL;
random = NULL;
}
};
*/
class Solution {
public:
Node* copyRandomList(Node* head) {
Node* ptr = head;
Node* ptr1 = head;
... | ALGO | 0.998717 | 5.432555 |
1636c81e-49ea-41b5-be22-cf2b67f3ef06 | tlhuangtw/leetcode | 541.cpp | class Solution {
public:
string reverseStr(string s, int k) {
for (int start = 0; start < s.size(); start += 2 * k) {
int end = min(start + k - 1, (int)(s.size() - 1));
for (int i = start, j = end; i < j; i++, j--) {
swap(s[i], s[j]);
}
}
r... | ALGO | 0.999969 | 6.218283 |
ec0f68dc-03e7-4c42-952d-dd0d053e03c4 | jonathandarryl/UVa-Code | 11777.cpp | #include<iostream>
#include<algorithm>
using namespace std;
int main(void){
int term1, term2, final, attn, testcase;
double ave, total;
int test[3];
cin>>testcase;
for(int i=1;i<=testcase;i++){
cout<<"Case "<<i<<": ";
cin>>term1>>term2>>final>>attn;
for(int j=0;j<3;j++)
... | ALGO | 0.996942 | 3.405117 |
c27ed46b-9de3-419b-aa73-03916c3da1e0 | goodchai0/Problems | 0733-flood-fill/0733-flood-fill.cpp | class Solution {
public:
vector<vector<int>> floodFill(vector<vector<int>>& grid, int sr, int sc, int color) {
queue<pair<int,int>>q;
q.push({sr,sc});
int c=grid[sr][sc];
grid[sr][sc]=-1;
int m=grid.size(),n=grid[0].size();
vector<pair<int, int>> dirs = {{1, 0},{-1, 0... | ALGO | 0.998939 | 6.218087 |
54e9117e-0b2c-43b2-bc76-0ceb0b588226 | abhix201/LeetCode_Codes | 1476-count-negative-numbers-in-a-sorted-matrix/1476-count-negative-numbers-in-a-sorted-matrix.cpp | class Solution {
public:
int countNegatives(vector<vector<int>>& grid) {
int row = grid.size();
int col = grid[0].size();
int cnt = 0;
for (int i = 0; i < row; i++) {
for (int j = col - 1; j >= 0; j--) {
if (grid[i][j] < 0)
cnt++;
else
break;
}
}
... | ALGO | 0.999977 | 6.493047 |
34c363ab-84f6-4bb7-a362-664725c74fbb | nxp-mcuxpresso/mcux-sdk-examples | evkmimxrt1060/eiq_examples/tflm_cifar10/source/model/get_top_n.cpp | #include "get_top_n.h"
// Returns the top N confidence values over threshold in the provided vector,
// sorted by confidence in descending order.
void MODEL_GetTopN(const uint8_t* tensorData, int tensorSize, tensor_type_t tensorType,
size_t numResults, float threshold, result_t* topResults)
{
for ... | ALGO | 0.98799 | 7.041502 |
04b887a7-49d3-4402-8e72-1024feaaa30c | devos50/programmingchallenges | UVA/11479/main.cpp | #include <iostream>
#include <set>
using namespace std;
void solve(int cas)
{
long long a, b, c; cin >> a >> b >> c;
if(!(a + b > c && a + c > b && b + c > a)) cout << "Case " << cas << ": Invalid" << endl;
else if(a == b && b == c) cout << "Case " << cas << ": Equilateral" << endl;
else if(a == b || b == c |... | ALGO | 0.999629 | 4.651935 |
c12209be-d53c-4625-bd49-fd2f6be86a0e | anshita572/DSA_Updated | GFG ques/Binary Search Trees/largest_bst.cpp | // https://practice.geeksforgeeks.org/problems/largest-bst/1
// TC : O(n) SC : O(n)
class info{
public:
int maxi;
int mini;
bool isBST;
int size;
};
info solve(Node* root,int &ans)
{
if(root == NULL)
{
return {INT_MIN,INT_MAX,true,0};
}
info left=solve(root->left,ans);
info right=solve(root-... | ALGO | 0.999956 | 6.331628 |
25cf6021-1810-4f83-86ef-42b8d1345b86 | reunanen/boost-prebuilt-windows-binaries | libs/geometry/doc/src/docutils/tools/support_status/support_status.cpp | // Boost.Geometry (aka GGL, Generic Geometry Library)
// Tool reporting Implementation Support Status in QBK or plain text format
#include <iostream>
#include <fstream>
#include <sstream>
#include <boost/mpl/for_each.hpp>
#include <boost/mpl/vector.hpp>
#include <boost/type_traits/is_base_of.hpp>
#define BOOST_GEOME... | TEST | 0.928217 | 7.756148 |
33741053-7970-4099-aa2a-11a50a388f27 | Tamalckb531/DSA-course | Week11/Mega/MinStack.cpp | #include <iostream>
#include <stack>
#include <vector>
#include <algorithm>
using namespace std;
class MinStack
{
public:
//? v.back() return the last value of vector, so it acts like the last in first out method of stack
vector<pair<int, int>> v;
MinStack()
{
}
void push(int val)
{
... | ALGO | 0.999966 | 6.158583 |
dacef678-13ed-454b-887e-3b76a2249e3f | ishandutta2007/codeforces | lawrenceli/normal/442/B.cpp | #include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iostream>
#include <list>
#includ... | ALGO | 0.999966 | 3.766783 |
e999e198-f310-45b0-be7a-3ea3bd5842ac | j2noo/BOJ | 1577/1577.cpp | #include<iostream>
#include<string.h>
#include<vector>
#include<utility>
#define ll long long
#define pii pair<int,int>
#define mp make_pair
using namespace std;
int n,m,k;
int isNotRoad[101][101][2]={0}; //r,c , 翩
ll dp[101][101];
ll solve(int r,int c){// r,c n,m
if(r>n || c>m) return 0;
if(r==n && c==m) r... | ALGO | 0.999903 | 3.445559 |
67db8d4d-fee9-45ef-8fbf-52004c22c8f0 | ishandutta2007/codeforces | kirill22/normal/1598/A.cpp | #include<bits/stdc++.h>
using namespace std;
template <typename A, typename B>
string to_string(pair<A, B> p);
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);
string to_string(const st... | ALGO | 0.999912 | 4.588454 |
ae7c7bea-96cf-4ade-bb42-f88fb8a6af82 | snmath-pi/DataStructures | 450DSASHEET/Miscellaneous/LargestAreaInHistogram(optimized).cpp | #include <algorithm>
#include <array>
#include<stack>
#include <bitset>
#include <cassert>
#include <chrono>
#include <climits>
#include <cmath>
#include <complex>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#includ... | ALGO | 0.999978 | 4.395679 |
200c7178-1681-4b99-ab28-047d814c864c | edsomjr/TEP | Grafos/problems/OJ_10116/codes/10116.cpp | #include <bits/stdc++.h>
using namespace std;
using ii = pair<int, int>;
#define MAX 15
char grid[MAX][MAX];
int dist[MAX][MAX];
const map<char, ii> dirs { { 'N', { -1, 0 } }, { 'S', { 1, 0 } },
{ 'W', { 0, -1 } }, { 'E', { 0, 1 } } };
ii solve(int start)
{
auto steps = 0, x = 1, y = start;
while (gri... | ALGO | 0.999819 | 3.293328 |
d3b3eb5e-cf8b-4044-b3bc-1c5de7f8f2eb | hikjik/leetcode | solutions/time-needed-to-inform-all-employees/test.cpp | #include <catch.hpp>
#include <solution.hpp>
TEST_CASE("Simple") {
struct TestCase {
int n;
int headID;
std::vector<int> manager;
std::vector<int> informTime;
int expected;
};
std::vector<TestCase> test_cases{
{
.n = 1,
.headID = 0,
.manager{-1},
... | TEST | 0.974328 | 6.982177 |
96a93dcc-2bda-4769-9ed8-08cecc8e1b9d | alisabir16767/DSA | recursion/Inseart.cpp | #include<iostream>
using namespace std;
int insert(int n,int arr[],int pos,int cap,int x){
if(n==cap)
return n;
int idx=pos-1;
for(int i=n-1;i>=idx;i--){
arr[i+1]=arr[i];
arr[idx]=x;
return (n+1);
}
}
int main(){
int n,x;
cout<<"Enter the size of the array:";
cin>>n;
cout<<"Enter the number which ... | ALGO | 0.999739 | 3.896847 |
27e47686-2917-45f9-beee-6b87b438ba89 | augustynka/Flowshop-Optimization-Methods-Simulated-Annealing-variants | SA_EDD_reheating.cpp | #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <random>
#include <chrono>
#include <cmath>
#include <fstream>
#include <numeric>
using namespace std;
using Clock = chrono::high_resolution_clock;
using Micro = chrono::microseconds;
struct Task {
int id;
int p1, p2; // ... | ALGO | 0.999677 | 6.919765 |
13951769-6d3c-4f4f-8096-b0c1c1cada44 | freefcw/leetcode | cpp/linked-list-cycle.cpp |
#include <cstdio>
#include <vector>
#include <iostream>
using namespace std;
struct ListNode {
int val;
ListNode *next;
ListNode(int x) : val(x), next(NULL) {}
};
class Solution {
public:
bool hasCycle(ListNode *head) {
if (head == NULL || head->next == NULL) {
return false;
... | ALGO | 0.999942 | 4.756222 |
8db99f9f-f48a-4774-b3a4-4048a6361711 | nursyah21/algoexercise | 1201210005_TeguhSambadaAbrielKarisma/Hackerrank/Hackerrank/pointer.cpp | #include <stdio.h>
void update(int *a,int *b) {
int sum = *a + *b;
int absDifference = *a - *b > 0 ? *a - *b : -(*a - *b);
*a = sum;
*b = absDifference;
}
int main() {
int a, b;
int *pa = &a, *pb = &b;
scanf("%d %d", &a, &b);
update(pa, pb);
printf("%d\n%d", a, b);
retur... | ALGO | 0.999894 | 4.253378 |
3253aef5-df12-4d41-96a0-ac1e12a4b6e9 | ishandutta2007/codeforces | zhangzy/normal/191/D.cpp | #include<bits/stdc++.h>
#define N 101000
#define M 606000
#define cout cerr
using namespace std;
namespace fastIO{
#define BUF_SIZE 100005
#define OUT_SIZE 100005
#define ll long long
//fread->read
bool IOerror=0;
inline char nc(){
static char buf[BUF_SIZE],*p1=buf+BUF_SIZE,*pend=buf+B... | ALGO | 0.999249 | 4.074281 |
528fd6e7-3a73-4489-8361-370026ffb34d | hazel0511/Multiple-Bloom-Filters | MBF_02/bloomFilter.cpp | #include <iostream>
#include <string>
#include "bloomFilter.h"
hash_function hf[11] = { RSHash,JSHash,PJWHash,ELFHash,BKDRHash,SDBMHash,DJBHash,DEKHash,BPHash,FNVHash,APHash };
int BloomFilter::getByteSize(BloomFilter bf)
{
return sizeof(bf.filter);
}
//Create a hash of an int and get a generator of hash functions... | TOOL | 0.940596 | 5.480518 |
c70f1b40-0a71-4a60-ad7c-662c40eb2240 | narutozxp/LeetCode | cpp/89.格雷编码.cpp | /*
* @lc app=leetcode.cn id=89 lang=cpp
*
* [89] 格雷编码
*/
// @lc code=start
#include<math.h>
class Solution {
public:
vector<int> grayCode(int n) {
vector<int> res;
size_t num = 1<<n;
// size_t mask = num-1;
for (size_t i = 0; i < num; i++)
{
// 不需要mask,因为最... | ALGO | 0.99986 | 6.102803 |
4e6e47b5-e2d1-419d-9f14-f908eb91f7ca | umeshsaini19/Leetcode-solutions | 329-longest-increasing-path-in-a-matrix/329-longest-increasing-path-in-a-matrix.cpp | class Solution {
public:
int dp[200][200];
bool is_valid(int i,int j,vector<vector<int>> &mat){
int m = mat.size(), n = mat[0].size();
if(i >= 0 and j >=0 and i < m and j < n) return true;
return false;
}
int solve(int i,int j,vector<vector<int>> &mat){
if(dp[i][j] != -1... | ALGO | 0.999996 | 6.263259 |
7cf9ce09-51d1-4b96-9f86-d240b33fc48c | Lotuses-robot/Codes | Exercise/Luogu/P1941/P1941.cpp | template<typename T>
void read(T &r) { r = 0; static char ch, last; ch = getchar(), last = 'z'; while (ch < '0' || ch > '9') last = ch, ch = getchar(); while (ch >= '0' && ch <= '9') r = (r << 1) + (r << 3) + (ch ^ 48), ch = getchar(); r = (last == '-') ? -r : r; }
template<typename T, typename...Ts>
void read(T &arg, ... | ALGO | 0.999978 | 3.926935 |
4258de88-d89b-4d10-bc94-017f50843b7b | TatianePirico/maratona | Basics/Average 1/app.cpp | /*
Read two floating points' values of double precision A and B, corresponding to two student's grades. After this, calculate the student's average, considering that grade A has weight 3.5 and B has weight 7.5. Each grade can be from zero to ten, always with one digit after the decimal point. Don’t forget to print the ... | ALGO | 0.999796 | 5.640544 |
14c04687-82eb-4d46-b805-f5ac90901ab7 | ShyLP/mang2chieu.cpp | bai1.cpp | //1. Tính tổng cách phần tử lẻ nằm trên đường chéo chính và đường chéo phụ của mảng 2 chiều a[dong][cot]
#include <iostream>
#define MAX 50
using namespace std;
void nhap(int a[MAX][MAX], int cot, int dong);
void xuat(int a[MAX][MAX], int cot, int dong);
int tong(int a[MAX][MAX], int cot, int dong);
int main()
{
int a... | ALGO | 0.999917 | 3.637236 |
ef90d5b2-ee22-400c-a4ff-cc98dc62378a | FoxXofix/Transmitting_dynamic_massive | Transmitting_dynamic_massive/Transmitting_dynamic_massive.cpp | #include <iostream>
using namespace std;
void print(int* mas, int n)
{
for (int i = 0; i < n; i++)
cout << "| " << mas[i] << " |" "\t";
}
int main()
{
setlocale(LC_ALL, "Russian");
{
int n;
cout << "Проверка задания : |Передача динамического массива| \nВведите число : ";
cin >> n;
if (n > 0)
{
int... | TOOL | 0.96947 | 3.963892 |
9d7b8d70-e965-4392-bf06-bd9ba90dc4df | InTheBloodHorse/ACM | HDU/1728bfs(一搜到底).cpp | #include<iostream>
#include<queue>
using namespace std;
const int m=100+30;
const int INT=1000;
char map[m][m]; //ͼ
int vis[m][m]; //洢ÿһת
int nn[4][2]={0,1,-1,0,0,-1,1,0}; //ϣң
bool outside(int h,int z,int n,int m) //жǷ
{
if(h>0&&h<=n&&z>0&&z<=m)
return 1;
else
return 0;
}
struct node
{... | ALGO | 0.999872 | 3.385602 |
9ae1f1a5-c6cd-4796-80dc-ba58278821a5 | kactasar/adventofcode | 2021/day11/main.cpp | #include <iostream>
#include <string>
#include <fstream>
#include <sstream>
#include "Octopus.hpp"
#include "functions.hpp"
int main(){
std::fstream input_file("input");
if(!input_file){
std::cout << "Error: input file not found.\n";
return 1;
}
Octopus** octopi_array = new Octopus* [X_SIZE];
for (size_t x... | ALGO | 0.990792 | 5.265412 |
8d6a6f1b-666b-458a-aa05-d6cb9e7320a1 | anugoyal998/DSA | CSES/Introductory Problems/Solve Later/Grid_Paths.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<vector<int>> vvi;
typedef vector<vector<double>> vvd;
int n = 2;
vvi vis(n,vi(n,0));
vi dx = {-1,0,1,0}; // 4 directions
vi dy = {0,1,0,-1}; // 4 directions
bool isSafe(int i,int j){... | ALGO | 0.999933 | 3.43227 |
cc6758dd-651d-406f-b9b3-fe8779b2b626 | imReese/leetcode-solutions | problems/2595-number-of-even-and-odd-bits/solution.cpp | // Link: https://leetcode.cn/problems/number-of-even-and-odd-bits/
// Level: Easy
// Date: 2025-02-20
class Solution {
public:
vector<int> evenOddBit(int n) {
vector<int> res(2, 0);
int index = 0;
while(n) {
if (n & 1) {
res[index % 2]... | ALGO | 0.999912 | 5.894825 |
c235f9b2-ac63-45c2-ac3b-103954e1544b | MaicolGomez/ACM | 2756.cpp | #include<cstdio>
#include<iostream>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<climits>
#include<set>
#include<deque>
#include<queue>
#include<map>
#include<climits>
#include<string>
#include<stack>
#include<sstream>
using namespace std;
#define pi (2.0*acos(0.0))
#define eps 1e-6
#... | ALGO | 0.999946 | 3.616599 |
d87db359-e0a3-4111-aa21-39a6dec87d4a | nextpointer/dsa-journey | Day15/reverseStr2.cpp | #include <bits/stdc++.h>
using namespace std;
void reverseStr(vector<char> &arr, int k) {
int n = arr.size();
for (int start = 0; start < n; start += 2*k) {
int endPointer = min(start + k - 1, n - 1);
reverse(arr.begin() + start, arr.begin() + endPointer + 1);
}
}
void PrintArray(vector<ch... | ALGO | 0.99987 | 4.934113 |
da53a727-f386-48bf-92fe-fc852d98a8e1 | kaustabh-das/Stack-datastructure | BYLINK.CPP | /* Implementation of stack by Link-list */
/* Data Structures Using C by UDIT AGARWAL */
#include <stdio.h>
#include <conio.h>
#include <alloc.h>
struct node
{
int info;
struct node *link;
};
struct node *top;
void main()
{
clrscr();
void create(),traverse (),push ( ),pop ();
create ();
printf("\nstack is:\n");
travers... | ALGO | 0.999725 | 4.573199 |
56fab15d-e96b-40bb-a3e6-37b39001b2a0 | Akanksha038/Striver_Sheet_Question | 0901-online-stock-span/0901-online-stock-span.cpp | class StockSpanner {
public:
stack<pair<int,int>>st;
StockSpanner() {
}
int next(int price) {
int stockSpan=1;
while(!st.empty() && st.top().first<=price )
{
stockSpan=stockSpan+st.top().second;
... | ALGO | 0.998493 | 6.072021 |
017e18a1-e080-49d1-8b37-d83f708f1314 | Radhika26Gupta/PrePlacementClasses | basic_questions/fibonacciseriesrec.cpp | #include<iostream>
using namespace std;
int fibo(int n)
{
if(n==0||n==1)return n;
else return fibo(n-1)+fibo(n-2);
}
int main()
{
int num;
cout<<"Enter the number : ";
cin>>num;
for(int i=0;i<num;i++)
{
cout<<fibo(i)<<" ";
}
}
// #include<iostream>
// using namespace std;
/... | ALGO | 0.999759 | 4.24534 |
bb7b35df-bc33-4f17-81b0-ef5c06a7e912 | dennisYatunin/OthelloAI | board.cpp | #include "board.hpp"
// An array for finding the index of the least significant bit in a 64-bit
// integer using the DeBruijn sequence 0x03f79d71b4cb0a89. Obtained from
// http://chessprogramming.wikispaces.com/BitScan.
const uint8_t DEBRUIJN_INDICES_64BIT[] = {
0, 1, 48, 2, 57, 49, 28, 3,
61, 58, 50, 42, ... | ALGO | 0.993074 | 6.445044 |
244e0e62-00f5-4ccb-8b8c-6448f852b2f9 | kumarshivam27december/data_structure_and_algorithm_in_c- | lec014_binary_search_interview_question/02_search_in_rotated_array.cpp | #include <iostream>
using namespace std;
int getpivot(int arr[],int n)
{
int s = 0;
int e = n-1;
int mid = s + (e-s)/2;
while (s<e)
{
//if(arr[mid]>arr[0]) // this will not pass on test case arr[1] = {1} , target = 1;
if(arr[mid]>arr[n-1])
{
s = mid +1;
... | ALGO | 0.999981 | 4.630659 |
ac66aa6a-2698-4238-8767-166b228443a8 | abhisheksaran/Competitive-Programming | codechef/long-challenge/oct20/posand.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int t;
cin>>t;
for(int i=0;i<t;i++){
int n;
cin>>n;
int arr[7]={2,3,1,5,4,6,7};
if(n==1) cout<<1<<"\n";
else if(!(n& (n-1)) ) cout<<-1<<"\n";
else{
for(int j=1;j<=n;j++){
if(j<=7) cout<<arr[j-1]<<" ";
else if(!(j&(j-1))){
// co... | ALGO | 0.999745 | 4.046017 |
2f303439-a7d6-4986-907c-836569e54d9e | AbdullahRFA/Number-theory | Prime factor .cpp | #include<bits/stdc++.h>
using namespace std;
void primefact()
{
int count=0,n;
cin>>n;
for(int i=2;i*i<=n;i++)
{
if(n%i==0)
{
while(n%i==0)
{
count++;
n/=i;
}
cout<<i<<"^"<<count;
if(n>1)cout<<",";
... | ALGO | 0.999423 | 4.392207 |
74413ca1-1891-4441-99d9-bc7b6be2abf3 | Mwako/deps | boost/libs/graph/example/print-edges.cpp | using namespace boost;
template < typename Graph, typename VertexNamePropertyMap > void
read_graph_file(std::istream & graph_in, std::istream & name_in,
Graph & g, VertexNamePropertyMap name_map)
{
typedef typename graph_traits < Graph >::vertices_size_type size_type;
size_type n_vertices;
typena... | ALGO | 0.993465 | 5.660892 |
353ff446-51be-4f67-a472-098e49d3535b | argoswamii/dsa-question | ashu-binarytree.cpp | #include<bits/stdc++.h>
using namespace std;
class Node{
public:
int data;
Node *left,*right;
Node(int d){
data=d;
left=right=NULL;
}
};
// Preorder build of the Tree root,left,right tree
Node* buildtree(){
int d;
cin>>d;
if(d==-1){
return NULL;
}
Node* n=ne... | ALGO | 0.999964 | 4.450953 |
387c9b27-2f49-4aae-9ce8-49d5e2a82634 | anjaneya-sharma-1/Competitive-Programming-Solutions | D_Divide_and_Equalize.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define N 1000000
#define MOD 1000000007
class Solution{
public:
void solve() {
ll n;
cin>>n;
ll ans =1;
vector<ll>v;
ll maxi=0;
for(int i =0;i<n;i++){
ll curr;
cin>>curr;
v.push_back(curr);
ma... | ALGO | 0.999564 | 4.778143 |
71f0e3af-4d3f-491f-8093-e945d260f3ef | kushantgarg/Stacks | staks/towerofhanoi.cpp | #include<iostream>
using namespace std;
void towerofhanoi(int n, char from_rod, char to_rod, char aux_rod)
{
if(n==1)
{
cout<<"Move disk 1 from rod "<<from_rod<<" To rod "<<to_rod<<endl;
return;
}
towerofhanoi(n-1,from_rod,aux_rod,to_rod);
cout<<"Move disk "<<n<<" from rod "<<from_rod<<" TO rod "<<to_rod<<endl... | ALGO | 0.999865 | 4.813965 |
07cd2ca4-7044-47eb-98c4-b1383999c8a0 | imulan/procon | poj/3293.cpp | #include <cstdio>
#include <iostream>
#include <vector>
#include <cstring>
#include <algorithm>
#include <set>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define each(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); ++itr)
#define all(x) (x).begin(),(x).end... | ALGO | 0.999897 | 4.066981 |
e37cb02d-5851-45c7-9cda-6a481892142d | flores-vincentangelo/cplusplus | book-learning/chapter2/programming-exercises/23.cpp | #include <iostream>
using namespace std;
int main()
{
const double k = 6.67e-8;
double m1 = 0.0, m2 = 0.0, d = 0.0, F = 0.0;
cout << "Input data in this format <Mass1 Mass2 distance>: ";
cin >> m1 >> m2 >> d;
F = ((m1 * m2)/d) * k;
cout << "The force between the two objects is: " << F << end... | ALGO | 0.999241 | 3.954343 |
fdfda2dd-a00b-4908-8e22-11abb0018e79 | karan-pawar-09/codeforces | A_-_Digit_Machine.cpp | /*
author:Karan
created:26.02.2022 17:31:23
*/
#if true
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define all(ar) ar.begin(),ar.end()
#define endl '\n'
#define mset(a,x) memset(a,x,sizeo... | ALGO | 0.999189 | 4.67665 |
4fc07563-b5a5-4079-bac9-c39a9b92587d | AmanGupt2020/dsa_practice_6 | CFRTEST.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin>>t;
while(t--){
unordered_set<int> arr2;
int n;
cin>>n;
int arr[n];
for(int i=0;i<n;i++){
cin>>arr[i];
arr2.insert(arr[i]);
}
cout<<arr2.size()<<endl;
}
return 0;
}
| ALGO | 0.999486 | 4.562349 |
3bf4c984-9860-4395-b1ba-28f166f3c1be | shhiivvaam/minimal_social_media | 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.9988 | 6.76073 |
92925de3-f50d-4280-8678-e2d3c4baa463 | VRMGOrganization/Vismaya | blender-2.68/extern/carve/lib/convex_hull.cpp | #if defined(HAVE_CONFIG_H)
# include <carve_config.h>
#endif
#include <carve/csg.hpp>
#include <carve/convex_hull.hpp>
#include <algorithm>
namespace {
bool grahamScan(const std::vector<carve::geom2d::P2> &points,
int vpp, int vp,
const std::vector<int> &ordered,
... | ALGO | 0.999891 | 7.096387 |
5bcfa319-bc69-43b1-8912-af750057f9b6 | dhruwill/Codeforces | dhruvil_11/996/B [World Cup].cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
int n;
cin>>n;
double a[n],ind=0;
ll min=10000000000;
for(int i=0;i<n;i++)
{
cin>>a[i];
ll t=ceil((a[i]+1-(i+1))/n);
if(t<=0)
t=0;
//cout<<t<<endl;
if(min>=(i+1)+t*n)
{
... | ALGO | 0.999938 | 3.706664 |
594fcda7-5735-4f98-a5a7-d2202e3fff69 | Mohan-3410/DSA | Pattern Code/squarePattern.cpp | #include <iostream>
using namespace std;
int main (){
char star = '*';
int n;
cin >> n;
int j=0;
while(j<n){
int i=0;
while(i<n){
cout<< star << " ";
i++;
}
cout<<"\n";
j++;
}
} | ALGO | 0.999967 | 3.810159 |
01fd74fe-9bfa-42d7-8464-119de2b30aa7 | jamilalways/Phitron-Algoritm | 11_3_Find_operation_implementation - Copy.cpp | #include<bits/stdc++.h>
using namespace std;
int par[1005];
int find(int node){
while(par[node] != -1){
cout << node << endl;
node = par[node];
}
return node;
}
int main(){
memset(par,-1,sizeof(par));
par[0] = 1;
par[1] = -1;
par[2] = 1;
par[3] = 1;
par[4] = 5;
pa... | ALGO | 0.999959 | 4.536397 |
1c3b7b47-963c-4f4c-9494-c4b24d8ebf52 | kuheli31/Leetcode_DSA | 169-majority-element/majority-element.cpp | class Solution {
public:
int majorityElement(vector<int>& nums) {
int count=0;
int element;
for(int i=0 ; i<nums.size() ;i++)
{
if(count==0)
{
count=1;
element=nums[i];
}
else if(nums[i] == element)
... | ALGO | 0.999864 | 5.556094 |
94e1050a-8e0e-4e60-a65c-5396680630ef | anc95/leetcode | 009. Palindrome Number/main.cpp | #include "solution.h"
using namespace std;
bool main() {
Solution s;
return s.isPalindrome(121);
} | ALGO | 0.999535 | 5.338049 |
332af012-e2a9-457a-a8b4-19bb5b01f770 | hjiang13/LLMs-in-IR | POJ-104/104/935.cpp | #include <iostream>
using namespace std;
void father(int x,int y)
{
int r1=0,r2=0;
for (int i=1; i<12; i++)
{
if (x-pow(2,i-1) < pow(2,i-1) && x-pow(2,i-1)>=0)
r1=i;
if ((y-pow(2,i-1)) < pow(2,i-1) && (y-pow(2,i-1))>=0)
r2=i;
if (r1!=0 && r2!=0)
break;
}
if (r1>r2)
x=x/pow(2,r1-r2);
else if (r1<r2)
y=y/pow(2,(r2-r1));
... | ALGO | 0.999987 | 3.286269 |
e3e1b723-66b3-4b05-b591-e2e21965f7d0 | AWaterColorPen/Template | legacy/GRAPH/EBC.cpp | #include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <queue>
using namespace std;
struct EBC {
static const int M = 255 ;
int con[M][M], mth[M], fa[M], base[M], path[M], inb[M], inq[M];
int n;
void init()
{
memset(con, 0, sizeof(con));
memset(mth, 0, sizeof(mth));
}
void... | ALGO | 0.999162 | 3.845756 |
4f426213-4ee9-4844-a542-1ebce136586c | AndrewShkrob/Courses | Coursera/Data Structures and Algorithms Specialization/Algorithmic Toolbox/Assignments/week2_algorithmic_warmup/7_last_digit_of_the_sum_of_fibonacci_numbers_again/fibonacci_partial_sum.cpp | #include <iostream>
#include <vector>
using std::vector;
long long get_fibonacci_partial_sum_naive(long long from, long long to) {
long long sum = 0;
long long current = 0;
long long next = 1;
for (long long i = 0; i <= to; ++i) {
if (i >= from) {
sum += current;
}
... | ALGO | 0.999924 | 4.840507 |
7c5c4c24-d393-4234-8698-c3f469e5ef1e | Avinash0308/LeetCodePOTDSolution_2023 | APR 23 2023 -- Restore The Array Solution.cpp | class Solution {
public:
int dfs(const string& s, long k, int i, vector<int>& dp) {
if (i == s.size()) return 1;
if (s[i] == '0') return 0;
if (dp[i] != -1) return dp[i];
int ans = 0;
long num = 0;
for (int j = i; j < s.size(); j++) {
num = num * 10 + s[j... | ALGO | 0.999835 | 5.821484 |
fc6c1fbc-564a-4c99-819e-2e86e7d3e34d | Shell-Wataru/AtCoder | ABC/ABC178/C.cpp | #define _USE_MATH_DEFINES
#include <iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <queue>
#include <set>
#include <map>
#include <limits>
#include <cmath>
#include <iomanip>
#include <functional>
#include <random>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
using ll = ... | ALGO | 0.999969 | 4.446439 |
8230dada-8add-4d84-bd15-15176c1a5f7c | Satyajeet5275/Data_Structures_and_Algorithms-Leetcode | 1675-magnetic-force-between-two-balls/magnetic-force-between-two-balls.cpp | class Solution {
public:
int maxDistance(vector<int>& position, int m) {
sort(position.begin(), position.end());
int lo = 1;
int hi = (position.back() - position[0]) / (m - 1);
int ans = 1;
while (lo <= hi) {
int mid = lo + (hi - lo) / 2;
if (canWePlac... | ALGO | 0.999919 | 5.701074 |
19c33964-886b-4556-a881-4d6a2699ae04 | mrmanago/coding_challenges | LeetCode/minimum_value_to_get_positive_step_by_step_sum.cpp | class Solution {
public:
int findMinFibonacciNumbers(int k) {
vector<int> fib = { 1, 1 };
int i = 1;
while (fib[i] < k) {
int nextFib = fib[i] + fib[i - 1];
fib.push_back(nextFib);
++i;
}
int n = fib.size();
if (k == fib[n - 1]) {
... | ALGO | 0.999973 | 5.680226 |
068e2780-6c41-4ba0-a368-66bf27cb3dae | mydude/leetcode | cpp_solutions/79_subsets.cpp | class Solution {
public:
vector<vector<int> > subsets(vector<int> &nums) {
vector<vector<int>> res;
vector<int> vec;
res.push_back(vec);
sort(nums.begin(), nums.end());
for(int i=0; i<nums.size(); i++) {
int n = res.size();
for(int j=0; j<n; j++) {
... | ALGO | 0.999991 | 5.789709 |
421c4a11-a907-4777-9896-c03ce04e7afa | ArnaudPannatier/PCSC2017_Group8 | Solvers/Preconditioners.cpp | //
// Created by Groupe 8
// Muhammad Haziq Bin Razali and Arnaud Pannatier
// PCSC 2017
//
#include "Preconditioners.h"
#include "LU.h"
Matrix Preconditioners::Jacobi(const Matrix &A) {
return A.Diagonal();
}
Matrix Preconditioners::GaussSeidel(const Matrix &A) {
LU LUSolver(A, Vector(A.size().lines));
... | TOOL | 0.903343 | 5.470608 |
29706257-6b4a-4a5d-9485-cbd58ce16e5e | SudiptoDasSukanto/MyLibrary_OfAlgorithom | All Algorithms/HamiltonianCycle.cpp | #include<bits/stdc++.h>
using namespace std;
bool graph[100][100];
bool isSafe(int e , int path[] ,int pos){
//cout << "SUkantp"<< e <<endl;
if(graph[path[pos-1]][e]==0) return false ;
for(int i=0 ; i<pos ; i++){
if(e==path[i]) return false ;
}
return true ;
}
bool Hamiltonianpath(int v... | ALGO | 0.999996 | 3.961419 |
e48d77fc-be28-4bee-b9c8-b473a2ebf4fa | junesookang/asplos24-GMT | include/freestanding/libcxx/test/std/containers/sequences/vector/vector.modifiers/push_back.pass.cpp | // <vector>
// void push_back(const value_type& x);
#include <vector>
#include <cassert>
#include <cstddef>
#include "test_macros.h"
#include "test_allocator.h"
#include "min_allocator.h"
#include "asan_testing.h"
int main(int, char**)
{
{
std::vector<int> c;
c.push_back(0);
assert(c.size... | TEST | 0.950167 | 5.986049 |
d2873521-d703-4f92-b6c3-c71100b08da0 | Alan-chenhx/ACM | cf_contest/Codeforces Round #561 (Div. 2)/A.cpp | #include<bits/stdc++.h>
using namespace std;
#define IOS std::ios::sync_with_stdio(false); std::cin.tie(0);
#define endl "\n"
int cnt[26]={0};
long long com[101][3]={0};
long long comb(int n,int c){
if(n==0) return 0;
if(n==1) return 0;
long long ans=1;
for(int i=1;i<=n;i++){
ans*=i;
}
for(int i=1;i<=c;i++){
... | ALGO | 0.999971 | 3.781237 |
dd2661ec-1219-4651-9e7e-477bf3c922d6 | ishandutta2007/codeforces | hollwoq_pelw/normal/1243/B1.cpp | #include <bits/stdc++.h>
using namespace std;
int n;
string s,t;
void solve() {
cin >> n >> s >> t;
int ndsp[n];
int idx = 0;
for (int i = 0; i < n; i++){
if (s[i] != t[i]) {ndsp[idx] = i; idx++;}
}
if (idx != 2 && idx != 0) cout << "NO" << endl;
else if (idx == 2 && (t[ndsp[0]] !=... | ALGO | 0.999952 | 4.667682 |
a682f067-80d7-4578-97da-264481f56536 | xh5a5n6k6/cadise | source/math/distribution/distribution1D.cpp | #include "math/distribution/distribution1D.h"
#include "fundamental/assertion.h"
#include "math/math.h"
namespace cadise {
Distribution1D::Distribution1D() = default;
Distribution1D::Distribution1D(const real* const value, const std::size_t sizeNumber) :
_cdf(sizeNumber + 1) {
CADISE_ASSERT(value);
_d... | ALGO | 0.938345 | 6.222903 |
3c716d11-e20d-4852-8edc-a0bb3e7a280d | kunalgargk15/week1-dp5-CipherSchools | linked_list_q1.cpp | #include <bits/stdc++.h>
using namespace std;
struct Node{
int data;
Node* next;
Node(int x){
data=x;
next=NULL;
}
};
void printlist(Node *head){
Node *curr=head;
while(curr!=NULL){
cout<<curr->data<<" ";
curr=curr->next;
}cout<<endl;
}
Node *delTail(Node... | ALGO | 0.997832 | 4.502867 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.