uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
b3da3a99-b206-4046-883c-f94acec0fede | justdotheg/Algorithm | 알고리즘/프로그래머스/Level1/크레인 인형뽑기 게임/크레인 인형뽑기 게임.cpp | #include <string>
#include <vector>
#include <iostream>
using namespace std;
int solution(vector<vector<int>> board, vector<int> moves) {
//재구성
vector<vector<int>> v(board.size());
for(int i=0;i<board.size();i++){
for(int j=board.size()-1;j>=0;j--){
if(board[j][i] != 0) v[i].push... | ALGO | 0.999641 | 5.18713 |
d16c4089-78f4-4b9c-9ba1-bde921ba782f | Aspetto33/leetcode | c++/剑指Offer29.顺时针打印矩阵/剑指Offer29-顺时针打印矩阵.cpp | class Solution {
public:
vector<int> spiralOrder(vector<vector<int>>& matrix) {
vector<int> result;
if(matrix.size() == 0) return result;
int rt = 0;
int rb = matrix.size() - 1;
int cl = 0;
int cr = matrix[0].size() - 1;
while(1){
for(int i = c... | ALGO | 0.999998 | 6.430602 |
a0517bcb-6306-43ff-b830-3287f2fb21db | SabarishMN/codePractice | 1894-merge-strings-alternately/merge-strings-alternately.cpp | class Solution {
public:
string mergeAlternately(string word1, string word2) {
int i=0;
int j=0;
string result = "";
int count = 0;
while(i<word1.length() && j<word2.length()) {
if(count%2==0)
{
result += word1[i];
... | ALGO | 0.999975 | 5.943284 |
17b30207-a2c9-4872-9488-cf2e219397c2 | 731676158/Octree | 3rdparty/pcl_for_ubuntu/tools/marching_cubes_reconstruction.cpp | #include <pcl/PCLPointCloud2.h>
#include <pcl/io/pcd_io.h>
#include <pcl/io/vtk_io.h>
#include <pcl/surface/marching_cubes_hoppe.h>
#include <pcl/surface/marching_cubes_rbf.h>
#include <pcl/console/print.h>
#include <pcl/console/parse.h>
#include <pcl/console/time.h>
using namespace pcl;
using namespace pcl::io;
using... | ALGO | 0.98269 | 6.56499 |
663eb953-e175-4066-8e35-4b74de9193e8 | AtharvaPanegai/CppLearning | Functions/Fibonacci/program.cpp | #include<bits/stdc++.h>
using namespace std;
void fibonacci(int num){
int t1 = 0;
int t2 = 1;
int nextTerm;
for (int i = 1; i <=num; i++)
{
cout<<t1<<endl;
nextTerm = t1+t2;
t1 = t2;
t2=nextTerm;
}
return;
}
int main(){
int n;
cin>>n;
fib... | ALGO | 0.999972 | 4.169352 |
1cf1f5c9-202e-422d-ad80-80a7cff306b5 | ellisaveta/FMI-SDA | Merge.cpp | #include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
void merge(vector<int>& arr, int l, int mid, int r) {
vector<int> left;
vector<int> right;
for (int i = l; i <= mid; i++) {
left.push_back(arr[i]);
}
for (int i = mid + 1; i <= r; i++) {
right.push_back(arr[i]);
}
int i = 0;
... | ALGO | 0.999987 | 5.136943 |
c33e8264-4414-4b79-99a4-4ba9f15039a9 | LLSwillow/cpp.study | 5.26/circle.cpp | #include <iostream>
using namespace std;
// 判断点和圆的位置关系,涉及到两个不同类的对象,所以创建两个类
class point
{
public:
void setx(int x)
{
my_x = x;
}
int getx()
{
return my_x;
}
void sety(int y)
{
my_y = y;
}
int gety()
{
return my_y;
}
private:
int my_x;... | ALGO | 0.999113 | 3.969676 |
8432d6a0-8005-46aa-81d8-089d5d884def | Oriburger/problem_solving_1w3solve | BOJ/17390_이건꼭풀어야해.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
int n, q, ans=0;
vector<int> a, b, s;
cin>>n>>q;
a.resize(n, 0);
b.resize(n, 0);
s.resize(n, 0);
for(int i=0; i<n; i++)
{
cin>>a[i];
b[i]=a[i];
}
... | ALGO | 0.999955 | 4.099737 |
8dee6c24-80bc-42ce-83b3-93bb4b2d43ca | AntCPLab/malicious_3pc_binary | FHEOffline/PairwiseSetup.cpp | /*
* PairwiseSetup.cpp
*
*/
#include <FHEOffline/PairwiseSetup.h>
#include "FHE/NoiseBounds.h"
#include "FHE/NTL-Subs.h"
#include "Math/Setup.h"
#include "FHEOffline/Proof.h"
#include "FHEOffline/PairwiseMachine.h"
#include "FHEOffline/TemiSetup.h"
#include "Tools/Commit.h"
#include "Tools/Bundle.h"
#include "Proce... | TOOL | 0.878074 | 6.191817 |
dc9beeb8-fce2-4773-bec0-07ce48ae23f5 | jmontgomery/EBMAforecast | samplers/logitGibbs.cpp | #include <Rcpp.h>
using namespace Rcpp;
// [[Rcpp::export]]
IntegerVector oneMultinomCalt(NumericVector probs) {
int k = probs.size();
IntegerVector ans(k);
rmultinom(1, probs.begin(), k, ans.begin());
return(ans);
}
// [[Rcpp::export]]
NumericVector getRGamma(double shape) {
RNGScope scope;
NumericVecto... | ALGO | 0.999662 | 5.860932 |
d108922d-6c35-4283-9242-7b1c3fe93772 | MaggieLee01/Coding | 16_01_DoublePower/DoublePower.cpp | //实现函数double Power(double base, int exponent),求base的exponent次方。不得使用库函数,同时不需要考虑大数问题。
//来源:https://leetcode-cn.com/problems/shu-zhi-de-zheng-shu-ci-fang-lcof
//-100.0 < 底数 < 100.0, 指数是32位有符号整数,其数值范围是[−2^31, 2^31 − 1] 。
//小数问题//负指数问题
//负指数问题可以通过abs()绝对值函数,abs()函数的处理类型为int;long int labs (long int n);
//如何得到double函数的小数点位,这... | ALGO | 0.998458 | 5.399661 |
f5aa9ad3-c734-40bb-a324-fd6c30b3f8bb | simulationcoin/ycash | src/rpc/mining.cpp | #include "amount.h"
#include "chainparams.h"
#include "consensus/consensus.h"
#include "consensus/validation.h"
#include "core_io.h"
#ifdef ENABLE_MINING
#include "crypto/equihash.h"
#endif
#include "init.h"
#include "main.h"
#include "metrics.h"
#include "miner.h"
#include "net.h"
#include "pow.h"
#include "rpc/server... | WEB | 0.994907 | 5.724424 |
26ca278f-7dfe-4fab-a2e8-7b41a563ea86 | gihwanJang/Algorithm | cpp/Baekjoon10844/Baekjoon10844.cpp | #include<iostream>
using namespace std;
int main(int argc, char const *argv[]){
int n, mod = 1000000000;
long ans = 0, table[101][11];
scanf("%d", &n);
table[1][0] = 0;
fill(table[1]+1, table[1]+10, 1);
for(int i = 2; i <= n; ++i)
for(int j = 0; j <= 9; ++j){
if(j == 0) tab... | ALGO | 0.999932 | 5.056445 |
9c48b953-9e69-4873-b2f3-12918bd7b9a2 | Rohit138270/cpp-programs | factorial.cpp | //Factorial of given number using loops
#include<iostream>
using namespace std;
int main(){
int i,num,fact=1;
cout<<"Enter the number..."<<endl;
cin>>num;
for(i=1;i<=num;i++){
fact = fact * i;
}
cout<<"Factorial of "<<num<<" is "<<fact;
}
| ALGO | 0.999905 | 3.14905 |
2319c26d-6eb1-4ad7-bf16-c39bc06f8787 | Trietptm-on-Coding-Algorithms/online-judge | codeforces/276/c.cpp | #include <iostream>
#include <algorithm>
#include <utility>
#define MAX_N 200005
using namespace std;
int N, Q, l, r;
int a[MAX_N];
int seg[MAX_N];
int freq[MAX_N];
int main() {
cin >> N >> Q;
for (int i = 0; i < N; i++) {
cin >> a[i];
}
sort(a, a + N, greater<int>());
for (int i = 0; i <... | ALGO | 0.99997 | 4.365149 |
f1b85709-7fcf-4d05-a43f-a77ca2ce173a | ishandutta2007/codeforces | enanimant/normal/1196/D2.cpp | // July 24, 2019
// https://codeforces.com/contest/1196/problem/D1
// https://codeforces.com/contest/1196/problem/D2
/*
Same code for both subtasks.
*/
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
#ifdef _DEBUG
freopen("input.txt", "r", stdin)... | ALGO | 0.999629 | 4.900126 |
2734f0f0-9124-47b8-ac33-069e7294e8b6 | raincross7/code-similarity | codes/train_code/problem226/problem226_42.cpp | #include <bits/stdc++.h>
using namespace std;
bool isVacantRange(int i, string s, pair<int, string> LR) {
if((i - LR.first)%2 == 0) {
if(s == LR.second) return false;
else return true;
} else {
if(s != LR.second) return false;
else return true;
}
}
int main() {
int n;... | ALGO | 0.999526 | 4.056129 |
374a4e8d-c560-46b9-86e4-d5c02d8809e8 | ercodex/Object-Oriented-Programming-Exercises | multipleInheritance.cpp | #include <iostream>
using namespace std;
class Base{ // Base
protected:
int member;
public:
Base(){
cout << "Base Constructor" << endl;
}
~Base(){
cout << "Base Destructor" << endl;
}
};
// Make ---> class Base1 : virtual public Base
class Base1 : public Base{ // Derived from Base
... | TOOL | 0.907895 | 5.945956 |
a1b73439-454d-45ab-9685-57f1c8a5cda8 | johnlees/rapidnj | src/simpleNJ.cpp | /*A simple implementation of the neighbour-joining method*/
#include "stdinclude.h"
#include "simpleNJ.h"
#include "float.h"
using namespace std;
void printMatrix(distType** matrix, int size);
void printArray(distType* a, int size);
int countersim = 0;
simpleNJ::simpleNJ(distMatrixReader* reader, int matrixSize, bo... | ALGO | 0.999782 | 5.882656 |
33b5c926-e994-4fad-bf54-7febc3000a90 | 0-jij-0/CompetitiveProgramming | Problems Archive/1000 - 1999/1331 - Slimes.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
using namespace std;
typedef long long ll;
ll dp[400][400]; vector<ll> v;
inline ll query(int i, int j) { return i ? v[j] - v[i - 1] : v[j]; }
int main() {
int n; cin >> n; v.resize(n);
for (auto &x : v) { cin >> x; }
partial_sum(v.begi... | ALGO | 0.999972 | 3.589736 |
3c550707-cc32-464a-8e4e-6d06c2d4bc77 | PrathmeshRS/Data-Structures-and-Algorithms | Arrays/Leaders.cpp | // Program to find leader elements from a array
// an element is a leader if there is no element which is greater or equal to it's right
/*
IP : arr[] = {7, 10, 4, 3, 6, 5, 2}
OP : 10, 6, 5, 2
IP : arr[] = {10, 20, 30}
OP : 30
IP : arr[] = {30, 20, 10}
OP : 30, 20, 10 */
#include<iostream>
using namespace std;
/*... | ALGO | 0.99997 | 4.238743 |
b8cff98c-fde0-435a-a579-a76e4340834b | jungh150/PS | baekjoon/28088.cpp | #include <iostream>
#include <vector>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n, m, k;
cin >> n >> m >> k;
vector<bool> a(n, false);
vector<bool> b(n, false);
for (int i = 0; i < m; i++) {
int x;
cin >> x;
b... | ALGO | 0.999997 | 4.118633 |
5e9e1de9-78dd-4923-a132-39f4740c6605 | trixirt/magma | magmablas/blas_zbatched.cpp | /*
-- MAGMA (version 2.0) --
Univ. of Tennessee, Knoxville
Univ. of California, Berkeley
Univ. of Colorado, Denver
@date
@precisions normal z -> s d c
@author Ahmad Abdelfattah
Implementation of batch BLAS on the host ( CPU ) using OpenMP
*/
#include "magma_intern... | ALGO | 0.883729 | 6.225461 |
e8176ab1-4adb-48c5-92a8-e4418efa098f | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_6166_5.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
string s[n], t, k;
string mid = "", first, last, res;
for (int i = 0; i < n; i++) cin >> s[i];
for (int i = 0; i < n - 1; i++) {
t = s[i];
reverse(t.begin(), t.end());
if (t == s[i]) {
if (t.size() > mid.si... | ALGO | 0.999971 | 3.729683 |
0cd096a3-c45c-4755-a543-ece93e203930 | lucatardella/PLMIX | src/quickintsample.cpp | # include <Rcpp.h>
# include "fittingmeasure.h"
using namespace Rcpp;
//' Weighted sampling without replacement from a finite urn
//'
//'
//' @param n Number of distinct integer-labeled balls in the urn.
//' @param size Number of balls sampled without replacement.
//' @param prob Numeric vector of length \eqn{n} probab... | ALGO | 0.999816 | 6.436481 |
8ba58470-ec70-4ddb-a721-2a40cc41df57 | virajs213/ProgramsPractice | Logic Building Program/program230.cpp | #include<iostream>
using namespace std;
void DisplayHexadecimal(int iNo)
{
int iDigit = 0;
char Arr[] = {'A','B','C','D','E','F'};
cout<<"Hexadecimal conversion of : "<<iNo<<"is : "<<"\n";
while(iNo != 0)
{
iDigit = iNo % 16;
if(iDigit <= 9)
{
cout<<iDigit; ... | ALGO | 0.99088 | 3.736757 |
b8150aa2-2bc5-4401-852e-b9f0cac15ad9 | shivamxverma/cses-solution | cses-trainee/Grid_Paths_I.cpp | // Jai shree Ram
// Shivam verma
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
#include <iostream>
#include <set>
#include <map>
using namespace std;
// some common Defination
const long long INF = LLONG_MAX;
#define ll long long int
#define all(v) (v).begin(), (v).end()
#define rall(v) ... | ALGO | 0.999968 | 4.21345 |
b193b78e-4e56-4523-808a-03f84cbbcc90 | Dorshir/dorshir | cpp/src/palantir/vigenère_decryptor.cpp | #include "vigenère_decryptor.hpp"
#include <cstddef> // for size_t
#include <string>
#include <algorithm>
namespace palantir {
VigenereDecryptor::VigenereDecryptor(std::string const& keyword)
: m_keyword{keyword}
{}
std::string VigenereDecryptor::encode(std::string const& message) const
{
std::string result = m... | ALGO | 0.9262 | 6.276767 |
61abf7a4-26f9-4b09-8deb-34335b007a76 | k-kavya-28/OOPS-fundamentals | LAB5a/q1.cpp | #include <iostream>
using namespace std;
class number
{
int arr[200];
int n;
public:
void read()
{
cout << "Enter the no. of elements :";
cin >> n;
cout << "Enter the numbers: " << endl;
for (int i = 0; i < n; i++)
{
cin >> arr[i];
}
}
... | ALGO | 0.990832 | 4.900309 |
f73271b1-a538-4094-b809-2ebf75337e67 | sandeshprasai/C-_BE_Second_SEM | reverseofnumberusingfriendfunction.cpp | #include<iostream>
using namespace std;
class reverse{
int number;
public:
friend reverse ffunction(reverse r);
void setnumber(int num)
{
number=num;
}
};
reverse ffunction(reverse r)
{
int rem,sum=0;
while(r.number>0)
{
rem=r.number%10;
sum=(sum*10)+rem;
r.number=r.numb... | ALGO | 0.999175 | 4.414021 |
24038c3c-9639-4142-865d-3614f7a23fb0 | AbinayaSakthivel13/DSA-LeetCode-solutions | 900-reordered-power-of-2/reordered-power-of-2.cpp | class Solution {
public:
bool reorderedPowerOf2(int n) {
string s=to_string(n);
sort(s.begin(),s.end());
for(int i=0;i<31;i++){
int power=1<<i;
string p=to_string(power);
sort(p.begin(),p.end());
if(s==p)
return true;
}
... | ALGO | 0.999328 | 5.963644 |
51790c94-0d6e-4733-a891-aaa6fbdac246 | fdj32/fork_samples | cppreference/w/cpp/algorithm/replace_copy.cpp | #include <algorithm>
#include <vector>
#include <iostream>
#include <iterator>
int main()
{
std::vector<int> v{5, 7, 4, 2, 8, 6, 1, 9, 0, 3};
std::replace_copy_if(v.begin(), v.end(),
std::ostream_iterator<int>(std::cout, " "),
[](int n){ return n > 5; }, 99);
... | ALGO | 0.999969 | 4.68651 |
1d5a1b38-7660-4aac-ab77-db4d21895317 | ishandutta2007/codeforces | hogloid/normal/83/B.cpp | #include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<vector>
#define REP(i,m) for(int i=0;i<m;++i)
#define REPN(i,m,in) for(int i=in;i<m;++i)
#define ALL(t) (t).begin(),(t).end()
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define dump(x) cerr << #x << " =... | ALGO | 0.999985 | 3.185223 |
0c73b342-3a44-4439-899e-b75860d0f646 | jaxxzer/ardupilot-rov | libraries/Filter/examples/Derivative/Derivative.cpp | /*
* Example sketch to demonstrate use of DerivativeFilter library.
*/
#include <AP_HAL/AP_HAL.h>
#include <Filter/Filter.h>
#include <Filter/DerivativeFilter.h>
const AP_HAL::HAL& hal = AP_HAL::get_HAL();
DerivativeFilter<float,11> derivative;
// setup routine
void setup(){}
static float noise(void)
{
... | ALGO | 0.94425 | 6.394028 |
f8a02e05-364e-4d42-baa9-eb062aad96f6 | raincross7/code-similarity | codes/train_code/problem356/problem356_73.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
int n;
int a[300005];
int cnt[300005],qzh[300005];
signed main() {
scanf("%lld",&n);
for(int i=0; i<n; i++) {
scanf("%lld",a+i);
cnt[a[i]]++;
}
sort(cnt,cnt+n+1);
for(int i=1; i<=n; i++) {
qzh[i]=qzh[i-1]+cnt[i];
}
for(int i=1; i<=n; i++... | ALGO | 0.999958 | 3.647921 |
060199ae-956f-48b7-ab53-b24fbda8f6ca | youtube-programmercpp/Y211219 | q13254109568_multbl/sample_6.cpp | #include <stdio.h>
int main()
{
int i = 1;
do {
int j = 2;
printf("%d̒i\n%d~1%d", i, i, i);
do
printf("A%d~%d%d", i, j, i * j);
while (++j <= 9);
putchar('\n');
}
while (++i <= 9);
}
/*
https://detail.chiebukuro.yahoo.co.jp/qa/question_detail/q13254109568
1249827098
2021/12/18 14:24
1
C++ł̃vO~OR[hɂ‚... | ALGO | 0.990885 | 3.535836 |
0a49761d-88b3-42b9-b845-935dd8353685 | usc-isi/llvm | libc/fuzzing/stdlib/qsort_fuzz.cpp | #include "src/stdlib/qsort.h"
#include <stdint.h>
static int int_compare(const void *l, const void *r) {
int li = *reinterpret_cast<const int *>(l);
int ri = *reinterpret_cast<const int *>(r);
if (li == ri)
return 0;
else if (li > ri)
return 1;
else
return -1;
}
extern "C" int LLVMFuzzerTestOneI... | TEST | 0.981006 | 5.395842 |
71b37e29-2b61-4371-9019-96e031c844b5 | tahdiislam/xpsc | contest/PC_03_d3/A_Prefixes.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin >> n;
string s;
cin >> s;
int cnt = 0;
for (int i = 0; i < n - 1; i += 2)
{
if (s[i] == s[i + 1])
{
cnt++;
if (s[i] == 'a')
s[i + 1] = 'b';
else
... | ALGO | 0.999938 | 3.419899 |
c61ac844-69af-40c7-95bc-30fbd368ae8f | oxygen-hunter/Flashboom | data/big-vul-100/add_attention_code/Phi/top0-100/double-modular-exponentiation-Solution.getGoodIndices/177768_DoS.cpp | sparse_dump_region (struct tar_sparse_file *file, size_t i)
{
union block *blk;
off_t bytes_left = file->stat_info->sparse_map[i].numbytes;
if (!lseek_or_error (file, file->stat_info->sparse_map[i].offset))
return false;
while (bytes_left > 0)
{
size_t bufsize = (bytes_left > BLOCKSIZE) ? BLOCKS... | TOOL | 0.984861 | 6.433943 |
bf388357-6927-408f-82dc-2d6a3239b271 | channyHuang/MyMatlabLib | Dependent/gptoolbox-master/mex/point_mesh_squared_distance.cpp | #include <mex.h>
#undef assert
#define assert( isOK ) ( (isOK) ? (void)0 : (void) mexErrMsgTxt(C_STR(__FILE__<<":"<<__LINE__<<": failed assertion `"<<#isOK<<"'"<<std::endl) ) )
#include <igl/matlab/MexStream.h>
#include <igl/matlab/mexErrMsgTxt.h>
#include <igl/matlab/parse_rhs.h>
#include <igl/point_mesh_squared_dist... | ALGO | 0.998482 | 5.83722 |
1682ac31-b610-4ff0-93d3-2da3d3b6d525 | HardenedBSD/hardenedBSD-stable | contrib/llvm/lib/CodeGen/SafeStack.cpp | #include "SafeStackColoring.h"
#include "SafeStackLayout.h"
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/AssumptionCache.h"
#include "llvm/Analysis/BranchProbabilityInfo.h"
#include ... | TOOL | 0.886423 | 4.316676 |
42a94029-efe7-4ce5-988b-abdd9bf5b122 | AndrewKapok/code | luogu/P1596.cpp | #include <cstdio>
int n, m, fx[] = {0, 1, 1, 1, 0, -1, -1, -1}, fy[] = {1, 1, 0, -1, -1, -1, 0, 1};
bool map[101][101];
void dfs(int x, int y)
{
for (int i = 0; i < 8; i++)
{
int xx = x + fx[i], yy = y + fy[i];
if (1 <= xx && x <= n && 1 <= yy && yy <= m && map[xx][yy])
{
map... | ALGO | 0.999777 | 3.508528 |
3b7594f4-a959-4f9b-b5c4-0306e2d8d925 | manikanta2901/ubuntu | .history/SRM/elab/DataStructures/Assignment_20201103182724.cpp | #include<iostream>
using namespace std;
// taking input
struct Input{
char FirstName[30],LastName[30];
int Age,Year;
};
struct QueueNode{
Input taken;
QueueNode* next;
QueueNode(Input person){
taken = person;
}
};
struct Queue{
QueueNode *rear,*front;
void enqueue(In... | ALGO | 0.86914 | 3.323844 |
27a51d15-6e9d-416b-8666-dca29ef5b142 | FardeenAz/Competitive-Programming-Solves | CodeChef/C++/Counting Primes .cpp | #include<bits/stdc++.h>
using namespace std;
#define mx 10000009
typedef long long ll;
vector < int > primes;
void sieveOfEratosthenes()
{
bool flag[mx+1];
for(int i=0 ; i<=mx ; i++)
flag[i]=true;
primes.push_back(2);
flag[0]=flag[1]=false;
for(int i=4 ; i<=mx ; i+=2)
{
fl... | ALGO | 0.999705 | 3.866842 |
5866a560-bec5-4f6c-986d-be4eb81697d0 | ishandutta2007/codeforces | agua_podrida/normal/1654/D.cpp | #include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<vvvi> vvvvi;
using ll = long long;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vvll> vvvll;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<vvc> v... | ALGO | 0.999863 | 4.803855 |
defbca33-2a6a-4f48-8ff7-265e3387a1c4 | nguyenhoang4875/CompetitiveProgramming | Spct/bruteforce/G.cpp | #include <bits/stdc++.h>
#define int long long
using namespace std;
vector<int> v[1005];
int a[1005];
int tcs, n;
void solve() {
cin >> n;
for(int i = 1; i <= n; i++) {
cin >> a[i];
}
int ans = 0;
for(int k = 1; k <= n; k++) {
int i = a[k];
int temp = a[k];
int l ... | ALGO | 0.999754 | 5.066085 |
840873cb-339d-46a1-9db9-ddea9420d6f4 | ishandutta2007/codeforces | sergeyrogulenko/normal/74/A.cpp | #pragma comment(linker, "/STACK:60000000")
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <ctime>
#include <cstring>
#include <cassert>
#include <sstream>
#include <iomanip>
#include ... | ALGO | 0.99891 | 3.248148 |
d22ae425-8815-4c12-8209-be0d742cbc2d | Galian5/cpp_algorithms | spojne_skladowe.cpp | #include <iostream>
#include <iomanip>
using namespace std;
// Typy dla dynamicznej tablicy list ssiedztwa i stosu
struct slistEl
{
slistEl * next;
int v;
};
class stack
{
private:
slistEl * S; // lista przechowujca stos
public:
stack(); // konstruktor
~stack(); // destruktor
b... | ALGO | 0.999798 | 4.854722 |
2a3c62e5-c924-4876-963f-d4ae9387f466 | KinshukBhatia29/DSA-in-CPP | link list/circulli.cpp | #include <iostream>
using namespace std;
class Node
{
public:
int data;
Node * next;
//constructor
Node(int data)
{
this->data= data;
this->next=NULL;
}
//destructor
~Node()
{
int value=this->data;
while(this->next!=NULL)
{
delete next;
this->next=NULL;
cout<<"memory is fre... | ALGO | 0.999631 | 4.142493 |
3bfaeef5-1e68-4cd8-9128-31e803fb908e | shagunlamba/Competitive-Programming | Task On The Board.cpp | //https://codeforces.com/contest/1367/problem/D
#include<iostream>
#include<limits>
#include<bits/stdc++.h>
#include<algorithm>
#include<vector>
#include<cmath>
#include<math.h>
#include<iomanip>
#include<deque>
#include<string>
#include<string.h>
#include<map>
#include<utility>
#define ll long long
#define tc(t) l... | ALGO | 0.999946 | 3.468022 |
7ef0d9b9-b5b5-452d-892d-94e82a2835ac | Iman-Howlader/Competitive-Programming | Codeforces/A_Least_Product.cpp | /**
* Author : iman320
* Created: 2023-12-24 20:41:30
**/
#include <bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define nl '\n'
#define ll long long
#define all(x) x... | ALGO | 0.99754 | 4.161806 |
7691fa7b-3a5d-4f35-850c-0de7b2848997 | atoledanoh/Gex2019 | Homework08/5.16/Source.cpp | /*
* @file <========================.cpp>
*
* @author <Alejandro Toledano>
* @version <1.0>
*
* change log
* name date
*
*
* [file, auther, version, and change log are not necessary with
* modern source code management system]
*
* @section Academic Integrity
* I certify that this work is solely my own and com... | ALGO | 0.901569 | 3.468396 |
55b6d008-fb93-4bd3-b33b-15211ed6f559 | YooChangWoo/basic-cpp-2024 | day02/Project12/Project12/clang12_2_swap.cpp | #include <iostream>
using namespace std;
int main() {
int num = 10; // ʱȭ
cout << "num: " << num << endl;
int *pnum = # //ּҷ num
int& rnum = num; // num
num = 20;
cout << endl;
cout << "num: " << num << endl;
cout << "*pnum: " << *pnum << endl;
cout << "rnum: " << rnum << endl;
*pnum = 30;
cout << ... | ALGO | 0.92827 | 3.149064 |
2428b72c-c01a-4b52-9124-ae9dbeb6d1cd | ChoiJangSeop/codenet-c-cpp-codeql-test | cpp/s840155426.cpp | #include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define all(v) v.begin(),v.end()
using namespace std;
typedef long long ll;
int main()
{
vector<char> n(3);
rep(i,3) cin>>n[i];
rep(i,3){
if(n[i] == '1') cout << '9';
else cout << '1';
}
cout << endl;
retu... | ALGO | 0.999845 | 3.629714 |
3c4723a0-0617-4634-b260-ff84ab559373 | lordofwizard/codechef | lazychf/code.cpp | /* This project template is created by LordOfWizard
* https://github.com/lordofwizard
* YouTube https://0x0.st/NUMD
*/
#define vi vector<int>
#define vc vector<char>
#include <bits/stdc++.h>
#include <vector>
using namespace std;
int main(){
int t;
cin >> t;
while(t--){
int x,m,d;
cin >> x >> m >> d;
int... | ALGO | 0.99981 | 4.238154 |
0c4dadbf-7420-44e0-9274-bc8141574b76 | alim-buet/CPCodes | Codes/bookallocation.cpp | #include<bits/stdc++.h>
using namespace std;
bool ispossible(int bookpages[], int nOfbooks, int nOfstudents, int k) {
int currentstudent = 1, nowpage = 0;
for (int i = 0; i < nOfbooks; i++) {
if ((bookpages[i] + nowpage) > k) {
currentstudent++;
nowpage = bookpages[i];
}... | ALGO | 0.999964 | 4.540617 |
2ff4e248-c024-4559-9c48-41a3d476bc48 | hrehfeld/ezrgraphicsdemo | lib/eigen/bench/bench_sum.cpp | #include <Eigen/Core>
USING_PART_OF_NAMESPACE_EIGEN
using namespace std;
int main()
{
typedef Matrix<SCALAR,Eigen::Dynamic,1> Vec;
Vec v(SIZE);
v.setZero();
v[0] = 1;
v[1] = 2;
for(int i = 0; i < 1000000; i++)
{
v.coeffRef(0) += v.sum() * SCALAR(1e-20);
}
cout << v.sum() << endl;
}
| ALGO | 0.987933 | 3.127294 |
77ce745f-b13e-4033-b939-364e7812f26a | AnkitAggarwal0/LeetCode_Solutions | 0036-valid-sudoku/0036-valid-sudoku.cpp | class Solution {
public:
bool isValidSudoku(vector<vector<char>>& board) {
for (int i = 0; i < 9; i++){
vector<int> freq_rows(10,0);
vector<int> freq_cols(10,0);
for (int j = 0; j < 9; j++){
if(board[i][j] != '.'){
int num = bo... | ALGO | 0.999357 | 6.706737 |
90c7a9b5-5642-4a3a-87fe-e4a9c7fb9009 | grassnhi/programming-languages | Cpp/Function/sam.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int ret(int n, int M) {
if (n < 0) return n - (n / M - 1) * M;
else return n % M;
}
void solve() {
int n, M;
cin >> n >> M;
vector<int> a;
int temp;
for (int i = 0; i < n; i++) {
cin >> temp;
a.push_back(temp);
}
int max = 0... | ALGO | 0.999851 | 5.146183 |
599af5c2-3e3e-4f49-b818-f51f8d4729a5 | py0o0/CodingTest | 프로그래머스/2/160585. 혼자서 하는 틱택토/혼자서 하는 틱택토.cpp | #include <string>
#include <vector>
using namespace std;
int O;
int X;
int Osuc;
int Xsuc;
void row(vector<string> board,int x,int y){
if(board[x][y] =='O' and board[x][y+1] =='O' and board[x][y+2] =='O')
Osuc =1;
if(board[x][y] =='X' and board[x][y+1] =='X' and board[x][y+2] =='X')
Xsuc =1;
... | ALGO | 0.999964 | 5.407187 |
e809632d-a7d4-42f1-a146-9847e7933bbb | Harsimrank23/Daily-Coding | 745-prefix-and-suffix-search/745-prefix-and-suffix-search.cpp | class WordFilter {
public:
unordered_map<string, int> mp;
WordFilter(vector<string>& words)
{
int n = words.size();
for(int i = 0; i < n; i++)
{
string word = words[i];
for(int j = 0; j < word.size(); j++)
{
string pref... | ALGO | 0.998203 | 5.931563 |
88bf4967-b125-4df3-9830-d4e4193f48dd | Amr-Elmaghraby/Problem_Solving | 011-AntonandDanik_CF/Anton_Danilk.cpp | #include <iostream>
using namespace std;
int main(){
int num_of_games,Anton_d=0;
cin >> num_of_games;
char winner;
for(int i =0 ;i < num_of_games ; ++i){
cin >> winner;
switch (winner){
case 'A':
Anton_d ++;
break;
case 'D':
A... | ALGO | 0.999683 | 4.370536 |
5b0cfc91-95fb-4722-809a-ad281b4a629e | chaharnishant11/LABS | Graphics/8_ELLIPSE_MIDPOINT/ELLIPSE_MIDPOINT.cpp | #include<graphics.h>
#include<iostream>
#include<math.h>
#define PI 3.148
using namespace std;
void point(int x, int y, int ox, int oy, int color){
if(ox+x>=0 && oy-y>=0 && ox+x<getmaxx() && oy-y<getmaxy())
putpixel(ox+x,oy-y,color);
else
cout<<ox+x<<","<<oy-y<<" : Pixel out of bound\n";//display a point x,y with... | ALGO | 0.975058 | 3.48062 |
a22f967c-3aa5-4b9b-bd32-a80f8655e466 | dreamledger/DreamLedger | src/arith_uint256.cpp | #include <arith_uint256.h>
#include <uint256.h>
#include <crypto/common.h>
template <unsigned int BITS>
base_uint<BITS>::base_uint(const std::string& str)
{
static_assert(BITS/32 > 0 && BITS%32 == 0, "Template parameter BITS must be a positive multiple of 32.");
SetHex(str);
}
template <unsigned int BITS>
b... | ALGO | 0.959373 | 6.755129 |
597ccd3d-6192-48e6-bde3-22cd4c349252 | mirinta/leet_code | string/2490_circular_sentence.cpp | #include <string>
/**
* A sentence is a list of words that are separated by a single space with no leading or trailing
* spaces.
*
* For example, "Hello World", "HELLO", "hello world hello world" are all sentences.
* Words consist of only uppercase and lowercase English letters. Uppercase and lowercase English
*... | ALGO | 0.99665 | 6.857453 |
ed6ad873-564b-43f1-8892-1fbe8605b163 | Chep-Code-lo/LUYEN_CODE | NHAP_MON_LAP_TRINH_UTE_OJ/016.cpp | #include<iostream>
#include<algorithm>
using namespace std;
long long a, b;
int main(){
cin >> a >> b;
cout << __gcd(a, b);
} | ALGO | 0.9997 | 4.40368 |
538cffae-e2dd-40f0-80e0-a2ff620519c6 | YevgeniyEngineer/Convex-Hull | test_convex_hull.cpp | #include "convex_hull.hpp"
#include <chrono>
#include <iostream>
#include <random>
int main()
{
using namespace geom;
using PointType = double;
int num_pts = 99'999;
int coords_range = 1000;
bool print_results = true;
auto orientation = Orientation::CLOCKWISE;
// Seed the random number g... | ALGO | 0.997345 | 7.314686 |
d203c959-2646-408e-9392-711c4b89c5ef | DanielDFY/LeetCode | Problems/206. Reverse Linked List/Test.cpp | #define CATCH_CONFIG_MAIN
#include "../../Utils/Cacth/single_include/catch2/catch.hpp"
#include "solution.h"
ListNode* createList(const std::vector<int>& v) {
ListNode* pHead = new ListNode(0);
ListNode* pTail = pHead;
for (const auto& k : v) {
pTail->next = new ListNode(k);
pTail = pTail-... | TEST | 0.99974 | 6.456638 |
82b328df-a786-4284-9298-f4be47549ab7 | Yaro2709/AlgoProblems | 16/1559C.cpp | #include<iostream>
using namespace std;
void solve() {
int n;
cin >> n;
int *a = new int[n + 7];
for (int i = 1; i <= n; i++) {
cin >> a[i];
}
int mnpos = n + 1;
for (int i = 1; i <= n; i++) {
if (a[i] == 1) { mnpos = i; break; }
}
for (int i = 1; i < mnpos; i++) {
cout << i << ' ';
}
cout << n + 1 <... | ALGO | 0.999396 | 3.497004 |
84876064-1782-432f-9860-c5e892d19728 | dongsiik/Myeongpoom-CPP-Programming | chap04/4_07.cpp | #include <iostream>
using namespace std;
class Circle {
private:
int radius;
public:
void setRadius(int radius) { this->radius = radius; }
double getArea() { return 3.14 * radius * radius; }
};
int main() {
Circle c[3];
int r = 0;
int cnt = 0;
for (int i = 1; i < 4; i++) {
cout << " " << i << " >> ";
cin... | ALGO | 0.995809 | 4.211264 |
9e611610-5583-451a-acde-8d31d0f9c6b4 | ishandutta2007/codeforces | fanache99/normal/1214/B.cpp | #include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <stack>
#include <cassert>
#include <map>
#include <numeric>
#include <cstring>
#include <set>
#include <ctime>
#include <queue>
#include <cmath>
#include <iomanip>
#include <iterator>
using namespace std;
clock_t timeStart, timeFi... | ALGO | 0.999371 | 3.909906 |
c91a3761-589d-4dad-bfb2-3477f73cb8f4 | OMICHH/Lenguaje | Programacion Basica/Sequia/solution/solution.cpp | #include <iostream>
using namespace std;
int n, c, lluvia, total,r;
bool lleno=false;
int main()
{
cin>>n>>c;
for (int d=1; d<=n; d++) {
cin>>lluvia;
total+=lluvia;
if (total >= c && !lleno) {
r=d; //respuesta de das en que se llen
lleno=true; //no se requiere ... | ALGO | 0.999983 | 4.026722 |
56c654f9-fd76-4f43-b79c-f74e8e7b1147 | wdzeng/cp-solutions | PCCA-Winter-Camp-2020/Day2/cf1288d.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define x first
#define y second
#define all(v) v.begin(), v.end()
#define ms(v) memset(v, 0, sizeof(v))
#define mss(v) memset(v, -1, sizeof(v))
const int maxn = 3e5, maxm = 8;
int arr[maxn][maxm];
int n, m;
pii check(int ... | ALGO | 0.999929 | 4.270498 |
98274d2f-4022-4bf0-a9e2-4203e78175bd | tomoakiii/atcoder2 | Archive/abc269/d.cpp | #include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
using namespace atcoder;
#define rep(i,n) for (ll i = 0; i < (n); ++i)
template<typename T> inline bool chmax(T &a, T b) { return ((a < b) ? (a = b, true) : (false)); }
template<typename T> inline bool chmin(T &a, T b) { return ((a > b) ? (a = b, true... | ALGO | 0.999872 | 4.993145 |
ab7e61ac-56e9-4534-989c-24c2c663a0cd | lichangche/libre_pilot_uavtalk | ground/gcs/src/libs/eigen/test/sparseLM.cpp | #include "main.h"
#include <Eigen/LevenbergMarquardt>
using namespace std;
using namespace Eigen;
template <typename Scalar>
struct sparseGaussianTest : SparseFunctor<Scalar, int>
{
typedef Matrix<Scalar,Dynamic,1> VectorType;
typedef SparseFunctor<Scalar,int> Base;
typedef typename Base::JacobianType JacobianT... | TEST | 0.99413 | 6.130261 |
540a6e50-6d48-4ae8-adbd-886b4426ef12 | ekoapriliyani/inventorly_app_v2 | 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 |
b59ea4b2-99d3-481b-8743-b443cb9750b8 | YassinHemdan/leetcode | random/3153.cpp | class Solution {
private:
void digitPositionFreq(int num, vector<vector<int>>& position){
int idx = 0;
while(num){
int digit = num % 10;
num /= 10;
position[idx][digit]++;
++idx;
}
}
public:
long long sumDigitDifferences(vector<int>& nu... | ALGO | 0.999946 | 6.29713 |
8574bf34-55b0-4107-aa03-e9367100f904 | wfystx/LeetCodeDailyPractice | Trie/1065IndexPairsofaString.cpp | class TrieNode {
public:
TrieNode* child[26];
bool is_word;
TrieNode(){
memset(child, 0, sizeof(child));
is_word = false;
}
};
class Solution {
private:
TrieNode* root;
public:
vector<vector<int>> indexPairs(string text, vector<string>& words) {
root = new TrieNode();
... | ALGO | 0.999977 | 6.04723 |
c0bbb422-9425-4705-ac98-01f312cd6506 | shreyansh28801/StriverCpSheet | Tree&Graph/Tree/CSES_TREE/q2.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long int li;
#define int long long int
typedef long double ld;
#define lb lower_bound
#define ub upper_bound
#define pub push_back
#define pob pop_back
#define nl "\n"
typedef long double ld;
template <typename ... | ALGO | 0.997029 | 4.622646 |
d616122a-1c2e-4e68-add6-7ab20cf6bb19 | uji-ros-pkg/uwsim_bullet | src/BulletCollision/Gimpact/btGImpactQuantizedBvh.cpp | /*! \file gim_box_set.h
\author Francisco Leon Najera
*/
#include "btGImpactQuantizedBvh.h"
#include "LinearMath/btQuickprof.h"
#ifdef TRI_COLLISION_PROFILING
btClock g_q_tree_clock;
float g_q_accum_tree_collision_time = 0;
int g_q_count_traversing = 0;
void bt_begin_gim02_q_tree_time()
{
g_q_tree_clock.reset();
}... | ALGO | 0.999107 | 7.06359 |
2a8dc5fe-a86b-41fd-acfe-6f8cf9998dc5 | AC2-K/Solutions | Main/ABC282/B.cpp | #include<bits/stdc++.h>
using namespace std;
//cout << fixed << setprecision(10);
#define rep(i, N) for(int i=0;i<(N);i++)
#define all(x) (x).begin(),(x).end()
#define popcount(x) __builtin_popcount(x)
using ll = long long;
using ld = long double;
using Graph = vector<vector<int>>;
using P = pair<int, int>;
const int ... | ALGO | 0.999969 | 4.965007 |
6a93f194-3eac-4eb8-9c3b-e0f695ff898d | Sushreesatarupa/DSA-cpp | 21. Dynamic Programming/LongestPalindromicSubsequence.cpp | class Solution {
public:
// Bottom-up approach
// TC: O(N*N), SC: O(N*N)
int longestPalindromeSubseqTabular(string& s) {
if(s.empty())
return 0;
const int N = s.size();
// dp(i, j): length of longest palindromic substring in s[i:j]
vector<vector<int> > dp... | ALGO | 0.999969 | 6.673717 |
0863e99f-4a1b-4411-aa66-ce08f1331353 | vryy/kratos_bcn3 | applications/ContactStructuralMechanicsApplication/custom_utilities/active_set_utilities.cpp | // System includes
// External includes
// Project includes
#include "custom_utilities/active_set_utilities.h"
#include "utilities/parallel_utilities.h"
#include "utilities/reduction_utilities.h"
#include "contact_structural_mechanics_application_variables.h"
#include "utilities/atomic_utilities.h"
namespace Kratos
... | ALGO | 0.999763 | 5.683145 |
9c2f81c0-ef8f-4d1b-8a57-c5ff13653315 | shyamal2411/DSA-Practice | leetcodePractice/Graph/1971FindPathinGraph_BFS.cpp | #include<bits/stdc++.h>
using namespace std;
// https://leetcode.com/problems/find-if-path-exists-in-graph/
// https://leetcode.com/problems/find-if-path-exists-in-graph/discuss/1409030/C%2B%2B-oror-100-FASTER-oror-EXPLAINED-3-Approaches-%3A-DFS-BFS-UnionFind
class BFS_Solution {
public:
//BFS APPROACH
bo... | ALGO | 0.999997 | 5.565127 |
bc669e4b-0195-438d-a0d9-742797be6aa5 | Gaitz/algorithm-playground | MySolutions/USACO/chap1/142_barn1.cpp | /*
ID: gaitzga1
LANG: C++11
PROG: barn1
*/
#include <algorithm>
#include <fstream>
#include <iostream>
#include <string>
using namespace std;
const string PROG_NAME = "barn1";
string solve(int maxBoards, int stalls, int numberOfCows,
int cowsInStall[200]) {
int blocked = cowsInStall[numberOfCows - 1] -... | ALGO | 0.999679 | 4.141979 |
a95c5b60-8514-43c7-bb2d-0b9339878685 | duoniduoni/task_dispose | task_dispose/Contour.cpp | #include "stdafx.h"
#include "Contour.h"
Contour::Contour(void)
{
}
Contour::~Contour(void)
{
points.clear();
}
bool Contour::isBelong(CvPoint & point)
{
//ȡĵ
int cen_x, cen_y;
cen_x = range.x + range.width / 2;
cen_y = range.y + range.height / 2;
if( abs(cen_x - point.x) > (range.width / 2 + 2) ||
abs(cen_... | ALGO | 0.87317 | 4.265174 |
6e34384b-ce72-431f-87d0-7d5b87e5a312 | jhanssen/libcxx | test/algorithms/alg.modifying.operations/alg.replace/replace_copy_if.pass.cpp | // <algorithm>
// template<InputIterator InIter, typename OutIter,
// Predicate<auto, InIter::value_type> Pred, class T>
// requires OutputIterator<OutIter, InIter::reference>
// && OutputIterator<OutIter, const T&>
// && CopyConstructible<Pred>
// OutIter
// replace_copy_if(InIter first... | TEST | 0.980992 | 6.410222 |
a6c30634-cf3e-46e9-818b-3abeaf12f79b | Fer-Matheus/Estrutura-de-Dados | AC4/Codigos em C/main.cpp | #include <iostream>
#include "Tree.cpp"
using namespace std;
int main()
{
int values[] = {39, 32, 22, 55, 36, 1, 57, 29, 49, 4, 81, 91, 26, 54, 77, 91, 11, 32, 54};
Tree *tree = new Tree();
int tam = sizeof(values) / sizeof(int);
for (int i = 0; i < tam; i++)
{
tree->insert(values[i]);
... | ALGO | 0.995082 | 4.167617 |
65820f71-6c10-4c5a-a41c-4b08924c722d | aashuchaudhary/gfg_solution | Difficulty: Medium/Merge Sort/merge-sort.cpp | //{ Driver Code Starts
#include <stdio.h>
#include <bits/stdc++.h>
using namespace std;
/* Function to print an array */
void printArray(int arr[], int size)
{
int i;
for (i=0; i < size; i++)
printf("%d ", arr[i]);
printf("\n");
}
// } Driver Code Ends
class Solution
{
public:
void merge(i... | ALGO | 0.999948 | 6.467475 |
cc878815-f08f-4b19-8928-a05e1bac76fa | harith-s/cs101lab | ps14_2.cpp | #include <iostream>
using namespace std;
struct point {
double x, y;
};
struct rect{
point x1, x2;
void print(){
cout << x1.x << " " << x1.y << " and ";
cout << x2.x << " " << x2.y << endl;
}
};
bool inside(rect r, point a) {
if (r.x1.x>r.x2.x){
point temp;
... | ALGO | 0.995348 | 3.333711 |
d9112e34-5bdf-4267-aaee-78f6733628d0 | helloworld202106/Leetcode | src/0154-Find-Minimum-in-Rotated-Sorted-Array-II/0154.cpp | #include <iostream>
#include <vector>
using namespace std;
static int x = []() {std::ios::sync_with_stdio(false); cin.tie(0); return 0; }();
class Solution
{
public:
int findMin(vector<int>& nums)
{
int low = 0, high = nums.size() - 1;
while (low <= high)
{
int mid = (high ... | ALGO | 0.999981 | 5.258759 |
9c22cac1-e197-428d-bdda-8021a7847a2b | hit7sh/CodeForces | Round 748 div 3/D2.cpp | template<typename T>
std::vector<T> divisors(T n) {
std::vector<T> divisors;
for (int i = 1; (T) i * i <= n; i++) {
if (n % i == 0) {
divisors.push_back(i);
if (i != n / i) {
divisors.push_back(n / i);
}
}
}
return divisors;
}
void solve() {
int n;
cin >> n;
vi A(n);
... | ALGO | 0.999883 | 4.406724 |
81a7afee-d80d-4455-b698-238e3d15a0e8 | nisa-fathul/advertise | P6_PBB/snackbar/snackbar/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.997033 | 6.763549 |
279bc18c-2031-4373-a12c-5fb6a8949ee1 | NandiSoham/Leetcode-POTD-Daily-Coding-Challenge | Year 2025/01_January/day24_802. Find Eventual Safe States.cpp | // Problem Link -> https://leetcode.com/problems/find-eventual-safe-states/description/
class Solution {
public:
bool detectCycleDFS(vector<vector<int>>& graph, int node,
vector<bool>& isVisited, vector<bool>& recursionStack) {
isVisited[node] = true;
recursionStack[node] = ... | ALGO | 0.999973 | 6.842175 |
bc30123c-0c82-483f-baee-f1bc9b0842f5 | kuldeepvarma7413/DSA | bit_manipulation/replace_bits.cpp | #include<bits/stdc++.h>
using namespace std;
void clearRangeOfBits(int &n, int i, int j){
int mask1=(~0)<<j+1;
int mask2=(1<<i)-1;
int mask=mask1|mask2;
n=mask&n;
}
void replaceBits(int &n, int i, int j, int m){
// remove bits from i to j
clearRangeOfBits(n,i,j);
//shift m till ith bit
... | ALGO | 0.999825 | 3.516166 |
02daf6f9-1d94-49c4-9e0c-e817a2d8932b | Fleker/gem5 | src/systemc/tests/systemc/examples/updown/updown.cpp | #include "systemc.h"
#include "specialized_signals/scx_signal_int.h"
#include "specialized_signals/scx_signal_signed.h"
#include "specialized_signals/scx_signal_uint.h"
#include "specialized_signals/scx_signal_unsigned.h"
SC_MODULE(up_down)
{
sc_in_clk clk;
sc_in<sc_uint<1> > up;
sc_in<sc_ui... | TOOL | 0.992583 | 4.010221 |
660924b0-8127-4cf1-b66a-e03e9c664b13 | PablooDario/Cpp-Implemented-Data-Structures | CompleteBT/CompleteBinTree.cpp | #include "CompleteBinTree.h"
int main()
{
//Create a tree
CompleteBT myTree;
//Create the root *This Step is necesary when yu create the tree*
myTree.CreateRoot(10);
node *aux;
//Delete the root
myTree.DeleteDeepest();
//Found the deepest node in an empty tree
aux=myTree.DeepestN... | ALGO | 0.964191 | 3.963443 |
49fe1739-1127-44f5-9822-c064a2471c13 | Munawertaj/Data-Structures-and-Algorithms | String/KMP.cpp | #include <bits/stdc++.h>
#define ll long long
#define ld long double
#define nl "\n"
#define FOR(x, y) for (ll i = x; i <= y; i++)
#define f0(x) for (ll i = 0; i <= x; i++)
#define f1(x) for (ll i = 1; i <= x; i++)
#define pb(x) push_back(x)
#define mp make_pair
#define pii pair<int, int>
#define pll pair<ll, ll>
#defi... | ALGO | 0.999956 | 5.056475 |
4f2e975e-7cd3-41ba-8ec6-e1cbe31b8e29 | softweight/My_OJ | Leetcode/DataStructure_I/#53_Maximum_Subarray/53.cpp | #include <iostream>
#include<vector>
#include <algorithm>
using namespace std;
// nums = {-2, 1, -3, 4, -1, 2, 1, -5, 4}
// dp = {-2, 1, -2, 4, 3, 5, 6, 1, 5}
class Solution {
public:
int maxSubArray(vector<int>& nums) {
vector<int> dp = nums;
for(int i = 1; i < size(nums); i++)
d... | ALGO | 0.999964 | 4.979301 |
c459cdba-2f6f-4a12-a3a2-f9415d54b811 | AkashSingh3031/The-Complete-FAANG-Preparation | 1]. DSA + CP/1]. DSA/4]. Striver Series/30 Days of SDE Sheet/C++/03]. Day-3 (Arrays)/CodeStudio/4]. Majority Element (N-3 times).cpp | #include <bits/stdc++.h>
vector<int> majorityElementII(vector<int> &arr)
{
// Write your code here.
int cnt1 = 0, cnt2 = 0, num1=0, num2=1;
for(int n: arr){
if (num1==n){
cnt1++;
}
else if (num2==n){
cnt2++;
}
... | ALGO | 0.999851 | 5.158784 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.