uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
ef9ffd32-4540-4839-9c9d-9c31fab8103d | DynoW/CS-files-storage | Chirila Daniel Stefan/C++/main.cpp | #include <iostream>
#include <fstream>
using namespace std;
int nr_prim(int n){
int ct=0;
for(int i=1;i<=n;i++)
if(n%i==0)
ct++;
if(ct==2)
return 1;
else
return 0;
}
int cmmdc(int a, int b) {
if(a * b == 0)
return a + b;
else {
while(a != b)
... | ALGO | 0.999824 | 4.404285 |
e9903757-7631-45a7-ae38-7b7486d14450 | ishandutta2007/codeforces | swistakk/normal/258/E.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#define M 131072
using namespace std;
struct wez
{
int war;
int niez;
int szer;
};
vector<int> slo[M];
wez drz[2*M+5];
int pre[M];
int inv[M];
int roz[M];
int d;
int dfs(int v)
{
roz[v]=1;
inv[d]=v;
pre[v]=d;
d++;
for(int i=0; i<... | ALGO | 0.999979 | 4.245866 |
515d7c75-13c1-44ac-bd05-b238f08300cd | smartbh/DSalgorithm | ch04/stack2.cpp | #include <iostream>
#include <stack>
using namespace std;
int main(){
stack<int> stk;
stk.push(10);
stk.push(20);
stk.push(30);
//10, 20, 30 순으로 쌓임 제일 위에 30
stk.pop();
// 30제거
cout << stk.top() << endl;
stk.push(40);
while(!stk.empty()){
auto& e = stk.top();
c... | ALGO | 0.995579 | 4.484926 |
2e1b9b81-7211-48ed-99fb-60c8018433d5 | ImMasterSam/SCIST-Solutions | 初章:C++ 語法基礎/第三節:依不同狀況判斷該做哪件事/平閏年/平閏年.cpp | #include <iostream>
using namespace std;
bool isleap(int y){
bool i = false;
if(y%4==0){
if(y%100==0){
if(y%400==0)
i = true;
}
else
i = true;
}
return i;
}
int main(){
int Y;
cin >> Y;
if(isleap(Y))
cout << "YES";
else
cout << "NO";
return 0;
} | ALGO | 0.99975 | 4.777449 |
fdd4cf72-d740-40ca-aebd-723ef50fd5b7 | CodeCamper-Sub/Problem_Solving | baekjoon/11001-12000/11062.cpp | #include <bits/stdc++.h>
#define INF 999999999999
typedef long long ll;
using namespace std;
ll tt;
ll n, answer;
vector<ll> card;
vector<vector<vector<ll>>> dp; // i의 턴일 때, 왼쪽에서 j개, 오른쪽에서 k개 가져갔을 때 근우가 얻을 수 있는 최대 점수
ll go(ll left, ll right, ll turn) {
if(left + right >= n) return 0;
if(dp[turn][left][right] != ... | ALGO | 0.999897 | 4.450338 |
6420feaa-45e3-4c30-a5c3-28bb0b2a050e | I1Va/olimpiad_programming | спбгу/checker/brut.cpp |
#include <iostream>
#include <vector>
#include <unordered_set>
using namespace std;
ostream& operator<< (ostream& stream, const vector<int>& a) {
for (auto to : a) {
stream << to << " ";
}
return stream;
}
const int INF = 1e9;
int gcd (int a, int b) {
while (b) {
a %= b;
swap (a, b);
}
r... | ALGO | 0.999656 | 4.370516 |
dd70eb55-94b4-4900-85c8-09b1b047d705 | intel/Halide | test/correctness/bounds_inference_complex.cpp | #include "Halide.h"
#include <stdio.h>
using namespace Halide;
int main(int argc, char **argv) {
const int K = 8;
Func f[K]; Var x, y;
if (argc > 1) srand(atoi(argv[1]));
else srand(0);
f[0](x, y) = x+y;
f[1](x, y) = x*y;
for (int i = 2; i < K; i++) {
int j1 = rand() % i;
... | ALGO | 0.9554 | 4.79636 |
8dee67d6-ff76-4d3c-bb73-d81b12716b4d | bretternst/tcpppl_answers | ch18/ex06.cpp | #include <iostream>
#include <functional>
#include <algorithm>
#include <iterator>
#include <sstream>
namespace ch18 {
using namespace std;
template<class In>
struct Iseq : public pair<In,In> {
Iseq(In i1, In i2) : pair<In,In>(i1, i2) { }
};
template<class C>
Iseq<typename C::iterator... | TOOL | 0.959264 | 5.231678 |
9a30b819-0ba9-452d-a1f5-9c4c03130ed6 | Xylot/Labs | Lab 2/Sample Code/ascii_table.cpp | /*
Sample program to output the ascii table using a loop.
*/
#include <iostream>
#include <cctype>
#include <iomanip>
using namespace std;
int main(void)
{
cout << "The ASCII table" <<endl;
cout << "int ch\tint ch\tint ch\tint ch\tint ch\tint ch\tint ch\tint ch"<<endl;
cout << "___ _ \t___ _ \t___ _ \... | TOOL | 0.979485 | 4.27887 |
390a2b51-2721-459a-84b8-f9fa1e7fa544 | swathisnayak14/Interview_Prep | PatternProgramming/Pattern22.cpp | // 1
// 2 3
// 4 5 6
// 7 8 9 10
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n,count=0;
cin>>n;
for(int i=0;i<n;i++)
{
for(int j=0;j<=i;j++)
{
count++;
cout<<count<<" ";
}
cout<<endl;
}
} | ALGO | 0.999692 | 3.674306 |
09a224bd-f890-4d6b-b5e6-1dff49e6cb1c | 21SINGH/-code-question | 0026-remove-duplicates-from-sorted-array/0026-remove-duplicates-from-sorted-array.cpp | class Solution {
public:
int removeDuplicates(vector<int>& nums) {
if(nums.size() <= 0 )
return 0 ;
int i = 0 ;
for(int j = 1 ; j < nums.size() ; j++)
{
if(nums[j] != nums[i] ) // diffrent element
{
i++;
... | ALGO | 0.999936 | 6.105535 |
68b3106d-aac2-4036-b508-3533c18b6a9d | C0D1NG/Programming | C++/aborrelli20_leap_year.cpp | int main() {
int year = 0;
std::cout << "Enter year: ";
std::cin >> year;
if (year < 1000 || year > 9999) {
std::cout << "Invalid input.\n";
}
else if (year % 4 == 0 && year % 400 == 0 || year % 100 != 0) {
std::cout << year << " is a leap year.\n";
}
else {
std::cout << year << " is not a leap year.\n... | ALGO | 0.973455 | 3.083078 |
afd3d261-8c38-4e0b-8a35-d66fe000c40f | rsk0315/library | algorithm/dp_on_tree.cpp | #ifndef H_dp_on_tree
#define H_dp_on_tree
/**
* @brief 木 DP
* @author えびちゃん
*/
#include <cstddef>
#include <utility>
#include <vector>
#include "utility/make/fix_point.cpp"
template <typename Monoid, typename AdjacencyList, typename Fn>
std::vector<Monoid> dp_on_tree(AdjacencyList const& g, Fn f, Monoid e = Mono... | ALGO | 0.999819 | 4.883711 |
e405d8a4-039b-4dc4-aa0e-c8938fb5192d | bharatr21/leetcode-problems | 0342-power-of-four/0342-power-of-four.cpp | class Solution {
public:
bool isPowerOfFour(int n) {
if(n <= 0) return false;
int tmp = n;
while(tmp > 1) {
if(tmp % 4) return false;
tmp = tmp / 4;
}
return (tmp == 1);
}
}; | ALGO | 0.999545 | 5.910203 |
7645681c-f710-41ee-b31c-4c0eb9dae77b | kshoo0421/AlgorithmStudy | 12_최단경로(다익스트라)/12_4_01238.cpp | #include <bits/stdc++.h>
#define MAX 1e9
using namespace std;
vector<int> Dijkstra(int start, int N, vector<vector<pair<int, int>>>& graph) {
vector<int> dist(N + 1, MAX);
priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> pq;
dist[start] = 0;
pq.push({ 0, start });
w... | ALGO | 0.999963 | 5.482027 |
61ba6814-3d25-43eb-b71b-475f6eae3e43 | tommy1900/Path-Planning-Frenet-Frame-Optimal-Trajectory-Generation-JMT | src/Eigen-3.3/doc/snippets/Triangular_solve.cpp | Matrix3d m = Matrix3d::Zero();
m.triangularView<Eigen::Upper>().setOnes();
cout << "Here is the matrix m:\n" << m << endl;
Matrix3d n = Matrix3d::Ones();
n.triangularView<Eigen::Lower>() *= 2;
cout << "Here is the matrix n:\n" << n << endl;
cout << "And now here is m.inverse()*n, taking advantage of the fact that"
... | ALGO | 0.998442 | 3.691875 |
fb24ee19-6c9d-4f28-82ca-846cc8b28183 | gjainiitr/Algorithms-and-Data-Structres | Dynamic Programming/Ways-To-Write-n-as-Sum.cpp | /*
Problem URL :- https://practice.geeksforgeeks.org/problems/ways-to-write-n-as-sum-1587115621/1
*/
#include<bits/stdc++.h>
#define mod 1000000007
using namespace std;
int countWays(int);
// Driver program
int main()
{
int t;
cin >> t;
while(t--)
{
int n;
cin>>n;
cout<... | ALGO | 0.999964 | 5.324117 |
de89f0df-3968-4849-a405-bfee4a231a1d | ixjosemi/ED-UGR | P4/material/src/Ontologias.cpp | #include <Ontologias.h>
using namespace std;
/* Comprueba si una palabra está en el conjunto o no */
pair <bool, const_iterator> Ontologias::Esta(const string & o){
set<string>::const_iterator sit; // Iterador del conjunto
ArbolGeneral<pair<set<string>, int>>::const_iter_preorder ait = ab.cbegin(); // Iterador de... | ALGO | 0.962431 | 3.774691 |
6975a84d-e870-46d3-be3e-c58b2fac42ee | IDavron/RTEngine | rt/solids/quad.cpp | #include <rt/solids/quad.h>
namespace rt {
Quad::Quad(const Point& origin, const Vector& span1, const Vector& span2, CoordMapper* texMapper, Material* material)
{
this->v1 = origin;
this->span1 = span1;
this->span2 = span2;
if(texMapper == nullptr){
this->texMapper = new WorldMapper(Vector::re... | ALGO | 0.864868 | 6.460548 |
3d1b9435-b1f0-485c-b312-811e13bb5894 | LLNL/muster | src/partition.cpp | ///
/// @file partition.cpp
/// @author Todd Gamblin <EMAIL>
///
#include "partition.h"
#include <iostream>
#include <iterator>
#include <map>
#include <cassert>
#include <algorithm>
#include "counter.h"
#include "stl_utils.h"
using namespace std;
namespace cluster {
partition::partition(size_t num_objects) : cl... | ALGO | 0.997304 | 6.4154 |
ec1fe24d-6ad2-4b50-a89c-bce6fb650cab | ermek-bdnf/c-cpp-sources | factorial.cpp | #include<iostream>
using namespace std;
int Fact(int N)
{
if(N == 0)
return 0;
if(N == 1)
return 1;
return N * Fact(N - 1);
}
int main()
{
cout << "Factorial of number" << endl;
int N;
cout << "Enter a number: ";
cin >> N;
cout << Fact(N) << endl;
return 0;
}
| ALGO | 0.999421 | 4.505786 |
fc1ccf01-4082-4e68-81ad-db2439556bf4 | yeesonmin/Study | CPP/09_Friend 및 연산자 중복/소스.cpp | #include <iostream>
using namespace std;
class Power
{
int kick;
int punch;
public:
Power(int kick = 0, int punch = 0) {
this->kick = kick;
this->punch = punch;
}
friend Power operator* (Power op1, Power op2);// Լ
Power operator+ (Power op2);
bool operator== (Power op2);
Power operator+= (Power op2);
... | ALGO | 0.974765 | 4.311932 |
ea80a2b4-5030-4882-b497-cf56e18cdb14 | zayim/ProgrammingIntro | Rokovi/R1/K3/R1.3Z2.cpp | #include <iostream>
using namespace std;
int STRCMP(char a[], char b[])
{
int len_a=0,len_b=0,len,i=0;
while (a[++len_a]!='\0');
while (b[++len_b]!='\0');
len=min(len_a,len_b);
while (i<len && a[i]==b[i++]);
i--;
if (a[i] > b[i]) return 1;
if (a[i] < b[i]) return -1;
if (len_a==le... | ALGO | 0.999679 | 3.147489 |
123e9914-e796-4ae6-90af-1f90a04b538b | agabgim/ctf_tpls | boost/1.49.0/libs/math/example/find_root_example.cpp | // find_root_example.cpp
// Example of using root finding.
// Note that this file contains Quickbook mark-up as well as code
// and comments, don't change any of the special comment mark-ups!
//[root_find1
/*`
First we need some includes to access the normal distribution
(and some std output of course).
*/
#include... | ALGO | 0.999968 | 4.875978 |
ce7da06b-8b29-4d9a-a796-d54bf7b941a5 | ishandutta2007/codeforces | maximumshot/normal/535/B.cpp | #include <iostream>
#include <math.h>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <fstream>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#define ALL(x) (x).begin(), (x).end()
#define mp make_pair
#define vec vector
#define deb(x) cerr << #x << " = " << x << '\n... | ALGO | 0.999696 | 3.749462 |
ce5f317e-2e3e-4556-9ec4-1ebd0351bbb6 | aewsion/M4RL | 1_MSABM/no_treatment_case/src/main.cpp | #include <iostream>
#include <fstream>
#include <random>
#include "environment.h"
extern std::random_device rd;
int main(int argc, char **argv){
std::string folder = argv[1]; // save folder
std::string set = argv[2]; // set
int N = std::stoi(argv[3]); // number of simulations
double simTime = std::st... | ALGO | 0.997836 | 4.85782 |
8cc0330f-634e-437d-ac42-7eedf94752ba | u-wyh/luogu-code | P1440.cpp | #include<bits/stdc++.h>
using namespace std;
int n,k;
int minh=0,mint=0;
int minq[10000005];
int nums[10000005];
int main()
{
cin>>n>>k;
for(int i=0;i<n;i++)
cin>>nums[i];
for(int i=0;i<n;i++){
if(i==0)
cout<<'0'<<endl;
else
cout<<nums[minq[minh]]<<endl;
... | ALGO | 0.999998 | 3.511882 |
88d18c6d-0ca2-4047-ba56-58b61c174ae5 | MohamadAshrafSalama/User-Stories-generation | Code_Snippets/311-320/s123719043.cpp | #include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
#define MOD 1000000007
#... | ALGO | 0.999996 | 3.747623 |
e0675b6a-390d-43d0-82a8-5bcaae25422a | 16BitNarwhal/Competitive-Programming | codeforces/300C.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod = 1e9+7, MM = 1e6+2;
ll fac[MM], inv[MM];
ll qpow(ll a, ll b) { return b==0?1:(b%2?a:1)*qpow(a*a%mod, b/2)%mod; }
void init() {
fac[0] = 1;
for (ll i=1;i<MM;i++) fac[i]=(fac[i-1]*i)%mod;
for (ll i=0;i<MM;i++) inv[i]=qpow(fac[i], mod... | ALGO | 0.999931 | 4.883148 |
8b6abe55-6807-4252-9db8-06d575f14ec0 | Mythili007/CodePractice | LeetCode/EASY/HASHTABLE/keyboardRow.cpp | /**
* https://leetcode.com/problems/keyboard-row/
*
*/
#include <bits/stdc++.h>
using namespace std;
class Solution
{
public:
vector<string> findWords(vector<string> &words)
{
string firstRow = "qwertyuiopQWERTYUIOP", secondRow = "asdfghjklASDFGHJKL", thirdRow = "zxcvbnmZXCVBNM";
vector<s... | ALGO | 0.999357 | 5.278274 |
c0b3fead-9da8-45ab-8d48-00370e5826e0 | RainyCyan/oceanbase_private | src/sql/rewrite/ob_transform_min_max.cpp | #define USING_LOG_PREFIX SQL_REWRITE
#include "ob_transform_min_max.h"
#include "ob_transformer_impl.h"
#include "lib/allocator/ob_allocator.h"
#include "lib/oblog/ob_log_module.h"
#include "common/ob_common_utility.h"
#include "common/ob_smart_call.h"
#include "share/schema/ob_column_schema.h"
#include "share/schema/o... | ALGO | 0.976071 | 6.034268 |
4b1bb674-9419-4875-a60e-7dd86aa1e737 | Kawser-nerd/CLCDSA | Source Codes/AtCoder/abc104/A/4711570.cpp | #include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include <utility>
using namespace std;
int main(void) {
int n;
cin >> n;
if (n < 1200)
cout << "ABC";
else if (n < 2800)
cout << "ARC";
else
cout << "AGC";
cout << endl;
return 0;
} | ALGO | 0.999518 | 3.915996 |
965a8cd4-52fa-453d-a77a-fe22f53e46df | seo-bo/ProblemSolving | Atcoder/ABC377/A.cpp | #include <bits/stdc++.h>
using namespace std;
int main(void)
{
cin.tie(0)->sync_with_stdio(0);
string str;
cin >> str;
sort(str.begin(), str.end());
cout << ((str == "ABC") ? "Yes" : "No");
return 0;
}
| ALGO | 0.999959 | 4.557954 |
ad41a881-a5ac-4f30-be59-4ca209d9c7f9 | s0metimes/aligothm | week6/1647_CityDivisionPlan/1647_CityDivisionPlan_seogki.cpp | #include <iostream>
#include <queue>
using namespace std;
#define MAX 100001
#define pii pair<int, int>
#define edge pair<int, pii>
priority_queue<edge, vector<edge>, greater<edge>> pq;
int N, M, A, B, C, sum;
int P[MAX];
int FIND(int node) {
if (node == P[node])
return node;
return P[node] = FIND(P[n... | ALGO | 0.999932 | 4.33183 |
0a540070-a3c3-42a3-a45f-7531f2c14363 | shravan-d/Leetcode | 419-battleships-in-a-board/419-battleships-in-a-board.cpp | class Solution {
public:
int countBattleships(vector<vector<char>>& board) {
int ans = 0;
for(int i=0;i<board.size();i++){
for(int j=0;j<board[0].size();j++){
if(board[i][j]=='X'){
ans++;
int temp = i+1;
if(temp!... | ALGO | 0.999639 | 6.022208 |
e1b88922-f3ee-41d9-a993-35244b7cb59f | revantg/shittycoders | 9A - Mishka and Contest/A - Mishka and Contest.cpp | /*
9 A - Mishka and Contest
author : ltra_golu | submitted at : 2018-07-12 07:10:57
time taken : 31 ms | memory consumed : 8 KB
*/
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n, d, flag = 0, count = 0; cin >> n >> d;
vector <int> v(n);
for(int i = 0; i < n; i++)
{
cin >> ... | ALGO | 0.999962 | 3.768646 |
80389c18-37fa-4379-b902-014362f36794 | gautamop01/Daily-Goals-Of-Coding | Leet Code/Longest Cycle in a Graph.cpp | /*
You are given a directed graph of n nodes numbered from 0 to n - 1, where each node has at most one outgoing edge.
The graph is represented with a given 0-indexed array edges of size n, indicating that there is a directed edge from node i to node edges[i]. If there is no outgoing edge from node i, then edges[i] == ... | ALGO | 0.999773 | 5.44802 |
e2b19f98-e82d-4555-9a3f-ee232d63bb17 | MatveyDmitryevich2/differentiator | Graphics_and_Taylor/graf.cpp | #include "graf.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <assert.h>
#include <stdbool.h>
#include <math.h>
#include "../utils.h"
#include "../com.h"
#include "../tree_utils.h"
#include "../tree.h"
static double Counting_leaflet_at_point(Node* node, double x, Pool_alloc... | ALGO | 0.998944 | 4.068747 |
76e2bb1f-e302-43c1-907b-1aa6e1c2b365 | mohansaivenkat/LeetCode | 0098-validate-binary-search-tree/0098-validate-binary-search-tree.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.999956 | 6.840428 |
b78c84af-18f9-4afb-ac05-cce42b2f9562 | Magni16/MyCourseCodes | milestone 3/Linked List 2/bubbleSort.cpp | /****************************************************************
Following is the class structure of the Node class:
class Node
{
public:
int data;
Node *next;
Node(int data)
{
this->data = data;
this->next = NULL;
}
... | ALGO | 0.999994 | 5.12273 |
b24be3eb-0e5f-4d55-9956-74b509135267 | Normal-pcer/sync_code | N1099_五子棋.cpp | /*
@link https://neooj.com:8082/oldoj/problem.php?id=1099
*/
#include <bits/stdc++.h>
#define initDebug DEBUG_MODE=(argc-1)&&!strcmp("-d", argv[1])
#define debug if(DEBUG_MODE)
#define log(f, a...) debug printf(f, ##a);
#define upto(i,n) for(int i=1;i<=(n);i++)
#define from(i,b,e) for(int i=(b);i<=(e);i++)
#define rev(... | ALGO | 0.999673 | 3.632951 |
31658e01-ac42-4692-bde7-26233d2a2587 | joopixel1/CSES | GFG2/range_queries/med/num_whose_sum_of_xor_in_range_is_max.cpp | #include <iostream>
#include <vector>
#include <cmath>
using namespace std;
typedef long long ll;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout << "Starting..." << "\n";
ll n, m;
cin >> n >> m;
vector< ll > v(n);
for(ll i=0; i<n; i++) cin >> v[i];
vector< vector< ll >... | ALGO | 0.999974 | 4.664592 |
157ca429-7a6c-4a80-bf23-3b55ccb1e085 | ketpals/LC_coding | Sorting/Selection_sort.cpp | #include<bits/stdc++.h>
using namespace std;
void ss(vector<int> &arr){
int min;
int n = arr.size();
for(int i=0; i<=n-2;i++){
min =i;
for(int j=i; j<=n-1; j++){
if(arr[j]<arr[min]) min =j;
}
int temp = arr[min];
arr[min] = arr[i];
arr[i] = temp;
... | ALGO | 0.999984 | 4.352513 |
86440e6d-e609-460b-8771-a9c4039276d0 | deepak-ky/cpp-codes | cpp-codes/dima_and_continous_line.cpp | #include<iostream>
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define varname(name) #name
#define mod 1000000007
#define wer(x) cout<<"\n"<<varname(x)<<" here : "<<x
#define test int t;... | ALGO | 0.999996 | 3.916918 |
8570ba82-2027-40ac-a3c6-cc878e87ab96 | sukirth-singh-gaur/Leetcode | leetcode/monotonicStack/nextGreater.cpp | #include <bits/stdc++.h>
using namespace std;
vector<int> findNextGreaterIndexes(vector<int> & arr){
// initialize an empty stack
stack<int> s;
// initialize nextGreater array, this array hold the output
// initialize all the elements are -1 (invalid value)
vector<int> nextGreater(arr.size(),-1);
... | ALGO | 0.999988 | 4.992384 |
77e15793-2f06-4843-aac9-8790ea68dfb8 | gilbertoamarcon/tsp | src/main.cpp | #include "includes.hpp"
#include "sol.hpp"
int store_hist(vector<double> &costs, char *filename){
FILE *file;
char fileBuffer[BUFFER_SIZE];
file = fopen(filename,"w");
if(file == NULL){
printf("Error writing file '%s'.\n",filename);
return 1;
}
for(auto &c : costs)
fprintf(file,"%.6f\n",c);
}
int ... | ALGO | 0.999619 | 4.175492 |
683152b7-1409-4f82-a69a-036f3c273e1f | sahilduhan/pepcoding_youtube | linked_list/first.cpp | #include <bits/stdc++.h>
using namespace std;
class node
{
public:
int data;
node *next;
node(int data)
{
this->data = data;
next = NULL;
}
};
void insert_at_last(node *head, int data)
{
node *new_ndoe = new node(data);
node *temp = head;
while (temp->next != NULL)
{
... | ALGO | 0.999236 | 3.712776 |
a509c54c-47c5-4b06-b38e-a974bfe9a8ed | ishandutta2007/codeforces | roki/normal/168/A.cpp | #pragma comment(linker, "/STACK:167177216")
#include<stdio.h>
#include<stack>
#include<math.h>
#include<iostream>
#include<algorithm>
#include<string.h>
#include<string>
#include<set>
#include<memory.h>
#include<vector>
#include<map>
#include<queue>
using namespace std;
typedef long long li;
typedef long double ld;
... | ALGO | 0.999049 | 3.276655 |
808ced8d-86ff-4361-a66c-85379b5d74b0 | Elliot0122/leetcode_practice | 198/solution.cpp | class Solution {
public:
int rob(vector<int>& nums) {
int s = nums.size();
if(s == 1)return nums[0];
else if(s == 2)return max(nums[0], nums[1]);
int dp[nums.size()];
for(int i=0; i<s; ++i) dp[i] = 0;
dp[0] = nums[0];
dp[1] = max(nums[0], nums[1]);
for... | ALGO | 0.999943 | 5.947793 |
6ebe03cf-afe0-4aa0-8b36-7bcd9bd7a812 | DrezByte/rose-next-classic | thirdparty/imgui-1.77/misc/fonts/binary_to_compressed_c.cpp | // dear imgui
// (binary_to_compressed_c.cpp)
// Helper tool to turn a file into a C array, if you want to embed font data in your source code.
// The data is first compressed with stb_compress() to reduce source code size,
// then encoded in Base85 to fit in a string so we can fit roughly 4 bytes of compressed data i... | TOOL | 0.919038 | 6.62991 |
f26d39eb-91ec-4d33-9f96-60c20f2b2900 | awoopeurval/France-io | Level 5/Plus courts chemins/Bruler de la poudre/main.cpp | #include <bits/stdc++.h>
#define N 1024
#define DIR 4
using namespace std;
typedef pair<int,int> ii;
inline int MAX(int a,int b){return (a>b)?a:b;}
int n,m,s;
int a,b,d;
int dis[N];
int vis[N];
vector<ii> g[N];
vector<ii> ans;
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cin>>n>>m>>s;
for(... | ALGO | 0.999981 | 3.389957 |
7d701fde-9aa2-4a34-84ba-590798aa157d | WonteakLim/USDC_02_05_MPC | src/Eigen-3.3/doc/snippets/Tutorial_solve_triangular.cpp | Matrix3f A;
Vector3f b;
A << 1,2,3, 0,5,6, 0,0,10;
b << 3, 3, 4;
cout << "Here is the matrix A:" << endl << A << endl;
cout << "Here is the vector b:" << endl << b << endl;
Vector3f x = A.triangularView<Upper>().solve(b);
cout << "The solution is:" << endl << x << endl;
| ALGO | 0.999587 | 3.055453 |
53535ddd-07ca-441f-8505-de427f9ef6e6 | surags/MotionPlanner | src/Eigen-3.3/doc/examples/class_VectorBlock.cpp | #include <Eigen/Core>
#include <iostream>
using namespace Eigen;
using namespace std;
template<typename Derived>
Eigen::VectorBlock<Derived>
segmentFromRange(MatrixBase<Derived>& v, int start, int end)
{
return Eigen::VectorBlock<Derived>(v.derived(), start, end-start);
}
template<typename Derived>
const Eigen::Vec... | TOOL | 0.925166 | 4.383477 |
76b95a21-c38b-4122-a401-e39308abb673 | MateoRicci/CompetitiveProgramming | excercise/course/MusicalPuzzle.cpp | #include <bits/stdc++.h>
#define fst first
#define snd second
#define fore(i,a,b) for(ll i=a,ThxDem=b;i<ThxDem;++i)
#define dfore(a,b,c) for(int a=b; a>=c; --a)
#define DGB(a) cout<<#a<<" = "<<a<<"\n"
#define RAYA cout<<"=============="<<"\n"
#define show(a) cout<<a<<"\n"
#define showAll(a) for(auto i:a) cout<<i<<" ";c... | ALGO | 0.997507 | 4.080566 |
7fc66b4c-d7eb-4423-82aa-b51be5382327 | rezavai92/gfk-patterns | pattern14.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
void printTriangle(int n) {
// code here
for(int i=1;i<=n;i++){
for(int j=0;j<i;j++){
cout<<(char)(j+65);
}
cout<<"\n";... | ALGO | 0.999192 | 5.829403 |
e1f0567b-55cc-457e-8ad8-0b07f9ea57ff | XingwXiong/SDC_Bench | x86/acl/app/master/tools/master_ctl/main.cpp | #include "stdafx.h"
#ifdef HAS_READLINE
#include <readline/readline.h>
#include <readline/history.h>
#endif
#include "http_request.h"
static bool __verbose = false;
static long long __timeout = 0;
static acl::string __server_addr;
static acl::string __extname;
static void print_space(int n)
{
for (int i =... | WEB | 0.953569 | 3.438765 |
73b38588-001d-440e-b807-638ae46242d5 | Eliel-Ontiveros/Programacion-Estructurada | Examen/EAOO_368746_EXAMEN.cpp | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
// Estructura para almacenar datos del análisis de la muestra
struct Estadisticas
{
float media;
float moda;
float mediana;
float varianza;
float desviacion_estandar;
float tercer_cuartil;
};
// Prototipos de funcione... | DATA | 0.909865 | 4.324418 |
c06473aa-28dd-4005-a92e-e6c8673c0107 | satishphd/WorkStealing-Spatial-Join | src/thread_util.cpp | #include <thread_util.h>
static int core_thread_aff[36] = {-1};
static std::mutex aff_mutex;
static bool IS_ALL_JOB_PUSHED[NUM_THREADS] = {false};
static bool IS_ALL_JOB_DONE[NUM_THREADS] = {false};
gsj::thread_barrier syn_barrier(2);
namespace gsj
{
// core_id = 0, 1, ... n-1, where n is the system's number of ... | TOOL | 0.993875 | 3.912937 |
8557ef95-7d57-4e63-b143-dd4d07967ae6 | Rikon07/Codeforces-Rik_on | 791A.Bear&Brother.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int a, b, larger = 0;
cin >> a >> b;
while(a <= b)
{
a *= 3;
b *= 2;
larger++;
}
cout << larger << endl;
return 0;
}
| ALGO | 0.999783 | 3.991462 |
ada2e3ec-61cc-412a-9857-324f50fc218d | SautismS/ACM | 动态规划/5-B.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N; // N
vector<long long> a(N);
for (int i = 0; i < N; i++) {
cin >> a[i]; // i˻õĿֵa_i
}
vector<long long> dp; // ڴ洢ǰѡĿֵ
for (int i = 0; i < N; i++) {
// ʹlower_boundҵһڵa[i]λ
auto it = lower_... | ALGO | 0.999973 | 4.903505 |
2e1746d6-57a0-4b65-94d4-3a8e56d1a8bf | hihihi28/dsa_codeptit | DSA1002-TAPCONKETIEP.cpp | #include<bits/stdc++.h>
using namespace std;
int n,k,a[1005];
void sinh(int n,int k){
int i=k;
while(i>=0&&a[i]==n-k+i){
i--;
}
if(i>=1){
a[i]++;
for(int j=i+1;j<=k;j++){
a[j]=a[i]+j-i;
}
}
else{
for(int i=1;i<=k;i++){
a[i]=i;
}
}
for(int i=1;i<=k;i++){
cout<<a[i]<<' ';
}
}
int main(){
int... | ALGO | 0.999835 | 3.136307 |
c3a8cab8-5e8f-4b9a-a5b7-229fd81abe46 | Juanan7676/json-solver-server | include/cryptopp/serpent.cpp | // serpent.cpp - originally written and placed in the public domain by Wei Dai
#include "pch.h"
#include "serpent.h"
#include "secblock.h"
#include "misc.h"
#include "serpentp.h"
NAMESPACE_BEGIN(CryptoPP)
void Serpent_KeySchedule(word32 *k, unsigned int rounds, const byte *userKey, size_t keylen)
{
FixedSizeSecBl... | ALGO | 0.999798 | 7.557911 |
0625a59b-d2f5-44c9-a440-f67c9000e5c9 | krishagrawal30/CPP_Collections | stack even_odd.cpp | //PRATEEK RANJAN B-48
// mob + DaTE = 766693619024
// mid no : 36
// 36^2 = 1276
//1276 % 29 = 20
// 20. Two stacks STACK1 and STACK2 is to be implemented using single array. STACK1 and
// STACK2 are arranged alternately starting from index 0 (zero), write a common push ()
// function that will insert odd ele... | ALGO | 0.989302 | 3.880828 |
697ef500-7598-47ff-88f4-0aca73b95546 | raincross7/code-similarity | codes/train_code/problem418/problem418_226.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
long long n,k;
string s;
cin >> n >> s >> k;
char a = s[k-1];
for(long long i = 0; i < n; i++){
if(s[i]!=a) s[i]='*';
}
cout << s << endl;
} | ALGO | 0.999915 | 3.073556 |
167192f8-d72b-4b65-a9c3-1dc89bb7adca | mratkovic/projekt-mapper | src/core/suffix_array.cpp | /*
* suffix_array.cpp
*
* Created on: Dec 27, 2014
* Author: marko
*/
#include "suffix_array.h"
SuffixArray::SuffixArray(const char* text, size_t textLen)
: text_(text),
textLen_(textLen) {
suffix_array_.clear();
suffix_array_.resize(textLen);
divsufsort((const sauchar_t *) text, &suffix_a... | ALGO | 0.996308 | 4.50803 |
d12fcf39-f026-4a38-8a44-d66be2e1dfa7 | witek-formanski/WDP | src/other/union-find.cpp | #include <vector>
typedef struct fu *find_union;
struct fu {
int label;
find_union up;
int rank, size;
std::vector<find_union> elems;
};
find_union create_fu(int label) {
find_union res = (find_union)malloc(sizeof(struct fu));
*res = {.label = label, .up = NULL, .rank = 0, .size = 1, .elems{}}... | ALGO | 0.999711 | 4.87181 |
3dcfa6df-f478-4b79-9fc3-23529363d76f | wendyh9/Data-Structures | Templates/LinkedList.cpp | // author: Wendy Haw
// collaborators: none
#include <iostream>
#include "LinkedList.h"
using namespace std;
template<class T>
Node<T>::~Node(){
};
template<class T>
void Node<T>::operator=(const Node<T> &n){
val = n.val;
next = n.next;
}
// Constructor
template<class T>
LinkedList<T>::LinkedList(){
fi... | TOOL | 0.974187 | 3.975991 |
d1bb87fa-8f1e-4c91-a21c-9f79960ac4a0 | vpg222/Applied-Cryptography | cipher_test/main.cpp | #include <iostream>
#include <map>
#include <vector>
#include <cstdlib>
#include <string>
#include <iomanip>
#include <ctime>
using namespace std;
const int KEY_MAP_SIZE = 106;
map<char, int> frequency = {{' ', 19}, {'e', 10}, {'a', 7}, {'t', 7}, {'i', 6},
{'n', 6}, {'o',6}, {'h', 5}, {'r... | ALGO | 0.998944 | 4.02343 |
ad4a20cf-bf0c-4208-9bfc-0751bc07fdbc | namndtth/competitive-programming | codeforces/1373C.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int tc;
cin >> tc;
while (tc--)
{
string s;
cin >> s;
int n = int(s.length());
long long res = 0, cnt = 0;
for (int i = 1; i <= n; i++)
{
if (s[i - 1] == '-')
cnt--;
... | ALGO | 0.998841 | 4.321362 |
c4c0cbcb-1737-4381-83d6-b310aff10502 | seanpquinn/rand_fields | hammurabicode-code/class_CRE.cpp | #include <hammurabi.h>
#include "proto_namespace_Vec_Handling.h"
#include "proto_class_CRE.h"
using namespace std;
// from the NE2001 data.
const double thick_disk_radius=17.*CGS_U_kpc;
//-------------------------------------------------------------------------------------------------------
//Routines of class CRE
/... | ALGO | 0.982222 | 4.901132 |
b48f4246-d741-4047-817d-fb3f47064b27 | ituacm/ITU-ACM-AlgoTeam | Regular-Question-Answers/product-of-array-except-self.cpp | // Author: Bilgenur Çelik
// Question Link: https://leetcode.com/problems/product-of-array-except-self/
// Reviewer: Denis Davidoglu
/*
* For each element try to find the product of all elements except itself.
* It can be achieved via keeping two arrays one postfix and one prefix.
* Then keep the product for every ... | ALGO | 0.999969 | 7.138277 |
cdcf6f48-a8af-4b9f-b65b-ee549c6278f1 | srijithumakanth/rtab_mapping | rtabmap/corelib/src/RegistrationIcp.cpp | #include <rtabmap/core/RegistrationIcp.h>
#include <rtabmap/core/util3d_registration.h>
#include <rtabmap/core/util3d_surface.h>
#include <rtabmap/core/util3d.h>
#include <rtabmap/core/util3d_transforms.h>
#include <rtabmap/core/util3d_filtering.h>
#include <rtabmap/utilite/ULogger.h>
#include <rtabmap/utilite/UConvers... | TOOL | 0.93313 | 3.557058 |
ed9d7c47-6472-4e1c-b444-fe8df3b142e9 | ishandutta2007/codeforces | pyqe/normal/1405/B.cpp | #include <bits/stdc++.h>
using namespace std;
long long n;
int main()
{
long long t,rr,i,k,sm,z;
scanf("%lld",&t);
for(rr=0;rr<t;rr++)
{
scanf("%lld",&n);
z=0;
sm=0;
for(i=0;i<n;i++)
{
scanf("%lld",&k);
sm-=k;
z+=max(sm,0ll);
sm=min(sm,0ll);
}
printf("%lld\n",z);
}
} | ALGO | 0.99988 | 3.592296 |
84db4bb6-bb09-4830-9d4a-e3817da95204 | unstoppablesahilsaifi/DSA_CPP | LeetCode_Questions/3_2D_Array/1_M_Q54_SpiralMatrix.cpp | #include<iostream>
#include<vector>
using namespace std;
class Solution {
public:
vector<int> spiralOrder(vector<vector<int> >& matrix) {
vector<int> ans;
int row = matrix.size();
int col = matrix[0].size();
int count = 0;
int total = row*col;
//ind... | ALGO | 0.99998 | 5.462905 |
b097ebf4-29d7-437f-89a6-794f7ba0e4af | Jonathan-Uy/CSES-Solutions | Bitwise Operations/Maximum Xor Subarray.cpp | #include <bits/stdc++.h>
using namespace std;
struct Node {
Node *c[2];
};
int N, xum, best;
Node *root;
void update(int x){
Node *cur = root;
for(int i = 30; i >= 0; i--){
if(x&(1<<i)){
if(!cur->c[1]) cur->c[1] = new Node();
cur = cur->c[1];
} else {
... | ALGO | 0.999966 | 4.413415 |
2e1e8b1b-9d3d-4640-836e-5349786b8fde | fudoge/Problem_Solving | 프로그래머스/3/150365. 미로 탈출 명령어/미로 탈출 명령어.cpp | #include <bits/stdc++.h>
using namespace std;
vector<int> dx = {1, 0, 0, -1};
vector<int> dy = {0, -1, 1, 0};
vector<char> dir = {'d', 'l', 'r', 'u'};
pair<int, int> from;
pair<int, int> to;
vector<vector<vector<bool>>> visited;
int rowSize;
int colSize;
int getDiff(pair<int, int> a, pair<int, int> b) {
return... | ALGO | 0.999704 | 4.121006 |
9d3babb3-35e5-4e84-929c-7b0d8e999ee7 | syntacore/snippy | libc/fuzzing/string/strstr_fuzz.cpp | #include "src/string/strlen.h"
#include "src/string/strstr.h"
#include <stddef.h>
#include <stdint.h>
// Simple loop to compare two strings up to a size n.
static int simple_memcmp(const char *left, const char *right, size_t n) {
for (; n && *left == *right; ++left, ++right, --n)
;
return n ? *left - *right : ... | TEST | 0.861027 | 6.528111 |
37d6de7e-2867-4095-ad72-5b434bdd67e9 | smh997/Problem-Solving | Online Judges/Kattis/powerstrings.cpp | /*
* https://open.kattis.com/problems/powerstrings
* Author: https://github.com/smh997/
*/
#include <bits/stdc++.h>
using namespace std;
#define Max_n 10000003
int M, N, lps[Max_n];
string pat, txt;
int res;
void calcLPS()
{
int len = 0;
lps[0] = 0;
int i = 1;
while (i < M) {
if (pat[i] == pat[len]) {
... | ALGO | 0.999587 | 3.993772 |
083f3ca3-586f-46c0-9874-292614b631d6 | Larissa-alSouza/PROGRAMACAO-E-ALGORITMOS-ETEC-Modulo-I | Linguagem C++/Lista de Exercícios 7/exercicio_9.cpp | #include<iostream>
#include<string.h>
#include<locale.h>
using namespace std;
main()
{
setlocale(LC_ALL, "Portuguese");
char frase[50], l1, l2;
int i;
cout << "Digite a frase: ";
gets(frase);
cout << "Qual letra você quer trocar? ";
cin >> l1;
cout << "Qual letra você quer colocar no lugar? ";
cin >> ... | ALGO | 0.998963 | 4.201154 |
cc7b55e3-784b-4057-bf32-9a854c2eef14 | Hee-won/LLVM-JSRfuzz | libc/src/math/generic/modf.cpp | #include "src/math/modf.h"
#include "src/__support/FPUtil/ManipulationFunctions.h"
#include "src/__support/common.h"
namespace __llvm_libc {
LLVM_LIBC_FUNCTION(double, modf, (double x, double *iptr)) {
return fputil::modf(x, *iptr);
}
} // namespace __llvm_libc
| ALGO | 0.985047 | 6.859813 |
911e8c9a-eb11-4465-a264-391f71db6ab0 | ishandutta2007/codeforces | bicsi/normal/551/C.cpp | #include <iostream>
#include <cstdio>
using namespace std;
typedef long long var;
var n, m;
var W[200000], V[200000];
bool good(var T) {
var curelem = 1;
var curperson = 1;
var curtime = T - 1;
for(var i=1; i<=n; i++) {
V[i] = W[i];
}
while(true) {
var sub = min(V[curelem], ... | ALGO | 0.999985 | 3.565073 |
fb3a84ce-4aa9-4032-9bdb-31600011634b | vanAken/CarND-Path-Planning-Project | src/Eigen-3.3/doc/special_examples/Tutorial_sparse_example_details.cpp | #include <Eigen/Sparse>
#include <vector>
#include <QImage>
typedef Eigen::SparseMatrix<double> SpMat; // declares a column-major sparse matrix type of double
typedef Eigen::Triplet<double> T;
void insertCoefficient(int id, int i, int j, double w, std::vector<T>& coeffs,
Eigen::VectorXd& b, con... | ALGO | 0.997284 | 5.388735 |
b606ef04-ac13-429a-b258-9747534bb52d | KindarkhediyaKhushbu/ASSESSMENT | c++/copy.cpp | #include<iostream>
#include<stdlib.h>
#include<ctime>
using namespace std;
class game
{
private:
int round;
string name;
int champscore=0;
int userscore=0;
public:
//constracture
game()
{
cout << "Enter your Name :" << endl;
cin >> name;
cout << name <<" how many round :" << endl;
... | ALGO | 0.995959 | 3.198881 |
485eabe9-67b4-4b32-9ec9-94bf4e14271f | tofergregg/CodeReview | course/cs106b/1176/midterm/p5/student_195.cpp | Vector<int> bestRoute(Grid<double> &distance, int startCity) {
Vector<int> currPath;
currPath.add(startCity);
double minDistance = 0;
Set<int> visited;
visited += startCity;
minDistance = recBestRoute(distance, startCity, currPath, minDistance, 0, visited);
return currPath;
}
/* base case: if the currentPat... | ALGO | 0.99999 | 5.43997 |
757fa3c8-0145-4666-b631-f86dbcdfe4ee | AdityaAjey/SOC_CompetitiveProgramming | leetcode-238.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution {
public:
vector<int> productExceptSelf(vector<int>& nums) {
int n= nums.size();
int pref[n]; //product of prefix array
int suff[n]; //product of suffix array
pref[0] = 1;
suff[n-1] = 1;
for(int i=1;i<n;i+... | ALGO | 0.999977 | 4.954728 |
bb00cd38-cd7b-49ed-bda9-fcda53c4a641 | MissAashnaa1/DSA-Questions | 1549-longest-continuous-subarray-with-absolute-diff-less-than-or-equal-to-limit/1549-longest-continuous-subarray-with-absolute-diff-less-than-or-equal-to-limit.cpp | class Solution {
public:
int longestSubarray(vector<int>& nums, int limit) {
deque<int> increase;
deque<int> decrease;
int max_len = 0;
int left = 0;
for (int right = 0; right < nums.size(); ++right) {
while (!increase.empty() && nums[right] < increase.back()) {
... | ALGO | 0.999997 | 6.180475 |
f3f59861-06b6-4aae-902e-6d3f4e6cd3e1 | omar-s-ta/solved-problems | UVA/Random/Back To High School Physics.cpp | #include<iostream>
using namespace std;
int main()
{
int v,t;
while (cin >> v >> t)
cout << v*(2*t) << endl;
return 0;
} | ALGO | 0.997143 | 3.467925 |
0269a05e-4b2d-4bd4-8db7-77289b0a7c5c | AnandIISc/Data-Structure | LinkedListStackQueue/Swap2NodeLL.cpp | Swap two Node of LL
Given a linked list, i & j, swap the nodes that are present at i & j position in the LL. You need to swap the entire nodes, not just the data.
Indexing starts from 0. You don't need to print the elements, just swap and return the head of updated LL.
Assume i & j given will be within limits. And i ca... | ALGO | 0.999977 | 4.387926 |
d29b17df-bf70-4438-921f-83d96b85ba06 | BhanuKiranChaluvadi/rover_motion | src/main.cpp | #include <fstream>
#include <iostream>
#include <sstream>
#include <string>
#include <memory> // for std::unique_ptr
#include "Rover.h"
using std::cout;
using std::ifstream;
using std::ofstream;
using std::istringstream;
using std::string;
namespace builder
{
// private utiltiy functions
namespace {
... | TOOL | 0.949691 | 4.310562 |
4dc3c2a7-7c6e-4462-bbe2-4155a6e190c4 | kirteeprajapati/Competitive-Coding | CodeForces cpp/158A - Next Round.cpp | #include <iostream>
using namespace std;
int main()
{
int n, k, count = 0;
cin >> n >> k;
int score[n];
for (int i = 0; i < n; i++)
{
cin >> score[i];
}
for (int j = 0; j < n; j++)
{
if (score[j] >= score[k - 1] && score[j] > 0)
{
count++;
}
... | ALGO | 0.999876 | 3.488644 |
6fc4e811-2ad5-4c21-963c-66644e348945 | AaronHavens/Follow_me | src/qpOASES/src/Indexlist.cpp | /**
* \file src/Indexlist.cpp
* \author Hans Joachim Ferreau, Andreas Potschka, Christian Kirches
* \version 3.2
* \date 2007-2017
*
* Implementation of the Indexlist class designed to manage index lists of
* constraints and bounds within a QProblem_SubjectTo.
*/
#include <qpOASES/Indexlist.hpp>
BEGIN_NAMESPA... | ALGO | 0.990054 | 6.227 |
c0123671-8495-4a6d-9564-bb6952ee3707 | a3a256/LeetCodeFun | algorithms/medium/2033. Minimum Operations to Make a Uni-Value Grid/solution.cpp | class Solution {
public:
int minOperations(vector<vector<int>>& grid, int x) {
int i, j, mid, count, diff;
vector<int> line;
for(i=0; i<grid.size(); i++){
for(j=0; j<grid[i].size(); j++){
line.push_back(grid[i][j]);
}
}
sort(line.begin(... | ALGO | 0.999989 | 5.484638 |
9af03c65-7da6-42b0-869c-a39cfcc47627 | SeuMscGzy/px4_flight_visual_servo_control | src/pid_100hz/src/pid_fast.cpp | #include <ros/ros.h>
#include <eigen3/Eigen/Dense>
#include <std_msgs/Float64.h>
#include <std_msgs/Float64MultiArray.h>
#include <cmath>
#include <quadrotor_msgs/PositionCommand.h>
#include <quadrotor_msgs/TakeoffLand.h>
#include <std_msgs/Bool.h>
#include <math.h>
#include <std_msgs/Int32.h>
#include <geometry_msgs/P... | ALGO | 0.976041 | 4.509464 |
45ec7102-d501-4250-b0ac-04502e84a204 | ShashankSureshRotti/Basket-Asian-Option-Pricing | PathDepOption02.cpp | #include "PathDepOption02.h"
#include <cmath>
namespace fre {
SamplePath Rescale(SamplePath S, double index, double x)
{
int m = S.size();
for(int i = 0; i< m; ++i)
{
S[i][index] = S[i][index] * x;
}
return S;
}
double PathDepOption::PriceByMC(MC... | ALGO | 0.996969 | 5.884039 |
292f8232-0513-42df-b57e-2859fc082959 | AllErw/MISI_ImgAlg | support_scripts.cpp | #include "stdafx.h"
#include "fftw3.h"
#include "math.h"
double squa(double base) { return base*base; }
void Compute_envelope_FFTW(double *image,int Nx,int Ny,int Nz)
{
fftw_complex *in, *out, *hilb;
fftw_plan p, pinv;
int cnt,zcnt;
int NxNy = Nx*Ny;
double Nzinv = 1.0/Nz;
in = (fftw_complex*) fftw_malloc(s... | ALGO | 0.994901 | 4.508717 |
3e320b11-2b50-40eb-9d2d-d6be2505591d | Tushar0508/DSA-PRACTICE | 96-unique-binary-search-trees/unique-binary-search-trees.cpp | class Solution {
public:
int numTrees(int n) {
vector<int> dp(n+1);
dp[0]=1;
for(int i=1;i<=n;i++)
{
int sum=0;
for(int j=0;j<i;j++)
{
sum+=dp[j]*dp[i-j-1];
}
dp[i]=sum;
}
return dp[n];
}
... | ALGO | 0.999995 | 6.217064 |
4948f215-6499-4c43-9faa-fba1efbb89fc | akshit24/commoncodes | unionfind.cpp |
// Union-Find
//With Path Compression
include <iostream>
using namespace std;
int id[101];
int sz[101]
void init(int n){
for (int i = 0 ; i < n ; i++){
id[i] = i;
sz[i] = 1;
}
}
int root (int i){
while (i != id[i])
{
id[i] = id[id[i]];
i = id[i];
}
return i;
}
bool isconnected (int p , int q){
ret... | ALGO | 0.999824 | 4.364489 |
3f571b3e-e000-4b2b-ad13-d3d00af4613b | manishsinghkuswaha/code_library-100-Questions- | arrange_positive_negative.cpp | #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];
}
int j=0;
for(int i=0; i<n; i++)
{
if(a[i]<0)
{
if(i!=j)
{
swap(a[i],a[j]);
}
j++;
}
}
for(int i=0... | ALGO | 0.999992 | 4.003791 |
c4766dea-b7a5-4606-be7e-e3e8be603728 | Dhruv1249/CipherSchoolsAssignments | Week1/Day2/Q1.cpp | // Ques-01: Write a C++ program that takes three integers as input from the user and
// determines the largest of the three using if-else statements.
#include "bits/stdc++.h"
using namespace std;
int main(){
int a,b,c;
cout<<"Enter the first number: ";
cin>>a;
cout<<"Enter the second number: ";
... | ALGO | 0.990869 | 3.941666 |
5537e5eb-0221-410a-9008-f89cd7d6e981 | Sayanduary/DSA-Practice | Stack and Queue/implementUsingArray.cpp | #include <iostream>
using namespace std;
struct Stack
{
int size;
int top;
int *arr;
};
void createStack(struct Stack *st)
{
cout << "Enter Size " << endl;
cin >> st->size;
st->top = -1;
st->arr = (int *)malloc(st->size * sizeof(int));
}
void displayStack(struct Stack st)
{
int i;
for (i = st.top; i ... | ALGO | 0.991025 | 3.811892 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.