uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
c944f961-1a87-4e11-a9f1-e68a8f9c4f57 | SimpleisNice/Algorithm | history/SourceCode_algorithm_book/algospot_PI.cpp | #include <iostream>
#include <algorithm>
using namespace std;
int numCase[10000][10000];
string num;
int numLen;
int getSmall(int index) {
int count = 0;
if(numLen - index < 2)
return 0;
// 모든 숫자가 같은 경우
int tempNum = num[index];
int tempIndex = 1;
while(true) {
if(tempIndex + ... | ALGO | 0.999788 | 4.977008 |
1742beeb-39a8-4da9-b165-1f1904f4b967 | ArfreeX/TravelingSalesmanProblem-PEA_1 | tsp/GeneticAlgorithm.cpp | #include "GeneticAlgorithm.h"
#include <math.h>
#include <algorithm>
#include <functional>
#include <iostream>
#include <numeric>
#include <queue>
#include <random>
namespace tsp
{
GeneticAlgorithm::GeneticAlgorithm(std::vector<std::vector<int>> roadMap, long long int timeLimit,
ts... | ALGO | 0.999992 | 5.751895 |
de48ab0a-d46f-40b2-bac2-8b7046c290e5 | miguelsndc/competitive-programming-lib | code/Number Theory/Fast-Exponentiation.cpp | /*
Fast Exponentiation
Calcula a^b mod m em O(log(n))
*/
ll fexp(ll a, ll b, ll MOD){
ll ans = 1;
while(b) {
if(b & 1) ans = (ans * a) % MOD;
a = (a * a) % MOD;
b >>= 1;
}
return ans;
} | ALGO | 0.999638 | 5.108688 |
7b27230c-d36c-4b1f-b9f3-ccc6363b2bbd | ishandutta2007/codeforces | peti1234/normal/1285/F.cpp | #include <bits/stdc++.h>
using namespace std;
const int c=100002;
int n, pro[c], cnt[c], si;
vector<int> oszt[c];
bool v[c], ff[c];
vector<long long> sz;
long long maxi=1;
void add(int a, int b) {
for (int x:oszt[a]) {
if (!ff[x]) {
if (pro[x]%2) {
cnt[x]+=b;
} else ... | ALGO | 0.999989 | 3.963162 |
d47231b1-bda2-4edd-aa44-ba703ee78331 | yDeepak1889/DynamicProgrammming | eggDropping.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define itr iterator
#define ritr reverse_iterator
#define pint pair<int, int>
#define pll pair<ll, ll>
#define S second
#define F first
#define v(a) vector<a>
#define mk(a, b) make_pair(a, b)
#define psh(a) push_back(a)
#define mem(arr, a) memset(arr... | ALGO | 0.999708 | 3.828808 |
6ad5ab3e-04c6-4371-8650-66d1e8565fcc | VRToxin-AOSP/android_external_skia | src/pathops/SkOpCoincidence.cpp | #include "SkOpCoincidence.h"
#include "SkOpSegment.h"
#include "SkPathOpsTSect.h"
bool SkOpCoincidence::extend(SkOpPtT* coinPtTStart, SkOpPtT* coinPtTEnd, SkOpPtT* oppPtTStart,
SkOpPtT* oppPtTEnd) {
// if there is an existing pair that overlaps the addition, extend it
SkCoincidentSpans* coinRec = fHead... | TOOL | 0.998693 | 5.568325 |
6b612f4c-736d-4e21-9981-e8b71e0b3b65 | MaheshSharan/LeetCode_Automation | solutions/2500-2599/2503.Maximum Number of Points From Grid Queries/Solution.cpp | class Solution {
public:
const int dirs[5] = {-1, 0, 1, 0, -1};
vector<int> maxPoints(vector<vector<int>>& grid, vector<int>& queries) {
int k = queries.size();
vector<pair<int, int>> qs(k);
for (int i = 0; i < k; ++i) qs[i] = {queries[i], i};
sort(qs.begin(), qs.end());
... | ALGO | 0.999961 | 5.984578 |
a1073ea8-df3c-4226-8131-ce68d8e7fa60 | SourabhNarwal/DSA | 0226-invert-binary-tree/0226-invert-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.999969 | 6.199794 |
4a50ac96-efd8-4873-97b4-745e8bac1420 | ishandutta2007/codeforces | gabrielpessoa/normal/784/G.cpp | #include <bits/stdc++.h>
using namespace std;
char s[50];
int ptr = 0;
int getNext() {
int i = 0;
while(s[ptr] >= '0' && s[ptr] <= '9') {
i = i * 10 + s[ptr++] - '0';
}
return i;
}
int tenpow(int n) {
int r = 1;
while(n-- > 0) {
r *= 10;
}
return r;
}
int digits(int n... | ALGO | 0.999976 | 3.932867 |
071760ca-89cb-45fe-b7a3-154ee1db4709 | AliBinary/Quera-Answers | problemset/33025.cpp | /*
author: Ali
Email: <EMAIL>
GitHub: https://github.com/AliBinary
created: 15.05.2024 13:36:19
*/
#include <bits/stdc++.h>
using namespace std;
#define fast_io ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#define endl '\n'
#define sep ' '
typedef long long ll;
typedef long double ld;
typedef... | ALGO | 0.999961 | 3.724148 |
ad6d11e5-a06b-425e-af8b-21c04bac696b | viennacl/viennacl-dev | matlab/viennacl_bicgstab.cpp | #include <math.h>
#include "mex.h"
#include "viennacl/vector.hpp"
#include "viennacl/compressed_matrix.hpp"
#include "viennacl/linalg/bicgstab.hpp"
#if !defined(MAX)
#define MAX(A, B) ((A) > (B) ? (A) : (B))
#endif
void viennacl_bicgstab(double * result, //output vector
mwIndex * cols, //inpu... | ALGO | 0.99991 | 3.566835 |
e1e88024-ef1f-44bf-b99e-3c6ca65eca33 | hmofrad/CodingPractice | skinnyleetcode/firstBadVersion.cpp | /*
* Problem: https://leetcode.com/problems/first-bad-version/submissions/
* Compile: g++ -o firstBadVersion firstBadVersion.cpp -std=c++11 && ./firstBadVersion
* (c) Mohammad Hasanzadeh Mofrad, 2019
* (e) <EMAIL>
*/
#include <iostream>
#include <stdint.h>
#include <stdio.h>
#include <vector>
#include <st... | ALGO | 0.995896 | 5.992417 |
3c4d62e0-c400-421a-9a43-c79fc35fe9d1 | TerminalWarlord/CodeForces-Submissions | C++/1624C. Division by Two and Permutation.cpp | // Author : TerminalWarlord - Joy Biswas
// Date : 26.04.2022
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
#define fastio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define MOD 100000000... | ALGO | 0.999917 | 4.813797 |
4748b1d7-a5bd-4550-9e5f-0dce34a7f617 | mwang98/leetcode-practice | 2054-two-best-non-overlapping-events/2054-two-best-non-overlapping-events.cpp | class Solution {
public:
int maxTwoEvents(vector<vector<int>>& events) {
/* DP + binary search
Sort events by their start time
Def: dp[i]: the maximum value given events[i:]
Transition:
dp[i] = max(dp[i+1], events[i].value)
sum of values: events[i].value + dp... | ALGO | 0.999577 | 6.19724 |
473607ba-d073-4ee7-b093-28775eecbbcc | hardik44ss/100-Days-of-Code | Day 88/SortMethod.cpp | /* Best Sorting Technique:
- Merge Sort and Quick Sort are the best sorting techniques among the five.
- Both have an average time complexity of O(n log n) and are efficient for large datasets.
- Merge Sort is stable and has a predictable performance, while Quick Sort is faster in practice.
*/
#include <bits/stdc++.h... | ALGO | 0.999966 | 6.180433 |
3604fe33-5ea8-4e9c-941a-a072fe7e8f4b | Lydxn/Competitive-Programming | DMOJ/champions.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
pair<int, int> v[100000];
int friends[100000], ans[100000];
bool comp(const pair<int, int>& v1, const int v2) { return v1.first < v2; }
int main() {
cin.sync_with_stdio(0);
cin.tie(0);
int n, k, a, b;
cin >> n >> k;
for (int i = 0;... | ALGO | 0.999983 | 4.009329 |
e01201e7-0435-41bb-88e2-581b8d66cbd2 | freebsd/freebsd-src | contrib/llvm-project/llvm/lib/CodeGen/ReachingDefAnalysis.cpp | #include "llvm/CodeGen/ReachingDefAnalysis.h"
#include "llvm/ADT/SetOperations.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/CodeGen/LiveRegUnits.h"
#include "llvm/CodeGen/TargetRegisterInfo.h"
#include "llvm/CodeGen/TargetSubtargetInfo.h"
#include "llvm/Support/Debug.h"
using namespace llvm;
#define DEBUG_TYPE "r... | ALGO | 0.997882 | 7.718518 |
fa1c928b-a3a6-4ce5-b01a-3ce845df586b | Yureyka/University | 2 курс/1 семестр/ООП/ЛАБ2/ЛАБ2.cpp | #include <iostream>
#include <cmath>
#include <windows.h>
using namespace std;
class Shape
{
int n;
float *p;
Shape();
virtual float perimetr();
virtual void show_parametri();
/*Shape::Shape()
{
cout<<" "<<endl;
}
*/
float Shape::perimetr()
{
int i;
flo... | ALGO | 0.931811 | 3.091049 |
34ca54ce-1f08-4fc3-ba9f-0688a0dbd35c | ishandutta2007/codeforces | marcina007/normal/241/C.cpp | #include <cstdio>
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <string>
#include <queue>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <complex>
#include <stack>
using namespace std;
#define PB push_back
#define REP(i,n) for(int i=0;i<(n);i++)
#defi... | ALGO | 0.999516 | 3.108308 |
d6510ebf-eb86-4607-a02d-08b3c51caceb | blenz3/Grind75 | 038_missing_number/solution.cpp | class Solution {
public:
// Strategy
// - Approach 1: Sum them all up and compare with the expected sum
// - Approach 2: Vector of bools from 1..n where we fill them in if encountered and then scan for missing
int missingNumber(vector<int>& nums) {
int expected = (nums.size() * (nums.... | ALGO | 0.999955 | 6.197607 |
e6c2f9b1-c95d-4745-9c3a-e0ea484449f5 | ne0z/gecko-nokia-8110 | gfx/skia/skia/src/pathops/SkPathOpsWinding.cpp | // given a prospective edge, compute its initial winding by projecting a ray
// if the ray hits another edge
// if the edge doesn't have a winding yet, hop up to that edge and start over
// concern : check for hops forming a loop
// if the edge is unsortable, or
// the intersection is nearly at the ... | ALGO | 0.999903 | 6.826071 |
10b63b4f-a1c8-4c00-9b1d-8fd797523e5f | OpenSees/OpenSees | SRC/element/frictionBearing/TFP_Bearing2d.cpp | // Written: Tracy Becker
//
// What: "@(#) TFP_Bearing2d.C, revA"
// we specify what header files we need
#include "TFP_Bearing2d.h"
#include <elementAPI.h>
#include <G3Globals.h>
#include <math.h>
#include <float.h>
#include <Information.h>
#include <Domain.h>
#include <Node.h>
#include <Channel.h>
#include <Message... | ALGO | 0.988984 | 4.309427 |
11abc9c3-54e2-40a5-b25d-77030658434b | sarvex/leetcode-elm | solution/1900-1999/1945.Sum of Digits of String After Convert/Solution.cpp | class Solution {
public:
int getLucky(string s, int k) {
string t;
for (char c : s) t += to_string(c - 'a' + 1);
s = t;
while (k--) {
int t = 0;
for (char c : s) t += c - '0';
s = to_string(t);
}
return stoi(s);
}
}; | ALGO | 0.999828 | 6.133164 |
364749bb-a2ab-4176-98a8-64f4a47c454c | Prathamesh-2004/ADSA_Lab_111_CPP | Assignment_3.cpp | // Implement a problem of smallest number with at least no trailing
// zeroes in factorial.
// Statement: Given a number n. The task is to find the smallest number
// whose factorial contains at least n trailing zeroes.
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
int n;
int ans... | ALGO | 0.999911 | 6.011698 |
5776506d-f3e0-4c8a-860b-4ee293211efa | ripa01/ProblemSolvingCode | I Wanna Be the Guy.cpp | #include <bits/stdc++.h>
using namespace std;
int a, pas;
int main() {
cin >> a;
pas = a / 5;
if (a % 5 > 0) {
pas++;
}
cout << pas;
}
| ALGO | 0.998753 | 3.603329 |
605ed3b3-6633-4f50-988c-412cc093aca8 | Saifu0/Competitive-Programming | CP/1500/maximum_subarray_sum.cpp | #include<bits/stdc++.h>
using namespace std;
#define NINJA ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define deb(x) cout << #x << " " << x << endl;
#define fo(i,n) for(int i=0;i<n;i++)
#define Fo(i,k,n) for(int i=k;i<n;i++)
#define vi vector<int>
#define ii pair<int,int>
#define vii vector<ii>
#define ll l... | ALGO | 0.999989 | 3.875468 |
172c2cd1-056f-4fd4-b8cf-e59d47ca6aaa | sunputawan/POSNC-Archive | betaProgramming/1058.cpp | #include <bits/stdc++.h>
using namespace std;
char arr[1005][1005];
int l[1005][1005],r[1005][1005],u[1005][1005],d[1005][1005];
void solve(void){
int m,n; cin>>n>>m;
memset(l,0,sizeof(l));
memset(r,0,sizeof(r));
memset(u,0,sizeof(u));
memset(d,0,sizeof(d));
for(int i=1;i<=n;i++){
for(i... | ALGO | 0.999832 | 3.957065 |
e68ee766-1987-4620-ad79-77b24c37322a | snehapriyasinha/DSA | 61_painterPartitionProblem.cpp | #include <stdio.h>
#include <vector>
using namespace std;
bool isValid(vector<int> v, int boards, int painters, int mid)
{
int maxAllowedBoards = mid;
int painter = 1;
int board = 0;
for (int i = 0; i < boards; i++)
{
if (v[i] > maxAllowedBoards)
{
return false;
... | ALGO | 0.999752 | 5.703323 |
bca0cdd2-d62e-4186-b8e2-6dc937cefea8 | ChuanqiXu9/clangd-for-modules | libc/src/math/nvptx/llrintf.cpp | #include "src/math/llrintf.h"
#include "src/__support/common.h"
#include "declarations.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(long long, llrintf, (float x)) {
return static_cast<long long>(__builtin_rintf(x));
}
} // namespace LIBC_NAMESPACE_DECL
| ALGO | 0.985835 | 5.620537 |
fcb4158b-c8bd-4c0a-b964-ed1109e4065f | flexath/flexath-cpp | C++ Data Structures and Algorithms/Queue/queue_with_linkedlist.cpp | #include <iostream>
struct Node{
int data;
Node *next;
};
Node *frontQ = NULL;
Node *rear = NULL;
void enqueue(int data);
void dequeue();
bool isEmpty();
void print_queue();
int main(){
enqueue(5);
enqueue(10);
enqueue(15);
enqueue(20);
enqueue(25);
enqueue(30);
enqueue(35);
... | ALGO | 0.994834 | 4.086592 |
9ad08b56-ec00-4f5d-a182-c4aaa3c028e2 | aman9211-max/sdeSheetchallenge | Day3/rat_in_maze.cpp | vector<vector<int> > ans;
void dfs(vector<vector<int> > &m, int i, int j, int n, vector<vector<int> > &t) {
if(i < 0 || i >= n || j < 0 || j >= n || t[i][j] == 1) {
return;
}
if(m[i][j] == 0) {
return;
}
if(i == n - 1 and j == n - 1) {
t[i][j] = 1;
vector<int> c;
... | ALGO | 0.999987 | 5.22669 |
91531209-44b4-4b3a-bc21-b5bbe3175c13 | QuantumGhost/yuzu | src/shader_recompiler/frontend/maxwell/translate/impl/integer_minimum_maximum.cpp | #include "common/bit_field.h"
#include "common/common_types.h"
#include "shader_recompiler/frontend/maxwell/translate/impl/impl.h"
namespace Shader::Maxwell {
namespace {
void IMNMX(TranslatorVisitor& v, u64 insn, const IR::U32& op_b) {
union {
u64 insn;
BitField<0, 8, IR::Reg> dest_reg;
Bi... | ALGO | 0.946061 | 7.34062 |
fe2cb0a8-9b17-4ab6-ac9c-14d23487656d | primihub/hackathon | winning-project/ABY/aby/poly_ay/pppt.cpp |
#include "pppt.h"
#include <abycore/circuit/booleancircuits.h>
#include <abycore/sharing/sharing.h>
int32_t
test_pppt_circuit (e_role role, const std::string &address, uint16_t port,
seclvl seclvl, uint32_t bitlen, uint32_t nthreads,
e_mt_gen_alg mt_alg, e_sharing sharing, uint32... | ALGO | 0.949368 | 4.626606 |
b8fbfbf6-ac5d-4850-9d53-bd55c2d59987 | Alex-Beng/ojs | FuckAlgorithmAnalysis/noj/1209_滑雪.cpp | #include <cstring>
#include <iostream>
using namespace std;
int rows,cols;
int height[233][233];
int dp[233][233];
int direction[4][2] = {{1,0}, {-1,0}, {0,1}, {0,-1}};
int ans;
bool is_valid(int row, int col) {
if (row<0 || row>=rows || col<0 || col>=cols) {
return false;
}
return true;
}
int df... | ALGO | 0.999746 | 5.070669 |
449c4640-03f8-4e1f-a0f7-29a436d324ee | ishandutta2007/codeforces | lucina/normal/1234/A.cpp | #include<bits/stdc++.h>
using namespace std;
int solve(){
int sum = 0,n ,x;
scanf("%d",&n);
for(int i=1;i<=n;i++)
scanf("%d",&x),sum += x;
return ((sum - 1) / n + 1);
}
int main(){
int q;
cin >>q;
while(q--){
printf("%d\n",solve());
}
} | ALGO | 0.998564 | 3.349663 |
62a4cc37-c54f-4fe7-b4c4-7b2727a34ed7 | prashantkalokhe/Hactoberfest-2022-New | count_inversions.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution{
public:
// arr[]: Input Array
// N : Size of the Array arr[]
// Function to count inversions in the array.
long long int inversion&merge(long long int arr[],long long int lb,long long int mid,l... | ALGO | 0.99983 | 6.051386 |
7137d327-7365-4069-a8d9-d73d1a075a5f | cocosabio97/ED | 6.- Árboles Genealógicos/Prac6.cpp | /*
* ---------------------------------------------------
* ESTRUCTURAS DE DATOS
* ---------------------------------------------------
* Indica el nombre y apellidos de los componentes del
* grupo:
*
* Nombre 1: Fernando Hermoso Cara
* Nombre 2: Ignacio Palls Gozlvez
* ------------------------------------... | ALGO | 0.999707 | 4.153676 |
10bb4573-80b5-4293-9b17-0059ca3db3b6 | yasharth291/CPP-tutorials-and-CP-questions- | Codechef/ZCOPRAC/ZCO13001.cpp | #include <iostream>
#include <algorithm>
#include<bits/stdc++.h>
using namespace std;
long long int sumPairs(long long int arr[],long long int n) ;
int main() {
long long int n,i,sum=0;
scanf("%lld",&n);
long long int a[n];
for(int i=0;i<n;i++)
{
scanf("%lld",&a[i]);
}
std::s... | ALGO | 0.999988 | 4.085718 |
68eaa3e9-c453-4e1d-8cd5-a9a12d6e255d | cyruscyliu/videzzo-llvm-project | clang-tools-extra/clang-doc/Representation.cpp | namespace clang {
namespace doc {
namespace {
const SymbolID EmptySID = SymbolID();
template <typename T>
llvm::Expected<std::unique_ptr<Info>>
reduce(std::vector<std::unique_ptr<Info>> &Values) {
if (Values.empty())
return llvm::createStringError(llvm::inconvertibleErrorCode(),
... | TOOL | 0.956527 | 7.603121 |
d21bd7bf-bebe-48d9-8772-92c80c347806 | Biplabsarkar2018b/Local-CPP-Codes | moorevooting.cpp | #include<bits/stdc++.h>
using namespace std;
int majorityElement(vector<int>& v){
int prev = v[0];
int count = 1;
for(int i=1;i<v.size();i++){
if(v[i]==prev){
count++;
}else{
count--;
if(count==0){
prev = v[i];
count++;
... | ALGO | 0.999892 | 4.618841 |
1a13ffaf-0c61-4e7a-97d2-ba4ed44f0ad9 | ramanrewati/leetcode-POTD | lc2616.cpp | class Solution {
private:
bool isValid(int thresh, const vector<int>& nums, const int p) {
int cnt = 0;
for(int i = 0 ; i < nums.size()-1 ; ) {
if(abs(nums[i] - nums[i+1]) <= thresh)
cnt++ , i += 2;
else i++;
if(cnt==p) return true;
}
... | ALGO | 0.999985 | 5.633976 |
68292824-5a34-4d1b-adc5-dd35053fdd84 | Corycle/OI-Codes | Bashu OnlineJudge/5281.cpp | /*====Corycle====*/
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline")
#pragma GCC optimize("-fgcse")
#pragma GCC optimize("-fgcse-lm")
#pragma GCC optimize("-fipa-sra")
#pragma GCC optimize("-ftree-pre")
#pragma GCC optimize("-ftree-vrp")
#pragma GCC optimize("... | ALGO | 0.999804 | 4.132342 |
a6dd8151-02a7-4a55-bd8c-7d250c5f854b | uday-biswas/learnings | learning_dsa_cpp_luv/hcf.cpp | #include <bits/stdc++.h>
using namespace std;
int hcf(int a , int b){
int min_ = min(a,b),hcf;
for (int i=1; i<=min_; i++){
if (a% i ==0 && b%i ==0){
hcf = i;
}
}
return hcf;
}
int main() {
cout<<hcf(7,12);
return 0;
} | ALGO | 0.999869 | 5.19364 |
937fa0f7-7a79-4615-836f-8e9bfed83e61 | Guitar-Thanakrit/pethub | 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.998689 | 6.787361 |
7b335ca8-b537-433f-be98-270e5b994f35 | Harsh1820/dsa-love-babbar | kSumPaths-tree.cpp | // { Driver Code Starts
//Initial template for C++
#include <bits/stdc++.h>
using namespace std;
struct Node
{
int data;
Node *left;
Node *right;
Node(int val) {
data = val;
left = right = NULL;
}
};
// Function to Build Tree
Node *buildTree(string str)
{
// Corner Case
... | ALGO | 0.999809 | 6.582765 |
cc549d84-b833-45d3-a10a-6aa47c9f9d3d | somu-bs/Leetcode | 0338-counting-bits/0338-counting-bits.cpp | class Solution {
private:
int cntTotal(int num) {
int cnt = 0;
for(int i = 0;i<32;i++) {
if(num & (1 << i)) cnt++;
}
return cnt;
}
public:
vector<int> countBits(int n) {
vector<int> ans(n+1, 0);
for(int i = 1;i<=n;i++) {
a... | ALGO | 0.999942 | 5.91955 |
d9c0ccbd-6d59-496a-8851-aa8b7bbf8bd2 | bochen4566/C- | lab05/STARTER-lab05-main/countPrimes.cpp | #include "arrayFuncs.h"
#include <cstdlib>
#include <iostream>
#include "utility.h"
int countPrimes(int a[], int size) {
return -42; // STUB! Replace with correct code.
}
| TOOL | 0.972679 | 3.569702 |
07ddeb5a-09d3-4106-9667-64aaaf66a0ab | MiguelLaraB/creditcard-api | creditcardvenv/lib/python3.12/site-packages/sklearn/svm/src/liblinear/tron.cpp | #include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include "tron.h"
#ifndef min
template <class T> static inline T min(T x,T y) { return (x<y)?x:y; }
#endif
#ifndef max
template <class T> static inline T max(T x,T y) { return (x>y)?x:y; }
#endif
static void default_print(const char *buf)
{... | ALGO | 0.999624 | 5.847107 |
e19b3c08-11fa-43cf-9812-84a82602bda3 | AndroidBBQ/android10 | frameworks/av/media/libstagefright/codecs/amrnb/common/src/norm_s.cpp | /*
Pathname: ./gsm-amr/c/src/norm_s.c
------------------------------------------------------------------------------
REVISION HISTORY
Description: Created separate file for the norm_s function. Sync'ed up
with the current template and fixed tabs.
Description: Updated input/output definition and module... | ALGO | 0.99316 | 5.865812 |
31fda901-c32c-420a-960e-5d78a64f2b42 | virtleo/lanqiao | 十三/9.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mo=1e9+7;
int n,m;
ll f[110][110][110];//dp
//i,j,kֱΪ n,m,k
int main()
{
cin>>n>>m;//nΪ꣬mΪ
f[0][0][2]=1;
for(int i=0;i<=n;i++)
{
for(int j=0;j<=m;j++)
{
for(int k=0;k<=m;k++)
{
if(i&&k%2==0)f[i][j][k]=(f[i][j][k]+f[i-1][j][k... | ALGO | 0.999977 | 4.410986 |
07eb3430-ef48-487a-9edf-d81eaa893060 | enesovski/MLFQ-CPU-Scheduler | Implementation/Process.cpp | #include "Process.h"
//Enes Ceran
//ID: 22302324
//Section 1
Process::Process(int _pid, int _burst, int _arrivalTime)
{
pid = _pid;
burstTime = _burst;
arrivalTime = _arrivalTime;
remainingTime = burstTime;
usedQuantum = 0;
end = -1;
}
Process::~Process() = default;
Process::Process(const P... | ALGO | 0.98256 | 4.515026 |
aebbe086-274c-400f-9edb-7dcc7cd1abb1 | SirajMM/Login_page_flutter | 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.998859 | 6.785645 |
595e827b-98c2-46f7-9908-160e3c38d04f | Mondiegus/Cpp_Learning | My_Tasks/3/T3_7.cpp | #include <iostream>
#define KMTOMILES (62.14/100)
#define GALONTOLITRES (3.875)
using namespace std;
void convertFunc(double);
int main()
{
double efficiency = 0, gasoline = 0, gasolineBackup = 0;
cout << "How many litres per km are you using?" << endl;
cin >> efficiency;
if(efficiency >= 0)
... | TOOL | 0.912376 | 3.792183 |
0224e7eb-4e31-4bac-97e3-4caeb73e8644 | lksa4e/Algorithm-Study-Cpp | BOJ/0818/BOJ1992_김경준.cpp | #include <iostream>
#include <map>
#include <vector>
#include <queue>
#include <tuple>
#include <stack>
#include <string>
#include <set>
#include <functional>
#include <algorithm>
#include <math.h>
#include <cctype>
#include <sstream>
#pragma warning(disable:4996)
#define endl '\n';
#define all(x)
#define INF int(1e9)... | ALGO | 0.99948 | 4.899635 |
36d4e359-d418-4d73-9914-2fb265fa1c54 | Anu-rag200/daily-dsa-dose | take you forward problem question/array easy/linearseearch.cpp | // Linear Search
// https://www.codingninjas.com/studio/problems/linear-search_6922070
#include<bits/stdc++.h>
using namespace std;
int linearSearch(int n, int num, vector<int> &arr)
{
for(int i=0;i<n;i++){
if(arr[i] == num){
return i;
}
}
return -1;
} | ALGO | 0.999909 | 5.534908 |
b2f7c718-6b79-473a-8f74-4ecc546b13c6 | OdarkaDetroit/Procedural-Programming-CS2 | test_2019/First.cpp | #include "Functions.h"
#include <cmath>
using namespace std;
// 1. Для змінної unsigned int n спростити
// вираз n = ~n ? n : 0xFFFFFFFF.
double First(unsigned int n)
{
//~n == 0 ? 0xFFFFFFFF : n;
int n_different = ~n;
if (n == n_different)
return n;
else return 0xFFFFFFFF;
}
| ALGO | 0.996927 | 4.265996 |
2ba94d13-a282-496e-bdf3-9e84c1e35cc3 | Ryoukiwei/Leetcode | 643 Maximum Average Subarray I.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution
{
public:
double findMaxAverage(vector<int> &nums, int k)
{
int sum = accumulate(nums.begin(), nums.begin() + k, 0);
int ans = sum;
for (int i = k; i < nums.size(); i++)
{
sum += nums[i] - nums[i - k];
... | ALGO | 0.999602 | 5.803901 |
09959111-cba7-4636-95c4-e79fe9886516 | avramdj/MATF | AISP/ISPIT/petljaVar.cpp | #include <iostream>
#include <vector>
using namespace std;
void sveVar(vector<int>& var, int n, int p){
int k = var.size();
if(p == k){
for(auto& x : var){
cout << x << " ";
}
cout << endl;
} else {
for(int i = 1; i <= n; i++){
var[p] = i;
... | ALGO | 0.999807 | 3.540375 |
87e55c72-d5f6-49ca-998e-52065f0bc507 | aayush2761/CSES | rANGEqUERIES/RangeXor.cpp | #include<iostream>
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
//Speed
#define fastio() ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
//Macros
#define IOtext freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
#d... | ALGO | 0.999977 | 4.835024 |
22836e7b-db2b-4e89-a2ad-2461d733b00d | dgpk/agent-secure-scheduler | GASched.cpp | /*
* File: main.cpp
* Author: daniel
*
* Created on 19 czerwca 2016, 23:36
*/
#include <cstdlib>
#include <iostream>
#include <string>
#include <vector>
#include <time.h>
#include <stdlib.h>
#include <functional>
#include <iomanip>
#include <fstream>
#include <cmath>
#include <chrono>
#include <ctime>
#include ... | ALGO | 0.998199 | 3.616979 |
9086725f-ca86-468e-a2d6-402021ec44b5 | UnpureRationalist/myLeetcodeAnswer | top-interview-150/162-寻找峰值.cpp | #include "header.h"
class Solution {
public:
int findPeakElement(vector<int> &nums) {
int left = 0, right = nums.size() - 1;
while (left < right) {
int mid = left + (right - left) / 2;
if (nums[mid] > nums[mid + 1])
right = mid;
else
left = mid + 1;
}
return left;
... | ALGO | 0.999647 | 5.352605 |
6bdbf4f5-4443-4bc0-929e-4e81198f210f | zinchuriki/CODEFORCES | A. Olesya and Rodion.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n, t;
cin >> n >> t;
if (t == 1 || t == 2 || t == 3 || t == 4 || t == 5 || t == 6 || t == 7 || t == 8 || t == 9)
for (int i = 0; i < n; ++i)
cout << t;
else
{
... | ALGO | 0.999601 | 3.750835 |
d8a0056f-875e-4024-b5ce-6e49543ec7fe | PratikGupta114/LFR_8_channel_sensor | Sensor.cpp |
#include <stdint.h>
#include <stdbool.h>
#include <Arduino.h>
#include "Defaults.h"
#include "Sensor.h"
#include "PinDefinitions.h"
#include "Config.h"
#include "Wire.h"
#define BYTE_TO_BINARY_PATTERN "%c%c%c%c%c%c%c%c"
#define BYTE_TO_BINARY(byte) \
(byte & 0x80 ? '1' : '0'), \
(byte & 0x40 ? ... | TOOL | 0.859679 | 3.409148 |
0a4127c1-20bb-45ab-b2bf-693a42612e93 | otavioon/COLA-2022-Tools | datasets/src/optz/poj/0/61_1279.cpp | #include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <iostream>
using namespace std;
/*
* ????1203.cpp
* ??????
* ?????2012-12-12
* ???????????????
*/
int main() {
char str[100], *p = NULL; //????
cin.getline(str, 100); //????
p = str; //?????
for (p = str; *p != '\0'; ++p) {... | ALGO | 0.999729 | 3.225604 |
70b0ef18-d214-4187-9a70-78cc194bfafe | Anushkakumari123/youtube | cpp/stl.cpp/printcounting.cpp | #include<iostream>
using namespace std;
void print (int n){
//base case
if(n==0){
return ;
}
cout<<n<<endl;
print(n-1);
}
int main (){
int n;
cin>>n;
print(n);
return 0;
} | ALGO | 0.999783 | 4.568334 |
3c56ba61-f93e-43dc-8542-c09c6425330b | drreynolds/Math6370-labs | lab2-intermediate_unix/vector_product.cpp | /* Daniel R. Reynolds
SMU Mathematics
Math 4370 / 6370
*/
// Description: computes the pointwise product u*v=w for vectors of length n
void vector_product(int n, double* u, double* v, double* w) {
for (int i=0; i<n; i++)
w[i] = u[i] * v[i];
return;
}
| ALGO | 0.99926 | 4.525692 |
7a7be352-1132-49ff-bd9d-d41473f0bead | stonezk/Thinputer3D_ReadBack | VirtualBox-5.0.12-Thinputer/src/VBox/NetworkServices/NetLib/ComHostUtils.cpp | /* $Id: ComHostUtils.cpp $ */
/** @file
* ComHostUtils.cpp
*/
/*********************************************************************************************************************************
* Header Files ... | TOOL | 0.965808 | 6.336533 |
17c65384-b3a2-4d3b-9e5f-f75c8eb5dad5 | ishandutta2007/codeforces | dengyaotriangle/normal/1065/C.cpp | #include<bits/stdc++.h>
using namespace std;
const int maxn=200005;
long long a[maxn],q[maxn],k;
int n;
long long mi=10000000,xi=0;;
int main(){
ios::sync_with_stdio(0);
cin>>n>>k;
for(int i=1;i<=n;i++){
cin>>a[i];
mi=min(mi,a[i]);
xi=max(xi,a[i]);
q[a[i]]++;
}
lo... | ALGO | 0.999981 | 3.712148 |
f4f00fd9-e611-4fa6-8135-15b8b68b9641 | AtharvaPanegai/CppLearning | DSA/Stack/StackPractice/program.cpp | #include "bits/stdc++.h"
using namespace std;
bool isValid(string s)
{
int n = s.size();
stack<char> st;
bool ans = true;
for (int i = 0; i < n; i++)
{
if (s[i] == '{' || s[i] == '[' || s[i] == '(')
{
st.push(s[i]);
}
else if (s[i] == ')')
{
... | ALGO | 0.999511 | 5.373934 |
8f70b496-ba32-4de2-98ad-a43641f428eb | HONGJICAI/LeetCode | cpp/390.cpp | class Solution {
// Runtime: 8 ms, faster than 80.71% of C++ online submissions for Elimination
// Game. Memory Usage: 8.3 MB, less than 36.46% of C++ online submissions for
// Elimination Game.
public:
int lastRemaining(int n) {
function<int(int, bool)> dfs = [&dfs](int n, bool left) {
if (n == 1)
... | ALGO | 0.999955 | 6.342683 |
094c3231-8c52-438d-ade3-08e739801b22 | Yawn-Sean/Daily_CF_Problems | daily_problems/2024/04/0416/personal_submission/cf623a_hopeworse.cpp | // link : https://codeforces.com/contest/623/submission/256891136
void solve() {
int n, m;
cin >> n >> m;
vector<vector<int>> mp(n + 1, vector<int>(n + 1));
for (int i = 1; i <= m; i++) {
int u, v;
cin >> u >> v;
mp[u][v] = 1;
mp[v][u] = 1;
}
vector<char> color(n... | ALGO | 0.999971 | 5.215404 |
911547ac-5caa-4566-a7ca-9bf9efcdb547 | AnikiFan/Tongji-DataStructure-Homework | 数据结构实现/栈和队列/静态数组队列实现/静态数组.cpp | #include<stdio.h>
#define MAX_SIZE 100
#define OK 1
#define ERROR 0
typedef int Status,ElemType;
typedef struct {
ElemType base[MAX_SIZE];
int top;
}SqStack;
Status InitStack(SqStack &S)
{
S.top = 0;
return OK;
}
Status Push(SqStack &S,ElemType e)
{
if(S.top==MAX_SIZE)
return ERROR;
S.base[S.top++]=e;
retur... | ALGO | 0.878911 | 3.335221 |
7eb05444-6f67-4893-82f0-a512190ca93e | GhassenDhif7/e_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.9988 | 6.76073 |
25a93bdf-4ffa-40b2-8c56-9e93c575bad0 | HQVFX42/Algorithm | Algothingy/3474.cpp | #include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
const int dx[] = { 1,0,-1,0 }, dy[] = { 0,1,0,-1 };
bool OOB(int x, int y, int n, int m) { return x < 0 or x >= n or y < 0 or y >= m; }
void FastIO() { ios::sync_with_stdio(false); cin.tie(nullptr); }
int main()
{
FastIO();
int TC = 0;
cin... | ALGO | 0.999699 | 5.229585 |
60a18e3e-efa0-4044-a0a2-25fb31de50b4 | Dhruva1098/learnCpp | dsa/rest/n_meetings_in_one_room.cpp | #include <utility>
#include <vector>
int max_meetings_possible(int n, int start[], int end[]){
int min = 0;
int count = 0;
std::vector<std::pair<int,int>> v;
for(int i = 0; i<n; i++){
v.push_back({end[i], start[i]});
}
sort(v.begin(), v.end());
for(auto it : v){
if(min < it.second){
min = it... | ALGO | 0.999504 | 5.28601 |
a484cca8-9a14-4b47-a234-25431958dbf6 | zyfgisrs/CppLeetNinjas | 1-50/0024两两交换链表中的节点/0024swap-nodes-in-pairs_dg.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:
ListNode* swapPairs(ListNode* head) {
if (head == nullptr || head->next == nu... | ALGO | 0.999971 | 5.229298 |
cfd672d1-003b-412c-896d-cc84f4ddd299 | cvrseq/Al-Kindy-analyzer | main.cpp | #include <iostream>
#include <string>
#include <map>
class AlKindiCryptanalysis {
private:
std::map<char, int> frequencyMap;
public:
std::string analyze(const std::string& ciphertext) {
for (char c : ciphertext) {
frequencyMap[c]++;
}
char mostFrequentChar = cipher... | ALGO | 0.999923 | 5.309586 |
aa307982-060b-4855-ad25-dcb13f96caab | sayantan1413/CP | A_Insert_Digit.cpp | #include "stdc++.h"
using namespace std;
void solve(string s, int n, int d){
for(int i=0;i<n;++i) {
if(s[i] - '0' >= d) {
cout << s[i];
} else {
cout << d;
for(int j = i; j < n; ++j) {
cout << s[j];
}
cout << "\n";
... | ALGO | 0.99982 | 4.301118 |
52d89bf1-7073-420d-87a6-4c53bf141bec | mafemello/Advanced-Algorithms | [5th WEEK] Inversions, Luchu and Solve It/inversions.cpp | /*
Counting Invertions
Advanced Algorithms
Maria Fernanda Lucio de Mello
nUSP: 11320860
*/
#include <iostream>
#include <vector>
#include <stdio.h>
using namespace std;
// global
vector<int>elem;
vector<int> aux;
int Combine (int left, int middle, int right) {
int i = left; // left vector
int j = middle; //... | ALGO | 0.999797 | 4.434232 |
4d7b888e-8dbf-4bb7-9b76-8b2ddde0b78d | geometer/FBReader | fbreader/src/libraryTree/LibraryByAuthorView.cpp | #include "LibraryView.h"
#include "LibraryNodes.h"
#include "../library/Library.h"
#include "../library/Book.h"
#include "../library/Author.h"
LibraryByAuthorView::LibraryByAuthorView(ZLPaintContext &context) : LibraryView(context) {
}
void LibraryByAuthorView::addAuthorSubtree(shared_ptr<Author> author, size_t atPo... | ALGO | 0.982652 | 6.396378 |
028fa286-352a-4a73-9bd3-495474a65772 | jhmin-kk99/Algorithm-Study | DP/12852.cpp | #include <iostream>
#include <algorithm>
using namespace std;
int d[1000005], pre[1000005], n;
//pre : 경로 추적
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cin >> n;
d[1] = 0;
for (int i = 2; i <= n; i++)
{
d[i] = d[i - 1] + 1;
pre[i] = i - 1;
if (i % 2 == 0 && d[... | ALGO | 0.999998 | 4.003223 |
51ffcd3f-c29d-46c7-ae9f-27583812eeb1 | ios4u/Math-Blast | MathBlast/libs/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.996755 | 7.235566 |
bb215ecb-5fe2-421f-9965-6ca5748a98b5 | OTTFFYZY/StandardCodeLibrary | Mathematics/NumberTheory/PowerReductionFormula_0.cpp | typedef long long LL;
LL qm(LL a,LL n,LL m)
{
LL ans=0;
while(n)
{
if(n&1) ans=(ans+a)%m;
a=(a+a)%m;
n>>=1;
}
return ans;
}
LL qp(LL a,LL n,LL m)
{
LL ans=1;
while(n)
{
if(n&1) ans=qm(ans,a,m);
a=qm(a,a,m);
n>>=1;
}
return ans;
}
LL phi(LL n)
{
LL ans=n;
for(LL i=2;i*i<=n;i++)
if(n%i==0)
{... | ALGO | 0.99992 | 3.475611 |
75b35598-d57e-4f74-8ade-92513fcdebbe | phire/Jedi-Outcast | utils/q3data/vect3.cpp | #include "vect3.h"
const Vect3 Vect3X(1.f,0.f,0.f);
const Vect3 Vect3Y(0.f,1.f,0.f);
const Vect3 Vect3Z(0.f,0.f,1.f);
const Vect3 Vect3negX(-1.f,0.f,0.f);
const Vect3 Vect3negY(0.f,-1.f,0.f);
const Vect3 Vect3negZ(0.f,0.f,-1.f);
const Vect3 Vect3Zero(0.f,0.f,0.f);
const Vect3 &Vect3::operator/= (const float d)
{
flo... | TOOL | 0.909611 | 4.747886 |
b7203e7b-641a-44a1-b460-a03e23035fb2 | alexandraback/datacollection | solutions_5646553574277120_1/C++/Storm/ProbC.cpp | /*#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <queue>
#include <stack>
#include <set>
using namespace std;
int main()
{
freopen("C:\\Projects\\gcj\\input.txt", "r", stdin);
freopen("C:\\Projects\\gcj\\output.txt", "w", st... | ALGO | 0.999573 | 3.397165 |
037908fc-5709-4b70-a875-e931f5027a81 | Aadarsh-aadi/Leetcode-and-GeeksForGeek | 556-next-greater-element-iii/556-next-greater-element-iii.cpp | class Solution {
public:
int nextGreaterElement(int n) {
string nums = to_string(n);
if(!nextPermutation(nums)) return -1;
long long result=stoll(nums);
return (result>INT_MAX || result<=n)? -1:result;
}
private:
bool nextPermutation(string& nums) {
if(nums.empty()) r... | ALGO | 0.999894 | 5.736605 |
6dc1b6db-4d3a-4df5-b9e0-b9d79e7ad103 | mejibyte/competitive_programming | UVa/11590 - Prefix lookup/11590.6.cpp | /*
Accepted!
*/
#include <iostream>
#include <map>
#include <cstdio>
#include <cstring>
#include <cassert>
using namespace std;
#define D(x) cout << #x " is " << (x) << endl
typedef unsigned long long uint64;
struct node{
bool end;
node * left;
node * right;
node(bool end) : end(end) {
left = right =... | ALGO | 0.999507 | 3.652508 |
4f0f6f84-c2c4-4c18-a736-b9a1c410cb3a | arunkp1986/Kindle | hscc/gem5/src/systemc/tests/systemc/misc/examples/parsing/activa.cpp | /*****************************************************************************
activa.cpp --
Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
*****************************************************************************/
/*****************************************************************************... | ALGO | 0.976198 | 6.045314 |
571f8c8a-cd62-4348-8880-1ba27ae0a622 | rockyappdev/LiveStageMMD-GLKit-GLES2 | LVSTG gles2/LVSTG gles2/Src_Bullet_282/BulletCollision/BroadphaseCollision/btDbvt.cpp | ///btDbvt implementation by Nathanael Presson
#include "btDbvt.h"
//
typedef btAlignedObjectArray<btDbvtNode*> tNodeArray;
typedef btAlignedObjectArray<const btDbvtNode*> tConstNodeArray;
//
struct btDbvtNodeEnumerator : btDbvt::ICollide
{
tConstNodeArray nodes;
void Process(const btDbvtNode* n) { nodes.push_bac... | ALGO | 0.992746 | 6.11591 |
66e84077-c7a5-460f-bfb3-f0de5ad9cffc | sim0nnesterov/my_tasks | informatics.msk/3329_Дерево_интервалов_с_присваиванием_на_отрезке.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
struct Node {
ll val, set;
};
vector<ll> a;
vector<Node> st;
void apply(ll v, ll l, ll r, ll x) {
if (x != -1) {
st[v].val = x;
st[v].set = x;
}
}
void push(ll v, ll l, ll r) {
ll mid = (l + r) / 2;
apply(2... | ALGO | 0.999868 | 5.043729 |
bc098326-8e57-45cd-bcc3-97938f6d1f92 | NehaChaudhary311/Competitive-Programming-Problems-2020 | Dynamic Programming/Minimum number of jumps to reach end.cpp | // { Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
// Function to return minimum number of jumps to end of array
int minJumps(int arr[], int n){
// Your code here
int* jumps = new int[n];
if (n == 0 || arr[0] == 0) return -1;
jumps[0] = 0;
for (int i =... | ALGO | 0.999926 | 5.849077 |
76a6f87f-b648-4f0f-a1a6-6d9b8b4c998b | rvgpu/rvgpu-llvm | llvm/lib/Transforms/Scalar/LoopUnrollAndJamPass.cpp | #include "llvm/Transforms/Scalar/LoopUnrollAndJamPass.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/PriorityWorklist.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Analysis/AssumptionCache.h"
#include "llvm/Analysis/CodeMetrics.h"
#include "llvm/Analysis/DependenceAnalysis.h"... | ALGO | 0.995847 | 6.831436 |
438776af-3fef-43ba-bd05-d6aaa24e5d86 | ivalani/TC1033 | Ejercicios_1/2_NumPrimos.cpp | //Programa que imprime el número de números primos que hay entre 1 y 1000
#include <conio.h>
#include <stdio.h>
int main()
{
int contador, n, primo;
printf( "\n " );
for ( n = 1 ; n <= 1000; n++ )
{
primo = 1;
contador = 2;
while ( contador <= n / 2 && primo )
{
... | ALGO | 0.999169 | 3.624619 |
864117df-e34d-489c-ac26-19e7255b45c1 | zjukk/LeetCode-is-my-son | 56-mergeIntervals.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
struct Interval {
int start;
int end;
Interval() : start(0), end(0) {}
Interval(int s, int e) : start(s), end(e) {}
};
static bool cmp(const Interval& a, const Interval& b) {
return a.start < b.start;
}
ve... | ALGO | 0.999711 | 4.053517 |
dd9d82a8-e153-403e-bf2c-3f06884e9b97 | zimpha/acm-icpc | USACO/2001/open/orange/base.cpp | #include <cstdio>
#include <cstring>
const int MAXN=50;
int num[MAXN];
int s, t, bs, bt;
void tonum(int n, int base)
{
memset(num, 0, sizeof(num));
while (n)
{
num[0]++;
num[num[0]]=n%base;
n/=base;
}
}
bool check()
{
for (int i=1; i<=num[0]/2; i++)
if (num[i]!=num[num[0]-i+1]) return false;
return tr... | ALGO | 0.999226 | 4.302272 |
1d317036-c44f-4378-a2f9-ceecf9f7c394 | MarcoSpagnoli/Kalc | Calculator.cpp | //
// Created by Marco on 12/07/2025.
//
#include "Calculator.h"
int Calculator::max(int a, int b, int c) {
b = b > a ? b : a;
c = c > b ? c : b;
return c;
}
int Calculator::min(int a, int b, int c) {
b = b < a ? b : a;
c = c < b ? c : b;
return c;
}
int Calculator::mean(int a, int b, int c)... | TOOL | 0.924046 | 4.923231 |
49078e93-9707-45fe-abe8-9fe7fe00aada | sparsh2002/Placement-Course-cpp | codeforces/RANDOM_PROBLEMS/1200/10_Pashmak_and_Garden.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vii;
typedef vector<ll> vl;
typedef vector<vl> vvl;
#define rep(i,a,b) for(int i=a ; i<b ; i++)
#d... | ALGO | 0.999654 | 3.38114 |
792642a0-a7dd-4842-9073-b733eacd57d2 | KienPT0610/COPEPTIT | DSA/HoanViXauKiTu.cpp | #include <bits/stdc++.h>
typedef long long ll;
typedef double db;
using namespace std;
//JohnBelus//
int c[101] = {}, b[101] = {};
void display(string s) {
for(int i = 0; i < s.length(); i++) {
cout << s[b[i]];
}
cout << ' ';
}
void backtrack(int pos, string s) {
for(int i = 0; i < s.length()... | ALGO | 0.999921 | 5.061809 |
1f643387-f05f-4c03-ad15-9ef90bbd4c31 | anoobzg/qi | src/tbb/src/examples/task/tree_sum/SerialSumTree.cpp | #include "common.h"
Value SerialSumTree( TreeNode* root ) {
Value result = root->value;
if( root->left )
result += SerialSumTree(root->left);
if( root->right )
result += SerialSumTree(root->right);
return result;
}
| ALGO | 0.99684 | 4.495154 |
aa1200fc-152b-4297-ba0a-57d31fd7e010 | bBookout/TowersOfHanoiGame | TowersOfHanoi/TowersOfHanoi/TowersOfHanoi.cpp | // TowersOfHanoi.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
using namespace std;
int myMoves(0);
void MakeMoves(int n, char a, char b, char c);
void MakeMoves(int n, char a, char b, char c){
myMoves++;
if (n == 1){
cout << "Move disc " << n << " from " <... | ALGO | 0.997744 | 5.83026 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.