uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
a99e589f-fd4d-4120-8e06-880ba734b40e | sunstick/code-street | uva/459-connectedComponent.cpp | #include <iostream>
#include <set>
#include <cstdio>
#include <cctype>
using namespace std;
int father[500];
int rank[500];
set<int> re;
void make_set(int x) {
father[x] = x;
rank[x] = 0;
}
int find_set(int x) {
if (x != father[x])
father[x] = find_set(father[x]);
return father[x];
}
void u... | ALGO | 0.999396 | 4.20341 |
49267bcf-461a-4983-b8e1-49309e5bfeeb | DucNhat03/datastructure_algorithms | CTDL_GT/Lab2/Vidu_DoiChoTrucTiep.cpp | #include <stdio.h>
void Swap(int &a, int &b)
{
int temp = a;
a = b;
b = temp;
}
void InterchangeSort(int a[], int n)
{
for (int i=0 ; i<n-1 ; i++)
for (int j=i+1; j < n ; j++)
if(a[i]>a[j]) //nếu có nghịch thế thì đổi chỗ
Swap(a[i], a[j]);
}
int main()
{
int a[20]... | ALGO | 0.999963 | 3.856427 |
d3c0beb2-14cc-457e-845d-776c0dbfefd3 | HourunLi/CCF-CSP | 2017_9/CSP201709_4.cpp | /**
* @file CCF201709_4.CPP
* @author HourunLi
* @brief ccf csp 2017 09 4 source: http://<IP_ADDRESS>/view.page?gpid=T60
* @version 0.1
* @date 2022-06-22
*
* @copyright Copyright (c) 2022
*
*/
#include <bits/stdc++.h>
using namespace std;
typedef unsigned int uint32;
typedef long long ll;
typedef unsigned l... | ALGO | 0.999766 | 4.345588 |
dc1c6107-13e0-4ac5-bf98-74cb8e610a45 | NevineMGouda/Transactional-Memory | deque.cpp | #include <atomic>
#include <iostream>
#include <thread>
#include <unistd.h>
class DQueue
{
struct QNode
{
QNode *left, *right;
int val;
};
QNode *leftSentinel, *rightSentinel;
public:
DQueue()
{
leftSentinel = nullptr;
rightSentinel = nullptr;
}
QNode* newQNode(int val, QNode* left,... | TOOL | 0.993347 | 4.23027 |
c313ecfe-501c-4015-a95d-bb28aeef4b6f | bulinx/dv-loam-change | orb_slam2/Thirdparty/g2o/g2o/core/optimization_algorithm_dogleg.cpp | #include "optimization_algorithm_dogleg.h"
#include <iostream>
#include "../stuff/timeutil.h"
#include "block_solver.h"
#include "sparse_optimizer.h"
#include "solver.h"
#include "batch_stats.h"
using namespace std;
namespace g2o {
OptimizationAlgorithmDogleg::OptimizationAlgorithmDogleg(BlockSolverBase* solver)... | ALGO | 0.999947 | 6.70963 |
5613a105-c207-4034-b338-059edce3db21 | Md-Pranta/graph | CountingRooms.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define N 1006
#define SetBit(x, k) (x |= (1LL << k))
#define ClearBit(x, k) (x &= ~(1LL << k))
#define CheckBit(x, k) ((x>>k)&1)
#define M 10000000007
#define all(x) x.begin(), x.end()
#define kill(x) return cout << x << endl, void();
vector<string>gr... | ALGO | 0.999708 | 5.046965 |
e90ec19e-96ec-4448-a380-555c95d3c9e2 | tr1ten/DNA | leetecode/SortColors.cpp | #include <iostream>
#include <vector>
#include <string>
using namespace std;
void sortColors(vector<int>& nums) {
int arr[3]={0,0,0};
for (auto i:nums)
{
arr[i]++;
}
int j=0;
for (int i = 0; i < 3; i++)
{
for (int k = 0; k < arr[i]; k++)
{
nums[j] = i;
... | ALGO | 0.999474 | 5.276045 |
79b1ef6c-208b-4015-b49d-1b6bcfdaba28 | koustav2001/Codeforces | Codeforces_cpp/powerof2(1).cpp | #include<iostream>
using namespace std;
int main()
{
long long int num;
cin>>num;
long long int c,i=0;
while(1)
{
if(pow(2,i)==num)
{
f=1;
break;
}
else if(pow(2,i)>num)
{
f=0;
break;
}
i++;
}
if... | ALGO | 0.999823 | 4.178878 |
336a9e8c-f40f-42a6-a115-e025dd9ee7b2 | MahirSez/problem-solving | codeforces/1043/B.cpp | #include <bits/stdc++.h>
#define ll long long int
#define PI acos(-1)
#define read freopen("in.txt","r",stdin)
#define uu first
#define vv second
#define write freopen("out.txt","w",stdout)
#define pii pair<int,int>
#define INF 1e9
#define EPS 1e-8
#define MAX 1000006
... | ALGO | 0.99997 | 3.257384 |
aa47a3ef-c3aa-430b-81ca-d777bed08b27 | secondo-database/secondo | Algebras/SemanticTrajectory/SemanticTrajectoryAlgebra.cpp | #include "SemanticTrajectoryAlgebra.h"
#include "Algebra.h"
#include "NestedList.h"
#include "QueryProcessor.h"
#include "StandardTypes.h"
#include "Attribute.h"
#include "Symbols.h"
#include "ListUtils.h"
#include "Algebras/Relation-C++/RelationAlgebra.h"
#include "Algebras/Rectangle/CellGrid.h"
#include "Stream.h"
#i... | TOOL | 0.884466 | 4.322445 |
0f0731eb-63c5-4f86-8674-db4c078518e7 | Geetansh01/dsa-lb-codes | Greedy Algos/DEFKIN.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <limits.h>
using namespace std;
int findBiggestRectangle(int row, int col, int towers, vector<pair<int, int>> &locs)
{
// For X axis
vector<int> towersX;
// Push 2 dummy towers at x = 0 & x = col + 1;
towersX.push_back(0);
towersX... | ALGO | 0.999471 | 4.95138 |
4136156d-182f-4354-9e74-15bd21e53cda | a5tronomy/ue5-ffcotw | Engine/Source/ThirdParty/ICU/icu4c-53_1/source/common/normlzr.cpp | #include "unicode/utypes.h"
#if !UCONFIG_NO_NORMALIZATION
#include "unicode/uniset.h"
#include "unicode/unistr.h"
#include "unicode/chariter.h"
#include "unicode/schriter.h"
#include "unicode/uchriter.h"
#include "unicode/normlzr.h"
#include "unicode/utf16.h"
#include "cmemory.h"
#include "normalizer2impl.h"
#include... | TOOL | 0.899129 | 7.784697 |
6e70dffc-b3b3-4ffc-a8df-792156c0abc6 | PowerDiagram/PowerDiagram | src/cpp/sdot/BigRational.cpp | #include "BigRational.h"
#include <boost/multiprecision/detail/default_ops.hpp>
#include <boost/multiprecision/detail/integer_ops.hpp>
namespace sdot {
BigRational::BigRational( Normalized, BI num, BI den, SI64 exp ) : num( num ), den( den ), exp( exp ) {
}
BigRational::BigRational( BI num, BI den, SI64 exp ) : num(... | TOOL | 0.861923 | 5.835482 |
f178fe80-c8e0-41f6-bf6c-ddca1bf12113 | annapetrosyaan/Algorithms | QuickSort/QuickSort.cpp | #include <iostream>
#include <vector>
void quickSort(std::vector<int>&, int, int);
namespace Utility
{
template <typename T>
void swap(T& a, T& b)
{
T temp = a;
a = b;
b = temp;
}
}
//worst case= O(n*n), on average= O(n log n)
void quickSort(std::vector<int>& vec, int first, i... | ALGO | 0.999927 | 5.657298 |
b7df75a0-53a5-493a-bd28-7a154e735232 | lukasmonk/lucaschess | Engines/Linux32/greko/src/bitboards.cpp | // GREKO Chess Engine
// (c) 2002-2014 Vladimir Medvedev <<EMAIL>>
// http://greko.110mb.com
// bitboards.cpp: 64-bit position representation
// modified: 01-Mar-2013
#include "position.h"
#include "utils.h"
U64 Bitboard::m_single[64];
U64 Bitboard::m_dir[64][8];
U64 Bitboard::m_pawnAttacks[64][2];
U64 Bitboard... | CONFIG | 0.935749 | 5.115557 |
558cd082-48d7-48c9-a370-e6e0dadd9687 | asimbaidya/cp | src/2023/23-03-14/usaco-1-fence-painting.cpp | // shit
// #include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#define showl(x) cout << __LINE__ << "| " << #x << " = " << x << "\n"
#define show(x) cout << #x << " = " << x << "\n"
using namespace std;
const string nl = "\n";
const string sp = " ";
int main() {
// // fast io
// ios::sync_with_... | ALGO | 0.999396 | 4.017462 |
05877c4e-4954-4ce0-bc56-717e7210298b | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_11714_13.cpp | #include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1);
int main(int argc, char const* argv[]) {
int d, l, v1, v2;
scanf("%d%d%d%d", &d, &l, &v1, &v2);
printf("%I64d\n", double((double(l - d)) / (double(v1 + v2))));
return 0;
}
| ALGO | 0.998108 | 3.463739 |
22a9c89e-5133-4491-b7fa-94571d944178 | Ali-18-0/DSA | Binary Tree C++/BoundaryTraversal_Working.cpp | #include<iostream>
#include<vector>
#include<stack>
using namespace std;
class node{
public:
int data;
node* left;
node* right;
node(int d){
data = d;
left = NULL;
right = NULL;
}
};
node* buildTree(node* root){
cout<<"Enter data for node\n";
int data;
cin>... | ALGO | 0.999922 | 4.335961 |
ec05fc27-d802-4871-acd9-dbcbf2e8bd8b | sourcegraph/lsif-clang | llvm/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp | #include "llvm/Transforms/Utils/UnifyFunctionExitNodes.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/Type.h"
#include "llvm/InitializePasses.h"
#include "llvm/Transforms/Utils.h"
using namespace llvm;
char UnifyFunctionExitNodes::ID = 0;
UnifyFunc... | TOOL | 0.887048 | 7.7052 |
c0a0de73-b48a-4197-8b2d-bf153a2323dc | seirion/fpcpp-code-examples | chapter-03/older-than-generic/main.cpp |
#include <iostream>
#include <vector>
#include <algorithm>
#include "../../common/person.h"
// Implements a generic function object that compares an object's age
// against a predefined integer limit (section 3.1.4)
class older_than {
public:
older_than(int limit)
: m_limit(limit)
{
}
// Defi... | TOOL | 0.978245 | 6.394778 |
39d39406-c261-4b49-8d3c-b2ed897a9576 | DinosL/BenchmarkingAdaptiveIndexes | MultidimensionalAdaptiveIndexing_Clean_shapes/src/indexes/median_kd_tree.cpp | #include <full_scan_candidate_list.hpp>
#include "median_kd_tree.hpp"
#include "kd_tree.hpp"
#include "full_scan.hpp"
#include <algorithm>
using namespace std;
MedianKDTree::MedianKDTree(std::map<std::string, std::string> config){
if(config.find("minimum_partition_size") == config.end())
minimum_partition... | ALGO | 0.989354 | 5.966403 |
52012a7c-3b7c-4465-b5cc-27b2c8e80760 | Gaolious/algorithm | Baekjoon/015000_015999/15486/main.cpp | #include <bits/stdc++.h>
#include <math.h>
#include <unistd.h>
#include <sys/mman.h>
#include <sys/syscall.h>
#include <sys/stat.h>
using namespace std;
class FIO
{
#define BUFF_LEN (1<<22)
char *p;
char out[BUFF_LEN]{};
int nOut ;
public :
FIO()
{
struct stat rstat{};
this->p =... | ALGO | 0.999889 | 4.058973 |
3ee3de4b-dcd9-4ff7-9bd9-ebfed0d5d6b4 | kingstar718/CPlus_Learning | CPP_Primer_Plus/chapter_7_function/atrctfun.cpp | //
// Created by wujinxing on 2019/10/29.
// 点的两种表示
//
#include <iostream>
#include <cmath>
// structure declarations
struct polar {
double distance;
double angle;
};
struct rect {
double x;
double y;
};
//prototype
polar rect_to_polar(rect xypos);
void show_polar2(const polar * pda);
void show_polar... | ALGO | 0.90819 | 4.92538 |
2948bcae-f0b8-45d6-b4e4-24739bbade3d | praymeta/Code-Up-Algorithm | BOJ_5698_Tautogram.cpp | #include <iostream>
#include <vector>
using namespace std;
int main(void) {
string str;
while(getline(cin, str)) {
if(str == "*") break;
vector<int> temp;
temp.push_back(0);
for(int i = 1; i < str.length(); i++) {
if(str[i] == ' ') temp.push_back(i + 1);
}
... | ALGO | 0.999813 | 3.314001 |
4d815f26-121c-4240-a4b8-af62b039a53f | arifparvez14/Basic-and-competetive-programming | Online-Judge-Solution/Codeforces Solutions/368(A.Brains Photos).cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n,m,a,i,j;
char ch[300][300];
while((scanf("%d %d",&n,&m))==2)
{
int status=0;
for(i=1;i<=n;i++)
{
for(j=1;j<=m;j++)
{
cin>>ch[i][j];
if(ch[i][j]=='C' || ch[i][j]... | ALGO | 0.998072 | 3.780689 |
ce0d5962-7a92-47c7-8e28-35e4493fee0f | RishiTripathi1/Data-Structures-And-Algorithms | 0542-01-matrix/0542-01-matrix.cpp | class Solution {
public:
vector<vector<int>> updateMatrix(vector<vector<int>>& mat) {
int n = mat.size();
int m = mat[0].size();
vector<vector<int>>vis(n, vector<int>(m,0));
vector<vector<int>>dis(n, vector<int>(m,0));
queue<pair<pair<int,int>,int>>q;
for(int i=0;i<n... | ALGO | 0.999978 | 6.256139 |
312a6bcf-dd99-4b80-b0a6-c4c3a880e4ce | NguyTroBinh/Cat-Code | CTDL046.cpp | #include <iostream>
// mua luong thuc
int cnt_min_day(int N, int S, int M){
// so ngay nhieu nhat co the mua luong thuc
int max_day = S - (int)(S / 7);
// so luong thuc tieu thu trong S ngay
int total_food = M * S;
if(total_food > max_day * N) return -1; // bi chet doi
else if(total_food == max_day * N) return... | ALGO | 0.999895 | 4.439519 |
245e01e9-6b00-4b3e-afb3-0492b7c36979 | ishandutta2007/codeforces | mateocv/normal/1509/C.cpp | #include <bits/stdc++.h>
#define pb push_back
#define fst first
#define snd second
#define fore(i,a,b) for(int i=a,ggdem=b;i<ggdem;++i)
#define SZ(x) ((int)x.size())
#define ALL(x) x.begin(),x.end()
#define mset(a,v) memset((a),(v),sizeof(a))
#define FIN ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using namespace st... | ALGO | 0.999973 | 3.91392 |
fa36252e-f389-46c1-9123-ad3dcf2890c6 | Teravor/SimpleGNN | GNN_interface.cpp | #include "GNN_interface.h"
#include <stdio.h>
#include <assert.h>
#include <math.h>
int symbol2number(const char* _symbol) {
switch(_symbol[0]) {
case 'O':
return 8;
case 'H':
return 1;
default:
fprintf(stderr, "Unspecified atomic symbol: %s\n", _symbol);
abort();
}
}
Trajectory::Trajectory()
: atoms... | ALGO | 0.902449 | 5.274125 |
2eca8085-55cc-423b-aac5-4e612f4e3622 | ishandutta2007/codeforces | radewoosh/normal/1322/A.cpp | //~ while (clock()<=69*CLOCKS_PER_SEC)
//~ #pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
//~ #pragma GCC target ("avx2")
//~ #pragma GCC optimize("Ofast")
//~ #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//~ #pragma GCC optimize("unroll-loops")
#include <bits/st... | ALGO | 0.999909 | 3.766929 |
c805f3d4-eb4f-4959-9ef7-05b55b85f58d | SweetWith/Algorithm | leetcode/Week1/Trapping_rain_water/GH_Solution.cpp | #include <stack>
class Solution {
public:
int trap(vector<int>& height)
{
stack<int> stack;
int output = 0;
int size = height.size();
for (int i = 0; i < size; i++)
{
int max;
while (not stack.empty() and stack.top() <= height[i])
... | ALGO | 0.999982 | 6.718317 |
31e0a8ac-723f-4408-bd94-5a0f8f5266a8 | alexandraback/datacollection | solutions_1480487_1/C++/ankorol/A.cpp | #include <iostream>
#include <vector>
#include <map>
#include <string>
#include <cmath>
#include <algorithm>
#include <set>
using namespace std;
int main()
{
int T;
cin >> T;
for (int t = 1; t <= T; ++t)
{
int N;
cin >> N;
vector<pair<int, int> > s;
s.resize(N);
... | ALGO | 0.999512 | 4.096862 |
44837686-e0f8-4952-8e37-d5fa615989da | ryan4waters/cppsaga | Lambda/Recursion In Lambda/src/f_in_capture_list.cpp | #include <iostream>
int main(int argc, char* argv[])
{
auto fib = [
f = [](auto&& self, int n, int i = 0, int num1 = 0, int num2 = 1) {
if (i >= n) return num1;
else return self(self, n, i + 1, num2, num1 + num2);
}](int n) { return f(f, n); };;
std::cout << fib(5);
return 0;
} | ALGO | 0.991408 | 5.914584 |
dc4565f5-d5cd-4b42-8772-c5cd9bb124e4 | gazelle98/data-structures-and-algorithms | Second Assignment/لیست بر مبنای آرایه _ صف تریکیو.cpp | #include <stdio.h>
#include <iostream>
#include <algorithm>
#include <string>
#include<math.h>
#include<assert.h>
using namespace std;
template<typename T>
class Array {
protected:
T* a;
public:
int length;
Array(int l) {
length = l;
a = new T[length];
}
T& operator[](int i) {
... | ALGO | 0.999821 | 3.848884 |
78cb695a-c221-4960-9843-be4e05890f74 | RohanDSkaria/CodeForces | C_Largest_Subsequence.cpp | #include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0);cin.tie(nullptr);cout.tie(nullptr);
#define endl '\n'
#define int long long
#define pb(a) push_back(a)
#define v vector
#define vi v<int>
#define bl cout<<endl;
#define all(a) a.begin(),a.end()
#define deb(x) cout<<#x<<" = "<<x<<endl;
tem... | ALGO | 0.999441 | 3.813188 |
ae13958f-2970-4148-8cbf-674e7efdb674 | 0508gyhun/Codetree_algorithm | 241223/언덕 깎기/hill-cutting.cpp | #include <iostream>
using namespace std;
#include <bits/stdc++.h>
int a[1004];
int n;
int k =17;
int main() {
// 여기에 코드를 작성해주세요.
cin >> n;
for(int i = 0 ; i < n ; i++)
{
cin >> a[i];
}
int mn = INT_MAX;
for(int i = 0 ; i <= 100 ; i++)
{
int sum = 0 ;
for(int j ... | ALGO | 0.999816 | 3.668438 |
679d2faf-7cf0-4bf7-a49a-915987dd1120 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_10639_7.cpp | #include <bits/stdc++.h>
using namespace std;
const int INF = 0x3c3c3c3c;
const long long LINF = 1ll * INF * INF * 2;
const int N = 1000001;
int n, m, x, y;
vector<pair<int, int> > v;
long long dp[100][100100];
int main(void) {
scanf("%d%d", &n, &m);
for (int i = 0; i < n; i++) {
scanf("%d%d", &x, &y);
v.pu... | ALGO | 0.999959 | 4.191846 |
a10a9e73-dff2-4e3e-ba33-4c17dc22edab | neelchoudhury/cp | Codeforces/158D.cpp | #include<bits/stdc++.h>
#define ll long long int
#define ios ios_base::sync_with_stdio(false);
#define pb push_back
#define inf -99999999999999999999
using namespace std;
ll a[20010];
ll bu[20010];
vector<ll> v;
void pr(ll n)
{
while (n%2 == 0)
{
v.push_back(2);
n = n/2;
}
for (in... | ALGO | 0.999978 | 3.392033 |
7bbf6571-80bf-4090-9552-5fdf601e40ec | ujjwal4384/Leetcode-Submissions | 0211-design-add-and-search-words-data-structure/0211-design-add-and-search-words-data-structure.cpp | struct TrieNode{
map<char,TrieNode*>mp;
bool isEnd;
TrieNode(){
isEnd = false;
}
};
class WordDictionary {
TrieNode* root;
public:
WordDictionary() {
root = new TrieNode();
}
void addWord(string word) {
TrieNode* temp = root;
for(auto ch: word){... | ALGO | 0.999746 | 6.197636 |
8172e6a1-28fe-4f08-bb7c-315f44c89ba9 | danaguilar/CppBookExercises | chaptersix/source/whitespacereader.cpp | # include <iostream>
# include <fstream>
# include <string>
# include <vector>
# include <map>
# include <algorithm>
using namespace std;
// 6.6.3: Read a sequence of possibly whitespace-separated (name, value) pairs, where the name is a single
// whitespaced-separated word and the value is an integer or a fla... | ALGO | 0.999372 | 5.328244 |
a3f5ee85-5362-4b4b-84b9-64dd67084eb1 | adetaylor/android-frameworks-base-with-remote-control-service | media/libstagefright/codecs/aacdec/pns_corr.cpp | /*
Pathname: pns_corr.c
------------------------------------------------------------------------------
REVISION HISTORY
Description: Made changes per review comments, the most major of which
being the change of the scaling into a 16 x 16 multiply.
Description: When the multiplication of two 16-bits variables i... | ALGO | 0.999464 | 5.392339 |
6bc98009-613d-456a-984f-fa868b566bcb | anubhavchk007/Competitive-Programming | Templates/DSU.cpp | class DSU {
public:
vector<int> parent, size;
int connected;
DSU(int n) {
parent.resize(n + 1);
iota(parent.begin(), parent.end(), 0);
size.resize(n + 1, 1);
connected = n;
}
int get(int x) {
return parent[x] = (parent[x] == x ? x : get(parent[x]));
}
... | ALGO | 0.999437 | 4.234652 |
5bb0aea5-aa5d-47c1-a195-cf41960592be | khalwsh/CP-Problems | AtCoder/abc213_d/42664319_AC_135ms_25848kB.cpp | #include<bits/stdc++.h>
using namespace std;
#define line '\n'
#define khaled ios_base::sync_with_stdio(0);cin.tie(0);
vector<int>res;
void dfs_traversal(int node,int parent,vector<int>adj[])
{
res.emplace_back(node);
for(auto &val:adj[node])
{
if(parent==val)
continue;
dfs_trave... | ALGO | 0.99999 | 4.337385 |
ace5b3c8-744f-4e65-ac3e-cb9ccf623cd1 | khaledsliti/CompetitiveProgramming | AtCoder/AtCoder127-ABC-D.cpp | #include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
typedef long long ll;
const int mod = 1e9 + 7;
const int N = 1e5 + 5;
int n, m;
int A[N];
pair<int, int> BC[N];
int main()
{
cin >> n >> m;
for(int i = 0 ; ... | ALGO | 0.999981 | 3.678503 |
dc06d17b-84c6-44f1-a367-30ef520b6a44 | Pandaggar/MechaT-dev--files | MechaT/eular.cpp | #include <math.h>
#include <iostream>
int ABV(double x, double y, double z, double w) {
double B = ((180/3.14159265359)*(acos(((x*y)+(z*w))/((sqrt((x*x)+(y*y)))*(sqrt((z*z)+(w*w)))))));
// std::cout << B;
return B;
}
int QuadXY(double x, double y)
{
double B = 0;
if(x>0 and y>0 and y > x){
... | ALGO | 0.999351 | 3.212264 |
83002f12-0dc4-49bd-8d6c-1cf1a2b4355d | Xushi8/Code | 2024/January/contest1/dd.cpp | // 2024/01/12 15:06:44
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdint>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <functional>
#include <iomanip>
#include <cmath>
#include <stack>
#include <... | ALGO | 0.999952 | 4.704363 |
3c0fe637-797f-42a3-9c33-0afc8115bb9d | sahil1415/DSA_Problems | howManyTimesArrRotated.cpp | #include <bits/stdc++.h>
using namespace std;
int findKRotation(vector<int> &arr)
{
int low = 0;
int high = arr.size() - 1;
int mid = low + (high - low) / 2;
int ans = INT_MAX;
int index = -1;
// int index =-1;
while (low <= high)
{
if (arr[low] <= arr[mid])
{
... | ALGO | 0.999988 | 4.90107 |
9651a8fd-79ff-49af-a92b-950288cffe9c | maurojh/dionecapf | 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 |
3df78422-0b68-4bb3-845a-6cba565a3225 | wcysai/Calabash | ByteDance - Moscow Workshops ICPC Programming Camp 2019. Day 6, The Final Contest/J.cpp | #pragma GCC optimize(3)
#include<bits/stdc++.h>
#define MAXN 20
#define INF 1000000000
#define MOD 1000000007
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
ll n,m;
ll t[MAXN];
ll a[MAXN][MAXN];
ll b[MAXN][MAXN];
vector<int> mask;
int main()
{
scanf("%lld%lld",&... | ALGO | 0.999984 | 3.252751 |
a47ceb53-ddf3-4bae-a0cc-acaf170b0744 | G5471/C-Codes | findvalue.cpp | #include<iostream>
using namespace std;
int main(){
int a=1;
cout<<(a++)*(++a)<<endl;
return 0;
} | ALGO | 0.998868 | 3.346267 |
bf8af4fa-d1fa-4a10-b1a6-08e5439b0c61 | zxas56555/DataStructureTraining | Source/第5章 树和二叉树/5.7 求二叉树中叶子结点个数及结点个数/BitreeNumMain.cpp | #include "BitreeNum.cpp"
int main(int argc, char* argv[])
{
BiTree T = NULL;
CreateBiTree(T);
int leaf = LeafCount(T);
cout<<"Ҷӽ"<<leaf<<endl;
int nodes = Nodes(T);
cout<<"н"<<nodes<<endl;
cout << "" << endl;
return 0;
}
| ALGO | 0.9925 | 3.671774 |
c4017258-584b-474b-a2b1-a13c282d88f5 | CaiHuicheng/Project | Code/nowCode/NC199最小的K个数_sort.cpp | class Solution {
public:
// void quickSort(vector<int> &a,int left,int right){
// if(left<right){
// int mid = a[left];
// int low = left,high = right;
// while(low<high){
// while(a[high]>=mid&&low<high){
// high--;
// ... | ALGO | 0.999995 | 5.365068 |
cc8eea7e-d880-4c0d-9c3c-1c101ee8b3e7 | to0d/rulp-project | lang/src/runtime/XRFactorCompute.cpp | namespace lfc {
XRFACTOR_IMPL_BEGIN(XRFactorCompute)
auto obj = interpreter->compute(frame, args->get(1));
AUTO_INC_DEC(obj);
while (TYPE_INDEX_OF(obj) == E_EXPR) {
obj = interpreter->compute(frame, obj);
}
return obj;
XRFACTOR_IMPL_ARG(2, 2)
XRFACTOR_IMPL_END
STATIC_FACTOR_REGISTER(XRFactorCompute, F_... | ALGO | 0.947477 | 6.814873 |
8453155b-4316-446a-a058-7e08e02c2ae7 | MrinalCom/GeeksforGeeksPOTD | Maximum sum increasing subsequence.cpp | vector<int>sum(n,0);
sum[n-1] = arr[n-1];
for(int i=n-2;i>=0;i--){
int sumi = arr[i];
int addi = 0;
for(int j = i+1;j<n;j++){
if(arr[j]>arr[i]){
addi = max(addi,sum[j]);
}
}
sum[i] = addi + sumi;
}
int maxi=INT_M... | ALGO | 0.99992 | 4.500772 |
e54d16d6-8045-463e-8457-90b3b8e327bc | zaforf/competitiveprogramming | codeforces/1834C.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int T; cin>>T;
while (T --> 0) {
int n; cin>>n;
string s1,s2; cin>>s1>>s2;
int cntf = 0, cntr = 0;
for (int i=0;i<n;i++) {
if (s1[i]!=s2[i]) cntf++;
if (s1[i]!=s2[n-i-1]) cntr++;
}
if (cntf==0) cout << "0\n";
else if (cntr==0) cout << "2\... | ALGO | 0.99996 | 4.687411 |
dfb35e72-5b81-465f-9ad1-fe244cba8c42 | Zhenghao-Liu/LeetCode_problem-and-solution | 1611.使整数变为0的最少操作次数/solution1_dfs.cpp | class Solution {
public:
int minimumOneBitOperations(int n) {
return dfs_0(n);
}
int dfs_0(int n)
{
if (n<=1)
return n;
if (is_power_of_2(n))
return highbit(n)*2-1;
int highbit_n=highbit(n);
int otherbit_n=n&(highbit_n-1);
return 1+... | ALGO | 0.999986 | 6.266665 |
9acab63d-57c3-4849-b091-1b160db32352 | dseco/acmudec | EricFernández/Semestre2-2017/rcp/D - 21Octubre.cpp | #include <cstdio>
#include <iostream>
using namespace std;
unsigned long long int digitos(unsigned long long int n){
unsigned long long int x = 0;
if(n<=9){
return n;
}
while(n != 0){
x += n%10;
n = n/10;
}
if(x > 9) digitos(x);
else return x;
}
int main(){
unsigned long long int N;
while(1){
cin ... | ALGO | 0.999869 | 4.549592 |
5ce29575-41ee-4728-a8dd-c75909842c34 | marco-tomSuden/MineSlicer | src/libigl/igl/edges_to_path.cpp | #include "edges_to_path.h"
#include "dfs.h"
#include "sort.h"
#include "slice.h"
#include "ismember.h"
#include "unique.h"
#include "adjacency_list.h"
template <
typename DerivedE,
typename DerivedI,
typename DerivedJ,
typename DerivedK>
IGL_INLINE void igl::edges_to_path(
const Eigen::MatrixBase<DerivedE> &... | ALGO | 0.999363 | 4.94567 |
369f0007-eb2d-4159-b478-3e4d21f579d2 | b0n21en5/problem_solutions | CodeForces/110A.cpp | // 110A - Nearly Lucky Number
#include <bits/stdc++.h>
using namespace std;
int main()
{
long long n;
cin >> n;
int c = 0;
while (n)
{
if (n % 10 == 4 || n % 10 == 7)
c++;
n /= 10;
}
if (c == 4 || c == 7)
cout << "YES";
else
cout << "NO";
... | ALGO | 0.999459 | 4.814348 |
7204d15d-648f-459a-a361-d8874d021bf3 | cpselvis/leetcode | solution100.cpp | /**
* Same Tree
*
* cpselvis(<EMAIL>)
* September 1sth, 2016
*/
#include<iostream>
struct TreeNode {
int val;
TreeNode *left;
TreeNode *right;
TreeNode(int x) : val(x), left(NULL), right(NULL) {}
};
class Solution {
public:
bool isSameTree(TreeNode* p, TreeNode* q) {
if (p == NULL && q == NULL)
... | ALGO | 0.999849 | 6.0825 |
59bf9786-dade-4657-9154-b528ed9e90de | bi0rob0t/ParallelProgCourceLabs | Lab2/lab2_4.cpp | #include <stdio.h>
#include <stdlib.h>
#include "mpi.h"
int numTasks, rank;
int min(int a, int b) {
if (a <= b) return a;
return b;
}
int max(int a, int b) {
if (a >= b) return a;
return b;
}
int *createNumbers(int howMany) {
int * numbers = (int *) malloc(sizeof(int) * howMany);
if (numbers == NULL) {... | ALGO | 0.99995 | 4.01408 |
8e35b017-bcdb-4856-8213-f7549c1621af | aplqo/exercises | luogu/01-Starter/P1046-Apples.cpp | #include <iostream>
using std::cin;
using std::cout;
int main()
{
unsigned int apples[10], heigh;
unsigned int num = 0;
for (auto& i : apples) {
cin >> i;
}
cin >> heigh;
heigh += 30;
for (const auto i : apples) {
if (i <= heigh) {
num++;
}
}
cout << num;
return 0;
}
| ALGO | 0.999369 | 3.893997 |
0bdf6656-b547-4a11-8eda-2779257b2f47 | MrZ3RO-K3NiS7/CODE-SUBMiSSiONS | LEETCODE/reverse-nodes-in-k-group.cpp | class Solution {
public:
ListNode *reverseKGroup(ListNode *head, int k)
{
ListNode *CheckRevPossible = head;
for (int i = 0; i < k; i++)
{
if (CheckRevPossible == NULL)
{
return head;
}
CheckRevPossible = CheckRevPossible->n... | ALGO | 0.999994 | 5.790251 |
293b5a5e-a8f2-41cc-a561-847a42cfe307 | a815063199/one-peace | common_reader/test.cpp | #include <stddef.h>
#include <iostream>
#include <memory>
#include <string>
#include <sstream>
#include <fstream>
#include <unordered_map>
#include <vector>
/*try {...} catch {...} wrapper*/
#define CD_TRY try {
#define CD_CATCH \
} catch (const std::exception &e) { ... | TOOL | 0.909814 | 6.045166 |
aa2b1da4-3008-4be6-955c-012a2bc15331 | ishandutta2007/codeforces | ooops_no/normal/1582/A.cpp | #include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define ld long double
#define int long long
#define ll long long
mt19937 rnd(51);
signed main()
{
#ifdef LOCAL
freopen("input.txt", "r", stdin);
#endif // LOCAL
ios::sync_with_stdio(0);
cin.tie(0);
int t;
cin >> t;
while(t--)... | ALGO | 0.999753 | 4.669612 |
c5c6fd61-389f-42cc-8f99-a350fb6ceb74 | ishandutta2007/codeforces | lackadaisical_lad/normal/871/A.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
const int MOD = 1e9 + 7;
ll binpow(ll a, ll p, int mod = MOD) {
ll res = 1;
while (p) {
if (p & 1) {
(res *= a) %= mod;
}
p >>= 1;
(a *= a) %= mod;
}
return res... | ALGO | 0.999801 | 5.179955 |
a47c9c99-269f-404d-a196-19813ebe625a | phumipatc/C_Competitive_Programming | C++ - 2561/Pre_Camp/Rock_Pick_Game.cpp | /*
Author : Phumipat C.
School : RYW
Language: C++
*/
#include<bits/stdc++.h>
using namespace std;
int a[110],dp[110][110];
int pick(int l,int r){
if(l>r) return 0;
if(dp[l][r]!=-1) return dp[l][r];
int maxx = 0;
maxx = max(maxx,pick(l+2,r)+a[l]);
maxx = max(maxx,pick(l+1,r-1)+a[... | ALGO | 0.999902 | 3.738081 |
205264db-a35a-4ddc-b482-2f94b0bcf06e | sahilshembekar/Patterns | Pattern2/main.cpp |
#include <iostream>
using namespace std;
int main() {
int rows ;
int Columns;
cout << "Enter No of Rows:";
cin>>rows;
cout << "Enter No of Columns:";
cin>>Columns;
{
for (int i=1;i<=rows;i++) { //Rows
for (int j=1;j<=Columns;j++) { //Columns
if (i==1 || i==rows) {
cout ... | ALGO | 0.993731 | 3.04375 |
271c9228-9c81-40c1-a8b2-9ba3ed1fed03 | wbjeon2k/EE32601 | Lab3/gcd_custom_ip/gcd_ip/solution1/sim/wrapc_pc/gcd_custom.cpp_pre.cpp.tb.cpp | void gcd_custom(int a,int b,int& gcd){
#pragma HLS INTERFACE s_axilite port=a
#pragma HLS INTERFACE s_axilite port=b
#pragma HLS INTERFACE s_axilite port=gcd
int tmp;
if(b>a){
tmp = a;
a = b;
b = tmp;
}
while(b){
tmp = b;
b = a%b;
a = tmp;
}
gcd = a;
}
#ifndef HLS_FASTSIM
#ifdef __cplusplus
exter... | ALGO | 0.999903 | 4.912677 |
d21764c7-4296-4aab-ac71-bc1fdcfda50f | InflixOP/LeetCode-CPP-Solutions | #2529. Maximum Count of Positive Integer and Negative Integer.cpp | class Solution {
public:
int maximumCount(vector<int>& nums) {
int pc=0,nc=0;
for(int i=0;i<nums.size();i++){
if(nums[i]>0){
pc++;
}else if(nums[i]<0)
nc++;
}
return max(pc,nc);
}
... | ALGO | 0.999857 | 5.368891 |
8f297123-8fe9-4762-badc-4dbd02f61a28 | opensource-hisense/SmartTV-SeriesVidaaU7_NT | oss/part1/boost/boost_1_73_0/libs/algorithm/minmax/fuzzing/minmax_element_variants.fuzz.cpp | #include <iterator> // for std::distance
#include <cassert> // for assert
#include <boost/algorithm/minmax_element.hpp>
#include <boost/algorithm/cxx11/none_of.hpp>
// Fuzzing tests for:
//
// template <class ForwardIterator>
// std::pair<ForwardIterator,ForwardIterator>
// first_min_first_max_element(ForwardIter... | TEST | 0.980435 | 5.683649 |
77945948-4f4e-4e12-8b98-9f28241357fc | K-jais/6Companies30Days | Amazon/3 iplday2.cpp | vector<int> max_of_subarrays(vector<int> nums, int n, int k) {
vector<int> result;
if (k == 0) return result;
priority_queue<pair<int, int>> w;
for (int i = 0; i < n; i++) {
while (!w.empty() && w.top().second <= i-k)
w.pop();
w.push(make_pair(nums[i],i));
if (i >... | ALGO | 0.999963 | 5.104647 |
38535152-96f0-4610-8225-a45dbfbfeb4c | wendyh9/Algorithm-Design-and-Analysis | Max_Subarray/maxSubarray.cpp | // author: Wendy Haw
#include <iostream>
#include <limits.h>
#include <algorithm>
using namespace std;
// two functions needed for max subarray algorithm
int find_max_crossing_subarray(int A[], int low, int midpoint, int high){
int left_sum = INT_MIN, right_sum = INT_MIN;
int sum = 0;
// left of midpoint... | ALGO | 0.999819 | 4.919178 |
54a13582-d65e-466e-854f-9157f89424f2 | ishandutta2007/codeforces | yousef_salama/normal/1276/B.cpp | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 200005;
int t, n, m, a, b, ui, vi;
vector <int> g[MAXN];
bool vis[MAXN];
pair <int, int> dfs(int u){
vis[u] = true;
pair <int, int> ret = make_pair(1, 0);
for(int v : g[u]){
if(v == a)ret.second |= 1;
else if(v == b)ret.second |= 2;
else if(vi... | ALGO | 0.999877 | 4.064867 |
f9ca5d27-ae50-4949-a16b-48308cd37a0c | QuyDatSadBoy/DSA_Tong_Hop | Dp/DSA05041_bien_doi_ve_xau_doi_xung.cpp | #include <bits/stdc++.h>
#define ll long long
#pragma GCC optimize("Ofast")
const ll mod = (ll)1e9 + 7;
#define endl "\n"
#define maxn 1000006
#define _oo LLONG_MIN
#define oo LLONG_MAX - 9
#define bit(x, i) ((x >> i) & 1)
#define all(v) v.begin(), v.end()
#define ms(a) memset(a, 0, sizeof(a))
#define faster() ... | ALGO | 0.999785 | 4.675537 |
33992e7a-47a1-46dd-846a-47e64d70fcea | derekwong9/OrderBookAdvisorBot | src/OrderBook.cpp | #include "OrderBook.h"
#include "CSVReader.h"
#include <map>
#include <algorithm>
#include <iostream>
bool OrderBook::sortOrdersByTimestamp()
{
// written/modified by Derek Wong
for (OrderBookEntry &e : orders)
{
ordersSorted[e.timestamp].push_back(e);
}
if (ordersSorted.size() == 0)
... | ALGO | 0.980027 | 5.084154 |
fa6786c8-eb1f-4ccf-ac08-364023869ca9 | goubraim/player-ui | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998859 | 6.785645 |
91de650b-aa7d-4622-91e4-fd8e9673b1fb | SnowyTulip/-LeetCode | 第2周/6有序数组的平方977.cpp | #include <vector>
using namespace std;
class Solution {
public:
vector<int> sortedSquares(vector<int>& nums) {
vector <int>result;
int n = nums.size();
int index = 0;
for(int i = 0;i < n;++i){
if(nums[i] < 0)
index ++;
nums[i] = nums[i] *nums[i... | ALGO | 0.999994 | 5.471247 |
0e85419f-4037-4f7d-95bc-8fa8573e4ae9 | Hideyoshizane/Algorithm-I-Assignment-3 | functions.cpp | #include "functions.h"
//Functions
//Receive the parameters from the file and insert then on the variables
void StartVariable(int& lines, int& columns,vector<vector<unsigned long long>>& matrix){
cin >> lines;
cin >> columns;
for(int i= 0; i < lines;++i){
vector<unsigned long long> temp;
for(int j = 0; j <... | ALGO | 0.999986 | 3.970974 |
16f64a5c-ed89-489f-82c8-7a1eb6d190d2 | RedDocMD/compush | estest.cpp | #include "gl.hpp"
#include "util.hpp"
#include <cstring>
#include <fstream>
struct vectors {
std::vector<double> vec;
size_t dim;
size_t cnt;
vectors(std::vector<double> vec, size_t dim, size_t cnt)
: vec(std::move(vec)), dim(dim), cnt(cnt) {}
};
static vectors parse_vectors(const std::string... | DATA | 0.89516 | 5.823819 |
f944e0fd-5cd5-4988-80dd-ef6ee48f6921 | ishandutta2007/codeforces | blackbori/normal/1205/A.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int A[202020];
int n;
int main()
{
int i;
scanf("%d", &n);
if(~n & 1){
printf("NO\n");
return 0;
}
printf("YES\n");
for(i=0; i<n; i++){
if(i & 1){
A[i] = i * 2 + 1;
A[n + i] = i * 2 + 2;
}
else{
A[i] = i * 2 + 2;
... | ALGO | 0.999923 | 3.33159 |
6a618746-3c90-4a2c-9eed-70623d6e96ba | diegonehab/stroke-to-fill | rvg-util.cpp | #include "rvg-util.h"
#include <iostream>
namespace rvg {
namespace util {
#ifdef USE_LAPACK
bool linear_solve(float a00, float a01, float a10, float a11,
float b0, float b1, float *x, float *y) {
lapack_int m = 2;
lapack_int n = 2;
lapack_int nrhs = 1;
float a[4] = {a00, a10, a01, a11};
l... | ALGO | 0.999514 | 5.316747 |
1d0f795e-e3ac-4ed5-a752-07c32fcf8eed | wyyrepo/Tianchi2 | tianchi/Encrypt/cryptopp/xtr.cpp | // cryptlib.cpp - written and placed in the public domain by Wei Dai
#include "pch.h"
#include "xtr.h"
#include "nbtheory.h"
#include "algebra.cpp"
NAMESPACE_BEGIN(CryptoPP)
const GFP2Element & GFP2Element::Zero()
{
return Singleton<GFP2Element>().Ref();
}
void XTR_FindPrimesAndGenerator(RandomNumberGenerator &rn... | ALGO | 0.998535 | 5.116609 |
c0ebb1a5-1f65-4bde-b14d-fda83659ea45 | MuBob/pjproject-2.4 | MicroSIP-3.12.1-src/global.cpp | #include "stdafx.h"
#include "global.h"
#include "settings.h"
#include "utf.h"
#include "langpack.h"
#include <afxinet.h>
#ifdef UNICODE
#define CF_TEXT_T CF_UNICODETEXT
#else
#define CF_TEXT_T CF_TEXT
#endif
struct my_call_data *tone_gen = NULL;
int transport;
pjsua_acc_id account;
pjsua_acc_id account_local;
CStri... | TOOL | 0.883783 | 3.171692 |
f12060c4-f65d-46af-bd8f-020263c07d46 | raincross7/code-similarity | codes/train_code/problem204/problem204_464.cpp | #include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < n; i++)
#... | ALGO | 0.999837 | 3.240342 |
c1b31b01-cf5f-4987-9bc9-9e846a0af3b8 | kkc-ritwik/DSA-CODES | Lecture036 Recursion Day6/quickSort.cpp | #include<iostream>
using namespace std;
int partition( int arr[], int s, int e) {
int pivot = arr[s];
int cnt = 0;
for(int i = s+1; i<=e; i++) {
if(arr[i] <=pivot) {
cnt++;
}
}
//place pivot at right position
int pivotIndex = s + cnt;
swap(arr[pivotIndex], arr... | ALGO | 0.999969 | 4.916068 |
41796e80-5d2e-4f76-9cf8-5550b97082a1 | jingdao/site_reconstruction | solve_accuracy.cpp | #include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <vector>
#include <string.h>
#include <math.h>
typedef struct {
float x,y;
} Coordinate;
int sortByXY(const void* v1, const void* v2) {
Coordinate* c1 = (Coordinate*)v1;
Coordinate* c2 = (Coordinate*)v2;
if (c1->x == c2->x)
return c1->y - c2->... | ALGO | 0.997381 | 5.371368 |
71e56d55-6f28-4b4f-a6d3-9fa048414c62 | wuyuhang05/My-OI-Code | TopCoder/SRM577/BoardPainting.cpp | #include<bits/stdc++.h>
#define fi first
#define se second
#define U unsigned
#define P std::pair<int,int>
#define LL long long
#define pb push_back
#define MP std::make_pair
#define all(x) x.begin(),x.end()
#define CLR(i,a) memset(i,a,sizeof(i))
#define FOR(i,a,b) for(int i = a;i <= b;++i)
#define ROF(i,a,b) for(int ... | ALGO | 0.999779 | 4.279149 |
1e05dd8c-3a02-432a-94d7-45ccf590019b | shall1we/Ardupilot | libraries/Filter/DerivativeFilter.cpp | /// @file Derivative.cpp
/// @brief A class to implement a derivative (slope) filter
/// See http://www.holoborodko.com/pavel/numerical-methods/numerical-derivative/smooth-low-noise-differentiators/
//
#include <inttypes.h>
#include <AP_Math/AP_Math.h>
#include "Filter.h"
#include "DerivativeFilter.h"
template <class ... | ALGO | 0.947552 | 7.019264 |
32e89e0f-ed3a-46a1-a022-dce11abecf2b | goelayush7/LEETCODE | 1667-find-kth-bit-in-nth-binary-string/find-kth-bit-in-nth-binary-string.cpp | class Solution {
public:
string reverse(string s){
string val="" ;
int n = s.size();
for(int i =n-1;i>=0 ;i--){
val+=s[i];
}
return val;
}
string invert(string s){
for(int i =0;i<s.size();i++){
if(s[i]=='1')s[i]='0';
else s[... | ALGO | 0.999987 | 5.903111 |
26003305-df99-41b4-aa10-72c6180f9373 | JunhaoWang615/MCVO | MCVO/thirdparty/eigen/doc/snippets/SelfAdjointEigenSolver_SelfAdjointEigenSolver_MatrixType.cpp | MatrixXd X = MatrixXd::Random(5,5);
MatrixXd A = X + X.transpose();
cout << "Here is a random symmetric 5x5 matrix, A:" << endl << A << endl << endl;
SelfAdjointEigenSolver<MatrixXd> es(A);
cout << "The eigenvalues of A are:" << endl << es.eigenvalues() << endl;
cout << "The matrix of eigenvectors, V, is:" << endl << ... | ALGO | 0.999768 | 3.056724 |
f1979403-0553-4966-ab1d-c351fd69eddd | igaspard/LeetCode | 137_SingleNumberII.cpp | class Solution {
public:
int singleNumber(vector<int>& nums) {
int seenOnce = 0, seenTwice = 0;
for (auto it : nums) {
seenOnce = ~seenTwice & (seenOnce ^ it);
seenTwice = ~seenOnce & (seenTwice ^ it);
}
return seenOnce;
}
};
// Bit Manipulation
... | ALGO | 0.999937 | 6.165641 |
58c72f3b-d207-4ba9-999b-1d00caf80666 | DBorello/OpenSeesDev | SRC/system_of_eqn/linearSOE/bandGEN/DistributedBandGenLinSOE.cpp | // $Revision: 1.4 $
// $Date: 2009-05-20 17:30:26 $
// $Source: /usr/local/cvs/OpenSees/SRC/system_of_eqn/linearSOE/bandGEN/DistributedBandGenLinSOE.cpp,v $
// Written: fmk
//
// Description: This file contains the implementation for BandGenLinSO... | ALGO | 0.997394 | 3.955637 |
47d7f8c5-3ede-4e05-9739-5bb6f1f3c0bb | ishandutta2007/codeforces | aarr/normal/1187/A.cpp | #include <iostream>
using namespace std;
int main() {
int q;
cin >> q;
for (int i = 0; i < q; i++) {
int s, t, n;
cin >> n >> s >> t;
int x = s + t - n;
int ans = min(n, n);
ans = min(ans, max(t - x, s - x) + 1);
cout << ans << endl;
}
return 0;
} | ALGO | 0.999907 | 3.643078 |
7ff871b8-f6e3-40f1-b9ba-cde7289251f0 | Yashvihg/DSAbasics | Maths/LCM.cpp | //Efficient approach
#include "bits/stdc++.h"
using namespace std;
int gcd(int a, int b)
{
if(b==0)
return a;
else
return gcd(b,a%b);
}
int lcm(int a, int b)
{
return (a*b)/gcd(a,b);
}
int main()
{
int a,b;
cin>>a>>b;
int multiple = lcm(a,b);
cout<<multiple;
return 0;
}
// not e... | ALGO | 0.999918 | 4.179996 |
58573815-8fe0-4707-b07b-39a277788de1 | j2ibeo/askalcoin | src/test/util/blockfilter.cpp | #include <test/util/blockfilter.h>
#include <chainparams.h>
#include <node/blockstorage.h>
#include <validation.h>
bool ComputeFilter(BlockFilterType filter_type, const CBlockIndex* block_index, BlockFilter& filter)
{
CBlock block;
if (!ReadBlockFromDisk(block, block_index->GetBlockPos(), Params().GetConsensu... | TOOL | 0.899554 | 6.829962 |
f4bce090-1310-4391-89d7-0160b3b8d999 | OscarOu0421/leetcode | 930.cpp | // Time Complexity: O(n), where n is the length of nums
// Space Complexity: O(n), for the hashmap storing prefix sum frequencies
class Solution {
public:
int numSubarraysWithSum(vector<int> nums, int goal) {
unordered_map<int, int> map; // Maps prefix sum to its frequency
int ret = 0; // Total cou... | ALGO | 0.999993 | 7.069383 |
9d44b4aa-511a-480d-ae47-2880cd01f4ae | masayuki-kono/generate-ikfast-solver | templates/ikfast_c_interface.cpp | #define IKFAST_HAS_LIBRARY
#include "ikfast.h"
using namespace ikfast;
IKFAST_API bool ComputeIkC(const IkReal* eetrans, const IkReal* eerot, const IkReal* pfree, IkSolutionListC* solutions) {
if (!eetrans || !eerot || !solutions) {
return false;
}
ikfast::IkSolutionList<IkReal> cppSolutions;
bool success... | ALGO | 0.991895 | 5.498116 |
a4a26fc1-d376-46d1-b85e-bcafb1b9d8ed | jtcriswell/safecode-llvm37 | projects/poolalloc/tools/WatchDog/WatchDog.cpp | #include <cstdio>
#include <cstdlib>
#include <unistd.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/wait.h>
using namespace std;
// Process ID to watch. This is global because it is needed by the signal
// handler.
static int pid_to_watch = 0;
// Number of seconds to wait before checking up on the ch... | TOOL | 0.915768 | 6.162732 |
6a2f5b44-090c-4a31-bb53-2ce9eb8ab85a | isangyoon-zz/BOJ | 10950.cpp | #include <iostream>
int N;
int main(int const argc, char const** argv)
{
std::ios::sync_with_stdio(false);
std::cin >> N;
while (N--)
{
int a, b;
std::cin >> a >> b;
std::cout << (a + b) << std::endl;
}
return 0;
}
| ALGO | 0.990059 | 5.354342 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.