uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
56ffbd80-33a5-4503-a4e5-25193bb2811e | cakctus/season13-source-files | Util/cryptopp/gf2_32.cpp | // gf2_32.cpp - written and placed in the public domain by Wei Dai
#include "pch.h"
#include "misc.h"
#include "gf2_32.h"
NAMESPACE_BEGIN(CryptoPP)
GF2_32::Element GF2_32::Multiply(Element a, Element b) const
{
word32 table[4];
table[0] = 0;
table[1] = m_modulus;
if (a & 0x80000000)
{
table[2] = m_modulus ^ (... | ALGO | 0.999725 | 5.535272 |
398444a2-8b87-4f63-af5a-974628f5b8f6 | MDOBAIDULLAHalmahdy/XPSC | Week 7/Day 1/W_4_I_Xorry_1.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
// your code goes here
int t;
cin>>t;
while(t--){
long long int x,first,two_multiple=1;
cin>>x;
while(two_multiple<x){
two_multiple*=2;
}
if(two_multiple==x){
cout<<0<<" "<<x<<endl;
... | ALGO | 0.99989 | 3.879877 |
b0676d36-b313-46c7-9892-2b4decbab6ca | pgupta11/HessianforML | cpp/thirdparty/eigen/test/visitor.cpp | #include "main.h"
template<typename MatrixType> void matrixVisitor(const MatrixType& p)
{
typedef typename MatrixType::Scalar Scalar;
Index rows = p.rows();
Index cols = p.cols();
// construct a random matrix where all coefficients are different
MatrixType m;
m = MatrixType::Random(rows, cols);
for(Ind... | TEST | 0.881766 | 6.363361 |
33b50fa6-140e-442d-a935-1b7f4ab44bdd | EdimarJunior/CompositionalTioco | symbolrt/CVC4/src/theory/quantifiers/bv_inverter_utils.cpp | /********************* */
#include "theory/quantifiers/bv_inverter_utils.h"
#include "theory/bv/theory_bv_utils.h"
using namespace CVC4::kind;
namespace CVC4 {
namespace theory {
namespace quantifiers {
namespace utils {
Node getICBvUltUgt(bool pol, Kind k, Nod... | ALGO | 0.997627 | 6.603398 |
8a653911-8eab-49c2-983d-767cc5a72bc5 | nnnlog/codeforces | 2021.02.17_Round_702/R702_G_U.cpp | #include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<ld> vld;
typedef ... | ALGO | 0.999915 | 3.511797 |
dfd64acc-eca9-48fc-8cc7-b0ec1a78f652 | haoyuwu97/GNM | neigh.cpp | #include "nr3.h"
#include "ran.h"
#include "GNM.h"
#include <stdlib.h>
#include <string>
#include <cstring>
#include <fstream>
#include <math.h>
#include <iostream>
#include <iomanip>
#include <cmath>
#include <sstream>
using namespace std;
//Find which cell the particle in (the cell is start from 0)
int search_cel... | ALGO | 0.999783 | 3.115485 |
5721a99e-a4f3-42df-a54e-5a054e1f7c2d | sezalmittal987/black-ravens-notes | 26jan/inputvector.cpp | #include<iostream>
#include<vector>
using namespace std;
int main(){
vector<int> v;
int n;
cin>>n;
for( int i = 0 ;i < n ; i++ ){
int x;
cin>>x;
v.push_back(x);
}
for( int i = 0 ;i < n ; i++ ){
cout<<v[i]<<" ";
}
cout<<endl;
} | ALGO | 0.999714 | 3.853956 |
8e47978a-9962-49e6-b09d-e221bd2db673 | Munbin-Lee/Programmers | 프로그래머스/lv0/120834. 외계행성의 나이/외계행성의 나이.cpp | #include <string>
#include <vector>
using namespace std;
string solution(int age) {
string answer = to_string(age);
for (char &ch : answer) {
ch += 'a' - '0';
}
return answer;
} | ALGO | 0.972061 | 4.863271 |
ee72a86a-bcae-4a7c-9dcb-75ba1a78dd61 | fengabriel/opencv_contrib | modules/sfm/src/conditioning.cpp | #include "precomp.hpp"
// Eigen
#include <Eigen/Core>
// OpenCV
#include <opencv2/core/eigen.hpp>
#include <opencv2/sfm/conditioning.hpp>
// libmv headers
#include "libmv/multiview/conditioning.h"
namespace cv
{
namespace sfm
{
template<typename T>
void
preconditionerFromPoints( const Mat_<T> &_points,
... | ALGO | 0.959369 | 5.571324 |
5cf7f7df-aac2-4533-98a2-d2340a389e6a | rohanlambe22/PPA41 | Program186.cpp | #include<iostream>
using namespace std;
int main()
{
int iNo1 = 0, iNo2 = 0, iAns = 0;
cout<<"Enter first number : \n"; // printf("Enter first number : \n");
cin>>iNo1; // scanf("%d",&iNo1);
cout<<"Enter second number : \n"; // printf("Enter second number : ... | TOOL | 0.970456 | 3.412207 |
2356b264-d563-4609-b774-8ab6e2632359 | vrmaroli/problemsolving | SAMER08F/solution.cpp | // SAMER08F
#include <iostream>
#include <stdio.h>
using namespace std;
int main() {
int i,sum;
while(1) {
scanf("%d",&i);
if(i==0)
return 0;
sum=0;
while( i>0 ) {
sum+=i*i;
i--;
}
printf("%d\n",sum);
}
}
| ALGO | 0.999832 | 3.661723 |
2bdff450-a6dc-450b-82cb-b86d03664fb3 | keatoncscheible/cpp_101 | src/11__stl_algorithms/std_exclusive_scan.cpp | // File: std_exclusive_scan.cpp
// Description: This C++ program demonstrates the usage of the std::exclusive_scan algorithm from the C++ Standard Library.
// The std::exclusive_scan algorithm computes the exclusive prefix sum of a range of elements in a vector.
#include <iostream>
#include <numeric>
#inc... | ALGO | 0.999411 | 6.487981 |
e08eb6e1-b133-4fcc-9841-49dfa434b66e | gim-largerepo/including-investment-59GB | packages/before.cpp | Seem hand campaign could difference Congress learn.
Option face certainly discussion.
Simple like new enter. | ALGO | 0.912033 | 7.524023 |
da97f9a8-d34b-45c5-9eb2-1aceb4fb8cf6 | Bibs24/Leetcode-GFG-Progress | Broken blocks - GFG/broken-blocks.cpp | // { Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
int dfs(vector<vector<int>>& matrix, int i, int j, int n, int m, vector<vector<int>> &dp){
if(j<0 || j>=m || i==n || matrix[i][j] == -1) return 0;
if(dp[i][j] != -1) return dp[i][j];
int lef... | ALGO | 0.999913 | 6.536431 |
243bc146-776a-4b10-a7f5-cbf736308975 | abhi00999/LeetCode-Questions | Preorder Traversal and BST - GFG/preorder-traversal-and-bst.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:
int canRepresentBST(int pre[], int n) {
// code here
stack<int> s;
// Initialize current root as minimum ... | ALGO | 0.999753 | 6.294999 |
92a5b140-17fd-4708-8476-e78a4956f391 | Shaktiswarup07/GfG | Next Greater Element - GFG/next-greater-element.cpp | //{ Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
// User Function Template for C++ solution
class Solution {
public:
vector<long long> nextLargerElement(vector<long long> &arr, int n){
// Your code here
vector<long long>v;
stack<long long> st;
... | ALGO | 0.999651 | 6.210517 |
50272a9b-6487-40f1-a967-998bce84b279 | Flight-myPPL/Flight | src/wallet/crypter.cpp | #include <wallet/crypter.h>
#include <crypto/aes.h>
#include <crypto/sha512.h>
#include <script/script.h>
#include <script/standard.h>
#include <util/system.h>
#include <string>
#include <vector>
int CCrypter::BytesToKeySHA512AES(const std::vector<unsigned char>& chSalt, const SecureString& strKeyData, int count, un... | TOOL | 0.897646 | 7.603846 |
faaa85cf-f928-44cd-8bb6-35ed746b5ce0 | Dev-Bhardwaj123/LC-Questions | 122-best-time-to-buy-and-sell-stock-ii/best-time-to-buy-and-sell-stock-ii.cpp | class Solution {
public:
int solve(int i,int buy,vector<int>& prices,vector<vector<int>>& dp){
//base case
if(i==prices.size()){
return 0;
}
if(dp[i][buy]!=-1){
return dp[i][buy];
}
int prof=0;
//if bought then only one can sell
... | ALGO | 0.999982 | 6.07455 |
7c9d24d9-c29c-48e1-9f6a-9af391cfde5b | RakanSalama/Multimedia_CPIT380 | opencv/sources/3rdparty/carotene/src/morph.cpp | #include "common.hpp"
#include <algorithm>
#include <limits>
#include <vector>
#include <cstring>
namespace CAROTENE_NS {
bool isMorph3x3Supported(const Size2D &size, BORDER_MODE border)
{
return isSupportedConfiguration() && size.width >= 16 &&
(border == BORDER_MODE_CONSTANT ||
border == BO... | ALGO | 0.996098 | 6.977763 |
252e9fff-da78-4df4-993c-77281d8ea76e | hws522/Codeup-Basic100 | C++/codeup_1096_바둑판에 흰 돌 놓기.cpp | #include<iostream>
using namespace std;
int main()
{
int n;
int x, y;
int arr[19][19] = {};
cin >> n;
for(int i = 0; i < n; i++)
{
cin >> x >> y;
arr[x - 1][y - 1] = 1;
}
for(int i = 0; i < 19; i++)
{
for(int j = 0; j < 19; j++)
{
... | ALGO | 0.999472 | 3.194893 |
0f5b56c6-028a-40b2-989c-865d16e30d40 | duzetao7/learnc-experiment | 实验三利润.cpp | #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main()
{
int i;
double p[4];
printf("******enterprise interest count******\nPA=");
scanf("%lf", &p[0]);
printf("PB=");
scanf("%lf", &p[1]);
printf("PC=");
scanf("%lf", &p[2]);
printf("PD=");
scanf("%lf", &p[3]);
for (i = ... | ALGO | 0.980688 | 3.110867 |
9a81ea6f-bd26-4a59-86ed-e0480c1ebfb7 | sam5854/lc_submitter | C++/maximize-the-number-of-target-nodes-after-connecting-trees-i.cpp | // Time: O(nlogn + mlogm)
// Space: O(n + m)
// dfs, centroid decomposition, prefix sum
class Solution {
public:
vector<int> maxTargetNodes(vector<vector<int>>& edges1, vector<vector<int>>& edges2, int k) {
const auto& centroid_decomposition = [](const auto& adj, int k) {
vector<int> result(si... | ALGO | 0.999964 | 5.562017 |
d87c5c3f-ace3-4551-b306-b6070f0e060d | sharmagourav28/GFG-DSA | Array/Array1.cpp | #include <stdio.h>
// insert at end
int insertSorted(int arr[], int n, int key, int capacity)
{
if (n >= capacity)
return n;
arr[n] = key;
return (n + 1);
}
int main()
{
int arr[20] = {12, 16, 20, 40, 50, 70};
int capacity = sizeof(arr) / sizeof(arr[0]);
int n = 6;
int i, key = ... | ALGO | 0.999915 | 4.158208 |
26049352-699a-4851-b8ed-2596febc5246 | thezealousfool/Misc-Work | C++/CodeChef/APRIL16-CHEFPATH/CHEFPATH.cpp | /*input
2
1000000000000000000 5
4 1
*/
#include <iostream>
typedef unsigned long long int uInt;
typedef long long int Int;
int main() {
Int T;
uInt N, M;
std::cin >> T;
while (T--) {
std::cin >> N >> M;
if (N==1 && M==1) {
std::cout << "No" << std::endl;
continu... | ALGO | 0.999973 | 4.647864 |
0319ac6d-921a-4782-802d-4d1e448797a3 | JackyLu0520/cpp | ssy/CF915E.cpp | #include<bits/stdc++.h>
using namespace std;
inline int read(){
int sgn=1,n=0;
char c;
do{c=getchar();if(c=='-')sgn=-1;}while(!isdigit(c));
while(isdigit(c)){
n=(n<<1)+(n<<3)+c-'0';
c=getchar();
}
return sgn*n;
}
void write(int n,bool f=1){
if(n<0){putchar('-');n=-n;}
if(... | ALGO | 0.999216 | 3.970342 |
c22080d9-39b2-460e-a503-2adf237c4504 | R-enanVieira/Competitive-Programming | atcoder/abc_333/a.cpp | #include <bits/stdc++.h>
using namespace std;
const int oo = 1e9;
using ll = long long;
using ii = pair<int, int>;
using edge = tuple<int, int, int>;
typedef vector<int> vi;
#define pb push_back
#define ln "\n"
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
string n, ans;
cin >> n;
int x = n[0] - '0';
... | ALGO | 0.999448 | 3.613307 |
4fa425fd-029f-48a6-8c1b-500d3f68a957 | oxygen-hunter/Flashboom | data/big-vul-100/add_attention_code/Gemma/top0-100/two-sum-iii-data-structure-design-TwoSum.find/177811_DoS.cpp | aspath_put (struct stream *s, struct aspath *as, int use32bit )
{
struct assegment *seg = as->segments;
size_t bytes = 0;
if (!seg || seg->length == 0)
return 0;
if (seg)
{
/*
* Hey, what do we do when we have > STREAM_WRITABLE(s) here?
* At the moment, we would write out a par... | TOOL | 0.984042 | 6.18558 |
b6bee53b-5d7a-473f-9ace-cf0e32a83ee7 | MateyApostolov/HomeWork | Autumn National/cups.cpp | #include <bits/stdc++.h>
using namespace std;
int main () {
pair <int, int> cp[3];
for(int i = 0; i < 3; i++) {
cin >> cp[i].first >> cp[i].second;
}
sort(cp, cp + 3);
if(cp[2].first - 2 * cp[2].second >= cp[1].first && cp[1].first - 2 * cp[1].second >= cp[0].first) cout << cp[2].first;
... | ALGO | 0.999638 | 3.568057 |
2ce31fa1-cc36-410d-b4bf-eaeda9ddcb95 | jhpp114/css342Upload | Lab3/driver.cpp | #include <iostream>
#include <vector>
#include <sys/time.h>
#include <stdlib.h>
#include <fstream>
#include "bubblesort.cpp"
#include "insertionsort.cpp"
#include "selectionsort.cpp"
// array initialization with random numbers
void initArray( vector<int> &array, int randMax ) {
int size = array.size( );
for ( int... | ALGO | 0.987416 | 4.789332 |
2d8d85dc-6107-4e8f-ba6c-73700be0df73 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_5586_212.cpp | #include <bits/stdc++.h>
using namespace std;
int main() { cout << "Odd"; }
| ALGO | 0.998185 | 3.299085 |
d26ee442-46bc-4d26-8896-080fd5a50c71 | tomoakiii/atcoder2 | Archive/abc350/d.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 0x0F0F0F0F0F0F0F0F;
const int INFi = 0x0F0F0F0F;
class UnionFind
{
public:
UnionFind() = default;
/// @brief Union-Find 木を構築します。
/// @param n 要素数
explicit UnionFind(size_t n)
: m_parents(n)
, m_sizes(n, 1)
{
std::iota(m_par... | ALGO | 0.999978 | 5.095713 |
8605ca97-d45c-4d7d-9e3a-f8a3d3f0e155 | rlaa54/CodingTest | 프로그래머스/unrated/181932. 코드 처리하기/코드 처리하기.cpp | #include <string>
#include <vector>
#include <iostream>
using namespace std;
string solution(string code) {
string answer = "";
bool mode = false;
for (int i = 0; i < code.length(); i++) {
if (code[i] == '1') {
mode ? mode=false : mode=true;
}
else {
if (mode... | ALGO | 0.999916 | 4.788296 |
94d14749-61b0-44aa-ad7a-55ce9a5e4d66 | DhavalMavani/DSA_Leetcode | 0450-delete-node-in-a-bst/0450-delete-node-in-a-bst.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.999996 | 6.118018 |
707fcbd1-ca19-4078-8a18-d96bbd3b5a0a | ackoujens/learning-c-plus-plus | 56-polymorphic-bad-guy/PolymorphicBadGuy.cpp | /**
* PolymorphicBadGuy.cpp
* Contributors:
* * Jens Ackou
* Description:
* calling member functions dynamically
*/
#include <iostream>
using namespace std;
class Enemy {
public:
Enemy(int damage = 10);
virtual ~Enemy();
void virtual Attack() const; // made virtual to be overridden
protected:
int* ... | TOOL | 0.858413 | 5.989786 |
bff52e02-0c6d-40ab-bd1d-c7c2ffd415ce | SakshamSahgal/Competitive-Programming | Codeforces + Codechef/B. Limit.cpp | #include<iostream>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<cmath>
#include<climits>
#define usi unsigned short int
#define ui unsigned int
#define ulli unsigned long long int
#define lli long long int
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);... | ALGO | 0.999962 | 3.01294 |
27b543a4-bb7b-4388-8edb-269c76ffa49a | dglazier/elSpectro | core/DecayModelW.cpp | #include "DecayModelW.h"
#include "DecayingParticle.h"
#include "FunctionsForElectronScattering.h"
#include "DistConst.h"
#include <TDatabasePDG.h>
#include "TFile.h"
namespace elSpectro{
//////////////////////////////////////////////////////
////Constructor for e- scattering kinematics only
DecayModelW::DecayMo... | TOOL | 0.986312 | 5.916006 |
9f14fe90-d556-4264-abf0-6a1fa30e2127 | GiovanniBussi/plumed-mingw | src/generic/WholeMolecules.cpp | #include "core/ActionAtomistic.h"
#include "core/ActionPilot.h"
#include "core/ActionRegister.h"
#include "tools/Vector.h"
#include "tools/AtomNumber.h"
#include "tools/Tools.h"
#include "core/Atoms.h"
#include "core/PlumedMain.h"
#include "core/ActionSet.h"
#include "core/GenericMolInfo.h"
#include "tools/OpenMP.h"
#i... | TOOL | 0.93579 | 6.121099 |
ec417a6f-f418-49ca-9b67-b5ae55224c97 | sultancodess/leetcode- | C++/nested-list-weight-sum.cpp | // Time: O(n)
// Space: O(h)
/**
* // This is the interface that allows for creating nested lists.
* // You should not implement it, or speculate about its implementation
* class NestedInteger {
* public:
* // Return true if this NestedInteger holds a single integer, rather than a nested list.
* bool ... | ALGO | 0.999568 | 6.36934 |
a40a188a-ef60-4628-b19e-9505e37a8563 | KISHLAY568/Cpp | LOVE_BABBAR_1/nextSmallerElementStack.cpp | #include <iostream>
#include <vector>
#include <stack>
using namespace std;
vector<int> nextSmaller(vector<int> &v)
{
stack<int> s;
s.push(-1);
vector<int> ans(v.size());
for (int i = v.size() - 1; i >= 0; i--)
{
int curr = v[i];
while (s.top() >= curr)
{
s.pop... | ALGO | 0.999993 | 4.861236 |
310b5d4d-13bd-4cf3-9bdf-076ef832e88d | Zhaisan/ads | basicsOF_c++(not algo course)/extrainf/informatics/extra2_AP.cpp | #include <iostream>
using namespace std;
int main(){
long n;
long cnt=0;
cin >> n;
for(int i=1;i<=n;i++){
if(n%i==0)
cnt++;
}
cout << cnt ;
return 0;
} | ALGO | 0.999868 | 4.39471 |
b0060a77-c2ac-4fa7-8cf9-9d31654e947f | VatsalS31/DSA | Graphs/LC-210-Course-Schedule-II.cpp | //^ https://leetcode.com/problems/course-schedule-ii/description/
//* INTUITION
//* Go back and watch course schedule 1 and topo sort using Kahn's
class Solution
{
public:
vector<int> findOrder(int numCourses, vector<vector<int>> &prerequisites)
{
vector<vector<int>> adj(numCourses);
for (au... | ALGO | 0.999989 | 6.483755 |
154fffbc-9fce-47f6-8c68-a095636e0b64 | hajimeIppo-cmd/cp-codes | Baekjoon OJ/18000-18999/18796_naive.cpp | #define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#include <cassert>
using namespace std;
#define ll long long
#define ld long double
#define pii pair<int, int>
#define pll pair<ll, ll>
#define fr first
#define sc second
#define vt vector
#define all(c) (c).begin(), (c).end()
#define sz(x) (int)(x).size()
#define EXP... | ALGO | 0.99984 | 3.26461 |
8d7b5412-40aa-49ea-90cf-5b95d0c8ffa5 | wuhao5/boost | libs/numeric/odeint/performance/rt_generic_rk4_phase_lattice.cpp | #include <boost/array.hpp>
#include "rt_explicit_rk.hpp"
#include "rk_performance_test_case.hpp"
#include "phase_lattice.hpp"
const size_t N = 1024;
typedef boost::array< double , N > state_type;
typedef rt_explicit_rk< state_type > rk_stepper_type;
const size_t stage_count = 4;
class rt_generic_wrapper
{
publi... | ALGO | 0.981733 | 3.872622 |
6a6ac5d0-b732-4ae6-bc82-3dedbafe1f58 | ivarty/mipt_algo | graph_algo/Kruskal/kruskal.cpp | #include <cstdint>
#include <iostream>
#include <algorithm>
#include <ratio>
#include <utility>
#include <vector>
class Edge {
public:
Edge(int a, int b, int w) : weight(w), u(a), v(b) {
}
public:
int weight;
int u;
int v;
};
class DSU {
public:
explicit DSU(int vertex) {
parent_.resize(vertex + 1... | ALGO | 0.999972 | 5.277977 |
e1397902-8732-4012-b1ba-bea9909ecb68 | ishandutta2007/codeforces | denisson/normal/1608/C.cpp | #include <bits/stdc++.h>
#define ll long long
#define db long double
#define ull unsigned long long
#define x first
#define y second
#define mp make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
using namespace std;
#define pper(a) cerr << #a << " = " << a << endl;
void per() { cerr << endl; }
template... | ALGO | 0.999979 | 3.730417 |
67bd64c8-6244-4fc7-8477-f1b6515066ec | kth1888/Algorithm | Notepad/Bad_Approaches/1764bad.cpp | #include <iostream>
#include <algorithm>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int N, M;
cin >> N >> M;
string *dud = new string[N];
string *bo = new string[M];
string *result = new string[((N > M) ? N : M)];
for (int i = 0; i < N; i++)
... | ALGO | 0.999955 | 3.899769 |
07654886-0da3-4b37-bdc1-745906dfac14 | ishandutta2007/codeforces | sert/normal/1194/A.cpp | #pragma GCC diagnostic ignored "-Wunused-result"
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
void solve() {
int a, b;
cin >> a >> b;
cout << b * 2 << "\n";
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t; cin >> t;... | ALGO | 0.999422 | 4.678796 |
2e5d2270-f688-456c-8ad7-532bff8ca1b6 | Karan-Veer-Singh/Leetcode | Arrays/766. Toeplitz Matrix.cpp | class Solution {
public:
bool isToeplitzMatrix(vector<vector<int>>& matrix) {
for (int i = 1; i < matrix.size(); i++)
for (int j = 1; j < matrix[0].size(); j++)
if (matrix[i][j] != matrix[i - 1][j - 1])
return false;
return true;
}
};
// https://... | ALGO | 0.99994 | 6.61193 |
7d2be36d-01a1-45bd-8052-4acb4df85d5d | KevinChackoP/Testing123 | Binary_Search_Tree/node.cpp | /*
This program serves as the cpp program for the Binary Search Tree Program's
node class. It has all the functions that will be used to make and interact
with the binary search tree.
Author: Kevin Chacko
Last Updated: 3/20/2024
Period 5, C++ / Data Structures
*/
/*
For this whole file I copy pasted my ... | ALGO | 0.998064 | 5.098632 |
98220cb5-37fc-4b3e-84d4-b2b968e96a94 | chrisdembia/coin | Bonmin/Cbc/examples/sample2.cpp | #include <cassert>
#include <iomanip>
#include "CoinPragma.hpp"
// For Branch and bound
#include "OsiSolverInterface.hpp"
#include "CbcModel.hpp"
#include "CbcBranchUser.hpp"
#include "CbcCompareUser.hpp"
#include "CbcCutGenerator.hpp"
#include "CbcStrategy.hpp"
#include "CbcHeuristicLocal.hpp"
#include "OsiClpSolver... | ALGO | 0.998768 | 5.805416 |
54425288-7f94-46d2-aa22-e5bda80dfe61 | valderyaya/Competitive-Programming | TIOJ/1838.cpp | //#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,fast-math")
#include<bits/stdc++.h>
//#include<bits/extc++.h>
//using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
#define F first
#define S second
#define REP(i,n) for(int i=0;i<(n);++i)
#define REP1(i,a,b) for(int i=(a);i<=(b);++i)
#def... | ALGO | 0.999683 | 3.880292 |
54188a4d-bd8a-45e5-ab7a-442b9c550619 | jjunCoder/ProblemSolving | 4256/4256/소스.cpp | /*
2016.10.4
BaekJoon Online Judge
Problem Solving
Seong Joon Seo (ID: jjunCoder)
Problem
#4256
트리
*/
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
vector<int> preorder, inorder;
void post(int l, int r, int L, int R) {
if (l >= r) return;
const int N = r - l;
const int root = ... | ALGO | 0.999977 | 4.399987 |
f1f225b1-84f3-49f8-b3d8-a31a21cbd3a7 | sarvex/leetcode-raku | solution/0900-0999/0992.Subarrays with K Different Integers/Solution.cpp | class Solution {
public:
int subarraysWithKDistinct(vector<int>& nums, int k) {
vector<int> left = f(nums, k);
vector<int> right = f(nums, k - 1);
int ans = 0;
for (int i = 0; i < nums.size(); ++i) {
ans += right[i] - left[i];
}
return ans;
}
vect... | ALGO | 0.999967 | 6.321012 |
88fba8f1-f853-49f8-9ac1-a5e1a00bcede | Lyhour-Heng/ML-F1-prediction- | ml_venv/lib/python3.11/site-packages/sklearn/utils/src/MurmurHash3.cpp | // Note - The x86 and x64 versions do _not_ produce the same results, as the
// algorithms are optimized for their respective platforms. You can still
// compile and run any of them on any platform, but your performance with the
// non-native version will be less than optimal.
#include "MurmurHash3.h"
//-------------... | ALGO | 0.998608 | 7.198757 |
3609d014-6bb0-471d-a5b7-08b665225952 | raincross7/code-similarity | codes/train_code/problem193/problem193_439.cpp | #include <bits/stdc++.h>
using namespace std;
// n: 演算回数
// c: 答えをひとつだけ出すためのカウンタ
void find_seven(vector<int> &vec, string calc, int Sum, int n, int &c) {
// 停止条件
if (n == 4) {
if (Sum == 7 && c == 0) {
c++;
cout << calc + "=7" << endl;
return;
}
retu... | ALGO | 0.999853 | 4.607594 |
f0b13c59-2288-4774-a93b-40e1c3e6f5e2 | Tushar-99/Data-Structure | Abdul_bari_Sir_C++/CodeVita/Smallest_NO.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int no , temp , val;
bool flag = false;
cin >> no;
if(no < 0)
cout << "Wrong Input";
else
{
val = no;
temp = no * no;
while(val != 0 && temp != 0)
{
val %= 10;
temp ... | ALGO | 0.999465 | 4.088531 |
b4462fd8-fd51-47bb-a753-738a5904e2df | Fabulous-Oreo/packages_inputmethods_LatinIME | native/jni/src/suggest/core/layout/proximity_info_params.cpp | #include "defines.h"
#include "suggest/core/layout/proximity_info_params.h"
namespace latinime {
const float ProximityInfoParams::NOT_A_DISTANCE_FLOAT = -1.0f;
const int ProximityInfoParams::MIN_DOUBLE_LETTER_BEELINE_SPEED_PERCENTILE = 5;
const float ProximityInfoParams::VERTICAL_SWEET_SPOT_SCALE = 1.0f;
const float P... | TOOL | 0.959729 | 7.040804 |
3861756b-a4d8-4dbe-b8cd-a1b10086b716 | SONTAX/KNU | 4_term/AC/lab4/OptimalBinaryTree.cpp | #include "OptimalBinaryTree.h"
Node::Node() {
left = right = parent = nullptr;
}
Node::Node(int value, double probability, bool key) {
this->value = value;
this->probability = probability;
this->key = key;
left = right = parent = nullptr;
}
void Node::output(Node *node, int space) const {
if ... | ALGO | 0.999853 | 4.926937 |
e54b8722-24af-4e9b-b103-8fb0515a786d | hongjianMa/cpp | Algorithm/Acwing/未分类/迷宫问题.cpp | #include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> PII;
// #define int long long
const int N = 1010;
PII q[N * N];
PII prv[N][N]; // 记录前驱坐标
// bool st[N][N];
// 前序坐标,每个位置,都需要记录它的前序来源坐标,
// 如果来源坐标还是默认的初始值-1,表示没有走过;如果来源坐标里有一个数对,就知道它是由某个位置走过来的,就是走过了
// 参数:x,y 坐标,值:前驱是哪个节点PII,相当于一个PII组成的链条,从最后一个出发,不断的找自己... | ALGO | 0.999982 | 3.451938 |
445cd190-cf7a-421d-80d3-0556b26e0abe | openharmony/third_party_skia | third_party/externals/swiftshader/third_party/llvm-10.0/llvm/lib/Transforms/IPO/LoopExtractor.cpp | #include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/AssumptionCache.h"
#include "llvm/Analysis/LoopPass.h"
#include "llvm/IR/Dominators.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/Module.h"
#include "llvm/InitializePasses.h"
#include "llvm/Pass.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Tran... | TOOL | 0.958361 | 7.858078 |
a192afdc-ab4e-4296-a5ec-62ae8579cfcc | akgmage/data-structures-and-algorithms | Priority Queues/kth_largest_element.cpp | /*
Given an array A of random integers and an integer k, find and return the kth largest element in the array.
Note: Try to do this question in less than O(N * logN) time.
Input Format :
The first line of input contains an integer, that denotes the value of the size of the array. Let us denote it with the symbol N.
Th... | ALGO | 0.999945 | 5.40393 |
7065ebb3-78c1-4c55-9fc2-7e11397e634c | youtube/cobalt_sandbox | third_party/icu/source/io/ufile.cpp | #include "unicode/platform.h"
#if U_PLATFORM == U_PF_CYGWIN && defined(__STRICT_ANSI__)
/* GCC on cygwin (not msys2) with -std=c++11 or newer has stopped defining fileno,
unless gcc extensions are enabled (-std=gnu11).
fileno is POSIX, but is not standard ANSI C.
It has always been a GCC extension, which every... | TOOL | 0.851416 | 7.063703 |
56d0c62e-11f8-42ed-8038-e7f9e54482e3 | sing-dance-rap-basketball/leetcode | zxq/cpp/8-string-to-integer-atoi.cpp | /*
* @lc app=leetcode id=8 lang=cpp
*
* [8] String to Integer (atoi)
*/
// @lc code=start
class Solution {
public:
int myAtoi(string str) {
int i = 0;
long ans = 0;
int sign = 1;
for (; i < str.size() && str[i] == ' '; ++i); // go to the first non-empty character
... | ALGO | 0.992893 | 5.699746 |
59c8e82d-e009-4d37-a67d-755b187b2fef | bartsidee/boxee | xbmc/FileSystem/UPnPDirectory.cpp | #include "UPnPDirectory.h"
#include "UPnPAvDirectory.h"
#include "URL.h"
#include "UPnP.h"
#include "Platinum.h"
#include "PltSyncMediaBrowser.h"
#include "VideoInfoTag.h"
#include "FileItem.h"
#include "log.h"
#include "Util.h"
#include "Application.h"
using namespace MUSIC_INFO;
using namespace XFILE;
namespace DIR... | TOOL | 0.959439 | 3.870264 |
15e9cf86-b65e-4974-ad6f-3bdea24b9190 | MoppelDerDegu/warping | SaliencyMath.cpp | // author : Torben Dittrich
// edited by : Christopher Hipp
#include "StdAfx.h"
#include "SaliencyMath.h"
#include <opencv/cv.h>
#include <opencv/highgui.h>
using namespace std;
SaliencyMath::SaliencyMath(int rows, int cols)
{
this->image_saliency_map = cvCreateMat(cols, rows, CV_8UC2);
this->motion_saliency_ma... | ALGO | 0.990997 | 5.236121 |
ed5634b4-244c-480d-a15c-4d325f527a12 | akshatsingh523/Data-Structures-and-Algorithm | merge similar items using map.cpp | class Solution {
public:
vector<vector<int>> mergeSimilarItems(vector<vector<int>>& items1, vector<vector<int>>& items2) {
vector<vector<int>> res;
map<int,int> m;
for(auto item : items1){
m[item[0]]+=item[1];
}
for(auto item : items2){
m[item[0]]+=it... | ALGO | 0.999905 | 5.466298 |
33d730a7-757f-4c86-9008-b4ad402164a9 | ksgeu0905/Practice_Questions | Prerequisite Tasks - GFG/prerequisite-tasks.cpp | //{ Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
bool isPossible(int N, vector<pair<int, int> >& pr) {
vector<int>indeg(N,0);
vector<int>adj[N];
for(auto it:pr){
adj[it.second].push_back(it.first);
indeg[it.first]++;
... | ALGO | 0.999846 | 6.199083 |
35ce6762-22fb-4d59-b2b8-394f287515a0 | WhiteF326/cpp | ABC/ABC140/A.cpp | #include <bits/stdc++.h>
using namespace std;
int fact(int x) { return x <= 1 ? 1 : x * fact(x - 1); }
void manyIntInput(vector<int> s){
for(int i = 0; i < s.size(); i++) cin >> s[i];
}
int main(){
int n; cin >> n;
cout << (int)pow(n, 3) << endl;
} | ALGO | 0.999888 | 4.025797 |
20167c0a-ce6d-4dd7-bf8d-efd5b0a2f39d | MTDEV-CM7/frameworks | base/media/libstagefright/codecs/amrwb/src/deemphasis_32.cpp | /*
------------------------------------------------------------------------------
Filename: deemphasis_32.cpp
Date: 05/08/2004
------------------------------------------------------------------------------
REVISION HISTORY
Description:
-----------------------------------------------------------------------... | ALGO | 0.999706 | 6.02347 |
2f1a9743-fef2-4ff5-bba7-a10b429c7c00 | JangMinSeong/algo | 2024/8월/240819/Main_BJ_14476_최대공약수 하나 빼기.cpp | #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int n;
vector<int> nums;
vector<int> Llist, Rlist;
int gcd(int a, int b);
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
cin >> n;
for (int i = 0; i < n; i++) {
int num;
cin >> num;
nums.push_back(n... | ALGO | 0.99999 | 3.80769 |
efe03ede-b1bc-49a6-b371-8332287678d7 | zouharvi/mff-student | 1819-1/cpp_programming_1/hw_2/main.cpp | #include <iostream>
#include "tokenizer.h"
#include "converter.h"
#include "expression.h"
/*
General note on exceptions:
This code does not use exceptions for invalid inputs (both on invalid tokens
and operator semantics). Invalid inputs are expected and thus are part of
the standard code flow. There a... | ALGO | 0.930098 | 6.215576 |
e0336666-b156-49b9-a526-ba5c66400104 | amnydv17/POTD_LeetCode_GFG | LeetCode_POTD/String/1455. Check If a Word Occurs As a Prefix of Any Word in a Sentence_02_12_24.cpp | class Solution {
public:
int isPrefixOfWord(string sentence, string searchWord) {
istringstream ss(sentence);
string word;
int index = 0;
int m = searchWord.length();
// Iterate through each word in the sentence
while (ss >> word) {
index++;
... | ALGO | 0.999837 | 6.379514 |
ca751d6d-1062-4655-a296-3bd78ec78650 | evgurov/algo_prac | sprint_8/H.cpp | #include <iostream>
#include <fstream>
#include <vector>
#include <unordered_set>
std::unordered_set<int> find_matches_places(
const std::string& str,
const std::string& temp) {
std::unordered_set<int> matches_places;
std::vector<int> prefix_fun (temp.length());
int prev_fun = 0;
for (int i ... | ALGO | 0.999672 | 5.846956 |
0916e084-3d0d-4990-94b0-e4a9a2e02bd9 | PranshuSrivastava/Data-Structures-And-Algorithms | Arrays/getbit.cpp | //Perform basic bit operations
#include <bits/stdc++.h>
using namespace std;
int getBit(int n, int pos)
{
return ((n & (1 << pos)) != 0);
}
int setBit(int n, int pos)
{
return (n | (1 << pos));
}
int clearBit(int n, int pos)
{
return (n & ~(1 << pos));
}
int updateBit(int n, int pos, int value)
{
int m... | ALGO | 0.941885 | 3.794422 |
1589abfe-a776-44e6-98cf-c40cdea3ff00 | Masud-Abdullah/Online-Judges | LightOJ/Shadow_Sum_1447.cpp | #include <bits/stdc++.h>
#define nl "\n"
#define nn (cout << "NO\n")
#define yy (cout << "YES\n")
#define ss " "
#define ll long long
#define ull unsigned long long
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) ((a/gcd(a,b)) * b)
#define pii pa... | ALGO | 0.999613 | 3.611134 |
447baa9c-4cde-4ba8-9942-a5ecd160d794 | ishandutta2007/codeforces | se1ka2/normal/1132/B.cpp | #include <algorithm>
#include <iostream>
using namespace std;
typedef long long ll;
int main()
{
int n;
cin >> n;
ll a[300005];
ll sum = 0;
for(int i = 0; i < n; i++){
cin >> a[i];
sum += a[i];
}
sort(a, a + n, greater<ll>());
int m;
cin >> m;
for(int i = 0; i < ... | ALGO | 0.999834 | 3.534058 |
73c3bff0-817f-471d-9ac3-f1373f6939cb | pkgamma/cs225-final-review | code/04-heap/copy.cpp | #include <iostream>
using std::cout;
using std::endl;
int main() {
int i = 2, j = 4, k = 8;
int *p = &i, *q = &j, *r = &k;
k = i;
cout << i << j << k << *p << *q << *r << endl;
p = q;
cout << i << j << k << *p << *q << *r << endl;
*q = *r;
cout << i << j << k << *p << *q << *r << endl;
}
| ALGO | 0.996958 | 3.046369 |
972a3ccc-5524-4931-ba66-329d8159d2d2 | sukminkang12/codingforme | kakao/2019_카카오_신입공채_1차_2.cpp | #include <string>
#include <vector>
#include <iostream>
using namespace std;
vector<int> solution(int N, vector<int> stages) {
float arr[501] ={0,};
int total = stages.size();
int temp = 0;
float max = -1;
int max_index = 0;
vector<int> answer;
for(int i=0;i<stages.size();i++){
arr[stages.at(i)] += 1;
}... | ALGO | 0.99999 | 4.461129 |
8d197db5-4937-45c0-88a9-e1695e504001 | Mohit2352002/LeetCode_Solved | 2870-longest-alternating-subarray/2870-longest-alternating-subarray.cpp | static auto _ = [](){
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
return nullptr;
}();
/*
class Solution {
int helper(vector<int>&nums, int ind, int diff){
if(ind==nums.size()) return 0;
int ans=0;
if(nums[ind]-nums[ind-1]==diff) ans=max(ans,1+helper(nu... | ALGO | 0.999981 | 5.517669 |
6804ff7c-8b51-4aeb-b1a9-d7407d392afd | postcode-x/NAMPluginSimplified | eigen/doc/snippets/EigenSolver_EigenSolver_MatrixType.cpp | MatrixXd A = MatrixXd::Random(6,6);
cout << "Here is a random 6x6 matrix, A:" << endl << A << endl << endl;
EigenSolver<MatrixXd> es(A);
cout << "The eigenvalues of A are:" << endl << es.eigenvalues() << endl;
cout << "The matrix of eigenvectors, V, is:" << endl << es.eigenvectors() << endl << endl;
complex<double> l... | ALGO | 0.999315 | 3.088587 |
55d2d544-b081-41ab-8ac6-8ce76538d099 | BetterOIer/competitive-cpp-code-backup | Competition/Competition35/T1.cpp | #include<iostream>
using namespace std;
inline int read(){
int x=0,f=1;char c=getchar();
for(;!isdigit(c);c=getchar())if(c=='-')f=-1;
for(;isdigit(c);c=getchar())x=(x<<3)+(x<<1)+(c^48);
return x*f;
}
int a[15];
int main(){
int t=read(),l,y;
while(t--){
l=read(),y=read();
int L=10,R=l;
... | ALGO | 0.999925 | 3.577814 |
42885bb3-5e84-46f5-9a7b-9a5edbe1371e | ushabh-jain/Cpp | searching/q9.cpp | // Capacity To Ship Packages Within D Days
// class Solution {
// public:
// int d(vector<int>& weights,int weight){
// int currweight = 0,days=0;
// for(int w:weights){
// if(currweight + w <= weight) {
// currweight += w;
// }
//... | ALGO | 0.999991 | 5.42911 |
220eb662-ce5d-4806-a4b7-ecbe91bd3523 | asyncde/asyncde | examples/ade_example.cpp | #include <chrono>
#include <limits>
#include <math.h>
#include <stdlib.h>
#include <time.h>
// #define _GPERF_PROFILER
#ifdef _GPERF_PROFILER
#include <gperftools/profiler.h>
#endif // _GPERF_PROFILER
#include "asyncde/ADEConfig.h"
#include "asyncde/ADEIterator.h"
#include "asyncde/ADEPoint.h"
#include "asyncde/ADEP... | ALGO | 0.995645 | 5.362163 |
e969cadc-fff1-4f4e-ab38-2075ce865851 | www12345w/Lab1-2022111545 | main2.cpp | #include "main2.h"
char toLower(char c) {
return tolower(c);
}
WordNode::WordNode(const std::string& w) : word(w), next(nullptr) {}
Graph::Graph(int vertices) : numVertices(vertices),
adjacencyMatrix(vertices, std::vector<int>(vertices, 0)) {
if (vertices > MAX_VERTICES) {
s... | ALGO | 0.999383 | 6.207051 |
087de195-6397-48ca-a4b2-c2321aa6e9bc | ms0208/Linked-List | SLLO12.cpp | // Sort a LL of 0's, 1's and 2's
// To sort a linked list containing only 0's, 1's, and 2's, we can use a three-pointer approach.
// This technique, often referred to as the Dutch National Flag algorithm, ensures that we
// traverse the list in a single pass, keeping the time complexity at O(n) and space complexity
... | ALGO | 0.999996 | 6.186998 |
b03f53cc-29b9-4d50-8104-ffa263b71302 | ishandutta2007/codeforces | aidos/normal/1156/A.cpp | #include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <ctime>
#define pb push_back
#define ll long long
#define mp make_pair
#define f first
#define s second
#define pii pair < int, int ... | ALGO | 0.999861 | 3.32208 |
696b2b6b-a7de-4e85-a4d6-3340220a4004 | arghadeep25/Kalman-Filter | examples/kalman_filter.cpp | #include <Eigen/Dense>
#include <iomanip>
#include <iostream>
#include <vector>
#include "kf/kf.hpp"
int main(int argc, char *argv[]) {
int n = 3; // Number of states
int m = 1; // Number of measurements
int c = 1;
double dt = 1.0 / 30; // Time step
Eigen::MatrixXd A(n, n); // System dynamics matrix
Ei... | ALGO | 0.999199 | 7.082019 |
eb77f49b-568c-4333-9fa4-354be5a00cd7 | zhaoxinghai/ZHAOXINGHAI | Gateway/g711/g711.cpp | /*
* g711.c
*
* Created on: Aug 6, 2012
* Author: bogdan
*/
#include "g711.h"
int8_t ALaw_Encode(int16_t number)
{
const uint16_t ALAW_MAX = 0xFFF;
uint16_t mask = 0x800;
uint8_t sign = 0;
uint8_t position = 11;
uint8_t lsb = 0;
if (number < 0)
{
number = -number;
sign = 0x80;
}
if (number > AL... | ALGO | 0.988524 | 3.693873 |
73b33cce-4e58-4a0f-b31c-3a1af44dd963 | Karanpratap20/LeetCode-DSA | 783-search-in-a-binary-search-tree/search-in-a-binary-search-tree.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.999992 | 6.195477 |
1023e930-22dc-4add-93b8-17cdacf3255b | hihozoo/KeepLearning | LeetCode/103-binary-tree-zigzag-level-order-traversal.cpp | /**
* 给你二叉树的根节点 root ,返回其节点值的 锯齿形层序遍历 。(即先从左往右,再从右往左进行下一层遍历,以此类推,层与层之间交替进行)。
*/
#include <stack>
#include <vector>
#include <iostream>
#include <queue>
#include <sstream>
#include <algorithm>
using namespace std;
struct TreeNode{
int val;
TreeNode* left;
TreeNode* right;
TreeNode() : val(0), left(nullptr), right... | ALGO | 0.999991 | 5.654988 |
4462249a-a1dc-4ebf-920d-c36cf0f1b238 | pavankumarsai18/LeetCode | 1329-minimum-cost-to-move-chips-to-the-same-position/solution.cpp | class Solution {
public:
int minCostToMoveChips(vector<int>& chips)
{
//1. need to move the minimum number of chips to left or right
//2. need to maximize the shift that are even
// count all items at odd place
// count all items at even place
//can br... | ALGO | 0.99996 | 5.659487 |
ac8a8518-9d27-491b-9388-675b3cede764 | harsimran01099/Data-structure | buckketSort.cpp | #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
void printArray(float a[],int n)
{
for(int i=0;i<n;i++)
{
cout<<a[i]<<endl;
}
}
void bucketSort(float a[],int n)
{
vector<float> b[n];
for(int i=0;i<n;i++)
{
int b1=n*a[i];
b[b1].push_back(a[i]);
}
for(int i=0;i<n;i++)
{
sor... | ALGO | 0.999858 | 4.083678 |
1b24bfa0-08fc-446c-babd-80b4149d625b | MarcusMors/ADA | CSES_problem_set/Introductory_Problems/trailing_zeros.cpp | #include <iostream>
using namespace std;
int main()
{
int n;
cin >> n;
cout << n / 5 << endl;
return 0;
}
| ALGO | 0.99805 | 3.643915 |
adbe6186-9fb8-4463-bb3f-553ca37ac529 | Ping6666/LeetCode | src/problems/0053. Maximum Subarray/0053. Maximum Subarray.cpp | #include <vector>
using namespace std;
// Maximum Subarray Problem
class Solution
{
// Kadane's algorithm
// Time complexity: O( n )
// Runtime: 96 ms (92.44 %), Memory: 67.7 MB (91.39 %).
public:
int maxSubArray(vector<int> &nums)
{
int Sum = nums[0];
for (int i = 1; i < nums.si... | ALGO | 0.999806 | 6.008541 |
63a61b8f-e695-4201-afe3-08d0d96af932 | Sarwvidya/30DayCoding | Number of Provinces - GFG/number-of-provinces.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
//User function Template for C++
class Solution {
private:
void dfs(int node, vector<int> adjlis[], int vis[]){
vis[node] = 1;
for(auto it : adjlis[node]){
if(!vis[it]){
df... | ALGO | 0.999984 | 6.575984 |
b6294fea-7d39-4df4-bf3c-3f0b969ece11 | dilipgudlur/CodeSamples | CCI/LinkedList/cci_2.2.cpp | #include <iostream>
#include <string>
#include <unordered_map>
#include <vector>
using namespace std;
/*2.2 Return Kth to Last: Implement an algorithm to find the kth to last element of a singly linked list.
*/
typedef struct node {
struct node* next;
int val;
}NODE;
NODE* head;
//Iterative solution - most... | ALGO | 0.999474 | 4.93969 |
400b5520-9878-47cc-976b-354b9525e923 | RayLee234/Competitive-Programming-Stuff | Dynamic Programming/Fence/main.cpp | #include <iostream>
#include <queue>
#include <algorithm>
using namespace std;
int n, m, f[101][16001];
struct worker {
int l, p, s;
}a[101];
bool cmp(worker x, worker y) {
return x.s < y.s;
}
int calc(int i, int k) {
return f[i-1][k] - k * a[i].p;
}
int main() {
cin >> m >> n;
for(int i=1;i<=n;++i)... | ALGO | 0.999741 | 3.920879 |
582d6639-aee5-41c6-824d-186b991b5cba | Hanamuke/Projet-MH | main.cpp | #include "Grille.hpp"
#include <iostream>
#include <fstream>
#include <ctime>
#include <cstdlib>
using namespace std;
int main(int argc, char* argv[])
{
int t, rCapt, rCom;
//float facteurEnleve;
cin>>t>>rCapt>>rCom;
cout<<endl;
clock_t t1, t2;
fstream out5;
out5.open("out5.txt",fstream::trunc|fstream::out)... | ALGO | 0.956246 | 4.236463 |
1035c66d-668c-4dca-a5e4-f7a7695909f2 | GarikHarutyunyan/cpp-virtual-machine-32bit | cpp-virtual-machine-32bit/Alu.cpp | #include "Alu.h"
#include <iostream>
stream Alu::run(byte instruction, stream value1, stream value2) {
int instructionCode = Utils::decoder3bit(instruction);
stream result;
switch (instructionCode) {
case 0:
result = Alu::streamAdd(value1, value2);
break;
case 1:
result = Alu::streamSub(value1, value2... | TOOL | 0.872967 | 5.28843 |
3874654d-fc21-4fba-9497-deffdba6d82c | sarvex/leetcode-haskell | lcci/17.10.Find Majority Element/Solution.cpp | class Solution {
public:
int majorityElement(vector<int>& nums) {
int cnt = 0, m = 0;
for (int& v : nums) {
if (cnt == 0) {
m = v;
cnt = 1;
} else
cnt += (m == v ? 1 : -1);
}
cnt = count(nums.begin(), nums.end(),... | ALGO | 0.999953 | 5.659158 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.