uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
543a6acc-f5d0-4f32-a683-1bc160a52da6 | maxim1770/hash-table-sort_set_class | YAMP3_2/YAMP3_2.cpp | #include <iostream>
#include <list>
#include "dlist.cpp"
#include "hash.cpp"
#include "set.cpp"
#include<fstream>
using namespace std;
class word {
public:
std::string s;
word() :s("") {};
word(std::string s1) :s(s1) {};
bool operator==(word a) { return s == a.s; }
bool operator!=(word a) { return... | ALGO | 0.999437 | 4.032182 |
491278b0-d0b1-4e90-a429-063af59f3ddd | itsmepsk/Competitive | Codechef/Contests/Other/ACMKGP14/ACM14KGP1/ACM14KGP1.cpp | #include <bits/stdc++.h>
using namespace std;
long long int arr[100005];
int main() {
long long int t,n,i,j,sum;
cin >> t;
for(j=1;j<=t;j++) {
cin >> n;
for(i=0;i<n;i++) {
cin >> arr[i];
}
sort(arr+0,arr+n);
sum = arr[n-1] + arr[n-2] + arr[n-3];
... | ALGO | 0.999888 | 4.084726 |
91e3315f-fd0e-460d-a439-2a30b46da964 | nikolausmayer/Advent-of-Code-2020 | day-02/cpp/part-2.cpp | #include <cstdlib>
#include <fstream>
#include <iostream>
#include <vector>
int main(int argc, char* argv[])
{
if (argc != 2) {
throw std::runtime_error("bad arguments");
}
auto filename = argv[1];
std::ifstream infile{filename};
if (infile.bad() or not infile.is_open()) {
throw std::runtime_error("c... | TOOL | 0.863482 | 5.302803 |
f119ed15-0829-40c3-962d-dc25acdf565e | aflynt/rhino | src/bindings/bnd_curve.cpp | #include "bindings.h"
BND_Curve::BND_Curve()
{
}
BND_Curve::BND_Curve(ON_Curve* curve, const ON_ModelComponentReference* compref)
{
SetTrackedPointer(curve, compref);
}
void BND_Curve::SetTrackedPointer(ON_Curve* curve, const ON_ModelComponentReference* compref)
{
m_curve = curve;
BND_GeometryBase::SetTracked... | TOOL | 0.853077 | 7.42424 |
0e1f767e-f1a1-4e14-a0aa-889bacf072aa | ishandutta2007/codeforces | ilith/normal/449/A.cpp | #include<bits/stdc++.h>
#define rgi register int
#define fin(x) freopen(x,"r",stdin)
#define fout(x) freopen(x,"w",stdout)
typedef long long ll;
using namespace std;
inline void read(){}template <typename T,typename... Ts> inline void read(T& A,Ts&... As){
T x=0,f=1;char ch=getchar();
while(ch<'0'||ch>'9'){if(ch=='-'... | ALGO | 0.999996 | 3.32956 |
d2bba9bd-d84a-4650-8790-b16235f467f2 | RiyaWarikoo/5th_sem_training | sort_project.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
// Function declarations
void bubbleSort(vector<int>& arr);
void selectionSort(vector<int>& arr);
void insertionSort(vector<int>& arr);
void mergeSort(vector<int>& arr);
void merge(vector<int>& arr, int left, int mid, int right);
void mer... | ALGO | 0.999897 | 5.581277 |
5674647e-acc2-448d-b653-29cee9ab7a3b | LidaZ/Proj01_Chatbin | COG code/Burst-Sparse-Acquisition-Postprocessing/GPUFit/Gpufit-1.2.0/tests/utils.cpp | #include "utils.h"
#include <stdexcept>
// initialize random number generator
std::mt19937 rng(0);
/*
Given a parameter vector p with 4 entries, constructs a 1D Gaussian peak function with x values 0,..,v.size() - 1
*/
void generate_gauss_1d(std::vector< REAL > & v, std::vector< REAL > const & p)
{
for (std::si... | TOOL | 0.982861 | 5.758271 |
aac8fad7-7568-4e87-939b-7ae1442b2477 | shristigupta12/DSAInCpp | O4GettingStartedWithProgramming/basicCalculator.cpp | #include<iostream>
using namespace std;
int switchCase(char ch,int n1,int n2){
switch (ch){
case '+':
return n1+n2;
case '-':
return n1-n2;
case '*':
return n1*n2;
case '/':
if(n2!=0){ ... | ALGO | 0.996977 | 3.602232 |
2dca9c83-63f3-4981-9ae7-93e45ecc6bff | Pratim-Kumar-Hazarika/DSA-Prep | Trees/19-Vertical-Traversal/main.cpp | #include<iostream>
#include<set>
#include <map>
using namespace std;
class Node{
public:
int data;
Node* left;
Node* right;
Node(int val){
data = val;
left = nullptr;
right = nullptr;
}
};
// 1
// / \
// 2 3
// /... | ALGO | 0.999994 | 5.105979 |
ee52a579-11ed-4016-b6bd-92780c1d2fa7 | tarunbhoomla/Leetcode-and-GFG-solutions | 692-top-k-frequent-words/692-top-k-frequent-words.cpp | class Solution {
public:
static bool myComp(pair<string,int>a ,pair<string,int>b)
{
return a.second > b.second || (a.second == b.second && a.first < b.first);
}
vector<string> topKFrequent(vector<string>& words, int k)
{
map<string,int> s ;
for(auto it:words)
{
... | ALGO | 0.999992 | 6.114403 |
4773fc7b-5053-46ad-a4b0-6029e7dfbc36 | GouravMadhwal/LeetCode | 977-squares-of-a-sorted-array/977-squares-of-a-sorted-array.cpp | class Solution {
public:
vector<int> sortedSquares(vector<int>& nums) {
for(int i=0;i<nums.size();i++){
nums[i] = pow(nums[i], 2);
}
sort(nums.begin(), nums.end());
return nums;
}
}; | ALGO | 0.999939 | 5.934338 |
6720f45d-54ee-4f32-8f50-e411da387c80 | 9woods123/easy_mav | drivers/opencv-3.4/modules/photo/src/calibrate.cpp | #include "precomp.hpp"
#include "opencv2/photo.hpp"
#include "opencv2/imgproc.hpp"
#include "hdr_common.hpp"
namespace cv
{
class CalibrateDebevecImpl CV_FINAL : public CalibrateDebevec
{
public:
CalibrateDebevecImpl(int _samples, float _lambda, bool _random) :
name("CalibrateDebevec"),
samples(_s... | ALGO | 0.994222 | 6.254205 |
c7b05f65-c8b8-4f04-b49a-4eb99c6e75bd | meilleur777/Competitive_Programming | BOJ/cpp/31945.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(0); cin.tie(0);
vector<vector<int>> v(8);
for (int i=0; i<(1<<3); i++) {
for (int j=2; j>=0; j--) {
v[i].push_back((i&(1<<j)));
}
}
int t;
cin >> t;
while (t--) {
v... | ALGO | 0.999781 | 4.268795 |
fc92a277-8d5c-4c2a-965f-2f01e4a733f9 | khaledkamr/problem_solving | Assit sheets/Contest #3/D - Counting elements.cpp | #include<iostream>
#include<string>
#include<iomanip>
#include<algorithm>
#include<math.h>
using namespace std;
int main()
{
int size, count = 0;
cin >> size;
int arr[size];
for (int i = 0; i < size; i++)
{
cin >> arr[i];
}
for (int i = 0; i < size; i++)
{
for (int j = 0; j < size; j++)
{
if (arr[j]... | ALGO | 0.99974 | 3.525613 |
e9809d02-4996-4d2e-897d-b9e55953b21c | alexandraback/datacollection | solutions_5670465267826688_1/C++/LuXinyu/google.cpp | #include <iostream>
#include <fstream>
#include <string>
#include <vector>
using namespace std;
int t;
char cal(char first, char second) { // h = 1, n = -1, o = -i, p = -j, q = -k
if(first == 'h')
return second;
if(first == 'i') {
if(second == 'h')
return 'i';
if(second == 'i')
return 'n';
if(second... | ALGO | 0.999864 | 3.689232 |
1634f214-d204-4224-9743-05dd366da68c | wasd96040501/conv3x3 | eigen-git-mirror/doc/examples/matrixfree_cg.cpp | #include <iostream>
#include <Eigen/Core>
#include <Eigen/Dense>
#include <Eigen/IterativeLinearSolvers>
#include <unsupported/Eigen/IterativeSolvers>
class MatrixReplacement;
using Eigen::SparseMatrix;
namespace Eigen {
namespace internal {
// MatrixReplacement looks-like a SparseMatrix, so let's inherits its trai... | ALGO | 0.998704 | 6.161131 |
3b30c7d1-a973-4afe-a0c4-5d2227361c4f | zhibekkazbek/pp1-22B030546 | lab4/O.cpp | /*O-74503. Main diagonal.
The main diagonal of a matrix consists of those elements that lie on the diagonal that runs from top left to bottom right.
Return the maximum value of the element on this diagonal and its coordinates.
If there same maximum elements it takes coordinates of the first one.*/
#include <iostream>... | ALGO | 0.998513 | 4.227014 |
dda87358-353a-4080-aa1a-8ece89f32639 | KrailH/FeatureVerificatio | SearchAlgorithmsVerficatio/BFS.cpp | #include <iostream>
#include <list>
#include <queue>
#include <vector>
// Graph类代表一个有向图
class Graph {
public:
Graph(int V); // 构造函数
void addEdge(int v, int w); // 添加边到图中
void BFS(int s); // 从给定源点s开始的BFS
private:
int V; // 顶点的数量
std::list<int>* adj; ... | ALGO | 0.99991 | 5.672929 |
deaed4b0-fc09-4158-847b-2caa753ce92d | sunjiahaovo/Droid_SLAM_online | thirdparty/eigen/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_colwise.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
int main()
{
Eigen::MatrixXf mat(2,4);
mat << 1, 2, 6, 9,
3, 1, 7, 2;
std::cout << "Column's maximum: " << std::endl
<< mat.colwise().maxCoeff() << std::endl;
}
| ALGO | 0.999747 | 3.779679 |
dd29b1dc-f8d5-4ae8-a2ce-de3f379afa78 | utkarsh438-tech/codeforces_codes | Satyam_and_Counting.cpp | #include <bits/stdc++.h>
using namespace std;
#define arrr array
#define ll long long
#define ld long double
#define szarr(x) ((int)x.size())
#define arrll(arr) (arr).begin(), (arr).end()
#define vec vector<int>
#define vecp vector<parrir<int,int>>
#define vecc vector<vector<int>>
#define pb push_barrck
#... | ALGO | 0.999988 | 3.840303 |
040819ae-7a11-470b-b7d4-de49aeaf55bf | rajEMNS/dmje | 4th-belt-cpp/greaterlesserArray.cpp | #include <iostream>
using namespace std;
int main()
{
int n;
cin >> n;
int a[n];
for (int i = 0; i < n; i++)
{
cin >> a[i];
}
int t;
cin >> t;
int gc = 0, lc = 0;
for (int i = 0; i < n; i++)
{
if (a[i] > t)
{
gc++;
}
else... | ALGO | 0.999988 | 3.499038 |
91240f67-1c0f-4d6f-93b7-f2d6cf6b7d75 | CongJyu/Pitaya | SCUT-Code/P_539/P_539/main.cpp | //
// main.cpp
// P_539 3.12 Account Class
//
// Created by Rain Chen on 2021/12/28.
//
#include <iostream>
using namespace std;
class Account {
private:
int balance;
public:
Account(int init) {
if (init < 0) {
cout << "Error: Initial balance cannot be negative." << endl;
ba... | ALGO | 0.985673 | 5.17511 |
676f7cea-023b-4b83-bb63-55585ca8d9a0 | Prathamesh-Patil-GitHub/practice-programs | PRO Data Structures/DSA in C++ Engineering LAB/DSA Sem 3/Ass - 2 Set Operations/setOperations.cpp | #include<iostream>
using namespace std;
class Set{
private:
int* arr;
string name;
int n;
int eleCount;
public:
Set(string name){
this->name = name;
eleCount = 0;
}
Set(string name, int n){
this->name = name;
this->n = n;
arr = new int[n];
eleCount = 0;
}
void inputSet(){
cout<... | ALGO | 0.993692 | 4.430264 |
227d8247-fc22-4620-86f1-63e87b70bdd2 | jeffyehtw/E-Turtor | 中文題庫/Datastructure 001 - 050/[C_DT12-易] 解讀神秘的密碼.cpp | #include<iostream>
#include<string>
using namespace std;
int main()
{
string s;
while (cin >> s)
{
for (int i = s.length() - 1; i > -1; i--)
cout << s[i];
cout << endl;
}
return 0;
} | ALGO | 0.999223 | 4.106041 |
54114c39-4d18-4271-800f-d36356915fa8 | aminjonshermatov/competitive_programming | codeforces/div4/898/A.cpp | #include <bits/stdc++.h>
#ifdef LOCAL
#include "debug.h"
#else
#define dbg(...) 42
#endif
using namespace std;
void solve() {
string s;
cin >> s;
string x = "383";
int cnt = 0;
for (int i = 0; i < 3; ++i) {
cnt += s[i] != x[i];
}
cout << (cnt == 0 || cnt == 2 ? "YES" : "NO") << '\n';
}
bool is_mul... | ALGO | 0.999565 | 4.411527 |
44b722d7-0bba-4cf0-b614-a1f24226c8bc | samar-gupta/DSA_POTD | Leetcode/Evaluate Reverse Polish Notation.cpp | //Approach-1 (Basic stack approach)
//T.C : O(n)
//S.C : O(n)
class Solution {
public:
int operate(int &a, int &b, const string &s) {
if(s == "+")
return a+b;
if(s == "-")
return a-b;
if(s == "*")
return (long)a*(long)b;
... | ALGO | 0.999931 | 6.434152 |
5cca2cc4-fcdd-4b17-a8ff-0d0f227eebdd | jaipuriyar10/coding-problems | nqueen_problem_using_branch_and_bound.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
void solve(vector<vector<bool>>&v1, ll r, ll n, vector<bool> &col, vector<bool> &ndiag, vector<bool> &rdiag, string str)
{
if (r == n)
{
cout << str;
cout << ".";
cout << "\n";
return ;
}
for (ll i = 0; i ... | ALGO | 0.999287 | 3.675262 |
7fc8443f-3fa6-4e34-ac71-f2405675ef33 | Luigisvc/Marlin_Sources | Marlin-2.1/buildroot/share/PlatformIO/variants/MARLIN_CREALITY_STM32F401RC/variant.cpp | #include "pins_arduino.h"
#ifdef __cplusplus
extern "C" {
#endif
// Digital PinName array
const PinName digitalPin[] = {
PA_0, // Digital pin 0
PA_1, // Digital pin 1
PA_2, // Digital pin 2
PA_3, // Digital pin 3
PA_4, // Digital pin 4
PA_5, // Digital pin 5
PA_6, // Digital pin 6
PA_7, // Dig... | CONFIG | 0.903731 | 6.350003 |
51f9add9-c123-4693-b4ca-3d32372b4bfd | heavenMOJANG/ICPC | .history/2024牛客多校/牛客多校3/B_20240723123545.cpp | #pragma GCC optimize(1)
#pragma GCC optimize(2)
#pragma GCC optimize(3,"Ofast","inline")
#include<bits/stdc++.h>
#define int long long
using namespace std;
constexpr int inf = 0x7fffffff;
constexpr int N = 110;
int n, D, h[N];
signed main() {
cin.tie(0) -> sync_with_stdio(0);
cin >> n >> D;
for (int i = 0; ... | ALGO | 0.999878 | 3.96699 |
b176d9b7-d0be-42da-a43a-107223c49106 | abhishek18124/PPCPPApril2023 | Lecture 29/002LinkedList_AddTwoNumbers.cpp | #include<iostream>
using namespace std;
class ListNode {
public:
int val;
ListNode* next;
ListNode(int val) {
this->val = val;
this->next = NULL;
}
};
void insertAtHead(ListNode*& head, int val) {
ListNode* n = new ListNode(val);
n->next = head;
head = n;
}
void printLinkedList(ListNode* head) {
whil... | ALGO | 0.999982 | 5.297513 |
9eea811c-be84-467c-b8a0-0365a8b8140f | the-mahapurush/Data-Structure-Using-C-C- | 1 Introduction to Array/14 Binary search.cpp | #include <iostream>
using namespace std;
int A[] = {2, 3, 4, 5, 7, 11, 23, 44, 56, 77, 87, 98, 99, 100};
void BinarySearch()
{
int key;
int low = 0, high = (sizeof(A) / sizeof(int));
cout << "Enter Key to search\n ";
cin >> key;
while (low <= high)
{
int mid = (low + high) / 2;
i... | ALGO | 0.999486 | 4.880143 |
9cdb00ac-c491-45f7-8b18-4efa7bfd07a1 | pratapaditya1997/leetcode | medium/1387/sol.cpp | static map<int,int> m;
class Solution {
public:
vector<pair<int,int>> v;
int dfs(int n) {
if(n == 1) return 0;
if(m.find(n) != m.end()) return m[n];
int ret;
if(n&1) ret = 1 + dfs(3*n+1);
else ret = 1 + dfs(n/2);
m[n] = ret;
return ret;
... | ALGO | 0.999972 | 5.024253 |
2d1932dc-4846-46b9-ad59-1da42822bd24 | rutujapunde20/C | reversenum.cpp | #include<stdio.h>
int main()
{
int n,rem,sum;
printf("Enter a number:");
scanf("%d",&n);
while(n!=0)
{
rem=n%10;
sum=sum+rem;
printf("%d\n",sum);
}
return 0;
}
| ALGO | 0.999135 | 3.284865 |
23b64881-726a-4656-9473-c60da53d44ca | Althaf-Budiman/quran_app_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.9988 | 6.76073 |
d4f8b2bb-1bf7-4acc-a724-c848c045f67b | slgnalin/backtracking | knapsack-problem/main.cpp | /**
* ==========================================================================================================
*
* Knapsack problem
*
* ==========================================================================================================
*
*
*
* ==========================================================... | ALGO | 0.999861 | 3.842808 |
87152678-d460-48ef-9ac7-85146188192b | AbubakrAliFOX/CPP | Homeworks/Prime/file.cpp | #include <iostream>
using namespace std;
int ReadPositiveNumber(string Msg)
{
int Number;
do
{
cout << Msg << endl;
cin >> Number;
} while (Number <= 0);
return Number;
}
bool CheckPrime(int Number)
{
;
for (int i = Number - 1; i >= 1; i--)
{
if (Number % i == ... | ALGO | 0.998916 | 4.217179 |
75f3aec2-0cd6-493a-98a8-705d01703718 | LEECHHE/acmicpc | solved/2602.cpp | #include<iostream>
#include<cstring>
using namespace std;
int dp[25][105][2];
char stones[2][105];
char paper[25];
int n,m;
int solve(int p, int idx, bool angel){
if ( p >= n ) return 1;
if ( idx >= m ) return 0;
int& ret = dp[p][idx][angel];
if( ret != -1 ) return ret;
char target = paper[p];
ret = solve(p, idx... | ALGO | 0.999908 | 3.312179 |
b0ad8e38-842c-4c2b-8b06-d941f928114b | andyyang200/CP | Competitive Programming/Contests/CodeForces/Contests/Rounds/300s/Codeforces Round 389/Check/check.cpp | //Andrew Yang
#include <iostream>
#include <stdio.h>
#include <sstream>
#include <fstream>
#include <string>
#include <string.h>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <functional>... | ALGO | 0.999951 | 3.267619 |
0bef9b25-9693-4f88-b111-009081cce349 | Quicksilvercoin/quicksilver | src/bloom.cpp | #include "bloom.h"
#include "main.h"
#include "script.h"
#include "hash.h"
#define LN2SQUARED 0.4804530139182014246671025263266649717305529515945455
#define LN2 0.6931471805599453094172321214581765680755001343602552
using namespace std;
static const unsigned char bit_mask[8] = {0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x4... | ALGO | 0.960469 | 6.82032 |
8f892423-3771-44b7-b7fd-cc4bd36f3455 | megamxl/ueTestHelpers | ueTest.cpp | //
// Created by Maximilian Nowak on 28.06.22.
//
#include "ueTest.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
list *l_init() {
list *lst = (list *) malloc(sizeof(list));
lst->head = NULL;
lst->count = 0;
return lst;
}
void l_insert(list *lst, char *word) {
element *new_data = (... | ALGO | 0.984851 | 3.101092 |
004de0ff-a863-4a33-bfcf-17e9d98a60ef | robertobbaik/codingtest | 0814/1697.cpp | #include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;
int main()
{
int N, K;
cin >> N >> K;
vector<int> visited(100001, -1);
queue<int> q;
q.push(N);
visited[N] = 0;
while(!q.empty())
{
int pos = q.front();
q.pop();
if(pos == K)
{
cout << visited[pos]... | ALGO | 0.999912 | 3.900749 |
b039bfa7-94ee-4cb5-aa11-8d035312db7f | nrdyava/Competitive-Coding | Interviewbit/trees/diagonal traversal.cpp | /**
* Definition for binary tree
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
void DT(TreeNode* A, map<int, vector<int>> &M, int row, int col){
if(A == NULL) return;
M[row - col].push_back(A->val);
... | ALGO | 0.999998 | 5.310305 |
a94c4b06-3717-4f28-a236-228b31661b69 | Maulik176/Maulik_Leetcode | 112-path-sum/112-path-sum.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.999957 | 6.100853 |
b63b1303-1bb3-457f-ab3e-88bd1ba2bc74 | imran43h/problem-solutions | lightoj/1015 - Brush (I).cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int t, i, n;
int sum;
cin>>t;
for(i=1; i<=t;i++){
cin>>n;
sum = 0;
while(n--){
int num;
cin>>num;
if(num<0) continue;
sum+=num;
}
cout<<"Case "<<i<<": "<<su... | ALGO | 0.998414 | 4.060652 |
6e97a21b-be1f-44d9-a2c2-1182d538026b | marco-tomSuden/MineSlicer | src/libigl/igl/columnize.cpp | template <typename DerivedA, typename DerivedB>
IGL_INLINE void igl::columnize(
const Eigen::PlainObjectBase<DerivedA> & A,
const int k,
const int dim,
Eigen::PlainObjectBase<DerivedB> & B)
{
// Eigen matrices must be 2d so dim must be only 1 or 2
assert(dim == 1 || dim == 2);
// block height, width, and... | ALGO | 0.926659 | 5.236076 |
24696c27-cd1f-4cc1-bc3e-63524fdfc873 | LZProgrammerIG/Cpp-Codes | Diamond_Pattern.cpp | #include<iostream>
using namespace std;
int main() {
int N;
cout << "Enter odd number of rows here:- ";
cin >> N;
int i=0;
int half=(N+1)/2;
while(i<half){ //Loop for first half.
int j=i;
while(j<(half-1)){ //Loop for spaces.
cout << ... | ALGO | 0.9998 | 4.519677 |
8845e55e-12e9-464e-914f-59822ef54c01 | vivek-ku-gu/competative_coding | concepts/recursion/fibonacci.cpp | #include<iostream>
using namespace std;
int fibonacci(int n){
if(n== 0 || n==1)
{return n;}
int fibo= fibonacci(n-1) + fibonacci(n-2);
return fibo;
}
int main(){
cout<<fibonacci(8);
} | ALGO | 0.999928 | 4.004819 |
4c0c2178-ee99-4085-892f-87c69f0cb6bb | ShouryaKapoor/LeetCode_DSA_Problems_Solution_Record | 1160-letter-tile-possibilities/1160-letter-tile-possibilities.cpp | class Solution {
public:
int dfs(vector<int>& freq) {
int count = 0;
for (int i = 0; i < 26; i++) {
if (freq[i] > 0) {
count++; // Count current sequence
freq[i]--; // Use the letter
count += dfs(freq); // Recursive call
... | ALGO | 0.999907 | 7.316003 |
add1a331-cd31-44c3-93e2-bfd4837753eb | neelchoudhury/cp | Codechef and Spoj/1-K/IB_GRAY_CODE.cpp | #include <bits/stdc++.h>
#define ll long long int
#define ld double
#define MOD 1000000007
#define mem(a) memset(a,0,sizeof(a))
#define pb push_back
#define ff first
#define ss second
#define sc(n) scanf("%d", &n)
#define pr(n) printf("%I64d\n", n)
#define prf(n) printf("%lf\n",n)
#define scf(n) scanf("%lf", &n)
... | ALGO | 0.999872 | 3.580711 |
faabb444-ac0b-4489-863d-22eb90af9599 | memfault/llvm-project | libcxx/test/std/algorithms/alg.sorting/alg.sort/stable.sort/ranges.stable.sort.pass.cpp | // UNSUPPORTED: c++03, c++11, c++14, c++17
// <algorithm>
// template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
// class Proj = identity>
// requires sortable<I, Comp, Proj>
// I ranges::stable_sort(I first, S last, Comp comp = {}, Proj proj = {}); // since C+... | TEST | 0.995764 | 7.945768 |
f89fe3a0-1a9d-4561-8d38-ea05b604c986 | areian13/PS_BOJ | 1. Bronze/Bronze 4/[B4] 31994 강당 대관.cpp | #include <iostream>
#include <string>
#define FastIO ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr)
using namespace std;
#define MAX 7
int main()
{
FastIO;
string result = "";
int maxPeople = 0;
for (int i = 0; i < MAX; i++)
{
string name;
int people;
... | ALGO | 0.999416 | 4.331152 |
b7f91b96-643a-4590-83e6-5c666096e0b0 | glerium/acm-life | contest/240819-astar-2024-final/1.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int n;
ll a[30],b[30][30],c[30][30][30];
ll best[30];
ll v[10][3];
bitset<30> vis;
void dfs(int x, ll now) {
if(x % 3 == 0 && x != 0) {
auto tt = v[x/3-1];
now += c[tt[0]][tt[1]][tt[2]];
}
best[x] = max(best[x], now);
if... | ALGO | 0.999943 | 3.829353 |
12779a16-19db-4ced-b15f-51270ead6d8d | CGCL-codes/LoomIO | src/boost/libs/iterator/example/permutation_iter_example.cpp | #include <iostream>
#include <vector>
#include <deque>
#include <algorithm>
#include <boost/iterator/permutation_iterator.hpp>
#include <boost/cstdlib.hpp>
#include <assert.h>
int main() {
using namespace boost;
int i = 0;
typedef std::vector< int > element_range_type;
typedef std::deque< int > index_type;
... | ALGO | 0.983509 | 4.411915 |
ec3fe782-6ce4-44a9-8bc0-43ed326a86b9 | itskingdeep/todo_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.998799 | 6.776823 |
46a78b11-2760-4f7e-9b63-3bbfe7593f5b | stujbrown/AdventOfCode_2022 | days/day9.cpp | #include "day9.h"
#include "output.h"
#include <fstream>
#include <string>
#include <array>
namespace aoc
{
void Day9::run()
{
short_tail_visits_.clear();
long_tail_visits_.clear();
std::array< std::pair<int, int>, 10> rope;
rope.fill(std::pair<int, int>(0, 0));
short_tail_visits_.insert(std::pair<int, ... | ALGO | 0.981779 | 5.755787 |
781d7989-198b-4b93-919e-d36401be5c8a | gtkn/atcoder | ABC_336_F.cpp | //title
#include <bits/stdc++.h>
using namespace std;
//#include <atcoder/all>
//using namespace atcoder;
#define rep(i,n) for (ll i = 0; i < (n); ++i)
#define rep1(i,n) for (ll i = 1; i <= (n); ++i)
#define repr(i,n) for (ll i = (n)-1; i >= 0; --i)
#define rep1r(i,n) for (ll i = (n); i > 0; --i)
#define bit(n,k) ((n>>... | ALGO | 0.999916 | 4.056625 |
d26cd2c6-672b-40df-892a-bd158fc042ca | LostOracle/AOC | 2020/users/ian/08/Part1.cpp | #include <iostream>
#include <cstdio>
#include <fstream>
#include <vector>
#include <algorithm>
#include <map>
#include <tuple>
#include <cstring>
#include <functional>
#include <cctype>
#include <regex>
#include <cassert>
#include <memory>
#include <typeinfo>
#include "State.h"
#include "AuditLog.h"
#include "Operato... | ALGO | 0.995757 | 5.231449 |
c3269445-4ffd-47a8-8591-7937646ca0c8 | 071yoon/Algorithm | Daily/2022_02/2022_02_24/1253/1253.cpp | #include <unordered_map>
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
unordered_map <int, int> ump;
int cnt, num;
cin >> cnt;
for(int i = 0; i < cnt; i++){
cin >> num;
ump[num] = 1;
}
int ret = 0;
for(auto i = ump.begin(); i != um... | ALGO | 0.9992 | 3.382511 |
801509b5-023d-4e10-adbb-1b3417fc28d8 | itsvishalcodes/Leetcode-Solutions | 141-linked-list-cycle/141-linked-list-cycle.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
bool hasCycle(ListNode *head) {
if(!head) return false;
ListNode* slow = head, *fast = head->next;
while(fast an... | ALGO | 0.999727 | 5.423809 |
16f4f4c0-b171-4cd0-b103-3daa91794154 | r-forge/flr | branches/release_2.0/FLBRP/src/FLBRP.cpp | /*
* FLBRP.cpp =
*
* Author : Laurie Kell <<EMAIL>> Cefas, UK
* Last Change: 06 Mar 2009 16:01
* $Id$
*
*/
#define ADOLC_TAPELESS
#include <adouble.h>
typedef adtl::adouble adouble;
#include "FLBRP.hpp"
int RP_harvest=0,
RP_yield =1,
RP_rec =2,
R... | ALGO | 0.997799 | 5.760696 |
520a4d51-9d6d-4073-ac10-2e0d0af25c0c | AngieYi/leetcode | c++/DeleteFromLinkedList.cpp | // https://leetcode.com/problems/delete-node-in-a-linked-list/
struct ListNode {
int val;
ListNode *next;
ListNode(int x) : val(x), next(0) {}
};
class Solution {
public:
void deleteNode(ListNode* node) {
if (node == 0) return;
if (node->next == 0) {
delete node;
node = 0;
return;
... | ALGO | 0.999775 | 6.420313 |
2732e36c-f562-4225-9daf-0a7a7a7d610e | abhijit10601/Striver_SDE_QNA | Day-13_Stacks_Queues/stack_using_queue.cpp | /*
Problem Link: https://leetcode.com/problems/implement-stack-using-queues/solution/
*/
class MyStack {
public:
// IMPLEMENTATION USINIG A SINGLE QUEUE
/** Initialize your data structure here. */
queue<int> q;
MyStack() {
}
/** Push element x onto stack. */
void push(int x) {
... | ALGO | 0.99903 | 6.090681 |
cc4edf92-d474-4681-8e34-ae5e299c5751 | MamnoonSiam/polygon | sp-queries-in-path-graph/validator.cpp | #include <bits/stdc++.h>
#include "testlib.h"
using namespace std;
#define MAXN 100000
#define MAXQ 100000
#define WLIM 1000000000
#define PLIM 50
using ll = long long;
using ii = pair<int, int>;
using vi = vector<int>;
#define all(v) begin(v), end(v)
#define sz(v) (int)(v).size()
#define fi first
#define se second
... | ALGO | 0.999597 | 4.01133 |
f1edf08d-b7e3-43fb-be50-3d0a6a7bc5a7 | vityok/code-snippets | cpp/distance/distance.cpp | /// perform sanity checks on a string in a buffer. Check whether
/// std::distance results can be used instead of strlen
#include <assert.h>
#include <string.h>
#include <algorithm>
#include <iterator>
#include <string>
#include <vector>
int main(int argc, char** argv)
{
auto buff = std::vector<char>{100};
... | TEST | 0.852936 | 6.778018 |
e3ed87c4-4ab2-45e4-8f60-4988392a31d2 | Anushka23ja/CSS342-Data-Structures-Algorithms-and-Discrete-Mathematics-I | LAB2/Catalan.cpp | //The Catalan Number Problem
//Author: Anushka Chougule
#include<iostream>
using namespace std;
//function created to print catalan numbers
int catalancalculator(int value){
if(value <= 1){
return 1;
}
int final = 0;
for(int i = 0; i < value; i++){
final += catalancalculator(i) *... | ALGO | 0.999839 | 5.587184 |
0efe5fee-56d6-404e-bcbe-e3ac645eceda | RunaNam/Algorithm_old | 프로그래머스 고득점 kit/C++/카펫.cpp | #include <string>
#include <vector>
using namespace std;
vector<int> solution(int brown, int yellow)
{
vector<int> answer;
//노란색의 약수페어를 찾고, 두 값에서 +2 해서 카펫 격자 개수하고 같은지 확인.
// 두 변이 같은거까지는 굳이 필요 없어서 나감.
for (int i = 1; i * i <= yellow; i++)
{
if (yellow % i == 0)
{
int a ... | ALGO | 0.998954 | 5.32327 |
a8bfb8ee-fa9b-43b8-88ee-a64f1a45c1bf | ramalokeshreddyp/gfg-solutions | Difficulty: Basic/Odd or Even/odd-or-even.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
string oddEven(int n) {
// code here
if(n%2==0){
return "even";
}
else{
return "odd";
}
}
};
//{ Driver Code Starts.
int main() ... | ALGO | 0.999882 | 5.713896 |
0e79853f-41f4-427b-aeb3-c90522a241ae | Memo9494/Competitive_Programming_Solutions | pointers_course.cpp | #include<iostream>
using namespace std;
void sum_of_elements(int A[],int size){
int i, sum = 0;
for(i = 0; i < size;i++ ){
A[i]= 2*A[i];
}
}
int main(){
int A[] = {1,2,3,4,5};
int size = sizeof(A)/sizeof(A[0]);
sum_of_elements(A,size);
for(int i = 0; i < size-1; i++){
cout <<... | ALGO | 0.999269 | 3.568552 |
e0a1eb0f-a279-4e74-8f78-20b65fd68a1f | shakenetwork/42-1234 | src/kernelrecord.cpp | #include "kernelrecord.h"
#include "wallet.h"
#include "base58.h"
using namespace std;
bool KernelRecord::showTransaction(const CWalletTx &wtx)
{
if (wtx.IsCoinBase())
{
if (wtx.GetDepthInMainChain() < 2)
{
return false;
}
}
if(!wtx.IsTrusted())
{
retu... | TOOL | 0.928428 | 5.004024 |
6fa44c18-ad35-41f3-935b-dd4374018021 | miaoqi1224/gas03-miaoqi1224 | sumOdds.cpp | #include "arrayFuncs.h"
#include <cstdlib>
#include <iostream>
#include "utility.h"
int sumOdds(int a[], int size) {
// STUB! Replace with correct code.
int sum = 0; // Initialize sum to 0
for (int i = 0; i < size; i++) {
if (isOdd(a[i])) { // If a[i] is odd
sum += a[i];
}
}
return sum;
}
| ALGO | 0.992458 | 5.397719 |
d5d31440-e9ea-45ed-b305-b043519fdd2c | mtao/vempic | unmoved_files/vem_fluid_2d/pointwise_vem_mesh2.cpp | #include "pointwise_vem_mesh2.hpp"
#include <spdlog/spdlog.h>
#include <mtao/eigen/sparse_block_diagonal_repmats.hpp>
#include <mtao/eigen/stack.hpp>
#include <mtao/geometry/triangle_monomial_integrals.hpp>
#include <mtao/iterator/enumerate.hpp>
#include <numeric>
Eigen::SparseMatrix<double> PointwiseVEMMesh2::diverg... | ALGO | 0.998194 | 5.159939 |
c28a3423-99cd-4823-9db3-ecb2896550e5 | nimrodpar/Obfvious | llvm/lib/CodeGen/MachineLoopUtils.cpp | #include "llvm/CodeGen/MachineLoopInfo.h"
#include "llvm/CodeGen/MachineLoopUtils.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/TargetInstrInfo.h"
using namespace llvm;
namespace {
// MI's parent and BB are clones of each other. Find the equivalent ... | TOOL | 0.945518 | 7.414448 |
01efff21-777e-465a-8d07-0b67d15d9879 | Pushpendra9045/Aanlysis-and-design-of-algorithms | Binary_search.cpp | // Program to implement Binary search
#include <iostream>
using namespace std;
// Function for searching an element
int bSearch(int arr[], int n, int x)
{
int low = 0, high = n - 1;
while(low <= high)
{
int mid = (low + high) / 2;
if(arr[mid] == x)
return mid;
else if(arr[mid] > x)
high = mid - 1;
... | ALGO | 0.999791 | 5.920403 |
217f328a-4fab-4f5c-a47b-5d55d4459680 | chalkp/old-competitive | online/posnwu/PR/Graph/EX1.cpp | #include <bits/stdc++.h>
using namespace std;
struct node {
int index;
};
struct edge {
node v;
int w;
};
string names[] = {"Top", "May", "Boy", "Kim", "Gun"};
vector<edge> adj[4];
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
adj[0].push_back({1, 12});
adj[0].... | ALGO | 0.997086 | 3.728882 |
ad0c265d-e820-43cb-97b7-42bd106e7520 | hkhetawat/SCOREP_Applications | lammps/src/KSPACE/pair_tip4p_long.cpp | /* ----------------------------------------------------------------------
Contributing authors: Amalie Frischknecht and Ahmed Ismail (SNL)
simpler force assignment added by Rolf Isele-Holder (Aachen University)
------------------------------------------------------------------------- */
#include "pair_tip4p_long... | ALGO | 0.980774 | 5.544144 |
02b27711-31d6-4456-bb7c-db74dffa21a4 | kimjh7669/Algorithm | Programmers/Lv1/예산.cpp | #include <iostream>
#include <stdio.h>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int solution(vector<int> d, int budget) {
int answer = 0;
int sum = 0;
sort(d.begin(), d.end());
for(int i = 0; i< d.size(); i++){
if(sum + d[i] > budget) break;
sum += ... | ALGO | 0.99972 | 4.92011 |
6d648b88-3ca3-4467-9b69-78f91b599b5e | sukam09/algorithm | 바킹독의 실전 알고리즘/0x12강 수학/17103.cpp | #include <bits/stdc++.h>
using namespace std;
int t, n;
vector<bool> p(1000001, true);
void sieve() {
p[0] = p[1] = false;
for (int i = 2; i * i <= 1000000; i++) {
if (!p[i]) continue;
for (int j = i * i; j <= 1000000; j += i)
p[j] = false;
}
}
void solve() {
int ans = 0;
... | ALGO | 0.99972 | 5.526515 |
7ab21142-fbb3-4734-94ec-a046899599d5 | AddyaPandey/Arrays.cpp | readingBooks.cpp | #include <stdio.h>
int main()
{
int mod = (int)1e7+7;
long int n,a=0,b=1,c=2,d,i;
scanf("%ld",&n);
if(n==1 || n==2)
printf("%ld",n-1);
else{
for(i=3 ; i<=n ; i++){
d = (c * (a + b)) % mod ;
a = b;
b = d;
c++;
}
... | ALGO | 0.99996 | 3.720546 |
45b361a3-4393-44bb-87f6-35df65d0f981 | ishandutta2007/codeforces | hyperbolic/normal/1389/A.cpp | #include <stdio.h>
int main()
{
int T;
scanf("%d",&T);
while(T--)
{
int a,b;
scanf("%d%d",&a,&b);
if(2*a<=b) printf("%d %d\n",a,2*a);
else printf("-1 -1\n");
}
} | ALGO | 0.999869 | 3.983135 |
02b5d41c-7377-46bc-beb2-28059d644d1d | GuptaDivyansh26/DSA-Practice | codes/2025-01-14/Subarray Sum Equals K.cpp | // Subarray Sum Equals K
// Brute - 3 loops
// TC- O(N^3)
// SC- O(1) [No extra space]
class Solution {
public:
int subarraySum(vector<int>& nums, int k)
{
int n = nums.size();
int cnt = 0;
for (int idx = 0 ; idx < n; idx++)
{
for (int jdx = idx; jdx < n; jd... | ALGO | 0.999579 | 6.511758 |
6d0eb6ac-b81f-409e-ab29-5d32f88ff6ca | somyeong0623/JAVA_AlgorithmStudy | src/week13/programmers_TruckCrossingTheBridge/Somyeong.cpp | //모르겠어서 구글링함 ㅜㅜㅜ
#include <string>
#include <vector>
#include <queue>
using namespace std;
int solution(int bridge_length, int weight, vector<int> truck_weights) {
int answer=0; // 걸린 시간
int currentWeight=0; // 현재 도로에 올라가져있는 차 무게
queue<int> count; //도로에 올라가져 있는 차
queue<int> bridgeOn; //차마다 남은 거리
... | ALGO | 0.999954 | 5.424542 |
78b8ebfd-81e5-4e3b-8944-3aaec17c92ba | tomoakiii/atcoder2 | Archive/abc286/f.cpp | #include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
using namespace atcoder;
#define rep(i,n) for (ll i = 0; i < (n); ++i)
template<typename T> inline bool chmax(T &a, T b) { return ((a < b) ? (a = b, true) : (false)); }
template<typename T> inline bool chmin(T &a, T b) { return ((a > b) ? (a = b, true... | ALGO | 0.999753 | 4.431425 |
12cbc91a-f491-419b-bef9-51510ec6c452 | ArafatBytes/CSE-4304_220041146 | Lab 12/dummy.cpp | #include <bits/stdc++.h>
using namespace std;
struct Node
{
int distance;
int predecessor;
char color;
};
void printAdjList(const unordered_map<int, vector<int>> &adj)
{
cout << "Adjacency list:\n";
for (const auto &[node, neighbors] : adj)
{
cout << node << ": ";
for (int neig... | ALGO | 0.999953 | 5.708587 |
c6a58720-a174-445c-b263-b3b96f19ea42 | raincross7/code-similarity | codes/train_code/problem003/problem003_405.cpp | #include <iostream>
#include <vector>
#include <string.h>
#include <algorithm>
#include <cstring>
#include <queue>
#include <assert.h>
#include <cmath>
#include <deque>
#include <set>
#include <unordered_map>
#include <complex>
#include <fstream>
#include <map>
#include <numeric>
#include <functional>
using namespace s... | ALGO | 0.998706 | 3.413912 |
fee86970-bc5e-4e79-80be-9ab8d588ea8b | geoffgeorgein/CP | 1/number_spiral.cpp | #include<bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define rall(x) x.rbegin(),x.rend()
#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define F first
#define S second
#define ll ... | ALGO | 0.999857 | 4.272679 |
a275a74e-5bf1-4e24-ab07-c8527be94971 | vfolunin/archives-solutions | Kattis/classrooms.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <string>
using namespace std;
bool compare(pair<int, int> &a, pair<int, int> &b) {
return a.second < b.second;
}
int main() {
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
int seg... | ALGO | 0.999969 | 4.62817 |
240efd8e-95c1-438d-a784-f2ba2d159a45 | nguyenvantu11052002/CPP | CPP0101 - TÍNH TỔNG 1 ĐẾN N.cpp | #include<iostream>
#include<math.h>
#include<iomanip>
using namespace std;
void inraketqua(){
long long n, sum = 0;
cin >> n;
sum = (n*(n + 1))/2;
cout << sum << endl;
}
int main(){
int k;
cin >> k;
while(k--){
inraketqua();
}
return 0;
}
| ALGO | 0.999483 | 4.4465 |
a6a0fccd-3bdf-4a06-b5de-fc671cea5ebd | sirparashar/Dsa_Solutions | 57-insert-interval/insert-interval.cpp | class Solution {
public:
void merge(vector<vector<int>>& temp, vector<vector<int>>& res) {
res.push_back(temp[0]);
for(int i = 1; i < temp.size(); i++) {
if(res.back()[1] >= temp[i][0]) {
res.back()[1] = max(res.back()[1], temp[i][1]);
} else {
... | ALGO | 0.999992 | 6.346512 |
21ca8fce-c549-49bf-a0d0-053d80cb9c8e | splucs/Competitive-Programming | Live Archive/2015 ACM ICPC Asia Changchun Regionals/G.cpp | #include <bits/stdc++.h>
using namespace std;
#define MAXN 109
#define EPS 1e-9
struct point {
double x, y;
point() { x = y = 0.0; }
point(double _x, double _y) : x(_x), y(_y) {}
double norm(){
return hypot(x, y);
}
point normalized(){
return point(x,y)*(1.0/norm());
}
double angle(){ return atan2(y, x); }... | ALGO | 0.99983 | 4.029488 |
88afb43c-ae52-432d-8152-43314af9810b | siddiq2604/GFG-Problems | Basic/Flying Jet/flying-jet.cpp | //{ Driver Code Starts
//Initial Template for C++
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
//User function Template for C++
class Solution{
public:
long long int Nth_mileSpeed(int n){
// Code here
if(n%2==0)
return 7*pow(3,(n/2)-1);
else
ret... | ALGO | 0.999536 | 5.276042 |
a143d9c5-336f-40c2-8fc9-0280ae867be3 | ishandutta2007/codeforces | tanphatls987/normal/490/A.cpp | #include <algorithm>
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <deque>
#include <vector>
#include <queue>
using namespace std;
#define X first
#define Y second
#define INPUT freopen(".inp","r",stdin)
#define OUTPUT freopen(".out","w",stdout)
#define FOR(i,l... | ALGO | 0.999729 | 3.082831 |
90c55b8d-3ec9-40d4-b711-fd968c850400 | harcomia/Harcomia-core | src/addrman.cpp | #include "addrman.h"
#include "hash.h"
#include "serialize.h"
#include "streams.h"
using namespace std;
int CAddrInfo::GetTriedBucket(const uint256& nKey) const
{
uint64_t hash1 = (CHashWriter(SER_GETHASH, 0) << nKey << GetKey()).GetHash().GetLow64();
uint64_t hash2 = (CHashWriter(SER_GETHASH, 0) << nKey << ... | TOOL | 0.929733 | 6.59934 |
faad80b9-a828-4919-ae62-ccb03f217e17 | rishab1128/LeetCode-Problems | 4-median-of-two-sorted-arrays/4-median-of-two-sorted-arrays.cpp | class Solution {
public:
//Binary Search Solution
//TC: O(log(min(n1,n2))) SC : O(1)
double findMedianSortedArrays(vector<int>& a, vector<int>& b)
{
if(a.size()>b.size())
swap(a,b);
int n1 = a.size() , n2 = b.size() , tot = (n1+n2+1)/2;
int low = 0 , high = n1;... | ALGO | 0.999954 | 5.651393 |
49eacd26-6ba6-4ec2-bd0e-11aba4cea1d2 | Nullray/ICT | software/workload/firesim/host/firesim-lib/lib/boost/libs/compute/example/opengl_sphere.cpp | #include <iostream>
#include <algorithm>
#include <GL/gl.h>
#include <vtkActor.h>
#include <vtkCamera.h>
#include <vtkgl.h>
#include <vtkInteractorStyleSwitch.h>
#include <vtkMapper.h>
#include <vtkObjectFactory.h>
#include <vtkOpenGLExtensionManager.h>
#include <vtkOpenGLRenderWindow.h>
#include <vtkProperty.h>
#inc... | TOOL | 0.860106 | 6.576921 |
ae66197b-564e-401c-90fc-50e39e6c9927 | MohdAqib8267/6-Companies_30_days_Challenges | 0274-h-index/0274-h-index.cpp | class Solution {
public:
// Approach
// 1.H-index is at least 'cnt' paper being cited 'cnt' times
// 2.sort the vector, then count from the end of the vector
// 3.whenever citations[i] > cnt, add the counter
int hIndex(vector<int>& citations) {
int cntH=0;
int n=citations.size();
sort(ci... | ALGO | 0.999959 | 6.333633 |
b98d3f6a-a552-4bdb-bacb-6f5b1cf56230 | nunberty/au-fall-2014 | algo/contests/3/find3/find3.cpp | #include <fstream>
#include <vector>
#include <iostream>
#include <algorithm>
uint32_t count(const std::vector<int32_t> &nums, int32_t l, int32_t r)
{
auto low = std::lower_bound(begin(nums), end(nums), l);
auto up = std::upper_bound(begin(nums), end(nums), r);
return up - low;
}
int main()
{
std::ios... | ALGO | 0.999865 | 4.613782 |
afd3ab99-9d31-40ab-b06f-4b2dfddaf17e | Prince-Choudhury/LeetCode-Daily-Challenge | 16_DAY16_Linked_List_Cycle.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
bool hasCycle(ListNode *head) {
map<ListNode*, bool> table;
ListNode* temp = head;
while(temp != NULL){
... | ALGO | 0.999908 | 5.191059 |
cce751c7-8a5f-4646-b0fe-6ca762b44c6f | vishal1844/leetcode | 1669-merge-in-between-linked-lists/1669-merge-in-between-linked-lists.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* mergeInBetw... | ALGO | 0.999986 | 5.009057 |
10fa1f44-1864-48c2-9406-56d0e4738465 | kolpo0210/Hackerrank | C++ solutions/Inherited Code.cpp | #include <iostream>
#include <string>
#include <sstream>
#include <exception>
using namespace std;
class BadLengthException {
private:
int n;
public:
BadLengthException(int errornumber) {
n = errornumber;
}
int what() {
return n;
}
};
bool ... | ALGO | 0.998496 | 4.368464 |
ba78031c-eb9d-4e8e-bf49-b92d604fb10b | abdullahutem/tt | 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.