uuid
string
repo_name
string
relative_path
string
content
string
category
string
algo_rel_score
float64
quality_score
float64
8d773d15-ddc3-4ae8-b0c9-239705b5fabd
StartAt24/leetcode
basic_data_structure/array/380_insert_delete_getRandom.cpp
#include <iostream> #include <vector> #include <map> using std::unordered_map; using std::vector; class RandomizedSet { public: RandomizedSet() { } bool insert(int val) { if (_valToIndex.count(val)) return false; _valToIndex[val] = _nums.size(); _nums.push...
ALGO
0.996839
6.044023
38c68326-673f-4595-a717-f15048554168
br7dev/atom-Cpp
LeetCode/30_day_challenge_april2020/1.cpp
#include<bits/stdc++.h> using namespace std; main() { int a , b, sum; cout<<"enter the operators:"<<endl; cin>>a>>b; sum = a^b; cout<<"sum is: "<<sum; }
ALGO
0.99984
3.68454
f00330f0-e313-4d59-b5b0-7fb1913c2e86
usefmahmud/leetcode-problems
540-single-element-in-a-sorted-array/single-element-in-a-sorted-array.cpp
class Solution { public: int singleNonDuplicate(vector<int>& nums) { int l = 0, r = nums.size()-1, m; if(r == 0) return nums[0]; while(l < r){ m = (l + r) / 2; if(m%2 != 0) --m; if (nums[m] == nums[m+1]) { l = m + ...
ALGO
0.999661
5.865839
c205a55e-48a4-4814-8910-0c378c6c7f9d
RinatMambetov/I-am-learning
learn-cpp/lessons/doubleNumber.cpp
#include <iostream> int doubleNumber(int x) { return x * 2; } int main(void) { int x; std::cin >> x; std::cout << doubleNumber(x) << std::endl; }
TOOL
0.936013
4.944555
31f5b3f5-c72b-47f5-b28e-977662ea042b
Sprdalo/DP
max_put_matrix.cpp
#include <bits/stdc++.h> using namespace std; //A proud student of Gimnazija Svetozar Markovic Nis //From Serbia //Team member of SouthSerbia Dziberi //My professor is a grandmaster //Can't be hacked m8! //Try me b!tch !!! typedef long long ll; typedef vector<int> vi; typedef vector<ll> vl; typedef vector<double...
ALGO
0.999991
3.92114
9c5ba80f-5abc-478e-8283-e7bb23ba6946
ishandutta2007/codeforces
kevinxiehk/normal/1214/D.cpp
#include<bits/stdc++.h> using namespace std; #define pb push_back int v[1000100]; int n,m; bool vi[1000100][3]; int lol(int a,int b){ return (a-1)*m+b-1; } void bfs(int a,int b,int d){ if(a<=0||b<=0)return; if(a>n||b>m)return; if(v[lol(a,b)]==-1)return; if(vi[lol(a,b)][d+1])return; // cout<<...
ALGO
0.999925
3.477929
58f9715e-d511-41bf-b9e8-848bbfb8fc9d
SamathaAshokkumar/CodeVerse-cpp
stack_stack.cpp
#include<iostream> #include<string.h> #include<cstring> using namespace std; struct node { int data; struct node *link; }*top1,*top2=NULL; void insert1(int value) { struct node *temp=(struct node*)malloc(sizeof(struct node)); struct node *prev=(struct node*)malloc(sizeof(struct node)); temp->dat...
ALGO
0.998156
3.366726
87167633-ba8f-4e48-8831-dd71ef2debbf
abnayak/brainz
Algorithms/Array/quickSort.cpp
#include <iostream> #include <algorithm> #include <iterator> using namespace std; int partition(int arr[], int low, int high){ int pivot = arr[low]; int j = low; for (int i = low+1; i <= high; ++i){ if ( arr[i] <= pivot){ j++; swap(arr[j],arr[i]); } } swap(arr[low],arr[j]); return j; } void quickSort...
ALGO
0.999864
4.903551
983be6a0-fe59-4427-8e6e-f7a8978d9b6d
best-Hui/Games202
Assignment2/prt/ext/openexr/OpenEXR/IlmImf/ImfFastHuf.cpp
#include "ImfFastHuf.h" #include <Iex.h> #include <string.h> #include <assert.h> #include <math.h> #include <vector> OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_ENTER // // Adapted from hufUnpackEncTable - // We don't need to reconstruct the code book, just the encoded // lengths for each symbol. From the lengths, we can...
ALGO
0.931645
5.674493
66626dde-3032-4cc9-a0a6-deccb2817222
Artcs1/ConcursodeProgramacionUNT2019
Master/b.cpp
#include <bits/stdc++.h> #define MAX 10010 using namespace std; int N; int C[MAX]; int memo[MAX]; int dp (int idx) { if (memo[idx] != -1) return memo[idx]; int res = 0; for (int i = idx+1 ; i < N ; i++) { if (C[i] % C[idx] == 0) res = max(res, 1 + dp(i)); } return memo[idx] = res; } int main () { int...
ALGO
0.999996
3.465738
b1950f52-af7b-44f2-bd5a-a7d620d7adfc
muhammad-sayem/AtCoder
B_Almost_GCD.cpp
#include<bits/stdc++.h> #define endl '\n' #define yes cout << "YES" << endl #define no cout << "NO" << endl #define ll long long #define pb push_back #define pii pair <int,int> #define pll pair <long...
ALGO
0.999978
3.433486
8aec1ddc-8346-46eb-874e-9d6f9cc01ac6
NNeuralDynamics/differential-isoform-salmon
STAR-2.7.11a/source/ClipMate_clip.cpp
#include "ParametersClip.h" #include "Parameters.h" #include "SequenceFuns.h" uint32 ClipMate::clip(uint &Lread, char *seqNum) { clippedN=0; if (type<0) return 0; //no clip for this mate uint LreadOld=Lread; if (N>0) {//clip N bases if (Lread>N) { Lread -= N; // for 3p this is all clippedN += N; if...
TOOL
0.991497
5.075704
17b2e1c0-4b86-4c55-aaab-a4f331c1165b
KatsuyaKikuchi/ProgrammingContestCpp
AtCoder/tenkei90/026.cpp
#include <iostream> #include <vector> #include <string> #include <algorithm> #include <functional> #include <queue> #include <stack> #include <iomanip> #include <cmath> #include <map> #include <set> using namespace std; using ll = long long int; using pll = pair<ll, ll>; #define FOR(i, n, m) for(ll i = (m);(i)<(n);++...
ALGO
0.999948
4.454608
b9d319c6-6aba-48be-bf7b-082f5490192d
SPsuyash/LeetCode
2220-minimum-bit-flips-to-convert-number/2220-minimum-bit-flips-to-convert-number.cpp
class Solution { public: int minBitFlips(int start, int goal) { int c=0; int ans=start^goal; for(int i=0;i<31;i++) { if(ans) { c+=ans&1; ans>>=1; } } return c; } };
ALGO
0.999985
5.694513
248a995f-5e63-43b3-b6d7-ca4b36d5cdc4
w74srm/tsinghua
cppfile/zojpatest/1151.cpp
#include <iostream> #include <vector> #include <map> using namespace std; map<int, int> pos; vector<int> in, pre; void lca(int inl, int inr, int preRoot, int a, int b) { if (inl > inr) return; int inRoot = pos[pre[preRoot]], aIn = pos[a], bIn = pos[b]; if (aIn < inRoot && bIn < inRoot) lca(i...
ALGO
0.999982
4.411261
0f474e32-1a88-4691-a7c8-19bf2e699e8c
TranMinhHieu2/CODE-C-
CPP0141 kiem tra so fibonacci.cpp
#include <bits/stdc++.h> using namespace std; long long fibonaci(long long n){ long long a1=1, a2=1; if(n==1||n==2) return 1; long long a=0; while(a<n){ a=a1+a2; a1=a2; a2=a; } if(a==n) return 1; else return 0; } int main(){ int t; cin>>t; while(t--){ long long n; cin>>n; if(fibonaci(n)==1) cout...
ALGO
0.999991
5.347653
060b0a13-9e91-4108-a122-ce1ac0b27b4b
ishan0805/gfg_must_do
class.cpp
#include<iostream> using namespace std; class Point { public: int *x=nullptr;int y; Point(int &x1) { x= &x1; } int getx() { return *x; } }; int main() { int r=10; int e=25; int *t= &r; int *p= &e; Point *P1=new Point(r); Point ...
ALGO
0.919206
3.760128
55d06f98-e641-4ee7-8ea1-31377f2729e5
datahaven/CodersOfTheCaribbean
HexGrid.cpp
#include "Vector2.h" // TAG_REMOVE #include "HexGrid.h" // TAG_REMOVE #include <cstdlib> // TAG_REMOVE Vector2 HexGrid::Neighbour(Vector2 position, int orientation) { int DIRECTIONS_EVEN[][2] = { { 1, 0 },{ 0, -1 },{ -1, -1 },{ -1, 0 },{ -1, 1 },{ 0, 1 } }; int DIRECTIONS_ODD[][2] = { { 1, 0 },{ 1, -1 },{ 0, -1 },{ ...
ALGO
0.993953
5.644339
35fdc0c5-b86c-4644-aac2-a4fa38677d20
Nevil844/codeForces
Implementation-50/foxAndSnake.cpp
#include <iostream> #include <bits/stdc++.h> using namespace std; int main(){ int row,col; cin>>row>>col; bool headTail; for(int i=0; i<row; i++){ headTail=0; for(int j=0; j<col; j++){ if((i+1)%2!=0){ cout<<"#"; }else{ if((((i+1)/2...
ALGO
0.999826
3.51705
0287b376-f22e-4d18-9bc2-e97556057853
SiwanLee/4weeks
Power.cpp
// Power.cpp : 이 파일에는 'main' 함수가 포함됩니다. 거기서 프로그램 실행이 시작되고 종료됩니다. // #include <iostream> #include <stdio.h> #include <stdlib.h> #include <conio.h> using namespace std; int power(int a, int b); int main() { int count; count = power(2, 10); printf("%d", count); } //int power(int a, int b) //{ // pow(a, b); // ret...
ALGO
0.98346
4.957445
c13f9556-613f-4b18-9049-153b3d5d97bc
LokeshKumarkumawat/DSA
Dynamic Programming/code help/04 house robber.cpp
class Solution { public: int rob(vector<int>& nums) { int n = nums.size(); if (n == 1) return nums[0]; vector<int> dp(n, nums[0]); dp[1] = max(nums[0], nums[1]); for (int i = 2; i < n; i++) { dp[i] = max(dp[i-1], dp[i-2]+nums[i]); } ...
ALGO
0.999844
5.992281
59a88296-caa7-41c0-a00c-bff94256f753
wisamreid/NodUrIK
eigen/doc/examples/Tutorial_BlockOperations_colrow.cpp
#include <Eigen/Dense> #include <iostream> using namespace std; int main() { Eigen::MatrixXf m(3,3); m << 1,2,3, 4,5,6, 7,8,9; cout << "Here is the matrix m:" << endl << m << endl; cout << "2nd Row: " << m.row(1) << endl; m.col(2) += 3 * m.col(0); cout << "After adding 3 times the first colu...
ALGO
0.992064
3.576145
5cc80984-40dc-45b0-a100-0147cea66674
ljw020711/Problem_Solving
재귀/1629.cpp
#include <iostream> using namespace std; int abmodc(long long a, long long b, long long c) { if(b == 1) { return a % c; } else { long long tmp = abmodc(a, b / 2, c); long long ans = tmp * tmp % c; if(b % 2 != 0) { ans = ans * (a % c) % c; } return ans; } } int main() ...
ALGO
0.999969
5.09718
18abf722-bc86-44ec-9836-79d972e99985
LarsHaalck/CATER
lib/panorama/src/similarityGlobalOptimizer.cpp
#include "similarityGlobalOptimizer.h" namespace ct { SimilarityGlobalFunctor::SimilarityGlobalFunctor( const Eigen::Vector2d& q1, const Eigen::Vector2d& q2, double weight) : mQ1(q1) , mQ2(q2) , mWeight(weight) { } } // namespace ct
TOOL
0.90942
4.618975
e9c40212-1eb1-419f-a2a9-59e14339fc33
rishitha-2406/leetcode
3243-count-the-number-of-powerful-integers/3243-count-the-number-of-powerful-integers.cpp
class Solution { public: long long numberOfPowerfulInt(long long start, long long finish, int limit, string s) { const string a = to_string(start); const string b = to_string(finish); const string aWithLeadingZeros = string(b.length() - a.length(), '0') + a; vector<vec...
ALGO
0.999709
6.121392
39b33a0f-1efa-4e86-937f-947bdfb12380
uvbs/tama
XE/Third_Party_lib/Oolong_Engine2/Bullet/src/BulletCollision/CollisionDispatch/btBoxBoxDetector.cpp
///ODE box-box collision detection is adapted to work with Bullet #include "btBoxBoxDetector.h" #include "BulletCollision/CollisionShapes/btBoxShape.h" #include <float.h> #include <string.h> btBoxBoxDetector::btBoxBoxDetector(btBoxShape* box1,btBoxShape* box2) : m_box1(box1), m_box2(box2) { } // given two boxes (p...
ALGO
0.999411
6.240304
3e9cf8a7-2a7c-4551-8051-c468d8d10f13
samarslan/cdersleri
23.03.2022/Asal.cpp
#include <stdio.h> int main(){ int x; int sayac=2; bool isPrime=true; printf("Sayı girin: "); scanf("%d", &x); while(sayac<x){ if(x==2) { isPrime=true; break; } if(x%sayac==0) { isPrime=false; break; } sayac++; } if(isPrime){ printf("\nSayı...
ALGO
0.999722
3.991413
a46de927-4e91-492c-9730-b7a8bec916fc
MattCzajkowski/GenCoF
GenCoF-master/Bowtie2/bowtie2-2.3.4.1/unique.cpp
#include "unique.h" using namespace std; // There is no valid second-best alignment and the best alignment has a // perfect score. const TMapq unp_nosec_perf = 44; // There is no valid second-best alignment. We stratify the alignment // score of the best alignment into 10 bins. const TMapq unp_nosec[11] = { 43, 42...
ALGO
0.984568
6.31644
d46ebd02-e6c8-44a4-87f3-550ff1b06f95
mahekshah21314/Flutter_Practical_22000248
working_with_shared_preferences/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.998934
6.76775
75fe705b-9612-4a15-8e26-41aa9af4fc58
wells-wei-wei/smplify-x_in_docker
opencv-4.2.0/samples/cpp/tutorial_code/features2D/AKAZE_match.cpp
#include <opencv2/features2d.hpp> #include <opencv2/imgproc.hpp> #include <opencv2/highgui.hpp> #include <iostream> using namespace std; using namespace cv; const float inlier_threshold = 2.5f; // Distance threshold to identify inliers with homography check const float nn_match_ratio = 0.8f; // Nearest neighbor mat...
ALGO
0.980705
6.1825
d1d7aac8-81a7-4e75-9fc2-cef551566d55
ishandutta2007/codeforces
enem/normal/1045/I.cpp
#include <bits/stdc++.h> using namespace std; #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; #define M1 1000000007 #define M2 998244353 #define ll long long #define pll pair<ll,ll> #define REP(i,a,b) for(ll i=a;i<b;i++) #define REPI(i,a,b) for(ll i=b-1;i>=a;i--...
ALGO
0.999923
4.34421
a9c4c1be-8939-4357-b8d6-5cc698a00f71
physicalist/ncbs-moose
moose/branches/camel/biophysics/VClamp.cpp
// VClamp.cpp --- // // Filename: VClamp.cpp // Description: // Author: // Maintainer: // Created: Fri Feb 1 19:30:45 2013 (+0530) // Version: // Last-Updated: Wed Feb 6 17:22:55 2013 (+0530) // By: subha // Update #: 281 // URL: // Keywords: // Compatibility: // // // Commentary: // // Im...
TOOL
0.926854
6.311222
751a6413-59e1-49ff-835c-78df23e10f72
umeshsaini19/Leetcode-solutions
144-binary-tree-preorder-traversal/144-binary-tree-preorder-traversal.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.999967
6.45166
15f375af-cb4e-4239-a41f-60d1ae9cc205
Ujk768/DSA
DSA/Graphs/shortest_path_in_undirected_graph._with_weights.cpp
#include<iostream> #include<vector> #include<queue> #include<stack> using namespace std; /** * @brief * 1. take a distance array of size N and all is marked as infinity * 2. take a queue ds and put src node in it and mark dist 0 as 0 * 3. queue is always going to store the nodes * 4. take the top element of the ...
ALGO
0.999984
5.360572
bff29da8-bfac-4f47-9a62-51b93a2d1335
Yujin0328/Baekjoon
Number_2743.cpp
#include <stdio.h> #include <iostream> #include <string> using namespace std; int main() { string s; cin >> s; cout << s.length(); }
ALGO
0.993101
3.400403
e2e683d4-93b2-4872-aee9-079dbecab824
Rithishrana/192211113
reverse array prg_1676611299025.cpp
#include<stdio.h> int main() { int a[]={16,18,27,16,23,21,19},i,n; n=sizeof(a)/sizeof(a[0]); printf("Orginal array:\n"); for(i=0;i<n;i++) { printf("%d",a[i]); } printf("\n"); printf("array in reverse order:\n"); for(i=n-1;i>=0;i--) { printf("%d",a[i]); } return 0; }
ALGO
0.992846
3.144152
4c2287af-2f97-42eb-8516-53f9a4a70618
RhisavRay/Leetcode-Easy
2859. Sum of values at indices with k set bits.cpp
class Solution { public: int countSetBits(int n) { int cnt = 0; while(n > 0) { if(n % 2) cnt++; n /= 2; } return cnt; } int sumIndicesWithKSetBits(vector<int>& nums, int k) { int sum = 0; for(int i =...
ALGO
0.999952
6.188225
69c7e1fc-21ac-4708-ba75-c3dd9c357686
amaraihek/Butte_CSCI_21
pa2sp22-ismara2003-2022-Butte-CSCI-21/labs/24/bs_tree.cpp
/* * Name : Lab 24 cpp * Author : Amara Ihekwoeme * Description : Introduction to Trees * Sources : Luke Santhrum */ #include "bs_tree.h" // Constructor BSTree::BSTree() { root_ = NULL; size_ = 0; } // Destructor BSTree::~BSTree() { Clear(); } // Calls private function Insert(int, root) bool...
ALGO
0.998416
5.113475
496605e7-9055-403d-9d5f-d15e7036ab02
tilak-gm/Data-Structures-lab-programs
Experiment 7(circular_queue).cpp
#include<iostream> using namespace std; struct node { int info; struct node *next; }; struct linked_list { node *front,*rear; linked_list() { front=NULL; rear=NULL; } void insert_beg(); void display(); node* createnode(int); void del(); }; node* linked_list::creat...
ALGO
0.998628
3.581867
0603a5fe-e058-4ffb-8553-882e44d1c988
enlighten5/symfit-kernel
subprojects/symcc-rt/src/backends/qsym/qsym/third_party/z3/src/muz/pdr/pdr_manager.cpp
#include <sstream> #include "muz/pdr/pdr_manager.h" #include "ast/ast_smt2_pp.h" #include "ast/for_each_expr.h" #include "ast/has_free_vars.h" #include "ast/rewriter/expr_replacer.h" #include "ast/expr_abstract.h" #include "model/model2expr.h" #include "model/model_smt2_pp.h" #include "tactic/model_converter.h" namesp...
TOOL
0.965384
6.953084
4b89a61c-10ba-4b0b-8042-8cfd68795dd9
ishandutta2007/codeforces
teraqqq/normal/1641/A.cpp
#include <bits/stdc++.h> #define F first #define S second using namespace std; using ll = long long; using pi = pair<int, int>; using vi = vector<int>; template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, true : false; } template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, true : ...
ALGO
0.999861
4.032857
fa5ebf0a-2656-41c6-a51a-3cc64c527d70
tori-az/code
practice/Creating_Strings.cpp
// https://cses.fi/problemset/task/1622 // 枚舉 #include<bits/stdc++.h> #pragma GCC optimize("Ofast", "unroll-all-loops") #define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); #define int long long #define endl '\n' const int MAX = 2e5+5; const int INF = 9e18; const int MOD = 1e9+7; const double EPS = ...
ALGO
0.999988
4.212218
c91a668b-92fc-4266-8c77-377b0b421c1c
yzd0014/Game-Engine
Engine/Core/MemoryManagement/BitArray.cpp
#include "stdint.h" #include "assert.h" #include <intrin.h> #include "BitArray.h" #include "HeapManager.h" #include "Core\Utility\Utility.h" BitArray::BitArray(size_t i_numBits, bool i_bIniToZero) { assert(HeapManager::heapManager); #if _WIN64_BUILD numChunks = i_numBits / 64; p_bits = static_cast<uint64_t *>(Heap...
TOOL
0.878611
4.748678
5ecf3b4f-f8be-45f7-afef-36a88caa563c
Voddden/VisualStudio-SEM2
Lab-1/Lab-1__task1/countNumbers.cpp
#include "tasks.h" int countNumbers(FILE* fp) { fseek(fp, 0, SEEK_SET); char c; int res = 0; while ((c = getc(fp)) != EOF) { if (c == ' ' || c == '\n') ++res; } fseek(fp, 0, SEEK_SET); return (res + 1); }
TOOL
0.858144
3.211048
b963f7f6-4e8e-4cca-8ad5-0d80cd51ae24
A5Chord/Lian_lian_kan
Graph.cpp
#include "stdafx.h" #include "Graph.h" extern int MAX_COL; extern int MAX_ROW; CGraph::CGraph() { InitGraph(); //ʼͼ } CGraph::~CGraph() { } ////ʼͼ void CGraph::InitGraph() { m_nArcnum = 0; m_nVexnum = 0; //ʼϢ for (int i = 0; i < MAX_ROW * MAX_COL; i++) { //ʼ m_Vertices[i] = -1; } for (int i = 0; i < ...
ALGO
0.98572
3.510977
0d484989-d342-4da1-9e12-be075e232c7d
stackwild/gogogadget
leetcodes/2243. Calculate Digit Sum of a String/2243.cpp
class Solution { public: string digitSum(string s, int k) { while (s.length() > k) { string next; for (int i = 0; i < s.length(); ++i) next += to_string(accumulate( s.begin() + i, s.begin() + min(static_cast<int>(s.length()), i + k), 0, [](int subtotal, char c) { retur...
ALGO
0.999898
6.95542
475ca87b-0df1-45aa-96da-a63ec54c10ad
binji/love-nacl
src/libraries/Box2D/Dynamics/b2WorldCallbacks.cpp
#include <Box2D/Dynamics/b2WorldCallbacks.h> #include <Box2D/Dynamics/b2Fixture.h> // Return true if contact calculations should be performed between these two shapes. // If you implement your own collision filter you may want to build from this implementation. bool b2ContactFilter::ShouldCollide(b2Fixture* fixtureA, ...
TOOL
0.9539
7.142647
3c03f0e0-865e-4854-b773-5cc02b140ea4
macste7/Programming-classes-CPP
Lab1.cpp
#include "Wybor.h" using namespace std; /* * Uwaga: Zadania kod rozwiazania zaania umieszczać pomiędzy #ifdef a #endif. */ #ifdef Zad_1_1 int main() { double staticD = 3.05; double pi = 3.1415; double staticE = (5.0 * pi) * pow(5.0, 0.5); double statice = 2.7182; cout << "Którą funkcję wybieras...
ALGO
0.992848
3.364792
7cc15022-1dab-4b0f-8d0a-aff55d5ea3ab
liuxuanhai/book-code
Cpp_Primer_Answers-Chinese/ch11/exercise11_33.cpp
#include <iostream> #include <map> #include <fstream> #include <sstream> using namespace std; void word_transform(ifstream&, ifstream&); map<string, string> buildMap(ifstream&); string transform(const string&, map<string, string>&); int main() { ifstream ifs_rules("H:/code/C++/Cpp_Primer_Answers/data/transform_rule...
TOOL
0.965386
4.694418
793b8e09-dbd9-4ce2-9aa7-48c8531ce1af
happydabas/C-
LECTURE-6/13lastOccurance.cpp
#include<iostream> using namespace std; int main(){ int n; cout << "enter size: " << endl; cin >> n; int arr[n]; int target; cout << "enter target: " << endl; cin >> target; cout << "enter elements: " << endl; for(int i = 0; i<n; i++){ cin >> arr[i]; } for(int i=n;i>0...
ALGO
0.999204
5.080079
6e2b2c87-21ef-4491-aaea-9d2d9a1a50fd
Hyperb0rean/itmo_algo
timus/1444.cpp
#include <iostream> #include <vector> #include <algorithm> #include <cmath> using namespace std; struct point{ int x,y,i; }; struct { bool operator()(const point& a, const point& b) const { return atan2(b.y, b.x) == atan2(a.y , a.x) ? a.x * a.x + a.y * a.y < b.x * b.x + b.y * b.y : ...
ALGO
0.99996
4.279298
348d9754-d32d-4c36-8d87-313e741e6c9c
nahuel-torres18/estructura-de-datos-c-
Ejercicio4.cpp
#include <bits/stdc++.h> using namespace std; int main() { int n,k; char letra; deque<char> personas; ios::sync_with_stdio(0); cin.tie(0); cin >> n; while (n--) { cin >> letra; if (letra == 'E') { personas.push_back('P'); } if (letra == 'N') {...
ALGO
0.999893
4.218463
f3f75b91-f30a-4953-802d-5a4315bd522c
rammendozaa/Programacion
UVA/11586.cpp
#include <iostream> #include <string> #include <vector> using namespace std; int main(void) { int cases; cin >> cases; cin.ignore(); while(cases--) { string auxS; getline(cin, auxS); int izqM = 0, derM = 0, izqF = 0, derF = 0; for(int i = 1 ; i < auxS.length() ; i +=...
ALGO
0.999815
3.659411
08688198-577b-4baa-bd4e-d9f1d14b09f1
ishandutta2007/codeforces
smallling/normal/915/F.cpp
#include <bits/stdc++.h> using namespace std; const int N = 1000010; struct Edge{ int x, y, next; }edge[N << 1]; struct lhy{ int v, id; }a[N]; int n, tot; int f[N], sz[N], son[N]; inline void add(int x, int y) { edge[++tot].x = x; edge[tot].y = y; edge[tot].next = son[x]; son[x] = tot; } inline int cmp1(con...
ALGO
0.999876
3.793594
30bd6c55-96a1-40e5-aaaf-2cc6e3e31228
DeshAcharjee/Competitive-Programming
USACO/USACO2023_Dec_Silver_Target_Practice.cpp
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); int t, c; cin >> t >> c; vector<bool> target(2 * c + 1); for (int i = 0; i < t; i++) { int x; cin >> x; target[x + c] = 1; } string s; cin >> s; vec...
ALGO
0.99991
3.906205
c20f8000-e5fe-4478-b460-9af9e7ea5905
viethung92gtvt/CTDLGT
Vector/CaiDatVector.cpp
#include <bits/stdc++.h> using namespace std; template <class T> class Vector{ unsigned int cap,num; T *buff; public: typedef T *iterator; Vector(){ cap=0;num=0;buff=NULL; } Vector(unsigned int C){ cap=C; num=0; buff = new T[C]; } Vector(unsigned int n, T x){ cap = num = n; buff = new T[...
ALGO
0.987867
3.73073
86f63118-a4b3-4619-89ee-a0ea97c4ba98
natallem-ITMO/Algo-labs
Semester2/Lab1/K.cpp
/*#include <iostream> #include <vector> #include <string> #include <stdio.h> #include <fstream> using std::vector; using std::max; using std::min; using std::cout; using std::endl; using std::string; int firstIndex; int lastIndex; int getRs(int node) { return node * 2 + 2; } int getLs(int node) { return getR...
ALGO
0.999939
3.88449
6cf7a4c5-59d6-4502-90b2-0dc03c1de263
MiTronCoinX/MiTronCoinX
src/sync.cpp
#include "sync.h" #include "util.h" #include <boost/foreach.hpp> #ifdef DEBUG_LOCKCONTENTION void PrintLockContention(const char* pszName, const char* pszFile, int nLine) { printf("LOCKCONTENTION: %s\n", pszName); printf("Locker: %s:%d\n", pszFile, nLine); } #endif /* DEBUG_LOCKCONTENTION */ #ifdef DEBUG_LOC...
TOOL
0.97413
5.7469
a2e3de5f-fbe8-4075-b142-f0bf4bf10dd7
ETLang/Sharpish
Sharpish/BoundingBox.cpp
#include "Sharpish.h" // ::PUBLICLIB:: #define MIN(x,y) (((x) < (y)) ? (x) : (y)) #define MAX(x,y) (((x) > (y)) ? (x) : (y)) #undef min #undef max #define MinFloat numeric_limits<float>::min() #define MaxFloat numeric_limits<float>::max() using namespace CS; using namespace std; Float3 BoundingBox::MaxVector(MaxF...
TOOL
0.959284
7.164582
13ec62e5-f75e-4369-9db8-31f7c52a457f
rathi062/codes
spoj_codes/arrangement.cpp
#include<iostream> #include<list> #include<string> #include<cstring> #include<sstream> #include<cctype> #include<string.h> #include<algorithm> #include<cmath> #include<stack> #include<fstream> #include<cstdlib> #include<vector> #include<map> #include<set> #include<utility> #include<iomanip> #include<queue> using names...
ALGO
0.999948
3.367677
9e1b708c-0b7a-47bc-9115-83a5d4f4c1f2
GunHoi/Computer-Graphics
ConsoleApplication1/bouncing.cpp
// This application shows balls bouncing on a checkerboard, with no respect // for the laws of Newtonian Mechanics. There's a little spotlight to make // the animation interesting, and arrow keys move the camera for even more // fun. #ifdef __APPLE_CC__ #include <GLUT/glut.h> #else #include <GL/glut.h> #endif #includ...
ALGO
0.990521
5.699461
d5a9e437-f71e-469b-9719-fae03c80114a
Nishant-Jain-Codes/LeetCode-Solutions
Knapsack with Duplicate Items - GFG/knapsack-with-duplicate-items.cpp
//{ Driver Code Starts // Initial Template for C++ #include <bits/stdc++.h> using namespace std; // } Driver Code Ends // User function Template for C++ class Solution{ public: int knapSack(int N, int W, int val[], int wt[]) { // code here return optimized(N,W,val,wt); return tabulati...
ALGO
0.999998
5.788591
71136466-ecf5-4548-9424-2749535788a9
sankarvema/labWorks
libraries/tess-two/jni/com_googlecode_tesseract_android/src/cube/tess_lang_model.cpp
// The TessLangModel class abstracts the Tesseract language model. It inherits // from the LangModel class. The Tesseract language model encompasses several // Dawgs (words from training data, punctuation, numbers, document words). // On top of this Cube adds an OOD state machine // The class provides methods to traver...
ALGO
0.993277
5.511448
5eba5695-4a1e-4c01-bc79-0dfdfe087f81
ZivFerdinand/CompetitiveProgramming
C++ Code/Merge_it.cpp
#include <iostream> #include <algorithm> using namespace std; int main(){ int q,total; cin >> q; int test[10]; while(q--){ int n,x; cin >> n; test[0] = test[1] = test[2] = total = 0; for(int i=0;i<n;i++){ cin >> x; x%=3; if(x==0){ total++; } else if(xs==1){ test[1]++; } el...
ALGO
0.999644
3.256914
7633abde-89ba-4173-b18a-122d4bf807e2
thanoschild/Leetcode
2509-minimize-xor/2509-minimize-xor.cpp
class Solution { public: int minimizeXor(int num1, int num2) { int x = 0; int count1 = __builtin_popcount(num1); int count2 = __builtin_popcount(num2); if(count1 == count2){ return num1; } if(count2 > count1){ int diff = count2 - count1...
ALGO
0.999947
5.611471
44b25047-c6b7-4059-a1fa-81540a7bde93
FIFSAK/algorithms
5 lab/d.cpp
#include <iostream> #include <vector> #include <algorithm> using namespace std; const long long N = (long long)1e6 + 7; void heapify_up(long long *a, long long n, long long v) { while(v != 1 && a[v] < a[v/2]) { swap(a[v], a[v/2]); v = v / 2; } } void push(long long *a, long long &n, long lon...
ALGO
0.999991
4.651421
4e98ff0d-5f60-45ab-9c30-9eb81e38aac1
ishandutta2007/codeforces
apsara/normal/1335/B.cpp
#pragma comment(linker, "/STACK:1024000000,1024000000") #include <cstdio> #include <cstring> #include <cstdlib> #include <cmath> #include <ctime> #include <algorithm> #include <iostream> #include <vector> #include <string> #include <map> #include <set> #include <queue> using namespace std; typedef long long LL; typede...
ALGO
0.999721
3.166389
0bd08395-ee43-493e-bf2b-f17c25e704f9
JustJie2002/Leetcode
Contest/W85/D.cpp
/******************************************** * author : Jie Chen (3rd Year CS) * school : Rochester Institute of Technology * created: 02.06.2024 22:05:25 *********************************************/ using i64 = long long; struct DSU { vector<int> par, siz; int components; DSU() {} DSU(int n): ...
ALGO
0.999939
6.029149
eec7b7ac-8217-4892-8d79-9e855e7e9ce4
phaeton2040/gb-cpp-hardcore
lesson2.cpp
#include "iostream" #include "vector" #include "algorithm" #include <fstream> #include <sstream> #include "Timer.cpp" using namespace std; template<typename T> void Swap(T* a, T* b) { T temp = *a; *a = *b; *b = temp; } int CountVowels1() { // the actual file is ignored due to its size; // the ori...
ALGO
0.967404
4.076378
5d6c4aac-2034-4981-bbd2-c86d7d6513c5
odrowonz/atbcoin-insight
src/rpc/client.cpp
#include "rpc/client.h" #include "rpc/protocol.h" #include "util.h" #include <set> #include <stdint.h> #include <boost/algorithm/string/case_conv.hpp> // for to_lower() #include <univalue.h> using namespace std; class CRPCConvertParam { public: std::string methodName; //!< method whose params want conversion ...
CONFIG
0.963428
6.924237
d97fa951-1877-4747-bef4-6c591dd32cb4
tushar7810/Stack
Stack.cpp
#include<iostream> using namespace std; #define max 7 int stack[max]; int top =-1; void push(){ int val; cout<<"Enter the data : "; cin >> val; if(top >= max-1){ cout<<"Stack Overflow"; }else{ stack[++top] = val; } } int pop(){ if( top < 0){ cout<<"Stack Underflow"<...
ALGO
0.993648
3.989161
ff0ad1cc-0cd5-41ca-ad10-f75a0e94acea
RohanG610/C-study-DS-and-OOP-
STL/Vectors1.cpp
#include<iostream> #include<vector> using namespace std; int main() { vector<int> vec; int i,n,temp; cout<<"Enter value of Intial Input Lenght: "; cin>>n; cout<<"Inserting next element in beginning\n"; for(i=0;i<n;i++) { cin>>temp; vec.insert(vec.begin(),temp); } co...
ALGO
0.986187
3.418774
60793076-211e-437a-8a15-6f4f7ecfc347
ishandutta2007/codeforces
stasana/normal/867/A.cpp
#include <iostream> using namespace std; int main() { int n; cin >> n; bool a; char ch; cin >> ch; a = ch == 'F'; int res = 0; for (int i = 1; i < n; ++i) { cin >> ch; bool b = ch == 'F'; if (a != b) { if (a) { --res; } el...
ALGO
0.999866
4.324297
6ebabb85-5f56-4324-bc33-8f2c9cfe4c80
VuTienQuang/CTDL-GT
chiamangthanh2mangcon.cpp
#include<bits/stdc++.h> using namespace std; int main(){ int t; cin >> t; while(t--){ int n , k; cin >> n >> k; int a[n+1]; for(int i = 0;i < n;i++){ cin >> a[i]; } sort(a ,a + n); long long sum1= 0 ,sum2 = 0; k = min(k , n-k); for(int i = 0;i < n;i++){ if(i < k){ sum1 += a[i]; }else{ ...
ALGO
0.999971
3.922363
3b636c6f-47c5-430f-968e-3f85d533d7ab
scaledrecognition/opencv
modules/legacy/src/blobtrackanalysistrackdist.cpp
#include "precomp.hpp" typedef struct DefTrackPoint { float x,y,r,vx,vy,v; } DefTrackPoint; class DefTrackRec { private: int ID; public: DefTrackRec(int id = 0,int BlobSize = sizeof(DefTrackPoint)) { ID = id; m_pMem = cvCreateMemStorage(); m_pSeq = cvCreateSeq(0,sizeof(CvSe...
ALGO
0.998295
5.67974
143e4261-8920-4f72-8573-b9f68174fde2
FrancescBrau/vorlesung_29_10
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
1c2702a5-0638-4107-99dc-27a9ccace749
QM117/leetcode
56. Merge Intervals/2.cpp
/** * Definition for an interval. * struct Interval { * int start; * int end; * Interval() : start(0), end(0) {} * Interval(int s, int e) : start(s), end(e) {} * }; */ class Solution { public: vector<Interval> merge(vector<Interval>& intervals) { if(intervals.empty()) return interval...
ALGO
0.999999
5.6405
961a4588-8b41-4582-b3fd-ca064d782c4d
skollhati/boost_srv
libs/intrusive/example/doc_rbtree_algorithms.cpp
struct my_node { my_node(int i = 0) : int_(i) {} my_node *parent_, *left_, *right_; int color_; //other members int int_; }; //Define our own rbtree_node_traits struct my_rbtree_node_traits { typedef my_node node; typedef my_node * ...
ALGO
0.999881
6.599195
f75f2190-aded-4fd1-be50-9f9a4539a3f9
NeoAnomaly/xray
3rd party/boost/libs/numeric/ublas/bench1/bench13.cpp
#ifdef BOOST_MSVC #pragma warning (disable: 4355) #pragma warning (disable: 4503) #pragma warning (disable: 4786) #endif #include <iostream> #include <string> #include <boost/numeric/ublas/config.hpp> #include <boost/numeric/ublas/vector.hpp> #include <boost/numeric/ublas/matrix.hpp> #include <boost/timer.hpp> #i...
TOOL
0.9917
5.579605
8a475d43-dfa8-4e6c-bf74-6e30f7b324bd
hoangmanhkhiem/SPOJ
submited/CPRMT.cpp
/* USER: hoangmanhkhiem TASK: CPRMT ALGO: dynamic programming */ #include <cstdio> #include <algorithm> #include <cstring> using namespace std; #define MAX 1111 char s1[MAX], s2[MAX]; int len1, len2, dp[MAX][MAX]; void lcs() { int i, j; for(i=1;i<=len1;i++) { for(j=1;j<=len2;j++) { if(s1[i-1]==s2[j-1]) dp...
ALGO
0.999957
3.510185
15fa86e2-4985-4e33-9ce7-f86baa00dc59
alexandraback/datacollection
solutions_2749486_0/C++/asundqui/B1.cpp
#include <iostream> #include <string> using namespace std; int main() { int T; cin >> T; for (int case_num = 1; case_num <= T; ++case_num) { int X, Y; cin >> X >> Y; string pogo; while (X > 0) { pogo += "WE"; --X; } while (X < 0) { pogo += "EW"; ++X; ...
ALGO
0.999893
3.847037
1948bfcf-43e8-4455-ba45-3a80265f49eb
aw-junaid/Computer-Science
Programming Fundamentals/Cplusplus/C-Plus-Plus-Algorithms/graph/hamiltons_cycle.cpp
/** * @file * @brief The implementation of [Hamilton's * cycle](https://en.wikipedia.org/wiki/Hamiltonian_path) dynamic solution for * vertices number less than 20. * @details * I use \f$2^n\times n\f$ matrix and for every \f$[i, j]\f$ (\f$i < 2^n\f$ and * \f$j < n\f$) in the matrix I store `true` if it is possi...
ALGO
0.999737
6.808569
db69e031-5ab0-4c8a-bb4c-1085fa0c0252
imakumar98/data-structures-practice
string/alternating-characters.cpp
#include <iostream> using namespace std; int deletions(string); int main(){ string s = "AAABBB"; int res = deletions(s); cout<<"Number of deletions : "<<res; } int deletions(string s){ int result = 0; for(int i=0; i<s.size(); i++){ if(s[i]==s[i+1]){ result = result + 1; ...
ALGO
0.999638
5.034043
064c31f0-4796-4734-9a07-24e097ba3803
Sahil123git/CLG_CP1
Stack/getMinOpt.cpp
#include <iostream> #include <stack> #include <climits> using namespace std; class Stack { int Min; stack<int> stk; public: Stack() { Min = INT_MAX; } void _push(int ele) // if u are insrtng (min ele) then first push prev min ele in stack and then insert this new min ele otherwise only...
ALGO
0.999904
5.285525
09472ccd-490c-418f-85f2-89416b6c5a68
omillaa/AppApiLocal
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
4d9fe638-02c9-45d6-b2b6-0d608798b1c4
MrinmoyOpsAlpha/Leetcoding
0554-brick-wall/0554-brick-wall.cpp
class Solution { public: int leastBricks(vector<vector<int>>& wall) { unordered_map<int,int> countGap; for(int i=0;i<wall.size();i++){ int pos = 0; for(int j=0;j<wall[i].size()-1;j++){ pos = pos + wall[i][j]; countGap[pos]++; ...
ALGO
0.999732
6.064815
0b3868c4-e824-41bf-805f-8ed97d6afdde
ritikshukla29/oops-experiment-all
T_VirtualFunction.cpp
#include<iostream> using namespace std; class A { public: int x=5; /* virtual*/ void display() { cout<<"Value of x"<<endl; } }; class B:public A { public: int y=10; void display() { cout<<"Value of y"; } }; int main(int argc, char const *argv[]) { A *a; ...
TOOL
0.854554
4.661438
5be087ee-fa0d-4c5e-ae7e-6ddb0c175aca
QuaziSamiha/C-and-CPP
Basic Problem Solving/Basic Problems/fibonacci1.cpp
#include <iostream> using namespace std; // without array int main() { int n, first = 0, second = 1, febo = 0; cout << "enter a number : "; cin >> n; cout << endl << first << "\t" << second << "\t"; for (int i = 0; i < n; i++) { febo = first + second; cout << febo << ...
ALGO
0.999754
3.456865
e8a95624-f650-4332-b985-4d3f76f78a6f
cpuwhiz11/CS-School-Work
201/prg630/prog630.cpp
/* * File: prog630.cpp * Author: Paul * * Created on October 14, 2010, 3:43 PM */ #include <iostream> using namespace std; /* * This is a method I was using until I wised up. It is preserved here for posterity. * int howbig( int num ) { int counter ; while( num != 0 ) { num = num / 10 ; ...
ALGO
0.999697
4.667325
65844eba-d0ef-4ff3-9fb5-b1ab5c117417
hjiang13/LLMs-in-IR
POJ-104/38/1358.cpp
#include <iostream> using namespace std; int main() { int k; //?????? cin>>k; for(int i=0; i<k; i++) { double x[101],*p=x; //??????? double n,sum=0; ; cin>>n; for(int j=0; j<n; j++){ cin>>*(p+j); sum+=*(p+j); //???? } double ave,s; ave=sum/n; //????? sum=0; for(int j=0; j<n; j++) sum+=pow(*(p+j)-ave,2); //???? s=sqrt(s...
ALGO
0.998417
3.422476
64426ac7-37e3-4ac4-a6e9-6163d50afbad
AdoptOpenJDK/openjdk-aarch32-jdk8u-old
hotspot/src/share/vm/opto/live.cpp
#include "precompiled.hpp" #include "memory/allocation.inline.hpp" #include "opto/callnode.hpp" #include "opto/chaitin.hpp" #include "opto/live.hpp" #include "opto/machnode.hpp" // Compute live-in/live-out. We use a totally incremental algorithm. The LIVE // problem is monotonic. The steady-state solution looks lik...
ALGO
0.984752
7.129347
66a4f392-56a8-4319-ba45-69ad9e283861
R-YaTian/opencv320
sources/modules/features2d/src/keypoint.cpp
#include "precomp.hpp" namespace cv { struct KeypointResponseGreaterThanThreshold { KeypointResponseGreaterThanThreshold(float _value) : value(_value) { } inline bool operator()(const KeyPoint& kpt) const { return kpt.response >= value; } float value; }; struct KeypointRespons...
TOOL
0.948804
6.160172
f6bfe7e5-fcc6-47e9-afeb-e04215319b9f
Bachhsunkid/Leetcode-daily
easy/roman-to-integer.cpp
#include<bits/stdc++.h> using namespace std; //leetcode.com/problems/roman-to-integer/ class Solution { public: int romanToInt(string s) { int ans=0; unordered_map <char,int> mp{{'I',1}, {'V',5}, {'X',10}, ...
ALGO
0.999792
6.158846
2b8141e5-7fe2-4c4a-a606-7894ffd75f8b
KirPot05/DS_Algo_Practice
Linked List/Reverse_K_nodes.cpp
#include"Linked_List.hpp" Node* Reverse_K_Nodes(Node* &head, int k){ Node* current = head; Node* ptr = nullptr; Node *nextptr; int count = 0; while(current != nullptr && count < k){ nextptr = current -> next; current -> next = ptr; ptr = current; current = nextp...
ALGO
0.999778
4.378762
bc898a74-3854-4395-8dbf-5d988bd9945c
MDATIK-3/CPP-Problem-Solving
problem_344_A.cpp
#include <bits/stdc++.h> #define ll long long int #define yes cout << "YES" << endl #define no cout << "NO" << endl using namespace std; void MUKU() { int t; cin >> t; vector<string> arr(t); for (int i = 0; i < t; i++) cin >> arr[i]; int count = 1; for (int i = 1; i < t; i++) { ...
ALGO
0.99978
4.49157
9629be52-7274-47e5-8a80-1620496e83a3
uranolais/Programas-C-EE-UFPI
questoes/SWITCH-MesesDoAno.cpp
/* 2.Faa um programa que receba o valor inteiro e retorne o ms do ano equivalente (1 = janeiro, 2 = fevereiro, 3 = maro, ..., 12 = dezembro). Se o valor recebido for maior que 12 ou menor que 1 dever imprimir ms invlido.*/ #include <stdio.h> #include <stdlib.h> #include <locale.h> int main() { system("color 1F"); set...
TOOL
0.990896
3.012238
e482e8d3-b2ef-4744-b59d-58c034913b51
sdurand777/test_dpvslam
thirdparty/eigen-3.4.0/doc/examples/Tutorial_ArrayClass_interop.cpp
#include <Eigen/Dense> #include <iostream> using namespace Eigen; using namespace std; int main() { MatrixXf m(2,2); MatrixXf n(2,2); MatrixXf result(2,2); m << 1,2, 3,4; n << 5,6, 7,8; result = (m.array() + 4).matrix() * m; cout << "-- Combination 1: --" << endl << result << endl << e...
ALGO
0.999657
4.531452
e9ef22fd-e882-4d48-aa90-05ee52874e22
vieanh88/Programming_Techniques_HUST
Kì 2024.2/Lab_Code/Lab3/lab3-3.8(new).cpp
#include <bits/stdc++.h> using namespace std; struct state{ int i, j; state(int _i = 0, int _j = 0): i(_i), j(_j) {} }; int main() { int n, M; cin >> n >> M; int m[n+1]; for (int i = 1; i <= n; ++i) cin >> m[i]; int x[n+1] = {0}; // Kh?i t?o t?t c? l 0 // ?t tr?c t...
ALGO
0.999962
3.863258
5d7cf035-05f2-40ba-9533-cd3592bb2d1b
samadritakarak/DS-and-Algo
Inversioncount.cpp
// C++ program to Count Inversions // in an array #include <bits/stdc++.h> using namespace std; int getInvCount(int arr[], int n) { int inv_count = 0; for (int i = 0; i < n - 1; i++) for (int j = i + 1; j < n; j++) if (arr[i] > arr[j]) inv_count++; return inv_count; } // Driver Code int mai...
ALGO
0.999837
5.926293
ed2794c2-830d-4ec7-b7dd-27e634ffc199
JasperOrion/Algorithm
Data_Structures/03_Stacks/src/arithmetiic2.cpp
// 这个只是实现了一位数的加减乘除取余运算,而且还没有括号,和求出后缀表达是的方法 #include <iostream> #include <stack> using std::cin, std::cout, std::endl; enum TokenType { LEFT_PARE, RIGHT_PARE, ADD, SUB, MUL, DIV, MOD, EOS, NUM }; char expr[] = "82/2+56*-"; TokenType getToken(char *symbol, int *index) { *symbol = expr[*index]; *index = *index + 1...
ALGO
0.997303
3.737902