uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
1b6e95c4-71ae-4f5d-8370-ce95b9a23ef4 | Ayush024-dev/Neetcode_150 | Graph/bfs/Jump_game_4.cpp | // leetcode link: https://leetcode.com/problems/jump-game-iv/description/
// So we are given an array of integers. In one step we can either go to i+1th index or i-1 th index or to any other index where i!=j and arr[i]= arr[j]
// We need to find the minimum number of steps to get to the last index;
// Now at first it... | ALGO | 0.99998 | 5.93719 |
cdbd3cdb-63c0-43e2-83b5-1d30e50007eb | sarvex/leetcode-erlang | solution/0000-0099/0042.Trapping Rain Water/Solution.cpp | class Solution {
public:
int trap(vector<int>& height) {
int n = height.size();
int left[n], right[n];
left[0] = height[0];
right[n - 1] = height[n - 1];
for (int i = 1; i < n; ++i) {
left[i] = max(left[i - 1], height[i]);
right[n - i - 1] = max(right[... | ALGO | 0.999991 | 6.836226 |
902e0fb9-307c-4b6e-9824-d68735934bf6 | luisreyes55/CPCFI | GrayCode.cpp | #include <iostream>
#include <string>
#include <vector>
using namespace std;
int main(){
vector<string> arr;
// start with one-bit pattern
arr.push_back("0");
arr.push_back("1");
for (int i = 0 ; i < arr.size() ; i++ )
cout << arr[i] << endl;
}
| ALGO | 0.999764 | 3.179505 |
23438fcf-d52e-45d2-be1a-dfe2444e727c | tree105778/algorithmn | 2870.cpp | #include <bits/stdc++.h>
using namespace std;
int n, j, k;
string s, num;
char ch;
vector<string> v;
queue<char> qu;
// ๋น๊ต ๋์น์ฑ์ ์ง์ผ์ผ ํจ
bool compare(string& s1, string& s2) {
if (s1.size() != s2.size()) return s1.size() < s2.size();
return s1 < s2;
}
// 100์๋ฆฌ๊น์ง ๋์ฌ ์ ์์ผ๋ฏ๋ก ๋ฌธ์์ด๋ก ์ฒ๋ฆฌ
int main() {
cin >> n;
for(in... | ALGO | 0.999918 | 5.382753 |
5d35ab70-e9ce-4ec4-aeb9-9dac3a62519f | IrdEli/GazeDetection | opencv-master/samples/cpp/asift.cpp | #include <opencv2/core.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/features2d.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/calib3d.hpp>
#include <iostream>
#include <iomanip>
using namespace std;
using namespace cv;
static void help(char** argv)
{
cout
<< "This is a sample usage of AffineFe... | ALGO | 0.989638 | 6.013153 |
237cf35b-8b4a-44c5-9bb3-51dd00fa6809 | minseo0102/Algorithm | ํ๋ก๊ทธ๋๋จธ์ค/2/43165.โ
ํ๊ฒโ
๋๋ฒ/ํ๊ฒโ
๋๋ฒ.cpp | #include <string>
#include <vector>
using namespace std;
int solution(vector<int> numbers, int target) {
if(numbers.empty()){
if(target==0) return 1;
else return 0;
}
int answer = 0;
int top = numbers.back();
numbers.pop_back();
answer+=solution(numbers, target+top);
... | ALGO | 0.999894 | 5.480037 |
6c8bdce0-142d-47d1-8a14-d56fb01bd817 | YB73/DSA-QUES | 1971-find-if-path-exists-in-graph/1971-find-if-path-exists-in-graph.cpp | class DisjointSet {
public:
vector<int> parent, size;
DisjointSet(int n){
parent.resize(n+1,0);
size.resize(n+1);
for(int i=0;i<=n;i++){
parent[i] = i;
size[i] = 0;
}
}
int up(int node){
return (node == parent[node]) ? node : parent[node] ... | ALGO | 0.999992 | 6.087083 |
5a29cd27-903e-4951-a732-58431a0900b7 | kubaizak/BSK_sprawozdanie_2 | rail_fence.cpp | #include <iostream>
#include <deque>
#include <string>
#include "rail_fence.hpp"
typedef std::string (*fcnPtr)(std::string, int);
static fcnPtr executeFn = RailFence::encrypt;
static std::string message;
static int n;
std::string remove_substring(std::string str, std::string sub){
size_t pos = 0;... | ALGO | 0.99819 | 4.994599 |
bb46ce02-bb47-4adf-b644-8525fd293fcb | phonkee/Wusik-ZR | JUCE/JUCE/modules/juce_dsp/maths/juce_LookupTable.cpp | namespace juce
{
namespace dsp
{
template <typename FloatType>
LookupTable<FloatType>::LookupTable()
{
data.resize (1);
}
template <typename FloatType>
LookupTable<FloatType>::LookupTable (const std::function<FloatType (size_t)>& functionToApproximate,
size_t numPointsToUse)
{... | TOOL | 0.873468 | 6.787538 |
a62c2c39-c0ce-4de1-ac6a-cb227a800283 | QbitQuantum/Basics | ะัั
ะพะดะฝะธะบะธ/Process_Manager.cpp | pid_t
ACE_Process_Manager::wait (pid_t pid,
const ACE_Time_Value &timeout,
ACE_exitcode *status)
{
ACE_TRACE ("ACE_Process_Manager::wait");
ACE_exitcode local_stat = 0;
if (status == 0)
status = &local_stat;
*status = 0;
ssize_t idx = -1;
ACE_Proc... | TOOL | 0.8513 | 6.71487 |
cdd85f8d-4c9f-44ea-a52a-9eb93d518743 | KhaiJP/AtCoder | ABC/<300/271/C++/wrong_C.cpp | /*
algorithm below has counterexample:
8
1 1 1 1 3 4 6
*/
#include<iostream>
#include<vector>
#include<algorithm>
#define rep(i,s,t) for(int i=(s); i<(t); ++i)
using namespace std;
int main(){
int N; cin >> N;
vector<int> A(N+1,0); rep(i,1,N+1) cin >> A[i];
sort(A.begin(), A.end());
int id = 1, volume= 0,... | ALGO | 0.999961 | 3.709026 |
fa7ee5fd-cd76-4530-af9f-3d4e98740853 | yzzupgo/MFTCG | Data/abc136_b/retaliatorElite/ac/6698151.cpp | #include<cstdio>
#include<iostream>
using namespace std;
int main(){
int n;
cin>>n;
int ans=0;
if(n>=9) ans+=9;
if(n>=999) ans+=900;
if(n>=99999) ans+=90000;
if(n>=0&&n<9) ans+=n-0;
if(n>=100&&n<999) ans+=n-100+1;
if(n>=10000&&n<99999) ans+=n-10000+1;
cout<<ans;
return 0;
}
| ALGO | 0.999567 | 3.257246 |
73ba5c58-bc05-4018-bae2-5c9b49e2c7b6 | ASchneidman/HackCMU2018 | HackCMU2018/crawler/cpp_files/spojANARC05B - The Double HeLiX.cpp | #include<bits/stdc++.h>
using namespace std;
long long a[10004],b[10004];
long long solve(long long n1,long long n2)
{
long long k=0,sum1=0,sum2=0,ans=0,i=0,j=0;
while(i<n1 and j<n2){
if(a[i]<b[j]){
sum1+=a[i];
i++;
}
else if(a[i]>b[j]){
sum2+=b[j];
... | ALGO | 0.999925 | 3.280799 |
815b4173-ebab-4415-af81-448f23da70f9 | nqdat2002/C_Plus_Plus | Mycode/chia het cho A va B.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int T; cin >> T;
while(T--) {
int m, n, a, b;
cin >> m >> n >> a >> b;
int counta = 0;
for(int i = m; i <= n; i++)
if(i % a == 0 || i % b == 0)
counta ++;
cout << counta << '\n';
}
return 0;
}
| ALGO | 0.999449 | 3.538982 |
4478856f-0f11-4796-8ec9-f8540cf6292d | wangjinzhuo/tubecnn | TubeConvNets/src/caffe/layers/bnll_layer.cpp | #include <algorithm>
#include <vector>
#include "caffe/layer.hpp"
#include "caffe/vision_layers.hpp"
namespace caffe {
const float kBNLL_THRESHOLD = 50.;
template <typename Dtype>
void BNLLLayer<Dtype>::Forward_cpu(const vector<Blob<Dtype>*>& bottom,
const vector<Blob<Dtype>*>& top) {
const Dtype* bottom_data... | DATA | 0.936111 | 6.979207 |
a0fc567a-83a5-47f9-8148-be74885d5a8e | ax6000/atcoder | abc149/a.cpp | #include <iostream>
using namespace std;
#include <string>
int main (){
string S,T;
cin >> S >> T ;
cout << T + S << endl;
return 0;
} | ALGO | 0.994561 | 3.760666 |
c6772d6b-4c7d-4c40-94d7-b299942ebaa9 | amit269/flutter-api-project | 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.998799 | 6.776823 |
c6ee9bc5-2997-42bf-95a3-51b4d992117e | confusedconsciousness/geeks-for-geeks | Trees/check_bst.cpp | #include<iostream>
using namespace std;
/*
in this problem we need to check whether the given tree is a BST
a binary search tree is a tree in which its left child is always smaller or equal to the parent node and its right child is
always bigger than the parent node
*/
// basic definition of node in our... | ALGO | 0.999977 | 6.003134 |
96fdb5d9-a402-4e23-9e6b-e4a30d05ea8b | de-ansh/SdeSheetChallenge | Trees/Boundary.cpp | void leftVeiw(TreeNode<int> * root , vector<int>&ans){
if(root == NULL){
return ;
}
if(root -> left == NULL and root -> right == NULL ){
return ;
}
ans.push_back(root -> data) ;
leftVeiw(root -> left , ans) ;
if(root -> left == NULL ){
leftVeiw(root -> right , ans ) ; ... | ALGO | 0.999988 | 5.247066 |
e2be112c-58a9-4ca0-9205-95162482f796 | dpetrosy/LeetCode | problem509/solution.cpp | class Solution
{
public:
int fib(int n)
{
if (n == 0)
return 0;
int first = 0;
int second = 1;
int num = 1;
for (int i = 1; i < n; ++i)
{
num = first + second;
first = second;
second = num;
}
return... | ALGO | 0.999997 | 6.229368 |
bd1176cf-0091-47ce-b243-854da91c6e02 | aryan-palkar/CP-DSA | Practise/Beautiful_Arrangement.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
void test_case(){
int n;
cin>>n;
}
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
int T = 1;
// cin>>T;
while(T--){
test_case();
}
return 0;
} | ALGO | 0.993088 | 3.209659 |
83b06f94-37aa-4569-a8ae-6257731f3bba | KartikTakyar0046/DS-Algo-Notes | Bubble_Sort/Bubble_Sort.cpp | #include <iostream>
using namespace std;
// Function for bubble sort
void Bubble_Sort(int array[], int size)
{
int temp, flag;
// flag keeps track if any swap happened or not, if swap not happened then array is sorted and it will break out of the loop
// and will save time from running for loop unnecessar... | ALGO | 0.999947 | 5.983738 |
68007f7e-e857-430e-84a5-40ee94215ba1 | Algorithms-and-Data-Structures-2022/cpp-basics-assignment-TimerbulatGilmutdinov | src/code.cpp | #include "assignment/code.hpp"
#include <iostream> // cout, printf
#include <algorithm> // fill, copy
#include <bits/stdc++.h>
using namespace std;
namespace assignment {
// Task 1
int squared_diff(int left, int right) {
return abs(left-right)*abs(left-right);
}
// Task 2
bool check_bit(int mask, i... | TOOL | 0.880885 | 4.031593 |
c4c49fc7-41fd-408c-aa9e-65b5fe1a4cb8 | Zoyaali11/DSA | DSAprep/mallocfree.cpp | #include <iostream>
#include <cstdlib>
using namespace std;
int main() {
// allocate 5 int memory blocks
int* ptr = (int*) malloc(5 * sizeof(int));
// check if memory has been allocated successfully
if (!ptr) {
cout << "Memory Allocation Failed";
exit(1);
}
cout << "Initializing values..." << en... | TOOL | 0.93186 | 3.516699 |
703288a7-89c1-42ed-bd0c-ee716af7d4de | dyninst/examples | DynC/mutatee.cpp | #include <iostream>
int hi = 0;
int zarray[1];
int array[5] = {1, 2, 3, 4, 5};
int array2[5] = {6, 7, 8, 9, 10};
int arrayField = array[2];
struct myStructType {
int i;
char const* s;
char const* sa[4];
} mystruct = {3, "house", {"how", "now", "brown", "cow"}};
int count(int i);
int zomg = 2;
int main() {
... | ALGO | 0.925718 | 3.37719 |
1cc4656a-609d-4596-978a-571595b34a03 | AniKouDev/CodeChef | 0-1000 Beginner Level/Instagram.cpp | #include <iostream>
using namespace std;
int main(){
int t;
cin >> t;
while(t--){
int x, y;
cin >> x >> y;
if(x > 10*y)
cout << "Yes" << endl;
else
cout << "No" << endl;
}
} | ALGO | 0.999482 | 4.21018 |
38763970-a549-43bb-b377-d21aa8546d24 | AI-4-SE/workload_coverage_companion | misc/code/z3/src/nlsat/nlsat_explain.cpp | #include "nlsat/nlsat_explain.h"
#include "nlsat/nlsat_assignment.h"
#include "nlsat/nlsat_evaluator.h"
#include "math/polynomial/algebraic_numbers.h"
#include "util/ref_buffer.h"
namespace nlsat {
typedef polynomial::polynomial_ref_vector polynomial_ref_vector;
typedef ref_buffer<poly, pmanager> polynomial_r... | ALGO | 0.995012 | 5.870319 |
327c8a78-944e-45fb-a152-96b48e38af55 | chm994483868/HMDailyLearningRecord | Algorithm_C/Algorithm_C/First/MergeSortedLists/MergeSortedLists.cpp | #include "MergeSortedLists.hpp"
ListNode* merge(ListNode* pHead1, ListNode* pHead2) {
if (pHead1 == nullptr)
return pHead2;
else if (pHead2 == nullptr)
return pHead1;
ListNode* pMergedHead = nullptr;
if (pHead1->m_nValue < pHead2->m_nValue) {
pMergedHead = pHead1;
... | ALGO | 0.999699 | 5.455888 |
c0a67542-01a7-4091-9243-d7d82bd61e81 | thehamzaihsan/DSA | [08] Recursion/factorial.cpp | #include <iostream>
using namespace std;
long int factorial(int n){
if(n == 0){
return 1;
}
else{
return n*factorial(n-1);
}
}
int main()
{
cout << "20 factorial is: " << factorial(20) << endl;
} | ALGO | 0.993269 | 3.916383 |
9b527c7d-f7db-457b-b223-4a9fd3c6ce76 | ANIKETRAJ28/DSA-and-CP | Trees/binary-tree-inorder-traversal.cpp | #include <bits/stdc++.h>
#define ll long long int
#define infp INT_MAX
#define infn INT_MIN
#define pp pair<int, int>
#define mod 1000000007
using namespace std;
template <typename T>
using vec = vector<T>;
// https://leetcode.com/problems/binary-tree-inorder-traversal/
struct TreeNode
{
int val;
TreeNode *l... | ALGO | 0.999995 | 6.182126 |
4c60fa66-b15d-4ae9-944b-36dd79eda28c | noko206/AtCoder | abc/201-250/224/b.cpp | #include <bits/stdc++.h>
using namespace std;
#define _overload3(_1,_2,_3,name,...) name
#define _REP(i,n) REPI(i,0,n)
#define REPI(i,a,b) for(int i=int(a);i<int(b);++i)
#define REP(...) _overload3(__VA_ARGS__,REPI,_REP,)(__VA_ARGS__)
#define ALL(a) (a).begin(),(a).end()
#define ALLR(a) (a).rbegin(),(a).rend()
typedef... | ALGO | 0.999985 | 3.715992 |
1d81a677-b499-4a9d-a770-4d50c8914b25 | lapierryoh/Prog-Systeme | partie2.cpp | #include <unistd.h>
#include <iostream>
#include <sys/wait.h>
#include <sys/types.h>
#include <signal.h>
using namespace std;
//g++ -o index.exe index.cpp
void handler(int sig);
int main(int argc, char const *argv[])
{
/**
* Partie 1 du TP01
*/
cout << getpid() << endl;
cout << getppid() << ... | TOOL | 0.906699 | 3.528566 |
8aa169d9-b274-47a0-ba5b-d36b1a61b1d0 | akashchouhan16/Data-Structures-And-Algorithms | Binary Tree/RightViewOfTree.cpp | #include <cstdlib>
#include <iostream>
#include <queue>
using namespace std;
typedef struct Node
{
int data;
struct Node *left;
struct Node *right;
} Tree;
Tree *CreateBinaryTree()
{
Tree *temp = new Tree();
int data;
cout << "Enter Data : ";
cin >> data;
if (data == -1)
return... | ALGO | 0.999765 | 5.232995 |
4d6ba103-419b-4d77-982b-5bc28c94ec6d | NancyGuptaEr/Nancy-LeetCode-Solutions | 0014-longest-common-prefix/0014-longest-common-prefix.cpp | class Solution {
public:
string longestCommonPrefix(vector<string>& strs) {
//TC = O(n), SC = O(1)
string ans = "";
sort(strs.begin(), strs.end()); //sort lexicographically
//in this way, first and last words will have most and least common words
string first = strs[0], last ... | ALGO | 0.999836 | 6.023216 |
3676f61e-ac6f-42c2-b697-491a8fa84867 | ras1234/geeks4geeks | geeks_string/24b_lexicographicRank.cpp | #include <bits/stdc++.h>
using namespace std;
int factorial(int num)
{
if(num==0 || num==1)
return 1;
else
return (num*(factorial(num-1))%1000003)%1000003;
}
int findsmaller(string s,int l,int r)
{
int num=0;
for(int i=l;i<=r;i++)
{
if(s[i]<s[l-1])
num++;
}
return num;
}
int lexicographicRank(strin... | ALGO | 0.999985 | 4.821453 |
e8798b3d-f0ee-4ace-ac90-292f11237c5c | iqtree/iqtree3 | alignment/superalignmentpairwise.cpp | #include "superalignmentpairwise.h"
SuperAlignmentPairwise::SuperAlignmentPairwise()
: AlignmentPairwise()
{
}
SuperAlignmentPairwise::SuperAlignmentPairwise(PhyloSuperTree *atree, int seq1, int seq2)
: AlignmentPairwise()
{
tree = atree;
seq_id1 = seq1;
seq_id2 = seq2;
SuperAlignment *aln = (SuperAlignment*)... | ALGO | 0.970199 | 4.284505 |
ca359838-b9a2-45fa-8931-8189b67f0ce1 | zyue2022/bustub_learn | src/storage/index/b_plus_tree.cpp | #include <string>
#include "common/exception.h"
#include "common/rid.h"
#include "storage/index/b_plus_tree.h"
#include "storage/page/header_page.h"
namespace bustub {
INDEX_TEMPLATE_ARGUMENTS
BPLUSTREE_TYPE::BPlusTree(std::string name, BufferPoolManager *buffer_pool_manager, const KeyComparator &comparator,
... | ALGO | 0.994428 | 7.3269 |
5b0137a2-20cd-406f-8c74-9e624f0bb2a6 | rshrj/matrix-models-cpp | src/matrices/Solver.cpp |
class Solver
{
public:
unsigned int N;
unsigned int K;
Solver(const unsigned int Nval, const unsigned int Kval) : N(Nval), K(Kval) {
}
private:
}; | ALGO | 0.996046 | 4.406993 |
8c58fbd8-0f93-449a-8c9b-6c016f15c238 | KroNuSeTe/ProgPPUCPPProject | ProgPPUCPPProject/ProPrinCPP/Chapter5/Chp5Exer11.cpp | #include <iostream>
#include <vector>
using namespace std;
vector<int> FibonacciCalc(int numAmount) {
vector<int> FibonacciSeries;
for (int i = 0; i < numAmount; ++i) {
if (i > 1) {
FibonacciSeries.push_back(FibonacciSeries[i - 2] + FibonacciSeries[i - 1]);
}
else {
FibonacciSeries.push_back(1);
}
}
... | ALGO | 0.998731 | 4.164698 |
bfbe0098-2167-48a4-a02e-b7854c692dc9 | artiam99/GeeksforGeeks | 14 Bit Magic Algoritms/1 Basic/21 All Apear Thrice Except One Find Exception.cpp | #include <bits/stdc++.h>
using namespace std;
int Find(vector<int> &a,int n)
{
int ones = 0 , tows = 0;
for(int i = 0 ; i < n ; i++)
{
ones = (ones ^ a[i]) & ~tows;
tows = (tows ^ a[i]) & ~ones;
}
return ones;
}
int main()
{
vector<int> a = {12, 1, 12, 3, 12, 1, 1, 2, ... | ALGO | 0.999917 | 4.277758 |
3d3dc66c-b464-4ee0-b498-9b1e37faabca | Ujjwal55/LeetCode-Solutions | binary-tree-level-order-traversal/binary-tree-level-order-traversal.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.999945 | 6.096855 |
393d5d57-e30e-4d2f-a06c-c65fbb495b20 | demul/hands_on_gtsam | third_party/gtsam/gtsam/3rdparty/Eigen/unsupported/doc/examples/PolynomialSolver1.cpp | #include <unsupported/Eigen/Polynomials>
#include <vector>
#include <iostream>
using namespace Eigen;
using namespace std;
int main()
{
typedef Matrix<double,5,1> Vector5d;
Vector5d roots = Vector5d::Random();
cout << "Roots: " << roots.transpose() << endl;
Eigen::Matrix<double,6,1> polynomial;
roots_to_mo... | TEST | 0.998968 | 4.659281 |
cc2c379e-4307-44d0-be5e-568f9545a0c6 | Rishabh7798/GFG-POTD-2025 | 15-02-2025.cpp | Lowest Common Ancestor in a BST
/*
// Tree Node
class Node {
public:
int data;
Node* left;
Node* right;
// Constructor to initialize a new node
Node(int val) {
data = val;
left = NULL;
right = NULL;
}
};
*/
class Solution {
public:
Node* LCA(Node* root, Nod... | ALGO | 0.999993 | 7.06776 |
e62719ec-4063-4402-a946-6cc83b846711 | Adham-amr-1/ICPC-Issuit-codeforce | J. Primes from 1 to n.cpp | #include <iostream>
using namespace std;
int main()
{
int n, i, k;
cin >> n;
for (i = 2; i <= n; i++) {
bool test = true;
for (k = 2; k <= (i/2); k++) {
if (i % k == 0) {
test = false;
break;
}
}
if (test) {
cout << i << " ";
}
}
return 0;
}
| ALGO | 0.999844 | 4.565151 |
3c547ffd-720e-45f0-89df-12c8081fc2f2 | raincross7/code-similarity | codes/train_code/problem113/problem113_270.cpp | #include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>... | ALGO | 0.999894 | 3.992377 |
7c002720-6528-4189-9f4c-8c398a3aa34c | Naveen-123-kumar/DataSturcture_and_Algorithm | C++Code/Sorting/selectionSort.cpp | #include<iostream>
using namespace std;
void selectionSort(int arr[],int n){
int i,j,tem,index;
for(i=0;i<n-1;i++){
int minValue=arr[i];
for(j=i;j<n;j++){
if(minValue>arr[j]){
minValue=arr[j];
index=j;
}
}
tem=arr[i];
arr[i]=minValue;
arr[index]=tem;
}
fo... | ALGO | 0.999979 | 4.245544 |
aa1aaf98-3b0d-49e4-8743-d69a82184d74 | tasneemrz/leetcode-problems | 0826-most-profit-assigning-work/0826-most-profit-assigning-work.cpp | class Solution {
public:
int maxProfitAssignment(vector<int>& difficulty, vector<int>& profit, vector<int>& worker) {
int totalMaxProfit = 0;
for(int i = 0; i < worker.size(); i++) {
int maxProfitWorker = 0;
for(int j = 0; j < difficulty.size(); j++) {
... | ALGO | 0.999969 | 6.134427 |
70c4246d-f436-4d4e-b316-240c762b39a3 | 98andwin/Kattis_solutions | Problems/Test Drive/testdrive.cpp | #include <iostream>
using namespace std;
int main(){
int a, b, c;
cin >> a >> b >> c;
int diff_1 = b-a, diff_2 = c-b;
if (diff_1 == diff_2){
cout << "cruised";
}
else if (diff_1*diff_2 < 0 && diff_1 != 0 && diff_2 != 0){
cout << "turned";
}
else{
if (diff_1 <=... | ALGO | 0.999792 | 4.386807 |
af52d73f-707b-431d-ac0f-6333ecac0f04 | abhitejabhi/leetcoding | 0459-repeated-substring-pattern/0459-repeated-substring-pattern.cpp | class Solution {
public:
bool repeatedSubstringPattern(string s) {
int n=s.size();
for(int i=0;i<n/2;i++)
{
string temp=s.substr(0,i+1);
string ans="";
if(n%temp.size()==0)
{
int val=(n/temp.size());
for(int i=1... | ALGO | 0.999945 | 5.997869 |
0a1a24f5-8645-47a7-b225-e9c1b3833307 | Alexantoun/Coding_Challenges | Kattis/backspace.cpp | /*
Store a string, if the '<' char is encountered, delete the last character input.
at EOF output the string in order of arrival
*/
#include <deque>
#include <iostream>
using namespace std;
int main(){
char input;
deque<char> keepString;
while(cin>>input)
(input == '<')? keepString.pop_bac... | ALGO | 0.998873 | 3.053728 |
c9f8c2e7-4853-4963-9b78-d70ec7a8ea85 | solar-engine/wpilib-mirror | wpilibc/simulation/src/PIDController.cpp | /*----------------------------------------------------------------------------*/
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* the project. */
/*-------------------------------------------------------------------------... | TOOL | 0.962474 | 7.159134 |
85413c5a-a0a9-4ba7-891d-c8f896030237 | sanchit-bhalla/Competitive-Coding-Hackerrank | Interview Preparation Kit/Arrays/Array_manipulation.cpp | #include<iostream>
using namespace std;
int main()
{
long int n,m,k,i,p,q,max_=0,x=0;
cin>>n>>m;
long int *a=new long int[n+1](); // If array is large you have to
//make it dynamically otherwise you will get
// Segmentation Fault
for(i=0;i<m;i++)
... | ALGO | 0.999929 | 3.20891 |
9d6f5913-2fec-42d0-b526-6e3f9f369f0d | TeamCarbonXtremeARMv6/frameworks_av | media/libstagefright/codecs/amrnb/enc/src/hp_max.cpp | /*
------------------------------------------------------------------------------
Filename: /audio/gsm_amr/c/src/hp_max.c
Date: 02/01/2002
------------------------------------------------------------------------------
REVISION HISTORY
Description: Replaced "int" and/or "char" with OSCL defined types.
Des... | ALGO | 0.999618 | 7.219464 |
6278fc68-6c70-4dc2-a848-6f5c443e4757 | Sageena-Sharma/datastructure | insertion_sort.cpp | #include<iostream>
using namespace std;
void insertionsort(int a[],int n)
{
for(int i=1;i<n;i++)
{
int key=a[i];
int j=i-1;
while(j>=0&&a[j]>key)
{
a[j+1]=a[j];
j=j-1;
}
a[j+1]=key;
}
}
int main()
{
int a[100],n,i,size,m;
cout<<... | ALGO | 0.999856 | 3.971964 |
792a5299-3aa2-4fc7-bf6c-611edd35fc2d | YangJunNan/scilab | scilab/modules/sparse/src/ColPack/src/GeneralGraphColoring/GraphCore.cpp | #include "ColPackHeaders.h"
using namespace std;
namespace ColPack
{
//Virtual Function 1102
void GraphCore::Clear() //!< Reinitialize all variables
{
m_i_MaximumVertexDegree = _UNKNOWN;
m_i_MinimumVertexDegree = _UNKNOWN;
m_d_AverageVertexDegree = _UNKNOWN;
m_s_InputFile.clear();
m_vi_Vertices.clear(... | ALGO | 0.966283 | 3.332216 |
54650ac6-7f1b-4704-b1a7-7a4d044ecae8 | michimani/atcoder | abc/301-400/323/cpp/c.cpp | #include <iostream>
#include <vector>
#include <tuple>
#include <algorithm>
#include <map>
using namespace std;
int main()
{
unsigned long N = 0, M = 0;
cin >> N >> M;
vector<int> A(M, 0);
for (unsigned long i = 0; i < M; i++)
{
cin >> A[i];
}
tuple<int, int> max_score = {0, 0};
vector<tuple<int... | ALGO | 0.99993 | 3.869587 |
f3823ce8-1fa5-4660-bf49-ead7afd7acd9 | colegruninger97/IBAMR_Second_Order_Stokes | examples/ConstraintIB/impulsively_started_cylinder/example.cpp | // Config files
#include "SAMRAI_config.h"
// Headers for basic PETSc functions
#include "petscsys.h"
// Headers for basic SAMRAI objects
#include "BergerRigoutsos.h"
#include "CartesianGridGeometry.h"
#include "LoadBalancer.h"
#include "StandardTagAndInitialize.h"
// Headers for application-specific algorithm/data ... | ALGO | 0.998877 | 6.616604 |
b93cba6b-149e-4bdf-a1d3-9748c2f0dc90 | myasincifci/jetbrains-test-task | test_data/C++/postfix_evaluation.cpp | /**
* @file
* @brief Evaluation of [Postfix Expression](https://en.wikipedia.org/wiki/Reverse_Polish_notation)
* @author [Darshana Sarma](https://github.com/Darshana-Sarma)
* @details
* Create a stack to store operands (or values).
* Scan the given expression and do following for every scanned element.
* If the ... | ALGO | 0.999525 | 6.626534 |
d11a5d8c-b63d-48e5-9e0f-aaebe87f4297 | fkgusdk/2022_winter | chap7/vac_p306_gambler/vac_p306_gambler/vac_p306_gambler.cpp |
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#define SEED 50
#define GOAL 250
int main()
{
std::cout << "306 ํ์ด์ง ๋๋ฐ ์์ ์ฐ์ต\n\n";
std::cout << "๋์๋ฅผ ์ด์ฉํด ํ๋ฅ ํํํ๋ ๋ฒ์ด ์ธ์ ๊น์\n\n";
printf("์ด๊ธฐ ์๊ธ : %d $ \n\n", SEED);
printf("๋ชฉํ ๊ธ์ก : %d $ \n\n", GOAL);
int win = 0;
for (int i = 0; i < 10... | ALGO | 0.968438 | 4.154706 |
32c45cce-ada6-443a-a5f2-d166f1256fa6 | monicafe02/DDP-MI-23 | 04 perulangan/monica_angka_turun_dari_x.cpp | #include <iostream>
using namespace std;
int main() {
int m, o;
cin >> m >> o;
for(int i = m; i >= o; i--){
cout << i << " " << endl;
}
return 0;
}
| ALGO | 0.999037 | 3.346593 |
8913e473-9de4-474b-b542-1c5404557037 | dhu/borealis-demo | sigmod2005/cube/bot_src/src/worldlight.cpp | // worldlight.cpp
#include "cube.h"
extern bool hasoverbright;
VAR(lightscale,1,4,100);
void lightray(float bx, float by, persistent_entity &light) // done in realtime, needs to be fast
{
float lx = light.x+(rnd(21)-10)*0.1f;
float ly = light.y+(rnd(21)-10)*0.1f;
float dx = bx-lx;
float dy = by-... | TOOL | 0.998875 | 6.059165 |
e282e161-ac26-43b3-bfd6-51e7d56a06e3 | JAICHANGPARK/flutter_notebook_chapter_24 | 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.99887 | 6.783439 |
eb45dcf4-8255-4676-8ea6-f5360c534bf7 | ishandutta2007/codeforces | irkstepanov/normal/47/C.cpp | #include <bits/stdc++.h>
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()
#define pb push_back
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ld, ld> pld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
bool ok;
vector<string> s(6);
void f(int a, int b, int... | ALGO | 0.999866 | 3.793658 |
59a9bf63-94c9-4f20-9590-a386d4d97cde | 9kyo-hwang/Problem-Solving | ํ๋ก๊ทธ๋๋จธ์ค/unrated/181944.โ
ํ์งโ
๊ตฌ๋ถํ๊ธฐ/ํ์งโ
๊ตฌ๋ถํ๊ธฐ.cpp | #include <iostream>
using namespace std;
int main(void) {
int n;
cin >> n;
cout << n << " ";
cout << (n % 2 == 0 ? "is even" : "is odd");
return 0;
} | ALGO | 0.996329 | 4.185397 |
f64a443d-d24e-4507-8a5a-58d83e85e2b5 | haisam10/cpp_if_else | demo12.cpp | /**
* C program to print number of days in a month
*/
#include <iostream>
using namespace std;
int main()
{
int month;
/* Input month number from user */
cout<<"Enter month number (1-12): ";
cin>>month;
if(month == 1)
{
cout<<"31 days";
}
else if(month == 2)
{
... | TOOL | 0.96156 | 3.733646 |
192b38df-66f1-4083-b3de-50c740a2ef68 | kurimulion/CS-472 | mockturtle/experiments/node_resynthesis.cpp | #include <string>
#include <vector>
#include <fmt/format.h>
#include <lorina/aiger.hpp>
#include <mockturtle/algorithms/collapse_mapped.hpp>
#include <mockturtle/algorithms/equivalence_checking.hpp>
#include <mockturtle/algorithms/lut_mapping.hpp>
#include <mockturtle/algorithms/miter.hpp>
#include <mockturtle/algorit... | TOOL | 0.923352 | 5.406076 |
531001ab-f451-4f99-864f-dc6cde68b72d | Chandan51Coder/Algorithms | Phase 5-Analysis of algorithm/Dynamic Programming/17_reducing_dishes.cpp | #include<bits/stdc++.h>
using namespace std;
class Solution {
public:
int solve(vector<int>& sat,int index, int time){
if(index == sat.size()){//all diishes are covered
return 0;
}
int inc = sat[index]*(time+1) + solve(sat,index+1,time+1);
int exc = 0 + solve(sat,index+1,... | ALGO | 0.999939 | 5.243912 |
034eb4bb-c908-4937-99b0-53164da1b8ab | Mohammadkamrulhassan/CompetitiveProgramming | Codeforces/A_Maximum_in_Table.cpp | /**
* BISMILLAHIR RAHMANIR RAHIM ("in the name of God, Most Gracious, Most Merciful")
* SOE_225
* time start: 2024-02-16 01:03:53
* time end : 2024-02-16 01:58:26
*/
/** ===================================== ==== header files ==== ===================================== */
#include <bits/stdc++.h>
u... | ALGO | 0.999992 | 5.698679 |
a7842beb-3228-4250-9fd2-729a2edce8d0 | zhukovdm/contest | cses/graph-algorithms/cycle-finding.cpp | /**
* https://cses.fi/problemset/task/1197
*
* Theorem.
*
* Adding super-vertex with distances to all edges 0 does not introduce new
* negative cycles or disrupt old ones. In other words, (...) is a negative
* cycle in G if and only if (...) is a negative cycle in G'.
*
* Proof.
*
* => Look at the same cycle... | ALGO | 0.999991 | 4.691833 |
20129b8b-43b6-4c1c-8402-fd03a02609d8 | Mredul10/Figma-App-UI-Design | 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.998784 | 6.761023 |
78084545-d585-4f57-ae1f-84620a23448f | raincross7/code-similarity | codes/train_code/problem217/problem217_318.cpp | #include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using vi = vector<int>;
using vii = vector<vi>;
int main() {
int N;
cin >> N;
vector<string> W(N);
for(int i = 0; i < N; i++) {
cin >> W[i];
}
string ans = "Yes";
for(int i = 0;... | ALGO | 0.999961 | 4.309467 |
7824091b-7424-4f75-9044-4407cfa3b303 | OpenHUTB/engine_bak | Engine/Source/ThirdParty/PhysX3/APEX_1.4/module/destructible/fracture/Core/Delaunay2dBase.cpp | #include "RTdef.h"
#if RT_COMPILE
#include "Delaunay2dBase.h"
#include "PxBounds3.h"
#include <PxMath.h>
namespace nvidia
{
namespace fracture
{
namespace base
{
using namespace nvidia;
// -------------------------------------------------------------------------------------
Delaunay2d::Delaunay2d(SimScene* scene):
m... | ALGO | 0.990024 | 4.989594 |
c925aad2-aa57-4450-8dc3-b51513464f99 | abhishek-dhnma/DSA-Learning-Concepts | reversearray.cpp | #include<iostream>
using namespace std;
int main(){
int n;
cin>>n;
int arry[n];
for (int i = 0; i < n; i++)
{
cin>>arry[i];
}
cout<<"Original Array : ";
for (int i = 0; i < n; i++)
{
cout<<arry[i]<<endl;
}
int strt = 0, end = n-1;
for(int strt = 0; st... | ALGO | 0.999891 | 4.731667 |
43405bd9-d5f6-4ac4-9e8f-8fe065185f80 | Jhonatan-Yamil/Algoritmica | Kattis_onechicken.cpp | #include<iostream>
using namespace std;
int main()
{
int N,M;
cin>>N>>M;
int s=abs(N-M);
if(N<M){
if(s!=1){
cout<<"Dr. Chaz will have " << s << " pieces of chicken left over!";
} else{
cout<<"Dr. Chaz will have " << s << " piece of chicken left over!";
}
}else if(N>M){
if(s!=1){
... | ALGO | 0.999946 | 3.556806 |
5f0b2554-e248-491b-bc21-8b55fc4c382b | am1n000/LeetProblems | 1991-find-the-middle-index-in-array/1991-find-the-middle-index-in-array.cpp | class Solution {
public:
int findMiddleIndex(std::vector<int>& nums)
{
if (nums.size() == 1)
return (0);
int sum1 = std::accumulate(nums.begin(), nums.end(), 0);
int sum2 = 0;
int i = 0;
std::vector<int>::iterator f_index = nums.begin();
while (f_index... | ALGO | 0.999939 | 5.962351 |
a79739ae-4d35-4e86-89ff-26e150a8c719 | KausBoss/CP-SubGrouped | CodeForces/1427C.cpp | /*
*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define vi vector<int>
#define pb push_back
#define fi first
#define si second
#define pii pair<int,int>
#define vii vector<pair<int,int>>
#define F(a,n) for(int i=0;i... | ALGO | 0.99982 | 3.356093 |
acfbbeb8-99cf-48bf-b796-c288a9991384 | egormkn/ifmo-kt | course2/algorithms/crypto/C_bigprimes.cpp | #include <cstdio>
#include <cstdlib>
using namespace std;
long long mult(long long a, long long b, long long c) {
long long res = 0;
while (b > 0) {
if (b % 2 == 1) {
b--;
res = (res + a) % c;
}
a = (a + a) % c;
b /= 2;
}
return res;
}
long l... | ALGO | 0.999686 | 4.013091 |
1df2cc1e-4f26-4edc-baed-5b5ca20aa5c2 | prithvijitbasak/LeetCode-Solutions | 421. Maximum XOR of Two Numbers in an Array.cpp | //Editorial: https://youtu.be/EIhAwfHubE8, https://leetcode.com/problems/maximum-xor-of-two-numbers-in-an-array/discuss/1722683/C%2B%2B-Trie-Solution-or-Intuition-or-O(nlog(m))
class Node{
public:
Node* child[2];
Node()
{
this->child[0]=NULL;
this->child[1]=NULL;
}
};
class Solution ... | ALGO | 0.999976 | 5.619275 |
22d2effd-6e60-469e-9649-5881deed9704 | skbkontur/contests | internship_backend_apr25/jury_solutions/cpp/a.cpp | #include <iostream>
#include <set>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
const int allCardsCount = 52;
const set<char> all_suits = { 'C', 'D', 'H', 'S' };
const set<char> all_ranks = { '2', '3', '4', '5', '6', '7', '8', '9', 'T', 'J', 'Q', 'K', 'A' };
vector<string> read_cards... | ALGO | 0.98778 | 4.052854 |
2719b196-9bb6-4530-b125-a586c4b1199c | shr4mm/C- | LR6/main.cpp | #include <iostream>
int main() {
int N;
std::cout << "? เ ซ์ญฅ แซฎ N: ";
std::cin >> N;
if (N <= 0) {
std::cout << ": แซฎ N เ ซ์ญจ!" << std::endl;
return 1;
}
int product = 1; // โฎช , ? ? 7
bool hasDigitNotSeven = false; // เฅข?เช , , ??? ? 7
while (N > 0) {
int digit = N % ... | ALGO | 0.999456 | 5.517018 |
14af5739-381f-411b-88e0-d8b57b2072fc | WULEI7/WULEI7 | ACMไฟฑไน้จ/ๅคงไธไธๅญฆๆ่ฎญ็ป/็ฌฌ6ๅจไฝไธ๏ผๆทฑๆ ๅนฟๆ๏ผ/I - Hopscotch๏ผDFS๏ผset๏ผ.cpp | #include <cstdio>
#include <iostream>
#include <set>
using namespace std;
int x[6][6];
set <int> rec;
void dfs(int r,int c,int cur,int num)
{
if(cur==6)
{
rec.insert(num);
return;
}
//if(r<0||r>=5||c<0||c>=5) return;
if(r-1>=0)
dfs(r-1,c,cur+1,num*10+x[r-1][c]);
if(r+1<5)
dfs(r+1,c,cur+1,num*10+x[r+1][c])... | ALGO | 0.998095 | 3.643062 |
7471f2e5-06ea-4ce0-833a-0db77a38756e | jshilong/GPT4RoI | mmcv-1.4.7/mmcv/ops/csrc/onnxruntime/cpu/gridSample.cpp | #include "../ort_mmcv_utils.h"
#include "grid_sample.h"
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#define MAX(a, b) (((a) < (b)) ? (b) : (a))
#define CLIP_COORDINATES(in, out, clip_limit) \
out = MIN((clip_limit - 1), MAX(in, 0))
// modified from
// https://github.com/pytorch/pytorch/blob/master/aten/src/ATen/nat... | ALGO | 0.988683 | 7.315826 |
702e7c13-bf72-4aeb-a05f-57860b39cc7e | lucheng2/leetcode | leetcode/q5689/my.cpp | #include<iostream>
#include<vector>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<unordered_map>
using namespace std;
class Solution {
public:
int countMatches(vector<vector<string>>& items, string ruleKey, string ruleValue) {
int index = 0;
if(ruleKey == "color")
ind... | ALGO | 0.998251 | 5.360397 |
77b5831d-fce8-4d28-a50e-01fa2283659e | qing-del/DataStructAndAlgorithm | MyTest/Data_Struct/BigInt.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define il inline
#define rg register
const int N = 502;
class BigInt {
public:
int arr[N]; // ็ฌฌ้ถไฝไธ่ฝๆพๆฐๅญ
int size;
bool nagetive; // ๆฏๅฆไธบ่ดๆฐ
// ๆ้ ๅฝๆฐ
BigInt(const string& s = "0")
{
size = s.size();
int len = size;... | ALGO | 0.999657 | 3.978896 |
ee9d2a32-95bf-4c65-8765-640e65ba87b9 | Shreyanshraj12/assignment1 | question3.cpp | #include<bits/stdc++.h>
int searchInsert(std::vector<int>& nums, int target) {
int left = 0;
int right = nums.size();
while (left < right) {
int mid = left + (right - left) / 2;
if (nums[mid] == target) {
return mid;
} else if (nums[mid] < target) {
left = ... | ALGO | 0.999732 | 6.569029 |
cc58b480-a46d-484a-939a-c2631ffcd079 | Haeo/Acmicpc-cpp | General Math 1/11005.cpp | #include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main() {
int n, b;
cin >> n >> b;
string v = "";
string arr = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
while (n > 0) {
v.push_back(arr[n % b]);
n /= b;
}
reverse(v.begin(), v.end());
cout << v;
return 0;
}
| ALGO | 0.999798 | 4.158827 |
6e57c7b4-101f-45df-af5c-2eaab255fa5d | MohamadAshrafSalama/User-Stories-generation | Code_Snippets/221-230/s618935697.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(long long i = 0; i < (long long)(n); i++)
#define repi(i,a,b) for(long long i = (long long)(a); i < (long long)(b); i++)
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define fi first
#define se second
#define mt make_tuple
#define mp make... | ALGO | 0.999952 | 4.140085 |
81ebf80e-1410-4d03-aa65-ce92c6274f5f | ahmeddiab1234/LeetCode-Solving | LeetCode_75/DP_1D/198.House_Robber.cpp | // https://leetcode.com/problems/house-robber/description/?envType=study-plan-v2&envId=leetcode-75
#include <iostream>
#include <vector>
#include <cstring>
#include <climits>
using namespace std;
const int MAX_idx = 100+1;
int memory[MAX_idx];
vector<int> values;
class Solution {
public:
int dp(int idx){
... | ALGO | 0.999936 | 5.651947 |
ca8de126-8659-4952-85c0-6e64ef940146 | airynrinny/CPP_Codes | 2_2_answer.cpp | #include <iostream>
#include <iomanip>
using namespace std;
int main() {
double x1, y1, x2, y2, xm, ym;
cout << "Enter the coordinates of the first endpoint: ";
cin >> x1 >> y1;
cout << "Enter the coordinates of the second endpoint: ";
cin >> x2 >> y2;
xm = (x1 + x2) / 2;
ym = (y1 + y2) /... | ALGO | 0.999727 | 6.160737 |
71194268-93f5-4cb0-894c-00bd7b6370b0 | UCLA-VAST/Merlin-UCLA | trunk/regression_test/test_case/test_cases_unit/systolic_frontend/backend/matmul/test4/src/test.cpp | #pragma ACCEL kernel
void systolic_array_kernel(const float **A,const float **B,float **C)
{
#pragma ACCEL interface variable=A depth=256,128
#pragma ACCEL interface variable=B depth=256,128
#pragma ACCEL interface variable=C depth=256,256
#pragma ACCEL systolic
for (int k_outer = 0; k_outer < 1; ++k_out... | ALGO | 0.989473 | 3.374445 |
0d24287e-7fbd-4832-80f6-a71ec02280ed | tridibsamanta/Codeforces_Solutions | 1369B.cpp | /*
~ Author : @tridib_2003
*/
#pragma GCC optimize("O3")
// #pragma GCC optimize("Ofast")
// #pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag,
tree_orde... | ALGO | 0.999962 | 5.327634 |
6592c01f-36d6-44eb-bcb4-136aa259e6a1 | junweinehc/CppPractices | reference.cpp | #include <iostream>
using namespace std;
void passCopy(int x);
void passReference(int *y);
int main()
{
int lisa = 6;
int jj = 2;
passCopy(lisa);
passReference(&jj);
cout << "Lisa: " << lisa << endl;
cout << "jj: " << jj << endl;
}
void passCopy(int x)
{
x=10;
}
void passReference(int... | TOOL | 0.850307 | 3.937853 |
67ddb3fa-05d3-4485-865a-8e8a9213aa63 | aleepstapa/aleepstapa.github.io | homework/ไฝไธ/quicksort.cpp | #include <iostream>
#include <vector>
#include <chrono>
#include <fstream>
#include <random>
#include <cmath>
using namespace std;
// ่ฎก็ฎๅๅ
int partition(vector<int>& arr, int low, int high) {
int pivot = arr[high];
int i = low - 1;
for (int j = low; j <= high - 1; j++) {
if (arr[j] <= pivo... | ALGO | 0.999351 | 5.915139 |
7cd3f3d2-ab55-4306-8eed-de54d522d57d | cssartori/sorter | sorter/countingsort.cpp | #include "countingsort.h"
#include <sys/timeb.h>
std::vector<int> CountingSort::sort(std::vector<int> array){
timeb start, end;
ftime(&start); // start timer
int max = this->maxElement(&array);
std::vector<int> ra(array.size(), 0); //return array
std::vector<int> count(max+1, 0); //counting array... | ALGO | 0.999532 | 4.71511 |
e7a1c89a-be53-498a-a350-5461ce2b03f8 | NaveenJsr/C-Plus-Plus | math/gcd_recursive_euclidean.cpp | /**
* @file
* @brief Compute the greatest common denominator of two integers using
* *recursive form* of
* [Euclidean algorithm](https://en.wikipedia.org/wiki/Euclidean_algorithm)
*
* @see gcd_iterative_euclidean.cpp, gcd_of_n_numbers.cpp
*/
#include <iostream>
/**
* algorithm
*/
int gcd(int num1, int num2) {... | ALGO | 0.999939 | 6.978758 |
4b4149cb-4d22-42d5-b11e-c7b36fc60620 | stopmin/Algorithmic-Problem-Solving-Strategies | pykido/brute_force/algospot/BOGGLE.cpp | // ์ข
๋ง๋ถ p.150 ๋ณด๊ธ๊ฒ์ (๋ฌธ์ ID : BOGGLE, ๋์ด๋ : ํ)
// 1. ๋ธ๋ฃจํธ ํฌ์ค๋ก ํ์์.
// 2. ์
๋ ฅ์ด ์๋ชป๋๊ฑฐ๋ ๋ฒ์์์ ๋ฒ์ด๋ ๊ฒฝ์ฐ ๊ธฐ์ ์ฌ๋ก๋ก ํํด ๋งจ ์ฒ์์ ์ฒ๋ฆฌํ์!
// 3. ์ต์
์ ๊ฒฝ์ฐ ๋จ์ด ๊ธธ์ด N์ ๋ํด ๋งค๋ฒ 8์นธ์ฉ ๊ฒ์ฌํ๋ฏ๋ก ์๊ฐ ๋ณต์ก๋๋ O(8**N)์ด๋ค.
#include <iostream>
using namespace std;
int dr[8] = {-1,0,1,-1, 1,-1,0,1};
int dc[8] = {1,1,1,0,0,-1,-1,-1};
int C, N;
char board[5][5];
//
bool... | ALGO | 0.99982 | 5.649764 |
84958476-455d-4b49-9d51-3c298c0d1f97 | Toysoft/NNvision | darknet_nvenc/opencv-3.4.4/modules/features2d/src/bagofwords.cpp | #include "precomp.hpp"
namespace cv
{
BOWTrainer::BOWTrainer() : size(0)
{}
BOWTrainer::~BOWTrainer()
{}
void BOWTrainer::add( const Mat& _descriptors )
{
CV_Assert( !_descriptors.empty() );
if( !descriptors.empty() )
{
CV_Assert( descriptors[0].cols == _descriptors.cols );
CV_Assert( de... | ALGO | 0.965641 | 6.564444 |
389820a9-3759-4e97-9951-6ed7564ef8df | gulmoharrizvi/SC-lab | lab12.cpp | #include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>
#include <bits/stdc++.h>
using namespace std;
const double PI = 3.141592653589793;
const double alpha = 1.0;
double initialCondition(double x) {
return sin(100 * PI * x) + sin(50 * PI * x);
}
void thomasSolver(const std::vector<double>& a,... | ALGO | 0.999951 | 4.158957 |
079dde05-89d6-4054-8a94-87be9011c47d | NafiHasan/HabiJabi | C++/Collab/icpc coll/a.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define en "\n"
#define fast_io() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define w(t) int t; cin >> t; while (t--)
int main()
{
fast_io();
int a,b,c;
cin >> a >>b >>c;
int cnt=0;
for (int i=-100; i<101; i++){
fo... | ALGO | 0.999804 | 3.903641 |
0eaf6dd0-f67a-4a81-b693-d14d249f786f | anagorko/informatyka | home/lukom/nicolo_Tartaglii.cpp | #include<iostream>
using namespace std;
int cz(long long int _p, long long int _q,long long int _x){
int p[20],q[20], x[20], w[20];
for(int i=19;i>=0;i--){
p[i] = _p%10;
_p /= 10;
q[i] = _q%10;
_q /= 10;
x[i] = _x%10;
_x /= 10;
w[i]=0;
}
cout<<"p:";
for(int i=0;i<20;i++)cout<<p[i];
cout<<"\n... | ALGO | 0.999926 | 3.366967 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.