uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
f1bd2362-1c8a-4784-bb14-31cfce23ab1d | vipul-kumar455/GeeksForGeeks-problem-of-the-day | Stack/Get min at pop.cpp | //Function to push all the elements into the stack.
stack<int> _push(int a[],int n)
{
// your code here
stack<int>s;
s.push(a[0]);
for(int i=1;i<n;i++)
{
s.push(min(s.top(),a[i]));
}
return s;
}
//Function to print minimum value in stack each time while popping.
void _getMinAtPop(stack... | ALGO | 0.999974 | 5.13556 |
c6649987-cb85-4e38-a3ee-b8d786c5324a | prasadbylapudi/DSA | pascal_traingle.cpp |
//program to find the frequency of elements in vector using map.
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
// void printFrequency(vector<int>vec){
// map<int,int> M;
// for(int i=0;i<vec.size();i++)
// {
// if(M.find(vec[i])==M.end()){
// M[vec[i]]=1;
//... | ALGO | 0.999675 | 4.467882 |
fb6b5183-54a4-41b0-b300-bebbfc32c1c6 | Windcloud8/opencv-contribute | modules/xphoto/src/learning_based_color_balance.cpp | #include "learning_based_color_balance_model.hpp"
#include "opencv2/core.hpp"
#include "opencv2/core/hal/intrin.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/xphoto.hpp"
using namespace std;
#define EPS 0.00001f
namespace cv
{
namespace xphoto
{
inline void getChromaticity(Vec2f &dst, float R, float G, float... | ALGO | 0.929906 | 5.703774 |
e3735c4b-b5fc-454f-9e17-fc9c8fbc6a82 | Justinshao33/competitive_programming | done/Codeforces/F_The_Sum_of_the_k_th_Powers.cpp | #pragma GCC optimize("O3,unroll-loops")
// #pragma GCC target("avx,popcnt,sse4,abm")
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define rep(X, a, b) for(int X = a; X < b; ++X)
usin... | ALGO | 0.999983 | 4.743749 |
916ccfa3-0c14-494c-9dd8-b874d12ee138 | LocalPiperITMO/DSA | yandex_contest/M.cpp | #include <fstream>
#include <iostream>
#include <list>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <vector>
using namespace std;
const long INF = 1e7;
struct Node {
long g;
int num;
};
bool operator<(const Node &a, const Node &b) { return a.g > b.g; }
int main() {
ifstre... | ALGO | 0.999942 | 3.967249 |
a814bae1-c7a5-4365-9878-91ea0f2a5283 | ppzzyy11/cpp_algorithm_datastructure_practice | SegmentTree.cpp | /*
* Segment Tree | Minimum Range Query
*
* Two interface:
* 1.Update(int idx,int val);//set val to nums[idx]
* 2.GetMin(l,r) //get the Minimum of range from l to r
*
* Range Minimum Query
* http://www.geeksforgeeks.org/segment-tree-set-1-range-minimum-query/
*
*/
#include<iostream>
#include<vector>
#include<... | ALGO | 0.999981 | 4.64138 |
44568dee-e7f8-4960-bcae-d475b62ba632 | rickalon/DSA-LeetCode-solutions | Arrays & Strings/roman-to-integer.cpp | class Solution {
public:
int romanToInt(string s) {
int result {0};
int size = s.size();
for(int iii=0;iii<s.size();++iii)
{
if(s[iii] == 'I' && iii+1 < size && s[iii+1]=='V')
{
result += 4;
iii++;
}
else if(s[iii] == 'I' && iii+1 < size && s[iii+1]=='X')
{
... | ALGO | 0.999421 | 6.17576 |
1e287695-9fb4-47b8-998b-e820c53fee08 | meizhitu/pojExec | interview/Construct Binary Tree from Inorder and Postorder Traversal.cpp | #include <iostream>
#include <vector>
using namespace std;
typedef struct TreeNode {
int val;
TreeNode *left;
TreeNode *right;
TreeNode(int x) : val(x), left(NULL), right(NULL) {}
}TreeNode;
TreeNode * compute(vector<int> &inorder,int s,int e, vector<int> &postorder,int idx)
{
if(idx<0) return 0;
if(s>e) return ... | ALGO | 0.999991 | 5.096107 |
badf1eec-7ba4-4508-87b0-82876126a897 | leehi0110/Algorithm | ProgrammersAlgorithm/Cpp/Level_1/L1_Spaced_Number.cpp | #include <string>
#include <vector>
using namespace std;
vector<long long> solution(int x, int n) {
vector<long long> answer;
for(int i=1;i<=n;i++){
answer.push_back(i*x);
}
return answer;
} | ALGO | 0.999852 | 3.894567 |
c520b043-0c74-47b2-9ad1-1b566ad497c8 | VijayNegi/LeetHub | 557-reverse-words-in-a-string-iii/557-reverse-words-in-a-string-iii.cpp | class Solution {
public:
string reverseWords(string s) {
int n = s.size();
string::size_type pos=0;
while(pos < n) {
int next = s.find(' ',pos);
if(next ==string::npos)
next = n;
auto st =s.begin();
auto ed =s.begin();
... | ALGO | 0.99993 | 6.087955 |
167a9194-b3ba-411d-80d6-7dad412ed8ac | Marcux777/Programacao_Competitiva | Beecrowd/Organizar/BEE1031.cpp | #include <bits/stdc++.h>
using namespace std;
int survivor(int n, int k)
{
int i, Tnk = 0;
for (i = 1; i < n; ++i)
Tnk = (Tnk + k) % i;
return Tnk;
}
int main()
{
int n;
while (cin >> n && n)
{
int aux = 1;
while (survivor(n, aux) + 2 != 13)
{
aux... | ALGO | 0.999801 | 3.582397 |
2acfd0da-23e2-41af-a1cb-0b1b477011db | shirishbahirat/interview | msm.cpp | #include <iostream>
using namespace std;
typedef void (*_dispatch) (int);
struct api {
_dispatch dispatch;
api(_dispatch d):dispatch(d){}
};
struct cdb{
uint32_t cmd : 8;
uint32_t ecc :16;
uint32_t crc : 8;
};
int indxc = 0;
void merge(int arr[], int lo, int mid, int hi)
{
int... | ALGO | 0.998792 | 4.003671 |
459bd7f5-7a31-49a4-9d3b-e8558d3e642b | WickeyC/dspc-prac | prac3/P3Q2A.cpp | // P3Q2.cpp : Defines the entry point for the console application.
//
//#include "stdio.h"
//#include "omp.h"
//
//static long num_steps = 100000;
//double step;
//
//int main()
//{
// int i;
// double x, pi, sum = 0.0;
// step = 1.0 / (double)num_steps;
//
// for (i = 0; i < num_steps; i++)
// {
// ... | ALGO | 0.999975 | 3.653614 |
bd9c85a3-5d1b-44e2-9375-3fdca2be443d | nhatdang2604/CPP | 6.2b.cpp | // 6.2b.cpp : Defines the entry point for the console application.
//
#include <iostream>
using namespace std;
void input(int &n) {
cout << "Moi thay nhap chieu cao cua tam giac Pascal: ";
cin >> n;
}
int C(int n, int k) {
if (k == n || k == 1 || n == 1) return 1;
return C(n - 1, k - 1) + C(n - 1, k);
}
void pr... | ALGO | 0.989813 | 4.936886 |
dfef2300-8ae5-4d17-b6c9-2682be7ae7c7 | ziyanghong/Radar-SLAM | Thirdparty/codegen/lib/generateGlobalFeature/xnrm2.cpp | /* Include files */
#include "xnrm2.h"
#include "generateGlobalFeature.h"
#include "rt_nonfinite.h"
#include <cmath>
/* Function Definitions */
double b_xnrm2(const double x[3], int ix0)
{
double y;
double scale;
int kend;
int k;
double absxk;
double t;
y = 0.0;
scale = 3.3121686421112381E-170;
kend ... | ALGO | 0.998116 | 4.838262 |
2bc30d54-777a-49fa-834d-3afcd4827737 | naveenls/Competitive-Coding | C++/test110.cpp | #include<bits/stdc++.h>
using namespace std;
long long mod=1e9+7;
const int maxN=1e5+1;
long long DP[maxN+1];
int main()
{
int t,k;
cin>>t>>k;
for(int i=0;i<k;i++)
{
DP[i]=1;
}
for(int i=k;i<maxN;i++)
{
DP[i]=(DP[i-1]+DP[i-k])%mod;
}
for(int i=1;i<maxN;i++)
{
DP[i]=(DP[i]+DP[i-1])%mod;
}
while(t--)
... | ALGO | 0.999958 | 4.556306 |
52b1a049-22fe-41c7-b6e7-48659f1875e3 | 233wer/rebelwar_mapbase_source | sp/src/utils/vrad/vraddisps.cpp | #include "vrad.h"
#include "utlvector.h"
#include "cmodel.h"
#include "BSPTreeData.h"
#include "VRAD_DispColl.h"
#include "CollisionUtils.h"
#include "lightmap.h"
#include "Radial.h"
#include "CollisionUtils.h"
#include "mathlib/bumpvects.h"
#include "utlrbtree.h"
#include "tier0/fasttimer.h"
#include "disp_vrad.h"
cl... | ALGO | 0.969745 | 3.946927 |
9b9f8ab8-761c-4d2c-96ae-038b748a5686 | laureanobruno/ObservAR | ESP32/ObservAR_inferencing/src/edge-impulse-sdk/tensorflow/lite/micro/kernels/micro_tensor_utils.cpp | #include "edge-impulse-sdk/tensorflow/lite/micro/kernels/micro_tensor_utils.h"
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <cstring>
#include <limits>
#include <utility>
#include "edge-impulse-sdk/third_party/gemmlowp/fixedpoint/fixedpoint.h" // from @gemmlowp
#include "edge-impulse-sdk/tensorf... | ALGO | 0.992886 | 7.539769 |
b4872492-71f8-4943-98c2-cc9390269c15 | fraregom/G_VRP_BT-FC | functions.cpp | #include "functions.h"
/*!
* Función encargada de "dividir" un string según delimitador
*
* @param str: String que se desea dividir
* @param delimiter: Delimitador que se quiere utilizar.
* @return vector<string>: Vector string con el resultado de la división.
*/
vector<string> split_string(const string& str,
... | ALGO | 0.999586 | 4.196279 |
cf2cf643-5ffc-4fa9-a704-37b08bf53535 | pishabh625/TOC-Programs | noOf(1's & 0's)[CO-46 Rishabh Patel].cpp | /******************************************************************************
Online C++ Compiler.
Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.
******************************************... | ALGO | 0.996341 | 5.578007 |
e98229a9-3636-403d-bf7e-4d3ecbc493c9 | yash0260/Leetsol | 0494-target-sum/0494-target-sum.cpp | class Solution {
public:
int findTargetSumWays(vector<int>& nums, int target) {
unordered_map<int, int> dp;
dp[0] = 1;
for (int num : nums) {
unordered_map<int, int> next_dp;
for (auto& entry : dp) {
int sum = entry.first;
int count = en... | ALGO | 0.999982 | 6.484609 |
064b55b0-cc5e-49a0-8426-ad6444e0956b | deanyim0226/onnuriLeetcode | solutions/112.PathSum/sunny.cpp | 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), left(left), right(right) {}
};
class Solution {
... | ALGO | 0.999966 | 6.271035 |
1d4a3ffa-b561-4e59-8690-f7647cb533bb | ivanalejandro2002/Competitive-Programming-Problems | UvaJudge/10000/11000/11044searchForNessy.cpp | #include <bits/stdc++.h>
#include <fstream>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define LSOne(S) ((S)&(-S))
#define all(S) S.begin(),S.end()
#define fore(V,I,F) for(int V=I;V<=F;V++)
typedef long long int ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> v... | ALGO | 0.999941 | 4.172446 |
422cf2d6-0106-4a63-97ff-6c73c0be5bc2 | gabriel-candeia/Competitive-Programming-Solutions | Codeforces/[GYM] - Samara Farewell Contest 2020 (XXI Open Cup, GP of Samara)/L.cpp | #include<bits/stdc++.h>
#define fastio() ios_base::sync_with_stdio(false), cin.tie(NULL)
using namespace std;
int main(){
fastio();
int n, k;
vector<int> arr, dp, nxt, succ, parent, parentRemoved;
vector<vector<int>> adj;
map<int,int> last;
cin >> n >> k;
arr.assign(n,0), dp.assign(n+1,n),... | ALGO | 0.999992 | 3.620526 |
c082c9f4-cc22-4297-a7e3-b6ec612aa285 | letoleto3/prog | matrix.cpp | #include "head.h"
int solve_tridiag_matrix (double *a, double *b, double *x, double *workspace, int n)
{
int i, idx;
double d;
double *alpha = workspace;
double *betta = alpha + n;
if (fabs (a[1]) < EPS)
return -1;
alpha[1] = - a[2] / a[1];
betta[1] = b[0] / a[1];
for (i = 1, idx = 3; i < n - 1... | ALGO | 0.999983 | 4.805661 |
e4db0fc5-5c99-43f3-8ad7-b828932fc947 | SalmaRedaBedair/datastructure-algorithms | datastructure&algorithms/heap/main.cpp | #include <iostream>
using namespace std;
int left(int x)
{
return 2*x;
}
int right(int x)
{
return 2*x+1;
}
int parent(int x)
{
return x/2;
}
void MaxHeapify(int *a,int length,int i)
{
int l=left(i),
r=right(i),
largest;
if(l<length&&a[l]>a[i])
{
largest=l;
}else largest=i... | ALGO | 0.999689 | 3.599783 |
5dd17be0-f514-42af-9ef4-0c35978d7fe3 | ishandutta2007/codeforces | weakesttopology/normal/1300/B.cpp | #include "bits/stdc++.h"
using namespace std;
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
vo... | ALGO | 0.999326 | 4.402673 |
9b81429d-95d5-42c4-bdce-fe0004ed8eb3 | Keyur1284/GFG-Solutions | First non-repeating character in a stream - GFG/first-nonrepeating-character-in-a-stream.cpp | //{ Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
string FirstNonRepeating(string A){
unordered_map<char, int> freq;
queue<char> q;
string ans = "";
for (auto &it : A)
{
freq[it]... | ALGO | 0.999929 | 5.693934 |
ba44d15b-2367-45fb-b145-d482f13bcbf8 | JakeTrock/timedout_lookslike | 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 |
69d0ed6b-b1df-4def-81a5-1dbe43c20129 | SourabhGurwani/Leetcode-Question | 2236-maximum-twin-sum-of-a-linked-list/maximum-twin-sum-of-a-linked-list.cpp |
class Solution {
public:
int length(ListNode* head){
ListNode* temp=head;
int i=0;
while(temp){
temp=temp->next;
i++;
}
return i;
}
int pairSum(ListNode* head) {
if(head==nullptr) return 0;
int len=length(head);
ListNod... | ALGO | 0.999995 | 5.418609 |
a46ee1ad-f03c-49aa-9631-8ece1ab15ec2 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_7212_11.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 3e3 + 50;
int n, k, c[N];
long long *sm[N], ans;
long long dp[18][N];
void work(int d, int l, int r) {
if (l == r) {
for (int i = 0; i <= k; i++)
if (k - i <= c[l]) ans = max(ans, dp[d - 1][i] + sm[l][k - i]);
return;
}
int mid = (l + r) >>... | ALGO | 0.999937 | 3.172444 |
0bd99fc1-6f9e-4846-96dc-8c6b1cbec955 | SPsuyash/LeetCode | 0201-bitwise-and-of-numbers-range/0201-bitwise-and-of-numbers-range.cpp | class Solution {
public:
int rangeBitwiseAnd(int m, int n) {
int c=0;
while(m!=n)
{
m>>=1;
n>>=1;
c++;
}
return m<<=c;
}
}; | ALGO | 0.999946 | 5.964241 |
2c84af54-4e5f-4ef3-b198-7370ac7c8084 | Krish-Parekh/Data-Structure-And-Algorithm | Queue/Queue_Using_LL.cpp | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
template<typename T>
class node
{
public:
T data;
node<T> *next;
node(T data)
{
this->data = data;
next = NULL;
}
};
template<typename V>
class Queue{
node<V> *head;
node<V> *tail;
int size;
public:
... | ALGO | 0.986176 | 4.035445 |
ebc380eb-b590-44c7-a51d-6184016d8632 | bww9641/Algorithm_Project | codeforce/95_edu/A.cpp | #include<bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false); cin.tie(nullptr)
using namespace std;
int main(){
long long t,x,y,k;
long long tmp;
cin >> t;
while(t--){
cin >> x >> y >> k;
tmp=(long long)ceil((long double)((y+1)*k-1)/(x-1));
cout << tmp+k << '\n';
}
} | ALGO | 0.999423 | 3.32775 |
c00b27e8-ccf4-4fd8-830b-8d9b19ab41ee | ans2568/ROS2_nodes | jackal/LeGO-LOAM_node/yujin_yrl_v2_package/eigen-3.3.7/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_rowwise.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
int main()
{
Eigen::MatrixXf mat(2,4);
mat << 1, 2, 6, 9,
3, 1, 7, 2;
std::cout << "Row's maximum: " << std::endl
<< mat.rowwise().maxCoeff() << std::endl;
}
| ALGO | 0.999624 | 3.881484 |
b068e3f2-88bf-4ab1-9eb6-bf175df5053b | ong-wei-hong/coding-problems | kattis/skener/main.cpp | #include <iostream>
#include <string>
int r, c, zr, zc;
std::string s;
int main() {
std::ios_base::sync_with_stdio(false);
std::cin.tie(nullptr);
std::cin >> r >> c >> zr >> zc;
while (r--) {
std::cin >> s;
for(int i{0}; i<zr; ++i) {
for(auto& c: s)
for(int... | ALGO | 0.982112 | 3.420305 |
dba30a1c-7f45-4e19-a2ad-b219d695ce36 | krishnas005/CPP-Codes | A_Sasha_and_His_Trip.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
int32_t main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int n, v;
cin >> n >> v;
if (n-1 <= v) {
cout << n-1 << endl;
return 0;
}
int ans = v-1;
for (int i = 1; i <= n... | ALGO | 0.999826 | 3.066221 |
d328c739-8f00-4fd0-9b2a-6b98be20eb69 | nvnamsss/leetcode | assesments/0819/q1.cpp | #include <bits/stdc++.h>
using namespace std;
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), left(left), right... | ALGO | 0.999717 | 5.801876 |
ec2bf349-e096-4325-8264-ecfdd51bcaad | unsuspectingchi/Reed-Code-Sample | algorithms/src/Problem3.cpp | #include <stdio.h>
#include "Problem3.hpp"
namespace Problem3
{
// O(n^2)
// - Loops through each array position, and for each, loops again through the
// array, multiplying all other elements, excluding the one at that position.
void GetProductArrayV1(int size, int *in, int *out)
{
for (int i = 0; i ... | ALGO | 0.999841 | 4.93592 |
8edfebdd-cfdf-413c-be91-e9d8cf7f2aa4 | Charleyhoo/C-basic-plus | basic/Fabonacci Optimize/nest.cpp | //时间复杂度:O(N^2log5N)
#include <iostream>
#include <iomanip> // 用于设置输出格式
using namespace std;
void fun(int n) {
for(int i = 1; i <= n; i++) {
for(int j = 1; j <= n; j++) {
int k = 1;
while(k <= n) {
cout << "Addresses of variables: " << endl;
cout << ... | ALGO | 0.975301 | 3.294657 |
20393bb9-97e4-4eeb-b60d-8f3144388215 | efeslab/nvm-file-indexing | api/p-hot/boost_1_73_0/libs/fusion/example/performance/inner_product2.cpp | #include <boost/array.hpp>
#include <boost/timer.hpp>
#include <boost/fusion/algorithm/iteration/accumulate.hpp>
#include <boost/fusion/algorithm/transformation/transform.hpp>
#include <boost/fusion/container/vector.hpp>
#include <boost/fusion/algorithm/transformation/zip.hpp>
#include <boost/fusion/sequence/intrinsic... | TEST | 0.990136 | 6.179477 |
261bc4c0-b174-438b-b5b7-89341aeafeda | Coders-Evoke-Community/DailyDsaWithCodersEvoke | Questions/Day 2/Cpp/Q1.cpp | #include <iostream>
using namespace std;
int main()
{
cout << "Enter a: ";
int a = 0;
cin >> a;
cout << "Enter b: ";
int b = 0;
cin >> b;
cout << "Enter c: ";
int c = 0;
cin >> c;
int max = INT8_MIN;
if (a >= max)
max = a;
if (b >= max)
max = b;
if... | ALGO | 0.869363 | 4.073508 |
c472d294-5185-4de4-9e17-5323da3c894d | FFFFFRYGIO/Studia | inżynier/ALS - Algorytmy i Struktury Danych/quels/quels.cpp | #include <iostream>
#include <ctime>
#include <conio.h>
using namespace std;
const int L=4;
int n;
typedef struct Elem{
int x;
int key;
}Elem;
typedef struct keys{
int first, second;
}keys;
bool isEmpty(Elem* quel){
for(int i=0;i<n;i++)
if(quel[i].x!=0)
return false;
return t... | ALGO | 0.990572 | 3.330409 |
1bf47657-bcdb-49f0-bc6d-fde73d4422cd | CedricKuang/LeetCode | easy/1351.count-negative-numbers-in-a-sorted-matrix.cpp | /*
* @lc app=leetcode id=1351 lang=cpp
*
* [1351] Count Negative Numbers in a Sorted Matrix
*/
// @lc code=start
#include <vector>
using namespace std;
class Solution {
public:
int countNegatives(vector<vector<int>>& grid) {
int ans = 0;
for (int i = 0, j = grid[0].size() - 1; i != grid.size()... | ALGO | 0.999959 | 6.626446 |
7de6175d-4409-495e-a657-15f5e18e2f3b | Abhinav7076/My-Codes | Company Coding Questions/PayTM/Segregate Prime and Non-Prime Numbers in an array.cpp | // Input: arr[] = {1, 8, 2, 3, 4, 5, 7, 20}
// Output: 7 5 2 3 4 8 1 20
// Explanation:
// The output consists of all the prime numbers 7 5 2 3, followed by Non-Prime numbers 4 8 1 20.
// Input: arr[] = {2, 3, 4, 5, 6, 7, 8, 9, 10}
// Output: 2 3 7 5 6 4 8 9 10
// C++ program for the above approach
#include <iostream... | ALGO | 0.999994 | 5.786777 |
5e1afacb-4f58-43b3-8514-4cdd544cd6bf | oscardegroot/pedsim_original | src/ped_scene.cpp | #include "pedsim_original/ped_scene.h"
#include "pedsim_original/ped_agent.h"
#include "pedsim_original/ped_obstacle.h"
#include "pedsim_original/ped_tree.h"
#include "pedsim_original/ped_waypoint.h"
#include <cstddef>
#include <algorithm>
#include <stack>
using namespace std;
/// Default constructor. If this constr... | TOOL | 0.891364 | 5.369237 |
86d53ff7-adf8-40c7-882b-46c0b1b9e4ff | Abhishekkute234/Data-Structure-and-Algorithm-in-CPP | STRIVE_A_to_Z_Sheet/Step 05 ~ Strings/01.EASY PROBLEMS/07-CHECK-ANAGRAM.CPP | #include <bits/stdc++.h>
using namespace std;
// https://practice.geeksforgeeks.org/problems/anagram-1587115620/1
class Solution
{
public:
//Function is to check whether two strings are anagram of each other or not.
bool isAnagram(string a, string b){
// Your code here
if(a.length... | ALGO | 0.999961 | 5.422551 |
c8d9cf1c-328d-4ffe-92f0-0951e73177a2 | Mohamedsaied8/SWE | ModernC++/Containers/linked_list_g17.cpp | #include <iostream>
typedef char Data;
struct Node
{
Data data;
Node* next;
};
void Search(Node* head, Data key)
{
if(head->data == key)
{
std::cout << "Element found" << std::endl;
}
}
void Print(Node* head)
{
std::cout << "data " << head->data << "\n";
}
void Traverse(Node *head... | ALGO | 0.999581 | 4.088263 |
7026dacc-56ef-450c-8b50-54c50ebf2a98 | Dineshjat1106/cpp-full-course | quick-sort-23/sort-array-1.cpp | #include<iostream>
using namespace std;
int partition(int arr[],int si,int ei){
int pivatele=arr[si];
int count=0;
for(int i=si+1;i<=ei;i++){
if(arr[i]<=pivatele) count++;
}
int pivatidx=count+si;
swap(arr[si],arr[pivatidx]);
int i=si;
int j=ei;
while(i<pivatidx && j>pivatidx... | ALGO | 0.999985 | 5.068143 |
b4746984-d460-43f2-8cc2-73adcc9c7437 | next-step-for-interview-prep/Coding-Ninjas-DSA-course_code_and_notes_cpp | Milestone-4=DSA/questions and solutions/Lec-9=Linkedlist-2/09-Swap_two_nodes_of_linkedlist.cpp | // #include <iostream>
// #include <vector>
// using namespace std;
// void recursive(int n, vector<int> &ans)
// {
// if (n == 0)
// {
// return;
// }
// ans.push_back(n);
// recursive(n - 1, ans);
// }
// int main(int argc, char const *argv[])
// {
// int n;
// cin >> n;
// v... | ALGO | 0.999971 | 6.318519 |
4edbfa95-ef7c-4bfb-9e18-91172197f47f | martinezdiego/competitive-programming | solutions/Leetcode/May Challenge/Week 3/minimum_moves_to_equal_array_elements.cpp | // Given an integer array nums of size n, return the minimum number of moves required to make all array elements equal.
//
// In one move, you can increment or decrement an element of the array by 1.
//
// Test cases are designed so that the answer will fit in a 32-bit integer
class Solution {
public:
int minMov... | ALGO | 0.999937 | 6.025659 |
6eb094d7-cc25-4ec7-a136-891d0865aeba | Camixxx/ROS-Noetic-pr2 | catkin_ws/src/moveit/moveit_ros/robot_interaction/src/robot_interaction.cpp | /* Author: Ioan Sucan, Adam Leeper */
#include "moveit/robot_interaction/robot_interaction.h"
#include <moveit/robot_interaction/interaction_handler.h>
#include <moveit/robot_interaction/interactive_marker_helpers.h>
#include <moveit/robot_interaction/kinematic_options_map.h>
#include <moveit/transforms/transforms.h>
... | TOOL | 0.865681 | 7.310278 |
fb05a5c5-455b-4961-a217-794fa7eaab8d | dankanium/Coding-Ninjas | Data Structures in C++/Lecture 17 - Backtracking/NQueenProblem.cpp | #include<bits/stdc++.h>
using namespace std;
int board[11][11];
bool flag = true;
bool isPossible(int n, int row, int col)
{
// same column
for (int i = row - 1; i >= 0; i--)
{
if (board[i][col] == 1)
return false;
}
// upper left diagonal
for (int i = row - 1, j = col - 1; i... | ALGO | 0.999951 | 5.234371 |
105193be-1d2a-40f7-82f2-d1c64dcad100 | gtkn/atcoder | ABC_310_C.cpp | //title
#include <bits/stdc++.h>
using namespace std;
//#include <atcoder/all>
//using namespace atcoder;
#define rep(i,n) for (ll i = 0; i < (n); ++i)
#define rep1(i,n) for (ll i = 1; i <= (n); ++i)
#define repr(i,n) for (ll i = (n)-1; i >= 0; --i)
#define rep1r(i,n) for (ll i = (n); i > 0; --i)
#define bit(n,k) ((n>>... | ALGO | 0.999861 | 4.358993 |
b6892f94-c46e-4a0b-9cb0-86ea5a826e14 | FelixLN2/TP1_Emergente | TP1_Emergente/TP1_Emergente.cpp | // TP1_Emergente.cpp : Ce fichier contient la fonction 'main'. L'exécution du programme commence et se termine à cet endroit.
//
#include <iostream>
#include <string>
using namespace std;
void trierTab(int* tab, int taille) {
for (int i = 0; i < taille - 1; ++i) {
for (int j = 0; j < taille - i - 1; ++j)... | TOOL | 0.978961 | 4.696241 |
69524212-2640-4bfb-a447-10fbacc09fb1 | aarya280404/Leetcoder | Difficulty: Medium/Delete all occurrences of a given key in a doubly linked list/delete-all-occurrences-of-a-given-key-in-a-doubly-linked-list.cpp | //{ Driver Code Starts
// Initial Template for C++
#include <bits/stdc++.h>
using namespace std;
struct Node {
int data;
struct Node* next;
struct Node* prev;
};
void push(struct Node** head_ref, int new_data) {
struct Node* new_node = (struct Node*)malloc(sizeof(struct Node));
new_node->data = n... | ALGO | 0.999959 | 5.825774 |
a2dcdd91-c9cf-4cad-bfcd-30e8a3272415 | Aditya007it/Practice-SDE-sheet | Practice SDE sheet/Day-10 ( Binary Search )/single_element_in_a_sorted_array.cpp |
// Submitted on Jun 15, 2022, 1:43:25 PM
#include<bits/stdc++.h>
int bs(vector<int> &arr, int n){
int low = 0;
int high = n-1;
while(low <= high){
int mid = low + (high - low)/2;
if(arr[mid] != arr[mid+1] && arr[mid] != arr[mid-1]){
return mid;
}
else i... | ALGO | 0.999874 | 4.712902 |
27d3c84a-12a5-4e84-b883-d0c99dd70c6a | saga92/leetcode | lowest_common_ancestor_of_binary_tree.cpp | #include<cstdio>
struct TreeNode {
int val;
TreeNode *left;
TreeNode *right;
TreeNode(int x) : val(x), left(NULL), right(NULL) {}
};
class Solution {
public:
TreeNode* lowestCommonAncestor(TreeNode* root, TreeNode* p, TreeNode* q) {
if(!root||root==p||root==q){return root;}
TreeNod... | ALGO | 0.999996 | 5.222447 |
2e35903d-fa5a-4940-a5dd-fa1b266966e1 | dhanashreeg368/DSA-Practice-Questions | 0290-word-pattern/0290-word-pattern.cpp | class Solution {
public:
bool wordPattern(string pattern, string s) {
unordered_map<char, size_t> dp;
unordered_set<size_t> seenWords;
istringstream ss(s);
string word;
size_t h;
int i = 0;
while (ss >> word) {
h = hash<string>()(word);
... | ALGO | 0.998762 | 6.445951 |
832bb342-4889-4acd-a1d4-e5eec49f10f7 | royayon/CPlusPlus | MyCodes/LightOJ/1000.cpp | #include<iostream>
using namespace std;
int main()
{
int T;
cin>>T;
for(int i=1; i<=T; i++){
int a,b;
cin>>a>>b;
cout<<"Case "<<i<<": "<<a+b<<endl;
}
}
| ALGO | 0.992361 | 5.247874 |
274c00da-f209-4e7e-9cf8-295dcb2e4189 | yuforest/contests | abc_136/d/d.cpp | // g++ -o d.out d.cpp -std=c++17
// oj d https://atcoder.jp/contests/abc222/tasks/abc222_d
// oj t -c "./d.out"
// oj s https://atcoder.jp/contests/abc222/tasks/abc222_d d.cpp
#include <bits/stdc++.h>
using namespace std;
int n, k;
int c[300005];
map<int, int> mp;
// long long mod = 1000000007;
// 縦軸が弁当の種類、横軸がたこ焼きの数、配... | ALGO | 0.999697 | 4.085051 |
29016c5a-8398-4b67-800f-f79689de30d8 | amitgupta7061/My-Dsa-Prepration | 28. Segment Tree/range_freq_Query.cpp | #include<bits/stdc++.h>
using namespace std;
vector<unordered_map<int, int>> SegmentTree;
unordered_map<int, int> addMap(unordered_map<int, int> &mp1, unordered_map<int, int> &mp2){
unordered_map<int, int> result(mp1.begin(), mp1.end());
for(auto p : mp2){
if(result.count(p.first))
result[... | ALGO | 0.999821 | 4.808684 |
eb2dbd1e-cc4b-4ee8-ad94-f44caee17705 | SoulEater1998/tinyrenderer | .history/main_20201021151733.cpp | #include"drawfunc.h"
#include"model.h"
#include<cstring>
#include<map>
const TGAColor white = TGAColor(255, 255, 255, 255);
const TGAColor red = TGAColor(255, 0, 0, 255);
Vec3f origin_point(0,0,0);
Vec3f eye(0,1,3);
Vec3f center(0,0,0);
Vec3f up(0,1,0);
Vec3f light_dir(0,0,-1);
struct ve... | ALGO | 0.898121 | 4.033612 |
70a44a64-aac4-4688-b5a1-ff4df473c4f0 | qhho/GaussianBeliefTrees | src/StatePropagators/SimpleStatePropagator.cpp | /* Author: Qi Heng */
#include "StatePropagators/SimpleStatePropagator.h"
#include "ompl/control/spaces/RealVectorControlSpace.h"
#include "ompl/util/Exception.h"
using namespace ompl;
SimpleStatePropagator::SimpleStatePropagator(const oc::SpaceInformationPtr &si) : oc::StatePropagator(si)
{
duration_ = si->getPr... | ALGO | 0.994358 | 6.647552 |
fe6ccf51-97bf-4875-8067-e719006868bb | MunSeoHee/baekjoon | algorithm/algorithm/6_2 보글보글.cpp | #include<iostream>
#include <string>
using namespace std;
char arr[5][5] = { { 'U','R','L','P','M' },{ 'X','P','R','E','T' },{ 'G','I','A','E','T' },{ 'X','T','N','Z','Y' },{ 'X','O','Q','R','S' } };
int xy[8][2] = { {-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,-1},{1,0},{1,1} };
bool flag=false;
void boggle(string word, int... | ALGO | 0.999966 | 4.390288 |
af757828-14d9-4489-b588-b8a67d38833c | bvbasavaraju/competitive_programming | leetcode/weekly/208.cpp | /****************************************************
Date: Sept 27th, 2020
Successful submissions : 3
Time expiration : 0
Not Solved : 0
Wrong Answer/ Partial result : 1
link: https://leetcode.com/contest/weekly-contest-208
****************************************************/
#include <iostream>
#include <vector>
#i... | ALGO | 0.998142 | 5.364338 |
b1449975-aa35-4405-8589-c48679e5cb85 | jiezhoucs/llvm-analysis | lld/ELF/Relocations.cpp | #include "Relocations.h"
#include "Config.h"
#include "LinkerScript.h"
#include "OutputSections.h"
#include "SymbolTable.h"
#include "Symbols.h"
#include "SyntheticSections.h"
#include "Target.h"
#include "Thunks.h"
#include "lld/Common/ErrorHandler.h"
#include "lld/Common/Memory.h"
#include "lld/Common/Strings.h"
#inc... | TOOL | 0.937244 | 4.588493 |
ceff165e-afdb-46e4-bb61-815597a8cb86 | Korinin38/raytracing-hw | src/io/scene_parser.cpp | #include "scene_parser.h"
#include <utils/matrix.h>
#include <cstdlib>
#include <iostream>
// Define these only in *one* .cc file.
#define TINYGLTF_IMPLEMENTATION
#define STB_IMAGE_IMPLEMENTATION
#define STB_IMAGE_WRITE_IMPLEMENTATION
#include <tinygltf/tiny_gltf.h>
struct ScenePartial {
camera_uniq_ptr camera... | TOOL | 0.922421 | 7.246901 |
1ca12d82-7cc5-4d9e-a118-bfe3f1a2df6a | CliffChen21/Algorithm-DS | 746 - Fast Food Restaurant.cpp | /*****************************************
* (This comment block is added by the Judge System)
* Submission ID: 46039
* Submitted at: 2017-12-12 10:10:16
*
* User ID: 335
* Username: 54780828
* Problem ID: 746
* Problem Name: Fast Food Restaurant
*/
#include<stdio.h>
#include<string.h>
struct... | ALGO | 0.999934 | 3.198239 |
8f6ff49c-b299-4ce5-a367-d5f4d424c4b1 | asd147asd147/High_Quality_Data_Structure | 자료구조/자료구조03/polyadd_1.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
ifstream in("polyadd.inp");
ofstream out("polyadd.out");
vector < tuple < int, int > > fx;
int num_fun, num_term;
int num_c, num_e;
bool check = true;
in >> num_fun;
for(int i = 0; i < num_fun; i++){
in >> num_term;
... | ALGO | 0.999486 | 3.942935 |
8157a7ea-16c7-4e89-a437-774255f2975f | TaiKonne/Code_Forces | strange_table.cpp | #include <bits/stdc++.h>
using namespace std;
#define nl << '\n'
#define vti vector<int>
#define vtll vector<long long>
#define yep cout << "YES" nl
#define nope cout << "NO" nl
#define ll long long
#define lg long
#define db double
#define pb push_back
#define bg begin()
#define ed end()
#define rbg rbegin()
#define ... | ALGO | 0.999959 | 3.974273 |
1f4aa099-cafc-44a1-861f-0c71a95d4e48 | Hedlen/NISwGSP_Ubuntu | UglyMan_NISwGSP_Stitching/UglyMan_NISwGSP_Stitching/eigen/bench/spmv.cpp |
//g++-4.4 -DNOMTL -Wl,-rpath /usr/local/lib/oski -L /usr/local/lib/oski/ -l oski -l oski_util -l oski_util_Tid -DOSKI -I ~/Coding/LinearAlgebra/mtl4/ spmv.cpp -I .. -O2 -DNDEBUG -lrt -lm -l oski_mat_CSC_Tid -loskilt && ./a.out r200000 c200000 n100 t1 p1
#define SCALAR double
#include <iostream>
#include <algor... | ALGO | 0.899174 | 4.293816 |
d0b5ab70-a49c-4a07-b4d2-9019800ff3c6 | C-2023-1-3/8209230104xiangyiyang | 实验/8209230104向一洋-实验三,四/第三次实验代码/304area1.cpp | #include<iostream>
#include"mytriangle.h"
using namespace std;
int main()
{
double side1, side2, side3;
cout << "please input side1,side2 and side3:" << endl;
cin >> side1 >> side2 >> side3;
if (is_valid(side1, side2, side3) == 1)
{
cout << "the area is:" << double_area(side1, side2, side3) << endl;
}//Թξ
else... | ALGO | 0.950814 | 4.079927 |
9490b99d-b8d1-4c0f-83f3-33f5bbfe104c | Nishant0073/Striver-s-SDE-Sheet-Challenge | Binary_Tree/Maximum_Width_In_Binary_Tree.cpp | /************************************************************
Following is the TreeNode class structure
template <typename T>
class TreeNode {
public:
T val;
TreeNode<T> *left;
TreeNode<T> *right;
TreeNode(T val) {
this->val = val;
left = NUL... | ALGO | 0.999959 | 5.757004 |
7413eb59-a0db-4f5a-9016-6d4b771b51c2 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_9618_2.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 5e3 + 7;
int g[N];
int mark[N];
int mv[N];
string s;
vector<pair<int, int> > sz;
int main() {
ios::sync_with_stdio(false);
cin >> s;
int n = s.length();
for (int i = 1; i <= n; i++) {
for (int j = i - 1; j >= 0; j--)
mark[g[max(j - 1, 0)] ^ g... | ALGO | 0.999953 | 3.212618 |
20edc9bb-686c-4f87-ac2f-2630a4e25717 | jungyuha/codingtest | c++/c9935.cpp | #include<bits/stdc++.h>
using namespace std;
string s , ps;
int p,len;
int main(){
cin >> s >> ps;
len = ps.size();
p=s.find(ps);
while(p!=-1){
s.replace(p,len,"");
// (1)
p = s.find(ps);
}
if(s.size()==0){
cout << "FRULA" <<endl;
}
else{
cout <... | ALGO | 0.999741 | 3.425108 |
73ad8870-503c-4625-8f18-fa506b7569a2 | neurominer-git/NeuroMiner_1.2 | graphs/graph_preproc/mi/estcondentropy.cpp | #include "miinclude.h"
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
if(nrhs != 2 && nrhs!=1)
mexErrMsgTxt("Usage [mutual_info] = progname(jointprob_table, marginprob_2). The last two inputs are optional.");
if(nlhs > 1)
mexErrMsgTxt("Too many output argument <mutual_info>.... | ALGO | 0.999689 | 4.047156 |
016dd4f7-aa36-46aa-a563-27cb03435e04 | zbr-98/DSA | Love babbar/Array/subarrays_equal0sand1s.cpp | #include<bits/stdc++.h>
using namespace std;
main(){
int n,a;
vector<int> arr;
cout<<"Enter n:";
cin>>n;
cout<<"Enter elements:";
for(int i=0;i<n;i++){
cin>>a;
arr.push_back(a);
}
int count=0;
// Brute Force (n*n)
//setting zeros wi... | ALGO | 0.999754 | 4.474151 |
08314cc5-353e-46ed-9ff9-8d3107b4b8e7 | PRIME3015/L4 | B_Greg_and_Graph.cpp | // राधाकृष्ण राधाकृष्ण राधाकृष्णराधाकृष्ण राधाकृष्ण राधाकृष्ण राधाकृष्ण राधाकृष्ण राधाकृष्ण राधाकृष्ण राधाकृष्ण राधाकृष्ण राधाकृष्ण राधाकृष्ण राधाकृष्ण राधाकृष्ण राधाकृष्णराधाकृष्ण राधाकृष्ण राधाकृष्ण
// राधाकृष्ण राधाकृष्णराधाकृष्ण राधाकृष्णराधाकृष्णराधाकृष्ण राधाकृष्ण राधाकृष्णराधाकृष्ण राधाकृष्ण राधाकृष्णराधाकृष्ण र... | ALGO | 0.999989 | 3.711365 |
a968910a-523e-46f0-b5c0-6a9cd15df9c1 | fepaf/Competitive-Programming | Resoluções OJ/cses/1069.cpp | #include<bits/stdc++.h>
#define _ ios_base::sync_with_stdio(0); cin.tie(0);
#define endl '\n'
#define INF 0x3f3f3f3f
#define MAX (1<<20)
#define MOD 1000000007
#define i64 long long
#define all(x) (x).begin() , (x).end()
#define sz(x) (int)(x).size()
#define ii antr<int, int>
#define fs first
#define sc second
#define ... | ALGO | 0.999541 | 3.334908 |
a6b1dd79-50b1-470f-a53c-be47804e36e7 | gellistvan/Advanced-Cpp | modules/01_Templates/10_TMP_with_Cpp23/52_constexpr_matrix_multiplication.cpp | #include <iostream>
#include <array>
// Compile-time matrix multiplication
template<std::size_t N, std::size_t M, std::size_t P>
constexpr auto multiply(const std::array<std::array<int, M>, N>& a, const std::array<std::array<int, P>, M>& b) {
std::array<std::array<int, P>, N> result = {};
for (std::size_t i =... | ALGO | 0.999749 | 5.640254 |
867b3ee7-3300-400c-b3bf-e615b5a6ca4c | sp-alex-osou/Firework | SpringPairGenerator.cpp | #include "SpringPairGenerator.h"
SpringPairGenerator::SpringPairGenerator(void)
{
}
SpringPairGenerator::SpringPairGenerator(float length, float coefficient)
: length(length), coefficient(coefficient)
{
}
SpringPairGenerator::~SpringPairGenerator(void)
{
}
void SpringPairGenerator::addPair(const Particle& a, const... | ALGO | 0.981717 | 5.380148 |
c07220d0-e71e-4664-a8d2-a24033642b23 | leeeyupeng/leeeyupeng.github.io | project/algorithm/leetcode2021/src/154.findMin_1.cpp | #include"leetcode.h"
class Solution {
private:
int _findMin(vector<int>& nums,int n,int s,int e){
int ret;
int i,j,mid;
i = s,j = e;
while(i<j){
mid = (i+j)>>1;
if(nums[mid] > nums[s]){
i = mid+1;
}
else if(nums... | ALGO | 0.999994 | 5.781168 |
a616ad96-f5b4-41a3-b112-159396db562b | ssj-gz/Competitive-Programming | codechef/atm2.cpp | #include <iostream>
#include <vector>
#include <cassert>
using namespace std;
template <typename T>
T read()
{
T toRead;
cin >> toRead;
assert(cin);
return toRead;
}
int main()
{
const int T = read<int>();
for (int t = 0; t < T; t++)
{
const int N = read<int>();
const in... | ALGO | 0.999834 | 4.151029 |
3fa97830-4df5-4719-b092-52923d56733c | Anishprajapat123/DATA-STRUCTURES-AND-ALGOS | ARRAY/COUNT SUBARRAY OF SUM K 1.cpp | #include<iostream>
#include<bits/stdc++.h>
using namespace std;
void countsumarraysum(int n,vector<int> &a,int k)
{
int cnt=0;
int s=0;
for(int i=0;i<n;i++)
{
s=a[i];
if(a[i]==k)
{
cnt++;
}
for(int j=i+1;j<n;j++)
{
... | ALGO | 0.999778 | 4.546486 |
b2d85f23-77cf-4aa7-9131-832f1ed74869 | ishandutta2007/codeforces | cirno_9baka/normal/1237/C1.cpp | #include<bits/stdc++.h>
using namespace std;
const int M=998244353;
int n,i,ans,j,k,m,u;
struct str{
int x,y,z,t;
}a[100005],p[100005];
bool cmp(str a,str b)
{
if(a.x==b.x)
{
if(a.y==b.y)
return a.z<b.z;
return a.y<b.y;
}
return a.x<b.x;
}
int main()
{
scanf("%d",&n);
for(i=1;i<=n;i++)
{
scanf("%d %d %... | ALGO | 0.999963 | 3.66921 |
cbaa38a4-f973-479c-912d-cea061008bb7 | EliaRu/CPCSolutions | subset.cpp | /*
The solution is very similar to the "Subset Sum" in
the lecture notes.
First the program computes the sum of the element
in the set. If the sum is not divisible by 2 is
impossible to divide the set into two such that
the sum of each is the same. If the sum is zero,
since all the element... | ALGO | 0.99987 | 4.62343 |
54a6a054-7f17-4b48-8eea-23ab6b1f948a | rovinbhandari/Programming_Scripting | ProgrammingCompetitions/ACM-ICPC/ACM-ICPC_12/Amritapuri/online contest/ACM-ICPC Amritapuri 2012 Online Competition Accepted Solutions/B/cpp/00002722_B_STICKS_amicpc120079.cpp | // Standard includes
#include<cstdio>
#include<iostream>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<limits.h>
#include<string.h>
//Data Structures
#include<algorithm>
#include<vector>
#include<string>
#include<set>
#include<map>
#include<utility>
#include<stack>
#include<queue>
using namespace std;
... | ALGO | 0.999757 | 3.105956 |
34e87245-2241-47f9-864d-56df18195f66 | Gemechu-Asfaw/Leetcode-Problems | Power_of_Two/submission4.cpp | class Solution {
public:
bool isPowerOfTwo(int n) {
if (n<=0){
return false;
}
return (INT_MAX/2+1)%n==0;
}
}; | ALGO | 0.998671 | 5.972285 |
423cbb2a-2c05-415b-95d1-29125495a536 | mahmoudabozied4/CP_Templates | Math/Counting/Stirling Numbers.cpp | /*
#Stirling number
1. S(r, n), represents the number of ways that we can arrange r objects around indistinguishable circles of length n,
and every circle n must have at least one object around it.
2. S(n,k) as the different ways to cut n different elements into k undifferentiated non-empty subsets. Fo... | ALGO | 0.999935 | 5.360205 |
37e36287-f91a-4054-a3db-770615be6791 | ksanu1998/static_analysis_codegen_llms | results/feedback_pipeline/cpp_results/cpp_files_before_feedback/question-220-pass-1.cpp | #include <bits/stdc++.h>
using namespace std ;
int minMoves(long long n) {
int moves = 0;
while (n % 25!= 0) {
n++;
moves++;
}
return moves;
} | ALGO | 0.999596 | 4.243381 |
2f26c9e6-b98a-4bb3-9b84-2bcc5acb23b0 | ahmadsoliman/ACM | CodeBlocks/ACM/Regionals Contests/MissingPages.cpp | #include <iostream>
#include <fstream>
#include <string>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <queue>
#include <algorithm>
#include <set>
#include <math.h>
#include <bitset>
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef ... | ALGO | 0.999607 | 3.249415 |
a0b2a7b0-8553-485d-8d6a-8a48a92a7b7d | ishandutta2007/codeforces | yp155136/normal/711/B.cpp | #include <iostream>
#include <stdio.h>
#include <ctime>
#include <cstdlib>
using namespace std;
typedef long long LL;
const int MAX_N = 503;
LL num[MAX_N][MAX_N];
int main () {
srand(time(NULL));
int n;
while (scanf("%d",&n) != EOF) {
if (n==1) {
scanf("%d",&n);
printf("%d\n",rand() + 123456);
continue... | ALGO | 0.999954 | 3.210286 |
852e7769-0f86-41e3-9626-b0744e768bd3 | Bonaparto/CPP-Codes | quizes/mbquiz3/v2/compression.cpp | #include <iostream>
using namespace std;
string compression(string g){
for(int i = 0; i < g.size(); ++i){
for(int j = i + 1; j < g.size(); ++j){
if(g[i] == g[j])
g.erase(g.begin() + j);
}
}
return g;
}
int main(){
string n;
cin >> n;
cout << compression(... | ALGO | 0.999989 | 4.47994 |
d3b7738b-927b-4422-95db-e2ebcbafe46a | bindaldhara/DSA-Practice | 2597-the-number-of-beautiful-subsets/2597-the-number-of-beautiful-subsets.cpp | class Solution {
public:
int count = 0;
unordered_map<int, int> mp;
void dfs(vector<int>& nums, int i, int n, int k){
if(i == n){
count++;
return;
}
if(mp[nums[i] - k] == 0){
mp[nums[i]]++;
dfs(nums, i + 1, n, k);
mp[nu... | ALGO | 0.999988 | 5.886286 |
138a2ec4-97a7-4e38-be6c-d8fff8521482 | patrory/DSA | BinarySearch.cpp | #include<bits/stdc++.h>
using namespace std;
int i123=0;
void binarySearch(int arr[],int key ,int s,int e){
if(s==e && key != arr[s]){
// cout<<-1;
i123=-1;
return;}
int mid = (e+s)/2;
if(key==arr[mid]){
// cout<<mid ;
i123=mid;
return;}
if( arr[mid]>key)bin... | ALGO | 0.999898 | 4.821048 |
78017838-799c-4616-9c2d-a6c696128846 | complete-dope/Recursion_dsa | lexigrographic.cpp | // Find all lexicographic permutations of a string
// In this post, we will see how to find all lexicographic permutations of a string where the repetition of characters is allowed.
// For example, consider string ABC. It has the following lexicographic permutations with repetition of characters:
// AAA AAB AAC ABA A... | ALGO | 0.999943 | 5.607322 |
6df2bc41-f5a8-40ca-ac67-063ccf67a0ee | Normal-pcer/sync_code | 20241119/T1/T1 copy.cpp | #include <bits/stdc++.h>
#pragma GCC optimize(3)
#pragma GCC optimize("inline")
using ll = long long;
namespace Solution {
constexpr inline auto pow(ll a, ll b, int p) {
auto res = 1LL;
for (; b; b >>= 1, a = a * a % p) if (b&1) res = res * a % p;
return res;
}
void solve() {
... | ALGO | 0.999958 | 4.516182 |
b597ac76-fb77-4dd8-97f6-7b7f39c9ef51 | ku-dml/SDsystem | OGDF/src/coin/Clp/ClpPlusMinusOneMatrix.cpp | /* $Id: ClpPlusMinusOneMatrix.cpp 1665 2011-01-04 17:55:54Z lou $ */
#include <cstdio>
#include "CoinPragma.hpp"
#include "CoinIndexedVector.hpp"
#include "CoinPackedVector.hpp"
#include "CoinHelperFunctions.hpp"
#include "ClpSimplex.hpp"
#include "ClpFactorization.hpp"
// at end to get min/max!
#include "ClpPlusMin... | ALGO | 0.871745 | 3.950677 |
40bdf607-7c7c-4dfb-9977-6d681ffcfdec | joseandre25/Nitro-Congenial- | Amador/cinema.cpp | #include <iostream>
using namespace std;
int main() {
int fileiras, cadeiras, fileiraEscolhida = -1, assentoEscolhidoX = -1, assentoEscolhidoY = -1;
cin >> fileiras >> cadeiras;
int matriz[fileiras][cadeiras];
for (int i = 0; i < fileiras; i++) {
for (int j = 0; j < cadeiras; j++) {
... | ALGO | 0.997643 | 4.56815 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.