uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
deb6c24f-cd3f-45de-b3e8-45e7f222b6a8 | ishandutta2007/codeforces | rajat1603/normal/687/D.cpp | #include "bits/stdc++.h"
using namespace std;
const int N = 1e3 + 3;
const int M = 5e5 + 5;
int n , m , q;
pair < pair < int , int > , pair < int , int > > edges[M];
int a , b , c;
int l , r;
int idx[M];
int cur;
vector < int > v[N];
int parent[N];
int col[N];
bool rekt;
int find(int node){
if(parent[node] == node){
... | ALGO | 0.999902 | 4.114304 |
ee463d2c-e347-42f8-828f-2d0418cb253b | NekoRolly/Soluciones | Olimpiadas/OPI/2021/B_Reporte_de_tareas_100p.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll M = 2e5+1;
ll n,m;
vector<pair<int,int>> rn;
vector<pair<int,int>> ans;
int t[M];
int al,ar;
int main(){
ios_base::sync_with_stdio(0); cin.tie(0);
cin >> n >> m;
for (int i=0; i<n; i++){
int l,r; cin >> l >> r;
r... | ALGO | 0.999988 | 4.041812 |
770da2e8-7ac3-4fde-b15f-ed46484e849b | crazyplum/NLP | irstlm-5.80.06/trunk/src/mdiadapt.cpp | #include <cmath>
#include <string>
#include <assert.h>
#include "util.h"
#include "mfstream.h"
#include "mempool.h"
#include "htable.h"
#include "dictionary.h"
#include "n_gram.h"
#include "mempool.h"
#include "ngramcache.h"
#include "ngramtable.h"
#include "normcache.h"
#include "interplm.h"
#include "mdiadapt.h"
#inc... | ALGO | 0.99648 | 5.768427 |
9ba700cc-f255-41e6-9129-f09dd031d0a2 | smartinsider/cgencore | src/pow.cpp | #include "pow.h"
#include "chain.h"
#include "chainparams.h"
#include "main.h"
#include "primitives/block.h"
#include "uint256.h"
#include "util.h"
#include <math.h>
unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHeader* pblock)
{
/* current difficulty formula, cgencore - DarkGravity... | ALGO | 0.999272 | 7.081151 |
8b6bd678-4d1d-4d30-8bef-fb8e5ac37e71 | AOSP-12/bootable_recovery | otautil/rangeset.cpp | #include "otautil/rangeset.h"
#include <limits.h>
#include <stddef.h>
#include <algorithm>
#include <string>
#include <utility>
#include <vector>
#include <android-base/logging.h>
#include <android-base/parseint.h>
#include <android-base/stringprintf.h>
#include <android-base/strings.h>
RangeSet::RangeSet(std::vect... | TOOL | 0.903019 | 7.499398 |
2a7dd1e2-e819-4597-a925-b2aa30a03518 | zfa07/Killyouss | Engine/Source/ThirdParty/openexr/OpenEXR-1.7.1/ilmbase-1.0.3/Imath/ImathFun.cpp | #include "ImathFun.h"
namespace Imath {
float
succf (float f)
{
union {float f; int i;} u;
u.f = f;
if ((u.i & 0x7f800000) == 0x7f800000)
{
// Nan or infinity; don't change value.
}
else if (u.i == 0x00000000 || u.i == 0x80000000)
{
// Plus or minus zero.
u.i = 0x... | ALGO | 0.964397 | 6.87551 |
88844dc8-219d-4537-b8da-5ed8afbfebc0 | hitenSharm/LeetCode | delete-node-in-a-bst/Wrong Answer/7-31-2021, 6_40_50 PM/Solution.cpp | // https://leetcode.com/problems/delete-node-in-a-bst
/**
* 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) {}
* TreeN... | ALGO | 0.999996 | 6.380939 |
94eb0ae1-49b2-4fda-b6ba-f270e782fc35 | MaratShch/ImageLab | AFTEREFFECT_PLUGIN.DEV/ImageLabProcLib/src/algo_fft_cpu.cpp | #include "algo_fft.hpp"
void winograd_1d_fft_avx2 (const float* __restrict input, size_t input_size, float* __restrict output_real, float* __restrict output_imag, size_t output_size) noexcept
{
winograd_1d_fft (input, input_size, output_real, output_imag);
return;
}
void winograd_1d_fft_avx2 (const double* __restri... | ALGO | 0.998477 | 6.016264 |
4cc3b736-7538-4f01-9ec3-ff24906c26f9 | ThLentzas/leetcode | General/Problem_1/main.cpp | #include <iostream>
#include <vector>
#include <queue>
#include <stack>
/*
* Write a function std::vector<std::pair<int, std::string>> getTopNFiles(const std::string& filepath, int n) that
* returns the top N largest files under a given file system path.The result must be a vector of pairs, where each pair
* con... | ALGO | 0.998355 | 6.541259 |
df0afc68-c506-48fc-a551-d9533c1830eb | AXP-OS/android_external_icu | icu4c/source/common/filterednormalizer2.cpp | #include "unicode/utypes.h"
#if !UCONFIG_NO_NORMALIZATION
#include "unicode/edits.h"
#include "unicode/normalizer2.h"
#include "unicode/stringoptions.h"
#include "unicode/uniset.h"
#include "unicode/unistr.h"
#include "unicode/unorm.h"
#include "cpputils.h"
U_NAMESPACE_BEGIN
FilteredNormalizer2::~FilteredNormalizer... | TOOL | 0.924222 | 7.660444 |
cd1b0268-327c-45b4-a8df-b547172dfaa1 | trimplexx/TicTacToe | KolkoKrzyzyk/Gra.cpp | #include "Gra.h"
#include <iostream>
using namespace std;
//klasa Board
/**
* przeciążenie operatora '<<', które rysuje plansze do gry
*/
ostream& operator<< (ostream& out, const Board& point)
{
for(int i=0; i<9; i++)
{
out << " " << point.pole[i] << " ";
if((i+1) % 3) out << "|";
if ... | TOOL | 0.913335 | 4.666284 |
7659946c-1e67-4cdc-91a3-32f7f1dd2bdb | cartovarc/CompetitiveProgramming | solutions/UVA/10688 - The Poor Giant.cpp | #include <iostream>
#include <cstring>
using namespace std;
#define inf 100000000;
int n, k;
int dp[505][505];
int c(int a, int b){
if(a>b) return 0;
if(b-a==0) return 0;
if(dp[a][b]!=-1) return dp[a][b];
int minimo = inf;
for(int i=a; i<=b; i++){
int bitter = c(i+1, b);
... | ALGO | 0.999713 | 3.818604 |
7ec14756-23fb-47d0-9d07-d0bb02967883 | Dcoder10M/DSA-solved-questions | 2206-detonate-the-maximum-bombs/2206-detonate-the-maximum-bombs.cpp | class Solution {
public:
typedef long long ll;
ll dfs(ll node,vector<vector<int>> &adj,vector<ll> &vis){
vis[node]=1;
ll ans=1;
for(auto i:adj[node]){
if(!vis[i]){
ans+=dfs(i,adj,vis);
}
}return ans;
}
ll maximumDetonation(vector<ve... | ALGO | 0.999683 | 5.266516 |
832f44ab-d866-4350-9c05-8d0c5e171ce8 | sarvex/leetcode-carbon | solution/0900-0999/0935.Knight Dialer/Solution.cpp | using ll = long long;
class Solution {
public:
int knightDialer(int n) {
if (n == 1) return 10;
int mod = 1e9 + 7;
vector<ll> f(10, 1ll);
while (--n) {
vector<ll> t(10);
t[0] = f[4] + f[6];
t[1] = f[6] + f[8];
t[2] = f[7] + f[9];
... | ALGO | 0.99995 | 5.604474 |
2b58b01d-86ce-4347-b7ad-41f27882a679 | AgriyaRavindra/Atcoder | recent 194/A_ABC_Preparation.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> v... | ALGO | 0.999704 | 3.929511 |
18497564-02b0-4839-b175-f60aab9304e4 | ishandutta2007/codeforces | flashmt/normal/1586/A.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
int test;
cin >> test;
while (test--)
{
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; i++)
cin >> a[i];
auto isPrime = [&](int x)
{
for (int i = 2; i * i <= ... | ALGO | 0.999828 | 4.121958 |
4b272901-16da-4d31-8989-dace79d4b2c1 | llvm-pic/llvm-pic | llvm/lib/Transforms/IPO/LoopExtractor.cpp | #include "llvm/Transforms/IPO/LoopExtractor.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/AssumptionCache.h"
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/IR/Dominators.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/PassManager.h"
#include "llvm/InitializePasses.h"
... | TOOL | 0.987846 | 7.954693 |
43b3531b-99a9-4345-a255-774958641709 | dinhtai1104/ctdl_gt_D18 | Contest11/Contest 10-20200627T132525Z-001/Contest 10/Bai2.2.cpp | #include<bits/stdc++.h>
#define M 1000000007
#define fi first
#define se second
#define ll long long
#define pb push_back
#define ppair pair<int, int>
using namespace std;
int n, m;
bool isSafe(int v, bool graph[][15],
int path[], int pos)
{
if (graph [path[pos - 1]][ v ] == 0)
return ... | ALGO | 0.999982 | 4.875926 |
8968f1db-6dfd-4a96-af16-81d30827fc4e | ivanrafli14/CP-Archives | Angka Tebak WA.cpp | #include <bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
string ipt; cin >> ipt;
int n, tebak;
cin >> n >> tebak;
int l = 1;
int r = n;
//int mid = i + r / 2;
for(int i=1; i <= tebak; i++){
int as; cin >> as;
if((as-l) >= (r - as)){
cout << "TERLALU BESAR" << endl;
r ... | ALGO | 0.999902 | 3.686714 |
db264c6d-56b5-49c6-adfb-7bf3f5c7f6a5 | dbriceno10/ucv_ayde_1_2025 | practica5/2_eliminar_n_numeros/index.cpp | #include <iostream>
using namespace std;
class IntList
{
struct Node
{
int data;
Node *next;
Node(int d, Node *n = nullptr) : data(d), next(n) {}
};
Node *head;
Node *tail;
int size;
public:
typedef Node *tPosition;
IntList() : size(0)
{
tail = new Node(0);
head = new Node(0, ta... | ALGO | 0.999428 | 5.508394 |
92a89442-836f-4da9-a08e-b3cd8a6df53b | raincross7/code-similarity | codes/train_code/problem495/problem495_354.cpp | #include <bits/stdc++.h>
#define REP(i, n) for(long long i=0; i<n; i++)
#define REPR(i, n) for(long long i=n-1; i>=0; i--)
#define FOR(i, m, n) for(long long i=m; i<=n; i++)
#define FORR(i, m, n) for(long long i=m; i>=n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) ... | ALGO | 0.999913 | 3.889692 |
bdf971f9-030a-4dab-8fa7-f28a8d98a59b | SZUEA/EA-code-inspiration | template/rev_x.cpp | #include <bits/stdc++.h>
#define IOS \
ios::sync_with_stdio(0); \
cin.tie(0), cout.tie(0);
typedef long long ll;
#define rep(i, s, t) for (int i = (s); i <= (t); i++)
#define rep_r(i, s, t) for (int i = (s); i >= (t); i--)
#define max(a, b) (a > b ? a : b)
int gcd(int a, int b)
{
return b =... | ALGO | 0.99996 | 3.602144 |
aaee919e-88d7-4edf-8b2a-760e3041ab72 | ishandutta2007/codeforces | oleh1421/normal/1447/F1.cpp | //#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
//#define int ll
#define endl '\n'
const int N=200010;
const ll mod=998244353;
const ll inf=2000000000000000000;
int a[N];
//int cnt[N];
//int cnt1[N];
vector<int>g[N];
int pref[N];... | ALGO | 0.99987 | 4.140588 |
b19c5102-05f9-4160-b84a-53033cf94fea | ishandutta2007/codeforces | jdurie/normal/1517/A.cpp | #pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
template<class T, class S>
ostream& operator << (ostream &o, const pair<T, S> &p) {
return o << '(' << p.first << ", " << p.second << ')';
}
template<template<class, class...> cla... | ALGO | 0.999408 | 4.616862 |
df414969-1bd1-41ce-a20b-00f6cf1897ab | RashidAGP/minimap | src/systemc/tests/systemc/misc/unit/data/datawidth_bool_to_unsigned/promote_truncation/datawidth.cpp | /*****************************************************************************
datawidth.cpp --
Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
*****************************************************************************/
/**************************************************************************... | ALGO | 0.960632 | 5.742909 |
fee40064-f78e-4729-96ca-2e1c8ccb70f2 | p-north/DSA_Prep | Strings/1903_largest_odd_number_string.cpp | #include<bits/stdc++.h>
using namespace std;
// optimal solution
string largestOddNumber(string num) {
int n = num.size();
for(int i = n-1; i>=0; i--){
// check for odd
char c = num[i];
if((c - '0') % 2 != 0){
return num.substr(0, i+1);
}
... | ALGO | 0.999904 | 5.602738 |
6e77d9a1-383e-4440-8cb2-4bb20c5df2d5 | WilderStill/C-Programs | 洛谷/主题库/P3385 【模板】负环.cpp | #include<bits/stdc++.h>
#define INF 0x3f3f3f3f
#define ll long long
#define M 114514
using namespace std;
struct edge
{
int v,w,nxt;
}edge[4*M];
int hd[M],vis[M],cnt[M],tot,n,m,t;
ll ans,dis[M];
queue<int> q;
void add(int u,int v,int w)
{
edge[++tot].v=v;
edge[tot].w=w;
edge[tot].nxt=hd[u];
hd[u]=tot;
}
int main()... | ALGO | 0.999852 | 4.239419 |
9db8f2b1-912c-4b9b-a314-ee576a69af70 | SeaVegetable/Parallel-Computing | matrix_free/src/ControlPointGenerator.cpp | #include "ControlPointGenerator.hpp"
std::vector<double> ControlPointGenerator::GenerateControlPoints1D(
const BSplineBasis * const &basis,
const double &Pmax, const double &Pmin)
{
const int p = basis->GetDegree();
const std::vector<double> S = basis->GetKnotVector();
const int nFunc = static_cast... | ALGO | 0.996861 | 5.563011 |
ef501f91-79d0-49e7-bb11-01596e3f1d99 | mikeLofton/SteeringBehaviours | raygame/SeekDecision.cpp | #include "SeekDecision.h"
#include "SeekBehaviour.h"
#include "WanderBehavior.h"
#include "Agent.h"
#include "Enemy.h"
void SeekDecision::makeDecision(Agent* agent, float deltaTime)
{
SeekBehaviour* seek = agent->getComponent<SeekBehaviour>();
WanderBehavior* wander = agent->getComponent<WanderBehavior>();
Enemy* e... | ALGO | 0.952848 | 5.791965 |
a3d4a5bf-7580-48ea-8722-be895f31260b | EbubekirKurt/TicTacToe | main.cpp |
#include <iostream>
#include <string>
using namespace std;
char kare[10] = {'o', '1', '2', '3', '4', '5', '6', '7', '8', '9'};
int kontrolEt();
void tahta();
int main()
{
int oyuncu = 1, i, secim;
char isaretle;
do
{
tahta();
oyuncu = (oyuncu % 2) ? 1 : 2;
cout << "Oyuncu... | ALGO | 0.987247 | 4.681203 |
c13e8388-efae-46b4-b5d3-30a8d4e97ccc | jaimemin/programmers | 위클리 챌린지/교점에 별 만들기.cpp | #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <climits>
using namespace std;
vector<string> solution(vector<vector<int>> line) {
long long minX = LLONG_MAX, minY = LLONG_MAX;
long long maxX = LLONG_MIN, maxY = LLONG_MIN;
vector<pair<long long, long long>> coords;
int lineSi... | ALGO | 0.999828 | 4.805702 |
5e9b200f-b946-4198-875a-4fe75377fbf1 | tmusale/Coding | Array/rearrange1.cpp | /*
Rearrange positive and negative numbers in O(n) time and O(1) extra space
An array contains both positive and negative numbers in random order.
Rearrange the array elements so that positive and negative numbers are
placed alternatively. Number of positive and negative numbers need not be equal.
If there are more... | ALGO | 0.99998 | 5.535139 |
8f382afb-0ac9-45c7-aeb1-6c33499d211d | ahmedibrahim404/CompetitiveProgramming | Codeforces/427C/main.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long long ll;
const int N = 100000 + 3;
int n, tim=0, c=0;
const ll MOD = 1e9+7;
ll ans=1LL, tot=0LL;
vvi adj;
int dfn[N], lowestLink[N];
stack<int> stk;
bool inStack[N]; ll cost[N];
void tarja... | ALGO | 0.999856 | 4.182638 |
230957b8-98dd-47f1-acc5-029c83f9d428 | muschellij2/FSL6.0.0 | extras/include/boost/libs/spirit/classic/example/fundamental/functor_parser.cpp | #include <boost/spirit/include/classic_core.hpp>
#include <boost/spirit/include/classic_functor_parser.hpp>
#include <boost/spirit/include/classic_assign_actor.hpp>
#include <iostream>
#include <vector>
#include <string>
///////////////////////////////////////////////////////////////////////////////
//
// Demonstrate... | TOOL | 0.954979 | 7.249001 |
f0985838-8fd7-4e0f-93f9-cacb96133199 | TomokiMatsuno/BiaffineAutobatch | lib/tarjan.cpp | //
// Created by 松野智紀 on 2017/11/01.
//
#include "../headers.h"
class Tarjan{
private:
map<unsigned, vector<unsigned>> _edges;
set<unsigned> _vertices{0};
vector<unsigned> _indices;
vector<unsigned> _lowlinks;
vector<bool> _onstack;
vector<vector<unsigned>> _SCCs;
unsigned index = 0;
v... | ALGO | 0.999208 | 5.281353 |
d510fd37-f752-405d-a30c-74ed2c1a376b | Ujjwal2017099/leet-code | Shuffle integers - GFG/shuffle-integers.cpp | // { Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution{
public:
void shuffleArray(int arr[],int n)
{
vector<int> v;
for(int i=0;i<n/2;i++) v.push_back(arr[i]);
fun(v,arr,n,0);
for(int i=0;i<n;i++){
arr[i] = v[i];
}
... | ALGO | 0.999822 | 5.371072 |
c228aa30-9b7d-4f94-8ae8-f3abba059a20 | keruwang/TMG-SandScape | ofxLibigl/libs/igl/include/igl/boundary_loop.cpp | template <typename DerivedF, typename Index>
IGL_INLINE void igl::boundary_loop(
const Eigen::PlainObjectBase<DerivedF> & F,
std::vector<std::vector<Index> >& L)
{
using namespace std;
using namespace Eigen;
if(F.rows() == 0)
return;
VectorXd Vdummy(F.maxCoeff()+1,1);
DerivedF TT,TTi;
vector<s... | ALGO | 0.997769 | 6.131008 |
7e3f0002-abfa-4a63-a1e8-e5bfa76d39ec | wichtounet/word_spotting | src/ae_hybrid_stacked_mp.cpp | #ifndef SPOTTER_NO_AE
#include "dll/neural/conv_layer.hpp"
#include "dll/neural/dense_layer.hpp"
#include "dll/neural/deconv_layer.hpp"
#include "dll/pooling/mp_layer.hpp"
#include "dll/pooling/upsample_layer.hpp"
#include "dll/dbn.hpp"
#include "dll/trainer/stochastic_gradient_descent.hpp"
#include "dll/util/flatten.... | DATA | 0.865884 | 6.038921 |
7d44126a-5f7d-473e-80b4-86ca1353cbe2 | rib/rig | icu/source/tools/gennorm2/gennorm2.cpp | #include "unicode/utypes.h"
#include "n2builder.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "unicode/errorcode.h"
#include "unicode/localpointer.h"
#include "unicode/putil.h"
#include "unicode/uchar.h"
#include "unicode/unistr.h"
#include "charstr.h"
#include "normalizer2impl.h"
#include "to... | TOOL | 0.880839 | 5.566227 |
c516c435-3640-4bd2-a57c-302159f13725 | ishandutta2007/codeforces | alexluchianov/normal/1261/E.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using ll = long long;
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#define MAX(a, b) (((a) < (b)) ? (b) : (a))
int const nmax = 1000;
int v[1 + nmax], p[1 + nmax];
std::string sol[5 + nmax];
std::pair<int,int> bonus[1 + nmax];
int main() {
int n;
std::ci... | ALGO | 0.999992 | 3.351228 |
10e880f9-cd05-42a3-be07-27fb34bbb6b8 | iyaacs/algospot | WHITECOLLAR.cpp | #include <iostream>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <queue>
#include <limits.h>
#include <set>
using namespace std;
struct city{
vector<int> move;
int m_min;
};
city c_list[1005];
int order[1005];
bool suc[1005];
int N, M;
vector<int> mhash;
void loop(int i, int k){
for (vect... | ALGO | 0.999988 | 4.087591 |
2f950478-d171-451d-87f8-2fae95ee7ca8 | ahmad-thewhiz/data-structures | design_based/range_sum_query.cpp | // Problem Link: https://leetcode.com/problems/range-sum-query-immutable/description/
class NumArray {
private:
vector<int>prefix;
int size;
public:
NumArray(vector<int>& nums) {
size=nums.size();
if(size<1)
return;
prefix.push_back(nums[0]);
for(int i... | ALGO | 0.999896 | 6.838232 |
b53469ae-87a7-4f19-a2d9-9579009d7e24 | sgibson53/simple-flask | venv/lib/python3.6/site-packages/pystan/stan/lib/stan_math/test/unit/math/mix/mat/fun/dot_product_test.cpp | #include <stan/math/mix/mat.hpp>
#include <gtest/gtest.h>
#include <test/unit/math/rev/mat/fun/util.hpp>
TEST(AgradMixMatrixDotProduct, vector_vector_fv_1stDeriv) {
using stan::math::vector_d;
using stan::math::vector_fv;
using stan::math::fvar;
using stan::math::var;
vector_d vd_1(3), vd_2(3);
vector_fv ... | TEST | 0.900516 | 7.181798 |
f288be56-83d0-4d62-912e-26ce200e9918 | SagenHansda19/Contest | AtCoder_Beginner_Contest_393/D.cpp | #include <bits/stdc++.h>
using namespace std;
void solve() {
int n;
string s;
cin >> n >> s;
vector<int> ones;
for (int i = 0; i < n; ++i) {
if (s[i] == '1') {
ones.push_back(i);
}
}
int k = ones.size();
int m = k / 2;
long long ans = 0;
for (int i = ... | ALGO | 0.999947 | 4.595264 |
8ffaca4f-4a05-4a7d-98ac-fc82c22da657 | KoulickS/Codeforces-Solutions | 535/A.cpp | #include<bits/stdc++.h>
#include<string.h>
#define ll long long int
#define fio ios_base::sync_with_stdio(false); cin.tie(NULL);
#define MAX_LIMIT 100010
#define haha(x) x.begin(),x.end()
#define rs resize
#define remove_zero(str) str.erase(0, str.find_first_not_of('0'));
#define be begin
#define br break
const long lo... | ALGO | 0.999703 | 4.820053 |
1d9767c2-6222-4adc-8fc4-e8a7eb26d255 | qwer312132/competive-programing | dataStructure/pers_seg_tree.cpp | struct Node{
Node *l, *r;
int val;
Node(int _val):val(_val){l = r = nullptr;}
};
void pull(Node *x){x->val = x->r->val + x->l->val;}
void build(Node *&x, int l, int r){
x = new Node(0);
if(l == r){
x->val = arr[l];
return;
}
int mid = (l + r) >> 1;
build(x->l, l, mid);
... | ALGO | 0.999984 | 4.017115 |
39d5c314-424b-4628-8868-9851cf4f8b49 | lfvicent3/202202-inf112-praticas | pratica_11/Criptografia.cpp | #include "Criptografia.h"
std::string Criptografia::operator()(unsigned int m)
{
std::string mat = "";
for (int i = 3; i >= 0; i--)
{
if ((m & (1 << i)) != 0)
{
mat += "0";
}
else
{
mat += "1";
}
}
return mat;
} | ALGO | 0.999267 | 4.906149 |
a90b463c-b64a-43cb-aeaa-9504b25875c0 | Nogi-v-Ruki/Anomaly | src/xrCore/rt_lzo1x_9x.cpp | #include "stdafx.h"
#pragma hdrstop
#if !defined(LZO1X) && !defined(LZO1Y) && !defined(LZO1Z)
# define LZO1X
#endif
#if defined(LZO1X)
# include "rt_config1x.h"
#elif defined(LZO1Y)
# include "config1y.h"
#elif defined(LZO1Z)
# include "config1z.h"
#else
# error
#endif
/*****************************************... | ALGO | 0.997863 | 5.490062 |
1ec3d369-949f-4a4a-aa38-17097f4d8800 | abhipray1512/Open_CV_image_procesing | Day2/Erosion and dilation.cpp | #include "opencv2/highgui/highgui.hpp"
#include "opencv2/core/core.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include<iostream>
using namespace std;
using namespace cv;
int main(){
Mat img=imread("erosion4.png",0);
Mat b(img.rows,img.cols,CV_8UC1,Scalar(0));
Mat c(img.rows,img.cols,CV_8UC1,Scalar(0));
Mat d(img.r... | ALGO | 0.993802 | 4.017049 |
caec7d81-71a2-4695-afb0-d74abfcbba95 | RobertoTicona/Calculando-tiempo-de-ejecuci-n | Jumpsearch/Jump_search.cpp | #include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <string>
#include <stdlib.h>
#include <chrono> // Para medir el tiempo
#include <iomanip> // Para configurar precisin en los decimales
using namespace std;
// Funcin de Jump Search
int jumpSearch(int arr[], int x, int n) {
int paso = sqrt(n)... | ALGO | 0.999697 | 5.498496 |
61c9268b-0a1e-4c8b-b1b0-2e42ca5c3b83 | amineAllache/llvm-bolt19 | libc/src/math/amdgpu/frexpf.cpp | #include "src/math/frexpf.h"
#include "src/__support/common.h"
#include "declarations.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(float, frexpf, (float x, int *p)) {
return __builtin_frexpf(x, p);
}
} // namespace LIBC_NAMESPACE_DECL
| ALGO | 0.912936 | 5.120024 |
7ee22729-22d3-425e-804f-daba5a788cc1 | squaresLab/BatFix | results/transcoder/translations/py/COUNT_NUMBER_OF_WAYS_TO_COVER_A_DISTANCE_1.cpp | int printCountDP ( int dist ) {
int count [ dist + 1 ] = {
0 }
;
count [ 0 ] = 1 ;
count [ 1 ] = 1 ;
count [ 2 ] = 2 ;
for ( int i = 3 ;
i <= dist ;
i ++ ) {
count [ i ] = ( count [ i - 1 ] + count [ i - 2 ] + count [ i - 3 ] ) ;
}
;
return count [ dist ] ;
;
}
| ALGO | 0.999871 | 3.475011 |
8a14d3ed-a163-41b7-a6cb-68b10e109b9f | abdullah-amjaddd/git-hub-maintenance-profile | reversing number.cpp | #include<iostream>
using namespace std;
int main() {
int num;
cout<<"Enter a number:";
cin>>num;
int reversed=0;
while(num>0) {
int digit=num%10; //num%10 will extract the last digit
reversed=reversed*10+digit;
num/=10;//This process will remove the last digit
}
cout<<"The reversed number is:"<<reversed<<endl;
return 0... | ALGO | 0.997117 | 3.211233 |
38767823-c40a-4ab3-9c27-8b98ade4626a | sarvex/leetcode-boo | solution/1700-1799/1792.Maximum Average Pass Ratio/Solution.cpp | class Solution {
public:
double maxAverageRatio(vector<vector<int>>& classes, int extraStudents) {
priority_queue<tuple<double, int, int>> pq;
for (auto& e : classes) {
int a = e[0], b = e[1];
double x = (double) (a + 1) / (b + 1) - (double) a / b;
pq.push({x, a, ... | ALGO | 0.999737 | 5.72213 |
f8a77453-ae1b-42da-a2a5-457084fa7c43 | LumenRoses/GaiaEngine | sfml-sim/1-SFML-GRAVITY-BOX.cpp | #include <SFML/Graphics.hpp> //Llama a la librera grfica de SFML.
#include "GaiaWorld.h"
int main()
{
sf::RenderWindow window(sf::VideoMode(800, 600), "A falling box"); //Creamos una ventana con dimensiones 800x600.
window.setFramerateLimit(60);
sf::Event event; //Creamos un objeto tipo evento, llamado event.
s... | TOOL | 0.938156 | 3.818389 |
236a5da5-0abc-470f-a771-4d4f7a29bf82 | cs442app/demos | 03_nav_route/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.997789 | 6.76775 |
655e46c3-091d-4e76-8aee-fae74311aa09 | mandycs/42MalagaCore | CPPs/cpp08/ex01/Span.cpp | #include "Span.hpp"
// Constructor
Span::Span(unsigned int N) : _maxSize(N) {
_numbers.reserve(N); // Optimización: reservar memoria
}
// Constructor de copia
Span::Span(const Span& other) : _maxSize(other._maxSize), _numbers(other._numbers) {
}
// Operador de asignación
Span& Span::operator=(const Span& other) ... | ALGO | 0.983797 | 5.71663 |
cc9e3d7c-19e6-41ba-bd5e-728b3eaf4bb0 | RabbitSeries/Algorithms | Datastruct/Tree/BST_pop.cpp | #include <vector>
#include <iostream>
#include <queue>
#include <algorithm>
typedef struct bstTree {
int data;
struct bstTree* left;
struct bstTree* right;
} bstTree;
bstTree* root = NULL;
void insertNode(int val, bstTree*& r = root) {
if (!r) {
r = (bstTree*)malloc(sizeof(bstTree));
... | ALGO | 0.999977 | 5.033748 |
1aa9b0cc-f3a0-4236-8277-68ca5d49b6b3 | Ashishkumar448/GFG-Problem-of-the-day | 2025-03-March-GFG-POTD/March 21 - Stickler Thief/Solution.cpp | #include <iostream>
#include <vector>
using namespace std;
class Solution {
public:
int findMaxSum(vector<int>& arr) {
if (arr.empty()) return 0;
if (arr.size() == 1) return arr[0];
int prev2 = 0, prev1 = arr[0];
for (size_t i = 1; i < arr.size(); i++) {
... | ALGO | 0.998569 | 5.970389 |
b968a3b3-f784-4db2-8ff8-b78b68b0c17e | ashrafmoid/cp | d.cpp | #include<bits/stdc++.h>
using namespace std;
//int a[10002];
int lft[200001],rght[200001];
int h[200001];
int main(){
//set<pair<int,int> >st;
ios_base::sync_with_stdio(false);
cin.tie(NULL);
string s1,s2;cin>>s1>>s2;
memset(h,-1,sizeof(h));
memset(lft,0,sizeof(lft));
memset(rght,0,sizeof(rght));
int lo=0;
... | ALGO | 0.999913 | 3.776923 |
2bd2d9c6-47a4-4918-a35c-2af8ebe82ce2 | raincross7/code-similarity | codes/train_code/problem308/problem308_445.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
if(n==1){
cout<<1<<endl;
return 0;
}
int count=0;
for(int i=6;i>=0;i--){
if(pow(2,i)<=n){
cout<<pow(2,i)<<endl;
return 0;
}
}
} | ALGO | 0.99996 | 4.236747 |
91a95390-4ece-4904-939b-d93fd8bcf6b5 | sarvex/leetcode-g-forth | solution/1200-1299/1258.Synonymous Sentences/Solution.cpp | class UnionFind {
public:
UnionFind(int n) {
p = vector<int>(n);
size = vector<int>(n, 1);
iota(p.begin(), p.end(), 0);
}
void unite(int a, int b) {
int pa = find(a), pb = find(b);
if (pa != pb) {
if (size[pa] > size[pb]) {
p[pb] = pa;
... | ALGO | 0.999999 | 5.968808 |
6c63a276-fce2-45fb-81e6-ed3d7f0755c3 | thighburger/CPP2409 | practice/week2/auto_keyword.cpp | #include <iostream>
using namespace std;
auto add(int x ,int y)
{
return x+y;
}
int main()
{
auto sum =add(5,6);
cout<<sum;
return 0;
} | TOOL | 0.959924 | 4.216287 |
19c85214-bc32-4bf5-b5e2-fddc392e45bf | aire233/leetcode | Intermediate_algo/dp/3.cpp | class Solution {
public:
int coinChange(vector<int>& coins, int amount) {
int Max = amount + 1;
vector<int> dp(amount + 1, Max);
dp[0] = 0;
for (int i = 1; i <= amount; ++i)
for (int j = 0; j < coins.size(); ++j)
if (coins[j] <= i)
dp[i... | ALGO | 0.999953 | 5.932043 |
7ae39cd7-a680-45d2-941b-a8cbdb518f2f | honeyvikash/Leetcode_Solved_Problems | 0706-design-hashmap/0706-design-hashmap.cpp | class MyHashMap {
public:
unordered_map<int,int>m;
MyHashMap() {
m.clear();
}
void put(int key, int value) {
m[key]=value;
}
int get(int key) {
if(m.find(key)!=m.end())
{
return m[key];
}
return -1;
}
void remove(... | ALGO | 0.996136 | 6.231072 |
2c350b57-1e17-4500-8c51-67156f4bdc5f | dideler/divs | unit.cpp | #include <iostream>
#include "unit.h"
#include "board.h"
using namespace std;
unit::unit () { }
void
unit::drawUnit (int location) { }
vector<int>
unit::moves (int location, const vector< vector <board::placement> > &boardState)
{
vector<int> x;
return x;
}
vector<int>
unit::pawnMoves (int location, const vect... | ALGO | 0.991074 | 5.282869 |
aed76d58-5cb0-4c79-b7b2-c65b58ac5adc | samueltphd/SecureMemoryTutorial | src/systemc/tests/systemc/misc/v1.0/dash6/dist.cpp | /*****************************************************************************
dist.cpp -- Implementation of the odometers.
Original Author: Ali Dasdan, Synopsys, Inc.
*****************************************************************************/
/************************************************************... | ALGO | 0.995669 | 6.558409 |
f893c953-03db-46a4-a581-1542622f1c03 | 731676158/Octree | 3rdparty/pcl_for_ubuntu/tools/unary_classifier_segment.cpp | #include <pcl/io/pcd_io.h>
#include <pcl/console/print.h>
#include <pcl/console/parse.h>
#include <pcl/console/time.h>
#include <pcl/segmentation/unary_classifier.h>
using namespace pcl;
using namespace pcl::io;
using namespace pcl::console;
double default_feature_threshold = 5.0;
double default_normal_radius_search... | DATA | 0.932209 | 6.403636 |
6341953f-67c8-4ab1-946b-19adbac2fb21 | Moyu0730/CP-Question-Record | AtCoder/Beginner Contest 324/E. Joint Two Strings.cpp | /* Question : AtCoder Beginner Contest 324 - E. Joint Two Strings */
#include<bits/stdc++.h>
using namespace std;
#define opt ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define priq(type) priority_queue<type, vector<type>, greater<type>>
#define mem(x, value) memset(x, value, sizeof(x));
#define pii p... | ALGO | 0.999936 | 4.499218 |
fbf430fa-a02b-4b38-8e1e-3a82eeacaaff | lihongzheshuai/yummy-code | gesp/dad/gesp4/B3940-dad.cpp | #include <iostream>
// 定义一个足够大的二维数组用于存放魔方阵
int array[25][25];
int main() {
int n;
std::cin >> n; // 输入魔方阵的阶数n(n为奇数)
int mid = n / 2; // 计算中间列的位置
array[0][mid] = 1; // 将1放在第一行的中间位置
int num = 2; // 下一个要填入的数字
int l_n = 0, l_m = mid; // l_n, l_m分别表示上一个数字所在的行和列
int c_n, c_m; // c_n, c_m用于计算下一... | ALGO | 0.99998 | 5.49111 |
ce05484d-78fd-4d85-8395-49934b14376d | sehrish678/PF-tasks | PF-SEMESTER-1/week-6/task10.cpp | #include<iostream>
using namespace std;
bool areSame(int num1,int num2,int num3);
main()
{
int num1;
cout<<"Enter the first number: ";
cin>>num1;
int num2;
cout<<"Enter the second number: ";
cin>>num2;
int num3;
cout<<"Enter the third number: ";
cin>>num3;
bool result=areSame(nu... | ALGO | 0.99829 | 3.671207 |
92d90459-4d3d-454a-8105-8c3c72047c16 | dubshfjh/LeetCode | 198.cpp | 动态规划:设计数组dp[size+1],dp[i]存储到达第[i]天的最高盗窃金钱数:dp[i] = max(dp[i-1],dp[i-2]+nums[i-1])
在第i天有2种选择,1:第i天不盗窃, dp[i]=dp[i-1];2.第i天盗窃,dp[i] = dp[i-2]+nums[i-1]
class Solution {
public:
int rob(vector<int>& nums) {
int size,res;
size = nums.size();
int dp[size+1];
dp[0] = 0;//增加一个dummy space,用来... | ALGO | 0.999959 | 4.511032 |
caee5a18-3e07-4af6-88ef-2322e4cdf01f | Nitrosito/FP | EJERCICIOS/SESION4/5_letra_Original.cpp | #include <iostream> // Recursos de entrada/salida
#include <cmath> // Recursos matematicos
#include <cctype> // Recurso para trabajar con caracteres
using namespace std ;
int main(){
char letra_original ;
char letra_convertida;
bool es_mayuscula ;
cout << "Introduzca una letra: " ;
cin >> letra_original ... | ALGO | 0.860755 | 4.330232 |
bf94a425-ff14-4f1a-b9ba-52f373272c2d | GHScan/DailyProjects | C++/LeetCode/57_InsertInterval.cpp | #include "stdafx.h"
struct Interval {
int start;
int end;
Interval() : start(0), end(0) {}
Interval(int s, int e) : start(s), end(e) {}
};
//------------------------------
#include <algorithm>
class Solution {
public:
vector<Interval> insert(vector<Interval> &intervals, Interval newInterval) {
... | ALGO | 0.999915 | 5.809809 |
7454306e-bed1-4fda-85a9-d5a2d756de2f | CoderDream/java-architect-util | hello-algo/hello-algo-main/zh-hant/codes/cpp/chapter_dynamic_programming/climbing_stairs_dfs_mem.cpp | /**
* File: climbing_stairs_dfs_mem.cpp
* Created Time: 2023-06-30
* Author: krahets (<EMAIL>)
*/
#include "../utils/common.hpp"
/* 記憶化搜尋 */
int dfs(int i, vector<int> &mem) {
// 已知 dp[1] 和 dp[2] ,返回之
if (i == 1 || i == 2)
return i;
// 若存在記錄 dp[i] ,則直接返回之
if (mem[i] != -1)
return m... | ALGO | 0.999994 | 6.034237 |
dff1229c-dfc9-49fc-9177-9a8cc2c4afdf | rupav/cp | competitive_coding/graphs/Flow/SPOJ_MATCHING.cpp | #include<bits/stdc++.h>
using namespace std;
#define fr(i,n) for(int i=0; i<n; i++)
#define rep(i, st, en) for(int i=st; i<=en; i++)
#define repn(i, st, en) for(int i=st; i>=en; i--)
#define sq(a) (a*a)
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll mod = 1e9+7;
struct Edge{
int fr... | ALGO | 0.999599 | 4.371531 |
b65195a7-3ebf-465c-b4d4-261d26839782 | luciandinu93/CPlusPlusLearning | Chapter4/Lab4-9.cpp | /* Text manipulation find and replace */
#include <iostream>
#include <string>
int main(void)
{
int index, end_index;
std::string from;
std::getline(std::cin, from);
std::string to;
std::getline(std::cin, to);
std::string sentence;
std::getline(std::cin, sentence);
index = sentence.find(from);
if(index ==... | TOOL | 0.969564 | 4.225679 |
f986c932-8bb4-4fdd-909e-8073b0608468 | kambehmw/algorithms_cpp | AOJ/courses/ITP1/9_B.cpp | #include <iostream>
using namespace std;
int main() {
while (true) {
string s;
cin >> s;
if (s == "-") break;
int m;
cin >> m;
for (int i = 0; i < m; i++) {
int h;
cin >> h;
s = s.substr(h, s.size() - h) + s.substr(0, h);
... | ALGO | 0.993088 | 3.354977 |
838584a3-108d-4f03-83cc-062b48191a05 | pparent76/Sokoban-IA | src/CritereArretNombreIteration.cpp | #include"CritereArretNombreIteration.h"
#include <iostream>
#include <algorithm>
#include "SDL/SDL.h"
using namespace std;
CritereArretNombreIteration::CritereArretNombreIteration(int n){
nombreIteration=n; quiet=false;
}
int CritereArretNombreIteration::getNombreIteration(){
return nombreIteration;
}
CritereAr... | TOOL | 0.917074 | 3.377336 |
f9ff2559-7db9-41c8-b15a-86981d0e83b4 | Mokuroh54/Comp_Prog | Codeforces/1-500/101-200/156_D_Clues.cpp | /*
Idea: MST
Just find the number of existing components and find how many ways there are to connect them
*/
#include <iostream>
#include <map>
#include <algorithm>
using namespace std;
int N, M, K;
int p[100010];
int r[100010];
map<int, int> buckets;
int Root(int a)
{
return (p[a] == a) ? a : Root(p[a]);
}
void... | ALGO | 0.999971 | 4.304778 |
e5218a96-4838-4ea3-8973-3d2542318448 | yyz845935161/sigin_cpp | 7Jul/7.28_全排列.cpp | #include<iostream>
using namespace std;
#include<vector>
#include<algorithm>
int main()
{
vector<int> v = {3,2,7,1};
sort(v.begin(),v.end());
do
{
/* code */
for(auto e:v)
{
cout<<e<<" ";
}
cout<<endl;
} while (next_permutation(v.begin... | ALGO | 0.999877 | 4.032911 |
2fc14eaa-7eb5-4332-bb01-84d259ee51ae | shavidze/Codeforces | 160B.cpp | #include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <iostream>
#include <sstream>
#include <cassert>
#include <fstream>
#include <cstring>
#include <numeric>
#inclu... | ALGO | 0.999708 | 3.203764 |
3dc56dcd-d447-49e3-8581-b9317afd7b04 | Abhishekkkkkkkkkkk/100DaysofLearningChallange | DAY18/DSA/BookAllocation.cpp | #include <bits/stdc++.h>
using namespace std;
bool isPossible(int n, int m, int mid, int arr[]){
int studentCount = 1; // yaha pe total student 1 maan ke chal rhe hai
int pageSum = 0;
for(int i = 0; i<n; i++){
if(pageSum + arr[i] <= mid){
pageSum += arr[i];
}
else{
studentCount ++;
if(student... | ALGO | 0.999991 | 5.768329 |
af194e4f-b92a-4872-9cae-8a9a400615af | chitranshp/DSA | Recursion/KeysAndRooms.cpp | // https://leetcode.com/problems/keys-and-rooms/description/
class Solution {
public:
void dfs(vector<vector<int>> &rooms, int source, vector<bool> &visited)
{
visited[source] = 1;
for(int node : rooms[source])
{
if(!visited[node])
dfs(rooms, node, visited);
... | ALGO | 0.999927 | 6.496455 |
6d70e23a-acb5-4e08-a62d-c586b35b139a | satishsahu25/cp | Codeforces/218B.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n, m;
cin >> n >> m;
int arr[m],arr2[m];
vector<int> arr,arr2;
int maxx = 0, minn = 0;
for (int i = 0; i < m; i++)
{
int x;
cin >> x;
arr[i] = x;
arr2[i]=x;
}
for(int i=0;i<n;i++){
... | ALGO | 0.999981 | 3.68042 |
6da67836-1066-44e6-8b5f-d3bf279e933d | aishani20/Leetcode_Practice_Questions | Binary Search/287. Find the Duplicate Number.cpp | class Solution {
public:
int findDuplicate(vector<int>& nums) {
sort(nums.begin(),nums.end());
for(int i=0;i<nums.size()-1;i++){
if(nums[i]==nums[i+1]){
return nums[i];
}
}
return -1;
}
}; | ALGO | 0.999976 | 5.671831 |
8f79e81d-9033-473d-b7c3-5d5e3e677d95 | Yash777g/DSA | dsa/rotate_matrix.cpp | #include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
void rotate(vector<vector<int>>& matrix) {
int row = matrix.size(), col = matrix[0].size();
for(int i = 0; i < row; i++) {
for(int j = i; j < col; j++) { swap(matrix[i][j], matrix[j][i]); }
}
for(int... | ALGO | 0.99998 | 5.481295 |
3ce898ef-3417-409f-b9b8-fe64647d1f11 | Ytr00m/comp-programming | src/OBI/2025/PS-F1/fila.cpp | #include <bits/stdc++.h>
int alunos[100000];
using namespace std;
int main() {
int N; cin >> N;
for (int i=0;i<N;i++) cin >> alunos[i];
int max_a = alunos[N-1];
int cont = 0;
for (int i=N-2;i>=0;i--) {
if (alunos[i] <= max_a) cont++;
max_a = max(max_a, alunos[i]);
}
cout << cont << endl;
}
| ALGO | 0.999552 | 3.85414 |
4ad75b63-ff1b-4e98-9293-0f106598a475 | sinian666/code_102_8 | cpp_副本38/chapter_array_and_linkedlist/list.cpp | /**
* File: list.cpp
* Created Time: 2022-11-25
* Author: Krahets (<EMAIL>)
*/
#include "../utils/common.hpp"
/* Driver Code */
int main() {
/* 初始化列表 */
vector<int> list = {1, 3, 2, 5, 4};
cout << "列表 list = ";
printVector(list);
/* 访问元素 */
int num = list[1];
cout << "访问索引 1 处的元素,得到 n... | ALGO | 0.948319 | 5.023399 |
19faddb6-1ed3-440a-aa5f-b1e36fae7420 | Xushi8/Code | 2023/2023_September/ABC 257/f.cpp | // 2023/11/05 14:36:42
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <cstring>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
constexpr int N = 1000005;
vector<int> G[N];
int dis[2][N];
bool inqueue[N];
vector<int> no_sure;
void bfs(int k, int s)
{
q... | ALGO | 0.999909 | 4.677388 |
38797aff-1c0c-4706-a8c9-bcde6b0d6a37 | indrajeeet223/cpp-codes | queues/reverseusingvector.cpp | // queue using vector reverse
#include<iostream>
#include<vector>
#include<queue>
using namespace std;
void print(queue<int>&v)
{
for(int i=1;i<=v.size();i++)
{
int x=v.front();
cout<<x<<" ";
v.pop();
v.push(x);
}
}
void display(queue<int>&v)
{
vector<int>z;
while(v.s... | ALGO | 0.999389 | 4.499296 |
37c176e4-3ff1-4063-a779-d86d3af21461 | shreyash-Pandey-Katni/placementPractice | array/math/trailingZeroesInFactorial.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int trailingZeroes(int N)
{
if(N<0){
return -1;
}
int count=0;
for(int i=5;N/i>0;i*=5){
count+=N/i;
}
return count;
}
int main(int argc, char const *argv[])
{
int N;
cout << "Enter the number:... | ALGO | 0.999921 | 6.286204 |
44a3900e-764f-4852-a29d-55803110a90e | dixit-shubham-404/Data-Structure-Implementation | calculate_expression_tree.cpp | //Calculate the value of expresion tree
int evalTree(node* root) {
// Your code here
string s1="+",s2="-",s3="*",s4="/";
if(!root->data.compare(s1))
{
int left=evalTree(root->left);
int right=evalTree(root->right);
return left+right;
}
else if(!root-... | ALGO | 0.999735 | 4.417273 |
8a38ef68-ab69-4bad-836b-3c4667f35654 | yashikaBhandari/leetcode-with-me | 8-String-to-Integer-(atoi).cpp | /*class Solution {
public:
int myAtoi(string s) {
if(s.length()==0)
return 0;
int i=0;
// start traversing the string
while(i<s.size()&& s[i]==' '){
i++;
}
s=s.substr(i);
int sign=+1;
long ans=0;
if(s[0]=='-'){
... | ALGO | 0.999671 | 5.416323 |
ca441120-bdce-42c3-ba88-38d0d68e6496 | yamaarash1/AtCoder | src/problemC/215/main.cpp | #include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <cmath>
#include <limits>
#include <map>
#include <vector>
#include <set>
#include <iomanip>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
#define I_MAX 2147483647;
#... | ALGO | 0.999946 | 3.809454 |
f0d4bb8a-1a14-4eaa-bf21-5e0e781ac306 | account-deactivated1/LeetCode | 748-largest-number-at-least-twice-of-others/largest-number-at-least-twice-of-others.cpp | class Solution {
public:
int dominantIndex(vector<int>& nums);
};
int Solution::dominantIndex(vector<int>& nums) {
int max=INT_MIN, maxIndex, size = nums.size();
for ( int i = 0; i < size; ++i) {
if (nums[i] > max) {
max = nums[i];
maxIndex = i;
}
}
for ( int... | ALGO | 0.999977 | 5.888688 |
97f8e52d-f43f-4586-aa67-776d4e791b4d | pepper-project/pepper | pepper/apps_sfdl_hw/boyer_occur_merkle_p_exo.cpp | #include <apps_sfdl_hw/boyer_occur_merkle_p_exo.h>
#include <apps_sfdl_gen/boyer_occur_merkle_cons.h>
#include <common/sha1.h>
#include <storage/configurable_block_store.h>
#pragma pack(push)
#pragma pack(1)
//This file will NOT be overwritten by the code generator, if it already
//exists. make clean will also not re... | ALGO | 0.99497 | 4.304492 |
ca34de26-0588-40c6-98c9-c7b7b093c63b | karunsehwag/leetcode_daily | 0105-construct-binary-tree-from-preorder-and-inorder-traversal/0105-construct-binary-tree-from-preorder-and-inorder-traversal.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.999982 | 6.390902 |
8468cd18-a447-4bc2-90cb-2b7cb2aa444d | JosephSmarsh/Vatim-Data-Saver | virtualenv/Lib/site-packages/basemap-1.1.0/geos-3.3.3/src/linearref/LocationIndexOfPoint.cpp | #include <geos/geom/LineSegment.h>
#include <geos/linearref/LinearIterator.h>
#include <geos/linearref/LinearLocation.h>
#include <geos/linearref/LocationIndexOfPoint.h>
#include <geos/util/IllegalArgumentException.h>
#include <cassert>
#include <limits>
using namespace std;
using namespace geos::geom;
namespace ge... | ALGO | 0.997948 | 5.876191 |
9351d13d-ae02-4e12-9a09-54b6e74249ba | purvasingh96/My-Leetcode-Solutions | 1610-maximum-number-of-visible-points/1610-maximum-number-of-visible-points.cpp | const double pi = M_PI;
class Solution {
private:
double slope(vector<int>& point, vector<int>& location){
int x = point[0] - location[0];
int y = point[1] - location[1];
double angle = atan2(y, x) * (180 / pi);
//cout<<angle<<"\n";
if(angle<0) angle += 360;
... | ALGO | 0.999982 | 5.163594 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.