uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
da208518-1f6a-43d1-9047-056ade041c0e | KunjShah95/DSA-COLLEGE-CODE | quick sort/main.cpp | #include <iostream>
using namespace std;
int Partition(int A[], int start, int end)
{ // Fixed array parameter
int pivot = A[end];
int pindex = start;
for (int i = start; i < end; i++)
{ // Fixed loop condition (i < end)
if (A[i] <= pivot)
{
swap(A[i], A[pindex]);
... | ALGO | 0.999959 | 5.902895 |
7acf0c08-0361-4d46-833b-92b80efafbdf | Sean0628/competitive_programming | atcoder/tessoku-book/2/b40.cpp | #include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
#define rep(i, n) for (int i = 0; i < (n); ++i)
using ll = long long;
using P = pair<int, int>;
int main() {
ll n; cin >> n;
vector<ll> a(n);
map<int, ll> cnt;
rep(i, n) {
cin >> a[i];
cnt[a[i]%100]++;
}
... | ALGO | 0.999811 | 4.524334 |
a8a5487a-2c28-49ba-bfe0-d68f3f7aaab7 | Ljh-11/list | LinkList.cpp | //
// Created by on 2020/6/19.
//
#include <iostream>
//ṹ
typedef struct LNode {
int data;
struct LNode * next;
}LNode, * LinkList;
//
int List_Length(LinkList L);
//ͷ巨
LinkList List_HeadInsert(LinkList & L, int a[], int len) {
LNode * s;
L = (LNode *) malloc (sizeof(LNode));
L->next = nullptr;
... | ALGO | 0.999647 | 3.379962 |
4ce5651c-2428-4969-9735-2dc435e9c91e | keremsemiz/learning-cpp | LearningC++/Tasks/MaximumElement.cpp | // task - find the maximum element
#include <iostream>
int findMax(int arr[], int size) {
int max = arr[0];
for (int i = 1; i < size; ++i) {
if (arr[i] > max) {
max = arr[i];
}
}
return max;
}
int main() {
int arr[] = {10, 20, 5, 30, 15};
int size = sizeof(arr) / s... | ALGO | 0.999607 | 5.673489 |
026df038-c60c-43d1-85da-20d5fe4b87eb | sinian666/code_41_30 | cpp_副本9/chapter_array_and_linkedlist/array.cpp | /**
* File: array.cpp
* Created Time: 2022-11-25
* Author: Krahets (<EMAIL>)
*/
#include "../utils/common.hpp"
/* 随机返回一个数组元素 */
int randomAccess(int *nums, int size) {
// 在区间 [0, size) 中随机抽取一个数字
int randomIndex = rand() % size;
// 获取并返回随机元素
int randomNum = nums[randomIndex];
return randomNum;
... | ALGO | 0.904222 | 4.8213 |
af790c6e-1bcd-4faf-b5e8-120ec8f12255 | Priyo002/DSA | Decode-DSA-C++/Classes/Week23(Graph)/Class11/Shortest_Path_In_terms_Of_Edge_Cost.cpp | #include<bits/stdc++.h>
using namespace std;
#define int long long
#define pp pair<int,int>
void init() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
#ifndef ONLINE_JUDGE
freopen("inputf.in", "r", stdin);
freopen("outputf.in", "w", stdout);
#endif
}
/*
Q: Given an undirected weighted graph, along with
a ... | ALGO | 0.999976 | 4.226741 |
9eee396c-a338-4224-9ed6-4061d5eb0d44 | mateuszkowalczyk0305/cpp_leet_code_tasks | ValidAnagram[easy]/validAnagram.cpp | #include <iostream>
#include <string>
bool isAnagram(std::string s, std::string t) {
if (s.length() != t.length()) {
return false;
}
for (int i = 0; i < s.length(); i++) {
for (int j = 0; j < s.length(); j++) {
if (s[i] == t[j]) {
t.erase(t.begin() + j);
break;
}
}
}
... | ALGO | 0.998759 | 6.26568 |
713b0ae3-4597-4ef7-962e-9ceea0c1e5d0 | certik/hermes2d | examples/richards/forms.cpp | // Jacobian matrix, implicit Euler.
// Jacobian matrix, Crank-Nicolson.
double jac_euler(int n, double *wt, Func<double> *u_ext[], Func<double> *u, Func<double> *v, Geom<double> *e, ExtData<double> *ext)
{
double result = 0;
Func<double>* h_prev_newton = u_ext[0];
Func<double>* h_prev_time = ext->fn[0];
for (in... | ALGO | 0.999916 | 4.615915 |
e5e6f919-7962-43ca-afd0-ca6a8267263c | AmanSharma13/mycCode | Basic Programs/number_RBreaking_Days.cpp | #include<iostream>
using namespace std;
int main(){
int n;
cin>>n;
int arr[n+1];
arr[n] = -1;
for (int i = 0; i < n; i++)
{
cin>>arr[i];
}
if (n==1)
{
cout<<"1"<<endl;
return 0;
}
int ans=0;
int mx = -1;
for (int i = 0; i < n; i++)
{
... | ALGO | 0.999988 | 3.690599 |
141a8a0c-8feb-4394-b934-ec1f216e51a5 | farzamdorostkar/amon | llvm-project-17.0.6.src/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp | #include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/CodeGen/ISDOpcodes.h"
#include "llvm/CodeGen/MachineValueType.h"
#include "llvm/CodeGen/SelectionDAG.h"
#include "llvm/CodeGen/SelectionDAGNodes.h"
#include "llvm/CodeGen/TargetLowering.h"
#include "llvm/CodeGen/ValueTypes.h"
#include "llvm... | ALGO | 0.929451 | 7.540082 |
a4fa9f89-2f09-4bc0-9cdb-67e7bf3e049d | harshitha937/DSA | basics/operators/pos_neg.cpp | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
/*Take 2 numbers, check if both are positive.
Check if either of them is greater than 10.*/
int main(){
int a,b;
cout<<"Enter 1st number:";
cin >> a;
cout <<"enter 2nd number:";
cin >> b;
if(a >10 || b> 10){
cout << a <<"or" << b <<... | ALGO | 0.996586 | 3.256784 |
66d48594-44a4-44e0-b55c-d430d43d2eeb | HoppenR/AdventOfCode | 2018/day06/day6.cpp | #include <iostream>
#include <set>
#include <string>
#include <vector>
// All yee who enter here, heed this warning: Pepega
#define INT_MAX 2147483647
#define PART2 0
int main(void) {
std::vector<std::pair<int, int>> coordvec;
std::vector<std::pair<int, int>>::iterator coordveciter;
int minx = INT_MAX;
... | ALGO | 0.996484 | 5.125968 |
b28dadf9-32d0-4e8f-83c1-77d1b6d24dee | shubhampund100k/Cpp_and_DSA | Recursion/printNto1.cpp | // Print all the numbers from N to 1 using Recursion
#include<iostream>
using namespace std;
void printNto1(int n){
if(n==0)
return;
cout<<n<<endl;
printNto1(n-1);
}
int main(){
printNto1(4);
}
// Output:
// 4
// 3
// 2
// 1
// Logic:
// printNto1(4) prints 4 -> printNto1(3) prints... | ALGO | 0.999748 | 5.835066 |
c4f377d1-60a3-4821-8fc3-81e797087b3a | ishandutta2007/codeforces | omer223/normal/1365/E.cpp | #define MOD 1000000007
#define fast ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define foru(i, k, n) for (int i = k; i < n; i++)
#define ford(i, k, n) for (int i = k; i >= n; i--)
#define pb push_back
#define mp make_pair
#define has(set, x) set.find(x) != set.end()
#define nohas(set, x) set.find(x) == set.en... | ALGO | 0.999984 | 4.555557 |
f61ae19a-c555-43ec-9b11-5b807e1689c1 | ishandutta2007/codeforces | falldream/normal/993/E.cpp | #include<bits/stdc++.h>
#define MN 200000
const double pi=acos(-1);
using namespace std;
inline int read()
{
int x=0,f=1;char ch=getchar();
while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
return x*f;
}
int n,X,a[MN+5],N;
long long res[MN+5];
struct cp
{
dou... | ALGO | 0.999757 | 3.20413 |
118f9701-03e7-4b62-a82f-496dbd25a50a | avalevich/P2 | zestaw3/main.cpp | //
// main.cpp
// zestaw3
//
// Created by Alexey Valevich on 15/03/2021.
//
#include <iostream>
using namespace std;
void display(u_int16_t num){
int MAX = UINT16_MAX + 1;
MAX >>= 1;
while(true) {
if(num & MAX) {
cout << "1";
}else {
cout << "0";
}
... | ALGO | 0.997521 | 4.721295 |
a20652a2-69cd-40e0-a116-069424c62d30 | habib-e/All-Problem-Solving-code-with-name | competitive programmer.cpp | #include<bits/stdc++.h>
using namespace std;
#define CLR(a) memset(a,0,sizeof(a))
int cnt[15];
int main() {
int n;
cin >> n;
string s;
for(int i=1;i<=n;i++) {
cin >> s;
CLR(cnt);
int sum = 0;
for(int i=0;i<s.size();i++) {
cnt[s[i]-'0']++;
sum += s... | ALGO | 0.999448 | 3.788717 |
0518babf-1fab-456f-b435-4da675bfda5a | 0sidharth/seasonsOfCode | moat.cpp | #include <bits/stdc++.h>
using namespace std;
int timer, l;
vector<int> tin, tout;
vector<vector<int> > up;
void dfs(int v, int p, vector<int> adj[]) {
tin[v] = ++timer;
up[v][0] = p;
for (int i = 1; i <= l; ++i)
up[v][i] = up[up[v][i-1]][i-1];
for (int u : adj[v]) {
if (u != p)
... | ALGO | 0.999991 | 4.655495 |
23250846-2c5b-4c88-8821-3361df2613f3 | cms-externals/boost | libs/compute/example/k_means.cpp | #include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <boost/compute/system.hpp>
#include <boost/compute/container/vector.hpp>
#include <boost/compute/image/image2d.hpp>
#include <boost/compute/interop/opencv/core.hpp>
#include <boost/compute/interop/op... | ALGO | 0.998317 | 6.887066 |
3b59ea8a-9661-4bb0-bf8b-db7d1de99c32 | Amaima-Salim/15-Days-Of-LeetCode-Challenge- | 15-3sum/3sum.cpp | class Solution {
public:
vector<vector<int>> threeSum(vector<int>& nums) {
vector<vector<int>> result;
sort(nums.begin(),nums.end());
for(int i=0;i<nums.size();i++){
if(i>0 && nums[i]==nums[i-1])continue;
int left=i+1;
int right=nums.size()-1;
... | ALGO | 0.999957 | 5.941781 |
ffb33d74-94ae-453d-aae2-42269ed1a792 | ishandutta2007/codeforces | lqx2005/normal/4/A.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
if(n%2==0&&n!=2)
{
cout<<"YES"<<endl;
}
else
{
cout<<"NO"<<endl;
}
return 0;
} | ALGO | 0.999452 | 3.370126 |
aed028b4-2cac-4dfd-b6e9-9f6c47f3dd21 | mirzanorazman/project-E_MAIL | TraverseInOrder.cpp | // Author : Mirza Nor Azman
#include "tree.h"
#include <sstream>
void TraverseInOrder(TREENODE *root)
{
std::ostringstream oss;
if(!root) return;
double dummy;
TraverseInOrder(root->left);
dummy = calcBill(root);
oss << "User: " << root->user.name << "\n" << "Charge: " << dummy << " dollars\n";... | ALGO | 0.99694 | 4.389263 |
aa571f9e-20b9-42d0-83aa-7b4b7c0d1e75 | Piyush289kumar/DSA | Optus-EdTech-Solutions/Basic/Prefix Sum/Q1.cpp | /* Q1:PreFix Sum.*/
#include <bits/stdc++.h>
using namespace std;
vector<int> findPrefixSum(vector<int> &nums, vector<vector<int>> pq)
{
vector<int> prefixSum(nums.size());
int prefixCurrSum = 0;
for (int i = 0; i < nums.size(); i++)
{
prefixCurrSum += nums[i];
prefixSum[i] = prefixCu... | ALGO | 0.999694 | 4.653335 |
68fb340b-16ba-4c2a-8ddc-268e0218d98c | tony11306/haker-rank-solution | dataStructure/linkedList/Delete duplicate-value nodes from a sorted linked list.cpp | // problem source: https://www.hackerrank.com/challenges/delete-duplicate-value-nodes-from-a-sorted-linked-list/problem
#include <bits/stdc++.h>
using namespace std;
class SinglyLinkedListNode {
public:
int data;
SinglyLinkedListNode *next;
SinglyLinkedListNode(int node_data) {
... | ALGO | 0.999745 | 5.665449 |
65b9715d-f85a-415b-b42a-62df462534ff | VeerRavi97/Others | isSame.cpp | class Solution {
public:
bool isSameTree(TreeNode* p, TreeNode* q) {
if(!p && !q) return true;
if(!p || !q) return false;
if(p->val==q->val)
return isSameTree(p->left,q->left) && isSameTree(p->right,q->right);
return false;
}
}; | ALGO | 0.999952 | 6.401874 |
309cd812-8185-44fd-b1d3-07cf39ffc1c5 | tarekalmowafy/Compatetive_Programming | uva/10324_zeros_and_ones.cpp | #include <cstdio>
#include <vector>
#include <string.h>
#include <iostream>
using namespace std;
int main() {
vector<string> solutions;
char line[1000015];
int n_cases, counter = 1;
while (scanf("%s", line) == 1) {
if (strcmp(line, "n") == 0)
break;
scanf("%d", &n_cases);
... | ALGO | 0.999709 | 4.050498 |
5c871257-7b39-4ac9-bd9a-e9ca6f765d0a | SZ-NPE/ValueSeparationTestEnv | terarkdb/third-party/terark-zip/3rdparty/boost-include/libs/algorithm/test/search_test3.cpp | #include <boost/algorithm/searching/boyer_moore.hpp>
#include <boost/algorithm/searching/boyer_moore_horspool.hpp>
#include <boost/algorithm/searching/knuth_morris_pratt.hpp>
#define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>
#include <ctime> // for clock_t
#include <iostream>
#include <fstream>
#incl... | TEST | 0.957577 | 6.017538 |
658f3c7e-5f47-4415-8ee2-abd4fd72b856 | yitianhao/gpu_sched_new | gpu-sched-centralcontrol/minor/boost_1_61_0/libs/graph/example/strong-components.cpp | int
main()
{
using namespace boost;
typedef adjacency_list < vecS, vecS, directedS > Graph;
const int N = 6;
Graph G(N);
add_edge(0, 1, G);
add_edge(1, 1, G);
add_edge(1, 3, G);
add_edge(1, 4, G);
add_edge(3, 4, G);
add_edge(3, 0, G);
add_edge(4, 3, G);
add_edge(5, 2, G);
std::vector<int> c(N... | ALGO | 0.989774 | 5.386024 |
63dab28b-2d45-4128-b272-0dbb7a97e2e5 | Blackfury7/LeetCode | 268-missing-number/268-missing-number.cpp | class Solution {
public:
int missingNumber(vector<int>& nums) {
int result = nums.size();
int i=0;
for(int num:nums){
result ^= num;
result ^= i;
i++;
}
return result;
}
}; | ALGO | 0.999955 | 5.796967 |
eaef13a2-f95f-4a87-a2db-93dc5b868c03 | Pooh1223/Online-Judge | CompetitiveProgramming/476.cpp | #include <bits/stdc++.h>
using namespace std;
long long num[100003];
int parse(string s){
s += " ";
string tmp = "";
int cnt = 0;
for(int i = 0;i < s.length();++i){
if(s[i] == ' '){
num[cnt] = stoll(tmp);
cnt++;
tmp = "";
} else {
tmp +=... | ALGO | 0.999759 | 3.786866 |
3d5ea3fb-2734-4e1c-91c8-ca9ebacb1c8e | daoanhkhoa123/Cpp_Basic | math_problem.cpp | #include <vector>
using namespace std;
int max3(const int x, const int y, const int z)
{
int k = x;
if (k < y)
{
k = y;
}
if (k < z)
{
k = z;
}
return k;
}
int maxSumRec(const vector<int> &a, const int left, const int right)
{
if (left == right) // base
{
... | ALGO | 0.999781 | 5.232787 |
b977ca00-f774-4535-af9e-225e27038af4 | aryans1319/LeetCode | longest-substring-without-repeating-characters/longest-substring-without-repeating-characters.cpp | class Solution {
public:
int lengthOfLongestSubstring(string s) {
int i=0,j=0;
int mx = 0;
unordered_map<char,int> memo;
while(j<s.length()){
memo[s[j]]++;
if(memo.size()<j-i+1){
while(memo.size()<j-i+1){
memo[s[i]]--;
if(memo... | ALGO | 0.999903 | 6.251851 |
ab24053b-aa56-488e-99a9-5f41e1cd09c1 | h-square/Periodic-Frequent-Pattern-Mining | fullMemory/parallel-pfp.cpp | #include <iostream>
#include <cassert>
#include <string>
#include <set>
#include <vector>
#include <map>
#include <algorithm>
#include <chrono>
#include <utility>
#include <fstream>
#include <sstream>
#include <omp.h>
#include "pftree.hpp"
using namespace std;
int TDB_SIZE = 0;
PFNode::PFNode(const Item& item, cons... | ALGO | 0.995189 | 5.975719 |
038c1e6f-597f-4fe7-8ee3-379b7e690273 | fremasadi/silalu | 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.998733 | 6.76775 |
cdcdb893-258c-4e7d-8538-f8902bc69a1b | mcatalan15/Cpp-Modules | intra_videos/Day_01/02_References/ref1.cpp | #include <iostream>
int main() {
int numberOfBalls = 42;
int *ballsPtr = &numberOfBalls;
int &ballsRef = numberOfBalls;
std::cout << numberOfBalls << " " << *ballsPtr << " " << ballsRef << std::endl;
*ballsPtr = 21;
std::cout << numberOfBalls << std::endl;
ballsRef = 84;
std::cout << numberOfBalls << std::... | TOOL | 0.930861 | 4.05669 |
59da2588-20e5-42b1-9e9a-7864852c5e59 | Aayush2302/CP | perfect_Numbers.cpp | #include<bits/stdc++.h>
using namespace std;
int divisor(int n){
set<int>num;
for(int i=1; i< n/2 ; i++){
if(n%i==0){
num.insert(i);
num.insert(n/i);
}else{
continue;
}
}
// sort(num.begin(),num.end());
int sum = 0;
for(auto n:num){
... | ALGO | 0.999923 | 4.33271 |
04e34a05-d9f0-452e-9ec1-a4c39dd261d9 | raincross7/code-similarity | codes/train_code/problem318/problem318_151.cpp | #include<bits/stdc++.h>
using namespace std;
#define nl cout<<'\n';
int main()
{
int p,q,r;
cin>>p>>q>>r;
cout<<min((p+q),min((p+r),(q+r)));
nl;
return 0;
}
| ALGO | 0.99974 | 3.780495 |
dc4f2fbe-af8f-4fd6-80ae-3334885fc02a | stefanieszabo/Reply-Recruiting-Test | rtScheduler.cpp | #include "rtScheduler.h"
/*
##########################
RECRUITING TEST
BACKEND ENGINEER INTERNET OF THINGS -- CONCEPT REPLY
Applicant: Stefanie SZABO
Test: Mobility on Demand
Date: 17.09. - 24.09.2018
Task: 3 (Scheduling Service Implementation)
##########################
Task Description
Design and implement a servi... | ALGO | 0.948495 | 5.115088 |
b65edbe4-8672-42f4-971d-926e5a71ecd1 | schmouk/ObjectGL | ObjectGL/external_libs/eigen-3.4.0/bench/perf_monitoring/trmv_up.cpp | #include "gemv_common.h"
EIGEN_DONT_INLINE
void trmv(const Mat &A, const Vec &B, Vec &C)
{
C.noalias() += A.triangularView<Upper>() * B;
}
int main(int argc, char **argv)
{
return main_gemv(argc, argv, trmv);
}
| ALGO | 0.972845 | 4.868302 |
4434c519-d5a6-472c-abc5-747654bfcff1 | Ilahe2007/Cpp_e-olymp_solutions | The minimum in queue.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
ll n,a,b,c,x,cem=0;
cin>>n>>a>>b>>c>>x;
queue<ll>q;
deque<ll>d;
for(ll i=1;i<=n;i++){
x=(a*x*x+b*x+c)/100%1000000;
if(x%5<2){
if(!q.empty()){
if(q.front()==d.front()){
d.pop_front();
}q.pop();
}
}else{
q.push... | ALGO | 0.998389 | 3.292041 |
5cd967ca-6e5b-4e76-b846-7e3d954e1f6d | varshap17/DSA | Stacks/maximum rectangular area in histogram.cpp | #include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution
{
public:
//Function to find largest rectangular area possible in a given histogram.
long long getMaxArea(long long arr[], int n)
{
stack <int> s;
long long area=0;
long long marea=0;
lo... | ALGO | 0.999741 | 6.604922 |
7f512d15-c7b4-4c55-aa81-7d83ae484fe7 | khurd21/Project-Euler | 11-20/14.cpp | /*
The following iterative sequence is defined for the set of positive integers:
n → n/2 (n is even)
n → 3n + 1 (n is odd)
Using the rule above and starting with 13, we generate the following sequence:
13 → 40 → 20 → 10 → 5 → 16 → 8 → 4 → 2 → 1
It can be seen that this sequence (starting at 13 and finishing at 1)
... | ALGO | 0.999994 | 6.042024 |
f93b2620-7975-4319-8b28-d23bb3003c96 | Hima0X2/number-theory | prime numbers.cpp | #include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const long long int mx = 1e7+123;
long long int a[mx];
int main()
{
optimize();
long long int n,i,j;
cin>>n;
//long long int i,j;
vector<long long int> v;
... | ALGO | 0.999923 | 3.606594 |
c71a5336-229b-4fdd-a775-a9ff03a22492 | gunisha30/datastructures | revstringcpp.cpp | #include <bits/stdc++.h>
using namespace std;
void solve(string &str)
{
stack <char> stk;
char c;
for (int i=0;i<str.length();i++)
stk.push(str[i]);
vector <char> temp;
while(stk.empty()!=1)
{
if(stk.top()!='.')
{
c=s... | ALGO | 0.999811 | 3.887836 |
f51f03f8-537a-446a-bde2-faf14d5b417e | ntrntr/leetcode | leetcode_cpp/leetcode/Kuchiguse.cpp | #include <vector>
#include <iostream>
#include <string.h>
#include <algorithm>
#include <string>
#include <map>
#include <stack>
#include <unordered_map>
#include <limits.h>
using namespace std;
int main()
{
int n;
cin >> n;
vector<string> f;
getchar();
string tmp;
int minlen = INT_MAX;
for (int i = 0; i < n; ++... | ALGO | 0.999916 | 4.408021 |
d38f8d6e-62c6-421d-bf85-1eaf666a03ac | starrykss/CPP_Study | 배열 숫자 분류.cpp |
/*
#include <iostream>
#define NUM 10
using namespace std;
int main()
{
int tmp, mark = 0, count = 1;
int ary[NUM];
int a[NUM], b[NUM];
cout << "Input " << NUM << " Numbers : ";
for (int i = 0; i < NUM; i++) {
cin >> ary[i];
}
// 1. 배열 정렬 (Sorting Array)
for (int i = 0; i < NUM - 1; i++) {
for (int j ... | ALGO | 0.999576 | 4.192291 |
853a5ed3-e6ca-4661-b008-0fc3d617b433 | tkir/goldenbyte2016 | libs/tmxloader/include/tmx/tmx2box2d.cpp | #include <tmx/tmx2box2d.h>
#include <Box2D/Dynamics/b2Body.h>
#include <Box2D/Collision/Shapes/b2CircleShape.h>
#include <Box2D/Collision/Shapes/b2PolygonShape.h>
#include <Box2D/Collision/Shapes/b2EdgeShape.h>
#include <Box2D/Collision/Shapes/b2ChainShape.h>
#include <cassert>
#include <array>
namespace
{
//this s... | TOOL | 0.852844 | 7.462502 |
6186187c-a97e-43ce-9d91-ada83feebde7 | yerass11/PP1-FALL-2022 | labka/10th lab/B (1).cpp | #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int a=0;
unsigned long long f(){
unsigned long long res=1;
for(int i=1;i<=a;i++){
res=res*a;
}
a++;
return res;
}
int main(){
int n;
cin >> n;
vector<unsigned long long > v(n+1);
generate(v.beg... | ALGO | 0.999922 | 3.86852 |
5d010b9d-67f2-4657-aa97-63abf542ba25 | VikasKumarRoy/Leetcode | Problem-131.cpp | //Problem - 131
// https://leetcode.com/problems/palindrome-partitioning/
// Passes all test cases O(2^n)
class Solution {
public:
bool isPalindrom(string s) {
int i = 0, n = s.length()-1;
while(i < n) {
if(s[i++] != s[n--])
return false;
}
retur... | ALGO | 0.999964 | 6.651216 |
befb847c-6ea2-406f-bff0-b945abc8c199 | 21P31A05A5/Codes | GFG/POTD/Search_Pattern_(KMP-Algorithm).cpp | vector <int> search(string pat, string txt)
{
int n=pat.size();
int m=txt.size();
vector<int>v;
string temp;
for(int i=0;i<m-n+1;i++)
{
string temp="";
if(txt[i]==pat[0])
{
... | ALGO | 0.999494 | 5.198664 |
f827a01d-4de7-4666-b926-2f841eeeeab4 | MomanRehman/oop | TicTacToe.cpp | //
// Created by Hp on 11/15/2020.
//
#include "TicTacToe.h"
#include<iostream>
using namespace std;
TicTacToe::TicTacToe() {
}
void TicTacToe::empty() {
for(int i=0;i<3;i++){
for(int m=0;m<3;m++){
board[i][m]=' ';
}
}
cout<<"Welcome To TicTacToe Game!!!!"<<endl;
}
void TicTacT... | ALGO | 0.934927 | 4.98081 |
c99ceb66-6a18-4c38-8c64-cc90ad5fec41 | Mukit09/UVA_Solution | 10842.cpp | #include<stdio.h>
#include<algorithm>
using namespace std;
long p[110],r[110],i,cost,u,v,n,e,t,k=1;
struct ss
{
long u,v,cost;
}T[10010];
bool cmp(ss aa,ss bb)
{
return aa.cost>bb.cost;
}
long find(long x)
{
if(p[x]==x)
return x;
else return p[x]=find(p[x]);
}
void link(long x,long y)
{
if(r[x]>=r[y])
p[y... | ALGO | 0.99993 | 3.966078 |
c76dc6e6-7205-4007-a782-a6eb096b655e | esl000/CustomUE4VolumeRaymarching | Engine/Source/ThirdParty/nvTextureTools/nvTextureTools-2.0.8/src/src/nvtt/squish/maths.cpp | #include "maths.h"
#include "simd.h"
#include <cfloat>
namespace squish {
Sym3x3 ComputeWeightedCovariance( int n, Vec3 const* points, float const* weights, Vec3::Arg metric )
{
// compute the centroid
float total = 0.0f;
Vec3 centroid( 0.0f );
for( int i = 0; i < n; ++i )
{
total += weights[i];
centroid += ... | ALGO | 0.999885 | 6.516203 |
a3578fd9-946d-4448-b19d-081693fc6bd9 | manas6699/All-Data-structures | tries/tries1.cpp | #include <bits/stdc++.h>
using namespace std;
class trieNode
{
public:
char data;
trieNode **bantu;
bool isTerminal;
trieNode(char data)
{
this->data = data;
bantu = new trieNode *[26];
for (int i = 0; i < 26; i++)
{
bantu[i] = NULL;
}
i... | ALGO | 0.999038 | 4.284012 |
46378ac3-6043-46c6-9b1c-f0a0b3429994 | FengQingDai/NORI | src/microfacet.cpp | NORI_NAMESPACE_BEGIN
// Beckmann normal distribution term
static float distributeBeckmann(const Vector3f &wh, float alpha) {
float tanTheta = Frame::tanTheta(wh);
float cosTheta = Frame::cosTheta(wh);
float a = std::exp(-(tanTheta * tanTheta) / (alpha * alpha));
float b = M_PI * alpha * alpha * std::po... | ALGO | 0.997121 | 7.842019 |
7cebb08a-ab7b-4ed4-b6ae-eca00da7e8f7 | ishandutta2007/codeforces | risujiroh/normal/377/D.cpp | #include <bits/stdc++.h>
class SegtreeBase {
public:
virtual int size() const = 0;
protected:
template <class F>
void forward(int l, int r, F f) const {
int h = h1(l += size() - 1, r += size());
for (int s = 0; s < h; ++s)
if (int i = l >> s; ~i & 1) f(i + 1);
for (int s = h; s--;)
if ... | ALGO | 0.999987 | 4.452011 |
fd6ecb6e-9700-4850-8d9a-2e36c521d595 | ishandutta2007/codeforces | maroonrk/normal/878/D.cpp | #include <bits/stdc++.h>
using namespace std;
using ll=long long;
//#define int ll
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define pb push_back
#define eb emplace_back
#define a first
#define b secon... | ALGO | 0.999934 | 4.210308 |
2bab03cd-75d8-4436-8daf-efa588dcd8f8 | ErikHupka/Definitely-Not-Sudoku_CS_Unity | Library/PackageCache/com.unity.ide.visualstudio@2.0.22/Editor/COMIntegration/COMIntegration~/COMIntegration.cpp | #include <iostream>
#include <sstream>
#include <string>
#include <filesystem>
#include <windows.h>
#include <shlwapi.h>
#include <fcntl.h>
#include <io.h>
#include "BStrHolder.h"
#include "ComPtr.h"
#include "dte80a.tlh"
constexpr int RETRY_INTERVAL_MS = 150;
constexpr int TIMEOUT_MS = 10000;
// Often a DTE call m... | TOOL | 0.94689 | 6.933211 |
a2a6d3a1-7ed1-4221-9ec5-e1a25ccfc095 | Seunghwan8334/Baekjoon-Practice | 12005.cpp | #include<stdio.h>
#include<algorithm>
using namespace std;
int a[10000];
int main() {
int n,k,ans=0;
scanf("%d %d", &n, &k);
for (int i=0; i<n; i++) scanf("%d", &a[i]);
sort(a, a+n);
int tmp = 0;
for (int i=0; i<n; i++) {
if (a[i]-a[tmp]>k) tmp++;
if (ans < i-tmp+1) ans = i-... | ALGO | 0.999969 | 3.970296 |
dcd124c3-cbc2-4328-88fc-ec66dacdb925 | mdsiaofficial/ProblemSolving | LeetCode/biweekly_contest_128/100279_Minimum_time_to_visit_disappearing_nodes.cpp | #include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
#define pi 3.14159
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define nl endl
#define ll long long
#define ld long double
#define ull unsigned long long
#define mod 90000007
#define fs(n) fixed<<setprecision(in... | ALGO | 0.999938 | 6.602757 |
2dbb1f16-6a15-47ba-826a-5400f84322e5 | bftjoe/Fairy-Stockfish | src/movepick.cpp | #include <cassert>
#include "movepick.h"
namespace Stockfish {
// Since continuation history grows quadratically with the number of piece types,
// we need to reserve a limited number of slots and map piece types to these slots
// in order to reduce memory consumption to a reasonable level.
int history_slot(Piece pc... | ALGO | 0.998054 | 7.810989 |
5b4e55b2-c4b6-4bb2-a927-96fe70540dd3 | 483759/AlgorithmSolutionStorage | C++/AlgorithmSolutionStorage/AlgorithmSeminar/1000/1149.cpp | #include <cstdio>
#include <algorithm>
using namespace std;
int n;
int check[1001][3];
int dp[1001][3];
int main() {
freopen("input.txt", "r", stdin);
scanf("%d", &n);
for (int i = 0; i < n; i++)
scanf("%d%d%d", &check[i][0], &check[i][1], &check[i][2]);
dp[0][0] = check[0][0]; dp[0][1] = check[0][1]; dp[0][2] = ... | ALGO | 0.999633 | 4.08847 |
c9ae3eed-f601-4f3d-9ed3-52fbdf9afc15 | ishandutta2007/codeforces | 1092515503/normal/149/D.cpp | #include<bits/stdc++.h>
using namespace std;
const int mod=1e9+7;
int mat[710],n,f[710][710][3][3],res;
char s[710];
stack<int>stk;
int main(){
scanf("%s",s+1),n=strlen(s+1);
for(int i=1;i<=n;i++){
if(s[i]=='(')stk.push(i);
else mat[stk.top()]=i,mat[i]=stk.top(),stk.pop();
}
for(int i=1;i<n;i++)if(mat[i]==i+1)f... | ALGO | 0.999967 | 3.785087 |
eeacc371-ba60-4c4b-94ed-89ad53b0a2e2 | acse-yp21/mpi_example | lecture3/solutions/solution1.cpp | #include <mpi.h>
#include <iostream>
#include <cstdlib>
#include <time.h>
using namespace std;
int id, p;
void bubble_sort(double* list, int* index, int num)
{
double temp;
bool swap;
do{
swap = false;
for(int i=0;i<num-1;i++)
{
if(list[i] > list[i+1])
{
... | ALGO | 0.999978 | 4.145338 |
442118a2-a7c3-4314-935b-9b4ac1c3d180 | npadmana/baorecon | src/tests/testCIC2.cpp | #include <iostream>
#include <cmath>
#include "Recon.h"
static char help[] = "A test program\n";
using namespace std;
int main(int argc, char *args[]) {
PetscErrorCode ierr;
ierr=PetscInitialize(&argc,&args,(char *) 0, help); CHKERRQ(ierr);
{
Particle pp;
Vec grid;
int lo, hi;
... | TEST | 0.876532 | 4.352272 |
3df8410b-258e-4d7a-b225-a9c0d428eb1c | ps06756/Leetcode-Practice-Problems | Cousins in binary tree/cousins in binary tree.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.999987 | 5.891981 |
831ba717-432d-4d4e-ac7c-30b6413283ff | matienzar/breathetoyou | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998859 | 6.785645 |
1e1fcc40-f16e-435c-ac9f-e50d539ef529 | lovemachune/CAD | cadb0093.cpp | #include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <math.h>
using namespace std;
struct Line{
double start_x, start_y, end_x, end_y;
};
struct Arc{
double start_x, start_y, end_x, end_y;
double center_x, center_y;
double radius;
bool direction;//CW = 0, CCW = 1;
... | DATA | 0.949258 | 4.009845 |
1b4f5d32-3609-4e61-84d7-961b895d3363 | Jackarain/avhttp | boost/libs/math/src/tr1/assoc_legendrel.cpp | extern "C" long double BOOST_MATH_TR1_DECL boost_assoc_legendrel BOOST_PREVENT_MACRO_SUBSTITUTION(unsigned l, unsigned m, long double x) BOOST_MATH_C99_THROW_SPEC
{
return (m&1 ? -1 : 1) * c_policies::legendre_p BOOST_PREVENT_MACRO_SUBSTITUTION(l, m, x);
}
| TOOL | 0.979642 | 4.163469 |
758ce38b-92d0-404a-9267-fa4548f1028f | softbankrobotics-research/dmpbbo | src/dynamicalsystems/ExponentialSystem.cpp | /**
* @file ExponentialSystem.cpp
* @brief ExponentialSystem class source file.
* @author Freek Stulp
*
* This file is part of DmpBbo, a set of libraries and programs for the
* black-box optimization of dynamical movement primitives.
* Copyright (C) 2014 Freek Stulp, ENSTA-ParisTech
*
* DmpBbo is free sof... | ALGO | 0.899772 | 5.972495 |
e79aab6c-f292-4048-b76e-90aa6a3b7c22 | eklavyaK/codeforces-solutions | AquamoonAndStrangeSort.cpp | #include<bits/stdc++.h>
#define mod2 998244353ll
#define mod1 1000000007ll
#define removezeros(s) s.erase(0,s.find("1")!=-1?s.find("1"):s.length()-1)
#define binary(n,k) bitset<k>(n).to_string()
#define makeset(s,c,sizeofc) for(int i = 0; i<sizeofc; i++){s.emplace_back(c[i]);while(i+1<sizeofc && c[i+1]==c[i])i++;}
type... | ALGO | 0.999884 | 4.343675 |
e31059d0-7044-412a-8fea-2b08322c9744 | Kartikey-Kabdwal/LeetCode-Solutions-by-Kartikey | 852-peak-index-in-a-mountain-array/852-peak-index-in-a-mountain-array.cpp | class Solution {
public:
int peakIndexInMountainArray(vector<int>& a) {
int n=a.size();
for(int i=1;i<n-1;i++)
{
if(a[i]>a[i+1] and a[i]>a[i-1])
{
return i;
}
}
return -1;
}
}; | ALGO | 0.99999 | 5.463295 |
b5317b88-d36f-43fc-a484-c268399b127c | sinhadityaforever/data_structures_algorithms | 155-min-stack/155-min-stack.cpp | class MinStack {
public:
stack<pair<int, int>> st;
MinStack() {
}
void push(int val) {
if(!st.empty()){
int lastMin = st.top().second;
if(val<lastMin){
st.push({val, val});
}
else{
st.push({va... | ALGO | 0.999874 | 6.59643 |
c65f55a2-321e-4a22-bfb0-155b3f18a84e | performeru/Baekjoon-Programmers | 프로그래머스/2/12909. 올바른 괄호/올바른 괄호.cpp | #include<string>
#include <iostream>
#include <stack>
using namespace std;
bool solution(string s)
{
stack<char> str;
for (char ch : s)
{
if (ch == '(')
{
str.push(ch);
}
else if (ch == ')')
{
if (str.empty())
{
... | ALGO | 0.99628 | 5.526616 |
08f8f42d-df0e-4648-a265-2c9e8d80ccee | hellascrypto/hellascoin-v2 | src/rpcnet.cpp | #include "net.h"
#include "bitcoinrpc.h"
using namespace json_spirit;
using namespace std;
Value getconnectioncount(const Array& params, bool fHelp)
{
if (fHelp || params.size() != 0)
throw runtime_error(
"getconnectioncount\n"
"Returns the number of connections to other nodes.");
... | WEB | 0.926101 | 6.646237 |
d7f58336-2739-45b8-aaf1-4519075c9c41 | sprainsc0/SPRainNode_CAN | src/sensor_gps/device/sbf.cpp | /**
* @file sbf.cpp
*
* Septentrio protocol as defined in PPSDK SBF Reference Guide 4.1.8
*
* @author Matej Frančeškin <<EMAIL>>
*
*/
#include "sbf.h"
#include <stdio.h>
#include <string.h>
#include <math.h>
#define SBF_CONFIG_TIMEOUT 500 // ms, timeout for waiting ACK
#define SBF_PACKET_TIMEOUT 2 ... | TOOL | 0.887071 | 5.416939 |
0cce6691-8c57-44d7-ac28-54d2474cb746 | fatima4445/PD-LAB-3 | task6.cpp | #include <iostream>
using namespace std;
main(){
cout<<"enterthe size of fertillizer bag in pounds:";
int cost,area,cop,cps, size;
cin>>size;
cout<<"enter the cost of the bag :$";
cin>> cost;
cout<<"enter area in square feet that can be covered by the bag:";
cin>>area;
cop = cost/size;
cout<<"cost of fertilizer per pou... | ALGO | 0.98248 | 3.960407 |
cf0df6bc-14a9-4847-86aa-0289d318b7d7 | ytsaurus/ytsaurus-cpp-sdk | contrib/libs/icu/common/ucharstrie.cpp | #include "unicode/utypes.h"
#include "unicode/appendable.h"
#include "unicode/ucharstrie.h"
#include "unicode/uobject.h"
#include "unicode/utf16.h"
#include "cmemory.h"
#include "uassert.h"
U_NAMESPACE_BEGIN
UCharsTrie::~UCharsTrie() {
uprv_free(ownedArray_);
}
UStringTrieResult
UCharsTrie::current() const {
... | ALGO | 0.962592 | 7.54039 |
fe444f63-1cde-411f-814a-a38db506ada7 | Ashish-Chokhani/Competitive_Programming | Codeforces/979/E.cpp | #include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define f first
#define s second
#define getunique(v) {sort(v.begin(), v.end()); v.erase(unique(v.begin(), v.end()), v.end());}
#define all(x) (x).begin(), (x).end()
#define int long long int
typedef long double lld;
typedef unsigned long long ull;
const i... | ALGO | 0.999877 | 4.206141 |
1eafe740-2618-450c-b635-c42857867948 | SWAGATSWAROOP/LeetCode | 0207-course-schedule/0207-course-schedule.cpp | class Solution {
public:
bool canFinish(int n, vector<vector<int>>& prerequisites) {
vector<vector<int>> G(n);
vector<int> degree(n, 0), bfs;
for (auto& e : prerequisites)
G[e[1]].push_back(e[0]), degree[e[0]]++;
for (int i = 0; i < n; ++i) if (!degree[i]) bfs.push_ba... | ALGO | 0.999818 | 6.630509 |
859b2e93-8b05-441d-86b1-934f771af1e0 | RiyanAstriWijaya/alpro-dasar | Modul 1 Program/3.cpp | #include <iostream>
using namespace std;
int main () {
int hasil,a,b;
cout<<"masukkan nilai a:" ;
cin>>a;
cout<<"masukkan nilai b:" ;
cin>>b;
hasil= a*b;
cout<<hasil;
}
| TOOL | 0.917668 | 3.545799 |
725907ce-5b81-4fa4-9571-69050e312142 | fatrolls/Codility-Solutions | sol8.cpp | #include "StdAfx.h"
#if 0
#define MAX_LENGTH 300007
#define MAX_LENGTH_SIZE (sizeof(int) * MAX_LENGTH)
#define NON_ISLAND_VAL (-10)
int LongestIsland;
int IslandCount;
int IslandStarts[ MAX_LENGTH ];
int N;
int LongestIslandIndex;
void ConvertIslandFormat( char *S, int *IsIsland )
{
int i = 0;
... | ALGO | 0.99955 | 3.73446 |
47006f92-6a61-4a05-9ab6-516b49f85920 | subanahian/C- | N_Convert_to_Base.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int T;
cin >> T;
if (T == 1) {
string N;
int X;
cin >> N >> X;
int result = 0;
for (int i = 0; i < N.length(); i++) {
char c = N[i];
int value;
if (c >= '0' && c <= '9') ... | ALGO | 0.998821 | 5.755708 |
e83214ab-1a60-4209-9c02-272db108af18 | felipesdias/Extractor-URI-Online-Judge | URI-EN/AD-HOC/1547 - Guess What.cpp | // Author: Felipe Souza Dias <<EMAIL>>
// Name: Guess What
// Level: 1
// Category: AD-HOC
// URL: https://www.urionlinejudge.com.br/judge/en/problems/view/1547
#include <cstdio>
int abs(int n) {
return n < 0 ? -1*n : n;
}
int main () {
int n, nAlunos, numSecreto, alunoGanhador, alunoAtual, chute, chuteGanhador;
... | ALGO | 0.999818 | 4.145916 |
aa41b204-462b-4c34-854d-971fe4d26c04 | lucienyoung/mapping-positioning-ros | VINS-RGBD/pose_graph/src/ThirdParty/DVision/BRIEF.cpp | #include "BRIEF.h"
#include "../DUtils/DUtils.h"
#include <boost/dynamic_bitset.hpp>
#include <vector>
using namespace std;
using namespace DVision;
// ----------------------------------------------------------------------------
BRIEF::BRIEF(int nbits, int patch_size, Type type):
m_bit_length(nbits), m_patch_size(... | ALGO | 0.98669 | 5.876971 |
b454b993-e3ba-469c-8c8d-1d4a633a2ffe | Husain0007/HackerBlocks | Today'sCodeByte/FormBiggestNumber/p.cpp | /*
Compiled and run on https://ide.codingblocks.com
*/
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int compare(int x, int y)
{
string a = to_string(x);
string b = to_string(y);
string ab = a.append(b);
string ba = b.append(a);
return ab.compare(ba) > 0 ? 1 ... | ALGO | 0.999707 | 4.759717 |
914c7b94-b3bf-4f65-8beb-70eaf13d6797 | pawan-vishwakarma/LeetCode-Problems | arrayEasy/productOfArray.cpp | class Solution {
public:
vector<int> productExceptSelf(vector<int> nums) {
int n = nums.size() ;
int p =1 ;
vector<int> ans(n,1) ;
for(int i = 0 ;i<n ;i++){
ans[i] = p;
p = p*nums[i] ;
}
p =1 ;
for(int... | ALGO | 0.999961 | 6.245729 |
d2e02b90-9ba2-4114-b530-8c7e48576753 | p1kalys/Leetcode-DSA-Vault | 0004-median-of-two-sorted-arrays/0004-median-of-two-sorted-arrays.cpp | class Solution {
public:
double findMedianSortedArrays(vector<int>& nums1, vector<int>& nums2) {
int n1 = nums1.size();
int n2 = nums2.size();
if(n1>n2) return findMedianSortedArrays(nums2,nums1);
int low = 0,high = n1;
int left = (n1+n2+1)/2;
int n = n1+n2;
w... | ALGO | 0.999992 | 6.146803 |
3c3fcdd4-1db0-44de-8108-108905be66c1 | yashtekade21/LeetCode_Solved | 3405_Count_the_Number_of_Arrays_with_K_Matching_Adjacent_Elements.cpp | const int MOD = 1e9 + 7;
vector<long long> fact;
vector<long long> fermatFact;
class Solution {
public:
int countGoodArrays(int n, int m, int k) {
calcFactorial(n);
calcInverseFactorial(n);
int ans = (nCr(n - 1, k) * m) % MOD;
ans = (ans * power(m - 1, n - k - 1)) % MOD;
re... | ALGO | 0.999984 | 5.249317 |
dcedd20d-0661-461b-9bee-52cc8f1524ed | QuICC/EPMDynamoCode | src/Simulations/Implementations/ThermalConvectionSimulation.cpp | /** \file ThermalConvectionSimulation.cpp
* \brief Implementation of a thermal convection simulation
*/
// Configuration includes
//
// System includes
//
// External includes
//
// Class include
//
#include "Simulations/Implementations/ThermalConvectionSimulation.hpp"
// Project includes
//
#include "BoundaryC... | ALGO | 0.990044 | 7.250042 |
1f030b18-b306-4d1f-bf94-0a82be497641 | Kartikey-Kabdwal/LeetCode-Solutions-by-Kartikey | 413-arithmetic-slices/413-arithmetic-slices.cpp | class Solution {
public:
int numberOfArithmeticSlices(vector<int>& a) {
int ans=0;
int cnt=0;
for(int i=1;i<a.size()-1;i++)
{
if(a[i-1]-a[i]==a[i]-a[i+1])
ans++;
else
ans=0;
cnt+=ans;
}
return cnt;
}
}; | ALGO | 0.999841 | 6.006001 |
01802034-96a7-480c-bf5c-58600899c622 | memaskal/ceid-projects | Data-Structures/ProjectDomes2015/AVLSearches.cpp | #include "AVLSearches.h"
#define max(a,b) (((a)>(b))?(a):(b))
/**
* Constructor, attaches objserver to subject
**/
AVLSearches::AVLSearches(DataHandler *data) {
subject = data;
subject->attach(this);
size = 0;
root = NULL;
}
/**
* Destroys the structure
**/
AVLSearches::~AVLSearches() {
deleteTree(root);
}
/*... | ALGO | 0.973417 | 4.413628 |
8d884787-8a29-4ff6-853b-bdec329470c0 | ik07onkar/CodeForces | Kefa and First Steps.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
ll n, max_till_now = 0, cnt = 0;
cin>>n;
ll a[n];
for(ll i=0; i<n; i++)
cin>>a[i];
for(ll i=0; i<n; i++)
{
max_till_now = max(max_till_now, cnt);
if(a[i] <= a[i+1])
cnt++;
... | ALGO | 0.999966 | 3.873289 |
97bc27a9-176f-4ee2-a4a4-f4a35e9f8809 | kushantgarg/Linked-List-Basic-to-Advance-questions | detectloopinlinklist.cpp | //detect loop in link list using 3 methods
#include<bits/stdc++.h>
using namespace std;
class Node{
public:
Node*next;
int data;
};
//first method to find the loop using hashing
bool detectloop(Node *head)
{
unordered_set<Node*>s;
while(head!=NULL)
{
if(s.find(head)!=s.end())
{
return true;
}
s.in... | ALGO | 0.999933 | 4.524632 |
a07ad890-a6e5-4b50-b74c-29fb8d4fe966 | MuhammadAhmadA01/Leetcode-challenges | 2576-minimum-penalty-for-a-shop/minimum-penalty-for-a-shop.cpp | class Solution {
public:
int bestClosingTime(string customers) {
int max=INT_MIN;
int profit=0;
int idx=0;
for(int i =0;i<customers.length();i++)
{
if(customers[i]=='Y')
{
profit++;
if(profit>max && profit>0)
{
... | ALGO | 0.999814 | 5.755318 |
11120a0e-7304-48f8-a13f-512c626b4f50 | aditya-kr86/OOP-s-Lab | Assignment 25-02-2025/q5.cpp | // Write a C++ Program to calculate Factorial of a Number Using Recursion
#include <iostream>
using namespace std;
int factorial(int number)
{
if (number == 0)
{
return 1;
}
else
return number * factorial(number - 1);
}
int main()
{
int number;
cout<<"Enter a Number of Which You... | ALGO | 0.999916 | 5.113667 |
eb787c88-9af4-47b7-a12f-d72ee7b2cad3 | ishandutta2007/codeforces | zhoushang2003/normal/1591/A.cpp | #include<bits/stdc++.h>
using namespace std;
#define int long long
const int N=1e6,I=1e9;
int t,n,a[N],A;
signed main()
{
cin>>t;
while(t--&&cin>>n)
{
for(int i=1;i<=n;i++)
cin>>a[i];
A=a[1]+1;
for(int i=2;i<=n;i++)
if(!a[i]&&!a[i-1])
A=-I;
else if(a[i]&&!a[i-1])
A++;
else if(a[i]&&a[i-1])
... | ALGO | 0.999793 | 4.028279 |
8652ac52-6f32-4e24-bfdf-303ac2bb28dd | YAMINISARIKI/DATA_STRUCTURES-OWLCODING- | BFS_Graph.cpp | #include<bits/stdc++.h>
using namespace std;
void bfs(int n,vector<bool>&visited,vector<int>adj[])
{
queue<int>q;
visited[n] = true;
q.push(n);
while(!q.empty())
{
int x = q.front();
cout<<x<<" ";
q.pop();
for(auto i:adj[x])
{
if(!visited[i])
... | ALGO | 0.99999 | 4.459703 |
03865406-c493-4aaf-a81d-1e6c1330bf51 | magician2/api_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 |
c2e11e07-db87-4b35-af34-6d4d10e2a163 | irondeveloper321/pci | FHEOffline/DistDecrypt.cpp |
#include "DistDecrypt.h"
#include "FHE/P2Data.h"
template<class FD>
DistDecrypt<FD>::DistDecrypt(const Player& P, const FHE_SK& share,
const FHE_PK& pk, const FD& FTD) :
P(P), share(share), pk(pk), mf(FTD), f(FTD)
{
vv.resize(pk.get_params().phi_m());
vv1.resize(pk.get_params().phi_m());
// extra limb f... | ALGO | 0.991434 | 4.840469 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.