uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
48b0e7c1-3e2a-4f6d-9ea7-a414eeabc9e0 | diogocecilio/neopz-master | Shape/TPZShapeHDivConstant.cpp | #include "TPZShapeHDivConstant.h"
#include "TPZShapeHCurlNoGrads.h"
#include "TPZShapeH1.h"
#include "pzshapelinear.h"
#include "pzshapetriang.h"
#include "pzshapequad.h"
#include "pzshapetetra.h"
#include "pzshapecube.h"
#include "pzshapeprism.h"
#include "pzshapepiram.h"
#include "pzgeoel.h"
#include "pzgnode.h"
#i... | ALGO | 0.927885 | 4.696409 |
c156e756-68ca-45ab-acd0-01152ae29dd7 | manhtung001/cpp_PTIT | 2_BCNN-UCLN.cpp | #include <iostream>
using namespace std;
long long gcd(long long a, long long b){
if (b == 0){
return a;
}
return gcd(b, a % b);
}
int main(){
int t;
cin >> t;
while (t--) {
long long a,b;
cin >> a >> b;
long long lcm = a * b / gcd(a, b);
cout << lc... | ALGO | 0.999929 | 5.13851 |
f72d0d27-9d9f-41ea-bf40-36b770413287 | prisrv/prisrv | Algorithm/MIRACL/ecn2.cpp | /*
* MIRACL C++ Implementation file ecn2.cpp
*
* AUTHOR : M. Scott
*
* PURPOSE : Implementation of class ECn2 (Elliptic curves over n^2)
*
* WARNING: This class has been cobbled together for a specific use with
* the MIRACL library. It is not complete, and may not work in other
* applications
*... | TOOL | 0.930522 | 5.237745 |
bb58189d-5a0d-4d27-9b00-67715d5750a8 | maxjerebko/C | LR10/main.cpp | #include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
int main() {
const int m = 4; // Кількість рядків
const int n = 3; // Кількість стовпців
int array[m][n]; // Двовимірний масив
// Ініціалізація генератора випадкових чисел
srand(static_cast<unsigned int>(time(0)));
... | ALGO | 0.995817 | 5.349886 |
a5d918e3-2bea-4ecb-9aaf-0ce51b26946c | biTLegi0n/DSA-Codes-w-Explanation | IB_Bookmarks/Dp/Evaluate_Exp_toTRUE.cpp | #include <bits/stdc++.h>
using namespace std;
/**
@brief Well, this is not my code. I copied this one from fatty's id. Now in this problem, we maintain a 3d dp table, that
stores the dp of i,j(well, i and j are sort of pointers that tell us which part is to be considered) with their fact
i... | ALGO | 0.999992 | 4.871867 |
01af3fd8-031f-4eff-965c-9f30ac00525f | Severus25/100-Days-Of-Code-Challenge | Day 71 Code - Sort the Matrix Diagonally.cpp | // Problem Statement:
// https://leetcode.com/problems/sort-the-matrix-diagonally/
// Problem Solution:
class Solution {
public:
vector<vector<int>> diagonalSort(vector<vector<int>>& mat)
{
for(int k = 0; k + 1 < mat.size(); k++)
for(int i = 0; i + 1 < mat.size(); i++)
for... | ALGO | 0.999989 | 6.388458 |
5a2babc8-bbc1-4369-9a28-0f7cbd053b7e | ZhZhuang/demo_cpp_basic | LeetCode-Hot-100/tree/pathSum.cpp |
//437. 路径总和 III
//路径 不需要从根节点开始,也不需要在叶子节点结束,但是路径方向必须是向下的(只能从父节点到子节点)。
//https://blog.csdn.net/qq_17550379/article/details/82284240
//区别于
//Leetcode 112:路径总和(最详细的解法!!!)
//Leetcode 113:路径总和 II(最详细的解法!!!)
// 方法一:暴力
// 方法二:前缀和 hashmap
#include <unordered_map>
using namespace std;
struct TreeNode{
int val;
Tre... | ALGO | 0.999966 | 5.825451 |
595f9f64-8f52-4d55-b328-371565360a6c | hfinkel/llvm-project-cxxjit | clang/tools/clang-check/ClangCheck.cpp | #include "clang/AST/ASTConsumer.h"
#include "clang/CodeGen/ObjectFilePCHContainerOperations.h"
#include "clang/Driver/Options.h"
#include "clang/Frontend/ASTConsumers.h"
#include "clang/Frontend/CompilerInstance.h"
#include "clang/Rewrite/Frontend/FixItRewriter.h"
#include "clang/Rewrite/Frontend/FrontendActions.h"
#in... | TOOL | 0.884577 | 7.657917 |
5e51343b-9a12-4502-8601-8be6e6708f43 | lchacin/leetcodeQuestions | NumberSubArraysOddSum.cpp | /*
Number of Sub-arrays With Odd Sum
Given an array of integers arr, return the number of subarrays with an odd sum.
Since the answer can be very large, return it modulo 109 + 7.
Constraints:
1 <= arr.length <= 105
1 <= arr[i] <= 100
*/
#include<iostream>
#include<vector>
#include<numeric>
int numOfSubarrays(st... | ALGO | 0.999929 | 5.619875 |
97197802-e611-4135-bf16-6c3c1a6f63f8 | Priyanshu4650/Daily-Problems-LeetCode | 155-min-stack/min-stack.cpp | class MinStack {
stack<int> st, minStack;
public:
MinStack() {}
void push(int val) {
st.push(val);
if (minStack.empty() || val <= minStack.top()) {
minStack.push(val);
}
}
void pop() {
if (st.top() == minStack.top()) {
minStack.pop()... | ALGO | 0.998937 | 6.817107 |
460bf2dc-59a1-424a-b13a-513abf1c0426 | FelixMatrixx/23521215_23521704_23521494_23521821_23521208_23521327_BT03 | Bai142/Bai142.cpp | #include <iostream>
#include <iomanip>
using namespace std;
void Nhap(float[], int&);
void Xuat(float[], int);
void HoanVi(float&, float&);
void DuongTang(float[], int);
int main()
{
float b[500];
int k;
Nhap(b, k);
cout << "Mang da nhap la: ";
Xuat(b, k);
cout << "\nSau sap xep: ";
DuongTang(b, k);
Xuat(b, k... | ALGO | 0.999927 | 3.281753 |
3a7d2d6d-bfe3-4792-bfec-9384ada692b9 | Hangalik/advent-of-code | 2021/day-04/main.cpp | #include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <vector>
#include "input_selector.h"
void printVector(const std::vector<int> ints) {
for (int i : ints) {
std::cout << i << ", ";
}
std::cout << std::endl;
}
std::vector<int> getRandomNumbers(std::istream& in) {
std::string ra... | ALGO | 0.984582 | 4.805187 |
7ef5e531-fbfa-40d2-b9a3-942a3acba9b9 | NandiSoham/Leetcode-POTD-Daily-Coding-Challenge | Year 2025/05_May/day17_75. Sort Colors.cpp | // Problem link -> https://leetcode.com/problems/sort-colors/description/
class Solution {
public:
void sortColors(vector<int>& nums) {
int count_0 = 0, count_1 = 0, count_2 = 0;
for(int i = 0; i < nums.size(); i++){
if(nums[i] == 0) count_0++;
else if(nums[i] == 1) count_1+... | ALGO | 0.999889 | 6.158935 |
7e8fd287-3e0c-4f3f-bf03-82a6679e19de | kantram7/coursera_c-plus-plus-red-belt | week-1/Deque/deque.cpp | #include <iostream>
#include <vector>
#include <exception>
using namespace std;
template <class Item>
class Deque {
public:
Deque() = default;
bool Empty() const {
return (start.empty() && end.empty());
}
size_t Size() const {
return (start.size() + end.size());
}
Item& operato... | TOOL | 0.927386 | 5.405253 |
a0f77918-5a26-4467-9bf3-a9eee85cb205 | masterSahil/DSA | Oops/Categorizing/main.cpp | #include<iostream>
#define MAX 100
using namespace std;
class Project {
private:
int size = 0;
int arr[MAX];
public:
void input_array();
void display();
void selection_sort();
void linear_search();
void binary_search();
void merge(int [], int, int, int);
void merge_sort(int [], int... | ALGO | 0.999881 | 4.732323 |
115ab26a-37fd-455c-a104-f91e3134a6b3 | RinCloud/TrickCatcher | Datasets/TrickyBugs/GenProgs/tc_generated_progs_cpp/p03331/p03331_num9_parsed.cpp | #include <iostream>
using namespace std;
int main() {
int N;
cin >> N;
int sum =0;
if(N % 10 !=0){
while(N>0) {
sum += N % 10;
N /= 10;
}
}
else sum = 1; // Changed from 10 to 1
cout << sum << endl;
}
| ALGO | 0.999659 | 4.716841 |
d8d4237a-5683-43a5-a9af-c4cf12571806 | metehkaya/Algo-Archive | Problems/LeetCode/Solutions/1838.Frequency_of_the_Most_Frequent_Element.cpp | #define pb push_back
typedef long long LL;
class Solution {
public:
int maxFrequency(vector<int>& ar, int k) {
int n = ar.size();
sort(ar.begin(),ar.end());
vector<LL> sum;
sum.pb(0);
for( int i = 0 ; i < n ; i++ )
sum.pb(sum[i]+ar[i]);
int ans = 0;
... | ALGO | 0.999945 | 5.470942 |
8bd36fc8-e160-4708-8666-a70ba175ea32 | jirol9xa/algorithms | leet-code/240.cpp | #include <iostream>
#include <vector>
using namespace std;
class Solution {
public:
bool searchMatrix(const vector<vector<int>> &matrix, int target)
{
int begin = 0, end = matrix.size() - 1;
while (begin < end) {
int mid = (begin + end + 1) / 2;
if (matrix[mid][0] <= ... | ALGO | 0.999884 | 6.140077 |
942b57fb-33d9-4cb1-92f4-a92b80b4f855 | ForestSquirrel/MexWrapper-for-CUDABifurcation-3.0 | MEXWrappers/bifurcation1DForHMEXWrapper.cpp | #include "mex.h"
#include "..\Library\hostLibrary.cuh"
#include <stdio.h>
#include <iomanip>
#include <ctime>
#include <conio.h>
#include <iostream>
#include <sstream>
#include <fstream>
#include <vector>
#include <string>
#define OUT_FILE_PATH "D:\\CUDABifurcation3.0\\MatlabScripts\\CUDA_OUT\\mat.csv"
// Helper fun... | ALGO | 0.998931 | 6.128934 |
5d516bd5-4ddd-4e06-b50f-2a9f0504847c | QQHEZhangyubin/JNIStudy | AnkerEngine/src/main/cpp/sliceservice/libs/arm64-v8a/icu/source/tools/toolutil/ppucd.cpp | #include "unicode/utypes.h"
#include "unicode/uchar.h"
#include "charstr.h"
#include "cstring.h"
#include "ppucd.h"
#include "uassert.h"
#include "uparse.h"
#include <stdio.h>
#include <string.h>
U_NAMESPACE_BEGIN
PropertyNames::~PropertyNames() {}
int32_t
PropertyNames::getPropertyEnum(const char *name) const {
... | TOOL | 0.865422 | 6.241901 |
ca57e3ec-d3b8-481c-bed2-8c716be7b8d9 | Hi5App/BrainTellServer | thirdparty/CollServerWithDBMS/colldetection.cpp | #include "colldetection.h"
#include "coll_server.h"
#include "sort_swc.h"
#include <iostream>
#include <vector>
#include "detect_crossing/utilities.h"
#include "detect_crossing/SwcReader.h"
#include <mutex>
#include <filesystem>
#include "detect_crossing/CrossingDetect.h"
#include "detect_crossing/ResultWriter.h"
#incl... | ALGO | 0.946384 | 3.539313 |
a8432125-0d62-433a-843b-2a24346283d9 | Gautam-2002/GFG_ques | largestElementInArray.cpp | // { Driver Code Starts
//Initial Template for C++
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
//User function Template for C++
class Solution
{
public:
int largest(vector<int> &arr, int n)
{
int max=INT_MIN;
for(int i=0;i<n;i++){
if(arr[i]>max){
... | ALGO | 0.999869 | 6.320872 |
596da507-8e0d-44a5-8558-782e418fbfaf | mushkul/Vanderbilt-CP | solutions/claude-3-5-sonnet-20241022/1144.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
struct Query {
char type;
int k, a, b;
};
int main() {
ios::sync_with_stdio(0); cin.tie(0);
int n, q;
cin >> n >> q;
vector<int> p(n);
vector<Query> queries(q);
set<int> coords;
for(int i = 0; i < n; i++) {
... | ALGO | 0.999715 | 4.323767 |
fe138f92-079e-4da1-acec-827bda9666cf | WashizuRyo/Competitive-programming | ABS/abc376/c.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
using P = pair<int, int>;
using ll = long long;
int main() {
int n;
cin >> n;
vector<int> a(n), b(n - 1);
rep(i, n) cin >> a[i];
rep(i, n - 1) cin >> b[i];
sort(a.begin(), a.end());
sort(b.begin(), b.end());
... | ALGO | 0.999966 | 3.725749 |
0cd20c92-f32e-47af-8e88-e6db8e862ae1 | trandoduy28072004/MyCode | SortingAlgorithms/counting-sort.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n, a[10000];
cin >> n;
memset(a, 0, sizeof(a));
int max = INT_MIN;
for (int i = 1; i <= n ; i++)
{
int x;
cin >> x;
a[x]++;
if (max < x) max = x;
}
for (int i = 1; i <= ... | ALGO | 0.999977 | 3.505368 |
da1a2bf8-eac6-44eb-9b11-1f1a8daf350d | ShubhamKapil04/Placement | Pattern And loops/Upperandlower.cpp | #include<iostream>
using namespace std;
int main(){
char ch;
cout << "Enter the Character" ;
cin >> ch;
if (ch >= 65 && ch <= 90)
{
cout << "The character is Upper case "<< ch << endl;
}
else if (ch >= 97 && ch <= 122)
{
cout << "The Character is Lower case "<< ch << e... | ALGO | 0.988096 | 3.460723 |
46c50c0b-45c7-42d4-95d2-c01a9fc80794 | uxdxdev/bullet-dominos | Bullet/src/BulletCollision/CollisionShapes/btConvexTriangleMeshShape.cpp | #include "btConvexTriangleMeshShape.h"
#include "BulletCollision/CollisionShapes/btCollisionMargin.h"
#include "LinearMath/btQuaternion.h"
#include "BulletCollision/CollisionShapes/btStridingMeshInterface.h"
btConvexTriangleMeshShape ::btConvexTriangleMeshShape (btStridingMeshInterface* meshInterface, bool calcAabb)
... | ALGO | 0.973599 | 7.530622 |
ac9e16b0-1536-459b-9186-0ffb377f8b68 | Hephaestus14089/c- | Queues/Circular.cpp | #include<iostream>
using namespace std;
class Queue {
int size;
int *arr;
int start;
int end;
public:
Queue(int max) {
size = max;
arr = new int[size];
start = 0;
end = -1;
}
void enqueue(int n) { arr[ ++end % size ] = n;... | ALGO | 0.883188 | 4.238295 |
c65ef25d-8a78-40dd-8e1f-35915e9772c8 | naumazeredo/competitive-programming | gym/damascus-2018/d.cpp | // @subject:
// @diff:
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
std::mt19937_64 rng((int) std::chrono::... | ALGO | 0.999775 | 3.959493 |
30d71f61-dedd-4625-9b59-1aabf063c4ed | jifunzesasa/cpp-examples | 7_sorting/quick_sort.cpp | /**
program: Quick Sort Algorithm
*/
#include <iostream>
void PrintArray(int *array, int n)
{
for (int i = 0; i < n; ++i)
std::cout << array[i] << " " << std::flush;
std::cout << std::endl;
}
inline void Swap(int &a, int &b)
{
int k = a;
a = b;
b = k;
}
//reload rand to produce random... | ALGO | 0.99996 | 4.946994 |
6ed70e7c-097a-41f7-9fa5-267a360e5791 | bpru/faceoff | boost_1_62_0/libs/math/example/inverse_chi_squared_bayes_eg.cpp | // inverse_chi_squared_bayes_eg.cpp
// This file is written to be included from a Quickbook .qbk document.
// It can still be compiled by the C++ compiler, and run.
// Any output can also be added here as comment or included or pasted in elsewhere.
// Caution: this file contains Quickbook markup as well as code
// and... | ALGO | 0.998181 | 5.09631 |
a84b5c74-9edf-4d89-83f0-254d40f4c275 | Ho-Holic/flappy-cat | app/src/main/jni/engine/physics/VectorMath.cpp | // engine
#include "VectorMath.h"
// stl
#include <cmath>
#include <algorithm>
Position::value_type VectorMath::dot(const Position& a, const Position& b) {
return a.x() * b.x() + a.y() * b.y();
}
Position::value_type VectorMath::distance(const Position& a, const Position& b) {
return std::sqrt((a.x() - b.x()) *... | ALGO | 0.99557 | 5.783631 |
b0a78940-4440-4e58-b7c7-2bc3d25047d6 | fardinkhan69/xpsc-problem-solving | week5/Day3/Permutation_Mod_K.cpp | #include <bits/stdc++.h>
using namespace std;
void solve() {
int n, k;
cin >> n >> k;
if (k == 1) {
cout << -1 << endl;
return;
}
vector<int> ans(n + 1);
vector<bool> used(n + 1, false);
//sob gula one by one position check kore dekhi ki hoy
for (int i = 1; i <= n; ++i... | ALGO | 0.999907 | 4.931197 |
c88e9b92-55fb-4472-9c65-7bc25bf95ad4 | kanishkachaudhary-03/flight-management-system- | boost_1_88_0/libs/bimap/example/mighty_bimap.cpp | // VC++ 8.0 warns on usage of certain Standard Library and API functions that
// can be cause buffer overruns or other possible security issues if misused.
// See https://web.archive.org/web/20071014014301/http://msdn.microsoft.com/msdnmag/issues/05/05/SafeCandC/default.aspx
// But the wording of the warning is mis... | TOOL | 0.943673 | 6.083573 |
d03e2016-755b-4517-a190-236c5c21a9aa | ishandutta2007/codeforces | demoralizer/normal/1685/B.cpp | #include "bits/stdc++.h"
using namespace std;
#define int long long
#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define all(x) (x).begin(),(x).end()
#define uniq(v) (v).erase(unique(all... | ALGO | 0.999863 | 5.021162 |
3aa928f0-2d31-4c46-9857-c4e2c00b6657 | boyu-ai/Hands-on-DS | textcode/chapter2/LongLongIntTest.cpp | // LongLongInt类的测试程序
// 输入两个大整数(位数不超过100),输出其对应的a+b和a-b
// 样例输入:124 421
// 样例输出: a plus b is +545
// a minus b is -297
#include "LongLongInt.h"
int main() {
char a[100], b[100];
cin >> a >> b;
LongLongInt inta(a), intb(b);
LongLongInt intc(inta);
cout << "a plus b is " << inta + intb << endl;
cout ... | ALGO | 0.907742 | 3.814904 |
a6682203-6945-45b0-84d9-27694ab7ad1a | drlenny/Cpp-course-assignments | Section 9 Controlling Program Flow/Looping/NestedLoops/NestedExercise/main.cpp | #include <iostream>
#include <vector>
using namespace std;
int main()
{
vector<int> vec{1, 2, 3};
int result{};
for (size_t i{0}; i < vec.size(); ++i)
{
for (size_t j{i+1}; j < vec.size(); ++j)
{
result = result + vec.at(i) * vec.at(j);
}
cout << result <... | ALGO | 0.999755 | 4.25683 |
7b65a51a-39cb-4504-b0ce-f9ab3c25dd22 | AyushChauhan7983/Algorithms-C- | Randomize Quick Sort/Randomize_quick_sort.cpp | #include <cstdlib>
#include <time.h>
#include <iostream>
using namespace std;
int partition(int arr[], int low, int high)
{
int pivot = arr[high];
int i = (low - 1);
for (int j = low; j <= high - 1; j++)
{
if (arr[j] <= pivot)
{
i++;
swap(arr[i], arr[j]);
... | ALGO | 0.999903 | 5.253529 |
a30df0b6-4c6e-4116-b60e-7c206db82649 | Snejochekk/LvlUp.Start | Maxmin/massfun.cpp | #include "massfun.h"
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
void fillMass(int *M, int mass)
{
srand(time(nullptr));
printf("Massive:\n");
for(int i = 0; i < mass; ++i)
{
M[i] = rand() % 41 - 5;
printf("%d ", M[i]);
}
printf("\n -------------------------------... | ALGO | 0.992895 | 4.070552 |
b7e42d4e-7fe2-403d-a033-6c8a1b649745 | Priyanshu150/6_companies_30_DaysChallenge | Microsoft_coding_questions/Bulls_and_Cows.cpp | Links:- https://leetcode.com/problems/bulls-and-cows/description/
Intution:-
Maintain the map for secret in order to search the char present.
Reducing the frequency every time we find a code and simultaneouly maintaining the count.
Time complexity:- O(N+M)
Space complexity:- O(N)
where, "N" is the len of secr... | ALGO | 0.99999 | 6.98718 |
4aa947a1-377d-4199-9aaf-7a2442c6c1f7 | jyotiraditya-chauhan/Shooping_ui | 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 |
bfeb4613-dc24-4366-a370-121947b7df1b | Ownfos/Waffle | libraries/boost_1_72_0/libs/dll/example/tutorial7/tutorial7.cpp | #include <vector>
#include "../b2_workarounds.hpp"
//[callplugcpp_tutorial7
#include <boost/dll/shared_library.hpp>
#include <boost/dll/library_info.hpp>
#include <iostream>
void load_and_execute(const boost::dll::fs::path libraries[], std::size_t libs_count) {
const std::string username = "User";
for (std::... | TOOL | 0.911132 | 5.263221 |
87c7a6ef-7655-4470-9398-87d214f3e8e3 | horrible-hacker/Cpp-codes | guess_the_number.cpp | #include <iostream>
#include<cstdlib>
#include<cmath>
using namespace std;
int main()
{
srand(time(0));
int a[3];
a[0] = rand()%10;
a[1] = rand()%10;
a[2] = rand()%10;
int trial = 5;
cout<<"You have 5 trials to guess correct number upto 3 digit"<<endl;
while(trial--)
{
i... | ALGO | 0.999006 | 3.081582 |
74c24d28-2d98-45be-974a-c16129ace22f | Am10aN16/webD_projects_beginners_Hacktoberfest22 | LInked_List/insert_node_in_ll.cpp | #include<iostream>
using namespace std;
class Node{
public:
int data;
Node *next;
Node(int data)
{
this->data=data;
next=NULL;
}
};
void print(Node *head)
{
Node *temp=head;
while(temp)
{
cout<<temp->data<<" ";
temp=temp->next;
}
cout<<endl;... | ALGO | 0.999924 | 3.87038 |
ba984b56-1d1b-4b88-aeb6-c1d577f44e3a | Gaaaamma/LeetCode | CPP/easy/pb0700.cpp | #include <iostream>
#include <vector>
#include <stack>
#include <queue>
using namespace std;
/*
#700 Search in a Binary Search Tree
Attempt 1:
Just traverse the tree according to the val
Complexity: O(N)
Q: You are given the root of a binary search tree (BST) and an integer val.
Find the node in the BST that th... | ALGO | 0.999995 | 6.262111 |
c24a8b59-8653-4c6f-a803-8d39464879ef | alexandraback/datacollection | solutions_5709773144064000_0/C++/ac517/b.cpp | #include <vector>
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <cmath>
#include <map>
#include <set>
#include <algorithm>
#include <time.h>
#include <string.h>
#include <limits.h>
#include <stdio.h>
#include <queue>
#include <iomanip>
using namespace std;
#define FOR(i,a,b) fo... | ALGO | 0.999065 | 3.891979 |
b656fb1d-80a5-4d28-a12f-5e5345e0916b | Meshva30/media_player_example | 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.998757 | 6.771107 |
0066c66d-8422-4ff8-92bc-c428cf2d5d15 | nxplatform/nx-mobile | thirdparty-cpp/boost_1_62_0/libs/phoenix/example/parallel_for.cpp | #include <boost/phoenix.hpp>
struct omp_for_eval
{
typedef void result_type;
template <typename Init, typename Cond, typename Step, typename Do, typename Context>
result_type
operator()(
Init const& init
, Cond const& cond
, Step const& step
, Do const& do_
, Context & ... | ALGO | 0.996472 | 5.904364 |
2941c76e-97cf-4335-8b7d-efcf98f25405 | Chaste/Chaste | lung/src/ventilation/odes/LambertAirwayWallFactory.cpp | #include "LambertAirwayWallFactory.hpp"
//Airway generation alpha0 data, generation 0 -> generation 16
const double LambertAirwayWallFactory::mAlpha0[] = {0.882,0.882,0.686,0.546,0.450,0.370,0.310,0.255,0.213,0.184,0.153,0.125,0.100,0.075,0.057,0.045,0.039};
//The below are in Pascals^-1
const double LambertAirwayWal... | TOOL | 0.924841 | 6.009494 |
13ba2fd1-87b3-4fa4-a34b-c4c7e4c93536 | AbhijitDoesCoding/Coding | C_Ski_Resort.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define nline cout << "\n";
#define yes cout << "Yes\n";
#define no cout << "No\n";
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define mod 10000000... | ALGO | 0.999782 | 3.848954 |
b9680f54-62bc-43a2-b578-d05484179b3f | neilj9530/C-plus-plus-Coursework | Merge Sort.cpp | // Code written by James Neil NUID: 002250732
#include <iostream>
#include <random> // needed for assigning random integer values to the array
using namespace std;
int getSize();
void mergeSort(double*, int, int);
void merge(double*, int, int, int);
int main() {
int n = getSize();
random_device rd; // create a ra... | ALGO | 0.999924 | 5.341392 |
7a046c22-033e-4b89-94b1-b8c77eaa2540 | Gaurav3009/LeetCode | Set kth bit - GFG/set-kth-bit.cpp | //{ Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution
{
public:
int setKthBit(int N, int K) {
return (N | (1<<K));
}
};
//{ Driver Code Starts.
int main()
{
int t;
cin >> t;
while (t--)
{
int N, K;
cin >> N >> K;... | ALGO | 0.999863 | 5.234985 |
a4a08cb6-f793-4aeb-ab1b-2f892dae24ab | zoharl3/eigen_wrapper_cpp | test.cpp |
#include "stdafx.h"
#include <iostream>
#define USE_EIGEN_WRAPPER
#ifdef USE_EIGEN_WRAPPER
#include "eigen_wrapper.h"
namespace Eigen = EigenWrapper;
#else
#include <Eigen/Dense>
#endif
using namespace std;
int main() {
Eigen::VectorXd vx;
vx.resize( 4 );
vx.setZero();
vx( 0 ) = 5;
... | ALGO | 0.95528 | 3.142359 |
ef2217ab-b68f-49c3-9989-894363a1a394 | pacha2880/competitive_programming_codes | A - Multiplication 1.cpp | #include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#define mp make_pair
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)a.size()
#define eq(a, b) (fabs(a - b) < EPS)
#define md(a, b) ((a) % b + b) % b
#define mod(a) ... | ALGO | 0.999448 | 4.049345 |
5f8186c1-9228-4736-a70c-767b0bfe9055 | yzzupgo/MFTCG | Data/abc206_a/pultik/ac/23584937.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long int;
void __print(int x) {
cerr << x;
}
void __print(long x) {
cerr << x;
}
void __print(long long x) {
cerr << x;
}
void __print(unsigned x) {
cerr << x;
}
void __print(unsigned long x) {
cerr << x;
}
void __print(unsigned long long x) {
cerr << x;
}
v... | ALGO | 0.999529 | 3.547581 |
5030cefa-63dc-41be-aa2d-938ec93d4d4f | Deepashri22/DSA-Data-Structures-and-Algorithms- | numbertriangle.cpp | #include<iostream>
using namespace std;
int main(){
int n;
cout<<"No of rows";
cin>>n;
for(int i=1;i<=n;i++){
for(int j=1;j<=i;j++){
cout<<j;
}
cout<<endl;
}
} | ALGO | 0.99895 | 3.865786 |
c80a15d0-f83d-4b0a-af2f-27a5d6f74253 | baudm/project-euler | 029.cpp | #include <iostream>
#include <vector>
#include <cmath>
/**
* Returns the factors of num (excluding 1 and num itself)
*/
void get_factors(unsigned short num, std::vector<unsigned short>& factors)
{
unsigned short i, s = sqrt(num);
factors.clear();
for (i = 2; i <= s; i++) {
if (num % i == 0) {
factors.push_b... | ALGO | 0.993883 | 4.948368 |
8e961a34-25bc-47b2-a400-8b11f704740b | qiaozishun4/CSP2024_BJ | BJ-Senior/answers/BJ-S00175/color/color.cpp | #include <cstdio>
#include <map>
#include <algorithm>
using namespace std;
map<int,int>mp;
int a[200010];
void solve(){
int n;
long long ans=0;
scanf("%d",&n);
for(int i=0;i<n;i++){
scanf("%d",&a[i]);
mp[a[i]]=0;
}
for(int i=0;i<n;i++)mp[a[i]]++;
sort(a,a+n);
for(int i=0;... | ALGO | 0.999606 | 3.936846 |
ec668675-19ba-4dac-9a5a-d8fa0082e80f | rishiiiiitaaaaa/Amazon-PYQ | LRU_Cache.cpp | class LRUCache {
public:
class Node{
public:
int key;
int value;
Node* prev;
Node* next;
Node(int key,int value){
this->key=key;
this->value=value;
prev= NULL;
next=NULL;
}
};
Node* head= new Node(-1,-1)... | ALGO | 0.999136 | 5.752081 |
f4a9140b-c0c5-44c4-a214-2af61fc1caf3 | Orpheus-3145/Webserver | src/http/RequestValidate.cpp | #include "RequestValidate.hpp"
// ╔════════════════════════════════╗
// ║ CONSTRUCTION PART ║
// ╚════════════════════════════════╝
RequestValidate::RequestValidate(t_serv_list const& servers) : _servers(servers)
{
_setDefaultServ();
this->_handlerServer = this->_defaultServer;
_resetValues();
}
// ╔═══════════... | WEB | 0.93901 | 5.020293 |
9f597705-2fe5-419f-a647-d82f12652d3f | ivipinyadav14/cpp-code-vault | topic-wise-codes/prog11_armstrongNum.cpp | #include <iostream>
using namespace std;
int main()
{
int n, orgNum;
int num = 0;
cout << "Enter Number : ";
cin >> n;
orgNum = n;
while (n > 0)
{
int dig = n % 10;
num = num + dig * dig * dig;
n/=10;
}
if (orgNum == num)
cout << orgNum << " is a Arms... | ALGO | 0.999816 | 4.534176 |
7c4ecd31-d815-4583-9039-4b630f5667e2 | ishandutta2007/codeforces | alan233/normal/1535/B.cpp | // Author: wlzhouzhuan
#pragma GCC optimize(2, 3, "Ofast")
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define pii pair<int, int>
#define pb push_back
#define fir first
#define sec second
#define rep(i, l, r) for (int i = l; i <= r; i++)
#define per(i, l, r) for (in... | ALGO | 0.999542 | 3.879988 |
c1a43ab6-3b34-4769-ba66-ce0d31bc60d9 | premc5731/LOGIC-BUILDING | program_0202.cpp | #include<iostream>
using namespace std;
typedef unsigned int UINT; // this is done by compiler not by preprocessor
bool CheckBit(int iNo)
{
UINT iMask = 2048;
UINT iResult = 0;
iResult = iNo & iMask;
return iResult == iMask;
}
int main()
{
UINT iValue = 0;
bool bRet = false;
cout<<"Ent... | ALGO | 0.987147 | 5.256059 |
93cbecb4-f071-48eb-8b5c-0829057f3a15 | mattho1/TSP-solving-algorithms | Populacja.cpp | #include "Populacja.hpp"
Populacja::Populacja(int ** Dane, int liczbaMiast)
{
//srand(time(NULL));
if (liczbaMiast % 2 == 0) {
wielkoscPopulacji = 2 * liczbaMiast + liczbaMiast / 2;
}
else {
wielkoscPopulacji = 2 * liczbaMiast + (liczbaMiast / 2) + 1;
}
this->liczbaMiast = liczbaMiast;
miasta = new int*[lic... | ALGO | 0.999325 | 4.723851 |
0b86dd59-c9c7-4adf-93fc-e9ff690e414c | amnydv17/POTD_LeetCode_GFG | GFG_POTD/Bit/Swap two nibbles in a byte_31_5_24.cpp | class Solution {
public:
int swapNibbles(int n) {
// Aman Yadav
int rn=n & (0b11110000);
int ln=n & (0b00001111);
rn=rn>>4;
ln=ln<<4;
return rn | ln;
}
}; | ALGO | 0.999314 | 3.257335 |
89a85307-38f6-4d8f-a3af-5fff2e1f3758 | hanshuobest/learn_slam | bundle_adjustment/main.cpp | #include <iostream>
#include <opencv2/core/core.hpp>
#include <opencv2/features2d/features2d.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/calib3d/calib3d.hpp>
#include <Eigen/Core>
#include <Eigen/Geometry>
#include <g2o/core/base_vertex.h>
#include <g2o/core/base_unary_edge.h>
#include <g2o/core/block... | ALGO | 0.991433 | 5.886637 |
89857870-9983-47a9-9a40-b4947be9d5d8 | bolatov/leetcode | 0070_climbing_stairs.cpp | class Solution {
public:
int climbStairs(int n) {
vector<int> dp(n+1, 1);
dp[2] = 2;
for (int i = 3; i <= n; i++) {
dp[i] = dp[i-1] + dp[i-2];
}
return dp[n];
}
};
| ALGO | 0.999948 | 6.232625 |
daffbf4e-ef04-4c22-8377-54ecb9f7cc45 | GalaxyHorder/CSCI-21-FALL-2015 | Lab5/lab_5.cpp | /*
* Name : lab_5.cpp
* Author : Xavier Winsor
* Description : Practicing Functions. Use this file to write your
* Function Definitions (what goes below main()).
*/
#include "lab_5.h"
// CODE HERE (FUNCTION DEFINITIONS)
void Hello(){
cout<<"Hello world!";
}
void PrintMessage(string... | TOOL | 0.980117 | 4.328014 |
b49e8ab1-b86b-45b9-8eb2-bbb38b0a4c1b | tan10120/DAA_Assignment_rep | week10Q2maxtasks.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
int i,t[n],f[n];
for(i=0;i<n;i++)
cin>>t[i];
for(i=0;i<n;i++)
cin>>f[i];
vector<vector<int>> a;
vector<int> act;
for(i=0;i<n;i++)
a.push_back({f[i],f[i]-t[i],i+1});
sort(a.begin(),a.end());
int e... | ALGO | 0.999992 | 3.175364 |
accb11f2-bbc1-444e-b40a-738944de7ada | AvanishShukla20/Leetcode-problems | 1917-maximum-average-pass-ratio/maximum-average-pass-ratio.cpp | class Solution {
public:
double maxAverageRatio(vector<vector<int>>& classes, int extraStudents) {
int n=classes.size();
double res = 0.0;
priority_queue<pair<double, int>> pq;
for(int i=0; i<n; i++)
{
double pr = (double)classes[i][0]/classes[i][1];
... | ALGO | 0.999892 | 5.500399 |
b7b0e9cd-5857-4db9-80bd-8dde62b7e392 | PythonSmall-Q/OI-Codes | 3414.cpp | #include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int n,x,y,i;
int main()
{
scanf("%d",&n);
int r[n+1]={0};
for(i=1;i<n;i++)
{
scanf("%d%d",&x,&y);
r[x]++;
r[y]++;
}
r[1]=r[1]+1;
for(i=1;i<=n;i++)
{
//r[i]--;
printf("%d ",r[i]-1);
}
}
| ALGO | 0.999831 | 3.520658 |
b4f25548-073e-4de5-9e15-754f537d8c8a | NocNoc31/CAN_ | src/Control/Impedance_controller/src/impedance_control_node.cpp | #include "rclcpp/rclcpp.hpp"
#include "std_msgs/msg/float32.hpp"
#include <linux/can.h>
#include <linux/can/raw.h>
#include <net/if.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <unistd.h>
#include <cstring>
#include <algorithm>
#include <chrono>
#include <deque>
#include <Eigen/Dense>
class ImpedanceCont... | TOOL | 0.979047 | 5.862511 |
76f4914c-1a05-4916-a92a-a92a9ee89911 | Sudhanshu2306/Competitive-coding | mathworks.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int n; cin>>n;
vector<string> a(n);
for(int i=0;i<n;i++) cin>>a[i];
vector<int> cnt(26,0);
for(auto it:a){
for(auto itr:it) cnt[itr-'a']++;
}
vector<int> x;
int total=0;
for(auto it:a){
int z=it.size();
... | ALGO | 0.999956 | 4.020649 |
436bc7c6-fd31-4671-917c-133f9901ec99 | pulkitverma25/Code | Hackerrank/Domains/Algorithms/Search/icecream-parlor.cpp | /**********************************************************
* @author Pulkit Verma
* @email technopreneur[dot]pulkit[at]gmail[dot]com
**********************************************************/
/*
https://www.hackerrank.com/challenges/icecream-parlor
Sunny and Johnny together have M dollars and want to spend t... | ALGO | 0.999981 | 4.450771 |
5b0327f4-31c9-44ac-a688-b4d4d64e0570 | Bhanureddy700/DAA--CSA0695 | factors.cpp | #include<stdio.h>
int main(){
int num, i;
printf("enter a positive integer: ");
scanf("%d",&num);
printf("factors of %d are: ",num);
for(i=1;i<=num;++i){
if(num%i==0){
printf("%d ",i);
}
}
return 0;
}
| TOOL | 0.985002 | 3.006085 |
ff2fa225-7f89-4bb2-afa5-2377fd143d41 | ShiweiHe0713/DSIO---Human-Traffic-Monitoring-App-Dev-Based-on-OpenCV- | Panorama/opencv-4.1.1/modules/imgproc/src/geometry.cpp | #include "precomp.hpp"
CV_IMPL CvRect
cvMaxRect( const CvRect* rect1, const CvRect* rect2 )
{
if( rect1 && rect2 )
{
cv::Rect max_rect;
int a, b;
max_rect.x = a = rect1->x;
b = rect2->x;
if( max_rect.x > b )
max_rect.x = b;
max_rect.width = a += rec... | ALGO | 0.999695 | 6.075745 |
3c478b1f-a0a0-4359-9d10-9d950af01d3b | Keyu-He/Enhancing-Debugging-Skills-of-LLMs-with-Prompt-Engineering | solutions_correct/algorithms/M/Maximal Square/Maximal Square.cpp | class Solution {
public:
int dp[305][305];
int ans;
int getMax(vector<vector<char>>& mat, int i, int j){
int n=mat.size(), m=mat[0].size();
if(i>=n || j>=m) return 0;
if(dp[i][j] != -1) return dp[i][j];
// getting min of the perfect squares formed by left adjacen... | ALGO | 0.999849 | 5.951557 |
9f4d01d8-730d-4381-b183-b9e2189064b7 | AdanosGotoman/GenomeGameSDK | ThirdParty/Bullet_2.89/BulletCollision/CollisionShapes/btBvhTriangleMeshShape.cpp | //#define DISABLE_BVH
#include "BulletCollision/CollisionShapes/btBvhTriangleMeshShape.h"
#include "BulletCollision/CollisionShapes/btOptimizedBvh.h"
#include "LinearMath/btSerializer.h"
///Bvh Concave triangle mesh is a static-triangle mesh shape with Bounding Volume Hierarchy optimization.
///Uses an interface to a... | ALGO | 0.947345 | 7.678749 |
2edc0d6d-304c-4072-89f9-7522f4f7d8e9 | Pasha-006/Leetcode_solutions_cpp | backtrack/DistinctSubseq.cpp | #include<iostream>
class Solution {
public:
int solve(std::string s,std::string t, int sstart,int tstart,int size)
{
if(tstart==t.length() && size==tstart)
{
return 1;
}
if(tstart>t.length() || s.length()<sstart || tstart==t.length())
{
re... | ALGO | 0.999974 | 5.755146 |
d1774c94-7409-42ed-bc17-f6e9da52263a | fseasy/SoftwareDesign | shortestPath/main.cpp | #include "../lib_x/Graph_adjList.h"
using namespace std;
int main()
{
fstream in("data.txt") ;
if(in == NULL)
{
cout<<"ļȡʧ\n" ;
return 0 ;
}
Graph x(in) ;
for(int i = 0 ; i < x.getVertexNum() ; i++)
{
x.Dijkstra(i+1) ;
}
x.Floyd() ;
return 0;
}
| ALGO | 0.998088 | 3.749254 |
8a50dfc8-8b84-43e1-83e5-7635cf7d242f | priyanshu12mittal/cpp | Rating 900/C_Vasilije_in_Cacak.cpp | #include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#define ll long long
#define ull unsigned long long
#define pb push_back
#define mp make_pair
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define vi vector<int>
... | ALGO | 0.999931 | 4.500596 |
359db24c-6cca-46a0-9d4f-15bab8d9dae9 | Vojlok/tsmp_project | components/nvtt_static/nvtt/squish/singlecolourfit.cpp | #include "singlecolourfit.h"
#include "colourset.h"
#include "colourblock.h"
namespace squish {
struct SourceBlock
{
u8 start;
u8 end;
u8 error;
};
struct SingleColourLookup
{
SourceBlock sources[4];
};
#include "singlecolourlookup.inl"
static int FloatToInt( float a, int limit )
{
// use ANSI round-to-zero b... | ALGO | 0.879269 | 6.092329 |
ae516fc8-175a-43c4-ba25-d3afef82975e | LokeshBolisetty/DSA | Arrays/MaxDistance.cpp | #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int maximumGap(const vector<int> &A) {
if(A.size()==0)return 0;
vector<pair<int,int>> the;
for(int i=0;i<A.size();i++){
the.push_back({A[i],i});
}
sort(the.begin(),the.end());
//Sorting made sure that A[i]<A[j] ... | ALGO | 0.999472 | 4.251067 |
03aea28e-e18f-487a-b5b4-ca16b156b0df | lusjenka/origin1 | Lesson22/Task1/ConsoleApplication1/ConsoleApplication1/ConsoleApplication1.cpp | #include <iostream>
#include <vector>
template <class T>
T sqrt_(T a)
{
a *= a;
return a;
}
int main()
{
int a = 5;
std::vector<int> v6{-3, 2, 4, 5};
std::cout << "[IN]: " << a << std::endl << "[OUT]: " << sqrt_(a) <<std::endl;
std::cout << "[IN]: ";
for(int i = 0; i < v6.size(); i++... | ALGO | 0.995126 | 3.73714 |
48d924a2-3abb-4448-a3c9-a81dbe41f723 | kernelzilla/android_frameworks_base | media/libstagefright/codecs/amrnb/common/src/add.cpp | /*
Filename: /audio/gsm_amr/c/src/add.c
------------------------------------------------------------------------------
REVISION HISTORY
Description: Created separate file for add function. Sync'ed up with the
current template and fixed tabs.
Description: Changed all occurrences of L_sum with sum.
De... | ALGO | 0.998181 | 6.71736 |
3d4bd8b5-1809-4df9-afa7-e8a958f70c78 | ishandutta2007/codeforces | toxel/normal/1190/A.cpp | #include <bits/stdc++.h>
typedef long long ll;
const int N = 100010;
ll p[N];
ll getpiece(ll sit, ll offset, ll k){
return (sit - offset) / k;
}
int main(){
ll n, m, k;
scanf("%lld%lld%lld", &n, &m, &k);
for (int i = 0; i < m; ++ i){
scanf("%lld", &p[i]);
-- p[i];
}
int offse... | ALGO | 0.999915 | 3.756662 |
897c8669-954a-4784-8a2f-8123002ebe54 | rocket0l4/codechefparctice | puppy_sum.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int t, a, b;
cin >> t;
while (t--)
{
cin >> a >> b;
// b1= b;
while (a--)
{
int count =0;
for (int i = 1; i <= b; i++)
{
count += i;
}
b ... | ALGO | 0.99982 | 3.644949 |
b490fe31-2a24-4725-8884-541a47afb40a | vovkasm/jsc-android | icu/source/i18n/rbt_rule.cpp | #include "unicode/utypes.h"
#if !UCONFIG_NO_TRANSLITERATION
#include "unicode/rep.h"
#include "unicode/unifilt.h"
#include "unicode/uniset.h"
#include "unicode/utf16.h"
#include "rbt_rule.h"
#include "rbt_data.h"
#include "cmemory.h"
#include "strmatch.h"
#include "strrepl.h"
#include "util.h"
#include "putilimp.h"
... | TOOL | 0.962752 | 3.307638 |
0a5939ed-32ab-4ef6-9bbf-f5924b10e99e | TenX-OS-VIC/frameworks_av | media/module/codecs/amrnb/common/src/pow2_tbl.cpp | /*
Filename: /audio/gsm_amr/c/src/pow2_tbl.c
------------------------------------------------------------------------------
REVISION HISTORY
Description: Added #ifdef __cplusplus and removed "extern" from table
definition.
Description: Put "extern" back.
Who: Date:
Descrip... | CONFIG | 0.878061 | 5.935047 |
c43a014b-32fc-4c18-900e-ac7a0fba9229 | old-yan/leetcode-solutions | leetcode_solutions/leetcode_1700/1685/1685.cpp | #include "utils.h"
class Solution {
public:
vector<int> getSumAbsoluteDifferences(vector<int>& nums) {
int n=nums.size(),sum=accumulate(ALL(nums),0);
vi ans(n);
for(int i=0,left=0,right=sum;i<n;i++){
right-=nums[i];
ans[i]=right-(n-i-1)*nums[i]+i*nums[i]-left;
... | ALGO | 0.999829 | 5.401242 |
5f1b7fe7-88a5-4d1e-86c1-35f3e5a8b0ce | ypandey700/DAA-4-Semester | Week5/Q2.cpp | // Given an unsorted array of integers, design an algorithm and
// implement it using a program to find whether two elements exist such
// that their sum is equal to the given key element. (Time Complexity = O(n
// log n))
#include<iostream>
#include<algorithm>
using namespace std;
void sum(int arr[],int n, int key)
{
... | ALGO | 0.999986 | 4.158534 |
b42a9c5d-c781-4eec-b14f-258be36a50bd | sarvex/leetcode-d | solution/0700-0799/0768.Max Chunks To Make Sorted II/Solution.cpp | class Solution {
public:
int maxChunksToSorted(vector<int>& arr) {
stack<int> stk;
for (int& v : arr) {
if (stk.empty() || stk.top() <= v)
stk.push(v);
else {
int mx = stk.top();
stk.pop();
while (!stk.empty() &&... | ALGO | 0.999977 | 5.837968 |
1b1ab258-b44a-4784-bdd4-3906c6720108 | rifatr/Competitive-Programming | Old_items/LightOJ/1017.cpp | #include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define scan(a) scanf("%d", &a)
#define scanl(a) scanf("%lld", &a)
#define scand(a) scanf("%lf", &a)
#define ... | ALGO | 0.999986 | 3.610494 |
f63aa53e-856a-4b15-b512-5b9d4ec2fa1c | RahulAwasthi314/problem-solving | leetcode/array/isPalindrome.cpp | /**
* @file isPalindrome.cpp
* @author Rahul Awasthi (<EMAIL>)
*
* @brief
* try out the problem here:
* https://leetcode.com/problems/palindrome-number/
*
*/
class Solution {
public:
bool isPalindrome(int x) {
stringstream ss;
ss << x;
string s;
ss >> s;
string s2... | ALGO | 0.998704 | 6.027574 |
7e43c530-7a0e-446c-9ab0-77d013a2f97e | kheiro-bellahcene/cpp_crash_course | src/les_exceptions.cpp | #include<iostream>
using namespace std;
/**
int factoriel(int x){
int fact = 1;
for(int i=2; i <= x; i++)
fact *= i;
return fact;
**/
int factoriel(int x){
if (x < 0){
throw x;}
else{
int fact = 1;
for(int i=2; i <= x; i++){
fact *= i;}
return fact;
}
}
int main(){
/**
if (A < 0)
cerr << "imp... | ALGO | 0.998657 | 4.248123 |
dc2725d8-9668-4db0-a497-53b6d45c134b | AvijitChowdhury/C-Cplusplus-DSA | 5_Algorithm/Algorithms-II/Module 15/bfs_2d.cpp | #include <bits/stdc++.h>
#define pi pair<int, int>
using namespace std;
const int N = 1005;
bool vis[N][N];
int dis[N][N];
int n, m;
vector<pi> path = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}};
bool isValid(int cI, int cJ)
{
if (cI >= 0 && cI < n && cJ >= 0 && cJ < m)
return true;
else
return false;
}
... | ALGO | 0.99995 | 3.913284 |
e2da1a6c-561d-4478-a6d5-ff4b3b0292df | abhishek18124/PPCPPApril2023 | Lecture 23/009QuickSort.cpp | // constraints : n <= 100
#include<iostream>
using namespace std;
int partition(int* arr, int s, int e) {
int j = s;
int i = j - 1; // represent the right boundary of the left partition
int pivot = arr[e];
while (j < e) {
if (arr[j] < pivot) {
i++;
swap(arr[i], arr[j]);
}
j++;
}
swap(arr[i +... | ALGO | 0.999967 | 5.223615 |
33eee3a6-115a-4de7-b753-4ae1397aa7b5 | RedwanPlague/cses_problems | Sorting-and-Searching/Movie-Festival.cpp | // https://cses.fi/problemset/task/1629/
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
#define F first
#define S second
#define all(v) (v).begin(),v.end()
typedef pair<int,int> pii;
int main () {
ios_base::sync_with_stdio(false); cin.tie(nullptr);
int n;
cin >> n;
... | ALGO | 0.999797 | 4.810027 |
f55be251-de46-4d04-be40-276f89033dde | muzair2003/Tic-Tac-Toe | bot.cpp |
#include "bot.h"
#include <stdlib.h>
#include<bits/stdc++.h>
using namespace std;
Bot::Bot(Box::State piece):
Player("Bot",piece),
player('o'),
opponent ('x'),
m_piece(piece),
m_choose(Box::Pos(rand()%9))
{
}
Bot::~Bot(){
}
char Bot:: CharToState(Box::State state){
if (state == Bo... | ALGO | 0.999404 | 4.451263 |
67ac4fe6-f725-4146-9b68-62d8929d0331 | mycode2024/c--_vscode | kamacode/day_22/216.cpp | #include <vector>
using namespace std;
class Solution {
public:
vector<vector<int>> combinationSum3(int k, int n) {
backtracking(1, 0, k, n);
return result;
}
void backtracking(int startIndex, int sum, int k, int n){
if (sum > n) {
return;
}
if (k == pa... | ALGO | 0.999959 | 6.762999 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.