uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
af84914b-1515-4ccb-a73e-0d4c22d98ea8 | kewal-godhane/cpp-dsa | 13_string/4_remove_consecutive_character.cpp | #include<bits/stdc++.h>
#include<iostream>
using namespace std;
int main()
{
string s,re=" ";
cin>>s;
vector<char>v;
char maxch;
int max=0;
for(int i=0; i<s.length(); i++)
{
char ch=s[i];
int count=0;
for(int j=i+1; j<s.length(); j++)
{
if(ch==s[j]... | ALGO | 0.999948 | 3.479503 |
3545f3b0-702c-4feb-b309-53a94152212b | codevanss/C_plusplus | selectionsortwithcomparison.cpp | #include <iostream>
using namespace std;
void selection_sort(int arr[], int n, int &comparisons) {
comparisons = 0;
for (int i = 0; i < n - 1; i++) {
int min_index = i;
for (int j = i + 1; j < n; j++) {
comparisons++;
if (arr[j] < arr[min_index]) {
min_i... | ALGO | 0.999972 | 5.521992 |
76997157-0d9e-4ee3-97b6-efe387988388 | ishandutta2007/codeforces | low_/normal/1038/C.cpp | #include<iostream>
#include<fstream>
#include<vector>
#include<queue>
#include<deque>
#include<algorithm>
#include<cmath>
#include<set>
#include<map>
#include<cstdio>
using namespace std;
#define int long long
#define inf 92233720368547757
#define mn 100005
#define FLN "test"
int n;
vector <int> a, b;
main()
{
ios_b... | ALGO | 0.999983 | 3.375022 |
68fc4796-f39f-4d34-8cb6-01144db6271d | raincross7/code-similarity | codes/train_code/problem139/problem139_198.cpp | #include <bits/stdc++.h>
using namespace std;
#define forn(i,n) for(int i=0;i<(int)(n);i++)
#define forsn(i,s,n) for(int i = (int)(s); i<((int)n); i++)
const int N = 18;
int n;
int best[1<<N][3], ans[1<<N];
void insert(int mask, int val){
auto a = best[mask];
a[2] = val;
if (a[2] > a[1]) swap(a[2], a[1]... | ALGO | 0.999965 | 3.944395 |
381a1a21-7ae3-44ae-b5cf-4b3e45b77b8d | watchpoints/bitcoin | src/base58.cpp | #include <base58.h>
#include <hash.h>
#include <uint256.h>
#include <util/strencodings.h>
#include <util/string.h>
#include <assert.h>
#include <string.h>
#include <limits>
/** All alphanumeric characters except for "0", "I", "O", and "l" */
static const char* pszBase58 = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghi... | TOOL | 0.906128 | 7.337991 |
a815cff3-313e-4d2d-a593-d0c1a1eb880a | yonsei-hpcp/gcom | third-party/boost_1_86_0/libs/compute/example/transform_sqrt.cpp | //[transform_sqrt_example
#include <vector>
#include <algorithm>
#include <boost/compute/algorithm/transform.hpp>
#include <boost/compute/container/vector.hpp>
#include <boost/compute/functional/math.hpp>
namespace compute = boost::compute;
int main()
{
// get default device and setup context
compute::devic... | ALGO | 0.998326 | 5.203486 |
cd6273f8-d31c-4966-bea5-d452150d96f2 | maruf-hossain74/Codeforces_problem_Solve | Rating_1200-1300/Rudolf and Snowflakes (simple version).cpp | /*$$$$$$$$ বিসমিল্লাহির রাহমানির রাহিম $$$$$$$
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
JATIYA KABI KAZI NAZRUL ISLAM UNIVERSITY
$$$$$$$$$ MD. MARUF HOSSAIN $$$$$$$$$$$$$$
$$$$$$$$$ DEPARTMENT OF CSE $$$$$$$$$$$$$$
$$$$$$$$$ SEASION: 2021-2022 $$$$$$$$$$$*/
#include<bits/stdc++.h>
#include<algorithm>
#include<string.... | ALGO | 0.999663 | 4.922169 |
e37ce894-71b0-4e96-b26a-a0d2d073fc37 | mandalsudipti/AtcoderSolutions | BeginnerContest216/Amusement park.cpp | #include<bits/stdc++.h>
using namespace std ;
int main()
{
long long int n , k , ele;
cin>>n>>k;
map<long long int , long long int , greater<long long int>>freq ;
for(int i = 0 ; i < n ; i++)
{
cin>>ele ;
freq[ele]++;
}
long long int points = 0 ;
while(fre... | ALGO | 0.999988 | 4.025362 |
6a27a158-4456-497c-abd2-af1c3b874553 | ehnryx/acm | ecpc-2013-cf100283/i.cpp | #include <bits/stdc++.h>
using namespace std;
#define _USE_MATH_DEFINES
#define TESTFILE "zanzibar"
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef complex<ld> pt;
typedef vector<pt> pol;
const char nl = '\n';
const int INF = 0x3f3f3f3f;
const ll INFLL = 0x3f3f3f3f3f3f3f3f;
const ll ... | ALGO | 0.999742 | 4.992785 |
6297227b-e97d-4fb8-bf4d-2495cfd6a3d8 | chinmayjainnnn/CPP | 209-minimum-size-subarray-sum/minimum-size-subarray-sum.cpp | class Solution {
public:
int minSubArrayLen(int target, vector<int>& nums) {
int n=nums.size();
int l=0,r=0,sum=0,mini=INT_MAX;
nums.push_back(0);
while(l<=r && r<=n){
if(sum<target){
sum+=nums[r];
r++;
}
else{
... | ALGO | 0.999992 | 6.156668 |
4be84b57-4801-43f9-8229-60e6967e39bc | AlexeyTolstopyatov/Esox-math | Esox/Models/linecast_idea.cpp | #include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <cmath>
#include <random>
using namespace std;
const double EPS = 1e-9;
class LinearSystemSolver {
vector<vector<double>> augmented;
vector<string> latex_steps;
int n;
bool is_homogeneous;
void add_step(const str... | ALGO | 0.999635 | 5.150849 |
4d4c9c63-b025-4563-a83f-a49d85630d5c | Divyanshu9794/LeetcodePotd | 15-3sum/3sum.cpp | class Solution {
public:
vector<vector<int>> threeSum(vector<int>& nums) {
int n = nums.size();
vector<vector<int>> ans;
sort(nums.begin(),nums.end());
for(int i=0;i<n;i++){
//continue if duplicate element are there
if(i>0 && nums[i]==nums[i-1]){
... | ALGO | 0.999913 | 5.947533 |
9e063264-79d0-4eb1-bfbc-766255a85bc8 | kashem-khondaker/Algorithm | weak 5/modeule 17/factorila.cpp | #include<bits/stdc++.h>
using namespace std;
int fact(int n)
{
if (n==0)
{
return 1;
}
int sub_problem = fact(n-1);
return sub_problem * n;
}
int main()
{
int n ;
cin >> n;
cout << fact(n) << endl;
int ans = 1;
for (int i = 1; i <= n; i++)
{
ans = ans*i;
}... | ALGO | 0.999981 | 5.013636 |
1d7a1068-8570-42fb-9f02-000a617c4e27 | ishandutta2007/codeforces | shik/normal/1322/A.cpp | // {{{ by shik
#include <bits/stdc++.h>
#pragma GCC diagnostic ignored "-Wunused-result"
#pragma GCC diagnostic ignored "-Wunused-function"
#define SZ(x) ((int)(x).size())
#define ALL(x) begin(x), end(x)
#define REP(i, n) for (int i = 0; i < int(n); i++)
#define REP1(i, a, b) for (int i = (a); i <= int(b); i++)
#define... | ALGO | 0.99979 | 4.222373 |
9e9b8c66-4a30-400d-89d9-8f11d6a1f010 | YashrajSJ/Learning-DataStructure-Algorithms_with_c_plus.plus | AssignmentPractice/AssignmentsLoops_1/Practice2.cpp | // q1 Write a function to print squares of n natural numbers.
// #include<iostream>
// using namespace std;
// int main(){
// int n;
// cout<<"Enter a number ";
// cin>>n;
// for(int i=1;i<=n;i++){
// int k=i*i;
// cout<<k<<endl;
// }
// }
// q2 Write a function to take the radius ... | ALGO | 0.995986 | 4.225051 |
d66c1346-6d41-477e-9e60-269729f61336 | ishandutta2007/codeforces | juve45/normal/1249/E.cpp | #include <bits/stdc++.h>
#define st first
#define nd second
using namespace std;
void debug_out() { cerr << endl; }
template<class T> ostream& prnt(ostream& out, T v) { out << v.size() << '\n'; for(auto e : v) out << e << ' '; return out;}
template<class T> ostream& operator<<(ostream& out, vector <T> v) { return prn... | ALGO | 0.99999 | 3.261826 |
99b0b493-cfd0-4323-b901-23af65f92f70 | Suikaba/procon-solved | AOJ/0600-0649/0601-Sugar_Glider.cpp | // http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0601
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll inf = 1e18;
struct edge {
int to;
ll cost;
};
using graph = vector<vector<edge>>;
void add_edge(graph& g, int from, int to, int cost) {
g[from].push_back(ed... | ALGO | 0.999981 | 5.436427 |
d47d265d-d927-4817-8142-7bdb7f312a05 | wylu/leetcodecn | src/cpp/p1to99/6.z-字形变换.cpp | /*
* @lc app=leetcode.cn id=6 lang=cpp
*
* [6] Z 字形变换
*
* https://leetcode-cn.com/problems/zigzag-conversion/description/
*
* algorithms
* Medium (48.91%)
* Likes: 869
* Dislikes: 0
* Total Accepted: 180.3K
* Total Submissions: 368.5K
* Testcase Example: '"PAYPALISHIRING"\n3'
*
* 将一个给定字符串根据给定的行数,以... | ALGO | 0.99999 | 6.671887 |
93dbafa7-f570-43b1-8a8c-826da583af33 | ishandutta2007/codeforces | dormi/normal/1552/D.cpp | #include "bits/stdc++.h"
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
template<typename T>
int sz(const T &a){return int(a.size());}
const int MN=11;
int arr[MN];
int main(){
cin.tie(NULL);
ios_base::sync_with_stdio(false);
int t;
cin>>t;
while(t--){... | ALGO | 0.999909 | 4.040948 |
671cf02e-87dd-4ece-b2ff-e677eaa72243 | hunjyeong/Ethereum | finite/ellipticcurve.cpp | #include <iostream>
#include <openssl/sha.h>
#include <random>
#include <boost/multiprecision/cpp_int.hpp>
#include <fstream>
#include <algorithm>
#include <vector>
#include <string>
#include <numeric>
#include <math.h>
#include <iomanip>
#include <sstream>
#include <openssl/sha.h>
#include <cassert>
#include <random>
... | ALGO | 0.998415 | 5.085227 |
a7cb4b4a-8c11-44d4-9ab8-12c332cc09dd | veenits123/SDE-Sheet | 60. Permutation Sequence.cpp | // never the same!!
#include <iostream>
#include <cstdio>
#include <cmath>
#include <set>
#include <algorithm>
#include <vector>
#include <map>
#include <iomanip>
#include <cassert>
#include <string>
#include <cstring>
#include <queue>
using namespace std;
/*ϕϕϕϕϕϕϕϕϕϕϕϕϕϕϕϕϕϕϕϕϕϕϕϕϕϕϕϕϕϕϕϕϕϕϕϕϕϕϕϕϕϕϕϕϕϕϕϕϕϕϕϕϕϕϕϕϕ*/
... | ALGO | 0.999963 | 4.998496 |
14d4c47d-479e-4640-ad51-6ffd2e9ae927 | ishandutta2007/codeforces | stgatilov/normal/81/C.cpp | #include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <c... | ALGO | 0.999788 | 3.087795 |
e9d7e1a5-899a-44ff-9f4c-e30a2b2e4eba | ishandutta2007/codeforces | tinsane/normal/553/A.cpp | #include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <iomanip>
#include <queue>
#include <vector>
#include <map>
#include <cmath>
#include <string>
#include <stack>
#include <set>
#include <algorithm>
#include <list>
#pragma comment(linker, "/STACK:167772160")
using namespace std;
//8739
const double PI ... | ALGO | 0.999967 | 4.061286 |
19d74561-3ce9-4e29-926e-3992b47ad21e | rakietov/wannier | lattice.cpp | #include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <complex>
#include "lattice.h"
// ----------------------------------------------------------------------------------------
Tlattice::Tlattice( std::vector< std::complex<long double> > coeffs ) : l... | ALGO | 0.971445 | 3.234759 |
14d0a4b5-5c2e-4300-b583-3d6299206375 | raincross7/code-similarity | codes/train_code/problem436/problem436_270.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int n; cin>>n;
int arr[n];
for(int i=0;i<n;i++) cin>>arr[i];
int ans = 1e9;
for(int k=-100;k<=100;k++){
int cost = 0;
for(int i=0;i<n;i++) cost += (k-arr[i])*(k-arr[i]);
ans = min(ans,cost);
}
cout<<ans;
return 0;
} | ALGO | 0.999963 | 3.784501 |
95664647-5df0-419b-95c8-1cf074013923 | jones2000/hqchartPy2 | HQChartPy2.Free/src/HQChart.Complier.Source/HQChart.Algorithm.cpp | #include "HQChart.data.h"
#include "HQChart.Execute.h"
////////////////////////////////////////////////////////////////////////////////
// ú
//
///////////////////////////////////////////////////////////////////////////////
namespace HQChart { namespace Complier {
Variant* VariantOperator::MAX(const Variant& data, c... | ALGO | 0.992258 | 5.605963 |
b9c664d3-983c-42a5-b3f7-fc7738942465 | mahim007/Online-Judge | codeforces/A. Bear and Five Cards.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long int
map<ll,ll>M;
int main(){
ll i,j,k,sum=0;
for(i=1;i<=5;i++){
ll d;
cin>>d;
M[d]++;
sum+=d;
}
ll mx=0;
map<ll,ll>::iterator it;
for(it=M.begin();it!=M.end();it++){
if(it->second>=3){
... | ALGO | 0.999861 | 3.604208 |
69d733dc-4431-415c-9c32-39f05fe70310 | ferconde87/Programming-contests | hacker-rank/interview-preparation-kit/Search/iceCreamParlorOldSolution.cpp | #include <bits/stdc++.h>
using namespace std;
class IceCream {
public:
int flavor;
int index;
IceCream(int f, int i) {
flavor = f;
index = i;
}
};
bool compare(IceCream &a, IceCream &b){
return a.flavor < b.flavor;
}
int binarySearch(int first, i... | ALGO | 0.999994 | 4.408684 |
22d0800f-2380-46ba-9a60-f6c59b9f3838 | dat85pr/Codeptit | CodePTIT - DSA/DSA08008 - Số BDN 2.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
void testcase(){
ll n;
cin >> n;
queue<ll> q;
q.push(1);
while(1){
ll top = q.front();
if(q.front() % n == 0){
cout << q.front() << endl;
break;
}
q.pop();
q.push(top * 10);
q.push(top * 10 + 1);
}
}
int main(){
int t;
c... | ALGO | 0.999435 | 3.893444 |
53a785bb-11ef-4a67-b559-22b80e0a368f | RajkumarSony/LeetCode-Solutions | cpp/105-Construct-Binary-Tree-From-Preorder-And-Inorder.cpp | /*
Given 2 integer arrays preorder & inorder, construct & return the binary tree
Ex. preorder = [3,9,20,15,7], inorder = [9,3,15,20,7] -> [3,9,20,null,null,15,7]
Preorder dictates nodes, inorder dictates subtrees (preorder values, inorder positions)
Time: O(n)
Space: O(n)
*/
/**
* Definition for... | ALGO | 0.999989 | 7.131659 |
525ee3f9-2455-4fd0-925c-260d9035a4ed | glycerine/low-level-lush | llvm-2.8/lib/CodeGen/StackSlotColoring.cpp | #define DEBUG_TYPE "stackcoloring"
#include "VirtRegMap.h"
#include "llvm/Function.h"
#include "llvm/Module.h"
#include "llvm/CodeGen/Passes.h"
#include "llvm/CodeGen/LiveIntervalAnalysis.h"
#include "llvm/CodeGen/LiveStackAnalysis.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineInstrBuilder... | ALGO | 0.951378 | 7.628033 |
ca2a0965-9648-4987-b3fc-4fdeb2030572 | lakshitcodes/DSA_Problems | LeetCode/2338_CountTheNumberOfIdealArrays.cpp | #include <bits/stdc++.h>
using namespace std;
//Question Link : https://leetcode.com/problems/count-the-number-of-ideal-arrays/description/
const int mod = 1e9 + 7;
int factMemo[100000] = {};
int dp[100000][15];
using ll = long long;
class Solution {
public:
ll power(ll a, ll b, ll m = mod) {
ll res = 1;
... | ALGO | 0.999963 | 5.670461 |
fd40e524-0ee3-43d3-bad8-709fd43e1691 | sach4008/Practice_cpp_dsa_cp | LeetCode/1567. Maximum Length of Subarray With Positive Product.cpp | class Solution {
public:
int getMaxLen(vector<int>& nums) {
int n = nums.size();
int ans = 0, cnt = 0, tmp = 0, pos = -1;
for(int i=0;i<n;i++){
if(nums[i]==0){
cnt = 0;
tmp = 0;
pos = -1;
continue;
... | ALGO | 0.999976 | 5.931306 |
d483a0a5-94fc-4f9a-8fa4-14d4129720f5 | JavaFalls/Banzai | Custom Godot/servers/physics/joints/slider_joint_sw.cpp | /*************************************************************************/
/* slider_joint_sw.cpp */
/*************************************************************************/
/* This file is part of: */
/* ... | TOOL | 0.948803 | 5.630579 |
958a30f4-ebc7-420c-bb80-d62e4faa0e38 | InstitutoDOr/FriendENGINE | fsl/newmat/sl_ex.cpp | // This is an example of the use of solution to find the cube root of
// the integers -10 to 10
// you will need to compile and link solution.cpp and except.cpp
#define WANT_STREAM
#define WANT_MATH
#include "include.h"
#include "solution.h"
#ifdef use_namespace
using namespace RBD_LIBRARIES;
#endif
// the cube c... | TOOL | 0.998098 | 4.269 |
5ad5dd1c-9c24-41cc-a76d-5d343ee9e7d9 | LINMOH/algo_code | code/P5724.cpp | #include<iostream>
using namespace std;
int main()
{
int n;
cin >> n;
int min = 1000;
int max = 0;
for (int i = 0; i < n; i++)
{
int num;
cin >> num;
if (num > max) max = num;
else if (num < min) min = num;
}
cout << max - min;
return 0;
}
| ALGO | 0.99978 | 3.796474 |
049e93c4-e1ec-4a0b-8eee-06db90077e99 | PriyanshuSingh/CompProg | spoj/TREEGAME.cpp | #include <iostream>
#include <vector>
#include <queue>
#include <cstdio>
#include <cstdlib>
using namespace std;
vector<int> graph[10001];
int level[10001];
int le[10001];
bool vis[10001];
queue<int> q;
void levelSetter(int k,int lev){
int i;
vis[k] = true;
for(typeof(graph[k].begin()) i = graph[k].begin... | ALGO | 0.999783 | 3.577584 |
a666d1c9-9743-40bb-885a-6c8a669ac920 | Jacksonfphan/ClassCodes | strings/p11.cpp | /*Reverse String: Write a program that reverses a given
text string. For example, if the input is "hello,"
the program should output "olleh."*/
#include<iostream>
using namespace std;
int main (){
string s1;
string s2 = "";
int c = 0;
getline (cin, s1);
while (c < s1.length()) {
s2 = s1[c... | ALGO | 0.978231 | 3.212628 |
3f90338c-424a-4faf-a465-11983daedf75 | miraz23/Competetive-Programming | A_Odd_One_Out.cpp | /*
||-------------------------------||
|| Mohiul Islam Miraz ||
||-------------------------------||
*/
#include <bits/stdc++.h>
#define push \
ios_base::sync_with_stdio(0); \
cin.tie(NULL);
#define sac sort(v.begin(), v.end())
#define sdc sort(v.begin(), v.end(), grea... | ALGO | 0.999967 | 4.97113 |
341be8c0-6379-47c7-9da1-52e7b6075206 | VarickQ/ACM | HaveDone/POJ/二分图最大匹配2446.cpp | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <map>
#include <string>
#include <iostream>
#include <algorithm>
using namespace std;
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
const int inf = 100000000;
const int M = 35000;
const int N = 1030;
typede... | ALGO | 0.99995 | 3.557944 |
da83683c-43dd-42af-9e1b-24e2d543aa4c | githubUser435543/Programs | C++/maxSubArrSum.cpp | #include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "debug.h"
#else
#define debug(...)
#endif
#define arg4(a, b, c, d, ...) d
#define rep3(i, l, r) for (int i = int(l); i < int(r); i++)
#define rep2(i, n) rep3(i, 0, n)
#define rep(...) arg4(__VA_ARGS__, rep3, rep2) (__VA_ARGS__)
#define per3(i, l, r... | ALGO | 0.999943 | 3.527103 |
6ac1031b-5f9e-4e1f-b048-9a3390ba82b8 | Aethereux/Hikari-LLVM19 | libcxx/test/std/algorithms/alg.modifying.operations/alg.swap/swap_ranges.pass.cpp | // <algorithm>
// template<ForwardIterator Iter1, ForwardIterator Iter2>
// requires HasSwap<Iter1::reference, Iter2::reference>
// Iter2
// swap_ranges(Iter1 first1, Iter1 last1, Iter2 first2);
#include <algorithm>
#include <cassert>
#include <memory>
#include <utility>
#include "test_macros.h"
#include "test... | TEST | 0.857718 | 7.178187 |
04f65b2b-c173-4f5e-b258-b54bf48ab6f6 | AnupeshVerma/LeetCode_DSA | 1466-reorder-routes-to-make-all-paths-lead-to-the-city-zero/1466-reorder-routes-to-make-all-paths-lead-to-the-city-zero.cpp | class Solution {
public:
int methodOne(int n, vector<vector<int>>& connections)
{
vector<int>adj[n];
set<vector<int>>st;
for(auto i:connections)
{
st.insert(i);
adj[i[0]].push_back(i[1]);
adj[i[1]].push_back(i[0]);
}
ve... | ALGO | 0.999899 | 5.453995 |
3f069164-6045-46de-90f5-45ded8f60f99 | SovietPower/My-OI-ACM | 网络流/费用流/BZOJ.2668.[CQOI2012]交换棋子(费用流zkw)(optimize).cpp | /*
1148kb 16ms
ȺڰӵĽȼںڰͼƶָλá~~֪~~
ô嵽ָλþһ·ôģ·
Ƿֳ·յĸĴΪ1·ĸӽΪ2
뵽ÿinoutֳΪ/յ·ĴIJ
Dz㣬in,x,outxԭ㣬xΪlimin,outƽΪlim/2
ֱlim/2ôעÿֻΪյһΡxڣôΪյһζΪ㣬(in->x,(lim+1)/2),(x->out,lim/2)ǺڵףһΣõ㲻Ҫlim/2
Ѿin->xx->out1ˡ
ʼͼеĺڵi(S->x(i),1)ͼеĺڵi(x(i)->T,1)(u->v,w)ʾu->vĵߣΪw
ڵi,j(out(i),in(j),INF)
ΪʲôҪأΪڿյĵֳʼ
յ㣬һҪΪյһΣˣDz1ġ
õյ㣬$in->out$Ϊ(lim+1)/2Ϊlim... | ALGO | 0.999948 | 3.685143 |
8e93ef61-6741-4f7b-88bd-6738795f55ce | kinstaky/cssx | binlock.cpp | #include <iostream>
#include <string>
#include <bitset>
using namespace std;
int main() {
string s;
cin >> s;
bitset<30> lock(s);
cin >> s;
int len = s.length();
lock ^= bitset<30>(s);
int min = 100;
bitset<30> lim = (1 << len) - 1;
for (int i = 0; i != (1 << len); ++i) {
bitset<30> swtch = i;
int cnt =... | ALGO | 0.999907 | 3.633864 |
e7f70d74-9e99-4f21-ac5a-f32e5cb86e5b | vade3741/dsa- | recursion/recursion5backtracking/permutestring.cpp | #include<iostream>
#include<bits/stdc++.h>
using namespace std;
void permute(char *in,int i){
if(in[i]=='\0'){
cout<<in<<" ";
return;
}
//recursive case
for(int j=i;in[j]!='\0';j++){
swap(in[i],in[j]);
permute(in,i+1);
//backtracking to restore the orignal array
... | ALGO | 0.99996 | 4.929103 |
f3d41153-4ab2-4dd8-b4c0-d4ecc6dcdcc9 | bendudson/BOUT-0.8 | BOUT++/SRC/invert/invert_laplace_gmres.cpp | #include "invert_laplace_gmres.h"
#include "invert_laplace.h"
const Field3D LaplaceGMRES::invert(const Field3D &b, const Field3D &start, int inv_flags, bool precon, Field3D *a, Field3D *c)
{
flags = inv_flags;
enable_a = (a != NULL);
if(enable_a)
a3d = *a;
enable_c = (c != NULL);
if(enable_c)
c3d = ... | ALGO | 0.999596 | 4.442358 |
127e961a-068f-48e2-802e-e21cef2b0ce0 | SuzalShrestha/leetcode | 53.maximum-subarray.cpp | class Solution
{ // Bruteforce approach
public:
int maxSubArray(vector<int> &nums)
{
int n = nums.size();
int sum = INT_MIN;
for (int i = 0; i < n; i++)
{
int sum1 = 0;
for (int j = i; j < n; j++)
{
sum1 += nums[j];
sum = max(sum1, sum);
}
}
return sum... | ALGO | 0.999967 | 6.105854 |
8f145637-1066-40c4-ab2d-c9d507bce1ff | 94prathampatil/DSA-Program | Lecture 33_Recursion Day 3/binarySearchUsingRecursion.cpp | #include <bits/stdc++.h>
using namespace std;
bool binarySearch(int arr[], int n, int target, int start, int end)
{
//Base condition.
if(start > end)
return false;
int mid = start + (end - start) / 2;
if (arr[mid] == target)
{
return true;
}
//Processing + Recursive Call.... | ALGO | 0.999872 | 5.486303 |
1bbd44e2-b6ff-4108-bc4e-b16ab614853f | catsudon/TOI-prep | passed/1021.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n; cin >> n;
priority_queue<int> pq;
for(int i=0;i<n;++i)
{
char cmd;
cin >> cmd;
if(cmd == 'Q')
{
if(pq.empty()) cout << -1 << endl;
else {cout << pq.top() << endl; pq.pop();}
... | ALGO | 0.996584 | 3.760943 |
13f72e94-550b-4a81-97e8-ca22139529ca | raincross7/code-similarity | codes/train_code/problem470/problem470_134.cpp | #include <iostream>
using namespace std;
int main(){
char buf[110],stack[110]={0},*sp,*p;
while(fgets(buf,103, stdin),*buf!='.'){
sp=stack+1;
p=buf;
for(;*p!='.';p++){
if(*p == '(' || *p == '['){
*sp++ = *p;
}else if(*p == ')' || *p == ']'){
sp--;
if(!((*sp =='(' && *p == ')') || (*sp =='[' &&... | ALGO | 0.999785 | 3.43603 |
3f2a3514-5b5f-4a89-8058-e4de3fceca32 | DarwinJesusNeiraC/competitive | codeChef/balrev.cpp | /*
* @Autor: Darwin Neira Carrasco
* @Email: <EMAIL>
* @File: balrev
* @Descripcion:
*/
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define endl "\n"
#define INF 2e9
void solve(){
int n;cin>>n;
string s;cin>>s;
sort(s.begin(),s.end());
cout<<s<<endl;
}
int main(... | ALGO | 0.999938 | 4.562964 |
25bfe14d-54cc-48c8-ad62-a9ad9b52e8c4 | fed-gren/Algorithm | baekjoon/b11650.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
class Position
{
public:
int x;
int y;
Position(int x, int y) : x(x), y(y) {}
};
bool compare(Position p1, Position p2)
{
if (p1.x == p2.x)
{
return p1.y < p2.y;
}
else
{
return p1.x < p2.x;
}
}
void printPositi... | ALGO | 0.999909 | 5.53082 |
fbf3ccdc-53e4-46a0-8faa-a77179c16593 | P01Sensai/DSA | ARRAY/lineararray.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int arr[] = {1,2,3,4,5,66,87,88,78};
//int n = sizeof(arr);
//cout<<n<<endl;
int n = 9;
int find;
cout<<"Input the finding element ";cin>>find;
bool flag = 0;
//int max = INT_MIN;
for(int i=0;i<n;i++){
if(arr[i] == f... | ALGO | 0.998868 | 3.88471 |
308fda5f-4726-4557-9ddd-03ace1de827c | millaker/MiGPU-llvm-project | libcxx/test/std/utilities/function.objects/func.search/func.search.bmh/default.pass.cpp | // UNSUPPORTED: c++03, c++11, c++14
// <functional>
// boyer_moore_horspool searcher
// template<class RandomAccessIterator1,
// class Hash = hash<typename iterator_traits<RandomAccessIterator1>::value_type>,
// class BinaryPredicate = equal_to<>>
// class boyer_moore_horspool_searcher {
// public:
... | TEST | 0.885847 | 6.522567 |
34a14543-c1ce-49da-9146-af082c6233ae | khangdepzaivodich/CSES-problem-set-s-solution | Introductory Problems/HanoiTower.cpp | #include<bits/stdc++.h>
using namespace std;
void solve(char start, char mid, char target, int n){
if(n == 1){
cout<<start<<" "<<target<<endl;
return;
}
solve(start,target,mid,n-1);
cout<<start<<" "<<target<<endl;
solve(mid,start,target,n-1);
}
int main(){
int n;
cin >> n;
... | ALGO | 0.999798 | 3.814285 |
6d1624e8-32d8-42d0-ad05-e6e5c334f4d4 | deepsnow/Practice-Problems | selection_sort_pointers-to-arbitrary-types/SortArbType.cpp | // SortArbType.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "RecordList.h"
#include "StringRecord.h"
#include <iostream>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
int intListA[3] = { 1, 2, 3 };
int intListB[3] = { 1, 3, 2 };
int intListC[3] = { 2, 1, ... | TOOL | 0.940484 | 4.691153 |
c253a559-83f7-4a18-b593-00dc5f352a5d | ahanavish/DSA-using-CPP | Polynomial/add_using_LL.cpp | #include <iostream>
#include <math.h>
using namespace std;
class node
{
public:
int coeff;
int exp;
node *next;
friend class ll;
};
class ll
{
int n;
node *head;
public:
ll() { head = 0; }
~ll()
{
node *p = head;
while(head)
{
head ... | ALGO | 0.975609 | 3.582364 |
220dbe15-97f3-4a64-81ba-943098078713 | svn2github/FMSLogo | logo/tags/VER-06-07-02/src/lists.cpp | #include "allwind.h"
static
NODE *bfable_arg(NODE *args)
{
NODE *arg = car(args);
while ((arg == NIL || arg == Unbound || arg == Null_Word ||
nodetype(arg) == ARRAY) && NOT_THROWING)
{
setcar(args, err_logo(BAD_DATA, arg));
arg = car(args);
}
return arg;
}
NODE *lis... | TOOL | 0.916582 | 3.713341 |
4ff7079d-2ddc-42f0-8a4d-493f1be424ab | Kawser-nerd/CLCDSA | Source Codes/CodeJamData/12/52/8.cpp | #include <cstdio>
#include <algorithm>
using namespace std;
const int MAXN = 108;
bool mark[MAXN][MAXN];
char board[MAXN][MAXN];
int tag[MAXN][MAXN];
int bin(int i) {
return 1 << i;
}
const char *output[8] = {
"none",
"bridge",
"fork",
"bridge-fork",
"ring",
"bridge-ring",
"fork-rin... | ALGO | 0.999975 | 4.327168 |
cb01091b-698e-494b-b427-8b122c8eb216 | Yashwanth-Ramamurthi/TopoDistMF-v.1 | OGDF/src/coin/Osi/OsiGrbSolverInterface.cpp | // $Id: OsiGrbSolverInterface.cpp 1846 2012-07-25 10:50:01Z stefan $
#include <iostream>
#include <cassert>
#include <string>
#include <numeric>
#include "CoinPragma.hpp"
#include "CoinError.hpp"
#include "OsiGrbSolverInterface.hpp"
#include "OsiRowCut.hpp"
#include "OsiColCut.hpp"
#include "CoinPackedMatrix.hpp"
#i... | ALGO | 0.957392 | 4.569992 |
ba5fed91-b685-4fc4-9b75-04f59a8039cb | nhh9905/Code-PTIT | C++/cpp0152.cpp | #include <bits/stdc++.h>
#define ll long long
using namespace std;
int main() {
int t;
cin >> t;
while (t--) {
int a, m;
bool dd = 0;
cin >> a >> m;
for (int i = 1; i < m; i++) {
if (a*i % m == 1) {
dd = 1;
cout << i << endl;
... | ALGO | 0.999916 | 4.260978 |
79bdad29-5aad-410b-b0d8-b3e41b05f48c | dedeha39/Image-Patching-for-Corrupted-Image-Restoration | Project_CV/Lab_4.cpp | // *****************************
// Name = Ismail Deha
// Surname = Kose
// Student ID = 2072544
// Task = Lab 4
// |->Used StarWars picture which have 4 patch
// ****************************
#include <opencv2/opencv.hpp>
#include <iostream>
#include <string>
// Function to prompt the user to enter the number of pat... | ALGO | 0.924218 | 4.023373 |
494516c4-36c5-4c21-aebb-a1a04d28a6b1 | Arik096/Graphics-LAB | lab 1 b section/draw cube/main.cpp | #include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include <windows.h>
#include <glut.h>
#define pi (2*acos(0.0))
double cameraHeight;
double cameraAngle;
int drawgrid;
int drawaxes;
double angle;
struct point
{
double x,y,z;
};
void drawAxes()
{
if(drawaxes==1)
{
glColor3f(1.0, 1.0, 1.0);
glBegin(GL_LI... | TOOL | 0.890643 | 4.153827 |
bd846d3d-bbfa-43b2-aaf6-4813feeacdbd | suhaas02/Data-structures-and-algorithms | 150-evaluate-reverse-polish-notation/evaluate-reverse-polish-notation.cpp | class Solution {
public:
int evalRPN(vector<string>& tokens) {
stack<int> nums;
stack<string> op;
int ans = 0;
for(int i = 0; i < tokens.size(); i++)
{
if(tokens[i] == "+" or tokens[i] == "-" or tokens[i] == "*" or tokens[i] == "/")
{
i... | ALGO | 0.999918 | 5.933531 |
b6d6ffc6-3a87-4881-b573-57f87490897d | NamKey/bigstone_algo | week3_pset/p16234.cpp | //
// Created by 남기륭 on 2022/10/25.
//
#include <iostream>
#include <queue>
#include <cstring>
using namespace std;
int inguMap[50][50];
bool visited[50][50];
int N;
int L, R;
int sumIngu;
vector<pair<int, int>> nationPos;
const int dy[] = {-1, 0, 1, 0};
const int dx[] = {0, 1, 0, -1};
int step = 0;
void dfs(int ... | ALGO | 0.999851 | 4.503024 |
327c4ca2-c9a6-4565-8c95-9db530fb546c | bayashi-cl/procon-submission | codeforces/1611/C/136906718.cpp | #line 2 "byslib/template/bys.hpp"
#ifndef LOCAL
#define NDEBUG
#endif
#include <algorithm>
#include <array>
#include <cassert>
#include <cmath>
#include <complex>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sta... | ALGO | 0.999968 | 4.840398 |
0980d08b-925a-4444-b1f0-00210dace04c | GyeongSam/1Dday-1Algorithm | 230717~/0919_BJ_S1_트리 순회/1991.cpp | #include <iostream>
#include <vector>
using namespace std;
void dfs(int node, const vector<vector<int>>& grp, vector<vector<char>>& answer) {
answer[0].push_back(node);
if (grp[node][0] != 0) dfs(grp[node][0],grp,answer);
answer[1].push_back(node);
if (grp[node][1] != 0) dfs(grp[node][1],grp,answer);
answer[2].pu... | ALGO | 0.999635 | 4.248426 |
c987867f-759f-464e-8bea-3ffc8bbe3158 | Yukariko/acm | problem/12026/test.cpp | #include <bits/stdc++.h>
using namespace std;
const int INF = 987654321;
const char *mark = "BOJ";
int N;
char a[1001];
int cache[1001][3];
int solve(int pos, int idx)
{
if(pos == N-1)
return 0;
int& ans = cache[pos][idx];
if(ans != -1)
return ans;
ans = INF;
for(int i=pos+1; i < N; i++)
if(a[i] == ma... | ALGO | 0.999929 | 3.70833 |
2f4ba57e-71e1-4881-80fc-1d2d1ad0ff07 | JoanValiente/eXtremePinball | Pinball/Box2D/Box2D/Dynamics/Contacts/b2ChainAndPolygonContact.cpp | #include <Box2D/Dynamics/Contacts/b2ChainAndPolygonContact.h>
#include <Box2D/Common/b2BlockAllocator.h>
#include <Box2D/Dynamics/b2Fixture.h>
#include <Box2D/Collision/Shapes/b2ChainShape.h>
#include <Box2D/Collision/Shapes/b2EdgeShape.h>
#include <new>
b2Contact* b2ChainAndPolygonContact::Create(b2Fixture* fixtureA... | ALGO | 0.994561 | 6.405189 |
fc806e4c-baab-4cda-8888-53fff6681b0b | lakorovin/coderun | partial-reverse/solution.cpp | #include "solution.h"
#include <cassert>
using namespace std;
/** Comment it before submitting
struct Node {
int val;
Node* next;
Node(int val_, Node* next_) {
val = val_;
next = next_;
}
};
**/
Node* Reverse(Node* head, int left, int right) {
assert(left <= right);
Node fakeh... | ALGO | 0.999985 | 5.023788 |
1d97a383-6c95-4fb4-b704-7439e7c3035c | haripriyadutta/summer_internship_2024 | Next Permutations.cpp | class Solution {
public:
void nextPermutation(vector<int>& v) {
if(v.size()==1) return;
if(v.size()==2){
swap(v[1], v[0]); return;
}
int i=v.size()-2;
for(;i>=0;i--){
if(v[i]<v[i+1]) break;
}
sort(v.begin()+i+1, v.end());
if(i==... | ALGO | 0.999988 | 5.486224 |
30677c66-d723-4589-8347-80ee57b70412 | iabh1shek/ProblemsHackerrank | coding bootcamp/69_Selection_sortarray.cpp | #include<bits/stdc++.h>
using namespace std;
void printarray(int arr[], int size) {
for(int i = 0; i < size; i++) {
cout<<arr[i]<<" ";
}
cout<<endl;
}
int main () {
int arr[6] = {1,2,2,3,6,3};
for(int i = 0; i < 6; i++) {
for(int j = i + 1; j < 6; j++) {
if(arr[j] < a... | ALGO | 0.999525 | 4.151877 |
01495531-8dd6-4644-adf0-f83dcd69cd82 | Avi-141/Competitive_Programming | Hackerearth/Barclays Challenge/HardSum.cpp | #include <bits/stdc++.h>
using namespace std;
const unsigned long long int MOD = 1000000007;
unsigned long long int pairAndSum(vector<unsigned long long int> &vect, unsigned long long int n)
{
unsigned long long int ans = 0;
for (unsigned long long int i = 0; i < 32; i++)
{
unsigned long long ... | ALGO | 0.999965 | 4.181834 |
e8da942d-c7d5-4c09-9dcc-98271f09d2c2 | caru1613/algorithm_with_languages | brain_stimulating_algorithm/01_list/DoubleLinkedList/DoubleLinkedList.cpp | #include "DoubleLinkedList.h"
#include <iostream>
Node* DoubleLinkedList::CreateNode(ElementType NewData)
{
Node* NewNode = new Node;
NewNode->Data = NewData;
NewNode->PrevNode = NULL;
NewNode->NextNode = NULL;
cout << __func__ << " " << NewNode << " " << NewNode->Data << endl;
return NewNode;... | ALGO | 0.889637 | 4.331415 |
7b7fee2e-4ed1-4ab8-9ede-7caf8c5edc5e | intzeros/coding4fun | hihocoder/1489-Legendary Items.cpp | #include <iostream>
#include <stdio.h>
#include <vector>
#include <math.h>
using namespace std;
double solve(double p, double q){
double rst = 0;
if(fabs(p-1.0) < 0.000000001) return 1.0;
if(p > 0.000000001) rst += 1*p;
int k = 1;
double tmp = 1;
while(true){
if(p + k*q >= 1.0){
... | ALGO | 0.999914 | 3.580528 |
37071567-4c91-4c11-9815-bb609f1eb408 | PaulTheLionHeart/manpwin | Genline.cpp | /*
GENLINE.CPP -- high level interface to video routines.
Global line routines.
Written in Visual 'C++' by Paul de Leeuw 23/05/92.
VESA P. de Leeuw 22/12/94
This program is written in "standard" C. Hardware dependant code
(console drivers & serial I/O) is in separate machine libraries.
*/
... | ALGO | 0.900565 | 4.787777 |
c2a7efa9-93d9-4888-bca7-4b17c41d2663 | ishandutta2007/codeforces | potassium/normal/1017/A.cpp | #pragma GCC optimize ("O3", "unroll-loops")
// #pragma GCC target ("avx2")
// #pragma comment(linker, "/stack:200000000")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include "bits/stdc++.h"
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define disti... | ALGO | 0.999849 | 3.962016 |
96694195-6db8-47bc-aca5-fa57b835a8c6 | POC-2025/leetcode | lcof/面试题58 - II. 左旋转字符串/Solution.cpp | class Solution {
public:
string reverseLeftWords(string s, int n) {
return s.substr(n) + s.substr(0, n);
}
}; | ALGO | 0.999647 | 6.619859 |
ca8d2321-bffd-48cb-94bd-5c8ea4b6f46f | TravHaran/premium_algo_100_cpp | math/count_substrings_one_distinct_letter/solution.cpp | class Solution {
public:
int countLetters(string s) {
int width = 0;
int l = 0, r = 1;
int count = 0;
while(r < s.size()){
if(s[r]==s[r-1]){
r++;
} else {
width = r-l;
count += (width*(width+1))>>1;
... | ALGO | 0.999966 | 6.183544 |
653301ce-4d02-47e7-9952-402033b2477a | DuhaZuhayr/Code | shortest.cpp | #include <iostream>
#include <unordered_map>
#include <vector>
#include <limits>
#include <set>
#include <string>
using namespace std;
class NetworkRouting {
protected:
unordered_map<string, unordered_map<string, int>> graph;
public:
void add_edge(const string& from, const string& to, int weight) {
g... | ALGO | 0.999966 | 5.993007 |
a24abcec-f7a0-41d3-bafa-ef0fbc3c3e76 | Blockchain-Research-Lab-Trainees/BRL-Task-1 | 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.998764 | 6.762122 |
e816f629-36e6-45df-a0ed-e7c8be22043e | shailpujan88/leetcode-daily-question | 0496-next-greater-element-i/0496-next-greater-element-i.cpp | class Solution {
public:
vector<int> nextGreaterElement(vector<int>& nums1, vector<int>& nums2) {
unordered_map<int,int> mpp; // A map to store the next greater number for each element in nums2
stack<int> st; // A stack to help find the next greater number
for(int i = nums2.size()-1 ; i>=0; i--){... | ALGO | 0.999796 | 6.170923 |
892e0d81-1b25-472d-bb20-be4f354ac941 | whysodrooled/BOJ | cpp/1010.cpp | #include <bits/stdc++.h>
using namespace std;
int t;
int n, m;
int temp;
unsigned long long int lol;
int main()
{
cin.tie(NULL);
ios_base::sync_with_stdio(false);
cin >> t;
while(t > 0)
{
cin >> n >> m;
lol = 1;
temp = 1;
for(int i = m; i > m-n; i--)
{
... | ALGO | 0.999986 | 5.011622 |
a72d8449-0ffd-4384-8681-d2a468477b92 | LiveMirror/freedownload | trunc/Bittorrent/libtorrent/src/pe_crypto.cpp | #ifndef TORRENT_DISABLE_ENCRYPTION
#include <boost/cstdint.hpp>
#include <algorithm>
#if defined TORRENT_USE_GCRYPT
#include <gcrypt.h>
#elif defined TORRENT_USE_OPENSSL
#include <openssl/bn.h>
#include "libtorrent/random.hpp"
#elif defined TORRENT_USE_TOMMATH
extern "C" {
#include "libtorrent/tommath.h"
}
#include "... | ALGO | 0.978439 | 6.277084 |
b9b2dedd-4ad3-47d4-a57f-83657051d269 | tt1k/ours | 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 |
d6d8812d-a69c-4891-96eb-1297e42430a3 | xiaofan6033/LLVM-CFI | source_code/tools/clang/lib/AST/DeclObjC.cpp | #include "clang/AST/DeclObjC.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/ASTMutationListener.h"
#include "clang/AST/Attr.h"
#include "clang/AST/Stmt.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallString.h"
using namespace clang;
//===------------------------------------------------------------... | TOOL | 0.981871 | 7.316666 |
987ad906-6df0-47bb-8a97-a568ba195b49 | rbtre/rbtre.github.io | assets/code/P2392.cpp | #include <cstdio>
#include <algorithm>
using namespace std;
int s[5], a[25];
int left, right, minn;
void dfs(int p, int i) {
if (p > i) {
minn = min(minn, max(left, right));
return;
}
left += a[p];
dfs(p + 1, i);
left -= a[p];
right += a[p];
dfs(p + 1, i);
right -= a[p... | ALGO | 0.999885 | 3.015296 |
786111d8-ef1d-49a0-a0a5-0be6a3bc187b | Barmanpriyanka/Strivers-A2Z-DSA | heap/min_maxheap_implementation.cpp |
/*The structure of the class is
struct MinHeap
{
int *harr;
int capacity, heap_size;
MinHeap(int cap) {heap_size = 0; capacity = cap; harr = new int[cap];}
int extractMin();
void deleteKey(int i);
void insertKey(int k);
int parent(int i);
int left(int i);
int right(int i);
};*/
//... | ALGO | 0.999909 | 4.596455 |
2655da3c-76e4-4c3a-9377-61ecb3b87eba | ishandutta2007/codeforces | yousef_salama/normal/444/E.cpp | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 3005;
int n, ai, bi, ci, X[MAXN];
vector < pair <int, int> > G[MAXN];
bool vis[MAXN];
int dfs(int i, int v){
vis[i] = true;
int r = 1 + X[i];
for(pair <int, int> u : G[i]){
if(vis[u.first])continue;
if(u.second >= v)conti... | ALGO | 0.99992 | 3.975279 |
4d09a129-12ab-46ab-abde-b8ca2b82d338 | ToshikiShimizu/AtCoder | ABC/073/c.cpp | #include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define SUM(a) accumulate((a).begin(),(a).end(),0)
#define SORT(a) sort(ALL(a))
#define REV(a) reverse(ALL(a))
#define dump(x) cerr << #x << " = " << (x) << endl... | ALGO | 0.999752 | 4.044962 |
78bf7fec-66de-4268-8c02-f8defa41b5d1 | chuang0221/leetcode | Dynamic Programming/5. Longest Palindromic Substring/main.cpp | #include <iostream>
#include <string>
#include <algorithm>
using namespace std;
class Solution {
public:
string remove(string& s, char target) {
string output;
int start = 0, end = s.length();
int insertIdx = 0;
for (int i = 0; i < end; i++) {
if (s.at(i) != target) {
... | ALGO | 0.999982 | 4.887554 |
94e1cede-4f36-4aaa-9205-18ac1db2a5d9 | changmu/StructureAndAlgorithm | HDOJ/11421.cpp | ////////////////////System Comment////////////////////
////Welcome to Hangzhou Dianzi University Online Judge
////http://acm.hdu.edu.cn
//////////////////////////////////////////////////////
////Username: changmu
////Nickname: ľ
////Run ID:
////Submit time: 2014-08-14 10:21:25
////Compiler: Visual C++
////////////////... | ALGO | 0.99997 | 4.376609 |
1dadbc0a-ab93-48ca-a9fd-d59d7614753b | anotherub/cprograms | sparse array/main.cpp | #include <iostream>
#include<stdlib.h>
#include<map>
#include<iterator>
using namespace std;
map<string,int>data;
map<string,int>::iterator itr;
void insertdata(string str)
{
for(itr=data.begin();itr!=data.end();itr++)
{
if((*itr).first==str)
{
(*itr).second++;
break;
}else
{
data.insert(pair<string,int>(str,0));}
}
... | ALGO | 0.998892 | 4.065974 |
4fe69fe0-8ffe-4753-82a5-dbde66080eed | scriptsengineer/how_to_program_cpp | introduction/compare.cpp | #include <iostream>
using std::cin;
using std::cout;
using std::endl;
int main() {
int number1;
int number2;
cout << "Enter number 1:";
cin >> number1;
cout << "Enter number 2:";
cin >> number2;
if (number1 == number2) {
cout << number1 << "==" << number2 << endl;
}
if (number1 != number2) {
... | ALGO | 0.995112 | 3.380121 |
d0ef9712-6ea5-4159-8a3a-deb4c6f191d5 | saikrishna17394/OGDF | src/coin/CoinUtils/CoinPresolveDual.cpp | /* $Id: CoinPresolveDual.cpp 1373 2011-01-03 23:57:44Z lou $ */
#include <stdio.h>
#include <math.h>
#include "CoinPresolveMatrix.hpp"
#include "CoinPresolveFixed.hpp"
#include "CoinPresolveDual.hpp"
#include "CoinMessage.hpp"
#include "CoinHelperFunctions.hpp"
#include "CoinFloatEqual.hpp"
//#define PRESOLVE_TIGHTEN... | ALGO | 0.997407 | 5.470572 |
de59f4b6-6063-4d85-98d2-21d22dc8a80c | nikhilsourav/Data-Structures-and-Algorithms | 05. Array/24. Min Consecutive flips/flips.cpp | /*
Given a binary array, we need to find the minimum of number of
group flips to make all array elements same. In a group flip,
we can flip any set of consecutive 1s or 0s.
*/
#include <bits/stdc++.h>
using namespace std;
// Time complexity: O(n)
void printGroups(int arr[], int size)
{
// Logic:
... | ALGO | 0.999924 | 5.031739 |
39700189-73f0-44a5-9122-201de2f728ba | wakamebu/AtcoderPractice | abc333/d/main.cpp | #include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
using ll = long long;
using P = pair<int,int>;
#define rep(i,n) for(int i = 0; i < (n); i++)
int main() {
int n;
cin >> n;
//隣接リスト
vector<vector<int>> to(n);
rep(i,n-1){
int a,b;
cin >> a>> b;
a--;b--;
... | ALGO | 0.994917 | 4.565031 |
e63d5739-7393-465b-b338-40368b1c6f35 | vgslavov/Problems | leetcode/can_jump.cpp | #include <algorithm>
#include <vector>
// number: 55
// title: Jump Game
// url: https://leetcode.com/problems/jump-game/
// section: array / string
// difficulty: medium
// tags: array, greedy, dp, top 150
// constraints
// 1 <= nums.length <= 10^4
// 0 <= nums[i] <= 10^5
bool canJumpI(const std::vector<int>& nums,... | ALGO | 0.999972 | 6.774899 |
0122901f-a180-4a64-b643-15a01853e617 | RohanGodha/code-daily-repo | Linked List/declaration.cpp | #include <iostream>
#include <unordered_map>
using namespace std;
struct listNode {
int data;
listNode *next;
void printList(listNode *n)
{
while(n!=NULL)
{
cout<<n->data<<endl;
n=n->next;
}
}
};
listNode *push(listNode *head,int newdata)
{
... | ALGO | 0.990784 | 4.100269 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.