uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
a8cb9704-b999-432b-ad31-a6d8765e9275 | Vishal-Agarwal12/Competitive-programming-codes | 1921B.cpp | #include <bits/stdc++.h>
using namespace std;
#ifndef ONLINE_JUDGE
#include "debug.h"
#endif
using ll = long long;
using maxheap = priority_queue<ll>; // maxheap
using minheap = priority_queue<ll, vector<ll>, greater<ll>>; // minheap
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#defi... | ALGO | 0.999974 | 5.875688 |
b91aad61-443d-4b37-b8de-b95393dfda55 | sk10salman/placement | stackfile.cpp | #include <cmath>
#include <cstdio>
#include <stdio.h>
#include <vector>
#include <iostream>
#include<bits/stdc++.h>
#include <algorithm>
using namespace std;
int size;
int main()
{
string s="";
int n;
cin>>n;
for(int i=0;i<n;i++)
{
int ch;
cout<<"1.append - Appen... | ALGO | 0.972914 | 3.816145 |
2b0c67d6-32e3-4928-86bf-d214dc70b50a | adityaarya1067/6companies30days | Microsoft/min-cost.cpp | class Solution {
private:
static constexpr int CHAR_COUNT = 26;
static constexpr int INF = 1e9;
std::vector<std::vector<int>> buildConversionGraph(const std::vector<char>& original, const std::vector<char>& changed, const std::vector<int>& cost) {
std::vector<std::vector<int>> graph(CHAR_COUNT, std... | ALGO | 0.999944 | 6.298429 |
56eac338-45bb-44a0-845e-99119b2e7435 | KaranNasa/Placement | Binary subarray with sum - GFG/binary-subarray-with-sum.cpp | //{ Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution{
public:
int numberOfSubarrays(vector<int>& arr, int N, int target){
// code here
unordered_map<int,int> m;
int curr_sum=0;
int count=0;
for(int i=0;i... | ALGO | 0.99985 | 6.212933 |
8a75e4d0-c739-4c36-8002-d6919bfbc961 | itlezy/eMule-mods-archive | eMule-0.50a-ZZUL-TRA_2.6_Src/cryptopp/cmac.cpp | // cmac.cpp - written and placed in the public domain by Wei Dai
#include "pch.h"
#ifndef CRYPTOPP_IMPORTS
#include "cmac.h"
NAMESPACE_BEGIN(CryptoPP)
static void MulU(byte *k, unsigned int length)
{
byte carry = 0;
for (int i=length-1; i>=1; i-=2)
{
byte carry2 = k[i] >> 7;
k[i] += k[i] + carry;
carry =... | ALGO | 0.919522 | 7.689518 |
e51c30b4-cbeb-4b9f-8c87-14415ccd6bcf | pombredanne/sf.net-brlcad | src/other/openNURBS/opennurbs_polycurve.cpp | /* $NoKeywords: $ */
#include "opennurbs.h"
ON_OBJECT_IMPLEMENT(ON_PolyCurve,ON_Curve,"4ED7D4E0-E947-11d3-BFE5-0010830122F0");
ON_PolyCurve::ON_PolyCurve()
{
}
ON_PolyCurve::ON_PolyCurve( int capacity )
: m_segment(capacity), m_t(capacity+1)
{
m_segment.Zero();
}
ON_PolyCurve::ON_PolyCurve( const O... | TOOL | 0.923646 | 7.745488 |
c8198f21-6d06-4a17-b5e4-c793db21d8f7 | acidtech/Dolphin-MMJR | Externals/FreeSurround/source/KissFFT.cpp | #include "FreeSurround/_KissFFTGuts.h"
/* The guts header contains all the multiplication and addition macros that are
defined for
fixed or floating point complex numbers. It also delares the kf_ internal
functions.
*/
static void kf_bfly2(kiss_fft_cpx *Fout, const size_t fstride,
const kiss_... | ALGO | 0.999412 | 5.324813 |
5536c669-0807-40b1-a7e9-8ab74ad286e8 | BilalBashirDEV/Logic-building-for-absolute-beginner-programmers-in-Cpp | sum of pr.cpp | #include <iostream>
using namespace std;
int main(){
int x,y,z,i,j=0;
cout<<"enter a number"<<endl; //this program will add prime numbers upto x
cin>>x;
z=0;
for(i=2;i<x;i++)
{
for(y=2;y<i;y++)
{
if(i%y == 0)
{
j++;
}}
if (j==0){
z=z+y;
}
else{
j=0;
}
}
cout<<z;
return... | ALGO | 0.999793 | 3.732203 |
91319829-1aeb-40f6-89e1-b7a5a5acafe6 | ishandutta2007/codeforces | he_ren/normal/1335/B.cpp | #include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
void solve(void)
{
int n,a,b;
scanf("%d%d%d",&n,&a,&b);
for(int i=1,j=1; i<=n; ++i,++j)
{
if(j>a) j=1;
if(j<b) putchar('a'+j-1);
else putchar('z');
}
putchar('\n');
}
int main(void)
{
int T;
scanf("%d",&T);
while(T--) sol... | ALGO | 0.998317 | 3.542227 |
70acefcd-3585-4bde-8de7-0aeb21c2c857 | PabloLandro/competitive-programming | AceptaElReto/AdaByron/final-2020/multiplos.cpp | #include <bits/stdc++.h>
using namespace std; // Tipos
#define ll long long // 64 bits INT
#define ld long double // 80 bits FP
// Constantes
#define PI 3.1415926535897932384626433832795l
const int MAX_N = 1e5 + 5; // Valor de numero máximo de casos genérico
const ll MOD = 1e9 + 7; // Para outputs grandes, a ve... | ALGO | 0.999788 | 4.281552 |
1a482abd-398a-4d04-aa18-fbce21a49304 | nxplatform/nx-mobile | thirdparty-cpp/boost_1_62_0/libs/graph/example/adjacency_list.cpp | #include <boost/graph/adjacency_list.hpp>
#include <boost/graph/graph_utility.hpp>
#include <boost/property_map/property_map.hpp>
/*
Sample Output
graph name: foo
0 --joe--> 1
1 --joe--> 0 --curly--> 2 --dick--> 3
2 --curly--> 1 --tom--> 4
3 --dick--> 1 --harry--> 4
4 --tom--> 2 -... | ALGO | 0.980724 | 6.19313 |
f4f90d3d-3901-488e-a433-550960e7b574 | rmrychecky/CSCI2270 | PracticeMidterm1/LL.cpp | #include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
#include <sstream>
#include <cmath>
using namespace std;
#include "LL.h"
LL ::LL () {
head = nullptr;
tail = nullptr;
}
LL :: ~LL(){
Node *tmp, *current = head; //you start at the head and then delete and then point to the next until t... | ALGO | 0.997524 | 3.416055 |
69a840d1-1ad6-41a9-9e88-aa73cb13f76f | CQUzst/LeetCode | CPP/leetcode 89 格雷编码.cpp | class Solution {
public:
vector<int> grayCode(int n) {
//方法一:递归,会超时
//方法二:自底向上,递归改循环
// vector<int> res;
// if(n == 0 || n ==1){
// for(int i =0;i<=n;i++)
// res.push_back(i);
// return res;
// }
// res.push_back(0);
// ... | ALGO | 0.999973 | 5.753459 |
9c2d9461-550c-463b-a5f8-ed04ffeee494 | Grremily/Robot-transporting | workspace/src/van_loading/libs/mrpt/libs/maps/src/maps/CHeightGridMap2D_MRF.cpp | #include "maps-precomp.h" // Precomp header
#include <mrpt/maps/CHeightGridMap2D_MRF.h>
#include <mrpt/poses/CPose2D.h>
#include <mrpt/poses/CPose3D.h>
using namespace mrpt;
using namespace mrpt::maps;
using namespace mrpt::obs;
using namespace mrpt::poses;
using namespace std;
using namespace mrpt::math;
// =====... | TOOL | 0.895843 | 7.658539 |
528fc073-0309-4b95-a612-1b0cd5e0b413 | rodrigoext/ParallelSOM | SOM/eigen/doc/examples/class_VectorBlock.cpp | #include <Eigen/Core>
#include <iostream>
using namespace Eigen;
using namespace std;
template<typename Derived>
Eigen::VectorBlock<Derived>
segmentFromRange(MatrixBase<Derived>& v, int start, int end)
{
return Eigen::VectorBlock<Derived>(v.derived(), start, end-start);
}
template<typename Derived>
const Eigen::Vec... | TOOL | 0.988037 | 4.383477 |
31e10194-7bf1-44ab-9411-92d3f99c7d59 | ajitsoni05/leetcode | 530-minimum-absolute-difference-in-bst/minimum-absolute-difference-in-bst.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.999963 | 6.427952 |
2a6f4ffd-7b7d-4779-8e75-0d3e11012fab | cjm571/Mu-Man | lib/boost_1_55_0/libs/numeric/ublas/doc/samples/vector_binary_outer.cpp | #include <boost/numeric/ublas/matrix.hpp>
#include <boost/numeric/ublas/io.hpp>
int main () {
using namespace boost::numeric::ublas;
vector<double> v1 (3), v2 (3);
for (unsigned i = 0; i < (std::min) (v1.size (), v2.size ()); ++ i)
v1 (i) = v2 (i) = i;
std::cout << outer_prod (v1, v2) << std::... | ALGO | 0.997693 | 3.956377 |
e89c9ec2-5ce0-4b3f-9579-69a641443c0d | m5stack/StackFlow | projects/llm_framework/main_tts/src/runner/eigen-3.4.0/unsupported/test/NumericalDiff.cpp | #include <stdio.h>
#include "main.h"
#include <unsupported/Eigen/NumericalDiff>
// Generic functor
template<typename _Scalar, int NX=Dynamic, int NY=Dynamic>
struct Functor
{
typedef _Scalar Scalar;
enum {
InputsAtCompileTime = NX,
ValuesAtCompileTime = NY
};
typedef Matrix<Scalar,InputsAtCompileT... | TEST | 0.975477 | 6.171012 |
f7bf90ff-f69e-4884-a558-abdd7808136b | hu9700/cpp_stl | container/vector/vector_iterator.cpp | #include <iostream>
#include <vector>
int main(void)
{
std::vector<int> g1;
for (int i = 1; i <= 5; i++)
g1.push_back(i);
std::cout << "Output of begin and end: ";
for (auto i = g1.begin(); i != g1.end(); ++i)
std::cout << *i << " ";
std::cout << "\nOutput of cbegin and cend: "... | TOOL | 0.868282 | 4.046772 |
cd2b6bc1-e4f6-49f5-9845-26795c7adc11 | tak-ka3/rvv-llvm-project | mlir/lib/Analysis/Presburger/Utils.cpp | #include "mlir/Analysis/Presburger/Utils.h"
#include "mlir/Analysis/Presburger/IntegerPolyhedron.h"
#include "mlir/Support/LogicalResult.h"
#include "mlir/Support/MathExtras.h"
using namespace mlir;
using namespace presburger_utils;
/// Normalize a division's `dividend` and the `divisor` by their GCD. For
/// example... | ALGO | 0.988024 | 6.904789 |
5c5de509-4e69-4c36-a048-6ada03dc7604 | koba-e964/contest | atcoder/cf16-final/c.cpp | #include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include ... | ALGO | 0.999953 | 3.970344 |
604ccbcd-b2ec-4aae-95e2-694127d1077a | MC0803/coding | erpme/insertion.cpp | #include<iostream>
#include<algorithm>
using namespace std;
int main(){
int arr[]={12,3,45,55,7};
int n,i,j,key;
n=sizeof(arr)/sizeof(arr[0]);
for(i=1;i<n;i++){
key=arr[i];
j=i-1;
while(j>=0 && arr[j]>key){
swap(arr[j+1],arr[j]);
j--;
key=arr[j+1];
}
}
fo... | ALGO | 0.999982 | 3.526441 |
7c5fd63d-6055-4980-bdc8-176b7e4e1e9c | x-brymo/store_web_flutter | 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 |
1be8a115-6b1d-4236-9571-c5bc83943a41 | suhaas02/Data-structures-and-algorithms | 1039-find-the-town-judge/find-the-town-judge.cpp | class Solution {
public:
int findJudge(int n, vector<vector<int>>& trust) {
// int n = trust.size();
vector<pair<int,int>> judge(n + 1);
for(int i = 0; i < trust.size();i++)
{
judge[trust[i][0]].first++;
judge[trust[i][1]].second++;
}
for(int i... | ALGO | 0.999938 | 5.187238 |
b5453558-6c97-4257-a66a-0e112d426e06 | knerd1/Cpp_Practice | Data-Structure/Basics/armStrongNumber.cpp | #include <iostream>
using namespace std;
bool armstrong(int n) {
int dup = n;
long long sum = 0;
while (n > 0) {
int ld = n % 10;
sum = sum + (ld * ld * ld);
n = n / 10;
}
return sum == dup;
}
int main() {
int n;
cin >> n;
if (armstrong(n)) {
cout << "yes";
} else {
cout << "no"... | ALGO | 0.999979 | 5.302026 |
30fba599-eb6f-4dd6-a1f1-ad6c7e5c8f2a | NewMNSavings/NewMNSCoin | src/qt/transactionrecord.cpp | #include "transactionrecord.h"
#include "base58.h"
#include "timedata.h"
#include "wallet/wallet.h"
#include "main.h"
#include <algorithm>
#include <stdint.h>
std::string TransactionRecord::getValueOrReturnEmpty(const std::map<std::string, std::string>& mapValue, const std::string& key)
{
const auto& it = mapVal... | TOOL | 0.864257 | 5.442916 |
9c80c0e0-3742-4d14-bc25-23bffaa61f45 | GeekNoTime/-django-epic- | src/zerocoin/Accumulator.cpp |
/**
* @file Accumulator.cpp
*
* @brief Accumulator and AccumulatorWitness classes for the Zerocoin library.
*
* @author Ian Miers, Christina Garman and Matthew Green
* @date June 2013
*
* @copyright Copyright 2013 Ian Miers, Christina Garman and Matthew Green
* @license This project i... | TOOL | 0.91686 | 6.519381 |
d4308582-46f2-4f67-865c-def6dd69c1c0 | kore207/algorithm | sugar.cpp | <<<<<<< HEAD
#include <iostream>
using namespace std;
int main(void)
{
int n;
cin >> n;
for (int i = n; i > 0; n++)
{
for (int k = 0; k < n ; n++)
{
cout << " ";
}
for (int k = 1; k > i+1 ; n++)
{
cout << "*";
}
cout << endl;
}
return 0;
}
//5
//4 1
//3 2
//2 3
//1 4
//5 0
=======
#include... | ALGO | 0.999956 | 4.579647 |
bbd70a90-9a0f-4279-a129-54172f146699 | zhaosiwen1949/GAMES202_homework | homework2/prt/ext/eigen/unsupported/doc/examples/MatrixSinh.cpp | #include <unsupported/Eigen/MatrixFunctions>
#include <iostream>
using namespace Eigen;
int main()
{
MatrixXf A = MatrixXf::Random(3,3);
std::cout << "A = \n" << A << "\n\n";
MatrixXf sinhA = A.sinh();
std::cout << "sinh(A) = \n" << sinhA << "\n\n";
MatrixXf coshA = A.cosh();
std::cout << "cosh(A) = \n"... | ALGO | 0.989611 | 5.914005 |
eb8eb562-1722-4f2d-b28b-b693d20367fa | sarvex/leetcode-solidity | solution/2400-2499/2429.Minimize XOR/Solution.cpp | class Solution {
public:
int minimizeXor(int num1, int num2) {
int cnt1 = __builtin_popcount(num1);
int cnt2 = __builtin_popcount(num2);
for (; cnt1 > cnt2; --cnt1) {
num1 &= (num1 - 1);
}
for (; cnt1 < cnt2; ++cnt1) {
num1 |= (num1 + 1);
}
... | ALGO | 0.999992 | 5.902061 |
5462db9e-c7a3-4367-a468-eb896324b531 | coldsteelpope/baekjoon | QueueUsing2Stacks/main.cpp | #include <iostream>
#include <stack>
using namespace std;
class Queue
{
public:
void Enqueue(int n)
{
stack_one.push(n);
}
int Dequeue()
{
if (stack_two.size() == 0)
{
int stack_one_size = stack_one.size();
for (int i = 0; i < stack_one_size; ++i)
{
stack_two.push(stack_one.top());
stack_... | ALGO | 0.999678 | 5.018045 |
ef81a73f-6e81-4059-85b9-2356260412cf | ChocoRolis/Escuela-ITC | projectEuler/13_large_sum.cpp | #include <iostream>
#include <fstream>
#include <string>
using namespace std;
inline int char_a_int(char num)
{
return (int) num - '0';
}
int main()
{
ifstream entrada;
string lineas[100], resultado = "";
int temp;
entrada.open("large_sum.txt");
for (int i = 0; i < 100; ++i)
{
entrada >> l... | ALGO | 0.999157 | 3.966321 |
3033fd24-53c0-468e-9af0-0c4ba81ef8f1 | robotmoose/hardware | obsolete/stunserver/common/fasthash.cpp | #include "commonincludes.hpp"
#define IS_DIVISIBLE_BY(x, y) ((x % y)==0)
static unsigned int FindPrime(unsigned int val)
{
unsigned int result = val;
bool fPrime = false;
if (val <= 2)
{
return 2;
}
if (val == 3)
{
return 3;
}
if ((result % 2)==0)
... | ALGO | 0.99238 | 5.117496 |
5ed620c4-891d-41ad-9e20-b1ba6d2914c3 | wootguy/SevenKewp | game_shared/bot/bot_manager.cpp | // Author: Michael S. Booth (<EMAIL>), 2003
#pragma warning( disable : 4530 ) // STL uses exceptions, but we are not compiling with them - ignore warning
#define DEFINE_EVENT_NAMES
#include "extdll.h"
#include "util.h"
#include "cbase.h"
#include "weapons.h"
#include "soundent.h"
#include "gamerules.h"
#include ... | TOOL | 0.917428 | 5.473881 |
65753fa5-4044-48aa-9bad-786b9e11b2aa | Starry0/ACM | 计蒜客/ACM Southeastern Europe Regional Contest 2016/i.cpp | #include <bits/stdc++.h>
#define ll long long
#define INF 0x3f3f3f3f
using namespace std;
int n;
map<int,int> mp, mp1, mp2;
int main() {
for(int i = 1; i <= 355; i ++) mp2[i*i*i] = i;
cin >> n;
queue<int> que;
que.push(0);
mp[0] = 0, mp[n] = INF;
while(!que.empty()) {
int v = que.front();que.pop();
if(v >= n... | ALGO | 0.999982 | 3.324547 |
f0414f76-f971-4012-aa4d-7e76881f4a4d | cgogn/CGoGN_3 | cgogn/simulation/algos/shallow_water/riemann_solver.cpp | #include <cgogn/simulation/algos/shallow_water/riemann_solver.h>
namespace cgogn
{
namespace simulation
{
namespace shallow_water
{
Str_Riemann_Flux Solv_HLLC(Scalar g, Scalar hmin, Scalar smalll, Scalar zbL, Scalar zbR, Scalar PhiL, Scalar PhiR,
Scalar hL, Scalar qL, Scalar rL, Scalar hR, Scalar qR, Scala... | ALGO | 0.999947 | 4.883744 |
bb46c316-2d91-42d0-9fcf-094c64d6814b | quanglinhhip/linkerp | 1.Vietjack.com/1.Ve tam giac trong C(Su dung vong lap long nhau)/6.Ve tam giac Floyd.cpp | #include<stdio.h>
/* Tam giac Floyd:
Tam giac vuong duoc hien thi bang so tu nhien tang dan.
*/
int main(){
int i, j, n;
int k=1;
printf("Nhap so hang:");
scanf("%d", &n);
for(i=1; i<=n; i++){
for(j=1; j<=i; j++)
printf("%3d", k++);
printf("\n");
}
return 0;
}
| ALGO | 0.99952 | 3.09497 |
3d965a54-b248-4ea4-98b5-7c1aa53a3b99 | chombz/c-and-c-plus-plus-programming | cpp/loop_statement/while_do_while_star_pattern.cpp | //C++ program that displays a star pattern using a nested do...while loop
///Pre-processor Directives
#include <iostream>
using namespace :: std;
///Main program begins with a program execution
int main()
{
//variables declaration
int e = 1, c;//looping variable
int rows;
//prompt the user for the nu... | ALGO | 0.969426 | 3.899336 |
b150f27d-cbe3-4fef-83c1-2d96c0080505 | TStr626/AtCoder | ARC150/A.cpp | #include<iostream>
#include<vector>
#include<cmath>
#include<numeric>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<deque>
#include<iomanip>
using namespace std;
# define rep(i,n) for(i=0; i<n; i++)
int main() {
long long n, m, i, j, k, h, w, x, y, ans, cur, res, jud, mod;... | ALGO | 0.999943 | 3.797597 |
b52a7e0e-9384-4af6-8978-834a86453193 | EPro30/singh-cop3330-ch05-ex07 | QuadraticEquation.cpp | //The purpose of this program is to find the value of x in quadratic equation.
#include <iostream> //allows program to perform input and output
#include <string> //allows program to work with strings
#include "std_lib_facilities.h" //header file
#include <cmath> //allows a program to use math functions
//add the root... | ALGO | 0.999687 | 4.564764 |
960b0816-fc95-4833-b3e3-a261336419e5 | MishkatIT/codeforces-atcoder-submissions | codeforces/1719/1719A Chip Game.cpp | #include<iostream>
using namespace std;
typedef long long int lli;
int main()
{
lli t, n1, n2;
cin >> t;
while(t--)
{
cin >> n1 >> n2;
if((n1 + n2) % 2 == 0)
cout << "Tonya" << endl;
else
cout << "Burenka" << endl;
}
}
| ALGO | 0.999161 | 4.930015 |
4bb60469-e68f-4b7d-94be-04da36df562e | morpheus-30/LeetCode | 268-missing-number/missing-number.cpp | class Solution {
public:
int missingNumber(vector<int>& nums) {
int n = nums.size();
int initial_sum = 0;
int sumNums = accumulate(nums.begin(), nums.end(), initial_sum);
int ideal = n*(n+1)/2;
return ideal-sumNums;
}
}; | ALGO | 0.999929 | 5.879997 |
1cc0fac1-7a6d-4592-bd3e-4fd738ddd268 | pawan-nirpal-031/Algorithms-And-ProblemSolving | Active/InterviewPreparation/ExpressInterviewPrep/LeetCodeEssentilas.cpp | #include <bits/stdc++.h>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;
#define Mod 1000000007
#define Infinity (ll)1e18
#define Append(a) push_back(a)
#define Pair(a,b) make_pair(a,b)
#define Clear(a) for(ll &x : a){x=0;}
#define Point(x) std::fixed<<setpreci... | ALGO | 0.999882 | 4.175716 |
7173533e-f883-45cc-82ef-0c00b1217856 | salim002/Cpp-Codes | 52_Codeforces/17_Codeforces 2/176.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<ld> vd;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
const int mod = 1000000007;
// const int mod = ... | ALGO | 0.999635 | 6.094368 |
98b82eca-8983-441f-a5f8-f01c9053873f | onlyapon/codeforces-solutions | C/C_Two_Colors.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int t;cin>>t;
while (t--)
{
int n,m;cin>>n>>m;
vector<int> v(m);
for(auto &i:v)cin>>i;
sort(v.begin(),v.end());
int ans=0;
for (int i = 1; i < n; i++)
{
int x=m-(lower_bound(v.begin(... | ALGO | 0.999926 | 3.997633 |
f8764dfe-26b4-431d-98aa-21de7b58b01a | rodrigoAMF/competitive-programming | Upsolving/Codeforces/1107A.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
/*
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
*/
int q;
int n;
string s;
char d1;
scanf("%d ", &q);
while(q--){
cin >> n >> s;
if(n == 2 && s[0] >= s[1]){
cout << "NO\n";
}else{
cout << "YES\n";
cout << "... | ALGO | 0.99901 | 3.504716 |
4a668643-6b0f-4480-bc95-d53ff892a5e4 | Markelas/KAI_labs | lab_1/lab_1_3/lab_1_3.cpp | /*
Написать программу решения квадратного уравнения.
Программа должна проверять правильность исходных данных и в случае,
если коэффициент при второй степени неизвестного равен нулю,
выводить соответствующее сообщение
*/
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
setlocale(LC_ALL, "Russi... | ALGO | 0.998983 | 4.736979 |
96987663-411b-4835-aefd-13b0d258d3b5 | hapiel/workshop_bot | driver_0_7_0a1/BottangoArduinoDriver/src/FixedBezierCurve.cpp | #include "FixedBezierCurve.h"
#include "Arduino.h"
#include "Log.h"
#include "../BottangoArduinoConfig.h"
// Returns roughly the same value as a FloatBezierCurve.cpp, but in fixed point math!
// Big thanks to @Dschadu for the smart thinking and advice along the way to bringing fixed point curve evaluation to Bottango!... | ALGO | 0.956875 | 6.938368 |
f24de664-62f7-4690-baa9-ae9db9f056a3 | kahowang/sensor-fusion-for-localization-and-mapping | 第五章 惯性导航原理及误差分析/作业代码框架/sensor-fusion-for-localization-and-mapping/workspace/assignments/05-imu-calib/src/imu_tk/src/filters.cpp | #include "imu_tk/filters.h"
using namespace Eigen;
template <typename _T>
void imu_tk::staticIntervalsDetector ( const std::vector< imu_tk::TriadData_<_T> >& samples,
_T threshold, std::vector< imu_tk::DataInterval >& intervals,
in... | ALGO | 0.989996 | 6.438294 |
584924b0-de0b-404f-a3e1-fb0cdde430f8 | DarshanRokkad/DSA | 02_Array/016_Window_sliding.cpp | // Window sliding
#include<iostream>
using namespace std;
int Windowsliding(int a[],int n ,int k)
{
if(n<k)
{
return -1 ;
}
int max_sum = 0 ;
for(int i = 0 ;i<k ;i++)
max_sum+=a[i];
// sum of first window
int window_sum = max_sum ;
for(int i = k ;i< n ;i++)
{
... | ALGO | 0.999845 | 4.251027 |
1c995634-7cdd-4412-8b0f-39a1e40b4621 | wassimalharaki/Codeforces | 1400/SuffixOperations.cpp | #include <bits/stdc++.h>
using namespace std;
#ifdef WASSIM
#include "debug.h"
#else
#define dbg(...)
#endif
#define int long long
#define INF LONG_LONG_MAX
#define nl '\n'
#define v vector
#define pb push_back
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define mp make_pair
#define F firs... | ALGO | 0.99966 | 5.200308 |
1684728c-a437-4594-b29d-2e953ef0c1a0 | lakshits11/LeetCode | 0629-k-inverse-pairs-array/0629-k-inverse-pairs-array.cpp | static const auto speedup = []() -> int{
std::ios::sync_with_stdio(false);std::cin.tie(nullptr);return 0;
}();
class Solution {
public:
int kInversePairs(int n, int k) {
int dp[2][1001] = { 1 };
for (int N = 1; N <= n; ++N)
for (int K = 0; K <= k; ++K) {
dp[N % 2][K]... | ALGO | 0.99995 | 5.550186 |
49ded20f-0f69-40dd-9c65-7be5e98b9da3 | ethoshomo/codding-challenges | Leetcode/2900-Longest-Unequal-Adjacent-Groups-Subsequence-I.cpp | /* 2900. Longest Unequal Adjacent Groups Subsequence I
You are given a string array words and a binary array groups both of length n, where words[i] is associated with groups[i].
Your task is to select the longest alternating subsequence from words. A subsequence of words is alternating if for any two consecutive str... | ALGO | 0.999936 | 5.93048 |
3de14a58-d252-4533-a64e-e76ad7bce71b | pronajitdey/Cpp-Programming | Apna College/05. Sorting/quick_sort.cpp | /* Choose an element and place it in correct position, i.e.
left side smaller no.s & right side larger no.s (unsorted) */
#include <iostream>
using namespace std;
void swap(int arr[], int i, int j) {
int temp = arr[i];
arr[i] = arr[j];
arr[j] = temp;
}
int partition(int arr[], int l, int r) {
int pivot = arr... | ALGO | 0.999954 | 5.036987 |
675330ed-42c0-4690-9540-d88b0282433a | kks227/BOJ | 17400/17478.cpp | #include <cstdio>
using namespace std;
inline void print(int n){ for(int i = 0; i < n*4; ++i) putchar('_'); }
void rec(int n, int k = 0){
print(k); puts("\"재귀함수가 뭔가요?\"");
print(k);
if(k == n){
puts("\"재귀함수는 자기 자신을 호출하는 함수라네\"");
}
else{
puts("\"잘 들어보게. 옛날옛날 한 산 꼭대기에 이세상 모든 지식을 통달한 선인이 있었어.");
print(k); pu... | ALGO | 0.999799 | 3.986094 |
b47ff2b6-ea81-41e2-aaec-31798827121a | SamZhong2/CSC212-Project | Archived Code/btree (lawrence version) (not functioning properly) (non-template).cpp | #include "btree.h"
#include <fstream>
#include <algorithm>
/*
Class Constructors
*/
BTreeNode::BTreeNode() {
is_leaf = true;
}
BTreeNode::BTreeNode(bool leaf) {
is_leaf = leaf;
}
BTree::BTree(){
this->root = nullptr;
this->degree = 2;
}
BTree::BTree(int _degree){
this->root = nullptr;
th... | ALGO | 0.991626 | 5.132105 |
2c85df56-75c3-4d3a-8a52-401c6159753e | Goelshiva1611/Leetcode_Problems | 3447-clear-digits/clear-digits.cpp | class Solution {
public:
string clearDigits(string s) {
stack<char>st;
int n=s.size();
for(int i=0;i<n;i++)
{
if(s[i]>=48 && s[i]<=57 && !st.empty())
st.pop();
else
st.push(s[i]);
}
string ans="";
while(!... | ALGO | 0.99956 | 5.693164 |
37cc3e58-999c-49c2-aa18-1190c6cef26e | stepanvanecek/sys-sage | src/parsers/cccbench.cpp | #include <iostream>
#include <cassert>
#include <algorithm>
#include <numeric>
#include <fstream>
#include <string>
#include <vector>
#include <exception>
#include <bits/stdc++.h>
#include "cccbench.hpp"
using namespace std;
CccbenchParser::CccbenchParser(const char *csv_path)
: c2cDatapoints((Vec2DArray<float> *... | DATA | 0.879944 | 4.078121 |
a47a7fed-0890-4142-be03-31ae863a28e7 | anotherwebguy/Interviewbit-cpp | Binary Search Tree/Recover Binary Search Tree.cpp | /**
* Definition for binary tree
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
void findInorder(TreeNode* A, vector<int> &inorder){
if(!A) return;
findInorder(A->left,inorder);
inorder.push_back(A->... | ALGO | 0.999994 | 5.720814 |
1e0f3d44-14ae-444f-8ca8-ff62262deedf | levando20194017/LaptrinhC-Advanced | TTUD/Tranning3/S.test2.cpp | #include<iostream>
using namespace std;
const int N = 1e4 +7;
int n, i;
int x[N];
int count = 0;
unsigned long long k;
int sum;
void solution(){
for(int o=1; o<=n; o++){
cout<<x[o]<<" ";
}
cout<<endl;
}
void TRY(int l){
for(int v= 0; v<=1; v++){
x[l] = v;
if(l==n){
solution();
}
else TRY(l+1);
}
}
in... | ALGO | 0.999687 | 3.583236 |
7a769d93-6ffb-465b-9dfa-8ff78a4db5e2 | Zeratuli/Algorithm-Competition-Code-Set | 竞赛/牛客竞赛/牛客的比赛/牛客周赛/牛客周赛 Round 28/E.cpp | #include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
int goodArrays(int n, int k) {
vector<vector<long long>> dp(n + 1, vector<long long>(2, 0));
dp[1][0] = (k + 1) / 2;
dp[1][1] = k / 2;
for (int i = 2; i <= n; ++i) {
dp[i][0] = (dp[i - 1][0] * ((k + 1) / 2) + dp[i... | ALGO | 0.999938 | 5.138155 |
5e72aa27-d1f0-4719-869e-5b3ff8793a73 | letstatt/itmo | algo-labs/lab8 - minpath games/d.cpp | #include <algorithm>
#include <iostream>
#include <vector>
#include <set>
using namespace std;
#define sp << ' ' <<
#define nl << '\n'
#define sq << ' '
typedef long long ll;
void solve();
int main() {
/*ios_base::sync_with_stdio(0);
cout.tie(0);
cin.tie(0);*/
solve();
}
const ll INF = 1e12;
vect... | ALGO | 0.999917 | 4.216173 |
242b983a-000b-4921-b911-6286142144ac | avijitpandey5/LeetCode-Problems | Minimum Common Value.cpp | class Solution {
public:
int getCommon(vector<int>& nums1, vector<int>& nums2) {
unordered_map<int,int>mpp;
for(int i=0;i<nums1.size();i++)
{
mpp[nums1[i]]++;
}
for(int i=0;i<nums2.size();i++)
{
if(mpp[nums2[i]]>0)
return ... | ALGO | 0.999952 | 5.60738 |
bb99ef07-5d57-4ed4-985d-251e49c7910a | muhirwanto-dev/HackerRankDebugBridge | source/PracticeCPP/CamelCase.cpp | #include "pch.h"
#include "PracticeCPP/CamelCase.h"
#define main() MAIN_ENTRY(CamelCase)
using namespace std;
// Complete the camelcase function below.
int camelcase(string s) {
int res = 1;
for (auto c : s)
{
if (isupper(c))
{
res++;
}
}
return res;
}
int main()
{
//ofstream fout(getenv("OUTPUT_PA... | ALGO | 0.999508 | 5.181038 |
42427079-7de9-44bd-b150-282196635fcc | k4sud0n/codetree-TILs | 240113/원점으로부터의 거리/distance-from-origin.cpp | #include <iostream>
#include <algorithm>
#include <cstdlib>
using namespace std;
class Plane {
public:
int index, length;
Plane(int index = 0, int length = 0) {
this->index = index;
this->length = length;
}
};
bool cmp(Plane p1, Plane p2) {
if(p1.length == p2.length) return p1.index ... | ALGO | 0.999946 | 4.572531 |
efdd662d-5899-4777-8457-1f5a8e33a9b6 | gnd10137/C- | 2025-07-19 상상.cpp | //#include <cstdio>
//int d[11];
//int main()
//{
// for (int i = 1; i <= 10; i++)
// {
// if (i - 1 >= 0)
// {
// d[i] += d[i - 1];
// }
// if (i - 2 >= 0)
// {
// d[i] += d[i - 2];
// }
// if (i - 3 >= 0)
// {
// d[i] += d[i - 3];
// }
// }
// int t;
// scanf("%d", &t);
// while (t--)
// {
// int n;
/... | ALGO | 0.999952 | 3.470108 |
fab72fde-9fe7-42af-9a72-323d2260ab28 | josue46/yinzo-app | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998733 | 6.76775 |
916df24c-1ad4-49a9-b42c-436eae210d40 | DongXD22/luogu | P1719.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
int n,a[125][125],m[125][125],ans=0,num=0;
cin>>n;
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
cin>>a[i][j];
}
}
for(int i=0;i<=n;i++){
m[i][0]=0;
m[i][1]=a[i][0];
fo... | ALGO | 0.999978 | 3.169497 |
f00381de-6a1b-4cce-a6c9-ed286ec75e8e | joshualass/CP | Solutions/Default/moviecollection.cpp | #include <bits/stdc++.h>
typedef long long ll;
using namespace std;
int n;
vector<int> t(0);
void printV(vector<int> x) {
for(int y : x) {
cout << y << ' ';
}
cout << '\n';
}
void printM(map<int,int> x) {
for(pair<int,int> y : x) {
cout << y.first << ' ' << y.second << '\n';
}
}
... | ALGO | 0.999918 | 4.177911 |
32a8883c-928a-406b-93a9-c185ab5b0b70 | khallark/Cpp-DSA-Questions | Data structures/Sorting and Searching/Subarrays_sum_I.cpp | #include <iostream>
#include <vector>
#define ll long long
using namespace std;
int main() {
int n;
ll x;
cin >> n >> x;
vector<int> nums(n);
for(auto& i : nums) cin >> i;
int i = 0, j = 0;
ll sum = 0;
int count = 0;
while(j < n) {
sum += nums[j];
while(sum >= x) {
... | ALGO | 0.999886 | 4.269377 |
05f39b58-1b75-4213-af1b-dce0491ce5ff | mpatwa98/DSA | Array/Buy-Maximum-Stocks-if-i-stocks-can-be-bought-on-i-th-day.cpp | //{ Driver Code Starts
/* Driver program to test above function */
#include <bits/stdc++.h>
using namespace std;
void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __p... | ALGO | 0.999942 | 5.614454 |
699b3123-65f3-4bb8-9e63-6ca035b32a98 | takaakiaoki/my-lammps | src/USER-OMP/pair_brownian_omp.cpp | /* ----------------------------------------------------------------------
Contributing author: Axel Kohlmeyer (Temple U)
------------------------------------------------------------------------- */
#include "math.h"
#include "pair_brownian_omp.h"
#include "atom.h"
#include "comm.h"
#include "domain.h"
#include "for... | ALGO | 0.999727 | 7.374432 |
d8adad72-f60d-4ddb-be98-63f479e78aa0 | huge-data/hadoop-guides | hadoop-chap02/src/main/cpp/max_temperature.cpp | #include <algorithm>
#include <limits>
#include <stdint.h>
#include <string>
#include "hadoop/Pipes.hh"
#include "hadoop/TemplateFactory.hh"
#include "hadoop/StringUtils.hh"
class MaxTemperatureMapper : public HadoopPipes::Mapper {
public:
MaxTemperatureMapper(HadoopPipes::TaskContext& context) {
}
void map(Had... | DATA | 0.95715 | 6.166068 |
30aebc19-5d69-4c46-a592-adb852dbf927 | levietanh1505/C-C- | code nhap/8/main.cpp | // #include <iostream>
// using namespace std;
// int main(){
// int n;int sum = 0;
// while (true){
// int check = 0;
// cin >> n;
// switch (n){
// case 1:
// cout << "nhap m = " << endl;
// int m;
// cin >> m;
// ... | TOOL | 0.97894 | 4.236244 |
f18e237e-230c-4bad-9799-9818d2595d7b | d-mironov/competitive-programming | HackerRank/compare-the-triplets/C++/src/main.cpp | #include <cstddef>
#include <iostream>
#include <sstream>
#include <string_view>
#include <vector>
using namespace std;
vector<int> compareTriplets(vector<int> a, vector<int> b);
int main() {
return 0;
}
vector<int> compareTriplets(vector<int> a, vector<int> b) {
vector<int> out(2, 0);
for (std::size_t... | ALGO | 0.998984 | 5.313462 |
082a86ca-93da-4728-bb19-0911cd1d3ba8 | yatharthdixit44/C-Program-Assignment- | C program Project/square_of_a_number.cpp | #include<stdio.h>
#include<math.h>
int main()
{
double num,root;
printf("Enter a number: ");
scanf("%lf",&num);
printf("Square root of %2.lf=%.2lf",num,root);
return 0;
}
| ALGO | 0.996235 | 3.340013 |
50c9d166-a257-48bb-86f0-d077e9e0b667 | savitansh/Contest-Programs | codeForceDiv219_C.cpp | #include <iostream>
#include <algorithm>
using namespace std;
int arr[1000000];
bool filled[1000000];
int main(){
int n;
cin>>n;
for (int i = 0; i < n; ++i)
{
cin>>arr[i];
}
int p1=0,p2=0;
sort(arr,arr+n);
for (int i = 0; i < n; ++i)
{
cout<<arr[i]<<" ";
}
while(p2 < n)
{
if(arr[p1] == -1)
p1++;
... | ALGO | 0.999905 | 3.675879 |
49722f2c-926d-47ff-961a-b5ae301e7918 | openkylin/qtbase-opensource-src | src/corelib/tools/qhash.cpp | // for rand_s, _CRT_RAND_S must be #defined before #including stdlib.h.
// put it at the beginning so some indirect inclusion doesn't break it
#ifndef _CRT_RAND_S
#define _CRT_RAND_S
#endif
#include <stdlib.h>
#include "qhash.h"
#ifdef truncate
#undef truncate
#endif
#include <qbitarray.h>
#include <qstring.h>
#incl... | TOOL | 0.967543 | 6.413382 |
5bf01bf5-155c-46df-97f3-69cc815d0590 | aaronboda24/Loose-GNSS-IMU | Loose-GNSS-IMU/Loose-GNSS-IMU/Libraries/eigen/doc/examples/class_FixedVectorBlock.cpp | #include <Eigen/Core>
#include <iostream>
using namespace Eigen;
using namespace std;
template<typename Derived>
Eigen::VectorBlock<Derived, 2>
firstTwo(MatrixBase<Derived>& v)
{
return Eigen::VectorBlock<Derived, 2>(v.derived(), 0);
}
template<typename Derived>
const Eigen::VectorBlock<const Derived, 2>
firstTwo(c... | TOOL | 0.975669 | 5.200637 |
030a2e5a-40d6-478a-afaa-86621fd68f0e | abhisehekkumr/c-plus-plus | segmentTreeOddEven.cpp | #include<bits/stdc++.h>
using namespace std;
struct Node{
int odd;
int even;
};
void buildTree(int *arr, Node *tree, int treeNode, int start, int end){
if(start == end){
if(arr[start]%2){
//std::cout << arr[start] << ' ' << "odd" << endl;
tree[treeNode].odd = 1;... | ALGO | 0.999972 | 4.713356 |
bb31fd51-d2f0-4436-8576-a0e7f42a1053 | OmkarBhostekar/leetcode | 547-number-of-provinces/547-number-of-provinces.cpp | class Solution {
public:
void dfs(vector<vector<int>>& adj, vector<bool> &vis, int i, int n){
if(i==n || vis[i]) return;
vis[i] = true;
for(auto x: adj[i])
if(!vis[x])
dfs(adj, vis, x, n);
}
int findCircleNum(vector<vector<int>>& con) {
i... | ALGO | 0.999996 | 5.985574 |
67167147-cec8-40e1-9ff1-cc9d079ae9f1 | yiheng666/leetcode | 2. Add Two Numbers.cpp | class Solution {
public:
ListNode* addTwoNumbers(ListNode* l1, ListNode* l2) {
ListNode* res = new ListNode();
ListNode* p = l1,*q = l2,*t = res;
int carry = 0;
while (p || q || carry){
int val = carry;
if (p){
val += p->val;
p ... | ALGO | 0.999907 | 6.552709 |
de65df6c-a926-49d9-9a76-0185d5d3818e | Nur-Alam39/online-judges-problem-solutions | Codeforces/A. Beru-taxi.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
double x,y,n;
cin>>x>>y>>n;
double m,t,v,d,x1,y1;
m=10000.00000000000000000000;
for(int i=0; i<n; i++)
{
cin>>x1>>y1>>v;
d=sqrt((x-x1)*(x-x1)+(y-y1)*(y-y1));
t=d/v;... | ALGO | 0.999827 | 4.139172 |
97631072-40b6-44c0-a550-f4f28899d894 | morris821028/UVa | volume123/12393 - Non-negative Partial Sums.cpp | #include <stdio.h>
#define maxN 1048576<<1
int S[maxN], Q[maxN];
inline int ReadInt(int *x) {
static char c, neg;
while((c = getchar()) < '-') {if(c == EOF) return EOF;}
neg = (c == '-') ? -1 : 1;
*x = (neg == 1) ? c-'0' : 0;
while((c = getchar()) >= '0')
*x = (*x << 3) + (*x << 1) + c-'0... | ALGO | 0.999469 | 3.665292 |
545b6d5d-ea19-4e75-8adf-7975c257ecd7 | ducmanh1312/Project-for-CV | Code C++/C++ PTIT/8_Stack016_Số_lượng_nguyên_tử_@@@/main.cpp | #include <bits/stdc++.h>
using namespace std;
/// @brief
/// @bug
/// @return
#define int long long
map<string, int> parse(string s)
{
map<string, int> cnts;
stack<map<string, int>> st;
st.push({});
for (int i = 0; i < s.size();)
{
if (s[i] == '(')
{
st.push({});
... | ALGO | 0.999375 | 5.139213 |
5bdcb417-29f5-46af-9c5a-093fc22d68e5 | ishandutta2007/codeforces | yasugongshang/normal/993/B.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define sqr(x) ((x)*(x))
#define mp make_pair
#define uint unsigned
#define PI pair<int,int>
inline char gc(){
static char buf[100000],*p1=buf,*p2=buf;
return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
#define gc getchar... | ALGO | 0.999992 | 3.513227 |
bb362392-3a27-4671-8304-4e4d790a8214 | duhber/spoj | the-shortest-path.cpp | #include<iostream>
#include<vector>
#include<map>
#include<algorithm>
#include<list>
#include<set>
#include<cstring>
#include<cstdio>
//#include<unordered_map>
#include<string>
#include<limits>
#include<functional>
#include<queue>
using namespace std;
typedef pair<long long ,long long>ii;
typedef vector<ii>vii;
typede... | ALGO | 0.999447 | 3.603782 |
9d9776d6-750a-4a7a-ac83-4188b79ab9b2 | ME-JAHED/CPP-Programming | Final_Exam/sort_it.cpp | #include<bits/stdc++.h>
using namespace std;
class Student
{
public:
string nm;
int cls;
char s;
int id;
int math_marks;
int eng_marks;
};
bool cmp(Student a,Student b)
{
if(a.math_marks+a.eng_marks==b.math_marks+b.eng_marks)
{
return a.id<b.id;
}
return a.math_marks+a.eng_ma... | ALGO | 0.995867 | 3.416037 |
c498a785-c0bb-4092-b71c-44f2c99f204f | HarshitSaxena12/Hacktoberfest | binary_to_decimal.cpp | #include <bits/stdc++.h>
using namespace std;
int bTd(int n)
{
int ans = 0;
int x = 1;
while (n > 0)
{
int y = n % 10;
ans += x * y;
x *= 2;
n = n / 10;
}
return ans;
}
int main()
{
int n;
cin >> n;
cout << bTd(n) << endl;
return 0;
} | ALGO | 0.999937 | 4.799326 |
42038ae4-1325-4c9f-abbf-085e8eb9632d | tuw-robotics/tuw_global_planner | global_planner/src/heuristics_diagonal.cpp | #include <global_planner/heuristics_diagonal.h>
#include <math.h>
#include <algorithm>
namespace global_planner
{
float HeuristicsDiagonal::CalcHeuristic(double act_x, double act_y, double start_x, double start_y, double end_x,
double end_y, float neutral_cost)
{
float dx = ab... | ALGO | 0.948003 | 5.169077 |
eab62663-7c81-4d50-9cfe-2bb89278e600 | pavangami/Code | Recursion/10countpathinmaze.cpp | #include <bits/stdc++.h>
using namespace std;
int countpath(int i,int j,int n)
{
if(i==n && j==n)
return 1;
int count=0;
if(i<n)
count+=countpath(i+1,j,n);
if(j<n)
count+=countpath(i,j+1,n);
return count;
}
int main()
{
int n;
cin>>n;
cout<<countpath(0,0,n-1);
retur... | ALGO | 0.999971 | 4.366287 |
e2391c02-3787-44db-8ef2-75698ec782e6 | Palak-Bhandari/College | 7. DS/4_Bully_Election_Algorithm.cpp |
/*
Bully Algo:
Process with higher priority get msg from process with lower priority. Higher priority acknowledge the lower priority
process after becoming coordinator.
The most higher priority process can only become the coordinator process.
*/
#include <iostream>
#include <vector>
#include <map>
#include <algorit... | ALGO | 0.999997 | 5.09862 |
2747ea97-270b-4612-bb23-9834418f6cb8 | twoint/LibOfTwoArm | eigen-3.3.8/doc/examples/DenseBase_middleRows_int.cpp | #include <Eigen/Core>
#include <iostream>
using namespace Eigen;
using namespace std;
int main(void)
{
int const N = 5;
MatrixXi A(N,N);
A.setRandom();
cout << "A =\n" << A << '\n' << endl;
cout << "A(2..3,:) =\n" << A.middleRows(2,2) << endl;
return 0;
}
| ALGO | 0.950251 | 3.307581 |
c51729d6-478a-4233-ba3f-6c11ceb5b41d | jhaym3s/moni | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998733 | 6.76775 |
af141e2a-8cd1-4813-9dd3-5465364592d3 | sabbirahmedfahim/Basic-Data-Structures | WEEK_03/module_11/reverse.cpp | /*
class Solution {
public:
void reverse(ListNode*& head, ListNode* current) {
if (current->next == NULL) {
head = current;
return;
}
reverse(head, current->next);
current->next->next = current;
current->next = NULL;
}
ListNode* reverseList(Lis... | ALGO | 0.997783 | 4.919 |
28ae2810-a1d4-4cda-8e50-cf9d0e6e4b3b | tiny-flower/leetcode | 623.在二叉树中增加一行.cpp | /*
* @lc app=leetcode.cn id=623 lang=cpp
*
* [623] 在二叉树中增加一行
*/
// @lc code=start
/**
* 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)... | ALGO | 0.999949 | 7.156796 |
37799d76-8426-4774-8677-a0a54bd21b33 | ujjwal-ism/CompetitiveCode | SPOJ/NAUGHTY.cpp | #include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[])
{
std::ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
int n,x,y,temp,a;cin>>n;
unordered_map<int,int> t,b;
for(int i=0;i<n;i++){
cin>>x>>y;
t[x]++;
if(x!=y) b[y]++;
}
int ans = INT_MAX;
unordered_map<int,int>:... | ALGO | 0.999882 | 3.747063 |
adce1d5e-48c1-4890-ab45-3d7cbed1022d | Raibows/NCEPU-CS-COURSES | Compiler/IS/2/2.cpp | #define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<string>
using namespace std;
//分析栈
struct stack
{
int top=0;
char a[100];
};
stack s;
void push(char c)
{
s.a[s.top++] = c;
}
char* pop(int length)
{
char* temp = new char[100];
for (int i = 0;i < length;i++)
{
temp[i] = s.a[s.top - length + i];
}
... | ALGO | 0.99994 | 3.502103 |
081fe302-0e2e-4756-ba2d-6c65b1c7c6fc | yunxiao3/ACM | 1030.cpp | #include <iostream>
#include<cmath>
using namespace std;
int main(int argc, char const *argv[]){
int N, M;
cin >> N >> M;
int Nr = 1, Mr = 1;
int Nc, Mc;
while(pow(Nr,2) < N){
Nr++;
}
while(pow(Mr,2) < M ){
Mr++;
}
Nc = N - pow(Nr - 1,2);
Mc = M - pow(Mr - 1,2);
if (Mr == Nr)
cout << (M > N ? Mc ... | ALGO | 0.999829 | 4.197996 |
897c385c-526e-46e3-99a7-a03062f6c0da | IITH-Compilers/bullseye | boost_1_76_0/libs/graph/example/default-constructor2.cpp | using namespace boost;
template < typename Graph > void read_graph_file(std::istream& in, Graph& g)
{
typedef typename graph_traits< Graph >::vertex_descriptor Vertex;
typedef typename graph_traits< Graph >::vertices_size_type size_type;
size_type n_vertices;
in >> n_vertices; // read in number of vert... | ALGO | 0.917461 | 5.73055 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.