uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
113cd6ac-9bd4-470a-bc19-4be7e43aeb3b | raincross7/code-similarity | codes/train_code/problem273/problem273_245.cpp | #include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define chmax(x,y) x = max(x,y);
#define chmin(x,y) x = min(x,y);
const int di[] = {-1, 0, 1, 0};
const int dj[] = {0, -1, 0, 1};
const int INF = 1001001001;
int main() {
int ... | ALGO | 0.999641 | 3.808471 |
02fc4b57-9f12-451f-b8b1-7af907c9fccd | Etsuya233/CodeSyncEtsuya | Luogu/1229.cpp | #include <iostream>
#include <string>
#include <cmath>
using namespace std;
int main(){
string in, out;
cin >> in >> out;
out.reserve();
long long amount = 0, ans = 0;
for(int i = 1; i < in.length(); i++){
if(in[i] == out[i] && in[i - 1] == out[i - 1]) amount++;
}
ans = pow(2, amoun... | ALGO | 0.999928 | 3.772688 |
bbf17a2d-7ad0-4252-8acc-f3084d793136 | halogenOS/android_packages_apps_OTAUpdates | jni/boost_1_57_0/libs/random/example/die.cpp | //[die
/*`
For the source of this example see
[@boost://libs/random/example/die.cpp die.cpp].
First we include the headers we need for __mt19937
and __uniform_int_distribution.
*/
#include <boost/random/mersenne_twister.hpp>
#include <boost/random/uniform_int_distribution.hpp>
/*`
We use __mt19937 wi... | ALGO | 0.935005 | 6.137387 |
34ea817a-1c0f-4873-ae71-0d818ebbb882 | Tachikoma87/CBPhotoelectricBarrier | AndroidApp/app/src/main/cpp/Libraries/eigen-master/doc/examples/make_circulant2.cpp | #include <Eigen/Core>
#include <iostream>
using namespace Eigen;
// [circulant_func]
template<class ArgType>
class circulant_functor {
const ArgType &m_vec;
public:
circulant_functor(const ArgType& arg) : m_vec(arg) {}
const typename ArgType::Scalar& operator() (Index row, Index col) const {
Index index = ... | ALGO | 0.999699 | 5.538595 |
a2284d23-c5eb-498d-9219-a6737bb8fe06 | ishandutta2007/codeforces | takio/normal/615/D.cpp | #include <bits/stdc++.h>
#define pii pair <int, int>
#define pic pair <int, char>
#define psi pair <string, int>
#define piii pair <pii, int>
#define UINT unsigned int
#define LL long long
#define xx first
#define yy second
using namespace std;
const int N = 210000;
const int mod = 1e9 + 7;
LL c[N], L[N], R[N];
LL m... | ALGO | 0.999989 | 3.913726 |
67a264e6-ba8d-48ef-9e6a-afbff2b37e77 | suhas25/LC-Solutions | Heaps/373. Find K Pairs with Smallest Sums.cpp | //
// Created by Suhas Reddy on 2/25/25.
//
class Solution {
public:
vector<vector<int>> kSmallestPairs(vector<int>& nums1, vector<int>& nums2, int k)
{
int m = nums1.size();
int n = nums2.size();
vector<vector<int>>result;
//pq -> {sum, {index1, index2}}
priority_queue<pair<int, pair<int, in... | ALGO | 0.999984 | 5.824986 |
38d07814-54bd-44ee-8ff3-aca1e946b455 | gfonsecabr/shadoks-robots | robot_by_robot/world.cpp | // CG:SHOP 2021 Coordinated Motion Planning - Shadoks Team
//
// Class that stores all robots and obstacles together
//
#ifndef WORLD
#define WORLD
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <stack>
#include <filesystem>
#in... | TOOL | 0.884453 | 3.999527 |
44edddfe-e535-4260-9b07-f10a9649546d | anishacharya/Cracking-Coding-Interviews | Graph/BFS.cpp | #include <iostream>
#include<list>
#include<queue>
using namespace std;
class Graph
{
int V; // No. of vertices
list<int> *adj; // Pointer to an array containing adjacency lists
public:
Graph(int V); // Constructor
void addEdge(int v, int w); // function to add an edge to graph... | ALGO | 0.999931 | 4.406829 |
670d96e8-bd51-4a0e-8c95-b3bbf0d50076 | rikiblues/c | transposematrix.cpp | #include <stdio.h>
int main()
{
int matrix[10][10], transpose[10][10];
int row, col, i, j;
printf("Enter number of rows and columns of the matrix: ");
scanf("%d %d", &row, &col);
printf("Enter elements of the matrix:\n");
for(i = 0; i < row; i++)
{
for(j = 0; j < col; j++)
{
... | ALGO | 0.994745 | 4.201929 |
6aeecf25-0362-4f27-a95e-092b2710d202 | Rofidajamal/SingleLinkedList | main.cpp | #include <iostream>
using namespace std;
template <typename T>
struct node {
node* link;
T info;
};
template <class T>
class LinkedList {
private:
node<T>* head;
node<T>* last;
int length;
public:
LinkedList() {
head = NULL;
last = NULL;
length = 0;
}
bool is... | ALGO | 0.99927 | 4.688545 |
fa6ecaba-3fad-425f-8a8c-227644c29383 | pakhandi-zz/CODECHEF | PC05/1.cpp | //Author : pakhandi
//
using namespace std;
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<cstring>
#define wl while
#define fl(i,a,b) for(i=a; i<b; i++)
int primes[] = {2,3,5,7,11,13,17,19,23,25,29,31,37,41,43,47};
int main()
{
int cases, i, j, l, u, temp,... | ALGO | 0.999496 | 3.554903 |
409e6244-ada7-42bb-8f35-bb377f66f73a | achmadsyahrian/dasar-pemograman | 2312000059.cpp | #include <stdio.h>
#include <iostream>
main()
{
int nilai;
std::cout << "Masukkan Nilai Anda : ";
std:: cin >> nilai;
if (nilai >= 85){
std::cout << "Anda Dapat Nilai A ";
} else if (nilai >= 70) {
std::cout << "Anda Dapat Nilai B ";
} else if (nilai >= 60) {
std::cout << "Anda Da... | TOOL | 0.88321 | 3.657052 |
ac785baa-6470-4bc9-b742-a9d4092d9624 | GWFrank/TCG-2023 | hw1/b09902004/src/solve.cpp | #include <queue>
#include <vector>
#include <unordered_set>
#include <cstdio>
#include <cstdint>
#include "ewn.hpp"
inline void PrintDummyAnswer() { printf("0\n"); }
// Returns whether a goal state is reached
bool DFSLimit(ewn::Game &game, int limit) {
int moves[16]; // at most can move 2 pieces in 8 direction... | ALGO | 0.999605 | 5.624336 |
38c37d4c-e0ec-426e-9d5b-d51b315b2fc9 | creatale/node-dv | deps/tesseract/cube/cube_utils.cpp | #include <math.h>
#include <string>
#include <vector>
#include "cube_utils.h"
#include "char_set.h"
#include "unichar.h"
namespace tesseract {
CubeUtils::CubeUtils() {
}
CubeUtils::~CubeUtils() {
}
/**
* convert a prob to a cost (-ve log prob)
*/
int CubeUtils::Prob2Cost(double prob_val) {
if (prob_val < MIN_PRO... | TOOL | 0.97092 | 6.406516 |
1a2d71a6-eefd-43ae-94ad-b69da40501bb | STATICHIT/AlgorithmProblemTraining | 寒假预备役/二.7.二叉树深度.cpp |
#include<bits/stdc++.h>
using namespace std;
int n,ans;
struct Tree
{
struct Tree * left;
struct Tree * right;
} T[100000];
void dfs(struct Tree * x,int deep)//ǰ
{
ans=max(ans,deep);
if(x->left!=NULL)
dfs(x->left,deep+1);
if(x->right!=NULL)
dfs(x->right,deep+1);
}
int main()
{
c... | ALGO | 0.999799 | 3.807153 |
c185a262-3487-4b0f-9572-83c25836c678 | akinanop/mvl-solver | tests/RandomSAT/z3-master/src/tactic/fpa/fpa2bv_model_converter.cpp | #include"ast_smt2_pp.h"
#include"fpa2bv_model_converter.h"
void fpa2bv_model_converter::display(std::ostream & out) {
out << "(fpa2bv-model-converter";
for (obj_map<func_decl, expr*>::iterator it = m_const2bv.begin();
it != m_const2bv.end();
it++) {
const symbol & n = it->m_key->get_n... | TOOL | 0.937663 | 5.831355 |
2056d760-5ab2-4889-ac01-bba77114e27f | applied-numerical-algorithms-group-lbnl/Chombo_3.2 | lib/src/EBAMRElliptic/DirichletConductivityDomainBC.cpp | #ifdef CH_LANG_CC
#endif
#include "DirichletPoissonDomainBCF_F.H"
#include "DirichletConductivityDomainBC.H"
#include "EBArithF_F.H"
#include "NamespaceHeader.H"
/*****/
DirichletConductivityDomainBC::
DirichletConductivityDomainBC()
{
}
/*****/
DirichletConductivityDomainBC::
~DirichletConductivityDomainBC()
{
}
/*... | ALGO | 0.988334 | 6.123336 |
639cd4b2-7b6c-4902-b1df-8eab4d292704 | msm8953-dev/android_frameworks_av | media/libstagefright/codecs/amrnb/common/src/q_plsf_3.cpp | /*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include <string.h>
#include "q_plsf.h"
#include "typedef.h"
#include "lsp_lsf.h"
#include "reorder.h"
#include "lsfwt.h"
/*------------------------... | ALGO | 0.999484 | 5.832959 |
5d7c5453-2532-4c84-9623-289ea7d76b86 | hasib9963/Algorithm-Module-3 | merge_sort.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 7; // Maximum size of the array
int a[N]; // Array to be sorted
// Merge function to merge two sorted subarrays
void merge(int l, int r, int mid)
{
int left_size = mid - l + 1;
int L[left_size + 1];
int right_size = r - mid;
... | ALGO | 0.999998 | 5.639764 |
fac4b5ea-ba42-4100-826d-b44f8020b12b | shriamrut/Problem-Solving | Dynammic Programming/longestpalindromesubstr.cpp | //lOnGeSt PaLlInDrOmE sUbseq
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ll long long
#define MOD 10000000007
using namespace std;
void fast()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
}
int main()
{
fast();
int j;
string s;
cin>>s;
int n=s.size();
bool dp[n][n];
f... | ALGO | 0.999817 | 3.155936 |
22b9e778-537a-42b3-bdb3-9067e00d8153 | K1XE/LeetCode | 6.栈与队列/8.前 K 个高频元素/347.前-k-个高频元素.cpp | /*
* @lc app=leetcode.cn id=347 lang=cpp
*
* [347] 前 K 个高频元素
*/
#include <bits/stdc++.h>
using namespace std;
// @lc code=start
class Solution {
public:
vector<int> topKFrequent(vector<int>& nums, int k) {
auto cmp = [](const pair<int, int>& a, const pair<int, int>& b)
{
return a.fir... | ALGO | 0.999988 | 6.056695 |
be619c61-bf8e-4bac-9509-bdb732cac971 | aadityesh/striver-sde-sheet | 11-missing-repeating.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];
// brute (for loops)
/*
int miss = -1;
int repeat = -1;
for (int i = 1; i <= n; i++)
{
int cnt = 0;
for (int j = 0; j < n; j++... | ALGO | 0.999886 | 3.909181 |
2d08e459-24fa-4432-8eff-2a6e6eaec0e3 | ishandutta2007/codeforces | maroonrk/normal/958/E2.cpp | #include <bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(int)(N);i++)
#define rep1(i,N) for(int i=1;i<=(int)(N);i++)
#define show(x) cout<< #x<< " "<<(x)<<endl;
#define all(c) c.begin(),c.end()
#define chmax(x,y) x = max(x,y)
#define fs first
#define sc second
#define pb push_back
using namespace std;
using ll = long ... | ALGO | 0.999973 | 3.799443 |
e25b20cd-0d33-4b0c-be4d-1156c43478aa | boing-86/Algorithm_Study | 프로그래머스/lv1/12921. 소수 찾기/소수 찾기.cpp | #include <string>
#include <vector>
using namespace std;
int solution(const int n) {
int answer = 0;
int num[1000000] = {0, };
for(int i = 2; i<=n; i++){
num[i] = i;
}
for(int i = 2; i<=n; i++){
if(num[i] == 0){
continue;
}
for(int j = 2*i; ... | ALGO | 0.999873 | 4.874707 |
b530940e-1338-437c-943b-60bd9945f6ad | baheti07/GFG-POTD-100-days-code- | binarytreetobst.cpp | int idx;
Node* binaryTreeToBST(Node* root) {
if (root == nullptr)
return nullptr;
vector<int> al;
order(al, root);
sort(al.begin(), al.end());
idx = 0;
replace(al, root);
return root;
}
void order(vecto... | ALGO | 0.999991 | 5.760135 |
5eb09ad4-a626-4b5b-b558-609bee260a62 | lordjunn/Starting-Out-With-Cpp | CHAPTER 4 Making Decisions/Programming Challenges/11. Math Tutor.cpp | /* This is a modification of Programming Challenge 17 from Chapter 3. Write a program
that can be used as a math tutor for a young student. The program should display two
random numbers that are to be added, such as:
247 + 129
The program should wait for the student to enter the answer. If the answer is correct,
a mess... | ALGO | 0.989912 | 6.004439 |
bbb89f69-a82e-4aff-a40c-82058b949810 | zhenchai00/cpp-tutorial | week1/Lab/Lab.cpp | #include <iostream> // input output stream library
# include <iomanip> // input output manipulation library
using namespace std;
// int main() is the entry point of the program which return an integer
// void main() is the entry point of the program which return nothing
int main()
{
// :: => scope operator
/... | TOOL | 0.867063 | 4.205453 |
272e5237-265b-4369-ad86-54a2853393fe | PranshVaishnav/DSA-Implementation-Question | Tree/Binary_Seach_Tree.cpp | // No duplicates present
// Inorder traversal gives sorted Elements.
// Catelon Number binary search tree possible
#include <iostream>
using namespace std;
// structure of node class
class Node
{
public:
int data;
Node *left;
Node *right;
Node(int x)
{
data=x;
left=right=NULL;
... | ALGO | 0.999899 | 5.338355 |
a72a3d19-b24d-4947-804a-336fd536c8fb | lc-3-2/llvm | llvm/lib/DebugInfo/LogicalView/Core/LVRange.cpp | #include "llvm/DebugInfo/LogicalView/Core/LVRange.h"
#include "llvm/DebugInfo/LogicalView/Core/LVLocation.h"
#include "llvm/DebugInfo/LogicalView/Core/LVOptions.h"
using namespace llvm;
using namespace llvm::logicalview;
#define DEBUG_TYPE "Range"
void LVRange::startSearch() {
RangesTree.clear();
LLVM_DEBUG({ d... | TOOL | 0.934648 | 7.589659 |
b5e915e1-de9a-41a3-ba45-137f3081f7b5 | DamonZhao-sfu/Vitis_Accel_TopSort | ocl_kernels/cl_partition_cyclicblock/src/host.cpp | #include "xcl2.hpp"
#include <algorithm>
#include <cstdio>
#include <random>
#include <vector>
using std::default_random_engine;
using std::generate;
using std::uniform_int_distribution;
using std::vector;
// row major
void matmul(vector<int, aligned_allocator<int> >& C,
vector<int, aligned_allocator<int>... | ALGO | 0.978539 | 5.635562 |
225f31b6-3746-4493-ae6f-90ba4bf104b1 | ravireddy07/cpp-book | src/Leetcode/1162_as-far-from-land-as-possible.cpp | // https://leetcode.com/problems/as-far-from-land-as-possible/
#include <bits/stdc++.h>
using namespace std;
class Solution
{
public:
int maxDistance(vector<vector<int>> &grid)
{
queue<pair<int, int>> q;
int N = grid.size();
for (int i = 0; i < N; i++)
{
for (int j ... | ALGO | 0.999742 | 5.583189 |
a4d61807-30bd-434a-8224-560fa9dcc700 | sushantkumar143/Competitive-Programming | CodeForces/A_Way_Too_Long_Words.cpp | #include<iostream>
using namespace std;
int main(){
int t;
cin >> t;
while(t--){
string s;
cin >> s;
int n = s.length();
if(n<=10){
cout << s << "\n";
}
else{
string ans = "";
ans += s[0];
ans += to_str... | ALGO | 0.999659 | 4.625623 |
58c8483b-52ee-408d-8066-15afffffdb04 | mattoverby/admm-elastic-sca | deps/admm-elastic-sca/deps/Eigen3/failtest/colpivqr_int.cpp | #include "../Eigen/QR"
#ifdef EIGEN_SHOULD_FAIL_TO_BUILD
#define SCALAR int
#else
#define SCALAR float
#endif
using namespace Eigen;
int main()
{
ColPivHouseholderQR<Matrix<SCALAR,Dynamic,Dynamic> > qr(Matrix<SCALAR,Dynamic,Dynamic>::Random(10,10));
}
| TEST | 0.951448 | 3.162483 |
365d9ef2-990a-4b8b-a915-bbd76d2a9d03 | 1nt3nt/parallel_programming | hw4/gold.cpp | #include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <float.h>
#include "constMem.cuh"
void computeGold(float* result, float* input1, float* input2, float* temp);
/**
* @brief
*
* @param result reference result res[128][128]
* @param input1 input1[128]
* @param input2 input2[128][128]
* @param te... | ALGO | 0.999711 | 3.645655 |
cbebd979-7667-4d8c-b187-6e23d302392e | Schr0Smi1ey/XPSC | Week 05/Contest/G_Possible_or_Not.cpp | #include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define endl "\n"
#define int long long int
void solution(){
int n,k;cin >> n >> k;
int arr[n];
int andd = -1;
for(int i=0;i<n;i++){
cin >> arr[i];
if((arr[i]&k) == k){
... | ALGO | 0.999553 | 5.08251 |
eadb8e87-44cf-4ce2-ac4a-47fbbcbc7025 | luckyhyom/TIL | C++/과제/DAlloc.cpp | #include <iostream>
using namespace std;
int main()
{
cout << "202134-154253 김효민" << std::endl;
char *sPtr;
int maxSLen; // 입력할단어의최대길이
cout << "단어의 최대 길이를 입력하시오 : ";
cin >> maxSLen;
sPtr = new char[maxSLen]; // maxSLen개의 문자를 저장할 메모리 할당
cout << "단어를 입력하시오 : ";
cin >> sPtr;
int len{0}... | TOOL | 0.956105 | 4.510656 |
977be4ff-bf84-46a5-aab0-3ea026f108c1 | palilo815/ps | baekjoon/18000/18937.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
cin.tie(nullptr)->sync_with_stdio(false);
#ifdef home
freopen("in", "r", stdin);
freopen("out", "w", stdout);
#endif
int n;
cin >> n;
int sum = 0;
for (int x; n--;) {
cin >> x;
sum ^= x - 2;
}
string fst;
... | ALGO | 0.999973 | 4.657872 |
143c3cce-3989-4bed-aaaa-1012e13a36e2 | hey-rum-ba/G4G-DSA | Reverse Coding.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
#define mod (int)(1e9 + 7)
class Solution
{
public:
int sumOfNaturals(int n)
{
// code here
return ((n * 1LL * (n + 1)) / 2) % mod;
}
};
//{ Driver Code Starts.
int main()
{
int t;
cin >> t;... | ALGO | 0.999915 | 6.154389 |
fbe216f4-897e-4c1c-a110-d5e146f435b8 | karayuumac/procon-archive | atcoder.jp/abc124/abc124_a/Main.cpp | #include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define copy(from, to) copy(from.begin(), from.end(), back_inserter(to));
#define sort(a) sort(a.begin(), a.end())
typedef long long ll;
using namespace std;
template<class T>
void load(vector<T> &v, int n) {
for (int i = 0; i < n; ++i) {... | ALGO | 0.997428 | 3.086934 |
6ce58511-449a-49da-b533-da888fcd6ee6 | 2809708153/WorkCG | cat.cpp | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
class Cat {
int age;
static int HowManyCats; //̬
public:
Cat(int a = 0) : age(a) {
HowManyCats++;
}
~Cat() {
HowManyCats--;
cout << "destructing of the cat!" << endl;
}
static int GetHowMany() {
... | TOOL | 0.851775 | 5.031266 |
ea8313e6-5359-499b-9ec7-aa89736828c9 | hal-uw/cpelide-micro24-artifact | gem5_multigpu/src/systemc/tests/systemc/misc/synth/gcd/gcd.cpp | /*****************************************************************************
gcd.cpp --
Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
*****************************************************************************/
/*****************************************************************************
... | ALGO | 0.99957 | 5.771304 |
8fda9a5a-d5ca-463b-a323-e63f2d3f205d | zzfbwoals/Study | BOJ/Step/TwoDimensionalArray/4/색종이.cpp | #include <iostream>
using namespace std;
int main()
{
int N, sum = 0;
cin >> N;
int arr[100][100] = {0};
for(int i=0; i<N; i++)
{
int x, y;
cin >> x >> y;
for(int j=x; j<x+10; j++)
{
for(int z=y; z<y+10; z++)
{
if(arr[j][z]==1... | ALGO | 0.998797 | 3.11381 |
aa7f7eea-6b74-4cd2-9fb4-e662a6e6fb51 | Michal-Szczepaniak/measurements | drc/baselib.cpp | /* Funzioni di libreria base */
/* Inclusioni */
#include "baselib.h"
#include "fft.h"
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
/* Memory leaks debugger */
#ifdef DebugMLeaks
#include "debug_new.h"
#endif
/* Output stringhe con sync output e parametro */
int sputsp(const char * s, const char * p)
{... | TOOL | 0.974374 | 5.269869 |
858b9476-e9a3-4bb4-b6a6-e9394ff0594b | ahsamehx/Problem-Solving | Dp/Tetrahedron.cpp | #include <bits/stdc++.h>
#define int long long
#define mod 1000000007
using namespace std;
signed main() {
ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
int n;
cin>>n;
int a = 0, b = 0, c = 0, d = 1;
for(int i = 1; i <= n; i++) {
int na = (b + c + d) % mod;
int n... | ALGO | 0.999973 | 3.94206 |
3e01b7ba-abe4-4892-9838-72d960cb8c0c | olimjon1606/daily-c-2 | semester2/lesson3_ex1.cpp | #include <iostream>
#include <string>
#include <vector>
using namespace std;
int main()
{
vector<float> squares;
for (int i = 2; i <= 10; ++i)
{
for (int j = 0; j <= 10; ++j)
{
squares.push_back(i * j);
}
}
for (int i = 0; i < squares.size(); ++i)
{
... | ALGO | 0.95368 | 3.534828 |
6bf671f5-bb6a-410d-b187-41dd01b02fdd | Azeemo/Master-Linked-List- | 9_Check_LinkedList_Palindrome.cpp | //{ Driver Code Starts
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <stack>
using namespace std;
/* Link list Node */
struct Node {
int data;
struct Node *next;
Node(int x) {
data = x;
next = NULL;
}
};
// } Driver Code Ends
/*
struct Node {
int data;
struct Node *next;
Nod... | ALGO | 0.999241 | 5.088322 |
9401a440-fe1a-458e-8aee-2b394e94b82f | qiatongxueshaonianC/CaiZebin-Code_warehouse | PAT/顶级/1001/并查集/count_if/main.cpp | #include<bits/stdc++.h>
using namespace std;
const int maxn=510;
struct Edge{
int c1,c2,cost;
Edge(int a,int b,int c):c1(a),c2(b),cost(c){}
};
vector<Edge> use,repair;
int N,M,father[maxn],cost[maxn];
bool cont(int a){
if(a>0) return true;
return false;
}
int findFather(int a){
if(father[a]==a)
return a;
int t... | ALGO | 0.999936 | 3.952084 |
f5bbf0f1-a275-405b-9ce5-331db26b9cdc | CryptoCoderz/FlavorXL-Core | src/stealth.cpp | #include "stealth.h"
#include "base58.h"
#include <openssl/rand.h>
#include <openssl/ec.h>
#include <openssl/ecdsa.h>
#include <openssl/obj_mac.h>
bool CStealthAddress::SetEncoded(const std::string& encodedAddress)
{
data_chunk raw;
if (!DecodeBase58(encodedAddress, raw))
{
if (fDebug)
... | TOOL | 0.885377 | 6.597433 |
7a0743a4-fa74-4226-9178-288071aafbcf | Chineseboy-neo/C-homework | Chapter05/T5_27.cpp | /*
File:T5_27
Name:Yuzhuo Wang
E-mail:<EMAIL>
Date:Apr 2th,2022
Function:ȥcontinue
*/
#include <iostream>
using namespace std;
int main()
{
int x;
double y;
cin>>x>>y;
switch(x)
{
case 1:cout<<2.98*y;break;
case 2:cout<<4.50*y;break;
case 3:cout<<9.98*y;break;
... | ALGO | 0.998495 | 3.732827 |
a43b7bae-65c3-43c8-82f2-815b23dc9603 | Suvraneel/LeetCode | 141-linked-list-cycle/141-linked-list-cycle.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 && fast->next){
slow=slo... | ALGO | 0.999817 | 5.27499 |
974888e6-1ea3-490d-ba69-1e126152be4e | guessable/backup | cpp/LeetCode/JZ/JZ56.cpp | #include <iostream>
#include <vector>
#include <queue>
using namespace std;
class Solution {
public:
vector<int> maxSlidingWindow(vector<int>& nums, int k) {
int n = nums.size();
vector<int> result;
deque<int> qu;
for(int i = 0; i < k; i++) {
while(!qu.empty()) {
if(qu... | ALGO | 0.999928 | 6.259753 |
c49ee0a1-e654-4933-863e-fdb416348009 | bogdan-lab/Algorithm_puzzles | Tasks/MD_task_11B.cpp | #include <algorithm>
#include <functional>
#include <iostream>
#include <limits>
#include <numeric>
#include <sstream>
#include <vector>
constexpr int kInfinity = std::numeric_limits<int>::max();
struct VertexEnd {
int id = 0;
int weight = 0;
};
class PriorityQueue {
public:
PriorityQueue(std::function<bool(i... | ALGO | 0.999997 | 5.043984 |
7be420b5-b4a1-427e-8d5d-b505b715840a | ishandutta2007/codeforces | ngfam/normal/839/E.cpp | #include<bits/stdc++.h>
using namespace std;
const int MAXN = 42;
typedef bitset<MAXN> bs;
int n, k;
bs a[MAXN];
int f[1 << (MAXN / 2)];
int main() {
ios_base::sync_with_stdio(false); cin.tie(NULL);
cin >> n >> k;
for(int i = 0; i < n; ++i) {
for(int j = 0; j < n; ++j) {
int x; cin >> x;
a[i... | ALGO | 0.999774 | 3.791222 |
4ccfda5c-b692-4a0f-b4ac-a77d9d8346f1 | admafi/Instagib2021 | codeJK2/game/wp_melee.cpp | #include "g_headers.h"
#include "b_local.h"
#include "g_local.h"
#include "wp_saber.h"
#include "w_local.h"
#include "g_functions.h"
// Temp melee attack damage routine
//---------------------------------------------------------
void WP_Melee( gentity_t *ent )
//-------------------------------------------------------... | TOOL | 0.938102 | 5.315248 |
dd7593be-6203-4975-a67d-26206fa98931 | AmpleCoder/Leetcode-Solving | DP/1D DP/1641. Count Sorted Vowel Strings.cpp | /*
below is the most basic solution
*/
class Solution {
public:
int countVowelStrings(int n) {
int ans=0;
int dp[n][5];
memset(dp,0,sizeof(dp));
for(int i=0;i<5;i++){
dp[0][i]=1;
}
for(int i=1;i<n;i++){
for(int j=0;j<... | ALGO | 0.999918 | 6.684919 |
b9a024bf-3164-465f-8744-43c8cae87cf9 | kmjp/procon | codeforce/851-900/862/c2.cpp | #include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define FORR2(x,y,arr) for(auto& [x,y]:arr)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define ... | ALGO | 0.999888 | 3.551428 |
7c3bc89b-4fc9-4e4d-80c9-81a3757c5b86 | KentuckyFriedData/SDRPlusPlus-Mac-ARM64 | decoder_modules/radio/src/rds.cpp | #include "rds.h"
#include <string.h>
#include <map>
#include <algorithm>
#include <utils/flog.h>
namespace rds {
std::map<uint16_t, BlockType> SYNDROMES = {
{ 0b1111011000, BLOCK_TYPE_A },
{ 0b1111010100, BLOCK_TYPE_B },
{ 0b1001011100, BLOCK_TYPE_C },
{ 0b1111001100, BLOCK_TYPE... | ALGO | 0.952687 | 4.045099 |
00136105-f5db-4e60-9c6f-895b9eeabc25 | nubango/EDA-DomJudge | Soluciones/2-03-suficientementedisperso.cpp | // Nuria Bango Iglesias
// VJ04
#include <iostream>
#include <iomanip>
#include <fstream>
#include <vector>
using namespace std;
// se considera suficientemente disperso si la diferencia entre el primer valor que se saca
// y el ultimo sea mayor o igual que una cantidad K
// tambien la diferencia entre el primer val... | ALGO | 0.999971 | 4.247825 |
78c97d1b-d082-41e1-b424-69e6f57ac6f1 | amangupta2486/Leetcode-problems-solutions | Minimum Swaps to Sort - GFG/minimum-swaps-to-sort.cpp | // { Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution
{
public:
//Function to find the minimum number of swaps required to sort the array.
int minSwaps(vector<int>& a)
{
int n=a.size();
int vis[n+1];
memset(vis,0,sizeof(vis));
... | ALGO | 0.999958 | 5.842315 |
e7e41829-ce76-4a1b-9e0c-e478ff9ac37e | davidjoffe/dave_gnukem | src/djfonts.cpp | /*--------------------------------------------------------------------------*/
#include "config.h"
#include "djfonts.h"
#include "djutf8.h" // <- for 'utf8 to 32-bit' conversion for TTF_GlyphIsProvided32 to help find closest best matching font
#ifdef djUNICODE_TTF
// /#include "datadir.h"//Don't actually want just for... | TOOL | 0.86601 | 6.168336 |
2b2760e3-8fac-4e11-88fd-5f8d8d86067f | sarvex/leetcode-prolog | solution/2400-2499/2466.Count Ways To Build Good Strings/Solution.cpp | class Solution {
public:
const int mod = 1e9 + 7;
int countGoodStrings(int low, int high, int zero, int one) {
vector<int> f(high + 1, -1);
function<int(int)> dfs = [&](int i) -> int {
if (i > high) return 0;
if (f[i] != -1) return f[i];
long ans = i >= low &... | ALGO | 0.999978 | 5.934868 |
91c89cd3-ce41-4ae7-bafb-829b91cdda70 | amit-nafshi/ece0302-programming08 | projects/project5/puzzle_solver.cpp | #include "puzzle_solver.hpp"
#include <functional>
#include <unordered_set>
#include "puzzle.hpp"
#include "state.hpp"
#include "frontier_queue.hpp"
// specialize the std::hash function for Puzzles
// reference here: https://en.cppreference.com/w/cpp/language/extending_std
namespace std {
template <> struct hash<Puz... | ALGO | 0.999975 | 6.020046 |
cbd32b9d-83b8-4167-add3-b629d7f73a9d | ur0/webkit-source | WebCore/platform/cocoa/TelephoneNumberDetectorCocoa.cpp | #include "config.h"
#include "TelephoneNumberDetector.h"
#if ENABLE(TELEPHONE_NUMBER_DETECTION)
#include <wtf/SoftLinking.h>
#if USE(APPLE_INTERNAL_SDK)
#include <DataDetectorsCore/DDDFAScanner.h>
#else
typedef struct __DDDFAScanner DDDFAScanner, * DDDFAScannerRef;
struct __DDDFACache;
#endif
SOFT_LINK_PRIVATE_FRAM... | TOOL | 0.920849 | 7.33045 |
eb985027-e4d7-4015-934c-950977c951d4 | frits-scholer/comb | karatsuba/p1.cpp | #include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(int)(b);++i)
#define REP(i,a) FOR(i,0,a)
#define sp << " " <<
#define all(x) x.begin(),x.end()
#define PB push_back
#define sz(x) x.size()
#define MP make_pair
#define X first
#define Y ... | ALGO | 0.999948 | 3.342374 |
1ba446d1-1d2a-4367-b058-510b4e56cf09 | steinbergmedia/vstgui | vstgui/standalone/examples/minesweeper/source/model.cpp | #include "model.h"
#include <algorithm>
#include <random>
#include <cassert>
//------------------------------------------------------------------------
namespace VSTGUI {
namespace Standalone {
namespace Minesweeper {
//------------------------------------------------------------------------
Model::Model (uint32_t nu... | TOOL | 0.918783 | 6.321444 |
a6191d03-4c08-441d-a9da-113ffd2735f1 | Edison-Du/Competitive-Programming | Canadian Computing Competition/2013/S4 Who is Taller.cpp | #include <bits/stdc++.h>
using namespace std;
const int MAX = (int)1e6+5;
int n, m, p, q;
bool vis[MAX];
vector<int> adj[MAX];
bool dfs (int cur, int target) {
if (cur == target) return 1;
else if (vis[cur]) return 0;
vis[cur] = 1;
bool good = 0;
for (int i : adj[cur]) {
good |= dfs(i, targ... | ALGO | 0.999895 | 4.710885 |
c9a04a9e-80f2-49c2-bef9-09bae23952f3 | ysk24ok/leetcode-submissions | 0230/dfs.cpp | #include <cassert>
#include <iostream>
#include "leetcode/tree.hpp"
using namespace std;
using namespace LeetCode;
class Solution {
public:
int kthSmallest(TreeNode* root, int k) {
int ret = 0;
dfs(root, k, 0, ret);
return ret;
}
int dfs(TreeNode* node, int k, int offset, int& ret) {
if (!nod... | ALGO | 0.999917 | 6.238539 |
216ce343-5258-4ad2-ae3d-5156da76162d | refatulfahad/Algorithm-Implementation | DATA STRUCTURE/Sparse Table minimum query.cpp | #include<bits/stdc++.h>
using namespace std;
int ar[10000],query[100][100];
void Build_rmq(int n)
{
for(int i=1; i<=n; i++)
{
query[i][0]=ar[i];
}
for(int j=1; (1<<j)<=n; j++)
{
for(int i=1; i+(1<<j)-1<=n; i++)
{
query[i][j]=min(query[i][j-1],query[i+(1<<(j-1))][... | ALGO | 0.999987 | 4.914433 |
c4be7756-1467-4c6a-8419-681f8ba9efac | raincross7/code-similarity | codes/train_code/problem336/problem336_275.cpp | #include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define debug(var) do{cout << #var << " : "; view(var);}while(0)
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;ret... | ALGO | 0.999924 | 3.544984 |
c7ee97f6-4b14-475d-ab36-0c5f42f60509 | Harsh-Dogney/leetcode-DSA | 1497-design-a-stack-with-increment-operation/1497-design-a-stack-with-increment-operation.cpp | class CustomStack {
public:
int n;
stack<int> stack;
vector<int> inc;
CustomStack(int n) {
this->n = n;
}
void push(int x) {
if (stack.size() < n) {
stack.push(x);
inc.push_back(0);
}
}
int pop() {
if (stack.empty()) return -1;
... | ALGO | 0.999841 | 5.204934 |
87840645-6f1e-47c6-9727-7778b6c19563 | all1m-algorithm-study/2021-1-Algorithm-Study | week3/Group7/Boj11729_poiu694.cpp | #include <iostream>
#include <cmath>
using namespace std;
void hanoi(int num, int start, int temp, int end){
if(num==1){
cout << start << " " << end << '\n';
}else{
hanoi(num-1,start, end, temp);
cout << start << " " << end << '\n';
hanoi(num-1,temp, start, end);
}
}
int main() {
int N;
cin >> N;
cout <... | ALGO | 0.999856 | 4.442485 |
56165667-7265-4dbb-9edf-4ed59c29b760 | ishandutta2007/codeforces | akulyat/normal/1249/B1.cpp | #include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
ifstream in;
ofstream out;
const long long kk = 1000;
const long long ml = kk * kk;
const long long mod = ml * kk + 7;
const long long inf = ml * ml * ml + 7;
ll ... | ALGO | 0.999962 | 4.627686 |
1bd04cad-3967-4ed4-a84b-b7167d516aed | multi-os-engine/icu | icu4c/source/i18n/collationcompare.cpp | #include "unicode/utypes.h"
#if !UCONFIG_NO_COLLATION
#include "unicode/ucol.h"
#include "cmemory.h"
#include "collation.h"
#include "collationcompare.h"
#include "collationiterator.h"
#include "collationsettings.h"
#include "uassert.h"
U_NAMESPACE_BEGIN
UCollationResult
CollationCompare::compareUpToQuaternary(Coll... | ALGO | 0.99584 | 7.350449 |
83bf1a73-12e4-46c9-8f5a-c47791b3cd4d | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_5586_25.cpp | #include <bits/stdc++.h>
using namespace std;
int main() { cout << "Odd"; }
| ALGO | 0.997481 | 3.299085 |
baab83c1-7d29-4c7a-9c52-e6947f1424e3 | Nakib-Arman/CSE318---ArtificialIntelligence | 4.DecisionTree/.history/decision_tree_20250703121816.cpp | #include<bits/stdc++.h>
using namespace std;
int getEntropy(int attributes, vector<int> top, vector<int> bottom)
{
int entropy=0;
for (int i=0;i<attributes;i++){
float p = static_cast<float> (top[i])/bottom[i];
entropy -= log2(p) * p;
}
}
int main()
{
vector<vector<string>> dataset;
... | ALGO | 0.987275 | 4.262118 |
a2a5e5dc-3dac-42be-b33f-06330556a6ac | ishandutta2007/codeforces | zhoushang2003/normal/1520/E.cpp | #include<bits/stdc++.h>
using namespace std;
#define int long long
int t,n,A,d;
string s;
signed main()
{
cin>>t;
while(t--&&cin>>n>>s)
{
vector<int>v;
for(int i=0;i<n;i++)
if(s[i]=='*')
v.push_back(i);
A=0,d=v.size()/2;
for(int i=0;i<v.size();i++)
A+=abs(v[d]-v[i]-d+i);
cout<<A<<'\n';
}
return... | ALGO | 0.999545 | 3.800317 |
03a1a94c-2f98-4d48-910f-76f9a6b1de70 | priyanshi585/DSA | Graph/prims_algo.cpp | #include<iostream>
#include<unordered_map>
#include<vector>
#include<list>
#include<limits.h>
using namespace std;
vector<pair<pair<int , int> , int>> calculatePrimsMST(int n, int m ,vector<pair<pair<int , int> , int>> &g)
{
unordered_map<int , list<pair<int , int>>> adj ;
for(int i = 0;i<g.size();i++){
... | ALGO | 0.999991 | 5.050363 |
e3ee410d-987e-4913-ae9f-04006887696c | ob22a/Leetcode | 228-summary-ranges/summary-ranges.cpp | class Solution {
public:
vector<string> summaryRanges(vector<int>& nums) {
if(nums.empty()) return {};
int a=nums[0];
vector<string> ranges;
for(int i=1;i<=nums.size();++i){
if(i==nums.size() || nums[i]!=1+nums[i-1]){
if(a==nums[i-1]) ranges.push... | ALGO | 0.999946 | 6.484811 |
f52b3edb-be32-43df-beff-af563dc961eb | Waqar-107/LeetCode | Daily Challenges/2022/May/1679. Max Number of K-Sum Pairs.cpp | class Solution {
public:
int maxOperations(vector<int>& nums, int k) {
map<int, int> cnt;
for(int e : nums) {
if(e <= k) {
cnt[e]++;
}
}
int ans = 0;
auto itr = cnt.begin();
while(itr != cnt.end())
... | ALGO | 0.999762 | 6.053368 |
69929709-226e-4767-a3da-ff92a08171b8 | Nitish9711/coding-blocks | sortingAndSearching/counting.cpp | #include<iostream>
using namespace std;
void counting_sort(int ar[], int n)
{
int largest = -1;
for(int i =0;i<n;i++)
{
largest = max(largest, ar[i]);
}
int *freq = new int [largest + 1]{0};
for(int i=0;i<n;i++)
freq[ar[i]]++;
int j =0;
for(int i=0;i<= largest;i... | ALGO | 0.99998 | 4.704641 |
3378dfe7-599f-4160-b49c-193305b71f3c | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_5789_0.cpp | #include <bits/stdc++.h>
using namespace std;
signed main(void) {
int judge = 0;
int road[4][4];
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
cin >> road[i][j];
}
}
for (int i = 0; i < 4; i++) {
if (road[i][0] == 1 && (road[i][3] == 1 || road[(i - 1) % 4][3] == 1))
judge... | ALGO | 0.99993 | 3.460308 |
78a677e4-2e30-428c-a7c1-3e46e8cb5127 | AdityaRaj212/AZ_practice_codes | Recursion_backtracking/all_subsequences.cpp | #include<bits/stdc++.h>
using namespace std;
int n;
int arr[100100];
vector<int> permutation;
void rec(int level){
if(level==n){
for(int i=0;i<permutation.size();i++){
cout<<permutation[i]<<" ";
}
cout<<endl;
return;
}
rec(level+1);
permutation.push_back(arr... | ALGO | 0.999965 | 4.637359 |
34aa0a5a-112f-485c-8df2-de68a0d97f54 | johannesgerer/jburkardt-cpp | pwl_interp_2d_scattered/pwl_interp_2d_scattered_prb.cpp | # include <cstdlib>
# include <iostream>
# include <iomanip>
# include <cmath>
# include <cstring>
using namespace std;
# include "pwl_interp_2d_scattered.hpp"
# include "test_interp_2d.hpp"
# include "r8lib.hpp"
int main ( );
void test01 ( );
void test02 ( );
void test03 ( int prob );
//***************************... | TEST | 0.970429 | 5.726456 |
7de7500e-a310-4640-93a5-5f314d8d389f | ketan270/GFG-160 | Search in a sorted Matrix.cpp | class Solution {
public:
// Function to search a given number in row-column sorted matrix.
bool searchMatrix(vector<vector<int>> &mat, int x) {
if(mat.empty() || mat[0].empty()){
return false;
}
int n = mat.size();
int m = mat[0].size();
int row=0;
i... | ALGO | 0.999948 | 6.029498 |
beb83d5c-d65a-4dbc-89d8-1c7c3e6cd037 | shamiul94/SMTP-Protocol-And-File-Server-Implementation-With-Java | network-offline-dvr/test/DVR_final/help.cpp | #include <iostream>
#include <fstream>
#include <string>
#include <cstring>
#include <vector>
#include <map>
#include <set>
#include <cstdio>
#include <arpa/inet.h>
#include <sys/socket.h>
#include <unistd.h>
using namespace std;
#define INFINITY 9999
//1205082
int sockfd;
int routerIpAddress;
map<int, int> updateS... | ALGO | 0.969486 | 3.764542 |
d07bc95c-56cf-49e6-ab79-f5099f134c5e | AlveyCoin/Alvey-Core | src/cpp-ethereum/libdevcore/CommonIO.cpp | #include "CommonIO.h"
#include <libdevcore/FileSystem.h>
#include <iostream>
#include <cstdlib>
#include <fstream>
#include <stdio.h>
#if defined(_WIN32)
#include <windows.h>
#else
#include <termios.h>
#endif
#include "Exceptions.h"
#include <boost/filesystem.hpp>
using namespace std;
using namespace dev;
namespace fs... | TOOL | 0.89269 | 5.882367 |
a6959b6a-7c1e-4981-8d35-e45b04dd913b | ishandutta2007/codeforces | pyqe/normal/869/E.cpp | #include <bits/stdc++.h>
using namespace std;
long long n,m,a[2569][2569],fw[2569][2569],fi,fj;
void ud(long long y,long long x,long long w)
{
for(fi=y;fi<=n;fi+=fi&-fi)
{
for(fj=x;fj<=m;fj+=fj&-fj)
{
fw[fi][fj]^=w;
}
}
}
long long qr(long long y,long long x)
{
long long z=0;
for(fi=y;fi;fi-=fi&-fi)... | ALGO | 0.999728 | 3.515062 |
930c6d11-e4a0-4272-9986-d98a53aacdc6 | shubhamtiwari158/Shopping-Application | 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.998859 | 6.785645 |
996b01bd-9e7d-4898-ad46-5a16d4c0988a | mushkul/Vanderbilt-CP | solutions/claude-3-5-sonnet-20241022/1638.cpp | #include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9+7;
int main() {
int n;
cin >> n;
vector<vector<char>> grid(n, vector<char>(n));
for(int i = 0; i < n; i++) {
for(int j = 0; j < n; j++) {
cin >> grid[i][j];
}
}
vector<vector<long long>> ... | ALGO | 0.99999 | 4.894944 |
d36894cd-4884-48e0-b20b-ccd58b0f40b4 | Arshjeet-Singh/Strivers-SDE-Sheet-Challenge | Maximum XOR With an Element From Array.cpp | #include<bits/stdc++.h>
class TrieNode{
public:
TrieNode *children[2];
};
class Trie{
TrieNode *root;
public:
Trie()
{
root=new TrieNode();
}
void insert(int n)
{
TrieNode *node=root;
for(int i=31;i>=0;i--)
{
int bit=(n>>i)&1;
i... | ALGO | 0.999923 | 5.457933 |
33bbc782-01bc-4710-bb2b-b5b1fde95a11 | Wiladams/sr | lessons/week5/app_plotbezier.cpp | #include "p5.hpp"
/*
Create a plot that shows the basis
functions for a cubic bezier curve
There are 4 separate functions
*/
typedef float REAL;
// signature for a parametric function
typedef float (*CFUNC)(float u);
// Cubic bezier basis functions
// the 'u' value ranges from 0.0 to 1.0
float BEZ03(REAL... | ALGO | 0.984783 | 5.598571 |
def2f6f2-f36f-4b61-86f5-693883821719 | Viishhnur/Auditorium-DSCPP-codes | Get starting node of CLL.cpp | #include<iostream>
#include<map>
#include "LL.cpp"
using namespace std;
/*
Using Floyds cycle detection method(slow is increased by one step and first by
2 steps) return the starting node of the loop
*/
bool isLoopPresent(Node* head){
if(head==NULL){
return false;
}
Node* slow = head;
... | ALGO | 0.999942 | 4.464863 |
7cbafe20-1ee5-4c39-8c05-e9bae4fc743b | Aditbise/Cpp-Practice | C++/prims.cpp | #include <iostream>
#define V 8
#define I 32767
using namespace std;
void PrintMST(int T[][V-2], int G[V][V]){
cout << "\nMinimum Spanning Tree Edges (w/ cost)\n" << endl;
int sum {0};
for (int i {0}; i<V-2; i++){
int c = G[T[0][i]][T[1][i]];
cout << "[" << T[0][i] << "]---[" << T[1][i] << "... | ALGO | 0.999594 | 4.573984 |
37ed76a3-4cfc-4879-bf55-236149ca9fc5 | SegFault03/LeetCode | Arrays/1351_CountNegativeNumbersinSortedMatrix.cpp | /*
Given matrix here is sorted both column and row-wise.
We can take advantage of this fact in order to calculate total number of negative numbers.
Intuition:
-> Start searching from the bottom of the matrix as that is where most negative numbers would be
-> We initally start at the bottom-left corner
-> if it is a pos... | ALGO | 0.999985 | 5.916608 |
3d0a52a1-f123-41c4-90ae-26fad4595bf1 | mosthandsomeman/LeetCode | 121.cpp | #include<bits/stdc++.h>
using namespace std;
class Solution {
public:
int maxProfit(vector<int>& prices) {
if(prices.size() <= 1) return 0;
multiset<int> vec(prices.begin(), prices.end());
int res = 0;
for(int i =0;i<prices.size()- 1;++i){
vec.erase(vec.find(prices[i]));
... | ALGO | 0.99997 | 5.536832 |
9f438410-cf3c-4b6f-84d8-033f58a23200 | Revathi-15/Leetcode-Solutions | cses/RoomAllocation.cpp | #include<bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<pair<pair<int,int>,int>> vect(n);
for(int i = 0; i < n; i++) {
int a, b;
cin >> a >> b;
vect[i].first.first = a;
vect[i].first.second = b;
vect[i].second = i;
}
sort(vect.be... | ALGO | 0.999997 | 4.725788 |
d9df6221-38ca-483c-b16f-c956d141afe7 | r-d-s-l-w/competitive-programming | CSES/Two Sets.cpp | /// Radoslaw Mysliwiec 2020
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define PB push_back
#define ALL(x) (x).begin(),(x).end()
#define endl '\n'
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vll = vector<ll>;
using pi =... | ALGO | 0.999891 | 3.392751 |
898bb4b2-6366-4e7c-9103-e4d251e91c71 | suber-IQ/C_plus_plus-Master | 03_Operators/testOperators.cpp | // 👉 Increment and Decrement
#include<iostream>
using namespace std;
int main(){
// ❓ Problem 1
// int a = 5,b;
// b=++a + a++ + ++a;
// cout << "Value of a: " << a << endl;
// cout << "Value of b: " << b << endl;
// ❓ Problem 2
int a = 10,b;
//Rules:- pre ➡️ arthematic ➡️ asign ➡️ ... | ALGO | 0.999628 | 3.854991 |
d022cae9-43d8-4e37-97f2-d6a35468e289 | akkeh/SOGM_jr3 | fin/testART/neuron.cpp | #include <iostream>
#include "neuron.h"
void Neuron::won() {
/*
notify neuron it has won
*/
update_w();
};
unsigned long Neuron::get_id() {
return id;
};
float Neuron::eval(float** x) {
y = 0;
float error = 0;
for(unsigned long m=0; m<M; ++m)
for(unsigned long n=0; n<N; ++n) {
error ... | ALGO | 0.986014 | 3.865277 |
cf77cc67-51a4-48e5-a071-1f8405f34ec7 | InnoFang/algo-set | LeetCode/0198. House Robber/solution.cpp |
class Solution {
public:
int rob(vector<int>& nums) {
int len = nums.size();
if (len == 0) return 0;
vector<int> dp(nums.size() + 1);
dp[1] = nums[0];
for (int i = 2; i <= len; ++ i) {
dp[i] = max(dp[i - 1], dp[i - 2] + nums[i - 1]);
}
return dp.... | ALGO | 0.999937 | 6.019083 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.