uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
f47d7ec2-9ea2-4053-a6d4-43eaf6d1172b | Ben1524/cxkframework | cxk/util/hash_util.cpp | #include "hash_util.h"
#include <algorithm>
#include <stdexcept>
#include <string.h>
#include <openssl/md5.h>
#include <openssl/sha.h>
namespace cxk {
#define ROTL(x, r) ((x << r) | (x >> (32 - r)))
static inline uint32_t fmix32(uint32_t h)
{
h ^= h >> 16;
h *= 0x85ebca6b;
h ^= h >> 13;
h *= 0xc2b2ae35;
h ^= ... | ALGO | 0.977033 | 6.542903 |
0269e668-a209-494b-af88-a4765476fb34 | Rahul-Chhabra-27/Interview_Preparation | Bits_Manipulation/SubarrayXor.cpp | #include<bits/stdc++.h>
using namespace std;
int countSubarrays(int *nums,int n,int k) {
unordered_map<int,int>map;
map[0] = 1;
int cnt = 0;
int currXor = 0;
for(int i = 0;i<n;i++) {
currXor ^= nums[i];
if(map.count(currXor^k)) {
cnt += map[currXor^k];
}
map[currXor]++;
}
return cnt;
}
int main(in... | ALGO | 0.999988 | 4.960296 |
e57cef9c-6789-4621-889d-b4af2ff141f8 | aditya-mad/leetcode-solutions | Solutions/2150. Find All Lonely Numbers in the Array.cpp | class Solution
{
public:
vector<int> findLonely(vector<int> &nums)
{
unordered_map<int, int> memo;
vector<int> ans;
for (auto x : nums)
memo[x]++;
for (auto x : nums)
{
if (memo[x] == 1 && memo[x - 1] == 0 && memo[x + 1] == 0)
ans.... | ALGO | 0.999985 | 5.318714 |
acb12526-a9f6-4573-94c6-5106bba911bc | AMReX-Astro/MAESTROeX | Source/MaestroRegrid.cpp |
#include <Maestro.H>
using namespace amrex;
// check to see if we need to regrid, then regrid
void Maestro::Regrid() {
// timer for profiling
BL_PROFILE_VAR("Maestro::Regrid()", Regrid);
// wallclock time
const Real strt_total = ParallelDescriptor::second();
BaseState<Real> rho0_temp(base_geom.... | ALGO | 0.992964 | 6.362737 |
64d4feec-d0d4-481c-b1ce-0d710eff91d4 | izaq-code/izaq-code-Programming-logic-C_plus_plus | C++ - logica da programação/Atividade 1 - Transição da Linguagem/cand.cpp | #include <iostream>
#include <string>
#include <locale>
using namespace std;
int main(int argc, char** argv) {
setlocale(LC_ALL,"portuguese");
int cand,ron,nulo,mes,cr,branco;
do{
cout<<"so candidados os senhores josivaldo, zaracho e edmundo\n";
cout<<"escolha em qual votar\n";
cout<<"1- pica-pau\n";
cout<<"2- di... | ALGO | 0.98818 | 3.769155 |
4404ff30-88b8-4804-bbb5-f3170c9aa72c | arkayyy/leetcode-problems | 2187-minimum-time-to-complete-trips/2187-minimum-time-to-complete-trips.cpp | class Solution {
public:
long long minimumTime(vector<int>& time, int totalTrips) {
// queue<pair<long long,long long>> q;
// for(auto t: time)
// q.push({t,0});
// long long timeCounter = 0;
// //long long inc = *min_element(time.begin(),time.end());
//... | ALGO | 0.999979 | 5.883633 |
68675728-b48e-4b7c-9129-c2f22e48c112 | ishandutta2007/codeforces | zhangzy/normal/786/D.cpp | #pragma GCC target("arch=corei7-avx")
#include<bits/stdc++.h>
using namespace std;
#define rint register int
#define pic pair<int,char>
#define fi first
#define se second
int n, q, hea[22222], ui[22222], vi[22222]; char wi[22222], s[22222];
pic to[44444];
vector<int>ask[22222]; int ans[22222];
int fa[22222], dep[22222... | ALGO | 0.999891 | 3.912045 |
2e83d909-2d8e-4ed5-b646-2ea9bf61e34f | rafaelleru/aoc2021 | 9/9.cpp | #include <iostream>
#include <fstream>
#include <string>
#include <utility>
#include <vector>
void print_grid(std::vector<std::vector<int>>& grid){
for(const auto row: grid) {
for(const auto digit: row)
std::cout << digit;
std::cout << std::endl;
}
}
std::vector<std::vector<int>> parse_input(std::string inpu... | ALGO | 0.99346 | 6.283352 |
e30a9c55-d4e5-42e1-b0a6-98231514c66f | menma-at-here/kyo-pro | ABC/111~120/117/d.cpp | #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include<numeric>
#include<cmath>
#include<map>
#include<iomanip>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9... | ALGO | 0.999971 | 4.112978 |
5f5c5a7e-4f9a-48d4-a947-15412cff4cfc | kabilanmohan/LeetCode-Dailies | BackTracking/78. Subsets.cpp |
/*
Time complexity : O(2^n)
Space complexity : O(2^n)
*/
class Solution {
public:
vector<vector<int>> subsets(vector<int>& nums) {
vector<vector<int>> ans;
vector<int> result;
func_subset(0,nums,ans,result);
return ans;
}
void func_subset(int idx , vector<i... | ALGO | 0.999824 | 6.541935 |
46f5182f-9ea8-4085-8303-4890baa05204 | Evolution-X-AOSP/frameworks_av | media/libmedia/IMediaCodecList.cpp | #include <stdint.h>
#include <sys/types.h>
#include <binder/Parcel.h>
#include <media/stagefright/MediaCodecList.h>
#include <media/IMediaCodecList.h>
#include <media/MediaCodecInfo.h>
#include <utils/Errors.h> // for status_t
namespace android {
enum {
CREATE = IBinder::FIRST_CALL_TRANSACTION,
COUNT_CODEC... | TOOL | 0.897917 | 7.209244 |
9fd8c210-d156-4728-8087-084a46da8678 | 72Rahul/Vector | Vectorbasic.cpp |
#include<iostream>
// STL (Standard Templet Library) use as tool for vector //
#include<vector>
using namespace std;
int main(){
//
// Declare the vector
// vector <int> vec;
// vec = {12, 24, 36, 48, 60};
// cout<<vec[0]<<endl;
// cout<<vec[1]<<endl;
// cout<<vec[2]<<endl;
// cout<<ve... | ALGO | 0.873315 | 3.642815 |
923b45b1-5fb9-441a-bebc-a49e281e2bd5 | EnricoVianelli/LSN_EV | lez2/main1.1.cpp |
#include "random.h"
#include <cmath>
#include <fstream>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
double function(double x) { return (M_PI / 2) * cos(M_PI * x / 2); }
int main(int argc, char *argv[]) {
Random rnd;
int seed[4];
int p1, p2;
ifstream Primes("Primes");
if ... | ALGO | 0.991556 | 3.969112 |
2f546d01-9531-4ed6-811d-c7f92dce68ab | zitengzela/mangos-tbc | src/game/AI/ScriptDevAI/scripts/kalimdor/caverns_of_time/hyjal/boss_archimonde.cpp | /* ScriptData
SDName: Boss_Archimonde
SD%Complete: 100
SDComment: TODO: 2.2 patch - grip of the legion cant hit someone with air burst
SDCategory: Caverns of Time, Mount Hyjal
EndScriptData */
#include "AI/ScriptDevAI/include/sc_common.h"
#include "hyjal.h"
#include "Maps/MapManager.h"
#include "AI/ScriptDevAI/base/Co... | TOOL | 0.958648 | 5.070535 |
9197ae8a-bb78-42ff-86bb-fb448660a87c | geekzzz/IntroToAlgorithm_CPP | PlayGround/876.链表的中间结点.cpp | /*
* @lc app=leetcode.cn id=876 lang=cpp
*
* [876] 链表的中间结点
*/
// @lc code=start
/**
* 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)... | ALGO | 0.999897 | 6.294437 |
8a17fe10-dfba-44a4-b763-6956447b21a3 | felipefonsecadev/uva-solutions | 10635.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int test;
cin >> test;
for (int t = 1; t <= test; t++) {
int n, p1, p2;
cin >> n >> p1 >> p2;
vector<int> v1(p1);
vector<int> v2(p2);
vector<int> dict(n * n, 0);
vector<int> lis;
int lisSize = 0;
for (int i = 0; i < p1 + 1; i++)
cin ... | ALGO | 0.999738 | 3.786165 |
8cabe3d3-5967-4056-96e4-be8fd6f297f7 | tzupengwang/PECaveros | contest/Daejeon/2015/k.cpp | #include <bits/stdc++.h>
using namespace std;
#define N 1021
struct Tree{
char c[ N * 10 ] , clr[ N ];
vector< int > son[ N ];
int n , len , id[ N * 10 ] , pr[ N * 10 ];
int root , sz[ N ];
int go( int l , int r ){
int now = id[ l ];
clr[ now ] = c[ l ];
for( int i = l + 1 ; i <= r ; ){
son[... | ALGO | 0.999486 | 3.557994 |
9c5b9fb0-546a-4484-8a18-80684f34a090 | yuyichao/cs-doc | Programming/C_C++/C++_Primer_Plus中文第四 五版 源码+习题/C++_Primer_Plus中文第四 五版 源码+习题/C++_Primer_Plus 第五版 习题解答 代码/cpp5sol/ch16/toobig.cpp | #include <iostream>
#include <list>
#include <iterator>
template<class T>
class TooBig
{
private:
T cutoff;
public:
TooBig(const T & t) : cutoff(t) {}
bool operator()(const T & v) { return v > cutoff; }
};
int main()
{
using std::list;
using std::cout;
using std::endl;
TooBig<int> f100(100);
list<int>... | TOOL | 0.968224 | 5.029435 |
7f733326-19d8-424d-8c70-dbd761c0555f | ahsabshiraz/gfg-question | 11.LINKED-LIST/21middleOfLL.cpp | #include <bits/stdc++.h>
using namespace std;
struct Node
{
int data;
Node *next;
Node(int x)
{
data = x;
next = NULL;
}
};
void printlist(Node *head)
{
Node *curr = head;
while (curr != NULL)
{
cout << curr->data << " ";
curr = curr->next;
}
cou... | ALGO | 0.999729 | 5.048416 |
143fdb8b-6ad1-4c76-ae4b-b378b19301bc | dbyqs21/My_Code | C++/C++_ProgramTraining/mapSort.cpp | #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
/**< һСڱȽ࣬жT͵ĴС */
template<class T>
struct LESS : binary_function<T,T,bool>
{
bool operator()(const T & x, const T & y)
{
// return x<y; // ֵ˳
return x.length()<y.length(); // ַij... | ALGO | 0.999569 | 4.333321 |
efe9829e-c8fa-4c08-98d8-7bdbac04fa7a | Nefedovich/Task5Nefedov | solver.cpp |
#include "Solver.h"
bool Solver::comp(point a1, point a2, point b1, point b2){
return -dist(a1, a2) - dist(b1, b2) + dist(a1, b1) + dist(a2, b2) < 0;
}
double Solver::path_length(std::vector<point> points, std::vector<int> path){
int n = points.size();
double length = 0;
for(int i = 0; i < n - 1; i++... | ALGO | 0.999956 | 4.255241 |
9acde232-cea8-40e7-a502-afe0c2b7ead8 | openjdkgit/jfx-sandbox | modules/javafx.web/src/main/native/Source/WebCore/platform/graphics/PathUtilities.cpp | #include "config.h"
#include "PathUtilities.h"
#include "AffineTransform.h"
#include "BorderData.h"
#include "FloatPoint.h"
#include "FloatRect.h"
#include "FloatRoundedRect.h"
#include "GeometryUtilities.h"
#include <math.h>
#include <wtf/MathExtras.h>
namespace WebCore {
class FloatPointGraph {
WTF_MAKE_NONCOP... | ALGO | 0.999633 | 7.543091 |
cbed638b-73f9-4479-b0a2-76ed42797bea | Taha-Adeel/CP | Starters 105 (Rated till 6 Stars)/Spooky_Sequences.cpp | #include <bits/stdc++.h>
using namespace std;
#define FAST ios::sync_with_stdio(0); cin.tie(0)
template<class T> struct V: vector<T>{using vector<T>::vector;
void sort() {std::sort(this->begin(), this->end());}
void sort_dsc() {std::sort(this->begin(), this->end(), greater<T>());}
auto sum(... | ALGO | 0.999948 | 5.160051 |
0a23d2cf-9654-4c46-9188-b7d63040b112 | waseem18/LightOJ | 1328.cpp | #include <cstdio>
#include <algorithm>
using namespace std;
typedef long long i64;
const int MAX = 100001;
const i64 MOD = 1000007;
int K, C;
i64 a[MAX], c[MAX];
void gen(int n) {
for(int i = 1; i < n; i++) {
a[i] = (K*a[i - 1] + C) % MOD;
}
}
i64 GetDiffSum(int n) {
i64 sum = 0;
int i, lt, rt;
for(i = 0; i... | ALGO | 0.998688 | 3.415934 |
405a57cf-2dc5-4a2f-8811-721be111d137 | akothen/Hydride | backends/llvm/lib/CodeGen/PostRASchedulerList.cpp | #include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/CodeGen/AntiDepBreaker.h"
#include "llvm/CodeGen/LatencyPriorityQueue.h"
#include "llvm/CodeGen/MachineDominators.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineLoopInfo.h"
#include "llvm/CodeGen/Mach... | ALGO | 0.984936 | 7.506311 |
f17058af-ebc7-4027-8992-a25ad8d08733 | ishandutta2007/codeforces | mrdindows/normal/461/A.cpp | #pragma comment(linker, "/stack:20000000")
#define _CRT_SECURE_NO_WARNINGS
# include <iostream>
# include <cmath>
# include <algorithm>
# include <cstdio>
# include <cstring>
# include <string>
# include <cstdlib>
# include <vector>
# include <bitset>
# include <map>
# include <queue>
# include <ctime>
# include <stac... | ALGO | 0.999898 | 3.377161 |
7cee2460-7c1a-4e7f-93c5-3601f24e6c87 | YanYue83/Homework_LTNC | HW04/HW4_Sherlock.cpp | #include <iostream>
#include <vector>
using namespace std;
// Ham kiem tra
string balancedSums(vector<int> arr) {
int sum = 0;
for(auto i:arr){
sum+=i;
}
int len = arr.size();
if((sum - arr[0]) == 0) return"YES";
if((sum - arr[len-1]) == 0) return "YES";
int inti = arr[0];
for... | ALGO | 0.999754 | 4.176604 |
ed0a01cc-e356-46d6-af29-b4e45e2d2703 | cvc5/cvc5 | src/theory/decision_strategy.cpp | #include "theory/decision_strategy.h"
#include "theory/rewriter.h"
using namespace cvc5::internal::kind;
namespace cvc5::internal {
namespace theory {
DecisionStrategyFmf::DecisionStrategyFmf(Env& env, Valuation valuation)
: DecisionStrategy(env),
d_valuation(valuation),
d_has_curr_literal(context()... | ALGO | 0.995373 | 7.136863 |
0170bf76-4dc8-4f26-a8ee-451dee990e66 | tommy16102/2022-algorithm-study | 2021/8주차/정환훈/9012_괄호.cpp | //#include <iostream>
//#include <string>
//#include <vector>
//#include <algorithm>
//#include <stack>
//using namespace std;
//stack<char> test;
//string s;
//int a = 0;
//long long result = 0;
//void input() {
// ios_base::sync_with_stdio(0);
// cin.tie(0);
// cout.tie(0);
// cin >> s;
//}
//
//bool is_valid() {
// ... | ALGO | 0.9999 | 4.660585 |
30657426-7d95-4669-8ae7-6cad1bf63cb4 | arnob444/CP_04 | Week4/Day4/Xooy1.cpp | #include <bits/stdc++.h>
#define ll long long int
#define endl "\n";
using namespace std;
int main()
{
int t;
cin >> t;
while (t--)
{
ll x;
cin >> x;
ll ans, cnt = 0;
ans = x;
while (ans > 1)
{
ans = ans / 2;
cnt++;
}
... | ALGO | 0.999944 | 4.038923 |
176bea71-5d10-48d1-9c97-a5ac2bbe5d98 | forked-llvm/Polaris-Obfuscator | llvm/lib/CodeGen/LiveVariables.cpp | #include "llvm/CodeGen/LiveVariables.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/DepthFirstIterator.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/Pas... | ALGO | 0.986069 | 7.923407 |
54b73a0b-60e5-4144-9a2f-d95a6bdaad6d | championswimmer/LearningDataStructsCPP | src/LinkedList.cpp | /*
* LinkedList.cpp
*
* Created on: 01-Sep-2014
* Author: championswimmer
*/
#include "LinkedList.hpp"
#include <stdlib.h>
#include <stdio.h>
struct Node {
int Val;
Ptr2Node Next;
};
int isEmpty (List L) {
return L->Val == NULL;
}
int isLast (Pos P) {
return P->Next == NULL;
}
List createList (int X... | TOOL | 0.968036 | 3.264947 |
45c48bce-dea0-436d-ae5d-53d80bc1f876 | arpan-dey-xo/LeetCode-POTD | 18-05-25.cpp | class Solution {
private:
static constexpr int mod = 1000000007;
public:
int colorTheGrid(int m, int n) {
int mask_end = pow(3, m);
for (int mask = 0; mask < mask_end; ++mask) {
vector<int> color;
int mm = mask;
for (int i = 0; i < m; ++i) {
... | ALGO | 0.999979 | 6.290959 |
a3e609ff-d5e5-4c60-a2db-1d6a0085e3db | Andwerpz/Competitive-Programming-Practice | - cpp -/rectanglecutting.cpp |
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
//CSES 1744
//dp[i][j] represents the amount of cuts required to turn a rectangle of width i and height j into squares.
//we know that dp[i][i] = 0 for all i, since if a rectangle has the same width and height, then it is a square.
//for dp[i]... | ALGO | 0.999957 | 4.4704 |
1f19785d-5ca6-46ff-ba41-d69a61ae76e2 | EricCardenasMartin/cosasDeC- | pr08.cpp | // #include <iostream>
// int main() {
// float n1,n2,n3,n4;
// float p1,p2,p3,p4;
// char c;
// float r;
// printf("Introduce la nota 1: ");
// scanf("%f", &n1);
// printf("Introduce la nota 2: ");
// scanf("%f", &n2);
// printf("Introduce la nota 3: ");
// scanf("%f", &n3);
// printf("Introduce la not... | TOOL | 0.857576 | 3.276434 |
99925ac1-1bef-4c03-9d36-935bda4e59d5 | Najma099/CompetitiveProgramming | 1200/Rock.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const long long MOD = 1000000007;
ll bit(ll num) {
int msb = 0;
while (num > 1) {
num >>= 1;
msb++;
}
return msb;
}
int solve() {
IOS
int t;
cin... | ALGO | 0.999924 | 4.629682 |
9e3bd1a9-5f2b-4bb2-a260-4b28301c1928 | Sanketkatkade/TCS-Coding-Practice | 48_max_occuring_char.cpp | // https://takeuforward.org/data-structure/maximum-occurring-character-in-a-string/
#include<iostream>
#include<string>
#include<map>
using namespace std;
int main(){
string str;
cin >> str;
map<char,int>mp;
for(auto x : str){
mp[x]++;
}
char res;
int max = 0;
for(const auto& ... | ALGO | 0.999779 | 4.778146 |
b23a1a60-f7b7-41ce-be8c-7f6243668b14 | Irinaa21/MP | miMP/ejercicios/rel_t3/ej_9.cpp | /*Orden creciente o decreciente para el algoritmo de ordenacion con un puntero a funcion*/
#include <iostream>
using namespace std;
bool Increasing(int a, int b){
return a > b;
}
bool Decreasing(int a, int b){
return a < b;
}
void swap(const int *v[], int i, int j){
const int *aux = v[i];
v[i] = v[j... | ALGO | 0.999708 | 4.515729 |
05ce1ff5-dd37-4051-99dc-959f4ff9a085 | wengtiancheng/solution_of_leetcode | src/code_without_input/198.打家劫舍.cpp | /*
* @lc app=leetcode.cn id=198 lang=cpp
*
* [198] 打家劫舍
*/
// @lc code=start
#include <vector>
#include <algorithm>
using namespace std;
class Solution {
public:
int rob(vector<int>& nums) {
int len = nums.size();
vector<int> dp(len + 1);
dp[0] = 0;
dp[1] = nums[0];
for(... | ALGO | 0.999378 | 5.61092 |
324f6f0c-2681-4927-af84-c41f2f77032f | rjk13637110731/Cplusplus-Language-Learn-Note | C++程序设计/chapter3/3.14.cpp | # include <iostream>
# include <iomanip>
# include <cmath>
using namespace std;
int main() {
int m, k, i, n = 0;
bool prime;
for (m = 101; m <= 200;m = m + 2) {
prime = true;
k = int(sqrt(m));
for (i = 2; i <= k;i++) {
if (m%i == 0) {
prime = false;
break;
}
}
if (prime) {
cout <... | ALGO | 0.998359 | 4.534107 |
a3c70540-fbc8-40d1-ab4a-dcaab4036a66 | davecrump/portsdown | src/libdvbmod/DVB-S2/dvbs2_interleave.cpp | #include "memory.h"
#include "DVBS2.h"
//
// The output is bit packed ready for modulating
//
void DVBS2::s2_interleave( void )
{
int index=0;
int rows=0;
int frame_size = m_format[0].nldpc;
if( m_format[0].constellation == M_QPSK )
{
rows = frame_size/2;
m_payload_symbols = rows;... | ALGO | 0.976274 | 4.087337 |
cfd611c4-51b3-461a-8c02-8ff8d6d17eb6 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_12139_31.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int const N = 100 * 1000 + 16;
int const M = 1000 * 1000 * 1000 + 7;
int n, k;
int a[N];
int c[N];
ll e, v[N];
vector<int> idx[N];
struct wavelet {
int L, R;
vector<int> b;
wavelet* l = 0;
wavelet* r = 0;
wavelet(int* pl, int* pr, int L, int ... | ALGO | 0.999968 | 4.246893 |
12b0c9c4-0c62-4e07-9ffc-613cec7b2922 | VikramChauhan19/swayam | 5_04_25/987. Vertical Order Traversal of a Binary Tree.cpp | #include<algorithm>
#include<vector>
#include<map>
#include<queue>
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(int x, TreeN... | ALGO | 0.999998 | 5.886114 |
827ff24f-d1f8-4c23-bc3d-f02b0728a23b | BychkovArthur/algorithms | leetcode/22_2.cpp | class Solution {
public:
static void foo(int n, int left, int right, string&& str, vector<string>& res) {
if (str.size() == 2 * n) {
res.push_back(move(str));
return;
}
if (left < n && left > right) {
string copy = str;
str.push_back('(');
... | ALGO | 0.999694 | 6.557892 |
6e80dcc2-eeac-48eb-a2cc-1e1a65f75a2e | EgorEfremoff/Node- | deps/icu-small/source/common/filterednormalizer2.cpp | #include "unicode/utypes.h"
#if !UCONFIG_NO_NORMALIZATION
#include "unicode/edits.h"
#include "unicode/normalizer2.h"
#include "unicode/stringoptions.h"
#include "unicode/uniset.h"
#include "unicode/unistr.h"
#include "unicode/unorm.h"
#include "cpputils.h"
U_NAMESPACE_BEGIN
FilteredNormalizer2::~FilteredNormalizer... | TOOL | 0.929618 | 7.675402 |
78135149-ea23-4dd6-a9fb-9871ff7e88f6 | Joshuaii3712/bayesianFilterProject | src/main.cpp | #include <iostream>
#include <sstream>
#include <fstream>
#include <map>
#include <vector>
#include <string>
#include <cctype>
#include <algorithm>
#include <cmath>
#include <iomanip>
using namespace std;
int nOfSpam = 100;
int nOfHam = 100;
class Word{
public:
string name; //the word itself
int spamMails; //am... | DATA | 0.890975 | 4.359445 |
3ca48219-2728-4835-890a-4a30d4c86ea4 | Amartya-vats/Programming-in-C-C- | 9HA/a9_p8.cpp | /*
CH-230-A
a9 p8.cpp
Amartya Vats
<EMAIL>
*/
#include <iostream>
using namespace std;
//funtion for swapping two integers by real call by reference
void swapping (int &a, int &b) {
int temp = a;
a = b;
b = temp;
}
//funtion for swapping two floats by real call by reference
void swapping (float &x, float... | ALGO | 0.972819 | 4.197578 |
8d167e37-000f-4cb9-8dd4-397cf73a224c | pwc/difx-svn2git-try4 | libraries/beamformer/src/BeamformerWeights.cpp | //===========================================================================
// SVN properties (DO NOT CHANGE)
//
// $Id$
// $HeadURL$
// $LastChangedRevision$
// $Author$
// $LastChangedDate$
//
//============================================================================
#include "BeamformerWeights.h"
#include <a... | ALGO | 0.997714 | 6.171659 |
556b2202-7b2c-4cc8-8d23-f4dbc4786b0f | Brihat9/DSA | Priority Queue.cpp | /** Priority Queue using multiple Linear Queue **/
#include<iostream>
#define MAX_PRIORITY 3 //max number of priority
#define MAX_ELEMENT 2 //max element in one priority queue
using namespace std;
class queue
{
private:
int rear,front,data[MAX_ELEMENT];
public:
//constructor
queue()... | ALGO | 0.999312 | 4.143284 |
07037a2a-95b8-4543-a6f8-4eb227f63909 | qzysw123456/ACM_ICPC_Template | Code/Winter Camp/k8/DDD/main.cpp | #include <cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
int A[2020];
int dp[2020][2020];
int main()
{
int T,n;
//n=2000;
//for(int i=1;i<=n;i++) A[i]=(n+1-i)*10000;
//T=10;
scanf("%d",&T);
while(T--)
{
//memset(dp,0,sizeof(dp));
scanf("%d",&n);
in... | ALGO | 0.998662 | 3.79762 |
b7eb9981-0b9f-4704-aad5-dcb5a7fd0b4b | priyanshusharma1000/2nd | stack.cpp | #include<iostream>
using namespace std;
class stack{
public:
int *arr;
int size;
int top;
stack(int size){
this->size=size;
arr = new int[size];
top = -1;
}
void push(int d){
if(top==size-1){
cout<<"overflow";
}
else{
top= top+1;
arr[top]=d;
}
}
void pop(){
if(top<0){
cout<<"underflow"<<end... | ALGO | 0.999408 | 4.005911 |
c30a4b1a-38b0-468f-bb89-59e2530d2e91 | emo-mruczek/lt | cpp/392_Is_Subsequence.cpp | #include <iostream>
class Solution {
public:
static bool isSubsequence(std::string s, std::string t) {
unsigned int i = 0;
unsigned int counter = 0;
unsigned int len = t.length();
for (char c : s) {
while (i < len) {
if (c != t[i]) {
i... | ALGO | 0.999793 | 6.329409 |
c92f563f-8c80-4a62-92df-05dbd1f62e61 | IvanRenison/ProgrammingProblems | CSES/Advertisement.cpp | // https://cses.fi/problemset/task/1142/
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef vector<ull> vu;
#define fore(i, a, b) for (ull i = a, gmat = b; i < gmat; i++)
template<class T>
struct RMQ {
vector<vector<T>> jmp;
RMQ(const vector<T>& V) : jmp(1, V) {
for (ull ... | ALGO | 0.999894 | 4.860472 |
82610579-9753-4a29-945c-773ae5e8cb7c | SanghunOh/Algorithm | Sort/quick_sort.cpp | #include <iostream>
int pivot(int p, int r, int arr[]){
int piv = r;
int i = p-1;
int j = p;
for( ; j<r ; ){
if(arr[piv] >= arr[j]){
i++;
int t = arr[j];
arr[j] = arr[i];
arr[i] = t;
j++;
}
else
j++;
}
i++;
int t = arr[piv];
arr[piv] = arr[i];
arr[i] = t;
return i;
}
void quick_sor... | ALGO | 0.999964 | 4.312912 |
4d1f2a4f-a6a1-4c97-8e26-2ff2c6d118b1 | allwinner-ics/platform_frameworks_base | media/libstagefright/codecs/aacdec/pv_log2.cpp | /*
Filename: pv_log2.c
------------------------------------------------------------------------------
REVISION HISTORY
Who: Date: MM/DD/YYYY
Description:
------------------------------------------------------------------------------
INPUT AND OUTPUT DEFINITIONS
Int32 x ... | ALGO | 0.999481 | 6.170989 |
6f6eb162-b490-4613-8680-7ced8a63ac24 | Allenem/yk | 240517/sort.cpp | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
class Solution {
public:
// Bubble Sort
vector<int> bubbleSort(vector<int>& nums) {
for (int i = 0; i < nums.size(); i++) {
for (int j = 0; j < nums.size() - i - 1; j++) {
if (nums[j] > nums[... | ALGO | 0.999864 | 5.41628 |
6874b872-a2a4-4202-a54b-68b3a90d64a0 | Bhupesh-Khordia/CodeHelp-DSA | L22 Char array, String/ReverseAStr.cpp | #include <iostream>
using namespace std;
int LengthOfStr(char arr[]){
int length = 0;
for(int i = 0; arr[i] != '\0'; i++){
length++;
}
return length;
}
void reverse(char arr[]) {
int s = 0;
int e = LengthOfStr(arr) - 1;
while(s < e) {
swap(arr[s], arr[e]);
s++;
... | ALGO | 0.988857 | 4.305661 |
31ae3a15-c9e0-4d05-9201-d0e68489f0aa | debanjandgt/LeetCode | 1208. Get Equal Substrings Within Budget/code.cpp | class Solution {
public:
int equalSubstring(string s, string t, int maxCost) {
int maxiLength=0;
int currCost=0;
int i=0;
int back=0;
int currLength=0;
while(i<s.size())
{
char c1=s[i];
char c2=t[i];
if(c1 == c2)
... | ALGO | 0.999952 | 6.117393 |
27b489be-d243-47b2-b7b5-e97dcf098332 | Siyao-Lu/Leetcode | c++/array/187_repeated_DNA_sequences.cpp | // array: leetcode medium (hash map)
/*
Given a string s that represents a DNA sequence, return all the 10-letter-long sequences (substrings) that occur more than once in a DNA molecule.
You may return the answer in any order.
*/
#include <vector>
#include <algorithm>
#include <set>
#include <string>
#include <unordere... | ALGO | 0.993769 | 6.69984 |
00e61519-d5ec-4b06-97ed-6d7e3729df25 | rayloyal/leetcode | test/t_0011.cpp | #include "q_0011.h"
#include "gtest/gtest.h"
using namespace std;
using ::testing::Test;
TEST(Q0011, EXAMPLE){
Solution solution;
vector<int> height1 = {1, 8, 6, 2, 5, 4, 8, 3, 7};
ASSERT_EQ(solution.maxArea(height1), 49);
vector<int> height2 = {1, 1};
ASSERT_EQ(solution.maxArea(height2), 1);
}
| TEST | 0.982361 | 6.722087 |
734c6c5c-a20f-4c25-bab6-514e0377d658 | LukeSamkharadze/cs106b | Priority Queue/pqueue-binomialheap.cpp | #include "pqueue-binomialheap.h"
#include "error.h"
#include <math.h>
BinomialHeapPriorityQueue::BinomialHeapPriorityQueue()
{
capacity = 1;
length = 0;
nodes = new Node*[capacity];
}
BinomialHeapPriorityQueue::~BinomialHeapPriorityQueue()
{
for(int i = 0; i < length; i++)
Destructor(nodes[i]);
}
int Binomi... | ALGO | 0.999851 | 5.561038 |
65a44438-eff0-4fe0-8beb-3995943fdb15 | pitabasdev/45-C--program | 32.cpp | #include<iostream>
using namespace std;
int main()
{
int amt,discount;
cout<<"Enter amount : ";
cin>>amt;
if(amt>20000)
discount=15;
else if(amt>15000) discount=10;
else if(amt>10000) discount=5;
else discount=0;
cout<<"You will get "<<discount<<"% discount.";
return 0;
}
| ALGO | 0.87737 | 3.524744 |
5ac6d8e1-5c18-4a68-aa3e-0217ebec818a | alamgir5/Online-Judge | UVA/GCD.cpp | #include<bits/stdc++.h>
using namespace std;
#define faster ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define sq(x) (x)*(x)
#define PI acos(-1.0)
#define all(x) x.begin(),x.end()
#define nl '\n'
typedef long long int ll;
typedef unsigned long long int llu;
int main()
{
while(1)
{
... | ALGO | 0.999714 | 4.519232 |
98dffbcb-5b6c-48ef-9fd3-d5bf098a8bbb | ilicina1/TP-CPP | ZSR6/Z12/main.cpp | //TP 2018/2019: ZSR 6, Zadatak 12
#include <iostream>
#include <vector>
typedef std::vector<std::vector<int>> Matrica;
template <typename nekiTip>
nekiTip **funkcija(std::vector<std::vector<nekiTip>> a){
nekiTip **b = new nekiTip *[a.size()];
for(int i = 0; i < a.size(); i++) b[i] = new nekiTip[a.at(i).size()... | ALGO | 0.982042 | 3.621111 |
c6f247ef-4bb6-407a-b881-9371d81ef900 | Devansh0012/Striver-s-DSA | Recursion/print1toN.cpp | #include <bits/stdc++.h>
using namespace std;
void print(int i, int n){
if(i > n) return;
cout << i << " ";
print(i+1,n);
}
int main(){
int n;
cin >> n;
print(1,n);
return 0;
} | ALGO | 0.998617 | 4.292186 |
5fc47f70-dac7-49c6-a42d-4a76f9d171fb | hamm-bit/VJ | 4128/C2_past/A.cpp | #include <algorithm>
#include <array>
#include <bits/stdc++.h>
#include <climits>
using namespace std;
#define ll long long
const ll nMOD = (ll) 1e9 + 7;
const int MAX = 5e5 + 5;
const int kMAX = 1005;
const int nMAX = 1005;
void arr_print(array<array<int, nMAX>, MAX> z, int m = 0) {
cout << "\n================... | ALGO | 0.999952 | 4.758121 |
ccabf517-978b-4a7c-b44b-1622d466b5c8 | DincyJiang/Codes | LeetCode/LeetCode-Algorithm/LeetCode_401_二进制手表.cpp | // 二进制手表顶部有 4 个 LED 代表小时(0-11),底部的 6 个 LED 代表分钟(0-59)。
// 每个 LED 代表一个 0 或 1,最低位在右侧。
// 例如,上面的二进制手表读取 “3:25”。
// 给定一个非负整数 n 代表当前 LED 亮着的数量,返回所有可能的时间。
// 案例:
// 输入: n = 1
// 返回: ["1:00", "2:00", "4:00", "8:00", "0:01", "0:02", "0:04", "0:08", "0:16", "0:32"]
// 注意事项:
// 输出的顺序没有要求。
// 小时不会以零开头,比如 “01:00” 是不允许的,应为 “... | ALGO | 0.998942 | 7.416862 |
c3c4ce5c-b373-44de-bcc6-696878c418eb | yyhaos/Data-Structures-and-Algorithms | Dp/acm/信息战(三)——军队调度.cpp | #include<bits/stdc++.h>
using namespace std;
//Problem : http://acm.bnu.edu.cn/v3/problem_show.php?pid=1017
int N, M, ans=0, used[10];
void dp(int th, int x)
{
if(th==N+1)
printf("%d\n",x),ans++;
else
{
for(int i = 1 ; i<=N && i<=th+M;i++)
{
if(used[i]>0)
... | ALGO | 0.999562 | 3.350383 |
1f488cd8-5b6f-4b5f-8e97-baf327583929 | imon-n/phitron | Algorithm/module_3(merg sort)/merg.cpp | #include<bits/stdc++.h>
using namespace std;
void merge(int a[],int l,int m,int r)
{
int left_size = m-l+1;
int right_size = r-m;
int L[left_size],R[right_size];
int k=0;
for (int i=l; i<=m; i++)
{
L[k]=a[i];
k++;
}
k=0;
for (int i=m+1; i<=r; i++)
{
R[k]=a[i];
k++;
... | ALGO | 0.999992 | 3.795028 |
18ac82c1-a474-4da8-828a-9b226037502c | Shell-Wataru/AtCoder | YukiCoder/1432.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <queue>
#include <set>
#include <ctime>
#include <map>
#include <boost/multiprecision/cpp_int.hpp>
#include <string>
using namespace std;
using ll = long long;
namespace mp = boost::multiprecision;
int main()
{
ll a,b;
cin >>... | ALGO | 0.999764 | 3.302275 |
c948b5f9-12b4-430d-aad4-10d05d9ad6f6 | chriskiefer/libcccrt | eigen-3.4.0/bench/bench_norm.cpp | #include <typeinfo>
#include <iostream>
#include <Eigen/Core>
#include "BenchTimer.h"
using namespace Eigen;
using namespace std;
template<typename T>
EIGEN_DONT_INLINE typename T::Scalar sqsumNorm(T& v)
{
return v.norm();
}
template<typename T>
EIGEN_DONT_INLINE typename T::Scalar stableNorm(T& v)
{
return v.sta... | TEST | 0.975244 | 6.694365 |
58649eb6-a8fe-46bd-993b-4ed3c09ac3c6 | JawadKotaichh/Codeforces | Brothers/Div 3 1020/B.cpp | #include <bits/stdc++.h>
using namespace std;
int mex(vector<int> &arr, int N)
{
sort(arr.begin(), arr.end());
int mex = 0;
for (int idx = 0; idx < N; idx++)
{
if (arr[idx] == mex)
{
mex += 1;
}
}
return mex;
}
vector<int> slicing(vector<int> &arr, int X, in... | ALGO | 0.999938 | 4.19666 |
5f4f0b58-4e0e-48d8-ac06-d63277ea8242 | faterazer/LeetCode | 2588. Count the Number of Beautiful Subarrays/Solution.cpp | #include <unordered_map>
#include <vector>
using namespace std;
class Solution {
public:
long long beautifulSubarrays(vector<int>& nums)
{
unordered_map<int, int> prefix_xor_cnt { { 0, 1 } };
int prefix_xor = 0;
long long ans = 0;
for (int x : nums) {
prefix_xor ^= x... | ALGO | 0.999995 | 5.770978 |
877ca877-0a86-44be-8376-9a88ffed061a | Arysoltani/Field-Runners | EnemyTable.cpp | #include "EnemyTable.hpp"
#include "Enemy.hpp"
#include<vector>
#include "RSDL-master/src/rsdl.hpp"
#include "Shoot.hpp"
#define SCRAMBLER_IMAGE "./Assets/enemies/scrambler.png"
using namespace std;
void EnemyTable::add(Enemy* new_enemy)
{
enemies.push_back(new_enemy);
}
void EnemyTable::clear_all()
{
enemie... | TOOL | 0.870792 | 4.089038 |
31ce00c4-2a23-4228-936a-d4e81ef1f2c7 | sarvex/leetcode-powershell | solution/1100-1199/1161.Maximum Level Sum of a Binary Tree/Solution.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.999978 | 6.329797 |
a36693cd-8282-4203-8ba2-309d16f5140a | anshu0202/DataStructur-Code | tree/binary_searchtree/self_practise/hackerrank_bfs.cpp | #include <bits/stdc++.h>
using namespace std;
class Node {
public:
int data;
Node *left;
Node *right;
Node(int d) {
data = d;
left = NULL;
right = NULL;
}
};
class Solution {
public:
Node* insert(Node* root, int data) {
... | ALGO | 0.998916 | 5.321101 |
115e69c4-a052-4949-9578-c761805a406a | coderyjc/STDU-Curriculum | C语言/课后题/7.6.cpp | //#include<stdio.h>
//
//int Fact(int x)
//{
// int sum = 1, i;
// for (i = 1;i <= x;i ++)
// {
// sum = sum * i ;
// }
// return (sum);
//}
//
//int main ()
//{
// int a;
// int sum;
//
// printf("Please enter a number : ");
// scanf("%d",&a);
//
// for (sum = 0; a>0 ; a--) sum += Fact(a);
//
// printf("1!+2!+......+n... | ALGO | 0.998637 | 3.028397 |
437c7af9-f29d-4cd3-b451-969bdd617d75 | azmuth13/Leetcode | 706-design-hashmap/706-design-hashmap.cpp | class MyHashMap {
public:
int arr[1000001];
MyHashMap() {
for(int i = 0; i < 1000001; i++)
arr[i] = -1;
}
void put(int key, int value) {
arr[key] = value;
}
int get(int key) {
return arr[key];
}
void remove(int key) {
arr[ke... | ALGO | 0.999141 | 6.095837 |
e245ea46-36c8-4173-9ed2-3140674fefab | shreydevep/DSA | Codeforces/Educational Codeforces Round 121 [Rated for Div. 2]/A.cpp | #include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define MOD1 998244353
#define inf 1e18
#define MAXN 10000001
#define PI 3.141592653589793238462
#define ll long long
#define pb push_back
#define mkp make_pair
#define pll pair<ll, ll>
#define vll vector<int>
#define mll map<ll, ll>
#define pqg pri... | ALGO | 0.999985 | 3.94968 |
7f0e4aae-21b7-4738-964c-eff3ae3db0bc | Vinay-Rastogi/LeetCode | 2419. Longest Subarray With Maximum Bitwise AND.cpp | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
class Solution
{
public:
int longestSubarray(vector<int> &nums)
{
int ans = 0;
int len = 0;
int maxE = *max_element(nums.begin(), nums.end());
for (int i = 0; i < nums.size(); i++)
{
if (nu... | ALGO | 0.999821 | 5.168777 |
ecf1c53a-6215-4184-8e6c-29d900e9557e | costheta-z/codes | pair_sum.cpp | //Find a pair with the given sum in an array
#include<bits/stdc++.h>
using namespace std;
#define _z ios_base::sync_with_stdio(false); cin.tie(NULL);
#define int long long int
#define endl "\n"
#define mod 1000000007
#define pb_ push_back
#define mp_ make_pair
//______________________________z________________________... | ALGO | 0.999867 | 3.287736 |
00a2aeb5-80b7-4734-83c7-7f9bf42c66b8 | m-eraf/DSApractice | Assignment 2/strings.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
string a, b;
cin>>a;
cin>>b;
int d = a.size();
int e = b.size();
cout<<d<<" "<<e<<endl;
string c = a+b;
cout<<c<<endl;
char x= a[0];
char y= b[0];
a[0] = y;
b[0] = x;
cout<<a<<" "<<b;
}
| ALGO | 0.999853 | 3.867224 |
bf8ed04f-1ffb-4813-bb46-199b8a9a06b3 | ShivaReddy54/STRIVER | Blind 75 Sheet/Linked List/Detect a cycle in Linked List.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
class Node{
public:
int data;
Node* next;
Node(int n){
data = n;
next = nullptr;
}
};
int main(){
Node* root = new Node(1);
Node* slow = root;
Node* fast = root;
while(fast and fast->next){
sl... | ALGO | 0.999831 | 3.968209 |
8bef0313-5291-4165-ae7c-abb9033bd4f4 | bogdan-lab/Algorithm_puzzles | Tasks/CF_task_1396A.cpp | #include <iostream>
#include <sstream>
#include <vector>
void Solution(std::istream& input = std::cin);
void RunTests();
int main() {
std::ios_base::sync_with_stdio(false);
std::cin.tie(nullptr);
// RunTests();
Solution(std::cin);
return 0;
}
void Solution(std::istream& input) {
int64_t n;
input >> n;
... | ALGO | 0.999886 | 3.555815 |
88624e6a-4b47-4423-9d1b-2dc05f908282 | nanditav/H_apps | apps/lens_blur/lens_blur.cpp | #include "Halide.h"
using namespace Halide;
#include <iostream>
#include <limits>
#include "benchmark.h"
#include "halide_image_io.h"
using namespace Halide::Tools;
using std::vector;
Var x, y, z, c;
// Downsample with a 1 3 3 1 filter
Func downsample(Func f) {
Func downx, downy;
downx(x, y, _) = (f(2*x... | ALGO | 0.996659 | 5.845542 |
c2e7b3cc-eb97-498e-bf5b-91c7b81f94c0 | qizhuocai/ncnn_work | src/layer/gridsample.cpp | #include "gridsample.h"
namespace ncnn {
GridSample::GridSample()
{
one_blob_only = false;
support_inplace = false;
}
int GridSample::load_param(const ParamDict& pd)
{
sample_type = pd.get(0, 1);
padding_mode = pd.get(1, 1);
align_corner = pd.get(2, 0);
permute_fusion = pd.get(3, 0);
if ... | ALGO | 0.998309 | 6.608994 |
7ebdd77d-b715-42a0-89c9-022ef65538a0 | abhishekbathena/Data-structures-and-Algorithms-Q-A | 2147-number-of-ways-to-divide-a-long-corridor/2147-number-of-ways-to-divide-a-long-corridor.cpp | class Solution {
public:
int numberOfWays(string corridor) {
int mod=1e9+7;
vector<int>s;
int n=corridor.size();
for(int i=0;i<n;i++ ){
if(corridor[i]=='S')
s.push_back(i);
}
if(s.size()==0 || s.size()&1){
return 0;
}
... | ALGO | 0.999972 | 5.74547 |
91e2cff6-ccc7-4a9e-a898-54c0b4633f89 | yashbhanu/Data-Structure-and-Algorithms | Problem Solving/p2.cpp | #include <iostream>
using namespace std;
int main(){
int n;
cin>>n;
int count = 0;
while (n!=0)
{
if(n&1){
count++;
}
n = n>>1;
}
cout<<count;
return 0;
} | ALGO | 0.999914 | 4.766979 |
07adf63d-a18e-43e4-af25-b84873be4831 | alexandrelea/oi-oj-codes | luogu/p3367/prog.cpp | #include <bits/stdc++.h>
using namespace std;
const int N=1e4+10;
int n,m,fa[N];
int find(int x){
return fa[x]=(fa[x]==x?x:find(fa[x]));
}
int main(){
cin>>n>>m;
for(int i=1;i<=n;++i) fa[i]=i;
while(m--){
int z,x,y;
cin>>z>>x>>y;
x=find(x),y=find(y);
if(z==1) fa[x]=y;
else cout<<(char)(x==y?'Y':'N')<<endl... | ALGO | 0.999953 | 4.009013 |
a11dc0fc-1c65-4112-9239-8cfd3bcf22bc | sarvex/leetcode-pascal | lcof2/剑指 Offer II 053. 二叉搜索树中的中序后继/Solution.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* inorderSuccessor(TreeNode* root, TreeNode* p) {
TreeNode *cur = root, *ans = ... | ALGO | 0.999871 | 5.83252 |
5d637133-ab29-4337-9f8b-37cfbbff68c8 | Hasibull/Cpp-playground | Problem Solving/codeforces/617_A.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
if(n%5==0){
cout<<n/5<<endl;
}
else
cout<<(n/5)+1<<endl;
return 0;
}
| ALGO | 0.999818 | 3.663803 |
b9b2870c-a74c-4bdf-a8de-1a60fd1d4dcb | mehadi007/School_Code | Data Structures/bfs+queue/flight_route.cpp | #include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include "Queue.h"
using namespace std;
using namespace cop4530;
struct CityNode
{
int previous, costToPrevious;
bool added;
string name;
vector<int> neighbors, cost;
};
int get_index(vector<CityNode>&, string);
void min_hop(vector<CityNod... | ALGO | 0.995377 | 4.168886 |
0b7380ef-96f9-4cba-8a6e-007674deee8e | AviX4/LeetCode | 41-first-missing-positive/41-first-missing-positive.cpp | class Solution {
public:
int firstMissingPositive(vector<int>& nums) {
unordered_set<int> s(nums.begin(),nums.end());
int i=0;
for(i=1;i<=nums.size();i++){
if(s.find(i)==s.end()){
return i;
}
if(i==nums.size()){
return i+1;
... | ALGO | 0.999926 | 4.906064 |
3041c5f5-6d2e-465c-a7b5-32314b525c95 | Saiyangodgoku1/start-450 | Step-03(Binary Search)/1d/08.Search_in_rotated_sorted_array.cpp | /*
QUESTION:
Given a rotated sorted array 'arr' of size 'n' and a target element 'k', implement a function to search for 'k' in the array.
Example:
Input:
arr = [4, 5, 6, 7, 0, 1, 2], n = 7, k = 0
Output:
4 // Index of 0 in the array
APPROACH:
1. Implement a binary search algorithm to search for the target element 'k... | ALGO | 0.999993 | 6.942655 |
34524352-42f6-4c92-a6da-e60030642a13 | has2/Problem-Solving | boj-solved.ac/Silver5/2947.cpp | #include <cstdio>
int a[5];
void prt(){
for(int i=0;i<5;i++) printf("%d ",a[i]);
puts("");
}
bool cmp(int i,int j){
if(a[i]>a[j]){
int tmp=a[i];
a[i]=a[j];
a[j]=tmp;
return true;
}
return false;
}
int main(){
for(int i=0;i<5;i++) scanf("%d",&a[i]);
while(1){
... | ALGO | 0.999949 | 3.564066 |
2f1fd499-5825-4e94-a10c-5b1bd710b317 | Sookmyung-Algos/2021algos | algos_semina/3rd_seminar/E_20209/yoonyesle_20209.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <string>
#include <map>
using namespace std;
typedef pair<int, int> pii;
vector<int> graph[9];
vector<int> num;
queue<vector<int>> q;
map<vector<int>, int> m;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.t... | ALGO | 0.999882 | 3.719052 |
1a5b0d20-b074-4d08-82c0-20fad6c23dc7 | gretacannon/Assignment1cpp | firecapacity.cpp | #include <iostream>
using namespace std;
int main(int argc, char **argv){
int numPeople;
int roomCapacity;
int extraPeople;
cout << "what is the room capacity?" << endl;
cin >> roomCapacity;
//promps user to enter room roomCapacity and stores it
cout << "how many people are in the room?"<< endl;
cin... | TOOL | 0.938347 | 3.696621 |
d0995602-9e96-4807-bc3c-99a37e4e167e | raosy98/pta | Basic level/B1018.cpp | #include <iostream>
#include <map>
using namespace std;
int iswin(char j,char y) {
if (j == y) {
return 0;
}
if (j == 'C') {
if (y == 'B') {
return 2;
}
} else if (j == 'B') {
if (y == 'J') {
return 2;
}
} else {
if (y == 'C') {
return 2;
}
}
return 1;
}
in... | ALGO | 0.999935 | 3.877944 |
2cd44bed-05a8-4b2a-8666-e4fceddd6c73 | Sameer2499/Basic-Coding-Programs | 93.Floyd_Triangle.cpp | #include<iostream>
using namespace std;
int main()
{
int n,num=1;
cin>>n;
for(int i=1;i<=n;i++)
{
for(int j=0;j<i;j++)
{
cout<<num<<" ";
num++;
}
cout<<endl;
}
}
| ALGO | 0.99992 | 3.597325 |
e6e6f234-ac81-4085-8c89-b6d9773dbde6 | yanlaisheng/Robot | Drivers/CMSIS/NN/Examples/ARM/arm_nn_examples/gru/arm_nnexamples_gru.cpp | /**
* @ingroup groupExamples
*/
/**
* @defgroup GRUExample Gated Recurrent Unit Example
*
* \par Description:
* \par
* Demonstrates a gated recurrent unit (GRU) example with the use of fully-connected,
* Tanh/Sigmoid activation functions.
*
* \par Model definition:
* \par
* GRU is a type of recurrent neura... | ALGO | 0.914648 | 7.471897 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.