uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
e9613e62-7fce-4426-bdfb-e4571b3c60f5 | RyanHir/CPPCalc | src/calc.cpp | #include <math.h>
double rounder(double input) {
return round(input * 1000) / 1000;
}
//Option One
double calcMagnitude(double x1, double y1) {
double xPower = pow (x1, 2);
double yPower = pow (y1, 2);
return (double) rounder(sqrt (xPower + yPower));
}
double calcVector(double x, double y) {
double done = ( at... | ALGO | 0.998383 | 5.135467 |
fccb1841-e536-4c08-8e0e-4ffa70381ded | SIC1740/LaptrinhC | sangsonguyento.cpp | #include<bits/stdc++.h>
using namespace std;
using ll = long long ;
int snt(ll n, ll k){
vector<bool>isPrime(n+1,true);
isPrime[0] = isPrime[1] = false ;
for (int i = 2 ; i * i <= n ; ++i){
if (isPrime[i] == true){
for (int j = i * i ; j <= n ; j+=i){
isPrime[j] = false ;
}
}
}
vector<int>primeNu... | ALGO | 0.999791 | 4.066033 |
a1a3c393-38c9-4e10-a4fc-f05c5efffb13 | busebd12/InterviewPreparation | LeetCode/C++/General/Easy/GuessNumberHigherOrLower/main.cpp | #include <iostream>
using namespace std;
/*
* Approach: just your basic binary search
*
* Time complexity: O(log n)
* Space complexity: O(1)
*/
int guessNumber(int n)
{
int result=0;
int high=n;
int low=0;
while(low <= high)
{
int number=(low + ((high - low))/2);
int guess... | ALGO | 0.999957 | 5.961212 |
e96827e4-883b-438a-9fe2-517dfaaa979f | Abdul-Basit31/CPP-Paractice | Cpp DSA/Array/Linearly_Search.cpp | // C++ code to linearly search x in arr[].
#include <bits/stdc++.h>
using namespace std;
int search(int arr[], int N, int x)
{
for (int i = 0; i < N; i++)
if (arr[i] == x)
return i;
return -1;
}
// Driver code
int main(void)
{
int arr[] = { 2, 3, 4, 10, 40 };
int x;
cout<<"x=";... | ALGO | 0.999391 | 5.458973 |
3ad6fdab-60ba-47d9-a07c-6ebe17e4550c | superozing/LeetCode | LeetCode/LeetCode/179. Largest Number.cpp | #include ".h"
bool Ŭ(int& _a, int& _b)
{
string a, b;
a = to_string(_a);
b = to_string(_b);
string aSum = (a + b);
string bSum = (b + a);
return aSum > bSum;
}
class Solution
{
public:
string largestNumber(vector<int>& nums)
{
if (nums.size() == 1)
return to_string(... | ALGO | 0.999958 | 6.315105 |
35a1a57b-924b-43f6-9feb-ff72281dda6c | AmanPrakash00/LeetcodeProblems_Solution | 0415-add-strings/0415-add-strings.cpp | class Solution {
public:
void recadd(string &num1,string &num2,int p1,int p2,int carry,string &output){
if(p1< 0 && p2 <0){
if(carry != 0){
output.push_back(carry + '0');
}
return;
}
int n1 = (p1>=0 ? num1[p1] : '0') - '0';
int n2 ... | ALGO | 0.999994 | 6.467568 |
b0004834-e41b-45d3-aed2-34fb5f473cfe | ishandutta2007/codeforces | somethingnew/normal/1239/B.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <queue>
#include "bitset"
#include "iomanip"
#include <random>
#include "map"
typedef double ld;
typedef long long ll;
#define int long long
#define all(x) x.begin(), x.end()
using namespace std;
pair<int, pair<int, int>... | ALGO | 0.999961 | 4.128911 |
cd04202e-f109-4818-a44d-b451504127f5 | tangyao0792/ACM_Solutions | poj/poj3321_10156016.cpp | #include<cstdio>
#include<cstring>
#include<iostream>
using namespace std;
const int MAXN=100100;
const int MAXM=2*MAXN;
int in[MAXN]; //新编号下的数组
int treearray[MAXN];
int pos[MAXN]; //pos[i]表示,i号节点的编号
int num[MAXN]; //num[pos[i]]:i节点的孩子数
int first[MAXN],next[MAXM],v[MAXM];
int n,cnt,q,nInd... | ALGO | 0.999913 | 4.036766 |
a7d6e785-d2e1-458e-8dc6-fb80817073ce | jpastell/data_algo_problems | other_examples/kth_smallest.cpp | // #include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
using namespace std;
int partition(int arr[], int l, int r);
// This function returns K'th smallest element in arr[l..r]
// using QuickSort based method. ASSUMPTION: ALL ELEMENTS IN
// ARR[] ARE DISTINCT
int kthSmallest(int arr[], int l, int r, in... | ALGO | 0.999976 | 4.627567 |
59424c53-2849-4a2b-a67b-6776fc0dbfaa | gsm-pro/acm | algo/algo-solutions/BE30.CPP | #include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
void main()
{
int n,a,b;
cin>>n;
vector<pair<pair<int,int>,int>> v;
for (int i=0;i<n;i++) cin>>a>>b,v.push_back(make_pair(make_pair(a,b),i+1));
sort(v.begin(),v.end());
for (int i=0;i<n;i++) cout<<v[i].second<<" ";
} | ALGO | 0.999722 | 3.42908 |
779772d6-4c7a-4fe7-850d-1307bdb71f30 | RoumaisaTanveer/LeetCode_Problems | happynumber.cpp | #include <bits/stdc++.h>
using namespace std;
bool isHappy(int n) {
unordered_set<int> seen;
if(n!=1 && seen.find(n)==seen.end()){
seen.insert(n);
int sum = 0;
while(n>0){
int digit = n % 10;
sum += digit + digit;
n /= 10;
}
... | ALGO | 0.99977 | 5.050763 |
112b1c63-5076-4458-83d7-01898b5eb3a9 | Immortalqx/pi-slam-fusion | GSLAM-DIYSLAM/src/chengyuqi/MatcherSiftGPU.cpp | #ifdef HAS_OPENCV
#include <opencv2/features2d/features2d.hpp>
#include "GSLAM/core/Estimator.h"
#include <GSLAM/core/Timer.h>
#include <GSLAM/core/Vocabulary.h>
#include "zhaoyong/SiftGPU/SiftGPU.h"
#include "Matcher.h"
using std::vector;
class MatcherSiftGPU : public Matcher {
public:
MatcherSiftGPU(... | ALGO | 0.971084 | 6.056402 |
991b6574-0a5a-4458-9980-d49262aa1b9b | JooseRajamaeki/TVCG18 | SCA/eigen_332/unsupported/doc/examples/FFT.cpp | // To use the simple FFT implementation
// g++ -o demofft -I.. -Wall -O3 FFT.cpp
// To use the FFTW implementation
// g++ -o demofft -I.. -DUSE_FFTW -Wall -O3 FFT.cpp -lfftw3 -lfftw3f -lfftw3l
#ifdef USE_FFTW
#include <fftw3.h>
#endif
#include <vector>
#include <complex>
#include <algorithm>
#include <iterator>... | ALGO | 0.997987 | 6.121914 |
f8b9344e-17cd-4170-adca-5d0874a5d7f4 | ahmedmostafa10/Problem-Solving | Number of Ways/Number of Ways.cpp |
//=============//
//AHMED MOSTAFA//
//=============//
//Keep going..Sometimes you win, Sometimes you learn. > < .
// \ U /
//
/*
||========||
|| i ♥ u ||
||========||
Dark_Carnage
*/
//// وَقُلْ رَبِّ زِدْنِي عِلْمًا
// سبحان الله وبحمده سب... | ALGO | 0.999978 | 3.825037 |
cff1a776-6f48-4d7f-a7ac-4d0c6b139786 | NIBRAS-N/Competitive-Programming-From-Scratch | Graph_theory__all_problems/spoj_Is_it_a_tree.cpp | //problem link: https://www.spoj.com/problems/PT07Y/
//problem type: check it is graph or not
//Here n nodes and m edges wil be given. next m line will be u and v.
//I have to tell if it is graph or not..
//technique: it is graph if it has only one connected component and has exactly n-1 edges.
#include<bits/stdc++... | ALGO | 0.99992 | 4.34993 |
5b7ef3fe-163c-452b-aa9f-fce2f7c1992b | areian13/PS_BOJ | 3. Gold/Gold 1/![G1] 32032 만보기 대행 서비스.cpp | #include <iostream>
#include <climits>
#include <algorithm>
#define FastIO ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr)
using namespace std;
long long MinDist(long long l, long long r, long long d)
{
if (l >= 0)
return r * 2 + d;
l = -l;
if (r <= 0)
return l * 2 +... | ALGO | 0.999325 | 4.167954 |
4a89ae62-c13b-498e-b83f-1bb488ccffaf | KaniamLaes/codeforces_solved_problems | A_Mark_the_Photographer.cpp | #include <bits/stdc++.h>
using namespace std;
#define asc(x) sort(x.begin(), x.end())
#define all(x) x.begin(),x.end()
int main()
{
int t;
cin >> t;
while (t--)
{
int n, x;
cin >> n >> x;
vector<int> h(2*n);
int sum=0;
for (int i = 0; i < 2*n; i++)
{
... | ALGO | 0.999943 | 3.978173 |
df757724-1831-4894-9f91-014d81babe26 | TCGBench/TCGBench | data/human_performance_code/human_performance_code_canonical/P4238/ac_3.cpp | #include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
typedef long long ll;
using namespace std;
namespace fast_IO {
#define IOSIZE 100000
int precision = 3, POW[10] = {1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000}; // 向下取整到小数点后第 precision 位
char ibuf[IOSIZE], obuf[IOS... | ALGO | 0.999945 | 3.230469 |
dd9f0e34-a7f7-4a91-817f-ef43f922bc00 | Muzahid037/Data-Structure | Linked List/idea_from_gfg.cpp | ///"--------------------Bismillahir Rahmanir Rahim"-----------------------///
#include <bits/stdc++.h>
using namespace std;
///_____________________________FAST I/O__________________________________///
#define Boost() \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout... | ALGO | 0.998622 | 4.373657 |
5f5192c3-c642-4314-8ac0-e0bdc4f706e6 | lmun/competitiveProgramingSolutions | codeforces/1395/c.cpp | #include <bits/stdc++.h>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstring>
#include <chrono>
#include <complex>
#define endl "\n"
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define vpii vector<pii >
#define wgraph vec... | ALGO | 0.999953 | 3.829178 |
8a422a0c-3a91-4725-b09a-a619fd1bd7ee | shashank73744/Competitive_Coding | hashing/hashing/main.cpp | #include <iostream>
#include <algorithm>
#include <math.h>
#include <stdio.h>
#include <map>
int HASHSIZE = 2000000 ;
using namespace std;
int max_nodes;
int getMid(int s, int e) {
return s + (e - s) / 2;
}
int hashingFunction1(long pos) {
return pos % 1999957;
}
int hashingFunction2(long pos) {
return... | ALGO | 0.999994 | 3.996472 |
93c25b2e-a354-45cc-a878-d3c1aaa1d296 | lintopher0315/CSES | problems/dp/edit_distance.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
string n, m;
cin >> n >> m;
int h=n.size(), w=m.size(), p, c;
vector<int> v(w+1);
for (int i=1; i<w+1; ++i) v[i]=i;
for (int i=1; i<=h; ++i) {
p=v[0];
v[0]=i;
for (int j=1; j<=w; ++j) {
c=v[j];
... | ALGO | 0.999981 | 3.896534 |
02fde263-3f70-4023-bc78-8967b8fe1a1f | Soumyadip54321/CPP_Codes | Contest/maxarrval.cpp | #include <iostream>
#include <stdlib.h>
#include <string.h>
#include <algorithm>
#include <vector>
using namespace std;
long long maxArrayValue(vector<int>& nums);
int main(){
vector<int> nums={34,92,42,24,98,87,40,82,51,67,70,75,45,57,67};
cout<<maxArrayValue(nums);
return 0;
}
long long maxArrayValue(vec... | ALGO | 0.999632 | 4.344001 |
57a2cae4-9323-4d67-8a87-52626cab2a0f | thissupershivam1/Cp_and_dsa | recursion/print_digit.cpp | #include <iostream>
using namespace std;
typedef long long ll;
// Recursive function to print digits with space, but no trailing space
void solve(ll n) {
if (n < 10) {
// Only one digit, print without space
cout << n;
return;
}
solve(n / 10); // Print higher digits first... | ALGO | 0.999882 | 6.512898 |
3b16ac16-c970-4660-81c9-3c8064fe54f7 | phpgl/php-bullet | bulletphysics/src/BulletCollision/NarrowPhaseCollision/btPersistentManifold.cpp | #include "btPersistentManifold.h"
#include "LinearMath/btTransform.h"
#include "LinearMath/btSerializer.h"
#ifdef BT_USE_DOUBLE_PRECISION
#define btCollisionObjectData btCollisionObjectDoubleData
#else
#define btCollisionObjectData btCollisionObjectFloatData
#endif
btScalar gContactBreakingThreshold = btScalar(0.02);... | ALGO | 0.964489 | 5.011851 |
03f13423-d378-4f01-9355-9f157eef788c | leizhao3/CarND-Path-Planning-Project | src/main.cpp | #include <uWS/uWS.h>
#include <fstream>
#include <iostream>
#include <string>
#include <vector>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include "json.hpp"
#include "spline.h"
#include "Eigen-3.3/Eigen/Core"
#include "Eigen-3.3/Eigen/QR"
#include "helpers.h"
#include "cost_functions.h"
#include "path_... | WEB | 0.946213 | 3.983425 |
e26aa3cb-b349-4447-8bf5-42a7ce8d49c8 | siramirsaman/GS | OpenCL/GS.cpp |
#include "GS.h"
#include "safe_call.h"
/** @brief CPU Implementation of Gauss Seidel for solving a square
* system of linear equations A.x=b
* @param x array of unknowns [N]
* @param b array of constant terms [N]
* @param A array of coefficients [N*N]
* @param N size of arrays
* @param tol toler... | ALGO | 0.999845 | 5.72221 |
c32bca22-b499-478d-9539-d374568dc537 | ishandutta2007/codeforces | andreinet/normal/629/E.cpp | #include <bits/stdc++.h>
#define SZ(x) ((int) (x).size())
using namespace std;
typedef long long i64;
const int NMAX = 100005;
int64_t dp1[NMAX], dp2[NMAX];
int treeSize[NMAX];
int father[NMAX], an[20][NMAX];
int level[NMAX];
vector<int> G[NMAX];
void dfs1(int node, int prev) {
father[node] = prev;
treeSize... | ALGO | 0.999928 | 4.13623 |
d314f1a2-b48b-48a1-83d4-94e918987f9e | HotdogsCC/GDP102_AT2_Math_Lib_Game | dependencies/glm/test/core/core_func_integer_find_lsb.cpp | // This has the programs for computing the number of trailing zeros
// in a word.
// Max line length is 57, to fit in hacker.book.
#include <cstdio>
#include <cstdlib> //To define "exit", req'd by XLC.
#include <ctime>
int nlz(unsigned x) {
int pop(unsigned x);
x = x | (x >> 1);
x = x | (x >> 2);
x = ... | ALGO | 0.999021 | 5.239535 |
9f915258-3dfb-4914-a9d7-e528154227fc | DavidAbdelmalek/Self_Driving_Car_ND | motion_planning_and_decision/starter_files/eigen-3.3.7/bench/sparse_cholesky.cpp | // #define EIGEN_TAUCS_SUPPORT
// #define EIGEN_CHOLMOD_SUPPORT
#include <iostream>
#include <Eigen/Sparse>
// g++ -DSIZE=10000 -DDENSITY=0.001 sparse_cholesky.cpp -I.. -DDENSEMATRI -O3 -g0 -DNDEBUG -DNBTRIES=1 -I /home/gael/Coding/LinearAlgebra/taucs_full/src/ -I/home/gael/Coding/LinearAlgebra/taucs_full/build/lin... | ALGO | 0.997462 | 4.147974 |
a751a7cb-cda4-4a69-95ba-7191ed5e306c | kasakgupta/DSA-A2Z | LeetCode/CombSum.cpp | #include <iostream>
#include <vector>
using namespace std;
// Function to find all unique combinations that sum to the target using DP
vector<vector<int>> combinationSumDP(vector<int> &candidates, int target)
{
// dp[i] stores all unique combinations that sum to 'i'
vector<vector<vector<int>>> dp(target + 1);
// B... | ALGO | 0.999736 | 6.973502 |
8a9146b4-255e-4c87-b15b-d3062d01b994 | Mohamedeid-11/ACM | Level 1/weeks/week 3/sheet/Beautiful Arrays.cpp | #include <iostream>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin >> n;
int nums[n];
bool found[101] = {};
for (int i = 0; i < n; i++)
{
cin >> nums[i];
if (!found[nums[i]])
found[nums[i]] = true;
}
... | ALGO | 0.999934 | 4.623894 |
c9bdfdeb-f3aa-4cdc-ba42-ea09fd45e894 | cjj0414/leetcode | src/tree/pre_order.cpp | #include "util.cpp"
vector<int> preorderTraversal(TreeNode *root)
{
stack<TreeNode *> s;
vector<int> res;
auto *curr = root;
while (curr)
{
//visit current node
res.push_back(curr->val);
//visit left subtree
if (curr->left)
{
s.push(curr);
... | ALGO | 0.999984 | 5.547998 |
d1d0e230-3501-4612-8b50-3403eee18836 | anurag-garg01/LeetcodeSolutions | 1407-group-the-people-given-the-group-size-they-belong-to/1407-group-the-people-given-the-group-size-they-belong-to.cpp | class Solution {
public:
vector<vector<int>> groupThePeople(vector<int>& groupSizes) {
// group size is 3 and so on
vector<vector<int>> ans;
int n = groupSizes.size();
/*
2 -> {0}
*/
unordered_map<int,vector<int>> mp;
for(int i =0;i<n;i++){
... | ALGO | 0.999958 | 6.142618 |
9f5afd84-a4ce-46e4-ba56-a9e79cb53b94 | adilthedealer/PP1 | ran.cpp | #include <iostream>
#include <vector>
int main() {
int n, m;
std::cin >> n >> m;
std::vector <int> a(n);
for (int i = 0; i < n; i++) {
std::cin >> a[i];
}
for (int i = 0; i < n; i++) {
if (a[i] + 1 == m || a[i] == m) {
std::cout << i + 1;
}
else {
}
}
return 0;
}
| ALGO | 0.999986 | 4.067769 |
37afeb78-60e2-4cca-8619-d95021d663fa | Ashutosh1604/DSA-Cheatsheet-loveBabbar | Array/MergeIntervals.cpp | #include<bits/stdc++.h>
using namespace std;
vector<vector<int>> merge(vector<vector<int>>& intervals) {
vector<vector<int>> res;
if(intervals.size()==0)
{
return res;
}
sort(intervals.begin(),intervals.end());
res.push_back(intervals[0]);
int ... | ALGO | 0.999927 | 5.332749 |
099fa449-1020-49b9-9e9a-281088030b52 | waschkbaer/BrainVis | src/core/Math/MathTools.cpp | /**
\file MathTools.cpp
\author Jens Krueger
SCI Institute
University of Utah
\version 1.11
\date October 2008
*/
#include "MathTools.h"
#include <algorithm>
using namespace Core::Math;
using namespace Core::Math::MathTools;
uint32_t Core::Math::MathTools::Log(uint32_t value, uint32... | ALGO | 0.90142 | 6.337288 |
6e897896-1590-4974-bd6f-31677a8febf6 | Maxwell12345/AI_Backbone_API | _eigen/doc/examples/tut_matrix_coefficient_accessors.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace Eigen;
int main()
{
MatrixXd m(2,2);
m(0,0) = 3;
m(1,0) = 2.5;
m(0,1) = -1;
m(1,1) = m(1,0) + m(0,1);
std::cout << "Here is the matrix m:\n" << m << std::endl;
VectorXd v(2);
v(0) = 4;
v(1) = v(0) - 1;
std::cout << "Here is the vector v:\n... | ALGO | 0.99868 | 3.687909 |
289c1a57-7507-44f5-a1e2-da6149762b26 | adilrauf78/scaads | 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 |
74c9b86c-14da-4dd0-8fc5-0e303a03c403 | CedricKuang/LeetCode | medium/347.top-k-frequent-elements.cpp | /*
* @lc app=leetcode id=347 lang=cpp
*
* [347] Top K Frequent Elements
*/
// @lc code=start
#include <unordered_map>
#include <map>
#include <vector>
#include <unordered_set>
using namespace std;
class Solution {
public:
vector<int> topKFrequent(vector<int>& nums, int k) {
unordered_map<int, int> fre... | ALGO | 0.9999 | 6.439904 |
b066dcef-28ad-4dc3-a1ec-92b40af7fba5 | jnyfah/LeetCode | HACKER RANK 30 DAYS OF CODE/DAY17.cpp | #include <cmath>
#include <iostream>
#include <exception>
#include <stdexcept>
using namespace std;
//Write your code here
class Calculator {
public:
int power(int n, int p) {
if(n < 0 || p < 0) {
throw runtime_error("n and p should be non-negative");
}
return pow(n, p);
... | ALGO | 0.943442 | 5.7968 |
3e07ec1a-1c9a-4842-a9b4-0286db122a9b | ritesh0402/Algorithm | LeetCode/Practice/429. N-ary Tree Level Order Traversal.cpp | /*
// Definition for a Node.
class Node {
public:
int val;
vector<Node*> children;
Node() {}
Node(int _val) {
val = _val;
}
Node(int _val, vector<Node*> _children) {
val = _val;
children = _children;
}
};
*/
class Solution
{
public:
vector<vector<int>> levelOrd... | ALGO | 0.99998 | 6.048571 |
6f0f4130-f414-4f56-a148-f595e909c8ec | AlexanderKh72/SM-CompWorkshop6 | BigProgram/BigProgram/ChiSquare.cpp | #include "ChiSquare.h"
#include "PROBDIST.H"
ChiSquare::ChiSquare(Sample* sample, Distribution& distr) :
emp_freq(nullptr), theor_freq(nullptr), t(0), pvalue(0), df(0), nstates(sample->getNstates()) {
emp_freq = new int[nstates];
theor_freq = new double[nstates];
int size = sample->size();
for (int i = 0; i < n... | ALGO | 0.963299 | 5.520702 |
ff4ea9c6-bf60-442e-a7af-fd685b86d1e7 | abhishekbiswas772/DSA | DSA_Files/src/Sorting/intersectionV1.cpp | #include<iostream>
#include<vector>
using namespace std;
std::vector<int> getIntersectionArray(std::vector<int> arr1, std::vector<int> arr2, int n1, int n2){
std::vector<int> res;
int i = 0;
int j = 0;
while( i < n1 && j < n2){
if(i > 0 && arr1[i] == arr1[i-1]){
i++;
continue;
}
if(arr1[i] < arr2[j])... | ALGO | 0.999929 | 4.916019 |
86f805e9-eac4-422c-a253-b2fb68b36090 | noammirjani/Leetcode | cpp/other/reverse-char*.cpp | #include <iostream>
#include <cstring>
/**
const char* str = "Hello";:
// Points to a read-only area in memory, the string is stored in the data segment, the content of the string cannot be changed but the pointer itself can be changed, i.e., str = "hi"
char str[] = "Hello";:
// The string is copied into an array in ... | ALGO | 0.990602 | 6.121079 |
0705820b-089e-4662-9134-419db8fd084f | cicuvc/LLVM-LA32R | libcxx/test/std/containers/associative/multiset/equal_range.pass.cpp | // <set>
// class multiset
// pair<iterator,iterator> equal_range(const key_type& k);
// pair<const_iterator,const_iterator> equal_range(const key_type& k) const;
#include <set>
#include <cassert>
#include "test_macros.h"
#include "min_allocator.h"
#include "private_constructor.h"
int main(int, char**)... | TEST | 0.874793 | 5.294887 |
fd6c3ac2-e2a7-417e-86d7-08966e23063e | bevous/c-homework-4 | lewis_Nordan_hw4/lewis_Nordan_hw4/wordprocess.cpp | #include "stdafx.h"
#include "wordprocess.h"
wordprocess::wordprocess()
{
message = "";
}
wordprocess::~wordprocess()
{
}
void wordprocess::setString(string newMessage) {
message = newMessage;
}
void wordprocess::wordsInMessage() {
words.clear();
int y = 0;
size_t pos = 0;
string copymes = message;
string ... | TOOL | 0.992798 | 4.286791 |
8ebfb37e-acc8-4ed1-99b5-d53b44333f53 | bsrinivas84/Algos | Sorting/Sorting.cpp | // Sorting.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "malloc.h"
void BubbleSort(int Input[], int length) {
int temp = 0;
for (int i = 0; i < length - 1; i++)
for (int j = i + 1; j < length; j++)
{
if (Input[i] > Input[j])
{
temp = Input[i];
Input[i... | ALGO | 0.99995 | 4.602531 |
4db6bfb1-886a-4142-81ec-a544a77845d2 | Ujjawal0204/leetcode | 57-insert-interval/insert-interval.cpp | class Solution {
public:
vector<vector<int>> insert(vector<vector<int>>& intervals, vector<int>& newInterval) {
vector<vector<int>> merged;
int i = 0;
while (i < intervals.size() && intervals[i][1] < newInterval[0]) {
merged.push_back(intervals[i]);
i++;
}
... | ALGO | 0.999981 | 6.385397 |
db538bc2-240f-4f06-bb0f-ebb4d7d1f2ef | sweetholly/Baekjoon_Algorithm_Cpp | BaekJoon_algorithm/Doit_cpp_class/4.Sort/11724.cpp | #include<iostream>
#include<vector>
using namespace std;
using std::vector;
using std::cin;
using std::cout;
using std::stack;
static stack<vector<int>> graph;
static stack<bool> check;
void DFS(int x);
int main()
{
int point, line;
int dfs_count = 0;
cin >> point >> line;
graph.resize(point + 1);
for(int ... | ALGO | 0.999376 | 3.837768 |
9a9aaa72-0ecd-4fd3-ad46-4e6778abda6f | abiam222/Data-Structures-and-Algorithms | Data Structures/Binary Search/BST/bst.cpp | #include <iostream>
using namespace std;
struct TNode {
int data;
struct TNode *left;
struct TNode *right;
};
struct TNode *create_bst();
void insert_bst(struct TNode *root, struct TNode *node);
void inorder(struct TNode *root);
void preorder(struct TNode *root);
void postorder(struct TNode *root);
int s... | ALGO | 0.999793 | 4.258202 |
d01a3c1d-a0a9-45a9-982a-0108a90686ea | Giantpizzahead/comp-programming | JOI/JOI 2022/electionwrong.cpp | /*
JOI 2022 Problem 3
Solution: DP.
Sort the states by increasing B[i].
Let dp[i][k][p] =
Minimum time required to get k votes and p people together (1 + # of collabs),
using only states 1 to i (one indexed).
Base case: dp[0][0][1] = 0
Assuming A and B are stored using zero indexing.
Transitions:
dp[i][k][p] = C
Ge... | ALGO | 0.999731 | 4.973394 |
c3dc61d7-135c-4319-9e48-3df4327f026b | AbhJ/some-cp-files-1 | learning_c++/sort3.cpp | #include<bits/stdc++.h>
int n[1000];
using namespace std;
int main(){
int N=0,i=0,j=0;
cin>>N;
string a[N];
for(i=0;i!=N;i++){
cin>>a[i];
for(j=0;j!=i;j++){
if(a[j].compare(a[i])<0)
n[i]++;
}
cout<<n[i]<<endl;
}
return 0;
} | ALGO | 0.999971 | 3.748234 |
e66e6df7-308f-4db1-a503-821dae9aa115 | sam5854/lc_submitter | C++/insert-into-a-sorted-circular-linked-list.cpp | // Time: O(n)
// Space: O(1)
// Definition for a Node.
class Solution {
public:
Node* insert(Node* head, int insertVal) {
if (head == nullptr) {
auto node = new Node(insertVal, nullptr);
node->next = node;
return node;
}
auto curr = head;
while (... | ALGO | 0.999994 | 5.942365 |
4e4f5833-6c28-4ed8-9f5d-cd4d88c97695 | kushpo357/DSA_practice | GFG_POTD/min_cost_to_make_strings_identical.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
int findMinCost(string x, string y, int cx, int cy) {
int n=x.size(),m=y.size();
vector<int>prev(m+1,0),curr(m+1,0);
for(int i=1;i<=m;i++){
prev[i]=cy*i;
... | ALGO | 0.999669 | 5.89304 |
87a884c6-6c5c-47a6-8912-113b623c3743 | david19kerrigan/codeforces | practice/923d.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int t;
cin >> t;
while(t--){
int n, k;
cin >> n >> k;
int ans[n];
bool inc = 1;
int l = 1;
int r = n;
for(int i = 0; i < k; i++){
int ... | ALGO | 0.999992 | 3.935467 |
1c067054-6b8e-495d-b593-3d8cafce7c81 | n6xej/b176cmake | boost_1_76_0/libs/algorithm/test/search_test3.cpp | #include <boost/algorithm/searching/boyer_moore.hpp>
#include <boost/algorithm/searching/boyer_moore_horspool.hpp>
#include <boost/algorithm/searching/knuth_morris_pratt.hpp>
#define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>
#include <ctime> // for clock_t
#include <iostream>
#include <fstream>
#incl... | TEST | 0.920899 | 6.017538 |
912cd97b-c852-4175-b34d-18f727b38b5d | ishandutta2007/codeforces | pavel.savchenkov/normal/187/A.cpp | //HACK ME, PLEASE! ^_^
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <vector>
#include <set>
#include <utility>
#include <math.h>
#include <cstdlib>
#include <memory.h>
#include <queue>
#define pb push_back
#define i64 long long
#define mp make_pair
#define pi... | ALGO | 0.999782 | 3.080489 |
7e96379d-e477-43ea-9b07-9000db703c23 | vallarasuk/LeetCode | solutions/238. Product of Array Except Self/238-2.cpp | class Solution {
public:
vector<int> productExceptSelf(vector<int>& nums) {
const int n = nums.size();
vector<int> ans(n, 1);
// Use ans as the prefix product array.
for (int i = 1; i < n; ++i)
ans[i] = ans[i - 1] * nums[i - 1];
int suffix = 1; // suffix product
for (int i = n - 1; i... | ALGO | 0.999957 | 6.965195 |
4cf30388-4195-4cc3-a1cb-b0d245b3547e | Rohan200511/CPP-Leetcode-Questions | 907-koko-eating-bananas/koko-eating-bananas.cpp | class Solution {
public:
int findmax(vector<int> &arr){
int maxi=arr[0];
int n=arr.size();
for(int i=0;i<n;i++){
maxi=max(maxi,arr[i]);
}
return maxi;
}
long long findhours(vector<int>& a , int hour){
long long totalh=0;
int n=a.size();
... | ALGO | 0.999929 | 5.95035 |
1f24613d-4ad0-42a1-9df2-311f924b81c7 | manni2000/5th-Semester | Algo/Assignments/Kruskal/Kruskal.cpp | #include <bits/stdc++.h>
using namespace std;
class Edge
{
public:
int src;
int dest;
int weight;
};
bool compare(Edge e1, Edge e2)
{
return e1.weight < e2.weight;
}
int getParent(int v, int *parent)
{
if (parent[v] == v)
return v;
return getParent(parent[v], parent);
}
Edge *kruskal... | ALGO | 0.99999 | 4.434987 |
25954c1d-cd48-4b6d-b36f-c9ea716543fb | SunnyYeahBoiii/DSA-Assignments | Week2/Codes/Manual_Quick_Sort/a.cpp | #include<bits/stdc++.h>
using namespace std;
const int MAXN = 1e6 + 5;
int n , m;
int a[MAXN];
void QuickSort(int l , int r){
if(l >= r) return;
int pivot = a[r];
int j = l;
for(int i = l ; i < r ; i++){
if(a[i] > pivot) continue;
swap(a[i] , a[j]);
j++;
}
swap(a[r]... | ALGO | 0.999653 | 3.725779 |
bd47eb27-8669-43b5-b9d1-a404e8f582f9 | ishandutta2007/codeforces | user202729_/normal/1326/F1.cpp | // "undefined behavior is accepted"
#ifndef LOCAL
#define NDEBUG 1
#endif
#include<bits/stdc++.h>
std::vector<int> add;
std::array<std::vector<int>, 2> countBinary;
unsigned constexpr revbit(unsigned x){
x=(x&0x55555555)<<1|((x>>1)&0x55555555);
x=(x&0x33333333)<<2|((x>>2)&0x33333333);
x=(x&0x0f0f0f0f)<<4|((x>>4)&... | ALGO | 0.999987 | 3.975162 |
d9a26f69-2a44-40a3-bbe9-6d5c3b78a81b | Ravi-Khatri/code | CAKE wALK/catwalk - Copy.cPP | #include <iostream>
using namespace std;
int main() {
int t;
cin>>t;
while(t--)
{ int c=0;
long long int n,i=1;
cin>>n;
while(n)
{ cout<<i<<" ";
if(n%10==0)
n/=10;
if(n%20==0)
n/=20;
... | ALGO | 0.999808 | 3.435316 |
9912d8ad-a631-404d-945b-05e2619ddcd3 | Prabhat2002/Final_450 | Rotten Oranges.cpp | class Solution
{
public:
bool valid(int i,int j,vector<vector<int>>&grid)
{
if(i>=0 && i<grid.size() && j>=0 && j<grid[0].size() && grid[i][j]==1)
return 1;
return 0;
}
int orangesRotting(vector<vector<int>>& grid)
{
int fresh=0;
int n=grid.size();
... | ALGO | 0.999953 | 6.104118 |
51836fd7-609a-4430-805e-a1e7f0027877 | OpenFaker/MyScaleDB | src/AggregateFunctions/AggregateFunctionQuantileTimingWeighted.cpp | #include <AggregateFunctions/AggregateFunctionQuantile.h>
#include <AggregateFunctions/QuantileTiming.h>
#include <AggregateFunctions/AggregateFunctionFactory.h>
#include <AggregateFunctions/Helpers.h>
#include <DataTypes/DataTypeDate.h>
#include <DataTypes/DataTypeDateTime.h>
#include <Core/Field.h>
namespace DB
{
st... | TOOL | 0.869947 | 7.921647 |
2bd2db22-4589-4ba3-b8a2-33192388feaa | mr-vicky/LeetCode | 2475-number-of-unequal-triplets-in-array/2475-number-of-unequal-triplets-in-array.cpp | class Solution {
public:
int unequalTriplets(vector<int>& nums) {
int count = 0;
int n = size(nums);
for(int i=0; i<n; i++)
for(int j=i+1; j<n; j++)
for(int k=j+1; k<n; k++)
if(nums[i]!=nums[j] && nums[i]!=nums[k] && nums[j]!=nums[k])
... | ALGO | 0.999946 | 5.393919 |
7379c3c1-4cee-4991-9e07-2e1a7da5bdfa | 2369931/LintCode | code/127_拓扑排序.cpp | #include <iostream>
#include <cmath>
#include <limits>
#include <vector>
#include <string>
#include <map>
using namespace std;
struct DirectedGraphNode {
int label;
vector<DirectedGraphNode *> neighbors;
DirectedGraphNode(int x) : label(x) {};
};
vector<DirectedGraphNode*> topSort(vector<DirectedGraphNod... | ALGO | 0.999905 | 5.108704 |
6a551393-f9bc-47a7-87c9-54d537574816 | iagozag/competitive_programming | contests/cf/contest/628d2/ehab_and_path-etic_mexs.cpp | #include <bits/stdc++.h>
using namespace std;
#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define all(a) (a).begin(), (a).end()
#define endl '\n'
#define f first
#define s second
#define pb push_back
typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ll> vl;
const int INF =... | ALGO | 0.999989 | 4.21456 |
71b6c2fd-3e17-496b-a7e0-b089807b4d6e | ConnorMacDonell/Interview_Preparation_Solutions | src/LinkedList.cpp | /*
* LinkedList.cpp
*
* Created on: Apr 1, 2019
* Author: Connor
*/
#include "LinkedList.h"
ll_node* newLLNode(int data){
ll_node* node = new ll_node;
node -> data = data;
node -> next = NULL;
return node;
}
void nodeSwap(ll_node* prevNode1, ll_node* prevNode2){
if(!prevNode1 || !prevNode2 || !prevNo... | ALGO | 0.968444 | 4.014269 |
a9760d59-aca7-4d0b-b3d6-a69a20757da3 | ros2cuda/cupoch-fat | src/tests/test_utility/sort.cpp | #include "tests/test_utility/sort.h"
using namespace thrust;
// ----------------------------------------------------------------------------
// Greater than or Equal for sorting Eigen::Matrix<T, Dim, 1> elements.
// ----------------------------------------------------------------------------
template <typename T, int... | TEST | 0.995698 | 7.35545 |
630f5681-154d-441f-81ce-55a85348588f | pn1137/LeetCode-Exercises | distribute_candies.cpp | /*
575. Distribute Candies
Alice has n candies, where the ith candy is of type candyType[i]. Alice noticed that she started to gain weight, so she visited a doctor.
The doctor advised Alice to only eat n / 2 of the candies she has (n is always even). Alice likes her candies very much, and she wants to eat t... | ALGO | 0.999891 | 6.137296 |
ef1c4a78-b57f-417e-9389-be6e145ac17f | abaytek/Competitive-Programming | 2007-find-original-array-from-doubled-array/2007-find-original-array-from-doubled-array.cpp | class Solution {
public:
vector<int> findOriginalArray(vector<int>& changed) {
vector<int>original;
unordered_map<int,int>mp;
for(auto& i:changed)
mp[i]++; // O(n)
sort(changed.begin(),changed.end()); // O(nlogn)
for(auto& i:changed){
... | ALGO | 0.999978 | 5.475542 |
b33b4890-aeb6-4d90-9b1b-c83f1f1a220f | Aeopp/Github | MyStudy/Convenience_Lib/Sample.cpp | #include <iostream>
#include <vector>
#include <random>
#include <algorithm>
#include <iterator>
#include <map>
#include <iomanip>
using namespace std;
int main() {
const size_t data_points{ 100'000 };
const size_t sample_points{ 10 };
const int mean{ 100 };
const size_t dev{ 1 };
random_device rd;
mt19937 g... | ALGO | 0.998476 | 3.766638 |
213dbd48-e79c-4973-9532-1dcecd20059d | Pardeep009/Coding-Questions | swap using resursion in array.cpp | #include<iostream>
using namespace std;
void f(int a[],int i,int j)
{
static int c=-1;
if(a[j]==-1)
{
c=i;
return;
}
else if(a[j+1]==-1)
{
c=i+1;
return;
}
else
{
f(a,i+1,j+2);
a[i]=a[i]+a[c];
a[c]=a[i];
c++;
}
}
int main()
{
int n,i,j=0;
int a[100];
cin>>i;
while(i!=-1)
{
a[j++]=i;
c... | ALGO | 0.999979 | 3.274141 |
36a347d5-e0b0-4b8d-bd6d-db7190e296cb | CoderAbhinav/6Companies30Days | MICROSOFT/396_ROTATE_FUNCTION.cpp | #include <iostream>
#include <string>
#include <vector>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <iomanip>
#include <climits>
#define FAST_IO \
ios_base::sync_with_stdio(false); \
cin.tie(0); \
cout.tie(0);
#define ll long lo... | ALGO | 0.999408 | 4.851362 |
8347d8f9-a6c4-48f5-8351-049f2af9772c | Melor-Smith/Mi-Primer-Repo | Nueva carpeta/HY.CPP | #include <iostream>
using namespace std;
int main() {
register int suma = 0;
int n;
cout << "Introduce un número entero positivo: ";
cin >> n;
for (register int i = 1; i <= n; ++i) {
suma += i;
}
cout << "La suma de los números del 1 al " << n << " es: " << suma << endl;
return 0... | ALGO | 0.994946 | 3.828385 |
56d83a52-84e6-4a3c-9b7f-a94533210b3d | Prachi1429/Data-Structures-Lab | Lab_Program_3.cpp | #include <iostream>
using namespace std;
int main()
{
int n,ele;
cout<<"Enter size of array: \n";
cin>>n;
int arr[n];
for(int i=0;i<n;i++)
{
cin>>arr[i];
}
for(int i=0;i<n-1;i++)
{
for(int j=0;j<n-i-1;j++)
{
if(arr[j]>arr[j+1])
{... | ALGO | 0.999695 | 4.40164 |
68b090e0-9ce3-4760-805a-2cd5b1aa3e7e | sci-visus/OpenVisus | Libs/slamcpp/ExternalLibs/g2o/g2o/core/optimization_algorithm_dogleg.cpp | #include "optimization_algorithm_dogleg.h"
#include <iostream>
#include "g2o/stuff/timeutil.h"
#include "block_solver.h"
#include "sparse_optimizer.h"
#include "solver.h"
#include "batch_stats.h"
using namespace std;
namespace g2o {
OptimizationAlgorithmDogleg::OptimizationAlgorithmDogleg(BlockSolverBase* solver... | ALGO | 0.999923 | 6.663886 |
f5898350-0eaa-45cc-a423-5c0d68b40901 | Aditi1017/SDE-Problems | Day 25/Unbounded Knapsack(DP).cpp | #include <bits/stdc++.h>
using namespace std;
//int dp[1002][102];
int max(int a ,int b)
{
return a > b ? a:b;
}
int Knapsack(int weight[] , int val[] , int W , int n)
{
int dp[n+1][W+1];
for(int i = 0 ; i <= n ; i++)
{
for(int j = 0 ; j<= W ; j++)
{
if(i ==0 || j ==0)
... | ALGO | 0.999933 | 4.344938 |
3d3f0d84-6485-4bf7-945a-f06e1c1fb87a | kks227/BOJ | 1300/1326.cpp | #include <cstdio>
#include <queue>
using namespace std;
int main(){
int N, S, E, A[10000];
scanf("%d", &N);
for(int i=0; i<N; i++)
scanf("%d", A+i);
scanf("%d %d", &S, &E);
S--; E--;
bool visited[10000] = {0};
visited[S] = true;
queue<int> Q;
Q.push(S);
for(int result = 0; !Q.empty(); result++){
if(visi... | ALGO | 0.99999 | 3.16928 |
0d200006-b30a-44c2-9a82-829517734ed4 | HackudoZone/emergency_assist_app | 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.998733 | 6.76775 |
d59cec34-3cd1-40cb-a298-c5e5af36d751 | elyryba/darkpool | src/core/post_trade_drift.cpp | #include "darkpool/core/post_trade_drift.hpp"
#include <cmath>
#include <algorithm>
#include <numeric>
namespace darkpool {
PostTradeDrift::PostTradeDrift(const Config& config) : config_(config) {
symbol_data_.reserve(1000);
}
void PostTradeDrift::on_trade(const Trade& trade) {
std::unique_lock lock(data_mut... | ALGO | 0.968247 | 7.470095 |
1a291c12-3163-49be-8786-2e85170e47fd | Jaimedev12/tareas-prograsofia | Abril 2024/15Abril-21Abril/10792_Bloques_cayendo.cpp | #include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define _ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
// Esta matriz es global, entonces se puede acceder a ella desde
// cualquiera de las funciones del archivo
vector<vector<bool>> mat(10, vector<bool>(10));
void placeInColumn(int c) {
... | ALGO | 0.999952 | 4.220813 |
fa7a5879-9c38-48ec-8053-6183b8fa5505 | AlexeyEf/skillbox | C++/11/task_2/main.cpp | #include <iostream>
bool checkEMail(std::string eMail);
int getSeparateEMailIdx(std::string eMail);
std::string getFirstEMailPart(std::string eMail);
std::string getLastEMailPart(std::string eMail);
bool checkFirstEMailPart(std::string str);
bool checkLastEMailPart(std::string str);
int main()
{
std::string eMai... | ALGO | 0.995686 | 5.1887 |
1f616b1a-aac1-459b-a0fa-9370e66a0185 | IITH-Compilers/bullseye | boost_1_76_0/libs/move/test/bench_sort.cpp | #include <cstdlib> //std::srand
#include <algorithm> //std::stable_sort, std::make|sort_heap, std::random_shuffle
#include <cstdio> //std::printf
#include <iostream> //std::cout
#include <boost/container/vector.hpp> //boost::container::vector
#include <boost/config.hpp>
#include <boost/move/unique_ptr.hpp>
#inc... | ALGO | 0.989591 | 5.689814 |
24d0e115-7f57-434d-b45a-bedd6dc68cf3 | manikanta2901/ubuntu | .history/practice/cpp/codeforces/NizzerAndColourful_20210319195807.cpp | // https://codeforces.com/problemset/problem/1478/A
#include <bits/stdc++.h>
#include<vector>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<iterator>
#include<string>
#include<map>
#include<queue>
using namespace std;
#define trav(dataType,DataStruct,name) for(dataType<DataStruct>::itt ip = name.bb();... | ALGO | 0.999937 | 3.92181 |
3bc9f3c1-b46a-4cfd-bcdb-706273fab133 | Abidur24/Codeforces | 919B - Perfect 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>
#define ll long long
#define FASTIO ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb pus... | ALGO | 0.999796 | 3.286635 |
8e4a4977-44ba-41d2-819c-ec91c3bcf130 | akhilr007/Leetcode-problems | 28-implement-strstr/28-implement-strstr.cpp | class Solution {
public:
int strStr(string haystack, string needle) {
int n = haystack.length();
int m = needle.length();
if(m==0) return 0;
for(int i=0; i<=n-m; i++){
int j;
for(j=0; j<m; j++){
if(needle[j] != haysta... | ALGO | 0.999956 | 5.902044 |
3ceaf00b-1936-4bee-91ed-12866f98932d | aminnazari91/BASU-CPP | chap0/t12.cpp | #include <iostream>
using namespace std;
int main(){
int a, b, c, max;
cout<<"Enter muliple numbers splited by spaces(a, b, c):";
max = (a > b) ? ( (a > c) ? a : c ) : ( (b > c) ? b : c );
cout << max;
return 0;
} | ALGO | 0.992833 | 3.921271 |
5b2ba5bf-bf10-4793-a30b-42affb418351 | hbs-harsh/LeetCode-problem | 260-SingleNumberIII/260-SingleNumberIII.cpp | // Last updated: 6/27/2025, 4:37:20 PM
class Solution {
public:
vector<int> singleNumber(vector<int>& nums) {
int xorAll=0;
for(int num:nums){
xorAll = xorAll^num;
}
int val=xorAll;
int i=0;
while((val&1)==0){
val=val>>1;
i++;
}
... | ALGO | 0.999977 | 5.720134 |
6e9c80a9-d782-4051-933c-8e53ff492426 | bit24/Competitive-Programming | Contests/JOI/bubblesort2.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
type... | ALGO | 0.999949 | 4.428911 |
f315607a-4439-42eb-886b-4b273c0612dc | zethuman/PP1 | Lab/lab.2/72782.0.cpp | #include <iostream>
using namespace std ;
int n, x;
int a = 0;
int b = 0 ;
int main ()
{
cin>>n;
for ( int i = 0; i < n ; i++ )
{
cin >> x;
if ( x%2==0 ) a++;
else b++;
}
cout << a << " " << b << endl;
}
| ALGO | 0.998893 | 3.746207 |
9e863193-60f0-4ac7-bd9f-a769ee1f9566 | LordAlain/Leetcode | 0167-two-sum-ii-input-array-is-sorted/0167-two-sum-ii-input-array-is-sorted.cpp | class Solution {
public:
vector<int> twoSum(vector<int>& numbers, int target) {
int l = 0, r = numbers.size() - 1;
while (l < r) {
int tsum = numbers[l] + numbers[r];
if (tsum > target) {
r--;
} else if (tsum < target) {
l++;
... | ALGO | 0.999701 | 6.684562 |
45d27acf-01ca-40b8-b43e-b937651168a5 | atul4sharma/hackerEarthProblems | monk_and_power_of_time.cpp | #include <iostream>
#include <string>
#include <list>
using namespace std;
int main()
{
unsigned int n,x,cost,temp;
list<unsigned int> order,correctOrder;
list<unsigned int>::iterator iter,newIter;
cin>>n;
for(unsigned int i=0;i<n;i++)
{
cin>>x;
order.push_back(x);
}
... | ALGO | 0.999885 | 3.30973 |
450e2b48-a9d5-40db-826c-c0e3bf904a82 | changsongzhu/leetcode | C++/per_day/06-19-2017/625_m.cpp | /**
625[M]. Minimum Factorization
Given a positive integer a, find the smallest positive integer b whose multiplication of each digit equals to a.
If there is no answer or the answer is not fit in 32-bit signed integer, then return 0.
Example 1
Input:
48
Output:
68
Example 2
Input:
15
Output:
35
**/
ss Solution {
pub... | ALGO | 0.999979 | 5.892039 |
a9665322-261f-4fb9-a362-cdb3c340434c | sudoosama/flutter-build-demo | 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.998693 | 6.797273 |
55d8e041-ed0e-4339-aff6-e163e9de82fc | manikanta2901/CCC | .history/Day 3/Test/Answers/HappySightening_20210306161322.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int size;
cin >> size;
map<int,int>aa;
int max =INT_MIN;
for(int i = 0; i < size; i++){
int a;
cin >> a;
aa[a]++;
}
return 0;
} | ALGO | 0.999726 | 3.754283 |
5482c6ed-0431-48a9-bec2-4ebc8f344d4b | rejesthm/his_words_flutter | 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.998733 | 6.76775 |
23e9a8f0-67ec-474c-b873-1ca98183aa9c | raincross7/code-similarity | codes/train_code/problem305/problem305_239.cpp | #include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
const double EPS = 1e-9;
#define INF (1LL<<60)
#define D double
#define fs first
#define sc second
#define int long long
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define RFOR(i,a,b) for(int i = (int)(b-1);i>=(int)(... | ALGO | 0.99992 | 4.221527 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.