uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
778abf38-b43c-4ae8-94f3-7ae0c920fb17 | RutvikMori18/c-basic-program | C++ Program/dereference operator.cpp | #include<iostream>
using namespace std;
int main(){
int x=20;
int* ptrx=&x;
cout<<*(&x)<<endl;
cout<< *ptrx<<endl;
cout<<*(ptrx)+1<<endl;
cout<<*(ptrx+1);//print the garbage value
}
| ALGO | 0.968131 | 3.229036 |
00b29fe8-9bdd-4527-9f2c-c80d8fbfce2d | arangodb/v8 | third_party/icu/source/tools/genrb/filterrb.cpp | #include <iostream>
#include <stack>
#include "filterrb.h"
#include "errmsg.h"
const char* PathFilter::kEInclusionNames[] = {
"INCLUDE",
"PARTIAL",
"EXCLUDE"
};
ResKeyPath::ResKeyPath() {}
ResKeyPath::ResKeyPath(const std::string& path, UErrorCode& status) {
if (path.empty() || path[0] != '/') {
... | TOOL | 0.981563 | 6.28081 |
f18328e6-df26-47f9-bee0-c21e9772b728 | hybridSMT/hybridSMT | source_code/src/ackermannization/ackr_helper.cpp | #include "ackermannization/ackr_helper.h"
double ackr_helper::calculate_lemma_bound(fun2terms_map const& occs1, sel2terms_map const& occs2) {
double total = 0;
for (auto const& kv : occs1) {
total += n_choose_2_chk(kv.m_value->var_args.size());
total += kv.m_value->const_args.size() * kv.m_valu... | ALGO | 0.998231 | 4.288644 |
1bc00a28-a022-459a-9159-84d0ff558636 | junwlee/baekjoon | advanced1/cpp/no25206.cpp | #include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <map>
using namespace std;
int main() {
vector<string> sentences(20);
string line;
// 평점에 따른 점수를 맵으로 저장
map<string, double> gradeToPoint = {
{"A+", 4.5}, {"A0", 4.0}, {"B+", 3.5}, {"B0", 3.0},
{"C+", 2... | TOOL | 0.965013 | 5.356591 |
5066c37a-af19-4f38-895a-572a5f9916c5 | agegold/honda-pilot | selfdrive/controls/lib/cluster/fastcluster_R_dm.cpp | struct pos_node {
t_index pos;
int node;
};
void order_nodes(const int N, const int * const merge, const t_index * const node_size, int * const order) {
/* Parameters:
N : number of data points
merge : (N-1)×2 array which specifies the node indices which are
merged in each ... | ALGO | 0.999984 | 6.393015 |
5eb8727f-546e-4398-924d-cba91aa8f964 | nissyjainy/Competitive-programming-and-DSA-using-Cpp | Love_Babbar/Frequency.cpp | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main()
{
// jo even aaya to yes otherwise no ok
// frequency even che ki nahi check kar ok
int t;
cin >> t;
while (t--)
{
int n;
cin >> n;
vector<int> v;
for (int i = 0; i < n; i++)
{
... | ALGO | 0.99984 | 4.945243 |
08b9df66-b19a-4379-b30f-b63db8025e90 | kerrache/linkpred | tutorials/code/simp/cpp/predAll/predAll.cpp | #include <linkpred.hpp>
#include <iostream>
using namespace LinkPred::Simp;
int main() {
// Create a prtedictor object
Predictor p;
// Load network from file
p.loadnet("Zakarays_Karate_Club.edges");
// Predict the score of all non-existing edges using Adamic Adar index
std::vector<EdgeScore> esv = p.predAllADA()... | ALGO | 0.968954 | 4.282111 |
9a593452-bc64-464e-bd9a-c78271b28fca | oceanumeric/cs106 | lib/collections/lexicon.cpp | /*
* File: lexicon.cpp
* -----------------
* A Lexicon is a word list. This Lexicon is backed by a data
* structure called a prefix tree or trie ("try").
*
* This is a re-implementation of Lexicon. Its previous implementation used
* a pair of structures: a directed acyclic word graph (DAWG) and an STL set.
* T... | TOOL | 0.953343 | 7.383095 |
46c232a3-1ce7-49b9-9a77-c49683b99f82 | ctyVegetableDog/leetcode | helloLeet/1652.cpp | // 前缀和
/*
*朴实无华的好题
* */
class Solution {
public:
vector<int> decrypt(vector<int>& code, int k) {
int len = code.size();
vector<int> ans(len);
if (k == 0) return ans;
vector<int> pre(2 * len + 1); // 这种循环前缀和一般都是开两倍长度的前缀和数组,做两倍长度的前缀和
for (int i = 1; i <= 2 * len; ++i) {
... | ALGO | 0.999958 | 4.206658 |
9c154f0f-6669-4c2e-ba5c-624eedbf8a4a | rock-core/tools-graph_analysis | src/lemon/DirectedSubGraph.cpp | #include "DirectedSubGraph.hpp"
#include "DirectedGraph.hpp"
namespace graph_analysis {
namespace lemon {
DirectedSubGraph::DirectedSubGraph(const DirectedGraph::Ptr& graph)
: SubGraphImpl(graph)
, mpDirectedGraph(graph)
, mNodeMap(graph->raw())
, mArcMap(graph->raw())
{
// graph_t refers to the g... | TOOL | 0.914283 | 6.800675 |
1be2e93b-2a4d-41b9-b404-132b251f8e0e | JieniTurtle/Stardrew-Valley | cocos2d/tools/simulator/libsimulator/lib/ProjectConfig/SimulatorConfig.cpp | #include "SimulatorConfig.h"
#include <sstream>
SimulatorConfig *SimulatorConfig::_instance = NULL;
SimulatorConfig *SimulatorConfig::getInstance()
{
if (!_instance)
{
_instance = new SimulatorConfig();
}
return _instance;
}
SimulatorConfig::SimulatorConfig()
{
_screenSizeArray.push_back(... | CONFIG | 0.895873 | 4.28234 |
5f9340f3-e875-4d9d-84d7-31e5f21e4ef9 | riku546/cpp-tutorial | section3/05.cpp | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
int main()
{
// vector<int> nums = {1, 2, 4};
// // rep(i, nums.size()) cout << nums[i] << endl;
// rep(j, 3)
// {
// rep(k, 3)
// {
// if (j + k == 1)
// continue;
// cout << j + k << endl... | ALGO | 0.99941 | 3.245296 |
06115936-6269-46d7-b39a-9486b3016563 | HardikNegi9/CodeForces | 1200/C_Stable_Groups.cpp | #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
long long n, x, k;
cin >> n >> k >> x;
vector<long long> a(n);
for(int i=0; i<n; i++){
cin >> a[i];
}
sort(a.begin(), a.end());
vector<long long> diff;
for(int i = 1; i < n; i++){
... | ALGO | 0.999884 | 3.885265 |
1dfeb8be-5324-4eee-8095-262fa05de1c5 | ki7348/Algorithm | cpp/simulation/5002.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <deque>
using namespace std;
int main(){
int n;
cin >> n;
string str;
cin >> str;
deque<char> q;
for(int i=0;i<str.length();i++){
q.push_back(str[i]);
}
int boys = 0;
int girls = 0;
int cnt = 0;
... | ALGO | 0.999967 | 3.644976 |
a87503f3-09c1-44db-86e7-0785be5b78cf | DanielAugusto191/Competitive_Programming | Solved/C++/Project Euler #67.cpp | // https://projecteuler.net/problem=67
#include <bits/stdc++.h>
using namespace std;
#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
#define dbg(a) cout << a << " -- DEBUG -- "<< endl;
#define Adbg(a) for(auto e: a){cout << e << ' ';};cout << endl;
#define Mdbg(a) for(auto e: a){cout << e.first <<... | ALGO | 0.997926 | 3.807177 |
1c9f61a6-dd40-4efb-8dd8-65b1458cdf20 | NLGRF/Advance-Compro | mid term/week 5.1/ex5.cpp | #include<stdio.h>
int main(){
int i,j,num;
printf("Enter a number : ");
scanf("%d",&num);
for(i=1;i<=num;i++){
for(j=1;j<=num-i;j++)
printf(" ");
for(j=1;j<=2*i-1;j++)
printf("*");
printf("\n");
}
return 0;
}
| ALGO | 0.999926 | 3.134256 |
bf413bc7-10c3-4739-a02a-71fa76131e9c | Madmins07/Competitive-Programming | codeforces/1971A.cpp | #include <bits/stdc++.h>
using namespace std;
#define fastread() (ios_base:: sync_with_stdio(false),cin.tie(NULL));
int main() {
fastread();
int t, x, y;
cin >> t;
while (t--) {
cin >> x >> y;
if (x >= y) {
cout << y << " " << x << endl;
} else {
cou... | ALGO | 0.999805 | 4.297481 |
93d44357-6280-4832-a487-5ad049342003 | BenjaminQuiedeville/AmpModeler | libs/JUCE/modules/juce_dsp/frequency/juce_FFT.cpp | namespace juce::dsp
{
struct FFT::Instance
{
virtual ~Instance() = default;
virtual void perform (const Complex<float>* input, Complex<float>* output, bool inverse) const noexcept = 0;
virtual void performRealOnlyForwardTransform (float*, bool) const noexcept = 0;
virtual void performRealOnlyInverseTra... | ALGO | 0.924076 | 7.107293 |
8147d996-c3d7-4517-9e18-2d724c98d841 | retr0717/leetcode-ques | greedyAlgos/jumpGame2.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution {
public:
int jump(vector<int> &nums) {
int jumps, l, r;
jumps = l = r = 0;
int n = nums.size();
while (r < n - 1) {
int farthest = 0;
for (int i = l; i <= r; i++) {
farthest = max(farthest, i + nums[i]);
}
... | ALGO | 0.999981 | 5.788444 |
56f8652b-4911-4831-9682-c880fde1f23b | 2mulin/brushQuestion | LeetCode/algorithm/1_100/85_MaximalRectangle.cpp | /*******************************************************************************
* @author reddragon
* @date 2020/8/10
* @brief medium hard
* 最目前为为止最难的一题,需要把问题拆分,就可以使用84题的思路
* 1. 暴力法。两点确定一个矩形,找出所有的矩形,判断每个矩形是否合法,最终得到最大
* 的矩形。
* 2. 利用一个辅助数组arr,arr[i][j]表示正上方最多有多少个连续的‘ 1 ’。就可以
* 将问题转化为84题那样的柱状图最大矩形的子问题。然后利用84题的解法就... | ALGO | 0.999961 | 5.48961 |
7073eb70-ea31-450d-aed6-7a88396fd343 | moana16/BOJ | 그래프/교수가_된_현우.cpp | #include<bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false); cin.tie(0);
int t; cin>>t;
while(t--) {
int N; cin>>N;
int count = 0;
for (long long i = 5; N / i >= 1; i *= 5) {
count += N / i;
}
cout<<count<<'\n';
}
} | ALGO | 0.999878 | 4.740894 |
c1a185fb-f724-4a30-866e-7b831cac64fd | NguyenBui256/PTIT | DSA/DSA09028 - TÔ MÀU ĐỒ THỊ.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i,a,b) for(int i = a; i < b; i++)
#define FORD(i,a,b) for(int i = a; i > b; i--)
#define fi first
#define se second
#define pb push_back
#define TEST cin >> t; while(t--)
int n, m, k;
int a[1005][1005];
int dem[1005], check[1005];
void sol... | ALGO | 0.999992 | 4.161529 |
90faba3c-80e6-410d-bd69-325957f8797d | Yawn-Sean/Daily_CF_Problems | daily_problems/2024/05/0502/personal_submission/cf1168a_retyrn.cpp | int n, m;
void solve() {
cin >> n >> m;
vector<int> a(n);
cin >> a;
auto check = [&](int x) {
int last = 0;
for (int i = 0; i < n; i ++) {
if (a[i] <= last) {
if (last - a[i] > x) return false;
}
else {
// 尝试变成a[i-... | ALGO | 0.999994 | 4.118311 |
361fa86e-aabf-4752-9c94-39d5c1f39529 | manikanta2901/ubuntu | .history/HashCode/A_20210226000340.cpp | #include<bits/stdc++.h>
#include<vector>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<iterator>
#include<string>
#include<map>
#define vv vector
#define F first
#define S second
#define MP make_pair
#define EXECUTE_FASTER ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define printM... | ALGO | 0.999548 | 3.816463 |
5d6cf8f0-0ba7-40c3-89bc-eaf148e0f659 | tsukasa38/AtCoderBeginnerContest | src/ABC190/A.cpp | #include <iostream>
using namespace std;
int main() {
int A, B, C;
cin >> A >> B >> C;
string winner;
if(C == 0 && A == B) { winner = "Aoki"; }
if(C == 1 && A == B) { winner = "Takahashi"; }
if(A < B) { winner = "Aoki"; }
if(A > B) { winner = "Takahashi"; }
cout << winner << endl;
... | ALGO | 0.99982 | 4.288826 |
a8dcc156-339f-452e-a776-817fdf56c21b | wybosys/nnt | contrib/geos/src/noding/IntersectionAdder.cpp | #include <geos/noding/IntersectionAdder.h>
#include <geos/noding/SegmentString.h>
#include <geos/noding/NodedSegmentString.h>
#include <geos/algorithm/LineIntersector.h>
#include <geos/geom/Coordinate.h>
using namespace geos::geom;
namespace geos {
namespace noding { // geos.noding
/*private*/
bool
IntersectionAdder... | ALGO | 0.993275 | 5.738275 |
91139489-3677-45a6-8a65-be0c141e00e3 | Zabdielsoto/Curso-Profesional-C-plus-plus | 14.- Arreglos 4.cpp | //Ejercicio propuesto 14
/*
4.- Crea un programa en C++ donde el usuario ingrese 10 nmeros,
despus estos se deben de guardar en un array,
para finalmente imprimir su promedio.
*/
#include<iostream>
using namespace std;
int main(){
int arreglo[10] = {};
float promedio = 0;
cout<<"Ingrese los numeros"<<endl;
f... | ALGO | 0.966777 | 3.476248 |
01f5375f-522b-4daf-a020-60b97a6da48a | Prachi15600/Placement-Preparation-Module | 0135-candy/0135-candy.cpp | class Solution {
public:
int candy(vector<int> &ratings)
{
int size=ratings.size();
if(size<=1)
return size;
vector<int> num(size,1);
for (int i = 1; i < size; i++)
{
if(ratings[i]>ratings[i-1])
num[i]=num[i-1]+1;
}
for (int i= size-1; i>0 ; i--)
{
if(ratings[i-1]>ratings[i])
num[i... | ALGO | 0.999995 | 5.913602 |
5f43abe7-e585-46e0-b700-dd3cc56f6811 | reger-men/HPL_GPU | src/pgesv/HPL_pdgesv.cpp | /*
* Include files
*/
#include "hpl.h"
#ifdef STDC_HEADERS
void HPL_pdgesv
(
HPL_T_grid * GRID,
HPL_T_palg * ALGO,
HPL_T_pmat * A
)
#else
void HPL_pdgesv
( GRID, ALGO, A )
HPL_T_grid * GRID;
HPL_T_palg * ... | ALGO | 0.999953 | 3.600929 |
37b9d34f-e8f4-4c0f-9dc8-f68be4669a6f | antoniopedrofraga/computational-methods | reports/src/main.cpp | #include <iostream>
#include "methods/analytical.h"
#include "methods/explicit/dufort_frankel.h"
#include "methods/explicit/richardson.h"
#include "methods/implicit/laasonen.h"
#include "methods/implicit/crank_nicolson.h"
#include "io/iomanager.h"
/*
Main file - creates a problem, solving it with the different method... | ALGO | 0.99938 | 5.911674 |
3a0edb37-381e-41e5-9463-a41b2d6127da | manikanta2901/ubuntu | .history/codingChallenges/cpp/Codechef/longChallenges/Year2021/May/AnInterestingSequence_20210509154048.cpp | #include<bits/stdc++.h>
#include<iostream>
using namespace std;
int getGcd(int a,int b){
return __gcd(a,b);
}
int main(){
int t;
cin >> t;
while(t--){
int k;
cin >> k;
vector<int> series;
for(int i = 1; i <= (2 * k) + 1; i++){
series.push_back(k + i * i);
... | ALGO | 0.999804 | 4.012395 |
c0b6c9ba-18ef-443d-a15a-0bc934942bcd | itsmesuraj20/Leetcode-Practice | 1260-shift-2d-grid/1260-shift-2d-grid.cpp | class Solution {
public:
vector<vector<int>> shiftGrid(vector<vector<int>>& grid, int k) {
auto elements = getElements(grid);
k%= elements.size();
elements = shiftElements(elements,k);
updateGrid(grid,elements);
return grid;
}
void updateGrid(vector<vector<int>>& grid... | ALGO | 0.99998 | 6.412951 |
faa43e9c-0ad6-44d6-8c95-579184324e3a | sfegan/ChiLA | VSDataReduction/VSStage3SimCalc.cpp | #include <VSStage3SimCalc.hpp>
#include <VSALinearLeastSquares.hpp>
#include <VSSimpleStat.hpp>
using namespace VERITAS;
void VSStage3SimCalc::analyze(VSStage3SimDatum& data)
{
// Effarea ------------------------------------------------------------------
calc(data.egymc_triggered_hist,data.egymc_total_hist,
... | DATA | 0.995042 | 5.322192 |
2f1f8514-7dcc-4ffc-b10d-aa84f412ed0e | RoGgu/CodingTest | it 취업을 위한 알고리즘 문제풀이 (with CC++) 코딩테스트 대비/섹션 2. 정렬 & 이분탐색(결정알고리즘) & 투포인트 알고리즘 & 스택/38. Inversion Sequence (삽입정렬 코드스타일) [O].cpp | #define _CRT_SECURE_NO_WARNINGS
#include<stdio.h> // cin,cout말고 이제 c에서 제공하는 sanf, printf 사용 - 속도가 조금 더 빠름
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
// 강사 풀이보고 푼거
//freopen("input.txt", "rt", stdin); // input.txt 파일 읽기
int n, i, j, pos;
// n: 입력 수, i : 큰수부터 차례대로 돌면서 입력, j : 뒤에 큰수 땡겨야하는... | ALGO | 0.999985 | 4.231019 |
aff2170c-2f54-4e65-a211-9d91b57d7474 | dgonzalezarbelo/Kattis | twostones.cpp | #include <bits/stdc++.h>
#pragma warning (disable : 4996)
using namespace std;
#define rep(i, a, b) for(int i = a; i < b; ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define fi first
#define se second
#define mp make_pair
const double EPS = 1e-9;
const double INF = 1e9; //1e18 tambien suele ir ... | ALGO | 0.999979 | 3.622249 |
8106cc68-0c68-4c11-9415-421aa6a53548 | ZRZRING/algorithm | Practice/GPLT/2025/2-4.cpp | #include <bits/stdc++.h>
int main() {
int n;
std::cin >> n;
std::string L, R;
std::cin >> L >> R;
// if (L.length() < n) {
// L = "1";
// for (int i = 1; i < n; i++) {
// L += "0";
// }
// }
// if (R.length() > n) {
// R.clear();
// for (int i = 0; i < n; i++) {
// R += "9";
// }
// }
// std::cout << L <... | ALGO | 0.99999 | 5.127003 |
53502765-33ae-426b-b4d3-4af42283b011 | pankajchouhan0610/PracticeDSA | 94-binary-tree-inorder-traversal/94-binary-tree-inorder-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.999947 | 6.465989 |
a3e9b89f-8d95-4008-a118-21aed0f64daa | teners/csc-homeworks | algorithms/hw08/8f.cpp | #include <bits/stdc++.h>
std::vector <std::vector <int>> g;
std::vector <int> used;
int n, m, a, b, s;
void dfs(int v)
{
used[v] = s;
for (int i = 0; i < g[v].size(); ++i)
{
if (used[g[v][i]] == 0)
{
dfs(g[v][i]);
}
}
return;
}
int main()
{
std::ios::sync_w... | ALGO | 0.999976 | 4.83438 |
c55febec-ec16-4338-a15f-e608decdb2b1 | ngtranminhtuan/Algorithm-Immediately | 12. Binary Search Tree/Isenbaev's Number.cpp | #include <iostream>
#include <cstdio>
#include <string>
#include <map>
#include <set>
#include "sstream"
#include <vector>
#include <queue>
using namespace std;
vector<int> adj[500];
int dis[1010];
int vis[1010];
void bfs(int s)
{
queue<int> q;
q.push(s);
vis[s] = 1;
while (!q.empty())
{
... | ALGO | 0.999875 | 4.055599 |
fb0f86c7-f165-40a5-87b2-6e4bffed71cf | tallsong/ultipa | Queue.cpp | struct QueueNode
{
QueueNode* prev;
QueueNode* next;
char* data;
/* data */
};
class Queue
{
private:
int m_size{0};
QueueNode* m_head{nullptr};
QueueNode* m_tail{nullptr};
public:
Queue(QueueNode* node):m_head(node),m_tail(node){}
QueueNode *getTail()
{
QueueNode* tem... | ALGO | 0.946285 | 4.786086 |
d41368b1-f0ce-478e-b63e-5674f3ad4668 | prikshitcodes/Problem-Solving-Skills | Arrays/removeDuplicatesFromSortedArray.cpp | class Solution {
public:
int removeDuplicates(vector<int>& nums) {
int n=nums.size();
int i=0;
for(int j=1;j<n;j++){
if(nums[j]!=nums[i]){
nums[i+1]=nums[j];
i++;
}
}
return i+1;
}
};
| ALGO | 0.999776 | 6.187031 |
e878c6ea-e023-4b56-9e9b-266891a4422a | dihanrh/Competitive-Programming | PlusOneontheSubset.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
ios_base ::sync_with_stdio(false);
cin.tie(NULL);
cin.tie(0);
cout.tie(0);
#ifndef ONLINE_JUDGE
freopen("inputVS.txt", "r", stdin);
freopen("outputVS.txt", "w", stdout);
#endif
long int t ;
... | ALGO | 0.999488 | 3.785293 |
2a2c54b3-513d-46fe-bea3-545e1d90cf89 | tangyao0792/ACM_Solutions | hdoj/hdu3091_5924969.cpp | /*
* Author: Tangyao
* Email: <EMAIL>
* tangyao0792.github.com
*/
#include<iostream>
using namespace std;
int pre[19];
int map[18][18];
__int64 hash[1<<18][18];
int N,M;
int main()
{
__int64 sum;
int i,j,k,s,e,len;
pre[0]=1;
for(i=1;i<19;i++)
pre[i]=pre[i-1]<<1;
while(scanf("%d %d... | ALGO | 0.999973 | 3.150634 |
bc9f8948-823f-40cc-ad69-bf0ad5ac0519 | settyblue/MPI-programming | mpi_message_passing.cpp | #include<mpi.h>
#include<stdio.h>
#include<stdlib.h>
using namespace std;
int main(int argc, char** argv){
//Initialie the MPU environment.
MPI_Init(NULL,NULL);
//Find out rank and size.
int world_size, world_rank;
MPI_Comm_size(MPI_COMM_WORLD, &world_size);
MPI_Comm_rank(MPI_COMM_WORLD, &world_rank);
int numb... | ALGO | 0.983004 | 4.101496 |
e340c0ec-f064-48d4-9da0-b5b0f9752275 | lpc-cnrs-amu/N-word-frequency | selection_noun_in_files/main.cpp | #include <iostream>
#include <iomanip>
#include "../util/OccurrencesSafe.hpp"
#include "../util/util.hpp"
#include "Tokeniseur.hpp"
#include <regex>
#define LINE_SIZE 10000
using namespace std;
using namespace std::chrono;
mutex print_mutex;
bool is_upper(const std::wstring& token_wstr)
{
unsigned i = 0;
while( t... | TOOL | 0.888794 | 4.616146 |
dd5e80a5-1a68-46c7-83f7-939b53f286b0 | naruto361/LeetCodeSolutions | NimGame.cpp | class Solution {
public:
bool canWinNim(int n) {
return n%4!=0;
}
};
| ALGO | 0.999821 | 5.898237 |
4e929865-7ddc-4a15-bcf8-d34742dc37d4 | 0xkohe/ant-book-study | 2-2-2/main.cpp | #include <cstdio>
#include<algorithm>
using namespace std;
const int MAX_N = 100000;
int N=5;
int S[MAX_N] = {1,2,4,6,8};
int T[MAX_N] = {3,5,7,9,10};
pair<int, int> itv[MAX_N];
void solve() {
for(int i=0;i<N;i++){
itv[i].first=T[i];
itv[i].second=S[i];
}
//sort(itv, itv+N);
for(int i=... | ALGO | 0.958885 | 3.083034 |
841565eb-3b8c-4d3a-bf36-919bc37fb467 | kmjp/procon | atcoder/abc151-200/abc180/b.cpp | #include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;
#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define FORR2(x,y,arr) for(auto& [x,y]:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#def... | ALGO | 0.999713 | 3.36221 |
b49ba441-8b03-4e84-9ab4-62339cad357a | bangkitdc/Praktikum-OOP-2023 | prak-3/responsi/4/bintreemain.cpp | #include "BinaryTree.hpp"
#include <iostream>
using namespace std;
int main() {
BinaryTree <int> t;
t.setValue(1);
cout << t;
return 0;
} | TOOL | 0.969715 | 4.366461 |
9b17fac5-56bb-4ebe-bbcc-ee389314f972 | ishandutta2007/codeforces | gs12117/normal/1361/C.cpp | #include<cstdio>
#include<vector>
int n;
int sl[500100][2];
int dl[500100][2];
int en[500100][2];
std::vector<int> el[1100000];
std::vector<int> ed[1100000];
int usec[1100000];
int echk[1100000];
int conn[1100000][2];
int eord[1100000];
void nodeinit(int x) {
el[x].clear();
ed[x].clear();
usec[x] = 0;
}
int para(int... | ALGO | 0.999921 | 3.786664 |
c52fbbd0-6cdc-425d-bd96-7dcbe7b3fae8 | iRobot42/Geeks-for-Geeks | Easy/Number of subarrays whose minimum and maximum are same.cpp | long long numberOfways( int a[], int n ) {
long long x{};
for ( int i{ 1 }, c{ 1 }; i < n; ++i )
if ( a[ i ] == a[ i-1 ] ) x += ++c;
else ++x, c = 1;
return ++x;
}
| ALGO | 0.998278 | 5.058982 |
50c9ade4-5cfe-4f75-94b3-0f9e5f9fd440 | Avinash123Avinash/LEETCODE | 3639-zero-array-transformation-i/zero-array-transformation-i.cpp | class Solution {
public:
bool isZeroArray(vector<int>& nums, vector<vector<int>>& queries) {
int n=nums.size();
vector<int>diff(n+1,0);
for(auto it:queries)
{
int l=it[0];
int r=it[1];
diff[l]+=1;
diff[r+1]-=1;
}
vector<int>sum(n+1);
sum[0]=diff[0];
... | ALGO | 0.999745 | 5.897342 |
392d3f71-79fc-45e7-a7bc-767c07e10015 | atkikta/competitive-programming | cpp/t90/main55.cpp | #include <bits/stdc++.h>
// vector input
template<typename T> std::istream& operator >> (std::istream& is, std::vector<T>& vec){
for(T& x: vec) is >> x;
return is;
}
// vector join
template<typename T> std::string join(std::vector<T>& vec, std::string sep = ","){
std::stringstream ss;
ss << "{";
for... | ALGO | 0.999858 | 4.293467 |
58de6264-5fad-4370-a8ce-2bd3188396ef | ishandutta2007/codeforces | origenes/normal/1612/G.cpp | #include <bits/stdc++.h>
#include <utility>
namespace atcoder {
namespace internal {
// @param m `1 <= m`
// @return x mod m
constexpr long long safe_mod(long long x, long long m) {
x %= m;
if (x < 0) x += m;
return x;
}
// Fast moduler by barrett reduction
// Reference: https://en.wikipedia.org/wiki/B... | ALGO | 0.999603 | 4.586275 |
d21fef8e-8675-4d65-a0d6-56b2a84f4072 | Abhinav-1409/OPCode | A_Supercentral_Point.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define In \
for (ll i = 0; i < n; i++) \
{ \
cin >>
#define test \
ll t; \
cin >> t; \
while (t--)
#define Y cout << "YES" << endl;
#define N cout << "NO" << endl;
#define f... | ALGO | 0.99999 | 3.798055 |
81da6877-4860-4b57-8735-db338bf80c1d | ishandutta2007/codeforces | eddy1021/normal/958/A1.cpp | #include <bits/stdc++.h>
using namespace std;
#define N 50
int n;
char c[ 2 ][ N ][ N ] , t[ N ][ N ];
void rotate(){
for( int i = 0 ; i < n ; i ++ )
for( int j = 0 ; j < n ; j ++ )
t[ i ][ j ] = c[ 0 ][ i ][ j ];
// j = 0 i = n - 1 .. 0
for( int i = 0 ; i < n ; i ++ )
for( int j = 0 ; j < n ; j ++ )
... | ALGO | 0.999998 | 3.046387 |
f6994ed6-f8f9-4677-a516-125e6c4f37d1 | mrquincle/roveropen | jni/cxcore/src/cxjacobieigens.cpp | #include "_cxcore.h"
/*F///////////////////////////////////////////////////////////////////////////////////////
// Names: icvJacobiEigens_32f, icvJacobiEigens_64d
// Purpose: Eigenvalues & eigenvectors calculation of a symmetric matrix:
// A Vi = Ei Vi
// Context:
// Parameters:... | ALGO | 0.999921 | 5.339906 |
be198f49-be3b-4e15-9a43-8334325ca93b | jhavishesh/100DaysOfCodes | Day-46/Leetcode Biweekly Partition Array According to Given Pivot.cpp | /* https://leetcode.com/problems/partition-array-according-to-given-pivot/ */
//Solution:
class Solution {
public:
vector pivotArray(vector& nums, int pivot) {
vectorres;
vectorg;
int p=0;
for(int i=0;i<nums.size();i++)
{
if(nums[i]<pivot)res.push_back(nums[i]);
else if(nums[i]==pivot)p++;
else g.push_back(nums[i]);
... | ALGO | 0.999978 | 6.315668 |
218f7e02-c93c-42a6-a84a-4eafd518ec00 | darpan-b/Nirdesh-2023 | jaggus_dilemma_solution.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
freopen("testcase_case.txt", "r", stdin);
freopen("testcase_solution.txt", "w", stdout);
string s;
cin >> s;
int n = (int)s.size();
assert(n <= 2'00000);
int maxans = 0, curans = 0;
for (int i = 0; i < n; i++) {
if (... | ALGO | 0.999911 | 4.479146 |
e9f15925-aa9e-47a7-b47f-584dc52835e2 | wavelet-and-multiscale-library/Marburg_Software_Library | WaveletTL/interval/spline_basis.cpp | // implementation for spline_basis.h
#include <algebra/sparse_matrix.h>
#include <algebra/vector.h>
#include <numerics/cardinal_splines.h>
#include <numerics/schoenberg_splines.h>
#include <numerics/gauss_data.h>
#include <numerics/quadrature.h>
#include <numerics/gauss_quadrature.h>
#include <numerics/iteratsolv.h>
... | ALGO | 0.997156 | 7.119058 |
80662bdd-d608-428d-aa41-11643ac50b1c | AnujVastani/C-Projects | maintain.cpp | #include <iostream>
// Define the Node structure
struct Node {
int data;
Node* next;
Node(int val) : data(val), next(nullptr) {}
};
// Define the LinkedList class
class LinkedList {
private:
Node* head;
public:
LinkedList() : head(nullptr) {}
// Insert a new node at the end of the list
... | ALGO | 0.997304 | 6.061133 |
f5b77cb2-5c35-4be5-81a3-fbdc9183dc94 | TalelMejri/codeForces | Substring and Subsequence/main.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--){
string a,b;
cin>>a>>b;
int n=a.size(),m=b.size();
int lon=0;
for(int x=0;x<m;x++){
int j=x;
int c=0;
for(int i=0;i<n;i++){
if(a[i]==b[j]) c++,... | ALGO | 0.99974 | 4.724164 |
77b68b49-5f1d-4127-be18-e67c2c2355e4 | nopslide/firovm | src/policy/fees.cpp | #include <policy/fees.h>
#include <clientversion.h>
#include <streams.h>
#include <txmempool.h>
#include <util/system.h>
static constexpr double INF_FEERATE = 1e99;
std::string StringForFeeEstimateHorizon(FeeEstimateHorizon horizon) {
static const std::map<FeeEstimateHorizon, std::string> horizon_strings = {
... | ALGO | 0.991416 | 7.033765 |
a29c9364-13d9-4ada-b558-01012f815f40 | ntalfer/codingame | numeros_de_telephone.cpp | // Read inputs from stdin. Write outputs to stdout.
#include <iostream>
#include <string>
#include <vector>
using namespace std;
class Node
{
public:
Node(char c)
{
val = c;
}
char val;
vector<Node*> children;
};
void add_tel(vector<Node*>* roots, const string& val)
{
Node* node = NULL;
char c = v... | ALGO | 0.999367 | 4.781658 |
ea7ac5a3-175d-44d2-8fb4-f788c008431a | AmarShukla1/Competitive-Programming | Desktop/C.P/Sublime Text 3/programs/monkeyuva.cpp | //this is [f,f,f,f,f,t,t,t,t,t] type
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
int n;
bool check(int a[],int k)
{
if(a[0]==k){k--;}//bcoz of this condition i was missing.
for(int i=1;i<n;i++)
{
if(a[i]-a[i-1]>k)
{
return false;
... | ALGO | 0.99945 | 3.736996 |
e14a36bd-a24b-4a24-847e-297a5e7e2bc7 | somdengre/LeetCode | 2367-number-of-arithmetic-triplets/2367-number-of-arithmetic-triplets.cpp | class Solution {
public:
int arithmeticTriplets(vector<int>& nums, int diff) {
int count = 0;
for(int i=0;i<nums.size();i++){
for(int j=0;j<nums.size();j++){
for(int k=0;k<nums.size();k++){
if(i<j && j<k && (nums[j] - nums[i] == di... | ALGO | 0.999975 | 6.161347 |
1e2e5c9a-4fd1-4203-a59d-19d19226ecb0 | navendraagrawal9479/Object-Oriented-Programming-By-Navendra-Agrawal | unary_operator.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define m 1000000007
class test{
int a;
int b;
public:
test(){}
test(int x,int y){
a=x;
b=y;
}
void display(){
cout<<"a: "<<a<<" b: "<<b<<endl;
}
void operator-();
};
void test::operator-(){
... | ALGO | 0.99614 | 4.077541 |
dbdb22b5-5851-4908-84a1-ef6ad5337be2 | geleg-rigzin/Task_OMP_MPI_OCL | main.cpp | #include <iostream>
#include <vector>
#include <set>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <omp.h>
#include <cmath>
#include <climits>
#define MAX_SIZE 1000000
struct CSRPortrait {
int M = 0;
int N = 0;
std::vector <int> cumulative_sum;
std::vector <int> column_numbers;
... | ALGO | 0.997129 | 3.428614 |
45090ae0-fd12-4ef1-a13e-4a833c3edd9d | Parzival1509/GFG_POTD | 2024/2024-05/GFG_POTD_2024-05-17_Find_Pair_Given_Differences.cpp | // GFG POTD 2024/05/17
// Find Pair Given Differences
// Easy
#include <bits/stdc++.h>
using namespace std;
class Array {
public:
template <class T> static void input(vector<T>& A, int n) {
for (int i = 0; i < n; i++) {
scanf("%d ", &A[i]);
}
}
template <class T> static void p... | ALGO | 0.999959 | 5.562147 |
c911189d-a588-4526-aa44-af33359d7d29 | KaniamLaes/codeforces_solved_problems | Asterix_find.cpp | #include<bits/stdc++.h>
#define int long long
#define endl "\n"
#define FastIO ios_base::sync_with_stdio(false); cin.tie(NULL);
using namespace std;
void solve()
{
string s1,s2;
cin>>s1>>s2;
stack<char> s;
string ans="";
int a=0;
for(int i=0;i<s1.size();i++)
{
ans+=s1[i];
s.... | ALGO | 0.999994 | 3.785054 |
7431892b-b17f-4653-a509-90f565474d28 | hustwei/SPIRV-Tools | source/val/BasicBlock.cpp | #include "BasicBlock.h"
#include <algorithm>
#include <utility>
#include <vector>
using std::vector;
namespace libspirv {
BasicBlock::BasicBlock(uint32_t label_id)
: id_(label_id),
immediate_dominator_(nullptr),
immediate_post_dominator_(nullptr),
predecessors_(),
successors_(),
ty... | TOOL | 0.951797 | 7.111311 |
65f72575-fa6c-4fac-a6f2-8682792b7408 | hjiang13/LLMs-in-IR | POJ-104/25/1054.cpp | #include <iostream>
using namespace std;
int main()
{
int a[200] = {
0}
, i, flag = 0;
a[199] = 1;
int n;
cin >> n;
while (n != 0)
{
flag = 0;
for (i = 199; i >= 0; i--)
{
if (a[i] * 2 >= 10)
{
a[i] = a[i] * 2 - 10 + flag;
flag = 1;
}
else
{
a[i] = a[i] * 2 + flag;
flag = 0;
}
}
n--;
}
for (i = 0; a[i] == 0; i++)
{... | ALGO | 0.999963 | 3.308682 |
67986e72-8a59-4c74-b0ac-b7eeb40e21e3 | jmuhlich/bionetgen | bng2/Network3/src/pla/eRungeKutta/extra/eRungeKutta_TC_FG_sbPL.cpp | /*
* eRungeKutta_TC_FG_sbPL.cpp
*
* Created on: May 10, 2011
* Author: Leonard Harris
*/
#include "eRungeKutta_EXTRA.hh"
eRungeKutta_TC_FG_sbPL::eRungeKutta_TC_FG_sbPL(ButcherTableau bt, double eps, double p, double pp, double q, double w,
vector<SimpleSpecies*>& sp, vector<Reaction*>& rxn, Preleap_TC& p... | ALGO | 0.998819 | 4.877341 |
42abadfe-d94b-4116-b67c-5c897cfcfd20 | ishandutta2007/codeforces | andreasyan/normal/1551/E.cpp | #include <bits/stdc++.h>
using namespace std;
#define m_p make_pair
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define fi first
#define se second
typedef long long ll;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
mt19937 rnf(2106);
const int N = 2003, INF = 1000000009;
... | ALGO | 0.999959 | 3.94603 |
e9d087dd-16c2-4f6f-96fc-5a489d48f09c | phumipatc/C_Competitive_Programming | C++ - 2560/Pre 2_3 Camp/NC_Painting_Restore.cpp | /*
Task :
Author : Phumipat C.
School : RYW
Language: C++
*/
#include<bits/stdc++.h>
using namespace std;
int main(){
long long n,a,b,c,d;
scanf("%lld %lld %lld %lld %lld",&n,&a,&b,&c,&d);
long long minn=min(a+b,min(a+c,min(b+d,c+d)));
long long maxx=max(a+b,max(a+c,max(b+d,c+d)));
... | ALGO | 0.999857 | 4.101147 |
84089bb2-aa48-4381-bca6-c2cd1f45671c | AkashKalme/Binary-Search-Aditya-Verma | 2BinarySearchReverse.cpp | // Binary Search on Descending Array
#include <iostream>
using namespace std;
int reverseBinarySearch(int arr[], int n, int x)
{
int start = 0;
int end = n - 1;
while (start <= end)
{
int mid = start + (end - start) / 2;
if (arr[mid] == x)
{
return mid;
}
... | ALGO | 0.999982 | 5.819832 |
af0bfb61-c687-4510-ab8c-3057619413a1 | pvthuyet/CppInAction | lib/boost_1_70_0/libs/contract/example/features/pure_virtual_public.cpp | #include <boost/contract.hpp>
#include <vector>
#include <cassert>
//[pure_virtual_public_base_begin
template<typename Iterator>
class range {
public:
// Pure virtual function declaration (contract in definition below).
virtual Iterator begin(boost::contract::virtual_* v = 0) = 0;
//]
// Could program cla... | TOOL | 0.948904 | 5.225903 |
d49db53c-0499-4e82-bc34-0601814b3306 | ShJavokhir/University-Projects | Freshmen year/lab9-semester1/4.cpp | #include<iostream>
using namespace std;
int main(){
int n;
cout<<"Enter the number of elements: ";
cin>>n;
int a[n];
cout<<"Enter the array elements: ";
for(int i=0;i<n;i++) cin>>a[i];
int valueToAdd;
int positionThatThatWillBeAddetAt;
cout<<"Enter the value you want to add in arrr... | ALGO | 0.999276 | 4.345604 |
e60724a6-617b-4544-b98c-730ae22e916c | ZubairFarooq004/-DSA_Lab- | pointer to function.cpp | #include <iostream>
using namespace std;
int add(int a,int b){
return a + b;
}
int main (){
int (* ptr)(int , int) = add;
cout << " Sum: " << ptr(5,7) << endl;
return 0;
}
| TOOL | 0.952536 | 4.42107 |
4b02bacc-eace-4f1b-bc00-26cb9f6cf19d | hkalra0001/CompetitiveCodeVault | CodeChef/START125D/Overspeeding.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
// your code goes here
int speed;
cin>>speed;
if (speed>40) cout<<"YES";
else cout<<"NO";
}
| ALGO | 0.999675 | 3.217428 |
f8948385-f339-4b16-b376-8537b3e2d1f0 | Axying/upgraded-potato | 蓝桥杯代码测试/前缀和/平衡串.cpp | //平衡串
#include <bits/stdc++.h>
using namespace std;
const int N = 1000;
int prefix[N];
char s[N];
int main()
{
ios::sync_with_stdio(0),cout.tie(0),cin.tie(0);
cin>>s+1;
int m = strlen(s+1);
for(int i = 1;i<=m;i++){
prefix[i] = prefix[i-1]+(s[i]=='L'? 1 : -1);
}
int ans = 0;
for(int i = 1;i<=m;i++){
for(in... | ALGO | 0.999865 | 3.440926 |
f8406118-561e-498f-8e63-dcc132fe3920 | limon2009/ACM-UVA-Online-Judge-solution | 10041.cpp | #include<stdio.h>
#include<math.h>
#include<stdlib.h>
#define MAXN 30001
int RELATIVE[MAXN];
long long DIFF,MID;
int sf(const void *a, const void *b) {
return *(int *)a - *(int *)b;
}
void COM_DIFF(int N) {
int i;
DIFF = 0;
for(i = 0;i<N; i ++)
DIFF += abs(RELATIVE[i] - MID);
printf("%lld\n",DIFF)... | ALGO | 0.998816 | 3.369468 |
79ac1f12-771e-4c6a-aa2c-a28e46c9ac38 | mamarezatajik/Competitive-Programming | Codeforces/2005/B.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
#define F first
#define S second
#define len(a) (ll) (a.size())
#define all(a) (a).begin(), (a).end()
const ll m... | ALGO | 0.999947 | 4.855854 |
c2d6e855-ec7a-478e-8a36-fecd9d82df71 | ishandutta2007/codeforces | koosha_mv/normal/NA/184.cpp | #include<iostream>
using namespace std;
int main()
{
long long n;
cin>>n;
long long b,tb,k,tk,a;
for(long long i=0;i<n;i++)
{
cin>>a;
if(i==0)
{
b=a;
tb=1;
k=a;
tk=1;
}
else
{
if(a==b)
{
tb++;
}
if(a>b)
{
b=a;
tb=1;
}
if(a==k)
tk++;
if(a<k)
{
k... | ALGO | 0.999979 | 3.172205 |
ce0f7bd6-0f83-41bf-bc28-9ec7e84dcca6 | eunnbi/algorithm | bfs/BOJ/4179/4179.cpp | #include <bits/stdc++.h>
using namespace std;
string board[1002];
int dist1[1002][1002]; // 불의 전파 시간
int dist2[1002][1002]; // 지훈이의 이동 시간
int n, m;
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };
int main(void) {
ios::sync_with_stdio(0);
cin.tie(0);
cin >> n >> m;
// dist1, dist2 배열 초기화
for (int i = 0; i... | ALGO | 0.999949 | 5.290456 |
3cb48831-aafe-47c1-a2e4-64ddfe7d902a | CodderPrince/PythonProject | CODEFORCES/DIV 2 JAN 30 24/b.cpp | #include <bits\stdc++.h>
using namespace std;
int main()
{
int t;
cin >> t;
while (t--)
{
int n;
cin >> n;
vector<int> a(n), b(n);
for (int i = 0; i < n; ++i)
{
cin >> a[i];
}
for (int i = 0; i < n; ++i)
{
cin >... | ALGO | 0.999827 | 3.330698 |
e5d3dce6-dfe5-4183-96ea-d36b0c954637 | PerfectLifeG/Algorithm-Competition | Nowcoder/M99/e.cpp | #include<bits/stdc++.h>
using namespace std;
#define int long long
#define all(x) x.begin(),x.end()
#define no cout<<"No"<<endl
#define yes cout<<"Yes"<<endl
#define endl '\n'
#define x first
#define y second
typedef pair<int,int> PII;
const int N=200010;
const int mod=998244353;
const int INF=0x3f3f3f3f3f3f3f3f;
void ... | ALGO | 0.999975 | 4.068937 |
0075543d-815a-44af-a61c-e10f7fe5167a | bokusunny/atcoder-archive | atcoder.jp/arc074/arc074_b/Main.cpp | #include <bits/stdc++.h>
using namespace std;
void solve() {
int N;
cin >> N;
vector<long long> A(3 * N);
for (int i = 0; i < 3 * N; i++) cin >> A[i];
long long tot1 = 0;
priority_queue<long long, vector<long long>, greater<long long>> pq1;
for (int i = 0; i < N; i++) {
tot1 += A[i];
pq1.push(A[... | ALGO | 0.999928 | 4.377508 |
39b51eac-4b3e-4d61-95d7-814ff07b1586 | ishandutta2007/codeforces | juanzhang/normal/1477/C.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=(a),i##end=(b);i<=i##end;++i)
#define per(i,a,b) for(int i=(a),i##end=(b);i>=i##end;--i)
typedef long long ll;
const int maxn=5050;
int n;
struct point{
int x,y;
}A[maxn];
bool vis[maxn];
ll sqr(int x){
return 1ll*x*x;
}
ll get(int i,int j... | ALGO | 0.999995 | 3.703616 |
fcf55887-ea2e-4792-84d0-2091cff34249 | barkhayadav/Recursion | recursion revision/r14countSubseqWhoseSumK.cpp | #include<iostream>
#include<vector>
using namespace std;
int countSubseqWhoseSumK(int a[],int i,int target,int n,int sum,vector<int>&v)
{
if(i>n)
{
if(sum==target)
{
return 1;
}
return 0;
}
v.push_back(a[i]);
sum+=a[i];
int l=countSubseqWhoseSumK(a,i+... | ALGO | 0.999954 | 4.496664 |
d1f4922e-ecf2-43f6-8bcb-ea0a24150617 | Shibam008/CPP_programe | Recursion/Divide_n_conqure_and_Backtracking/Merge_sort.cpp | #include<iostream>
using namespace std;
void merge(int *arr, int s, int e){
int mid = s + (e-s)/2;
int left_len = mid-s+1;
int right_len = e - mid;
// creat dynamic array in Heap memory using "new" keyword
int *left = new int[left_len];
int *right = new int[right_len];
//copying values... | ALGO | 0.999972 | 4.793021 |
696203a5-78a6-4135-8004-fbe5413b7386 | AztecProtocol/aztec-2.0 | barretenberg/src/aztec/stdlib/merkle_tree/memory_tree.cpp | #include "memory_tree.hpp"
#include "hash.hpp"
namespace plonk {
namespace stdlib {
namespace merkle_tree {
MemoryTree::MemoryTree(size_t depth)
: depth_(depth)
{
ASSERT(depth_ >= 1 && depth <= 20);
total_size_ = 1UL << depth_;
hashes_.resize(total_size_ * 2 - 2);
std::vector<uint8_t> zero_element... | ALGO | 0.913102 | 6.273464 |
25e6caef-1d84-4078-b59d-b9d2d2818a13 | AadityaShukla01/Interview-Preparation | Prerequisite Tasks - GFG/prerequisite-tasks.cpp | //{ Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
bool isPossible(int N, vector<pair<int, int> >& prerequisites) {
int indegree[N]={0};
vector<int> adj[N];
for(auto it:prerequisites){
adj[it.first].push_back(it.second);
}
... | ALGO | 0.999853 | 6.137283 |
5788eb65-ec44-4606-86b4-e60af75dc341 | beingnabeel/DSA | c++ programming/cherno cpp/90 classTemplate.cpp | #include <iostream>
using namespace std;
template <typename T>
struct Pair
{
T x;
T y;
Pair(T i, T j)
{
x=i;
y=j;
}
T getfirst();
// {
// return x;
// }
T getsecond()
{
return y;
}
};
// you can define the functionality of getfirst outside the class also
template<typename T>
T Pair<T> ::getfirst()... | TOOL | 0.942649 | 4.579607 |
d47241b3-3db4-45cc-91e1-a9529c2bf731 | Akshay-Quant/Competitive-Coding | InterviewBit/Arrays/Merge Overlapping Intervals.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) {}
* };
*/
bool comp(const struct Interval P,const struct Interval Q){
return P.start<Q.start;
}
vector<Interval> Solution::merge(... | ALGO | 0.999997 | 5.788235 |
cc548853-cc8b-463c-a0a6-068289bc4537 | checkoutb/LeetCodeCCpp | ge1800/LT1850_2021-05-03_Minimum_Adjacent_Swaps_to_Reach_the_Kth_Smallest_Number.cpp |
#include "../header/myheader.h"
class LT1850
{
public:
// D D
// 8ms
// for(int i=0;i<k;++i) {
// next_permutation(num.begin(), num.end());
// }
// md
// 40ms
// void nextPermutation(vector<int>& nums) {
// int n = nums.size(), i = n - 1;
// while(i > 0 && nums[i-1] >= num... | ALGO | 0.999959 | 4.774302 |
bc393c51-25c0-4095-8a8f-76d3a289f136 | casm-lang/libtptp | etc/test/z3.cpp | #include "main.h"
#include <z3++.h>
/**
Demonstration of how Z3 can be used to prove validity of
De Morgan's Duality Law: {e not(x and y) <-> (not x) or ( not y) }
see: https://github.com/Z3Prover/z3/blob/master/examples/c%2B%2B/example.cpp
*/
TEST( libtptp, z3_demorgan )
{
z3::context c;
z3::expr ... | ALGO | 0.918574 | 7.014958 |
9f0c7028-d4b6-4f92-8359-789a2315c254 | flick7k/CSGO-SIMPLE-BETA | CSGOSimple-master/CSGOSimple/SourceEngine/Vector4D.cpp | #include "Vector4D.hpp"
#include <cmath>
#include <limits>
namespace se
{
void VectorCopy(const Vector4D& src, Vector4D& dst)
{
dst.x = src.x;
dst.y = src.y;
dst.z = src.z;
dst.w = src.w;
}
void VectorLerp(const Vector4D& src1, const Vector4D& src2, vec_t t, Vector4D& ... | TOOL | 0.929755 | 5.309267 |
e3215ae2-1c1d-41a8-9f62-fcf760f58460 | mokshsharma089/GuideCodeForCpp | Sorting/Heap Sort.cpp | #include <iostream>
#include <vector>
#include <cstdlib>//for rand() function
#include <algorithm>
#define pb push_back
using namespace std;
void display(vector<int>& arr){
cout<<endl<<"-----------------Current State Of Array-----------------"<<endl;
for(auto a:arr){
cout<<a<<" , ";
}
cout<<endl<<"---------... | ALGO | 0.999846 | 4.576789 |
eeadbef8-31a5-466a-84f9-fc708ba46c60 | lovelybigduck/note | 代码练习/刷题/蓝桥代码/统计工龄.cpp |
/*7 ͳƹ䣨25 ֣
˾NԱĹ䣬ҪÿжԱ
ʽ:
ȸN10
?5
?? ԱNÿԱĹ䣬Χ[0, 50]
ʽ:
ĵ˳ÿԱʽΪ:ÿռһСΪ0
:
8
10 2 0 5 7 2 5 2
:
0:1
2:3
5:2
7:1
10:1*/
#include <iostream>
#include<algorithm>
#include<vector>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;
bool comp(i... | ALGO | 0.998952 | 3.790722 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.