uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
0119c8a5-aa1f-4f79-b6ed-a8b715dd2210 | vectar31/Spoj-solutions-and-other-c-codes | cencry/main.cpp | #include<bits/stdc++.h>
#define isvowel(x) (x == 0 || x == 4 || x == 8 || x == 14 || x == 20)
// from the infinite pattern try to figure out hte mapping until repition occurs. Mapp in O (1) time
// O (1) time pased in 0.08 seconds;
using namespace std;
int main(){
string vows= "aeiouaeiouaeiouaeiouaeiouaeiouaeio... | ALGO | 0.999912 | 4.646439 |
d674c72c-8f02-4209-82e4-f2228b2bfc0d | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_8595_1.cpp | #include <bits/stdc++.h>
using namespace std;
struct Dominator {
struct min_DSU {
int N;
vector<int> par, val;
vector<int> const ;
min_DSU(int _N, vector<int> const &semidom)
: N(_N), par(N, -1), val(N), semi(semidom) {
iota(val.begin(), val.end(), 0);
}
void comp(int x) {
... | ALGO | 0.999975 | 4.659986 |
491a5625-78b9-4152-aa3d-727d56c14766 | jimmy19911108/cppPractice | listPractice.cpp | //a deck of cards(52 cards)
//get 5 cards in each hand
//11 hands in each comepare
//record the times that the last hand has a same hand in the other 10
//print the execution time and the recorded times
//list practice
#include<iostream>
using std::cout;
using std::cin;
using std::endl;
#include<list>
using std::lis... | ALGO | 0.982398 | 4.051664 |
67964c3b-2da7-4be6-ad0e-d4cfff454771 | IllusoryY/exercise | Algorithms/SwapNodesinPairs/SwapNodesinPairs/SwapNodesinPairs.cpp | /*
Given a linked list, swap every two adjacent nodes and return its head.
You may not modify the values in the list's nodes, \
only nodes itself may be changed.
Example:
Given 1->2->3->4, you should return the list as 2->1->4->3.
*/
#include<iostream>
struct ListNode
{
int val;
ListNode *next;
ListNode(int x) : va... | ALGO | 0.99999 | 5.61692 |
4e782028-5532-4e12-8350-78f2f6cc6cc4 | NAGAVENIGOWDA/My_Placement_prep_DSA | preorder.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// Tree Node
struct Node
{
int data;
Node* left;
Node* right;
};
vector<int> preorder(struct Node* root);
// Utility function to create a new Tree Node
Node* newNode(int val)
{
Node* temp = new Node;
temp->data = val;
temp->l... | ALGO | 0.999764 | 7.159167 |
60f6ae72-36bb-4bc8-994c-10a2ced33a44 | ashib11/Sub_Zero_ | matrix.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
template <typename T>
#define ll long long
#define pi acos(-1.0)
#define ull unsigned long long
#define endl "\n"
#define all(v) v.begin(), v.end()
#define allr(v) v.r... | ALGO | 0.999953 | 4.915083 |
87d8dddb-ceb7-4672-90fb-9b5c1d70aa48 | shelltdf/osgall | prebuild/boost_1_71_0/libs/geometry/example/c01_custom_point_example.cpp | // Boost.Geometry (aka GGL, Generic Geometry Library)
#include <iostream>
#include <boost/geometry/algorithms/distance.hpp>
#include <boost/geometry/algorithms/make.hpp>
#include <boost/geometry/geometries/register/point.hpp>
#include <boost/geometry/strategies/strategies.hpp>
#include <boost/geometry/io/dsv/write.hp... | TOOL | 0.856838 | 5.841064 |
ed260d75-6a5c-4980-8f8d-3306e47a5ceb | abichengs01/bmi_calculator | 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 |
1f646759-3c89-4b0d-aaca-a125aa43ac64 | himanshudabas/CG_Lab | 1-Bresenham_Line.cpp | #include <iostream>
#include <stdio.h>
#include <graphics.h>
#include <cmath>
using namespace std;
int X, Y;
void put_pixel(int x, int y) {
putpixel(X + x, Y - y, RED);
}
void Bresenham(int X1, int Y1, int X2, int Y2) {
int DX = X2 - X1;
int DY = Y2 - Y1;
int _2DY = 2 * DY;
int _2DX = 2 * DX;
... | ALGO | 0.856286 | 3.634103 |
ad9e468f-6e33-49f1-b147-d553d53ff1a3 | upendra-coder/CP | A_Puzzles.cpp | #include <bits/stdc++.h>
using namespace std;
bool solve(const vector<int> &a, int n, int mid) {
for (int i = 0; i + n - 1 < a.size(); i++) {
if (a[i + n - 1] - a[i] <= mid)
return true;
}
return false;
}
int main() {
int n, m;
cin >> n >> m;
vector<int> a(m);
for (int ... | ALGO | 0.999987 | 4.840476 |
8ada85f4-32df-4b8a-a12b-86f5c2447bb3 | Jake-Sheehan/MerkleTree | trees.cpp | #include "trees.h"
namespace trees
{
/*
* DEFAULT CONSTRUCTOR
*
* This default constructor takes in a vector of transaction pointers.
* Then, it generates the root hash, generating the entire Merkle tree
* in the process.
*/
Merkle::Merkle(std::vector<nodes::Node*> uTransactions)
{
transactions = uTransac... | ALGO | 0.951714 | 3.423436 |
9d05fc25-3dc2-4d06-985f-c4f81b494b35 | AlexisBalayre/SparseMatrixMultiplicationMPI | Source Code/utils.cpp | #include "utils.h"
/**
* Method to convert a PETSc matrix to a fat vector
* @param C PETSc matrix
* @return FatVector fat vector
*/
FatVector ConvertPETScMatToFatVector(Mat C)
{
PetscInt m, n; // Number of rows and columns in the matrix
MatGetSize(C, &m, &n); // Get the number of rows and columns i... | TOOL | 0.990697 | 5.729802 |
d7c3c41d-b5e5-47c7-9f3b-4aed964e4807 | AhJo53589/leetcode-cn | problems/sum-of-digits-in-base-k/SOLUTION.cpp |
//////////////////////////////////////////////////////////////////////////
class Solution {
public:
int sumBase(int n, int k) {
int ans = 0;
while (n != 0) {
ans += n % k;
n /= k;
}
return ans;
}
};
///////////////////////////////////////////////////////... | ALGO | 0.999935 | 4.798531 |
6226d659-4b3e-45d4-90aa-c38b5e8b3f57 | adityanjr/code-DS-ALGO | CodeForces/Complete/1000-1099/1077B-DistrurbedPeople.cpp | #include <cstdio>
#include <vector>
int main(){
long n; scanf("%ld", &n);
std::vector<int> a(n); for(long p = 0; p < n; p++){scanf("%d", &a[p]);}
long cnt(0);
for(long p = 1; p < n - 1; p++){
if(a[p]){continue;}
if(a[p - 1] && a[p + 1]){a[p + 1] = 0; ++cnt;}
}
printf("%ld\n",... | ALGO | 0.99996 | 4.060673 |
0e1b6bad-7973-48a8-be27-1109d354115d | krishnaanaril/UVA | 324.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef vector<int> vi;
typedef vector<ld> vd;
typedef pair<ll,ll> pl;
#define FASTIO ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
#define... | ALGO | 0.99901 | 3.666025 |
5185beac-6f48-46ee-84a3-006a05fe32c6 | abhishekrathour07/cpp-language | 10_Multilevel_Inheritance.cpp | // c oncept of multilevel inheritance .
#include <iostream>
using namespace std;
class student
{
int Roll;
public:
int set_Roll(int r)
{
Roll = r;
}
void get_Roll()
{
cout << "The roll number is " << Roll << endl;
}
};
class exam : public student {
protected:
float maths ,... | TOOL | 0.881818 | 4.070872 |
60e9688f-8e5a-41ad-92cc-0df615ffbeca | Ha-r-Preet-Singh/whatsapp_clone_ui | 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.998841 | 6.783336 |
df480cf9-a889-43c4-81a5-3924904bfb6a | Mubashir-vp/Location_provider | 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 |
19af36e2-2a0d-4ff9-b97b-8f5ab60fa1c9 | Vijaymalav/LeetCode-solution | 34-find-first-and-last-position-of-element-in-sorted-array/34-find-first-and-last-position-of-element-in-sorted-array.cpp | class Solution {
public:
vector<int> searchRange(vector<int>& nums, int target) {
int st=-1,end=-1;
int l=0;
int h=nums.size()-1;
while(l<=h){
int mid=(l+h)/2;
if(nums[mid]==target){
if(mid==0 || nums[mid]>nums[mid-1] ){
st=... | ALGO | 0.999957 | 6.610336 |
46aee69b-36d9-4d21-b76d-441ff1d126dd | a00012025/Online_Judge_Code | UVa/1439.cpp | #include<stdio.h>
#include<string.h>
#include<map>
#include<vector>
using namespace std;
map<char,int> mp ;
char ch[20] ;
bool G[20][20],have_edge[1<<15] ;
int cnt,n ;
vector<int> edge[2000] ;
int id(char c)
{
if(mp.count(c)) return mp[c] ;
mp[c]=n ; ch[n]=c ; //printf("ch[%d]=%c\n",n,c) ;
n++ ; return n-1... | ALGO | 0.999967 | 3.268205 |
8d6a34dd-a599-4c09-a10c-98ee8473bcd0 | falcaoanderson/CompetitiveProgramming | new-CSES/cses-1619.cpp | // 26/03/23 //
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define endl "\n"
#define PB push_back
typedef pair<int, int> pii;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
vector<pii> v;
for(int i=1; i<=n; i++){
... | ALGO | 0.999942 | 4.576657 |
bd77cf2e-ba81-41bc-a32a-b6c1fd49212c | hareta0109/atcoder | submissions/other/diverta2019/b.cpp | #include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <set>
#include <sstream>
#include <bitset>
#include <string>
using namespace std;
#define MOD (... | ALGO | 0.999697 | 3.770102 |
6eef43fe-29ee-428f-b77d-3bf527541b47 | akiraf1/competitive_programming | AOJ/introduction1/2_c.cpp | #include <iostream>
using namespace std;
int main()
{
int a, b, c, tmp;
cin >> a >> b >> c;
if (a > b) {
tmp = a;
a = b;
b = tmp;
}
if (b > c) {
tmp = c;
c = b;
b = tmp;
}
if (a > b) {
tmp = a;
a = b;
b = tmp;
}
... | ALGO | 0.99976 | 3.389239 |
92ae0197-f85b-4287-b95c-14f372c89ef4 | Bor1s/data_structures | week_1/Starters PA1/tree_height/tree-height.cpp | #include <iostream>
#include <vector>
#include <algorithm>
class TreeHeight {
int n;
std::vector<int> parent;
public:
void read() {
std::cin >> n;
parent.resize(n);
for (int i = 0; i < n; i++)
std::cin >> parent[i];
}
int compute_height() {
// Replace this code with a fas... | ALGO | 0.999451 | 5.382996 |
1c695249-4383-4d17-8f5c-338bfd5b56c1 | Nayeem-XTREME/UVa | 11677.cpp | #include <iostream>
using namespace std;
int main()
{
int H1, M1, H2, M2, m;
while (1) {
cin >> H1 >> M1 >> H2 >> M2;
if (H1 == 0 && M1 == 0 && H2 == 0 && M2 == 0)
break;
else {
if ((H2 * 60 + M2) < (H1 * 60 + M1)) {
H2 = H2 + 24;
m = (H2 * 60 + M2) - (H1 * 60 + M1);
}
else if ((H2 * 6... | ALGO | 0.999479 | 3.567297 |
257515cf-9869-4cc1-90ca-6eb4a43e4dd2 | ishandutta2007/codeforces | timur_sitdikov/normal/1450/A.cpp | #include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef double DOUBLE;
typedef complex<double> point;
#define xx real()
#define yy imag()
#define REP(i, a, b) for(int i = (a); i < (int)(b); i++)
#define R... | ALGO | 0.999861 | 3.793039 |
b5e28acc-48d4-4dc3-aaff-77643fab792e | varshney565/My-LeetCode-Submissions | 1591-strange-printer-ii/1591-strange-printer-ii.cpp | class Solution {
public:
bool isPrintable(vector<vector<int>>& grid) {
int n = grid.size();
int m = grid[0].size();
//Helping To calculate the boundries of each colour
vector<vector<int>> Colour(61,vector<int>{INT_MAX,INT_MIN,INT_MAX,INT_MIN});
for(int i = 0 ; i < n ; i++){
... | ALGO | 0.998508 | 5.740114 |
d9691cb1-7721-4acf-8243-0aa6775d06a2 | thanhdatnguyentk/Helloworld | CP/dictionarythtb.cpp | #include<bits/stdc++.h>
using namespace std;
string a[1000006],x;
long long n,k[30],dd[1000006];
int main() {
cin >> n;
for (int i = 1; i <= n; i++)
cin >> a[i];
for (int i = 0; i <= 25 ; i++) {
char t = (char) ((int) ('a') + i);
cout << "count " << t << endl;
cin >> k[i];
}
for (int i = 1; i <= n; ... | ALGO | 0.999747 | 3.1388 |
eec16d85-e67b-4412-872f-9db96efe2415 | liuxueyang/cpp | nowcoder/contest/round-79/数组数组_gen.cpp | #include <algorithm>
#include <array>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#inclu... | TOOL | 0.98148 | 4.121001 |
2069189d-d524-4a62-85c0-9b8798e68556 | zhipingu/algorithm | virtual_inheritance.cpp | // virtual_inheritance.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
/**
̳Уࣩ
*/
#include <iostream>
using namespace std;
// A
class A
{
public:
int dataA;
};
class B : virtual public A
{
public:
int dataB;
};
class C : virtual public A
{
public:
int dataC;
};
class DDD : publ... | TOOL | 0.902031 | 4.285331 |
befc0211-d607-4c97-9fcd-622e10980a2e | PabloMessina/Competitive-Programming-Material | Solved problems/Red de Programación Competitiva/2016-Competencia-11/J_OlympicGames.cpp | // tags: point-line duality, convex hull, two pointers, geometry
#include <bits/stdc++.h> // add almost everything in one shot
using namespace std;
// defines
#define rep(i,a,b) for(int i = a; i <= b; ++i)
#define invrep(i,b,a) for(int i = b; i >= a; --i)
#define umap unordered_map
#define uset unordered_set
// typedef... | ALGO | 0.999905 | 4.14751 |
985a81b5-0102-4079-82da-343667c41a0c | Mahesh-Pawar-02/Industrial-Programming-Logics | C++ Programming/Program505.cpp | #include<iostream>
using namespace std;
class Array
{
private:
int * Arr;
int iSize;
public:
Array(int X) // Parametrised Constructor
{
iSize = X;
Arr = new int[iSize];
}
~Array() // Destructor
{
... | ALGO | 0.999777 | 4.397834 |
0fefd434-069f-43f4-9de6-164c21cc7d6f | manojz18/Data-Structure-Algoritms | Binary Search/searchin_rotated_sorted_array.cpp | #include<iostream>
#include<vector>
using namespace std;
int Search_in_RotatedArr(vector<int> &arr, int target){
int s = 0;
int e = arr.size()-1;
while(s <= e){
if(arr[s] == target){
return s;
}
if(arr[e] == target){
return e;
}
if(arr[s] <... | ALGO | 0.999768 | 5.47757 |
23471904-b7a4-4c19-b0f9-6541f14b7b06 | jingresume/notes | interview/剑指Offer/Question/Q04_FindInPartialSortedMatrix.cpp | /*
* 在一个二维数组中,每一行都按照从左到右递增的顺序,每一列也按照从上到下递增的顺序
* 给你一个二维数组和整数,请查找整数是否包含在二维数组中
*/
#include <iostream>
bool findInMatrix(int* mat, int row, int col, int target)
{
bool found = false;
int curCol = col - 1, curRow = 0;
while (curCol >= 0 && curRow < row)
{
int curVal = mat[curRow * col + curCol];
... | ALGO | 0.9996 | 5.54491 |
e9bac2d7-3621-472e-b959-d8c03e33f11e | KC191/50-Days-Coding-Challenge | Day-07/61_Solution.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
ListNode* rotateRight... | ALGO | 0.999989 | 5.905497 |
13818c9c-3bef-4426-bb6c-3297c3139b68 | Harsh20221/DSA | LinkedList/Check for sorted.cpp | #include <iostream>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
struct node {
int data ;
struct node *next;
}*first=NULL;
void create(int A[], int n ){
struct node *last;
struct node *t;
first=new node ;
first->data=A[0];
first->next=NULL;
last=first;
for ( int i=1 ; i<n ; i++){
... | ALGO | 0.999853 | 4.63929 |
43c31c9f-2cea-4f76-873f-cf24ca3ea67b | pirroman/brute-force | brute_force/CryptoPP/eprecomp.cpp | // eprecomp.cpp - written and placed in the public domain by Wei Dai
#include "pch.h"
#ifndef CRYPTOPP_IMPORTS
#include "eprecomp.h"
#include "integer.h"
#include "algebra.h"
#include "asn.h"
NAMESPACE_BEGIN(CryptoPP)
template <class T> void DL_FixedBasePrecomputationImpl<T>::SetBase(const DL_GroupPrecomputation<E... | ALGO | 0.927971 | 7.16549 |
cd3f1e4e-15b3-48d8-9789-103ad77bff23 | 21A91A05C0/GeeksForGeeks | Difficulty: Medium/Maximum product subset of an array/maximum-product-subset-of-an-array.cpp | //{ Driver Code Starts
/* Driver program to test above function */
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
// User function Template for C++
class Solution {
public:
long long int findMaxProduct(vector<int>& arr) {
// Write your code here
int mod=1e9+7;
if(arr... | ALGO | 0.999923 | 6.325905 |
ed93531c-d848-4c74-8419-ca56138543f8 | KathrynLaing/CPNLearning | 10_DirichletSample.cpp | #include "10_DirichletSample.h"
using namespace std;
std::vector<double> DirSample(std::vector<double> beta, int k, int N){
//This Function takes k beta values and draws N times from the associated Dir distribution
//sample is output as a N*k vector listing each sample in order
double InputBeta[k],sample[k];
/... | ALGO | 0.970497 | 4.365956 |
dede333e-9eff-4d61-9330-b7850fd5e273 | jjhwan-h/algorithm | CPP/1593.cpp | /**
* @file 1593.cpp
* @author jang jeonghwan (<EMAIL>)
* @brief BOJ/1593/문자 해독
* @version 0.1
* @date 2024-07-08
*
* @copyright Copyright (c) 2024
*
*/
#include<iostream>
#include<vector>
#include<map>
#include<string>
using namespace std;
int W,S;
vector<int> per(100,0);
string arr;
void input(){
s... | ALGO | 0.999962 | 4.45265 |
87160bb8-a289-4ad3-8eff-07799f8b3adc | KudeGit/elments_of_programming_interview | first_pass/ch17_old/es13.cpp | #include <iostream>
#include <vector>
int get_max_height_helper (int c, int d,
std::vector<std::vector<int>>& F)
{
if (d == 0 || c == 0) {
return 0;
} else if (c == 1) {
return d;
} else if (F[c][d] == -1) {
F[c][d] = get_max_height_helper(c, d-1, F) +
get_max_h... | ALGO | 0.999707 | 5.215189 |
9a5105b6-4dc3-465e-b518-96bc8e1cf5b7 | OM6978/CP | CF/2024-C/H1/923/1.cpp | #include <bits/stdc++.h>
using namespace std;
#define space " "
#define endl '\n'
#define p_int pair<int,int>
#define v_int vector<int>
void solve()
{
int N;
cin>>N;
string s;
cin>>s;
int fir=-1,sec=-1;
for(int i=0;i<N;i++)
{
if(s[i]=='B')
{
if(fir==-1)fir=i;
... | ALGO | 0.99987 | 4.377674 |
aa09a63d-4956-429f-b7a5-4d24710e9b84 | Shubham0920/Daily-Leetcode-question | Check if Linked List is Palindrome - GFG/check-if-linked-list-is-palindrome.cpp | //{ Driver Code Starts
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <stack>
using namespace std;
/* Link list Node */
struct Node {
int data;
struct Node *next;
Node(int x) {
data = x;
next = NULL;
}
};
// } Driver Code Ends
/*
struct Node {
int data;
struct Node *next;
Nod... | ALGO | 0.999793 | 5.245747 |
38b137ea-6c34-4134-8d60-9e2cb1e14ff9 | muthu165/C-Plus-Plus-programs-and-Data-Structures | interpolation-search.cpp | #include<bits/stdc++.h>
using namespace std;
//ARRAY SORTED
//INTERPOLITAN SEARCH
int search(vector<int>v,int n,int k){
int l=0,h=n-1;
while(l<=k && k>=v[l] && k<=v[h]){
if(l==h){
if(v[l]==k) return l;
return -1;
}
int pos = l +(((double)(h-l)/(v[h]-v[l]))*(k-v[l]));
if(v[pos]==k) return pos;
if(v[po... | ALGO | 0.999949 | 5.139874 |
1965aab6-779c-4896-ad9a-c852acdc3822 | sadikmahmudadive/Codes_of_data_stractures_using_cpp | concatinate_two_strings_without_function.cpp | #include<iostream>
using namespace std;
int main()
{
string s1="Bangladesh University Of ";
string s2="Business And Technology";
string concat;
for(int i=0 ; i<s1.length(); i++)
{
concat += s1[i];
}
for(int i=0 ; i<s2.length(); i++)
{
concat += s2[i];
}
cout <<"T... | ALGO | 0.941565 | 3.037158 |
39263b53-1da6-4d10-adec-d05fbdad2997 | priya2001/gfg_potd_AC | Medium/Number of occurrence/number-of-occurrence.cpp | //{ Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
//User function template for C++
class Solution{
public:
/* if x is present in arr[] then returns the count
of occurrences of x, otherwise returns 0. */
int count(int arr[], int n, int x) {
// code here
int count=... | ALGO | 0.999892 | 5.95918 |
75dda25c-3a40-4aef-a4a8-ac987fe3acb0 | GeraldKimmersdorfer/meshlet_playground | source/vertexcompressor/DynamicMeshletVertexCodec.cpp | #include "DynamicMeshletVertexCodec.h"
#include "../helpers/lut.h"
#include <imgui.h>
#include "../helpers/packing.h"
#include "../helpers/permcodec.h"
#include "../meshletbuilder/MeshletbuilderInterface.h"
#include <glm/gtx/string_cast.hpp>
void DynamicMeshletVertexCodec::doCompress(avk::queue* queue)
{
// Step 1: C... | TOOL | 0.924851 | 5.868321 |
814d209a-1d14-4554-84fc-e9f8de74f861 | EnzoIdk/Programacion-2-24-1 | Proyectos Programación 2/Laboratorio 5/ImplementacionDeUnaListaGenerica/BibliotecaListaGenerica.cpp | #include <iostream>
#include <iomanip>
#include <fstream>
using namespace std;
#include "BibliotecaListaGenerica.h"
enum Nodo{DATO,SIG};
void crearLista(const char *nombArch,void *&lista,void* (*lee)(ifstream &),
int (*cmp)(const void*,const void*)){
void *dato;
ifstream arch(nombArch,ios::in);
... | TOOL | 0.992911 | 3.884564 |
7924cb77-4ea9-40a2-8175-b5df9c83889b | SansPapyrus683/usaco-solutions | src/official/o2013/jan/silver/pointlessFences/all_squares.cpp | #include <iostream>
#include <fstream>
#include <vector>
#include <set>
#include <stdexcept>
#include <algorithm>
using std::cout;
using std::endl;
using std::vector;
using std::set;
struct IDSquare {
int x;
int y;
int width;
int id;
IDSquare(int x, int y, int width, int id) : x(x), y(y), wid... | ALGO | 0.999386 | 4.461188 |
1ac7041e-d8b1-438a-a1d9-a26d47ebc1f8 | AwaisMehnga/DSA_Lab | LAB 12/Code/preorder.cpp | #include <iostream>
using namespace std;
struct Node {
int data;
struct Node *left, *right;
};
Node* newNode(int data)
{
Node* temp = new Node;
temp->data = data;
temp->left = temp->right = NULL;
return temp;
}
void printPreorder(struct Node* node)
{
if (node == NULL)
return;
... | ALGO | 0.999992 | 6.124395 |
1f3c9bd9-7cec-425d-ba56-870a6b1bfd5d | shoutagit/AtCoder | 過去問C問題/C - Same Integers.cpp |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
const ll INF = 1LL << 60;
//毎回合計が2ずつ増えていく
//A,B,C→X,X,Xなら(3X-(A+B+C))/2が答え
//3X=A+B+C(mod2)
//X>=max{A,B,C}
//上記の条件を満たすのはmaxかmax+1のどちらかだから2パターンだけになる
int main(){... | ALGO | 0.999973 | 4.844631 |
6beef92a-7a38-4b39-a1d5-dba465cc833f | thakursachin05/MASTERING_CPP | Assignment_08_&_09/BreakingTheRecords.cpp | // https://www.hackerrank.com/challenges/breaking-best-and-worst-records/
// Breaking the records
#include <bits/stdc++.h>
using namespace std;
string ltrim(const string &);
string rtrim(const string &);
vector<string> split(const string &);
/*
* Complete the 'breakingRecords' function below.
*
* The function is... | ALGO | 0.997945 | 5.850852 |
d0e9faef-2b2c-4e78-8be4-e7a21bf959d9 | yuika-sama/code-ptit-solutions | SSAA - 2024/1420.cpp | #include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O2")
#pragma GCC target("avx,avx2,fma")
#define faster() {ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);}
#define ll long long
#define pii pair<int, int>
#define vi vector<int>
#define vll vector<long long>
#define mii map<int, int>
#define si s... | ALGO | 0.999864 | 4.650616 |
9b34543d-01b5-4b74-89a8-8372f322e180 | Aethereux/Hikari-LLVM19 | mlir/examples/toy/Ch5/mlir/Dialect.cpp | #include "toy/Dialect.h"
#include "mlir/IR/Attributes.h"
#include "mlir/IR/Builders.h"
#include "mlir/IR/BuiltinTypes.h"
#include "mlir/IR/Location.h"
#include "mlir/IR/OpImplementation.h"
#include "mlir/IR/OperationSupport.h"
#include "mlir/IR/ValueRange.h"
#include "mlir/Interfaces/CallInterfaces.h"
#include "mlir/I... | TOOL | 0.859513 | 7.96477 |
cd8afd7a-9284-46af-a2c6-3f41b540a4cc | Sewery/InformatykaMatura | Operon_probne/Operon 2022.11 prob nf/N7968_informa_SP_klucz_GLOWNY_rn/rozwiązania/zadanie 2.3/main.cpp | #include <iostream>
#include <bits/stdc++.h>
#include <fstream>
using namespace std;
int main()
{ifstream plik;
plik.open("genetyka.txt");
char geny[5][3]={{'A','B','D'},{'B','C','A'},{'B','C','D'},{'C','D','D'},{'D','B','C'}};
string s,s1;
int dlugosc,i,bledy=0;
bool koniec;
while(!plik.eof())
{plik>>s;
dlugosc=s.s... | ALGO | 0.999594 | 3.647581 |
20eeb0e5-5c41-4def-aecd-9d995a413d00 | Kuldeepagrahari/Programming-DSA-Shell-BashScripting-OOPS | algos/DP/fr0g_jump.cpp | #include <bits/stdc++.h>
int ans=0;
int rec( vector<int>&heights , int n , int ind , vector<int>&dp){
if ( ind <= 0 ){
return 0;
}
int oneStep = INT_MAX,twoStep = INT_MAX;
if ( dp[ind] != -1 )return dp[ind];
if (ind - 1 >= 0) {
oneStep = rec(heights, n... | ALGO | 0.999806 | 5.050797 |
e6afd518-25d1-4a4e-a5c9-e6563cb446a7 | smart-make/boost | libs/msm/doc/PDF/examples/SimpleWithFunctors.cpp | #include <vector>
#include <iostream>
// back-end
#include <boost/msm/back/state_machine.hpp>
//front-end
#include <boost/msm/front/state_machine_def.hpp>
// functors
#include <boost/msm/front/functor_row.hpp>
#include <boost/msm/front/euml/common.hpp>
// for And_ operator
#include <boost/msm/front/euml/operator.hpp>
... | TOOL | 0.892509 | 6.584952 |
151e9257-4a19-4a43-b0f1-8fccfc5aa936 | lyccrius/OI-Solution | UVa/11019 Matrix Matcher Hash.cpp | #include <iostream>
typedef char chr;
typedef unsigned long long ull;
const int maxN = 1000;
const int maxM = 1000;
const int maxX = 100;
const int maxY = 100;
const ull base1 = 131;
const ull base2 = 13331;
int t;
int n, m;
int x, y;
chr A[maxN + 10][maxM + 10];
chr B[maxX + 10][maxY + 10];
ull a[maxN + 10][maxM + ... | ALGO | 0.997936 | 3.927183 |
29d43207-9b5f-45b2-ae82-257b02180ddd | ashrafulislampro/Basic_Data_Structure_with_phitron | Module_10/cycle_detecting_alg.cpp | #include <bits/stdc++.h>
using namespace std;
class Node
{
public:
int val;
Node *Next;
Node(int n)
{
this->val = n;
this->Next = NULL;
}
};
int main()
{
Node *head = new Node(10);
Node *a = new Node(20);
Node *b = new Node(30);
Node *c = new Node(40);
Node *d = ... | ALGO | 0.999786 | 4.510882 |
fb05eea1-f04a-4990-90d7-b838915327e1 | SadMathLovergo/LeetCodeSolution | 207canFinish/207canFinish.cpp | #include <vector>
#include <iostream>
using namespace std;
//207 γ̱
//˼·鿴Ƿѭ
//ʹDFSǷѭ
class Solution {
private:
vector<bool> hasBeenFinished; //ڱDFSУͼıΪʵֵݹݣtrueΪѱfalseΪδ
vector<bool> canBeFinished; //ڱÿڵǷԱ鿴еĽڵǷܱ
vector<bool> needPrerequisites; //needPrerequisites[i]ΪǷָi·
vector<vector<int>> prerequisitesMe... | ALGO | 0.999907 | 5.711249 |
6c876079-45fc-430e-9c0e-1a55515f92c6 | thetimehacker/newlife2 | Templates/vector_template.cpp | #include<bits/stdc++.h>
using namespace std;
//creating a basic vector template
//--can be used to declare a vector of n size
//--can be used to make a copy of another vector
template<class T>
class vect{
//one pointer of type T
T* v;
int size;
public:
vect(int s){
v=new T[size=s];
//also initializing every... | ALGO | 0.961266 | 3.130297 |
e8be0666-85ee-4074-b1fb-c8e19e3c6299 | dangbach3107/PTIT_Discrete_Mathematics_2 | chu_trinh_hamilton.cpp | #include <iostream>
using namespace std;
int n, k, u , a[105][105];
int res[100];
bool check[100];
void in(){
for(int i = 1; i <= n; i++) cout << res[i] << " ";
cout << res[1] << endl;
}
void hmt(int k){
for(int y = 1; y <= n; y++){
if(a[res[k - 1]][y]){
if(k == n + 1 && y == res[1]){... | ALGO | 0.999888 | 3.117076 |
ca26f89b-38c7-4b7b-bf36-e2fa3d2fc369 | rragesh/M1-Robotics-Reports | SEMESTER 1/COMPUTER VISION/COVIS-Labs/lab1_CV/src/point_estim.cpp | #include <visp/vpHomogeneousMatrix.h>
#include <visp/vpPoint.h>
#include <visp/vpSubColVector.h>
#include <visp/vpSubMatrix.h>
#include <visp/vpFeaturePoint.h>
#include <visp/vpFeatureBuilder.h>
#include <visp/vpExponentialMap.h>
#include <visp/vpAdaptiveGain.h>
#include <visp/vpIoTools.h>
#include <cam_models.h>
#in... | ALGO | 0.987801 | 4.963038 |
aa0f77ea-66c3-4df4-9be7-f173e411022d | josehpg98/Algorithms | A-I_2018.2/Aula3/listexercicios2/e23.cpp | #include<iostream>
#include<locale.h>
using namespace std;
main()
{
setlocale(LC_ALL,"Portuguese");
int m,a;
string t;
cout<<"qual foi o mes em que foi feita a recarga";
cin>>m;
cout<<"qual foi o ano da recarga?";
cin>>a;
cout<<"qual o tipo do extintor?(em minusculo)";
cin>>t;
if... | ALGO | 0.962725 | 3.750697 |
9ba9e241-c9ab-48cf-ae3c-153c02007239 | Nakkkkkul0130/Neo-Collab-DSA | unit 4/vasu.cpp | #include <iostream>
using namespace std;
struct TreeNode {
int val;
TreeNode* left;
TreeNode* right;
TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
};
TreeNode* insert(TreeNode* root, int val) {
if (root == nullptr) {
return new TreeNode(val);
}
if (val < root->val) {
... | ALGO | 0.999711 | 5.820117 |
e6acd255-6336-41b9-b824-8bc8f0acfdaf | dabin011109/20205101-_Project2 | 20205101_Project4/ex_02.cpp | // p435, 5
#include<iostream>
using namespace std;
class Time {
private:
int hours;
int minutes;
public:
Time(): hours(0), minutes(0){ }
Time(int h, int m): hours{h}, minutes{m} { }
void displayTime() {
cout << hours << ": " << minutes << endl;
}
Time& operator++() {
if (minutes >= 59) {
++hours;
... | TOOL | 0.984154 | 5.031544 |
3b9f1cf4-563c-478e-a278-bd9e38e57c4c | mayankkeswani11/mysirg_saurabh_shukla_c-_dsa_iot-bootcamp_programs | my_c++_programs/assignment26/ass10.cpp | /*9. Define a class Bill and define its member function get() to take detail of customer ,
calculateBill() function to calculate electricity bill using below tariff :
Upto 100 unit RS. 1.20 per unit
From 100 to 200 unit RS. 2 per unit
Above 200 units RS. 3 per unit.*/
#include<iostream>
using namespace std;
class Bill{... | TOOL | 0.971264 | 4.583564 |
2bba9ac3-e771-4f03-b2ee-0034965332f4 | newfeed123/C_Programming | buoi11/bai21.cpp | #include<iostream>
#include<math.h>
using namespace std;
int a[101];
void sang(){
for(int i = 0; i < 101; i++)
a[i] = 1;
a[0] = 0;
a[1] = 0;
for(int i = 2; i <= sqrt(101); i++){
if(a[i] == 1){
for(int j = i*i; j <= 101; j += i){
a[j] = 0;
}
}
}
}
int main(){
int t; cin>>t;
sang();
// for(int i =... | ALGO | 0.99938 | 3.354015 |
04efe396-8d52-4ecf-88d1-6b7dc36962c2 | sishir2001/DSA_DAA | Mathematics/iterativePower(binary_exponentiation).cpp | // calculating power of number using binary exponention
#include<iostream>
using namespace std;
long binaryExponention(int x,int n){
// @param x : base number
// @param n : exponent
// T(N) = O(log(n))
// S(n) = O(1)
long res = 1;
while(n!=0){
if(n%2 == 1){
// last bit is... | ALGO | 0.999909 | 5.845961 |
f2d9c099-f7d6-4f4d-a340-6bde721eca9a | SummerZheng/MyEuLerProject | Project69/Source.cpp | #include<iostream>
#include<vector>
#include<time.h>
using namespace std;
template <typename T>
void print(vector<T> vec){
for(int i=0; i!=vec.size(); ++i)
cout<<vec[i]<<" ";
cout<<endl;
}
void generatePrimeChart(vector<int> &primeChart, int maxN){
primeChart[0]=2;
int primeCount = 1;
for (int n=3; n<=maxN; ++... | ALGO | 0.999791 | 4.138175 |
d1d802cd-3a8b-4839-bd82-7478f79ea3c5 | yevhenDarovykh/RomanToInteger | RomanToInteger/Solution.cpp | #include <iostream>
#include <map>
using namespace std;
class Solution {
public:
map<string, int> romanNumbers = {
{"I", 1},
{"V", 5},
{"X", 10},
{"L", 50},
{"C", 100},
{"D", 500},
{"M", 1000}
};
map<string, int> romanNumberSubs = {
{"IV", 4}... | ALGO | 0.999748 | 5.819005 |
6485ca45-e3ff-4097-94da-26e8b5a2b926 | Robbbert/messui | 3rdparty/bgfx/3rdparty/spirv-tools/source/opt/block_merge_util.cpp | #include "block_merge_util.h"
namespace spvtools {
namespace opt {
namespace blockmergeutil {
namespace {
// Returns true if |block| contains a merge instruction.
bool IsHeader(BasicBlock* block) { return block->GetMergeInst() != nullptr; }
// Returns true if |id| contains a merge instruction.
bool IsHeader(IRConte... | TOOL | 0.988414 | 7.970522 |
28c7d9e0-8d22-46b5-a5e3-2d76ce39803a | KekovD/ITMO_algorithms | Second semester/Lab_12/12_B/12_B.cpp | #include <iostream>
#include <vector>
#include <algorithm>
std::vector<long long> parent;
long long find (long long x) {
if (parent[x] != x) {
parent[x] = find (parent[x]);
}
return parent[x];
}
void unite (long long x, long long y) {
long long px = find (x);
long long py = find (y);
... | ALGO | 0.999978 | 4.933193 |
3cae888b-0629-4fa4-b240-3e6867f54fc2 | lohith171/Coding-Practice-Problems | Arrays/Pascal triangle.cpp | //https://www.interviewbit.com/problems/pascal-triangle/
vector<vector<int> > Solution::solve(int A) {
if(A==0)return {};
vector<vector<int>>res;
res.push_back({1});
for(int i=1;i<A;i++){
vector<int>temp;
temp.push_back(res[i-1][0]);
for(int j=1;j<res[i-1].size();j++){
... | ALGO | 0.999313 | 4.974179 |
15f1b8db-9b21-4b53-8fc4-e317c900b98a | XessX/Angry_Bird_Alike | boost/libs/iterator/example/transform_iterator_example.cpp | #include <functional>
#include <algorithm>
#include <iostream>
#include <boost/iterator/transform_iterator.hpp>
// What a bummer. We can't use std::binder1st with transform iterator
// because it does not have a default constructor. Here's a version
// that does.
namespace boost {
template <class Operation>
clas... | ALGO | 0.995204 | 6.608331 |
f5961f36-8d59-4628-971b-3fdbb28102b1 | Dashmenko/OPSIS | 4.4/4.4.cpp | /*
Мьютекс-это объект синхронизации потоков, который позволяет одновременно обращаться к ресурсу только одному потоку.
Доступ к другим ресурсам разрешается только тогда, когда процесс переходит в сигнальное состояние.
предназначен для организации взаимоисключающего доступа к общим данным для нескольких потоков с испо... | ALGO | 0.977872 | 3.966989 |
08fd8ac5-32ef-4590-8ae7-b016bf862833 | WingsOSab/android_frameworks_av | media/module/codecs/amrnb/common/src/div_s.cpp | /*
Pathname: ./gsm-amr/c/src/div_s.c
------------------------------------------------------------------------------
REVISION HISTORY
Description: Created separate file for the div_s function. Sync'ed up
with the current template and fixed tabs.
Description: Making changes based on review meeting.
Des... | ALGO | 0.999713 | 5.724687 |
74ffe56c-a0b6-46c9-944e-76fca19fad80 | rongfengyu/Data_Structure_and_Algorithm | Leetcode/151-reverse-words-in-a-string.cpp | /*
151. 翻转字符串里的单词
给定一个字符串,逐个翻转字符串中的每个单词。
示例 1:
输入: "the sky is blue"
输出: "blue is sky the"
示例 2:
输入: " hello world! "
输出: "world! hello"
解释: 输入字符串可以在前面或者后面包含多余的空格,但是反转后的字符不能包括。
示例 3:
输入: "a good example"
输出: "example good a"
解释: 如果两个单词间有多余的空格,将反转后单词间的空格减少到只含一个。
说明:
无空格字符构成一个单词。
输入字符串可以在前面或者后面包含多余的空格,但是反转后的字符不... | ALGO | 0.999625 | 3.832635 |
bebd98f1-051f-4d2d-ab06-77f484e86111 | txgcwm/code_study | cplusplus/boost/boost_1_63_0/libs/metaparse/example/compile_to_native_code/main.cpp | #include <boost/metaparse/repeated.hpp>
#include <boost/metaparse/sequence.hpp>
#include <boost/metaparse/lit_c.hpp>
#include <boost/metaparse/last_of.hpp>
#include <boost/metaparse/space.hpp>
#include <boost/metaparse/int_.hpp>
#include <boost/metaparse/foldl_reject_incomplete_start_with_parser.hpp>
#include <boost/me... | ALGO | 0.912094 | 6.802124 |
e7e85bf3-a4ba-4d02-a492-d10754b4d20f | butine/research | blockchain/source/bitcoin-master/src/wallet/wallet_ismine.cpp | #include "wallet_ismine.h"
#include "key.h"
#include "keystore.h"
#include "script/script.h"
#include "script/standard.h"
#include "script/sign.h"
#include <boost/foreach.hpp>
using namespace std;
typedef vector<unsigned char> valtype;
unsigned int HaveKeys(const vector<valtype>& pubkeys, const CKeyStore& keystore... | ALGO | 0.989776 | 5.516846 |
3c5bf0ac-5ad0-4236-9144-69513e330eef | khushi0704/DSA | binary_tree/level_order.cpp | #include <iostream>
#include <queue>
using namespace std;
// input
// preorder : output : 1 2 4 5 7 3 6
// inorder : output : 4 2 7 5 1 3 6
// Postorder : output : 4 7 5 2 6 3 1
// Level Order : output : 1 \n 2 3 \n 4 5 6 \n 7
class Node{
public:
int data;
Node *left;
Node *right;
Node(int d){
... | ALGO | 0.999887 | 4.687834 |
4623775b-b621-4dc1-8acd-bb2bffec430f | GrapixLeGrand/Lustrine | thirdparty/Bullet3/bullet3/src/BulletSoftBody/poly34.cpp | // poly34.cpp : solution of cubic and quartic equation
// (c) Khashin S.I. http://math.ivanovo.ac.ru/dalgebra/Khashin/index.html
// khash2 (at) gmail.com
// Thanks to Alexandr Rakhmanin <rakhmanin (at) gmail.com>
// public domain
//
#include <math.h>
#include "poly34.h" // solution of cubic and quartic equation
#defi... | ALGO | 0.999872 | 3.514366 |
d1853421-ef78-4ae4-911c-b7c9f4f1ace9 | GHScan/DailyProjects | C++/LeetCode/48_RotateImage.cpp | #include "stdafx.h"
//------------------------------
#include <algorithm>
class Solution {
public:
void rotate(vector<vector<int>> &matrix) {
flipVertically(matrix);
transpose(matrix);
}
private:
void transpose(vector<vector<int>> &matrix) {
for (int y = 0; y < (int)matrix.size(); ... | ALGO | 0.999872 | 5.504547 |
a579e158-34b1-4454-a87e-f32e09c82fe5 | ishandutta2007/codeforces | satashun/normal/276/D.cpp | //include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <... | ALGO | 0.999829 | 3.343768 |
a531e633-0da4-4144-8527-2e9016d3e8f0 | googleguru/vlsi-implementation | tools/LSOracle/lib/Galois/lonestar/experimental/bp/libdai/src/lc.cpp | #include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <dai/lc.h>
#include <dai/util.h>
#include <dai/alldai.h>
namespace dai {
using namespace std;
void LC::setProperties(const PropertySet& opts) {
DAI_ASSERT(opts.hasKey("tol"));
DAI_ASSERT(opts.hasKey("maxiter"));
DAI_ASSERT(opts.has... | ALGO | 0.999391 | 6.369451 |
2f5cca57-c1ba-4749-ac5a-e6b3f71437b2 | mrini01/CS170_EightPuzzle | node.cpp | using namespace std;
#include <iostream>
#include "Node.h"
Node::Node(int data[3][3], int n, int m) {
Node* root = new node();
for (int i = 0; i < 3; ++i) {
for (int j = 0; j < 3; ++j) {
root->GameState[i][j] = data[i][j];
}
}
root->right = nullptr;
root->left = nullptr;... | ALGO | 0.908451 | 3.299751 |
d91b6fef-5108-4350-b8e3-5829e228a097 | dzheng44/Coding | learnC++/Program1_RightTriangle/Program1_RightTriangle/dz183_prog1_righttriangle.cpp | /*
Name: David Zheng
NetID: dz183
Program Description: This program is dessigned to give the hypotenuss.
It will ask the user for 3 inputs, upon which it will give the hypotenuse.
*/
#include <iostream>
#include <string>
using std::cout;
using std::cin;
using std::string;
using std::endl;
//function declaration
voi... | ALGO | 0.995232 | 3.643242 |
2ab10e3b-71ba-499e-bf71-6f125631f76f | wisdompeak/LeetCode | Greedy/2457.Minimum-Addition-to-Make-Integer-Beautiful/2457.Minimum-Addition-to-Make-Integer-Beautiful.cpp | class Solution {
public:
int DigitSum(long long x)
{
int sum = 0;
while (x>0)
{
sum += x%10;
x/=10;
}
return sum;
}
long long makeIntegerBeautiful(long long n, int target)
{
string ret;
int carry = 0;
... | ALGO | 0.99988 | 5.962837 |
596cd499-3e1c-4217-96b0-703b1f3e8ebb | zaedulislam/Data-Structures | Binary Search Tree/Binary tree traversal (Preorder, Inorder, Postorder).cpp | // Binary tree traversal (Preorder, Inorder, Postorder).cpp
#include<iostream>
#include<cstdio>
using namespace std;
struct BSTNode
{
int data;
BSTNode *left, *right;
};
BSTNode *CreateNewNode(int data)
{
BSTNode *newNode = new BSTNode();
newNode->data = data;
newNode->left = NULL;
newNode->r... | ALGO | 0.999977 | 5.384629 |
da161427-e1d4-462c-b398-ba262990671a | marcosvcloures/maratona | UVA/10191.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int t = 0, qtd, max_val, max_ini, ini_h, ini_m, fim_h, fim_m, intervalos[10000], i;
char linha[260];
while (scanf(" %d ", &qtd) > 0) {
t++;
max_val = -1;
intervalos[0] = 600;
for (i = 0; i < qtd; i++) {
fgets(linha, 260, stdin);
sscanf(li... | ALGO | 0.996226 | 3.61468 |
15b4bc00-911d-42cd-897a-6b89e8e9745e | Effygal/fs-obj | Filelog-KV/client.cpp | /*
------------------------------------
Client.cpp
------------------------------------
Usage: ./client <type>
PUT <key> <value>
GET <key>
DEL <key>
------------------------------------
Performance evaluation under batched requests:
./client <num_gws> <trace_file>
Results are... | WEB | 0.88478 | 6.495879 |
3dd63385-6ff4-460e-ac2e-91317fa5eb93 | NewtonPP/MLIAP-RANN | src/EXTRA-PAIR/pair_gauss_cut.cpp | // clang-format off
/* ----------------------------------------------------------------------
Contributing authors: Arben Jusufi, Axel Kohlmeyer (Temple U.)
------------------------------------------------------------------------- */
#include "pair_gauss_cut.h"
#include <cmath>
#include "atom.h"
#include "comm.h"... | ALGO | 0.988881 | 6.23839 |
3f826200-7de9-458d-91de-16430c431a51 | Rahulnama08/LeetCode-Questions | 20-valid-parentheses/valid-parentheses.cpp | class Solution {
public:
bool isValid(string s) {
stack<char>st;
for(int i = 0; i < s.length(); i++){
char ch = s[i];
if(ch == '(' || ch == '{' || ch == '[') st.push(ch);
else {
if(!st.empty()){
if(ch == ')' && st.top() == '(' |... | ALGO | 0.999437 | 6.285763 |
90b0502a-14f4-4dcf-9bf3-6c689e412b82 | shauryagupta06/coding | graphs/is-connected-bfs.cpp | //We call funtion isConnectred function, and then BFSTraversal
//starting vertex = 0
//After returning from BFSTraversal, visited array must
//have all the vertices marked true which were a part of the
//connected component containing 0
//If any vertex left, it means it is not connected
//to 0, means there is a dis... | ALGO | 0.99998 | 5.151708 |
214e6ab8-e9ee-4af9-9dee-75b04fff3186 | nishatlea/Programming | Basic Concepts/String/check_palindrome.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int num, reverse_num=0, remainder,temp;
cin>>num;
temp=num;
while(temp!=0)
{
remainder=temp%10;
reverse_num=reverse_num*10+remainder;
temp/=10;
}
if(reverse_num==num)
printf("%d is a palindrome number",num);
el... | ALGO | 0.99988 | 4.275208 |
65ce830c-0e3f-4d3c-b3a8-ede316f67790 | Pratham754/leetcode | 695-max-area-of-island/max-area-of-island.cpp | class Solution {
public:
int dfs(vector<vector<int>>&a, int i, int j){
if(i<0 || j<0 || i>=a.size() || j>=a[0].size() || a[i][j]==0) return 0;
a[i][j] = 0;
int area = 1;
area += dfs(a,i-1,j);
area += dfs(a,i+1,j);
area += dfs(a,i,j-1);
area += dfs(a,i,j+1);... | ALGO | 0.999944 | 6.354435 |
6e403658-e99f-46ae-8370-dc4025a2d5cd | daltonsilverman/CS31-CS32 | Loose files/mazestack.cpp | //
// main.cpp
// Homework2
//
// Created by Dalton Silverman on 2/8/23.
//
#include <iostream>
#include <stack>
using namespace std;
class Coord
{
public:
Coord(int r, int c) : m_row(r), m_col(c) {}
int r() const { return m_row; }
int c() const { return m_col;... | ALGO | 0.902702 | 4.350491 |
9f82ed22-2bb4-4294-9cb7-259c765902b8 | alomerry/docs | others/algorithm/code/pat/a/1149/main.cpp | #include <iostream>
#include <map>
#include <string>
#include <vector>
using namespace std;
int n, m, tmp;
map<string, vector<string>> matrx;
vector<string> list;
int main()
{
std::ios::sync_with_stdio(false);
std::cin.tie(0);
string a, b;
cin >> n >> m;
for (int i = 0; i < n; i++)
{
cin... | ALGO | 0.999896 | 4.507804 |
4577d3e5-54cb-4dc0-ae25-7bacbc5bd1ab | vampcoder/Online-Programmes | SPOJ/onezero.cpp | #include<iostream>
#include<cstdio>
#include<cstring>
#include<queue>
#include<cstdlib>
using namespace std;
struct node{
char arr[2000];
int mod;
};
int main()
{
int t;
cin >> t;
while(t--){
int n;
int visited[200000] = {0};
cin >> n;
queue<node> q;
node temp1, temp2, temp;
strcpy(temp.arr, "1");
t... | ALGO | 0.99996 | 3.59162 |
f425ed00-5616-4511-bc25-53d1561cc587 | zzammz/MKcode | 1-Snippets/4-Algorithms/C_C++/tree.cpp |
#include <stdio.h>
#include <stdlib.h>
void pname(const char *msg)
{
printf("\n====== %s\n", msg);
}
//------------------- TREE
struct TREENODE
{
int t_data;
TREENODE *tptr_left, *tptr_right;
};
struct TREENODE *TreeNewNode(int new_val)
{
TREENODE *tmpptr = (TREENODE *) malloc (sizeof(TREENODE));
if (tmpptr)
... | ALGO | 0.991861 | 4.508166 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.