uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
3914c161-c53a-461b-bfef-04d75121fccc | woodart8/Learning-Algorithm-CPP | 19237.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;
#define MAX_N 20
#define MAX_DIR 4
struct Shark {
int num;
int x;
int y;
int dir;
vector<vector<int>> priority;
bool operator<(const Shark &shark) const {
return num < shark.num;
}
}... | ALGO | 0.999968 | 4.136124 |
ba0d4413-67da-44bf-a264-038efa2901f6 | Italia2407/Mackerel-Engine | Mackerel-Core/ext/Eigen 3.4.0/doc/examples/Tutorial_simple_example_fixed_size.cpp | #include <Eigen/Core>
#include <iostream>
using namespace Eigen;
int main()
{
Matrix3f m3;
m3 << 1, 2, 3, 4, 5, 6, 7, 8, 9;
Matrix4f m4 = Matrix4f::Identity();
Vector4i v4(1, 2, 3, 4);
std::cout << "m3\n" << m3 << "\nm4:\n"
<< m4 << "\nv4:\n" << v4 << std::endl;
}
| ALGO | 0.954317 | 3.129515 |
8994e6e8-9295-47a6-943d-bc19db2617b5 | Tinky1224/CppLearning | codeforces/cf_1669F.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
int main(){
std::cout.sync_with_stdio(false);
std::cin.tie(nullptr);
int t;
std::cin >> t;
std::vector<int> res, w(200020);
while (t>0){
t--;
res.clear();
int n, a=0, b=0, p1, ... | ALGO | 0.99987 | 3.704716 |
63442bff-5f22-4881-a44f-a95f7e2e79f7 | QbitQuantum/Basics | Исходники/FastResampler_FirFilter_SSE2.cpp | void FastResampler_FirFilter2_C2_SSE2(unsigned int channels, unsigned int filter_length, float* coef1, float* coef2, float frac, float* input, float* output) {
Q_UNUSED(channels);
__m128 sum = _mm_setzero_ps();
__m128 v_frac = _mm_set1_ps(frac);
for(unsigned int i = 0; i < filter_length / 4; ++i) {
__m128 v_coef1... | ALGO | 0.997307 | 5.016753 |
b803f189-1bf5-41a8-8b6b-926b3a384ab7 | koralle/Cpp | study/Others/memolized_cut_rod.cpp | #include <iostream>
#include <vector>
#include <cmath>
using namespace std;
// トップダウン型DP
// e.g. vx = [1, 5, 8, 8, 9, 10, 17, 17, 20, 24, 30], n = 10
// -> return 30
int memolized_cut_rod(const vector<int> &v, const int n);
int memolized_cut_rod_aux(const vector<int> &v, const int n, vector<int> &r);
int memolized_cu... | ALGO | 0.999864 | 4.73873 |
20207d13-ae69-43fa-a6bb-fd662b65dfe9 | Dev1634/CodeBreaker | car.cpp | #include <iostream>
#include <vector>
#include <queue>
#include <set>
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
#define mg first
#define node second
const int INF = INT32_MAX;
int main() {
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int n, e; cin >> n >> e;
vector... | ALGO | 0.999904 | 4.004011 |
a8ca7837-4ddc-4842-98d2-bf56017c98ec | Jimmy-Sim/Competitive-Programming | Baekjoon/1700-멀티탭스케줄링.cpp | #include <iostream>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
int N, K;
cin >> N >> K;
int names[105];
for (int i = 0; i < K; i++) cin >> names[i];
int ans = 0, cnt[105] = {};
for (int i = 0; i < K; i++) {
b... | ALGO | 0.999966 | 4.451312 |
88378d80-e3f7-426d-9154-33315825c24b | dongyi-kim/10weeks-codingtest | chapter09/problem_a/main.cpp | #include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
class LIS {
public:
vector<int> memo; // DP 상태공간
vector<int> array; // 수열의 원소
int n; // 수열의 길이
LIS(vector<int> array) {
this->array = array;
this->n = array.size();
this->memo.assign(n, -1);
}
/**
... | ALGO | 0.999964 | 4.940721 |
cd72ebb7-5a5c-4c70-b746-98f86d631614 | Osasion/auc.cdt | eosio_llvm/lib/Transforms/Scalar/InstSimplifyPass.cpp | #include "llvm/Transforms/Scalar/InstSimplifyPass.h"
#include "llvm/ADT/DepthFirstIterator.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/AssumptionCache.h"
#include "llvm/Analysis/InstructionSimplify.h"
#include "llvm/Analysis/OptimizationRemarkEmitter.h"
#include "llvm/An... | TOOL | 0.850748 | 7.86026 |
c657343a-f641-4206-a137-1a2cfcdb7ebf | AvinandanBose/C_PLUS_PLUS_Beginner | 60thProgram_Example_16.cpp | /*******************
* Prime Numbers:A natural number that can be divided exactly only by itself and 1.
* Eg: 2,3,5,7, .... etc. 0 and 1 and negative numbers are not prime numbers.
****************************************************************/
#include <iostream>
using namespace std;
int main()
{
int a;
i... | ALGO | 0.999784 | 3.575577 |
9c227ff3-f6fd-4e3a-8d0a-5204d5cb3b05 | shilpade/LeetCode | Power of Two.cpp | class Solution {
public:
bool isPowerOfTwo(int n) {
if(n == 0)
return 0;
if(n == 1)
return 1;
if(n%2 == 0)
isPowerOfTwo(n/2);
else return 0;
}
}; | ALGO | 0.999683 | 6.120111 |
3bed5521-7920-42e0-a705-ae60873ee5c5 | himanshugupta09/LEETCODE_SOLUTIONS | Dynamic_Programming/new-21-game.cpp | class Solution {
public:
double new21Game(int n, int k, int maxPts) {
vector<double>dp(n+1);
dp[0] = 1;
double t = k > 0 ? 1: 0;
for(int i=1;i<=n;i++)
{
dp[i] = t/maxPts;
if(i < k)
{
t += dp[i];
}
... | ALGO | 0.999967 | 4.390568 |
8aebeb8b-d91e-447f-ac4a-2d6f9619ced8 | ishandutta2007/codeforces | aid/normal/1491/A.cpp | #ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif
#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
#ifdef DEBUG
#define eprintf(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#else
#define eprintf(...) ;
#endif
#define sz(x) ((int) (x).size())
#define TASK "text"
const int inf = (int) 1.01e9;
con... | ALGO | 0.999806 | 4.284379 |
75a26b6e-705d-49ee-b0e2-857405747fa4 | AnupamAwasthi2004/Leet_Code_Questions | 985.cpp | class Solution {
public:
vector<int> sumEvenAfterQueries(vector<int>& nums, vector<vector<int>>& queries) {
vector<int> res;
for(int i=0;i<queries.size();i++){
nums[queries[i][1]] = nums[queries[i][1]] + queries[i][0];
int sum = 0;
for(int j=0;j<nums.size();j++){
... | ALGO | 0.999943 | 6.225582 |
50b76eeb-6b7c-48ff-a521-66741e8b4211 | Sheena997/LeetCode-Practice | productExceptSelf.cpp | /*
238. 除自身以外数组的乘积
给你一个长度为 n 的整数数组 nums,
其中 n > 1,返回输出数组 output ,
其中 output[i] 等于 nums 中除 nums[i]
之外其余各元素的乘积。
示例:
输入: [1,2,3,4]
输出: [24,12,8,6]
提示:题目数据保证数组之中任意元素的全部
前缀元素和后缀(甚至是整个数组)的乘积都
在 32 位整数范围内。
说明: 请不要使用除法,且在 O(n) 时间复杂度内完成此题。
进阶:
你可以在常数空间复杂度内完成这个题目吗?
( 出于对空间复杂度分析的目的,输出数组不被视为额外空间。)
来源:LeetCode
链接:https://leetcode... | ALGO | 0.999966 | 5.943441 |
a6a8261c-f93e-435a-a79b-a6f746c19986 | whquddn55/Algorithm_BojSolves | 16000/16235.cpp | #include <bits/stdc++.h>
#pragma GCC target("avx2")
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template<typename a, typename b>
ostream& operator<<(ostream& os, const pair<a, b>& pai) {
os << pai.first << ' ' << pai.second;
return os;
}
template<typename a... | ALGO | 0.999787 | 4.021811 |
7a7e3f07-8d57-44c4-8775-e1091e26f490 | kaushal-09/Computer-Networks | CRC using Modulo-2.cpp | #include <stdio.h>
#include <conio.h>
int d[7], div[4], r[7];
void dn(int dd[]);
int main()
{
int i, f = 0;
long int a;
printf("-----SENDER'S SIDE-----\n\n");
printf("Enter code : ");
scanf("%ld", &a);
for (i = 3; i > -1; i--)
{
d[i] = (long)a % 10;
a = a / 10;
}
... | ALGO | 0.999694 | 3.026853 |
f13b52d8-0142-4073-921c-7635635ea44d | vikrant911998/CPPBatch10Reg | 18Jan2020/demo2.cpp | //Array of Objects
#include<iostream>
using namespace std;
class Student{
int id;
string name;
public:
void input(){
cout<<"Enter the ID"<<endl;
cin>>id;
cout<<"Enter the Name"<<endl;
cin>>name;
}
void output(){
cout<<"Id... | TOOL | 0.964231 | 3.902229 |
e22c374a-e332-4911-b057-2856684177d9 | mitasingh10332/Questions | Love Babbar DSA/Combination Sum IV(tab).cpp | int solveTab(vector<int> &num, int tar)
{
vector<int> dp(tar+1,0);
dp[0]=1;
for(int i=1;i<=tar;i++)
{
for (int j = 0; j < num.size(); j++)
{ if(i-num[j]>=0)
{dp[i]=dp[i]+ dp[i-num[j] ];}
}
}
return dp[tar];
}
int findWays(vector<int> &num, int tar)
{
int a... | ALGO | 0.999815 | 4.662107 |
45104ba6-81a3-43f3-95a9-21e4d54e06fe | poojawaghmare05/Native | program83.cpp | //Accept string and toggle upper to lower and lower to upper
#include<iostream>
using namespace std;
void strtoggleX(char str[])
{
while(*str != '\0')
{
if((*str >= 'A') && (*str <= 'Z'))
{
*str = *str + 32;
}
else if((*str >= 'a') && (*str <= 'z'))
{
... | ALGO | 0.876911 | 4.852686 |
f5214a6e-d72b-4a7c-aa5e-c8d8b5a2d139 | ANA-CNU/ANA-Daily-Algorithm | 김시온/20931.cpp | #include <bits/stdc++.h>
#define deb(x) cout << #x << " : " << (x) << "\n"
#define deb_pair(x, y) \
cout << "(" << #x << ", " << #y << ") : (" << (x) << ", " << (y) << ")\n"
#define deb_tuple(x, y, z) \
c... | ALGO | 0.999498 | 3.747231 |
2c06e03a-cfd2-4929-ae23-abc51746008c | puffyyy/coding | C++ code/course code/lanqiao/no.10/b.cpp | #include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
using namespace std;
typedef long long ll;
const int MS = 3e7 + 5;
int dp[MS] = {0, 1, 1, 1, 3};
int f(int x)
{
for (int i = 4; i <= x;... | ALGO | 0.999892 | 3.642699 |
02419ef7-7f93-457a-bbde-4394e5844f75 | mahfuz1703/Job-Interview-Preparation | Data Structures and Algorithms/1. Complexity Analysis/Practices/Count the Number of Set Bits.cpp | #include <bits/stdc++.h>
using namespace std;
// Time complexity: O(log n) // because we are shifting bits
// Space complexity: O(1) // no extra space used
int countSetBits(int n){
int cnt = 0;
while(n > 0){
cnt += (n & 1);
n >>= 1; // Right shift n by 1 bit
}
return cnt;
}
int main()... | ALGO | 0.999947 | 6.244477 |
d8df7927-b344-431d-9c55-0920671d7f42 | ManyaMittal05/DSALeetCode | 0017-letter-combinations-of-a-phone-number/0017-letter-combinations-of-a-phone-number.cpp | class Solution {
public:
void helper(string digits, int i, vector<string>& ans, string ds, unordered_map<int, string> mp){
if(i >= digits.length()){
if(ds != "")
ans.push_back(ds);
return;
}
int num = digits[i] - '0';
string alpha = mp[num];
... | ALGO | 0.999978 | 6.87331 |
3e4578b2-a877-4356-b87b-3111770b110d | yashk9293/Striver-A2Z-Sheet | Step 04 - Binary Search/Lec 2/01_Sqrt(x).cpp | // Question Link :- https://leetcode.com/problems/sqrtx/
// Sqrt(x)
// T.C: O(log n)
// S.C: O(1)
class Solution {
public:
int mySqrt(int x) {
// For special cases when x is 0 or 1, return x.
if (x == 0 || x == 1) {
return x;
}
int low = 1, high = x;
while (low ... | ALGO | 0.99997 | 6.108837 |
be7da927-14fb-4c9a-8027-8a8c144fa346 | ayushpratap27/DSA-NonStop | Strings/reverseOnlyLetters.cpp | #include<bits/stdc++.h>
using namespace std;
string reverseOnlyLetters(string s) {
int i = 0;
int j = s.size()-1;
while(i<=j){
if(isalpha(s[i]) && isalpha(s[j])){
swap(s[i],s[j]);
i++;
j--;
}
else if(!isalpha(s[i])){
i++;
}
... | ALGO | 0.999752 | 6.235328 |
b3dd7d04-4024-4b1f-9b14-3494d9924d99 | DLarisa/FMI-Materials-BachelorDegree-UniBuc | Algoritmi & Structuri Date (ASD)/Laborator/Teme/6-7/1. MergeSort.cpp | #include <iostream> //MergeSort
using namespace std;
void interclasare(int a[], int st, int m, int dr)
{
int c[100], i = st, j = m + 1, k = -1;
while (i <= m && j <= dr)
if (a[i] < a[j]) c[++k] = a[i++];
else c[++k] = a[j++];
while (i <= m) c[++k] = a[i++];
while (j <= dr) c[++k] = a[j++];
for (i = 0; i <= k; ... | ALGO | 0.999966 | 4.566322 |
48a7205a-3fbf-453d-b5d1-e8d3995ca03d | rsr180004/BRLCAD-UAT | brl-cad/brlcad/src/libged/help/help.cpp | #include "common.h"
#include <ctype.h>
#include <string>
#include "bu/app.h"
#include "bu/file.h"
#include "ged.h"
/**
* get a list of all the files under a given 'dir' filepath,
* dynamically allocated. returns the number of files found in an
* argv array that the caller must free via bu_argv_free().
*/
static... | TOOL | 0.910147 | 5.735531 |
f350d7f1-c3a4-4d41-b5e6-6358ae2723c8 | Showrov-CoU/Codeforces-Solution | A_Bovine_Dilemma.cpp | #include <bits/stdc++.h>
#define PI 2*acos(0.0)
#define ll long long int
#define ull unsigned long long int
#define MOD 1e9+7
#define endl ("\n")
#define vector vector<ll>
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/__gcd(a,b)))
#define fr(i,n)... | ALGO | 0.990954 | 4.1605 |
9c89c3f8-c935-4e2c-b5f9-ec994f265749 | MilindGupta-Creator/Competitive-Coding-Section | Algorithm/Knuth'sOptimization.cpp | int solve() {
int N;
... // read N and input
int dp[N][N], opt[N][N];
auto C = [&](int i, int j) {
... // Implement cost function C.
};
for (int i = 0; i < N; i++) {
opt[i][i] = i;
... // Initialize dp[i][i] according to the problem
}
for (int i = N-2; i >= 0; ... | ALGO | 0.999969 | 4.861714 |
0a8261f3-250b-4604-b036-4249fff12cc0 | pranavajith/CP-Practice | B_Timofey_and_cubes.cpp | #include <bits/stdc++.h>
#include <iostream>
#include <set>
#include <cmath>
#include <map>
#include <sstream>
#include <deque>
#include <queue>
#include <stack>
#include <algorithm>
#include <limits>
#include <iomanip>
using namespace std;
#define ll long long
ll mod = 1e9 + 7;
// #define TxtIO freopen("input.txt","... | ALGO | 0.999878 | 3.964855 |
d5aa1f77-a4ef-4297-8de9-fb61a80481b2 | jebbinj/leetcode-journey | 412_Fizz_Buzz/solution.cpp | class Solution
{
public:
vector<string> fizzBuzz(int n)
{
vector<string> result;
for (auto i = 1; i <= n; ++i)
{
if (i % 15 == 0)
result.push_back("FizzBuzz");
else if (i % 3 == 0)
result.push_back("Fizz");
else if (i ... | ALGO | 0.999784 | 6.989282 |
34508344-4a2e-4010-a659-199ae2909065 | BishWhite/UJ-ASD-2022 | lab2/DoubleLinkedList.cpp | #include<iostream>
template <typename T> class LinkedList{
struct cell{
T x = T();
cell* next = nullptr;
cell* prev = nullptr;
};
protected:
cell *head;
public:
LinkedList(){
this->head = nullptr;
}
void Insert(T x, cell*p){
if(head == nullptr){
... | ALGO | 0.999689 | 4.194096 |
aeda7bce-bc19-495e-861f-56a49f3d308e | sraesch/simple_3d_engine | Stuff/BSPBuilder/ENBSPBuilder.cpp | //---------------------------------------------------------------------------
#include "ENBSPBuilder.h"
//---------------------------------------------------------------------------
//////////////////////////////////////////////////////////////////////////
//// ENBSPPolygon
/////////////////////////////////////////////... | ALGO | 0.992074 | 3.498209 |
19463c2e-f65f-4833-8c05-c36c43934d1d | LonxunQuantum/Lammps_for_PWMLFF | lammps_neigh_mlff_20230508/src/BROWNIAN/fix_brownian_base.cpp | /* ----------------------------------------------------------------------
Originally modified from CG-DNA/fix_nve_dotc_langevin.cpp.
Contributing author: Sam Cameron (University of Bristol)
------------------------------------------------------------------------- */
#include "fix_brownian_base.h"
#include "com... | ALGO | 0.994681 | 7.485832 |
5fda8cc0-54e7-48b7-b9f8-b92337915c3e | diverse-project/samplingfm | tools/z3/src/util/lp/lp_primal_core_solver_instances.cpp | #include <utility>
#include <memory>
#include <string>
#include "util/vector.h"
#include <functional>
#include "util/lp/lar_solver.h"
#include "util/lp/lp_primal_core_solver.hpp"
#include "util/lp/lp_primal_core_solver_tableau.h"
namespace lp {
template void lp_primal_core_solver<double, double>::find_feasible_solutio... | ALGO | 0.99464 | 6.056962 |
a79abe53-2bbe-48f8-bc8b-6d4f8bb46d0c | Nithin-Rokkam/My_Files | CompetitveProgramming-master/Recursion/Factorial.cpp | #include<iostream>
using namespace std;
int factorial(int n){
if(n == 0){
return 1;
}
int small = factorial(n-1);
int big = n*small;
return big;
}
int main(){
int n;
cin >> n;
int result = factorial(n);
cout<<result;
} | ALGO | 0.999991 | 5.457232 |
7f304c42-2a51-4b51-b4cd-de8e4023a350 | boredcui/LeetCode | Medium/740.删除并获得点数.cpp | /*
* @Author: Boredcui
* @Date: 2022-03-03 20:38:17
* @LastEditors: Boredcui
* @LastEditTime: 2022-03-03 20:46:50
* @FilePath: \LeetCode\740.删除并获得点数.cpp
* @Description:
*
* Copyright (c) 2022 by boredcui, All Rights Reserved.
*/
/*
* @lc app=leetcode.cn id=740 lang=cpp
*
* [740] 删除并获得点数
*/
// @lc code=sta... | ALGO | 0.999668 | 5.852818 |
89375825-90f5-43d0-a0cf-60d1df4fddae | Joaquin05Pagano/Trabajos-laboratorio-orientada-a-objetos | juego de los pozos.cpp | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include <conio.h>
char tablero[10][10];
int posj[2]; // = {0, 0} -> tablero[0][0] = '0'
void mostrar_tablero(char tablero[10][10], int posj[2]) { //funcion del tablero (Imprime el tablero)
for (int i = 0; i < 10; i++) {
printf("+---+-+-... | ALGO | 0.995019 | 3.358081 |
497367ca-f531-4908-b920-de3109b70633 | aditya-singhal/code_dump | systemc/4_bit_adder/adder.cpp | #include <iostream>
#include "adder.h"
adder::adder(sc_module_name name) : sc_module(name),
single_bit_adder("single_bit_adder",4),
in1("in1"),
in2("in2"),
carry_in("carry_in"),
out("out"),
carry_out("carry_out") {
SC_HAS_PROCESS(adder);
SC_METHOD(ev... | TOOL | 0.965356 | 5.882132 |
2718b336-c7e9-47eb-8f50-1efabc3ad91d | PriyanshK09/Leetcode-Discord-Bot | solutions/concatenation-of-consecutive-binary-numbers.cpp | // Time: O(n)
// Space: O(1)
class Solution {
public:
int concatenatedBinary(int n) {
static int MOD = 1e9 + 7;
uint64_t result = 0, len = 0;
for (int i = 1; i <= n; ++i) {
if ((i & (i - 1)) == 0) {
++len;
}
result = ((result << len) % MO... | ALGO | 0.999997 | 6.812597 |
2330c5b0-3060-4106-af97-ecb51185411c | engulfing-marubozu/CodeForces_Streak | A_Face_Detection.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
ll row, col;
cin>>row>>col;
vector<string> vect;
for(ll i=0;i<row; i++)
{
string s ;
cin>>s;
vect.push_back(s);
}
ll res=0;
for(ll i=0; i<row-1; i++)
for(ll j=0; j<... | ALGO | 0.9996 | 3.977896 |
5dc261b4-3188-41bd-840f-e86af6583b19 | cangorur/human_robot_collaboration | code/despot_MDP_robot/src/pomdpx/pomdpx.cpp | #include <despot/pomdpx/pomdpx.h>
#include <despot/solver/pomcp.h>
using namespace std;
namespace despot {
/* =============================================================================
* POMDPXState class
* =============================================================================*/
POMDPXState::POMDPXState... | ALGO | 0.998238 | 6.600333 |
769808b0-10c9-4063-aea8-db5db33d6840 | seclab-ucr/IncreLux | llvm/llvm-9.0.0.src/lib/Transforms/Utils/FlattenCFG.cpp | #include "llvm/ADT/SmallPtrSet.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/Transforms/Utils/Local.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/InstrTypes.h"
#include "llvm/IR/Instruction.h"
#include "llvm/IR/Instructions.h"
#... | ALGO | 0.994941 | 7.587616 |
bd70ee66-92a6-4120-b0e6-8c5638fa3273 | Akatsuki-Coding-Club/Data-Structures-Algorithms-Akatsuki-Coding-CLub | CPP/Reverse_Integer.cpp | // File Name: Reverse_Integer.cpp
#include <iostream>
#include <climits>
class Solution {
public:
int reverse(int x) {
const int INT_MAX = 2147483647;
const int INT_MIN = -2147483648;
long long result = 0;
while (x != 0) {
int pop = x % 10;
x /= 10;
... | ALGO | 0.999378 | 6.465698 |
61da6385-fbd2-4953-bc73-543b695f40a7 | trueos/sysadm | src/bridge/main.cpp | #include <unistd.h>
#include <sys/types.h>
#include "BridgeServer.h"
#define DEBUG 0
#define USELOG 1 //turn this to "0" for dumping all output to the CLI (for debugging)
//Create any global classes/settings
QSettings *CONFIG = 0;
AuthorizationManager *AUTHSYSTEM = new AuthorizationManager();
QString SSLFILEDIR;
//... | TOOL | 0.866215 | 5.432736 |
80daab99-109c-467a-a20f-d73c7d56ca27 | Nolanbrrl/PROG_ALGO_S2 | TD6/src/node.cpp | #include <vector>
#include <algorithm>
#include <iostream>
#include "node.hpp"
Node* create_node(int value){
Node* noeud { new Node {value, nullptr, nullptr}};
return noeud;
}
bool Node::is_leaf() const{
if (Node::left == nullptr && Node::right == nullptr)
{
return true;
}
return fal... | ALGO | 0.998208 | 3.895068 |
ba0c77ac-db6f-48dd-9b0b-846c457e7877 | StackDoubleFlow/LLVMStackPU | libc/src/math/fmax.cpp | #include "src/__support/common.h"
#include "utils/FPUtil/BasicOperations.h"
namespace __llvm_libc {
double LLVM_LIBC_ENTRYPOINT(fmax)(double x, double y) {
return fputil::fmax(x, y);
}
} // namespace __llvm_libc
| ALGO | 0.977696 | 6.155942 |
21c1330e-5cb9-4a7d-b86e-df800c48d9c8 | Rkp420/gfg160 | Day77/n_queen.cpp | #include <iostream>
using namespace std;
// User function Template for C++
class Solution
{
public:
vector<vector<int>> ans;
bool isSafe(int row, int col, vector<int> &positions)
{
for (int prevCol = 0; prevCol < col; prevCol++)
{
int prevRow = positions[prevCol];
i... | ALGO | 0.999975 | 6.07682 |
173cd252-a61f-4390-8d63-41c39236ce3e | AbhishMB/Cpp_DSA_Solutions | C++ 1st innings/BEGINNING/switchC1.cpp | #include<iostream>
using namespace std;
int mian(){
int day;
cin>>day;
switch(day){
case 1:
cout<<"monday"<<endl;
break;
case 2:
cout<<"tuesday"<<endl;
break;
case 3:
cout<<"wed"<<endl;
break;
default:
cout<<"default case"<<endl;
}
return 0;
} | ALGO | 0.989716 | 3.201087 |
76a70e15-4e35-45e3-8489-81b263d2f40e | tushargandhi77/LeetCode | 1326.cpp | // rec + memo
class Solution {
public:
int N;
map<pair<int,int>,int> mp;
int solve(int idx,int maxEnd,vector<pair<int,int>>& range){
if(idx >= range.size()){
if(maxEnd >= N) return 0;
return 1e9;
}
if(range[idx].first > maxEnd) return 1e9;
if(m... | ALGO | 0.999946 | 5.847456 |
fa652727-2760-475b-a9a9-82e4c77abba9 | raincross7/code-similarity | codes/train_code/problem012/problem012_388.cpp | #include <bits/stdc++.h>
using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod= int(1e9)+7;
//const int mod=998244353;
using P = pair<int,int>;
using Pll = pair<ll,ll>;
using ld=long double;
int main() {
ll n,h;cin >>n>>h;
vector<l... | ALGO | 0.999965 | 4.140627 |
49e7d3f1-160b-4baf-84d3-975025c3e112 | nikhilmohite123/DSA-PRACTICE | 1D array/left_rotate.cpp | // Given an array of size N. The task is to rotate array by D elements where D ≤ N.
#include<iostream>
using namespace std;
void reverse(int *a,int s,int e){
while(s<e){
swap(a[s++],a[e--]);
}
}
void leftRotate(int arr[], int n, int d) {
// code here
d=d%n;
if(n==1)... | ALGO | 0.999984 | 5.226549 |
79f105b9-bea8-47ff-b2ee-ebb2d31945a4 | Wild-Donkey/Code | ZROJ/C1-C999/C975/A.cpp | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <vector>
#define Wild_Donkey 0
using namespace std;
inline unsigned RD() {
unsigned intmp(0);
char rdch(getchar());
while (r... | ALGO | 0.999828 | 3.575567 |
15c3900d-c9d7-4f20-a6d1-2af4b804f95a | jasveen18/CP-krle-placement-lag-jayegi | InterivewBit/15 Graphs/4SnakeLadders.cpp | /******************************************
* AUTHOR : ARPIT *
* NICK : arpitfalcon *
* INSTITUTION : BIT MESRA *
******************************************/
// Problem Statement - Snake and Ladders
int Solution::snakeLadder(vector<vector<int> > &A, vector<vector<int> > &B) {
vector<int> arr(102, 0);
for (aut... | ALGO | 0.999694 | 4.5689 |
f78a1c12-9eea-40f6-9730-e199ceedefb8 | anupma-Kumari57/Daily-LeetCode-Practise | 0852-peak-index-in-a-mountain-array/0852-peak-index-in-a-mountain-array.cpp | class Solution {
public:
int peakIndexInMountainArray(vector<int>& arr) {
int s=0, e=arr.size()-1;
while(s<e){
int mid=s+(e-s)/2;
if(arr[mid]<arr[mid+1]){
s=mid+1;
}
else{
e=mid;
}
}
... | ALGO | 0.999979 | 5.769814 |
eebc181f-b399-443d-9d35-7fcd2c1f8f04 | doocs/leetcode | solution/2100-2199/2113.Elements in Array After Removing and Replacing Elements/Solution.cpp | class Solution {
public:
vector<int> elementInNums(vector<int>& nums, vector<vector<int>>& queries) {
int n = nums.size(), m = queries.size();
vector<int> ans(m, -1);
for (int j = 0; j < m; ++j) {
int t = queries[j][0], i = queries[j][1];
t %= (n * 2);
if ... | ALGO | 0.999988 | 5.942136 |
2935a54f-283e-4c47-a4c8-a3b733a00be4 | krewli/EA | src/knapsack/knapsack_utility.cpp | #include "knapsack_utility.h"
#include "knapsack_item.h"
#include "knapsack_id.h"
#include <iostream>
#include <fstream>
#include <stdexcept>
namespace knapsack
{
Knapsack read_knapsack( const std::string& filename )
{
std::ifstream file { filename };
if ( !file )
{
throw std::runtime_error("Could n... | TOOL | 0.993699 | 6.262237 |
e7208985-e196-4e99-bbfe-2411bc19bb22 | cnavasca95/jdk8-hotspot | src/share/vm/opto/chaitin.cpp | #include "precompiled.hpp"
#include "compiler/compileLog.hpp"
#include "compiler/oopMap.hpp"
#include "memory/allocation.inline.hpp"
#include "opto/addnode.hpp"
#include "opto/block.hpp"
#include "opto/callnode.hpp"
#include "opto/cfgnode.hpp"
#include "opto/chaitin.hpp"
#include "opto/coalesce.hpp"
#include "opto/conn... | ALGO | 0.98596 | 4.52972 |
319920ae-bdd4-4974-ab0e-99b451f3f05c | IamA1ive/Table | TSortedArray.cpp | #include "TSortedArray.h"
TSortedArray::TSortedArray() : max(0), count(0), array(nullptr) {}
TSortedArray::TSortedArray(int _max) {
max = _max;
count = 0;
array = new TNode[max];
}
void TSortedArray::Sort() {
int i, j;
for (i = 1; i < count; i++) {
j = i;
while ((j > 0) && (array[j - 1].key > array[j].key)) {... | ALGO | 0.998003 | 4.38806 |
def4ba64-1e97-4892-a9a5-b0584473bcb8 | PurpleBionicle/Zero_knowledge_proof | realization/cpp/attacker.cpp | #include "../hpp/attacker.hpp"
std::vector<Point> Attacker::client_gives_initial_points() {
std::vector<Point> Y;
while (true) {
mpz_class coordinate_x;
mpz_class coordinate_y;
std::string str;
file >> str;
if (str != "0") {
mpz_set_str(coordinate_x.get_mpz_t... | ALGO | 0.885337 | 3.04339 |
e9e05973-4adb-49fe-8641-c03c820682a9 | CGAL/cgal-dev | Polynomial/examples/Polynomial/subresultants.cpp | #include <CGAL/Polynomial.h>
#include <CGAL/Polynomial_traits_d.h>
#include <CGAL/Polynomial_type_generator.h>
#include <CGAL/Exact_integer.h>
int main(){
CGAL::IO::set_pretty_mode(std::cout);
typedef CGAL::Exact_integer Int;
typedef CGAL::Polynomial_type_generator<Int,1>::Type Poly_1;
typedef CGAL::Polynom... | ALGO | 0.998781 | 4.772139 |
12e66d5f-666a-4338-a0f7-daa0be578f03 | lucasxia01/Competitive-Programming-Problems | Codeforces/Ed CF 131/D.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
#define F0R(i,n) for (int i = 0; i < n; i++)
#define FOR(i,a,b) for (int i = ... | ALGO | 0.999977 | 3.576008 |
5436be6a-a0c8-413a-a8bf-d468f94f6c54 | anas20023/Code-Forces | CFs/B_Just_Eat_It.cpp | //onAC(ALPHA) =>{Target Next ICPC ^-^}
// ^-^ ^-^ ^-^ ^-^ ^-^
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
template <typename T> using ordered_set = tree<T, null_type, less<T>, r... | ALGO | 0.999921 | 4.908695 |
600f42ac-b0c6-4d63-8f5f-3a8e37d59679 | IT22557292/tutorial03 | .ccls-cache/@home@runner@tutorial-2-1/exersise 1.cpp | #include <iostream>
#include <iomanip>
using namespace std;
int main() {
float marks[] = {78.4, 90.6, 45.9, 72.2, 54.4};
char names[][20] = {"Ajith", "Wimal", "Kanthi", "Suranji", "Kushmitha"};
cout << setw(5)<<"No" <<setw(15)<< "Name" <<setw(10)<<"Marks" << endl;
for (int r = 0; r < 5; r++) {
cout <<setw(5)<< se... | TOOL | 0.940518 | 3.378945 |
84a72aaa-9fa3-442a-81f2-912c6d747b12 | A-stick-bug/DMOJ | DMOPC '17 Contest 1 P4 - Quests.cpp | #include <bits/stdc++.h>
#define int long long
using namespace std;
const int inf = 1LL << 60;
signed main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int N, H;
cin >> N >> H;
vector<int> prev1(H + 1, -inf); // did not take previous set
vector<int> prev2(H + 1, -inf);
prev1[0] = ... | ALGO | 0.999532 | 4.048108 |
63d648ab-c67f-46c6-923c-117f7573dec2 | NalinDalal/codeforces | 585.1715B.cpp | /*B. Beautiful Array
time limit per test1 second
memory limit per test256 megabytes
Stanley defines the beauty of an array 𝑎
of length 𝑛
, which contains non-negative integers, as follows:
∑𝑖=1𝑛⌊𝑎𝑖𝑘⌋,
which means that we divide each element by 𝑘
, round it down, and sum up the resulting values.
Stanley told S... | ALGO | 0.999707 | 3.538159 |
428c1646-8c33-49a5-aee0-164382646ff1 | Samiul-Hossen-Sarkar-Santo/bus_tracker_user_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 |
2bf0df88-9c57-4c2c-87d3-fb1e391a4404 | insertfahim/Code-Library | Number Theory/Stirling Number of the Second Kind for Fixed n.cpp | #include<bits/stdc++.h>
using namespace std;
const int N = 1 << 18;
const int mod = 998244353;
const int root = 3;
int lim, rev[N], w[N], wn[N], inv_lim;
void reduce(int &x) { x = (x + mod) % mod; }
int POW(int x, int y, int ans = 1) {
for (; y; y >>= 1, x = (long long) x * x % mod) if (y & 1) ans = (long long) ans ... | ALGO | 0.999975 | 4.335079 |
9be49ab1-cebb-4536-a728-41ab52eafa11 | KharrazAdam/heckerrank_prepare | C++/medium/Virtual_Functions/Virtual_Functions.cpp | #include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
class Person {
public:
virtual void getdata() = 0;
virtual void putdata() = 0;
protected :
int age;
std::string name;
static int ids[2];
};
int Pers... | ALGO | 0.913032 | 3.497667 |
32530e4b-d46d-403f-bac2-04f5cddd67bf | leontalukdar/Codeforces | 659/C.cpp | #include <iostream>
#include <sstream>
#include <math.h>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <queue>
#include <cstring>
#include <ctype.h>
#define ll long long int
#define pii pair<int,int>
#define PI acos(-1.0)
using n... | ALGO | 0.999998 | 3.124365 |
d001c6b3-5000-45dd-b621-d696414a0ee7 | XzzX/mrmd | examples/SpartianLJ/SpartianLJ.cpp | #include <fmt/format.h>
#include <CLI/App.hpp>
#include <CLI/Config.hpp>
#include <CLI/Formatter.hpp>
#include <Kokkos_Core.hpp>
#include <fstream>
#include <iomanip>
#include <iostream>
#include "action/ContributeMoleculeForceToAtoms.hpp"
#include "action/LJ_IdealGas.hpp"
#include "action/LangevinThermostat.hpp"
#in... | ALGO | 0.988822 | 6.654428 |
44b2b69c-eed5-4ca4-ac9c-192d55554753 | muyuwood/homework | 第8次上机作业.cpp | #include<iostream>
#include<cstdio>
#include<bits/stdc++.h>
using namespace std;
class Poit
{
double x;
double y;
public:
Poit();
Poit(double n,double m);
Poit(const Poit& r);
double GetX();
double GetY();
void SetX(double ax);
void SetY(double ay);
void SwapPoint(double& xa,dou... | ALGO | 0.999571 | 3.335617 |
31d6de8c-55c0-4b93-87b8-a72294c920a7 | shAwmitrAcse134582/phitron_course | Algorithm/Moule-2.5/missing_number.cpp | class Solution {
public:
int missingNumber(vector<int>& nums) {
int x=nums.size();
int sum1=(x*(x+1))/2;
int sum2=0;
for(int i=0;i<x;i++){
sum2+=nums[i];
}
return sum1-sum2;
}
}; | ALGO | 0.999952 | 5.294455 |
0a2dcad3-7f79-45e9-ac23-a68b35ca159f | TLBlur-SGX/llvm-project | clang-tools-extra/clang-include-fixer/find-all-symbols/tool/FindAllSymbolsMain.cpp | #include "FindAllSymbolsAction.h"
#include "STLPostfixHeaderMap.h"
#include "SymbolInfo.h"
#include "SymbolReporter.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/ASTMatchers/ASTMatchers.h"
#include "clang/Frontend/CompilerInstance.h"
#include "clang/Frontend/FrontendActions.h"
#include "clang/Lex/Pre... | TOOL | 0.97001 | 7.606348 |
8dc4ca44-3114-4007-9e36-bd634141f1dc | ODINGAH001/HackerMan | Algorithm/time-conversion.cpp | #include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <iomanip>
using namespace std;
int main() {
/* Enter your code here. Read input from STDIN. Print output to STDOUT */
int h,m,s;
char c;
std::stringstream ss;
scanf("%d:%d:%d... | ALGO | 0.97094 | 4.133845 |
7e0e760d-300a-404c-982c-f8b361a96236 | Tahsin005/Leetcode | Leetcode daily challanges/72_day_of_the_year.cpp | #include<bits/stdc++.h>
#define ll long long
using namespace std;
/*
https://leetcode.com/problems/day-of-the-year/
*/
class Solution {
public:
int dayOfYear(string date) {
string d = date.substr(8, 2);
int dd = stoi(d);
string m = date.substr(5, 2);
int mm = stoi(m);
str... | ALGO | 0.999384 | 5.138972 |
c284fa3d-a715-4205-a94f-56f1bb09e185 | unl-nimbus-lab/phys | data/mannu_local_eklavya/controls/controls/src/vs_pid.cpp | #include <ros/ros.h>
#include <std_msgs/Float64.h>
#include <stdio.h>
#include <fcntl.h>
#include <std_msgs/Float32.h>
#include <controls_msgs/encoder_msg.h>
#include <std_msgs/Int32.h>
#include <geometry_msgs/Twist.h>
#include <cmath>
#include <mutex>
#include "BlackPWM.h"
#include <cstdint>
std::mutex Vs_t_lock, Alp... | ALGO | 0.982376 | 4.802629 |
39065da2-56ee-4498-b22b-6a41f3475b27 | yangtengleo/DeepSPIN | lammps_DeepSPIN/src/OPENMP/npair_half_bin_newton_omp.cpp | // clang-format off
#include "omp_compat.h"
#include "npair_half_bin_newton_omp.h"
#include "npair_omp.h"
#include "neigh_list.h"
#include "atom.h"
#include "atom_vec.h"
#include "molecule.h"
#include "domain.h"
#include "my_page.h"
#include "error.h"
using namespace LAMMPS_NS;
/* -----------------------------------... | ALGO | 0.997905 | 6.245244 |
236e1ec1-2058-4efe-bcb4-4115faad5674 | pgm26/WorkBook | collatz_omp.cpp | #include <cstdio>
#include <algorithm>
#include <sys/time.h>
static int collatz(const long range, const int threads)
{
// compute sequence lengths
int maxlen = 0;
#pragma omp parallel for num_threads(threads) default(none) reduction(max:maxlen) SCHED
for (long i = 1; i <= range; i += 2) {
long val = i;
... | ALGO | 0.999537 | 5.156214 |
1d0ae6ae-e276-4392-9425-76e1e0c04e62 | d13k03/ZeroTier-QUIC | node/CertificateOfOwnership.cpp | /****/
#include "CertificateOfOwnership.hpp"
#include "RuntimeEnvironment.hpp"
#include "Identity.hpp"
#include "Topology.hpp"
#include "Switch.hpp"
#include "Network.hpp"
#include "Node.hpp"
namespace ZeroTier {
int CertificateOfOwnership::verify(const RuntimeEnvironment *RR,void *tPtr) const
{
if ((!_signedBy)||(... | TOOL | 0.859115 | 4.484991 |
a9a4ea04-cfc4-43ad-8a7c-c066d868471b | TheProjecter/project-qtcreator | src/libs/3rdparty/botan/src/stream/turing/turing.cpp | #include <botan/turing.h>
#include <botan/loadstor.h>
#include <botan/xor_buf.h>
namespace Botan {
namespace {
/*
* Perform an N-way PHT
*/
inline void PHT(MemoryRegion<u32bit>& buf)
{
u32bit sum = 0;
for(u32bit j = 0; j < buf.size() - 1; ++j)
sum += buf[j];
buf[buf.size()-1] += sum;
sum = buf[b... | ALGO | 0.998891 | 6.378997 |
d8192f1a-9a9a-4b13-87a8-d137b451ae15 | wavescholar/numerical_libraries | MatLib/fdistr.cpp | #include "fdistr.h"
double fdistribution(int a, int b, double x)
{
double result;
double w;
ap::ap_error::make_assertion(a>=1&&b>=1&&ap::fp_greater_eq(x,0), "Domain error in FDistribution");
w = a*x;
w = w/(b+w);
result = incompletebeta(0.5*a, 0.5*b, w);
return result;
}
double fcdistribu... | ALGO | 0.998556 | 6.099779 |
bb55f208-9cce-48c6-b697-812af26390fb | TuanTran0168/CPP-BASIC-OU | VS Code/C++/nháp/nhap2.cpp | #include <iostream>
using namespace std;
void ham_NhapMang(int a[], int &Maxsize);
void ham_XuatMang(int a[], int Maxsize);
void ham_XoaPhanTuTrongMang(int a[], int &Maxsize, int &k);
void ham_ThemPhanTuTrongMang(int a[], int &Maxsize, int &x, int &k);
void ham_Xoa(int a[], int &Maxsize, int &k);
void ham_XoaTrung(int ... | TOOL | 0.999083 | 3.469448 |
28230fdf-9b91-40ff-9b34-600c8083ad23 | Coding1610/DSA | Stack/Stack_Implementation_Using_Array.cpp | #include<bits/stdc++.h>
using namespace std;
// Push
void push( int stack[] , int *top , int value , int size ){
if( *top >= size ){
cout << "Stack Is Overflow !!" << endl;
}
else{
(*top)++;
stack[*top] = value;
cout << "pushed => " << value << endl;
}
}
// Pop
void ... | ALGO | 0.998146 | 3.70213 |
5df61feb-f90c-4091-bae5-2f77886938e2 | nina-sanchez/ACM-W | debugging.cpp | #include <iostream>
using namespace std;
int main() {
int user-input;
int sum = 0
// using a for loop to get numbers from the user 5 times
for (i = 0; i < 5; ++i) {
cout << "Enter a number: ";
cin >> userInput;
// add the entered number to the sum
sum += number:
}... | ALGO | 0.99201 | 3.024302 |
1a8a0b6b-6431-4e5f-a0f2-40cbd12b9856 | xuyongzhi/Automatic-As-built-Reconstruction | maskrcnn_benchmark/csrc/cpu/ROIAlign_cpu.cpp | // implementation taken from Caffe2
template <typename T>
struct PreCalc {
int pos1;
int pos2;
int pos3;
int pos4;
T w1;
T w2;
T w3;
T w4;
};
template <typename T>
void pre_calc_for_bilinear_interpolate(
const int height,
const int width,
const int pooled_height,
const int pooled_width,... | DATA | 0.983841 | 6.540604 |
33780d4d-2f2e-45c3-8c1c-102ce42e0963 | Aditya21102001/DSAPractice | Move all zeroes to end of array - GFG/move-all-zeroes-to-end-of-array.cpp | // { Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
//User function template for C++
class Solution{
public:
void pushZerosToEnd(int arr[], int n) {
int i=0, j=0;
while(j<n)
{
if(arr[j]>0)
{
swap(arr[j], arr[i]);
i++;
... | ALGO | 0.999662 | 5.747903 |
3efd82ae-a52b-43c6-adba-0a15bab75679 | DarkTerror/LaPosadaDelOcio | dep/tbb/src/tbb/spin_rw_mutex.cpp | #include "tbb/spin_rw_mutex.h"
#include "tbb/tbb_machine.h"
#include "itt_notify.h"
#if defined(_MSC_VER) && defined(_Wp64)
// Workaround for overzealous compiler warnings in /Wp64 mode
#pragma warning (disable: 4244)
#endif
namespace tbb {
template<typename T> // a template can work with private spin_rw_mut... | TOOL | 0.941097 | 7.227855 |
b4a4c11f-2d37-48da-b684-a52686cf37cf | Shashankiitr/Nongamba- | Codeforces/B_Summation_Game.cpp | #include <bits/stdc++.h>
#define int long long
using namespace std;
void solve(){
int N, K, X, sum = 0; cin >> N >> K >> X; vector<int> A(N); for(auto &a : A) cin >> a;
sort(A.begin(), A.end()); int end = N-X;
vector<int> pref_sum(N);
pref_sum[0] = A[0];
for(int i = 1 ; i < N ; i++){
pref_sum[i] = pref_sum[i-1] ... | ALGO | 0.999689 | 4.5354 |
a37e3f56-f01b-44b2-a112-73e510e0d380 | CGAL/cgal-dev | Arrangement_on_surface_2/examples/Arrangement_on_surface_2/unb_planar_vertical_decomposition.cpp | //! \file examples/Arrangement_on_surface_2/vertical_decomposition.cpp
// Performing vertical decomposition of an arrangement.
#include <list>
#include <CGAL/Arr_vertical_decomposition_2.h>
#include "arr_linear.h"
using Cell_type = std::variant<Vertex_const_handle, Halfedge_const_handle,
... | ALGO | 0.999346 | 5.986225 |
d673bbe9-8b4f-4316-8916-c12c51848e4c | KarthikNedunchezhiyan/competitive-programming-solutions | solutions/leetcode/medium/00848-Shifting-Letters/solution_prefix_sum.cpp | class Solution {
public:
string shiftingLetters(string s, vector<int> &shifts) {
for (int i = 1; i < shifts.size(); i++) shifts[i] = (shifts[i] % 26) + shifts[i - 1];
for (int i = 0; i < s.length(); i++)
s[i] = 'a' + (s[i] - 'a' + (i ? (shifts.back() - shifts[i - 1]) : shifts.back())) %... | ALGO | 0.999949 | 6.264211 |
1aa53039-ef1f-42c4-9135-6a9113a22529 | narendrakumar5264/DSA | patterns/pattern5.cpp |
#include<iostream>
#include<conio.h>
#include<stack>
#include<stdlib.h>
using namespace std;
int main()
{
system("cls");
int n;
cout<<"enter your number";
cin>> n;
int value;
for(int i=i;i<=n;i++)
{
for (int j=1;j<=i;j++){
value=i;
cout<<value<<" ";
value=... | ALGO | 0.999905 | 3.409294 |
f2633a05-3200-4998-bcff-c2c4ee7958ce | nitish-sharma1/leetcode-daily | 2579-count-total-number-of-colored-cells/2579-count-total-number-of-colored-cells.cpp | class Solution {
public:
long long coloredCells(int n) {
long long ans =1+ (long long)2*(n-1)*n;
return ans ;
}
}; | ALGO | 0.999945 | 4.688432 |
67bea74e-d6f7-42a7-b22a-84d594424763 | himanshumahajan138/Leetcode | 2415-count-the-number-of-ideal-arrays/count-the-number-of-ideal-arrays.cpp | const int mod = 1e9 + 7;
int factMemo[100000] = {};
int dp[100000][15];
using ll = long long;
class Solution {
public:
ll power(ll a, ll b, ll m = mod) {ll res = 1;while (b > 0) {if (b & 1)res = (res * a) % m;a = (a * a) % m;b = b >> 1;}return res;}
ll fact(ll n) {
if (n == 0) return 1;
if (factMemo... | ALGO | 0.99996 | 5.368255 |
b166782c-ebe0-464d-ac27-b60e1e5cf484 | jinwu99/Structured-Variational-Inference-for-Bayesian-Variable-Selection | SVI for BVS (20230628)/Code (논문에서 시뮬레이션 섹션)/rcpp/SVI_EXACT.cpp | #include <Rcpp.h>
#include <random>
#include <RcppEigen.h>
using namespace Rcpp;
using namespace Eigen;
// [[Rcpp::depends(RcppEigen)]]
void nzero_zero_idx(const VectorXd& cov_mem, VectorXd& nzero_idx, VectorXd& zero_idx, const int& P){
int nz = 0;
int z = 0;
for(int j=0; j<P; j++){
if(cov_mem(j)==1){
... | ALGO | 0.999655 | 6.675853 |
e5540810-b3d0-4a8b-a3b5-38a638340eca | Warawreh/CP-Library | Contests/GCJ/2/f.cpp | #include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define fast ios::sync_with_stdio(false);cin.tie(0);
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int order(vector<int> arr, int la... | ALGO | 0.999919 | 3.950073 |
9187f1e7-ddeb-4777-8114-5b42a7139dff | Orboro/cs372.barkley | include/ExpTree.cpp | //
// File: ExpTree.cpp
// Author: <EMAIL>
// Purpose:
// Use the tree class from lecture to build an expression tree. By intent, we
// don't use inheritance here as we're using the Tree rather than extending it.
//
#include <stack>
#include <string>
#include <iostream>
#include "Tree.h"
using namespace std;
using T... | ALGO | 0.986815 | 5.487364 |
21406d45-28bc-44cb-9eda-57ed50c23308 | ishandutta2007/codeforces | zemen/normal/1696/F.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
const int N = 100;
bitset<N> d[N][N];
using Graph = vector<vector<int>>;
void dfs(const Graph& g, vector<int>& dist, int u, int prev = -1, int d = 0) {
dist[u] = d;
for (int v : g[u]) {
if (v != prev) {
dfs(g, d... | ALGO | 0.999989 | 4.708656 |
7060a40c-b163-46c5-8331-789d37f180c6 | Hayessolo/Bitcoin-core | bitcoin/src/crypto/poly1305.cpp | #include <crypto/common.h>
#include <crypto/poly1305.h>
#include <string.h>
namespace poly1305_donna {
// Based on the public domain implementation by Andrew Moon
// poly1305-donna-32.h from https://github.com/floodyberry/poly1305-donna
void poly1305_init(poly1305_context *st, const unsigned char key[32]) noexcept ... | ALGO | 0.99798 | 7.291689 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.