uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
0a1968c5-e183-421a-96a1-c0ad804ef038 | Andyson007/AOC | 2022/3/a.cpp | #include <iostream>
#include <fstream>
#include <string>
int main (int argc, char *argv[]) {
std::ifstream fin(argv[1]);
std::string line;
int score{};
while (std::getline(fin, line)) {
std::string first = line.substr(0,line.size()/2);
std::string second = line.substr(line.size()/2);
bool flag{true... | ALGO | 0.993734 | 4.90517 |
7e4a519e-228d-4434-b83b-f89f14fcaea6 | 20km-shimakaze/SthCode | code/codeforce/R/#811(div3)/B.cpp | /*
ǰɾֻҪӺǰѯֱظļ
*/
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef long long ll;
typedef pair<int,int> P;
int n,a[200005],vis[200005];
void solve()
{
cin>>n;
for(int i=1;i<=n;i++){
cin>>a[i];
vis[i]=0;
}
for(int i=n;i>=1;i--){
if(vis[a[i]]){
cou... | ALGO | 0.999814 | 4.13401 |
0d691ec1-7680-485c-b35b-4511757a25cf | Hydra-Chain/node | src/banman.cpp | #include <banman.h>
#include <netaddress.h>
#include <ui_interface.h>
#include <util/system.h>
#include <util/time.h>
BanMan::BanMan(fs::path ban_file, CClientUIInterface* client_interface, int64_t default_ban_time)
: m_client_interface(client_interface), m_ban_db(std::move(ban_file)), m_default_ban_time(default_... | TOOL | 0.880106 | 6.6842 |
16a9c44f-8914-4b0e-ab52-2cc9b90f3b11 | cjlworld/OJ | Acwing/acw#475.cpp | #include<set>
#include<map>
#include<queue>
#include<stack>
#include<ctime>
#include<cmath>
#include<bitset>
#include<vector>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
c... | ALGO | 0.999882 | 3.389922 |
164a61d0-959d-4c8e-9814-a0f05f309e91 | yuliy/sport_programming | timus/1607/main.cpp | #include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <list>
#include <algorithm>
using namespace std;
int main() {
int p1, d1, p2, d2;
cin >> p1 >> d1 >> p2 >> d2;
bool flag = true;
for (; p1 < p2; ) {
if (flag) {
p1 += d... | ALGO | 0.999886 | 3.446519 |
6ce8a55c-2543-4f9b-8ee6-5988caadc2b8 | zayim/ProgrammingIntro | AV12/AV12Z1.cpp | #include <iostream>
using namespace std;
long long fakt(long long n)
{
long long i,f=n;
for (i=2; i<n; i++) f*=i;
return f;
}
long long fakt_rekurzija(long long n)
{
if (!(n-1)) return 1;
return n*fakt_rekurzija(n-1);
}
int main()
{
long long n;
cout << "Unesi n: "; cin >> n;
cout << "F... | ALGO | 0.999903 | 4.975794 |
7778fc7b-9b00-4319-ba59-656eaef9006f | Apurba-Sarker/Competitive-Programming | CodeForces/1451B/47567111_AC_46ms_8kB.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;
const int N = 1e5 + 3;
const int K = 20;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll T123;
cin >> T123;
while(T123--){
ll n,q; cin >> n >> q;
string s; cin >> s;
for(int i=... | ALGO | 0.999524 | 3.797544 |
40a5faa9-c290-4da2-89c3-22ac2faff1d2 | dufrdigital/gigaddikcoin | src/qt/transactionfilterproxy.cpp | #include "transactionfilterproxy.h"
#include "transactionrecord.h"
#include "transactiontablemodel.h"
#include <cstdlib>
#include <QDateTime>
// Earliest date that can be represented (far in the past)
const QDateTime TransactionFilterProxy::MIN_DATE = QDateTime::fromTime_t(0);
// Last date that can be represented (... | TOOL | 0.871334 | 6.527426 |
eb6a8aa5-4829-4e85-a625-9bdc9cb51d27 | KennethYangle/CMPCC | Eigen/bench/perf_monitoring/lazy_gemm.cpp | #include <iostream>
#include <fstream>
#include <vector>
#include <Eigen/Core>
#include "../../BenchTimer.h"
using namespace Eigen;
#ifndef SCALAR
#error SCALAR must be defined
#endif
typedef SCALAR Scalar;
template <typename MatA, typename MatB, typename MatC>
EIGEN_DONT_INLINE void lazy_gemm(const MatA &A, const M... | TOOL | 0.977957 | 6.15536 |
f296f475-c85a-4b5b-b880-624d9e997d2e | sijan2006/csit | csit/Discrete_structures/lab2/program1.cpp | // WAP a program to implement x^2+1 and implement it for domain of -2 -1 0 1 2
#include <iostream>
using namespace std;
int implement(int x)
{
return (x * x + 1);
}
int main()
{
int arr[] = {-2, -1, 0, 1, 2};
int i;
for (i = 0; i < 5; i++)
{
cout << "the range is " << implement(arr[i]) << en... | ALGO | 0.998852 | 5.052296 |
e6f08a29-6a6e-409d-9e22-3ee30b61b177 | FENGBONE/OBexercise | src/observer/sql/optimizer/conjunction_simplification_rule.cpp | //
// Created by Wangyunlai on 2022/12/26.
//
#include "sql/optimizer/conjunction_simplification_rule.h"
#include "common/log/log.h"
#include "sql/expr/expression.h"
RC try_to_get_bool_constant(std::unique_ptr<Expression> &expr, bool &constant_value)
{
if (expr->type() == ExprType::VALUE && expr->value_type() == At... | ALGO | 0.999839 | 4.851355 |
23457dce-d9a0-4a56-8897-8a8cd3f85523 | jric2002/algorithms | codeforces/low_difficulty/difficulty_800/37.divisibility_problem_[1328A]/divisibility_problem.cpp | #include <iostream>
/* Author: José Rodolfo (jric2002) */
using namespace std;
int main() {
int t;
unsigned long int a, b;
unsigned int movements;
cin >> t;
unsigned long int min_movements[t];
for (int i = 0; i < t; i++) {
cin >> a;
cin >> b;
movements = 0;
if ((a % b) != 0) {
movement... | ALGO | 0.999685 | 3.829173 |
cf9be5bc-437d-4b63-9dd7-cd92aaf02682 | SMiles02/CompetitiveProgramming | Codeforces/CF 1300 - 1399/CF1328/CF1328C.cpp | #include <bits/stdc++.h>
#define ll long long
#define sz(x) (int)(x).size()
using namespace std;
int binpow(int a, int b) {
if (b == 0)
{
return 1;
}
ll res = binpow(a, b / 2);
res*=res;
if (b % 2)
{
return res * a;
}
return res;
}
ll gcd(ll a,ll b)
{
if (b==0) ... | ALGO | 0.999861 | 3.783378 |
9a1e8dc6-4edb-40d5-af3b-a48a4f58a419 | theamaan619/POMPOM | FYIT/C++/Practical Exam/Vowels.cpp | #include<iostream>
using namespace std;
class Vowel
{
public:
void V()
{
char ch;
cout<<"Enter the Characters: "<<endl;
cin>>ch;
if(ch=='A'||ch=='E'||ch=='I'||ch=='O'||ch=='U'||ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u')
{
cout<<"Characters is Vowels!"<<endl;
}
else
{
cout<<"Character is Const... | ALGO | 0.993246 | 3.739012 |
9b34f822-d034-4b82-b43b-e89a7b8b6093 | xfgt/summer-grind | Exercises/RawCPP/AlgorithmsTesting/selectionSort.cpp | #include "algorithms.h"
void selectionSort(int* a, unsigned n){
for(int i = 0; i < n-1; ++i){
int cmin = i;
for(int j = i+1; j < n; ++j){
if(a[j] < a[cmin])
cmin = j;
}
swap(a[i], a[cmin]);
}
}
| ALGO | 0.999983 | 4.605519 |
2f86458f-397a-4acc-b5a0-c7475b3fe950 | ordinary-developer/book_c_plus_plus_recipes_a_problem_solution_approach_b_sutherland | code/ch_8-THE_STL_ALGORITHMS/recipe_8.1-using_an_iterator_to_define_a_sequence_within_a_container/03-using_a_const_iterator/main.cpp | #include <cstdint>
#include <iostream>
#include <vector>
int main() {
using IntVector = std::vector<int32_t>;
using IntVectorIterator = IntVector::iterator;
using ConstIntVectorIterator = IntVector::const_iterator;
IntVector myVector(5, 0);
int32_t value{ 0 };
for (IntVectorIterator iter{ myVe... | ALGO | 0.94586 | 3.990984 |
a58edec1-e386-4e18-8ac2-7fc85164490a | TomBers/InvisibleGalleryAndroid | InvisibleGalleries/jni/SampleUtils.cpp | /*==============================================================================
Copyright (c) 2012 QUALCOMM Austria Research Center GmbH.
All Rights Reserved.
Qualcomm Confidential and Proprietary
This Vuforia(TM) sample application in source code form ("Sample Code") for the
Vufo... | TOOL | 0.876639 | 4.600229 |
053d6fae-8b08-49a7-b22c-6027245cbcda | Saiyangodgoku1/start-450 | Step-15(Dynamic Programming)/3.DP on Subsequence/09.coin_change_2.cpp | #include <vector>
using namespace std;
/*
EXAMPLE:
Input: arr = {1, 2, 3}, target = 4
Output: 4
Explanation: There are four ways to make change for the target sum:
- {1, 1, 1, 1}
- {1, 1, 2}
- {1, 3}
- {2, 2}
QUESTION:
Given an array of integers 'arr' representing coin denominations and a target sum 'target', count ... | ALGO | 0.999974 | 7.267515 |
24953bea-5865-4931-a44d-61e1f5363466 | gioh-mkv/estruturas-de-dados-em-Cpp | ListaDuplamenteLigadaSentinela.cpp | // ------------------------------------------------------------------------------------------------
// Secao 10.2 do Livro Algoritmos (de Cormen, Leiserson, Rivest, Stein)
// Implementacao de Listas Duplamente Ligadas com Sentinelas
// ------------------------------------------------------------------------------------... | ALGO | 0.999493 | 4.620268 |
40f37878-99ce-4873-9d74-b66dcf0d4c2a | vbermudez/CarND-Path-Planning-Project | src/Eigen-3.3/bench/spbench/sp_solver.cpp | // Small bench routine for Eigen available in Eigen
// (C) Desire NUENTSA WAKAM, INRIA
#include <iostream>
#include <fstream>
#include <iomanip>
#include <Eigen/Jacobi>
#include <Eigen/Householder>
#include <Eigen/IterativeLinearSolvers>
#include <Eigen/LU>
#include <unsupported/Eigen/SparseExtra>
//#include <Eigen/Sp... | ALGO | 0.991719 | 4.31638 |
c9604323-b6f1-4b8a-86e5-246999074c45 | CodeKwang/Blue-Bridge-Cup-2020-C- | 2013-C++ABC组/2013-B-04黄金连分数.cpp | #include<iostream>
#include<string>
#include<sstream>
#include<algorithm>
using namespace std;
int n=50;
void i2s(int num,string &str){
}
string add(string a,string b){
a=a.substr(a.find_first_not_of('0'));
b=b.substr(b.find_first_not_of('0'));
long long lenA=a.length();
long long lenB=b.length();
lon... | ALGO | 0.999341 | 3.833585 |
6d7131c3-3942-4106-bee0-8d6ee4b86549 | ashishverma94/6Companies30days | 1. Microsoft/1M__Evaluate_Reverse_Polish__Notation.cpp | class Solution {
public:
int evalRPN(vector<string>& tokens) {
stack<string> st ;
for ( auto i : tokens )
{
if ( i == "+" )
{
long long x = stol(st.top()) ;
st.pop() ;
long long y = stol(st.top()) ;
st.p... | ALGO | 0.999937 | 5.787157 |
c4d47eee-a05e-4fd0-97b0-022d2b09f432 | jainapal/Data_Structures_Algorithms | Heaps/MergeTwoBinaryMaxHeap.cpp | void heapify(vector<int>& ans, int ind, int n){
int largest = ind;
int left = 2*ind + 1;
int right = 2* ind + 2;
if(left < n && ans[left] > ans[largest]) largest = left;
if(right < n && ans[right] > ans[largest]) largest = right;
if(largest != ind){
swap(ans[largest]... | ALGO | 0.999982 | 4.805325 |
f5bd6efe-1948-4241-8667-fe65b593f86a | Tim-Lu-cuhksz/have-some-fun | tic tac toe/tictactoe.cpp | #include "tictactoe.h"
#include <iostream>
#include "error.h"
#include "simpio.h"
#include "console.h"
using namespace std;
/* Constants */
const char COMPUTER_MOVE = 'X';
const char HUMAN_MOVE = 'O';
const char BLANK = ' ';
const Player INITIAL_PLYAER = COMPUTER;
const int N_POS = 9;
const int DIMENSION = 3;
const i... | ALGO | 0.998872 | 6.587103 |
38136439-625d-4178-8e33-46e48ad6e0e3 | JackRao123/4plop | src/node.cpp | // node.cpp
#include "node.h"
#include <algorithm>
#include <array>
#include <cassert>
#include <iostream>
#include <thread>
#include "chancenode.h"
#include "equity_calc.h"
#include "include/phevaluator.h"
using namespace std;
// Adjust the strategy.
// action_ev is the ev of various actions, performed by player_i... | ALGO | 0.999496 | 5.355672 |
d47995bd-251b-4428-9e93-60aee76c0274 | kimdhair/git_cpp_practice | cpp_practice/cpp_9_5/cpp_9_5/vector_review.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
int input;
int index;
int num;
int result;
vector<int> v = {};
vector<int> v2 = {};
cout << " 5 ԷϽÿ ";
for (int i = 0; i < 5; i++)
{
cin >> input;
v.insert(v.begin() + i, input);
}
cout << " ũ: " << v.size() ... | ALGO | 0.999529 | 3.142403 |
a422634e-bb1b-48e4-8a76-4b2168c86b0b | yanyong666/pcl-1.10.1 | apps/src/pcd_organized_edge_detection.cpp | #include <thread>
#include <pcl/console/print.h>
#include <pcl/console/parse.h>
#include <pcl/console/time.h>
#include <pcl/features/organized_edge_detection.h>
#include <pcl/features/integral_image_normal.h>
#include <pcl/io/pcd_io.h>
#include <pcl/point_cloud.h>
#include <pcl/point_types.h>
#include <pcl/visualizati... | ALGO | 0.984721 | 6.596002 |
ab549e95-fe31-4a3f-af89-63bd4887a935 | NeBq2109/leetcode-solutions | 0205-isomorphic-strings/0205-isomorphic-strings.cpp | class Solution {
public:
bool isIsomorphic(string s, string t) {
unordered_map<char, char> mp, mp2;
for (int i = 0; i < s.size(); i++) {
if (mp[s[i]] && mp[s[i]] != t[i]) return false;
if (mp2[t[i]] && mp2[t[i]] != s[i]) return false;
mp[s[i]] = t[i];
... | ALGO | 0.999982 | 6.405875 |
2fc78fbc-9a8d-400a-9cb5-c59e8b153ff8 | luliyucoordinate/Leetcode | src/0189-Rotate-Array/0189.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
static int x = []() {std::ios::sync_with_stdio(false); cin.tie(0); return 0; }();
class Solution
{
public:
void rotate(vector<int>& nums, int k)
{
vector<int> result(nums);
for (unsigned int i = 0; i < nums.size()... | ALGO | 0.999934 | 4.842253 |
c9d915aa-c211-461f-b5d0-f1a9bd37df0b | Nakib-Arman/CSE310---Compiler | 4.ICG/antlr4-resources/antlr4-skeletons/cpp/.history/optimizer_20250721224527.cpp | #include<iostream>
#include<fstream>
#include<sstream>
using namespace std;
int main()
{
ifstream code("output/code.asm");
ofstream optcode("output/optcode.asm");
if(!code.is_open()){
cerr<<"Error opening code.asm for optimization"<<endl;
}
string prev_var="";
string prev_reg="";
s... | ALGO | 0.967425 | 3.398565 |
5c5f62df-6077-4d27-b97e-c52cf4a4e013 | Neel-29/project_cpp | OOPD PROJECT.cpp | #include<iostream>
using namespace std;
class Matrix
{
public:
int O,r,c,m,n;
int **a,**b,**d;
Matrix()
{
printf("\t\t\t\t\t\t\tMATRIX CALCULATOR\t\t\t\t\t\t\t\n");
printf("CHOOSE : \n1.Sum of matrices\n2.Subtraction of matrices\n3.Multiplication of matrices... | ALGO | 0.927023 | 3.296008 |
2b7eb813-9334-4077-ad4c-f0ba9ae1b66a | mazen-alasas/Problem-Solving | CodeForces/Groups/ICPC Assiut University Training - Standard - Juniors Phase 1/Standard #2 (binary search , stack , queue, deque , priority queue)/F - Deque.cpp | /// بِسْمِ اللَّـهِ الرَّحْمَـٰنِ الرَّحِيمِ
/** إن الله وملائكته يصلون على النبي يا أيها الذين آمنوا صلوا عليه وسلموا تسليما **/
#include <bits/stdc++.h>
#define ll long long
#define fix(n) fixed << setprecision(n)
#define T ll tests; cin >> tests; while(tests--)
#define IOS ... | ALGO | 0.9987 | 4.435718 |
9293cc3c-7c76-47da-a77b-729c11874441 | aryan57/cp-archive | local/local/uber2021-2.cpp | /*
group : local
name : uber2021-2.cpp
srcPath : /home/aryan/Desktop/cp-workspace/uber2021-2.cpp
url : /home/aryan/Desktop/cp-workspace/uber2021-2.cpp
*/
/**
* author: Aryan Agarwal
* created: 01.08.2021 00:20:23 IST
**/
#include <bits/stdc++.h>
using namespace std;
#define int long long
void solve()
{
... | ALGO | 0.999998 | 4.769023 |
555cbf72-0a6e-4e07-87a4-1d9dc14aca58 | himanshugupta09/LEETCODE_SOLUTIONS | Dynamic_Programming/coin-change-ii.cpp | class Solution {
public:
int change(int amount, vector<int>& coins) {
int N = coins.size();
int sum = amount;
int dp[N+1][sum+1];
for(int i=0;i<=N;i++)
{
dp[i][0] = 1;
}
for(int i=0;i<=sum;i++)
{
dp[0][i] = 0;
}
for(int i... | ALGO | 0.999928 | 5.787736 |
684d8879-3705-4bc7-9a57-3dcb3f0efada | Sallyeen/C-_learn | project_3/code_extent/encrypt.cpp | #include <iostream>
#include <fstream>
#include<sstream>
#include <string>
#include <vector>
#include<unordered_map>
int main(int argc, char *argv[])
{
std::string _path_book = argv[1]; //码本文件
std::string _path_code = argv[2]; //输入文件
std::string _path_en_code = argv[3]; //加密文件
std::ofstream outFi... | TOOL | 0.995898 | 3.062216 |
96e8bcf5-5e0c-4f48-8940-9462cba95528 | Mneach/Competitive-Programming-Notes | Dynamic Programming Algorithms/Basics of Recursion/power_function_fast.cpp | #include <bits/stdc++.h>
#include <bits/stdc++.h>
using namespace std;
// Power Function
// write a function to find power of a number
// both number & power are given as input!
// time complexity O(log N)
// algorithm -> binary exponential algorithm
// Logic
// if n is odd then x^n = x * (n ^ n / 2) ^ 2, why we mu... | ALGO | 0.999927 | 5.266535 |
c15e55bc-7a7a-4369-be5f-5745b2e8e994 | saptarshi-mondal-12/DSA-Revision | 3. Stack/14_Reverse_a_string.cpp | #include<iostream>
#include<stack>
using namespace std;
// Time complexity - O(n) + O(n)
// space comlexity - O(1)
string reverse(string s){
stack<char>st;
for(int i=0;i<s.length();i++){
st.push(s[i]);
}
int i=0;
while(!st.empty()){
s[i]=st.top();
st.pop();
i++;... | ALGO | 0.999775 | 5.93641 |
a9e43370-d861-4adf-955a-810f557c19a3 | scantinibudden/OCR-kNN | eigen/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_broadcast_simple_rowwise.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
int main()
{
Eigen::MatrixXf mat(2,4);
Eigen::VectorXf v(4);
mat << 1, 2, 6, 9,
3, 1, 7, 2;
v << 0,1,2,3;
//add v to each row of m
mat.rowwise() += v.transpose();
std::cout << "Broadcasting result: " << std::... | ALGO | 0.998121 | 4.26067 |
b4d8cb0a-47f4-4d6f-92cf-b3cbd44f3154 | sottorivalab/FORECAST_image_tiling | code/image_tiles/3rdparty/OpenCV-4.1.2/samples/cpp/warpPerspective_demo.cpp | /**
@file warpPerspective_demo.cpp
@brief a demo program shows how perspective transformation applied on an image
@based on a sample code http://study.marearts.com/2015/03/image-warping-using-opencv.html
@modified by Suleyman TURKMEN
*/
#include "opencv2/imgproc.hpp"
#include "opencv2/imgcodecs.hpp"
#include "opencv2/... | ALGO | 0.988191 | 6.133409 |
b14a4379-7b15-45e3-be2c-85792afaf9b2 | YanZhangRock/Union | frameworks/js-bindings/cocos2d-x/cocos/platform/winrt/sha1.cpp | #include "sha1.h"
/*
* Define the SHA1 circular left shift macro
*/
#define SHA1CircularShift(bits,word) \
(((word) << (bits)) | ((word) >> (32-(bits))))
/* Local Function Prototyptes */
void SHA1PadMessage(SHA1Context *);
void SHA1ProcessMessageBlock(SHA1Context *);
/*
* SHA1Reset
*
* Descri... | ALGO | 0.98505 | 7.007953 |
334ea180-9739-41cf-95f6-592e934dca03 | VatsBhatt11/45DaysChallengeDSA-Sheet | Arrays/Game Of Life.cpp | class Solution {
public:
int count(vector<vector<int>>& board,int r,int c)
{
int cnt=0;
for(int i=r-1;i<=r+1;i++)
{
for(int j=c-1;j<=c+1;j++)
{
if(i<0 || j<0 || i==board.size() || j==board[0].size()
|| (i==r && j==c))
... | ALGO | 0.999762 | 6.254755 |
c1390f00-02d1-4060-a043-0ff6416bf8fd | skmdJeesan/DSA-with-cpp | Linked_list/NodeClass.cpp | #include<iostream>
using namespace std;
class Node{
public:
int val;
Node* next;
Node(int val){
this->val = val;
this->next = NULL;
}
};
int main(){
// Manual creation of Linked list by static memory allocation
Node a(20);
Node b(30);
Node c(40);
Node d(50);
//L... | ALGO | 0.999498 | 4.528281 |
7ec63858-79cd-490e-8cfc-a22a7f07e024 | Fisher87/leetcode | cplus/minimum-operations-to-halve-array-sum.cpp | // Time: O(nlogn)
// Space: O(n)
// heap
class Solution {
public:
int halveArray(vector<int>& nums) {
auto target = accumulate(cbegin(nums), cend(nums), 0.0) / 2;
priority_queue<double> max_heap(cbegin(nums), cend(nums));
int result = 1;
while (!empty(max_heap)) {
doubl... | ALGO | 0.999925 | 5.985651 |
7bf9dc21-b276-432e-acd4-6d41112ffb2f | Empire843/CPPNew | Matrix7.cpp | // @author: (☞゚ヮ゚)☞ <-> ☜(゚ヮ゚☜)
#include <bits/stdc++.h>
const long long mod = 1e9 + 7;
#define input(a, n) for (int i = 0; i < n; i++) cin >> a[i]
#define reset(a) memset(a,0,sizeof(a))
#define fastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
int main(){
fastIO;
int t;
... | ALGO | 0.999897 | 3.506776 |
e4acffa7-3359-4dc3-9925-50bc6d0967fd | delgomati/OOP-Project-1 | city.cpp | //
// Created by Owner on 11/1/2022.
//
#include "city.h"
#include "distance.h"
#include <iostream>
using namespace std;
//creating class
City::City() {
name = "";
countOfDistances = 0;
}
City::City(string cityName){
name = cityName;
countOfDistances = 0;
}
//sets the city name with the coordinatin... | ALGO | 0.998653 | 4.325173 |
bd60d241-52e3-4e0b-9361-6a6c08a9fdaa | Siwas99/projektMaraton | funkcje.cpp | #include <iostream>
#include <fstream>
#include <string>
#include <sys/types.h>
#include <vector>
#include <deque>
#include <iomanip>
#include "funkcje.h"
#include "struktury.h"
#include "dirent.h"
#include "nvwa/debug_new.h"
//listowanie Katalogu i dodawanie jej elementow do dynamicznej tablicy
void listowanieKatalo... | TOOL | 0.963465 | 3.915046 |
34729fd1-a5db-456c-a01b-6d4fc523144d | Henrik-Yao/NEUQ-ACM-Solution | week6/谢海源/7-1 字符串模式匹配.cpp | #include<bits/stdc++.h>
using namespace std;
#define int long long
const int maxn=1e6+5;//字符串长度最大值为maxn
const int base=1776840;//进制
const int mod = 1e9 + 7;
char s1[maxn],s2[maxn];
int power[maxn], ha[maxn];
int get(int l,int r)
{
return (ha[r] - ha[l - 1]*power[r-l+1]%mod + mod)%mod;//求子串
}
void init()//预处理
{
pow... | ALGO | 0.999964 | 4.574013 |
cdba083b-e448-42a4-973d-47e8adf314e6 | MarcosSilva2001/Practicas_CPP | APAREO_CORTECONTOL/Apareo de Archivos/ApareoArchivo/Apareo.cpp | /*
Apareo de dos vectores o archivos. Se genera un tercer archivo o vector con los datos de los dos.
Ambos archivos deben ser del mismo tipo y estar ordenados por una misma clave de ordenamiento.
Los datos se intercalan de manera ordenada según un criterio.
*/
#include <iostream>
#include <stdio.h>
using ... | ALGO | 0.947696 | 3.940111 |
69b5c1b5-3440-44e4-8b29-b85753f18f39 | doreenvalmyr/ParallelKDTree | src/lockFree/kdTree.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include "kdTree.h"
using namespace std;
atomic<KDNode*> buildKDTreeImpl(vector<DataPoint>& data, int depth, int k) {
if (data.empty()) {
return nullptr;
}
// Choose axis based on depth for balanced tree construction
int axis = depth % k;
// S... | ALGO | 0.996779 | 7.034513 |
c9df1413-bb81-4677-b352-255eaa510541 | okaryo/CompetitiveProgramming | AtCoder/AGC/011~020/011/B.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long LL;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
int main() {
int n; cin >> n;
vector<int> a(n);
rep(i, n) cin >> a[i];
sort(all(a));
LL sum = a[0];
int ans = n;
for (int i = 1; i < n; i ++) {
... | ALGO | 0.998485 | 3.977754 |
314129a8-762d-4019-842a-57bd44429e78 | LBiff/subjects_2020 | ProjectsMaxPrifit.cpp | //项目顺序问题: 已知每个项目的花费cost_i 和其纯利润pri_i, 最大串行做的项目数k, 初始启动资金m,求最大获利
//贪心问题: 在现有资金能做的情况下选利润最高的
#include <queue>
#include <vector>
#include <cstdlib>
#include <algorithm>
using namespace std;
class Project
{
public:
uint64_t _idx; //索引
uint64_t _cost; //花费
uint64_t _profit; //纯利润
Project(uint64_t idx, uint6... | ALGO | 0.999922 | 4.705347 |
cc137b66-0c90-4613-9418-821c6ca2e47e | Soban-Abbas/DSA | bb.cpp | #include<iostream>
using namespace std;
int main(){
int arr[5]={5,4,3,2,1,};
int minimum=arr[0];
for(int i=0;i<5;i++){
if(arr[i]<minimum){
minimum=arr[i];
}
}
cout<<minimum;
} | ALGO | 0.999851 | 3.150108 |
d41ce459-8e4d-41d7-b27a-9f1e3282005a | prayag29-sahu/DSA | 2_Linkedlist/2.Dll/15_swap_f_l.cpp | #include <stdio.h>
#include <conio.h>
#include <stdlib.h>
#include <iostream>
#define null 0
using namespace std;
struct node
{
int data;
struct node *next, *prev;
};
node *first, *temp, *ttemp, *p,*q;
void init()
{
first = temp = ttemp = null;
}
void createfirst(int val)
{
first = (node *)malloc(si... | ALGO | 0.999505 | 3.637776 |
d11da0bd-0a5e-4b57-9a09-2f1bd0917b0f | adityamk43/CodeBank | DSA Self Paced/Arrays/Naive Methods/MaximumDifference.cpp | /**
* @file MaximumDifference.cpp
* @author ADITYA BHARDWAJ
* @brief
* @version 0.1
* @date 2022-09-02 05:24 PM
*
* @copyright Copyright (c) 2022
*
*/
#include <bits/stdc++.h>
using namespace std;
/*
TIME COMPLEXITY: ⊝(n^2)
*/
int maxDiff(int *arr, int n)
{
int res = arr[1] - arr[0];
for (in... | ALGO | 0.999448 | 4.943624 |
dc757600-22e5-48ec-871d-9b7b0c6b06f5 | atharvarekhawar/Leetcode_codes | 1700-minimum-time-to-make-rope-colorful/minimum-time-to-make-rope-colorful.cpp | class Solution {
public:
int minCost(string colors, vector<int>& neededTime) {
if (colors.length() == 1) {
return 0;
}
int cost = 0;
int n = neededTime.size();
char currentColor = colors[0];
int currentTime = neededTime[0];
for (int i = 1; i < n... | ALGO | 0.999719 | 6.420388 |
ec01d889-832c-4ab3-9344-e2b7be2fd550 | ibayashi-hikaru/allegro-legato | lammps/src/OPENMP/pair_lj_long_tip4p_long_omp.cpp | // clang-format off
/* ----------------------------------------------------------------------
Contributing author: Axel Kohlmeyer (Temple U)
------------------------------------------------------------------------- */
#include "pair_lj_long_tip4p_long_omp.h"
#include "atom.h"
#include "comm.h"
#include "domain.h"... | ALGO | 0.998108 | 6.094212 |
20df5cb1-3b61-44c5-b904-89de918b4c82 | asifcsai/Competitive-Programming-Problem-Solution | Vjudge - NSUPS All OJ Problem Solution/boga_and_moga_string.cpp | #include<bits/stdc++.h>
using namespace std;
#define optimize() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl '\n'
int main(void)
{
optimize();
string s1, s2;
cin >> s1;
cin >> s2;
for(int i = 0; i< max(s1.size(), s2.size()); ++i)
{
if(i < s1.size())
cou... | ALGO | 0.999247 | 3.278959 |
1c06c37f-8395-43ec-a5ff-8919463ac93f | MyNamesLex/Code-Adventures | C++/Hangman/Hangman.cpp | #include <iostream>
#include <cstdlib>
using namespace std;
//start choice string
string press;
//bools for strings
bool Gamer = false;
bool Being = false;
bool MadeWord = false;
//words
string G = "G";
string A = "A";
string M = "M";
string E = "E";
string R = "R";
//
string B = "B";
string I = "I";
string N = ... | TOOL | 0.943972 | 4.267417 |
73a8161f-df19-4d2d-a608-a34000c6ca30 | Drishti814/DSA | LinkedLists/Medium Problems On LL/findStartingNodeOfLoopInLL.cpp | #include<iostream>
#include<vector>
#include<stack>
#include<unordered_map>
using namespace std;
class Node{
public:
int data;
Node* next;
public:
Node(int data1, Node* next1){
data = data1;
next = next1;
}
public:
Node(int data1){
data = data1;
n... | ALGO | 0.999991 | 5.161733 |
cd56b722-ba3d-45d4-8ac6-58873ea5282f | yuyangh/LeetCode | 215. Kth Largest Element in an Array.cpp | #include "LeetCodeLib.h"
/*
* @lc app=leetcode id=215 lang=cpp
*
* 215. Kth Largest Element in an Array
*
* https://leetcode.com/problems/kth-largest-element-in-an-array/description/
*
* algorithms
* Medium
*
* Find the kth largest element in an unsorted array. Note that it is the kth
* largest element in t... | ALGO | 0.999808 | 5.559621 |
89b17bcc-bb81-4728-998a-48456ff39bca | JerseysGet/cses-solution-set | src/Introductory Problems/1092.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
void solve() {
int n; cin >> n;
if (n % 4 == 0) {
cout << "YES\n";
cout << n / 2 << "\n";
for (int i = 1; i <= n/4; i++) {cout << i << " ";}
for (int i = 1 + 3*(n/4); i <= n; i++) {cout << i << " ";}
cou... | ALGO | 0.999379 | 3.671045 |
1b69e597-2fba-42b7-979a-f06e8d50fbdb | AyushKUMAR031/Leetcode-Practise-CPP | Folder_To_Q0100+/Q128_longest_consecutive_sequence.cpp | class Solution {
public:
int longestConsecutive(vector<int>& nums) {
if(nums.empty()) return 0;
sort(nums.begin(), nums.end());
int lcs = 1, cs = 1;
for(int i = 1; i < nums.size(); i++) {
if(nums[i] == nums[i-1]) {
// skip duplicates
con... | ALGO | 0.999906 | 5.763494 |
c7d1b1a3-7f95-4541-8fbd-5f71ba3fd74a | SourabhNarwal/DSA | 0199-binary-tree-right-side-view/0199-binary-tree-right-side-view.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.999833 | 6.167568 |
425f5ea2-3fb2-45c7-a1bd-f4c72f71ed05 | newjinr/Competitive-Programming | alternatingSorting.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int N;
cin >> N;
int arr[N];
for (int i = 0; i < N; ++i)
cin >> arr[i];
sort(arr, arr + N);
int p1 = 0;
int p2 = N - 1;
vector<int> ans;
bool flag = true;
while (p1 < p2)
{
if (flag)
a... | ALGO | 0.99999 | 3.91987 |
286381b2-0e6c-4807-9046-1452f4e4ddf2 | sssazer/LeetcodeRecoder | 2023.07.10/16最接近的三数之和.cpp | #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
class Solution {
public:
int threeSumClosest(vector<int>& nums, int target) {
int minDiff = INT32_MAX; // 记录三数和中与target的最小差值
int result = 0;
sort(nums.begin(), nums.end(), less<int>());
for(int i = 0; i <... | ALGO | 0.999992 | 5.766918 |
c9243b5d-341d-441d-951b-0d370f55684e | prijwal/Data-Structures-and-Algorithm | Dynamic Proramming/Longest Inc Subseq/Longest Inc Subseq sol.cpp | int lengthOfLIS(vector<int>& a) {
int n=a.size();
vector<int> dp(n,1);
for(int i=1;i<n;i++)
{
for(int j=0;j<i;j++)
{
if(a[i]>a[j])
dp[i]=max(dp[i],1+dp[j]);
}
}
return *max_element(dp.begin(),dp.end());
}
| ALGO | 0.999834 | 4.709417 |
95e10011-f8a0-45fc-8968-88be0a420132 | mycielskit/Szkola-lekcje | Klasa1/Zajecia-2020.05.05/1d2b.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
ios::sync_with_stdio(0);
cin.tie(NULL);
int n; cin >> n;
do
cout << n % 2 << endl;
while(n /= 2);
return 0;
} | ALGO | 0.99997 | 3.886359 |
ae1d6e05-00f9-4787-be3c-d366ebf2ef81 | pkaiki/MAC0214 | Codeforces/Codeforces Round 909 (Div. 3)/b.cpp | #include <bits/stdc++.h>
#define int long long
using namespace std;
const int oo = 1e17;
void solve(){
int n; cin >> n;
vector<int> a(n+1, 0);
vector<int> acc(n+1, 0);
for(int i=1; i<=n; i++){
cin >> a[i];
acc[i] = acc[i-1] + a[i];
}
int max_dif = 0;
for(int k=1; k<=n; k++){
int minn = oo;... | ALGO | 0.998785 | 4.463221 |
3090bebe-ae47-4a0c-b60e-b7cab1e691ff | virgolinosoares/Crowd-SLAM | Thirdparty/g2o/g2o/core/optimization_algorithm_gauss_newton.cpp | #include "optimization_algorithm_gauss_newton.h"
#include <iostream>
#include "../stuff/timeutil.h"
#include "../stuff/macros.h"
#include "solver.h"
#include "batch_stats.h"
#include "sparse_optimizer.h"
using namespace std;
namespace g2o {
OptimizationAlgorithmGaussNewton::OptimizationAlgorithmGaussNewton(Solve... | ALGO | 0.998499 | 6.723323 |
36281944-71c0-4998-88de-b1aa40f18ae0 | Zaber30/Codeforces-Github | A_Median_of_an_Array.cpp | #include<bits/stdc++.h>
using namespace std;
using ll=long long;
int main()
{
ll t;
cin>>t;
while(t--){
ll n,i,j,k;
cin>>n;
ll a[n+2];
for(i=1;i<=n;i++){
cin>>a[i];
}
sort(a+1,a+n+1);
ll mid=(n+2-1)/2;
ll cnt=0;
for(i=mid;i<... | ALGO | 0.999735 | 4.148342 |
af667836-18d6-48a3-80ff-87c01616b74d | lianah/cbmc-cegis | src/analyses/constant_propagator.cpp | /*******************************************************************\
Module: Constant Propagation
Author: Peter Schrammel
\*******************************************************************/
//#define DEBUG
#ifdef DEBUG
#include <iostream>
#endif
#include <util/find_symbols.h>
#include <util/arith_tools.h>
#inc... | ALGO | 0.999792 | 7.122064 |
3eb0eace-6f98-4d56-b34d-77097dbb1c1e | Benjamin23115/322-turing-machine-implementation | main.cpp | #include "turing_machine.h"
#include "config_settings.h"
#include "input_strings.h"
#include <exception>
#include <string>
#include <iostream>
using namespace std;
string toLower(const std::string &str)
{
std::string result = str;
for (char &ch : result)
{
if (ch >= 'A' && ch <= 'Z')
{
... | ALGO | 0.964272 | 5.974372 |
6c04e8f3-0c02-4a36-bf93-4c8b4ea5a445 | zhouxs1023/WildMagic | LibPhysics/Intersection/Wm5ExtremalQuery3BSP.cpp | #include "Wm5PhysicsPCH.h"
#include "Wm5ExtremalQuery3BSP.h"
namespace Wm5
{
//----------------------------------------------------------------------------
template <typename Real>
ExtremalQuery3BSP<Real>::ExtremalQuery3BSP (
const ConvexPolyhedron3<Real>* polytope)
:
ExtremalQuery3<Real>(polytope)
{
/... | ALGO | 0.999254 | 4.760306 |
9f3b0ee3-e8f8-4e1e-aace-5ee7711f1d0b | shashank9aug/Leetcode_Daily_Grind | 24-swap-nodes-in-pairs/24-swap-nodes-in-pairs.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* swapPairs(L... | ALGO | 0.999989 | 5.706218 |
01bd0c4b-9d0d-428c-8b68-e7c82ba7479b | onkar-sawarna/Competitive-Programming | CodeChef_Problems/PAJAPONG.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
#ifndef ONLINE_JUDGE
freopen("Input.txt", "r", stdin);
freopen("Output.txt", "w", stdout);
#endif
int T;
cin>>T;
while(T--)
... | ALGO | 0.999811 | 3.793186 |
f957b048-11ee-4475-a57b-044775be803c | Abhinavjha07/InterviewBit | Arrays/Min_Steps_in_Infinite_Grid.cpp | int Solution::coverPoints(vector<int> &A, vector<int> &B) {
int ans = 0;
for(int i=0;i<A.size()-1;i++)
{
ans += max(abs(A[i]-A[i+1]),abs(B[i]-B[i+1]));
}
return ans;
}
| ALGO | 0.99964 | 5.270282 |
ff57474e-dc0c-4d0d-ade4-495db91424c4 | nmessa/CPlusPlus---2024 | Lab Exercise 4.19.2024/Integral/Integral/main.cpp | //Lab Exercise 4.19.2024 Problem 2
//Author:
#include <iostream>
using namespace std;
int main()
{
//Add code here
return 0;
}
/* Output
Enter the time of the upper limit: 3
Enter the time of the lower limit: 1
Enter the number of integration steps: 1000
The value of the integral is 86.7667
*/
| ALGO | 0.999715 | 3.986104 |
48a3c126-1abb-40b4-b81f-c7e7f5e85f9a | logand9497/Project-3-MLB-Hitters | MERGESORT.cpp | #include <iostream>
#include "MERGESORT.h"
#include <string>
#include <vector>
#include <cmath>
#include <fstream>
#include <sstream>
using namespace std;
/* void readCSV(vector<pair<string, double>>& rVal, string fileNAME){ // reading file
string fileN = fileNAME; // file name
ifstream file(fileN); //... | ALGO | 0.997686 | 4.460142 |
d8f61bfb-a9d9-4e9d-bdba-1ff01ac8d4eb | columbia-university-robotics/vehicle-machine-learning | src/pid/src/autotune.cpp | /***************************************************************************/
// Use the Ziegler Nichols Method to calculate reasonable PID gains.
// The ZN Method is based on setting Ki & Kd to zero, then cranking up Kp until
// oscillations are observed.
// This node varies Kp through a range until oscillations are... | ALGO | 0.996775 | 5.837752 |
a399f5bf-48b4-47d3-acf8-e5c7e1ca1154 | roytam1/UXP | intl/icu/source/i18n/sortkey.cpp | //===============================================================================
//
// File sortkey.cpp
//
//
//
// Created by: Helena Shih
//
// Modification History:
//
// Date Name Description
//
// 6/20/97 helena Java class name change.
// 6/23/97 helena Added comments t... | TOOL | 0.987407 | 6.226934 |
c756ea37-b891-4149-a2a7-459023a4a9bd | Oriburger/problem_solving_1w3solve | BOJ/14645_와이버스부릉부릉.cpp | #include <iostream>
using namespace std;
int main()
{
int n, k;
cin>>n>>k;
for(int i=0; i<n; i++)
{
int a, b;
cin>>a>>b;
}
cout<<"비와이\n";
return 0;
}
| ALGO | 0.998685 | 3.401396 |
66da2d05-d83e-4c4d-a5eb-232090b80e3b | icegeiser/bigtreetech-1.4 | Marlin/src/libs/heatshrink/heatshrink_decoder.cpp | #include "../../inc/MarlinConfigPre.h"
#if ENABLED(BINARY_FILE_TRANSFER)
/**
* libs/heatshrink/heatshrink_decoder.cpp
*/
#include "heatshrink_decoder.h"
#include <stdlib.h>
#include <string.h>
#pragma GCC optimize ("O3")
/* States for the polling state machine. */
typedef enum {
HSDS_TAG_BIT, /* ... | ALGO | 0.920021 | 4.962111 |
257fef9d-c0ae-426d-876e-80d241f31e15 | LouisNguyen25/NGCP_Software_2021_2022 | opencv-master/samples/cpp/tutorial_code/core/discrete_fourier_transform/discrete_fourier_transform.cpp | #include "opencv2/core.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/imgcodecs.hpp"
#include "opencv2/highgui.hpp"
#include <iostream>
using namespace cv;
using namespace std;
static void help(char ** argv)
{
cout << endl
<< "This program demonstrated the use of the discrete Fourier transform (D... | ALGO | 0.994761 | 6.214012 |
08eda561-bf62-43bf-b7f4-ff47db297c31 | Meteor0223/2023aaia2 | week17/week17-2.cpp | ///week17-2.cpp ܱƧǪk Selection Sort
#include <stdio.h>
void myPrint(int a[10]){
for(int i=0;i<10;i++){
printf("%d ",a[i]);
}
printf("\n");
}
int main(){
int a[10]={9,8,7,6,5,4,3,2,1,0};
myPrint(a);
for(int i=0;i<10;i++){
for(int j=i+1;j<10;j++){
if(a[i]>a[j]){
... | ALGO | 0.999833 | 3.707406 |
b3837102-f852-43fa-bad7-97bf4d13d24a | MarioAntelo/Practica-DVD | practica2/mario 2015-1016/M-back.cpp | #include <stdio.h>
#include <string.h>
#include <iostream>
#include <vector>
using namespace std;
class Simbolo
{
private:
vector<int> simbolo;
public:
vector<int> getSimbolo()const {return simbolo;};
void addSegmento(int seg){simbolo.push_back(seg);};
int getSegmento(int pos){return simbolo[pos];};
vo... | ALGO | 0.999844 | 4.477849 |
0f56a74d-f5b2-444a-8645-249e59af2c71 | PeterJSims/DSandACPP | src/ch7/exercises/creativity/ch7_20.cpp | //
// Created by Peter Sims on 1/29/25.
//
#include <print>
#include <stack>
int main() {
std::stack<int> r;
std::stack<int> s;
std::stack<int> t;
for (int i{1}; i < 10; ++i) {
if (i < 4) {
r.push(i);
} else if (i > 5) {
t.push(i);
} else {
... | ALGO | 0.994744 | 5.845051 |
ad0331c5-05ef-4b89-bac1-31a0bd1e588b | JulyJohn/LeetCodeInCPlus | dynamic_programming/Max_Common_SubString.cpp | //
// Created by yzjhh on 2019/3/14.
//
/**
*
* 最长公共子序列
*
* note:
*
* dp[i][j] = dp[i-1][j-1] + 1, str1[i] == str[j]
* dp[i][j] = 0, str1[i] != str[j]
*
* */
#include <iostream>
#include <string>
#include <vector>
using namespace std;
class Solution {
public:
int maxCommonSubstring(string str1, string ... | ALGO | 0.999922 | 5.568414 |
d9f8f592-f0c6-4b91-b413-bbeeb10a59b1 | boundarydevices/frameworks_av | media/libstagefright/codecs/m4v_h263/dec/src/pp_semaphore_luma.cpp | /*
------------------------------------------------------------------------------
INPUT AND OUTPUT DEFINITIONS
Inputs:
xpred = x-axis coordinate of the MB used for prediction (int)
ypred = y-axis coordinate of the MB used for prediction (int)
pp_dec_y = pointer to the post processing semaphore for curren... | ALGO | 0.999655 | 6.601039 |
3cb22faa-f974-404e-8442-218c331e21a0 | AcaiHi/Sunny | D_Coprime.cpp | #include<iostream>
#include<map>
using namespace std;
using ll = long long;
ll gcd(ll x, ll y){
return y ? gcd(y, x % y) : x;
}
int main(){
ll t; cin >> t;
while (t--){
ll n; cin >> n;
map<ll, ll> m;
for (ll i = 1, x; i <= n; i++){
cin >> x;
m[x] = i;
... | ALGO | 0.999804 | 3.550504 |
05ac7de0-b2ea-4cff-b36f-064a689fcb42 | sparsh9/DSA_Practice | 450_DSA_Sheet/Random/minimum_steps_toA_destination.cpp | // Approach : Recursion
class Solution{
public:
int helper(int source, int steps, int d){
if(source == d) return steps;
if(abs(source) > d) return INT_MAX;
// towards left side in the number line
int left = helper(source - steps - 1, steps + 1, d);
// towards right side in ... | ALGO | 0.99998 | 5.743736 |
b158c058-0458-4b73-854a-08ec86baedf1 | ishandutta2007/codeforces | icecuber/normal/1204/E.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int nax = 4e3+10;
ll fac[nax], ifac[nax], inv[nax];
ll mod = 998244853;
ll ncr(int n, int k) {
if (n < 0 || k < 0 || k > n) return 0;
return fac[n]*ifac[k]%mod*ifac[n-k]%mod;
}
int main() {
ios::sync_with_stdio(0); cin.tie(0);
fac[0] =... | ALGO | 0.999994 | 4.960078 |
0a7b6f46-5515-445d-8ac1-bc82bc94ba36 | ThiagoFBastos/programacao-competitiva | beecrowd/2068 - Marcando um Encontro.cpp | #include "bits/stdc++.h"
using namespace std;
using i64 = long long;
using u64 = unsigned long long;
using i32 = int;
using u32 = unsigned;
using i16 = short;
using u16 = unsigned short;
using ld = long double;
using ii = pair<int, int>;
std::mt19937 rnd(chrono::system_clock::now().time_since_epoch().count());
void... | ALGO | 0.999845 | 4.756659 |
59e45ba6-dd1f-4147-bd13-14097fb02003 | VR-Blackbird/cpp | Basics/declareandinitialise.cpp | #include <iostream>
using namespace std;
double volume()
{
// Your code will go below this line
double width{10.0};
double length{20.1};
double height{4.5};
// Your code will go above this line
return width * length * height;
}
int main()
{
double volume_of_cuboid = volume();
cout <<... | TOOL | 0.893317 | 3.472063 |
170d686c-6e9f-4116-81ab-1c0ec26f751f | joan12222/algorithme | luogu/luogu-P1004.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
int n,a[15][15]={0},f[25][15][15]={0};
int main(){
cin>>n;
int x,y,z;
while(cin>>x>>y>>z&&(x!=0||y!=0||z!=0)) a[x][y]=z;
f[0][1][1]=a[1][1];
for(int i=1;i<=2*n-2;i++){
for(int xone=1;xone<=n;xone++){
for(int xtwo=1;xtwo<=n;xtwo++){
int yo... | ALGO | 0.999829 | 3.511707 |
c46bff89-5cdd-49aa-b8ad-1b88a1347374 | magnetcoindev/MagnetCoin | src/miner.cpp | #include "txdb.h"
#include "miner.h"
#include "kernel.h"
using namespace std;
//////////////////////////////////////////////////////////////////////////////
//
// BitcoinMiner
//
extern unsigned int nMinerSleep;
int static FormatHashBlocks(void* pbuffer, unsigned int len)
{
unsigned char* pdata = (unsigned char... | ALGO | 0.998623 | 4.293184 |
24d312a5-5f10-41b2-afa0-10acea1fa141 | eyangch/competitive-programming | Codeforces/1615/d.cpp | #include <bits/stdc++.h>
#define endl '\n'
#define eat cin
#define moo cout
#define int long long
#define fi first
#define se second
using namespace std;
int T, N, M, X[200000], Y[200000], V[200000], aV[200000], A[200000], B[200000], P[200000], r[200000];
vector<pair<int, int>> graph[200000];
bool sad;
void dfs(int ... | ALGO | 0.999811 | 4.466021 |
f38f8b9f-8540-4549-9e51-2c054bda8973 | ysk24ok/leetcode-submissions | leetcode/tree.cpp | #include <queue>
#include <sstream>
#include "tree.hpp"
namespace LeetCode {
TreeNode* CreateTreeNode(const std::string& str) {
std::istringstream iss(str);
std::string s;
if (!(iss >> s)) {
return nullptr;
}
TreeNode* root = new TreeNode(std::stoi(s));
std::queue<TreeNode*> q;
q.push(root);
whil... | ALGO | 0.984899 | 5.581506 |
725e800b-071b-4d32-ba0a-6b72d41a3716 | Tarequl-islam/Programming-competition | URI Solutions/uri1113.cpp | #include<iostream>
using namespace std;
int main(){
for(int j=1; j<=1000; j++){
int a, b;
cin>>a>>b;
if(a==0 || b==0){
break;
}
else if(a>0 && b>0){
cout<<"primeiro"<<endl;
}
else if(a>0 && b<0){
cout<<"quarto"<<endl;
... | ALGO | 0.999929 | 3.456068 |
238b57f2-0c84-4a64-8bfb-a6a950b7f75a | redital/ConvessizzazionePoliedri | gedim/src/core/IO/Output.cpp | #include "Output.hpp"
#include "MacroDefinitions.hpp"
#include "ParallelEnvironment.hpp"
#include "UnitTestSummary.hpp"
#include <sys/stat.h>
#include <sys/types.h>
#include <cstdlib>
#include <cstring>
#include <string>
#include <iostream>
#include <sstream>
#include <limits>
#include <dirent.h>
#ifdef _WIN32
#inclu... | TOOL | 0.858833 | 5.227898 |
8fdad24c-20a3-4137-a60e-69625da640cf | anurag-kqi/MI-7-systems | personal/Aishwarya/CPP/search_sort/heap.cpp | #include <iostream>
using namespace std;
void MaxHeapify(int heap[], int i, int n) {
int j, temp;
temp = heap[i];
j = 2*i;
while (j <= n) {
if (j < n && heap[j+1] > heap[j])
j = j+1;
if (temp > heap[j])
break;
else if (temp <= heap[j]) {
heap[j/2] = heap[j];
j = 2*j;
}
}
heap[j/2] = temp;... | ALGO | 0.999947 | 4.339559 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.