uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
9e046905-9a27-4827-826d-80fc3085c193 | willing827/lyCommon | include/sqthird/Raknet/cat/src/math/rtl/addsub/Double.cpp | #include <cat/math/BigRTL.hpp>
using namespace cat;
u8 CAT_FASTCALL BigRTL::Double(const Leg *in, Leg *out)
{
// Double low leg first
Leg last = in[0];
out[0] = last << 1;
// Shift up the rest by 1 bit; actually pretty fast this way!
for (int ii = 1; ii < library_legs; ++ii)
{
Leg next... | ALGO | 0.870752 | 5.009792 |
d6967a73-b905-4168-9e1d-d18b7411ea4b | leexsh/LeetCode | 04_CodeInterview/53_1_nque.cpp | #include <iostream>
#include <vector>
#include "map"
using namespace std;
//
// Created by leexsh on 2020/7/12.
//
class Solution {
public:
int missingNumber(vector<int>& nums) {
int sum = 0;
int n = nums.size();
for (int i = 0; i < nums.size(); i++) {
sum += nums[i];
}
... | ALGO | 0.999712 | 4.534277 |
d17bbb3b-2ac7-4f36-a7ae-1fb22cb47f9a | mahirjhajharia/LeetCode_Daily_Challenge | March 2023/2444. Count Subarrays With Fixed Bounds.cpp | // 2444. Count Subarrays With Fixed Bounds
// Problem Link - https://leetcode.com/problems/count-subarrays-with-fixed-bounds/
class Solution {
public:
long long countSubarrays(vector<int>& nums, int minK, int maxK){
long long answer=0;
int lastInvalidIdx=-1;
int minNumIdx=-1;
int ma... | ALGO | 0.999719 | 5.596802 |
acc96684-41ae-4289-88bd-72a1ee5824d9 | Siddhesh672004/DSA | Learn the Basics/Basic Recusion/Best-Time-to-Buy-and-Sell-Stocks-leetcode(recursion).cpp | class Solution {
public:
void findMaxProfit(vector<int>& prices, int i, int& minPrice, int& maxProfit){
//base case
if(i == prices.size()){
return;
}
//One case solve
if(minPrice > prices[i]){
minPr... | ALGO | 0.99794 | 6.182189 |
a851c290-553f-47fc-bf83-b4ad2c8053be | krishna1912/DSA_program | quickSort.cpp | // THIS IS THE IMPLEMENTATION OF QUICKSORT ALGORITM IN C++
#include <iostream>
#include <vector>
using namespace std;
// basic swap function
void swap(int *a, int *b)
{
int temp = *a;
*a = *b;
*b = temp;
}
// This function takes the last ('end') array element as pivot and rearranges the array such that
... | ALGO | 0.999988 | 5.529952 |
f9b2f601-3b31-4398-b91d-67acbd56a0d0 | Dchengg/Progra_1_Datos_Bena | Ordenamientos.cpp | #include "ListaSimple.cpp"
#include "ListaDoble.cpp"
#include <vector>
template<class T>
ListaDoble<T*>* insertion(T* TDA) {
ListaDoble<T*>* pasos = new ListaDoble<T*>();
if(!TDA->primero || !TDA->primero->getSiguiente()) {
return pasos;
}
Nodo<typename T::type>* t1 = TDA->primero->getSiguiente(... | ALGO | 0.999748 | 4.101052 |
596cf722-485d-46f5-8b8f-008141f8fbfa | kennet0/JUCEPractice | JUCE_old/modules/juce_box2d/box2d/Dynamics/b2WorldCallbacks.cpp | #include "b2WorldCallbacks.h"
#include "b2Fixture.h"
// Return true if contact calculations should be performed between these two shapes.
// If you implement your own collision filter you may want to build from this implementation.
bool b2ContactFilter::ShouldCollide(b2Fixture* fixtureA, b2Fixture* fixtureB)
{
const ... | TOOL | 0.899948 | 7.109838 |
8d9603be-f151-40c2-8ca6-f5f7972ce9bb | ravi956/pepcoding-level1-in-cpp | Recursion and Backtracking/05_introduction_to_recursion/08_tower_of_hanoi.cpp | #include <bits/stdc++.h>
using namespace std;
void toh(int n, int t1id, int t2id, int t3id)
{
if (n == 0)
{
return;
}
toh(n - 1, t1id, t3id, t2id);
cout << n << "[" << t1id << " -> " << t2id << "]" << endl;
toh(n - 1, t3id, t2id, t1id);
}
void solve()
{
int n, n1, n2, n3;
cin >... | ALGO | 0.999724 | 4.580011 |
672a463e-b666-4d47-a3a8-560499fe35e0 | meldaw84/The-offecial-GROMACS-molecular-simulation-toolkit_2023.2 | src/gromacs/utility/datafilefinder.cpp | /*! \internal \file
* \brief
* Implements gmx::DataFileFinder.
*
* \author Teemu Murtola <<EMAIL>>
* \ingroup module_utility
*/
#include "gmxpre.h"
#include "datafilefinder.h"
#include <cstdlib>
#include <set>
#include <string>
#include <vector>
#include "buildinfo.h"
#include "gromacs/utility/directoryenumer... | TOOL | 0.962546 | 6.324634 |
278c7fe2-89d9-4f02-ae31-5b2ae2ae1407 | SWEG-2015EC-Batch/Felix | ETS1065_15_Natnael_Samson/Activity_3.1/Playing_with_numbers/playing_with_numbers.cpp | #include <iostream>
#include <cmath>
using namespace std;
int main() {
int choice, num;
cout << "Enter an integer: ";
cin >> num;
cout << "Menu:\n";
cout << "1. Reverse of the number\n";
cout << "2. Count number of digits\n";
cout << "3. Sum of digits\n";
cout << "4. Product of even d... | ALGO | 0.996811 | 4.629897 |
607ccef1-86ea-4efb-9ef7-d2761ce29d2e | rishab95/Data-Structures-and-Algorithms | Search/linear.cpp | #include <iostream>
using namespace std;
void linearSearch(int ar[], int n, int e)
{
for(int i=0;i<n;i++)
{
if(ar[i] == e)
cout<<e;
}
}
int main()
{
int arr[] = {1,2,3,4,5};
int as = sizeof(arr)/sizeof(arr[0]);
linearSearch(arr, as, 0);
return 0;
} | ALGO | 0.996125 | 3.672928 |
893fc9fe-c4c9-487f-a32d-9decab539d58 | KeerthanaPravallika/DSA | Strings/RemoveAllAdjDuplicates.cpp | /*
Given a string s, remove all its adjacent duplicate characters recursively.
Example 1:
Input:
S = "geeksforgeek"
Output: "gksforgk"
Explanation:
g(ee)ksforg(ee)k -> gksforgk
*/
class Solution{
public:
string remove(string s){
// code here
int last = 0,flag = 0,i,j , l=0,r=0;
... | ALGO | 0.999986 | 5.848468 |
ec96aaf8-9f00-4420-b862-eec1da2ffebb | neamul-haq/XPSC_DailyCodes | week3/Day5(20.6.23)/A_A_B.cpp | /*
Neamul Haq
University of Barisal
*/
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define ndl '\n';
#define cyes cout << "YES" << '\n';
#define cno cout << "NO" << '\n';
#define print cout << ans << '\n';
#define umap unordered_map<ll,ll>m;
#define map map<ll,ll>m;
int const mod = 1e9+7;
co... | ALGO | 0.999813 | 4.03915 |
bd396aba-1c95-407b-a3bd-069082f929e0 | lasya-rajan/FractalProject | src/FractalProjectApp.cpp | #include "cinder/app/App.h"
#include "cinder/app/RendererGl.h"
#include "cinder/gl/gl.h"
#include "cinder/Camera.h"
#include "cinder/params/Params.h"
#include "cinder/Easing.h"
#include "cinder/Rand.h"
#include "cinder/ImageIo.h"
#include <vector>
#include "Resources.h"
using namespace ci;
using namespace ci::app;
us... | TOOL | 0.960773 | 6.288 |
6b93c4be-d104-4418-8d12-8efd27a56d16 | aarafiit/leetcode | 3075-maximize-happiness-of-selected-children/3075-maximize-happiness-of-selected-children.cpp | class Solution {
public:
long long maximumHappinessSum(vector<int>& happiness, int k) {
sort(happiness.begin(),happiness.end(),greater<int>());
long long sum = 0;
long long j = 0;
for(int i = 0;i<k;i++){
if((happiness[i] - j) < 0 ) continue;
... | ALGO | 0.999992 | 5.466825 |
4161dcb3-eb44-4890-a5a7-d0a8e74be010 | ishandutta2007/codeforces | wlzhouzhuan/normal/171/A.cpp | // Author: wlzhouzhuan
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define rint register int
#define rep(i, l, r) for (rint i = l; i <= r; i++)
#define per(i, l, r) for (rint i = l; i >= r; i--)
#define mset(s, _) me... | ALGO | 0.999775 | 3.701508 |
dd7d92d2-764b-42b5-938c-64d09e3d3ca2 | armando1530343/Portafolio-Academico | 1. Ingeniería en tecnologías de la información/Estructura de datos (c++)/PilaLineal/Pila.cpp | #include "Pila.h"
#include <string.h>
using namespace std;
Pila::Pila(){
pila = NULL;
tope = NULL;
elementos = 0;
}
Pila::~Pila(){}
void Pila::apilar(int valor){
if(elementos == 0){
//si no hay elementos se inicializa el apuntador de la pila
pila = new _Pila();
pila->valor = valor;
//se asigna el valor ... | ALGO | 0.939028 | 4.558434 |
7fd9fb44-37e0-4ed9-ac28-2fdac1215791 | unofficial-ladybird-test/ladybird-bin | Libraries/LibCore/Process.cpp | #include <AK/ByteString.h>
#include <AK/ScopeGuard.h>
#include <AK/String.h>
#include <AK/Vector.h>
#include <LibCore/Environment.h>
#include <LibCore/File.h>
#include <LibCore/Process.h>
#include <LibCore/System.h>
#include <errno.h>
#include <signal.h>
#include <spawn.h>
#include <unistd.h>
extern "C" {
# include... | TOOL | 0.946354 | 7.79198 |
95fce4f4-6f17-4921-b846-9bdc4acea850 | SteamDB2/CSGO-Old2018- | studiorender/r_studiolight.cpp | #include "r_studiolight.h"
#include "studiorender.h"
#include "studiorendercontext.h"
#include "studio.h"
#include "materialsystem/imaterialsystemhardwareconfig.h"
#include "mathlib/vector.h"
#include "mathlib/mathlib.h"
#include <float.h>
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/mem... | TOOL | 0.930767 | 5.905922 |
a27f192e-bc80-44c6-ad54-6d25437bc494 | Rajanarender/CAndCPPCompleteSubject | candcpp/study/Manipulations/StringasSentenceQuestions/Easy/PrintSubstringtillNULLandSpaceForGivenCharacterInSentence.cpp | #include<stdio.h>
#include<string.h>
//Print the substring till space[i.e.,complete word],substring starts with specified character
void func(char *x,int n,char *y)
{
while(*x)
{
if(*x==n) //primary check of character
{
char *temp = x; //Should no... | ALGO | 0.999042 | 3.017844 |
e77be043-c076-4987-9408-acf29f31b260 | anipnwr7777/my-cp-template | flood_fill.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
ll gcd(ll a, ll b)
{
if(b==0) return a;
return gcd(b,a%b);
}
ll lcm(ll a, ll b)
{
return a*b/gcd(a,b);
}
void floodfill(vector<vector<ll>> &v, ll x, ll y, ll old, ll newc, ll m , ll n){
if(x<0 || x>n-1 || y<0 |... | ALGO | 0.997691 | 3.499808 |
72f5d370-fbb8-42d6-9b2b-86a37b70d950 | 567yash/cryptography | 29.C program for SHA-3 option with a block size of 1024 bits.cpp | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <stdint.h>
#define STATE_SIZE 25
#define CAPACITY_LANES 16
#define LANE_SIZE 64
typedef struct {
uint64_t state[STATE_SIZE];
} InternalState;
void initializeState(InternalState *state)
{
for (int i = 0; i < STATE_SIZE; i++)
{
state->st... | ALGO | 0.999402 | 4.132937 |
0209f19d-c7dc-4024-b0fb-be560f6435da | BerntA/BrainBread2 | mathlib/quantize.cpp | #ifndef STRING_H
#include <string.h>
#endif
#ifndef QUANTIZE_H
#include <quantize.h>
#endif
#include <stdlib.h>
#include <minmax.h>
#include <math.h>
static int current_ndims;
static struct QuantizedValue *current_root;
static int current_ssize;
static uint8 *current_weights;
double SquaredError;
#define SPLIT_T... | ALGO | 0.999629 | 4.597368 |
8e516f2d-1b38-4983-bf6e-c51a4eaded4c | thecreatorsir/striver-DSA-sheet-solutions | K-th largest element in an unsorted array.cpp | class Solution {
public:
int findKthLargest(vector<int>& nums, int k) {
priority_queue <int,vector<int>,greater<int>> pq;
for(int i=0;i<nums.size();i++){
if(i<k){
pq.push(nums[i]);
}else{
if(nums[i]>pq.top()){
pq.pop();
... | ALGO | 0.999985 | 5.197307 |
eb4fa403-0e31-43fb-ac89-ea2a333221ea | as468579/Leetcode | cplusplus/medium/DesignAddAndSearchWordsDataStructure.cpp |
const int ALPHABET_SIZE = 26;
struct TrieNode{
public:
bool isWord;
TrieNode *next[ALPHABET_SIZE];
// Constructor
TrieNode(): isWord(false){
for(int i=0; i<ALPHABET_SIZE; ++i){
next[i] = nullptr;
}
}
// Destructor
~TrieNode(){
}
};
class Trie{
public:
... | ALGO | 0.9991 | 5.711747 |
39d0a625-26f1-4361-8aa2-fb617f843a85 | TINABJan254/DSA_CodePTIT | DuyetDoThi/DSA09013_LietKeCanhCau.cpp | #include <bits/stdc++.h>
using namespace std;
#define EL "\n"
#define ll long long
#define fi first
#define se second
#define sz size()
#define pb push_back
#define vi vector<int>
#define vii vector<vector<int>>
#define faster() ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#define pii pair<i... | ALGO | 0.999973 | 4.319158 |
d590a101-08e7-40fe-9f1a-22d23e56d431 | HenriquePCR/Algorithm_exercises | miniMaratona/algebra/dividir.cpp | #include <bits/stdc++.h>
using namespace std;
#define _ \
ios_base::sync_with_stdio(0); \
cin.tie(0);
#define endl '\n'
#define f first
#define s second
#define dbg(x) cout << #x << " = " << x << end
typedef long long ll;
const int INF = 0x3f3f3f3f;
const ll LINF = 0X3f3f3f3f3f3f3f3f... | ALGO | 0.99934 | 3.51995 |
71489af9-0792-4121-b416-f46c40481740 | pawan0777/Binary-Trees | width_of_bt.cpp | #include<bits/stdc++.h>
using namespace std;
class Node{
public:
int val;
Node* right;
Node* left;
Node(int data){
val = data;
right = NULL;
left = NULL;
}
};
int widthOfBT(Node* root){
queue<pair<Node*, int>> q;
int ans = 0;
q.push({root, 0});
while(!q... | ALGO | 0.999865 | 5.095537 |
80b9dbe1-77cb-49ec-b1ee-4ce5f520a08d | cosmin-andrei/DunareaHighschool-Work | BACALAUREAT/2017/MODEL 2017 - SIII.4/main.cpp | #include <iostream>
using namespace std;
int main()
{
int x,y;
cin>>x>>y;
while(y>=x)
{
cout<<y<<" ";
if(y%2!=0)
y=y/2+1;
else y=y-1;
}
return 0;
}
| ALGO | 0.999918 | 3.66645 |
cc46be66-8bf1-4201-ad57-c9806ff65456 | SiyangShao/codes | codeforces/2022/VP/R745/B.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll N = 105;
ll n, m, k, P;
array<ll, N> fac;
array<array<ll, N>, N> c;
array<array<array<ll, N>, N>, N> dp;
auto main() -> int {
ios::sync_with_stdio(false);
cin.tie(nullptr), cout.tie(nullptr);
cin >> n >> m >> k >> P;
m--;
... | ALGO | 0.999946 | 4.122856 |
ef4bae02-3501-4874-9657-b16b53462647 | rahaan-sharif/data_structure_-faradars-shirafcan- | writing_a_stack_with_classes/writing_a_stack_with_classes.cpp | #include <iostream>
using namespace std;
class stack
{
private:
int* data, top, capacity;
public:
stack(int ent = 0) : capacity(ent)
{
data = new int[capacity];
top = 0;
}
void add(int item)
{
if (top < capacity)
data[top++] = item;
else
cout << "FULL\n";
}
int get()
{
if (top == 0)
{
co... | ALGO | 0.999042 | 4.300838 |
8c4f86d4-62ce-4388-9feb-6dd1b5c75cfc | LifeSucksDude/StriverSheetSolution | RecursionRevision/combinationSum2.cpp | #include<vector>
#include<string>
#include<map>
using namespace std;
class Solution {
public:
void subSequence(int i,vector<int> &ds,vector<vector<int>> &ans,int target,int s,int n,vector<int> &candidates){
if(target==0){
ans.push_back(ds);
return;
}
for(int k=i; k<n; k+... | ALGO | 0.999956 | 5.919639 |
8a64522e-1484-45a5-bdef-a913490d2658 | pranavajith/CP-Practice | A_Superhero_Transformation.cpp | #include <bits/stdc++.h>
#include <iostream>
#include <set>
#include <cmath>
#include <map>
#include <sstream>
#include <deque>
#include <queue>
#include <stack>
#include <algorithm>
#include <limits>
#include <iomanip>
using namespace std;
#define ll long long
ll mod = 1e9 + 7;
// #define TxtIO freopen("input.txt","... | ALGO | 0.999977 | 4.155674 |
b99b5d43-70ae-4be3-8ff8-178fb98dd7ae | pavi-rajes/Assistive-sensory-motor-perturbations-influence-learned-neural-representations | model/params/bci-model-clda1/copy_FNN.cpp | /**
* FFN.cpp | bmi_model
*/
#include "FFN.hpp"
#include "rand_mat.hpp"
#include <fstream>
#include "TwoLayerFFN.hpp"
FFN::FFN(std::vector<unsigned int> topology, ActivationType phi) : phi(phi){
//input -> W0 -> h[0] -> W[1] -> h[1] -> ... W[L-1] -> h[L-1] -> W[L] -> output
input_type = DataGenerator::unspe... | ALGO | 0.99819 | 6.346169 |
c9ba5593-2364-4283-86bc-4bd1b865208d | Team302/2023ChargedUp | src/main/cpp/mechanisms/arm/ArmHoldPosHelper.cpp | // Team 302 Includes
#include <mechanisms/arm/ArmHoldPosHelper.h>
#include <mechanisms/intake/IntakeStateMgr.h>
/// DEBUGGING
#include <utils/logging/Logger.h>
ArmHoldPosHelper::ArmHoldPosHelper()
{
}
double ArmHoldPosHelper::CalculateHoldPositionTarget(double armAngle,
... | TOOL | 0.979822 | 6.072367 |
a73b0031-2652-470c-80b0-bd6cbaf4f3a9 | dimforex1/PX4-PX4-Autopilot | src/modules/control_allocator/ActuatorEffectiveness/ActuatorEffectivenessHelicopterCoaxial.cpp | #include "ActuatorEffectivenessHelicopterCoaxial.hpp"
#include <lib/mathlib/mathlib.h>
using namespace matrix;
using namespace time_literals;
ActuatorEffectivenessHelicopterCoaxial::ActuatorEffectivenessHelicopterCoaxial(ModuleParams *parent)
: ModuleParams(parent)
{
for (int i = 0; i < NUM_SWASH_PLATE_SERVOS_MAX; ... | ALGO | 0.916984 | 6.487693 |
bc41f59e-3cc4-4a31-80be-b67392b105fb | ebisenttt/atcoder | abc087/b/main.cpp | #include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define INF 1e9
typedef long long ll;
t... | ALGO | 0.99966 | 4.126945 |
2ae1c454-fa73-4913-885c-07ca2fbdd216 | zilixie/Ray-Tracer-TBB | ext/eigen/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_maxnorm.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main()
{
MatrixXf mat(2,4);
mat << 1, 2, 6, 9,
3, 1, 7, 2;
MatrixXf::Index maxIndex;
float maxNorm = mat.colwise().sum().maxCoeff(&maxIndex);
std::cout << "Maximum sum at position " << maxIndex << std:... | ALGO | 0.999907 | 4.220459 |
c99bea80-a442-4811-b658-efac2c92e9d6 | saiarcot895/gt-bus-locations | geos/src/geomgraph/EdgeEndStar.cpp | #include <geos/util/TopologyException.h>
#include <geos/geomgraph/EdgeEndStar.h>
#include <geos/algorithm/locate/SimplePointInAreaLocator.h>
#include <geos/geom/Location.h>
#include <geos/geomgraph/Label.h>
#include <geos/geomgraph/Position.h>
#include <geos/geomgraph/GeometryGraph.h>
#include <cassert>
#include <stri... | TOOL | 0.996072 | 7.50977 |
ae61cbaf-cccc-46bd-aff0-9e057d1f99a3 | adarista012/faceRecognoitionPython | opencv-master/modules/dnn/src/tensorflow/tf_importer.cpp | /*
Implementation of Tensorflow models parser
*/
#include "../precomp.hpp"
#ifdef HAVE_PROTOBUF
#include "tf_io.hpp"
#include <iostream>
#include <fstream>
#include <algorithm>
#include <string>
#include <queue>
#include "tf_graph_simplifier.hpp"
#endif
namespace cv {
namespace dnn {
CV__DNN_INLINE_NS_BEGIN
#if HA... | TOOL | 0.923848 | 6.897677 |
25b9a2d9-544b-40d5-be35-1496ada3dfb0 | Belgorodsky/MultithreadingC_Cpp | 8_ParallelCoding/mergesortTBB.cpp | #include <iostream>
#include <cstdlib>
#include <fstream>
#include <algorithm>
#include <iterator>
#include <memory>
#include <tbb/tbb.h>
void parse_space_separated_tokens(const std::string &src_filename, tbb::concurrent_vector<int64_t>& result)
{
std::ifstream f(src_filename, std::ios::binary);
tbb::c... | ALGO | 0.998926 | 5.496029 |
c8bf9db5-ed64-43be-b50f-33e8e6a4f4e4 | Fork-PixelExperience/frameworks_av | media/libheadtracking/PosePredictor.cpp | #include "PosePredictor.h"
namespace android::media {
namespace {
#ifdef ENABLE_VERIFICATION
constexpr bool kEnableVerification = true;
constexpr std::array<int, 3> kLookAheadMs{ 50, 100, 200 };
#else
constexpr bool kEnableVerification = false;
constexpr std::array<int, 0> kLookAheadMs{};
#endif
} // namespace
void... | ALGO | 0.89582 | 7.446632 |
b5128cf9-c326-4dba-b4e8-44e858f2ab02 | tiger0132/code-backup | Codeforces/1000~1999/1300/A.cpp | #include <algorithm>
#include <cstdio>
#include <cstring>
int n, x, s, zc;
int main() {
for (scanf("%*d"); ~scanf("%d", &n);) {
s = zc = 0;
while (n--) {
scanf("%d", &x);
s += x;
zc += !x;
}
if (!zc)
puts(s ? "0" : "1");
else
printf("%d\n", zc + !(s + zc));
}
} | ALGO | 0.999205 | 3.695291 |
e4daa6c3-43dd-4bef-848f-8bfc361861d4 | Toufik-Islam/XPSC_Phitron | Week 9/Day 4/B_Different_is_Good.cpp | /*\~~~~~~~~~~~~~~~~~\
\ TOUFIK \
\ ISLAM \
\~~~~~~~~~~~~~~~~~\*/
#include <bits/stdc++.h>
using namespace std;
const int N = (int)1e6 + 5;
const int M = (int)1e9 + 5;
const int md = (int)1e9 + 7;
#define ll long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
... | ALGO | 0.999866 | 4.147161 |
a18e96bf-45c9-4907-936b-7f963b251d47 | salvador-murillo/Fundamentos-Programacion | 6.Ciclos-WHILE/37.Numeros-v3/main.cpp | /*FUNDAMENTOS DE PROGRAMACION
Practica 37 - Numeros V3
Salvador Murillo Arias
*/
#include <iostream>
using namespace std;
int main() {
int salir;
do {
int divisor = 10000, conPar = 0, conImp = 0;
int numUser, numAlt, mult, digito;
cout << "\033[2J\033[0;0H";
cout << "Ingresa un numero entero de 5 digitos... | ALGO | 0.979626 | 3.671071 |
6e7e680c-04cb-424d-a373-038d1be27c73 | yanlinlin82/leetcode | 00087_scramble-string/200128-4.cpp | // https://leetcode-cn.com/problems/scramble-string/
// 第四次尝试:挑战失败,超出时间限制
#include <cstdio>
#include <string>
#include <vector>
#include <unordered_map>
using namespace std;
class Solution {
public:
bool isScramble(string s1, string s2) {
//printf("'%s', '%s'\n", s1.c_str(), s2.c_str());
int n = s1.size(), n2 = s... | ALGO | 0.999957 | 5.304329 |
b0a45988-0db6-4a97-ba7f-391f5be71f25 | luanaamorim04/competitive_programming | tutoria-lgm/semestre1/aula6-dsu/bosses.cpp | #include <iostream>
#define MAXN (int) (3e5 + 10)
#define ii pair<int, int>
using namespace std;
int n, m, op, a, b, tam[MAXN], pai[MAXN], dist[MAXN];
ii find(int x)
{
if (x == pai[x]) return {x, dist[x]};
ii tmp = find(pai[x]);
pai[x] = tmp.first;
dist[x] += tmp.second;
return {pai[x], dist[x]};
}
void join... | ALGO | 0.999855 | 4.591226 |
0cf0e9bf-2bcf-4b59-8d34-10441edf96a3 | gsovereignty/rewritetest | src/pubkey.cpp | #include <pubkey.h>
#include <hash.h>
#include <secp256k1.h>
#include <secp256k1_extrakeys.h>
#include <secp256k1_recovery.h>
#include <secp256k1_schnorrsig.h>
#include <span.h>
#include <uint256.h>
#include <algorithm>
#include <cassert>
namespace
{
/* Global secp256k1_context object used for verification. */
secp2... | TOOL | 0.959546 | 7.45326 |
02de3360-0137-46b5-8f64-54a71199b618 | BHOJANE-VARUN/MyVscode | cp/Contests/contest109/fourth.cpp | #include<bits/stdc++.h>
using namespace std;
void inputarrInt(int *arr,int n)
{ int temp;
for(int i =0;i<n;i++)
{
cin>>temp;
arr[i] = temp;
}
}
int main()
{
int t;
cin>>t;
while (t--)
{
unordered_map<int,vector<int>> mp;
int n;
cin>>n;
for... | ALGO | 0.999976 | 3.691512 |
f00fc6d2-b26c-43f6-b846-ecf816d8c650 | GustavoPolicarpo/maratona | URI/AD-HOC/3016 - Eggfruit Cake.cpp | // Author: Gustavo Policarpo
// Name: Eggfruit Cake
// Level: 8
// Category: AD-HOC
// URL: https://www.beecrowd.com.br/judge/en/problems/view/3016
#include <bits/stdc++.h>
//LIFE IS NOT A PROBLEM TO BE SOLVED
#define rep(i,a,b) for( int i = (int) a; i < (int) b; i++ )
#define F first
#define S second
#define pb p... | ALGO | 0.99978 | 3.374012 |
ae0a4fdf-d650-4d6a-9120-b810c0b62a5a | aymanreda56/Far5a-Trollware | src/MAD.cpp | #include <windows.h>
#include <filesystem>
#include <tlhelp32.h>
#include <iostream>
#include <fstream>
/*
MAD is short for Mutually Assured Destruction.
A case when two entities have armaggedon weaponry but choose not to attack.
Because if any party decides to attack the other, it assures the destruction of both enti... | TOOL | 0.909914 | 4.648487 |
448b511d-14f3-4eb0-8ef8-d3030c04ee77 | belikeakash/Leetcode | 1282-group-the-people-given-the-group-size-they-belong-to/1282-group-the-people-given-the-group-size-they-belong-to.cpp | class Solution {
public:
vector<vector<int>> groupThePeople(vector<int>& a) {
vector<vector<int>>ans;
int n = a.size();
int p = 1;
unordered_map<int,vector<int>>m;
for(int i=0;i<n;i++) {
m[a[i]].push_back(i);
if(m[a[i]].size()==a[i]) {
... | ALGO | 0.999988 | 5.818089 |
b6afc0df-7a57-44ec-8949-0a9837203a1e | NextThread/450-dsa | string/longest_repeating_subsequence.cpp | class Solution
{
public:
int f(string &a, string &b, int i, int j, vector<vector<int>> &dp)
{
if (i == a.size() || j == b.size())
return 0; // if index reaches endpoint
if (dp[i][j] != -1)
return dp[i][j]; // check if previously stored
int take = 0;
if (a[... | ALGO | 0.999929 | 6.003204 |
6b854dbc-dec8-4aee-bc7c-538317213a04 | xucaimao/netlesson | pa2-algorithmbase/cy0301-POJ2016.cpp | /*
程序设计与算法(二)第二周测验 1:Boolean Expressions POJ2106
write by xucaimao,20171129,AC 2017-11-29 22:57:19
表达式= 项&|项...&|项
项=(表达式)
项=V or F ;这也是递归终止条件
项=!项
条件的推导,很费心思。重点在!运算符。
*/
#include<iostream>
using namespace std;
bool term();
bool exp();
bool exp(){
bool result;
result=term();//本行与下一行顺序不能反。开始时在这里折腾了许久
while(cin.peek(... | ALGO | 0.999021 | 3.886302 |
f59c22bf-eeb0-4dd5-be52-4e1f2396e4a7 | RohitVishwakarma8840/DSA | Dynamic_Programming/Intro/House_Robber_Leetcode.cpp | class Solution {
public:
int find(int index,vector<int>&nums,int n,vector<int>&dp){
// Base Case
if(index>=n)
return 0;
// check if computed
if(dp[index]!= -1)
return dp[index];
dp[index] = max(nums[index]+find(index+2,nums,n,dp), find(index+1,nums,... | ALGO | 0.999985 | 5.860224 |
9ac92cf3-6700-4fa8-9f93-a9303b5171b5 | Nullray/ICT | software/workload/firesim/host/firesim-lib/lib/boost/libs/program_options/example/regex.cpp | // This example shows how a user-defined class can be parsed using
// specific mechanism -- not the iostream operations used by default.
//
// A new class 'magic_number' is defined and the 'validate' method is overloaded
// to validate the values of that class using Boost.Regex.
// To test, run
//
// regex -m 123... | TOOL | 0.876862 | 7.578928 |
f8316982-a2d9-4c3e-af87-831bf07a84c1 | ishandutta2007/codeforces | al13n/normal/513/D1.cpp | #define _CRT_SECURE_NO_DEPRECATE
#define _USE_MATH_DEFINES
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <climits>
#include <ctime>
#include <numeric>
#include <vector>
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <iomanip>... | ALGO | 0.999983 | 3.315401 |
ba79dad4-276b-41bf-9ce9-bb3abab62812 | makankosappoh/Leetcode-soln | 0013-roman-to-integer/0013-roman-to-integer.cpp | class Solution {
public:
int romanToInt(string s) {
unordered_map<char, int> mp ={ //<key, value>
{'I', 1}, {'V', 5}, {'X', 10}, {'L', 50},
{'C', 100}, {'D', 500}, {'M', 1000}
};
if(s.empty()) {
return 0;
}
int roi = 0; //value to s... | ALGO | 0.999916 | 6.255485 |
ac81f464-0a3a-4b61-b82d-b888fecfbe89 | Sania-Islam/Problem_Solving | Delete value form any position.cpp |
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n, pos, value;
cout<< "The number of value : ";
cin>>n;
cout << "Inserted array is: ";
int a[n];
for(int i=0; i<n;i++)
{
cin>>a[i];
}
cout<< "Which position: ";
cin>>pos;
//int position = pos+1;
for(in... | ALGO | 0.999793 | 3.188531 |
1b4b27de-b7a7-4ab9-8dbf-f5a4cc3337e7 | ishandutta2007/codeforces | awakeanay/normal/1554/D.cpp | #include <iostream>
#include <algorithm>
#define int long long
signed main() {
std::ios::sync_with_stdio(false);
std::cin.tie(0);
int ts;
std::cin >> ts;
while(ts--) {
int n;
std::cin >> n;
if(n <= 10) {
for(int i = 0; i < n; i++)
std::cout << (char)('a' + i);
std::cout <<... | ALGO | 0.998212 | 3.958405 |
139e5c06-836b-43eb-95f7-982d46f9a3b4 | Shezitt/Que-no-no-perdio-Teambook | alex/range_ds/segment_tree.cpp | vi v(N+1, INF);
void update(int i, int x, int n) {
i+=k;
for (v[i] = x; i; i>>=1) v[i>>1] = min(v[i], v[i^1]);
}
int query(int i, int j, int n) {
int res = INF;
for (i+=k, j+=k; i<j; i>>=1, j>>=1) {
if (i&1) res = min(res, v[i++]);
if (j&1) res = min(res, v[--j]);
}
return res;
}
void build(int p, int n) {... | ALGO | 0.999976 | 3.580737 |
e81c910c-b2dc-4e26-b6bc-5390ba452c6f | hermit-git/C- | CodingBlocks_algo++/Bitmasking/fastExponentiation.cpp | #include<iostream>
using namespace std;
// Exponentiation Using Bitmasking
int power_optimized(int a,int n){
int ans=1;
while(n>0){
int last_bit=(n&1);
if(last_bit){
ans=a*ans;
}
a=a*a;
n=(n>>1);
}
return ans;
}
int main(){
int a,n;
cin>>a>>n;
cout<<power_optimized(a,n)<<en... | ALGO | 0.999994 | 4.791553 |
bda0a21a-9831-4735-860b-d638863ca859 | abtinahmdi/olympiad-codes | diverse garland.cpp | #include<bits/stdc++.h>
using namespace std;
int n, cnt;
string s;
int main()
{
cin >> n >> s;
for(int i = 0;i < n;i++){
if(s[i] == 'B' && s[i] == s[i + 1] && s[i] == s[i + 2])
s[i + 1] = 'R', cnt++;
if(s[i] == 'B' && s[i] == s[i + 1] && s[i] != s[i + 2]){
if(s[i + 2] == 'G')
s[i + 1] = 'R';
else
... | ALGO | 0.999878 | 3.631178 |
1a1e859f-9877-407b-b7b3-371d9f9d14d6 | xsfd/LeetCode | 1081.cpp | //
// Created by yf on 11/15/20.
//
#include "1081.h"
//todo: 贪心算法
string smallestSubsequence(string s) {
string res = "";
for (int i = 0; i < s.size(); i++) {
auto ch = s[i];
auto mm = find(s.begin() + i, s.end(), res[res.size() - 1]);
auto ch_find_in_res = find(res.begin(), res.end()... | ALGO | 0.999979 | 5.733932 |
e5ae7c05-f0ff-4347-8537-3517eac81066 | GPradaT/CPP09 | ex01/RPN.cpp | #include "RPN.hpp"
RPN::RPN() {}
RPN::~RPN() {}
RPN::RPN(const RPN &src) {(void)src;}
void RPN::operator=(const RPN &src) {(void)src;}
int RPN::getResult() const
{
return result;
}
bool RPN::isOperator(char c) const
{
return (c == '+' || c == '-' || c == '*' || c == '/');
}
void RPN::validInput(const std::stri... | ALGO | 0.988197 | 5.579074 |
24d8aa64-0f1b-4774-a63b-cd49665dcb2b | jjpprrrr/frameworks_av | media/libeffects/lvm/lib/Eq/src/LVEQNB_Process.cpp | /****************************************************************************************/
/* */
/* Includes */
/* ... | ALGO | 0.996688 | 5.497777 |
6413c55d-1ae1-4725-9622-fc6fbdc716b1 | yingzhang536/mrayy-Game-Engine | Engine/mrayEngine/src/smeshmanipulator.cpp | #include "stdafx.h"
#include "SMeshManipulator.h"
#include "ILogManager.h"
#include "SMesh.h"
#include "NvTriStrip.h"
#include "mraySystem.h"
namespace mray{
namespace scene{
SMeshManipulator::SMeshManipulator()
{
#ifdef ___DEBUG___
setDebugName("SMeshManipulator");
#endif
}
SMeshManipulator::~SMeshManipulator... | TOOL | 0.909117 | 4.399329 |
d31ba7a3-2463-4c4e-82d4-b75d3c5f00e5 | ishandutta2007/codeforces | rush_d_cat/normal/913/D.cpp | #include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <cstring>
#include <set>
#include <map>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define rd(x) scanf("%d", &x)
#define rd2(x, y) scanf("%d %d", &x, &y)
#define pb push_back
#define sz(x) (int)x.si... | ALGO | 0.999991 | 3.356319 |
7c270f1e-01b9-47ef-9cb4-fd1cf8991b97 | hieupham1103/TINHOC | SCHOOL/LOP10/22-11 2D Array/hinhvuong.cpp | #include<bits/stdc++.h>
using namespace std;
int dp[10000][10000];
int main(){
freopen("hinhvuong.inp","r",stdin);
freopen("hinhvuong.out","w",stdout);
int n,m,k;
cin>>n>>m>>k;
for (int i=1;i<=n;i++){
for (int e=1;e<=m;e++){
int inp;
cin>>inp;
dp[0]... | ALGO | 0.999852 | 3.586137 |
a9a050fe-5db2-4cab-a7b0-eb08e5ac7d94 | raincross7/code-similarity | codes/train_code/problem452/problem452_482.cpp | #include <iostream>
#include <algorithm>
using namespace std;
typedef long long int LLI;
struct info{
LLI rep;
LLI value;
};
bool by_value(info & a, info & b)
{
return a.value < b.value;
}
int main()
{
LLI n, k, a, b;
cin >> n >> k;
info arr[n];
for(int i = 0; i < n; i++)
{
cin >> a >> b;
arr[i].rep = ... | ALGO | 0.999992 | 3.516151 |
38c5ae04-8adb-4125-9b8a-e5f52cda9522 | CanchezAK/Kin | Time_var/Drivers/CMSIS/NN/Examples/ARM/arm_nn_examples/gru/arm_nnexamples_gru.cpp | /**
* @ingroup groupExamples
*/
/**
* @defgroup GRUExample Gated Recurrent Unit Example
*
* \par Description:
* \par
* Demonstrates a gated recurrent unit (GRU) example with the use of fully-connected,
* Tanh/Sigmoid activation functions.
*
* \par Model definition:
* \par
* GRU is a type of recurrent neura... | ALGO | 0.943384 | 7.471897 |
13a34880-ce31-43fd-b369-f6d214da4f16 | rnewman/services-central-old | layout/inspector/src/inCSSValueSearch.cpp | #include "inCSSValueSearch.h"
#include "nsIComponentManager.h"
#include "nsIServiceManager.h"
#include "nsVoidArray.h"
#include "nsReadableUtils.h"
#include "nsIDOMDocument.h"
#include "nsIDOMStyleSheetList.h"
#include "nsIDOMCSSStyleSheet.h"
#include "nsIDOMCSSRuleList.h"
#include "nsIDOMCSSStyleRule.h"
#include "nsI... | TOOL | 0.882075 | 6.468219 |
e6525e48-f3b1-4a41-a112-b1f412bf3878 | Kangbaejin/Algorithms | beakjoon/samsung_sw/13460.cpp | /*
* baekjoon 13460
*
* 구슬 탈출2
*
* https://www.acmicpc.net/problem/13460
*
*
* '.', '#', 'O', 'R', 'B'
* 빈칸, 벽, 구멍, red, blue
*
*
*/
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;
struct bead{
int rx, ry; //빨간 구슬 좌표
int bx, by; //파란 구슬 좌표
int... | ALGO | 0.99969 | 4.529357 |
09546339-a690-4dc2-97c3-c4b32c5a0b47 | racherim/Notes-Flutter | 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 |
90c70789-a369-4217-92d3-8ee4f927c101 | ishandutta2007/codeforces | nuip/normal/1342/E.cpp | #include <string>
#include <vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<functional>
#include<list>
#include<deque>
#include<bitset>
#include<set>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include<cstring>... | ALGO | 0.999988 | 4.810552 |
5f6e3758-a1ab-4290-ae50-9fc739ff61ca | rohmish2/spoj_solutions | SPOJSOLUTIONS/AFS.cpp | // Problem: AFS
// Submission ID: 25879988
// Language: 19212
#include <bits/stdc++.h>
using namespace std;
long long int cnt[1000001],sol[1000001];
int main()
{
for(int i=1;i*2<=1000000;i++)
for(int j=i*2;j<=1000000;j+=i)
cnt[j]+=i;
sol[0]=sol[1]=0;
for(int i=2;i<=1000000;i++)
... | ALGO | 0.996083 | 3.776634 |
a0e09674-0bb5-4148-b78b-9da67875a981 | TejasAdhikari/2-Data-Structures | Lec 13 - Heaps/4_HeapSort.cpp | /*
Consider an array 'arr' which is to be sorted using Heap Sort.
a) Initially build a max heap of elements in 'arr'.
b) The root element, that is arr[0], will contain maximum
element of arr. After that, swap this element with the
last element of arr and heapify the max heap excluding the... | ALGO | 0.99996 | 5.709674 |
e57db786-41ba-491f-92fd-903cbb62c4c7 | ishandutta2007/codeforces | marckess/normal/1303/G.cpp | #include <bits/stdc++.h>
#define endl '\n'
#define fi first
#define se second
#define MOD(n,k) ( ( ((n) % (k)) + (k) ) % (k))
#define forn(i,n) for (int i = 0; i < n; i++)
#define forr(i,a,b) for (int i = a; i <= b; i++)
#define all(v) v.begin(), v.end()
#define pb push_back
using namespace std;
typedef long long... | ALGO | 0.999946 | 3.904405 |
f83a83c2-41d9-4b90-9a62-16f987037f5f | akj2002276/GFG-solved-problems | Hard/Let's Play!!!/lets-play.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 isSuperSimilar(int n, int m, vector<vector<int>>& mat, int x)
{
vector<vector<int>> v(n);
x=x%m;
for(int ... | ALGO | 0.999812 | 5.300847 |
5b10a728-af4c-40e7-b4f2-f7212576304a | omkarnath7989/CSES-Solutions | IntroductoryProblems/Two_Knights.cpp | #include<iostream>
#include<vector>
using namespace std;
long long f( int n ){
if( n == 1 )
return 0 ;
else if( n == 2 )
return 6 ;
else{
long long k = n*1ll*n*1ll ;
long long ans = k * ( k- 1 ) / 2 ;
long long dif = 4*(n-1)*(n-2) ;
return ( ans - dif ) ;
... | ALGO | 0.999714 | 4.294771 |
2a5937f7-f413-47c3-9dac-22707a3de593 | CodeIntelligenceTesting/llvm-project | libcxx/test/std/algorithms/alg.sorting/alg.lex.comparison/lexicographical_compare_comp.pass.cpp | // <algorithm>
// template<InputIterator Iter1, InputIterator Iter2, CopyConstructible Compare>
// requires Predicate<Compare, Iter1::value_type, Iter2::value_type>
// && Predicate<Compare, Iter2::value_type, Iter1::value_type>
// constexpr bool // constexpr after C++17
// lexicographical_com... | TEST | 0.908048 | 6.43159 |
61e659b4-9e1f-44cc-a8d0-bac08d6e692d | spirosmastorakis/ndn-rtc-simulations | examples/ndn-congestion-topo-plugin.cpp | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
// ndn-congestion-topo-plugin.cpp
#include "ns3/core-module.h"
#include "ns3/network-module.h"
#include "ns3/ndnSIM-module.h"
namespace ns3 {
/**
* This scenario simulates a grid topology (using topology reader module)
*
* /------\ ... | ALGO | 0.980588 | 5.490948 |
da44b0e9-d517-46f4-9cef-940b22dae614 | exegee/stolarczyk_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.9988 | 6.76073 |
7994a93a-0509-40ad-9def-830851d89bab | sinian666/codes_86_4 | cpp_副本19/chapter_backtracking/preorder_traversal_iii_compact.cpp | /**
* File: preorder_traversal_iii_compact.cpp
* Created Time: 2023-04-16
* Author: Krahets (<EMAIL>)
*/
#include "../utils/common.hpp"
vector<TreeNode *> path;
vector<vector<TreeNode *>> res;
/* 前序遍历:例题三 */
static void preOrder(TreeNode *root) {
// 剪枝
if (root == nullptr || root->val == 3) {
ret... | ALGO | 0.999942 | 5.640774 |
0c0a0e19-8836-4f62-9304-2232d2bf43f3 | akhilsharmaa/Competitive-Programming | Leetcode Contest/Weekly Contest 299/6101_Check_if_Matrix_Is_X-Matrix.cpp | /*
Author - @akhilsharmaa
C++ code by Akhilesh Sharma
*/
#include <bits/stdc++.h>
using namespace std;
class Solution {
public:
bool checkXMatrix(vector<vector<int>>& grid) {
set<pair<int, int>> st;
bool flag = true;
for (int i = 0; i < grid.size(); i++){
if(grid[i][i... | ALGO | 0.999732 | 4.616179 |
5d7e3a37-1fa5-45aa-a88b-0dc2d982c9be | 81-28/AtCoder | archive/25_02_15/abc393_b.cpp | // https://atcoder.jp/contests/abc393/tasks/abc393_b
#include<bits/stdc++.h>
using namespace std;
void print(){cout<<'\n';}
template<typename Head,typename... Tail>
void print(const Head &head,const Tail &... tail){cout<<head;((cout<<' '<<tail),...);cout<<'\n';}
int main(){
ios::sync_with_stdio(false);cin.tie(nu... | ALGO | 0.999769 | 4.892108 |
2f87278d-ae75-42aa-8656-dc15b79cf27e | ajaydewangan1100/DSA_Love_babbar | 07_july/july_22/01_string_compression.cpp | #include<bits/stdc++.h>
using namespace std;
int compress(vector<char>& chars) {
// Solution 1 -----------------------------
int i = 0;
int n = chars.size();
int ansIndex = 0;
while(i < n) {
int j = i + 1;
while(j < n && chars[i] == chars[j]) {
j++;
}
c... | ALGO | 0.999773 | 5.192697 |
0a15ba30-8dc5-4964-9a76-4f732b3c18f4 | Mindjolt2406/Competitive-Programming | Kattis/2018 Singapore Regional/H.cpp | /*
Rathin Bhargava
IIIT Bangalore
*/
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>... | ALGO | 0.999993 | 3.825756 |
a16f04f5-af0c-4678-baf3-c508968d4cb6 | MOEA-LAB/Swarm-Control-Task-based-on-ZJU-Swarm-Formation | src/uav_simulator/so3_quadrotor_simulator/include/ode/libs/numeric/odeint/examples/stepper_details.cpp | #include <iostream>
#include <boost/array.hpp>
#include <boost/numeric/odeint.hpp>
using namespace std;
using namespace boost::numeric::odeint;
const size_t N = 3;
typedef boost::array< double , N > state_type;
//[ system_function_structure
void sys( const state_type & /*x*/ , state_type & /*dxdt*/ , const double ... | ALGO | 0.978301 | 6.463598 |
9daa2f15-8f3f-4408-9ac6-79ec5fe56819 | Elmokh1/ecommerce | 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.998859 | 6.785645 |
a1ade898-cee0-45d7-8859-fa52505268e9 | aovi/UnrealEngine4 | Engine/Plugins/Experimental/AlembicImporter/Source/ThirdParty/Alembic/ilmbase-1.0.2/Half/half.cpp | // Primary authors:
// Florian Kainz <<EMAIL>>
// Rod Bogart <<EMAIL>>
//---------------------------------------------------------------------------
//
// class half --
// implementation of non-inline members
//
//---------------------------------------------------------------------------
#include <assert.h>
... | TOOL | 0.930981 | 6.852328 |
909c39ca-d011-41e4-a391-6964d88247b5 | chenxue03/winmerge | Externals/freeimage/Source/OpenEXR/Half/toFloat.cpp | //---------------------------------------------------------------------------
//
// toFloat
//
// A program to generate the lookup table for half-to-float
// conversion needed by class half.
// The program loops over all 65536 possible half numbers,
// converts each of them to a float, and prints the result.
//
//-----... | TOOL | 0.923035 | 5.550715 |
33dbcceb-02f5-4082-a36c-980494288b93 | clxxrlove/algorithm-study-cpp | 2342/main.cpp | //
// main.cpp
// 2342
//
// Created by 정지용 on 2/10/25.
//
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using vi = vector<int>;
using vvi = vector<vector<int>>;
const int INF = 2e9;
void setDefault() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
}
int main(int ... | ALGO | 0.999752 | 4.354044 |
fe69ea2b-9184-4aa0-9f48-4d01685219f0 | YBRua/LeetCode | General/125-valid-palindrome/main.cpp | #include <cctype>
#include <string>
#include <iostream>
using namespace std;
class Solution {
public:
char safe_tolower(char ch) { return static_cast<char>(std::tolower(static_cast<unsigned char>(ch))); }
bool isPalindrome(string s) {
int begin = 0, end = s.size() - 1;
while (begin < end) {... | ALGO | 0.999507 | 6.293994 |
97a230e9-79e8-4e1a-bf1d-0534b27fdda4 | TonyLiu2004/CPP-CS135 | lab4/trapezoid.cpp | //Author: Tony Liu
//Course: CSCI-135
//Instructor: Genady Maryash
//Assignment: Lab4 F
//Enter width and height, returns an upsidedown trapezoid with the requested
//width and length
#include <iostream>
using namespace std;
int main(){
int width;
int height;
cin >> width >> height;
if(((height-1)*2) ... | ALGO | 0.948599 | 3.643146 |
b6e01f1b-08df-4532-9523-866937da50ca | MahbubAhmedTonmoy/algorithm_DS_code | graph/Dijkstra.cpp |
/*
8 14
0 1 4
0 7 8
1 2 8
1 7 11
2 8 2
8 6 6
7 8 7
7 6 1
2 3 7
2 5 4
6 5 2
3 5 14
3 4 9
5 4 10
0 8
*/
#include<bits/stdc++.h>
#include<stdio.h>
#include<vector>
#include<queue>
using namespace std;
const int MAX_SIZE = 1000;
const int INF = 1e9;
vector<int> graph[MAX_SIZE],cost[MAX_SIZE];
int dist[MAX_SIZE],node,e... | ALGO | 0.999979 | 4.038447 |
157ac32c-af64-45b4-906f-f8ddaf3327d5 | lordhaa123/CSES_Problem_set | Range_Queries/salary_queries.cpp | #include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include<algorithm>
#include <iostream>
#include <stack>
#include <queue>
#include <cmath>
#include <list>
#include <cstring>
#include <bitset>
#include <limits.h>
#include <string.h>... | ALGO | 0.999981 | 4.080168 |
023d8913-19b7-4262-a939-1acd36e2159a | SelimDonmez/gitsetupde | functions.cpp |
/**
* @brief A C++ program to find the maximum of four integers.
*
* This program takes four integer inputs and finds the maximum of those four numbers using the `max_of_four` function.
* It then prints the maximum value.
*
* @param none
*
*/
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
using namespa... | ALGO | 0.99959 | 4.968248 |
3851b1e4-7ff6-44a8-97fb-e1acc318a390 | Aast12/competitive-programming | uva/739.cpp | #include <iostream>
#include <iomanip>
using namespace std;
// A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z
int codes[] = {0, 1, 2, 3, 0, 1, 2, 0, 0, 2, 2, 4, 5, 5, 0, 1, 2, 6, 2, 3, 0, 1, 0, 2, 0, 2};
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie... | ALGO | 0.99891 | 3.950134 |
d90713e6-2dc2-4f65-8c8b-726a9fac6b10 | Bonaparto/CPP-Codes | yandex/algos/lecture5/d.cpp | #include <iostream>
using namespace std;
int main(){
int n, k, l = 0, r = 1, ans = 0;
cin >> n >> k;
int a[n];
for(int i = 0; i < n; ++i) cin >> a[i];
while(r != n)
{
if(a[r] - a[l] > k)
{
ans += n - r;
l++;
}
else r++;
}
cout << an... | ALGO | 0.999853 | 3.46653 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.