uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
f201a20a-badf-414d-b72f-235bc52bd788 | devenderpahadia/LeetcodeSolutions | 230-kth-smallest-element-in-a-bst/230-kth-smallest-element-in-a-bst.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.999998 | 6.096972 |
7170c970-1d5a-4fe8-a07d-9bd7f9bee6ef | williamwill1860/opencv_test | opencv/samples/cpp/tutorial_code/features2D/feature_description/SURF_matching_Demo.cpp | #include <iostream>
#include "opencv2/core.hpp"
#ifdef HAVE_OPENCV_XFEATURES2D
#include "opencv2/highgui.hpp"
#include "opencv2/features2d.hpp"
#include "opencv2/xfeatures2d.hpp"
using namespace cv;
using namespace cv::xfeatures2d;
using std::cout;
using std::endl;
const char* keys =
"{ help h | ... | ALGO | 0.969398 | 5.63767 |
58ab7c0d-da33-4e50-964d-b78e641f0653 | YYC-CYY/Practice_of_Programming | 2020_03_31_C++11/MyBitset.cpp | #include <iostream>
#include <cstring>
using namespace std;
template <int bitNum>
struct MyBitset
{
char a[bitNum/8+1];
MyBitset() { memset(a,0,sizeof(a));};
void Set(int i,int v) {
char & c = a[i/8];
int bp = i % 8;
if( v )
c |= (1 << bp);//乘以2^bp,将c的第bp+1位变为1,其他位不变
else
c &= ~(1 << bp);//乘以2^bp,第b... | ALGO | 0.997191 | 3.173465 |
24efe8ef-e235-4876-8fa7-b74d1935ccb9 | shurik111333/spbu | olympic/classwork/13.11.15_graph_part2/ProjectB/main.cpp | #include <iostream>
#include <fstream>
#include <cstring>
using namespace std;
int first[210000] = {}, next1[410000] = {}, val[410000] = {};
int used[210000] = {}, pow[210000] = {}, topSort[210000] = {};
int countVal = 0;
bool isFind = false;
ofstream fout("topsort.out");
void add(int a, int b)
{
countVal++;
... | ALGO | 0.999989 | 4.272311 |
712a0bd9-8a40-4949-b9f7-237bc9b9f6b5 | rohitb2310/FacePrep360 | Collatz problem.cpp | /*
Collatz problem
The rules for generating Collatz sequence are: If n is even: n = n / 2 If n is odd: n = 3n + 1 For example, if the starting number is 5 the sequence is: 5 -> 16 -> 8 -> 4 -> 2 -> 1 It has been proved for almost all integers, that the repeated application of the above rule will result in a sequence t... | ALGO | 0.999985 | 5.089485 |
f28fc032-970b-413e-9cec-3fab528be0a3 | paridhigulati/LeetCode | 2261-k-divisible-elements-subarrays/2261-k-divisible-elements-subarrays.cpp | class Solution {
public:
int countDistinct(vector<int>& nums, int k, int p) {
int n=nums.size();
set<vector<int>>ans;
int i,j;
for(i=0;i<n;i++)
{
vector<int>tt;
int ct=0;
for(j=i;j<n;j++)
{
tt.push_back... | ALGO | 0.999812 | 5.017189 |
18163505-56e2-455b-b517-53d86b979cbe | satishrdd/comp-coding | codeforces/732-A/732-A-21547570.cpp | #include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int main(int argc, char const *argv[])
{
/* code */
int k,r;
cin>>k>>r;
int u =k%10;
int res=1;
while(true){
if(u==0||u==r){
cout<<res<<endl;
break;
}
u+=k;
u%=10;
res++;
}
return 0;
} | ALGO | 0.999629 | 3.184892 |
38683784-c62c-4f77-abc9-e626838fd0db | FranklinJie/acquaintance-CPP | 源.cpp | #include<iostream>
using namespace std;
int f(int x)
{
if (x == 1)
return 1;
else
if (x == 2)
return 2;
else
return f(x - 1) + 2 * f(x - 2);
}
int main()
{
cout << "2022110957Ľ" << endl;
cout << "еţ";
int x;
cin >> x;
cout << "еĵ" << x << "Ϊ" << f(x) << endl;
system("pause");
return 0;
}
| ALGO | 0.999881 | 3.41435 |
a1fe9b54-74d7-4864-b379-82432e7d0fe1 | RevealMind/itmo | algorithms_and_data_structures/term_1/lab_1/f.cpp | #include<bits/stdc++.h>
int minI,minJ;
int n , _n;
std :: vector <int> a(100000), b(100000);
void solve()
{
int min = abs(a[0]-b[0]);
int i = 0, j =0;
minI = i;
minJ = j;
while(i < n && j <_n)
{
int x = a[i]-b[j];
if(abs(x) < min)
{
min = abs(x);
m... | ALGO | 0.99999 | 3.319263 |
06624338-e63b-4858-b8c5-5d1fd62a75fe | voronoi/RuleRunner | main.cpp | /*
* File: RuleRunner.cpp
* Author: Adi
*
* Created on December 14, 2015, 12:17 PM
*/
#include <cstdlib>
#include <iostream>
#include <iterator>
using namespace std;
class rule {
private:
int integerArray[100], arrayIndex, ruleCheck = 0, NumberOfRules = 3;
public:
bool RunTests(int* input, int arraySize)
{
co... | TEST | 0.86815 | 5.126409 |
c4677a26-2957-4826-840f-75626cc4c595 | ishandutta2007/codeforces | y0105w49/normal/868/A.cpp | // ayy
// ' lamo
#include <bits/stdc++.h>
#include <bits/extc++.h>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld; //CARE
typedef complex<ld> pt;
#define fi first
#define se second
#define pb push_back
const ld eps=1e-8;
const int inf=1e9+99;
const ll linf=1e18+99;
const i... | ALGO | 0.999987 | 3.98255 |
febb1407-c024-4e8d-a4e9-336e14602b23 | sarvex/leetcode-fish | solution/1700-1799/1744.Can You Eat Your Favorite Candy on Your Favorite Day/Solution.cpp | using ll = long long;
class Solution {
public:
vector<bool> canEat(vector<int>& candiesCount, vector<vector<int>>& queries) {
int n = candiesCount.size();
vector<ll> s(n + 1);
for (int i = 0; i < n; ++i) s[i + 1] = s[i] + candiesCount[i];
vector<bool> ans;
for (auto& q : que... | ALGO | 0.99995 | 5.650021 |
1394e274-744e-4699-8075-05eca000730d | nettee/leetcode | solutions/0780.max-chunks-to-make-sorted/0780.max-chunks-to-make-sorted.1569136260.cpp | class Solution {
public:
int maxChunksToSorted(vector<int>& arr) {
if (arr.empty()) {
return 1;
}
int N = arr.size();
// left_max[i] = max value in arr[0..i)
vector<int> left_max(N, 0);
// right_min[j] = min value in arr[j..N)
vector<int> ... | ALGO | 0.999993 | 5.804837 |
5ac5780d-2b83-4267-8b0c-d4f15d2463ca | optimisticlucifer/SolvedLeetcodeProblemByMe | 2352-equal-row-and-column-pairs/2352-equal-row-and-column-pairs.cpp | class Solution {
public:
int equalPairs(vector<vector<int>>& grid) {
int n = grid.size();
int count = 0;
map<vector<int>, int> mp;
//1
for(int row = 0; row < n; row++) {
mp[grid[row]]++;
}
... | ALGO | 0.999972 | 6.237268 |
19d41376-0e3b-4638-8bdb-74b6cd1d365a | CharlzKlug/using_cpp | 04/166_tasks/01/main.cpp | #include <iostream> // Для std::cin
int main () {
int temp;
while (std::cin >> temp) {
std::cout << temp << '\n';
}
return 0;
}
| TOOL | 0.912373 | 4.144608 |
58afdba5-d63a-406c-a3a1-9f3b6b27413c | ascholerChemeketa/cs260Code-201920 | Week06/CharBSTCopyRemove/CharBST.cpp | #include "CharBST.h"
#include <iostream>
#include <stdexcept>
using namespace std;
///----------------------CON/DE STRUCTORS----------------------------
CharBST::CharBST() {
root = nullptr;
}
//Helper used by destructor and assignment operator
void deleteSubTree(BSTNode<char>* startNode) {
if(startNode == nu... | ALGO | 0.935558 | 5.801749 |
327d48ff-c337-4ab7-acee-8b2fb42b5fd2 | ishandutta2007/codeforces | yuma_/normal/1239/D.cpp | #include "bits/stdc++.h"
#include<vector>
#include<iostream>
#include<queue>
#include<algorithm>
#include<map>
#include<set>
#include<iomanip>
#include<assert.h>
#include<unordered_map>
#include<unordered_set>
#include<string>
#include<stack>
#include<complex>
#pragma warning(disable:4996)
using namespace std;
using ld... | ALGO | 0.999944 | 4.409986 |
170934de-acd7-4dc6-ac62-bae51235c0fb | Aaryan004/CPP | Fibonacci(DP).cpp | #include <iostream>
using namespace std;
int fib_helper(int n, int* ans){
if(n<=1) return n;
if(ans[n]!=-1){
return ans[n];
}
ans[n]= fib_helper(n-1,ans)+fib_helper(n-2,ans);
return ans[n];
}
//
int fib(int n){
int *ans=new int[n+1];
for(int i=0;i<=n;i++){
ans[i]=-1;
}
return fib_helper(n,ans);
}
//Dyn... | ALGO | 0.999956 | 5.234771 |
a29102b6-20fb-4199-aa45-6d816a0190ca | albertec1/Development | Physics2_class1_handout/Box2D/Box2D/Collision/Shapes/b2EdgeShape.cpp | #include <Box2D/Collision/Shapes/b2EdgeShape.h>
#include <new>
void b2EdgeShape::Set(const b2Vec2& v1, const b2Vec2& v2)
{
m_vertex1 = v1;
m_vertex2 = v2;
m_hasVertex0 = false;
m_hasVertex3 = false;
}
b2Shape* b2EdgeShape::Clone(b2BlockAllocator* allocator) const
{
void* mem = allocator->Allocate(sizeof(b2EdgeSh... | ALGO | 0.938446 | 7.680163 |
d790748f-07ac-4a95-956c-55125b4a9e0b | diserus/SAOD-labs | lab22/main.cpp | #include <iostream>
#include <iomanip>
struct vertex
{
int Data;
vertex *Left = nullptr;
vertex *Right = nullptr;
short int balance = 0;
};
void work(vertex *p)
{
if (p != nullptr)
{
work(p->Left);
std::cout << p->Data << " ";
work(p->Right);
}
}
int max(int a, int b)... | ALGO | 0.999935 | 4.323437 |
8e093412-c6fe-4929-9412-1ac05c790449 | fullon-labs/fullon.shard | libraries/chain/fork_database.cpp | #include <eosio/chain/fork_database.hpp>
#include <eosio/chain/exceptions.hpp>
#include <boost/multi_index_container.hpp>
#include <boost/multi_index/member.hpp>
#include <boost/multi_index/ordered_index.hpp>
#include <boost/multi_index/hashed_index.hpp>
#include <boost/multi_index/mem_fun.hpp>
#include <boost/multi_in... | TOOL | 0.947179 | 7.478959 |
17837796-0d39-44e1-9f16-7b88fd406ef6 | G3rkul3s/MultiLeap-Computer-Animation-Lab | eigen-3.4.0/bench/perf_monitoring/gemm.cpp | #include "gemm_common.h"
EIGEN_DONT_INLINE
void gemm(const Mat &A, const Mat &B, Mat &C)
{
C.noalias() += A * B;
}
int main(int argc, char **argv)
{
return main_gemm(argc, argv, gemm);
}
| ALGO | 0.970917 | 5.244571 |
5a5e70da-d493-4857-94cb-aaf87f6735f5 | Fezaan/Leetcode | 0064-minimum-path-sum/0064-minimum-path-sum.cpp | class Solution {
public:
int f(int i, int j, vector<vector<int>>& grid, vector<vector<int>>& dp){
if(i==0 && j==0) return grid[0][0];
if(i<0 || j<0) return INT_MAX;
if(dp[i][j]!=-1) return dp[i][j];
int l=f(i,j-1,grid,dp);
int u=f(i-1,j,grid,dp);
return dp[i][j... | ALGO | 0.999985 | 6.030462 |
4ba161b1-2172-4cda-914f-3852b6d8237d | rhamstengel/GeeksforGeeks | Easy/Find duplicates in an array/find-duplicates-in-an-array.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
vector<int> duplicates(long long int a[], int n) {
vector<int> result;
// Incrementing the value at indices
for (int i = 0; i < n; i++) {
a[a[i] % n] = a[a[i] % ... | ALGO | 0.999247 | 5.790367 |
fe833a63-8a67-4a17-82c1-40c20ab10a87 | alexandraback/datacollection | solutions_6404600001200128_1/C++/kenning9/a.cpp | #include<cstdio>
#include<iostream>
using namespace std;
int n, TC, p[100000];
int mthchoice(){
int ans = 0;
for(int i = 1; i < n; ++i){
ans += max(0, p[i-1] - p[i]);
}
return ans;
}
int mthconstant(){
int ans = 0, dec = 0;
for(int i = 1; i < n; ++i) dec = max(dec, p[i-1] - p[i]);
for(int i = 1; i < n; ++i){
... | ALGO | 0.998936 | 3.52027 |
09f794cc-1305-4d71-a752-9594473f2366 | boomzero/XMOJ | 1000-1999/1808.cpp | #include <bits/stdc++.h>
#define int long long
using namespace std;
int n;
int a[100005], in[100005], tmp[100005];
int lb(int x) {
return x & (-x);
}
signed main() {
memset(a, 0, sizeof(a));
scanf("%d", &n); // NOLINT(*-err34-c)
int ans = 0;
for (int i = 1; i <= n; ++i) {
scanf("%d", &in[i... | ALGO | 0.999858 | 4.405197 |
ad277b84-a922-43c6-980a-b1f5d8ba2a33 | sampritipanda/IOI_Repository | SPOJ/GSS3.cpp | #include <cstdio>
#include <algorithm>
#include <climits>
using namespace std;
struct node {
int l_sum = 0, r_sum = 0, sum = 0, ans = INT_MIN;
bool empty = false;
};
node segtree[200004];
int P[50001];
node empty_node() {
node N;
N.empty = true;
return N;
}
node merge(node L, node R) {
if(L.empty) retu... | ALGO | 0.999947 | 5.17408 |
74d74d46-4c90-4262-8870-e650aac47c26 | caskater4/libntfslinks | libntfslinks/source/StringUtils.cpp | #include "StringUtils.h"
#include <strsafe.h>
int StrFind(LPCTSTR Str, LPCTSTR Sub, int StartIdx, int Dir)
{
int result = -1;
// Grab the length of the string to search
size_t StrLength;
if (FAILED(StringCchLength(Str, MAX_PATH, &StrLength)) || StrLength == 0)
{
return result;
}
// Grab the length of the s... | TOOL | 0.950249 | 5.56249 |
79636329-966f-436a-a56b-ee2cfa0c8ec0 | sohardforaname/ACM_ICPC_practice | codeforces/1425/A.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1e5 + 5;
void solve()
{
ll n;
scanf("%lld", &n);
ll ans = 0;
bool f = 1;
while (n)
{
if (n % 2)
{
if (f)
ans += 1;
n -= 1;
}
else if (n % 4 ||... | ALGO | 0.99972 | 4.465334 |
5a5ee16b-cf87-4c1d-8729-d33983ead6f4 | OscarRexid/PP | libraries/eigen-3.4.0/doc/examples/TutorialLinAlgRankRevealing.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main()
{
Matrix3f A;
A << 1, 2, 5,
2, 1, 4,
3, 0, 3;
cout << "Here is the matrix A:\n" << A << endl;
FullPivLU<Matrix3f> lu_decomp(A);
cout << "The rank of A is " << lu_decomp.rank() << endl;
c... | ALGO | 0.999833 | 3.720849 |
5c97c70c-c193-457a-84a5-e829183f4382 | Merisho/comprog | codeforces/round-643-div-2/a.cpp | #include <bits/stdc++.h>
using namespace std;
long long mind(long long a) {
long long m = 10;
while (a != 0) {
m = min(m, a % 10);
a /= 10;
}
return m;
}
long long maxd(long long a) {
long long m = 0;
while (a != 0) {
m = max(m, a % 10);
a /= 10;
}
return m;
}
int main() {
int T;
cin >> T;
... | ALGO | 0.999902 | 3.90643 |
00acdb9b-4359-4017-8f05-9e56306a8c6a | nikhilmantri99/Interviewbit-questions-solution | backtracking/target.cpp | #include <bits/stdc++.h>
#include <iostream>
using namespace std;
void print_vector(vector <int> &x){
for(int i=0;i<x.size();i++){
cout<<x[i]<<" ";
}
cout<<endl;
}
void update_answer(vector<vector<int>> &ans, vector <int> &temp,vector <int> &A,int lowerlim, int upperlim, int target){
if(target<0){
return;
}... | ALGO | 0.999919 | 4.17017 |
8edb9623-1f9b-421f-97ef-a7251437df8f | kash1sh/practice_ques_cp | B_Ternary_String.cpp | // #include <bits/stdc++.h>
// #define REP(i, n) for (int i = 1; i <= n; i++)
// #define mod 1000000007
// #define pb push_back
// #define ff first
// #define ss second
// #define ii pair<int, int>
// #define vi vector<int>
// #define vii vector<ii>
// #define lli long long int
// #define INF 1000000000
// #define endl... | ALGO | 0.999926 | 5.203907 |
f9f2cdfb-648a-4459-ad23-b9bf03ed680f | sinkyoungdeok/Algorithm | boj_code/10900/10992.cpp | #include <iostream>
#include <algorithm>
using namespace std;
int main()
{
int n;
cin >> n;
for (int i = 1; i <n; i++)
{
for (int j = n - i; j > 0; j--)
cout << " ";
cout << "*";
for (int j = (i - 2) * 2 + 1; j > 0; j--)
cout << " ";
if(i!=1)
cout << "*";
cout << endl;
}
for (int i = n * 2 - ... | ALGO | 0.999932 | 3.569878 |
4ed95b70-5c51-488b-bb38-f794c884e621 | HassnHamada/CP-Solutions | 1747B.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 2e5 + 10, M = 3, L = 30, MOD = 1e9 + 7, HV = 151, INF = 0x3f3f3f3f;
void run()
{
int n;
scanf("%d", &n);
printf("%d\n", (n + 1) / 2);
int l = 1, h = n;
while (l <= h)
{
printf("%d %d\n", (l - 1) * 3 + 1, h... | ALGO | 0.999671 | 3.974835 |
a1693644-3416-4187-a07e-db20f6ad4a5f | sanju784/DS-Algo_Questions | 3. Stack/7.cpp | /*********************************************
*
* Reverse a Stack using only Push and Pop
*
*/////////////////////////////////////////////
#include <iostream>
#include <stack>
using namespace std;
/**
* Take a global Stack.
* All changes will be reflected to it.
*/
stack<int> s;
void insertAtBottom(int item) {... | ALGO | 0.999342 | 5.635901 |
001b36c4-217a-4dbe-9c7d-7eafcbf46d71 | Esrappelt/PAT-AdvancedLevel | 1095Cars on Campus/main.cpp | #include <bits/stdc++.h>
using namespace std;
struct node
{
int flag,time;
string name;
};
bool cmp1( const node &a,const node &b) { return a.name != b.name ? a.name < b.name : a.time < b.time; }
bool cmp2( const node &a,const node &b) { return a.time < b.time; }
int main()
{
map<string,int> ans;
vector... | ALGO | 0.999776 | 3.849481 |
2bd2319f-edb6-4937-a63b-854bd4da40f6 | dhirajpatil2346/cf500in100challenge | 1700/mysterious.cpp | #include <bits/stdc++.h>
using namespace std;
#define LL long long
#define endl "\n"
// int f(int ind, vector<pair<int, int>> &vp, vector<int> &dp)
// {
// if (ind == vp.size())
// return 0;
// // don't take
// int ret = f(ind + 1, vp, dp);
// ret = max(ret, 1 + f(upper_bound(vp.begin(), vp.end... | ALGO | 0.999989 | 3.723611 |
5b788a9c-c449-4eb0-b566-4956989e9957 | nhatrongbp/DSA_codePTIT | demsobit1.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
/*
level 1 return luon
level 2: node giua la node 2
level 3: node giua la node 4
level 4: node giua la node 8
...
level n: node giua la node 2^(n-1)
1 level: toi da 1 node la
2 level: toi da 3 node la
3 level: toi da 7 node la
4 level: toi da 15 node l... | ALGO | 0.999697 | 3.452362 |
aeef7180-3b43-4b17-b0c8-dee8e5a7d4c2 | vinay-kumar99/Hactoberfest2022 | HackerRank/Inherited Code (C++ Solutions).cpp | #include <iostream>
#include <string>
#include <sstream>
#include <exception>
using namespace std;
/* Define the exception here */
class BadLengthException {
private:
int n;
public:
BadLengthException(int errornumber) {
n = errornumber;
}
int what() {return n;}... | ALGO | 0.9955 | 4.31867 |
c517f6a9-3483-4bde-947c-8b4638dfc1ff | hosenarafat/Codeforces-Problems-Solution | 1359B.cpp | //! Bismillahi-Rahamanirahim.
/** ========================================**
** @Author: Md. Abu Farhad ( RUET, CSE'15)
** @Category:
/** ========================================**/
#include<bits/stdc++.h>
#include<stdio.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
using namespace std;
#defin... | ALGO | 0.999671 | 3.572465 |
78c867d2-ec13-4de8-8d29-d0a668435ec3 | Anurag319/LeetCode | 2423-remove-letter-to-equalize-frequency/2423-remove-letter-to-equalize-frequency.cpp | class Solution {
public:
bool equalFrequency(string word) {
int n = word.size();
vector<int> freq(26,0);
// a--> 1 b--> 1 c--> 2
for(int i=0;i<n;i++){
freq[word[i]-'a']++;
}
for(int i=0;i<n;i++){
... | ALGO | 0.999928 | 5.686307 |
23f39bb3-fed0-4131-8968-fa29a3660fe4 | Sofiullah-Iqbal-Kiron/CPP-Program-Files | AtCoder/AtCoder Beginner Contest 153/D - Caracal vs Monster.cpp | #include<iostream>
#include<math.h>
using namespace std;
int main()
{
long int H, k=0;
int i;
cin >> H;
for(i=1; i<H; i++)
{
k+=(pow(2, i-1));
}
cout << k << endl;
}
| ALGO | 0.999886 | 3.676732 |
18ce04ed-8686-4af9-897f-f3a99d9d8140 | GaisaiYuno/OI-Record-exe-deleted | Grade 10-12/2018 autumn/NOIP/NOIP2018提高组Day1程序包/GD-Senior/answers/GD-0250/track/track.cpp | #include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
struct vn{
int x,y,l;
}v[50009];
int n,m,c1=1,c2=1;
bool cmp1(vn x,vn y){
return(x.l>=y.l);
}
int main(){
freopen("track.in","r",stdin);
freopen("track.out","w",stdout);
scanf("%d%d",&n,&m);
for(int i=1;i<n;i++){
scanf("%d%d%d",&v[i].... | ALGO | 0.999957 | 3.492424 |
4a455dc9-d217-4715-a5c2-33872bad0565 | virtyaluk/leetcode | problems/1818/solution.cpp | typedef long long int ll;
const int MOD = 1000000007;
class Solution {
public:
int minAbsoluteSumDiff(vector<int>& nums1, vector<int>& nums2) {
ll ans = 0, dif = 0;
set<int> s(begin(nums1), end(nums1));
for (int i = 0; i < nums1.size(); i++) {
ll cur = abs((ll) nums1[i... | ALGO | 0.999976 | 5.806655 |
48f7836b-36ee-4834-8961-eb2a67473ca4 | Sinchy/MATLAB | 2_Data_Extraction/4_3DTracking/Micro_bubble_tracking/codegen/lib/BubbleCenterAndSize/regionprops.cpp | // Include files
#include "regionprops.h"
#include "BubbleIdentifier.h"
#include <cmath>
// Function Declarations
static void ComputePixelList(const double imageSize[2], coder::array<b_struct_T,
1U> &stats, struct_T *statsAlreadyComputed);
static int div_s32(int numerator, int denominator);
// Function Definitions
... | ALGO | 0.99039 | 7.035009 |
ec686f2b-cb93-43a0-8511-7ee8b096cf46 | manavvinayak/cpp_programs | Problems/3sum.cpp | #include <iostream>
#include <vector>
using namespace std;
int main() {
vector<int> nums = {-1,0,1,2,-1,-4};
int n = nums.size();
for(int i=0; i< (n-2); i++) {
for(int j=i+1; j < (n-1); j++ ) {
for(int k = j+1; k < n; k++) {
if( nums[i] + nums[j] + nums[k] == 0) {
... | ALGO | 0.999143 | 4.3712 |
1b901613-aa53-44bb-9a67-5dcdf9791552 | OpenPrinting/splix | src/compress.cpp | #include "compress.h"
#include <math.h>
#include <string.h>
#include "page.h"
#include "band.h"
#include "errlog.h"
#include "request.h"
#include "bandplane.h"
#include "algo0x0d.h"
#include "algo0x0e.h"
#include "algo0x11.h"
#include "algo0x13.h"
#include "algo0x15.h"
static bool _isEmptyBand(unsigned char* band, un... | ALGO | 0.998098 | 4.307054 |
8c9eca3e-c2ae-4f4b-9d65-82c4b683db45 | Itsrajsk/DSA-In-Cpp-From-Scratch | Heap/Min-Cost-Of-Ropes.cpp | // Min Cost Of Ropes
#include <iostream>
#include <queue> // Include the priority_queue header
#include <vector>
using namespace std;
long long minCost(long long arr[], long long n)
{
// Priority queue declaration with proper comparison function
priority_queue<long long, vector<long long>, greater<long long>>... | ALGO | 0.999992 | 5.707922 |
800528de-a6d2-4574-8110-c0b8af1eefd4 | Fly0307/dtee_ncnn_face_recognition | src/host/secure/secure_include/ncnn.x64/layer/riscv/crop_riscv.cpp | #include "crop_riscv.h"
#if __riscv_vector
#include <riscv_vector.h>
#endif // __riscv_vector
#include "riscv_usability.h"
namespace ncnn {
Crop_riscv::Crop_riscv()
{
#if __riscv_vector
support_packing = true;
#if __riscv_zfh
support_fp16_storage = true;
#endif
#endif // __riscv_vector
#if NCNN_BF16
su... | DATA | 0.900294 | 6.302158 |
667086d1-ee5d-40a8-a325-1762705b1803 | Aayush2492/Codeforces-Problems | Live/23-12-2023/C.cpp | #include <bits/stdc++.h>
using namespace std;
using LLI = long long int;
template <typename T>
using VEC = vector<T>;
template <typename T>
using VV = VEC<VEC<T>>;
template <typename T>
using PTT = pair<T, T>;
#define FOR(i, n) for (int i = 0; i < n; i++)
#define ROF(i, n) for (int i = n - 1; i >= 0; i--)
templat... | ALGO | 0.998608 | 3.043923 |
40636eb2-8a5a-4ee7-afb8-9ffc8053e9df | Saperz4002/ICPC_prep | Basics/journey.cpp | #include <bits/stdc++.h>
using namespace std;
void solve(){
long long n, a, b, c; cin >> n >> a >> b >> c;
vector<long long> nums;
long long N = a + b + c;
nums.push_back(a);
nums.push_back(b);
nums.push_back(c);
int cont = 3*(n/N);
n -= N*(n/N);
int i = 0;
while(n>0){
... | ALGO | 0.999899 | 4.191328 |
663b8d89-48ec-4c86-82b1-2e22046f044c | susanka068/UVa-submissions | 11805 - Bafana Bafana.cpp | /*******************************************
Author : Susanka Majumder (bingobong)
*******************************************/
#include <bits/stdc++.h>
using namespace std;
int main()
{
int test=1,t;
cin>>t;
while(t--)
{
int n,k,p,res;
cin>>n>>k>>p;
res = (k+p)%n;
... | ALGO | 0.999424 | 3.346276 |
c30e33c2-ae7d-4f0e-a434-8e05e44c95ce | MAA1117/DSA | cses/geometry/05_lattice_pts/05_lattice_pts_fastest.cpp | // https://cses.fi/problemset/task/2193
#include "timer.h"
#include <algorithm>
#include <stdio.h>
using namespace std;
typedef long long ll;
static inline ll getint() {
int x, y, m = 1;
while ((x = getchar_unlocked()) < '-') {
}
if (x == '-') {
m = -1;
x = 0;
} else {
x -= '0';
}
while ((y ... | ALGO | 0.999843 | 4.939623 |
c94d2cea-00bd-40a3-af4d-75beb9d5beee | KKyzm/leetcode | cpp/0319.bulb-switcher/solution.cpp | // Created by Yaniru at 2023/11/02 01:01
// leetgo: dev
// https://leetcode.cn/problems/bulb-switcher/
#include "LC_IO.h"
#include <bits/stdc++.h>
#include <cmath>
#include <math.h>
using namespace std;
// @lc code=begin
class Solution {
public:
int bulbSwitch(int n) { return sqrt(n + 0.5); }
};
// @lc code=end
... | ALGO | 0.999912 | 5.494352 |
4b5201ea-556e-4553-95fd-fbe0f7db4476 | AlignmentResearch/KataGo-custom | cpp/book/book.cpp |
#include "../book/book.h"
#include <fstream>
#include <thread>
#include "../core/makedir.h"
#include "../core/fancymath.h"
#include "../core/fileutils.h"
#include "../game/graphhash.h"
#include "../neuralnet/nninputs.h"
#include "../external/nlohmann_json/json.hpp"
//------------------------
#include "../core/using.... | ALGO | 0.999116 | 6.627293 |
7102b965-763e-4bc7-b2d6-2cfb4f4c520f | aniketraj1615/codeforces-15sep- | id15.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
int arr[n];
double d=0;
for(int i=0;i<n;i++){
cin>>arr[i];
d+=arr[i];
}
d=d/(n*100);
cout<<100*d<<endl;
return 0;
} | ALGO | 0.9995 | 3.444476 |
9bd14922-54e4-424a-8567-f9624d4bfc06 | qazmichaelgw/sparse_map | src/ndt_core_public/ndt_generic/src/utils.cpp | #include <ndt_generic/utils.h>
namespace ndt_generic {
void getVectorMeanStdev(const std::vector<double> &v, double &mean,
double &stdev) {
mean = std::accumulate(v.begin(), v.end(), 0.0) / v.size();
std::vector<double> diff(v.size());
std::transform(v.begin(), v.end(), diff.begin(),
... | TOOL | 0.944977 | 5.700844 |
9f80d5cc-547b-4481-b3b3-a1c2f25f9ad0 | deytulsi18/GCI-Advanced-Cpp | 04_charges-repel.cpp |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n; cin>>n;
string s; cin>>s;
string res ="";
stack <char> v;
for(int i = 0; i < n; i++)
{
if(v.empty() || v.top() != s[i] )
{
v.push(s[i]);
}
else
{
v.pop();
}
}
while(!v.empty())
{res = v.top() + res;
v.pop... | ALGO | 0.999973 | 3.701364 |
8c7678fb-7a1c-4e75-805b-579330d490e4 | phaneendra3000/problemsolving | maxrectansum.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int arr[4][5] ;
int n = 4,m=5;
for(int i =0; i<n ;i++)
{
for(int j = 0; j<m;j++)
{
cin>>arr[i][j];
}
}
int a[n][m+1];
int maxs= INT_MIN;
for(int i = 0 ;i<n;i++)
{
a[i][0]= 0;
... | ALGO | 0.99999 | 3.023913 |
4ea9da04-ed62-4c1c-ada8-707c29e470d0 | wise-toddler/emptyqwerty | CSES_PROBLEMSET/Array_Division.cpp | // https://cses.fi/problemset/task/1085
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define endl '\n'
#define nl cout << endl;
#define IOS ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
#define v vector
#define vi v<int>
#define vvi v<v<int>>
#define p... | ALGO | 0.999917 | 4.116324 |
144b8cdb-9f3b-4965-8175-cd57e7635b8f | Graygzou/advent-of-code-2020 | src/AdventOfCode2020/Day13-ShuttleSearch/Day13-ShuttleSearch.cpp | // Day13-ShuttleSearch.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include <iostream>
#include <string>
#include <fstream>
#include <vector>
using namespace std;
pair<int, int> FindEarlistedAirportBus(string busSchedule, int earlistDepartPossible);
unsigned long long So... | ALGO | 0.991013 | 4.911554 |
b09c0a38-1eda-48ff-b176-2df325991cbe | Bepitic/DataStructures | BFS/CPP/bfs.cpp | #include <vector>;
#include <queue>;
using namespace std;
template <typename T>
class bfs
{
private:
vector<vector<T>> Graph;
vector<bool> explored(false);
vector<int> parent();
public:
bfs(vector<vector<T>> graph);
~bfs();
bfs(vector<vector<T>> graph, int src, int final)
{
queue<i... | ALGO | 0.999836 | 5.178956 |
9b51046b-81a5-4e24-a8f8-bec94b4aaa81 | JoMeGo2701/Isil2024-2 | S02. Arreglo Unidimensional/Repaso/E03.cpp | #include <iostream>
using namespace std;
//N ELEMENTOS EN VECTOR
int main(){
int i,n;
cout <<"Ingrese tamaño del arreglo: ";
cin >>n;
int vector[n-1];
//Lectura del vector
for(i=0;i<n;i++){
cout << "Ingrese numero ["<<(i+1)<<"]: ";
cin >> vector[i];
}
//Mostrar elementos... | ALGO | 0.923148 | 3.384253 |
3f4643fe-c199-41cc-91f7-8a0e05971a93 | GebUCSP/Arquitectura | Arquitectura/bitProgram.cpp | #include "bitProgram.h"
std::vector<bool> bitProgram::DecToBin(int decimal) {
std::vector<bool>tempVect;
bool signo = !(decimal > 0);
while (decimal) {
tempVect.insert(tempVect.begin(), decimal % 2);
decimal /= 2;
}
return tempVect;
}
std::vector<bool> bitProgram::Add(std::vector<bool> a, std::vector<bool... | ALGO | 0.999345 | 4.651938 |
ca601bf5-17e8-415c-8b20-6d892c82286f | fullcontact/icu-sys | icu/source/tools/genrb/prscmnts.cpp | // Safer use of UnicodeString.
#ifndef UNISTR_FROM_CHAR_EXPLICIT
# define UNISTR_FROM_CHAR_EXPLICIT explicit
#endif
// Less important, but still a good idea.
#ifndef UNISTR_FROM_STRING_EXPLICIT
# define UNISTR_FROM_STRING_EXPLICIT explicit
#endif
#include "unicode/regex.h"
#include "unicode/unistr.h"
#include "un... | TOOL | 0.857316 | 5.512165 |
f3fb858b-f3fe-4973-9f96-3f800dbd71e9 | ishandutta2007/codeforces | klimoza/normal/1207/F.cpp | #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <math.h>
#include <cmath>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <cassert>
#include <random>
#include <deque>
#include <bitset>
#include <string>
#include <complex>
#def... | ALGO | 0.999609 | 4.229116 |
35e6fb3f-3827-45fd-9427-762d6672407d | Devansh8954/program-cpp | String array program/Reverse_Word_Wise.cpp | #include <iostream>
using namespace std;
int length(char input[]) {
int count = 0;
for(int i=0; input[i] !='\0'; i++)
{
count++;
}
return count;
}
void reverse(char input[], int start, int end)
{
while (start < end)
{
char temp = input[start];
input[start] = input[e... | ALGO | 0.999984 | 5.774572 |
ec6c5fdd-525e-4169-a2fd-0f641bbb7677 | alexandraback/datacollection | solutions_5644738749267968_0/C++/lnzsy/war.cpp | #include <cstdio>
#include <cstdlib>
#include <climits>
#include <cstdint>
#include <cmath>
#include <utility>
#include <iostream>
#include <sstream>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <string>... | ALGO | 0.998268 | 3.397386 |
c539a0c7-e83f-4730-9766-2035f3d1549c | lim0sha/itmo-ads-labs | Semester_1/ALGOLAB1/taskH.cpp | #include <iostream>
using namespace std;
int main() {
int n, s = 0, total = 0, index_first=-10, index_last;
int answer = 10000;
bool flag = true;
bool change = false;
cin >> n;
int rooms[n];
for (int i = 0; i < n; i++) {
cin >> rooms[i];
}
for (int j = 0; j < 10; j++) {
... | ALGO | 0.999984 | 4.485531 |
93cc65cf-fd37-4f7c-9484-dd5b334f8083 | jadid800/leetcodeSolutions | solutions/maximum_xor_for_each_queary.cpp | /*https://leetcode.com/problems/maximum-xor-for-each-query/*/
class Solution {
public:
vector<int> getMaximumXor(vector<int>& nums, int maximumBit) {
int maxNum = (int)pow(2,maximumBit)-1;
vector<int> ans(nums.size());
int xorRes=0;
for(int i=0; i< nums.size(); i++){
xorR... | ALGO | 0.999945 | 5.752123 |
23eda69d-0724-42bb-adbd-6a86a7811c5b | yingyuey/ds | homework/hw4/main.cpp | #include"../../Graph/Graph.h"
#include <iostream>
#include <queue>
#include <unordered_map>
#include <algorithm>
#include <vector>
#include <climits>
#include "../../vector.xxx/vector.h"
using namespace std;
unordered_map<char, vector<char>> graph = {
{'A', {'B', 'C', 'D'}},
{'B', {'E', 'F'}},
{'D', {'G',... | ALGO | 0.999832 | 4.490424 |
52cf47a7-5f6b-4341-a81f-be0eabfc00b2 | pavankumar4404/Competitive_Programming | A_Game_of_Division.cpp | #include <bits/stdc++.h>
using namespace std;
// Speed
#define fastio() ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
// Macros
typedef long long ll;
#define for0(i,n) for(int i=0;i<n;i++)
#define for1(i,n) for(int i=1;i<=n;i++)
#define rfor(i,j) for(int i=j-1;i>=0;i--)
#define all(x) x.begin... | ALGO | 0.99981 | 4.231856 |
2d25971e-50ed-44e2-9cfd-df5afc959722 | 18-RAJAT/Amazon | DAY-8/Find Peak Element.cpp | class Solution {
public:
int findPeakElement(vector<int>& nums) {
//Using BS
int start=0;
int end=nums.size()-1;
while(start<end)
{
int mid=start+(end-start)/2;
if(nums[mid]<nums[mid+1]){start=mid;}
else... | ALGO | 0.999949 | 5.471453 |
b91b5f24-f8c3-46fe-8316-c09fe84239f8 | Rudresh1604/DAILY-PROGRAMMING-CHALLENGE-2024 | ZeroOneTwoSort.cpp | #include <bits/stdc++.h>
using namespace std;
void myfun(vector<int> &arr)
{
int n = arr.size();
int l = 0, m = 0, h = n - 1;
while (m <= h)
{
if (arr[m] == 0)
{
swap(arr[l], arr[m]);
l++;
m++;
}
else if (arr[m] == 1)
{
... | ALGO | 0.999972 | 4.670809 |
f55336ec-988f-4446-a4e2-2773bd933782 | honeyvikash/Leetcode_Solved_Problems | 3301-maximize-the-total-height-of-unique-towers/3301-maximize-the-total-height-of-unique-towers.cpp | class Solution {
public:
long long maximumTotalSum(vector<int>& mh) {
sort(mh.begin(), mh.end());
unordered_map<int,int> cnt;
long long ans = 0;
for(auto it : mh)
{
if(cnt[it] == 0)
{
ans += it;
cnt[i... | ALGO | 0.999979 | 5.1731 |
60541bc3-122e-4fc5-af4f-c2302d8f5169 | Namanmittal0007/DsaLevel1 | level2/recursionAndBacktracking/queenCombination2_2D.cpp | #include<bits/stdc++.h>
using namespace std;
void displayy(vector<vector<char>> box){
for(auto x: box){
for(auto y: x){
cout<<y<<" ";
}
cout<<endl;
}
cout<<endl;
}
void combination2d(int cq,vector<vector<char>> &box, int tq, int li, int lj){
if(cq==tq){
displa... | ALGO | 0.999842 | 3.540229 |
d6bf41f5-3204-4fcd-9e92-d268bda280fe | AkashSingh3031/Striver-SDE-Sheet-Challenge | 21]. Day-21 (Binary Search Tree)/Leetcode/7]. Size of the largest BST in 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.999969 | 6.984433 |
26627d81-68e2-48ee-bdb6-04e6ea58d644 | kunwarvidhan/Standard-C-Algorithms | bst.cpp | #include<bits/stdc++.h>
using namespace std;
class Bst{
public:
int data;
Bst * left,*right;
Bst();
Bst(int key);
Bst*Insert(Bst*,int);
void inorder(Bst*);
Bst*del(Bst*,int);
Bst*minval(Bst*);
};
Bst :: Bst() : data(0), left(NULL), right(NULL){}
Bst::Bst(int value)
{
data=value;
left=N... | ALGO | 0.999979 | 4.034641 |
53f7c099-db2a-49fa-96d0-3214ba3b1f1c | AdityaSharmaHub/100DaysOfCode | Day 12/aggressiveCows.cpp | #include<iostream>
#include<vector>
#include<bits/stdc++.h>
using namespace std;
int solve(int n, int k, vector<int> &stalls) {
// Write your code here
int start=1, end, mid, ans;
// Sort the array in ascending order
sort(stalls.begin(),stalls.end());
end = stalls[n-1]-stalls[0];
... | ALGO | 0.999929 | 5.246823 |
65fbb94c-d379-472a-b3a1-ba4c9f972ee1 | rishik1001/TFLITE | unsupported/test/BVH.cpp | #include "main.h"
#include <Eigen/StdVector>
#include <Eigen/Geometry>
#include <unsupported/Eigen/BVH>
namespace Eigen {
template <typename Scalar, int Dim>
AlignedBox<Scalar, Dim> bounding_box(const Matrix<Scalar, Dim, 1> &v) {
return AlignedBox<Scalar, Dim>(v);
}
} // namespace Eigen
template <int Dim>
struct... | TEST | 0.995274 | 6.838835 |
d9c89242-a962-42d8-ab25-9e5f6fd699f3 | ggarabs/competitive-programming | problems/Codeforces/2055C-The-Trail.cpp | #include <bits/stdc++.h>
#define lli long long int
using namespace std;
int main(){
int t; cin >> t;
while(t--){
int n, m; cin >> n >> m;
string path; cin >> path;
vector <vector<lli>> grid(n, vector <lli>(m, 0));
vector <lli> r_sum(n, 0), c_sum(m, 0), r_fill(n, 0), c_fill(m... | ALGO | 0.999725 | 4.959928 |
1030efb4-7c35-499c-a71f-95fb311d8c77 | mtorres26/ALG | ALGP1/Material/MaximoMinimoDyV.cpp | #include <iostream>
#include <ctime>
#include <cstdlib>
#include <climits>
#include <cassert>
#include <chrono>
#include <fstream>
#include <utility>
using namespace std;
using namespace std;
int maximo, minimo;
int max(int max1, int max2){
int aux=0;
if(max1>max2)
aux=max1;
else
aux=max2;
return au... | ALGO | 0.997341 | 4.107858 |
23c88218-4ff3-4a32-a6b8-b32d57278419 | yashbhanu/Data-Structure-and-Algorithms | Problem Solving/codeStudio7_sort_012.cpp | #include <iostream>
using namespace std;
//sort 0s 1s 2s
// you are given an array => [1,1,0,2,2,0,1,2] => sort it into 0's and 1s 2s => [0 0 1 1 1 2 2 2]
//initialize 3 variables left=0[start], mid=0[start] && right=n-1[end]
//run the loop till mid exceeds right[end]; //pass the mid value to switch case and check ins... | ALGO | 0.999822 | 4.956433 |
31a4e0c8-f7da-4192-8e0c-a9668246cbb5 | longpth/RoLabsSlam | ThirdParty/g2o/g2o/core/estimate_propagator.cpp | #include "estimate_propagator.h"
#include <queue>
#include <vector>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <fstream>
//#define DEBUG_ESTIMATE_PROPAGATOR
using namespace std;
namespace g2o {
# ifdef DEBUG_ESTIMATE_PROPAGATOR
struct FrontierLevelCmp {
bool operator()(EstimatePropa... | ALGO | 0.999889 | 5.590659 |
626131a5-9390-41c0-8196-7d182ffc1038 | Yaro2709/AlgoProblems | 12/1023B.cpp | #include <iostream>
using namespace std;
int main() {
long long int n, k;
cin >> n >> k;
long long int high = std::min(k - 1, n);
long long int low = k - high;
cout << ((high - low + 1) / 2 > 0 ? (high - low + 1) / 2 : 0);
return 0;
} | ALGO | 0.999711 | 3.350668 |
7f42deee-6b00-4430-88f6-36510f940045 | devahub/leetcode_problems | 1443-minimum-time-to-collect-all-apples-in-a-tree/1443-minimum-time-to-collect-all-apples-in-a-tree.cpp | class Solution {
public:
unordered_map<int, vector<int>> g; // to store the graph
unordered_map<int, bool> visited; // to stop exploring same nodes again and again.
void createGraph(vector<vector<int>>& edges) {
for (auto e: edges) {
g[e[0]].push_back(e[1]); // adjecency list representation
... | ALGO | 0.999965 | 5.874497 |
e27e3b0e-d3c9-42e1-8794-20319fd8d694 | 1z2s3e4v/3d-placer | ntuplace_MRT/GlobalRouting/steiner.cpp | #include "steiner.h"
using namespace std;
// (donnie)
// global variable
CFlute* pgFlute = NULL;
void CFlute::Solve( const std::vector<CPoint>& points )
{
m_steiner_array.clear();
if( points.size() > MAXD )
{
fprintf(stderr, "Warning: flute cannot solve more than %d points (current %d)\n", MAXD, points... | ALGO | 0.999265 | 3.756684 |
573dd4f2-dd9c-41a1-83f1-b451f17e9abe | Asonance11/DSA-CPP | linkedList/linkedList.cpp | #include <iostream>
using namespace std;
// ADIGUN SAMUEL OLUWADABIRA 20/2005
// COMPUTER SCIENCE GROUP A
// Inserting, Searching and deleting from a linked list;
struct Node
{
int data;
Node *next;
};
Node *insertNode(Node *head, int val)
{
// Create new node
Node *newNode = new Node;
// assign ... | ALGO | 0.999466 | 4.488081 |
022d218c-35e8-45e3-b620-1618200a0c81 | es-amit/Striver-A2Z-DSA-Sheet | Stacks & Queues/TrappingRainWater.cpp | #include<bits/stdc++.h>
using namespace std;
class Solution {
public:
int trap(vector<int>& height) {
int n = height.size();
int mxl[n];
int mxr[n];
mxl[0] = height[0];
// filling the maxl array
for(int i=1;i<n;i++){
mxl[i] = max(mxl[i-1],height[i]);
... | ALGO | 0.999965 | 6.380513 |
ea48de8e-9edc-442b-ad50-b6086d189655 | prakul-27/Cloth-Simulation | COD891_CODE_BASE/ARCSim-HYLC-master/dependencies/eigen/doc/examples/Tutorial_ArrayClass_addition.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace Eigen;
using namespace std;
int main()
{
ArrayXXf a(3,3);
ArrayXXf b(3,3);
a << 1,2,3,
4,5,6,
7,8,9;
b << 1,2,3,
1,2,3,
1,2,3;
// Adding two arrays
cout << "a + b = " << endl << a + b << endl << endl;
// Subt... | ALGO | 0.977432 | 3.642258 |
5fa7ae2e-8de5-4fb7-b0bc-41629f298ee5 | m-talha/Self-Driving-Car-Udacity | P7-Path-Planning-Project/src/Eigen-3.3/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.996951 | 6.161131 |
df8b61fc-4666-407d-8c92-43b6a28a9d7a | Kiran-Chaitu/GFG_CODES | Easy/Frequencies of Limited Range Array Elements/frequencies-of-limited-range-array-elements.cpp | //{ Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution{
public:
//Function to count the frequency of all elements from 1 to N in the array.
void frequencyCount(vector<int>& arr,int N, int P)
{
// code here
unordered_map<int,int> mp;
... | ALGO | 0.999875 | 5.228687 |
77c12ff1-9056-4b18-984f-2d1b4ec5a40a | Biochemical-Networks/DNA_replication_muriel | 221007_model_muriel_grow_mRNA_wr_kinetic_template_string.cpp | /*
07-10-22, Muriel Louman, AMOLF
Grow mRNA, assumingh a randomly distributed template string of zeros and ones. Reproduicing the kinetic case of Jenny's paper.
delta G_TT = 0, delta G_k = delta G.
mRNA only consisting of zeros and ones.
model muriel:
Using a absorption matrix consisting of the probabilities to mo... | ALGO | 0.985329 | 4.52047 |
d43985e4-cdde-44f6-b604-99eef73d2a14 | bjbjkidrock/LeetCode-1 | Algorithms/h-index-ii.cpp | 275. H-Index II
https://leetcode.com/problems/h-index-ii/
Follow up for H-Index: What if the citations array is sorted in ascending order? Could you optimize your algorithm?
#include <iostream>
#include <vector>
using namespace std;
class Solution {
public:
int hIndex(vector<int>& citations) {
int sz = ... | ALGO | 0.999947 | 6.195106 |
119b7629-1293-4a61-ac8a-24bfdf59300d | Rolight/ACM_ICPC | Old_Contests/CodeForces/#6/A.cpp | #include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
int tri[4];
int f1 = 0, f2 = 0;
for(int i = 0; i < 4; i++) {
scanf("%d", tri+i);
}
sort(tri, tri+4);
if(tri[0] + tri[1] > tri[2])
f1 = 1;
else if(tri[0] + tri[1] == tri[2])
f2 = 1;
if(tri[0] +... | ALGO | 0.999848 | 4.316312 |
991df7be-f37c-494a-8410-169b926155d1 | isharout2003/c-programe | c.129.cpp | // C program to demonstrate
// addition of complex numbers
#include <stdio.h>
// define a structure for complex number
typedef struct complexNumber {
int real;
int img;
} complex;
// This function accepts two complex numbers
// as parameter and return addition of
// them.
complex add(complex x, complex y);
// Driv... | ALGO | 0.988277 | 4.034374 |
a5c5e1d6-3405-448e-b43a-7c511e52797e | sahilchavhan/C-plus-plus | binary decimal octal/dec_to_octal.cpp | //decimal to octal
#include<iostream>
using namespace std;
int main()
{
int n,oct=0,d,k=1;
cout<<"enter the number";
cin>>n;
while (n>0)
{
d=n%10;
oct=oct+(d*k);
n=n/10;
k=k*8;
}
cout<<"the octal number is "<<oct<<endl;
return 0;
} | ALGO | 0.996557 | 3.743896 |
271ddc69-f5c7-4330-b07e-a4f0db887720 | cyberark/rdpfuzz | rdpfuzz-winafl/cmake-3.16.0/Source/Checks/cm_cxx14_check.cpp | #include <cstdio>
#include <iterator>
#include <memory>
int main()
{
int a[] = { 0, 1, 2 };
auto ai = std::cbegin(a);
int b[] = { 2, 1, 0 };
auto bi = std::cend(b);
std::unique_ptr<int> u(new int(0));
return *u + *ai + *(bi - 1);
}
| ALGO | 0.889678 | 4.518634 |
8835efcd-db5e-4a02-9bb1-15154e89dda1 | TiagoMLucio/Competitive-Programming | codeforces/Contests/905/a.cpp | #include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define allr(x) (x).rbegin(), (x).rend()
#define gsize(x) (int)((x).size())
const char nl = '\n';
typedef long long ll;
typedef long double ld;
using namespace std;
void solve() {
string pin;
cin >> pin;
ll ans = 0;
ll prev = 1, c... | ALGO | 0.999469 | 5.128562 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.