uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
984dc641-c4a5-4e62-84f5-8da63b0702fe | mrityunjay33/DSA | 0324-wiggle-sort-ii/0324-wiggle-sort-ii.cpp | class Solution {
public:
void wiggleSort(vector<int>& nums) {
int n = nums.size();
priority_queue<int> q(nums.begin(), nums.end());
for(int i=1; i<n; i+=2) {
nums[i] = q.top();
q.pop();
}
for(int i=0; i<n; i+=2) {
nums[i] = q.top();
... | ALGO | 0.999996 | 5.436344 |
251c7046-cac7-4e4f-83e8-9c161b78890c | criezy/script_cmd | equation_module.cpp | #include "equation_parser.h"
#include "modules.h"
#include <math.h>
#include <ctype.h>
#include <stdio.h>
#ifdef USE_READLINE
#include <readline/readline.h>
#include <readline/history.h>
#endif
void printEquationModuleHelp(int mode) {
switch (mode) {
case 1:
printf("The recognized constants are:\n");
printf(" -... | TOOL | 0.912189 | 4.034343 |
17892b3f-95e2-4139-aa50-2e467e2ff007 | ishandutta2007/codeforces | mr_spade/normal/1536/A.cpp | #include<bits/stdc++.h>
using namespace std;
const int N=105;
int n,mn,mx;
inline void solve()
{
int x;
register int i;
cin>>n;mn=200;mx=-200;
for(i=1;i<=n;i++)
cin>>x,mn=min(x,mn),mx=max(x,mx);
if(mn<0)
return puts("NO"),void();
puts("YES");
cout<<101<<endl;
for(i=0;i<=100;i++)
cout<<i<<' ';
cout<<endl;... | ALGO | 0.999772 | 4.056958 |
79490873-8693-4b48-8625-a9639f4c3052 | imShubh03/Basic-DSA | C++/Strings/remove-Brackets.cpp | #include<bits/stdc++.h>
using namespace std;
string removebrac(string &s){
int n = s.size();
string ans="";
for(int i =0; i<n; i++){
char ch = s[i];
if(ch == '(' || ch == ')') continue;
ans += ch;
}
return ans;
}
int main(){
string s;
getline(cin, s);
string... | ALGO | 0.999857 | 4.659541 |
84c13825-6877-4b91-9728-5314a91951eb | qyhs-2000/QyhsEngine | engine/3rdparty/JoltPhysics/Jolt/Physics/Collision/BroadPhase/BroadPhaseBruteForce.cpp | #include <Jolt/Jolt.h>
#include <Jolt/Physics/Collision/BroadPhase/BroadPhaseBruteForce.h>
#include <Jolt/Physics/Collision/RayCast.h>
#include <Jolt/Physics/Collision/AABoxCast.h>
#include <Jolt/Physics/Collision/CastResult.h>
#include <Jolt/Physics/Body/BodyManager.h>
#include <Jolt/Physics/Body/BodyPair.h>
#include ... | ALGO | 0.97828 | 7.787055 |
038e1039-ff97-4747-92cf-f83005d79a5c | Ayushluthra2001/LeetCode-CN-POTD | Find the Array Concatenation Value(O(1))space.cpp | class Solution {
public:
long long findTheArrayConcVal(vector<int>& nums) {
int start=0,end=nums.size()-1;
long long ans=0;
while(start<=end){
if(start==end){
ans+=nums[start];
return ans;
}else{
long long n=stoi(to_stri... | ALGO | 0.999959 | 6.626715 |
b9694156-91cc-41aa-ac33-34e264b28818 | Next-Gen-UI/Code-Dynamics | Leetcode/1000-2000/1428. Leftmost Column with at Least a One/1428.cpp | /**
* // This is the BinaryMatrix's API interface.
* // You should not implement it, or speculate about its implementation
* class BinaryMatrix {
* public:
* int get(int row, int col);
* vector<int> dimensions();
* };
*/
class Solution {
public:
int leftMostColumnWithOne(BinaryMatrix& binaryMatrix) {
... | ALGO | 0.999443 | 6.787724 |
e905bd40-1019-4b52-a890-a663daa3908a | nirajbawa/dsa | 38-lec/keypad.cpp | class Solution {
public:
void solve(string digit, string output, int index, vector<string>& ans, string mapping[])
{
if(index>=digit.length())
{
ans.push_back(output);
return;
}
int number = digit[index] - '0';
string value = mapping[number];
... | ALGO | 0.999935 | 6.726481 |
fcc3ac39-60f8-4740-aaf2-86949b342e95 | LemoNade2000/ProblemSolving | Google/KickStartF/PB/src/PB.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define MOD 1000000007
int TC;
int N, Q;
vector<vector<int>> adj;
vector<int> level;
vector<int> lvlCnt;
int solve(){
cin >> N >> Q;
adj = vector<vector<int>>(N + 1);
level = vector<int>(N + 1, -1);
lvlCn... | ALGO | 0.999767 | 4.525521 |
6b14d8ae-1db7-4ee2-b483-cfd4b3a33c6b | YangWoomin/Algorithms | QuickSort/Source.cpp | #include "SortCommon.h"
using namespace std;
class QuickSort : public SortCommon
{
public:
virtual void Sort() override
{
Sort(0, size - 1);
}
private:
void Sort(std::size_t left, std::size_t right)
{
if (nullptr == arr)
return;
std::size_t pivot = (left + right) / 2;
if (right > left)
{
std::s... | ALGO | 0.99907 | 5.479359 |
46b78323-bf67-41be-90fc-8ab216834f98 | CSE71/Coding-in-Cpp | Coding/GFG/LinkedList/Detect Loops.cpp | // If N is given i.e here it is 300
//Cheap method :")
/*
// C program to detect loop in a linked list
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
struct Node {
int data;
struct Node *next;
Node(int x) {
data = x;
next = N... | ALGO | 0.998907 | 4.718241 |
26b83f37-aebe-4694-bb3b-350a9229f174 | kamala-mohan/Competitive_coding | maximumdraws.cpp | #include<iostream>
using namespace std;
int main(){
int T;
cin>>T;
while(T--){
int n;
cin>>n;
cout<<n+1<<endl;
}
return 0;
} | ALGO | 0.994346 | 3.531596 |
b695a784-c9d1-4a44-a501-5e5685b0b005 | zhangfuli/homework | dataStructure/hash.cpp | #include<iostream>
#include<assert.h>
#include<math.h>
using namespace std;
struct Node
{
int Key; // 关键字
Node *next;
};
struct HeadNode
{
Node *next;
};
class Hash
{
protected:
HeadNode *ht; // 散列表结头,存放的是指针而非具体的地址,只是提供一个索引而已
int p; // 除留余法... | ALGO | 0.999643 | 3.142626 |
9448fbb6-4f15-4555-abdd-d7264a739365 | yinchunlong/abelkhan-1 | ext/c++/thirdpart/c++/boost/libs/numeric/odeint/examples/van_der_pol_stiff.cpp | #include <iostream>
#include <fstream>
#include <utility>
#include <boost/numeric/odeint.hpp>
#include <boost/phoenix/core.hpp>
#include <boost/phoenix/operator.hpp>
using namespace std;
using namespace boost::numeric::odeint;
namespace phoenix = boost::phoenix;
const double mu = 1000.0;
typedef boost::numeric::ub... | ALGO | 0.997699 | 5.570545 |
62e891d4-e8f1-4085-a63e-9c3d818e01cf | fekijj/flowsense | flowsense/functions/ragebot/animfix.cpp | #include "animfix.h"
#include "../features.h"
#include "../../base/tools/threads.h"
void c_animation_fix::anim_player_t::simulate_animation_side(records_t* record)
{
auto state = ptr->animstate();
if (!state)
return;
if (!last_record)
state->last_update_time = (record->sim_time - interface... | ALGO | 0.892156 | 4.393771 |
471bbc9b-83ae-43fe-a040-e2c1f5730fc3 | dashdeckers/Wildfire-Control-Python | pyastar/astar.cpp | #include <queue>
#include <limits>
#include <cmath>
// represents a single pixel
class Node {
public:
int idx; // index in the flattened grid
float cost; // cost of traversing this pixel
Node(int i, float c) : idx(i),cost(c) {}
};
// the top of the priority queue is the greatest element by default... | ALGO | 0.999973 | 6.432815 |
1813bbb7-2977-48c6-b18b-e424ce9a4d5d | mariahito/studious | lab8/inlab/inlab3.cpp | #include <iostream>
using namespace std;
void printArray (int nums[], int length) {
for(int i = 0; i < length; i++) {
cout<< nums[i] << ' '<< endl;
}
}
int main() {
int length = 5;
int nums[] = {3, 4, 2, 5, 7};
printArray(nums, length);
}
| ALGO | 0.910297 | 4.735229 |
d0fd10ab-9865-454e-a290-bce2865afe51 | lauslim12/competitive-programming | codeforces/A-Set/601 - 700/677 - Vanya and the Fence.cpp | #include <iostream>
using namespace std;
int main() {
int numberOfFriends, fenceHeight, ans = 0, friendHeight;
cin >> numberOfFriends >> fenceHeight;
while(numberOfFriends--) {
cin >> friendHeight;
if(friendHeight > fenceHeight) {
ans += 2;
}
else {
ans += 1;
}
}
cout << an... | ALGO | 0.999815 | 3.746246 |
630c7a61-7397-4d28-957b-ece84c475593 | appiniakhil/Leetcode_solutions | solutions/0557-Reverse Words in a String III.cpp | class Solution {
public:
//Time Complexity :O(n * n) && Space Complexity :O(1)
string reverseWords(string s) {
int n = s.length();
int j=0;
for(int i=0;i<n;i++)
{
if(s[i] == ' ')
{
reverse(s.begin() + j,s.begin() + i);
j=i+... | ALGO | 0.999997 | 6.154459 |
7b8a9d4a-090f-4f66-ba41-8281bcfd8028 | ksw1220/BOJ-Problem-Solving | 6416.cpp | #include <iostream>
#include <vector>
#include <queue>
#define MAXNUM 14
using namespace std;
vector<vector<int>> tree;
vector<int> indegree, outdegree;
bool isTree(int root)
{
queue<int> que;
vector<bool> visited;
visited.assign(MAXNUM, false);
que.push(root);
visited[root] = true;
while (!... | ALGO | 0.999686 | 4.551966 |
0c4341c1-856c-4ab1-a403-d0ec37202bc8 | liaoy14866/algorithmic_code | code/codevs_1082_common.cpp | #include<cstdio>
#include<algorithm>
#include<vector>
using namespace std;
char ch;
inline void read(int &a){
for(ch=getchar();ch<'0'||ch>'9';ch=getchar());
for(a=0;ch>='0'&&ch<='9';ch=getchar())(a*=10)+=ch-'0';
}
int n,m;
int A[200010];
struct node{
int l,r,m;
long long tag,sum;
};
node Seg[500010];//һ㻹dz2.5
inli... | ALGO | 0.999883 | 3.887772 |
ed427675-8429-43d6-880b-93e67dcfd904 | q3chain/q3 | src/chain/chain.cpp | #include "chain/chain.h"
using namespace std;
/**
* CChain implementation
*/
void CChain::SetTip(CBlockIndex *pindex) {
mc_gState->ChainLock();
if (pindex == NULL) {
vChain.clear();
mc_gState->ChainUnLock();
return;
}
vChain.resize(pindex->nHeight + 1);
while (pindex && v... | ALGO | 0.997799 | 5.632514 |
49947f90-541a-49b8-b15a-afaa3084d79a | kevinkinking/cartoon | main.cpp | #include <opencv2/core.hpp>
#include <opencv2/dnn.hpp>
#include <opencv2/dnn/shape_utils.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/highgui.hpp>
using namespace cv;
using namespace cv::dnn;
#include <iostream>
using namespace std;
const size_t inWidth = 800;
const size_t inHeight = 800;
const float inSca... | DATA | 0.857949 | 4.250986 |
15d6a843-53f1-4696-981f-142ec2e1025d | Vasanth-96/DSA | Algorithms/sorting/merge_sort.cpp | #include<bits/stdc++.h>
using namespace std;
// merge function
void merge(int arr[], int start, int mid, int end)
{
int n1 = mid-start+1;
int n2 = end-mid;
int a1[n1];
int a2[n2];
for(int i=0;i<n1;i++)
{
a1[i] = arr[i+start];
}
for(int i=0;i<n2;i++)
{
a2[i] = arr[i+mi... | ALGO | 0.999997 | 4.986969 |
bacb467a-bb32-4f60-b178-77ac5eefbc3d | raincross7/code-similarity | codes/train_code/problem040/problem040_191.cpp | #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
using namespace std;
typedef long long ll;
int main(){
int N;
cin >> N;
int d[N];
for(int i=0;i<N;i++){
cin >> d[i];
}
sort(d,d+N);
cout << d[N/2]-d[N/2-1]<< endl;
}
| ALGO | 0.999876 | 4.204329 |
12234b1d-ac69-4e14-bc2f-b07531954f7d | sjtuyinjie/M3DGR | baseline_systems/Ground_Fusion_M3DGR/src/Ground-Fusion/vins_estimator/src/factor/pose_local_parameterization.cpp | #include "pose_local_parameterization.h"
bool PoseLocalParameterization::Plus(const double *x, const double *delta, double *x_plus_delta) const
{
Eigen::Map<const Eigen::Vector3d> _p(x);
Eigen::Map<const Eigen::Quaterniond> _q(x + 3);
Eigen::Map<const Eigen::Vector3d> dp(delta);
Eigen::Quaterniond dq... | ALGO | 0.988425 | 6.093532 |
e90a6ac7-73d9-4dfc-8c67-134dc73b2c93 | chiranjib22/Codeforces_Solve | Divisibility_Problem.cpp | #include<iostream>
using namespace std;
int main()
{
int t;
int a,b,r;
cin >> t;
while(t--)
{
cin >> a >> b ;
if(a%b!=0)
{
r=((a/b)+1)*b-a;
}
else r= 0;
cout << r << endl;
}
return 0;
} | ALGO | 0.99991 | 3.990705 |
a1a94abe-f4eb-4981-b1d2-7b5a5b8a783e | cybertk/opencv | opencv/src/opencv/cv/cvfeatureselect.cpp | #include "_cv.h"
#define cmp_features( f1, f2 ) (*(f1) > *(f2))
static CV_IMPLEMENT_QSORT( icvSortFeatures, int *, cmp_features )
CV_IMPL void
cvGoodFeaturesToTrack( const void* image, void* eigImage, void* tempImage,
CvPoint2D32f* corners, int *corner_count,
double qu... | ALGO | 0.999323 | 6.538709 |
d19a5e2b-a4c0-4aed-8f33-dc35151808a3 | phantom23333/3D-Gaussian-Reconstruction | submodules/tetra-triangulation/CGAL-5.6.1/demo/CGAL_ipelets/pca.cpp | #include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include <CGAL/Simple_cartesian.h>
#include <CGAL/CGAL_Ipelet_base.h>
#include <CGAL/linear_least_squares_fitting_2.h>
#include <boost/utility.hpp>
namespace CGAL_pca{
//~ typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel;
ty... | ALGO | 0.99878 | 4.930801 |
3a1ad066-b121-44cb-a5fe-daf44d30952b | GlodonOpenSrc/Qt5.4.2_Glodon | qtwebengine/src/3rdparty/chromium/third_party/smhasher/src/sha1.cpp | /*
SHA-1 in C
By Steve Reid <<EMAIL>>
100% Public Domain
-----------------
Modified 7/98
By James H. Brown <<EMAIL>>
Still 100% Public Domain
Corrected a problem which generated improper hash values on 16 bit machines
Routine SHA1Update changed from
void SHA1Update(SHA1_CTX* context, unsigned char* data, unsigned i... | ALGO | 0.998543 | 6.354428 |
c4a99753-b30e-4595-bf0c-097bfc2e7bb3 | marioyc/Online-Judge-Solutions | ZOJ/3668 - Launching the Spacecraft.cpp | #include <cstdio>
using namespace std;
int u[22000],v[22000],w[22000],ne;
int dist[1001];
int main(){
int N,M,l,r,a,b;
while(scanf("%d %d",&N,&M) == 2){
ne = 0;
for(int i = 0;i < M;++i){
scanf("%d %d %d %d",&l,&r,&a,&b);
u[ne] = l - 1; v[ne] = r; w[ne] = ... | ALGO | 0.999828 | 3.050006 |
07be550d-c2e3-4a17-a393-e2ca01e7ccfb | AstronOmewa/Ege4All | old/24/cpp/24_2.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
fstream f("D://Ege4All/old/24/cpp/1_24.txt");
string s;
f >> s;
vector<char> line(s.begin(), s.end());
for(int i = 0; i<10000001; i++){
line[i] = (char)(s[i]);
}
char * l = line.data()+1,
* r = line.data(),
... | ALGO | 0.999579 | 3.507263 |
7130c279-bb20-4b12-9027-1b6dd1d71bbc | K11Arnav/sigArnav | C++/NzeroToEnd.cpp | #include <iostream>
using namespace std;
int main()
{
int size;
cin >> size;
int arr[size];
for (int i = 0; i < size; i++)
{
cin >> arr[i];
}
int k=n-1;
for (int i = 0; i < size; i++)
{
if (arr[i] == 0)
{
for (int j = i; j < size-1; j++)
... | ALGO | 0.999905 | 4.058965 |
49e7f25a-945d-4964-b9ef-ad9c2f0d5f7d | elemental/Elemental | src/lapack_like/spectral/Polar.cpp | #include <El.hpp>
#include "./Polar/QDWH.hpp"
#include "./Polar/SVD.hpp"
namespace El {
// Compute the polar decomposition of A, A = Q P, where Q is unitary and P is
// Hermitian positive semi-definite. On exit, A is overwritten with Q.
template<typename Field>
PolarInfo Polar( Matrix<Field>& A, const PolarCtrl& ct... | ALGO | 0.996385 | 6.29158 |
048a7642-c29e-411e-bc4a-c31b31f4cbab | omkarlenka/leetcode | kth_largest_element_in_a_stream_lc703.cpp | #include <iostream>
#include <queue>
#include <vector>
using namespace std;
class KthLargest {
priority_queue<int,vector<int>,greater<int>> pq;
int k;
public:
KthLargest(int k, vector<int>& nums) {
this->k = k;
int m = min(k,(int)nums.size());
for(int i = 0;i<m;i++){
pq... | ALGO | 0.999937 | 5.613407 |
69e13b1d-18b2-461f-96c8-14b4018b12d1 | Amebkas/comb_math | LW2/task1/tree.cpp | #include "tree.h"
#include <fstream>
#include <vector>
namespace
{
using namespace std;
using GraphVertex = int;
using Graph = vector<vector<GraphVertex>>;
Graph graph, graphTransposed;
vector<bool> used;
vector<GraphVertex> order, component;
bool OpenFile(ifstream& inputFile, string filePa... | ALGO | 0.999399 | 5.454413 |
42be9160-24c1-41c7-9018-dab9fbdbf336 | nikhil0441/DSA | Sorting Technique/QuickSort.cpp | #include<iostream>
using namespace std;
class Quick{
public:
int divide(int arr[],int low,int high){
int pivot=arr[low];//9
int i=low+1;//1
int j=high;//4
do{
while(arr[i]<pivot){
i++;
}
while(arr[j]>pivot){
j--;
}
if(i<j){
int temp=arr[i];
... | ALGO | 0.999974 | 4.819794 |
76970590-b612-463e-819b-38d437fdaf59 | doublethinkco/boost | libs/multi_index/example/serialization.cpp | #if !defined(NDEBUG)
#define BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING
#define BOOST_MULTI_INDEX_ENABLE_SAFE_MODE
#endif
#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
#include <algorithm>
#include <boost/archive/text_oarchive.hpp>
#include <boost/archive/text_iarchive.hpp>
#include <... | TOOL | 0.983188 | 6.749949 |
9e661b21-5411-45f4-9e7f-ccb5cbf5e7ec | boyima/Leetcode | lc075-2.cpp | class Solution {
public:
void sortColors(vector<int>& nums) {
int n = nums.size();
int count0 = 0;
int count1 = 0;
int count2 = 0;
for(int i = 0; i<=n-1; i++){
if(nums[i] == 0){
count0++;
}
if(nums[i] == 1){
... | ALGO | 0.999902 | 5.806548 |
467d604e-e7c2-41f9-9aa0-5256edc83c65 | SEAL-IIT-KGP/randomized_caches | sasscache/ext/systemc/src/sysc/datatypes/fx/scfx_pow10.cpp | /*****************************************************************************
scfx_pow10.cpp -
Original Author: Robert Graulich, Synopsys, Inc.
Martin Janssen, Synopsys, Inc.
*****************************************************************************/
/**********************************... | ALGO | 0.994616 | 6.051939 |
0bfb8b61-4506-4feb-8e5c-c721974f2d59 | uncle-lu/surf-the-internet | openjudge/1.5/31-temp.cpp | #include <cstdio>
int main()
{
int n,m;
scanf("%d %d",&n,&m);
for(int i=1;i<=n;++i)
{
int s = 1;
for(int j=1; j<=m ; ++j)
{
if(i % j == 0)
s=s*-1;
}
if(s==-1)
{
if(i==1)printf("1");
else printf(",%d",i);
}
}
return 0;
}
| ALGO | 0.99998 | 3.047753 |
3c75c6ba-6def-41e2-bca9-fc89a4ced2c8 | chongin12/Problem_Solving | acmicpc.net/old/17136.cpp | #include <iostream>
#define INF 123456789
#define iMAX 10
#define jMAX 10
using namespace std;
int arr[10][10];
int garo_seq[10][10];
int sero_seq[10][10];
int paper[6]={0, 5, 5, 5, 5, 5};
int result=INF;
void f(int i, int j, int one_count, int paper_count){
if(j == jMAX) {
f(i+1, 0, one_count, paper_count... | ALGO | 0.999814 | 3.590503 |
6ba1f396-4015-4874-95e3-54bbc146733f | ishandutta2007/codeforces | hitonanode/normal/1521/B.cpp | #include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cmath>
#include <deque>
#include <forward_list>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#inclu... | ALGO | 0.999658 | 4.201552 |
e0a18ba7-ead9-4f26-bed0-8982c4d113e2 | MaykonSantos00/programs.c- | capitulo04/exercicio02/ex1.cpp | #include <iostream>
using namespace std;
int main(){
int counter = 1;
do
{
cout << counter << " ";
counter++;
} while (counter <= 10);
return 0;
} | TOOL | 0.851162 | 3.816606 |
ecc9c951-79e0-43a5-a8b8-b10bcdb41239 | ankita0335/-CrackYourInternship | 0155-min-stack/0155-min-stack.cpp |
/**
* Your MinStack object will be instantiated and called as such:
* MinStack* obj = new MinStack();
* obj->push(val);
* obj->pop();
* int param_3 = obj->top();
* int param_4 = obj->getMin();
*/
class MinStack {
public:
stack<pair<int, int>>st;
MinStack()
{
}
void push(int val)
{
... | ALGO | 0.999854 | 6.402652 |
90eec6b9-a1c0-4323-a088-9642434ec220 | alexandraback/datacollection | solutions_5708284669460480_1/C++/JoaoM/b_fast.cpp | #include <bits/stdc++.h>
#define MAX_N 7300
#define X first
#define Y second
using namespace std;
typedef pair<int,int> pii;
int T, k, l, s;
char keys[MAX_N], target[MAX_N];
double ans, xp;
int mx, cr;
bool u[MAX_N][MAX_N];
double dp[MAX_N][MAX_N];
pii pre[MAX_N][MAX_N];
char suf[MAX_N];
int max_occurs(){
for(int... | ALGO | 0.997815 | 3.559206 |
d51b7e62-fe70-4755-b9a1-60107626d653 | PierceLBrooks/TES3MP | components/detournavigator/findsmoothpath.cpp | #include "findsmoothpath.hpp"
#include <components/misc/convert.hpp>
#include <algorithm>
#include <array>
namespace DetourNavigator
{
std::vector<dtPolyRef> fixupCorridor(const std::vector<dtPolyRef>& path, const std::vector<dtPolyRef>& visited)
{
std::vector<dtPolyRef>::const_reverse_iterator furth... | ALGO | 0.999762 | 6.616939 |
7bab2b7d-ff9e-4668-871e-27df70a07a5f | marcosmpmp/LISTAEXERCICIOS2024 | vet20.cpp | #include <iostream>
#include <vector>
using namespace std;
int main() {
const int SIZE = 10;
vector<int> vetor1(SIZE);
vector<int> vetorImpares;
cout << "Digite 10 numeros inteiros no intervalo [0,50]: " << endl;
for (int i = 0; i < SIZE; ++i) {
int num;
cin >> num;
while ... | ALGO | 0.998918 | 4.632181 |
d6c116ed-10c3-45df-a341-be006f2dc9c7 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_7163_5.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, a, b;
cin >> n >> a >> b;
cout << min(a, b) << (a + b < n ? 0 : a + b - n);
}
| ALGO | 0.999505 | 3.061465 |
82641e70-7976-452a-8916-69d127ffaed0 | JulioMelo-Classes/lista-1-rafasfz | negativos5/src/main.cpp | #include <iostream>
using std::cin;
using std::cout;
const int SIZE = 5; // input size.
/*
ok
*/
int main(void)
{
int numbers[5];
int negatives = 0;
for (int i=0; i<5; i++) {
cin >> numbers[i];
if (numbers[i] < 0)
negatives++;
}
cout << negatives;
return 0;
}
| ALGO | 0.999654 | 4.735092 |
5cbd31ce-6545-49b1-8628-2c96f9d7ba32 | Rajesh351/Leetcodeall | 1755-defuse-the-bomb/1755-defuse-the-bomb.cpp | class Solution {
public:
vector<int> decrypt(vector<int>& code, int k) {
int n=code.size();
vector<int> ans(n, 0);
if (k==0) return ans;
if (k>0){
int wsum=accumulate(code.begin()+1, code.begin()+k+1, 0);
ans[0]=wsum;
for(int l=1, r=k+1; l<n ; r++... | ALGO | 0.999972 | 4.69156 |
a847001b-2044-472f-92c5-cdb006c3eb00 | natetang/CPE_C-practice | recursionandmod.cpp | #include <stdio.h>
#include <stdlib.h>
long long cal(int a,long long n,long long b)
{
if(n==1)return 3;
else
{
long long result=cal(a,n/2,b);
if(n%2==1)
{
return ((result*result*3))%b;
}
else
{
return ((result*result))%b;
}
... | ALGO | 0.999966 | 3.452287 |
56da3dfc-4677-4f0d-b6f1-b3bf49d11f97 | saurabhhhpandeyyyy/Leetcode_PROBLEMS | 2323-minimum-bit-flips-to-convert-number/2323-minimum-bit-flips-to-convert-number.cpp | class Solution {
public:
int minBitFlips(int start, int goal) {
int n=start^goal;
int count=0;
while(n){
n&=n-1;
count++;
}
return count;
}
}; | ALGO | 0.999993 | 5.776898 |
ce111268-440b-4464-ab84-ee1c550fc455 | phammaidung/flutter_counter_getx | 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 |
2ec32eae-2438-40e3-b753-62f57623d306 | Josedzzz/competitive-programming | codeForces/81A.cpp | #include <algorithm>
#include <iostream>
#include <stack>
#include <string>
using namespace std;
string removePairs(string s) {
stack<char> st;
for (char c : s) {
if (!st.empty() && st.top() == c) {
st.pop();
} else {
st.push(c);
}
}
string result;
while (!st.empty()) {
result += ... | ALGO | 0.999874 | 6.228423 |
e1dd8552-0db0-43f8-959e-0fdb5d8230e9 | aruaru0/cpp-myatcoder | ABC/351/c.cpp | #include <iostream>
#include <vector>
using namespace std;
using ll = long long;
int main()
{
int n;
cin >> n;
vector<ll> ans;
for (int i = 0; i < n; i++)
{
int cur;
cin >> cur;
while (ans.size() > 0 && ans.back() == cur)
{
ans.pop_back();
cu... | ALGO | 0.999753 | 4.02933 |
6f85ab94-c04a-489d-95bc-7d28516f24d2 | alex-nguyennn/Leetcode_Solutions | 66.plus-one.cpp | /*
* @lc app=leetcode id=66 lang=cpp
*
* [66] Plus One
*/
// @lc code=start
class Solution {
public:
vector<int> plusOne(vector<int>& digits) {
int n=digits.size();
for(int i=n-1;i>=0;--i)
{
if (digits[i]==9)
{
digits[i]=0;
}
... | ALGO | 0.999876 | 7.145664 |
86b6116a-be37-4bab-950c-00a6aeabe351 | ShivamKureel1122/365-days-coding-challenge | day73-Serialize.cpp | // Problem - https://www.interviewbit.com/problems/serialize/
-------------------------------------------------------
string Solution::serialize(vector<string> &A) {
string res = "";
for(string s : A) {
res += s + to_string(s.size()) + '~';
}
return res;
}
| ALGO | 0.983156 | 5.468851 |
294b91f0-f3ec-4240-8f3e-82fe89ad93d5 | sourcegraph/lsif-clang | llvm/lib/Analysis/PostDominators.cpp | #include "llvm/Analysis/PostDominators.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/PassManager.h"
#include "llvm/InitializePasses.h"
#include "llvm/Pass.h"
#include "llvm/Support/raw_ostream.h"
using namespace llvm;
#define DEBUG_TYPE "postdomtree"
#ifdef EXPENSIVE_CHECKS
sta... | TOOL | 0.987302 | 7.651863 |
e2fc54b8-6056-45e3-bf94-445ec5982c3f | MuhammadSaad000/DSA | Stack/ReverseWordsOfString.cpp | #include<iostream>
#include<stack>
using namespace std;
//File Completed on : November 15,2022.
//Problem solved : https://www.geeksforgeeks.org/reverse-the-sentence-using-stack/
string ReverseWords(string& s);
int main()
{
string s = "I love to code";
s = ReverseWords(s);
cout << s << endl;
return 0;
}
string ... | ALGO | 0.999941 | 4.729559 |
73e37001-3a15-452a-9d70-b95978ae4c24 | Anton20241/pipe_inspect_ws | src/go_to_goal_tut/src/go_to_goal_tut.cpp | #include <cstdlib> // Use for the absolute value method abs()
#include <iostream> // Enables command line input and output
#include "ros/ros.h" // Necessary header files for ROS
#include "geometry_msgs/Twist.h" // Twist messages (linear & angular velocity)
#include "geometry_msgs/Pose2D.h" // x, y position and theta ... | TOOL | 0.913837 | 5.968456 |
32e12bf6-9ca1-4a0e-a940-f8dc15f3c941 | Haeun-Y/gyeo-bang-al | 윤하은/[13] 시뮬레이션/14890.cpp | //240211
//BOJ 14890 경사로
//GOLD 3
#include <iostream>
#include <vector>
using namespace std;
int n, l;
vector<vector<int>> land;
bool isPassableRoadRow(int row)
{
int beforeHeight = land[row][0];
int beforeNum = 1;
for(int i = 1; i<n; i++)
{
int curHeight = land[row][i];
int difference =... | ALGO | 0.999922 | 3.997836 |
73b610d2-bc30-4d11-be80-548bce79dfd0 | ZhadaevAlex/Marathon | Alex03/main.cpp | #include <iostream>
using namespace std;
int main()
{
cout << "Александр Morgan" << endl;
long beginTime = clock();
uint8_t n = 0;
cin >> (int&)n;
uint8_t h[n];
uint8_t identical = n/5;
//Сортировка массива при вводе
uint8_t min = 0;
uint8_t max = 0;
for (uint8_t i = 0; i < n... | ALGO | 0.999949 | 3.647382 |
ed7fc5b9-e9bf-42a1-92b9-74bd0d776760 | ningnawang/Computer_Graphics | 2. A Mini Mesh editor /src/texture.cpp | #include "texture.h"
#include <assert.h>
#include <iostream>
#include <algorithm>
using namespace std;
namespace CMU462 {
inline void uint8_to_float( float dst[4], unsigned char* src ) {
uint8_t* src_uint8 = (uint8_t *)src;
dst[0] = src_uint8[0] / 255.f;
dst[1] = src_uint8[1] / 255.f;
dst[2] = src_uint8[2] ... | ALGO | 0.932487 | 5.798117 |
e9b71c72-0722-4a68-a750-a90c786ac5d9 | sinian666/code_86_7 | cpp_副本9/chapter_array_and_linkedlist/linked_list.cpp | /**
* File: linked_list.cpp
* Created Time: 2022-11-25
* Author: Krahets (<EMAIL>)
*/
#include "../utils/common.hpp"
/* 在链表的节点 n0 之后插入节点 P */
void insert(ListNode *n0, ListNode *P) {
ListNode *n1 = n0->next;
P->next = n1;
n0->next = P;
}
/* 删除链表的节点 n0 之后的首个节点 */
void remove(ListNode *n0) {
if (n0... | ALGO | 0.999766 | 5.584367 |
7a20ca11-ca0d-41e3-9a8b-0805c09ffd02 | MkAngelo/CompetitiveProgramming | Codeforces/750a.cpp | #include <bits/stdc++.h>
using namespace std;
void run_case(){
int p, t, total = 240, ts;
cin >> p >> t;
total -= t;
int ans = 0;
for(int i=1; i<= p; i++){
if(i * 5 <= total){
total -= (i * 5);
ans++;
} else {
break;
}
}
cout << ans << endl;
}
int main(){
ios_base::sync_with_stdio(0); c... | ALGO | 0.998904 | 3.865912 |
d825ce41-6f13-4394-8ec7-f6e02c770c08 | harshit-singhh/DSA-QUESTIONS | 2891-maximum-beauty-of-an-array-after-applying-operation/2891-maximum-beauty-of-an-array-after-applying-operation.cpp | class Solution {
public:
int maximumBeauty(vector<int>& arr, int k) {
int left = 0, right = 0, ans = 0;
sort(arr.begin(),arr.end());
while(right < arr.size()){
if(arr[right] - arr[left] > 2*k) left++;
else{
ans = max(ans,right - left + 1);
... | ALGO | 0.99995 | 5.749316 |
e732158b-0284-47e5-a503-c95427fb4740 | mbruening18/CS172-HW-3 | HW #03/HW #03/MyIntegerClass.cpp | //EX03_05 – Liang Programming Exercise 10.10: the MyInteger class
//creates a data feild that stores an int value sets equal to val
MyInteger:: MyInteger (int val)
{
value = val;
}
// constant function that return value
int MyInteger:: getValue() const
{
return value;
}
//unctions that return true if va... | TOOL | 0.912016 | 3.875845 |
33484331-0838-4f3d-acf7-ca242d610303 | asthemus/programs | codeforces/1365/C1365.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long int
#define istream ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define uint unsigned int
#define mod 1000000007
#define vec vector<int>
#define twod vector<vector<int>>
#define all(a) a.begin(),a.end()
#define debug1(x) cout<<#x... | ALGO | 0.999961 | 3.670666 |
2e1e05a8-db29-4a62-8c00-68dfacce22ba | XiaoWendell/ProjectAssets | books/github_learning_materials/C语言数据结构/求m,n之间素数和.cpp | #include<stdio.h>
int isprime(int n)
{
int i=2;
for(i;i<n;i++)
{
if(n%i==0)
break;
}
if(i==n)
return 1;
else
return 0;
}
int main()
{
int m,n,count=0;
int sum=0;
scanf("%d %d",&m,&n);
for(int i=m ;i<=n;i++)
{
if(isprime(i)==1)
... | ALGO | 0.999976 | 3.969226 |
122afd51-4cb2-4aac-9d68-6d9a29202e83 | PranjalGaur-PG/Repo-for-HacktoberFest | LongestSupersequence.cpp | #include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define IOS ios_base::sync_with_stdio(0); cin.tie(0);
using namespace std;
#define rep(i,a,b) for(i=a;i<b;i++)
typedef long long ll;
typedef unsigned long long ull;
#define test(t) int t; cin>>t; while(t--)
int fun(string a,string b) {
int n=a.length... | ALGO | 0.999975 | 4.419724 |
aea9e5fd-2371-4bbb-8953-cc7b08b3fbb7 | justt1n/codeforce | A Team/run.cpp | #include <bits/stdc++.h>
using namespace std;
void solve()
{
int n, A[1000][3];
cin >> n;
for (int i = 0; i < n; i++)
for (int j = 0; j < 3; j++)
cin >> A[i][j];
int ans = 0;
for (int i = 0; i < n; i++)
{
int sum = 0;
for (int j = 0; j < 3; j++)
... | ALGO | 0.999518 | 4.524121 |
237ed699-1272-4d32-a7af-0add858fb35d | tobiasveiga/competitive-programming | PPATH.cpp | /**
PPATH - Prime Path
https://www.spoj.com/problems/PPATH/
Solution:
- Precompute primes from 1000 to 9999 using Sieve of Eratosthenes
- Use BFS to get minimum cost
- Speed up BFS by precomputing all prime numbers groups with 3 digits in
common, i.e. 1033 belong to the groups *033, 1*33, 10*3 and 103*
ACCEPTED
**/
#... | ALGO | 0.999609 | 4.616974 |
7882eef7-3438-461a-8a21-603a70c7d809 | raincross7/code-similarity | codes/train_code/problem049/problem049_285.cpp | #include <iostream>
#include <stdio.h>
#include <vector>
#include <queue>
using namespace std;
static const int MAX = 100000;
static const int WHITE = 0;
static const int GRAY = 1;
vector<int> adjList[MAX];
vector<int> out;
int colors[MAX];
int indeg[MAX];
//int openTable
void bfs(int vertexInd, int numVertex){
... | ALGO | 0.999989 | 4.680107 |
c9df5849-8d21-4e65-b349-f6c312806548 | ishandutta2007/codeforces | fuppy/normal/958/F1.cpp |
//#include "stdafx.h";
#include "bits/stdc++.h"
using namespace std;
#define DEBUG(x) cout<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cout<<#v<<":";for(int i=0;i<v.size();i++) cout<<" "<<v[i]; cout<<endl
typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll ... | ALGO | 0.999987 | 3.470255 |
a9a52a53-1bd2-4de2-aa06-748de2fee0dd | Aashish-Shakya/Complete_CPP_Course | B. Part B - Basics of C++/6. Loops/Solutions/8_sumofDivisible3.cpp | #include <iostream>
using namespace std;
/*
8. Sum of all numbers from **1 to n** divisible by 3
*/
int main()
{
int n = 100;
int sum = 0;
for (int i = 1; i < n; i++)
{
if (i % 3 == 0)
{
sum += i;
}
cout << " sum " << sum << endl;
}
} | ALGO | 0.997462 | 3.47918 |
9e65a68f-c928-415a-bc48-7ee53b710c45 | jofiguero/Implementacion-Ciaccia-Patella | TareaMtree/aux_clases_cp.cpp | #ifndef CLASES_CPP
#define CLASES_CPP
#include <stdlib.h>
#include <set>
#include <vector>
using namespace std;
#include "aux_fun.cpp"
class Conjunto_sample{
public:
Point sample;
vector<Point> conjunto;
Conjunto_sample(Point s) : sample(s) {}
void agregarPunto(Point nuevoPunto) {
conjunt... | ALGO | 0.951693 | 3.655808 |
8234c6a7-ba92-429a-8166-06f0f67f0c4e | Arpit9838/cipherschools_lpu | Lecture-14(ll)-cipherschool.cpp | #include <iostream>
using namespace std;
void minandmax(int *a, int *min, int *max)
{
// Whatever we change to *min, *max inside the funciton will get affected even outside the function
// *min=1;
// *max=5;
int i;
// int small=10000000 , large=-99999;
int small=a[0] , large=a[0];
... | ALGO | 0.99342 | 3.143533 |
b7ac49ed-6464-4a17-8bc5-b8e7e109891e | ashoknaidu001/15practicalprograms | 13tharthemetic.cpp | #include<iostream>
using namespace std;
int main()
{
int x,a,b,c;
cout<<"enter the value of a:";
cin>>a;
cout<<"enter the value of b:";
cin>>b;
cout<<"enter the choise:";
cin>>x;
switch(x)
{
case 1:
c=a+b;
cout<<"addition="<<c;
break;
case 2:
c=a-b;
cout<<"subtration="<<c;
break;
case 3... | ALGO | 0.967288 | 3.00288 |
a5b76136-baf7-4bec-81cb-54e1f8c9c2de | Drone-Banks/ACM | CodeForces/#/#369 Div.2/A.cpp | /*************************************************************************
> File Name: test.cpp
> Author: Akira
> Mail: <EMAIL>
************************************************************************/
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <cstdlib>
#includ... | ALGO | 0.999559 | 3.299532 |
49ee04a7-63ab-4160-bbf9-64a07ac8f234 | SsachinnCS/Compettitive-Programming | Lecture.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(false); cin.tie(0);
int n,m;
cin>>n>>m;
map<string,string>words;
for(int i = 0; i < m; i++){
string s1,s2;
cin>>s1>>s2;
if(s1.size()>s2.size())words[s1]=s2;
else words[s1]=s1;
}
... | ALGO | 0.999933 | 4.36028 |
672ea89b-ce56-4b16-80a5-414122c3be57 | wellvolks/Problemas | Uri/uri2186.cpp | #include <bits/stdc++.h>
using namespace std;
#define MAXD 5500000
typedef long long int64;
typedef unsigned long long uint64;
struct node{
int c, y, val, swap;
int sum[28];
node *l, *r;
node(){}
node( int v ){
val=v;
memset(sum, 0, sizeof(sum));
sum[v] = 1;
y=ran... | ALGO | 0.999897 | 3.824518 |
64d8fc32-58f4-4415-b398-ae51f6ee688f | SanskritiKushik5/Problem-Solving | Hashing/sum-zero.cpp | #include<iostream>
using namespace std;
#include<vector>
#include<map>
#include<unordered_map>
#define rep(i, a, b) for(int i=a; i<b; i++)
int main()
{
int n;
cin >> n;
vector<int> a(n);
rep(i, 0, n)
cin >> a[i];
map<int, int> cnt;
int prefSum = 0;
rep(i, 0, n)
{
prefSum ... | ALGO | 0.999972 | 3.834374 |
335bdfd0-f65d-4146-bcdb-7504b03c8bfd | TheTrustyPwo/CP | CodeBreaker/grassplanting.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector < int > vi;
typedef pair < int, int > pi;
typedef pair < int, pi > pii;
typedef set < int > si;
typedef vector < pi > vpi;
typedef double dl;
#define mp make_pair
#define pb push_back
#define f first
#define s second
ll MOD = 1e9 + 7;
#d... | ALGO | 0.999762 | 3.897974 |
17adacc9-e9d8-46c4-a816-9a38282f0a4f | ishandutta2007/codeforces | wild_hamster/normal/1148/D.cpp | #include <string>
#include <time.h>
#include <vector>
#include <algorithm>
#include <bitset>
#include <utility>
#include <map>
#include <set>
#include <sstream>
#include <iostream>
#include <cmath>
#include <deque>
#define pii pair<ll,ll>
#define MOD 998244353
#define mp make_pair
#define X first
#define Y second
type... | ALGO | 0.999991 | 3.848058 |
72cee8b5-5e18-46f4-8cca-3c946451db2c | nativemen/leetcode | 450. Delete Node in a BST/main.cpp |
using namespace std;
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... | ALGO | 0.999988 | 6.59528 |
d5b37ea3-e7eb-42d3-9106-49bec1822d93 | ishandutta2007/codeforces | krijgertje/normal/1245/B.cpp | #include <algorithm>
#include <iostream>
#include <sstream>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <list>
#include <cassert>
#include <ctime>
#include... | ALGO | 0.999971 | 3.470396 |
3a25f467-0352-47aa-82c8-12848c5df0ad | Shao-ZW/Stanford-CS149 | asst1/prog2_vecintrin/main.cpp | #include <stdio.h>
#include <algorithm>
#include <getopt.h>
#include <math.h>
#include "CS149intrin.h"
#include "logger.h"
using namespace std;
#define EXP_MAX 10
Logger CS149Logger;
void usage(const char* progname);
void initValue(float* values, int* exponents, float* output, float* gold, unsigned int N);
void absS... | ALGO | 0.994854 | 6.040373 |
32abdd60-549b-45eb-ac11-6c420b0d5353 | alokpandeygzp/GFG-Leetcode | Counting Sort - GFG/counting-sort.cpp | //{ Driver Code Starts
//Initial Template for C++
#include <bits/stdc++.h>
using namespace std;
#define RANGE 255
// } Driver Code Ends
//User function Template for C++
class Solution{
public:
//Function to arrange all letters of a string in lexicographical
//order using Counting Sort.
string countS... | ALGO | 0.999959 | 6.035307 |
e7c66e0b-e91c-4045-a54f-a81861523454 | 113bommy/LogicalErrorFixCodeT5 | logicalErrorFix_CodeT5_Linenumber/model/cpp/CodeT5_LineNumber_cpp_source/Problem_41_source_229.cpp | #include <bits/stdc++.h>
using namespace std;
int n, k, tt[100005][14], i, ans, j, gg;
void cons(int l, int r, int x, int dep) {
if (l == r) {
return;
}
int tmp = (r - l + 1) / k, cc = 0;
for (int i = l; i <= r; i += tmp) {
++cc;
if (x < i + tmp) {
tt[x][dep] = cc;
cons(i, i + tmp - 1, x, dep + 1);
return;
}
}
}
int ma... | ALGO | 0.999885 | 3.089906 |
6d35141b-6e2d-4e28-beb1-ea01360de8a2 | DraSoGo/Competitive_Programming | C2/2563/0005_C2_63_8_FinalMission.cpp | #include <bits/stdc++.h>
using namespace std;
const int x = 1e6+10;
int A[x],DP[x];
int main()
{
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int n,mx = 0;
cin >> n;
memset(DP,0,sizeof(DP));
for (int i = 1; i <= n; i++)
{
cin >> A[i];
}
DP[1] = A[1];
DP[2] = A[2];
... | ALGO | 0.999918 | 3.836699 |
81151cdf-5c82-4558-bf35-04e4572dda77 | theprelior/SixenvironmentsBrickBreaker | brickgamecodes/brickming.cpp | #include <stdio.h>
#include <stdlib.h>
#include <graphics.h>
#include <string>
#include <sstream>
#include <conio.h>
#include <iostream>
using namespace std;
#define ENTER 10
#define ESC 27
#define RACKETLEFT1 'A' //TOP MOVE
#define RACKETLEFT2 'a'
#define RACKETRIGHT1 ... | TOOL | 0.97522 | 3.627814 |
da100c9d-62be-4b02-9ce7-5ccbf8435caf | youraj145/DSA-Bootcamp- | DAY- 7 KRUSKA'S ALGORITHM.cpp | #include <stdio.h>
#include <stdlib.h>
#define MAX 100
#define INF 9999
// Structure to represent an edge
struct Edge {
int u, v, weight;
};
// Structure to represent a graph
struct Graph {
int V, E;
struct Edge edge[MAX];
};
// Create a new graph
struct Graph* createGraph(int V, int E) {
struct Gra... | ALGO | 0.999992 | 5.895655 |
f3a2adbc-9d65-4297-957a-2df9f71c6f62 | nayanGowdaM/LeetCodeSolns | 52-n-queens-ii/n-queens-ii.cpp | class Solution {
int ans;
bool check( vector<string>& res, int row, int col){
//row check
for( int i=0;i<row;i++) if( res[i][col]=='Q') return false;
//column check
// for( int i=0;i<res.size();i++) if( res[row][i]=='Q' && i!=col) return false;
int x = row-1, y = col-1... | ALGO | 0.999907 | 5.509305 |
15fe7891-5179-42ad-8f32-a08cb995d655 | deepakjoshi0909/Day-41 | Maximum Number of Visible Points.cpp | #include <vector>
#include <cmath>
#include <algorithm>
class Solution {
public:
int visiblePoints(std::vector<std::vector<int>>& points, int angle, std::vector<int>& location) {
std::vector<double> angles;
int sameLocationCount = 0;
for (const auto& point : points) {
i... | ALGO | 0.999961 | 6.349802 |
eeb58b47-174a-4e51-b638-201b9f7610f8 | pahuldeep/CxxPractice | STLbasics/lambda/lambdaMax.cpp | #include <iostream>
using namespace std;
int main(){
int x, y;
cout << "First Integer: "; cin >> x;
cout << "Second Integer: "; cin >> y;
auto max = [](auto x, auto y) -> auto { return x > y ? x: y; };
auto largerNumber = max(x, y);
cout << "The larger number is: " << largerNumber ;
... | ALGO | 0.998434 | 3.850016 |
2bbb42f9-2663-4c1a-ab5e-23f3bba89198 | ibnushevayanto/learn-cpp | kuliah-algoritma-dan-pemrograman/Pointer/lat10_7.cpp | #include<iostream>
using namespace std;
void duplicate(int&a, int&b, int&c)
{
a*=2;
b*=2;
c*=2;
}
int main()
{
int x=1, y=3, z=7;
duplicate( x, y, z);
cout<<"x=" << x << ", y="<<y<<", z=" << z;
return 0;
}
| ALGO | 0.990522 | 3.241109 |
fa96ca1c-3aef-4acf-b6ff-2e80f5ccd15f | BlauHimmel/Hikari | ext/tbb/examples/parallel_reduce/convex_hull/convex_hull_sample.cpp | /*
This file contains the TBB-based implementation of convex hull algortihm.
It corresponds to the following settings in convex_hull_bench.cpp:
- USETBB defined to 1
- USECONCVEC defined to 1
- INIT_ONCE defined to 0
- only buffered version is used
*/
#include "convex_hull.h"
#include "tbb/task... | ALGO | 0.999526 | 6.846014 |
6b169664-2ca7-4492-a7df-d95ab4d3b1b4 | Henrik-Yao/NEUQ-ACM-Solution | week3/崔梓晖/双周赛/7.cpp | #include <bits/stdc++.h>
using namespace std;
long long n,a[1000001],r[1000001],ans=0;
void hebin(int s,int mid,int e)
{
int p=s;
int q=mid+1;
for(int i=s;i<=e;i++)
{
if((q>e)||(a[p]<=a[q]&&p<=mid))
{
r[i]=a[p];
p++;
}
else
{
r[i]=a[q];
q++;
ans=ans+mid-p+1;
}
}
for(int i=s;i<=e;i++)
{... | ALGO | 0.999964 | 4.790784 |
61143436-dfe4-46c2-9e38-8e1570873009 | TCGBench/TCGBench | data/partially_correct_code/partially_correct_code_noip/P2196/60-80_4.cpp | #include<bits/stdc++.h>
using namespace std;
bool v[205][205];
int a[205][10];
void print(int x){
if(a[x][2]==0)cout<<x;
else{
print(a[x][2]);
cout<<" "<<x;
}
}
int main(){
int n,x,y,num;
cin>>n;
for(int i=1;i<=n;i++){
cin>>a[i][0];
a[i][1]=a[i][0];
a[i][2]=0;
}
for(int i=1;i<=n-1;i++){
for(int j=i... | ALGO | 0.99994 | 3.641952 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.