uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
bd83cb07-d7ed-4852-90f9-e415013bf77d | temper8/Tizen-FBReader | FBReader/library/Library.cpp | #include <queue>
#include <algorithm>
#include <ZLLogger.h>
#include <ZLibrary.h>
#include <ZLStringUtil.h>
#include <ZLUnicodeUtil.h>
#include <ZLFile.h>
#include <ZLDir.h>
#include <ZLDialogManager.h>
#include <ZLInputStream.h>
#include "Library.h"
#include "Book.h"
#include "Author.h"
#include "Tag.h"
#include "..... | TOOL | 0.973094 | 5.022914 |
b4648866-81e9-4662-960c-45c35ce0d0a6 | mohit-shrma/bilinear-models | modelFullHinge.cpp | #include "modelFullHinge.h"
//return maximum negatively rated item
int ModelFullHinge::estRatingsforUser(int u, const Data& data,
std::map<int, float>& itemRatings) {
int item, maxNegItem, maxNegRat;
float r_ui, r_ui_est;
gk_csr_t *trainMat = data.trainMat;
Eigen::VectorXf pdt(nFeatures);
maxNegItem ... | ALGO | 0.999772 | 5.766301 |
b6589fb4-37bd-4e7f-a3a6-51cab6d71f08 | SergeySinyavskiy/ECC | Elliptic curves/boost_1_70_0/libs/spirit/example/qi/sum.cpp | ///////////////////////////////////////////////////////////////////////////////
//
// A parser for summing a comma-separated list of numbers using phoenix.
//
// [ JDG June 28, 2002 ] spirit1
// [ JDG March 24, 2007 ] spirit2
//
///////////////////////////////////////////////////////////////////////////////
#inc... | TOOL | 0.896369 | 6.890997 |
62d18b41-f157-4d88-a7fd-96700875da94 | snehaagrawal14/CodeForces_Solutions | 791A-Bear_and_Big_Brother.cpp | #include <iostream>
using namespace std;
int main() {
int a, b;
cin>>a>>b;
int year = 0;
while(a<=b){
year++;
a*=3;
b*=2;
}
cout<<year;
return 0;
} | ALGO | 0.999599 | 4.175021 |
a87ec5c7-f463-494c-8f29-50931207799d | Shakila72/IT-2 | LAB Inherritance programs/function overloadinvg p.cpp | #include <iostream>
using namespace std;
float absolute(float var)
{
if (var < 0.0)
var = -var;
return var;
}
int absolute(int var)
{
if (var < 0)
var = -var;
return var;
}
int main()
{
cout << "Absolute value of -5 = " << absolute(-5) << endl;
cout << "Absolute value of... | ALGO | 0.99436 | 3.893531 |
600af9ea-ccaa-4a9b-83f5-9aa63f639dd4 | Mayankjoshi670/cpAlgo | cp31/1400/C. Array Game.cpp | #include <bits/stdc++.h>
using namespace std;
#define fast_io ios_base::sync_with_stdio(false); cin.tie(NULL)
#define vi vector<int>
#define vvi vector<vector<int>>
#define ll long long
#define int long long int
void findAns() {
int n, m;
cin >> n >> m;
vi a(n);
for (auto &it : a) cin >> it;
if (m... | ALGO | 0.999948 | 5.423716 |
028ae1b2-64ab-4951-a952-54bb4e09f1e3 | ishandutta2007/codeforces | jeroenodb/normal/1257/G.cpp | #include "bits/stdc++.h"
using namespace std;
#define all(x) begin(x),end(x)
template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; }
template<typename T_container, typename T = typename enable_if<!is_same<T_container, string>::va... | ALGO | 0.999958 | 4.067357 |
fcc6cb31-1f8d-4018-9132-855ff515908d | Kabindraborah/DSA-lovebabbar | lec 019/Container/set.cpp | #include <iostream>
#include<set>
using namespace std;
int main()
{
set<int>s;
s.insert(5);
s.insert(1);
s.insert(6);
s.insert(0);
s.insert(6);
s.insert(5);
s.insert(6);
for(auto i:s){
cout<<i<<endl;
}
s.erase(s.begin());
cout<<"After erase"<<endl;
for(auto i:s){
cout<<i<<endl;
}
cout<<s.count(5)<<endl;
set<int>:... | ALGO | 0.98877 | 3.45134 |
70c5135d-1ebe-4b15-a624-2fcc04a47ff9 | kuna2512/CPP-DSA_BY_PW_skills | _10_ One dimension array part-1/_69VecctorPassedByValue.cpp | /*
Vector are passed by value : Each time you pass, New vector is created.
we can achive this by using this : & --> ampercant
=======================
output :
As it is element print : 9 23 19 34 14 18
Print after update the value : 9 100 19 34 14 18
*/
#include<bits/stdc++.h>
using namespace std;
void change(vector<in... | ALGO | 0.997831 | 4.809361 |
2fc336ff-81ce-4a61-8a50-1c49e1e566e9 | checkoutb/LeetCodeCCpp | ge2000/LT2062_2022-02-27_Count_Vowel_Substrings_of_a_String.cpp |
#include "../header/myheader.h"
class LT2062
{
public:
//Runtime: 0 ms, faster than 100.00% of C++ online submissions for Count Vowel Substrings of a String.
//Memory Usage: 6.1 MB, less than 96.39% of C++ online submissions for Count Vowel Substrings of a String.
int lt2062b(string word)
{
int arr[1... | ALGO | 0.999941 | 6.117692 |
dcd8e631-21ff-407d-9bfb-55e005aabc98 | Azharul-Raj/xcpc | week5/day5/H.cpp | /**
* author: raj_001
* created: 2024-04-23 17:26:27
**/
#include <bits/stdc++.h>
#define nl '\n'
#define ll long long int
using namespace std;
int main(){
ios::sync_with_stdio(false);
cin.tie(NULL);
int t=1;
cin>>t;
while(t--){
int n;cin>>n;
vector<int> a(n);
ll sum=0;
... | ALGO | 0.999968 | 5.835265 |
daddb179-3b1c-4d8d-b021-fbb0962db8f2 | PerfectoZ/effective-succotash | Dynamic Programming/DP_Permutations.cpp | #include<bits/stdc++.h>
#define ll long long int
#define pi 3.1415926535897932385
#define mod 1000000007
#define db double
#define pp(x) pair<x,x>
#define ff first
#define ss second
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define tc ll tc; cin>>tc ; cin.ignore(5,'\n'); for(ll number = 1 ; number <... | ALGO | 0.999997 | 3.758194 |
9efc923f-34b7-4a29-b983-05febdfe6621 | liuzuyang/my_repository | code/10chapter_test/main.cpp | #include <iostream>
#include <algorithm>
#include <numeric>
#include <vector>
int main()
{
std::vector<int> vi{10, 293, 2348, 234, 123, 10, 10, 50};
std::sort(vi.begin(), vi.end());
auto unique_end = std::unique(vi.begin(), vi.end());
for (const auto &val : vi)
{
std::cout << val << " | ";
}
st... | ALGO | 0.999101 | 5.150158 |
27203875-78d7-44f0-a9f4-14975d58b560 | josh1248/cp-training | kattis/2025/04/04_17_ab_medium/aldursrodun.cpp | #include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int, int> pi;
typedef long long ll;
#define sz(x) ((int)size(x))
#define all(x) begin(x), end(x)
#define rep(i, a, b) for (int i = a; i < (b); i++)
int main() {
ios_base::sync_with_stdio(false);
... | ALGO | 0.999998 | 4.477703 |
7f5ffa74-477d-4435-ab91-41b0eadb72b8 | cayanide/WinterTraining | C++/Rough Code Snippets/Pop & Push.cpp | #include <iostream>
#include <stack>
using namespace std;
int main()
{
// Empty stack
stack<int> mystack;
cout<<"Enter Number Of Elemnts To Push=> \n";
int m;
cin>>m;
for(int i =1;i<=m;i++){
int n;
cin>>n;
mystack.push(n);
}
bool flag=0;
while(flag==0){
cout<<"Choose An option\n";
cout<<"Press 0 For Exit... | ALGO | 0.984738 | 3.76838 |
d8495800-1831-43dc-ba77-f59d5bca5aaa | mariofv/LittleOrionEngine | Libraries/include/MathGeoLib/Geometry/LineSegment.cpp | /** @file LineSegment.cpp
@author Jukka Jylnki
@brief Implementation for the LineSegment geometry object. */
#include "LineSegment.h"
#include "../Math/MathFunc.h"
#include "AABB.h"
#include "Ray.h"
#include "Line.h"
#include "Plane.h"
#include "Polygon.h"
#include "Polyhedron.h"
#include "Frustum.h"
#include "../Mat... | ALGO | 0.98861 | 6.653174 |
3d812b85-ab99-4508-936e-ecf539b71a93 | itzJunaedRayhan/500-Plus-Problem-Solving-JavaScript | data-structure/Same_to_Same_Again.cpp | #include<bits/stdc++.h>
using namespace std;
class Node {
public:
int val;
Node* next;
Node* prev;
Node (int val) {
this->val = val;
this->next = NULL;
this->prev = NULL;
}
};
class myStack {
public:
Node* head = NULL;
Node* tail = NULL;
int sz = 0;
... | ALGO | 0.999995 | 3.958027 |
fc0a16f5-2ea2-4536-b6f8-e3799bb8d717 | sarvex/leetcode-mini-kanren | solution/0400-0499/0493.Reverse Pairs/Solution.cpp | class BinaryIndexedTree {
public:
int n;
vector<int> c;
BinaryIndexedTree(int _n)
: n(_n)
, c(_n + 1) {}
void update(int x, int delta) {
while (x <= n) {
c[x] += delta;
x += lowbit(x);
}
}
int query(int x) {
int s = 0;
wh... | ALGO | 0.999994 | 5.731302 |
7fce6152-c34b-4f47-b3d4-a06326f8b577 | losvald/algo | dmih/98/abc.cpp | #include <cstdio>
#include <iostream>
#include <cstdlib>
using namespace std;
int rek(int a, int b, const int c, int br) {
int sol = 999;
if(a == c || b == c) return br;
if(br > 10) return 1000;
sol = min(sol, rek(-a,b,c,br+1));
sol = min(sol, rek(a,-b,c,br+1));
sol = min(sol, rek(a+b,b,c,br+1))... | ALGO | 0.999693 | 4.117421 |
5368c0f2-fefb-426c-982e-fb334dfc69b0 | wnovoa9606/sprint1_ciclo4 | 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 |
f736a893-96f5-4783-ad94-5465b05d9d86 | satriaprayoga/lawas | src/net/hopfield.cpp | /*
* hopfield.cpp
*
* Author: Gilang Satria Prayoga
*/
#include <iostream>
#include <cassert>
#include "hopfield.h"
using namespace std;
const int DefaultSize=4;
HopfieldNetwork::HopfieldNetwork():size(DefaultSize) {
}
HopfieldNetwork::HopfieldNetwork(const int & size):size(size){}
bool * HopfieldNetwork::out... | ALGO | 0.999502 | 4.092296 |
9bed5dfe-51ae-4f02-b2e1-fcc5845f6b5a | deepanshuoct12/interviewbit-solution | ibgraphblackshapes.cpp | int dx[4]={1,-1,0,0};
int dy[4]={0,0,1,-1};
bool isvalid(int x,int y,int n,int m)
{
if(x<0 || x>=n || y<0 || y>=m)
return false;
return true;
}
void BFS(int i,int j,vector<string>& vec,int n,int m)
{
queue<pair<int,int> >q;
q.push(make_pair(i,j));
while(!q.empty())
{
pair<int,int> p=... | ALGO | 0.999752 | 5.522921 |
9c1162c9-7157-4712-8ce3-1a1224633137 | sency90/boj | 12865.cpp | #include <stdio.h>
#include <algorithm>
#include <vector>
using namespace std;
int d[100001];
int main() {
int n, k;
scanf("%d%d",&n,&k);
vector<pair<int,int> > v(n);
for(int i=0; i<n; i++) {
scanf("%d%d",&v[i].first, &v[i].second);
}
for(int i=0; i<n; i++) {
for(int j=k; j-v[i].... | ALGO | 0.999949 | 3.101356 |
e1f8b2ca-214d-47dc-8218-0f4564d0aad6 | Vikesh0355/CPP_DSA_Practice | src/Week5_TreeAndClass.cpp/BinaryTreeInorderTraversal.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.999935 | 6.934176 |
a6c5c169-9b97-4728-b941-b2daf26b6843 | cyberReckon/Cplusplus | random/warehouse.cpp | #include <bits/stdc++.h>
using namespace std;
map<int, int> has;
vector<vector<int>> tree(50001);
// Function to add an edge between two nodes
void Add_edge(int x, int y)
{
tree[x].push_back(y);
tree[y].push_back(x);
}
int solve(int i, int k)
{
if (has[i] != 0)
return 0;
if (k == 0)
... | ALGO | 0.999859 | 4.799138 |
0349de32-d76c-451e-95e4-a75fa35da0f9 | smlnj/smlnj-llvm-18.1 | llvm/tools/llvm-exegesis/lib/SerialSnippetGenerator.cpp | #include "SerialSnippetGenerator.h"
#include "CodeTemplate.h"
#include "MCInstrDescView.h"
#include "Target.h"
#include <algorithm>
#include <numeric>
#include <vector>
namespace llvm {
namespace exegesis {
struct ExecutionClass {
ExecutionMode Mask;
const char *Description;
} static const kExecutionClasses[] = ... | ALGO | 0.934031 | 7.937397 |
0c7928be-69fa-466e-a779-c041f6e98d8b | calypsodevs/calypso | src/calypso-tx.cpp | #include "base58.h"
#include "clientversion.h"
#include "coins.h"
#include "core_io.h"
#include "keystore.h"
#include "primitives/block.h" // for MAX_BLOCK_SIZE
#include "primitives/transaction.h"
#include "script/script.h"
#include "script/sign.h"
#include "ui_interface.h" // for _(...)
#include <univalue.h>
#include ... | TOOL | 0.909054 | 4.595385 |
8bce8c41-c190-4848-ad4f-317816805a69 | son-of-mountain/problem-solving | codeforces/.history/icpc_mansoura/session4/O- Sort String_20240912191637.cpp | #include<bits/stdc++.h>
using namespace std;
#define sonic ios_base::sync_with_stdio(false) ; cin.tie(NULL) ; cout.tie(NULL);
/*
APPROACH
what causes the 'weird char' ??
its because i didnt include the nested loop :
for(int j = 0; j < frq[i]; j++){
..........
}
therefor... | ALGO | 0.999831 | 4.146025 |
1560d569-485e-4bc3-bf6a-bfc01c08d5fe | CP1984/UDACITY--Cpp_For_Programmers | Lesson13/Video4/main.cpp | // constructing vectors
// constructing vectors
#include <iostream>
#include <vector>
int main()
{
//creating a vector of integers
std::vector<int> vectorInts;
//creating an iterator for the vector
std::vector<int>::iterator it;
std::cout << "vectorInts has " << vectorInts.size() << " elements\n";
std::cout <<... | ALGO | 0.97258 | 4.092371 |
3ddcc8cf-0d82-45a6-9b3a-3f04e6ea71d6 | Aditya-Chowdhury/DSA-C-- | Graph/adjList_weightedGraph.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int vertex,edges;
cin>>vertex>>edges;
vector<pair<int,int> >adjlist[vertex];
int u,v,weight;
for(int i=0;i<edges;i++){
cin>>u>>v>>weight;
adjlist[u].push_back(make_pair(v,weight));
adjlist[v].push_back(make_pair(u,weig... | ALGO | 0.999954 | 3.634404 |
9f2c504d-f559-4bf0-969a-7159b38a3b53 | superdariobros22/code | codigos_c++/olimpiada/codewars 2022/9.cpp | #include<bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
while (b != 0) {
int temp = b;
b = a % b;
a = temp;
}
return a;
}
int main() {
int a, b;
cin >> a >> b;
cout << gcd(a, b);
} | ALGO | 0.999382 | 5.324354 |
709b3c9f-d26c-452f-8bea-2d409b31a4bf | YanjieHe/Algorithms | Design_and_Analaysis_of_Algorithms/main.cpp | #include <iostream>
#include "test/Test_Disjoint_Set.hpp"
#include "test/Test_Union_Find.hpp"
#include "test/Test_Kruskal_MST.hpp"
#include "test/Test_Prim_MST.hpp"
#include "test/Test_Dijkstra.hpp"
#include "Huffman_Coding.hpp"
#include "Fibonacci.hpp"
#include "Bitmasking.hpp"
#include "Wildcard Pattern Matching.hpp"... | TEST | 0.977751 | 3.403231 |
dfbcc736-cedb-43c4-8b2a-8e6c504525ff | hyxinchou/VOI2023 | VNOI/YugiHacker/Duong_Di_Ngan_Nhat/A.cpp | #include <bits/stdc++.h>
using i64 = long long;
int N, M, K, U, V, L, d[5005];
std::vector<std::vector<std::pair<int, int>>> E(5005);
i64 ways[5005];
int main() {
std::ios_base::sync_with_stdio(false);
std::cin.tie(nullptr);
std::cin >> N >> M;
for (int i = 0; i < M; ++i) {
std::cin >> K >> ... | ALGO | 0.999874 | 4.496881 |
25a8d6c1-0e2c-4a56-948b-c326f890ca65 | TMBOC/Robust-GNSS-Estimation-using-FG-GMM-TD | 3rdparty/RobustGNSS/gtsam/gtsam/3rdparty/Eigen/unsupported/doc/examples/MatrixSinh.cpp | #include <unsupported/Eigen/MatrixFunctions>
#include <iostream>
using namespace Eigen;
int main()
{
MatrixXf A = MatrixXf::Random(3,3);
std::cout << "A = \n" << A << "\n\n";
MatrixXf sinhA = A.sinh();
std::cout << "sinh(A) = \n" << sinhA << "\n\n";
MatrixXf coshA = A.cosh();
std::cout << "cosh(A) = \n"... | ALGO | 0.995191 | 5.890235 |
e172aad8-6243-446c-af9a-52a62f186032 | Bynaryman/OSFNTC | flopoco/src/IEEE/IEEEAdd.cpp | #include "IEEEAdd.hpp"
#include <iostream>
#include <sstream>
#include <vector>
#include <math.h>
#include <string.h>
#include <gmp.h>
#include <mpfr.h>
#include <gmpxx.h>
#include <utils.hpp>
#include <Operator.hpp>
using namespace std;
namespace flopoco{
#define DEBUGVHDL 0
IEEEAdd::IEEEAdd(OperatorPtr parent... | TOOL | 0.973972 | 5.599569 |
b25f621f-1600-421c-a1b7-8da7124258f3 | rohit11012003/cp_problems | Mike and Children.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
long long int a[n];
for(int i=0;i<n;i++)
{
cin>>a[i];
}
vector<long long int>v;
for(int i=0;i<n-1;i++)
{
for(int j=i+1;j<n;j++)
{
v.push_back(a[i]+a[j]);
}
}
sort(v.begin(),v.end());
long long int count=1;
long long int ma=... | ALGO | 0.999965 | 3.635342 |
c382ebe7-c71b-4c6b-8dee-d32b8a24ae20 | mehrab2603/Solved-Problems | UVa/369 - Combinations.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n, m;
while(scanf("%d %d", &n, &m) && (n || m)) {
long long ans = 1;
if(n - m > m)
for(int i = 0; i < m; i++)
ans = ((ans * (n - i))/ (i + 1));
else
for(int i = 0; i < n - m; i++)
... | ALGO | 0.99983 | 4.384483 |
8020fdc0-bde2-40c4-8e41-e4c42d1fe6de | WOONBE/C__Algorithm | Math/2745.cpp | #include <iostream>
#include <string>
using namespace std;
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
string n;
int b;
int result = 0;
cin >> n >> b;
for(int i=0; i<n.size(); i++){
if('0'<=n[i] && n[i] <='9'){
result = result * b + (n[i] - '0');
}
... | ALGO | 0.998358 | 4.295149 |
5442ee10-3396-41cc-8786-3c42bfdc8c9e | JiaqiJin/PBRT | EXCALIBUR/EXCALIBUR/core/BXDF/microfacete/MicrofacetDistribution.cpp | #include "MicrofacetDistribution.h"
#include "../BxDF.h"
RENDERING_BEGIN
static Vector3f BeckmannSample(const Vector3f& wi, Float alpha_x, Float alpha_y,
Float U1, Float U2) {
Vector3f wiStretched =
normalize(Vector3f(alpha_x * wi.x, alpha_y * wi.y, wi.z));
Float slope_x, slope_y;
BeckmannSa... | ALGO | 0.999422 | 5.407226 |
fab12c22-20c1-48af-a1f1-771e2bceb32c | yakud/ton-fork | crypto/func/optimize.cpp | #include "func.h"
namespace funC {
/*
*
* PEEPHOLE OPTIMIZER
*
*/
void Optimizer::set_code(AsmOpConsList code) {
code_ = std::move(code);
unpack();
}
void Optimizer::unpack() {
int i = 0, j = 0;
for (AsmOpCons *p = code_.get(); p && i < n; p = p->cdr.get(), ++j) {
if (p->car->is_very_custom()) {... | ALGO | 0.998364 | 3.555189 |
c816e84a-fea7-4257-b944-a0d1d54c9740 | isym444/Competitive-Programming-Solved-Problems | CP1/Codewars/Practice/Codeforces/A_Theatre_Square.cpp | /* #include <bits/stdc++.h> */
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
using namespace std;
/* using std::vector; */
#define fo(i, n) for (i = 0; i < n; i++)
#define ll long long
#define sz(x) (int)(x).size()
#define mp make_pair
typedef pair<l... | ALGO | 0.999732 | 3.245276 |
259bb310-18cc-446b-9360-10f0cba7bef9 | adam5336/codeforces-1400-solutions | codeforces-1400-solutions/GCD-sequence.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <numeric>
using namespace std;
int is_check(vector<long long> a){
for(int i=0;i<a.size()-2;i++){
if(__gcd(a[i],a[i+1])>__gcd(a[i+1],a[i+2])){
return i+1;
}
}
return -1;
}
int main(){
int k,n,i,pos;
cin>>... | ALGO | 0.999914 | 3.960142 |
4674b3dc-5063-4aac-88e7-72a620018ebd | inie0722/air-ctl | test/heap.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <gtest/gtest.h>
extern "C"
{
#include "air/ctl/heap.h"
#include "air/ctl/vector.h"
}
using namespace std;
vector<size_t> stl;
CTL_vector ctl;
void test_new()
{
srand((unsigned)time(NULL));
CTL_vector_new(&ctl, 10, sizeof(size_t));
}
bool ... | TEST | 0.956348 | 5.59345 |
819468fe-82ad-44b5-92a6-d411032d6ae0 | mr-jestin-roy/LeetCode-TaskList | Z_CPH Dump/A_Gamer_Hemose.cpp | #pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define int long long int
#define mod 1000000007
#define fast ios_base::sync_with_stdio(false), cin.tie(NULL)
#define PI 3.14159265358979323846
int32_t main()
{
fast;
cout << fixed << setprecision(20);
int t = 1;... | ALGO | 0.999891 | 3.361748 |
67b1023d-a0de-4d7c-a2d9-56c274d7f67e | mohamedGamalAbuGalala/Practice | Study Material/ArabicCompetitiveProgramming-master/06 String Processing/String_Processing_Suffix_Array_1_O(nlognlogn).cpp | // Suffix array algorithms (nlognlog and nlogn) are from my oach Mohamed Abd Wahab, aka Fegla
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
#define all(v) ((v).begin()), ((v).end())
#define sz(v) ((int)((v).size()))
#define clr(v, d) memset(v, d, sizeof(v))
#define rep(i, v) for(int ... | ALGO | 0.99992 | 4.542356 |
6d1db7b4-0ace-4f49-a6d5-8303f6424ff2 | himel5113/Problem_solving- | 1861A.Gift Carpet.cpp | #include<bits/stdc++.h>
#include<vector>
#include<string>
#define ll long long
#define endl '\n'
#define tc() ll t;cin>>t;while(t--)
#define opt() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;
/*void solve() {
ll m, n;
cin>>m>>n;
vector<string> V;
string s;
for... | ALGO | 0.999925 | 4.281418 |
fc9b33f7-4167-4e1b-86d0-a0dd644570a5 | FlorinTulba/Recoded | ExpandZeros/C++_OpenMP_CUDA/colRanges.cpp | /*
Given a matrix, for any element with value 0,
set all elements from the corresponding row and column on 0, as well.
Implementations using OpenMP and CUDA for NVIDIA GPUs.
@2017 Florin Tulba (<EMAIL>)
*/
#include "colRanges.h"
#include <cassert>
using namespace std;
void buildColRanges(ColRanges &colRanges, con... | TOOL | 0.953563 | 7.877342 |
79a91ea3-af97-42e5-904c-b4464dee1067 | ishandutta2007/codeforces | hank55663/normal/632/D.cpp | #include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define x first
#define LL long long
#define y second
#define sqr(x) ((x)*(x))
#define pii pair<int,int>
#define pll pair<LL,LL>
#define pdd pair<double,double>
#define MEM(x) memset(x,0,sizeof(x))
#define MEMS(x) memset(x,-1,sizeof(x))
using namespace... | ALGO | 0.999994 | 3.220316 |
3abd68e7-61a2-4755-9481-1f39d7492d86 | balu6914/a2ncoin | a2ncoin/src/bitcoin-cli.cpp | #if defined(HAVE_CONFIG_H)
#include "config/a2ncoin-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.968222 | 6.693568 |
7f7a928e-ed6e-4e5d-93b2-419f9d38bd22 | risal-shefin/Competitive-Programming | LightOJ/1155 - Power Transmission - 1332239.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll maxnodes = 205;
ll nodes = maxnodes, src, dest;
ll dist[maxnodes], q[maxnodes], work[maxnodes];
struct Edge
{
ll to, rev;
ll f, cap;
};
vector<Edge> g[maxnodes];
void addEdge(ll s, ll t, ll cap)
{
Edge a = {t, g[t].size(), 0, cap};
... | ALGO | 0.999588 | 4.33438 |
7e44fc1d-c08f-4379-aa2c-039902aa1500 | Deng-yl/work_D | opencv-4.11.0/samples/dnn/person_reid.cpp | #include <opencv2/imgproc.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/dnn.hpp>
using namespace cv;
using namespace cv::dnn;
const char* keys =
"{help h | | show help message}"
"{model m | | network model}"
"{query_list q | | list of query images}"
"{galle... | DATA | 0.905089 | 6.499674 |
a74d69be-028e-496f-b973-1896bb9040f5 | OfirBachar/MinimumSpanningTree | MinSpanTree/PriorityQueue.cpp | #include "PriorityQueue.h"
int PriorityQueue::Left(int i_VertexIndex)
{
return (2 * i_VertexIndex + 1);
}
int PriorityQueue::Right(int i_VertexIndex)
{
return (2 * i_VertexIndex + 2);
}
int PriorityQueue::Parent(int i_VertexIndex)
{
return (i_VertexIndex - 1) / 2;
}
PriorityQueue::PriorityQueue(int i_NumOfVertic... | ALGO | 0.999867 | 4.09394 |
c7921e42-adbf-4d42-9553-0c29f115819b | ArchBlizzard/DSA | Linked List/Find length of loop (E).cpp | #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;
for(int i=1; i<position; i++)
... | ALGO | 0.99974 | 4.47697 |
18c5294d-b110-4d08-a2e1-888f3f32a8a5 | amirphl/learning | data-structures/geeks-for-geeks/array/order-statistics/kth-smallestlargest-element-unsorted-array.cpp | // https://www.geeksforgeeks.org/kth-smallestlargest-element-unsorted-array/
// https://www.geeksforgeeks.org/kth-smallestlargest-element-unsorted-array-set-2-expected-linear-time/
// https://www.geeksforgeeks.org/kth-smallestlargest-element-unsorted-array-set-3-worst-case-linear-time/
// https://www.geeksforgeeks.org... | ALGO | 0.999798 | 5.228731 |
8c094a5c-ff70-46df-9756-8c7a7c764590 | coin-or/Clp.old | Clp/examples/ekk_interface.cpp | /* $Id$ */
#include <cassert>
#include "ClpSimplexPrimal.hpp"
#include "ClpFactorization.hpp"
#include "ClpPresolve.hpp"
#include "ekk_c_api.h"
//#include "ekk_c_api_undoc.h"
extern "C" {
OSLLIBAPI void * OSLLINKAGE ekk_compressModel(EKKModel * model);
OSLLIBAPI void OSLLINKAGE ekk_decompressModel(EKKModel ... | ALGO | 0.998944 | 5.799307 |
86d781c8-cca0-4d6f-87ac-7ce69166f728 | idlegossip/Codeforces | Educational Codeforces Round 80 (Rated for Div. 2)/B.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
ll t;
cin>>t;
while(t--)
{
ll l,r;
cin>>l>>r;
ll cnt=0;
r++;
while(r)
{
r/=10;
cnt++;
}
... | ALGO | 0.999565 | 3.541376 |
46cda9af-a853-464c-b24a-56618c70c7cb | viren-joshi/DSASubmissions | problems/longest_consecutive_sequence/solution.cpp | class Solution {
public:
int longestConsecutive(vector<int>& nums) {
if(nums.size() == 0)
return 0;
sort(nums.begin(),nums.end());
int count = 0, tempCount=1;
for(int i=1; i<nums.size();i++) {
if(nums[i] == nums[i-1])
continue;
if(nums[... | ALGO | 0.999962 | 5.529774 |
d3c12aa9-ad21-4cdb-badf-2c36fcbfd060 | jiohLee/selfcar_2020_ws | Sim_path_tracking/src/Sim_path_tracking.cpp | #include "Sim_path_tracking.h"
#include <iostream>
#include "ros/ros.h"
#include <geometry_msgs/PoseWithCovarianceStamped.h>
#include <geometry_msgs/PoseStamped.h>
#include <geometry_msgs/Twist.h>
#include <tf/transform_listener.h>
#include <tf/transform_datatypes.h>
#include <nav_msgs/Path.h>
#include <nav_msgs/Odome... | ALGO | 0.99881 | 3.620198 |
3b927545-9538-4518-9d44-9e2d705a769d | Prasad-264/DSA-CP | DSA/Tree/Binary Tree/Tree Problems/Diameter of BT/Diameter_BT.cpp | // Count Diameter of binary tree Problem in c++
#include <bits/stdc++.h>
using namespace std;
// A binary tree node has data, pointer to left child and a pointer to right child
struct Node {
int data;
struct Node *left;
struct Node *right;
Node(int val){
data = val;
left = NULL;
right = NULL;
}
};... | ALGO | 0.99996 | 6.631992 |
06fac50d-fd58-48bc-bbaf-48df0b5df554 | tianyang-li/de-novo-rna-seq-quant-1 | boost_1_51_0/libs/graph/example/edge_iterator_constructor.cpp | /*
Sample data (edge_iterator_constructor.dat):
5
10
0 1
1 2
1 3
2 4
3 4
1 0
2 1
3 1
4 2
4 3
Sample output:
0 --> 1
1 --> 2 3 0
2 --> 4 1
3 --> 4 1
4 --> 2 3
*/
#include <boost/config.hpp>
#include <utility>
#include <iostream>
#include <fstream>
#include <iterator>
#inc... | ALGO | 0.997836 | 5.416752 |
c7171846-7204-4844-965f-5c36abb9cf36 | X-Xia0828/Campus_Navigation_QT | UF.cpp | #include "head.h"
#include "UF.h"
UF:: UF(int sz){
fa = new int [n = sz];
memset(fa, 0, sizeof(fa));
for(int i = 1; i < sz; i ++) fa[i] = i;
}
UF:: ~UF(){
delete fa;
}
int UF:: find(int x){
if(fa[x] == x) return x;
else return fa[x] = find(fa[x]);
}
bool UF:: same(int x, int y){
retur... | ALGO | 0.998165 | 4.166811 |
0663167f-e010-4784-a034-334875ce7b44 | Jp3d/maze_gen | Source.cpp | #include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>
#include <math.h>
#include <iostream>
#include <vector>
#include "Functions.h"
#include "Lab_types.h"
using namespace std;
using namespace sf;
constexpr int windowWidth{ 800 }, windowHeight{ 600 };
#define MAX_X 36
#define MAX_Y 24
#define CELL 18
void print_... | TOOL | 0.992552 | 3.165197 |
d8c0e758-5f72-44b2-9528-8bc6206ddfbb | KMSBisko/Cpp-pratice-learning | bai6tdn.cpp | #include <iostream>
using namespace std;
int main ()
{
int a,b;
cout << "nhap vao 1 so nguyen random nao do ";
cin >> a;
b = sqrt(a) %1;
if( b == 0)
{cout << "yes ";}
else {cout << "no ";}
}
| ALGO | 0.999851 | 3.841376 |
55aec5b5-a3ff-437f-b3d3-874133bdb72a | cavh2000/Competitive-programming | Hackerrank/DetectWhetherALinkedListContainsACycle.cpp | //https://www.hackerrank.com/challenges/detect-whether-a-linked-list-contains-a-cycle/
bool has_cycle(SinglyLinkedListNode* head) {
if(head && head->next){
SinglyLinkedListNode *slow = head;
SinglyLinkedListNode *fast = head;
while(slow->next && (fast->next && fast->next->next)){
... | ALGO | 0.999686 | 3.826654 |
a427b499-5eb6-459b-9a7b-414bf1c4e9ed | Rinnnt/CompetitiveProgramming | AtCoder/bc141/E.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef pair<int, int> pii;
#define nl '\n'
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int n;
cin >> n;
string s;
cin >> s;
int l = 0;
int r = 2501;
while (l + 1 < r) {
int mi... | ALGO | 0.999965 | 4.526337 |
fd4f252c-acef-4fc5-8a60-7197943337ff | panda959595/boj_algorithm | boj_algorithm/11657.cpp | #include <iostream>
#include <vector>
using namespace std;
const int INF = 1000000000;
vector< pair<int,int> > road[505];
int n, m;
int dis[505];
int main() {
cin >> n >> m;
for (int i = 0; i < m; i++) {
int a, b, c;
cin >> a >> b >> c;
road[a].push_back({ b,c });
}
for (int i = 1; i <= n; i++) {
dis[i] = I... | ALGO | 0.999971 | 3.980042 |
f53b935d-ba6a-4538-8948-e18fb42bb5ce | swapnilsachan03/apna-college-dsa | Chapter 33 - Greedy Algorithms/max_and_min_difference.cpp | // You are given an array, A, of n elements. You have to remove exactly n/2 elements from A and add it to another array B (initially empty). Find the maximum and minimum values of differences between those two arrays. We define the difference between the two arrays as sum(abs(A[i] - B[i])).
#include <iostream>
#includ... | ALGO | 0.999716 | 4.742121 |
9eee98ba-aded-4de2-b524-15c50c64b419 | nehatkr/CPP-Programs | prepInsta100Ques/accentureCodingQue/cardCountForPyramid.cpp | #include<iostream>
using namespace std;
int cardCount(int n){
if(n==0) return 0;
if(n==1) return 2;
int arr[n+1]; //we have taking n+1 bcz if we take n then it will return the number of card upto n-1 thats why we have taken n+1=>n+1-1=n
arr[0]=0;
arr[1]=2;
for (int i = 2; i <= n; i++)
{
... | ALGO | 0.999952 | 4.193611 |
0ed83d86-47f6-48f9-8de4-ed76df3049db | roeas/GAMES101-Premake | Frame/Source/ThirdParty/opencv/samples/tapi/bgfg_segm.cpp | #include <iostream>
#include <string>
#include "opencv2/core.hpp"
#include "opencv2/core/ocl.hpp"
#include "opencv2/core/utility.hpp"
#include "opencv2/videoio.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/video.hpp"
using namespace std;
using namespace cv;
#define M_MOG2 2
#define M_KNN 3
int main(int arg... | TOOL | 0.95706 | 5.803363 |
c91e5c63-83a7-4ac9-ac7d-cf62549d176d | mnslarcher/modern-cpp-for-cv | homework_4/src/ipb_algorithm.cpp | #include <algorithm>
#include <numeric>
#include <vector>
#include "homework_4.h"
namespace ipb {
using vector = named_vector<int>;
int accumulate(vector& nv) {
const std::vector<int>& v = nv.vector();
int out = std::accumulate(v.cbegin(), v.cend(), 0);
return out;
}
int count(vector& nv, const int& val) {
... | TOOL | 0.974788 | 5.128819 |
5ea646e7-deef-4f0b-b9e5-c78c4f2fa0bd | akashb2003/dsa-questions | Hashing/stl-number-hashing.cpp | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n,num,m;
cout<<"Enter array size\n";
cin>>n;
cout<<"Enter array\n";
unordered_map<int,int>mpp;
//we can also use map, which takes O(log n) in best, worst and average case
//unordered_map takes O(1) f... | ALGO | 0.999914 | 4.302745 |
55244565-fd52-4138-8011-a4c5c274add8 | darshsherasiya2710/DLP | PRAC 12/prac_12.cpp | #include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <cctype>
using namespace std;
// Check if the given string is a number
bool isNumber(const string &s) {
for (char c : s) {
if (!isdigit(c) && c != '.') return false;
}
return true;
}
// Perform arithmetic operation... | ALGO | 0.999727 | 7.536666 |
8a6d9f3b-205a-4a7e-bc00-6b49aa557623 | garry133/Leetcode | longest-increasing-subsequence/longest-increasing-subsequence.cpp | class Solution {
public:
int lengthOfLIS(vector<int>& nums) {
int t[nums.size()];
t[0]=1;
for(int i=1;i<nums.size();i++){
t[i]=1;
for(int j=0;j<i;j++){
if(nums[i]>nums[j]){
t[i]=max(t[i],t[j]+1);
}
}
... | ALGO | 0.999982 | 6.04162 |
39ff0a5c-761f-4b91-a978-b73624ee1d51 | raincross7/code-similarity | codes/train_code/problem484/problem484_195.cpp | #include<iostream>
#include<string>
using namespace std;
int main(){
int a;
string s, t, ans;
cin >> s >> t;
a = s.size();
ans = "Yes";
for(int i = 0;i < a;i++){
if(s.at(i) != t.at(i)){
ans = "No";
break;
}
}
cout << ans;
}
| ALGO | 0.999993 | 3.448211 |
ea311dc2-8673-4424-a3f7-c0355c02f842 | amityv0113/solution_to_hackerrank | Is Fibo.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
vector<long long >v;
long long f1=0;
long long f2=1;
while(f2<=10000000000)
{
v.push_back(f2);
long long int a=f2;
f2=f1+f2;
f1=a;
}
long long int t;
cin>>t;
while(t--)
{
long ... | ALGO | 0.99975 | 4.324101 |
d7dc5780-74df-4fb5-90ab-1839287b0f8b | AmYre/my42 | cpp/cpp09/ex02/main.cpp | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.cpp :+: :+: :+: ... | ALGO | 0.979854 | 4.969091 |
6aacbfec-9aaf-4473-acec-e75ad52daced | dynamic-wind/advent-of-code-2023-solutions | day10/part1.cpp | #include <iostream>
#include <cassert>
#include <array>
#include <tuple>
#include <vector>
#include <string>
using namespace std;
using ii = pair<int, int>;
pair<ii, ii> get_adjacents(const vector<string>& lines, int i, int j) {
switch (lines.at(i).at(j)) {
case '|': return {{i+1, j}, {i-1, j}};
... | ALGO | 0.999758 | 4.72416 |
3b5e732f-b1a0-42c0-a8c5-9878083ed24e | ishandutta2007/codeforces | kostia244/normal/999/F.cpp | #pragma GCC optimize("trapv")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx,avx2,sse,sse2,fma,tune=native")
#include<bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define pb push_back
#include <x86intrin.h>
#define pb push_back
using namespace std;
using ll = long long;
using pi = pair<int, int>;
usin... | ALGO | 0.999974 | 3.498895 |
576f903a-3fd6-491a-a52b-08419a4c34b8 | SugarHedgehog/labs_shipilova | masha/yomkosti_dlya_producti.cpp | #include <iostream>
#include <string>
#include <iomanip>
using namespace std;
class Banka
{
protected:
double capacity; // ะะผะบะพััั ะฒ ะปะธััะฐั
public:
// ะะพะฝััััะบัะพั, ะฟัะธะฝะธะผะฐััะธะน ะตะผะบะพััั
Banka(double cap) : capacity(cap) {}
// ะะตัะพะด ะดะปั ะฟะพะปััะตะฝะธั ะพะฟะธัะฐะฝะธั ะตะผะบะพััะธ
string getDescription() const
{... | TOOL | 0.87244 | 5.683049 |
1ced3492-0ad9-4f25-b9f4-58c2f9380f3d | Fta16-web/DataStructureCPlusplus | STL/genericMerge.cpp | /*STL generic algorithm merge: combining elements of two sorted sequences into a single sorted seguence
merge(first1, last1, first2,last2,result);
result contains all elements of the two input sequences and is also in asending order
*/
#include<iostream>
#include<cassert>
#include<list>
#include<deque>
#include<a... | ALGO | 0.96697 | 4.912657 |
60da5f91-2e15-4f0b-9583-b60714c54b9f | whoiszyc/Repo_cpp | online_course/advanced-cplusplus-master/ImprovingtheBasicFractal/src/main.cpp | #include <iostream>
#include <cstdint>
#include "Mandelbrot.h"
#include "Bitmap.h"
using namespace std;
using namespace caveofprogramming;
int main() {
int const WIDTH = 800;
int const HEIGHT = 600;
Bitmap bitmap(WIDTH, HEIGHT);
double min = 999999;
double max = -999999;
for (int y = 0; y < HEIGHT; y++) {
... | ALGO | 0.903661 | 5.659448 |
b2487b83-3833-40c9-89e5-ce197f540134 | Liu-YT/LeetCode | cpp/275.H_Index_II.cpp | class Solution {
public:
int hIndex(vector<int>& citations) {
int h = 0, size = citations.size()-1;
for(int i = size; i >= 0; --i) {
if(h+1 <= citations[i]) ++h;
else break;
}
return h;
}
}; | ALGO | 0.999755 | 6.344141 |
9e85eaca-326f-4a4c-8ee0-d4f3ff3ca19a | LINKHA/Auto3D | Auto3D/ThirdParty/bgfx/bgfx/3rdparty/glsl-optimizer/src/glsl/lower_vec_index_to_swizzle.cpp | /**
* \file lower_vec_index_to_swizzle.cpp
*
* Turns constant indexing into vector types to swizzles. This will
* let other swizzle-aware optimization passes catch these constructs,
* and codegen backends not have to worry about this case.
*/
#include "ir.h"
#include "ir_visitor.h"
#include "ir_optimization.h"
... | ALGO | 0.910405 | 7.461843 |
1fd5394e-4aac-4663-9ef6-b574063594f9 | xhaktmchl/Algorithm_study | AlgorithmJobs/[์๊ณ ๋ฆฌ์ฆ์ก์ค ch3 V] ์ซ์ ํผ๋ผ๋ฏธ๋.cpp | #include <iostream>
using namespace std;
/*
[์๊ณ ๋ฆฌ์ฆ์ก์ค ch3 V] ์ซ์ ํผ๋ผ๋ฏธ๋
ํ์ด: ๋ฐฐ์ด์ 1~9 ๊น์ง ์ ์ฅํ๊ณ ์ธ๋ฑ์ค ๋ฏธ๋ฆฌ ๊ฒ์ฐํด์ ์ญ์, ์ ์ ์ถ๋ ฅ
์๊ฐ๋ณต์ก๋: O()=
ํ์ด2: ์ถ๋ ฅ๋ ์ซ์ ๋ฐฐ์ด์ ์ ์ฅ์์ผ์ ์ญ์์ถ๋ ฅ
์๊ฐ๋ณต์ก๋: O(n*n)=10000
*/
int n,s;
int a[201];
int main() {
ios::sync_with_stdio(false); // ๊ณ์ฐ์๊ฐ ๋จ์ถ // cin,scanf ๊ฐ์ด ์ฐ๋ฉด ์ค๋ฅ
cin.tie(nullptr); cout.tie(nullptr);// ์
์ถ๋ ฅ ์๊ฐ ๋จ์ถ ... | ALGO | 0.999736 | 3.529266 |
b1721ca3-c8b5-4c0e-8af8-ef0cf3b60f44 | ryo-manba/AtCoder | ABC/ABC180/c/main.cpp | #include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = (int)1e9;
const ll INFL = (ll)1e15;
const int MOD = 1e9 + 7;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};
int main()
{
ll n;
cin >> n;
set<lo... | ALGO | 0.999805 | 4.197022 |
a5402945-a96f-4b14-b65b-84ecb2365730 | LoricAndre/IN203 | TravauxDirige_n.2/Sources/mandelbrot_mpi.cpp | # include <iostream>
# include <cstdlib>
# include <mpi.h>
# include <vector>
#include <iterator>
# include "Mandelbrot.cpp"
int main( int nargs, char* argv[] ) {
MPI_Init( &nargs, &argv );
MPI_Comm globComm;
MPI_Comm_dup(MPI_COMM_WORLD, &globComm);
int nbp;
MPI_Comm_size(globComm, &nbp);
int rank;
MPI_C... | ALGO | 0.997863 | 4.938725 |
3bcdccec-a429-4d33-b7b7-e100ea804646 | ricky-aufvaa/DSA | lec34/palindrome.cpp | #include <iostream>
using namespace std;
bool palindrome(string &s, int i, int j) {
// base case
if (i > j) {
return true;
}
if (s[i] == s[j]) {
return palindrome(s, i + 1, j - 1);
} else {
return false;
}
}
int main() {
string s = "eaaarrraaae";
bool ispalindrome = palindrome(s, 0, s.leng... | ALGO | 0.99992 | 4.587115 |
00e58dc3-cebf-4410-b8d3-2a02e9152c6f | mdtariqueh007/My_Leetcode | 726-number-of-atoms/number-of-atoms.cpp | class Solution {
public:
string countOfAtoms(string formula) {
int n = formula.size();
stack<unordered_map<string,int>> st;
st.push(unordered_map<string,int>());
int i = 0;
while(i<n){
if(formula[i]=='('){
st.push(unordered_map<string,int>());
... | ALGO | 0.999995 | 5.098056 |
e58b6ddc-2fc0-4c43-af68-8522f05d96d5 | OmarShamkh/competitive-programming-practise | CodeForces/I_Meteor_Flow.cpp | #include <bits/stdc++.h>
#pragma GCC optimize ("O3")
using namespace std;
typedef long long ll;
#define INGZzz cin.tie(0);cin.sync_with_stdio(0);
const int N = 1e5;
int main()
{
INGZzz
int t = 1;
// cin >> t;
while(t--){
int n;
cin >> n;
priority_queue<int>pq;
int... | ALGO | 0.999836 | 4.358259 |
1c4c8cfc-3682-4389-8e1d-d67ccb88797d | Rajspeaks/Code-Pyramid | C++/Linked List/LeetCode LinkedList/234. Palindrome Linked List.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:
bool isPalindrome(Lis... | ALGO | 0.999741 | 6.074725 |
f1a52d09-6f9c-495c-9e1e-ff9746cc1c6f | miriyalatarunkumar/DSA_Practice | 0078-subsets/0078-subsets.cpp | class Solution {
private:
void fun(vector<int> &nums, vector<vector<int>> & ans, vector<int> v, int i){
if(i==nums.size()){
ans.push_back(v);
return;
}
v.push_back(nums[i]);
fun(nums, ans, v, i+1);
v.pop_back();
fun(nums, ans, v, i+1);
}
pu... | ALGO | 0.999952 | 6.256414 |
4ad0bdf4-ca84-4057-94f9-eef61c7eccc9 | peucastro/prog_exercises | P08/fraction.cpp | class Fraction
{
public:
Fraction();
Fraction(int numerator, int denominator);
int numerator() const;
int denominator() const;
int gcd(int a, int b);
int lcm(int a, int b);
void normalise();
void write() const;
Fraction sum(const Fraction &right);
Fraction sub(const Fraction &rig... | TOOL | 0.989524 | 6.220739 |
c6d65e1b-34ee-40a5-a06a-152aa35599db | PhoenixGS/Solutions | USACO/ride.cpp | /*
ID: thestar1
PROG: ride
LANG: C++
*/
#include <cstdio>
#include <cstring>
char x[100];
char y[100];
int n, m;
int xx, yy;
int main()
{
freopen("ride.in", "r", stdin);
freopen("ride.out", "w", stdout);
scanf("%s", x + 1);
scanf("%s", y + 1);
n = strlen(x + 1);
m = strlen(y + 1);
xx = 1;
for (int i = 1; i <... | ALGO | 0.999894 | 3.519199 |
34e11b67-5244-4d78-a266-636aea270b19 | ArmenSl/LTL-Search | Model.cpp | #include "Model.h"
#include <iostream>
#include <fstream>
#include <filesystem>
#include <cctype>
#pragma region InterpretationFunction
InterpretationFunction::InterpretationFunction()
{
}
InterpretationFunction::InterpretationFunction(int stateCount)
{
this->interpretations.resize(stateCount);
}
void Interpretat... | TOOL | 0.93257 | 5.215429 |
a4c479f2-08b2-4110-8e6a-c35af452ab1d | Bitcoinote/node-cryptonote-utils | src/cryptonote_core/difficulty.cpp | #include <algorithm>
#include <cassert>
#include <cstddef>
#include <cstdint>
#include <vector>
#include "common/int-util.h"
#include "crypto/hash.h"
#include "cryptonote_config.h"
#include "difficulty.h"
namespace cryptonote {
using std::size_t;
using std::uint64_t;
using std::vector;
#if defined(_MSC_VER)
#... | ALGO | 0.997858 | 6.869785 |
acc30f2f-fbc7-42ad-9308-8842b0f39df2 | EASINTUHA/Codechef-My-All-Solution | Bucket_and_Water_Flow.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(NULL);
int t;
cin>>t;
while(t--)
{
int a,b,c,d;
cin>>a>>b>>c>>d;
a=a+(c*d);
if(a>b)
{
cout<<"overFlow"<<endl;
}
else if(a==b)
... | ALGO | 0.990538 | 3.367446 |
4a0f04fb-20e1-4135-8b07-9a8543cf7a41 | Lawrenceh/AC_Monster | Sorting Algorithms/counting sort.cpp | #include <iostream>
#include <cstdlib>
#include <cstdio>
using namespace std;
void csort(int a[], int b[], int n) {
int *c = new int[10001]{0};
for (int i = 0; i < n; i ++) c[a[i]] ++;
for (int i = 0; i < 10000; i ++) c[i + 1] = c[i] + c[i + 1];
int j = n - 1;
while (j >= 0) {
b[c[a[j]] - 1... | ALGO | 0.999986 | 4.354448 |
2b871086-01f4-41a6-8cd6-686984f6d82f | mmaddury/LeetCode | 848. Shifting Letters.cpp | class Solution {
public:
string
shiftingLetters(string S, vector<int>& shifts) {
vector<char> a{'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};
map<char,int> m;
for( int i=0; i<a.size(); i++ ) {
... | ALGO | 0.999969 | 6.062091 |
3e582b2c-f24f-445a-9112-98df6ccfdac8 | Matteovullo/Prog-I | ESAMI LABORATORIO/26_07_2019_B.cpp | #include <iostream>
#include <cstdlib>
#include <typeinfo>
#include <cmath>
#define DIM 50
using namespace std;
class A{
private:
int *vec;
short len;
public:
A(short m, int a, int b){
len=m;
vec=new int[len];
for(int i=0; i<len; i++){
... | ALGO | 0.987848 | 3.629117 |
606e8388-a472-4fa2-b528-e87ac7baca6b | omkar1403/DSA-questions-on-daily-basis | DP_Series/DP_STRINGS/Edit_distance.cpp | /* Here we have to do the 3 operations Soo when it comes to replace then we just replace and moving i-1,j-1 and
when it comes to deletion then we just delete one number and move i-1 and j remains as it is so when it comes to
inserting the element then we just kept i as it is as we insert element similar to the j soo ... | ALGO | 0.999999 | 5.998866 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.