uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
7dd8d7a4-4b21-464f-930d-e942b262d695 | firiexp/contest_log | codeforces/1038B.cpp | #include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>
static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;
template... | ALGO | 0.999968 | 4.230517 |
1f868814-3eb7-4db7-b230-bc804ab733ca | Lucifero-debug/Data-Structure-and-algorithm | binaryTrees/flattenTree.cpp | #include <iostream>
using namespace std;
class TreeNode {
public:
int val;
TreeNode *left;
TreeNode *right;
};
void flatten(TreeNode* root) {
TreeNode* curr=root;
while(curr!=NULL){
if(curr->left){
TreeNode* pred=curr->left;
while(pr... | ALGO | 0.999976 | 4.418942 |
844fa160-0dd0-43bb-a8e4-3dbf48ccf722 | grotius-cnc/hal-core | src/hal/components/skynet/cpp_interface/libruckig/examples/3_waypoints.cpp | #include <iostream>
#include <ruckig/ruckig.hpp>
using namespace ruckig;
int main() {
const double control_cycle {0.01};
const size_t DOFs {3};
const size_t max_number_of_waypoints {10}; // for memory allocation
// Create instances: the Ruckig OTG as well as input and output parameters
Ruckig<D... | ALGO | 0.98897 | 6.137189 |
59d89aa6-a0fe-4116-8fd7-7733fa51c553 | SumitGarg11/Algorithms | Graph/Algozienth/BFS/bfsCode.cpp | #include <bits/stdc++.h>
using namespace std;
int n, m;
vector<vector<int>> g;
vector<int> vis;
vector<int> dis;
void bfs(int sc_node)
{
queue<int> q;
// before to push the node vis the node;
vis[sc_node] = 1;
dis[sc_node] = 0; // distance from source node is 0
q.push(sc_node);
while (!q.empty()... | ALGO | 0.999972 | 4.507133 |
316f2196-a627-484f-ae4b-c5484dfddb92 | ishandutta2007/codeforces | square1001/normal/868/C.cpp | #include <iostream>
using namespace std;
int n, m, a[100009], s, b;
int main() {
cin >> n >> m;
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
cin >> s;
a[i] |= s << j;
}
b |= 1 << a[i];
}
bool f = false;
for (int i = 0; i < 1 << m; i++) {
for (int j = i + 1; j < 1 << m; j++) {
if ((i... | ALGO | 0.999988 | 4.053985 |
895c3005-9243-4a34-a2d5-756d7be77285 | MuteMeteor/LintCode | C++/LinkedList/035 Reverse Linked List.cpp | /**
* Reverse a linked list.
* Example
* For linked list 1->2->3, the reversed linked list is 3->2->1
*/
/**
* Definition of ListNode
*
* class ListNode {
* public:
* int val;
* ListNode *next;
*
* ListNode(int val) {
* this->val = val;
* this->next = NULL;
* }
* }
*... | ALGO | 0.999549 | 5.36658 |
3e151967-57e4-4d2f-8417-e15de3073bb4 | Mayaraassis/Desafios_logica | Remove Duplicates from Sorted 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* deleteDupli... | ALGO | 0.999929 | 5.751267 |
09fb05a0-d07e-4b2f-9781-77358922a818 | hrehfeld/ezrgraphicsdemo | lib/eigen/doc/examples/Tutorial_simple_example_dynamic_size.cpp | #include <Eigen/Core>
// import most common Eigen types
USING_PART_OF_NAMESPACE_EIGEN
int main(int, char *[])
{
for (int size=1; size<=4; ++size)
{
MatrixXi m(size,size+1); // a (size)x(size+1)-matrix of int's
for (int j=0; j<m.cols(); ++j) // loop over columns
for (int i=0; i<m.rows(); +... | ALGO | 0.876649 | 3.241578 |
aec992e9-121f-4457-b4fa-34f0a88a3ff3 | felrock/projectEuler | problem83.cpp | #include <array>
#include <fstream>
#include <iostream>
#include <vector>
#include <string>
#define INF 99999999
using namespace std;
struct Node
{
int index;
int weight;
vector<int> neighbors;
};
vector<int> parseLine(string line, char delimiter)
{
string temp;
vector<int> result;
for(const... | ALGO | 0.999812 | 4.585287 |
1a40e040-5afd-4d52-8a53-ef0218da2bcf | zahidzhp/ALL-MY-ACM-CODES | Scrambled Solved Problems/Free spots - 10703.cpp | #include <stdio.h>
int grid[505][505];
void reset()
{
register int i,j;
for(i=0;i<505;i++)
for(j=0;j<505;j++)
grid[i][j]=0;
}
int main()
{
int w,h,n;
while(scanf("%d %d %d",&w,&h,&n)&&w&&h&&n)
{
register int i,j;
for()
}
}
| ALGO | 0.989259 | 3.022646 |
efb6aa72-64df-4f9d-83d7-549d19142edd | davrec72/clang-meta | llvm/projects/libcxx/test/std/algorithms/alg.sorting/alg.clamp/clamp.pass.cpp | // <algorithm>
// XFAIL: c++98, c++03, c++11, c++14
// template<class T>
// const T&
// clamp(const T& v, const T& lo, const T& hi);
#include <algorithm>
#include <cassert>
struct Tag {
Tag() : val(0), tag("Default") {}
Tag(int a, const char *b) : val(a), tag(b) {}
~Tag() {}
int val;
const c... | TEST | 0.965894 | 6.694221 |
f3647316-7d96-451b-b756-9891c1bad10a | Forman3/Algorithm_code | uva 315.cpp | #include<bits/stdc++.h>
#define pb(a) push_back(a)
using namespace std;
vector<int>adj[1000];
vector<int>Ans;
int visited[1000],start_time[1000],low_time[1000],parent[1000],tim=0,child_count=0,v,root;
void Articulationpoin(int u){
visited[u]=1;
start_time[u]=tim;
low_time[u]=tim;
tim++;
bool isArti =false;
for(int i=0;... | ALGO | 0.999961 | 4.71602 |
78c1f4e0-4fe0-4daf-8268-3f30cfcd9683 | Daria2002/ctci | src/Chapter_16_Moderate/T9.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <ctime>
#include <cstdlib>
#include <unordered_map>
#include "trie/Trie.hpp"
std::vector<std::vector<char>> t9_letters = {{}, {}, {'a', 'b', 'c'}, {'d', 'e', 'f'},
{'g', 'h', 'i'}, {'j', 'k', 'l'}, {'m', 'n'... | ALGO | 0.996946 | 6.680737 |
2f3ea2b6-c35c-4bb4-8fbd-a8868c534660 | ethereon/p7zip-hybrid | p7zip/CPP/7zip/Crypto/Sha1.cpp | // Crypto/Sha1.cpp
// This file is based on public domain
// Steve Reid and Wei Dai's code from Crypto++
#include "StdAfx.h"
#include "../../../C/RotateDefs.h"
#include "Sha1.h"
namespace NCrypto {
namespace NSha1 {
// define it for speed optimization
// #define _SHA1_UNROLL
static const unsigned kNumW =
#ifdef... | ALGO | 0.993411 | 6.773674 |
37e1dcd4-3328-49ea-bbf7-cf658534e551 | lanshi17/leetcode | editor/cn/subarray-sums-divisible-by-k.cpp | /*
* @lc app=leetcode.cn id=974 lang=cpp
* @lcpr version=30201
*
* [974] 和可被 K 整除的子数组
*/
// @lc code=start
class Solution {
public:
int subarraysDivByK(vector<int>& nums, int k) {
int n=nums.size();
int preSum=0,res=0;
unordered_map<int,int> count;
count[0]=1;
for (int i = 1... | ALGO | 0.999963 | 6.112589 |
731e93ff-704c-45a8-ad45-9af27d4fdb45 | shivatheja3/Data-Structures-and-Algorithms | 2256-minimum-average-difference/2256-minimum-average-difference.cpp | class Solution {
public:
int minimumAverageDifference(vector<int>& nums) {
long long res=1000000;
int ind=0;
long long sum1=0;
for(int i=0;i<nums.size();++i)
sum1+=nums[i];
long long temp=0;
for(int i=0;i<nums.size();++i){
sum1-=nums[i];
... | ALGO | 0.999975 | 5.766068 |
ff7d96c0-60a1-4e60-ab12-a6b364ef128f | anushgr/dsa | algorithms/prims_algorithm.cpp | #include <stdio.h>
void prims(int n , int a[10][10], int source) {
int d[100], s[10], i, j, u, v, min, sum = 0;
for (i =1; i<=n; i++) {
d[i] = a[source][i];
s[i] = 0;
}
s[source] = 1;
for( i=1; i<n; i++ ) {
min = 9999;
for(j=1; j<=n; j++) {
if( s[j] ==... | ALGO | 0.999962 | 4.238389 |
6a296010-d533-4776-aedd-9b0cd69f4b6d | sarvex/leetcode-checked-c | solution/0000-0099/0024.Swap Nodes in Pairs/Solution.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* swapPairs(L... | ALGO | 0.999995 | 5.962777 |
8eb36b67-d101-4610-ab50-e412f61e7802 | bioresestance/AdventOfCode2024 | day-17/main.cpp | #include <string>
#include <iostream>
#include <string_view>
#include <gtest/gtest.h>
#include <filesystem>
#include <chrono>
#include "InputFile.hpp"
#include "src/include.hpp"
#define ENABLE_PART1 (true)
#define ENABLE_PART2 (true)
// Add the test input and output strings here to validate the solution
const std::ve... | ALGO | 0.967517 | 6.550189 |
3bb065b8-5fa0-456a-964e-865995b46099 | czyzlukasz/Simulator | Simulator/Src/Simulator.cpp | #include <Simulator.hpp>
#include <cmath>
Simulator::Simulator() : planeItems(), planeStatus(), rigidBody(), isInitialized(false), timePointSinceStart(){
rigidBody.rotation = Quaterniond(Vector3d{0, 0, 0});
}
void Simulator::initialize(TimePoint startTimePoint) {
for(const auto& planeItem : planeItems){
... | ALGO | 0.851807 | 5.685182 |
bbb912c9-e1f7-40ed-9733-8cb490667371 | sudosurootdev/platform_ndk | sources/cxx-stl/llvm-libc++/libcxx/test/algorithms/alg.sorting/alg.set.operations/set.difference/set_difference_comp.pass.cpp | // <algorithm>
// template<InputIterator InIter1, InputIterator InIter2, typename OutIter,
// CopyConstructible Compare>
// requires OutputIterator<OutIter, InIter1::reference>
// && OutputIterator<OutIter, InIter2::reference>
// && Predicate<Compare, InIter1::value_type, InIter2::value_type... | TEST | 0.860881 | 6.450739 |
bd9a67d4-50fa-4ca0-87da-5445197fd632 | leijurv/pytorch | aten/src/ATen/native/sparse/cuda/SparseBlas.cpp | #define TORCH_ASSERT_ONLY_METHOD_OPERATORS
#include <ATen/core/Tensor.h>
#include <ATen/ExpandUtils.h>
#include <ATen/SparseCsrTensorUtils.h>
#include <ATen/native/Resize.h>
#include <ATen/native/sparse/cuda/SparseBlasImpl.h>
#include <ATen/native/sparse/SparseBlas.h>
#include <ATen/native/sparse/SparseCsrTensorMath.h>... | TOOL | 0.868221 | 6.219512 |
6d07d7d6-ef99-4db6-acc5-b4356fd74fce | DOGEOFDOGE/DDOGE | src/merkleblock.cpp | #include "merkleblock.h"
#include "hash.h"
#include "consensus/consensus.h"
#include "utilstrencodings.h"
CMerkleBlock::CMerkleBlock(const CBlock& block, CBloomFilter& filter)
{
header = block.GetBlockHeader();
std::vector<bool> vMatch;
std::vector<uint256> vHashes;
vMatch.reserve(block.vtx.size());... | ALGO | 0.997744 | 6.069984 |
a93d3cae-7a63-48be-a1a8-d62bbff4b3f8 | gaia-platform/GaiaPlatform | third_party/production/TranslationEngineLLVM/lldb/packages/Python/lldbsuite/test/functionalities/recursion/main.cpp | #include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
struct node;
struct node {
int value;
node* next;
node () : value(1),next(NULL) {}
node (int v) : value(v), next(NULL) {}
};
void make_tree(node* root, int count)
{
int countdown=1;
if (!root)
return;
root->value = countdown;
while (count > 0)
{
... | ALGO | 0.998847 | 3.433065 |
c8340d74-3104-4ee6-a92c-8e896116dff0 | SuperCreativeViolence/BrokenCrystal | BrokenCrystal/include/BulletPhysics/BulletCollision/BroadphaseCollision/btQuantizedBvh.cpp | #include "btQuantizedBvh.h"
#include "LinearMath/btAabbUtil2.h"
#include "LinearMath/btIDebugDraw.h"
#include "LinearMath/btSerializer.h"
#define RAYAABB2
btQuantizedBvh::btQuantizedBvh() :
m_bulletVersion(BT_BULLET_VERSION),
m_useQuantization(false),
//m_traversalMode(TRAVERSAL_STACKLESS_CACHE_FRIE... | ALGO | 0.996339 | 6.978654 |
0d3f4332-2eb2-45ee-b986-57888a9c102a | Atharvaw07/DSA | lec5/incredecre.cpp | #include<iostream>
using namespace std;
int main(){
int i=7;
cout<<(++i)<<endl; //8
cout<<(i++)<<endl;//8--->9
cout<<(--i)<<endl;//8
cout<<(i--)<<endl;//8--->7
return 0;
} | ALGO | 0.992919 | 3.217504 |
96fd3487-6645-44ed-8db2-ea6b3c2cb3b2 | RohitBeniwal/CSES-Problem_Set | Introductory/Coin_piles.cpp | #include<bits/stdc++.h>
#define MOD 1000000007
#define pb push_back
#define rep(i, a, b) for (int i = a; i < b; i++)
#define ff first
#define ss second
#define vll vector<ll>
#define pll pair<ll,ll>
#define all(x) (x).begin(), (x).end()
#define mp make_pair
#define endl "\n"
#define yes cout<<"YES"<<endl
#define no cou... | ALGO | 0.999663 | 4.37603 |
6c6f82ed-e3ff-4e2d-bf06-1d5d8eacb976 | f-zyj/ACM | ACM 模板代码/f-Baby-Step Giant-Step/f-Baby-Step Giant-Step/main.cpp | #include <iostream>
#include <cmath>
using namespace std;
/*
* baby_step giant _step
* a^x = b(mod n) n不要求是素数
* 求解上式0 ≤ x < n的解
*/
#define MOD 76543
int hs[MOD];
int head[MOD];
int _next[MOD];
int id[MOD];
int top;
void insert(int x, int y)
{
int k = x % MOD;
hs[top] = x;
id[top] = y;
_next[to... | ALGO | 0.999943 | 3.842365 |
79eb28de-981f-42e8-b68e-b9408db36fa5 | azrazic/object-oriented-programming | zadatak12.cpp | #include <iostream>
using namespace std;
int main()
{
int i,n;
int suma=0;
cout << "Unesi n: ";
cin>>n;
cout << "*****************"<<endl;
cout << "Prosti brojevi"<<endl;
cout << "*****************"<<endl;
bool prost;
int br=0;
for (int x=1; x<n; x++)
{prost=true;
... | ALGO | 0.999872 | 3.98338 |
db767d71-cb2d-429a-88b3-65f66a99420c | raincross7/code-similarity | codes/train_code/problem322/problem322_468.cpp | #include<stdio.h>
int main(){
int i=1,x; ;
while(1){
scanf("%d",&x);
if(x==0) break;
printf("Case ");
printf("%d: %d\n",i,x);
i++;
}
return(0);
} | ALGO | 0.974199 | 3.160495 |
49d60b6c-79ea-4a2a-8b09-f15e19c6371a | ravindran-dev/Leetcode | 3307-find-the-k-th-character-in-string-game-ii/3307-find-the-k-th-character-in-string-game-ii.cpp | class Solution {
public:
char kthCharacter(long long k, vector<int>& ops) {
string s = "a";
for (int op : ops) {
string t;
if (op == 0) t = s;
else for (char c : s) t += (c == 'z' ? 'a' : c + 1);
s += t;
}
return s[k - 1];
}
}; | ALGO | 0.999727 | 5.745356 |
62360bab-7de6-47d1-91a5-1c4c9bb4c5a4 | heoboseong7/algorithm | baekjoon/17478.cpp | #include <bits/stdc++.h>
using namespace std;
int N;
void rec(int n) {
for(int i = 0; i < n; i++)
printf("____");
printf("\"재귀함수가 뭔가요?\"\n");
if(n == N) {
for(int i = 0; i < n; i++)
printf("____");
printf("\"재귀함수는 자기 자신을 호출하는 함수라네\"\n");
}
else {
for(int i = 0; i < n; i++)
printf("____");
printf... | ALGO | 0.998765 | 3.865107 |
9ead2b65-cdfe-4952-b8bd-d1f481cbdd0a | nayemuddinn/Competitive-programming | Codeforces/Laptops 456A.cpp | /**
.
author-> NATE
.
**/
#include<bits/stdc++.h>
using namespace std;
#define first_in_out ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define For(i,n) for(int i=0;i<n;i++)
#define For2(i,n) for(int i=1;i<=n;i++)
#define For3(i, j, n) for (int i = j; i <= n; i++)
#... | ALGO | 0.999899 | 3.292804 |
f7b09d7b-3cb0-4520-8240-591d56912a9a | DmitriyShepelev/sumo | src/microsim/cfmodels/MSCFModel_W99.cpp | /****************************************************************************/
/****************************************************************************/
/// @file MSCFModel_W99.cpp
/// @author Jakob Erdmann
/// @date June 2019
///
// The psycho-physical model of Wiedemann (10-Parameter version from 1999)
//... | ALGO | 0.999173 | 5.487502 |
e259d26a-412c-4364-a296-857768b8a29f | mr-vicky/TCS-NQT-Coding-Sheet | Striver TCS Sheet/01]. Arrays/11_Remove_Duplicates_in-place_from_Sorted_Array.cpp | /*
Remove Duplicates in-place from Sorted Array
Problem Statement: Given an integer array sorted in non-decreasing order, remove the duplicates in place such that each unique element appears only once. The relative order of the elements should be kept the same.
If there are k elements after removing the duplicates, th... | ALGO | 0.999842 | 6.271278 |
62f3d4a7-c0e0-409b-915b-44338c0450ef | luckcul/LeetCode | algorithms/Single Element in a Sorted Array/Single Element in a Sorted Array.cpp | class Solution {
public:
int singleNonDuplicate(vector<int>& nums) {
int ret = 0;
for(int i = 0; i < nums.size(); i++) ret ^= nums[i];
return ret;
}
}; | ALGO | 0.999961 | 5.867038 |
864afc57-8774-49fe-b900-c8de6640b5b8 | ishandutta2007/codeforces | laycurse/normal/1208/B.cpp | #pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
void *wmem;
template<class T> inline void walloc1d(T **arr, int x, void **mem = &wmem){
static int skip[16]={0, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1};
(*mem) = (void*)( ((char*)(*mem)) + skip[((unsigned long long)(*mem)) & 15] ... | ALGO | 0.999973 | 4.335747 |
4bb83b31-8e75-4591-ab4c-5f3e67cffa80 | falcaoanderson/CompetitiveProgramming | juizes/uva-11855.cpp | /*
25 and 26 /03/24
Problem:
Complexity:
*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl "\n"
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL)
#define PB push_back
#define EB emplace_back
#define FF first
#define SS second
#define sz(x) (int)(x).size()
typedef pair<... | ALGO | 0.999969 | 4.393417 |
ac85279d-9a0c-41e2-ab37-fd17d26b57d1 | Junchi-Liang/AI_assignment1 | sequential_a_star.cpp | #include "sequential_a_star.h"
namespace solver_ns
{
// build the path from (start_col, start_row) to (goal_col, goal_row) according to trace back for heuristic index_heuristic , store the result to output
void sequential_a_star::build_result(int index_heuristic, int start_col, int start_row, int goal_col, int goal... | ALGO | 0.999983 | 5.40134 |
407945b1-8f98-4ad8-967a-e6088a30da65 | ishandutta2007/codeforces | farhod_farmon/normal/609/E.cpp | #include <bits/stdc++.h>
#define lli long long int
#define sc scanf
#define pr printf
#define pb push_back
#define p_b pop_back
#define mp make_pair
#define fi first
#define se second
#define fin freopen( "input.txt", "r", stdin );
#define fout freopen( "output.txt", "w", stdout );
#define dist( x, xx, y, yy ) sqrt( (... | ALGO | 0.999964 | 3.718961 |
32fdd88c-53ee-4b6f-a473-25ca6453d028 | vladmaryna/laborat | lab_15_2.cpp | #include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
int A[n];
srand(time(NULL));
for( int i=0; i<n; i++){
A[i]=rand()%21-10;
cout << A[i]<<" ";
}
cout<<endl;
int max=A[0];
int max_index=0;
for (int i=1; i<n; i++) {
if (... | ALGO | 0.998236 | 3.685476 |
47ebceeb-dc8b-4f47-a5b3-54fa7f37b15d | LTZDLY/2020_work_spring | w6互评/p1 +1 [UTF_8]1850384_aw6p1.cpp | //
// Created by Zhengyi on 2020/4/7.
// Using Google Naming Regulations
// Using C++11 standard, compiled with 0 warnings on
// Apple clang version 11.0.3 (clang-110<IP_ADDRESS>).
// Compiling configuration is [g++ -Wall -std=gnu++11 aw6p1.cpp]
//
#include <iostream>
#include <string>
#include <cstdlib>
/* Interface... | ALGO | 0.996311 | 5.497813 |
10baac2e-6a2c-4784-805f-3d98f09fac9d | xjyOOoo/fitst | prim.cpp | #include <iostream>
#include <vector>
#include <queue>
#include <climits>
using namespace std;
typedef pair<int, int> iPair; // Utility class for weighted edges (destination, weight)
class Graph
{
int V; // Number of vertices
vector<vector<iPair>> adj; // Adjacency list representation of ... | ALGO | 0.999985 | 6.101243 |
8b1de8fb-5060-4ed0-ac1d-a870217c141a | kosakowski/OGS6-MP-LT-Drum | NumLib/TimeStepping/Algorithms/IterationNumberBasedTimeStepping.cpp | #include "IterationNumberBasedTimeStepping.h"
#include <algorithm>
#include <cassert>
#include <cmath>
#include <limits>
#include <utility>
namespace NumLib
{
IterationNumberBasedTimeStepping::IterationNumberBasedTimeStepping(
double const t_initial, double const t_end, double const min_dt,
double const max_d... | ALGO | 0.999598 | 6.541481 |
c677a375-972f-4e2d-9e94-a1c8a27e943a | akshayupadhyay008/CpTemplate1 | cp22.cpp | #include <bits/stdc++.h>
using namespace std;
/*
// Ordered-Set (PBDS)
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define os_find(k) os.f... | ALGO | 0.99996 | 3.951128 |
131467cd-c5c6-4e4c-b797-e5fce4f99cba | TrakJohnson/mines-cpp-chaleur | includes/eigen-3.4.0/doc/examples/Tutorial_ArrayClass_interop.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace Eigen;
using namespace std;
int main()
{
MatrixXf m(2,2);
MatrixXf n(2,2);
MatrixXf result(2,2);
m << 1,2,
3,4;
n << 5,6,
7,8;
result = (m.array() + 4).matrix() * m;
cout << "-- Combination 1: --" << endl << result << endl << e... | ALGO | 0.999365 | 4.531452 |
9418b707-1bb2-4a6d-b6cc-f5c75a39c48f | kisarur/minimap2-fpga | opencl/includes/xcl2/xcl2.cpp | #include "xcl2.hpp"
#include <climits>
#include <sys/stat.h>
#include <string>
#include <iomanip>
#include <sstream>
#if defined(_WINDOWS)
#include <io.h>
#else
#include <unistd.h>
#endif
namespace xcl {
std::vector<cl::Device> get_devices(const std::string& vendor_name) {
size_t i;
cl_int err;
std::vector... | TOOL | 0.968228 | 5.348813 |
8817b0a3-a711-4188-873e-69eb2322cf60 | sunnybhardwaj2027/sigma | day_12/countingSort.cpp | // counting sort - O(n + range)
// idea -- use a frequency count of element for min to max.
// it gives best complexity if all the numbers are positive and range is very less. ~ O(n)
#include<iostream>
#include<climits>
using namespace std;
void printSortedArray(int *arr, int n){
for (int i = 0; i < n; i++){
... | ALGO | 0.999975 | 5.969265 |
8a69ab98-98fb-4120-be92-4b3c973794c0 | MWD-IOT/c | 数据结构/数据结构-实验/SY_5/Dance.cpp | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "Status.h"
typedef struct{
int id; //
int height; //
int refuse; //뱻ܾŮܾ
int totalRefuse; //ܾܾܴ
int finished; //ɵ
}stuType; //ѧϢ
typedef int QElemType; //Ԫ
#include "CirQueue.h"
Cir... | ALGO | 0.985902 | 3.725527 |
1953aa57-a349-4e44-92d4-172b34a081a4 | wzds2015/RemoteSensing_Geophysics | InSAR_algorithms/APS_ramp_removal_wrapped/cor_ramp_aps_wrap_CPP/main.cpp | #include <iostream>
#include <vector>
#include <string>
#include <sys/stat.h>
#include <fstream>
#include <math.h>
#include <algorithm>
using namespace std;
// prototype
template <typename T>
vector<T> diff_mat(T *ar, const int col1, const int line1, const char order1, float th=0);
vector<float> retrieve_phase(float ... | ALGO | 0.983033 | 3.236233 |
b08f0a42-cf29-45bb-9bc9-a0e778ac6a49 | sultancodess/leetcode- | C++/design-circular-queue.cpp | // Time: O(1)
// Space: O(k)
class MyCircularQueue {
public:
/** Initialize your data structure here. Set the size of the queue to be k. */
MyCircularQueue(int k) :
start_(0),
size_(0),
buffer_(k, 0) {
}
/** Insert an element into the circular queue. Return true i... | ALGO | 0.998976 | 6.088099 |
6e3472db-7a45-473b-a7ee-e5e5b470f9e1 | Shubhodaya/Leetcode | 20-valid-parentheses/valid-parentheses.cpp | class Solution {
public:
bool isValid(string s) {
stack<char>st;
st.push(s[0]);
for( int i=1;i<s.size();i++){
if(st.size()==0 && (s[i]==')' || s[i]=='}' || s[i]==']'))return 0;
char t;
if(st.size()) t=st.top();
if( s[i]=='(' || s[i]=='{' || s[i]=='[... | ALGO | 0.999695 | 5.973962 |
17464ee1-ea91-40bc-b29b-d31e24d5fb3b | ishandutta2007/codeforces | jaroslavurban/normal/1389/A.cpp | #define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
//#define int ll
//#define endl '\n'
// use unique(x) - removec consecutive items, returns vec.begin() + number of items
// for vector: sort(all(vec)); vec.erase(unique(all(vec)), vec.end());
// use i... | ALGO | 0.999779 | 5.00218 |
3e4ce6ef-4862-404c-8e61-d216bd0f188f | rogerli2020/Monte-Carlo-Option-Price-Calculator-Website | archive/black_scholes.cpp | #include "black_scholes.h"
#include <cmath>
#include <stdexcept>
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
#ifndef M_SQRT1_2
#define M_SQRT1_2 0.70710678118654752440
#endif
double normalCDF(double value)
{
return 0.5 * erfc(-value * M_SQRT1_2);
}
double blackScholesCall(double S, double K, double... | ALGO | 0.999016 | 6.798435 |
6a238e87-bb9e-40fc-b6d5-f878563db2f4 | andyjaramillo/godot_build | thirdparty/icu4c/common/uhash.cpp | #include "uhash.h"
#include "unicode/ustring.h"
#include "cstring.h"
#include "cmemory.h"
#include "uassert.h"
#include "ustr_imp.h"
/* This hashtable is implemented as a double hash. All elements are
* stored in a single array with no secondary storage for collision
* resolution (no linked list, etc.). When there... | ALGO | 0.996873 | 6.858666 |
d987769d-cad6-40fb-be57-fa4559ae70d6 | Amogha-Mayya/DS-STL | DS-Algorithms/SEARCHING/linear_search.cpp | //LINEAR SEARCH ALGORITHM.....
#include<iostream>
using namespace std;
int linear_search(int arr[],int n,int x)
{
int count=0;
for(int i=0;i<n;i++)
if(arr[i]==x){
cout<<"element found at : "<<i<<endl;
count ++;
}
return count;
}
int main(){
int arr[10],n,x;
... | ALGO | 0.999579 | 4.619547 |
63ef5ce5-78bf-49cf-b2fa-4a45f4776a81 | gpoussel/copro-plus | codeforces/problems-01xx/0158/E.cpp | #include <algorithm>
#include <array>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <numbers>
#include <set>
#include <string>
#include <vector>
using namespace std;
#define nl '\n'
#define deb(x) cerr << #x " = " << x << nl
#define EPSILON 1e-9
#d... | ALGO | 0.999934 | 4.187213 |
593d398e-0edb-4947-9b29-7d14512c771f | MDRobiulhassan/Codeforces | 1807D.cpp | //Time Limit Exceed
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
#define ll long long
int main()
{
int t;
cin >> t;
while (t--)
{
int n, q, l, r, k;
cin >> n >> q;
int a[n], c[n];
for (int i = 0; i < n; i++)
{
cin ... | ALGO | 0.99965 | 3.696621 |
92d4ae64-857b-4680-8806-c6e18093e639 | SivasubramaniKP/tempDAA | Greedy/Kruskal.cpp | #include <filesystem>
#include <iostream>
#include <vector>
#include <queue>
#include <unordered_map>
#include <algorithm>
class Edge {
public:
int source;
int weight;
int destination;
Edge ( int s, int w, int d ) : source(s), weight(w),destination(d) {};
};
class DisjointSet {
public:... | ALGO | 0.999967 | 5.055557 |
0cb66b3b-fe38-479c-a3a1-1474ec4217fd | yiftachn/krembot_sim_fork | argos3/src/plugins/simulator/physics_engines/dynamics3d/bullet/BulletCollision/Gimpact/btContactProcessing.cpp | #include "btContactProcessing.h"
#define MAX_COINCIDENT 8
struct CONTACT_KEY_TOKEN
{
unsigned int m_key;
int m_value;
CONTACT_KEY_TOKEN()
{
}
CONTACT_KEY_TOKEN(unsigned int key, int token)
{
m_key = key;
m_value = token;
}
CONTACT_KEY_TOKEN(const CONTACT_KEY_TOKEN& rtoken)
{
m_key = rtoken.m_key;
... | ALGO | 0.997883 | 5.085586 |
99388e5d-e07b-4723-8b7b-57659707df9d | siiyayu/Algorithms-specialization | course2/week4_binary_search_trees/2_is_bst/is_bst.cpp | #include <algorithm>
#include <iostream>
#include <vector>
using std::cin;
using std::cout;
using std::endl;
using std::vector;
struct Node {
int key;
int left;
int right;
Node() : key(0), left(-1), right(-1) {}
Node(int key_, int left_, int right_) : key(key_), left(left_), right(right_) {}
};
bool IsBin... | ALGO | 0.999819 | 6.141661 |
b91b26df-5106-4c19-86ec-a34e27551b5f | griffin28/sandbox | extern/glm/test/gtx/gtx_fast_trigonometry.cpp | #include <glm/ext/scalar_ulp.hpp>
#define GLM_ENABLE_EXPERIMENTAL
#include <glm/gtc/type_precision.hpp>
#include <glm/gtx/fast_trigonometry.hpp>
#include <glm/gtx/integer.hpp>
#include <glm/gtx/common.hpp>
#include <glm/gtc/constants.hpp>
#include <glm/gtc/vec1.hpp>
#include <glm/trigonometric.hpp>
#include <cmath>
#i... | TEST | 0.964668 | 6.277224 |
11663c18-4351-42c0-a2f3-b68d8948ee88 | srikumar947/effective-barnacle | LC/Linked_Lists/Medium/add_two_numbers_1.cpp | /*
You are given two non-empty linked lists representing two non-negative integers.
The digits are stored in reverse order and each of their nodes contain a single digit.
Add the two numbers and return it as a linked list.
You may assume the two numbers do not contain any leading zero, except the number 0 itself.
I... | ALGO | 0.999984 | 5.883004 |
bb12166f-f88a-4c7c-b647-461a82e6f932 | Chandrashekharsk/dsa_cpp | day49/oops/moveSemantics.cpp | #include <iostream>
using namespace std;
void swap(int& a, int& b) {
int temp = a;
a = b;
b = temp;
}
void swap2(int* a, int* b) {
int temp = *a; // Dereference the pointer to get the value
*a = *b; // Assign the value pointed by b to a
*b = temp; // Assign the temp value to b
}
void swap3(i... | ALGO | 0.995578 | 6.133305 |
c1eec2ed-29a3-4174-a128-face8fc307dc | Premkumar2312-pw/SkillRack | Daily Test/C++/College Events - Students 31.5.2025.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
int n, h1, m1, h2, m2;
cin >> n;
vector<pair<int, int>> e;
for(int i = 0; i < n; i++) {
char c;
cin >> h1 >> c >> m1 >> h2 >> c >> m2;
int s = h1 * 60 + m1;
int t = h2 * 60 + m2;
... | ALGO | 0.999968 | 4.301863 |
ff80af48-7212-41a5-8a7f-78cff498868a | yooonmyong/algorithm | programmers/브루트포스_카펫.cpp | #include <string>
#include <vector>
#include <algorithm>
using namespace std;
bool comp(const int &a, const int &b)
{
return a > b;
}
vector<int> solution(int brown, int yellow) {
vector<int> answer = { 2, 2 };
int row = 1, column;
// int yellowrow = 1;
brown -= 4;
// 카펫이 정사각형일 때를 따로 나눴는데 굳이 이럴... | ALGO | 0.998085 | 5.424168 |
a2044f30-c563-4484-912e-cb152741fbd6 | WohlSoft/libFreeImage | Source/FreeImage/Halftoning.cpp | #include "FreeImage.h"
#include "Utilities.h"
static const int WHITE = 255;
static const int BLACK = 0;
// Floyd & Steinberg error diffusion dithering
// This algorithm use the following filter
// * 7
// 3 5 1 (1/16)
static FIBITMAP* FloydSteinberg(FIBITMAP *dib) {
#define RAND(RN) (((seed = ... | ALGO | 0.997498 | 6.142759 |
30e0792f-a668-4604-bf4f-1b3ebad01953 | sarvex/leetcode-basic | solution/0500-0599/0542.01 Matrix/Solution.cpp | class Solution {
public:
vector<vector<int>> updateMatrix(vector<vector<int>>& mat) {
int m = mat.size(), n = mat[0].size();
vector<vector<int>> ans(m, vector<int>(n, -1));
queue<pair<int, int>> q;
for (int i = 0; i < m; ++i) {
for (int j = 0; j < n; ++j) {
... | ALGO | 0.999983 | 6.353415 |
d2f1be88-936b-4330-9d7a-233ebe6c3371 | imreszepesi/Prog_1 | Ch_21/drill-Ch21_vector1.cpp | #include <iostream>
#include <stdexcept>
#include <vector>
#include <fstream>
#include <string>
#include <list>
#include <algorithm>
struct Item {
std::string name;
int iid;
double value;
};
std::ostream& operator<<(std::ostream& os, const Item& it){
return os << it.name << '\t'
<< it.iid << '\t'
<< it.... | TOOL | 0.991105 | 4.897231 |
5d595897-bc6b-4533-8674-07680bcca334 | Abidur24/Codeforces | 1760A - Medium Number.cpp | // In the name of Allah.
// We're nothing and you're everything.
// Ya MAALIK-UL-MULK!!!
/*
Indeed, my prayer, my rites of sacrifice,
my living and my dying are for Allah, Lord of the worlds
*/
#include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
int a,b,c;
cin>>t;
for(int i=1;i<=t;i++)
... | ALGO | 0.999906 | 3.989964 |
f2912458-cd24-4439-b76a-b58cb7ef5e61 | akingse/learn_cpp | ProjectPPC/geometry/ParaNearestCatchIndex.cpp | #include "pch.h"
using namespace std;
using namespace para;
// mouse catch algorithm
typedef pair<short, pair<double, double>> pair_ParaCube;
bool cmp_less_vec(pair_ParaCube a, pair_ParaCube b) // operator<
{
double aNorm = a.second.first;
double bNorm = b.second.first;
double aDeep = a.second.second;
... | ALGO | 0.998232 | 4.256067 |
e275c508-9234-43f6-b0cf-3a99221f8a9a | laas-graveyard/llvs | src/MonoSlam/monoslamhrp_velocities.cpp | #include "Scene/control_general.h"
#include "monoslamhrp.h"
#ifdef VERBOSE
#undef VERBOSE
#endif
#define VERBOSE false
#include <VNL/sample.h>
bool MonoSLAMHRP::GoOneStepHRP(const VW::ImageMono<unsigned char> *new_image,
double delta_t,
bool currently_mapping_flag,
bool use_vision_flag,... | ALGO | 0.968145 | 4.220471 |
61c76bb5-9a12-4e4a-8c37-871461166d6a | Project-Traunce/.github | src/pubkey.cpp | #include <pubkey.h>
#include <secp256k1.h>
#include <secp256k1_recovery.h>
#include <secp256k1_schnorrsig.h>
namespace
{
/* Global secp256k1_context object used for verification. */
secp256k1_context* secp256k1_context_verify = nullptr;
} // namespace
/** This function is taken from the libsecp256k1 distribution and... | TOOL | 0.915051 | 7.428119 |
8032ef24-9254-4964-a5fd-817d307d0756 | raincross7/code-similarity | codes/train_code/problem030/problem030_300.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int64_t n,a,b;
cin >> n >> a >> b;
int64_t cnt=n/(a+b);
int64_t caat=n%(a+b);
if(caat>a)caat=a;
cout << a*cnt+caat << endl;
}
| ALGO | 0.999891 | 3.130066 |
0ad9cd27-ba21-4c49-a25b-646cca8d05b7 | Sheeba02M/Hacktoberfest-2021 | Dfs.cpp | lines (48 sloc) 1.07 KB
#include<bits/stdc++.h>
using namespace std;
class Solution {
void dfs(int node, vector<int> &vis, vector<int> adj[], vector<int> &storeDfs) {
storeDfs.push_back(node);
vis[node] = 1;
for(auto it : adj[node]) {
if(!vis[it]) {
dfs(i... | ALGO | 0.999947 | 6.179239 |
974a1765-8274-4055-9517-e0c1977e7acb | jordandong/mylintcodes | LINT_00071_BinaryTreeZigzagLevelOrderTraversal.cpp | /*
Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to right, then right to left for the next level and alternate between).
Example:
Given binary tree {3,9,20,#,#,15,7},
3
/ \
9 20
/ \
15 7
return its zigzag level order traversal as:
[
[3],
[20,... | ALGO | 0.999999 | 6.092901 |
82e6fc91-2540-4c18-8c6f-8f87170a6deb | zayim/ProgrammingIntro | AV6/AV6Z3.cpp | #include <iostream>
#include <cmath>
using namespace std;
int main()
{
int n,i;
double a[100],s=0.0;
cout << "Unesi n: "; cin >> n;
cout << "Unesi niz: ";
for (i=0; i<n; i++) cin >> a[i];
while (n--) s=sqrt(s+a[n]);
cout << "Rezultat: " << s << endl;
return 0;
}
| ALGO | 0.99917 | 3.637028 |
1dfe11f2-423a-45c9-869d-e262a3719d6a | samyakkhabiya/Leetcode | 36-valid-sudoku/36-valid-sudoku.cpp | class Solution {
public:
bool isValidSudoku(vector<vector<char>>& board) {
vector<set<int>> rows(9), cols(9), blocks(9);
for (int i = 0; i < 9; i++) {
for (int j = 0; j < 9; j++) {
if (board[i][j] == '.') continue;
... | ALGO | 0.999479 | 6.980935 |
cef1db05-5803-4440-965c-66e8bee59c9e | GeeKY03/cppcodesolutions | hgfjgjfgjfgfgf.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long int> vlli;
#define pb push_back
#define endl '\n'
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);
int main(){
IOS
auto start1 = std::chrono::high_resolution_clock::now();
// freopen("input.txt","... | ALGO | 0.999736 | 4.159835 |
c74e1d6a-a3c3-4c9e-a72c-2cffafdef65f | DodgeHo/VMD_2D_cpp | Eigen/bench/quat_slerp.cpp | #include <iostream>
#include <Eigen/Geometry>
#include <bench/BenchTimer.h>
using namespace Eigen;
using namespace std;
template<typename Q>
EIGEN_DONT_INLINE Q nlerp(const Q& a, const Q& b, typename Q::Scalar t)
{
return Q((a.coeffs() * (1.0-t) + b.coeffs() * t).normalized());
}
template<typename Q>
EIGEN_DONT_INL... | ALGO | 0.990308 | 6.251058 |
a2cbb9a8-159b-4326-b6f2-d8d00af7cd8f | nusrat-rima/Algoritms-2103 | Array_insertion.cpp | #include <iostream>
using namespace std;
void display_arr(int arr[], int size);
int main()
{
int arr[10] = {10, 20, 30, 40, 50};
int size = 5;
int new_element = 25;
int index = 3;
cout << "before insertion :" << endl;
display_arr(arr, size);
for (int i = size; i >= index; i--)
{
arr[i + 1] = arr[i];... | ALGO | 0.999627 | 4.531365 |
6c258e6d-988b-4f2b-96cb-42fdb3098e21 | LittleYang0531/CQ-CSP-S-2021 | CQ-00347/palin/palin.cpp | #include <cstdio>
#include <cmath>
using namespace std;
int main() {
freopen("palin.in", "r", stdin);
freopen("palin.out", "w", stdout);
int t;
scanf("%d", &t);
while (t--)
printf("-1\n");
return 0;
}
| ALGO | 0.978579 | 3.073238 |
7785fed4-c400-4dd9-aa20-7dafc1c5dc25 | SakshiParashar29/DSAPractice | Backtracking/Maximum Number of Achievable Transfer Requests.cpp |
class Solution {
public:
int res = 0;
bool check(vector<int> freq)
{
for(int i = 0; i < freq.size(); i++)
{
if(freq[i] != 0)
return false;
}
return true;
}
void solve(int i, vector<vector<int>>& requests, vector<int> freq, int cnt)
{
... | ALGO | 0.999608 | 5.921706 |
4b25fbec-8ca6-4767-881d-6b5ea3ae475e | Keshav7891/Leetcode-Solutions | Get minimum element from stack - GFG/get-minimum-element-from-stack.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
/*
The structure of the class is as follows
class _stack{
stack<int> s;
int minEle;
public :
int getMin();
int pop();
void push(int);
};
*/
class Solution{
int minEle;
stack<int> s;
stack<int> mine;
... | ALGO | 0.999742 | 5.492452 |
a066701f-f6ea-4c82-adb1-eb0a86e345b9 | lbenc135/Algorithms | Tournament tree/main.cpp | #include <iostream>
using namespace std;
#define MAXN 1048576 //2^20
int t[MAXN];
int n, N=1;
void add(int v, int pos)
{
pos+=N;
for(;pos>0;pos/=2)
t[pos]+=v;
}
int query(int a, int b, int lo, int hi, int r=1)
{
if(a<=lo && b>=hi) return t[r];
if(b<lo || a>hi) return 0;
return query(a, ... | ALGO | 0.999818 | 3.842504 |
d349ad0a-1a4c-4cac-af71-3875e8d08dd2 | Arpit-Payasi/Group-LeCode-James | SnakeGame.cpp | #include <iostream>
#include <cstdlib>
#include <ctime>
#include <conio.h>
using namespace std;
#define ROWS 20
#define COLS 20
#define MAX_SIZE 400
#define UP 'w'
#define DOWN 's'
#define LEFT 'a'
#define RIGHT 'd'
void delay(int milliseconds) {
clock_t start_time = clock();
while (clock() < start... | ALGO | 0.998237 | 6.118003 |
4582071a-0019-431e-935c-f348ef5ae8df | ChengFujia/C-project | CSP(C++)/201409_1.cpp | #include <iostream>
using namespace std;
int a[1005];
int b[1005];
int main()
{
int n;
cin >> n;
for(int i=1;i<=n;i++)
{
cin >> a[i];
b[i] = a[i];
}
int count = 0;
for(int i=1;i<=n;i++)
{
for(int j=1;j<=n;j++)
{
if(b[j] == a[i] + 1)
{
count++;
break;
}
}
}
cout << count << endl;... | ALGO | 0.999855 | 3.379812 |
9c0811b6-b5a9-4fb9-9080-2ad46117a61c | samiakona/Hackerrank | conditionstatement.cpp | #include<iostream>
using namespace std;
int main()
{
int n;
string num[10] = {"Greater than 9","one", "two", "three", "four", "five", "six", "seven", "eight", "nine"};
cin >> n;
if(n > 9)
{
cout << num[0];
}
else
{
cout << num[n];
}
return 0;
}
| ALGO | 0.999306 | 3.512025 |
fa8683fc-f777-4e99-97a1-919758ebaf9e | Harshit2047/LeetCode | 2292-counting-words-with-a-given-prefix/counting-words-with-a-given-prefix.cpp | class Solution {
public:
int prefixCount(vector<string>& words, string pref) {
int count=0;
for(int i=0;i<words.size();i++){
string a=words[i];
bool temp=false;
for(int j=0;j<pref.size();j++){
if(pref[j]==a[j]){
temp=true;
... | ALGO | 0.999928 | 6.030546 |
7af047de-805d-4536-8763-0a50166d7608 | nkvelkov/UP2014 | exercises/exercise7/selectionSortProblem6.cpp | #include <iostream>
using namespace std;
int main()
{
int arr[100];
int x, n;
cin >> n; // >> x;
for(int i = 0; i < n; ++i)
{
cin >> arr[i];
}
for(int i = 0; i < n - 1; ++i)
{
int index = i;
for(int j = i + 1; j < n; ++j)
{
if(arr[j] > ar... | ALGO | 0.999976 | 4.217722 |
f2cb9627-3e64-45d6-aa53-cf853db637c5 | luk1684tw/LeetCode | 26_RemoveDuplicatesFromSortedArray.cpp | #include <iostream>
#include <vector>
using namespace std;
class Solution {
public:
int removeDuplicates(vector<int>& nums) {
int index = 0;
int size = nums.size();
if (size == 0) {
return 0;
}
for (int i = 1; i < size; i++) {
if (nums[i] > nums[i ... | ALGO | 0.999936 | 5.901538 |
0d1009ac-ef3a-4471-bc2a-26477e39e37d | kgcdream2019/Dinasty | src/mnemonics/electrum-words.cpp | /*!
* \file electrum-words.cpp
*
* \brief Mnemonic seed generation and wallet restoration from them.
*
* This file and its header file are for translating Electrum-style word lists
* into their equivalent byte representations for cross-compatibility with
* that method of "backing up" one's wallet keys.
*/
#i... | TOOL | 0.91656 | 6.725127 |
cbd050e6-3f65-42aa-8b8f-1e1b81e6b439 | xiezy0/MultiParty-PSI | thirdparty/win/miracl/miracl_osmt/source/super2.cpp | //
// Simple Program to find number of points on supersingular curves over GF(2^p)
//
// Either y^2+y=x^3+x
// or y^2+y=x^3+x+1
//
// See "Elliptic Curve Public Key Cryptosystems", Menezes,
// Kluwer Academic Publishers, Chapter 3
//
// Requires: big.cpp ec2.cpp
//
//
#include <iostream>
#include <iomanip>
#incl... | ALGO | 0.963912 | 3.815095 |
6544a798-1127-4088-b94a-34b6224da4a7 | chandra-prakash-khudia/cppCodeBase | 2darray/rotate90.cpp | #include<iostream>
using namespace std;
int main(){
int temp=0;
int arr[4][4]={1,2,3,4
,5,6,7,8
,9,10,11,12
,13,14,15,16};
for(int i=0;i<4;i++)
{
for(int j=i;j<4;j++)
{
temp =arr[i][j];
arr[i][j]=arr[j][i];
arr[j]... | ALGO | 0.999948 | 3.507564 |
1e0517a9-35b7-49d2-8938-f2fbb958dd92 | DuyAn1723/BTVN | chuong9/Program 9.12.cpp | #include <iostream>
#include <algorithm>
// Hàm tính điểm trung bình
double tinhDiemTrungBinh(int* diem, int soLuongDiem) {
int tongDiem = 0;
for (int i = 0; i < soLuongDiem; i++) {
tongDiem += diem[i];
}
return static_cast<double>(tongDiem) / soLuongDiem;
}
int main() {
int soLuongDiem;
... | ALGO | 0.999401 | 6.660387 |
359e8279-9ff9-4259-abf8-056fef3e3d4b | CyanogenMod/android_external_llvm | lib/Transforms/Utils/SimplifyInstructions.cpp | #define DEBUG_TYPE "instsimplify"
#include "llvm/Transforms/Scalar.h"
#include "llvm/ADT/DepthFirstIterator.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/Dominators.h"
#include "llvm/Analysis/InstructionSimplify.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/Function... | TOOL | 0.873622 | 7.747487 |
c6c121e2-1105-459e-b359-f10214266072 | NandiSoham/Leetcode-POTD-Daily-Coding-Challenge | Year 2024/09_September/day04_874. Walking Robot Simulation.cpp | // Problem Link -> https://leetcode.com/problems/walking-robot-simulation/description/
class Solution {
public:
int robotSim(vector<int>& commands, vector<vector<int>>& obstacles) {
unordered_set<string> obstacleSet;
for(auto &it : obstacles){
string obstacleKey = to_string(it[0]) + '-'... | ALGO | 0.999789 | 5.544322 |
81d02316-8811-4048-a1a5-d91cde9309a0 | steventan1011/DataStructures-C-Programming | Sort Algorithms/MergeSort.cpp | #include<stdio.h>
/*
1. Divide an input sequence of length n into two subsequences of length n / 2;
2. Merge and sort these two subsequences respectively;
3. Combines two sorted subsequences into a final sorted sequence.
*/
void Merge_Sort(int *arr, int *temparr,int start,int mid,int end)
{
int left_star... | ALGO | 0.99994 | 4.299465 |
74235198-a4b6-40e0-910d-0f7639f12142 | q545244819/leetcode | 2020-12/103.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
vector<vector<int>> zigzagLevelOrder(TreeNode* root) {
if (root == NULL)
re... | ALGO | 0.999984 | 6.182446 |
da82f584-dca0-4b9e-92dc-b36b843ff612 | kazama679/ss12-C | bai1.cpp | #include<stdio.h>
int main() {
int n;
printf("Nhap n: ");
scanf("%d", &n);
if (n <= 0) {
printf("Khong co gia tri lon nhat\n");
return 0;
}
int arr[n];
for (int i = 0; i < n; i++) {
printf("Nhap vao phan tu %d trong mang: ", i + 1);
scanf("%d", &arr[i]);
... | ALGO | 0.999062 | 3.882243 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.