uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
0405ed44-ce1d-450c-9f73-8b9997ffe435 | prateek27/algo-9june-2019 | Lecture -09 BST, Heaps/bst_new.cpp | #include<iostream>
#include<cmath>
#include<vector>
#include<queue>
using namespace std;
class Node{
public:
int data;
Node*left;
Node*right;
Node(int d){
data = d;
left = NULL;
right = NULL;
}
};
void levelOrderBFS(Node*root){
queue<Node*> q;
q.push(root);
q.push(NULL);
while(!q.empty()){
Node*... | ALGO | 0.999995 | 4.330354 |
4db5ecc7-539a-4e24-92bf-1f168d98d1e3 | sarvex/leetcode-assembly | solution/1700-1799/1702.Maximum Binary String After Change/Solution.cpp | class Solution {
public:
string maximumBinaryString(string binary) {
int k = binary.find('0');
if (k == binary.npos) return binary;
int n = binary.size();
for (int i = k + 1; i < n; ++i) {
if (binary[i] == '0') {
++k;
}
}
return... | ALGO | 0.99999 | 6.47259 |
ec5876df-eece-4010-ab0b-29a75e23e665 | aestesis/Csimd | Sources/simdlib/SimdVsxNeural.cpp | #include "Simd/SimdMemory.h"
#include "Simd/SimdStore.h"
#include "Simd/SimdExtract.h"
#include "Simd/SimdSet.h"
namespace Simd
{
#ifdef SIMD_VSX_ENABLE
namespace Vsx
{
template <bool inversion> v128_u8 Invert(v128_u8 value);
template <> v128_u8 Invert<true>(v128_u8 value)
{
return vec_sub(K8_FF, v... | ALGO | 0.973078 | 5.845043 |
5a2286f8-b079-494a-8888-826d7eab0c4b | Project-Xtended/external_ComputeLibrary | src/runtime/NEON/functions/NEAbsoluteDifference.cpp | #include "arm_compute/runtime/NEON/functions/NEAbsoluteDifference.h"
#include "src/core/NEON/kernels/NEAbsoluteDifferenceKernel.h"
#include "support/MemorySupport.h"
#include <utility>
namespace arm_compute
{
NEAbsoluteDifference::~NEAbsoluteDifference() = default;
void NEAbsoluteDifference::configure(const ITensor... | TOOL | 0.933025 | 6.045387 |
79d4c6df-ec0e-48fc-b9de-b4d002ce030a | Priyanshu-Pandat/leetcode_-problems-by-me | Perfect Numbers - GFG/perfect-numbers.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
int isPerfectNumber(long long N) {
// code here
long long sum = 1 ;
if(N==1) return 0;
for(long long i = 2 ; i*i <= N; i++) {
if(N%i == 0) {
... | ALGO | 0.999836 | 5.846405 |
532164d9-5bbb-4744-838f-6a941c40a236 | avijitgupta/contrail-avrotest | boost_1_49_0/libs/thread/example/monitor.cpp | #include <vector>
#include <iostream>
#include <boost/thread/condition.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/thread/recursive_mutex.hpp>
#include <boost/thread/thread.hpp>
namespace {
const int ITERS = 100;
boost::mutex io_mutex;
} // namespace
template <typename M>
class buffer_t
{
public:
typed... | TEST | 0.888961 | 6.072437 |
9c2f76c2-077a-460f-9f72-f88da86ef75a | MarwanMoh11/Assignment_6_goneid | main.cpp | #include <iostream>
#include "Graphs.h"
using namespace std;
int main() {
Graphs x;
x.getGraph("LISTS.txt");
cout << "Number of Vertices: " << x.No_of_Verices() << endl;
cout << "Number of Edges: " << x.No_of_Edges() << endl;
x.dispGraph();
x.dispEdges();
cout << "DFS TRAVERSAL: " << end... | ALGO | 0.885157 | 3.890028 |
eb36500e-f07e-4426-bc7d-c608b48d0c5b | Subrat29/CrackYourPlacement | Day33/403. Frog Jump/recursive.cpp | #include <bits/stdc++.h>
using namespace std;
// sc: 3^n
// tc: n
bool solve(vector<int> &stones, int current_stone_index, int prevStone, unordered_map<int, int> &mp)
{
// base case
if (current_stone_index == stones.size() - 1)
return true;
for (int i = -1; i <= 1; i++)
{
int nextJump... | ALGO | 0.999794 | 4.971817 |
3332b64c-6e44-49b6-aa8f-20b4b74a5152 | Arkavidia-CP/arkavidia-cp-problemset | 2022/arkavidia-2022-qual-crewmate-dan-impostor/spec.cpp | #include <tcframe/spec.hpp>
#include<bits/stdc++.h>
using namespace tcframe;
using namespace std;
#define MAXN 1e5
#define sz(x) (int)(x).size()
class ProblemSpec: public BaseProblemSpec {
protected:
int n;
vector<int> t;
int ans;
void InputFormat() {
LINE(n);
LINE(t);
}
void ... | ALGO | 0.999564 | 4.751832 |
1372ae2c-7f1c-4941-85bc-618c67a55ee8 | Sianuga/OutlierApp | outlier/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.998388 | 6.785645 |
bff8185d-8f5f-4cda-a83f-264d15455966 | Xiaohao-Xu/SLAM-under-Perturbation | benchmark/GO-SLAM/thirdparty/lietorch/eigen/lapack/cholesky.cpp | #include "lapack_common.h"
#include <Eigen/Cholesky>
// POTRF computes the Cholesky factorization of a real symmetric positive definite matrix A.
EIGEN_LAPACK_FUNC(potrf,(char* uplo, int *n, RealScalar *pa, int *lda, int *info))
{
*info = 0;
if(UPLO(*uplo)==INVALID) *info = -1;
else if(*n<0) ... | ALGO | 0.997999 | 6.004565 |
dd40d99f-3bec-4c7b-b95c-7c908941277b | vintagetechfan/mame | 3rdparty/bgfx/3rdparty/glslang/SPIRV/InReadableOrder.cpp | // The SPIR-V spec requires code blocks to appear in an order satisfying the
// dominator-tree direction (ie, dominator before the dominated). This is,
// actually, easy to achieve: any pre-order CFG traversal algorithm will do it.
// Because such algorithms visit a block only after traversing some path to it
// from ... | ALGO | 0.999337 | 7.709106 |
6bdd9cd2-a165-442a-8ca5-dbb7296afa42 | ishandutta2007/codeforces | lyc_music/normal/1450/C1.cpp | //QwQcOrZ yyds!!!
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include... | ALGO | 0.999624 | 4.875262 |
7642518a-6b1e-477d-890b-9a2f7ce37ca8 | RicciWoo/CodePractice | 09_BFS_Tree/Zigzag_Traversal-1.cpp | #include <list>
#include <queue>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
// Balanced Binary Tree, Recursion, 20180818
// Definition for a binary tree node.
struct TreeNode {
int val;
TreeNode *left;
TreeNode *right;
TreeNode(int x) : val(x), left(NULL), right(NUL... | ALGO | 0.999975 | 5.972028 |
ec81bda3-c435-47f0-a3c9-f194785ca786 | AlfonsoEsteves/MapProject | VSProject/Map/Map.cpp | #include "Common.h"
void execute_frame()
{
for (std::list<Object*>::iterator it = objects[time % BUCKETS].begin(); it != objects[time % BUCKETS].end(); it++) {
Object* object = *it;
# ifdef DEBUG
lastExecutedObject = object->id;
if (object->id == DEBUG_OBJECT) {
if (object->type() == objectUnit) {
Unit*... | ALGO | 0.903264 | 3.787472 |
0ac2687d-d297-47cb-a0e4-54e3d62010a0 | Anup-A-K/Hackerrank | cpp/Apple_and_Orange.cpp | #include <bits/stdc++.h>
using namespace std;
string ltrim(const string &);
string rtrim(const string &);
vector<string> split(const string &);
/*
* Complete the 'countApplesAndOranges' function below.
*
* The function accepts following parameters:
* 1. INTEGER s
* 2. INTEGER t
* 3. INTEGER a
* 4. INTEGER... | ALGO | 0.999458 | 5.145414 |
f9b6df45-912f-4424-a481-28137ce790e8 | Joshua-Terriquez/CSE100 | Lab03/MaxSubArray.cpp | #include<stdio.h>
#include<iostream>
#include<limits.h>
using namespace std;
//References:
// - https://www.geeksforgeeks.org/maximum-subarray-sum-using-divide-and-conquer-algorithm/#:~:text=The%20idea%20is%20simple%2C%20find%20the%20maximum%20sum,maximum%20among%20left%2C%20right%20and%20combination%20of%20both.
// -... | ALGO | 0.999876 | 5.399942 |
831febe4-84eb-4420-a7bc-62bf2fb8b478 | KU-ALPS-15/Algorithm-Practice_kihyun | alps/alps/괄호.cpp | #include <iostream>
#include <string>
using namespace std;
class Stack {
private:
int point=0;
char box[51];
bool TOF=true;
public:
void init() {
point = 0;
TOF = true;
}
void add(char ch) {
box[point++]=ch;
}
void pop() {
if (point > 0)
point--;
else
TOF = false;
}
bool isEmpty() {
return ... | ALGO | 0.999966 | 4.226083 |
112f00be-6e1f-4400-a67b-f35bb6506731 | sarvex/leetcode-elm | lcof2/剑指 Offer II 112. 最长递增路径/Solution.cpp | class Solution {
public:
vector<vector<int>> memo;
vector<vector<int>> matrix;
int m;
int n;
int longestIncreasingPath(vector<vector<int>>& matrix) {
m = matrix.size();
n = matrix[0].size();
memo.resize(m, vector<int>(n, -1));
this->matrix = matrix;
int ans =... | ALGO | 0.99999 | 6.069603 |
54241dcc-6882-49af-94db-2f7ecb97db47 | SindhukPillai/DataScience | CelebrityFaceRecognition/model/opencv/haarcascades_bk/opencv-master/samples/cpp/letter_recog.cpp | #include "opencv2/core.hpp"
#include "opencv2/ml.hpp"
#include <cstdio>
#include <vector>
#include <iostream>
using namespace std;
using namespace cv;
using namespace cv::ml;
static void help(char** argv)
{
printf("\nThe sample demonstrates how to train Random Trees classifier\n"
"(or Boosting classifier, or... | DATA | 0.870705 | 5.59586 |
86b1949a-6c46-4e4c-9294-72af18523416 | alishbaaramzan/DataStructuresandAlgorithms | SizeOfDoublyLinkedList.cpp | #include<iostream>
using namespace std;
class Node{
public:
int data;
Node* prev;
Node* next;
};
class DoublyLinkedList{
Node* head;
public:
DoublyLinkedList(){
head = NULL;
}
void addNode(int data){
Node* ptr = new Node();
... | ALGO | 0.999945 | 5.366765 |
74caa341-ff23-4653-981f-bdf4a7bc8bc7 | prableen14/DSA-own-practice- | Foundation/Dynamic Programming/Arrange Buildings.cpp | /*
1. You are given a number n, which represents the length of a road. The road has n plots on it's each side.
2. The road is to be so planned that there should not be consecutive buildings on either side of the road.
3. You are required to find and print the number of ways in which the buildings can be built on both s... | ALGO | 0.999996 | 5.091268 |
8fc5dbf8-758c-4236-87a0-7814e53e3ea5 | pico2/Arianrhod | Source/sources/upx/src_mod/filter.cpp | #include "conf.h"
#include "filter.h"
#include "file.h"
/*************************************************************************
// util
**************************************************************************/
static //inline
void initFilter(Filter *f, upx_byte *buf, unsigned buf_len)
{
f->buf = buf;
f->... | TOOL | 0.900874 | 5.471915 |
4b90faab-1c4d-40ee-862b-d8ce0fc2a86e | H-Shen/MyCodeCollection | 校招Collection/Others/网页浏览历史.cpp | // https://www.nowcoder.com/practice/588d31d72721414584679ad7d32a6a93
#include <bits/stdc++.h>
using namespace std;
const int maxn = 200;
int main() {
int n, pos;
string tempStr;
while (~scanf("%d", &n)) {
vector<string> webList;
pos = 0;
while (n--) {
char a[max... | ALGO | 0.999785 | 4.180536 |
63504476-1621-4036-b51f-8dd6a5a95bd3 | ShucunZhao/Leetcode | C++/07String/jz058LeftRotateString/solwithReverse.cpp | class Solution {
public:
string LeftRotateString(string str, int n) {
if(str.size()==0){//Key point1: Because the len of str can be 0,
//So if meet this condition return empty directly.
return "";
}
while(n>str.size()){//Key point2: The size of given N can... | ALGO | 0.999985 | 6.56644 |
5f6ba771-3519-4cf5-b57c-d826b88b4418 | janani271/CP-solutions-1 | 1234b2.cpp | #include<bits/stdc++.h>
using namespace std;
queue<long long>q;
stack<long long>s;
long long n , k , i , id[200009] , r;
map<long long,long long>p;
int main()
{
cin>>n>>k;
for(i=0;i<n;i++)
{
cin>>id[i];
}
//processing
for(i=0;i<n;i++)
{
if(p[id[i]]==0)
{
if(q.size()==k)
{
r = q.front();
q.po... | ALGO | 0.999992 | 3.832804 |
5fa80596-f66d-481e-ba8d-2a4ce6939fbb | 48cfu/Udacity-Real-Self-Driving-Car-Carla | ros/src/waypoint_follower/src/pure_pursuit_core.cpp | #include "ros/ros.h"
#include "pure_pursuit_core.h"
namespace waypoint_follower
{
void PurePursuit::callbackFromCurrentPose(const geometry_msgs::PoseStampedConstPtr &msg)
{
current_pose_.header = msg->header;
current_pose_.pose = msg->pose;
pose_set_ = true;
}//processing frequency
void PurePursuit::callbackFr... | ALGO | 0.995694 | 4.605611 |
1a28c771-a9b8-43db-b246-bfb07a9215da | daiyonglin/code_learning | 24251lab1/double_LinkList.cpp | #include<bits/stdc++.h>
#include<iostream>
using namespace std;
#define MAXSIZE 50
//双链表结点结构体
typedef struct DNode{
int data; //数据域
DNode* pre; //前驱指针
DNode* next; //后继指针
}*DLinkList; //定义双链表
//双链表初始化
bool InitList(DLinkList& L){
L = new DNode;
if(!L){
cout<<"申请失败!"<<endl;
return ... | ALGO | 0.999757 | 3.500382 |
614ffdcb-9420-435b-b683-dfe53b584a3d | armankhalid/iphone_simulator | 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 |
cdbc5bbb-a1e0-4542-a6ef-b840dc0fd1a9 | codetatvaacademy/GU-Technical-Training-2026 | Kanishk-Tyagi/Basic-questions/Problem19.cpp | // WAP to take input income from the user and calculate the amount of tax to be paid as per rules.
#include<bits/stdc++.h>
using namespace std;
class solution{
public:
double calculateTax(int income){
if(income<=10000){
return 0;
}
else if(income>10000 && income<=25000){
... | ALGO | 0.999283 | 4.000956 |
7e0d9657-2226-437c-a370-d619a47b7d0c | leonldy/Calabash | 牛客网暑期ACM多校训练营(第九场)/F.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for(int i=(a);i<(n);++i)
int ch[1<<18][26], fail[1<<18], val[1<<18];
int sz, rt;
int newnode() {
memset(ch[sz], -1, sizeof(ch[sz])), val[sz] = 0;
return sz++;
}
struct KMP{
static const int maxn = 1e5+100;
int nxt[maxn];
int len;
v... | ALGO | 0.999928 | 3.792305 |
0cbaf133-ac5f-4536-b95f-4db6d9ed8f66 | samyak-raj/ncitstuff | CPP/week-6/3.cpp | //wap to overload + operator to add two times (hr, min) T3 = T1 + T2
#include <iostream>
using namespace std;
class Time {
private:
int hr, min;
public:
Time() {
hr = 0;
min = 0;
}
Time(int h, int m) {
hr = h;
min = m;
}
... | ALGO | 0.937962 | 5.484527 |
0dcbd7d1-de1f-499f-872f-a15fa271cdea | Mulab11/cntt2016-hw1 | TC-SRM-599-div1-950/oysq.cpp | #line 2 "SimilarNames.cpp"
#include <bits/stdc++.h>
using namespace std;
#define ui unsigned
#define ll long long
#define pii std::pair<int,int>
#define mp std::make_pair
#define fi first
#define se second
#define SZ(x) (int)(x).size()
#define pb push_back
template<class T>inline void chkmax(T &x, const T &y)... | ALGO | 0.999972 | 3.965837 |
62b55fe8-20b0-4961-8b70-186b85c93f45 | tranngocduy/react-native | third-party/folly-2016.09.26.00/folly/detail/CacheLocality.cpp | #include <folly/detail/CacheLocality.h>
#ifndef _MSC_VER
#define _GNU_SOURCE 1 // for RTLD_NOLOAD
#include <dlfcn.h>
#endif
#include <fstream>
#include <folly/Conv.h>
#include <folly/Exception.h>
#include <folly/FileUtil.h>
#include <folly/Format.h>
#include <folly/ScopeGuard.h>
namespace folly {
namespace detail {
... | TOOL | 0.971374 | 7.219906 |
4539601e-d272-4cdb-bf2d-54bf712c39fc | kaifamiao/Trivial | trivial/leetcode/source/tire.cpp | #include <bitset>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
class Trie {
public:
Trie() { _head = new Node(); }
void insert(const string& word) {
Node* cursor = _head;
for (const auto& ch : word) {
Node* child = cursor->childs[ch - 'a'];
if (child == nullpt... | ALGO | 0.998841 | 6.16151 |
c45f4729-5acc-4636-9e5f-0853983293d7 | jedward225/RUCDataStructureLab4-ChineseWordSegmentation | src/Segmenter.cpp | #include "Segmenter.h"
#include <fstream>
#include <sstream>
#include <limits>
#include <iostream>
#include <string>
Segmenter::Segmenter(const std::string& dictPath) {
loadDictionary(dictPath);
}
void Segmenter::loadDictionary(const std::string& path) {
dictionary.loadFromFile(path);
}
std::vector<std::stri... | CONFIG | 0.876678 | 4.991176 |
707b9203-416d-4f8f-8c93-892a5d5ce7d5 | thebesttv/00.ACM | 50.c/20.入门经典/code/ch10/uva11181.cpp | // UVa11181 Probability|Given
// Rujia Liu
#include<cstdio>
#include<cstring>
const int maxn = 20 + 5;
int n, r, buy[maxn];
double P[maxn], sum[maxn];
// depth, current number of 1, and product of probs
void dfs(int d, int c, double prob) {
if(c > r || d - c > n - r) return; // too many 1/0
if(d == n) {
sum[n]... | ALGO | 0.999617 | 3.191336 |
ff084532-c6a6-4b1a-861e-ffa7edac489a | DeeptanuNeogi/Deeptanu_Neogi_240333 | Week_2/Counting_subarrays.cpp | #include <iostream>
#include <vector>
using namespace std;
int solve(vector<int> &A, int B) {
int n = A.size();
int count = 0;
int sum = 0;
for (int i = 0, j = 0; j < n; j++) {
sum += A[j];
while (sum >= B) {
sum -= A[i];
i++;
}
count += (j - i + ... | ALGO | 0.999927 | 5.422424 |
a301a546-c0b4-4366-943e-57f7257355ba | saikiranpatil/my-dsa-problems | 1146-snapshot-array/1146-snapshot-array.cpp | class SnapshotArray {
public:
vector<unordered_map<int, int>> snaps;
int snapId;
SnapshotArray(int length) {
snaps.resize(length);
snapId=0;
}
void set(int index, int val) {
snaps[index][snapId]=val;
}
int snap() {
return snapId++;
}
... | ALGO | 0.943813 | 6.255713 |
2ed40b4b-8a99-444e-84f4-650fc8081912 | FromTheo/NeetCode | [C++] Bit Manipulation/missing_number.cpp | #include <iostream>
#include <vector>
#include <algorithm> //std::sort
using namespace std;
/* -------- Subject --------
Given an array nums containing n integers in the range [0, n] without any duplicates,
return the single number in the range that is missing from nums. */
/* -------- Explanation --------
... | ALGO | 0.999714 | 5.700649 |
25fcebaf-e05c-4143-9f01-7995b5c944ce | Dawidsoni/programming-competitions | MIA/2017/UNJ/wzo.cpp | #include <iostream>
using namespace std;
struct Position {
int zeroCount, oneCount, twoCount;
};
string pattern;
Position startPos;
int targetCount;
Position targetList[60];
bool isReach[35][35][35];
int result;
Position createPos(int aNum, int bNum, int cNum) {
Position result;
result.zeroCount = aNum;
resu... | ALGO | 0.999841 | 4.301666 |
552b0670-8a8b-4ca9-bdcd-43129c6e8639 | VAR-solutions/Algorithms | Other Algorithms/union_find/union_find.cpp | /*
* Algorithm that merges two disjointed sets and can find
* what set each element is.
*/
#include <bits/stdc++.h>
#define MAXN 10010
using namespace std;
// Declare the variables that will store the fathers and the ranks of each element.
int father[MAXN], rank[MAXN];
int find(int x){
if(father[x] == x) return... | ALGO | 0.999918 | 4.362605 |
7ab25a92-75e7-49ba-ac40-8d7bd3919fc2 | boshishuoshuo/cppprimer | ch5/e5-9.cpp | #include <iostream>
using namespace std;
int main(int argc, char const *argv[])
{
cout << "Please enter a letter: " << endl;
unsigned vowelCnt = 0;
char l;
char cont = 'y';
while (cin >> l)
{
if ( l == 'a' || l == 'e' || l == 'i' || l == 'o' || l == 'u')
{
++vowelC... | ALGO | 0.974074 | 4.745251 |
7e5d7d1c-facc-429c-9d42-c4d8a36e319d | yingziyu-llt/program_in_univ | intro_of_comp/11.17/6.cpp | #include<stdio.h>
#include<algorithm>
#include<string.h>
#include<math.h>
#include<string>
#include<map>
#include<iostream>
using namespace std;
map <string,int> cnt;
int main()
{
#ifdef llt
freopen("6.in","r",stdin);
freopen("6.out","w",stdout);
#endif
int n;
scanf("%d",&n);
char s[1000];
scanf("%s",s);
for(i... | ALGO | 0.999995 | 3.138418 |
deebcb6a-2bcb-4196-a137-496c45871dfc | 73629somesh/codes | codes1/25-9-2023/sort.cpp | #include<iostream>
using namespace std;
template<class T,int size>
class BubbleSort{
public:
T a[size];
void insert_a(){
cout<<"Enter the value of any datatype randomly(In unsorted manner)"<<endl;
for(int i=0; i < size; i++){
cout<<"Enter the element number : "<< i+1<<endl;
cin>>a[i];
}
}
void sorting_a... | ALGO | 0.999367 | 4.209515 |
b3ae5ff2-5a29-4a60-9d84-3aa95ac993a9 | victorhug01/techcontrol | 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.998733 | 6.76775 |
245bbce2-a543-4dfd-aae6-c2b3a7fb831f | ishandutta2007/codeforces | leaf1415/normal/442/D.cpp | #include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <cassert>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <string>
#include <algorithm>
#include <utility>
... | ALGO | 0.999887 | 3.76747 |
db3a1310-0a07-46c5-b741-28c0c5103055 | Devchonka/C_Cpp_Courses_n_Data_Structures | DataStructures/Linked_List/Circularized_Doubly_LL/ctextEditor.cpp | /**
This is a set of functions in use for the line text editor program.
*/
#include <iostream>
#include <exception>
#include <string>
#include <cctype>
#include <iomanip>
#include <fstream>
#include "cvalidation.h"
#include "CircDoublyList.h"
using namespace std;
const string FILENAME = "input.txt";
/**
Prints out... | TOOL | 0.917368 | 4.709602 |
aec00b36-f01d-4363-9880-992fddb31316 | karthikeya03/LEETCODE-dsa | 1954-replace-all-digits-with-characters/replace-all-digits-with-characters.cpp | class Solution {
public:
string replaceDigits(string s) {
for (int i = 0; i < s.size(); ++i) {
if(i%2!=0)
s[i] = s[i - 1] + (s[i]-'0');
}
return s;
}
};
| ALGO | 0.999938 | 6.333436 |
d8c00347-e6a3-41a4-923b-c25081e22204 | chhabra01/4TH-SEM-DSA | LINKED LIST/singly linked list/singly_LL.cpp | #include <bits/stdc++.h>
using namespace std;
class node
{
public:
int data;
node *next;
public:
node(int data)
{
this->data = data;
this->next = NULL;
}
};
void insert_At_head(node *&head, int d)
{
//* new node create :
node *temp = new node(d);
temp->next = head;
... | ALGO | 0.998185 | 5.024482 |
c8ae6c99-bf53-4de2-b794-bc964d9d0391 | shubh7007-rich/Leetcode | 0128-longest-consecutive-sequence/0128-longest-consecutive-sequence.cpp | class Solution {
public:
int longestConsecutive(vector<int>& nums) {
unordered_set<int> st;
if(nums.empty()) return 0;
int cnt = 1, maxi = 1;
for(int & i : nums) st.insert(i);
for(auto i : st){
if(!st.count(i-1)){
int x = i+1;
... | ALGO | 0.999942 | 5.759176 |
a2cab3b7-7d6e-40d5-b0e1-b931914fc413 | EthanKim8683/High-School-Competitive-Programming | Codeforces/Problemset/Sortings/1420a.cpp | #include<bits/stdc++.h>
using namespace std;
using I=int;
using B=bool;
const I N=5e4;
I a_arr[N];
I main(){
cin.tie(0)->sync_with_stdio(0);
I t;cin>>t;
while(t--){
I n;cin>>n;
for(I i=0;i<n;i++)cin>>a_arr[i];
B res=0;
for(I i=0;i+1<n;i++)res|=a_arr[i]<=a_arr[i+1];
printf("%s\n",res?"YES":"NO"... | ALGO | 0.999732 | 4.35592 |
58d94fcc-99a9-4ffd-b246-df871a6a2674 | r03er7/algorithms | [Code] algorytmika praktyczna/Programy_bez_komentarzy/programy_bez_komentarzy/covertree.cpp | #include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;
typedef vector<int> VI;
typedef long long LL;
#define FOR(x, b, e) for(int x = b; x <= (e); ++x)
#define FORD(x, b, e) for(int x = b; x >= (e); --x)
#define REP(x, n) for(int x = 0; x < (n); ++x)
#defi... | ALGO | 0.999659 | 4.267998 |
f1518070-ed99-4b48-a622-6ba1c7434a4a | jhaGagan0/C-Programs | greatest no..cpp | #include <stdio.h>
int main(){
int a,b,c;
printf("Enter 1st number :");
scanf("%d",&a);
printf("Enter 2nd number :");
scanf("%d",&b);
printf("Enter 3rd number :");
scanf("%d",&c);
if(a>b){
if(a>c){
printf("Greatest number is %d",a);
}
else{
printf("Greatest no. is %d",c);
}
}
if(b>a){
... | ALGO | 0.999892 | 3.433918 |
ac308867-19ef-4969-a343-d0e09f85df53 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_2303_11.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 2E5 + 5, M = 5;
int n, m, q, t, l, r, mx, a[N];
long long u;
struct node {
int f[1 << M];
node(int _b = 0) {
for (int i = 0; i < mx; i++) {
f[i] = ((i << 1) & mx) | (_b == 0 || i < mx);
}
}
node operator+(const node &oth) const {
node... | ALGO | 0.999903 | 4.955401 |
2a80df1d-4a26-455d-92b8-de501789ce07 | MaheshSharan/LeetCode_Automation | solutions/2400-2499/2497.Maximum Star Sum of a Graph/Solution.cpp | class Solution {
public:
int maxStarSum(vector<int>& vals, vector<vector<int>>& edges, int k) {
int n = vals.size();
vector<vector<int>> g(n);
for (auto& e : edges) {
int a = e[0], b = e[1];
if (vals[b] > 0) g[a].emplace_back(vals[b]);
if (vals[a] > 0) g[b... | ALGO | 0.99999 | 5.785993 |
cb635748-6aac-4ff8-879e-b565c303b18e | cvtrana/LeetcodeSolutions | 0662-maximum-width-of-binary-tree/0662-maximum-width-of-binary-tree.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.999896 | 5.951922 |
0539e56a-d8fd-4208-bd7f-29ddc0b49445 | to1dev/tengu | src/Clients/Solana/gRPC/Core/ConfigManager.cpp | #include "ConfigManager.hpp"
#include <stdexcept>
#include <system_error>
#include "Consts.h"
#include "Utils/PathUtils.hpp"
#include "../Utils/Logger.hpp"
using namespace Daitengu::Core;
using namespace Daitengu::Utils;
namespace solana {
ConfigManager::ConfigManager(const std::string& configFile)
: configF... | CONFIG | 0.949763 | 7.007741 |
4a18aab0-1ec9-4888-a1d1-89e56f8dba47 | manfromafar/winamp | Src/Plugins/General/gen_ml/ml_rating.cpp | #include "./ml_rating.h"
#include <commctrl.h>
#define IMAGE_PARTSCOUNT 4
BOOL MLRatingI_Draw(HDC hdc, INT maxValue, INT value, INT trackingVal, HMLIMGLST hmlil, INT index, RECT *prc, UINT fStyle)
{
INT ilIndex;
if (!hdc || !hmlil || !prc) return FALSE;
if (RDS_OPAQUE_I & fStyle) ExtTextOutW(hdc, 0, 0, ETO_OPAQU... | TOOL | 0.95976 | 3.679599 |
c81536b7-83fb-4ddf-8327-4f1595c4ef94 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_2956_9.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
int t1[100005] = {};
for (int i = 1; i <= n; i++) {
int c, t;
cin >> c >> t;
t1[i] = t1[i - 1] + c * t;
}
int i0 = 0;
for (int i = 0; i < m; i++) {
int v;
cin >> v;
while (t1[i0] <= v && i0 < n) i0+... | ALGO | 0.999982 | 4.140042 |
57c4d4b8-d13d-4971-9d17-8d5620904a1f | 1457792186/JWCocosGame | GunBoys/cocos2d/extensions/Particle3D/PU/CCPUForceField.cpp | #include "CCPUForceField.h"
NS_CC_BEGIN
const Vec3 PUForceFieldCalculationFactory::DEFAULT_WORLDSIZE(500.0f, 500.0f, 500.0f);
//-----------------------------------------------------------------------
unsigned short PUForceFieldCalculationFactory::getOctaves(void) const
{
return _octaves;
}
//--------------------... | TOOL | 0.949755 | 6.670735 |
845bafda-e036-4492-85b4-2032f6a35966 | ygzhang-yolo/cmu15445-2022 | src/optimizer/optimizer.cpp | #include "optimizer/optimizer.h"
#include <optional>
#include "common/util/string_util.h"
#include "execution/plans/abstract_plan.h"
namespace bustub {
auto Optimizer::Optimize(const AbstractPlanNodeRef &plan) -> AbstractPlanNodeRef {
if (force_starter_rule_) {
// Use starter rules when `force_starter_rule_` is... | ALGO | 0.883289 | 7.865147 |
ad160016-5adc-4e0a-989f-a8ea0e8fe6a1 | khadas/android_external_opencv3 | samples/cpp/tutorial_code/ShapeDescriptors/moments_demo.cpp | /**
* @function moments_demo.cpp
* @brief Demo code to calculate moments
* @author OpenCV team
*/
#include "opencv2/imgcodecs.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
using namespace cv;
using namespace std;
Mat ... | ALGO | 0.969736 | 7.378616 |
6db2ef86-96ac-4406-860c-2c78cf24cbfc | jtmalinowski/advent-of-code | year-2020/d02/main.cpp | #include <cstdio>
using namespace std;
int main() {
int n; scanf("%d", &n);
int result = 0;
while (n--) {
int min, max, count = 0;
char c;
scanf("%d-%d %c:", &min, &max, &c);
char l;
while (1) {
char l = getchar();
if (l == c) {
count++;
}
if (l == '\... | ALGO | 0.981847 | 3.466393 |
c6774712-11e3-4950-bef5-b39a05b2ee0f | PixelPlusUI-SnowCone/frameworks_av | media/codecs/mp3dec/src/pvmp3_mpeg2_stereo_proc.cpp | /*
------------------------------------------------------------------------------
PacketVideo Corp.
MP3 Decoder Library
Filename: pvmp3_mpeg2_stereo_proc.cpp
Functions:
pvmp3_st_intensity_ver2
pvmp3_mpeg2_stereo_proc
Date: 09/21/2007
-----------------------------------------------------... | ALGO | 0.996555 | 5.966504 |
d38ec2b4-747f-4b84-843f-c50753d7d072 | thegamer1907/Code_Analysis | Implementation/544.cpp | #include<cstdio>
#include<algorithm>
#include<iostream>
using namespace std;
int main()
{
int n,k,i,c=0;
int a[101];
scanf("%d%d",&n,&k);
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
for(i=0;i<n;i++)
{
if((a[i]>=a[k-1]) && (a[i]>0))
{
c++;
}
}... | ALGO | 0.999969 | 3.236029 |
17214a6d-e5a1-446c-b100-df35e198f951 | QuangHai115/BTL_CTDLGT | Bai38_thuattoan.cpp | #include <iostream>
using namespace std;
class Stack {
private:
int data[10000];
int top; /
public:
Stack() {
top=-1;
}
//Ham them
void push(int n) {
if (top==10000 - 1) {
cout << "FULL!" << endl;
} else {
top++;
data[to... | ALGO | 0.996848 | 4.411584 |
63969d09-5319-4467-a5e7-c4c41c149df7 | wuyuhang05/My-OI-Code | Luogu/P1896.cpp | #include <algorithm>
#include <iostream>
#include <cstring>
#include <climits>
#include <cstdio>
#include <vector>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#define Re register
#define LL long long
#define U unsigned
#define FOR(i,a,b) for(Re in... | ALGO | 0.999958 | 3.765347 |
3f6aeaf6-9eef-4e48-8fd3-63184abb8a13 | Ahmed8881/semester-1 | PF/week 7/task666.cpp | #include <iostream>
using namespace std;
int GCD(int num1,int num2);
int LCM(int num1,int num2,int result1);
main()
{
int num1,num2,result1,result2;
cout<<"Enter the first number: ";
cin>>num1;
cout<<"Enter the second number: ";
cin>>num2;
result1=GCD(num1,num2);
result2=LCM(num1,num2,result... | ALGO | 0.999141 | 3.529021 |
133951c4-09f1-4d4b-ad4c-aad5affc24ea | sameer2800/mohit-fu | docs/dolfin/1.1.0/cpp/source/demo/undocumented/meshintersection/3D/cpp/main.cpp | #include <dolfin.h>
using namespace dolfin;
#ifdef HAS_CGAL
int main()
{
Sphere sphere(Point(0, 0, 0), 1.0);
Mesh sphere_mesh(sphere, 16);
UnitCubeMesh cube_mesh(20, 20, 20);
// Access mesh geometry
MeshGeometry& geometry = sphere_mesh.geometry();
// Start center and propagtion speed for the sphere.
... | ALGO | 0.975043 | 6.729627 |
a65643f9-ea73-413a-9705-8d8bb4255b7e | nishantdeploys/Daily-Code-Practice | recursion/functioncall.cpp | #include<bits/stdc++.h>
using namespace std;
void fun(int n){
if(n==0) return;
cout<<"Recursion "<<n<<endl;
fun(n-1);
}
int main(){
fun(5);
} | ALGO | 0.998586 | 4.751672 |
6b396f7c-43e0-4156-a331-67209f78694f | kkpan11/apple-llvm-project | lldb/test/API/commands/command/script/main.cpp | #include <cstdlib>
#include <cstring>
#include <string>
#include <fstream>
#include <iostream>
int
product (int x, int y)
{
int result = x * y;
return result;
}
int
sum (int a, int b)
{
int result = a + b;
return result;
}
int
strange_max (int m, int n)
{
if (m > n)
return m;
else if ... | ALGO | 0.992212 | 4.083736 |
b684113a-0bfc-4209-8887-cc36a7d46981 | KevinAz999/cpp1 | IfElsehw8.cpp | #include <iostream>
using namespace std;
int main()
{
char l;
cout<<"Enter a LETTER: ";
cin>>l;
if(l == "a"||"e"||"i"||"o"||"u"||"y"){
cout<<l<<" is a vowel.";
}else if(l = "b"||"c"||"d"||"f"||"g"||"h"||"j"||"k"||"l"||"m"||"n"||"p"||"q"||"r"||"s"||"t"||"v"||"w"||"x"||"z"){
cout<<l<<" is a co... | ALGO | 0.971066 | 3.684621 |
d81d3a3c-b21f-49d2-ac6c-667d9a1f59ab | zapwiz22/DSA-in-CPP | binary-trees/traversals/level-order-traversal.cpp | #include <iostream>
#include <vector>
#include <queue>
using namespace std;
struct Node {
int data;
Node* left;
Node* right;
Node() {
data = 0;
left = NULL;
right = NULL;
}
Node(int x) {
data = x;
left = NULL;
right = NULL;
}
Node(int x,Node* left,Node* right) {
data = x;
left = left;
right ... | ALGO | 0.999852 | 5.40587 |
d13028c3-5827-49d4-af5e-36b002d7c0f6 | Alok-2004/Pattern_Printing | star.cpp | #include<iostream>
using namespace std;
int main()
{
int n;
cout<<"Enter the number of rows: ";
cin>>n;
// Method 1
/*for(int i = 1; i<= n; i++)
{
for(int j = 1; j<=n-i; j++)
{
cout<<" ";
}
for(int k = 1; k<=(2*i -1); k++)
{
cout<<"*";
}
cout<<endl;
}
for(int i = n+1; i<= 2*n - 1... | ALGO | 0.999816 | 4.030334 |
ebf18778-ab01-4e20-a865-165ac4946482 | wdweer/Overtaking-algorithm_ws | src/Overtaking_Algorithm.cpp | #include <ros/ros.h>
#include <geometry_msgs/PoseStamped.h>
#include <autoware_msgs/DetectedObjectArray.h>
#include <visualization_msgs/MarkerArray.h>
#include <std_msgs/ColorRGBA.h>
#include <tf2/LinearMath/Quaternion.h>
#include <tf2_geometry_msgs/tf2_geometry_msgs.h>
#include <hmcl_msgs/LaneArray.h>
#include <hmcl_m... | ALGO | 0.995695 | 3.054543 |
c77b3997-66c8-4550-930a-39519e3702ed | khushvind/Competitive-Programming | codeforces/1916/D.cpp | #include <bits/stdc++.h>
using namespace std;
using i64 = long long;
int solve() {
int n; cin >> n;
if (n == 1) {
cout << 1 << endl;
return 0;
}
cout << 196 << string(n - 3, '0') << endl;
for (int i = 0; i < n / 2; i++) {
cout << 1 << string(i, '0') << 6 << string(... | ALGO | 0.999661 | 5.562995 |
df156a02-1981-4609-b1e2-13d4f7290179 | makio93/competitive-othersites | LeetCode/Problems/DCC/2022/Jun/W3/D17/1/main1-2.cpp | // 学習1回目,解説AC2
#include <bits/stdc++.h>
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(nullptr) {}
TreeNode(int x, TreeNo... | ALGO | 0.999868 | 6.359828 |
cf6ab27d-a025-4784-9fae-b9f529222631 | ishandutta2007/codeforces | caoyue/normal/1340/B.cpp | #include<iostream>
#include<cstring>
#include<cassert>
#include<cmath>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<vector>
#include<time.h>
#include<bitset>
#include<cstdio>
#include<algorithm>
using namespace std;
#define REP(i,x,y) for(int i=x;i<=y;i++)
#define rep(i,n) REP(i,1,n)
#define rep... | ALGO | 0.999969 | 3.203952 |
d15fb371-6be7-4323-9a7a-011d11a69a5e | Mohit-Jain-git/Patterns | Pattern20.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int i, j, k, n, l, m;
cin >> n;
for (i = 1; i <= n; i++)
{
for (j = 1; j < n; j++)
{
if (i == 1 || i == n || j == 1 || j == (n - 1))
cout << "*";
else
cout << " ";
}
cout << endl;
}
// for (i = 1; i <= n; ... | ALGO | 0.999823 | 3.237163 |
2203108c-de7f-4441-994a-f29d1c25d9b3 | ripalnakiya/Cpp-Programmes | Star Patterns/02_MirrorRightAngledTriangle.cpp | #include<iostream>
using namespace std;
int main()
{
int a;
cout<<"Enter number of lines:";
cin>>a;
for (int i = 0; i < a; i++)
{
for (int j=0 ; j<a-i-1 ; j++) // (int j = a-i-1 ; j > 0; j--)
cout<<" ";
for (int k = 0; k <= i; k++)
cout<<"*";
cout<<"\... | ALGO | 0.999408 | 3.386319 |
d04c8d85-a27a-4b65-a6dd-38053b088cbd | ishandutta2007/codeforces | hollwoq_pelw/normal/1487/A.cpp | /*
/+==================================================+\
//+--------------------------------------------------+\\
|.|\\...>>>>>>> Hollwo_Pelw(ass) 's code <<<<<<<...//|.|
\\+--------------------------------------------------+//
\+==================================================+/
*/
#include <bits/stdc++.h>
using ... | ALGO | 0.999609 | 5.541873 |
b098a778-d03c-460f-a3f0-8fbaa0fe40d8 | MrCocoNuat/tiny-chess-960 | tiny-chess/save.cpp | #include "persistence.hh"
#include "chess.hh"
#include "types.hh"
/*
Overall structure: 512B are split into
1B reserved
1B for how many turns have passed - this is how far to read the saved data
2B for the saved seed
2B*254 for saved moves
*/
/*
Each move is recorded in 2 bytes
and is not stored revers... | TOOL | 0.89041 | 6.063351 |
a74ec0ec-2a1a-4374-a684-5ab86c6a2da2 | motioncomposer/-MC | TM/release/modules/tracking/position.cpp |
#include "position.h"
namespace mc
{
namespace position
{
// ==========================================================================================================================
//
// position estimator parameter
//
// ================================================================================... | ALGO | 0.962283 | 4.039835 |
1d510c50-9dea-4969-b0b8-f16d0d946830 | riteshbirthal/Coding-Problem-Solutions | GFG DSA Solutions/Year-2025/March/27-March/solution.cpp |
class Solution {
public:
// Function to find the minimum number of platforms required at the
// railway station such that no train waits.
int findPlatform(vector<int>& arr, vector<int>& dep) {
// Your code here
int n = arr.size(), res = n, left = 1, right = n, mid, isPossible;... | ALGO | 0.999911 | 5.765028 |
25aff4f2-9c19-4e7a-878d-77891f955285 | 7aeHoon/BaekJoon | 프로그래머스/0/120842. 2차원으로 만들기/2차원으로 만들기.cpp | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
vector<vector<int>> solution(vector<int> num_list, int n) {
vector<vector<int>> answer;
int size = (num_list.size() / n);
for (int i = 0; i < size; i++) {
vector<int> v;
for (int j = 0; j < n... | ALGO | 0.999877 | 5.730056 |
8b4b8272-36ce-47de-81fb-16341f4e3322 | snichols/boost_1_61_0 | libs/multi_index/perf/test_perf.cpp | #include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
#include <algorithm>
#include <assert.h>
#include <boost/multi_index_container.hpp>
#include <boost/multi_index/identity.hpp>
#include <boost/multi_index/ordered_index.hpp>
#include <boost/multi_index/sequenced_index.hpp>
#include <boost/ne... | TOOL | 0.890862 | 7.568899 |
c273bad3-7d50-4878-9c9f-998f6c235428 | tcew/nodal-dg | nudg++/trunk/Src/Examples3D/Euler3D/CouetteBC3D.cpp | // CouetteBC3D.cpp
// function Q = CouetteBC3D(xin, yin, zin, nxin, nyin, nzin, mapI, mapO, mapW, mapC, t, Q);
// 2007/07/11
//---------------------------------------------------------
#include "NDGLib_headers.h"
#include "Euler3D.h"
//---------------------------------------------------------
void Euler3D::CouetteBC3D... | ALGO | 0.988667 | 5.370167 |
ec3e45d4-1ff3-43ce-b875-fc47b872df42 | TheoLong/NTRT_ML | src/dev/btietz/TC_Tension/JSONGoalTension.cpp | /**
* @file JSONGoalTension.cpp
* @brief A controller for the template class BaseSpineModelLearning
* @author Brian Mirletz
* @version 1.1.0
* $Id$
*/
#include "JSONGoalTension.h"
// Should include tgString, but compiler complains since its been
// included from BaseSpineModelLearning. Perhaps we should move th... | TOOL | 0.872158 | 5.769952 |
58f9f4b2-87a2-45d4-9bea-c99961013c49 | juruohejiarui/ACM | 9.27/E.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int maxn = 2e5 + 5;
const LL INF = 1e18;
int n;
vector<int> G[maxn], nd[maxn];
struct Edge {
int v, nex;
Edge(int v = 0, int nex = 0) : v(v), nex(nex) {}
} E[maxn << 1];
int hd[maxn], tck[maxn], ti, tote;
void clear() { ti++, tote = 0;... | ALGO | 0.999918 | 4.191569 |
889c0326-c377-4dbc-bb09-e55beb6a5ead | sabrinaibnath/Codeforces | P_937A_Olympaid.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin >> n;
vector<int> d(n);
for (int i = 0; i < n; i++) {
cin >> d[i];
}
sort(d.begin(), d.end());
int count = 0;
if (d[0] != 0) {
count++;
}
for (int i = 0; i < n - 1; i++) {
if (d[i]... | ALGO | 0.999963 | 4.229724 |
4d687ed9-23c1-4735-8efe-c90a6a2c7e93 | neepan/CP009 | A_Neverending_competitions.cpp | // Neepan Biswas
// neepanb ~ codeforces
#include <bits/stdc++.h>
using namespace std;
#define fr(i, n) for (lli i = 0; i < n; i++)
#define pb push_back
#define sz(x) x.size()
#define ff first
#define ss second
#define all(v) v.begin(), v.end()
#define debug(x) cout << '>' << #x << ':' << x << endl;
using lli = long ... | ALGO | 0.999885 | 4.222202 |
2f5535eb-7d22-4313-9661-c00ba7826a9e | ganpati0910/DSA-PROBLEM- | 1029-vertical-order-traversal-of-a-binary-tree/vertical-order-traversal-of-a-binary-tree.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.999995 | 6.047217 |
047d558c-e1ce-4cc7-bbe9-c40015687579 | ShahjalalShohag/bcs-contest-resources | uu_iupc_2025/H/[ACCEPTED] nlogn_suffix_array.cpp | #include<bits/stdc++.h>
using namespace std;
const int N = 1e6 + 9, LG = 22;
vector<int> sort_cyclic_shifts(string const& s) {
int n = s.size();
const int alphabet = 256;
vector<int> p(n), c(n), cnt(max(alphabet, n), 0);
for (int i = 0; i < n; i++)
cnt[s[i]]++;
for (int i = 1; i < alphabet... | ALGO | 0.999974 | 4.657378 |
e997e78d-4ca6-435c-b2b2-9ffe9cb62a94 | vedikasangle/codes | nqueerns.cpp | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
int a[30], count;
int place(int i, int j)
{
int k;
for (k = 1; k <= i - 1; k++)
{
if (a[k] == j)
{
return 0;
}
else if (abs(a[k] - j) == abs(k - j))
{
return 0;
}
}
re... | ALGO | 0.999831 | 3.763075 |
972996f7-27ce-441a-b0ea-ae11bfa07738 | JesseSarria/final-project-dune | src/Transports/UDP/Task.cpp | // ISO C++ 98 headers.
#include <vector>
#include <stdexcept>
#include <set>
#include <algorithm>
#include <cstddef>
// DUNE headers.
#include <DUNE/DUNE.hpp>
// Local headers.
#include "NodeAddress.hpp"
#include "NodeTable.hpp"
#include "Listener.hpp"
#include "LimitedComms.hpp"
namespace Transports
{
namespace U... | WEB | 0.866728 | 7.369278 |
c341e055-9d49-46a3-b7f2-0fdad5c40446 | andyzhu23/Competitive-Programming | CCC/2022/S5.cpp | #include <bits/stdc++.h>
using namespace std;
#define pb push_back
using ll = long long;
const int N = 2e5 + 5;
const ll inf = 0x3f3f3f3f;
// 0, from father
// 1, from child
// 2, self is Y
int n, a[N];
ll dp[N][5][5];
char c[N];
vector<int> e[N];
void dfs(int u = 1, int fa = 0) {
dp[u][0][1] = a[u];
dp[u][1]... | ALGO | 0.999919 | 4.024877 |
6d8bb777-0bca-49ab-a2f3-2d159d2e02a0 | ianmolnarang/LeetcodeAll | 144-binary-tree-preorder-traversal/144-binary-tree-preorder-traversal.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.99998 | 6.124642 |
3b6a0627-b5bb-4042-b217-7d3232c3b7cd | shivanshsanoria1/LeetcodeSolutions | CPP [1501-2000]/1717.maximum_score_from_removing_substrings [1].cpp | class Solution {
public:
// T.C.=O(n), S.C.=O(n)
// Greedy
int maximumGain(string s, int x, int y) {
// higher-priority string
string highStr = x > y ? "ab" : "ba";
// lower-priority string
string lowStr = highStr == "ab" ? "ba" : "ab";
// Step 1: remove all occurenc... | ALGO | 0.999959 | 5.829437 |
0c30c536-abb2-4c66-9de4-e2d32366986a | AzharRISC-V/p1_2021ysyx | code/oscpu/libraries/fceux-am/src/utils/md5.cpp | //Modified October 3, 2003, to remove testing code, and add include of "types.h".
//Added simple MD5 to ASCII string conversion function.
// -Xodnizel
#include "../types.h"
#include "md5.h"
#define GET_UINT32(n,b,i) \
{ \
(n) = ( (uint32) (b)[(i) + 3] << 24 ) \
| ( (uint32)... | ALGO | 0.950276 | 6.37734 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.