uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
91c8d38f-8019-4821-b012-7cc18549bdf0 | matumoto1234/atcoder | abc/113/A/main.cpp | #include <bits/stdc++.h>
using namespace std;
#include <boost/range/adaptors.hpp>
using namespace boost::adaptors;
// {{{ templates
// clang-format off
// Macros
#define over_load_(_1,_2,_3,_4,NAME,...) NAME
#define rep(...) over_load_(__VA_ARGS__, rep4, rep3, rep2)(__VA_ARGS__)
#define rep2(i, r) for ( int i = 0; ... | ALGO | 0.999461 | 4.624498 |
2dc24f65-c609-4a1a-a8ac-62c3749cb432 | Eeman1113/Leetcode | Problems/2608.cpp | class Solution {
public:
int miceAndCheese(vector<int>& reward1, vector<int>& reward2, int k) {
// diffs[i] := reward1[i] - reward2[i].
vector<int> diffs;
for (int i = 0; i < reward1.size(); ++i)
diffs.push_back(reward1[i] - reward2[i]);
nth_element(diffs.begin(), diffs.begin() + k, diffs.end... | ALGO | 0.999835 | 5.710166 |
5bcba25e-724c-4ec4-936c-180fad8b348c | Denver44/CP-and-DSA-in-CPP | Competitive_Programming/58SALARYWITHBONUS.cpp | #include <iostream>
#include <string>
#include <iomanip>
using namespace std;
const int tax = 15;
int main()
{
string name;
cin >> name;
double salary;
double totalslae;
cin >> salary >> totalslae;
double res;
cout << setprecision(2) << fixed;
res = salary + (totalslae * tax / 100);
... | TOOL | 0.880628 | 4.612512 |
641274eb-c27a-4512-b78a-96f6572f6850 | ttrochez/cpp | Ejercicios/Tarea 8-Raiz Cuadrada/main.cpp | #include <iostream>
#include <math.h>
using namespace std;
int main(int argc, char const *argv[])
{
float num = 0;
float resultado = 0;
cout << "Ingrese el numero a calcular: ";
cin >> num;
resultado = (sqrt (num));
cout <<endl <<endl;
cout <<"La raiz cuadrada de: exit
" << num <<"... | ALGO | 0.970528 | 3.185761 |
b0846e9d-e4bc-47ee-a008-69999a390e46 | raaphat99/ProblemSolving | Reverse Integer.cpp | class Solution {
public:
int reverse(int x) {
// Handle an edge case when x = -2147483648
if (x == numeric_limits<int>::min())
return 0;
bool negative = (x < 0);
int remainder, reversedNum=0;
x = abs(x);
while(x) {
remainder = x % 10;
... | ALGO | 0.999902 | 6.137318 |
f4f2a3af-90be-406f-aa17-5568b01042bd | jkinggu/faceRecognition | opencv/sources/3rdparty/carotene/src/convolution.cpp | #include "common.hpp"
#include "saturate_cast.hpp"
namespace CAROTENE_NS {
bool isConvolutionSupported(const Size2D &size, const Size2D &ksize,
BORDER_MODE border)
{
return isSupportedConfiguration() && size.width >= 8 &&
(border == BORDER_MODE_CONSTANT ||
border ==... | ALGO | 0.979985 | 6.337611 |
694df53c-cfa4-4f87-bbed-c2f60ec0497e | stackwild/gogogadget | leetcodes/933. Number of Recent Calls/933.cpp | class RecentCounter {
public:
int ping(int t) {
q.push(t);
while (q.front() < t - 3000)
q.pop();
return q.size();
}
private:
queue<int> q;
};
| ALGO | 0.987869 | 6.695617 |
efb1e136-5384-46ef-9ebc-bf25baf57cdb | Abhil-ekh/DSA | 1Stack/infixtoprefix.cpp | #include<iostream>
#include<cstring>
#include<cctype>
#define MAX 20
using namespace std;
class Stack {
private:
char a[MAX];
int top;
public:
Stack() {
top=-1;
}
bool isEmpty() {
return (top==-1);
}
void push(char item) {
if(top==MAX-1)
cout<<endl<<"Stack overflow"<<endl;
else
a[++... | ALGO | 0.999915 | 4.683418 |
fa5e1ebb-cbaa-449e-9c4c-1a6cdbe526ea | tetrisroyale/a_tetrisroyale_godot_3.1 | thirdparty/bullet/BulletCollision/CollisionShapes/btMultiSphereShape.cpp | #if defined(_WIN32) || defined(__i386__)
#define BT_USE_SSE_IN_API
#endif
#include "btMultiSphereShape.h"
#include "BulletCollision/CollisionShapes/btCollisionMargin.h"
#include "LinearMath/btQuaternion.h"
#include "LinearMath/btSerializer.h"
btMultiSphereShape::btMultiSphereShape(const btVector3* positions, const bt... | TOOL | 0.910699 | 7.286427 |
24ebe01f-c6b5-439f-a0d0-6ba83d9ae5dd | vishalrangras/P10-Model-Predictive-Control | src/Eigen-3.3/unsupported/doc/examples/PolynomialUtils1.cpp | #include <unsupported/Eigen/Polynomials>
#include <iostream>
using namespace Eigen;
using namespace std;
int main()
{
Vector4d roots = Vector4d::Random();
cout << "Roots: " << roots.transpose() << endl;
Eigen::Matrix<double,5,1> polynomial;
roots_to_monicPolynomial( roots, polynomial );
cout << "Polynomial:... | ALGO | 0.995877 | 3.999627 |
a182de1d-622c-4e0b-ad51-ff0d7eef76aa | SAURABHMISHRA55/CPP-Striver-A2Z | Step_16_Dynamic_Programming/07. DP ON MCM/DP-46-MATRIX-CHAIN-MULTIPLICATION.CPP | #include <bits/stdc++.h>
using namespace std;
class Solution {
public:
int recursion (int arr[], int i , int j) {
// base condition
if(i == j) {
return 0 ;
}
int mini =INT_MAX ;
for(int k = i ; k < j ; k++) {
int curr = (arr[i-1] * arr[k] * arr[j]) + ... | ALGO | 0.999987 | 4.266547 |
669682ac-f07c-4a4b-8941-0f3c8d4b7ffe | ishandutta2007/codeforces | wygzgyw/normal/1709/B.cpp | // wygzgyw
#include <bits/stdc++.h>
using namespace std;
template <typename T> void read(T &t) {
t=0; char ch=getchar(); int f=1;
while (ch<'0'||ch>'9') { if (ch=='-') f=-1; ch=getchar(); }
do { (t*=10)+=ch-'0'; ch=getchar(); } while ('0'<=ch&&ch<='9'); t*=f;
}
template <typename T> void write(T t) {
if (t<0) { put... | ALGO | 0.999964 | 4.177702 |
eeef03f2-3566-457a-8eb7-6105f59a8975 | ishandutta2007/codeforces | anta.baka/normal/314/A.cpp | #include <bits/stdc++.h>
using namespace std;
#define sz(a) (int)((a).size())
#define all(a) (a).begin(), (a).end()
using ll = long long;
const int mod = 1e9 + 7;
int main() {
ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
//freopen("in.txt", "r", stdin);
int n, k; cin >> n >> k;
int sub = 0;
ll... | ALGO | 0.999994 | 3.778959 |
2d55366d-c894-45d2-b764-92aa7c5ebfe1 | iPiyushJaiswal/codingPlatform | codePOD/2023/10October/D03M10Y2023/LeetCodeD03M10Y2023POD.cpp | /*Problem LeetCode (Easy)
1512. Number of Good Pairs
Question link: https://leetcode.com/problems/number-of-good-pairs/description/?envType=daily-question&envId=2023-10-03
Logic: Maths
-------------------------
Complexity:
Method 1: Maths
Time Complexity=O(n)
Space Complexity=O(n)
--------------------------... | ALGO | 0.99996 | 6.010519 |
5a6d418d-148a-4c93-9646-92777066a577 | bochen0909/pyoslom | cpp/dir_oslom_net_global.cpp | #include "set_parameters.h"
#include "directed_oslomnet_evaluate.h"
#include "dir_oslom_net_global.h"
namespace oslom{
extern Parameters *paras;
namespace dir{
oslom_net_global::oslom_net_global(map<int, map<int, pair<int, double> > > & A) : oslomnet_evaluate(A) {
}
oslom_net_global::oslom_net_global(int_matrix & ... | ALGO | 0.959426 | 4.49903 |
2fefe207-0e11-448f-8282-e12442e58d21 | lych4o/competitive-programming | vjudge/hdu/1402/lych.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const int mod = 119 << 23 | 1;
const int G = 3;
int wn[20];
int qpow(int x, int k){
int ret = 1;
while(k > 0){
if(k&1) ret = 1LL*ret*x%mod;
x = 1LL*x*x%mod;
k >>= 1;
}
return ret;
}
void getwn(){ // 千万不要忘记
... | ALGO | 0.999935 | 3.659125 |
17e93d3b-0c6a-4879-a891-a4ed2854eeae | korinVR/DeltaStrider | CollisionDetection/CollisionDetector.cpp | #include "CollisionDetector.h"
#include "../Entity/GameObject.h"
vector<CollisionBall> CollisionDetector::m;
vector<CollisionBall> CollisionDetector::n;
void CollisionDetector::Clear()
{
m.clear();
n.clear();
}
void CollisionDetector::RegisterM(const CollisionBall& ball)
{
m.push_back(ball);
}
void Col... | ALGO | 0.92137 | 4.373055 |
759d21a4-9d33-42c0-9c88-4726e3ed4001 | WGZ-W/algorithm- | hello-algo/codes/cpp/chapter_dynamic_programming/coin_change.cpp | /**
* File: coin_change.cpp
* Created Time: 2023-07-11
* Author: krahets (<EMAIL>)
*/
#include "../utils/common.hpp"
/* 零钱兑换:动态规划 */
int coinChangeDP(vector<int> &coins, int amt) {
int n = coins.size();
int MAX = amt + 1;
// 初始化 dp 表
vector<vector<int>> dp(n + 1, vector<int>(amt + 1, 0));
// 状... | ALGO | 0.999958 | 6.195321 |
5d4c4be0-a179-44c0-94f2-2d2814c42f45 | jiyeon2781/algorithm-practice | Baekjoon/Gold/11000.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
using namespace std;
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int N;
cin >> N;
vector<pair<int, int>> lists;
int s, t;
while (N--) {
cin >> s >> t;
lists.push_back({... | ALGO | 0.999969 | 5.160859 |
d1dcbf3d-16a1-4e14-81b7-a86997a1f85b | ACSOP/android_external_quake | quake/src/WinQuake/d_polyse.cpp | // d_polyset.c: routines for drawing sets of polygons sharing the same
// texture (used for Alias models)
#include "quakedef.h"
#include "r_local.h"
#include "d_local.h"
// TODO: put in span spilling to shrink list size
// !!! if this is changed, it must be changed in d_polysa.s too !!!
#define DPS_MAXSPANS MAXHEIG... | ALGO | 0.985053 | 4.444685 |
6152d787-52ca-41d7-954a-c6a08ba687e4 | Jhonisnotreal/CPP | Funciones/E25.cpp | //Recursividad
// Factorial de 5! = 120
#include<iostream>
using namespace std;
int factorial(int);
int main(){
cout<<"Factorial: "<<factorial(3)<<endl;
return 0;
}
int factorial(int n){
if(n==0){
n = 1;
}
else {
n *= factorial(n-1);
}
return n;
} | ALGO | 0.999302 | 3.986352 |
8ef896c4-0296-47ae-878f-5f6319dc714e | Narayan1309/DSA | Binary Search/Pivot.cpp | #include<iostream>
using namespace std;
int getPivot(int arr[], int n) {
int s = 0;
int e = n-1;
int mid = s + (e-s)/2;
while(s<e) {
if(arr[mid] >= arr[0])
{
s = mid+1;
}
else{
e = mid;
}
mid = s + (e-s)/2;
}
return s;
... | ALGO | 0.999928 | 5.829756 |
7e9590f1-a8de-480a-ab6e-6067b1569f71 | ryanberryhill/pme | src/pme/minimization/brute_force.cpp | #include "pme/minimization/brute_force.h"
namespace PME
{
BruteForceMinimizer::BruteForceMinimizer(VariableManager & vars,
const TransitionRelation & tr,
const ClauseVec & proof)
: ProofMinimizer(vars, tr, proof),
... | ALGO | 0.999059 | 6.560381 |
9d32c20d-573d-4c18-991b-8b57a54c1813 | JamesL425/Chess-AI | main/AI/move_generator/position.cpp | //
// Created by jimbo on 31/07/2022.
//
#include "position.h"
Position::Position() {
board = {Piece::R, Piece::N, Piece::B, Piece::Q, Piece::K, Piece::B, Piece::N, Piece::R,
Piece::P, Piece::P, Piece::P, Piece::P, Piece::P, Piece::P, Piece::P, Piece::P,
Piece::x, Piece::x, Piece::x, Pie... | ALGO | 0.870461 | 5.51127 |
878bfa93-9196-4491-9e12-bc01739e2d9e | AyushAg06/coding | tuf_practice/array_7.cpp | // rotate array by d places to the left
#include<bits/stdc++.h>
using namespace std;
void reverseArray(vector<int>& nums, int start, int end)
{
while (start < end) {
swap(nums[start], nums[end]);
start++;
end--;
}
}
void rotate(vector<int>& nums, int k) {
int n = nums.size();
//... | ALGO | 0.999993 | 5.85042 |
efb2c2cb-d1d3-44f7-9c42-95b4da64b4eb | jun113/swKokkos | LICOM/kokkos/swKokkos-4.1.00-opt/example/tutorial/launch_bounds/launch_bounds_reduce.cpp | #include <Kokkos_Core.hpp>
#include <cstdio>
//
// First reduction (parallel_reduce) example:
// 1. Start up Kokkos
// 2. Execute a parallel_reduce loop in the default execution space,
// using a functor to define the loop body
// 3. Shut down Kokkos
//
struct collision {
// Reduction functor
// For eac... | ALGO | 0.98057 | 5.834693 |
4e8ff118-8e3f-40ee-993f-9b068e547a65 | Khush786Mohammad/Data-Structures-and-Algorithms | Sorting/Quick Sort/Lomuto.cpp | #include<iostream>
#include<vector>
using namespace std;
int partition(vector<int>&nums , int lb , int ub)
{
int pivot = nums[ub];
int i = lb;
for(int j = lb ; j<ub; j++)
{
if(nums[j] < pivot)
{
swap(nums[i],nums[j]);
i++;
}
}
swap(nums[ub],nums[... | ALGO | 0.999984 | 5.070769 |
c49361c4-8447-4fa7-b030-a0dbfc9b0202 | mfaisalghozi/competitive-programming-stuff | point.cpp | #include<stdio.h>
int main(){
int t,n,x,y;
scanf("%d",&t);
int first,second,third,fourth,nothing;
for(int l=0;l<t;l++){
scanf("%d",&n);
first=0,second=0,third=0,fourth=0,nothing=0;
for(int p=0;p<n;p++){
scanf("%d %d",&x,&y);
if(x>=0 && y>=0) first++;
else if(x<=0 && y>=0) second++;
else if(x>=0 &... | ALGO | 0.999912 | 3.262038 |
a9b6f526-2c66-496c-bf6e-196273f357e2 | Nakib-Arman/CSE318---ArtificialIntelligence | 4.DecisionTree/.history/decision_tree_20250705122014.cpp | #include<bits/stdc++.h>
using namespace std;
float getEntropy(vector<vector<string>>& dataset,unordered_set<string>& decisions)
{
float entropy=0;
vector<string> decisions_vect;
vector<int> count(decisions.size(),0);
for(string decision : decisions){
decisions_vect.push_back(decision);
}
... | ALGO | 0.990131 | 5.337191 |
92cf641f-eb95-455c-9ad8-d22bafe6ff50 | wndlthsk/algorithm-study | week02/김주성/6593_김주성.cpp | #include<string>
#include<iostream>
#include<vector>
#include<algorithm>
#include<tuple>
#include<queue>
using namespace std;
int dx[6]={1,-1,0,0,0,0};
int dy[6]={0,0,1,-1,0,0};
int dz[6]={0,0,0,0,1,-1};
int main(){
while(true)
{
int x=0;
queue<tuple<int,int,int>> q;
bool printed=false;
... | ALGO | 0.99983 | 4.062767 |
d81a500a-6168-48a5-8776-0f59bd485051 | CoronaEngine/Vision | src/ext/ispc-v1.20.0-windows/examples/xpu/simple-usm/simple-usm.cpp | #include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
// ispcrt
#include "ispcrt.hpp"
std::ostream &operator<<(std::ostream &os, const ISPCRTDeviceType dt) {
switch (dt) {
case ISPCRT_DEVICE_TYPE_AUTO:
os << "Auto";
break;
case ISPCRT_DEVICE_TYPE_GPU:
os << "... | TOOL | 0.862385 | 5.963548 |
b1c46fec-5ec6-449c-9444-7c8af8410692 | AMReX-Astro/Castro | Source/mhd/mhd_ppm.cpp | #include <Castro.H>
#include <ppm.H>
using namespace amrex;
#include <mhd_eigen.H>
void
Castro::ppm_mhd(const Box& bx,
const int idir,
Array4<Real const> const& q_arr,
Array4<Real const> const& qaux,
Array4<Real const> const& flatn,
Arr... | ALGO | 0.999489 | 4.400274 |
66aee52b-1d8b-4601-893f-b2ca79e737cd | Chillee/CompProgramming | archive/Cornell10.13.2018/E/main.cpp | #include <bits/stdc++.h>
#define endl '\n';
using namespace std;
const int MAXN = 505;
int N, M, Q;
bool board[MAXN][MAXN];
int color[MAXN][MAXN];
bool isValid(int r, int c) { return r >= 0 && c >= 0 && r < N && c < M; }
void flood(int r, int c, int clr) {
if (color[r][c] != -1)
return;
vector<array<i... | ALGO | 0.998461 | 5.149921 |
b9f7a643-f0b9-4c7c-87a4-dd6f16f14598 | gjenfwo/sml-project | fuzzylite/fuzzylite/src/defuzzifier/WeightedDefuzzifier.cpp | #include "fl/defuzzifier/WeightedDefuzzifier.h"
#include "fl/term/Activated.h"
#include "fl/term/Concave.h"
#include "fl/term/Constant.h"
#include "fl/term/Function.h"
#include "fl/term/Linear.h"
#include "fl/term/Ramp.h"
#include "fl/term/Sigmoid.h"
#include "fl/term/SShape.h"
#include "fl/term/ZShape.h"
namespace f... | ALGO | 0.989948 | 6.477939 |
e7d93bf0-deec-4ebe-b506-a9bd698dc14a | Zhanghq8/Leetcode_notes | 78_Subsets/submission1.cpp | #include <iostream>
#include <string>
using namespace std;
class Solution {
public:
vector<vector<int>> subsets(vector<int>& nums) {
vector<vector<int>> result;
vector<int> output;
helper(result, output, nums, 0);
return result;
}
private:
void helper(vector<vector<int>>& r... | ALGO | 0.999889 | 6.012498 |
d708cdec-8100-491a-b24e-971f068495c9 | yopio/aoj | 0231.cpp | #include <iostream>
#include <algorithm>
using namespace std;
int n,m[100],a[100],b[100];
bool ans;
int main(void){
while( cin >> n , n ){
for( int i = 0 ; i < n ; i++ ){
cin >> m[i] >> a[i] >> b[i];
}
ans = false;
for( int i = 0 ; i < n ; i++ ){
int c = m[i];
for( int j = 0 ;... | ALGO | 0.98767 | 3.816989 |
e5b8581a-956e-4d17-845c-df582de03688 | ishandutta2007/codeforces | thebes/normal/629/C.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
typedef vector<int> vi;
#define pb push_back
const int MN = 2005, mod = 1e9+7;
int dp[MN][MN], n, m, i, j, t, r, ans;
string s;
int main(){
cin >> n >> m >> s;... | ALGO | 0.999984 | 4.197506 |
45e6620d-3456-4507-a056-da342715261e | mrron313/Programming | LeetCode/FlippingImage.cpp |
#include<bits/stdc++.h>
using namespace std;
vector<vector<int> > flipAndInvertImage(vector<vector<int> >& A) {
int row = A.size();
int col;
vector<vector<int> > B;
for( int i=0 ; i<row ; i++ ){
col = A[i].size();
vector<int> Elements;
for( int j=col-1 ; j>=0 ; j-- ){
if(A[i][j]==0)
Element... | ALGO | 0.999832 | 3.548516 |
2215da75-6452-45b9-a22d-8e9f032d2a7f | 4SohyunChoi4/PSAlgorithm | 17682.cpp | #include <string>
#include <algorithm>
#include <ctype.h>
#include <vector>
#include <iostream>
using namespace std;
int solution(string dartResult) {
int answer = 0;
vector<int>::iterator iter;
vector<int> num;
string num_str="";
for(int i=0 ; i < dartResult.size();i++){
if(isdigit(dartRe... | ALGO | 0.999519 | 4.494545 |
654f7196-49f1-4204-bacf-b349e44a64be | Davi-Bernardo761/My-learning-process-in-C-plus-plus | loopExercise6.cpp | //This program prints all number from 10 down to 0.
#include <iostream>
#include <string>
using namespace std;
int main (){
for (int counter = 10; counter >=0; counter--){
cout<<counter<<endl;
}
return 0;
}
| TOOL | 0.913293 | 3.180804 |
7bb07696-145c-4bf9-b4f8-31d56807a413 | MarianaLagrava/repositorio | Parydivisible3.cpp | #include <iostream>
#include <string>
using namespace std;
int main (void)
{
int n, txt;
string resp;
cout << endl;
cout << "PAR Y divisible entre 3"<<endl;
cout << "Digite un valor: ";
cin >> n;
txt = (n%3 == 0) && (n%2==0) ;
cout <<"Es "<< n << " par y divisible entre 3?" <... | ALGO | 0.999188 | 3.552187 |
e1028115-2221-4e1c-8ba9-9ed87fca4a1d | Surajvatsya/Leetcode | 2181-merge-nodes-in-between-zeros/2181-merge-nodes-in-between-zeros.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
ListNode* mergeNodes(... | ALGO | 0.99994 | 4.801283 |
8f82a2a1-8916-4b6d-a3ee-5d42a9ae605e | rishii3468/DSA | dp-practice/kCoins.cpp | #include<iostream>
#include<vector>
using namespace std;
int main(){
int k,l,m;
cin>>k>>l>>m;
vector<bool>dp(1000005);
dp[1] = 1;
dp[k] = 1;
dp[l] = 1;
for(int i=2;i<=1000000 ;i++){
if(i==l || i == k) continue;
dp[i] = !(dp[i-1] && (i-k<0? 1: dp[i-k]) && (i-l<0? 1 : dp[i-... | ALGO | 0.999964 | 3.859878 |
dedd4ff6-72dc-4bc3-af6e-e6d26ad26e84 | siosio34/AlgorithmStudy | z_unclassified/2789.cpp17.cpp | #include <iostream>
#include <string>
using namespace std;
int main() {
string cStr = "CAMBRIDGE";
string s;
cin >> s;
for(int i = 0 ; i < s.size() ; i++) {
bool check = false;
for(int j= 0 ; j <cStr.size() ; j++) {
if(s[i] == cStr[j]) {
check = true;
}
}
if(!check) cout << s[i];
}
} | ALGO | 0.999889 | 3.244205 |
ce16ca3a-3eaf-46e8-899a-75390b3955dc | GaryDoooo/ml_codes | cross/cpp/test_atan2.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
cout << atan2(1, 0) << endl;
cout << atan2(-1, 0) << endl;
cout << atan2(0, 1) << endl;
cout << atan2(0, -1) << endl;
}
| ALGO | 0.988912 | 3.999783 |
f3ecdd04-48fb-44b8-ada1-23b708be3a61 | Griestopff/squid | src/main.cpp | #include <iostream>
#include <chrono>
#include <fstream>
#include <opencv2/opencv.hpp>
#include "../lib/CLI/CLI11.hpp"
#include "../lib/nlohmann/json.hpp"
#include "HyperstackImage.h"
#include "PSF.h"
#include "PSFGenerator.h"
#include "GaussianPSFGeneratorAlgorithm.h"
#include "DeconvolutionAlgorithm.h"
#include "RLD... | TOOL | 0.912138 | 3.530818 |
3a5de721-4216-4b3c-b769-e65b145854f7 | toufique-imam/SOLVED-PROBLEMS | LightOJ/LOJ 1201.cpp | #include<bits/stdc++.h>
//#include<unordered_map>
//#include<unordered_set>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
/*
using namespace __gnu_pbds;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node... | ALGO | 0.999845 | 4.510484 |
7e59fdd9-d63b-4f6c-88c6-0e681692a4f6 | liviu-liviu/pseudocode | UVa Online Judge/Bipartite Graph/Bicoloring (10004)/BFS Coloring.cpp | #include <bits/stdc++.h>
using namespace std;
#define white 0
#define black 1
class Graph
{
vector<vector<int>> adj;
int vertex;
public:
Graph(int vertex);
bool isBiPartite();
void addEdge(int u, int v);
};
Graph :: Graph(int vertex)
{
this->vertex = vertex;
adj.resize(vertex);
}
void Graph :: addEdge(int... | ALGO | 0.999502 | 5.312074 |
1002afce-48a4-4476-81cf-8bd16be8e36b | manikanta2901/ubuntu | .history/imp/cpp/Algorithm/binaryExponentiation_20200715142151.cpp | #include<bits/stdc++.h>
using namespace std;
int bruteForce(int n,int base){
// to raise the given base ntimes
int temp =1;
for(int i = 0; i < n; i++){
temp = temp * base;
}
return temp;
}
int main(){
return 0;
} | ALGO | 0.999955 | 4.009196 |
233606ae-0ebc-49db-9844-848f89d2bf94 | kamilszymczak1/my_solutions | poi/VI/gra_w_wielokaty.cpp | #include <algorithm>
#include <iostream>
using namespace std;
bool IsExterior(int *arr, int n);
int main() {
ios_base::sync_with_stdio(0);
int n, arr[3];
cin >> n;
for(int i = 0; i < 3; i++)
cin >> arr[i];
if(IsExterior(arr, n))
cout << "TAK\n";
else
... | ALGO | 0.999914 | 4.810423 |
2ba51500-7121-4534-9711-9d44a8fb690f | purnamrita/LC | 0104-maximum-depth-of-binary-tree/0104-maximum-depth-of-binary-tree.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.999541 | 6.426899 |
13315683-fef8-4e1d-9918-be73b207a3cf | umeng/cocos2dx_Component_lua | frameworks/cocos2d-x/cocos/math/CCVertex.cpp | #include "math/CCVertex.h"
#include "base/ccMacros.h"
NS_CC_BEGIN
void ccVertexLineToPolygon(Vec2 *points, float stroke, Vec2 *vertices, unsigned int offset, unsigned int nuPoints)
{
nuPoints += offset;
if(nuPoints<=1) return;
stroke *= 0.5f;
unsigned int idx;
unsigned int nuPointsMinus = nuPoin... | ALGO | 0.994514 | 5.81487 |
47483ec7-895e-4724-8b6b-d5d56068726f | Weil0ng/pintool | source/tools/ToolUnitTests/inlined-stack-arg1.cpp | #include <cstdio>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <fstream>
#include <cstdlib>
#ifdef TARGET_LINUX
#include <unistd.h>
#include <sys/syscall.h>
#include <errno.h>
# ifdef TARGET_IA32E
# include <asm/prctl.h>
# include <sys/prctl.h>
# endif // TARGET_IA32E
#endif // TARGET_LINUX
#inc... | TOOL | 0.868928 | 5.217174 |
3388d40d-da38-41be-a8a7-a88d60f4ebba | SaineeNihar/Searching | FindIn2D.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
vector<vector<int>> a{{1,2,3,4,5},
{6,7,8,9,10},
{11,12,13,14,15},
{16,17,18,19,20},
{21,22,23,24,25}};
int x=15;
int n=5;
int p=-1,q=-1;
... | ALGO | 0.999354 | 4.141104 |
6ceb38c2-4aa1-4e0d-bda2-38b3959bea23 | pkduy2006/CVA | pttt/cvahn_dt23_23bosotgc.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 1e4 + 16, M = 1e7 + 16;
int n, a[N], cnt[M];
long long res;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
freopen("Bai3.inp","r",stdin);
freopen("Bai3.out","w",stdout);
cin >> n;
for(int i = 1; i <= n; i... | ALGO | 0.999888 | 3.881829 |
adbb86f7-8551-4644-8ef5-ddbfa44365fe | yeobi01/Algorithm | 큰돌_C++/3주차_완전탐색_백트래킹/3M_2529.cpp | #include <bits/stdc++.h>
using namespace std;
const int INF = 987654321;
const int MAX = 1501;
int k, visited[10];
char arr[10];
vector<int> v;
vector<vector<int>> ret;
void DFS(int x, int n){
if(v.size() == k + 1){
/*
for(int ret : v){
cout << ret;
}
cout << "\n";
... | ALGO | 0.999982 | 3.523774 |
d1778d6d-a6f7-4022-ac8a-98d12adccdde | Amanzhol-1/ADS_KBTU | LAB 2/k.cpp | #include <iostream>
#include <map>
using namespace std;
struct Node {
char val;
Node* next;
Node() {}
Node(char val) {
this->val = val;
next = NULL;
}
};
void push(Node* &end, Node* &head, int val) {
if(end == NULL) {
head = new Node(val);
end = head;
... | ALGO | 0.99953 | 4.5218 |
8541d06b-be98-493e-b985-f856044a3c76 | Deiolly/GameGuruMAX | GameGuru Core/SDK/BULLET/bullet-3.19/src/BulletCollision/Gimpact/btGImpactQuantizedBvh.cpp | /*! \file gim_box_set.h
\author Francisco Leon Najera
*/
#include "btGImpactQuantizedBvh.h"
#include "LinearMath/btQuickprof.h"
#ifdef TRI_COLLISION_PROFILING
btClock g_q_tree_clock;
float g_q_accum_tree_collision_time = 0;
int g_q_count_traversing = 0;
void bt_begin_gim02_q_tree_time()
{
g_q_tree_clock.reset();
}... | ALGO | 0.998919 | 7.131923 |
fe831c98-5fd8-4d85-80a5-60a37cf8f3dd | sarvex/leetcode-giz | solution/2000-2099/2043.Simple Bank System/Solution.cpp | class Bank {
public:
vector<long long> balance;
int n;
Bank(vector<long long>& balance) {
this->balance = balance;
n = balance.size();
}
bool transfer(int account1, int account2, long long money) {
if (account1 > n || account2 > n || balance[account1 - 1] < money) return fa... | ALGO | 0.998599 | 5.461759 |
ec7adf3d-5d32-4be6-87a5-15cf5950d85e | Meantint/Baekjoon | Bronze III/BOJ_10871/BOJ_10871.cpp | #include <iostream>
#include <vector>
using namespace std;
int n, x;
vector<int> info;
int main()
{
cin >> n >> x;
info.resize(n);
for (int i = 0; i < n; ++i) {
cin >> info[i];
}
vector<int> answer;
for (int i = 0; i < n; ++i) {
if (info[i] < x) {
answer.push_bac... | ALGO | 0.99998 | 3.745532 |
2ff5557c-4b03-46e5-803c-d083e2135489 | n17y17/kyou_pro_history | At_coder/abc/abc322/abc322_c copy.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
int main()
{
int n, m;
vector<int> a;
cin >> n >> m;
int tmp;
rep(i, m)
{
std::cin >> tmp;
a.push_back(tmp);
}
vector<int> ans(n);
int count = 0;
for (int i=n-1; i... | ALGO | 0.999994 | 3.981839 |
84b1e960-692f-4a32-8689-e7b26ae78907 | MGsus/Competitive-Programming | Submit Error UPB/710A King Moves.cpp | #include <bits/stdc++.h>
using namespace std;
char c;
char d;
int r = 0;
int main(int argc, char const *argv[]) {
cin >> c >> d;
if (c == 'a' || c == 'h')
r++;
if (d == '1' || d == '8')
r++;
if (r == 2)
r++;
if (r == 1)
r += 4;
if (r == 0)
r = 8;
c... | ALGO | 0.999435 | 3.060714 |
711d84fb-be15-441c-9f03-3c5d6bdbef95 | zgpeace/LeetCodeJustDoIt | src/1325-Delete-Leaves-With-a-Given-Value/1325.cpp | class Solution
{
public:
TreeNode* removeLeafNodes(TreeNode* root, int target)
{
if (root == nullptr) return nullptr;
root->left = removeLeafNodes(root->left, target);
root->right =removeLeafNodes(root->right, target);
return root->val == target && root->left == root->right ? n... | ALGO | 0.999729 | 6.762879 |
3a5debb5-2db1-4649-8c45-67b0dfad83ed | nayemuddinn/Competitive-programming | Codeforces/Arena 1487A.cpp | /**
.
author-> NATE
.
**/
#include<bits/stdc++.h>
using namespace std;
#define first_in_out ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define For(i,n) for(int i=0;i<n;i++)
#define For2(i,n) for(int i=1;i<=n;i++)
#define For3(i, j, n) for (int i = j; i <= n; i++)
#... | ALGO | 0.999541 | 4.419849 |
f13defbf-8ed0-4e17-b835-a7bceb043df2 | Mwanyi/boost_searcher | dir_tool/boost_1_81_0/libs/msm/doc/PDF/examples/iPodSearchEuml.cpp | // same as iPodSearch.cpp but using eUML
// requires boost >= v1.40 because using mpl::string
#include <vector>
#include <iostream>
#include <boost/msm/back/state_machine.hpp>
#include <boost/msm/front/euml/euml.hpp>
#include <boost/msm/front/euml/stl.hpp>
using namespace std;
using namespace boost::msm::front::euml... | ALGO | 0.985223 | 5.675474 |
67dc4c0c-04cb-42cf-a853-46da9a6eefc4 | Refstop/icp_lidar | 3rdparty/eigen/unsupported/doc/examples/MatrixSine.cpp | #include <unsupported/Eigen/MatrixFunctions>
#include <iostream>
using namespace Eigen;
int main()
{
MatrixXd A = MatrixXd::Random(3,3);
std::cout << "A = \n" << A << "\n\n";
MatrixXd sinA = A.sin();
std::cout << "sin(A) = \n" << sinA << "\n\n";
MatrixXd cosA = A.cos();
std::cout << "cos(A) = \n" << cos... | ALGO | 0.982366 | 5.878768 |
446e5965-51a5-4d43-accd-7466481fdcd4 | ivangalbans/leetcode | src/0088.cpp | // https://leetcode.com/problems/merge-sorted-array/description/
// Memory O(m + n)
class Solution
{
public:
void merge(vector<int> &nums1, int m, vector<int> &nums2, int n)
{
vector<int> temp(m + n);
int index = 0;
int l = 0, r = 0;
while (l < m && r < ni)
temp[in... | ALGO | 0.999947 | 5.832531 |
58b39560-ee8d-4241-8410-6bbb761afcfd | charul124/100_days_code | Easy/Armstrong Numbers/armstrong-numbers.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:
string armstrongNumber(int n) {
// code here
string numStr = to_string(n);
int sum = 0;
for(char c : n... | ALGO | 0.999221 | 5.932279 |
d8df77ff-6231-4c3c-a734-7a2ad31199d4 | Gocoderunav/LeetCode-Questions | 1677-matrix-diagonal-sum/matrix-diagonal-sum.cpp | class Solution {
public:
int diagonalSum(vector<vector<int>>& mat) {
int result =0;
int n =mat.size();
for (int i=0 ;i<n ;i++){
result+= mat[i][i];
result+=mat[i][n-1-i];
}
return result - ((n % 2==1)? mat[n/2][n/2] :0);
}
}; | ALGO | 0.999969 | 5.868101 |
d22cdc1a-3233-4369-91b8-470c3ac0e15c | ishandutta2007/codeforces | rush_d_cat/normal/633/G.cpp | #include <iostream>
#include <bitset>
#include <vector>
using namespace std;
const int M=1000;
int n,q,m;
int prime[M],vis[M];
void init(){
for(int i=2;i<M;i++){
if(vis[i]==0) {
prime[++prime[0]]=i;
}
for(int j=2*i;j<M;j+=i) vis[j]=1;
}
}
const int N=100000+10;
typedef bitset... | ALGO | 0.999868 | 4.370826 |
95327849-a6dc-4e19-b934-320fb6da224e | ARPANARIT/Data-Structures-using-Cpp | Recursion/permutationString.cpp | #include<iostream>
#include<vector>
#include<set>
using namespace std;
void permutation(int idx,string str,set<string> &st){
//base
if(idx==str.size()){
st.insert(str);
return;
}
for(int j=idx;j<str.size();j++){
swap(str[idx],str[j]);
permutation(idx+1,str,st);
... | ALGO | 0.999988 | 4.898272 |
2edd7449-17b5-46d5-8e64-ebfd4923e212 | silence0201/iOS-Reverse | Obfuscator/Source/tools/clang/lib/StaticAnalyzer/Core/Z3ConstraintManager.cpp | #include "clang/Basic/TargetInfo.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/SMTConstraintManager.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/SMTConv.h"
#include "clang/Co... | TOOL | 0.943488 | 3.466725 |
30601888-9da8-46e5-959f-2a32a65bbd21 | kmjp/procon | yuki/2301-2400/2328.cpp | #include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define FORR2(x,y,arr) for(auto& [x,y]:arr)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define ... | ALGO | 0.999185 | 3.792912 |
6deb7236-bf12-4397-8b6f-7bf247bcf6bc | ishandutta2007/codeforces | macesuted-moe/normal/839/C.cpp | /**
* @author Macesuted
*
* @copyright Copyright (c) 2021
*
*/
#include <bits/stdc++.h>
using namespace std;
namespace io {
#define SIZE (1 << 18)
char ibuf[SIZE], *iS, *iT, obuf[SIZE], *oS = obuf, *oT = oS + SIZE - 1, c, qu[55];
int f, qr;
inline void flush(void) {
fwrite(obuf, 1, oS - obuf, stdout);
... | ALGO | 0.99912 | 4.010585 |
bcb34841-2a25-4950-a09a-8558fddd5e0f | Arj-Patel/CodingNinjasCPP | Binary Trees/level_order_traversal.cpp | #include <iostream>
#include <queue>
template <typename T>
class BinaryTreeNode
{
public:
T data;
BinaryTreeNode<T> *left;
BinaryTreeNode<T> *right;
BinaryTreeNode(T data)
{
this->data = data;
left = NULL;
right = NULL;
}
};
using namespace std;
#include <queue>
void p... | ALGO | 0.999991 | 5.698834 |
af715d3f-bdee-4b00-adea-290fab7c6b70 | its-cr7/LeetCode-V2 | 2054-the-number-of-the-smallest-unoccupied-chair/2054-the-number-of-the-smallest-unoccupied-chair.cpp | class Solution {
public:
int smallestChair(vector<vector<int>>& times, int tf) {
int n = times.size();
vector<pair<pair<int, int>, int>> events;
for (int i = 0; i < n; i++) {
events.push_back({{times[i][0], 1}, i});
events.push_back({{times[i][1], -1}, i});
... | ALGO | 0.99998 | 6.29316 |
06d5dc89-ecf4-48d8-82fc-d7b3001ed8b4 | Ura3535/SEM4_Algorithmics | number-theory/HW/0033.cpp | #include <iostream>
#include <bitset>
#include <vector>
#include <string>
#include <algorithm>
void compute_favorite_numbers(std::vector<int>& favorite_numbers) {
std::bitset<500001> sieve;
sieve.reset();
for (long long i = 2; i <= 500000; i++) {
if (!sieve[i]) {
if (std::to_string(i).f... | ALGO | 0.999574 | 4.910345 |
79117285-2d53-44b6-a20c-6d4158145f91 | ishandutta2007/codeforces | cyanic/normal/1279/C.cpp | #include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define fi frist
#define se second
#define pb push_back
#define mp make_pair
#define SZ(x) ((int)x.size())
using namespace std;
typedef pair<int,int> pii;
typedef vec... | ALGO | 0.999954 | 3.648175 |
1e262925-c644-4a39-924a-52d0086ee913 | HRahman1777/Programming-Boat-of-C_CPP | codeforces/cf-A_TrickySum.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
int tc;
cin >> tc;
while (tc--)
{
ll n, genS = 0, num = 1, pS = 0;
cin >> n;
genS = n * (n + 1) / 2;
while (num <= n)
{
pS += num;
num *= 2;
}
... | ALGO | 0.999889 | 4.495984 |
6d810507-4138-4eac-ac7e-be8ce0b7698b | yujjwal9700/DSAWORKSHOP | Workshop1/question1opt2.cpp | #include<bits/stdc++.h>
using namespace std;
vector<int>numbers;
vector<bool>prime;
int range=100000;
void sieve(){
prime.resize(range,true);
for(int i=2;i<=sqrt(range);i++)
{
if(prime[i]){
for(int j=i*2;j<=range;j*=i)
prime[i]=false;
}
}
}
void odd_div()
{
nu... | ALGO | 0.999882 | 4.502306 |
bf93d6aa-695d-4938-a836-904bc9a15d11 | fang-sen-wei/Code-for-Qingwen-Algorithm | question-128.cpp | //01串
#include<cstdio>
#include<vector>
using namespace std;
vector<vector<int> > result;
vector<int> k;
void print01(int index,int n)
{
if(index==n) {
result.push_back(k);
return;
}
else
{
//这里看成树,左子树为0,右子树为1的二叉树,每次先去0的子树,再去1的子树
//类似于中序遍历,每次都是先0后1
k.push_back(0);... | ALGO | 0.99997 | 3.524906 |
fec9584c-e623-4469-8d04-74ee8125dff6 | MrcSanto/beecrowd-exercises | 1258/1258.cpp | #include <iostream>
#include <algorithm>
#include <vector>
struct Camiseta{
std::string nome;
std::string cor;
char tamanho;
};
// compare function
int comp (Camiseta& a, Camiseta& b){
if (a.cor == b.cor) {
if (a.tamanho == b.tamanho){
return a.nome < b.nome;
}
retu... | ALGO | 0.995959 | 5.259128 |
692be6c5-b4b1-4956-80ef-c27f793bc52d | orenov/usaco | silver/introduction_to_trees/journey.cpp | #include <iostream>
#include <vector>
#include <iomanip>
void dfs(int pos, int parent, std::vector<std::vector<int>>& g, std::vector<double>& res, double prob, int len) {
if (g[pos].size() == 1 && pos != 0) {
res.push_back(prob * len);
return;
}
int p = g[pos].size();
if (pos != 0) p--... | ALGO | 0.999525 | 5.080462 |
0a913403-1058-4479-bec6-1200a23edf70 | samkimuel/problem-solving | BaekjoonOJ/10869.cpp | /**
* @file 10869.cpp
* @brief 사칙연산
* @author Sam Kim (<EMAIL>)
*/
#include <iostream>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int a, b;
cin >> a >> b;
cout << a + b << '\n';
cout << a - b << '\n';
cout << a * b << '\n';
cout << a / ... | ALGO | 0.993148 | 4.120518 |
56f902a1-e6fe-454c-b7a6-f1010fdcdc25 | Hisham42/cpp-how-to-program | ch06/parking-charges/app.cpp | #include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
double calculateCharges(double hours);
double hourCalculator(double hours);
int main() {
double hours1{0}, hours2{0}, hours3{0};
cout << "Please enter hours for 3 cars " << "\n";
cin >> hours1;
cin >> hours2;
... | ALGO | 0.961772 | 4.198067 |
1e3edfd8-5c83-49e1-abab-5a4a218a07b4 | gcdco/cs161 | Assignment 3/3c/numGuess.cpp | #include <iostream>
using std::cout;
using std::cin;
int main()
{
// Declare variables
int numToGuess, correct, guess, count;
// Initialize variables
numToGuess = correct = guess = 0;
count = 1; // The user will have guessed once before entering the loop
// Prompt the user to enter a number to guess
// and... | ALGO | 0.975289 | 5.383419 |
731d0a67-cde0-48a1-aa76-320beec3aa5e | Aref111n/Challange-100 | Difficulty: 1200/36) 1205A - Almost Equal.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll ;
int main()
{
ll n, i ;
cin >> n ;
if(n%2==1)
cout << "YES" << endl ;
else {
cout << "NO" << endl ;
return 0;
}
cout << 1 << " " ;
ll c=0 ;
for(i=4; i<=2*n; i++) {
c++ ;
if(c<=2)
... | ALGO | 0.999887 | 3.013432 |
fc5e7834-c841-442d-ac93-d379207c360e | AbbaszadeAbbas/Cpp_learning | C++ Lessons/Group_D/September(2022)/day4-5/task10.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
char char_helper;
string input,helper;
int num ;
vector<long long>array;
while(cin>>input){
if(input=="push"){
cin>>num;
array.push_back(num);
cout<<"ok"<<endl;
}else if(input=="front"){
if(array.size()>0){
... | ALGO | 0.979008 | 3.87053 |
25f0e3df-f7b2-4094-8581-87f344390566 | BaeJinYeol/Algorithm | c++bits/bronze/28702-bronze1.cpp | ///
/// , ڿ
///
#include <iostream>
#include <string>
#include <vector>
using namespace std;
using ll = long long;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
vector<string> strv(3);
for (string& s : strv) cin >> s;
int num;
if (strv[0][2] != 'z')
num = stoi(strv[0]) + 3;... | ALGO | 0.999841 | 4.212049 |
852f9a9d-e396-4690-8f00-668a1baaac8c | cc20mtech11006/Data-Structures-and-Algorithms | 08_Arrays/8.4_MaximumSumOfSubArray.cpp | //Finding Maximum Sum of sub arrays. ------------- O(n^3) --Very bad. We will see better version of this in kadane's algo
// Ex : a[] = {-1 4 7 2}------------ Output: 13 (4+7+2 = 13 is the max sum of all sub arrays)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cout<<"Enter size of array: ";
cin >>... | ALGO | 0.999844 | 4.627623 |
d583d948-670d-4cc0-bb25-3c3a11475c04 | ps2997/LeetCode | K Sum Paths - GFG/k-sum-paths.cpp | //{ Driver Code Starts
//Initial template for C++
#include <bits/stdc++.h>
using namespace std;
struct Node
{
int data;
Node *left;
Node *right;
Node(int val) {
data = val;
left = right = NULL;
}
};
// Function to Build Tree
Node *buildTree(string str)
{
// Corner Case
... | ALGO | 0.99991 | 6.571247 |
394f85ca-a95a-4b3d-93e7-42b2d2448538 | raincross7/code-similarity | codes/train_code/problem316/problem316_419.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = 1; i < (int)(n + 1); i++)
// vector<vector<int>> A(3, vector<int>(4));
int main() {
int A,B;
ci... | ALGO | 0.999897 | 3.561954 |
56d1595e-38e9-444e-b944-3be3cca5a584 | IvanLunev/modern_prog | modern_prog.cpp | // modern_prog.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
#include <Eigen/Dense>
#include "FUN1.h"
#include "FUN2.h"
#include "FUN3.h"
using namespace Eigen;
using namespace std;
int main()
{
//Vector2d V(-1.2, 1);
//Vector2d l(-2, -2);
//Vector2d r(2, 2)... | ALGO | 0.999306 | 4.906357 |
60f13d36-376a-407d-bd24-279715587f7b | nehatkr/CPP-Programs | prepInsta100Ques/accentureCodingQue/magicalNumbers.cpp | // you have given numbers from zero to n . A magical number is defined by
// 1. replace 0 with 1 , 1 with 2 in the binary
// 2. sum of modified binary digit is odd means its a magical number
// input: 2 => 10 =>21 =>(2+1)=>3
// output:3
#include<iostream>
using namespace std;
int main(){
int n;
cin>>n;
in... | ALGO | 0.999914 | 4.065204 |
842135b3-bf85-4b44-8991-79dd90c3c9bd | knibey/3rd_attempt | visualstudiocode/testleetcode.cpp | #include <iostream>
#include <vector>
using std::vector;
vector<int> twoSum(vector<int>& nums, int target) {
for (int i = 1, k = 0; i < nums.size(); ++i) {
for (int j = 0; j < nums.size(); ++j) {
if (nums[k] + nums[i] == target) {
return vector<int>{k, i};
}
... | ALGO | 0.998807 | 5.501376 |
3c0820d1-437d-4bfb-bd94-dbc4d9553993 | Koozzi/Algorithms | BJ/10809.cpp | #include <iostream>
#include <string>
using namespace std;
int cnt[26];
string str;
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> str;
for(int i = 0 ; i < 26 ; i++){
cnt[i] = -1;
}
for(int i = 0 ; i < str.size() ; i++){
if(cnt[str[i] - 97] ==... | ALGO | 0.999899 | 4.093839 |
162e5dab-39df-4f6c-88b1-ceaad2d6a68e | scanno/android_frameworks_av_shuttle | media/libstagefright/codecs/aacdec/ps_all_pass_fract_delay_filter.cpp | /*
Filename: ps_all_pass_fract_delay_filter.c
------------------------------------------------------------------------------
REVISION HISTORY
Who: Date: MM/DD/YYYY
Description:
------------------------------------------------------------------------------
INPUT AND OUTPUT DEFI... | ALGO | 0.988564 | 4.391964 |
62f5f9f4-1350-479a-a581-d33bf2b16ae2 | meomnzak/Problem-Solving | LeetCode-Solutions/cracking_the_safe/solution.cpp | class Solution {
public:
int n,k,total;
string crackSafe(int n, int k) {
this->n = n;
this->k = k;
total = pow(k,n);
string ans(n,'0');
unordered_set<string> visited = {ans};
backtrack(ans,visited);
return ans;
}
bool backtrack(string &ans, unorde... | ALGO | 0.999978 | 5.569852 |
23ae8837-76eb-4db1-af11-ad9859b0ae1c | sirkp/DSA | 5. Searching/problems/p2.cpp | // https://practice.geeksforgeeks.org/problems/who-will-win-1587115621/1/?track=SPCF-Searching&batchId=154
int binary_search(int arr[], int i, int j, int x){
if(i<=j){
int mid = (i+j)/2;
if(arr[mid]==x)
return 1;
if(x>arr[mid])
return binary_search(arr, (mid+1), j, x)... | ALGO | 0.999866 | 4.778225 |
1b6226b8-f9b2-41e7-8f4c-51048c1e4745 | Shreyaa710/leetcode | 0392-is-subsequence/0392-is-subsequence.cpp | class Solution {
public:
bool isSubsequence(string s, string t) {
int n1= s.length();
int n2= t.length();
int i=0,j=0;
if(n1==0) return true;
while(i<n2){
if(s[j]==t[i]) j++;
if(j==n1) return true;
i++;
}
... | ALGO | 0.999935 | 6.277409 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.