uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
bf45b3b1-b766-4f13-a6cd-3a62d0f6f355 | ryan-m-parker/csce121 | practiceExam1/seqSeg/main.cpp | #include <iostream>
using namespace std;
int main() {
int segments = 1;
int num = 0;
int length = 0;
cout << "Enter the sequence length: ";
cin >> length;
cin >> num;
for (int i = 1; i < length; ++i)
{
int testNum = 0;
cin >> testNum;
if (testNum != num)
{
segments++;
num = testNum;
}
}
cou... | ALGO | 0.999108 | 3.107039 |
b7c7eda4-558c-47be-8ff6-eb782ab968ab | DBarinovv/Stack | 08_10_19.cpp | #include <stdio.h>
#include <iostream>
#include <stdlib.h>
#include <assert.h>
#include "TXLib.h"
//=============================================================================
typedef int elem_t;
struct stack_t
{
int saver_left;
const char *name;
long int hash;
int size;
int capacity;
e... | ALGO | 0.914951 | 5.016881 |
4558b5e7-9d39-4fc1-bfc8-53e563e10ae5 | rh29152/IBA-CS-Cources | Smester 1/Intro to Programming (ITP)/Labs Taks & Solution/Lab-7/Task6.cpp | #include <iostream>
int main() {
int n = 100;
long long fib[n];
fib[0] = 1;
fib[1] = 1;
for (int i = 2; i < n; i++) {
fib[i] = fib[i - 1] + fib[i - 2];
}
for (int i = 0; i < n; i++) {
std::cout << fib[i] << " ";
}
std::cout << std::endl;
return 0;
}
| ALGO | 0.999909 | 4.105757 |
2476b7e7-b1be-43b1-8190-cf51708ae67a | Orang123/ACMAlgorithmExercises | DP经典模型/数位dp/HDU 3709 Balanced Number.cpp | /*
:ժ
[x,y]ƽĸνƽһλƽ㣬
ֵȡ
x,y<=10^18.
:https://acm.hdu.edu.cn/showproblem.php?pid=3709
˼·:λdp.
dp[k][pos][sum]ʾ֧posλλlenk-1λΪsum(λ±)
ٴkλĩβⲿܹɵвԭʼnλʹ͵0Ŀ
*/
//ac 31ms 仯+֦
//dp[k][pos][sum]ʾ֧posλλlenk-1λΪsum(λ±)
//ٴkλĩβⲿܹɵвԭʼnλʹ͵0Ŀ
//ռ临ӶO(20*3078)=61560
//ʱ临ӶO(10*20*3078)=615600
//ÿsolveʼdp 265ms
#include<cstdio>
#include<cst... | ALGO | 0.998753 | 4.124054 |
1cd4ab4a-16b0-4262-ad4b-4cb8fa1a452f | iagorrr/Competitive-Programming-Solutions | submissions/Neps/direcao.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long int lli;
int dy[] = {1, 0, -1, 0};
int dx[] = {0, -1, 0, 1};
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
string sA, sB;
cin >> sA >> sB;
lli angA, angB;
lli ans;
char A = sA[0]; char B = sB[0]... | ALGO | 0.999947 | 4.150614 |
9299f4e1-8306-4357-a05c-72510a9d5146 | SJMA11723/Problem-solving | codeforces/Codeforces Round 971 (Div. 4)/A.cpp | /**
* Author: Jorge Raul Tzab Lopez
* Github: https://github.com/SJMA11723
*/
#include <bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int t; cin >> t;
while(t--){
int a, b; cin >> a >> b;
cout << b - a << '\n';
}
}
| ALGO | 0.999675 | 4.170436 |
e7b8c48c-53c6-4b46-b2ae-9ecfd9ec2006 | gitHubwhl562916378/opencv4.3 | opencv_contrib-4.3.0/modules/superres/src/optical_flow.cpp | #include "precomp.hpp"
#include "opencv2/optflow.hpp"
#include "opencv2/core/opencl/ocl_defs.hpp"
using namespace cv;
using namespace cv::cuda;
using namespace cv::superres;
using namespace cv::superres::detail;
///////////////////////////////////////////////////////////////////
// CpuOpticalFlow
namespace
{
cla... | ALGO | 0.980897 | 7.527307 |
6759595c-af55-4553-b95b-1259abe6fb4a | Mulab11/cntt2016-hw1 | TC-SRM-578-div1-1000/isdkfj.cpp | #include <bits/stdc++.h>
using namespace std;
const int inf=0x3f3f3f3f;
int f[55][55][55][55],n,col[55];
vector<int>g[55];
int s,t,q[5555],dt[55],fst[55],nxt[5555],to[5555],w[5555],c[5555],p[55],in[55],tt;
void ad(int x,int y,int z,int o){
nxt[++tt]=fst[x];fst[x]=tt;to[tt]=y;w[tt]=z;c[tt]=o;
nxt[++tt]=fst[y];fst[y]... | ALGO | 0.999814 | 4.427242 |
b350d724-615c-44fb-84b8-a9d4c0cf0464 | Adityarns/Tugas-Algoritma-dan-Pemrograman | Tugas BAB 12/Latihan Algoritma/125.cpp | #include <iostream>
using namespace std;
int main(){
int i, N, max = 100;
cout << "Masukkan nilai N: ";
cin >> N;
int A[max];
for (int i = 1; i <= N; i++){
cout << "Input: ";
cin >> A[i];
}
return 0;
} | ALGO | 0.899419 | 3.424711 |
aba33cce-37aa-4a51-85b5-61ab3876691a | KiranManaware/Recursion-I | Que3.cpp | // Given a positive integer, return true if it is a power of 2 using recursion (leetcode 231)
#include<iostream>
using namespace std;
bool isPowerOfTwo(int n) {
if(n==1) return true;
if(n%2!=0 || n==0) return false;
return isPowerOfTwo(n/2);
}
int main()
{
int n;
cout<<"Enter n : ";
cin>>n;
... | ALGO | 0.999324 | 5.894968 |
71eabb66-1025-4eb1-bc2b-e7eb0ae490c3 | Dockerel/Baekjoon | ETC/14621/a.cpp | #include <bits/stdc++.h>
#define fastIO ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
using namespace std;
int n, m, u, v, d, node, ret;
char univ_type;
int univ_types[1004];
int parent[1004];
vector<pair<int, pair<int, int>>> edges;
bool cmp(pair<int, pair<int, int>> a, pair<int, pair<int, int>> b) {
return a... | ALGO | 0.99978 | 4.147082 |
44b5569d-dd43-4e46-bd42-f317b30e5cb2 | MarkKim1/Leetcode | 1155-number-of-dice-rolls-with-target-sum/1155-number-of-dice-rolls-with-target-sum.cpp | class Solution {
public:
const int MOD = 1e9 + 7;
vector<vector<int>> memo;
int numRollsToTarget(int n, int k, int target) {
memo.resize(n+1,vector<int>(target+1,-1));
return recursive(0,0,n,k,target);
}
int recursive(int curr_index, int curr_sum,int n, int k, int target){
if... | ALGO | 0.999993 | 6.091277 |
c61be2cd-8191-4c0e-99bf-2ccca8d192ab | ishandutta2007/codeforces | physics0523/normal/545/E.cpp | #include<bits/stdc++.h>
using namespace std;
using pl=pair<long long,long long>;
using plp=pair<long long,pl>;
using Graph=vector<vector<plp>>;
long long llzt(long long a,long long b){return max(a,b)-min(a,b);}
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
long long n,m;
cin >> n >> m;
Graph g... | ALGO | 0.999984 | 3.502109 |
c67ce1e9-6a70-42dc-83a7-fc02fddc0d88 | mpsurya001/reduction_load_rockfort | 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 |
8cec32ad-c259-464b-9460-ce60ec1926c8 | Yash5588/leetcode | 3587-maximum-points-tourist-can-earn/maximum-points-tourist-can-earn.cpp | class Solution {
public:
long long dp[200][200];
long long solve(int n, int k, vector<vector<int>> &stayScore, vector<vector<int>> &travelScore, int day, int city) {
if(day >= k) return 0;
if(dp[day][city] != -1) return dp[day][city];
long long stay = stayScore[day][city] + solve(n,k,sta... | ALGO | 0.99987 | 5.05723 |
1cd26637-8835-4ed0-9474-c5de4931831b | chuck8868/QuantLibQt | ql/models/marketmodels/driftcomputation/cmsmmdriftcalculator.cpp | /* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
#include <ql/models/marketmodels/driftcomputation/cmsmmdriftcalculator.hpp>
#include <ql/models/marketmodels/curvestates/cmswapcurvestate.hpp>
namespace QuantLib {
CMSMMDriftCalculator::CMSMMDriftCalculator(
... | ALGO | 0.999347 | 7.611876 |
0a52604a-02c2-49d2-a952-5abe7e4308c8 | ahmad-mirsalari/PyTorch_E5M2 | aten/src/ATen/native/cuda/ScanKernels.cpp | #define TORCH_ASSERT_ONLY_METHOD_OPERATORS
#include <ATen/core/Tensor.h>
#include <ATen/TensorUtils.h>
#include <ATen/native/cuda/ScanKernels.h>
#include <ATen/native/ReduceOps.h>
#ifndef AT_PER_OPERATOR_HEADERS
#include <ATen/Functions.h>
#include <ATen/NativeFunctions.h>
#else
#include <ATen/ops/_cummax_helper_nati... | TOOL | 0.945235 | 7.30092 |
aada6f8b-fe78-463d-99e0-1b33d6435ee4 | nitish312/DSA-sheet1 | Arrays/5-Frequency_of_Array_Elements.cpp | #include<bits/stdc++.h>
using namespace std;
void printArray(int arr[], int n){
for(int i=0; i<n; i++) cout<<arr[i]<<" ";
cout<<endl;
}
// 1. keeping visited arr ? O(N) + O(N*N) -> O(N^2) : O(N)
void countFrequency(int arr[], int n){
// bool visited[n];
// for(int i=0; i<n; i++){
// visite... | ALGO | 0.999823 | 5.089278 |
d1af9041-895b-460e-9d16-e9c7a1cfa1d1 | KojiShiono/SelfDrivingCar | Path_Planning_Project/src/Eigen-3.3/doc/examples/Tutorial_ArrayClass_mult.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace Eigen;
using namespace std;
int main()
{
ArrayXXf a(2,2);
ArrayXXf b(2,2);
a << 1,2,
3,4;
b << 5,6,
7,8;
cout << "a * b = " << endl << a * b << endl;
}
| ALGO | 0.992688 | 3.527115 |
025a7e75-ac99-4474-83f5-91b7159a4987 | mohammad-majoony/codeForces-submits | D. Buying Shovels/main.cpp | #include<bits/stdc++.h>
#define MMD ios_base::sync_with_stdio(0) ; cin.tie(0) ;
typedef long long ll ;
using namespace std ;
ll solve(){
ll num , range , get ;
cin >> num >> range ;
if(num > range){
ll mini = num , store ;
get = (range > sqrt(num)) ? sqrt(num) : range ;
for(ll i... | ALGO | 0.999863 | 4.839949 |
bebcf23e-b98a-41f8-bd34-07851bb4f704 | jbaisani/algorithms | OJ/poj/1003.cpp | #include <iostream>
using namespace std;
int main(int argc, char const *argv[]) {
float c;
int i;
int num;
float sum;
cin >> c;
while(c!=0.0){
sum = 0.0;
for(i=2,num=0;sum<=c;++i,++num){
sum += 1.0/i;
}
cout << num << ' ' << "card(s)" << endl;
cin >> c;
}
return 0;
}
| ALGO | 0.999764 | 3.145514 |
567ba827-be14-432a-b5bd-4ef4f972752f | kevinrjt/leetcode | squares-of-a-sorted-array/squares-of-a-sorted-array.cpp | #include <algorithm>
#include <vector>
#include "../utilities.h"
using namespace std;
vector<int> sortedSquares(vector<int> &nums)
{
int len = nums.size();
vector<int> squares(len);
int i = 0;
int j = len - 1;
for (int k = len - 1; k >= 0; --k)
{
if (-nums[i] > nums[j])
{
... | ALGO | 0.99995 | 5.80145 |
814a62fd-8101-4ed4-a388-d1f48fcc7a24 | Nandanammunje/Data_structures-and-algorithms | increasingdecreasing.cpp | #include<iostream>
using namespace std;
int search(int a[],int m,int first,int last)
{
int mid=0;
first=0;
last=m-1;
while (first <=last)
{
if(first==last)
return a[first];
else if(first==last-1)
return max(a[first],a[last]);
else
{
mid=first+(last-first)/2;
if(a[m... | ALGO | 0.999977 | 4.376205 |
1483d41e-2e66-4b6d-af04-8f5d7e963bcb | MELANCHOLY123456/LeetCode_Cplusplus | slidingWindow_doublePointers/definite-length_slidingWindow/04-getAverages.cpp | //
// Created by Administrator on 24-10-22.
//
#include <vector>
class Solution {
public:
static std::vector<int> getAverages(const std::vector<int>& nums, const int k) {
const size_t length = nums.size();
long long sum = 0;
std::vector<int> ans(length, -1);
for (int i = 0; i < 2 *... | ALGO | 0.999849 | 6.314399 |
a64ebabd-cfda-4b60-a23b-bdbe1e606e5b | doviethung11192023/code_c_pluss_pluss_2 | buoi 14 bai 4 tinh tong 4.cpp | #include<iostream>
#include<cmath>
using namespace std;
long long sum(long long n){
if(n==1)return -1;
return pow(-1,n)*n+sum(n-1);
}
int main(){
long long n;
cin>>n;
cout<<sum(n);
return 0;
}
| ALGO | 0.999926 | 3.996532 |
0debb18b-75d9-4201-8cff-39b323725944 | hiberabyss/LeetCode | cpp/71.simplify-path.cpp | /*
* @lc app=leetcode.cn id=71 lang=cpp
*
* [71] 简化路径
*
* https://leetcode-cn.com/problems/simplify-path/description/
*
* algorithms
* Medium (41.18%)
* Total Accepted: 135.1K
* Total Submissions: 305.5K
* Testcase Example: '"/home/"'
*
* 给你一个字符串 path ,表示指向某一文件或目录的 Unix 风格 绝对路径 (以 '/' 开头),请你将其转化为更加简洁的规... | ALGO | 0.999454 | 5.431678 |
2fdc7736-03f5-481a-b6a8-68fecae79ffe | IITH-Compilers/bullseye | boost_1_76_0/libs/regex/example/grep/grep.cpp | #include <boost/regex.hpp>
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#ifdef BOOST_MSVC
#pragma warning(disable:4512 4244)
#endif
#include <boost/program_options.hpp>
namespace po = boost::program_options;
int after_context;
int before_context;
bool print_byte_offset;
bool count_only... | TOOL | 0.922771 | 6.486158 |
edf58dad-4e97-41b8-a028-65ed4e031582 | Nelzg/HomeWork_4_sem | LambdaFunc/Source.cpp | #include <string>
#include "PrepareWord.h"
#include <vector>
#define N 8
using namespace std;
int main() {
std::vector<string> strings = {"asd","asd","tasf","Asd","uojkk","tasf","poipoj","uo jkk", "tat u k r"};
std::vector<string>::iterator it;
transform(strings.begin(), strings.end(), strings.begin(), PrepareWo... | ALGO | 0.999214 | 4.973959 |
51321b20-9723-49b7-9e0a-1a41e2e105c3 | temporaer/seralign | src/third_party/sdpa-7.1.1/sdpa_dataset.cpp | #include "sdpa_dataset.h"
#include "sdpa_parts.h"
#include "sdpa_jordan.h"
#include "sdpa_linear.h"
#include "sdpa_newton.h"
namespace sdpa {
Solutions::Solutions()
{
// Nothings needs.
}
Solutions::~Solutions()
{
terminate();
}
Solutions::Solutions(int m,
int SDP_nBlock, int* SDP_blockStruct,
int... | ALGO | 0.999432 | 3.7127 |
6833c213-f852-44d8-88e8-6018d04e27ac | duongtrieuelec/LeetSolve | cpp-leetcode/leetcode77-combinations_iterative.cpp | #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
class Solution {
public:
vector<vector<int>> combine(int n, int k) {
vector<vector<int>> res;
vector<int> curGroup;
// 迭代法: 先加入一个最小的满足条件的组合, 然后用对各位微调生成更多
for (int i = 1; i <= k; i++)
curGroup... | ALGO | 0.999986 | 5.353079 |
64964bb1-7d8c-44b7-b288-23159bb6d179 | josuehfa/DAASystem | CoreSystem/lib/daidalus/src/TCAS2D.cpp | #include "Vect2.h"
#include "TCAS2D.h"
#include "Util.h"
#include "Horizontal.h"
namespace larcfm {
// Compute modified tau
double TCAS2D::tau_mod(double DMOD, const Vect2& s, const Vect2& v) {
double sdotv = s.dot(v);
if (Util::almost_equals(sdotv,0)) // [CAM] Changed from == to almost_equals to mitigate numeri... | ALGO | 0.994988 | 6.493068 |
829410aa-f9f7-44f2-b37b-ef9b7c99bfd2 | Taimoo-r/LeetCode | 1803-average-waiting-time/average-waiting-time.cpp | class Solution {
public:
double averageWaitingTime(vector<vector<int>>& cus) {
int n = cus.size();
double avgTime = 0;
int prev = 0 ;
for(int i = 0 ; i < n ; i++){
int arriveTime = cus[i][0];
int cookTime = cus[i][1];
if(arriveTime < prev){
... | ALGO | 0.999891 | 5.628622 |
2c33ff90-081c-4f28-ad4f-e22c40f03be8 | CVC4/CVC4-archived | examples/api/sets.cpp | /********************* */
#include <iostream>
#include <cvc4/cvc4.h>
#include <cvc4/options/set_language.h>
using namespace std;
using namespace CVC4;
int main() {
ExprManager em;
SmtEngine smt(&em);
// Optionally, set the logic. We need at least UF for ... | TEST | 0.987543 | 6.66317 |
66781c2c-abef-46c9-98c3-11fc6d95bdf2 | ishandutta2007/codeforces | ashishgup/normal/267/A.cpp | #include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define Max(x,y,z) max(x,max(y,z))
#define Min(x,y,z) min(x,min(y,z))
#define fr(i,s,e) for(i=s;i<e;i++)
#define rf(i,s,e) for(i=s-1;i>=e;i--)
#define pb push_back
#define mp make_pair
typed... | ALGO | 0.999931 | 3.4196 |
8035c222-7989-43fd-a337-a055a6379d0d | zfa07/Killyouss | Engine/Plugins/Experimental/ProxyLODPlugin/Source/ThirdParty/UVAtlasCode/UVAtlas/isochart/isochartmesh.cpp | /*
Terms:
L2 Stretch:
Corresponds to the root-mean-square stretch over all directions
in the domain.
Ln Stretch:
The worst-case norm Ln is the greatest stretch.
Note that both L2 and Ln increase to infinity as the parametrization of
face become... | ALGO | 0.986824 | 4.685134 |
62ba348f-df0e-4e96-9fe3-282945212385 | raihanuldev/Data-Structure | module-6 LinkedList Operation/Head_Insertion.cpp | #include <bits/stdc++.h>
using namespace std;
class Node
{
public:
int val;
Node* next;
Node(int val)
{
this->val = val;
this->next = NULL;
}
};
void insert_at_head(Node* &head,int val){
Node* newNode = new Node(val);
newNode->next = head;
... | ALGO | 0.998964 | 4.273339 |
e08e12b0-02df-4892-9c31-e25c1b3f7f3d | vishwesh5/Competitive-Programming | Complete-Cpp-CodingBlocks/Challenges-Fundamentals/revising-quadratic-equations.cpp | #include<iostream>
#include <cmath>
using namespace std;
int main() {
int a,b,c;
cin >> a >> b >> c;
int d = b*b - 4*a*c;
if (d==0){
int root1,root2;
cout << "Real and Equal" << endl;
root1 = (-b - sqrt(d))/(2*a);
cout << root1 << " " << root1 << endl;
}
else if (d > 0){
cout << "Real an... | ALGO | 0.999903 | 3.995301 |
a31ac8f1-274a-475f-9844-8d0a5fec2c94 | sarvex/leetcode-scheme | solution/1200-1299/1207.Unique Number of Occurrences/Solution.cpp | class Solution {
public:
bool uniqueOccurrences(vector<int>& arr) {
unordered_map<int, int> cnt;
for (int& x : arr) {
++cnt[x];
}
unordered_set<int> vis;
for (auto& [_, v] : cnt) {
if (vis.count(v)) {
return false;
}
... | ALGO | 0.999895 | 6.325812 |
f0fa9a8f-0c11-4a0c-bce8-76277ae036a8 | SEA-ME-COSS/Autonomous-Driving-System | src/realworld_control/include/realworld_control/dbcppp/third-party/boost/libs/spirit/classic/example/fundamental/stuff_vector2.cpp | ///////////////////////////////////////////////////////////////////////////////
//
// This sample demontrates a parser for a comma separated list of identifiers
// This is a variation of stuff_vector.cpp.
// This is discussed in the "Phoenix" chapter in the Spirit User's Guide.
//
// [ JDG 1/12/2004 ]
//
//////////... | TOOL | 0.913264 | 6.951008 |
88313a65-c6b2-42ac-9469-71a79737ba70 | loki-engr/CtrlHair | wrap_codes/wrap_triangle/useful_code/libigl/include/igl/repmat.cpp | template <typename DerivedA, typename DerivedB>
IGL_INLINE void igl::repmat(
const Eigen::MatrixBase<DerivedA> & A,
const int r,
const int c,
Eigen::PlainObjectBase<DerivedB> & B)
{
assert(r>0);
assert(c>0);
// Make room for output
B.resize(r*A.rows(),c*A.cols());
// copy tiled blocks
for(int i = 0... | ALGO | 0.988782 | 4.148574 |
62bd3501-f4a5-444a-a5c8-95f96149e0b7 | aditi944/Data-Structure-And-Algorithms | array/word pattern.cpp | //https://leetcode.com/problems/word-pattern/
class Solution {
public:
bool wordPattern(string pattern, string s) {
unordered_map<char,string>mp;
set<string>se;
vector<string>v;
stringstream ss(s);//Used for breaking words ie if given let "i am a coder" than it convert it into
... | ALGO | 0.99911 | 6.47699 |
43d4783a-b887-4cb1-bfc2-4326f39cf942 | neil3d/My3DEngine2008 | NexusManaged/NexusEngineCLI/math/Vector4.cpp | #include "stdafx.h"
#include "Matrix.h"
#include "Quaternion.h"
#include "Vector2.h"
#include "Vector3.h"
#include "Vector4.h"
using namespace System;
using namespace System::Globalization;
namespace NexusEngine
{
Vector4::Vector4( float value )
{
x = value;
y = value;
z = value;
w = value;
}
Vector4::V... | TOOL | 0.987153 | 3.745676 |
6387ddc0-16ff-4d8b-8045-7c9b5b945328 | LuvKobe/CPP-Programming | 01-C++-StudyCode/test_10_30/Test14.cpp | #define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
#include <assert.h>
using namespace std;
//class Date
//{
//public:
// //캯
// Date()
// {
//
// }
// //ʼ
// void Init(int year, int month, int day) {
// _year = year;
// _month = month;
// _day = day;
// }
// //ӡ
// void Print() {
// cout << _year << "-" << _m... | ALGO | 0.962246 | 4.467 |
5413bf25-0890-48ea-95c1-bba67eecea3d | Vinay0700/leetcode | 17-letter-combinations-of-a-phone-number/17-letter-combinations-of-a-phone-number.cpp | class Solution {
public:
const vector<string> pad = {
"", "", "abc", "def", "ghi", "jkl",
"mno", "pqrs", "tuv", "wxyz"
};
vector<string> letterCombinations(string digits) {
if (digits.empty()) return {};
vector<string> result;
result.push_back("");
for... | ALGO | 0.999958 | 6.935205 |
a15c9933-f02a-4c9c-a08d-e4bc88d67d4c | Sakshipriya0826/Cpp_kk | 2d_snake_pattern.cpp | //Print matrix in snake pattern
#include<iostream>
using namespace std;
int main(){
int arr[3][3]={{1,2,3},{4,5,6},{7,8,9}};
int row=sizeof(arr)/sizeof(arr[0]);
int col=sizeof(arr[0])/sizeof(arr[0][0]);
for(int i=0;i<row;i++){
if(i%2==0){
for(int j=0;j<col;j++){
... | ALGO | 0.999695 | 4.116486 |
5dfc3895-78e7-479c-b44c-7823b625af50 | akshayupadhyay008/CpTemplate1 | cp1-part1/cp29.cpp | #include <bits/stdc++.h>
using namespace std;
// #pragma GCC target ("avx2")
// #pragma GCC optimize ("O3")
// #pragma GCC optimize ("unroll-loops")
#define ill int long long
#define ld long double
#define fi first
#define se second
#define pb push_back
#define MP make_pair
// #define fo(i,k,n) for(ill i=k... | ALGO | 0.999912 | 5.742926 |
48c928e0-736d-45f4-8237-edd52c9f234d | ftErSandeepYadav/CP-SIGMA-CODES | CP files/BinarySearchStriver.cpp | // binary search it returns the index otherwise -1
int binarySearch(vector<int> &a , int x){
int n=a.size();
int lo = 0 , hi=n-1;
while(lo<=hi){
int mid = lo+(hi-lo)/2;
if(a[mid]==x) return mid;
else if(a[mid]>x) hi=mid-1;
else lo=mid+1;
}
return -1;
}
// recursive code
int binarySearchRecursive(vector<in... | ALGO | 0.999961 | 4.07275 |
d05e21c1-2380-49d1-b290-7eea6756078d | Proton-X00TD/android_frameworks_av | media/codecs/amrnb/enc/src/cor_h.cpp | /*
------------------------------------------------------------------------------
Pathname: ./audio/gsm-amr/c/src/cor_h.c
Date: 06/12/2000
------------------------------------------------------------------------------
REVISION HISTORY
Description: Updated template used to PV coding template. First attempt a... | ALGO | 0.999914 | 3.937387 |
d53ed094-56c1-442a-a205-c9e280a8eaf0 | sinhasaurabh079/DSA | Recursion/NthFibonacciFormula.cpp | #include<bits/stdc++.h>
using namespace std;
/* this is the golden ratio or the linear recurrence solution to find the
fibonacci series nth number
formula = 1/sqrt(5)*((1+ (under root 5 )/2)^n - (1 - (under root 5 )/2)^n)
so the time complexity is
t(n) = O(1.6180)^n
expln : (1 - (under root ... | ALGO | 0.99997 | 4.160856 |
5cc3cfa5-677d-4272-8444-971ab83e2b8b | ryangrayson1/CS-2150 | Lab03/PostLab/postfixCalculator.cpp | /**
* Ryan Grayson
* rtg5xkh
* 02/24/2021
* InLab 3
* postfixCalculator.cpp
*/
#include <iostream>
#include <cstdlib>
#include "postfixCalculator.h"
using namespace std;
postfixCalculator::postfixCalculator(){
theStack = stack();
}
stack postfixCalculator::getStack(){
return theStack;
}
void postfixCalcul... | ALGO | 0.929772 | 3.843802 |
26d2c74e-f860-40c9-a928-e0db8583e236 | Wardergrip/MinecraftTool | Project/gui/JUCE/modules/juce_dsp/processors/juce_FIRFilter.cpp | namespace juce
{
namespace dsp
{
template <typename NumericType>
double FIR::Coefficients<NumericType>::Coefficients::getMagnitudeForFrequency (double frequency, double theSampleRate) const noexcept
{
jassert (theSampleRate > 0.0);
jassert (frequency >= 0.0 && frequency <= theSampleRate * 0.5);
constexpr ... | ALGO | 0.983273 | 5.865329 |
e35ab25c-e63a-4e4c-a710-b7859ea797f3 | nul00000000/VRGame | VRGame/noise.cpp | #include "noise.h"
#include <algorithm>
#include <numeric>
#include <random>
PerlinNoise::PerlinNoise(unsigned int seed) {
p.resize(256);
// Fill p with values from 0 to 255
std::iota(p.begin(), p.end(), 0);
// Initialize a random engine with seed
std::default_random_engine engine(s... | TOOL | 0.962548 | 5.12346 |
0bfc6d64-5823-45f8-a0cf-1fc0b1548830 | Tinnerson/CompetitiveProgramming | Codeforces/0157A.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
int n;
cin>>n;
int a[n][n];
int ac[n][n];
int ar[n][n];
for(int i=0; i<n; i++){
for(int j=0; j<n; j++){
cin>>a[i][j];
}
}
int t=0;
... | ALGO | 0.99996 | 3.611132 |
c008635b-3d43-4372-8b93-d121de3f9b87 | Epochephemeral/CPtemplate | 高斯消元.cpp | const double eps = 1e-5;
int n; //可以跑 n=668的情况
double a[105][105];
void Gauss() {
for (int i = 1; i <= n; ++i) {
int p = i;
for (int j = i + 1; j <= n; ++j)
if (fabs(a[j][i]) > fabs(a[j][p]))
p = j;
if (fabs(a[i][i]) < eps) {
cout << "No Solution" << '\n';;
return ;
}
for (int j = 1; j <= n + 1... | ALGO | 0.999986 | 3.570489 |
149ef895-5bcf-4579-b21e-feff7d722da5 | shivamEr/DSA-In-CPP | Trees/add_duplicate.cpp | #include <iostream>
using namespace std;
// Node structure for the binary search tree
class Node {
public:
int data;
Node* left;
Node* right;
Node(int d) {
data = d;
left = NULL;
right = NULL;
}
};
// Function to insert a new node in BST
Node* insert(Node* root, int data) ... | ALGO | 0.999984 | 6.401361 |
e76ce6de-52bd-48e4-872e-f74c6baf8e1e | daleihao/GCAM_co2_downscaling | cvs/objects/solution/solvers/source/bisect_policy_nr_solver.cpp | /*!
* \file bisect_policy_nr_solver.cpp
* \ingroup objects
* \brief BisectPolicyNRSolver class source file.
* \author Josh Lurz
*/
#include "util/base/include/definitions.h"
#include <memory>
#include <xercesc/dom/DOMNode.hpp>
#include <xercesc/dom/DOMNodeList.hpp>
#include "solution/solvers/include/bisect_policy_nr... | ALGO | 0.998205 | 6.654656 |
f00d9fde-155e-4bc4-b13d-b742d497edcf | lew91/ML_homework | algorithms/sort/bitonic_sort.cpp | #include<iostream>
#include<cstdio>
#define ASCENDING true
using namespace std;
using std::vector;;
void compare(int *arr, int a, int b, bool dir){
if (dir == (arr[a] > arr[b])){
int temp = arr[a];
arr[a] = arr[b];
arr[b] = temp;
}
}
void halfCleaner(int *arr, int group, int length, bool dir, int f... | ALGO | 0.999819 | 4.120657 |
3690d174-3f3d-4c76-a6e6-59a0afb7eea3 | Shailesh93602/potd | leetcode/2025/april/15/15.cpp | struct BIT {
vector<int> tree;
BIT(int n) : tree(n + 1, 0) {}
void update(int i, int delta) {
for (++i; i < tree.size(); i += i & -i)
tree[i] += delta;
}
int query(int i) {
int ans = 0;
for (++i; i > 0; i -= i & -i)
ans += tree[i];
return an... | ALGO | 0.999963 | 5.428097 |
91e436cc-909d-4f92-8433-71913e826037 | hzhou/usaco | 17open/jasmine/art2_gold.cpp | //Jasmine Zhang
//1.5 hours
//9/10 cases passed
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <iostream>
using namespace std;
int main () {
int N;
FILE * In = fopen("art2.in", "r");
fscanf(In, "%d", &N);
int painting [N+2];
//setting up initial canvas
painting[0] = 0;
... | ALGO | 0.999547 | 3.818544 |
c44e412c-f666-48a2-8f1b-79a9d95c02e3 | alifalhasan/CP-code-vault | Codeforces/Codeforces Round/Codeforces Round 790 (Div. 4)/B - Equal Candies/156782142.cpp | #pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
template<typename temp>using ordered_set = tree<temp, null_type, less_equal<temp>, rb_tree_tag,tree_order_statistics_node_update>;
//order_of... | ALGO | 0.999734 | 4.533586 |
427228b5-7821-4b15-b941-32fc64296642 | mgcorona/pytorch | aten/src/ATen/native/cpu/SoftMaxKernel.cpp | #define TORCH_ASSERT_ONLY_METHOD_OPERATORS
#include <ATen/native/cpu/SoftmaxKernel.h>
#include <algorithm>
#include <iterator>
#include <numeric>
#include <ATen/Dispatch.h>
#include <ATen/Parallel.h>
#include <ATen/TensorIterator.h>
#include <ATen/core/Tensor.h>
#include <ATen/cpu/vec/functional.h>
#include <ATen/cpu... | DATA | 0.994001 | 7.309481 |
44047bc6-5ed9-4ed9-83ff-2f57b0e29a74 | whitehax0r/mesa-git | src/compiler/glsl/lower_discard.cpp | /**
* \file lower_discard.cpp
*
* This pass moves discards out of if-statements.
*
* Case 1: The "then" branch contains a conditional discard:
* ---------------------------------------------------------
*
* if (cond1) {
* s1;
* discard cond2;
* s2;
* } else {
* s3;
* }
*
* becomes:
*
* ... | ALGO | 0.868473 | 7.731054 |
630e9279-6c34-4c39-b9cd-d5bb385e7e3e | TzashiNorpu/Algorithm | Clion/zero/1400_1600/arrayChange_2295.cpp | //
// Created by TzashiNorpu on 2023/6/28.
//
#include "../header/header.h"
using namespace zero;
vector<int> Solution::arrayChange(vector<int> &nums, vector <vector<int>> &operations) {
unordered_map<int, int> m;
int n = nums.size();
for (int i = 0; i < n; ++i) {
m[nums[i]] = i;
}
for (auto &op: operat... | ALGO | 0.999941 | 6.094711 |
0ae49094-f11e-4774-9add-70a5c586a872 | JoyJi99/leetcode | 763.划分字母区间.cpp | /*
* @lc app=leetcode.cn id=763 lang=cpp
*
* [763] 划分字母区间
*/
// @lc code=start
class Solution {
public:
vector<int> partitionLabels(string s) {
vector<int> res;
int hash[27] = {0}; // i为字符,hash[i]为字符出现的最后位置
for (int i = 0; i < s.size(); i++) { // 统计每一个字符最后出现的位置
hash[s[i] - '... | ALGO | 0.999894 | 6.267109 |
4a9ebc6b-7d36-4c31-ad79-3e2cb83fc5d6 | abhishekjunior1/Cpp__codes | strings/1stLetter.cpp | #include<iostream>
using namespace std;
#include<stack>
#include<cctype>
#include<string>
// #define n=10;
void rev(string str)
{
stack<string> st;
for(int i=0;i<str.length();i++)
{
string s="";
while(str[i]!=' ')
{
s=s+ str[i];
... | ALGO | 0.999686 | 3.567368 |
6fc13092-7ba1-4151-b80f-5a42a6725968 | mohosy/CS8_Data_Structures | PCC Class Assignments/lab19_question1/question3.cpp | #include <iostream>
#include <cstring>
#include <cstdlib>
#include <ctime>
using namespace std;
const int N = 10;
void print(int arr[], int count){
for(int i = 0; i < count; ++i){
cout << arr[i] << " ";
}
cout << endl;
}
void reverse(int left, int right, int arr[], int count){
if(right ... | ALGO | 0.998718 | 4.333615 |
ce160577-21f7-42aa-b929-cd6d9bc46ee8 | yanyan-li/4DGS-SLAM | submodules/diff-gaussian-rasterization/third_party/glm/test/gtx/gtx_simd_mat4.cpp | ///////////////////////////////////////////////////////////////////////////////////
/// OpenGL Mathematics (glm.g-truc.net)
///
/// Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net)
/// Permission is hereby granted, free of charge, to any person obtaining a copy
/// of this software and associated documentatio... | TEST | 0.984791 | 6.515547 |
9fda43c5-d5ba-49d1-82c6-fb1b28e93aa9 | ccrabbs/ch1_Cubed | ch1_Cubed/ch1_Cubed.cpp | // ch1_Cubed.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <stdlib.h>
#include "platform.h"
#define CUBED(a) ((a) * (a) * (a))
float my_input = 0, my_result = 0.0;
char my_end[25];
void main()
{
system(CLEAR);
printf("Please, enter the number to be cubed:");
fflush(s... | TOOL | 0.97143 | 3.075688 |
c43c1ec3-30ce-4229-be93-8737090a8052 | abhi-03xyz/Cpp | p3.cpp | #include<iostream>
#include<iomanip>
using namespace std;
//#define *area;
void sqaureAREA(float &side)
{
side=side*side;
}
void circleAREA(float &side)
{
side= 3.14*(side*side);
}
int main()
{
float radii;
cout<<"Enter the radius of the circle\n";
cin>>radii;
circleAREA(radii);
cout<<"Area of the circle: "<<radii<... | ALGO | 0.972781 | 3.433959 |
2316c698-24d7-4d55-af30-ee3ff04849a0 | GaurishIIITNR/CP-Problems-III | Rearrange_Double_Arrays.cpp | // हर हर महादेव
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define F first
#define S second
#define dbl double
#define pb push_back
#define ll long long int
#define uset unordered_set
#define umap unordered_m... | ALGO | 0.999974 | 4.228186 |
bc83bb73-a814-4d86-8ae6-425e47740846 | Tarequl-islam/Programming-competition | Codeforces/1175 c.Electrification.cpp | #include<bits/stdc++.h>
using namespace std;
#define fo(i, n) for (i = 0; i < n; i++)
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define ll long long
#define si(x) scanf("%d", &x)
#define sl(x) scanf("%lld", &x)
#define ss(s) scanf("%s", s)
#define pi(x) printf("%d\n", x)
#define pl(x) printf("%lld\n", x)
#defi... | ALGO | 0.999976 | 3.71005 |
3c687e84-128a-4faa-8d9b-bf8d05d59c1b | yoonjaehee/STL-algorithm | src/graph/bak1389_bfs.cpp | #include <iostream>
#include <queue>
#include <vector>
using namespace std;
queue<int>q;
vector<int> conn[101];
int arr[101][101];
int n,m;
void bfs(int start){
int temp[101]={0,};
q.push(start);
temp[start]=1;
while(!q.empty()){
int current = q.front();
q.pop();
for(int t=0;t<co... | ALGO | 0.999903 | 3.974158 |
1ab8914a-5273-44ee-aa8c-d5d2c8f07bc6 | scaactk/PARA | Clus/ClusDoC-Clus-DoC/private/mexSource/optics_dbscan_mex_src/ompdbscan_mex/omp_dbscan.cpp | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* Files: omp_main.cpp clusters.cpp clusters.h utils.h utils.cpp */
/* dbscan.cpp dbscan.h kdtree2.cpp kdtree2.hpp */
/* */
/* Description: an openmp implementation of dbscan clustering al... | ALGO | 0.994302 | 6.550738 |
8453d435-14c7-49be-a928-af8798ac1f47 | MedusaMMC/Blockchain | src/util.cpp | #if defined(HAVE_CONFIG_H)
#include "config/pivx-config.h"
#endif
#include "util.h"
#include "allocators.h"
#include "chainparamsbase.h"
#include "random.h"
#include "sync.h"
#include "utilstrencodings.h"
#include "utiltime.h"
#include <librustzcash.h>
#include <stdarg.h>
#include <thread>
#include <boost/date_tim... | CONFIG | 0.975818 | 6.221821 |
02a90d39-5f7b-4d6c-83f2-2cd462c2194c | ishandutta2007/codeforces | gamegame/normal/1270/D.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,k;
vector<int>v;
ll x,y;
void ask(){
cout << "?";
for(auto cur:v) cout << ' ' << cur;
cout << endl;
cin >> x >> y;
v.clear();
}
ll gdx,gdy;
int main(){
ios::sync_with_stdio(false);
cin >> n >> k;
if(k==1){
cout << "! " << k << endl;
re... | ALGO | 0.999955 | 3.279958 |
ff8f7136-51d4-4f70-bf63-37c9f8151992 | Polidea/SiriusObfuscator-SymbolExtractorAndRenamer | lldb/tools/debugserver/source/RNBServices.cpp | #include "RNBServices.h"
#include "CFString.h"
#include "DNBLog.h"
#include "MacOSX/CFUtils.h"
#include <CoreFoundation/CoreFoundation.h>
#include <libproc.h>
#include <sys/sysctl.h>
#include <unistd.h>
#include <vector>
// For now only SpringBoard has a notion of "Applications" that it can list for
// us.
// So we h... | TOOL | 0.85419 | 5.395328 |
35cb48ce-8347-435a-837a-24cea03e6e43 | shekharbhide/DSA-Questions-CPP | 06_BINARY SEARCH/11_find_k_closest_element.cpp | //FIRST FIND THE DIFFEERNCE & SORT ACCORING TO DIFF
//THEN RETURN FIRST K ELEMENTS
class Solution {
public:
vector<int> findClosestElements(vector<int>& arr, int k, int x) {
int diff;
vector < pair <int,int> > ans;
vector <int> fa;
for(int i=0;i<arr.size();i++){
diff = ab... | ALGO | 0.999997 | 5.736848 |
9902ad97-4b65-4915-92f6-9975403f33b5 | projectchrono/DEM-Engine | src/demo/DEMdemo_Shake.cpp | // =============================================================================
// Put particles in a jar, the shake the jar in the hope to change the bulk density.
// =============================================================================
#include <DEM/API.h>
#include <DEM/HostSideHelpers.hpp>
#include <DEM/ut... | ALGO | 0.885017 | 6.123057 |
600a3ff4-ef00-48d8-8c45-efe6f64b7329 | victoralad/coding_projects | interesting_prob/one_edit.cpp | #include <iostream>
#include <deque>
bool one_edit(std::string &word1, std::string word2);
bool one_edit(std::string &word1, std::string word2)
{
int word1_size = word1.size();
int word2_size = word2.size();
// The if-statement appears redundant, as the else-statement solves the same issue as the if state... | ALGO | 0.999248 | 5.15945 |
443cd6fe-5451-4869-8d9c-f64eb9e19dec | saiful-islam-auny/Problem-Solving | CODE FORCE/Wrong Subtraction.cpp | #include <iostream>
using namespace std;
int main()
{
int n,i,k;
cin>>n>>k;
for(i=1; i<=k; i++)
{
if(n%10!=0)
{
n--;
}
else
n = n/10;
}
cout<<n;
return 0;
}
| ALGO | 0.999819 | 3.432473 |
f12581d5-8d86-4790-b0dc-c90c49298dea | Falicitas/Code_Template | 数学/FWT.cpp | #include <bits/stdc++.h>
using namespace std;
constexpr int P = 998244353;
void add(int& x, int y) {
(x += y) >= P && (x -= P);
}
void sub(int& x, int y) {
(x -= y) < 0 && (x += P);
}
/*使用时直接调用Or,And,Xor,无需额外开2^k空间*/
struct FWT {
int extend(int n) {
int N = 1;
for (; N < n; N <<= 1)
... | ALGO | 0.9999 | 4.309876 |
26417147-03a6-4fba-a259-1047b2d0db8d | CodePractice01/LearningC- | 06_gamePlayer_addStruct.cpp | #include <iostream>
#include <ctime>
#include <cstdlib> //c standard library
#include<fstream>
using namespace std;
struct player
{
string name;
int numWins;
};
//prototype
string FindPlayerName(player[], bool playerTurn);
int askMove(bool player1Turn, int chipsInPile, player[]);
void getUserNames(player[]);
vo... | ALGO | 0.986057 | 3.692728 |
2924be06-ebe9-4d52-a744-e69817cdf309 | anklinv/Algorithms-Lab-HS18 | casino_royale/casino_royale.cpp | // ALGOLAB BGL Tutorial 3
// Code snippets demonstrating
// - MinCostMaxFlow with arbitrary edge costs using cycle_canceling
// - MinCostMaxFlow with non-negative edge costs using successive_shortest_path_nonnegative_weights
// Compile and run with one of the following:
// g++ -std=c++11 -O2 bgl_mincostmaxflow.cpp -o... | ALGO | 0.996228 | 4.270175 |
0849e075-eefa-4fd8-982a-d578f94d673b | cyrillwork/EulerProject | tasks/task12.cpp | #include "task12.h"
ITask::ResType Task12::Process()
{
result = 0;
const int N = 500;
ResType number = 2;
while(true)
{
result = getTriangularNumber(number);
int countDiv = divisors(result);
if(countDiv >= N)
{
break;
}
++number;
... | ALGO | 0.996579 | 6.025628 |
a191b866-9772-4623-a971-0ba52e4bfb5e | spol-29/Usaco | yearofthecow/yearofthecow.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
string a[12] = {"Ox", "Tiger", "Rabbit", "Dragon", "Snake", "Horse", "Goat", "Monkey", "Rooster", "Dog", "Pig", "Rat"};
string cow1, born, in, relative, zodiac, year, from, cow2;
vector <pair<string, int> > cow1vec;
vector <string> cow2vec;
vect... | ALGO | 0.999101 | 3.648181 |
43bdbf76-f9c5-4a85-a08d-ef9b338d0170 | mmorshedulislam/03-Basic-Data-Structures-Phitron | Week - 05 - Binary Tree/18.5 - Week 05 - Practice Day 01/pre_post_in_level.cpp | #include <bits/stdc++.h>
using namespace std;
class Node
{
public:
int val;
Node *left;
Node *right;
Node(int val)
{
this->val = val;
this->left = NULL;
this->right = NULL;
};
};
void pre_order(Node *root)
{
if (root == NULL)
return;
cout << root->val <... | ALGO | 0.99993 | 4.931656 |
bbceb005-3426-412f-a433-973e3315c583 | taadith/school | csce430/labs/lab10/showroom.cpp | #include <vector>
#include <deque>
#include <iostream>
using namespace std;
const vector<pair<int, int>> directions = {
{0,-1},
{0,1},
{-1,0},
{1,0}
};
int main() {
int r,c;
cin >> r >> c;
vector<vector<char>> showroom(r + 2, vector<char>(c + 2, '.'));
for(int i = 1; i < r + 1; i++)... | ALGO | 0.99969 | 4.621951 |
342b70ab-e5bc-4d20-aa2a-deae0b401690 | joy-adhikary/Codeforces-Solutions- | A_Lucky_Sum_of_Digits.cpp | /*
ॐ नमः शिवाय
_Karn_2.0_
*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long u... | ALGO | 0.999982 | 3.743682 |
9cfe0158-8ce1-46e1-8c56-e2b968b4e3ee | hardik20sharma/C_plus_plus | SUM OF FIBONACCI SERIES.cpp | #include<iostream>
using namespace std;
int main()
{
long n,first=0,second=1,next,sum=0,a;
cout<<"Enter the number of terms:";cin>>n;
cout<<"0 ";
for(int i=1;i<=n;i++)
{
if(i==1)
{
next=i;
}
else
{
next=first+second;
sum+=next;
first=second;
second=next;
}
cout<<next<<" ";
}
a=s... | ALGO | 0.999813 | 3.556331 |
ffb15c87-a5c4-4ab9-9663-886521a2896f | AdityaMisal23/Harsh_Data | Cpp/Day03/demo01.cpp | #include <iostream>
using namespace std;
void changeNum1(int *ptr)
{
cout << "Address of num1 using ptr= " << ptr << endl;
cout << "Address of ptr= " << &ptr << endl;
*ptr = 20;
}
int main()
{
int num1 = 10;
cout << "Address of num1 = " << &num1 << endl;
cout << "Before change in num1 = " << n... | ALGO | 0.999528 | 4.30037 |
45f5e2cd-073c-4dfb-8e5e-eb4233050f8c | eternal-echo/cann_c_operator_s3 | CANN_C_Operator_S3/arg_max_with_value/op_kernel/arg_max_with_value.cpp | #include "kernel_operator.h"
extern "C" __global__ __aicore__ void arg_max_with_value(GM_ADDR x, GM_ADDR indices, GM_ADDR values, GM_ADDR workspace, GM_ADDR tiling) {
GET_TILING_DATA(tiling_data, tiling);
// TODO: user kernel impl
} | ALGO | 0.997434 | 5.336923 |
49cb24fd-6a36-47de-aa5b-9e0d0c347c14 | SatDump/SatDump | plugins/analog_support/noaa_apt/noise_reduction.cpp | #include "noise_reduction.h"
#include "common/dsp/window/window.h"
namespace dsp
{
AptNoiseReductionBlock::AptNoiseReductionBlock(std::shared_ptr<dsp::stream<complex_t>> input, int bins) : Block(input), _bins(bins)
{
// Init buffers
{
// Allocate FFT buffers
forwFFTIn = ... | ALGO | 0.885105 | 6.003343 |
d34875ab-0ac7-4a52-87b5-89e8e715b401 | NicksonCheng/leecode | Graph/3613. Minimize Maximum Component Cost.cpp | /*
Binary Search + DFS
先假設 minimum cost = m 的時候是否能符合# compoennt <= k(DFS), binary search
找到minimum cost
*/
class Solution {
public:
int minCost(int n, vector<vector<int>> &edges, int k) {
if (edges.empty())
return 0;
sort(edges.begin(), edges.end(),
[](auto &e1, auto &e2) { return e1[2] < e... | ALGO | 0.999983 | 6.007152 |
50434c40-51e8-41bc-9bf5-f07c8f6cc306 | EauDouceFish/Games202 | homework2/prt/ext/eigen/lapack/cholesky.cpp | #include "lapack_common.h"
#include <Eigen/Cholesky>
// POTRF computes the Cholesky factorization of a real symmetric positive definite matrix A.
EIGEN_LAPACK_FUNC(potrf,(char* uplo, int *n, RealScalar *pa, int *lda, int *info))
{
*info = 0;
if(UPLO(*uplo)==INVALID) *info = -1;
else if(*n<0) ... | ALGO | 0.999452 | 6.004565 |
3273c457-a183-4690-9f7a-9aabf132467c | SiddhiShelar25/Cpp | ARRAYS/Array2/PassArrayToFunc.cpp | #include <iostream>
using namespace std;
void display(int a[], int size)
{
for (int i = 0; i <= size - 1; i++)
{
cout << a[i] << " ";
}
cout << endl;
return;
}
void change(int b[], int size)
{
b[0] = 100;
}
int main()
{
int arr[] = {1, 2, 3, 4, 5};
int size = sizeof(arr) / sizeof... | ALGO | 0.97313 | 3.395628 |
fa6a2afd-7c5d-4d03-b18e-b41e79099c3e | grepatel/Cpp | Cpp/Practice/VendingMachine.cpp | #include <iostream>
#include <sstream>
#include <unordered_map>
#include <fstream>
#include <vector>
#include <regex>
#include<math>
using namespace std;
class Item
{
public:
string Name;
float Price;
string Code;
int Count;
};
typedef unordered_map<int, int> CashBoxType;
class Inventory
{
public:
... | TOOL | 0.983885 | 5.151162 |
155f2434-da5d-40ea-93fe-759285d60f14 | 0mehedihasan/0-to-CF-Expert | CodeChef/cchef-17.cpp | #include<iostream>
using namespace std;
int main()
{
int T;
cin>>T;
while(T--){
int A,B,C;
cin>>A>>B>>C;
if(A>B&&A>C&&B>C)
{
cout<<A-C<<endl;
}
else if(A>B&&A>C&&B<C)
{
cout<<A-B<<endl;
}
else if(B>A&&B>C&&A>C)
{
cout<<B-C<<endl;
}
else if(B>A&&B>>C&&A<C)
{
cout<<B-A<<endl;
}
else if(C>A&&C>B&&A>B)
{
cout<<C-B<<endl;
... | ALGO | 0.999995 | 4.258503 |
8219d216-a7c5-47e7-a53c-5e9e8cb029a3 | thu-ml/sEM-vr | lda/gd.cpp | //
// Created by 陈键飞 on 2018/4/17.
//
#include "gd.h"
#include "corpus.h"
#include <random>
#include <algorithm>
#include <cmath>
#include <fstream>
#include <exception>
#include <iostream>
#include <queue>
#include <atomic>
#include <omp.h>
#include "gflags/gflags.h"
#include "utils.h"
#include "flags.h"
#include "cl... | ALGO | 0.998667 | 5.195355 |
5a149a9e-ba2b-479c-a937-32fcdda98af9 | shenderaj9021/Data-structure | linked list/5_delete_node.cpp | #include<iostream>
using namespace std;
class node{
public:
int data;
node* next;
};
void printlist(node* n){
while(n!=NULL){
cout << n->data<<endl;
n = n->next;
}
}
void deletenode(node* head_ref,int node_data){
node* temp = head_ref;
node* prev = NULL;
if(tem... | ALGO | 0.999595 | 4.141687 |
13ca748d-fcda-4aed-a2b6-d1e858f74659 | devdrx/cp-submissions | F_Substring.cpp | #include "bits/stdc++.h"
#define int long long
#define uint unsigned long long
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define fr(i,n) for(int i=0; i<(n); i++)
#define rep(i,a,n) for(int i=(a); i<=(n); i++)
#define nl cout<<"\n"
#define dbg(var) cerr<<#var<<"="<<va... | ALGO | 0.999947 | 4.029837 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.