uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
c7d9aecc-bcde-43ae-8133-3ea405ff0bb6 | Karanmishra2004/CPP | binary_search.cpp | /*
Binary Search
Given an array of integers nums which is sorted in ascending order, and an integer target, write a function to search target in nums. If target exists, then return its index. Otherwise, return -1.
You must write an algorithm with O(log n) runtime complexity.
Example 1:
Input: nums = [-1,0,3... | ALGO | 0.999945 | 5.623625 |
e76383ee-8c2d-40cf-ae94-bd992405571e | sebastianagv/Roboboat | Roberto-2017/ComputerVisionPython/opencv-master/modules/imgproc/src/filter.avx2.cpp | #include "precomp.hpp"
#include "filter.hpp"
namespace cv
{
int RowVec_32f_AVX(const float* src0, const float* _kx, float* dst, int width, int cn, int _ksize)
{
int i = 0, k;
for (; i <= width - 8; i += 8)
{
const float* src = src0 + i;
__m256 f, x0;
__m256 s0 = _mm256_set1_ps(0.0f... | ALGO | 0.978013 | 6.215927 |
fc0a5bb4-ffda-45f1-9806-9955cd2ef440 | AntonioBD/cPay_coin | src/spork.cpp | #include "chainparams.h"
#include "validation.h"
#include "messagesigner.h"
#include "net_processing.h"
#include "spork.h"
#include <boost/lexical_cast.hpp>
class CSporkMessage;
class CSporkManager;
CSporkManager sporkManager;
std::map<uint256, CSporkMessage> mapSporks;
void CSporkManager::ProcessSpork(CNode* pfro... | TOOL | 0.967908 | 5.859682 |
b7311a4d-be2c-4c7c-a729-6cf955869bfd | Nanduag0/Leetcode | nandincpp/Remove All Adjacent Duplicates in String II.cpp | class Solution {
public:
string removeDuplicates(string s, int k)
{
vector<pair<int, char>> v;
for(auto c : s)
{
if(v.size()==0 || v.back().second!=c)
{
v.push_back({0, c});
}
if(++v.back().first == k)... | ALGO | 0.999991 | 6.29007 |
2acd20a0-3f9b-498e-ab4e-d5d09e31b8d1 | sdhabh/Big_Data_Computing_labs | PAGERANK/pagerank.cpp | // pagerank.cpp
#include "pagerank.h"
#include <cstdlib>
#include <sys/stat.h>
PageRank_basic::PageRank_basic(double damping, double epsilon, int max_iter, int top_k)
: DAMPING(damping), EPS(epsilon),
MAX_ITER(max_iter), TOP_K(top_k) {}
// 修改后的readEdges实现
void PageRank_basic::readEdges(const std::string& ... | ALGO | 0.999957 | 4.939808 |
f1a54613-4b48-486e-beff-004f3617f899 | LibertyChaser/Luogu | 5703.cpp | #include<iostream>
int main(int argc, char const *argv[])
{
int a, b;
std::cin >> a >> b;
std::cout << a * b;
return 0;
}
| ALGO | 0.989258 | 4.31113 |
4ef46b10-b7a9-40d6-be71-658d6a00a758 | amritpandey23/DSA-Library | _ARCHIVE/arrays/maximum_diff_with_order.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long int
#define print(a) for (auto x : a) cout << x << " "; cout << endl;
#define mod 1e9 + 7
#define endl "\n"
/*
author: ok-ape
date:
*/
/* test cases
*/
int maxDiffWithOrder(int A[], int n) {
int Ans = INT_MIN;
int maxIdx = -1;
f... | ALGO | 0.999943 | 4.382642 |
db0bbef3-c15a-42c8-b917-74a8dc582e38 | dawan0111/Auto-Marker-Docking | auto_marker_docking_system/src/aruco_marker_detector.cpp | // ArucoMarkerDetector.cpp
#include "auto_marker_docking/aruco_marker_detector.hpp"
ArucoMarkerDetector::ArucoMarkerDetector(const cv::Mat &cameraMatrix,
const cv::Mat &distCoeffs,
int dictionaryId)
: cameraMatrix(cameraMatrix.clone... | TOOL | 0.894555 | 7.218521 |
350f8da0-f539-4aca-8b5f-094d15474152 | Hasanul-Bari/contests | Educational Codeforces Round 89 (Rated for Div. 2)/A. Shovels and Swords.cpp | #include<bits/stdc++.h>
#define faster ios :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define ull unsigned long long
#define pb push_back
const double PI = acos(-1.0);
using namespace std;
int main()
{
faster
int t,a,b;
cin>>t;
while(t--)
{
cin>>a>>b;
... | ALGO | 0.999876 | 4.562644 |
1a19c770-4a66-4db6-ae74-edfc9748a5a7 | ayush8006/competitive-Proagramming | date07_01/rec_u.cpp | #include<bits/stdc++.h>
using namespace std;
void solve(){
int n,w;
cin>>n>>w;
vector<pair<int,int>>a(n);
for(int i=0;i<n;i++){
cin>>a[i].first>>a[i].second;
}
}
int main() {
int t=1;
//cin>>t;
while(t--){
solve();
}
return 0;
} | ALGO | 0.999954 | 3.947874 |
38e3739c-4121-4a47-98ff-0e0a70dd6591 | CheatingBilliard/ProjetRVBillard | boules_detection.cpp | /**
* \file boules_detection.cpp
* \brief programme de detection des boules
* \author Quentin.T
* \version 0.1
* \date 11 janvier 2015
*
* Partie dédiée à la reconnaissance des boules de billard
*
*/
#include <string>
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "open... | TOOL | 0.978783 | 4.296345 |
64c0fafe-adf9-48f6-b1a7-a561523e7db1 | BZDOLiVE/YoloPlanarSLAM | CAPEAddition/src/PlaneSeg.cpp | #include "PlaneSeg.h"
namespace CAPE{
PlaneSeg::PlaneSeg(Eigen::MatrixXf & cloud_array, int cell_id, int nr_pts_per_cell, int cell_width)
:nr_pts(0), min_nr_pts(nr_pts_per_cell/2),
x_acc(0), y_acc(0), z_acc(0),
xx_acc(0), yy_acc(0), zz_acc(0),
xy_acc(0), xz_acc(0), yz_acc(0)
//isSmall(false)
{
// nr_pts = 0;
// mi... | ALGO | 0.997261 | 5.082492 |
be035b9e-6821-4399-a508-f0cb36dc7bf9 | Mayankjoshi670/cpAlgo | cp31/1300/B. Omkar and Last Class of Math.cpp | #include<bits/stdc++.h>
using namespace std;
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL)
#define vi vector<int>
#define vvi vector<vector<int>>
#define ll long long
#define int long long int
void findAns() {
int n ;
cin>> n ;
int ans = 0 ;
for(int i =2 ; i<= 100000 ; i++){
if(n%i == 0 ){
... | ALGO | 0.999498 | 4.255117 |
29744f9d-7828-4ea9-b776-e30e5323ffb9 | Istimam/XPSC-Club-phitron | CodeForces Contests/Good Bye 2023/B_Two_Divisors.cpp | #include<bits/stdc++.h>
#define For(i,A,B) for(int i = A; i < B; i++)
#define nl '\n'
#define ll long long
const int MOD = 1e9 + 7;
using namespace std;
int gcd(int a, int b) {
while (b != 0) {
int temp = b;
b = a % b;
a = temp;
}
return a;
}
void solve()
{
ll a, b;
cin >> a ... | ALGO | 0.999946 | 5.040228 |
6a8cf66d-a35d-4806-9499-da45bbf4ab10 | hieu-ln/IT82-07 | CodeC2/DoQuyen_C2_bai5.cpp | #include<iostream>
#include<stdio.h>
using namespace std;
#define MAX 100
int a[MAX];
int sp;
//5.2
void init(int a[], int &sp)
{
sp = -1;
}
//5.3
int isEmpty(int a[], int sp)
{
if(sp == -1)
return -1;
return 0;
}
//5.4
int isFull(int a[], int sp)
{
if(sp == MAX -1)
return 1;
return 0;
}
//5.5
int Push(int ... | ALGO | 0.99785 | 3.600083 |
9e1e5f25-a876-44c8-a86a-d933343eae69 | curtis-sun/TLI | competitors/PGM-index/lib/sdsl-lite/tutorial/expl-23.cpp | #include <sdsl/suffix_trees.hpp>
#include <iostream>
using namespace sdsl;
using namespace std;
int main()
{
cst_sct3<csa_wt<wt_huff<rrr_vector<>>>, lcp_support_sada<>> cst1;
construct(cst1, "english.200MB", 1);
cout << "cst1.lcp in MiB : " << size_in_mega_bytes(cst1.lcp) << endl;
util::clear(cst1);
... | ALGO | 0.992504 | 4.12375 |
d9a6e204-7ecd-4c8c-a751-a9a24c4d5ff9 | evanbanks/LeetCode | 112 Path Sum/answer.cpp | class Solution {
public:
bool hasPathSum(TreeNode* const root, const int targetSum) const {
if (!root){
return false;
}
int rest = targetSum-root->val;
if (!rest && !root->left && !root->right){
return true;
}
return hasPathSum(root->right, rest) |... | ALGO | 0.99982 | 6.497814 |
9243062d-180f-4edf-881e-8bb6a73fd9f4 | iains/LLVM-8-Branch | libcxx/test/std/algorithms/alg.sorting/alg.binary.search/equal.range/equal_range.pass.cpp | // <algorithm>
// template<ForwardIterator Iter, class T>
// requires HasLess<T, Iter::value_type>
// && HasLess<Iter::value_type, T>
// constexpr pair<Iter, Iter> // constexpr after c++17
// equal_range(Iter first, Iter last, const T& value);
#include <algorithm>
#include <vector>
#include <cassert>
... | TEST | 0.99117 | 6.972918 |
d260ba94-b044-4fe7-9739-6420a835a00e | lxb1226/leetcode_cpp | src/question59.cpp | #include <iostream>
#include <vector>
using namespace std;
class Solution {
public:
vector<vector<int>> generateMatrix(int n) {
vector<vector<int>> matrix(n, vector<int>(n, 0));
// 顺序:右,下,左,上
vector<vector<int>> directions{{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
int maxNum = n * n;... | ALGO | 0.99988 | 5.165247 |
ef771003-5c23-4647-b715-594e5bb1c465 | vaarcilal/ST0245-032 | talleres/taller10/Punto1.cpp | #include <stdio.h>
#include <stdlib.h>
struct Nodo {
int valor;
struct Nodo* izquierda;
struct Nodo* derecha;
};
struct Nodo* nuevoNodo (int valor){
struct Nodo * nodo = (struct Nodo*)malloc(sizeof(struct Nodo));
nodo->valor = valor;
nodo->derecha = NULL;
nodo->izquierda = NULL;
};
void a... | ALGO | 0.999997 | 3.715373 |
e8d5887e-5e98-45fa-9272-d09995e71ced | Shantanu2k19/cpp_DSA_templates | STL/HEAPS.cpp | #include<bits/stdc++.h>
using namespace std;
//12 8 10 6 4 3 9 1 2
void heapify(vector<int> &heap, int curInd, int size){
int largest = curInd;
int l = 2*curInd+1;
int r = 2*curInd+2;
if(l<size and heap[l]>heap[largest])
largest=l;
if(r<size and heap[r]>heap[largest])
largest=r;
... | ALGO | 0.999912 | 4.249532 |
dc6a8537-3fc1-4e43-a125-3921e7dac701 | raincross7/code-similarity | codes/train_code/problem256/problem256_69.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
signed main()
{
cin.tie(0);
ios::sync_with_stdio(false);
int k, x;
cin >> k >> x;
if (k * 500 >= x) cout << "Yes\n";
else cout << "No\n";
return (0);
} | ALGO | 0.999639 | 3.569474 |
132ec228-ef36-47e0-8283-58c14673038a | 220v-K/DataStructure-2021DGU | Lab06_Doubly Linked List/polynomial.cpp |
// ̾ κ
//------------------------------------------------------------------
template < class DT > // Forward declaration of the List class
class List;
template < class DT >
class ListNode // Facilitator class for the List class
{
private:
// Constructor
ListNode(const DT& degree_data, con... | ALGO | 0.928382 | 3.940608 |
936de44a-89ae-41ce-9051-3183c02c5032 | VenkataAnilKumar/InterviewBit-CPlusPlus | Greedy/DistributeCandy.cpp | // https://www.interviewbit.com/problems/distribute-candy/
int Solution::candy(vector<int> &ratings) {
// Do not write main() function.
// Do not read input, instead use the arguments to the function.
// Do not print the output, instead return values as specified
// Still have a doubt. Checkout www.int... | ALGO | 0.999971 | 5.773508 |
80cd1cf9-18ef-46e8-aba4-a18a2ea90685 | alisha027/Leetcode_Practice | 0236-lowest-common-ancestor-of-a-binary-tree/0236-lowest-common-ancestor-of-a-binary-tree.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:
TreeNode* lowestCommonAncestor(TreeNode* root, TreeNode* p, TreeNode* q) {
if (root ==... | ALGO | 0.999969 | 6.575344 |
79b10d91-0445-400d-b815-95273eb299c0 | GGabrielToyo/TrabAV1_ED2 | main.cpp | #include <iostream>
#include <string.h>
#include <iomanip>
#include <locale.h>
#include <fstream>
#include "ArvoreAVL.h"
using namespace std;
int main()
{
No* arvore;
No* palavraBuscada;
Livros* biblioteca;
string nomeLivro;
string palavra;
int qtd = 3;
biblioteca = NULL;
palavraBu... | ALGO | 0.99656 | 3.656668 |
dda48b06-2e10-42e8-8b8b-d2762b734e79 | mdnavid/cpp_files | others/connect.cpp | #include<bits/stdc++.h>
#define MAX 59
#define mem(x,y) memset(x,y,sizeof(x));
#define pii pair<int,int>
using namespace std;
int dx[] = { -1, 1, 0, 0 };
int dy[] = { 0, 0, -1, 1 };
char grid[MAX][MAX] ;
bool vis[MAX][MAX];
int row, column ;
vector<pii>v[2] ;
bool valid(int x, int y)
{
if(x>=0 && x<row && y>=0 ... | ALGO | 0.999674 | 3.44953 |
3f5ec0c1-4aef-4923-b7fb-c9f47c209636 | Hemant856/Trie | trie_Implementation.cpp |
class TrieNode {
public :
char data;
TrieNode **children;
bool isTerminal;
TrieNode(char data) {
this -> data = data;
children = new TrieNode*[26];
for(int i = 0; i < 26; i++) {
children[i] = NULL;
}
isTerminal = false;
}
};
class Trie {
TrieNode *root;
public :
Trie() {
... | ALGO | 0.999929 | 5.646018 |
a2fe2de1-bfbb-4b1a-9b2f-5a34a600aea0 | andyyang200/CP | Competitive Programming/Contests/CSacademy/Round 41/Pairing/pairing.cpp | //Andrew Yang
//Accepted
#include <iostream>
#include <stdio.h>
#include <sstream>
#include <fstream>
#include <string>
#include <string.h>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <... | ALGO | 0.999889 | 3.797724 |
0ee74bc8-1447-47af-ac8c-0bdab51315ed | Marcux777/Programacao_Competitiva | CodeForces/Codeforces Round 952 (Div. 4)/B.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define IOS \
ios_base::sync_with_stdio(false); \
cin.tie(0)
#define pb push_back
#define all(v) v.begin(), v.end()
#define f first
#define s second
#define Unique(v) \
sort(all(v)); \
v.erase(unique(all(v)),... | ALGO | 0.999947 | 5.146453 |
f012d515-93f0-44e2-b390-7f25783f7670 | ayush-yadav-4/leetcode-solutions | 0051-n-queens/0051-n-queens.cpp | class Solution {
public:
vector<vector<string>> solveNQueens(int n) {
vector<vector<string>> ans;
vector<string> board(n);
for(int i =0; i < n;i++){
for(int j =0; j < n;j++){
board[i].push_back('.');
}
}
helper(ans,board,0,... | ALGO | 0.999772 | 5.885645 |
1050be2a-5670-4015-aba5-6836ff85abe8 | annulen/qtwebkit-snapshots | Source/JavaScriptCore/b3/B3BreakCriticalEdges.cpp | #include "config.h"
#include "B3BreakCriticalEdges.h"
#if ENABLE(B3_JIT)
#include "B3BasicBlockInlines.h"
#include "B3BlockInsertionSet.h"
#include "B3ControlValue.h"
#include "B3ProcedureInlines.h"
#include "B3ValueInlines.h"
namespace JSC { namespace B3 {
void breakCriticalEdges(Procedure& proc)
{
BlockInsert... | TOOL | 0.92419 | 6.124915 |
a2c847d0-70f6-443a-a4c2-c873485063c3 | AkashSingh3031/The-Complete-FAANG-Preparation | 1]. DSA + CP/2]. Competitive Programming/04]. Coding Ninjas/2]. Contests/Beginner Contest/Beginner Contest 01/C++/3. Anish and rectangles.cpp | /*
Time Complexity: O(N ^ 2)
Space Complexity: O(N)
where 'N' is the number of points provided.
*/
#include<set>
int find(int n, vector< vector<int>> &points){
// Storing the set of points
set<vector<int>> s;
for(int i = 0; i < n; i++){
s.insert(points[i]);
}
int count = 0;... | ALGO | 0.99973 | 5.982844 |
18c6e705-04d6-4e09-9233-5ace33128e1b | foresterfx/COMP2710 | project1_AU jfw0006.cpp | /*********************************************************************************
* AUTHOR: Joseph Forester Warren
* DATE: 01/20/20
* COURSE: COMP2710-001
*
* FILE NAME: project1_AU jfw0006.cpp
* COMPILE: g++ project1_AU\ jfw0006.cpp -o p1
* RUN: ./p1
*
* This code is a loan and interest calculator. It prompts the use... | TOOL | 0.930609 | 3.91175 |
e963664c-9eb4-4171-a1ba-f53fb10ca012 | JaiminDave47/CPP-Code | Lecture4/02.cpp | /* n = 3;
123
456
789
*/
#include<iostream>
using namespace std;
int main(){
int n;
cout << "Enter n: ";
cin >> n;
int num = 1;
for(int i = 0; i < n; i++){
for(int j = 0; j < n; j++){
cout << num;
num++;
}
cout << endl;
}
return 0;
} | ALGO | 0.999569 | 4.334327 |
656cceea-f237-4b96-97b7-d7fd1e30b1a2 | roniahamed/CodeForces-Contest | S. Search In Matrix.cpp | /*
**===================================**
** AE Roni Ahamed **
** Phitron **
** **
**===================================**
*/
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n,m;
cin>>n>>m;
int array[n][m];... | ALGO | 0.998697 | 3.580872 |
1fa9756a-9aea-4d1b-b00b-0c08d6958b2f | RodATS/ComputacionParalela | Multplicacion de Matrices/main.cpp |
#include <iostream>
#include <chrono>
#include <vector>
using namespace std;
//definir tamaños de las matrices
int n = 10;
int m = 10;
int p = 10;
// Función para multiplicar dos matrices por bloques
vector<vector<int>> multiplyMatricesByBlocks(vector<vector<int>>& A, vector<vector<int>>& B, int blockSize) {
in... | ALGO | 0.99954 | 4.239295 |
4ca4475e-1b8f-45d4-8643-a44f31a128d9 | GreatGameDota/leetcode-challenges | medium/kth-smallest-element-in-a-sorted-matrix/solution.cpp | class Solution
{
public:
int kthSmallest(vector<vector<int>> &matrix, int k)
{
priority_queue<int> q;
for (int i = 0; i < matrix.size(); i++)
{
for (int j = 0; j < matrix[0].size(); j++)
{
q.push(matrix[i][j]);
if (q.size() > k)
... | ALGO | 0.999985 | 5.602203 |
a6a3f322-83b3-4946-ab0e-e010025d06e1 | Kawser-nerd/CLCDSA | Source Codes/CodeJamData/15/55/4.cpp | #include <cstdlib>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cstring>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
#define SIZE(x) (int((x).size()))
#define rep(i,l,r) for (int i=(l); i<=(r); i++)
#... | ALGO | 0.998482 | 3.196165 |
621b1df6-5298-468d-881d-0677a4c03285 | KaiKostack/blender-demolition | extern/carve/lib/intersection.cpp | #if defined(HAVE_CONFIG_H)
# include <carve_config.h>
#endif
#include <algorithm>
#include <carve/carve.hpp>
#include <carve/poly.hpp>
#include <carve/timing.hpp>
#include <carve/intersection.hpp>
void carve::csg::Intersections::collect(const IObj &obj,
std::vector<carve::mes... | ALGO | 0.926688 | 6.199245 |
3b053766-8d64-4e59-a006-459e24f10e4e | scalaris-project/scalaris | src/addrman.cpp | #include <addrman.h>
#include <hash.h>
#include <serialize.h>
#include <streams.h>
int CAddrInfo::GetTriedBucket(const uint256& nKey) const
{
uint64_t hash1 = (CHashWriter(SER_GETHASH, 0) << nKey << GetKey()).GetCheapHash();
uint64_t hash2 = (CHashWriter(SER_GETHASH, 0) << nKey << GetGroup() << (hash1 % ADDRM... | TOOL | 0.884022 | 6.780999 |
1b370836-afa0-4dfa-9d3a-7743eed5dd4c | ChengShijieUSTC/15445 | third_party/argparse/test/test_parse_args.cpp | #include <argparse/argparse.hpp>
#include <doctest.hpp>
using doctest::test_suite;
TEST_CASE("Missing argument" * test_suite("parse_args")) {
argparse::ArgumentParser program("test");
program.add_argument("--config").nargs(1);
REQUIRE_THROWS_WITH_AS(program.parse_args({"test", "--config"}),
... | TEST | 0.866321 | 7.791342 |
8b547539-5737-40a1-b4f4-e84b3cfdec5c | carolain3472/POO-Orientada-a-objetos- | TALLER4Con-polimorfismo/main.cpp | /*
@brief
HISTORIA:
Estamos en el concurso de televisión ¿Quieres ser trillonario? Los ganadores están en fila para recibir el premio El premio, y también hay una fila de presentadores para entregarlos. Hay distintos tipos de presentadores:
• El presentador de ideas fijas: siempre da como premio 100 bitcoin... | ALGO | 0.863739 | 5.093636 |
eaf077c9-328e-495a-811b-3cfaee65f9d2 | Aryan-Gupta2003/Leetcode-solutions | 3. Hard/sum_of_dist_in_tree.cpp | // Leetcode problem statement link
// https://leetcode.com/problems/sum-of-distances-in-tree/
// There is an undirected connected tree with n
// nodes labeled from 0 to n - 1 and n - 1 edges.
// You are given the integer n and the array
// edges where edges[i] = [ai, bi] indicates
// that there is an edge between nod... | ALGO | 0.999917 | 5.941091 |
679dc4ab-b7ac-42aa-a53d-2a33df000388 | pandaxtc/chepp | src/king.cpp | #include "piece.h"
#include "board.h"
/**
* @brief Given board state, mark all squares that the piece is capable of moving to.
* @param board Square*[][] Array of Square class pointers representing board state.
* @see Piece::markDanger
* @see Board::p_squares
*
* Checks 8 squares around it (less if on an edge). ... | ALGO | 0.939016 | 5.383693 |
7527c030-1f4a-4f0b-9542-1cc4064dc1c0 | Droh2000/Cpp-Curso-Completo | 12_Punteros/sumarDosMatrices.cpp | #include<iostream>
#include<conio.h>
using namespace std;
void pedirDatos();
void sumarMatrices(int**, int**, int, int);
void mostrarMatriz(int**, int, int);
int **matriz1, **matriz2, nfilas, ncol;
int main(){
pedirDatos();
sumarMatrices(matriz1, matriz2, nfilas, ncol);
mostrarMatriz(matriz1, nfilas, nc... | ALGO | 0.973647 | 3.671224 |
bc48af4b-da99-4724-b458-fae374ecd461 | JiangQH/algorithms | code_inter/25.cpp | void printPath(TreeNode* node, int num) {
if (!node)
return;
vector<TreeNode*> path;
int cur_num = 0;
printPathCore(node, num, cur_num, path);
}
void printPathCore(TreeNode* node, int num, int cur_num, vector<int>& path) {
cur_num += node->val;
path.push_back(node);
// having reach the leaf and condition meet... | ALGO | 0.999978 | 4.844982 |
36894fdd-992f-46de-8c33-08f99f008364 | Madhavsingla1/LeetCode-Sol | 1559-detect-cycles-in-2d-grid/1559-detect-cycles-in-2d-grid.cpp | class Solution {
vector<vector<bool>>vis;
bool res=0;
vector<vector<int>>dir={{1,0},{-1,0},{0,1},{0,-1}};
public:
void dfs(int i,int j,vector<vector<char>>&grid,pair<int,int>prev)
{
if(i<0 or i>=grid.size() or j<0 or j>=grid[i].size() or grid[i][j]!=grid[prev.first][prev.second])return;
... | ALGO | 0.999987 | 6.016703 |
cdd22993-97be-45b2-a86b-d244a74e0c19 | oldlick/CompetitiveProgramming | atcoder/3 ABC/258/B.cpp | // -------------------------------------------------------------------------------
//
// -------------------------------------------------------------------------------
// FileName : B.cpp
// Version : ver 1.0
// Date : 2022-07-02 Sat 20:47:02
// -------------------------------------------------------------------... | ALGO | 0.999917 | 4.482174 |
6e9e1dfb-4cce-4b16-8e70-896787163c18 | animesht/codeforces | 499.cpp | #include <iostream>
#include <string>
#include <map>
#include <vector>
using namespace std;
int lecture;
int langs;
map<string, string> b;
vector<string> v;
int main() {
cin>>lecture;
cin>>langs;
string l;
for (int i=0; i<langs; i++) {
cin>>l;
cin>>b[l];
}
for (int i=0; i<lecture; i++) {
cin>>l;
if (l.l... | ALGO | 0.998886 | 3.183001 |
614ede9d-ec77-4075-8d7a-a3401e10bd7c | htadg/ADA-Algorithms | exp1/mergeSort.cpp | #include<bits/stdc++.h>
using namespace std;
void merge(int arr[], int low, int mid, int high){
int i,j,k,n1=mid-low+1,n2=high-mid;
int L1[n1], L2[n2];
for(i=0; i<n1; i++) L1[i] = arr[low+i];
for(i=0; i<n2; i++) L2[i] = arr[mid+1+i];
i=j=0, k=low;
while(i<n1 && j<n2)
if(L1[i] < L2[j]) arr[k++] = L1[i++];
els... | ALGO | 0.99995 | 4.764752 |
12b79e8f-efd0-4806-a196-551bbd900446 | LucaIT523/C_OpenCV_BCC_Recompile | OpenCV470_BCC/modules/core/src/lda.cpp | #include "precomp.hpp"
#include <iostream>
#include <map>
#include <set>
namespace cv
{
// Removes duplicate elements in a given vector.
template<typename _Tp>
inline std::vector<_Tp> remove_dups(const std::vector<_Tp>& src) {
typedef typename std::set<_Tp>::const_iterator constSetIterator;
typedef typename s... | ALGO | 0.999333 | 6.232382 |
1bbe7d19-8581-4411-a28f-67ecd0fad7d6 | Jiwoong617/Baekjoon | Silver/_2503.cpp | #include <algorithm>
#include <string>
#include <iostream>
#include <functional>
using namespace std;
bool check(string a, string b, int n, int m)
{
int n1 = 0, m1 = 0;
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 3; j++)
{
if (a[i] == b[j] && i == j) n1++;
if ... | ALGO | 0.999249 | 4.25164 |
4fc4639d-6b9b-4a27-99f7-aee740c5fadb | krydyh/Algorithm | Programmers/코딩 기초 트레이닝/[181882]조건에_맞게_수열_변환하기_1.cpp | #include <vector>
using namespace std;
vector<int> solution(vector<int> arr) {
vector<int> answer;
for(int i = 0; i < arr.size(); ++i) {
if(arr[i] >= 50 && arr[i] % 2 == 0) answer.push_back(arr[i]/2);
else if(arr[i] < 50 && arr[i] % 2 == 1) answer.push_back(arr[i]*2);
else answer.... | ALGO | 0.999876 | 5.228162 |
5230f605-2000-4e02-89ca-58330c41b35c | james-sungjae-lee/2018_CPP | STUDY/MidTerm/PowerCpp/03/EX6.cpp | #include <iostream>
using namespace std;
int main(int argc, char const *argv[]) {
int k = 0;
for (size_t i = 0; i < 31; i++) {
k += (i*i) + 1;
std::cout << k << '\n';
}
return 0;
}
| ALGO | 0.993325 | 3.391191 |
de2d3fdc-19e1-4df7-9da6-d384e1a1c121 | reyren19/Leetcode | 0002-add-two-numbers/0002-add-two-numbers.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* addTwoNumbe... | ALGO | 0.999939 | 6.282781 |
64cd11e6-91fa-4b2f-b198-ec233eb05312 | TheHarshal30/CPP-DSA-CP | Codeforces & Leetcode/VasyaandSocks.cpp | /* Code by Harshal Rudra(harshal_3073)*/
#include<bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL)
#define rep(i,n) for(int i=0;i<n;i++)
#define ll long long int
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define vll vector<ll>
#define tt ll t; cin>>t; while(t--)
#define timeta... | ALGO | 0.999962 | 3.142232 |
889bfd6e-2e41-4f14-9295-632b25e213c0 | satya117/DSA_CPP | functions/sum_n.cpp | /*Sum of n natural numbers: */
#include<iostream>
using namespace std;
int sum(int n){
int i,sum=0;
for(i=1;i<=n;i++){
sum+=i;
}
return sum;
}
int main(){
int num;
cout<<"Enter a number: "<<endl;
cin>>num;
int ans = sum(num);
cout<<"Sum of n natural numbers: "<<ans<<endl;
... | ALGO | 0.975375 | 3.649359 |
3c3d2c1a-f36e-43bf-8090-e836fb161666 | Abdev1205/leetcode-problems | 203-remove-linked-list-elements/remove-linked-list-elements.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* removeEleme... | ALGO | 0.999943 | 5.765914 |
b780a267-05ff-4b95-9e08-336a42aa687b | Viv3kshukla/Dynamic-Programming- | coinChange.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
int arr[n];
for(int i=0;i<n;i++){
cin>>arr[i];
}
int sum;
cin>>sum;
int dp[sum+1];
for(int i=0;i<=sum;i++){
dp[i]=0;
}
dp[0]=1;
for(int i=0;i<n;i++){
for(int j=arr[i];j<=sum;j++){
dp[j]+=dp[j-arr[i]];
}
}
for(int i=0;i<=s... | ALGO | 0.999958 | 3.284032 |
758f45fb-d34e-4e6d-9521-6c745bd25a29 | geometryprocessing/geometric-contact-potential | src/polyfem/mesh/remesh/PhysicsRemesher.cpp | #include "PhysicsRemesher.hpp"
#include <polyfem/mesh/remesh/wild_remesh/LocalRelaxationData.hpp>
#include <polyfem/solver/NLProblem.hpp>
#include <paraviewo/VTUWriter.hpp>
namespace polyfem::mesh
{
template <class WMTKMesh>
std::vector<typename PhysicsRemesher<WMTKMesh>::Tuple>
PhysicsRemesher<WMTKMesh>::local_m... | TOOL | 0.982603 | 7.093605 |
d804944a-1b67-4063-adee-b45c28396e1b | ishandutta2007/codeforces | juve45/normal/466/E.cpp | #include <bits/stdc++.h>
#define st first
#define nd second
using namespace std;
void debug_out() { cerr << endl; }
template<class T> ostream& prnt(ostream& out, T v) { out << v.size() << '\n'; for(auto e : v) out << e << ' '; return out;}
template<class T> ostream& operator<<(ostream& out, vector <T> v) { return prn... | ALGO | 0.999992 | 4.31295 |
fa5da8d8-1fc2-4894-9a08-8ed7015a8943 | pvlKryu/flutter_workspaces | 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 |
402a40ef-203f-4ae5-9af3-c7c593d0e271 | Andrewyx/Thundersearch | sources/software/src/software/ai/evaluation/keep_away_test.cpp | #include "software/ai/evaluation/keep_away.h"
#include <gtest/gtest.h>
#include "software/ai/passing/cost_function.h"
#include "software/test_util/test_util.h"
#include "software/world/team.h"
TEST(KeepAwayCostTest, test_keep_away_cost_no_enemies)
{
Team enemy_team;
Pass pass(Point(0, 0), Point(1, 1), 5);
... | ALGO | 0.893174 | 7.742002 |
f553b323-fc0e-497a-8a2b-4c3d97775df0 | ishandutta2007/codeforces | m_99/normal/884/E.cpp | #include <stdio.h>
#include <bits/stdc++.h>
#include <algorithm>
#include <cassert>
#include <vector>
namespace atcoder {
// Implement (union by size) + (path compression)
// Reference:
// Zvi Galil and Giuseppe F. Italiano,
// Data structures and algorithms for disjoint set union problems
struct dsu {
public:
... | ALGO | 0.99992 | 4.136781 |
759946d7-aa26-4ea4-bcf5-20fc473ff4b2 | SaihajGulati/practice | sliding-window/longest-substring-wout-repeats.cpp | class Solution {
public:
int lengthOfLongestSubstring(string s)
{
unordered_set<char> substring;
size_t left = 0;
int maxLength = 0;
for (int right = 0; right < s.size(); right++)
{
//as long as has duplicate, keep on pushinig left of window up (bc could be m... | ALGO | 0.999134 | 5.610029 |
40561fad-8689-4a1c-8786-984e5abd589e | jindalshivam09/cppcodes | ACM/CodeCzr/BHAVUK.cpp | #include<iostream>
#include<vector>
using namespace std;
int main() {
int t;
cin >> t;
while(t--) {
long long s,n,c;
cin >> s >> n >> c;
if(s > n + 2*c)
cout << "NO" << endl;
else {
long long temp = (s-n)/2;
if (s == n + 2*temp)
cout << "YES " << temp << endl;
else
cout << ... | ALGO | 0.999874 | 3.576146 |
535959c9-b87d-46c1-9124-5f7bc6d681a7 | qj/algorithmsCormen | src/08_sorting_in_linear_time.cpp | #include <iostream>
#include <algorithm>
#include <iterator>
#include <vector>
using namespace std;
/*
INPUT: a - vector to be sorted in ascending order
b - vector A sorted
k - maximum element in vector A
*/
template <typename T>
void counting_sort(vector<T>& a, vector<T>& b, long long k) {
v... | ALGO | 0.999797 | 4.317553 |
8a13f0f6-e6f5-4a4c-8dba-a3a50db188c8 | Klaypexx/Parallel-Programming | opencv/sources/modules/calib3d/src/levmarq.cpp | #include "precomp.hpp"
#include <stdio.h>
namespace cv
{
class LMSolverImpl CV_FINAL : public LMSolver
{
public:
LMSolverImpl(const Ptr<LMSolver::Callback>& _cb, int _maxIters, double _eps = FLT_EPSILON)
: cb(_cb), epsx(_eps), epsf(_eps), maxIters(_maxIters)
{
printInterval = 0;
}
int... | ALGO | 0.999568 | 6.484408 |
e3e762bb-479d-4afb-b169-440e7d7cdc0d | aelaraby6/Competitive-Programming | Topices/Recursion/Binary search.cpp | /*In the end, we only regret the chances we didn’t take.*/
#include <bits/stdc++.h>
#define ll long long
#define via(vec, n) { for(int i = 0; i < n; i++) cin >> vec[i]; }
using namespace std;
int n;
int binarySearch(const vector<int>& A, int left, int right, int X) {
if (left > right) return -1;
int mid = le... | ALGO | 0.999968 | 4.958402 |
cc1068ee-899c-483f-b4e8-2e9b8b0d94bf | MObinXIV/a-Repo-to-get-back-My-level-of-the-devil | DataStructure/Queue/problems/QueueWithStacks.cpp | //https://leetcode.com/problems/implement-queue-using-stacks/description/
#include<bits/stdc++.h>
using namespace std;
// using single one
class MyQueue {
stack<int>st1,st2;
public:
MyQueue() {
}
void push(int x) {
// emplace the whole elements of the stack in another one before w... | ALGO | 0.999483 | 5.512544 |
f9fdc0cb-2947-46ea-8914-cf74c3bdfec2 | searchkuldeepsingh/Data-Structures-and-Algorithms | Geeksforgeeks/Recursion/DigitalRoot.cpp | /*
You are given a number n. You need to find the digital root of n. DigitalRoot of a number is the recursive sum of its digits until we get a single digit number.
Example 1:
Input:
n = 1
Output: 1
Explanation: Digital root of 1 is 1
Example 2:
Input:
n = 99999
Output: 9
Explanation: Sum of digits of 99999 is 45
wh... | ALGO | 0.999961 | 6.827113 |
fc848fa3-d047-4a9d-9e25-e8fc6334fa94 | ChangWinde/Algorithm | leetcode/Dynamic Programming/Partition Equal Subset Sum.cpp | // 416. Partition Equal Subset Sum
// Given a non-empty array containing only positive integers, find if the array can be partitioned into two subsets such that the sum of elements in both subsets is equal.
// https://leetcode.com/problems/partition-equal-subset-sum/
class Solution {
public:
bool canPartition(v... | ALGO | 0.999918 | 5.491624 |
850b3294-1c9c-4144-bf4d-bf96b4f45a41 | LemonPrefect/BugRepoForACM | mckm2000's Bug_Code/杭电OJ/2025.cpp | #include <iostream>
#include<stdio.h>
#include<string>
#include<math.h>
#include<iomanip>
using namespace std;
int main() {
char str[200];
int n=0,len,a,b,max=0,result,c;
while (cin.getline(str, 200)) {
len = strlen(str) -1;
max = 0;
for (a = 0; a <= len; a++) {
... | ALGO | 0.999384 | 3.181079 |
8ede08d2-729c-49f1-9782-1e18f2d08e07 | opensim/opensim-libs | BulletPhysics/bulletTrunk/src/BulletCollision/CollisionShapes/btStridingMeshInterface.cpp | #include "btStridingMeshInterface.h"
btStridingMeshInterface::~btStridingMeshInterface()
{
}
void btStridingMeshInterface::InternalProcessAllTriangles(btInternalTriangleIndexCallback* callback,const btVector3& aabbMin,const btVector3& aabbMax) const
{
(void)aabbMin;
(void)aabbMax;
int numtotalphysicsverts = 0;
i... | ALGO | 0.979679 | 6.116045 |
84b848a5-33a6-4306-94fb-5c66614ba8cd | Shubham-js/Codes | combination_sum2.cpp | class Solution {
public:
set<vector<int>>s;
void combination(vector<int>&c, int t, int i, int sum, vector<int>v)
{
if (sum == t)
{
//cout<<sum<<endl;
s.insert(v);
return;
}
if (sum > t or i == c.size())
{
return;
... | ALGO | 0.999986 | 5.366042 |
e4176bdf-579e-4a5b-8450-cd8dd61cb43a | bhuppidhamii/myLeetCode | 1445-number-of-sub-arrays-of-size-k-and-average-greater-than-or-equal-to-threshold/number-of-sub-arrays-of-size-k-and-average-greater-than-or-equal-to-threshold.cpp | class Solution {
public:
int numOfSubarrays(vector<int>& arr, int k, int threshold) {
int n=arr.size();
int count=0, currSum=0;
for(int i=0; i<k; i++){
currSum+=arr[i];
}
if(currSum/k >= threshold){
count++;
}
for(int i=k; i<n; i++){... | ALGO | 0.99996 | 6.392706 |
720a023c-dd58-4c0a-a54e-be2afbc78313 | tpisto/rmongo | src/mongo-cxx-driver/boost/libs/msm/doc/HTML/examples/SimpleTimer.cpp | #include <vector>
#include <iostream>
#include <boost/msm/back/state_machine.hpp>
#include <boost/msm/front/euml/euml.hpp>
using namespace std;
using namespace boost::msm::front::euml;
namespace msm = boost::msm;
// how long the timer will ring when countdown elapsed.
#define RINGING_TIME 5
namespace // Concrete F... | TOOL | 0.88112 | 6.781747 |
ee8db150-f663-42dd-ad36-b4d4599b4dde | Sohailkhan2k02/Linkedlist.cpp | Doubly-Linkedlist.cpp | #include<bits/stdc++.h>
using namespace std;
class Node{
public:
int data;
Node* next;
Node* back;
Node(int data){
this->data = data;
this->next=NULL;
this->back=NULL;
}
};
Node* deleteHead(Node* head){
if(head==NULL) return NULL;
Node* temp=head;
head=head... | ALGO | 0.999939 | 4.33212 |
47c05ee9-1de4-4214-92ff-85f9526fce76 | AlexKougentakos/Odyssey-Engine | Testing/src/Tichu.cpp | #include "Tichu.h"
#include <algorithm>
#include <iostream>
#include <unordered_map>
Combination Tichu::CreateCombination(std::vector<Card>& cards) const
{
const size_t numberOfCards = cards.size();
//Determine the combination
Combination combination{};
combination.combinationType = CombinationType::CT_Invalid;
... | ALGO | 0.960027 | 6.056321 |
7500099b-428d-4b2a-ba33-d73929c6dbfe | twohyjr/Advent_2020 | Dec2/main.cpp | #include <iostream>
#include <string>
#include <vector>
#include <fstream>
#include <sstream>
#include <algorithm>
std::vector<std::string> parseInputValues(std::string filepath) {
std::vector<std::string> values;
std::ifstream inputFile;
try {
inputFile.open(filepath);
std::strin... | ALGO | 0.987829 | 5.938981 |
6b13aa66-8f34-4df3-96c1-92b27ec7ffa5 | jeffdk/SpecClass2011 | Iryna/Assignment04Iryna/RaiseToPower_Iryna.cpp | #include "RaiseToPower_Iryna.hpp"
// Compute a^n
unsigned int RaiseToPower(const unsigned int a, const unsigned int n) {
if(n == 0) return 1;
if(n > 1) return a*RaiseToPower(a,n-1);
return a;
}
| ALGO | 0.99765 | 5.272868 |
9283b7f2-a784-4efc-a8c4-d00fea3b5f11 | Greeeder/Program | &HydroNet_FlowSolver/HydroNet_FlowSolver/HydroNet_FlowSolver/Libraries/unsupported/doc/examples/MatrixSquareRoot.cpp | #include <unsupported/Eigen/MatrixFunctions>
#include <iostream>
using namespace Eigen;
int main()
{
const double pi = std::acos(-1.0);
MatrixXd A(2,2);
A << cos(pi/3), -sin(pi/3),
sin(pi/3), cos(pi/3);
std::cout << "The matrix A is:\n" << A << "\n\n";
std::cout << "The matrix square root of A is:... | ALGO | 0.999486 | 3.930508 |
603ee230-671a-440d-952a-a8834690aa24 | ArunRathaur1/LeetcodeCodes | 0983-validate-stack-sequences/0983-validate-stack-sequences.cpp | class Solution {
public:
bool validateStackSequences(vector<int>& pushed, vector<int>& popped) {
stack<int>st;
int tem=0;
int x=popped.size();
for(auto i: pushed){
st.push(i);
while(!st.empty()&& tem<x&& st.top()==popped[tem]){
st.pop();
... | ALGO | 0.999712 | 6.073229 |
ee4b1e63-2e35-4abe-a4a2-9f30ef7909fe | Shubham84095/CPP | E_Sakurako_Kosuke_and_the_Permutation.cpp | #include <bits/stdc++.h>
#define print(V) for(auto &e : V) cout << e << " ";
#define all(V) V.begin(), V.end()
#define int long long int
#define endl '\n'
#define yes() cout<<"YES\n"
#define no() cout<<"NO\n"
using namespace std;
typedef long long ll;
int minSwaps(vector<int>& A, vector<int>& B) {
int n = A.size(... | ALGO | 0.999931 | 4.556605 |
77b5eb68-3e26-47b2-b887-aec4f6ab83c2 | sohilshah2/sohilbot | engine.cpp | #include <cstring>
#include "engine.hpp"
#include "evaluate.hpp"
#include "sohilbot.hpp"
#include "transpositionTables.hpp"
int32_t Engine::searchBestMove(BitBoard& board, BitBoard::Move& move,
uint8_t depth, uint32_t time)
{
uint8_t const iterStart = 1;
int32_t eval = 0;
n... | ALGO | 0.999615 | 7.003205 |
20dbc043-8dd1-4a30-adfb-c9479d8a9054 | Sumonta056/My-Codes | BASIC Pratices/pattern/Number pattern.cpp |
#include<iostream>
using namespace std;
int main()
{
int n;
cout<<"N = ";
cin>>n;
// type 1
for ( int row1 =1 ; row1<=n ; row1++)
{
for( int col1 =1 ; col1<=row1; col1++)
{
cout<<col1;
}
cout<<endl;
}
//type 2
for( int row2 =n ;... | ALGO | 0.999379 | 3.626576 |
eac885f8-33cd-4f7e-a43f-4def5e99fa86 | sarvex/leetcode-scopes | solution/0800-0899/0878.Nth Magical Number/Solution.cpp | using ll = long long;
class Solution {
public:
const int mod = 1e9 + 7;
int nthMagicalNumber(int n, int a, int b) {
int c = lcm(a, b);
ll l = 0, r = 1ll * (a + b) * n;
while (l < r) {
ll mid = l + r >> 1;
if (mid / a + mid / b - mid / c >= n)
r =... | ALGO | 0.999975 | 5.951842 |
45fe3ca2-a595-4ebf-98b5-9835e7fc595c | rewted/ICPC | practice/spavanac.cpp | #include <iostream>
using namespace std;
int main () {
int hour;
int minute;
cin >> hour;
cin >> minute;
// need to adjust hour
if (minute < 45) {
minute = minute + 60 - 45;
if (hour == 0) {
hour = 23;
}
else {
hour--;
}
}
// don't need to adjust hour
else {
mi... | ALGO | 0.999843 | 5.173255 |
f5af1c30-2b3e-4ed5-8956-fffc7ecd3524 | Apapath77/Custom_llvm_Project | llvm/lib/CodeGen/ReachingDefAnalysis.cpp | #include "llvm/ADT/SmallSet.h"
#include "llvm/CodeGen/LivePhysRegs.h"
#include "llvm/CodeGen/ReachingDefAnalysis.h"
#include "llvm/CodeGen/TargetRegisterInfo.h"
#include "llvm/CodeGen/TargetSubtargetInfo.h"
#include "llvm/Support/Debug.h"
using namespace llvm;
#define DEBUG_TYPE "reaching-deps-analysis"
char Reachin... | ALGO | 0.999182 | 7.759061 |
c6808bd0-740b-4fd4-8293-b775690c72d9 | linouk23/epi | Ch 07. Strings/Reverse all the words in a sentence.cpp | #include "bits/stdc++.h"
using namespace std;
class Solution {
public:
void ReverseWords(string& s) {
reverse(s.begin(), s.end());
size_t start = 0, end;
while ((end = s.find(" ", start)) != string::npos) {
reverse(s.begin() + start, s.begin() + end);
start... | ALGO | 0.999758 | 5.834153 |
774f4ae0-e365-4880-941d-fefe99c14ed6 | Kartik-Mathur/5MarchCPP | Lecture-24/isBalancedBST.cpp | #include <iostream>
#include <queue>
#include <cmath>
using namespace std;
class node {
public:
int data;
node*left, *right;
node(int d) {
data = d;
left = right = NULL;
}
};
node* insertInBST(node* root, int data) {
if (!root) {
root = new node(data);
return root;
}
if (data < root->data) {
root->l... | ALGO | 0.999956 | 4.6753 |
106bf7a8-f303-4875-ba85-13c9a78b2714 | henockt/problems | leetcode/next-greater-element-ii.cpp | class Solution {
public:
vector<int> nextGreaterElements(vector<int>& nums) {
int n = nums.size();
// for circular array
stack<int> st;
for (int i=n-1; i>=0; --i) {
while (!st.empty() && nums[i] >= st.top()) { st.pop(); }
st.push(nums[i]);
}
/... | ALGO | 0.999883 | 5.747012 |
93a195bd-dab5-4af4-9648-b202fcbfd9f3 | yuforest/contests | ddcc_2020_qual/a/main.cpp | // ここは競プロではサボりがちです
#include <bits/stdc++.h>
using namespace std;
// デバッグ用マクロです。詳しくは https://naskya.net/post/0002/
#ifdef LOCAL
#include <debug_print.hpp>
#define debug(...) debug_print::multi_print(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (static_cast<void>(0))
#endif
// 節操ないですが、競プロでは便利です。
using ll = long ... | ALGO | 0.998912 | 3.981077 |
644d0c25-c585-45df-ad32-e657ddae7090 | kronic-staging/platform_external_libcxx | test/std/utilities/function.objects/func.search/func.search.bm/hash.pred.pass.cpp | // UNSUPPORTED: c++98, c++03, c++11, c++14
// XFAIL: c++17, c++2a
// <functional>
// boyer_moore searcher
// template<class RandomAccessIterator1,
// class Hash = hash<typename iterator_traits<RandomAccessIterator1>::value_type>,
// class BinaryPredicate = equal_to<>>
// class boyer_moore_searcher {... | TEST | 0.930061 | 6.919787 |
954fefed-3899-48f2-b21d-a555010da198 | lc-3-2/llvm | llvm/lib/CodeGen/UnreachableBlockElim.cpp | #include "llvm/CodeGen/UnreachableBlockElim.h"
#include "llvm/ADT/DepthFirstIterator.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/CodeGen/MachineDominators.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachineLoopInfo.h"
#include "llvm/CodeG... | ALGO | 0.931392 | 7.794114 |
cf306840-7db6-4225-b599-c040fc3c67dd | itmc-ptit/itmc-cpp-class-2024 | N24DCCN173/buoi5/bai5.cpp | #include <bits/stdc++.h>
using namespace std;
bool check(int n)
{
if(n == 2 || n == 3)
{
return true;
}
if(n <= 1) return false;
for(int i = 2; i <= sqrt(n); i++)
{
if(n %i == 0) return false;
}
return true;
}
int main()
{
int n; cin >> n;
for(int i = 2; i < n; i+... | ALGO | 0.999684 | 4.565464 |
c90779c6-21fe-401e-bed3-857146b301b7 | Mrcocvs02/Boid | Boid/Flock.cpp | #include "Flock.hpp"
#include <cmath>
#include <numeric>
Flock::Flock(float d_, float s_, float a_, float c_, int n_)
: d{d_},
s{s_},
a{a_},
c{c_},
n{n_},
Predator_{{(static_cast<float>(rand() % 30000 + 45000)) / 100,
(static_cast<float>(rand() % 15000 + 20000)) / 100... | ALGO | 0.999773 | 4.166413 |
3341195f-a0e5-4827-96a7-1a736712d9e9 | RoPro99/DS-ALGO-CB | Arrays/ArrayToFunction.cpp | #include<bits/stdc++.h>
#include<iostream>
using namespace std;
void PrintArray(int inp[],int n){
//cout<<"function"<<sizeof(inp)<<endl;
cout<<"PrintArray"<<endl;
for (int i = 0; i < n; i++)
{
cout<<inp[i]<<" ";/* code */
}
cout<<endl;
}
int main(){
int n;
cout<<"Enter the N"<<endl;
cin>>n;
int inp[... | ALGO | 0.905626 | 3.681663 |
fdaf6a49-b7d9-4683-b106-7cf131b17ad8 | MoisesKersch/Combinatoria | src/Anagram.cpp | #include "Anagram.h"
Anagram::Anagram(string word)
{
setPermutation(word.size());
int repetitions = 1;
transform(word.begin(), word.end(),word.begin(), ::toupper);
for (int x=0; x<word.size();x++)
{
for (int y = x+1; y < word.size(); y++)
{
if (word.at(x) == word.at(y))
{
word.erase(word.begi... | ALGO | 0.998644 | 4.071141 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.