uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
d5c7de65-28ed-4176-b579-67c6a3d89724 | yogendrarp/leetcode | algorithms/450/heaps/topkfrequency.cpp | #include <bits/stdc++.h>
using namespace std;
void topkfrequency(int arr[], int k, int size)
{
map<int, int> frequency;
for (int i = 0; i < size; i++)
{
frequency[arr[i]]++;
}
map<int, int>::iterator it;
priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> m... | ALGO | 0.999885 | 5.001098 |
e46d50e7-409c-4a05-baa3-c4c09623ba34 | doneni/boj_study | 10825/main.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
struct Student
{
string name;
int lang;
int eng;
int math;
};
bool cmp(const Student &s1, const Student &s2)
{
if(s1.lang == s2.lang)
{
if(s1.eng == s2.eng)
{
if(s1.math == s2.math)
... | ALGO | 0.998735 | 4.071025 |
702fe113-c2d7-4e4d-a4a4-720133c8cf51 | jdnull/LeetCode | 80 Remove Duplicates from Sorted Array II/main.cpp | #include <iostream>
#include <string>
#include <vector>
using namespace std;
class Solution {
public:
int removeDuplicates(vector<int>& nums) {
if (nums.size() < 2) {
return nums.size();
}
int last2 = nums[0];
int last1 = nums[1];
int p = 1;
... | ALGO | 0.998402 | 6.297583 |
1f778204-86ac-4cd9-99f2-4f9bcb48174e | michaelyql/cp | cf/math/2109c1.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define LSOne(S) ((S) & -(S))
#define debug
#ifdef debug
#define db(x) cout << #x " = " << x << endl;
#define bp(x) cout << #x << endl;
#else
#define db(x)
#define bp(x)
#endif
using ll = long long;
using pi... | ALGO | 0.993649 | 3.42628 |
5df8ee05-40fb-4230-bbbe-6a168c096a66 | AlonsoPaulino/competitive-programming | HackerRank/Plus Minus.cpp | #include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
int n;
int pos = 0, neg = 0, ze = 0;
cin >> n;
vector<int> arr(n);
for(int arr_i = 0;arr_i < n;arr_i++){
cin >> arr[arr_i];
arr[arr_i] < 0 ? ++neg : (arr[arr_... | ALGO | 0.998859 | 3.575912 |
f597ee55-28cf-4178-b578-3710de4ddcc5 | Crazy-German/BlastIntegration | PhysX-main/physx/source/geomutils/src/sweep/GuSweepCapsuleTriangle.cpp | #include "GuSweepCapsuleTriangle.h"
#include "GuIntersectionCapsuleTriangle.h"
#include "GuDistanceSegmentTriangle.h"
#include "GuIntersectionTriangleBox.h"
#include "GuSweepSphereTriangle.h"
#include "GuInternal.h"
using namespace physx;
using namespace Gu;
using namespace aos;
#define COLINEARITY_EPSILON 0.00001f
... | ALGO | 0.996821 | 7.596847 |
2f83e1f6-f138-402e-b14a-bdf0787c28c2 | shivamp-24/CSES-solutions | Dynamic Programming/8_Array Description.cpp | #include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define endl "\n"
#define int long long
void func(){
int n, m; cin >> n >> m;
vector<int> arr(n);
for(int i=0; i<n; i++){
cin >> arr[i];
}
vector<vector<int>> dp(n, vector<int>(m+1));
//dp[i][last] -> number of array... | ALGO | 0.999986 | 4.565546 |
48840ee0-f268-4350-8507-5aab6a66d272 | carrtesy/Problem-Solvings | bkj/10757/tmp.cpp | #include <cstdio>
#include <cstdlib>
#include <ctime>
using namespace std;
int main(void){
srand(time(NULL));
for(int t = 0; t < 1000000; t++){
int _A = rand();
int _B = rand();
long long answer = _A + _B;
char A[9], B[9], C[9];
//scanf("%s %s", &A, &B);
sprintf(A, "%d", _A);
sprintf(B, "%d", _... | ALGO | 0.998921 | 3.318769 |
2b3fcc38-ff4a-43c4-b2ba-6dfb6f727ece | dilevin/CSC417-a6-rigid-body-contact | extern/libigl/include/igl/cut_to_disk.cpp | #include "cut_to_disk.h"
#include <map>
#include <set>
#include <deque>
#include <algorithm>
namespace igl {
template <typename DerivedF, typename Index>
void cut_to_disk(
const Eigen::MatrixBase<DerivedF> &F,
std::vector<std::vector<Index> > &cuts)
{
cuts.clear();
Index nfaces = F.rows();
... | ALGO | 0.990404 | 4.886522 |
c6ddcec7-06b2-4614-95e4-dce82a472e59 | FennelDumplings/leetcode-maxed_out | algorithm/cpp/prob1-500/prob129_medium_Sum-Root-to-Leaf-Numbers.cpp | // prob129: Sum Root to Leaf Numbers
/*
* Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number.
* An example is the root-to-leaf path 1->2->3 which represents the number 123.
* Find the total sum of all root-to-leaf numbers.
* Note: A leaf is a node with no children.... | ALGO | 0.999914 | 6.535934 |
2d1e7d44-474c-49c8-9064-c856032e76bc | sendoru/problem_solving | source/codeforces/efc_r111_b.cpp | #include <iostream>
#include <vector>
#include <string>
using namespace std;
int main(void)
{
cin.tie(0);
cout.tie(0);
ios_base::sync_with_stdio(false);
int t;
cin >> t;
while (t--)
{
int n, a, b, ans;
cin >> n >> a >> b;
// b >= 0 : maximize op, ans = (a + b) * s.length()
// b < 0 : minimize op, ans = ... | ALGO | 0.998637 | 4.539167 |
b1f8feab-0c8b-4bfb-9ad7-f19a6645c7d6 | jmichelstl/hierarchical_networks | src/affine_displace.cpp | /*
This code provides a means of adding large-scale position disorder to networks.
The program accepts a large-scale skeleton and a description of the small-scale
structure of a network, then iteratatively distorts the large-scale skeleton.
For each configuration of the skeleton, a large-scale envelope of finite width
... | ALGO | 0.996769 | 4.391463 |
bb00bdd2-9bbb-4d83-b2ed-8e0d36888fa0 | yung751206/ctci | CTCI/main.cpp |
#include "4_2.h"
#include "4_1.h"
#include <iostream>
#include <list>
using namespace std;
int main ()
{
tree t1;
t1.root = new node;
t1.root->left = new node;
t1.root->right = new node;
t1.root->left->right = new node;
t1.root->left->left = new node;
t1.root->left->right->right = new node;... | ALGO | 0.996188 | 3.647393 |
3cb13144-97eb-4fe7-a712-0eac79f3bb9d | pytorch/FBGEMM | fbgemm_gpu/src/faster_hash_ops/faster_hash.cpp | #include <ATen/Parallel.h> // @manual
#include <torch/csrc/jit/runtime/static/ops.h> // @manual
#include <torch/library.h> // @manual
#include <torch/torch.h> // @manual
#include "c10/core/ScalarType.h" // @manual
#include "c10/core/TensorImpl.h" // @manual
#include "fbgemm_gpu/faster_hash_ops/common_utils.cuh" // @man... | ALGO | 0.975873 | 7.093125 |
b007418c-730d-4838-9a8e-e7abfa62f395 | HuaiYu-code/x2t-wasm | x2t-wasm/core/Common/3dParty/cryptopp/md4.cpp | // md4.cpp - modified by Wei Dai from Andrew M. Kuchling's md4.c
// The original code and all modifications are in the public domain.
// This is the original introductory comment:
/*
* md4.c : MD4 hash algorithm.
*
* Part of the Python Cryptography Toolkit, version 1.1
*
* Distribute and use freely; there are n... | ALGO | 0.999759 | 6.482319 |
c5370d44-eb5e-430d-bfc9-22851df99d23 | Easso/doubly-linked-list-deque | dequealistdriver.cpp | #include "deque.h"
#include <iostream>
//--------helper functions I made to retrieve the url and name from the "'stuff'" format commands are given as--------
std::string extract_name(std::string input);
std::string extract_url(std::string input);
std::string extract_name(std::string input_en) {
std::string result_... | ALGO | 0.955013 | 4.745305 |
e302cbe9-8b60-4ed6-a325-e7a505acb122 | GoranMarjanovic90/IoT22_230316-main | C++_TaskSolutions/Övning39.cpp | #include<iostream>
using namespace std;
void Draw(int n)
{
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
{
if(i<=j)
cout<<"* ";
else
cout<<" ";
}
cout<<endl;
}
} | ALGO | 0.998936 | 3.016443 |
3e766440-f803-43dd-b188-8c16b4baa23a | aykut-bozkurt/Algos | divide-and-conquer/median-of-2-array.cpp | #include "median-of-2-array.h"
#include <algorithm>
int median_of_2_array(const std::vector<int>& a, const std::vector<int>& b, int start_idx1, int start_idx2, int end_idx1, int end_idx2){
if(start_idx1 == end_idx1){
// combine; average 2 median values for merged list
return (a[start_idx1] + b[sta... | ALGO | 0.999983 | 6.081701 |
446fef2e-f3e0-4913-a6bd-4d726cc87acb | mmatrosov/FKN2020 | preliminary/C/33906251.cpp | //#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{
ios::sync_with_stdio(0);
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; i++) cin >> a[i];
sort(a.begin(), a.end());
a.resize(unique(a.begin(), a.end()) - a.begin());
... | ALGO | 0.999959 | 4.67273 |
b985c94d-ed78-4b54-afe8-967144992676 | RavenColEvol/competitive-journey | Notes/Graph/bford.cpp | #include<bits/stdc++.h>
#define FIO ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
using namespace std;
typedef long long ll;
vector<tuple<int,int,int>> g = {
{0, 1, 1},
{0, 3, 3},
{0, 2, 3},
{1, 2, 1},
{1, 3, 1},
{2, 3, 2},
};
int dis[4];
void bf() {
fill(dis, dis + 4, 1... | ALGO | 0.999904 | 3.284697 |
1547e289-6b84-4de9-80f2-3b29c684e939 | tanmoydebnath56/C-Practice | plus minus.cpp | #include<iostream>
using namespace std;
int main(){
int n,i;
float pos=0,neg=0,zero=0;
int a[n];
float x,y,z;
cout<<"Enter the size of array\n";
cin>>n;
cout<<"Enter the array\n";
for(i=0;i<n;i++){
cin>>a[i];
}
for(i=0;i<n;i++){
if(a[i]>0){
pos++;
}else if(a[i]<0){
neg++;
} else if(a[i... | ALGO | 0.999479 | 3.342442 |
d85d74ee-df8b-4ce1-b592-5904477b2312 | AshminJayson/Competitive_Coding | Events/CodeChef May Lunchtime/TANDJ1.cpp | #include <bits/stdc++.h>
using namespace std;
#define start(x) int x;cin>>x;while(x--)
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
start(t){
int a,b,c,d,k;
cin>>a>>b>>c>>d>>k;
int l1=abs(c-a);
int l2=abs(d-b);
int total=l1+l2;
k-=total;
if(k<0)
cout<<"No\n";
... | ALGO | 0.999962 | 3.380608 |
d2c70e14-0657-4169-8266-aba8d110a81f | PhoenixGS/Solutions | LOJ/114.cpp | #include <cstdio>
int n, m;
long long v[100];
int last;
long long vv[100];
int flag;
void insert(long long x)
{
for (int i = 60; i >= 0; i--)
{
if ((1ll << i) & x)
{
if (v[i])
{
x = x ^ v[i];
}
else
{
v[i] = x;
return;
}
}
}
flag = 1;
}
void build()
{
for (int i = 0; i <= 52;... | ALGO | 0.999877 | 4.478387 |
7175f764-5c7a-4d6d-9d41-701627d065f3 | ishandutta2007/codeforces | mangooste/normal/161/D.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
struct node {
unordered_map<int, int> cnt;
int del;
node() : cnt({}), del(0) {}
inline int size() {
return cnt.size();
}
inline int merge(node &n, int k) {
int res = 0;
for (auto [len, num] : n.cnt) {
if (cnt.find(k - len - n.del - ... | ALGO | 0.999964 | 4.780556 |
69bdfcc4-ce78-4267-b201-d4b6c0e6c2a5 | thecodophile/My-DSA-Code | Array/CharArray/validPalindrome.cpp | // Valid Palindrome
class Solution
{
private:
bool valid(char ch)
{
if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || (ch >= '0' && ch <= '9'))
{
return 1;
}
return 0;
}
char toLowerCase(char ch)
{
if ((ch >= 'a' && ch <= 'z') || (ch >=... | ALGO | 0.999953 | 6.317456 |
f0d9ba04-0ce7-486e-bc4b-e5b55291d0d2 | viccch/viccch.github.io | tin_delaunay_triangulation/src/main.cpp | #include "utils.hpp"
int main(int argc, char **argv)
{
auto cal_start = std::chrono::system_clock::now();
std::vector<Point> data;
read_file(argv[1], data);
{
// auto tin = std::shared_ptr<Tin>(Tin::build_from_rectangle(data));
// auto tin = std::shared_ptr<Tin>(Tin::build_from_convex_with_seed(da... | ALGO | 0.984366 | 3.88985 |
232a497f-c243-484a-9c51-6e5e00688176 | ishandutta2007/codeforces | kostka/normal/1004/C.cpp | //Bartek Kostka
// You are not prepared!
#include "bits/stdc++.h"
using namespace std;
#define x first
#define y second
#define SZ(x) int(x.size())
#define ll long long
#define pii pair <int, int>
#define vi vector <int>
const int MAXN = 1e5+7;
int main()
{
ios_base::sync_with_stdio(0);
int n;
cin >> n;
v... | ALGO | 0.999965 | 3.673949 |
752f09bb-570d-412d-adf1-264b24c3d4ca | vikasjha2003/Daily-Practice | C++/Conditional/absolute.cpp | #include<iostream>
using namespace std;
int main () {
int n;
cout<<"Enter the number : ";
cin>>n;
// if (n>=0) {
// cout<<"Absolute value of the number is "<<n;
// }
// else {
// cout<<"Absolute value of the number is "<<-n;
// }
if (n<0) {
n = -n;
}
cout... | ALGO | 0.998394 | 3.377445 |
a8b0970e-e534-4621-9146-34dcc6db941f | Coderboy004/MainGateGuardV2 | 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 |
83215b32-6d11-4702-bab8-ff615606748b | kavin-arvind/File_Compression | FileCompression/huffman-zip.cpp | #include "tree-encoding.cpp"
#include "constants.h"
// given a compressed binary string, convert it to the original string using the huffman tree
std::string inflate(std::string &compressed)
{
treeEncodebits enc;
int i = 0;
i += GAMMA;
int sz = enc.g(compressed.substr(0, GAMMA));
string bitenc = ... | ALGO | 0.999811 | 5.231416 |
b3a0d379-0747-453b-aa63-6407f51ba9a7 | NitaiBanik/LeetCode | 763-partition-labels/763-partition-labels.cpp | class Solution {
public:
vector<int> partitionLabels(string s) {
vector<int> maxPosition(125, -1);
for(int i = 0; i < s.size(); i++)
maxPosition[s[i]] = max(maxPosition[s[i]], i);
int cnt = 0;
vector<int> lengths;
... | ALGO | 0.999806 | 6.083502 |
eacebac6-7833-4750-b03b-b8d48a2cda18 | Johannyjm/c-pro | AtCoder/othercontests/joi2009ho/b.cpp | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep1(i, n) for (int i = 1; i < (n); ++i)
using namespace std;
typedef long long ll;
ll calc_dist(ll d, ll x, ll y){
return min(abs(x-y), d-abs(x-y));
}
int main() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
ll d, n,... | ALGO | 0.999954 | 4.362767 |
40cba534-df5d-4ac1-bf51-2e47ab3279e1 | Iunhims/DSA | DSA/CTDL038.cpp | #include<bits/stdc++.h>
using namespace std;
int Three(string s){
int num=0;
for(int i=0;i<s.size();++i){
if(s[i]=='5') s[i]='3';
num = num*10 + s[i]-'0';
}
return num;
}
int Five(string s){
int num=0;
for(int i=0;i<s.size();++i){
if(s[i]=='3') s[i]='5';
num=num*10 + s[i]-'0';
}
return num;
}
int... | ALGO | 0.999705 | 4.556847 |
ce1fa203-7128-49ab-bd16-bbc3b75a44ee | vedas-dixit/Cplusplus | graph/dijkstra.cpp | /**
* @file
* @brief [Graph Dijkstras Shortest Path Algorithm
* (Dijkstra's Shortest Path)]
* (https://en.wikipedia.org/wiki/Dijkstra%27s_algorithm)
*
* @author [Ayaan Khan](http://github.com/ayaankhan98)
*
* @details
* Dijkstra's Algorithm is used to find the shortest path from a source
* vertex to all other... | ALGO | 0.999939 | 5.620116 |
cd26e4b7-e2c5-4867-a26c-aa9453fbd53f | 01amine/sopimem | 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 |
3ceafce4-0fa2-43be-ac8a-82b0cbb2e7e3 | leverimmy/Codes | 比赛/学校/2019-11-12测试1/source/PC60_HB-何睦/attack.cpp | #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
#define NO 10005
#define INF 0x3f3f3f3f
#define mp(x, y) make_pair(x, y)
#define fi first
#define se second
#define fup(i, x, y) for (register int i = x;... | ALGO | 0.999803 | 3.550019 |
763aa694-1f73-4a96-aa10-8d92d24406f1 | kyungmax/AlgorithmStudy | STL/11650_sort.cpp | #include <stdio.h>
#include <algorithm>
using namespace std;
typedef struct point{
int x;
int y;
}POINT;
POINT pos [100010];
bool cmp_POINT1(POINT a, POINT b) { return a.x<=b.x; }
bool cmp_POINT2(POINT a, POINT b) { return a.y<b.y; }
int main(){
int N;
scanf("%d", &N);
for(int i=0;i<N;i++)
scanf("%d%d", &pos[... | ALGO | 0.999785 | 3.69817 |
950f881b-8f32-4ae6-b47e-6c76461b1f7e | qiaoyu2015/QVTKWidget | src/CPU/demo/univmon.cpp | #include <stdio.h>
#include <stdlib.h>
#include <unordered_map>
#include <vector>
#include "../UnivMon/UnivMon.h"
using namespace std;
#define START_FILE_NO 1
#define END_FILE_NO 10
struct FIVE_TUPLE{ char key[13]; };
typedef vector<FIVE_TUPLE> TRACE;
TRACE traces[END_FILE_NO - START_FILE_NO + 1];
void ReadInTraces... | DATA | 0.919746 | 3.691395 |
fd7593e9-849b-488f-b24e-0f0d9a5716fd | DucL0c/DSA_PTIT | src/DSA08006so0vaso9.cpp | #include <bits/stdc++.h>
using namespace std;
int n,a[100],d=0;
queue<int> q;
void in(){
int c=1;
for(int i=1;i<=15;i++){
q.push(a[i]);
}
while(!q.empty() && q.front()==0) q.pop();
long long res=0;
while(!q.empty()){
if(q.front()==1) res = res*10 + 9;
else res = res*10 + ... | ALGO | 0.999777 | 4.890642 |
65462562-5442-4e5e-ba36-91d5be1399c8 | preetikumari5/DSA | hcf.cpp | #include <iostream>
using namespace std;
int main()
{
int n1, n2;
cin>>n1;
cin>>n2;
int hcf = 1;
// for(int i=1; i<=min(n1,n2);i++)
// {
// if(n1%i ==0 && n2%i ==0)
// {
// if(i>hcf)
// {
// hcf=i;
// }
// }
// }
... | ALGO | 0.999907 | 4.515107 |
1c410012-cd5c-42a2-ad44-74e396fad95f | sarvex/leetcode-basic | solution/1600-1699/1638.Count Substrings That Differ by One Character/Solution.cpp | class Solution {
public:
int countSubstrings(string s, string t) {
int ans = 0;
int m = s.length(), n = t.length();
int f[m + 1][n + 1];
int g[m + 1][n + 1];
memset(f, 0, sizeof(f));
memset(g, 0, sizeof(g));
for (int i = 0; i < m; ++i) {
for (int j... | ALGO | 0.999978 | 6.393209 |
42f123ea-c6f6-49ad-be01-2b24e5b3fb63 | Ashutosh-0506/Striver-DP | L14_ATargetsum.cpp | //***********************************ASHUTOSH KUMAR***********************************//
/*
कर्मण्येवाधिकारस्ते मा फलेषु कदाचन।
मा कर्मफलहेतुर्भूर्मा ते सङ्गोऽस्त्वकर्मणि॥
Karmanye vadhikaraste Ma Phaleshu Kadachana,
Ma Karmaphalaheturbhurma Te Sangostvakarmani,
The meaning of the verse is :—
You have the right to wo... | ALGO | 0.99994 | 5.146972 |
486dcfb3-a606-4daa-8dfa-08863ffb1d03 | Sanchit-Garg-4850/The-Huffman-Highway-230908 | Assignment 7/Assignment_7_Q1.cpp | #include <bits/stdc++.h>
using namespace std;
int maxProjectValue(int N, vector<int>& values, vector<vector<string>>& required_languages, set <string>&known_languages) {
int sum=0;
for(int i=0 ; i<N ;i++){
bool flag=true;
for(auto language : required_languages[i]){
if(known_language... | ALGO | 0.9999 | 6.109842 |
c2413e50-14db-4d35-8e2d-fd24c5cbfa57 | behitek/acm-epu | SPOJ/cpp/spoj-ptit/PTIT128D.cpp | #include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <vector>
std::vector<int> ed[1010];
int a[1010];
int ... | ALGO | 0.999582 | 3.456112 |
37fe1289-5b4a-4b29-b991-d2264ac97b9c | sontung/old_code | sph_data/libigl-example-project/main_smoothing.cpp | #include <igl/barycenter.h>
#include <igl/cotmatrix.h>
#include <igl/doublearea.h>
#include <igl/grad.h>
#include <igl/jet.h>
#include <igl/massmatrix.h>
#include <igl/per_vertex_normals.h>
#include <igl/readDMAT.h>
#include <igl/readOBJ.h>
#include <igl/repdiag.h>
#include <igl/opengl/glfw/Viewer.h>
#include <iostrea... | ALGO | 0.99759 | 5.374705 |
67b97635-7273-4f6b-a1f5-2b7807dcb845 | ishandutta2007/codeforces | syloviaely/normal/623/E.cpp | #include<iostream>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<algorithm>
using namespace std;
int K,I[31000],nI[31000],C[31000],D[31000],fir[31000],mi[31000],en[31000];
int ans[31000],E[31000],F[31000];
long long n;
const int mo=1e9+7,N=32000;
const long double pi=acos(-1);
struct atom{
long double x,... | ALGO | 0.999968 | 3.902891 |
b8613045-b872-47ae-890f-cbe360f7d02e | ZiluZhang/LeetCode-2 | 0227.cpp | class Solution {
public:
int calculate(string s) {
int res = 0;
stack<int> st;
int len = s.length();
int num = 0;
char op = '+';
unordered_set<char> ops({'+','-','*','/'});
for (int i = 0; i < len; i++) {
if ('0' <= s[i] && s[i] <= '9') {
... | ALGO | 0.999922 | 5.096464 |
e317361b-f3fa-4083-8d01-dbb3758b7562 | Yourrrrlove/leetcode-2 | 数组/有效的完全平方数.cpp | #include <iostream>
using namespace std;
class Solution{
public:
bool isPerfectSquare(int num){
int left = 0, right = num, mid;
while(left <= right){
mid = left + (right - left) / 2;
if((long long) mid*mid < num) left = mid + 1;
else if((long long) mid*mid > num)... | ALGO | 0.999775 | 4.741827 |
7c53de24-122a-431d-91b0-2ad439e1d6fe | pannalamanasa/Basic-Programs- | gcd.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution {
public:
vector<int> lcmAndGcd(int a, int b) {
int a1 = a;
int b1 = b;
while (a > 0 && b > 0) {
if (a > b) {
a = a % b;
} else {
b = b % a;
}
}
... | ALGO | 0.999634 | 6.127058 |
42e97e85-df8a-4e42-81bb-398e19eb5366 | Soma53/atcoder | CPLUS/abc300/325/E.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i=0; i<(int)(n); ++i)
#define repp(i, s, n) for (int i=(s); i<=(int)(n); ++i)
using ll = long long;
const ll mod = 1000000007;
const ll INF = numeric_limits<ll>::max();
template <typename T>
bool chmax(T &a, const T& b) {if (a < b) {a = b;retur... | ALGO | 0.9999 | 4.293384 |
49ae166f-b9bf-4db0-8ed4-500fbfd7a4fa | april211/Data_Structure_Learning | PTA202009/实验/实验2020.9.8_长期/tt.cpp | #include <cstring>
#include <iostream>
#include <string>
using namespace std;
int mm[10011][10011];
struct TNode
{
int space;
int prior;
char name[261];
struct TNode *son, *sib;
};
int cmp(struct TNode *p, struct TNode *q)
{
if (p->prior > q->prior)
return 1;
... | ALGO | 0.999336 | 4.022498 |
4c9300c7-c13c-447b-aae6-f24dca2bd833 | rodep/cppPrimer | Chapter 5/cumulativeSum.cpp | #include <iostream>
#include <cstring>
#include <cmath>
using namespace std;
int main(){
int number=0;
int sum=0;
int cont=0;
cout << "Type the number you want to cumulative sum. Type 0 to exit: "<< "\n";
cin >> number;
if(number == 0){
cout << "Goodbye!";
}
else{
while(number !... | ALGO | 0.993305 | 3.993321 |
20f38b80-9090-468e-ba7b-aecddc060874 | G0T-cha/G0T-cha.github.io | thirdparty/linux/miracl/miracl_osmt/source/curve/pairing/zzn8.cpp | /*
* MIRACL C++ Implementation file zzn8.cpp
*
* AUTHOR : M. Scott
*
* PURPOSE : Implementation of class ZZn8 (Arithmetic over n^8)
*
* WARNING: This class has been cobbled together for a specific use with
* the MIRACL library. It is not complete, and may not work in other
* applications
*
*/
... | ALGO | 0.996882 | 5.766033 |
727fe578-f075-47f6-8519-929e0bbce9cc | aroragarvit/c-Object_oriented | c++/copyconstclass.cpp | #include<iostream>
#include<conio.h>
using namespace std;
class Example {
// Member Variable Declaration
int a, b;
public:
//Normal Constructor with Argument
Example(int x, int y) {
// Assign Values In Constructor
a = x;
b = y;
cout << "\nIm Constructor";
}
//Copy Con... | TOOL | 0.946228 | 5.321358 |
9c8017ab-626c-401a-acc3-8bf69986e9c6 | hyper-hronoz/university | Documents/university/3_practical_lab/Romae.cpp | #include <cmath>
#include <iostream>
using namespace std;
int main() {
double sum = 0;
int n = 2;
double previous;
double current = 5.0 / 6;
do {
previous = current;
sum += current;
current = 1 / pow(2, n) + 1 / pow(3, n);
n++;
cout << "I: " << n << endl;
... | ALGO | 0.999266 | 3.311738 |
8a3ff7c4-1b92-47a0-950f-2347f5875f82 | BilawalAliFaiz/c-plus-plus-programs | function/call by refernce 2nd method.cpp | #include<iostream>
using namespace std;
void swap(int a,int b)
{
int temporary;
temporary=a;
a=b;
b=temporary;
}
//call by refernce
void swap_pointer(int*a,int*b)
{
int temporary;
temporary=*a;
*a=*b;
*b=temporary;
}
int main()
{
int x=6,z=8;
cout<<"the value of x is "<<x<<":the value of z is "<<z<<endl;
swa... | ALGO | 0.998922 | 4.232197 |
bfab8e69-f407-47c7-aa74-7882f4e1de56 | koba-e964/contest | atcoder/indeednow-quala/a.cpp | #include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include ... | ALGO | 0.999491 | 4.041881 |
d6a2aebb-9cfc-4b76-b174-ea1b1c458dbe | devanshdeveloper/cpp | document/volumeOfSphere.cpp | #include <iostream>
using namespace std;
int main()
{
int rad1;
float volsp;
cout << "\n\n Calculate the volume of a sphere :\n";
cout << "---------------------------------------\n";
cout << " Input the radius of a sphere : ";
cin >> rad1;
volsp = (4 * 3.14 * rad1 * rad1 * rad1) / 3;
cou... | ALGO | 0.951058 | 3.701757 |
e74fb39f-8ffa-4589-9668-55d98c50972c | kajgm/gaussian-acceleration | fpga/comp-opt/gauss_test.cpp | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <math.h>
#include <sys/types.h>
#include "gauss.h"
#include "my_timer.h"
/* Print input matrices */
void print_inputs(float *A, float *B, float *X)
{
int row, col;
if (SIZE < 10)
{
printf("\nA =\n\t");
for (row = 0; row <... | ALGO | 0.999139 | 5.339424 |
c9fb4da2-04f1-4f43-bcba-ef30b8cc4d56 | Thasin-Sheikh/CSES-Solutions | Digit Queries .cpp | ///*Bismillahir Rahmanir Rahim***///
/***Stay_Home_Stay_Safe***/
///**Author Thasin Sheikh**///
#include<bits/stdc++.h>
using namespace std;
#define MAX 1e6+10
#define MOD 1000000007
#define PI acos(-1)
#define R 510
#define makefast__ ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using ll=long long int ;
u... | ALGO | 0.999899 | 4.092944 |
7f597e9a-9f23-4237-96c8-8c2c935b77e4 | juyoungj/EECS281 | project4/project4.cpp | // Project Identifier: 8729BF7B2234189B8DF8A6DD31770D2B18569C27
#include <getopt.h>
#include <iostream>
#include <vector>
#include <string>
#include <iomanip>
#include <math.h>
#include <algorithm>
#include <limits>
using namespace std;
struct DonutShop
{
int x;
int y;
// unsigned int location;
char ... | ALGO | 0.999145 | 4.83277 |
549932c0-3eb8-4fdd-8b80-7f03d14a521a | WantTo-Sleep/Linux | 每日一练/只出现一次的数字Ⅱ.cpp | class Solution {
public:
int singleNumber(vector<int>& nums)
{
int i = 0;
while (i < nums.size())
{
int flag = 1;
// 找与第 i 个元素相同的,找到就放到第 i 个元素后面
for (int j = i + 1; j < nums.size() && flag < 3; ++j)
{
if (nums[j] == nums[i])... | ALGO | 0.999829 | 5.341634 |
8a39a35b-c30a-4968-8c8b-995534c6b655 | VA-run23/GeeksforGeeks-POTD | January/POTD_11_01_2025.cpp | class Solution {
public:
int longestUniqueSubstr(string s) {
// code here
unordered_map<char, int> chIdx;
int maxLen = 0;
int start = 0;
for (int i = 0; i < s.size(); i++) {
if (chIdx.find(s[i]) != chIdx.end()) {
start = max(start, chIdx[s[i]] + 1... | ALGO | 0.999925 | 6.430205 |
98366b8a-ad4c-4432-856b-1530cc72ed2c | pippi0057/Competitive-Programming | AtCoder/ABC/-190/182/C.cpp | #include <bits/stdc++.h>
using namespace std;
int scan() { return getchar(); }
void scan(int &a) { cin >> a; }
void scan(long long &a) { cin >> a; }
void scan(char &a) { cin >> a; }
void scan(double &a) { cin >> a; }
void scan(string &a) { cin >> a; }
template <class T, class S> void scan(pair<T, S> &p) { scan(p.first)... | ALGO | 0.999922 | 3.70058 |
7024363d-5ac9-4ab6-8013-d7c9549d85e6 | caoshuai619/Cpp | ParanthesesBalanced.cpp | #include <iostream>
#include <stack>
#include <string>
using namespace std;
//这是一个用来匹配[],{},()是否匹配的程序,用的是stack
bool Match(char a, char b) {
if (a == '(' && b == ')') return true;
else if (a == '{' && b == '}') return true;
else if (a == '[' && b == ']') return true;
else
return false;
}
bool AreParanthesesBalanc... | ALGO | 0.999061 | 4.104673 |
af85dc81-8334-46fa-b14e-f711deb777ce | mahim007/Online-Judge | uva/10780.cpp | #include<bits/stdc++.h>
using namespace std;
#define i64 long long int
#define maxx 5009
bool tag[maxx];
vector<i64>V;
int main()
{
tag[0]=tag[1]=1;
for(i64 i=4;i<maxx;i=i+2)
tag[i]=1;
for(i64 i=3;i*i<maxx;i=i+2)
{
if(tag[i]==0)
{
for(i64 j=i*i;j<maxx;j=j+i+i)
... | ALGO | 0.999398 | 4.005731 |
0bb84503-1cb7-437e-88b7-710c4b068201 | LingmoOS/LingmoOS | shell/bc/OCRServer/3rdparty/ncnn/src/layer/mips/concat_mips.cpp | #include "concat_mips.h"
namespace ncnn {
Concat_mips::Concat_mips()
{
#if __mips_msa
support_packing = true;
#endif // __mips_msa
}
int Concat_mips::forward(const std::vector<Mat>& bottom_blobs, std::vector<Mat>& top_blobs, const Option& opt) const
{
int dims = bottom_blobs[0].dims;
int positive_axis = ... | ALGO | 0.926329 | 5.58552 |
122e349d-bf4a-4c76-82f6-a704248d39bb | KirchakKirill/course-intelligent-systems | lab5/lab5/main.cpp | #include <iostream>
#include <string>
#include <set>
#include <vector>
#include <fstream>
#include <algorithm>
#include <map>
using namespace std;
struct Fact
{
public:
string value;
Fact(string value)
{
this->value = value;
};
Fact()
{
};
string to_string()
{
return value;
}
bool operator < (const Fac... | ALGO | 0.999239 | 3.84077 |
2212cb01-a16f-4b7b-bb9b-d072acbf8254 | ishandutta2007/codeforces | darkkcyan/normal/1208/A.cpp | #include <bits/stdc++.h>
using namespace std;
using namespace std::placeholders;
#define llong long long
#define xx first
#define yy second
#define len(x) ((int)x.size())
#define rep(i,n) for (int i = -1; ++ i < n; )
#define rep1(i,n) for (int i = 0; i ++ < n; )
#define all(x) x.begin(), x.end()
// #define rand __ran... | ALGO | 0.999832 | 4.19055 |
54bdd1f5-43aa-47de-9a65-15f3aa111fdd | MpowerMPO/Code | src/httpserver.cpp | #include "httpserver.h"
#include "chainparamsbase.h"
#include "compat.h"
#include "util.h"
#include "netbase.h"
#include "rpc/protocol.h" // For HTTP status codes
#include "sync.h"
#include "ui_interface.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#inclu... | WEB | 0.894861 | 4.209087 |
dad27bcc-9265-4fe5-ba65-9c15d30166c1 | kenrick95/code-archive | cec/2.cpp | #include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <string>
#define INF 1000000000000LL
typedef long long int64;
typedef unsigned long long qword;
using namespace std;
/* Problem:
* URL:
*/
int main(){
//freopen("test.in","r",stdin);
//fre... | ALGO | 0.999934 | 3.843104 |
85062fa8-c8b6-4263-a7bc-a1e0ae801667 | uos/katana_driver | kni/KNI_4.3.0/src/InvKin/KatanaKinematics6M180.cpp | #include "KNI_InvKin/KatanaKinematics6M180.h"
#include "common/MathHelperFunctions.h"
#include <algorithm>
namespace KNI {
const double KatanaKinematics6M180::_tolerance = 0.001;
const int KatanaKinematics6M180::_nrOfPossibleSolutions = 8;
void
KatanaKinematics6M180::DK(coordinates& solution, encoders const& current... | ALGO | 0.995608 | 5.732333 |
29270b42-20ef-4305-870d-24965b82cb50 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_9077_5.cpp | #include <bits/stdc++.h>
using namespace std;
const long long Maxn = 5e5 + 5, Maxm = 4e6 + 5;
const long long inf = 1e6;
long long n, q, a[Maxn], mn[Maxm], cnt[Maxm], lz[Maxm];
void pushup(long long k) {
if (mn[k << 1] == mn[k << 1 | 1])
mn[k] = mn[k << 1], cnt[k] = cnt[k << 1] + cnt[k << 1 | 1];
else if (mn[k ... | ALGO | 0.999964 | 4.239246 |
3f1604ac-5388-41aa-9dcc-3458975a8e0f | CookiC/Codeforces | ECR 24 B. Permutation Game.cpp | //Author:CookiC
//#include"stdafx.h"
#include<iostream>
#define maxn 110
//#pragma warning(disable : 4996)
using namespace std;
int n,m;
int l[maxn],a[maxn];
bool vis[maxn];
int main(){
// freopen("test.in","r",stdin);
// freopen("test.out","w",stdout);
ios::sync_with_stdio(false);
int i,x;
cin>>n>>m;
for(i=0;i... | ALGO | 0.999991 | 3.037051 |
b0d6b70c-409d-46c0-995c-fbf28439ecb9 | PauloMiranda98/Grupo-Preparatorio-para-OBI-2019 | Contest 05º semana/A.cpp | #include <iostream>
using namespace std;
int main() {
int n, x, y, z;
cin >> n;
cin >> x >> y >> z;
//Vamos ordenar x <= y <= z
if(y < x)
swap(x, y);
if(z < x)
swap(x, z);
if(z < y)
swap(y, z);
int cont = 0;
if(n >= x){
cont++;
n -= x;
}
if(n >= y){
cont++;
n -= y;
}
if(n >= z){
... | ALGO | 0.999913 | 3.74697 |
3110f3c8-275b-474d-a657-936a29bac814 | guessable/backup | cpp/LeetCode/1833.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
class Solution {
public:
int maxIceCream(vector<int>& costs, int coins) {
sort(costs.begin(), costs.end());
int count = 0;
int sum = 0;
for(int cost : costs) {
sum += cost;
if(sum <= coins) {... | ALGO | 0.999799 | 6.03042 |
10a4cc6d-a80f-4b56-b3ce-64e008016c86 | unelmacoin/unelmacoin | src/wallet/feebumper.cpp | #include <consensus/validation.h>
#include <wallet/coincontrol.h>
#include <wallet/feebumper.h>
#include <wallet/fees.h>
#include <wallet/wallet.h>
#include <policy/fees.h>
#include <policy/policy.h>
#include <policy/rbf.h>
#include <validation.h> //for mempool access
#include <txmempool.h>
#include <utilmoneystr.h>
#i... | TOOL | 0.992932 | 7.098897 |
ceaf1ddc-8752-4055-b1ca-4a7d006e9c3a | vedantkokane10/Strivers_SDE_Sheet | 08_Greedy_Algorithm/04_Fractional_Knapsack.cpp | /*
Given weights and values of n items, we need to put these items in a knapsack of capacity w to get the maximum total value in the knapsack.
Return a double value representing the maximum value in knapsack.
Note: Unlike 0/1 knapsack, you are allowed to break the item here.
The details of structure/class is defined in... | ALGO | 0.99999 | 6.000863 |
702523cc-4716-452c-af65-4ed0b070329c | Apeksha-22/POTD | GFG/AUGUST/13-08-2025.cpp | // Tywin's War Strategy
class Solution {
public:
int minSoldiers(vector<int>& arr, int k) {
int n=arr.size();
int cnt=0,ans=0;
vector<int>temp;
for(int x : arr){
if(x % k == 0){
temp.push_back(0);
}else
temp.push_back(k-(x%k));
... | ALGO | 0.999922 | 3.998322 |
7063a539-b59c-4735-af5e-52c2e97210bb | brown0394/algorithm_practice | findingParentNode.cpp | #include <iostream>
#include <vector>
#include <queue>
int main() {
int N;
scanf_s("%d", &N);
std::vector<std::vector<int>> arr(N+1);
std::vector<int> parents(N + 1);
int from, to;
for (int i = 0; i < N-1; ++i) {
scanf_s("%d %d", &from, &to);
arr[from].push_back(to);
arr[to].push_back(from);
}
std::queue... | ALGO | 0.999985 | 4.816473 |
3004a660-26fe-4f49-a21c-25cf038dd67c | wjw164833/RtkGpsForPhone | app/src/main/jni/simonlynen_android_libs/eigen/jni/eigen/doc/examples/DenseBase_template_int_middleCols.cpp | #include <Eigen/Core>
#include <iostream>
using namespace Eigen;
using namespace std;
int main(void)
{
int const N = 5;
MatrixXi A(N,N);
A.setRandom();
cout << "A =\n" << A << '\n' << endl;
cout << "A(:,1..3) =\n" << A.middleCols<3>(1) << endl;
return 0;
}
| ALGO | 0.940944 | 3.154174 |
69c51c4e-297c-4992-b35a-bf1001dc3377 | deepakdashcode/Coding | striver/L3 Patterns/2nd.cpp | /*
Enter n : 5
*
* *
* * *
* * * *
* * * * *
* * * *
* * *
* *
*
*/
#include<iostream>
using namespace std;
int main()
{
int n;
cout << "Enter n : ";
cin >> n;
for(int i = 1; i <= n; i ++)
{
for(int j = 1; j <= i; j ++)
{
cout << "* ";
}
co... | ALGO | 0.999878 | 4.085547 |
4f264fc7-c72f-49bd-9ac9-06ac20f5352e | ZJWang9928/PAT-Solutions | Advanced/1011.cpp | #include <algorithm>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <queue>
#include <string>
#include <vector>
using namespace std;
double W, T, L;
double maxW, maxT, maxL, curMax, res;
int curIdx;
char ret[3] = {'W', 'T', 'L'};
int main() {
ios::sync_with_stdio(false);
... | ALGO | 0.999709 | 3.857446 |
3f2de2bf-c05e-48f3-888e-b2d1f298bd45 | hadiuzzaman524/L2t1-c- | string exe/main.cpp | #include <iostream>
#include <string>
#include<cctype> //used for isspace()
using namespace std;
int main()
{
string header( "****counts words ****\n"),jaman("enter a text and terminate with a period and return:");
string line(60,'-'),text;
cout<< header<<endl<<jaman<<endl<<line<<endl;
getline(c... | ALGO | 0.9194 | 3.617119 |
64705a5f-f38b-449c-9704-b3a9c4c38e67 | AlessandroCilardo/NaplesPU-toolchain | compiler/lib/CodeGen/LiveInterval.cpp | #include "llvm/CodeGen/LiveInterval.h"
#include "LiveRangeUtils.h"
#include "RegisterCoalescer.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/iterator_range.h"
#include "llvm/CodeGen/LiveIntervals.h"
#include "llvm... | TOOL | 0.994215 | 7.942347 |
06f6e0eb-bf4b-43a8-bd76-9bcf808d210a | 1tav0/TranslatingDsa | C++/DP/09-maximumPathSum.cpp | #include <iostream>
#include <vector>
using namespace std;
/************************Grid*************************/
class Solution{
public:
/* ------------------------------------------------------------------- */
//Recursion
//tc - 3`n //3 options every time
//sc - O(n) recursion stack space
int helper1(int i... | ALGO | 0.99999 | 5.207245 |
bfebf75b-86f3-4795-8d40-650ad4313dd0 | parthsinghal09/CSES-Problem-Set | Sorting and Searching/subarray_sum2.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n;
long long int x;
cin>>n;
cin>>x;
vector<long long int> v;
for(int i = 0; i<n; i++){
long long int p;
cin>>p;
v.push_back(p);
... | ALGO | 0.999877 | 4.348518 |
f763df9b-0b6f-4213-b3a2-7126c23448b5 | JNNNNYao/LeetCode-Practice | 84. Largest Rectangle in Histogram/solution.cpp | class Solution {
public:
int largestRectangleArea(vector<int>& heights) {
int ans = heights[0];
int min, val;
int num[10001]={0};
vector<int> st;
st.push_back(heights[0]);
for(int i = 1; i < heights.size(); i++){
min = i;
while(!st.empty() && h... | ALGO | 0.999965 | 6.381878 |
54a02e20-c8e3-491b-b394-f6e08f81afd0 | DigvijayNarayanPandey/Data-Structures-Algorithm-in-C- | 3 Array/Easy/swapping.cpp | #include <iostream>
using namespace std;
// Swapping of two numbers without using a third variable
// void swapping(int &a, int &b)
// {
// a = a - b;
// b = a + b;
// a = b - a;
// }
// Swapping of two numbers by using XOR operation
void swapping(int &a, int &b)
{
a = a ^ b;
b = a ^ b;
a = a ... | ALGO | 0.999411 | 4.258483 |
d04c902a-57cc-41a8-a908-6ba43cfd4970 | naledo/my_gem5 | src/systemc/tests/systemc/misc/unit/data/general/add_promote/datawidth.cpp | /*****************************************************************************
datawidth.cpp --
Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
*****************************************************************************/
/**************************************************************************... | ALGO | 0.981838 | 5.691682 |
1edadd46-8f94-47e3-a79f-7e237a8907c2 | nathaditya543/CompetetiveProgSolutions | cses_inc_array.cpp | #include<bits/stdc++.h>
using namespace std;
long solve(vector<long> nums){
long prev = nums[0];
long ops = 0;
for(int i = 1; i < nums.size(); i++){
if(nums[i] < prev){
ops += prev - nums[i];
nums[i] = prev;
}
prev = nums[i];
}
return ops;
}
int main... | ALGO | 0.999907 | 4.270761 |
a9b21181-7619-4252-b2b0-48c029ce4df2 | Ayse2Nur/Cpp-Projeleri | heap_sort.cpp | #include <iostream>
using namespace std;
void swap(int *a,int *b){//yer deistirmeyi yapar
int temp=*a;
*a=*b;
*b=temp;
}
heapify(int dizi[],int n, int i)//sralama yapyor
{
int enbuyuk=i;
int sol=2*i+1;
int sag=2*i+2;
if(sol<n && dizi[sol]>dizi[enbuyuk])//girilen deer soldakinen kk ve dizi[sol]>dizi[enbuyuk] ise sol... | ALGO | 0.999912 | 4.36862 |
aea5ba71-600c-4a23-8794-5b019987bdfb | chauhansatyam3112/DSA-problems | 1438-longest-continuous-subarray-with-absolute-diff-less-than-or-equal-to-limit/1438-longest-continuous-subarray-with-absolute-diff-less-than-or-equal-to-limit.cpp | class Solution {
public:
int longestSubarray(vector<int>& nums, int limit) {
multiset<int>mp;
int i=0,j=0;
int maxi=0;
while(j<nums.size())
{
mp.insert(nums[j]);
while(*mp.rbegin()-*mp.begin()>limit)
... | ALGO | 0.999992 | 6.010638 |
05d08fe7-0111-4a92-81c2-55d0c1b0f112 | maayeesha/CSE-242-Lab | Exp_5/exp_5_homework_2.cpp | //Maayeesha Farzana
//Id: 1804069
#include<bits/stdc++.h>
using namespace std;
struct Node {
int data;
Node* prev;
Node* next;
};
Node* constructDoubly()
{
Node* head=nullptr,*prev_node;
while(1)
{
int input;
cin>>input;
if(input == -1) break;
Node* curr = new Node;
... | ALGO | 0.999723 | 4.585572 |
a07ff86a-95c1-4f73-9e1e-c12bc4994e32 | rahulsinha152/General-Coding | BubbleSorting.cpp | #include <iostream>
#include <stdlib.h>
using namespace std;
int main()
{
int n;
cin>>n;
int counter =1;
int arr[n];
for (int j=0;j<n;j++){
arr[j]=rand();
cout<<arr[j]<<endl;
}
for (counter=1;counter<n;counter++){
for (int i=0;i<n;i++){
if (arr[i+1]<arr[... | ALGO | 0.999828 | 3.359397 |
87de7162-5abd-48eb-b111-9debf561c81d | Jianyi2004/Algorithms_problems | hitteam/w2/p1028_数的计算.cpp | #include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
const int N = 1e3 + 100;
typedef long long LL;
long long f[N];
int main()
{
int n;
cin >> n;
f[1]=1;
for(int i=2;i<=n;i++)
{
f[i]=1;
int j=i/2;
while(j)
{
f[i]+=f[j];
... | ALGO | 0.999956 | 4.085862 |
839bb37d-3a17-4950-976f-9991335d8a41 | tanvirtareq/programming | vjudge/tfc3 2020/Untitled1.cpp | #include<bits/stdc++.h>
#define v(a) vector<a>
#define p(a, b) pair<a, b>
#define dbg(a) cput<<#a<<" = "<<a<<endl
using namespace std;
typedef long long ll;
typedef long long unsigned lu;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef priority_queue<int> mxpqi;
typedef priority_queue<int, vector<int> , g... | ALGO | 0.999962 | 3.735109 |
5247956a-440d-4cb2-a13a-3afbb75a5b6a | sarvex/leetcode-harbour | lcof/面试题56 - I. 数组中数字出现的次数/Solution.cpp | class Solution {
public:
vector<int> singleNumbers(vector<int>& nums) {
int xs = 0;
for (int& x : nums) {
xs ^= x;
}
int lb = xs & -xs;
int a = 0;
for (int& x : nums) {
if (x & lb) {
a ^= x;
}
}
int b... | ALGO | 0.999871 | 5.457954 |
41fc6859-fb46-43bf-b413-4ddab54cbbb4 | lealldiogo/CarND-Path-Planning-Project | src/Eigen-3.3/failtest/qr_int.cpp | #include "../Eigen/QR"
#ifdef EIGEN_SHOULD_FAIL_TO_BUILD
#define SCALAR int
#else
#define SCALAR float
#endif
using namespace Eigen;
int main()
{
HouseholderQR<Matrix<SCALAR,Dynamic,Dynamic> > qr(Matrix<SCALAR,Dynamic,Dynamic>::Random(10,10));
}
| TEST | 0.887556 | 3.076401 |
8d23b26a-5f89-41a3-aab5-401e0eddbc28 | oddcard2/mishmash | Algorithms/geometry/interval_tree_rect_finder.cpp | #include <gtest/gtest.h>
#include "common.h"
using namespace std;
struct rect {
int n;
int x1;
int y1;
int x2;
int y2;
};
struct node {
node() : r(-1), l(-1) {}
int r, l;
int c;
vector<pair<int, int>> s;
};
vector<rect> rects;
vector<node> nodes;
vector<bool> used;
int get_mid(vector<int>& r) {
auto res ... | ALGO | 0.999548 | 6.477559 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.