uuid stringlengths 36 36 | repo_name stringlengths 5 123 | relative_path stringlengths 5 4k | content stringlengths 33 2.85M | category stringclasses 6
values | algo_rel_score float64 0.85 1 | quality_score float64 3 8.76 |
|---|---|---|---|---|---|---|
ae3126f1-4c99-467f-8479-1e3f7b81ab4a | ODUWAX/oduwacoin | src/chain.cpp | #include "chain.h"
using namespace std;
/**
* CChain implementation
*/
void CChain::SetTip(CBlockIndex *pindex) {
if (pindex == NULL) {
vChain.clear();
return;
}
vChain.resize(pindex->nHeight + 1);
while (pindex && vChain[pindex->nHeight] != pindex) {
vChain[pindex->nHeight] ... | ALGO | 0.999562 | 6.185319 |
28e78602-41b9-465f-ba89-3e71267b71fa | RioRighten/Cpp-coding-questions | Ans15.cpp | #include <iostream>
#include <vector>
#include <algorithm> // For std::sort
#include <string>
using namespace std;
// Class to represent a Student
class Student {
private:
string name;
int id;
float grade;
public:
Student(const string& n, int i, float g) : name(n), id(i), grade(g) {}
float getGr... | TOOL | 0.998103 | 6.898092 |
8b6bbb74-a85a-4fa5-9bab-dd3f21d47b12 | kmjp/procon | srm/661-680/680/BearFair.cpp | #include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;
#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<to;x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ZERO(a) memset(a,0,sizeof(a))
#define MINU... | ALGO | 0.999638 | 4.68957 |
1f5b29f5-1b2d-4467-9b08-ad905debd444 | himanshu11399/DSA | 443-string-compression/string-compression.cpp | class Solution {
public:
int compress(vector<char>& chars) {
int idx=0;
for(int i=0;i<chars.size();i++){
char ch=chars[i];
int count=0;
while(i<chars.size() && chars[i]==ch){
count++;
i++;
}
if(count==1){
... | ALGO | 0.999995 | 6.395917 |
ae99e8d0-4432-4d7c-8c3b-c70e92b29d35 | Trietptm-on-Coding-Algorithms/Leetcode-1 | cpp/324.cpp | class Solution {
public:
void wiggleSort(vector<int>& nums) {
vector<int> copy(nums);
sort(copy.begin(), copy.end());
for (int i = nums.size() - 1, j = 0, k = i / 2 + 1;
i >= 0;
--i){
nums[i] = copy[i & 1 ? k++ : j++];
}
return ;
}
};... | ALGO | 0.999996 | 5.239949 |
bf90a8c1-dba2-4c9f-a1b1-35966abe8f13 | ishandutta2007/codeforces | roki/normal/255/A.cpp | #pragma comment(linker, "/STACK:167177216")
#include<stdio.h>
#include<stack>
#include<math.h>
#include<iostream>
#include<algorithm>
#include<string.h>
#include<string>
#include<set>
#include<memory.h>
#include<vector>
#include<map>
#include<queue>
using namespace std;
typedef long long li;
#define forn(i, n) for ... | ALGO | 0.999573 | 3.860463 |
967dc8fe-9410-4742-93a1-9ff39086a1cf | plasmatic1/dmoj-solutions | cpp/ecoo19r3p1.cpp | #pragma region
#include <bits/stdc++.h>
using namespace std;
// Common Type shorteners and int128
using ll = long long; using ull = unsigned long long; using ld = long double;
using pii = pair<int, int>; using pll = pair<ll, ll>;
template <typename T> using vec = vector<T>;
template <typename K, typename V> using umap ... | ALGO | 0.998311 | 4.280785 |
b0998680-ecb4-4549-b4f4-03ada856236e | swarnalii/LeetCode | intersection-of-two-arrays-ii/intersection-of-two-arrays-ii.cpp | class Solution {
public:
vector<int> intersect(vector<int>& nums1, vector<int>& nums2) {
int n1 = nums1.size(), n2 = nums2.size();
unordered_map <int, int> cnt;
for(int i = 0; i < n1; i++){
cnt[nums1[i]]++;
}
vector<int> ans;
for(int i = 0; i < n2... | ALGO | 0.999982 | 5.577977 |
2be76dab-c9e4-4c8d-9664-b1d3ab006a67 | Akhileshmalik23/DSA | 1818-maximum-score-from-removing-substrings/maximum-score-from-removing-substrings.cpp | class Solution {
public:
int maximumGain(string s, int x, int y) {
if (x >= y)
return find(s, 'a', 'b', x, y);
else
return find(s, 'b', 'a', y, x);
}
int find(string s, char first, char sec, int high, int low) {
string intermediate = "";
stack<char> s... | ALGO | 0.999949 | 5.744808 |
efcb524b-d27e-4d6a-b4d3-fdbcf1b7af80 | Evanstar/bitflip | gem5/src/systemc/tests/systemc/misc/user_guide/chpt10.1/paramadd.cpp | /*****************************************************************************
paramadd.cpp --
Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
*****************************************************************************/
/***************************************************************************... | ALGO | 0.985093 | 5.820003 |
4e0bfb91-aac7-45a6-bc19-c5fe8700a21e | maruf-ahammed-75/problem-solve-for-cp | LightOj/A-Childhoo-Game.cpp | // A Childhood Game
#include<bits/stdc++.h>
#define ll long long
using namespace std;
void IAmHere(){
ll n;
string s;
cin>>n>>s;
if(s=="Alice"){
if(n%3==1){
cout<<"Bob";
}
else{
cout<<"Alice";
}
}
else{
if(n%3){
cout<<"... | ALGO | 0.999806 | 3.668242 |
b2e28747-0344-422b-a4fa-7e248a695fb7 | violet-mj/problem-solving | baekjoon/problem/17219.cpp | #include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
#include <algorithm>
#include <utility>
using namespace std;
#ifndef ONLINE_JUDGE
#include "/Users/mj/.vim/template/debug.cpp"
#else
#define debug(x...)
#endif
typedef long long lint;
typedef long double ld;... | ALGO | 0.999967 | 4.371478 |
367fb9f1-8172-4671-98b7-65b8d71b46c8 | dnggngn825/TheAutonomousRobot | asclinic-system/catkin_ws/src/asclinic_pkg/src/nodes/main/_not_use/pose_estimator_odom.cpp | /* ==================================================
AUTHORSHIP STATEMENT
The University of Melbourne
School of Engineering
ELEN90090: Autonomous Clinic Systems
Author: Quang Trung Le (987445)
================================================== */
/* ==================================================
FUNCTIONALITY: Es... | ALGO | 0.998149 | 5.341917 |
3ead518e-6217-40d3-b69d-2995c55e1cf2 | aminul9/Codeforces | 954/B.cpp | /*----------------
| |
| MD.AMinul islam|
| DUET,CSE_15 |
| |
-------------------
*/
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
//freopen("in.txt","r",stdin);
int n;
string ss;
cin>>n>>ss;
ss="#"+ss;
ss=ss+"#";
int limit=n/2,ans=0;
for(int i=1;i<=limit;i++)
{
int ... | ALGO | 0.999748 | 3.317773 |
c05242f7-27f9-4db6-8ab0-517b478ade10 | gaoguangxiao/C__Learn | C++提高编程/一、模板/001-C++函数模板语法/001-C++函数模板语法/main.cpp | //
// main.cpp
// 001-C++函数模板语法
//
// Created by gaoguangxiao on 2023/3/16.
//
#include <iostream>
using namespace std;
void swapInt(int &a,int &b){
int temp = a;
a = b;
b = temp;
}
template <typename T>
void swapT(T &a,T &b) {
T temp = a;
a = b;
b = temp;
}
int main(int argc, const char ... | TOOL | 0.967424 | 4.439831 |
69350937-34fb-4e17-846a-dee82d7539a7 | Kavaldrin/Graphs | set 4/vertex.cpp | #include "vertex.h"
void Vertex::generatePaths(int numV)
{
std::vector<int> temp_v;
int prev;
for(int i=0;i<numV;++i){
m_shortestPaths.push_back(temp_v);
prev = m_prevNeigh[i];
while(prev != -1){
m_shortestPaths[i].push_back(prev);
prev = m_prevNeigh[prev];... | ALGO | 0.998137 | 3.939668 |
b47a3f86-26c3-4282-a944-85b8ea65e352 | kalyan997/Leetcode | 2.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.999965 | 6.293845 |
988a61cf-f2a6-47d4-89be-7a54d86e1fb4 | ishandutta2007/codeforces | crying/normal/1644/E.cpp | #include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define op(x) ((x&1)?x+1:x-1)
#define odd(x) (x&1)
#define even(x) (!odd(x))
#define lc(x) (x<<1)
#define rc(x) (lc(x)|1)
#define lowbit(x) (x&-x)
#define Max(a,b) (a>b?a:b)
#define Min(a,b) (a<b?a:b)
#defi... | ALGO | 0.998527 | 3.782128 |
2ee7511e-d789-4281-a0cd-20fb3046979d | GitHub-Sanjit/allProgramsPhitron | PhitronAllPrograms-main/DSA/DATA STRUCTURE/MAIN CONCEPTS SERIAL/Binary Tree/Perfect_Binary_Tree.cpp | #include<bits/stdc++.h>
using namespace std;
// Create an binary treee
// Create Binary Tree class
class Node{
public:
int val;
Node *left;
Node *right;
// consturctor
Node (int val){
this->val = val;
this->left = NULL;
this->right = NULL;
}
};
Node* LevelOrderI... | ALGO | 0.999967 | 4.542458 |
23e529b6-c8a9-4d7f-b120-a5cc39442683 | vkjw1420/Humanoid | houghLine2.cpp | #include <opencv2/core/core.hpp>
#include <raspicam/raspicam_cv.h>
#include <opencv2/imgproc.hpp>
#include <iostream>
#include <cstdio>
using namespace cv;
using namespace std;
int main()
{
Mat srcImage = imread("image.jpg", IMREAD_COLOR);
if (srcImage.empty())
return -1;
Mat edges;
Canny(srcImage, edges, 50, 10... | ALGO | 0.948839 | 3.996312 |
0eb48dc7-4e25-4d48-9291-e6ad790821f7 | aryans23/Array | areConsequetive.cpp | #include <iostream>
using namespace std;
void init(int *arr, int n) {
while(n--) {
cin >> *arr;
arr++;
}
}
void printArr(int *arr, int n) {
for(int i = 0; i < n; i++) {
cout << arr[i] << " ";
}
cout << endl;
}
int getSum(int *arr, int n) {
int sum = 0;
for(int i = 0; i < n; i++) {
sum += arr[i];
}
... | ALGO | 0.998587 | 4.606806 |
a7bb3fe2-bed1-4f1e-9f30-bb2500c62d33 | tuhinakhanam/leetcode_solution | Reverse_an_Array.cpp | #include <iostream>
#include <vector>
using namespace std;
void reverseArray(vector<int> &arr)
{
int left = 0, right = arr.size() - 1;
while (left < right)
{
swap(arr[left], arr[right]);
left++;
right--;
}
}
int main()
{
int n;
cin >> n;
if (n <= 0)
{ // Hand... | ALGO | 0.99967 | 5.592756 |
d0ceb78d-2047-47ae-a386-bcad51a64f9a | maatheusfp/Algorithms-Data-Structure | Sorting/exercises/exercise1/hacker.cpp | #include <iostream>
#include <stdlib.h>
using namespace std;
void merge(int array[], int l, int m, int r){
int i, j, k;
int leftLength = m - l + 1;
int rightLength = r - m;
int tempLeft[leftLength];
int tempRight[rightLength];
for (int i = 0; i < leftLength; i++)
tempLeft[i] = array[... | ALGO | 0.999969 | 4.223904 |
9bbe1698-9c7f-42ac-b452-2e5e1a4f3913 | tronghao/HKI | Ngon ngu lap trinh/C/bai tap thuc hanh/Buoi 3/3_1.cpp | #include <stdio.h>
#include <conio.h>
int BSCNN(int a, int b);
int main()
{
int a,b;
do{
printf("nhap vao so nguyen thu nhat: ");
scanf("%d", &a);
} while (a<=0);
do{
printf("nhap vao so nguyen thu hai: ");
scanf("%d", &b);
} while (a<=0);
printf("BSCNN cua %d va %d la %d", a, b, BSCNN(a,b));
getch();
ret... | ALGO | 0.999344 | 3.026952 |
b7690daf-db84-427b-a323-85c9751da34f | Singhaditya3116/Data-Structures-and-Algorithms | 6.advanced graph/domino TLE (Adjacnency matrix).cpp | #include<bits/stdc++.h>
using namespace std;
void dfs(int **graph,int n,int start, bool *visited,stack <int> &s)
{
visited[start]=true;
for(int i=0;i<n;i++)
{
if(graph[start][i]==1 && !visited[i])
{
dfs(graph,n,i,visited,s);
}
}
s.push(start);
}
void dfs2(int **... | ALGO | 0.999823 | 4.557436 |
e33a74a4-a68f-4cf4-bb5e-7db4bf7b4507 | JoelGanesh/CompPsi | PsiFFT.cpp | #include "CompPsi.h"
#include "Fourier.h"
#include "Utility.h"
#include "Elementary.h"
namespace CompPsi
{
float_dec_T PsiFFT::Psi0(int64_t N)
{
Elementary::SegmentationArray<float_dec_T> segmentationArray(N);
const int32_t S = int32_t(N * (pow(8, segmentationArray.getDelta()) - 1));
return SegmentationFFT(N, ... | ALGO | 0.99913 | 4.769382 |
0c34fb78-9ba6-48c3-9af5-68a13b9e9c16 | muhammadhasan01/cp | Online Judge/Codeforces/Contests/DIV2/DIV2-488/C.cpp | #include<bits/stdc++.h>
using namespace std;
double a[15], b[15];
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
double cx1 = 0, cy1 = 0, lx = 105, rx = -105, ly = 105, ry = -105;
for (int i = 1; i <= 8; i++) {
cin >> a[i];
if (i & 1) {
a[9] += a[i... | ALGO | 0.999958 | 3.131061 |
3dca375a-5013-45db-a072-ad7f36395831 | k3dr1/project-euler | P22/main.cpp | #include <algorithm>
#include <vector>
#include <iostream>
#include <fstream>
#include <string>
// Comparator for names
bool alphabet_cmp(std::string& a, std::string& b) {
int i = 0;
int j = 0;
while ((i < a.size()) && (j < b.size())) {
if (a[i] == b[j]) {i++; j++;}
if (a[i] > b[j]) return false;
if (a[i] < ... | ALGO | 0.995867 | 4.753618 |
6e616b12-c88c-45b6-84fb-594652426b8a | IsaacMPereira/cppPersonal | codigosTEP/1_strings/contSubStringDistintas.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll p = 31, q = 1'000'000'007;
//Assinaturas
int unique_substrings(const string& s);
vector<ll> prefixes(const string& s);
int h(const string& s);
vector<ll> inverses(ll N);
ll fast_exp_mod(ll a, ll n);
int f(char c);
int h(int i, int j, con... | ALGO | 0.999748 | 5.597972 |
8e5816c4-b61f-446b-8d9b-10f484a0a3c4 | lk-2009/cpp-h1 | 21-v.frecventa/nerd_arena-minnr.cpp | #include <iostream>
using namespace std;
int n, f[11],nr;
int main(){
cin>>n;
while(n>0){
f[n%10]++;
n/=10;
}
for (int i = 1; i <= 9; i++)
{
if(f[i]>0){
nr=i;
f[i]--;
break;
}
}
for (int i = 0; i < 10; i++)
{
... | ALGO | 0.999783 | 4.520196 |
5d899db6-f9f9-4a52-b2c5-890e4f40b82e | bulkin-anton/programming_practice | c_and_c++_practice/c++_practice/task_j/J1.cpp | #include <iostream>
#include <string>
int
main(){
std::cout << 0 << std::endl << 2 << std::endl;
std::string str;
while(std::getline(std::cin, str)){
size_t cnt = 0, cnt_c = 0, err = 0;
for (size_t i = 0; i < str.size(); i += 2){
if (!((str[i] == 'a') && (str[i + 1]) == 'b')){
... | ALGO | 0.999911 | 3.793418 |
ff24fb57-199c-4fa8-8db6-40819dee3cd1 | LiWeiJie/ACM-Code | hdoj/4607.cpp | //hdu 4607 Park Visit
//http://acm.hdu.edu.cn/showproblem.php?pid=4607
/*
* 题意:
* n个节点的公园,有n-1条路相通,路的路径长固定为1,询问m次,问游览p个节点,最少走多远,开始点任意
* 思路:
* 首先找出树的直径r,那么可以轻易推出,
* 对于每个询问q,若q<=r+1,则路长为q-1,若q>r+1,则对于不在直径上的任意一个节点都需要付出两倍的路径长度代价,所以路长为r+(q-r-1)*2
* 计算树的直径的方法为两次dfs,从任意一个点出发dfs得到最远的点,再从该点dfs得到最远的距离即为其直径长度
* author:lica... | ALGO | 0.999949 | 4.360517 |
a0da5ac6-e2a4-442e-9f2a-de6633d38c00 | xjhsafeguards/mit | eigen-eigen-323c052e1731/bench/quat_slerp.cpp | #include <iostream>
#include <Eigen/Geometry>
#include <bench/BenchTimer.h>
using namespace Eigen;
using namespace std;
template<typename Q>
EIGEN_DONT_INLINE Q nlerp(const Q& a, const Q& b, typename Q::Scalar t)
{
return Q((a.coeffs() * (1.0-t) + b.coeffs() * t).normalized());
}
template<typename Q>
EIGEN_DONT_INL... | ALGO | 0.992107 | 6.251058 |
8c7f588b-e0e9-40d7-a476-f475044e70e4 | Rxdgxn/leet | src/900.cpp | #include "../include.h"
class RLEIterator {
public:
deque<int> apparitions, values;
int q = 0;
RLEIterator(vector<int>& encoded) {
for (int i = 0; i < encoded.size(); i++) {
if (i % 2 == 0) {
if (encoded[i] == 0) {
i++;
continue;
... | ALGO | 0.996251 | 4.761892 |
25338f35-5c94-481c-81e0-59324789f3df | JessJess-Choi/ProblemSolving | 프로그래머스/k진수에서 소수 개수 구하기.cpp | #include <string>
#include <vector>
#include <algorithm>
using namespace std;
bool f(string str){
long long l = stoll(str);
if(l == 0 || l == 1)return false;
for(long long i = 2;i*i<=l;i++)
if(l % i == 0)return false;
return true;
}
int solution(int n, int k) {
int answer = 0;
string ... | ALGO | 0.999808 | 4.562343 |
fbeee9ee-5f8d-4c6c-9af4-e85b59f644d1 | bhyeanhasan/Competitive-Programming-Solutions | Code Forces Problem Solutions/some code/I - Imaginary Dragon.cpp | /**===========================================================================================
B H Yean Hasan (Noyen)
Patuakhali Science and Technology University
Faculty of Computer Science and Engineering
<EMAIL> /<EMAIL>
/... | ALGO | 0.999975 | 3.225292 |
ce993364-9743-4986-a2a7-204f0b8a9eef | idsyr/leetcode | 2023.06.15_#1161_maximum_level_sum_of_a_binary_tree.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.999992 | 6.58988 |
db3c7431-0629-4281-82bd-55ddb47c150c | paolo-torres/interview-prep | leetcode/google/categories/design/stream_of_characters.cpp | /*
Design an algorithm that accepts a stream of chars & checks:
if a suffix of these chars is a string of a given array of words
Ex. words = ["abc","xyz"], stream: 'a','x','y','z' -> true, "xyz"
Trie, but reversed since suffix, then compare w/ stream in reverse
Time: O(n) -> n = max length of a wo... | ALGO | 0.999571 | 7.054777 |
6d430b3b-7e33-4724-8058-0ca7c2e2fae9 | Hsue66/Algo | BOJ/n11005.cpp | #include<cstdio>
#include<stack>
//#include<iostream>
using namespace std;
int num,base;
stack<char> S;
int main(){
scanf("%d%d",&num,&base);
do{
int left = num % base;
char val = '0'+left;
if(left >= 10)
val = left-10+'A';
S.push(val);
num = num / base;
}while(num != 0);
while(!S.empty()){
prin... | ALGO | 0.999928 | 4.012918 |
21b956eb-f68f-43d6-b6f5-fddcf8ad98ed | david-guerrero/MITK | MITK/Modules/DiffusionImaging/Tractography/GlobalTracking/SphereInterpolator.cpp |
#include "auxilary_classes.cpp"
class SphereInterpolator
{
public:
float *barycoords;
int *indices;
int size; // size of LUT
int sN; // (sizeofLUT-1)/2
int nverts; // number of data vertices
float beta;
float inva;
float b;
int *idx;
float *interpw;
SphereInterpolator(float *barycoords, i... | ALGO | 0.998049 | 3.956206 |
10f7bc0e-fa00-4cc3-b966-f07311e6f25a | lavanyakkkk/Traning.cpp | assessments/cppbasics/cppbasics/prg04.cpp | /*Write a Program to Find the ASCII Value of a Character*/
#include <iostream>
using namespace std;
void func(char);
int main()
{
char ch;
cout << "enter a character: " << endl;
cin >> ch;
func(ch);
return 0;
}
void func(char c)
{
cout << "the ascii value of character is: " <<int(c)<< endl;
}
| TOOL | 0.997574 | 4.816041 |
e36211b5-2e7d-4643-9be8-0abc57b1fde6 | aviaryan/competitive | hackerrank/coin_change.cpp | #include "bits/stdc++.h"
#define MODULO 1000000007
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
int main(){
int n, j, i, m;
ios_base::sync_with_stdio(0);
cin >> n >> m;
int arr[m];
ll ans[m][n+1], a, k;
for (i=0; i<m; i++){
cin >> arr[i];
ans[i][0] = 1;
}
for (i=1; i<=n; i+... | ALGO | 0.999992 | 3.359521 |
ac58f216-4a92-498e-8655-8174dfaf99ab | xodbs97/Baekjoon | 프로그래머스/unrated/181939. 더 크게 합치기/더 크게 합치기.cpp | #include <string>
#include <vector>
using namespace std;
int solution(int a, int b) {
int answer = 0;
int t1 = a, t2 = b, i1 = 1, i2 = 1;
while(t1){
t1 /= 10;
i1 *= 10;
}
while(t2){
t2 /= 10;
i2 *= 10;
}
return a * i2 + b > b * i1 + a ? a * i2 + b :... | ALGO | 0.999719 | 4.514612 |
7465eb87-030c-48be-a4cb-030e2e2dffad | Prashant-flick/codeforces-contest | CodeTON Round 9/B_Shohag_Loves_Strings.cpp | #include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
int t;
cin >> t;
while (t--)
{
string s;
cin >> s;
int n = s.size();
if(n==1){
cout << -1 << endl;
continue;
}
string t="";
string t2="";
... | ALGO | 0.999939 | 4.084327 |
9cad05f1-7c57-4317-8b0c-07408afc9304 | tobytyx/leetcode | 面试题32-III_从上到下打印二叉树III.cpp | #include<iostream>
#include<vector>
#include<deque>
#include<algorithm>
using namespace std;
struct TreeNode {
int val;
TreeNode *left;
TreeNode *right;
TreeNode(int x) : val(x), left(NULL), right(NULL) {}
};
class Solution {
public:
vector<vector<int>> levelOrder(TreeNode* root) {
vector<... | ALGO | 0.999993 | 5.489379 |
0c978764-ad7e-4bb9-b476-43fc4f474171 | rohan-more/Portfolio | CaptureTheFlag/Code/Engine/Math/cHalf.cpp | // Header Files
//=============
#include "cHalf.h"
// Static Data Initialization
//===========================
namespace
{
static int const shift = 13;
static int const shiftSign = 16;
static int32_t const infN = 0x7F800000; // flt32 infinity
static int32_t const maxN = 0x477FE000; // max flt16 normal as a flt3... | TOOL | 0.934866 | 6.427157 |
b75ecb32-da5a-4df9-b213-1d065d1a6723 | Dylrak/CPSE | v2cpse1-examples-master/2016-2017-V2CPSE1-05-07-lambda/main.cpp | #include "hwlib.hpp"
constexpr double pow( double g, int n ){
double result = 1;
while( n > 0 ){
result *= g;
--n;
}
return result;
}
constexpr double fac( int n ){
double result = 1;
while( n > 0 ){
result *= n;
--n;
}
return result;
}
constexpr double sin( double... | TOOL | 0.955878 | 6.472822 |
d13880b2-abe3-4e6d-ad23-9940950f14f7 | mehtaparivesh/codechef | EVacuate_to_Moon.cpp | #include <bits/stdc++.h>
// #include<ext/pb_ds/assoc_container.hpp>
// using namespace __gnu_pbds;
using namespace std;
#define ll long long int
#define ld long double
#define mod 1000000007
#define inf 1e18
#define endl "\n"
#define pb emplace_back
#define vi vector<ll>
#define vs vector<string>
#define pii pair<ll, ... | ALGO | 0.999965 | 4.298345 |
ca2b42a9-3ce8-418f-b6f2-81c5681ef0cc | gexiannan2/testwebsocket | include/boost_1_85_0/libs/graph/example/girth.cpp | /*
Adapted from the GIRTH program of the Stanford GraphBase.
Sample output:
This program explores the girth and diameter of Ramanujan graphs.
The bipartite graphs have q^3-q vertices, and the non-bipartite
graphs have half that number. Each vertex has degree p+1.
Both p and q should be odd prime numbers;
... | ALGO | 0.999799 | 5.753296 |
0a45bc73-31b3-47a0-862a-79dc8844020c | Ananya-L/CP-SOC | Assignment_2/i.cpp | #include <iostream>
#include <vector>
#include <algorithm> // for std::find
using namespace std;
// Function to swap two rows in a matrix
void swapRows(vector<vector<int>>& matrix, int row1, int row2) {
if (row1 != row2) {
swap(matrix[row1], matrix[row2]);
}
}
// Function to swap two columns in a mat... | ALGO | 0.999986 | 5.803024 |
d73a8ab0-b261-4d55-b475-2b4fd137fed2 | hku-mars/SUPER | rog_map/include/rog_map/rog_map_core/raycaster.cpp | #include "raycaster.h"
namespace rog_map {
namespace raycaster {
RayCaster::RayCaster(const double &resolution) {
#ifdef ORIGIN_AT_CORNER
#ifdef ORIGIN_AT_CENTER
throw std::runtime_error(" -- [SlidingMap]: ORIGIN_AT_CORNER and ORIGIN_AT_CENTER cannot be both true!");
#endif
#endif
#ifndef ORIG... | ALGO | 0.955279 | 6.180702 |
49f75b39-5a7a-47c7-9903-e8c05e4d4cd1 | sarvex/leetcode-free-pascal | solution/2100-2199/2119.A Number After a Double Reversal/Solution.cpp | class Solution {
public:
bool isSameAfterReversals(int num) {
return num == 0 || num % 10 != 0;
}
}; | ALGO | 0.999917 | 6.067679 |
1440a19e-8911-49b3-a291-0ce1fa03b1b8 | fei0319/competitive-programming | code/codeforces/1916H2.cpp | #include <bits/stdc++.h>
using ll = long long int;
const int MOD = 998244353;
int qpow(int a, ll b) {
int res = 1;
while (b) {
if (b & 1) res = (ll)res * a % MOD;
a = (ll)a * a % MOD, b >>= 1;
}
return res;
}
void solve(void) {
ll n;
int p, k;
std::cin >> n >> p >> k;
... | ALGO | 0.999871 | 3.887567 |
3cf64199-d575-4058-8da5-76ab07ba5001 | vbermudez/CarND-Path-Planning-Project | src/Eigen-3.3/failtest/fullpivqr_int.cpp | #include "../Eigen/QR"
#ifdef EIGEN_SHOULD_FAIL_TO_BUILD
#define SCALAR int
#else
#define SCALAR float
#endif
using namespace Eigen;
int main()
{
FullPivHouseholderQR<Matrix<SCALAR,Dynamic,Dynamic> > qr(Matrix<SCALAR,Dynamic,Dynamic>::Random(10,10));
}
| TEST | 0.86806 | 3.150836 |
38682be7-43fc-4c8a-aebc-20459ebb7cb3 | stilgarpl/bsc | src/parser/parser/parameters/CommandLineParameters.cpp | //
// Created by Krzysztof Tulidowicz on 07.01.2020.
//
#include "CommandLineParameters.h"
#include <memory>
#include <numeric>
#include <utility>
namespace bsc {
CommandLineParameters::CommandLineParameters() : parser(parserBuilder().make()) {}
std::shared_ptr<CommandLineParameters::ArgumentParser> CommandLi... | TOOL | 0.968524 | 7.41702 |
d80e62a3-af08-45fc-bf11-d42e3334883f | ehnryx/acm | cerc-2013-cf100299/l.cpp | #include <bits/stdc++.h>
using namespace std;
#define _USE_MATH_DEFINES
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef complex<ld> pt;
typedef vector<pt> pol;
const char nl = '\n';
const ll INF = 0x3f3f3f3f;
const ll INFLL = 0x3f3f3f3f3f3f3f3f;
const ll MOD = 1e9+7;
const ld EPS = 1e... | ALGO | 0.999023 | 4.702653 |
59bc525c-ba6f-4c30-a68e-d3aa2237c8d3 | gmh5225/OLLVM-test-goron-10 | libcxx/test/std/algorithms/alg.modifying.operations/alg.replace/replace_copy.pass.cpp | // <algorithm>
// template<InputIterator InIter, typename OutIter, class T>
// requires OutputIterator<OutIter, InIter::reference>
// && OutputIterator<OutIter, const T&>
// && HasEqualTo<InIter::value_type, T>
// constexpr OutIter // constexpr after C++17
// replace_copy(InIter first, InIte... | TEST | 0.970647 | 6.625417 |
5901c15f-14b8-401e-b9e9-536dee24286c | usernameSplash/BOJ | Problems/200_Basic_Data_Structure/1158_JosephusSeq/main.cpp | #include <iostream>
#include <queue>
#include <vector>
using namespace std;
void cppIOInitialize()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
}
int main()
{
int n, k;
cin >> n >> k;
int answer[5000];
queue<int> q;
for (int i = 1; i <= n; i++)
{
q.... | ALGO | 0.999889 | 3.609962 |
5b97e129-640d-4419-8257-70e0e5fefdb8 | parthgoyal123/GeeksForGeeks | Sorting/2. MergeSort.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define MAX 1000000007
#define loop(i,a,b) for(int i=a; i<b; i++)
#define lloop(i,a,b) for (long long i=a; i<b; i++)
template <typename T>
void printArray(T arr[], int n){
loop(i,0,n){
cout << arr[i] << " ";
} cout << endl;
}
void me... | ALGO | 0.999965 | 4.512116 |
07059643-2200-4f11-9d46-cee4192e195c | weizds/LeetCode | easy/912_Sort_an_Array.cpp | class Solution {
public:
void siftDown(vector<int> &heap, int start, int end) {
int root = start;
while(root*2 + 1 <= end) {
int left = root * 2 + 1;
int to_swap = root;
if(heap[to_swap] < heap[left])
to_swap = left;
int right = left + ... | ALGO | 0.999997 | 5.865036 |
a9fde4c9-058b-4794-99f0-78da203fb120 | Huchangzhi/oi-wiki | math/code/basis/basis_1.cpp | #include <bits/stdc++.h>
using ull = unsigned long long;
ull p[64];
void insert(ull x) {
for (int i = 63; ~i; --i) {
if (!(x >> i)) // x 的第 i 位是 0
continue;
if (!p[i]) {
p[i] = x;
break;
}
x ^= p[i];
}
}
int main() {
int n;
scanf("%d", &n);
ull a;
for (int i = 1; i <= n... | ALGO | 0.99995 | 4.696043 |
61e42f92-16c9-480b-a6fb-92dcd4249dc6 | GagandeepCodes/Cpp_files | codeforces/contest/A_2023.cpp | //code aisa likho ki,
//4 log debug krne se dare
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,a,b) for(ll i=a;i<b;i++)
const long long M=1e9+7; //998244353;
void solve(){
int t;cin>>t;
while(t--)
{
int n,k;
cin>>n>>k;
vector<int> arr(n+1);
... | ALGO | 0.999707 | 3.784661 |
38035cc6-0e9e-4a12-937f-336584ec7b71 | sainisajal147/Problem_solving | chaining(hash_table)/main.cpp | #include <iostream>
#include<vector>
using namespace std;
struct node
{
int data;
node* next;
};
void Insert(node * &head,int data)
{
node * newn=new node();
newn->data=data;
newn->next=NULL;
if(head==NULL)
{
head=newn;
return ;
}
else if(head->data>da... | ALGO | 0.999553 | 3.365307 |
f48f550b-508d-478e-807d-a31dda4b3ec6 | WooodHead/keggle_santa | libs/Cbc-2.9.7/Cbc/examples/qmip.cpp | #include <cassert>
#include <iomanip>
#include "CoinPragma.hpp"
// For Branch and bound
#include "OsiSolverInterface.hpp"
#include "CbcModel.hpp"
#include "CbcBranchUser.hpp"
#include "CbcCompareUser.hpp"
#include "CbcCutGenerator.hpp"
#include "CbcHeuristicLocal.hpp"
#include "ClpQuadInterface.hpp"
// Cuts - some m... | ALGO | 0.993871 | 6.175622 |
e70e268b-c6c7-44cc-858c-f99a8944d7e4 | luckcul/LeetCode | algorithms/String Compression II/String Compression II.cpp | class Solution {
struct node {
char ch;
int cnt;
int start_idx;
int end_idx;
};
public:
int get_len(int x) {
if(x == 1) return 0;
if(x < 10) return 1;
if(x < 100) return 2;
return 0;
}
int getLengthOfOptimalCompression(string s,... | ALGO | 0.999818 | 5.153366 |
b1c56b84-58a1-47fa-bdaa-e80b413b25b2 | Akhil18x/CSA0356-DataStructures | fibonacciwithoutrecursion.cpp | #include <stdio.h>
int main() {
int n;
printf("Enter the number of terms: ");
scanf("%d", &n);
int first = 0, second = 1, next;
printf("Fibonacci Series: ");
printf("%d", first); // Display the first term
for (int i = 1; i < n; ++i) {
printf(", %d", second); // Display the curr... | ALGO | 0.999599 | 4.532139 |
84bcdedb-d968-4f4c-97d0-0e2f116979e5 | pederson/fdtd | tests/testTEM.cpp | #include <fdtd.h>
#include <iostream>
#include <typeinfo>
#include <vector>
#include <algorithm>
using namespace fdtd;
// compile with:
// clang++-3.8 -std=c++14 -stdlib=libc++ -I../ testTEM.cpp -o test
int main(int argc, char * argv[]){
// time-stepping parameters
const double cfl = 0.9;
const double dx = 1... | ALGO | 0.982744 | 4.208893 |
9e189497-ee85-4679-91b4-f6e0223b17bf | apaarkamal/miscellaneous-codes | chocolates and college.cpp | #include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long int
#define F first
#define S second
#define pb push_back
using namespace std;
using namespace __gnu_pbds;
typedef tree<ll, null_type, less<ll>, rb_tree_tag,
tree_order_statistics_node_u... | ALGO | 0.999994 | 4.108479 |
36032baa-0cad-4df7-9f81-a139c92f5426 | wongkristen/Solutions | LeetCode/TwoSum.cpp | //
// Created by Kristen Wong on 10/9/17.
//
#include <vector>
using namespace std;
//Given an array of integers, return indices of the two numbers such that they add up to a specific target.
//
//You may assume that each input would have exactly one solution, and you may not use the same element twice.
//
//Example:... | ALGO | 0.999476 | 6.511715 |
1d6cb932-2715-4b1d-9f2f-5c7fca437e16 | prerna120/6-companies-30-days-challenge | Goldman Sachs/14.cpp | class Solution {
public:
int minSubArrayLen(int target, vector<int>& nums) {
int i=0,j=0,n=nums.size(),sum=0,mn=INT_MAX;
while(j<n){
sum+=nums[j];
if(sum>=target){
while(sum>=target){
mn=min(j-i+1,mn);
sum-=nums[i++];
... | ALGO | 0.999995 | 6.368857 |
51961afa-bf3d-4e69-9ddc-f5b1efb13d87 | sailendrachettri/dsa-love-babber | queue/sumMaxMin.cpp | #include <iostream>
#include <deque>
using namespace std;
int solve(int *arr, int n, int k){
deque<int> maxi(k);
deque<int> mini(k);
// addition of first k size window
for(int i = 0; i < k; i++){
while(!maxi.empty() and arr[maxi.back()] <= arr[i])
maxi.pop_back();
... | ALGO | 0.999909 | 3.85667 |
1dcb2d65-fe4d-4bb9-aa69-6c5de0b9f9f5 | fanioc/code-training | Vijos/P1696 数与连分数.cpp | #include <cmath>
#include <iostream>
using namespace std;
int step = 0;
string toLianfenshu(int a, int b) {
string x = "";
if (b == 1 || a % b == 0) {
x += to_string(a / b);
step = 0;
return x + "]";
}
if (step == 0)
x += "[";
x += to_string((int)a / b);
if (step == 0) {
x += ";";
... | ALGO | 0.983003 | 4.286082 |
b3e9b634-605a-4259-b978-1230da3e940a | ishandutta2007/codeforces | boook/normal/474/E.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/priority_queue.hpp>
using namespace std;
using namespace __gnu_pbds;
#define REP(i,j) for(int i = 0 ; i < j ; ++i)
#define REPNM(i,j,k) for(int i = j ; i < k ; ++i)
#define RREP(i,j,k) for(int i = j ; i >=k ; --i)
#define A... | ALGO | 0.999989 | 3.670038 |
585bd3b2-3e6c-49d4-a502-5b10b4a84fee | hushmirror/hush3 | src/notarizationdb.cpp | NotarizationDB *pnotarizations;
NotarizationDB::NotarizationDB(size_t nCacheSize, bool fMemory, bool fWipe) : CDBWrapper(GetDataDir() / "notarizations", nCacheSize, fMemory, fWipe, false, 64) { }
NotarizationsInBlock ScanBlockNotarizations(const CBlock &block, int nHeight) {
EvalRef eval;
NotarizationsInBlock ... | TOOL | 0.904486 | 4.573928 |
ec241c7c-0c12-4522-abce-a77900fe8161 | lrdashuaibi/- | c.15.cpp | #include <stdio.h>
int main() {
int nums[100000];
int n;
printf("볤ȣ");
scanf("%d", &n);
printf("֣");
for (int i = 0; i < n; i++)
{
scanf("%d", &nums[i]);
}
int count = 0;
for (int i = 1; i < n-1; i++)
{
if ((nums[i] > nums[i-1] && nums[i] > nums[i+1]) || (nums[i] ... | ALGO | 0.999897 | 3.223793 |
d51ce034-a9ff-4862-bd98-abd95ea8b912 | ishandutta2007/codeforces | ddytxdy/normal/1394/A.cpp | #include<bits/stdc++.h>
#define LL long long
using namespace std;
const int N=1e5+50;
int n,d,m,a[N],n1,n2;LL s1[N],s2[N],ans;
int main(){
scanf("%d%d%d",&n,&d,&m);
for(int i=1;i<=n;i++)scanf("%d",&a[i]);
sort(a+1,a+n+1);
for(int i=1;i<=n;i++)
if(a[i]<=m)++n1,s1[n1]=s1[n1-1]+a[i];
else ++n2,s2[n2]=s2[n2-1]+a[i]... | ALGO | 0.999919 | 3.391075 |
fa04087c-0c4f-4d46-9cee-92965f8bdc27 | cbkpar/BOJ | boj_2258.cpp | #include <iostream>
#include <algorithm>
using namespace std;
struct tMeat
{
int iWeight;
int iCost;
};
int main()
{
int iN;
cin >> iN;
int iM;
cin >> iM;
tMeat* arrMeat = new tMeat[iN];
for (int i = 0; i < iN; ++i)
{
int iWeight;
int iCost;
cin >> iWeight >> iCost;
arrMeat[i] = { iWeight, iCost };... | ALGO | 0.999973 | 3.793145 |
7349f946-2a16-434c-8782-fe1c4bd29ec3 | suchaimi/suchcoin | src/rpc/misc.cpp | #include <base58.h>
#include <chain.h>
#include <clientversion.h>
#include <core_io.h>
#include <crypto/ripemd160.h>
#include <init.h>
#include <validation.h>
#include <httpserver.h>
#include <net.h>
#include <netbase.h>
#include <rpc/blockchain.h>
#include <rpc/server.h>
#include <rpc/util.h>
#include <timedata.h>
#in... | WEB | 0.920455 | 7.38209 |
c571b56b-1aa6-4568-bcad-73a890a08576 | SatyaKanth-6627/ProblemSolving_July-3-24 | CodeChef_Problems/NearlyEqual.cpp | // problem link
// https://www.codechef.com/problems/SAMESAME
#include <bits/stdc++.h>
using namespace std;
int main() {
// your code goes here
int t;
cin >> t;
while(t--){
int s = 0;
int e ;
int n;
cin >> n >> e;
string str1, str2;
cin >> str1 >> str2;
e = str2.length();
... | ALGO | 0.999919 | 4.640086 |
cc41baf7-fe44-4441-b667-42fa02b3bb28 | WadekarPrashant/LeetCode-Problems-2024 | Problem300.cpp | class Solution {
public:
int lengthOfLIS(std::vector<int>& nums) {
if (nums.empty()) {
return 0;
}
int n = nums.size();
std::vector<int> dp(n, 1);
for (int i = 1; i < n; ++i) {
for (int j = 0; j < i; ++j) {
if (nums[i] > nums[j]) {
... | ALGO | 0.999933 | 6.475633 |
26d49246-8727-4cbd-8188-4bd8d2b32483 | kmjp/procon | 2017-2021/2017/njpc/h.cpp | #include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;
#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZER... | ALGO | 0.999977 | 4.244506 |
542abd90-daae-492b-8295-4b61bb42f772 | coderwyc/hello-world | same_binary_tree.cpp | /*
Given two binary trees, write a function to check if they are equal or not.
Two binary trees are considered equal if they are structurally identical and the nodes have the same value.
*/
/**
* Definition for binary tree
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* Tre... | ALGO | 0.999966 | 6.984371 |
93caeea9-3236-4824-aace-1402e2c4209c | Kavin1421/Leetcode-Solution | 1700-1799/1754.Largest Merge Of Two Strings/Solution.cpp | class Solution {
public:
string largestMerge(string word1, string word2) {
int m = word1.size(), n = word2.size();
int i = 0, j = 0;
string ans;
while (i < m && j < n) {
bool gt = word1.substr(i) > word2.substr(j);
ans += gt ? word1[i++] : word2[j++];
... | ALGO | 0.999993 | 5.647105 |
22899377-ba5e-4f4b-81c8-f2ea1f9df9d8 | Derrick-Png/LeetCode | 896.cpp | #include <iostream>
#include <stdio.h>
#include <unordered_map>
#include <string>
using namespace std;
class Solution {
public:
bool isMonotonic(vector<int>& nums) {
bool isI = false;
bool isD = false;
if(nums.size() == 1)
{
return true;
}
else
{
... | ALGO | 0.999991 | 5.412895 |
828fb3fe-585d-4fe1-8217-51179e95aac3 | shd24/5252525255 | 52/1111.cpp | #include <iostream>
#include <limits>
using namespace std;
int main() {
setlocale(LC_ALL, "Russian");
const int size = 10;
int A[size];
int* ptr = A;
cout << " 10 : ";
for (int i = 0; i < size; ++i) {
while (!(cin >> *(ptr + i))) {
cin.clear();
cin.ignore(numeri... | ALGO | 0.998846 | 3.330367 |
4ddf4b94-e767-4682-ae14-b8babdd7d140 | jel-PDX/MyDSandAlgorithms | Algorithms/Quick_Sort/src/test.cpp | /// Quick Sort
//
// By: James Lawrance
// Date: 6/27/23
//
/// ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
#include <catch2/catch_test_macros.hpp>
#include "QuickSort.h"
void matchLists(int actual_arr[], int expected_arr[], int len) {
for (int i{}; i < len; ++i) CHECK(actual_arr[i] == expected_arr[i]);
... | TEST | 0.874951 | 6.290024 |
abde6ce5-7303-4dee-bebf-4c22b538dd24 | yiqun-liu/Algo-Lab-ETHz | PotW/deck_of_cards/deck_of_cards.cpp | #include <cstdio>
const int MAX_N = 100000;
const int MAX_K = 1 << 30;
int v[MAX_N];
int absDiff(int a, int b)
{
int ret = a - b;
if (ret < 0) return -ret;
return ret;
}
void testcase()
{
int n, k;
scanf("%d%d", &n, &k);
int sum = 0;
int minDiff = MAX_K, l = 0, r = 0;
// Here I k... | ALGO | 0.999979 | 4.360892 |
f99e730d-1667-4e12-b583-e23a99547e1a | anveshadixit/CrackYourPlacement_45DaysChallenge | 0509-fibonacci-number/0509-fibonacci-number.cpp | class Solution {
public:
int fib(int n) {
// base case
if (n == 0 )
{
return 0 ;
}
if (n == 1)
{
return 1 ;
}
// recursive call
return fib(n - 1) + fib(n - 2) ;
}
}; | ALGO | 0.999981 | 6.076369 |
9aed93bb-bd37-4f3e-ac6a-df69aa8d2d42 | elgamalsalman/cp-solutions | UVa/UVa_Solutions/00247_Calling_Circles/00247.cpp | #include<bits/stdc++.h>
using namespace std;
typedef map<string, int> msi;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef stack<int> si;
int tcNum, dfsCounter, dfsNum[30], dfsLow[30], callerCounter, n, m;
bitset<30> inStack;
string s1, s2;
msi dict;
vvi adj;
si sccStack;
string findCallerWithInd (int ind) ... | ALGO | 0.999877 | 4.70593 |
b37c97ed-ea61-43b8-b4a1-6ab5ae82049e | qinhaoxu0123/CS32-Data-Structure-and-Algorithm-Analysis | Homework 2/Homework 2/mazestack.cpp | #include <iostream>
#include <string>
#include <stack>
#include <assert.h>
using namespace std;
class Coord
{
public:
Coord(int rr, int cc) : m_r(rr), m_c(cc) {}
int r() const { return m_r; }
int c() const { return m_c; }
private:
int m_r;
int m_c;
};
bool pathExists(string maze[], int nRo... | ALGO | 0.999239 | 3.823304 |
4d7b5205-587f-455d-a372-01f256ef8c57 | Priyasharma02821/GeeksforGeeks-DSA-Solutions | Difficulty: Basic/Count number of elements between two given elements in array/count-number-of-elements-between-two-given-elements-in-array.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
int getCount(vector<int> &arr, int num1, int num2) {
int n = arr.size();
int left = -1, right = -1;
for (int i = 0; i < n; i++) {
if (arr[i] == num1) {
left = i;... | ALGO | 0.99951 | 6.140363 |
fc1db832-5725-4e26-aaa7-f6a3e56ba784 | Ivanguado/Recuerdo-en-C- | Bloque 9 - Funciones/Ejercicio 16 - menor elemento de una fila de la matriz.cpp | /*Ejercicio 16: Realice una funcin que dada una matriz y un nmero de fila de la
matriz devuelva el menor de los elementos almacenados en dicha fila.*/
#include<iostream>
#include<conio.h>
using namespace std;
void pedirDatos();
int comprobarMenorElemento(int m[][100],int,int);
int m[100][100],nfilas,ncol;
int main... | ALGO | 0.997311 | 3.527147 |
20b51cef-3359-4986-a138-d4758d1ed71a | sus-unn/blender | extern/bullet2/src/BulletCollision/CollisionDispatch/btSphereTriangleCollisionAlgorithm.cpp | #include "btSphereTriangleCollisionAlgorithm.h"
#include "BulletCollision/CollisionDispatch/btCollisionDispatcher.h"
#include "BulletCollision/CollisionShapes/btSphereShape.h"
#include "BulletCollision/CollisionDispatch/btCollisionObject.h"
#include "SphereTriangleDetector.h"
#include "BulletCollision/CollisionDispatch... | ALGO | 0.998697 | 6.826073 |
07f0e5d9-caec-4fa1-bd55-34fae67268dd | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_8882_3.cpp | #include <bits/stdc++.h>
using namespace std;
const int maxn = 1010;
int n, m, h[maxn][maxn];
string str[maxn];
set<int> x[maxn], y[maxn];
void bfs(int a, int b) {
queue<pair<int, int>> q;
h[a][b] = 0;
q.push({a, b});
while (!q.empty()) {
pair<int, int> v = q.front();
q.pop();
while (x[v.first].size... | ALGO | 0.999797 | 4.291737 |
ca460f9c-54fa-49e6-bb35-171cf1368f46 | PabloMessina/Competitive-Programming-Material | Graphs/articulation-points,cut-edges,biconnected-components.cpp | // -------------------
// Tarjan's Algorithm
// -------------------
// references:
// https://www.youtube.com/watch?v=jFZsDDB0-vo
// https://www.hackerearth.com/practice/algorithms/graphs/articulation-points-and-bridges/tutorial/
// https://www.hackerearth.com/practice/algorithms/graphs/biconnected-components/tutorial/... | ALGO | 0.998436 | 4.661205 |
a2eacd5d-a8ec-4d02-b0a2-8180589deffb | Pushkar-sharma28/Dsa | Hashing/7.Winner_of_an_election.cpp | //gfg hashing problem
class Solution{
public:
//Function to return the name of candidate that received maximum votes.
vector<string> winner(string arr[],int n)
{
// Your code here
// Return the string containing the name and an integer
// representing the number of votes the wi... | ALGO | 0.999984 | 5.457967 |
be61d693-d96b-4a91-aeb4-ee8276038e7e | sarvex/leetcode-odin | solution/2100-2199/2110.Number of Smooth Descent Periods of a Stock/Solution.cpp | class Solution {
public:
long long getDescentPeriods(vector<int>& prices) {
long long ans = 0;
int n = prices.size();
for (int i = 0, j = 0; i < n; i = j) {
j = i + 1;
while (j < n && prices[j - 1] - prices[j] == 1) {
++j;
}
int... | ALGO | 0.999717 | 5.666641 |
01368c90-aeee-4475-8f6f-62f12d6f7e80 | hjiang13/LLMs-in-IR | processed_data/DecompiledResuts_Human_x_164_O1/GPT4o_Human_x_164_O1_decompiled/test/CPP_39.cpp | #include <iostream>
int prime_fibi(int n) {
int result = 0;
for (int i = 1, j = 2; i < n; ++i) {
int is_prime = 1;
for (int k = 2; k * k <= j; ++k) {
if (j % k == 0) {
is_prime = 0;
break;
}
}
if (is_prime) {
re... | ALGO | 0.999894 | 5.547664 |
8dcf1a0b-91d5-4a8b-9ad1-fb0625ca031d | misop/diplomovka | SQM/glm_aditions.cpp | #include "stdafx.h"
#include "glm_aditions.h"
namespace glm {
bool operator==(const glm::vec3 &vecA, const glm::vec3 &vecB)
{
const double epsilion = 0.000001; // choose something apprpriate.
return fabs(vecA[0] -vecB[0]) < epsilion
&& fabs(vecA[1] -vecB[1]) < epsilion
&& fabs(vecA[2] -vecB[2]... | TOOL | 0.901746 | 6.343097 |
4d7b02b4-7fcc-4764-8a74-a0f88eca7825 | carrotsoups/ccc_solutions | Solutions/C++/2019/S2/S2.cpp | #include <bits/stdc++.h>
using namespace std;
bool isPrime(int n){
if (n ==1) return false;
for (int i = 2; i < sqrt(n)+1;i++){
if (!(n%i)) return false;
}
return true;
}
int main(){
int ddfhsu; cin >>ddfhsu;
for (int ssifs = 0; ssifs<ddfhsu;ssifs++){
int n; cin >> n;
f... | ALGO | 0.999834 | 3.814281 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.