uuid stringlengths 36 36 | repo_name stringlengths 5 123 | relative_path stringlengths 5 4k | content stringlengths 33 2.85M | category stringclasses 6
values | algo_rel_score float64 0.85 1 | quality_score float64 3 8.76 |
|---|---|---|---|---|---|---|
ef96e2cd-f10e-4273-8a4a-f054713cf908 | suve0803/training_cpp | classwork/day47/prog03.cpp | #include<iostream>
#include<vector>
using namespace std;
int main() {
vector<int>oddno;
auto odd = [](int n, vector<int>& no) {
for (int i = 0;i < n;i++) {
if (i % 2 != 0)
no.emplace_back(i);
cout << i << endl;
}
};
/*auto odd = [](int n) {for (int i = 0;i <= n;i++)if (i % 2 != 0)cout<< i<<endl;};
o... | ALGO | 0.998238 | 4.285716 |
938118ab-9e76-42ae-b96a-184890971995 | 18ivan18/DataStructuresAndProgramming2024 | week07 - introduction to trees/solutions/1.cpp | #include <vector>
#include <stack>
// 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) ... | ALGO | 0.999992 | 6.639684 |
8b440ead-f0dc-4c64-b657-10f2fe7532b6 | stjaeckel/quadriga-lib | src/point_inside_mesh.cpp | #include "quadriga_tools.hpp"
#include "quadriga_lib_helper_functions.hpp"
/*!SECTION
Site-Specific Simulation Tools
SECTION!*/
/*!MD
# point_inside_mesh
Test whether 3D points are inside a triangle mesh using raycasting
## Description:
- Uses raycasting to determine whether each 3D point lies inside a triangle mesh... | ALGO | 0.986086 | 7.253787 |
47e53f0c-eb19-48e4-a6e2-fcd17df88260 | Afrigonblockchain/Afrigon-Core | src/consensus/merkle.cpp | #include <consensus/merkle.h>
#include <hash.h>
/* WARNING! If you're reading this because you're learning about crypto
and/or designing a new system that will use merkle trees, keep in mind
that the following merkle tree algorithm has a serious flaw related to
duplicate txids, resulting in a ... | ALGO | 0.999526 | 7.434482 |
9ec3da1d-ff8c-4b1a-b162-2c66345f4411 | yousuf-cse-bd/ProgrammingGathering | StringExample.cpp | /****
* @Author: Muhammad Yousuf Ali
* @Since: Sunday, 12 July 2020
* ***String Function Exmaple****
*/
#include <bits/stdc++.h>
using namespace std;
int main()
{
char firstName[] = "Yousuf";
char lastName[] = "Ali";
cout<<firstName<<"\t"<<lastName<<endl;
cout<<strlen(firstName)<<endl;
///strcpy(... | TOOL | 0.967031 | 3.224371 |
f6bebcc0-fb05-4e25-af55-078e37209a84 | clongbupt/algorithm_cookbook | ACM/uva/10137.cpp | /**
* The 3n+1 problem (3n+1 问题)
* PC/UVa IDs: 110101/100
*/
#include<iostream>
#include<cstdio>
#include<cstdlib>
using namespace std;
int get_length(long int num)
{
if (num == 1)
return 1;
else if (!(num & 1)) //判断是否为偶数
//else if (num | 0)
num >>= 1;
else
//num += (num<<1) + 1;
num += (num << 1)... | ALGO | 0.999512 | 3.728975 |
02c76ba8-1dc9-4190-96ac-a67fbaba3f4c | Familyye/InjectUtils | libs/chat/deps/json/docs/examples/find__object_t_key_type.cpp | #include <iostream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
int main()
{
// create a JSON object
json j_object = {{"one", 1}, {"two", 2}};
// call find
auto it_two = j_object.find("two");
auto it_three = j_object.find("three");
// print values
std::cout << std::boolalph... | TOOL | 0.869999 | 6.132683 |
72402e20-28d0-4686-bf81-d181e1a2686d | Sakrac/Step6502 | Src/Expressions.cpp | #include "stdafx.h"
#include <inttypes.h>
#include "machine.h"
#include "sym.h"
// These are expression tokens in order of precedence (last is highest precedence)
enum ExpOp {
EO_END,
EO_NONE = EO_END,
// values
EO_VAL8, // fixed value, 8 bits
EO_VAL16, // fixed value, 16 bits
EO_PC, // current PC
EO_A... | ALGO | 0.972098 | 5.715086 |
907305c3-4d73-4e9b-a3a1-ef1c57fe20bd | haasegu/CppProgramming | Beispiele/v_stl_intro3/bsp511a.cpp | // Sec. 511 of lecture
// Dynamic C++-Vector
// g++ -std=c++11 -Wall -Wextra -pedantic bsp511a.cpp
#include <cmath> // sqrt()
#include <iostream>
#include <vector> // vector<>
using namespace std;
int main()
{
unsigned int n;
cout << "\n Anzahl der Vek... | ALGO | 0.979039 | 3.154876 |
f885bc31-98f5-4fe1-a73e-b87abfcfca37 | boyslikeguy23/dsa_Cpp | vectorbangmang.cpp | //cai dat vector
#include<bits/stdc++.h>
using namespace std;
template <class T>
class Vector
{
int n, cap; //size and capacity
T *buf;
private:
void recap(int newcap)
{
cap=newcap;
T *tem=buf;
buf=new T[cap];
for(int i=0; i<n; i++) buf[i]=tem[i];
if(tem) delete[]tem;
}
public:
Vector(){
n... | ALGO | 0.997024 | 3.591651 |
b25c1cef-33e6-44d6-9ec2-8b4f4ea12d8c | algorithm5/baekjoon | lth/2579.cpp | #include <stdio.h>
#include <algorithm>
using namespace std;
int dp[301][2];
int step[301];
int main()
{
int n;
scanf("%d", &n);
for (int i = 1; i <= n; ++i)
{
scanf("%d", &step[i]);
}
dp[1][0] = step[1];
for (int i = 2; i <= n; ++i)
{
dp[i][0] = max(dp[i - 2][0], dp[i - 2][1]) + step[i];
... | ALGO | 0.999961 | 3.772468 |
2f307b58-e066-4791-8915-c95ae3bd68f7 | omarr-gamal/Competitive-Programming-Problems-on-CodeForces | 1400. B. Amr and Pins.cpp | // link to problem: https://codeforces.com/problemset/problem/507/B
#include <stack>
#include <iostream>
#include <functional>
#include <algorithm>
#include <iterator>
#include <iomanip>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <sstream>
#include <memory.h>
#include <string>
#include <d... | ALGO | 0.999209 | 3.356799 |
9b7c4d8e-62cc-41fe-bd72-0f8bdebaf308 | mpoullet/NumCSE | LectureCodes/MatVec/Dense/roots/Eigen/main.cpp | ///////////////////////////////////////////////////////////////////////////
/// Demonstration code for lecture "Numerical Methods for CSE" @ ETH Zurich
/// (C) 2016 SAM, D-MATH
/// Author(s): Thomas Etterlin <<EMAIL>>
/// Repository: https://gitlab.math.ethz.ch/NumCSE/NumCSE/
/// Do not remove this header.
////////////... | ALGO | 0.970132 | 4.413701 |
bc230d66-d1d7-4813-91f0-14e7e3732d7d | MDNROnik/Competitive-Programming | Codeforces/A. We Need the Zero.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define fastIo() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
bool prime[100000001];
ll n=100000000;
void sieve();
ll mod(ll x);
ll add(ll a,ll b);
ll mul(ll a,ll b);
ll modPow(ll x, ll y);
ll Pow(ll x, ll y);
ll setbit(ll num);
ll combinatio... | ALGO | 0.999415 | 4.206122 |
521161bf-5088-43bf-84ff-6eff4df186d0 | saim29/data-flow-framework | data_flow/dataflow.cpp |
////////////////////////////////////////////////////////////////////////////////
#include "dataflow.h"
namespace llvm {
// Add code for your dataflow abstraction here.
DFF::DFF() {
}
void DFF::setBoundary(bool direction, bool boundary_val, unsigned bitvec_size) {
BitVector init_val = BitVector(bitve... | ALGO | 0.999468 | 7.565459 |
cb1d88ab-17b8-4a3f-9b7d-437e199e16ea | RoshanSharma20/leetcode_answers | 1598-crawler-log-folder/1598-crawler-log-folder.cpp | class Solution {
public:
int minOperations(vector<string>& logs)
{
stack<string> ans;
for(int i=0;i<logs.size();++i)
{
if(logs[i]=="../")
{
if(!ans.empty())
ans.pop();
}
else if(logs[i]!="./")
... | ALGO | 0.991753 | 5.092291 |
4dfe35d8-1002-4973-9d57-21a9505ec926 | ltrbless/CG_HW_Hierarchicl_Z_Buffer | extern/eigen/bench/sparse_product.cpp |
//g++ -O3 -g0 -DNDEBUG sparse_product.cpp -I.. -I/home/gael/Coding/LinearAlgebra/mtl4/ -DDENSITY=0.005 -DSIZE=10000 && ./a.out
//g++ -O3 -g0 -DNDEBUG sparse_product.cpp -I.. -I/home/gael/Coding/LinearAlgebra/mtl4/ -DDENSITY=0.05 -DSIZE=2000 && ./a.out
// -DNOGMM -DNOMTL -DCSPARSE
// -I /home/gael/Coding/LinearAlgebr... | ALGO | 0.993017 | 4.17358 |
68db7a51-a6d4-4611-847b-39659bf053a0 | Nikhil-57/my--new-repository | DiameterOFTree.cpp | #include<iostream>
#include<bits/stdc++.h>
using namespace std;
struct TreeNode{
int val;
TreeNode *left;
TreeNode *right;
TreeNode(int x) : val(x),left(NULL), right(NULL) {}
};
class solution{
public:
int diameterOfBinaryTree(TreeNode* root){
int diameter = 0;
hei... | ALGO | 0.999787 | 6.126665 |
70d591e4-11d0-4b24-82c2-2eea08f97d9b | Vinniellf/Competitive-Programming | Training ICPC 2024/TEMAS/Data Strucutre/Fenwick tree/StaticRangeMinimQuery.cpp | #pragma GCC optimize(2)
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define cases ll T=0;cin>>T;while(T--)
#define rep... | ALGO | 0.999946 | 5.167318 |
61d62073-2ade-4a29-82d0-06310bd7239e | desharp14/NA2024 | Programming/Chapter1/E.cpp | #include <iostream>
#include <cmath>
#include "EquationSolver.h"
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
// Constants for the problem
const double L = 10.0; // Length of the trough (in feet)
const double r = 1.0; // Radius of the semi-circular cross-section (in feet)
const double V_target... | ALGO | 0.999998 | 6.690095 |
5905c9f4-4a36-4c94-abc8-899f73953ba4 | aghres186/aghres486 | A. Hit the Lottery.cpp | #include <iostream>
#include <vector>
using namespace std;
int main()
{
int count;
cin >> count;
int result = 0;
while (true)
{
if (count >=100)
{
count -= 100;
result++;
if (count == 0)
{
break;
}
}
else if (count >=20)
{
count -= 20;
result++;
if (count == 0)
{
break;... | ALGO | 0.999707 | 3.922558 |
c943a0bc-9550-405c-8348-e1660b132121 | mrabid/Data-Structure-Cpp | Doubly Link List.cpp | //Doubly linked list
#include <iostream>
using namespace std;
struct node
{
int data;
node* next;
node* prev;
};
void addValue(node*& a, int data)
{
if (a == NULL)
{
a = new node;
a->data = data;
a->next = NULL;
a->prev = NULL;
}
else
{
node* curr... | ALGO | 0.999093 | 4.097696 |
23b84b5e-33d1-4b27-b195-1fec140994f3 | lukadupli/MIScan | native/transform/book_transform.cpp | #include "book_transform.h"
#include <cmath>
bool BookTransform::canTransform(Point2D p1, Point2D p2, Point2D p3, Point2D p4) {
return quad.canTransform(p1, p2, p3, p4);
}
bool BookTransform::loadCoordinates(Point2D p1, Point2D p2, Point2D p3, Point2D p4, const std::vector<Point2D> curve, bool curvePosition) {
... | ALGO | 0.985613 | 5.351329 |
6be438a2-3ab7-44f4-9633-eaac48190b68 | Ma7moudKassem/LeetCode | 53. Maximum Subarray/53. Maximum Subarray.cpp | #include <iostream>
#include <vector>
using namespace std;
int maxSubArray(vector<int>& nums) {
vector<int> dp(nums);
for (int i = 1; i < nums.size(); i++)
dp[i] = max(nums[i], nums[i] + dp[i - 1]);
return *max_element(dp.begin(), dp.end());
}
int main()
{
vector<int> nums = { -2,1,-3,4,-1,2,1,-5,4 };
cout <... | ALGO | 0.999838 | 5.052143 |
49d9525d-daba-4cf2-9e0a-931abac15ecb | andrewschoi/cses-solutions | rangequeries/staticrangequeries.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n, q;
cin >> n >> q;
vector<long long> prefix(n + 1);
for (int i = 1; i <= n; i++)
{
cin >> prefix[i];
prefix[i] += prefix[i - 1];
}
while (q--)
{
int l, r;
cin >> l >> r;
cout << prefix[r] - prefix[l - 1] << "\n";
}
... | ALGO | 0.999941 | 4.589515 |
7191a2e2-0767-4716-9a5a-38ff10d33325 | tsawke/OI | Luogu/P1XXX/P1226.cpp | //C++11 - Template
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <climits>
#include <iostream>
#include <string>
#include <map>
#include <queue>
#include <stack>
#include <functional>
#include <unistd.h>
using namespace std;
typedef unsigned in... | ALGO | 0.999951 | 4.490335 |
6b4bc63e-c0f0-47f5-b8bd-693b557d9ed2 | gaonK/AlgorithmStudy | Session 1/hy00nc/3.다이나믹/11055.cpp | #include <iostream>
using namespace std;
int main(){
cin.tie(NULL);
ios::sync_with_stdio(false);
int n;
cin>>n;
int A[n];
for(int i=0;i<n;i++) cin>>A[i];
int d[n];
for(int i=0;i<n;i++){
d[i]=A[i];
for(int j=0;j<i;j++){
if(A[i]>A[j]&&d[i]<d[j]+A[i]) d[i]=d[j]... | ALGO | 0.999961 | 3.680935 |
4e16cf78-033c-4ac2-a67a-aab9b954535f | mohammad-majoony/codeForces-submits | A. System of Equations/main.cpp | #include<bits/stdc++.h>
using namespace std ;
int main(){
ios_base::sync_with_stdio(0) ;
cin.tie(0) ;
int a , b , count = 0 ;
cin >> a >> b ;
for(int i = 0 ; i < 32 ; i++){
for(int j = 0 ; j < 32 ; j++){
if(i * i + j == a && i + j * j == b) count++ ;
}
}
cou... | ALGO | 0.999487 | 4.365764 |
522ce9b7-3e74-4243-b14c-e1051dc0d096 | chenfan2014/CFgit | C++Primer/testSome/smallAndLarge.cpp | #include <iostream>
#include <string>
#include <vector>
using namespace std;
void smallAndLarge(int a[], int res[],int n)
{
int k = 0;
int i, j;
for(i = 0; i != n; i ++)
{
int flag = 0;
int max, min;
max = min = a[i];
for(j = 0; j != i; j ++){
if(a[j] > max){... | ALGO | 0.999919 | 3.333461 |
3f62b150-8f39-46bd-8e46-7615c9a0202e | RRIL97/Graphics-Scene-Editor | igl/random_dir.cpp | IGL_INLINE Eigen::Vector3d igl::random_dir()
{
using namespace Eigen;
double z = (double)rand() / (double)RAND_MAX*2.0 - 1.0;
double t = (double)rand() / (double)RAND_MAX*2.0*PI;
// http://www.altdevblogaday.com/2012/05/03/generating-uniformly-distributed-points-on-sphere/
double r = sqrt(1.0-z*z);
double... | ALGO | 0.995849 | 5.755002 |
5515abd3-464f-4d23-9c67-1721a85abc2f | santhosh-kumar/MultiviewAppearanceTracker | lib/ihog-master/spams/decomp/mex/mexSparseProject.cpp | /*!
* \file
* toolbox Linalg
*
* by Julien Mairal
* <EMAIL>
*
* File mexL1Project.cpp
* \brief mex-file, function mexL1Project
* Usage: Y = mexSparseProject(X,param); */
#include <mex.h>
#include <mexutils.h>
template <typename T>
inline void ca... | TOOL | 0.939123 | 4.725672 |
927f29f8-834c-4f71-a9ef-ce02521201b4 | prashantjagtap2909/LeetCode-POTD_2024 | 09 September/20 Sep: 214. Shortest Palindrome.cpp | class Solution {
public:
string shortestPalindrome(string s) {
int n = s.size(), i = 0;
for (int j=n-1; j>= 0; j--) {
while (j>=0 && s[i] == s[j])
i++, j--;
}
if (i==n)
return s;
string temp= s.substr(i), remain_rev=temp;
rever... | ALGO | 0.999995 | 6.331855 |
6b2732ac-2c12-4745-b7dc-c658f197002b | Beisenbek/MSPP1_24 | week4/10.cpp | #include <iostream>
using namespace std;
bool isOK(string s){
for(int i = 0; i < s.size(); ++i){
if(s[i] >='0' && s[i] <='9')
return false;
}
return true;
}
int main(){
string s;
getline(cin, s);
s = s + ' ';
string t = "";
for(int i = 0; i < s.size(); ++i){
... | ALGO | 0.997409 | 3.970854 |
76fa073c-02e9-4b24-a571-42a66f026a15 | 21omkarsase/CP | Codechef/LUNCH TIME/FIRST/racing.cpp | #include <iostream>
using namespace std;
#define ll long long int
int main() {
// your code goes here
ll t;
cin>>t;
while(t--)
{
ll x,t,m;
cin>>x>>t>>m;
t*=60;
m*=60;
ll req=0;
req+=min(x,t);
t-=min(x,t);
req+=t*2;
if(req<=m)
{
cout<<"yes"<<endl;
... | ALGO | 0.999787 | 3.901142 |
d53074e5-d25d-4a59-a2f3-4524e87703c8 | Suyashmishra13/USACO-Questions | LasersAndMirrors.cpp | #include <cstdio>
#include <iostream>
#include <queue>
#include <unordered_map>
#include <vector>
using namespace std;
int main() {
freopen("lasers.in", "r", stdin);
freopen("lasers.out", "w", stdout);
int n;
cin >> n;
vector<pair<int, int>> points(n + 2);
// lines[0] are vertical, lines[1] are horizontal
unord... | ALGO | 0.999972 | 4.378932 |
375a1ce5-c086-4e3b-9b7d-875aa507e471 | tdnq/learning | cProgram/dataStructure/src/tree/modules/Init/init.cpp | #include "./init.h"
namespace leetCode
{
TreeNode *InitTrees::initTree(int data[], int size, int index)
{
if (index >= size)
{
return nullptr;
}
if (!data[index])
{
return nullptr;
}
TreeNode *node = new TreeNode(data[index]);
... | ALGO | 0.999012 | 5.788718 |
7a2bc935-1359-4c51-9678-3c6b1996a032 | phidiaLam/GAMES | GAMES202_Homework_S2021/homework2/prt/ext/openexr/OpenEXR/IlmImf/ImfWav.cpp | //-----------------------------------------------------------------------------
//
// 16-bit Haar Wavelet encoding and decoding
//
// The source code in this file is derived from the encoding
// and decoding routines written by Christian Rouet for his
// PIZ image file format.
//
//-------------------------------------... | ALGO | 0.995217 | 6.282012 |
f9872bea-88cb-43e1-9333-4f4d005c96b3 | diverse-project/samplingfm | tools/ugen2/cmsat/SolverDebug.cpp | #include "cmsat/Solver.h"
#include "cmsat/VarReplacer.h"
using namespace CMSat;
#ifdef DEBUG_ATTACH_FULL
void Solver::testAllClauseAttach() const {
for (Clause * const*it = clauses.getData(), *const*end = clauses.getDataEnd(); it != end; it++) {
const Clause& c = **it;
assert(normClauseIsAttached... | ALGO | 0.988875 | 6.031028 |
9d4e99c9-7ff0-4715-b1e4-689ab28601e7 | Aryan-747/YeetCode | 137-single-number-ii/single-number-ii.cpp | class Solution {
public:
int singleNumber(vector<int>& nums) {
map<int,int> m1;
for(int i=0 ; i<nums.size() ; i++)
{
m1[nums[i]]++;
}
for(int i=0 ; i<nums.size() ; i++)
{
if(m1[nums[i]] == 1)
{
return nums[i];
... | ALGO | 0.999916 | 5.454187 |
8fcbb7d1-457e-44a3-81ae-9237156e791c | luke333z/pbinfo.ro | #4146_Sort10.cpp | #include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
using namespace std;
string filename = "file";
ifstream in(filename + ".in");
ofstream out(filename + ".out");
int main()
{
int n,v[1001];
cin>>n;
for(int i=1;i<=n;i++)
cin>>v[i];
for(int i=1;i<n;i++)
for(int ... | ALGO | 0.998881 | 3.187707 |
58d7f132-7337-4723-ae33-5d126bf68248 | Sohel440/gfg | Difficulty: Hard/Palindromic Partitioning/palindromic-partitioning.cpp | //{ Driver Code Starts
// Initial Template for c++
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
// User function Template for C++
class Solution{
public:
int dp[501][501];
bool palindrom(int i ,int j , string &str){
while(i < j ){
if(str[i] != str[j]){
... | ALGO | 0.999933 | 6.51857 |
6b5c0d89-c77e-4a2a-bed0-bbc3acaab274 | Jayteare/HackerRank | Data_Structures/Linked_Lists/Linked_List_Problem7.cpp | /*
Compare two linked lists A and B
Return 1 if they are identical and 0 if they are not.
Node is defined as
struct Node
{
int data;
struct Node *next;
}
*/
int CompareLists(Node *headA, Node* headB)
{
// This is a "method-only" submission.
// You only need to complete this method
if(h... | ALGO | 0.999801 | 4.455644 |
34960e20-e2b2-4539-a34e-44e8d2d3753a | Yomnasalama/leetcode-problem-Solving | largest-values-from-labels.cpp | class Solution {
public:
int largestValsFromLabels(vector<int>& values, vector<int>& labels, int numWanted, int useLimit) {
int n = values.size();
vector<vector<int>> val;
for ( int i = 0; i < n; i++ ) {
val.push_back({values[i], labels[i]});
}
sort(val.begin(), v... | ALGO | 0.99999 | 6.262362 |
5be2c3ba-7850-4f58-8e86-a8d651591bd0 | zqyuan-tw/DSnP2019 | hw6/src/util/util.cpp | #include <sys/types.h>
#include <dirent.h>
#include <errno.h>
#include <vector>
#include <string>
#include <cstring>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include "rnGen.h"
#include "myUsage.h"
using namespace std;
//----------------------------------------------------------------------
// G... | TOOL | 0.891116 | 5.463684 |
8fee973d-c7ae-495b-9964-79ee7f23b3bb | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_5122_10.cpp | #include <bits/stdc++.h>
const long long maxn = 50;
long long read() {
long long x;
scanf("%I64d", &x);
return x;
}
long long n, k, a[maxn];
void cut(long long p) {
memset(a, 0, sizeof(a));
for (long long i = 1; i <= 32; i++)
if (((1 << (i - 1)) & p) > 0) a[i] = 1;
}
signed main() {
n = read(), k = read... | ALGO | 0.999916 | 4.28017 |
a30ddcb3-9d6a-4af0-b3fa-da2a978af956 | devanshkhatri12/DSA | Basic 2.0/ISeven.cpp | #include<iostream>
using namespace std;
bool IsEven(int n)
{
if(n&1) //odd no.
{
return 0;
}
return 1; //even no.
}
void isEven(int n)
{
if((n /2) * 2 == n)
{
cout<<"EVEN"<<endl;
}
else{
cout<<"ODD"<<endl;
}
}
void isEven(int n)
{
cout << ((n %2 == 0... | ALGO | 0.998969 | 4.286036 |
6735d0fd-d9d8-426b-91e6-23a64925acb9 | minhvpham/Competitive_Programing | Vnoj/trau.cpp | #include<bits/stdc++.h>
using namespace std;
#define task "bedao_g10_holiday"
#define pb push_back
#define ll long long
#define ull unsigned long long
#define fi first
#define se second
#define ALL(x) x.begin(),x.end()
#define BIT(i) ((1LL)<<(i))
#define GETBIT(x,i) (((x)>>(i))&1)
#define TURNOFF(x,i) ((x)&(~(1<<i)))
#... | ALGO | 0.999952 | 4.154048 |
82ada1d5-ca6a-4512-a7a0-c5547ca925a1 | sinian666/code_102_6 | cpp_副本10/chapter_searching/hashing_search.cpp | /**
* File: hashing_search.cpp
* Created Time: 2022-11-25
* Author: Krahets (<EMAIL>)
*/
#include "../utils/common.hpp"
/* 哈希查找(数组) */
int hashingSearchArray(unordered_map<int, int> map, int target) {
// 哈希表的 key: 目标元素,value: 索引
// 若哈希表中无此 key ,返回 -1
if (map.find(target) == map.end())
return -... | ALGO | 0.999679 | 5.427675 |
7c9d3aa3-89e2-4c13-b88a-ad3c0b57ceb7 | ishandutta2007/codeforces | quailty/normal/611/E.cpp | #include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<set>
using namespace std;
multiset<int>s;
multiset<int>::iterator itr;
int c[5],tot;
int get_ty(int x)
{
if(c[2]>=x)return 1;
else if(c[1]+c[2]>=x)return 2;
else if(c[0]+c[1]+c[2]>=x)return 3... | ALGO | 0.999975 | 3.515093 |
b1358bf0-e151-4a13-9098-2a5b6dfeeb68 | delphixe1982/wanghucode | 游戏源码/客户端组件/黑杰克/游戏服务器/GameLogic.cpp | #include "StdAfx.h"
#include "GameLogic.h"
//////////////////////////////////////////////////////////////////////////
//̬
const BYTE CGameLogic::m_bCardArray[52] = //˿
{
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
27, 28, 29, 30, 31, 32, 33, 34, 3... | ALGO | 0.992413 | 3.56731 |
382059f7-677a-46a7-9322-1060297759c3 | moscowlights/xray-soc | trunk/3rd party/boost/libs/graph/example/topo-sort2.cpp | int
main()
{
using namespace boost;
const char *tasks[] = {
"pick up kids from school",
"buy groceries (and snacks)",
"get cash at ATM",
"drop off kids at soccer practice",
"cook dinner",
"pick up kids from soccer",
"eat dinner"
};
const int n_tasks = sizeof(tasks) / sizeof(char *);
... | ALGO | 0.997241 | 5.273723 |
1d98465b-f59a-4f7f-9885-0a38bb4ca064 | usmhkoy39/ACM | 图论/同余最短路.cpp | /*
洛谷P3403: 给定x[0], x[1], x[2], ..., x[n - 1], 对于k <= h, 求有多少个k满足a[0]x[0] + a[1]x[1] + ... + a[n - 1]x[n - 1] = k
洛谷P2662: 最大的不能被x[0], x[1], ..., x[n - 1]表示的数(从小到大), 显然如果gcd(x[i]) = x[0], 无解, 否则跑同余最短路求出max(dis) - x[0]即为答案
解决形如上述类型的题目
*/
/*
一是体现在建图
二是体现在最短路
*/
typedef long long ll;
const int N = 2e6 + 10;
#define IN... | ALGO | 0.99991 | 3.638242 |
bc1f3f58-71e5-451a-a80e-3fc53bb51383 | Synonymous64/Leetcode-daily-challenges | Year-2022/LeetCode-July-Challenge/BinaryTreeLevelOrderTraversal.cpp | #include<bits/stdc++.h>
using namespace std;
class TreeNode {
public:
int val;
TreeNode *left;
TreeNode *right;
TreeNode(int value) : val(value) {
left = nullptr;
right = nullptr;
}
};
class Solution {
private :
vector<vector<int>> res;
void levelorderTraversal(TreeNode *roo... | ALGO | 0.999982 | 5.609403 |
635507b5-3940-476c-9ad0-862aaacf69d3 | Darshanpakhale26/Data-Structures-Algorithms | Strings/first_nonRepeatingchar.cpp | // Program to find the first non-repeating character in a string
#include <iostream>
#include <string>
#include <unordered_map>
using namespace std;
char firstNonRepeatingChar(string s) {
unordered_map<char, int> count;
for (int i = 0; i < s.length(); i++) {
count[s[i]]++;
}
for (int i = 0; i ... | ALGO | 0.999246 | 5.480289 |
ef7f28c9-e115-4847-b1b6-af5bed1a9fd9 | ahinagangopadhyay/DSA_PREP | Linked List/Merge K sorted lists.cpp | /*Merge K Sorted Linked Lists
Solved
You are given an array of k linked lists lists, where each list is sorted in ascending order.
Return the sorted linked list that is the result of merging all of the individual linked lists.*/
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* Lis... | ALGO | 0.999935 | 5.901466 |
252c82fa-8606-4d58-9d03-e21065739e30 | JohnItoo/Solvay | SPOJ+Codeforces/trycodejam.cpp | //#include <bits/stdc++.h>
//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
#include <iostream>
using namespace std;
//using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld;
//typedef complex<ld> cd;
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<l... | ALGO | 0.999638 | 4.350559 |
e2893c5c-3f60-40c1-bf7b-a4896d1ce83f | MSHP-Community/Decipherer | Siberia.cpp | #include "Siberia.h"
Siberia::Siberia(std::wstring str)
{
clearText = str;
rows = find_size(str.length());
encryptedTable.resize(rows);
encrypt();
encrypt_text();
encrypt_int_text();
decryptedTable.resize(rows);
decrypt();
}
std::wstring Siberia::get_encrypted_text()
{
return enc... | ALGO | 0.872631 | 3.420518 |
e9009903-3613-4ac3-8658-cf72aca913d2 | hhg128/DKGL | DK/lib/BulletPhysics/src/BulletCollision/CollisionShapes/btConvexHullShape.cpp | #if defined (_WIN32) || defined (__i386__)
#define BT_USE_SSE_IN_API
#endif
#include "btConvexHullShape.h"
#include "BulletCollision/CollisionShapes/btCollisionMargin.h"
#include "LinearMath/btQuaternion.h"
#include "LinearMath/btSerializer.h"
btConvexHullShape ::btConvexHullShape (const btScalar* points,int numPoin... | ALGO | 0.991752 | 7.224159 |
c848eb04-aff6-4f7e-9330-b49f017c4816 | srishtiprasadmanit12/Data-Structure-Algorithm | Binary Search/findPeakElement.cpp | /*************************BRUTE FORCE APPROACH************************* */
class Solution {
public:
int findPeakElement(vector<int>& nums) {
int n = nums.size();
if(n==1){
return 0;
}
if(nums[0]>nums[1]){
return 0;
}
if(nums[n-1]>nums[n-2]){
return n-1;
}
in... | ALGO | 0.999977 | 5.675203 |
75e18e35-03cd-4c22-b5f9-148def2d7ce6 | LaLlorona/Algorithms | CodeForce/R633D2A.cpp | #include <bits/stdc++.h>
using namespace std;
int n;
int main()
{
std::ios_base::sync_with_stdio(false);
std::cin.tie(NULL);
std::cout.tie(NULL);
std::ifstream in("in.txt");
std::streambuf *cinbuf = std::cin.rdbuf(); //save old buf
std::cin.rdbuf(in.rdbuf()); //redirect std::cin to in.txt!
int num_t... | ALGO | 0.976998 | 4.003057 |
75fcfd5e-a32f-4f87-8b5b-70f1fae7d3cf | raincross7/code-similarity | codes/train_code/problem287/problem287_448.cpp | #include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define ll long long
#define rep(i,n) for(int i = 0; i < int(n); i++)
#define vi vector<int>
#define INF (1<<30)-1
using namespace std;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
template<class T> inline bool chmax(T &a, const T &b){ if(a... | ALGO | 0.999987 | 3.899236 |
26762660-f81a-4b13-8c61-1a8189b6b765 | phantomwolf/leetcode-problems | Algorithm/Tree/BinaryTree/MaximumPath/main.cpp | #include <iostream>
#include <stack>
#include <unordered_map>
#include <limits>
using namespace std;
typedef struct TreeNode TreeNode;
struct TreeNode {
int val;
TreeNode *left;
TreeNode *right;
TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
};
inline int max3(int a, int b, int c)
{
... | ALGO | 0.999972 | 4.944711 |
4d8d6b5b-d649-4598-b8b7-5fd61ca0fea1 | jnvshubham7/All_Programming | All_Folder/DSA/Graph/Graph_Adjacency_Matrix.cpp | // Adjacency Matrix representation in C++
#include <iostream>
using namespace std;
class Graph {
private:
bool** adjMatrix;
int numVertices;
public:
// Initialize the matrix to zero
Graph(int numVertices) {
this->numVertices = numVertices;
adjMatrix = new bool*[numVertices];
for (int i = 0;... | ALGO | 0.99912 | 5.898176 |
24fca890-a177-4a77-a0cf-e41b41095980 | CrealityOfficial/CrealityPrint | src/libigl/igl/mosek/mosek_linprog.cpp | IGL_INLINE bool igl::mosek::mosek_linprog(
const Eigen::VectorXd & c,
const Eigen::SparseMatrix<double> & A,
const Eigen::VectorXd & lc,
const Eigen::VectorXd & uc,
const Eigen::VectorXd & lx,
const Eigen::VectorXd & ux,
Eigen::VectorXd & x)
{
// variables for mosek task, env and result code
MSKenv_t ... | ALGO | 0.997573 | 6.554703 |
08bfecb7-89ef-488f-a63f-0cf887bd3b58 | Satyajeet5275/Data_Structures_and_Algorithms-Leetcode | 719-find-k-th-smallest-pair-distance/find-k-th-smallest-pair-distance.cpp | #include <vector>
#include <algorithm>
class Solution {
public:
int smallestDistancePair(std::vector<int>& numbers, int k) {
std::sort(numbers.begin(), numbers.end());
int minDistance = 0, maxDistance = numbers.back() - numbers.front();
while (minDistance < maxDistance) {
... | ALGO | 0.999995 | 6.717769 |
e60493e7-55ed-40fb-88b9-8ae6e4af4fc5 | amoghkrishna55/CPP | testata.cpp | #include<iostream>
#include<sstream>
#include<vector>
using namespace std;
int main(){
string line;
getline(cin, line);
istringstream iss(line);
int num;
vector<int> v;
while(iss >> num){
v.push_back(num);
}
int limit;
cin >> limit;
int truck = 0;
int start = 0;
... | ALGO | 0.999974 | 4.022287 |
943baa50-d99d-4930-9ba0-e927ca3ffc5f | jizhang-cmu/autonomy_stack_diablo_setup | src/slam/dependency/gtsam/examples/StereoVOExample.cpp | /**
* @file StereoVOExample.cpp
* @brief A stereo visual odometry example
* @date May 25, 2014
* @author Stephen Camp
*/
/**
* A 3D stereo visual odometry example
* - robot starts at origin
* -moves forward 1 meter
* -takes stereo readings on three landmarks
*/
#include <gtsam/geometry/Pose3.h>
#include ... | ALGO | 0.99924 | 6.608006 |
ebb0a254-0db9-4c1c-99f5-bf2a790b8874 | lkoiescg2031/APSS | Baekjoon Online Judge/1074.cpp | #include <cstdio>
int n, x, y;
bool is_in(int i, int j, int s) {
return i <= x && x < i + s && j <= y && y < j + s;
}
int sol(int x, int y, int s) {
int ret = 0;
if (s == 1) return 1;
s /= 2;
for(int i=0;i<2;i++)
for (int j = 0; j < 2; j++) {
if (is_in(x + i * s, y + j * s, s)) {
return ret + sol(x + i *... | ALGO | 0.998772 | 3.865833 |
ba7af688-fce5-47a0-bdde-08d329747a4c | basecode-lang/basecode | share/prototypes/bootstrap/ext/boost-1.67.0/libs/algorithm/string/example/rle_example.cpp | // Boost string_algo library example file ---------------------------------//
// See http://www.boost.org for updates, documentation, and revision history.
/*
RLE compression using replace framework. Goal is to compress a sequence of
repeating characters into 3 bytes ( repeat mark, character and repetition... | ALGO | 0.9995 | 5.694153 |
b06ec159-127b-41c4-9aea-4b1b4c3665c7 | atulanand1811/DSA-Supreme-Batch | ARRAYS_10th_February_2023/minNumber.cpp | #include <iostream>
using namespace std;
int main()
{
int arr[] = {5, 7, 6, 2, 3, 9, 4, 8, 12};
int n = 10;
int min = INT_MAX;
for(int i = 0; i < n; i++) {
if(arr[i] < min) {
min = arr[i];
}
}
cout << "\nMinimum no. in an array is: " << min << endl;
return 0;
... | ALGO | 0.999946 | 4.151838 |
b0a38224-b9f1-46b6-9909-b436814a6caa | Leaves333/competitive-programming | cf/1883/g1.cpp | #pragma optimize("O3")
#include <bits/stdc++.h>
using namespace std;
#define all(x) begin(x), end(x)
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<vb>... | ALGO | 0.99999 | 3.700526 |
b6c234bc-224f-4a62-996e-1b7a05645397 | tarangparmar007/Practice-set-CPP | 2/2-14.cpp | /*14. WA function using variables as arguments to swap the values of a pair of integers using call
by value, call by address and call by reference*/
#include<iostream>
#include<iomanip>
using namespace std;
void swap( int a, int b)
{
int c;
c=a;
a=b;
b=c;
cout<<"Values of a and b after swapping:"<<endl;
... | ALGO | 0.997873 | 5.13924 |
ebd7ba5d-86c8-482a-a877-4dcbc2736144 | Amel-CYDF/BOJ | BOJ_11051.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<int,pii> piii;
#define N 1010
#define M 100010
#define MOD 10007
int n,m,a[N][N];
int main(){
// freopen("input.txt","r",stdin);
cin>>n>>m;
for(int i=0;i<=n;i++)
{
a[i][0]=1;
for(... | ALGO | 0.99998 | 4.075639 |
84ebaf63-fd18-4349-8cab-afc77d2b26e2 | neverac/2020summer | 个人赛3/H/26460143_3019244286_H.cpp | #include<iostream>
#include<cstdio>
using namespace std;
char maps[60][60];
int main() {
int t;
scanf("%d", &t);
while (t--) {
int r, c;
scanf("%d%d", &r, &c);
for (int i = 0; i < r; i++) {
getchar();
for (int j = 0; j < c; j++) {
scanf("%c", &maps[i][j]);
}
}
bool hasA = 0;
bool hasP = 0... | ALGO | 0.99994 | 3.818434 |
538a88a8-4f94-480f-8a87-43e6dbf759c4 | Anilkumar90386/Data-Structures-And-Alogorithms | Array/two_sum.cpp | #include<bits/stdc++.h>
using namespace std;
/// @brief
/// @return
int main()
{
int n;
cin>>n;
int arr[n];
int target;
for(int i=0;i<n;i++)
{
cin>>arr[i];
}
cin>>target;
/*for(int i=0;i<n;i++)
{
for(int j=i+1;j<n;j++) O(n^2)
{
if(arr[i]... | ALGO | 0.999524 | 5.422055 |
95f5076e-df78-40af-a6b1-d6af9af922d8 | himanshuagarwal407/LeetCode_GFG_Problems | 55-jump-game/55-jump-game.cpp | class Solution {
public:
bool canJump(vector<int>& nums) {
int n=nums.size();
int mSum=0;
for(int i=0; i<n; i++)
{
if(i<=mSum)
mSum = max(i+nums[i], mSum);
else
return false;
}
return true;
... | ALGO | 0.999977 | 6.23366 |
01497b01-4049-41ab-a886-85d275d049d2 | Smorodov/ImGUI_colorer | shared/colorer/parsers/helpers/TextParserHelpers.cpp |
#include<colorer/parsers/helpers/TextParserHelpers.h>
#include<common/Logging.h>
/////////////////////////////////////////////////////////////////////////
// parser's cache structures
ParseCache::ParseCache()
{
children = next = parent = null;
backLine = null;
vcache = 0;
};
ParseCache::~ParseCache()
{
CLR_TR... | TOOL | 0.941981 | 3.551626 |
9d69fdce-f242-427b-8007-bd8670867582 | Rishabhcodes65536/RISHABH_CP | D/D_Trivial_Conjecture.cpp | #include<bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
//using namespace __gnu_pbds;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
#define endl '\n'
#define ff first
#define ss second
#define ... | ALGO | 0.999451 | 3.238659 |
ab54c883-7dbb-4692-98ad-82d61f44003b | kirito-udit/DSA-450 | FINAL450/Dynamic programming/TilingProblem/TilingProblem2.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n,m;
cin >> n >> m;
int dp[n+1];
for(int i=1;i<=n;i++)
{
if(i<m)
dp[i] = 1;
else if(i==m)
dp[i] = 2;
else{
dp[i] = dp[i-1] + dp[i-m];
}
}
cout << dp[n] << endl;
} | ALGO | 0.999987 | 3.148306 |
881eee97-e7dc-4c8e-8134-2766225aa1cf | bever209/Competitive-Programming | Cpp programs/USACO/2021_to_2022/G1_Jan.cpp | #include <bits/stdc++.h>
#define pb push_back
#define f first
#define s second
#define mp make_pair
#define pq priority_queue
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<ll>;
using str = string;
const ll inf = 2 * 1e18;
const ll mod=1e9+7;
int main() {
ios::sync_with... | ALGO | 0.999968 | 4.17569 |
167a7404-9404-4643-8117-7a36dcb36d58 | manitbaser/LeetCode | problems/add_binary/solution.cpp | class Solution {
public:
string addBinary(string a, string b) {
int c = 0, i = 0;
reverse(a.begin(),a.end());
reverse(b.begin(),b.end());
while(i<a.length() && i<b.length()){
if(a[i]-'0' + b[i]-'0'+c==3) c = 1;
else if(a[i]-'0' + b[i]-'0'+c==2) a[i] = '0', c =... | ALGO | 0.999988 | 6.022901 |
dc5c8688-70a3-41d1-9da7-3c13a3c427f2 | TS-aynaT/c-practice | FirstAndLast.cpp | class Solution {
public:
vector<int> searchRange(vector<int>& nums, int target) {
vector<int> arr1(2,-1);
int l= nums.size();
for(int i=0;i<l;i++)
{
if(target==nums[i])
{
if(arr1[0]==-1)
arr1[0]=i;
arr1[1]=i;
... | ALGO | 0.999845 | 6.448179 |
0048bce2-a018-4d20-93a2-3624fb80362b | rosedu/digikam-2012-kipi-plugins | dngconverter/dngwriter/extra/dng_sdk/dng_utils.cpp | /*****************************************************************************/
/*****************************************************************************/
/* $Id: //mondo/dng_sdk_1_3/dng_sdk/source/dng_utils.cpp#1 $ */
/* $DateTime: 2009/06/22 05:04:49 $ */
/* $Change: 578634 $ */
/* $Author: tknoll $ */
/*****... | TOOL | 0.939288 | 6.263317 |
7d3cf117-23a9-4e26-b2b4-ab0acb5fa9f7 | rahulsud48/cpp | platters.cpp | #include<iostream>
#include<conio.h>
using namespace std;
int main()
{
int speed;
cout << "\nEnter 33,45, or 78: ";cin >> speed;
switch(speed)
{
case 33:
cout<<"A";
break;
case 45:
cout<<"B";
break;
case 78:
cout<<"C";... | ALGO | 0.881143 | 3.211107 |
f2ead12f-b8ff-415c-a52e-f71ffa7368a5 | amorphous1/aoc2021 | day03.cpp | #include <iostream>
#include <vector>
using namespace std;
int day03a(const vector<string>& lines) {
size_t rows = lines.size(), cols = lines.at(0).length();
string gamma, epsilon;
for (int x = 0; x < cols; x++) {
int one_bits = 0;
for (const string& line : lines) {
if (line[x]... | ALGO | 0.998277 | 6.392337 |
e654f517-d8fb-4d21-b140-edd0d6c3ab44 | raincross7/code-similarity | codes/train_code/problem115/problem115_251.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int Sheep,Wolf;
cin >> Sheep >> Wolf ;
if(Sheep > Wolf){
cout << "safe" << endl;
}else{
cout << "unsafe" << endl;
}
} | ALGO | 0.998593 | 3.708149 |
b87f9027-c386-405f-9f9e-d97c64c18568 | Pentacode-IAFA/Quad-Remeshing | libs/quadwild/libs/libigl/include/igl/embree/bone_heat.cpp | bool igl::embree::bone_heat(
const Eigen::MatrixXd & V,
const Eigen::MatrixXi & F,
const Eigen::MatrixXd & C,
const Eigen::VectorXi & P,
const Eigen::MatrixXi & BE,
const Eigen::MatrixXi & CE,
Eigen::MatrixXd & W)
{
using namespace std;
using namespace Eigen;
assert(CE.rows() == 0 && "Cage edges not... | ALGO | 0.987873 | 5.674852 |
f49fedd8-cf9c-4751-95d3-b81e3d374711 | shaoshengsong/YOLOv8Det | eigen/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_broadcast_simple_rowwise.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
int main()
{
Eigen::MatrixXf mat(2,4);
Eigen::VectorXf v(4);
mat << 1, 2, 6, 9,
3, 1, 7, 2;
v << 0,1,2,3;
//add v to each row of m
mat.rowwise() += v.transpose();
std::cout << "Broadcasting result: " << std::... | ALGO | 0.997979 | 4.296038 |
3b2f5347-3ed7-4f15-a5cf-6df8a86fafb2 | AndreyVAAVA/MIREA_Programming_C- | MIREA/Task4.cpp | #include "Task4.h"
void Task4::task1(std::string path)
{
srand(time(0));
std::ofstream fout(path);
if (!fout)
{
std::cout << "you entered wrong file name or file doesn't exists";
}
else
{
for (int i = 0; i < 10; i++)
{
fout << rand() % 1000 - 500;
fout << " ";
}
fout.close();
char el;
std::s... | TOOL | 0.851073 | 3.105541 |
1a6d048b-d68f-4c69-bf0a-9019ecca997f | Chirag-creator17/450-dsa-questions | array-string-searching/min-swap-for-no-less-k-together.cpp | #include <bits/stdc++.h>
using namespace std;
int minSwap(int *arr, int n, int k)
{
int count = 0;
for (int i = 0; i < n; ++i)
if (arr[i] <= k)
++count;
int bad = 0;
for (int i = 0; i < count; ++i)
if (arr[i] > k)
++bad;
int ans = bad;
for (int i = 0, j = ... | ALGO | 0.999953 | 4.087295 |
f351522c-5a8f-48a4-9bfa-c0fc6a3e7ae5 | duows/Exercicios-Programacao | AQUECIMENTO_INTRIF_2/O/O_Jadir.cpp | #include <bits/stdc++.h>
using namespace std;
#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
#define lli long long int
const double TOLERANCE = 1e-7;
const int MAX_ITERATIONS = 10000;
double evaluatePolynomial(const vector<double>& coeffs, double x) {
double result = 0;
double power =... | ALGO | 0.999907 | 4.78168 |
0b503e6b-bf62-4122-829d-8ff5f94b46a7 | NMSU-KLAP/fzn-minicpp | fz_constraints/int_array.cpp | #include <algorithm>
#include <limits>
#include <fz_constraints/int_array.hpp>
array_int_element::array_int_element(CPSolver::Ptr cp, FlatZinc::Constraint& fzConstraint, std::vector<var<int>::Ptr>& int_vars, std::vector<var<bool>::Ptr>& bool_vars) :
Constraint(cp),
_b(int_vars[fzConstraint.vars[0]]),
_as()... | ALGO | 0.979796 | 5.312199 |
11ce7432-d00d-4245-a7bc-eb376c18e8d6 | JoaoP-Silva/BikeShapley | src/main.cpp | #include "genPrefList.h"
#include "Bicycle.h"
#include "User.h"
#include <fstream>
int main(int argc, char* argv[]) {
int numVis, rows, collums;
std::ifstream inFile;
inFile.open(argv[1]);
//Lendo o numero de pessoas, linhas e colunas do mapa
inFile >> numVis; inFile >> rows; inFile >> collums;
//Alocando a ... | ALGO | 0.98698 | 3.940439 |
fe401a58-4628-4ed9-b4d5-5026b4ef1131 | AnesBendimerad/FaceRecognition | src/FaceFinder.cpp | #include "FaceFinder.hpp"
FaceFinder::FaceFinder(const string& model_file,const string& trained_file)
{
classifier=new Classifier(model_file,trained_file);
maxInitialSize=-1;
faceThreshold=FACE_THRESHOLD;
quantile=DEFAUTLT_QUANTILE;
}
void FaceFinder::SetQuantile(float quantile)
{
FaceFinder::quant... | TOOL | 0.879953 | 4.948688 |
594b1c91-fa35-43fd-a207-74b859f7839d | ishandutta2007/codeforces | pashka/normal/859/D.cpp | #include <cstdio>
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <map>
#define MAX_INT 2147483647
#define MOD 1000000007L
#define PI 3.141592653589793238462643383279502884L
#define long long long int
using std::vector;
using std::map;
using std::string;
using std::pair;
using ... | ALGO | 0.999678 | 3.792441 |
5c8b3794-0564-471e-b4f5-f109ba7c184e | Choidaehankr/BOJ-Algorithm | BFS-DFS/4963/4963_섬의개수.cpp | // 4963 섬의 개수
#include <iostream>
#include <queue>
#include <cstring>
using namespace std;
int r=0, c=0;
int arr[51][51];
int dx[8] = {1, 0, -1, 0, -1, 1, 1, -1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
void init() {
memset(arr, 0, sizeof(arr));
}
void input(int r, int c) {
for (int i = 0; i < r; i++) {
for (int ... | ALGO | 0.999681 | 5.245333 |
e95a039e-249a-404b-ae73-3ca79300eac1 | AbdoWael2003/Graduation-Project-QAgent2.0- | FlowChartGeneration/CPPSamples/Sample916/sample_code916.cpp | #include <iostream>
#include <regex>
#include <string>
std::string text_uppercase_lowercase(const std::string& text) {
std::regex patterns("[A-Z]+[a-z]+$");
if (std::regex_search(text, patterns)) {
return "Found a match!";
} else {
return "Not matched!";
}
}
| TOOL | 0.874011 | 4.991619 |
56d7a496-cd49-4477-92cd-c97e3b598c6d | shanthansuresh/SDC-Term2 | P5-MPC-Controller/CarND-MPC-Project/src/Eigen-3.3/bench/sparse_lu.cpp |
// g++ -I.. sparse_lu.cpp -O3 -g0 -I /usr/include/superlu/ -lsuperlu -lgfortran -DSIZE=1000 -DDENSITY=.05 && ./a.out
#define EIGEN_SUPERLU_SUPPORT
#define EIGEN_UMFPACK_SUPPORT
#include <Eigen/Sparse>
#define NOGMM
#define NOMTL
#ifndef SIZE
#define SIZE 10
#endif
#ifndef DENSITY
#define DENSITY 0.01
#endif
#ifnd... | ALGO | 0.995476 | 4.187482 |
9eed4369-5b4b-4da9-b47c-cff647526579 | VenkatRaman3103/Data-Structures-and-Algorithms | cpp/03-Array/3.1-Easy/3.1.1-Check-If-Array-is-Sorted/3.1.1-Check-If-Array-is-Sorted.cpp | #include <iostream>
#include <vector>
using namespace std;
class Solution
{
public:
bool check(vector<int> &nums)
{
int counter = 0;
if(nums[0] < nums[nums.size() - 1]){
counter++;
}
for (int i = 1; i < nums.size(); i++)
{
if (nums[i - 1] < nu... | ALGO | 0.999692 | 5.165873 |
e63c98a4-3230-494c-9893-51d63ca26a03 | jubos/meguro | deps/spidermonkey/jshash.cpp | /*
* PR hash table package.
*/
#include <stdlib.h>
#include <string.h>
#include "jstypes.h"
#include "jsstdint.h"
#include "jsbit.h"
#include "jsutil.h" /* Added by JSIFY */
#include "jshash.h" /* Added by JSIFY */
/* Compute the number of buckets in ht */
#define NBUCKETS(ht) JS_BIT(JS_HASH_BITS - (ht)->shift)
... | ALGO | 0.899344 | 6.547047 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.