uuid stringlengths 36 36 | repo_name stringlengths 5 123 | relative_path stringlengths 5 4k | content stringlengths 33 2.85M | category stringclasses 6
values | algo_rel_score float64 0.85 1 | quality_score float64 3 8.76 |
|---|---|---|---|---|---|---|
d57fcc43-63c2-45ae-b27b-3f03948f9675 | klishevich/cpp-algorithms2 | adventofcode/2022_day05/2022_day05.cpp | // 2022_day05.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include <iostream>
#include <string>
#include <sstream>
#include <set>
#include <vector>
using namespace std;
string input();
vector<string> split(const string& str, const char& ch) {
string next;
vector... | ALGO | 0.999112 | 5.034922 |
e33f662e-c9f0-44f2-bcf8-0c0d4209abcb | vfolunin/archives-solutions | LeetCode/466.cpp | class Solution {
public:
int getMaxRepetitions(string &a, int an, string &b, int bn) {
vector<int> nextBi(an + 1);
vector<int> bCyclesInACycles(an + 1);
int bi = 0, bCycles = 0;
for (int aCycles = 1; aCycles <= an; aCycles++) {
for (int ai = 0; ai < a.size(); ai+... | ALGO | 0.99981 | 5.078658 |
cdc7ce64-d96d-4a97-bae5-f66aa7c7a394 | Sounne/UE_4.25_Totem | Engine/Source/ThirdParty/ICU/icu4c-64_1/source/layoutex/LXUtilities.cpp | #include "layout/LETypes.h"
#include "LXUtilities.h"
U_NAMESPACE_BEGIN
//
// Finds the high bit by binary searching
// through the bits in n.
//
le_int8 LXUtilities::highBit(le_int32 value)
{
if (value <= 0) {
return -32;
}
le_int8 bit = 0;
if (value >= 1 << 16) {
value >>= 16;
... | TOOL | 0.975851 | 5.889595 |
e6bf6ba6-0350-4217-88eb-799a49660250 | ishandutta2007/codeforces | sfiction/normal/583/E.cpp | #include <cstdio>
#include <algorithm>
using namespace std;
typedef long long ll;
const int MAXN = 2E5 + 10;
int n;
int a[MAXN], b[MAXN], c[MAXN];
int val[MAXN];
ll ans;
int gcd(int a, int b){
return b ? gcd(b, a % b) : a;
}
void work(int d){
for (int i = 0; i < d; ++i)
val[i] = a[i];
for (int i = d; i < n;... | ALGO | 0.999888 | 3.597886 |
0500e159-dbaa-438e-a5e3-15a7c6380624 | adityasingh10012007/leetcodeSol | 2873-maximum-value-of-an-ordered-triplet-i/2873-maximum-value-of-an-ordered-triplet-i.cpp |
// class Solution {
// public:
// long long maximumTripletValue(vector<int>& nums)
// {
// }
// };
// //
// // // // // // // Solve Using Three Method ===>
// // // // // // // Solve Using Three Method ===>
// //
// //
// /... | ALGO | 0.999986 | 5.538121 |
13000f60-958e-4b04-93ad-aee4b9cd041c | harshleet/leetsolution | 241-different-ways-to-add-parentheses/different-ways-to-add-parentheses.cpp | class Solution {
public:
vector<int> helper(string ex,int size){
if(ex.size()==0){
return {};
}
vector<int>res;
for(int i=0;i<ex.size();i++){
if(ex[i]=='+' || ex[i]=='-' || ex[i]=='*'){
vector<int>val1=helper(ex.substr(0,i),i);
... | ALGO | 0.999979 | 5.348732 |
b9028e20-8895-49b9-a428-56bd8a64a31a | rayhan50001/Code_Library | LightOj/loj-1076 - Get the Containers.cpp | //GREEDY BINARY SEARCH :P :) :D
#include<bits/stdc++.h>
using namespace std;
int arr[1000001];
int check(int ans,int k,int n)
{
int sum=0;
int c=1;
for(int i=0; i<n; i++)
{
sum+=arr[i];
if(sum>ans)
{
sum=arr[i];
c++;
}
}
return (c<=k);
}
i... | ALGO | 0.999965 | 3.791155 |
869e5ae1-978b-40bd-851c-dc7812e4050d | khusboobothra/DSA | STRINGS/Next Permutation.cpp | //Problem :
//Reference : https://www.youtube.com/watch?v=LuLCLgMElus
//Code :
vector<int> nextPermutation(int N, vector<int> arr){
// code here
int i,j;
for(i=arr.size()-1;i>0;i--)
{
if(arr[i]>arr[i-1])
break;
}
if(i==0)
{
sort(arr.begin(),arr.end());
... | ALGO | 0.999998 | 5.482138 |
ed56cef8-e2ee-4527-a5e7-374a5d494419 | bdhBDH/learngit | algorithm/leetcode_199_二叉树右视图.cpp | #include <iostream>
#include <vector>
#include <queue>
using namespace std;
/**
* 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(nu... | ALGO | 0.999938 | 6.45461 |
0ca64665-c38d-4993-a11d-c9cfe616ee1b | goffioul/android-frameworks-av | media/libstagefright/codecs/amrnb/enc/src/c8_31pf.cpp | /*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include "c8_31pf.h"
#include "typedef.h"
#include "cnst.h"
#include "inv_sqrt.h"
#include "cor_h.h"
#include "cor_h_x2.h"
#include "set_sign.h"
#inclu... | ALGO | 0.999957 | 4.394365 |
57ff55d4-3624-4219-9da5-df7864fff7d4 | FireShine1/Salt-and-Pepper | main.cpp | #include "utils.h"
#include <cstdlib>
#include <ctime>
void writeResultImage(BMP *result_image, int isCpu, float* data, int height, int width) {
for (int i = 0; i < height; i++) {
for (int j = 0; j < width; j++) {
RGBApixel pixel;
pixel.Red = data[i * width + j];
pixel.B... | ALGO | 0.992043 | 5.230101 |
d377bd0e-46b0-4439-9201-c002f3a46ffd | MaheshSharan/LeetCode_Automation | solutions/1400-1499/1434.Number of Ways to Wear Different Hats to Each Other/Solution.cpp | class Solution {
public:
int numberWays(vector<vector<int>>& hats) {
int n = hats.size();
int m = 0;
for (auto& h : hats) {
m = max(m, *max_element(h.begin(), h.end()));
}
vector<vector<int>> g(m + 1);
for (int i = 0; i < n; ++i) {
for (int& v ... | ALGO | 0.999989 | 6.004991 |
6d22a633-a29c-4e73-bdf2-f32dae28ad1a | Priyanka-Mondal/B-Tree-Path-ORAM | src/mitrap/OMAP.cpp | #include "OMAP.h"
using namespace std;
OMAP::OMAP(int maxSize, bytes<Key> key) {
treeHandler = new AVLTree(maxSize, key);
rootKey = 0;
}
OMAP::~OMAP() {
}
string OMAP::find(Bid key) {
if (rootKey == 0) {
return "";
}
treeHandler->startOperation();
Node* node = new Node();
node->k... | ALGO | 0.961294 | 3.950499 |
d16be28a-bfdf-4365-a72c-ec5c455dd6e3 | 0v0v0/CIS_461_HW5 | src/scene/materials/specularbtdf.cpp | #include "specularbTdf.h"
Color3f SpecularBTDF::f(const Vector3f &wo, const Vector3f &wi) const
{
return Color3f(0.f);
}
float SpecularBTDF::Pdf(const Vector3f &wo, const Vector3f &wi) const
{
return 0.f;
}
Color3f SpecularBTDF::Sample_f(const Vector3f &wo, Vector3f *wi, const Point2f &sample, Float *pdf, Bx... | ALGO | 0.926612 | 5.721004 |
04cb86b0-b9ee-42ac-84c5-4e7cf6c397ee | shuav/temp_copter | libraries/AP_Math/matrix3.cpp | #pragma GCC optimize("O3")
#include "AP_Math.h"
// create a rotation matrix given some euler angles
// this is based on http://gentlenav.googlecode.com/files/EulerAngles.pdf
template <typename T>
void Matrix3<T>::from_euler(float roll, float pitch, float yaw)
{
float cp = cosf(pitch);
float sp = sinf(pitch);
... | ALGO | 0.986312 | 6.560962 |
f14d9cf6-f5cf-41eb-9240-7a2ce8943c4e | Kandariarjun07/Leetcode | 3461-find-the-minimum-area-to-cover-all-ones-i/3461-find-the-minimum-area-to-cover-all-ones-i.cpp | class Solution {
public:
int minimumArea(vector<vector<int>>& grid) {
int row_min = INT_MAX, row_max = INT_MIN;
int col_min = INT_MAX , col_max = INT_MIN;
for(int i = 0; i<grid.size(); i++){
for(int j = 0; j<grid[0].size(); j++){
if(grid[i][j] == 1){
... | ALGO | 0.99983 | 6.378838 |
138478e4-673d-4f0c-88c5-c9bc203fbfe1 | alibaba/nann | blaze-benchmark/thirdparty/boost_1_53_0/libs/msm/doc/PDF/examples/iPodEuml.cpp | #include <vector>
#include <set>
#include <string>
#include <iostream>
// we need more than the default 20 states
#define FUSION_MAX_VECTOR_SIZE 20
// we need more than the default 20 transitions
#include "boost/mpl/vector/vector50.hpp"
#include <boost/msm/back/state_machine.hpp>
#include <boost/msm/front/euml/euml.hpp... | TOOL | 0.913095 | 5.742204 |
b96c66ec-6d83-4690-bfcf-e492501f24ba | p1kalys/Leetcode-DSA-Vault | sort-the-people/sort-the-people.cpp | class Solution {
public:
vector<string> sortPeople(vector<string>& names, vector<int>& heights) {
vector<pair<int,int>>pairs;
vector<string>ans;
for(int i=0;i<names.size(); i++){
pairs.push_back({heights[i],i});
}
sort(pairs.begin(),pairs.end(),greater<pair<int,in... | ALGO | 0.99999 | 6.286966 |
645cd130-1f6c-4943-9e1c-335949c22aec | vijaypurohit/OS-Scheduling-Algorithm | priority_sa_pm_vp.cpp | // C++ Program to demonstrate the working of Priority Based Scheduling Algorithm - Preemptive
// it consider the arrival time in and out order
// by Vijay Purohit
// working and tested on Dev-C++ 5.11
#include<stdio.h>
#include<iostream>
#include<cstdlib>
#include<cstdio>
using namespace std;
typedef struct process... | ALGO | 0.999985 | 4.591405 |
7a5ca606-0631-43ef-8885-90570a36fdc7 | raincross7/code-similarity | codes/train_code/problem252/problem252_286.cpp | #include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii v... | ALGO | 0.999732 | 3.412267 |
771d331d-46f7-4698-8d47-052d5d9cc844 | pp2110/My-Leetcode-Submissions | 872-leaf-similar-trees/872-leaf-similar-trees.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.999978 | 6.290175 |
792e0489-97ab-4dc1-bd4f-6ea3d0565a01 | neel-kumar/cpp | usaco/pails_silver.cpp | #include <iostream>
#include <cmath>
#include <bits/stdc++.h>
using namespace std;
int x, y, k, m, ans = 2000000000;
bool memo[200][200][200];
void solve(int pail1, int pail2, int steps) { if (memo[pail1][pail2][steps]) return; memo[pail1][pail2][steps] = true;
ans = min(ans, abs(m-pail1-pail2));
if (steps =... | ALGO | 0.999952 | 3.731175 |
3ddcbbf1-3478-45f4-a377-f5ceac6b8033 | doldam42/DoldamEngine | src/ModelExporter/GameUtils.cpp | #include "pch.h"
#include "GameUtils.h"
void GameUtils::s2ws(const char *inStr, wchar_t *outWStr)
{
int len = (int)strlen(inStr);
int size_needed = MultiByteToWideChar(CP_UTF8, 0, inStr, len, NULL, 0);
MultiByteToWideChar(CP_UTF8, 0, inStr, len, outWStr, size_needed + 1);
}
void GameUtils::ws2s(const wcha... | TOOL | 0.873636 | 4.769952 |
621e82f7-a0cb-43c1-a9ea-4e5b21c1f4be | shaunak56/competitve-programming | leetcode/max_consecutive_ones.cpp | #include<bits/stdc++.h>
using namespace std;
int findMaxConsecutiveOnes(vector<int>& nums) {
int ans = 0, curr = 0;
for (int i=0; i<nums.size(); i++) {
if (nums[i])
curr++;
else
curr = 0;
ans = max(ans, curr);
}
return ans;
}
int main() {
ios_base::... | ALGO | 0.999865 | 5.60903 |
88f8c26e-c481-4be7-b79d-641701657744 | Ahnho/Algorithm | Algorithm/kaprekar.cpp | #include <iostream>
using namespace std;
int kaprekar(int a[] );
void div(int n, int a[], int len);
int count ;
int main(){
int numTestCases;
cin >> numTestCases;
for(int i = 0 ; i < numTestCases ; i++){
int n;
int a[4];
int len = 4;
count = 0;
cin >> n ;
... | ALGO | 0.999062 | 3.983424 |
c91ee686-c682-4144-907d-7ffd6d6f26b1 | s310135/Esercitazione_2_OOP | esercitazione2/main.cpp | #include <iostream>
template<typename T> //T è un tipo di dato qualsiasi
class complex_number{ //sto definendo la nuova classe complex_number
private: //definisco le variabili di tipo T
T real;
T imaginary;
public: // tutto ciò che segue è accessibile dall'esterno della classe.
//cost... | ALGO | 0.97825 | 5.454589 |
7ed5f47b-c1f4-4382-9da6-95ecf24e85ca | ledinhchien3320/tindocdaicuong | 20181201/Cau109/Cau109.cpp | #include<iostream>
using namespace std;
int main() {
//viet chuong trinh in bang cuu chuong ra man hinh
for (int i = 1; i <= 10; i++) {
cout << "____\n";
for (int j = 1; j <= 10; j++) {
cout << i << " * " << j << " = " << i * j << endl;
}
}
system("pause");
return true;
} | ALGO | 0.952814 | 3.097002 |
c0a5bc8a-1528-45b5-b201-a2035f61d5b9 | ttser1085/ChessAI | ChessAI/ChessHandler.cpp | #include "ChessHandler.h"
bool color(Figure figure)
{
return (int)figure < 6;
}
uint8_t fscore(Figure figure)
{
switch (figure % 6)
{
case 0:
return 255;
case 1:
return 9;
case 2:
return 5;
case 3:
return 3;
case 4:
return 3;
case 5:
return 1;
}
}
char to_char(Figure figure)
{
switch (figure %... | ALGO | 0.87296 | 4.750443 |
a8f9b519-d9dd-4544-8fdc-4441cf059ddd | ZMoD-R/android_frameworks_av | media/libstagefright/ClockEstimator.cpp | //#define LOG_NDEBUG 0
#define LOG_TAG "ClockEstimator"
#include <utils/Log.h>
#include <math.h>
#include <media/stagefright/ClockEstimator.h>
#include <media/stagefright/foundation/ADebug.h>
namespace android {
WindowedLinearFitEstimator::WindowedLinearFitEstimator(
size_t headLength, double headFactor, si... | ALGO | 0.983101 | 5.892895 |
67da03a5-0dc5-4709-94a5-58afa3b22ad1 | DungNguyenCoder/SPOJ_PTIT | PTIT018B.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define faster() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define mx 1000000
#define mod 10000007
#define TEST 1
void solution()
{
int n;
cin >> n;
int a[n], b[n];
for(int i = 0; i < n; i++)
cin >> a[i];
for(... | ALGO | 0.999976 | 3.489375 |
b1c568f7-87cf-47c4-b39d-9b81f8ed934b | keerthana-1820/c- | Sum of n natural no's using FOR.cpp | #include <iostream>
using namespace std;
int main() {
int n, num, sum = 0;
cout << "Enter the value of n: ";
cin >> n;
cout << "Enter the numbers: ";
for (int i = 0; i < n; i++) {
cin >> num;
sum += num;
}
cout << "Sum: " << sum << endl;
return 0;
}
| ALGO | 0.99657 | 3.95552 |
1f666130-8251-4891-bc8d-c44ea83e58d2 | AbhishekPatil313/DSA-CPP1 | bitwise operators/bits.cpp | #include <iostream>
using namespace std;
//Write your countBits function here
int countBits(int n){
int sum=0;
while(n>0){
if(n&1){
sum+=1;
}
n=n>>1;
}
return sum;
}
int main() {
int n;
cin >> n;
cout<<countBits(n);
return 0;
} | ALGO | 0.999921 | 5.571835 |
92b66108-693b-4561-8dab-8c99dfdc9a10 | malay-chauhan/Tranining_malay | CPP/list_stl.cpp | #include <iostream>
#include <list>
using namespace std;
void display (list<int> &lst)
{
list<int> :: iterator it;
for (it=lst.begin(); it != lst.end(); it++);
{
cout<<*it<<endl;
}
}
int main ()
{
list<int> list1;
list1.push_back(5);
list1.push_back(7);
list1.push_back(12);
... | TOOL | 0.895464 | 3.578285 |
3fe51e08-4fa1-4c8a-ad0d-149aa31bc5e9 | vsaikiran234/leetcode | 0167-two-sum-ii-input-array-is-sorted/0167-two-sum-ii-input-array-is-sorted.cpp | class Solution { // class Solution {}
public: // public:
vector<int> twoSum(vector<int>& numbers, int target) {
int l = 0; // int l = 0;
int r = numbers.size() - 1; // int r = numbers.size() - 1;
while (numbers[l] + numbers[r] != target) // while (numbers[l] + numbers[r] != target)
if (numbers[l... | ALGO | 0.999279 | 5.933991 |
932b78c4-373d-4dff-bf19-6daa2cd99752 | azat-archive/qtcreator | src/libs/3rdparty/botan/src/block/des/des.cpp | #include <botan/des.h>
#include <botan/loadstor.h>
namespace Botan {
namespace {
/*
* DES Key Schedule
*/
void des_key_schedule(u32bit round_key[32], const byte key[8])
{
static const byte ROT[16] = { 1, 1, 2, 2, 2, 2, 2, 2,
1, 2, 2, 2, 2, 2, 2, 1 };
u32bit C = ((key[7] & 0... | ALGO | 0.983653 | 6.801373 |
88fc5790-465d-4622-bacf-90f8b3a87038 | postcode-x/NAMPluginSimplified | eigen/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_broadcast_simple.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
int main()
{
Eigen::MatrixXf mat(2,4);
Eigen::VectorXf v(2);
mat << 1, 2, 6, 9,
3, 1, 7, 2;
v << 0,
1;
//add v to each column of m
mat.colwise() += v;
std::cout << "Broadcasting result: " << std::endl;... | ALGO | 0.998486 | 4.147263 |
110d45e0-f081-44a9-9a9a-8c3823037417 | GoscZnickiem/uwr-anum | l1/z4.cpp | #include <cmath>
#include <cstddef>
#include <iostream>
using T = double;
template<std::size_t N>
constexpr T y = y<N-1> * 35 / 6 + y<N-2>;
template<>
constexpr T y<0> = 1;
template<>
constexpr T y<1> = -1.0 / 6;
template<std::size_t N>
void constexprloop() {
if constexpr(N > 0) {
constexprloop<N-1>();
std::c... | ALGO | 0.999244 | 4.190808 |
f96511fa-bf93-46ea-a265-082e69fe1ac2 | boostorg/math | test/test_mapairy_quan_nvrtc_double.cpp | #define BOOST_MATH_OVERFLOW_ERROR_POLICY ignore_error
#define BOOST_MATH_PROMOTE_DOUBLE_POLICY false
// Must be included first
#include <nvrtc.h>
#include <cuda.h>
#include <cuda_runtime.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <random>
#include <exception>
#include <boost/math/distributio... | ALGO | 0.887455 | 6.193911 |
6f5a5477-e42a-4014-be0a-6de2a49e7357 | Kawser-nerd/CLCDSA | Source Codes/CodeJamData/15/23/9.cpp | #include <bits/stdc++.h>
#define REP(a,b) for(int a=0; a<(b); ++a)
#define FWD(a,b,c) for(int a=(b); a<(c); ++a)
#define FWDS(a,b,c,d) for(int a=(b); a<(c); a+=d)
#define BCK(a,b,c) for(int a=(b); a>(c); --a)
#define ALL(a) (a).begin(), (a).end()
#define SIZE(a) ((int)(a).size())
#define VAR(x) #x ": " << x << " "
#def... | ALGO | 0.999539 | 3.615329 |
a2f60b8c-2dcc-4cef-81e2-1d5a1816860a | tsurumeso/AtCoder | abc/073/c.cpp | #include <bits/stdc++.h>
#include <algorithm>
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < n; i++)
#define vi vector<int>
#define vvi vector<vi>
using namespace std;
typedef long long ll;
int main() {
int N, ptr = 0, ans = 0;
cin >> N;
vi A(N, 0);
rep(i, N) cin >> A[i];
sort(all... | ALGO | 0.999937 | 4.193039 |
1be21ea8-2128-4ce3-b309-edddaac18190 | markverick/ioi-training | skgrader/plus_number_bak.cpp | #include<stdio.h>
#include<algorithm>
using namespace std;
int a,b;
int fk=0;
int c[200000],p[200000];
int prime[200000],factor[200000],nf=0,np=0;
int fx(int n)
{
int i,hi;
for(i=0;true;i++)
{
if(n%p[i]==0)
{
fx(n-p[i]);
}
}
}
int main()
{
int i,j,k,idx=0;
sc... | ALGO | 0.999908 | 3.008298 |
15fe9e33-2936-41bb-99da-61d2ca89b3ec | Twinparadox/AlgorithmProblem | Before_2023/Jungol/1809 - 탑.cpp | #include <iostream>
#include <stack>
using namespace std;
typedef struct _node
{
int height;
int idx;
}node;
int n, rec[500002];
node arr[500002];
int main(void)
{
cin >> n;
for (int i = 1; i <= n; i++)
{
cin >> arr[i].height;
arr[i].idx = i;
rec[i] = -1;
}
stack<node> s;
int cnt = 1, bot = 0;
for (in... | ALGO | 0.999994 | 4.063619 |
4c263302-83f3-4b21-9726-dcfa59cb276e | mahabub5090/CPP-Various-Online-Judge-Problem-Solving | week-2/B_All_Distinct.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 1e5;
int main()
{
int t;
cin >> t;
while (t--)
{
int n;
cin >> n;
int arr[n];
set<int> st;
map<int, int> mp;
for (int i = 0; i < n; i++)
{
cin >> arr[i];
st.insert(... | ALGO | 0.999574 | 5.05366 |
293e3af3-7303-4400-9150-d9eda68fda71 | HnpawsPham/CP-PROBLEMS | Codeforces/IVA_AND_PAV.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int t;
void build(int node, int st, int en, ll a[], ll tree[]){
if(st == en){
tree[node] = a[st];
return;
}
int mid = (st + en) / 2;
build(2 * node, st, mid, a, tree);
build(2 * node + 1, mid + 1, en, a, tree);
... | ALGO | 0.999931 | 5.201789 |
fd6404a4-a4fa-4e66-859f-f7a918b1ddae | sarvex/solution-cpp | 1055.shortest_way_to_form_string.cpp | class Solution {
public:
int shortestWay(string source, string target) {
int m = source.size(), n = target.size();
int ans = 0, j = 0;
while (j < n) {
int i = 0;
bool ok = false;
while (i < m and j < n) {
if (source[i] == target[j]) {
... | ALGO | 0.999994 | 5.950812 |
193b60a1-ad88-4293-bebd-7ab7fe1fe7a3 | koosaga/olympiad | ICPC/NAIPC/naipc16_h.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long lint;
typedef long double llf;
typedef pair<int, int> pi;
const int mod = 1e9 + 7;
vector<lint> v[305];
int n, m;
lint dp[100005];
void dnc(int s, int e, int ps, int pe, vector<lint> &prv, vector<lint> &cur, vector<lint> &cst){
if(s > e) return;
int m ... | ALGO | 0.999963 | 3.455804 |
7248b06b-807a-4c2d-9bfe-345495afcd7c | NishkarshRaj/CPP-Reference | Vectors/Modifiers/Assign.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
//Assign is an advanced push_back function which pushes back n iterations of same value at back
//vector.assign(number of times, value);
vector<int> arr;
int i;
arr.assign(2,8);
for(i=0;i<arr.size();i++)
{
cout<<arr[i]<<endl;
}
arr.assign(3,5);
for(i... | ALGO | 0.991899 | 3.358958 |
230f4892-869b-4b77-bec8-f003f9813c71 | mattxlee/bip32_cpp | src/ckd.cpp | #include "ckd.h"
namespace bip32 {
CKDPriv::CKDPriv(N256 k, N256 c)
: k_(std::move(k))
, c_(std::move(c))
{
}
P CKDPriv::operator[](uint32_t const& i) const
{
Bytes data;
if (i >= ((uint32_t)2^31)) {
data.push_back(0x00);
data = Connect(data, ser256(k_));
data = Connect(data, ... | TOOL | 0.952669 | 4.263043 |
0baa2ef8-7383-40ce-a921-2b81656dc474 | ytsaurus/ytsaurus-cpp-sdk | yt/yt/core/misc/linear_probe.cpp | #include "linear_probe.h"
#include <util/system/types.h>
#include <atomic>
namespace NYT {
////////////////////////////////////////////////////////////////////////////////
TLinearProbeHashTable::TLinearProbeHashTable(size_t maxElementCount)
: HashTable_(maxElementCount * HashTableExpansionParameter)
{ }
bool ... | ALGO | 0.875315 | 6.250897 |
31a87df3-c56a-463c-bbe1-0e6226c936aa | mustafabawani/Implementing-Least-Distance-Algorithm-for-Search-Engine | BinarySearchTree.cpp | #include <iostream>
#include <fstream>
#include "BinarySearchTree.h"
using namespace std;
BinarySearchTree::BinarySearchTree(){
root=NULL;
readFromFile();
}
void BinarySearchTree::insert(string word,string pos,string meaning){
TreeNode* new_node=new TreeNode(word,pos,meaning);
... | ALGO | 0.991695 | 3.540332 |
ce609dde-e533-4050-adc5-844261e450b5 | baixun2307/asd | solution/1100-1199/1128.Number of Equivalent Domino Pairs/Solution.cpp | class Solution {
public:
int numEquivDominoPairs(vector<vector<int>>& dominoes) {
int cnt[100]{};
int ans = 0;
for (auto& e : dominoes) {
int x = e[0] < e[1] ? e[0] * 10 + e[1] : e[1] * 10 + e[0];
ans += cnt[x]++;
}
return ans;
}
}; | ALGO | 0.999796 | 6.686335 |
6a581bc9-3932-4976-a4c6-8a639b362f0b | smiromania/teme-la-info | V54_S3_4.cpp | #include <iostream>
#include <fstream>
using namespace std;
ifstream f("date.in");
int main()
{
int n, v[100], i, j, k, num = 0, ok;
f >> n;
for (i = 0; i < n; i++)
f >> v[i];
for (i = 0; i < n; i++)
{
ok = 0;
for (j = 0; j < n; j++)
{
for (k = j + 1; k ... | ALGO | 0.999714 | 4.325316 |
8a48ee5f-f361-42ba-b861-dab88ea6abd4 | beathahahaha/LeetCode-Weekly | xiong/118.cpp | class Solution {
public:
vector<vector<int>> generate(int numRows) {
if(numRows == 0) return vector<vector<int>>{};
vector<int> first = {1};
if(numRows == 1) return vector<vector<int>>{first};
vector<int> sec = {1, 1};
if(numRows == 2) return vector<vector<int>>{first, sec}... | ALGO | 0.999987 | 5.674195 |
4e6fc10d-7814-4ea3-baba-221d716cbc36 | Sergio72111/lab_7 | boost/libs/graph/test/finish_edge_bug.cpp | // Author: Alex Lauser
// Output (Note that 'finish_edge' is never printed):
// The example graph:
// 0 --> 1 2
// 1 --> 2
// 2 --> 0
#include <boost/config.hpp>
#include <iostream>
#include <vector>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/graph_utility.hpp>
template < typename graph_t > stru... | ALGO | 0.992741 | 6.709805 |
2ec2fdd3-da94-4da6-bb51-379ddba0ece7 | lucasbazante/competitive-programming-learning | contest_abc293/c.cpp | #include <bits/stdc++.h>
#define foreach(e, comp) for (auto &e : comp)
#define forinc(i, a, b) for (int i{a}; i <= b; ++i)
#define forexc(i, a, b) for (int i{a}; i < b; ++i)
#define remax(a, b) (a) = max((a), (b))
#define remin(a, b) (a) = min((a), (b))
#define fi first
#define se second
#define pb push_back
#define n... | ALGO | 0.999737 | 4.741519 |
a0f33f74-013c-4f83-8456-f133dcbc3fe2 | SeekerNik/code | Cpp/SS/Operator_overloading.cpp | #include<bits/stdc++.h>
using namespace std;
class nik{
public :
int a;
nik(int x){
a=x;
}
// nik sum(nik c){
// nik temp(0);
// temp.a=a+c.a;
// return temp;
// }
nik operator +(nik c){
nik temp(0);
temp.a=a+c.a;
return temp;
}
... | ALGO | 0.995695 | 3.485214 |
3ccbcd0e-651a-4f96-b3f3-e913b47096c8 | ssatwik975/leetcode-solutions | solutions/1642-water-bottles/solution.cpp | const auto init = [](){
std::cin.tie(nullptr);
std::cout.tie(nullptr);
std::ios_base::sync_with_stdio(false);
return nullptr;
}();
class Solution {
public:
int numWaterBottles(int numBottles, int numExchange) {
int drunk = numBottles;
int empty = numBottles;
int f... | ALGO | 0.999872 | 4.604117 |
6ec3e0d9-ee5e-4123-8e6f-5b565aa6fcd9 | H2020-InFuse/cdff | Common/Core/liborbslam/modules/g2o/g2o/core/estimate_propagator.cpp | #include "estimate_propagator.h"
#include <queue>
#include <vector>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <fstream>
//#define DEBUG_ESTIMATE_PROPAGATOR
using namespace std;
namespace g2o {
# ifdef DEBUG_ESTIMATE_PROPAGATOR
struct FrontierLevelCmp {
bool operator()(EstimatePropa... | ALGO | 0.999919 | 5.590659 |
b6650bbb-c512-450d-9f88-dc1233824527 | paulz059/myprogram | C-paractise/schoolwork/mathpa/main.cpp |
#include"matgpaV4.cpp"
int main() {
placeCursor(screen,2,35);
cout << "數學練習程式" ;
while (true) {
srand(time(0)); //隨機數 函數
placeCursor(screen,5,35);
cout << "請選擇難度 (1: 初級, 2: 中級, 3: 高級): ";
cin >> difficulty;
randquestion (difficulty); // 產生問題
mathPractice( qusention );
showan... | TOOL | 0.867597 | 3.029769 |
52f08f69-ad66-4ae7-9f49-594b93e2e659 | manikantanallagatla/Miscellaneous-Files-of-CPP | Mathematical Algo/dayFromDate.cpp | /* A program to find day of a given date */
#include<stdio.h>
#include<bits/stdc++.h>
#include<math.h>
#define ll long long int
using namespace std;
string dayofweek(int d, int m, int y)
{
static int t[] = { 0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4 };
y -= m < 3;
int x = ( y + y/4 - y/100 + y/400 + t[m-1] + d) %... | ALGO | 0.999805 | 4.06305 |
2a464572-200e-4cdc-9a3d-13bfa9d2da30 | am-aakash/dsa | codeforces/1200+/1635C.cpp | #include <bits/stdc++.h>
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define REP(i,n) for (int i = 0; i < n; i++)
#define fr(i, a, b) for (ll i = a; i < b; i++)
#define all(v) v.begin(), v.end()
#define mod 1000000007
#define pb push_back
#define ff first
#define ss second
#define ii pair<int,int... | ALGO | 0.998488 | 3.835949 |
6b0f3073-206e-418e-9689-e7097cb31fe4 | ishandutta2007/codeforces | fishcathu/normal/1676/A.cpp | #include<bits/stdc++.h>
#define ls i<<1
#define rs i<<1|1
#define fi first
#define se second
#define min amin
#define max amax
#define pb push_back
using namespace std;
using ll=long long;
using pii=array<int,2>;
const int N=2E5+10;
const int inf=1E9;
template<typename T=int>T read(){T x;cin>>x;return x;}
template<type... | ALGO | 0.990756 | 3.380728 |
6dc86cdc-4a50-46ef-9830-cee16c7529c6 | riceroll/MylarFilmSimulator | lib/libigl/include/igl/ray_sphere_intersect.cpp | template <
typename Derivedo,
typename Derivedd,
typename Derivedc,
typename r_type,
typename t_type>
IGL_INLINE int igl::ray_sphere_intersect(
const Eigen::PlainObjectBase<Derivedo> & ao,
const Eigen::PlainObjectBase<Derivedd> & d,
const Eigen::PlainObjectBase<Derivedc> & ac,
r_type r,
t_type & ... | ALGO | 0.999025 | 6.828658 |
09b20c4f-ee4c-469e-8fd2-a22239f2c6d7 | Aosp-A11/frameworks_native | libs/vr/libbufferhubqueue/benchmarks/buffer_transport_benchmark.cpp | #include <android-base/logging.h>
#include <android/native_window.h>
#include <benchmark/benchmark.h>
#include <binder/IPCThreadState.h>
#include <binder/IServiceManager.h>
#include <dvr/dvr_api.h>
#include <gui/BufferItem.h>
#include <gui/BufferItemConsumer.h>
#include <gui/Surface.h>
#include <private/dvr/epoll_file_... | TEST | 0.909108 | 5.248497 |
e477dad2-85d6-4dfc-92e7-2edacab2f21d | Fahad16301139/medusa-enhanced | flex-flow/flexflow-train-8d82c91a8417f88c95389206752beb9741f93259/src/ops/arg_topk.cpp | #include "flexflow/ops/arg_topk.h"
#include "flexflow/utils/hip_helper.h"
#include <hip/hip_runtime.h>
namespace FlexFlow {
// declare Legion names
using Legion::coord_t;
enum class HeapType { kMinHeap, kMaxHeap };
enum class PreferIndices { kLower, kHigher };
template <typename T>
struct Entry {
int index;
T va... | ALGO | 0.998471 | 7.264279 |
08576e78-3fc7-40d6-9fae-17acabf3ae2a | pgupta11/HessianforML | cpp/thirdparty/eigen/unsupported/doc/examples/MatrixSquareRoot.cpp | #include <unsupported/Eigen/MatrixFunctions>
#include <iostream>
using namespace Eigen;
int main()
{
const double pi = std::acos(-1.0);
MatrixXd A(2,2);
A << cos(pi/3), -sin(pi/3),
sin(pi/3), cos(pi/3);
std::cout << "The matrix A is:\n" << A << "\n\n";
std::cout << "The matrix square root of A is:... | ALGO | 0.999405 | 3.9114 |
f9e475b2-7d45-45b2-89ce-dc01c1d9302a | Deepti675/Leet_Code | LinkedList/merge-two-sorted-lists.cpp | //https://leetcode.com/problems/merge-two-sorted-lists/
//inplace solution for merging two linked list
/**
* 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 ... | ALGO | 0.99995 | 5.798034 |
2b66763a-0f60-4b8a-ae6f-a6d7f62f05f4 | tlsgkdns/study | Greedy/13019_AtoB.cpp | #include <iostream>
using namespace std;
string A, B;
int cnt1[26], cnt2[26];
bool f = false;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
cin >> A;
cin >> B;
for (int i = 0; i < A.size(); i++) ++cnt1[A[i] - 'A'];
for (int i = 0; i < B.size(); i++) ++cnt2[B[i] - 'A'];
for (int... | ALGO | 0.999984 | 4.310269 |
f65464eb-3be7-43fb-8b4c-2bb08a5edcce | oMatheusValim/Graduacao | SSC0601 - Eng Comp 2025/Pré Prova 1/Jogo_das_velas.cpp | /*Em um jogo, há N velas inicialmente acesas. A cada rodada, o jogador escolhe um número inteiro K, que é divisor do número atual de velas acesas, e apaga exatamente K velas. O jogo continua até que não seja possível apagar velas (ou seja, só resta 1 vela).
Dado um número inicial de velas acesas, determine em quantas ... | ALGO | 0.999986 | 5.358021 |
75803124-80ac-4245-a665-2b4d4bf1ef26 | NickNojiri/test | workspace/lower div/cs150/ic/ic03a/C/Flipper.cpp | #include <string>
using std::string;
string STUDENT = "nnojiri"; // Add your Canvas login name
// Write your function here
string flipCase( const string& str){
string result;
for(char c : str ){
if(isupper(c)){
result += tolower(c);
}
else if(islower(c)){
resu... | ALGO | 0.979172 | 5.590151 |
489dd8b5-7f4c-40fc-8a06-d8412f5f62ed | pstglia/frameworks-av | media/libstagefright/codecs/amrnb/enc/src/c4_17pf.cpp | /*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include "c4_17pf.h"
#include "typedef.h"
#include "inv_sqrt.h"
#include "cnst.h"
#include "cor_h.h"
#include "set_sign.h"
#include "basic_op.h"
/*---... | ALGO | 0.999979 | 5.284888 |
f46b33f7-5ee4-4705-8254-5a66813f0c06 | Mohitgarg1111/100DaysOfLeetCode | day49.cpp | //530. Minimum Absolute Difference in BST
/**
* 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, Tr... | ALGO | 0.999715 | 5.130854 |
152abcd2-daeb-443d-b53c-fa6698bef2d8 | Hussam-Turjman/FLDServer | third_party/opencv/samples/cpp/flann_search_dataset.cpp | // flann_search_dataset.cpp
// Naive program to search a query picture in a dataset illustrating usage of FLANN
#include <iostream>
#include <vector>
#include "opencv2/core.hpp"
#include "opencv2/core/utils/filesystem.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/features2d.hpp"
#include "opencv2/flann.hpp"
u... | ALGO | 0.993758 | 5.985429 |
aac9d7e2-8b70-47f7-8692-356009a40dfa | bPavan16/my-aps-academia | amazon-analysis/Dijkstra_Algorithm.cpp | // Generic C++ implementation of Dijkstra's algorithm
#include <iostream>
#include <vector>
#include <queue>
#include <limits>
#include <algorithm>
class DijkstraAlgorithm {
private:
struct Edge {
int destination;
double weight;
Edge(int dest, double w) : destination(dest), weight(... | ALGO | 0.999994 | 7.15534 |
cb965ea6-e49e-4c01-a751-c798bd4c5004 | Raimal-Raja/CPP_Programming_Data-Structures_Algorithms | 03 - Nested Loops & Patterns/squarePatternNumber.cpp | # include <iostream>
using namespace std;
int main(){
int n = 4;
for(int i =1; i<=n; i++){
for(int j =1; j<=n; j++){
cout<<"*"<<" ";
}
cout<<endl;
}
return 0;
} | ALGO | 0.998396 | 3.525313 |
5e403f10-fa42-45e0-897b-a2893e58642c | wxl-98/OJ_Code | 37.cpp | /***********************************************************
* &Author: Wang Xianling
* &E-mail: <EMAIL>
* &Motto: Believe in yourself.
* &File Name: 37.cpp
* &Created Time: 2019年12月06日 星期五 19时49分30秒
* &Description:
***********************************************************/
#i... | ALGO | 0.999831 | 3.603328 |
6e37710e-7bad-4547-96d7-dad4500f34ef | RIzmaylov/C_plus_plus_Specialization | White_Belt/1.Introduction/1.5.1_min_string.cpp | #include <iostream>
using namespace std;
int main()
{
string a, b, c;
cin >> a >> b >> c;
string minstr;
a < b ? minstr = a : minstr = b;
cout << (minstr < c ? minstr : c);
return 0;
}
| ALGO | 0.999696 | 4.038093 |
ef1e8331-0f7e-4273-b0ab-95b6ed82a33d | ishandutta2007/codeforces | vercingetorix/normal/1220/C.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <ctype.h>
#include <deque>
#include <cstring>
#include <set>
#include <bitset>
#include <map>
#include <chrono>
#include <random>
#include <unordered_map>
#include <stdio.h>
using namespace std;
typedef long long ll;
typedef long do... | ALGO | 0.999878 | 3.502136 |
8761ce97-7075-4107-97a3-641c97c9ca05 | samikshasadana/data_structures | stackassignment/ques3.cpp | #include<bits/stdc++.h>
using namespace std;
#define MAX 6
int Stack[MAX];
int top = -1;
void push(int x);
void pop();
void display();
int main ()
{
int choice, val;
choice = -1;
while(choice !=4)
{
//cout<<"Choice";
cin >> choice;
switch(choice)
{
case 1... | ALGO | 0.997577 | 4.05061 |
58a435ee-7a64-45f4-b09d-d39bfa5da974 | MishkatIT/codeforces-atcoder-submissions | others/Replay of Ostad Presents Intra KUET Programming Contest 2023/M. Banana Monitor.cpp | /*
author : MishkatIT
created : Tuesday 2023-10-10-22.35.45
*/
#include<bits/stdc++.h>
#define fio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define debug(_) cout << #_ << " is " << _ << '\n';
using namespace std;
using ll = long long;
using ld = long double;
const ll mod = 1e9 ... | ALGO | 0.999632 | 4.086956 |
17ee6824-8a84-41a5-9326-5fb136314465 | halder057/UVA-Solutions | 136/main.cpp | #include<stdio.h>
#define min(a,b) (a<b? a:b)
int main()
{
int a,b,c,n;
long ugly[1502],x,y,z;
ugly[1]=a=b=c=n=1;
while(n!=1500)
{
x=2*ugly[a];
y=3*ugly[b];
z=5*ugly[c];
ugly[++n]=min(x,min(y,z));
if(ugly[n]==x)a++;
if(ugly[n]==y)b++;... | ALGO | 0.99997 | 3.654132 |
4d83f623-3a75-4827-8864-695c07ce05aa | AdityaSharmaHub/100DaysOfCode | Day 19/kadaneAlgorithm.cpp | #include<iostream>
using namespace std;
class Solution{
public:
// arr: input array
// n: size of array
//Function to find the sum of contiguous subarray with maximum sum.
long long maxSubarraySum(int arr[], int n){
// Your code here
long long maxi = INT_MIN, prefix = 0;
... | ALGO | 0.999965 | 5.534967 |
fd8d158c-0cf7-4bb5-9355-335843f7c9f0 | rakeshmeena5499/leetcode | distribute-coins-in-binary-tree.cpp | class Solution {
public:
int ans;
int solve(TreeNode* root){
if(root==NULL)
return 0;
int left = solve(root->left);
int right = solve(root->right);
ans += abs(left) + abs(right);
return root->val + left + right - 1;
}
int distributeCoins(TreeNode* roo... | ALGO | 0.999984 | 6.188813 |
ffa8d955-d671-47c7-bf1f-199d22aaaf53 | tesseract-ocr/tesseract | src/ccmain/tfacepp.cpp | #include <cmath>
#include "blamer.h"
#include "errcode.h"
#include "ratngs.h"
#include "reject.h"
#include "tesseractclass.h"
#include "werd.h"
#define MAX_UNDIVIDED_LENGTH 24
/**********************************************************************
* recog_word
*
* Convert the word to tess form and pass it to the ... | ALGO | 0.883002 | 6.839953 |
6de7ad7a-5b74-4682-8149-9543bf67aeef | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_7467_19.cpp | #include <bits/stdc++.h>
using namespace std;
int a[200001];
int b[600001];
int n, L;
bool chk(int d) {
if (d * 2 >= L) return true;
int l = 0, r = 3 * n - 1;
while (b[l] < a[0] - d) l++;
while (b[r] > a[0] + d) r--;
for (int i = 1; i < n; i++) {
l++;
r++;
while (b[l] < a[i] - d) l++;
while (b... | ALGO | 0.999965 | 3.613185 |
e231cf8a-02a0-4976-9f09-ca5060ce1c04 | LAUCHINREN/ANALYSING-FINANCIAL-TRANSACTIONS-FOR-FRAUD-DETECTION- | Data sturcture project/main.cpp | // FraudDetectionCollections.cpp
// Implements array-based and linked-list-based collections for financial transactions
// Supports sorting by location, searching by transaction type, filtering by payment channel,
// JSON export using nlohmann/json, and performance comparison.
#include <iostream>
#include <fstream>
#i... | TOOL | 0.958642 | 7.38002 |
651cfc60-1a18-4d51-bdbc-8e8c5733d74c | sirsahil2003/DataStructure_Using_Cpp | Misc/MatrixMul.cpp | #include <iostream>
using namespace std;
int main(){
int arr1[2][2] ={1,2,3,4};
int arr2[2][2] ={1,2,3,4};
int arr3[2][2];
int sum=0;
int i,j;
for(i=0;i<=1;i++){
int z=0; sum=0;
for(j=0;j<=1;j++){
int x=arr1[i][j];
int y=arr2[j][i];
int z=z+x*y;
sum=sum+z;
arr3[i][j]=z;
... | ALGO | 0.999798 | 3.333134 |
3b016b1b-e0e4-445f-8301-61b0b147a8ed | macrobomastercontrolteam/Infantry_WheeledBiped | eigen-3.4.0/unsupported/doc/examples/PolynomialSolver1.cpp | #include <unsupported/Eigen/Polynomials>
#include <vector>
#include <iostream>
using namespace Eigen;
using namespace std;
int main()
{
typedef Matrix<double,5,1> Vector5d;
Vector5d roots = Vector5d::Random();
cout << "Roots: " << roots.transpose() << endl;
Eigen::Matrix<double,6,1> polynomial;
roots_to_mo... | TEST | 0.998832 | 4.668283 |
702d9870-d785-4c1e-b6e5-87361e77c29e | mdrasheduzzamanakash/DSA | Leetcode/dynamic-programming/673-Number-of-Longest-Increasing-Subsequence.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution {
public:
int findNumberOfLIS(vector<int>& nums) {
int n = nums.size();
vector<int> cnt(n, 1), len(n, 1);
int max_len = 0, res = 0;
// code
for(int i = 0; i < n; i++) {
for(int j = 0;j < i; j++) {
... | ALGO | 0.999995 | 5.951288 |
f8eb16e2-f721-442d-b62c-2199c027a01b | gabkidner/CS_2130Programs | Program1/Program1.cpp | #include <iostream>
int main(){
using namespace std;
string setA = "{1,3,5,6,8}", setB = "{2,3,4,7,9}", AuB = "{", AnB = "{",
AminusB = "{", anb = " ";
char chaA, chaB;
int index1 = 0;
for (int i = 0; i < setB.length(); i++) {
chaA = setA[i];
chaB = setB[i];
if (isdigit(chaA) || isdigit(c... | ALGO | 0.995587 | 4.218803 |
9313cd2e-3d10-4c97-94a1-ba4f849aed9b | insubkim/Problem_Solving | Programmers/Lv1/체육복.cpp | #include <string>
#include <vector>
#include <algorithm>
using namespace std;
int solution(int n, vector<int> lost, vector<int> r) {
sort(r.begin(), r.end());
vector<int> s(n, 1);
for (int i = 0; i < (int)lost.size(); i++){
s[lost[i] - 1] = 0;
n--;
}
for (int i = 0; i < (int)r.size... | ALGO | 0.999819 | 4.390974 |
b57cc8a4-9ba3-45e2-822a-e0712e113821 | Malav5372/Py2CppDSA | C++/Data Structure/Trees/LevelOrderTraversal.cpp | /*
Level order traversal of a binary search Tree
This is an algorithm to traverse through a binary search tree level by level
Time complexity for level order traversal: O(N) where N is the number of nodes in the tree
*/
#include<bits/stdc++.h>
using namespace std;
//implementation of binary Tree - very minima... | ALGO | 0.999995 | 5.691351 |
290c28a2-5c65-41b9-bfd6-b9b4957628ba | svn2github/FDM | YouTubeParser/SignatureDeciphering.cpp | #include "StdAfx.h"
#include "SignatureDeciphering.h"
#include <sstream>
#include <boost/algorithm/string.hpp>
#include <regex>
SignatureDeciphering::SignatureDeciphering( std::shared_ptr<ValuesProviderBase<SignatureDecipheringAlgorithm> > algorithmProvider ){
_algorithmProvider = algorithmProvider;
fillDecipheringA... | ALGO | 0.950653 | 5.302156 |
a66e4467-e46c-427e-8ef5-111c901ad59d | NIKITA320495/cpp-codes | DSA/dsa practice/stringtoll.cpp | #include <iostream>
#include <string>
using namespace std;
struct node {
int info;
node* next;
};
node* start = nullptr;
node* parse(string s) {
node* temp = nullptr; // Temporarily store the last node
node* originalStart = nullptr; // Keep track of the original start
for (int i = 0; i < s.leng... | ALGO | 0.997579 | 4.801312 |
45034882-b550-464d-bcb0-6bae942a316d | megaman14263/zadanie3 | te/te.cpp | #include <iostream>
using namespace std;
int main()
{
//Инициализируем переменные
int K, sum = 0;
int a, b, c;
cin >> K;
a = 1;
b = 1;
while (K > 0)
{
K--;
c = a + b;
cout << a << " ";
sum += a;
a = b;
b = c;
}
cout << "\n" << sum... | ALGO | 0.999969 | 3.715923 |
30e8ff6f-43c5-4af9-91ae-86a0cd7fef0d | dibyatanoy/Competitive_Programming | Piece_of_cake.cpp | #include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <utility>
#include <map>
#include <set>
#define pb push_back
#define CLR(x) memset(x,0,sizeof(x))
#define all(v) v.begin(),v.end()
#define MP make... | ALGO | 0.999987 | 3.878992 |
e7da1f86-fc00-4eef-b844-50b8e4e4ccc5 | owoshch/Cracking_the_coding_interview_5 | chapter_1_arrays_and_strings/1_1_editorial.cpp | /*
Implement an algorithm to determine if a string has all unique characters.
What if you cannot use additional data structures?
Useful links:
http://www.geeksforgeeks.org/determine-string-unique-characters/
https://www.youtube.com/watch?v=aijR_Jhh3JI
*/
#include <iostream>
#include <string>
// O(n) time, O(1) spac... | ALGO | 0.994629 | 6.694763 |
c52a1144-ce37-4525-b378-0e5a76b9601f | openjdk/lilliput-jdk21u | src/hotspot/share/opto/reg_split.cpp | #include "precompiled.hpp"
#include "libadt/vectset.hpp"
#include "memory/allocation.inline.hpp"
#include "memory/resourceArea.inline.hpp"
#include "opto/addnode.hpp"
#include "opto/c2compiler.hpp"
#include "opto/callnode.hpp"
#include "opto/cfgnode.hpp"
#include "opto/chaitin.hpp"
#include "opto/loopnode.hpp"
#include... | ALGO | 0.992636 | 7.251251 |
42f6816c-0bee-4282-ac68-b0dc79198fec | Bigpunishah/Advanced-CPP-class | myArray/myArray.cpp | #include "myArray.h"
#include <iostream>
//Initialize the dynamic value to nullptr
myArray::myArray(){
array = nullptr;
arraySize = 0;
index = 0;
}
myArray::myArray(int size){
if(size <= 0){
std::cout<<"Size not valid."<<std::endl;
return;
}
//We need to delete the current ver... | TOOL | 0.870235 | 3.749213 |
e09c1e52-e1bb-496b-8d30-8a15fe0ab150 | alexandraback/datacollection | solutions_1484496_0/C++/seanwu/c.cpp | #include <stdio.h>
int c[1000];
int a[100];
int b[100];
int dfs(int d,int s1,int s2,int n,int m){
if(d==20){
if(s1==s2 && n>0 && m>0){
for(int i=0; i<n;i++){
if(i) printf(" ");
printf("%d",a[i]);
}
puts("");
for(int i=0; i<m;i... | ALGO | 0.99946 | 3.308342 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.