uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
6a02a4e1-316c-4067-8f21-c36f6b79f8a9 | SuperSlot0613/leetcodeProblem | 1005-maximize-sum-of-array-after-k-negations/1005-maximize-sum-of-array-after-k-negations.cpp | class Solution {
public:
int largestSumAfterKNegations(vector<int>& nums, int k) {
sort(nums.begin(),nums.end());
for(int i=0;i<nums.size();i++){
if(k>0){
if(nums[i]<0){
nums[i]=nums[i]*(-1);
k--;
}
}
... | ALGO | 0.999983 | 5.494403 |
183b0ee6-0359-47a1-bf97-8248bd849e95 | anjaneya-sharma-1/Competitive-Programming-Solutions | C_Grouping_Increases.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define N 1000000
#define MOD 1000000007
class Solution{
public:
void solve() {
ll n;
cin>>n;
vector<ll> v;
for(int i=0;i<n;i++){
ll curr;
cin>>curr;
v.push_back(curr);
}
map<ll,ll> m;
ll count=0;
... | ALGO | 0.999725 | 5.236804 |
eb5b330b-1115-473e-b91e-e95f8e8cfb2c | swapnil-tayal/DSA | 0713-subarray-product-less-than-k/0713-subarray-product-less-than-k.cpp | class Solution {
public:
int numSubarrayProductLessThanK(vector<int>& arr, int k) {
int n = arr.size();
int i=0;
int j=0;
int sum = 1;
int cnt = 0;
while(j < n){
sum = sum * arr[j];
if(sum >= k){
... | ALGO | 0.99991 | 5.386162 |
67556d12-5fdf-4f45-b76b-c95465b923b6 | ishandutta2007/codeforces | risujiroh/normal/1109/A.cpp | #include <bits/stdc++.h>
using namespace std;
using lint = long long;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;
template<class T, class U> void assign(V<T>& v, int n, const U& a) { v.assign(n, a); }
template<class T, class... Args> void assign(V<T>& v, int n, const Args&... | ALGO | 0.999989 | 4.55511 |
52e26b2d-e2f6-41ff-a5f7-8d7cd0fa7b4f | g0dspeak/coin | src/crypto/crypto.cpp | #include "crypto.h"
#include "common/Varint.h"
#include "hash.h"
#include "random.h"
#include <alloca.h>
#include <cassert>
#include <cstddef>
#include <cstdint>
#include <cstdlib>
#include <cstring>
#include <memory>
#include <vector>
namespace Crypto
{
extern "C"
{
#include "crypto-ops.h"
#include "keccak.... | ALGO | 0.990195 | 7.327832 |
5dabdbb7-e28c-4eb9-b1fd-3eaac7308848 | HEIGVD-PRG1-F-2022/lab02-mandelbrot-team-robin-f-boris-h | main.cpp | /*
* Fichier : main.cpp
* Autheur : Boris Hutzli, Robin Forestier
* Date : 13.10.22
*
* But : Le but de ce deuxième laboratoire est de réaliser une visualisation d'une fractale de Mandelbrot.
* Et de l'afficher de différente manière.
*/
#include <iostream>
#include <vector>
#include <windows.h>... | TOOL | 0.921354 | 4.797928 |
a89f4b0f-f6d0-424f-999e-6cc62aef1856 | deepin-community/libterralib | src/terralib/image_processing/TePDIRgbPaletteFunctions.cpp | #include "TePDIRgbPaletteFunctions.hpp"
#include <TeAgnostic.h>
#include <TeUtils.h>
#include <math.h>
namespace TePDIRgbPaletteFunctions
{
TePDIRgbPalette::pointer createLSBPalette( unsigned int levels )
{
TEAGN_TRUE_OR_THROW( levels > 0, "Invalid supplied Levels" );
unsigned int channel_levels =
... | TOOL | 0.858972 | 4.200159 |
30e171f3-e1cd-4ec2-81ab-9455b5eaeae5 | ishandutta2007/codeforces | elegia/normal/946/D.cpp | #include <cstdio>
#include <algorithm>
#include <limits>
using namespace std;
const int N = 510;
int n, m, k;
int hour[N], help[N];
int dp[N][N];
char s[N];
int main() {
scanf("%d%d%d", &n, &m, &k);
fill(dp[0] + 1, dp[0] + m + 1, (int)1e8);
for (int i = 1; i <= n; ++i) {
scanf("%s", s + 1);
int cnt = 0;
f... | ALGO | 0.999869 | 4.090295 |
305a86d7-f135-4aef-8382-5d1f59bba7f4 | RajMakkad/LeetCode | Matrix Exponentiation - GFG/matrix-exponentiation.cpp | // { Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
typedef long long int ll;
typedef vector<vector<ll>> matrix;
int mod= 1e9+7;
matrix prod(matrix a,matrix b){
matrix temp(2,vector<ll>(2,0));
for(int i=0;i<2;i++){
f... | ALGO | 0.999985 | 5.531603 |
c7220a9b-af52-4351-a905-f1733d609473 | Kibiandkimi/stu | Problem/Luogu/P3796.cpp | //
// Created by kibi on 2022/7/11.
//
#include <bits/stdc++.h>
using namespace std;
struct tree{
int fail, v[30], end;
}AC[20005];
int cnt, n;
//char s[1000005], t[1000005];
char s[205][105], t[1000005];
int num[205];
//int n;
void build(int id){
int now = 0;
int i = 1;
while(s[id][i] != 0){
if... | ALGO | 0.999847 | 3.737297 |
f3c75060-adde-434c-9498-ada9a988d77e | biggysmith/advent_of_code_2015 | src/day03/day3.cpp | #include <vector>
#include <iostream>
#include <fstream>
#include <string>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <functional>
#include <set>
#include <map>
#include <queue>
#include <iterator>
struct pos_t{
int x,y;
};
bool operator<(const pos_t& a,const pos_t& b){
return std::ma... | ALGO | 0.999824 | 5.767006 |
eaf9f68a-f8da-4cf4-a177-ab5d8a0154d6 | harshitgaur-b05/dsapractice | day7(linkedlist)/trappingrainwater.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution {
public:
int trap(vector<int>& a) {
int n = a.size();
int left = 0, right = n - 1;
int maxleft = 0, maxright = 0;
int res = 0;
while (left < right) {
if (a[left] <= a[right]) {
if (a[le... | ALGO | 0.999943 | 6.094226 |
d9e212d9-0a06-4fad-a108-320341f93c65 | Seirisiii/submit | programming/0037.cpp | #include<bits/stdc++.h>
using namespace std;
int n,m;
int l,k;
int c;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin>>n>>m;
cin>>l>>k;
cin>>c;
int cost=l*k*c;
for(int i=0;i<n;++i){
for(int j=0;j<m;++j){
int x;
cin>>x;
cost+=x;
... | ALGO | 0.999582 | 3.051979 |
4ecf32e3-9010-4adb-82fe-ed5b3366aaf0 | Shoumorup/KE-Lab | 6. Generalise.cpp | #include<bits/stdc++.h>
using namespace std;
bool isInm1(vector<int>& s,map<vector<int>,int>& m1)
{
for(map<vector<int>,int>::iterator it=m1.begin();it!=m1.end();it++)
{
int f=0;
for(int i=0;i<it->first.size();i++)
{
if(s[i]!=it->first[i])
{
f=1; break;
}
}
if(!f) return true;
}
return f... | ALGO | 0.998571 | 3.381152 |
68515f80-4a63-4775-a5bc-9c164f3b007f | shz1202/eigen_first | bench/perf_monitoring/trmv_upt.cpp | #include "gemv_common.h"
EIGEN_DONT_INLINE
void trmv(const Mat &A, Vec &B, const Vec &C)
{
B.noalias() += A.transpose().triangularView<Upper>() * C;
}
int main(int argc, char **argv)
{
return main_gemv(argc, argv, trmv);
}
| ALGO | 0.985884 | 4.898617 |
c734721d-1f40-4f57-8595-0d413efc2dc7 | khaledkamr/problem_solving | Assit sheets/Sheet #2 (Loops)/O - pyramid.cpp | #include<iostream>
#include<string>
#include<iomanip>
#include<algorithm>
#include<math.h>
using namespace std;
int main()
{
int x;
cin >> x;
for (int i = 0; i < x; i++)
{
for (int j = 0; j <= i; j++)
{
cout << "*";
}
cout << endl;
}
return 0;
} | ALGO | 0.999823 | 3.520632 |
26f74d75-441a-48a4-8ee6-9554de6ad481 | QIDITECH/QIDISlicer | src/libslic3r/Tesselate.cpp | #include "Tesselate.hpp"
#include <glu-libtess.h>
#include <algorithm>
#include <deque>
#include <utility>
#include <cassert>
#include <cstring>
#include "ExPolygon.hpp"
#include "admesh/stl.h"
class GLUtesselator;
namespace Slic3r {
class GluTessWrapper {
public:
GluTessWrapper() : m_tesselator(gluNewTess()) ... | ALGO | 0.944749 | 7.290547 |
49285ffc-707e-4472-bd5e-0bd00d2cc1a2 | ordinary-developer/education | cpp/std-11/b_sutherland-cpp_recipes/ch_08-the_stl_algorithms/recipe_8_06-sorting_elements_in_a_sequence/02-using_a_predicate_with_sort/main.cpp | #include <algorithm>
#include <iostream>
#include <vector>
bool IsGreater(int left, int right) {
return left > right;
}
int main() {
std::vector<int> myVector{ 10, 6, 4, 7, 8, 3, 9 };
std::sort(myVector.begin(), myVector.end(), IsGreater);
for (auto&& element: myVector)
std::cout << element <... | ALGO | 0.999822 | 5.083642 |
34d5b823-bfa8-4ae3-a584-50557128591e | pujakkar/Pujak | binaryTree14.cpp | #include<bits/stdc++.h>
using namespace std;
struct node{
int data;
node* left;
node* right;
node(int val){
data=val;
left=NULL;
right=NULL;
}
};
node* findLCA(node* root,int n1,int n2){
if(root==NULL){
return NULL;
}
if(root->data==n1 || root->data==n2)... | ALGO | 0.999991 | 4.290263 |
27ba9a31-c5f4-4500-bd75-8efa8c774f64 | sir-rasel/Online_Judge_Problem_Solve | toph/Easy/better-passwords.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
vector<char>pass;
string s;
cin>>s;
for(auto c=s.begin();c!=s.end();c++){
if(c==s.begin()) pass.push_back(toupper(*c));
else if(*c=='i') pass.push_back('!');
else if(*c=='s') pass.push_back('$');
else if(*c=='o') {... | ALGO | 0.939086 | 3.331803 |
0bde1132-3606-4132-8991-a99477911311 | du-felix/runde2 | auf2/code/cpp/test.cpp | #include <bitset>
#include <iostream>
int main(int argc, char const *argv[])
{
std::vector<bool> flags;
flags.resize(10, false);
for (size_t i = 0; i < flags.size(); i++)
{
flags[i] = true;
}
for (auto flag: flags) {
std::cout << flag << " ";
}
return 0;
}
| TOOL | 0.939618 | 3.436053 |
b948c30d-dbfe-4f31-9823-54d393c82878 | saursuri/DSA | LeetCode_Questions/Linked_List/237. Delete Node in a Linked List/Code.cpp | /*
Problem Link: https://leetcode.com/problems/delete-node-in-a-linked-list/description/?envType=daily-question&envId=2024-05-05
Time Complexity: O(1)
Space Complexity: O(1)
*/
class Solution {
public:
void deleteNode(ListNode* node) {
// Approach: Instead of deleting the currentNode
// Copy value f... | ALGO | 0.999729 | 6.58751 |
9e3c61f4-f167-4804-a88e-bbb36d8a564a | md-sazid9089/Cse_2208_data_Structure | bfs_dfs/print_leaf_recursion.cpp | #include<bits/stdc++.h>
using namespace std;
void dfs(int node,vector<vector<int>>& adj, vector<int>& visited, vector<int>& ans){
visited[node]=1;
bool isLeaf=true;
for(auto it:adj[node]){
if(!visited[it]){
isLeaf=false;
dfs(it,adj,visited,ans);
}
}
if(isLeaf) ans.push_back(node);
}
int main(... | ALGO | 0.999936 | 4.719341 |
b0032681-a0f8-4e87-bb44-95f1eeee8db3 | l3v11/Codeforces | 1475A. Odd Divisor.cpp | #include <algorithm>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>
using namespace std;
using ll = long long;
using ld = long double;
using str = string;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define mp make... | ALGO | 0.999316 | 5.654089 |
f3bf0c39-9949-40e9-ba1d-0f18d0f69d12 | shizenvillafane169/SchoolProject | src/22.cpp | #include <iostream>
using namespace std;
int main() {
int a = 5;
int b = 3;
int sum = a + b;
cout << "Sum: " << sum << endl;
return 0;
}
| TOOL | 0.951418 | 3.879362 |
c53a4e83-e7fe-46ab-8247-ebe6297e96c8 | raincross7/code-similarity | codes/train_code/problem416/problem416_4.cpp | // AtCoder Regular Contest 078
// E - Awkward Response
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
bool query(ll n) {
char c;
cout << "? " << n << endl;
cin >> c;
return c == 'Y';
}
int main() {
int d;
ll n, l... | ALGO | 0.999428 | 3.302667 |
040146bf-6a95-4f6c-aae5-a09cd5753ae0 | susantabiswas/Software-Interview-Essentials | Leetcode/Hashing/max-number-of-k-sum-pairs.cpp | /*
https://leetcode.com/problems/max-number-of-k-sum-pairs/
TC: O(n)
SC: O(n)
2 Sum solutions - Hashing, Sorting both can be used for solving this.
Idea is just to find the pairs and then exclude both the numbers.
*/
class Solution {
public:
int maxOperations(vector<int>& nums, in... | ALGO | 0.999959 | 6.655969 |
5764c0a8-bf2f-4309-a013-a82618186d67 | Arham689/DSA | 3447-clear-digits/clear-digits.cpp | class Solution {
public:
string clearDigits(string s) {
for(int i = 1 ;i < s.length() ; i++){
if(s[i] >= '0' && s[i] <= '9'){
s.erase(s.begin() +(i-1) , s.begin() + i+1) ;
i -= 2;
}
}
return s;
}
}; | ALGO | 0.998991 | 5.494098 |
252be993-e183-426b-afae-64b4e810ddcc | abednar0/optymalizacja9000 | opt_alg.cpp | #include "opt_alg.h"
solution
MC(matrix(*ff)(matrix, matrix, matrix), int N, matrix lb, matrix ub, double epsilon, int Nmax, matrix ud1, matrix ud2) {
try {
solution Xopt;
while (true) {
Xopt = rand_mat(N);
for (int i = 0; i < N; ++i)
Xopt.x(i) = (ub(i) - lb(... | ALGO | 0.999995 | 5.834605 |
6b789513-1c1f-4259-8814-e030162faec2 | bokusunny/atcoder-archive | atcoder.jp/abc164/abc164_d/Main.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
string S;
cin >> S;
map<int, int> M;
M[0]++;
int ans = 0, prev = 0, ten = 1;
for (int i = (int)S.size() - 1; i >= 0; i--) {
int cur = (prev + ten * (S[i] - '0')) % 2019;
ans += M[cur];
M[cur]++;
prev = cur;
ten = ten * 10 % 2019... | ALGO | 0.999604 | 4.986233 |
41d0b4fa-a472-4a51-a97b-1410a6102750 | SrjPdl/Maze-Generator-Solver | Maze/MazeSolver.cpp | #include "MazeSolver.h"
int32_t MazeSolver::shortestPathIndex = INT_MAX;
MazeSolver::MazeSolver(MazeGenerator& mazeGenerator)
:mazeGenerator(mazeGenerator),
adjacencyMatrix(mazeGenerator.getAdjacencyMatrix()),
mazeWidth(mazeGenerator.getMazeWidth()),
mazeHeight(mazeGenerator.getMazeHeight()),
startNode(Node(1... | ALGO | 0.999683 | 5.865196 |
1425846d-5170-4e8d-a2cf-9a9287648cef | thisismr900/CodeForces_Contests | 6. Codeforces Round 918 (Div. 4)/A. Odd One out.cpp | #define MOD 1000000007
#define ll long long
#include<bits/stdc++.h>
using namespace std;
int main()
{
ll tt;
cin>>tt;
while(tt--){
ll a,b,c;
cin>>a>>b>>c;
if(a==b)
cout<<c;
else if(a==c)
cout<<b;
else cout<<a;
cout<<endl;
}... | ALGO | 0.999979 | 4.486214 |
ab5f3c4c-4b4b-4834-a3de-c3218b9eb8d4 | hackybacky/my-leet | 234-palindrome-linked-list/234-palindrome-linked-list.cpp | /**
* 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, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
ListNode * tmp;
b... | ALGO | 0.999961 | 5.68126 |
e2e89ed6-3522-40c5-9e50-ed330fca90cf | Ronny-22-Code/C-Plus-Plus-Programming-Codes | EvenSquare.cpp | //This program is to display the square of the even numbers.
#include<iostream>
using namespace std;
int main()
{
int a[10],i,n;
cout<<"Enter the number of elements:";
cin>>n;
cout<<"Enter the array elements";
for(i=0;i<n;i++)
{
cin>>a[i];
}
for(i=0;i<n;i++)
{
if((a[i]%2)==0)
{
... | ALGO | 0.986 | 3.296773 |
c1e9696f-e185-462e-b262-d20c32689b8e | PrashamModi/gfg | Difficulty: Easy/Sort a k sorted doubly linked list/sort-a-k-sorted-doubly-linked-list.cpp | //{ Driver Code Starts
// Initial Template for C++
#include <bits/stdc++.h>
using namespace std;
// a node of the doubly linked list
class DLLNode {
public:
int data;
DLLNode *next;
DLLNode *prev;
DLLNode(int val) {
data = val;
this->next = NULL;
this->prev = NULL;
}
};
... | ALGO | 0.999891 | 6.11815 |
adb1e27c-41bb-416f-8db6-393524535a6d | Nakib-Arman/CSE318---ArtificialIntelligence | 3.ChainReaction/.history/main_20250610083239.cpp | #include <bits/stdc++.h>
using namespace std;
class Cell {
int orb_num;
int critical_mass;
char color;
public:
Cell() {
this->orb_num = 0;
this->color = 'W';
this->critical_mass = 4;
}
// Cell(int orb_num, char color) {
// this->orb_num = orb_num;
// t... | ALGO | 0.99881 | 4.746616 |
b964a06e-d2f3-4e5a-99ac-789cb9fc8e12 | mikolaj-paz/E-media-projekt-1 | src/rsa.cpp | #include <iostream>
#include <math.h>
#include <vector>
#include <rsa.hpp>
#include <cryptopp/osrng.h>
#include <cryptopp/integer.h>
using namespace CryptoPP;
void RSA::generate_keys(Integer& n, Integer& d, Integer& e) {
AutoSeededRandomPool rng;
AlgorithmParameters params = MakeParameters("BitLength", 1024)... | ALGO | 0.99795 | 6.724413 |
d103b556-b08e-4ea5-a066-32c41f171b59 | Mohamedselim2/ProblemSolving | Random/Team.cpp | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main()
{
long long x , sum=0 ;
cin >> x ;
for (long long c=1 ; c<=x ; c++)
{
int p1 , p2 , p3 ,ic=0 ;
cin >> p1 >> p2 >>p3 ;
if (p1==1) ic++ ;
if (p2==1) ic++ ;
if (p3==1) ic++ ;
if (ic>=2) sum++ ;
}
cout << sum ;
} | ALGO | 0.999711 | 3.705601 |
956d7c90-1153-45d9-ae6c-2b70bd2bf6a4 | Torugo-Tozzo/Facul-Things | ARVORES/Azeite-Ultimate-Deluxe/main.cpp | /*----------------------------------------------------------------------------------------------*
Victor Hugo Tozzo Filho - 2020.1.08.018
Pedro Henrique Alves Barbosa - 2022.1.08.043
Rafael Silva Fortuna- 2022.1.08.026
------------------------------------------------------------------------------------------------... | ALGO | 0.997384 | 4.86747 |
dc144f54-6de3-4c4f-aa69-b47f3c5ea7f6 | riiziill/unit_6_assignment_despi | 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 |
3607cb0d-b885-446b-b107-f74482652623 | alexandraback/datacollection | solutions_5648941810974720_0/C++/dancho/a.cpp | #include <cmath>
#include <cstdio>
#include <cstring>
#include <vector>
#include <string>
using namespace std;
const double EPS = 1e-6;
const int INF = 1000000000;
int gauss (vector < vector<double> > a, vector<double> & ans) {
int n = (int) a.size();
int m = (int) a[0].size() - 1;
vector<int> where (m, -1);
fo... | ALGO | 0.999866 | 4.752696 |
9eae8440-49bc-4022-b117-4eb504a88a92 | yomcong/Programmers | 2630-colorpaper.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
using namespace std;
int White(int arr[], const int c, int t, int y, int x)
{
for (int i = y; i < (t + y); ++i)
{
for (int j = x; j < (t + x); ++j)
{
if (arr[(i * c) + j] != 0)
{
if (t == 1)
... | ALGO | 0.999589 | 4.179602 |
f293a8e6-5e2e-4c1c-a3d5-0d300af0e632 | sujallimje/codeforces | 1. Learn a language/45.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
long long sum=0,temp;
for(int i=0;i<n;i++){
cin>>temp;
sum+=temp;
}
cout<<abs(sum);
return 0;
} | ALGO | 0.999878 | 3.58034 |
e063947d-5ebe-4e0c-af3f-6b469038dd04 | hadeer-r/LeetCode | 0143-reorder-list/0143-reorder-list.cpp | /**
* 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, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
void reorderList(List... | ALGO | 0.999986 | 5.962662 |
59b6dc35-bcdb-417c-ab92-cea63e0f68d4 | rohmish2/spoj_solutions | SPOJSOLUTIONS/PRISMSA.cpp | // Problem: PRISMSA
// Submission ID: 25869989
// Language: 4780
#include<bits/stdc++.h>
using namespace std;
double cuberoot(double a)
{ double l=0.0,h=a,q=2,mid=(l+h)/q,t;
// cout<<l<<" "<<h<<" "<<mid;
while(h-l>1.e-6)
{ mid=(l+h)/q;
// cout<<"sex\n";
//cout<<endl<<1<<" "<<mid;
t=mid*mid*mid;
if(... | ALGO | 0.998969 | 3.976843 |
b5c907ba-2719-4e14-85e9-38b5316fd74b | Cobb-Yoo/Algorithms | BOJ/15665 n과 m(11)/15665 n과 m(11).cpp | #include <iostream>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;
map<int,int> numCnt;
int answer[7];
vector<int> v;
int n,m;
void bfs(int idx, int cnt){
if(cnt == m){
for(int i=0;i<m;i++) cout << answer[i] << " ";
cout << "\n";
return;
}
for(int i=0;i<v.size();i++){
answer[i... | ALGO | 0.999991 | 4.04479 |
ab78706a-3f32-40fa-92ed-943850db4809 | dandanJing/leetcode | leetcode/leetcode_new/leetcode_new/LRU_cache_146.cpp | #include"top.h"
typedef struct _Node_{
int key; //
int value; //
struct _Node_ *next; //һڵ
struct _Node_ *pre; //һڵ
}CacheNode;
class LRUCache{
private:
int cache_size_; //cache
int cache_real_size_; //Ŀǰʹõij
CacheNode *p_cache_list_head; //ͷڵָ
CacheNode *p_cach... | ALGO | 0.999394 | 3.901822 |
d98997c8-d1b7-45c4-9728-53697eb2bba1 | Romeo-Aryal/C-program-fest2022 | linked_list.cpp | #include<stdio.h>
#include<stdlib.h>
#include<conio.h>
struct Node{
int data;
struct Node * next;
};
struct Node * tail;
int count_nodes(){
if(tail == 0){
return 0;
}
else{
int count = 0;
struct Node *temp = tail->next;
while(temp!=tail){
temp= temp->next;
count += 1;
}
return co... | ALGO | 0.999603 | 3.79783 |
7ac594df-081d-405f-bf58-b021dfa7c1ab | bravol/Seven_flutter_projects_for_beginners | flutter_internals/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.998282 | 6.76073 |
05d26bbf-f40d-4500-86ce-cfd594d9b3b6 | aryan-palkar/CP-DSA | Contests/CF_Educational_122(div2)/B_Minority.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
int t;
cin>>t;
while(t--){
string s;
cin>>s;
int a0 = 0, a1 = 0;
for(char c : s){
if(c == '0'){
a0++;
}else{
... | ALGO | 0.999985 | 4.54715 |
3b358a68-387b-48f5-8189-d349e00f8e55 | 0xm4yo/compro | atcoder/virtual/virtual20240118-20240131/3.cpp | #include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
using ull = unsigned long long;
template <class T> using priority_queue_rev = priority_queue<T, vector<T>, greater<T>>;
#define rep(i, a, b) for(ll i=a; i<b; i++)
#define rrep(i, a, b) for(ll i=a; i>=b;... | ALGO | 0.999938 | 5.27424 |
26ed31ac-bcff-44c7-8cc7-97692ee60938 | bhaviknetam/dsa_with_cpp | 3055-maximum-odd-binary-number/maximum-odd-binary-number.cpp | class Solution {
public:
string maximumOddBinaryNumber(string s) {
string ans="";
int count =0;
for(int i=0; i < s.size(); i++){
if(s[i]=='1') count++;
}
int k = s.size() - count;
while(count > 1){
ans.push_back('1');
count--;
... | ALGO | 0.999996 | 5.843112 |
a0731fa2-4546-4cc3-8bb2-3cd76e7036ab | CKlittleluck/C | 11-29/11-29/test.cpp | #include<iostream>
using namespace std;
#include<vector>
#include<string>
#include<algorithm>
//class Solution {
//public:
// int StrToInt(string str) {
// int length = str.length();
// if (length < 1)
// {
// return 0;
// }
// }
//};
//int func()
//{
// int i, j, k = 0;
// for (i = 0, j = -1; j = 0; i++, j+... | ALGO | 0.999867 | 4.816475 |
8293320c-d33b-44a0-a4c0-29b579ab51d8 | geoffcline/CS2500_proj2 | NodeDistances.cpp | // Alex Marey, Tyler Percy, Geoffrey Cline
// Project 2
// NodeDistances.cpp
#include "NodeDistances.h"
#include <fstream>
int minDistance(int* distance, bool sptSet[], const int V)
{
// Initialize min value
int min = INT_MAX, min_index(0);
for (int v = 0; v < V; v++)
if (sptSet[v] == false &... | ALGO | 0.999184 | 4.281662 |
62a8da33-217b-4d5f-a50d-72cfa8d26ed4 | peterjumper/neetcode | neetcode-main ans/cpp/0013-roman-to-integer.cpp | /*Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M.
Symbol Value
I 1
V 5
X 10
L 50
C 100
D 500
M 1000
For example, 2 is written as II in Roman numeral, just two ones added together. 12 is written ... | ALGO | 0.999812 | 6.215531 |
0002f465-b202-4ffa-9e1d-ab32d807ed95 | yinheyi/LeeCode | leeCode/91_解码总数.cpp | class Solution {
public:
int numDecodings(string s) {
if (s.empty()) {
return 0;
}
int pp = 1;
int p = s[0] > '0' ? 1 : 0;
for (size_t i = 1; i < s.size(); ++i) {
int cur = s[i] > '0' ? p : 0;
const int val = (s[i-1] - '0') * 10 + s[i] - '0... | ALGO | 0.999923 | 6.131321 |
d8858311-b1de-4b0f-bd05-85d8b9b85b28 | uwafsl/TRAPIS2 | libraries/AP_Math/matrix3.cpp | #pragma GCC optimize("O3")
#include "AP_Math.h"
// create a rotation matrix given some euler angles
// this is based on http://gentlenav.googlecode.com/files/EulerAngles.pdf
template <typename T>
void Matrix3<T>::from_euler(float roll, float pitch, float yaw)
{
float cp = cosf(pitch);
float sp = sinf(pitch);
... | ALGO | 0.993234 | 6.478196 |
008b34bf-e7b1-4e62-b85b-18fa4f211e9a | itish-agarwal/CP-submissions | Atcoder/C++ (GCC 9.2.1)/dp_o/19392189.cpp | #include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int nax = 21;
int n, a[nax][nax];
int dp[nax][(1<<nax)];
void add_self(int& a, int b) {
a += b;
if(a >= mod) {
a -= mod;
}
}
int ways(int id, int mask) {
//mask is for women that are paired;
if(id==n) {
return 1;
}
if... | ALGO | 0.999978 | 4.055852 |
909b3b51-b6bb-4ce1-a8a5-589f7f4b864a | BREAK350/myCProgram-old | Мої/збереження графічної моделі у файл/нове/нове/Draw3D.cpp | //---------------------------------------------------------------------------
#pragma hdrstop
#include "Draw3D.h"
//---------------------------------------------------------------------------
int X,Y,i,j,er;
unsigned short int n1,n2;
float Front=100;
//-------------------------------------------------------------------... | TOOL | 0.954486 | 4.207398 |
c237a952-829b-4b46-99f4-3efc8ef4bcf1 | astitva3377/dsacollab | tiling.cpp | #include<bits/stdc++.h>
using namespace std;
/*
Given a board of 2xN and tiles of size 2x1. Count the number of ways to tile the board.
*/
int count(int n) {
if(n == 0 || n == 1) return n;
return (count(n-1)+count(n-2));
}
int main() {
int n;
cin >> n;
count(n);
return 0;
} | ALGO | 0.999931 | 4.713748 |
332295d0-bec9-4754-afdf-584b6dea227b | jewelzqiu/opencv-android-library | opencv/3rdparty/carotene/src/blur.cpp | #include <vector>
#include "common.hpp"
#include "saturate_cast.hpp"
namespace CAROTENE_NS {
bool isBlur3x3Supported(const Size2D &size, BORDER_MODE border)
{
return isSupportedConfiguration() && size.width >= 8 &&
(border == BORDER_MODE_CONSTANT ||
border == BORDER_MODE_REPLICATE);
}
void b... | ALGO | 0.997407 | 6.554525 |
d99827c0-c060-446c-b044-4b01e2260f7e | xbackupx/Infinity_WoW_0.1a_Prototype | src/bindings/SD2/scripts/northrend/ulduar/halls_of_stone/boss_sjonnir.cpp | /* ScriptData
SDName: Boss_Sjonnir
SD%Complete: 20%
SDComment:
SDCategory: Halls of Stone
EndScriptData */
#include "precompiled.h"
#include "halls_of_stone.h"
enum
{
SAY_AGGRO = -1599000,
SAY_SLAY_1 = -1599001,
SAY_SLAY_2 = -1599002,
SAY_SLAY_3 ... | TOOL | 0.885629 | 4.33346 |
dfb950e4-016c-44c3-9da3-26118b441086 | ishandutta2007/codeforces | chemthan/normal/490/E.cpp | #ifndef ONLINE_JUDGE
#include <iostream>
#include <iomanip>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#else
#include <bits/stdc++.h>
#endif
using namespace std;
#define ms(s, n) memset(s, n, sizeof(s))
#define FOR(i, a, b) for(int i = a; i < b;... | ALGO | 0.999995 | 3.396789 |
6abef881-2452-4747-8cf4-9d48d224dae8 | everXXfor/C-Cpp-Code | leetcode/dp/基础题目/96/96.cpp | #include<bits/stdc++.h>
using namespace std;
class Solution {
public:
int numTrees(int n)
{
vector<int> dp(n + 1, 0); // 区间长度为i的dp[i]种不同的二叉搜索的种数,
// 如 dp[3] 可以是 1,2,3 的二叉搜索树,也可以是 2,3,4 的搜索树的种数
dp[0] = 1;
for (int i = 1;i <= n;i++)
for (int j = 1;j <= i;j++)
... | ALGO | 0.99999 | 5.225441 |
277bd9c6-e7bf-4a70-9c68-27ad4536b630 | NafizEkbal/Codeforces-Solutions | 1771_A_HossamandCombinatorics.cpp | #include<bits/stdc++.h>
using namespace std;
int main() {
int t;
cin>>t;
while(t--){
int n;
cin>>n;
int a[n];
for(int i=0;i<n;i++){
cin>>a[i];
}
sort(a,a+n);
int big=a[0];
int small=a[n-1];
int nbig=count(a,a+n,big);
... | ALGO | 0.999658 | 3.680014 |
bd603e90-5e13-4384-94b4-d6382626b59b | Mahmoud-s-Khedr/neetCode150 | generateParenthesis.cpp | class Solution {
vector<string>ans;
public:
void dfs(string s,int open,int close){
if(open>0){
dfs(s+"(",open-1,close);
}
if(close>0&&open!=close){
dfs(s+")",open,close-1);
}
if(open==0&&close==0){
ans.push_back(s);
}
}
... | ALGO | 0.99984 | 6.33531 |
daa14d18-7f13-4bae-9ef4-cfc8d27165ff | kalashkose0/MD-Retailer | md_retailer/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.998726 | 6.76775 |
acd6737b-a152-4b1d-9111-22b05a6a8125 | mandarine3ds/mandarine | src/video_core/renderer_software/sw_clipper.cpp | #include <array>
#include <cstddef>
#include <tuple>
#include "video_core/pica/regs_texturing.h"
#include "video_core/renderer_software/sw_clipper.h"
namespace SwRenderer {
using Pica::TexturingRegs;
void FlipQuaternionIfOpposite(Common::Vec4<f24>& a, const Common::Vec4<f24>& b) {
if (Common::Dot(a, b) < f24::Ze... | ALGO | 0.956847 | 6.877463 |
805b8b5e-880d-4428-9c5e-87c77ec094df | RobertGuerra/c_plus_plus | find_sum_recursively.cpp | /*
Recursion: Sum
Write a function that finds the sum of the first n natural numbers. Make your function recursive.
*/
#include <iostream>
using namespace std;
int sum(int n) {
if (n < 0)
return 0;
else
return n + sum(n - 1);
}
int main()
{
int num = 0;
cout << "Enter an number any number: ";
cin >> num;
... | ALGO | 0.999578 | 5.500099 |
e3b05f0f-bb74-4575-bd9e-8502c38bfcdf | truongnh16072000/C- | contest4/bai24.cpp | #include<iostream>
using namespace std;
typedef long long ll;
#define modulo 123456789;
ll n;
ll result(ll n)
{
if (n==0)
return 1;
ll temp = result(n/2);
temp%=modulo;
ll result = (temp * temp)%modulo;;
if (n%2==0)
return result;
else
return (2*result)%modulo;
}
int... | ALGO | 0.999943 | 4.505812 |
85c50daa-b6c6-4c86-9eb8-479ae28d53c1 | AhmetBoraBolat/To_Do-App | 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 |
3eecc877-0dd6-428f-a54b-318365493f5e | ishandutta2007/codeforces | turmax/normal/1656/F.cpp | #pragma GCC optimize("O3","Ofast","unroll-loops")
#pragma GCC target("avx2")
#include <bits/stdc++.h>
using namespace std;
#define int long long
int32_t main()
{
ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
int t;
cin>>t;
while(t--)
{
int n;
cin>>n;
int a[n];
... | ALGO | 0.999932 | 4.255188 |
a1a2b140-52ff-486f-ad23-bbd8a13ab529 | alittlekitten/AlgorithmStack | Baekjoon/Cpp/Arithmetic/B3_10179_쿠폰.cpp | #include <iostream>
#include <cmath>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
// 10179 쿠폰
// 수학
int n;
double price;
cin >> n;
cout << fixed;
cout.precision(2);
for (int i = 0; i < n; ++i) {
cin >> price;
cout << "$" << round(price * 100) * 0.8 ... | ALGO | 0.998329 | 4.574347 |
aa51592c-ed46-45c7-a2c8-ff9769837934 | imjnnanna/USACO-solutions | Gold/sandcas.cpp | /*
#include <iostream>
#include <algorithm>
using namespace std;
int n, x, y, a[25005], b[25005];
int main() {
cin >> n >> x >> y;
for(int i = 0; i < n; i++) cin >> a[i] >> b[i];
int cost = 0;
sort(a, a + n);
sort(b, b + n);
for(int i = 0; i < n; i++) {
if(a[i] < b[i]) cost += (b[i] - a[... | ALGO | 0.999773 | 3.451026 |
6407883c-dec0-4a75-a343-62e410b024a6 | sadorrab/personal-3d-game-engine | src/test/TestCollisions.cpp | #include <stdio.h>
#include <stdlib.h>
#include "../main/Collisions.hpp"
bool testDirectionToOrigin();
bool testOriginEnclosed();
bool testColliding();
bool testSupportFunction();
int main() {
int success =
testDirectionToOrigin() +
testOriginEnclosed() +
testSupportFunction() +
te... | TEST | 0.927314 | 5.821834 |
2ff327c6-ee9b-43fb-8cd5-ef007a754eb8 | shivansh9848/CSES | Introductory Problems/Gray_Code.cpp | #include <bits/stdc++.h>
using namespace std;
vector<string> generateGray(int n)
{
if (n <= 0)
return {"0"};
if (n == 1)
{
return {"0", "1"};
}
vector<string> recAns =
generateGray(n - 1);
vector<string> mainAns;
for (int i = 0; i < recAns.size(); i++)
{
... | ALGO | 0.999948 | 4.775039 |
525d5519-1f33-4f40-b8cc-43efe45c9c4c | tej0kk/dev-C- | Kattis/I've Been Everywhere, Man.cpp | /*#include <stdio.h>
#include <string.h>
int main(){
int cases;
int cities;
char name[25][25];
scanf("%d", &cases);
getchar();
for(int i=0; i<cases; i++){
scanf("%d", &cities);
getchar();
int count = 1;
int temp = 0;
for(int j=0; j<cities; j++){
scanf("%s", &name[j]); getchar();
}
for(int j=0;... | ALGO | 0.999903 | 3.467622 |
7930569d-37f8-4328-99d9-914c4395dd6a | ZJUBCA/eosio-dapp-boilerplate | libc++/upstream/test/std/containers/associative/set/find.pass.cpp | // <set>
// class set
// iterator find(const key_type& k);
// const_iterator find(const key_type& k) const;
#include <set>
#include <cassert>
#include "test_macros.h"
#include "min_allocator.h"
#include "private_constructor.hpp"
int main()
{
{
typedef int V;
typedef std::set<int> M;
{
... | TEST | 0.86673 | 4.399806 |
4a5bff73-2766-48dd-a431-4cff75bb551b | noureldin-khaled/workspace | C++/UVA/Prime Ring Problem.cpp | #include <bits/stdc++.h>
using namespace std;
int n;
bool prime[33];
bool used[33];
int res[17];
void rec(int num, int k);
int main()
{
memset(prime, false, sizeof prime);
prime[2] = prime[3] = prime[5] = prime[7] = prime[11] = prime[13] = prime[17] = prime[19] = prime[23] = prime[29] = prime[31] = true;
int t = ... | ALGO | 0.999843 | 3.838184 |
64c1e483-2c1a-490c-ab40-e17a17f995bc | PurpleBote/pboted | src/EmailWorker.cpp | #include <ctime>
#include <iterator>
#include <openssl/sha.h>
#include <utility>
#include <vector>
#include "BoteContext.h"
#include "DHTworker.h"
#include "EmailWorker.h"
namespace bote
{
EmailWorker email_worker;
EmailWorker::EmailWorker ()
: m_main_started (false),
m_worker_thread (nullptr),
m_send_thr... | TOOL | 0.937056 | 6.47011 |
ce60eadc-b9bb-421d-98bf-0cdfc15d688a | vishnujayvel/practicecodes | ACM6/q2.cpp | #include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ct... | ALGO | 0.999964 | 4.088813 |
9c819b52-0562-43ec-bebd-413c635850f7 | ProgramTraveler/leetcode | Leetcode_Question/105.从前序与中序遍历序列构造二叉树.cpp | class Solution {
private:
unordered_map<int, int> index;
public:
TreeNode* myBuildTree(const vector<int>& preorder, const vector<int>& inorder, int preorder_left, int preorder_right, int inorder_left, int inorder_right) {
if (preorder_left > preorder_right) {
return nullptr;
}
... | ALGO | 0.999992 | 6.502775 |
36c07949-fdfa-4c09-9d63-0373b664d447 | tu-27-6/code-C-PTIT | modulo11.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll modulo11(ll a, ll b, ll c) {
if (b==0) {
return 0;
}
ll s=modulo11(a, b/2, c);
s=(2*s)%c;
if (b%2!=0) {
s=(s+a)%c;
}
return s;
}
int main() {
int t;
cin>>t;
while(t--) {
ll a, b, c;
cin>>a>>b>>c;
cout<<modulo11(a, b, ... | ALGO | 0.999761 | 5.005665 |
860f9290-a412-4a2f-b540-fb62b35bff51 | gem5-X/gem5-X | src/systemc/tests/systemc/misc/unit/data/datawidth_unsigned/promote_extension/datawidth.cpp | /*****************************************************************************
datawidth.cpp --
Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
*****************************************************************************/
/**************************************************************************... | ALGO | 0.965385 | 5.331775 |
4885a4fa-7c02-4d2e-9cd4-7803770beeff | rilato/Baekjoon | cpp/알고리즘별/Combination/15661(링크와_스타트).cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int N;
int gap = 2100000000;
vector <vector <int>> v;
vector <int> start;
vector <bool> visited;
void Combination(int depth, int num, int m);
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
cin ... | ALGO | 0.999883 | 3.896733 |
b74b5488-251d-4096-a6b6-9e5c2eb982bf | jwl-7/leetcode-cheatsheet | src/code/cpp/binary_search/duplicate_elements_right_insertion.cpp | #include <vector>
using namespace std;
int fn(vector<int>& arr, int target) {
int left = 0;
int right = arr.size();
while (left < right) {
int mid = left + (right - left) / 2;
if (arr[mid] > target) {
right = mid;
} else {
left = mid + 1;
}
}
... | ALGO | 0.999881 | 6.086475 |
dc51d837-27e2-4b04-8c71-3de6628f683b | 113bommy/LogicalErrorFixCodeT5 | logicalErrorFix_CodeT5_Linenumber/model/cpp/CodeT5_LineNumber_cpp_source/Problem_60_source_331.cpp | #include <bits/stdc++.h>
#pragma gcc optimize("Ofast,no-stack-protector,tune=native")
#pragma gcc optimize("sse,sse2,sse3,sse4,ssse3")
#pragma gcc optimize("O3")
#pragma gcc optimize("abm,mmx,avx,avx2,unroll-loops,fast-math,section-anchors")
#pragma GCC target("avx,avx2")
const long long inf = 1e18, mod = 1e9 + 9, N = ... | ALGO | 0.999876 | 4.405349 |
db3a7a9a-e265-4c6e-b40e-1b6b6d0815aa | Euphoria-OS-Legacy/android_frameworks_av | media/libstagefright/codecs/mp3dec/src/pvmp3_dct_16.cpp | /*
------------------------------------------------------------------------------
PacketVideo Corp.
MP3 Decoder Library
Filename: pvmp3_dct_16.cpp
Functions:
dct_16
pv_merge_in_place_N32
pv_split
Date: 09/21/2007
-------------------------------------------------------------------------... | ALGO | 0.998539 | 4.896559 |
489606a1-47a8-4912-abb6-914448132d01 | wilsoc5/AOC2024 | day02cpp/main.cpp | #include <iostream>
#include <string>
#include <vector>
#include <fstream>
#include <algorithm>
#include <iterator>
#include <sstream>
#include <numeric>
using namespace std;
template<typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T>& v){
for (auto&& vi : v){
os <<vi <<" ";
}
return os... | ALGO | 0.989468 | 4.965977 |
6a2e8e0f-c812-4f77-825b-69d96181998b | immortalmin/ZOJ | 1495.cpp | #include<iostream>
#include<cstdio>
#include<string>
#include<cmath>
#include<algorithm>
#include<map>
#include<vector>
using namespace std;
int main() {
// freopen("1.txt","r",stdin);
int n,a[200];
while(scanf("%d",&n)){
if(n==0) break;
for(int i=1;i<=n;i++){
cin>>a[i];
}
int k=n,k2=0;
for(int i=1;i<=n;... | ALGO | 0.999819 | 3.472037 |
b5700edd-8aed-4f6e-8e50-abc2c25d40a3 | shervindadashzade/algorithm_trainning | stack/main.cpp | #include<iostream>
using namespace std;
struct node{
struct node *next;
struct node *prev;
int value;
};
class Stack{
int length = 0;
struct node *top;
public:
bool isEmpty(){
if(length == 0)
return true;
else
return false;
}
void push(int val){
struct node *node = new struct node;
node->valu... | ALGO | 0.997642 | 4.16095 |
3b4befbf-09ee-4976-bca3-1de957ea7466 | pulavartivinay/Competitive-Programming | Permutations.cpp | Question Link: https://leetcode.com/problems/permutations/
Solution:
void DFS(int i,vector<vector<int>>& ans,vector<int> temp,int n,vector<bool>& vis,vector<int>& nums,int count)
{
if(i<0 or i>n) return;
if(vis[i]) return;
vis[i] = 1;
temp.push_back(nums[i]);
if(count == n-1) ans.push_back(temp);... | ALGO | 1 | 7.0519 |
50852d56-a702-44b7-86b0-89133460c4a1 | rasulzhan/Hermetic-server | libs/boost/algorithm/test/find_backward_test.cpp | #include <iostream>
#include <boost/algorithm/find_backward.hpp>
#define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>
#include <vector>
#include <list>
namespace ba = boost::algorithm;
template <typename Container>
struct dist_t
{
dist_t(Container & cont) : cont_(cont) {}
template<typename Iter>
... | TEST | 0.859312 | 6.945155 |
787d2e6b-3b33-4fab-bda1-a8271123649e | rickymcmuffin/Synthematics | src/JUCE/modules/juce_gui_basics/layout/juce_FlexBox.cpp | namespace juce
{
struct FlexBoxLayoutCalculation
{
using Coord = double;
enum class Axis { main, cross };
FlexBoxLayoutCalculation (FlexBox& fb, Coord w, Coord h)
: owner (fb), parentWidth (w), parentHeight (h), numItems (owner.items.size()),
isRowDirection (fb.flexDirection == FlexBox:... | TOOL | 0.963076 | 7.110122 |
1bdb0c46-6536-4c5e-80c4-40d0dfc37c7c | MaheshSharan/LeetCode_Automation | solutions/0400-0499/0498.Diagonal Traverse/Solution.cpp | class Solution {
public:
vector<int> findDiagonalOrder(vector<vector<int>>& mat) {
int m = mat.size(), n = mat[0].size();
vector<int> ans;
vector<int> t;
for (int k = 0; k < m + n - 1; ++k) {
int i = k < n ? 0 : k - n + 1;
int j = k < n ? k : n - 1;
... | ALGO | 0.999997 | 6.410528 |
200f544c-ce07-49ba-9292-da26be8d1604 | William957-web/Programming-Problem-Solving | Daily/dikstra 最短路徑.cpp | #include<bits/stdc++.h>
using namespace std;
#define wh_ale ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define int long long
#define INF 1e18
#define pii pair<int, int>
#define psb push_back
vector<pii> g[100009];
int dis[100009];
int n, m, s, t;
pii r;
int pt;
int vis[100009]={};
priority_queue<pii, vector<pii>, g... | ALGO | 0.999916 | 4.698935 |
fba8789b-0667-4296-8cac-f91112066300 | senthilnathan01/DSA | Basics/Problems/Strings/string_to_integer_atoi.cpp | #include<iostream>
#include <climits>
using namespace std;
/*
Implement the myAtoi(string s) function, which converts a string to a 32-bit signed integer.
The algorithm for myAtoi(string s) is as follows:
Whitespace: Ignore any leading whitespace (" ").
Signedness: Determine the sign by checking if the next chara... | ALGO | 0.999426 | 5.301991 |
2931d274-bba3-4d9f-824b-276026b869b4 | zhuminjie/OpenSeesPy | SRC/reliability/analysis/direction/PolakHeSearchDirectionAndMeritFunction.cpp | // $Revision: 1.4 $
// $Date: 2008-02-29 19:47:19 $
// $Source: /usr/local/cvs/OpenSees/SRC/reliability/analysis/direction/PolakHeSearchDirectionAndMeritFunction.cpp,v $
//
// Written by Terje Haukaas (<EMAIL>)
//
#include <PolakHeSearchDirectionAndMeritFunction.h>
#include <SearchDirection.h>
#include <MeritFunctio... | ALGO | 0.999887 | 6.676285 |
8389ae2e-b92d-4d3b-9112-b58c9a49b443 | denisigo/fireprime_frameworks_base | tools/split-select/Main.cpp | #include <algorithm>
#include <cstdio>
#include "aapt/AaptUtil.h"
#include "Grouper.h"
#include "Rule.h"
#include "RuleGenerator.h"
#include "SplitDescription.h"
#include "SplitSelector.h"
#include <androidfw/AssetManager.h>
#include <androidfw/ResourceTypes.h>
#include <utils/KeyedVector.h>
#include <utils/Vector.h... | TOOL | 0.978914 | 6.459566 |
166dd36e-2765-4f9c-ac1a-fb117ed51d8e | privateLLM001/Private-LLM-Inference | OpenCheetah/SCI/extern/eigen/unsupported/doc/examples/PolynomialUtils1.cpp | #include <unsupported/Eigen/Polynomials>
#include <iostream>
using namespace Eigen;
using namespace std;
int main()
{
Vector4d roots = Vector4d::Random();
cout << "Roots: " << roots.transpose() << endl;
Eigen::Matrix<double,5,1> polynomial;
roots_to_monicPolynomial( roots, polynomial );
cout << "Polynomial:... | ALGO | 0.996324 | 4.015535 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.