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 |
|---|---|---|---|---|---|---|
78715627-2dd0-409c-a21a-5ce16431c391 | Lost-MSth/Lost | HPC/HPCGame 2025/K-画板/main/vanity.cpp | #include <openssl/evp.h>
#include <openssl/sha.h>
#include <pthread.h>
#include <secp256k1.h>
#include <semaphore.h>
#include <chrono>
#include <cstring>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <sstream>
#include <vector>
std::string toHex(const uint8_t* data, size_t size) {
std::ostrin... | ALGO | 0.9918 | 4.952736 |
5f91ca27-5947-4daf-aed6-b3325de5d89f | Mehedihasan444/compititive-programming | DSA/Module-9-Doubly_linked_List/insert_at_tail.cpp | #include <bits/stdc++.h>
using namespace std;
class Node
{
public:
Node *prev;
Node *next;
int val;
Node(int val)
{
this->val = val;
this->prev = NULL;
this->next = NULL;
}
};
void insert_at_tail(Node *&head, Node *&tail, int val)
{
Node *newNode = new Node(val);
... | ALGO | 0.998803 | 5.072935 |
b56fceac-0ca8-4f96-90f3-b4c10f78a9ae | tic40/atcoder | abc/abc334/d/main.cpp | #include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<n;i++)
#define endl '\n'
using ll = long long;
int main() {
ll n,q; cin >> n >> q;
vector<ll> r(n);
REP(i,n) cin >> r[i];
sort(r.begin(),r.end());
vector<ll> s(n+1);
REP(i,n) s[i+1] = s[i] + r[i];
REP(_,q) {
ll x; cin >> x;... | ALGO | 0.999968 | 4.199433 |
591ef0ac-c1cc-45d7-87ed-b601736ce3af | cenkkaanbolukbas/C | Quiz and Homework/1.cpp | #include<stdio.h>
#include<stdlib.h>
int function(int gradeofsection[][10],int size,int averageofgrade[],int sumofaverages[],int *haverage,int *win){
int f,b; // variables for loops
for(f=0;f<4;f++){ // I know that when we don't input value at each of array indexes, all the indexes are 0 but my computer miscalculat... | ALGO | 0.999616 | 3.69863 |
d0c385bb-22fa-467b-b06d-3daa5e4786bd | sswamyn/cpp | docs/Exercises/c20_exercises/20-4/20-4.cpp | import <vector>;
import <deque>;
import <iostream>;
import <algorithm>;
import <iterator>;
import <numeric>;
using namespace std;
int main()
{
vector<int> values(100);
iota(begin(values), end(values), 1);
deque<int> evens, odds;
partition_copy(begin(values), end(values),
back_inserter(evens),
front_inserter(... | ALGO | 0.999309 | 5.002896 |
09b0ecc4-61b8-4579-a1d3-1c479d9f9bbf | Kongminsang/Parking-distance-warning-system | collision_checker.cpp | #include <limits>
#include "collision_checker.h"
CollisionChecker::CollisionChecker(double threshold) : threshold(threshold) {
// Constructor implementation
}
double CollisionChecker::calculateTTC(double distance, double speed) {
if (speed <= 0) {
return std::numeric_limits<double>::infinity(); // No ... | TOOL | 0.970777 | 6.387832 |
6fb94738-7f4a-4d91-b978-654bb4cb4c23 | saurabhjawli/practice | Program236.cpp | #include<iostream>
using namespace std;
#pragma pack(1)
struct node
{
int data;
struct node *next;
};
typedef struct node NODE;
typedef struct node * PNODE;
typedef struct node ** PPNODE;
class SinglyCL
{
public:
PNODE First;
PNODE Last;
SinglyCL();
void InsertFirst(int ... | ALGO | 0.999831 | 4.252009 |
3dd14f27-a987-4a7a-9c2f-b830bb490cc6 | NIAN-QIAO/Daily | 2405/NO240506hard.cpp | //
// Created by PC on 2024/5/6.
//741. 摘樱桃
//https://leetcode.cn/problems/cherry-pickup/description/
#include "iostream"
#include "vector"
using namespace std;
class Solution {
public:
int cherryPickup(vector<vector<int>> &grid) {
int n = grid.size();
vector<vector<vector<int>>> f(n * 2 - 1, vect... | ALGO | 0.999983 | 5.741459 |
2fc61859-ab40-4ac0-b587-7823796a6d88 | GonzaloHR/LeetCode | 4-median-of-two-sorted-arrays/median-of-two-sorted-arrays.cpp | class Solution {
public:
double findMedianSortedArrays(vector<int>& nums1, vector<int>& nums2) {
int n = nums1.size();
int m = nums2.size();
int i = 0, j = 0, m1 = 0, m2 = 0;
// Find median.
for (int count = 0; count <= (n + m) / 2; count++) {
m2 = m1;
... | ALGO | 0.999985 | 6.840026 |
c79116ec-c4fc-47ba-b957-55f26b1442d3 | VIA-Research/LazyDP | tbb/examples/parallel_do/parallel_preorder/parallel_preorder.cpp | #include "tbb/parallel_do.h"
#include <vector>
#include <algorithm>
#include "Graph.h"
class Body {
public:
Body() {};
//------------------------------------------------------------------------
// Following signatures are required by parallel_do
//------------------------------------------------------... | ALGO | 0.999598 | 5.855957 |
6b92183f-e289-4390-b131-0fc6fe745246 | Midas847/Competitive-Coding | LeetCode Submissions/intersection-of-two-arrays-ii/Accepted/9-17-2021, 10_25_15 PM/Solution.cpp | // https://leetcode.com/problems/intersection-of-two-arrays-ii
class Solution {
public:
vector<int> intersect(vector<int>& nums1, vector<int>& nums2) {
sort(nums1.begin(),nums1.end());
sort(nums2.begin(),nums2.end());
vector<int>::iterator it, st;
int n1 = nums1.size();
int ... | ALGO | 0.999991 | 5.781559 |
b35e657d-ffcb-4e1a-93fd-c4b7fe6c9a4c | ishandutta2007/codeforces | sirrembocodina/normal/776/C.cpp | #include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <string>
#include <map>
using namespace std;
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
typedef long long ll;
map<ll, int> m;
int main() {
... | ALGO | 0.999893 | 3.740747 |
10a37148-500e-473d-8358-018529e03dea | Junlin-Yin/myLeetCode | mine/236-LCA_of_a_binary_tree.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
TreeNode* LCA;
bool find(TreeNode* root, TreeNode* p, TreeNode* q, bool& hasp, bool& hasq)... | ALGO | 0.99999 | 6.380301 |
2f9cdcd6-f8af-4ea9-8e8f-63c071f41d30 | Asayuki397/baekjoon | 1927.cpp | #include <stdio.h>
#include <vector>
#include <queue>
using namespace std;
int main() {
priority_queue<int, vector<int>> q;
int n;
scanf("%d", &n);
for (int i = 0; i < n; i++) {
int k;
scanf("%d", &k);
if (k == 0) {
if (q.empty()) {
printf("0\n")... | ALGO | 0.999959 | 4.480242 |
599adf58-0ca5-48ba-8cb1-96afab4fb450 | towhid1zaman/Different_OnlineJudge_Solutions | Atcoder_Solutions/Atcoder Boot camp/abc124_c.cpp |
// </> : towhid1zaman
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair< int, int > pii;
typedef pair< pii, int > ppi;
#define fill(a,b) memset(a,b,sizeof(a))
#define all(v) (v).begin(),(v).end()
#define sp(k) cout<<setprecision(k)<<fixed;... | ALGO | 0.999989 | 3.882964 |
b5b9f312-2c56-4cf4-ae26-a5e0e154ace1 | Risheek-Lahiri/Voice_Recognition_yes_or_no | Project Submit1/Submit1.cpp | // Yes_No_classifier.cpp : Defines the entry point for the console application.
//
#include "StdAfx.h"
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main()
{
FILE *fp = fopen("ys2.txt", "r");
if (fp==NULL)
printf("This file is not available");
else
{
char mystring[150];
int... | ALGO | 0.985918 | 4.56804 |
fd37fd7a-b9fb-4e63-9ff6-9ec23a24d89c | YanichChe/nsu-labs-cxx | Task1/libs/big_int/src/big_int.cpp | #include "../include/big_int.h"
std::vector<std::string> toBin(BigInt &number)
{
std::vector<std::string> output;
std::string result = "";
while (number > BigInt(0))
{
BigInt a = number % BigInt(2);
result += (number % BigInt(2)).operator std::string();
number /= BigInt(2);
... | ALGO | 0.999348 | 4.703206 |
601f49e1-99d9-464a-a9ac-03879094b930 | pfeiffer-kai/Eigen3_2_10_symmetricSchur | doc/examples/class_CwiseUnaryOp.cpp | #include <Eigen/Core>
#include <iostream>
using namespace Eigen;
using namespace std;
// define a custom template unary functor
template<typename Scalar>
struct CwiseClampOp {
CwiseClampOp(const Scalar& inf, const Scalar& sup) : m_inf(inf), m_sup(sup) {}
const Scalar operator()(const Scalar& x) const { return x<m_... | ALGO | 0.963091 | 6.433227 |
55be84e9-e200-4ffe-9d88-dc9900fbe421 | chx2502/LeetCode | LeetCode_590_斐波那契数/LeetCode_590_斐波那契数/main.cpp | #include <iostream>
#include <vector>
using namespace std;
class Solution {
public:
/*
递归实现
**/
// int fib(int N) {
// if (N == 0) return 0;
// if (N == 1) return 1;
// return fib(N-1) + fib(N-2);
// }
/*
数组实现
**/
int fib(int N) {
vector<int> array(N+... | ALGO | 0.999991 | 5.607087 |
d2d3abdf-5fd1-4f45-881c-eb31384af6d6 | filipmalecki94/Algorithms_and_data_structures | lista1/zadanie3.cpp | #include <iostream>
#include <cmath>
using namespace std;
double oblicz(double a[], int n, double x)
{
int multipyCounter = 0;
double result = 0.0;
int tempN = n;
double tempElement = 1;
for(int i=0; i<n; i++)
{
for(int j=1; j<tempN+1; j++)
{
tempElement *= x;
... | ALGO | 0.999612 | 3.619641 |
42ad26c4-58a1-455b-af6c-ee77f3dfbe07 | RJ-Mitra/Programming101_CPP | sortedListToBST.cpp | //Sorted list to binary search tree
#include<bits/stdc++.h>
using namespace std;
class TreeNode{
public:
int value;
TreeNode *left;
TreeNode *right;
TreeNode(int value){
this->value = value;
this->left = nullptr;
this->right = nullptr;
}... | ALGO | 0.999997 | 5.567937 |
39cceca0-72f0-4439-bf8f-3418b46c5d4f | silverthreadk/leetcode | Cpp/1337_The_K_Weakest_Rows_in_a_Matrix.cpp | class Solution {
public:
vector<int> kWeakestRows(vector<vector<int>>& mat, int k) {
vector<int> result(k);
priority_queue<pair<int,int>> pq;
for(int i=0; i<mat.size(); ++i){
int count = 0;
for(int j=0; j<mat[0].size(); ++j){
if(mat[i][j] == 0... | ALGO | 0.999905 | 6.123164 |
16f372eb-9b30-4c27-a741-e454984a7231 | Maeg5854/algorithm | BOJ/수학/2775.cpp | /*
* 2775 : γȸ ɰž
* 22.03.07
*/
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int GetCount(int k, int n)
{
if (n == 1)
return 1;
if (k == 0)
return n;
return (GetCount(k - 1, n) + GetCount(k, n - 1));
}
int main()
{
int t;
int k, n;
cin >> t;
while (t-- > 0)
{
cin >> ... | ALGO | 0.999843 | 4.660335 |
f080879a-d779-486f-b539-a66be2bd4da0 | omarfaruk-k/CnCpp | CF/A_Three_Piles_of_Candies.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
int t;
cin>>t;
while (t--)
{
ll a,b,c,j,k;
cin>>a>>b>>c;
ll kk = a+b+c;
cout<<kk/2<<endl;
// ll arr[3]={a,b,c};
// sort(arr,arr+3);
// j=arr[2];
// k=arr... | ALGO | 0.999779 | 4.166168 |
6c4e4c26-32af-4f92-8615-b72dea9cad47 | blee1616/CP | Graph/Dec2016P1/main.cpp | #include <fstream>
#include <iostream>
#include <queue>
#include <vector>
using std::cout;
using std::endl;
using std::pair;
using std::queue;
using std::vector;
/** @return the squared distance between 2 points */
int dist_sq(const pair<int, int> &p1, const pair<int, int> &p2) {
int dx = p1.first - p2.first;
int d... | ALGO | 0.999935 | 4.950731 |
2137cf44-76ab-47b1-a82a-9eb4f98560fd | Manoj-T-V/DSA | power-of-three/power-of-three.cpp | class Solution {
public:
bool isPowerOfThree(int n) {
if(n<1)
{
return false;
}
while(n%3==0)
{
n=n/3;
}
return n==1;
}
}; | ALGO | 0.99888 | 5.904956 |
daf35ecb-23d8-4070-9677-0e881d19f375 | xyzuan/livescore_app | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.9988 | 6.76073 |
8171c34b-6ccf-49f3-9e07-8dedc9177994 | sairojp/CPP_LEC | Assignment/1_Assignment_inheritance/overvect.cpp | #include <iostream>
using namespace std;
const int MAX=5;
class vector
{
protected:
int arr[MAX];
int size ;
public :
vector()
{
size = 0;
}
int &getset(int index)
{
return arr[index];
}
void additem(int num )
{
arr[size++]=num;
}
int remov... | ALGO | 0.939783 | 3.848756 |
dc1112e9-1276-43a9-949e-df118786eb9d | garg-saumya20/Data-Structure | Graph/TopologicalSortUsingDFS.cpp | #include <iostream>
#include <list>
#include <unordered_map>
#include <queue>
#include <stack>
#include <vector>
using namespace std;
void prepareAdjList(unordered_map<int, list<int>> &adj, vector<pair<int, int>> edges)
{
for (int i = 0; i < edges.size(); i++)
{
int u = edges[i].first;
int v = ... | ALGO | 0.999993 | 5.215672 |
02266329-b570-4a2d-97be-4af36bc753a8 | pablocrossa/trinitycore-portable | src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.cpp | #include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "utgarde_keep.h"
#include "SpellScript.h"
#include "SpellAuraEffects.h"
uint32 ForgeSearch[3] =
{
GO_GLOWING_ANVIL_1,
GO_GLOWING_ANVIL_2,
GO_GLOWING_ANVIL_3
};
class npc_dragonflayer_forge_master : public CreatureScript
{
public:
np... | TOOL | 0.929513 | 5.644991 |
7ce914de-5279-401f-9698-5ae165a37e2d | anshul45-github/Leet-GFG-360 | Tries/Problems/Maximum_XOR_of_two_numbers_in_an_array.cpp | // https://leetcode.com/problems/maximum-xor-of-two-numbers-in-an-array/
#include<bits/stdc++.h>
using namespace std;
class Node {
public:
Node* left;
Node* right;
Node() {
left = nullptr;
right = nullptr;
}
};
class Solution {
public:
int findMaximumXOR(vector<int>& nums) {
... | ALGO | 0.999949 | 5.556047 |
585c4c88-349e-45de-88e1-8465504a4d9b | joydip10/Codeforces | 231A.cpp | #include<iostream>
using namespace std;
int main()
{
int num;
cin>>num;
int a,b,c,x=0;
while(num--)
{
cin>>a>>b>>c;
if((a+b+c)>=2)
{
x++;
}
}
cout<<x<<endl;
return 0;
}
| ALGO | 0.999841 | 4.177698 |
b86e816e-3446-45e3-8a57-b16b5d4b9911 | ishandutta2007/codeforces | 12tqian/normal/1472/D.cpp | #pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <iostream>
#include <iomanip>
#incl... | ALGO | 0.999963 | 5.515962 |
9d4c656c-962c-4add-9c11-c2ab37c79988 | tiltil9/mypng | cmodel/src/mypng_filter.cpp | /******************************************************************************
*******************************************************************************
** **
** File :
** Contributor :
** Date :
** Description :
** ... | TOOL | 0.994009 | 6.09125 |
aac4a5eb-3703-4178-a35d-0cc191cb3b57 | adriannprtm/Tubes-SDA-Kelompok4 | SymbolicC++/examples/grass.cpp | // grass.cpp
#include <iostream>
#include "symbolicc++.h"
using namespace std;
int main(void)
{
int i,j,n=4;
Symbolic e("e",n);
Symbolic y,result;
Symbolic A("A",n,n);
// non-commutative e0, e1, e2, ... , en
e = ~e;
cout << e << endl;
A(0,0) = 1; A(0,1) = 2; A(0,2) = 5; A(0,3) = 2;
A(1,0... | ALGO | 0.999576 | 3.329622 |
b27a735d-d7ca-4a7e-ae64-17e646b888d2 | Wh31028/coding-test | 바킹독/0x07/deque.cpp | #include <bits/stdc++.h>
using namespace std;
const int MX = 1000005;
int dat[2*MX+1];
int head = MX, tail = MX;
void push_front(int x){
dat[--head] = x;
}
void push_back(int x){
dat[tail++] = x;
}
void pop_front(){
head++;
}
void pop_back(){
tail--;
}
int front(){
return dat[head];
}
int back(){
ret... | ALGO | 0.975999 | 3.81988 |
88a32ed1-f7d8-4754-b698-8092e945d55e | Shubhamm1211/GFG- | Difficulty: Easy/Count distinct elements in every window/count-distinct-elements-in-every-window.cpp | //{ Driver Code Starts
// Initial Template for C++
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
vector<int> countDistinct(vector<int> &arr, int k) {
// code here.
int n = arr.size();
map <int,int> mp;
int i = 0, j = 0;
vecto... | ALGO | 0.999195 | 6.142388 |
b65c6507-1d3e-4078-aff9-3bc63ffe240d | ishandutta2007/codeforces | hitonanode/normal/793/B.cpp | #include <bits/stdc++.h>
using namespace std;
using lint = long long;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
struct fast_ios {
fast_ios() { cin.tie(nullptr), ios::sync_with_stdio(false), cout << fixed << setprecision(20); };
} fast_ios_;
#define FOR(i, begin, end) for (int i = (begin), i##_end... | ALGO | 0.999971 | 4.203511 |
0d41837d-245e-4816-8610-c3af18a6ea7c | Bitcoin-com/bitcoin-abc | src/bloom.cpp | #include "bloom.h"
#include "hash.h"
#include "primitives/transaction.h"
#include "random.h"
#include "script/script.h"
#include "script/standard.h"
#include "streams.h"
#include <cmath>
#include <cstdlib>
#define LN2SQUARED 0.4804530139182014246671025263266649717305529515945455
#define LN2 0.69314718055994530941723... | ALGO | 0.960184 | 7.340889 |
b80d7e95-5192-43ac-a46a-4e51c20a672f | agilbride2010/LED-Name-Plate | libraries/FastLED/src/noise.cpp | /// @file noise.cpp
/// Functions to generate and fill arrays with noise.
/// Disables pragma messages and warnings
#define FASTLED_INTERNAL
#include "FastLED.h"
#include <string.h>
FASTLED_NAMESPACE_BEGIN
/// Reads a single byte from the p array
#define P(x) FL_PGM_READ_BYTE_NEAR(p + x)
FL_PROGMEM static uint8_t c... | ALGO | 0.990392 | 6.414986 |
4b45d702-c454-49d9-bac2-269d439805d3 | ishandutta2007/codeforces | gyh20/normal/1439/E.cpp | #include<bits/stdc++.h>
#define re register
using namespace std;
inline int read(){
re int t=0;re char v=getchar();
while(v<'0')v=getchar();
while(v>='0')t=(t<<3)+(t<<1)+v-48,v=getchar();
return t;
}
int n,m,A[100002],B[100002],C[100002],D[100002],inf=1<<30,tot,rt,fa[500002],w[500002],O,tg[500002];
vector<int>G[500... | ALGO | 0.999838 | 3.348497 |
40d871f1-dc80-4a4c-8ef8-c6ef1ca71687 | JasonRomps/RC5-Accelerator | software/src/rc5/rc5.cpp | #include "rc5.h"
rc5::word_t rc5::rotl(rc5::word_t x, rc5::word_t y){
rc5::word_t n = y % W;
return (((x)<<(n)) | ((x)>>(W-n)));
}
rc5::word_t rc5::rotr(rc5::word_t x, rc5::word_t y){
rc5::word_t n = y % W;
return (((x)>>(n)) | ((x)<<(W-n)));
}
rc5::block_t rc5::encrypt(rc5::block_t data, rc5::word_t... | ALGO | 0.998947 | 4.920591 |
a82d3fa5-91d4-43eb-9b6a-e56291ca1fc5 | nau90535/leetcode | Medium/1921. Eliminate Maximum Number of Monsters.cpp | class Solution {
public:
//arrive[i] means when monster[i] will arrive (dist/speed), then sort arrive[0:n-1]
int eliminateMaximum(vector<int>& dist, vector<int>& speed) {
vector<float> arrive;
int numberOfMonster = dist.size();
for (int i=0; i<numberOfMonster; i++) {
arrive.push_... | ALGO | 0.99989 | 5.88064 |
a99490d1-a396-4c5f-aeba-0b0cc116050d | tnakai11/Atcoder-practice | ARC/ARC113/a.cpp | #include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
typedef long long ll;
typedef long double ld;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(int i=n; i>-1; --i)
#define ALL(a) (a).begin(),(a).end()
#define FILL(a,n,x) REP(i,(n)){ (a)[i]=(x)... | ALGO | 0.999954 | 4.834896 |
efe44a33-5ddd-4a29-bcad-ce032535c5bc | leon-schi/fortune-hyperbolic | experiments/CGAL-5.2/examples/Spatial_searching/using_fair_splitting_rule.cpp | #include <CGAL/Simple_cartesian.h>
#include <CGAL/point_generators_2.h>
#include <CGAL/Search_traits_2.h>
#include <CGAL/Orthogonal_k_neighbor_search.h>
#include <cmath>
typedef CGAL::Simple_cartesian<double> R;
typedef R::Point_2 Point_d;
typedef CGAL::Random_points_in_square_2<Point_d> Random_points_iterator;
typede... | ALGO | 0.999986 | 6.27707 |
bc90dc85-4e65-4720-b9a5-e78f221982e0 | Darbouka/VR-DAW | JUCE-7.0.9/modules/juce_audio_devices/native/oboe/src/flowgraph/resampler/IntegerRatio.cpp | #include "IntegerRatio.h"
using namespace resampler;
// Enough primes to cover the common sample rates.
static const int kPrimes[] = {
2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41,
43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97,
101, 103, 107, 109, 113, 127, 131, 137, 139, 149,
151, ... | ALGO | 0.995169 | 5.343403 |
46c606e0-2e90-485c-8b2c-edef9e621d64 | PhotonAOSP/platform_packages_inputmethods_LatinIME | native/jni/src/utils/autocorrection_threshold_utils.cpp | #include "utils/autocorrection_threshold_utils.h"
#include <algorithm>
#include <cmath>
#include "defines.h"
#include "suggest/policyimpl/utils/edit_distance.h"
#include "suggest/policyimpl/utils/damerau_levenshtein_edit_distance_policy.h"
namespace latinime {
const int AutocorrectionThresholdUtils::MAX_INITIAL_SCO... | TOOL | 0.927118 | 6.919679 |
cd2f07bf-c0eb-4b23-928a-47e9675e64d2 | kmhaneef/c-programming | finding positive integers.cpp | #include <stdio.h>
int findMissingPositive(int arr[], int size) {
for (int i = 0; i < size; i++) {
while (arr[i] > 0 && arr[i] <= size && arr[arr[i] - 1] != arr[i]) {
// Swap the elements to put them in the correct position
int temp = arr[i];
arr[i] = arr[temp - 1];
... | ALGO | 0.999969 | 4.727572 |
ab4bfec0-7cab-47ca-a16b-b34a6357dc89 | Amrita156/Leetcode_Amrita | 2334-number-of-flowers-in-full-bloom/2334-number-of-flowers-in-full-bloom.cpp | class Solution {
public:
vector<int> fullBloomFlowers(vector<vector<int>>& flowers, vector<int>& people)
{
unordered_map<int,int> mp;// no ordering
vector<int> mp_key;
#pragma unroll
for(int a: people){
if (mp.count(a)==0){
mp[a]=0;
mp_... | ALGO | 0.999976 | 5.95991 |
18b744e8-8faa-40d4-9906-5a76ae3a3836 | bulsond/prop_commands | example/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.998905 | 6.785645 |
7fbc3e05-fa39-4560-bab8-8d661f00ddae | raincross7/code-similarity | codes/train_code/problem437/problem437_404.cpp | #include<iostream>
#include<algorithm>
using namespace std;
int main(){
int i,j,n,m,t[50001],c[21];
cin >> n >> m;
for(i = 0; i < m; i++) cin >> c[i];
for(j = 0; j <= n; j++) t[j] = 10001;
t[0] = 0;
for(i = 0; i < m; i++){
for(j = c[i]; j <= n; j++){
t[j] = min( t[j], t[j-c[i]] + 1 );
}
... | ALGO | 0.999992 | 3.669654 |
d3633d3f-bb33-4c25-8862-d2f5cb7489d3 | arclab-hku/DEIO | thirdparty/gtsam/gtsam/geometry/Cal3_S2Stereo.cpp | /**
* @file Cal3_S2Stereo.cpp
* @brief The most common 5DOF 3D->2D calibration + Stereo baseline
* @author Chris Beall
*/
#include <gtsam/geometry/Cal3_S2Stereo.h>
#include <iostream>
namespace gtsam {
/* ************************************************************************* */
std::ostream& operator<<(st... | TOOL | 0.914321 | 6.910432 |
e749fd6b-ab3a-4564-9fb4-c99c727c3ea4 | plskz/competitive-programming | Junior Training Sheet/A/149.cpp | #include <bits/stdc++.h>
#define ll long long
#define all(x) (x).begin(), (x).end()
#define allr(x) (x).rbegin(), (x).rend()
using namespace std;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int k, l, m, n, d;
cin >> k >> l >> m >> n >> d;
int ans = 0;
for (int i = 1; i <= d; i++)
... | ALGO | 0.999641 | 3.964886 |
17645f76-06ef-421e-abb1-eb811aee7f52 | abdelrahmanbassam/LeetCode-Problems | 0121-best-time-to-buy-and-sell-stock/0121-best-time-to-buy-and-sell-stock.cpp | class Solution {
public:
int maxProfit(vector<int>& prices) {
int maxProf = 0, curMin = INT_MAX;
for(auto &p : prices){
curMin = min(curMin, p);
maxProf = max(maxProf,p - curMin);
}
return maxProf;
}
}; | ALGO | 0.999706 | 6.261945 |
4b311c4c-82ba-4c69-b2b3-7c9df34e0d91 | irmakaleem/Linear-Binary-Search-in-c- | lighestWeight.cpp | #include <iostream>
using namespace std;
int main()
{
double weight[] = {21.5, 15.0, 12.5, 25.0, 17.5, 24.0, 35.0, 40.0, 27.5, 22.0, 33.0, 12.5, 23.5, 10.25, 5.5, 45.5, 19.25, 12.25, 32.0, 20.0};
int n = sizeof(weight) / sizeof(weight[0]);
double lightest = weight[0];
for (int i = 1; i < n; i++)
{ ... | ALGO | 0.996663 | 3.407253 |
6d1977d9-3f79-4338-813d-00c02941f00d | cvc5/cvc5 | src/proof/theory_proof_step_buffer.cpp | #include "proof/theory_proof_step_buffer.h"
#include "proof/proof.h"
#include "proof/proof_node_algorithm.h"
using namespace cvc5::internal::kind;
namespace cvc5::internal {
TheoryProofStepBuffer::TheoryProofStepBuffer(ProofChecker* pc,
bool ensureUnique,
... | ALGO | 0.998535 | 6.701988 |
0b27e86b-418e-4c43-b13b-13a87e19cf15 | watermelonCrane/PS-Practice | code-up/1050.cpp | #include <iostream>
int main() {
int a, b;
std::cin >> a >> b;
std::cout << (a == b);
return 0;
} | ALGO | 0.996677 | 3.312332 |
04d1ce6f-4b27-468a-a718-490eadb8538b | waydandeSneha/Coding_Challenges | divisibleSumPairs/pairs.cpp | #include <bits/stdc++.h>
using namespace std;
string ltrim(const string &);
string rtrim(const string &);
vector<string> split(const string &);
int divisiblePairs(int n, int k, vector<int>ar){
int count =0;
for(int i=0; i<n; i++){
for(int j=i+1; j<n; j++){
if(ar[i] < ar[j] && ar[i]+ar[j]/k == 0){
... | ALGO | 0.999656 | 4.454828 |
d40113fd-3c8c-45aa-8458-db3fe009adb0 | PhD-Strange/Computational-Math | sin0.cpp | #include "solution.h"
int main() {
vector<double> sin_inits0(SPACE_SCALE_N_0); // sin initial conditions
vector<double> sin_inits1(SPACE_SCALE_N_0);
vector<double> sin_inits2(SPACE_SCALE_N_0);
cout << check_stability(3, TIME_SPLIT_T_0, SPACE_SPLIT_H_0) << endl;
cout << check_stability(3, TIME_SPLI... | ALGO | 0.99963 | 3.809092 |
0a1c39ea-7c9d-40af-b605-8e06fb88540a | elador/FeatureDetection | libImageIO/src/imageio/LandmarkCollection.cpp | /*
* LandmarkCollection.cpp
*
* Created on: 23.03.2013
* Author: Patrik Huber
*/
#include "imageio/LandmarkCollection.hpp"
#include <stdexcept>
using cv::Mat;
using std::string;
using std::vector;
using std::make_pair;
using std::shared_ptr;
namespace imageio {
LandmarkCollection::LandmarkCollection()
{
... | TOOL | 0.925711 | 6.568371 |
f2742e0b-8ffe-4205-98a3-a8d7468e8ea6 | Mac-Ste/wzr-2k20-air | wzr20_2k/vector3D.cpp | /*********************************************************************************
Operacje na __vectorach 3- wymiarowych + kilka przydatnych funkcji graficznych
**********************************************************************************/
#define __VECTOR3D_CPP_
#include <math.h>
#include "vector3D.h"
float p... | ALGO | 0.982141 | 4.781413 |
595f357f-da36-4b87-af6f-d2c3d7737bb5 | Harsh-bharwani/competitive-programming | catchTheCoin.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
for(int i=0;i<n;i++){
int x,y;
cin>>x>>y;
if(y==0 or y==-1 or (y>0 and (y=2*abs(x) or x==0))){
cout<<"YES"<<'\n';
}
else cout<<"NO"<<'\n';
}
} | ALGO | 0.999778 | 3.623336 |
02aa6b99-276d-4104-ad87-fef6294d60de | Sarwar05/LightOJ | 1082 - Array Queries .cpp | #include<bits/stdc++.h>
using namespace std;
int ara[100005];
int tree[4*100005];
void build(int at, int begin,int end)
{
if(begin == end){
tree[at] = ara[begin];
return;
}
int left = at*2;
int right = at*2+1;
int mid = (begin+end)/2;
build(left,begin,mid);
build(right,mid+1,... | ALGO | 0.999948 | 4.152717 |
2476c07a-5582-49d8-9c01-c14422178117 | NG-Geeks/GFG_POTD | November_POTD/Print Pattern.cpp | Print Pattern
Print a sequence of numbers starting with N, without using loop, where replace N with N - 5, until N > 0. After that replace N with N + 5 until N regains its initial value.
Solution::
class Solution{
void solve(int n,vector<int>&v){
if(n<=0){
v.push_back(n);
return ;
... | ALGO | 0.999922 | 4.626301 |
a858a96c-ee9b-43f2-b4d9-47b6b4796c24 | ArnaudCs/Licence-Informatique-UM | S2/Données mulimédia/TP2 3D/HAI605I_TP2_Code/src/Mesh.cpp | #include "Mesh.h"
#include <algorithm>
using namespace std;
void Mesh::clear () {
clearTopology ();
clearGeometry ();
}
void Mesh::clearGeometry () {
vertices.clear ();
}
void Mesh::clearTopology () {
triangles.clear ();
}
void Mesh::computeTriangleNormals (vector<Vec3Df> & triangleNormals) {
f... | TOOL | 0.954573 | 6.277864 |
61d0288f-611a-46b8-a090-82a194c1ae07 | guihunkun/LeetCode | 640.cpp | class Solution {
public:
#define NO "No solution"
#define INF "Infinite solutions"
void helper(string exp, int& num, int& fac) {
int sign = 1; // 符号
int k = 0; // 系数值
bool is_x = false; // 系数是否隶属于x
for (int i = 0; i < exp.size(); ++i) {
char c = exp[i];
... | ALGO | 0.99995 | 4.436059 |
9feeecb7-5736-4114-8707-56216692157c | diogocecilio/neopz-master | SubStruct/tpzdohrprecond.cpp | /**
* @file
* @brief Contains the implementation of the TPZDohrPrecond methods.
* @author Philippe Devloo
* @since 2006
*/
#include "tpzdohrprecond.h"
#include "tpzdohrsubstructCondense.h"
#include "pzskylmat.h"
#include "pzvisualmatrix.h"
#include "tpzdohrassemblelist.h"
#include <sstream>
#include "pzlog.h"
... | ALGO | 0.969636 | 4.186563 |
199ab6d2-01c4-40b3-9d20-814e116db575 | sauber92/Study_Algorithm | BOJ/Bruteforce/10819.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int calc(vector<int> vec) {
int sum = 0;
for (unsigned int i = 0; i < vec.size()-1; i++) {
sum += abs(vec[i] - vec[i+1]);
}
return sum;
}
int main() {
int N, tmp, ans = 0;
cin >> N;
vector<int> A(N);... | ALGO | 0.999837 | 4.652585 |
62247a1f-d91a-4bab-b54f-c1dcc03165cb | ishandutta2007/codeforces | ko_osaga/normal/1290/C.cpp | #include<bits/stdc++.h>
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()
using namespace std;
using lint = long long;
using pi = pair<int, int>;
const int MAXN = 600005;
struct node{
int rootVal;
int cnt0, cnt1;
node(){
rootVal = -1;
cnt0 = 1, cnt1 = 0;
}
};
struct disj{
int pa[MAXN];
v... | ALGO | 0.999911 | 3.711859 |
bdb8c674-c741-4808-ae60-22c36a04d07f | mitesh-goswami/DSA | c++-leetcode/synaptics/demo.cpp | #include <bits/stdc++.h>
using namespace std;
/*
C/C++ Program for Reverse words in a given string-
"work I Synaptics for " becomes "I work for Synaptics ".
*/
string breakTwo(string s)
{
}
string revWVec(string s)
{
vector<string> words;
string word;
for (char c : s)
{
if (c == ' ')
{
... | ALGO | 0.999961 | 5.32443 |
5ba13658-7758-42c0-8c95-f01bafaa6028 | SpinOrg/cblast_binaries | src/routines/level3/xsymm.cpp | #include "routines/level3/xsymm.hpp"
#include <string>
#include <vector>
namespace clblast {
// =================================================================================================
// Constructor: forwards to base class constructor
template <typename T>
Xsymm<T>::Xsymm(Queue &queue, EventPointer event, ... | ALGO | 0.998307 | 6.758948 |
3729dc91-b770-4b7e-a61e-e446dd06a034 | bastosmichael/semantic-web-crawler | External Libraries/boost_1_49_0/libs/graph/example/edge-function.cpp | using namespace boost;
template < typename Graph, typename VertexNamePropertyMap > void
read_graph_file(std::istream & graph_in, std::istream & name_in,
Graph & g, VertexNamePropertyMap name_map)
{
typedef typename graph_traits < Graph >::vertices_size_type size_type;
size_type n_vertices;
typena... | ALGO | 0.956764 | 5.370278 |
b55a680d-30f4-426a-b407-a584717e04de | PhuocVinhLee/LuanVan_CNTT | online_exam_system_backend/temp/kc2kryt6.cpp | #include<stdio.h>
int max(int a, int b){
if(a>b) return a;
return b;
}
int max3(int a, int b, int c)
{return max(max(a,b), c);
}
int main() {
printf("%d", max3(-5, 1, 4));
return 0;
}
| ALGO | 0.999851 | 4.487778 |
ce0ea03b-57f8-4fc4-bdf7-ff225d757354 | yyyj2813/CodingTestPrac | LeetCode/56_MergeIntervals.cpp | #include <algorithm>
#include <stack>
class Solution {
public:
vector<vector<int>> merge(vector<vector<int>>& intervals) {
sort(intervals.begin(), intervals.end());
stack<vector<int>> st;
for(auto interval: intervals){
if(!st.empty() && interval[0] <= st.top()[1] ){
... | ALGO | 0.999999 | 5.968513 |
34fc5208-c4a3-41b0-8d15-0877330684da | anushkaGurjar99/Data-Structure-and-Algorithms | LEETCODE/Greedy/Q45. Jump Game II.cpp | /*
* Author : Anushka Gurjar
* Date : June 2020
* flags : -std=c++14
*/
#include<bits/stdc++.h>
using namespace std;
// Problem Statement: https://leetcode.com/problems/jump-game-ii/
class Solution{
public:
int jump(vector<int>& A) {
int n = A.size();
if(n <= 1)
r... | ALGO | 0.999956 | 5.581395 |
41e4d2e7-c6c5-4da4-aa02-e90cc2f80cbd | ishandutta2007/codeforces | unstoppablechillmachine/normal/1229/C.cpp | #include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
using namespace std;
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define SZ(x) (int)(x).size()
#define int ll
#define F first
#define S second
const int N = 1e5 + 10;
vector<int> in[N];
int cnt[N];
ll ans;
inline void sub(int v) {
... | ALGO | 0.999745 | 4.386359 |
352ea7fc-ba1b-4e7b-b443-9d93bbf60283 | stdstring/leetcode | Algorithms/Tasks.2501.3000/2849.DetermineIfCellIsReachableAtGivenTime/solution.cpp | #include <algorithm>
#include "gtest/gtest.h"
namespace
{
class Solution
{
public:
[[nodiscard]] bool isReachableAtTime(int sx, int sy, int fx, int fy, int t) const
{
const int deltaX = std::abs(sx - fx);
const int deltaY = std::abs(sy - fy);
if ((deltaX == 0) && (deltaY == 0))
... | TEST | 0.998933 | 6.694249 |
d851f91c-e78f-41af-b851-d52e291c3bdc | AmiriShavaki/competitive-programming | HW/HW6/C.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
long long dearr_cnt[5] = {1, 0, 1, 2, 9};
inline long long comb(int k, int n) {
int ans = 1;
for (int i = n - k + 1; i <= n; i++) ans *= i;
for (int i = 1; i <= k; i++) ans /= i;
return ans;
}
int32_t main() {
ios::sync_with_st... | ALGO | 0.999767 | 4.574812 |
195601aa-75a9-4295-aaba-1162c5f85169 | injamam00155/Data-Structure-Problems-Solving-in-C- | isMultiple.cpp | #include<iostream>
using namespace std;
bool isMultiple(int x,int y)
{
if(x%y==0){return true;}
return false;
}
int main()
{
bool x =isMultiple(8,4);
cout<<x;
return 0;
} | ALGO | 0.999 | 3.242961 |
847f35a7-20c0-4491-8804-1a7e0dd76145 | PaukIsUha/optimizing_formating_code | predictions/submissions-aizu-gpt4/Codenet/p02314/552519859/response_5.cpp | #include <algorithm>
#include <iostream>
#define INF 2000000000
#define MAX_N 50001
#define MAX_M 21
int main() {
int n, m;
std::ios::sync_with_stdio(false);
std::cin.tie(NULL);
std::cin >> n >> m;
int c[MAX_M];
int mini[MAX_N];
mini[0] = 0;
for (int i = 1; i <= m; i++) {
std::cin >> c[i];
}
st... | ALGO | 0.999986 | 4.101796 |
34d0b77a-3da3-47bf-817d-13673c576520 | Pika-Pool/cpp-progs-3rd-sem | 54-overload +- time.cpp | #include <iostream>
using namespace std;
class Time
{
private:
int h, m;
long long s;
public:
Time(int hours = 0, int minutes = 0, long seconds = 0)
{
if (hours < 0 || minutes < 0 || seconds < 0)
throw "Invalid time. Values can't be negative";
h = hours;
m = minutes;
s = seconds;
normlize();
}
//... | TOOL | 0.956137 | 5.503554 |
2923668b-4893-40be-a99e-39135b96683e | sarvex/leetcode-intercal | solution/0100-0199/0172.Factorial Trailing Zeroes/Solution.cpp | class Solution {
public:
int trailingZeroes(int n) {
int ans = 0;
for (int i = 5; i <= n; i *= 5) ans += n / i;
return ans;
}
}; | ALGO | 0.999968 | 6.535993 |
575c6585-87bd-4553-a628-dc90ab964b2b | sarvex/leetcode-intercal | solution/1000-1099/1026.Maximum Difference Between Node and Ancestor/Solution.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.999974 | 6.50711 |
11781d09-2d27-4886-a2bc-815c09bd001e | franky90237/LeetCode | Medium_1038. Binary Search Tree to Greater Sum Tree.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.99994 | 5.310091 |
40b770ac-e2db-4868-bf0d-b9175272e82e | haitaibrowser/haitaibrowser | third_party/skia/experimental/SkSetPoly3To3.cpp | #include "SkMatrix.h"
// FIXME: needs to be in a header
bool SkSetPoly3To3(SkMatrix* matrix, const SkPoint src[3], const SkPoint dst[3]);
static void computeOuterProduct(SkScalar op[4],
const SkPoint pts0[3], const SkPoint& ave0,
const SkPoint pts1[3], c... | TOOL | 0.970594 | 7.065676 |
c80246f0-b1b5-4eba-a4f5-f6d88b46c94f | ZoruaSama/Solutions-4-Luogu-Problems | P1223/main.cpp | #include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int n;
struct p{
int id;
int t;
}P[1010];
bool cmp(p &a,p &b){
return a.t < b.t;
}
int main() {
cin>>n;
for(int i=1;i<=n;++i){
cin>>P[i].t;
P[i].id=i;
}
sort(P+1,P+1+n,cmp);
double t=0;
fo... | ALGO | 0.999597 | 3.56884 |
5b1b6413-3b06-428b-8477-d6dacecdea70 | welkin-qing/C | c语言代码/习题8/8.4.cpp | #define PI 3.14
#include<stdio.h>
void function(int r1,int r2,int h)
{
double v;
v=PI*r1*r1*h-PI*r2*r2*h;
printf("%4.2f",v);
}
main()
{
int r1,r2,h;
double v;
scanf("%d,%d,%d",&r1,&r2,&h);
function(r1,r2,h);
}
| ALGO | 0.998962 | 3.294918 |
2dd336b3-275b-4134-b0dc-75b601102592 | vipinrao009/DSA_WITH_CPP | Basic_Math_Pointer/Que1.cpp | #include<iostream>
using namespace std;
void solve(int arr[],int size)
{
//imp case
*arr =*arr+1;
}
int main()
{
int arr[] = {10,20,30,40,50};
int size =5;
solve(arr,size);
for(int i=0; i<size; i++)
{
cout<<arr[i]<<" ";
}
} | ALGO | 0.999669 | 3.952941 |
02ef4026-27ea-4cfe-a183-e62098f1b4c6 | anwar-arif/acm-code | uva/1121 - Subsequence.cpp | #include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <queue>
#... | ALGO | 0.999684 | 3.162698 |
5096b2e5-a6d3-4769-a47e-7a12606d0208 | vishwas25/DAA-Codes | 14. Activity Selection.cpp | #include<bits/stdc++.h>
using namespace std;
sortCol(const vector<int>& v1, const vector<int>& v2)
{
return v1[1] < v2[1];
}
int main()
{
int n,ip,end;
cout<<"Enter number of persons : ";
cin>>n;
vector<vector<int> > v;
cout<<"Enter the start and end time : ";
for(int i=0;i<n;i++)
{
vector<int> v1;
for(... | ALGO | 0.999913 | 4.494419 |
41408eec-61d2-49c1-8a8d-85a422cf23be | turneja123/competitive-programming-library | Problem/Dynamic Programming/Frog 2.cpp | //https://atcoder.jp/contests/dp/tasks/dp_b
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define endl "\n"
#define ll long long
#define IOS ios_base::sync_with_stdio(false); cin.tie(nullptr);
const int N = 1e5 + 5;
const int INF = 2e9;
int dp[N];... | ALGO | 0.999964 | 4.032256 |
afd15b8d-16dc-4404-9434-e784a3102b40 | ManishxNinja/DSA-Code | Tree/AVL Tree/LL_Rotation.cpp | #include<iostream>
using namespace std;
class Node{
public:
int data;
int height;
Node* left;
Node* right;
}*root = NULL;
int NodeHeight(Node* p){
int h1,h2;
h1 = p && p->left?p->left->height:0;
h2 = p && p->right?p->right->height: 0;
return h1>h2?h1 + 1:h2 + 1;
}
int balanceFacto... | ALGO | 0.999939 | 4.88911 |
0ee0b7a9-cab5-47bc-9159-8fb76387da94 | nitin22032002/leetcode_question | k largest elements - GFG/k-largest-elements.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
//User function template for C++
class Solution{
public:
vector<int> kLargest(int arr[], int n, int k) {
priority_queue<int,vector<int>,greater<int>> d;
for(int i=0;i<n;i++){
d.push(arr[i]);
if(d.s... | ALGO | 0.999982 | 5.737115 |
44ab8a98-3d84-44cf-bbb7-6131ab3030bf | stackwild/gogogadget | leetcodes/312. Burst Balloons/312-2.cpp | class Solution {
public:
int maxCoins(vector<int>& nums) {
const int n = nums.size();
// dp[i][j] := maxCoins(nums[i..j])
vector<vector<int>> dp(n + 2, vector<int>(n + 2));
nums.insert(nums.begin(), 1);
nums.insert(nums.end(), 1);
for (int d = 0; d < n; ++d)
for (int i = 1; i + d <= n... | ALGO | 0.999968 | 5.917793 |
8fb91c80-8ccf-4ce3-bbfd-f648184aed15 | ssj-gz/Competitive-Programming | contests/world-codesprint-12/factorial-array.cpp | #define VERIFY_SEGMENT_TREE
#define SUBMISSION
#ifdef SUBMISSION
#undef VERIFY_SEGMENT_TREE
#define NDEBUG
#endif
#include <iostream>
#include <vector>
#include <array>
#include <algorithm>
#include <cassert>
using namespace std;
constexpr int64_t mod = 1'000'000'000UL;
constexpr int maxNonZeroFactorial = 39;
vector... | ALGO | 0.999956 | 4.91596 |
b662f53a-0c73-4574-8268-8befb0f6c8a8 | vlluvia/algorithm | pat/甲级/1083.cpp | #include<bits/stdc++.h>
#define INF 1<<29
using namespace std;
struct student {
string name;
string id;
int grade;
};
int n, min_grade, max_grade;
vector<student> students;
vector<student> res;
bool cmp(student s1, student s2) {
return s1.grade > s2.grade;
}
void pat1083() {
cin >> n;
for ... | ALGO | 0.999822 | 4.673671 |
091d4602-a71a-41a3-aeaf-0f2570ca94b6 | kschmeckpeper/keypoint-pose-estimation | gtsam/gtsam-4.0.0/gtsam/nonlinear/NonlinearConjugateGradientOptimizer.cpp | /**
* @file NonlinearConjugateGradientOptimizer.cpp
* @brief Simple non-linear optimizer that solves using *non-preconditioned* CG
* @author Yong-Dian Jian
* @date Jun 11, 2012
*/
#include <gtsam/nonlinear/NonlinearConjugateGradientOptimizer.h>
#include <gtsam/nonlinear/internal/NonlinearOptimizerState.h>
#i... | ALGO | 0.999546 | 7.598557 |
71c836d3-a12d-417c-8a3b-33af59dafa3e | hkhetawat/SCOREP_Applications | lammps/src/RIGID/fix_rattle.cpp | /* ----------------------------------------------------------------------
Contributing author: Peter Wirnsberger (University of Cambridge)
------------------------------------------------------------------------- */
#include "fix_rattle.h"
#include <mpi.h>
#include <cmath>
#include <cstring>
#include "atom.h"
#incl... | ALGO | 0.999279 | 5.92192 |
48f59b4b-8a0f-4e46-aa2c-15efcea071bf | Seirisiii/programming.in.th | CodeCube/codecube_137.cpp | #include<bits/stdc++.h>
using namespace std;
int n;
int ans;
int num;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int mn=4005;
cin>>n;
while(n--){
cin>>num;
if(abs(2017-num)<mn){
mn=abs(2017-num);
ans=num;
}
}
cout<<ans;
return 0;
} | ALGO | 0.999843 | 3.898047 |
c425c8b5-ec5c-4cf9-bfe0-a8a98f84da3d | LYPei401/Joye-Libert-Encryption | fast_en.cpp |
#include <gmp.h>
#include <gmpxx.h>
#include <chrono>
using namespace std;
#include <iostream>
#include <fstream>
#include <ctime>
#include <cstdlib>
#include <cstring>
unsigned long long get_seed(unsigned int i)
{
auto now = std::chrono::high_resolution_clock::now();
auto millis = std::chrono::duration_cast<... | ALGO | 0.999903 | 4.216919 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.