uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
a0cc2488-e440-47d5-b033-86fdb6af18a7 | sairaj2003/OOP-s-CPP | FunctionOverloading.cpp | #include <iostream>
using namespace std;
class overloading
{
public:
int num1=10,num2=20;
void fun(double a,double b)
{
double sum=num1+num2;
cout<<"Sum:"<<sum<<endl;
}
void fun(int a,int b)
{
int sub=a-b;
cout<<"Subtraction is:"<<sub;
}
};
int main()
{
overloading test;
test.fun... | TOOL | 0.95222 | 4.488643 |
5d2af4a5-662c-472c-a9e4-01f91f7a8214 | Larry-Kuo/Leetcode | P228_summaryRanges.cpp | class Solution {
public:
vector<string> summaryRanges(vector<int>& nums) {
vector<string> ans;
string arrow = "->";
int n = nums.size();
if(n==0){
return ans;
}
else if(n==1){
ans.push_back(to_string(nums[0]));
return ans;
}... | ALGO | 0.999963 | 6.503305 |
ae8771e2-5825-40b1-ac8a-8894cbf7c12a | Hrithik08-varshney/C-Practice | Prefix Sum 1D.cpp | /*Given array a of N integer. Given Q queries
and in each query given L and R. Print sum of
array elements from index L to R.
Constraints
1<=N<=10^5
1<=a[i]<=10^9
1<=Q<=10^5
1<=L,R<=N
*/
//without constraints
/*#include<bits/stdc++.h>
using namespace std;
int main(){
#ifndef ONLINE_JUDGE
freopen("input.txt","r",st... | ALGO | 0.999933 | 5.367371 |
c93f9b71-2965-4b10-802c-ddb32b53a6ec | Gonaz/HierarchicalTextClassification | Project TBIR/tc3.cpp | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
#include "tc3.h"
#include "util.h"
NBC3::NBC3(const PatentList &patents) : patents{patents} {
calculateClasses();
calculateSections();
calculatePriors();
calcula... | ALGO | 0.998927 | 7.093566 |
d989f5f2-c633-47b1-8437-a966295ff4c1 | nathanhulet/HashTestingDS316 | chainingArray.cpp | //
// Created by Nathan Maynard Hulet on 4/20/22.
//
#include "chainingArray.h"
#include <iostream>
// constructor
chainingArray::chainingArray() {
// starts with space for 8 elements all initialized to -1
arrayPointer = new int[8];
for (int i = 0; i < 8; ++i) {
arrayPointer[i] = -1;
}
cap... | TOOL | 0.993623 | 4.492128 |
617fdb37-60f4-4328-a791-8d7a9d158393 | muhammadabdurrehmanmaqsood/100-CPP-Problems | PatternPrograms58.cpp | #include <iostream>
using namespace std;
//PatternPrograms73
int main() {
int n=5;
for(int i=n; i>=1; i--){
for(int j=1; j<=i; j++){
cout<<i<<" ";
}
cout<<endl;
}
return 0;
} | ALGO | 0.999546 | 4.190088 |
0fd0e598-2b1a-4f9f-b135-a6740a20a59a | 3di/3di-viewer-rei-libs | irrlicht_r1883/Irrlicht SDK/source/Irrlicht/COctTreeTriangleSelector.cpp | #include "COctTreeTriangleSelector.h"
#include "ISceneNode.h"
#include "os.h"
namespace irr
{
namespace scene
{
//! constructor
COctTreeTriangleSelector::COctTreeTriangleSelector(const IMesh* mesh,
const ISceneNode* node, s32 minimalPolysPerNode)
: CTriangleSelector(mesh, node), Root(0), NodeCount(0),
MinimalPo... | ALGO | 0.963324 | 7.144733 |
86b6a0a8-bea0-455c-a404-ca5f68958394 | Ana2804/ece511_final | src/systemc/tests/systemc/misc/v1.0/dash1/pulse.cpp | /*****************************************************************************
pulse.cpp -- Implementation of the pulse generator.
Original Author: Ali Dasdan, Synopsys, Inc.
*****************************************************************************/
/*****************************************************... | TOOL | 0.934265 | 6.360893 |
ad365146-e325-4eb0-9d93-70bf0b7683c2 | MoyillaLaliteswari/leetcode | 2236-root-equals-sum-of-children/2236-root-equals-sum-of-children.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.999974 | 6.519585 |
4e981ae0-1e79-407f-8c7a-ca068ab0c59b | ishandutta2007/codeforces | karry5307/normal/901/E.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
const ll MAXN=6e5+51;
set<ll>res;
set<ll>::iterator it;
ll MOD,G,INVG;
ll fd,cnt,limit,inv2,v,p,q,r,s,sum,cur;
ll f[MAXN],g[MAXN],rev[MAXN],tmp[MAXN],delta[MAXN],delta2[MAXN],h[MAXN];
inline ll read()
{
register ll num=0,neg=1;
register char... | ALGO | 0.999976 | 3.170398 |
4aace7c4-1e26-473e-9dcc-6742c3032ed7 | 93Hong/Algorithms | 1149_RGB/Main.cpp | #include <cstdio>
#include <algorithm>
using namespace std;
int D[1001][3], home[1001][3];
int main() {
int N;
scanf("%d", &N);
for (int i = 0; i<N; i++) {
for (int j = 0; j<3; j++) {
scanf("%d", &home[i][j]);
}
}
D[0][0] = home[0][0];
D[0][1] = home[0][1];
D[0][2] = home[0][2];
for (int i = 1; i<N... | ALGO | 0.999608 | 3.800394 |
d8701da5-50ed-40e1-ad1a-f3750267bc7a | iashu-777/cpp-prgramming-language | Vaccine_Dates.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 998244353
#define loop(a,b,c) for(ll i=a;i<b;i+=c)
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll t;
cin>>t;
while(t--)
... | ALGO | 0.999929 | 4.32891 |
70a126b9-ced4-4b5c-9028-affdadcfbb35 | MinhTamPhan/CSES-Problem-Set | 0.Introductory-Problems/13.Creating-String.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
sort(s.begin(), s.end());
vector<string> permu;
do {
permu.push_back(s);
} while (next_permutation(s.begin(), s.end()));
cout << permu.size() << endl;
for (int i = 0; i < permu.size(); i++)
cou... | ALGO | 0.999958 | 5.018498 |
35851d85-6c5c-408a-9745-5b9dc8579d46 | MohitJain617/DSA-JAVA | Algo/GeneratingPermutations.cpp | #include <iostream>
#include <vector>
using namespace std;
//prints all the permutation of a string
void permut(string s,string ans=""){
int l=s.size();
if(l==0){
//process
cout<<ans<<endl;
return;
}
if(l==1){
permut("",ans+s[0]);
return;
}
for(int i=0;i<l;i++){
string temp;
if(i==0){
permut(s.... | ALGO | 0.999918 | 4.476187 |
1bf89c01-463a-4f36-8260-901d2e358cd7 | Aditya-Trivedi-06/Google-Kickstart-Solutions | 2019/G/A.cpp | #include <bits/stdc++.h>
#define ll long long
#define ld double
#define uint unsigned int
#define ull unsigned long long
#define ff first
#define ss second
// For Loops ----------------------------
#define lp(i, n) for (int i = 0; i < n; i++)
#define lp1(i, n) for (int i = 1; i < n; i++)
// Vectors / pairs / maps ... | ALGO | 0.999852 | 3.648619 |
54fb79b1-12ff-4c0d-ba95-898aae5a0fb6 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_6585_5.cpp | #include <bits/stdc++.h>
using namespace std;
int a[100005], p[100005], fa[100005];
vector<int> v[100005];
int findd(int x) {
if (x == fa[x]) {
return x;
} else {
return fa[x] = findd(fa[x]);
}
}
int main() {
int n, m, x, y;
scanf("%d%d", &n, &m);
int ans = n - 1;
for (int i = 1; i <= n; i++) {
... | ALGO | 0.999915 | 4.104094 |
169c6135-2bb2-4b92-a563-be39ab8f194b | Credosvaldo/OBI | Nivel1/Fase2/autoEstrada.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n,resp=0;
cin>>n;
char v[n];
for(int i=0;i<n;i++)
cin>>v[i];
for(int i=0;i<n;i++)
{
if(v[i]=='P'||v[i]=='C')
{
resp+=2;
}
else if(v[i]=='A')
{ resp++;
}
}
... | ALGO | 0.996923 | 3.315915 |
87ee8ba5-5ae3-4b7a-ad5c-3d9eed7e5ff9 | KaranTalreja/LeetCode | src/wiggle-sort/solution.cpp | /*
Given an unsorted array nums, reorder it in-place such that nums[0] <= nums[1] >= nums[2] <= nums[3]....
For example, given nums = [3, 5, 2, 1, 6, 4], one possible answer is [1, 6, 2, 5, 3, 4].
*/
class Solution {
public:
void wiggleSort(vector<int>& nums) {
int size = nums.size();
if (!size) ret... | ALGO | 0.999992 | 5.644042 |
be302211-02a5-466f-abcb-932523292e55 | fankurr/python-ai-test | opencv-4.x/samples/cpp/tutorial_code/calib3d/real_time_pose_estimation/src/main_detection.cpp | // C++
#include <iostream>
// OpenCV
#include <opencv2/core.hpp>
#include <opencv2/core/utils/filesystem.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/calib3d.hpp>
#include <opencv2/video/tracking.hpp>
// PnP Tutorial
#include "Mesh.h"
#include "Model.h"
#include "PnPProblem.h"
#i... | ALGO | 0.99144 | 7.564085 |
8eebe777-fefe-4524-94ef-c110c665e29c | hariom2002/MY_DSA | 0518-coin-change-ii/0518-coin-change-ii.cpp | class Solution {
public:
int change(int amount, vector<int>& coins) {
vector<vector<int>> dp(coins.size()+1, vector<int> (amount+1, 0));
for(int i=0;i<coins.size()+1;i++){
for(int j=0;j<amount+1;j++){
if(i == 0)dp[i][j] = 0;
if(j == 0)dp[... | ALGO | 0.999921 | 5.928733 |
661389a7-0611-4a05-b905-be8e99875bab | cmsong111/article-app | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998799 | 6.776823 |
a4ee2736-7a7d-44f1-aea2-32c7e7917f07 | Misiulavlad/StudentCppRevisionTask08Project | task04.cpp | #include "tasks.h"
/* Task 04. Student and Swimming Pool [студент и бассейн]
*
* Студент плавал в бассейне размером N×M метров и устал. В этот момент он
* обнаружил, что находится на расстоянии X метров от одного из ДЛИННЫХ
* бортиков (не обязательно от ближайшего) и Y метров от одного из КОРОТКИ бортиков.
* Ка... | ALGO | 0.99946 | 4.839602 |
476ea141-b24d-4d4d-84d9-ae1e2becd63b | INikolaR/CPPHomeworks | tasks/scorer/scorer.cpp | #include "scorer.h"
#include <vector>
bool Comparator(const Event*& first_event, const Event*& second_event) {
return first_event->time < second_event->time;
}
ScoreTable GetScoredStudents(const Events& events, time_t score_time) {
std::vector<const Event*> sorted_events(events.size());
size_t index = 0;... | ALGO | 0.952743 | 6.332804 |
a91b3e54-f89e-4c32-9692-deff95a83dc3 | Vandan121/VS-code | Coding/Codeforces/Codeforces Round #772 (Div. 2)/Avoid Local Maximums.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define cd complex<ld>
#define pi pair<int, int>
#define pl pair<ll,ll>
#define pd pair<ld,ld>
#define vi vector<int>
#define vd vector<ld>
#define vl vector<ll>
#define vpi vector<pi>
#define vpl vector<pl>
#define vcd vecto... | ALGO | 0.999817 | 3.233021 |
2b0f354d-ac8e-48f4-9320-c25f03a93412 | 7princekumar/competitive_coding | coding_ninjas/basics_recursion/merge_sort.cpp | #include <iostream>
using namespace std;
void print(int* a, int n) {
for(int i=0; i<n; i++) {
cout << a[i] << " ";
}
cout << endl;
}
void merge(int* arr, int sp, int mp, int ep){
int* merged = new int[ep-sp]; //create an array for elements btw sp and ep
int i = sp;
int j = mp + 1;
int k = 0;
while(i <= mp &... | ALGO | 0.999983 | 4.643092 |
1233639c-34a7-4c40-b201-1bb9a174954d | InvincibleSarthak/Competitive-Programming | UniqueElements-III.cpp | //To print the unique element from an array where all the other elements are present three times
#include<iostream>
using namespace std;
#define ll long long int
const int N=1000002;
int arr[N];
int main(){
ll a,res[64]={0};
cin>>a;
for(ll i=0;i<a;i++){
cin>>arr[i];
}
for(ll i=0;i<a;i++){
... | ALGO | 0.999969 | 3.706382 |
4176db15-b697-4968-9cd7-398e27687f4b | 87092rohitkumar/DSACPP | ArrayDifference.cpp | #include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
void subTwoArrays(vector<int> &a, vector<int> &b){
int n = a.size();
int m = b.size();
int i = n-1;
int j = m-1;
vector<int>ans(max(n,m), 0);
int k = ans.size() - 1;
int borrow = 0;
while(k>=0){
int di... | ALGO | 0.999756 | 4.593389 |
ced4a72c-e8ca-4487-a920-7bc7bba34731 | JeffafaV/Mastering-Data-Structures-and-Algorithms | Section 7/reversing_an_array.cpp | #include <iostream>
using namespace std;
// array abstract data type (adt)
struct Array // struct for array
{
int A[10]; // array of size 10
int size; // size of array
int length; // number of elements in array
};
// prints the array
void display(struct Array arr)
{
printf("Elements in array:\n");
... | ALGO | 0.989858 | 5.140494 |
1befc8c7-ba41-407c-916a-e96c47c9067d | talas/OpenJK-OJP | code/qcommon/cm_polylib.cpp | // this is only used for visualization tools in cm_ debug functions
#include "cm_local.h"
// counters are only bumped when running single threaded,
// because they are an awefull coherence problem
int c_active_windings;
int c_peak_windings;
int c_winding_allocs;
int c_winding_points;
void pw(winding_t *w)
{
int i;... | ALGO | 0.988871 | 4.979113 |
91d89634-957f-432d-bf34-ac01fb98bfe5 | sounishnath003/practice-180D-strategy | Codechef-Long/DEC02B/evenpair.cpp | #include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
using namespace std ;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
template < class c > s... | ALGO | 0.999923 | 5.729041 |
40fc0535-0fd9-41fe-8c33-7538f6855eaf | Arrow-DV/CPP-Problems | Easy/8 Kyu/Find the smallest integer in the array.cpp | #include <vector>
#include <algorithm>
using namespace std;
int findSmallest(vector <int> list)
{
std::sort(list.begin(),list.end());
return list.front();
} | ALGO | 0.998801 | 4.20382 |
dc7e5258-b524-4dbe-9922-901ec025696d | coussiraty/PWClient-152 | PWClient152/CElementEditor/PathMap/Matrix.cpp | //////////////////////////////////////////////////////////////////////
// Matrix.cpp
//
// CMatrix ʵļ
//
// ܳ, 2002/8
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "Matrix.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#... | TOOL | 0.957297 | 4.008213 |
bad54c9d-7c4f-474f-8080-70e5371d1eb8 | jun-pac/PS | 231227/5set/C.cpp |
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define fi first
#define se second
#define cediv(a,b) ((a)%(b)==0?((a)/(b)):((a)/(b))+1)
#define rng(i,a,b) for(int i=int(a);i<=int(b);i++)
#define rep(i,b) rng(i,0,b-1)
#define gnr(i,b,a) for(int i=int(b);i>=int(a);i--)
#define per(i,b) gnr(i,b-1,0)
#d... | ALGO | 0.999973 | 4.347064 |
73e581b5-a744-412f-b15e-6ba5ae9cf050 | anagorko/algorytmika | home/evildevill/ffibonacci.cpp | #include<iostream>
using namespace std;
int fibonacci(int n)
{
int a, b, c;
a = 0;
b = 1;
c = 0;
for(int i=1; i <= n; i++)
{
a = b;
b = c;
c = a + b;
}
return c;
}
int main()
{
int n;
cin >> n;
cout << fibonacci(n) << endl;
return 0;
}
| ALGO | 0.999986 | 4.716697 |
24389c14-3b13-4ba6-8537-4e29cc565d81 | MummidiLakshman/OWLCODER | Count Primes In Range(Seive algorithm).cpp | public:
void seive(int *prime,int n)
{
prime[0]=1;
prime[1]=1;
for(int i=2;i*i<=n;i++)
{
if(prime[i]==0)
{
for(int j=i*i;j<=n;j+=i)
{
prime[j]=1;
}
}
}
}
int ... | ALGO | 0.999961 | 4.460718 |
e70c3dfd-ba18-4bf3-9f96-f20323b8221b | IntelEmbeddedSystemCompetitionPKU/LostAndFound | client_qt/qtvirtualkeyboard/src/virtualkeyboard/3rdparty/pinyin/share/splparser.cpp | #include <assert.h>
#include "../include/splparser.h"
namespace ime_pinyin {
SpellingParser::SpellingParser() {
spl_trie_ = SpellingTrie::get_cpinstance();
}
bool SpellingParser::is_valid_to_parse(char ch) {
return SpellingTrie::is_valid_spl_char(ch);
}
uint16 SpellingParser::splstr_to_idxs(const char *splstr, ... | ALGO | 0.863426 | 5.228116 |
e8b7123f-9f4b-4767-a210-4cb104325058 | 4hund3rbird/CPP | College assignments/lab_assignment3.cpp | #include<iostream>
#include<limits>
using namespace std;
template<class T>
T selection_sort() //Template function
{
T a[10];
T temp;
for(int i=0;i<10;i++) //Accepting elements
{
cout<<"a["<<i<<"]=";
cin>>a[i];
... | ALGO | 0.995899 | 4.222931 |
b4e7d5d6-d711-4429-900c-eae46d454dc5 | howerj/junk | projects/repo/libprolog/ext/little_logic/main.cpp | #include <iostream>
#include <string>
#include <vector>
#include <map>
#include <memory>
#include <sstream>
#include "variant.h"
#include "variable_handle.h"
#include "parameter.h"
#include "text_clause.h"
#include "parser.h"
#include "compiled_clause.h"
#include "runtime.h"
void enumerate_predicate(const std::string... | ALGO | 0.990133 | 5.632396 |
0638ec00-951b-437d-bce0-b4c262030954 | imjoyhalder/Leetcode_Problem_solving | January/Day-11/B_Number_of_Smaller.cpp | #include<bits/stdc++.h>
#define ll long long
#define nl '\n'
#define all(v) v.begin(),v.end()
#define print(v) for(auto data: v) cout<<data<<' '
#define yes cout<<"YES"<<nl;
#define no cout<<"NO"<<nl;
using namespace std;
int main(){
ios::sync_with_stdio(false);
cin.tie(NULL);
int n,m; cin>>n>>m... | ALGO | 0.999997 | 3.872798 |
060fb880-3d06-4f90-b120-7f955c8ec34d | ezra08mc/tugas | Penentuan Kuadran/penentuan_kuadran.cpp | #include <iostream>
using namespace std;
int main() {
float X, Y;
cout << "Masukkan koordinat X: ";
cin >> X;
cout << "Masukkan koordinat Y: ";
cin >> Y;
if (X > 0 && Y > 0) {
cout << "Titik (" << X << ", " << Y << ") berada di Kuadran I.\n";
} else if (X < 0 && Y > 0) {
c... | ALGO | 0.998779 | 4.63737 |
016389a3-0b95-4cbb-ab53-51608e26c41c | nhamlv-55/Ropey | z3grpc/src/api/api_parsers.cpp | #include<iostream>
#include "api/z3.h"
#include "api/api_log_macros.h"
#include "api/api_context.h"
#include "api/api_util.h"
#include "api/api_ast_vector.h"
#include "cmd_context/cmd_context.h"
#include "smt/smt_solver.h"
#include "parsers/smt2/smt2parser.h"
#include "solver/solver_na2as.h"
extern "C" {
// -----... | TOOL | 0.959743 | 5.525828 |
6c02c12a-db0b-4b58-b6f0-75d045602a8b | Debraj-Das/DSA | Material/youtube/cses/IntroductoryProblems/1623.cpp | // Problem: Apple Division
// URL: https://cses.fi/problemset/task/1623
// Memory Limit: 512 MB
// Time Limit: 1000 ms
/*
"You cannot believe in God until you believe in yourself."
by Swami Vivekananda
*/
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#p... | ALGO | 0.999987 | 5.29045 |
669fb36f-7bc6-46c3-9eda-f618c19e4005 | pranavajith/CP-Practice | CP (Until Creation of Repo)/CPH/B_Nastya_and_Door.cpp | #include <bits/stdc++.h>
#include <iostream>
#include <set>
#include <cmath>
#include <map>
#include <sstream>
#include <deque>
#include <algorithm>
#include <limits>
#include <iomanip>
using namespace std;
#define ll long long
// #define TxtIO freopen("input.txt","r",stdin); freopen("output.txt","w",stdout); freopen... | ALGO | 0.999895 | 3.917018 |
988979d4-0657-43f4-aadb-5705d6508547 | shacojx/SourceCodeGameTLBB | Game/boost/libs/graph/example/miles_span.cpp | // Sample output:
//
// The graph miles(100,0,0,0,0,10,0) has 405 edges,
// and its minimum spanning tree has length 14467.
//
#include <boost/config.hpp>
#include <string.h>
#include <stdio.h>
#include <boost/graph/stanford_graph.hpp>
#include <boost/graph/prim_minimum_spanning_tree.hpp>
// A visitor class for ac... | ALGO | 0.998091 | 4.259951 |
f2efcd74-cda7-4515-b6e8-3402c96c2165 | sauravkr818/LeetCode | 1334-find-the-city-with-the-smallest-number-of-neighbors-at-a-threshold-distance/1334-find-the-city-with-the-smallest-number-of-neighbors-at-a-threshold-distance.cpp | class Solution {
public:
int findTheCity(int n, vector<vector<int>>& edges, int distanceThreshold) {
vector<vector<int>>dist(n,vector<int>(n,INT_MAX));
for(auto it: edges){
int u = it[0];
int v = it[1];
int wt = it[2];
dist[u][v] = wt;
... | ALGO | 0.999989 | 6.250393 |
ee20c98f-aafb-49f7-81a5-40207dd1681d | cportugalz/pucp_gpu | samples/Samples/4_CUDA_Libraries/simpleCUBLAS_LU/simpleCUBLAS_LU.cpp | /*
* This example demonstrates how to use the cuBLAS library API
* for lower-upper (LU) decomposition of a matrix. LU decomposition
* factors a matrix as the product of upper triangular matrix and
* lower trianglular matrix.
*
* https://en.wikipedia.org/wiki/LU_decomposition
*
* This sample uses 10000 matrices ... | ALGO | 0.999504 | 4.197081 |
ce182ecd-52c9-4715-8b2c-bc03e67d89ff | LJ-hyeok/Algorithm_with_C | 2022/1158.cpp | #include<iostream>
#include<queue>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
queue<int> q,ans;
int N, K;
cin >> N >> K;
for(int i=1;i<=N;i++) q.push(i);
for(int i=0;i<N;i++){
for(int j=0;j<K-1;j++){
q.push(q.front());
q.pop();
}
ans.push(q.front())... | ALGO | 0.999956 | 3.017535 |
e914a10c-a846-499d-800f-1e62f30a37f0 | miteshkumar77/LC | merge-intervals/Accepted/11-18-2020, 5:38:40 PM/Solution.cpp | // https://leetcode.com/problems/merge-intervals
class Solution {
public:
vector<vector<int>> merge(vector<vector<int>>& intervals) {
if (intervals.size() == 0) {
return intervals;
}
sort(intervals.begin(), intervals.end(), [] (vector<int>& a, vector<int>& b) -> bool {
... | ALGO | 0.999999 | 6.548759 |
cb0d537a-1d6c-4235-a268-cd3672b41b40 | Pedrovsdf/Questoes-com-Temas-Variados-em-C | Questões Aleatórias em C/gay.cpp | #include<stdio.h>
#include <locale.h>
int main(){
setlocale(LC_ALL, "Portuguese");
int I;
float A, B, C, aux;
printf("menu:\n 1 -> para ordem crescente\n 2 -> para ordem descrescente\n 3 -> para que o maior valor fique no meio \n\n");
printf("Digite sua opo: "); scanf("%d", &I);
if( I >= 1 && I <=3 ){
... | ALGO | 0.99985 | 3.741986 |
4b708df0-2d8a-48ab-9add-fc76c93c4a50 | ishandutta2007/codeforces | emthrm/normal/1374/B.cpp | #define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
using ll = long long;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007... | ALGO | 0.999925 | 4.490745 |
61f15e06-93ef-40a7-a1f4-cec92b3c2aec | MaciejWojs/WAP | Lab14/Lab14_4/Lab14_4.cpp | /*
Napisz program sprawdzający, czy dana liczba naturalna jest elementem ciągu Fibonacciego.
Program powinien wczytywać liczbę ze standardowego wejścia i drukować na standardowe wyjście odpowiedni komunikat.
*/
#include <iostream>
#include <fstream>
#include <string>
using string = std::string;
string nazwaP... | ALGO | 0.997204 | 5.130862 |
42853ba0-1241-4fc8-9f46-4dbdea923d59 | JunheeLee7/Programers.CP | [프로그래머스 C++] 인덱스 바꾸기.cpp | ◈ 문제 설명 링크
https://school.programmers.co.kr/learn/courses/30/lessons/120895
◈ 작성 코드
#include <string>
#include <vector>
using namespace std;
string solution(string my_string, int num1, int num2)
{
string answer = "";
for(int i = 0; i < my_string.size(); i++)
{
if(i == num1)
{
... | ALGO | 0.999966 | 4.752826 |
643e23d6-ff52-41fb-9610-d7df15293999 | Monathakur803/DSA_loveBabbar | 8_week2_lec2Arrayclass2/3.1union_2_arrray.cpp | #include <iostream>
#include <vector>
using namespace std;
int main()
{
int arr[] = {1, 3, 5, 7, 9};
int sizea = 5;
int brr[] = {2, 4, 6, 8};
int sizeb = 4;
vector<int> ans;
// push all the elements of vector arr
for (int i = 0; i < sizea; i++)
{
ans.push_back(arr[i]);
}
... | ALGO | 0.999751 | 3.941548 |
3312ba1c-6eac-4118-ac4f-bbea73998933 | zhongyoub/algoStudy | algo_six.cpp | #include<iostream>
#include<map>
#include<string>
using namespace std;
/*
【字符串类型】给一串数字,输出这些数字能够组成的合法的最大时间,数字不够则用零补全
例:
输入:“274536”
输出:“23:57:46”
*/
map<int, int>mm;
string res = "";
//
int get(int mx) {
int i = mx;
for (; i >= 0; i--) {
if (mm[i] > 0) {
mm[i]--;
return i;
}
}
return - 1;
}
void init... | ALGO | 0.997233 | 4.593255 |
8c2294a1-e4a1-4f8f-932b-03ec013ff710 | githjk/cornell-robocup | Skillz/AdvanceBallUpfieldSkill.cpp | #include "AdvanceBallUpfieldSkill.h"
#include "info/robot/robot.h"
#include "GUI/GUI.h"
#include "RoboCup_modules/RoboCupStrategyModule.h"
#include "common/util/math/angle.h"
#include "common/util/math/dist.h"
#include "common/util/shoot/shoot.h"
#include "JukeAroundOpponentSkill.h"
#include "TurnAndKickSkill.h"
#inclu... | ALGO | 0.935729 | 4.389169 |
705a33ca-a2ce-4213-8ae6-42eb1d2bfaa1 | FarisXiong/CodeAnswer | Leetcode1-100/leetcode18.cpp | //
// Created by Alienware on 2022/2/13.
//
//给你一个由 n 个整数组成的数组nums ,和一个目标值 target 。请你找出并返回满足下述全部条件且不重复的四元组[nums[a], nums[b], nums[c], nums[d]](若两个四元组元素一一对应,则认为两个四元组重复):
//
//0 <= a, b, c, d< n
// a、b、c 和 d 互不相同
//nums[a] + nums[b] + nums[c] + nums[d] == target
// 你可以按 任意顺序 返回答案 。
//
//
//
//示例 1:
//
//输入... | ALGO | 0.999938 | 5.417144 |
5d4434cf-01ae-4673-b4eb-1d2626c0a3c2 | NityaReddy912/Flutter | Meals_app_riverpod_animation/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.998571 | 6.761023 |
7ed23545-9cd3-4f09-880d-9197751e3477 | Ganeshbg/programs | binary.cpp | #include<iostream>
using namespace std;
bool BinarySearch(int arr[],int size,int item)
{
int low=0;
int high=size-1;
int mid;
while(low<=high)
{
mid = (low+high)/2;
if(arr[mid]==item)
{
return true;
}
else if(arr[mid]>item)
{
hi... | ALGO | 0.999583 | 4.013658 |
309df09a-cd6d-426f-9de0-b27d8b89d7d5 | matthias-steinkamp/design_patterns_cpp | Patterns/Visitor/ConceptualExample.cpp | // ===========================================================================
// ConceptualExample.cpp // Visitor Pattern
// ===========================================================================
#include <iostream>
#include <string>
#include <array>
#include <memory>
namespace ConceptualExample {
/**
... | TOOL | 0.852105 | 7.801508 |
bcc5eac0-b4bb-428c-a777-e698d851d725 | alba-ch/data-structures | AVLTree/main.cpp | /* Classe principal */
#include <cstdlib>
#include "AVLTree.h"
#include <iostream>
using namespace std;
int main(int argc, char** argv) {
AVLTree<int,int> tree1;
int testKeys[] = {2, 0, 8, 45, 76, 5, 3, 40};
int testValues[] = {5, 5, 1, 88, 99, 12, 9, 11};
for(int i=0; i<8;i++){
tree1.add(tes... | ALGO | 0.992852 | 4.275735 |
763b0fbe-93e5-4544-8cf2-e36bdb2087b4 | 529106896/FishTouchingXMUer | 大二下/计算机图形学/lab/实验4/lab4/lab4/eigen-3.3.7/unsupported/doc/examples/MatrixLogarithm.cpp | #include <unsupported/Eigen/MatrixFunctions>
#include <iostream>
using namespace Eigen;
int main()
{
using std::sqrt;
MatrixXd A(3,3);
A << 0.5*sqrt(2), -0.5*sqrt(2), 0,
0.5*sqrt(2), 0.5*sqrt(2), 0,
0, 0, 1;
std::cout << "The matrix A is:\n" << A << "\n\n";
std::cout << "... | ALGO | 0.998993 | 3.595733 |
d2650a7e-35a4-45ae-ba13-fc4b75f3822c | Chaitalykundu/Data-Structure-and-Algorithm | 03-Array/Traversing/CPP/Using_only_main.cpp | /* Author : Chaitaly Kundu
Date : 27-03-2021 */
#include <iostream>
using namespace std;
int main() {
// your code goes here
int a[10],n,i;
// No. of Elements
cin >> n ;
// Array Elements
for(i=0;i<n;i++)
{
cin >> a[i] ;
}
// Traversing
for(i=0;i<n;i++)
{
cout << a[i] << " element is in " ... | ALGO | 0.960121 | 3.574889 |
52152776-52dd-4076-8b4c-418c5ed52243 | ohinhyuk/PSS_Group05_2022 | 2022_01_28/A081_오인혁_20220128.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(int args , char** argv){
int N;
cin >> N;
vector<int> v;
int temp;
for(int i = 0 ; i < N ; ++i){
for(int j = 0 ; j < 10 ; ++j){
cin >> temp;
v.push_back(temp);
}
... | ALGO | 0.992355 | 3.350194 |
440a65c1-e703-4f7d-8091-1b91c308b1df | cin-mano/competitive-prog | contest5May.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution
{
public:
bool isValid(string word)
{
if (word.length() < 3)
{
return false;
}
int vCount = 0, cCount = 0;
for (int i = 0; i < word.length(); i++)
{
if (word[i] == 'a' || word[i]... | ALGO | 0.997599 | 5.574881 |
9a0f7560-770c-4078-992f-49de073db1df | prangya20084/Wakeup_Code_Sleep | codechef/DSA Learning Series/Complex analysis + Basics warm up/FLOW007.CPP | #include <iostream>
using namespace std;
int main() {
int T,N;
cin>>T;
for(int i=0;i<T;i++)
{
cin>>N;
bool L=true;//FOR ANY LEADING ZERO IN THE NUMBER AFTER REVERSAL
while(N>0)
{
if(N%10==0 && L)
{
N/=10;
continue;
}
L=false;
cout<<N%10;
N/=10;
}
cout<... | ALGO | 0.999856 | 4.367134 |
3d59c5d0-96cc-427a-8357-552e3a967096 | vitalya212/foocoin | src/hash.cpp | #include "hash.h"
inline uint32_t ROTL32 ( uint32_t x, int8_t r )
{
return (x << r) | (x >> (32 - r));
}
unsigned int MurmurHash3(unsigned int nHashSeed, const std::vector<unsigned char>& vDataToHash)
{
// The following is MurmurHash3 (x86_32), see http://code.google.com/p/smhasher/source/browse/trunk/MurmurH... | ALGO | 0.987379 | 6.215198 |
b0179542-0c23-468c-a6a0-21dd5735c26e | tgparkk/c-DATA-STRUCTURES-AND-ALGORITHM | lesson1_example/lesson1_example/실습문제3.cpp | #include <iostream>
#include <queue>
class Job
{
int id;
std::string user;
int pages;
static int count;
public:
Job(const std::string& u, int p) : user(u), pages(p), id(++count) {}
friend std::ostream& operator<<(std::ostream& os, const Job& j)
{
os << "id: " << j.id << ", : " << j.user << ", : " << j.page... | TOOL | 0.850626 | 4.700384 |
8bfa4419-527f-4a10-a1bf-5f294b496293 | SatejSawant45/Solutions | Dice_Combinations_CSES.cpp | #include<bits/stdc++.h>
using namespace std;
long long int M = 1e9 + 7;
int main()
{
int n;
cin>>n;
vector<int> dp(n+1);
dp[0] = 1;
for(int i=1;i<=n;i++)
{
for(int j=1;j<=6;j++)
{
if(j<=i)
{
dp[i] = (dp[i] + dp[i-j]) % M;
}
}
}
cout<<dp[n]<<e... | ALGO | 0.999987 | 4.488502 |
7915e703-3c0f-4e35-b9fe-b8fee5e026de | ishandutta2007/codeforces | dengyaotriangle/normal/1155/E.cpp | #include<bits/stdc++.h>
using namespace std;
const int maxn=20;
const long long mdn=1000003;
long long x[maxn][maxn];
long long qpow(long long bse,long long ex){
if(ex==0) return 0;
if(ex==1) return bse%mdn;
long long ans=qpow(bse,ex/2);
ans=(ans*ans)%mdn;
if(ex%2) ans=(ans*bse)%mdn;
return ans;
}
long lo... | ALGO | 0.99983 | 3.204397 |
3ee5b482-509c-420c-bbfe-6b20b6abde31 | berkeodaci/HackerRank-Solutions | 30 Days Of Code/Day 04/C++Solution.cpp | using namespace std;
#include <iostream>
class Person{
public:
int age;
Person(int initialAge);
void amIOld();
void yearPasses();
};
Person::Person(int initialAge){
if(initialAge < 0)
{
cout<<"Age is not valid, setting age to 0.\n";
age =... | ALGO | 0.998697 | 5.48158 |
c6f2a86e-a862-4c97-abb5-a4c4de00e1c1 | turzo06/vscode | C_Prepend_and_Append.cpp | /******************CODE*********************/
// Library
#include <bits/stdc++.h>
using namespace std;
// Type Definition
typedef vector<string> vstr;
typedef vector<long long> vll;
// STL Operation
#define pb push_back
#define ll long long
#define acs(v, x) accumulate(v.begin(), v.end(), x);
#define acm(v,x) accumu... | ALGO | 0.999851 | 5.09546 |
eef99d5f-ccec-447a-ab27-b3a577432314 | Ali-Nadhir/pr3 | homework18.cpp | // homework18.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
int r;
float PI;
PI = 3.14;
cout << "enter area : ";
cin >> r;
float area;
area = PI * pow(r, 2);
cout << "result : " << ceil (a... | ALGO | 0.996242 | 3.243663 |
33a8fa99-afc7-4146-9bb5-5858a46c90ef | miguelarauj1o/URI | src/UOJ_1737 - (1876742) Accepted.cpp | #include <cstdio>
#include <cstring>
#include <iostream>
#include <iomanip>
#include <string>
#include <map>
#define sc1(a) scanf("%d", &a)
#define fr(i,a,n) for(int i = (a); i < (n); i++)
using namespace std;
typedef map<string, int> MSI;
typedef multimap<int, string, greater<int> > MMIS;
MSI dic;
MMIS freq;
MSI:... | ALGO | 0.980583 | 3.868056 |
10faf9d5-00c9-4cbf-9cc0-2277c4bdf14a | colesteaks/560Labs | Jurden_Lab9/Timing/main.cpp | //start timer
//build leftist heap
//stop timer
//start timer
//build skew heap
//stop timer
//duration for leftist heap
//duration for skew heap
#include <iostream>
#include <fstream>
#include <string>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <cmath>
#include "Timer.cpp"
#include "Leftist.h"... | ALGO | 0.985233 | 3.549277 |
c9366106-65ad-44d9-b833-42c2c210329f | ArpitaAgrahari/DSA_Practice | 12_SelectionSorting.cpp | #include<iostream>
using namespace std;
void selectionSorting(int arr,6){
for(int i = 0;i<size-1;i++){
int minIndex = 1;
for(int j = i+1;j<size;i++){
if(arr[j]<arr[minIndex]){
minIndex = j;
}
}
swap(arr[minIndex],arr[i]);
}
}
int main(){
... | ALGO | 0.999875 | 3.748597 |
54e3f8e8-1bd4-4a5e-b8b0-dc2a182cc1eb | pateljainilanilbhai/cpp_programs | infixtopostfix (2).cpp | #include<iostream>
#include<stdio.h>
#include<stack>
using namespace std;
int prec(char c)
{
if(c == '^')
return 3;
else if(c == '*' || c == '/')
return 2;
else if(c == '+' || c == '-')
return 1;
else
return -1;
}
void infixToPostfix(string s)
{
stack<char> st;
st.push('#');
... | ALGO | 0.999972 | 4.382221 |
d74a826e-bb2d-4ed8-930d-f3c5655f7674 | firdauslubis88/NISwGSP | NISwGSP/eigen3/unsupported/doc/examples/MatrixSine.cpp | #include <unsupported/Eigen/MatrixFunctions>
#include <iostream>
using namespace Eigen;
int main()
{
MatrixXd A = MatrixXd::Random(3,3);
std::cout << "A = \n" << A << "\n\n";
MatrixXd sinA = A.sin();
std::cout << "sin(A) = \n" << sinA << "\n\n";
MatrixXd cosA = A.cos();
std::cout << "cos(A) = \n" << cos... | ALGO | 0.970211 | 5.878768 |
33b3d60b-f95b-4318-997b-376f40b3ad0f | sxqnicholas96/kattis | solutions/ceiling.cpp | #include <bits/stdc++.h>
using namespace std;
int main(void){
ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
int n,k,val,i,root,found,index = 1 ,vtx;
unordered_map<int,pair<int,int>> list;
set<set<int>> ans;
set<int> track;
cin >> n >> k;
while(n--){
list.clear();
for(i=0;i<k;i++){
ci... | ALGO | 0.999646 | 3.779408 |
5c24908d-3c10-4609-976b-cd09a25651ee | PranshVaishnav/DSA-Implementation-Question | Arrays/Array_operation/HeapSort.cpp | // Heap Sort in C++
#include <iostream>
using namespace std;
void heapify(int arr[], int n, int i) {
// Find largest among root, left child and right child
int largest = i;
int left = 2 * i + 1;
int right = 2 * i + 2;
if (left < n && arr[left] > arr[largest])
largest = left;
... | ALGO | 0.999973 | 5.707454 |
f211b293-edb9-4c04-b033-17dba587e15c | wang-nima/Sudoku | cocos2d/tools/simulator/libsimulator/lib/runtime/ConsoleCommand.cpp | #include "Runtime.h"
#include "ConfigParser.h"
#include "ConsoleCommand.h"
#include "json/document.h"
#include "json/filestream.h"
#include "json/stringbuffer.h"
#include "CCLuaEngine.h"
#include "RuntimeProtocol.h"
#include "cocos2d.h"
using namespace cocos2d;
static void resetLuaModule(const string& fileName)
{
... | TOOL | 0.919973 | 4.143251 |
583b5fe3-b66d-444d-80e2-63f4b55f6f0e | tempure/algorithm-advance | OJ/atcoder/abc180/d.cpp | #include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define um unordered_map
#define pq priority_queue
#define sz(x) ((int)(x).size())
#define fi first
#define se second
#define endl '\n'
typedef vector<int> vi;
typedef long long ll;
typedef unsigned long long ull;
t... | ALGO | 0.999359 | 3.865761 |
6b9b73a7-d62f-41a5-8835-2882a68c1a68 | svetlanasieber/SoftUni-Upskill-Courses | Module C++/CPP FUNDAMENTALS - March 2024/Arrays/Array Rotation.cpp | #include <iostream>
using namespace std;
void readArray(int arr[], const int& n) {
for (int i = 0; i < n; i++) cin >> arr[i];
}
void printArray(int arr[], const int& n) {
for (int i = 0; i < n; i++) cout << arr[i] << ' ';
cout << endl;
}
// Solution #1, Complexity: O(n^2), Simple
void shiftArray(int arr[... | ALGO | 0.999564 | 5.953918 |
d24cb8da-b3b3-4e23-b614-810ab79bafb6 | ydc123/uoj | Problem14/main.cpp | #include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#define maxn 500010
using namespace std;
typedef long long LL;
int father[maxn],edge[maxn][2],depth[maxn];
LL ans[maxn];
int Find(int p)
{
if(father[p]!=p)
return Find(father[p]);
return p;
}
void read()
{
i... | ALGO | 0.999481 | 3.822617 |
61bf290f-02dd-465e-9be7-49180df4ef18 | 10godFather18/sirius2020Jun | Algorithm/main.cpp | #include <iostream>
#include <fstream>
#include <strstream>
#include <vector>
using namespace std;
struct substits{string el[2];bool isFinal;};
struct workSch{string word; bool stop;};
string sub(int start, int fin, string str){
string subStr;
for(int i = start; i < fin; i++){
subStr += str[i];
}... | ALGO | 0.999555 | 3.819862 |
470d6d84-e150-4326-988c-c06ef343523e | ishandutta2007/codeforces | fastmath/normal/1746/D.cpp | #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
... | ALGO | 0.999883 | 3.732398 |
3ec175ad-62e1-4dde-b14c-4fe7a6c30bc1 | maxpsurcov/LinkedList | calendar.cpp | #include <iostream>
#include <string>
using namespace std;
// Структура для представлення дати
struct Date {
int day;
int month;
int year;
};
// Структура для представлення події в календарі
struct Event {
string name;
Date date;
};
// Вузол списку
struct Node {
Event event;
Node* next;
}... | TOOL | 0.953075 | 5.994682 |
8c040ef2-49cc-435c-9705-f5aca4f72bee | Tass0sm/DataStructures | Calculator/postFixInterpreter.cpp | k#include <stdio.h>
#include <iostream>
#include <string>
#include "calcStack.h"
using namespace std;
int main(int argc, char *argv[]) {
stack myStack;
myStack.create();
std::string expression;
while (myStack.getLength() < 7) {
getline(cin, expression);
if (expression == "exit") {
break;
}
... | ALGO | 0.944756 | 4.07105 |
476168c9-ea17-479a-b56f-7373edae9f6c | Itaya-winter/atcoder | abc-a/132.cpp | #define ll long long
#define INF 99999999
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#include<bits/stdc++.h>
using namespace std;
int main(){
string s;
cin >> s;
sort(s.begin(),s.end());
if(s[0]==s[1]&&s[2]==s[3]&&s[1]!=s[2])cout <<"Yes";
else cout << "No";
return 0;
} | ALGO | 0.999982 | 3.133116 |
79f43558-02bb-4ac1-a426-7a73126c72aa | cyberbuddy-io/open-source-contribution-for-beginners | MLSA Event-101/C++/theory/16_arrays.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
int array[n];
for (int i = 0; i < n; i++)
{
cin>>array[i];
}
for (int i = 0; i < n; i++)
{
cout<<array[i]<<" ";
}
// int max,min;
// for (int i = 0; i < n; i++)
// {
// if ... | ALGO | 0.998656 | 3.536354 |
1ef1f29e-0a6e-4207-baa8-d8254f0483c2 | gergoszucs/group-project | Eigen/doc/examples/Tutorial_ArrayClass_addition.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace Eigen;
using namespace std;
int main()
{
ArrayXXf a(3,3);
ArrayXXf b(3,3);
a << 1,2,3,
4,5,6,
7,8,9;
b << 1,2,3,
1,2,3,
1,2,3;
// Adding two arrays
cout << "a + b = " << endl << a + b << endl << endl;
// Subt... | ALGO | 0.966166 | 3.642258 |
9f0e8f26-5ee2-4121-b501-b1d779106022 | Mohit21251139/stiver_sde_sheet | 2882-ways-to-express-an-integer-as-sum-of-powers/2882-ways-to-express-an-integer-as-sum-of-powers.cpp | class Solution {
int a = 1e9+7;
int arr[301][301];
private:
int solve(int n, int num,int x ){
if (n == 0 )return 1;
if (n < 0 )return 0;
int power = pow(num,x);
if (power > n)return 0;
if (arr[n][num] != -1)return arr[n][num];
int take = solve(n - power,... | ALGO | 0.999991 | 5.423107 |
cd2f2c0b-002f-40d1-bb11-68be0eeaea1e | FangYang970206/Leetcode | Difficulty/Medium/[137] Single Number II/solution.cpp | class Solution {
public:
int singleNumber(vector<int>& nums) {
int x1 = 0, x2 = 0, mask = 0;
for (auto num : nums) {
x2 ^= x1 & num;
x1 ^= num;
mask = ~(x1 & x2);
x2 &= mask;
x1 &= mask;
}
return x1;
}
}; | ALGO | 0.999982 | 5.656411 |
0a12961b-b6e7-42df-bf24-26c53a68a1b0 | hryshn/reram | puma-simulator/benchmarks/panther_benchmarks/convBPanther.cpp | // Simulate a matrix size of Layer9 (same repeats from 9-13) of Vgg16 -
#include "puma.h"
int main(int argc, char** argv) {
Model model = Model::create("convBPanther");
// Process parameters
unsigned int in_size = 2304;
unsigned int out_size = 256;
unsigned int batch_size = 1;
// Layer matr... | DATA | 0.920656 | 3.644521 |
be227f03-7d1b-4d32-9a1c-5d5da81417ca | fsjhhh/acm_title | cpp/模板/裁剪序列_单调队列优化DP.cpp |
// 暴力 o(n ^ 3)
/*
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <deque>
#define IOS ios::sync_with_stdio(false); \
cin.tie(0); ... | ALGO | 0.999962 | 3.488182 |
935e9a27-b6d7-4f7d-9161-1946084d161b | anjali25singhhh/Leetcode | 1160-letter-tile-possibilities/1160-letter-tile-possibilities.cpp | class Solution {
public:
int numTilePossibilities(string tiles) {
vector<int> count(26);
for (const char t : tiles)
++count[t - 'A'];
return dfs(count);
}
private:
int dfs(vector<int>& count) {
int possibleSequences = 0;
for (int& c : count) {
if (c == 0)
continue;
... | ALGO | 0.999846 | 7.55042 |
61d1484e-9090-4a74-937c-63ca506b67a9 | EthanKim8683/High-School-Competitive-Programming | Codeforces/Problemset/Binary Search/1530c.cpp | #include<bits/stdc++.h>
using namespace std;
using I=int;
using Lli=long long int;
using B=bool;
const I N=1e5;
I a_arr[N];
I b_arr[N];
Lli ps1[N+1];
Lli ps2[N+1];
I n;
B chk(I k){
I x=k-k/4,y=min(k-n,x);
return 100*y+ps1[x-y]>=ps2[min(x,n)];
}
I fnd(){
I l=n,r=2*n;
while(l<r){
I m=l+(r-l)/2;
if(c... | ALGO | 0.999684 | 4.038446 |
e0a512a7-69db-444d-887d-502bba4d4cd4 | Xilinx/SDAccel_Examples | getting_started/cpu_to_fpga/01_kernel_c/src/host.cpp | /*****
* Changes from Lab 0:
Added new file mmult.cpp with function implementation in HLS form. The function has
HLS specific pragmas and global arguments.
In host.cpp, added a new function called mmult_fpga(). Inside this function, added
code to setup OpenCL context and command queue, import the xclbin binary ... | ALGO | 0.990299 | 6.219395 |
323a6aa9-218e-4668-b196-ac446740c498 | ZihanYuanCN/C | 160917-1/160917-1/main.cpp | #include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <queue>
#include <vector>
#include <utility>
#include <map>
using namespace std;
int main(int argc, const char * argv[]) {
long long int n,now;
cin >> n;
... | ALGO | 0.998806 | 3.575818 |
ce7922f5-7842-4bdb-b576-ea4d5e4dac82 | Saif64/Interview-prep | questions/dynamic_programming/Tabular/max-subarray.cpp | /*
Given an integer array nums, find the subarray with the largest sum, and return its sum.
Example 1:
Input: nums = [-2,1,-3,4,-1,2,1,-5,4]
Output: 6
Explanation: The subarray [4,-1,2,1] has the largest sum 6.
*/
// Leetcode 53
class Solution {
public:
int maxSubArray(vector<int>& nums) {
int max_sum = ... | ALGO | 0.999984 | 6.779334 |
a025e6a4-816e-43a4-a8e8-ba9c381e76a1 | annnkumar/cpp-programs | sorting/iversionCount.cpp |
#include <iostream>
#include <vector>
using namespace std;
void merge(const vector<int> &a, const vector<int> &b, vector<int> &res) {
int i = 0, j = 0, k = 0;
while (i < a.size() && j < b.size()) {
if (a[i] < b[j]) {
res[k++] = a[i++];
} else {
res[k++] = b[j++];
... | ALGO | 0.999991 | 5.127686 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.