uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
49de77d3-55cd-499d-a8c4-bd6320bfa5ee | ishitarakchhit/Data-Structures-Code-Help | 14. Binary Search Trees/Homework/FindMedianOfBST.cpp | /*
Given a Binary Search Tree of size N, find the Median of its Node values.
Example 1:
Input:
6
/ \
3 8
/ \ / \
1 4 7 9
Output: 6
Explanation: Inorder of Given BST will be:
1, 3, 4, 6, 7, 8, 9. So, here median will 6.
Example 2:
Input:
6
/ \
3 8
/ \... | ALGO | 0.999999 | 6.118951 |
4c5a2e66-7fb5-4dd5-9f74-2b2ae1c6141d | JAPJEET01/c-DSA-PLACEMENT | arrays/initialize+_a_array.cpp | #include <iostream>
#include <climits>
#include<algorithm>
#include<minmax.h>
using namespace std ;
int main(){
int n ;
int maxno = INT_MIN ;
int minno = INT_MAX ;
cin>> n ;
int arr[n] ;
for (int i = 0; i < n ; i++)
{
cin>>arr[i] ;
maxno = max(maxno,arr[i]);
mi... | ALGO | 0.99957 | 4.126447 |
254ceed5-8ce2-4301-84eb-33320f0bb62e | romero-gator/CompetitiveProgrammingSolutions | HW5/Q4.cpp | #include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
int main() {
int n;
cin >> n;
int cars[2010];
for (int i = 1; i <= n; i++) {
cin >> cars[i];
}
int dp1[2010], dp2[2010], ans = 0;
for (int i = n; i >= 1; i--) {
dp1[i] = 1;
dp2[i] =... | ALGO | 0.999969 | 4.243862 |
a619ad0b-8e72-4c4e-b12a-485d5d173356 | TosakaUCW/CompetitiveProgramming | Old/Luogu/[Luogu P1832] A+B Problem(再升级).cpp | #include <stdio.h>
#include <algorithm>
typedef long long ll;
const ll N = 1e3 + 5;
ll n;
ll pri[N], f[N], cnt;
bool isPrime(ll x)
{
for (ll i = 2; i < x; i++)
if (x % i == 0)
return false;
return true;
}
int main()
{
scanf("%lld", &n);
for (ll i = 2; i <= n; i++)
if (is... | ALGO | 0.999987 | 4.40633 |
c351d6c8-e50a-4210-b4e9-8439918467db | lemonpuddi/I2P3-lemon | src/policy/alpha-beta.cpp | #include <cstdlib>
#include <iostream>
#include <fstream>
#include "../state/state.hpp"
#include "./alpha-beta.hpp"
int player;
/**
* @brief Randomly get a legal action
*
* @param state Now state
* @param depth You may need this for other policy
* @return Move
*/
Move Minimax2::get_move(State *state, int dept... | ALGO | 0.993569 | 4.021478 |
79d198b4-92e5-4a47-a5ea-8e7f81bf19d8 | Polidea/SiriusObfuscator | SymbolExtractorAndRenamer/llvm/lib/CodeGen/LiveInterval.cpp | #include "llvm/CodeGen/LiveInterval.h"
#include "LiveRangeUtils.h"
#include "RegisterCoalescer.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/CodeGen/LiveIntervalAnalysis.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostrea... | TOOL | 0.997542 | 8.0046 |
8a1ee29a-f104-4d2b-bdf0-bd82663a0b78 | shristigupta12/DSAInCpp | O29linkedList/o7recReverseLL.cpp |
//TO make this code run, add <inp.txt in the terminal when running the code
#include<iostream>
using namespace std;
class node{
public:
int data;
node*next;
node(int d){
data = d;
next = NULL;
}
};
void insertAtHead(node*&head,int data){
if (head==NULL)
{
head = new n... | ALGO | 0.999877 | 4.245526 |
012152c2-cc0c-4e59-9c3f-95ecd5fbcb2b | Josephzcy/my_compile_platform | third_party/opencv-3.4.8/samples/cpp/mask_tmpl.cpp | #include "opencv2/imgproc.hpp"
#include "opencv2/highgui.hpp"
#include <iostream>
using namespace std;
using namespace cv;
int main( int argc, const char** argv )
{
CommandLineParser parser(argc, argv,
"{ i | lena_tmpl.jpg |image name }"
"{ t | tmpl.png |template name }"
"{ m | mask.png |m... | ALGO | 0.946045 | 4.903745 |
46a5e70e-64b9-443c-a0cf-ff13fcd04f30 | dimkashelk/spbspu-labs-2022-aap-904-a | danilenko.ekaterina/I4/countDiagonalsWithoutZero.cpp | #include "countDiagonalsWithoutZero.h"
size_t countDiagonalsWithoutZero(const int* array, size_t n)
{
bool flag;
int count = 0;
for (size_t k = 0; k < 2 * (n - 1); k++)
{
flag = false;
for (size_t i = 0; i < n && !flag; i++)
{
size_t j = k - i;
if (j < n && array[i * j] == 0)
{
... | ALGO | 0.987638 | 5.483139 |
45a966b8-fe95-44d0-85f5-6ef83540ff8b | Shikhar8990/pChop | lib/Solver/STPBuilder.cpp | #include "klee/Expr.h"
#include "klee/Solver.h"
#include "klee/util/Bits.h"
#include "klee/SolverStats.h"
#include "ConstantDivision.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/CommandLine.h"
#include <cstdio>
#define vc_bvBoolExtract IAMTHESPAWNOFSATAN
// unclear return
#define vc_bvLeftShiftExpr ... | ALGO | 0.964775 | 5.201071 |
15e58ba1-16de-4f0a-8332-a70d6a5a42cf | cxlove/ACM_ICPC | Online_judge/poj/poj_2689_2.cpp | #include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#define INF 1000000+10
#define MAXN 1000000
#define PRIME 80000//开始把这个一不小心开小了,就RE了。。
#define PRIMETEMP 100000
using namespace std;
bool isprime[MAXN+10];
bool isprimetemp[MAXN+10];
long long prime[PRIME+10];
long long ... | ALGO | 0.999926 | 3.650729 |
2bad6fda-b526-4fce-8dea-13e807596e7e | ishandutta2007/codeforces | boook/normal/746/A.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define REP(i,j,k) for(int i = j ; i < k ; ++i)
#define RREP(i,j,k) for(int i = j ; i >=k ; --i)
#define A first
#define B second
#define mp make_pair
#define pb emplace_back
#define PII p... | ALGO | 0.99958 | 3.926506 |
4da1f6b7-ad98-4cfc-8f28-3a50d237f938 | Doda94/SS-Kodovi | 2019_2020_kodovi/20191125_dod_1/g_iterativno_ver_2.cpp | #include <iostream>
#define M 1000000007
using namespace std;
int n;
long long dp[100003] = {1};
int main()
{
cin >> n;
for(int i = 1; i < 5; ++i)
for (int j = 1; j <= i; ++j)
dp[i] = dp[i] + dp[i - j];
for (int i = 5; i <= n; ++i)
dp[i] = (dp[i - 1] % M + dp[i - 2] % M + dp[i - 3] % M + dp[i - 4... | ALGO | 0.99998 | 4.157225 |
be2d5d42-eb86-4fd4-9fe2-738dd4edca82 | AcaiHi/Sunny | D_Distinct_Split.cpp | #include<iostream>
#include<set>
#include<vector>
using namespace std;
vector<int> cnt(string s){
set<int> cc;
vector<int> pe(s.length());
int i =0 ;
for (int &it : pe){
cc.insert(s[i++]);
it = cc.size();
}
return pe;
}
int main(){
int t;
cin >> t;
while (t--){
... | ALGO | 0.999905 | 4.413278 |
5a12fef4-f2bb-4073-8da7-7c043e08314e | PrasanBora/Leetcode | 0713-subarray-product-less-than-k/0713-subarray-product-less-than-k.cpp | class Solution {
public:
int numSubarrayProductLessThanK(vector<int>& nums, int k)
{
if (k <= 1)
return 0;
int product =1;
int left =0;
int right =0;
int subarray =0;
for( right = 0; right<nums.size();right++)
{
product *=... | ALGO | 0.99991 | 5.316932 |
b7c73957-a198-42c4-bab3-28a67468ecf3 | libsdl-org/Maelstrom | checksum.cpp |
/* Okay, here is a method of doing checksumming on ourselves.
We calculate a checksum over the text segment from the address
of main() to the end of the text segment (etext), and then
encrypt it and ascii armour it (base64) for transport.
Note, this is NOT foolproof, so don't rely on it for critical sof... | TOOL | 0.996415 | 6.055427 |
222f69a5-4b39-40fb-be34-bfcbb7dcf764 | JimiVainikainen/voronoi_demo | app.cpp | #include <iostream>
#include "app.h"
#include "SDL2/SDL.h"
#include <cstdlib>
#include <time.h>
#include <array>
#include "delaunator.hpp"
App::App()
{
isRunning = true;
}
int App::OnExecute()
{
if(OnInit() == false)
{
std::cout<<"Could not open window" << SDL_GetError() << std::endl;
retu... | TOOL | 0.866057 | 5.118263 |
50630acc-d535-4588-a0df-15471e6aff82 | veryloooong/cpp | project1/21.cpp | #include <iostream>
#include <stack>
#include <string>
bool is_pair(const char c1, const char c2) {
return (c1 == '(' && c2 == ')') || (c1 == '[' && c2 == ']') ||
(c1 == '{' && c2 == '}');
}
int main() {
std::stack<char> st{};
std::string s{};
std::cin >> s;
for (const char c : s) {
if (c == '... | ALGO | 0.998943 | 5.422544 |
b8a170b8-a4e7-4a12-a1cd-8843be6130ee | huxingyi/autoremesher | thirdparty/libigl/include/igl/arap_linear_block.cpp | template <typename MatV, typename MatF, typename Scalar>
IGL_INLINE void igl::arap_linear_block(
const MatV & V,
const MatF & F,
const int d,
const igl::ARAPEnergyType energy,
Eigen::SparseMatrix<Scalar> & Kd)
{
switch(energy)
{
case ARAP_ENERGY_TYPE_SPOKES:
return igl::arap_linear_block_spokes(... | ALGO | 0.998844 | 5.133471 |
60c3f105-5ddb-4cbb-9c74-2116efa8e774 | jignesh2320/android_system_core_lineage | init/host_init_verifier.cpp | #include "host_init_verifier.h"
#include <errno.h>
#include <getopt.h>
#include <pwd.h>
#include <stdio.h>
#include <stdlib.h>
#include <fstream>
#include <iostream>
#include <iterator>
#include <map>
#include <set>
#include <string>
#include <vector>
#include <android-base/file.h>
#include <android-base/logging.h>
... | TOOL | 0.894636 | 6.945087 |
aaa13fe7-1c07-429f-b90d-4f21150f405e | MarekBillington/Batteries_Not_Included | BatteriesNotIncluded/RakNet-master/DependentExtensions/cat/src/math/rtl/div/EatTrailingZeroes.cpp | #include <cat/math/BigRTL.hpp>
using namespace cat;
int CAT_FASTCALL BigRTL::EatTrailingZeroes(Leg *inout)
{
// Count number of trailing zero legs
int trailing_zero_legs = 0;
for (; trailing_zero_legs < library_legs && !inout[trailing_zero_legs]; ++trailing_zero_legs);
// Move out the zero legs
MoveLegsRight(ino... | ALGO | 0.938225 | 5.214065 |
30581273-b936-438f-be02-9fad90552e57 | face4/yukicoder | Level4/0317.cpp | #include<iostream>
#include<vector>
#include<map>
using namespace std;
// 簡易UF
struct UF{
vector<int> p;
int n;
UF(int siz){
n = siz;
p.resize(n, 0);
for(int i = 0; i < n; i++) p[i] = i;
}
int parent(int x){
if(p[x] != x) p[x] = parent(p[x]);
return p[x]... | ALGO | 0.999798 | 4.471461 |
31e02591-a978-4930-8bc6-d88cb559f4da | xtf0214/CPP | Contest/Nowcoder/37782/C.cpp | /**
* @file : C 区间操作
* @author : Tanphoon
* @date : 2023/05/19 00:14
* @version : 2023/05/19 00:14
* @link : https://ac.nowcoder.com/acm/contest/37782/C
*/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 4e6 + 5, INF = 0x3f3f3f3f, mod = 1e9 + 7;
template <typ... | ALGO | 0.999815 | 4.512923 |
4ac6bfae-7f85-445d-a587-b2c0483c0c8b | vinodpatildev/RV-DSA-CPP | Binary Trees/lec_15_bt_check_balanced.cpp | #include<bits/stdc++.h>
using namespace std;
struct Node{
int data;
struct Node* left;
struct Node* right;
Node(int val){
data = val;
left = right = NULL;
}
};
class Solution {
public:
int helper(Node* root){
if(root==NULL){return 0;}
int lh = helper(root->left)... | ALGO | 0.999985 | 5.779608 |
e006bba5-4da7-477c-ae50-431ed842ff0f | tony9402/ps-library | src/cpp/basic/fenwick_tree.cpp | /*
* Problem for Testing Template : https://www.acmicpc.net/problem/2042
* Test : Accepted
* Last Updated : 2023.04.01 03:12 PM (KST)
*/
template<typename T>
struct Fenwick{
vector<T> tree, input;
int siz;
Fenwick(){ }
Fenwick(int N){ setSize(N); }
void setSize(int N){
siz = N;
... | ALGO | 0.971165 | 3.677017 |
fd8997e4-c6c3-4005-8264-92025f1f2fe1 | andremazevedo/Leethub | 1051. Height Checker/1051.cpp | #include "../streamUtils.hpp"
using namespace std;
class Solution {
public:
int heightChecker(vector<int>& heights) {
int count = 0;
vector<int> expected = heights;
sort(expected.begin(), expected.end());
for (int i = 0; i < heights.size(); i++)
if (heights[i] != expe... | ALGO | 0.999874 | 5.734277 |
4c3c2992-5221-405c-94f2-dd83f92e0891 | QuiverDance/Algorithm | week5/3190.cpp | #include<iostream>
#include<queue>
#include<tuple>
using namespace std;
int n, k, l, ret;
int board[104][104];
queue<pair<int, int>> body;
queue<pair<int, char>> mv;
int dy[] = {0 , 1, 0, -1};
int dx[] = {1, 0, -1, 0};
int turn(int cur, char d){
switch (cur)
{
case 0:
if(d == 'L') return 3;
... | ALGO | 0.99996 | 3.654136 |
959b7ac0-62dc-47ba-aaa6-0fb3e73b66af | TianYF2020/OpenGL | OpenGLStudy/OpenGLStudy/lib/eigen-3.4.0/doc/examples/tut_arithmetic_redux_basic.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
int main()
{
Eigen::Matrix2d mat;
mat << 1, 2,
3, 4;
cout << "Here is mat.sum(): " << mat.sum() << endl;
cout << "Here is mat.prod(): " << mat.prod() << endl;
cout << "Here is mat.mean(): " << mat.mean() ... | ALGO | 0.999233 | 3.872858 |
77320116-1076-4bd3-896a-7c5b6886b6a4 | Lewuathe/mlir-hello | thirdparty/llvm-project/flang/lib/Decimal/decimal-to-binary.cpp | #include "big-radix-floating-point.h"
#include "flang/Common/bit-population-count.h"
#include "flang/Common/leading-zero-bit-count.h"
#include "flang/Decimal/binary-floating-point.h"
#include "flang/Decimal/decimal.h"
#include "flang/Runtime/freestanding-tools.h"
#include <cinttypes>
#include <cstring>
#include <utilit... | ALGO | 0.980311 | 7.059533 |
54a7f528-e349-4fa9-9036-d0f971852e81 | Hasil-Sharma/leet-code | reverse-string-1.cpp | // https://leetcode.com/problems/reverse-string/description/
class Solution {
public:
string reverseString(string s) {
int i = 0, j = s.length() - 1;
while(i < j){
swap(s[i++], s[j--]);
}
return s;
}
};
| ALGO | 0.999011 | 6.668576 |
d64aa43a-11a9-4a41-b089-dff9c9719e19 | harshitjaiin/LeetCode-Grinding | 0221-maximal-square/0221-maximal-square.cpp | class Solution {
public:
int maximalSquare(vector<vector<char>>& matrix) {
int n = matrix.size() , m = matrix[0].size();
vector<vector<int>> visited( n , vector<int> ( m , 0));
for(int i = 0 ; i<m ;i++){
visited[0][i]=matrix[0][i]-'0';
}
for(int i = 0 ; i<... | ALGO | 0.999821 | 6.202727 |
69a88ea1-c7d8-4e93-91f2-d8e98acd482b | DrSwad/CP | Submissions/Codeforces/1684/E_MEX_vs_DIFF.cpp | #include <bits/stdc++.h>
using namespace std;
template<typename T, class F = function<T(const T&, const T&)>>
class SegmentTree {
int n;
vector<T> a;
vector<T> st;
T st_default;
F merge;
F setval;
void build(int stI, int L, int R) {
if (L == R) {
st[stI] = a[L - 1];
return;
}
int... | ALGO | 0.999973 | 4.396467 |
ccd42867-aa87-4963-a80b-751c6ba2cc9b | SmartGroupSystems/Dsp-map-simulator | src/uav_simulator/so3_quadrotor_simulator/include/ode/libs/numeric/odeint/examples/my_vector.cpp | #include <vector>
#include <boost/numeric/odeint.hpp>
//[my_vector
template< int MAX_N >
class my_vector
{
typedef std::vector< double > vector;
public:
typedef vector::iterator iterator;
typedef vector::const_iterator const_iterator;
public:
my_vector( const size_t N )
: m_v( N )
{
... | ALGO | 0.954173 | 5.893738 |
357d83ac-9254-4d7b-a375-b1dd2e15ed8f | feifeiwei/LeetCode | 067.二进制求和/run.cpp | class Solution {
public:
string addBinary(string a, string b) {
string ret;
bool carry{false};
for(auto i=a.size(), j=b.size(); i||j||carry; )
{
bool a_bit{i && a[--i]=='1'};
bool b_bit{j && b[--j]=='1'};
ret = (a_bit ^ b_bit ^ carry ... | ALGO | 0.999979 | 6.358002 |
09714eb5-6886-44f9-b3ff-09a02d0be3b6 | tmdghks/Problem-Solving-tmdghks | BOJ/03_Gold/1717_집합의 표현/집합의 표현.cpp | // 1717 집합의 표현
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using LL = unsigned long long;
// pair
struct dt {
ll a; // current
ll b; // sum
};
// vector<pair>
using vdt = vector<dt>;
vll g;
ll find(ll n) {
if (g[n] == n)
... | ALGO | 0.999974 | 5.103152 |
06559e72-d6a3-4fe1-8d4a-de6cccb2d6a3 | arpitgpta/Competitive_Programming | exercising_walk.cpp | /*
*/
#include <bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL)
#define endl '\n'
#define int long long int
using namespace std;
#define pii pair <int, int>
#define pb push_back
#define deb(x) cout << #x << " " << x << endl
#define deb2(x, y) cout << #x << " " << x << " " << #y << " " <<... | ALGO | 0.99785 | 3.452467 |
805d467f-52fe-476f-ae51-0488294eb483 | ahadalireach/problem.solving | 0189-rotate-array/0189-rotate-array.cpp | class Solution {
public:
void rotate(vector<int>& nums, int k) {
int n = nums.size();
k = k % n;
reverse(nums.begin(), nums.end());
reverse(nums.begin(), nums.begin() + k);
reverse(nums.begin() + k, nums.end());
}
};
// Approach 1
// int n = nums.size();
// vector<int>... | ALGO | 0.999997 | 6.279846 |
750931f3-fc77-4ddc-a4d6-c4c72ba88ff8 | Emungai/mpc_fiveLink | casadi-linux-matlabR2014b-v3.5.1/include/casadi/core/repmat.cpp | #include "repmat.hpp"
#include "casadi_misc.hpp"
#include "serializing_stream.hpp"
using namespace std;
namespace casadi {
HorzRepmat::HorzRepmat(const MX& x, casadi_int n) : n_(n) {
set_dep(x);
set_sparsity(repmat(x.sparsity(), 1, n));
}
std::string HorzRepmat::disp(const std::vector<std::string>& ar... | TOOL | 0.996416 | 6.307388 |
83f357d9-7a10-4551-91f5-fafe383d00a4 | StolasIn/leetcode_Submissions | content/binary-prefix-divisible-by-5/Accepted/8-24-2021, 10_12_42 AM/Solution.cpp | // https://leetcode.com/problems/binary-prefix-divisible-by-5
class Solution {
public:
vector<bool> prefixesDivBy5(vector<int>& nums) {
vector<bool> ans;
long long int now=0;
for(int i=0;i<nums.size();i++){
now=now*2+nums[i];
if(now%5==0){
ans.emplace... | ALGO | 0.999881 | 5.835544 |
60b99711-7a56-43bd-8fde-f5a60f862370 | amangupta2486/Leetcode-problems-solutions | 437-path-sum-iii/437-path-sum-iii.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.999984 | 6.018847 |
62bd32aa-2c37-48e1-9a45-1db9901dd788 | ishandutta2007/codeforces | 1004535809/normal/903/G.cpp | #include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/hash_policy.hpp>
using namespace std;
//using namespace __gnu_pbds;
#define fi first
#define se second
#define fill0(a) memset(a, 0, sizeof(a))
#define fill1(a) memset(a, -1, sizeof(a))
#define fillbig(a) memset(a, 63, sizeof(a))
... | ALGO | 0.99998 | 3.856699 |
898e26e3-069d-43f5-bcbf-5d5094779afa | amanjha491/Leetcode_Solution | 2100-2199/2170.Minimum Operations to Make the Array Alternating/Solution.cpp | typedef pair<int, int> PII;
class Solution {
public:
int minimumOperations(vector<int>& nums) {
int ans = INT_MAX;
int n = nums.size();
for (auto& [a, n1] : get(0, nums))
for (auto& [b, n2] : get(1, nums))
if (a != b)
ans = min(ans, n - (n1 + ... | ALGO | 0.999945 | 5.362035 |
1eb76ef6-c307-403c-b3df-ca68c62ce9b6 | ishandutta2007/codeforces | froggyzhang/normal/1320/A.cpp | #include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
typedef long long ll;
#define N 1000060
inline int read(){
int x=0,f=1;
char c=getchar();
while(c<'0'||c>'9'){
if(c=='-')f=-1;
c=getchar();
}
while(c>='0'&&c<='9'){
x=(x<<3)+(x<<1)+c-'0';
c=get... | ALGO | 0.999573 | 3.180027 |
9929b007-b336-4ec2-b9d0-e2edf2a3cc4b | SweetCanella/ind | KR3_Task_3_EFBO-06-24_VARIANT_14.cpp | #include <iostream>
using namespace std;
int main(){
float a,b;
cin>>a>>b;
printf("%.2f",a-b);
return 0;
} | ALGO | 0.984781 | 3.017379 |
8e1a662e-c703-4e02-8986-244aa76e0875 | liemroym/competitive_programming | Codeforce/contest/780_div3/vasya_and_coins.cpp | #include <bits/stdc++.h>
using namespace std;
#define LL long long
#define ull unsigned long long
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define fo(i, s, n) for (LL i = s; i < n; i++)
#define INF 10e10+7
#define __gcd gcd // gcd(4, 6) = 2, gcd (30, 90) = 30, greatest common divisor
#define PI... | ALGO | 0.999641 | 3.938141 |
2d578c49-ce0d-4006-96ad-67f087bddbb3 | kmjp/procon | codeforce/751-800/788/a2.cpp | #include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define FORR2(x,y,arr) for(auto& [x,y]:arr)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define ... | ALGO | 0.9999 | 4.104337 |
86d41e53-33ff-4509-858c-b7eab31a10d8 | mirzafathan/CP-Solutions | SWC/residential search service/solution.cpp | #include<string.h>
#include<unordered_map>
#include<utility>
#include<queue>
#include<algorithm>
#include<set>
#include<iostream>
using namespace std;
#define MAX_N (3000)
int dist[MAX_N + 5][3];
unordered_map<int, vector<pair<int, int>>> adj;
int idx2id[MAX_N + 5];
unordered_map<int, int> id2idx;
unordered_map<int, ... | ALGO | 0.99985 | 3.72438 |
da85fa8f-6b0f-4c24-8979-f257c8fd073d | rclluo/problems_2025 | USACO/Silver/Rental_Jan18/Rental.cpp | /*
Sort the cows, and farmers in descending order.
Also sort the shops in descending order by the price of milk.
For each cow, if it can make more money by selling milk, sell it.
Else, rent it to a farmer.
*/
#include <bits/stdc++.h>
using namespace std;
int main() {
ifstream cin("rental.in");
ofstream cout(... | ALGO | 0.999882 | 4.279478 |
fa93df3f-8d0e-4efb-bdd8-0c277fdb01b3 | VedanttPandey/LeetCode | 0206-reverse-linked-list/0206-reverse-linked-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* reverseList... | ALGO | 0.999408 | 5.719379 |
79499c93-645a-4627-a90f-acff41af3252 | capnmav77/Core-Programming | STL/DSA/DP/Find the Longest Valid Obstacle Course at Each Position.cpp | /*
MY YOUTUBE VIDEO ON THIS Qn : https://www.youtube.com/watch?v=sUtUgMW2kMY
Company Tags : META
Leetcode Link : https://leetcode.com/problems/find-the-longest-valid-obstacle-course-at-each-position/
*/
//Approach-1 (Using LIS code) - O(n^2) - TLE
class Solution {
public:
v... | ALGO | 0.999954 | 6.520344 |
64cbebca-ca05-4d08-baeb-ffebedbc48e6 | NestinGrigoriy/Project | 1_course/18.11_deadline/seminar/sem.cpp | #include <iostream>
#include <string>
#include <math.h>
using namespace std;
int main() {
int razmer;
cin >> razmer;
int* arr = new int[razmer];
int maxx = 0;
int minn = pow(10, 9);
for (int i = 0; i < razmer; i++) {
cin >> arr[i];
maxx = max(maxx, arr[i]);
minn = min(minn, arr[i]);
}
string mx = "0";
fo... | ALGO | 0.999978 | 4.051116 |
2c671df4-9eaf-45cf-98bd-a9b03fe7aaa2 | Abstractmachina/pcl_converter_new | PCL_WRAPPER/Search.cpp | #include "Search.h"
namespace PCL_CLI {
array<int>^ PCL_CLI::Search::KdTreeKNNSearch(const int searchPtIdx,
PointCloudXYZ^ inputCloud, const int k, array<float>^% out_distances) {
auto pts = Convert_To_NativeFloatArray(inputCloud);
float* out_d = new float[k];
auto ks = PCL_CORE::Search::kdtree_knn_search... | ALGO | 0.998269 | 6.688603 |
21bdef6b-d3d0-4358-ab43-ddc3647ef149 | DoanTrungHuy/exercises-and-solutions-to-algorithmic-problems | Contest Codeforces by Colin Galen/Dynamic Programming/O.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll n, k;
const ll MN = 3e5;
ll a[MN];
int main() {
cin >> n >> k;
for (ll i = 0; i < n; ++i) {
cin >> a[i];
}
ll l = 0, r = 0;
ll sum_zero = 0;
ll max_len = 0, last_index_valid = 0;
while (r < n) {
if (a[r... | ALGO | 0.999977 | 3.968264 |
9e4a40c8-67d4-4c20-baee-706f85d21d33 | LisarWang/Tutorials-C | c1-2.cpp | #include <iostream>
using namespace std;
int max(int, int);
int max(int, int, int);
int main()
{
cout << max(35,25) <<","<<max(25,39,35) << endl;
return 0;
}
int max(int m1,int m2)
{
return (m1 > m2) ? m1:m2;
}
int max(int m1, int m2, int m3)
{
int t = max(m1,m2);
return max(t,m3);
} | ALGO | 0.998708 | 4.231482 |
b1864f00-e206-43d6-9d4c-17b131ba2ceb | mertturkmenoglu/cpp | src/stl/algorithm/Modifying/E012_ReplaceIf/main.cpp | /**
* replace_if() example
* g++ main.cpp -std=c++17 -Wall -Wextra -Wnon-virtual-dtor -pedantic -g -o main
* valgrind --leak-check=yes -v ./main
*/
#include <algorithm>
#include <iostream>
#include <iterator>
#include <vector>
int main() {
std::vector<int> vector = { 1, 1, 2, 3, 5, 8 };
std::copy(vector.b... | TOOL | 0.991702 | 4.64858 |
a06e459a-17f6-40dc-adab-e7a03a96f7d1 | pure-night/CodingTest | Project/Project/Programmers/Lv1/[PCCP 기출문제] 1번.cpp | #include <string>
#include <vector>
using namespace std;
int solution(vector<int> bandage, int health, vector<vector<int>> attacks) {
int answer = health;
int temp = 0;
for (int i = 0; i < attacks.size(); i++) {
if (i > 0)
temp = attacks[i][0] - attacks[i - 1][0] - 1;
else
... | ALGO | 0.999849 | 4.217885 |
5900c843-4b81-4e78-ae2e-9cf9fc6b3214 | arpitgpta/Algorithms | fibnn_dp_table.cpp | // g++ fibnn_dp_table.cpp -o fibnn_dp_table && ./fibnn_dp_table
/*
*/
#include <bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cerr.tie(NULL)
#define endl '\n'
#define ll long long int
using namespace std;
#define pii pair <ll , ll >
#define vin vector<int>
#define vll... | ALGO | 0.999925 | 3.739313 |
88a98e98-2f4c-4c45-a04c-af8df8978781 | philipplenk/adventofcode24 | 12/02.cpp | #include <iostream>
#include <iterator>
#include <string>
#include <vector>
int main(int argc, char* argv[])
{
struct point2d
{
int x, y;
};
std::vector<std::string> grid{std::istream_iterator<std::string>{std::cin}, {}};
const int width = grid[0].size();
const int height = grid.size();
std::vector<bool> v... | ALGO | 0.998416 | 5.336106 |
f380b534-7029-4c71-aa6e-4e109a55d2d1 | wilbefast/TP_Algorithmes_Distribues | naimi_trehel/SafeNaimiTrehelSite.cpp | #include "SafeNaimiTrehelSite.hpp"
#include <iostream>
#include <sstream>
#include <string> // for parsing messages
// pro-tip: use hash-defines to prevent typos from causing problems
#define ARE_YOU_ALIVE "are_you_alive"
#define I_AM_ALIVE "i_am_alive"
#define PREDECESSORS "predecessors"
#define ARE_YOU_BEFORE "... | ALGO | 0.972973 | 5.161336 |
08b1d88d-2ead-4450-9fe0-657c8a8d1fbe | shunya-fug/atcoder-cpp | contest/atcoder.jp/abc057/abc057_b/main.cpp | #include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; (i) < (int)(n); ++(i))
#define REP3(i, m, n) for (int i = (m); (i) < (int)(n); ++(i))
#define REP_R(i, n) for (int i = (int)(n)-1; (i) >= 0; --(i))
#define REP3R(i, m, n) for (int i = (int)(n)-1; (i) >= (int)(m); --(i))
#define ALL(x) ::std::begin(x), ::std::en... | ALGO | 0.999964 | 4.91973 |
830d9b16-e894-4d21-87d4-07d5b4f1b3e6 | LAGxHATER/CSCI-1010 | Practice/multiwayIf.cpp | #include<iostream>
using namespace std;
int main() {
int userNum;
char letterGrade;
if(userNum >= 90)
{
cout << "A";
}
else if(userNum >= 80)
{
cout << "B";
}
else if(userNum >= 70)
{
cout << "C";
}
else if(userNum >= 60)
{
cout <<... | ALGO | 0.990413 | 3.835741 |
efca5ad3-ead5-405e-8bf3-2dc505562f07 | Seunghui-Shin/Baekjoon | Hash/7785.cpp | #include <iostream>
#include <string>
#include <unordered_set>
#include <vector>
#include <algorithm>
using namespace std;
string name, record;
unordered_set<string> set;
int n;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cin >> n;
for (int i = 0;i < n;i++) {
cin >> name >> record;
... | ALGO | 0.998855 | 4.321387 |
54e55b5c-a707-475d-a0eb-3ea839dac9a6 | ishandutta2007/codeforces | noimi/normal/1141/C.cpp | #pragma region Macros
// #pragma GCC target("avx2")
#pragma GCC optimize("O3")
// #pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define rep2(i, a, b) for(ll i = a; i <= b; ++i)
#define rep(i, n) for(ll i = 0; i < n; ++i)
#define rep3(i, a, b) for(ll i = a; i >... | ALGO | 0.999949 | 3.68261 |
1e036b28-b561-4762-8d00-f1f7a3b10264 | RitujaMore/Logic_Building | program232.cpp | // accept n no from user .&& .count each digit from individual numbers
// problems on n numbers & // problems on digits
#include<iostream>
using namespace std;
class ArrayX
int CalculateDigits(int iNo)
// no of digits kiti te sangt
//Arr[i]...arr madhlyadigit ch count
// while... | ALGO | 0.994502 | 4.261277 |
701017b8-894b-4c3d-9ac3-6437378d8cc1 | Husainbw786/GeeksForGeeks | Top 450/Binary Search Tree/20. Check whether BST contains Dead End.cpp | bool isDeadEnd(Node *root)
{
//Your code here
map<int,int>mp;
queue<Node*>q;
q.push(root);
mp[0]++;
while(!q.empty())
{
Node* temp = q.front();
q.pop();
mp[temp->data]++;
if(mp.find(temp->data + 1) != mp.end() && mp.find(temp->data - 1) != mp.end())
{
... | ALGO | 0.999847 | 3.996973 |
53de1746-7669-472e-aeda-bb8995100fe8 | henriquechav/cpp-estruturada | class14/learn03.cpp | // minha aposta de saída:
// valor: 20
// soma: 20
#include <iostream>
using namespace std;
int main()
{
int valor = 10, *temp, soma = 0;
temp = &valor;
*temp = 20;
temp = &soma;
*temp = valor;
cout << "valor: " << valor << "\nsoma: " << soma;
cout << endl;
return 0;
}
| ALGO | 0.98779 | 3.320732 |
0a66fdb8-608e-45b6-884b-c3c3cb4ce88e | CodeMacrocosm/Algo-a-Thon | Algos/C++/swap numbers.cpp |
<#include iostream.h>
using namespace std;
int main()
{
int a = 5, b = 10, temp;
cout << "Before swapping." << endl;
cout << "a = " << a << ", b = " << b << endl;
temp = a;
a = b;
b = temp;
cout << "\nAfter swapping." << endl;
cout << "a = " << a << ", b = " << b << endl;
retur... | ALGO | 0.942546 | 3.031247 |
1e9cbb3c-7439-4703-a8c0-223a3ab55d40 | ishandutta2007/codeforces | itst/normal/1101/A.cpp | #include<bits/stdc++.h>
//This code is written by Itst
using namespace std;
inline int read(){
int a = 0;
char c = getchar();
bool f = 0;
while(!isdigit(c)){
if(c == '-')
f = 1;
c = getchar();
}
while(isdigit(c)){
a = (a << 3) + (a << 1) + (c ^ '0');
c = getchar();
}
retur... | ALGO | 0.999871 | 3.209021 |
ab419088-b602-4131-98dc-d32950b9a057 | HarshSandhu1111/DSA | SORTINGS/Untitled-1.cpp | #include<bits/stdc++.h>
using namespace std;
int getSecondOrderElements(int n, vector<int> a) {
// Write your code here.
int large= INT_MIN;
int secondlarge= INT_MIN;
for(int i=0;i<n;i++){
if(a[i]>large){
secondlarge =large;
large=a[i];
}
else if (a[i] > ... | ALGO | 0.999759 | 4.455606 |
8b7db1e1-0e05-4eea-910e-450b16727a12 | dhirajpatil2346/compitative | mech tests/2.cpp | #include <iostream>
using namespace std;
int main()
{
long long n;
cin >> n;
if (n == 1 || n == 2)
{
cout << n * n << endl;
}
else
{
long long a = n * n * n;
long long b = (n - 2) * (n - 2) * (n - 2);
cout << a - b << endl;
}
return 0;
} | ALGO | 0.999742 | 3.417088 |
9beeb8f4-566f-4559-b775-31210462fd9a | RodriguesAlonso/UNIVESP | Estruturas de dados/C++/HashColisões/main_hash.cpp | #include<iostream>
#include "hash.h"
using namespace std;
int main(){
Hash alunoHash(10);
int ras[7] = {
12704, 31300, 1234,
49001, 52202, 65606,
91234};
string nomes[7] = {
"Pedro", "Raul", "Paulo",
"Carlos", "Lucas", "Maria",
"Samanta"};
for (int i = 0; i < 7; i++)
... | ALGO | 0.981485 | 3.878749 |
bf7ee5de-5ac8-4d42-ad5e-d2edf9526a85 | InwooLeeme/Algorithm | Boj/1277.cpp | #pragma GCC target("avx,avx2,fma")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <ext/rope>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define fastio ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
using namespace std;
using name... | ALGO | 0.99993 | 4.226611 |
056ed905-4ebe-4cb4-aa11-aced37caee55 | alexfernandez0804/Laboratorio8 | bullet3-3.25/src/BulletCollision/Gimpact/btContactProcessing.cpp | #include "btContactProcessing.h"
#define MAX_COINCIDENT 8
struct CONTACT_KEY_TOKEN
{
unsigned int m_key;
int m_value;
CONTACT_KEY_TOKEN()
{
}
CONTACT_KEY_TOKEN(unsigned int key, int token)
{
m_key = key;
m_value = token;
}
CONTACT_KEY_TOKEN(const CONTACT_KEY_TOKEN& rtoken)
{
m_key = rtoken.m_key;
... | ALGO | 0.990968 | 5.085586 |
bd46507f-7830-4195-8dc5-dc2fcb230391 | NadineKharlamova/nxp_demo | rover_nxp/src/modules/land_detector/VtolLandDetector.cpp | /**
* @file VtolLandDetector.cpp
* Land detection algorithm for VTOL
*
* @author Roman Bapst <<EMAIL>>
* @author Julian Oes <<EMAIL>>
*/
#include <drivers/drv_hrt.h>
#include <matrix/math.hpp>
#include "VtolLandDetector.h"
namespace land_detector
{
void VtolLandDetector::_update_topics()
{
MulticopterLandDet... | TOOL | 0.891887 | 6.935816 |
29801418-f90d-45d7-93fb-296511b56009 | thanhtoan1742/CSES | String Algorithms/Finding Periods/main.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define ar array
#define sqr(x) ((x) * (x))
#define maximize(a, b) (a) = max((a), (b))
#define minimize(a, b) (a) = min((a), (b))
#define gb(a, n) (((a) >> (n))&1)
using namespace std;
using n... | ALGO | 0.999836 | 4.228526 |
63f72a30-a7f3-4f0d-8bb8-26ec5b9e614c | doviethung11192023/code_c_pluss_pluss_2 | liet ke uoc.cpp | #include <iostream>
using namespace std;
int main(){
long long n;
cin >> n;
long long count= 0;
for(int i= 1; i<= n;i++){
if(n%i==0){
count++;
}
}cout<<count<<"\n";
for(int i=1; i<=n; i++){
if(n%i==0){
cout<<i<< " ";
}
}return 0;
}
| ALGO | 0.999912 | 3.772525 |
f05512b9-78d4-4596-81c8-70142191b233 | raincross7/code-similarity | codes/train_code/problem338/problem338_370.cpp | #include<bits/stdc++.h>
#define speed_up ios_base::sync_with_stdio(false); cin.tie(NULL)
#define ll long long
#define ara(A,N) sort(A,A+N)
#define rev(A,N) sort(A,A+N,greater<long long>())
using namespace std;
int main()
{
speed_up;
ll n, i;
cin>>n;
ll gcd = 0;
while(n--)
{
cin>>i;
... | ALGO | 0.999766 | 3.38935 |
f55c2ea8-a79d-4775-b1fe-5b58b885ef1b | blackbird2003/acm_cpp | luogu_p1638_exihibition_of_paintings.cpp | //
// Created by vv123 on 2022/2/28.
//
#include <bits/stdc++.h>
#define init() ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;
const int N = 1e6 + 10, M = 2e3 + 10;
int a[N], cnt[M];
set<int> st;
int main() {
init();
int n, m;
cin >> n >> m;
for (int i = 1; i <= n; i++)
cin >> ... | ALGO | 0.999998 | 5.342947 |
159efa9d-9384-4026-949e-44d8847e4e07 | komaljot/Practice-GFG | Medium/Maximum Product Subarray/maximum-product-subarray.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
//User function template for C++
class Solution{
public:
// Function to find maximum product subarray
long long maxProduct(vector<int> nums, int n) {
// code here
long long ans=nums[0];
long long maxi=ans;... | ALGO | 0.999921 | 6.653943 |
72998922-6160-475b-b2ae-cb543909c5b0 | naringcode/algorithm-training | BaekjoonOnlineJudge/math/3474.cpp | #include <bits/stdc++.h>
using namespace std;
int t;
int n;
int res;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
cin >> t;
for (int i = 0; i < t; i++)
{
cin >> n;
res = 0;
while (n > 4)
{
res += n / 5;
... | ALGO | 0.999835 | 4.781664 |
0bd83949-29b6-4f47-bbc7-f2dc885d8124 | ShantoFlutterD/newApp | 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 |
d87a3161-1d66-44d2-ae48-820dc609158f | mrugalpatel07/Learning-Experiments | C++program/loop/table.cpp | #include<iostream>
using namespace std;
int main()
{
int i,n,mut=0;
cout<<"enter any number";
cin>>n;
for(i=1;i<=10;i++)
{
cout << n << " x " << i << " = " << n * i << endl;
}
return 0;
} | ALGO | 0.99276 | 3.376201 |
ad974f58-7374-4c78-8ebd-7f0da32e417c | iam1513/Competitive-Programming | Random CF/C016_D3_981_D.cpp | #include <bits/stdc++.h>
#define ll long long
#define pll pair<ll, ll>
#define vll vector<ll>
#define mll map<ll, ll>
#define sl set<ll>
#define sc set<char>
#define pb push_back
#define MOD 1000000007
#define PI 3.1415926535897932384626433832795
ll gcd(ll a, ll b)
{
if (b == 0)
return a;
return gcd... | ALGO | 0.999772 | 3.678148 |
9cbc0ac5-8fc8-42e5-9123-0fcda673900a | DyhaCreator/programming_tasks | CodeForcesRound/nar/sort/276C.cpp | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
using ll = long long;
const int INF = 1e9 + 7;
int main() {
int n, k;
cin >> n >> k;
vector<ll> a(n);
for (auto &x : a)
cin >> x;
vector<ll> d(n + 1, 0);
for (int i = 0; i < k; i++) {
int l, r;
... | ALGO | 0.999985 | 4.375937 |
5e9e137a-3e18-45ee-aecf-c56929806323 | wolverinezgit/cpsolutions | A_Nearest_Interesting_Number.cpp | #pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define S second
#define v vector
#define pob pop_back
#define pf push_front
#define mp make_pair
#define p... | ALGO | 0.9999 | 4.23097 |
78f25ded-fcc9-4656-b792-c11557e33023 | hit7sh/CodeForces | Round 700 div 2/A.cpp |
void solve() {
string s;
cin >> s;
int i;
f0(i, sz(s)) {
if (i&1) {
if (s[i] == 'z')
s[i] = 'y';
else s[i] = 'z';
} else {
if (s[i] == 'a')
s[i] = 'b';
else s[i] = 'a';
}
}
print(s);
}
| ALGO | 0.99917 | 3.065932 |
fff50593-35e3-4397-bae3-495a3f6770dd | CybrAdm/CPP | SwapCharacter.cpp | #include <iostream>
#include <cctype>
using namespace std;
string name = "cYBERaDAM"; // CyberAdam
int namesize = size(name);
int main()
{
cout << name << endl;
for (int i = 0; i < namesize; i++)
{
if (islower(name[i]))
{
cout << char(toupper(name[i]));
}
else
{
cout << char(tolo... | ALGO | 0.953052 | 3.624019 |
43de8442-2aa4-47d1-9739-7e6d1c43db27 | thanhdt-vietmap/vn_guide_app | vn_guide_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.997007 | 6.76775 |
c03f6698-ed0f-4ee9-9233-01cf58300ce4 | rogueprogrammer/LeetCode2019 | Concurrency/ReadWriteLockMOSTFAIR.cpp | #include <iostream>
#include <string>
#include <set>
#include <vector>
#include <algorithm>
#include <stack>
#include <unordered_set>
#include <unordered_map>
#include <utility>
#include <queue>
#include <math.h>
#include <map>
#include <cstdlib>
#include <cmath>
#include <bitset>
#include <mutex>
#include <condition_v... | ALGO | 0.966216 | 4.544459 |
617df8f3-e372-4e27-bdc4-d8ad5e61066d | KARMAKAR7/DailyLeetCode | 3475-minimum-operations-to-make-binary-array-elements-equal-to-one-i/minimum-operations-to-make-binary-array-elements-equal-to-one-i.cpp | class Solution {
public:
int minOperations(vector<int>& nums) {
int n = nums.size();
int ans = 0 ;
for(int i = 0 ; i< n-2 ; i++){
if(nums[i]==1) continue;
for(int j = i ; j <= i+2 ; j++){
nums[j] = nums[j]^1;
}
ans++;
}... | ALGO | 0.999958 | 5.489692 |
1fd694e6-fa55-430d-aa49-52bda7215460 | tuananhbk1998/expander | http/libs_ubuntu/lib_boost-1.78.0/libs/geometry/doc/src/examples/algorithms/discrete_frechet_distance_strategy.cpp | //[discrete_frechet_distance_strategy
//` Calculate Similarity between two geometries as the discrete frechet distance between them.
#include <iostream>
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/point.hpp>
#include <boost/geometry/geometries/linestring.hpp>
int main()
{
namespace bg = boo... | ALGO | 0.998974 | 7.199414 |
0c3ae071-70ca-48a7-beff-2797828cbc5d | HridoyHazard/SPOJ-Solutions- | Huge GCD.cpp | #include<stdio.h>
int gcd(int a,int b)
{
return b==0?a:gcd(b,a%b);
}
int main()
{
int n,m,i,j,fl=0;
scanf("%d",&n);
int arn[n];
for(i=0;i<n;i++) scanf("%d",&arn[i]);
scanf("%d",&m);
int arm[m];
for(i=0;i<m;i++) scanf("%d",&arm[i]);
long long int ans=1;
for(i=0;i<n;i++)
{
... | ALGO | 0.999954 | 3.455602 |
875cb346-d317-4ae9-b9e8-d27c70bd7a7c | Rushabhgadhiya9102/cpp-programming | lab-wrk-4/que-8.cpp |
// 1
// 2 3
// 4 5 6
// 7 8 9 10
// 11 12 13 14 15
#include <iostream>
using namespace std;
int main(){
int i, j , n=1;
for(i=1 ; i<=5; i++){
for(j=1; j<=i; j++){
cout << n << " ";
n++;
}
cout << endl;
}
return 0;
} | ALGO | 0.999558 | 3.68593 |
195f2b1a-8a8e-4b6d-9402-12c0d0f8e257 | ADIo6/Cpp-programming | CampusMonk(YT)/ibmQ2.cpp | // decimal to binary conversion
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
string b;
while (n>0)
{
b += ((n%2) + '0');
n /= 2;
}
reverse(b.begin(), b.end());
cout<<b;
} | ALGO | 0.99993 | 5.268163 |
301bce90-e2da-40ff-8e9f-29349820d275 | mohitkadwe19/geeksforgeeks-solution | Binary-Modulo.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution
{
public:
int modulo(string s, int m)
{
int res = 0;
for (int i = 0; i < s.length(); i++)
{
res = res * 2 + (s[i] - '0');
res %= m;
}
return res;
}
};
int main()
{
string str = "101";
int m = 2;
Solution ob;
cou... | ALGO | 0.999944 | 4.666799 |
9f010031-76e7-4e98-aa9e-70af043ccfdb | jerryhong21/comp4128 | interuni/counting.cpp | #include <iostream>
#include <vector>
#include <cmath>
#include <stack>
#include <tuple>
// #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vll> vvl;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef ... | ALGO | 0.999998 | 5.750359 |
13186493-8fe6-4705-b2bd-bf677e1d426a | gim-largerepo/including-investment-59GB | app/question.cpp | Simple firm any kind blue nor.
Field consumer nor.
Force help then plant bar.
This us million very chance floor.
Improve appear word control recent center figure.
Someone girl reason husband thank color.
Their threat very rise.
Feel city ok edge call.
Behind interest who laugh.
Method close network film product.
Area h... | TOOL | 0.944321 | 7.053023 |
cd34d107-7176-4356-8a0e-67e55d6ae4e0 | AntoninoScala/proteus | proteus/MeshAdaptPUMI/createAnalyticGeometry.cpp | #include <createAnalyticGeometry.h>
#include "MeshAdaptPUMI.h"
#include <ma.h>
#include <lionPrint.h>
//routines to create analytic sphere in a 3D box
agm_bdry add_bdry(gmi_model* m, gmi_ent* e)
{
return agm_add_bdry(gmi_analytic_topo(m), agm_from_gmi(e));
}
agm_use add_adj(gmi_model* m, agm_bdry b, int tag)
{
a... | ALGO | 0.996586 | 5.3003 |
9793ed17-02e5-4eb2-a2bb-fd022c10ff22 | pbeata/iga-auto | utilities.cpp | #include "utilities.h"
// NOTE: WE KEEP THE ABAQUS "1-BASED" NUMBERING SYSTEM
// FOR NODES AND ELEMENTS !!!
template <typename T>
void print(vector<T> &v)
{
const int n = v.size();
for (int i = 0; i < n; ++i) {
cout << v[i] << " ";
}
cout << endl;
}
template <typename ValueType>
int ReadLine... | TOOL | 0.866516 | 3.214679 |
9cc3ea3f-4bdc-4956-adad-9383f3dfd2f4 | ishandutta2007/codeforces | radewoosh/normal/1120/F.cpp | //~ while (clock()<=69*CLOCKS_PER_SEC)
//~ #pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
//~ #pragma GCC optimize("Ofast")
//~ #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//~ #pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/asso... | ALGO | 0.999809 | 3.431017 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.