uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
7091a2f8-3f76-498d-8ba6-96f7a48a004a | itsmesuraj20/Leetcode-Practice | 77-combinations/77-combinations.cpp | class Solution {
public:
vector<vector<int>> combine(int n, int k) {
vector<vector<int>> result;
vector<int> numbers;
for(int i=1;i<=n;i++){
numbers.push_back(i);
}
for(int i=0;i<powl(2,n);i++){
int mask=i;
vector<int> temp;
for... | ALGO | 0.999982 | 6.093872 |
822bda36-e6bd-46e2-acba-7ecd7499e4ce | sharayupatil2781/Cpp-Programming | FunctionCallingMechanisams.cpp | #include<iostream>
using namespace std;
void fun(int no) // Call by value
{
cout<<"Inside call by value : "<<no<<"\n";
no++;
}
void gun(int *p) // Call by address
{
cout<<"Inside call by address : "<<*p<<"\n";
(*p)++;
}
void sun(int &ref) // Call by r... | ALGO | 0.995204 | 4.966645 |
98013e66-e0e3-49bd-afca-317735c544e8 | nachiketkanore/Codeforces-Solved-Problems | 34_C.cpp | /*
Author: Nachiket Kanore
Created: Friday 22 January 2021 11:29:31 AM IST
(ツ) Forgiveness does not change the past, but it does enlarge the future.
*/
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <cassert>
#include <string>
#include <cstring>... | ALGO | 0.999608 | 4.815209 |
de448769-ba0f-43ac-940b-382e26eacf87 | Tetrapico/cp_algo | DFS.cpp | /*
ID: ibrahim55
LANG: C++
TASK: test
*/
#include<bits/stdc++.h>
using namespace std;
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<class T>using oset = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
//cout<<s.order_of_key(5)... | ALGO | 0.999789 | 4.245368 |
174bd7ec-8808-4c91-93dd-9c30465b3678 | DaoTuPhat/UET | CODEFUN/CODEFUN 151 - 200/Bai162.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int a,b,c,t,count=0,temp1,temp2;
cin >> a >> b >> c >> t;
if(a==0 || b==0 || c==0 ){
cout << "0";
return 0;
}else{
if(t ==0){
cout << "1";
return 0;
}else{
int s[3];
s[0]=a;
s[1]=b;
s[2]=c;
sort(s,s+3);
for(int i=0; i<=t/s[2];... | ALGO | 0.999961 | 4.274848 |
98dbdfdc-c855-4193-8380-0b08eefaf122 | rohanblueboybaijal/Codeforces-code | 641a.cpp | #include <bits/stdc++.h>
using namespace std;
#define MP make_pair
#define PB push_back
#define ll long long int
#define F first
#define S second
#define MAX(x,y) (x)>(y)?(x):(y)
#define MIN(x,y) (x)<(y)?(x):(y)
#define REP(i,a,n) for(i=a;i<(n);i+=1)
#define REPL(i,a,n) for(i=a;i<=(n); i+=1)
#define REPr(i,n) for(i=n-... | ALGO | 0.999892 | 4.00168 |
f227dea6-abc7-48c9-88af-0d2cdce62dc4 | insectkorea/my-cp | cses/3/main.cpp | /**
* author: insectkorea
* create-mm-dd hh:mm:ss
**/
#include <bits/stdc++.h>
using namespace std;
// clang-format off
/* accelration */
// 高速バイナリ生成
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
// cin cout の結びつけ解除, stdioと同期しない(入出力非同期化)
// cとstdの入出力を混在させるとバグるので注意
struct Fast {Fast() {std::... | ALGO | 0.999881 | 4.164454 |
07709848-89bd-4080-93b8-49389f58cc28 | ankitjainhere/dsa | dynamic_programming/equal_sum_partition/equal_sum_partition_TopDown.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 equalPartitiionHelper(int N, int arr[], int sum,
vector<vector<int>> &dp) {
if (sum == 0) {
r... | ALGO | 0.999872 | 5.959816 |
6b2c6175-7136-41ff-a94f-21c6b5f9c42c | noel-la-borde/csc_142 | Week_14/Hard_Assignment.cpp | #include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
int roll_attack() {
return rand() % 10 + 1;
}
int roll_defense() {
return rand() % 10 + 1;
}
bool is_hit(int attack, int defense) {
return attack > defense;
}
void duel() {
int obi_wins = 0;
int maul_wins = 0;
for ... | ALGO | 0.996574 | 5.27201 |
cec66d41-11b9-4251-b22f-1e011f72d74b | RyoSci/AtCoder | くじかつ/20221123/d.cpp | // #define _GLIBCXX_DEBUG
#include <algorithm>
#include <atcoder/all>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
using namespace atcoder;
using lli = long long;
// usin... | ALGO | 0.99986 | 4.416567 |
2c12203d-6cfa-4f34-8893-e8bfa4574219 | ishandutta2007/codeforces | fotiie96/normal/472/D.cpp | #include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bi... | ALGO | 0.999975 | 3.28798 |
578b115d-a4bd-415f-911b-dbfd89bec3ed | joncampbell123/openwatcom-hackipedia | bld/plustest/regress/stl.94/examples/greater.cpp | // This example compiles using the new STL<ToolKit> from ObjectSpace, Inc.
// STL<ToolKit> is the EASIEST to use STL that works on most platform/compiler
// combinations, including cfront, Borland, Visual C++, C Set++, ObjectCenter,
// and the latest Sun & HP compilers. Read the README.STL file in this
// directory ... | ALGO | 0.999852 | 4.282848 |
06cd0436-3c25-4929-b83b-a006adceebdd | GoWest279/ORAM_SLAM_ROS_Odroid_N2 | A00opencv-3.4.3/3rdparty/carotene/src/count_nonzero.cpp | #include "common.hpp"
#include <limits>
namespace CAROTENE_NS {
s32 countNonZero(const Size2D &_size,
const u8 * srcBase, ptrdiff_t srcStride)
{
internal::assertSupportedConfiguration();
#ifdef CAROTENE_NEON
Size2D size(_size);
if (srcStride == (ptrdiff_t)(size.width))
{
size... | ALGO | 0.927936 | 6.519955 |
dd6debc1-97d3-48e0-9cff-4e9d71549ddd | Mjangel1/Algorithms_Boardgame | Source/Algorithms_Exam/Private/CPP_CountingSort.cpp | #include "CPP_CountingSort.h"
TArray<ACPP_Card*> UCPP_CountingSort::Sort(TArray<ACPP_Card*> CardsForSorting)
{
int32 n = CardsForSorting.Num();
if (n > 0 && n < 9) { //if the character piece dies, the max amount of cards wont be 8 anymore
int32 EvenNumber = n % 2; //we only allow sorting when the hand is full ... | ALGO | 0.998171 | 5.155106 |
1ab1ebb5-2225-41a3-b22a-fd63c872e38e | Vartika2207/LeetCode-Solutions-Cpp | LeetCode Solutions C++/1339. Maximum Product of Splitted 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.999981 | 6.190556 |
bc0a0153-f491-4c92-9619-ce8c79c559d7 | stonewinter/LeetcodeEx | cpp_LeetCode_algo_153.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
using namespace std;
int findMin(vector<int>& nums);
int main(){
vector<int> nums = {2,1};
//{1};
//{1,2,3,4,5,6,7,8,9,10,11,12};
//{5,6,7,8,9,9,9,10,11,0,1,2,3,3,3,4};
cout << findMin(nums) << endl;
return 0;
}
int... | ALGO | 0.999928 | 5.280697 |
aed86707-e370-4352-9bb2-32f22ef71e76 | catherinemabato/project3 | libc/src/math/nvptx/remquof.cpp | #include "src/math/remquof.h"
#include "src/__support/common.h"
#include "declarations.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(float, remquof, (float x, float y, int *quo)) {
return __nv_remquof(x, y, quo);
}
} // namespace LIBC_NAMESPACE_DECL
| TOOL | 0.956071 | 6.051359 |
9cdfbf49-eab7-4904-89a2-929795e1a816 | GrandMasterJedi/ModelPredictiveControl_Vehicle | src/Eigen-3.3/test/denseLM.cpp | #include <iostream>
#include <fstream>
#include <iomanip>
#include "main.h"
#include <Eigen/LevenbergMarquardt>
using namespace std;
using namespace Eigen;
template<typename Scalar>
struct DenseLM : DenseFunctor<Scalar>
{
typedef DenseFunctor<Scalar> Base;
typedef typename Base::JacobianType JacobianType;
typed... | TEST | 0.985158 | 5.862647 |
fddedd1e-6df2-47c9-b6fc-a012e33eba19 | alifalhasan/CP-code-vault | CodeChef/Practice/JOKRBTMN - Joker and Batman/48978815.cpp | #include<bits/stdc++.h>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long
template<typename temp>using ordered_set = tree<temp, null_type, less_equal<temp>, rb_tree_tag,tree_order_statistics_node_update
//order_of_key(k) : ... | ALGO | 0.999983 | 3.323919 |
6de28891-fa5d-4dc3-9773-1565606cb767 | Thewbi/cpp_compiler | src/test/resources/n-queen-problem.cpp | // https://www.geeksforgeeks.org/n-queen-problem-backtracking-3/
// C program to solve N Queen Problem using backtracking
//#define N 4
//#include <stdbool.h>
//#include <stdio.h>
// A utility function to print solution
void printSolution(int board[N][N])
{
for (int i = 0; i < N; i++) {
for (int j = 0; j < N; j++... | ALGO | 0.999913 | 3.142802 |
346ccdd3-2d26-4871-a7f1-7863d174a154 | Vortexx2/DSA-questions | leetcode/easy/144-preorder/stack.cpp | /**
* @file sol.cpp
* @author Vortexx2
* @brief Problem 144 - Binary Tree Preorder Traversal
* @date 20-07-2021
*
* Runtime - 4 ms
* Memory Usage - 8.3 MB
*/
#include <iostream>
#include <vector>
#include <deque>
#include <unordered_map>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include ... | ALGO | 0.999997 | 6.528122 |
32de71b5-ddbc-4945-a356-a30ca6e09c9c | Next-Gen-UI/Hacktober | Leetcode/0363. Max Sum of Rectangle No Larger Than K/0363.cpp | class Solution {
public:
int maxSumSubmatrix(vector<vector<int>>& matrix, int k) {
const int m = matrix.size();
const int n = matrix[0].size();
int ans = INT_MIN;
for (int baseCol = 0; baseCol < n; ++baseCol) {
// sums[i] := sum(matrix[i][baseCol..j])
vector<int> sums(m, 0);
for (i... | ALGO | 0.999883 | 6.519969 |
a2012483-6865-4421-a3d9-e615115a1b2a | sarvex/leetcode-j | solution/0800-0899/0869.Reordered Power of 2/Solution.cpp | class Solution {
public:
bool reorderedPowerOf2(int n) {
vector<int> s = convert(n);
for (int i = 1; i <= pow(10, 9); i <<= 1)
if (s == convert(i))
return true;
return false;
}
vector<int> convert(int n) {
vector<int> cnt(10);
for (; n; n ... | ALGO | 0.99979 | 6.232038 |
defd87e4-ada0-4f61-a1ed-b624aad813ab | CJSBinder-User/CJSBinder | experiment/correctness_efficiency/ChatGPT/tasks/FREQUENT_ELEMENT_ARRAY/FREQUENT_ELEMENT_ARRAY_GLUECODE.cpp | #include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include "include/libplatform/libplatform.h"
#include "include/v8.h"
#include "CQuesHeader.h"
using namespace v8;
// V8 related functions for handling JavaScript
void Print(const FunctionCallbackInfo<Value>& args){
v8::Isolate* isolate = arg... | ALGO | 0.939698 | 6.315104 |
0aef2f80-b8a2-43e3-ad9b-e2a110fb6802 | MobinTGR8/MyProjects | DSA/Q1-Sorted_Array.cpp | #include <iostream>
#include <string>
using namespace std;
int main() {
string List[10] = {"BBBB", "DDDD", "MMMM", "XXXX"};
int n = 4; // Current number of names
// Function to insert a name alphabetically
auto insertName = [&](string newName) {
int i = n - 1;
while (i >= 0 && List[i]... | ALGO | 0.998881 | 5.603144 |
3f0d5670-f642-4e70-937c-b56fb356c029 | knockcat/Leetcode | 0130-surrounded-regions/0130-surrounded-regions.cpp | class Solution {
public:
void dfs(int x , int y, int n, int m, vector<vector<bool>>& visited, vector<vector<char>>& board, vector<int>& dx, vector<int>& dy)
{
visited[x][y] = true;
for(int i = 0; i < 4; ++i)
{
int newx = dx[i] + x;
int newy = dy[i] +... | ALGO | 0.999911 | 6.255345 |
0f823001-96fa-415d-9c5c-59857a7673c4 | jdg824/CodingTestArchive | 프로그래머스/1/12934. 정수 제곱근 판별/정수 제곱근 판별.cpp | #include <string>
#include <vector>
#include <math.h>
#include <iostream>
using namespace std;
long long solution(long long n) {
long long answer = 0;
long long ans = sqrt(n);
if(ans * ans == n)
answer = pow(ans+1,2);
else
answer = -1;
return answer;
} | ALGO | 0.99987 | 5.041405 |
28e8964e-c0fe-4371-8798-8a50a4c79ba5 | PeregrineFalcon95/Online-Judge-Ex.-Uva-Solutions | 11000 - 11999/11678.cpp | #pragma comment(linker, "/stack:200000000")
#include<bits/stdc++.h>
using namespace std;
#define MOD 2117566807LL//(1e9+7)
#define P ( long long int )(1e8+7)//102019LL//257LL
#define inf (1e9+7)
#define mxs (int)(2e5+7)
#define ll long long int
int val , n , m , cases , t , a , b , c , d , e , i , j ;
set < int > x , y... | ALGO | 0.999688 | 4.079967 |
bcf9e0d4-4467-4cb8-8889-070637d20cd6 | 8bit-nyk/hslam_ros | src/HSLAM/Thirdparty/opencv-3.4.6/modules/imgproc/src/featureselect.cpp | #include "precomp.hpp"
#include "opencl_kernels_imgproc.hpp"
#include "opencv2/core/openvx/ovx_defs.hpp"
#include <cstdio>
#include <vector>
#include <iostream>
#include <functional>
namespace cv
{
#ifdef CV_CXX11
struct greaterThanPtr
#else
struct greaterThanPtr : public std::binary_function<const float *, const f... | ALGO | 0.995307 | 6.616395 |
8cb37062-0b0b-47e5-ae76-a1833a7c1975 | ntp0202/ntp020 | Lab5.Bai2.cpp | #include <iostream>
#include <vector>
using namespace std;
class SinhVien
{
protected:
int MSSV, tongSoTinChi;
string hoTen, diaChi;
float diemTB;
bool tinhTrangTotNghiep;
public:
SinhVien() {}
SinhVien(int MSSV, string hoTen, string diaChi, int tongSoTinChi, float diemTB) :
MSSV(MSSV), hoTen(hoTen),
diaC... | TOOL | 0.90898 | 4.66507 |
e97a9d93-8523-443c-8703-cec0ca389b62 | adityarawat1337x/DSA | 886-possible-bipartition/886-possible-bipartition.cpp | class Solution {
public:
bool isbipartite(vector<int> adj[],vector<int> &color,int &node){
queue<int> q;
q.push(node);
color[node]=1;
while(!q.empty()){
int x = q.front();
q.pop();
for(auto next:adj[x]){
if(!color[next]... | ALGO | 0.999929 | 5.806242 |
02c07591-a255-46ed-bbb9-cdab003bbe2f | nikolanan/CppBasics | oldLibrary2/oldLibrary2.cpp | #include <iostream>
#include <string>
using namespace std;
int main()
{
string favoriteBook;
getline(cin, favoriteBook);
int counter = 0;
string nextBookName;
getline(cin, nextBookName);
bool isFound = false;
while (nextBookName != "No More Books") {
if (nextBookName == favorit... | ALGO | 0.999303 | 4.659832 |
b6f83729-5069-442f-a8a2-dcb243be6f98 | JonathanHoshi/22s2-cp-spa-team-34 | Team34/Code34/src/spa/src/pkb/tables/NextTable.cpp | #include "NextTable.h"
#include "common/CollectionUtils.h"
void NextTable::clearNextT() {
computedAll = false;
keyToValTEntries = BaseMapSet<int, int>();
valToKeyTEntries = BaseMapSet<int, int>();
}
void NextTable::addNext(const int& front, const int& back) {
this->keyToValEntries.addEntry(front, back... | ALGO | 0.88303 | 5.833548 |
5d8eb270-077f-48f8-94bd-a2ff7f465fcd | oneshikaa/practice_codes_cpp | c++ lab assignments/lab8_1.cpp | #include<iostream>
#include<iomanip>
using namespace std;
int main(){
int x = -3;
long y = 3.456678;
cout<<showpos<<x<<endl;
cout<<noshowpos<<x<<endl;
cout<<setprecision(6)<<y<<endl;
cout<<setw(4)<<y;
return 0;
} | TOOL | 0.977982 | 3.213137 |
5eb80a4a-78e5-4362-a782-507777f03161 | JoaoGabrielRA/Compiladores | Testes/teste4.cpp | int main()
{
int i; int j; float v; float x; float a[100]; bool flag;
flag = true;
while (flag)
{
do
{
i = i+1;
}
while (a[i] < v);
do
{
j = j-1;
}
while (a[j] > v);
if (i >= j)
... | ALGO | 0.999993 | 3.347148 |
403dbac3-3cfa-47c2-9189-328409be9d0b | ishandutta2007/codeforces | yarek/normal/542/F.cpp | #include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;
vector<int> vec[1000];
int t[1000];
int q[1000];
int main()
{
int n, T;
scanf("%d %d", &n, &T);
for(int i = 0; i < n; i++)
{
scanf("%d %d", t + i, q + i);
vec[T - t[i]].push_back(q[i]);
}
for(int i = T; i > 0; i--)... | ALGO | 0.999979 | 3.282047 |
238d1d81-2e35-499d-988a-b2daad4f443f | nakib1948/Competitive-programming | F_Way_Too_Long_Words.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (i = 0; i < n; i++)
int main()
{
ll t,i,l;
string s;
cin>>t;
while(t--)
{
cin>>s;
l=s.size();
if(l<=10)
{
cout<<s<<endl;
}
else
{
cout<<s[0]<<... | ALGO | 0.999846 | 3.312709 |
647840b4-2e38-4952-82e0-b0e548f3077d | ADVRHumanoids/ct | ct_optcon/examples/LQR.cpp | /*!
* Simple example how to linearize a system and design an LQR controller.
*
* \example LQR.cpp
*/
#include <ct/optcon/optcon.h> // also includes ct_core
#include "exampleDir.h"
int main(int argc, char** argv)
{
// get the state and control input dimension of the oscillator
const size_t state_dim = ct:... | ALGO | 0.996351 | 6.636628 |
f730fadd-9671-432e-8c99-118713f005f1 | silence0201/iOS-Reverse | Obfuscator/Source/projects/libcxx/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/eval.pass.cpp | // <random>
// class bernoulli_distribution
// template<class _URNG> result_type operator()(_URNG& g);
#include <random>
#include <numeric>
#include <vector>
#include <cassert>
#include <cstddef>
template <class T>
inline
T
sqr(T x)
{
return x * x;
}
int main()
{
{
typedef std::bernoulli_distributi... | TEST | 0.941917 | 5.746401 |
e8133040-ef15-4e8e-9596-2f76b958d559 | raincross7/code-similarity | codes/train_code/problem370/problem370_1.cpp | #include<bits/stdc++.h>
using std::vector;
struct edge {
int to;
int cost;
};
int dist[100100];
vector<edge> G[100100];
bool chk[100100];
int main() {
int n, m;
scanf("%d%d", &n, &m);
for (int i = 0; i < m; i++) {
int l, r, d;
scanf("%d%d%d", &l, &r, &d);
G[l].push_back({ r,d });
G[r].push_back({ l,-d })... | ALGO | 0.999998 | 4.342631 |
a4c8fe7b-e300-4ebe-aed3-1f7531dc7710 | vfolunin/archives-solutions | UVa Online Judge/10860.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <string>
using namespace std;
bool contains(string &s, int to, string &part) {
for (int i = to, j = part.size() - 1; j >= 0; i--, j--)
if (s[i] != part[j])
return 0;
return 1;
}
void solve(int... | ALGO | 0.999812 | 4.034029 |
d9a3cedd-c2ff-4a5b-9c9c-16d403255779 | Akhil-ps-dev/flutter_bloc_road_map | 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 |
9b62c963-5cbf-4b99-8508-6312f6d1bf49 | squaresLab/BatFix | results/transcoder/results/python/syntax/LEXICOGRAPHICALLY_NEXT_STRING.cpp | #include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <fstream>
#include <iomanip>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <numeric>
#include <algorithm>
using namespace std;
string f_gold ( string s ) {
if ( s == "" ) re... | ALGO | 0.987216 | 4.703271 |
e7466f29-44ea-4abc-a476-cf4fe796efe9 | pasumi/pasumi | src/motion_model.cpp | #include <cstdlib>
#include <ctime>
#include <time.h>
#include <iostream>
#include <chrono>
#include <iostream>
#include <fstream>
#include <sstream>
#include "motion_model.h"
#include "math.hpp"
#include "config.h"
motion_model::motion_model() {
}
motion_model::motion_model(int waypoints, int paths, PATH_MODEL pat... | TOOL | 0.954235 | 4.110323 |
50dfbb3d-cf9f-4b5c-b301-504642f043b5 | Abhiram-108/leetcode | 2461-amount-of-time-for-binary-tree-to-be-infected/amount-of-time-for-binary-tree-to-be-infected.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.99999 | 6.308878 |
bd5e0396-b312-4208-b87c-c1034752bbbe | samadhansk/competitive-programming | Spirally_traversing_a_matrix_1.cpp | // { Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution
{
public:
//Function to return a list of integers denoting spiral traversal of matrix.
vector<int> spirallyTraverse(vector<vector<int> > matrix, int r, int c)
{
// vector<int> Solu... | ALGO | 0.999872 | 4.941268 |
e7ed7bc0-bb54-40fa-8ce6-bb6f9874d222 | DaAlG/code_studying | jeehyun/개별문제/Baekjoon/5618_공약수.cpp | /*
* 수학
* 5618 공약수
*/
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
int gcd(int a, int b)
{
while (b != 0) {
int r = a % b;
a = b;
b = r;
}
return a;
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n;
cin >> n;
int ... | ALGO | 0.999985 | 4.469274 |
ab60f37c-0406-4c68-b85c-7b151b36ccdf | rupali-12/Leetcode-Problems | Huffman Encoding - GFG/huffman-encoding.cpp | //{ Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Node{
public:
int data;
Node* left;
Node* right;
Node(int d){
data = d;
left =right =NULL;
}
};
class cmp{
public:
bool operator()(Node* a, Node* b){
return a->data > b-... | ALGO | 0.999986 | 5.61142 |
86d9dccf-272f-464f-9d9d-0d1aca0faa3a | adong001/C-DS-CPP | Boost库/boost_1_58_0/libs/numeric/ublas/doc/samples/banded_adaptor.cpp | #include <boost/numeric/ublas/banded.hpp>
#include <boost/numeric/ublas/io.hpp>
int main () {
using namespace boost::numeric::ublas;
matrix<double> m (3, 3);
banded_adaptor<matrix<double> > ba (m, 1, 1);
for (signed i = 0; i < signed (ba.size1 ()); ++ i)
for (signed j = (std::max) (i - 1, 0); j... | ALGO | 0.986514 | 3.642051 |
73b4f559-a2f8-4f0a-90b6-5a7cdd78bac1 | YMDragon/OJ-code | codeforces/494/C.cpp | #include <algorithm>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <vector>
#include <cmath>
using namespace std;
struct node{int l,r; double p;}a[5010];
int n,q,st[100010][20],mx[100010];
double ans,f[5010][5010];
bool g[5010][5010];
vector <int> V[100010];
bool cmp(node x,nod... | ALGO | 0.998967 | 3.607865 |
78a38ac4-6378-4599-be5d-54b16507ba91 | gatsoulis/cappocacciaactivevision | gabriele_detectobj.cpp | #include "cv.h"
#include "highgui.h"
#include "CSCData.h"
#include "CSCEllipticRegions.h"
#include "CSCMatrix2D.h"
#include "gabordescriptor.h"
#include "gaborfilter.h"
#include "harrisdetector.h"
#include "inputconnector.h"
#include "module.h"
#include "outputconnector.h"
#include "serializer.h"
#include "cvimage.h"
... | ALGO | 0.976922 | 3.859351 |
03edcf5b-90ff-4c2e-beb6-d5517621931b | heaoshidalao/frist | 620/620/621.cpp | #define _CRT_SECURE_NO_WARNINGS 1
//1.ģʵstrncpy
#if 0
#include<stdio.h>
#include<stdlib.h>
#include<assert.h>
char* mystrcpy(char *dest , const char*scr,int n)
{
char *p = dest;
int i = 0;
assert((dest!=NULL)&&(scr!=NULL));
while ((i < n) && (*dest++ = *scr++))
{
i++;
};
*dest='\0';
return p;
}
int main()
{
... | ALGO | 0.953356 | 3.243881 |
d0eec05c-9f4c-494c-876e-bae0fdbbad62 | MrAlexandrov/test | cpp/Contests/NlogN array 2 with star/C/main.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
///freopen("input.in", "r", stdin);
///freopen("output.out", "w", stdout);
int n;
cin >> n;
deque <int> a(n);
for (int &i : a) {
cin >> i;
}
... | ALGO | 0.999983 | 3.602351 |
793afb1e-6548-4808-bd71-797e0d9c22fa | VINAYAK308/Coding_Practice_Group_2_Vinayak | Write a program to convert Binary into Decimal.cpp | #include<iostream>
#include<math.h>
using namespace std;
int main()
{
int temp,i=0,num,rem,dec=0;
cout<<"\n Enter Binary Number: ";
cin>>num;
temp=num;
while(temp>0)
{
rem=temp%10;
dec=dec+rem*pow(2,i);
i++;
temp=temp/10;
}
cout<<"\n Conversion of entered... | ALGO | 0.998201 | 3.600246 |
c8450743-ef26-4820-bbc5-c3e56b7b5009 | TYRMars/Cpp-StepPitGuide | Algorithms/original/07-Graph-Basics/03-Vertex Adjacent Iterator/main.cpp | #include <iostream>
#include "SparseGraph.h"
#include "DenseGraph.h"
using namespace std;
int main() {
int N = 20;
int M = 100;
srand( time(NULL) );
// Sparse Graph
SparseGraph g1(N , false);
for( int i = 0 ; i < M ; i ++ ){
int a = rand()%N;
int b = rand()%N;
g1.add... | ALGO | 0.994397 | 4.459297 |
ea53e1c8-018d-4d53-a907-6666390b29c6 | iamritik19/DSA | Recursion/Beginner/firstoccuranceofelements.cpp | #include<iostream>
#include<climits>
void fun(int *arr,int n,int i,int target,int &ans){
if(i==n) return;
if(arr[i]==target){
ans=i;
return;
}
fun(arr,n,i+1,target,ans);
}
int main(){
int n;
std::cin>>n;
int arr[10];
for(int i=0;i<n;i++){
std::cin>>arr[i];
}
int target;
std::cin>>target;
int ans=-1;
fun(arr,n... | ALGO | 0.999951 | 5.798368 |
03b7e6df-c2fe-417f-8222-8308b844fc2b | cvonelm/masterarbeit_software | gem5/src/systemc/tests/systemc/misc/v1.0/dash6/pulse.cpp | /*****************************************************************************
pulse.cpp -- Implementation of the pulse generator.
Original Author: Ali Dasdan, Synopsys, Inc.
*****************************************************************************/
/*****************************************************... | TOOL | 0.915399 | 6.27887 |
c7438aa8-35aa-408d-bc34-376a3af377c6 | BilyZ98/BilyZ98.github.io | code/cpp/thread-local/main.cpp | #include <iostream>
#include <thread>
void add(int n) {
thread_local int count = 0;
// static thread_local int count = 0; // 两种写法等价!
count += n;
// 休眠n秒,防止输出时数据交错(Mac会出现)
std::this_thread::sleep_for(std::chrono::seconds(n));
std::cout<<std::this_thread::get_id()<<":"<<count<<std::endl;
}
int m... | TOOL | 0.898382 | 4.231678 |
829b5d5e-d516-4edf-af60-a11fad8b5fb6 | ishandutta2007/codeforces | lzr_010506/normal/743/B.cpp | #include <bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
int n;
ll k;
cin >> n >> k;
ll x = 1ll;
for(int i = 1; i <= n; i ++) x *= 2ll;
for(int i = n; i >= 1; i --)
{
if(k == x / 2) {cout << i; return 0;}
if(k > x / 2) k = x - k;
x /= 2ll;
}
return 0;
} | ALGO | 0.999977 | 3.758941 |
51f2a5d5-624d-480d-b1e1-54fc98e9af87 | likitd/-6Companies30days | Microsoft week-1/Envelopes and Dolls.cpp | //TLE
// class Solution {
// public:
// int maxEnvelopes(vector<vector<int>>& envelopes) {
// vector<int>dp(envelopes.size(),1);
// sort(envelopes.begin(),envelopes.end());
// for(int i=0;i<envelopes.size();i++){
// for(int j=0;j<i;j++){
// if(envelopes[i][0] > en... | ALGO | 0.999978 | 5.88938 |
43933c9f-2903-47dc-832c-21e467acec24 | mohneesh20/Cpp | Array/3SumClosest.cpp | #include<bits/stdc++.h>
using namespace std;
void threeSumClosest(vector<int>& nums,int target){
sort(nums.begin(),nums.end());
int i=0,j=nums.size()-1,k=i+1;
int mnDif=INT32_MAX;
int ans=-1;
while(i<j){
j=nums.size()-1;
k=i+1;
int prev=nums[i];
while(k<j){
... | ALGO | 0.999996 | 5.500457 |
d3c16ae0-08a7-4036-a0bc-bc4a563d68d5 | Lennethe/CPsolved | CodeForces/EDF63/E.cpp | //#define _GLIBCXX_DEBUG
#include <iostream>
#include <vector>
#include <stdio.h>
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define P pair<ll,ll>
#define FOR(i,n,m) for(ll i=n; i<(ll)m;i++)
#define FORa(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#defi... | ALGO | 0.999796 | 3.904155 |
b970d052-af12-41e5-a142-a2a22f758886 | wangtongxue-369/xcpc_Code_file | file/nowcoder/97908/B.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define INF 0x3f3f3f3f
#define PII pair<ll, ll>
const ll mod = 1e9 + 7;
const ll MAXN = 500005;
const ll base1 = 131;
const ll base2 = 127;
ll _ = 1, n, m, ans = 0, a[110][110]; // f[MAXN];
struct node
{
ll x, y;
s... | ALGO | 0.999463 | 3.632225 |
3a6ad5d3-e5fa-4990-b61f-1503c5c4369c | lcheng-ENME202/cpp-lecture-notes | 4g_functions_vecfun1.cpp | // ENME 202
// 4g_functions_vecfun1.cpp
// Functions - vector math example (1/2)
#include <iostream>
#include <cmath>
using namespace std;
// C++ cannot evaluate a statement like "v3 = v1+v2"
// when v1, v2, and v3 are arrays.
//
// Let us try to write a function to duplicate the Matlab
// behavior for v3 = v1 + v2.... | ALGO | 0.990402 | 4.820458 |
dbbb5350-b8f6-4441-98d3-290755b43431 | xiezy0/palisade-extend | src/pke/lib/scheme/bfvrnsb/bfvrnsB.cpp | // @file bfvrnsB.cpp - implementation of the BEHZ variant of BFVrns.
// @author TPOC: <EMAIL>
//
// @copyright Copyright (c) 2019, New Jersey Institute of Technology (NJIT)
// All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the foll... | TOOL | 0.963271 | 7.078026 |
ad8fb852-bab2-4aad-88ed-e922ebb3ae3c | kgorking/AdventOfCode | 2015/day19/day19.cpp | #include <iostream>
#include <string>
#include <unordered_set>
#include <algorithm>
#include <array>
int main() {
std::string const molecule = "<BASE64_DATA>";
std::array<std::pair<std::string, std::string>, 43> replacements{ {
{"Al", "ThF"},
{"Al", "ThRnFAr"},
{"B", "BCa"},
{"B", "TiB"},
{"B", "TiRnFAr"}... | ALGO | 0.997828 | 4.213019 |
cdb76356-3faa-4a72-9bf7-4f51b185278d | liuriloami-zz/competitive-programming | URI/1072.cpp | #include <bits/stdc++.h>
using namespace std;
int main (int argc, char** argv) {
int n, x, count = 0;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> x;
if (x >= 10 && x <= 20) count++;
}
cout << count << " in\n";
cout << n-count << " out\n";
return 0;
}
| ALGO | 0.996194 | 3.372757 |
354bfade-f86f-455f-b44f-ce3553776095 | tzupengwang/PECaveros | contest/opencup/XVII/Siberia/6_old.cpp | #include <bits/stdc++.h>
using namespace std;
#define N 101010
#define M 514
vector<int> v;
int p[ N ];
int f( int x ){
return x == p[ x ] ? x : p[ x ] = f( p[ x ] );
}
void uni( int x , int y ){
p[ f( x ) ] = f( y );
}
int b , m , nxt[ M ][ M ];
bool same[ M ][ M ];
bool inc[ M ][ M ];
bool gt[ M ][ M ];
bool ac[ ... | ALGO | 0.999878 | 4.151134 |
930952c7-e192-4e79-b40c-ff64075d2230 | Brave123555/leetcod1 | solution/2900-2999/2998.Minimum Number of Operations to Make X and Y Equal/Solution.cpp | class Solution {
public:
int minimumOperationsToMakeEqual(int x, int y) {
unordered_map<int, int> f;
function<int(int)> dfs = [&](int x) {
if (y >= x) {
return y - x;
}
if (f.count(x)) {
return f[x];
}
int a ... | ALGO | 0.999941 | 5.733235 |
f9402539-8d2b-4466-85d4-84a7b0be8a2b | ARYAMAN-2001/Competitive-Programming | CodeForces/GNU C++20 (64)/1678E | Tokitsukaze and Two Colorful Tapes/156388645.cpp | //****************************Template Begins****************************//
// Header Files
#include <bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<vector>
#include<utility>
#include<set>
#include<unordered_set>
#include<list>
#include<iterator>
#include<deque>
#include<queue>
#include<stack>
#include<... | ALGO | 0.999918 | 4.51474 |
27f2cb5a-9e74-4c2d-a24c-bab471725f5f | eshaalal/eshacodesdsa | pattern3.cpp | #include<iostream>
using namespace std;
int main(){
cout<<"enter the number of rows you want";
int n;
cin>>n;
int row=1;
while(row<=n){
int column=1;
while(column<=row){
cout<<row-column+1;
column+=1;
}
cout<<endl;
row+=1;
}
} | ALGO | 0.999896 | 3.914639 |
561160bd-3934-4a74-9c66-654f205d1cae | injoon149/codetree-TILs | 240828/뿌요뿌요/puyo-puyo.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
bool visited[101][101] = {false, };
int arr[101][101] = {0, };
int n;
int counter = 0;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, -1, 0, 1};
bool InRange(int x, int y)
{
return (0<=x && x < n && 0<=y && y < n);
}
bool CanGo(int x, i... | ALGO | 0.999943 | 4.789517 |
88faa4af-33b6-45bc-95a1-cd09dff8fecc | Minipoloalex/comp_prog | codeforces/themecp/4/C/C.cpp | #include <bits/stdc++.h>
using namespace std;
void solve() {
int n;
cin >> n;
vector<int> a(n);
for (auto &x: a) cin >> x;
int64_t total = 0, cur_value = 0, acc_value = 0;
for (int i = n - 1; i >= 0; i--) {
// cout << i << " " << cur_value << " " << acc_value << " " << total << endl;
... | ALGO | 0.999891 | 5.094248 |
e538142e-1897-43d6-b736-43f5c52db836 | raincross7/code-similarity | codes/train_code/problem287/problem287_184.cpp | #include<iostream>
#include<tuple>
#include<vector>
#include<algorithm>
#include<iterator>
#include<cmath>
#include<functional>
#include<map>
using namespace std;
int main(){
int N;
cin >> N;
map<int, int> o, e;
for(int i=0; i<N/2; i++){
int ot, et;
cin >> ot;
cin >> et;
... | ALGO | 0.999873 | 3.489486 |
572337d4-6be8-427a-95af-b62d31074466 | kaloronahuang/KaloronaCodebase | Practices/Fortuna-OJ/FOJ3743.cpp | // FOJ3743.cpp
#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 1e5 + 200;
void fileIO() { freopen("alice.in", "r", stdin), freopen("alice.out", "w", stdout); }
int head[MAX_N], current, last[MAX_N], ai[MAX_N], n, nodes[MAX_N], dfn[MAX_N], ptot;
struct edge
{
int to, nxt;
} edges[MAX_N << 1];
v... | ALGO | 0.999952 | 3.82895 |
8248141d-5d64-401e-adfd-f9ab79495086 | shreenidhisr/Computer-Graphics | 9/Liang_basky_lineClipping.cpp | #include <stdio.h>
#include <GL/glut.h>
double xmin=50,ymin=50, xmax=100,ymax=100; // Window boundaries
double xvmin=200,yvmin=200,xvmax=300,yvmax=300; // Viewport boundaries
int cliptest(double p, double q, double *u1, double *u2)
{
double r;
if(p) r=q/p; // to check whether p
if(p < 0.0) // potentiall... | ALGO | 0.997994 | 5.051517 |
aa992fb6-4de3-4272-a5b6-f8825166dd2b | harungunaydin/Competitive-Programming-Solutions | IOI/IOI 98/2.Gün/(+)Picture.cpp | #include <iostream>
#include <algorithm>
#include <cstdio>
#define FOR(i,a,b) for(i=a; i<=b; i++)
#define FOR2(i,n) FOR(i,0,n-1)
#define INPUT "picture.in"
#define OUTPUT "picture.out"
#define MAXN 100000
#define MAXL 10005
using namespace std;
FILE *in,*out;
class line
{
public:
int bas,x,son;
bool is_first;
}A[... | ALGO | 0.999527 | 3.485398 |
7aadfb61-bbce-4bb8-9b1d-cec4a12c8485 | giuseppeambrosio97/competitive_programming | cpp/leetcode/2.cpp | #include <bits/stdc++.h>
using namespace std;
struct ListNode
{
int val;
ListNode *next;
ListNode() : val(0), next(nullptr) {}
ListNode(int x) : val(x), next(nullptr) {}
ListNode(int x, ListNode *next) : val(x), next(next) {}
};
class Solution
{
public:
ListNode *addTwoNumbers(ListNode *l1, L... | ALGO | 0.999971 | 6.146953 |
26de7723-2cea-4140-8794-db045022d7ce | eikei54/kisokaraCpp | KisokaraCpp-samples/11/11-fexcepts.cpp | #include <iostream>
#include <cmath>
#include <cfenv>
using namespace std;
void report_fexcepts() {
if (fetestexcept(FE_DIVBYZERO)) cout << "FE_DIVBYZERO\n";
if (fetestexcept(FE_INEXACT)) cout << "FE_INEXACT\n";
if (fetestexcept(FE_OVERFLOW)) cout << "FE_OVERFLOW\n";
if (fetestexcept(FE_UNDERFLOW)) cout << ... | ALGO | 0.911334 | 3.467328 |
62afbf42-b2f2-42f5-a200-ad61a99b91cd | roddykou/Mesos | src/master/flags.cpp | #include <mesos/type_utils.hpp>
#include <stout/flags.hpp>
#include "common/http.hpp"
#include "common/parse.hpp"
#include "master/constants.hpp"
#include "master/flags.hpp"
using std::string;
mesos::internal::master::Flags::Flags()
{
add(&Flags::version,
"version",
"Show version and exit.",
fal... | CONFIG | 0.85136 | 6.192971 |
44aacb3c-813e-4514-b55c-f8c832371425 | ishandutta2007/codeforces | rocketcider/normal/1684/B.cpp | #include<bits/stdc++.h>
using namespace std;
#define ri register int
#define DEBUG(k...) fprintf(stderr,k)
typedef long long ll;
template<class T>inline bool ckmax(T &x,const T &y){return x<y?x=y,true:false;}
template<class T>inline bool ckmin(T &x,const T &y){return x>y?x=y,true:false;}
const int maxn=2e5+10;
int a,b,... | ALGO | 0.999875 | 3.713629 |
cea5b44d-34e1-4f08-8ee7-2faaf6a84020 | IAmWaseem/C---Programs | CP/quest 5.cpp |
#include<iostream>
#include<conio.h>
#include<math.h>
using namespace std;
int factorial1(int);
int factorial2(int);
int factorial3(int ,int);
void binomial(int ,int);
int main()
{
int n,m;
cout<<"Enter first value:";
cin>>n;
cout<<"Enter second value:";
cin>>m;
binomial(n,m);
getch();
return 0;
}
int factoria... | ALGO | 0.999851 | 3.826182 |
54e67bf2-2575-460b-8242-be970d5327f4 | rajesh-ss/smart_receptionist | raspberry_pi_code/opencv-master/samples/cpp/calibration.cpp | #include "opencv2/core.hpp"
#include <opencv2/core/utility.hpp>
#include "opencv2/imgproc.hpp"
#include "opencv2/calib3d.hpp"
#include "opencv2/imgcodecs.hpp"
#include "opencv2/videoio.hpp"
#include "opencv2/highgui.hpp"
#include <cctype>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <iostream>
us... | TOOL | 0.952071 | 4.057175 |
d66b4fb9-b27e-47bb-afda-86a9e1be137b | BunnyWarlock/My_CompetitiveProgramming_Library | Algorithms/Graph/Centroid Decomposition.cpp | // Author: Sahil Yasar, Johan Sannemo, pajenegod, chilli
// Tested here:
// https://codeforces.com/contest/321/problem/C
// https://codeforces.com/problemset/problem/342/E
#include <iostream>
#include <vector>
#include <bitset>
#include <algorithm>
#include <tuple>
using namespace std;
#define endl '\n'
const int MAX... | ALGO | 0.99993 | 4.777226 |
57a07d2f-b8d6-42d5-a5b1-e93ea768ada1 | mohsinkhan045/fullter_Apps | tasbeeh/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.99823 | 6.763549 |
55a1a1b3-839f-45a4-bc3a-664b8a69a9fe | hhandoo/learn_programming | problems/arrays/other/268_Missing_Number.cpp | #include <iostream>
#include <vector>
#include <unordered_map>
using namespace std;
int usingHashmap(vector<int> &nums)
{
// unordered_map<int, bool> mymap;
// int n = nums.size() + 1;
// for (int x : nums)
// {
// mymap[x] = true;
// }
// for (int i = 1; i <= n; i++)
// {
//... | ALGO | 0.999796 | 5.2451 |
f6f38853-4406-4a63-9a45-8e2d75efe600 | Jan-Jasa/Booth_CSI1430 | Class project/main.cpp | #include <iostream>
#include "SDL_Plotter.h"
#include <cmath>
#include <fstream>
#include "snakeStuff.h"
#include <iomanip>
#include <string>
#include <sstream>
#include <vector>
using namespace std;
const int NUM_ROW = 750;
const int NUM_COL = 1000;
enum Direction {UP, DOWN, LEFT, RIGHT};
int main(int argc, char *... | TOOL | 0.930621 | 5.282123 |
260501b5-1de4-4fb9-8900-5717f8d06027 | Adiboy77/solved_GrindLC | Add Two Numbers.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
//Learnt that make sure you check what you are ret... | ALGO | 0.99987 | 6.352497 |
e1e283dd-0556-478e-b356-4f1bcb1b3c0a | RahulGhosh201/babbar_dsa_pl | Searching/no of occurences.cpp | // ip: 0,1,1,5 k=5
// op: 1
#include <bits/stdc++.h>
using namespace std;
int firstOccurence(int arr[], int n, int k)
{
int start = 0, end = n - 1, ans = -1;
int mid = (start + end) / 2;
while (start <= end)
{
if (arr[mid] == k)
{
ans = mid;
end = mid - 1;
... | ALGO | 0.999984 | 5.245249 |
490afc49-c62f-4fcd-a234-d5a10fc8b85c | xdtianyu/android-4.2_r1 | frameworks/av/media/libstagefright/codecs/amrnb/dec/src/dec_lag3.cpp | /*
------------------------------------------------------------------------------
Pathname: ./audio/gsm-amr/c/src/dec_lag3.c
Functions: Dec_lag3
Date: 01/31/2002
------------------------------------------------------------------------------
REVISION HISTORY
Description:
(1) Updated to accept new parameter... | ALGO | 0.9999 | 7.141467 |
ae40622c-cd58-425e-ba61-22b0891bf02d | xchmwang/algorithm | basic/tree_traversal/preorder.cpp | #include <deque>
#include <stack>
#include <vector>
struct TreeNode {
int val;
TreeNode *left;
TreeNode *right;
TreeNode(int x): val(x), left(NULL), right(NULL) {}
};
class Solution {
public:
vector<int> preorderTraversal(TreeNode* root) {
vector<int> v;
stack<TreeNode*> st;
TreeNode ... | ALGO | 0.99999 | 6.110739 |
dbb826fd-2d1d-43d0-b0c8-03adae578736 | cy1366371760/CP | cf2004/e/sol.cpp | #include<bits/stdc++.h>
#define ll long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define eb emplace_back
#define fi first
#define sc second
#define pii pair<int, int>
#define pll pair<ll, ll>
template<typename T> bool chkmin(T &a, T b){return (b < a) ? a... | ALGO | 0.999985 | 4.933003 |
71c4efca-c431-4b38-b61e-a54b181108cd | koosaga/olympiad | USACO/mar09_damage2.cpp | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <string>
#include <functional>
#include <vector>
#include <numeric>
#include <deque>
#include <utility>
#include <bitset>
#includ... | ALGO | 0.999961 | 3.716628 |
b38f0b67-f08b-4594-bf64-a71fb09dd6e6 | CHiiii5640/2023aaia3 | week07/week07-3(a).cpp | class Solution {
public:
bool judgeCircle(string moves) {
int x=0,y=0;
for(char c:moves)
{
if(c=='U')
y--;
if(c=='D')
y++;
if(c=='L')
x--;
if(c=='R')
x++;
}
if(x==0... | ALGO | 0.999812 | 6.058704 |
f6e3ec7a-6d3f-4588-8def-7e1b5397ac29 | Vignesh750/Recursion | 1_to_n.cpp | #include <iostream>
using namespace std;
//! Program to print the number from 1 to n;
//!
void fun(int n)
{
if (n == 0)
{
return;
}
fun(n - 1);
cout << n << " ";
}
int main()
{
int n;
cout << "This program prints the numbers from 1 to n.\nEnter the number n: ";
cin >> n;
fun(n);
return 0;
} | ALGO | 0.983984 | 4.198082 |
b3a45a80-f1f7-4d4e-9c31-05469f3e9225 | GulSauce/codetree-TILs | 240217/문자열 정렬/string-sort.cpp | #include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main() {
string str; cin >> str;
sort(str.begin(), str.end());
cout << str;
return 0;
} | ALGO | 0.99983 | 5.135111 |
0aed56b7-2abd-481a-b3dd-f58f11118c9b | DouZyTan/FastLSHForMachineLearning | Neuron Network Training/SLIDE-FastSLIDE/SLIDE/LSH.cpp | #include <iostream>
#include <unordered_map>
#include "LSH.h"
#include <climits>
#include "Config.h"
#include <chrono>
using namespace std;
LSH::LSH(int K, int L, int RangePow)
{
_K = K;
_L = L;
_RangePow = RangePow;
_bucket = new Bucket*[L];
//#pragma omp parallel for
for (int i = 0; i < L; i++)
{
_bucket[i... | TOOL | 0.96964 | 3.592091 |
10f4a2c2-119e-4e43-8491-95f1d4d28aef | Dup4/competitive-programming | atcoder/abc128/b.cpp | #include <bits/stdc++.h>
using namespace std;
#define N 110
int n;
struct node {
string name;
int a, id;
void scan(int id) {
this->id = id;
cin >> name >> a;
}
bool operator<(const node &other) const {
if (name != other.name) {
return name < other.name;
}... | ALGO | 0.999517 | 3.911849 |
ea260203-be3d-4a4e-ab91-f6e9e7b63a24 | vmichal/Competitive | ACM/2019-winter/2/time_to_live.cpp | #include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
std::vector<int> distances(std::vector<std::vector<int>> const& graph, int start) {
int const V = graph.size();
std::vector<int> distances(V, -1);
distances[start] = 0;
std::queue<int> queue;
queue.push(start);
while (!queue.empty()) ... | ALGO | 0.998972 | 5.197133 |
a070f261-140d-4b15-b0f5-c3f84602daf5 | rishabraghav/dataStructure | LinkedList/RemoveNthNODE.cpp | struct ListNode {
int val;
ListNode *next;
ListNode() : val(0), next(nullptr) {}
ListNode(int x) : val(x), next(nullptr) {}
ListNode(int x, ListNode *next) : val(x), next(next) {}
};
class Solution {
public:
int length(ListNode* head) {
ListNode* current = head;
in... | ALGO | 0.999925 | 6.027647 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.