uuid stringlengths 36 36 | repo_name stringlengths 5 123 | relative_path stringlengths 5 4k | content stringlengths 33 2.85M | category stringclasses 6
values | algo_rel_score float64 0.85 1 | quality_score float64 3 8.76 |
|---|---|---|---|---|---|---|
bb9366bc-1150-4672-b6c7-9ea6964c9666 | virtyaluk/leetcode | problems/1357/solution.cpp | class Cashier {
private:
unordered_map<int, int> um;
int customer = 0,
_n = 0;
double _d = 0.0;
public:
Cashier(int n, int discount, vector<int>& products, vector<int>& prices) {
for (int i = 0; i < size(products); i++) {
um[products[i]] = prices[i];
}
... | ALGO | 0.980559 | 6.042731 |
2d024651-50f4-4b53-ab61-c218b2f8c31a | HendraHery/Belajargoding | Prosedur dan Fungsi2.cpp | #include <iostream>
using namespace std;
//Prosedur Ganjil Genap
void prosedurGanjilGenap (int);
int main ()
{
int a;
cout <<"Masukan Angka : ";
cin >>a;
prosedurGanjilGenap (a);
return 0;
}
void prosedurGanjilGenap (int a)
{
if (a%2==0){
cout <<"Angka Genap";
}
else if (a%2==1){
cout <<"Angka Ganji... | ALGO | 0.998885 | 3.300937 |
c86029a8-a2d0-427e-80cf-c4c71079df7f | Ketbome/Tesis | Trabajo/simulated-annealing/src/loup/ibex_LoupFinderIP.cpp | /* ============================================================================
* I B E X - Inner Polytope loup finder
* ============================================================================
*
* Author(s) : Ignacio Araya, Victor Reyes
* Created : April 2021
* Updated : April 2021
* -------------... | ALGO | 0.999976 | 5.723295 |
08adb98f-e2b3-4f1f-929b-4ffd8ff21117 | ishandutta2007/codeforces | alexandr_ts/normal/1354/A.cpp | #include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <type_traits>
#include <queue>
#include <cassert>
#include <utility>
#include <functional>
#include <set>
#include <cstdio>
#include <algorithm>
#include <ctime>
#include <vector>
#include <memory>
#include <string>
#include <optional>
... | ALGO | 0.998991 | 4.586327 |
9ff7aead-4858-4856-ab40-ef2ee51ecab4 | samruddhiDharankar/leetcode | Top Interview Questions/EASY/122. Best Time to Buy and Sell Stock II/sol.cpp | Say you have an array prices for which the ith element is the price of a given stock on day i.
Design an algorithm to find the maximum profit. You may complete as many transactions as you like (i.e., buy one and sell one share of the stock multiple times).
Note: You may not engage in multiple transactions at the same... | ALGO | 0.999936 | 5.799389 |
839fba4e-b22f-43a2-8dd7-60f2ea70128d | almex-n-hirai/OpenSiv3D | Siv3D/src/ThirdParty/soloud/src/core/soloud_misc.cpp | #include "soloud_misc.h"
#include <math.h>
namespace SoLoud
{
namespace Misc
{
float generateWaveform(int aWaveform, float p)
{
switch (aWaveform)
{
default:
case Soloud::WAVE_SQUARE:
return p > 0.5f ? 0.5f : -0.5f;
case Soloud::WAVE_SAW:
return p - 0.5f;
case Soloud::WAVE_SIN:
retu... | ALGO | 0.970601 | 5.513923 |
d83a48de-7220-469b-a08f-844abd1e6bd1 | sarvex/leetcode-rockstar | solution/2300-2399/2306.Naming a Company/Solution.cpp | class Solution {
public:
long long distinctNames(vector<string>& ideas) {
unordered_set<string> s(ideas.begin(), ideas.end());
vector<vector<int>> f(26, vector<int>(26));
for (auto v : ideas) {
int i = v[0] - 'a';
for (int j = 0; j < 26; ++j) {
v[0] = ... | ALGO | 0.99995 | 5.772797 |
96c658d4-2402-4a6d-9b70-ca3ae54b8beb | RadonX/LeetCode | HackerRank/OpenBracket CodeSprint/coprime-power-sum(prime array).cpp | /*
* https://www.hackerrank.com/contests/openbracket/challenges/coprime-power-sum
* O(n*k*m); memory: O(n)
*/
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
#define modulo 1000000007 // 10^9+7
#define maxm 1000000000000
long a[maxm+1];
long m;
int... | ALGO | 0.999896 | 4.025081 |
40251ed3-2bfd-475e-9896-074926732e21 | SciomeLLC/ToxicRToo | src/code_base/helperfunctions.cpp | #include "stdafx.h"
#include <cfloat>
#include <cmath>
#include <iostream>
#include <nlopt.hpp>
#ifdef R_COMPILATION
// necessary things to run in R
// necessary things to run in R
// #ifdef ToxicR_DEBUG
// #pragma GCC diagnostic push
// #pragma GCC diagnostic ignored "-Wignored-attributes"
// #include <RcppEigen.h>
/... | ALGO | 0.999411 | 5.718537 |
d9a044d1-ecd2-4957-8e11-112d2a55a71f | leecoders/ALGORITHMS_CODE | Algorithms/11438.cpp | //#include"bits/stdc++.h"
//using namespace std;
//
//#define mp make_pair
//#define pb(x) push_back(x)
//#define _upgrade ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
//#define ALL(a) (a.begin()),(a.end())
//#define ZERO(a) memset(a,0,sizeof(a))
//#define MINUS(a) memset(a,0xff,sizeof(a))
//
//typedef pair<int,... | ALGO | 0.99999 | 4.426983 |
085278b2-5c6d-49ec-951e-8891299c91bf | shubhgkr/Codechef | Beginner/CHEFROUT.cpp | /*
* @author Shubham Kumar Gupta (shubhgkr)
* github: http://www.github.com/shubhgkr
* Created on 4/6/20.
* Problem link: https://www.codechef.com/problems/CHEFROUT
*/
#include <iostream>
#include <regex>
int main() {
std::ios_base::sync_with_stdio(false);
std::cin.tie(nullptr);
int t;
std::cin >> t;
while ... | ALGO | 0.998916 | 4.824406 |
eb692aa6-6bf1-4c88-8bde-d2e3aeb2af63 | iamslash/learntocode | leetcode3/Step-By-StepDirectionsFromaBinaryTreeNodetoAnother/a.cpp | #include <cstdio>
#include <vector>
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), left(left), right(right) {}... | ALGO | 0.999955 | 5.770164 |
98dded6f-7af4-4ff9-8b2b-d2d92e524cfb | Marcelobbr/FGV_algorithms | hw1/test.cpp | #include <bits/stdc++.h>
#include <time.h>
#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <string>
using namespace std;
/* FUNCOES AUXILIARES */
void linspace(int array[], int size){
for (int i = 0; i < size; i++){
array[i]=10000+10000*i;
}}
void print(int A[], int l... | ALGO | 0.996889 | 4.789822 |
c11df710-4caf-4518-b307-eb3e15186e5c | yku/Competition | TopCoder/srm533/PikachuEasy.cpp | #include <iostream>
#include <sstream>
#include <cstring>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;
class PikachuEasy {
public:
string check(string word) {
int n = word.length();
for(int i = 0; i < n; ) {
if(word[i] == 'p' && i+1 < n && word[i+1] == 'i') i += 2;
... | ALGO | 0.999222 | 3.767251 |
98ed19bd-ecc1-47b1-b4cd-b0c223b24285 | AdityaDebnath7/GFG_DSA_CODES_-ADITYA_DEBNATH- | Tree/maxintree.cpp | #include <iostream>
using namespace std;
# include <limits>
struct Node
{
int key;
struct Node *left; // left pointer
struct Node *right; // right pointer
Node(int k)
{
key = k;
left = right = NULL;
}
};
int max_tree(Node* root)
{
if(root== NULL)return ;
else return max... | ALGO | 0.999468 | 3.804797 |
370168b0-05c2-4c17-8987-ec02ce54f8dc | sg782/sgNet | src/neural/layer/relu.cpp | #include "neural/layer/relu.h"
#include <vector>
#include "tensor/tensor.h"
SgNet::Relu::Relu(){
}
SgNet::Tensor SgNet::Relu::forward(Tensor inputs){
this->inputs = inputs;
inputs.min(0);
return inputs;
}
SgNet::Tensor SgNet::Relu::backward(Tensor dValues){
return (inputs>0) * dValues;
} | DATA | 0.96487 | 6.06009 |
84fdd0e7-e4cf-4333-9d0b-37a63a738e18 | saktheeswaranswan/leetcode-monk-version-big-examples | 823-binary-trees-with-factors/823-binary-trees-with-factors.cpp | class Solution {
public:
int numFactoredBinaryTrees(vector<int>& arr) {
unordered_map<int,long long int> m;
int n=arr.size();
sort(arr.begin(),arr.end());
for(int i=0;i<n;i++){
m[arr[i]]=1;
}
for(int i=1;i<n;i++){
long long int count=0;
... | ALGO | 0.999945 | 5.719292 |
d3f0f40b-38bd-491a-b56d-2217e1551401 | waris8/cpp | leetcodeNew/src/codeforces/CR811D2B.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include<string>
#include <cstdlib>
using namespace std;
int main()
{
int t;
cin >> t;
for (int x = 0; x < t; x++)
{
int n;
cin >> n;
vector<int> v(n,0);
int c=0;
for(int i=0;i<n;i++){
int y;... | ALGO | 0.99988 | 3.801266 |
4163dd03-7899-4e40-b004-030ef419f1e4 | HekpoMaH/Olimpiads | Shumen AiB/PROGRAMA_ZABAVA/IV/dquery.cpp | #include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
using namespace std;
struct qu
{
int l;int r;
int idx;
};
qu dq;
vector<qu> qrs;
int a[300004],n,m;
int last[1000009];
int ans[200009],t[30001];
bool cmp(qu fi,qu se)
{
if(fi.r<se.r)return true;
if(fi.r>se.r)return false;
if(fi... | ALGO | 0.99998 | 3.970983 |
28a2775a-1630-413d-b300-da0eff1aa7c2 | deluxDeepak/DSA | Tree/Binary_tree/09_array_input.cpp | #include <iostream>
#include <queue>
#include <vector>
using namespace std;
class node
{
public:
int data;
node*left,*right;
node(int value)
{
left=right=nullptr;
data=value;
}
};
// indexing to put the value of nodes in level order
node *insert_level_order(int arr[],int index,i... | ALGO | 0.999922 | 5.362284 |
5f60791c-80cb-42e1-a30e-4177e15cb380 | Shintaro0105/Competitive-programming | atcoder/abc/189/b.cpp | #include <iostream>
using namespace std;
int main(){
int n;cin>>n;
double x;cin>>x;
x*=100;
double sum=0;
int ans=-1;
for(int i=0;i<n;i++){
double v,p;cin>>v>>p;
sum+=v*p;
if(sum>x&&ans<0){
ans=i+1;
}
}
cout<<ans<<endl;
return 0;
} | ALGO | 0.999826 | 3.754983 |
43723e31-d704-4967-bd26-e068f694cbdb | meilleur777/Competitive_Programming | AtCoder/old/ABC/ABC125/D.cpp | #include <bits/stdc++.h>
#define fast_io ios_base::sync_with_stdio(false); cin.tie(NULL)
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> intp;
void init_code() {
fast_io;
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);... | ALGO | 0.999986 | 4.022505 |
84705c31-bb07-439b-a7e9-49bcd439c95c | b30wulf/themida | main.cpp | #include "pch.h"
#pragma comment(lib, "xed.lib")
#pragma comment(lib, "triton.lib")
#include <fstream>
#include <TlHelp32.h>
#include <tchar.h>
#include <chrono>
#include "ProcessStream.hpp"
#include "ThemidaAnalyzer.hpp"
#include "CFG.hpp"
struct redirect_cout
{
redirect_cout(const std::ostream &ostream)
{
thi... | TOOL | 0.906792 | 3.429934 |
af4d0f22-0364-4f02-9a5c-b0eaa57891f5 | sukyeee/Algorithm | 23_light.cpp | #include <bits/stdc++.h>
#include <algorithm>
#include <vector>
#pragma warning (disable:4996)
using namespace std;
#define MAX 100002
typedef struct Input {
int x;
int y;
int num; //index
}Input;
bool cmp(const Input& p1, const Input& p2) {
if (p1.x < p2.x) {
return true;
}
else if (p1.x == p2.x) {
return p... | ALGO | 0.999947 | 4.253196 |
34f76689-c3a5-4723-90df-086e09f9ff93 | brian521/Algorithm | c++/2440.๋ณ์ฐ๊ธฐ-3/๋ณ์ฐ๊ธฐ-3.cpp | #include <iostream>
using namespace std;
int main()
{
int N;
cin >> N;
for(int i = N; i > 0; i--)
{
for(int j = 1; j <= i; j++)
{
cout << "*";
}
cout << "\n";
}
return 0;
}
| ALGO | 0.999786 | 4.186023 |
d87f5cec-7cd7-43af-9c5d-f090375a4d66 | Vartikamishra07/LP2 | A_Star.cpp | #include <iostream>
#include <cmath>
#include <limits.h>
using namespace std;
int g = 0;
void Print(int puzzle[]) {
for(int i = 0; i < 9; i++) {
if(i % 3 == 0) cout << '\n';
if(puzzle[i] == -1) cout << "_ ";
else cout << puzzle[i] << " ";
}
cout << "\n\n";
}
void moveLeft(int star... | ALGO | 0.999976 | 5.010489 |
cf4a6970-8cd0-4c22-820a-4cd78341940d | AL-ETERNITY/DSA_Striver_Sheet | Recursion/q22.cpp | // function to solve the problem of word break using recursion and memoization
#include <bits/stdc++.h>
using namespace std;
class Solution {
private:
bool solve(string s, unordered_set<string> &words, unordered_map<string, bool> &dp) {
if(s.size() == 0) {
return true;
}
if(dp.... | ALGO | 0.999866 | 6.268908 |
4b5157c0-40bd-4a2e-a916-026b64c2c725 | pyrimidine02/Problem_Solving | Codeforces/Codeforces Round 951 (Div. 2)/C.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 0x3f3f3f3f;
using pii = pair<int, int>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vll = vector<ll>;
using vpii = vector<pii>;
ll gcd(ll a, ll b) {
for (; b; a %= b, swap(a, b));
return... | ALGO | 0.999921 | 4.263775 |
c6203dbd-2cf7-4ec5-89f3-47451eb39ade | Kanchii/Online_Judge_Problems | Uri/1332.cpp | #include <bits/stdc++.h>
#define INF (1 << 30)
#define LINF (1LL << 63)
using namespace std;
int main() {
int n;
cin >> n;
while(n--){
string a;
cin >> a;
if(a.size() > 3){
cout << 3 << endl;
} else {
if((a[0] == 'o' and a[1] == 'n') or (a[0] == 'o' and a[2] == 'e') or (a[1] == 'n' and a[2] == 'e'... | ALGO | 0.999481 | 3.96456 |
5f5fd9e6-897c-4bb4-8857-355745d13ffa | delwar03/CF | E_Not_a_Nim_Problem.cpp | #include <bits/stdc++.h>
#define int long long
#define endl '\n'
#define ff first
#define ss second
using namespace std;
const int mod = 998244353;
const int N = 1e7 + 10;
const int INF = 1e15 + 10;
int dp[105];
int f(int n) {
int &ans = dp[n];
if(~ans) return ans;
set<int> st;
for(int i = 1; i <= n;... | ALGO | 0.999943 | 4.972315 |
b69b12fc-033d-4971-8228-eebacb94ec4a | RabbitCabbage/FreshmanCode | ๅคงไธไธๅฐไฝไธ/homework2/ๅฐๆดฅๅ่ๆๆฑ/main.cpp | #include <iostream>
using namespace std;
int beishu;
int main() {
cin >> beishu;
int average = 0;
int mongo[beishu];
for (int i = 0; i < beishu; ++i) {
cin >> mongo[i];
}
int renshu;
for (renshu = 1; renshu <= beishu; renshu++) {
for (int qishi = 0; qishi <= beishu - rens... | ALGO | 0.999488 | 3.79656 |
68eb1436-95b0-4ab4-9b92-d0e4555aaec4 | WendellReis/Competitive-Programming | Junior Training Sheet V7/A/CF686-D2-A.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int n; cin >> n;
long long x; cin >> x;
int q = 0, d;
char c;
for(int i = 0; i < n; i++) {
cin >> c >> d;
if(c == '+')
x+=d;
else if(x < d)
q++... | ALGO | 0.999985 | 4.110585 |
bff33ad7-dfd3-4589-9703-12e4a3e5cadc | Pulakesh5/_DSA_ | March 19 '22/895. Maximum Frequency Stack leetcode.cpp | class FreqStack {
public:
unordered_map<int,int> freq;
unordered_map<int, stack<int>> m_stk;
int max_freq=0;
FreqStack() {
}
void push(int val) {
max_freq=max(max_freq,++freq[val]);
m_stk[freq[val]].push(val);
}
int pop() {
int x=m_s... | ALGO | 0.999673 | 6.358928 |
f936fe93-2816-466a-a6f5-440353c60589 | saransh2singh/StriversSheetChallenge | day14_StacknQueue_MinStack.cpp | class MinStack {
public:
MinStack() {
}
stack<long>st;
long mini;
void push(int val) {
int value = val;
if(st.empty()){
st.push(value);
mini = value;
}
else{
if(value < mini){
st.push((long)2*value - mini);
... | ALGO | 0.999982 | 6.093176 |
56e0166d-499a-44e4-8a86-d3274d38df5f | rpsingh55/Data-Structures | tempCodeRunnerFile.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution{
public:
int Maximize(int a[],int n)
{
sort(a,a+n);
long long int sum=0;
int mod=1000000007;
for(long long int i=0;i<n;i++)
{
sum =(sum + ((a[i]*i)%mod))%mod;
}
return sum;
... | ALGO | 0.999801 | 4.334068 |
1fb1150b-9458-4501-82f0-d363c13c9271 | AlanWu7895123/Visual_PnP_Navigation | src/pnp.cpp | #include "pnp.h"
#include <pcl/registration/icp.h>
PNPAlgorithm::PNPAlgorithm() {}
PNPAlgorithm::PNPAlgorithm(const vector<pair<double, double>> &source, const vector<pair<double, double>> &target,
const vector<int> &correspondences) : source(source),
... | ALGO | 0.996917 | 5.627722 |
4327f5ce-6730-4077-aa8a-e0f531b8a95b | sarvex/leetcode-algol | lcci/16.19.Pond Sizes/Solution.cpp | class Solution {
public:
vector<int> p;
vector<int> size;
vector<int> pondSizes(vector<vector<int>>& land) {
int m = land.size(), n = land[0].size();
for (int i = 0; i < m * n; ++i) {
p.push_back(i);
size.push_back(1);
}
for (int i = 0; i < m; ++i) {
... | ALGO | 0.999873 | 6.237022 |
a5a2f161-5a8d-4e5a-8202-2876ca9abccb | martinafrazzoni/cpp_programming | esercitazione_10/pila.cpp | /*
Una pila รจ una struttura dati che prevede due operazioni:
1) push: inserimento di un elemento di un dato valore (da passare alla
funzione)in cima alla pila. La pila ha una dimensione massima predefinita;
se la si supera l'operazione di push fallisce;
2) pop: estrazione di un elemento dalla cima della p... | ALGO | 0.97233 | 4.886722 |
c9b7b61d-af2d-4253-b455-4049ff062cbf | ShimuGuyue/AlgorithmPractice-Codes | LuoGu/้ขๅบ/P5735.cpp | #include <iostream>
#include <iomanip>
#include <cmath>
int main(void)
{
double x1, y1;
double x2, y2;
double x3, y3;
std::cin >> x1 >> y1;
std::cin >> x2 >> y2;
std::cin >> x3 >> y3;
double ans(0);
ans += sqrt(pow(x1 - x2, 2) + pow(y1 - y2, 2));
ans += sqrt(pow(x1 - x3, 2) + pow(y1... | ALGO | 0.99939 | 3.844486 |
a9e25f75-7c9c-4323-aa35-a14ee7ff9308 | RickyC0626/cisc3142-cpp-paradigms | Lab 3.1 - Some Codelab Exercises/3.1.2 - Classes/1 - Definitions/10889.cpp | /**
* Write the implementation (.cpp file) of the `Averager` class of
* the previous exercise. The full specification of the class is:
* - A data member named `sum` of type integer
* - A data member named `count` of type integer
* - A constructor with no parameters. The constructor initializes
* the data members ... | TOOL | 0.914347 | 7.348943 |
89125c10-ea97-42ef-8f5c-e34d1744790f | samreachyan/BKCodes | Thuat Toan Ung Dung/Slide Example/Chapter 2/HaonVi.cpp | #include <iostream>
using namespace std;
int n, m, count;
int a[100];
int Ghinhan(){
int i, j;
count++;
cout << "Hoan vi thu " << count << " : ";
for ( i=1; i<=n ; i++)
cout << a[i] << " ";
cout << endl;
}
bool UCV(int j, int k){
int i;
for (i=1; i<=k ; i++)
if (j==a[i]) return false;
return true;
}
voi... | ALGO | 0.999524 | 3.706967 |
962556d1-eb75-4380-9ffa-2b90dc13c44c | maryamhatami2005/University_homework | Semester2/Advanced_computer_programming/20th.cpp | #include<iostream>
using namespace std;
// finding max and min in array and returning the values
int MaxMin(float x[], int n, int *index1, int *index2)
{
int i;
*index1 = 0;
*index2 = 0;
for(i=1; i<n ; i++)
{
if(x[i] > x[*index1])
*index1 = i;
else
... | ALGO | 0.999576 | 3.340053 |
61c0cf18-8a94-4679-9067-513100de9da6 | goldfishrock/Marlin-bugfix-2.1.2.1-SKR.1.4.Turbo.BLTouch.TFT35-Custom | Marlin/src/HAL/shared/backtrace/unwarm_arm.cpp | #if defined(__arm__) || defined(__thumb__)
#define MODULE_NAME "UNWARM_ARM"
#include <stdio.h>
#include "unwarm.h"
/** Check if some instruction is a data-processing instruction.
* Decodes the passed instruction, checks if it is a data-processing and
* verifies that the parameters and operation really indicate a d... | TOOL | 0.865092 | 4.103226 |
ff381e1e-0700-4102-b718-df2beef0c925 | Sabbir-Rayhan/Codeforces_Problem | mahmoud_Ehab.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
if(n%2)
cout<<"Ehab"<<endl;
else
cout<<"Mahmoud"<<endl;
}
| ALGO | 0.999945 | 3.296825 |
9d43310d-ac2f-4ad2-bf53-6d29c49bf2f8 | jiangxu05/notes | ้ข/ๆด่ฐทๅท้ข็ฌ่ฎฐ/ๅพช็ฏ/ๅนณๅๅผ,็ด่งไธ่ง.cpp | #include<iostream>
#include<iomanip>
using namespace std;
int main() {
int n, k;
cin >> n >> k;
int sum1 = 0, sum2 = 0, count1 = 0, count2 = 0;//่ฟ้ๆไนๅๆฒกๆๅๅงๅ๏ผๆณจๆไบๅ
for (int i = 1; i <= n; ++i) { // ไป1้ๅๅฐn
if (i % k == 0) {
sum1 += i;
count1++;
} else {
... | ALGO | 0.999409 | 3.208225 |
3c3b6f3a-6122-4038-8424-ff3b175530e0 | fedeoliv/Math-Algorithms | pascal_triangle.cpp | #include <stdio.h>
typedef long long int LL;
/* Pascal's triangle is a triangular array of the binomial coefficients.
Write a function that takes an integer value n as input and prints first n lines of the Pascalโs triangle.
Following are the first 6 rows of Pascal's Triangle:
1
1 1
1 2 1
1 3 ... | ALGO | 0.999547 | 5.511155 |
01a7bbc2-7e00-461e-9f81-81073774de3a | JonasHri/everybode_codes | bjoern/ec9.cpp | #include <iostream>
#include <vector>
#include <fstream>
#include <string>
#include <unordered_map>
#include <limits>
int numDots(int brigthnes);
void setupMins();
int main(){
std::vector<int> sparkballs;
std::string line;
std::fstream file("everybody_codes_e2024_q09_p3.txt");
if(!file.is_open()){
... | ALGO | 0.999144 | 5.462681 |
db9d33fc-0668-494b-8742-dc17b3e65a67 | RohitKotha/leetcodePrograms | 17-letter-combinations-of-a-phone-number/letter-combinations-of-a-phone-number.cpp | class Solution {
public:
vector<string>sol;
void rec(int len,string &digi,string &temp,unordered_map<char,string>&mp){
if(len>=digi.length()){
sol.push_back(temp);
return;
}
char ch=digi[len];
string str=mp[ch];
for(int i=0;i<s... | ALGO | 0.999954 | 6.769716 |
f7b1f1f7-79fb-43e4-975d-f163f31bc79e | iamputradanish/alex | RTOS mode/AlexRTOS_v2.1.cpp | #include <Arduino.h>
#include <math.h>
#include <avr/io.h>
#include <FreeRTOS.h>
#include <task.h>
#include <semphr.h>
/*----------CONSTANTS----------*/
// FreeRTOS constants
#define STACK_SIZE 100
#define QUEUE_SIZE 10
// Task constants
#define BLUETOOTHTASK_PERIOD 25
#define RECEIVE_DATA_DEADLINE 10
#define GREENLE... | TOOL | 0.983644 | 3.769033 |
d92b4842-631c-43da-9dc2-ec2c438eeaa4 | ziap/cp | src/cses-2431.cpp | #include <bits/stdc++.h>
using i64 = int64_t;
int main(void) {
i64 q;
std::cin >> q;
for (; q; --q) {
i64 k;
std::cin >> k;
i64 n = 0;
i64 i = 1;
i64 e = 1;
while (true) {
i64 next = n + 9 * e * i;
if (next < k) {
n = next;
i++;
e *= 10;
} els... | ALGO | 0.999676 | 3.983788 |
b4bba768-d80b-43e2-9ff9-85c0671d3d4a | genius00hwan/HelloHuman | BaekJoon/2798_๋ธ๋์ญ3์คํฌ๋ฌธ.cpp | #include<iostream>
using namespace std;
int n,m,sum,result;
int deck[100];
int main(){
cin>>n>>m;
for(int i=0;i<n;i++){
cin>>deck[i];
}
for(int i=0;i<n;i++){
for(int j=i+1;j<n;j++){
for(int k=j+1;k<n;k++){
sum = deck[i]+deck[j]+deck[k];
if(sum... | ALGO | 0.999994 | 4.192606 |
de87e1b5-e8bf-4891-9ac7-49cfa0983cd5 | DuoGao/Thesis | duo_slam/src/slamdunk/transformation_estimation.cpp |
#include "slamdunk/transformation_estimation.h"
#include "slamdunk/pretty_printer.h"
#include <iostream>
#include <boost/random/variate_generator.hpp>
#include <boost/random/uniform_int.hpp>
#include <Eigen/SVD>
#include <Eigen/LU> // required for determinant computation
void SLAM_DUNK_API slamdunk::estimateTransfor... | ALGO | 0.998654 | 6.652764 |
db44611d-e8f6-46c6-b318-9adf64c956c4 | OpenDigitalTwin-Dev/FENGSim | toolkit/Geometry/pcl/registration/src/ppf_registration.cpp | #include <pcl/registration/ppf_registration.h>
//#ifndef PCL_NO_PRECOMPILE
//#include <pcl/point_types.h>
//#include <pcl/impl/instantiate.hpp>
//#include <pcl/registration/impl/ppf_registration.hpp>
//PCL_INSTANTIATE_PRODUCT(PPFRegistration, (PCL_XYZ_POINT_TYPES)(PCL_NORMAL_POINT_TYPES));
//#endif // PCL_NO_PRECO... | ALGO | 0.986346 | 6.839592 |
8e9d4de9-d193-4d53-8da3-b8d43b5ad9f0 | Iconoclast42/CSCI2270 | CSCI2270/Recitation7/recitation7.cpp | #include <iostream>
#include "BST.cpp"
using namespace std;
int main(){
BST tree(4);
for (int i=0; i<10; i++){
tree.insertNode(i);
}
tree.printTree();
if (tree.searchKey(8)){
cout << "found!" << endl;
}
} | ALGO | 0.997576 | 4.009789 |
3946b980-1b0c-4132-8680-882c421c4d66 | syloe1/CS- | exploring C++11/list4002.cpp | class rational {
public:
rational(int num) : numerator_ {num}, denominator_ {1} {}
rational(rational const&) = default;
inline rational(int num, int den);
void assign(int num, int den);
int numerator() const {
return numerator_;
}
int denominator() const {
return denominator_;
}
rational& opera... | TOOL | 0.953128 | 5.910335 |
8f35f151-1163-425e-87f0-619f67cb01da | ApoorvaRajBhadani/competitive-programming | hrprims.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define MOD 1000000007
#define fo(i,k,n) for(int i=k;i<=n;++i)
#define endl '\n'
int edge[3000][3000];
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);cout.tie(0);
memset(edge,0,sizeof(edge));
int n,m,start,i;
ll ans=0;
cin>>n>>m;
f... | ALGO | 0.999933 | 3.780504 |
0ab56826-b7dc-4798-87ed-b3a714cf68bc | Abhiram-108/leetcode | 36-valid-sudoku/valid-sudoku.cpp | class Solution {
public:
bool isValidSudoku(vector<vector<char>>& board) {
vector<vector<bool>>row(9,vector<bool>(9,false));
vector<vector<bool>>col(9,vector<bool>(9,false));
vector<vector<bool>>box(9,vector<bool>(9,false));
for(int i=0;i<9;i++){
for(int j=0;j<9;j++){
... | ALGO | 0.999696 | 6.750797 |
30f8b27b-96b0-458a-961d-d4417aaa61b9 | markmsmith/NaClAMBase | NaClAMBullet/bullet-2.81-rev2613/src/BulletCollision/NarrowPhaseCollision/btGjkConvexCast.cpp | #include "btGjkConvexCast.h"
#include "BulletCollision/CollisionShapes/btSphereShape.h"
#include "btGjkPairDetector.h"
#include "btPointCollector.h"
#include "LinearMath/btTransformUtil.h"
#ifdef BT_USE_DOUBLE_PRECISION
#define MAX_ITERATIONS 64
#else
#define MAX_ITERATIONS 32
#endif
btGjkConvexCast::btGjkConvexCast(... | ALGO | 0.996623 | 6.413063 |
fdb02034-cb67-431a-8202-3cbddcc5131f | ishandutta2007/codeforces | 0wuming0/normal/1648/B.cpp | #include"bits/stdc++.h"
using namespace std;
bool a[1000005];
int sum[1000005];
int main()
{
int t;
cin>>t;
while(t--)
{
int n,c;
cin>>n>>c;
for(int i=0;i<=c;i++)a[i]=0;
while(n--)
{
int k;
scanf("%d",&k);
a[k]=1;
}
... | ALGO | 0.999936 | 3.551226 |
f643e496-1db5-474e-bea1-07668b9ecdb9 | ppjy0927/Data_Structure | C++/KHU_data_structure/APP02/main.cpp | #include <iostream>
#include "ItemType.h"
#include "unsorted.h"
#include "sorted.h"
using namespace std;
int main() {
int n;
cout << "N(10 ฺฟ) : ";
cin >> n;
UnsortedType A;
cout << "ฦฎ A ๎ฐฅ (10 ฺฟ) N : ";
for (int i = 0; i < n; i++) {
ItemType item;
int num[10];
cin >> num[i];
item.Initialize(num[i]);
A... | ALGO | 0.999647 | 4.303126 |
60f43a00-ac31-46c4-909a-43dea7ed5a7c | GAURAVSVNIT/CODING-WITH-GAURAVSVNITIAN | 1.BASIC PROGRAMMING/C++/Vectors/pascaltriangle.cpp | /*
This program will generate the pascal triangle
*/
# include <iostream>
using namespace std;
int factaorial(int n)
{
int fact=1;
for(int i=2;i<=n;i++)
{
fact*=i;
}
return fact;
}
int combination(int n,int r)
{
int ncr=factaorial(n)/(factaorial(n-r)*factaorial(r));
return ncr;
}
i... | ALGO | 0.999894 | 3.687396 |
210808a0-717f-4135-b263-fea60d6a83d0 | VodimShilin/Algorithms-1sem | TaskC.cpp | #include <iostream>
#include <vector>
#include <ctime>
long long max(const std::vector<long long>& a) {
int max_ = 0;
for (int i = 1; i < a.size(); ++i) {
if (a[i] > a[max_]) {
max_ = i;
}
}
return a[max_];
}
long long random() {
int64_t x = rand();
x <<= 15;
x ... | ALGO | 0.999992 | 4.499804 |
9778ce4e-4f82-47f4-bedc-3e76c16fd70d | erik123567/SubliminalAudioApp | ios/boost-local/boost/libs/math/example/find_root_example.cpp | // find_root_example.cpp
// Example of using root finding.
// Note that this file contains Quickbook mark-up as well as code
// and comments, don't change any of the special comment mark-ups!
//[root_find1
/*`
First we need some includes to access the normal distribution
(and some std output of course).
*/
#include... | ALGO | 0.999971 | 4.818492 |
e10bf203-75ba-4935-898e-3b373d38a7fc | ujjwal897/InterviewBit-Problems | FIrst-Missing-Integer.cpp | Given an unsorted integer array, find the first missing positive integer.
Example:
Given [1,2,0] return 3,
[3,4,-1,1] return 2,
[-8, -7, -6] returns 1
Your algorithm should run in O(n) time and use constant space.
int Solution::firstMissingPositive(vector<int> &A) {
int n=A.size();
int j=0;
for(int i... | ALGO | 0.99997 | 4.475608 |
3c0b6b79-35a3-4cc4-8c19-a1832bf3810b | klasdfiz/leetcode | contains_duplicate_217.cpp | class Solution {
public:
bool containsDuplicate(vector<int>& nums) {
int len = nums.size();
if (len <= 1)
return false;
set<int> nums_set;
nums_set.insert(nums[0]);
for (int i = 1; i < len; i ++)
{
set<int>::iterator temp;
temp = nums_set.fi... | ALGO | 0.999602 | 5.744977 |
c2f632fd-f8e1-4ea5-a131-3bb044922aee | Danielbook/TNG033_-_Programmering_i_C- | Earlier years/kod/Lektioner/Lek 3/Solutions/ex2.cpp | /***************************************************************
* TNG033, lesson 3 *
* Exerc 2: STL *
* **************************************************************/
#include <iostream>
#include <vector>
#include <algorithm>... | ALGO | 0.998248 | 4.226276 |
b9305515-0c7d-4e42-b43f-69585c2dc164 | fyzel527/UnrealEngine-4.24Toon | Engine/Source/Runtime/Core/Private/Math/SHMath.cpp | #include "Math/SHMath.h"
//
// Spherical harmonic globals.
//
float NormalizationConstants[9];
int32 BasisL[9];
int32 BasisM[9];
/** Computes a factorial. */
static int32 Factorial(int32 A)
{
if(A == 0)
{
return 1;
}
else
{
return A * Factorial(A - 1);
}
}
/** Initializes the tables used to calculate SH va... | ALGO | 0.999525 | 6.170938 |
2ce1958f-2906-4212-82fb-13b59359b5dc | momororo/iroawase | cocos2d/cocos/ui/UITextField.cpp | #include "ui/UITextField.h"
#include "platform/CCFileUtils.h"
NS_CC_BEGIN
namespace ui {
static int _calcCharCount(const char * pszText)
{
int n = 0;
char ch = 0;
while ((ch = *pszText))
{
CC_BREAK_IF(! ch);
if (0x80 != (0xC0 & ch))
{
++n;
}
... | TOOL | 0.922184 | 6.487772 |
955884c2-3aef-49fd-bbfd-ec3fddf917f8 | allwellll/cf_code_jiangly | cuiaoxiang/687/687B-B-RemaindersGame.cpp | // url:https://codeforces.com/contest/687/problem/B
// time:2022-06-05 04:27:16
// name:B-RemaindersGame
// #define LOCAL
#define _USE_MATH_DEFINES
#include <array>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <vector>
#inc... | ALGO | 0.999989 | 4.573997 |
69875a14-05e1-4c1d-8a6d-4d8ee9125683 | ishandutta2007/codeforces | freshp_0325/normal/1539/E.cpp | #include<bits/stdc++.h>
using namespace std;
#define mp make_pair
int n,m,a[100005],l[100005][2],r[100005][2],g[2][100005];
bool inside(int x,int op,int val){return l[x][op]<=val && val<=r[x][op];}
void Solve(int now,int op)
{
if(!now) return ;
int lst=g[op][now];
Solve(lst,op^1);
for(int i=lst+1;i<=now;++i) printf... | ALGO | 1 | 3.446373 |
3ee36ddd-914d-4e0f-bd72-ab9a2f82bc0a | shohan2032/Competitive-Programming-Practice-Codes | D_1_Zero_One_Easy_Version.cpp | #include <bits/stdc++.h>
using namespace std;
//Debug Function-->works for vector,map,set(dbg(stl_name)),,arrar(dbg(array_name,range))
template < typename F, typename S >ostream& operator << ( ostream& os, const pair< F, S > & p ) {return os << "(" << p.first << ", " << p.second << ")";}
template < typename T >ostrea... | ALGO | 0.999353 | 4.016689 |
0e8c9b16-4703-4414-88aa-f27d2684ff44 | danilolanzi/C-_Program_I | par_impar.cpp | #include <iostream>
//Programa que solicita ao usurio um nmero inteiro,
//verifica se o nmero informado par ou impar
//e se o nmero est entre 1 e 50,
//se o nmero est acima de 50 ou se o nmero informado negativo
using namespace std;
int main()
{
int numero;
cout << "Informe o numero ";
cin >> numero;
... | ALGO | 0.997347 | 3.402072 |
c147f21a-4d66-4e56-b0e6-f8d2b0d487ec | orensb/UAV-Simulation---Cpp | main_with_thread.cpp |
#include "UAV.h"
#include "Inputs.h"
#include <iostream>
#include <iomanip> //for 2 decimal in my print, and the txt style.
#include <fstream> //read and the file
#include <map>
#include <unordered_map>
#include <vector>
#include <string>
#include <cmath>
#include <thread>
#include <mutex>
#include <chrono>
#include ... | TOOL | 0.893652 | 3.762617 |
f78901e6-6fcd-40b7-ba65-af6b49df1677 | DUSHYANT2026/LeetCode-Questions | 0124-binary-tree-maximum-path-sum/0124-binary-tree-maximum-path-sum.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.999985 | 6.278753 |
1458a954-a276-45b6-8127-731c16a88d06 | SORVER/CP-Problems | cp_problems/A_Two_Permutations.cpp | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
ll t; cin >> t; while(t--){
ll n , a , b ; cin >> n >> a >> b;
if(n == a && a == b){cout << "Yes\n";}
else if(a +b >= n -1 ) {cout << "No\n";}
else {cout << "Yes\n";}
}
} | ALGO | 0.999661 | 3.847228 |
e1d177fb-985d-42c2-8ecc-60c537c33ede | ytsaurus/ytsaurus-cpp-sdk | contrib/restricted/boost/atomic/src/lock_pool.cpp | /*!
* \file lock_pool.cpp
*
* This file contains implementation of the lock pool used to emulate atomic ops.
*/
#include <boost/predef/os/windows.h>
#if BOOST_OS_WINDOWS
// Include boost/winapi/config.hpp first to make sure target Windows version is selected by Boost.WinAPI
#include <boost/winapi/config.hpp>
#in... | TOOL | 0.892467 | 7.260393 |
104b3330-50a6-4a10-92e3-c89f7ec38081 | Simillo/dredd | lista 2/9.cpp | #include <iostream>
using namespace std;
int main(){
int x,y,z;
cin>>x>>y>>z;
if(x+y<z||x+z<y||z+x<y||z+y<x||y+x<z||y+z<x)
cout<<-1<<endl;
else{
if(z==y&&z==x)
cout<<"equilatero"<<endl;
else if((z==y&&z!=x)||(y==x&&y!=z)||(x==z&&x!=y))
cout<<"isosceles"<<endl;
else
cout<<"escaleno"<<endl;
... | ALGO | 0.99987 | 4.134288 |
0303d63b-3db3-4879-8914-71a6abf129dd | weimingtom/bullet | src/BulletDynamics/Featherstone/btMultiBodyPoint2Point.cpp | ///This file was written by Erwin Coumans
#include "btMultiBodyPoint2Point.h"
#include "btMultiBodyLinkCollider.h"
#include "BulletDynamics/Dynamics/btRigidBody.h"
btMultiBodyPoint2Point::btMultiBodyPoint2Point(btMultiBody* body, int link, btRigidBody* bodyB, const btVector3& pivotInA, const btVector3& pivotInB)
:bt... | ALGO | 0.946879 | 6.01181 |
30e234c8-2ccf-40a4-9fc2-411660fbedaa | gaurlakshya/Leetcode_Submissions | Largest subarray with 0 sum - GFG/largest-subarray-with-0-sum.cpp | //{ Driver Code Starts
//Initial Template for C++
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
/*You are required to complete this function*/
class Solution{
public:
int maxLen(vector<int>&A, int n)
{
// Your code here
unordered_map<int,int> ump;
int sum=... | ALGO | 0.999872 | 6.385459 |
f57f0e94-6310-4da1-a4ff-509d49f71650 | LHS-11/Algorithm | 1์ฃผ์ฐจ - ๋ฌธ์์ด, ๋์ ํฉ, ๊ตฌํ/14929.cpp | #include<bits/stdc++.h>
using namespace std;
/*
X1 X2 1 * -2 = -2
X1 X3 1 * 3 = 3
X2 X3 -2 * 3 = -6
-----------------------
-5
X1 X2
X1 X3
X1 X4
------
X2 X3
X2 X4
------
X3 X4
X1*(X2+X3+X4)
X2*(X3+X4)
X3*X4
*/
int n,arr[100004];
int main(){
ios::sync_with_stdio(0);cin.tie(0);
cin >> n;
long long sum=0;
fo... | ALGO | 0.999979 | 3.364363 |
693636f0-95b5-4690-b92b-ea3edd7a7524 | nervmor/pdf_hit_detector | code/third/boost_1_58_0/libs/icl/example/boost_party_/boost_party.cpp | /** Example boost_party.cpp \file boost_party.cpp
\brief Generates an attendance history of a party by inserting into an interval_map.
Demonstrating <i>aggregate on overlap</i>.
boost_party.cpp demonstrates the possibilities of an interval map
(interval_map or split_interval_map). Boost::posi... | ALGO | 0.979143 | 6.584379 |
232a9510-751f-4656-83ff-d651a4added9 | leandoero/OOP_lab5 | OOP_lab5/classEllipse.cpp | #include "classEllipse.h"
Ellipse::Ellipse(double a, double b) : Function(a, b) {};
void Ellipse::calculateY(double X) {
ellipseX = X;
double y = *b * *b * (1 - (X * X) / (*a * *a));
if (y < 0) {
index = 0;
}
else if (y > 0) {
index = 1;
ellipseY = sqrt(y);
}
else if(y == 0){
index = 2;
ellipseY = sq... | ALGO | 0.992214 | 5.334921 |
5c372a37-1f73-44c2-ac14-5b358917bf9c | raincross7/code-similarity | codes/train_code/problem370/problem370_31.cpp | #include <cstdio>
#include <iostream>
#include <vector>
#include <queue>
#include <cstring>
using namespace std;
typedef struct _data
{
int node;
int weight;
}Data;
vector<Data> vec[100005];
int N, M, chk[100005], dist[100005], result;
void BFS()
{
queue<Data> q;
for(int j = 1; j <= N; j++)
{
... | ALGO | 0.999997 | 4.446128 |
448f0871-46a2-4a96-bc48-bb30578909dc | JJHyeok13/codeTree-TIL | 241023/์ด์ํ ์ง์ 2/awkward-digits-2.cpp | #include <iostream>
#include <climits>
using namespace std;
int main() {
// ๋ณ์ ์ ์ธ ๋ฐ ์
๋ ฅ
string binary;
cin >> binary;
// ๊ฐ i๋ฒ์งธ ์๋ฆฟ์๋ฅผ ๋ฐ๊พธ์์ ๋์ ์ญ์ง์ ๊ฐ์ ๊ตฌํด์ค๋๋ค.
int ans = INT_MIN;
for(int i = 0; i < (int) binary.size(); i++) {
// i๋ฒ์งธ ์๋ฆฟ์๋ฅผ ๋ฐ๊ฟ๋๋ค.
binary[i] = '0' + '1' - binary[i];
// ์ญ์ง์๋ก ๋ณํํฉ๋๋ค.
... | ALGO | 0.999941 | 5.065729 |
5129e379-f664-483e-9c74-43d5472e0a2a | dam-crtl/dam-crtl | scc.cpp | #include<bits/stdc++.h>
#include<atcoder/all>
using namespace std;
using namespace atcoder;
using namespace internal;
using mint = modint1000000007;
using mint2 = modint998244353;
template <class T> using maxpq = priority_queue<T>;
template <class T> using minpq = priority_queue<T, vector<T>, greater<> >;
template <cla... | ALGO | 0.999839 | 5.677012 |
41a7cae0-993b-46bd-904e-24a81e07765d | NabilMasud/PML_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.9988 | 6.76073 |
01272065-4eb7-4c38-938d-89229175664c | AmitSharma234/DSA | STACK13.CPP | #include<stdio.h>
#include<conio.h>
#include<stdlib.h>
struct stack{
int top;
int size;
int *arr;
};
int isempty(struct stack *ptr)
{
if(ptr->top==-1)
{
return 1;
}
return 0;
}
int isfull(struct stack *ptr)
{
if(ptr->top==ptr->size-1){
return 1;
}
return 0;
}
... | ALGO | 0.999076 | 4.152321 |
5a86a973-d036-4505-9030-b5af85f8e3f6 | vishalkushw/oops-in-cpp | Multiple inheritance cube.cpp | /* Write a C++ program to demonstrate multiple inheritance by creating a
class cuboid which extends class rectangle, class shape. It calculates area
and volume. Use appropriate constructors and member variables? */
#include <iostream>
using namespace std;
class Shape {
protected:
double length;
double bread... | TOOL | 0.922122 | 5.824323 |
9d79786a-fb4a-4b36-b1a7-4964ec0a80dc | AbdulMalek-swe/problem_solving_weark-3 | day-5/sky_resort11.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t;
cin >> t;
while (t--)
{
int n, m, d;
cin >> n >> m >> d;
vector<int> arr(n);
for (int i = 0; i < n; i++)
{
cin>>arr[i];
}... | ALGO | 0.999858 | 5.762719 |
62b1e925-a2b3-4068-bd35-9a3d1e0f6067 | anshuahi/LeetCode | Problems/1-1000/01-50/33. Search in Rotated Sorted Array/solution.cpp | class Solution {
public:
int findPivot(vector<int> nums, int l, int h) {
if(l > h)
return -1;
if(l == h)
return l;
int mid = (l + h)/2;
// mid is not equal to high
if(mid < h && nums[mid] > nums[mid+1])
return mid;
// mid is no... | ALGO | 0.999995 | 6.037507 |
8b6c674c-4d58-407c-8599-168f3cc7159d | Tasssadar/mangos-arm | dep/src/g3dlite/Matrix.cpp | /**
@file Matrix.cpp
@author Morgan McGuire, http://graphics.cs.williams.edu
*/
#include "G3D/Matrix.h"
#include "G3D/TextOutput.h"
static inline G3D::Matrix::T negate(G3D::Matrix::T x) {
return -x;
}
namespace G3D {
int Matrix::debugNumCopyOps = 0;
int Matrix::debugNumAllocOps = 0;
void Matrix::serialize(T... | TOOL | 0.888088 | 7.73564 |
639f6648-6a29-4920-85ad-62a026d51d80 | beelisais2793/FX | Synthesizer/Waves/Oscillators/minBlep/jacksynth/src/TMinBlepPulseOscillator.cpp | /*
* Measurements at 880Hz PW=50%, sample rate 44100Hz.
* --> 50.1 samples per period.
* nzc=16, os=32 (--> 32 samples blep length):
* fundamental at -34dB, harmonics at -44 -48 -51 -53 -54 -57
* worst aliasing at -98dB, first peak at 538Hz.
* nzc= 8, os=32 (--> 16 samples blep length):
* fundamental ... | ALGO | 0.954783 | 6.616796 |
0f34c3c0-b3d3-41e6-8e4b-59ee23308669 | Winterleaf/OmniEngine.Net | Engine/lib/recast/Detour/Source/DetourCommon.cpp | #include <math.h>
#include "DetourCommon.h"
//////////////////////////////////////////////////////////////////////////////////////////
float dtSqrt(float x)
{
return sqrtf(x);
}
void dtClosestPtPointTriangle(float* closest, const float* p,
const float* a, const float* b, const float* c)
{
// Check if P in... | ALGO | 0.999748 | 7.015486 |
e6c7768e-6b76-4dfb-85ef-91c7e46109b8 | shangrex/leetcode | 0048-rotate-image/0048-rotate-image.cpp | class Solution {
public:
/*
Approach 1.
Inspired from: https://leetcode.com/problems/rotate-image/discuss/1175496/JS-Python-Java-C%2B%2B-or-Easy-4-Way-Swap-Solution-w-Explanation
Approach 2.
First reverse up and down then reflict left and right.
https://leetcode.com/problems/rotate-image/di... | ALGO | 0.999978 | 6.743972 |
d60b9ed8-ccee-4ea6-a85e-22f03adf9ffa | PimVanLeeuwen/aoc_2020 | day_21/Day21.cpp | #include "Day21.h"
#include <algorithm>
#include <deque>
#include <iostream>
#include <map>
#include <ostream>
#include <set>
#include <sstream>
using namespace std;
set<string> intersect(const set<string>& a, const set<string>& b) {
set<string> output;
for (const string& i : a) {
if (b.find(i) != b.... | ALGO | 0.97238 | 4.02685 |
3301c91b-37dd-4235-bc01-8c4bda3e7e0f | ergt666/learning_cpp | ReverseInteger2.cpp | #include <iostream>
#include <string>
#include <algorithm>
#include <climits>
#include <limits>
using namespace std;
int main(){
int x = 1534236469;
string res = "";
int i;
long long j;
if (x > INT_MAX || x < INT_MIN || x == 0){
cout << "ะะฐ ะผะตะถะฐะผะธ";
return 0;
} else {
string str = to_string(x);... | ALGO | 0.999826 | 4.34814 |
02707c06-7e66-4238-a4ad-7bc632a73a8a | mercyXp/Introduction-To-Programming-cpp | week-4/task4.cpp | #include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
bool isPrime;
for (int num = 2; num <= n; num++) {
isPrime = true;
for (int i = 2; i * i <= num; i++) {
if (num % i == 0) {
isPrime = false;
break;
}
... | ALGO | 0.999754 | 4.957959 |
53bff320-95a7-4caa-ab7a-b1ab19cc49eb | AmarjeetJyotis/GeeksForGeeks- | Difficulty: Hard/Search Pattern (KMP-Algorithm)/search-pattern-kmpalgorithm.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
vector<int> search(string& pat, string& text) {
int n = text.size();
int m = pat.size();
vector<int> lps(m, 0);
int len = 0;
lps[0] = 0;
... | ALGO | 0.999359 | 6.401971 |
cbd38125-ecc1-4ea4-8a10-0cdddf4e26f6 | nurayk22/BP | ch2b.cpp | #include <iostream>
using namespace std;
int main(){
int n;
cin>>n;
if( n%4==0 && n%100!=0 ||n%400==0){
cout<<"YES"<<endl;
}
else{
cout<<"NO"<<endl;
}
} | ALGO | 0.999918 | 4.661243 |
657474f5-4085-4fc7-a584-8bfaa34f1ccf | sakshi04-ui/LLD_Learning | Lecture 029/IteratorPattern.cpp | #include <iostream>
#include <vector>
#include <stack>
#include <string>
using namespace std;
// Iterator & Iterable Hierrarchy
template<typename T>
class Iterator {
public:
virtual bool hasNext() = 0;
virtual T next() = 0;
};
template<typename T>
class Iterable {
public:
virtual Iterator<T>* getIterator... | ALGO | 0.977033 | 5.146748 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.