uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
7b0d3c8d-cec5-41e7-b56f-be9e4ad02c80 | Nirhar/DBMS_B-plus-Tree | src/b+tree.cpp | #include "../include/b+tree.hpp"
#include <stack>
b_plus_tree::b_plus_tree(int p){
this->p=p;
this->depth=0;
this->num_keys=0;
this->root=new node(p);
this->root->setLeaf(true);
}
int b_plus_tree::get_depth(){
return this->depth;
}
int b_plus_tree::get_num_keys(){
return this->num_keys;
}... | ALGO | 0.998662 | 3.293624 |
a7ca9f1c-311c-4ce4-b123-cde2aa6d0928 | Arjunvankani/Image-processing | project_10_MPC_control/src/Eigen-3.3/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_reductions_norm.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace std;
using namespace Eigen;
int main()
{
VectorXf v(2);
MatrixXf m(2,2), n(2,2);
v << -1,
2;
m << 1,-2,
-3,4;
cout << "v.squaredNorm() = " << v.squaredNorm() << endl;
cout << "v.norm() = " << v.norm() << endl;
cout << "v.lpN... | ALGO | 0.992002 | 4.03798 |
a16efc84-96a8-4329-b9cb-3d36d6332dab | piyushkumar96/Programs-Of-Compiler-Design | p1sorting.cpp | void sorting(int a[],int n)
{
int i,temp,j ;
for(i=0;i<n-1;i++)
{
for(j=0;j<n-i-1;j++)
{
if(a[j]>a[j+1])
{
temp=a[j];
a[j]=a[j+1];
a[j+1]=temp;
}
}
}
}
| ALGO | 0.999934 | 3.286662 |
0c0f4802-1fd2-4ed1-8cb9-9b09e4764b49 | rohit02rsk/Leet-Codes | 2836-neither-minimum-nor-maximum/2836-neither-minimum-nor-maximum.cpp | class Solution {
public:
int findNonMinOrMax(vector<int>& nums) {
int n = nums.size();
int mini = *min_element(nums.begin(), nums.end());
int maxi = *max_element(nums.begin(), nums.end());
for(int i=0; i<n; i++)
if(nums[i] != mini and nums[i] != maxi)
retu... | ALGO | 0.999971 | 5.133259 |
dfa76d93-e5a8-43f7-84bd-ea0e8a3e3f02 | arash16/prayers | UVA/vol-006/636.cpp | /*
>>~~ UVa Online Judge ACM Problem Solution ~~<<
ID: 636
Name: Squares (III)
Problem: https://onlinejudge.org/external/6/636.pdf
Language: C++
Author: Arash Shakery
Email: <EMAIL>
*/
#include <bits/stdc++.h>
using namespace std;
int main() {
char s[17];
while (cin >> s && (s[1] || s[0]!='0')... | ALGO | 0.999777 | 4.068165 |
2d47af3c-57be-4202-837c-6076d64cadb9 | machamy/PS | BOJ/NYPC/Test/main.cpp | // g++ -std=c++20 -O2 -pipe -static -s mushroom_ai.cpp -o mushroom_ai
#include <bits/stdc++.h>
using namespace std;
constexpr int R = 10;
constexpr int C = 17;
struct Rect { int r1, c1, r2, c2; };
class Game {
/* ------------------------------------------------------------------ */
/* 상태 ... | ALGO | 0.998046 | 5.92807 |
acd6dd3a-1a3d-476b-8636-b4ea4f0b77fe | harshdeep91/Leetcode | K-th element of two sorted Arrays - GFG/kth-element-of-two-sorted-arrays.cpp | // { Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution{
public:
int kthElement(int arr1[], int arr2[], int n, int m, int k)
{
int i=0,j=0,count=1;
while(i<n&&j<m)
{
if(count==k)
return min(arr1[i],arr2[j]);... | ALGO | 0.999991 | 5.30879 |
09cfd996-2e81-49f3-8b81-6528cb198a28 | aribloch/MultiClassifiedServer | Algorithm/KnnAlgorithm.cpp | #include "KnnAlgorithm.h"
/**
* constructor
* @param k the k of K-Nearest Neighbors
* @param neighbors neighbors to find from them the k nearest
* @param d distance method to define "nearest"
*/
KnnAlgorithm::KnnAlgorithm(unsigned int k, vector<Neighbor> neighbors, Distance *d) {
m_k = k;
m_neighbors = ne... | ALGO | 0.999769 | 5.293795 |
2a22f25f-e4b4-452c-9f8a-5eac5570f001 | KarlosMoodios/Neural-Network-MLP | CPP files/main.cpp | // main.cpp
#include "../NeuralNetwork/Neuron.hpp"
#include "../NeuralNetwork/Matrix.hpp"
#include "../NeuralNetwork/NeuralNetwork.hpp"
#include "../NeuralNetwork/Layer.hpp"
#include <iostream>
#include <vector>
#include <conio.h>
using namespace std;
int main(int argc, char **argv) {
// Set values of the neurons
... | ALGO | 0.969593 | 3.60877 |
2ccb4ce7-ed0b-40b7-910e-d149cbd099ed | PlumpMonsey/Essential-CPP | chapt4/4_11/num_sequence.cpp | #include "num_sequence.h"
typedef num_sequence::PtrType PtrType;
const int num_sequence::num_seq;
vector<vector<int> > num_sequence::seq(num_seq);
PtrType num_sequence::func_tbl[num_seq]
{
0,
&num_sequence::fibo_seq,
&num_sequence::lucas_seq,
&num_sequence::pell_seq,
&num_sequence::triang_seq,
... | ALGO | 0.869856 | 4.522491 |
b656270e-9233-435c-948a-e097d870a44c | marble-develop/leaf_frameworks_av | media/module/codecs/amrnb/common/src/syn_filt.cpp | /*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include <string.h>
#include "syn_filt.h"
#include "cnst.h"
#include "basic_op.h"
#include "basic_op.h"
/*-----------------------------... | ALGO | 0.999638 | 5.314509 |
b9a5baeb-e20e-4d15-9d93-1df666de0c6f | rainD4X/gaka-engine | src/Geometry/Curves.cpp | #include "Geometry/Curves.hpp"
#include <cstddef>
#include <glm/ext/vector_float3.hpp>
#include <glm/fwd.hpp>
#include <stdexcept>
#include <vector>
void gk::geometry::SimpleCurve::registerPoint(glm::vec2 point) {
m_points.push_back(glm::vec3(point, 0.0));
updateIndices();
}
void gk::geometry::SimpleCurve::regis... | TOOL | 0.899885 | 7.70321 |
0e12e668-a664-4a0e-b633-c693e33bfcbc | iammaymaps/amazone_clone_flutter_nodejs_mongo | 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 |
ff3b822f-7efa-48d4-90b4-3a3564caf086 | bhavyakalra19/comp-prog | 1160-letter-tile-possibilities/letter-tile-possibilities.cpp | class Solution {
public:
unordered_map<string, bool> st;
vector<bool> check;
void getAns(string s, string &tiles, int cnt){
if(cnt == tiles.size()){
st[s] = 1;
return;
}
getAns(s, tiles, cnt+1);
for(int i = 0; i < check.size(); i++){
if(che... | ALGO | 0.999957 | 6.762958 |
ca34d2c1-54eb-4e5b-a1b5-4c8b45f806f4 | KapadiaNaitik/Leetcode-Solutions | 2239-execution-of-all-suffix-instructions-staying-in-a-grid/2239-execution-of-all-suffix-instructions-staying-in-a-grid.cpp | class Solution {
public:
vector<int> executeInstructions(int n, vector<int>& startPos, string s) {
vector<int> ans;
vector<int> dup=startPos;
for(int i=0;i<s.length();i++){
int count=0;
startPos=dup;
for(int j=i;j<s.length();j++){
if(s[j]... | ALGO | 0.999949 | 5.562071 |
d0a6c83d-aa65-410c-a7d3-697b981de547 | thegamer1907/Code_Analysis | DP/648.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
string s;
cin>>s;
int l=s.size();
vector<int>a(l);
vector<int>b(l);
int sum=0;
for(int i=0;i<l;i++)
{ if(i==l-1)
{
... | ALGO | 0.999948 | 4.221072 |
234cc42c-92ce-4cfa-ab1a-73099685c885 | sarvex/leetcode-odin | solution/2200-2299/2256.Minimum Average Difference/Solution.cpp | typedef long long ll;
class Solution {
public:
int minimumAverageDifference(vector<int>& nums) {
int n = nums.size();
vector<ll> s(n);
s[0] = nums[0];
for (int i = 1; i < n; ++i) s[i] = s[i - 1] + nums[i];
int ans = 0;
ll mi = LONG_MAX;
for (int i = 0; i < n;... | ALGO | 0.999992 | 6.398876 |
2b75a963-aacc-4e0c-b59b-9870d1d35f9f | sppostman/coding-questions | 283-move-zeroes/move-zeroes.cpp | class Solution {
public:
void moveZeroes(vector<int>& nums) {
int n=nums.size();
int anchor = 0, i=0;
for(; i<n; i++){
nums[anchor] = nums[i];
if(nums[i] != 0)
anchor++;
}
while(anchor<n)
nums[anchor++]=0;
// int z=... | ALGO | 0.999804 | 5.83713 |
1774eb78-ceea-450f-b127-f994b632a36b | tushargandhi77/LeetCode | 222.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.999937 | 6.745967 |
b4c49cd8-6f57-49be-a9e0-e447180bfd29 | wangyenjen/JAW-codebook | codebook/dataStructure/Leftist_Heap.cpp | const int MAXN = 10000;
struct Node{
int num,lc,rc;
Node() : num(0), lc(-1), rc(-1){}
Node( int _v ) : num(_v), lc(-1), rc(-1){}
}tree[ MAXN ];
int merge( int x, int y ){
if( x == -1 ) return y;
if( y == -1 ) return x;
if( tree[ x ].num < tree[ y ].num )
swap(x, y);
tree[ x ].rc = merge(tree[ x ].rc, ... | ALGO | 0.999746 | 3.685998 |
483220c9-dc52-4388-970f-5df3791a5104 | glKarin/com.n0n3m4.diii4a | Q3E/src/main/jni/gzdoom/src/common/rendering/hwrenderer/data/hw_vrmodes.cpp | #include "vectors.h"
#include "hw_cvars.h"
#include "hw_vrmodes.h"
#include "v_video.h"
#include "version.h"
#include "i_interface.h"
// Set up 3D-specific console variables:
CVAR(Int, vr_mode, 0, CVAR_GLOBALCONFIG|CVAR_ARCHIVE)
// switch left and right eye views
CVAR(Bool, vr_swap_eyes, false, CVAR_GLOBALCONFIG | CV... | TOOL | 0.879792 | 5.756087 |
f12c2ca3-bb10-490a-950e-56f6ab053744 | PRANAVJARANDE/Leetcode-Solutions | medium/Reverse Substrings Between Each Pair of Parentheses.cpp | class Solution {
public:
string reverseParentheses(string s)
{
stack<int> s1;
for(int i=0;i<s.size();i++)
{
if(s[i]=='(')
{
s1.push(i);
}
else if(s[i]==')')
{
int k=s1.top();
s1.p... | ALGO | 0.999908 | 5.82844 |
32aa2042-d711-42c5-9cc9-f25e6b4e9071 | Sohel440/CP-learning-phase | codeforces/cut_ribon.cpp | #include <bits/stdc++.h>
#include <vector>
using namespace std;
#define ll long long
#define scl(n) cin >> n;
#define scc(c) cin >> c;
#define fr(i, n) for (ll i = 0; i < n; i++)
#define fr1(i, n) for (ll i = 1; i <= n; i++)
#define fri(i, n) for (int i = 0; i < n; i++)
#define fri1(i, n) for (int i = 1; i <= n; i++)
#... | ALGO | 0.999899 | 3.63266 |
af72708a-b58a-44e7-9e5c-d6beeeac48ab | NVDuy82/project-1-exercise-hustack | w2/PERMUTATION_GEN.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> v;
for (int i = n; i != 0; --i) {
v.push_back(i);
}
vector<int> v_end(n);
v_end = v;
do {
next_permutation(v.begin(), v.end());
... | ALGO | 0.999954 | 5.255456 |
2883ed18-2f48-4456-a4e9-68bcc053ba20 | CharlesTousignant/LOG2810TP | sommet.cpp | #include "sommet.h"
#include <iostream>
using namespace std;
ostream& operator<<(ostream& os, const Sommet& sommet){
os << sommet.getNom();
return os;
}
void Sommet::afficher(ostream& os) const{
os << "(" << *this << ", " << couleur_ << ", (";
if (arretes_.size() != 0) {
// On itere jusqu'a 1 ... | TOOL | 0.916383 | 4.14694 |
7a6f6810-434f-4195-a6dd-7f5a0803d521 | BHANU-BOHRA/Cpp | matrix-overload.cpp | #include<iostream>
#include<iomanip>
#include<stdio.h>
#include<string.h>
using namespace std;
class Matrix
{
int rows,cols;
int **mat;
void create();
void input();
void clear();
public:
Matrix();
void set(int,int);
Matrix operator +()const; // y=x;
friend Matrix oper... | ALGO | 0.920564 | 3.347381 |
2646f016-a9d2-4fb2-ad30-9a0dd9ddd4b4 | pandeyji711/LeetCode | 2104-operations-on-tree/operations-on-tree.cpp | class LockingTree {
public:
vector<int> parent;
vector<vector<int>> children;
vector<int> lockUser; // lockUser[i] == 0 means unlocked
LockingTree(vector<int>& parent) : parent(parent), lockUser(parent.size(), 0) {
children.resize(parent.size());
for (int i = 0; i < parent.size(); ++i)... | ALGO | 0.998447 | 5.031823 |
aa8ed419-535a-42ff-81f6-06fd765773e0 | YSD98/OpenGL_Assignments | External Libraries/GLM/test/gtx/gtx_fast_trigonometry.cpp | #include <glm/ext/scalar_ulp.hpp>
#define GLM_ENABLE_EXPERIMENTAL
#include <glm/gtc/type_precision.hpp>
#include <glm/gtx/fast_trigonometry.hpp>
#include <glm/gtx/integer.hpp>
#include <glm/gtx/common.hpp>
#include <glm/gtc/constants.hpp>
#include <glm/gtc/vec1.hpp>
#include <glm/trigonometric.hpp>
#include <cmath>
#i... | TEST | 0.968476 | 6.277224 |
cf4a36f8-708f-411b-bc84-0f939390e0ea | igorjoz/cpp-course | ^ other/^ Brainly/suma 2 składników - brainly/main.cpp | #include <iostream>
using namespace std;
int main()
{
int pierwszy, drugi;
cout<<"Pierwszy skladnik sumy: ";
cin>>pierwszy;
cout<<"Drugi skladnik sumy: ";
cin>>drugi;
cout<<pierwszy<<" + "<<drugi<<" = "<<pierwszy+drugi;
return 0;
}
| TOOL | 0.887429 | 3.897037 |
38a03418-66d5-4297-9c92-2f345a176df7 | Aniket-coder95/CPP_Programming | leet_code_questions_practice/17.Letter_Combinations_of_a_Phone_Number/main.cpp | #include<bits/stdc++.h>
using namespace std;
const vector<string> pad = {
"", "", "abc", "def", "ghi", "jkl",
"mno", "pqrs", "tuv", "wxyz"
};
vector<string> letterCombinations(string digits) {
if (digits.empty()) return {};
vector<string> result;
result.push_back("");
for(auto digit: digits)... | ALGO | 0.999932 | 6.242754 |
edbd4b28-1088-4edf-ac3f-c4fdc34e787f | Mrtandon20/Pattern1 | Pattern12.cpp | #include<iostream>
using namespace std;
int main(){
int n;
cout<<"Enter the Number : ";
cin>>n;
int i=1;
while(i<=n){
int j = 1;
while(j<=n){
char ch = 'A'+j-1;
cout<<ch;
j++;
}
i++;
cout<<endl;
}
} | ALGO | 0.999408 | 3.811503 |
5399cf89-8e33-4e9a-a4b1-3a85eb7fd0bc | JorgeLuisOR/edd2015 | Parcial2/listas/listas1/funciones.cpp | #include <cstdlib>
#include <iostream>
#include "funciones.h"
using namespace std;
void iniciar (list &lista){
lista.inicio = NULL;
lista.capacidad = 0;
}
nodo *nodonuevo(int dato){
nodo *nuevo = new nodo;
nuevo->dato = dato;
nuevo->next = NULL;
return nuevo;
}
bool vacia (list &lista){
... | TOOL | 0.988065 | 4.068501 |
77669be5-4536-478f-b94e-6d7edb3861ae | DanielHaba/magma | src/zhegvdx_2stage.cpp | /*
-- MAGMA (version 2.0) --
Univ. of Tennessee, Knoxville
Univ. of California, Berkeley
Univ. of Colorado, Denver
@date
@author Raffaele Solca
@author Azzam Haidar
@author Mark Gates
@precisions normal z -> s d c
*/
#include "magma_internal.h"
#include "ma... | ALGO | 0.999401 | 5.646225 |
e14b475a-209c-4919-bb71-20072b0dbe34 | nrey/eulerProject | eu0009/eu0009.cpp | #include"eu0009.h"
void eu0009 :: solucion(){
// ---------------------------------------------------- //
tstart = (double)clock()/CLOCKS_PER_SEC;
// ---------------------------------------------------- //
output = 0;
// ---------------------------------------------------- //
this->fun_1();
// -------... | ALGO | 0.999877 | 3.986606 |
db53455b-5054-4e09-aea9-da306aa54ba9 | CodeRitik189/LeetCodeRepo | Largest Number formed from an Array - GFG/largest-number-formed-from-an-array.cpp | // { Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
//User function template for C++
class Solution{
public:
// The main function that returns the arrangement with the largest value as
// string.
// The function accepts a vector of strings
static bool cmp(string& s1, str... | ALGO | 0.99999 | 6.194258 |
ffe55300-c5f3-4847-bb30-0becae663753 | outman119/leetcode | largestrectangleinhistogram.cpp | class Solution {
public:
int largestRectangleArea(vector<int> &height) {
int len = height.size();
if (len == 0)
{
return 0;
}
int maxaera = 0;
stack<int>ss;
int i = 0;
while (i < len)
{
if (ss.empty() || height[ss.top()]... | ALGO | 0.999951 | 6.522122 |
5691549d-323d-4081-bb92-40184f8f5911 | ishandutta2007/codeforces | radewoosh/normal/1370/B.cpp | //~ while (clock()<=69*CLOCKS_PER_SEC)
//~ #pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
//~ #pragma GCC target ("avx2")
//~ #pragma GCC optimize("Ofast")
//~ #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//~ #pragma GCC optimize("unroll-loops")
#include <bits/st... | ALGO | 0.999458 | 3.537496 |
1ebcd4c0-aa55-4a68-9260-40b27c61d4f9 | austriancoder/third_party_mesa3d | src/intel/compiler/elk/elk_vec4_live_variables.cpp | #include "elk_vec4.h"
#include "elk_vec4_live_variables.h"
using namespace elk;
#define MAX_INSTRUCTION (1 << 30)
/** @file elk_vec4_live_variables.cpp
*
* Support for computing at the basic block level which variables
* (virtual GRFs in our case) are live at entry and exit.
*
* See Muchnick's Advanced Compiler... | ALGO | 0.860839 | 7.380141 |
59a7f7aa-22ca-4b09-8ae6-3a39a67e5e12 | KirtiSharma0/DSA | Stack Expressions/infix.cpp | #include<iostream>
#include<stack>
using namespace std;
int pr(char ch){
if(ch=='+' || ch=='-') return 1; //priority power low
if(ch=='/' || ch=='*') return 2; //priority power high
}
int solve(int n1, int n2, int ch){
if(ch=='+') return n1+n2;
else if(ch=='-') return n1-n2;
else if(ch=='/') retu... | ALGO | 0.999948 | 4.386528 |
8b1b0b77-2310-4098-9200-7477ac8edcdd | JohnnyJ5/CodingInterview | Sorting/question1.cpp |
#include "question1.h"
#include <vector>
#include <iostream>
void PrintVector(const std::string & title, const std::vector<int> & v)
{
std::cout << title << std::endl;
for (unsigned int i = 0; i < v.size(); ++i)
{
std::cout << v[i] << " ";
}
std::cout << std::endl;
}
//Note this could be ... | ALGO | 0.997688 | 4.536226 |
67230b42-300a-4104-822a-389738a976da | NJUSeclab/OCFI | ocfi/clang-tools-extra/clangd/index/Merge.cpp | #include "Merge.h"
#include "index/Symbol.h"
#include "index/SymbolLocation.h"
#include "index/SymbolOrigin.h"
#include "support/Logger.h"
#include "support/Trace.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/StringSet.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>... | TOOL | 0.984133 | 7.778971 |
9f9949ab-3f77-4efb-90f8-55a7cc338c71 | ishandutta2007/codeforces | noam13/normal/1178/F1.cpp | #include <bits/stdc++.h>
#define int int64_t
#define vi vector<int>
#define ii pair<int,int>
#define vb vector<bool>
#define vvi vector<vi>
#define vvvi vector<vvi>
#define vvvvi vector<vvvi>
#define vvvvvi vector<vvvvi>
#define vvb vector<vb>
#define vii vector<ii>
#define vvii vector<vii>
#define x first
#define y se... | ALGO | 0.999993 | 4.615033 |
663cba8f-8e7c-411c-a74e-7f34e150c1a3 | PDuchnik/ZMP2025 | l5/z3/z3b287378.cpp | #include <iostream>
using namespace std;
int max_value;
int min_c(int a, int b){
if(a < b){
return a;
}
else return b;
}
int max_c(int a, int b){
if (a > b){
return a;
}
else return b;
}
void copy(int destination[], int source[], int n, int dest_start, int src_start){
for ... | ALGO | 0.999622 | 3.768308 |
c8585e66-ce27-4eb3-833b-9ca5e9d99940 | mattya-lab/Aizu_Online_Judge | Volume0/0092.cpp | #include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define vecInt vector<int>
#define vecvecInt vector<vector<int>>
int solve(vecvecInt v);
bool checkSquareSumIs0(vecvecInt v, int cur_row, int cur_col, int col, int row);
int main(void)
{
while (true) {
int n; cin >> n; if (... | ALGO | 0.999796 | 4.206557 |
9909f7ae-3f9e-4b12-aab6-d8efbf533cc5 | harsh809/Codes | Dynamic programming/Matrix Chain Multiplication.cpp | //coding ninja Matrix Chain Multiplication
// memoization TC = o(n*n*n) SC = o(n*n) + o(n)
#include <bits/stdc++.h>
int f(int i,int j,vector<int> &arr,vector<vector<int>> &dp){
if(i==j) return 0;
if(dp[i][j]!=-1) return dp[i][j];
int mini = 1e9;
for(int k=i;k<j;k++){
int steps = arr[i-1]*ar... | ALGO | 0.999982 | 4.787931 |
673ca49e-1e96-40bc-b41f-1fbf91be2b52 | DrDAN6770/LeetCode | Easy/1582 Special Positions in a Binary Matrix.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
template <typename T>
void print_res(const T& input) {
if constexpr (is_same_v<T, int> || is_same_v<T, long> || is_same_v<T, long long> ||
is_same_v<T, bool> || is_same_v<T, float> || is_same_v<T, double> || is_same_... | ALGO | 0.999559 | 5.686872 |
9766e8a3-100b-49a3-8b11-905aadf0c3b0 | webvirtua/Estrutura-de-Dados-II | BiPartido, eHeap, HeapSort, CountSorting e HeapSortDecrescente/P5-eHeap.cpp | #include <stdio.h>
#include <stdlib.h>
#define TAM 15
void imprime_vetor(int* v, int tam) {
int i, j;
for (i = 0; i < tam; i++) {
printf("%d ", v[i]);
}
printf("\n");
}
bool eHeap(int* v, int n) {
for (int i = 0; i <= (n - 2) / 2; i++) {
if (v[2 * i + 1] > v[i])
return false;
if (v[2 * i + 2] > v[i])
... | ALGO | 0.995358 | 4.647442 |
9c2cc93f-731a-4bad-9c92-5139c37dbb4a | MichaelHeUVA/Codeforces | A/Winner.cpp | // https://codeforces.com/contest/2/problem/A
#include <bits/stdc++.h>
using namespace std;
template <typename A, typename B>
ostream& operator<<(ostream& os, const pair<A, B>& p) {
return os << '(' << p.first << ", " << p.second << ')';
}
template <typename T_container, typename T = typename enable_if<
... | ALGO | 0.999974 | 5.391128 |
16a8ed90-97a3-4196-a19e-2f18fb8604d4 | GurleenRajpal/DS-Cpp-Codes | 9_character_and_2d_array/8_wave_print.cpp | // Wave Print
// Send Feedback
// For a given two-dimensional integer array/list of size (N x M), print the array/list in a sine wave order, i.e,
// print the first column top to bottom, next column bottom to top and so on.
// Input format :
// The first line contains an Integer 't' which denotes the number of test ca... | ALGO | 0.999318 | 4.724018 |
4e4c601e-df93-4562-b703-3fbc0d31e777 | Jenil45/CPP-Programmes | sum_of_subarray.cpp | #include<iostream>
using namespace std;
// Find sum of all subarray ("sum of all subarray is also a array ofn size")
int main()
{
int n;
cin>>n;
int arr[n];
for (int i = 0; i < n; i++)
{
cin>>arr[i];
}
cout<<"\n The array is \n";
for (int i = 0; i < n; i++)
{
co... | ALGO | 0.999875 | 4.087565 |
5233bbbe-1541-4a5c-bbfc-a6d7c61c7a5e | StephenCao422/data_structure | lab/lab_ml/lib/nim_graph/graph.cpp | #include "graph.h"
const Vertex Graph::InvalidVertex = "_CS225INVALIDVERTEX";
const int Graph::InvalidWeight = INT_MIN;
const string Graph:: InvalidLabel = "_CS225INVALIDLABEL";
const Edge Graph::InvalidEdge = Edge(Graph::InvalidVertex, Graph::InvalidVertex, Graph::InvalidWeight, Graph::InvalidLabel);
Graph::Graph(bo... | TOOL | 0.982274 | 6.141974 |
f18b64cd-5d4a-4f42-a5ea-cfdcd3c339dd | mh-northlander/procon | googlecodejam/2017/round1c/b.cpp | #include <iostream>
#include <iomanip>
#include <vector>
#include <queue>
#include <algorithm> // sort
#include <utility>
#include <cmath>
typedef long long ll;
using namespace std;
struct seg{
int s,t;
bool c;
seg(int s,int t,bool c): s(s), t(t), c(c){}
bool operator<(const seg& rhs) const {
return s < r... | ALGO | 0.999493 | 4.14624 |
c840f5a5-d2e6-43c4-89be-49acba17fbaf | tiankonguse/ACM | contest/poj/shen10000/1423/8866038_AC_485MS_39432K.cpp | #include<iostream>
#include<math.h>
using namespace std;
int num=1;
int str[10000003];
double sum=0.0;
void fun(int n)
{
for(int i=num+1;i<=n;i++)
{
sum+=log10(1.0*i);
str[i]=(int)sum+1;
}
num=n;
}
int main()
{
int n,m;
memset(str,0,sizeof(str));
str[1]=1;
cin>>n;
while(n--)
{
cin>>m;
if(!str[m])fun(m);
print... | ALGO | 0.999597 | 3.296285 |
7ea9db80-b8c0-4189-89ca-70da27ed28ed | houtaru/code | VNOI Training/Hải Dương/2017.11.09/Code/MAXFLOW.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i, a, b) for (int i = a; i <= b; ++i)
#define REP(i, n) for (int i = 0; i < n; ++i)
#define INF 1e18
const int N = 1e5 + 10;
struct Dinitz2 {
int n, s, t, nE;
ll cap[N], flow[N];
int q[N], d[N], adj[N], last[N], pro[N], next[N... | ALGO | 0.999969 | 4.496892 |
28467a7d-40b9-41c9-818f-2832363e2880 | RismaParamesti/UTS_PemrogramanMobile | 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 |
2a23e661-5231-4d47-a38d-6867fcb914ed | thisisiron/Algorithm | BOJ/C++/BOJ_2042.cpp | #include <cstdio>
int n,m,k;
long long tree[1000000*4];
int init() {
for(int i=0;i<n*4;i++) tree[i] = 0;
int ret = 1;
while(ret<n) ret *= 2;
ret--;
return ret;
}
void update(int idx, long long data) {
int cur = idx;
while(cur > 0){
tree[cur] += data;
cur/=2;
}
}
long long sum(int start, int end) {
long... | ALGO | 0.999937 | 3.830307 |
ecfe8b5f-8255-4c2d-b000-3540c1160634 | insp3ctah/algos | Lab2/A.cpp | #include <fstream>
using namespace std;
int *Merge(int *start, int first, int *final, int last) {
int *c = new int[(first + last) * 4];
int i = 0;
int j = 0;
int k = 0;
while (i < first || j < last) {
if (i == first || (j < last && start[i] >= final[j])) {
c[k] = final[j];
... | ALGO | 0.999965 | 3.971368 |
b413ab0b-fcb9-4847-b967-0a04b0ef5372 | ghatdev/icewallcstudy | malloc1.cpp | #include <stdio.h>
#include <stdlib.h>
int main(void)
{
int **arr;
int size;
scanf("%d", &size);
arr = (int**)malloc(sizeof(int*)*size);
for (int i=0;i<size;i++)
{
arr[i] = (int*)malloc(sizeof(int)*size);
}
int x=-1,y=0;
int d = 1;
int num = 1;
... | ALGO | 0.999429 | 3.123438 |
0e088ae7-e6d1-4e1f-8b6a-23711e19a03e | Glowstudent777/Programming-Logic-and-Design | Module 3/LeapYearDetector.cpp | /*****
* Author: Glowstudent
* Program: Leap Year Detector
*****/
#include <iostream>
using namespace std;
int main()
{
int year;
cout << "Enter a year to see if it is a leap year: ";
cin >> year;
if (year % 400 == 0)
cout << year << " is a leap year" << endl;
else if (year % 100 != 0 &... | ALGO | 0.972417 | 3.37041 |
d90ea272-8b8e-4a84-a269-894b3dc037e2 | RUSHDCAT/Contest-Solutions | Codeforces Round #697 (Div. 3)/E.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N = 2000 + 10;
const int mod = 1e9 + 7;
int c[N][N];
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
for (int i = 0; i < N; i ++) c[i][0] = 1;
for (int i = 1; i < N; i ++) for (int j = 1; j <= i; j ++)... | ALGO | 0.999909 | 3.649468 |
c3488f65-13d5-409b-8154-647d355bb4d4 | Vranjan7077/Var_Plat_Codes | Interviewbit/Two Pointers/intersection-of-sorted-arrays.cpp | vector<int> Solution::intersect(const vector<int> &A, const vector<int> &B) {
vector<int> res;
int i = 0,j = 0;
int m = A.size();
int n = B.size();
while(i<m and j<n){
if(A[i]==B[j]){
res.push_back(A[i]);
i++;
j++;
}else if(A[i]<B[j]){
... | ALGO | 0.999932 | 5.078202 |
c15d8256-0233-4b57-b46b-23c3fc7c86ac | ITC-Vanadzor/ITC-7 | Jirayr_Stepanyan/Homework/25_10_2015/bajanararner.cpp | #include <iostream>
using namespace std;
int main()
{
cout << "enter any number " << endl;
int a, b, c, k = 0;
cin >> a;
c = a; // c-in veragrum enq a-i arjeq@
while (a > 1)
{
b = a % 10;
if (b) // ete b-n havasar che 0-i
{
if(!(c % b)) // ete c-n aranc mnacordi bajanvum e b-i ur... | ALGO | 0.999683 | 4.129019 |
c99cff99-b98d-4206-a906-ebdf4e849586 | kailashkai28/programs- | Cplusplus/test11.cpp | #include<iostream>
using namespace std;
class num
{ int a,b;
public:
num(){}
num(int x,int y){
a=x;
b=y;
}
friend num operator+(int,num);
void display();
};
num operator+(int u,num t){
return num(u,t.a+t.b);
}
void num::display(){
cout<<"Sum:"<<a+b<<endl;
}
int main(){
num n;
n.display();
n... | ALGO | 0.991841 | 4.453787 |
bfd7e972-5d25-4fa9-a59a-c60635fefb9a | Iman-Howlader/Competitive-Programming | CodeChef/Playing_with_OR.cpp | /**
* Author : iman320
* Created: 2023-11-01 21:10:19
**/
#include <bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define nl '\n'
#define ll long long
#define ve vect... | ALGO | 0.999829 | 4.808858 |
61a430e7-8fb1-4e2f-a236-9876f503061b | hzfsls/leetcode-supercrawl | data/0296.best-meeting-point/code_snippets/sol.cpp | class Solution {
public:
int minTotalDistance(vector<vector<int>>& grid) {
}
}; | ALGO | 0.999925 | 4.749713 |
113246af-8cbe-4ada-8c4d-3f5339597e9a | QianQNanami/JSOI-WC25 | PJ/judger/source/WC25-274/add.cpp | #include <bits/stdc++.h>
using namespace std;
int a[100000+2],n,m,l,r,sum[100000+2],ans;
int main(){
cin>>n;
for(int i=0;i<=n;i++){
cin>>a[i];
sum[i]=sum[i-1]+a[i];
}
sum[n]=sum[n-1]+a[n];
cin>>m;
for(int i=1;i<=m;i++){
cin>>l>>r;
ans=sum[r]-sum[l-1];
cout<<ans;
cout<<'\n';
}
return 0;
}
/*
4
2 4 3 ... | ALGO | 0.999938 | 4.033543 |
766cfdd3-a531-43c6-a8bb-ece58de07278 | aaSHEESH2001/cplusplus_codes | questions/square root with precision/code.cpp | #include<iostream>
using namespace std;
int sqrt_BS(int n){
int start = 0;
int end = n;
int ans;
while(start <= end){
int mid = start + (end - start)/2;
if(mid*mid == n){
return mid;
}
if(mid*mid < n){
ans = mid;
start = mid + 1;
... | ALGO | 0.999779 | 3.772015 |
5799863a-c709-4ef1-8015-00f2d2677c2d | Dharana23/Competitive-Coding | C++/even-odd.cpp | #include<bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int arr[n];
for(int i=0; i<n; i++) {
cin >> arr[i];
}
int even_sum = 0;
int odd_sum = 0;
for(int i=0; i<n; i++) {
if ((arr[i] % 2) == 0) {
if((i % 2) == 0) {
even_sum += arr[i];
}
}
else {
if((i % 2) != 0) {
o... | ALGO | 0.999983 | 4.370847 |
48879bc8-caed-4cbb-9b9d-a6f802ce977c | nolda-wh/PS_study | boj/CPP_solve/9085.cpp | #include <iostream>
using namespace std;
int main(void)
{
int T;
cin >> T;
while (T--)
{
int N, result = 0;
cin >> N;
for (int i = 0; i < N; i++) {
int input;
cin >> input;
result = result + input;
}
cout << result << '\n';
}
}
| ALGO | 0.999273 | 4.422197 |
7a5b5105-f67c-458f-bb6a-ff0f7c7bcffc | Lok-Yat-man/dbsystem-solid | dbsystem-master/LIBKDV_to_Pak_Lon/init_visual.cpp | #include "init_visual.h"
double computeSqNorm(double*q, int dim)
{
double sqNorm = 0;
for (int d = 0; d < dim; d++)
sqNorm += q[d] * q[d];
return sqNorm;
}
double inner_product(double*q, double*p, int dim)
{
double ip = 0;
for (int d = 0; d < dim; d++)
ip += q[d] * p[d];
return ip;
}
double sq_euclid_di... | ALGO | 0.974909 | 4.310665 |
dfecacc1-7fdf-446b-a449-fd8fb96222f7 | Achyut-shekhar/DAA | week6/bipartite.cpp | #include <iostream>
#include <vector>
#include <queue>
using namespace std;
// BFS function to check one connected component
bool bfsCheck(int start, vector<vector<int>>& graph, vector<int>& color) {
queue<int> q;
q.push(start);
color[start] = 0;
while (!q.empty()) {
int node = q.front();
... | ALGO | 0.999979 | 6.828987 |
9cb73ecc-5a95-472e-b873-fcfcf0769357 | a00012025/Online_Judge_Code | CodeForce/536-B.cpp | #include<bits/stdc++.h>
#define LL long long
#define MOD 1000000007
using namespace std;
const int maxn=1000000+10 ;
char s[maxn] ;
int Z[maxn],p[maxn] ;
bool ok[maxn] ;
main()
{
int n,m ; scanf("%d%d%s",&n,&m,s+1) ;
for(int i=1;i<=m;i++) scanf("%d",&p[i]) ;
int len=strlen(s+1) ;
Z[1]=0 ;
for(int i... | ALGO | 0.999979 | 3.730794 |
2f4bee15-e5c2-449a-869e-24bf129296b3 | hpaucar/parallel-programming-repo | Laboratory/MPI_code/prog03_SendMessage01/SendMessage01.cpp | #include "mpi.h"
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
int rank, contador;
MPI_Status estado;
MPI_Init(&argc, &argv); // Inicializamos la comunicacion de los procesos
MPI_Comm_rank(MPI_COMM_WORLD, &rank); // Obtenemos el valor de nuestro identificador
//Envi... | ALGO | 0.989245 | 3.809812 |
5178d021-b35a-4210-b3f3-5ebe54e0a5f2 | kuriel07/OrbWeaver | StackHost/StackHost.cpp |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include "defs.h"
#include "config.h"
#include "StackHost.h"
#include "core/http.h"
//#include "core/https.h"
#include "core/net.h"
#include "core/global.h"
#if defined(WIN32) || defined(WIN64)
#include "util/pthread.h"
#else
#include <... | WEB | 0.880763 | 3.655729 |
dd739bd1-3eb9-4b35-bc54-f47290c0446e | KaygoYM/Data-Structures-and-Algorithms | Sorting/main.cpp | #include"stdafx.h"
#include<stdio.h>
#include "stdlib.h"
#include<malloc.h>
#include"All_sorting.h"
#include<time.h>
void print_s(Elementtype A[], int N,char a[])
{
printf("The %s sort is: ", a);
for (int i = 0; i < N; i++)
printf("%d ",A[i]);
}
void main()
{
const long int N = 100000;
int Test_array[N];
time_... | ALGO | 0.998103 | 3.713711 |
c927abd5-aafb-4a54-92b6-c92bbd8a2d76 | Luckily777/C- | Likou070502.cpp | //94.
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
vector<int> inorderTraversal(TreeNode* root) {
stack<TreeNode*> st;
Tre... | ALGO | 0.999983 | 6.320919 |
67ea4f70-8f19-4ce9-b72f-12932033819b | n0IQ/Competitive-Programming | codeforces/1475/A.cpp | #include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define ff first
#define ss second
#define rep(i, n) for(int i = 0; i < n; ++i)
#define repR(i, n) for (int i = n-1; i >= 0; --i)
#define repA(i, a, n) for (int i = a; i <= n; ++i)
#de... | ALGO | 0.99957 | 5.461987 |
e7fd0255-bd25-4dbc-9e2e-6341a856d785 | Gu5tavoNcz/Ciencia_de_la_computacion_1 | LABORATORIO/7mo_proyecto/main.cpp | #include <iostream>
using namespace std;
int suma(const int arreglo[],const int tamanho){
int sum=0;
for(int i=0;i<tamanho;i++)
sum+=arreglo[i];
return sum;
}
float promedio(const int arreglo[],const int tamanho)
{
return (float) suma(arreglo,tamanho)/tamanho;
}
int inver... | ALGO | 0.988388 | 3.793212 |
39fe409f-bb75-47b4-a32d-9bf26ddfc6d6 | sx-aurora-dev/llvm-vp-project | libcxx/test/std/algorithms/alg.nonmodifying/alg.find.first.of/find_first_of_pred.pass.cpp | // <algorithm>
// template<InputIterator Iter1, ForwardIterator Iter2,
// Predicate<auto, Iter1::value_type, Iter2::value_type> Pred>
// requires CopyConstructible<Pred>
// constexpr Iter1 // constexpr after C++17
// find_first_of(Iter1 first1, Iter1 last1, Iter2 first2, Iter2 last2, Pred pred);
#incl... | TEST | 0.989763 | 6.48681 |
5559c835-b7b2-4dc8-a863-2f31a0bb60f2 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_11205_10.cpp | #include <bits/stdc++.h>
using namespace std;
const long double eps = 1e-15;
struct Point {
long double x, y;
} o1, o2, o3;
long double t1, t2, Ax, Ay, Bx, By, Cx, Cy;
long double r1, r2, r3;
int dcmp(long double x) {
if (fabs(x) < eps) return 0;
return x > 0.0 ? 1 : -1;
}
long double sqr(long double t) { return ... | ALGO | 0.999884 | 4.484362 |
df974e55-3b8f-4790-b668-f48f620ab982 | Tphuong612/DSA | DSA codeptit/5. quy hoach dong/gia tri nhi phan.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n, q;
cin>>n>>q;
int a[n+1];
memset(a, 0, sizeof(a));
int x, y;
while(q--){
cin>>x>>y;
for(int i=x;i<=y;i++){
if(a[i]==1) a[i]=0;
else a[i]=1;
}
}
for(int i=1;i<=n;i++) cout<<a[i]<<" ";
}
| ALGO | 0.999754 | 3.543855 |
35c33e7f-ac67-4633-a1be-003f9225f262 | isj0/Modern-Cpp | 03_Operators/Dress Up/dressUp.cpp | #include <iostream>
#include <vector>
using namespace std;
int main() {
cout << boolalpha;
// Determine whether you need to wear a coat based on temperature and wind speed
bool wear_coat {false};
double temp {};
int wind_speed {};
const int wind_speed_for_coat {25}; // wind over this... | TOOL | 0.949584 | 5.780498 |
c4a23f22-856a-438a-8232-b9378af80bd1 | shr128/DSAL | 6C.cpp | #include <iostream>
#include <queue>
using namespace std;
int adj_mat[50][50] = {0};
int visited[50] = {0};
void dfs(int s, int n, string arr[])
{
visited[s] = 1;
cout << arr[s] << " ";
for (int i = 0; i < n; i++)
{
if (adj_mat[s][i] && !visited[i])
dfs(i, n, arr);
}
}
void b... | ALGO | 0.999966 | 4.934542 |
18b98e19-0127-4806-a76d-a123d81e70ad | ChengyangHe-ux/cpp | BountyOrder/BountyOrder2/若有其事.cpp | //
// Created by 何承洋 on 24-10-21.
//
#include<iostream>
using namespace std;
int count=0;
int Fibonacci(int x) {
count++;
if(x==0 || x==1) return 1;
return Fibonacci(x-1)+Fibonacci(x-2);
}
int main() {
int x;
cin>>x;
int xx=Fibonacci(x);
cout<<count;
return 0;
} | ALGO | 0.999884 | 4.287309 |
90a69a0c-8bc7-4199-9c63-6d23fd65a709 | BssamQ/SeniorProject-Bus-Tracking | bus_tracking_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.998799 | 6.76775 |
7bb7d2ab-bd99-4785-a49d-6b3b08465eaf | Ali-hey-0/Bullet-Physics-SDK | src/BulletCollision/CollisionShapes/btOptimizedBvh.cpp | #include "btOptimizedBvh.h"
#include "btStridingMeshInterface.h"
#include "LinearMath/btAabbUtil2.h"
#include "LinearMath/btIDebugDraw.h"
btOptimizedBvh::btOptimizedBvh()
{
}
btOptimizedBvh::~btOptimizedBvh()
{
}
void btOptimizedBvh::build(btStridingMeshInterface* triangles, bool useQuantizedAabbCompression, const b... | ALGO | 0.977781 | 6.780021 |
fd38d57d-26cf-49e8-b53b-22f5f468dd4e | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_7529_19.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, sum = 0;
cin >> N;
for (int i = 1; i <= N; i++) {
for (int j = 1; j <= N; j++) {
int tmp;
cin >> tmp;
if (i == j or (i + j) == (N + 1) or i == (N / 2 + 1) or j == (N / 2 + 1))
sum += tmp;
}
}
cout << sum << end... | ALGO | 0.999846 | 3.740793 |
fedee09b-3ea5-43a6-b6dd-199724a8b54b | ishandutta2007/codeforces | crh380bl-2339/normal/1696/E.cpp | #include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define N 200005
int a[N];
int fac[N+N],_fac[N+N];
int qpow(int x,int y){
int t=1;
for(;y;y>>=1){
if(y&1)t=1LL*t*x%mod;
x=1LL*x*x%mod;
}
return t;
}
int C(int n,int m){
if(n<m||m<0)return 0;
return 1LL*fac[n]*_fa... | ALGO | 0.999959 | 3.702495 |
51c93b57-b630-45f2-a321-4ebff361f8bc | Wriderss/wrider_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.99887 | 6.783439 |
6af417bb-f7e1-4188-9de3-1b212ec1ef54 | Shahriar-Labib/Problem-Solving-Topic-Wise | Graph/Striver/7. Dijkstra using Set (GfG).cpp | // https://bit.ly/3KeZZ7j
//{ Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution
{
public:
vector<int> dijkstra(int V, vector<vector<int>> adj[], int S)
{
vector<int> dist_ans(V, INT_MAX);
//set
set<pair<int, int>> st;
//ans ve... | ALGO | 0.999985 | 5.350096 |
52b37c2e-ce5b-48fb-8107-9da3a2e21e72 | aliciapaivaa/interview_study | loopsIfsManipulacaoDeString/array.cpp | #include <bits/stdc++.h>
using namespace std;
//1 - Dado um array A, o elemento X existe no array A?
bool xExistsInA(const string A, char x){
for(int i = 0; i < A.size(); i++){
if(A[i] == x){
return true;
}
}
return false;
}
//2 - Dada uma string S, a palavra P é substring de ... | ALGO | 0.999466 | 3.78926 |
af83f127-799e-42d1-9814-612131f46306 | moondemon68/cp | Kattis/ptice.cpp | #include <bits/stdc++.h>
using namespace std;
int main () {
string a,b,c;
a="";
b="";
c="";
for (int i=1;i<=1000;i+=3) {
a+="ABC";
}
for (int i=1;i<=1000;i+=4) {
b+="BABC";
}
for (int i=1;i<=1000;i+=6) {
c+="CCAABB";
}
int n;
cin >> n;
string s;
cin >> s;
int cnta=0,cntb=0,cntc=0;
for (int i=0;... | ALGO | 0.999982 | 4.508204 |
91318e3f-9519-4d40-8c56-1eed2347fb2c | pavel-ryzhov/global_vars | runs/005063.cpp | #include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
using namespace std;
typedef struct{
int begin;
int end;
int len;
int total;
} SHEAD;
typedef struct{
int top_1;
int top_2;
} SPAIR;
class CHEAD{
public:
int begin;
int end;
int len;
public:
CHEAD():begin(0), end(0), len(0) {};
C... | ALGO | 0.998073 | 3.386548 |
8eece1e8-6dbb-4337-8d13-629aa2035e7e | realguocheng/ComputerNetwork | mm3/mm3.cpp | #include <math.h>
#include <stdlib.h>
#include <iostream>
#include <stdio.h>
#include <queue>
#include <time.h>
#include <fstream>
#define QN 3
#define BASIC 20
#define packet_size 10000
#define Nbtime 0.03
#define N 20
using namespace std;
double lanmada = 1.0;//ֲ
double mu = 3.1;//ʱֲ
struct Packet
{
double arri... | ALGO | 0.999565 | 3.301855 |
e6d85312-9e48-4b5b-bf03-0762e15866ce | shimanshu16/LeetCode-Solved-Questions | 0278-first-bad-version/0278-first-bad-version.cpp | // The API isBadVersion is defined for you.
// bool isBadVersion(int version);
class Solution {
public:
int firstBadVersion(int n) {
int first = 1;
int last = n;
while (first < last) {
int mid = first + (last - first) / 2;
if (isBadVersion(mid)) {
l... | ALGO | 0.999806 | 6.797964 |
b0007c51-edc6-4ec1-ac20-dcebae02a806 | gunjanms/svnmigration | tortoisesvn-code/src/SVN/SVNLineDiff.cpp | // TortoiseMerge - a Diff/Patch program
const svn_diff_fns2_t SVNLineDiff::SVNLineDiff_vtable =
{
SVNLineDiff::datasources_open,
SVNLineDiff::datasource_close,
SVNLineDiff::next_token,
SVNLineDiff::compare_token,
SVNLineDiff::discard_token,
SVNLineDiff::discard_all_token
};
#define SVNLINEDIFF... | TOOL | 0.988862 | 6.417453 |
d5f07cc0-c516-4e15-8b97-1484592a05f4 | Stevejobjong/PS | 프로그래머스/2/43165. 타겟 넘버/타겟 넘버.cpp | #include <string>
#include <vector>
using namespace std;
int ans;
void dfs(int n, vector<int> v, int t,int sum) {
if (n >= v.size()){
if(t == sum)
ans++;
return;
}
dfs(n + 1, v, t, sum + v[n]);
dfs(n + 1, v, t, sum - v[n]);
}
int solution(vector<int> numbers, int target) {
dfs(0, numbers, target, 0);
re... | ALGO | 0.999934 | 5.384498 |
918f30b4-6785-4c22-b770-a82cedc34a68 | ricardovinicius/competitive-programming | cses/1071.cpp | //
// Created by Ricardo on 25/06/2025.
//
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
ll t;
cin>>t;
for (ll i = 0; i < t; i++)
{
ll y,x;
cin >> y >> x;
// Find upper row result based on column
// Pattern:
// if column is ... | ALGO | 0.999812 | 5.09051 |
a260fec2-a8bf-49b3-a191-637798fb8a97 | prasannabantu/Code-100-days | LC1380 Lucky Numbers in a Matrix.cpp | class Solution {
public:
vector<int> luckyNumbers (vector<vector<int>>& a) {
vector<int>srow;
vector<int>scol;
int m=a.size(); int n=a[0].size();
int maxi=0;
for(int i=0;i<m;i++)
{
srow.push_back(*min_element(a[i].begin(),a[i].end()));
}
/... | ALGO | 0.999723 | 5.42658 |
ecc51245-69c2-4842-b8a6-ae5abf18ddc6 | Nitinjiwnani/Data-Structures-and-Algorithms | arrays/code_two.cpp | //find the index of the smallest and largest value in an array
#include<iostream>
using namespace std;
int main(){
int size = 6, arr[size], smallest = INT_MAX, largest = INT_MIN, smallestIndex, largestIndex;
for(int i=0;i<size;i++){
cin>>arr[i];
}
for(int i = 0; i<size; i++){
if(arr[i]... | ALGO | 0.999008 | 3.531323 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.