uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
7c25437d-9fd5-44f6-89e4-f1ffb2d3ab65 | jzc777/improved_GrabCut | graph.cpp | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "graph.h"
template <typename captype, typename tcaptype, typename flowtype>
Graph<captype, tcaptype, flowtype>::Graph(int node_num_max, int edge_num_max, void (*err_function)(char *))
: node_num(0),
nodeptr_block(NULL),
error_function... | ALGO | 0.989205 | 5.129763 |
5b4e599b-41ef-4b6a-beea-dfed82c8a82f | addRajj/Leet-Code | Longest Bitonic subsequence - GFG/longest-bitonic-subsequence.cpp | //{ Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution{
public:
int LongestBitonicSequence(vector<int>nums) {
int n = nums.size();
int dp[n+1] = {0}, dp_rev[n+1] = {0};
vector <int> v;
v.push_back(nums[0]);
dp[0] = 1;
for(int i=1; i<n; ... | ALGO | 0.999441 | 5.940464 |
9d5bbf7b-2835-4f7a-a9c5-d99a97b1d28b | wuwywu/work-temperature_scalenet | 化学突触/统计量/T-D/T=20.0(1).cpp | //wuyong @ccnu.cn 2022.03.28 // <EMAIL>
// ѧͻ ϵͳ¶ڴ24һΪϢ̬¶ֻǵ24
// ϵͳͬӣ
// ʹõޱ
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#define Pi 3.141592653589793
#define NN 200 // ij߶
// Զ庯
double fv(double v, double m, double n, double h, double e);
double gn(double v, double n, double T);
double gm(double v, doub... | ALGO | 0.99957 | 3.254603 |
51ad9b87-6bf8-4fba-a210-2f7abe00b3f1 | META-1-Official/meta1-core | libraries/wallet/wallet_transfer.cpp | #include "wallet_api_impl.hpp"
#include <graphene/wallet/wallet.hpp>
/***
* Methods to handle transfers / exchange orders
*/
namespace graphene { namespace wallet { namespace detail {
/***
* @brief a helper method to create an htlc_hash from an algo/hash combination
*/
htlc_hash wallet_api_impl::do_h... | WEB | 0.881359 | 5.331981 |
bf6624b5-81f8-4008-b769-6916b44e0972 | valida-xyz/valida-compiler | llvm/lib/CodeGen/AsmPrinter/DIEHash.cpp | #include "DIEHash.h"
#include "ByteStreamer.h"
#include "DwarfCompileUnit.h"
#include "DwarfDebug.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/CodeGen/AsmPrinter.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
using names... | TOOL | 0.857474 | 7.780445 |
76ab57af-8493-4691-9330-ac65702d7546 | hidayattaufiqur/cp-archives | competitions/latihanCompfest/Pemrograman_Dasar/Masukan_dan_Keluaran/C.cpp | #include <iostream>
#include <iomanip> // for std::setprecision()
// #include <cstdio>
using namespace std;
int main(){
long double a,b,c,d,e,f,result;
cin >> a >> b >> c >> d >> e >> f;
result = a + b + c + d + e + f;
cout << setprecision(11);
cout << result / 6.0;
} | ALGO | 0.995112 | 3.012939 |
e6c21811-4492-431f-b43d-f9a3a1419de7 | Lucky9128/STL | tempprograms/NonDecreasingSubArray.cpp | #include<iostream>
#include<vector>
#include<math.h>
#include<cstdio>
#define vvi vector<vector<int>>
#define ll long long
#define vi vector<ll>
#define inf INT32_MAX
#define Min(x,y) x<y?x:y
#define Max(x,y) x<y?y:x
using namespace std;
// void display(vi vec)
// {
// for(int i=0;i<vec.size();i++)
// {
//... | ALGO | 0.999829 | 3.914198 |
17ee4079-a997-4546-9a0b-08c6dd0f0189 | fishy15/competitive_programming | online/atcoder/arc132/almost_sorted.cpp | #include <iostream>
#include <iomanip>
#include <fstream>
#include <vector>
#include <array>
#include <algorithm>
#include <utility>
#include <map>
#include <queue>
#include <set>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <functional>
#include <numeric>
#define ll long long
#define ld long double
... | ALGO | 0.999808 | 4.153483 |
ad767e47-9b33-4cf3-bd99-0bf8efed9ec7 | ishandutta2007/codeforces | -skyline-/normal/891/A.cpp | //Relive your past life.
//Face your demons.
//The past is never dead,it is not even past.
//The memories are not only the key to the past but...also to the future.
//coded in Rusty Lake
#include<cmath>
#include<math.h>
#include<ctype.h>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<c... | ALGO | 0.999859 | 3.580297 |
3d5436c7-38ce-4c5c-ac37-12f59bd22e2f | YuKiJuDai1006/leetcode | 208.cpp | class Trie {
bool isend;
Trie* tab[26];
public:
Trie() {
isend = 0;
memset(tab, 0, sizeof(tab));
}
void insert(string word) {
Trie* node = this;
for(char ch : word){
int idx = ch - 'a';
if(!node->tab[idx]){
node->tab[idx] =... | ALGO | 0.999921 | 6.021761 |
40a87710-e71a-4cdf-8836-cffde159ef9a | sy117/SPOJ-Solutions | VECTAR8.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
vector<bool> prime(N, true);
vector<int> ans(N, 0);
void sieve(){
prime[0] = prime[1] = false;
for(int i=2; i*i<N; i++){
if(prime[i]){
for(int j=i*i; j<N; j+=i){
prime[j] = false;
}
}
}
}
int revNum(int x){
int res=0, rem;
whi... | ALGO | 0.999677 | 5.588798 |
83bef5c0-6bd9-447f-b9a9-137dc86c319e | Abhii-d/SdeSheetChallenge | 59. Word Break 2.cpp | /*Problem Statement
You are given a non-empty string S containing no spaces’ and a dictionary of non-empty strings (say the list of words). You are supposed to construct and return all possible sentences after adding spaces in the originally given string ‘S’, such that each word in a sentence exists in the given dictio... | ALGO | 0.999829 | 5.783111 |
74b0c0c9-5108-41a6-8836-e8d17e052ebc | ScienceLi1125/CQU-Study | 大二下/算法分析与设计/代码/8.动态规划/4.4.背包问题_完全背包.cpp | /*背包问题_完全背包:
题目:有N种物体,每种数量无限,重量分别为wi,价值为vi,在总重量不超过容量C的情况下让总价值最高,
但不允许只取走部分物体,要拿走只能整个拿走
思路:动态规划,用dp[i][j]表示前i件物品可以放入容量为j的袋子的最大价值,用W[i]表示第i件物品的
重量,V[i]表示第i件物品的价。因为j的取值是从0到C,所以不必担心超出C,只用考虑是否非负
注:01背包中dp[i][p]的下一个情况是dp[i+1][q](虽然求解过程是一个顺序穷举),即第i件物品取
舍影响第i+1的决策;但完全背包问题dp[i][p]的下一个情况是dp[i][p+W[i]],即第i件物品取舍只影响
下一次决策时的... | ALGO | 0.999975 | 3.618268 |
ced800bc-ae34-4033-95b2-5a0684460e43 | Xuechun-Hu/possion_reconstrction | libigl/include/igl/predicates/ear_clipping.cpp | #include <igl/slice.h>
#include "ear_clipping.h"
#include "point_inside_convex_polygon.h"
#include "predicates.h"
template <typename DerivedP, typename DerivedRT,
typename DerivedF, typename DerivedI>
IGL_INLINE void igl::predicates::ear_clipping(
const Eigen::MatrixBase<DerivedP>& P,
const Eigen::Matrix... | ALGO | 0.999224 | 6.754 |
77f48f38-0596-4245-bb92-70c74a6f985c | shivanshsanoria1/LeetcodeSolutions | CPP [1-500]/27.remove_element [1].cpp | class Solution {
public:
int removeElement(vector<int>& nums, int val) {
int n=nums.size(),c=0,j=n-1;
for(int i=0; i<n; i++)
{
if(i>j)
break;
if(nums[i]==val)
{
nums[i]=nums[j];
nums[j]=-1;
j-... | ALGO | 0.999929 | 5.899623 |
af21b36d-bd2c-4040-9c51-20f614777477 | VadimGirlin/mesa | src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp | /**
* \file brw_wm_vector_splitting.cpp
*
* If a vector is only ever referenced by its components, then
* split those components out to individual variables so they can be
* handled normally by other optimization passes.
*
* This skips vectors in uniforms and varyings, which need to be
* accessible as vectors f... | ALGO | 0.937426 | 7.657638 |
2c3d5c1a-2c62-4e1d-b697-3d5ea7d1ce1e | Coders-Assemble/Sanket-Jagtap-DSA | Tree/Tree Problems/LC222-Count_Complete_Tree_Nodes.cpp | #include <iostream>
#include <vector>
using namespace std;
// TC => O(n)
// SC => O(n)
// 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) {}
... | ALGO | 0.999945 | 6.907861 |
eeb17143-ba4a-406a-b219-842973ba28b1 | AmanParadkar/Striver_A2Z_DSA_sheet | BSon2DArrays/FindPeakElement2.cpp | #include<iostream>
#include<vector>
using namespace std;
vector<int> findPeakGrid(vector<vector<int>>& mat) {
int i = 0 ;
int j = mat[0].size()-1;
while(i <= j )
{
int mid = i + (j - i)/2;
int maxRow = 0;
for(int i = 0; i < mat.size(); i++)
{
if(mat[i][mi... | ALGO | 0.99987 | 4.616555 |
1ce21a90-56c0-4bf7-a57a-4f335878c059 | sarvex/leetcode-tcsh | solution/0400-0499/0458.Poor Pigs/Solution.cpp | class Solution {
public:
int poorPigs(int buckets, int minutesToDie, int minutesToTest) {
int base = minutesToTest / minutesToDie + 1;
int res = 0;
for (int p = 1; p < buckets; p *= base) ++res;
return res;
}
}; | ALGO | 0.997285 | 6.0089 |
027810d2-5429-4a6b-923e-474c8649b78c | bensteku/n-body-problem | main.cpp | #include <SFML/Graphics.hpp>
#ifdef THREED
#include <GL/glew.h>
#endif
#include <thread>
#include <iostream>
#include <immintrin.h>
#include "misc/settings.hpp"
#include "misc/util.hpp"
#include "body/body.hpp"
#include "render/render.hpp"
#include "render/input.hpp"
// TODO:
// - add colored bodies and add some wa... | TOOL | 0.850442 | 4.513541 |
0ae79a58-db7e-475c-b778-fee37e971b79 | yashchoudharygit/TCS-NQT-Coding | Accenture/1.Sum of Negatives/code.cpp | #include <iostream>
void sum_of_negatives(int a, int b, int c, int d) {
int numbers[] = {a, b, c, d};
int negative_sum = 0;
for (int i = 0; i < 4; i++) {
if (numbers[i] < 0) {
negative_sum += numbers[i];
}
}
std::cout << negative_sum << std::endl;
}
int main() {
int... | ALGO | 0.99955 | 4.774249 |
37764242-35b8-4ffd-817e-c6f9fc870ed1 | gulu-goolu/leetcode | problems/lc654/solution1.cpp | struct TreeNode {
int val;
TreeNode *left;
TreeNode *right;
TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
};
TreeNode *recursive(int *nums, int count) {
if (count == 0) return nullptr;
int index = 0;
int max = nums[index];
for (int i = 0; i < count; ++i) {
if (nums[i] > max) {
ma... | ALGO | 0.999978 | 6.236568 |
c24c03c9-51da-4169-be44-8140961dc603 | hashiryo/Library | test/yosupo/exp_of_FPS.test.cpp | // competitive-verifier: PROBLEM https://judge.yosupo.jp/problem/exp_of_formal_power_series
// competitive-verifier: TLE 0.5
// competitive-verifier: MLE 256
#include <iostream>
#include <vector>
#include "src/Math/ModInt.hpp"
#include "src/FFT/fps_exp.hpp"
using namespace std;
signed main() {
cin.tie(0);
ios::sync_w... | ALGO | 0.999708 | 3.926399 |
cda8d3b3-b401-4e7a-b545-fc4f78887f93 | chestNutLsj/acwing-code | basic-class/4-maths/06-linear-equtations/884.cpp | // 高斯消元解异或线性方程组
#include <iostream>
using namespace std;
const int N = 110;
int n;
int a[N][N];
/*
核心思想: 异或-不进位的加法
那么等式与等式间的异或要一起进行才能保证等式左右两边依然是相等关系!
a^b^c = x
d^f = y
则
a^b^d^c^f = x^y
1 左下角消0
1.1 枚举列
1.2 找第一个非零行
1.3 交换
1.4 把同列下面行消零(异或)
2 判断3种情况
2.1 唯一解
2.2 秩<n
2.2.1 有矛盾 无解
... | ALGO | 0.999986 | 3.680315 |
c76f1b69-a4c7-4639-94ea-dea4a4166efe | alexriderspy/Competitive-Programming | codeforces/726/p5.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int n,k;
cin>>n>>k;
string s;
cin>>s;
string mini;
for(int i=1;i<=n;i++){
string l="";
for(int j=0;j<i;j++){
l+=s[j];
}
string tmp=l;
for(int m=1;m*i<=k;m++){
l+=tmp;
... | ALGO | 0.99999 | 3.761073 |
10eb433f-232e-4523-939f-a6e99fd85c7d | onlyfans-icpc/codocodile | solutions/b.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 1e5 + 5;
int x, y, ans, temp;
void Main() {
cin >> x >> y;
temp = max(999 - x, y - 100);
ans = x - y;
if(temp / 100) ans += temp / 100 * 100;
else if(temp / 10 % 10) ans += temp / 10 % 10 * 10;
else ans += temp % ... | ALGO | 0.999518 | 4.011974 |
1e632a28-be61-4b27-8023-79fee8a37ede | JiaWenHa/octomap_ws | src/fast_gicp/thirdparty/Eigen/doc/snippets/MatrixBase_all.cpp | Vector3f boxMin(Vector3f::Zero()), boxMax(Vector3f::Ones());
Vector3f p0 = Vector3f::Random(), p1 = Vector3f::Random().cwiseAbs();
// let's check if p0 and p1 are inside the axis aligned box defined by the corners boxMin,boxMax:
cout << "Is (" << p0.transpose() << ") inside the box: "
<< ((boxMin.array()<p0.array(... | ALGO | 0.983861 | 3.51303 |
918eb57e-aada-46b7-9067-c482205253c6 | FishinLab/Algorithms_FisHinLab | topcoder/TCO_Algorithms/semifinal_round_one/level_two.cpp | /*
* The game DAG:
* The game is divided into N missions numbered from 1 to N, The order of competing the mission is not linear, there might be several missions which can be attempted at the same game.
* Some missions' completion is a prerequistie for attempting other missions.
* More specifically, a direct acyclic... | ALGO | 0.999022 | 3.018689 |
f4f10e76-7d35-4a97-8af4-a7b32c9edae9 | AralAskarov/Leetcode-Questions-Repo | 1108-defanging-an-ip-address/1108-defanging-an-ip-address.cpp | class Solution {
public:
string defangIPaddr(string address) {
string s = "";
for(int i = 0; i < address.size(); i++){
if(address[i] == '.'){
s += "[.]";
}
else{
s += address[i];
}
}
return s;
}
};
| ALGO | 0.988239 | 6.101146 |
f0cd6d0a-4ec0-4651-a1af-44ff86fdb838 | Bigpunishah/Advanced-CPP-class | myArrayAnyData/.history/myArray_20240313190810.cpp | #include "myArray.h"
#include <iostream>
// Initialize the dynamic value to nullptr
template <class T>
myArray<T>::myArray()
{
array = nullptr;
arraySize = 0;
index = 0;
}
template <class T>
myArray<T>::myArray(int size)
{
if (size <= 0)
{
std::cout << "Size not valid." << std::endl;
... | TOOL | 0.867835 | 4.005258 |
ce4a5d4b-2113-45e1-9383-0d1620b95870 | ankit-0369/Solving-DSA-Problems | 0347-top-k-frequent-elements/0347-top-k-frequent-elements.cpp | class Solution {
public:
vector<int> topKFrequent(vector<int>& nums, int k) {
int n= nums.size();
map<int,int> m;
for(int i=0; i<n; i++){
m[nums[i]]++;
}
// for(auto it : m){
// cout<< it.first<<" "<<it.second<<endl;
// }
// cout<<en... | ALGO | 0.999987 | 6.022255 |
3b34fd1c-b3f2-4907-9d72-c7f4c8f46463 | Coach-Academy/Summer-2-2024 | Level 1/CPU - Standard - L1 - C106/Practice G3/Week 04/D.cpp | #include <bits/stdc++.h>
using namespace std ;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int t ;
cin >> t ;
while(t--){
int n ;
cin >> n ;
int arr[n] ;
for(int i=0 ; i<n ; ++i){
cin >> arr[i] ;
... | ALGO | 0.998863 | 4.887389 |
3c95574a-11a5-44c1-95eb-7d1d8d94ae43 | MahendiranDurairaj/LAMMPS | src/USER-OMP/pair_dpd_omp.cpp | /* ----------------------------------------------------------------------
Contributing author: Axel Kohlmeyer (Temple U)
------------------------------------------------------------------------- */
#include "math.h"
#include "pair_dpd_omp.h"
#include "atom.h"
#include "comm.h"
#include "force.h"
#include "neighbor.... | ALGO | 0.99982 | 6.156171 |
69e54bf3-97e4-44a9-935d-1e8d67f91c2c | tarunp032/CppCodeLab | mergearrvector.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
// Function to find the median of a sorted vector
double findMedian(const vector<int>& mergedVec) {
int size = mergedVec.size();
if (size % 2 == 0) {
// If even, the median is the average of the two middle elements
... | ALGO | 0.999979 | 6.501671 |
59cd14c9-d614-4621-8424-8aa20e47d0ec | jas0n1ee/Algorithms-Hw | 2/proj1/main.cpp | #include<iostream>
using namespace std;
//Not confident about the struct of othrogonal list in textbook. There will be changes in code.
struct CrosLNode
{
int row,col;
int val;
CrosLNode *down, *right;
};
struct CNode
{
int row,col;
CNode *next;
CrosLNode *down, *right;
CrosLNode *down_last,*right_last;
};
void ... | ALGO | 0.99975 | 3.038024 |
0683991e-6555-4c5c-b407-59ba884f1009 | wenhhu/LLG-Code | src/Response.cpp | #include <cmath>
#include <cassert>
#include <iostream>
//#include <gsl/gsl_complex_math.h>
#include "constants.h"
#include "declarations.h"
using namespace std;
using namespace Eigen;
Response::Response ( Material Mat_A, Material Mat_B, Structure Crystal, Precision sPrecision, PlotData sPlotData )
: LandauLifs... | ALGO | 0.991625 | 3.201655 |
621c8750-c4c8-42c6-b684-dbf32b02c643 | kstreets/LaneDetection | opencv/sources/samples/tapi/pyrlk_optical_flow.cpp | #include <iostream>
#include <vector>
#include <iomanip>
#include "opencv2/core/utility.hpp"
#include "opencv2/imgcodecs.hpp"
#include "opencv2/videoio.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/core/ocl.hpp"
#include "opencv2/video/video.hpp"
using namespace std;
using namespace cv;
typedef unsigned char... | ALGO | 0.942313 | 5.754824 |
417356de-163f-479b-9138-b889587d8c80 | Syed-MuhammadAbdullah/DSA--JOSEPHUS-PROBLEM- | lab assignment#1_task_#3.cpp | #include<iostream>
using namespace std;
struct node
{
int data;
node* next;
};
node* front=NULL;
node* rear=NULL;
bool isEmpty()
{
if(front==NULL)
{
return true;
}
else
{
return false;
}
}
void enqueue(int x)
{
if(isEmpty())
{
node* ptr= new node();
ptr->data=x;
ptr->next=ptr;
front=ptr;
rear=p... | ALGO | 0.999499 | 4.11463 |
273a0569-4507-49ff-8ca1-540c56f9a0bf | UtkarshDhagat/new_sam | research.cpp | #include <iostream>
#include <queue>
#include <climits>
using namespace std;
int dx[] = {-1, 1, 0, 0}; // Up, Down
int dy[] = {0, 0, -1, 1}; // Left, Right
int bfs(int grid[22][22], int n, int startX, int startY, int rare[5][2], int r) {
int visited[22][22] = {0};
int dist[22][22] = {0};
queue<pair<int, i... | ALGO | 0.999772 | 5.703078 |
d8d3ec7b-c7aa-431f-b012-a1b3ac7b01ed | abhishek0777/CPCodes | Tree/2-DFS traversal.cpp | #include<bits/stdc++.h>
#define ll long long int
#define pb push_back
using namespace std;
// Time complexity : O(n)
// Auxiliary space : O(h)
struct node{
ll key;
node* left;
node* right;
node(ll k)
{
key=k;
left=right=NULL;
}
};
void inorder(node* root)
{
if(root!=NULL)
... | ALGO | 0.999913 | 5.205599 |
ace4276c-abc2-4076-a7ee-13bddbebbc45 | sujeetamberkar/DSA_PW_Skills | Pratice/Basic/Conditionals/DivisibleBy5&3Not15/code.cpp | #include<iostream>
using namespace std;
int main(){
int number;
cout <<"ENter a Number\t";
cin>>number;
if(number % 5 == 0 || number % 3 == 0)
{
if (number % 15 != 0)
{
cout<<"Number is Divisible by 3 an or 5 but not by 15";
}
else
{
c... | ALGO | 0.957 | 3.65862 |
ebe5bdc2-a847-4e9d-bab5-0d0b92bc580b | meprawin404/Cplus_plus | Assigenments/assige_25_class/add_time.cpp | #include<iostream>
using namespace std;
class Time
{
private:
int hour;
int min;
int sec;
public:
void setTime(int x,int y,int z)
{
hour = x;
min = y;
sec = z;
}
void displayTime()
{
cout<<endl<<hou... | TOOL | 0.980622 | 4.685413 |
9ee58a03-782c-4444-b1d5-654e35547827 | mdkhalidh111/CSE-122-FALL-2022-49-10- | Lab 01/2.492_49_10.cpp | /**CODE NAME : Way Too Long Words
CODE NO : 71A
**/
#include<iostream>
using namespace std;
int main(){
string s; int n;
cin>> n;
for (int i=0;i<n;i++) {
cin>>s;
if (s.size() > 10) {
cout<<s[0]<<s.size()-2<<s[s.size()-1]<< endl;
} else {
cout<<s<<endl;
}
}
}
| ALGO | 0.999729 | 4.177382 |
3a4ca7e2-474e-402e-99d1-6ff6bfe5091f | HrPeanut/advent-of-code-2023 | src/2023/day15/main.cpp | #include <trak/input.h>
#include <print>
#include <iostream>
#include <ranges>
#include <unordered_map>
#include <numeric>
struct hash {
u8 operator()(std::string_view str) const {
u8 current = 0;
for (char c : str)
current = ((current + c) * 17);
return current;
}
};
int m... | ALGO | 0.941559 | 5.45924 |
c8422500-5128-43af-a018-3eaa6c78ff7d | Achilleasein/Basic-data-Structures | Insertion Sort/Insertion_Sort.cpp | #include <iostream>
#include <cstdlib>
using namespace std;
void Insert_Sort(int [],int);
const int size = 6;
int main()
{
int Arr[size] = {1,20,6,12,2,3};
cout<<"BEFORE SORTING:"<<endl;
for (int i=0;i<size;i++) cout<<Arr[i]<<",";
cout<<endl;
Insert_Sort(Arr,size);
cout<<"\nAFTER SORTING:"<<endl;
for (int i=0;i<size... | ALGO | 0.999965 | 3.427669 |
98920c7f-9002-443d-946c-d70c5eb94774 | TheAomx/HP-625-Linux-Fancontrol | main.cpp | #include <cstdlib>
#include <iostream>
#include <vector>
#include <chrono>
#include <thread>
typedef double cpu_temp_t;
struct ThermalArea {
cpu_temp_t lower_bound;
cpu_temp_t upper_bound;
std::vector<std::uint64_t> devices;
bool is_temperature_in_area (const cpu_temp_t temperature) const {
r... | TOOL | 0.989196 | 6.568777 |
b603b57e-dcb5-4d5d-9a8c-2aa4e11130bf | kulvait/KCT_cbct | src/OSSARTReconstructor.cpp | #include "OSSARTReconstructor.hpp"
namespace KCT {
void OSSARTReconstructor::setup(float relaxationParameter, uint32_t subsetCount)
{
this->relaxationParameter = relaxationParameter;
this->subsetCount = subsetCount;
}
void OSSARTReconstructor::addUpperBoxCondition(float upperBound, float upperBoundSubstituti... | ALGO | 0.996792 | 5.411595 |
91186325-1111-4988-9d43-51e9778037cc | voe09/CPPPlayGround | Round1/LintCode/Search/ClassicBinarySearch.cpp | /*
Find any position of a target number in a sorted array.
Return -1 if target does not exist.
Have you met this question in a real interview? Yes
Example
Given [1, 2, 2, 4, 5, 5].
For target = 2, return 1 or 2.
For target = 5, return 4 or 5.
For target = 6, return -1.
Challenge
O(logn) time
*/
class Solution ... | ALGO | 0.999985 | 6.26452 |
7f0c7265-f9e2-440b-93d2-dd2f362be02b | antonioooooooooooo/codeforces | 800/785A - Anton and Polyhedrons.cpp | #include <iostream>
#include <string>
#include <unordered_map>
using namespace std;
int main() {
unordered_map<string, int> polyhedron_faces = {{"Tetrahedron", 4},
{"Cube", 6},
{"Octahedron", 8},
... | ALGO | 0.997787 | 6.042823 |
49ddec50-0d83-4041-ab8d-22f72b7e08d9 | hanzlikhan/randomcpp | ass12.cpp | #include <iostream>
using namespace std;
int main(){
for(int i=1;i<=5;i++){
for(int j=1; j<=i;j++)
cout<<"*";
cout<<endl;
}
for(int i=4;i>=1;i--){
for(int j=1; j<=i;j++)
cout<<"*";
cout<<endl;
}
}
| ALGO | 0.999906 | 3.444731 |
1a5d4ac3-3e62-415f-9125-dcb88744d789 | enhancedformysql/mysql-8.0.39 | extra/icu/icu-release-73-1/source/i18n/collation.cpp | #include "unicode/utypes.h"
#if !UCONFIG_NO_COLLATION
#include "collation.h"
#include "uassert.h"
U_NAMESPACE_BEGIN
uint32_t
Collation::incTwoBytePrimaryByOffset(uint32_t basePrimary, UBool isCompressible, int32_t offset) {
// Extract the second byte, minus the minimum byte value,
// plus the offset, modulo... | TOOL | 0.948931 | 6.556263 |
0ed393cc-33e5-4e19-a526-c8b375e44b16 | ProdriveTechnologies/pd_cpu_compiler | clang/lib/StaticAnalyzer/Core/RangedConstraintManager.cpp | #include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/RangedConstraintManager.h"
namespace clang {
namespace ento {
RangedConstraintManager::~RangedConstraintManager() {}
ProgramStateRef RangedConstraintManager::assumeSym(ProgramStateRef State,
... | TOOL | 0.902956 | 7.870032 |
56ce28f7-1828-4a98-b07c-2e76ef5bf11f | nasa/puma | cpp/src/materialproperties/tortuosity/particles_cuberilletortuosity.cpp | #include "particles_cuberilletortuosity.h"
puma::TortuosityReturn puma::compute_particle_cuberille_Tortuosity(puma::Workspace *grayWS, puma::Cutoff cutoff,
int numParticles, double meanFreePath, double meanVelocity,
... | ALGO | 0.999439 | 5.08085 |
246746b6-a5ac-40d7-9ce0-6489d99b7808 | MedivhGO/MySolutions | HackerRank/Algorithm/Time Conversion.cpp | //https://www.hackerrank.com/challenges/time-conversion/problem
#include <bits/stdc++.h>
using namespace std;
string timeConversion(string time) {
string output = time.substr(0, 8);
string ampm = time.substr(time.size() - 2);
string hourString = time.substr(0, 2);
if (ampm == "PM" && hourString != ... | ALGO | 0.994349 | 5.617666 |
e254a70f-c281-4693-81df-2464e26b49cd | sayanraha/OOPs_Interview | OOPS_2/Inheritance/HybridInheritance.cpp | // - Hybrid Inheritance: Combination of multiple inheritance and single-level inheritance, where different classes are involved in a complex inheritance hierarchy.
#include <iostream>
using namespace std;
// Base class 1
class Animal {
public:
string species;
Animal(string sp) : species(sp) {}
void dis... | TOOL | 0.970361 | 6.821017 |
b18e41c6-d07d-42e4-8d26-8c14783fa1ca | AkshathKamath/Data-Structures-Algorithms | Arrays/Easy/left_rotate_d_times.cpp | #include <bits/stdc++.h>
using namespace std;
void leftRotateDtimes(int arr[], int n, int d)
{
int temp[d];
for (int i = 0; i < d; i++)
{
temp[i] = arr[i];
}
for (int i = d; i < n; i++)
{
arr[i - d] = arr[i];
}
for (int i = n - d; i < n; i++)
{
arr[i] = te... | ALGO | 0.999779 | 4.313195 |
ec1bd3c3-4a4e-4c67-b5e6-03881f4edfbe | Mozammalhossainsobug/tesla_car_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 |
2ab95c17-d6f2-4b06-aa36-33b9b6d5f971 | rusrushal13/CodingInTown | Spoj/ABCDEF - ABCDEF.cpp | /*input
2
2
3
*/
//__author__= "Rushal Verma"
#include<bits/stdc++.h>
using namespace std;
/*******useful typedef's *********/
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vii;
typedef pair<int,int> pii;
typedef list<int>li;
typedef list<li>lii;
typedef set<int>si;
typedef se... | ALGO | 0.999932 | 3.524411 |
d61af143-dca7-4c41-9035-850a9c410a71 | tjgolubi/boost | libs/graph/example/cc-internet.cpp | int
main()
{
using namespace boost;
GraphvizGraph g;
read_graphviz("figs/cc-internet.dot", g);
std::vector<int> component(num_vertices(g));
connected_components
(g, make_iterator_property_map(component.begin(),
get(vertex_index, g), component[0]));
property_map < Gr... | ALGO | 0.871803 | 5.318306 |
08fe4da4-b5e3-41c1-a8d4-7c07fd81493c | sammkkit/codeforces_practice | Monster_Monster.cpp | #include <bits/stdc++.h>
#include <math.h>
#define fastio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define f(i, x, y) for(ll i = x; i < y; i++)
#define rf(i, x, y) for(ll i = x; i > y; i--)
#define enl "\n"
#define YES cout << "YES" << enl
#define NO cout << "NO" << enl
#define pb push_back
#defi... | ALGO | 0.999771 | 4.31634 |
cf8bd67c-a388-4348-922e-12ef171f2705 | raincross7/code-similarity | codes/train_code/problem283/problem283_465.cpp | #include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<cmath>
#include<stack>
#include<queue>
using namespace std;
typedef long long ll;
const int maxn = 200010;
ll n,t,mi,ans=0;;
ll der[2][maxn],vis,cnt[2]; // 0 left ; 1 right
string s;
ll read(){ ll s=0,f=1; char ch=getchar(); while(ch<... | ALGO | 0.99994 | 3.134375 |
763e802d-7d09-4e4f-ab6f-4cfcf7b20111 | WJ-self/algorithm | .history/acwing/basic/动态规划/背包/2_01背包问题_20230904014240.cpp | #include<bits/stdc++.h>
using namespace std;
const int M = 1010;
int N,V;
int v[M], w[M];
int dp[M][M]; // dp[i][j]: 背包容量为j时前i个物品的最大价值
int main() {
cin>>N>>V;
for (int i=0; i<N; i++) {
cin >> v[i] >> w[i];
}
for(int i=1; i<=N; i++) {
for (int j=1; j<=V; j++) {
dp[i][j] = m... | ALGO | 0.999995 | 4.481308 |
9afbf597-5de3-4542-8bfe-a49f7c8c4c29 | raincross7/code-similarity | codes/train_code/problem243/problem243_414.cpp | #include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>
#include <cmath>
using namespace std;
typedef long long ll;
ll mod = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)
int main(){
str... | ALGO | 0.999939 | 3.896028 |
20b355eb-5081-46fa-8779-9e1895ef5635 | Shlok95/LP-5 | Bubble Sort.cpp | #include<iostream>
#include<stdlib.h>
#include<omp.h>
using namespace std;
void bubble (int *, int);
void swap (int &, int &);
void
bubble (int *a, int n)
{
for (int i = 0; i < n; i++)
{
int first = i % 2;
#pragma omp parallel for shared(a,first)
for (int j = first; j < n - 1; j += 2)
{
if (a[j] >... | ALGO | 0.999945 | 3.841932 |
023a5dda-9339-45c7-9db0-de266d0d5ece | SnehilVukkusila/graph-resources | Leetcode Daily Challenge/January-2021/10. Create Sorted Array through Instructions.cpp | /*
Create Sorted Array through Instructions
============================================
Given an integer array instructions, you are asked to create a sorted array from the elements in instructions. You start with an empty container nums. For each element from left to right in instructions, insert it into nums. The c... | ALGO | 0.999253 | 6.483088 |
33e3248f-59c8-41e5-8fa5-bd0e93c883d4 | dgonzalezarbelo/AceptaElReto | 757.cpp | #include <bits/stdc++.h>
#pragma warning (disable : 4996)
using namespace std;
#define rep(i, a, b) for(int i = a; i < b; ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define fi first
#define se second
#define mp make_pair
const double EPS = 1e-9;
const double INF = 1e9; //1e18 tambien suele ir ... | ALGO | 0.999549 | 5.045442 |
8e685cd9-fc49-4cc8-87f9-4985e6840a4a | AndrewPoarch/Algorithms-Data-Strcutures-1-sem | laba6/E.cpp |
#include <iostream>
#include <string>
struct Node {
std::string value_;
bool usapple[3] {false, false, false};
Node* left_ {};
Node* right_ {};
int height_ = 1;
int diff_ = 0;
Node(std::string t_name, int idx):
value_(t_name) {
usapple[idx] = true;
}
};
Node* Exists(... | ALGO | 0.999869 | 4.421533 |
b55b7811-e484-4a89-bbce-42445f8ecf0a | has2/Problem-Solving | boj/Graph/Floyd-Washall/BOJ1389.cpp | //BOJ
//ID : 1389 / Floyd-Warshall
//2017/08/17
#include <cstdio>
#include <algorithm>
using namespace std;
const int INF = 987654321;
int n, m, dist[101][101];
int main() {
scanf("%d%d", &n, &m);
for (int i = 1; i <= n; i++)
for (int j = 1; j <= n; j++)
dist[i][j] = i == j ? 0 : INF;
while (m--) {
int a... | ALGO | 0.999971 | 4.13523 |
81ca4863-efdc-4bf5-84b7-c1476494164e | nmatzke/AA_to_3Di | src/FAMSA_3di-2.2.2/src/core/profile.cpp | #include "../core/profile.h"
#include "../core/sequence.h"
#include <assert.h>
#include <array>
#include <set>
#include <math.h>
#include <algorithm>
#include <stdio.h>
#include <future>
#define max3(x, y, z) (max((x), max((y), (z))))
#define NINF(x) ((x) < -999 ? -999: (x))
int aacode[32] = {0, 20, 4, 3, 6, 13, 7,... | ALGO | 0.984686 | 3.990995 |
d6729341-cd3d-4da4-aa25-eded197ca5c4 | JonathonMacleod/Distributed-Game-Architecture | libs/BOOST1.82.0/libs/spirit/classic/example/intermediate/ipv4.cpp | #include <boost/spirit/include/classic_core.hpp>
#include <boost/spirit/include/classic_push_back_actor.hpp>
#include <boost/spirit/include/classic_if.hpp>
#include <boost/spirit/include/classic_for.hpp>
#include <boost/spirit/include/phoenix1.hpp>
#include <iostream>
#include <string>
#include <vector>
#include <algor... | TOOL | 0.975152 | 6.156577 |
a31627ee-270d-4171-bed4-97b097253408 | bg-omar/VAMcore | src/radiation_flow.cpp | //
// Created by mr on 7/28/2025.
//
#include "radiation_flow.h"
namespace vam {
double RadiationFlow::radiation_force(double I0, double Qm, double lambda1, double lambda2, double lambda_g) {
double factor = (lambda1 / lambda_g) * (lambda2 / lambda_g);
double denom = 1.0 - std::pow(lambda1 / lambda_g, 2);
retu... | ALGO | 0.996625 | 6.517271 |
037988e3-8da7-4119-8e91-f8af5fc09960 | MZhikoV/04_CPlusPlus_OOP_SoftUni | 13_Inheritance_Ex/ByDonAn/02. Ranges/main.cpp | #include <iostream>
#include <string>
#include <sstream>
#include <map>
#include <functional>
#include <memory>
using namespace std;
class Range
{
int from, to;
public:
Range(istream &istr) { istr >> *this; }
int getFrom() const
{
return from;
};
... | ALGO | 0.984991 | 5.121211 |
d768b908-0e7d-4567-b7cb-6f599c5eda04 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_3126_8.cpp | #include<iostream>
using namespace std;
int main(){
int n, a[100];
cin >> n;
for(int i = 0; i < n; i++){
cin >> a[i];
}
for(int i = n-1; i<=0; i--){
cout << a[i] << " \n"[i == 0];
return 0;
}
| ALGO | 0.999712 | 3.048667 |
6840144a-cb82-4812-a731-26b5fb7885ef | qchien04/DSA-PTIT | sapxepchanle.cpp | #include <bits/stdc++.h>
#define endl "\n"
using namespace std;
bool cmp(int a,int b){
return a>b;
}
int main()
{
int n,k;
cin>>n;
int a[n+2];
vector<int> v1,v2;
for(int i=1;i<=n;i++){
cin>>a[i];
}
for(int i=1;i<=n;i++){
if(i%2==1) v1.push_back(a[i]);
else v2.insert(v2.begin(),a[i]);
}
sort(v1.begin(),... | ALGO | 0.999989 | 3.231591 |
9a6b5cdc-28c2-45cf-b804-212f59b22970 | ishandutta2007/codeforces | nishant403/normal/935/D.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define S second
#define F first
#define f(i,n) for(int i=0;i<n;i++)
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define vi vector<int>
#define pii pair<int,int>
const int M = 1e9+7;
int pw(int a,int b)
{... | ALGO | 0.999991 | 3.810244 |
cd3adebd-13e9-4768-b212-48a0c16c2825 | nldxtd/leetcode | List/382.linked-list-random-node.cpp | /*
* @lc app=leetcode id=382 lang=cpp
*
* [382] Linked List Random Node
*/
// @lc code=start
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, Li... | ALGO | 0.987401 | 5.726084 |
3fbb6b22-b95b-41c1-aeab-b8e1bd643ad4 | BerthaVilleda/cpp | Ejercicios/Ejercicio11 - Operador-Logico-And/main.cpp | #include <iostream>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;
int main(int argc, char** argv) {
int a=50;
int b=10;
int c=7;
if (a > b && a > c)
{
cout << "a es el mayor:" << a;
}
if (b > a && b > c)
{
cout << "b es el m... | ALGO | 0.995415 | 3.289211 |
3de18094-c4a3-43d6-a43e-93251f258190 | subreto-roy/C-programming | data structure/print lower case in stack.cpp | //Print Lower Case element in Stack
#include<stdio.h>
#include<string.h>
#define MAX 101
typedef struct st
{
int top;
char data[MAX];
}stack;
//typedef struct st stack;
int isEmpty(stack *s)
{
return s->top == -1;
}
void Push(stack*s, char item)
{
if (s->top<MAX)
{
s->top = s->top + 1;
s->data[s->top] = item... | ALGO | 0.995136 | 3.651637 |
38c7671a-8eb2-4d2f-9045-e348edbe714e | LiuXiaoWen1234/.leetcode | 27.移除元素.cpp | /*
* @lc app=leetcode.cn id=27 lang=cpp
*
* [27] 移除元素
*/
// @lc code=start
class Solution {
public:
int removeElement(vector<int>& nums, int val) {
int left = 0;
int right = nums.size()-1;
while(left <= right){
//从左侧搜索等于val的数组下标值,避免left在寻找过程中超过right
while(left<... | ALGO | 0.999873 | 6.380898 |
3f53767b-2309-494f-8464-1567483c412a | aokblast/LeetCode_Problem_Solving | Eazy/1089_Duplicate_Zeros.cpp | //
//Runtime 7
//Memory Usage 9.9
class Solution {
public:
void duplicateZeros(vector<int>& arr) {
int n = arr.size();
deque<int> q;
for(int i = 0; i < n; ++i) {
if(arr[i] == 0) {
q.push_back(0);
q.push_back(0);
arr[i] = q.... | ALGO | 0.999928 | 5.832088 |
9d0d57ac-a3b6-4ff0-8d53-ea620e574b9e | bot5294/ICPC_Assuit_Community | newcomer/sheet6_maths/H_GCD.cpp | #include <bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define ll long long
#define dd long double
#define p2(n) (n)*(n)
#define p(n,os) pow(n,os)
#define REP(i,a,b) for (int i = a; i < b; i++)
#define PINF LONG_LONG_MAX
#define NINF LONG_LONG_MIN
#define Num_of_Digits(n) ((int)log10(n) + 1)
#defi... | ALGO | 0.999943 | 4.224292 |
de576384-9d7b-4a48-9ec2-dfaa812c9d21 | yang-su2000/CP-Practice | archived/2023-10/1890d.cpp | #include <bits/stdc++.h>
using namespace std;
// ./run sample.cpp
#define ll long long
int main() {
int T, n;
ll c;
cin >> T;
while (T--) {
cin >> n >> c;
vector<ll> a(n);
for (int i=0; i<n; i++) cin >> a[i];
priority_queue<pair<ll, int>, vector<pair<ll, int>>, greater... | ALGO | 0.999991 | 4.329082 |
ac8e1a5f-91ad-49ac-9c4a-e84dd62e8453 | ranamihir/CPP-Programs | interviewbit/arrays/rotate_array.cpp | #include <iostream>
#include <vector>
using namespace std;
vector<int> rotateArray(vector<int> &A, int B);
int main() {
int n, value, B;
vector <int> A;
cin >> n >> B;
for(int i = 0; i < n; i++) {
cin >> value;
A.push_back(value);
}
vector <int> result = rotateArray(A, B);
for(int i = 0; i < n; i+... | ALGO | 0.999953 | 3.340297 |
b0a0202b-a03d-487f-bab5-b0f91d408122 | NeliocmSampaio/SPC | Encontre_o_Telefone/main.cpp | /*
* Nome: Nélio Cezar Muniz Sampaio
* Matricula: 2015042150
* Codigo do Problema: ENCOTEL Problema: Encontre o telefone
*
* O algoritmo percorre todos os caracteres da expressão e, caso seja uma
* letra maiúscula, decodifica de acordo com a tabela. A decodificação dos
* caracteres é feita de acordo com o i... | ALGO | 0.998635 | 4.652739 |
e3da0ced-659d-42ee-b1be-31202a3d5aa0 | 20060705Sean/judges | b967 第 4 題 血緣關係 ver2.cpp | // NA 40% because of 2 dfs is too slow
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,fast-math")
vector<int> dis;
void dfs(vector<vector<int>>graph, int root, int prev) {
for (int i = 0;i < (int)graph[root].size();i++) {
if (prev != graph[root][i]) {
di... | ALGO | 0.998444 | 4.164733 |
ea6e4d2a-a7b8-4969-ae20-fc6519fd5c66 | suchijain30/45daycode | WATERFLOW.cpp | #include <iostream>
using namespace std;
int main()
{
int t ;
cin>> t ;
while(t--)
{
int W, X, Y , Z, total ;
cin>>W>>X>>Y>>Z;
total=W+(Y*Z);
if(total==X)
cout<<"filled"<<endl;
else if (total>X)
cout<< "overflow"<<endl;
else
cout<<"Unfilled... | ALGO | 0.977225 | 3.622837 |
e311cc65-af1e-40dd-9e55-0f7e375c7f4f | eggag32/Competitive-Programming | Codeforces/Little C Loves 3 I.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cout << #x << ": " << x << endl
#define repn(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, a) for(int i = 0; i < (int)(a); i++)
#define all(v... | ALGO | 0.999678 | 3.255001 |
057a0cac-7d9d-48dc-826c-f0ae72c7b315 | zaki1993/HackBulgaria | Head_and_tails.cpp | #include<iostream>
using namespace std;
int main(){
int Hcounter = 0, Tcounter = 0; // Hcounter for H, Tcounter for T
int maxH = 0, maxT = 0;
char coin = ' ';
bool activeGame = true;
bool first = true;
char streakLetter = ' ';
std::cout << "Please enter * to stop the game..TAILS win by default..!" << std::endl;... | ALGO | 0.997769 | 4.169263 |
0398fb95-1dcd-4201-b14e-4cf434803796 | xjtn18/Programming-Practice-Library | _hard/frequency_stack/main.cpp | //////////////////////////////////////////////////////
// Author: Jacob Nardone
// Date created: 12/21/21
// File type: C++ source file
// Description: Create a stack that returns the mode of a stream
// of integers.
//////////////////////////////////////////////////////
#include <mystd.h>
using namespace st... | ALGO | 0.998813 | 6.05388 |
3e604c02-bc94-4c68-8e54-4824fa4e6a89 | Mehul237/GFG_237 | 00_Problem of the Day/07_July/BFSofgraph.cpp |
class Solution {
public:
vector<int> bfsOfGraph(int V, vector<int> adj[]) {
vector <int> res;
queue <int> q;
q.push(0);
map <int, int> vis;
vis[0] = 1;
while(!q.empty()) {
int topp = q.front();
q.pop();
res.push_back(topp... | ALGO | 0.999932 | 5.636395 |
26f2fbf0-023b-4690-bd15-9fee099671ba | adong001/C-DS-CPP | Boost库/boost_1_58_0/libs/numeric/odeint/examples/integrate_times.cpp | #include <iostream>
#include <boost/numeric/odeint.hpp>
using namespace std;
using namespace boost::numeric::odeint;
/*
* simple 1D ODE
*/
void rhs( const double x , double &dxdt , const double t )
{
dxdt = 3.0/(2.0*t*t) + x/(2.0*t);
}
void write_cout( const double &x , const double t )
{
cout << t << '\t... | ALGO | 0.999792 | 7.280291 |
52c30383-2c43-48ad-b8dd-7ed23b18cf05 | devmourya44/DSA-Practice | Medium/Count ways to reach the n'th stair/count-ways-to-reach-the-nth-stair.cpp | //{ Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution
{
public:
//Function to count number of ways to reach the nth stair.
int countWays(int n)
{
long long int mod=1e9+7;
if(n<=1) return 1;
int a=1,b=1;
for(int i=2;i<=n;... | ALGO | 0.999818 | 6.314058 |
5219e94d-d77b-45c8-aca2-bf39185c0190 | TammyAlok2/Dsa-150-Days | POTD/GFG/OCT_30_10_2023-sum-of-xor-pairs.cpp | class Solution
{
public:
long long int sumXOR(int arr[], int n)
{
long long int res = 0;
for (int i = 0; i < 32; i++)
{
long long int IndvSum = 0;
long long cnt0 = 0, cnt1 = 0;
for (int j = 0; j < n; j++)
{
if (arr[j] % 2 ==... | ALGO | 0.999915 | 4.960303 |
4778b2fd-afe6-4630-a00b-cde4c4a2542d | gabrielbianchin/bacharelado | grafos/codigo grafos/fusao/fusao.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
FILE *file;
file = fopen("teste.txt","r");
int n,a;
fscanf(file,"%d",&n);
int mat[n][n],m[n][n];
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
fscanf(file,"%d",&a);
if(i==j || a==0)
mat[i][j]=0... | ALGO | 0.999829 | 3.711464 |
dad1b063-bcec-4589-90a7-47d1914cbdc5 | iNiKe/boost | libs/algorithm/string/example/predicate_example.cpp | // Boost string_algo library example file ---------------------------------//
// See http://www.boost.org for updates, documentation, and revision history.
#include <string>
#include <iostream>
#include <functional>
#include <boost/algorithm/string/predicate.hpp>
#include <boost/algorithm/string/classification.hpp... | TOOL | 0.937684 | 6.221583 |
9bf02817-4be4-4cbe-86f7-1f14cb8d50f3 | bitsta/IncogCoin | src/zerocoin/SerialNumberSignatureOfKnowledge.cpp | /**
* @file SerialNumberSignatureOfKnowledge.cpp
*
* @brief SerialNumberSignatureOfKnowledge class for the Zerocoin library.
*
* @author Ian Miers, Christina Garman and Matthew Green
* @date June 2013
*
* @copyright Copyright 2013 Ian Miers, Christina Garman and Matthew Green
* @license This pr... | ALGO | 0.967818 | 7.107653 |
0210df3b-a631-4e6b-98c8-fc76c68fcae8 | suankun/cpp_snippets | Codewars/6kyu/01.Basic/Roman Numerals Encoder.cpp | // https://www.codewars.com/kata/51b62bf6a9c58071c600001b/train/cpp
// Create a function taking a positive integer between 1 and 3999 (both included) as its parameter and returning a string containing the Roman Numeral representation of that integer.
// Modern Roman numerals are written by expressing each digit separa... | ALGO | 0.999905 | 7.16624 |
e9fa5de3-18f6-4dea-8134-b0f5ead551bb | sarvex/leetcode-v | solution/1400-1499/1410.HTML Entity Parser/Solution.cpp | class Solution {
public:
string entityParser(string text) {
unordered_map<string, string> d;
d["""] = "\"";
d["'"] = "'";
d["&"] = "&";
d[">"] = ">";
d["<"] = "<";
d["⁄"] = "/";
string ans = "";
int i = 0, n = text.size();
while (i < n)... | ALGO | 0.998701 | 5.725502 |
9a061be0-0379-4286-b508-963ec820a2e7 | icaven/glm | test/core/core_func_integer_find_msb.cpp | #include <glm/glm.hpp>
#include <cstdio>
#include <cstdlib> // To define "exit", req'd by XLC.
#include <ctime>
#ifdef NDEBUG
#define LE 1 // 1 for little-endian, 0 for big-endian.
static int pop(unsigned x) {
x = x - ((x >> 1) & 0x55555555);
x = (x & 0x33333333) + ((x >> 2) & 0x33333333);
x ... | ALGO | 0.998012 | 3.356649 |
7e27e7ab-6e69-4ff1-b031-0dcbbfad3e31 | Faizun-Faria/Competitive-Programming | Online-Judge-Solutions/CodeForces/1311B/25636662_AC_31ms_3640kB.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 105;
int t, n, m;
int a[N], p[N];
void swap(int *xp, int *yp) {
int temp = *xp;
*xp = *yp;
*yp = temp;
}
void bsort(){
bool swapped;
for(int i=0; i<n-1; i++){
swapped = false;
for(int j=0; j<n-i-1; j++){
if(a[j... | ALGO | 0.999987 | 3.812501 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.