uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
f7491b7a-5953-4f66-9e67-2ccdc3638d87 | WohnJaskom/NeuralNetwork | src/Net.cpp | #include "../include/Net.hpp"
#include "../include/boost/algorithm/string/case_conv.hpp"
#include <iostream>
#include <algorithm>
using namespace std;
string activationFunctions[] =
{
"relu"
};
// Class Neuron
Neuron::Neuron(unsigned numOutputs)
{
for (unsigned c = 0; c < numOutputs; ++c) {
m_output... | ALGO | 0.990122 | 4.819241 |
6ca4e838-f147-48f1-91d3-bc57b3141255 | ShpakovNikita/crypto-algorithms | algorithms/elliptical_signature/elliptical_signer.cpp | #include "elliptical_signer.hpp"
#include <random>
#include <limits>
#include <ios>
#include <iosfwd>
#include <iomanip>
#include <sstream>
#include <iostream>
#include "gost_hash.hpp"
#include "prime_utils.hpp"
#include "elliptical_point.hpp"
constexpr uint64_t KEY_ALIGN = 64;
const std::string DEFAULT_HASH_KEY = "... | ALGO | 0.997047 | 6.553158 |
191873de-e2ad-451b-831e-7a0c9bc88740 | zeroo0o0/Learning | GAMES101笔记及作业/Homework/Hw7/my/BVH.cpp | #include <algorithm>
#include <cassert>
#include "BVH.hpp"
BVHAccel::BVHAccel(std::vector<Object*> p, int maxPrimsInNode,
SplitMethod splitMethod)
: maxPrimsInNode(std::min(255, maxPrimsInNode)), splitMethod(splitMethod),
primitives(std::move(p))
{
time_t start, stop;
time(&start);... | ALGO | 0.998857 | 6.08783 |
c7d8791b-223f-45fb-821d-7089a9361cc3 | skti-dev/mobile-flutter | app_01_meu_perfil/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.998314 | 6.797273 |
2153debe-613d-47aa-9374-a239d9d34769 | riyaroy-tech/DSA | Strings/1392. Longest Happy Prefix.cpp | //https://leetcode.com/problems/longest-happy-prefix/submissions/907878087/
class Solution {
public:
//Tc -> O(N)
//Sc -> O(1)
string longestPrefix(string s) {
long l=0,r=0,mul=1;
long mod = 1000000007;
long len=0;
// int l = "";
//int i,j;
for(int i=0,j=s.si... | ALGO | 0.999992 | 6.00763 |
73f85c9c-2a2b-4f1b-b717-8cd1992fd504 | ishandutta2007/codeforces-s | sutaner/normal/1299/B.cpp | #include <bits/stdc++.h>
#define rep(i, l, r) for (register int i = l; i <= r; i++)
#define per(i, r, l) for (register int i = r; i >= l; i--)
#define srep(i, l, r) for (register int i = l; i < r; i++)
#define sper(i, r, l) for (register int i = r; i > l; i--)
#define erep(i, x) for (register int i = h[x]; i; i = e[i].... | ALGO | 0.999959 | 3.619764 |
264cc438-eb3a-464b-92f7-dd344d431918 | Muhdhammad/dsa-learnings | Trees/Binary Tree.cpp | #include <iostream>
#include <queue>
using namespace std;
struct Node {
int data;
Node *left;
Node *right;
};
Node *CreateNode(int data) {
Node *newNode = new Node();
newNode->data = data;
newNode->left = newNode->right = NULL;
return newNode;
}
Node *InsertNode(Node *root, int data) {
if (root == NU... | ALGO | 0.999987 | 5.732182 |
42e2be04-c020-4d2b-9538-cd7340bdf521 | MiguelTaibo/MT_CSES_ProblemSet | Sorting&Searching/sumOf4Values.cpp | #include <bits/stdc++.h>
using namespace std;
#define FOR(n) for (int i=0; i<n;i++)
#define SPACE << " " <<
typedef long long ll;
const int mxn = 1e5;
int x,n;
array<int,2> a[mxn];
bool solve2SUM(int ini, int x, int &v1, int &v2) {
int i = ini;
int j = n-1;
while (i<j) {
if (a[i][0]+a[j][0]==x) {
v1... | ALGO | 0.999996 | 4.147074 |
e9ab8c47-8831-4815-9233-6b205aac8ac5 | wide-world/algorithm-samsungsds | Day8_동적계획법1/2579_계단오르기.cpp | #include <bits/stdc++.h>
#define MAX 301
using namespace std;
int N;
int DP[MAX];
int score[MAX];
int main(void) {
ios::sync_with_stdio(false); cin.tie(NULL);
cin >> N;
for (int i = 1; i <= N; i++)
cin >> score[i];
DP[1] = score[1];
DP[2] = score[1] + score[2];
for (int i = 3... | ALGO | 0.999951 | 4.622487 |
732c4847-0258-4052-beb0-1cb5f3f18607 | cyscgzx33/Leetcode-Practice | Others/ladder/Implicit_DFS_10_split_string.cpp | class Solution {
public:
void dfs(std::vector<std::string>& result,
std::vector<std::vector<std::string>>& results,
int start_index,
std::string& s,
bool is_last_elem_couple)
{
if ( start_index == s.size() ) {
results.push_back(result);
return;
}
std::string cur_str = "";
re... | ALGO | 0.999597 | 6.136297 |
65e5eb8b-677e-4625-a08d-7a39557c567d | samar-gupta/DSA_POTD | Leetcode/Max Sum of a Pair With Equal Sum of Digits.cpp | //Leetcode Link : https://leetcode.com/problems/max-sum-of-a-pair-with-equal-sum-of-digits
//Approach-1 (Brute Force)
//T.C : O(n^2 * m), m = number of digits
//S.C : O(1)
class Solution {
public:
int getDigitSum(int num) {
int sum = 0;
while(num > 0) {
sum += (num % 10);
... | ALGO | 0.999989 | 6.363487 |
ae9057c8-9a25-4553-a68d-dd3e973188ec | muhammadakfz/Algorithm-Adventures | codeforces/116A.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n; cin >> n;
int cap = 0, cur = 0, a, b;
while(n--) {
cin >> a >> b;
cur -= a;
cur += b;
if(cur > cap) cap = cur;
}
cout << cap;
return 0;
} | ALGO | 0.999803 | 3.927949 |
a49470a0-d7e0-44c2-9823-76d25e3a4f41 | rcanoaparicio/atcoder | beginner_contest_342/d.cpp | #include <iostream>
#include <vector>
#include <unordered_map>
using namespace std;
bool is_square(const int n) {
if (n == 1) return true;
for (int i = 1; i <= n; i++) {
if (i * i == n) {
return true;
}
}
cout << n << " not square" << endl;
return false;
}
int main() {
int N, a, res = 0;
... | ALGO | 0.999925 | 4.200802 |
def9a419-fd43-419f-bb02-ceeeb6c0c854 | ArefinAlter/ProblemSolving | codeforces/818/G.cpp | #include<bits/stdc++.h>
using namespace std;
const int N = 6030;
struct MCMF {
using T = int; static const T inf = 1e9 + 7;
int n, m, s, t; bool vis[N];
int par[N], pos[N]; T pot[N], dis[N], left[N];
priority_queue <pair <T, int>> q;
struct edge {
int to, rev; T cap, cost, flow; int id;
... | ALGO | 0.999974 | 3.58838 |
4c5ac261-fc04-47d0-8c0e-eb393a7ff577 | zhawhjw/PBO | eigen-3.4.0/doc/examples/Tutorial_ArrayClass_mult.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace Eigen;
using namespace std;
int main()
{
ArrayXXf a(2,2);
ArrayXXf b(2,2);
a << 1,2,
3,4;
b << 5,6,
7,8;
cout << "a * b = " << endl << a * b << endl;
}
| ALGO | 0.995253 | 3.527115 |
a9190645-551c-444c-b6b5-88cc8ff31554 | kimjs98/algorithm | backjoon/7576_tomato.cpp | #include <cstring>
#include <iostream>
#include <queue>
using namespace std;
#define MAX 1001
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
int m, n;
int map[MAX][MAX];
int dist[MAX][MAX];
queue<pair<int,int>> q;
void Bfs(void)
{
while(!q.empty())
{
int x = q.front().second;
int y = q.front().first;... | ALGO | 0.999365 | 3.637875 |
0c959518-6a73-43bd-800e-bc47445028be | SyedRouhanAli/C-practice | lec13.cpp | #include<iostream>
using namespace std;
void swapPointer(int* a ,int* b){ /*--------------call by reference using pointers------------*/
int temp=*a;
*a=*b;
*b=temp;
}
int main(){
int a=4, b=5;
/*cout<<"the sum of 4 and 5 is "<<sum(a,b);
*/
cout<<"the value of a is "<<a<<" and value of b is "<<b<<endl;
swapPoi... | ALGO | 0.999441 | 4.7575 |
bff08bae-c855-4ca8-9ff9-7c92687afe88 | Shailesh93602/potd | leetcode/2025/july/13/13.cpp | class Solution {
public:
int matchPlayersAndTrainers(vector<int>& players, vector<int>& trainers) {
sort(players.begin(), players.end());
sort(trainers.begin(), trainers.end());
int m = players.size(), n = trainers.size(), count = 0;
for(int i=0, j=0; i<m && j<n; i++, j++) ... | ALGO | 0.999857 | 5.473117 |
4ded7112-985a-496b-8456-374db8bcd0e9 | MOHDDANISH007/Question1 | count_words.cpp | #include <bits/stdc++.h>
#include <iostream>
#include <cstring>
using namespace std;
int countWords(string input) {
int words = 1;
if(input.size() == 0){
return 0;
}
else{
for(int i=0; i<input.size(); i++){
if(input[i] == ' '){
words++;
}
... | ALGO | 0.998038 | 4.798368 |
f3925449-3523-4901-afc2-a05bbfae0995 | joker-eph/llvm-project-with-mlir | libc/src/math/round/round.cpp | #include "src/math/round/round.h"
#include "src/__support/common.h"
namespace llvm_libc {
double __round_redirector(double x);
double LLVM_LIBC_ENTRYPOINT(round)(double x) {
return __round_redirector(x);
}
} // namespace llvm_libc
| TOOL | 0.955761 | 6.753097 |
6a1cffa9-483e-4420-8146-8c2cf12afe1e | raokartikkumar24/CodingCompetition | Hackerrank/zen2.cpp | #include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
using namespace std;
int main()
{
int T;
cin>>T;
while( T-- ) {
string str;
cin>>str;
int i = 0;
int j = str.length()-1;
while( abs(str[i]-str[i+1]) == abs(str[j]-str[j-1]) && i != j )
{
i++;
j--;
}
if( i < str.length()... | ALGO | 0.982134 | 4.633753 |
8e20de61-24fe-482d-8147-e800dd5c304a | ishandutta2007/codeforces | maroonrk/normal/1326/E.cpp | #include <bits/stdc++.h>
using namespace std;
using ll=long long;
//#define int ll
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define pb push_back
#define eb emplace_back
#define a first
#define b secon... | ALGO | 0.999994 | 3.581795 |
b468f33b-5971-404f-939a-3acbcf6cfd24 | Amit3200/codes_algo | heaps/sir/heap_pq_stl.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
priority_queue<int> pq;
pq.push(10);
pq.push(100);
pq.push(1);
pq.push(1000);
pq.push(10000);
pq.push(11);
while(!pq.empty()){
cout<<pq.top()<<"\n"; //
pq.pop(); //
}
}
| ALGO | 0.999541 | 3.884167 |
a34029d9-2967-44f0-a532-9162f3b7e37a | baluselva-ts/Algorithms | Graph/Dijkstra's.cpp | #include <iostream>
#include <queue>
#include <map>
#include <stack>
#define MIN(a,b) (((a)<(b))?(a):(b))
#define MAX(a,b) (((a)>(b))?(a):(b))
#define ll long long
using namespace std;
int getNextMinUnvisitedNode(vector<int> minDistance, vector<int> isVisited) {
int nextMin = INT_MAX;
int vertexWithMinDistance;
f... | ALGO | 0.999972 | 4.785497 |
b12d06cd-b3b7-4e62-885f-89bf24e16d50 | rupc/boj | 11050/11050.cpp | // input, output
#include <iostream>
#include <iomanip>
// container
#include <vector>
#include <array>
#include <list>
#include <map>
#include <set>
#include <string>
// container adaper
#include <stack>
#include <queue>
#include <deque>
// STL algorithm related
#include <algorithm>
#include <iterator>
#include <func... | ALGO | 0.999956 | 4.847268 |
5357ed10-10ef-47c3-a322-22a35eb42d68 | jncronin/gk-userland | boost-1.85.0/libs/graph/example/bipartite_example.cpp | #include <iostream>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/bipartite.hpp>
using namespace boost;
/// Example to test for bipartiteness and print the certificates.
template < typename Graph > void print_bipartite(const Graph& g)
{
typedef graph_traits< Graph > traits;
typename traits:... | ALGO | 0.999257 | 6.94289 |
6836227c-c1ec-450c-a1c8-54bf3247c7c7 | Bedadha/lab | lab.6.cpp |
#include<bits/stdc++.h>
#include<vector>
using namespace std;
int main()
{
int n,l;
vector <int> v;
cin >> n;
cin >> l;
int i,j;
int a,u,r;
for(i=0;i<n;i++)
{
v.push_back(0);
}
for(j=0;j<l;j++)
{
cin >> a;
if(a==1)
{
cin >> u >> r;
v[u-1]=v[u-1]+r;
}
else if(a==2)
{
int max,k,p;
p=1;
max=v[0];
if(n>... | ALGO | 0.999922 | 3.101088 |
e2825a7d-1f21-4d51-8f9d-1a5cdae1b2b4 | Aadyav-21/graph_cpp | GRAPHS/intro.cpp | #include<iostream>
#include<unordered_map>
#include<list>
using namespace std;
class graph{
public:
unordered_map<int,list<int>>adj;
void addEdge(int u,int v,bool direction){
//direction=0->undirected
//direction=1->directed graph
//create an edge from u to v
... | ALGO | 0.99994 | 5.282517 |
913c210a-4728-4b9a-85c2-adc1ee8d168b | ankit-prasadx/Logic_Development | Program192.cpp | #include<iostream>
using namespace std;
// Problems on N-numbers(array)
class ArrayX
{
public:
int * Arr;
int iSize;
ArrayX(int i)
{
iSize = i;
Arr = new int(iSize);
}
void Accept()
{
cout<<"Please Enter the Numbers : \n... | ALGO | 0.979943 | 3.995089 |
b1d2b461-3396-493f-9db2-abcc24483af9 | priincce/competitiveProgramming | Atcoder/pannasonnic/p1.cpp | #include<bits/stdc++.h>
using namespace std;
using ll= long long int ;
typedef pair<int, int> pii;
typedef pair<ll, ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpii;
typedef vector<pl> vpl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
#define F first
#define S second
#define pb pu... | ALGO | 0.999841 | 3.437944 |
feebe2a4-03f4-487e-a4c1-0591c2344ec5 | Roooobot/Unity-Learning | HybridCLRData/LocalIl2CppData-WindowsEditor/il2cpp/libil2cpp/vm-utils/NativeSymbol.cpp | #include "il2cpp-config.h"
#include "il2cpp-class-internals.h"
#include "os/Environment.h"
#include "os/File.h"
#include "os/Image.h"
#include "os/Initialize.h"
#include "os/LibraryLoader.h"
#include "os/Locale.h"
#include "os/Path.h"
#include "NativeSymbol.h"
#include "utils/Collections.h"
#include "utils/PathUtils.h... | TOOL | 0.906617 | 7.288784 |
9ec5a70f-1fa5-424a-803a-7988f7474cbe | welcomeToVirtualWorld/mynotes | 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 |
6ecf40b9-ce9e-4efd-858b-d7fc6ad203b6 | pravahanj/Data_Structure-and-Algorithm-CodingNinjas.com | Recursion 2/Print Subset Sum to K.cpp | /*
Print Subset Sum to K
Given an array A and an integer K, print all subsets of A which sum to K.
Subsets are of length varying from 0 to n, that contain elements of the array. But the order of elements should remain same as in the input array.
Note : The order of subsets are not important. Just print them in differe... | ALGO | 0.999922 | 4.947661 |
c0fb95bc-460f-42a6-bcf1-b01fdcbcbdb9 | Okandi/neps | ex_feitos/basicos/apaga_numeros.cpp | #include <iostream>
#include <string>
#include <stack>
using namespace std;
string removeSmallestDigitsFromNumber(string number, int qtdDigitosARemover) {
stack<char> numberStack;
for (char digit : number) {
if (numberStack.empty()) {
numberStack.push(digit);
continue;
... | ALGO | 0.999766 | 5.808085 |
f9a81d9a-7d7d-4d04-a836-ba1b08b74f17 | 42-codingtest-study/week-14 | boj_2011.cpp | #include<iostream>
#include<string>
#define endl "\n"
#define MAX 5000
#define Moduler 1000000
using namespace std;
int Arr[MAX];
int DP[MAX] , Len;
string Inp;
void Input()
{
cin >> Inp;
Len = Inp.length();
for (int i = 1; i <= Len; i++)
{
Arr[i] = Inp[i - 1] - '0';
}
}
void Solutio... | ALGO | 0.999967 | 4.582283 |
dd570599-e7ca-44c1-b24b-ac4ff025e2b2 | Illumina/strelka | src/c++/lib/applications/GetChromDepth/ReadChromDepthUtil.cpp | /// \file
/// \author Chris Saunders
///
#include "ReadChromDepthUtil.hh"
#include "blt_util/log.hh"
#include "blt_util/MedianDepthTracker.hh"
#include "blt_util/depth_buffer.hh"
#include "common/Exceptions.hh"
#include "htsapi/bam_header_info.hh"
#include "htsapi/bam_streamer.hh"
#include "starling_common/starling_r... | DATA | 0.865643 | 6.70916 |
4626e998-e9de-480f-82d9-4410bb751858 | vishallalge/TCS-NQT-problem-by-striver | Striver coding questions/02_largest_number_in_array.cpp | #include <bits/stdc++.h>
using namespace std;
// first approach
int bySorting(vector<int>& arr){
sort(arr.begin(), arr.end());
return arr[arr.size()-1];
}
// second approach
int byVariable(int* arr, int n){
int max = arr[0];
for(int i = 0; i < n; i++){
if(max < arr[i]){
max = arr[... | ALGO | 0.999668 | 4.841561 |
92d87479-8ec2-4bbf-a8bd-dfcb77c0cd48 | aerimforest/Algorithm-Study | Baekjoon/hyeonyoung/벽 부수고 이동하기 4.cpp | // 221223_BOJ_16946
#include <iostream>
#include <vector>
#include <queue>
#include <set>
using namespace std;
int N, M;
char board[1001][1001];
int visit[1001][1001];
vector<int> count = {0};
int dx[] = {-1, 1, 0, 0};
int dy[] = {0, 0, -1, 1};
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cin >> ... | ALGO | 0.999968 | 4.047178 |
c0a7ceab-f6a2-41c3-b956-58009104ed12 | allenge007/my_cpp_code | codeforces/Codeforces Round 983 (Div. 2)/d.cpp | #include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
int n, p[maxn];
void solve() {
int las = 0;
cin >> n;
p[1] = 0, p[2] = 1;
for(int i = 2; i < n; i ++) {
cout << "? " << 1 << " " << i << endl;
cout.flush();
int r;
cin >> r;
if(!r) {
... | ALGO | 0.99967 | 3.211695 |
827ce279-4b78-4683-8c38-30b7b7a953f8 | SulbhaAgg/CSC211_Prof_Jerry_Waxman | CSC211PerfectSquare.cpp | /******************************************************************************
Online C++ Compiler.
Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.
******************************************... | ALGO | 0.999274 | 4.431999 |
5535024a-e751-4452-8cb7-35c01bf9dd61 | Ritik2221999/DSA | Trees/kSumPath.cpp | #include<bits/stdc++.h>
using namespace std;
class node {
public:
int data;
node* left;
node* right;
node(int d) {
this -> data = d;
this -> left = NULL;
this -> right = NULL;
}
};
node* buildTree(node* root) {
cout<<"Enter t... | ALGO | 0.999957 | 4.501782 |
ceca5cf3-960e-476c-bd89-49ee20eb1f10 | vinayak-7/dsa_ques | Search a 2D Matrix.cpp | class Solution {
public:
bool searchMatrix(vector<vector<int>>& matrix, int target) {
int row = matrix.size();
int col = matrix[0].size();
int start = 0;
int end = row*col - 1;
while(start<=end)
{
int mid = start + (end-start)/2;
int element ... | ALGO | 0.999925 | 6.072789 |
3908f9e6-b715-4e5b-be89-2afde2faacaa | codenuri/CPPINTER_V3 | CPPINTER_4010_FUNCTION_OBJECT/less2.cpp | #include <print>
template <typename T = void>
struct less
{
bool operator()(const T& a, const T& b) const
{
return a < b;
}
};
template<>
struct less<void>
{
template <typename T1, typename T2>
constexpr auto operator()(T1&& a, T2&& b) const
-> decltype(std::forward<T1>(a) < std::f... | ALGO | 0.929739 | 3.621454 |
1fa9a78a-dab6-471c-9703-fee673d19521 | FalseG0d/Algorithm-Data-Structure | LeetCode/Medium/EvenOddLL.cpp | Node* oddEvenList(Node* head)
{
// Write your code here.
Node*odd = NULL;
Node*eve = NULL;
Node*lastOdd = NULL;
Node*lastEve = NULL;
int pos = 0;
Node* itr = head;
while(itr) {
Node*next = itr->next;
if(pos % 2 == 0) {
if(!odd) {
lastOdd = odd ... | ALGO | 0.999584 | 5.447218 |
ff35facb-2d9e-4968-a0b0-6399b78c7376 | Kristpher/leet_code | 2962-count-subarrays-where-max-element-appears-at-least-k-times/2962-count-subarrays-where-max-element-appears-at-least-k-times.cpp | class Solution {
public:
long long countSubarrays(vector<int>& nums, int k) {
int maxim = 0;
long long val = 0;
for (int i = 0; i < nums.size(); i++) {
maxim = max(maxim, nums[i]);
}
int i = 0, j = 0;
int count = 0;
while (j < nums.size()) {
... | ALGO | 0.999972 | 6.167285 |
fe3985fc-daf7-4b65-9f05-d22738aa515a | fatemehkarimi/uvaSolutions | uva-10920.cpp | //uva 10920
//Spiral Tap
#include <iostream>
using namespace std;
int main(void)
{
long long int n = 0, num;
while (true) {
cin >> n >> num;
if (n == 0)
break;
long long int x = n / 2;
long long int y = n / 2;
long long int n_col = 1;
long long int n_row = 1;
bool direction = 1;//1 indicates u... | ALGO | 0.999592 | 4.034355 |
1aa7fc32-ec9b-4cce-a96c-f2b9ff984009 | hatoriren/OctToDec | OctToDec.cpp | #include <iostream>
#include <string>
#include <iomanip>
#include <sstream>
using namespace std;
double octalToDecimal(const string& octal) {
double decimal = 0.0;
double base = 1.0 / 8.0;
for (char digit : octal) {
decimal += (digit - '0') * base;
base /= 8.0;
}
return decimal... | ALGO | 0.996172 | 4.845318 |
e66ba0da-9398-4321-86b9-2b90878853ce | SushiStar/LC | DFS_BFS/Subsets.cpp | /*
* Given a set of distinct integers, nums, return all possible
* subsets (the power set).
*
* Note: The solution set must not contain duplicate subsets.
*
* Date: 04/30/2020
* Author: Wei Du
*/
#include <vector>
#include <iostream>
using namespace std;
class Solution {
public:
vector<vector<int>> subsets... | ALGO | 0.999058 | 6.512611 |
859af2be-c4e5-4f51-9145-42af59dbde66 | unclezhou486/ACM-Solutions | Codeforces/Codeforces Round 1032 (Div. 3)/H.cpp | #include <bits/stdc++.h>
using namespace std;
constexpr int maxn=1e9;
constexpr int nodecnt=100;
struct seg{
int tot,root;
vector<int> cnt,ls,rs,lz,lzmax;
void init(int n){
root=tot=0;
cnt.assign(n*nodecnt,{});
ls.assign(n*nodecnt,{});
rs.assign(n*nodecnt,{});
lz.assign(n*nodecnt,{});
lzmax.assign(n*no... | ALGO | 0.999773 | 4.73237 |
d2faa33e-f1ff-4959-8fa0-2084ba1b000f | shab0001/leetcode-practice-problems | 456-132-pattern/456-132-pattern.cpp | class Solution {
public:
bool find132pattern(vector<int>& nums)
{
stack<int>st;
int top=INT_MIN;
for(int i=nums.size()-1;i>=0;i--)
{
if(nums[i]<top)
{
return true;
}
while(!st.empty() and nums[i]>st.top())
... | ALGO | 0.999942 | 6.357481 |
8f5355fd-7f75-475c-a7dd-9f2e391b1c11 | oxygen-hunter/Flashboom | data/big-vul-100/add_attention_code/Phi/top0-100/find-triangular-sum-of-an-array-Solution.triangularSum/177783_DoS_Exec_Code_Overflow.cpp | void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
int i, j;
Guchar *inp, *tmp_line;
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
tmp_line = (Guchar *) gmalloc (length * nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++... | ALGO | 0.994121 | 4.363569 |
563afa4d-8192-48cf-be8d-f08b7b231800 | aryangupta9680/DSA-Solved-Questions | Extra-Questions/Selection_Sort.cpp | #include <iostream>
using namespace std;
int main(){
int arr[1000];
int n; // size of array
cout << "Enter size of array: ";
cin >> n;
cout << "Enter " << n << " elements in the array: ";
for(int i = 0;i<n;i++)
{
cin >> arr[i];
}
for(int i = 0;i < n-1;i++)
{
in... | ALGO | 0.999669 | 4.595157 |
08e364a5-1d36-4cda-8c83-f3faa19a6763 | Chnmii/Nam1_Ky2 | OOP/ngay_thang.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
multiset<int> s;
long long n, x, res = 0;
cin >> n;
while(n--)
{
cin >> x;
s.insert(x);
}
while(s.size() > 1)
{
long long u = *s.begin();
s.erase(s.begin());
long long v = *s.begin();
... | ALGO | 0.999969 | 4.456057 |
bb0ebcd4-df99-4d14-bb64-895f33583858 | ihays/LeetCode | C++/ToLowerCase.cpp | /***********************************************************************************************
Problem To Lower Case
Developer Ian Hays
Date 05/24/2021
URL https://leetcode.com/problems/to-lower-case/
Space O(1)
Time O(N)
Description iterate through string, if upper case, cha... | ALGO | 0.993056 | 6.329817 |
8300cbe9-3fd0-48f1-87eb-31f2eb798d51 | Rupal48/DAA | 4a_Merge_Sort.cpp | #include <iostream>
using namespace std;
void merge(int arr[], int l, int m, int r)
{
int n1 = m - l + 1;
int n2 = r - m;
int L[n1], R[n2];
for (int i = 0; i < n1; i++)
L[i] = arr[l + i];
for (int j = 0; j < n2; j++)
R[j] = arr[m + 1 + j];
int i=0, j=0, k = l;
while (i <... | ALGO | 0.999965 | 5.047627 |
467dbc9c-31ea-46fb-a44e-e96da5557509 | ikiwihome/hello-algo | codes/cpp/chapter_dynamic_programming/climbing_stairs_constraint_dp.cpp | /**
* File: climbing_stairs_constraint_dp.cpp
* Created Time: 2023-07-01
* Author: ikiwi (<EMAIL>)
*/
#include "../utils/common.hpp"
/* 带约束爬楼梯:动态规划 */
int climbingStairsConstraintDP(int n) {
if (n == 1 || n == 2) {
return 1;
}
// 初始化 dp 表,用于存储子问题的解
vector<vector<int>> dp(n + 1, vector<int>... | ALGO | 0.999996 | 5.803348 |
04e9de0a-1ec9-4bb5-8608-6602cfec8a85 | jrijul1201/URI-Online-Judge | regularsimple.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
long long a, b, ans;
cin >> a >> b;
ans = a * b;
cout << ans << "\n";
return 0;
} | ALGO | 0.996078 | 4.133396 |
cd9c762c-aac0-4789-80e7-0c8595abb38d | ParthP511/FYP | Caeser cIpher Encryption.cpp | #include <iostream>
#include <string>
using namespace std;
string caesar_cipher(string message, int key) {
string cipher = "";
// Iterate over each character in the message
for (int i = 0; i < message.length(); i++) {
char c = message[i];
// Encrypt alphabetic characters by shifting them by the
... | ALGO | 0.999841 | 5.445375 |
2b5f2d38-1342-4c61-948c-71b4047766a6 | raincross7/code-similarity | codes/train_code/problem209/problem209_187.cpp | #include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <functional>
#include <iterator>
using namespace std;
const long long INF = 1e18;
class UnionFind
{
public:
static UnionFind Create(int iTotalNumber)
{
return UnionFind(iTotalNumber);
... | ALGO | 0.999878 | 4.578762 |
9471709e-962d-4d4b-b983-0aa616ae2121 | CDPS/Competitive-Programming | URI/1145-Logical Sequence 2.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int x,y;
scanf("%d %d",&x,&y);
for(int i=1;i<=y;i++){
printf("%d",i);
for(int j=0;j< x-1 && i<y;j++){
i++;
printf(" %d",i);
}
printf("\n");
}
return 0;
}
| ALGO | 0.999899 | 3.096589 |
fc672101-e69a-46e7-b1cd-76aecabb0046 | datnguyenhuy/KTLT_03 | BaiTH03_KTLT/BaiTH04_KTLT/BaiTH04_KTLT.cpp | //#include <iostream>
//using namespace std;
//struct Node {
// int data;
// Node* next;
//
// Node (int data) {
// this->data = data;
// next = NULL;
// }
//};
//
//// push a new element to the beginning of the list
//Node* prepend(Node* head, int data) {
// Node* new_head = new Node(data... | ALGO | 0.996789 | 4.181321 |
cd2e8aa2-756d-4fc1-8071-103a31463492 | AFpine/Problem-Solving | BOJ/15000-19999/17387.cpp | #include <bits/stdc++.h>
// 17383 Line Intersection (Counter Clockwise Algorithm)
// update 220413
using namespace std;
static const int INF = 1e9+1;
struct Point
{
int x;
int y;
};
struct Line
{
Point p1;
Point p2;
};
bool compare(Point left, Point right)
{//true : right point is greater than left point
if... | ALGO | 0.999963 | 3.575483 |
85291c60-c998-4dfb-ae79-6e080f1eebca | AndHager/SysCallStubber | llvm-project/libc/src/string/memmove.cpp | #include "src/string/memmove.h"
#include "src/__support/common.h"
#include "src/stdlib/abs_utils.h"
#include "src/string/memcpy.h"
#include <stddef.h> // size_t, ptrdiff_t
namespace __llvm_libc {
static inline void move_byte_forward(char *dest_m, const char *src_m,
size_t count) {... | TOOL | 0.992888 | 7.702854 |
2b01e607-37df-491b-b435-f2d2ab9600f9 | difx/difx-archive | master_tags/DiFX-2.6/applications/difxfilterbank/transient_wrapper/transient_wrapper.cpp | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include <ctype.h>
#include "transient_wrapper_data.h"
const char program[] = "transient_wrapper";
const char author[] = "Walter Brisken";
const char version[] = "0.2";
const char verdate[] = "2011 Jul 27";
const char defaultConfigFile[] = "... | TOOL | 0.911694 | 5.534397 |
27b2e72d-a46c-494f-a5b3-adf409049c0c | salog0d/DSA | Arrays/Problems/pair_with_sumk.cpp | #include <iostream>
using namespace std;
#include <iostream>
void findPair(int arr[], int n, int targetSum) {
for (int i = 0; i < n - 1; i++) {
for (int j = i + 1; j < n; j++) {
if (arr[i] + arr[j] == targetSum) {
cout << "Pair found at index " << i << " and " << j << std::endl... | ALGO | 0.997116 | 5.595343 |
ed948c00-35fb-4da3-a3cf-f6d48f560477 | abhishek9125/FAANG-Question-Set-Leetcode-CodingBlocks | Arrays and Strings/134.Gas Station.cpp | class Solution {
public:
int canCompleteCircuit(vector<int>& gas, vector<int>& cost) {
int extra = 0,index=0,total=0;
for(int i=0; i<gas.size(); i++) {
total += gas[i] - cost[i];
extra += gas[i] - cost[i];
if(extra < 0) {
extra = 0;
... | ALGO | 0.999991 | 5.7982 |
2d0d18c6-731c-4189-aedf-a0bc17e719f6 | SJMA11723/Problem-solving | codeforces/Codeforces Round 109 (Div. 2)/A.cpp | /**
* Author: Jorge Raul Tzab Lopez
* Github: https://github.com/SJMA11723
*/
#include <bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n; cin >> n;
int maxi, mini, ans = 0;
cin >> maxi; mini = maxi;
for(int i = 1; i < n; ++i){
... | ALGO | 0.999797 | 4.319743 |
a80f0cf6-ad6a-4e58-a6cb-116ab916732b | didichuxing2/myMariaDB | storage/ndb/src/kernel/blocks/dbtux/DbtuxMaint.cpp | #define DBTUX_MAINT_CPP
#include "Dbtux.hpp"
/*
* Maintain index.
*/
void
Dbtux::execTUX_MAINT_REQ(Signal* signal)
{
jamEntry();
TuxMaintReq* const sig = (TuxMaintReq*)signal->getDataPtrSend();
// ignore requests from redo log
if (c_internalStartPhase < 6 &&
c_typeOfStart != NodeState::ST_NODE_RESTART... | ALGO | 0.990726 | 6.842417 |
9840ead7-9694-4c4a-8c52-024445223aa4 | pnlinh-ivc/MyTranslator | app/src/main/cpp/com_googlecode_tesseract_android/src/wordrec/lm_consistency.cpp | #include "lm_consistency.h"
#include "associate.h"
#include "dict.h"
#include "ratngs.h"
namespace tesseract {
void LMConsistencyInfo::ComputeXheightConsistency(
const BLOB_CHOICE *b, bool is_punc) {
if (xht_decision == XH_INCONSISTENT)
return; // It isn't going to get any better.
// Compute xheight co... | ALGO | 0.950206 | 7.221689 |
90080488-d69d-43a4-b316-8d879aa6bcff | Peilin-Yang/leetcode | c++/flatten_binary_tree_to_linked_list.cpp | #include<iostream>
#include<queue>
#include<cstdio>
using namespace std;
struct TreeNode {
int val;
TreeNode *left;
TreeNode *right;
TreeNode(int x) : val(x), left(NULL), right(NULL) {}
};
void PrintMedOrder(TreeNode *root) {
if(root==NULL)
return ;
cout << root->val << "->"; // visit the... | ALGO | 0.999994 | 4.791323 |
5bed9df4-8090-45f0-8789-9476994d2cb2 | AST-TheCoder/CP-Solutions | CodeForces/GNU C++14/1680C | Binary String/157040426.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long int
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define Max 10000000000000000
#define min_heap priority_queue <ll,... | ALGO | 0.999993 | 4.391648 |
3d02d05f-5af2-4802-9286-f34d523bc989 | Yijunmaverick/DeepJointFilter | matlab/src/bits/impl/subsample_cpu.cpp | // @file subsampling_cpu.cpp
// @brief Subsampling block implementation (CPU)
// @author Andrea Vedaldi
// @author Karel Lenc
#include "subsample.hpp"
#include <cstring>
#include <iostream>
/* ---------------------------------------------------------------- */
/* subsamp... | ALGO | 0.990183 | 6.77669 |
76be0ce1-c0c7-4755-8eab-d2312e845623 | Gauravlamba1109/LeetCodeQuestions | 124-binary-tree-maximum-path-sum/124-binary-tree-maximum-path-sum.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.999963 | 6.414844 |
2cbd932e-5fd4-428f-8a9c-5cedc128265d | ishandutta2007/codeforces | kuroni/normal/1206/A.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 205;
int n, a[N];
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
for (int j = 0; j < 2; j++) {
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> a[i];
}
cout << *max_element(a + 1, a + ... | ALGO | 0.999837 | 3.780742 |
765a8132-02d0-4105-865c-d2d6c21a39ac | aanu2021/Leetcode-Solutions | 0350-intersection-of-two-arrays-ii/0350-intersection-of-two-arrays-ii.cpp | class Solution {
public:
vector<int> intersect(vector<int>& nums1, vector<int>& nums2) {
int m = nums1.size();
int n = nums2.size();
vector<int>answer;
unordered_map<int,int>f1,f2;
for(int &ele : nums1) f1[ele]++;
for(int &ele : nums2) f2[ele]++;
for(auto &itr... | ALGO | 0.999985 | 5.597056 |
36cd54c2-cc5c-42f3-9456-9b25554e7093 | abhishekprajapati29/coding | find_no_of_computer_not_get_by_a_customer.cpp | #include<iostream>
#include<cstring>
using namespace std;
#define MAX_CHAR 26
int runCustomerSimulation(int n, const char *seq)
{
char seen[MAX_CHAR] = {0};
int res = 0;
int occupied = 0;
for (int i=0; seq[i]; i++)
{
int ind = seq[i] - 'A';
if (seen[ind] == 0)
{
seen[ind] = 1;
if ... | ALGO | 0.999966 | 4.495968 |
35e17731-6266-438e-a7c4-1d9c578a99ed | princekalra/DSA_Practice2022 | Sum of Root To Leaf Binary Numbers.cpp | //Sum of Root To Leaf Binary Numbers
class Solution {
public:
int sol;
void DFS(TreeNode* root,int sum){
if(root==NULL)
{
return;
}
if(root->left==NULL && root->right==NULL){
sol+=((sum<<1) + root->val);
return;
}
DFS(root->left,((... | ALGO | 0.999987 | 5.956652 |
e9a3c164-1307-414e-8d0a-b70e4d9dfb64 | m0hitchaudhary/Data-Structures-and-Algorithms | String/patternFinding.cpp | #include <iostream>
using namespace std;
void findptr(string str, string pat){
int found = str.find(pat);
while(found != string::npos){
cout<<"Pattern found at "<<found<<"\n";
found = str.find(pat, found+1);
}
}
int main() {
string str, pat;
cin>>str>>pat;
findpt... | ALGO | 0.998884 | 4.895433 |
e9e0a145-813a-4939-9c42-53030c6ee778 | waydroid/android_external_mesa3d | src/gallium/frontends/mediafoundation/codecapi.cpp | #include "hmft_entrypoints.h"
#include "wpptrace.h"
#include "codecapi.tmh"
/***************************************************************************
* Quality VBR utility functions.
***************************************************************************/
#define MIN_QP 16
#define MAX_QP 44
#define QUALITY2... | TOOL | 0.879242 | 4.409143 |
b95e6e8a-e381-4e2d-915d-5c253055b2ef | jk-jung/problem-solving | codeforces/Codeforces Round 00x/R004_div2_C.cpp | #include <algorithm>
#include <array>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef vector<i... | ALGO | 0.999467 | 4.762435 |
db1cb981-d079-44b9-a96c-3db176ea1691 | JaeHyoNi/BackJoon | 1463.cpp | #define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;
int v[1000005] = { 0, };
int main() {
int X, tn,time,t1,t2,t3;
cin >> X;
if (X == 1) { cout << 0; exit(0); }
queue<pair<int, int>> arr;
arr.push(make_pair(X, 0));
pair<int, int> temp;
while (1) {
temp = arr.front();
arr.pop();
... | ALGO | 0.999976 | 3.419452 |
a61ec369-17f5-4d1a-98c1-74e6275cb965 | luanaamorim04/competitive_programming | problemas/devorador.cpp | #include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#define _ ios_base::sync_with_stdio(false); cin.tie(0);
using namespace std;
int n, c, id, num;
map<int, int> infect;
vector<int> res;
int main()
{_
cin >> n >> c;
while (c--)
{
cin >> id >> num;
while (num--)
... | ALGO | 0.999989 | 3.35823 |
37164eb9-9c17-48ce-b724-52b4cd9ee81c | Arpita2012/DSA-Practice | 692-top-k-frequent-words/692-top-k-frequent-words.cpp | #define pis pair<int,string>
/*class Solution {
public:
vector<string> topKFrequent(vector<string>& words, int k) {
map<string,int> m;
vector<pair<string,int>> v(k,{"",-1});
vector <string> ans(k,"");
for(auto x : words){
if(m.find(x)==m.end()... | ALGO | 0.999992 | 6.084626 |
39d908fc-dd69-4d77-a566-af4e619ae924 | ishandutta2007/codeforces | peti1234/normal/1360/E.cpp | #include <bits/stdc++.h>
using namespace std;
int w;
long long n;
bool v[52][52], jo=0;
int main()
{
ios_base::sync_with_stdio(false);
cin >> w;
while(w--) {
cin >> n, jo=1;
for (int i=1; i<=n; i++) v[i][n+1]=1, v[n+1][i]=1;
for (int i=1; i<=n; i++) for (int j=1; j<=n; j++) {
... | ALGO | 0.999982 | 4.473517 |
d67073be-2832-4ea5-b9c4-c08f6b9938af | Toysoft/NNvision | darknet_apache_nvenc/opencv-3.4.4/samples/cpp/fitellipse.cpp | /********************************************************************************
*
*
* This program is demonstration for ellipse fitting. Program finds
* contours and approximate it by ellipses using three methods.
* 1: OpenCV's original method fitEllipse which implements Fitzgibbon 1995 method.
* 2: The App... | ALGO | 0.99777 | 6.213858 |
06dd2014-c4b1-44bb-90c9-d30042abf803 | raincross7/code-similarity | codes/train_code/problem244/problem244_416.cpp | #include<bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define repk(i,k,n) for (ll i = k; i < (ll)(n); ++i)
#define MOD 1000000007
typedef long long ll;
using namespace std;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int N,A,B;
cin >> N >> A >> B;
int ans = 0;
repk(i,1,N+1){
... | ALGO | 0.999739 | 3.875693 |
022d47a6-0253-4d06-a1ad-71b636dac11a | antusaha970/My-source-code-DSA | leetcode/makeZerobySubstrack.cpp | #include <iostream>
#include <vector>
#include <climits>
using namespace std;
int minimum(vector<int> arr)
{
int minEle = 0;
for (int i = 0; i < arr.size(); i++)
{
if (arr[i] != 0)
{
minEle = min(INT_MAX, arr[i]);
}
}
return minEle;
}
int minimumOperations(vecto... | ALGO | 0.999921 | 5.201523 |
17dce96d-66fa-4982-a21c-53427b75b12e | vdeepak13/sill | examples/naive_bayes/naive_bayes_hybrid.cpp | #include <sill/factor/hybrid.hpp>
#include <sill/factor/moment_gaussian.hpp>
#include <sill/model/naive_bayes.hpp>
#include <sill/learning/dataset/hybrid_memory_dataset.hpp>
#include <sill/learning/dataset/hybrid_dataset_io.hpp>
#include <sill/learning/parameter/naive_bayes_mle.hpp>
#include <sill/learning/parameter/na... | DATA | 0.988843 | 6.624864 |
79e52b8e-2a44-4b3f-bee1-dea51eb29d79 | heysujal/Problem-Solving-in-cpp | recursion/PalindromeString.cpp | #include <bits/stdc++.h>
using namespace std;
bool isPalindrome(string s, int start, int end)
{
// for nittin
if(start > end){
return true;
}
if(start == end){
return true;
}
bool res= isPalindrome(s, start + 1, end - 1);
if(res and (s[start]==s[end])){
... | ALGO | 0.998527 | 4.400614 |
3e890d55-7acb-4c97-ac62-8631eb260478 | kiwon0502/giwon_projects | Coding Test Practice/cpp/2056.cpp | #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
#define MAX 10001
int N, ans;
int Time[MAX], endTime[MAX];
vector<int> precede[MAX];
int main() {
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cin >> N;
for (int i = 1; i <= N; i++) {
cin >> Time[i];
... | ALGO | 0.999855 | 3.878219 |
887f3800-3330-4686-a68f-d0bfc35cc9d9 | ytho-23/CIS-17A | Lab/ArraySumPowerOf2/ArraySumPowerOf2/main.cpp | /*
* File: main.cpp
* Author: Dr. Mark E. Lehr
* Date: Created on September 18, 2023, 7:01 PM
* Purpose: Shows 1 and 2 Dimensional Dynamic Arrays
* Solves how many Powers of 2 in a random array using all
* Combinations of Sums
*/
#include <iostream>
#include <cstdlib>
#include <c... | ALGO | 0.980636 | 4.5405 |
93d459ce-de3a-47b4-9fee-97d590ceced9 | snape-here/Data-Structures-and-Algorithms-Coursera-Solutions | Algorithmic Tollbox/Week 4/improving_quickSort.cpp | #include<bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define int long long
#define ld long double
#define pb push_back
#define pi pair< int,int >
#define ff first
#define ss second
#define mod 1000000007
#define inf 300000000000000007
#define endl "\n"
const int N = 1e5+5;
int a[N];
vector... | ALGO | 0.999925 | 4.523396 |
6447cd67-624a-4434-b566-7625e949c88f | YinYanCat/sorting-task | par_radix.cpp | void countingSort(std::vector<int> &data, int start, int end, int shift){
std::vector<int> output(end-start);
std::vector<int> count(65536,0);
for(int i=start;i<end;i++){
int byte = (data[i] >> shift) & 65535;
count[byte]++;
}
for(int i=1;i<65536;i++){
count[i] += count[i-1];
}
for(int i=end-1... | ALGO | 0.999979 | 4.938585 |
49ea14be-4f9b-4157-bb0c-3c6573c1b25a | 0marAmara/Problem-Solving | Arrays & Hashing/Valid Anagram/main.cpp | #include <iostream>
using namespace std;
bool isAnagram(string s, string t) {
if (s.size() != t.size())
return false;
int freqMap[26] = {0};
for (size_t i = 0; i < s.size(); i++)
{
freqMap[s[i] - 'a']++;
freqMap[t[i] - 'a']--;
}
for (size_t i = 0; i < 26; i++)
{
... | ALGO | 0.99998 | 5.507518 |
aabda6d9-d6db-41ed-9835-1b3ceb16cec3 | P0W/practice_all | cses/Subordinates.cpp | #include <iostream>
#include <deque>
#include <vector>
#include <map>
#include <algorithm>
using LL = long long;
template <typename Container>
void print(const Container& container) {
for (const auto& element : container) {
std::cout << element << " ";
}
std::cout << "\n";
}
using Pair = std::pair... | ALGO | 0.999793 | 4.115058 |
5cf7a749-0a7d-4d97-aaa9-1b70fabfc750 | CodeDogandCat/offer_ex | offer/Calculator/List.cpp | #include "stdc++.h"
ListNode* CreateListNode(int value) {
ListNode* pNode = new ListNode();
pNode->m_nValue = value;
pNode->m_pNext = nullptr;
return pNode;
}
void ConnectListNodes(ListNode* pCurrent, ListNode* pNext) {
if (pCurrent==nullptr) {
printf("Error to connect two nodes.\n");
exit(1);
}
pCurrent->m... | ALGO | 0.998753 | 4.222953 |
b98cbd49-008e-495d-a7c8-d12b48c773e7 | ngophuc/RigidTransformAcd2D | DGtal/examples/tutorial-examples/FMMErosion.cpp | /**
* @file tutorial-examples/FMMErosion.cpp
* @ingroup Examples
* @author Tristan Roussillon (\c <EMAIL> )
* Laboratoire d'InfoRmatique en Image et Systèmes d'information - LIRIS (CNRS, UMR 5205), CNRS, France
*
* @date 2014/06/19
*
* An example file named FMMErosion.
*
* This file is part of the DGtal libra... | ALGO | 0.997586 | 5.560129 |
6c5cb472-b441-483a-ac66-b5441859a90b | arkayyy/leetcode-problems | Strings/decode-ways/decode-ways.cpp | class Solution {
public:
int cnt=0;
int decodeUtil(string s,int i, vector<int> &dp)
{
if(i>=s.length()) { cnt++;
return 1;}
if(s[i]=='0') return 0;
//memoized value accessing
if(dp[i]!=-1) return dp[i];
int ways = 0;
... | ALGO | 0.999901 | 5.726743 |
92c919dc-3cea-49cf-a8a7-4be465e52c8f | m3tac1ph4r/striver_sde_sheet | DAY_18(Binary_Tree-II)/view_questions/left_view.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
const int M=1e9+7;
class Node
{
public:
int data;
Node *left;
Node *right;
Node(int d)
{
data = d;
left = NULL;
right = NULL;
}
};
Node *buildTree(Node *root)
{
int data;
cin >> data;
root = n... | ALGO | 0.999969 | 4.561862 |
d47f1719-f618-4dca-9324-ee4cb713f73f | neetusuthar90/Leetcode | ways-to-split-array-into-good-subarrays/ways-to-split-array-into-good-subarrays.cpp | class Solution {
int mod = 1e9+7;
public:
// Given an array [1 0 0 1] the split is equal to no. of zeros between two ones + 1
// there for here total split equal to 4
/// If array is like [1 0 0 1 0 1] then split is equal to 4 * (1+1) = 6
int numberOfGoodSubarraySplits(vector<int>& nums) {
i... | ALGO | 0.999996 | 5.617314 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.