uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
f5087d9f-5d8b-4e82-925e-5c82f713eb77 | ubermouser/pokemonAI | src/ranked_battlegroup.cpp | #include "../inc/ranked_battlegroup.h"
#include <algorithm>
#include <cmath>
#include <boost/functional/hash.hpp>
#include <boost/format.hpp>
#include <vector>
Battlegroup::Battlegroup(
const RankedTeamPtr& team,
const RankedEvaluatorPtr& evaluator,
const RankedPlannerPtr& planner,
const Contribution&... | ALGO | 0.926672 | 5.531094 |
78cfff49-954e-400d-9239-5362235b1fea | TruecoderSri/DSA-ProgramList | DP/matrixMultiplication.cpp | //{ Driver Code Starts
// Initial Template for C++
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
// User function Template for C++
class Solution{
public:
int solve(vector<vector<int>>&dp,int i,int j,int arr[]){
if(i>=j-1)
return 0;
if(dp[i][j]!=-1) return dp[i][j];
i... | ALGO | 0.999982 | 5.379302 |
147ca809-e0a3-4332-bd88-366d4e5d92e7 | alexfoohc/TC1017 | pro2quiz3.cpp | #include <iostream>
using namespace std;
int fibonacci (int n)
{
if (n==1) {
return 1;
}
else if (n<=0){
return 0;
}
else
{
return fibonacci(n-1)+fibonacci(n-2);
}
}
int main ()
{
int n;
char answ;
do{
cout <<"Type a number"<<endl;
cin >>n;
cout <<"The fibonacci number is "<<fibonac... | ALGO | 0.997508 | 3.816625 |
c84370e1-dcba-4a50-9883-b09e41acdc31 | vickykumar123/Data-Structure-And-Algorthim | DP/Maximum_sum_of_non-adjacent_elements.cpp | #include <bits/stdc++.h>
using namespace std;
// Using Recursion and memorization
int solveRec(vector<int> &nums, int n, vector<int> &dp)
{
// Base case
if (n < 0)
return 0;
if (n == 0)
return nums[0];
if (dp[n] != -1)
return dp[n];
int include = solveRec(nums, n - 2, dp) + n... | ALGO | 0.999982 | 5.477684 |
eaf2e7df-3e2c-4a9d-a374-7492243ef338 | erygle/Playground | cpp/Vector/vector-2.cpp | #include<iostream>
#include<vector>
using namespace std;
template <typename T>
void print(vector<T> &v);
int main(int argc, char const *argv[]){
vector <int> v1(3,5);
vector <int> v2(10);
vector <int> v3(&v2[4],&v2[7]);
vector <int> v4(v1);
/*vector <int>::iterator i = v1.begin();
while(i != ... | TOOL | 0.949497 | 3.733051 |
8dfc72a2-53d5-47be-b013-02e7789177ab | KausBoss/CP-SubGrouped | LeetCode/990.cpp | int uf_find(vector<int> &uf, int i) {
return uf[i] == -1 || uf[i] == i ? i : uf_find(uf, uf[i]);
}
bool equationsPossible(vector<string>& equations) {
vector<int> uf('z' + 1, -1);
for (auto s : equations)
if (s[1] == '=') uf[uf_find(uf, s[0])] = uf_find(uf, s[3]);
for (auto s : equations)
if (s[1] == '!... | ALGO | 0.999877 | 5.49317 |
0230a342-947a-4943-8b39-d443cd486c09 | 030831/group-stduy | 김종언/2436.cpp | #include <cmath>
#include <iostream>
#include <numeric>
using i64 = int64_t;
int main() {
std::cin.tie(nullptr)->sync_with_stdio(false);
i64 d, m;
std::cin >> d >> m;
i64 const n = d * m;
i64 a = 0x3F3F3F3F;
i64 b = 0x3F3F3F3F;
for (i64 i = 1; i * i <= n; ++i) {
if (n % i =... | ALGO | 0.999792 | 5.734882 |
866584e5-ba7b-472e-a582-1712ef94f4f2 | Farhan00755/AP-2 | Pertemuan 5/vektor.cpp | #include <iostream>
#include <vector> // header untuk vector
using namespace std;
int main() {
// vector declaratioon & initialization
vector<string> nama_karyawan = {"Farhan", "Fauzan", "dion", "tessa", "riko"}; // deklarasi
//ascending element of vector
// for(int i = 0; i < nama_karyawan.size(); i... | ALGO | 0.998505 | 3.998759 |
cf483484-55e4-40f2-9a4f-7f23309862ee | lannocc/bitcoin-abc | src/merkleblock.cpp | #include "merkleblock.h"
#include "consensus/consensus.h"
#include "hash.h"
#include "utilstrencodings.h"
CMerkleBlock::CMerkleBlock(const CBlock &block, CBloomFilter &filter) {
header = block.GetBlockHeader();
std::vector<bool> vMatch;
std::vector<uint256> vHashes;
vMatch.reserve(block.vtx.size());... | ALGO | 0.998597 | 6.303366 |
45f9c220-5bbc-4f57-b674-bdc1d4476b5c | bonizario/uri-solutions | problems/cpp/1068.cpp | #include <iostream>
#include <stack>
using namespace std;
int main() {
string expressao;
stack< char > pilha;
bool ok;
while (cin >> expressao) {
ok = true;
for (int i = 0; i < (int)expressao.size(); i++) {
if (expressao[i] == '(') {
pilha.push('(');
... | ALGO | 0.998523 | 4.81378 |
679d876e-d1f0-4397-ace3-3fc6e382302d | Horidas-Roy/Fundamental | XPSC/NewBie Zone/week - 2/problrm/mishaChangeHandle.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int n; cin >> n;
string x,y; cin >> x >> y;
set<pair<string,string>> s;
s.insert({x,y});
for(int i=0; i<n-1; i++){
cin >> x >> y;
bool flag = true;
for(auto it = s.begin(); it != s.end();){
if(it->second == ... | ALGO | 0.999804 | 3.502062 |
0bbf4a35-e53f-419b-84e3-b5920374697d | Mneach/Leetcode-Solution | 2734-lexicographically-smallest-string-after-substring-operation/2734-lexicographically-smallest-string-after-substring-operation.cpp | class Solution {
public:
string smallestString(string s) {
bool hasChange = false;
if(s[0] != 'a'){
for(int j = 0; j < s.length(); j++){
if(s[j] == 'a') break;
else s[j] = s[j] - 1;
}
hasChange = true;
... | ALGO | 0.999311 | 5.744246 |
f665ee3d-3e02-408c-99e2-a74dad62d8d2 | almondgood/BaekJun | 1021/Source.cpp | #include <iostream>
#include <deque>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
deque<int> q;
int count = 0;
int n, m;
cin >> n >> m;
for (int i = 1; i <= n; i++) {
q.push_back(i);
}
q[1] = 2;
while (m--) {
int val = 0;
cin >> val;
int in... | ALGO | 0.99993 | 3.622692 |
dff2c93e-2927-4ec6-91e5-160632f781bb | powerpower2005/allihave | Tools/Gacha/동등한 확률랜덤.cpp |
//공을 위로 동등한 확률 랜덤으로 쏘아올림.
#include <stdlib.h>
#include <math.h>
#define VIEW_WIDTH 640 // 화면 너비
#define VIEW_HEIGHT 480 // 화면 높이
#define CHAR_WIDTH 64 // 캐릭터 너비
#define CHAR_HEIGHT 64 // 캐릭터 높이
#define MAX_BALL_NUM 100 // 최대 공 수
#define VEL_WIDTH 10 // 가로방향 속도 폭
#define VEL_HEIGHT ... | TOOL | 0.914274 | 4.132254 |
c7d625e1-3bb8-4001-9340-52fc9c964752 | aditya13902/Leetcode | 841-keys-and-rooms/841-keys-and-rooms.cpp | class Solution {
public:
vector<bool>vis;
void dfs(vector<vector<int>>& rooms,int idx){
if(vis[idx]){
return;
}
vis[idx]=true;
for(auto ele:rooms[idx]){
dfs(rooms,ele);
}
}
bool canVisitAllRooms(vector<vector<int>>& rooms) {
vis.res... | ALGO | 0.999905 | 6.275268 |
e4980cb4-610c-484a-8eb4-4604c820bed0 | Shailja88/mixturee- | ak56(kickstart3).cpp | //kickstart3
#include "bits/stdc++.h"
using namespace std;
int main()
{
int n;
cin>>n;
int a[n];
for(int i=0;i<n;i++)
{
cin>>a[i];
}
const int N= 1e6+2;
int idx[N];
for(int i=0 ;i<N;i++)
{
idx[i]=-1;
}
int minidx=INT_MAX;
for(int i=0;i<n;i++)
{
... | ALGO | 0.999985 | 4.177187 |
b9c7bc8f-6519-4437-84f2-b37f6ed5aca7 | paolo-torres/interview-prep | leetcode/google/categories/matrices/count_square_submatrices_with_all_ones.cpp | /*
Given matrix of 1s & 0s, return how many square submatrices have all 1s
Subproblems = smaller submatrices, solutions make up future calculations
Optimal substructure, DP, think about "square combos", any 0 ends combo
Combo depends on all elements, combo only as strong as weakest link
Recurrence ... | ALGO | 0.999932 | 6.865112 |
43cc0525-8e8f-4ea1-8969-2182e822310c | RutvikRJ6800/DSandAlgo | AtoZ/DP/DP on Strings/Distinct Subsequences.cpp | // https://leetcode.com/problems/distinct-subsequences/
class Solution {
public:
int numDistinct(string s, string t) {
int n1 = s.size(), n2 = t.size();
vector<vector<double>> dp(n2+1, vector<double>(n1+1, 0));
for(int i=0; i<=n1; i++){
dp[0][i] = 1;
}
for(int i... | ALGO | 0.999983 | 6.861601 |
75f7e476-77a8-402b-9b28-a2a3161aa2e0 | solid0snake/SquareMatricesHandlerCpp | SquareMatrices.cpp | /*
* SquareMatrices.cpp
* By Pedro Garate on 10/17/2014
* Description: Implementation of the ADT for a Square Matrices Handler
* For this program we only consider square matrices.
* This program adds and multiplies matrices given
* that both matrices have the same size. It also
* multiplies matrices by ... | TOOL | 0.916481 | 4.276087 |
f91d6ad7-187e-4d06-a5ee-75953b1203b2 | ishandutta2007/codeforces | aid/normal/297/A.cpp | #include <iostream>
#include <string>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
string a, b;
cin >> a >> b;
int ca = 0, cb = 0;
for(size_t i = 0; i < a.length(); i++)
if(a[i] == '1')
ca++;
for(size_t i = 0; i < b.length(); i++)
if(b[i] == '... | ALGO | 0.999986 | 4.204627 |
54d5c45e-8a4e-4acd-9036-a62f82ae5596 | The-No-Hands-company/RudeBase3D | third_party/eigen/unsupported/doc/examples/MatrixPower_optimal.cpp | #include <unsupported/Eigen/MatrixFunctions>
#include <iostream>
using namespace Eigen;
int main()
{
Matrix4cd A = Matrix4cd::Random();
MatrixPower<Matrix4cd> Apow(A);
std::cout << "The matrix A is:\n" << A << "\n\n"
"A^3.1 is:\n" << Apow(3.1) << "\n\n"
"A^3.3 is:\n" << Apow(3.3) << "\n\n"
... | ALGO | 0.998341 | 3.396939 |
a327ed42-4180-454f-bfa8-364d8bde759d | SkyCloudShang/iRobot_Bhuman | Src/Tools/ImageProcessing/InImageSizeCalculations.cpp | /**
* @file InImageSizeCalculations.cpp
*
* A namespace with methods to help validate perception.
*
* @author <a href="mailto:<EMAIL>">Jesse Richter-Klug</a>
*/
#include "InImageSizeCalculations.h"
#include "Tools/Debugging/DebugDrawings.h"
#include "Tools/Math/Transformation.h"
float IISC::getImageBallRadiusByC... | TOOL | 0.995927 | 5.590541 |
9af7df17-7c2f-4ffc-b649-7cada64e6df6 | kpeel5839/LeetCode | 2022-convert-1d-array-into-2d-array/2022-convert-1d-array-into-2d-array.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution {
public:
typedef vector<int>vi;
typedef vector<vi>vii;
vector<vector<int>> construct2DArray(vector<int>& original, int m, int n) {
vii answer(m,vi(n,0));
for(int i=0;i<original.size();i++){
int h=i/n;
int... | ALGO | 0.999886 | 4.845931 |
515751d2-3ca3-44f1-9c23-09c0faaa94db | Rejwana-Shirajy/c-c- | warm up 1/odd_sum.cpp | #include<iostream>
using namespace std;
int main()
{
int a,b,i,t,j;
cin>>t;
for(i=0;i<t;i++)
{
int sum=0;
cin>>a>>b;
if((0<=a)&&(a<=b)&&(b<=100))
for(j=a;j<=b;j++)
if(j%2!=0)
sum+=j;
cout <<"Case "<<i+1<<": "<<sum<<endl;
}
}
| ALGO | 0.999807 | 3.901099 |
183fb422-d9c1-4dad-a73b-b4fdc39420af | Ragebobber/GETRequestBoost | boost_1_78_0/libs/graph/test/mean_geodesic.cpp | #include <iostream>
#include <boost/graph/undirected_graph.hpp>
#include <boost/graph/directed_graph.hpp>
#include <boost/graph/exterior_property.hpp>
#include <boost/graph/property_maps/constant_property_map.hpp>
#include <boost/graph/floyd_warshall_shortest.hpp>
#include <boost/graph/geodesic_distance.hpp>
using n... | TEST | 0.992528 | 5.304817 |
7d797bf5-3863-456d-86a7-c85707ecb5f8 | Nwon2464/cpp | april1/akari.cpp | #include <bits/stdc++.h>
using namespace std;
//Warsaw debug template
#define LOCAL
#define sim template <class c
#define ris return *this
#define dor > debug& operator<<
#define eni(x) \
sim > typename enable_if<sizeof dud<c>(0) x 1, debug&>::type... | ALGO | 0.999919 | 3.990225 |
9ae40305-91b6-42df-9f44-54c3e8a5a44f | ishandutta2007/codeforces | zx2003/normal/1477/D.cpp | #include<bits/stdc++.h>
using namespace std;
const int N=5e5+5;
int T,n,m,i,j,x,y,p[N],q[N],cnt[N],bel[N],dad[N];
vector<int>adj[N],ve[N];
set<int>S;
inline void bfs(int start){
queue<int>q;q.push(start);
for(;!q.empty();){
x=q.front();q.pop();
int fa=dad[x];
if(fa){
bel[x]=fa;
if(!bel[fa])++cnt[fa];else{... | ALGO | 0.999987 | 4.345585 |
99412da8-daeb-40f7-89b0-6e7b6f508412 | codebysantosh/dsa-practice | Backtracking/Permutations II.cpp | //Approach-1 (Using same concept as Permutation-I but keeping count to avoid duplicates)
//T.C : O(N * N!)
//S.C : O(N)
class Solution {
public:
int n;
vector<vector<int>> result;
unordered_map<int, int> mp;
void solve(vector<int> &temp) {
if(temp.size() == n) {
result.push_back(tem... | ALGO | 0.999966 | 6.832381 |
846eda4d-b93a-4f4b-9400-40b82f10ba18 | sdpkjc/training | luogu/X_ru_men/ac/P2676.cpp | // P2676 超级书架
// https://www.luogu.org/problem/P2676
#include <algorithm>
#include <iostream>
using namespace std;
int arr[20005];
int main() {
long long n, x;
cin >> n >> x;
for (int i = 0; i < n; i++) {
cin >> arr[i];
}
sort(arr, arr + n);
long long ans = 0, sum = 0;
for (int i = n - 1; i >= 0; i... | ALGO | 0.999992 | 4.621753 |
8ed348e4-0d3b-4a0f-be83-e7abae7e4712 | linpenghong/Training_Base | Learn_Eigen3/2016/Eigen3/doc/examples/TutorialLinAlgSVDSolve.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main()
{
MatrixXf A = MatrixXf::Random(3, 2);
cout << "Here is the matrix A:\n" << A << endl;
VectorXf b = VectorXf::Random(3);
cout << "Here is the right hand side b:\n" << b << endl;
cout << "The least-squares ... | ALGO | 0.999663 | 3.896713 |
d2a3adec-6160-46ca-8c33-ad94a7ed4574 | Jamesweng/leetcode | 0189-rotate-array.cpp | class Solution {
public:
void rotate(vector<int>& nums, int k) {
if (nums.size() <= 1) return;
vector<int> old(nums);
k %= nums.size();
for (int i = nums.size() - 1; i >= 0; --i) {
nums[i] = old[((i - k) + nums.size()) % nums.size()];
}
}
};
| ALGO | 0.999989 | 6.190682 |
ef835f14-0d49-41aa-902c-bdb54853e403 | K0nnyaku/Code | Cpp/Problem/DataStructure/LG4145.cpp | #include<bits/stdc++.h>
using namespace std;
#define IOR(i, st, ed) for(int i = st; i < ed; i++)
#define LOR(i, st, ed) for(int i = st; i > ed; i--)
#define MID ((L + R) >> 1)
#define V(x) (Tr[x].val)
#define M(x) (Tr[x].mx)
const int MAXN = 1e5 + 10;
#define int unsigned long long
struct Seg {
int lc, rc, mx, val;... | ALGO | 0.999697 | 3.993782 |
a15ccba7-6d52-4164-9e13-72c33c4ec6e6 | TheMartian0x48/CP | UVa/volume-002/294.cpp | // @author: the__martian
// 294
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define per(i, a, b) for(int i = a; i >= (b); --i)
#define trav(a, x) for(auto &a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
using ll = long long;
using pii = pair<int... | ALGO | 0.999802 | 4.821507 |
ac77b10d-51a7-4220-a0f1-2336bfed7352 | krishnenduduttadc/DSA_Master_cpp | GenericTreeL1/Size.cpp | #include <iostream>
#include <vector>
using namespace std;
struct Node {
int data;
vector<Node*> children;
};
void display(Node* node) {
cout << node->data << " -> ";
for (Node* child : node->children) {
cout << child->data << ", ";
}
cout << "." << endl;
for (Node* child : node->... | ALGO | 0.999815 | 5.822556 |
a81ae1c4-cae2-4756-acca-1d4f2796316c | Janesh7/CPP_DSA | Leetcode Problems/Extras/Sum of Diagonals.cpp | // 1572. Matrix Diagonal Sum
// Easy
// Given a square matrix mat, return the sum of the matrix diagonals.
// Only include the sum of all the elements on the primary diagonal and all the elements on the secondary diagonal that are not part of the primary diagonal.
// Example 1:
// Input: mat = [[1,2,3],
// ... | ALGO | 0.999928 | 6.450486 |
12027708-728b-431e-a4d6-9b1238c1d789 | Akasho09/DSA | Recursion/Fibonacci.cpp | #include <iostream>
using namespace std ;
// Multiple recursion
void Fibonacci(int n, int i, int j) {
if (n<1) {
return ;
}
cout <<j << " " ;
Fibonacci(n-1,i+j,i);
}
int Fibonacci2 (int n) {
if (n<=1) {
return n;
}
int last = Fibonacci2(n-1);
int Slast = Fibonacci2(n-2);
return last+Slast;
}
int main () {
... | ALGO | 0.999927 | 3.937981 |
76105cbb-c025-46fd-90dd-5c019ed3b2f5 | BetaPhIII/leetcode-problems | Leetcode-1400-01112025.cpp | class Solution {
public:
bool canConstruct(string s, int k) {
if(s.length()<k){
return false;
}
std::unordered_map<char, int> countMap;
for(const auto& c : s){
countMap[c]++;
}
int oddCounts=0;
for(const auto& pair : countMap){
... | ALGO | 0.999913 | 6.43191 |
ebbc85a5-db97-4604-86d0-1e0c2111db45 | JinyuLiu0116/CPP-Entry-Level | 0412HW2.cpp | //Write a program to get decimal number and convert to into any radix or base.
// -> get user input a decimal number
// -> get user input a radix
// -> get digit by decimal % radix
// -> digit * 10 + digit
// -> decimal number / radix
/*#include <iostream>
using namespace std;
int main()
{
int num, radix, digit, resu... | ALGO | 0.997746 | 3.716283 |
1b04993f-9679-4b1e-8b2c-e5c6f0ecf7b6 | goldi1027/EHL | boost_1_64_0/libs/algorithm/test/search_test2.cpp | #include <boost/algorithm/searching/boyer_moore.hpp>
#include <boost/algorithm/searching/boyer_moore_horspool.hpp>
#include <boost/algorithm/searching/knuth_morris_pratt.hpp>
#define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>
#include <ctime> // for clock_t
#include <iostream>
#include <fstream>
#incl... | TEST | 0.923575 | 6.041732 |
ad07af9d-04b2-4bcf-aa04-b23242b61a1f | traviesuras/maratona-ifsc | congresso-rec.cpp | #include <iostream>
#include <vector>
#include <iterator>
#include <algorithm>
typedef std::vector<std::vector<int>> majority_list;
// Finds all party sets summing at least "needed" votes
majority_list find_majorities(int needed, std::vector<int> dep);
// Send to standar out all sets, one per line
void show_majoritie... | ALGO | 0.999962 | 5.143461 |
eff64153-3a68-4697-a998-28634491e4f8 | LIFECorp/external | chromium_org/third_party/mesa/src/src/glsl/loop_controls.cpp | #include <limits.h>
#include "main/compiler.h"
#include "glsl_types.h"
#include "loop_analysis.h"
#include "ir_hierarchical_visitor.h"
/**
* Find an initializer of a variable outside a loop
*
* Works backwards from the loop to find the pre-loop value of the variable.
* This is used, for example, to find the initia... | ALGO | 0.998921 | 7.743438 |
ca07a126-32dd-4cad-bf7d-0bfd4af511ce | hozifabadr/hproject | task2/loops/for loop hard3/main.cpp | #include <iostream>
using namespace std;
int main()
{
int n,m,w;
cin>>n>>m>>w,cnt=0;
for(int a=1;a<=n;a++)
{
for(int b=a;b<=m;b++)
{
int c = a+b;
if(c>=1 && c<=w)
cnt+=2;
}
}
return 0;
}
| ALGO | 0.999873 | 3.638425 |
00972b4e-0221-45a1-a180-dc59ba994bb9 | alexcolls/invictus-coin | eos-dawn-2.x/libraries/fc/src/crypto/city.cpp | //#include "config.h"
//#include <city.h>
#include <algorithm>
#include <string.h> // for memcpy and memset
#include <fc/crypto/city.hpp>
#include <fc/uint128.hpp>
#include <fc/array.hpp>
#if defined(__SSE4_2__) && defined(__x86_64__)
#include <nmmintrin.h>
#else
uint64_t _mm_crc32_u64(uint64_t a, uint64_t b );
#end... | ALGO | 0.99791 | 6.377211 |
e31d993a-32f5-4278-8a95-ef716f761d78 | necst/trilli | aie/src/kernel_merger_1_i.cpp | #include "common.h"
#include "aie_api/aie.hpp"
#include "aie_api/aie_adf.hpp"
#include "aie_api/utils.hpp"
#include "kernel_merger_1_i.h"
#define INCR 32
#define SIZE DIMENSION * DIMENSION /INCR
void merger_1_i(input_window_float* in0, input_window_float* in1, output_window_float* R_out)
{
aie::vector<float, 32>... | TOOL | 0.983197 | 3.115875 |
c794d419-9c83-4fed-911b-56842522a67f | Nipuntank/GFG | Difficulty: Easy/Count ways to express N as the sum of 1,3 and 4/count-ways-to-express-n-as-the-sum-of-13-and-4.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
int mod=1e9+7;
long long helper(int n,vector<int>&dp)
{
if(n==1 || n==2)
{
return 1;
}
if(n==3)
{
return 2;
}
... | ALGO | 0.999955 | 6.034067 |
7154cc7c-c072-4fba-b336-dd337303946f | Kamna16/LeetCodeProgress | 1813-maximum-erasure-value/1813-maximum-erasure-value.cpp | class Solution {
public:
int maximumUniqueSubarray(vector<int>& nums) {
int n = nums.size();
unordered_set<int> st;
int i=0, j=0;
int currSum = 0;
int maxi = 0;
while(j<n)
{
if(st.find(nums[j]) == st.end())
{
currSum+= n... | ALGO | 0.999776 | 6.530853 |
bde4f10b-ad52-479a-aa7b-2578da33461b | avinashsai/codeforces | Practice/484A.cpp | #include<bits/stdc++.h>
#include<math.h>
using namespace std;
#define ll long long
int find(ll r)
{
int cnt = 0;
while(r)
{
r = (r>>1);
cnt+=1;
}
return cnt-1;
}
int main()
{
ll l,r;
int t;
cin>>t;
while(t--)
{
cin>>l>>r;
if(r==1)
cout<<"1"<<endl;
else{
int max2 = find(r);
cout<<pow(2,max2)-1<... | ALGO | 0.999957 | 4.389503 |
5fa8dda9-bb26-45da-a314-96646f04f9aa | adadesions/Vision | RegistrationGabor/src/registrationGabor.cpp | /*
* =====================================================================================
*
* Filename: registrationGabor.cpp
*
* Description: For my new experimence
*
* Version: 1.0
* Created: 05/08/2017 20:42:34
* Revision: none
* Compiler: gcc
*
* Author:... | TOOL | 0.882076 | 4.937081 |
7deda08a-3178-448c-b541-c9b6caa93341 | hardik302001/leetcode | problems/graph_valid_tree/solution.cpp |
// just check for cycle and connectedness in the graph. Both of these can be done via DFS.
class Solution {
public:
bool validTree(int n, vector<vector<int>>& edges) {
vector<vector<int>> neighbors(n);
for (auto e : edges) {
neighbors[e[0]].push_back(e[1]);
neighbors[e[1]].... | ALGO | 0.999835 | 6.130164 |
8e9b314c-1f08-4a65-be7e-5f519524741a | aminbenmansour/competitive-programming | codeforces/div A/Mahmoud and Longest Uncommon Subsequence.cpp | /**
*
* problem link: https://codeforces.com/contest/766/problem/A
*
* */
#include <bits/stdc++.h>
using namespace std;
string a, b;
string sht, lng;
int glb = -1;
int main(int argc, char **argv) {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int count = 0;
cin >> a;
cin >> b;
... | ALGO | 0.999927 | 4.16357 |
1b8eca67-f7eb-4480-8ffe-0b390a429643 | Sandi2156/TLE-Eliminators-Level-2-Problems | 14-graphs/04_building_roads.cpp | #include <bits/stdc++.h> // This will work only for g++ compiler.
#define for0(i, n) for (int i = 0; i < (int)(n); ++i) // 0 based indexing
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i) // 1 based indexing
#define forc(i, l, r) for (int i = (int)(l); i <= (int)(r); ++i) // closed interver from l to r r inclu... | ALGO | 0.999996 | 4.209687 |
64e2156f-6ea7-471d-8372-c280f4e9a670 | shankybit/C-C- | pyrmidInted.cpp | #include <iostream>
using namespace std;
int printpttern(int n){
for(int i = n; i > 0; i--){
for(int j = 0; j < i; j++){
cout << " *";
}
cout << "\n";
}
}
int main(){
int a;
cout << "the number: ";
cin >> a;
cout << printpttern(a);
return 0;
} | ALGO | 0.999903 | 4.439556 |
d193a5eb-fead-4e85-8db4-cc148fc8ac4a | lopezolidev/Cplusplus_exercises | src/practice_3/3_exc6.cpp | /*
Write an algorithm that takes as input a number N and prints the Fibonacci sequence until N. Fibonacci sequence starts with the numbers 1 and 0, and then each next step is calculate summing the last 2 numbers of the sequence. I.e: the first numbers of the sequence of Fibonacci are 0, 1, 1, 2, 3, 5, 8, 13...
*/
... | ALGO | 0.999621 | 5.187958 |
b6609134-d31c-4a59-a5b5-453562ae7765 | YashKumarYK/LeetCode | 354-russian-doll-envelopes/354-russian-doll-envelopes.cpp | bool comparator( vector<int> &a, vector<int> &b){
if( a[0]== b[0]) return a[1]>b[1];
return a[0]<b[0];
}
class Solution {
public:
int maxEnvelopes(vector<vector<int>>& env) {
sort( env.begin(), env.end(), comparator);
int n =env.size();
vector<int> v;
int len... | ALGO | 0.999996 | 6.081345 |
9085ffca-6728-4744-b2f7-40fa9344351c | vss2sn/advent_of_code | 2022/cpp/day_25a.cpp | #include <algorithm>
#include <array>
#include <fstream>
#include <iostream>
#include <limits>
#include <queue>
#include <string>
#include <unordered_set>
#include <unordered_map>
#include <vector>
// TODO: Clean up and optimize
// Also, use a better method
std::vector<long long> powers_5{1};
long long conver... | ALGO | 0.999681 | 5.720279 |
6cabfeae-1e2d-4b01-846e-8d2e4c75cdc5 | Kanita-Haider/CP-Codes | UVA code/445 Marvelous Mazes/main.cpp | #include <iostream>
#include <string>
using namespace std;
int main()
{
string str;
while(getline(cin,str)){
if(!str.size()){
cout<<endl;
continue;
}
int sum=0;
for(int i=0;i<str.size();i++){
if(str[i]>='0' && str[i]<='9') {
int x =str[i]-'0';
sum+=x;
}
if(str[i]>='A' && ... | ALGO | 0.993627 | 3.37613 |
449931ff-6de8-4250-ad8a-3e27bac73a7d | nuguri03/boj | c++/src/solved/DivideConquer/[6549]LargestRectangleInHistogram.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using ll = long long;
ll maxArea(vector<ll>& h, int left, int right) {
if (left == right) return h[right];
int mid = (left + right) / 2;
ll leftMax = maxArea(h, left, mid);
ll rightMax = maxArea(h, mid + 1, right);
in... | ALGO | 0.999677 | 5.971791 |
faad9294-cce4-4e52-8663-ec9b3c094b3d | gihop/AlgorithmStudy | 브루트포스/브루트포스/2048(Easy)_12100.cpp | #include <iostream>
#include <vector>
using namespace std;
//문제를 '제대로' 읽자.
//이미 합쳐진 블록은 또 다른 블록과 다시 합쳐질 수 없다는
//한 번의 이동에서 합쳐진 블록이 다시 합쳐질 수 없다는 뜻이다.
//이 문제에서 가장 중요한 부분은 적절히 맵을 저장해두었다가 다시 복사를 하는 부분이다
int n;
int ans;
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};
bool sum(vector<vector<int>> &v, vector<vector<boo... | ALGO | 0.999937 | 4.555511 |
88d43997-b13e-4337-a454-a3413a58d8ce | feizijie01/study | sith/practice2.cpp | #include<iostream>
int main()
{
using namespace std;
double tvarps;
double shui=0;
cout << "Please enter your income by tvarps: ";
while((cin >> tvarps)&&(tvarps>0))
{
if (tvarps <= 5000)
{
shui =0;
cout << "Your shui is " << shui << " tvarps." << endl;
co... | TOOL | 0.986131 | 3.014002 |
a677ecbd-6ee1-4c4c-86cc-2e83077e9823 | Nath-Sant/Fatec | 2°Semestre/Estrutura de dados/EDD 15 - Mapeamento-Dicionario/Mapeamento/Exercicio 7/Exercicio7.cpp | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef int Chave;
typedef char Valor[22];
typedef struct map {
Chave chave;
Valor valor;
struct map *prox;
} *Map;
Map no_map(Chave c, Valor v, Map p){
Map n = (struct map*)malloc(sizeof(struct map));
n->chave = c;
strcpy(n->valor,v);
n->prox = p;
re... | ALGO | 0.974227 | 4.03377 |
05a61968-f3f1-450a-bc8b-b64a8db8d02a | AryanJaiswal763/Leetcode | 3617-find-the-original-typed-string-i/3617-find-the-original-typed-string-i.cpp | class Solution {
public:
int possibleStringCount(string word) {
int ans=1;
vector<int>alphabet(26,0);
alphabet[word[0]-'a']++;
for(int i=1;i<word.length();i++)
{
if(alphabet[word[i]-'a']!=0)
{
if(word[i-1]==word[i])
... | ALGO | 0.999941 | 5.717033 |
5c38ccdd-8f67-4cb0-891e-3913ce91e028 | bluesea0/Leetcode | 796. 旋转字符串/796. 旋转字符串.cpp | #include <iostream>
#include<vector>
#include<queue>
#include<unordered_map>
#include<algorithm>
using namespace std;
//2021243:12:12
class Solution {
public:
bool rotateString(string A, string B) {
//жϳȣпܳȲͬ
if(A.size()!=B.size())return false;
A=A+A;
return A.find(B)==string::npos?f... | ALGO | 0.999918 | 5.158724 |
de6c5d34-8c78-4e46-b867-164b1e0b55cc | rosehgal/codes | can_construct_ransome_note.cpp | /*
Given an arbitrary ransom note string
and
another
string
containing
letters from
all
the
magazines,
write
a
function
that
will
return
true
if
the
ransom
note
can
be
constructed
from
the
magazines ;
otherwise,
it
will
return
false.
*/
#include<bits/stdc++.h>
using namespace std;
boo... | ALGO | 0.999963 | 4.801859 |
97b2d04c-3cff-4692-aa30-526e36b7f6e1 | Rahul-skush/leetcode-solutions | 0229-majority-element-ii/0229-majority-element-ii.cpp | class Solution {
public:
vector<int> majorityElement(vector<int>& nums) {
int e1, e2, cnt1 =0, cnt2 =0;
for(auto x : nums)
{
if(x==e1) cnt1++;
else if(x==e2) cnt2++;
else if(cnt1==0) e1 = x, cnt1++;
else if(cnt2==0) e2 = x, cnt2++;
... | ALGO | 0.999954 | 5.527785 |
f6ef3d52-a588-4af8-937c-7c6f69cc5c69 | kevindra/Algorithm-Implementations | trees/pathSum.cpp | /**
* File Name : bst_basic.cpp
*
* Purpose : Given a binary tree and a number, return true if the tree has a root-to-leaf path such that adding up all the values along the path equals the given number. Return false if no such path can be found.
*
* Creation Date : 28-01-2011
*
* Last Modified : Friday 28... | ALGO | 0.999949 | 5.411417 |
c70f4260-afab-4602-b9b1-14594312b3fa | tlxucheng/mylinux | App/vs_project/Dictionary-master/Dictionary-master/Dictionary_/AVL.cpp | #include "stdafx.h"
#include "AVL.h"
//************************ʵֲ
//*************************
void AVLTree::RotateL(AVLNode*& ptr)
{
AVLNode* subL = ptr;
ptr = subL->right;
subL->right = ptr->left;
ptr->left = subL;
ptr->bf = subL->bf = 0;
}
//*************************ҵ
void AVLTree::RotateR(AVLNode*& ptr)
{
AV... | ALGO | 0.999686 | 3.499636 |
f25d29f3-ee39-4684-9c2b-a1eeb93ab717 | HUSS41N/DSA | archive/LinkedList/remove-every-k-nodes.cpp | // { Driver Code Starts
// C program to find n'th Node in linked list
#include <stdio.h>
#include <stdlib.h>
#include<iostream>
using namespace std;
/* Link list Node */
struct Node
{
int data;
struct Node* next;
Node(int x){
data = x;
next = NULL;
}
};
Node *deleteK(Node *,in... | ALGO | 0.999854 | 5.53884 |
438d3580-8817-48ba-a568-e006ee7e0671 | eric-austin/CPSC457 | Assignment2/sum.cpp | #include <iostream>
#include <thread>
#include <fstream>
#include <array>
using namespace std;
int partialSums[1000000];
void doSum(int numbers[], int id, int start, int end) {
for(int i = start; i < end; i++) {
partialSums[id] += numbers[i];
}
}
int main(int argc, char ** argv) {
//get command line args
... | ALGO | 0.997811 | 4.961675 |
accd977f-afe3-4e07-96fb-97c4a174afd0 | MatteoGalletta/university | 1203 Programmazione 2/studying/prof/selectsort.cpp | /*
* selectsort.cpp
*/
#include <iostream>
#include <cstdlib>
using namespace std;
template <typename T> void _swap(T& a, T& b)
{
T tmp;
tmp = a;
a = b;
b = tmp;
}
template <typename T> void selectsort(T * data, int n)
{
for (int i = 1; i < n; i++) {
int least_index = i;
for (... | ALGO | 0.999943 | 4.546193 |
0386dc46-f412-4d93-9ba4-6827ddb6a304 | BunnnyBin/Algorithm | 자료구조1/큐/10845.cpp | #define _CRT_SECURE_NO_WARNINGS
#define MAX_QUEUE_SIZE 10000
#define Success 1
#define Error -1
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
typedef struct {
int queue[MAX_QUEUE_SIZE];
int head;
int tail;
}QueueType;
QueueType* created() {
QueueType* q;
q = (QueueType*)malloc(sizeof(QueueType));
... | ALGO | 0.999444 | 4.026119 |
92c6a357-e69e-4362-9faa-5113d420b5e0 | sujon-ahmed-WD/MODULE_21 | MD-23/priority_queue.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
priority_queue<int,vector<int>,greater<int>>q;
q.push(10);
q.push(20);
q.push(30);
cout<<q.top()<<endl;
return 0;
} | ALGO | 0.997289 | 3.324379 |
84be2a98-6f24-4e6e-be57-8c67ac0027d0 | 3142akay/leetcode- | 81-search-in-rotated-sorted-array-ii/search-in-rotated-sorted-array-ii.cpp | class Solution {
public:
int pivot(vector<int>& nums, int l, int r){
while(l<r){
while(l<r && nums[l]==nums[l+1])
l++;
while(l<r && nums[r]==nums[r-1])
r--;
int mid = l+(r-l)/2;
if(nums[mid]<=nums[r]){
r = mid;
} else {
l = mid+1;
... | ALGO | 0.999997 | 6.1268 |
39c973b5-78a2-4ae6-9961-2f0ad1dee604 | oxygen-hunter/Flashboom | data/big-vul-100/add_attention_code/Phi/top0-100/largest-color-value-in-a-directed-graph-Solution.largestPathValue/177826_DoS_Exec_Code_Overflow.cpp | bool extractPages (const char *srcFileName, const char *destFileName) {
char pathName[1024];
GooString *gfileName = new GooString (srcFileName);
PDFDoc *doc = new PDFDoc (gfileName, NULL, NULL, NULL);
if (!doc->isOk()) {
error(errSyntaxError, -1, "Could not extract page(s) from damaged file ('{0:s}')",... | ALGO | 0.98058 | 3.966154 |
1c6b1a58-1dc1-40d9-b33c-e900cfd59da6 | sndrzt/opencv-3.4.7 | samples/cpp/squares.cpp |
// The "Square Detector" program.
// It loads several images sequentially and tries to find squares in
// each image
#include "opencv2/core.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/imgcodecs.hpp"
#include "opencv2/highgui.hpp"
#include <iostream>
using namespace cv;
using namespace std;
static void he... | TOOL | 0.99724 | 5.892077 |
9f1b9c9e-a0df-4c2b-b636-54e569ef6a48 | GDuquee/Disciplina-Algoritimo-e-Programacao | Exercicio 5 - lista 3.cpp | //exerccio 5 lista 3
#include<stdio.h>
int main(){
int numero, i, fat;
printf("Insira um numero inteiro para fatorar: ");
scanf("%d", &numero);
fflush(stdin);
i=1;
if(numero<0){
printf("Somente nmeros inteiros positivos!");
} else if(numero==0){
printf("Fatorial de 0 : 1");
} else{
while(i<= numero)... | ALGO | 0.999778 | 4.34816 |
fb85dd47-133e-4fa3-92ae-fc27a6d56d11 | KausBoss/CP-SubGrouped | LeetCode/141.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
bool hasCycle(ListNode *head) {
ListNode * slow=head, *fast=head;
while(fast!=NULL && fast->next!=NULL){
fa... | ALGO | 0.999791 | 5.187561 |
e3ef376c-ef5a-4886-a183-2d66aae70ea7 | anurag9621/DSA | stack/validcom.cpp | #include<iostream>
#include<stack>
using namespace std;
int main()
{
stack<char> s;
char A[] = "{{}}";
if(A.length()%2!=o){
cout << -1;
}
else{
for (int i = 0; A[i] != '\0';i++){
char ch = A[i];
if(ch="{")
{
s.push(ch);
... | ALGO | 0.998985 | 4.25592 |
222b8705-89a3-4b3f-87fa-ece558f14e9f | xydinesh/jamming | algo/sort/countsort.cpp | #include "countsort.h"
CountSort::CountSort()
{
}
CountSort::CountSort(int i) : SortAlgorithms (i)
{
}
CountSort::~CountSort()
{
}
int CountSort::sortArray()
{
std::vector<int> count_vec(randvalue, 0);
std::vector<int> sorted_vec(nelements, 0);
int i = 0;
for (i = 0; i < nelements; i++)
{
... | ALGO | 0.999756 | 4.692869 |
e0058534-4cd9-4879-835d-1772b42fa74e | DhruvNischal/LeetCode_Problem | 0977-squares-of-a-sorted-array/0977-squares-of-a-sorted-array.cpp | class Solution {
public:
vector<int> sortedSquares(vector<int>& nums)
{
for(int i = 0 ; i < nums.size();i++)
{
nums[i]*=nums[i];
}
sort(begin(nums),end(nums));
return nums;
}
}; | ALGO | 0.999983 | 5.867542 |
bfe88168-80c0-458f-8b13-abfed81ded5d | Erica1217/algorithm | 14753 MultiMax/14753 MultiMax/main.cpp | #include <iostream>
#include <algorithm>
using namespace std;
int main()
{
int n;
cin>>n;
int data[11000]={0,};
for(int i=0; i<n ; i++)
{
cin>>data[i];
}
sort(data,data+n);
int right2=1;
int left2=1;
for(int i=0 ; i<2 ; i++)
{
right2*=data[i];
lef... | ALGO | 0.999913 | 3.18384 |
69a17f6b-6441-4093-ba6c-4aa106e4e882 | SaurabhKumar1611/iterviewBit_solutions | Tree_Data_Structure/Symmetric_Binary_Tree.cpp | // Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).
// Return 0 / 1 ( 0 for false, 1 for true ).
// Input 1:
// 1
// / \
// 2 2
// / \ / \
// 3 4 4 3
// Input 2:
// 1
// / \
// 2 2
// \ \
// 3 3
// Output 1:
// 1
// Output 2:
// 0... | ALGO | 0.999984 | 5.669886 |
fc0737eb-3ec5-4f60-a64d-51f620f17354 | SaurabhKumar171/data_structure_and_algorithms | .ccls-cache/@home@runner@datastructureAndalgorithms/Patterns@7_diamond_pattern.cpp | // *
// * *
// * * *
// * * * *
// * * * * *
// * * * *
// * * *
// * *
// *
#include <iostream>
using namespace std;
int diamond(){
int n=4;
for(int i=0; i<=n;i++){
for(int j=0;j<=n-i-1; j++){
cout << " ";
}
for(int k=0;k<=i; k++){
cout << " *";
}
co... | ALGO | 0.999715 | 4.309922 |
b4e34371-48d3-4632-9233-1a858cbb74eb | renhaofan/Source-Archive | OpenCV/opencv-4.5.2/modules/imgproc/src/deriv.cpp | #include "precomp.hpp"
#include "opencl_kernels_imgproc.hpp"
#include "opencv2/core/openvx/ovx_defs.hpp"
#include "filter.hpp"
/****************************************************************************************\
Sobel & Scharr Derivative Filters
\************************************... | ALGO | 0.988535 | 6.24908 |
c86b03ea-ee46-403a-9134-f078538b55cd | linjiafengyang/c-and-cpp | LeetCode/1TwoSum.cpp | /*
Given an array of integers, return indices of the two numbers such that they add up to a specific target.
You may assume that each input would have exactly one solution, and you may not use the same element twice.
Example:
Given nums = [2, 7, 11, 15], target = 9,
Because nums[0] + nums[1] = 2 + 7 = 9,
return [0, ... | ALGO | 0.999926 | 6.350044 |
a0b32917-2295-4383-a4bf-247b30e1abe0 | thinkphp/2SAT | 2sat.cpp | #include <cstdio>
#include <iostream>
#include <fstream>
#include <vector>
#define FIN "2sat.in"
#define FOUT "2sat.out"
using namespace std;
class SAT2 {
public:
SAT2(const int n = 0): N( n ), t( 0 ),
G(vector<vector<int> >(2*n+1)),
GT(vector<vector<... | ALGO | 0.999966 | 4.795287 |
37aa2ef0-2c93-421b-84c4-7b94dfcf2d95 | otaviobertucini/sorting-homework-v2 | Sequential.cpp | #include "Sequential.h"
#include <cstddef>
#include "Element.h"
#include "Linked.h"
#include <iostream>
#include <fstream>
#include <string>
#include <string.h>
#include <stdlib.h>
#include<ctime>
using std::cout;
using std::endl;
using std::fstream;
using std::ofstream;
using std::ifstream;
using std::ios;
using std:... | ALGO | 0.950333 | 3.823748 |
fd5dc73a-08de-420a-b29c-0d2c877bd8b2 | omniBaodzai/Cpp_DataType_InputOutput_28Tech | vd27.cpp | /*
Toán tử tăng giảm
*/
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
int n = 100;
++n; // n = 101
cout << n << endl;
n++; // n = 102
cout << n << endl;
n--; // n = 101
cout << n << endl;
--n; // 100
cout << n << endl;
return 0;
} | ALGO | 0.997823 | 3.568642 |
71938c5f-b2f1-4e8a-a9b9-a98d90bfe633 | nisanil03/Leetcode | 2792-neighboring-bitwise-xor/2792-neighboring-bitwise-xor.cpp | class Solution {
public:
bool doesValidArrayExist(vector<int>& derived) {
return (reduce(derived.begin(),derived.end(),0) &1)==0;
}
}; | ALGO | 0.999086 | 5.789883 |
dea01b17-9907-469e-bdf7-a74b180013d8 | jovana193206/Virtual-memory-management-system | os2proj/KernelProcess.cpp | #include "KernelProcess.h"
#include "KernelSystem.h"
#include "ResourceAllocator.h"
#include "global.h"
#include "List.h"
#include <iostream>
using namespace std;
KernelProcess::KernelProcess(ProcessId pid) {
id = pid;
pmtp = nullptr;
sys = nullptr;
}
KernelProcess::~KernelProcess() {
//prvo prodje kroz pmt i os... | TOOL | 0.888977 | 3.923048 |
3707c038-f708-443d-827f-55084a6f1c87 | will1996/ArcsimViewer | arcsim/src/vectors.cpp | #include "vectors.hpp"
#include "blockvectors.hpp"
using namespace std;
// LAPACK stuff
extern "C" {
#ifdef _WIN32
#define LAPACKE_dgesvd dgesvd_
#define LAPACKE_dsyev dsyev_
#endif
#define lapack_int int
#define LAPACK_ROW_MAJOR 101
#define LAPACK_COL_MAJOR 102
lapack_int LAPACKE_dsyev( int matrix_order, char jobz... | ALGO | 0.999188 | 5.560504 |
81d38300-1c8f-4f73-8f6c-0c6808676796 | sakibjnu/Algo-lab | lcs.cpp | #include<bits/stdc++.h>
#include<string.h>
using namespace std;
int dp[100][100]; // Global DP table
int lcs(string X, string Y) {
int m = X.length(), n = Y.length();
// Build the DP table
for (int i = 0; i <= m; i++) {
for (int j = 0; j <= n; j++) {
if (i == 0 || j == 0)
... | ALGO | 0.999984 | 5.26513 |
4d4aee71-39e7-44f6-922a-348759fbb608 | sarvex/leetcode-zig | lcof2/剑指 Offer II 073. 狒狒吃香蕉/Solution.cpp | class Solution {
public:
int minEatingSpeed(vector<int>& piles, int h) {
int left = 1, right = *max_element(piles.begin(), piles.end());
while (left < right) {
int mid = left + right >> 1;
int s = 0;
for (int pile : piles) s += (pile + mid - 1) / mid;
... | ALGO | 0.999942 | 6.003656 |
51893ac0-d6ac-4a3e-8b5d-04f972a9e642 | WolfireGames/overgrowth | Projects/bullet3-2.89/src/BulletDynamics/ConstraintSolver/btBatchedConstraints.cpp | #include "btBatchedConstraints.h"
#include "LinearMath/btIDebugDraw.h"
#include "LinearMath/btMinMax.h"
#include "LinearMath/btStackAlloc.h"
#include "LinearMath/btQuickprof.h"
#include <string.h> //for memset
#include <cmath>
const int kNoMerge = -1;
bool btBatchedConstraints::s_debugDrawBatches = false;
struct... | ALGO | 0.955466 | 4.416537 |
2bb19cdb-33ce-4d43-a4ac-f6a3c5418656 | closekn/procon | yukicoder/YC/254/B/1096.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
long long n;
cin >> n;
long long a[n];
for ( long long i = 0; i < n; i++ ) {
cin >> a[i];
}
long long sum = 0;
for ( long long i = 0; i < n; i++ ) {
sum += (i+1)*(n-i) * a[i];
}
cout << sum << endl;
return 0;
}
| ALGO | 0.999734 | 3.733159 |
ac1f2f2d-8b30-44e8-b96c-d6c8eed41999 | pcw109550/problem-solving | LeetCode/minimum-moves-to-equal-array-elements-ii.cpp | // 462. Minimum Moves to Equal Array Elements II
#include <algorithm>
#include <iostream>
#include <vector>
#include <climits>
class Solution {
public:
int minMoves2(std::vector<int>& nums) {
// O(N * log(N))
int result = 0;
std::sort(nums.begin(), nums.end());
... | ALGO | 0.999659 | 5.869708 |
32e719e2-f050-4fd0-837c-1879374ae225 | zenny126/-DataStructuresAndAlgorithms | bublesort.cpp | #include <iostream>
void bubbleSort(int arr[], int n) {
for (int i = 0; i < n - 1; ++i) {
for (int j = 0; j < n - i - 1; ++j) {
// Swap if the element found is greater than the next element
if (arr[j] > arr[j + 1]) {
std::swap(arr[j], arr[j + 1]);
}
... | ALGO | 0.999894 | 6.411617 |
e2d23e4c-6a38-44ef-88eb-20fe442484c2 | MalayShikharSoni/LeetCodeSolutions | 494-target-sum/target-sum.cpp | class Solution {
public:
int n;
int range;
vector<vector<int>> dp;
int helper(int i, int sum, vector<int>& nums, int t) {
if (i >= n) {
return sum == t;
}
if (dp[i][sum + range] != -1) {
return dp[i][sum + range];
}
int takePositive = helpe... | ALGO | 0.999994 | 5.928305 |
c27ffa1d-a7ff-4782-8956-837838bf0a37 | mihneaburlacu/FundamentalAlgorithms | MultiWayTrees/Source.cpp | /*
Burlacu Mihnea-Sebastian
Grupa 9
Am implementat 2 transformari a unui arbore, pornind de la un vector de parinti
Prima din vectorul de parinte in arbore multicai
A doua din arbore multicai in B Tree
A trebuit sa afisam arborele in toate cele 3 reprezentari, deci am implementat 3 prettyprint-uri pornind de la fie... | ALGO | 0.999741 | 4.265117 |
f3c48592-f9ef-43c9-a044-1bb2287c9a34 | ishandutta2007/codeforces | afterall/normal/1452/A.cpp | #include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
#define pb push_back
#define pii pair < int , int >
#define F first
#define S second
#define endl '\n'
#define int long long
#define sync ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#pragma GCC optimize("Ofast,no-stack-protector,unro... | ALGO | 0.999957 | 4.906614 |
0599c301-aa37-4da4-a5f3-66b30a89d434 | zhengxiang94/ocs2_ros2 | ocs2_robotic_examples/ocs2_ballbot/include/ocs2_ballbot/generated/miscellaneous.cpp | #include "miscellaneous.h"
#include <iit/rbd/utils.h>
using namespace iit::Ballbot;
using namespace iit::Ballbot::dyn;
iit::rbd::Vector3d iit::Ballbot::getWholeBodyCOM(const InertiaProperties& inertiaProps, const HomogeneousTransforms& ht) {
iit::rbd::Vector3d tmpSum(iit::rbd::Vector3d::Zero());
HomogeneousTrans... | ALGO | 0.994975 | 6.219775 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.