uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
90c1e0ca-e706-4a0c-8f2f-6ff1dd5b03d8 | GNITOAHC/LeetCode | Algorithms/Medium/P95-Unique_Binary_Search_Trees_II/p95-accepted.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.999963 | 6.687655 |
cb351263-aefd-44f5-b946-60e78a889d43 | ishandutta2007/codeforces | nantf/normal/547/D.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
const int maxn=1222222;
#define MP make_pair
#define PB push_back
#define lson o<<1,l,mid
#define rson o<<1|1,mid+1,r
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define ROF(i,a,b) for(int i=(a);i>=(b);i--)
#define MEM(x,v) m... | ALGO | 0.999959 | 3.376674 |
3a6b6336-7d9d-46d7-9a26-ae5eb0b56ca1 | ReivajRS/algorithms-notebook | strings/Hashing.cpp | // Time complexity Hashing O(n), hashInterval O(1)
typedef long long ll;
// Operaciones con modulo
inline int add(int a, int b, int mod) { a += b; return a >= mod ? a - mod : a; }
inline int sub(int a, int b, int mod) { a -= b; return a < 0 ? a + mod : a; }
inline int mul(int a, int b, int mod) { return ((ll)a*b) % mo... | ALGO | 0.999913 | 4.707961 |
bf6aa3ea-6c63-4b27-81bc-406f136925af | Nischalb10/DSA-in-Cpp | Linked Lists/MiddleLL.cpp | // Given the head of a singly linked list, return the middle node of the linked list.
// If there are two middle nodes, return the second middle node.
// Example 1:
// Input: head = [1,2,3,4,5]
// Output: [3,4,5]
// Explanation: The middle node of the list is node 3.
// Example 2:
// Input: head = [1,2,3,4,5,6]
// ... | ALGO | 0.999834 | 6.687163 |
ad44cc62-616e-46f1-916d-621a4069a5fc | RishabhhMittall/cpp | Difficulty: Easy/Left View of Binary Tree/left-view-of-binary-tree.cpp | /*
class Node {
public:
int data;
Node* left;
Node* right;
Node(int val) {
data = val;
left = nullptr;
right = nullptr;
}
};
*/
class Solution {
public:
void solve(Node* root, vector<int> &ans, int lvl) {
if(root == NULL) {
return;
}
... | ALGO | 0.999977 | 5.986213 |
a2cb3ab9-ca93-4131-8376-578bcd48be3b | 565353780/total-curvature-estimation | libigl/include/igl/fit_rotations.cpp | template <typename DerivedS, typename DerivedD>
IGL_INLINE void igl::fit_rotations(
const Eigen::PlainObjectBase<DerivedS> & S,
const bool single_precision,
Eigen::PlainObjectBase<DerivedD> & R)
{
using namespace std;
const int dim = S.cols();
const int nr = S.rows()/dim;
assert(nr * dim == S.rows());
a... | ALGO | 0.99451 | 6.286137 |
96ae7948-5a7a-453d-9f38-0d6ab73ab9bf | saransh79/LearnGit | BFS.cpp |
// Program to print BFS traversal from a given
// source vertex. BFS(int s) traverses vertices
// reachable from s.
#include<bits/stdc++.h>
using namespace std;
// This class represents a directed graph using
// adjacency list representation
class Graph
{
int V; // No. of vertices
// Pointer to an array containing... | ALGO | 0.999937 | 4.74232 |
ca8e2d9f-5903-4b20-942c-c22d7a0ec3fa | ishandutta2007/codeforces | maroonrk/normal/901/B.cpp | #include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define int ll
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define pb push_back
#define eb emplace_back
#define a first
#define b second
... | ALGO | 0.99996 | 3.076637 |
8086ece5-b69a-4f62-8bc5-c82fb77e516b | Rajat2614/6Companies30Days | Goldman Sachs/Factorial Trailing Zeroes.cpp | class Solution {
public:
int trailingZeroes(int n) {
int result = 0;
while (n) {
n /= 5;
result += n;
}
return result;
}
};
| ALGO | 0.999922 | 6.59378 |
79003261-c817-4d95-9b86-3dd182f01999 | VishalSingh-07/Geeks-for-Geeks | Easy/Plus_one.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
//User function Template for C++
// Brute Force Approach
// class Solution {
// public:
// vector<int> increment(vector<int> arr ,int n) {
// // code here
// vector<int> ans;
// long long digit=arr... | ALGO | 0.999929 | 7.060538 |
ad03213c-8cd9-4391-ad85-812e6b38c0a6 | strange-tiger/Baekjoon_practice | _2024_BOJ_Practice/1300_KthNumber.cpp | #include <iostream>
#include <algorithm>
using namespace std;
long long N, K;
void input()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
cin >> N >> K;
}
long long count(long long num)
{
long long cnt = 0;
for (int i = 1; i <= N; ++i)
cnt += min(num / i, N);
return cnt;
}
void solve()... | ALGO | 0.999925 | 4.187623 |
d8db52bd-4c4f-4cfe-92b7-a0abd6272c1d | arfizurrahman/problem-solving | other/lec_1.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
cout << sqrt(16);
} | ALGO | 0.997542 | 3.098301 |
18a050eb-8c7b-4e2c-8cf2-22d86a790f6d | basecase0/DSA | DP/stocks/BuySell-2.cpp | /*
You are given an integer array prices where prices[i] is the price of a given stock on the ith day.
On each day, you may decide to buy and/or sell the stock. You can only hold at most one share of the stock at any time. However, you can buy it then immediately sell it on the same day.
Find and return the maximum p... | ALGO | 0.999975 | 6.23748 |
0b565fa6-2cc9-45ba-b41d-f397d0331e19 | ishandutta2007/codeforces | monyura/normal/409/H.cpp | #include <iostream>
#include <iomanip>
#include <cstdio>
#include <stdio.h>
#include <cstdlib>
#include <bitset>
#include <memory>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <string>
#include <cstring>
#include <fstream>
#include <functional>
#include <stack>
#include... | ALGO | 0.999871 | 3.87783 |
d5286c87-d83f-4403-b838-eb9db71f6d82 | Stosic7/Strukture-Podataka | BLANKETI/II KOLOKVIJUM 2019/ZAD2.cpp | #include <iostream>
#include <vector>
#include <unordered_set>
using namespace std;
class GNode {
public:
int id;
vector<GNode*> neighbors;
GNode(int id) : id(id) {}
};
class Graph {
private:
vector<GNode*> nodes;
public:
void addNode(int id);
void addEdge(int from, int to);
int sub... | ALGO | 0.99742 | 5.707803 |
5490e933-d1af-43a2-a5c3-4f42ba264866 | alexandraback/datacollection | solutions_5658571765186560_1/C++/GuaiNiGuoFenMeiLi/Solution.cpp | #include <cstdio>
#include <iostream>
using namespace std;
int ntests, x, r, c;
int main() {
freopen("D-large.in", "r", stdin);
freopen("D-large.out", "w", stdout);
cin >> ntests;
for (int test = 1; test <= ntests; ++test) {
cin >> x >> r >> c;
cout << "Case #" << test << ": " << "GABRIEL" << endl;
... | ALGO | 0.99561 | 4.374078 |
d5c48a39-fbc9-465a-af8b-41499fb9318e | ishandutta2007/codeforces | lzr_010506/normal/269/D.cpp | #include <bits/stdc++.h>
#define inf 1000000000
#define lson (rt << 1)
#define rson (rt << 1 | 1)
using namespace std;
const int N = 100005;
struct Wall
{
int h,l,r;
Wall(){}
Wall(int _h,int _l,int _r):h(_h),l(_l),r(_r){}
bool operator<(const Wall w)const
{
return h < w.h;
}
}Wa[N];
stru... | ALGO | 0.999939 | 3.757821 |
103b1ab7-e5a9-4ee8-8fb3-6af82bd09493 | joydip007x/CompetitiveCodeArchive | CodeForces/1062A/17044003_AC_31ms_12kB.cpp | ///*/////////////////// /// *
/*// author-joydip007x /// *
/ */// <^> <^ <^> <^> /// *
///*<^> Never tired :)<^>:V*///
//*/*** Never Give UP ***///
/// Date<^>XX/08/2018 *///
#include<bits/stdc++.h>
using namespace std;
#define loop(i,L,U) for(long long int i=(long long int)L;i<U;i++)
#define l... | ALGO | 0.99991 | 3.70325 |
afb3186e-edc0-4bd9-88b6-b84bf1378301 | Leon-OS/ComputeGraphicsProgramingForApple | Chapter_17_stereoscopy/Prog17_1_anaglyph/main.cpp | #include <GL/glew.h>
#include <GLFW/glfw3.h>
#include <SOIL2/soil2.h>
#include <string>
#include <iostream>
#include <fstream>
#include <glm/gtc/type_ptr.hpp> // glm::value_ptr
#include <glm/gtc/matrix_transform.hpp> // glm::translate, glm::rotate, glm::scale, glm::perspective
#include "ImportedModel.h"
#include "Utils... | TOOL | 0.903421 | 4.946989 |
b54eafc2-8165-403a-ab85-9ab8bb6642d0 | Pradyut-Guchhait/Leetcode | 21. Merge Two Sorted Lists/Program.cpp | class Solution {
public:
ListNode* mergeTwoLists(ListNode* l1, ListNode* l2) {
ListNode* dummy = new ListNode(0); // Create a dummy node as the starting point
ListNode* current = dummy; // Initialize a pointer 'current' to track the end of the merged list
while (l1 && l2) { // Continue w... | ALGO | 0.999974 | 6.486245 |
221ea33d-c42b-4682-bf5e-315e927702af | Nabila-Farzana/blind75 | containsDuplicate.cpp | class Solution {
public:
bool containsDuplicate(vector<int>& nums) {
unordered_map<int, int> seen;
for(int num: nums){
if (seen[num] > 0)
return true;
seen[num]++;
}
return false;
}
};
| ALGO | 0.999744 | 6.117809 |
ae5ccbeb-455f-496e-a553-8c170ab62032 | rasheduzzamanrakib/basic-cpp | 33_digitSpelling.cpp | #include<iostream>
using namespace std;
int main()
{
int a;
cout<<"Enter any integer: ";
cin>>a;
switch(a)
{
case 0:
cout<<"zero";
break;
case 1:
cout<<"one";
break;
case 2:
cout<<"two";
break;
ca... | TOOL | 0.876166 | 3.495609 |
028c941b-f082-4249-a135-f63fb9318444 | sourabh14/algorithms-verified | kth smallest element.cpp | /* Given unsorted array - find the kth smallest element
* -Based on quick sort algo
* Complexity :
* Time : O(n)
* Space : O(1)
*
* To find median k = n/2
*/
#include <bits/stdc++.h>
#define MAXN 10
using namespace std;
int arr[MAXN], n, i;
int partition(int l, int r) {
if (l == r) return l;
int x ... | ALGO | 0.999986 | 4.851465 |
1621920a-ce52-4629-81aa-ea1167e005fa | wngudwls000/cpp_datastructure_algorithm | Lesson_3-Hash_Table,Bloom_Filter/Exercise15.cpp | #include <iostream>
#include <vector>
class hash_map
{
std::vector<int> data1;
std::vector<int> data2;
int size;
int hash1(int key) const
{
return key % size;
}
int hash2(int key) const
{
return (key / size) % size;
}
public:
hash_map(int n) : size(n)
{
data1 = std::vector<int>(size, -1);
data2 =... | ALGO | 0.998843 | 4.883534 |
44da7ceb-4fbe-429e-ae12-5c110c09bf6f | raincross7/code-similarity | codes/train_code/problem234/problem234_461.cpp | #include <bits/stdc++.h>
#define rep(i,n) for (ll i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<vector<ll> > Graph;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a ... | ALGO | 0.999934 | 3.583841 |
b433e97a-f40e-41d9-9932-6fe33d76fa30 | svn2github/wikia | extensions/Blahtex/source/md5Wrapper.cpp | #include "md5.h"
#include <sstream>
#include <iomanip>
using namespace std;
string ComputeMd5(const string& input)
{
md5_state_s state;
unsigned char buf[16];
md5_init(&state);
md5_append(
&state,
reinterpret_cast<const md5_byte_t*>(input.c_str()),
input.size()
);
md... | ALGO | 0.985112 | 6.330713 |
ee07e23c-f43b-4fb5-83e5-2b42e2db040e | shaunakbhanarkar/Practice-Geeks-For-Geeks | Arrays/sumofmiddle.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
//code
int t;
cin>>t;
while(t--)
{
int n;
cin>>n;
vector<int> v(2*n);
for (int i=0;i<2*n;i++)
{
cin>>v[i];
}
sort(v.begin(),v.end());
cout<<v[n]+v[n-1]<<endl;
}
return 0;
}
| ALGO | 0.999713 | 3.931188 |
5bdad3af-7437-4427-8fc7-44633807683d | Andr1yK/lab_9.2 | UnitTest/UnitTest.cpp | #include "pch.h"
#include "CppUnitTest.h"
#include "../lab_9.2/Student.cpp"
#include "../lab_9.2/extendFunctions.cpp"
#include "../lab_9.2/lab_9.2.cpp"
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
namespace UnitTest
{
TEST_CLASS(UnitTest)
{
public:
TEST_METHOD(TestSort)
{
const ... | TEST | 0.940603 | 6.078215 |
b0ce237f-55f0-41a0-8347-15f1e3437ba7 | mizuirorivi/kyopuro | ABC070proB.cpp | #include<bits/stdc++.h>
using namespace std;
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define SZ(x) ((int)(x).size())
#define debug(x) cerr << #x << ": " << x << '\n'
#define INF 999999999
typedef long long int Int;
using ll = long long;
using VI = ... | ALGO | 0.999603 | 3.588226 |
a88ff428-7630-4ae3-a698-2975a5d5769c | hariom575/leetcode | 173-binary-search-tree-iterator/173-binary-search-tree-iterator.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.999971 | 6.178123 |
789732e4-a5c1-45cb-82ba-c9a16bdb0d97 | Informatimukas/Solutions | Codeforces/2118/C.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int T;
int n;
ll k;
int main() {
scanf("%d", &T);
while (T--) {
scanf("%d %lld", &n, &k);
ll res = 0;
vector<ll> seq;
for (int i = 0; i < n; i++) {
ll a; scanf("%lld", &a);
for (int j =... | ALGO | 0.999455 | 3.713287 |
d6ab265f-0eef-4f4c-b26b-94823de67f58 | raincross7/code-similarity | codes/train_code/problem410/problem410_388.cpp | #include <iostream>
#include <vector>
using namespace std;
int main(){
int n;
cin >> n;
vector<int> a(n+1);
for(int i = 1; i <= n; i++) cin >> a[i];
int ans = 0;
int cur = 1;
for(; ans <= n; ans++){
if(cur == 2) break;
else cur = a[cur];
}
if(ans > n) ans = -1;
... | ALGO | 0.999964 | 3.567607 |
1bcfa71a-fc32-4f77-a419-75ea3f4ba3a3 | Ravi-kumar178/DSA | SearchinAndSorting/firstAndLastOccurrence.cpp | public:
int firstOcc(int arr[],int n, int x){
int start = 0;
int end = n-1;
int mid = start + (end-start)/2;
int ans = -1;
while(start <= end){
if(arr[mid] == x){
ans = mid;
end = mid-1;
}
el... | ALGO | 0.999763 | 5.781634 |
5c31a7ff-7aa5-4ae6-8cfe-66c76b85236b | ArtemRotov/Algorithms | Route256/AmountPayable.cpp | /*
В магазине акция: «купи три одинаковых товара и заплати только за два».
Конечно, каждый купленный товар может участвовать лишь в одной акции.
Акцию можно использовать многократно.
Например, если будут куплены 7 товаров одного вида по цене 2 за штуку и
5 товаров другого вида по цене 3 за штуку, то вместо 7⋅2+5⋅3... | ALGO | 0.999964 | 4.708566 |
8c652a7c-552e-4ba9-b9c8-df60b5a1c40f | JollyBolt/leetcode | 1605-minimum-number-of-days-to-make-m-bouquets/minimum-number-of-days-to-make-m-bouquets.cpp | class Solution {
public:
bool isValid(vector<int>& bloomDay, int m, int k,int check){
int curr=0,count=0;
int n = bloomDay.size();
for(int i=0;i<n;i++){
if(bloomDay[i]<=check){
curr++;
}
else curr=0;
if(curr==k){
... | ALGO | 0.999999 | 5.999924 |
d4eb7070-6bc3-4741-95dd-8d6cf199e4aa | XDEv11/Codeforces | Round#841_div2/D.cpp | //#pragma GCC optimize ("O3")
#include <ios>
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
void solve() {
int n, m;
cin >> n >> m;
vector<vector<int>> g(n, vector<int>(m));
for (auto& v : g)
for (auto& x : v) cin >> x;
}
int main() {
ios_base::sync_with_stdio(false);
cin.t... | ALGO | 0.999678 | 4.571294 |
28d6741a-c9b4-4c5b-a219-e89a3afdacd1 | koson/book-source-codes | C++/C++GameDevelopmentCookbook_Code/Chapter9/Source/bullet3-2.83.7/test/collision/main.cpp | ///Original author: Erwin Coumans, October 2014
///Initial version of this low-level GJK/EPA/MPR convex-convex collision test
///You can provide your own support function in combination with the template functions
///See btComputeGjkEpaSphereSphereCollision below for an example
///Todo: the test needs proper coverage a... | TEST | 0.962077 | 6.797097 |
47b02c25-5e1e-485e-af3d-9fa8f02e842e | kendryte/kendryte-tensorflow | tensorflow/lite/tools/make/downloads/eigen/bench/perf_monitoring/llt.cpp | #include "gemm_common.h"
#include <Eigen/Cholesky>
EIGEN_DONT_INLINE
void llt(const Mat &A, const Mat &B, Mat &C)
{
C = A;
C.diagonal().array() += 1000;
Eigen::internal::llt_inplace<Mat::Scalar, Lower>::blocked(C);
}
int main(int argc, char **argv)
{
return main_gemm(argc, argv, llt);
}
| ALGO | 0.999163 | 4.213988 |
2848f1b0-0893-47af-a47f-e3bf46dc14d0 | YashKhati/CEC | Dp/MaximumSumOfNonAdjacentElements.cpp/OptimizationTabulation.cpp | /*
https://www.codingninjas.com/studio/problems/maximum-sum-of-non-adjacent-elements_843261?utm_source=striver&utm_medium=website&utm_campaign=a_zcoursetuf
*/
#include <iostream>
using namespace std;
int main()
{
int n;
cout << "Array Size : ";
cin >> n;
int arr[n];
cout << "Enter Array Elements :... | ALGO | 0.999964 | 5.031094 |
5574312a-0a84-4e45-a5c1-945f0968e1af | strn18/cpp_practice | algorithm/no category/2754.cpp | #include <iostream>
#include <string>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
string str;
double grade;
cin >> str;
cout << fixed;
cout.precision(1);
if(str == "F"){
cout << 0.0;
return 0;
}
if(str[0] == 'A') grade = 4.0;
else if(str[0] =... | ALGO | 0.999863 | 3.682488 |
38903ad0-f1b7-492c-8021-7adbd73974d5 | ishandutta2007/codeforces | 131131yhx/normal/1054/B.cpp | #include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
int main() {
int n;
scanf("%d", &n);
int nw = 0;
for(int i = 1; i <= n; i++) {
int x;
scanf("%d", &x);
if(x > nw) {
printf("%d\n", i);
return 0;
} else if(x == nw) nw+... | ALGO | 0.999902 | 3.863947 |
7fa949bc-8137-4e0f-a7f5-e6782e5d3b52 | suirless/libeigen | doc/examples/Tutorial_ArrayClass_interop_matrix.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace Eigen;
using namespace std;
int main()
{
MatrixXf m(2,2);
MatrixXf n(2,2);
MatrixXf result(2,2);
m << 1,2,
3,4;
n << 5,6,
7,8;
result = m * n;
cout << "-- Matrix m*n: --" << endl << result << endl << endl;
result = m.array() * ... | ALGO | 0.999232 | 4.30885 |
b0153f7b-9515-4733-b6f6-e1b6f61a115c | mzl13/Lithium | Src/AmrTask/AmrCore/AMReX_FillPatchUtil.cpp | #include <AMReX_Utility.H>
#include <AMReX_FillPatchUtil.H>
#include <AMReX_FillPatchUtil_F.H>
#include <cmath>
#ifdef AMREX_USE_EB
#include <AMReX_EBFabFactory.H>
#endif
#ifdef _OPENMP
#include <omp.h>
#endif
namespace amrex
{
void FillPatchSingleLevel (MultiFab& mf, Real time,
const Vector<MultiFab*>& sm... | ALGO | 0.982374 | 3.911225 |
b5f6c41c-78b4-421d-8af9-c934be6ae139 | sarvex/leetcode-lol-code | solution/0600-0699/0617.Merge Two Binary Trees/Solution.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.999995 | 6.283309 |
aa9b8a67-5505-4526-ac09-062cd06ee327 | tungday/CppOf_Mrs-4.1 | tinhtonggiaithua.cpp | #include <bits/stdc++.h>
using namespace std;
int main () {
int n;
cin >> n;
long long tong=0, tich=1;
for (int i=1; i<=n; i++) {
tich *= i;
tong += tich;
}
cout << tong << endl;
return 0;
} | ALGO | 0.999974 | 4.42644 |
d5794f53-e600-45f9-b354-d40444e0a93d | Ma406007/blue-bridge-cup-preparation | LeetCode30/LeetCode30.cpp | #include<iostream>
#include<vector>
#include<string>
#include<unordered_map>
#include<algorithm>
#include<queue>
using namespace std;
// 1.https://leetcode.cn/problems/nearest-exit-from-entrance-in-maze/
class Solution01 {
public:
int dir[4][2] = { {-1, 0}, {1, 0}, {0, -1}, {0, 1} };
int nearestExit(vector<ve... | ALGO | 0.999796 | 5.540583 |
45b2088e-5831-4fe6-a075-38499d5de347 | DevMohi/Algorithm-C- | Module 17.5 - Bellman and Floyd Practice/ford_bellman.cpp | #include<bits/stdc++.h>
using namespace std;
class Edge{
public:
int u;
int v;
int w;
Edge(int u, int v, int w){
this-> u = u;
this-> v = v;
this-> w = w;
}
};
int main(){
int n,e;
vector<Edge> v;
cin>>n>>e;
while(e--){
int a,b,w;
... | ALGO | 0.999924 | 4.223898 |
855917fd-9dac-4c74-9d46-fa7b4ad1b0b4 | ayaki-sugawara/atcoder | abc235/d.cpp | #include <bits/stdc++.h>
using namespace std;
bool flag = false;
int a;
int final_ans =1001001001;
int reverseB(int num);
map<int, bool> visited;
void search(int num, int count, int pre) {
if (num == 1 ) {
flag = true;
if ( final_ans > count) final_ans = count;
return;
}
else {
if (visited... | ALGO | 0.999753 | 3.748436 |
c71e9729-5924-46fe-94ab-b2eade31ed06 | ishandutta2007/codeforces | _menhera/normal/958/D1.cpp | #include<bits/stdc++.h>
using namespace std;
pair<int, int> arr[200010];
int gcd(int a, int b)
{
return a ? gcd(b%a, a) : b;
}
int main()
{
int m, i;
scanf("%d", &m);
map<pair<int, int>, int> cnt;
for(i=0;i<m;i++)
{
int a, b, c;
scanf(" (%d+%d)/%d", &a, &b, &c);
... | ALGO | 0.999326 | 3.498441 |
084b16ef-f611-4c4b-859d-7909a6016b77 | thegamer1907/Code_Analysis | contest/1542502724.cpp | #include<iostream>
#include<algorithm>
using namespace std;
bool book[60];
int main()
{
int h,m,s,t1,t2;
scanf("%d%d%d",&h,&m,&s);
scanf("%d%d",&t1,&t2);
if(t2==12){t2=0;}
if(t1==12){t1=0;}
if(h==12){h=0;}
if(m==0&&s==0){book[h*2]=true;}
else{book[h*2+1]=true;}
if(s==0&... | ALGO | 0.99982 | 3.198027 |
85fca10c-8b82-482e-9b7e-d600c13f9294 | ItsLucas/acm | DS/monkey/Huffman/lzw.cpp | #include "libio.h"
#include "lzw.h"
#include <cassert>
#include <ctime>
#include <iostream>
typedef unsigned long long ull;
typedef unsigned char byte;
unsigned getLzwMap(const std::vector<byte> &input, byte *lzwMap) {
const ull size = input.size();
bool used[256];
for (unsigned i = 0; i < 256; ++i) {
... | ALGO | 0.992755 | 4.589597 |
78ad38a2-63d9-47e6-997c-a70e71dd304a | Sean0628/competitive_programming | atcoder/abc/abc259/c.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
using ll = long long;
using P = pair<char, int>;
int main() {
string s,t; cin >> s >> t;
vector<P> scnt, tcnt;
rep(i, s.size()) {
if (scnt.empty()) scnt.push_back(make_pair(s[i], 1));
else if (scnt[scnt.size()-... | ALGO | 0.999998 | 4.158012 |
409cd0b8-f895-423a-841e-4b555718a586 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_12052_7.cpp | #include <bits/stdc++.h>
using namespace std;
int n, m, k, s;
int kind[100010];
struct Edge {
int to, w, next;
} edge[400010];
int head[100110];
int dis[100110];
bool inq[100110];
int cnt = 1;
int ans[100010][110];
int now[100010];
void add(int u, int v, int w) {
edge[cnt].to = v;
edge[cnt].w = w;
edge[cnt].nex... | ALGO | 0.99999 | 3.062336 |
c0910610-7f22-4dd1-98e3-6c4f3fdea074 | SlowerPhoton/Programy | zadani03/main.cpp | #include <iostream>
#define N 100
using namespace std;
int main()
{
bool nmbrs[N];
for (int i = 2; i < N; i++)
nmbrs[i] = true;
for (int i = 2; i < N; i++)
{
if (nmbrs[i] == false)
continue;
for (int j = 2*i; j < N; j+=i)
nmbrs[j] = false;
}
... | ALGO | 0.998324 | 4.140392 |
22f51870-edf7-4904-8a8f-52341d0c0fa8 | GaisaiYuno/OI-Record-exe-deleted | Grade 10-12/2018 autumn/NOIP/NOIP2018提高组Day2程序包/answers/GD-0225/defense/defense.cpp | #include <cstdio>
#include <vector>
#include <algorithm>
#define kN 100001
#define rep(i,x,y) for(int i=x;i<y;++i)
#define iter vector<int>::iterator
#define INF 10000000001
// BA987654321
using std::vector;
using std::min;
typedef long long i64;
int n, m, a[kN], w[kN];
vector<int> adj[kN];
int qa, qx, qb, qy;... | ALGO | 0.999896 | 3.843261 |
051a0029-18e5-4ae2-af01-8f08f6dcf105 | BusratSabiha/SPL-1 | print_topological_sorting.cpp | #include<bits/stdc++.h>
using namespace std;
int main(void)
{
printf("DFS(V, E)\n\nfor each u E V\n do color[u] <- WHITE\n prev[u] <- NIL\ntime <- 0\nfor each u E V\n do if color[u] = WHITE\n then DFS-VISIT(u)");
printf("\n\nDFS-VISIT(U)\n\ntime <- time+1\nd[u] <- time\nfor each v E Adj[u]\n do if color[v] ... | ALGO | 0.99809 | 4.187194 |
75282247-8e47-4de4-a438-f13d167a384c | hhy018/opencv | samples/cpp/tutorial_code/ShapeDescriptors/findContours_demo.cpp | /**
* @function findContours_Demo.cpp
* @brief Demo code to find contours in an image
* @author OpenCV team
*/
#include "opencv2/imgcodecs.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/imgproc.hpp"
#include <iostream>
using namespace cv;
using namespace std;
Mat src_gray;
int thresh = 100;
RNG rng(12345)... | ALGO | 0.928558 | 7.238969 |
af22cb65-f760-4310-9fb6-4ab685e12a9a | Jimenez09/Cimol | Aula4/ex4.cpp | #include <stdio.h>
#include <stdlib.h>
#include <locale.h>
int main() {
setlocale(LC_ALL, "Portuguese_Brazil");
int op, habitantes;
float nat, mort, taxa;
printf("Digite a opo desejada: \n");
printf("1= Taxa de Natalidade. \n");
printf("2= Taxa de Mortalidade. \n");
scanf("%d", &op);
printf("\n");
s... | TOOL | 0.85273 | 3.566325 |
dc2322dd-9e81-4517-a014-e4174ba1cb44 | IMDxD/made_algo | sorting_2/c.cpp | #include <iostream>
#include <string>
#include <vector>
using namespace std;
const int ALPHABET_SIZE = 26;
const char FIRST_CHAR = 'a';
vector<string> read_input(int array_size) {
vector<string> data(array_size);
string el;
for (int i = 0; i < array_size; ++i) {
cin >> el;
data[i] = el;
}
return da... | ALGO | 0.999798 | 4.009252 |
6089618b-bfba-4b5c-ba90-0cbade25b6d5 | eshf/NPSI | source/headers/boost/libs/graph/example/file_dependencies.cpp | // Some small modifications are done by Alexander Holler
/*
Paul Moore's request:
As an example of a practical problem which is not restricted to graph
"experts", consider file dependencies. It's basically graph construction,
plus topological sort, but it might make a nice "tutorial" example. Build a
depen... | ALGO | 0.999842 | 5.279836 |
867b4c15-54ef-457b-a38e-ce16e28fcc91 | m-schuetz/CudaLOD | libs/laszip/src/arithmeticdecoder.cpp |
#include "arithmeticdecoder.hpp"
#include <string.h>
#include <assert.h>
#include "arithmeticmodel.hpp"
ArithmeticDecoder::ArithmeticDecoder()
{
instream = 0;
}
BOOL ArithmeticDecoder::init(ByteStreamIn* instream, BOOL really_init)
{
if (instream == 0) return FALSE;
this->instream = instream;
length = AC__... | ALGO | 0.956605 | 5.736513 |
f0c2075f-73ce-4a53-aba8-bbc8c898dea6 | lilSpeedwagon/factory | BeltScript/BeltScript/RuntimeLib/RuntimeCommon.cpp | #include "pch.h"
#include <ctime>
#include "RuntimeCommon.h"
#include "RuntimeContext.h"
namespace
{
int fibonacci_impl(int num)
{
if (num <= 0) return 0;
if (num == 1) return 1;
return fibonacci_impl(num - 2) + fibonacci_impl(num - 1);
}
}
// seeding random number generator
struct RandInit
{
RandInit()
... | TOOL | 0.86234 | 5.396454 |
4c573767-e9ba-455d-a8ea-0357647c3372 | callmeFilip/Thinking-in-CPP-Volume-1-2nd-Edition | Chapter_12/Task_25/Integer.cpp | //: C12:Integer.cpp {O}
// Implementation of overloaded operators
#include "Integer.h"
#include "require.h"
using namespace std;
const Integer
operator+(const Integer &left,
const Integer &right)
{
return Integer(left.i + right.i);
}
const Integer
operator-(const Integer &left,
const Integer &ri... | TOOL | 0.935352 | 5.700753 |
e11f4f0d-911d-4c0a-874e-a1227f3b935a | Vedant3008/CPP | Do_While.cpp | #include <iostream>
using namespace std;
int main(){
int n,i=1;
cout<<"Enter number: ";
cin>>n;
do{
cout<<i<<endl;
i++;
}
while(i<=n);
return 0;
} | ALGO | 0.997537 | 3.467164 |
b2e57841-17af-485d-add4-d7bfc6376670 | Sujal-prajapati07/College_programs | sem 4/Data Structure/UNIT4/tree_create_pre_post_in.cpp | #include<iostream>
using namespace std;
class node
{
public:
int data;
node *left;
node *right;
};
node *tree=NULL;
node *insert(node *tree,int num)
{
node *ptr,*nodeptr,*parentPtr;
ptr=new node();
ptr->data=num;
if(tree==NULL)
{
tree=ptr;
tree->left=NULL;
... | ALGO | 0.999687 | 4.393078 |
2dbea5e9-fc10-4552-bff3-fd24ce5af1e7 | Sounean/Algorithm-learning | LuoGu/Part9/P1328.cpp | #include <iostream>
using namespace std;
// 下方带a的是甲,b的是乙
int N,Na,Nb=1; // N:游戏进行的轮次,Na:A的周期,Nb:B的周期
int ScoreA,ScoreB; // A和B的成绩
int main(){
// 游戏结构二维表
int a[5][5] = {{0,-1,1,1,-1},
{0,0,-1,1,-1},
{0,0,0,-1,1},
{0,0,0,0,1},
{0,0,0... | ALGO | 0.99999 | 3.686584 |
6c98445e-4d4a-4d7a-b1a6-c589f66bfbb5 | ishabhray/Competitive-Programming | codeforces/1473D.cpp | #include <bits/stdc++.h>
using namespace std;
#define PI 3.141592653589
#define ll long long int
#define ld long double
#define vi vector<int>
#define vl vector<ll>
#define ii pair<int,int>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define pll pair<ll,ll>
#define vv vector
#define al... | ALGO | 0.999949 | 4.089061 |
b8263f25-55bd-4a3b-9a80-0d863248e3af | rares-gh-pisoi/pbinfo | Clasa 10/meditatie/teme/8.12.2024/Permutare/permutare/main.cpp | #include <iostream>
#include <algorithm>
using namespace std;
int v[101];
int main()
{
int n;
cin>>n;
for(int i=1;i<=n;i++){
cin>>v[i];
}
sort(v+1,v+n+1);
if(v[1]==0){
cout<<"NU";
}else{
for(int i=1;i<=n;i++){
if(v[i+1]-v[i]>1){
cout<<"NU";... | ALGO | 0.999754 | 3.836127 |
6317b4b5-5d5c-4ca4-a54b-e190841f44e8 | AmanSharma-01/DSA | Binary-Tree/Diameter_of_a_binary_tree.cpp | // Recursive optimized C++ program to find the diameter of a Binary Tree
#include <bits/stdc++.h>
using namespace std;
struct node {
int data;
struct node *left, *right;
};
struct node* newNode(int data);
int max(int a, int b) { return (a > b) ? a : b; }
int height(struct node* node);
int m;
int func(stru... | ALGO | 0.999963 | 6.295025 |
5c965d96-3bb2-4d35-9116-e6c70096154b | llvm-mirror/llvm | tools/llvm-extract/llvm-extract.cpp | #include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/Bitcode/BitcodeWriterPass.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/IRPrintingPasses.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/LegacyPassManager.h"
#include "llvm/IR/Module.h"
#inclu... | TOOL | 0.867855 | 7.501846 |
4b936dc1-f5c6-4638-a8ea-fe7fa7189f7d | ishmeet09/DSA | Heaps/heapclass4Codes/heapclass4Codes/main (5).cpp | class node {
public:
char data;
int count;
node(char d, int c) {
data = d;
count = c;
}
};
class compare {
public:
bool operator()(node a, node b) {
return a.count < b.count;
}
};
class Solution {
public:
string reorganizeString(string s) {
//creat... | ALGO | 0.999999 | 5.946352 |
96487a63-70ae-428a-b182-b833a4dcf9a2 | Psyhe/Single_Source_Shortest_Paths | HYBRID_EXP/reading.cpp | #include <mpi.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <tuple>
#include <string>
#include <queue>
#include <set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
using namespace std;
const long long INF = 1e18;
int global_root = 0;
const double tau = 0.4;
int delta = 40; /... | ALGO | 0.999623 | 3.217296 |
b752e469-8f5b-44e7-ae08-58338018bef5 | ahm-fahim/cpp-in-1h | 5.2.Exercise.cpp | #include <iostream>
using namespace std;
int main()
{
double sales = 95000;
cout << "Sales : $" << sales << endl;
const double stateTaxRate = 0.4;
double stateTax = sales * stateTaxRate;
cout << "State Tax : $" << stateTax << endl;
const double countyTaxRate = 0.2;
double countyTax = sale... | ALGO | 0.971985 | 4.008907 |
f8017591-dd72-4bfd-b26b-b0ffe5956f7f | ak0327/42_webserv | srcs/HttpRequest/MapSetFieldValues/set_via.cpp | #include <algorithm>
#include "Color.hpp"
#include "Constant.hpp"
#include "HttpRequest.hpp"
#include "HttpMessageParser.hpp"
#include "StringHandler.hpp"
#include "MapSetFieldValues.hpp"
namespace {
Result<std::string, int> parse_received_by(const std::string &field_value,
std::size_t start_pos,
... | WEB | 0.979802 | 6.322409 |
5ea3c10f-f983-4f61-b183-2af77866025f | phantomcoder11/All-codes | dp/1. 01 knapsack/6. TargetSum.cpp | class Solution {
public:
int findTargetSumWays(vector<int>& nums, int target) {
int sum=0;
int n=nums.size();
for(int i=0;i<n;i++) sum+=nums[i];
if(target>sum || (target+sum)%2==1) return 0;
sum=(sum+target)/2;
if(sum<0) return 0;
int dp[n+1][sum+1];
... | ALGO | 0.99999 | 5.997448 |
f16a0280-114b-454b-9f07-b052ec2cbe67 | Caparow/CPP-tasks | AntGraphWithoutSets/AntGraphWithoutSets/header.cpp | #include "header.h"
using namespace std;
bool ReadFromFile(vector<edge>& graph, int& graph_size, string filename)
{
char buf;
int conn_num;
int temp_edge, temp_neighbour;
string buf_line = "";
ifstream f(filename);
if (f.is_open())
{
f >> buf;
while (buf == 'c')
{
getline(f, buf_line, '\n');
buf ... | ALGO | 0.998851 | 3.873186 |
83cff6d4-1c8b-4f79-ba86-a8eddef01214 | RCA-CP-ENGINEERS/Competitive_programming_algorithms | recursion/factorial.cpp | #include <bits/stdc++.h>
using namespace std;
\
int fact(int n){
if(n == 1){
return 1;
}else if (n == 0){
return -1;
}else{
return n * fact(n-1);
}
}
int factorial(int n)
{
if(n == 0){
return 1;
} else if(n < 0){
return -1;
}else {
//assumprio... | ALGO | 0.999934 | 4.406371 |
5e15dac7-63aa-44fa-ae7c-f46c03799027 | Kawser-nerd/CLCDSA | Source Codes/AtCoder/abc117/D/4171529.cpp | #include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
int N; long long K;
cin >> N >> K;
vector<int> c(50);
long long ans = 0;
for (int i = 0; i < N; ++i) {
long long x;
cin >> x;
for (int j = 49; j >= 0; --j) {
if ((x >> j) & 1) ++c[j];
}
ans += x ^ K;
}
for (... | ALGO | 0.999982 | 4.269042 |
d4bfa34f-f09a-467f-a51d-379ec4a0a3ae | c0mp3r/Serenity | Userland/Libraries/LibMarkdown/Text.cpp | #include <AK/Debug.h>
#include <AK/ScopeGuard.h>
#include <AK/StringBuilder.h>
#include <LibMarkdown/Text.h>
#include <LibMarkdown/Visitor.h>
#include <ctype.h>
#include <string.h>
namespace Markdown {
void Text::EmphasisNode::render_to_html(StringBuilder& builder) const
{
builder.append((strong) ? "<strong>"sv :... | TOOL | 0.877868 | 3.263958 |
63157c8d-e2e0-49da-8dba-d4f4b5714e74 | MihaelaAngelova/Data-Structures-Exam-Revision | 1 Увод, основи и примери/task1charArr.cpp | // Превърнете рождената си дата в шестнадесетична, в осмична и в двоична бройни системи.
#include <iostream>
int size(int n){
int counter = 0;
while (n > 0){
n = n / 10;
counter++;
}
return counter;
}
char hexRemainders(int r){
return 'A' + r - 10;
}
char* reverse(char* input){
... | ALGO | 0.980289 | 6.009994 |
0eb8e7a9-7d45-49e1-9ee9-6a507f021ea9 | minstaar/beakjoon | 2024/32344.cpp | #include <iostream>
#include <algorithm>
using namespace std;
using ll = long long;
const int INF = 1e9;
struct Data{
ll sx = INF, sy = INF, ex = -INF, ey = -INF;
}arr[100010];
int main()
{
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int r, c, N; cin >> r >> c >> N;
for(int i=1; i<=N; i++){
... | ALGO | 0.999648 | 4.118966 |
176cc273-dd6e-4c57-a714-fa1e6661e78f | eggag32/Competitive-Programming | Implementations/ordered set.cpp | #include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
template<class T>
using ordered_set = __gnu_pbds::tree<T, __gnu_pbds::null_type, less<T>, __gnu_pbds::rb_tree_tag, __gnu_pbds::tree_order_statistics_node_update>;
//https://codeforces.com/blog/entry/11080 | CONFIG | 0.999022 | 3.935476 |
f6a22d74-9022-43e5-97a9-6d851b83fb25 | jainrishabh98/CP | cc-COOK111B-DOR.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin >> t;
while (t--)
{
long long l, r, c, p;
cin >> l >> r;
if (r == 0)
{
cout << 0 << "\n";
continue;
}
c = l ^ r;
if(c==0)
{
cout<<r<<"... | ALGO | 0.999948 | 3.820913 |
9c07fdb5-fdb6-4ba3-971a-73c7e5b783cd | wassimalharaki/Codeforces | 1500/DidWeGetEverythingCovered.cpp | #include <bits/stdc++.h>
using namespace std;
#ifdef WASSIM
#include "debug.h"
#else
#define dbg(...)
#endif
#define int long long
#define INF LONG_LONG_MAX
#define nl '\n'
#define v vector
#define pb push_back
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define mp make_pair
#define F firs... | ALGO | 0.999984 | 4.393339 |
7edb0e1a-1a6a-47e0-a33b-624cb2e08cd1 | ntran5518/mathmart_shopping_app | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998733 | 6.76775 |
a4f1b67a-9dfe-41ee-9b54-846ed343eed2 | pranjal021/LeetCode_Solutions | Easy/876-Middle of the Linked List.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* middleNod... | ALGO | 0.99992 | 5.813665 |
6913d66f-3e9c-4003-a01d-9536ec07e3cb | MikMoreno/4883-PT-Moreno | Assignments/A04/10370/main.cpp | #include <stdio.h>
int main()
{
int T, n;
int A[1000];
scanf("%d", &T);
while (T--)
{
scanf("%d", &n);
double sum = 0;
int i, count = 0;
for (i = 0; i < n; i++)
scanf("%d", &A[i]), sum += A[i];
sum /= n;
for (i = 0; i < n; i++)
... | ALGO | 0.997823 | 4.09187 |
6817f64b-e03e-4b51-b707-f035def64c91 | FFMG/myoddweb.piger | myodd/boost/libs/compute/perf/perf_tbb_sort.cpp | #include <iostream>
#include <vector>
#include <tbb/parallel_sort.h>
#include "perf.hpp"
int main(int argc, char *argv[])
{
perf_parse_args(argc, argv);
std::cout << "size: " << PERF_N << std::endl;
std::vector<int> v(PERF_N);
perf_timer t;
for(size_t trial = 0; trial < PERF_TRIALS; trial++){
... | ALGO | 0.996407 | 5.398663 |
fa5392e2-59a2-4102-9bde-1609ef9843cd | steffanc/Practice | searchingsorting/mergesort.cpp | #include <iostream>
#include <string.h>
using namespace std;
// PROS
// - best, avg, worst case is O(nlogn) for time complexity
// CONS
// - worst case of O(n) space complexity
// - can be done in place but takes longer O(n(logn)^2)
int _l = 7;
void pArray(int* a, int l) {
for (int i=0; i<l; ++i) {
cout <<... | ALGO | 0.999941 | 4.98244 |
450af837-273c-4519-8bba-32000fb9cc3a | KatsuyaKikuchi/ProgrammingContest | Codeforces/ProblemSet/1353/A.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> pll;
#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)
const ll MOD = 1000000007;
const ll INF = (ll) 1e15;
ll solve() {
ll N, M;
cin >> N >> M;
... | ALGO | 0.999894 | 4.599565 |
da263efd-96ac-49c6-a056-d6716ff11d45 | jackeddaniel/leetcode_solutions | dp/139_word_break.cpp | class Solution {
public:
bool check(string& s, vector<string>& wordDict, int l, int r) {
return find(wordDict.begin(), wordDict.end(), s.substr(l, r-l+1)) != wordDict.end();
}
bool solve(int l, string& s, vector<string>& wordDict, vector<int>& dp) {
if(l == s.size())... | ALGO | 0.999927 | 6.171247 |
090a96d6-3c72-4e8b-bff8-8a3e1099148d | iamarghamallick/GeeksforGeeks-Solutions | Difficulty: Easy/Pairs with difference k/pairs-with-difference-k.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
// User function template for C++
class Solution {
public:
/* Returns count of pairs with difference k */
int countPairsWithDiffK(vector<int>& arr, int k) {
int n = arr.size();
unordered_map<int, int>... | ALGO | 0.998561 | 5.7598 |
bc313e1d-5609-438f-b246-cb2ea02035b3 | heygaurav1/6companiesques-30days | Day 4/299. Bulls and Cows.cpp | class Solution {
public:
string getHint(string secret, string guess) {
int bulls = 0;
int cows = 0;
int n = secret.length();
vector<int> secretCounts(10, 0);
vector<int> guessCounts(10, 0);
// First, count bulls and populate the counts
for (int i = 0; i < n; ++i) {
if (secret[i]... | ALGO | 0.999956 | 7.137981 |
a177ae54-fcbb-49c3-97ba-2409d89cd3f3 | shreejitverma/SDE-Interview-Prep | LeetCode/C++/paint-house-iii.cpp | // Time: O(m * t * n^2)
// Space: O(t * n)
class Solution {
public:
int minCost(vector<int>& houses, vector<vector<int>>& cost, int m, int n, int target) {
// dp[i][j][k]: i means the ith house, j means j neighbor groups, k means the kth color
vector<vector<vector<int>>> dp(2,
vector<v... | ALGO | 0.999937 | 6.408954 |
16b8e7d7-a6f7-42bc-9956-a79e590644b8 | Rebellion-OS/frameworks_av | media/libstagefright/codecs/amrnb/common/src/reorder.cpp | /*
Filename: /audio/gsm_amr/c/src/reorder.c
------------------------------------------------------------------------------
REVISION HISTORY
Description:
1. Eliminated unused include file add.h.
2. Replaced array addressing by pointers
3. Eliminated math operations that unn... | ALGO | 0.99994 | 6.232624 |
5d52a8f5-5bf2-466b-9a73-adb7e7fef908 | morphomuseum/ISE-MeshTools | Landmark_Transform.cpp | #include "Landmark_Transform.h"
#include "vtkMath.h"
#include "vtkMatrix4x4.h"
#include "vtkObjectFactory.h"
#include "vtkPoints.h"
#if !defined(_WIN32) || defined(__CYGWIN__)
# include <unistd.h> /* unlink */
#else
# include <io.h> /* unlink */
#endif
//vtkCxxRevisionMacro(Landmark_Transform, "$Revision: 1.1 $");
v... | ALGO | 0.878296 | 5.81674 |
7bc7ace8-e8e9-42c0-94a8-21f7c7cf7064 | ZiqiChai/DataStructure | src/tree_test1.cpp | #include <iostream>
#include <algorithm>
using namespace std;
//#define max(a,b) ((a)>(b)? (a):(b))
struct treeNode{
treeNode* left=NULL;
treeNode* right=NULL;
int val;
treeNode(int n,treeNode*l=NULL,treeNode*r=NULL){val=n;left=l;right=r;};
};
treeNode* treefind(treeNode*node,int val)
{
if(nod... | ALGO | 0.999229 | 4.019834 |
32a53137-3229-452a-b5b4-3a42147b07e4 | Sheryar-Ahmed/LC-Problems | 48-rotate-image/rotate-image.cpp | class Solution {
public:
void rotate(vector<vector<int>>& matrix) {
int n = matrix.size();
for(int i=0; i < n; i++){
for(int j= i; j < n; j++){
swap(matrix[i][j], matrix[j][i]);
}
reverse(matrix[i].begin(), matrix[i].end());
}
}
}; | ALGO | 0.999964 | 6.460362 |
0c671f9a-3704-4988-a24d-b8ed77ebf5a7 | kushagra-18/Leetcode-solutions | 2405-optimal-partition-of-string/2405-optimal-partition-of-string.cpp | class Solution {
public:
int partitionString(string s) {
int count = 1;
unordered_map<char,int>mp;
for(auto &x:s){
if(mp.find(x)!=mp.end()){
count++;
mp.clear();
mp[x]++;
... | ALGO | 0.999988 | 5.842008 |
03e78fb6-0b56-4117-ae56-b0bd144407d5 | kokkia/kal | eigen3.3.7/doc/examples/class_FixedBlock.cpp | #include <Eigen/Core>
#include <iostream>
using namespace Eigen;
using namespace std;
template<typename Derived>
Eigen::Block<Derived, 2, 2>
topLeft2x2Corner(MatrixBase<Derived>& m)
{
return Eigen::Block<Derived, 2, 2>(m.derived(), 0, 0);
}
template<typename Derived>
const Eigen::Block<const Derived, 2, 2>
topLeft2... | TOOL | 0.935643 | 6.64346 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.