uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
816c9571-b8b6-4f7e-8fac-af9a4f73bdc5 | KazuhoSAKAOKA/leetcode | leetcode_Q3189/leetcode_Q3189.cpp | // leetcode_Q3189.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include "./../utility/leetcode_testcase_helper.h"
using namespace std;
class Solution {
public:
int minMoves(vector<vector<int>>& rooks) {... | ALGO | 0.999395 | 6.167034 |
f602fd9b-e926-4a99-9438-1c3b3fbf307f | Cheshulko/Competitive-programming | Leetcode/Permutations.cpp | class Solution {
public:
vector<vector<int>> permute(vector<int>& nums) {
sort(nums.begin(), nums.end());
vector<vector<int>>ans;
if(nums.size() == 0) return ans;
ans.push_back(nums);
while(1){
bool done = 0;
for(int j = nums.size() - 2; j >= 0 && !don... | ALGO | 0.999999 | 6.047895 |
7bd56235-d307-4f60-a613-c6aed4872e65 | raincross7/code-similarity | codes/train_code/problem311/problem311_466.cpp | #include <bits/stdc++.h>
using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod= int(1e9)+7;
//const int mod=998244353;
using P = pair<int,int>;
using Pll = pair<ll,ll>;
using ld=long double;
using V=vector<int>;
using Vl=vector<ll>;
using ... | ALGO | 0.999926 | 5.037385 |
cf94d2c0-b8c6-4066-bc28-dbcff79dc216 | Telurt/URI-online-judge | 1747.cpp | #include <bits/stdc++.h>
using namespace std;
// function for mdc
int mdc(int n1, int n2)
{
int resto= n1%n2;
while(resto)
{
n1 = n2;
n2 = resto;
resto = n1%n2;
}
return n2;
}
// principal function
int main()
{
int aux,a,b,i, n_vert, n_arest;
cin... | ALGO | 0.999698 | 3.744262 |
65542b46-975d-4d37-a7a6-11d05dc6fd0a | hhovakimyann/STL | Algorithmns/sort_algorithms/counting_sort.cpp | #include <iostream>
#include <vector>
std::vector<int> counting_sort(std::vector<int>& vec) {
int size = vec.size();
int max = 0;
for(int i = 0; i < size; i++) {
max = std::max(max,vec[i]);
}
std::vector<int> counting(max);
for(int i = 0; i < size; i++) {
counting[vec[i]]++;
... | ALGO | 0.999978 | 5.6216 |
565d2720-5a57-4129-b840-5dabcace3ae2 | Edemolt/CrackYourInternship | day26/The Celebrity Problem.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:
// Function to find if there is a celebrity in the party or not.
int celebrity(vector<vector<int> >& mat) {
// code here
... | ALGO | 0.999677 | 6.028055 |
719d494a-5939-4918-a4ae-9de648ef1cdb | sqiemanqieman/Leetcode-vscode | header/583.两个字符串的删除操作.cpp | /*
* @lc app=leetcode.cn id=583 lang=cpp
*
* [583] 两个字符串的删除操作
*/
// @lc code=start
#ifdef RUN_IN_LOCAL
#include "common.h"
#endif
#include <bits/stdc++.h>
using namespace std;
class Solution {
public:
int minDistance(string word1, string word2) {
vector<vector<int>> dp(word1.size()+1, vector<int>(wor... | ALGO | 0.999982 | 6.233434 |
7cd67454-75d7-4cde-9c7b-e34d0d775a07 | sssemil/INF_EX1 | INF_EX1/c++/4/n4.11.cpp | #include <iostream>
#include <math.h>
int main() {
std::cout << "Enter array length: ";
int length;
std::cin >> length;
int *arr = new int[length];
for (int i = 0; i < length; i++) {
std::cout << "Enter " << i + 1 << "th element: ";
std::cin >> arr[i];
}
double mid = 1;
... | ALGO | 0.999294 | 3.698372 |
ad2d518d-cf74-44a5-b157-537a1ec04daa | natsukmoe/natsubf | runner.cpp | #include "headers.h"
namespace {
vector<char> Program,Full;
}
bool CheckParenthesis(const vector<char> &,bool);
void RunProgram(){
CheckParenthesis(Full,1);
int cur=0;
vector<char> ram(30000,0);
int Size=(int)Program.size(),pos=0;
vector<int> reps;
while(cur<Size){
if(Program[cur]=='+... | ALGO | 0.997018 | 3.698251 |
041894fe-7897-498a-89fb-99ffd74c78f4 | Ruben725/MedMinder | 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 |
6cbb8c71-4a10-449b-b1bf-b087c3dc56dc | MaheshSharan/LeetCode_Automation | solutions/3100-3199/3115.Maximum Prime Difference/Solution.cpp | class Solution {
public:
int maximumPrimeDifference(vector<int>& nums) {
for (int i = 0;; ++i) {
if (isPrime(nums[i])) {
for (int j = nums.size() - 1;; --j) {
if (isPrime(nums[j])) {
return j - i;
}
}... | ALGO | 0.999945 | 5.251069 |
3e17f42b-d6d6-412f-af2f-49d7cefe3737 | matheus3301/neps-academy-exercises | 04 - ESTRUTURAS/sorvete.cpp | #include <bits/stdc++.h>
#define REP(x,ini,fim) for(int x = ini; x < fim; x++)
#define endl "\n"
#define debug(x) cout << "DEBUG: " << x << endl;
#define ini first
#define fim second
using namespace std;
typedef long long ll;
int p, s;
pair<int,int > S[5010];
vector<pair<int,int > > ans;
int main(){
ios_base::... | ALGO | 0.999753 | 3.270546 |
7939a9f6-efe2-40c8-bb5b-59e0d4a690cb | fengabriel/opencv_contrib | modules/tracking/src/trackerCSRTScaleEstimation.cpp | #include "precomp.hpp"
#include "trackerCSRTScaleEstimation.hpp"
#include "trackerCSRTUtils.hpp"
//Discriminative Scale Space Tracking
namespace cv
{
class ParallelGetScaleFeatures : public ParallelLoopBody
{
public:
ParallelGetScaleFeatures(
Mat img,
Point2f pos,
Size2f base_target_sz,
... | ALGO | 0.995536 | 6.259945 |
4450b896-1e39-439c-aa75-1daa366976e0 | stoianmihail/duckdb-parachute | extension/core_functions/aggregate/distributive/string_agg.cpp | #include "core_functions/aggregate/distributive_functions.hpp"
#include "duckdb/common/exception.hpp"
#include "duckdb/common/types/null_value.hpp"
#include "duckdb/common/vector_operations/vector_operations.hpp"
#include "duckdb/common/algorithm.hpp"
#include "duckdb/execution/expression_executor.hpp"
#include "duckdb... | TOOL | 0.881575 | 7.762585 |
68ac64c3-1846-4687-8caa-0e45ab583fe4 | ishandutta2007/codeforces | ormlis/normal/1594/D.cpp | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep1(i, n) for (int i = 1; i < (n); ++i)
#define rep1n(i, n) for (int i = 1; i <= (n); ++i)
#define repr(i, n) for (int i = (n) - 1; i >= 0; --i)
#define pb push_back
#define eb emplace_back
#define all(a) (a).begin(), (a).end()
#define r... | ALGO | 0.999935 | 4.509217 |
bbebd757-6b51-48e6-9bd8-048ac892b7b9 | beelisais2793/FX | Synthesizer/Waves/PhysicalModel/qiano/src/Utilities.cpp | #include "Utilities.h"
namespace fftconvolver
{
bool SSEEnabled()
{
#if defined(FFTCONVOLVER_USE_SSE)
return true;
#else
return false;
#endif
}
void Sum(Sample* FFTCONVOLVER_RESTRICT result,
const Sample* FFTCONVOLVER_RESTRICT a,
const Sample* FFTCONVOLVER_RESTRICT b,
size_t len)
{
c... | ALGO | 0.996077 | 6.508176 |
f5f0606e-1722-49f0-b5d6-75aaa21c86a8 | HyunsunHong/Algorithm | programmers/BFS_DFS/travel_route.cpp | #include <string>
#include <vector>
#include <algorithm>
using namespace std;
bool used[10000] = {false, };
vector<string> ans;
bool dfs(string curr, vector<vector<string> > tickets) {
if(ans.size() == tickets.size() + 1) {
return true;
}
for(int i = 0; i < tickets.size(); i++) {
if(... | ALGO | 0.999546 | 5.86585 |
72d6ac32-8936-4b94-807c-5e77db077e9e | JoydeepMallick/CODEFORCES | 8.6.25 Codeforces Round 1029 (Div. 3)/F.cpp | /*
_________________________
| Written by silent_Joy |
---------~u~---------
*/
#include"bits/stdc++.h"
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("bmi,bmi2,lzcnt,popcnt")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt") //intel pentium processors released post 2020 support avx2, unfortun... | ALGO | 0.999833 | 4.913529 |
946520bd-1691-4de3-8f70-7f9a2438a8fb | javashin/DiabloOS | freebsd-ports-diablo/www/logtools/files/patch-clfmerge.cpp | --- clfmerge.cpp.orig 2016-12-25 14:50:06 UTC
+++ clfmerge.cpp
@@ -1,17 +1,20 @@
-#include <stdio.h>
+#include <cstdio>
#include <unordered_map>
-#include <stdlib.h>
+#include <cstdlib>
#include <map>
#include <cstring>
#include <unistd.h>
-#include <ctype.h>
+#include <cctype>
+#include <string>
#include "logto... | TOOL | 0.975561 | 5.25066 |
0ef3c761-9a01-4790-99e7-fbd4e35fdf6c | tr4nscr1pt/kmcoin-2.0 | tests/CoreTests/Chaingen.cpp | #include "Chaingen.h"
#include <iostream>
#include <stdint.h>
#include <vector>
#include <boost/archive/binary_oarchive.hpp>
#include <boost/archive/binary_iarchive.hpp>
#include <boost/program_options.hpp>
#include "Common/CommandLine.h"
#include "CryptoNoteCore/CryptoNoteBasic.h"
#include "CryptoNoteCore/CryptoNot... | TOOL | 0.902236 | 5.071846 |
e92a8f53-5997-4c9d-ba8f-eed222eedc6b | RiyaadHossain/XPSC-Practice | Phitron Practice/week 15/Day 4/D_Super_Permutation.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using pbds = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define endl '\n'
#define ye cout << "YES"
#define no... | ALGO | 0.999717 | 4.791012 |
ac4768d1-6903-40b9-b1a1-51e4899b98b6 | hu-zhiyu/cpp-interview-prep | Algorithm/LeetCode/516.最长回文子序列.cpp | /*
* @lc app=leetcode.cn id=516 lang=cpp
*
* [516] 最长回文子序列
*/
// @lc code=start
class Solution {
public:
int longestPalindromeSubseq(string s) {
int sz = s.size();
if(sz == 0) return 0;
if(sz == 1) return 1;
vector<vector<int>> dp(sz, vector<int>(sz, 0));
for(int i = 0; ... | ALGO | 0.999974 | 6.604122 |
17a780cd-33c0-4db4-96df-52857311023e | Pandor17/cmasmas | 7.funciones/ej_comp_ordenamiento.cpp | #include <iostream>
using namespace std;
//prototipos
int pedir_tamano ();
void llenar_array (int ixArray[], int iTamano);
bool creciente (int ixarray[], int iTamano);
int main(){
int iTam = pedir_tamano();
int iarray [iTam];
llenar_array(iarray,iTam);
bool comprobar = creciente (iarray,iTam);
if... | ALGO | 0.998519 | 4.249419 |
5e5ef645-1b81-42f6-975c-e010f0a8e75b | rbruno95/codeforces-ladders | < 1300/047-system_of_equations.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n, m;
cin >> n >> m;
int t = min(n,m);
int counter = 0;
for(int a=0;a<=t;++a)
for(int b=0;b<=t;++b)
counter+= (a * a + b == n and a + b * b == m);
cout << counter << '\n';
return 0;
} | ALGO | 0.999587 | 4.961003 |
01f448ed-d0f2-4cd1-86c3-9e35f8a372ed | smshozab/Data-Structures-cpp-Codes | DS Lab/Lab 3-4/2.cpp | #include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
cout << endl << "For array having a size of 50" << endl << endl << endl;
int arr[50],random,count=0;
cout << "Unsorted Array, having random values is:" << endl << endl;
for (int i=0;i<50;i++){
random=rand() % 100;
arr[i]=random;
cout << ... | ALGO | 0.999573 | 4.127733 |
5e062b8e-e998-412a-ab24-9a21e699ee31 | anushkaGurjar99/Data-Structure-and-Algorithms | LEETCODE/Leetcode May Challenge/Q3. Ransom Note.cpp | /*
* Author : Anushka Gurjar
* Date : May 2020
* flags : -std=c++14
*/
#include<bits/stdc++.h>
using namespace std;
// Problem Statement: https://leetcode.com/problems/ransom-note/
class Solution {
public:
bool canConstruct(string ransomNote, string magazine){
if(ransomNote.size() > maga... | ALGO | 0.999897 | 5.939274 |
9070769b-c870-4b9a-b0f8-a381bea5ff5a | rohanxxx/leetcode | 3731-sum-of-variable-length-subarrays/3731-sum-of-variable-length-subarrays.cpp | class Solution {
public:
int subarraySum(vector<int>& nums) {
int n = nums.size();
vector<int> prefix(n, 0);
for(int i = 0; i < n; i++){
if(i == 0){
prefix[i] = nums[i];
continue;
}
prefix[i] = prefix[i-1]+nums[i];
... | ALGO | 0.999924 | 5.644564 |
417b232b-de21-46ea-a361-e84ff28e97bf | morrazzzz/Rengen-Luch-Source | xray-svn-trunk/xr_3da/xrRender_R4/light_GI.cpp | #include "StdAfx.h"
#include "../xrRender/light.h"
IC bool pred_LI(const light_indirect& A, const light_indirect& B)
{
return A.E > B.E;
}
void CLightSource::gi_generate()
{
indirect.clear();
indirect_photons = ps_r2_ls_flags.test(R2FLAG_GI) ? ps_r2_GI_photons : 0;
CRandom random;
random.seed(0x12071980);
xrX... | ALGO | 0.850788 | 3.904694 |
4d502a71-a790-466c-a332-4d140e3ca9ee | ElihuTM/problems-solved | Uva/DivisibleGroupSums_10616.cpp | #include <bits/stdc++.h>
#define maxn 203
#define modu 23
#define inf -999999999
using namespace std;
int memo[ maxn ][ modu ][ 13 ];
int arr[ maxn ];
int n,q, d, m;
int dp( int pos, int mod, int rest )
{
if( rest < 0 )
return 0;
if( pos == n )
return rest == 0 && mod == 0 ? 1 : 0;
if( ~memo[ pos ][ mod ]... | ALGO | 0.994639 | 3.436012 |
ce52eef9-068c-4bbf-b9b2-5790f29ef02a | ishandutta2007/codeforces | _guoyh_/normal/1065/F.cpp | # include <bits/stdc++.h>
# define ll long long
using namespace std;
const int MAXN = 1000051;
struct Edge{
int t, nxt;
Edge(int t = 0, int nxt = 0): t(t), nxt(nxt){}
} g[MAXN * 2];
int n, k, gsz;
int fa[MAXN];
int fte[MAXN * 2];
bool lf[MAXN];
void addedge(int u, int v){
g[++gsz] = Edge(v, fte[u]);
fte[u] = gsz;
}... | ALGO | 0.99994 | 3.914157 |
d8e7597b-7a76-4978-9d19-bacc67c39fc0 | SepehrGanji/LeetCode-Solutions | Solutions/2868-continuous-subarrays/solution.cpp | class Solution {
public:
long long continuousSubarrays(vector<int>& nums) {
map<int, int> mp;
int l = 0, r = 0;
int n = nums.size();
long long ans = 0;
while(r < n) {
mp[nums[r]]++;
while(mp.rbegin()->first - mp.begin()->first > 2) {
mp... | ALGO | 0.999981 | 6.101886 |
96888072-e53a-443c-a62b-799e46726aa5 | shravan-d/Leetcode | 55-jump-game/55-jump-game.cpp | class Solution {
public:
bool canJump(vector<int>& nums) {
if(nums.size()==1)
return true;
if(nums[0]==0)
return false;
int jump=1;
for(int i=0;i<nums.size();i++){
if(jump==0)
return false;
jump=(jump-1>nums[i])?jump-1:n... | ALGO | 0.999963 | 5.922478 |
1ba48f94-b21e-445e-922a-06732f7651b1 | shivanshsanoria1/LeetcodeSolutions | CPP [1-500]/349.intersection_of_two_arrays [4].cpp | class Solution {
public:
// T.C.=O(n1 + n2), S.C.=O(n1 + n2)
vector<int> intersection(vector<int>& nums1, vector<int>& nums2) {
unordered_set<int> s1(nums1.begin(), nums1.end());
unordered_set<int> s2(nums2.begin(), nums2.end());
vector<int> ans;
for(int num: s1)
//... | ALGO | 0.999895 | 5.849098 |
52f7781e-8030-4fd4-a12a-8d90403731ed | Nitishojha00/DSA_NOTES | Graph/Cycle_Detection_Directed_Graph.cpp/dfs.cpp | class Solution {
public:
bool dfs(vector<int> adj[], int node, vector<bool>& visited, vector<bool>& recStack) {
visited[node] = true;
recStack[node] = true;
for (auto neib : adj[node]) {
if (!visited[neib]) {
if (dfs(adj, neib, visited, recStack))
... | ALGO | 0.999952 | 6.375131 |
29d572c2-4054-4658-873e-f3ce884de783 | vedant2307/Leetcode | 2231-find-first-palindromic-string-in-the-array/find-first-palindromic-string-in-the-array.cpp | class Solution {
public:
bool isPalindrome(string str){
int i=0,j=str.size()-1;
while(i<j && str[i]==str[j]) i++, j--;
return i>=j;
}
string firstPalindrome(vector<string>& words) {
for(auto it:words) if(isPalindrome(it)) return it;
return "";
}
}; | ALGO | 0.999845 | 6.172615 |
d58bde78-b92b-4cf0-9a91-df1f8e2aefa7 | billy122333/LeetCode_Practice | easy/21. Merge Two Sorted Lists.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* mergeTwoLis... | ALGO | 0.999701 | 5.68337 |
4396d007-3098-410d-a7b3-b600fa506ff2 | ishandutta2007/codeforces | wasa855/normal/1278/B.cpp | #include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define Fast_IO ios::sync_with_stdio(false);
#define fir first
#define sec second
#define int long long
inline int read()
{
char ch=getchar(); int nega=1; while(!isdigit(ch)) {if(ch=='-') nega=-1; ch=getchar();}
int ans=0; while(is... | ALGO | 0.999859 | 4.065252 |
8b7f15c9-d55e-423f-9606-4d996b4c5692 | nguyentuss/Competitive-Programming | CP/OnlineJudge/CodeForce/VNOI/TRAFFICN.cpp | #include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <limits.h>
using namespace std;
#define boost ios::sync_with_stdio(0); cin.tie(NULL);
#define fi freopen("trafficn.inp","r",stdin);
#define fo freopen("trafficn.out","w",stdout);
#define ii pair<int , int>
i... | ALGO | 0.999794 | 4.041114 |
11ec198a-9d22-4de7-91f4-3a0d8902395a | christopher-roelofs/vibe-coding | ball_maze/Level.cpp | #include "Level.h"
#include <fstream>
#include <iostream>
#include <algorithm>
#include <cctype>
Level::Level() : current_level_index_(-1) {
// Initialize with empty levels
}
bool Level::loadFromFile(const std::string& filepath) {
std::cout << "Starting to load levels from file: " << filepath << std::endl;
... | TOOL | 0.893498 | 6.163578 |
b3dd7160-b2c1-40f3-a595-e3bf313222c3 | farrelinoarv/Phascode-C-Mastery-Class | .ccls-cache/@home@runner@Phascode/part5@caseFloorCeil@solverFloorCeil.cpp | #include <iostream>
#include <math.h>
using namespace std;
// deklarasi variabel
double x;
int fl, cl;
int main(){
// ambil input var x
cin >> x;
// cek apakah bilangan tersebut sudah bulat, jika iya maka set floor dan ceiling sama dengan bilangan tsb
// jika dia bilangan positif, gunakan trunc(x) untuk floo... | ALGO | 0.999843 | 4.881711 |
e342030c-0fc4-4e57-a1f9-3e2ee9f4cdb0 | yzzupgo/MFTCG | Data/abc136_b/Jupytor/wa/6685162.cpp | #include <bits/stdc++.h>
using namespace std;
int main(void){
int n,a,i,s,ans=0;
cin >> n;
for (i=10;i<=n;i++){
s=0;
a=i;
while (a){
a/=10;
s++;
}
if (s%2==0) ans++;
}
cout << ans << endl;
return 0;
}
| ALGO | 0.998268 | 3.640006 |
4930a946-2d33-45b9-85f2-0e46f58ee3dc | ishandutta2007/codeforces | quailty/normal/442/A.cpp | #include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
const char ty[]="RGBYW";
pair<int,int> card[105];
bool check(int m1,int m2,int n)
{
for(int i=1;i<=n;i++)
for(int j=i+1;j<=n;j++)
{
bool isok=0;
if... | ALGO | 0.999501 | 3.58897 |
b577443e-7524-43cb-94ef-61b0703c17d5 | rajesh-1920/Competitive_Programming_Problem_Solving | Codeforces/C_Ahahahahahahahaha.cpp | // Author: Rajesh Biswas
// CF : rajesh-1920
// Date : 12.05.2025
#include <bits/stdc++.h>
using namespace std;
//----------------------------(definition section)-----------------------------------------
#define dbg(x) cout << #x << " = " << x << '\n'
#define int long long int
#define fi first
#define sc second... | ALGO | 0.99998 | 4.783664 |
11581d03-3301-481b-85c7-b9b0e8cf24dd | mohamedkhairy70/DataStructureAss | LinkedListOfQueue-Day2/LinkedListOfQueue-Day2.cpp | // LinkedListOfQueue-Day2.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include <iostream>
#include "LinkedListAsQueue.h"
using namespace std;
bool PrintDequeue(LinkedListAsQueue & linkedList)
{
int data;
if (linkedList.DeQueue(data))
{
cout << data << ... | ALGO | 0.97782 | 4.119541 |
4edf2e1c-daa3-4192-b0ae-41264b3db870 | Youngwook-Jeon/algorithm-problems-solving | leetcode/1133_LargestUniqueNumber.cpp | #include <vector>
using namespace std;
class Solution
{
public:
int largestUniqueNumber(vector<int> &nums)
{
int freq[1001]{0};
int ans = -1;
for (auto num : nums)
{
freq[num]++;
}
for (int i = 0; i <= 1000; i++)
{
if (freq[i] == ... | ALGO | 0.999777 | 5.71999 |
49c00c98-782c-41f6-8b6c-db54c7e6bd37 | mahadi-74/Competitive-Programming | CP 2025/CF_Amusing_joke.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
string guest,host,pile;
cin>>guest>>host>>pile;
string combined = guest+host;
if(combined.length() != pile.length())
{
cout<<"NO"<<endl;
return 0;
}
sort(combined.begin(),combined.end());
sort(pile.begin(),pile.... | ALGO | 0.999948 | 3.731776 |
659be0e5-63c0-4258-a385-66b769d6aaef | fanfancy/hetero_gem5 | gem5/src/systemc/tests/systemc/misc/cae_test/general/control/if_test/fsm/fsm.cpp | /*****************************************************************************
fsm.cpp --
Original Author: Rocco Jonack, Synopsys, Inc., 1999-10-25
*****************************************************************************/
/*****************************************************************************
M... | ALGO | 0.942773 | 4.025086 |
e5e6a391-ed47-47b1-bcb8-8ae46a893b0c | bitdove/Algorithm | AcWing/AW35_反转链表.cpp | /*
题目:
定义一个函数,输入一个链表的头结点,反转该链表并输出反转后链表的头结点。
思考题:
请同时实现迭代版本和递归版本。
样例
输入:1->2->3->4->5->NULL
输出:5->4->3->2->1->NULL
*/
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), nex... | ALGO | 0.999907 | 5.585454 |
00718914-6db9-494a-a1aa-5d9f45ebdb63 | yuchuangu85/AOSP_Frameworks | base/libs/androidfw/Util.cpp | #include "androidfw/Util.h"
#include <algorithm>
#include <string>
#include "utils/ByteOrder.h"
#include "utils/Unicode.h"
#ifdef _WIN32
#ifdef ERROR
#undef ERROR
#endif
#endif
namespace android {
namespace util {
void ReadUtf16StringFromDevice(const uint16_t* src, size_t len, std::string* out) {
static constexp... | TOOL | 0.933716 | 7.28306 |
7b24dc73-2622-48f1-ad71-25c42d4c820a | tanaygup/CSES-imp | binary and decimal/negativenum to binary.cpp | #include<iostream>
#include <math.h>
using namespace std;
int decimalToBinary(int n){
int ans = 0;
int i = 0;
while(n!=0){
int bit = n&1;
ans = (bit * pow(10,i)) + ans;
n = n >> 1;
i++;
}
return ans;
}
int main(){
int n;
cin >> n;
if(n<0){
// if... | ALGO | 0.999961 | 5.518169 |
557ff1a3-66a9-4d9e-aa11-bab1c79f1f38 | dgiantsidi/Coyote-playground | replacingLastPacket/sum_of_all_input_data_plus_verify/vitis2/sha1/sha2561.cpp | #include "sha2561.hpp"
#include <stdio.h>
#include <stdlib.h>
#include <string.h> // for overloaded memcpy() function
#include "sha256_impl1.hpp"
#include <iostream>
void sha2561_ver(hls::stream<AXIS_DATA>& input,
AXIS_DATA& outWord, AXIS_DATA& lastPacket) {
// Interface definitions
#pragma HLS INTERFACE ap_ctr... | ALGO | 0.996866 | 5.816319 |
8090e28d-1c59-4022-a9d3-0f79d8b0da70 | SeekoeiD/AirDollars | airdollars/src/coins.cpp | #include "coins.h"
#include "memusage.h"
#include "random.h"
#include <assert.h>
/**
* calculate number of bytes for the bitmask, and its number of non-zero bytes
* each bit in the bitmask represents the availability of one output, but the
* availabilities of the first two outputs are encoded separately
*/
void ... | TOOL | 0.932295 | 7.062761 |
607c28a6-98ca-4da6-8ae7-0b53ef971cc3 | 30something/algos | structures/treap.cpp | #include "template.h"
struct treap {
treap(ll nkey, ll nprr, ll nzn) : key(nkey), prr(nprr), sz(1), add_sg(0), zn(nzn) {};
treap* left = nullptr;
treap* right = nullptr;
ll key, prr, sz, add_sg, zn;
};
vector<pll> dbg;
treap* root = nullptr;
void push(treap* first) {
if (first == nullptr) return;
if (first... | ALGO | 0.999373 | 3.91951 |
c43fb841-7cd3-4ee8-8908-ffcf51c4a5b4 | jHoon0223/Cpp_Self-Study | BOJ/201sabde/심화 1/4344.cpp | #include <iostream>
#include <stdio.h>
#include <vector>
using namespace std;
int main() {
int C;
cin >> C;
while(C-->0) {
int N;
cin >> N;
vector<int> v;
for (int i=0; i<N; i++) {
int a;
cin >> a;
v.push_back(a);
}
int ... | ALGO | 0.998843 | 4.327919 |
7f00918a-52ab-4922-9635-8ff54c79d113 | Ri-Nai/CompetitionCode | OI/School_203/2000_5000/3228.cpp | #include<bits/stdc++.h>
using namespace std;
const int maxn=1e6+10;
int n,k,A[maxn],B[maxn],C1[maxn],dp[maxn],
C2[maxn],C3[maxn],ans,st,nxt[maxn],las;
void ToMax1(int x,int y){while(x<=1e6+5)C1[x]=max(y,C1[x]),x+=x&-x;}
int GetMax1(int x,int y=0){while(x)y=max(C1[x],y),x^=x&-x;return y;}
void ToMax2(int x,int y){while(... | ALGO | 0.999998 | 3.145893 |
d026e8f5-3502-4a52-8583-e1880eca6091 | JarvisLam-LemonCEO/CMPE | CMPE 126 Lab/Lab12/leftViewMethod2.cpp |
#include<iostream>
#include <queue>
using namespace std;
// A Binary Tree Node
struct Node{
int data;
struct Node *left, *right;
};
// Utility function to create a new tree node
Node* newNode(int data){
Node *temp = new Node;
temp->data = data;
temp->left = temp->right = NULL;
return temp;
}
// function to pr... | ALGO | 0.99995 | 6.040877 |
562742fe-2b50-487e-80bc-c24da0ce5335 | adriannarendra/YOUQR | 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 |
f702c55e-3a2d-438a-9e99-e01f0b1ede20 | lggqYu/Flow | code_20250625.cpp | #include <iostream>
#include <casadi/casadi.hpp>
#include <vector>
#include <fstream>
// 定义状态向量和控制输入的维度
const int STATE_DIM = 12; // 位置(x,y,z)、速度(vx,vy,vz)、姿态(phi,theta,psi)、角速度(p,q,r)
const int CONTROL_DIM = 4; // 油门、副翼、升降舵、方向舵
class FlightControlOptimizer {
private:
int N; // 优化时域长度
d... | ALGO | 0.999987 | 6.766043 |
efb6d449-c14b-4727-9be3-899dac3cb9b5 | ArthurBufalo/projetos-tpa | 04-08-2021/media.cpp | #include <iostream>
#include <sstream>
using namespace std;
int main() {
//Declaração de variaveis pra fazer a média
int index = 0;
int nums = 0;
while (true) { //Um loop perguntando os numeros para incluir na média
cout << "Type a number or type 'done': ";
string s; //Declarando uma st... | TOOL | 0.965164 | 4.124808 |
623e16b7-24a5-4d2d-9a14-33dff3cc5229 | leizy1008/MA-CETSP | src/Genetic/Population.cpp | /**
* Population.cpp
* created on : March 03 2022
* author : Z.LEI
**/
#include "Genetic/Population.hpp"
Population::Population(Parameters *params): neighbor(params->neighbor_size), ls(params) {
this->initialization = params->init;
this->selection = params->select;
this->crossover_type = params->cross... | ALGO | 0.999933 | 5.915151 |
610dbcb9-e4a1-41df-b7d5-89d26090d7f5 | t4nm4y/cpp_dsa | cipher/hill.cpp | //Hill Cipher 3x3
#include<bits/stdc++.h>
using namespace std;
void getKeyMatrix(string key, int keyMatrix[][3])
{
int k = 0;
for (int i = 0; i < 3; i++)
for (int j = 0; j < 3; j++)
keyMatrix[i][j] = (key[k++]) % 65;
}
void encrypt(int cipherMatrix[][1], int keyMatrix[][3], int messageVector[][1])
{
... | ALGO | 0.999997 | 4.555158 |
6e0c4021-963e-4eae-9b5a-6711b54290f4 | asmit557/Coding_Problem | leetcode/binaryTreeMaximumPathSum.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.999979 | 6.34517 |
4922297a-ea73-49fb-94f5-54b0d743d30a | raincross7/code-similarity | codes/train_code/problem359/problem359_295.cpp | #include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define yorn(f) cout<<((f)?"Yes":"No")<<endl;
#define YORN(f) cout<<((f)?"YES":"NO")<<endl;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, n) for (int i = 1; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define pu... | ALGO | 0.999986 | 3.067936 |
151cef4e-6c37-4444-96d3-0c9b12b48d42 | elixter/Study | Baekjoon/1629.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long int lli;
lli solution(int n, int pow, int mod) {
if (pow == 1) return n % mod;
else if (pow == 0) return 1 % mod;
lli result;
lli tmp = solution(n, pow / 2, mod);
if (pow % 2 == 0) {
result = tmp * tmp % mod;
}
... | ALGO | 0.999988 | 4.98567 |
120b2043-a327-4c76-bbf3-51051877d901 | vinayak-7/DSA | Medium/Bleak Numbers/bleak-numbers.cpp | //{ Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution
{
public:
int cnt(int n)
{
int count = 0;
while(n)
{
if((n&1) == 1) count++;
n >>= 1;
}
return count;
}
int is_bleak(int n)
{
// Co... | ALGO | 0.999237 | 5.62679 |
e31a48ad-75c8-495b-a83f-030a2be6ec0c | Ph0en1xGSeek/ACM | 模板/欧拉回路John's_trip.cpp | #include <iostream>
#include <stdio.h>
#include <cstring>
#include <stack>
using namespace std;
int g[46][2000], degree[46];
bool vis[2000];
int num;
stack<int> st;
void euler(int u)
{
for(int i = 0; i <= num; i++)
if(g[u][i] && !vis[i])
{
vis[i] = true;
euler(g[u][i]);
... | ALGO | 0.999844 | 3.485374 |
51cc8714-6ebc-4e0b-93b7-480bac6f5f12 | MamangolivE/praktikum-apl | Kelas/pertemuan-2/pertemuan2.cpp | #include <iostream>
using namespace std;
//string nama[4] = {"Haqi","Melchi","Dzaki"};
// #define MAX_BUAH 100 // Ukuran maksimum array buah
// int panjang = 0; // Jumlah elemen saat ini
// string buah[MAX_BUAH]; // Array dengan ukuran tetap
// int pilihan, index;
//int main(){
//string arr[4] = {"Hello", "World... | ALGO | 0.980986 | 3.084376 |
26ea1d9b-2383-4b40-9746-3939c69190da | Nakib-Arman/CSE314---OperatingSystem | 3.IPC/.history/main_20250627004317.cpp | #include <iostream>
#include <chrono>
#include <pthread.h>
#include <random>
#include <vector>
#include <unistd.h>
using namespace std;
#define MAX_PHASE1_TIME 20
#define MAX_PHASE2_TIME 20
#define SLEEP_MULTIPLIER 1000
auto start_time = chrono::high_resolution_clock::now();
long long get_time() {
auto end_time ... | ALGO | 0.997974 | 4.754369 |
145c6892-279f-48ad-a050-753d109e66cf | utkarsht/SPOJ-problems | MSTICK(seg tree).cpp | #include<bits/stdc++.h>
#define M 100005
#define MAX 2147483647
#define MIN -MAX
using namespace std;
typedef pair<int,int> ii;
int b[M];
ii st[M];
ii combine(ii a,ii b)
{
ii temp;
temp.first = min(a.first,b.first);
temp.second = max(a.second,b.second);
return temp;
}
double get(ii p1)
{
return (( p1.first + (p1... | ALGO | 0.999747 | 3.837031 |
df5e0ef7-51fe-485a-b91d-1b401655f5ef | Jaimedfalla/advanced-wasm-pong | pong.cpp | #include <cstdlib>
#include <cmath>
#include <emscripten.h>
#include <emscripten/bind.h>
enum class Move {
STATIONARY = 0,
UP = 1,
DOWN = 2
};
struct Paddle {
float xpos;
float ypos;
float speed;
// Constructors for compatibility
Paddle() : xpos(0), ypos(300), speed(5) {}
Padd... | ALGO | 0.996602 | 7.56464 |
62f195dc-01f5-49d1-8f19-013591b3470f | ggasoftware/indigo | layout/src/molecule_layout_graph_assign.cpp | #include "layout/molecule_layout_graph.h"
#include "layout/attachment_layout.h"
#include "graph/biconnected_decomposer.h"
#include "graph/cycle_enumerator.h"
#include "graph/embedding_enumerator.h"
#include "graph/morgan_code.h"
using namespace indigo;
enum
{
QUERY_BOND_SINGLE_OR_DOUBLE = 5,
QUERY_BOND_SINGLE_O... | ALGO | 0.995789 | 5.320529 |
47c6dd7e-0810-4709-96d3-e1bc07c23c4f | seclab-fudan/SyzDirect | source/llvm-project-new/llvm/tools/dsymutil/BinaryHolder.cpp | #include "BinaryHolder.h"
#include "llvm/Object/MachO.h"
#include "llvm/Support/WithColor.h"
#include "llvm/Support/raw_ostream.h"
namespace llvm {
namespace dsymutil {
static std::pair<StringRef, StringRef>
getArchiveAndObjectName(StringRef Filename) {
StringRef Archive = Filename.substr(0, Filename.rfind('('));
... | TOOL | 0.912665 | 7.884395 |
f9e72820-549b-40de-aa67-50600d7b7cd7 | jahid0002/All-code | stateManegment/less/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.997904 | 6.76073 |
4573a09f-8aa7-4033-b5cf-4c33596b6dc7 | jimlin2004/LeetCode | Unfinish/227/227.cpp | #include <string>
#include <stack>
#include <queue>
#include <iostream>
using namespace std;
class Solution
{
public:
int calculate(string s)
{
this->getRPN(s);
return this->evalRPN();
}
private:
queue<string> RPN;
int getPriority(char c)
{
switch (c)
{
... | ALGO | 0.999913 | 4.855294 |
6e990828-a26f-4817-88d1-a908a7aa0fe9 | Nero-TheThrill/UE4_ShortTest | UnrealEngine-4.25/Engine/Source/ThirdParty/PhysX3/PhysX_3.4/Source/PhysXExtensions/src/ExtSphericalJointSolverPrep.cpp | #include "ExtSphericalJoint.h"
#include "ExtConstraintHelper.h"
#include "CmConeLimitHelper.h"
#include "CmRenderOutput.h"
namespace physx
{
namespace Ext
{
PxU32 SphericalJointSolverPrep(Px1DConstraint* constraints,
PxVec3& body0WorldOffset,
PxU32 /*maxConstraints*/,
PxConstraintInvMassScale &invMassScale,
c... | TOOL | 0.879576 | 6.193104 |
cce4652c-40ca-4d05-9ddc-e031fe9ecc84 | Hstb1230/Study | Algorithm/PTA/PAT (Basic Level) Practice (中文)/1091 N-自守数.cpp | #include <iostream>
using namespace std;
int main()
{
int m, k, n, t;
cin >> m;
while(m--)
{
cin >> k;
if(k > 100)
t = 1000;
else if(k > 10)
t = 100;
else
t = 10;
bool isFind = false;
for(int n = 1; n < 10; n++)
{
// printf("%d %d %d\n", t, n, n * k * k);
if((n * k * k) % t == k)
{
... | ALGO | 0.999866 | 3.484233 |
0e2a5f2f-0e26-43d4-aadf-531c334b2c6a | 019abhi/geeksforgeeks-C-solutions | Array/SetMatrixZeroes.cpp | #include<iostream>
using namespace std;
#include<vector>
class Solution {
public:
void setMatrixZeroes(vector<vector<int>> &mat) {
// code here
int n= mat.size();
int m = mat[0].size();
vector<bool> row(n, false);
vector<bool> col(m, false);
for(int i =0; i<n... | ALGO | 0.999752 | 4.533098 |
6a2cb479-a0cb-46bc-b4f5-3b049c3a460b | Gxyrious/Healper-BackEnd-DotNet | Encryption/md5.cpp | /**
* @file md5.cpp
* @The implement of md5.
* @author Jiewei Wei
* @mail <EMAIL>
* @github https://github.com/JieweiWei
* @data Oct 19 2014
*
*/
#include "pch.h"
#include "md5.h"
/* Define the static member of MD5. */
const byte MD5::PADDING[64] = { 0x80 };
const char MD5::HEX_NUMBERS[16] = {
'0', '1', '2... | ALGO | 0.883831 | 6.023032 |
0391a38b-a372-4790-97af-ab6bf1995ec7 | MS-Raunak/C-and-CPP-tutorial | C tutorials cource/rectangle.cpp | #include<iostream>
using namespace std;
int main()
{
int l,b,ar,p;
cout<<"Enter the length & bredth of rectangle:";
cin>>l>>b;
ar=l*b;
cout<<"Area of Rectangle is "<<ar<<endl;
p=2*(l+b);
cout<<"Perimeter of Rectangle is "<<p;
} | ALGO | 0.931713 | 3.494302 |
4446d15c-922c-4a51-b602-5f0310b802d5 | codershenglinli/cpp_learning | cpp_ice/Chapter4Array.cpp/1.3.cpp | /*
任务描述
本关任务:黑色星期五是指某天既是13号又是星期五。13号在星期五比在其他日子少吗?为了回答这个问题,编写一个程序,计算每个月的13号落在周一到周日的次数。
编程要求
根据提示,在右侧编辑器补充代码,用户输入正整数n,n为正整数且不大于400。要求计算从1900年1月1日至1900+n-1年12月31日中13 号落在周一到周日的次数(已知1900年1月1日是星期一)。
*/
#include<iostream>
using namespace std;
int main(){
int run[12]={31,29,31,30,31,30,31,31,30,31,30,31};
int not_run... | ALGO | 0.999959 | 3.760099 |
2ade354f-3d16-4222-85e3-78d0bde7d662 | CascadingRadium/Leetcode1000ProblemChallenge | 389-find-the-difference/389-find-the-difference.cpp | class Solution {
public:
char findTheDifference(string s, string t)
{
unordered_map<char,int> hmap;
for(auto i:s)
hmap[i]++;
for(auto i:t)
hmap[i]--;
char ret;
for(auto i:hmap)
if(i.second!=0)
{
ret=i.first;... | ALGO | 0.999939 | 6.326497 |
724fe589-c8ff-4fb4-a8f8-0e957efbaaa1 | Gunhee-Lee/realestate-practice-2 | lib/QuantLib-1.21/ql/models/shortrate/onefactormodels/extendedcoxingersollross.cpp | /* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
#include <ql/models/shortrate/onefactormodels/extendedcoxingersollross.hpp>
#include <ql/methods/lattices/trinomialtree.hpp>
#include <ql/math/distributions/chisquaredistribution.hpp>
namespace QuantLib {
ExtendedCoxIngersollRoss::Ex... | ALGO | 0.894506 | 7.416808 |
1d39d803-a2e1-493b-90c3-becac57623d2 | bprows/DataStructures | expressions_lab/ExpressionManager.cpp | #include "ExpressionManager.h"
#include <sstream>
#include <cctype>
#include <stack>
#include <string>
using namespace std;
/*
* Checks whether an expression is balanced on its parentheses
*
* - The given expression will have a space between every number or operator
*
* @return true if expression is bal... | ALGO | 0.978267 | 5.035359 |
c27f6382-c1d7-464c-9b36-c6a392c899ee | HanYouyang/Computer | 数据结构与算法/PKU-CS/Leetcode/LeetCode-master/C++/102. Binary Tree Level Order Traversal.cpp | 102. Binary Tree Level Order Traversal
My Submissions QuestionEditorial Solution
Total Accepted: 98904 Total Submissions: 304078 Difficulty: Easy
Given a binary tree, return the level order traversal of its nodes’ values. (ie, from left to right, level by level).
For example:
Given binary tree {3,9,20,#,#,15,7},
... | ALGO | 0.999985 | 6.132044 |
272bd213-b0ae-4f6d-ae9c-e2a8d84f6e90 | edidada/cppstdlib | stl/copy1.cpp | #include <algorithm>
#include <list>
#include <vector>
#include <deque>
using namespace std;
int main()
{
list<int> coll1 = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
vector<int> coll2;
// resize destination to have enough room for the overwriting algorithm
coll2.resize (coll1.size());
// copy elements fro... | TOOL | 0.986731 | 5.040023 |
893d5a7f-13a1-4cfd-816d-9c00008e3ee0 | fedorenkoivan/KIUTZ_NAU_labs | ОПАМ/some fancy code lies here/8.cpp | #include <iostream>
#include <string>
using namespace std;
int main() {
// 27-25 = 2
// Ввести довільний текст. У даному тексті знищити всі символи «,» і
// підрахувати довжину утвореного тексту.
cout<<"Введіть якийсь текст:"<<endl;
string sometext;
getline(cin, sometext);
for(int i = 0... | ALGO | 0.995403 | 3.338756 |
4ee26403-45dd-483e-a42c-8e2ed539b047 | MrE-Fog/compactor | src/util.cpp | /*
* Developed by Sinodun IT (www.sinodun.com)
*/
#include <cerrno>
#include <exception>
#include <thread>
#include <system_error>
#include "config.h"
#ifdef HAVE_PTHREAD
#include <pthread.h>
#ifdef HAVE_PTHREAD_NP_H
#include <pthread_np.h>
#endif
#endif
#include <grp.h>
#include <pwd.h>
#include <sys/stat.h>
#in... | TOOL | 0.915359 | 6.454255 |
34429551-688a-4ad7-99b6-23a139f579ae | yantay0/algorithms-and-data-structures | labs-ejudge/lab-6/H.cpp | #include <iostream>
using namespace std;
void swap(int *a, int *b)
{
int t = *a;
*a = *b;
*b = t;
}
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++;
... | ALGO | 0.999951 | 3.853652 |
ca8479b9-d15e-4fb6-9f9f-bf29e011d965 | lymcool/Introduction-to-Algorithms-Data-Structures | RBT.cpp | #include <iostream>
#include "RBT.h"
using namespace std;
void main() {
int a[] = {10,40,30,60,90,70,20,50,80};
int check_insert = 0;
int check_remove = 0;
int i;
int ilen = (sizeof(a)) / (sizeof(a[0]));
RBTTree<int>* tree=new RBTTree<int>();
cout << "ԭʼݣ";
for (i = 0;i < ilen;i++)
cout << a[i] << " ";
cou... | ALGO | 0.998533 | 3.86873 |
44e2bc3a-26ff-4622-a08a-e140d30dd838 | akash-pandey1209/Data_Structures-Algorithms_Challenge | BuyAndSell2.cpp | class Solution {
public:
int maxProfit(vector<int>& prices) {
int maxpro =0;
for(int i=1; i<prices.size(); i++){
if(prices[i]>prices[i-1]){
maxpro += prices[i]-prices[i-1];
}
}
return maxpro;
}
}; | ALGO | 0.998656 | 5.873679 |
3a0b16c7-6796-4c0a-9542-957ee7a69772 | rohandocx/Leetcode-DSA-Problems | top view.cpp | class Solution
{
public:
//Function to return a list of nodes visible from the top view
//from left to right in Binary Tree.
vector<int> topView(Node *root)
{
vector<int>ans;
if(root == NULL){
return ans;
}
map<int,int> topnode;
queue<pai... | ALGO | 0.999982 | 5.130909 |
affeb7b5-9ab4-4b58-ba29-b93471b5a809 | WormLabCaltech/DigiTracker_Suite | DigiRecognizer/Release_1.2.1/jpeglib/jcmaster.cpp | #define JPEG_INTERNALS
#include "jinclude.h"
#include "jpeglib.h"
/* Private state */
typedef enum {
main_pass, /* input data, also do first output step */
huff_opt_pass, /* Huffman code optimization pass */
output_pass /* data output pass */
} c_pass_type;
typedef struct {
struct jpeg_comp_master pub; /* pu... | TOOL | 0.966599 | 3.002103 |
ef7998e3-d4ae-4a12-b5d2-69d87a4b542f | ishandutta2007/codeforces | andrew/normal/1139/A.cpp | #include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define fi first
#define se second
#define p_b push_back
#define pll pair<ll,ll>
#define m_p make_pair
#define all(x) x.begin(),x.end()
#define ld long double
#define sset ordered_set
#define sqr(x) (x)*(x)
using name... | ALGO | 0.999959 | 3.949542 |
7c202e17-4076-42e1-aff6-675f2159307e | wajid-9/CSA0613-DAA | hamiltonian circuit.cpp | #include <stdio.h>
#define MAX_VERTICES 5
int graph[MAX_VERTICES][MAX_VERTICES];
int valid(int path[], int v, int p) {
if (graph[path[p - 1]][v] == 0) {
return 0;
}
for (int i = 0; i < p; i++) {
if (path[i] == v) {
return 0;
}
}
return 1;
}
int hami(int path[]... | ALGO | 0.999998 | 5.85766 |
2f1715d2-a9f2-472c-8977-858f9a8a1ac8 | Yaro2709/AlgoProblems | 11/1614B.cpp | #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long ll;
int main()
{
int t;
cin >> t;
while (t--)
{
int n;
cin >> n;
vector<pair<ll, ll>> aa(n);
for (int i = 0; i < n; i++)
{
aa[i].first = i;
cin >> aa[i].second;
}
sort(aa.begin(), aa.end(), [](co... | ALGO | 0.999867 | 3.405905 |
2c860907-26d5-41ef-9bbc-646ef22d6c54 | mnygp/MolecularSimulation | problemSet5/51/main.cpp | #include<iostream>
#include<cmath>
#include "functions.h"
#include "classes.h"
int main(){
const int N = 11;
//const int n_steps = 100;
const double m = 1;
const double k = 1.0;
const double tau = sqrt(m/k);
const double l = 1.0;
const double L = 11*l;
const double dt = 0.01;
const... | ALGO | 0.999248 | 3.918352 |
8b22d9da-3d7f-4ac1-84eb-f3ab513eeb91 | glucosesupremacy/IPMP-adi-s | Week 3/LL7.cpp | void removeLoop(Node *head)
{
// code here
// just remove the loop without losing any nodes
Node *slow = head;
Node *fast = head;
int count = 0;
while (fast != NULL && fast->next != NULL)
{
slow = slow->next;
fast = fast->next->next;
if (slow == fast)
{
... | ALGO | 0.999937 | 4.492527 |
cf0c28c8-9632-4db8-83e6-c850f0ad24d4 | NickLennonLiu/cpp | dsa/PA/PA2a/2-3/final/graph.cpp | #include <stdio.h>
#define nmax 800010
#define mmax 800010
#define MAX 2223372036854775807
#define MOD 998244353
#define parent(x) ((x) >> 1)
#define lc(x) ((x) << 1)
#define rc(x) (((x) << 1) | 1)
int n,m;
long long dis1[nmax], disn[nmax]; // (并查集意义下)1到其他节点的最短距离、n到其他节点的最短距离
long long spc1[nmax], spcn[nmax]; // (... | ALGO | 0.99994 | 4.655904 |
ae27b002-47e3-4448-a9fa-ca1de2151295 | TonyJZ/IntegratedPhotogrammetry | src/ImageGeoProcess/ImageGeometry.cpp | #include "StdAfx.h"
#include "ImageGeometry.h"
#include "Geometry.h"
// RobustReor.cpp: implementation of the CRobustReor class.
//
//////////////////////////////////////////////////////////////////////
#include <math.h>
#include "iphMatrix.h"
void ReliablityMatrix(double *A, double *P, int m, int n, double *Rlb)
{
i... | ALGO | 0.998992 | 5.161076 |
d35af23c-9834-4317-bbcd-31d6b7ebe9ae | vinaytheprogrammer/Cpp_LabWork | Lab/lab04.cpp | #include<bits/stdc++.h>
#define S 10
using namespace std;
bool identical(int *p1,int *p2)
{
int count=0;
for(int i=0;i<S;i++)
{
if(*(p1+i)==*(p2+i))
{
count++;
}
}
if(count==S)
{
return 1;
}
return 0;
}
int main()
{
... | ALGO | 0.999838 | 3.213765 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.