uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
7d532b2e-079c-407d-9efe-6b422ca428e0 | gaumarjos/T2-CarND-MPC-Quizzes | mpc_to_line/src/Eigen-3.3/failtest/jacobisvd_int.cpp | #include "../Eigen/SVD"
#ifdef EIGEN_SHOULD_FAIL_TO_BUILD
#define SCALAR int
#else
#define SCALAR float
#endif
using namespace Eigen;
int main()
{
JacobiSVD<Matrix<SCALAR,Dynamic,Dynamic> > qr(Matrix<SCALAR,Dynamic,Dynamic>::Random(10,10));
}
| ALGO | 0.926546 | 3.33146 |
2cf9bae8-9dde-4cb7-8f96-16e8e2eada51 | Nishant-Bhosale/Competitive-Programming-CPP | CodeForces_Problems/MediumBitManipulationProblems/AndIt'sNonZero.cpp | #include<bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define vii vector<int,int>
#define rep(a,b) for(int i = a;i<b;i++)
#define pi pair<int,int>
typedef long long ll;
const ll N = 2e5 + 1;
ll arr[N][31];
void preCalc(){
for(ll i = 1; i < N; i++){
for(ll j = 0; j <= 30; j++){
if(i&(1... | ALGO | 0.999828 | 4.13686 |
7a9ac7e9-09b8-40ae-9719-7aa5be29ff08 | graceemlin/codeforces | 2033/2033a.cpp | #include <bits/stdc++.h>
using namespace std;
int main(int argc, char* argv[]) {
ios::sync_with_stdio(0);
cin.tie(0);
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
int turn_num = 0;
int dot_location = 0;
int direction = 1;
while (dot_location >= -1 * n && dot_location <= n) {
... | ALGO | 0.999969 | 4.565412 |
fa894395-73de-4932-908f-972cf765c5d4 | Githubiswhat/LeetCode | C++/src/Solution1101_1200/Solution1188.cpp | //
// Created by windows on 2023/3/2.
//
#include "Solution1188.h"
#include <functional>
#include <iostream>
#include <vector>
#include <unordered_set>
#include <unordered_map>
#include <string>
using namespace std;
| ALGO | 0.979278 | 3.125334 |
7a43d1c7-d528-4e9f-8839-8bbbc9f6099f | ArchitKumar1/LeetCode-Submissions | count-all-valid-pickup-and-delivery-options/Accepted/3-29-2020, 6:46:50 AM/Solution.cpp | // https://leetcode.com/problems/count-all-valid-pickup-and-delivery-options
class Solution {
public:
int countOrders(int n) {
long long prev = 1;
long long mod = 1e9+7;
for(int i = 2;i<=n;i++){
long long curr = (i-1)*2+2;
curr = ((long long )(curr)*(curr-1)/2)%mod;... | ALGO | 0.999993 | 6.20541 |
5274ec48-1e89-4fb8-bfeb-9e934e66c6df | behrang-kaboudi/meta1 | public/components/stockfish.js-master/src/endgame.cpp | #include <cassert>
#include "bitboard.h"
#include "endgame.h"
#include "movegen.h"
namespace {
// Used to drive the king towards the edge of the board
// in KX vs K and KQ vs KR endgames.
// Values range from 27 (center squares) to 90 (in the corners)
inline int push_to_edge(Square s) {
int rd = edge_d... | ALGO | 0.998681 | 6.68818 |
f7a11ef3-eaa8-4009-8818-73ea5e35530e | tllaw/cp | src/codechef/contests/LP1TO203/MAGDOORS.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
long long t;
string s;
cin >> t;
while(t--) {
long long p = '1', r = 0;
cin >> s;
for(long long i = 0; i < s.length(); i++) {
r += p != s[i];
p = s[i];
}
cout << r << endl;
... | ALGO | 0.999934 | 4.522784 |
2be1774d-3a2e-42f7-a9a3-9ec5a4bbea8c | elManto/SAST_on_Decompilers | CVE/CVE-2017-17760/project_code/opencv/samples/gpu/optical_flow.cpp | #include <iostream>
#include <fstream>
#include "opencv2/core.hpp"
#include <opencv2/core/utility.hpp>
#include "opencv2/highgui.hpp"
#include "opencv2/cudaoptflow.hpp"
#include "opencv2/cudaarithm.hpp"
using namespace std;
using namespace cv;
using namespace cv::cuda;
inline bool isFlowCorrect(Point2f u)
{
retu... | ALGO | 0.979255 | 6.070336 |
5bf56e14-fcc0-459c-9667-d8e06c45685c | brunoduan/mojo-strip | third_party/android_ndk/sources/cxx-stl/llvm-libc++/test/std/algorithms/alg.nonmodifying/alg.find.end/find_end_pred.pass.cpp | // <algorithm>
// template<ForwardIterator Iter1, ForwardIterator Iter2,
// Predicate<auto, Iter1::value_type, Iter2::value_type> Pred>
// requires CopyConstructible<Pred>
// Iter1
// find_end(Iter1 first1, Iter1 last1, Iter2 first2, Iter2 last2, Pred pred);
#include <algorithm>
#include <cassert>
#in... | TEST | 0.985427 | 6.196625 |
f40bb7c3-47c0-44df-b561-eb28264b59f6 | chowon986/Study | 백준 알고리즘/1/1.cpp | // 1.cpp : https://www.acmicpc.net/problem/4375
#include <iostream>
using namespace std;
int main()
{
int N;
while (cin >> N)
{
int CurNum = 0;
for (int i = 1; ; i++)
{
CurNum = CurNum * 10 + 1;
CurNum = CurNum % N;
if (CurNum == 0)
{
cout << i << '\n';
break;
}
}
}
} | ALGO | 0.999875 | 4.316681 |
0d519d2c-09a1-469e-8ea4-7df2aa6440fd | EECE27/Embedded | Sections/section3.cpp | #include <iostream>
/*Stacks & Queues*/
struct node;
typedef node* link;
struct data
{
int data;
link next;
};
template <typename T, int max> // Non-type paramter to specify the size
class stack
{
private:
T arr[max];
int top;
public:
stack()
{
... | ALGO | 0.99756 | 4.726107 |
0f454aec-5ac8-4ba4-9820-655efc867f88 | dev-Rluan/codeTest | Baekjoon/BasicMathTwo1978/BasicMathTwo1978.cpp | #include <iostream>
using namespace std;
bool isPrime(int num)
{
for (int i = 2; i * i <= num; i++)
{
if (num % i == 0)
return false;
}
return true;
}
int main()
{
int n, cnt = 0, num;
cin >> n;
for (int i = 0; i < n; i++)
{
cin >> num;
if (num == 1... | ALGO | 0.999975 | 4.152853 |
15928370-1a61-4309-9da7-0045b5a0d1a9 | Hieu031/VTI_Tranning | TraniningCpp/DynamicAllocarion/alloOperator.cpp | #include <iostream>
using namespace std;
/*
Dynamic allocation to pointer is a operation which assign pointer a specified
memory and put it into occupied area which ohters program can't use.
*/
int main(){
int a[5] = {1, 3, 5, 7, 9};
int *pa = new int(12); //allocate dynamic pointer pa and assgin value is... | ALGO | 0.983702 | 3.296943 |
d68183d8-38a4-423f-a8ef-2fffd5a28bf5 | Szelethus/cpp_courses | 2024-25-2/friday10-12/11gy/remove.cpp | #include <iostream>
#include <vector>
#include <algorithm>
struct IsEven {
bool operator()(int i) {
return i % 2 == 0;
}
};
int main() {
std::vector<int> v{1,2,3,4,5,6,7,8,9};
auto it = std::remove_if(v.begin(), v.end(), IsEven{});
std::cout << *it << '\n';
std::cout << '\n';
v.erase(it, v.end())... | ALGO | 0.995902 | 5.545682 |
81f7ce13-6b28-421f-aaf8-3be2f75e9e87 | lucadecandia2000/personal | UNIVERSITY/sysdevprog/labs/lab4/ex01.cpp | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <iostream>
#include <thread>
#include <fstream>
#include <list>
#include <vector>
#include <algorithm>
struct thread_data{
char* fileName ;
int* output ;
int size ;
} ;
using namespace std ;
void * t_f( thread_data *data) {
ifstream file... | ALGO | 0.997081 | 3.290746 |
14302f93-ab5b-4dcb-b33b-66298190824b | Hahava1/Beecrowd-solutions | Iniciante/CPP/3241.cpp | #include <iostream>
#include <string>
using namespace std;
int main() {
int n;
string s;
cin >> n;
for(int i = 0; i < n; i++) {
cin >> s;
int found;
found = s.find("+");
if(found == -1) cout << "skipped" << endl;
else {
int a = stoi(s.substr(0, found... | ALGO | 0.99985 | 5.221369 |
ec324e57-9d96-437a-b965-0b7e13a89da4 | Eduard0803/TEP | codeforces/1D_eraser.cpp | #include <bits/stdc++.h>
using namespace std;
// link: https://codeforces.com/contest/1873/problem/D
int main(){
int t, n, k;
cin >> t;
for(int j=0; j<t; ++j){
string s;
int count=0;
cin >> n >> k;
cin >> s;
for(int i=0; i<n; ++i)
if(s[i] == 'B'){
... | ALGO | 0.999534 | 3.829461 |
899bb39f-2583-40a7-af10-a4c42868ad57 | ishandutta2007/codeforces | khadaev/normal/378/A.cpp | #include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define forn(i, a, n) for (int i = (int)(a); i < (int)(n); ++i)
... | ALGO | 0.999828 | 4.147571 |
902a8880-894d-4c61-b7aa-96379a1f2917 | SwetabjaGit/competitive-programming | SEAKAM.cpp | #include<bits/stdc++.h>
#define ll long long
using namespace std;
const ll MOD = 1e9+7;
ll dp[100007],n;
map < ll,ll > m;
vector < pair < ll,ll > > arr;
vector < vector < ll > > graph;
vector < ll > v;
vector < ll > temp;
bool visited[17];
void pre(){
dp[0]=1;
for(ll i=1;i<=100000;i++){
dp[i]=(dp[i-1]*1LL*i)%MO... | ALGO | 0.999673 | 4.777884 |
813caeea-8bfd-4c6c-bf26-d79a67835c59 | ishandutta2007/codeforces | rush_d_cat/normal/1479/B1.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N = 200000 + 10;
int a[N << 2], lz[N << 2];
void pushdown(int rt) {
if (lz[rt]) {
lz[rt<<1] += lz[rt];
a[rt<<1] += lz[rt];
lz[rt<<1|1] += lz[rt];
a[rt<<1|1] += lz[rt];
lz[rt] = 0;
}
}
void update1(int l, int r, int rt, int L, int ... | ALGO | 0.999975 | 4.168514 |
a7d912bf-bf4b-4bfa-9ba5-6f9b7587d5c7 | Mosina916/April23_CPP | Lecture5/arthematicop.cpp | #include<iostream>
using namespace std;
int main(){
// pre inc
// int a=10;
// int y=++a;
// cout<<"value of a is "<<a<<endl;
// cout<<"value of y is "<<y<<endl;
// // post inc
// int a=10;
// int y=a++;
// cout<<"value of a is "<<a<<endl;
// cout<<"value of y is "<<y<<endl;
// pre dec
// int a=10;
//... | ALGO | 0.990548 | 3.432216 |
68b5da36-0d02-42f2-af6d-9207e8d750c7 | CTranLam/DSA-28tech | Linked list/bai 9 liet ke.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
struct node{
int data;
node * next;
};
node * makenode(int x){
node* newnode=new node;
newnode->data=x;
newnode->next=NULL;
return newnode;
}
void insert(node*& head,int x){
node* newnode=makenode(x);
if(head==NULL){
head=newnode;
return;
}... | ALGO | 0.999951 | 4.155919 |
441bb149-aaeb-4b87-8bb1-21ee0ef10c7c | ayoushman/c- | C-Plus-Plus-master/data_structures/disjoint_set.cpp | /**
*
* \file
* \brief [Disjoint Sets Data Structure
* (Disjoint Sets)](https://en.wikipedia.org/wiki/Disjoint-set_data_structure)
*
* \author [leoyang429](https://github.com/leoyang429)
*
* \details
* A disjoint set data structure (also called union find or merge find set)
* is a data structure that tracks a... | ALGO | 0.999728 | 5.460063 |
2c9e713d-eeda-4724-b736-299cf19f71b1 | ssbadjate02/Competetive-Programming | templates/Data Structures/2D_fenwick.cpp | struct fenwick_2D {
vector<vector<int>>bit;
int n;
fenwick_2D(int n) {
this->n = n;
bit.assign(n , vector<int>(n));
}
void add(int i , int j , int delta) {
for (; i < n; i = i | (i + 1))
for (int y = j; y < n; y = y | (y + 1))
bit[i][y] += delta;
... | ALGO | 0.999646 | 4.256435 |
bce8e812-174f-48a1-b054-fef7ab79bbf4 | jinhan814/solutions | ICPC/LATIN/latin24_e.cpp | #include <bits/stdc++.h>
using namespace std;
auto check = [](int n, auto v) {
vector c(n + 1, 0);
for (int i = 1; i + 1 < n; i++) {
if (!v[i] || c[v[i]]++) return 0;
if (v[i - 1] < v[i]) continue;
if (v[i] > v[i + 1]) continue;
return 0;
}
return 1;
};
auto construct = [](int n, int p, auto v) {
if (p <... | ALGO | 0.999991 | 3.584166 |
7bd315c5-f267-4894-ae46-fbd2ea6767d6 | saurabh317/C-PLUS-PLUS-PRACTICE | factorial.cpp | #include<iostream>
using namespace std;
int main()
{
int n,fact,i,j;
float sum=0;
cout<<"enter the no. of terms";
cin>>n;
for(i=1;i<=n;i++)
{
fact=1;
for(j=1;j<=i;j++)
{
fact=fact*i;
}
sum=sum+(float)1/fact;
}
cout<<"sum="<<sum<... | ALGO | 0.999831 | 3.58893 |
3debde32-1699-425c-a57a-55250497801c | khleungaw/https-server | src/server.cpp | //
// Created by Solace on 6/7/2022.
//
#include <iostream>
#include <cstring>
#include <csignal>
#include <thread>
#include <filesystem>
#include <algorithm>
#include <unistd.h>
#include <sys/epoll.h>
#include <sys/signalfd.h>
#include <openssl/err.h>
#include <arpa/inet.h>
#include <fstream>
#include <utility>
#incl... | WEB | 0.933528 | 6.546246 |
9b451f33-4e04-4075-a82c-685f8aa76229 | IcemanGambit/SPOJ | tst.cpp | #include <iostream>
#include <vector>
using namespace std;
int f[1000000];
void sort(int s[][],int q){
int t1,t2,t3;
for(int i=0;i<q;i++){
for(int j=0;j<q-i-1;j++){
if(s[j][0] > s[j+1][0]){
t1 = s[j][0];t2 = s[j][1];t3 = s[j][2];
s[j][0] = s[j+1][0];s[j][1] = s[j+1][1];s[j][2] = s[j+1][2];
s[j+1][0]... | ALGO | 0.9998 | 3.486011 |
37525926-7b8c-4288-bdc0-8800fe9cd3b1 | SimulationEverywhere/CDPP_ExtendedStates-codename-Santi | src/cd++/atomics/cpu/cpu.cpp | /*******************************************************************
*
* DESCRIPTION: class CPU (processes jobs with a specified
* distribution)
*
* AUTHOR: Amir Barylko & Jorge Beyoglonian
* v2: Alejandro Troccoli
*
* EMAIL: mailto://<EMAIL>
* mailto://<EMAIL>
* mailto://<EMAIL>
*
* DATE:... | TOOL | 0.983847 | 4.186381 |
9b382ff9-d538-41ec-ac5c-29848f39a9b2 | alejandrocanadas/spotifyAppCourse | dev/manual_tests/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.998685 | 6.770269 |
89df53dd-0bd5-46e9-a351-890b9b42a6a1 | GenesisOS/android_frameworks_base | libs/hwui/jni/PathMeasure.cpp | #include "GraphicsJNI.h"
#include "SkMatrix.h"
#include "SkPath.h"
#include "SkPathMeasure.h"
#include "SkPoint.h"
#include "SkScalar.h"
/* We declare an explicit pair, so that we don't have to rely on the java
client to be sure not to edit the path while we have an active measure
object associated with it.
... | TOOL | 0.932322 | 6.125662 |
10f2f336-43e1-4107-bb8c-f03e78cd8bc5 | su1jun/Chess | stockfish/src/nnue/features/half_ka_v2_hm.cpp | //Definition of input features HalfKAv2_hm of NNUE evaluation function
#include "half_ka_v2_hm.h"
#include "../../position.h"
namespace Stockfish::Eval::NNUE::Features {
// Index of a feature for a given king position and another piece on some square
template<Color Perspective>
inline IndexType HalfKAv2_hm::m... | ALGO | 0.874363 | 7.09654 |
af00a07b-27c0-46cc-918b-33ecc09033b7 | enochjung/acmicpc_net | 14/14240.cpp | #include <cstdio>
#include <algorithm>
#include <list>
#define N 200010
using std::max;
using std::list;
int n, a[N];
long long b[N];
class remainder
{
private:
struct st
{
long long p, q;
};
list<st> l;
public:
void push(long long value, long long interval)
{
l.insert(l.end(), {value, interval});
}
lo... | ALGO | 0.999883 | 3.623795 |
b7566512-f420-4e67-ac2a-e93589eae17a | app4mc-rover/rover-app-raspbian-cross-sdk | includes/opencv-3.2.0/modules/calib3d/src/solvepnp.cpp | #include "precomp.hpp"
#include "upnp.h"
#include "dls.h"
#include "epnp.h"
#include "p3p.h"
#include "opencv2/calib3d/calib3d_c.h"
#include <iostream>
namespace cv
{
bool solvePnP( InputArray _opoints, InputArray _ipoints,
InputArray _cameraMatrix, InputArray _distCoeffs,
OutputArray _... | ALGO | 0.997089 | 6.392121 |
a8574dc1-e68b-4d05-b424-00fcbdfe5b85 | ESchulze88/WhiteRiver | Vrui-4.2-006/VRDeviceDaemon/VRCalibrators/ForwardGridCalibrator.cpp | #include <VRDeviceDaemon/VRCalibrators/ForwardGridCalibrator.h>
#include <iostream>
#include <fstream>
#include <Misc/ConfigurationFile.h>
/* Forward declarations: */
template <class BaseClassParam>
class VRFactoryManager;
/**************************************
Methods of class ForwardGridCalibrator:
**************... | TOOL | 0.895658 | 7.467278 |
24f53730-8ba4-4358-955a-1872562ecf77 | johnoneil/mupen64plus-web | boost_1_59_0/libs/spirit/classic/example/fundamental/number_list.cpp | ///////////////////////////////////////////////////////////////////////////////
//
// This sample demontrates a parser for a comma separated list of numbers
// This is discussed in the "Quick Start" chapter in the Spirit User's Guide.
//
// [ JDG 5/10/2002 ]
//
///////////////////////////////////////////////////////... | TOOL | 0.906278 | 7.075739 |
423777f1-1cdf-481d-a0b6-a825df2cae82 | Fireow9039/Learning-the-Basics-for-DSA | 3 Arrays/1. Easy/12. Find the number that appears once, and the other numbers twice/12. a) Find the number that appears once, and the other numbers twice Brute Force.cpp | /******************************************************************************
Find the number that appear once, the other nuber twice
Brute Force Method
*******************************************************************************/
#include <bits/stdc++.h>
using namespace std;
int getSingleElement(vector<int> &a... | ALGO | 0.999878 | 5.153105 |
11ebb8b9-6534-4466-bbc2-065ef9145919 | My-master-degree/PED-MC621-contests | contest8/Perfect-Team.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int q,
m,
c,
x,
d,
r;
scanf("%d", &q);
while(q--){
scanf("%d%d%d", &c, &m, &x);
d = abs(c - m);
if (c >= m)
c -= d;
else
m -= d;
x += d;
if (x > m)
r = m;
else{
r = x;
... | ALGO | 0.999959 | 3.594761 |
962936fc-c007-442c-b3c6-5e23068afcf3 | hsahni55h/CPP_udacity | foundations/A star/8. expand neighbours/main.cpp | #include <fstream>
#include <algorithm>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
using std::abs;
using std::ifstream;
using std::istringstream;
using std::sort;
using std::string;
using std::vector;
using namespace std;
enum class State {kEmpty, kObstacle, kClosed, kPath};
//--------... | ALGO | 0.99847 | 4.685031 |
fb515e1c-d6e4-420b-b8f5-5a8e738a867d | StevenMaMei/Competitive-Programming | Contest/Topcoder/DIV1_easy/769_PrimePruning/main.cpp | #include <bits/stdc++.h>
#define ff first
#define ss second
#define fore(i,a,b) for(int i=a,colchin=b;i<colchin;++i)
#define pb push_back
#define ALL(s) s.begin(),s.end()
#define FIN ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define sz(s) int(s.size())
using namespace std;
class PrimePruning{
public: s... | ALGO | 0.999775 | 3.221668 |
5b1f8239-c47d-4754-a653-ec3172fa8793 | hatchjaw/teensy-audiosync | framework-arduinoteensy/libraries/Audio/async_input_spdif3.cpp | /*
by Alexander Walch
*/
#if defined(__IMXRT1062__)
#include "async_input_spdif3.h"
#include "output_spdif3.h"
#include "biquad.h"
#include <utility/imxrt_hw.h>
//Parameters
namespace {
#define SPDIF_RX_BUFFER_LENGTH AUDIO_BLOCK_SAMPLES
const int32_t bufferLength=8*AUDIO_BLOCK_SAMPLES;
const uint16_t noSamplerPe... | TOOL | 0.863999 | 5.683398 |
586f8d71-dc02-4c0d-9510-d7f206b6003e | harshturakhia/OOPS-in-CPP | function_fibo_3.cpp | #include<iostream>
using namespace std;
void fib(int n)
{
int t1=0, t2=1, nextTerm;
for(int i=1; i<=n; i++)
{
cout<<t1<<endl;
nextTerm = t1 + t2;
t1=t2;
t2=nextTerm;
}
return;
}
int main()
{
int n;
cin>>n;
fib(n);
} | ALGO | 0.999388 | 4.142595 |
058cea96-f4ac-4ab6-a849-f33b695d5e55 | ishandutta2007/codeforces | cqxym/normal/1616/A.cpp | #include<iostream>
#include<set>
using namespace std;
#define R register int
inline void Solve(){
int n,a;
cin>>n;
set<int>S;
for(R i=0;i!=n;i++){
cin>>a;
if(S.count(a)==0){
S.insert(a);
}else{
S.insert(-a);
}
}
cout<<S.size()<<endl;
}
int main(){
int t;
cin>>t;
for(R i=0;i!=t;i++){
Solve();
}... | ALGO | 0.998423 | 4.090714 |
105854c9-1bb5-4548-bd8c-a5997d3af4f7 | hjiang13/LLMs-in-IR | POJ-104/13/335.cpp | #include <iostream>
using namespace std;
/**
* ????buchongfushu.cpp
* ?????????
* ??????
* ???2010.10.30
*/
int main()
{
int n , i , j , number;
int a[100] = {
0}
; //??????????????
cin >> n;
i = 0;
for (j = 1 ; j <= n ; j++)
{
cin >> number;
if (a[number] == 0) //????????????
{
a[number]++... | ALGO | 0.999937 | 3.210214 |
de4b6084-98d6-4ff2-9682-74f0d4d00646 | dooli1971039/Algorithm | Stack/BOJ_1935.cpp | #include <iostream>
#include <stack>
#include <vector>
using namespace std;
double calculate(char ch,double first,double second) {
if (ch == '+') return first + second;
if (ch == '-') return first - second;
if (ch == '*') return first * second;
if (ch == '/') return first / second;
}
int main() {
//Է
int n;
st... | ALGO | 0.999598 | 3.801409 |
8a382a19-22d0-4f09-894a-6693a57e9b0f | alokyadav686/MyMedic | 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 |
a7bb67c6-e56f-4e9b-93e9-d15e44a9f3fe | nathanramli/my-algorithm-practice | codeforces/479A.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int a, b, c, maximum = -1;
cin >> a >> b >> c;
maximum = max(maximum, a + b * c);
maximum = max(maximum, a * (b + c));
maximum = max(maximum, a * b * c);
maximum = max(maximum, (a + b) * c);
maximum = max(maximum, a + b ... | ALGO | 0.999884 | 4.261939 |
94999b5f-459f-43d2-8e7f-55a7f5a98c96 | Doda94/SS-Kodovi | 2019_2020_kodovi/Atcoder 153/A.cpp | #include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
using namespace std;
long long a,b;
int main () {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin >> a >> b;
if (a%b == 0)
cout << a/b;
else
cout << (a/b)+1;
return 0;
}
| ALGO | 0.999223 | 3.240459 |
e43563b8-c62e-4ecc-a303-6a001093c3b6 | Era2016/myLeetcode | Target_Sum/solution.cpp | #include <iostream>
#include <vector>
using std::vector;
class Solution {
public:
int findTargetSumWays(vector<int>& nums, int target) {
int n = nums.size();
int sum = 0;
for (int num: nums) sum += num;
if (sum<target || (sum-target)%2) return 0;
int left = (sum-tar... | ALGO | 0.999992 | 5.841114 |
8c856e48-7193-4637-b30c-ac62c339d020 | ishandutta2007/codeforces | isonan/normal/1023/G.cpp | #include <cstdio>
#include <vector>
#include <random>
#include <algorithm>
int n,head[100001],nxt[200001],b[200001],v[200001],k,q;
std::vector<std::pair<int,int> >vec[100001];
int lson[400001],rson[400001],size[400001],cnt,pri[400001],lazy[400001],root[100001];
int stk[400001],top;
long long sum[400001];
struct info{
... | ALGO | 0.999877 | 3.912203 |
8c157857-c07b-4bce-8396-5c33a034d861 | BrMaro/C-- | Take a Ten Minutes Walk.cpp | #include<vector>
bool isValidWalk(std::vector<char> walk) {
int charSum = 0;
if (walk.size() != 10) return false;
for (char ch : walk){
if (ch == 'n') charSum += 1;
else if (ch == 's') charSum -= 1;
else if (ch == 'e') charSum += 100;
else charSum -= 100;
}
if (char... | ALGO | 0.999451 | 3.569801 |
02117d04-0752-428e-8f21-45ccd03fd807 | knst/Competitive-programming | codeforces/271/d.cpp | /*****************************************************************************
* codeforces: knst
* topcoder: knstqq
* projecteuler: knstqq
* **************************************************************************/
#include <algorithm>
#include <iostream>
#include <limits>
#include <map>
#include <set>
#i... | ALGO | 0.99991 | 4.292744 |
deb5fd72-2875-4b40-b7e4-edd51a6499d3 | Shinjinok/tandem2 | libraries/AP_Motors/AP_MotorsHeli_Dual.cpp | #include <stdlib.h>
#include <AP_HAL/AP_HAL.h>
#include "AP_MotorsHeli_Dual.h"
#include <GCS_MAVLink/GCS.h>
extern const AP_HAL::HAL& hal;
const AP_Param::GroupInfo AP_MotorsHeli_Dual::var_info[] = {
AP_NESTEDGROUPINFO(AP_MotorsHeli, 0),
// Indices 1-6 were used by servo position params and should not be use... | TOOL | 0.87425 | 5.741084 |
655d62fd-5d07-4b38-843b-2befb24e2300 | raiseiyonekura-univ/SketchBesedModeling | header/libigl-main/tutorial/903_FastFindSelfIntersections/main.cpp | #include <igl/read_triangle_mesh.h>
#include <igl/unique.h>
#include <igl/opengl/glfw/Viewer.h>
#include <igl/fast_find_self_intersections.h>
int main(int argc, char *argv[])
{
Eigen::MatrixXd V;
Eigen::MatrixXi F;
igl::read_triangle_mesh(argc<=1?TUTORIAL_SHARED_PATH "/cow.off":argv[1], V, F);
// Plot the me... | ALGO | 0.926407 | 4.979695 |
2341827b-434b-4099-ac60-8958c4b560fc | RishabhSinghal04/C_Plus_Plus | STL Algorithms/std_none_of.cpp |
#include <iostream>
#include <conio.h>
#include <algorithm>
#include <vector>
bool is_odd(int num)
{
return num % 2 != 0;
}
int main()
{
using namespace std;
vector<int> integers;
integers.reserve(10);
integers.emplace_back(12);
integers.emplace_back(644);
integers.emplace_back(-278);
... | ALGO | 0.984407 | 5.041595 |
b4346411-800f-4b2b-89f0-5a0855447908 | Aaditya8C/CP_DSA | lvl1000/helmet.cpp | #include <bits/stdc++.h> // This will work only for g++ compiler.
#include <iostream>
#include <vector>
#define for0(i, n) for (int i = 0; i < (int)(n); ++i) // 0 based indexing
#define for1(i, n) for (int i = 1; i < (int)(n); ++i) // 0 based indexing starts with 1
#define for11(i, n) for (int i =... | ALGO | 0.999936 | 3.951046 |
1ffeecde-2aa6-4dec-8f65-1f8fdd0ba62f | bsdelf/mous | deps/uchardect/uchardect/src/CharDistribution.cpp | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
#include "CharDistribution.h"
#include "JISFreq.tab"
#include "Big5Freq.tab"
#include "EUCKRFreq.tab"
#include "EUCTWFreq.tab"
#include "GB2312Freq.tab"
#define SURE_YES 0.99f
#define SURE_NO 0.01f
//return confidence base on received ... | ALGO | 0.987389 | 5.768363 |
389fb685-9e74-439f-908d-1b73fd70ca67 | JD2xor/competitive-programming | ABC080/B.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
cin.tie(0);
ios_base::sync_with_stdio(false);
string str;
cin >> str;
int n = atoi(str.c_str());
int len = str.size();
vector<int> nums(len);
transform(str.begin(), str.end(), nums.begin(),
[](char ch) { return ch - '0'; });
i... | ALGO | 0.999979 | 5.118561 |
a459dedf-2d04-42b5-807f-3a3986d3396a | lomrormaheshIITB/coursera | data structure/week3_hash_tables/4_substring_equality/old.cpp | #include <iostream>
#include <vector>
#include <math.h>
using std::vector;
using namespace std;
class Solver {
string s;
vector<long>hash1;
vector<long>hash2;
vector<long>x_pow_p1;
vector<long>x_pow_p2;
long p1;
long p2;
long x1;
long x2;
int n;
int ascii(char c){
return (int)c;
}
long modula(lon... | ALGO | 0.999892 | 4.339016 |
581d905f-12ba-4010-bd2c-f1c399dac212 | sinian666/code_41_29 | cpp_副本4/chapter_sorting/merge_sort.cpp | /**
* File: merge_sort.cpp
* Created Time: 2022-11-25
* Author: Krahets (<EMAIL>)
*/
#include "../utils/common.hpp"
/* 合并左子数组和右子数组 */
// 左子数组区间 [left, mid]
// 右子数组区间 [mid + 1, right]
void merge(vector<int> &nums, int left, int mid, int right) {
// 初始化辅助数组
vector<int> tmp(nums.begin() + left, nums.begin() ... | ALGO | 0.999973 | 5.85512 |
403c373a-f8e0-4e47-a45e-08be981c7ee1 | ishandutta2007/codeforces | emthrm/normal/1504/A.cpp | #define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
using ll = long long;
constexpr int INF = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr double EPS = 1e-8;
constex... | ALGO | 0.999943 | 5.492222 |
5f983ba8-beb0-4993-9000-212dfc384272 | shiv8115/LeetCode | two-sum/two-sum.cpp | class Solution {
public:
vector<int> twoSum(vector<int>& nums, int target) {
vector<int>v;
unordered_map<int,int>mp;
for(int i=0;i<nums.size();i++){
if(mp.find(target-nums[i])!=mp.end()){
v.push_back(mp[target-nums[i]]);
v.push_back(i);
... | ALGO | 0.999793 | 6.22909 |
28d13349-72b1-43b0-9f6b-56f5a2ca81f6 | m1cov/PSP2023 | 1 Kolokvium/z6.cpp | #include <iostream>
using namespace std;
struct queue
{
int list[100];
int f, r;
inline void init() { f = r = -1; }
inline bool isFull() { return r >= 99; }
inline bool isEmpty() { return r - f < 0; }
int peek()
{
}
int pop()
{
}
void push(int x)
{
}
};
bo... | ALGO | 0.999541 | 3.911695 |
07479600-0901-4729-bea4-c645150e4a16 | raincross7/code-similarity | codes/train_code/problem094/problem094_38.cpp | // In the name of God
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
long long total = 0;
int n;
cin >> n;
for(int i = 0; i < n; i++) {
total += 1ll * (i + 1) * (n - i);
}
for(int i = 0; i < n - 1; i++) {
int u, v;
cin >> u >> v;
if(u > v)... | ALGO | 0.999461 | 3.7239 |
856b0a4f-3386-4c1c-baaf-f17bfa32a444 | Bewolf2/LearningGameAI | src/bullet_collision/src/CollisionDispatch/btCompoundCollisionAlgorithm.cpp | #include "BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.h"
#include "BulletCollision/CollisionDispatch/btCollisionObject.h"
#include "BulletCollision/CollisionShapes/btCompoundShape.h"
#include "BulletCollision/BroadphaseCollision/btDbvt.h"
#include "LinearMath/btIDebugDraw.h"
#include "LinearMath/btAa... | ALGO | 0.999643 | 6.685928 |
f6ea1864-7c7c-40a0-86ea-fa905a11ad4e | ishandutta2007/codeforces | sankear/normal/549/D.cpp | #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cassert>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <bitset>
#include <queue>
#include <deque>
#include <stack>
#include <complex>
using namespace std;
#define pb ... | ALGO | 0.999976 | 3.570296 |
47f9ad87-6582-401b-b6e6-a02f74e6297f | kmjp/procon | leetcode/301-350/347/2712.cpp | #include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;
#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define FORR2(x,y,arr) for(auto& [x,y]:arr)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a)... | ALGO | 0.999907 | 4.801474 |
10c6d0c1-3cd4-47ff-9029-7249668d7f3d | Mihir8053/Operating-system-practical | IndexedFileAllocation.cpp | #include <iostream>
using namespace std;
int files[50], indexBlock[50], indBlock, n;
void recurse1();
void recurse2();
void recurse1(){
cout << "Enter the index block: ";
cin >> indBlock;
if (files[indBlock] != 1){
cout << "Enter the number of blocks and the number of files needed for the index " ... | TOOL | 0.955656 | 3.180689 |
96fbc8be-c040-4c83-9ea6-c71e14c51d12 | adrialva/C-_Projects | MiProyecto6/main.cpp | #include<iostream>
using namespace std;
int main (int argc, char *argv[]) {
int contador;
int filas;
int posiciones;
int asteriscos;
// Solicitud del numero de filas a visualizar
printf("No. de Filas : ");
scanf(" %d",&filas);
// Visualizar primera piramide
posiciones=filas*2;
for(contador=1;contador<=posici... | ALGO | 0.951441 | 3.485974 |
6596cb05-aa75-4001-80f7-5d7f8c6f3964 | pulkitshringi/DSA_Cplusplus | Patterns 2/p8Fancy12Pattern.cpp | #include <iostream>
using namespace std;
int main(){
int n;
cin >> n;
for(int i=0;i<n;i++){
for(int j=0;j<i+1;j++){
if(j==i)
cout << i+1;
else
cout << i+1 << "x";
}
cout << endl;
}
return 0;
} | ALGO | 0.999715 | 3.450115 |
eca46ef1-5958-4372-abd9-aa42762e971b | Priyo002/DSA | Vivek_Gupta_RecomendedSheet/Sheet3/Sorting.cpp | #include<bits/stdc++.h>
using namespace std;
int main() {
#ifndef ONLINE_JUDGE
freopen("inputf.in", "r", stdin);
freopen("outputf.in", "w", stdout);
#endif
int n;
cin >> n;
int arr[n];
for (int i = 0; i < n; i++)
cin >> arr[i];
for (int i = 0; i < n - 1; i++) {
bool flag = true;
for (int j = 0; j < n -... | ALGO | 0.999982 | 3.946581 |
5829620f-62f7-4a02-8a7e-3c835e48fe10 | masudrana2015/Atcoder_Solutoins | Atcoder/C++14 (GCC 5.4.1)/abc135_b/12175319.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
ll n,g,x,t,h,k=0,f,l=0,c=0;
cin>>n;
ll a[n+10],b[n+10];
for(int i = 0; i < n; i++)
{
cin>>a[i];
b[i] = a[i];
}
sort(a,a+n);
for(int i = 0; i < n; i++)
{
if(a[i]!=b[i])
... | ALGO | 0.99999 | 3.489201 |
a3a2b971-32a9-46c5-9fbb-4bc395ebce9d | Caknoooo/one-day-one-problem | 2024_01_January/25_Thursday/string_to_int.cpp | class Solution
{
public:
int myAtoi(string s)
{
int len = s.length();
long res = 0;
int i = 0;
int op = 1;
while (i < len && s[i] == ' ')
{
i++;
}
if (s[i] == '-')
{
op = -1;
i++;
}
else if (s[i] == '+')
{
i++;
}
while (i < len)
... | ALGO | 0.999067 | 5.07618 |
3aa162c7-faec-4968-90d0-152ad0b6ee9c | chocolatedesue/xidian_weather | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.9988 | 6.76073 |
7949c6a9-101f-4bfa-9366-8a52cd49059f | sangmin970528/BOJ-algorithm | category/dp/1965_상자넣기.cpp | #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <deque>
#include <climits>
#include <map>
#include <set>
using namespace std;
int box[1001];
int dp[1001];
int main() {
cin.tie(NULL);
cout.tie(NULL);
ios_base::sync_wi... | ALGO | 0.999967 | 4.275729 |
f2c36b3e-a662-4078-90f4-c51febd600df | yitati/LCProject | Leetcode/WordLadder.cpp | /******************************************************************************
* Question: #127 Word Ladder
* company tag: Amazon, LinkedIn
* Given two words (beginWord and endWord), and a dictionary's word list, find the length of shortest transformation
* sequence from beginWord to endWord, such that:
* 1.Only one... | ALGO | 0.999907 | 6.079294 |
7f6afeae-7322-4235-9f5f-9e8a821b25b0 | AishwaryaTatiwar/Competitive_DSA | LL.cpp | #include<bits/stdc++.h>
using namespace std;
class Node{
public:
int data;
Node* next;
public:
Node(int data1,Node* next1){
data=data1;
next=next1;
}
public:
Node(int data1){
data=data1;
next=nullptr;
}
};
int main(){
vector<int> arr={2,5,8,7};
... | ALGO | 0.982423 | 3.103138 |
bee1e4a3-ac92-46d6-8bdb-8f79f5cf3cc2 | shantanu726/Binary-Search-Tree | BSTIntro.cpp | #include <bits/stdc++.h>
using namespace std;
class Node
{
public:
int data;
Node *left;
Node *right;
Node(int d)
{
this->data = d;
this->left = NULL;
this->right = NULL;
}
};
Node *insertBST(Node *root, int d)
{
if (root == NULL)
{
root = new Node(d);
... | ALGO | 0.99998 | 4.646783 |
f3c502ed-188a-4f01-ade5-de24a78e5ec8 | raincross7/code-similarity | codes/train_code/problem271/problem271_411.cpp | #include<iostream>
#include<cstring>
#include<algorithm>
#include<string>
#include<vector>
#include<cstdio>
#include<cmath>
#define pb(in,tmp) in.push_back(tmp)
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) loop(i,0,b)
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
using namespace std;
int ma... | ALGO | 0.999903 | 3.337289 |
4c3b6eab-62cb-469e-bf9c-659197b27a9d | amana2525/proiecte-informatica | tema 9-info/tema info 9- pr 44/main.cpp | #include <iostream>
using namespace std;
int main()
{
int n,i,d,k=0;
cin>>n;
for(i=2;i*i<=n;++i)
{ k=0;
for(d=2;d*d<=i;++d)
{if(i%d==0)
++k;
}
if(k==0)
cout<<i*i<<" ";
}
return 0;
}
| ALGO | 0.999662 | 3.72607 |
0006d231-c845-4489-9ecb-480b0433f3d0 | Hyperionlucky/SuperGis | geomath.cpp | #include "geomath.h"
#include <cmath>
#include <QDebug>
/* double变量的比较 */
int dcmp(double x, double y, double precision /*= 1e-6*/)
{
if (fabs(x - y) < precision)
return 0;
else if (x < y)
return -1;
else
return 1;
}
/* 叉积 */
double cross(const GeoPoint& vec1Start, const GeoPoint& ... | ALGO | 0.997395 | 4.985977 |
26bd6ff6-5f1d-4bc8-9d4d-10bff161514d | algoknu/materials | Друга ліга/19.10 STL + структури данних/contest/G_alternative.cpp | #include<iostream>
#include<algorithm>
#include<vector>
#include<tuple>
using namespace std;
int main(){
int n;
cin >> n;
vector<tuple<int, int, int>> a(n);
for(auto & i : a)
cin >> get<0>(i) >> get<1>(i) >> get<2>(i);
sort(a.begin(), a.end());
for(auto & i : a)
cout << get<0>... | ALGO | 0.999314 | 3.496567 |
aa267b8d-f0ec-45c6-a207-a1f893d70fb6 | SPsuyash/LeetCode | 2461-amount-of-time-for-binary-tree-to-be-infected/2461-amount-of-time-for-binary-tree-to-be-infected.cpp | class Solution {
public:
void find(TreeNode* root, int target, TreeNode*& BurnNode) {
if (!root) return;
if (root->val == target) {
BurnNode = root;
return;
}
find(root->left, target, BurnNode);
find(root->right, target, BurnNode);
}
int Heigh... | ALGO | 0.99998 | 6.47738 |
aef59420-8dda-4172-bf8c-e04dac7f1991 | raincross7/code-similarity | codes/train_code/problem389/problem389_101.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> iint;
typedef pair<ll,ll> llll;
#define ALL(x) (x).begin(),(x).end()
const ll zero = 0;
const ll INF = 3000000000000000000; //10^18
const int inINF = 1000000000; //10^9
const ll MOD = 1000000007; //10^9+7
const ll MOD2 = 998244353... | ALGO | 0.999161 | 3.355484 |
01c9c63c-5156-408b-a474-f5226384bc3b | iamzart/lanqiaocup | 堆.cpp | #define _CRT_SECURE_NO_WARNINGS
#include<iostream>
using namespace std;
const int N = 1e5 + 10;
int n;
//˳洢
int heap[N];
void up(int child) {//Դ±
int parent = child / 2;
while (parent >= 1 && heap[parent] < heap[child]) {
//Ҳ˳ʱ
swap(heap[parent], heap[child]);
child = parent;
parent = child / 2;
}
}
void do... | ALGO | 0.999923 | 3.628007 |
8ce528b9-1a02-492b-9bc0-d47a4250ecbd | SamSanket9595/Basic-CPP-Programs | Pattern.cpp | ////////////////////////////////////////////////////////////////////////////////
// Q. Write a program which accept number from user and
// print that number of $ and * on the screen.
//
// Input: 5 | 3 | -3
// Output: $ * $ * $ * $ * $ * | $ * $ * $ * | $ * $ * $ *
//
//
// Technology: C++
//... | ALGO | 0.989716 | 3.833584 |
5e5a6c05-aa96-4c1f-81a6-1718672fccd9 | XT-Error406/leetcode | 2darray.cpp | #include<iostream>
#include<vector>
using namespace std;
bool search2d(vector<vector<int>>arr,int n,int m,int row,int target){
int start=0;
int end=m-1;
int mid=start+(end-start)/2;
while(start<=end){
if(arr[row][mid]==target){
return true;
}
... | ALGO | 0.999929 | 3.551672 |
693f7e88-095d-4749-9d81-16145c7bc9e1 | ishandutta2007/codeforces | peti1234/normal/1468/C.cpp | #include <bits/stdc++.h>
using namespace std;
const int c=500002;
priority_queue<pair<int, int> > q;
int n, kezd, ert;
bool v[c];
int main()
{
ios_base::sync_with_stdio(false);
cin >> n;
for (int i=1; i<=n; i++) {
int a, b;
cin >> a;
if (a==1) {
ert++;
cin >>... | ALGO | 0.999973 | 3.598971 |
8cbdb7f4-13da-4c7f-91e2-a500b7fc0b57 | priyanjali30/DSA | Intersection_of_Two_Linked_Lists.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
ListNode *getIntersectionNode(ListNode *headA, ListNode *headB) {
ListNode* curr1 = headA;
ListNode* cu... | ALGO | 0.999878 | 5.208697 |
627e11c6-97ac-48a3-bafb-18884b274979 | Jeevan-kumar-Raj/InterviewBit-Topicwise-Solutions | Stacks and Queues/First negative integer in window size B.cpp | vector<int> printFirstNegativeInteger(vector<int> arr, int n, int k)
{
// A Double Ended Queue, Di that will store indexes of
// useful array elements for the current window of size k.
// The useful elements are all negative integers.
deque<int> Di;
vector<int> ans;
/* Process f... | ALGO | 0.999991 | 5.369982 |
6a2fba8a-eff8-40e7-8fc7-c6bed88ce906 | RuprechtKraus/OOD | Lab3/Streams/Cryptography/Cryptographer.cpp | #include "Cryptographer.h"
#include <algorithm>
#include <random>
#include <numeric>
Cryptographer::Cryptographer(int key)
: m_key(key)
{
InitializeLookupTable();
}
uint8_t Cryptographer::Encrypt(uint8_t byte) const
{
return m_lookupTable[byte];
}
uint8_t Cryptographer::Decrypt(uint8_t byte) const
{
for (int i =... | ALGO | 0.984716 | 5.854362 |
ef3d2da3-b6fe-4056-992f-cb08f1c9d231 | abhiXsliet/DSA-Busted-A-Complete-CPP-DSA-Series | Lecture 010 Arrays Problems & HW/HW Questions/findDuplicate.cpp | //https://www.codingninjas.com/codestudio/problems/find-duplicate_625160
#include<bits/stdc++.h>
using namespace std;
int duplicateNumber(int *arr, int size)
{
// // Time Complexity => O(N*log(N))
// // Space Complexity => O(1)
// sort(arr, arr+size);
// for(int i=0; i<size; i++)
// if(arr[i] ... | ALGO | 0.999809 | 5.056751 |
81e997aa-4b1e-4bfb-986d-2950fd7be5b5 | Q-FORGE/ar_track_alvar | ar_track_alvar/src/TrackerPsa.cpp | #include "TrackerPsa.h"
using namespace std;
namespace alvar
{
using namespace std;
TrackerPsa::TrackerPsa(int _max_shift)
{
max_shift = _max_shift;
x_res = 0;
y_res = 0;
hor = 0;
horprev = 0;
ver = 0;
verprev = 0;
framecount = 0;
}
TrackerPsa::~TrackerPsa()
{
if (hor)
delete[] hor;
if (horp... | ALGO | 0.992992 | 5.10532 |
7aae74bf-7e24-4e9d-96cc-5db397a9c19a | MinTimmy/Data_Structure | Sorting/Radix_sort/Radix_exchange_Sort.cpp | #include<iostream>
#include<string>
#include <bitset>
#include <cmath>
using namespace std;
#define C_BITS 7 // 000 000 the number of bits for data
#define M 3 // every 3 bits to compare
#define MAX 7+1 // the max of 3 bits
void output(char a[][C_BITS], int amount)
{
for(int i = 0; i < amount; i++){
cout ... | ALGO | 0.999923 | 3.692464 |
68a11508-0e88-4fe5-a1eb-5e5a69849910 | Shell-Wataru/AtCoder | Other/JudgeSystemUpdateTestContest202004/B.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <queue>
#include <map>
#include <iomanip>
#include <cmath>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
using ll = long long;
namespace mp = boost::multiprecision;
ll BASE_NUM = 1000000007;
int main()
{
// 整数... | ALGO | 0.999723 | 3.947623 |
ff8bd6bb-5559-438b-8d81-84e8cdfd1c7c | MathewGarcia/ProjectEndure | Source/DungeonCrawler/Private/AIState_Range_Defense.cpp | #include "AIState_Range_Defense.h"
#include "AIEnemy.h"
#include "PlayerCharacter.h"
#include "Enemy.h"
TUniquePtr<AIDecisionTreeNode> AIState_Range_Defense::BuildInRange(AEnemy* Enemy)
{
//feature indices: 0 is player distance, 1 is player health, 2 is enemy health, 3 is enemy stamina, 4 is player state, 5 is mon... | ALGO | 0.854717 | 5.760114 |
9d2ad9c8-6f76-4d8d-91a5-aa84cfaea847 | bergwolf/tesseract-ocr-copy | ccstruct/linlsq.cpp | #include "mfcpch.h"
#include <stdio.h>
#include <math.h>
#include "errcode.h"
#include "linlsq.h"
#ifndef __UNIX__
#define M_PI 3.14159265359
#endif
const ERRCODE EMPTY_LLSQ = "Can't delete from an empty LLSQ";
#define EXTERN
EXTERN double_VAR (pdlsq_posdir_ratio, 4e-6, "M... | ALGO | 0.996311 | 5.78216 |
aa9429b1-74c5-4ca5-a5ec-efdc932174a8 | hjimce/lightcnn | lightcnn/lightcnn/Eigen/unsupported/bench/bench_svd.cpp | // Bench to compare the efficiency of SVD algorithms
#include <iostream>
#include <bench/BenchTimer.h>
#include <unsupported/Eigen/SVD>
using namespace Eigen;
using namespace std;
// number of computations of each algorithm before the print of the time
#ifndef REPEAT
#define REPEAT 10
#endif
// number of tests of t... | TEST | 0.998266 | 6.266157 |
f9dee67e-4b92-4242-a63d-4fb5cec8e5c9 | Vanhoai/MasterAlgorithms | practice/greedy_algorithms/divide_max_minus.cpp | #include <iostream>
using namespace std;
#define ms(s, n) memset(s, n, sizeof(s))
#define all(a) a.begin(), a.end()
#define sz(a) int((a).size())
#define FOR(i, a, b) for (int i = (a); i <= (b); ++i)
#define FORD(i, a, b) for (int i = (a); i >= b; --i)
#define PB push_back
#define MP make_pair
#d... | ALGO | 0.999969 | 4.961765 |
35a54565-3aa4-42ff-a483-f18512da6b92 | luckyhappycat/leetcode | 35-搜索插入位置/leetcode35_solution2.cpp | #include "../leetcode.h"
// 二分查找
class Solution {
public:
int searchInsert(vector<int>& nums, int target) {
int n = nums.size();
if (n == 0) return 0;
if (target < nums[0]) return 0;
if (nums[n - 1] < target) return n;
int left = 0, right = n - 1;
while (left <= righ... | ALGO | 0.999982 | 6.303741 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.