uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
1f9047b7-9427-4c76-a776-557850e6cfbf | jugshaurya/codes | recursion And Backtracking/print_subsequence.cpp | #include<iostream>
#include<string>
using namespace std;
void subsequence(string input, string output){
if(input.length() == 0){
cout<<output<<endl;
return;
}
//first decision for not to include 1st word
subsequence(input.substr(1),output);
//second is to include
subsequence(input.substr(1),output+input[0]);... | ALGO | 0.999849 | 4.196702 |
81d1dae8-ed12-48c7-bf55-2a5d3e93764d | gautamop01/Daily-Goals-Of-Coding | Leet Code/14 Days Study Plan to Crack Algo/278_First Bad Version.cpp | // The API isBadVersion is defined for you.
// bool isBadVersion(int version);
class Solution {
public:
int firstBadVersion(int n) {
int st = 1,end = n;
while(st <= end){
int mid = st + (end-st)/2;
if(isBadVersion(mid) == false) st = mid+1;
else end = mid-1;
... | ALGO | 0.999726 | 6.480628 |
e5c9ba93-7260-46ea-a7d3-17def40546cd | novas0x2a/celestia | src/celengine/staroctree.cpp | #include <celengine/staroctree.h>
using namespace Eigen;
// Maximum permitted orbital radius for stars, in light years. Orbital
// radii larger than this value are not guaranteed to give correct
// results. The problem case is extremely faint stars (such as brown
// dwarfs.) The distance from the viewer to star's bar... | ALGO | 0.99698 | 6.152796 |
b862c7ba-d22a-4877-85c7-4c2176d69c96 | 907th/code-challenges | Timus/2068/solution.cpp | #include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <array>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <cassert>
using namespace std;
// H... | ALGO | 0.999879 | 4.132983 |
a1359d81-01cd-4a2c-97c6-258d092fa598 | Moeez-Rajpoot/C-Programs | Level 5 Tasks/task 12.cpp | #include <iostream>
using namespace std;
int main()
{
int i, sum = 0;
cout << " Numbers between 100 and 200, divisible by 7: " << endl;
for (i = 101; i < 200; i++)
{
if (i % 7 == 0)
{
cout << " " << i;
sum=sum+i;
}
}
cout << "\n The sum : " << s... | ALGO | 0.998947 | 3.585695 |
95ceb4ad-8446-4b52-b524-e9d5e09d8be6 | jeffyehtw/E-Turtor | 中文題庫/Mathematics 001 - 050/[C_MM20-易] 十進位轉十六進位.cpp | #include<iostream>
using namespace std;
int main()
{
int x;
while (cin >> x)
{
printf("%X\n", x);
}
return 0;
} | ALGO | 0.91368 | 3.625709 |
3227937d-534b-4e38-8c0e-dce0b86f1117 | jainsourav43/DSA | CP/devu and array.cpp | #include<iostream>
#include<algorithm>
#define null NULL
#define ll long long
using namespace std;
typedef
struct avlnode
{
int data;
avlnode *lchild;
int height;
avlnode *rchild;
} *avlptr;
int Height(avlptr t)
{
if(t==null)
{
return -1;
}
else
{
return t->height;
}
}
void rotateright(avlptr &k2)
{
// c... | ALGO | 0.999999 | 3.897848 |
061b0a83-86dc-4fa6-8ef9-0f6d29fca41e | 1xingao/1xingao | leetcode/919.完全二叉树插入器.cpp | /*
* @lc app=leetcode.cn id=919 lang=cpp
*
* [919] 完全二叉树插入器
*/
#include<bits/stdc++.h>
using namespace std;
struct TreeNode
{
int val;
TreeNode *left;
TreeNode *right;
TreeNode() : val(0), left(nullptr), right(nullptr) {}
TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
TreeNode(in... | ALGO | 0.9999 | 6.439512 |
f1f5b774-090f-4708-a40d-ed12b4adfc71 | stwuhan/leetcode | solution/1300-1399/1346.Check If N and Its Double Exist/Solution.cpp | class Solution {
public:
bool checkIfExist(vector<int>& arr) {
unordered_map<int, int> m;
int n = arr.size();
for (int i = 0; i < n; ++i) m[arr[i]] = i;
for (int i = 0; i < n; ++i)
if (m.count(arr[i] * 2) && m[arr[i] * 2] != i)
return true;
return ... | ALGO | 0.999089 | 5.99212 |
a46e7ba6-4703-4218-88cd-51899c045615 | HannahHaensen/DynaMoN | src/eigen/doc/examples/Tutorial_BlockOperations_corner.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace std;
int main()
{
Eigen::Matrix4f m;
m << 1, 2, 3, 4,
5, 6, 7, 8,
9, 10,11,12,
13,14,15,16;
cout << "m.leftCols(2) =" << endl << m.leftCols(2) << endl << endl;
cout << "m.bottomRows<2>() =" << endl << m.bottomRows<2>() << endl << ... | ALGO | 0.998019 | 4.092313 |
7abc5a3a-b024-4588-8b94-b67ba300d4bf | suryaanshm/DesignPatterns | 19 Iterator/main.cpp | #include <iostream>
#include <vector>
#include <stack>
#include <string>
// Forward declaration of Book class
class Book;
// Iterator interface
class Iterator {
public:
virtual bool hasNext() const = 0;
virtual Book* next() = 0;
virtual ~Iterator() {}
};
// Aggregator interface
class Aggregator {
public:... | ALGO | 0.977942 | 6.254331 |
ddcd8d49-d8f1-47a0-adad-ca18be7fe9c5 | ducnguyen1224/Data_Structures_and_Algorithms_Code_PTIT | CON6_1.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007
int main()
{
int t;
cin >> t;
while (t--)
{
int n;
cin>>n;
int a[n];
for(int i=0;i<n;i++){
cin>>a[i];
}
vector<int>v;
sort(a,a+n);
int l=0,r=n-1;
while(... | ALGO | 0.999921 | 3.968935 |
7e3656d7-ec61-4646-a066-ac7a97fa3397 | metehkaya/Algo-Archive | Problems/LeetCode/Solutions/1086.High_Five.cpp | class Solution {
public:
const int MAX_ID = 1001;
vector<vector<int>> highFive(vector<vector<int>>& ar) {
vector<vector<int>> scores(MAX_ID);
int n = ar.size();
for( int i = 0 ; i < n ; i++ )
scores[ar[i][0]].push_back(ar[i][1]);
vector<vector<int>> ans;
for( ... | ALGO | 0.999795 | 5.451078 |
b7c93aa1-910c-4178-9740-5ce23fa2c2aa | miken22/ParallelPlanner | src/Heuristic.cpp | #include "Heuristic.h"
/* Abstract Base Class that all heuristics implement.
Written by Michael Nowicki */
bool StepComparator(const std::pair<Variable *, int>& p1, const std::pair<Variable *, int>& p2);
Heuristic::Heuristic(const std::vector<DTG> tg, const std::map<Variable *, int> goal, const std::vector<O... | ALGO | 0.999771 | 3.691264 |
245b8a00-0a9d-455f-a8dd-d10e83c38839 | Pandey-Siddharth/Codeforces-1000--1500- | 2 Pointers/TotalLength.cpp | #include<vector>
#include<iostream>
using namespace std;
long long solve(vector<long long> arr,int k,int n){
long long ans = 0;
long long sum = 0;
long long j = 0;
for(int i=0;i<n;i++){
while(j < n && sum + arr[j] <= k){
sum += arr[j];
j++;
}
long long... | ALGO | 0.999858 | 4.812545 |
3e189192-56f1-40b4-ac6f-af230289cd94 | Hitesh-s0lanki/DSA | Lexicographic/KthSmallestLexicographicalOrder.cpp | #include <iostream>
using namespace std;
int countSteps(long curr, long next, int n) {
int steps = 0;
while( curr <= n ) {
steps += min(( long )(n + 1), next) - curr;
curr *= 10;
next *= 10;
}
return steps;
}
int findKthNumber(int n, int k) {
int curr = 1;
k--;
... | ALGO | 0.99952 | 4.545709 |
847582e2-b6b8-4371-bb98-b9b6a3651776 | nd-0r/CodingPractice | c++/src/DiagonalDifference.cpp | #include "vector"
#include "string"
#include "iostream"
#include "fstream"
using namespace std;
string ltrim(const string &);
string rtrim(const string &);
vector<string> split(const string &);
/*
* Complete the 'diagonalDifference' function below.
*
* The function is expected to return an INTEGER.
* The functio... | ALGO | 0.999952 | 5.763853 |
4af9c11a-402a-4b15-be19-d1eaa69ef44d | TimSimpson/BoostCoroutineAndRange | Coroutine/src/example1.cpp | struct enemy
{
enum state {
seeking = 1,
attacking = 2,
defending = 3
};
int attack_phase;
coord target;
state current_state;
int defend_time;
Target target;
void update(int elapsed_time) {
switch(current_state) {
case searching:
... | ALGO | 0.996009 | 4.858275 |
a9c73846-d448-4a18-a753-a58a7522bbc9 | Iann1978/Explore-To-OpenCV | thirdparty/eigen/eigen-eigen-b3f3d4950030/doc/examples/tut_arithmetic_matrix_mul.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace Eigen;
int main()
{
Matrix2d mat;
mat << 1, 2,
3, 4;
Vector2d u(-1,1), v(2,0);
std::cout << "Here is mat*mat:\n" << mat*mat << std::endl;
std::cout << "Here is mat*u:\n" << mat*u << std::endl;
std::cout << "Here is u^T*mat:\n" << u.transpo... | ALGO | 0.999424 | 3.818344 |
da03cd80-9a12-48b2-a846-159521db1dad | pclubiitk/Spring-Camp-25 | CP/Tushar/Assignment-3/C_Mortal_Kombat_Tower.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define vi vector<ll>;
#define pr pair<ll,ll>;
#define vii vector<pair<ll,ll>;
void solve() {
ll n;
cin>>n;
vector<ll> v(n);
for(int i=0;i<n;i++){
cin>>v[i];
}
v.push_back(0);
v.push_back(0);
v.push_back(0);
... | ALGO | 0.999943 | 3.948074 |
cfcada69-13cf-40af-a66e-ac3139ea2a5d | sjm150/ps | baekjoon/2252/solution.cpp | #include <iostream>
#include <vector>
#include <queue>
using namespace std;
vector<int> edges[32001];
int indeg[32001];
int main() {
cin.tie(0); ios_base::sync_with_stdio(0);
int n, m; cin >> n >> m;
while (m--) {
int a, b; cin >> a >> b;
edges[a].push_back(b);
indeg[b]++;
}
... | ALGO | 0.999999 | 4.967426 |
60c7024e-ccf1-4541-93ac-6f0cc9e22f05 | oxygen-hunter/Flashboom | data/big-vul-100/add_attention_code/CodeLlama/top0-100/minimum-space-wasted-from-packaging-Solution.minWastedSpace/177750_DoS_Exec_Code.cpp | begin_softmask(fz_context *ctx, pdf_run_processor *pr, softmask_save *save)
{
pdf_gstate *gstate = pr->gstate + pr->gtop;
pdf_xobject *softmask = gstate->softmask;
fz_rect mask_bbox;
fz_matrix tos_save[2], save_ctm;
fz_matrix mask_matrix;
fz_colorspace *mask_colorspace;
save->softmask = softmask;
if (softmask ... | TOOL | 0.99056 | 4.936866 |
19ae82c5-6b55-4a77-8645-f0ad759e98bb | k-tabler13/P8-1 | P8-1/P8-1.cpp | // counts the amount of vowels in given letters .
#include <iostream>
#include <string>
using namespace std;
//functions and global var here .
int countVowel(string str);
//need to fix Q
bool Q = false;
//int main here
int main(void) {
string letter;
string input;
while (true) {
cout << "Enter a string ... | ALGO | 0.923977 | 5.791633 |
13404a60-c334-406d-b77c-ffa8c0fdb8a9 | srnit/codeon | hackerearth/hackerhash.cpp | #include<bits/stdc++.h>
using namespace std;
long int roll_num;
string name;
typedef map<long int,string> hash1;
int main()
{
int t,q;
hash1 hash;
cin>>t;
while(t--)
{
cin>>roll_num>>name;
hash[roll_num]=name;
}
cin>>q;
while(q--)
{
cin>>roll_num;
cout<<hash[roll_num]<<"\n";
}
} | ALGO | 0.97585 | 3.971403 |
866cd7ef-a54a-4b92-893e-6a9742e22115 | swaralichine/Leetcode-Solutions | 1790-check-if-one-string-swap-can-make-strings-equal/1790-check-if-one-string-swap-can-make-strings-equal.cpp | class Solution
{
public:
bool areAlmostEqual(string s1, string s2)
{
if(s1==s2)
{
return true;
}
for(int i=0;i<s1.size();i++)
{
for(int j=0;j<s2.size();j++)
{
swap(s1[i],s1[j]);
if(s1==s2)
... | ALGO | 0.999921 | 5.985124 |
4eb905ec-d22b-4b0a-a0b1-02b6b7721587 | Fourgame/AbstractdatatypeHomework | week6/6530300155_2.cpp | #include <iostream>
using namespace std;
struct Node {
char value;
struct Node* next;
};
char isempty(struct Node *S) {
return S == nullptr;
}
Stack createstack(void) {
return nullptr;
}
void makeempty(struct Node S) {
while (!isempty(S)) {
Stack temp = S;
S = S->next;
del... | ALGO | 0.999782 | 4.268879 |
21aa3806-3f6c-4e82-8a25-e17449457f98 | Abhishek630/LeetCode | 84-largest-rectangle-in-histogram/84-largest-rectangle-in-histogram.cpp | class Solution {
public:
vector<int> nsl(vector<int>&heights, int n){
vector <int> left;
int pseudo =-1;
stack<pair<int,int>>s;
for(int i=0; i<n ;i++){
if(s.empty()){
left.push_back(pseudo);
}
else if(!s.empty() && s.top().... | ALGO | 0.999988 | 6.638586 |
998726f4-baa3-400b-be0d-89105f928618 | sky-bro/AC | leetcode.com/0590 N-ary Tree Postorder Traversal/main.cpp | #include <algorithm>
#include <iostream>
#include <stack>
#include <vector>
using namespace std;
// Definition for a Node.
class Node {
public:
int val;
vector<Node*> children;
Node() {}
Node(int _val) { val = _val; }
Node(int _val, vector<Node*> _children) {
val = _val;
children = _children;
... | ALGO | 0.999914 | 6.15694 |
76b0bfbf-88f0-46d3-87a9-bbf65ebbc85f | jasveen18/CP-krle-placement-lag-jayegi | 450 DSA Questions/12 Graphs/5CheckBipartite.cpp | /******************************************
* AUTHOR : ARPIT *
* NICK : arpitfalcon *
* INSTITUTION : BIT MESRA *
******************************************/
// Problem Statement - Check if a graph can be divided into bipartite graph.
// 1. 2 Sets
// 2. All the nodes will be from one node to another. There is no inter... | ALGO | 0.99982 | 5.727735 |
97b7ff44-dd2e-42e4-a4ec-775d011a6284 | MD-DILDAR-MANDAL/cp-problem-solving | Array/findMaxConsecutiveOnes.cpp | class Solution {
public:
int findMaxConsecutiveOnes(vector<int>& nums){
int l = 0;
int r = 0;
int len = nums.size();
int cnt = 0;
while(r < len){
if(nums[r] != 1){
l = r + 1;
}
else if(nums[r] == 1){
cnt = m... | ALGO | 0.99993 | 6.165435 |
d4d978b8-9129-42e7-a04c-a1ed0c8ba6c2 | AMReX-Codes/amrex-backup | Src/LinearSolvers/Projections/AMReX_NodalProjector.cpp | #include <AMReX_Vector.H>
#include <AMReX_MultiFab.H>
#include <AMReX_MLNodeLaplacian.H>
#include <AMReX_MLMG.H>
#include <AMReX_NodalProjector.H>
#include <AMReX_ParmParse.H>
#include <AMReX_MultiFabUtil.H>
namespace amrex {
//
// Add defaults for boundary conditions???
//
NodalProjector::NodalProjector ( const amre... | ALGO | 0.999499 | 6.152302 |
bbbf971c-6676-4d08-88fe-75e53a10ee75 | Ivan-71-ua/Competitive-Programming | Algorithms_and_Data_Structures/AtCoder/Perfect_Matching_on_a_Tree2.cpp | #include <bits/stdc++.h>
void dfs_size(const std::vector<std::vector<int>>& tree, int node, int parent, std::vector<int>& size) {
size[node] = 1;
for (int neighbor : tree[node]) {
if (neighbor != parent) {
dfs_size(tree, neighbor, node, size);
size[node] += size[neighbor];
}
}
}
int dfs_centroid(const st... | ALGO | 0.999995 | 5.693524 |
d43493b7-bbb3-42ee-88bc-7228873ffadc | fluttterdevelop/Book_shop | 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.998809 | 6.763549 |
af34c7ce-b135-4204-ab98-6245aca09e1f | QianQNanami/JSOI-WC25 | JC/judger/source/WC25-325/cpfile.cpp | #include <bits/stdc++.h>
using namespace std;
int a[100000], ts, sum;
int main() {
int n;
cin >> n;
for (int i =1; i<=n; i++) {
cin>>a[i];
}
for (int i=1; i<=n; i++) {
for (int j=i; j>=1; j--) {
if (a[i]<=a[j]) {
int ts=a[i];
for (int k =j; k<i; k++) {
a[k+1]=a[k];
}
a[j]=ts;
}
}
... | ALGO | 0.999892 | 3.339221 |
40a16529-8375-401f-aa5a-81ad62017e1d | hack-parthsharma/LeetCode | 3129-find-all-possible-stable-binary-arrays-i/3129-find-all-possible-stable-binary-arrays-i.cpp | class Solution {
public:
int numberOfStableArrays(int zero, int one, int limit) {
constexpr int kMod = 1'000'000'007;
vector<vector<vector<long>>> dp(
zero + 1, vector<vector<long>>(one + 1, vector<long>(2)));
for (int i = 0; i <= min(zero, limit); ++i)
dp[i][0][0] = 1;
for (int j = 0... | ALGO | 0.999762 | 5.940406 |
d1da9841-d565-4787-9421-dc4bb9dee1d1 | zhanghx0905/undergraduate-archive | 01.FOP/杂题/洛谷P1049 装箱问题.cpp | /*
套用01背包问题的模板
将物品的体积同时视为它的价值
在最大容量的限制下,求取价值的最大值,也即求取能装进去物品体积的最大值
最后用总体积-最大占用体积,即得到箱子剩余空间
*/
using namespace std;
#define max(x,y) x > y ? x : y
#define M 20005 //背包质量上确界
#define N 35 //物品个数上确界
int weight[N + 1]; //记录每件物品的质量和价值
int value[N + 1];
int dp[M + 1];
void Package01(int amounts, int weights) ... | ALGO | 0.999993 | 3.495901 |
cd684d41-30a0-428e-bd63-982637eb2833 | JamieBriggsDev/Advent-of-Code-2024--CPP | cpp/day6/Day06.cpp | //
// Created by Jamie Briggs on 06/12/2024.
//
#include <string>
#include "Day06.h"
#include "LabGrid.h"
std::string solutions::Day06::solvePartOne(const helper::SolutionInput *input) {
day6::LabGrid labGrid = day6::LabGrid(input->getTestInput());
day6::LabGuard* guard = labGrid.getGuard();
bool hasLeftMap ... | ALGO | 0.99662 | 7.124747 |
6c37e837-aec6-4a88-a4a9-fde40dfe124a | YaneZhekov/Cpp_Basics_11-12_Nested_Loops | Extra 09 Sum Of Two Numbers.cpp | #include <iostream>
using namespace std;
int main()
{
int begin, end, magicNumber;
cin >> begin >> end >> magicNumber;
int count = 1;
int i ,k ;
for (i = begin; i <= end; i++)
{
for (k = begin; k <= end; k++)
{
if (i + k == magicNumber) {
cout... | ALGO | 0.999903 | 4.851428 |
ac29daac-1828-4e33-ae5b-cd8f98f31baf | PAC-ROM/android_frameworks_av | media/libstagefright/codecs/amrwb/src/preemph_amrwb_dec.cpp | /*
------------------------------------------------------------------------------
Filename: preemph_amrwb_dec.cpp
Date: 12/10/2004
------------------------------------------------------------------------------
REVISION HISTORY
Description:
-------------------------------------------------------------------... | ALGO | 0.999932 | 5.475962 |
8781fe16-252d-4979-9a2a-7530fbc9afc6 | divyanshgaba/Competitive-Coding | greedy gift givers/main.cpp | /*
ID: divyans19
PROG: gift1
LANG: C++
*/
#include <iostream>
#include<fstream>
#include<cstdio>
#include<string.h>
using namespace std;
char s[20][20];
int np;
int mon[20];
int index(char *str)
{
for(int i = 0;i<np;i++)
{
if(!strcmp(s[i],str))
{
return i;
}
}... | ALGO | 0.995498 | 3.068993 |
2d72c39f-d7c6-48e6-978a-e4977e15087a | denis-gubar/Leetcode | Stack/1472. Design Browser History.cpp | class BrowserHistory {
public:
BrowserHistory(string homepage) {
data.push_back(homepage);
pos = 0;
}
void visit(string url) {
data.resize(pos + 2);
++pos;
data[pos] = url;
}
string back(int steps) {
pos = max(0, pos - steps);
return data[pos];
}
string forward(int steps) {... | ALGO | 0.98145 | 5.414846 |
72562f84-530f-4bd8-9cea-4e0ff788a30c | Rahul8320/DS_and_Algo | Bit Manipulation/subset_bit.cpp | #include <iostream>
using namespace std;
void subsets(int arr[], int n)
{
for (int i=0;i < (1<<n);i++)
{
for (int j=0;j<n;j++)
{
if(i & (1<<j))
{
cout << arr[j] << " ";
}
}
cout << endl;
}
}
int main()
{
int n;
cin... | ALGO | 0.99966 | 4.768804 |
d3695016-9547-4731-bd9e-29aa49a5e849 | raihanalam/StartWithC-Programming | Programming Ground/Pyramid Shape.cpp | #include<stdio.h>
int main ()
{
int i,j,k,n;
printf("enter limit: ");
scanf("%d",&n);
for(i=2; i<=n; i++)
{
for(j=1; 1<=(n-i); j++)
printf(" ");
for(k=1;k<=(2*i-1);k++)
printf("*");
printf("\n");
}
return 0;
}
| ALGO | 0.99967 | 3.260448 |
2ebfd300-300b-496f-b25a-7378fc92dc95 | ishandutta2007/codeforces | lichenkoh/normal/128/A.cpp | #pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,sse4.1,sse4.2,popcnt,abm,mmx,avx,tune=native")
#include "bits/stdc++.h"
#include <assert.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define PB push_back
#define MP make_pair
const int MOD=1000000007;
#define endl "\n"
... | ALGO | 0.999817 | 4.275213 |
7ade0b20-2bde-40d5-819b-b14f247ecda9 | lclpsoz/competitive-programming | ARCHIVE/2018-09-02-0830/144A.cpp | #include <bits/stdc++.h>
using namespace std;
////////////// Prewritten code follows. Look down for solution. ////////////////
#define x first
#define y second
#define len(x) ((int)(x).size())
using pii = pair<int, int>;
using ll = long long;
using llu = long long unsigned;
using ld = long double;
const ld EPS = 1e-9... | ALGO | 0.99991 | 4.103561 |
71a3a147-4c3b-4c49-afb6-102dab53203c | WGree/solutions | Google-coding-competition/Kickstart/2020/Round B/Robot Path Decoding.cpp | //Robot Path Decoding.cpp
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
pll go(string &s, int l, int r, int mul) {
pll res;
for (int i = l; i <= r; ++i) {
if (isdigit(s[i])) {
int cnt = 0;
for (int j = i + 1; j <= r; ++j) {
... | ALGO | 0.999937 | 3.985625 |
2d24936c-7ff5-4877-ac5a-bb2c828aed10 | TangZichen0102/cpp_study | 吴江青少年科技馆/2022CSP强化班/CSP强化班/2022-8-16B/0-1 作业/先中后序.cpp | #include<bits/stdc++.h>
using namespace std;
/*
A
/ \
B C
/ \
D E
/ \
F G
*/
void PreOrder(string &tree, int root)
{
if(root >= tree.size() || tree[root] == '?' )
return;
cout<<tree[root]<<" ";
PreOrder(tree, 2*root+1);
PreOrder(tree, 2*root+2);
}
void MidOr... | ALGO | 0.999983 | 3.456426 |
365c020a-ff80-41fa-9140-25b400c69ef8 | prprprpony/oj | cf/723v/F.cpp | #include <bits/stdc++.h>
using namespace std;
// nichijou
#define REP(i,a,b) for (int i(a), _B(b); i < _B; ++i)
#define RP(i,n) REP(i,0,n)
#define PER(i,a,b) for(int i((a)-1), _B(b); i >= _B; --i)
#define PR(i,n) PER(i,n,0)
#define REP1(i,a,b) REP(i,a,(b)+1)
#define RP1(i,n) REP1(i,1,n)
#define PER1(i,a,b) PER(i,(a)+1,... | ALGO | 0.999993 | 3.998838 |
f943406a-a7bb-4137-93cd-907c4fa1ce04 | csbrady-warwick/FARpp | tests/functions/bessel_y1.cpp | #include <iostream>
#include "far.h"
#include "compare.h"
#define NX 3
#define NY 3
#define RESULT -0.781212821300288716547150000047964820549906390716444607843833246
using namespace far;
int main([[maybe_unused]]int argc, char** argv){
std::cout << "Testing bessel_y1 " << argv[0] << "\n";
#if !defined(FAR_NEED_BOOS... | TEST | 0.915769 | 4.292843 |
5413ff17-de77-48bb-ad6c-45be945d3208 | javed2214/Segment-Trees | Elements-Having-Max-Digit-Sum.cpp | // Elements having Maximum Digit Sum using Segment Tree
//
#include<bits/stdc++.h>
using namespace std;
unordered_map <int, int> Map;
int digitSum(int n){
int s = 0, r;
while(n != 0){
r = n % 10;
s = s + r;
n /= 10;
}
return s;
}
void buildTree(int *a, int *tree, int start, int end, int index){
if(s... | ALGO | 0.999979 | 5.140502 |
f55e6f89-6d52-4e1d-92ff-c1155d7afccd | ishandutta2007/codeforces | rubikun/normal/1646/B.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define fi first
#define ... | ALGO | 0.999986 | 5.226026 |
2a15c8ec-970d-40f7-b8cd-40bb6cfd7e39 | monk63/ICP.cpp | fibonacii.cpp | #include<iostream>
using namespace std;
int main(){
int n,i,first = 0, second =1, next;
cout<< "Enter the number of term of\
Fibonacci sequence"<<endl;
cin>>n;
cout<<"First"<< n << "Terms of Fibonacci \
sequence are:- "<<endl;
for (i=0;i<n;i++){
if (i<=1)
next=i;
else{
next=first+second;
... | ALGO | 0.999572 | 3.320821 |
f0696148-4590-4f7c-b81a-59f97a267646 | snewptl/stationaryTraveller | old-memory/Codeforces Round #752_div2/A.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int>pii;
typedef double db;
const int maxn=1e5+5;
const ll mod=998244353;
const double eps=1e-10;
int main(){
int T=1;scanf("%d",&T);
while(T--){
}
return 0;
} | ALGO | 0.99148 | 3.769937 |
90649c17-7958-4a62-97ff-ae47181488e4 | neamul-haq/XPSC_DailyCodes | week5/Day1(7.7.23)/B_Minimize_the_Permutation.cpp | /*
*/
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define ndl '\n';
#define cyes cout << "YES" << '\n';
#define cno cout << "NO" << '\n';
#define print cout << ans << '\n';
#define ump unordered_map<int,int>mp;
#define mp map<int,int>mp;
int const mod = 1e9+7;
const ll inf = 1e18;
const ll N... | ALGO | 0.999995 | 3.771094 |
91755d45-0681-4b17-8230-b20a2b93383d | alexandraback/datacollection | solutions_2749486_0/C++/Programist/1.cpp | #include <iostream>
#include <cstdlib>
#include <fstream>
#include <algorithm>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <math.h>
#include <stack>
#include <queue>
#include <list>
#include <limits.h>
#include <time.h>
#include <iterator>
#pragma comment(linker, "/STACK:167772160")
usi... | ALGO | 0.999961 | 3.550959 |
bf0095bc-c781-4dbe-ae43-155bfbbc036f | kabutakot/new_server | stock.cpp | #include <stdlib.h>
#include "stock.hpp"
Stock::Stock(int n)
{
max_item_count = n;
item_count = 0;
items = new Item[n];
current = 0;
}
Stock::~Stock()
{
delete [] items;
}
void Stock::AddBid(void *id, int amount, int price)
{
if(item_count>=max_item_count)
throw "BUG: Stock::AddBid: ... | ALGO | 0.99864 | 4.357484 |
d87f53b0-af07-425c-bdcc-4ac99d732453 | ParasAnxi/DSA-Practice | Lec071 Binary Search Tree 3/Normal_BST_To_Balanced_BST.cpp | #include<bits/stdc++.h>
using namespace std;
template <typename T>
class TreeNode
{
public :
T data;
TreeNode<T> *left;
TreeNode<T> *right;
TreeNode(T data) {
this -> data = data;
left = NULL;
right = NULL;
}
~TreeNod... | ALGO | 0.999993 | 5.520483 |
e818fa15-5206-4788-93cb-0b0cfef5b3a3 | ranadhananjay242003/DSA | 235-lowest-common-ancestor-of-a-binary-search-tree/lowest-common-ancestor-of-a-binary-search-tree.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
TreeNode* lowestCommonAncestor(TreeNode* root, TreeNode* p, TreeNode* q) {
while(root ... | ALGO | 0.999993 | 6.179032 |
e3efd1c6-989b-4767-8b09-95910e864fd4 | qwerL-11/HostSerial | parameterEstimation.cpp | #include "parameterEstimation.h"
#include <QMutexLocker>
#include <QDebug>
#include <complex>
#include <vector>
#include <fftw3.h>
#include <cmath>
// 定义参考值常量(现已移到成员变量)
ParameterEstimation::ParameterEstimation(QObject *parent)
: QObject(parent)
, m_timer(new QTimer(this))
, m_dataPoints()
, m_dataMute... | ALGO | 0.994864 | 6.017554 |
30ff9dcd-e14f-4771-b7b2-63bcb0e6c52e | Aditya2860/DSA | 2D_array/array_prifix_sum_problem_print_sum_of_values_in_given_range_of_indices_from_i_to_r.cpp | // Given an array of integers of size n.Answer q queries where you need to print the sum of values in a given range of indices from I to r(both included)
// Note: The values of I and r in queries foollow 1-based indexing.
//array a1 a2 a3 a4 a5 a6
// l=2 r=6
// output a2+a3+a4+a5+a6
// index -> 0 1 2 3 4 5 6... | ALGO | 0.999254 | 4.596592 |
f27a0c08-20c9-4ad7-ac6f-1dc8c3d82ed3 | Mauro-J/Practicing-programming | C++/2221.cpp | #include <iostream>
using namespace std;
int main()
{
int cases, bonus, Dabriel[4], Guarte[4];
cin >> cases;
while(cases--)
{
cin >> bonus;
cin >> Dabriel[0] >> Dabriel[1] >> Dabriel[2];
cin >> Guarte[0] >> Guarte[1] >> Guarte[2];
Dabriel[3] = ((Dabriel[0] + Dabriel[1]) / 2) + ((Dabriel[2] % 2) == 0 ? bonu... | ALGO | 0.999903 | 4.589943 |
e277612a-42d3-4199-ad9c-7a2032cfebc9 | Mengxiang-J/work | cpp/day8/1_friendclass.cpp | #include<iostream>
#include<math.h>
using namespace std;
class Point{
public:
Point(int x, int y)
: _ix(x)
, _iy(y)
{}
friend double distance(const Point&rhs1,const Point&rhs2);
private:
int _ix;
int _iy;
};
double distance(const Point&rhs1,const Point&rhs2)
{
return(sqrt((rhs1._ix-rhs2._... | ALGO | 0.998993 | 3.87807 |
aae13ad9-3dc7-44dc-90b3-8b35178affe0 | ZikangZhou/nim_rl | nim_rl/agent/optimal_agent.cpp | #include "nim_rl/agent/optimal_agent.h"
namespace nim_rl {
Action OptimalAgent::Policy(const State &state, bool /*is_evaluation*/) {
unsigned nim_sum = state.NimSum();
for (int pile_id = 0; pile_id != state.Size(); ++pile_id) {
unsigned num_objects_target = state[pile_id] ^nim_sum;
if (num_objects_target ... | ALGO | 0.964568 | 6.366507 |
2a98af90-c889-47b0-b25c-ee687d563d7c | RahulkumarRV/algorithms_and_data_structure | find_dublicate.cpp | class Solution {
public:
int findDuplicate(vector<int>& nums) {
sort(nums.begin(), nums.end());
for(int i=0; i<nums.size() - 1; i++){
if(nums[i] == nums[i+1]){
return nums[i];
}
}
return -1;
}
};
//other way
int findDuplicate(vector<int>&... | ALGO | 0.999983 | 5.914536 |
036758bb-bac9-40a9-86e9-a304e6a1c280 | AkashKalme/DSA | 2 C & C++ Practice/26ObjectOrientedProgram.cpp | // Object Oriented Program
#include <iostream>
using namespace std;
class Rectangle
{
private:
int length;
int breadth;
public:
void initialize(int l, int b)
{
length = l;
breadth = b;
}
int perimeter ()
{
int peri;
peri = 2*(length + breadth);
ret... | TOOL | 0.916259 | 4.014185 |
ba8bd316-d774-4e38-8456-8e47f983153e | PacktPublishing/Hands-On-GPU-Accelerated-Computer-Vision-with-OpenCV-and-CUDA | Chapter7/09_haar_face_video.cpp | #include <iostream>
#include <opencv2/opencv.hpp>
using namespace cv;
using namespace std;
int main()
{
VideoCapture cap(0);
if (!cap.isOpened()) {
cerr << "Can not open video source";
return -1;
}
std::vector<cv::Rect> h_found;
cv::Ptr<cv::cuda::CascadeClassifier> cascade = cv::cuda::... | TOOL | 0.86924 | 4.01704 |
e2500570-734b-436b-8024-885f894e6d5f | praveen-official/tasks_at_guvi | linked_list.cpp | #include<iostream>
using namespace std;
class node
{
private:
int data;
node *next,*previous;
node *head,*tail;
node *pointerr,*temprary,*chumma;
public:
node()
{
head=NULL;
}
int newlist(int x)
{
if(head!=NULL)
{
pointerr=new node();
... | ALGO | 0.999104 | 3.521849 |
ecace655-8921-4840-9f7d-f1dfe99aa31d | NahulRahman/DSA-II | Topological_Sort/topological_sort.cpp | //the code runs perfect in an online compiler, but it shows many problem in codeblocks
//topo-sort
#include <bits/stdc++.h>
using namespace std;
void topo_sort(int vertices, int edges) {
vector<char> ans;
queue<char> q;
map<char, vector<char> > graph;
map<char, int> inDegree;
vector < pair<char, c... | ALGO | 0.999939 | 4.581718 |
f93eaccc-11b2-48e1-9504-4548cf49799a | firiexp/contest_log | atcoder/ABC/116A.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using namespace std;
template<class T>
constexpr T INF = ::numeric_limits<T>::... | ALGO | 0.99993 | 3.979728 |
02f9a699-e66e-453a-92d3-48f347428af2 | sarvex/leetcode-c-sharp | solution/1100-1199/1167.Minimum Cost to Connect Sticks/Solution.cpp | class Solution {
public:
int connectSticks(vector<int>& sticks) {
priority_queue<int, vector<int>, greater<int>> pq;
for (int x : sticks) pq.push(x);
int res = 0;
while (pq.size() > 1) {
int val = pq.top();
pq.pop();
val += pq.top();
pq... | ALGO | 0.999961 | 5.609664 |
f02501f8-a829-4041-8e86-9df55386858d | hidayattaufiqur/cp-archives | competitions/UAJY/comp/A_ay.cpp | #include <bits/stdc++.h>
#define input cin
#define print cout
#define ll long long
#define gcn _getchar_nolock
#define gcu getchar_unlocked
#define pii pair<int, int>
#define pil pair<int, ll>
#define pll pair<ll, ll>
#define pib pair<int, bool>
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) a * b / __gcd(a, b)
#defin... | ALGO | 0.999949 | 3.406417 |
a639135f-4aa2-4586-8812-3712e6649d19 | xiewende/CPlusPlus_Algorithm | string/one-eight-seven.cpp | // 187. 重复的DNA序列
// 字符串+哈希 的使用
#include<iostream>
#include<vector>
#include<unordered_map>
#include<vector>
using namespace std;
vector<string> findRepeatedDnaSequences(string s) {
int n = s.length();
int l = 10;
unordered_map<string, int> seen;
vector<string> ans;
for (int i = 0; i <= n - l;i... | ALGO | 0.999694 | 4.117675 |
bc4efc4a-519c-45ec-b33b-5e4c4cb4585d | vihanagarwal18/leetcode | 2545-height-of-binary-tree-after-subtree-removal-queries/2545-height-of-binary-tree-after-subtree-removal-queries.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.999799 | 5.799454 |
36e0842b-86dd-48ae-9b56-f6e5f156b088 | TimothyHorscroft/competitive-programming | atcoder/agc054/c.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define FOR(i, a, b) for (int i=(a); i<(b); ++i)
#define vi vector<int>
#define vvi vector<vi>
const int MOD = 998244353;
signed main() {
ios::sync_with_stdio(0), cin.tie(0);
int n, k;
cin >> n >> k;
vi a(n);
FOR(i, 0, n) {
... | ALGO | 0.999996 | 4.798667 |
005bb97f-81c0-4f20-af6d-0e11a16efbdf | jroweboy/lemon | src/core/hw/y2r.cpp | #include <algorithm>
#include <array>
#include <cstddef>
#include <memory>
#include "common/assert.h"
#include "common/color.h"
#include "common/common_types.h"
#include "common/math_util.h"
#include "common/vector_math.h"
#include "core/hle/service/y2r_u.h"
#include "core/hw/y2r.h"
#include "core/memory.h"
namespac... | ALGO | 0.858247 | 7.060509 |
fe44a752-7e72-4d45-8141-e92a48b678ee | UITSE2024/LuuDoThuatToan_Cpp_Function | HHungdzai/111/111.cpp | #include<iostream>
using namespace std;
float tinhBieuThuc();
int main()
{
cout << "Tinh gia tri cua pi: " << tinhBieuThuc();
cout << "\n\n\nKet thuc!!!!!\n\n\n";
return 0;
}
float tinhBieuThuc()
{
float s = 3;
int dau = 1, i = 2;
float e = 3;
float epsilon = 1e-6;
while (e >= epsilon)
{
e = 4.0 / (i... | ALGO | 0.999857 | 3.438336 |
94c7f44a-4f14-4f4b-9408-5a53e30972e2 | TCSS-333-2016-Summer/Assignment-3-answer | lodepng/examples/example_png2bmp.cpp | #include "lodepng.h"
#include <iostream>
/*
This example converts a PNG file to a BMP file.
NOTE: it overwrites the output file without warning if it exists!
Give the PNG and the BMP file names as command line arguments.
*/
/*
g++ lodepng.cpp example_png2bmp.cpp -Wall -Wextra -pedantic -ansi -lSDL -O3
*/
//Input ima... | TOOL | 0.851047 | 6.104178 |
73b3c831-5fc5-437d-9357-f0bcb8f02eb5 | salilab/imp | modules/multifit/src/anchor_utilities.cpp | #include <IMP/multifit/anchor_utilities.h>
#include <IMP/statistics/internal/VQClustering.h>
#include <IMP/algebra/vector_search.h>
#include <IMP/atom/Atom.h>
#include <IMP/atom/SecondaryStructureResidue.h>
// Work around Boost bug with adjacency_matrix in 1.60:
// https://svn.boost.org/trac/boost/ticket/11880
#includ... | ALGO | 0.980424 | 5.59925 |
61a1dd75-0340-4c25-b37a-d338849aa32e | Sagar-Mondal/GFG-POTD | Difficulty: Medium/Minimize the Heights II/minimize-the-heights-ii.cpp | //{ Driver Code Starts
// Initial template for C++
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
// User function template for C++
class Solution {
public:
int getMinDiff(vector<int> &arr, int k){
int n = arr.size();
sort(arr.begin(), arr.end());
int ans = arr[n - ... | ALGO | 0.999827 | 5.621657 |
ae804ab2-4a4d-4e71-9dab-8723077ccd12 | LexxLuey/CPP-dock | exam peact/main.cpp | #include <iostream>
#include <iomanip>
#include <string.h>
#include <stdlib.h>
using namespace std;
int main()
{
char nation[20];
long double grains = 1;
int board, badboard;
bool boardflag = false;
long double sum = 1;
long double budget, cost;
char quit;
cout <<"WELCOME TO THE GREEDY... | TOOL | 0.928265 | 3.927864 |
07b18cfa-6d41-476b-8801-163d7da74eac | axxonite/algorithms | EPI/Solutions/11_Heaps/11.4_closest_stars_solution.cpp | #include "stdafx.h"
namespace Solutions
{
struct Star
{
bool operator<( const Star& that ) const
{
return Distance() < that.Distance();
}
double Distance() const { return sqrt( x * x + y * y + z * z ); } // why use a square root here?
double x, y, z;
};
// Overall, somewhat tricky to get just right... | ALGO | 0.999191 | 4.339719 |
95b41d64-4ba1-4d68-9148-2744268a43e7 | lfricken/Beta | include/API/Box2D/Dynamics/Joints/b2DistanceJoint.cpp | #include <Box2D/Dynamics/Joints/b2DistanceJoint.h>
#include <Box2D/Dynamics/b2Body.h>
#include <Box2D/Dynamics/b2TimeStep.h>
// 1-D constrained system
// m (v2 - v1) = lambda
// v2 + (beta/h) * x1 + gamma * lambda = 0, gamma has units of inverse mass.
// x2 = x1 + h * v2
// 1-D mass-damper-spring system
// m (v2 - v1... | ALGO | 0.998037 | 7.210575 |
cf142b5c-d2fa-4004-bd97-b8cae19bc4ff | Tahsin005/Problem-Solving | Week 25+/A_Magic_Numbers.cpp | /*
Author: tahsin_ferdous
Email: <EMAIL>
Qué mirás, bobo? Qué mirás, bobo?…
*/
#include<bits/stdc++.h>
#define OJ
using namespace std;
#define ll long long
#define cyes cout << "YES" << '\n'
#define yes cout << "Yes" << '\n'
#define cno cout << "NO"<< '\n'
#define no cout << "No"<< '\n'
#define... | ALGO | 0.999845 | 3.773102 |
32be802e-759d-4081-b563-0008b0b1e2d7 | xiaoer371/youqia | src/mailcore2-master/src/core/basetypes/MCHash.cpp | #include "MCHash.h"
unsigned int mailcore::hashCompute(const char * key, unsigned int len) {
unsigned int c = 5381;
const char * k = key;
while (len--) {
c = ((c << 5) + c) + *k++;
}
return c;
}
| ALGO | 0.999255 | 5.199936 |
6486805b-05e1-4d9f-9353-6a0a5c0949f6 | TaskaPaska/Codeforces-Solutions | 798/A[Mike and palindrome].cpp | #include <bits/stdc++.h>
using namespace std;
string str;
int x;
main() {
cin>>str;
for (int i = 0; i < str.size()/2; i ++) {
if (str[i] != str[str.size()-i-1]) {
x++;
}
}
if (x == 1) {
cout<<"YES";
}
else if (x == 0 & str.size()%2 == 1) {
cout<<"YES";
}
else {
cout<<"NO";
}
} | ALGO | 0.999966 | 3.884354 |
b01318e4-82f1-4970-b6ee-5703e6d6e812 | AadityaShukla01/Interview-Preparation | Check if two arrays are equal or not - GFG/check-if-two-arrays-are-equal-or-not.cpp | //{ Driver Code Starts
//Initial function template for C++
#include<bits/stdc++.h>
using namespace std;
#define ll long long
// } Driver Code Ends
//User function template for C++
class Solution{
public:
//Function to check if two arrays are equal or not.
map<int,int>map1;
map<int,int>map2;
boo... | ALGO | 0.999785 | 5.359156 |
fd7e673c-d0d6-405e-8266-5397683659ee | ashahrior/UVA-mysolutions | vol-10000/10041 vito's family.cpp | #include<stdio.h>
#include<algorithm>
using namespace std;
int main()
{
int str[30005];
int t, n, i, j, k, sum, median;
scanf("%d",&t);
for(k=1;k<=t;k++)
{
scanf("%d",&n);
for(i=0; i<n;i++)
scanf("%d", &str[i]);
sort(str,str+i);
median = str[i/2];
... | ALGO | 0.999923 | 4.110103 |
f1ba78bd-b57c-4a59-83c6-68365f02b519 | RashmiMaxCoder/Data-Structure | Tree/geeks/inOrder.cpp | void in(Node* root,vector<int> &vec)
{
if(root!=NULL)
{
in(root->left,vec);
vec.push_back(root->data);
in(root->right,vec);
}
}
vector<int> inOrder(Node* root) {
// Your code here
vector<int>vec;
in(root,vec);
... | ALGO | 0.999949 | 6.249068 |
f976bd24-705f-41a8-9642-0d0ce340cfd0 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_2858_18.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
string m[12] = {"January", "February", "March", "April",
"May", "June", "July", "August",
"September", "October", "November", "December"};
string s;
int k, d;
cin >> s >> k;
for (int i = 0; i < 1... | ALGO | 0.999915 | 3.572331 |
5ff5ed91-99ca-4ed7-88d0-9d01b37c703b | Steve-s2024/Competitive-Programming-root-folder | LeetCode root folder/Verifying an Alien Dictionary.cpp | // 100%
class Solution {
public:
bool isAlienSorted(vector<string>& words, string order) {
unordered_map<char, int> dict;
int i = 0;
for (char c : order) {
dict[c] = i;
i++;
}
for (int i1 = 1; i1 < words.size(); i1++) {
... | ALGO | 0.999971 | 6.005507 |
0df3bae3-b81a-44d9-82ff-acba0d6c08ad | jahidhasan17/Competitive-Programming | Others/Previous Code/Binary_search_tree.cpp | /*
9
10 6 15 1 8 7 9 12 16
*/
#include <bits/stdc++.h>
using namespace std;
struct node{
int num;
node *left,*right;
node(){
left=NULL;
right=NULL;
}
};
node *root=NULL;
void insert(int number){
node *curr=root,*parent;
if(root==NULL){
root=new node();
root->num=number;
}else{
while(1){
if(number... | ALGO | 0.999884 | 4.077445 |
104c0cb7-372c-47da-ad75-800ba64464fe | lsk-china/oi | P1717.cpp | #include <cstdio>
#include <queue>
#include <cstdlib>
struct lake {
int fishNum;
int dec;
int timeCost = 0;
};
bool operator<(struct lake lake1, struct lake lake2) {
return lake1.fishNum < lake2.fishNum;
}
#define PQ std::priority_queue<struct lake>
int main() {
int n, time;
scanf("%d", &n)... | ALGO | 0.999858 | 3.460665 |
f2204c2e-67ce-4302-91b3-5ddf7f313d54 | ShinjouKun/GameKouki | cocos2d/cocos/platform/winrt/CCFileUtilsWinRT.cpp | #include "platform/winrt/CCFileUtilsWinRT.h"
#include <regex>
#include "platform/winrt/CCWinRTUtils.h"
#include "platform/CCCommon.h"
#include "tinydir/tinydir.h"
using namespace std;
NS_CC_BEGIN
static std::string s_pszResourcePath;
// D:\aaa\bbb\ccc\ddd\abc.txt --> D:/aaa/bbb/ccc/ddd/abc.txt
static inline std::str... | TOOL | 0.912899 | 6.406528 |
cea71f63-bb3f-4514-9f8c-7a261a591c5d | mayank171/leetcode | 0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divbloomberg-divdiv-classcompanytagscontainer-tagoccurence2-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-id... | class Solution {
public:
vector<bool> checkArithmeticSubarrays(vector<int> &nums, vector<int> &l, vector<int> &r) {
std::vector<bool> res;
for (int i = 0; i < r.size(); i++) {
std::vector<int> arr(nums.begin() + l[i], nums.begin() + 1 + r[i]);
sort(arr.begin(), arr.end());
... | ALGO | 0.999827 | 6.121806 |
7c3d8192-a236-42a6-b0bc-140e1e5ca1da | RamtinTJB/TicTacToe | src/board.cpp | #include "board.h"
bool is_index_valid(int index) {
return index >= 0 && index <= 8;
}
bool is_cell_empty(const char brd[9], int index) {
return brd[index] == 0;
}
bool is_board_full(const char brd[9]) {
for (int i = 0; i < 9; i++) {
if (is_cell_empty(brd, i)) return false;
}
return true;
}
bool win(const ch... | ALGO | 0.996498 | 5.765501 |
1a065abc-b3d7-4e1f-a22c-d1ee4ba663dc | sungpyo9053/datastructure | shortestPath.cpp | #include <iostream>
using namespace std;
class Path
{
private:
int found[8];
int distance1[8];
public:
void shortestpath1(int v, int n);
void shortestpath2(int v, int n);
int choose(int v, int n);
};
const int MAX1 = 100;
const int MAX2 = 10000;
int array1[7][7] = { ... | ALGO | 0.999712 | 3.572079 |
f9472ca9-2349-44ad-8791-b8ee8dce4013 | PriyanshK09/Leetcode-Discord-Bot | solutions/two-sum-bsts.cpp | // Time: O(n)
// Space: O(n)
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
bool twoSumBSTs(TreeNode* root1, TreeNode* root2, int target) {
... | ALGO | 0.999988 | 6.778167 |
ec389177-934f-4717-aa5f-ffe448e78d92 | smartoctopus/Graphing-Calculator | Graphing Calculator/expression.cpp | #include <cmath>
#include <iostream>
#include <cassert>
#include "expression.h"
#include "utility.h"
Expr* expr_binary(ExprKind kind, Expr* lhs, Expr* rhs) {
assert(kind == ExprKind::Add || kind == ExprKind::Sub || kind == ExprKind::Mul || kind == ExprKind::Div || kind == ExprKind::Pow);
Expr* expr = xmalloc... | TOOL | 0.998613 | 5.916869 |
f33d554f-1a0d-474c-86e4-7a3177f58597 | sakaeigo/kwave | MatrixClasses/FftwRealMatrix.cpp | /**
* @file FftwRealMatrix.cpp
*
* @author Jiri Jaros \n
* Faculty of Information Technology \n
* Brno University of Technology \n
* <EMAIL>
*
* @brief The implementation file containing the class that implements various FFT using the FFTW interface.
*
* @version ... | ALGO | 0.982161 | 6.917403 |
1cb90e0f-4c38-47f6-9deb-0cabebf7fb0d | IsenVS/lab_4 | 5_1.cpp | #include <iostream>
#include <vector>
using namespace std;
// Линейный конгруэнтный генератор
vector<int> linearCongruentialGenerator(int X0, int A, int B, int C) {
vector<int> sequence;
int current = X0;
sequence.push_back(current);
do {
current = (A * current + B) % C;
sequence.push... | ALGO | 0.99989 | 4.580488 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.