uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
bc591367-f2ba-4130-b30a-a1f42b6292bd | chiyueOfgit/SmartObliquePhotography | libigl/include/igl/connected_components.cpp | #include "connected_components.h"
#include <queue>
template < typename Atype, typename DerivedC, typename DerivedK>
IGL_INLINE int igl::connected_components(
const Eigen::SparseMatrix<Atype> & A,
Eigen::PlainObjectBase<DerivedC> & C,
Eigen::PlainObjectBase<DerivedK> & K)
{
typedef typename Eigen::SparseMatrix<... | ALGO | 0.996626 | 6.73807 |
d81bf625-e5d9-4617-991c-c0d5c6d2a3b4 | SquarePants1991/EZGLKit | libs/bullet/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.999328 | 6.751988 |
44b96cee-649f-4ee3-9bd3-6105c94dde4a | RishikeshDwivedi-99/LeetCode | 1610-xor-operation-in-an-array/xor-operation-in-an-array.cpp | class Solution {
public:
int xorOperation(int n, int start) {
vector<int> v(n);
for(int i=0;i<n;i++) {
v[i] = start;
start += 2;
}
int xor1 = 0;
for(int i=0;i<n;i++) {
xor1 ^= v[i];
}
return xor1;
}
}; | ALGO | 0.999937 | 5.323101 |
d70f59a0-4338-40a9-950b-9432f4d06e1c | nmp9981/coding_daily_2024 | 20240713_11689.cpp | #include <iostream>
using namespace std;
typedef long long ll;
ll n, res;
ll Euler(ll n){
res = n;
for (ll i = 2; i * i <= n; i++) {
if (n % i == 0) res = res-(res/i);
while (n % i == 0) n = n/i;
}
if (n > 1) res = res-(res/n);
return res;
}
int main()
{
cin >> n;
cout<<Euler(n);
return 0;
}
| ALGO | 0.999977 | 4.819342 |
9f5110d6-5299-4145-876d-74347941d674 | ishandutta2007/codeforces | sd0061/normal/605/E.cpp | #include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
#include <cassert>
#include <cctype>
#include <queue>
#include <cmath>
using namespace std;
typedef long long LL;
const int N = 1005;
int n;
int p[N][N];
bool f[N];
double d[N] , K[N] , B[N];
int main() {
scanf("%d" , ... | ALGO | 0.999902 | 3.308491 |
f9b29a88-695e-465b-b00b-63d5b70832bb | ishandutta2007/codeforces | kizen/normal/1047/A.cpp | #include <bits/stdc++.h>
using namespace std;
int N;
int main(){
scanf("%d", &N);
if(N%3==0){
printf("%d %d %d", 1, 1, N-2);
}
else if(N%3==1){
printf("%d %d %d", 1, 2, N-3);
}
else if(N%3==2){
printf("%d %d %d", 2, 2, N-4);
}
return 0;
} | ALGO | 0.999823 | 3.303355 |
99b5e30b-d136-4a3e-b94a-10acbf3e9f88 | Pallab-Ghosh/DSA_LEETCODE_PROBLEMS | trees/symmetyric_tree.cpp | #include <iostream>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
class node{
public:
int data;
node* left;
node* right;
};
node* getnode(int x)
{
node* newnode=new node();
newnode->data=x;
newnode->left=0;
newnode->right=0;
retur... | ALGO | 0.999905 | 4.367896 |
e24b21ac-c9ee-411f-89a0-185dce9020c5 | haipng/cj | clab/BSEARCH/BSEARCH2.cpp | #include <bits/stdc++.h>
using namespace std;
int a[100010];
int x[100010];
int n, m;
int solve(int val) {
int lo=0, hi=n-1;
int ans = -1;
while(lo<=hi) {
int mid = (lo + hi)/2;
if(a[mid] >= val) {
ans = mid;
hi=mid-1;
}
else {
lo=mid+1;
}
}
if(idx == -1) abort();... | ALGO | 0.999981 | 4.709437 |
194550a1-4bf1-4efb-9065-450c7f97706c | FPSG-UIUC/Pandora | simulator/src/systemc/tests/systemc/misc/unit/data/datawidth_signed/lost_carry/datawidth.cpp | /*****************************************************************************
datawidth.cpp --
Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
*****************************************************************************/
/**************************************************************************... | ALGO | 0.980479 | 5.296924 |
3c0ecee6-7ab5-47d6-a677-249a976336bf | svn2github/vbox | src/VBox/Additions/WINNT/Graphics/Video/disp/xpdm/VBoxDispVrdpBmp.cpp | /* $Id$ */
/** @file
* VBox XPDM Display driver
*/
#include "VBoxDisp.h"
#include <iprt/crc.h>
#include <VBox/RemoteDesktop/VRDEOrders.h>
/*
* Cache has a fixed number of preallocated entries. Entries are linked in the MRU lists.
*
* A new bitmap hash is added to the "temporary" list, and the caller is told tha... | TOOL | 0.917466 | 6.367047 |
b87ea074-92eb-48dc-9aae-561c2f18d1e1 | syncfusion/SfQtWebKit | qtwebengine/src/3rdparty/chromium/third_party/skia/tools/skpdiff/SkPMetric.cpp | #include <cmath>
#include <math.h>
#include "SkBitmap.h"
#include "skpdiff_util.h"
#include "SkPMetric.h"
#include "SkPMetricUtil_generated.h"
struct RGB {
float r, g, b;
};
struct LAB {
float l, a, b;
};
template<class T>
struct Image2D {
int width;
int height;
T* image;
Image2D(int w, int... | TOOL | 0.992631 | 6.030801 |
afbbe9d3-9aa8-45ed-8882-9b154b2a2c8d | itsoulos/GrammarNN | METHODS/gradientdescent.cpp | #include "gradientdescent.h"
GradientDescent::GradientDescent()
{
hasInitialized = false;
lt=NULL;
addParam(Parameter("gd_maxiters",200,1,10000,"Maximum iterations for gradient descent"));
QStringList gd_linesearch;
gd_linesearch<<"none"<<"golden"<<"fibonacci"<<"armijo";
addParam(Parameter("gd_... | ALGO | 0.999498 | 5.688096 |
132099f8-7905-4363-be8d-3cd1a99213ed | vikashmalakar275/Data_Structure_and_Algorithm | takeUforward/Strivers_A2Z_DSA_Course/Binary_Search_1D_2D_Arrays_Search_Space_]/BS_on_2D_Arrays/Median_of_Row_Wise_Sorted_Matrix.cpp | /*
Problem Statement: Given a row-wise sorted matrix of size r*c, where r is no. of rows and c is no. of columns, find the median in the given matrix.
Assume – r*c is odd
Examples:
Example 1:
Input:
r = 3 , c = 3
1 4 9
2 5 6
3 8 7
Output: Median = 5
Explanation: If we find the linear sorted array, the array become... | ALGO | 0.999983 | 5.437983 |
c72c84c9-2482-4688-a8c5-94141b66dc61 | ishandutta2007/codeforces-r | rafi22/normal/1666/C.cpp | #include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
#define x first
#define y second
long long D(pair<int, int>a, pair<int, int>b) {
return (long long)abs(a.x - b.x) + (long long)abs(a.y - b.y);
}
int main() {
vector<pair<int, int>>p(3);
for(auto &[x, y] : p)
scanf("%d%... | ALGO | 0.999992 | 3.761215 |
3737fda6-a603-4ffa-b0f5-d8b889063f8a | d3b5/Beecrowd-URI-solutions | cpp+c/Population_Increase.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin >> t;
for(int j = 1; j<=t; j++)
{
int pa,pb,year;
double ra,rb;
cin >> pa >> pb >> ra >> rb;
year = 0;
while(true)
{
pa += (pa*ra/100.00);
pb += (pb*rb/100.00)... | ALGO | 0.999631 | 3.527954 |
05d92fe5-866c-4dd3-943e-a27180eeee17 | Supan-Roy/Algorithms_Lab-Vjudge | G_Combination_Lock.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
string x,y;
cin>>x>>y;
int comb=0;
for(int i=0;i<n;i++)
{
int forward = abs(x[i]-y[i]);
int backward = 10-forward;
comb+=min(forward,backward);
}
cout<<comb<<endl;
return 0;
} | ALGO | 0.999892 | 3.470056 |
23505c84-541f-450f-80f4-8dfa2bca7aa4 | kamrulashraf/Vjudge-mixed- | SPOJ/BYTESM2/5967413_AC_100ms_3482kB.cpp | #include <bits/stdc++.h>
using namespace std;
#define inf 1000000
#define grey 1
#define black 2
#define white 0
#define rep(i,x,y) for(int i = x ; i< y ; i++)
vector <int > prime;
template < class T > inline T gcd(T a, T b){return a%b ? gcd(b,a%b) : b;}
template < class T > inline T lcm(T a, T b) {... | ALGO | 0.999772 | 3.893516 |
2f8c7407-5e0a-4a3c-9415-0ceae55fb3cb | honey0632/Leetcode-2024-Daily | 01-04-2024.cpp | // 2870. Minimum Number of Operations to Make Array Empty
// https://leetcode.com/problems/minimum-number-of-operations-to-make-array-empty/
#include<bits/stdc++.h>
using namespace std;
class Solution {
public:
int minOperations(vector<int>& nums) {
unordered_map<int,int> mp;
int ans = 0;
... | ALGO | 0.999873 | 5.42886 |
7369dd1c-cd25-4c53-aba9-a00a1d8f8edf | hoosong0235/acmicpc | CLASS 5/CLASS 5/14003.cpp | #include <bits/stdc++.h>
using namespace std;
#define N 1000000
int n;
int a[N], idxs[N];
vector<int> v, w;
int main() {
ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
cin >> n;
for (int i = 0; i < n; i++) cin >> a[i];
// Longest increasing subsequence
idxs[0] = 0;
v.pus... | ALGO | 0.99999 | 4.15247 |
7eff528f-3309-47ee-8fc0-25caff6f3235 | Alex-Criwer/Algorithms | shortest_ways/G._Dijkstra.cpp | #include <iostream>
#include <vector>
#include <limits>
#include <deque>
#include <set>
typedef int Vertex;
constexpr int INF = std::numeric_limits<int>::max();
constexpr int MAX_DISTANCE = 2009000999;
class Cmp {
public:
bool operator()(const std::pair<int, int> &lhs, const std::pair<int, int> &rhs) const {
... | ALGO | 0.999962 | 4.229642 |
a4758f40-b655-4d92-9059-eb175f765b32 | jaindivij21/Comprehensive-DSA-Questions | Computer Graphics/Midpoint circle/main.cpp | // Mid Point Circle Program
#include<iostream>
#include<graphics.h>
using namespace std;
void drawcircle(int x,int y,int r)
{
int x2,y2,p;
x2=0;
y2=r;
p=1-r;
do{
putpixel(x+x2,y+y2,WHITE);
putpixel(x+x2,y-y2,WHITE);
putpixel(x-x2,y+y2,WHITE);
putpixel(x-x2,y+y2,WHI... | ALGO | 0.998628 | 4.378601 |
a0e27cfe-8f9b-4bab-a1bb-2ebdac5f0e92 | act1lazi0N/cPlusPlusInThePass | Professional/Week 3.2/2718.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin >> t;
while (t--)
{
set<char> st;
for (int i = 1; i <= 4; i++)
{
char c;
cin >> c;
st.insert(c);
}
cout << st.size() - 1 << "\n";
}
return 0;
}
| ALGO | 0.999347 | 3.90099 |
968c8393-6dc6-4fea-8daf-cf0823c764d5 | akipekoren/Trie | Trie.cpp | #include "Trie.h"
#include <iostream>
#include <sstream>
Trie::Trie(){
this->root = new TrieNode();
this->size = 0;
}
Trie::Trie(const Trie & copy){
root = copy.createClone();
size = copy.size;
cout << "Copy constructor called" << endl;
}
Trie::Trie(Trie && move):root(nullptr), size(0){
cout << "Move constru... | ALGO | 0.991216 | 4.539651 |
f7a3a808-2590-49e0-a73c-89b84f09ba23 | XianweiCheng01/gem5_SALAM | ext/llvm/llvm-9.0.0.src/lib/CodeGen/LatencyPriorityQueue.cpp | #include "llvm/CodeGen/LatencyPriorityQueue.h"
#include "llvm/Config/llvm-config.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
using namespace llvm;
#define DEBUG_TYPE "scheduler"
bool latency_sort::operator()(const SUnit *LHS, const SUnit *RHS) const {
// The isScheduleHigh flag allows n... | ALGO | 0.963259 | 7.53454 |
ed395532-4682-454f-94ae-154513013c04 | Harshsngh07/DataStructures_and_Algorithms | CodeForces/A/43Football.cpp | //g++ 5.4.0
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin >>n;
int count1(0),count2(0),temp(0);
string s[n];
for(int i = 0;i<n;i++)
cin >> s[i];
for(int i = 0;i<n;i++)
{
if(s[i]==s[0])
count1++;
else
{
temp = ... | ALGO | 0.999824 | 3.294233 |
a6177603-a62f-43ad-88ba-49684439c59c | julianogm/beecrowd | 6-paradigmas/1288.cpp | #include<bits/stdc++.h>
using namespace std;
int peso[101],poder[101];
int tab[101][101];
int canhao(int x,int y){
if(x==0) return 0;
if(y==0) return 0;
if(tab[x][y]!=-1) return tab[x][y];
if(peso[x]>y) return tab[x][y]=canhao(x-1,y);
else return tab[x][y]=max(canhao(x-1,y),canhao(x-1,y-peso[x])+... | ALGO | 0.999773 | 3.594495 |
71ab5b2e-f6bf-46d8-a684-129ba3e21a03 | ishandutta2007/codeforces | davoth/normal/1458/B.cpp | #include <bits/stdc++.h>
#pragma GCC optimize("O2")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx,avx2,sse,sse2,fma")
using namespace std;
using ll = long long int;
#define F first
#define S second
#define pb push_back
#define fast_io ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
const ... | ALGO | 0.999969 | 3.493469 |
8f52b83b-7ccc-4dcd-aff2-4d6d6e8623da | hyperon-hyeon/Digital-Image-Processing | code/histoEqualizationNstretching.cpp | #pragma warning(disable:4996)
#include <stdio.h>
#include <stdlib.h>
#include <Windows.h>
void obtainHisto(BYTE* Img, int* Histo, int W, int H) {
int ImgSize = W * H;
for (int i = 0; i < ImgSize; i++) Histo[Img[i]]++;
}
void obtainAHisto(int*Histo, int*AHisto) {
for (int i = 1; i < 256; i++) {
AHisto[i] = AHisto... | ALGO | 0.995858 | 3.349681 |
28612eae-576b-497d-bd5a-1147ab7a3e85 | iam-Arman/Codeforces | Codeforces_1768C.cpp | // Bismillahir Rahmanir Rahim //
// After hardship comes ease //
// AUTHOR : iamarman //
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <e... | ALGO | 0.999997 | 3.661288 |
65c5ff61-09fd-4555-a21a-b3a80af4255f | amanchandra395/CodeForces_Solution | 577A_Multiplication_Table.cpp | #include<iostream>
using namespace std;
int main()
{
long long int n,x;
cin>>n>>x;
long long int ans = 0;
for(long long int i = 1; i<=n; i++)
{
if(x%i == 0 and x/i <= n)
{
ans++;
}
}
cout<<ans<<endl;
return 0;
} | ALGO | 0.999961 | 3.948348 |
8686fca1-a8c8-4e33-b679-cc20382c833d | om2154460/MaciasOmar_CSC5_40717 | Class_Lab/BranchingMonthlyPaymentCalculater/main.cpp | /*
* File: main.cpp
* Author: Omar Macias
* Created on January 14, 2015, 11:24 AM
* Purpose:
*/
//System Libraries
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
//User Libraries
//Global Constants
//Function Prototypes
//Execution Begins Here!
int main(int argc, char** argv)... | ALGO | 0.998279 | 3.340065 |
699a8668-7ae4-4047-9017-6da5b8b0c6a9 | awen123awen/test | 夏浩天/B直线.cpp | //答案:40257
//暴力穷举
#include <iostream>
#include<map>
using namespace std;
struct points
{
double x, y;
};
points point[1000000];
long long en = 0; // 最终结果
int num;
map<pair<double, double>, bool> ma;
int main()
{
for (int i = 0; i < 20; i++)
for (int j = 0; j < 21; j++)
{
point[num].x = i;
point[num].y = j... | ALGO | 0.998398 | 3.160132 |
660055da-3843-493f-9e6a-8fd4b5dc1ace | CaoNguyen-1883/Leetcode-solution | 29. Divide Two Integers.cpp | #include"LeetCodeLibs.h"
class Solution {
public:
int divide(int dividend, int divisor) {
int res = 0;
return res;
}
}; | ALGO | 0.998845 | 5.246243 |
2628ee2f-42cc-451c-8685-3470e2e596c7 | Kamrul101/cpp_practice | CF800/systemsEquationsCF.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl "\n"
#define MOD 1000000007
#define mem(a,b) memset(a, b, sizeof(a) )
// const int mx =2e5+123;
// int a[mx];
int main() {
optimize();
... | ALGO | 0.999922 | 4.01427 |
98d7bef4-a84f-4b39-b9a4-9c09879bd8c4 | ZixinLiu/leetcode | 268.missing-number.cpp | class Solution {
public:
int missingNumber(vector<int>& nums) {
// initial thought, try to sort first and compare with targets,
// the complexity of sort function is algorithm library is O(nlogn),
// this doesn't meet complexity requirement
// // sort the nums in increasing order
// sort(num... | ALGO | 0.999931 | 5.786348 |
41edb197-785e-4d5f-972d-07bac931e43b | yuchsiao/caplet | caplet_solver/src/main.cpp | /*
Created : Jul 28, 2010
Author : Yu-Chung Hsiao
Email : <EMAIL>
*/
#include "caplet.h"
#include "mpi.h"
#include <iostream>
#include <string>
#include <sstream>
#include <list>
#include <cstdlib>
using namespace std;
void printUsage(char* command){
cout << "CAPLET: Extract capacitance matrix " << endl
... | TOOL | 0.915823 | 4.971322 |
c60e659c-7841-49e1-b8eb-3da818ef6a96 | btorgerson/CodeChallenge | boost_1_63_0/libs/multi_index/example/sequenced.cpp | #if !defined(NDEBUG)
#define BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING
#define BOOST_MULTI_INDEX_ENABLE_SAFE_MODE
#endif
#include <boost/multi_index_container.hpp>
#include <boost/multi_index/identity.hpp>
#include <boost/multi_index/ordered_index.hpp>
#include <boost/multi_index/sequenced_index.hpp>
#include <boost... | ALGO | 0.979579 | 6.33118 |
db8e4a53-16ee-4736-9584-d7f536ee6ecd | pseudobun/solo-projects | c_cpp_projects/list_sort/urejanje_seznama/urejanje_seznama.cpp | #include <iostream>
#include <ctime>
#include <chrono>
using namespace std;
using chrono::duration_cast;
using chrono::microseconds;
using chrono::steady_clock;
struct element {
int key;
element *prev, *next;
};
element *head = NULL;
element *tail = NULL;
element *temp = NULL;
element *l = NULL;
element *d =... | ALGO | 0.999291 | 4.885633 |
536266ff-262e-4967-ae02-c5dacf06aa77 | Hanamantray8151/Coding-Ninjas-Data-Structures-In-CPP | Trees/pre_post_order_traversal.cpp | #include<bits/stdc++.h>
using namespace std;
template<typename T>
class TreeNode{
public:
T data;
vector<TreeNode<T>*> children;
TreeNode(T data){
this -> data = data;
}
~TreeNode(){ //One by One from last it will delete enire tree.
for(int i=0;i<children.size();i++){
delete children[i];
... | ALGO | 0.999781 | 4.695159 |
1e39ec23-f4e6-437b-85dc-e8156d3a75b2 | BigRayLee/3DViewer | src/HLOD.cpp | #include "HLOD.h"
HLOD::HLOD() : curIdxOffset(0), curVertOffset(0) {}
void HLOD::BuildLODFromInput(Mesh *rawMesh, size_t vertCount, size_t triCount)
{
/* Get the max and min position value of the model */
clock_t start, end;
TimerStart();
for (int i = 0; i < vertCount * 3; i = i + 3)
{
Ge... | TOOL | 0.984858 | 5.444561 |
45925179-3cdb-47f3-a41d-7ca1b0df58eb | MasterIceZ/CP-COM | POSN_62/2nd_BUU/1-25_Data_Sturcture_Bsearch_DSU_MST/Places_Sacred.cpp | #include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int mxN = 2e5+1;
int p[mxN];
int fr(int i) {
if(p[i] == i) return i;
return p[i] = fr(p[i]);
}
pair<int,pair<int,int>> a[(int)(1e6)];
int main() {
ios::sync_with_stdio(false), cin.tie(nullptr);
int n, m;
cin >> n >> m;
iota(p+1, p+1+n, 1); /... | ALGO | 0.999878 | 4.123516 |
a15f7c15-1c96-44d9-bc43-29fd4cad8532 | hardikkumar4472/SkillStone-Summer-PEP-Assignment | Assignment 1/10.cpp | #include <bits/stdc++.h>
using namespace std;
struct ListNode {
int val;
ListNode* next;
ListNode(int x) : val(x), next(NULL) {}
};
ListNode* removeNodes(ListNode* head) {
if (head == NULL || head->next == NULL) {
return head;
}
head->next = removeNodes(head->next);
if (h... | ALGO | 0.999983 | 5.89475 |
5733c7b7-a082-4995-8619-9757deb066eb | ajay-nagpal/checkers | hashkey.cpp | #include"def.hpp"
#include<iostream>
using namespace std;
u64 generate_pos_key(const s_board *pos){
int sq=0;
u64 finalkey=0;
int piece=emptyy;
for(sq=0;sq<board_sq_num;sq++){
piece=pos->pieces[sq];
if(piece!=no_sq && piece!=emptyy && piece!=off_board){
ASSERT(piece>=wm &... | ALGO | 0.999441 | 4.418395 |
cef6bc09-1ca9-4fd5-9570-b83825f65c04 | dmkz/competitive-programming | codeforces.com/Codeforces Ladder 1700-1799 (extra)/0689D.cpp | /*
Problem: 689D. Friends and Subsequences
Solution: binary search, sparse table, O(n log(n))
Author: Dmitry Kozyrev, github: dmkz, e-mail: <EMAIL>
*/
#include <iostream>
#include <vector>
#include <algorithm>
#include <cassert>
#include <functional>
int main() {
std::ios_base::sync_with_std... | ALGO | 0.999943 | 4.958558 |
2bd2b10e-e657-4862-be23-326072f19a09 | ishandutta2007/codeforces | baluteshih/normal/1175/C.cpp | #include <bits/stdc++.h>
#define jizz ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define pb push_back
#define ET cout << "\n"
#define MEM(i,j) memset(i,j,sizeof i)
#define F first
#define S second
#define MP make_pair
#define ALL(v) v.begin(),v.end()
#define DB(a,s,e) {for(int i=s;i<e;++i) cout << a[i] << " ";ET;}... | ALGO | 0.999962 | 3.689711 |
c01eb143-69d8-414a-a0f2-a98f6f5fd19c | tickscn/leetcode | 448.找到所有数组中消失的数字.cpp | /*
* @lc app=leetcode.cn id=448 lang=cpp
*
* [448] 找到所有数组中消失的数字
*
* https://leetcode-cn.com/problems/find-all-numbers-disappeared-in-an-array/description/
*
* algorithms
* Easy (58.25%)
* Likes: 363
* Dislikes: 0
* Total Accepted: 40.1K
* Total Submissions: 68.5K
* Testcase Example: '[4,3,2,7,8,2,3,... | ALGO | 0.999843 | 5.90922 |
c4c911d7-c568-473c-b06c-3db1d72cb0a6 | sukhoeing/aoapc-book | TrainingGuide/bookcodes/ch6/uva10572.cpp | // UVa10572 Black and White
// Rujia Liu
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <map>
using namespace std;
int nrows, ncols, has_sol;
char partial[8][9]; // 输入网格
char grid[8][8], sol[8][8]; // 当前正在填的网格和解网格
struct State {
char color[8]; // 各列格子颜色
char up_left; ... | ALGO | 0.999717 | 3.941941 |
36aaa992-2c06-4cab-a4e7-0d16f90420db | KevinLaRocca/DartProjects | introduccion_flutter/introduccion/flutter_basics/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.998267 | 6.76775 |
69e5b685-5f9a-406c-be6b-af18c02bfbae | aelgailani/MBFEA | MBFEA/contact_forces.cpp | #include <iostream>
#include <string>
#include <vector>
#include <fstream>
#include <sstream>
#include <Eigen/Sparse>
#include <Eigen/Dense>
#include <cmath>
#include <sys/stat.h>
#include <dirent.h>
#include <iomanip>
#include <valarray>
#include "Parameters.hpp"
#include "Configuration.hpp"
#include "BaseSysData.hpp"... | ALGO | 0.980749 | 5.17684 |
dba947cd-759a-4786-901c-8b23190230c7 | MichalSara99/lss2 | unit_tests/sparse_solvers/lss_karawia_solver_t.cpp | #include "lss_karawia_solver_t.hpp"
#include "../../boundaries/lss_dirichlet_boundary.hpp"
#include "../../sparse_solvers/pentadiagonal/karawia_solver/lss_karawia_solver.hpp"
using lss_boundary::dirichlet_boundary_1d;
using lss_karawia_solver::karawia_solver;
using lss_utility::container_t;
void karawia_bvp_dirichle... | TEST | 0.968418 | 5.943842 |
93f8a4d6-a8ec-4a3e-aa92-c3293cc55f7e | int710/Zero_Basic_C | String/demtansuatcuastring.cpp | #include <stdio.h>
#include <string.h>
void toLowerStr(char str[]) {
int i;
for(i=0;i<strlen(str);i++) {
if(str[i] >= 'A' && str[i] <= 'Z') {
str[i]+=32;
}
}
}
int countStr(char str[],char ch) {
int count=0;
int i;
for(i=0;i<strlen(str);i++) {
if(str[i]==ch) {
count++;
}
} return count;
}
int ma... | ALGO | 0.99161 | 3.469848 |
34ee63fd-2c28-4225-b464-82288dbef10f | ishandutta2007/codeforces | cinnamoroll/normal/1131/C.cpp | // warm heart, wagging tail,and a smile just for you!
//
//
//
//
... | ALGO | 0.999977 | 3.223456 |
1f871cd1-5627-463b-b415-e04bc38df07e | duckysmacky/advent-of-code-2023 | Day14/2.cpp | #include <iostream>
#include <vector>
#include <fstream>
#include <algorithm>
std::vector<std::string> split(const std::string &s, char delimiter) {
std::vector<std::string> tokens;
std::string token;
for (char c : s) {
if (c == delimiter) {
if (!token.empty())
tokens.pu... | ALGO | 0.999912 | 5.58786 |
f9a0e3ed-5d81-49ae-ad0e-98730bb48cee | Mohammed-Waleed061126/Codeforces-Contests | Codeforces Beta Round 1/B. Spreadsheets.cpp | #include <bits/stdc++.h>
#define ll long long
#define ld long double
#define pl pair<ll, ll>
#define vi vector<ll>
#define sortx(X) sort(X.begin(),X.end());
#define el "\n"
#define yes cout<<"YES"<<el;
#define no cout<<"NO"<<el;
#define MW_HY ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
// ... | ALGO | 0.999681 | 3.577785 |
b075ac76-760a-4f8f-9e74-fbe48bbb740e | RHJihan/problem-solving | CodeForces/1829/1829A.cpp | // https://codeforces.com/contest/1829/problem/A
#include <iostream>
using namespace std;
int main() {
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
#endif
int t;
cin >> t;
string target = "codeforces";
while (t--) {
string s;
cin >> s;
int d... | ALGO | 0.999296 | 4.641832 |
08693d88-22bf-4ddf-9c70-fb36f2cd188f | LeoDiKadyrov/UniversityHomeWork | TopologicalWithList/Source.cpp | #include <iostream>
#include "Header.h"
using namespace std;
int main() {
Graf LD, newLD;
int n, i = 0;
n = LD.FormGraf();
LD.SortGraf(newLD);
int* res = new int[n];
Lider* t = newLD.head->next;
while (t != NULL) {
res[i] = t->key;
t = t->next;
i++;
}
cout << endl;
for (int i = 0; i < n; i++) {
cout... | ALGO | 0.999815 | 3.584063 |
b2734fac-12ff-4e6f-a606-1f6172e47aad | tuantruong-03/DSA | HashTable/HashTable/HashTable.cpp | #include "iostream"
#include <vector>
#include <sstream>
#include <fstream>
#include <string>
#include <math.h>
#define SIZE 2000
using namespace std;
struct Company
{
string name;
string tax_code;
string address;
};
using namespace std;
vector<Company> ReadCompanyList(string file_name) {
vector<Company> companyL... | ALGO | 0.994458 | 4.29745 |
17d80745-78f7-456c-95d6-0495c1ddf185 | ishandutta2007/codeforces | amnesiac_dusk/normal/631/D.cpp | /*
* I believe if I knew where I was going Id lose my way
* I believe that the words that he told you are not your grave
* I know that we are not the weight of all our memories
* I believe in the things that I am afraid to say
*
* I believe that today its okay to be not okay
*/
#pragma GCC optimize("Ofast,un... | ALGO | 0.999911 | 3.685447 |
30f9248f-0a8a-4d5e-8d6d-08d36b843c2e | langyanashish/Competitive-Programming | CNOTE.CPP | #include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--)
{
int x,y,k,n;
cin>>x>>y>>k>>n;
int a[n][2];
int flag=0;
for(int i=0;i<n;i++)
{
cin>>a[i][0];
cin>>a[i][1];
if(a[i][0]>=(x-y) && a[i][1]<=k)
flag=1;
}
if(flag==1)
cout<<"LuckyChef\n";
else
cout<<... | ALGO | 0.99969 | 3.117587 |
e5202d4a-8972-40d3-b4ca-5b51c6a2906f | AbdullahAhmed6859/neetcode-250 | Arrays-&-Hashing/1-concatenation-of-array.cpp | #include <vector>
using std::vector;
class Solution {
public:
vector<int> getConcatenation(vector<int>& nums) {
size_t oldSize = nums.size();
nums.resize(oldSize * 2);
for (size_t i = 0; i < oldSize; i++) {
nums[i + oldSize] = nums[i];
}
return nums;
}
}; | ALGO | 0.997816 | 5.614652 |
2ecc8f19-ff9b-408a-a350-bc41fb3a7a80 | ishandutta2007/codeforces | yancouto/normal/149/E.cpp | #include <bits/stdc++.h>
using namespace std;
#define fst first
#define snd second
typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
#define pb push_back
#define for_tests(t, tt) int t; scanf("%d", &t); for(int tt = 1; tt <= t; tt++)
template<typename T> inline T abs(T t) { return t < 0?... | ALGO | 0.999808 | 3.869553 |
e3b5b202-93dc-45fd-b691-d718c72f8fe8 | mazenmohamedmahmoudatia666/Daily-Coding- | 2109-Adding-Spaces-to-a-String.cpp | class Solution {
public:
string addSpaces(string s, vector<int>& spaces) {
string ss;
int l = 0;
for(int i = 0; i < s.size(); i++){
if(l < spaces.size() && i == spaces[l]){
ss += " ";
l++;
}
ss+= s[i];
... | ALGO | 0.999639 | 5.90109 |
0ca388aa-78cc-4998-bdea-f78142a535a2 | macarthur628/abc-tree | wxwidgets/wxWidgets-2.8.12/contrib/src/mmedia/g72x.cpp | /*
* g72x.c
*
* Common routines for G.721 and G.723 conversions.
*/
#include "wx/wxprec.h"
#include <stdlib.h>
#include "wx/mmedia/internal/g72x.h"
static short power2[15] = {1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80,
0x100, 0x200, 0x400, 0x800, 0x1000, 0x2000, 0x4000};
/*
* quan()
*
* quantizes the inpu... | ALGO | 0.998974 | 3.168157 |
a4dd3f41-0e64-4ab1-962d-20b5fbc5e4ce | krantirk/-self-driving-car | project_11_path_planning/src/Eigen-3.3/doc/snippets/MatrixBase_all.cpp | Vector3f boxMin(Vector3f::Zero()), boxMax(Vector3f::Ones());
Vector3f p0 = Vector3f::Random(), p1 = Vector3f::Random().cwiseAbs();
// let's check if p0 and p1 are inside the axis aligned box defined by the corners boxMin,boxMax:
cout << "Is (" << p0.transpose() << ") inside the box: "
<< ((boxMin.array()<p0.array(... | ALGO | 0.977863 | 3.51303 |
e2fe049e-715c-436b-838a-b0ac4e3a3ef2 | sarvex/leetcode-erlang | solution/1700-1799/1779.Find Nearest Point That Has the Same X or Y Coordinate/Solution.cpp | class Solution {
public:
int nearestValidPoint(int x, int y, vector<vector<int>>& points) {
int ans = -1, mi = 1e6;
for (int i = 0; i < points.size(); ++i) {
int a = points[i][0], b = points[i][1];
if (a == x || b == y) {
int d = abs(a - x) + abs(b - y);
... | ALGO | 0.999969 | 5.93421 |
a498e6d0-017d-4c66-9580-a3a17b1968a4 | shabah900/problem-solving | Two Buttons.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
int n,m,p=0;
cin>>n>>m;
while (m > n) {
if (m % 2 == 1) {
m += 1;
p++;
}
if (m % 2 == 0) {
m /= 2;
p++;
}
}
while (m < n) {
m += 1;
p++;
}
co... | ALGO | 0.999981 | 3.630445 |
9fc59ef6-7dad-4d06-8ab5-f67408bfd0dd | mamun4122/My-Online-Judge-Submission | UVA/532.cpp | #include<iostream>
#include<stdio.h>
#include<string.h>
#include<queue>
using namespace std;
int l,r,c,srcx,srcy,srcz,enx,eny,enz;
int adj[33][33][33];
int d[33][33][33];
int color[33][33][33];
bool bfs()
{
memset(d,0,sizeof(d));
memset(color,0,sizeof(color));
queue<int> a,b,c;
a.push(srcx);
b.push... | ALGO | 0.999914 | 3.304288 |
e5d70d8d-907d-42cf-b010-37f05753e1b8 | TudouSuperman/CPlusPlus | 黑马程序员/017-递增运算符/TestMain.cpp | //
// Created by QsPlus on 2022/8/28.
//
# include "iostream"
using namespace std;
int main()
{
// 1.前置递增。
int a = 10;
cout << "前置递增:" << ++a << endl;
// 2.后置递增。
int b = 10;
cout << "前置递增:" << a++ << endl;
// 3.前置与后置的区别。
// 前置递增,先让变量 + 1 然后进行表达式运算。
int a_1 = 10;
int a_2 = ++... | ALGO | 0.99542 | 4.256024 |
f397cc46-d552-4c88-987a-e957f4e3af0f | mdtariqueh007/My_Leetcode | 3429-special-array-i/special-array-i.cpp | class Solution {
public:
bool isArraySpecial(vector<int>& nums) {
int n = nums.size();
for(int i = 0;i<n-1;i++){
if((nums[i]%2)==(nums[i+1]%2)){
return false;
}
}
return true;
}
}; | ALGO | 0.999543 | 5.446141 |
c87bac31-cdfa-48e6-aa67-e159b286b2fe | wells-wei-wei/smplify-x_in_docker | boost_1_72_0/libs/geometry/index/example/benchmark_experimental.cpp | // Boost.Geometry Index
// Additional tests
#define BOOST_GEOMETRY_INDEX_DETAIL_EXPERIMENTAL
#include <iostream>
#include <boost/chrono.hpp>
#include <boost/foreach.hpp>
#include <boost/random.hpp>
#include <boost/range/algorithm/copy.hpp>
#include <boost/geometry.hpp>
#include <boost/geometry/index/rtree.hpp>
#inc... | TEST | 0.968242 | 4.477024 |
4790f8cf-e324-4933-b472-a5123093498a | dakarcoin/wallet | src/Nano/Signer.cpp | #include "Signer.h"
#include "../BinaryCoding.h"
#include "../Hash.h"
#include "../HexCoding.h"
#include <nlohmann/json.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <google/protobuf/util/json_util.h>
using namespace TW;
using uint128_t = boost::multiprecision::uint128_t;
using json = nlohmann::json;
na... | ALGO | 0.992463 | 7.158036 |
e61fe2f4-bfd4-4e10-b1bc-14ccce1eb27b | xxioachou/ACM | contest/牛客小白月赛93/B.cpp | #include <bits/stdc++.h>
#define x first
#define y second
#define sz(x) ((int)x.size())
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
const int inf = 0x3f3f3f3f;
const ll INF = 1e18;
const int mod = 998244353;
ll get(string &s) {
ll res = 0;
for(char c : s) {
res = res * 10 + c - '0';
r... | ALGO | 0.999966 | 5.556765 |
5acee7e4-6785-4a83-880b-ce67053b5973 | ishandutta2007/codeforces | semiexp/normal/715/C.cpp | #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
using namespace std;
#define MOD
#define ADD(X,Y) ((X) = ((X) + (Y)%MOD) % MOD)
typedef long long i64; typ... | ALGO | 0.999992 | 3.952357 |
bfbb07bd-f489-4c2f-935d-417123324d90 | djrondon/CSC699-Lexical-Text-Similarity | linear.cpp | /******************************************************************************
* Filename: linear.cpp
* Author: Zachary Colbert
* Contact: <EMAIL>
*
* Description: Implementation of linear algebra operations on vectors and
* matrices.
****************************************************************... | ALGO | 0.998779 | 6.944386 |
d6e1ba3d-5500-40db-bd2d-8623a5cfac0d | rennanfb/deep-forest-game | Conflict5.cpp | #include "Conflict5.hpp"
void Conflict5(std::vector <Character*> players, std::vector<NpCharacter*> enemies)
{
std::cout << std::endl;
std::cout << "------------------------------- Am i alive ? -------------------------------" << std::endl;
std::cout << "You feel sinking into a deep dark ocean, with countless silho... | TOOL | 0.896166 | 3.881091 |
009713f2-4e15-41df-82cf-44afb9778068 | nuaazdh/acm | 7-1-UVa725-Division.cpp | int check_valid(char *s) {
int a[10] = {0};
while (*s != '\0') {
a[*s - '0']++;
if (a[*s - '0'] > 1)
return 0;
++s;
}
return 1;
}
int main() {
int N;
char buff[20];
int kcase = 0;
while (scanf("%d", &N) && N) {
if(kcase++) printf("\n");
... | ALGO | 0.999562 | 4.206542 |
8291c524-af6d-46c0-868e-4605bf31f172 | ishandutta2007/codeforces | jklepec/normal/685/A.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; ++i)
typedef long long ll;
int N, M, n, m;
bool took[8];
int ln, lm, fn, fm;
vector<pair<ll, int> > v1, v2;
ll veliki(int pos, int num = 0, int pot = 1) {
if(pos == N && num <= n) return 1;
if(pos == N) return 0;
ll re... | ALGO | 0.99997 | 3.704966 |
993794c2-5ec1-40c6-afc2-0491184c0ec1 | anshulkumarx7/Data-Structures-and-Algorithms | Recursion/printSubArray.cpp | #include<iostream>
#include<vector>
using namespace std;
void printSubArray(vector<int>&v,int start,int end){
//base case
if(end==v.size()){
return;
}
for(int i=start;i<=end;i++){
cout<<v[i]<<" ";
}
cout<<endl;
//recursive call
print... | ALGO | 0.999257 | 5.377742 |
4b7d329f-1a11-473f-a65a-f47e0447dd57 | Krrish-29/DSA-Practice | DAY0051.cpp | // 2094. Finding 3-Digit Even Numbers
class Solution {
public:
vector<int> findEvenNumbers(vector<int>& digits) {
vector<int>answer;
int hashtable[10]={0};
for(int i=0;i<digits.size();i++){
hashtable[digits[i]]++;
}
if (hashtable[0]+hashtable[2]+hashtable[4]+hasht... | ALGO | 0.999724 | 6.037255 |
37efa29d-1149-4ddc-9079-c2cbe94c25f1 | RitchieLab/athena | tags/1.0.0/src/libGE-0.26/EXAMPLES/IntertwinedSpirals/GE_MITGALIB/spiral-lua.cpp | #include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<ga/ga.h>
#include<GE/ge.h>
#include "GEListGenome.h"
// Use lua for evaluation
extern "C"
{
#include <lua.h>
#include <lauxlib.h>
#include <lualib.h>
}
using namespace std;
// GE mapper, declared in main.cpp
extern GEGrammarSI mapper;
//... | ALGO | 0.992855 | 4.560902 |
2464d810-1b99-4556-af55-bf7c0829a868 | Prachi309/GFG-Questions | Difficulty: Medium/Partition Equal Subset Sum/partition-equal-subset-sum.cpp | //{ Driver Code Starts
// Initial Template for C++
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
// User function Template for C++
class Solution{
public:
bool isSubsetSum(int n, int arr[], long long k) {
vector<bool> prev(k + 1, 0), curr(k + 1, 0);
prev[0] = curr[0] = ... | ALGO | 0.999729 | 5.983887 |
005b3957-fa5c-4db9-b4cd-277aeb809e4e | miguelcram/AEED | Practicas/Practica2/Practica2.2.cpp | #include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
void mostrar(int array[], int max);
void Dados(int min, int max, int run);
void Dados(int min, int max, int run){
//srand(time(NULL));
int distribucion[max];
int num, i;
for(i=0; i<max; i++){
distribucion[i]=0;
... | ALGO | 0.90483 | 3.497369 |
4ab52f2b-a36f-4166-bb18-8f6f7bd7cd0a | Graspan-system/Graspan-C | src/compute/array/arraystomerge.cpp | #include "arraystomerge.h"
#include "../../algorithm/myalgorithm.h"
#include "../minheap.h"
#include <limits.h>
namespace myarray {
ArraysToMerge::ArraysToMerge() {
size = capacity = arraySize = arrayCapacity = numEdges = 0;
resEdges = NULL; resLabels = NULL;
}
void ArraysToMerge::mergeKArrays() {
if(size) {
v... | ALGO | 0.992503 | 3.530521 |
9d505a0c-ace6-4b4e-abfd-f3cd980df6f1 | AkshayRamchandraDhole/Flutter | Dart/Building_Core_Of_Flutter/Assignment/29Jan/Assignment1/stateful_assigment_01/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.998382 | 6.762122 |
0be0a168-b7e8-4cb1-bafb-d59e34e0738b | ShJavokhir/University-Projects | Freshmen year/lab11-semester2/2.cpp | /*
This code is written by Javokhir Shomuratov
U2010257
Started at; 21:19 22-april 2021
Finished at: 12:09 23-april 2021
Telegram: @shjavohir
Github: https://github.com/shjavokhir
*/
#include <iostream>
#include <fstream>
using namespace std;
//defining Person class
class Person
{
private:
... | TOOL | 0.904436 | 4.932936 |
3552d786-d970-477f-88e4-25cb1f0d6261 | gagaducko/leetcode_everyday | cn/C++/question/____03_06_Animal_Shelter_LCCI.cpp | // @algorithm @lc id=100228 lang=cpp
// @title animal-shelter-lcci
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
class AnimalShelf {
private:
queue<int> cat;
queue<int> dog;
public:
AnimalShelf() {
}
void enqueue(vector<int> animal) {
if (animal[1] == 0... | ALGO | 0.998744 | 5.62675 |
0b5eacae-2bb0-4441-867a-ce2b16e042b6 | Nullray/ICT | software/workload/firesim/host/firesim-lib/lib/boost/libs/filesystem/example/tut4.cpp | // filesystem tut4.cpp ---------------------------------------------------------------//
// Library home page: http://www.boost.org/libs/filesystem
#include <iostream>
#include <vector>
#include <algorithm>
#include <boost/filesystem.hpp>
using std::cout;
using namespace boost::filesystem;
int main(int argc, char... | TOOL | 0.888691 | 6.198208 |
f2ae2d3d-c9eb-4b72-9c3e-0990c6d56b2d | aanda-stcloudstate-edu/WebSpace | cs201/Gaddis/9e/SourceCode/Chapter 17/Program 17-36.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include "IsEven.h"
using namespace std;
int main()
{
// Create a vector of ints.
vector<int> v = { 1, 2, 3, 4, 5, 6, 7, 8 };
// Get the number of elements that even.
int evenNums = count_if(v.begin(), v.end(), IsEven());
// Display the result... | ALGO | 0.988759 | 5.993044 |
1911d7d6-4f9c-4cdb-938b-21ebc937401b | gjmingsg/Code | hackerrank/Data Structures/tree-height-of-a-binary-tree.cpp | #include<stdlib.h>
#include<iostream>
using namespace std;
/* you only have to complete the function given below.
Node is defined as
*/
struct node
{
int data;
node* left;
node* right;
};
void height_of_bt(node * root,int level,int& max)
{
if(root!=NULL){
height_of_bt(root->left,level+1,max... | ALGO | 0.999359 | 5.03703 |
e584cf26-1437-4375-b91f-59f938c091f7 | ishandutta2007/codeforces | nigus/normal/520/A.cpp | //#pragma GCC optimize("O3") //
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define per(i, b, a) for(int i = b - 1; i >= a; i--)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<i... | ALGO | 0.999992 | 3.974998 |
1f25d630-14b5-42c4-a71d-f9ce5cb999a0 | Vaib215/CPP | functions_pascals.cpp | #include<iostream>
using namespace std;
int fact(int n){
if (n==1||n==0)
{
return 1;
}
else
{
return n*fact(n-1);
}
}
int bin_coeff(int n,int r){
return fact(n)/(fact(n-r)*fact(r));
}
int main(){
//Author: VAIB
int n; cin>>n;
for (int i = 0; i < n; i++)
{... | ALGO | 0.999969 | 4.003489 |
42479a22-f224-4b6f-9477-f6df4424189a | ashok2811/CP_OLD | Library/nCr.cpp | #include <bits/stdc++.h>
using namespace std;
long long nCr(int n , int r){
long long res = 1 ;
for(int i = 0 ; i< r ; i++){
res *=(long long)(n-i);
res /=(long long)(i+1);
}
return res;
}
int main() {
int n , r ; cin >> n >> r ;
cout << nCr(n,r);
return 0;
}
| ALGO | 0.999949 | 5.736546 |
f8989f98-44e5-4771-a22b-ccbd38595138 | nisarg0/Algorithm-Implementation | Arrays/TrappingRainwater.cpp | #include<bits/stdc++.h>
using namespace std;
class Solution {
public:
int trap(vector<int>& height) {
int n = height.size();
int left=0; int right=n-1;
int res=0;
int maxleft=0, maxright=0;
while(left<=right){
if(height[left]<=heig... | ALGO | 0.999936 | 6.632256 |
e95d2fad-de07-4e30-8a44-0b2efdcbffe5 | theTerminatorrr/LeetCode-Solutions | 455. Assign Cookies.cpp | class Solution
{
public:
int findContentChildren(vector < int > & g, vector < int > & s)
{
sort(g.begin(), g.end());
sort(s.begin(), s.end());
int ans = 0;
int i = 0, j = 0;
while (i < g.size() && j < s.size())
{
if (s[j] >= g[i])
{
... | ALGO | 0.999698 | 5.744263 |
f81a066d-4a5d-48d9-8f2e-98898e82c6d7 | skyshaw/snippets | c-cpp/re.cpp | #include <algorithm>
#include <string>
#include <utility>
#include <cctype>
#include <list>
#include <cassert>
#include <iostream>
#include <iterator>
class NFA {
public:
NFA(const std::string& re) : re_(re) {
pos = re_.begin();
get_token();
nfa = build_nfa();
assert(re_.end() == pos);
}
private... | ALGO | 0.998802 | 4.69524 |
a1ddad16-0794-44c4-93b9-1f862b45934b | fat1maa/data-structure | 41.stack functions.cpp | #include<iostream>
using namespace std;
int stack[100],n=100,top=-1;int temp;int empty;int arraypop[100];int counter=0;
void push (int val)
{
if(top>=n-1)
cout<<"stack overflow "<<endl;
else
{
top++;
stack[top]=val;
}
}
void pop()
{
if(top<=-1)
cout<<"stack underflow "<<endl;
else
{
cout<<"the popped ... | ALGO | 0.989289 | 3.343926 |
c011a38d-2f93-4e28-86a6-58c458736f52 | kuretru/Programming-Learning | Courses/Data-Structure/09-排序2 Insert or Merge.cpp | #include <algorithm>
#include <iostream>
#include <vector>
std::vector<int> insertion_sort(std::vector<int> data, std::vector<int> sequence)
{
bool found = false;
for (int i = 2; i <= data.size(); i++)
{
std::sort(data.begin(), data.begin() + i);
if (found)
return data;
... | ALGO | 0.999995 | 5.035761 |
d9a7211e-e75e-4568-aec4-3b31bb1fd13d | shubhrajyotidey305/Leetcode | 222-count-complete-tree-nodes/222-count-complete-tree-nodes.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.999907 | 6.840047 |
f2ace49f-7e83-40a0-8ac4-bbcfe6154b7d | amineAllache/llvm-bolt19 | flang/runtime/reduce.cpp | // REDUCE() implementation
#include "flang/Runtime/reduce.h"
#include "reduction-templates.h"
#include "terminator.h"
#include "tools.h"
#include "flang/Runtime/descriptor.h"
namespace Fortran::runtime {
template <typename T, bool isByValue> class ReduceAccumulator {
public:
using Operation = std::conditional_t<is... | TOOL | 0.968247 | 7.399823 |
b9f43126-8d43-41ef-a347-55d924c265aa | tabletan1/c-code | Next Permutation/Next Permutation/main.cpp | #include <iostream>
#include <vector>
using namespace std;
void nextPermutation(vector<int>& nums) ;
int main(int argc, const char * argv[]) {
// insert code here...
vector<int> a={1,3,2};
nextPermutation(a);
cout << a[1] << a[2] << endl;
return 0;
}
void nextPermutation(vector<int>& nums) {
in... | ALGO | 0.999985 | 4.707057 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.