uuid stringlengths 36 36 | repo_name stringlengths 5 123 | relative_path stringlengths 5 4k | content stringlengths 33 2.85M | category stringclasses 6
values | algo_rel_score float64 0.85 1 | quality_score float64 3 8.76 |
|---|---|---|---|---|---|---|
b858e849-2060-4c78-abdf-e810cd054eb5 | ohgnakrap9290/CodeTree | 250708/짝수만 출력/output-only-even.cpp | #include <iostream>
using namespace std;
int main() {
// Please write your code here.
int a,b;
cin>>a>>b;
while(a<=b){
cout<<a<<' ';
a+=2;
}
return 0;
} | ALGO | 0.996919 | 3.32644 |
8dd69b77-0da2-412b-959b-1982f4fe9bf8 | Mrsuyi/algorithm | leetcode/232.cpp | #include <iostream>
#include <vector>
#include <stack>
#include <string>
#include <unordered_map>
using namespace std;
class Queue {
public:
stack<int> s;
// Push element x to the back of queue.
void push(int x)
{
s.push(x);
}
// Removes the element from in front of queue.
void pop(void)
{
stack<int> t... | ALGO | 0.978855 | 3.765531 |
44a6dad4-b7ad-4682-86fe-a1c11dfd5b00 | Jumpoutbush/test-main | PAT/A1053.cpp | #include<bits/stdc++.h>
using namespace std;
const int maxn = 110;
int n, m, S;
struct node{
int weight;
vector<int> child;
}Node[maxn];
vector<int> path;
vector<vector<int>> ans;
void DFS(int index, vector<int> path, int sum)
{
if(sum > S) return;
if(sum == S)
{
if(Node[index].child.size() ... | ALGO | 0.999975 | 3.380202 |
59c08841-7323-43c1-815f-da928240b578 | LuLuPan/lc1 | watertrap.cpp | class Solution {
public:
int trap(int A[], int n) {
if (n <= 2) return 0;
int max = 0;
int water = 0;
for (int i = 0; i < n; i++)
if (A[i] > A[max])
max = i;
for (int i = 0, peak = 0; i < max; i++) {
if (A[i] > peak) peak = A[i];
else w... | ALGO | 0.999952 | 6.151157 |
4cb21ed2-7698-4961-972c-7102db66f544 | natipt/CSC2549-Phys-based-animation | CSC2549-a1-mass-spring-1d/src/dV_spring_particle_particle_dq.cpp | #include <dV_spring_particle_particle_dq.h>
void dV_spring_particle_particle_dq(Eigen::VectorXd &dV, const Eigen::VectorXd &q, double stiffness) {
dV.resize(1);
dV = q * stiffness;
}
| ALGO | 0.971038 | 4.404937 |
da7b1353-a0aa-4bfa-a5a0-64b2c7dc6bac | shubhamjoshi24/CPP_CWH | function_pointer.cpp | #include <bits/stdc++.h>
using namespace std;
int sum(int a, int b)
{
return a + b;
}
int main()
{
cout << "Sum : " << sum(8, 9) << endl;
int (*fptr)(int, int); // declaring a function pointer
fptr = ∑ // creating a function pointer.
int d = (*fptr)(45, 43); // derefrencing a function ... | ALGO | 0.965372 | 4.899485 |
b6d82241-891d-4f15-b68d-fcac99870db8 | cliffszz/Leetcode | Cpp/HOT 100/84_largestArea.cpp | //https://leetcode-cn.com/problems/largest-rectangle-in-histogram/
#include <type_traits>
#include <vector>
#include <stack>
#include <algorithm>
using namespace std;
//O(N^2),暴力法超时
class Solution {
public:
int largestRectangleArea(vector<int>& heights) {
int res = 0;
int n = heights.size();
... | ALGO | 0.999831 | 6.595355 |
a4378903-11c2-474e-bae9-ecf247dfdbb6 | Paponsaeja/ENGCE117-lab | lab 12/lab_12.2.cpp | #include <stdio.h>
#include <algorithm>
using namespace std;
struct Item {
int weight;
int value;
};
bool compare(Item i1, Item i2) {
return ((double) i1.value / i1.weight) > ((double) i2.value / i2.weight);
}
int *KnapsackGreedy(int *w, int *v, int n, int wx) {
Item items[n];
int *x = new int[... | ALGO | 0.99996 | 3.975603 |
f26009fa-4d93-46a3-b7b0-43501bf73e25 | dinkoosmankovic/RPMPLv2 | src/state_spaces/Tree.cpp | //
// Created by nermin on 18.02.22.
//
#include "Tree.h"
base::Tree::Tree(std::string tree_name_, uint tree_num_)
{
tree_name = tree_name_;
tree_idx = tree_num_;
}
void base::Tree::clearTree()
{
states->clear();
}
std::shared_ptr<base::State> base::Tree::getNearestState(std::shared_ptr<base::State> q)
{
const ... | ALGO | 0.991079 | 4.643553 |
de8f2f84-2983-4c8f-a41b-87b6491e03df | airhood/BOJ | 05xxx/5341.cpp | #include <iostream>
using namespace std;
int main() {
while (true) {
int n;
cin >> n;
if (n == 0)
break;
cout << n * (n + 1) / 2 << endl;
}
} | ALGO | 0.999728 | 5.316356 |
2bd39cb9-d3ae-46e1-aa63-98ee23923b29 | DillonWall/CompetitiveProgramming | Sandbox.cpp | #include <bits/stdc++.h>
using namespace std;
// Templates that extend ostream
template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; }
template<typename T_container, typename T = typename enable_if<!is_same<T_container, string>... | ALGO | 0.999924 | 5.00048 |
8bdae7b9-7485-4534-9937-393e13b612d7 | Heych88/udacity-sdcnd-path-planning | src/Eigen-3.3/bench/benchVecAdd.cpp |
#include <iostream>
#include <Eigen/Core>
#include <bench/BenchTimer.h>
using namespace Eigen;
#ifndef SIZE
#define SIZE 50
#endif
#ifndef REPEAT
#define REPEAT 10000
#endif
typedef float Scalar;
__attribute__ ((noinline)) void benchVec(Scalar* a, Scalar* b, Scalar* c, int size);
__attribute__ ((noinline)) void be... | TOOL | 0.86376 | 5.111393 |
bfa931e9-7e64-46a4-86aa-f9c30d48bacb | nachiketjoshi19/CPP | TicTacToe/TicTacToe.cpp |
#include <iostream>
using namespace std;
class TicTacToe
{
private:
char matrix[10] = {'o', '1', '2', '3', '4', '5', '6', '7', '8', '9'};
int choice, player = 1;
int gameStatus;
char mark;
int checkForWin()
{
int returnValue = 0;
if (matrix[1] == matrix[2] && matrix[2] == matri... | ALGO | 0.990923 | 4.713644 |
c9c850ce-1267-4fe9-929e-89ad38314dda | devKiam/OS_Lab | LRU_page_replacement.cpp | #include<bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
int main()
{
ios_base::sync_with_stdio(false); cin.tie(nullptr);
cout << "size of reference string : " << endl;
int reference_string_size; cin >> reference_string_size;
cout << "Enter reference string :... | ALGO | 0.998739 | 4.303469 |
780ca71c-128d-404a-aae0-8a45704c83cf | Mahmoud-nfz/LeetCode-Solutions | easy/range_sum_query_-_immutable/Solution.cpp | class NumArray {
public:
// Dynamic programming array to store cumulative sums
vector<int> dp;
NumArray(vector<int>& nums) {
// Resize dp array with size nums.size() + 1 and initialize all elements to 0
dp.resize(nums.size() + 1, 0);
for (int i = 1; i < nums.size() + 1; i++) {
... | ALGO | 0.999954 | 7.280031 |
6e81c3b2-b161-4044-b038-68f35fb12b8d | maventura/uba-scmp-2017-1c | guide-3/ej1/explicit/main.cpp | #include <iostream>
#include <vector>
#include <chrono> // for high_resolution_clock.
#include "../../../mat/mat.h"
using namespace std;
int main() {
long double m = 1.0 / 1000.0; //kg.
long double xMax = 1.0; //meters
long double tMax = 0.03; //tMin a... | ALGO | 0.999604 | 4.051404 |
cc1279b2-4b84-4818-a2a5-aa472f6b36ea | tangzhanran/LeetCodes | MergeIntervals.cpp | // 56. Merge Intervals
//
// Given a collection of intervals, merge all overlapping intervals.
//
// For example,
// Given[1, 3], [2, 6], [8, 10], [15, 18],
// return[1, 6], [8, 10], [15, 18].
//
// Written by Zhanran Tang @ 5/29/2017
//
// Ideas: Sort intervals by start, than merge.
// Complexity: O(nlogn) in time, O(... | ALGO | 0.988949 | 5.817058 |
12c2b151-4261-4922-b5e6-ad59f31f4422 | vlsi-nanocomputing/Octantis | llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp | #include "llvm/CodeGen/GlobalISel/IRTranslator.h"
#include "llvm/ADT/PostOrderIterator.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/ScopeExit.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/Analysis/BranchProbabilityInfo.h"
#include "llvm/Analysis/OptimizationRemarkEmitter.h"... | TOOL | 0.936539 | 6.658412 |
9cea3dd4-12c6-45a2-8e01-709b60791c59 | Chandan07-lab/LEETCODE_PROBLEMS | 2067-maximum-number-of-points-with-cost/maximum-number-of-points-with-cost.cpp | class Solution {
public:
typedef long long ll;
long long maxPoints(vector<vector<int>>& points) {
int m=points.size(),n=points[0].size();
vector<ll> prev(n);
int score=0;
for(int col=0;col<n;col++){
prev[col]=points[0][col];
}
for(int i=1;i<m;i++){
vector<ll>curr(... | ALGO | 0.999978 | 5.668132 |
f4f2b358-f4b3-4042-a90d-1ee13db794e7 | nabiha45/CSE-216 | topsortchar.cpp | #include <bits/stdc++.h>
using namespace std;
map<string, vector<string>> adj;
map<string, int> degree;
set <string> nodes;
vector<string> ans;
int n;
bool topsort()
{
queue<string> qu;
for(string i: nodes)
{
if(degree[i]==0) qu.push(i);
}
while(!qu.empty())
{
string top= qu... | ALGO | 0.999999 | 4.771502 |
60a18335-4947-4132-a389-8a4f186f671d | rpuntaie/c-examples | cpp/algorithm_ranges_generate_n.cpp | /*
g++ --std=c++20 -pthread -o ../_build/cpp/algorithm_ranges_generate_n.exe ./cpp/algorithm_ranges_generate_n.cpp && (cd ../_build/cpp/;./algorithm_ranges_generate_n.exe)
https://en.cppreference.com/w/cpp/algorithm/ranges/generate_n
*/
#include <algorithm>
#include <array>
#include <iostream>
#include <random>
#includ... | TOOL | 0.912915 | 6.197895 |
c9865436-054a-4069-8862-7adfa9df5805 | KiwawaXC/frameworks_av | media/libstagefright/xmlparser/MediaCodecsXmlParser.cpp | #define LOG_NDEBUG 0
#define PROP_VALUE_MAX 92
#define LOG_TAG "MediaCodecsXmlParser"
#include <media/stagefright/xmlparser/MediaCodecsXmlParser.h>
#include <android-base/logging.h>
#include <android-base/macros.h>
#include <android-base/properties.h>
#include <utils/Log.h>
#include <media/stagefright/MediaErrors.h>... | TOOL | 0.974319 | 3.43332 |
b275c2b6-db54-49d0-89ed-b09635a7e604 | jiejuanliu/DataStructure_learning | palindrome_permutation/main.cpp | /*
* File: main.cpp
* Author: jiejuan.liu
*
* Created on 14 September, 2018, 4:25 PM
*/
#include <cstdlib>
#include <array>
#include <iostream>
#include <vector>
#include <unordered_map>
using namespace std;
/*
*
*/
template<typename ForwardIter>
bool is_palindrome_permutation(ForwardIter begin, ForwardI... | ALGO | 0.998662 | 5.135554 |
08251fdd-690e-4764-8671-228375b42b5a | lihuanshuai/chai3d | src/math/CVector3d.cpp | //===========================================================================
//===========================================================================
//---------------------------------------------------------------------------
#include "math/CVector3d.h"
#include "math/CMaths.h"
//-----------------------------... | TOOL | 0.997257 | 5.830488 |
dfeefae6-12a2-4ceb-bf12-26ff5b359021 | ishandutta2007/codeforces | ppavic/normal/1083/E.cpp | #include <cstdio>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <algorithm>
#include <vector>
#include <set>
#include <queue>
#include <iostream>
#include <string>
#define X first
#define Y second
#define MP make_pair
#define PB push_back
using namespace std;
typedef long long ll;
typedef long doub... | ALGO | 0.998798 | 3.686268 |
1e4ba059-0b93-47d7-9462-25fe84940555 | Adam-Ismaili-92/OPENGL | src/thunder.cpp |
#include "thunder.hh"
#include <iostream>
std::default_random_engine generator(time(0));
std::uniform_real_distribution<float> distribution(0.01f, 1.0f);
std::uniform_real_distribution<float> distribution2(10.f, 15.f);
std::uniform_real_distribution<float> distribution3(0.1f, 0.5f);
std::pair<Node *, unsigned int> ... | ALGO | 0.979497 | 4.710291 |
5a1ad1b3-10b5-4d83-833b-7c8429b133ce | DeepWaterGames/FrontLine | Source/Frontline Engine/Additional Libraries/Includes/PHYSICS/BulletCollision/CollisionDispatch/btBoxBoxDetector.cpp | ///ODE box-box collision detection is adapted to work with Bullet
#include "btBoxBoxDetector.h"
#include "BulletCollision/CollisionShapes/btBoxShape.h"
#include <float.h>
#include <string.h>
btBoxBoxDetector::btBoxBoxDetector(const btBoxShape* box1,const btBoxShape* box2)
: m_box1(box1),
m_box2(box2)
{
}
// given ... | ALGO | 0.999379 | 6.403652 |
5f7461c3-b7f9-4d0d-9a37-99c1cf8a959a | avarshvir/cpp_programming_language | 13_pointers/pointer_7.cpp | #include <iostream>
using namespace std;
int main() {
int arr[5] = {1, 2, 3, 4, 5};
int* ptr = arr;
int** ptr2 = &ptr;
cout << "Using single pointer:" << endl;
for (int i = 0; i < 5; ++i) {
cout << "i: " << i << endl;
cout << "Address using (ptr + i): " << (ptr + i) << endl;
... | ALGO | 0.996434 | 5.149486 |
303be5aa-a076-4209-9405-82a0aacc0cd8 | dianapaula19/data-structures-and-algorithms-course | teme/tema_2/tema_2_1+2/main.cpp | #include <iostream>
using namespace std;
typedef struct node{
int value;
node* next;
};
void switch_node(node*& head, node*& tail){
int x;
cout << "Introduceti o optiune noua: " << endl;
cin >> x;
while(x){
switch(x){
case 1:{
cout << "1.A" << endl;
cout... | ALGO | 0.996665 | 3.774669 |
077344fb-90cd-4242-9ea9-03f5e209095b | ishandutta2007/codeforces | sdya/normal/142/A.cpp | #include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cstring>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <ctime>
#pragma comment (linker, "/STACK:256000000")
using namespace std;
int main() {
//freopen("input.txt", "r... | ALGO | 0.999921 | 3.996207 |
48987431-66df-4778-9a26-5d2361d56a76 | magyarakoos/aoc | 2022/06/main.cpp | #include <bits/stdc++.h>
using namespace std;
int solve(const string& s,int n) {
for (int i = n - 1; i < s.size(); i++) {
set<char> cs;
for (int j = i - n; j < i && j < s.size(); j++) cs.insert(s[j]);
if (cs.size() == n) {
return i;
}
}
return 0;
}
int main() {... | ALGO | 0.999839 | 4.362197 |
1fb19ae7-5ffb-4743-ad5a-399e7fdfb42c | ComputationalBiomechanicsLab/opensim-creator | third_party/libosim/simbody/examples/Rattleback.cpp | /* This example is for experimenting with ellipsoid contact which was
introduced in Simbody 2.2.
*/
#include "Simbody.h"
#include <cstdio>
#include <exception>
#include <algorithm>
#include <iostream>
#include <fstream>
using std::cout; using std::endl;
using namespace SimTK;
Array_<State> saveEm;
const Real Cm2m... | ALGO | 0.963947 | 5.737612 |
48bb048f-29cc-48e8-b5af-01dae98877d0 | SUJAN-BA/ADA-lab | BFS.cpp | #include<iostream>
using namespace std;
void BFS(int cost[10][10],int visited[10],int source,int n){
int queue[10],u,v;
int f=0,r=-1;
queue[++r]=source;
while(f<=r){//until queue get empty
u=queue[f++];
for(v=1;v<=n;v++){
if(cost[u][v]==1 && visited[v]==0){
queue[++r]=v;
... | ALGO | 0.999956 | 4.193398 |
8eb7bfa7-c1f4-411b-bddf-e86359588292 | neroAzsy12/Open-Kattis | C++/hailstone.cpp | #include <iostream>
using namespace std;
int main() {
long result = 0;
long num;
cin >> num;
while (num != 1) {
result += num;
if (num % 2 == 0) {
num /= 2;
} else {
num = (3 * num) + 1;
}
}
result++;
cout << result << endl;
} | ALGO | 0.999954 | 5.053162 |
342f5b4d-ff9b-4deb-91a6-6f7e821d1b9b | aditiangra/Leetcode-daily-practice | 538-convert-bst-to-greater-tree/538-convert-bst-to-greater-tree.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.999889 | 6.451468 |
54cf7a0a-fa9e-484d-9be6-43252c3ca4b5 | dwpark10/CPP | SWAcademy/4012.cpp | #include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
using namespace std;
int sny[17][17];
int ans;
void DoProcess(int tot, int rem, bool *check, int start){
if(rem == 0){
int A, B;
A = 0;
B = 0;
for(int i = 1; i < tot; i++){
for(int j = i+1; j <= tot; j++){
if(i == j){
... | ALGO | 0.999392 | 3.911465 |
ffac8c4b-e696-4fa3-b04d-ce4886c9b980 | rabelhmd/LeetCode | 0118-pascals-triangle/0118-pascals-triangle.cpp | class Solution {
public:
vector<vector<int>> generate(int r) {
vector<vector<int>> ret(r);
for(int i = 0; i < r; i++) {
ret[i].push_back(1);
for(int j = 1; j < i; j++) {
ret[i].push_back(ret[i-1][j-1] + ret[i-1][j]);
}
if(i) ret[i].push... | ALGO | 0.999875 | 4.781499 |
fa0daded-a58b-49ef-9e41-b55fe75edaa9 | xflash96/morphaca | polymorph/main.cpp | /* from http://www.opencv.org.cn/index.php */
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <opencv2/opencv.hpp>
#include <ctime>
#include "parser.h"
#include "morph_lib.h"
using namespace cv ;
using namespace std ;
int main( int argc, char *argv[] )
{
PARA p... | ALGO | 0.974746 | 4.063473 |
b26a9e0e-73b5-4996-8560-3672cceb401b | himmetardaa/Habbitty-App | habbitty/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.998295 | 6.76073 |
3e8e860f-5b91-452f-90b4-fc0763356621 | marcelcorso/soundchat | 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.998693 | 6.797273 |
1eaf1e31-b73a-4355-b9b3-5846edbffb2c | ankit1519/competitive-programming-codes | BuyAshovel.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int k,r;
cin>>k>>r;
for(int i=1;i<INT_MAX;i++){
int num=k*i;
if(num%10==0 ||num%10==r){
cout<<i;
return 0;
}
}
} | ALGO | 0.99902 | 3.326551 |
8c173151-f6a9-4e67-a053-6041b52bdb8f | murilopava/primeiro-semestre-faculdade | trabalho-av2-algotimo-e-programacao/exercicio_3.cpp | #include <iostream>
using namespace std;
int main(){
double valor;
int quantCedulamoeda;
cout << "Indique o valor a ser decomposto: ";
cin >> valor;
cout << "O valor vai receber:" << endl;
while (valor != 0.01){
if (valor >= 100){
quantCedulamoeda = int(valor / 100);
... | ALGO | 0.984549 | 4.157379 |
e65d7f00-c338-4c67-b38a-dd1511ae6ab5 | stardog-union/boost | libs/xpressive/tools/perl2xpr.cpp | #include <stack>
#include <string>
#include <iostream>
#include <boost/xpressive/xpressive_static.hpp>
#include <boost/xpressive/regex_actions.hpp>
namespace x = boost::xpressive;
using namespace x;
int main(int argc, char *argv[])
{
int i = 1, j = 1;
bool nocase = false;
char const *dot = " ~_n ";
ch... | TOOL | 0.980926 | 4.996734 |
dc8e1306-43b8-4e60-8674-c04e3a6cdc89 | Divya292206/SE__WORK | Module-3(c++_lan)/18-7/structure.cpp | //structure
#include <iostream>
using namespace std;
struct rect
{
float width,height;
};
int main()
{
struct rect r1;
r1.height = 10.5;
r1.width = 20.6;
cout<<"Area of Rect is :"<<r1.height*r1.width<<endl;
return 0;
}
| TOOL | 0.88031 | 3.495472 |
d0e039ad-166d-49f3-9885-a98560b742e4 | jojeongmin304/SEA-ME_warmup | Module00/PhoneBook.cpp | #include <iostream>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;
//class of making a contact(declaratives)
class Contact{
private:
string name;
string phoneNumber;
string nickName;
bool isBookmarked;
public:
Contact(string name, string phonenumber, string nickname)... | TOOL | 0.995764 | 5.1568 |
84c8e29c-e2d1-4629-8194-ffcba43c976d | sparkrider/trustwallet-core | src/XRP/Entry.cpp | #include "Entry.h"
#include "Address.h"
#include "XAddress.h"
#include "Signer.h"
#include "../proto/TransactionCompiler.pb.h"
namespace TW::Ripple {
// Note: avoid business logic from here, rather just call into classes like Address, Signer, etc.
bool Entry::validateAddress([[maybe_unused]] TWCoinType coin, const ... | TOOL | 0.86186 | 7.932421 |
d88419ed-76dc-4e07-9a2a-1fce745192d1 | spacefarers/cp | problems/codeforces/SIT/H.cpp | #include <iostream>
using namespace std;
bool gone_bad[1000005];
int main(){
int n, k;
string c;
cin>>n>>k>>c;
int last_bad=-0x7fffffff;
for (int i=0;i<n;i++){
if (c[i]=='*') last_bad=i;
if (last_bad+k>=i) gone_bad[i]=true;
}
last_bad=0x7fffffff;
for (int i=n-1;i>=0;i-... | ALGO | 0.999893 | 3.169853 |
bc1c5107-5a68-4cb5-b59e-aa1c7230c18a | swarajkumarsingh/DSA-ALGO | Materials/fraz notes/Notes/01. Graphs/04. CycleDetection/1. DetectCycleUndirectedGraph.cpp | #include<bits/stdc++.h>
using namespace std;
bool detectCycle(unordered_map<int, vector<int>>& m, unordered_set<int>& visited, int node, int parent) {
visited.insert(node);
for(auto nbr: m[node]) {
if(visited.find(nbr) == visited.end()) {
if(detectCycle(m,visited,nbr,node)) return true;
}
else if(nbr != par... | ALGO | 0.99991 | 5.302523 |
dabf881c-8325-4dc1-bd84-b5978e01193d | MdRifathSharker/Competitive-programming | C_Similar_Pairs.cpp | #include<bits/stdc++.h>
using namespace std;
int main ()
{
int t;
cin>>t;
while(t--){
int n;
cin>>n;
int a[n];
for(int i=0;i<n;i++){
cin>>a[i];
}
sort(a,a+n);
int odd=0,even=0,x=0,y=0,z=0;
for(int i=0;i<n;i++){
if(a[i]%2... | ALGO | 0.999694 | 4.107173 |
4d4e51c8-8815-4136-9300-7cf9ba8fbec4 | ishandutta2007/codeforces | fishcathu/normal/1474/B.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2E5+10;
ll read()
{
ll a=0;
char b=1,c;
do if((c=getchar())==45)b=-1;while(c<48||c>57);
do a=(a<<3)+(a<<1)+(c&15);while((c=getchar())>47&&c<58);
return a*b;
}
void write(ll x,char c)
{
if(x<0)putchar('-'),x=-x;
char ... | ALGO | 0.999895 | 3.41515 |
400021e5-531d-47c4-ae0b-86588ec2070a | jmh0434/CodingTest_Python | Binarysearch/binary/binary_recursion/binary_recursion.cpp | #include <bits/stdc++.h>
using namespace std;
int binary_search(vector<int> &array, int target, int start, int end)
{
if (start > end)
return -1;
int mid = (start + end) / 2;
if (array[mid] == target)
return mid;
else if (array[mid] > target)
return binary_search(array, target,... | ALGO | 0.99996 | 6.353824 |
fb18abfe-d6ec-4e5a-99fa-fcafc6fa4f60 | yonsei-hpcp/gcom | third-party/boost_1_86_0/libs/graph/example/family_tree.cpp | enum family
{
Jeanie,
Debbie,
Rick,
John,
Amanda,
Margaret,
Benjamin,
N
};
int main()
{
using namespace boost;
const char* name[] = { "Jeanie", "Debbie", "Rick", "John", "Amanda",
"Margaret", "Benjamin" };
adjacency_list<> g(N);
add_edge(Jeanie, Debbie, g);
a... | ALGO | 0.981772 | 4.266905 |
45b82e31-ddea-4d5e-9ba1-d62e05111e19 | ACamaian/ActarDemonstrator-analysis-tool | hough/transformation/eigen_build/doc/snippets/compile_Cwise_boolean_or.cpp | static bool eigen_did_assert = false;
#define eigen_assert(X) if(!eigen_did_assert && !(X)){ std::cout << "### Assertion raised in " << __FILE__ << ":" << __LINE__ << ":\n" #X << "\n### The following would happen without assertions:\n"; eigen_did_assert = true;}
#include <iostream>
#include <Eigen/Eigen>
#ifndef M_PI... | TOOL | 0.977231 | 3.645743 |
f8ae6b69-6e32-40ea-a01d-af05aa4a5f69 | rladbwlsdlwl/Leetcode | ConstructBinaryTreefromPreorderandInorderTraversal.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), le... | ALGO | 0.999993 | 6.415275 |
16b207a0-8438-4342-9b3a-0cf630a11a92 | das-ankur/Daily-Problem-Solving | 0493-reverse-pairs/0493-reverse-pairs.cpp | class Solution {
public:
/*
// Brute Force
int reversePairs(vector<int>& nums) {
int res=0;
for(int i=0;i<nums.size();i++) {
for(int j=i+1;j<nums.size();j++) {
if(nums[i]>2*nums[j]) res++;
}
}
return res;
}
*/
int merge(vect... | ALGO | 0.99943 | 5.435956 |
3ed17b3e-a17e-4b9d-852c-fb61cbd2af17 | lee-honey/Baekjoon | C++/백트래킹/14620.cpp | #include <iostream>
#include <algorithm>
#define MAX 2147483647
using namespace std;
int N(0);
int arr[11][11] = {0,};
bool bIsVisited[11][11] = {false,};
int ans(MAX);
void BackTracking(int depth, int cost)
{
if(depth == 3)
{
ans = min(ans, cost);
return ;
}
for(int i = 1; i < N - 1;... | ALGO | 0.999954 | 4.004695 |
04dc6930-a72c-46e2-8ab9-e3ee5a7ec4c0 | ToLoveToFeel/LeetCode | Cplusplus/_0260_Single_Number_III/_0260_main.cpp | // Created by WXX on 2021/1/29 20:04
#include <iostream>
#include <vector>
using namespace std;
/**
* 执行用时:8 ms, 在所有 C++ 提交中击败了96.95%的用户
* 内存消耗:9.8 MB, 在所有 C++ 提交中击败了89.78%的用户
*/
class Solution {
public:
int get(vector<int> &nums, int k, int t) {
int res = 0;
for (auto x : nums)
if... | ALGO | 0.999997 | 5.299222 |
86915886-09dd-4530-849b-b77b821bb85e | HPI-Artificial-Intelligence-Teaching/25-pt2 | unit7/hash_st_test.cpp | /******************************************************************************
*
* A symbol table implemented with a separate-chaining hash table.
*
* Based on the source code from Robert Sedgewick and Kevin Wayne at https://algs4.cs.princeton.edu/
*
*
* % ./hash_st_test < ../data/tinyST.txt
* R 3
* S 0
*... | ALGO | 0.917655 | 5.071241 |
5f7e53b1-c775-475d-b096-ccac4048a573 | ashoktamang/cs2labs | lab5/main.cpp | #include "StackType.h"
#include <iostream>
#include <ctime>
#include <cstdlib>
#include <cstdio>
#include <fstream>
using namespace std;
bool validSyntax(ifstream &inputfile);
int main()
{
StackType stack1;
StackType stack2;
StackType stack3;
srand(time(NULL));
int index = 0;
int temp_array[MAX_ITEMS];
//... | ALGO | 0.983897 | 4.231675 |
0e57cb4f-0540-42c6-b90c-d29bb78f65c7 | Ncoder50/challenges | c++/bridge/bridge.cpp | #include <iostream>
#include <stdlib.h>
bool isSafeBridge(std::string bridge);
int main() {
std::cout << std::boolalpha;
std::cout << "======= Test of bridges =====" << std::endl;
std::cout << isSafeBridge("####") << std::endl;
std::cout << isSafeBridge("## ###") << std::endl;
std::cout << isSafeB... | ALGO | 0.973189 | 4.732194 |
4c15ebff-b23f-4007-8815-9fe43b3d76ea | VansonLeung/flutter_llama_cpp_dart_lib | llamasrc/llama.cpp/examples/tokenize/tokenize.cpp | #include "common.h"
#include "llama.h"
#include <cmath>
#include <cstdio>
#include <fstream>
#include <string>
#include <vector>
#if defined(_WIN32)
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <shellapi.h> // For CommandLineToArgvW
#endif
static void print_usage_information(const char * argv0, FILE *... | TOOL | 0.928783 | 7.395616 |
173bbe66-6d06-4b84-a7bb-0b969b17a048 | franzcrs/openpose-with-caffe-for-MacM1 | src/openpose/core/keepTopNPeople.cpp | #include <openpose/core/keepTopNPeople.hpp>
#include <algorithm> // std::sort
#include <cmath> // std::sqrt
#include <openpose/utilities/keypoint.hpp>
namespace op
{
KeepTopNPeople::KeepTopNPeople(const int numberPeopleMax) :
mNumberPeopleMax{numberPeopleMax}
{
}
KeepTopNPeople::~KeepTopNPeopl... | ALGO | 0.998545 | 7.00361 |
cf0ff1f1-3494-431c-b17e-280d23c97d1d | HONGYANGGAN/leetcode | solution/2900-2999/2944.Minimum Number of Coins for Fruits/Solution3.cpp | class Solution {
public:
int minimumCoins(vector<int>& prices) {
int n = prices.size();
deque<int> q;
for (int i = n; i; --i) {
while (q.size() && q.front() > i * 2 + 1) {
q.pop_front();
}
if (i <= (n - 1) / 2) {
prices[i - ... | ALGO | 0.99977 | 5.668044 |
4dbf0b50-7406-4fe9-9dae-c0ca84b97c46 | ZongleiJiao/OntologyViewer | libogdf/src/augmentation/PlanarAugmentationFix.cpp | /*
* $Revision: 1.8 $
*
* last checkin:
* $Author: gutwenger $
* $Date: 2007-12-14 15:22:22 +0100 (Fri, 14 Dec 2007) $
***************************************************************/
#include <ogdf/augmentation/PlanarAugmentationFix.h>
#include <ogdf/basic/simple_graph_alg.h>
#include <ogdf/planarity/Plan... | ALGO | 0.997951 | 3.00058 |
3b390518-1d1d-4dec-b3f5-47f53d80c4f8 | tiankonguse/ACM | manger/递推/递推/习题/source/陈嘉润/ball2.cpp | #include<fstream>
using namespace std;
long ball,box,i,j,f[21][21];
int main()
{
ifstream fin("ball2.in");
ofstream fout("ball2.out");
fin>>ball>>box;
for(i=1;i<=ball;i++)
f[i][1]=1;
for(i=1;i<=ball;i++)
{
f[i][i]=1;
for(j=1;j<i;j++)
f[i][j]=f[i-1][j-1]+f[i-1][j]*j;
}
fout<<f[... | ALGO | 0.999901 | 3.337009 |
3753dae8-a341-445b-a144-21a3bbfd97d6 | giovaneaf/CompetitiveProgramming | Contests/Benelux Algorithm Programming Contest (BAPC)/Regular/2018/H.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef pair<int, bool> ib;
#define FOR(a, b, c) for(int a = b; a < c; ++a)
#define RFOR(a, b, c) for(int a = b; a >= c; --a)
#define mp(a, b) make_pair(a, b)
#define all(v) v.begin(), v.end(... | ALGO | 0.999974 | 3.992342 |
cc6f9f4f-ea14-400a-8f6e-7c1ea102adbb | AshfaqueSami2/problem-solving | Codeforce rating based/HQ9+.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double dbl;
//shortcut
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define yes cout << "yes" << endl
#define no cout << "no" << endl
#define minus_one cout... | ALGO | 0.945245 | 3.360495 |
81557b9e-68e4-4ab3-ab05-7b8b446af2f5 | huatenglan/Ray-Tracing-Test | 03_MonteCarlo/sphere_plot.cpp | #include <math.h>
#include <iostream>
#include "rtweekend.h"
#include <iomanip>
int main() {
int N = 10000000;
auto sum = 0.0;
for (int i = 0; i < N; ++i) {
auto r1 = random_double();
auto r2 = random_double();
auto x = cos(2 * pi * r1) * 2 * sqrt(r2 * (1 - r2));
auto y = sin(2 * pi * r1) * 2 * sqrt(r2 * (1... | ALGO | 0.999534 | 4.358663 |
c0098197-941d-42ba-b19b-071e2a8bda53 | Zeppelindev/zeppelincoin | src/blockchain_utilities/blockchain_depth.cpp | #include <boost/range/adaptor/transformed.hpp>
#include <boost/algorithm/string.hpp>
#include "common/command_line.h"
#include "common/varint.h"
#include "cryptonote_core/tx_pool.h"
#include "cryptonote_core/cryptonote_core.h"
#include "cryptonote_core/blockchain.h"
#include "blockchain_db/blockchain_db.h"
#include "ve... | TOOL | 0.931807 | 6.222863 |
47194b0e-ccb8-4b3d-83c4-f9b27b9f7597 | Manoranjanhere/LEETCODE-PRACTICE | 1304-longest-happy-string/1304-longest-happy-string.cpp | #include <queue>
#include <string>
using namespace std;
class Solution {
public:
string longestDiverseString(int a, int b, int c) {
priority_queue<pair<int,char>> pq;
if(a>0)pq.push({a,'a'});
if(b>0)pq.push({b,'b'});
if(c>0)pq.push({c,'c'});
string ans="";
while(!pq.... | ALGO | 0.999941 | 5.311918 |
6c3a6e21-7cb6-40c2-9ab1-1e21eb46c1c7 | krishna9809/DSA-PEPARATION | Day-003/Ques/armstrong.cpp | // Ques -5 Given an integer N, return true it is an Armstrong number otherwise return false.
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cout<<"Enter 3 Digit Number"<<endl;
cin>>n;
int sum =0;
int reserve = n;
while(n > 0){
int rem = n%10;
sum =... | ALGO | 0.999816 | 4.364759 |
04c84b24-a78d-4827-8708-f714a2b0a123 | vale314/Algoritmia-ESCOM | ClaseStack/BuildingsNew.cpp | #include <iostream>
#include <vector>
#include <sstream>
#include <string>
#include <stack>
#include <utility>
#include <list>
#define io_ ios_base :: sync_with_stdio(0);cin.tie(0);
using namespace std;
// #include <bits/stdc++.h>
//Stack, guardamos Valor, Poscicion de vector
stack < pair <int long long,int long lon... | ALGO | 0.999984 | 3.980399 |
ccef36b6-e81c-4d03-8166-93b6dcf66979 | shivam-mishra1423/DSA-FILE | 01MinARRAY.cpp | //find the minimum element of the array
//var res to store the min element and comparision
#include<iostream>
using namespace std;
int main(){
int n;
cout<<"enter the size of the array " <<endl;
cin>>n;
int arr[n];
//takint he input in the array
for(int i=0;i<n;i++){
cin>>arr[i];
}
//printing the array
int minele=a... | ALGO | 0.999907 | 3.587619 |
10f64309-1bba-4ec7-adff-17bc056d9b16 | qqf0312/SPStore | deps/src/boost/libs/heap/examples/interface.cpp | #include <iostream>
#include <iomanip>
#include "../../../boost/heap/fibonacci_heap.hpp"
using std::cout;
using std::endl;
using namespace boost::heap;
//[ basic_interface
// PriorityQueue is expected to be a max-heap of integer values
template <typename PriorityQueue>
void basic_interface(void)
{
PriorityQueue ... | ALGO | 0.987097 | 4.874002 |
d38c40a7-4e47-41c1-8b2e-590c851caa6b | ishandutta2007/codeforces | savinov/normal/143/C.cpp | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
#define clr(x) memset((x), 0, sizeof(x))
#def... | ALGO | 0.999918 | 3.779757 |
cf2938a6-97a9-418a-bd4e-57ef20a8b25a | raincross7/code-similarity | codes/train_code/problem228/problem228_207.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define ii pair<int,int>
#define fi first
#define sc second
#define all(x) (x).begin(),(x).end()
int sum(int l, int r) {
int n = r - l + 1;
return (l + r) * n / 2;
}
void solve() {
int n, a, b;
cin >> n >> a >> b;
cout << max(((n - 1) * ... | ALGO | 0.999495 | 3.862556 |
2c5f5f0f-1012-4c01-8852-0cce64b3303b | zqvqk/Unicast_Routing | LSDB.cpp | //
// Created by Ariel Dang on 2022/10.
//
#include "LSDB.h"
#include <stdio.h>
#include <string.h>
LSDB::LSDB(int myRouterId) {
myId = myRouterId;
costs[myRouterId] = 0;
SPT[myRouterId] = myRouterId;
myMsgSeqN = 0;
globalMsgSeqN = 0;
neighbors[myRouterId] = 1;
// memset(SPT, -1, ROUTER_NUM... | ALGO | 0.995967 | 4.077412 |
a131f17c-0d4a-4c34-b6c7-67eb10c28328 | eggag32/Competitive-Programming | Codeforces/Making Slides.cpp | #pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cerr << #x << ": " << x << endl
#define debug2(x, y) debug(x), debug(y)
#define repn(i, a, b) for(int i ... | ALGO | 0.999978 | 3.509717 |
a8b5079a-a430-4121-93a6-b88c0847aafa | deArrudal/programming-tutorial-cpp | source/f08_calculator.cpp | #include <iostream>
using namespace std;
int main()
{
int num1;
int num2;
cout << "Enter first number: ";
cin >> num1;
cout << "Enter second number: ";
cin >> num2;
cout << "Answer: " << num1 + num2 << endl;
return 0;
} | TOOL | 0.986545 | 4.427263 |
f3fd628f-7100-41dd-bd74-181ee0ba2a8a | harusame777/haruGame | haruharuEngine/GameTemplate/k2EngineLow/ExEngine/bulletPhysics/src/LinearMath/btPolarDecomposition.cpp | #include "btPolarDecomposition.h"
#include "btMinMax.h"
namespace
{
btScalar abs_column_sum(const btMatrix3x3& a, int i)
{
return btFabs(a[0][i]) + btFabs(a[1][i]) + btFabs(a[2][i]);
}
btScalar abs_row_sum(const btMatrix3x3& a, int i)
{
return btFabs(a[i][0]) + btFabs(a[i][1]) + btFabs(a[i][2]);
}... | ALGO | 0.999143 | 6.762144 |
683a9caa-0794-4eed-9a88-dbdae04bc776 | sharma0vashu/DSA | 297-serialize-and-deserialize-binary-tree/serialize-and-deserialize-binary-tree.cpp | class Codec {
public:
// Encodes a tree to a single string.
string serialize(TreeNode* root) {
if (!root) return "#";
queue<TreeNode*> q;
q.push(root);
string s;
while (!q.empty()) {
TreeNode* currNode = q.front();
q.pop();
if (currNo... | ALGO | 0.999653 | 6.387705 |
881dc467-b4e4-481f-a52a-4ac2dd51c0c8 | Tuanlinh12312/CP-templates | APIO24_package/templates/DnC DP.cpp | ll Cost(ll k, ll j)
{
//calculates cost of a segment
}
void DnC(ll l, ll r, ll optl, ll optr)
{
if (r<l)
return;
ll mid=(l+r)/2, opt=0;
dp[mid]=INT_MAX;
for (ll i=optl; i<=min(mid, optr); i++)
if (ndp[i-1]+Cost(i, mid)
<dp[mid])
dp[mid]=ndp[i-1]+Cost(i, mid),... | ALGO | 0.999685 | 3.867292 |
5778bb47-9be3-470f-b1f2-b2fbd586b7e1 | ishandutta2007/codeforces | ljc00118/normal/1131/E.cpp | #include <bits/stdc++.h>
#define Fast_cin ios::sync_with_stdio(false), cin.tie(0);
#define rep(i, a, b) for(register int i = a; i <= b; i++)
#define per(i, a, b) for(register int i = a; i >= b; i--)
#define DEBUG(x) cerr << "DEBUG" << x << " >>> " << endl;
using namespace std;
typedef unsigned long long ull;
typedef p... | ALGO | 0.99991 | 3.725423 |
5ec78bfe-7f98-4cd4-bbd9-5d51439b073a | MrYuPengfei/SOFTWARE_VTM11_HM22 | VVCSoftware_VTM/source/Lib/DecoderLib/VLCReader.cpp | /** \file VLCWReader.cpp
* \brief Reader for high level syntax
*/
//! \ingroup DecoderLib
//! \{
#include "VLCReader.h"
#include "CommonLib/CommonDef.h"
#include "CommonLib/dtrace_next.h"
#if RExt__DECODER_DEBUG_BIT_STATISTICS
#include "CommonLib/CodingStatistics.h"
#endif
#include "CommonLib/AdaptiveLoopF... | TOOL | 0.859874 | 3.924276 |
04748768-a746-49ed-8622-98f464c5b7d2 | ishandutta2007/codeforces | roundgod/normal/1527/B1.cpp | #include<bits/stdc++.h>
#define MAXN 100005
#define INF 1000000000
#define MOD 1000000007
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int t,n,k,a[MAXN];
string str;
int main()
{
scanf("%d",&t);
while(t--)
{
scanf("%d",&n);
cin>>str;
... | ALGO | 0.999967 | 3.98143 |
f9714ff9-7528-472d-8c1b-b8b142a783a8 | som3a13/EmbeddedLinux-NTI | 1-C++/Tasks/02C++/Session2/lambda_sort_array.cpp | #include <algorithm>
#include <iostream>
int main()
{
int arr[]={10,20,40,15,17,18,19};
std::sort(std::begin(arr),std::end(arr),[](int x,int y){
return x>y; //Descending order
});
std::cout << "Array in Descending order: ";
for(auto i : arr)
{
std::cout << i << " ";
}
... | ALGO | 0.99934 | 4.971623 |
416c835e-1727-4e1e-8c91-95712559b315 | Sambitcr-7/Leetcode | 0141-linked-list-cycle/0141-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) {
if(!head) return false;
ListNode *slow, *fast;
slow = fast = head... | ALGO | 0.999654 | 5.236774 |
409610fe-bddb-4599-aafb-0554d32744fa | conankun/Dovelet | us/1690407_WA.cpp | #include<iostream>
#include<algorithm>
using namespace std;
int n;
int aray[10099];
int dyn[10099];
int btk[10099];
int bt2[10099];
int max_place = 0;
int max(int a, int b){
if (b-a >0){
return b;
}
return a;
}
int main(void){
int i, j, k;
cin >> n;
int maxi = -1;
for (i = 1; i <= n; i++){
cin >> aray[i];
}... | ALGO | 0.999998 | 3.615567 |
1de9801b-4b4c-448e-bc0f-fd3c7e39ff68 | AlexanderSHZ/MatrixProject | MatrixMain/SortMatrix.cpp | #include "Header.h"
void sortArrayDiagType()
{
Logotype();
cout << (char)9;//TAB
cout << (char)186 << " What diagonal do you whant to sort?" << setw(5) << (char)186 << "\n";
cout << (char)9;
cout << (char)186 << " 1 - main diagonal; " << setw(21) << (char)186 << "\n";
cout << (char)9;
cout << (char)186 << " 2 ... | ALGO | 0.997619 | 4.034942 |
8afc01c6-71bf-4b2b-aa39-a5fc0c229078 | wisdompeak/LeetCode | Bit_Manipulation/2680.Maximum-OR/2680.Maximum-OR.cpp | using LL = long long;
class Solution {
public:
long long maximumOr(vector<int>& nums, int k)
{
vector<int>count(32);
for (int i = 0; i< nums.size(); i++)
{
for (int j=0; j<=31; j++)
{
if ((nums[i]>>j)&1)
count[j... | ALGO | 0.999919 | 4.749063 |
1b70480e-d3a3-44e0-96f6-b39b54de8494 | Aadityajain75/CompetitiveProgramming | practice/plus.cpp | //https://www.hackerearth.com/challenge/competitive/may-circuits-18/algorithm/plus-plus-60bcac48/
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define f first
#define s second
int maxsum=0;
void f(vector<vector<int> > &a,int i,int j,int x,int y)
{
maxsum=max(maxsum,a[i-1][j]*a[x-1][y]+a[i][j-1]*a... | ALGO | 0.999974 | 3.665001 |
4fdb18e5-6c34-42f3-910d-6520a9914c16 | LiquidPlayer/LiquidCore | deps/boost_1_66_0/libs/geometry/example/ml02_distance_strategy.cpp | // Boost.Geometry (aka GGL, Generic Geometry Library)
#include <boost/geometry.hpp>
#include <boost/geometry/strategies/cartesian/distance_pythagoras.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
using namespace boost::geometry;
int main()
{
typedef model::d2::point_xy<double> point_xy;
point_xy p1(0.0,... | ALGO | 0.942554 | 4.546989 |
5afc5357-de9b-4965-9951-10e9e1095ecb | swatiinigam/gfg_coding | Difficulty: Basic/Sorted Array Search/sorted-array-search.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
// Function to find element in sorted array
// arr: input array
// k: element to be searched
bool searchInSorted(vector<int> arr, int k) {
// Your code here
for(int i=0... | ALGO | 0.997573 | 5.728542 |
85dd512c-618f-4cfe-a63e-ed3903def6cf | Chanda9528/leetcodeSolutions | 0001-two-sum/0001-two-sum.cpp | class Solution {
public:
vector<int> twoSum(vector<int>& nums, int target) {
vector<int>res;
for(int i=0;i<nums.size();i++){
for(int j=i+1;j<nums.size();j++){
if(nums[i]+nums[j]==target){
res.push_back(i);
res.push_back(j);
... | ALGO | 0.999909 | 6.036511 |
02a0f482-c791-4975-af9c-48a114586870 | darkwuta/-CSC417-Assignment | Assignment2/extern/libigl/include/igl/copyleft/cgal/submesh_aabb_tree.cpp | template<
typename DerivedV,
typename DerivedF,
typename DerivedI,
typename Kernel>
IGL_INLINE void igl::copyleft::cgal::submesh_aabb_tree(
const Eigen::PlainObjectBase<DerivedV>& V,
const Eigen::PlainObjectBase<DerivedF>& F,
const Eigen::PlainObjectBase<DerivedI>& I,
CGAL::AABB_tree<
CGAL::AABB_tra... | ALGO | 0.981177 | 7.853544 |
eb164120-e6a2-455c-9ea7-1a8cec3faade | ConradWarren/LeetCode-Challenges | 600-Non-negativeIntegerswithoutConsecutiveOnes.cpp | class Solution {
public:
int findIntegers(int n) {
std::vector<int> cache(32, 0);
cache[0] = 1;
cache[1] = 2;
for (int i = 2; i < 32; i++) {
cache[i] = cache[i - 1] + cache[i - 2];
}
int result = 0;
bool previous_flag = 0;
for (int i = 30; i >= 0; i--) {
if (n & (1 << i)) {
result += cache[i];
if... | ALGO | 0.999881 | 5.73048 |
7d63e7cd-29c2-4f67-967f-1446d100bdc9 | ishandutta2007/codeforces | mangooste/normal/1360/F.cpp | #include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <functional>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <string>
#include <vector>
using namespace std;
using ll = long long;
// #define int long long
#define all(a) a.begin(), a.e... | ALGO | 0.999944 | 4.471255 |
6f63f476-dd34-4e35-a23a-b6ff2dc6b947 | Shyam5323/Leetcode | 144-binary-tree-preorder-traversal/binary-tree-preorder-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.999925 | 6.474836 |
4c8f90e5-748b-497b-b4fa-f463de4e7ec9 | cran/exactextractr | src/exactextract/src/weighted_quantiles.cpp | #include "weighted_quantiles.h"
#include <stdexcept>
namespace exactextract {
void WeightedQuantiles::prepare() const {
std::sort(m_elems.begin(), m_elems.end(), [](const elem_t &a, const elem_t &b) {
return a.x < b.x;
});
m_sum_w = 0;
// relies on map being sorted wh... | ALGO | 0.996258 | 5.617146 |
77335bda-c34e-4a78-800f-80890a35ed14 | hiltd2758/C-- | Chuong 3/BT7_P1.cpp | #include <iostream>
using namespace std;
int USCLN(int a, int b) {
while (a != b) {
if (a > b) {
a -= b;
} else {
b -= a;
}
}
return a;
}
int main() {
int a, b, c;
cout << "Nhap vao 3 so nguyen a, b, c: ";
cin >> a >> b >> c;
int S = USCLN(... | ALGO | 0.999617 | 4.911853 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.