uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
975cff5b-4850-45d7-9323-a4e00772553d | farooq958/quick_change | example/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.998787 | 6.76775 |
98c301dc-82ef-43ec-850b-57f19fbfa3c7 | TejasSaraf/DSAFromScratch | Binary Tree/Inorder_Traversal.cpp | #include <iostream>
using namespace std;
class Node
{
public:
int data;
Node *left;
Node *right;
Node(int data)
{
this->data = data;
this->left = NULL;
this->right = NULL;
}
};
Node *buildTree(Node *root)
{
int data;
cout << "Enter node data:";
cin >> data;... | ALGO | 0.999967 | 5.954392 |
a480fecd-64dd-40e1-bed7-65be8376ba4a | irff/cp-codes | TOKI/pasanganwah.cpp | #include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
#define ll long long
#define ALL(v) v.begin(),v.end()
#define PII pair<int,int>
#define R(i,_a,_b) for(int i=int(_a);i<int(_b);i++)
#define x first
#define y second
int teskes,n,num;
vector<PII> co,ce;
void coerase(int loc){ co.erase(co.begi... | ALGO | 0.999707 | 3.007437 |
27451383-a3d1-41ce-813f-eeebccbf4817 | Ananya291/DSA | PrimeNo.cpp | // given a positive int number N .print all prime number occur in range from 1 to N.
#include <iostream>
using namespace std;
int main()
{
int n;
cout << "enter any number: ";
cin >> n;
for (int i = 1; i <= n; i++)
{
if (i % 2 != 0)
{
cout << i << " " << endl;
}... | ALGO | 0.9994 | 3.923706 |
a23b14dd-b5ae-4fcb-984b-5e8478bb3bbb | GitProger/lksh | lksh_sch/day11/E.cpp | #include <bits/stdc++.h>
using namespace std;
#define int ll
typedef long long ll;
typedef long double ld;
typedef long long var;
typedef pair<int, int>prii;
typedef pair<ll, ll>prll;
typedef vector<int>veci;
typedef vector<ll>vecl;
typedef vector<veci> graph;
typedef map<int, int> mapii;
typedef set<int> seti;
typedef... | ALGO | 0.999904 | 4.305793 |
ce4ccc72-e95e-4922-8155-3e8aaa62f583 | ishandutta2007/codeforces | physics0523/normal/1462/F.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int t;
cin >> t;
while(t>0){
t--;
vector<pair<int,int>> pv;
int n;
cin >> n;
for(int i=1;i<=n;i++){
int a,b;
cin >> a >> b;
pv.push_back(make_pair(a,-i));
p... | ALGO | 0.999606 | 4.297443 |
167b0577-976d-41ec-bcb0-675e89633ee6 | bshaswat/cis22a | 07-functions/7.14-optional-miles-to-track-laps/solution.cpp | #include <iostream>
#include <iomanip>
using namespace std;
double MilesToLaps(double userMiles) {
return userMiles / 0.25;
}
int main() {
double miles;
cin >> miles;
cout << fixed << setprecision(2);
cout << MilesToLaps(miles) << endl;
return 0;
} | TOOL | 0.994748 | 3.326036 |
9fe21b5c-1ff7-47a0-a053-f8687aa1b8ef | Durden-T/C-beginning-of-the-world | backtracking/anysumNoDuplicate.cpp | //LeetCode 39
#include <vector>
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
class Solution
{
public:
vector<vector<int>> combinationSum(vector<int> &candidates, int target)
{
vector<vector<int>> ans;
if (target <= 0 || candidates.empty())
return ... | ALGO | 0.999916 | 5.988189 |
a5f1c9be-b4fc-4d57-9aa7-d8aba805c41a | elrudrakssh/Dynamic-Programming | code-force-vault/1093C-MishkaAndTheLastExam.cpp | #include <cstdio>
#include <vector>
typedef long long ll;
int main(){
ll n; scanf("%lld", &n);
std::vector<ll> a(n, 0);
ll left(0), right(1e18);
for(ll p = 0; 2 * p < n; p++){
ll b; scanf("%lld", &b);
a[p] = (b - left <= right) ? left : (b - right);
a[n - 1 - p] = b - a[p];
... | ALGO | 0.999838 | 3.115355 |
f251618a-801c-4c08-b8ad-c28e5897b240 | wockomtosh/AI_Engine | apps/myApps/gameAI/src/AIClasses/Pathfinding/Graph/DirectedGraph.cpp | #include "DirectedGraph.h"
DirectedGraph::DirectedGraph(std::map<int, std::vector<DirectedWeightedEdge>> edges) :
edges(edges)
{
}
std::vector<DirectedWeightedEdge> DirectedGraph::getOutgoingEdges(int source)
{
if (edges.find(source) != edges.end())
{
return edges[source];
}
return std::vector<DirectedWeighted... | ALGO | 0.989922 | 5.647233 |
594b227e-a269-4e08-8cd9-32812e0da374 | prikshit-1103/CodingNinjaRevision | segment tree/LazyPropogationSumOfSquares.cpp | //Sum Of Squares
//Send Feedback
//Segment trees are extremely useful. In particular "Lazy Propagation" (i.e. see here, for example) allows one to compute sums over a range in O(lg(n)), and update ranges in O(lg(n)) as well. In this problem you will compute something much harder:
//The sum of squares over a range with ... | ALGO | 0.996397 | 4.195846 |
7ed93172-3ab8-4370-97dd-d17ecd815def | maxwell7774/SoftwareEngineeringGroupProject | Software_Engineering_Project/cocos2d/cocos/scripting/deprecated/CCDeprecated.cpp | #include "scripting/deprecated/CCDeprecated.h"
#include "platform/CCPlatformMacros.h"
#include "math/Vec2.h"
#include "math/CCGeometry.h"
#include "base/ccTypes.h"
#include "base/CCDirector.h"
#if defined(__GNUC__) && ((__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1)))
#pragma GCC diagnostic ignored "-Wde... | CONFIG | 0.934505 | 5.856105 |
dd504d78-bdcc-4b3b-b927-ff9c79c29951 | raffneptune/cpp | dealerkartu(blackjacksimplified).cpp | #include <iostream>
#include <vector>
#include <cstdlib>
#include <ctime>
using namespace std;
// Daftar kartu dalam deck
const vector<string> deck = {"2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K", "A"};
// Fungsi untuk menghitung nilai kartu
int card_value(const string& card) {
if (card == "J" || ... | ALGO | 0.99659 | 6.522856 |
86c88f27-a155-4e72-ae17-43d5264b1e73 | patelkenil26/DSA-With-CPP | 3. Array , Time & Space complexity/4. Array Assignment/12_find_duplicate.cpp | /*
287. Find the Duplicate Number
Given an array of integers nums containing n + 1 integers where each integer is in the range [1, n] inclusive.
There is only one repeated number in nums, return this repeated number.
You must solve the problem without modifying the array nums and using only constant extra space.
Examp... | ALGO | 0.999868 | 5.630097 |
59e2189c-0a7b-4807-a817-65d4b6a318f2 | Aayushraj14/DSA | 0101-symmetric-tree/0101-symmetric-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.999968 | 6.539855 |
89c870a1-77de-451c-b067-85ec3c835882 | GuacheSuede/MSSubmission1234567890 | submission/macd/boost_1_69_0/libs/numeric/odeint/examples/harmonic_oscillator.cpp | #include <iostream>
#include <vector>
#include <boost/numeric/odeint.hpp>
//[ rhs_function
/* The type of container used to hold the state vector */
typedef std::vector< double > state_type;
const double gam = 0.15;
/* The rhs of x' = f(x) */
void harmonic_oscillator( const state_type &x , state_type &dxdt , const ... | ALGO | 0.999261 | 7.228972 |
21edb9d8-7204-4f0f-b927-7a599c75693e | rare0b/training-atcoder | Contest/ABC291/A.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
//
int main() {
string s;
cin >> s;
for (int i = 0; i < s.length(); i++) {
if (s[i] - 'a' < 0) {
cout << i + 1 << endl;
}
}
} | ALGO | 0.996691 | 3.214043 |
19ab4653-5fc8-48d7-8d2a-a5bb7b7d48f8 | feanorye/leetcode | 128.cpp | #include "listnode.h"
#include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <stdint.h>
#include <string>
#include <tuple>
#include <unordered_map>
#include <utility>
#include <vector>
using std::cout;
using std::endl;
using std::greater;
using std::map;
using... | ALGO | 0.999924 | 4.737163 |
715eeab6-0dda-4167-a682-f2672790b0be | riscv-spectre-mitigations/llvm_retpoline | mlir/lib/Reducer/ReductionNode.cpp | #include "mlir/Reducer/ReductionNode.h"
#include "mlir/IR/BlockAndValueMapping.h"
#include "llvm/ADT/STLExtras.h"
#include <algorithm>
#include <limits>
using namespace mlir;
ReductionNode::ReductionNode(
ReductionNode *parentNode, std::vector<Range> ranges,
llvm::SpecificBumpPtrAllocator<ReductionNode> &all... | ALGO | 0.862474 | 3.078583 |
a77ed7a1-b68a-46c5-a9b1-dc00e20c8f65 | sdytlm/leetcode | findMinofRotatedArray2.cpp | /*
Follow up for "Find Minimum in Rotated Sorted Array":
What if duplicates are allowed?
Would this affect the run-time complexity? How and why?
Suppose a sorted array is rotated at some pivot unknown to you beforehand.
(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).
Find the minimum element.
The array may contai... | ALGO | 0.999989 | 5.652254 |
a54f1adc-53a1-408f-b65b-4a413bd2de73 | ShuyiLU/leetcode | leetcode-algorithms/463. Island Perimete/463. Island Perimeter.cpp | class Solution {
public:
int islandPerimeter(vector<vector<int>>& grid) {
const int mv[4]={1,-1,0,0};
int n=grid.size(); if (!n) return 0;
int m=grid[0].size(); if (!m) return 0;
int ans=0;
for (int i=0; i<n; i++) for (int j=0; j<m; j++) if (grid[i][j]) {
for (int... | ALGO | 0.99987 | 6.055338 |
6cc7705c-3ff3-4b8f-92d8-8208695fcd8a | denis-gubar/Leetcode | Depth-first Search/1530. Number of Good Leaf Nodes Pairs.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.999972 | 5.872663 |
fcbd0478-2657-4c84-9637-291a8556f640 | Siddharthm10/Competitive-Coding-Repo | CodeForces/A/A_Dragons.cpp | //"It's not a bug, It's a feature
// 1000,greedy,sortings
// 29 mins
#include <bits/stdc++.h>
#include <vector>
#include <stdio.h>
#include <iostream>
#define pi 3.1415926535
#define fu(i,n,j) for(int j=i; j<n; j++)
#define fd(i,n,j) for(int j=i; j>=0; j--)
#define inf 100000000
using namespace std;
bool sortcol( cons... | ALGO | 0.999932 | 3.562453 |
c21a5c7b-cffc-4997-a4c6-17ac88d33332 | axelu/leetcode | cpp/01500-01999/themostsimilarpathinagraph.cpp |
// 1548. The Most Similar Path in a Graph
// https://leetcode.com/problems/the-most-similar-path-in-a-graph/
/*
define editDistance(targetPath, myPath) {
dis := 0
a := targetPath.length
b := myPath.length
if a != b {
return 1000000000
}
for (i := 0; i < a; i += 1) {
if targetPa... | ALGO | 0.999943 | 6.265621 |
677f86a5-dd91-4ce8-a4c5-046eff7e9555 | gradient-ai/Grounded-IDM-VTON | preprocess/humanparsing/modules/src/inplace_abn_cpu.cpp | #include <ATen/ATen.h>
#include <vector>
#include "utils/checks.h"
#include "inplace_abn.h"
at::Tensor reduce_sum(at::Tensor x) {
if (x.ndimension() == 2) {
return x.sum(0);
} else {
auto x_view = x.view({x.size(0), x.size(1), -1});
return x_view.sum(-1).sum(0);
}
}
at::Tensor broadcast_to(at::Ten... | DATA | 0.87713 | 6.634133 |
abaa2222-0e40-42b3-b552-904a9bece001 | soon-yau/SDCND_Term3 | CarND-Path-Planning-Project/src/Eigen-3.3/doc/examples/DenseBase_template_int_middleCols.cpp | #include <Eigen/Core>
#include <iostream>
using namespace Eigen;
using namespace std;
int main(void)
{
int const N = 5;
MatrixXi A(N,N);
A.setRandom();
cout << "A =\n" << A << '\n' << endl;
cout << "A(:,1..3) =\n" << A.middleCols<3>(1) << endl;
return 0;
}
| ALGO | 0.9218 | 3.137618 |
dc05adf3-8f26-44d7-80b6-a0d56813ad11 | sriramsachit-git/Alpaca-Trading-Bot | venv/lib/python3.12/site-packages/sklearn/svm/src/liblinear/tron.cpp | #include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include "tron.h"
#ifndef min
template <class T> static inline T min(T x,T y) { return (x<y)?x:y; }
#endif
#ifndef max
template <class T> static inline T max(T x,T y) { return (x>y)?x:y; }
#endif
static void default_print(const char *buf)
{... | ALGO | 0.99963 | 5.847107 |
1b73baad-6f13-48ab-a2ce-5b625b7e5d8a | yamanojo/Atcoder_code | ABC/ABC166/A.cpp | #include <bits/stdc++.h>
using namespace std;
# define rep(i,n) for(int i=0;i<(n);i++)
typedef long long ll;
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
string S;
cin>>S;
string ans;
if(S=="ABC"){
ans = "ARC";
}else{
ans = "ABC";
}
cout<<ans<<"\n";
return ... | ALGO | 0.999868 | 4.201445 |
f989e248-a034-4996-afa5-482545d07dd3 | sangwonseo94/ProblemSolving | Inflearn C++/6 번/AA/main.cpp | #include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <string>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;
int main(int argc, char** argv) {
string s; int res =0, count=0;
getline(cin, s);
for (int index = 0; in... | ALGO | 0.998786 | 3.581426 |
c05ecc77-a195-4b52-a75a-6894c783ffb9 | Priya-1305/Scientific_calculator_2.0 | 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 |
9a471ee5-db69-46f0-9cfb-3d2496831abb | technateNG/discr | src/mdlp.cpp | //#include <Rcpp.h>
#include "../include/mdlp.hpp"
template <typename T>
std::vector<size_t> Utils::order(const std::vector<T> &vec) {
std::vector<size_t> ids(vec.size());
std::iota(ids.begin(), ids.end(), 0);
std::sort(ids.begin(), ids.end(),
[&vec](size_t i1, size_t i2) {return vec[i1] < vec[i2];})... | ALGO | 0.999544 | 5.770365 |
327b0f00-ab9f-4d92-a1e3-98f7d6dea2be | animesh363/DOM-02 | Extras/heep.cpp | #include <iostream>
using namespace std;
void heapify(int arr[],int n,int i) {
int largest = i;
int left = 2*i+1;
int right = 2*i+2;
if(left<n&&arr[left]>arr[largest]) {
largest = left;
}
if(right<n&&arr[right]>arr[largest]) {
largest = right;
}
if(i!=largest) {
... | ALGO | 0.999968 | 5.022643 |
5320603b-1723-47bd-8cc5-a261ac4db00d | Mikeippi94/CIS-165 | Array 2.cpp | #include <iostream>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
const int SIZE = 5;
int main(int argc, char** argv) {
int array[SIZE];
int sum;
int squared_number;
int squared;
int named_number;
for(int squared_number = 0; squared... | ALGO | 0.916568 | 3.053126 |
c281c730-f4d8-459c-b82e-b6002472dc53 | Ziumper/HelloCMakeProject | src/MathFunctions/mysqrt.cpp | #include "mysqrt.h"
#include <iostream>
namespace MathFunctions
{
namespace detail
{
// a hack square root calculation using simple operations
double mysqrt(double x)
{
if (x <= 0)
{
return 0;
}
double result = x;
// do ten iterations
for (int i = 0; i < 1... | TOOL | 0.999651 | 5.754049 |
4136c3b8-02c1-4469-a6c9-56bda4bb64b6 | praveenkumarsrivas/Go-for-Algo-with-Cpp | Searching/First and last occurrences of X in array.cpp | /*
Example:
Input:
2
9 5
1 3 5 5 5 5 67 123 125
9 7
1 3 5 5 5 5 7 123 125
Output:
2 5
6 6
*/
#include<bits/stdc++.h>
using namespace std;
int first_indx(int arr[],int n,int key){
int s=0,e=n-1;
int ans=-1;
while(s<=e)
{
int mid=(s+e)/2;
if(arr[mid]==key){
ans=mid;
e=mid-1;
... | ALGO | 0.999959 | 4.419809 |
05a51718-fd50-4e1e-b99a-36e4b9cf6780 | fi-mdp-poo/2024 | Luca Emiliano Uriarte/examples/06_stl/10_count/main.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
template <class T> void vPrintVec(vector<T> v)
{
typename vector<T>::iterator ForIter;
ForIter = v.begin(); // puntero al primer elemento
cout << endl;
while (ForIter != v.end() ) //... | ALGO | 0.984709 | 3.318602 |
9a2a3117-c284-4e70-bdfd-9f1d91c0fa98 | begonia-dev/android_frameworks_av | media/libeffects/lvm/lib/Common/src/dB_to_Lin32.cpp | /************************************************************************/
/* */
/* %created_by: sra % (CM/S)*/
/* %name: dB_to_Lin32.c % (CM/S)*/
/* %version: 2 % (CM/S)*/
/* %date_created: Wed Jun 18 11:27:46 2008 ... | ALGO | 0.909448 | 6.199811 |
555b6798-71ca-425f-87f3-2ba0c10e38b0 | YingGwan/ViconGwan | externalDependencies/eigen3/doc/snippets/Tutorial_AdvancedInitialization_LinSpaced.cpp | ArrayXXf table(10, 4);
table.col(0) = ArrayXf::LinSpaced(10, 0, 90);
table.col(1) = M_PI / 180 * table.col(0);
table.col(2) = table.col(1).sin();
table.col(3) = table.col(1).cos();
std::cout << " Degrees Radians Sine Cosine\n";
std::cout << table << std::endl;
| ALGO | 0.932705 | 3.543272 |
2c1e8f08-8b2f-49d6-8c9d-c13a42b412e2 | DebabrataMaity/Leetcode100 | Delete and Earn.cpp | class Solution {
public:
int deleteAndEarn(vector<int>& nums) {
int dp[100001];
int maximum = -1;
memset(dp,0, size(dp));
for(int i = 0; i < nums.size(); i++)
{
dp[nums[i]]++;;
maximum = max(maximum, nums[i]);
}
if(nums.size() <= 0)
... | ALGO | 0.99979 | 4.873739 |
2a13e0ba-2931-4056-8234-77c48f4a674b | pancham1305/6companies30days | q9.cpp | // Explanation ::
// Given that we have to find i , j such that 0 <= i < j <= n - 1 and
// nums1[i] - nums1[j] <= nums2[i] - nums2[j] + diff
// Step 1::
// Rewriting the inequality--
// (nums1[i] - nums2[i]) <= (nums1[j] - nums2[j]) + diff
// Step 2::
// Make a new array/vector c which stores nums1[i]-nums2[i].
// or ... | ALGO | 0.999986 | 5.720944 |
d6bcee60-c023-4390-a685-417ee8d5d20b | youlive789/AlgorithmStudy | euler/first/2.cpp | #include <iostream>
using namespace std;
int cache[4000000];
int fibo(int n) {
if (n == 1) {
return 1;
}
else if (n == 2) {
return 2;
}
else {
if (cache[n]) {
return cache[n];
}
else {
return cache[n] = fibo(n - 1) + fibo(n - 2);
... | ALGO | 0.999984 | 4.963788 |
5382f28a-76f5-4187-9b63-56dca8bf43e5 | adit2005/LEETCODE-CPP-DSA-QUESTIONS | 3406-find-all-possible-stable-binary-arrays-i/find-all-possible-stable-binary-arrays-i.cpp | class Solution {
public:
int MOD = 1e9 + 7;
int limit;
vector<vector<vector<vector<int>>>> dp;
int f(int z, int o, int prev, int cons){
if(z<0 || o<0 || cons > limit) return 0;
if(z==0 && o==0) return 1;
if(dp[z][o][prev][cons] != -1) return dp[z][o][prev][cons];
... | ALGO | 0.999894 | 5.023979 |
bf5ec800-3fd5-417b-8b82-3d211e92141a | Zhark1561/Small-Assignments | SmallAssignments/reversecollection/sauce.cpp | #include <iostream>
// Reverse Collection
int findLengthOf(char* string)
{
bool foundLength{false};
int length{0};
while (!foundLength)
{
if (string[length] == 0)
{
foundLength = true;
}
else
{
length++;
}
}
return length;
}
char* reverseString(char* string)
{
int length{ findLengthOf(string)... | ALGO | 0.98417 | 4.837363 |
774f4b76-b0a0-4471-b89e-de7e620bdd5b | Chaynik7101/Archiver | CodingTree.cpp | #include "CodingTree.h"
bool Branch_ptr_compare::operator () (const Branch* l, const Branch* r) const
{
return *l > *r;
}
Branch::Branch()
{
let = 0;
freq = 0;
lb_0 = nullptr;
rb_1 = nullptr;
}
bool Branch::operator > (const Branch& b) const
{
return freq > b.freq;
}
bool Branch::operator < (const Branch& b) ... | ALGO | 0.997157 | 3.748571 |
17c47b8f-bbc9-49b1-9503-757f4b9dd49c | davidstone/bounded-integer | source/bounded/arithmetic/modulus.cpp | export module bounded.arithmetic.modulus;
import bounded.arithmetic.extreme_values;
import bounded.arithmetic.min_max;
import bounded.arithmetic.safe_abs;
import bounded.bounded_integer;
import bounded.comparison;
import bounded.minmax;
import bounded.homogeneous_equals;
import bounded.integer;
import bounded.normaliz... | ALGO | 0.962913 | 7.237034 |
baefa05d-924b-460f-9f8d-9e0317be0d16 | Henrik-Yao/NEUQ-ACM-Solution | winter-day3/韩涵/图的创建 .cpp | #include<iostream>
#include<vector>
#include<algorithm>
#include<string.h>
using namespace std;
vector<int>v[20020];
int m, temp[20020], mem[20020];
struct edge
{
int to;
int next;
int weight;
}e[20010];
void add(int x, int y, int z)
{
++m;
v[x].push_back(m);
e[m].to = y;
e[m].next = x;
e[m].weight = z;
}
i... | ALGO | 0.999764 | 3.543601 |
6370c93b-19c2-4194-af57-bff858ab5816 | pawan-nirpal-031/Algorithms-And-ProblemSolving | Active/Training/Training1000-1400/Xor_Palindrome.cpp | // Problem Link :
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;
#define Mod 1000000007
#define Infinity (ll)1e18
#define Append(a) push_back(a)
#define Pair(a,b) make_pair(a,b)
#define Clear(a) for(ll &x : a){x=0;}
#define Point(x) s... | ALGO | 0.999882 | 4.9221 |
0b4b233f-8b8f-401c-9142-f2fc207131d0 | AbhijitMotekar99/LeetCode-POTD | January 2025/03 Jan : 2270. Number of Ways to Split Array.cpp | class Solution {
public:
int waysToSplitArray(vector<int>& nums) {
// int n = nums.size();
// long long Total_sum = 0;
// int count = 0;
// for(int num : nums){
// Total_sum += num;
// }
// long long left_sum = nums[0];
// if(left_sum >= (Total_s... | ALGO | 0.999875 | 5.627414 |
3960f830-76a3-44a8-bafb-cc63dd38be34 | abhilashkasap/Say_hi_to_Algorithms | ways_to_change_n_rupees.cpp | #include<iostream>
using namespace std;
int count_total_ways( int coins[], int m, int n )
{
int i, j, x, y;
int table[n+1][m];
for (i=0; i<m; i++)
table[0][i] = 1;
for (i = 1; i < n+1; i++)
{
for (j = 0; j < m; j++)
{
x = (i-S[j] >= 0)? table[i - S[j... | ALGO | 0.999957 | 5.606371 |
8563f80f-e4db-43ff-9063-2b5f9c768b86 | amisubhankar/CppProgram | count_frequency_in_array.cpp | //given that array element's from 1-n
#include<iostream>
using namespace std;
// Function to find counts of all elements present in
// arr[0..n-1]. The array elements must be range from
// 1 to n
void findfrequency(int arr[],int n)
{
//as item range is 1 to n
//add with n+1 as it's not present
int add=n+1... | ALGO | 0.999806 | 3.968406 |
af9c4947-3f6b-49e3-a70e-e6f1ef0b109a | NyaanNyaan/library | verify/verify-yosupo-fps/yosupo-sparse-pow.test.cpp | #define PROBLEM "https://judge.yosupo.jp/problem/pow_of_formal_power_series_sparse"
//
#include "../../template/template.hpp"
//
#include "../../fps/sparse-fps.hpp"
//
#include "../../fps/ntt-friendly-fps.hpp"
#include "../../modint/montgomery-modint.hpp"
#include "../../modulo/binomial.hpp"
//
using namespace Nyaan;
u... | ALGO | 0.999514 | 4.483754 |
c03f4010-8ee2-404a-885c-a0059b7ac9db | Achal-Aggarwal/entire-src | c++/anagram.cpp | //sg
#include<stdlib.h>
#include<string.h>
#include<stdio.h>
main()
{
char * s1,* s2;
s1=(char *)malloc(sizeof(char)*26);
s2=(char *)malloc(sizeof(char)*26);
int flags[26],anagram=1,cases,i=1;
scanf("%d",&cases);
for( i=0;i<26;i++)
flags[i]=0;
while(cases--)
{
anagram=1;
scanf("%s%s",s1,s2);
if(strlen(s1)!=strlen(s2))... | ALGO | 0.999972 | 3.440002 |
958bde44-6f5c-4183-ab2b-fcdeae4c053a | saikrishna-prathapaneni/cpp_datastructure | abdul baaru lec/towerofhanoi.cpp | #include <iostream>
using namespace std;
void print( int origin, int destination){
cout<< "Move the top disk from rod"<< origin << "to rod " << destination<<endl;
}
int help(int start,int end){
if (start==0 && end==1)
return 2;
if (start==0 && end ==2)
return 1;
if (start==1&&end ==2)
return 0;
}
void move(int... | ALGO | 0.999922 | 4.742417 |
79c21007-6295-49b0-bea0-ce1d17555b43 | Junaid7200/University-Labs | Data Structures/Activity-7-Evaluation_1167/.history/Question1_20240531141420.cpp | #include <iostream>
using namespace std;
class MinHeap {
public:
int capacity;
int currentSize;
int heap*;
}
int main () {
return 0;
} | ALGO | 0.977891 | 4.346055 |
70c5f152-8193-4562-b785-6b8eab63061f | ishandutta2007/codeforces | latte0119/normal/675/A.cpp | #include<bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n)... | ALGO | 0.999958 | 3.611196 |
b3ec1692-0bfd-4e87-80b3-b9133362db8d | RiyaadHossain/XPSC-Practice | Phitron Practice/week 6/Day 2/class/C_Maximum_Median.cpp | #include <bits/stdc++.h>
using namespace std;
#define ye "YES"
#define no "NO"
#define int long long
int32_t main()
{
int n, k;
cin >> n >> k;
int arr[n];
for (int i = 0; i < n; i++)
cin >> arr[i];
sort(arr, arr + n);
int medi = n / 2;
vector<int> a(medi + 1);
for (int i = m... | ALGO | 0.999982 | 4.475277 |
5d9c2fa1-4f02-4c04-95b9-9f7490217048 | wzh1994/Exercises | courses/courses/done/17051/uva1596.cpp | #include <iostream>
#include <map>
#include <set>
#include <cstdio>
#include <string>
#include <sstream>
#include <cctype>
typedef long long LL;
using namespace std;
typedef struct node{
LL length;
map<LL, LL> value;
node() { }
node(LL x, map<LL, LL> y) :length(x), value(y) { }
}IDentifier;
map<char, IDentifier> ve... | ALGO | 0.993552 | 3.68567 |
2822fcc7-1dad-47cd-b821-d6c8cf41ffb1 | satse13/LeetCode | algoritmia/319.cpp | #include <iostream>
using namespace std;
int bulbSwitch(int n);
int main() {
return 0;
}
int bulbSwitch(int n){
return (int)sqrt(n);
} | ALGO | 0.999032 | 4.239774 |
45712cf5-6cc3-4364-a95b-8c3a005a4235 | Saiyangodgoku1/start-450 | Step-14(Graph)/4.Shortest Path algorithm/05.path_with_minimum_effort.cpp | /*
QUESTION:
Given a 2D grid of heights, find the minimum effort required to travel from the top-left corner to the bottom-right corner. The effort of a path is defined as the maximum absolute difference in heights between consecutive cells of the path.
APPROACH:
1. Use Dijkstra's algorithm to find the path with the m... | ALGO | 1 | 7.655351 |
4b1cd1e7-4fac-427f-a9cd-75ceaf812fc9 | Harshvardhan6367/C-_DSA | 20_Stack/11_GetMinimumAtPop.cpp | #include<iostream>
#include<stack>
using namespace std;
int main()
{
int arr[]={2,1,3,5,0,6};
int n=6;
stack<int>st;
for (int i = 0; i < n; i++)
{
if(st.empty())
st.push(arr[i]);
else
st.push(min(arr[i],st.top()));
}
while(!st.empty())
{
c... | ALGO | 0.999991 | 4.545043 |
03f332af-4f26-4513-814a-b4ce5daf8781 | rainwl/GeometryKit | include/igl/edge_topology.cpp | template<typename DerivedV, typename DerivedF, typename DerivedE>
IGL_INLINE void igl::edge_topology(
const Eigen::MatrixBase<DerivedV>& V,
const Eigen::MatrixBase<DerivedF>& F,
Eigen::PlainObjectBase<DerivedE>& EV,
Eigen::PlainObjectBase<DerivedE>& FE,
Eigen::PlainObjectBase<DerivedE>& EF)
{
// Only needs ... | ALGO | 0.993773 | 4.849155 |
1b372b7a-38a1-49e8-9af3-c366c709b326 | hasnain-cyber/competitive-programming | codeforces/D_Add_to_Neighbour_and_Remove.cpp | #include <bits/stdc++.h>
#define MOD 1000000007
//#define MOD 998244353
#define MIN numeric_limits<int>::min()
#define MAX numeric_limits<int>::max()
#define int long long int
#define double long double
#define endl '\n'
using namespace std;
vector<int> factors(int n) {
vector<int> ans;
for (int i = 1; i <=... | ALGO | 0.999866 | 4.840107 |
0daf4543-4128-46c9-99fa-048e6775cd5f | ApolloMonasa/DS | Algorithm_AND_DataStructure/C14_StringMatch/5.RabinKarp.cpp | /*************************************************************************
> File Name: 1.brute_force.cpp
> Author: HDU-Apollo
> Mail: <EMAIL>
> Created Time: Sun 13 Jul 2025 06:38:39 PM CST
************************************************************************/
#include<iostream>
#include<cstdio>
#include<cstd... | ALGO | 0.999867 | 4.749716 |
b98f3797-4961-4f9c-b18e-053c983db01a | dhimashertianto/hacktoberfest2022-new | c++ problems asked in interview/215. Kth Largest Element in an Array.cpp | Given an integer array nums and an integer k, return the kth largest element in the array.
Note that it is the kth largest element in the sorted order, not the kth distinct element.
Example 1:
Input: nums = [3,2,1,5,6,4], k = 2
Output: 5
Example 2:
Input: nums = [3,2,3,1,2,4,5,5,6], k = 4
Output: 4
Solution:
cla... | ALGO | 0.999985 | 5.601262 |
2ca79333-f0a7-4e98-85cb-dc36ea9a1fc9 | ming1016/DaiMingCreationToolbox | Project/UseCompiler/LeanLLVMPass/lib/MBAAdd.cpp | /*
这个 pass 基于下面这个混合布尔算术表达式对8位整数加法指令进行替换:
a + b == (((a ^ b) + 2 * (a & b)) * 39 + 23) * 151 + 111
使用方法:
$ opt -load-pass-plugin <BUILD_DIR>/lib/libMBAAdd.so --passes="mba-add" <bitcode-file>
*/
#include "MBAAdd.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/Passes/PassBuilder.h"
#in... | TOOL | 0.966414 | 7.452058 |
23959e91-5012-4c00-801b-9e674f0242c4 | ishandutta2007/codeforces | kdvinit/normal/1515/D.cpp | /*
K.D. Vinit |,,|
*/
#include<bits/stdc++.h>
using namespace std;
#define int long long
void solve()
{
int n, l, r;
cin>>n>>l>>r;
int cntl[n+1]={0}, cntr[n+1]={0};
for(int i=1; i<=l; i++)
{
int x; cin>>x;
cntl[x]++;
}
for(int i=1; i<=r; i++)
{
int x; cin>>x... | ALGO | 0.99994 | 3.480453 |
2ad27273-61d3-4722-9c0b-b3e977edf52f | xczhang07/leetcode | cpp/middle/flatten_binary_tree_to_linked_list.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
void flatten(TreeNode* root) {
if(!root)
return;
TreeNode* tempRigh... | ALGO | 0.999997 | 5.887847 |
08efb1b7-43d5-4992-9285-4d11c80cb07d | sohamsolankii/cse205-ds | assignments/02.08.2023/2652.cpp | class Solution {
public:
int sumOfMultiples(int n) {
int ans =0;
for(int i = 3; i <= n ; i++){
if(i%3 == 0 || i%5 == 0 || i%7 == 0){
ans += i;
}
}
return ans;
}
}; | ALGO | 0.999882 | 5.023169 |
35006548-a7d9-41d6-bb7f-04c1eb4974dd | ncn6mq/headless-rl | headlessrl/envs/rl/eigen-3.3.7/bench/benchEigenSolver.cpp |
// g++ -DNDEBUG -O3 -I.. benchEigenSolver.cpp -o benchEigenSolver && ./benchEigenSolver
// options:
// -DBENCH_GMM
// -DBENCH_GSL -lgsl /usr/lib/libcblas.so.3
// -DEIGEN_DONT_VECTORIZE
// -msse2
// -DREPEAT=100
// -DTRIES=10
// -DSCALAR=double
#include <iostream>
#include <Eigen/Core>
#include <Eigen/QR>
#in... | TOOL | 0.996046 | 5.772194 |
79d525df-afc8-4962-b8f1-c4b577249f76 | rohitsinghkcodes/Hacktober-CP-contributions | INTERVIEWBIT/Linked-Lists/ReverseLinkList-II.cpp | // https://www.interviewbit.com/problems/reverse-link-list-ii/
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
ListNode* Solution::reverseBetween(ListNode* A, int m, int n) {
// Do not write main() functi... | ALGO | 0.999971 | 5.736282 |
3068d320-012e-4d6f-825f-c907ca2d1e1c | cran/rayrender | src/filter.cpp |
#include "filter.h"
Float BoxFilter::Evaluate(const vec2f &p) const {
return 1.0;
}
Float TriangleFilter::Evaluate(const vec2f &p) const {
return std::max((Float)0, radius.x() - std::fabs(p.x())) *
std::max((Float)0, radius.y() - std::fabs(p.y()));
}
Float GaussianFilter::Evaluate(const vec2f &p) const {
... | ALGO | 0.997669 | 5.774589 |
69e97d29-45fb-411a-aa5c-cdd0785013ba | u-wyh/luogu-code | P5018.cpp | #include<bits/stdc++.h>
using namespace std;
const int MAXN = 1e6+5;
char ss[MAXN << 1];//м#
char a[MAXN];//ԭʼ Ҫ
int p[MAXN << 1];//뾶
int n;
struct node{
int lson,rson;
int fa;
int weight;
int sub;//ԭʼַеλ
}nums[MAXN];
void manacherss() {
n = strlen(a) * 2 + 1;
for (int i = 0, j = 0; i < n; i... | ALGO | 0.999966 | 3.719057 |
98ba8f3a-bd94-4e3c-a700-7996165a2734 | AbhishekSingh9582/book-shop | 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.998859 | 6.785645 |
f0838fc3-616a-4cc0-8aa6-c84df818b417 | ishandutta2007/codeforces | gzchenben/normal/1691/A.cpp | #include <cstdio>
#include <algorithm>
using namespace std;
int n, t, a[100005], cnt[2];
int main()
{
scanf("%d", &t);
while (t--)
{
scanf("%d", &n);
cnt[0] = cnt[1] = 0;
for (int i = 1; i <= n; i++)
{
scanf("%d", &a[i]);
cnt[a[i] % 2]++;
}
... | ALGO | 0.999893 | 4.188592 |
11341cb6-0863-41a5-99e0-d9e5144fe066 | tawhidul-33/My-code-Data-Stracture | MODULE_2 STL Vector/C_replacement.cpp | //input
// 5
// 1 -2 0 3 4
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
vector<int>v(n);
for(int i=0;i<n;i++)
{
cin>>v[i];
}
for(int i=0;i<n;i++)
{
if(v[i]<0)
{
cout<<2<<" ";
}
else if(v[i]>0)
{
cout<<... | ALGO | 0.999963 | 3.803129 |
7ed71172-f470-4481-a6b7-7b320c6e2c25 | Averesoft/DMOJ_Solutions | ccc13s3/ccc13s3.cpp | #include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
int n = 0, x, played;
set<pair<int,int> > st;
map<int,int> score;
void solve(map<int,int> score, set<pii> st){
if (st.size() == 0){
int m = 0;
for(int i = 1; i <= 4; i++){
if(i == x) continue;
m = max(m... | ALGO | 0.999799 | 4.584371 |
4c699d1d-832a-4943-ad3e-ff4caec7379b | Divyanshu9794/LeetcodePotd | 15_may 1721. Swapping Nodes in a 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* swapNodes(L... | ALGO | 0.999998 | 5.763853 |
7238022f-b046-428c-8702-bb8a63d7868b | MarkRDavison/advent-of-code | test/2018/Day12PuzzleTests.cpp | #include <catch/catch.hpp>
#include <2018/Day12Puzzle.hpp>
namespace TwentyEighteen {
TEST_CASE("2018 Day 12 Examples work", "[2018][Day12]") {
const std::vector<std::string> input = {
"initial state: #..#.#..##......###...###",
"",
"...## => #",
"..#.. => #",
".#... => #",
".#.#. => #",
".#.## => #",
".##.. =>... | TEST | 0.903723 | 6.70214 |
40d37d28-779a-4bdf-a51d-6fa3f7380c43 | NehaKushwah993/pokemon_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.998733 | 6.76775 |
0a6e198c-3a78-4ddb-a8e2-3b9f3f9cf4df | Md-Jahid-Hasan-10/Algorithm_Lab_With_OOP | Sorting/Selection_sort.cpp | #include <iostream>
using namespace std;
void selectionSort(int ar[], int n) {
for (int step = 0; step < n - 1; step++) {
int min_idx = step;
for (int i = step + 1; i < n; i++) {
if (ar[i] < ar[min_idx])
min_idx = i;
}
swap(ar[min_idx],ar[step]);
}
for(int i = 0; i < n; i++){
co... | ALGO | 0.999834 | 4.515444 |
0cf4d793-37b4-4ed6-9f47-82e01fa63c97 | ArielCoinOrg/arielcoin | src/cryptopp/integer.cpp | // integer.cpp - written and placed in the public domain by Wei Dai
// contains public domain code contributed by Alister Lee and Leonard Janke
#include "pch.h"
#include "config.h"
#if CRYPTOPP_MSC_VERSION
# pragma warning(disable: 4100)
#endif
#if CRYPTOPP_GCC_DIAGNOSTIC_AVAILABLE
# pragma GCC diagnostic ignored "-... | ALGO | 0.895717 | 6.199875 |
fa7241cd-84f8-4b9e-879c-1fdee6646077 | ishandutta2007/codeforces | gs12117/normal/290/D.cpp | #include<stdio.h>
char a[100];
int n,i;
int main(){
scanf("%s%d",a,&n);
for(i=0;a[i];i++){
if(a[i]%32<n+1){
a[i]-=32;
if(a[i]<65)a[i]+=32;
}
else{
a[i]+=32;
if(a[i]<0)a[i]-=32;
}
}
printf("%s",a);
} | ALGO | 0.999322 | 3.147155 |
2ff9d0b8-c223-4444-97ad-17b942342227 | ZouZeBin/DS.github.io | 入门篇/误差修正eps.cpp | #include<cstdio>
#include<cmath>
const double eps=1e-8;
const double pi=acos(-1.0);
#define Equ(a,b) ((fabs((a)-(b))) <(eps))
#define More(a,b) (((a)-(b))>(eps))
#define Less(a,b) (((a)-(b))<(-eps))
int main(){
double db=1.23;
// if(Equ(db,1.23000001)){
// printf("db=1.23!");
// }else{
// printf("db!=1.23!");
// }
... | ALGO | 0.997407 | 3.600069 |
f5b7242f-dd3a-4720-bc8e-7c53a5a872d8 | barkolorious/cses-solutions | Sorting_and_Searching/1641_sum_of_three_values.cpp | // barkolorious - 03 September 2024
#include <bits/stdc++.h>
using namespace std;
#define FIN(x) freopen((string(x) + ".in").c_str(), "r", stdin)
#define FOUT(x) freopen((string(x) + ".out").c_str(), "w", stdout)
#define int long long
#define pb push_back
#define fr first
#define sc second
const int N = 2e5 + 5;
... | ALGO | 0.999992 | 4.536282 |
80c6de7a-243b-4705-aab9-ea73f23ac87b | biswajit-k/DSA | leetcode/problems/solving_questions_with_brainpower/solution.cpp | class Solution {
public:
long long mostPoints(vector<vector<int>>& Q) {
int n = Q.size();
vector<long long> dp(n, 0);
dp[n - 1] = Q[n -1][0];
for(int i = n - 2; i > -1; i--)
{
dp[i] = Q[i][0] + (i + Q[i][1] + 1 < n ? dp[i + Q[i][1] + 1] : 0);
... | ALGO | 0.999799 | 5.121838 |
fbbb7595-5c5f-4e76-9020-ce48652317cd | tamimcse/leetcode-practice | C++/138-employee-importance.cpp | /*
https://leetcode.com/problems/employee-importance/
*/
class Solution {
int getImportance_inner (unordered_map<int, Employee*> &hash, int id) {
Employee *e = hash[id];
int sum = e->importance;
for (auto e : e->subordinates) {
sum += getImportance_inner(hash, e);
}
... | ALGO | 0.999807 | 6.523518 |
bf9d2149-98a9-42b1-a45d-d552144436f6 | PeterBowman/kinematics-dynamics | libraries/ScrewTheoryLib/PardosGotorSubproblems.cpp | // -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*-
#include "ScrewTheoryIkSubproblems.hpp"
#include "ScrewTheoryTools.hpp"
using namespace roboticslab;
// -----------------------------------------------------------------------------
namespace
{
KDL::Vector computeNormal(const MatrixExpone... | ALGO | 0.999967 | 5.989867 |
b10820cb-b932-46e8-bc2f-9b0ea041abe1 | kaloronahuang/KaloronaCodebase | Practices/POJ/POJ1328.cpp | // POJ1328.cpp
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
const int maxn = 1010;
struct point
{
double x, y;
bool operator<(const point &pt) const
{
return x < pt.x;
}
} stall[maxn], ranges[maxn];
int main()
{
int cnt = 1;
while (true)
{
int n, d;
bool... | ALGO | 0.99995 | 3.789321 |
5fdf602b-57b1-4e56-9f7e-5b2351ef5abb | georgeh04/media_session | example/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.998845 | 6.776823 |
417c2643-640b-4518-bf74-8f3e6dee981e | liulin2012/myLeetcode | MinimumWindowSubstring.cpp | class Solution {
public:
string minWindow(string S, string T) {
string result = "";
int length = T.length();
int min = INT32_MAX, first = 0, second = 0, match = 0;
unordered_map<char, int> windows;
for (size_t i = 0; i < T.length(); i++) {
auto iter = windows.find... | ALGO | 0.999992 | 6.75127 |
50c41abd-01c5-452f-87ce-12a7670c86e4 | ishandutta2007/codeforces | rafbill/normal/1566/D1.cpp |
#include <stdio.h>
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
template<class T, size_t... I>
void print_tuple(ostream& s, T const& a, index_sequence<I...>){
using swallow = int[];
(void)swallow{0, (void(s << (I == 0? "" : ", ") << get<I>(a)), 0)...};
}
template<cl... | ALGO | 0.999846 | 3.884386 |
323b17f0-7cb0-4cdd-8d77-3d952d547e58 | emptysoal/Deepsort-YOLOv5-TensorRT | yolov5-deepsort-tensorrt/deepsort/src/kalmanfilter.cpp | #include "kalmanfilter.h"
#include <Eigen/Cholesky>
#include <iostream>
const double KalmanFilter::chi2inv95[10] = {
0,
3.8415,
5.9915,
7.8147,
9.4877,
11.070,
12.592,
14.067,
15.507,
16.919
};
KalmanFilter::KalmanFilter() {
int ndim = 4;
double dt = 1.;
_motion_mat... | ALGO | 0.99966 | 5.695608 |
640fc1ff-b510-463b-9328-0afe7e2eee8f | VishnuDeepakvarma9860/PPS | Main 5.cpp | #include <iostream>
using namespace std;
int main()
{
int a = 2 , b = 4
//Binary AND operator
cout << "a&b is" << (a&b) << endl;
//Binary OR operator
cout << "a|b is" << (a^b) << endl;
//Binary XOR operator
cout << "a^b is" << (a^b) << endl;
//Left sift operator
cout << "a<<L is" << (a<<) <... | ALGO | 0.9626 | 3.385273 |
e9652053-bca2-4b3e-8358-496c428890d2 | denis-gubar/Leetcode | all/3365. Rearrange K Substrings to Form Target String.cpp | class Solution {
public:
bool isPossibleToRearrange(string s, string t, int k) {
int const N = s.size(), M = N / k;
vector<string> S, T;
S.reserve(k);
T.reserve(k);
for (int i = 0; i < N; ++i)
{
if (i % M == 0)
{
S.push_back({});
S.back().reserve(M);
T.push_back({});
T.back().re... | ALGO | 0.999953 | 5.934473 |
6802177b-8e68-440d-ad91-4d991293c98f | uditya-shubham/Competitive_programming_repo | A_Square.cpp | #include "bits/stdc++.h"
#define int long long
#define uint unsigned long long
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define fr(i,n) for(int i=0; i<(n); i++)
#define rep(i,a,n) for(int i=(a); i<=(n); i++)
#define nl cout<<"\n"
#define dbg(var) cout<<#var<<"="<<va... | ALGO | 0.999612 | 4.282884 |
f90e0637-c449-463c-8dab-d02f84c09c66 | suhaas02/Data-structures-and-algorithms | 714-best-time-to-buy-and-sell-stock-with-transaction-fee/best-time-to-buy-and-sell-stock-with-transaction-fee.cpp | class Solution {
public:
int helper(int ind, vector<int> &prices, int n, int buy, vector<vector<int>> &dp, int fee)
{
if(ind == n)
return 0;
if(dp[ind][buy] != -1)
return dp[ind][buy];
int profit = 0;
if(buy)
{
profit = max(-prices[ind]... | ALGO | 0.999974 | 5.559823 |
7379414e-ed70-45d7-8cc9-bc93dff3d222 | lorderikstark0/algo_ds | practice/minmax.cpp | #include <bits/stdc++.h>
using namespace std;
void maxmin(vector<int>& arr )
{
sort(arr.begin(),arr.end(),greater<int>());
int max=0;int min=0;
int si=arr.size();
for(int i=0;i<si-2;i++)
{
max =max+arr[i];
}
for(int i=1;i<si-2;i++)
{
min=min+arr[i];
}
cout << max << " "<<min;
}
int main()
{
vector<int>... | ALGO | 0.999853 | 3.757381 |
f5531136-6cdc-4f28-aa37-f08a5af8d0fa | thegamer1907/Code_Analysis | Graphs/1722.cpp | /*
I am Hunting High and Low
Diving from the sky above
Looking for, more and more, once again
I'm Hunting High and Low
Sometimes I may win, sometimes I'll lose
It's just a game that I play
After the storm there's a calm
Through the clouds shines a ray of the sun
I'm carried from all my harm
There is no one I ... | ALGO | 0.999995 | 4.163085 |
8e0fbc94-bc42-47b6-8b87-c06720e46bce | alexandraback/datacollection | solutions_5706278382862336_1/C++/Enric/a.cpp | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
#define x first
#define y second
#define PB pu... | ALGO | 0.999021 | 3.627792 |
daa95c0b-ccb4-4214-af40-ae66761a77ca | Nhatthang27/CompetitiveProgramming | Codeforces/Codeforces-Round-995/E.cpp |
#include <bits/stdc++.h>
#define int long long
#define fu(i, a, b) for (int i = a; i <= b; i++)
#define fd(i, a, b) for (int i = a; i >= b; i--)
#define pii pair<int, int>
#define pll pair<ll, ll>
#define ff first
#define ss second
using namespace std;
void solve()
{
int n, k;
cin >> n >> k;
vector<int> a... | ALGO | 0.999975 | 3.735069 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.