uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
7ea89e1f-5c4d-4935-9b5c-fa9950446a36 | zengKun2002/ballgame | ballgame/cocos2d/extensions/Particle3D/PU/CCPUMeshSurfaceEmitter.cpp | #include "CCPUMeshSurfaceEmitter.h"
#include "extensions/Particle3D/PU/CCPUParticleSystem3D.h"
#include "extensions/Particle3D/PU/CCPUUtil.h"
NS_CC_BEGIN
// Constants
const Vec3 PUMeshSurfaceEmitter::DEFAULT_SCALE(1, 1, 1);
const MeshInfo::MeshSurfaceDistribution PUMeshSurfaceEmitter::DEFAULT_DISTRIBUTION = MeshInfo::... | TOOL | 0.886757 | 7.123833 |
d55bb0da-cd9d-4fa2-8a18-b3811a3494f1 | areian13/PS_BOJ | 1. Bronze/Bronze 3/[B3] 24302 КУРИЕРИ.cpp | #include <iostream>
#include <algorithm>
#define FastIO ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr)
#define lf(d) cout << fixed; cout.precision(d);
#define ulf() cout.unsetf(ios::scientific);
using namespace std;
int A(int x)
{
x /= 1'000;
if (x <= 5)
return 400;
if (x ... | ALGO | 0.99508 | 4.127191 |
1a3b67e2-e32b-40a7-b83b-ed9e61e3d55d | tecwds/Algorithm2024 | AlgContest1570/B/PBv1.cpp | //
// Created by wpan on 11/4/24.
//
#include <iostream>
#include <stack>
using namespace std;
stack<int> st;
int main() {
int n;
while (cin >> n) st.push(n);
while (!st.empty()) {
cout << st.top() << ' ';
st.pop();
}
return 0;
} | ALGO | 0.999782 | 6.249922 |
e3d32f58-8cdb-45b1-a14a-6b0c4df00e9f | juliemoisk/algorithms-training-5 | 1B-football-commentator/1B.cpp | #include <iostream>
#include <string>
int main(void)
{
std::string M1, M2;
int loc;
int sum1, sum2;
int answer;
std::cin >> M1 >> M2 >> loc;
int G1, G2;
G1 = std::stoi(M1.substr(0, M1.find(":")));
G2 = std::stoi(M1.substr(M1.find(":") + 1));
int currG1, currG2;
currG1 = std::stoi(M2.substr(0,... | ALGO | 0.999112 | 3.791461 |
d4a8df87-1bc8-4c6c-951b-ca0a26aa4b55 | anuragtomer/leetcode | cpp/707.design-linked-list.cpp | class MyLinkedList {
int size;
struct Node {
int val;
Node *next;
Node() : next(nullptr) {}
Node(int _val) : val(_val), next(nullptr) {}
Node(int _val, Node *_next) : val(_val), next(_next) {}
};
Node *head;
public:
MyLinkedList() {
head = nullptr;
size = 0;
}
int get(int in... | ALGO | 0.999608 | 5.591872 |
33ae2438-4bf1-4697-990b-0e02fd64d025 | kundan6930/coding_contest | codeforces/Codeforces Round 908 (Div. 2)/A_Secret_Sport.cpp | #include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main (){
int t;
cin>>t;
while(t--)
{
int n;
cin>>n;
string s;
cin>>s;
cout<<s[n-1]<<endl;
}
return 0;
} | ALGO | 0.991456 | 3.739276 |
c975f0e2-ce43-4955-963a-ec5ff26680fa | Muzahid037/Online-Judge-Problems | CodeForces/B. Increase and Decrease.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
ll n,a,sum=0;
cin>>n;
for(int i=0;i<n;i++)
{
cin>>a;
sum+=a;
}
if(sum%n==0) cout<<n<<endl;
else cout<<n-1<<endl;
return 0;
}
| ALGO | 0.999828 | 3.168482 |
295c6efb-880b-49b2-9bcc-b1075c752bba | geanshu/data_struct | experiment_5/map_list/main.cpp | #include"ADT_map.h"
#include"map_list.h"
#include<iostream>
using namespace std;
void creat(map_list<char>& G, int n, int e)
{
for (int i = 0; i < n; i++)
{
char val;
cin >> val;
G.setPoint(i, val);
G.setMark(i, false);
}
for (int i = 0; i < e; i++)
{
char s1, s2;
int w;
cin >> s1 >> s2 >> w;
int... | ALGO | 0.99982 | 3.327849 |
57453494-7d3e-437f-9f4f-a3cc6d519cf0 | AnishDhomase/Code2.O | 882-peak-index-in-a-mountain-array/peak-index-in-a-mountain-array.cpp | class Solution {
public:
int peakIndexInMountainArray(vector<int>& arr) {
int n = arr.size(), low=1, high=n-2, mid;
while(low <= high){
mid = low + (high-low)/2;
if(arr[mid-1] < arr[mid] && arr[mid] > arr[mid+1])
return mid;
else if(arr[mid-1] > ar... | ALGO | 0.999994 | 5.772679 |
a385470a-61eb-4526-bb86-2425ced9a814 | AnkitXGandhi/GFG_POTD | Difficulty: Medium/0 - 1 Knapsack Problem/0-1-knapsack-problem.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
// Function to return max value that can be put in knapsack of capacity W.
int rec(int i, int W, vector<int>& wt, vector<int>& val, vector<vector<int>>& mem) {
if(i>=val.size()) return ... | ALGO | 0.99999 | 6.048161 |
5427d66b-e19d-408e-9320-a7072f3957fb | surtweig/kpi-assignments | parallel/matrix-openmp/main.cpp | #include "../matrix/matrix.h"
#define MSIZE 5
// 1.5 C = SORT(A) *(MA*ME) + SORT(B)
void F1()
{
matrix* MA = matrix::random(MSIZE, MSIZE, 0.0, 1.0);
matrix* ME = matrix::random(MSIZE, MSIZE, 0.0, 1.0);
matrix* A = matrix::random(MSIZE, 1, 0.0, 1.0);//matrix::getcolumn(*MA, 0);
matrix* B = matrix::rand... | ALGO | 0.999702 | 3.13136 |
40ff2650-46e7-484f-b36c-1cc6491c91d5 | lukaskaibel/node-opencv-docker | opencv/3rdparty/carotene/src/remap.cpp | #include "remap.hpp"
namespace CAROTENE_NS {
#ifdef CAROTENE_NEON
namespace internal {
void remapNearestNeighborReplicate(const Size2D size,
const u8 * srcBase,
const s32 * map,
u8 * dstBase, ptrdiff_t dstStride... | ALGO | 0.973778 | 6.870541 |
a7fb4c8d-d470-492f-861a-611a78b32362 | foolnotion/advent-of-code | source/2015/01/solution.cpp | #include <aoc.hpp>
template<>
auto advent2015::day01() -> result {
std::fstream f("./source/2015/01/input.txt");
std::string line;
std::getline(f, line);
i64 floor{0};
i64 pos{-1};
for (auto i = 0; i < std::ssize(line); ++i) {
auto c = line[i];
floor += c == '(';
floor... | ALGO | 0.976036 | 4.991773 |
1cadb0d9-04ae-4e4b-ba00-bcce94e598d6 | jaxxzer/ardupilot-rov | libraries/AC_PID/AC_P.cpp | // -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*-
/// @file AC_P.cpp
/// @brief Generic P algorithm
#include <AP_Math/AP_Math.h>
#include "AC_P.h"
const AP_Param::GroupInfo AC_P::var_info[] = {
// @Param: P
// @DisplayName: PI Proportional Gain
// @Description: P Gain which pro... | TOOL | 0.901647 | 3.574988 |
a5c77552-9719-4ac9-9b0f-285b18e6aa83 | shivambitm/self.concepts | template2.cpp | /*/ Author: indian_shivam /*/
//Date: 28/11/2021
//Time: 15:35:15
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int str = 0;
string str; cin >> str;
for (int i = 0; i < str.size(); ++i) {
if (str[i] == 'P') continue;
else if (str[i] == 'A') abs++;
else if (str[i] == 'L') {
... | ALGO | 0.999821 | 3.541802 |
3beaf214-8b56-4191-887c-b8ec2ceca104 | webeights/my_requests | 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.998809 | 6.763549 |
6eaf48ed-475c-4c7d-aff8-6d7989195f59 | hiteshmewada/LeetHub | 146-lru-cache/146-lru-cache.cpp | class LRUCache {
public:
class Node{
public:
int key,value;
Node *next,*pre;
Node(int _key, int _val){
key=_key;
value=_val;
}
};
Node *head=new Node(-1,-1),*tail=new Node(-1,-1);
int cap;
map<int,Node*>mp;
LRUCache(int capacity) {
... | ALGO | 0.999608 | 6.088612 |
8506fc44-9da1-4b2e-84b9-1af73f34c572 | Divyanshnigam/DS-ALGO | BINARY TREE/BINARY TREE Level Order Recursive Print.cpp | #include<iostream>
using namespace std;
class node
{
public:
int data;
node*left;
node*right;
node(int d)
{
data=d;
left=NULL;
right=NULL;
}
};
node* buildtree()
{
int d;
cin>>d;
if(d==-1)
{
return NULL;
}
node* root=new node(d);
root->left=buildtree();
root->right=buildtree();
return root;
... | ALGO | 0.999987 | 4.033812 |
b2a4ef9b-e998-407d-afe3-147713ac6b97 | Autumnal-Joy/leetcode | 2001-3000/2501/main.cpp | #include <bits/stdc++.h>
using namespace std;
static auto _ = []() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
return 0;
}();
#ifdef LEETCODE
struct TreeNode {
int val;
TreeNode *left;
TreeNode *right;
explicit TreeNode(const int x) : val(x), left(nullptr), right(nullptr) {}
};
TreeN... | ALGO | 0.999876 | 5.19556 |
324d41c1-c287-4a01-ab2d-1120c83201e8 | shikgom2/Codeup | 2700/2761.cpp | #include <stdio.h>
int main()
{
int i,j;
scanf("%d %d",&i,&j);
int max,min,mid;
int a,b,c;
a = i+j;
b = i-j;
c = i*j;
if (a > b)
{
max = a, min = b;
min = (b < c) ? b : c;
max = (a>c) ? a : c;
if ((max == a) && (min == b))
mid = c;
else if (max != a)
mid = ... | ALGO | 0.999994 | 3.450548 |
b871ef21-3972-4df6-9eb0-c530ff0a0c11 | pacha2880/competitive_programming_codes | E. Phoenix and Computers.cpp | #include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// #include <ext/rope>
#define mp make_pair
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)a.size()
#define eq(a, b) (fabs(a - b) < EPS)
#define md(a, b) ((a) % b +... | ALGO | 0.999993 | 4.84563 |
c3547cd1-400a-4ae8-b246-7c36fa3543eb | GautamAggarwal-05/-CrackYourPlacement | 0050-powx-n/0050-powx-n.cpp | class Solution {
public:
double solve(double x,int n){
if (n == 0) return 1;
double half = solve(x, n / 2);
if (n % 2 == 0) {
return half * half;
}
else {
return half * half * x;
}
}
double myPow(double x, int n) {
if(n<0){
... | ALGO | 0.999873 | 5.833371 |
ac29c2e8-645c-4138-8dbb-ee0043a79fe0 | Vishvam10/CP-Problems | LeetCode/80/main.cpp | class Solution {
public:
int removeDuplicates(vector<int> &arr) {
int n = arr.size();
if (n <= 2) {
return n;
}
int c = 0, left = 1;
for (int i = 1; i < n; i++) {
if (arr[i - 1] == arr[i]) {
c++;
} else {
c = 0;
}
if (c < 2) {
arr[left] = arr[... | ALGO | 0.999801 | 6.401604 |
d8ec37d3-d4d0-48e4-bf99-50fe926b079f | socc-io/algostudy | baekjoon/smilu/21764.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int n;
int h[250010];
int x[250010];
const ll mod = 1000000007;
int main() {
ios::sync_with_stdio(0); cin.tie(0);
cin >> n;
for (int i = 0; i < n; i++) cin >> h[i];
memcpy(x, h, sizeof(x));
for (int i = 0; i < n; i++) {
if (i+1 < n) x[i] ... | ALGO | 0.999972 | 4.154219 |
3a92cd06-ef75-4495-836c-577adc60dd20 | sarvex/leetcode-object-pascal | solution/2400-2499/2457.Minimum Addition to Make Integer Beautiful/Solution.cpp | using ll = long long;
class Solution {
public:
long long makeIntegerBeautiful(long long n, int target) {
auto f = [](ll x) {
int v = 0;
while (x) {
v += x % 10;
x /= 10;
}
return v;
};
ll x = 0;
while (f... | ALGO | 0.999968 | 5.717799 |
ffec26cd-c6f5-4de7-b777-6cdbac252fa1 | sarvex/leetcode-c | solution/2300-2399/2305.Fair Distribution of Cookies/Solution.cpp | class Solution {
public:
int distributeCookies(vector<int>& cookies, int k) {
sort(cookies.rbegin(), cookies.rend());
int cnt[k];
memset(cnt, 0, sizeof cnt);
int n = cookies.size();
int ans = 1 << 30;
function<void(int)> dfs = [&](int i) {
if (i >= n) {
... | ALGO | 0.999975 | 5.180426 |
22ce4a5b-9d81-4e4c-973f-fc0b9564a358 | for4WARD/2023_spring_task | Sources/Game.cpp | #include "../Headers/Game.h"
#include <iomanip>
std::string color_str[2] = {"red", "blue"};
std::string warrior_str[5] = {"dragon", "ninja", "iceman", "lion", "wolf"};
std::string weapon_str[3] = {"sword", "bomb", "arrow"};
void Game::Run() {
int win = -1;//0 for red,1 for blue 2 for tie
int m, n, k, t;
i... | ALGO | 0.979146 | 3.578155 |
443e15d0-04c9-4300-bb90-6ac653938070 | Rijul1204/Algorithm_ACM | Source_Code/Number theory/Prime Number/10235 simply emirp.cpp | #include<stdio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
#include<algorithm>
using namespace std;
#define s 1000110
bool p[s];
void buildprime(int num);
int main(){
int n,n1;
char nam[15];
buildprime(s-10);
while(scanf("%d",&n)==1){
if(p[n]==1){
printf("%d is not prime.\n",n);
con... | ALGO | 0.99815 | 3.479119 |
1fde1672-f409-46e9-8902-9049d9dc7e8a | WaleedAbdelhakim/Competitive-Programming | CodeForces/CF100676-gym-H.cpp | // explanation :
// as we can move between any two cities in the same SCC in no time,
// we will only care about edges connecting nodes from different SCCs
// so we will construct a tree with every SCC compressed in a node
// this tree will have an edge going from node x to node y
// if there exists... | ALGO | 0.999962 | 4.558585 |
eb44b147-8d40-4efe-9f3d-d27bc59a3e0c | BurningYolo/FirstGame | Library/PackageCache/com.unity.ide.visualstudio@2.0.18/Editor/COMIntegration/COMIntegration~/COMIntegration.cpp | #include <iostream>
#include <sstream>
#include <string>
#include <filesystem>
#include <windows.h>
#include <shlwapi.h>
#include <fcntl.h>
#include <io.h>
#include "BStrHolder.h"
#include "ComPtr.h"
#include "dte80a.tlh"
constexpr int RETRY_INTERVAL_MS = 150;
constexpr int TIMEOUT_MS = 10000;
// Often a DTE call m... | TOOL | 0.954364 | 6.933585 |
5939d233-8c22-4d0a-8c3d-0a86015c63f7 | AdritaAash/C__ | sum4_13324.cpp | #include<iostream>
using namespace std;
int main(){
int a,i,sum=0;
cin>>a;
for(i=1;i<=a;i++){
sum=sum+i;
}
cout<<"the sum of numbers is "<<sum<<endl;
return 0;
} | ALGO | 0.998934 | 3.336755 |
25efa717-e500-4808-920d-f39f8eb37399 | wongquijote/smoke-simulation | ext/nanogui/ext/eigen/bench/spbench/test_sparseLU.cpp | // Small bench routine for Eigen available in Eigen
// (C) Desire NUENTSA WAKAM, INRIA
#include <iostream>
#include <fstream>
#include <iomanip>
#include <unsupported/Eigen/SparseExtra>
#include <Eigen/SparseLU>
#include <bench/BenchTimer.h>
#ifdef EIGEN_METIS_SUPPORT
#include <Eigen/MetisSupport>
#endif
using namesp... | ALGO | 0.99649 | 4.273294 |
83c0475f-355d-48ed-bd6f-9fca90eb2025 | koralle/Cpp | Atcoder/ABC/abc114/abc114b.cpp | #include <iostream>
#include <string>
#include <cmath>
#include <cstdlib>
using namespace std;
int main() {
string input_str;
cin >> input_str;
int min_753 = 1000 ;
for(unsigned int i = 0; i < input_str.size() - 2; i++ ) {
int tmp = (input_str[i] - '0') * 100 + (input_str[i+1] - '0') * 10 + ... | ALGO | 0.997848 | 3.594519 |
fcbeccd1-6913-4a2e-a063-b03dfef5f482 | kdg5424/nextfoam-cfd | ThirdParty-2404/sources/boost/boost_1_74_0/libs/geometry/test/algorithms/distance/distance_se_geo_ar_ar.cpp | // Boost.Geometry (aka GGL, Generic Geometry Library)
// Unit Test
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
#ifndef BOOST_TEST_MODULE
#define BOOST_TEST_MODULE test_distance_geographic_areal_areal
#endif
#include <boost/range.hpp>
#include <boost/type_traits/is_same.hpp>
#includ... | TEST | 0.953819 | 7.731604 |
73e7b6c8-111e-4164-b30e-a2d8c41d7dd9 | Autumnal-Joy/leetcode | 0001-1000/0093/main.cpp | #ifdef LEETCODE
#include <bits/stdc++.h>
using namespace std;
#endif
static auto _ = []() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
return 0;
}();
#ifdef LEETCODE
struct TreeNode {
int val;
TreeNode *left;
TreeNode *right;
explicit TreeNode(const int x) : val... | ALGO | 0.999818 | 6.219105 |
f44d087e-48f2-4e34-886d-0ef3e27fe862 | MilkClouds/Competitive-Programming | Codeforces/milkclouds/contest/1247/d/63476258.cpp | # pragma GCC optimize ("O3")
# pragma GCC optimize ("Ofast")
# pragma GCC optimize ("unroll-loops")
#include <bits/stdc++.h>
#define rep(a,b,c) for(ll a=b;a<c;a++)
#define rep2(a,b,c) for(ll a=b;a>c;a--)
#define pb push_back
#define x first
#define y second
#define all(x) x.begin(), x.end()
using namespace std;
using l... | ALGO | 0.999657 | 3.627304 |
41c7853a-a7d9-4fe1-83f3-05b77ea47c19 | Anjali1822/Striver-Sheet | Array Part-2/FindDuplicateInArrayofN+1integers.cpp | class Solution {
public:
int findDuplicate(vector<int>& nums) {
int slow=nums[0];
int fast=nums[0];
do {
slow=nums[slow];
fast=nums[nums[fast]];
}while(slow!=fast);
fast=nums[0];
while(slow!=fast){
slow=nums[slow];
... | ALGO | 0.999839 | 6.149489 |
05782c6f-3892-473f-b4c4-0036640b35ab | GloWE3/raindrop-space-happiness | Source/JavaScriptCore/b3/B3FoldPathConstants.cpp | #include "config.h"
#include "B3FoldPathConstants.h"
#if ENABLE(B3_JIT)
#include "B3BasicBlockInlines.h"
#include "B3CaseCollectionInlines.h"
#include "B3Dominators.h"
#include "B3InsertionSet.h"
#include "B3PhaseScope.h"
#include "B3SwitchValue.h"
#include "B3ValueInlines.h"
namespace JSC { namespace B3 {
namespac... | TOOL | 0.881768 | 7.892251 |
1c4e18d6-12dd-4c56-920c-62e4d9f0431c | Darkborderman/Online-judge | UVa/12468.cpp | #include<iostream>
#include<cmath>
using namespace std;
int main()
{
int front,end;
while(cin>>front>>end&&(front!=-1&&end!=-1))
{
int a=abs(front-end);
int b=100-a;
if(a>b) cout<<b<<endl;
else cout<<a<<endl;
}
return 0;
} | ALGO | 0.999365 | 3.158466 |
39114fab-6d22-49cb-b1e5-7213da7e0246 | tritt13579/CodeC | ntucoder/Sort.cpp | #include <bits/stdc++.h>
using namespace std;
#define MAX 100
// SX chen
void insertionSort(int a[], int n)
{
int i, j, k;
for (i = 1; i < n; i++)
{
k = a[i];
j = i - 1;
while (j >= 0 && a[j] > k)
{
a[j + 1] = a[j];
j--;
}
a[j + 1] = k... | ALGO | 0.999982 | 5.3023 |
f2f07c7c-a64f-4ffe-ab71-70e600d041b2 | opengauss-mirror/Plugin | contrib/spq_plugin/src/spq_optimizer/libspqopt/src/xforms/CXformLeftAntiSemiJoinNotIn2NLJoinNotIn.cpp | #include "spqopt/xforms/CXformLeftAntiSemiJoinNotIn2NLJoinNotIn.h"
#include "spqos/base.h"
#include "spqopt/operators/CLogicalLeftAntiSemiJoinNotIn.h"
#include "spqopt/operators/CPatternLeaf.h"
#include "spqopt/operators/CPhysicalLeftAntiSemiNLJoinNotIn.h"
#include "spqopt/xforms/CXformUtils.h"
using namespace spqop... | ALGO | 0.980362 | 5.704875 |
26ecd592-e161-462a-93cc-3ea6d3a570cb | ishandutta2007/codeforces | maksim1744/normal/1420/E.cpp | /*
author: Maksim1744
created: 24.09.2020 18:30:29
*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define sum(a) ( accumulate ((a).begin(), (a).end(), 0ll))
#define mine(a) (*mi... | ALGO | 0.999973 | 3.962039 |
960efc5e-c9df-4fd3-ae53-abfb3d430cd1 | GandalfMaster/Trash | 102201528HomeWork1/eigen-3.4.0/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_colwise.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
int main()
{
Eigen::MatrixXf mat(2,4);
mat << 1, 2, 6, 9,
3, 1, 7, 2;
std::cout << "Column's maximum: " << std::endl
<< mat.colwise().maxCoeff() << std::endl;
}
| ALGO | 0.999706 | 3.779679 |
28f196eb-9f80-4fff-af90-a95b23701ec9 | Vortexx2/DSA-questions | leetcode/easy/26-remove-duplicates/sol.cpp | /**
* @file sol.cpp
* @author Vortexx2
* @brief Problem 26 - Remove Duplicates From Sorted Array
* @date 06-05-2023
*
* Runtime - 15 ms O(n)
* Memory Usage - 18.3 MB O(1)
*/
#include <bits/stdc++.h>
using namespace std;
class Solution {
public:
int removeDuplicates(vector<int>& nums) {
if (nums.size(... | ALGO | 0.999915 | 6.432185 |
048c0c96-7fb0-41c5-b8ef-e3a46d614c97 | POOMESH-19/Leet-Code-Problem | 3300-Minimum-Element-After-Replacement-With-Digit-Sum.cpp | class Solution {
public:
int minElement(vector<int>& nums) {
vector<int> P;
for (int n : nums) {
int s = 0;
while (n) {
s += n % 10;
n /= 10;
}
P.push_back(s);
}
sort(P.begin(),P.end());
return P[... | ALGO | 0.999939 | 6.589905 |
06279e66-0325-4092-8774-6acc0075af0b | Vicke413/Leetcode_Problems | 2502-sort-the-people/2502-sort-the-people.cpp | class Solution {
public:
vector<string> sortPeople(vector<string>& names, vector<int>& height) {
vector<string>ans;
int n=names.size();
vector<pair<int,string>>v;
for(int i=0;i<n;i++)
{
v.push_back({height[i],names[i]});
}
sort(v.rbegin(),v.rend());
... | ALGO | 0.999988 | 6.443665 |
ada3005f-a581-402a-b008-5483da8ba362 | Yash-Thakare22/DSA_Uplift_Project | Assignments/Solutions/Venkata Naga Sai Rohit Kanteti/Assignment5/q1.cpp | /*
Question 1:Given a binary array A[] of size N. The task is to arrange the array in increasing order.
Note: The binary array contains only 0 and 1.
Input:
5
1 0 1 1 0
Output:
0 0 1 1 1
*/
#include<bits/stdc++.h>
using namespace std;
void swap(int *x,int *y)
{
int t;
t = *x;
*x = *y;
*y =... | ALGO | 0.99999 | 4.727169 |
5d48ee18-5ac9-40d7-b109-172cea1d936b | symcreg/multi_agent | include/eigen-3.4.0/doc/examples/Tutorial_BlockOperations_corner.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace std;
int main()
{
Eigen::Matrix4f m;
m << 1, 2, 3, 4,
5, 6, 7, 8,
9, 10,11,12,
13,14,15,16;
cout << "m.leftCols(2) =" << endl << m.leftCols(2) << endl << endl;
cout << "m.bottomRows<2>() =" << endl << m.bottomRows<2>() << endl << ... | ALGO | 0.999078 | 4.092313 |
ce2adb02-80d6-4e4e-86b4-ecea4c58a75d | Ynjxsjmh/PracticeMakesPerfect | LeetCode/p0003/I/3-longest-substring-without-repeating-characters.cpp | #include <set>
#include <iostream>
using namespace std;
class Solution {
public:
int lengthOfLongestSubstring(string s) {
int maxLength = 0;
for (int i = 0; i < s.size(); i++) {
int j = i+1;
set<char> exsist;
exsist.insert(s[i]);
while (j<s.size()) {
... | ALGO | 0.999778 | 5.403717 |
b84d55c2-5ff9-454c-8899-f50499c74de7 | bastamon/ACM2- | 第12章_2010_Day6/12.3.sum/sum.cpp | #include <stdio.h>
#include <string.h>
#include <algorithm>
const int M = 1005;
const int N = 1 << 12;
struct node{
int op;
int x1, y1, x2, y2;
} qu[M];
int opcount[N], clearcount[N], clear[N], count;
bool op[N], mark[N];
void init() {
memset(op, 0, sizeof(op));
memset(clear, -1, sizeof(clear));
memset(opcount,... | ALGO | 0.999917 | 4.095507 |
691e6c58-be8d-49f6-b4f9-6f4cace75590 | pavelsimo/ProgrammingContest | uva/11728_Alternate_Task/P11728.cpp | /* @BEGIN_OF_SOURCE_CODE */
/* @JUDGE_ID: 11728 C++ "Factors, Sieve, Divisors" */
#include <algorithm>
#include <cstdio>
#include <cstring>
using namespace std;
// MAX SUM ~ 3048
const int MAXN = 1002;
int D[MAXN], ans[3052];
void sieve() {
memset(D, 0, sizeof(D));
memset(ans, -1, sizeof(ans));
for(in... | ALGO | 0.999603 | 4.125621 |
94d4caf5-38b8-4925-aa9a-3a645b737e1d | duylonggg/DSA-CodePTIT | Generation/DSA01014.cpp | #include <bits/stdc++.h>
using namespace std;
int n, k, s, total, cnt;
vector<int> v;
void gen(int start) {
if (total > s) return;
if (v.size() > k) return;
if (v.size() == k and total == s) {
++cnt;
return;
}
for (int i = start; i <= n; ++i) {
v.push_back(i);
... | ALGO | 0.999851 | 3.663091 |
5ded0a62-c7ec-42fc-bc10-df36504c0e05 | Sean0628/competitive_programming | atcoder/tessoku-book/2/b16.cpp | #include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
#define rep(i, n) for (int i = 0; i < (n); ++i)
using ll = long long;
using P = pair<int, int>;
int main() {
int n; cin >> n;
vector<int> h(n);
rep(i, n) cin >> h[i];
vector<int> dp(n);
dp[0] = 0;
dp[1] = abs(h[0... | ALGO | 0.999954 | 4.755797 |
a2f9117b-a169-47fc-bcb3-dd6bb58a3e5d | Lee-Seungwook/Cetc | vs/C/Project5/Project5/소스.cpp |
#include <stdio.h>
#include <malloc.h>
#include <stdlib.h>
#define TRUE 1
#define FALSE 0
typedef struct ListNode {
int data;
struct ListNode *link;
}ListNode;
ListNode *head;
ListNode *getNode() {
ListNode *temp;
temp = (ListNode *)malloc(sizeof(ListNode));
if (temp == NULL) {
printf(" ҵ .\n"); exit(1);... | ALGO | 0.999889 | 3.522766 |
6457e4f9-720a-4ff5-9abb-ef7f72972738 | kumarnutan204/Elab | OOPS/Rohan is an enthusiastic.cpp | #include <iostream>
using namespace std;
class GoodNum
{
public:
// void check()
//{cout<<"hey";}
void check(int n)
{ int d,count=0,f=0;
while(n)
{
d=n%10;
if(d==0){
f=1;
count++;}
n/=10;
}
if(f==1) cout<<co... | ALGO | 0.999734 | 4.047881 |
4cffb7ab-0210-4946-a6ba-68e9c924160e | eileen0904/school_work | Grade2/grade2-1/DS_Class/Assignmen_2/c.cpp | #include<iostream>
using namespace std;
template <class T>
class Node{
public:
Node(){
prev = NULL;
next = NULL;
}
Node(T d){
prev = NULL;
next = NULL;
data = d;
}
void setPrev(Node *p){
prev = p;
... | ALGO | 0.998822 | 4.653707 |
f4219698-805b-4c4c-ab4f-4e60ea285400 | mohammedaljibory/arthultib | 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.998733 | 6.76775 |
6f3ca167-159d-405e-94a5-345c4f947341 | ThomasKidane/Competitive_Programming | Codeforce_Problems/1214E.cpp | #include<bits/stdc++.h>
using ll = long long;
using ld = long double;
using namespace std;
#define endl "\n";
#define ff first
#define ss second
#define forn(i,n) for(int i=0;i<n;i++)
#define dbgv(v) cout<<#v<<" "<<v<<endl
#define dbga(a,n) forn(i,n-1) {cout<<a[i]<<' ';} cout<<a[n-1]<<'\n';
void solve(){
int n;
... | ALGO | 0.99962 | 3.706205 |
4e7407c3-81b2-4246-a86f-7fd815d0f26b | raincross7/code-similarity | codes/train_code/problem378/problem378_149.cpp | #include<iostream>
#include<vector>
#include<math.h>
#include<algorithm>
using namespace std;
int main() {
int n;
long long sum = 0;
cin >> n;
vector<int> v(n);
for (int i = 0; i < n; i++) {
cin >> v[i];
sum = sum + v[i];
}
sort(v.begin(), v.end());
cout << v[0] << " " << v[n - 1] << " " << sum << endl;
}
| ALGO | 0.999935 | 3.426026 |
28811296-1806-44e9-9c7e-4052e27cb2c8 | themanhnd/StudyAlgorithm | _SourceCode/_11_283_Move_Zeroes.cpp | /*
The Brown Box / hoangvancong.com
Id: 283
Name: Move Zeroes
Url: https://leetcode.com/problems/move-zeroes/
*/
#include <iostream>
#include <vector>
using namespace std;
void moveZeroes(vector<int>& a)
{
int n = a.size();
int curIndex = 0;
for (int i = 0; i < n; i++)
{
if(a[i] != 0)
... | ALGO | 0.999801 | 5.695848 |
bbc98b07-370a-4c86-af74-6eb45015bd04 | jarodl/Spoom | Spoom/libs/Box2D/Collision/b2CollideCircle.cpp | #include <Box2D/Collision/b2Collision.h>
#include <Box2D/Collision/Shapes/b2CircleShape.h>
#include <Box2D/Collision/Shapes/b2PolygonShape.h>
void b2CollideCircles(
b2Manifold* manifold,
const b2CircleShape* circleA, const b2Transform& xfA,
const b2CircleShape* circleB, const b2Transform& xfB)
{
manifold->pointCou... | ALGO | 0.999332 | 7.757187 |
3c89be03-1752-423a-a1bc-47bc1bd20c27 | ishandutta2007/codeforces | dario2994/normal/788/B.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
template <typename T1, typename T2>
string print_iterable(T1 begin_iter, T2 end_iter, int counter) {
bool done_something = false;
stringstream res;
res << "[";
for (; begin_iter != end_iter and counter; ... | ALGO | 0.999914 | 4.367872 |
a21bb915-5899-4345-a1b6-24e52c2f764f | sarvex/leetcode-ada | solution/1000-1099/1008.Construct Binary Search Tree from Preorder Traversal/Solution.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.999995 | 6.367501 |
88e78396-e4c6-453c-a1c9-8fcd2e3ad545 | SuperheroesValley/superheroes-exercises | interviewbit/binary search/allocate books.cpp | int Solution::books(vector<int> &A, int B) {
if (B > (int)A.size())
return -1;
int sum = 0;
int l{0};
for (auto &x : A) {
sum += x;
l = max(l, x);
}
auto can = [&] (auto m) {
int b{B};
int s{0};
for (int k=0; k < (int)A.size() && b >= 0; ... | ALGO | 0.999967 | 5.201225 |
e5b6c0f6-89f6-42e6-bba2-2ba0519a6338 | maragmodh/GFGCODE | Medium/Topological sort/topological-sort.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution
{
void dfs(int start, vector<bool> &vis, stack<int> &s, vector<int> adj[]) {
vis[start] = 1;
for(int nbr : adj[start]) {
if(!vis[nbr])
dfs(nbr, vis, s, adj);
}
s.push(... | ALGO | 0.999899 | 6.895734 |
c111562d-097b-4467-9d87-439094144b56 | ishandutta2007/codeforces | emiso/normal/1621/D.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#ifdef EBUG
#include "trace.h"
#else
template<typename... Args> void trace(Args... args) {}
#define trace2(args...) trace(args)
#endif
#define MN 1001000
ll t = 1, n, ans, a[MN];
//char s[MN]; string str;
int main() {
scanf("%lld", &t);
st... | ALGO | 0.999884 | 3.125792 |
361c63e9-fdd1-4023-9acf-9ccad9d8d6d9 | ReNginx/acm | 组队练习/2017.10.8/D/a.cpp | /#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
typedef long long ll;
typedef double ld;
typedef pair <ll, int> pii;
const int maxn = 4e5+50, maxm = 1e5+50;
const int inf = 0x3f3f3f3f, mod = (int)1e9 + 7;
const ll INF = 0x3f3f3f3f3f3f3f3f;
typedef int arrn[maxn];
typedef ll arrm[ma... | ALGO | 0.999519 | 3.471308 |
a8f45369-21fa-4743-9c43-08b021e84ca9 | donzoru/GN-template-demo | buildtools/third_party/libc++/trunk/test/std/algorithms/alg.sorting/alg.sort/is.sorted/is_sorted.pass.cpp | // <algorithm>
// template<ForwardIterator Iter>
// requires LessThanComparable<Iter::value_type>
// bool
// is_sorted(Iter first, Iter last);
#include <algorithm>
#include <cassert>
#include "test_macros.h"
#include "test_iterators.h"
#if TEST_STD_VER > 17
TEST_CONSTEXPR bool test_constexpr() {
int ia[] ... | TEST | 0.986979 | 6.830899 |
1a7d3812-310e-42c8-bea2-7360b15afe91 | Pranavchiku/Love-Babbar-Solution | array/15.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long int
int minJumps(int arr[], int n){
int j = n-1;
int check[n]={0};
if(n==1) return 0;
else{
for(j=n-1;j>=0;j--){
if(arr[j]!=0){
int i=j+1;
int flag=0;
while(i<n and i<=... | ALGO | 0.999955 | 4.294057 |
75d6e76a-342a-4d7d-a976-5bfbcc6cdd84 | Aokman12/LeetCode | 0083-remove-duplicates-from-sorted-list/0083-remove-duplicates-from-sorted-list.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
ListNode* deleteDupli... | ALGO | 0.999932 | 5.818669 |
62faf6f9-a8ed-41d5-81ee-4f168130b116 | vrutikMangroliya/CPP | for_loop/eventotal.cpp | #include <iostream>
using namespace std;
int main()
{
int i, n, sum = 0;
cout << "enter the number: ";
cin >> n;
for (i = 1; i <= n; i++)
{
if (i % 2 == 0)
{
sum = sum + i;
cout << i << ',';
}
}
cout << endl <<"sum is ="<<sum ;
return 0... | ALGO | 0.999459 | 3.738958 |
9ca2c46b-b5e5-4fd0-8824-141a05d8bf32 | averyli290/usaco-cf-solutions | _codeforces/mex_cycle/mex_cycle.cpp | /*
Avery Li
2/26/2025
Problem link: https://codeforces.com/contest/2049/problem/C
*/
/*
can greedily choose using a stack choosing the first dragon immediately to be 0
Proof:
a dragon can have at most three friends, so mex will be at most three
the mex for a dragon i's neighbors i-1 and i+1
set a_1 = 0
5 1 3
1:... | ALGO | 0.999984 | 5.231802 |
c40b7da7-8d5e-4ae0-b33a-6c73bd80c9a6 | g1nya2/Algorithm_study | g1nya2/PGS/내적.cpp | #include <string>
#include <vector>
using namespace std;
int solution(vector<int> a, vector<int> b) {
int answer = 0;
for(int i=0;i<a.size();i++){
answer+=a[i]*b[i];
}
return answer;
}
| ALGO | 0.999948 | 4.459058 |
3c7f5340-ec55-4196-a551-63fa567f6dd8 | jiantao88/HaronyRN | react_native_openharmony/src/main/cpp/third-party/boost/libs/compute/perf/perf_search_n.cpp | #include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>
#include <boost/compute/system.hpp>
#include <boost/compute/algorithm/search_n.hpp>
#include <boost/compute/container/vector.hpp>
#include "perf.hpp"
int rand_int()
{
return static_cast<int>((rand() / double(RAND_MAX)) * 25.0);
}
int ... | ALGO | 0.988803 | 5.266295 |
188eea94-eb2b-4af9-a7b2-22f5f1422f66 | ishandutta2007/codeforces | qaqautomaton/normal/1334/E.cpp | /*
Author: QAQAutomaton
Lang: C++
Code: E.cpp
Mail: <EMAIL>
Blog: https://www.qaq-am.com/
*/
#include<bits/stdc++.h>
#define int long long
#define debug(...) fprintf(stderr,__VA_ARGS__)
#define DEBUG printf("Passing [%s] in LINE %d\n",__FUNCTION__,__LINE__)
#define Debug debug("Passing [%s] in LINE %d\n",__FUNCTION__,_... | ALGO | 0.999911 | 4.439563 |
18a1bf92-0b8e-4586-b397-6ad4fa03bc0d | ishandutta2007/codeforces | niyaznigmatul/normal/545/A.cpp | #include <bits/stdc++.h>
using namespace std;
int const N = 111;
int a[N][N], ans[N];
int main() {
int n;
scanf("%d", &n);
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) scanf("%d", a[i] + j);
}
int ac = 0;
for (int i = 0; i < n; i++) {
bool ok = true;
for (... | ALGO | 0.999856 | 3.268092 |
a9aae097-041e-4de6-98ee-35f4772c8354 | tomn2804/Kanalysis | External Dependencies/boost_1_74_0/libs/graph/test/clustering_coefficient.cpp | #include <iostream>
#include <boost/graph/undirected_graph.hpp>
#include <boost/graph/directed_graph.hpp>
#include <boost/graph/exterior_property.hpp>
#include <boost/graph/clustering_coefficient.hpp>
using namespace std;
using namespace boost;
// number of vertices in the graph
static const unsigned N = 5;
templat... | TEST | 0.915029 | 6.857328 |
7ef4a742-f5c4-4712-906b-2e60e4be9997 | Maxixler/C-Cpp | SortingAlgorithms/insertionSort.cpp | #include <stdio.h>
#include<math.h>
#define SIZE 10
void insertion_sort(int arr[]);
main(){
int i=0;
int arr[] = {28, -35, -46, 12, 23, 45, 126, 102, -89, 3};
printf("Siralama ncesi: ");
for(i=0;i<SIZE;i++){
printf("%d ",arr[i]);
}
puts("");
insertion_sort(arr);
printf("Siralama sonras: ");
for(i=0;i<SIZE;i+... | ALGO | 0.99999 | 4.210638 |
547e0431-77b6-4340-b916-2990c5a82279 | Dezreal/openpose-docker | opencv-3.4.14/modules/ml/test/test_utils.cpp | namespace opencv_test {
void defaultDistribs( Mat& means, vector<Mat>& covs, int type)
{
float mp0[] = {0.0f, 0.0f}, cp0[] = {0.67f, 0.0f, 0.0f, 0.67f};
float mp1[] = {5.0f, 0.0f}, cp1[] = {1.0f, 0.0f, 0.0f, 1.0f};
float mp2[] = {1.0f, 5.0f}, cp2[] = {1.0f, 0.0f, 0.0f, 1.0f};
means.create(3, 2, type);
... | ALGO | 0.912574 | 5.338003 |
ee4e3d1c-08c0-4980-b225-a8861b12c90e | lucasbitten/RoyalRush | include/GLM/test/core/core_func_integer_find_lsb.cpp | // This has the programs for computing the number of trailing zeros
// in a word.
// Max line length is 57, to fit in hacker.book.
#include <cstdio>
#include <cstdlib> //To define "exit", req'd by XLC.
#include <ctime>
int nlz(unsigned x) {
int pop(unsigned x);
x = x | (x >> 1);
x = x | (x >> 2);
x = ... | ALGO | 0.998951 | 5.181464 |
68ffd8bf-416c-4dec-96f1-1ba2205d3663 | raincross7/code-similarity | codes/train_code/problem460/problem460_150.cpp | #include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < n; i++)
#define repr(i, n) for(ll i = n; i >= 0; i--)
#define inf LLONG_MAX
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
int main()
{
ll H, W; cin >> H >> W;
if (H % 3 ... | ALGO | 0.999973 | 3.763815 |
75e51c1b-fb90-4eeb-a333-d307b974a6e7 | kyyyy516/pt2-project-bunshark | bunShark.cpp | #include<graphics.h>
#include"bunShark.hpp"
BunShark::BunShark(int _xPos, int _yPos, int _width, int _height)
: xPos(_xPos), yPos(_yPos),
width(_width), height(_height),
image(_width, _height),
jumping(false),
ascending(false),
jumpHeight(275),
jumpSpeed(30),
currentJumpPo... | TOOL | 0.935968 | 5.384868 |
6da8b014-7676-4539-9ab0-514e925b6770 | tayma-06/Basic_code | Contest/Binary_Search/Worms.cpp | #include<bits/stdc++.h>
using namespace std;
#define int long long
#define vll vector<int>
#define vpll vector<pair<int, int>>
signed main(){
int n;
cin>>n;
vll a(n);
for(int i=0; i<n; i++){
cin>>a[i];
}
int m;
cin>>m;
vll q(m);
for(int i=0; i<m; i++){
cin>>q[i];
... | ALGO | 0.999952 | 4.166935 |
89d477b4-a4e5-4431-9e07-2f9c5b73da9e | AliAshrafAnwaar/Job_Finder_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.998733 | 6.76775 |
8d73e547-9f72-4267-8259-ee52a53b31ea | JoshuaJakowlew/2024-12-01-parallel-labs | src/merge.cpp | #include <thread>
#include <random>
#include <chrono>
#include <fstream>
#include <span>
#include <algorithm>
#include <spdlog/spdlog.h>
void sort_chunk(std::span<int> data)
{
std::sort(data.begin(), data.end());
}
void merge_sort(std::vector<int> & numbers, std::size_t n_workers)
{
const std::size_t chunk_s... | ALGO | 0.998201 | 5.282972 |
9d9e6eaa-b77b-4ade-a7ca-d94118c8413a | jainsourav43/DSA | CP/Division without divide operator.cpp | class Solution {
public:
int divide(int dividend, int divisor) {
long long n = dividend, m = divisor;
// determine sign of the quotient
int sign = n < 0 ^ m < 0 ? -1 : 1;
// remove sign of operands
n = abs(n), m = abs(m);
// q stores ... | ALGO | 0.999787 | 5.82456 |
2848db70-ad23-4675-ae3d-562aee7c19d6 | CapTen101/CP-Solutions | LeetCode/Problems/DP/647. Count Palindromic Substrings.cpp | #include <bits/stdc++.h>
using namespace std;
int countSubstrings(string str)
{
int n = str.size();
int dp[n][n];
int ans = 0;
memset(dp, -1, sizeof(dp));
// s -> starting index
// e -> ending index
// g -> gap between the starting and ending index
// every g value represents a diago... | ALGO | 0.999956 | 4.96257 |
350eb541-8f0a-4598-8460-24094cb9d499 | alexanderommel/Competitive-Programming | Codeforces/Maximum Set/main.cpp | #include <bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
int t;
cin >> t;
while(t--){
ll l,r;
cin >> l >> r;
int i=1;
ll factor = 2;
while (l*factor<=r){
i++;
factor*=2;
//cout << factor <<'\n';
}
... | ALGO | 0.999203 | 3.660102 |
eb33146e-aeb7-4d17-898d-52aee3e5e562 | raincross7/code-similarity | codes/train_code/problem052/problem052_119.cpp | #include <iostream>
//#include <iomanip>
//#include <vector>
#include <string>
#include <algorithm>
using namespace std;
int main(){
string p, a, c, ans, buf, rep;
int n, b, e, cnt;
cin >> p >> n;
while (n--){
cin >> a;
if (a == "print"){
cin >> b >> e;
cnt = e - b;
ans = p.substr(b, cnt + 1);
... | ALGO | 0.997579 | 4.127028 |
5a6086e2-58ef-4f75-af25-ca0fc06bd06b | runtime-terror-63/LEET_HUB | 347-top-k-frequent-elements/top-k-frequent-elements.cpp | class Solution {
public:
vector<int> topKFrequent(vector<int>& nums, int k) {
unordered_map<int , int>mpp;
for(auto it : nums) mpp[it]++;
priority_queue<pair<int, int>>pq;
for(auto it : mpp){
pq.push({it.second, it.first});
}
vector<int>res;
for(... | ALGO | 0.999987 | 6.050944 |
aef85ae1-28d6-4be1-9ac5-b29cafffeafc | Puneetbisarwal/DTU-Coding-Practice-Questions | DTU Coding Questions/rotate_bits.cpp | #include <iostream>
#include<bits/stdc++.h>
using namespace std;
int right(int n,int d)
{
int a=(1<<d)-1;
cout<< "left shift "<<a<<endl;
int x = n & a;
cout<<"x = "<<x<<endl;
x = x << (16-d);
cout<<"x = "<<x<<endl;
n = n>>d;
cout<<" n = "<<n<<endl;
int res = (n|x);
cout<<"res =... | ALGO | 0.999901 | 4.000278 |
12cf34b3-b149-4eda-a092-5bf9f2f790b6 | Keerat666/LeetCode-Solutions | Leetcode-Hard/123-BestTimeToBuyAndSellStockIII/Best-Time-to-Buy-and-Sell-Stock-III.cpp | /*****************************************************************************************************
*
* Say you have an array for which the ith element is the price of a given stock on day i.
*
* Design an algorithm to find the maximum profit. You may complete at most two transactions.
*
* Note: You may not... | ALGO | 0.999981 | 6.484262 |
2b9b050c-bfca-45c1-b914-e1063ae3e630 | omidm/nimbus | applications/physbam/physbam-lib/Public_Library/PhysBAM_Fluids/PhysBAM_Incompressible/Grid_Based_Fields/TEMPERATURE_CONTAINER.cpp | namespace PhysBAM{
//#####################################################################
// Constructor
//#####################################################################
template<class T_GRID> TEMPERATURE_CONTAINER<T_GRID>::
TEMPERATURE_CONTAINER(T_GRID& grid_input)
:GRID_AND_ARRAY_CONTAINER<T_GRID,T>(grid_... | ALGO | 0.997133 | 6.077618 |
bed8e574-ef98-4e5e-91dd-fbf4a9564038 | duststorm/OgreCrowd | src/Detour/DetourNavMesh.cpp | #include <math.h>
#include <float.h>
#include <string.h>
#include <stdio.h>
#include "Detour/DetourNavMesh.h"
#include "Detour/DetourNode.h"
#include "Detour/DetourCommon.h"
#include "Detour/DetourAlloc.h"
#include "Detour/DetourAssert.h"
#include <new>
inline bool overlapSlabs(const float* amin, const float* amax,
... | ALGO | 0.975257 | 7.202378 |
2905f684-6d5c-479c-9558-150e922acc88 | rani0809/DS-Algo | 1689-partitioning-into-minimum-number-of-deci-binary-numbers/1689-partitioning-into-minimum-number-of-deci-binary-numbers.cpp | class Solution {
public:
int minPartitions(string n) {
return *max_element (n.begin(), n.end()) - '0';
}
}; | ALGO | 0.999748 | 6.063595 |
e5923cae-ed12-4b01-8345-58067985853a | jimlin2004/UVA | Math/FindPattern/1620/1620.cpp | #include <bits/stdc++.h>
using namespace std;
/*
數學結論題
定義 逆序數
1 3 2 4 6 5 7 8 的逆序數
-> 0+1+0+0+1+0+0+0 = 2
也就是每個數字後面有多少的數字比自己小
討論4個數字反轉對逆序數的改變
假設4個數字翻轉前逆序數是x,則翻轉後的逆序數是6 - x
為什麼
假設4個數字的逆序數: a + b + c + d = x,d一定等於0 -> a + b + c = x
經過翻轉
(3 - a) + (2 - b) + (1 - c) = 6 - (a + b + c) = 6 - x
其中逆序數的變化是
(6 - x) - x ... | ALGO | 0.999931 | 3.849669 |
f4d0da1c-4bb9-450a-8034-5752046649c2 | carvalhosouzalucas/Programas_CPP | 9) Caixa_Eletrônico.cpp | #include <iostream>
#include <locale.h>
using namespace std;
int main() {
setlocale(LC_ALL, "Portuguese");
int valor, duzentos, cem, cinquenta, vinte, dez, cinco, dois, resto;
cout << "Digite o valor a ser sacado (entre 2 e 2000): \n";
cin >> valor;
if (valor < 2 || valor > 2000) {
... | TOOL | 0.867542 | 5.102342 |
b0c4c4fd-4114-4b7a-a6f7-5115009e390a | ArchitKumar1/LeetCode-Submissions | maximum-number-of-ways-to-partition-an-array/Wrong Answer/10-2-2021, 8:42:10 PM/Solution.cpp | // https://leetcode.com/problems/maximum-number-of-ways-to-partition-an-array
template<class T>
void output_vector(vector<T> V){
for(int i = 0; i < (int)(V.size());i++){
if(i > 0) cout << " ";
cout << V[i];
}
cout << '\n';
};
class Solution {
public:
int waysToPartition(vector<int>& nu... | ALGO | 0.999973 | 5.822243 |
f47644b4-0fe7-40e2-a595-21f447b639f8 | dujingyao/Yao | 算法学习/acwing/真题训练/第十一届第二场/子串分值.cpp | #include<bits/stdc++.h>
using namespace std;
const int N=100010;
typedef long long int ll;
//l代表左边,r代表右边,h代表每次更新的下标
int l[N],r[N],h[27];
char st[N];
ll ans;
int main(){
scanf("%s",st+1);
int len=strlen(st+1);
//记录前一个的位置
for(int i=1;i<=len;i++){
int t=st[i]-'a';
l[i]=h[t];
... | ALGO | 0.999805 | 3.461408 |
84597f2a-d004-41c3-a1a8-7d128b2b5acd | AjayShukla1212/Data-Structures | Linked List/linked_list.cpp | #include<iostream>
using namespace std;
class Node{
public:
int data;
Node* next;
Node(int data){
this->data = data;
next = NULL;
}
};
Node* takeinput(){
int data;
cin >>data;
Node *head = NULL;
Node *tail = NULL;
while(data!= -1)
{
Node *newNode = new Node(data);
if(head==NULL... | ALGO | 0.999209 | 3.968135 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.