uuid stringlengths 36 36 | repo_name stringlengths 5 123 | relative_path stringlengths 5 4k | content stringlengths 33 2.85M | category stringclasses 6
values | algo_rel_score float64 0.85 1 | quality_score float64 3 8.76 |
|---|---|---|---|---|---|---|
eddc6989-0131-4767-b748-5c201f1ae80a | Dhruva1098/learnCpp | dsa/rest/printBinaryCombinations.cpp | #include <iostream>
#include <string>
void printBinaryCombinations(int size, std::string prefix) {
if (size == 0) {
std::cout << prefix << std::endl;
}
else {
printBinaryCombinations(size - 1, prefix + "0");
printBinaryCombinations(size - 1, prefix + "1");
}
}
int main() {
printBinaryCombinations(7, "");
} | ALGO | 0.997889 | 6.581716 |
95106155-3f8f-4be3-8c34-a89fcfd9b8e5 | SumitM28/Cpp | 24_BinaryTree/05_identicle.cpp | // you are given 2 tree check if both tree are identicle or not.
#include<iostream>
#include<queue>
using namespace std;
class Node{
public:
int data;
Node* left;
Node* right;
Node(int data){
this->data=data;
this->left=NULL;
this->right=NULL;
}
};
Node* createTree(Nod... | ALGO | 0.999833 | 5.169341 |
1e6b01e5-7854-4b63-b3e3-121ff17fb660 | Octo-Siddharth/TCS-NQT-Coding-Questions | 10_Cognizant/3_Reverse_Number.cpp | //Program to reverse a number
#include<bits/stdc++.h>
using namespace std;
int main()
{
int num, rev, rem = 0;
cin>>num;
while(num != 0)
{
rem = num % 10;
rev = rev * 10 + rem;
num = num / 10;
}
cout<<rev<<endl;
return 0;
} | ALGO | 0.999888 | 4.495494 |
3615ddf7-69bd-49ca-b447-1be3d6b97652 | dattocngan/THCS2_PTIT | Homework/bai163_xoatutrongxau.cpp | #include<stdio.h>
#include<math.h>
#include<string.h>
int main(){
int t;
scanf("%d",&t);
getchar();
for(int k = 1 ; k <= t ; k++ ){
char a[200], b[200];
gets(a);
gets(b);
int i,j,check;
printf("Test %d: ",k);
for( i = 0 ; i < strlen(a) ; i++ ){
check = 0;
if( i == 0 || a[i-1] == ' ' ){
char x... | ALGO | 0.999646 | 3.156558 |
936acf05-1f06-4033-a194-a5998f802435 | Muhammad-Al-Halaby/Competitive-Programming-Submissions | codeforces/1461/D.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1e5 + 9, M = 1e6 + 9, OO = 0x3f3f3f3f;
ll llOO = 0x3f3f3f3f3f3f3f3f;
ll n, q, a[N];
ll prefix[N];
map<ll, int> mp;
void solve(int left = 0, int right = n - 1){
if(left == right || a[left] == a[right]){
mp[a[left] * (rig... | ALGO | 0.999983 | 4.569433 |
443de420-68d1-4d03-9651-1c6bcac45a64 | AlfarLatypov/reposit | initializer_list/Source.cpp | #include <iostream>
#include <string>
#include <iomanip>
using namespace std;
class Point {
public:
int x, y;
Point(int x, int y) {
this->x = x;
this->y = y;
}
};
template<typename... T >
int check(T...args) {
int cnt = 0;
int r = 5;
for (auto&& i : initializer_list<Point>{ args... }) {
if (i.x * i.x +... | ALGO | 0.959098 | 4.456775 |
4e9b1a75-ab97-4ec8-80ab-03d220a2a605 | muqeemahmad12/FlutterSample | 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 |
cb1ec9db-05b3-4ee8-8356-50aa9cd8997f | squaresLab/BatFix | results/transcoder/translations/java/DYNAMIC_PROGRAMMING_SET_9_BINOMIAL_COEFFICIENT.cpp | int binomial_coeff ( int n , int k ) {
if ( k == 0 || k == n ) return 1 ;
return binomial_coeff ( n - 1 , k - 1 ) + binomial_coeff ( n - 1 , k ) ;
}
| ALGO | 0.998647 | 5.428064 |
89a1c62e-7a43-41d8-8aee-cbe4ba5c22db | yukikamome316/atcoder-archive | abc324/abc324_b_46533340_AC.cpp | /*
* Author: yukikamome316
* Submission URL: https://atcoder.jp/contests/abc324/submissions/46533340
* Submitted at: 2023-10-14 21:08:19
* Problem URL: https://atcoder.jp/contests/abc324/tasks/abc324_b
* Result: AC
* Execution Time: 1 ms
*/
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n)... | ALGO | 0.999983 | 4.512409 |
947c577b-864f-47ad-b287-0c9339ff53bf | raincross7/code-similarity | codes/train_code/problem323/problem323_197.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int n, m;
int a[1003];
int m_itens = 0, total_votes = 0;
double a_d[1000];
double n_d, m_d, total_votes_d = 0.0;
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(NULL);
cout.tie(NULL);
cin >> n >> m;
n_d = n*1.0;
m_... | ALGO | 0.99998 | 4.003345 |
b1420994-c404-476d-ba8b-54030d954f15 | otoyaa/past-contest | C++/プログラミング入門 /チェスボードの描画.cpp | #include <bits/stdc++.h>
#define read(x) cin>>x
#define vi vector<int>
#define l(i,s,n) for (int i=int(s);i<int(n);i++)
#define pb push_back
#define f first
#define s second
#define no cout<<"NO"<<"\n"
#define yes cout<<"YES"<<"\n"
#define pii pair<int,int>
typedef long long ll;
using namespace std;
void solve(){
... | ALGO | 0.999847 | 3.623832 |
72c8b1ee-5717-42b3-8829-f04b9218c7e7 | MarioTalevski/FICT | Part One/10.6 Функција за сортирање на Именик од 10.4/main.cpp | #include <cstdlib>
#include <iostream>
using namespace std;
void sortiraj(struct lice *niza, int brlica)
{
int i, j;
for (i=0; i<brlica-1; i++)
for (j=i+1; j<brlica; j++)
{
int prezime=strcmp(niza[i].prezime, niza[j].prezime);
int ime=strcmp(niza[i].ime, niza[j].ime);
... | TOOL | 0.931613 | 3.745058 |
5b8f6743-ec3d-480c-aad6-83f302097bcf | pranjalrana01/Data-Structures-using-cpp | 11MARCH/charArray.cpp | #include<iostream>
using namespace std;
void reverse(char name[],int n){
int s=0;
int e=n-1;
while(s<e){
swap(name[s++],name[e--]);
}
}
int getlen(char name[]){
int count = 0;
for(int i=0;name[i]!='\0';i++){
count++;
} return count;
}
int main(){... | ALGO | 0.999065 | 3.760057 |
02f3deaf-e78e-43da-bd16-ce682f0b797f | smileHorse/C- | fastdb/fastdb源码/fastdb-373/fastdb/GiST/RSTree/RT.cpp | // -*- Mode: C++ -*-
#include <string.h>
#include "GiST.h"
#include "RT.h"
typedef struct {
double dist;
int ix;
} distix;
extern "C" int
GiSTdistixcmp(const void *x, const void *y)
{
distix a = *(distix *)x;
distix b = *(distix *)y;
if (a.dist > b.dist)
return(-1);
else if (a.dist == b.... | ALGO | 0.990957 | 6.088064 |
028ab17c-7222-44f6-a971-30e0a745f826 | kschmeckpeper/keypoint-pose-estimation | gtsam/gtsam-4.0.0/gtsam/3rdparty/Eigen/test/eigen2/eigen2_sparse_solvers.cpp | #include "sparse.h"
template<typename Scalar> void
initSPD(double density,
Matrix<Scalar,Dynamic,Dynamic>& refMat,
SparseMatrix<Scalar>& sparseMat)
{
Matrix<Scalar,Dynamic,Dynamic> aux(refMat.rows(),refMat.cols());
initSparse(density,refMat,sparseMat);
refMat = refMat * refMat.adjoint();
for (i... | TEST | 0.953466 | 4.982318 |
a1442e63-9969-40c4-a31b-4b179c13d408 | pawandev200/Leetcode_Dsa | 0122-best-time-to-buy-and-sell-stock-ii/0122-best-time-to-buy-and-sell-stock-ii.cpp | class Solution {
public:
// just when you get the profit sell it, count the profit
// add the profit for the later transections
int maxProfit(vector<int>& prices) {
int n = prices.size();
int profit = 0; // minimum profit
for(int i=1; i<n; i++){
// buy on ith day and sell on... | ALGO | 0.999741 | 6.050725 |
8c82315d-242d-4044-b534-2ee781e413df | AmirHaytham/Online-Judges-Solutions | UVa/12455 - Bars/main.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int TC ; cin >> TC ;
while(TC--){
int required ; cin >> required ;
int n; bool ok = 1; cin >> n;
vector<int> v(n) ;
for(int i = 0; i < n; ++i)cin >> v[i];
for(int i = 0; i < (1 << n); ++i){
int sum ... | ALGO | 0.999542 | 4.380198 |
6d1d6a81-7b08-4fcc-b081-af35bc48b59a | raincross7/code-similarity | codes/train_code/problem078/problem078_486.cpp | #include<bits/stdc++.h>
#define rep(i,n) for(ll i = 0;i < n;++i)
#define all(v) v.begin(),v.end()
using namespace std;
using ll = long long;
typedef pair<int,int> P;
const int INF = 1001001001;
const long double PI = (acos(-1));
const int mod = 1e9+7;
const int vx[6] = {0,1,0,-1,1,-1};
const int vy[6] = {1,0,-1,0,1... | ALGO | 0.999996 | 4.106094 |
f862654c-3d24-4cfd-acca-45d7fab48891 | ketan-suthar/DataStructure | C++/Heap/KlargestElements.cpp | #include <bits/stdc++.h>
using namespace std;
#define MinHeap priority_queue<int, vector<int>, greater<int>>
void printHeap(MinHeap minHeap)
{
if(minHeap.size()<1)
return;
int top = minHeap.top();
minHeap.pop();
printHeap(minHeap);
cout<<top<<' ';
}
int printKLargestElements(int *arr, int... | ALGO | 0.999973 | 4.269509 |
42679fd5-d386-4396-bad6-d3d53bee2ddd | blue515/pcl_filters | voxel_grid.cpp | #include <iostream>
#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>
#include <pcl/filters/voxel_grid.h>
int main (int argc, char** argv)
{
pcl::PCLPointCloud2::Ptr cloud (new pcl::PCLPointCloud2 ());
pcl::PCLPointCloud2::Ptr cloud_filtered (new pcl::PCLPointCloud2 ());
// Fill in the cloud data
pcl::P... | DATA | 0.889558 | 5.882719 |
ce2ce592-e0eb-4d72-a69c-8ddd6b57d09f | Saigopu/Algouniv_OJ_Project | server/solutions/problemID1.cpp | //this is the solution which we will be using to get the expected output when user clicks run button
//this solution is for the problem TWO SUM
/*
complexity
time: O(nlogn)
space: O(1)
*/
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin >> n;
vector<int> arr(n);
for (int i = 0;... | ALGO | 0.999995 | 4.929101 |
c91a9668-548d-4c89-9869-702820b39545 | Abhishek9503/Problem-of-the-Day | String Permutations - GFG/string-permutations.cpp | //{ Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution{
public:
vector<string> permutation(string S)
{
vector<string> ans;
string cur = "";
vector<bool> vis(S.size(), 0);
function<void()> helper = [&]() {
... | ALGO | 0.999941 | 6.474 |
b1c4034e-e506-4727-9cf8-0e4b5d3f35f5 | AlexJLennartsson/ThinkLikeAProgrammerExamples | Decimal_Binary_Converter/main.cpp | #include <iostream>
#include <stack>
using namespace std;
int main(void) {
/*cout << "Please enter a Decimal Number: ";
int num;
cin >> num;
stack<int> stack;
while(num!=0) {
stack.push(num%2);
num /= 2;
}
while(!stack.empty()) {
cout << stack.top();
stack.p... | ALGO | 0.999356 | 4.411457 |
d2941f35-b82f-45c8-9492-78eb55b64cf6 | anmoanmo/acm_exercises | acm/hdu/24hdu训练07/1010.cpp | //
// Created by ᕕ(◠ڼ◠)ᕗ on 24-8-9.
//
#include<bits/stdc++.h>
#define ll long long
using namespace std;
void sol() {
ll n, x1, k;
cin >> n >> x1 >> k;
ll x = x1;
vector<ll> a(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
}
int ans = 0;
priority_queue<ll> maxHeap;
for (in... | ALGO | 0.999807 | 4.450733 |
2ae86e4f-28ca-4d02-af17-4699ca9666df | XushengZhao/Stanford_repo | Stanford Algorithms/Part I - Divide Conquer + Randomized Algos/Week 3 - Quicksort/Quicksort/Quicksort.cpp | #include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <fstream>
#include <vector>
using namespace std;
/* Implementation of the quick sort algorithm with 3 different pivot choose algorithms
The goal is to count the number of comparisons for each type of pivot choice to get a better unde... | ALGO | 0.999622 | 4.8193 |
50787d56-64ed-4cc6-a6d7-38ef936d5f08 | faisalOmarBadaam/Problem-Solving-Level-3 | ProblemSolvingLevel3/Problem 10/Problem 10.cpp |
#include <iostream>
#include <string>
#include <iomanip>
using namespace std;
void printArray(int arr[100][100], int lenthR, int lenthC)
{
for (int i = 0; i < lenthR; i++)
{
for (int j = 0; j < lenthC; j++)
{
printf(" %0*d ", 2, arr[i][j]);
}
cout << endl;
}
}
int randomNumber(int from, int to) {
retur... | ALGO | 0.987202 | 3.699821 |
e5a6c351-b7e7-4185-85c5-e6c2623f1e7d | kkakulphimp/3D_Scanner_PUBLIC | KinectPrototype/KinectPrototype/Mesh-processing-library/test/tSpatial.cpp | using namespace hh;
int main() {
{
PointSpatial<int> sp(40);
Vec<Point,30> pa;
Point p(.4f, .22f, .87621f);
Vector v(.0065f, .0212f, -.01623f);
for_int(i, pa.num()) {
pa[i] = p;
sp.enter(i, &pa[i]);
p += v;
}
for (int i = 8... | ALGO | 0.975457 | 4.273846 |
7f7514b5-b02c-4b28-88fb-221807672362 | virtualsecureplatform/llvm-rv16k | llvm/lib/CodeGen/LiveRangeShrink.cpp | #include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/ADT/iterator_range.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/MachineOperand.h"
#include... | ALGO | 0.995278 | 7.947615 |
3b0b0180-6bc8-4707-8610-ec0f7381782f | nikhilmehlan/Dsa | 0148-sort-list/0148-sort-list.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
ListNode* sortList(Li... | ALGO | 0.999977 | 5.650892 |
eb859ef0-633a-4879-9c34-c6306bd036e0 | abhinavgpt1/DSA-cpp | DSA-self/02_Basic_Recursion/printing all binary sequences of length n.cpp | #include<iostream>
using namespace std;
int binSeq(int start, int length, bool arr[])
{
static int count;
if(start==length)
{
for(int i=0;i<length;i++)
cout<<arr[i];
cout<<endl;
count++;
return count;
}
arr[start]=0;
binSeq(start+1,length,arr);//nowhere here count can be incremented
arr[start]=1;
bi... | ALGO | 0.999639 | 3.829017 |
72212079-86c5-4d3b-9bc1-abe1493fc2dd | nhamlv-55/Ropey | z3grpc/src/tactic/sls/bvsls_opt_engine.cpp | #include "ast/normal_forms/nnf.h"
#include "tactic/sls/bvsls_opt_engine.h"
bvsls_opt_engine::bvsls_opt_engine(ast_manager & m, params_ref const & p) :
sls_engine(m, p),
m_hard_tracker(sls_engine::m_tracker),
m_obj_tracker(m, m_bv_util, m_mpz_manager, m_powers),
m_obj_evaluator(m, m_bv_util, m_obj_track... | ALGO | 0.999366 | 6.748853 |
90dccdde-aecb-4fee-b8e9-50473e2e2ed4 | lehoangnb/android_device_pantech | ef63s/gps/utils/loc_misc_utils.cpp | #include <stdio.h>
#include <string.h>
#include <log_util.h>
#include <loc_misc_utils.h>
#include <ctype.h>
#define LOG_NDDEBUG 0
#define LOG_TAG "LocSvc_misc_utils"
int loc_util_split_string(char *raw_string, char **split_strings_ptr,
int max_num_substrings, char delimiter)
{
int raw_st... | TOOL | 0.970559 | 5.380703 |
6695af33-eec4-474a-84fc-8971711fc0f5 | ishandutta2007/codeforces | rfpermen/normal/962/A.cpp | #include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("tune=native")
#pragma GCC optimize("unroll-loops")
using namespace std;
#define ll long long
#define ull unsigned long long
#define rep(i,n,N) for(int i=(n);i<=(N);++i)
#define For(i,n,N) for(int i=(n);i< (N);++i)
#define rap(i,n,N) for(int i=(... | ALGO | 0.999918 | 3.607326 |
1138c9c1-79b6-4be6-9388-e40dfe760c58 | devararendy/tcp_proxy | sdk/boost_1_77_0/libs/compute/perf/perf_stl_search.cpp | #include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>
#include "perf.hpp"
int rand_int()
{
return static_cast<int>((rand() / double(RAND_MAX)) * 25.0);
}
int main(int argc, char *argv[])
{
perf_parse_args(argc, argv);
std::cout << "size: " << PERF_N << std::endl;
// create ve... | ALGO | 0.977813 | 5.696832 |
93399278-6033-4444-85d7-937e524e9e60 | ishandutta2007/codeforces | emilan/normal/152/C.cpp |
#include <cassert>
#include <numeric>
#include <type_traits>
#ifdef _MSC_VER
#include <intrin.h>
#endif
#include <utility>
#ifdef _MSC_VER
#include <intrin.h>
#endif
namespace atcoder {
namespace internal {
constexpr long long safe_mod(long long x, long long m) {
x %= m;
if (x < 0) x += m;
return x;
... | ALGO | 0.999711 | 5.072603 |
fd69fdbb-a905-4146-9f16-5e52131b0f04 | arpansahu/Graph | BellmanFord_Algorithm_Single_Source_Shortest_Path.cpp | #include <iostream>
#include <vector>
#include "set"
#include "unordered_map"
#include "algorithm"
#include "queue"
#include "climits"
using namespace std;
struct Edge{
int source,destination,weight;
};
struct Node {
int vertex, weight;
};
struct Compare{
inline bool operator ()( Node a, Node b){
... | ALGO | 0.999937 | 4.259364 |
221de9a3-cff5-40b8-8c03-bfc0a8c2efa9 | vudinhan2525/DSA-UIT | Baitap wecode2/Bai 7.cpp | stack<Node*> st;
st.push(root);
while(!st.empty()){
Node *tmp = st.top();
cout << tmp->data << " ";
st.pop();
if(tmp->right){
st.push(tmp->right);
}
if(tmp->left){
st.push(tmp->left);
}
} | ALGO | 0.999979 | 3.568313 |
90997bbb-2f86-4e68-9fe9-11097497b9ae | Andrew-Raz-ACRV/SnakeRaven-Project | raven_2/src/raven/trajectory.cpp | /**
* \file trajectory.h
* \author Hawkeye
* \version 10/2011
* \ingroup Control
* Generate joint and cartesian trajectories.
* Internal data structures track trajectory state, and update DOFs as needed
* upon calling.
*/
#include <ros/ros.h>
#include "trajectory.h"
#include "log.h"
#include "utils... | ALGO | 0.982752 | 5.644391 |
9639d0a2-7625-47c0-ad67-808f625fd9d5 | solareenlo/atcoder | 13_Other-Contests/005_WUPC-2012/C_001.cpp | #include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using P = pair<int, int>;
const int dx[4] = {0, 1, 0, -1};
const int dy[4] = {1, 0, -1, 0};
int n, m;
inline int bfs(int sy, int sx, int gy, int gx, string s[])
{
queue<P> q;
q.push({sy, sx});
vector<vector<int> > dist(n,... | ALGO | 0.9997 | 4.033973 |
f267d07c-110c-4753-8e29-7aa3e0959154 | aidarinho2017/Algorithms | lab2/lab3/3a.cpp | #include <iostream>
#include <vector>
using namespace std;
vector <int> v;
int b, c;
int m[10000][10000];
void f(int a, int b, int target) {
vector<int> q;
int r;
int top = 0;
int bot = b - 1;
while (top <= bot) {
int mid = (top + bot) / 2;
if (m[mid][0] > target && m[m... | ALGO | 0.999848 | 3.643024 |
e771f8b2-0896-4dbb-8d76-2a972334b62b | g0del-esch3r-bach/eigenvalue-002 | programfiles/deprecated/newcostfunc.cpp | #include<iostream>
#include<iomanip>
#include<vector>
#include<cstdio>
#include<cmath>
#include<string>
#include<algorithm>
#include "../eigen-3.4.0/Eigen/Dense"
#include "../eigen-3.4.0/Eigen/Eigenvalues"
using Eigen::MatrixXd;
using Eigen::VectorXcd;
using namespace std;
float eigen2(int A[][100],int N){
int i,j,... | ALGO | 0.999866 | 3.148743 |
6d0338fd-61c7-471a-8aa1-7a9d4aaa704a | panzg123/acm | HDOJ_1272_main.cpp | /*
1272 СԹ
鼯
ж㣺
1.κ2ĸڵ㲻ͬ->ᵼ2жͨ·
2.еֻ1
*/
#include <iostream>
using namespace std;
#define MAX 100001
int father[MAX];
int rank[MAX];
void Make_Set(int n)
{
for(int i=0; i<=n; i++)
{
father[i]=i;
rank[i]=0;
}
}
int Find_Set(int x)
{
if(x!=father[x])
return Find_Set(father[x])... | ALGO | 0.999974 | 3.585705 |
50854e68-12e8-47d2-bcb6-4ed07e338b66 | YJ17/codetree-TILs | 240416/블럭쌓는 명령2/block-stacking-commands2.cpp | #include <iostream>
using namespace std;
int main() {
// 여기에 코드를 작성해주세요.
int n, k, a, b, max = 0;
int arr[100] = {};
cin >> n >> k;
for(int i = 0; i < k; i++){
cin >> a >> b;
for(int i = a; i <= b; i++){
arr[i] += 1;
}
}
for(int i = 0; i < n; i++){
... | ALGO | 0.99994 | 3.883374 |
aa6fe09f-8067-4e2a-ac27-651b276147da | fepaf/Competitive-Programming | Meu-Codebook/Paradigmas/digit-pd-3.cpp | #include<bits/stdc++.h>
#define _ ios_base::sync_with_stdio(0);
#define vi vector<i64>
#define pb push_back
#define i64 long long
/*
Quantos numeros entre A e B digito K aparece N vezes
*/
using namespace std;
i64 dp[20][2][200];
i64 n,m,a,b,k,fa,fb;
vi dig;
string c;
vi getDigit(i64 x){
vi digitos;
do{
... | ALGO | 0.999459 | 3.496401 |
ed747b25-48a4-4d38-af03-4a3e815574f6 | jackwang0108/CPlusPlusPrimerPlus | chapter16/lstrmv.cpp | #include <iostream>
#include <list>
#include <algorithm>
void Show(int);
const int LIM = 10;
int main(void)
{
using namespace std;
int ar[LIM] = {4, 5, 4, 2, 2, 3, 4, 8, 1, 4};
list<int> la(ar, ar + LIM);
list<int> lb(la);
cout << "Original list contents:\n\t";
for_each(la.begin(), la.end()... | ALGO | 0.994955 | 5.166358 |
5af5ab4b-fe15-4ba1-bef0-b513f6c11de0 | viktorparipas92/adventofcode-2016 | CPP/1_NoTimeForATaxicab.cpp | #include <iostream>
#include <tuple>
#include <fstream>
#include <set>
using namespace std;
// main() is where program execution begins.
class Bunny {
public:
Bunny(int direction);
void turnRight(void);
void turnLeft(void);
void turn(char direction);
void walk(int steps);
... | ALGO | 0.999856 | 4.856171 |
a5eb5a5d-681e-4bfe-8738-10ff7e898895 | HaoTzuH/leetcode_solution | 14_LongestCommonPrefix.cpp | class Solution {
public:
string longestCommonPrefix(vector<string>& strs) {
if (strs.empty()) return "";
string res = "";
for(int i = 0;i < strs[0].size() ;i++)
{
char c = strs[0][i];
for(int j = 1; j < strs.size();j++)
{
if( strs[j... | ALGO | 0.999788 | 5.765708 |
e40ee8c4-018f-46a8-9416-acf546e8b36f | zhushaoben/training | 2020暑假训练/AtCoder Beginner Contest 174/C.Repsept.cpp | #include<bits/stdc++.h>
using namespace std;
const int N=1e6+5;
bool vis[N];
int main(){
int k,x=0;scanf("%d",&k);
for(int i=1;;i++){
x=(x*10+7)%k;
if(vis[x])break;
if(!x)return printf("%d\n",i),0;
vis[x]=1;
}
puts("-1");
return 0;
}
| ALGO | 0.99958 | 3.400505 |
ff8d92ac-47bb-4397-8c01-a7093980f420 | ishandutta2007/codeforces | martin53/normal/274/D.cpp | #include<bits/stdc++.h>
using namespace std;
const int mmax=3e5+42;
vector< vector<int> > inp;
int n,m;
vector<int> adj[mmax];
int in[mmax];
pair<int/*value*/,int/*index*/> help[mmax];
queue<int> q;
int main()
{
scanf("%i%i",&n,&m);
vector<int> now={};
for(int i=1;i<=m;i++)now.push_back(0);
for(int i=1;i<=n;i++)
{
... | ALGO | 0.999972 | 3.300939 |
64bdbdca-22a0-4a8a-a7e7-155d3b348aa0 | amisubhankar/CppProgram | BT_max_sum_leaf_to_root.cpp | #include<iostream>
using namespace std;
class Node{
public:
int data;
Node *left,*right;
public:
Node(){}
Node(int item){
data=item;
right=left=NULL;
}
int findMaxLeafToNode(Node *root){
if(root==NULL) return 0;
int L=findMaxLeafToNode(root->left);
... | ALGO | 0.999917 | 4.574036 |
5a4fd25b-5e1c-49ce-a3f9-b245ef0bb5e0 | imteekay/algorithms | competitive-programming/uri/help_girafales.cpp | // https://www.urionlinejudge.com.br/judge/en/problems/view/1911
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int get_index(vector< pair<string, string> > names, string name) {
for (int i = 0; i < names.size(); i++) {
if (names[i].first == name) return i;
}
}
int main() {
vector... | ALGO | 0.9962 | 4.059587 |
8237b2bd-7db4-40ca-a635-4082922bc7ec | ssaannzzhhiikk/PP1 | lab5/Dec to Hex E.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int dec, index = 0;
cin >> dec;
string hexx; // Increase the size to handle larger decimal numbers
// Handle edge case when input is 0
if (dec == 0) {
cout << "0" << endl;
return 0;
}
// Loop to convert decima... | ALGO | 0.999906 | 6.514745 |
9d622e44-c53e-4e5a-891f-39e43f174c0d | pratikmehakare/DSA | Graphs/Graph.cpp | //for only int data type
//by uging adj list
#include <bits/stdc++.h>
using namespace std;
class graph
{
public:
unordered_map<int, list<int>> adj; // to store U->V ex 1->{0,2,3} here U=1 and V=0,1,2//
//,so V is list of elments,
//oR vector<vector<int>> adj;
void addE... | ALGO | 0.999794 | 5.928981 |
69773a7c-6caf-4744-a883-e7f10e50b5ab | Seszel/IMO | lab/src/algorithms/algorithm2cycles.cpp | #include "algorithm2cycles.hpp"
int Algorithm2cycles::findClosestVertex(int v, const InstanceTSP & instance, std::vector<bool > & visited){
int min = RAND_MAX;
int closestVertex = -1;
for(int i = 0; i < instance.dimension; i++){
if(instance.matrix[v][i] < min && visited[i] == false){
... | ALGO | 0.999972 | 3.054684 |
7b7430ed-a1b1-4b76-b999-0640f9f48ee2 | ishandutta2007/codeforces | wasa855/normal/1586/H.cpp | #include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fast_IO ios::sync_with_stdio(false);
#define DEBUG fprintf(stderr,"Running on Line %d in Function %s\n",__LINE__,__FUNCTION__)
//mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#de... | ALGO | 0.999954 | 4.323951 |
3aee4471-f8e0-48a7-84c3-f75eb27cc68b | blueskyxzy/hotspot | src/share/vm/gc_implementation/g1/concurrentMark.cpp | #include "precompiled.hpp"
#include "classfile/symbolTable.hpp"
#include "gc_implementation/g1/concurrentMark.inline.hpp"
#include "gc_implementation/g1/concurrentMarkThread.inline.hpp"
#include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
#include "gc_implementation/g1/g1CollectorPolicy.hpp"
#include "gc_implemen... | TOOL | 0.934055 | 7.709915 |
040bf230-ebc5-420d-b4cd-21b852ce79d9 | dushyant-goel/leetcode | 1734.DecodeXORedPermutation.cpp | class Solution
{
public:
vector<int> decode(vector<int> &encoded)
{
int n = encoded.size() + 1;
vector<int> perm;
int x = 0;
for (int i = 1; i <= n; i++)
x ^= i;
for (int i = 1; i < n - 1; i += 2)
x ^= encoded[i];
perm.push_back(x);
... | ALGO | 0.999987 | 4.954402 |
1d468a6b-b460-4043-8fb4-7913c8e10637 | hquang782/ctdl | dayconlientiepcotonglonnhat.cpp | #include<bits/stdc++.h>
using namespace std;
void qhd(int a[],int n){
int s=0,e=0;
for(int i=0;i<n;i++){
e=max(a[i],e+a[i]);
s=max(s,e);
}
cout<<s<<endl;
}
int main() {
int t, n,a[1000];
cin >> t;
while (t--) {
cin >> n ;
for(int i=0;i<n;i++) cin>>a[i];
... | ALGO | 0.99993 | 4.235209 |
bff120ac-dce9-414b-be72-d4fc76837147 | kmjp/procon | codeforce/501-540/511/a.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 ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZER... | ALGO | 0.999949 | 3.562173 |
d54ce53a-039e-4260-82e0-e3d11b246a80 | dimarick/urfu_lr_cpp | lr5/file3.cpp | #include <cstdio>
#include <cerrno>
#include <cstring>
using namespace std;
int main(int arc, char *argv[]) {
if (arc < 4) {
printf("Usage: %s key input output", argv[0]);
return 1;
}
auto key = argv[1];
auto keyLength = strlen(key);
auto inputName = argv[2];
auto outputName ... | ALGO | 0.999286 | 5.191269 |
bebd4b7b-4ae2-4e4a-9df1-9945d4042145 | Riverside-City-College-Computer-Science/Summer14_CSC5_46023 | md2440538/Hmwk/Gaddis_7thEd_Ch2_Prob18/main.cpp | /*
* File: main.cpp
* Author: Dr. Mark E. Lehr
* Created on June 24, 2014, 11:27 AM
*/
//System Library
#include <iostream>
using namespace std;
//User Defined Libraries
//Global Constants
//Function Prototypes
//Execution Begins Here!
int main(int argc, char** argv) {
//Declare and initialize variables... | ALGO | 0.945964 | 3.714119 |
bb2851c3-2d3a-4ccf-b4d5-f877d5be9bf9 | prnv28/LeetCode-Practice | Difficulty: Basic/LCM And GCD/lcm-and-gcd.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
int gcd(long long a, long long b){
if(a>b) swap(a,b);
if(a==0) return b;
return gcd(a,b%a);
}
vector<long long> lcmAndGcd(long long A , long long B) {
long l... | ALGO | 0.99972 | 6.090603 |
e6b8ce3a-73f7-4c4f-86c9-a759cf84c6e1 | nunesamos/rasp_crowding_estimative | opencv-master/modules/calib3d/perf/perf_affine2d.cpp | #include "perf_precomp.hpp"
#include <algorithm>
#include <functional>
namespace opencv_test
{
using namespace perf;
CV_ENUM(Method, RANSAC, LMEDS)
typedef tuple<int, double, Method, size_t> AffineParams;
typedef TestBaseWithParam<AffineParams> EstimateAffine;
#define ESTIMATE_PARAMS Combine(Values(100000, 5000, 100)... | TEST | 0.983194 | 6.990574 |
63596f80-4870-4fe5-b7c8-1eebc3a6f995 | splucs/Competitive-Programming | Leetcode/81.cpp | class Solution {
public:
int search(vector<int>& nums, int target) {
int n = nums.size();
int tail = findTail(nums);
if (tail == -1) {
for (int i = 0; i < n; i++) {
if (nums[i] == target) return true;
}
return false;
}
int ... | ALGO | 0.999996 | 6.394255 |
d1e15ccf-8a9b-4535-8f29-a41084f23de6 | iamiago/c- | DynamicProgramming/allConstruct.cpp | #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
//allConstruct with memoization
// return all the ways that the 'target' can be constructed by concatenating elements of the wordBank
vector<vector<string>> allConstruct(string target,vector<string> wordBank){
vector<vec... | ALGO | 0.999537 | 5.651702 |
e1cb2e80-6d07-425a-be06-a37bea979808 | quangan16/Luyen_Code | C++/src/DK07.cpp | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
void ptb2(int a, int b, int c){
if(a == 0){
if(b == 0 && c ==0){
cout<<"INF";
}
else if( b != 0 && c == 0){
cout<<fixed<<setprecision(2)<<0.00;
}
else if(b ==0 && c != 0){
... | ALGO | 0.999829 | 4.162264 |
134c25ef-aa85-43ef-bbb5-920b0cfc2ec4 | skieffer/adapaca | cola/libavoid/tests/tjunct.cpp | #include "libavoid/libavoid.h"
using namespace Avoid;
int main(void) {
Router *router = new Router(OrthogonalRouting);
router->setRoutingPenalty((PenaltyType)0, 50);
router->setRoutingPenalty((PenaltyType)1, 0);
router->setRoutingPenalty((PenaltyType)2, 200);
router->setRoutingPenalty((PenaltyType)3... | ALGO | 0.995004 | 5.133749 |
59e27de9-93bd-4c0a-983d-58e081899bc0 | luqmanarifin/cp | 0-unclassified/Powerit.cpp | #include <bits/stdc++.h>
using namespace std;
class Powerit {
public:
int eulertot(int a) {
int ret = 0;
for(int i = 1; i * i <= a; i++) {
if(a % i == 0) {
ret++;
if(i * i != a) {
ret++;
}
}
}
ret--; // because of 1
return a - ret;
}
long long po... | ALGO | 0.99999 | 4.683969 |
88370f2d-89c7-4cba-804c-0b7596d2d246 | untodesu/refraction | src/mathlib/almostequal.cpp | #include <float.h>
#include <math.h>
#include "mathlib/mathlib.h"
static inline bool AE_IsInfinite(float a)
{
const int kInfAsInt = 0x7F800000;
// An infinity has an exponent of 255 (shift left 23 positions) and
// a zero mantissa. There are two infinities - positive and negative.
if ((*(int*)&a & 0x... | TOOL | 0.931823 | 6.345742 |
b17e5bbe-10d4-4bea-8c0d-07dc4cbd39c4 | KUMARANKIT3012/Leetcode | DFS of Graph.cpp | class Solution {
public:
void dfsHelper(int node, vector<vector<int>>& adj, vector<int>& vis, vector<int>& result) {
vis[node] = 1; // Mark current node as visited
result.push_back(node); // Add to result
for (auto it : adj[node]) {
if (!vis[it]) {
... | ALGO | 0.999978 | 6.734335 |
17cd20a7-f23b-4988-a700-4004185462f6 | xiewende/CPlusPlus_Algorithm | dynamic-programming/six-four-seven.cpp | // 647. 回文子串
#include<iostream>
#include<vector>
#include<numeric>
using namespace std;
int countSubstrings(string s) {
int n = s.length();
vector<vector<int>> dp(n, vector<int>(n, 0));
for (int i = 0; i < n;i++)
{
dp[i][i] = 1;
}
int ans = n;
for (int i = n - 1; i >= 0;i--)
... | ALGO | 0.999914 | 6.004616 |
d5c764db-a01d-448b-b783-59ea78cd354d | naxocist/POSN-IPST | codeforces/1750A.cpp | #include <bits/stdc++.h>
using namespace std;
void solve() {
int n; cin >> n;
vector<int> v(n);
for(int i=0; i<n; ++i) cin >> v[i];
if(v[0] == 1) cout << "YES";
else cout << "NO";
cout << "\n";
}
int main() {
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int t; cin >> t;
... | ALGO | 0.99948 | 4.238635 |
afdef470-feb3-4bc9-9273-5bb52d766396 | NiclasSvensson/Kattis | 2048/main.cpp | #include <iostream>
#include <vector>
#include <string>
using namespace std;
int WIDTH = 4;
// {dir_x, dir_y, start}
vector<vector<int>> VEC = {{-1,0,0}, {0,-1,0}, {1,0,3}, {0,1,3}};
class board {
private:
vector<int> matrix;
public:
board(): matrix(WIDTH*WIDTH, 0){
int in;
... | ALGO | 0.999875 | 3.874777 |
b2c92503-c225-4bfe-8038-5ebfea95eff0 | navneetk2001/CPP_Programs | Test Series/Amazon test Series/Data Structures and Algorithms/10. Tree Questions/24. Transform to Sum Tree.cpp | https://practice.geeksforgeeks.org/problems/transform-to-sum-tree/1
//Solution Approach :-
int solve(Node *node){
if(!node){
return 0;
}
int temp = node->data;
node->data = solve(node->right) + solve(node->left);
return temp + node->data;
}
void toSumTree(Node *node){
solve(node);
}
... | ALGO | 0.999997 | 5.592958 |
d03bd338-b742-47e8-bd67-7c5ed9c98c41 | davidstone/bounded-integer | source/containers/algorithms/copy.cpp | module;
#include <operators/forward.hpp>
export module containers.algorithms.copy;
import containers.algorithms.copy_or_relocate_from;
import containers.algorithms.reverse_iterator;
import containers.array;
import containers.begin_end;
import containers.dereference;
import containers.iterator;
import containers.rang... | TOOL | 0.999349 | 7.222995 |
2e77a2c3-6341-4bf7-9aff-5523f4c83882 | Zyyxsth/autolanding | src/real_flight_modules/VINS-Fusion/vins_estimator/src/featureTracker/feature_tracker.cpp | #include "feature_tracker.h"
bool FeatureTracker::inBorder(const cv::Point2f &pt)
{
const int BORDER_SIZE = 1;
int img_x = cvRound(pt.x);
int img_y = cvRound(pt.y);
return BORDER_SIZE <= img_x && img_x < col - BORDER_SIZE && BORDER_SIZE <= img_y && img_y < row - BORDER_SIZE;
}
double distance(cv::Poin... | ALGO | 0.967059 | 5.822362 |
14293814-b621-4ce5-80da-94c3d8786a01 | ShaoZyNwpu/opengauss_backpressure | src/common/backend/utils/adt/pg_lzcompress.cpp | /* ----------
* pg_lzcompress.c -
*
* This is an implementation of LZ compression for PostgreSQL.
* It uses a simple history table and generates 2-3 byte tags
* capable of backward copy information for 3-273 bytes with
* a max offset of 4095.
*
* Entry routines:
*
* bool
* pglz_compress(const char *... | ALGO | 0.976732 | 6.745279 |
22ebcd27-2991-4563-97f6-89b683a0a899 | niteshim0/DSA | 12_Binary_Tree/03_Vertical_Traversals/16_Top_View_of_Binary_Tree.cpp | class Solution {
public:
vector<int> topView(Node *root) {
vector<int> ans;
if(root == NULL) return ans;
queue<pair<Node*,int>> q;
map<int,int> mp;
q.push({root,0});
while(!q.empty()){
Node* node = q.front().first;
int line = q.front().second... | ALGO | 0.999954 | 5.951988 |
a961e9ed-0f0b-4ed6-9801-3f198359ff5b | vbonnici/grafe-sim | analysis/data/p02256/s066691106.cpp | #include<iostream>
#include<algorithm>
using namespace std;
int main(){
int x,y,amari=1,a,ans;
cin>>x>>y;
a=min(x,y);
x=max(x,y);
y=a;
while(amari){
amari=x%y;
x=y;
y=amari;
}
cout<<x<<endl;
return 0;
} | ALGO | 0.999967 | 3.463308 |
6e5a6ea0-ef86-4ef8-823d-18bcdb35b027 | dkkim1005/Neural_Network_Quantum_State | cpu/src/CH-train_rbm.cpp | #include <chrono>
#include "../include/hamiltonians.hpp"
#include "../include/optimizer.hpp"
#include "../include/argparse.hpp"
using namespace spinhalf;
int main(int argc, char* argv[])
{
std::vector<pair_t> options, defaults;
// env; explanation of env
options.push_back(pair_t("ninput", "# of visible nodes"))... | ALGO | 0.990286 | 5.946646 |
7b0e3e84-0eb9-40a1-9c8d-44f539308145 | sur16-cse/DSA-preparation | Count pairs with given sum - GFG/count-pairs-with-given-sum.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 getPairsCount(int arr[], int n, int k) {
// code here
map<int,int>mp;
int count=0;
for(int i=0;i<... | ALGO | 0.999857 | 5.612421 |
e0ef2d29-ff78-4bf3-819d-d531804d0821 | ku-leuven-msec/not-quite-write-experiments | softbound-attack/softboundcets-llvm-clang34/lib/CodeGen/LiveVariables.cpp | #include "llvm/CodeGen/LiveVariables.h"
#include "llvm/ADT/DepthFirstIterator.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/Passes.h"
#include "llvm/Support/D... | ALGO | 0.990501 | 7.922677 |
4e5ba4b7-8aba-49fa-972e-0b2021c1e65c | HardikJainGit/LeetCode | 0039-combination-sum/0039-combination-sum.cpp | #include <bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define vvi vector<vector<int>>
#define vvvi vector<vector<vi>>
#define f(b) for(int i=0;i<b;i++)
#define fz(i,a,b) for(int i=a;i<b;i++)
#define sz(x) ((int)(x).size())
#define vp vector<pair<int,int>>
#define pi pair<int,int>
#define pb push_back
#d... | ALGO | 0.999981 | 6.20203 |
e82b2359-e304-4503-985e-d7fa9725b664 | siddhanttomar2003/CP | 1976-number-of-ways-to-arrive-at-destination/1976-number-of-ways-to-arrive-at-destination.cpp | typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
const int m=1e9+7;
class Solution {
public:
int countPaths(int n, vector<vector<int>>& roads) {
vector<vector<pair<int,int>>>adj(n);
vector<int>paths(n,0);
for(auto it:roads){
adj[it[0]].push_back({it[1]... | ALGO | 0.999961 | 5.034235 |
ff771674-c218-409c-8698-7810f4f4a91f | rayechen/ppl_cpu | src/ppl/kernel/x86/fp32/random/random_fp32.cpp | #include <random>
#include <chrono>
#include "ppl/kernel/x86/common/internal_include.h"
namespace ppl { namespace kernel { namespace x86 {
ppl::common::RetCode random_uniform_fp32(
const ppl::common::TensorShape *output_shape,
const float *seed,
const float high,
const float low,
float *output)
{... | TOOL | 0.879802 | 6.230625 |
cb5cead4-80be-45a4-9057-dde5585e426c | AakashPawanGPS/CPP-Programming | Arrays/LeadersInAnArray.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution{
public:
vector<int> leaders(int a[], int n){
vector<int> v;
int curr=a[n-1];
v.push_back(curr);
for(int i=n-2;i>=0;i--){
if(curr<=a[i]){
curr=a[i];
v.push_back(curr);
... | ALGO | 0.999959 | 4.096099 |
ec6885f2-bd84-4c0a-92b0-f58e7161b22f | pratikjadhav0908/Cpp | Swap2.cpp | #include<iostream>
using namespace std;
int main()
{
int a,b;
cout<<"Enter value of a & b :";
cin>>a>>b;
a=a+b;
b=a-b;
a=a-b;
cout<<"a="<<a;
cout<<"\nb="<<b;
}
| ALGO | 0.99679 | 3.121582 |
89d7d691-4d2c-43e5-9ead-67251015e894 | kirijuana/OOP_LAB_1 | OOP_LAB_1/boost_1_75_0/libs/yap/example/vector.cpp | #include <vector>
#include <iostream>
//[ vector_take_nth_xform
struct take_nth
{
template <typename T>
auto operator() (boost::yap::expr_tag<boost::yap::expr_kind::terminal>,
std::vector<T> const & vec)
{ return boost::yap::make_terminal(vec[n]); }
std::size_t n;
};
//]
// A sta... | TOOL | 0.91705 | 6.644027 |
ad7dcdc9-55f7-4ed6-af5a-f7f3e09a8333 | shoaib30/OS-Lab | SSTF_Scheduling.cpp | #include<iostream>
#include<cmath>
using namespace std;
struct mem
{
int ID,loc,time,flag;
}memQueue[100];
int sizes=0;
void setSeekTime(int head) {
for(int i = 0; i < sizes; i++) {
if(memQueue[i].flag == false) {
memQueue[i].time = abs(head-memQueue[i].loc);
}
}
}
int f... | ALGO | 0.999933 | 3.34395 |
5abb0763-917d-42a5-bc5a-53d6b082cb9a | leo-pss/algorithm | leetcode/858.cpp | #include <algorithm>
using namespace std;
class Solution {
public:
int gcd(int p, int q){
if(q == 0) return p;
if(p < q) swap(p, q);
return gcd(q, p%q);
}
int mirrorReflection(int p, int q) {
int r = gcd(p, q);
int p_cnt = p / r;
int q_cnt = q / r;
i... | ALGO | 0.999971 | 4.954803 |
e4d28f63-752a-4180-bc08-25d089639a24 | Debmalya24/learningCpp | array.cpp/pairSumUsingVector.cpp | #include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int PairSumUsingVector(vector<int> &v){
int x;
cout<<"X:";
cin>>x;
int paris=0;
int left_point=0;
int right_point=v.size()-1;
int pairs=0;
while(left_point<right_point)... | ALGO | 0.999815 | 5.074758 |
8c21f60e-ce71-422d-ae1c-8122fec298f9 | sarvex/leetcode-go | solution/0700-0799/0739.Daily Temperatures/Solution.cpp | class Solution {
public:
vector<int> dailyTemperatures(vector<int>& temperatures) {
int n = temperatures.size();
vector<int> ans(n);
stack<int> stk;
for (int i = 0; i < n; ++i) {
while (!stk.empty() && temperatures[stk.top()] < temperatures[i]) {
ans[stk.t... | ALGO | 0.999988 | 6.658303 |
ef7b6b72-d4be-414b-9265-601dbb79064c | Mohit-106/DSA_Level_2 | Basic/PQofString.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
priority_queue<string, vector<string>, greater<string>>pq; // print in laxical order
pq.push("abc");
pq.push("aac");
pq.push("abb");
pq.push("acc");
while(pq.size()>0){
string s = pq.top();
pq.pop();
cout<<s<<endl... | ALGO | 0.994669 | 4.616282 |
c1366704-3401-47f9-9635-2d943be8e192 | ayush678-hub/OOPS | palindrome.cpp | #include<iostream>
using namespace std;
int main(){
int n;
cout<<"ENTER THE ARRAY SIZE : ";
cin>>n;
char arr[n];
cin>>arr;
int len=sizeof(arr);
int check=1;
for(int i=0;i<n;i++){
if(arr[i]==arr[len-1]){
len--;
}
else{
check=0;
break;
}
}
if (check==1) cout<<"IT IS A... | ALGO | 0.999812 | 4.000201 |
1a1ddf5a-18e3-4ad3-a4df-099d7d499135 | FreddyJS/AdventOfCode | 2020/Day3/src/main.cpp | #include <LinkedList.hpp>
#include <iostream>
#include <fstream>
#include <string.h>
using namespace std;
int getTrees(char* argv[], int moveX, int moveY) {
ifstream clusterFile;
clusterFile.open(argv[1]);
string readed;
bool checked = false;
int n_line = 0;
int pos = 0;
int posy = 1;
int lim ... | ALGO | 0.997256 | 3.557436 |
05dd1944-b335-476b-b7cf-db1bda75ffe8 | ishandutta2007/codeforces | matthew99/normal/573/A.cpp | #include <bits/stdc++.h>
using namespace std;
#define REP(i, a, b) for (int i = (a), _end_ = (b); i < _end_; ++i)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define mp make_pair
#define x first
#define y second
#define pb push_back
#define SZ(x) (int((x).size()))
#define ALL(x) (x).begin(), (x).end()
template<t... | ALGO | 0.99999 | 3.388589 |
52c3f308-9b68-4866-a58e-d3c3dac44f60 | shaniCattan/ex4 | Graph/Algorithms/Dfs.cpp | //
// Created by shani on 1/24/20.
//
#include "Dfs.h"
namespace graph {
namespace algorithms {
std::stack<Directions> Dfs::DfsSolver::DFSUtil(MatrixGraph::Vertex vertex) {
if (!m_matrix.isVertexValid(vertex) || m_matrix.getWeight(vertex) == MatrixGraph::INFINITE_WEIGHT) {
retu... | ALGO | 0.999985 | 6.466545 |
0220d1b1-97c1-4b99-aa09-85a85e1518b8 | sarvex/leetcode-gravity | solution/2500-2599/2524.Maximum Frequency Score of a Subarray/Solution.cpp | class Solution {
public:
int maxFrequencyScore(vector<int>& nums, int k) {
unordered_map<int, int> cnt;
for (int i = 0; i < k; ++i) {
cnt[nums[i]]++;
}
long cur = 0;
const int mod = 1e9 + 7;
for (auto& [k, v] : cnt) {
cur = (cur + qmi(k, v, mod... | ALGO | 0.999994 | 6.000457 |
cac39d87-3c14-4a49-9940-76d972fa9838 | gr790/Uva | 11286/program.cpp | #include <iostream>
#include <string>
#include <fstream>
#include <map>
#include <algorithm>
#include <vector>
#include <sstream>
using namespace std;
int main()
{
ifstream infile;
infile.open("./sample.txt");
int num;
/* read no of frosh */
while(infile >> num)
{
infile.ignore();
if(!num)
break;
map< ve... | ALGO | 0.998716 | 3.998259 |
4861d80e-3454-44f6-b254-5bec0edab916 | i-kor/TestTriangles | src/triangle.cpp | #include "triangle.h"
#include <iostream>
#include <optional>
#include <limits>
#include "vector2.h"
#include "vector3.h"
bool AreIntersecting(const Triangle<Vector2, Segment2D>& first, const Triangle<Vector2, Segment2D>& second)
{
// Check if triangle is degenerate
bool isDegenerate[2] {first.IsDegenerate()... | ALGO | 0.998776 | 7.564515 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.