uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
93a473ce-26b6-4d63-8a2d-691a286210fa | sailfishos-mirror/llvm-project | libcxx/test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan_op_init.pass.cpp | // UNSUPPORTED: c++03, c++11, c++14
// <numeric>
// Became constexpr in C++20
// template<class InputIterator, class OutputIterator, class T, class BinaryOperation>
// OutputIterator
// inclusive_scan(InputIterator first, InputIterator last,
// OutputIterator result,
// B... | TEST | 0.98155 | 7.335325 |
c21a1003-7422-4b9b-9880-8b0219676538 | IMWYY/algorithmING | leetCode/twoPoint/Problem862.cpp | #include <climits>
#include <deque>
#include <queue>
#include <vector>
/**
* solution1:
* keep a increasing prefix sum in a deque, apply sliding window based on
* the queue.
* see
* https://leetcode.com/problems/shortest-subarray-with-sum-at-least-k/discuss/189039/Detailed-intuition-behind-Deque-solution
*/
int ... | ALGO | 0.999916 | 6.040247 |
15fea9f9-e997-4fc6-9058-762d079b9ef3 | k-uu/TreeWFC | module.cpp | #include <fstream>
#include "module.h"
#include "prototype.h"
using prototype::Prototype;
using std::make_pair;
using std::map;
using std::endl;
namespace module {
Module::Module(unsigned x, unsigned y) {
pos_ = make_pair(x , y);
generatePrototypes();
}
void Module::collapse(Prototype &... | ALGO | 0.970645 | 5.086695 |
fbd4d6ff-a3ea-4772-a5a2-53717821d4dc | saikatcodec/CP | Virtual Jadge/J_J.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
// clang-format off
#define nl "\n"
#define ll long long
#define setbits(x) __builtin_popcountll(x)
#define zrobits(x) __builtin_ctzll(x)
#define mod 1000000007
#defin... | ALGO | 0.999943 | 4.780214 |
177abc27-8a84-470c-88c9-9cce93023920 | gorlak/panda3d-thirdparty | eigen/include/bench/benchmarkX.cpp | // g++ -fopenmp -I .. -O3 -DNDEBUG -finline-limit=1000 benchmarkX.cpp -o b && time ./b
#include <iostream>
#include <Eigen/Core>
using namespace std;
using namespace Eigen;
#ifndef MATTYPE
#define MATTYPE MatrixXLd
#endif
#ifndef MATSIZE
#define MATSIZE 400
#endif
#ifndef REPEAT
#define REPEAT 100
#endif
int mai... | ALGO | 0.977882 | 3.370773 |
60b180d8-90df-44f9-bee0-6d112cc2f4b6 | MuhammadShoaibKalim/PF-Practice-Questions | half_pyramide_after_180.cpp | #include<iostream>
using namespace std;
int main()
{
int n;
cout<<"Enter the value for rows and cols :";
cin>>n;
for(int i=1;i<=n;i++)
{
for(int j=1 ;j<=n;j++)
{
if(j<=n-i)
{
cout<<" ";
}
else
{
cout<<"*";
... | ALGO | 0.998854 | 3.514469 |
21cfea5f-8067-4ee0-9555-fad61adccfff | Yurills/2110104-Computer-Programming | Grader_05/05_String_21.cpp | //05_String_Camel_Split
#include <iostream>
#include <string>
using namespace std;
string CamelSplit(string input) {
string temp = ""; temp += input[0];
string answer = "";
for (int i=1;i<input.length();i++){
if (isupper(input[i])){
answer += temp + ", ";
temp = input[i];
... | ALGO | 0.99768 | 4.397027 |
b870e45e-dd68-4bd2-8a2a-ec71c15f99df | ankushsingh24/Striver-SDE-Sheet | Greedy Algorithm/fractional-knapsack.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
struct Item{
int value;
int weight;
};
// } Driver Code Ends
//class implemented
/*
struct Item{
int value;
int weight;
};
*/
class Solution
{
public:
bool static cmp(Item a, Item b)
{
return (double)a.value/(dou... | ALGO | 0.999987 | 5.757845 |
49db4932-0e76-49dc-99ce-6cfee1c066e3 | AoMas17/codeforces-perso | CSES/1094/accepted.cpp | #include <iostream>
#include <vector>
#include <string>
#include <bits/stdc++.h>
using namespace std;
#define init ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define FORi(a) for (int i = 0; i < a; i++)
#define FORj(a) for (int j = 0; j < a; j++)
#define FORk(a) for (int k = 0; k < a; k++)
#define ull unsigne... | ALGO | 0.999937 | 3.756072 |
dad30473-9524-4167-a0b9-b32ff6442712 | Abhi-wolf/All-DSA-Questions | Topic-Wise-cpp/Sliding_window/Length_of_longest_substring.cpp | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
/*
Given a string S, find the length of the longest substring without repeating characters.
Example 1:
Input:
S = "geeksforgeeks"
Output: 7
Explanation:
Longest substring is "eksforg".
*/
int longest_substring(string str)
{
deque<char>... | ALGO | 0.999833 | 5.670287 |
7665190c-1f9a-4c5c-85b8-a1b958539411 | DroidAITech/vslam-evaluation | ORB_SLAM2/opencv/samples/cpp/stereo_match.cpp | #include "opencv2/calib3d/calib3d.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/imgcodecs.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/core/utility.hpp"
#include <stdio.h>
using namespace cv;
static void print_help()
{
printf("\nDemo stereo matching converting L and R images into disparity and p... | ALGO | 0.989513 | 5.813172 |
bad040b1-4165-472f-b1c2-c14fc1af7600 | flinecoin/coin | src/libzerocoin/CoinSpend.cpp | /**
* @file CoinSpend.cpp
*
* @brief CoinSpend class for the Zerocoin library.
*
* @author Ian Miers, Christina Garman and Matthew Green
* @date June 2013
*
* @copyright Copyright 2013 Ian Miers, Christina Garman and Matthew Green
* @license This project is released under the MIT licen... | ALGO | 0.865916 | 6.953735 |
d311b84f-ff82-4916-ad49-3513ac2c3dd3 | ROCm/rocm-examples | Libraries/rocSPARSE/level_2/csrsv/main.cpp | #include "example_utils.hpp"
#include "rocsparse_utils.hpp"
#include <hip/hip_runtime.h>
#include <rocsparse/rocsparse.h>
#include <array>
#include <cmath>
#include <iostream>
#include <limits>
int main()
{
// 1. Setup input data.
// alpha * op(A) * y = x
// 1.0 * (... | ALGO | 0.999451 | 5.922849 |
ff9f8ef7-1da7-4962-8e2e-b2261da0b127 | zjukk/LeetCode-is-my-son | 112-PathSum.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;
class Solution {
public:
bool hasPathSum(TreeNode* root, int sum) {
if (!root) return false;
if (!root->left && !root->right && sum == root->val) return true;
return hasPathSum(root->left, sum... | ALGO | 0.999969 | 6.007425 |
256ef4b5-49b6-4638-9c71-3fade2fda374 | nasa/puma | cpp/src/utilities/solvers/ej_diffusion/ej_diffusion.cpp | #include "ej_diffusion.h"
EJ_Diffusion::EJ_Diffusion(puma::Matrix<double> *T, puma::Matrix<double> *kMat, char dir, double solverTol, int solverMaxIt, bool print, int numThreads)
{
this->T = T;
this->kMat = kMat;
this->dir = dir;
this->solverTol = solverTol;
this->solverMaxIt = solverMaxIt;
thi... | ALGO | 0.999686 | 4.752058 |
f401b31f-e489-462a-b0af-f3d092e60e6f | Zack-Xu-0419/transfer | framework/src/trajectorycli/endinobstacleoptimizer.cpp | #include "common.h"
#include "path/parameterization.h"
#include "path/endinobstaclesampler.h"
#include "core/rng.h"
#include <iostream>
#include <memory>
#include <QDebug>
const static float INVALID_COST = 10;
static float evaluateParameters(const std::vector<float> &optimalValues, const std::vector<Situation> &situ... | ALGO | 0.999084 | 5.133131 |
6780ca85-1828-4d91-9dca-c9a779cde128 | finnhobson/Computer-Graphics | glm/test/gtx/gtx_simd_mat4.cpp | ///////////////////////////////////////////////////////////////////////////////////
/// OpenGL Mathematics (glm.g-truc.net)
///
/// Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net)
/// Permission is hereby granted, free of charge, to any person obtaining a copy
/// of this software and associated documentatio... | TEST | 0.981763 | 6.438685 |
b914a29d-6c4f-4881-8b0b-ab15c05bd70d | taniskachandel/DAALab | WEEK 3/Question2.cpp | #include<iostream>
#define MAX 50
using namespace std;
int main()
{
int test_case;
cin>>test_case;
while (test_case--)
{
int arr[MAX],n,i,j,temp,minimum, comparisons=0, swaps=0;
cin>>n;
for (i=0;i<n;i++)
cin>>arr[i];
for (i=0;i<n-1;i++)
{
m... | ALGO | 0.9991 | 3.570949 |
c7b7de5a-ef92-4f2c-9ca7-68c2959be691 | Seyamalam/Codeforces | 401-600/519a-aandbandchess.cpp | #include <iostream>
#include <map>
int main(){
const int N = 8;
int total(0);
std::map<char, int> value;
value.insert(std::pair<char, int>('q', -9));
value.insert(std::pair<char, int>('r', -5));
value.insert(std::pair<char, int>('b', -3));
value.insert(std::pair<char, int>('n', -3));
v... | ALGO | 0.999268 | 5.02358 |
d4095247-3ae4-41f0-8acf-9fd82d419cbe | ishandutta2007/codeforces | timmyfeng/normal/1271/E.cpp | #include <bits/stdc++.h>
using namespace std;
long long n;
long long count(long long m) {
long long ret = 0;
long long range = 1;
while (m + range - 1 <= n) {
ret += range;
range *= 2;
m *= 2;
}
if (m <= n) {
ret += n - m + 1;
}
return ret;
}
int main() {
... | ALGO | 0.999916 | 4.234255 |
21366858-6950-404f-ab5f-4985fc7faecc | circt/llvm | clang/lib/Edit/EditedSource.cpp | #include "clang/Edit/EditedSource.h"
#include "clang/Basic/CharInfo.h"
#include "clang/Basic/LLVM.h"
#include "clang/Basic/SourceLocation.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Edit/Commit.h"
#include "clang/Edit/EditsReceiver.h"
#include "clang/Edit/FileOffset.h"
#include "clang/Lex/Lexer.h"
#includ... | TOOL | 0.873818 | 7.592973 |
135d5d7d-7b86-4b9e-9f99-011572795560 | changsongzhu/leetcode | C++/category/misc/630_h.cpp | /**
630[M]. Course Schedule III
There are n different online courses numbered from 1 to n. Each course has some duration(course length)t and closed on dth day. A course should be taken continuously for t days and must be finished before or on the dth day. You will start at the 1st day.
Given n online courses represente... | ALGO | 0.999909 | 6.116982 |
6b7fdd6d-4b12-4156-8574-76cace529bf4 | Shubhambarange/LeetCode-Top-Interview-150 | 73_set_Matrix_Zeros.cpp | Example 1:
Input: matrix = [[1,1,1],[1,0,1],[1,1,1]]
Output: [[1,0,1],[0,0,0],[1,0,1]]
Example 2:
Input: matrix = [[0,1,2,0],[3,4,5,2],[1,3,1,5]]
Output: [[0,0,0,0],[0,4,5,0],[0,3,1,0]]
Follow up:
A straightforward solution using O(mn) space is probably a bad idea.
A simple improvement uses O(m + n) space, but stil... | ALGO | 0.999696 | 6.919548 |
7cf2ee9b-59b1-489f-a280-7fb2ebf450bc | ZiadMostafaGit/Problem-solving | LeetCode/242ValidAnagram.cpp | #include <iostream>
#include <set>
#include <string>
#include <vector>
// Given two strings s and t, return true if t is an anagram of s, and false
// otherwise.
using namespace std;
class Solution {
public:
bool isAnagram(string s, string t) {
pmr::vector<int> res(265, 0);
if (s.size() != t.size()) {
... | ALGO | 0.998055 | 6.4067 |
38faa026-f90d-435e-b097-8a02281f2b86 | Samuel-fps/AAED | P1/2023/Ej3_4.cpp | #include <iostream>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#define N 10000000
using namespace std;
/* EJERCICIO 3
Utilizando rand(), escriba una funcin que genere un nmero pseudoaleatorio de coma
flotante y precisin doble en el intervalo continuo [a, b].
EJERCICIO 4
Escriba un programa que gener... | ALGO | 0.997004 | 3.696078 |
b31b6674-5c47-4a3c-b242-a1f7cc5b46e1 | taruns0203/DSA | Binary Search Tree/delete-a-bst.cpp |
#include <iostream>
#include <algorithm>
using namespace std;
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.999973 | 5.399104 |
febfa427-972a-43fc-90bc-ae9e9ec525cd | pashamata06/LR3 | Task_2.cpp | #include <iostream>
#include <cmath>
int main() {
double sum = 0.0;
double epsilon = 0.001;
int n = 1;
double d_n;
do {
d_n = 1.0 / std::pow(2, n) + 1.0 / std::pow(3, n);
sum += d_n;
n++;
} while (d_n >= epsilon);
std::cout << "Сумма ряда = " << sum << std::endl;
... | ALGO | 0.999959 | 4.129864 |
a85b2a5d-d89e-4c86-881e-09d207db8c7d | MohammadIrtisum/ds-final-lab | 6ans.cpp | /** Mohammad Irtisum
C223091
**/
//Write a program to create a Linked List of n elements and then insert an element to the list.
#include<bits/stdc++.h>
using namespace std;
struct LL{
int data;
LL*next;
};
LL *insert(LL *root,int data)
{
if(root==NULL)
{
root = new LL();
root->data ... | ALGO | 0.999777 | 4.706023 |
62c0a126-c030-4e86-9a4c-7cb38b474028 | iliyian/vjudge.net | 611325/A.cpp | #include <bits/stdc++.h>
#define int long long
using namespace std;
int n;
int h(const Node &x, const Node &y) {
for (int j = 1; j <= n + 1; j++) {
for (int i = 1; i <= 3; i++) {
}
}
};
struct Node {
int dis;
vector<vector<int>> a;
bool operator < (const Node &b) const {
return dis + h(*this) ... | ALGO | 0.999827 | 3.585654 |
d64c8b2f-6978-4aa1-8457-42d5b5c4c909 | imerfanahmed/DSA--CSE-2101 | linearSearch.cpp | // Linear Search in C++
#include <iostream>
using namespace std;
int search(int array[], int n, int x) {
// Going through array sequencially
for (int i = 0; i < n; i++)
if (array[i] == x)
return i;
return -1;
}
int main() {
int array[] = {2, 4, 0, 1, 9};
int x;
cin>>x;
int n = sizeof(array) ... | ALGO | 0.999464 | 5.140204 |
df1f37b5-f039-4153-8c02-4fb618a8892f | DBGroup-SUSTech/corograph | libcoro/src/GraphHelpers.cpp | #include <galois/graphs/GraphHelpers.h>
namespace galois {
namespace graphs {
namespace internal {
uint32_t determine_block_division(uint32_t numDivisions,
std::vector<unsigned>& scaleFactor) {
uint32_t numBlocks = 0;
if (scaleFactor.empty()) {
// if scale factor isn't speci... | ALGO | 0.953076 | 7.595084 |
7c67ab94-a409-495c-9c93-7c5bd5894706 | Troversones/prog2cpp | zhgyakprog2/STLalgoritmus1/feladat.cpp | #include<algorithm>
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<vector>
using namespace std;
#ifndef TEST_BIRO
#define TEST_KEDVENC_SZAMOK
#define TEST_UVEGGOLYOK
#define TEST_UTICELOK
//#define TEST_NAGY_KEZDOBETU
//#define TEST_PENZVALTAS
#endif // TEST_BIRO
#ifdef TEST_KEDVE... | ALGO | 0.995241 | 4.590514 |
6789348a-858f-459e-b912-98b5a043cbce | getong/flutter_workspace_example | device_preview_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.998936 | 6.76775 |
25f06ae8-b0ad-4c49-9879-c3780fccb2e1 | 81-28/AtCoder | archive/25_08_20/abc394_f_DFS.cpp | // https://atcoder.jp/contests/abc394/tasks/abc394_f
#include<bits/stdc++.h>
using namespace std;
template<typename T>
using v=vector<T>;
using vi=v<int>;
using vvi=v<vi>;
using pii=pair<int,int>;
#define rep1(i,n) for(int i=1;i<=(int)(n);++i)
#define pb push_back
#define rall(v) v.rbegin(),v.rend()
template<typename... | ALGO | 0.999689 | 4.529235 |
2616e80e-bb2a-4cae-a463-64134d54e785 | util6/cpp-algorithm-code | AcWing3492LoadBalancer.cpp | //
// Created by 刘宇韬 on 2022/2/27.
//
#include "bits/stdc++.h"
using namespace std;
typedef long long LL;
const int N = 200010;
struct Node{
int id,end,w;
bool operator <(const Node& x){
return end<x.end;
}
};
int v[N];
priority_queue<Node,vector<Node>,greater<Node>>q;
int n,m;
int main(){
cin>>n>>m;
for... | ALGO | 0.999835 | 4.45237 |
b4d002ac-73e8-470a-b48b-98439c41f232 | drewbriley/Monte-Carlo_AdvMat_DomainSizeMeasurements | src/Lattice_3D.cpp | #include "Lattice.h"
namespace monteCarlo {
double Lattice::gaussian(double sigma, double mean)
/**Doc String:
*This function uses Marsaglia Polar Method to calculate a value within a gaussian distribution
*Input:
* standard deviation of gaussian distribution
* average of gaussian distribution
*Return:
* a random val... | ALGO | 0.999664 | 4.9224 |
7d5cc712-8873-48f1-826a-917db2ecaa7b | athmanenaciri/sorting-Algorithms | mergeSort/mergeSort.cpp | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* mergeSort.cpp :+: :+: :+: ... | ALGO | 0.99972 | 5.263174 |
eb2b87a5-1db7-491a-b1cd-d32820a0b28a | KayG2310/learning-cpp | DSA sheet/Heaps/heap sort.cpp | #include<iostream>
using namespace std;
void heapify(int *arr, int n, int i){
int largest = i;
int left = 2*i;
int right = 2*i +1;
if(left <=n && arr[left]>arr[largest]){
largest = left;
}
if(right<=n && arr[right]>arr[largest]){
largest = right;
... | ALGO | 0.999967 | 4.410071 |
ff6b2b09-9857-444a-a7d2-89fb4c483908 | Parth-K-15/100-days-of-DSA | 912. Sort an Array.cpp | Given an array of integers nums, sort the array in ascending order and return it.
You must solve the problem without using any built-in functions in O(nlog(n)) time complexity and with the smallest space complexity possible.
Example 1:
Input: nums = [5,2,3,1]
Output: [1,2,3,5]
Explanation: After sorting the array, t... | ALGO | 0.999996 | 5.827261 |
740c81ed-4007-4b52-a7fe-b03e45042166 | ZZAMBAs/baekjoon | two-pointers/problem_1253.cpp | /*
//
// Created by cho on 23. 1. 7.
// 최적 풀이는 투 포인터이다: https://imnotabear.tistory.com/382
#include <iostream>
#include <map>
#include <vector>
using namespace std;
int N, A[2000], K;
map<int, vector<int>> m; // 값, 값의 idx들
bool visited[2000];
int main(){
cin >> N;
for (int i = 0; i < N; ++i) {
cin >>... | ALGO | 0.9999 | 4.580116 |
5cd7129b-ae27-4355-a096-d5b834891771 | BbaekGiwon/Baekjoon_GWB | baekjoon-26069.cpp | #include <iostream>
#include <set>
#include <cstring>
#include <algorithm>
using namespace std;
int main(void) {
int n,cnt=1;
set<string> rainbow;
rainbow.insert("ChongChong");
cin >> n;
for(int i=0; i<n; i++) {
string a, b;
cin >> a >> b;
if(find(rainbow.begin(), rainbow.end(), a)!=rainbow.end()) {
if(... | ALGO | 0.999947 | 4.274339 |
a1207096-f3f4-47b1-9293-577a1db01a2d | GopiPallapu/STRIVERSDESOLUTIONS | 0121-best-time-to-buy-and-sell-stock/0121-best-time-to-buy-and-sell-stock.cpp | class Solution {
public:
int maxProfit(vector<int>& prices) {
int minPrice = INT_MAX ;
int maxProfitObtained = INT_MIN ;
for(int i =0 ; i<prices.size() ; i++)
{
minPrice = min(minPrice , prices[i]) ;
maxProfitObtained = max(maxProfitObtained , prices[i]- minP... | ALGO | 0.999579 | 6.049878 |
5d20d3ab-9da5-46a2-af00-b2fd526589ad | LeoJY/Leetcode | 163_Missing_Ranges.cpp | //163. Missing Ranges
//Given a sorted integer array where the range of elements are in the inclusive range [lower, upper], return its missing ranges.
class Solution {
public:
vector<string> findMissingRanges(vector<int>& nums, int lower, int upper) {
int n = nums.size();
vector<string> result;
... | ALGO | 0.999397 | 5.305147 |
fb8bdbb8-54dd-4add-9088-48249bbcd146 | Theprovat/RETAIL-MAN-POS | 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 |
ecec139e-1b11-4f60-8551-09b840e9352d | riteshbirthal/Coding-Problem-Solutions | LeetCode Solutions/Year-2024/November/3-November/solution.cpp | class Solution {
public:
bool rotateString(string s, string goal) {
if(s.size()!=goal.size()) return false;
int n = s.size(), flag;
for(int i = 0; i < n; i++){
flag = 1;
for(int j = i; j < i+n && flag; j++){
if(s[j%n]!=goal[j-i]) flag = 0;
... | ALGO | 0.999943 | 5.744207 |
a3584606-25e5-467c-95c7-cdf8f220bdb5 | THROUGH-REALITY/testCell_1 | include/printCell.cpp | #include "printCell.hpp"
#include "firstCell.hpp"
#include <fstream>
#include <string>
void printCell(int fileCount, int timeCount, int remain){
std::ofstream writing_file;
std::string filename = "result_" + std::to_string(fileCount) + ".txt";
writing_file.open(filename, std::ios::app);
writing_file <<... | TOOL | 0.859667 | 3.725252 |
08058d0a-220e-4700-84de-4013a543edd9 | piotrcurious/esp8266_solar_battery_monitor | lead_acid_junkbox/voltage_epaper/junkbox/graph_compressor/multipoly/multi_poly4/fix2.cpp | // Fixed polynomial evaluation to match logging time scale
float evaluatePolynomial(const float *coefficients, float t) {
// t is already in milliseconds within the segment's time delta range
float result = 0.0;
float tPower = 1.0; // t^0 = 1
for (int i = 0; i < 6; i++) {
result += coeffi... | ALGO | 0.999185 | 5.217549 |
52e49368-358d-493e-9bf2-b2899c263283 | Pulakesh5/_DSA_ | June 22/10 June/Help a Thief!!! gfg.cpp | class Solution {
public:
int maxCoins(int A[], int B[], int T, int N) {
vector<pair<int,int>> vp(N);
for(int i=0;i<N;i++)
vp[i]={B[i],A[i]};
sort(vp.begin(), vp.end());
reverse(vp.begin(),vp.end());
int capacity=T,quantity=0;
int ans=0;
... | ALGO | 0.999869 | 4.133205 |
93ce870e-44b3-4efb-80e8-f7b66d0229fa | ITC-Vanadzor/ITC-7 | Hakob_Torosyan/JNI/Math.cpp | #include "Math.h"
/*
* Class: Math
* Method: getFactorial
* Signature: (I)J
*/
JNIEXPORT jlong JNICALL Java_Math_getFactorial
(JNIEnv * jenv, jobject jobj, jint num)
{
long factorial = 1;
for(int i = 1; i <= num; i++)
{
factorial *= i;
}
return factorial;
}
/*
* Class: Math
* Method: get... | ALGO | 0.993693 | 5.529241 |
722bea89-da5d-45b6-91c9-16e8356a4fab | a1dv/DA | Lectrs/FirstLecture.cpp | #include <iostream>
#include <vector>
struct KV{
int key;
char value;
};
int main()
{
KV elem;
std::vector<KV> elem;
while(std::cin >> elem.key >> elem.value) {
if(max > elem.key) {
max = elem.key;
}
}
}
| ALGO | 0.998471 | 4.349567 |
8b298e0f-de4e-4e0f-9d13-814b25af2843 | TD2106/Competitive-Programming | Random contest/2017 ACM Amman Collegiate Programming Contest/B.cpp | #include <bits/stdc++.h>
#define bug(x) cout<<#x<<'='<<x<<'\n'
#define tc() int tc;cin>>tc;for(int _tc=0;_tc<tc;++_tc)
#define up(i,l,r) for(int i=l;i<=r;++i)
#define rep(i,l,r) for (int i=l;i<r;i++)
#define down(i,r,l) for(int i=r;i>=l;--i)
#define fw(file) freopen(file,"w",stdout)
#define fr(file) freopen(file,"r",st... | ALGO | 0.999948 | 4.588776 |
d1ee67da-8df4-43a9-a541-23c22ae99906 | mohdmehdi2021/CPP-programming-question-solutions | multiplication_table.cpp | /*
PROBLEM =>
Print multiplication table of 24, 50 and 29 using loop.
CODER =>
Mohd Mehdi
DATE =>
29/06/2021
*/
#include<iostream>
using namespace std;
int main(){
cout << endl << "Multiplication Table of 24 : " << endl;
for (int i = 1; i <= 10; i++)
{
cout << "24 x " << i << " = " << 24*i <<... | ALGO | 0.997408 | 3.755967 |
ed509828-1d13-4dd0-86f9-bcbf0228ec27 | AlbertiAlessandro/esercizi_vacanze_2022 | funzione_array/main.cpp | #include <iostream>
#include <ctime>
using namespace std;
void inserisci(int v[], int lunghezza){
for (int i = 0; i < lunghezza; ++i) {
cout <<"Inserisci numero " << i + 1 << endl;
cin >> v[i];
}
for (int i = 0; i < lunghezza; ++i) {
cout << v[i] << " ";
}
cout << endl;
}
... | ALGO | 0.903621 | 3.424109 |
eb08a38a-1e20-4a1e-8efc-511fac84cba4 | jpgomes98/FC-Projetos | P2/Para enviar/1a/g2p2c0.cpp | /*Projeto 2
Grupo 2
1.a*/
#include <iostream>
#include <cmath>
#include <fstream>
using namespace std;
/* Funções utilizadas no método de Runge-Kutta relativas ao movimento harmónico */
double OH_Dx (double v)
{
return v;
}
double OH_Dv (double x, double v, double w0, double lbd)
{
return -w0 * w0 * x - 2 * ... | ALGO | 0.999924 | 4.946968 |
440ee5a4-4463-4445-a276-b468449de49a | ahmedyarub/advent2021 | day13-2/main.cpp | #include <iostream>
#include <fstream>
#include <string>
const int MAX_WIDTH = 2000;
const int MAX_HEIGHT = 4000;
int dots[MAX_WIDTH][MAX_HEIGHT] = {0};
int count = 0;
void fold_x(int x) {
for (int i = 0; i < x; i++) {
for (int j = 0; j < MAX_HEIGHT; j++) {
if (dots[i][j] == 1 || dots[x * 2 -... | ALGO | 0.998957 | 5.151291 |
2032af6c-c74d-4e8c-9b46-b1795c1352c5 | HEIG-VD-Edison-Sahitaj/prg1 | pratical-work-1/montantEnToutesLettres.cpp | #include <string>
#include "math.h"
using namespace std;
// "Tableau" de conversion des valeur fait a partir d'un switch
string conversion_valeur(int number) {
switch (number) {
case 0:
return "zero";
case 1:
return "un";
case 2:
return "deux";
ca... | TOOL | 0.879845 | 3.967558 |
0504224c-88f6-46f9-8c24-cf9134ccadc2 | ishandutta2007/codeforces | kostia244/normal/1609/B.cpp | // Problem: B. William the Vigilant
// Contest: Codeforces - Deltix Round, Autumn 2021 (open for everyone, rated, Div. 1 + Div. 2)
// URL: https://codeforces.com/contest/1609/problem/B
// Memory Limit: 256 MB
// Time Limit: 2000 ms
//
// Powered by CP Editor (https://cpeditor.org)
#pragma GCC optimize("Ofast,unroll-l... | ALGO | 0.999931 | 4.660718 |
f360519a-946f-4e4d-b58f-c86ef0a4e82c | demining/BitcoinArmory-Google-Colab | cppForSwig/cryptopp/skipjack.cpp | // skipjack.cpp - modified by Wei Dai from Paulo Barreto's skipjack32.c,
// which is public domain according to his web site.
#include "pch.h"
#ifndef CRYPTOPP_IMPORTS
#include "skipjack.h"
/*
* Optimized implementation of SKIPJACK algorithm
*
* originally written by Panu Rissanen <<EMAIL>> 1998.06.24
* optimi... | ALGO | 0.999502 | 6.921281 |
803688b8-afda-4119-a426-846164b390fb | AhmedKrimi/self-driving-car-nanodegree-udacity | nd013-c6-control-starter/project/pid_controller/eigen-3.3.7/doc/examples/class_Block.cpp | #include <Eigen/Core>
#include <iostream>
using namespace Eigen;
using namespace std;
template<typename Derived>
Eigen::Block<Derived>
topLeftCorner(MatrixBase<Derived>& m, int rows, int cols)
{
return Eigen::Block<Derived>(m.derived(), 0, 0, rows, cols);
}
template<typename Derived>
const Eigen::Block<const Derive... | TOOL | 0.975532 | 5.865374 |
2adc40ce-cd49-4276-af42-98a9a09baa14 | felipeflima/CU-Boulder | CSCI 2270 - Data Structures - F19/Workspace/Assignments/Assignment-3/every.cpp | #include "CountryNetwork.hpp"
// add any other includes you need that aren't already included in CountryNetwork.hpp
using namespace std;
// implementation of class functions goes here
CountryNetwork::CountryNetwork()
{
while (head != NULL)
{
head = head->next;
}
}
/*
* Purpose: Add a new Country to the ne... | TOOL | 0.951525 | 5.431225 |
e53c3356-3089-4cfc-aeb7-1e4182fbc1c0 | RahmanMoshiur00/Problem-Solving | Contests/hstu_stl_A.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
map<string, string> dic;
string str, sec;
getline(cin, str);
while(str != ""){
stringstream ss(str);
ss>>str>>sec;
dic[sec] = str;
getline(cin, str);
}
while(cin>>str){
if(dic[str]=="") prin... | ALGO | 0.985664 | 3.353091 |
5662e4ce-3e84-4324-a4a2-78104441e955 | TimKingNF/leetcode | test/cn/62.unique-paths.cpp | //
// Created by <EMAIL> on 2020/8/30.
//
#include "gtest/gtest.h"
#include "header.h"
#include "62.unique-paths.h"
namespace LeetCode62 {
typedef tuple<int, int> ArgumentType;
typedef int ResultType;
typedef tuple<ArgumentType, ResultType> ParamType;
class LeetCode62Test : public ::testing::TestWithParam<ParamType... | TEST | 0.970796 | 5.850112 |
3f11121f-6594-4805-9646-ab5e181a6a51 | TudorCalinCS/ProblemSolvingVault | buySellStocks.cpp | #include <vector>
using namespace std;
/*
You are given an array prices where prices[i] is the price of a given stock on the ith day.
You want to maximize your profit by choosing a single day to buy one stock and choosing a different day in the future to sell that stock.
Return the maximum profit you can achieve from... | ALGO | 0.99987 | 6.102161 |
b1328be9-a395-4761-9ae3-1a81fc565320 | Victorikhe/-PROYECTO-FINAL-P_Y_M-2020_2- | PRACTICA DE METODOS NUMERICOS/FALSA POSICION.cpp | #include <stdio.h>
#include <math.h>
#include <iostream>
float f(float x)
{
system ("COLOR B");
////////////////ELECCION DE FUNCION//////////////////////////////////////
float y;
//y=2*x*cos(2*x)-(x+1)*(x+1);
y= log(x)+x*x-4;
//y=1*3-(2.71828182845904523536*x)
//y= x+2;
return y;
}
float METODO(... | ALGO | 0.999983 | 3.974588 |
787910d8-e221-420c-ad1e-ac48bee6adbb | KevinHaoranZhang/Leetcode | Sequence/q1-q99/q70-q79/q74/q74.cpp | class Solution {
public:
bool searchMatrix(vector<vector<int>>& matrix, int target) {
int row = matrix.size();
if (row == 0) {
return false;
}
int col = matrix[0].size();
if (col == 0){
return false;
}
int left = 0, right = row - 1, mid... | ALGO | 0.999931 | 6.221912 |
7c3c0d68-c788-405b-8230-3dc3897d5f6d | Ashwinviji/c-programming | 3. largest and smallest in an array.cpp | #include<stdio.h>
#include<conio.h>
int main()
{
int arr[100], n, i, small, large;
printf("Enter the number of elements you want to insert : ");
scanf("%d", &n);
for (i = 0; i < n; i++)
{
printf("Enter element %d : ", i + 1);
scanf("%d", &arr[i]);
}
small = arr[0];
large ... | ALGO | 0.998691 | 3.023601 |
d43c2e69-61a4-4c4e-ad7d-4066523448e1 | f4exb/sdrangel | sdrbase/util/crc.cpp | #include "crc.h"
// Reverse bit ordering
uint32_t crc::reverse(uint32_t val, int bits)
{
uint32_t temp;
int i;
temp = 0;
for (i = 0; i < bits; i++)
temp |= ((val >> i) & 1) << (bits - 1 - i);
return temp;
}
// Calculate CRC for specified number of bits
void crc::calculate(uint32_t data, i... | ALGO | 0.999633 | 5.001707 |
f595c544-470f-4677-9244-123728cf77ed | getdebarghya07/Competitive-Programming-Problems | Codeforces/B2_Wonderful_Coloring_2.cpp | #include <bits/stdc++.h>
#define ll long long
using namespace std;
void solve()
{
int m, k;
cin >> m >> k;
vector<int> s(m);
for (int i = 0; i < m; i++)
{
cin >> s[i];
}
set<int> st(s.begin(), s.end());
int n = s.size();
vector<int> a(26);
for (int i = 0; i < n; i++)
... | ALGO | 0.999946 | 4.292958 |
165e9e24-c28f-40eb-8c04-b571c121bc47 | jevinskie/llvm-project-jev-embedded | libcxx/test/std/algorithms/alg.modifying.operations/alg.remove/remove_copy_if.pass.cpp | // <algorithm>
// template<InputIterator InIter, OutputIterator<auto, InIter::reference> OutIter,
// Predicate<auto, InIter::value_type> Pred>
// requires CopyConstructible<Pred>
// constexpr OutIter // constexpr after C++17
// remove_copy_if(InIter first, InIter last, OutIter result, Pred pred)... | TEST | 0.925341 | 7.590181 |
2fbcdbd0-921a-40e6-b6d7-12d4f0311507 | harshitaggarwal-1999/coding_ninjas_codes | introduction to c++/lecture_4-Pattern 1/square pattern/square_pattern_3.cpp | #include<iostream>
using namespace std;
int main(){
int n;
cin >> n;
int i = 1;
while (i <= n){
int j = 1;
while (j <= n){
cout << n-j+1;
j++;
}
cout << endl;
i++;
}
}
| ALGO | 0.999931 | 3.861197 |
92c182c4-4259-4788-bd8c-32b596f14368 | deepak427/Leet-Code | 1013-fibonacci-number/1013-fibonacci-number.cpp | class Solution {
public:
int fib(int n) {
if(n == 0){
return 0;
}
if(n == 1){
return 1;
}
return fib(n - 1) + fib(n -2);
}
}; | ALGO | 0.999988 | 6.006061 |
0583be15-afe0-4bc7-8c4f-968c98c327c5 | Aryan-Gupta2003/Leetcode-solutions | bitwise_and.cpp | // Leetcode problem statement link
// https://leetcode.com/problems/bitwise-and-of-numbers-range/
// Given two integers left and right that represent the
// range [left, right], return the bitwise AND of all
// numbers in this range, inclusive.
#include <bits/stdc++.h>
using namespace std;
// Sol For Leetcode
class ... | ALGO | 0.999808 | 5.750819 |
f695af0f-ca50-496e-8126-9e2875842e83 | Sumit-7Goswami/Overview-as-CPP | op_overload_11.cpp | // program to overload logical or operator
#include <iostream>
using namespace std ;
class logical{
int x ;
public :
logical()
{
x = 0 ;
}
logical(int a)
{
x=a ;
}
bool operator&&(logical obj)
{
return (x && obj.x ) ;
}
friend bool operato... | TOOL | 0.888452 | 4.217846 |
a156499e-773a-42d6-a377-7470830fb0ad | Achal-Aggarwal/entire-src | c++/tw1.cpp | //sg
#include<iostream>
#include<stdlib.h>
using namespace std;
class Country
{
int ipodCount;
int tspCost;
int cost;
char * name;
public:
Country(int cost,int tspCost,char * name)
{
ipodCount=100;
this->tspCost=tspCost;
this->cost=cost;
this->name=name;
}
int status()
{
int temp=ipodCount;
ipodCount=100;
retu... | ALGO | 0.981576 | 3.982805 |
8681be22-0505-4593-9d7e-8c847312740f | CrealityOfficial/Ender-5S1 | Marlin/src/lcd/menu/game/maze.cpp | #include "../../../inc/MarlinConfigPre.h"
#if ENABLED(MARLIN_MAZE)
#include "game.h"
int8_t move_dir, last_move_dir, // NESW0
prizex, prizey, prize_cnt, old_encoder;
fixed_t playerx, playery;
// Up to 50 lines, then you win!
typedef struct { int8_t x, y; } pos_t;
uint8_t head_ind;
pos_t maze_walls[50] = {
... | ALGO | 0.929765 | 5.047589 |
3f69c94a-8172-4a37-bbe4-c1707d0b47f0 | udaysrinu/leetcode-solutions | leetcode-explore-challenge-card-may-leetcoding-challenge-535-week-2-may-8th-may-14th-3327.cpp | class Solution {
public:
int singleNonDuplicate(vector<int>& A) {
for(int i=0;i<A.size()-1;){
if(A[i+1]==A[i]){
i=i+2;
}
else {
return A[i];
}
}
return A[A.size()-1];
}
}; | ALGO | 0.999531 | 5.607687 |
6673920b-d168-4d66-bfef-a3f532bb52c4 | Sosuke23/LeetCode | 1917-maximum-average-pass-ratio/1917-maximum-average-pass-ratio.cpp | class Solution {
public:
double Profit(int pass, int total) {
return (double) (pass + 1) / (total + 1) - (double) pass / total;
}
double maxAverageRatio(vector<vector<int>>& classes, int K) {
priority_queue<pair<double, array<int, 2>>> PQ;
double tot = 0;
for (auto &x : class... | ALGO | 0.999806 | 5.546736 |
a0ebf003-574f-4870-bd76-aa86885c42c4 | interactivevislab/TrianglePlugin-UE5 | TrianglePlugin/Source/libigl-static/include/bfs_orient.cpp | template <typename DerivedF, typename DerivedFF, typename DerivedC>
IGL_INLINE void igl::bfs_orient(
const Eigen::PlainObjectBase<DerivedF> & F,
Eigen::PlainObjectBase<DerivedFF> & FF,
Eigen::PlainObjectBase<DerivedC> & C)
{
using namespace Eigen;
using namespace std;
SparseMatrix<int> A;
orientable_patch... | ALGO | 0.999584 | 6.204818 |
990f2d45-dc42-4586-8831-d3c5f46be8b7 | ezrazka/Competitive-Programming | Codeforces/Contests/ROUND995/E_Best_Price.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define pii pair<int, int>
#define fi first
#define se second
#define debug(x) cout << "(" << #x << " : " << x << ")\n"
#define debughere cout << "HERE\n"
void solve(){
int n, k; cin >> n >> k;
vector<int> a(n), b(n);
for (int i = 0; i < ... | ALGO | 0.999921 | 3.793103 |
635ecd01-7f48-4322-9940-7e84de7a950f | ImranPasha247/Codes | C++/Contest/Intra_IIUC Junior Team Programming contest-Spring 2025[Male]/B_Password_Check.cpp | #include<bits/stdc++.h>
using namespace std;
void solve(){
string s;
cin>>s;
int num=0,upper_Case=0,lower_Case=0,sp_Case=0;
if(s.length()<6){
cout<<"Invalid"<<endl;
return;
}else{
for(int i=0;i<s.length();i++){
// if(islower(s[i])){lower_Case+=1;}
if(... | ALGO | 0.988391 | 4.016686 |
b69d5f60-d8fa-43e0-b9d9-a2dadf6297af | ykim155/CISC2200 | CISC2200/Lab 2/Lab2.cpp | #include <iostream>
#include <string>
#include <cctype>
#include <stack>
using namespace std;
string clean(string str); // clean string to have no spaces or punctuation
stack <char> reverse (stack <char> str); // reverse stack
stack <char> stringToStack(string str); // string to vector conversion
void palindrome(stri... | TOOL | 0.960958 | 5.506677 |
bee0e54a-7b90-4762-8a4d-6a6acc2c4719 | aboda97/task_firebase | 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 |
6d56c172-ecdb-49d5-96fc-6a03d7ce008a | kumarkoushik23/cryptography | polyalphabetic substitution.cpp | #include <stdio.h>
#include <string.h>
#include <ctype.h>
void encryptVigenere(char plaintext[], char key[]);
char shiftChar(char c, int shift);
int main() {
char plaintext[100], key[100];
printf("Enter the plaintext to encrypt: ");
fgets(plaintext, sizeof(plaintext), stdin);
plaintext[strcspn(plain... | ALGO | 0.999406 | 5.015477 |
3741f4bc-ccf6-4baf-b081-17887101ea76 | LroseC/OI | Luogu/LGR-089/B/main.cpp | #include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
int T;
int n, m;
char str[1000010];
int main(void)
{
scanf("%d", &T);
while (T--) {
scanf("%d%d", &n, &m);
scanf("%s", str + 1);
if (n >= m || n == 1) puts("-1");
else {
for (int i = 1; i < n; ++i) putchar('0');
putchar('1... | ALGO | 0.999692 | 3.46937 |
ace01b04-b549-481d-bed3-5a67faebf812 | fu3mo6/leetcode_cpp | src/Easy/Tree/BST/id_617_MergeTwoBinaryTree.cpp | class Solution {
public:
TreeNode* mergeTrees(TreeNode* t1, TreeNode* t2) {
TreeNode* root = NULL;
if(t1 && t2){
root = new TreeNode(t1 -> val + t2 -> val);
root->left = mergeTrees(t1->left, t2->left);
root->right = mergeTrees(t1->right, t2->right);
... | ALGO | 0.99997 | 6.438757 |
4efc3bdb-aefd-46b3-a4fa-4dbb1a34535e | ishandutta2007/codeforces | hzkmd/normal/1503/D.cpp | #include <bits/stdc++.h>
struct Node {
int l, r;
bool st;
bool operator<(const Node &rhs) const {
return r < rhs.r;
}
};
int main() {
std::ios_base::sync_with_stdio(false);
std::cin.tie(0);
int n;
std::cin >> n;
std::vector<Node> a(n);
for (int i = 0; i < n; ++i) {
std::cin >> a[i].l >> a[i].r;
if (... | ALGO | 0.999944 | 3.89672 |
31e61412-f454-4e6e-a3f5-f2128c72bcbd | git-bauerseb/leetcode-solutions | problems/0239_sliding_max.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution {
public:
vector<int> maxSlidingWindow(vector<int>& nums, int k) {
const int n = nums.size();
vector<int> output;
pair<int,int> m_idx = maxInWindow(nums,0,k);
output.push_back(m_idx.first);
... | ALGO | 0.999931 | 5.507491 |
0b90517d-587b-4aca-9056-1d88fa68ae36 | igargaditya/Arsh-Goyal-DSA-Sheet-Solutions | BackTracking/Subsets.cpp | // Leetcode 78
class Solution
{
public:
void f(int index, vector<int> &nums, vector<int> &temp, vector<vector<int>> &ans)
{
if (index == nums.size())
{
ans.push_back(temp);
return;
}
// Take and recursion
temp.push_back(nums[index]);
f(in... | ALGO | 0.99992 | 6.267871 |
10a620ae-4adf-4193-8c2b-85df49b08b77 | KevinZeratul/leetcode | other/-698.划分为k个相等的子集.cpp | /*
* @lc app=leetcode.cn id=698 lang=cpp
*
* [698] 划分为k个相等的子集
*/
// @lc code=start
class Solution {
public:
bool canPartitionKSubsets(vector<int>& nums, int k) {
}
};
// @lc code=end
| ALGO | 0.999822 | 5.494959 |
3375fb3d-95db-402b-953d-f772811727d0 | Kabir-Narula/C--Plus-Plus-Notes | 18.ArgumentsToTheMainFunction/18.3CalculatorV1/main.cpp | #include <iostream>
int main(){
double first_number {5.0};
double second_number {33.1};
char c{'+'};
switch(c){
case '+':
std::cout << first_number << " + " << second_number << " = "
<< first_number + second_number << std::endl;
break;
case '... | TOOL | 0.970305 | 3.816053 |
02109597-dcde-437d-94cc-a55e8d6f6f1b | authuir/leetcode | algorithm/cpp/350.cpp | #include <iostream>
#include <vector>
using namespace std;
class Solution {
public:
vector<int> intersect(vector<int>& nums1, vector<int>& nums2) {
vector<int> rtn;
for (auto iter1 = nums1.begin(); iter1 != nums1.end(); iter1++)
for (auto iter2 = nums2.begin(); iter2 != nums2.end(); iter2++)
{
if (*ite... | ALGO | 0.99981 | 5.175787 |
47df7804-c77b-4ffb-b8bf-7bfe72d16a9e | rianbowgift/Algorithm_Cpp | Algorithm_Cpp/Baekjoon/Failure/BJ_9663.cpp | //#include<iostream>
//using namespace std;
//
//int n;
//
//int arr[20][20];
//int isused[20][20];
//int sum;
//
//
//void re(int a) {
//
// if (a == n) {
//
// sum++;
// return;
// }
//
//
//
//
// for (int i = a; i < n; i++) {
//
// for (int j = 0; j < n; j++) {
// bool ck = false;
// if (!isused[i][j])... | ALGO | 0.999939 | 3.546156 |
ad8a6a3b-2bab-43c4-9024-0757a9176f3a | ajay-sehrawat/leetcode | 14. Longest Common Prefix.cpp | //O(n*L) solution
class Solution {
public:
string longestCommonPrefix(vector<string>& strs) {
int n = strs.size();
string check = strs[0];
int ch_size = strs[0].size();
int ans = INT_MAX, count = 0;
int i = 1, j = 0;
while( i<n )
{
int m = strs[i].... | ALGO | 0.999979 | 5.90524 |
aec7828d-0536-409e-b36c-95dbb2f05c9d | phUR99/TEST | 프로그래머스/lv2/42747. H-Index/H-Index.cpp | #include <string>
#include <vector>
#include <algorithm>
using namespace std;
int solution(vector<int> citations) {
int answer = 0;
//내림차순으로 벡터 정렬하기
sort(citations.begin(), citations.end(), greater<int>());
//최댓값이 0이면 답은 0
if (!citations[0]) return 0;
for (int i = 0; i < citations.s... | ALGO | 0.999884 | 5.924234 |
776c1581-118a-46ca-84d1-1a70bb5ce946 | richiks/IntelligentImageSlicing | lib/StanfordCPPLib/lexicon.cpp | /*
* File: lexicon.cpp
* -----------------
* A Lexicon is a word list. This Lexicon is backed by a data
* structure called a prefix tree or trie ("try").
*
* This is a re-implementation of Lexicon. Its previous implementation used
* a pair of structures: a directed acyclic word graph (DAWG) and an STL set.
* T... | TOOL | 0.947383 | 7.105185 |
14f22f98-836a-40f0-8a05-7aabfb57247d | Aayushgupta24/Leetcode-Daily-Practice-Problem | 2762-continuous-subarrays/2762-continuous-subarrays.cpp | class Solution {
public:
long long continuousSubarrays(vector<int>& nums) {
map<int, int> freq;
int left = 0, right = 0;
int n = nums.size();
long long count = 0;
while (right < n) {
freq[nums[right]]++;
while (freq.rbegin()->firs... | ALGO | 0.999974 | 6.220987 |
99dccd84-1a3a-4133-af4b-a76f19426736 | truongcongthanh2000/CSES-Solutions | Dynamic Programming/IncreasingSubsequence.cpp | #pragma GCC diagnostic ignored "-Wunused-parameter"
#include <bits/stdc++.h>
using namespace std;
#define INP "solve"
#define OUT "solve"
const int maxP = 1e4 + 10;
const long long INF_LL = 1e17;
const int INF = 1e9 + 100;
const int MOD = 1e9 + 7;
const int Base = 30;
const long double EPS = 1e-9;
const int BLOCK = ... | ALGO | 0.999884 | 5.268879 |
d3a4d3b7-b2d0-4e6b-8636-9de818783bbb | Dr-Don/MyAntithesisLeetcode-ING | c++/88_合并两个有序数组.cpp | /*给你两个有序整数数组 nums1 和 nums2,请你将 nums2 合并到 nums1 中,使 num1 成为一个有序数组。
说明:
初始化 nums1 和 nums2 的元素数量分别为 m 和 n 。
你可以假设 nums1 有足够的空间(空间大小大于或等于 m + n)来保存 nums2 中的元素。
示例:
输入:
nums1 = [1,2,3,0,0,0], m = 3
nums2 = [2,5,6], n = 3
输出: [1,2,2,3,5,6]
指针从尾部向前
*/
#include <iostream>
#include <vector>
#include <stdlib.h>
using... | ALGO | 0.999982 | 5.045649 |
d0e813ab-1ccd-4ac9-baa0-25f5ad50e11d | anugoyal998/Parteek-Bhaiya-DSA-Code | Graph_Striver/BST.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define loop(i,st,n) for(int i=st;i<n;i++)
#define mod 1000000007
#define maxN 1000001
#define ff first
#define ss second
#define pb push_back
#define vi vector<int>
#define vvi vector<vi>
void bfs(vi arr[],vi &vis,int src){
vis[src] = 1;
que... | ALGO | 0.999987 | 4.288256 |
fde7b8d4-21db-4166-b825-3b70e2715923 | TusharGautam29/C- | LinkedList/Assignment 1.cpp | #include<iostream>
//Q1 1 pointer needs to be modified for deletion
//Q2 1 3
class ListNode {
public:
int val;
ListNode* next;
ListNode(int val) : val(val), next(nullptr) {}
};
class LinkedList {
public:
ListNode* head;
ListNode* tail;
LinkedList() : head(nullptr), tail(nullptr) {}
void ... | ALGO | 0.996323 | 4.48281 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.