uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
a7b2fde5-edb7-4cd9-b2df-630f9c935987 | onyx6838/algorithm | Tin Dai Cuong & Lap Trinh Nang Cao/Tin dai cuong/For/Bai 6 for.cpp | /* kiem tra xem co phai so hoan hao khong */
#include<stdio.h>
main (){
int n,i,s;
scanf ("%d",&n);
s=0;
if (n<0)
printf ("khong thoa man");
else
{
for (i=1;i<n;i++)
{
if (n%i==0)
s=s+i;
else s=s;
}
if (s==n)
printf("--> %d la so nguyen to",n);
else
printf ("khong thoa man"); }
}
| ALGO | 0.999984 | 3.407272 |
4cad4d70-a055-441a-b3d1-a377259a74b1 | GuacheSuede/MSSubmission1234567890 | submission/ema/boost_1_69_0/libs/context/example/execution_context_v2/fibonacci.cpp | #include <cstdlib>
#include <iostream>
#include <memory>
#include <boost/context/execution_context.hpp>
namespace ctx = boost::context;
int main() {
int n=35;
ctx::execution_context< int > source(
[n](ctx::execution_context< int > && sink, int) mutable {
int a=0;
int b=1;
... | ALGO | 0.986487 | 5.340264 |
7fbdcde9-b60a-4f29-b083-5a4bd0749c92 | p1yush/code | Coding Ninjas/Arrays/BestTimeToBuyAndSellStock2.cpp | long getMaximumProfit(long *values, int n)
{
long long count = 0;
int sell = 0, buy = 0;
for(int i = 1; i < n; i++) {
if(values[i] >= values[i - 1])
sell++;
else {
count += values[sell] - values[buy];
buy = i;
sell = i;
}
}
... | ALGO | 0.999799 | 5.069734 |
48babb8a-1d03-4209-8427-68f373b2daf8 | AgreHarshal/Codeforces_Contests | code_896_div2/C_Fill_in_the_Matrix.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
const int mod = 1e9 + 7;
void precal()
{
}
int gcd(int a, int b)
{
if (b == 0)
return a;
return gcd(b, a % b);
}
// Function to return LCM of two numbers
int lcm(int a, int b)
{
return (a / gcd(a, b)) * b;
}
void solve()
{
int n... | ALGO | 0.999963 | 4.20722 |
88bdec07-fbb9-4a3f-bf3c-9e37919f4fff | kabsmeiou/cp-solutions | Rounds/Round 906(Div 2)/C.cpp | #include <bits/stdc++.h>
using namespace std;
signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int T;
cin >> T;
while (T--) {
int n;
string s;
cin >> n >> s;
if (n & 1) {
cout << -1 << '\n';
continue;
}
int cur1 ... | ALGO | 0.99934 | 5.017053 |
d175f240-28f6-460a-ae85-4f83cba91b43 | zhouyium/myoj | 5736/5736.cpp | //http://<IP_ADDRESS>/problem.php?id=5736
//5736: ѧϰ߶ II
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXN=1e4+10;
int a[MAXN];
int seg[4*MAXN];
void build_tree(int node, int l, int r) {
if (l>=r) {
seg[node]=a[l];
return;
}
int mid=(l+r)/2;
int l_node = 2*node;
int r_nod... | ALGO | 0.999964 | 3.916359 |
5659093b-81a1-435f-8195-20c676246baf | akamya997/PracticeCode | 201907_practice/1188/a2/a2.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#ifndef ONLINE_JUDGE
#define dbg(x...) do{cout << "\033[32;1m" << #x << "->" ; err(x);} while(0)
void err(){cout << "\033[39;0m" << endl;}
template<template<typename...> class T,typename t,typename... A>
void err(T<t> a,A... x){for (auto v:a) cout << v... | ALGO | 0.99994 | 3.904541 |
45d58efa-142a-46fb-a9b9-e7581cf1f4af | PaukIsUha/optimizing_formating_code | predictions/submissions-aizu-coop-gpt4/Codenet/p00740/146636770/response_1.cpp | #include <iostream>
using namespace std;
int main(void) {
int stone[50] = {0};
int bowl, n, p, ans;
while (1) {
cin >> n >> p;
if(n == 0 && p == 0) {
return 0;
}
bowl = p;
for (int i = 0; ; i = (i + 1) % n) {
if (bowl == 0) {
bowl = bowl + stone[i];
stone[i] = 0;
... | ALGO | 0.999825 | 3.343789 |
a1fe51be-33e1-4ac6-8e06-99f1a3423c9c | mozilla-spidermonkey/rust-frontend | netwerk/cache2/CacheHashUtils.cpp | #include "CacheHashUtils.h"
#include "mozilla/BasePrincipal.h"
#include "plstr.h"
namespace mozilla {
namespace net {
/**
* CacheHash::Hash(const char * key, uint32_t initval)
*
* See http://burtleburtle.net/bob/hash/evahash.html for more information
* about this hash function.
*
* This algorithm is used t... | TOOL | 0.878043 | 6.91541 |
a6f47717-c1cc-442e-abc1-84b36a95f953 | wangyonglin/ChatPlayer | src/components/sherpa-ncnn/include/ncnn-build/src/layer/x86/tanh_x86_avx.cpp | #include "tanh_x86_avx.h"
#include "x86_activation.h"
namespace ncnn {
TanH_x86_avx::TanH_x86_avx()
{
#if __SSE2__
support_packing = true;
#endif // __SSE2__
}
int TanH_x86_avx::forward_inplace(Mat& bottom_top_blob, const Option& opt) const
{
int w = bottom_top_blob.w;
int h = bottom_top_blob.h;
int... | ALGO | 0.953624 | 6.615372 |
f1855e8d-afab-4570-af0f-0fb21df4e5c3 | sarvex/leetcode-cobol | solution/2400-2499/2473.Minimum Cost to Buy Apples/Solution.cpp | using ll = long long;
using pii = pair<int, int>;
class Solution {
public:
const int inf = 0x3f3f3f3f;
vector<long long> minCost(int n, vector<vector<int>>& roads, vector<int>& appleCost, int k) {
vector<vector<pii>> g(n);
for (auto& e : roads) {
int a = e[0] - 1, b = e[1] - 1, c =... | ALGO | 0.99992 | 5.007036 |
6bf937db-1c23-47cb-9514-3ddde1a89a7d | PerfectLifeG/Algorithm-Competition | PracticeMakesPerfect/2023Spring/4.5/t7.cpp | #include<bits/stdc++.h>
using namespace std;
#define all(x) x.begin(),x.end()
const int N=100010;
#define lowbit(x) x&-x
int tr[N],a[N];
int s[8010][8010];
int main(){
ios::sync_with_stdio(0);cin.tie(0);
int n,q;cin>>n>>q;
for(int i=1;i<=n;i++)cin>>a[i];
for(int i=1;i<=n;i++){
for(int j=i;j<=n;j++){
if(a[j]<a[... | ALGO | 0.999658 | 3.411989 |
5c852c5c-80dd-46f5-b0a6-d1521dacbf4e | DeterministicChoco232/cppcp | codeforces/1804c.cpp | #include <iostream>
#include <algorithm>
#define ll long long int
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll t;
cin >> t;
while (t--) {
ll n,x,p; cin>>n>>x>>p;
ll mid=n/2;
bool isShiftPossible=n%2==0&&p>n;
ll sum=x;
bool ... | ALGO | 0.999949 | 3.470958 |
a02b0d3c-9c01-439c-9ee0-6299e5b890a4 | ishandutta2007/codeforces | flashmt/normal/171/B.cpp | #include <iostream>
#include <algorithm>
using namespace std;
int main()
{
int n;
long long ans=1;
cin >> n;
for (int i=1;i<n;i++) ans+=i*12;
cout << ans << endl;
} | ALGO | 0.999776 | 3.285269 |
bf6d6ed8-1c2b-4dbc-bb0b-f9b817602ca9 | ishandutta2007/codeforces | low_/normal/1268/C.cpp | #include<iostream>
#include<fstream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<deque>
#include<set>
#include<map>
#include<bitset>
#include<ctime>
#include<queue>
using namespace std;
#define int long long
#define mn 200005
#define inf 4444444444444444444
#define mod 1000000009
#def... | ALGO | 0.999964 | 3.493917 |
05705af3-0f1c-49e1-9932-d0bcbf6f3e76 | snikolov3/DEMSI_newLAMMPS | LAMMPS/src/USER-OMP/pair_gran_hertz_history_omp.cpp | /* ----------------------------------------------------------------------
Contributing author: Axel Kohlmeyer (Temple U)
------------------------------------------------------------------------- */
#include "omp_compat.h"
#include <cmath>
#include "pair_gran_hertz_history_omp.h"
#include "fix_neigh_history.h"
#incl... | ALGO | 0.999081 | 6.804372 |
935bddec-dbc7-4a42-bfdb-cb5dd8c6abcd | ishandutta2007/codeforces | dreamoon_love_aa/normal/884/D.cpp | #include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++... | ALGO | 0.999972 | 3.711982 |
fd3b4fd2-eba0-499c-a142-0fe7d3b012e6 | kushagra-18/Leetcode-solutions | 142-linked-list-cycle-ii/142-linked-list-cycle-ii.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
ListNode *detectCycle(ListNode *head) {
if(head == nullptr)
return nullptr;
bool isCyc... | ALGO | 0.999864 | 5.555511 |
0d012b7f-9b95-48ea-8883-36052901b086 | MKG0007/dsa-journal | array_Questions/leadersOfArray.cpp | leaders of the array--->elemets on its right side there is no greater element from that element.
broot force--> use nested loop and check on its right that is there any greater element is present or not if present then element is not the leader ele.
------------------------------------------------------------------... | ALGO | 0.999999 | 5.607744 |
3c217015-1119-4098-b08c-94cebe4ede73 | faros-ai/duckdb | src/core_functions/lambda_functions.cpp | #include "duckdb/core_functions/lambda_functions.hpp"
#include "duckdb/common/serializer/serializer.hpp"
#include "duckdb/common/serializer/deserializer.hpp"
#include "duckdb/planner/expression/bound_function_expression.hpp"
#include "duckdb/planner/expression/bound_cast_expression.hpp"
namespace duckdb {
//===----... | TOOL | 0.887355 | 7.829463 |
ae2b8777-6303-4f0b-b744-dab4f1710a72 | fantonio/eddaace | 1ºbim/cap02_Algoritmos_Recursivos/exer_algoritmos_recursivos/rec_func.cpp | #include<iostream>
/*
Algoritmo recursivo que recebe apenas um número inteiro x como parametro e retorna a soma dos seus digitos.
*/
using std::cout;
using std::cin;
using std::endl;
int soma(int numero){
if (numero % 10 == numero)
return numero;
return ((numero % 10) + soma(numero / 10));
}
int ma... | ALGO | 0.999577 | 5.532282 |
4004e204-d198-4546-bf84-853779b5aacd | axe-el/Uva-problems | 12541/12541.cpp | //12541 Clase persona para guardar la informacion, creo una funcion para comparar dos personas
//pRIMEero por year,mes,dia,nombre para usar sort para ordenarlos
#include <bits/stdc++.h>
using namespace std;
//Clase persona(dia,mes,year,nombre)
class Person{
public:
int dia;
int mes;
int year;
string name;
... | ALGO | 0.999787 | 3.777107 |
fba5fad4-c4e5-4c84-83e6-4e0d0076e192 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_9524_12.cpp | #include <bits/stdc++.h>
using namespace std;
string s[100];
string ans[2 * 100 - 1];
int n;
int dp[110][110];
int check(int dx, int dy) {
if (dp[dx + 55][dy + 55] != -1) return dp[dx + 55][dy + 55];
for (int i = 0; i < n; ++i) {
for (int j = 0; j < n; ++j) {
if (s[i][j] == 'o') {
if (i + dx >= n ... | ALGO | 0.999965 | 4.117881 |
b338038d-53c9-4e15-9315-cf3512d077d9 | NguyenNgocThanhPhuong/23521245_23521125_23521440_23521362_23521688_23521819_BT04 | Bai040/Bai040.cpp | #include <iostream>
#include <cmath>
#include<iomanip>
using namespace std;
void Nhap(int[][100], int&, int&);
void Xuat(int[][100], int, int);
int TongCot(int[][100], int, int, int);
int main()
{
int b[100][100];
int k, l;
cout << "Ma tran: \n";
Nhap(b, k, l);
cout << "\nMang ban dau: \n";
Xuat(b, k, l);
i... | ALGO | 0.988818 | 3.709769 |
10e09e24-9c46-406c-b1f3-23575686a500 | TheStranger512/Competitive-Programming-Stuff | SPOJ/AIBOHP.cpp | /* Solved
* 1021. Aibohphobia
* File: AIBOHP.cpp
* Author: Andy Y.F. Huang
* Created on August 8, 2012, 1:01 PM
*/
#include <cstdio>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <stack>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <fstream>
#include <set... | ALGO | 0.998839 | 4.026015 |
12859abe-d803-4ddd-9126-6f5a5005abf8 | mehtiNET/Server | src/libthecore/gost.cpp | #include "stdafx.h"
/*
static unsigned char const k8[16] = { 14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12, 5, 9, 0, 7 };
static unsigned char const k7[16] = { 15, 1, 8, 14, 6, 11, 3, 4, 9, 7, 2, 13, 12, 0, 5, 10 };
static unsigned char const k6[16] = { 10, 0, 9, 14, 6, 3, 15, 5, 1, 13, 12, 7, 11,... | ALGO | 0.981613 | 3.222157 |
a9bb1e30-06d3-45ea-b0da-1d7d03d985c2 | ritisha032/StriverSDESheet | 11thjune/Floor in BST.cpp | #include <bits/stdc++.h>
/************************************************************
Following is the TreeNode class structure
template <typename T>
class TreeNode {
public:
T val;
TreeNode<T> *left;
TreeNode<T> *right;
TreeNode(T val) {
this->val = v... | ALGO | 0.999995 | 5.111027 |
ef2dac24-be0d-4f09-8d86-dec04bb1693b | furkankurtoglu/whole-well | Ground_Truth_Transfer_Region/addons/dFBA/test/testClp.cpp | #include <iostream>
#include <string>
#include <coin-or/CoinPackedMatrix.hpp>
#include <coin-or/CoinPackedVector.hpp>
#include <coin-or/ClpSimplex.hpp>
using namespace std;
/*
minimise
4 x0 + 5 x1 + 6 x2
subject to
x0 + x1 >= 11
x0 - x1 <= 5
x2 - x0 - x1 = 0
7 x0 - 12 ... | ALGO | 0.999817 | 5.098569 |
d1df10f0-f11d-4663-97fc-79bd3fefa69a | sumit8692/Leetcode-solutions | 70-climbing-stairs/70-climbing-stairs.cpp | class Solution {
public:
int climbStairs(int n) {
vector<int> dp(n+1,-1);
dp[0] = 1;
dp[1] = 2;
for(int i = 2; i < n; i++) dp[i] = dp[i-1] + dp[i-2];
return dp[n-1];
}
}; | ALGO | 0.999987 | 6.310618 |
69ebbc1f-adee-4b79-95e0-157c598c461e | bharatr21/leetcode-problems | 0695-max-area-of-island/0695-max-area-of-island.cpp | class Solution {
public:
bool isValid(int x, int y, int m, int n) {
return (x >= 0 && x < m && y >= 0 && y < n);
}
int dfs(int x, int y, vector<vector<int>>& grid, vector<vector<bool>>& vis) {
int m = grid.size(), n = grid[0].size();
int sz = 1;
vis[x][y] = true;
vect... | ALGO | 0.999973 | 6.654477 |
8f964be4-fdfb-4690-8d09-330753cd7499 | FDU-VTS/LOL | src/fast_gicp/thirdparty/Eigen/unsupported/doc/examples/PolynomialSolver1.cpp | #include <unsupported/Eigen/Polynomials>
#include <vector>
#include <iostream>
using namespace Eigen;
using namespace std;
int main()
{
typedef Matrix<double,5,1> Vector5d;
Vector5d roots = Vector5d::Random();
cout << "Roots: " << roots.transpose() << endl;
Eigen::Matrix<double,6,1> polynomial;
roots_to_mo... | TEST | 0.998711 | 4.659281 |
c3667ea3-b50c-481c-aa86-b7e8b0829764 | ishandutta2007/codeforces | reyna/normal/155/A.cpp | #include <iostream>
using namespace std;
int main(){
int n;
cin >> n;
int a;
cin >> a;
int max=a,min=a;
int counter = 0;
for(int i = 1; i < n;i++){
int a;
cin >> a;
if(a > max){
max = a;
counter++;
}else if(a < min){
min = a... | ALGO | 0.99983 | 3.450795 |
bd79f9b6-4f80-445b-9e21-0c98ef028d4e | AkRockBoy/Leetcode-Solutions | 0075-sort-colors/0075-sort-colors.cpp | class Solution {
public:
void swap(int a , int b)
{
int t = a;
b = a;
a = t;
}
void sortColors(vector<int>& nums) {
int i = 0 , left = 0 , n = nums.size()-1;
int right = n;
while(i <= right)
{
if(nums[i] == 0)
{
... | ALGO | 0.999949 | 5.98305 |
7e2df15c-e762-4b15-9ce3-ef94babb25c8 | rk134/frameworks_av | media/libeffects/lvm/lib/Common/src/LVC_Core_MixHard_1St_2i_D16C31_SAT.cpp | /**********************************************************************************
INCLUDE FILES
***********************************************************************************/
#include "LVC_Mixer_Private.h"
#include "LVM_Macros.h"
#include "ScalarArithmetic.h"
void LVC_Core_MixHard_1St_MC_float_SAT(Mix_Priva... | ALGO | 0.902854 | 5.177013 |
f8cb8deb-83ac-4108-99dc-c06f3f7b7715 | parasailteam/coconet-experiments | pytorch/third_party/eigen/unsupported/doc/examples/MatrixSine.cpp | #include <unsupported/Eigen/MatrixFunctions>
#include <iostream>
using namespace Eigen;
int main()
{
MatrixXd A = MatrixXd::Random(3,3);
std::cout << "A = \n" << A << "\n\n";
MatrixXd sinA = A.sin();
std::cout << "sin(A) = \n" << sinA << "\n\n";
MatrixXd cosA = A.cos();
std::cout << "cos(A) = \n" << cos... | ALGO | 0.981337 | 5.878768 |
1769ebe1-3da7-4ef6-9855-2b0cfd4ea6ff | AkshatJain2021/basic-codes | Priority_Queue/k_closest_elements/using_pair&sorting.cpp | class Solution {
public:
vector<int> findClosestElements(vector<int>& arr, int k, int x) {
vector<pair<int,int>>v1;
for(int i=0;i<arr.size();i++)
{
pair<int,int>p;
p.first=abs(x-arr[i]);
p.second=arr[i];
v1.push_back(p);
}
sort(... | ALGO | 0.999998 | 5.628173 |
7946dd14-32c2-40a8-9b0b-c3d1fe83a040 | mattwata/ssl-H | _deps/nnabla-src/src/nbla/function/generic/top_k_grad.cpp | #include <nbla/array.hpp>
#include <nbla/common.hpp>
#include <nbla/function/top_k_grad.hpp>
#include <nbla/utils/top_k.hpp>
#include <nbla/variable.hpp>
namespace nbla {
NBLA_REGISTER_FUNCTION_SOURCE(TopKGrad, int, bool, int);
template <typename T>
void TopKGrad<T>::setup_impl(const Variables &inputs,
... | DATA | 0.987937 | 7.496568 |
8af1c4cf-fe64-4d37-896f-bf024125ae75 | lewis-revill/agc-llvm-project | mlir/lib/Reducer/ReductionNode.cpp | #include "mlir/Reducer/ReductionNode.h"
#include "mlir/IR/BlockAndValueMapping.h"
#include "llvm/ADT/STLExtras.h"
#include <algorithm>
#include <limits>
using namespace mlir;
ReductionNode::ReductionNode(
ReductionNode *parentNode, const std::vector<Range> &ranges,
llvm::SpecificBumpPtrAllocator<ReductionNod... | ALGO | 0.861471 | 3.184232 |
61a5e677-8ab3-43eb-b77c-4cdbbd204969 | ishandutta2007/codeforces | izban/normal/1335/E2.cpp | #include <iostream>
#include <fstream>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <ctime>
#include <algorithm>
#include <sstream>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <cstdlib>
#include <cstdio>... | ALGO | 0.999761 | 4.305665 |
c22e427d-8a57-4f72-b7eb-0a9617327892 | jsj2008/lithtech | runtime/world/src/world_tree.cpp |
#include "bdefs.h"
#include "world_tree.h"
#include "worldtreehelper.h"
// Used by some of the recursive routines.
typedef void (*FilterFn_R)(WorldTreeNode *pNode, void *pData);
class FilterObjInfo
{
public:
WorldTreeObj *m_pObj;
NodeObjArray m_iObjArray;
LTVector m_Min;
LTVector m_Max;
float m_MaxSiz... | ALGO | 0.958377 | 5.506995 |
f7ddb446-9b72-4aae-9302-1f721bccbbca | sarvex/leetcode-zsh | solution/0400-0499/0491.Non-decreasing Subsequences/Solution.cpp | class Solution {
public:
vector<vector<int>> findSubsequences(vector<int>& nums) {
vector<vector<int>> ans;
vector<int> t;
dfs(0, -1000, t, nums, ans);
return ans;
}
void dfs(int u, int last, vector<int>& t, vector<int>& nums, vector<vector<int>>& ans) {
if (u == num... | ALGO | 0.999995 | 6.262311 |
0e826002-25c3-4077-9840-61ddddde1d67 | JyotiKumari2/Crack-Your-Placement | 0 - 1 Knapsack Problem - GFG/0-1-knapsack-problem.cpp | //{ Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution
{
public:
//Function to return max value that can be put in knapsack of capacity W.
int knapSackDp(int W, int wt[], int val[], int n , int** dp)
{
if(n==0 || W==0)
ret... | ALGO | 0.999997 | 5.799847 |
9dac18ff-93f8-4fe5-8dde-33cebdd64932 | jack41402/Cplusplus | TNFSHOJ/16/main.cpp | #include <iostream>
#include <vector>
#define endl "\n"
using namespace std;
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
int T , S , Q , W , i , j , k ;
cin >> T ;
for (i=1 ; i<=T ; ++i)
{
vector<bool> quest(30000) ;
cin >> S ;
int stu[S] ;
for (j=0 ; j<S ... | ALGO | 0.9763 | 4.058362 |
2fbb9595-3e55-4d2f-8f27-971d93893c34 | LeePenn/Competitive-Programming | AOAPC-II/ch9/UVa1632.cpp | #include <iostream>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <map>
#include <unordered_map>
#include <sstream>
#include <vector>
#include <queue>
#define LL long long
#define ULL unsigned long long
using namespace std;
const int N = 10000 + 3, INF = 0x3f3f3f3f;
int n, dp[2][N][2];
int pos[N], ... | ALGO | 0.999985 | 3.714849 |
4b20c806-1c41-4388-ba91-46c0b16c4b0b | kapurm17/DS_and_Algos | Basic/Arrays/Arrays/help_ramu/main.cpp | #include <iostream>
using namespace std;
int main()
{
int c1, c2, c3, c4;
int r,c;
int rick[1000];
int cab[1000];
int Rcost , Ccost = 0;
cin>> c1>> c2>> c3>> c4;
cin>> r>>c;
for(int i=0; i<r; i++){
cin>>rick[i];
}
for(int i=0; i<c; i++){
cin>>cab[i];
}
... | ALGO | 0.999634 | 3.259479 |
176ed145-5073-4e89-b998-7b5dfc4255f9 | duixin111/CPlusPlus | practice/StackImplemenQueue.cpp | class Solution
{
public:
void push(int node) {
stack1.push(node);
}
int pop() {
if(stack2.empty())
{
while(!stack1.empty())
{
stack2.push(stack1.top());
stack1.pop();
}
}
int ret = stack2.top();
... | ALGO | 0.999931 | 5.570745 |
ddd847c0-4e82-48df-a45e-d11ec0c76b51 | Bhavya333-web/GeeksForGeeks_Streak | Difficulty Level - Medium/Find H-Index/Find_H-Index.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution {
public:
int hIndex(vector<int>& citations) {
// Time Complexity: O(n) | Space Complexity: O(n)
int n = citations.size();
vector<int> citarr(n+1,0);
for(int i:citations){
citarr[ min(i,n) ]++;
... | ALGO | 0.998532 | 5.704139 |
89abfb52-3555-49cb-a244-59ffdf030f4f | rifatbroh/Code_Binary | 2938. Separate Black and White Balls.cpp | class Solution {
public:
long long minimumSteps(string s) {
int n = s.size();
long long step = 0;
long long zero = 0;
// while(l < r){
// if (s[l] != s[r]){
// step++;
// swap(l, r);
// }
// }
for (int ... | ALGO | 0.99999 | 6.032124 |
453cd9b4-806f-4f76-8517-4d128304fac7 | Chakshu1409/leetcode | 198-house-robber/house-robber.cpp | class Solution {
public:
int rob(vector<int>& nums) {
int size=nums.size();
vector<vector<int>> dp(size, vector<int>(2,0));
int first=0;
int second=nums[0];
for(int i=1; i<size; i++){
int temp = max(nums[i] + first, second);
first = max(firs... | ALGO | 0.999792 | 5.711613 |
9bde4e68-29fe-49e2-8185-fbe6134434e4 | sophiiasun/Competitive-Programming | DMOJ/src/DMOPC/Y2016/C1/P5 - Blood Tubes.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int MN = 500005;
int N, bitf[MN], bitb[MN]; ll ans = 0LL;
void upd (int bit[], int idx, int val) {
for (; idx <= MN; idx += (idx & -idx)) bit[idx] += val;
}
ll sum (int bit[], int idx) {
ll ret = 0;
for (; idx; idx -= (idx & -... | ALGO | 0.999981 | 3.900727 |
0b9f8a1f-fa45-48e9-bbf9-a0ca11fa5036 | fj0rdingz/Competive_Programming | contests/abc164/164b.cpp | // lcm、__builtin_popcountとかはg++ -std=c++17 default.cppみたいなかんじで
#include <bits/stdc++.h>
#define ll long long
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
using namespace std;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
ll i,j,k,l,m,n,w,x,y,z,p,q,tmp,sum=0;
s... | ALGO | 0.999972 | 3.073236 |
fd464e16-2c7d-44f8-9395-6cd3633ca200 | sarvex/leetcode-emoji-code | solution/2500-2599/2584.Split the Array to Make Coprime Products/Solution.cpp | class Solution {
public:
int findValidSplit(vector<int>& nums) {
unordered_map<int, int> first;
int n = nums.size();
vector<int> last(n);
iota(last.begin(), last.end(), 0);
for (int i = 0; i < n; ++i) {
int x = nums[i];
for (int j = 2; j <= x / j; ++j)... | ALGO | 0.999975 | 5.71347 |
70ee0ae9-ae70-4684-ac27-956d5e17ec19 | Falcon-OS/frameworks_av | media/libeffects/lvm/lib/Common/src/DC_2I_D16_TRC_WRA_01.cpp | #include "BIQUAD.h"
#include "DC_2I_D16_TRC_WRA_01_Private.h"
#include "LVM_Macros.h"
#include "ScalarArithmetic.h"
/*
* FUNCTION: DC_Mc_D16_TRC_WRA_01
*
* DESCRIPTION:
* DC removal from all channels of a multichannel input
*
* PARAMETERS:
* pInstance Instance pointer
* pDataIn Input/Source... | ALGO | 0.971905 | 5.956313 |
7b51333e-15be-4c51-af11-d7a6d0669a4d | bekarraj/mytask | Arrays and Functions/Arrays/1_6.cpp | // write a program to sort an array in decending order.the array size and array elements are entered by the user.
#include<iostream>
using namespace std;
int main(){
int n,max,temp;
cout<<"Enter the size of an array"<<endl;
cin>>n;
int arr[n];
cout<<"Enter "<<n<<" elements of the array"<<endl;
for(int i=0;i<n;i+... | ALGO | 0.99964 | 4.05345 |
91386d3a-c617-4afb-84c7-838c72b7d317 | gcp-vais-team1/lammps | src/GRANULAR/gran_sub_mod_normal.cpp | #include "gran_sub_mod_normal.h"
#include "atom.h"
#include "error.h"
#include "citeme.h"
#include "fix_granular_mdr.h"
#include "granular_model.h"
#include "math_const.h"
#include "modify.h"
#include "update.h"
#include <cmath>
#include <iomanip>
#include <sstream>
using namespace LAMMPS_NS;
using namespace Granula... | ALGO | 0.999263 | 6.110139 |
7e4adc01-5fad-4774-9b6e-a1d0b5c72c15 | Spirit599/algorithm | leetcode/cpp/437_1.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.999961 | 5.701527 |
97251337-70ca-475c-9a17-f210925e3442 | chuyin221111/c.code | d.c/study12.cpp | #include <stdio.h>
int main() {
int a, b;
printf("\n");
scanf("%d%d", &a, &b);
printf("%d", a * b);
return 0;
} | ALGO | 0.979707 | 3.388326 |
1ccb4c2e-8e96-4d62-a9fa-b24cf728f00e | ArielGarciaM/CompetitiveProgramming | Codeforces/560/Dg.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
freopen("input.in", "w", stdout);
int t = 100, n = 4;
cout << t << '\n';
while(t) {
int prime = true;
for(int d = 2; d*d <= n; d++) {
if(n % d == 0)
prime = false;
}
if(prime) { n++; c... | ALGO | 0.99967 | 3.954146 |
d540376e-a028-419b-941e-2bd5d8d833a0 | sangvirgo/algorithm | codeforce/oldd/Thi thu ngay 18.8/B.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define MAX 1e9
const int MOD = 1e9 + 7;
/*
BÀI 5B - ƯỚC CHUNG LỚN NHẤT
Cho hai số nguyên dương N và M. Hãy tìm cách xây dựng dãy số A[] nguyên dương có đúng N phần tử thỏa mãn:
A[1] + A[2] + … + A[N] = M
và UCLN(A[1], A[2], …, A[N]) là lớn nhất có t... | ALGO | 0.999983 | 4.96634 |
05739b7f-abe6-4654-80e5-94053f017e2e | Shannju/njucser_helphelp | Algorithm算法/Code/5/.history/1.5_20220527215433.cpp | #include <iostream>
#include "stdio.h"
#include <vector>
#include <list>
#include <algorithm>
#include <map>
using namespace std;
// DSU data structure
// path compression + rank by union
#define SIZE 500
#define INT_MAX 2147483647
int n, m, k;
int ans1;
class DSU
{
int *parent;
int *rank;
public:
DSU(int n)
... | ALGO | 0.999983 | 3.665342 |
0ced8792-2708-4495-ba86-f3a2ab776442 | ziocoin/ZIOS | src/hash.cpp | #include "hash.h"
#include "crypto/hmac_sha512.h"
#include "crypto/scrypt.h"
inline uint32_t ROTL32(uint32_t x, int8_t r)
{
return (x << r) | (x >> (32 - r));
}
unsigned int MurmurHash3(unsigned int nHashSeed, const std::vector<unsigned char>& vDataToHash)
{
// The following is MurmurHash3 (x86_32), see http:... | ALGO | 0.986929 | 4.930666 |
5bfe220a-b607-4dd0-85e6-1555a7b3203c | AnoopArpan/DSA-PROBLEMS | SUPER POWER/code.cpp | class Solution {
public:
int modpow(int a, int b, int mod) {
a = a % mod;
int y = 1;
while (b > 0) {
if (b % 2 == 1) {
y = (y * a) % mod;
}
a = (a * a) % mod;
b = b / 2;
}
return y;
}
int superPow(int a, ... | ALGO | 0.999905 | 5.70305 |
52a61739-aa44-466f-b0db-9a5ce2f57ba3 | gustavomuller99/Algo | zOld/helga hufflepuffs cup/main.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll unsigned long long
ll MOD = 1e9+7;
vector<vector<int>> t;
int n, x; ll m, k, d[100000][3][11];
void dfs(int i, int p = -1) {
d[i][0][0] = m-k;
d[i][1][0] = k-1;
d[i][2][1] = 1;
for(int adj : t[i]) {
if(adj == p) continue;
dfs(adj, ... | ALGO | 0.999974 | 5.004804 |
8f5aaa46-861d-4c6a-8d32-ba879376119c | joshijai2/a-few-codes | Stack/Max-Area-Rectangle-in-binary-matrix.cpp | // { Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
#define MAX 1000
// } Driver Code Ends
/*You are required to complete this method*/
class Solution
{
public:
int getMaxArea(vector<int> arr, int n)
{
vector<int> nsl, nsr, area;
stack<int> ls, rs;
for (int i = 0; i ... | ALGO | 0.99991 | 6.104593 |
d89c0dde-c6f6-480b-a700-42108d8ec9ee | EvgeniiPliusnin/cpp_21day | PART_I/lesson3/listing_3_4.cpp | #include <iostream>
using namespace std;
int main(int argc, char const *argv[])
{
unsigned short uShortValue = 65535;
cout << "Incrementing unsigned short " << uShortValue << "gives ";
cout << ++uShortValue << endl;
short signed_short = 32767;
cout << "incrementing signed short " << signed_short <... | TOOL | 0.975202 | 3.928152 |
a2fa6aca-f2dd-42fc-b6de-608592d67e91 | Viktor3291/IDZ-second-sem | IDZ second sem/main.cpp | #include <SFML/Graphics.hpp>
#include <iostream>
#include <cmath>
#include <vector>
#include <windows.h>
#ifndef PI
#define PI 3.14159265358979323846
#endif
using namespace sf;
using namespace std;
const int WIDTH = 800, HEIGHT = 600;
const int maxDepth = 3;
class Obj {
private:
const int MyWidth, MyHeight;
pub... | TOOL | 0.893523 | 4.635407 |
da5c949e-ce2d-4c9f-951a-5af602c8de93 | Smiteshbhore21/-CrackYourPlacement | Day 5/Maximum points You can obtain from Cards.cpp | class Solution {
public:
int maxScore(vector<int>& cardPoints, int k) {
int lsum = 0, ch = 0, i = 0, j = cardPoints.size() - 1;
for (i; i < k; i++)
lsum += cardPoints[i];
i--;
ch = lsum;
for (j; i >= 0; j--, i--) {
ch = (ch - cardPoints[i]) + cardPoint... | ALGO | 0.999959 | 5.8836 |
b3db8d6b-acb7-4d3e-8f60-e8614b0989cc | KylieAndrea/KylieSola | hola/Kylie_Guzman/henry_guzman/practicas/orientado_objetos/flutter/prueba/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.996109 | 6.76073 |
df6d0934-b4f9-4a52-8f3c-4d867a757bd0 | nothingct/codingTestAlgorithm | 123더하기3.cpp | #include <iostream>
using namespace std;
const int MAX = 10000000;
const long long MOD= 1000000009LL;
long long d[MAX+1];
int main(){
d[0]=1,d[1]=1, d[2]=2;
for(int i=3; i<=MAX; i++){
d[i]= d[i-1]+d[i-2]+d[i-3];
d[i]%=MOD;
}
int t;
cin>>t;
while(t--){
int n ;
cin>>n;
cout<<d[n]<<'\n';
... | ALGO | 0.999956 | 4.026658 |
cac0b800-54d8-4799-8ed7-1a78359b66cb | MagicWinnie/SESC_IT | Grade_11/First_Semester/string/4.cpp | #include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main()
{
string s1, s2, out;
cin >> s1 >> s2;
for (int i = 0; i < s1.size(); i++)
{
if (s2.find(s1[i]) == string::npos)
out += s1[i];
}
sort(out.begin(), out.end());
if (out.size() > 0)
... | ALGO | 0.999772 | 4.48019 |
a100f7dd-f203-4d74-ba43-3cddbb9143b9 | anilpiparaiya/DSA-IN-C-plusplus | CSES-Solutions/Range Queries/Range Minimum Queries II (1649)/catkl.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
struct Tree {
typedef int T;
static conste... | ALGO | 0.999938 | 4.822303 |
d52d46e4-60b5-46c7-8e77-f346d3b89069 | aroyy007/Problem_Solving_Archive | LeetCode/Medium/2161. Partition Array According to Given Pivot/solution.cpp | class Solution {
public:
vector<int> pivotArray(vector<int>& nums, int pivot) {
vector<int> l, r, e;
for (int i = 0; i < nums.size(); i++) {
if (nums[i] > pivot) {
r.push_back(nums[i]);
} else if (nums[i] < pivot) {
l.push_back(nums[i]);
... | ALGO | 0.99998 | 6.305863 |
3e8502ac-7497-4660-ace9-6d7fce2239d4 | Italia2407/Mackerel-Engine | Mackerel-Core/ext/Eigen 3.4.0/unsupported/test/BVH.cpp | #include "main.h"
#include <Eigen/StdVector>
#include <Eigen/Geometry>
#include <unsupported/Eigen/BVH>
namespace Eigen {
template<typename Scalar, int Dim> AlignedBox<Scalar, Dim> bounding_box(const Matrix<Scalar, Dim, 1> &v) { return AlignedBox<Scalar, Dim>(v); }
}
template<int Dim>
struct Ball
{
EIGEN_MAKE_ALIGN... | TEST | 0.994559 | 6.630454 |
e8136997-cb20-4fc5-8931-26e001adf635 | nis44/DSA | 1121-partition-array-for-maximum-sum/partition-array-for-maximum-sum.cpp | class Solution {
public:
int maxSumAfterPartitioning(vector<int>& arr, int k) {
int n = arr.size();
vector<int> dp(n + 1, 0);
for(int i = n-1; i >= 0; i--) {
int sum = INT_MIN;
int large = INT_MIN;
int len = 0;
for(int j = i; j < min(n, i + ... | ALGO | 0.999848 | 5.74873 |
7ef09e16-1e1c-44dd-aa67-df7453522644 | rudransh-mishra-04/DSA-CODES- | DSA/SELECTION_SORT.cpp | #include <iostream>
using namespace std;
void selection_sort(int arr[],int n){
//TRAVERSING THE ENTIRE ARRAY
for(int i=0;i<n-1;i++){
int min=i;
for(int j=i+1;j<n;j++){
if(arr[j]<arr[min]){
min=j;
}
}
swap(arr[min],arr[i]);
}
}
void print(int arr[],int n){
for(int i=0;i<n;i++){
cout<<arr[i]<... | ALGO | 0.999882 | 4.582524 |
2895333f-7281-4af5-886a-2961043ac3e2 | gtoo8888/Cplusplustest | 1-Algorithm_test/leetcode/1-数据结构/2-链表/24-两两交换链表中的节点.cpp | #include <iostream>
#include <vector>
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){}
};
void printListNode(ListNode* head) {
while(head != nullptr) {
cout << ... | ALGO | 0.999943 | 5.177606 |
4cd77d1b-9055-4624-9364-8448e9e979bf | TwiceOS/frameworks_av | media/libstagefright/codecs/amrnb/common/src/residu.cpp | /*
Pathname: ./audio/gsm-amr/c/src/residu.c
------------------------------------------------------------------------------
REVISION HISTORY
Description: Updated template used to PV coding template. First attempt at
optimizing code.
Description: Deleted stores listed in the Local Stores Needed/Modified... | ALGO | 0.999934 | 3.810766 |
d9ddd11b-05fb-4802-ad4b-9a15fb1551ad | Soumithra-DNS/Problem_Solving | Codeforces/A. Remove Smallest.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin >> t;
while(t--){
int n;
cin >> n;
int arr[n];
for(int i=0;i<n;i++)
cin >> arr[i];
sort(arr,arr+n);
int z=0;
for(int i=0;i<n-1;i++){
if(arr[i+... | ALGO | 0.999875 | 4.011421 |
b4b70099-919c-4bbd-b7b8-5c2ed7740cd6 | Hyp3R0d/AlgorithmCompetition | 数学/组合数学/题目/LC2580.cpp | class Solution {
const int mod = 1e9 + 7;
public:
int countWays(vector<vector<int>> &ranges) {
std::sort(ranges.begin(), ranges.end(), [&](vector<int> a, vector<int>b)->bool{
return a[0] < b[0];
});
int ans = 2;
int n = ranges.size(); int r = ranges[0][1];
for (int i = 1; i < n; i++) {
if (ranges[i][0... | ALGO | 0.999914 | 5.24394 |
a248c78e-a1e9-4132-8166-837f37ded23e | lesyeuxdelamour/CStudyingPTIT | C06009.cpp | #include <stdio.h>
#include <string.h>
/*
7
29-T1 123.45
29-T1 555.55
29-T1 222.33
29-T1 686.88
29-T1 123.33
29-T1 555.54
29-T1 606.88
*/
int check(char s[])
{
if(s[0] == s[1] && s[1] == s[2] && s[3] == s[4])
return 1;
int flag1 = 1, flag2 = 1;
for(int i = 0; i < 5; ++i)
{
if(s[i] != '6' && s[i] != '8')
fl... | ALGO | 0.99652 | 3.434019 |
f24db491-4b32-4147-b676-7557d8e72542 | ShantoOBS/Number-Theory- | Prime Number/Prime generation using Harmonic series .cpp | //T.C: O(nln(n))
//S.C: O(1e8)
// Online C++ compiler to run C++ program online
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
const int mx = 1e8;
bool isPrime[mx];
vector<int> primes;
void primeGen ( int n )
{
for ( int i = 2; i <= n; i++ ) isPrime[i] = 1;
for ( int i = 2; i <= n; i++ ) {... | ALGO | 0.998108 | 4.743454 |
e591853d-0fac-4bc2-a7a4-e3cd5049961f | roytam1/mozilla-cvs-history-subtree | xpcom/glue/nsQuickSort.cpp | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* We need this because Solaris' version of qsort is broken and
* causes array bounds reads.
*/
#include <stdlib.h>
#include "prtypes.h"
#include "nsQuickSort.h"
PR_BEGIN_EXTERN_C
#if !defined(DEBUG) && (defined(__cplusplus) || define... | ALGO | 0.999982 | 5.847691 |
ec8ef1d8-644c-4027-8228-c2bf3b9f88b2 | sabih-haider1/programs | lab3/p2lab3.cpp | #include<iostream>
using namespace std;
int main()
{
int i,x,y;
cout << "Enter First number="<<endl;
cin >> x;
cout << "Enter second number="<<endl;
cin >> y;
for (i = x; i <= y; i++)
{
if (i % 3 == 0)
{
cout << i << endl;
}
}
system("pause");
return 0;
} | ALGO | 0.998795 | 3.182895 |
f0da5a7b-8ec2-4a1c-94d6-c0033d2fd658 | mativan15/TareasCC_II | .history/Ej7/reversy_20240425214110.cpp | #include <iostream>
#include <cstdlib>
#include <algorithm>
#include "reversy.h"
using namespace std;
void Reversy::print_tablero() {
char (*ptr1)[8] = tablero;
for (int i = 0; i < 9; i++,ptr1++) {
char *ptr2 = *ptr1;
for (int j = 0; j < 9; j++, ptr2++) { // Agregar una columna adicional p... | ALGO | 0.982291 | 3.123724 |
a8adc419-9176-4f54-a8a2-e4c5bd9435d8 | alexandraback/datacollection | solutions_2463486_1/C++/indranathc/round1c.cpp | #include <iostream>
#include <string>
#include <map>
using namespace std;
string fs[]={
"1",
"4",
"9",
"121",
"484",
"10201",
"12321",
"14641",
"40804",
"44944",
"1002001",
"1234321",
"4008004",
"100020001",
"102030201",
"104060401",
"121242121",
"123454321",
"125686521",
"400080004",
"404090404",
"10000200001",
"102... | ALGO | 0.984272 | 3.914553 |
4c7b8a94-fd5e-47db-b451-fa88fdf97c1f | Jaswantchaudharygla/assignment | Pattern program-5.cpp | #include <stdio.h>
int main()
{
int rows, cols, i, j;
printf("Enter number of rows: ");
scanf("%d", &rows);
printf("Enter number of columns: ");
scanf("%d", &cols);
for(i=1; i<=rows; i++)
{
for(j=1; j<=cols; j++)
{
if(i%2 == 1)
{
printf("... | ALGO | 0.998815 | 3.216605 |
3fc86a49-7c8f-4f67-9b60-4a9c98795982 | denis-gubar/Leetcode | Backtracking/1255. Maximum Score Words Formed by Letters.cpp | class Solution {
public:
int maxScoreWords(vector<string>& words, vector<char>& letters, vector<int>& score) {
int N = words.size();
vector<int> wordScore(N);
vector<vector<int>> wordCount(N, vector<int>(26));
vector<int> letterCount(26);
for (int c : letters)
++letterCount[c - 'a'];
for (int i = 0; i <... | ALGO | 0.999865 | 6.06135 |
997f23ea-4e8c-4427-b909-7da60e8f8317 | RevanasiddaNK/DSA-Revision-Hub | 0704-binary-search/0704-binary-search.cpp | class Solution {
public:
int search(vector<int>& nums, int target) {
int s=0, e=nums.size()-1;
while(s <= e){
int m = s+(e-s)/2;
if(nums[m] == target)
return m;
else if(nums[m] < target)
s = m+1;
else
e ... | ALGO | 0.999922 | 6.218111 |
c8be14ee-17ed-4f62-9a0e-87bf0cd2dab4 | USE-jx/leetcode-with-cpp-and-python | cpp_source_code/117.填充每个节点的下一个右侧节点指针-ii.cpp | /*
* @lc app=leetcode.cn id=117 lang=cpp
*
* [117] 填充每个节点的下一个右侧节点指针 II
*/
// @lc code=start
/*
// Definition for a Node.
class Node {
public:
int val;
Node* left;
Node* right;
Node* next;
Node() : val(0), left(NULL), right(NULL), next(NULL) {}
Node(int _val) : val(_val), left(NULL), right... | ALGO | 0.999486 | 6.126799 |
31b98cb7-5db3-4537-a6d9-33ad0e3ef136 | sangkim98/cse3081_SpanningTreeDFS | SpanningTreeDFS/s181605H02.cpp |
#include "Graph_adj_array.h"
void Read_Graph_adj_array (int Vnum, vertex V[], int Enum, edge E[]) {
// read graph information
// V와 E의 name field는 각각 자신의 인덱스를 저장한다
// V[].flag과 E[].flag은 반드시 false로 설정해야 한다.
int k, vf, vr, ec;
// Initialize each vertex
for (k = 0; k < Vnum; ++k) {
V[k].f_hd = V[k].r_hd = NON... | ALGO | 0.999405 | 4.388204 |
aa834597-7523-4036-a645-b469c8e902f9 | adityarathore063/Cpp-tutorial | c++/tut15.cpp | #include<iostream>
using namespace std;
// ******** Functions in c++ *********
// int sum(int a, int b){
// int c = a + b;
// return c;
// }
// Function Prototypes
// syntax:
// type function-name (arguments);
// int sum(int a,int b); ------- Accepetable
// int sum(int a, b); ------- Not Acceptable
int sum(in... | TOOL | 0.97909 | 4.042243 |
10898820-bd1f-4dbd-b048-3343779a4e70 | vfolunin/archives-solutions | LeetCode/968.cpp | class Solution {
vector<int> rec(TreeNode *n) {
if (!n)
return { 0, 0, (int)1e9 };
vector<int> l = rec(n->left);
vector<int> r = rec(n->right);
return {
l[1] + r[1],
min({ l[1] + r[2], l[2] + r[1], l[2] + r[2] }),
... | ALGO | 0.999888 | 7.180898 |
07cf1309-cb71-4af8-bd10-dcca2c5de4c9 | imandra-ai/z3 | src/qe/qsat.cpp | #include "ast/expr_abstract.h"
#include "ast/ast_util.h"
#include "ast/occurs.h"
#include "ast/rewriter/quant_hoist.h"
#include "ast/ast_pp.h"
#include "ast/rewriter/th_rewriter.h"
#include "ast/rewriter/expr_replacer.h"
#include "model/model_v2_pp.h"
#include "model/model_evaluator.h"
#include "model/model_evaluator_p... | ALGO | 0.998654 | 5.738039 |
933faa4b-82ca-41bd-a78b-202a5acc2d36 | Modding-Zaibatsu/Pre-Unreal-4.14 | Engine/Source/ThirdParty/PhysX/PhysX_3.4/Source/PhysXCharacterKinematic/src/CctSweptVolume.cpp | #include "CctSweptVolume.h"
using namespace physx;
using namespace Cct;
SweptVolume::SweptVolume()
{
mType = SweptVolumeType::eLAST;
}
SweptVolume::~SweptVolume()
{
}
void Cct::computeTemporalBox(PxExtendedBounds3& _box, float radius, float height, float contactOffset, float maxJumpHeight, const PxVec3& upDirectio... | TOOL | 0.868437 | 6.415471 |
dc37fe01-36da-4f58-9fe4-1464c4dc862f | liuawen/Play-Leetcode | Play-Leetcode-master/1438-Longest-Continuous-Subarray-With-Absolute-Diff-Less-Than-or-Equal-to-Limit/cpp-1438/main.cpp | /// Source : https://leetcode.com/problems/longest-continuous-subarray-with-absolute-diff-less-than-or-equal-to-limit/
/// Author : liuyubobobo
/// Time : 2020-05-02
#include <iostream>
#include <vector>
#include <map>
using namespace std;
/// Sliding Window + Map
/// Time Complexity: O(nlogn)
/// Space Complexity... | ALGO | 0.999987 | 5.884458 |
ea5569cb-a27d-495c-be92-fed26864368a | MarcOnTheMoon/imaging_learners | src/c++/lecture/05_Edges/Hough-Transform/HoughLine.cpp | /* Compiler settings */
#define _USE_MATH_DEFINES
/* Include files */
#include "HoughLine.h"
#include <cmath>
#include <opencv2/opencv.hpp>
/* Namespaces */
using namespace cv;
namespace ip {
/*! Calculate Hough transform for lines.
*
* \param edgeImage Source edge image (with edge pixels marked by value 255)
*... | ALGO | 0.995632 | 5.635398 |
ba922623-8966-4510-9904-f16771f25914 | ishandutta2007/codeforces | hir180/normal/1344/E.cpp | //Let's join Kaede Takagaki Fan Club !!
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
//#define int long long
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P... | ALGO | 0.999963 | 4.344389 |
06205903-a4fe-435e-ab93-198e8c066378 | InwooLeeme/Algorithm | Boj/9694.cpp | #pragma GCC target("avx,avx2,fma")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <ext/rope>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define fastio ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
using namespace std;
using name... | ALGO | 0.999983 | 5.335504 |
ffa76121-3b0b-4bc9-91d5-762245e48985 | jakub-kaminski/coding-challenges | Graph/SG0011-DetectCycleinUndirectedGraphBFS.cpp | // question name: SL0011 Detect Cycle in Undirected Graph BFS
// DESCRIPTION:
//
// APPROACH:
// FUNCTION NAME: detectCycle
#include <catch2/catch_all.hpp>
#include <bits/stdc++.h>
using namespace std;
typedef vector<vector<int>> v2t;
typedef vector<int> v1t;
class Solution{
public:
bool detectCycle(v2t adjac... | ALGO | 0.99957 | 5.993169 |
ceb0c5db-9133-43f0-9a75-e61e5316b4df | satyamtiwari736182/CP | pepcoding/Level 2/Recursion_&_Backtracking/2_Combinations - 1.cpp | // 1. You are give a number of boxes (nboxes) and number of identical items (ritems).
// 2. You are required to place the items in those boxes and print all such configurations possible.
// Items are identical and all of them are named 'i'.
// Note 1 -> Number of boxes is greater than number of items, hence some of th... | ALGO | 0.999939 | 4.048408 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.