uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
9568b06c-4aa1-4eeb-9f7e-b7d183b08597 | shubhamnegi9/MyLeetCodeSolutions | 1435-xor-queries-of-a-subarray/xor-queries-of-a-subarray.cpp | class Solution {
public:
// Brute Force Approach
vector<int> xorQueriesBrute(vector<int>& arr, vector<vector<int>>& queries) {
vector<int> result;
for(vector<int> query: queries) {
int left = query[0];
int right = query[1];
int XOR = arr[left];
... | ALGO | 0.999964 | 6.144923 |
922e5c68-f232-4876-8f2e-b35cad25bc7b | Sarwar05/SPOJ | CAPCITY - Capital City.cpp | #include<bits/stdc++.h>
using namespace std;
#define mx 100005
int vis[mx] = {0};
vector<int> adj[mx],rev[mx];
int scc, comp[mx];
stack<int > st;
void dfs(int s)
{
vis[s] = 1;
for(int i=0; i<(int)adj[s].size(); i++){
int v = adj[s][i];
if(vis[v]==0){
dfs(v);
}
}
st.pu... | ALGO | 0.999991 | 4.235326 |
3551f5f9-97f9-41d7-a4ba-683e59a71e53 | miaomao1989/program_test | c++/mm-temp/10/10-2-2.cpp | #include <iostream>
#include <string>
#include <utility>
#include <vector>
using namespace std;
int
main()
{
pair<string,int> sipr;
string str;
int ival;
vector< pair<string, int> > pvec;
cout << "Enter a string and an integer (Ctrl-D) to end: "
<< endl;
while (cin >> str >> ival) {
sipr.first = str;
si... | TOOL | 0.966286 | 4.43939 |
660d0442-552c-4d63-9608-4402a755fa2d | im2781975/Algorithm_solved | List/Single/Intersec 2.cpp | #include <bits/stdc++.h>
using namespace std;
struct Node {
int data;
struct Node* next;
};
void printList(struct Node* node)
{
while (node != NULL) {
cout << " " << node->data;
node = node->next;
}
}
void append(struct Node** head_ref, int new_data)
{
struct Node* new_node
... | ALGO | 0.999152 | 3.133028 |
ff573570-cfc4-403c-8148-ce707bde9fab | olawills/Pix-Hub | 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.998762 | 6.786404 |
2f075d68-d518-42cd-8b34-d04661bbe8de | BarunBlog/Algorithm--Data_Structure--Structure_Programming | 06 Data Structures/stack_of_plates1.cpp | #include<bits/stdc++.h>
using namespace std;
class DinnerPlates {
vector<stack<int>>dinnerPlateStack;
set<int>popedIndexes;
int capacity;
public:
DinnerPlates(int capacity) {
this->capacity = capacity;
}
void push(int val) {
if (popedIndexes.size() > 0)... | ALGO | 0.999253 | 5.610244 |
800b2663-30c0-4cf9-ae57-f3ca6c5c30de | Amit-Kumar-Chaurasia2/week3-DSA2-CipherSchools | Lecture35.cpp | #include<bits/stdc++.h>
using namespace std;
//! 0/1 Knapsack
//* Memoisation
#include <bits/stdc++.h>
int f(vector<int>&weight, vector<int> &value, int ind, int maxWeight, vector<vector<int>>&dp){
if(ind == 0){
if(weight[0] <= maxWeight){
return value[0];
}
return 0;
}
if(dp[ind][maxWeight] != -1){
... | ALGO | 0.999999 | 5.527841 |
9be8e4a0-855b-44fa-9bef-8234b596f13e | dxhisboy/lammps-sunway | USER-REAXC/pair_reaxc.cpp | /* ----------------------------------------------------------------------
Contributing author: Hasan Metin Aktulga, Purdue University
(now at Lawrence Berkeley National Laboratory, <EMAIL>)
Per-atom energy/virial added by Ray Shan (Sandia)
Fix reax/c/bonds and fix reax/c/species for pair_style reax/c added ... | TOOL | 0.938388 | 6.704831 |
7bba750b-1306-488a-bcb5-71943228f5ae | akhillak/B-Plus-Tree-DB | B+ Tree.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <fstream>
#include <string>
//#include <filesystem>
#include "B+ Tree.h"
#define _CRT_SECURE_NO_DEPRECATE //for VS 2019
void insertionMethod(BPTree** bPTree) {
int rollNo;
int age, marks;
string name;
cout << "Please provide the rol... | ALGO | 0.988374 | 3.056814 |
0ed779f6-ac17-4ee0-8b2f-820f1f418891 | trungdangtapcode/Competitive-Programming-Notebook | archived/school_laptop_02092023/ITMO_ST4_B.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
int n, m;
ll p;
struct mat{
ll a[2][2] = {{0,0},{0,0}};
mat operator*(mat b){
mat res;
res.a[0][0] = (a[0][0]*b.a[0][0]+a[0][1]*b.a[1][0])%p;
res.a[0][1] = (a[0][0]*b.a[0][1]+a[0][1]*b.a[1][1])%p;
res.a[1][0] = (a[1][0]*b.a[0][0]+a[1][1]*b.a[... | ALGO | 0.999968 | 4.348572 |
dad42a69-86f2-48e8-9c0c-bae612dd1b60 | Sanviiiii/DSA | Basic Math/Count-Digits.cpp | /*Given a positive integer n, count the number of digits in n that divide n evenly (i.e., without leaving a remainder). Return the total number of such digits.
A digit d of n divides n evenly if the remainder when n is divided by d is 0 (n % d == 0).
Digits of n should be checked individually. If a digit is 0, it shou... | ALGO | 0.999807 | 6.044494 |
f93a053e-92a0-4c38-92ea-7fe76081cb29 | Mattya1/Informatica | IP/PARTE13/fibonacci.cpp | #include <iostream>
using namespace std;
unsigned fibonacci (unsigned num)
{
if (num == 0 || num ==1){return 1;}
return fibonacci(num-1)+fibonacci(num-2);
}
int main ()
{
unsigned n;
cout <<"Inserisci un numero: ";
cin >> n;
cout << "\nIl risultato e' " << fibonacci(n)<<endl;
return 0;
} | ALGO | 0.999785 | 4.756039 |
ba52f534-b4af-4f3c-88f8-1a330f073674 | HyunSeokki/Problem-Solving | BOJ/2565.cpp | #include <stdio.h>
#include <string.h>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;
struct st
{
int a, b;
};
bool cmp(st a, st b)
{
if (a.a < b.a)
return true;
return false;
}
vector <int> v;
st s[501];
int n;
int main()
{
scanf("%d", &n);
for (int i = 0; i < n; i++)
{
sc... | ALGO | 0.999901 | 3.85523 |
bbedc81e-1bee-46df-a581-3160b5408c3b | cmangos/mangos-cata | src/game/Maps/ObjectPosSelector.cpp | #include "Maps/ObjectPosSelector.h"
#include "Entities/Object.h"
// The bigger this value, the more space npcs require around their target
#define OCCUPY_POS_ANGLE_ATAN_FACTOR 1.8f
ObjectPosSelector::ObjectPosSelector(float x, float y, float dist, float searchedForSize, WorldObject const* searchP... | ALGO | 0.967214 | 7.296613 |
a5e55c49-1855-4aa6-bea5-42f50dad3e23 | yashdubey369/DSA | Codeforces/A_Two_Groups.cpp | #include<bits/stdc++.h>
using namespace std;
#define int long long int
signed main(){
int t;
cin>>t;
while(t--){
int n,sum=0,x;
cin>>n;
for(int i=0;i<n;i++){
cin>>x;
sum+=x;
}
cout<<abs(sum)<<endl;
}
} | ALGO | 0.999605 | 3.71858 |
b49e01f1-cb58-4c45-8d3f-e211765978f4 | fThAbhishek-Pandey/Data-Structure-And-Algorithm | Graph/adjacencyList.cpp | #include <iostream>
#include<vector>
#include<list>
using namespace std ;
vector<list<int>> adjListGph;
void add (int src, int dest, bool isUnDirected = true){
adjListGph[src].push_back(dest);
if (isUnDirected) adjListGph[dest].push_back(src);
return;
}
void display (){
for (int i=0;i<adjListGph.siz... | ALGO | 0.999896 | 4.927235 |
dc241bd9-b9f1-45b4-83be-a551dde82278 | Neimat1/Codeforces | 546A.cpp | #include <iostream>
using namespace std;
int main() {
int w,k,n,cost=0;
cin>>k>>n>>w;
for(int i=1;i<=w;i++){
cost+=i*k;
}
if(cost>n)
cout<<cost-n<<endl;
else
cout<<0<<endl;
return 0;
}
| ALGO | 0.99992 | 3.207949 |
cdbccbe2-55d2-44bb-a46e-5e9af25355ef | Gypst/RDA_C | Структура Данных/Lab3-Stack+Queue/QueueMenu.cpp | #include "QueueMenu.h"
void ShowQueue(Queue* queue)
{
for (int i = 0; i < queue->BufferSize; i++)
{
if (queue->Items - i > 0)
{
cout << *(queue->Buffer + i) << '\t';
}
else
{
cout << "X \t";
}
}
cout << endl;
}
void QueueMenu()
{
Queue queue;
queue.BufferSize = QueueSize;
queue.Buffer = new ... | TOOL | 0.894333 | 4.328799 |
fe2e9615-b1f6-4ac0-a5e6-439a22f943f8 | MdSourovAhmed/CP-Online-Judge | UVA/Uva_10391.cpp | #include <bits/stdc++.h>
using namespace std;
int Min(int a, int b) { return (a > b) ? b : a; }
int main()
{
string s;
unordered_map<string, int> m;
vector<string>v;
int l = INT_MAX;
while (cin >> s)
{
// if(s=="#")break;
m[s]=1;
l = Min(l, s.size());
v.push_back(... | ALGO | 0.999622 | 3.636335 |
e226418a-7b63-4098-bee0-66bd62532fa7 | bensonlzl/spaced-kmer-sketching | src/kmers.cpp | /**
* @file kmers.cpp
* @author your name (<EMAIL>)
* @brief
* @date 2024-07-04
*
* @copyright Copyright (c) 2024
*
*/
#include "kmer.hpp"
constexpr int KMERS_DEBUG = DEBUG | 0;
// TO DO: Support spaced seeds
// Currently only supports palindromic masks
kmer reverse_complement(kmer k)
{
kmer_bitset rc_bit... | ALGO | 0.988605 | 6.050693 |
96043742-1864-4ed7-9c19-fb298b614bef | KhalidUsman2024/Programming-Fundamentals-In-C-Plus-Plus | 4 Patterns/6 printing perpendicular pattern.cpp | #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<=n; j++)
{
cout<<i<<" ";
}
cout<<endl;
}
}
| ALGO | 0.998805 | 3.533692 |
b20305cc-764b-4d65-be3a-641d4c37864d | i-X-ce/competitive-programming | ABC/389C.cpp | /*
g++ XXX.cpp
./a.out
*/
#include <bits/stdc++.h>
using namespace std;
struct Snake
{
long long x, l;
};
int main() {
long long q; cin >> q;
vector<Snake>snakes(0);
long long si = 0;
long long def = 0;
for (long long i=0;i<q;i++){
int query; cin >> query;
if (query == 1){
long long l; cin >... | ALGO | 0.999108 | 3.535924 |
8a930f19-62f3-4d1c-b785-12296a08a22c | nexus-x86/cp-solutions | completed/usaco19febb3.cpp | // http://www.usaco.org/index.php?page=viewproblem2&cpid=917
// https://github.com/nexus-x86/cp-solutions
// Sunday December 4 2022
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
using namespace std;
void setIO(string s) {
freopen((s + ".in").c_str(), "r", stdin);
freopen((s + ".out")... | ALGO | 0.999336 | 4.659189 |
74727550-8847-4d3d-b66c-1faf405fce36 | haiderkumail/PROGRAMMING-FUNDAMENTALS | week 07 pd/task9.cpp | #include <iostream>
using namespace std;
void printShape(int number);
main()
{
int number;
cout << "enter the number of rows:";
cin >> number;
printShape(number);
}
void printShape(int number)
{
char asteric = '*';
for (int i = 1; i <= number; i++)
{
for (int j = 1; j <= i; j++)
... | ALGO | 0.992257 | 4.380223 |
c4ab6a7e-c880-4730-baa3-f21c703147aa | wrobel546/Rownolegle-CUDA | source/openMP.cpp | #include <iostream>
#include <vector>
#include <random>
#include <chrono>
#include <algorithm>
#include <fstream>
#include <cmath>
#include <climits>
#include <sstream>
#include <filesystem>
#include <iomanip>
#include <omp.h>
using namespace std;
namespace fs = std::filesystem;
struct City {
int id;
double x... | ALGO | 0.999987 | 6.187149 |
baccc93f-728a-432d-b5aa-68114e2a5304 | ktada42/cpp09 | ex02/MaxValuedPair.cpp | #include "MaxValuedPair.hpp"
namespace mergeInsertByVector{
template<>
MaxValuedPair<int>::MaxValuedPair(int val) : largeVal(val)
{
vals.push_back(val);
}
};
namespace mergeInsertByList{
template<>
MaxValuedPair<int>::MaxValuedPair(int val) : largeVal(val)
{
vals.push_back(val);
}
}; | ALGO | 0.996112 | 4.86168 |
97bc5e3f-c526-4866-ad04-5ee604e3957c | Chayoso/Lava-Wax-Simulation- | example_elastoplastic/verifications/MPMExampleCooksMembrane.cpp | #include "MPMExampleCooksMembrane.h"
/*
./MPM --example 1044 --no_restart -N 32 --implicit 1 --max_dt 1e-3 --min_dt 1e-6 --final_frame 100 -E 240e2 --nu 0.4999
Comparing setup cmd line:
./MPM --example 1044 --no_restart -N 32 --implicit 1 --max_dt 1e-3 --min_dt 1e-6 --final_frame 1000 -E 5000 --pto -g 0
*/
TGS... | ALGO | 0.919629 | 5.735142 |
de4acffc-347c-4579-8e41-a9bb9af7eb30 | evanmozumder/cp | cp_solution/abc075_b.cpp | #include<bits/stdc++.h>
#define ll long long int
using namespace std;
void solve() {
int h,w;
cin>>h>>w;
string c[h];
for(int i=0;i<h;++i){
cin>>c[i];
}
for(int i=0;i<h;++i){
for(int j=0;j<w;++j){
if(c[i][j]=='.'){
int a=0,k=i-1,l=j-1,kr=i+2,lc=j+2;
if(i==0)
k=i;
if(j==0)
l=j;
i... | ALGO | 0.999962 | 3.781016 |
3d877dc6-54fb-4c7f-a5ec-7d19cbfe2631 | matheusosp/activities-in-C | Vetores/Ex.2.cpp | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//2 - Calcule a mdia das notas de 10 alunos de uma disciplina e determine o nmero de alunos que tiveram nota superior a mdia calculada/////
/////////////////////////////////////... | ALGO | 0.987149 | 3.581248 |
382c10b7-39d8-4c44-98d3-a22499ce2dc7 | PaukIsUha/optimizing_formating_code | predictions/submissions-aizu-cot-gpt35/Codenet/p00726/110091662/response_8.cpp | #include <iostream>
#include <vector>
using namespace std;
int N;
void dfs(const string& s, int start, int end, vector<char>& result) {
int i = start;
long long n = -1;
while (i < end) {
if ('0' <= s[i] && s[i] <= '9') {
if (n < 0)
n = s[i] - '0';
else
n = n * 10 + s[i] - '0';... | ALGO | 0.999894 | 4.715249 |
f2e0a4e2-9946-4a2a-b9ba-402b5f42a649 | AswinSaathappan/CPP | arr1.cpp | #include <iostream>
using namespace std;
int main() {
int VAL[50];
for (int i = 0; i < 25; ++i) {
VAL[i] = i * i; // Square of the index variable for the first 25 components
VAL[i + 25] = 3 * (i+25); // Three times the index variable for the last 25 components
}
// Output using t... | ALGO | 0.997927 | 4.205326 |
ff6aa245-b233-4ac3-a25c-bec984da5991 | harsh-panchal-804/LeetCode-Solutions | Water Bottles.cpp | class Solution {
public:
int numWaterBottles(int a, int b) {
return a+ (a-1)/(b-1) ;
}
}; | ALGO | 0.998934 | 4.933882 |
3e36db3d-ef55-4682-9b3c-dd9dfc288d6e | cielavenir/procon | tyama_icpc2010dE(TJU3789-aizu1169).cpp | #include <iostream>
#include <map>
#include <set>
#include <vector>
#include <string>
#include <algorithm>
#include <cstring>
using namespace std;
typedef pair<string,int> P;
map<int,vector<P> >arr;
int N,S,G;
void bfs(){
set<P>q;
q.insert(make_pair("",S));
for(;!q.empty();){
P p=*q.begin();q.erase(q.begin());
... | ALGO | 0.999848 | 3.738069 |
f34e9305-2332-4684-a650-0bf47187396f | dhrubajyotinath6/LEETCODE-QUESTIONS | 0740-delete-and-earn/0740-delete-and-earn.cpp | class Solution {
public:
//0 0 4 9 4
int findMaxSteal(vector<int> &wealth) {
if (wealth.empty()) {
return 0;
}
int n1 = 0, n2 = wealth[0], temp;
for (int i = 1; i < wealth.size(); i++) {
temp = max(n1 + wealth[i], n2);
n1 = n2;
n... | ALGO | 0.999649 | 5.520678 |
655bbc78-c9dc-4878-b7fa-649b82cde714 | phanan04/Code-PTIT | SPOJ PTIT/P148PROA.cpp | // https://www.spoj.com/PTIT/problems/P148PROA/
// P148PROA - ROUND 8A - Dãy số Hailstone
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
while (cin >> n)
{
if (n == 0)
break;
stack<int> st;
st.push(n);
while (st.top() != 1)
{
... | ALGO | 0.999979 | 5.210753 |
0612c577-a8d6-4869-8e62-a3d8e2add593 | cran/mlpack | inst/include/mlpack/methods/sparse_coding/sparse_coding_main.cpp | /**
* @file methods/sparse_coding/sparse_coding_main.cpp
* @author Nishant Mehta
*
* Executable for Sparse Coding.
*
* mlpack is free software; you may redistribute it and/or modify it under the
* terms of the 3-clause BSD license. You should have received a copy of the
* 3-clause BSD license along with mlpack... | DATA | 0.9904 | 6.763768 |
1ce9d60e-3913-4eaf-85ed-2b8629b5af23 | SKIRT/SKIRT7 | SKIRTcore/FoamMatrix.cpp | /*//////////////////////////////////////////////////////////////////
//// SKIRT -- an advanced radiative transfer code ////
//// © Astronomical Observatory, Ghent University ////
///////////////////////////////////////////////////////////////// */
#include <cmath>
#include "FoamMatrix.hpp"
... | ALGO | 0.999928 | 5.080669 |
727a71c1-337b-40aa-a07d-7f603834ca1f | raincross7/code-similarity | codes/train_code/problem217/problem217_55.cpp | // Created by ...Lusifer
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define prior priority_queue
#define MOD 1000000007
#define INF64 (long long)1e18
#define INF (int)1e9
#define PI 3.1415926535897932384626433832795
#define ll long long
#define ld long dou... | ALGO | 0.999967 | 4.363641 |
d02a5b7d-f9ab-4f13-9600-497e662ef377 | skhameedoutlook/llvm-seperate | parallel-libs/acxxel/examples/opencl_example.cpp | #include "acxxel.h"
#include <array>
#include <cstdio>
#include <cstring>
static const char *SaxpyKernelSource = R"(
__kernel void saxpyKernel(float A, __global float *X, __global float *Y, int N) {
int I = get_global_id(0);
if (I < N)
X[I] = A * X[I] + Y[I];
}
)";
template <size_t N>
void saxpy(float A, std... | ALGO | 0.974485 | 5.3781 |
cc215bb0-440d-4bc3-b454-221b0ebcc180 | ishandutta2007/codeforces | vladprog/normal/1176/E.cpp | #pragma GCC optimize("O3")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/rope>
#ifndef ONLINE_JUDGE
//#define DEBUG
#endif
#ifdef DEBUG
#define IFD(...) __VA_ARGS__
#define IFN(...)
#define L cout<<__LINE__<<"\n";
#define PRINT(...) __VA_ARGS__ cout<<__LINE__<<" :... | ALGO | 0.999917 | 4.520015 |
db049b00-c199-433d-a6fe-6dae3b88fb18 | DengH293/LinNet | libs/pointops2/src/attention_v2/attention_cuda_v2.cpp | #include <vector>
#include <torch/serialize/tensor.h>
#include <ATen/cuda/CUDAContext.h>
#include "attention_cuda_kernel_v2.h"
void attention_step1_forward_cuda_v2(int N, int M, int h, int C, const unsigned int n_max, at::Tensor q_tensor, at::Tensor k_tensor,
at::Tensor index0_tensor_offsets, at::Tensor index1_te... | DATA | 0.993361 | 4.367415 |
df2dbe3d-5937-4a7a-adbc-38e63e3a5ac3 | TheGeekiestOne/Coursera-Data-Structures-and-Algorithms-Specialization | Course 3 - Algorithms on Graphs/week3_paths1/1_bfs/bfs.cpp | #include <iostream>
#include <queue>
#include <vector>
class Graph {
std::vector<std::vector<int>> adj;
public:
Graph(int n) : adj(n, std::vector<int>()) {}
void add_edges(const int m) {
for (int j = 0; j < m; ++j) {
int s, t;
std::cin >> s >> t;
// we use 0 ... | ALGO | 0.999956 | 5.429816 |
092fbc6a-12a0-4b13-8aa5-1e3546ef88c7 | SarathAdhi/code_chef_codes | Reverse_Me.cpp | #include <iostream>
using namespace std;
int main()
{
int n;
cin >> n;
int arr[n];
for (int i = 0; i < n; i++)
{
cin >> arr[i];
}
while(n!=0)
{
cout << arr[n-1] << " ";
n--;
}
return 0;
} | ALGO | 0.999783 | 3.671813 |
1ba120a5-af29-4863-b653-4931f25a5c0b | PixysOS-Beta/frameworks_av | media/codecs/amrnb/enc/src/p_ol_wgh.cpp | /*
------------------------------------------------------------------------------
Pathname: ./audio/gsm-amr/c/src/p_ol_wgh.c
Funtions: p_ol_wgh_init
p_ol_wgh_reset
p_ol_wgh_exit
Lag_max
Pitch_ol_wgh
Date: 02/05/2002
---------------------------------------------------... | ALGO | 0.996438 | 3.601306 |
002fa08a-5838-4b1d-9b3e-67be9257235d | cppexamples/buildingannfa | nfa.cpp | #include "nfa.hpp"
#include <stack>
template <typename T>
auto pop_value(T &stack)
{
auto v = std::move(stack.top());
stack.pop();
return v;
}
TNFA::TNFA(std::string regexp) : G{regexp.length()}, re{regexp.c_str()}, M{regexp.length()}
{
std::stack<int> ops; // operation stack
for (int i = 0; i < M;... | ALGO | 0.97145 | 4.281686 |
0046d11a-67e7-48ed-9f0c-060bea11b89c | LILKOTYO/SimulationFramework | SimuFramework/libigl/python/py_igl/py_dqs.cpp | m.def("dqs", []
(
const Eigen::MatrixXd& V,
const Eigen::MatrixXd& W,
const RotationList& vQ,
const std::vector<Eigen::MatrixXd> & vT,
Eigen::MatrixXd& U
)
{
std::vector<Eigen::Vector3d> vTv;
for (auto item : vT) {
assert_is_Vector3("item", item);
Eigen::Vector3d obj = Eigen::Vector3d(item);
v... | TOOL | 0.991326 | 6.04154 |
203064ff-fbfd-4d84-a98a-f14402f83d00 | raincross7/code-similarity | codes/train_code/problem029/problem029_406.cpp | #include<iostream>
#include<vector>
#include<limits.h>
#include<queue>
#include<string>
using namespace std;
int main(){
int n,i,j;
cin >> n;
bool A[n][n];
for (i=0;i<n;i++){
for (j=0;j<n;j++){
A[i][j]=0;
}
}
for (i=0;i<n;i++){
int id,deg,dam;
cin >> id >> deg;
for (j=0;j<deg;j++){
cin >> dam... | ALGO | 0.999882 | 3.418496 |
e212a72f-d2bc-4792-b69b-dc02d31274dd | waingram/code-embeddings | test_data/C++/Binary-digits/binary-digits-5.cpp | #include <iostream>
std::string binary(int n) {
return n == 0 ? "" : binary(n >> 1) + std::to_string(n & 1);
}
int main(int argc, char* argv[]) {
for (int i = 1; i < argc; ++i) {
std::cout << binary(std::stoi(argv[i])) << std::endl;
}
}
| ALGO | 0.999733 | 6.345023 |
19ffdd41-2f21-4f80-8205-8049c56ae364 | hirakuuuu/kyopro | ABC/342/abc342_d.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i, a, n) for(int i = a; i < n; i++)
#define rrep(i, a, n) for(int i = a; i >= n; i--)
#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
// constexpr ll MOD = 1000000007;
constexpr ll MOD = 998244353;
constexpr int IINF = 1001001001;
conste... | ALGO | 0.999791 | 5.176102 |
efaf08ba-3b68-4754-b3b2-ee50f6b6476b | lilulab/particle_filter_IWAMP | src/imageSimilarity_modified.cpp | #include "imageSimilarity.h"
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <iostream>
#include <fstream>
#include <sstream>
#include <string.h>
#include <stdio.h>
#include <iomanip>
#include <locale>
#include <cmath>
#include <math.h>
#include <ros/ros.h>
#include "constants.h"
... | ALGO | 0.997269 | 5.189656 |
65453197-3e00-4b4b-838b-ffc40e8a08f5 | kunalkhr001/DS-Algo | hashmap/main.cpp | #include <iostream>
#include<map>
#include<vector>
using namespace std;
void printIntersection(int *arr1,int m,int *arr2,int n)
{
map<int ,int> map;
for(int i=0;i<m;i++)
{
if(!map.count(arr1[i]))
{
map[arr1[i]]=1;
}
else
{
int oldFreq=map[arr... | ALGO | 0.999617 | 3.81711 |
31c2bbc5-c15f-48c0-8b9a-e768cd0b257c | masayoshi64/library | library/graph/distance/multi_source_dijkstra.cpp | #pragma once
/**
* @brief multi-source dijkstra
* @docs docs/multi_source_dijkstra.md
*/
template <typename T>
vector<T> multi_source_dijkstra(Graph<T> &g, vector<int> &s) {
const auto Inf = numeric_limits<T>::max();
vector<T> dist(g.size(), Inf);
using Pi = pair<T, int>;
priority_queue<Pi, vector<P... | ALGO | 0.999814 | 4.535305 |
e0d0b5ce-6cc3-4848-978f-583b1adddb92 | jz769491062/Leetcode_Self | Code/BinaryTree/701. 二叉搜索树中的插入操作.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.999969 | 6.333046 |
b9604213-44fc-45fa-9417-78a4345fe7cd | Kumawatlalit912/CSES-SOLUTION | CSES-Solutions/Range Queries/Range Xor Queries.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxN = 2e5;
int N, Q, a, b;
ll x[maxN+1];
int main(){
scanf("%d %d", &N, &Q);
for(int i = 1; i <= N; i++){
scanf("%lld", &x[i]);
x[i] ^= x[i-1];
}
for(int q = 0; q < Q; q++){
scanf("%d %d", &a, &b);
... | ALGO | 0.999946 | 4.358033 |
ebee6e78-873e-43ec-9291-f4545d94b368 | ishandutta2007/codeforces | kraskevich/normal/500/F.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 4000 + 10;
const int Q = 20000 + 10;
struct Item {
int t;
int cost;
int h;
Item(): t(0) ,cost(0), h(0) {}
Item(int t): t(t), cost(0), h(0) {}
bool operator<(const Item& i) const {
return t < i.t;
}
};
Item items[N];
int dpL[N][N]... | ALGO | 0.99986 | 3.336486 |
57083fd4-f2e7-4af9-a6cf-0bff6af3c78d | lujiazho/LeetCode-Record | LeetCode/211-design-add-and-search-words-data-structure.cpp | ///////////////////////////////////////////////////////////////////////////////////////////////
// it's hard to implement original trie on leetcode with c++, so here is another kind of trie
////////////////
// Time Complexity: O(n), the estimated time complexity is larger than that of original trie
// Space Complexity:... | ALGO | 0.999613 | 6.083102 |
0d29f2c7-2841-4902-a958-ed02baccdf6d | MPSLab-ASU/CCF-20.04 | llvm-project/llvm/lib/Analysis/LegacyDivergenceAnalysis.cpp | #include "llvm/Analysis/LegacyDivergenceAnalysis.h"
#include "llvm/ADT/PostOrderIterator.h"
#include "llvm/Analysis/CFG.h"
#include "llvm/Analysis/DivergenceAnalysis.h"
#include "llvm/Analysis/Passes.h"
#include "llvm/Analysis/PostDominators.h"
#include "llvm/Analysis/TargetTransformInfo.h"
#include "llvm/IR/Dominators... | ALGO | 0.916707 | 7.909177 |
2103d14a-0833-435b-a397-3c32ccd4fdad | QTune1603/DSA_PTIT | GiaiMaXauKyTu.cpp | #include <bits/stdc++.h>
using namespace std;
void testCase() {
string s; cin >> s;
stack<string> st1;
stack<int> st2;
for (int i = 0; i < s.length(); ++i) {
if (s[i] >= '0' && s[i] <= '9') {
int num = 0;
while (i < s.length() && s[i] >= '0' && s[i] <= '9') {
... | ALGO | 0.99828 | 5.129363 |
49092ef9-fff0-41f0-a4f5-e01ae6ba423b | buskina/buskina-mipt-c | Lab 0/Problem 2/main.cpp | #include <iostream>
#include <math.h>
uint64_t dignum(uint64_t n)
{
uint64_t dignum;
dignum = 0;
for (uint64_t i = 1; i<=n; i=i*10)
{
dignum++;
}
return dignum;
}
int main()
{
uint64_t n, dig, i;
std::cin>>n;
dig = dignum(n);
uint64_t*mas = new uint64_t[dig];
for (i... | ALGO | 0.999647 | 4.795644 |
d6659b63-9061-410e-862b-3d1a57144482 | duyhuynh99/DSA | Lab3/Lab_3_3.cpp | #include <iostream>
using namespace std;
template <class T>
class Sorting {
public:
static void printArray(T *start, T *end) {
int count = end - start;
for (int i = 0; i < count - 1; i++) {
cout << start[i] << ", ";
}
cout << start[count - 1];
cout << endl;
}
static void oddEvenSort(T *start, T *end) ... | ALGO | 0.999354 | 4.82746 |
d34b5d75-7e41-439d-bb7c-b8b86b9f2b00 | upesacm/21DaysOfCode-2023 | C&C++/Arshdeep Kaur/Day3_2.cpp | #include <iostream>
#include <cmath>
using namespace std;
int main() {
int num;
cout << "Enter the number: ";
cin >> num;
float ans = log(num);
cout << "The logarithm value (base-e) of " << num << " is: " << ans << endl;
return 0;
}
| ALGO | 0.983441 | 3.789077 |
7cc9d9fa-99a1-4195-a93b-c61d80c1d781 | Ayush242/CodeWars | 8kyu/What is between?.cpp | // Complete the function that takes two integers (a, b, where a < b) and return an array of all integers between the input parameters, including them.
// For example:
// a = 1
// b = 4
// --> [1, 2, 3, 4]
#include <vector>
std::vector<int> between(int start, int end) {
// your code here
int diff = end - start + 1;... | ALGO | 0.974255 | 5.0003 |
6cc4c3b5-5ec4-4bee-9eea-14714bae11c1 | larryswang/leetcode_cpp | robatree.cpp | Solution {
public:
int tryRob(TreeNode* root, int& l, int& r){
if(root ==NULL) return 0;
int ll=0, lr=0, rl=0, rr=0;
l=tryRob(root->left, ll, lr);
r=tryRob(root->right, rl, rr);
return max(root->val + ll+ lr+ rl+ rr, l+r);
}
int rob(TreeNode* root) {
int left,... | ALGO | 0.999992 | 6.305144 |
ecd8d130-e5bd-4626-965f-4aeb9705b9b4 | KMJAE/backjoon | 10871.cpp | #include <iostream>
using namespace std;
int main(void){
int n,x;
cin >> n >> x;
int arr[10001];
for(int i = 0; i < n; i++){
cin >> arr[i];
}
for(int j = 0; j < n; j++){
if(arr[j] < x){cout << arr[j] << " ";}
}
cout << endl;
} | ALGO | 0.999971 | 3.310046 |
c8e62e28-ddfd-42c6-930a-98c62eaa9c4a | ndhoward/cs226-ivan-nathan | eigen/bench/vdw_new.cpp | #include <Eigen/Array>
USING_PART_OF_NAMESPACE_EIGEN
#ifndef SCALAR
#define SCALAR float
#endif
#ifndef SIZE
#define SIZE 10000
#endif
#ifndef REPEAT
#define REPEAT 10000
#endif
typedef Matrix<SCALAR, Eigen::Dynamic, 1> Vec;
using namespace std;
SCALAR E_VDW(const Vec &interactions1, const Vec &interactions2)
{
... | ALGO | 0.999775 | 3.58702 |
2cce76ea-a447-4086-a713-b6a79d6e5036 | jayjaisswal/Data-Structure | DSA Using cpp/String part 2/8maxStringArray.cpp | #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
using namespace std;
int main()
{
string arr[] = {"0123", "0023", "456", "00182", "940", "002901"};
int max = stoi(arr[0]);
string maxS = arr[0];
for (int i = 1; i <= 5; i++)
{
int x = stoi(arr[i... | ALGO | 0.999216 | 4.004229 |
4a55d6b7-d5da-4ab9-9656-7c3a012f6eae | AniketShukla2022/DailyProgramming | Min Avg of Smallest and Largest Elements.cpp | class Solution {
public:
double minimumAverage(vector<int>& nums) {
sort(nums.begin(),nums.end());
int n = nums.size();
double minAvg = INT_MAX;
int i = 0;
int j = 0;
while(i != n/2)
{
double avg =(double) (nums[j]+nums[n-j-1])/2;
if (a... | ALGO | 0.99991 | 6.327727 |
57912721-864d-4f06-b05a-826c1b45ccc4 | ishandutta2007/codeforces | demoralizer/normal/1381/A2.cpp | #include "bits/stdc++.h"
using namespace std;
#define int long long
#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define all(x) (x).begin(),(x).end()
#define uniq(v) (v).erase(unique(all... | ALGO | 0.999998 | 4.698931 |
5eda6dfc-90e0-4c90-9ec2-9723bfbb0a05 | TehWeifu/SMR | Programacion/1st Quarter/Ej 23 - 25/Actividad 24 - Julian.cpp | #include <iostream>
int main() {
unsigned short num;
std::cout << "introduce un numero): ";
std::cin >> num;
while (num >= 0 && num <= 10) std::cout << num++ << std::endl;
return 0;
} | TOOL | 0.966079 | 3.675087 |
2b06fe8d-dc95-407f-84d0-5095f14aa555 | AnteDev00/Machine-Learning-NN | src/NN.cpp | #include <iostream>
#include <vector>
#include "NN.h"
#include "NN_Utils.h"
double Forward(const Model& model, const double& inpBit1, const double& inpBit2)
{
//input layer
double outOr = Sigmoid(model.neurons[0].P1 * inpBit1 + model.neurons[0].P2 * inpBit2 + model.neurons[0].B); // First neuron
double ou... | ALGO | 0.999403 | 5.353445 |
5b6bc50d-9c9e-41e1-b5db-4c7632c04ad3 | akommula/CompetitiveProgramming | USACO/cpp/birds.cpp | #include <iostream>
#include <fstream>
#define MAX_N 1005
#define MAX_B 10005
using namespace std;
//DP[i][j]: i = tree, j = birds accumulated, DP[i][j] = mana_left;
int DP[MAX_N][MAX_B];
int birds[MAX_N], cost[MAX_N];
int N, W, B, X;
int main() {
ifstream fin ("birds.in");
ofstream fout ("birds.out");
... | ALGO | 0.9999 | 3.595052 |
27386719-aff0-4542-8e61-0cbb20d7ba3e | hdome/Prog2 | distance_learning/ziv_lempel_welch/z3a17_from_scratch.cpp | /*
Version history
z3a17
https://www.twitch.tv/videos/569832719
https://youtu.be/_mu54BDkqiQ
z3a18
https://www.twitch.tv/videos/570721110
https://youtu.be/QBD3zh5OJ0Y
z3a18qa
https://youtu.be/fvKYgMnu1z4
z3a18qa2
https://www.twitch.tv/videos/578115999
https://youtu.be/qoVNeSoHwXw
*/
#in... | ALGO | 0.998528 | 4.952193 |
809ec472-3768-443f-bbe0-a477df3b984b | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_10062_3.cpp | #include <bits/stdc++.h>
using namespace std;
vector<int> v[200100];
queue<int> zero;
queue<int> one;
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
string s;
cin >> s;
int cont = 0;
int zi = 0;
bool ok = true;
for (auto &x : s) {
zi++;
if (x == '0') {
if (one.e... | ALGO | 0.999489 | 3.810436 |
c2ba060f-b646-4414-b8a6-df00dc0a52cf | elixered/leetcode | 405-convert-a-number-to-hexadecimal/405-convert-a-number-to-hexadecimal.cpp | class Solution {
public:
string toHex(int num) {
unsigned int x = num;
string s;
string hex = "0123456789abcdef";
do{
int r = x%16;
s += hex[r];
x /= 16;
}while(x>0);
return string(s.rbegin(),s.rend());
}
}; | ALGO | 0.999661 | 6.070481 |
16e5acfb-71b4-40aa-bd14-0cfb94f4c4d9 | KozakNazar/cw_sp2__2024_2025 | cw_sp2__2024_2025/src/implementation/generator/and.cpp | #define _CRT_SECURE_NO_WARNINGS
/************************************************************
* N.Kozak // Lviv'2024-2025 // cw_sp2__2024_2025 *
* file: and.cpp *
* (draft!) *
****************************************... | ALGO | 0.983579 | 3.510941 |
b519ba7a-eb1a-4a7c-aa75-c86554a077c2 | mamarezatajik/Competitive-Programming | Codeforces/2050/C.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
mt19937_64 rng((unsigned ll) chrono::steady_clock::now().time_since_epoch().count());
#define F first
#define S second
#define len(a) ... | ALGO | 0.999664 | 4.902449 |
7b858372-4cf5-4976-8d03-e5f2c28e80ac | msgeden/llvm-project | libc/src/math/fabs.cpp | #include "src/__support/common.h"
#include "utils/FPUtil/BasicOperations.h"
namespace __llvm_libc {
double LLVM_LIBC_ENTRYPOINT(fabs)(double x) { return fputil::abs(x); }
} // namespace __llvm_libc
| TOOL | 0.939687 | 6.067063 |
d880cea4-affb-434d-904f-07044b4f755a | Ezeldeen-Saeed/Data-Structures-Implementations | Queue/Linked-List-Based-implementation/CPP/linkedList.cpp | #include <iostream>
using namespace std;
class linkedListNode {
public:
int data;
linkedListNode *next;
linkedListNode(int _data) {
this->data = _data;
this->next = NULL;
}
};
class linkedListIterator {
private:
linkedListNode *currentNode;
public:
linkedListIterator() { curre... | ALGO | 0.998904 | 5.078365 |
bb0df63a-b57b-4021-b0c4-caf1de45190f | mmatrosov/FKN2020 | preliminary/F/33917382.cpp | #include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
using namespace std;
const int N = 105;
int main() {
ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
int n, k;
cin >> n >> k;
vector<ll> a(n + 1);
a[0] = 0;
for (int i = 0; i < n; ++i) {
cin >> a[i + 1];
... | ALGO | 0.999997 | 3.069833 |
a5a0dd4d-4a21-4b8b-bb87-fc1377b9d015 | arifin191/190041201-CSE-4302 | Lab 13/201 Task1.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int arr[5];
int j=0;
set <int> st;
for(int i=0;i<10;i++)
{
if(i%2) st.insert(i);
else {
arr[j]=i;
j++;
}
}
vector <int> v(10);
merge(arr, arr+5, st.begin(), st.end(), v.begin());
... | ALGO | 0.999071 | 3.067493 |
0eeab43e-b5f1-4571-81f4-f4b3fa9a55d5 | ishandutta2007/codeforces | zeliboba/normal/238/A.cpp | #include <cstdio>
#include <cstdlib>
#include <cassert>
#include <iostream>
#include <set>
#include <vector>
#include <cstring>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <complex>
#include <map>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<l... | ALGO | 0.999986 | 4.593095 |
c235b199-b465-4dca-9bfd-f44ab8a2a66d | Akshatgupta000/DSA | c++ college wallah/Lecture33_recursionArrays/maxrecursive.cpp | #include<iostream>
using namespace std;
int f(int *arr,int idx, int n){
// base case
if(idx==n-1){
// we only have one element left, so it is the maximum
return arr[idx];
}
return max(arr[idx], f(arr, idx+1, n));
}
int main(){
int arr[]={3,10,3,2,5};
int n=5;
cout<<f(arr,0... | ALGO | 0.999865 | 4.716288 |
d22361f5-d51d-4d99-9b3f-71cbe12ceb44 | templerobotics/Lunabotics2024-ROS | src/teleop_controller/src/Digging.cpp | /**
* @brief Temple Lunabotics Digging Subsystem
* @todo Digging Belt - PID & Sensor Diagnostics via Timer
* @todo Leadscrews start at 0 , Actuators are down. Initializatin was leadscrews down for 2 seconds then came up till hit top limit switch even if at 0
*/
#include "core.hpp"
#include "Digging.hpp"
Digging::D... | TOOL | 0.93342 | 6.332828 |
34b9e35f-757c-449f-8bbe-ac3ffad6975d | CherednichekVD/PSTU_Labs_24 | Sem_2/Xanoi/Xanoi.cpp | #include <iostream>
#include <clocale>
using namespace std;
void fill_visual(int n, int** visual)
{
for (int i = 0; i < n; ++i)
{
visual[i] = new int[3];
}
for (int i = 0; i < n; i++)
{
for (int j = 0; j < 3; j++)
{
if (j == 0) { visual[i][j] = i + 1; }
else { visual[i][j] = 0; }
}
}
for (int i... | ALGO | 0.999838 | 3.964948 |
ae971a23-56d5-40b3-9f85-cc321e560855 | laxmishinde29/Logic_Building | LB_Assignment/Assi44_1.cpp | #include<iostream>
using namespace std;
template <class T>
T Minimum(T Arr[], int iSize)
{
T Min = Arr[0];
int i = 0;
for(i = 0; i < iSize; i++)
{
if(Arr[i] < Min)
{
Min = Arr[i];
}
}
return Min;
}
int main()
{
int iLength = 0;
float *ptr = NULL;
... | ALGO | 0.999699 | 3.324648 |
f5374b24-be09-4e35-a56b-675669315d97 | kwhu5695/invertedDRAM | gem5/src/systemc/tests/systemc/misc/examples/a2901/a2901_alu_inputs.cpp | /*****************************************************************************
a2901_alu_inputs.cpp --
Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
*****************************************************************************/
/*******************************************************************... | TOOL | 0.890041 | 4.6728 |
d042ce9c-a301-4b32-8237-b62955756b00 | ta121443/AOJ | ITP1/8_D.cpp | /*
リング状の文字列 sの任意の位置から、時計回りに連続した文字をいくつか選んで、文字列 pが作れるかを判定するプログラムを作成してください。
Input
1行目に文字列 sが与えられます。
2行目に文字列 pが与えられます。
Output
pが作れる場合は Yes と、作れない場合は No と1行に出力してください。
Constraints
1 ≤ pの長さ ≤ sの長さ ≤ 100
文字列は英小文字からなる
Sample Input 1
vanceknowledgetoad
advance
Sample Output 1
Yes
Sample Input 2
vanceknowledgetoad
advanced
... | ALGO | 0.99999 | 4.932946 |
1c739120-aa1e-4448-9720-bc89ba63fe1b | sunzhy3/exercise | code/conv2d.cpp | #include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
using namespace std;
/*
kernel的维度(order,k_c,k_h,k_w) order代表有几个kernel,和kernel_num相同
输入feature map的维度(f_c,f_h,f_w) 其中 k_c == f_c
输出feature map的维度(out_c,out_h,out_w) 其中 out_c == kernel的数量
*/
vector<vector<vector<int>>> Con... | ALGO | 0.995066 | 4.243844 |
111b5412-241b-4a82-98f1-aaed21444b54 | caitongbo/GA-CEC2014-Test | reference/CEC2010/CSO/CEC2010/F16.cpp | #include "F16.h"
#include <stdio.h>
/**
* D/m-group Shifted and m-rotated Ackley’s Function
*
* as defined in "Benchmark Functions for the CEC'2010 Special Session
* and Competition on Large-Scale Global Optimization" by Ke Tang,
* Xiaodong Li, P. N. Suganthan, Zhenyu Yang, and Thomas Weise
* published as techni... | ALGO | 0.999824 | 4.402001 |
2533af06-f86a-4ace-97eb-5ac2d00986a1 | karlchina2008/LeetCode | 298. Binary Tree Longest Consecutive Sequence.cpp | /*
Given a binary tree, find the length of the longest consecutive sequence path.
The path refers to any sequence of nodes from some starting node to any node in the tree along the parent-child connections.
The longest consecutive path need to be from parent to child (cannot be the reverse).
For example,
1
\
... | ALGO | 0.999981 | 5.868755 |
0094851d-239b-4624-b5aa-8a05b6ab1f09 | niranjan-ks-pro/drawerwidgetpart27 | 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.9988 | 6.76073 |
89036f48-a959-4ef8-8d01-eb317a0921e0 | zhaoziy/Algorithm | ShellSort/ShellSort/ShellSort.cpp | // ShellSort.cpp : ̨Ӧóڵ㡣
//
#include "stdafx.h"
#include <iostream>
using namespace std;
class ShellSort {
public:
int* shellSort(int* A, int n) {
// write code here
int step = n / 2;
while (step > 0)
{
for (int i = step; i < n; ++i)
{
for (int j = i - step; j >= 0; j -= step)
{
if (A[j +... | ALGO | 0.999875 | 4.737385 |
4fba8c1f-bb87-4b79-8174-08a46e1eadb3 | sarvex/leetcode-algol | solution/0200-0299/0201.Bitwise AND of Numbers Range/Solution.cpp | class Solution {
public:
int rangeBitwiseAnd(int left, int right) {
while (left < right) {
right &= (right - 1);
}
return right;
}
}; | ALGO | 0.999981 | 6.174218 |
3473ae80-5f96-4765-875b-80edf94d851a | timmyjose-experiments/competitive-programming | cp/cses/assiut/sheet5/i.cpp | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
void swap_row(vector<vector<int>> &a, int x, int y) {
int n = a.size();
for (int i = 0; i < n; i++) {
int t = a[x][i];
a[x][i] = a[y][i];
a[y][i] = t;
}
}
void swap_col(vector<vector<int>> &a, int x, i... | ALGO | 0.999825 | 3.520605 |
a5c5e499-5db5-4d01-add7-6e6271389839 | 11707266/max_IS | tool.cpp | /* Dynamic programming based program
for Largest Independent Set problem */
#include <bits/stdc++.h>
#include <string>
#include <queue>
using namespace std;
// A utility function to find max of two integers
int max(int x, int y) { return (x > y)? x: y; }
/* A binary tree node has data, pointer
to left child and a... | ALGO | 0.999937 | 6.390334 |
e50d1975-c6a9-4127-bfca-52d5bbb45375 | AdarshSharadPandey/100DaysOfCodeChallenge | Day 41/ArrangeTheArray(gfgPotdMed).cpp | void Rearrange(int arr[], int n)
{
vector<int>ans;
for(int i=0;i<n;i++)
if(arr[i]<0)
ans.push_back(arr[i]);
for(int i=0;i<n;i++)
if(arr[i]>=0)
ans.push_back(arr[i]);
for(int i=0;i<ans.size();i++)
arr[i]=ans[i];
} | ALGO | 0.999968 | 4.348745 |
639fbd9d-d9bf-4e13-8444-671d46dca03d | ishandutta2007/codeforces | onionpringles/normal/802/E.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int a[250];
int cnt[2001];
int main(){
int n;scanf("%d",&n);
for(int i=0;i<n;i++){
int N = 250;
for(int j=0;j<N;j++)scanf("%d",a+j);
double M=0;
for(int j=0;j<N;j++)M+=a[j];
M/=N;
double v=0;
for(int j=0;j<N;j++)v += (a[j]-M)*(a[j]-M);
... | ALGO | 0.999906 | 3.728188 |
2e06b3df-27f3-4f25-b365-50c07679cd7f | FiaDot/coding-test-cpp17 | bakjoon/bruteforce/weight_height.cpp | //
// Created by LEE GUNHO on 2023/03/30.
//
// 덩치 : https://www.acmicpc.net/problem/7568
#include <iostream>
using namespace std;
int main()
{
int count;
cin >> count;
pair<int,int> a[51];
for(int n=0;n<count;n++)
cin >> a[n].first >> a[n].second;
int rank=1;
for(int n=0;n<count... | ALGO | 0.999983 | 4.663752 |
dcced66a-0962-4032-bb65-9c240f763090 | ChaokangRen/planning_1_0 | thirdparty/Eigen/doc/examples/Tutorial_ArrayClass_cwise_other.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace Eigen;
using namespace std;
int main()
{
ArrayXf a = ArrayXf::Random(5);
a *= 2;
cout << "a =" << endl
<< a << endl;
cout << "a.abs() =" << endl
<< a.abs() << endl;
cout << "a.abs().sqrt() =" << endl
<< a.abs().sqrt() << endl... | ALGO | 0.984163 | 3.130341 |
ed1e8811-d3b1-46b9-8dfb-43b9c49bd561 | moti9/iCode | dsa/DP/Unbounded-Knapsack-RecursiveApproach.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007
// TC- O(2^N)
// SC- O(N)
class Solution
{
int maxProfit(int ind, int wt, vector<int> &profit, vector<int> &weight)
{
if (ind == 0)
{
return (wt / weight[0]) * profit[0];
}
int... | ALGO | 0.999994 | 5.217676 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.