uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
89d83b6e-ee3b-470b-b38d-725c4de053b7 | legendsovermyths/DSA | C++/SmallerstSubarray.cpp | // { Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution
{
public:
int sb(int arr[], int n, int x)
{
int left = 0;
int right = 0;
int sum = arr[0];
int mincount = right - left + 1;
while (right < n)
{
... | ALGO | 0.999785 | 6.030509 |
cec26f60-2307-4269-bb06-7187e1bb5b1b | nihal866/Codeforces_Questions | B_Trouble_Sort.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fri(i, a, b) for(ll i = a; i < b; i++)
#define frd(i, a, b) for(ll i = a; i >= b; i--)
#define g(a,b) __gcd(a,b)
#define lcm(a,b) (a*b)/g(a,b)
#define lb(v,key) lower_bound(v.begin(), v.end(), key)
#define ub(v,key) upper_bound(v.begin(), v.end()... | ALGO | 0.999896 | 3.712671 |
27ce4042-1f6c-4123-ba95-87c2241d7977 | angelcamposalejo/ejerciciosFor | ejericiosFor/ejericiosFor.cpp | #include "stdafx.h" //________________________________________ ejericiosFor.cpp
#include "ejericiosFor.h"
int contador = 1;
int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE, LPTSTR cmdLine, int cmdShow) {
ejericiosFor app;
return app.BeginDialog(IDI_ejericiosFor, hInstance);
}
void ejericiosFor::Window_Open(Win... | TOOL | 0.915169 | 3.116742 |
4c35d2f5-d674-445c-9aa8-14a7e62c726d | gandercoin/gandercoin-core | src/bitcoin-cli.cpp | #if defined(HAVE_CONFIG_H)
#include "config/bitcoin-config.h"
#endif
#include "chainparamsbase.h"
#include "clientversion.h"
#include "rpc/client.h"
#include "rpc/protocol.h"
#include "util.h"
#include "utilstrencodings.h"
#include <boost/filesystem/operations.hpp>
#include <stdio.h>
#include <event2/buffer.h>
#incl... | WEB | 0.973889 | 6.68424 |
08489142-486b-40bf-9561-4fca066714f8 | ayanhasnain03/DSA | recursion/powerRec.cpp | #include <iostream>
using namespace std;
int findExpo(int base, int exponential){
if (exponential == 0) return 1;
return base * findExpo(base,exponential-1);
}
int main (){
int base = 2;
int exponential = 3;
int result = findExpo(base,exponential);
cout << base << "^" << exponential << " = " << result << endl;
... | ALGO | 0.999848 | 4.769117 |
cb743f2a-8524-475e-bc6b-bd63f6685a6a | lincolntcxs/IALG | tes.cpp | #include <iostream>
#include <fstream>
using namespace std;
int main () {
char dig [3];
string sen = "2018";
char digi;
char senha[3];
bool correto = true;
for (int i = 0; i < 3; i++)
{
digi = sen[i];
senha[i] = digi;
}
for (int i = 0; i < 4; i++)
{
cin >> dig[i];
}
for (int i = 0; i < 4; i++)
{
... | ALGO | 0.990636 | 3.024194 |
da21f26b-0d7d-434c-af89-d69bb52c2706 | NINAD-17/Data_Structures_and_Algorithms | [17] Binary Search Trees/[02] Problems/5_valid_BST.cpp | #include <iostream>
#include <vector>
#include <climits>
#include "../lib/build.cpp"
using namespace std;
// IS A VALID BST?
// approach: with the help of range
// time complexity: O(n)
// space complexity: O(h)
bool isBST(Node* root, int min, int max) {
if(root == NULL)
return true;
if(root -> data ... | ALGO | 0.999904 | 5.501939 |
75c5225c-4db6-4561-82db-680a6df8fd7d | raincross7/code-similarity | codes/train_code/problem171/problem171_411.cpp | #include <iostream>
#include <algorithm>
#include <climits>
#define INF INT_MAX
using namespace std;
int main(){
int n;
cin >> n;
int m[n+1][n+1], p[n+1];
for(int i = 1; i <= n; i++) cin >> p[i-1] >> p[i];
for(int i = 1; i <= n; i++) m[i][i] = 0;
for(int l = 2; l <= n; l++){
for(int i... | ALGO | 0.999885 | 3.429538 |
76ba9886-6dc6-4dde-8d9f-28db05171f33 | ishandutta2007/codeforces | jiangly/normal/493/D.cpp | #include <bits/stdc++.h>
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int n;
std::cin >> n;
if (n % 2 == 0) {
std::cout << "white\n";
std::cout << "1 2\n";
} else {
std::cout << "black\n";
}
return 0;
} | ALGO | 0.999882 | 3.943064 |
d5f9acd9-3327-48d1-8679-9d8dd08de358 | Horidas-Roy/Fundamental | XPSC/NewBie Zone/week - 13/A_Thorns_and_Coins.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t; cin >> t;
while(t--){
int n; cin >> n;
string s; cin >> s;
int mxCoin = 0;
for(int i=1; i<n; i++){
if(s[i] == '.') continue;
if(s[i] == ... | ALGO | 0.992683 | 3.292068 |
c71ffa85-ad93-403e-81d9-4e76ee0600c6 | DravitLochan/DS | trees/binary tree/inorder_moris_traversal.cpp | #include <stdio.h>
#include <stdlib.h>
#include <iostream>
using namespace std;
struct tNode
{
int data;
struct tNode* left;
struct tNode* right;
};
void MorrisTraversal(tNode *root){
tNode *ptr, *t = root;
while(t){
if(t->left){
ptr = t;
t = t->left;
while(t->right && t -> right !... | ALGO | 0.999998 | 4.028524 |
8999a7a5-5ffd-4468-94e5-30cd36b897e5 | KMSBisko/Past-cpp-projects | loop/3.cpp | #include <cstdlib>
#include <iostream>
using namespace std;
int mainline(int argc, char *argv[])
{
int i;
int j;;
for (i = 1; i <= 9; i = i + 2) {
for (j = 1; j <= i; ++j)
cout << "*";
cout << "\n";
}
for (i = 9; i >= 1; i = i - 2) {
for (j = i; j >= 1; --j)
cout << "*";
cout << "\n";
}
c... | ALGO | 0.993391 | 3.57268 |
4c3a2992-a145-4194-8dc4-75656130a316 | shruti2307y/DSA-problems | Medium/Remove loop in Linked List/remove-loop-in-linked-list.cpp | //{ Driver Code Starts
// driver code
#include <bits/stdc++.h>
using namespace std;
struct Node
{
int data;
Node* next;
Node(int val)
{
data = val;
next = NULL;
}
};
void loopHere(Node* head, Node* tail, int position)
{
if(position==0) return;
Node* walk = head;
... | ALGO | 0.999931 | 4.325893 |
5ffa8ec7-1cbb-43ca-bf7b-f036cd12dd0d | pranavundre/Graphs | 19-Detect-Cycle-in-a-Directed-Graph.cpp | class Solution {
public:
bool checkDFS(vector<int> adj[], vector<int>& visited, int index) {
visited[index] = 1;
for (int i : adj[index])
if (visited[i] == 1) return true; // Cycle detected
else if (visited[i] == 0 && checkDFS(adj, visited, i)) return true;
visited[... | ALGO | 0.999863 | 6.217548 |
87daaa3f-2706-456b-a948-eb6bba68c71c | Pixel-0-1/Homework2_RL24 | orocos_kinematics_dynamics/orocos_kdl/src/chainiksolvervel_pinv_givens.cpp | // Version: 1.0
// Author: Ruben Smits <ruben dot smits at mech dot kuleuven dot be>
// Maintainer: Ruben Smits <ruben dot smits at mech dot kuleuven dot be>
// URL: http://www.orocos.org/kdl
#include "chainiksolvervel_pinv_givens.hpp"
#include "utilities/svd_eigen_Macie.hpp"
namespace KDL
{
ChainIkSolverVel_pinv... | ALGO | 0.998418 | 6.326654 |
7e9fba9d-4748-48d3-bfd4-702949b6db6a | MuhammadIktear/2025 | January/codeforces/C_Ternary_XOR.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define vec vector<int>
#define pii pair<int,int>
#define mii map<int,int>
#define vp vector<pair<int,int>>
#define fast_io ios::sync_with_stdio(false); cin.tie(nullptr)
#define py cout << "YES\n"
#define pn cout << "NO\n"
#define ... | ALGO | 0.99995 | 4.214949 |
bcf8d0e6-cf1d-4eb9-932a-ab66326c6579 | tpisto/rmongo | src/mongo-cxx-driver/boost/libs/math/example/find_mean_and_sd_normal.cpp | // find_mean_and_sd_normal.cpp
// Example of finding mean or sd for normal distribution.
// Note that this file contains Quickbook mark-up as well as code
// and comments, don't change any of the special comment mark-ups!
//[normal_std
/*`
First we need some includes to access the normal distribution,
the algorithms... | ALGO | 0.999794 | 5.835461 |
1aeb678b-a226-471d-8f41-db2f5047b279 | IRVLab/SOS-SLAM | thirdparty/g2o/g2o/core/optimization_algorithm_dogleg.cpp | #include "optimization_algorithm_dogleg.h"
#include <iostream>
#include "g2o/stuff/timeutil.h"
#include "block_solver.h"
#include "sparse_optimizer.h"
#include "solver.h"
#include "batch_stats.h"
using namespace std;
namespace g2o {
OptimizationAlgorithmDogleg::OptimizationAlgorithmDogleg(std::unique_ptr<BlockSo... | ALGO | 0.999883 | 6.783492 |
660396e4-61a5-4d82-bc9b-f6f8a431dca6 | getong/flutter_workspace_example | timer_ui_example/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.998102 | 6.776823 |
6fa28c5b-9ee7-46af-a078-555436ceac71 | anshika3112/leet_code | leetcode_Q_414third_indexed_number.cpp | class Solution {
public:
int thirdMax(vector<int>& nums) {
long int max1, max2, max3;
max1 = max2 = max3 = numeric_limits<long>::min();
for(int v: nums)
{
if(v > max1)
{
max3 = max2;
max2 = max1;
max1 = v;
... | ALGO | 0.99996 | 5.256475 |
9a647071-23a9-4725-bcad-8d4c04643864 | jrmoha/leetcode | Design/622. Design Circular Queue.cpp | class MyCircularQueue
{
std::vector<int> queue;
int front,rear,num_of_elements;
public:
MyCircularQueue(int k)
{
queue.resize(k);
this->front=0;
this->rear=0;
this->num_of_elements=0;
}
bool enQueue(int value)
{
if (!this->isFull())
{
... | ALGO | 0.999467 | 5.524389 |
581bcc7b-ad2a-4952-aeab-22ce4a306b14 | prcsueb/PeetCode | 77-combinations/77-combinations.cpp | class Solution {
public:
void helper(int n,int r, vector<vector<int>> &ans, vector<int> &sub, int idx) {
if(sub.size() == r) {
ans.push_back(sub);
return;
}
for(int i=idx;i<=n;i++) {
sub.push_back(i);
helper(n,r,ans,sub,i+1);
... | ALGO | 0.999986 | 5.840751 |
b72d94ca-069f-47d0-8bf8-4951a1994e80 | TarunManagan/Conditional_statements_C- | Greater_Number.cpp | #include<iostream>
using namespace std;
int main(){
int a,b,c;
cout<<"Enter the 3 (distinct) numbers you want to compare: ";
cin>>a>>b>>c;
if(a>b && a>c){ //Compares whether the value of a is greater than b and c
cout<<a<<" is the greatest";
}
else if(b>c && b>a){ //Compares whether the ... | ALGO | 0.999807 | 3.679397 |
9bf0ef2b-e846-4f15-b0d6-2c7ffb2fc0e6 | Anmol2307/Codeforces | Practice/431B.cpp | #include <bits/stdc++.h>
using namespace std;
inline void inp(int &n ) {//fast input function
n=0;
int ch=getchar(),sign=1;
while( ch < '0' || ch > '9' ){if(ch=='-')sign=-1; ch=getchar();}
while( ch >= '0' && ch <= '9' )
n=(n<<3)+(n<<1)+ ch-'0', ch=getchar();
n=n*sign;
}
vector<string> ge... | ALGO | 0.99997 | 3.520817 |
97d6ed69-058e-425e-bf13-b674440f171f | PaukIsUha/optimizing_formating_code | predictions/submissions-aizu-gpt35/Codenet/p00711/185975921/improved.cpp | #include <cstdio>
using namespace std;
#define rep(i, x) for (int i = 0; i < (x); ++i)
int dx[] = {-1, 1, 0, 0}, dy[] = {0, 0, -1, 1};
char mp[20][22];
int H, W;
void dfs(int y, int x) {
if (y < 0 || y >= H || x < 0 || x >= W || mp[y][x] == '#' || mp[y][x] == ' ')
return;
mp[y][x] = ' ';
rep(i, 4) dfs(y + dy[... | ALGO | 0.998158 | 3.783327 |
ee4ddb62-e7c8-4d1a-a5ba-21fadc7d7adf | ngctnnnn/evo_optim_cpp | include/boost/libs/spirit/example/qi/compiler_tutorial/calc5.cpp | ///////////////////////////////////////////////////////////////////////////////
//
// Same as Calc4, this time, we'll incorporate debugging support,
// plus error handling and reporting.
//
// [ JDG April 28, 2008 ] For BoostCon 2008
// [ JDG February 18, 2011 ] Pure attributes. No semantic actions.
//
/////... | TOOL | 0.965852 | 7.888275 |
277c76f0-6749-4456-8298-60cb6184b061 | kosirobwada/AtCoder | ABC330/d.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
int main()
{
int N;
cin >> N;
vector<vector<char>> S(N, vector<char>(N));
vector<int> a(N), b(N);
for (int i = 0; i < N; i++)
{
for (int j = 0; j < N; j++)
{
cin >> S[i... | ALGO | 0.999481 | 4.234341 |
6eaed9e4-59f7-43ad-bf13-6d7ae450491e | thekoushikdurgas/wanderai | 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 |
2123e690-3c74-49dc-99da-e477c30c13f8 | vinay-kumar99/Hactoberfest2022 | C++/Casino Number Guessing Game/casinoNumberGuessingGame.cpp | // Casino number guessing game
// contributor - Mahesh Gaikwad
#include <iostream>
#include <string>
#include <cstdlib>
#include <ctime>
using namespace std;
void rules();
int main()
{
string playerName;
int balance;
int bettingAmount;
int guess;
int dice;
char choice;
srand(time(0));
... | ALGO | 0.90423 | 3.793656 |
a362d4fa-03bc-45ea-afd7-a65ef33b5323 | alvarospace/hpc_ode | ext/magma-2.6.2/sparse/control/magma_zmilustruct.cpp | /*
-- MAGMA (version 2.6.2) --
Univ. of Tennessee, Knoxville
Univ. of California, Berkeley
Univ. of Colorado, Denver
@date April 2022
@precisions normal z -> s d c
@author Hartwig Anzt
*/
// in this file, many routines are taken from
// the IO functions provided by Matr... | TOOL | 0.977574 | 4.238796 |
d68a59f1-e0fe-4b84-beb5-8cd9ad3a743b | JubayerAhmmodShuvo/leetcodesolve | AverageSalaryExcludingThe MinMax.cpp |
class Solution {
public:
double average(vector<int>& salary) {
double n= salary.size();
double maxi= INT_MIN;
double min= INT_MAX;
double allsum=0;
for(int i=0; i<n;i++){
if(salary[i]>maxi) maxi= salary[i];
if(salary[i]<min) min= salary[i];
... | ALGO | 0.999274 | 5.704339 |
d6605ae0-1022-48cd-b08e-8a0e0dee8805 | ishandutta2007/codeforces | lichenkoh/normal/1419/E.cpp | #pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,sse4.1,sse4.2,popcnt,mmx,avx")
#include "bits/stdc++.h"
#include <assert.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define PB push_back
#define MP make_pair
const int MOD=1000000007;
#define endl "\n"
#define fst firs... | ALGO | 0.999592 | 4.542631 |
14a822ba-3eed-4d69-81ad-8dc6199c31c7 | zspace/system.opencv.4.8.1 | modules/imgproc/src/spatialgradient.cpp | #include "precomp.hpp"
#include "opencv2/core/hal/intrin.hpp"
#include <iostream>
namespace cv
{
/* NOTE:
*
* Sobel-x: -1 0 1
* -2 0 2
* -1 0 1
*
* Sobel-y: -1 -2 -1
* 0 0 0
* 1 2 1
*/
template <typename T>
static inline void spatialGradientKernel( T& vx, T& vy... | ALGO | 0.996456 | 6.386929 |
3f37a49a-42a3-4389-9dbe-dc2e1f1b9c14 | ishandutta2007/codeforces | i_love_dasha_karpenko/normal/1156/B.cpp | #include <bits/stdc++.h>
using namespace std;
#define DIM 200007
#define INF 10E16
#define MAXN 10000007
#define MODULO 1000000007
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pairll;
typedef ll arr[DIM];
typedef pairll parr[DIM];
typedef vector<ll> graph[DIM];
struct pp { ll a, b; };
ll t;
str... | ALGO | 1 | 4.935187 |
9f11ecb7-4581-4a47-b938-6d40687dc1d1 | Ashfaqur4988/DSA-codes | recursion/test.cpp | #include <iostream>
using namespace std;
void print(int &n, int m)
{
if (n == m)
{
return;
}
n++;
cout << "printing" << endl;
print(n, m);
}
void printLinear(int n, int i)
{
if (n < i)
{
return;
}
cout << n << endl;
printLinear(n - 1, i);
}
void backTrack(in... | ALGO | 0.999911 | 4.173877 |
d85a630e-0906-47d1-a3ee-b9ac4818046f | mocibb/CarrotSLAM | 3rdparty/g2o/g2o/types/slam3d/dquat2mat.cpp | #include "dquat2mat.h"
#include <iostream>
namespace g2o {
namespace internal {
using namespace std;
#include "dquat2mat_maxima_generated.cpp"
int _q2m(double& S, double& qw, const double& r00 , const double& r10 , const double& r20 , const double& r01 , const double& r11 , const double& r21 , const d... | ALGO | 0.999675 | 5.832991 |
842b9375-b766-4546-b70c-f0f4f8abd18e | OzzieIsaacs/winmerge-qt | ext/boost_1_70_0/libs/compute/perf/perf_stl_count.cpp | #include <algorithm>
#include <iostream>
#include <vector>
#include "perf.hpp"
int rand_int()
{
return static_cast<int>((rand() / double(RAND_MAX)) * 25.0);
}
int main(int argc, char *argv[])
{
perf_parse_args(argc, argv);
std::cout << "size: " << PERF_N << std::endl;
// create vector of random numb... | ALGO | 0.961311 | 5.452251 |
29d22807-3cd1-4062-977e-09dc255a001d | rohit8020/Competitive_Programming_Problems_Solutions_And_Concepts | Bitwise_Tuples.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define MOD 1000000007
ll powerFunc(ll base,ll power){
if(power==0)
return 1;
ll subProblem=powerFunc(base,power/2)%MOD;
if(power%2==0){
return (((subProblem%MOD)*(subProblem%MOD))%MOD);
}else{
return (((base)*(s... | ALGO | 0.999796 | 5.051796 |
734693a6-ac33-4902-aa5a-5ab36c2d7126 | Tsiiron/portfolio | long_number_arithmetic/Project-main/modules/Integer/Integer.cpp | #include "Integer.h"
#include <utility>
#include <stdexcept>
Integer::Integer(std::int64_t number) : sign_(number < 0), number_(Natural(std::abs(number))) {}
Integer::Integer(const std::string &str_number) : sign_(false) {
size_t sign_pos = str_number.find_first_of("-+");
if (sign_pos != std::string::npos)
... | TOOL | 0.928638 | 5.080151 |
e8328971-b3c3-4f82-8024-deeecf5bc02b | mosabrezaei/Programming-Principles | Sorting_Algorithms/insertoin_sort.cpp |
#include <iostream>
#include <iomanip>
#include <vector>
using std::cin;
using std::cout;
using std::cerr;
using std::setw;
using std::endl;
using std::setfill;
using std::vector;
//************************************************************
// Insertion Sort
// This function is one of the well-k... | ALGO | 0.999723 | 5.149856 |
8fa5b99e-e0d2-41a5-a2f1-02b820b3c792 | ishandutta2007/codeforces | ylwang/normal/407/E.cpp | #include <bits/stdc++.h>
using namespace std;
#define FILE(Name) freopen(Name"in", "r", stdin), freopen("out", "w", stdout)
namespace io {
const int __SIZE = (1 << 21) + 1;
char ibuf[__SIZE], *iS, *iT, obuf[__SIZE], *oS = obuf, *oT = oS + __SIZE - 1, __c, qu[55]; int __f, qr, _eof;
#define Gc() (iS == iT... | ALGO | 0.999983 | 4.068305 |
c2ec7c1e-f39a-4824-8962-ded00bf22679 | derek-hon/DME | ecj/ecj/opencv/modules/core/src/kmeans.cpp | #include "precomp.hpp"
#include <opencv2/core/utils/configuration.private.hpp>
#include <opencv2/core/hal/hal.hpp>
////////////////////////////////////////// kmeans ////////////////////////////////////////////
namespace cv
{
static int CV_KMEANS_PARALLEL_GRANULARITY = (int)utils::getConfigurationParameterSizeT("OPEN... | ALGO | 0.999777 | 6.560458 |
fd041eaf-aebb-40e5-8580-4162bb2c7b22 | ishandutta2007/codeforces | lichenkoh/normal/691/D.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <assert.h>
using namespace std;
typedef int ll;
typedef long double ld;
#define PB push_back
#define MP make_pair
#define MOD 1000000007LL
#define endl "\n"
const ll UNDEF = -1;
template<typename T> inline bool chkmax(T &a, T b) { return a < b ? a = b,... | ALGO | 0.999994 | 3.957134 |
cd421511-8d7c-4ed3-8613-2fe8bef3cf39 | ShilongLee/ACM | ACM/算法设计与分析/算法设计课/最接近点对问题(1维).cpp | #include<stdio.h>
#include<algorithm>
#include<iostream>
using namespace std;
int a[500500];
int Max(int a[],int l,int r)
{
int x=a[l];
for(int i=l; i<r; i++)
if(a[i]>x)
x=a[i];
return x;
}
int Min(int a[],int l,int r)
{
int x=a[l];
for(int i=l; i<r; i++)
if(a[i]<x)
... | ALGO | 0.999948 | 3.863712 |
6dc053bb-34bb-42a9-87f7-a1f5685a686f | Bisbiliroglu/Cpp | STL/container_adaptors/stack.cpp | /*
STACK
-----
Son girenin ilk çıktığı veri yapısı (LIFO)
template<
class T,
class Container = std::deque<T>
> class stack;
stack içerisinde protected olarka container class member olarak bulunaktadır. Bu sayede stackten kalıtım yoluyla geliştirici kendi stack sınıfını oluşturuabilir.
push fonksiyonu veri ek... | ALGO | 0.976591 | 5.826301 |
77e4e5a9-9975-404a-8c3a-b5c24e643904 | pablo-Acha/Progra-Competitiva | contest/div3-17-11/a.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int t;cin>>t;
while(t--){
int n;cin>>n;
int ch[n+1]= {0};
for (int i = 0,a; i < n; i++){
cin>>a;
ch[a]++;
}
int res = 0;
for (int i = 1; i <= n; i++){
res += ch[i]/2;
... | ALGO | 0.999607 | 3.792272 |
e2bf9cdd-736f-40e6-8a79-8fd5241ab28e | AnghelescuAlbert/chess-bot | chess_logic/src/tests/chessAPI.cpp | #include "search.hpp"
static std::string newBoardState;
extern "C" {
const char *makeMove(const char *boardState, const char *moveChar) {
Board board = Board(boardState);
std::string moveString = moveChar;
Movelist moves;
movegen::legalmoves(moves, board);
for (const auto ... | ALGO | 0.987314 | 4.618102 |
02e177a4-5a9b-4b52-8d9a-4abb3d0fd859 | Upendra2003/cpp | Question-9/q9.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int n,q;
cin>>n>>q;
vector<vector<int>> arrays;
for(int i=0;i<n;i++){
int k;
cin>>k;
vector<int> temp;
for(int j=0;j<k;j++){
int a;
cin>>a;
temp.push_back(a);
}
... | ALGO | 0.999815 | 3.810502 |
d1dd2335-c255-4075-bf9a-901fa153581b | Rob-robi-rob/POO | Ejercicios/guias/guia1ej4.cpp | #include <iostream>
#include <vector>
#include <ostream>
using namespace std;
int *redimensionar( int *lista, int n, int c ) {
int *newVint = new int[c];
for (int i = 0; i < c; i++)
if (i >= n) newVint[i] = 0;
else newVint[i] = lista[i];
delete []lista;
return newVint;
}
void mostra... | ALGO | 0.972309 | 3.049056 |
e2d42ebb-992f-4885-8c08-28da95b132d1 | srathod19/DSA---Programs | p27_getPivot.cpp | #include <iostream>
using namespace std;
int getPivot(int arr[], int n)
{
int start = 0;
int end = n - 1;
int mid = (start + end) / 2;
while (start < end)
{
if (arr[mid] >= arr[0])
{
start = mid + 1;
}
else
{
end = mid;
}
... | ALGO | 0.999906 | 5.175594 |
d8238a6c-84d3-44cb-94e2-4b74d8628deb | LeoPer02/Competitive-Programming | UVA/UVA_100.cpp | #include <iostream>
using namespace std;
/*
General Idea: Run through every number between i and j, and check wich one has the longest cycle
Time complexity: O(n^2)
*/
int max2(int a, int b){
if (a > b){
return a;
}
return b;
}
int main(){
int i, j, temp = 0, count = 1, max = -1;
while(ci... | ALGO | 0.999907 | 4.055313 |
571b72f0-3a27-4aa2-be99-355c61ebf0d6 | voltbit/Algorithms | maxflow_mincut/graph.cpp | #include "graph.h"
#include <utility>
// class Key{
// std::pair<int, int> edge;
// public:
// Key(int x, int y){
// this->edge.first = x;
// this->edge.second = y;
// }
// };
Graph::Graph() {
int i, j;
for(i = 0; i < MAX_N; i++) {
for(j = 0; j < MAX_N; j++)
this->adjacency_matrix[i][j] = 0;
this-... | ALGO | 0.988878 | 3.837996 |
0d09c22a-f656-424a-a84b-3ca60cd94fad | anushka209/DSALeetCode_Problems | 0735-asteroid-collision/0735-asteroid-collision.cpp | class Solution {
public:
vector<int> asteroidCollision(vector<int>& asteroids) {
int n=asteroids.size();
stack<int>st;
for(int i=0;i<n;i++)
{
while(!st.empty() && st.top()>0 && asteroids[i]<0)
{
int sum=st.top()+asteroids[i];
if(sum<0)
... | ALGO | 0.999981 | 5.887715 |
a7c60e44-9fb7-4b5d-8305-572063569796 | solareenlo/atcoder | 06_AtCoder-Regular-Contest/arc110/B/B_003.cpp | #include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); i++)
using namespace std;
int main() {
int n; cin >> n;
string t; cin >> t;
string s = "110";
long long res = 0;
REP(i, 3) {
bool ok = true;
REP(j, n)
if (t[j] != s[(j+i)%3])
ok = false;
if (ok) res += (3e10 - n - i) / 3 + 1;
}
cou... | ALGO | 0.999886 | 3.666719 |
670169fc-5a01-4a06-b0f0-792bc652f82f | yeetholmes619/Codeforces | 747_2/e.cpp | //Author = Anirudh Srikanth (yeetholmes619) [B20CS006]
#include<bits/stdc++.h>
#define curtime chrono::high_resolution_clock::now()
#define timedif(start,end) chrono::duration_cast<chrono::nanoseconds>(end - start).count()
using namespace std;
#define RESET "\033[0m"
#define BR "\033[1m\033[31m" ... | ALGO | 0.99989 | 4.820802 |
e8c919c9-3d11-4c2a-baa7-443ec724a0cd | ARui-tw/LeetCode | problems/1749-Maximum_Absolute_Sum_of_Any_Subarray/sol.cpp | /**
* Author: ARui<<EMAIL>>
* Problem: https://leetcode.com/problems/maximum-absolute-sum-of-any-subarray
* Runtime: 0 ms (100.00%)
*/
class Solution {
public:
int maxAbsoluteSum(vector<int>& nums) {
int sum = 0, curPosSum = 0, curNegSum = 0;
for (auto& n : nums) {
curPosSum = max(... | ALGO | 0.999921 | 6.234068 |
ebac4cb9-4207-4b3b-8592-9371e905b9dc | vyi/IAwithPowell | app/libs/llvm/include/Eigen/bench/benchVecAdd.cpp |
#include <iostream>
#include <Eigen/Core>
#include <bench/BenchTimer.h>
using namespace Eigen;
#ifndef SIZE
#define SIZE 50
#endif
#ifndef REPEAT
#define REPEAT 10000
#endif
typedef float Scalar;
__attribute__ ((noinline)) void benchVec(Scalar* a, Scalar* b, Scalar* c, int size);
__attribute__ ((noinline)) void be... | TOOL | 0.955169 | 5.111393 |
723b7542-6abf-469b-9574-31732cf7ff7a | deepin-community/llvm-toolchain-18 | lldb/source/Plugins/Process/Utility/MemoryTagManagerAArch64MTE.cpp | #include "MemoryTagManagerAArch64MTE.h"
#include "llvm/Support/Error.h"
#include <assert.h>
using namespace lldb_private;
static const unsigned MTE_START_BIT = 56;
static const unsigned MTE_TAG_MAX = 0xf;
static const unsigned MTE_GRANULE_SIZE = 16;
lldb::addr_t
MemoryTagManagerAArch64MTE::GetLogicalTag(lldb::addr_t... | TOOL | 0.854017 | 7.496341 |
ea07394e-a6c9-42fd-bf51-537f6efdccd7 | codulluiandrei/pbinfo | pbinfo-640/main.cpp | #include <iostream>
#include <fstream>
using namespace std;
ifstream fin("nrfii.in");
ofstream fout("nrfii.out");
int n , t[105], nr[105];
int main()
{
fin >> n;
for(int i = 1 ; i <= n ; i ++)
fin >> t[i];
for(int i = 1 ; i <= n ; i ++)
if(t[i] != 0)
nr[t[i]] ++;
int max = nr[1];
for(int i = 2 ; i <= n ; i ... | ALGO | 0.999921 | 3.26679 |
c6355ef8-c8df-4ed6-9611-b3328b3a063b | irff/cp-codes | TOKI/getting_in_line.cpp | #include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;
#define R(i,_a,_b) for(int i=int(_a);i<int(_b);i++)
int n, cx[10], cy[10];
double dist[10][10], ans = 0.00;
double rek(int pos, int b) {
bool bisa = 0;
R(i,0,n) if(!(b&(1<<i))) bisa = 1;
if(!bisa) return 0;
double ans = ... | ALGO | 0.999854 | 3.415061 |
b30a8fa6-ccb2-456d-9db9-f763bea88e1f | 18-RAJAT/ONLINE-JUDGE | B_Gleb_And_Pizza.cpp | #include<bits/stdc++.h>
using namespace std;
#define int long long
void sol()
{
int r,d,n,R,x,y,p,count=0;
cin>>r>>d>>n;
for(int i=1;i<=n;++i)
{
cin>>x>>y>>R;
p=x*x+y*y;
double q=sqrt(p);
if((r-d)<=q-R && q+R<=r && 2*R<=d)count++;
}
cout<<count;
}
signed main()
{
... | ALGO | 0.999797 | 4.130898 |
54e51ccc-767f-490a-91de-6214b9ac3758 | MuhammadTalhaAwais/PF | Week6lab/task06OP.cpp | #include<iostream>
using namespace std;
float discount(string day, string month, float purchaseAmount);
main(){
string day;
cout<<"Enter Purchase Day: ";
cin>>day;
string month;
cout<<"Enter Purchase Month: ";
cin>>month;
float purchaseAmount;
cout<<"Enter Purchase Amount: ";
cin>>p... | ALGO | 0.975067 | 3.986909 |
db32a53d-ab82-4094-9300-c4225a0ee279 | anuja2004/test-gfg | Easy/Finding middle element in a linked list/finding-middle-element-in-a-linked-list.cpp | //{ Driver Code Starts
//Initial template for C++
#include <bits/stdc++.h>
using namespace std;
struct Node
{
int data;
struct Node* next;
Node(int x){
data = x;
next = NULL;
}
};
void printList(Node* node)
{
while (node != NULL) {
cout << node->data <<" ";
... | ALGO | 0.999848 | 6.122982 |
af6db0ee-0d2c-4fa3-9a98-495a646c1343 | ishandutta2007/codeforces | unstoppablechillmachine/normal/446/B.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("O3")
//#pragma GCC optimize ("Ofast,no-stack-protector,fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
//#pragma GCC target("avx,tune=native")
using namespace std;
u... | ALGO | 0.999958 | 3.344723 |
14ae1306-9f2c-4981-83d4-67bfd0a59d45 | sahanics06/DSA_Sheet | Graph/Shortest Path in Weighted undirected graph.cpp | /*
You are given a weighted undirected graph having n vertices numbered from 1 to n and m edges describing there are edges between a to b with some weight,
find the shortest path between the vertex 1 and the vertex n and if path does not exist then return a list consisting of only -1.
Example:
Input:
n = 5, m= 6
edge... | ALGO | 0.999998 | 5.476016 |
96f87cac-4761-468b-b88c-ae19b3ad384f | ShubhamGupta2701/CPP-Codes | C++ Files/DSA/Recurrison/r_1.cpp | #include<iostream>
using namespace std;
int is_home(int s,int d){
if(s==d){
cout<<"home reached"<<endl;
}
s++;
if(s<d){
cout<<"not reached"<<endl;
}
return is_home(s,d);
}
int main(){
int s=1,d=20;
cout<<is_home(s,d);
return 0;
}
| ALGO | 0.998036 | 3.032766 |
f631694c-c3d4-4b6d-9a36-b49f86edeee5 | raulsenaferreira/Marathon_and_Contests | URI_Online_Judge/iniciante/1015.cpp | #include<stdio.h>
#include<stdlib.h>
#include<math.h>
int main(){
int x1,y1,x2,y2;
scanf("%d %d",&x1,&y1);
scanf("%d %d",&x2,&y2);
int x = pow((x2-x1),2);
int y = pow((y2-y1),2);
float distancia = sqrt(x+y);
printf("%.4f\n", distancia);
}
| ALGO | 0.999792 | 3.780742 |
9cbc859c-cab0-4c29-847c-be2913e3e29c | AshvinBa/CPP_Programs-2 | Graph/BFS_of_Directed_graph.cpp | /*
BFS of graph
Given a directed graph. The task is to do Breadth First Traversal of this graph starting from 0.
Note: One can move from node u to node v only if there's an edge from u to v. Find the BFS traversal of the graph starting from the 0th vertex, from left to right according to the input graph. Also, you sho... | ALGO | 0.999997 | 6.041375 |
3c0f755e-9c74-42cf-96c0-aed442ec035b | PranavKumar27/StacksNQueus | P31_LFU_Cache.cpp |
##########################################################################
REFER P32_LFU This code is incorrect
################################################################################
/*
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
using namespace std;
class Node
{
publ... | ALGO | 0.994555 | 4.063057 |
1ade37da-cbd7-4973-a30c-df20bc19d14a | Heyjude101/LeetCode | 104-maximum-depth-of-binary-tree/104-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.999583 | 6.233524 |
c078e1b7-2732-4105-9059-fe045cc0f92f | Vibhav-Singh9/Linked_List | Singly List Linked/Remove_Duplicate_Element.cpp | #include<iostream>
using namespace std;
class Node
{
public:
int data;
Node *next;
Node(int value)
{
data = value;
next = NULL;
}
};
Node* CreateLinkedList(int arr[], int index, int n)
{
if(index == n)
{
return NULL;
}
Node *temp;
temp = new Node(... | ALGO | 0.999992 | 5.072961 |
80c215e3-5e69-46b7-b12d-f51b8b876b27 | Aryan-Git-Hub/DSA-Using-CPP | 04 Sorting/03_Insertion_Sort.cpp | #include<iostream>
using namespace std;
int main() {
int n;
cout<<"Enter number of elements in array: ";
cin>>n;
int* arr = new int[n];
// Inserting elements
cout<<"Enter elements in array: ";
for (int i = 0; i < n; i++) cin>>arr[i];
// Main code
for (int i = 1; i < n; i++)
{
... | ALGO | 0.999872 | 4.444571 |
d2827f45-14b5-4a60-8a1c-d89d91c32bee | lycion/genex-project | src/crypto/aes.cpp | #include <crypto/aes.h>
#include <crypto/common.h>
#include <assert.h>
#include <string.h>
extern "C" {
#include <crypto/ctaes/ctaes.c>
}
AES128Encrypt::AES128Encrypt(const unsigned char key[16])
{
AES128_init(&ctx, key);
}
AES128Encrypt::~AES128Encrypt()
{
memset(&ctx, 0, sizeof(ctx));
}
void AES128Encryp... | TOOL | 0.963366 | 7.619499 |
b900234d-496e-43d4-b79f-7fa6b1bce488 | showmic96/Online-Judge-Solution | UVA/12709/7360315_AC_10ms_0kB.cpp | #include<bits/stdc++.h>
using namespace std;
int main(void)
{
long long a , l , h , w , area , ans;
while(cin >> a){
if(!a)break;
area = 0 , ans = 0;
for(int i=0;i<a;i++){
cin >> l >> w >> h;
if(h==ans){
ans = h;
if(l*w*h>are... | ALGO | 0.998413 | 3.287603 |
635df909-1f8a-4583-b44b-c615a8030262 | danache/coding | POJ/POJ2777/POJ2777/main.cpp | #include <iostream>
#include <set>
#define MAXN 100005
using namespace std;
struct Node{
int flag;
int color;
};
Node sum[MAXN << 2];
void pushUp(int i){
sum[i].color = sum[i << 1].color | sum[i << 1 | 1].color;
}
void build(int i, int l, int r){
sum[i].color = sum[i].flag = 0;
if (l == r){
... | ALGO | 0.999759 | 3.860539 |
650b7cf0-edad-458b-8958-6e753b883018 | shugaoye/platform_external_mesa | src/glsl/lower_mat_op_to_vec.cpp | /**
* \file lower_mat_op_to_vec.cpp
*
* Breaks matrix operation expressions down to a series of vector operations.
*
* Generally this is how we have to codegen matrix operations for a
* GPU, so this gives us the chance to constant fold operations on a
* column or row.
*/
#include "ir.h"
#include "ir_expression... | TOOL | 0.935483 | 7.514947 |
4d9ef369-03cc-4d85-a97f-f67fb8cefb0d | likeweilikewei/Algorithm-Data-Structure-Implement | 链表/不带头结点反转单链表/construct.cpp | #include"link.h"
NODE construct()
{
NODE link = NULL;
NODE tmp;
NODE current = link;
int value;
cout << "please input link value,q to quit." << endl;
while (cin >> value)
{
tmp = new(nothrow) Node;
//ʧܻҪͷ֮ǰڴ
if (NULL == tmp)
{
NODE delete_tmp;
while (NULL != link)
{
delete_tmp = link;
... | TOOL | 0.936512 | 3.09391 |
f118da25-684d-48a5-b778-b15f3c801011 | mb11797/FuN | Graphs/graph_implementation_using_adjacency list_for_integer_data.cpp | #include<iostream>
#include<list>
using namespace std;
class Graph{
int V;
list<int>*l;
public:
Graph(int v){
V = v;
l = new list<int>[V];
}
void addEdge(int u, int v, bool bidir=true){
l[u].push_back(v);
if(bidir)
l[v].push_back(u);
}
void pri... | ALGO | 0.999595 | 5.2087 |
101dd3b2-1f28-476d-a7d0-d28bd0bc3952 | 4th-ndn-hackathon/ndnSIM-Mobile-Simulation-Package | examples/ndn-load-balancer/random-load-balancer-strategy.cpp | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
#include "random-load-balancer-strategy.hpp"
#include <boost/random/uniform_int_distribution.hpp>
#include <ndn-cxx/util/random.hpp>
#include "core/logger.hpp"
NFD_LOG_INIT("RandomLoadBalancerStrategy");
namespace nfd {
namespace fw {
const Name
... | ALGO | 0.906293 | 6.785488 |
919552ba-cdad-4f4f-a8ce-5fef7b294f0c | wangwwno1/PX4-Autopilot-SimulateAttack | src/systemcmds/tests/test_search_min.cpp | /**
* @file test_search_min.c
* Tests arithmetic search algorithms.
*/
#include <unit_test.h>
#include <float.h>
#include <math.h>
#include <mathlib/math/SearchMin.hpp>
// linear function
float _linear_function(float x)
{
float slope = 2.0f;
return slope * x - 1.4f;
}
//linear function without slope
float _li... | TEST | 0.941061 | 6.868393 |
1c8533fe-ca18-408f-a3e0-f391719f63be | bilal-d/benchmark-fourier | fourier_transform_radix2dif_1024.cpp | #include <complex>
namespace {
std::complex<float> constexpr w[] = {
#include "fourier_radix2dif_twiddle_1024.inc"
};
unsigned int constexpr r[][2] = {
#include "fourier_radix2dif_reorder_1024.inc"
};
template<unsigned int n, unsigned int s>
inline void
fourier_transform_radix2dif_recurse(
std::complex<float> c... | ALGO | 0.999815 | 6.073599 |
13c7b981-9d3b-41b7-882d-59f87a1ebc8e | 181182/DAT105-Advanced-programming | PrimtallArray/main.cpp | #include <iostream>
#include "cmake-build-debug/Primtall.h"
using namespace std;
#include <math.h>
#include <array>
int teller = 0;
#define SIZEOF_ARRAY(primtall) ( sizeof( primtall ) / sizeof( *primtall ) )
int *primliste() {
int *prim = new int[50];
// int teller = 0;
for (int i = 2; i < 100; i++)
... | ALGO | 0.998067 | 3.626689 |
85838ca8-92e2-4574-8a84-01575b8cfeb4 | TheDev05/CARDIO | CodeForces/Rating 1400/A_Strange_Partition.cpp | /*
Jai Shree Krishna.
Hare Krishna Hare Krishna, Krishna Krishna Hare Hare,
Hare Rama Hare Rama, Rama Rama Hare Hare.
Prayers. Practice. Patience.
*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_... | ALGO | 0.999868 | 4.16153 |
ee39a2c6-dcba-43a9-bd05-1ae31b2734c1 | TheCodeNinja254/flutter_codelabs_own_playground | namer/step_05_i_optional_changes/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.997264 | 6.785645 |
248b5839-57db-4171-b417-68ba0be8be1d | akashrautela/p3 | Class Work (19-6-19)/2 tree are mirror image or not.cpp | #include<iostream>
using namespace std;
class node
{
public:
int data;
node *left, *right;
};
int ismirror(node *root1, node *root2)
{
if(root1 == NULL && root2 == NULL) return 1;
if(root1 == NULL || root2 == NULL) return 0;
if(root1->data == root2->data)
return ismirror(root1->left , root2-... | ALGO | 0.999925 | 5.350265 |
e7db7bb8-b1c1-4c7e-a25c-b1bf5a0eda4a | divyadhimaan/leetcoding | 387-first-unique-character-in-a-string/387-first-unique-character-in-a-string.cpp | class Solution {
public:
int firstUniqChar(string s) {
int idx =-1;
vector<int> v(26,0);
for(int i=0; i<s.length();i++)
{
v[s[i]-'a']++;
}
for(int i=0; i<s.length();i++)
{
if(v[s[i] - 'a'] == 1)
{
... | ALGO | 0.99967 | 5.857947 |
bf9670a6-43a9-402e-9f20-1e1f17f27f93 | MahmoudKhalid-eng/Problem-Solving | Topics/cstring/to upper.cpp | #include <cctype>
#include <iostream>
#include <cstring>
#include <cstdio>
using namespace std;
int main()
{
char str[] = "John is from USA.";
cout << "The uppercase version of \"" << str << "\" is " << endl;
for (int i=0; i<strlen(str); i++)
putchar(toupper(str[i]));
return 0;
}
| TOOL | 0.999279 | 5.303331 |
49bced6a-8b9e-4cb1-a9e4-18d05a1f3bcc | shirnschall/Numerik2 | code/aufgabe1/eigen-3.3.7/bench/bench_gemm.cpp |
// g++-4.4 bench_gemm.cpp -I .. -O2 -DNDEBUG -lrt -fopenmp && OMP_NUM_THREADS=2 ./a.out
// icpc bench_gemm.cpp -I .. -O3 -DNDEBUG -lrt -openmp && OMP_NUM_THREADS=2 ./a.out
// Compilation options:
//
// -DSCALAR=std::complex<double>
// -DSCALARA=double or -DSCALARB=double
// -DHAVE_BLAS
// -DDECOUPLED
//
#include... | TOOL | 0.984333 | 5.829477 |
93a3cfca-4d0d-4f2b-a309-c86045733907 | kotaok/procon-archive | abc302/E/f.cpp | #include <bits/stdc++.h>
#define log(x) cout << x << endl
#define all(x) (x).begin(), (x).end()
using namespace std;
int main() {
int n;
cin >> n;
vector<vector<int>> l;
set<vector<int>> s;
for (int i = 0; i < n; i++) {
vector<int> t(3);
for (int j = 0; j < 3; j++) {
cin >> t[j];
}
sort... | ALGO | 0.999572 | 3.999866 |
e9b21589-0194-413e-a479-c3f2491f5707 | linneszyx/CP-Problems | Medium/Count number of substrings/count-number-of-substrings.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:
long long int f (string s, int k) {
if(k<0) return 0;
long long int lo=0, hi=0, ans=0, n=s.size(), cnt=0;
vector<int> A(... | ALGO | 0.99988 | 6.051026 |
bd80275b-c1f9-48a5-ba5f-b03e5dacea52 | qimao7213/TGH-Planner | uav_simulator/car_mpc/src/car_mpc_nodelet.cpp | #include <car_msgs/CarCmd.h>
#include <nav_msgs/Odometry.h>
#include <geometry_msgs/Twist.h>
#include <std_msgs/Float64.h>
#include <std_msgs/Float64MultiArray.h>
#include <nodelet/nodelet.h>
#include <ros/ros.h>
#include <nodelet/nodelet.h>
#include <Eigen/Geometry>
#include "car_mpc.hpp"
#include <tf/transform_dataty... | TOOL | 0.938874 | 3.608218 |
7d5658bf-3365-43b2-9c62-93f438525962 | CaiHuicheng/Project | Code/C++练习/STL/19STL_queue.cpp | #include<cstdio>
#include<cstring>
#include<queue>
using namespace std;
/*
结构特点:
先进先出(FIFO)
常用的方法:
queue<int> q;
q.push()------入队;
q.pop()------出队;
q.empty()----判队空;
q.front()----得到队头元素;
q.back()----得到队尾元素;
应用范围:
BFS,搜索问题等等。
经典例题
A strange lift
此电梯每层只有上下两个按钮,且只能跨越固定的楼数,给出出发点A和目的地B,求最少按电梯多少次?
*/... | ALGO | 0.999789 | 3.592382 |
0cc2f13a-231c-4406-8616-cfacdc29198d | yinheyi/LeeCode | leeCode/4_寻找两个正序列数组的中位数.cpp | #include <iostream>
#include <iomanip>
#include <vector>
#include <cstdio>
using namespace std;
class Solution {
public:
Solution() : isOdd(false), totalToDelete(0) {}
double findMedianSortedArrays(vector<int>& nums1, vector<int>& nums2)
{
if (nums1.empty() && nums2.empty()) {
return ... | ALGO | 0.999988 | 5.347541 |
2f66a2f7-0f60-47a5-9bd9-3cca7f9df4b3 | TanushreeSB/Code-1000 | Binary Search/binsearch.cpp | #include <iostream>
using namespace std;
// Function to perform binary search
int binarySearch(int arr[], int size, int key) {
int start = 0;
int end = size - 1;
// Calculate mid-point
int mid = start + (end - start) / 2;
// Loop until the search space is exhausted
while (start <= end) {
... | ALGO | 0.999995 | 6.909903 |
3f794c6c-2e4a-4427-be28-ce19c994f382 | Awadheshbairagi/DSA-Questions | 025. Reverse Nodes in k-Group.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
// Solution 1.
class Solution {
public:
ListNode* reverseKGroup(ListNode* head, int k) {
ListNode* pre = new ListNode(0);
pre->next = head;
... | ALGO | 0.999997 | 5.912311 |
c87fdac6-ed6e-45bb-8402-f8e4ae46551b | tao73bot/codes | codeforces_552_B.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
long long n,i,digits=0,ans=0,x,a;
cin >> n;
a = n;
while (a!=0)
{
a/=10;
digits++;
}
for(i=digits;i>0;i--){
if(i==digits){
ans += (n-round(pow(10,i-1))+1)*i;
}
else
{... | ALGO | 0.99957 | 3.740336 |
db6d9853-375b-4fde-9cd2-7dd695216769 | sahwa/fastmatrix | include/eigen/doc/examples/function_taking_ref.cpp | #include <iostream>
#include <Eigen/SVD>
using namespace Eigen;
using namespace std;
float inv_cond(const Ref<const MatrixXf>& a)
{
const VectorXf sing_vals = a.jacobiSvd().singularValues();
return sing_vals(sing_vals.size()-1) / sing_vals(0);
}
int main()
{
Matrix4f m = Matrix4f::Random();
cout << "matrix m:... | ALGO | 0.999898 | 5.283265 |
389e2936-c0da-417b-b94f-2d3868f78642 | mmxsrup/procon | atcoder/disco/2017/d.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<pint> vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=n-1;i>=(0);i--)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin(... | ALGO | 0.999872 | 4.005908 |
50359b18-04da-4b34-8bd0-6f65a1de7d4e | ishankhanna28/Data-Structures-and-Algorithms | Queue/StaticQueue.cpp | #include <iostream>
using namespace std;
const int Max = 5;
void Qinsert(int a[], int &f, int &r, int d)
{
if(r==Max-1)
{
cout<<"Queue is Full"<<endl;
return;
}
if(r==-1)
f=0;
a[++r]=d;
}
void Qdelete(int a[], int &f, int &r)
{
if(f==-1)
{
cout<<"Queue is Empty"<<endl;
return;
}
if(f==r)
{
f=... | ALGO | 0.872771 | 3.749041 |
0c2b1370-4e33-4f38-bd99-55bdf45d763a | AhmedHani/Online-Judges-Problems-SourceCode | SPOJ/BUGLIFE.cpp | #include <cstdlib>
#include <stdio.h>
#include <string.h>
#include <string>
#include <iostream>
#include <map>
#include <algorithm>
#include <functional>
#include <math.h>
#include <vector>
#define Max 21000 + 5
#define INF 1000000000
#define BLUE 1
#define RED 2
//#define INT_MAX 2147483647
#define FOR(i, N) for( int ... | ALGO | 0.999717 | 4.245111 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.