uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
8c1068fc-1b40-4a7d-8656-fa454501f03b | dung250804/CTDL-GT-HW | SAMSUNG/samsung-A/2.cpp | #include <iostream>
#include <vector>
using namespace std;
void dfs(int cur, bool visited[], vector<vector<int>> Ma_tran_ke) {
visited[cur] = true;
for(int s : Ma_tran_ke[cur]) {
if(!visited[s])
dfs(s, visited, Ma_tran_ke);
}
}
int countConnectedComponents(int n, vector<vector<int>> Ma... | ALGO | 0.99976 | 5.451843 |
f1798081-1a87-4743-a497-9bcaeb24ea17 | pranjal021/LeetCode_Solutions | Medium/77-Combinations.cpp | class Solution {
public:
vector<vector<int>> combine(int n, int k) {
vector<vector<int>> res;
vector<int> v;
dfs(res,v,1,n,k);
return res;
}
void dfs(vector<vector<int>> &res,vector<int> &v,int index,int n,int k){
if(v.size() == k){
res.push_back(v);
... | ALGO | 0.999976 | 6.209703 |
9eaa945d-2d25-41d0-9ce2-336ca17e1ef4 | FDU-VTS/LOL | src/fast_gicp/thirdparty/Eigen/bench/vdw_new.cpp | #include <iostream>
#include <Eigen/Core>
using namespace Eigen;
#ifndef SCALAR
#define SCALAR float
#endif
#ifndef SIZE
#define SIZE 10000
#endif
#ifndef REPEAT
#define REPEAT 10000
#endif
typedef Matrix<SCALAR, Eigen::Dynamic, 1> Vec;
using namespace std;
SCALAR E_VDW(const Vec &interactions1, const Vec &inter... | ALGO | 0.999597 | 3.521349 |
10cad51c-699a-4009-84b9-14f3ca6e8bba | alexandraback/datacollection | solutions_5708284669460480_0/C++/Thuyen/B.cpp | #include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(a) int(a.size())
#define reset(a, x) memset(a, x, sizeof(a))
#define FOR(i, a, b) for(int i = a; i <= b; ++i)
#define FORD(i, a, b) ... | ALGO | 0.999382 | 3.572595 |
3a7137d8-b137-4245-b8d3-21d76d6923d3 | IsratJahan09/LeetCode | HARD/154. Find Minimum in Rotated Sorted Array II.cpp | //this code is Given the sorted rotated array nums that may contain duplicates, return the minimum element of this array.
class Solution {
public:
int findMin(vector<int>& nums) {
int n = nums.size();
int l = 0;
int r = n-1;
if(nums[l] < nums[r])
return nums[l];
whi... | ALGO | 0.999999 | 5.988516 |
7e01f40f-c9bb-42d5-996a-96774b06755a | sahilmadaan048/Striver-From-Scratch | 13. Binary Tree/2. Medium Problems/4. Maximum path sum/main.cpp | // https://leetcode.com/problems/binary-tree-maximum-path-sum/
// https://takeuforward.org/data-structure/maximum-sum-path-in-binary-tree/
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(null... | ALGO | 0.999893 | 7.186954 |
fdd04366-c95e-49f9-991c-3cad4083ec7f | ricardoquesada/Spidermonkey | xpcom/glue/nsCRTGlue.cpp | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
#include "nsCRTGlue.h"
#include "nsXPCOM.h"
#include "nsDebug.h"
#include "prtime.h"
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <stdarg.h>
#ifdef XP_WIN
#include <io.h>
#i... | TOOL | 0.918325 | 5.974113 |
6b76b2d3-6f70-4fd6-b145-1e9c428e0d8e | RIVEIDD/DUJARDIN-DENIAU_VPO_TP2 | 3-OpenCV-DFT/dftSkeleton.cpp | #include "opencv2/core.hpp"
#include "opencv2/core/utility.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/imgcodecs.hpp"
#include "opencv2/highgui.hpp"
#include <iostream>
using namespace cv;
using namespace std;
///helping functions
Mat rotateImage(Mat src, float angle) {
// Computing the center of the i... | ALGO | 0.974475 | 6.44823 |
16011ca2-a882-451c-81ae-480e20453539 | Chenaah/Cheetah-Software-RL | user/Fun_Controller/Controllers/VisionMPC/VisionSolverMPC.cpp | #include "VisionSolverMPC.h"
#include "../convexMPC/common_types.h"
#include "VisionMPC_interface.h"
#include "VisionRobotState.h"
#include <eigen3/Eigen/Dense>
#include <cmath>
#include <eigen3/unsupported/Eigen/MatrixFunctions>
#include <qpOASES.hpp>
#include <stdio.h>
#include <sys/time.h>
#define V_BIG_NUMBER 5e10... | ALGO | 0.999736 | 3.607145 |
778a3bc2-f2d7-4780-8759-80ab21ddc59b | RGALLA208/MaximillianJUCE | Maximilian/cpp/openFrameworks/openFrameworksExamples/OSX/ofxMaximExample_0.8.4_OSX_Granular/ofxMaxim/libs/maxiFFT.cpp | #include "maxiFFT.h"
#include "maximilian.h"
#include <iostream>
#include "math.h"
using namespace std;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//F F T
///////////////////////////////////////////////////////////////////////... | ALGO | 0.995117 | 5.189462 |
1c828f3f-e6f1-467b-ad84-642ba1909480 | HaroldWSchranz/OpenGLApp-main | dep/assimp/code/PostProcessing/TextureTransform.cpp | /** @file A helper class that processes texture transformations */
#include <assimp/Importer.hpp>
#include <assimp/postprocess.h>
#include <assimp/DefaultLogger.hpp>
#include <assimp/scene.h>
#include "TextureTransform.h"
#include <assimp/StringUtils.h>
using namespace Assimp;
// -----------------------------------... | TOOL | 0.858529 | 7.719121 |
300041c9-c0bd-4966-8cbc-5127ba943194 | ty-2000/u-tokyo_ist_ci_programming_test | 2012_s/problem2.cpp |
#include<bits/stdc++.h>
using namespace std;
struct Target {
enum Direction { Left = -1, Right = 1 };
int i = 0;
int j = 4;
Direction direction = Right;
Target() {}
Target(int i, int j) : i{ i }, j{ j } {}
void move() {
if (j == 0 || j == 8) {
direction = (direct... | ALGO | 0.998738 | 4.69861 |
c5201af0-3495-4541-bec2-590fe933f5ce | MoriamAkterSwarna/AtoZ-DSA | Patterns/pattern13.cpp | #include<bits/stdc++.h>
using namespace std;
void printPattern13(int n){
int num = 1;
for (int i = 1; i <= n; i++)
{
for(int j =1; j <=i; j++){
cout << num << " ";
num++;
}
cout << endl;
}
}
int main(){
int t;
cin >> t;
for(int i = 1; i<= t; ... | ALGO | 0.999929 | 4.804359 |
37f2300b-5615-4ee3-9490-ffd11ccb4f3c | rajnikantsr/Course2 | DSA/Stack/stackIntro.cpp | /*#include<iostream>
#include<stack>
using namespace std;
class Stack{
//Properties
public:
int top;
int *arr;
int size;
Stack(int size) {
this -> size = size;
arr = new int[size];
top = -1;
}
void push(int element) {
if(size - top > 1) {
top++... | ALGO | 0.998884 | 4.493337 |
0e4f3253-7f7b-4c17-ac41-2341f4393c13 | rsln-s/aggregative-coarsening-for-multilevel-hypergraph-partitioning | packages/rythmos/test/VanderPol/VanderPolModel.cpp | //@HEADER
#include "VanderPolModel.hpp"
#ifdef Rythmos_ENABLE_Sacado
#include "Teuchos_StandardParameterEntryValidators.hpp"
#include "Sacado.hpp"
#include "Thyra_DefaultSpmdVectorSpace.hpp"
#include "Thyra_DetachedVectorView.hpp"
#include "Thyra_DetachedMultiVectorView.hpp"
#include "Thyra_DefaultSerialDenseLinea... | ALGO | 0.945455 | 5.930536 |
baec1a6a-2359-49fe-a7ed-4cc85388b1a0 | Chasel-Tsui/MMCV-DCFL | mmcv/ops/csrc/parrots/min_area_polygons_parrots.cpp | #include "min_area_polygons_pytorch.h"
using namespace parrots;
#ifdef MMCV_WITH_CUDA
void min_area_polygons_cuda_parrots(CudaContext& ctx, const SSElement& attr,
const OperatorBase::in_list_t& ins,
OperatorBase::out_list_t& outs) {
auto points... | DATA | 0.876012 | 6.78798 |
4a2a04f0-ef32-4493-992b-71e7ed903c67 | SsalHub/baekjoon | solved/14215/main.cpp | #include <iostream>
#include <cmath>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
int a, b, c, sum, hyp;
cin >> a >> b >> c;
sum = a + b + c;
hyp = max(a, max(b, c));
if (sum - hyp <= hyp)
sum = 2 * (sum - hyp) - 1;
cout << sum << "\n";
re... | ALGO | 0.999757 | 4.205518 |
b0c4519e-2243-45ad-9056-a75caa2e4082 | syncfusion/SfQtWebKit | qtwebkit/Source/WebCore/Modules/webaudio/BiquadDSPKernel.cpp | #include "config.h"
#if ENABLE(WEB_AUDIO)
#include "BiquadDSPKernel.h"
#include "BiquadProcessor.h"
#include "FloatConversion.h"
#include <limits.h>
#include <wtf/Vector.h>
namespace WebCore {
// FIXME: As a recursive linear filter, depending on its parameters, a biquad filter can have
// an infinite tailTime. In ... | TOOL | 0.869409 | 7.382944 |
5711c1a1-6e4b-49b3-9539-2bb69485dccd | cbarnson/uva | archives/books/CP3-materials/ch9/SparseTable.cpp | #include <algorithm>
#include <cmath>
#include <cstdio>
using namespace std;
#define MAX_N 1000 // adjust this value as needed
#define LOG_TWO_N 10 // 2^10 > 1000, adjust this value as needed
class RMQ { // Range Minimum Query
private:
in... | ALGO | 0.999934 | 5.070676 |
335f0362-5f04-4322-83e0-0f58e58ee723 | Lokesh-666/hangman-in-cpp.github.io | game.cpp | #include<iostream>
#include <vector>
#include "hangman_functions.h"
using namespace std;
int main(){
greet();
string codeword = "SayMyName";
string answer = "_________";
int misses =0;
vector<char> incorrect;
bool guess = false;
char letter;
while(answer != codeword && misses <7){
... | TOOL | 0.898126 | 3.572258 |
35138519-f60c-4922-bdf7-e7c7d1c10dbf | nju16szh/myleetcode | 4.寻找两个正序数组的中位数.cpp | /*
* @lc app=leetcode.cn id=4 lang=cpp
*
* [4] 寻找两个正序数组的中位数
*/
// @lc code=start
class Solution
{
public:
double findMedianSortedArrays(vector<int> &nums1, vector<int> &nums2)
{
for (int i = 0; i < nums2.size(); i++)
nums1.push_back(nums2[i]);
sort(nums1.begin(), nums1.end());
... | ALGO | 0.999965 | 6.362615 |
226f5788-7151-4afd-b658-f61349a0b667 | SharpSnake/BoostTest | BoostTest/regex.cpp | #include <iostream>
#include <string>
#include <regex>
#include <boost/regex.hpp>
#include "Macros.h"
using std::cout;
using std::endl;
using std::string;
// C++11boostͬԷֱ
//#define LIBboost
#if defined( LIBboost )
using namespace boost;
#else
using namespace std;
#endif
// ӡһƥ
void Printsmatch( const smatch &s... | TOOL | 0.893099 | 4.513982 |
0cb19f72-0a28-466b-88c8-ecef4d449463 | saikat-007/DSA | maximum-subarray/maximum-subarray.cpp | class Solution {
public:
int maxSubArray(vector<int>& n) {
int max_sum=INT_MIN;
int curr_sum=0;
for(int i=0;i<n.size();i++)
{
curr_sum += n[i];
if(curr_sum > max_sum)
max_sum=curr_sum;
if(curr_sum<0)
... | ALGO | 0.999934 | 6.117279 |
163d184f-5808-4f7f-818b-8e53f158532c | Iam-Sodhi/DSA | Dynamic Programming/2D_Dp/2_MaximalSquare.cpp | #include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <climits>
using namespace std;
//Given an m x n binary matrix filled with 0's and 1's, find the largest square containing only 1's and return its area.
// // top-down approach
int solveMem(vector<vector<char>>& matrix,int i,int j,int &maxi,vect... | ALGO | 0.999964 | 5.30446 |
888d6146-c313-44b9-967e-3d78a8468c0e | wiktoriarhlk/biblioteka | examples/example_approximation.cpp | #include "approximation.h"
#include <iostream>
#include <vector>
int main() {
std::vector<double> x_vals = { 0, 1, 2, 3, 4 };
std::vector<double> y_vals = { 1, 2.1, 3.9, 6.2, 8.1 };
std::pair<double, double> result = least_squares_approximation(x_vals, y_vals);
double a = result.first;
double b = ... | ALGO | 0.998604 | 5.314756 |
cd81d750-53fa-43f7-900c-43faa5a52de1 | Jobayed1408/XPSC-PS | week 6/day 1/Rectangular Tiling.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int t; cin>>t;
while(t--)
{
int a,b; cin>>a>>b;
if( (a%2!=0) and (b%2!=0) ) cout<<"No\n";
else cout<<"Yes\n";
}
} | ALGO | 0.999851 | 4.169437 |
8694a7cc-f046-446c-8f77-4bb69664311c | zhzh2001/Learning-public | c++实用代码/test&code/qtree1/src/dynamic_baidu/1/1.cpp | #include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
using namespace std;
const int oo=1000000;
struct node
{
int cost,maxcost;
bool isroot;
node *c[2],*f;
}P[100005],*null;
int n,m,t,dy[100005];
void update(node *p)
{
p->maxcost=p->cost;
if (p->c[0]-... | ALGO | 0.999441 | 4.152393 |
71ee2511-87e1-40d3-9fbc-15aa2eeaf5ef | raincross7/code-similarity | codes/train_code/problem136/problem136_22.cpp | #include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int inf = 1001001001;
int main(){
string s,t;
cin >> s >> t;
sort(s.begin(),s.end());
sort(t.rbegin(),t.rend());
vector<string> u = {t,s};
sort(u.begin(),u.end());
if(u[0] == s && t ... | ALGO | 0.999988 | 4.181499 |
e0a6d50c-4676-4640-a691-84fdc802cd24 | hyeseongK/AlgorithmOfC | 19.cpp | #include <stdio.h>
main(){
int a, b, big, small, mok, nmg, gcm, lcm;
scanf("%d %d", &a, &b);
if(a >= b){
big = a;
small = b;
}else{
big = b;
small = a;
}
while(1){
mok = big / small;
nmg = big - mok * small;
if(nmg == 0){
gcm = small;
lcm = a * b / gcm;
printf("%d %d", gcm, lcm);
br... | ALGO | 0.999862 | 3.480242 |
7b480f78-d135-43da-a944-b07e8a1c0d28 | iontorrent/TS | torrentR/src/findBestCafie.cpp | #include <Rcpp.h>
#include "RawWells.h"
#include "CafieSolver.h"
RcppExport SEXP findBestCafie(
SEXP measured_in,
SEXP flowOrder_in,
SEXP keyFlow_in,
SEXP trueSeq_in,
SEXP known_cf_in,
SEXP known_ie_in,
SEXP known_dr_in,
SEXP analysisMode_in,
SEXP nKeyFlow_in,
SEXP doKeyNorm_in,
SEXP doScale_in,
... | ALGO | 0.999581 | 6.155921 |
07f329bc-efc2-4f18-842c-4f3244c99e19 | lazybones1/Algorithms | 백준알고리즘/단계별로 풀어보기/14. 백트래킹/P_Number_15650.cpp | #include <iostream>
#include <vector>
using namespace std;
bool visited[9];
vector<int> v;
void solve(int sindex, int n, int m){
if(m==0){
for(int i = 0; i<v.size(); i++){
cout<<v[i]<<" ";
}
cout<<"\n";
}
for(int i = sindex; i<=n; i++){
if(visited[i]) continue;
visited[i] = true;
v... | ALGO | 0.999986 | 3.886134 |
7b5fc965-81ef-42f3-b4f1-7031ab01ef65 | nileshsah/Algorithms | ANARC09A.cpp | #include <iostream>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <limits.h>
#include <cstring>
#define ll int
#define get(a) scanf("%d", &a)
#define rep(n) for( ll i = 0; i < n; i++ )
#define repVector(v) for(vector<ll>::iterator it = v.begin(); it != v.end(); it++ )... | ALGO | 0.993596 | 3.330144 |
5e8f4806-68c8-46f6-b2ef-22029b018548 | he305/Work | Matrix/matrix.cpp | #include <iostream>
#include "matrix.h"
#include <math.h>
template class Matrix<double>;
template<class TYPE>
Matrix<TYPE>::Matrix()
{
}
template<class TYPE>
Matrix<TYPE>::~Matrix()
{
for (int i = 0; i < size[0]; i++)
{
delete mat[i];
}
delete mat;
delete size;
}
template<class TYPE>
Matrix<TYPE>::M... | ALGO | 0.991072 | 4.129345 |
106089da-5010-43e7-ba20-7620a5e8a519 | ArseniyKholod/stce_ss24_ex12 | thirdParty/eigen-3.4.0/doc/examples/TutorialInplaceLU.cpp | #include <iostream>
struct init {
init() { std::cout << "[" << "init" << "]" << std::endl; }
};
init init_obj;
// [init]
#include <iostream>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main()
{
MatrixXd A(2,2);
A << 2, -1, 1, 3;
cout << "Here is the input matrix A before decompositi... | ALGO | 0.999544 | 3.804785 |
9b6152cb-b8be-4cd3-999a-cf27c4bef726 | salonijaiswal7412/DSA | GCDusingEuclidean.cpp | int calcGCD(int n, int m){
// Write your code here.
if(m==0)
return n;
else
return calcGCD(m,n%m);
}
| ALGO | 0.999876 | 4.9089 |
af57dd43-13b2-4cac-9a84-11ddfe6c5a49 | TrifanBogdan24/Probleme-PBINFO | pbinfo/coduri-cpp/clasa-XI/cladire.cpp | // #392 - Cladire
#include <iostream>
#include <fstream>
using namespace std;
ifstream f("cladire.in");
ofstream g("cladire.out");
int n, m, nr;
unsigned long long int a[1009][1009];
int main()
{
f >> n >> m;
for (int i = 1; i <= n; i++)
a[i][1] = 1;
for (int j = 1; j <= m; j++)
... | ALGO | 0.999979 | 3.898825 |
74b94729-9d83-45a5-86f3-fc2e694971ec | gcmaidana/LeetCode-Solutions | grind75/week1/005-Valid-Palindrome-Easy/005-Valid-Palindrome-Easy.cpp | // Problem link: https://leetcode.com/problems/valid-palindrome/
class Solution {
public:
bool isPalindrome(string s) {
int l = 0;
int r = s.size() - 1;
while(l < r)
{
if (!isAlphaNumeric(s[l]))
{
l += 1;
}
else if(!is... | ALGO | 0.999668 | 6.821146 |
d773833a-2d23-41f0-850b-d6f30ef3a9fe | skylook/tensorflow_cpp | third_party/eigen3/doc/examples/function_taking_ref.cpp | #include <iostream>
#include <Eigen/SVD>
using namespace Eigen;
using namespace std;
float inv_cond(const Ref<const MatrixXf>& a)
{
const VectorXf sing_vals = a.jacobiSvd().singularValues();
return sing_vals(sing_vals.size()-1) / sing_vals(0);
}
int main()
{
Matrix4f m = Matrix4f::Random();
cout << "matrix m:... | ALGO | 0.999846 | 5.283265 |
2723c6ee-1d53-4eea-9445-e046a6b45c79 | gautamkartike333/dsa_practice | Stacks and Queues/Monotonic Stack/Aestroid-collision.cpp | Ques Link :"https://leetcode.com/problems/asteroid-collision/description/"
HINT: dekho jab -ve element aaega tab dikkat hai , +ve toh push karte jao
Code-
class Solution {
public:
vector<int> asteroidCollision(vector<int>& arr) {
int n=arr.size();
stack<int>st;
for... | ALGO | 0.999978 | 5.749527 |
d2655fd9-2732-4ef9-88bf-c76e92478fc2 | ShenaoChen/Algorithm | code/leetcode/1078.cpp | class Solution {
public:
vector<string> findOcurrences(string text, string first, string second) {
vector<string> tmp, ans;
int s = 0, e = 0;
for(int i = 0; i < text.size(); i++){
e = i;
if(text[i] == ' '){
tmp.push_back(text.substr(s,e - s));
... | ALGO | 0.999914 | 5.222993 |
fab777e5-c944-4ea7-a12c-a4abb831c82e | colin-de/vslam_sfm | thirdparty/eigen/doc/examples/QuickStart_example2_dynamic.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace Eigen;
using namespace std;
int main()
{
MatrixXd m = MatrixXd::Random(3,3);
m = (m + MatrixXd::Constant(3,3,1.2)) * 50;
cout << "m =" << endl << m << endl;
VectorXd v(3);
v << 1, 2, 3;
cout << "m * v =" << endl << m * v << endl;
}
| ALGO | 0.999415 | 3.497552 |
1548f17a-94a8-49fe-b10b-4044cd85f8e2 | kinetic-rb/kinetic-rb.github.io | code/P2024.cpp | // Please submit with C++20!
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <iostream>
#include <list>
#include <map>
#include <ranges>
#include <set>
#include <tuple>
#include <unordered_map>
#include <utility>
#include <vector>
#define sc(n) sv::iota(1) | sv::take(n)
#define same(x, y) find(x) == c... | ALGO | 0.999924 | 4.489285 |
15622505-6269-4d1d-9060-ed7d81f5e536 | KhoiBui16/28Tech_Code_Online | Data structure algorithm/Source Code DSA Contest/ThuatToanSinhKeTiep/B13_LietKeTapCon.cpp | #include<bits/stdc++.h>
using namespace std;
int a[100] , n , ok;
void ktao()
{
for(int i = 1 ; i <= n ;i++)
{
a[i] = 0;
}
}
void sinh()
{
int i = n;
while(i >= 1 && a[i] == 1)
{
a[i] = 0;
--i;
}
if(i == 0)
{
ok = 0;
}
else
{
a[i... | ALGO | 0.99998 | 4.544858 |
a5c3a921-094b-483b-bbd8-d92b03dadf9e | BangSeIn/Data_Structure_C- | SelectedSort/SelectedSort/SelectedSort.cpp | #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <limits>
#define SIZE 999
using namespace std;
int a[SIZE];
void swap(int& a, int& b) {
int tmp = a;
a = b;
b = tmp;
}
int main()
{
int n, min, index;
cout << "Give the size of Array : "; cin >> n;
cout << "\nNow give values of each elements"<<endl;
... | ALGO | 0.999946 | 3.752482 |
fc16a24c-c518-48b0-a2fa-17bd7a60194a | yeahsilver/algorithm | 백준/data_structure/1920.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int N, M;
vector<int> numbers;
bool binary_search(int value) {
int left = 0;
int right = N-1;
int mid;
while(left <= right) {
mid = (left+right)/2;
if(numbers[mid] > value) {
right = mid-1;
... | ALGO | 0.999996 | 5.412438 |
7bb484d3-b664-46d0-b747-68fd44eea76e | mew177/cpp-practice | leetcode/683 - K Empty Slots/683 - K Empty Slots/main.cpp | #include <iostream>
#include <map>
#include <algorithm>
#include <vector>
using namespace std;
class Solution {
public:
int kEmptySlots(vector<int>& bulbs, int K) {
int N = bulbs.size();
int lights[N];
map<int, int> record;
for (int i = 0; i < N; i++) {
// initialize arr... | ALGO | 0.999508 | 5.444984 |
7887d064-e52f-4177-8037-f3e5a18dcd8e | Harsh23Kashyap/LeetCode | 0198-house-robber/0198-house-robber.cpp | class Solution {
public:
int rob(vector<int>& nums)
{
int n=nums.size();
if(n==1)
return nums[0];
if(n==2)
return max(nums[0],nums[1]);
vector<int> dp(n,0);
for(int i=2;i<n;i++)
nums[i]+=*max_element(nums.begin(),nums.begin()+... | ALGO | 0.999864 | 5.713331 |
320d96cd-3c6b-4da7-b493-2f430483e2ca | hey2022/oj.tsinglanit.cn | 10789.cpp | #include <iostream>
int main() {
int max_x, max_y, s, n, n_temp, x, y;
std::string ans;
std::cin >> max_y >> max_x >> s >> n;
x = (s - 1) % max_x;
y = (s - 1) / max_x;
bool grid[max_x + 3][max_y + 3];
for (int i = 0; i < max_x + 3; ++i) {
for (int j = 0; j < max_y + 3; ++j) {
... | ALGO | 0.999937 | 4.249045 |
b7146b5d-b92d-481a-8cd1-efd2778b4a6d | ishandutta2007/codeforces | hank55663/normal/1144/F.cpp | #include<bits/stdc++.h>
#define pdd pair<double,double>
#define pii pair<int,int>
#define pll pair<LL,LL>
#define cpii const pii
#define cpdd const pdd
#define x first
#define y second
#define pb push_back
#define mp make_pair
#define sqr(x) ((x)*(x))
#define LL long long
using namespace std;
vector<int> v[200005];
in... | ALGO | 0.999979 | 3.672102 |
fe9bcb9d-d3c2-4e12-9e20-1818426b8a0e | fredwhite/Backup | 10907.cpp | #include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<vector>
using namespace std;
struct point{
int x;
int y;
};
struct dpoint{
double x;
double y;
};
struct edge{
point a;
point b;
};
edge el[30];
vector<point> s;
int cross(point a,point b,point o){
return (a.x-o.x)*(b.y-o.y)-... | ALGO | 0.999507 | 3.659515 |
5950c410-8556-41c3-a117-81a04039c417 | daksh931/DSA | 2022DSA/Array/2-Max-Min-Array.cpp | #include<iostream>
using namespace std;
void MinMax(int arr[] , int len)
{
int min = arr[0];
int max = arr[0];
for (int i = 0; i < len; i++)
{
/* code */
if (min> arr[i])
{
min = arr[i];
}
if(max<arr[i])
{
max= arr[i];
... | ALGO | 0.999542 | 3.95172 |
6a3320c7-d0b7-47a1-ba8d-4622fbc5c663 | maythiwat-archive/ENGCE117 | homework/hw11/hw11-1.cpp | #include <stdio.h>
int add( int a, int b, int c ) ;
int main() {
int a, b, c ;
printf( "Input 1 : " ) ;
scanf( "%d", &a ) ;
printf( "Input 2 : " ) ;
scanf( "%d", &b ) ;
printf( "Input 3 : " ) ;
scanf( "%d", &c ) ;
printf( "Summation = %d (Calculate by add() Function)", add( a, b, c )... | TOOL | 0.990165 | 4.103967 |
32bdadbd-ff39-4fc4-bbdf-e66cbc8d36c7 | saurabhkumar70049/DSA | practice/2_9.cpp | #include <bits/stdc++.h>
using namespace std;
void sieve(int a) {
bool arr[a+1];
memset(arr, true, sizeof(arr));
for (int i = 2; i <= a; i ++) {
if (arr[i] == true) {
for (int j = i*i; j <= a; j += i) {
arr[j] = false;
}
}
}
for (int k = 2; k ... | ALGO | 0.999778 | 4.159527 |
3e388c67-5f40-42ca-b975-8b4f56d73a4c | madeso/hopper | devel/CSGLib/src/UT_Intersection.cpp |
// Author: Greg Santucci
// Email: <EMAIL>
// Project page: http://code.google.com/p/csgtestworld/
// Website: http://createuniverses.blogspot.com/
#include "UT_Intersection.h"
#include "ML_Maths.h"
utIntersectionResult utIntersectionPosition(const mlLine & ray, const mlTriangle & plane)
{
... | ALGO | 0.997917 | 5.325714 |
11143b65-3553-44c8-8511-f0fe9f98f91b | Tsukumo3/Atcoder | ABC/004/cpp/E.cpp | #include <iostream>
#include <string>
using namespace std;
int main(){
int h1;
int h2;
cin >> h1 >> h2;
int ans;
ans = h1 - h2;
cout << ans << endl;
return 0;
} | ALGO | 0.999594 | 3.026366 |
71aa53fc-3c01-4757-8627-df03d3d511db | git-vivek29/Data-Structure-And-Algorithm | SourceCode/Lec-19.2-QuickSort/QuickSort.cpp | #include<bits/stdc++.h>
using namespace std;
int partition(int arr[],int l,int r)
{
int pivot = arr[r];
int i = l-1;
for(int j = l; j<r;j++)
{
if(arr[j] < pivot)
{
i++;
swap(arr[i],arr[j]);
}
}
swap(arr[i+1],arr[r]);
return i+1;
}
void quickSor... | ALGO | 0.999984 | 5.468717 |
f7aaf797-4be0-4283-8cdf-6ec3b2612058 | Mh291093/problem-solving-with-C- | ps22.cpp | /* Given a comparison symbol S between two numbers A and B. Determine whether it is Right or Wrong.
The comparison is as follows: A < B, A > B, A = B.
Where A, B are two integer numbers and S refers to the sign between them.
Input :-
Only one line containing A, S and B respectively
Output :-
Print "Right" if the compar... | ALGO | 0.999985 | 3.300914 |
fae16f29-6e15-4653-8855-dfbcade53b6c | Generalnuh/open-cv | modules/core/src/mean.dispatch.cpp | #include "precomp.hpp"
#include "opencl_kernels_core.hpp"
#include "opencv2/core/openvx/ovx_defs.hpp"
#include "stat.hpp"
#ifndef OPENCV_IPP_MEAN
#undef HAVE_IPP
#undef CV_IPP_RUN_FAST
#define CV_IPP_RUN_FAST(f, ...)
#undef CV_IPP_RUN
#define CV_IPP_RUN(c, f, ...)
#endif // OPENCV_IPP_MEAN
#include "mean.simd.hpp"
#i... | ALGO | 0.998969 | 5.830918 |
02a82689-1fe2-499c-a5cf-e061fe8d4809 | divjot0/CollisionsOnSHA-256 | Implementations/SHA2 - sigma analysis/creatingWDifferentialTable/wDifferentialTable.cpp | #include "SHA2Util.h"
using namespace std;
// vector<string> getSigmaDifference(vector<vector<int> > &sigma, vector<char> xDifference) {
// // vector<char> sigmaDifference = getSigmaDifferenceFormCross(sigma, xDifference);
// vector<vector<int> > influencesSigmaDifference = getInfluencesSigmaDifference(sigma, xDiff... | ALGO | 0.999783 | 4.302129 |
632915ce-f9e1-4b42-8c7f-83002e554ea9 | coding-donjake/project.persona.sv | c#/opencv-master/3rdparty/openexr/IlmImf/ImfRational.cpp | //-----------------------------------------------------------------------------
//
// Rational numbers
//
// The double-to-Rational conversion code below
// was contributed to OpenEXR by Greg Ward.
//
//-----------------------------------------------------------------------------
#include <ImfRational.h>
#include <cma... | ALGO | 0.983058 | 5.885553 |
b8b8a265-3886-45f7-b26f-8b01d8263c98 | nghiadaibui/CppND | CppND-Route-Planning-Project/src/route_model.cpp | #include "route_model.h"
#include <iostream>
RouteModel::RouteModel(const std::vector<std::byte> &xml) : Model(xml) {
// Create RouteModel nodes.
int counter = 0;
for (Model::Node node : this->Nodes()) {
m_Nodes.emplace_back(Node(counter, this, node));
counter++;
}
CreateNodeToRoadH... | ALGO | 0.932979 | 5.335826 |
bac7cbf1-cdbe-426b-9fd1-52e307f7cf5e | rom-k/topcoder | source/CubeStickers.cpp | #include <stdio.h>
#include <time.h>
#include <vector>
#include <list>
#include <set>
#include <string>
#include <iostream>
#include <fstream>
#include <algorithm>
#include <sstream>
#include <queue>
#include <map>
#include <iomanip>
#include <cmath>
#include <stack>
#include <numeric>
#include <iterator>
#include <cst... | ALGO | 0.997243 | 4.854752 |
7544c8bc-3363-4fa7-bcac-bbad4c41e5f7 | anjalipathak13/Practice-Leetcode-Question | 456-132-pattern/456-132-pattern.cpp | class Solution {
public:
bool find132pattern(vector<int>& nums) {
stack<int>s;
int k=INT_MIN;
for(int i=nums.size()-1;i>=0;i--)
{
if(nums[i]<k)
return true;
while(!s.empty() && s.top()<nums[i])
{
k=s.top();
... | ALGO | 0.99994 | 6.270086 |
d686a956-9891-4997-a173-7330673e50cc | ajaykmr8684/Leetcode | 0882-peak-index-in-a-mountain-array/0882-peak-index-in-a-mountain-array.cpp | class Solution {
public:
int peakIndexInMountainArray(vector<int>& arr) {
int n = arr.size();
int l = 0;
int r = n - 1;
while(l <= r) {
int mid = l + (r - l) / 2;
if(arr[mid] > arr[mid -1] && arr[mid] > arr[mid+1]) return mid;
else if(arr[mid] < ... | ALGO | 0.999992 | 5.856084 |
696d7cc8-ec74-436d-b64b-a9432a58651f | GunioRobot/scribe-dependencies | boost_1_41_0/libs/regex/tools/generate/tables.cpp | /*
* LOCATION: see http://www.boost.org for most recent version.
* FILE tables.cpp
* VERSION see <boost/version.hpp>
* DESCRIPTION: Generates code snippets programatically, for cut-and
* paste into regex source.
*/
#include <map>
#include <vector>
#include <string>
#i... | TOOL | 0.878526 | 4.275406 |
5197b136-ffa7-4b1d-8723-abd91213fd89 | high-performace-source/high-performance-source-classroom-hse-spring-2025-04-hse-spring-2025-actor-system-07-ydb-actor-syste | contrib/libs/llvm12/tools/llvm-xray/xray-graph-diff.cpp | #include "xray-graph-diff.h"
#include "xray-graph.h"
#include "xray-registry.h"
#include "xray-color-helper.h"
#include "llvm/ADT/iterator_range.h"
#include "llvm/Support/FormatVariadic.h"
#include "llvm/XRay/Trace.h"
using namespace llvm;
using namespace xray;
static cl::SubCommand GraphDiff("graph-diff",
... | TOOL | 0.943094 | 7.622293 |
f698ec79-36cb-4722-b2f0-1718e2eeca0c | Miles7991/ancl_px4_sls_shiyu | src/modules/flight_mode_manager/tasks/ManualPositionSmoothVel/FlightTaskManualPositionSmoothVel.cpp | #include "FlightTaskManualPositionSmoothVel.hpp"
#include <mathlib/mathlib.h>
#include <float.h>
using namespace matrix;
bool FlightTaskManualPositionSmoothVel::activate(const trajectory_setpoint_s &last_setpoint)
{
bool ret = FlightTaskManualPosition::activate(last_setpoint);
// Check if the previous FlightTask ... | ALGO | 0.978171 | 6.660531 |
a36c5519-862c-4ed9-92d1-4034dc70cc08 | lbryio/lbrycrd-dependencies | boost_1_59_0/libs/numeric/ublas/benchmarks/bench2/bench23.cpp | #include "bench2.hpp"
template<class T, int N>
struct bench_c_matrix_prod {
typedef T value_type;
void operator () (int runs) const {
try {
static typename c_matrix_traits<T, N, N>::type m1, m2, m3;
initialize_c_matrix<T, N, N> () (m1);
initialize_c_matrix<T, N, N> ... | TOOL | 0.986495 | 5.227831 |
e7af3fe7-53e4-4898-93f5-9093ba6a9925 | UjwelMukeshkumar/Machine-Test---Flutter-0.1 | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.9988 | 6.76073 |
6a67ba57-15c0-44f4-be3d-444c52f6703c | ShauryaSingh14/SummerQuestions | Questions/Array/Q004.cpp | #include <iostream>
using namespace std;
class Solution
{
public:
void swap(int arr[], int i , int j){
int temp = arr[i];
arr[i]= arr[j];
arr[j]= temp;
}
void sort012(int arr[], int n)
{
int low = 0;
int mid = 0;
int high = n-1;
while(mid<=high... | ALGO | 0.99987 | 5.903144 |
71e40e4e-1159-4b30-beef-defa2055cae5 | kevinkawchak/LLMs-Pharmaceutical | Code/C++/C++ Tutorial Source Files/17_C++_Comparison2.cpp | #include <iostream>
#include <cmath>
using namespace std;
int getMax(int num1, int num2, int num3) {
int result;
if(num1 >= num2 && num1 >= num3) {
result = num1;
} else if(num2 >= num1 && num2 >= num3){
result = num2;
} else {
result = num3;
}
return result;
}
int m... | ALGO | 0.999235 | 4.747116 |
101f6e92-23c7-44bc-9f8c-4a0cd814f2f0 | anhtncode/code | THPT/2022-2023/NGhệ An/1976/khonghoanhao.cpp | #include<bits/stdc++.h>
using namespace std;
int a,b;
bool check(int x)
{
int tu=1;
for(int y=2; y<=sqrt(x); ++y)
if(x%y==0) tu=tu+y+x/y;
if(sqrt(x)==trunc(sqrt(x))) tu=tu-sqrt(x);
if(tu>x) return true;
else return false;
}
int main(){
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
freopen("khonghoanhao.in... | ALGO | 0.999883 | 4.04653 |
38e69605-502f-4b1c-84d8-d387c77996f9 | ecwu/COMP1013_SP | Groupproject/SMGS/SMGS/sort.cpp | #include "relay.h"
int sort() {
struct stu studentList[20];
struct stuNMarks studentMarks[20];
struct stuNSum studentSum[20];
int assignmentStatus[5] = { 0,0,0,0,0 };
int stuNumber = 0;
loadStudentList(studentList, &stuNumber);
if (loadStudentMarksforInquiry(studentMarks, &assignmentStatus[0], stuNumber) == -... | ALGO | 0.999323 | 3.977541 |
32592370-46a9-4cfb-a979-006b1baca2d8 | rabelhmd/LeetCode | 2038-remove-colored-pieces-if-both-neighbors-are-the-same-color/2038-remove-colored-pieces-if-both-neighbors-are-the-same-color.cpp | class Solution {
public:
bool winnerOfGame(string colors) {
int alice = 0, bob = 0, countAlice = 0, countBob = 0;
for (auto &x: colors) {
if (x == 'A') {
if (countAlice++ >= 2) alice += 1;
countBob = 0;
} else {
if (countBob++ >... | ALGO | 0.999218 | 5.901869 |
1aeeec88-7ee0-4c46-845f-2b3d1ae52558 | akazad13/contest | Number-theory/locus ncr in mlogn.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mx 142857
ll mod = mx;
/*ll pas[mx][mx];
ll nCr(ll n, ll r)
{
if(n==r || r==0)
{
return 1;
}
if(pas[n][r]!=-1)
return pas[n][r];
pas[n][r] = (nCr(n-1,r)+nCr(n-1,r-1))%mod;
return pas[n][r];
}*/
// s... | ALGO | 0.999983 | 5.033657 |
d51c882d-cd5f-4df9-9c7d-1992d99a677b | Csiddhart/Supreme-DSA | love-bhaiya's-notes/trei class 2 code/trei class 2 code/main (26).cpp | #include <iostream>
#include<vector>
using namespace std;
class TrieNode{
public:
char data;
TrieNode* children[26];
bool isTerminal;
TrieNode(char d) {
this->data = d;
for(int i=0; i<26 ; i++) {
children[i] = NULL;
... | ALGO | 0.999946 | 4.933275 |
824b6ceb-9003-4593-8a8b-b6cd3fd6f080 | ishandutta2007/codeforces | alternatingcurrent/normal/1463/E.cpp | #include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
int n, k;
int par[300300];
int pre[300300], nxt[300300];
vector<int> v[300300];
int cnt = 0;
int deg[300300];
vector<int> ord;
int in[300300];
vector<int> cc[300300];
void trop_sort(){
// cout << "????" << endl;
ord.clear();
m... | ALGO | 0.999998 | 3.802762 |
3012cdd1-b85c-430e-9483-86b1fb1bb3bd | anmolkaur18/C-Programs | patterns/sum_seriess.cpp | #include<iostream>
using namespace std;
int main()
{
float s=0.0;
int n,i,sign=1;
cout<<"enter the number of terms\n";
cin>>n;
for(i=1;i<=n;i++)
{
s+=i*sign;
sign*=-1;
}
cout<<"the sum of series = "<<s;
return 0;
}
| ALGO | 0.999946 | 3.273028 |
f04c0e44-7ceb-4727-8bfe-61287675c2eb | OpenCalib/LiDAR2INS | eigen3/bench/perf_monitoring/gemv.cpp | #include "gemv_common.h"
EIGEN_DONT_INLINE
void gemv(const Mat &A, const Vec &B, Vec &C)
{
C.noalias() += A * B;
}
int main(int argc, char **argv)
{
return main_gemv(argc, argv, gemv);
}
| ALGO | 0.945855 | 4.484408 |
8fb58f4d-5b51-4ae0-83d2-d9b9fc3c2520 | iamjatin08/DATA-STRUCTURES | dp 1/fib.cpp | #include<iostream>
using namespace std;
int fib(int n){
if(n==0 or n == 1) return n;
return fib(n-1) + fib(n-2);
}
int fibbymem(int n, int dp[]){
if(n==0 or n==1) return n;
if(dp[n]!=0) return dp[n];
int ans =fibbymem(n-1,dp)+fibbymem(n-2,dp);
return dp[n]= ans;
}
int purefib(int n ){
double arr[n+1];
arr[0]... | ALGO | 0.999986 | 4.70535 |
aa46b7d0-2f54-4e1f-88ff-09714a530277 | NestZ/competitive-programming | AtCoder/StringTransformation.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
string s, t;cin >> s >> t;
vector<int> cnts(26);
vector<int> cntt(26);
for(char c : s)cnts[c - 'a']++;
for(char c : t)cntt[c - 'a']++;
sort(cnts.begin(), cnts.end());
sort(cntt.begin()... | ALGO | 0.999999 | 4.358336 |
c416ece3-f426-4fd9-bd73-2e83936d35e3 | Uday-Berad22/cp_practice | new_start2.0.cpp/binary_expo.cpp | #include<bits/stdc++.h>
using namespace std;
const int N=1e9+7;
int binary_expo(int a,int b){
int ans=1;
while(b){
if(b&1){
ans=(ans*1LL*a)%N;
}
a=(a*1LL*a)%N;
b>>=1;
}
return ans;
}
int main(){
int a,b;
cin>>a>>b;
cout<<binary_expo(a,b)<<endl;
... | ALGO | 0.999974 | 5.030397 |
4ef252b7-e2a5-419c-8529-04906584ac60 | ayushman-sinha/My-LeetCode-Solutions | minimum-moves-to-convert-string/Accepted/10-3-2021, 10_08_33 AM/Solution.cpp | // https://leetcode.com/problems/minimum-moves-to-convert-string
class Solution {
public:
int minimumMoves(string s) {
int moves=0;
for(int i=0;i<s.length();i++)
{
int j=i;int c=0;bool b=false;
if(s[i]!='O')
{
while(c!=3&&j<s.length())
... | ALGO | 0.999944 | 5.934329 |
3d907437-1e28-44a5-8c1c-9a30885e7350 | Yashwanth-Ramamurthi/TopoDistMF-v.1 | OGDF/src/coin/Symphony/cp_wrapper.cpp | /*===========================================================================*/
/* */
/* This file is part of the SYMPHONY MILP Solver Framework. */
/* */
... | ALGO | 0.997285 | 5.355059 |
273bb885-1baf-46d6-a6f6-3c6dc2a6f5a0 | Sid330s/useFullCodes-return-AC- | Codeforces/edu/b.cpp | #include<bits/stdc++.h>
using namespace std;
long long int n,t,ans;
string str1;
int main(){
cin>>t;
while(t--){
cin>>str1;
n=str1.length();
vector<int> counts;
ans=0;
for(int i=0;i<n;i++){
if(str1[i]=='1') ans++;
else{
if(ans) counts.push_back(ans);
ans=0;
... | ALGO | 0.999898 | 4.675905 |
497c5ef4-7758-4c82-be22-3f3c108f3673 | ThoMut/v4r | modules/keypoints/src/RigidTransformationRANSAC.cpp | /**
* $Id$
*
* Software License Agreement (GNU General Public License)
*
* Copyright (C) 2015:
*
* Johann Prankl, <EMAIL>
* Aitor Aldoma, <EMAIL>
*
* Automation and Control Institute
* Vienna University of Technology
* Gusshausstraße 25-29
* 1170 Vienn, Austria
*
* This progr... | ALGO | 0.999635 | 6.254089 |
e040fea3-926c-4f73-943d-6ef5e0a4fed0 | Peap0ds-23/Leetcode_Submissions | 63-unique-paths-ii/unique-paths-ii.cpp | class Solution {
public:
int fun(vector<vector<int>>& obstacleGrid,vector<vector<int>>& dp,int i,int j,int m,int n){
if(i==m || j==n){
return 0;
}
if(i==m-1 && j==n-1){
if(obstacleGrid[i][j]){
return 0;
}
return 1;
}
... | ALGO | 0.999872 | 5.972456 |
2bff46aa-00d2-49b9-b857-6714fc7b7fda | fool8474/ComputerVisionStudy | VisionStudy/Homogeneous.cpp | #include "Homogeneous.h"
void Homogeneous::InitHomo()
{
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 3; j++)
{
HMatrix[i][j] = 1;
}
}
initMat = false;
}
void Homogeneous::MatrixMul(float homoMatrix[3][3])
{
if (!initMat)
{
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 3; j++)
{
... | ALGO | 0.914516 | 4.208585 |
a1120a9f-049f-4a13-ac51-4d082aad0c99 | Hypxr-7/CPP-Labs | IBA-OOP/OOP-Lab-10/q2.cpp | #include <iostream>
#include <string>
#include <fstream>
#include "graph.hpp"
#include "path_finder.hpp"
#define START 1
#define END 2
using namespace std;
// .\q1.exe "Vera, Billy" "Landis, Pete"
// Above prompt gives bacon no. of 4
int main(int argc, char *argv[]){
if (argc != 3){
cerr << "Missing com... | ALGO | 0.876927 | 4.164183 |
17ebc788-7b0e-4fc1-823d-824f48c3243a | Pradeep17Jadhav/LeetCode-Questions | 714-best-time-to-buy-and-sell-stock-with-transaction-fee/714-best-time-to-buy-and-sell-stock-with-transaction-fee.cpp | class Solution {
public:
int maxProfit(vector<int>& prices, int fee) {
int res = 0;
int cur = INT_MIN;
for(int i:prices)
{
int temp = res;
res = max(res, i+cur);
cur = max(cur, temp-i-fee);
}
return res;
}
}; | ALGO | 0.999793 | 5.425502 |
9a987955-ba0c-40fb-9106-1b378c307da7 | Kawser-nerd/CLCDSA | Source Codes/AtCoder/abc036/D/2041702.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i... | ALGO | 0.999698 | 4.178067 |
fa1e030b-6fd7-4a54-8092-05e01d8e097f | RicardoStoklosa/COMP | W01/implementacao_cpp/utils.cpp | #include "includes.h"
automato read_quintuple_from_data(){
string l, aux, aux2, start_state;
char c;
vs alphabet, states, final_states;
delta_function delta;
ifstream f ("in");
l = "\0";
getline(f,l);
string name = l;
l = "\0";
getline(f,l);
for (int i = 0; i < l.size(); i++... | ALGO | 0.924416 | 3.629751 |
beb7654b-4b62-4e2a-bd87-ced0365740d8 | Samsung/js_vendor_tc | JetStream-1.1/sources/gcc-loops.cpp | #include <sys/time.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <iostream>
#include <vector>
#include <numeric>
/// This test contains some of the loops from the GCC vectrorizer example page [1].
/// Dorit Nuzman who developed the gcc vectorizer said that we can use them in our test suite.
//... | TEST | 0.850595 | 5.501767 |
ad40200a-eb4c-4614-abff-b27a7c6e5e4e | Ritik2703/Competitive-coding-tips | sort_search_problems/testFindMax.cpp | #define CATCH_CONFIG_MAIN
#include "catch.hpp"
#include <iostream>
#include <vector>
int findMaximum(std::vector<int> & arr, int low, int high) {
// subset has only one element
if ( high == low ) {
return arr[low];
}
//subset has 2 elements
if ( high - low == 1 ) {
return arr[high] > arr[low] ? arr[high] : a... | TEST | 0.947022 | 6.202334 |
c9112ef9-fdb5-4ca6-864d-ee2077d7d5bc | Jingfan-Sun/M801 | m801tqn.cpp | //-------------------------------------------------------------------
//
// File: WMASTER\DEVICES\M801\m801tdm.cpp
//
// Six-Pulse Converter Model
//
// Quadratic Integration Method
//
//-------------------------------------------------------------------
#include "stdafx.h"
#include "\wmaster\agc\agc.h"
#include "\w... | TOOL | 0.897788 | 3.083845 |
cd46f66d-1f22-4717-916e-61b06115ad00 | SCahmedmohamed/Competitive-Programming | codeforces/B. Squares and Cubes.cpp | // By Ahmed Mohamed Ibrahim . Dec/20/2021 19:32
#include<bits/stdc++.h>
using namespace std;
#define el endl
#define ll long long
#define ft float
#define ld long double
#define sfa(x) ((int)x.size())
#define _3m_Scorpion ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
void solve(){
ll n, ans = 0;
cin >> ... | ALGO | 0.999905 | 4.438211 |
e74824cf-0c9a-4edc-a614-b00473c45a64 | FaridaSaeed/Leetcode | 189-rotate-array/rotate-array.cpp | class Solution {
public:
void rotate(vector<int>& nums, int k) {
int n = nums.size();
k%=n;
reverse(nums.begin(), nums.end()-k);
reverse(nums.end()-k, nums.end());
reverse(nums.begin(), nums.end());
}
}; | ALGO | 0.99999 | 6.056911 |
a7cc95ca-74ad-4b19-95ae-42f29b277700 | vinayak0505/Data-Structures | Concatenated Words.cpp | #include "vector"
#include "string"
using namespace std;
class Node{
public:
vector<Node*> next = vector<Node*>(26);
bool isEnd = false;
};
class Solution {
Node* head;
void add(Node* node,string& word,int i){
if(word.size() == i){
node->isEnd = true;
return;
... | ALGO | 0.999845 | 5.885805 |
cf55f4f0-f524-4218-ae5e-3d31fd682b27 | emanuelpeg/codigoCpp2023 | clase8/serie/juego.cpp | #include "juego.h"
#include "seriepar.h"
#include "serieimpar.h"
#include "seriepor7.h"
#include <cstdlib>
#include <ctime>
Juego::Juego()
{
this->generar();
}
void Juego::generar()
{
if (this->serie != 0) delete this->serie;
srand(time(0));
int semilla = (rand() % 3);
switch (semilla) {
case ... | TOOL | 0.991662 | 3.32441 |
ac338207-1134-4bf3-ac70-bc6d21c41be2 | 23101123130014/learning | constructir overloading.cpp | #include <iostream>
using namespace std;
class overload
{
private:
int res;
public:
overload(int x, int y)
{
res = x+y;
}
overload(int x, int y, int z)
{
res = x*y*z;
}
int output(){
return res;
}
};
int main()
{
overload o1(23, 12);
overload o2(22, 21, 20);
cout<<o1.output();
co... | TOOL | 0.87313 | 3.952124 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.