uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
11172dd4-4f85-4ba5-b8ce-1df7c488e17f | Raagsss/DSA | LeetCode/575-distribute-candies/distribute-candies.cpp | class Solution {
public:
int distributeCandies(vector<int>& candyType) {
unordered_map<int,int> mp;
for(int i=0;i<candyType.size();i++) {
mp[candyType[i]]++;
}
int m=candyType.size()/2;
int a=mp.size();
return min(a,m);
}
}; | ALGO | 0.999883 | 6.045258 |
1ebefea3-1a48-42ca-8fd0-81f8cb9db730 | xt9852/TestSet | 08.TestSet/src/08.Algorithm/bsdiff/bsdiff.cpp | #include "stdafx.h"
#include "bspatch.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <fcntl.h>
#include <stdarg.h>
#ifdef XP_WIN
#include <io.h>
#include <winsock2.h>
#else
#include <unistd.h>
#include <arpa/inet.h>
#define _O_BINARY 0
#endif
#undef MIN
#define MIN(x,y) (((x)<(y)) ? (x) : (y))... | TOOL | 0.962079 | 3.263353 |
9e50cec5-92df-4ebe-b60c-5c079f60ae94 | Parihar07/practice_dsa | string_eord_reverse/string_eord_reverse/main.cpp | //
// main.cpp
// string_eord_reverse
//
// Created by CodeBreaker on 23/01/25.
//
<<<<<<< HEAD
#include <iostream>
int main(int argc, const char * argv[]) {
// insert code here...
std::cout << "Hello, World!\n";
=======
/*
everse the String
Attempted
feature icon
Using hints except Complete Solution i... | ALGO | 0.999645 | 5.613808 |
759df47b-e38d-4f99-acac-d33376b1efa6 | patpro28/problems | D1/Dekiemtra/01/task4.cpp | #include <iostream>
#include <vector>
#include <array>
using namespace std;
const int M = 500;
int pack(int u, int v)
{
return u * M + v;
}
array<int, 3> ke1(int x)
{
return {{x + 1, x + M, x + M + 1}};
}
array<int, 3> ke2(int x)
{
return {{x - 1, x + M, x + M - 1}};
}
bool inBound(int u, int n)
{
int x = ... | ALGO | 0.999947 | 4.298631 |
974e927d-54ca-4d94-9105-226167210107 | karan-2906/CNS-CODES | Exp4/cryptolib/md4.cpp | // md4.cpp - modified by Wei Dai from Andrew M. Kuchling's md4.c
// The original code and all modifications are in the public domain.
// This is the original introductory comment:
/*
* md4.c : MD4 hash algorithm.
*
* Part of the Python Cryptography Toolkit, version 1.1
*
* Distribute and use freely; there are n... | ALGO | 0.999779 | 6.46053 |
3788e6d6-34b0-4198-875a-b49f375c4984 | 24icewolf42/gtsam | gtsam/3rdparty/Eigen/doc/examples/TutorialLinAlgRankRevealing.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main()
{
Matrix3f A;
A << 1, 2, 5,
2, 1, 4,
3, 0, 3;
cout << "Here is the matrix A:\n" << A << endl;
FullPivLU<Matrix3f> lu_decomp(A);
cout << "The rank of A is " << lu_decomp.rank() << endl;
c... | ALGO | 0.999874 | 3.720849 |
4c08e5e0-48f4-486e-8d9e-2d43164195e3 | GreenTecnologia/green_storage | green_storage/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.99885 | 6.785645 |
4a592ddb-bafb-4778-81e7-5bdbb607aa0b | wycg1984/ORB_SLAM2_Learning | Thirdparty/g2o/g2o/core/optimization_algorithm_levenberg.cpp | // Modified Raul Mur Artal (2014)
// - Stop criterium (solve function)
#include "optimization_algorithm_levenberg.h"
#include <iostream>
#include "../stuff/timeutil.h"
#include "sparse_optimizer.h"
#include "solver.h"
#include "batch_stats.h"
using namespace std;
namespace g2o {
OptimizationAlgorithmLevenberg::... | ALGO | 0.999862 | 6.434185 |
e7283ba6-a918-49e6-a333-8e4406139ac8 | QinHongZhe/hongzhe-leetcode | solution/0100-0199/0119.Pascal's Triangle II/Solution.cpp | class Solution {
public:
vector<int> getRow(int rowIndex) {
vector<int> row(rowIndex + 1, 1);
for (int i = 2; i < rowIndex + 1; ++i) {
for (int j = i - 1; j > 0; --j) {
row[j] += row[j - 1];
}
}
return row;
}
}; | ALGO | 0.99996 | 6.205659 |
eb47134e-fd3d-40d1-85c9-c1f384370850 | ShinSeungChul/BOJ | 14888/14888/소스.cpp | #include<iostream>
#include<cstdio>
#include<vector>
#pragma warning(disable:4996)
using namespace std;
int n, num;
int arr[4] = { 0 };
vector<int> v;
int max_num = -2000000000, min_num = 2000000000;
void solve(int sum, int cur) {
if (cur == n - 1) {
if (max_num < sum)
max_num = sum;
if (min_num > sum)
m... | ALGO | 0.99995 | 3.276191 |
48f11164-6b7c-4d58-af3d-326a523a68a0 | WizardPenguin/competative-programming | E131 div2/1701D.cpp | #pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> p... | ALGO | 0.999877 | 3.772091 |
97af9390-6c44-4a57-99aa-cba40dc52f24 | raincross7/code-similarity | codes/train_code/problem060/problem060_487.cpp | #include<bits/stdc++.h>
using namespace std;
//
typedef long double ld;
typedef long long int ll;
//
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
//
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<char> vc;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<vi> vvi;
typedef vector<vl>... | ALGO | 0.99988 | 4.295743 |
80bc44fd-70a6-4813-b2c3-02e0f0486d59 | tasosger/cp_problems | applediv.cpp | #include <bits/stdc++.h>
#define int long long
using namespace std;
int32_t main() {
ios::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
//cout << n << endl;
vector<int> p (n);
int w;
int total = 0;
for (int i = 0;i< n;++i) {
cin >> w;
p[i] = w;
//cout << ... | ALGO | 0.999971 | 3.842135 |
539c1181-75d1-4b2b-9842-5b30e5dfa6d4 | yashwanthguguloth24/Cpp-Practice | FINAL450/Dynamic Programming/Top Down Plus Bottom Up/0-1 knapsack type/min_subset_sum_diff.cpp | // https://practice.geeksforgeeks.org/problems/minimum-sum-partition3317/1
/*
Let sums be s1 and s2
then s2-s1 = min , Also s1+s2 = sum
==> sum-2*s1 should be minimum
Find all possible subset sums 0< s1 < sum and find minimum of sum-2*s1
Find all possible subset sums 0< s1 < sum -- already solved
Find if subset wit... | ALGO | 0.999949 | 5.178585 |
b2ea224c-5ac9-42cd-a2a6-9f91eb3b3e9a | sarvex/leetcode-intercal | solution/0700-0799/0749.Contain Virus/Solution.cpp | class Solution {
public:
const vector<int> dirs = {-1, 0, 1, 0, -1};
vector<int> c;
vector<vector<int>> areas;
vector<unordered_set<int>> boundaries;
vector<vector<int>> infected;
vector<vector<bool>> vis;
int m;
int n;
int containVirus(vector<vector<int>>& isInfected) {
inf... | ALGO | 0.999921 | 6.229177 |
5d2447c0-bc9f-479f-9b58-eeda55152732 | AksyonovaKaterina/labs_PA_22_Aksionava | 9304_Aksionava_EA/lab1/proccesses/second_proccess.cpp | #include <iostream>
#include <fstream>
#include <string>
#include <sys/shm.h>
#include <sys/ipc.h>
using namespace std;
#define FIRST_MATRIX_KEY 0x1234
#define SECOND_MATRIX_KEY 0x1334
#define THIRD_MATRIX_KEY 0x1434
void read_matrix_from_shm(int* matrix, int rows, int columns, key_t key) {
int shmid = shmget(ke... | ALGO | 0.860483 | 3.220275 |
78ad64f4-e3bc-4deb-a7dd-d16fe455b9c3 | ibsson/Program | BKJN/구현/20240801_bkjn_1347(미로 만들기).cpp | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct pos {
int x;
int y;
}Pos;
char maze[51][51] = { 0 };
void Get_Min(Pos* A, int* x_min, int* y_min, int K) {
for (int i = 0; i <= K; i++) {
if ((*x_min) > A[i].x) (*x_min) = A[i].x;
if ((*y_min) > A[i].y) (*y_min) = A[i].y;
}
}
void G... | ALGO | 0.99998 | 3.719451 |
c2b7e003-3931-48f9-90fd-2789ea97647f | LakoMoor/SE2013 | thirdparty/openal-soft/common/polyphase_resampler.cpp |
#include "polyphase_resampler.h"
#include <algorithm>
#include <cmath>
#include "math_defs.h"
#include "opthelpers.h"
namespace {
constexpr double Epsilon{1e-9};
using uint = unsigned int;
/* This is the normalized cardinal sine (sinc) function.
*
* sinc(x) = { 1, x = 0
* { sin... | ALGO | 0.999161 | 6.301872 |
9d12bced-d644-4c2b-aa7e-fe3487d63f4c | Cccmm002/my_leetcode | 568-maximum-vacation-days/maximum-vacation-days.cpp | //
// LeetCode wants to give one of its best employees the option to travel among N cities to collect algorithm problems. But all work and no play makes Jack a dull boy, you could take vacations in some particular cities and weeks. Your job is to schedule the traveling to maximize the number of vacation days you could ... | ALGO | 0.999912 | 5.819699 |
68c3f0db-a1c9-4533-8f29-ad91cda13a34 | Henrik-Yao/NEUQ-ACM-Solution | week6/谢尚呈/子字符串个数匹配.cpp | #include<iostream>
#include<cstdio>
#include<string>
using namespace std;
string A[1000], B;
int main()
{
int now=0;
char ty;
scanf("%c", &ty);
while(ty!='\n')
{
if((ty<'a')||(ty>'z'))
if((ty<'A')||(ty>'Z'))
if(A[now]!="\0")
{
now+=1;
scanf("%c", &ty);
continue;
}
else
{
scanf("%c", &ty);... | ALGO | 0.999548 | 3.305285 |
3bd63bb2-d91f-4b50-82ee-f860bd75f80c | PRADUMN-2020/Data-Structures-and-Algorithms | Heap/heap.cpp | #include<iostream>
using namespace std;
insert(int heap[],int n) // function to insert an element at n th (next to the heap array) position of heap array to the max heap
{
int temp,i=n;
temp=heap[n];
while(i>1&&temp>heap[i/2]) // for min heap just put less than sign after temp
{
heap... | ALGO | 0.999973 | 3.849066 |
6ff8c597-7b69-490a-be6d-e51e0d664c4e | GlycerolVeinz/ALG | Homeworks/Hw07/Simulator.cpp | #include "simulator.h"
Simulator *readInput() {
auto *sim = new Simulator;
unsigned long S, K, M;
std::cin >> S >> K >> M;
sim->S_simulatorSequencesCount = S;
sim->K_simulatorSequenceLength = K;
sim->M_sequenceLength = M;
for (int i = 0; i < S; ++i) {
std::string sequence;
... | ALGO | 0.999913 | 4.229973 |
bf433afe-cf2d-44d7-85e3-4eab5d15ce1c | urvangibran/Praktikum_StrukturData | Modul_3/ASI/ASI_KI.cpp | #include <iostream>
#include <map>
#define ull unsigned long long int
using namespace std;
int main()
{
int t;
cin >> t;
ull angka;
map<ull, ull> catalan_map;
catalan_map[0] = 1;
catalan_map[1] = 1;
while (t--)
{
cin >> angka;
// kalo gaada
if (catalan_map.cou... | ALGO | 0.999713 | 4.751827 |
d8a90a93-a723-4242-956a-f2b4ecbd6971 | joelchaconcastillo/Codeforces | contests/1024_Div3/A/main.cpp | #include <bits/stdc++.h>
using namespace std;
void solve(){
int n;cin>>n;
vector<int>a(n), b(n);
for(int i = 0 ;i < n ; i++){
cin>>a[i];
}
for(int i = 0 ;i < n ; i++){
cin>>b[i];
}
int res = 0;
for(int i = 0 ;i < n; i++){
res += max(0, a[i]-b[i]);
}
res++;
cout <<res<<endl;
}
int main(){
int T;
... | ALGO | 0.999983 | 3.793867 |
746fbc87-2cb2-403d-8a4a-5fb83cb6fee0 | Tejasarus/Coding-Assignments | CS 111 - Discrete Structures/test.cpp | #include <iostream>
#include <list>
#include <math.h>
#include <cmath>
#include <string>
using namespace std;
int gcd(int x, int y)
{
if (y == 0)
{
return x;
}
else
{
return gcd(y, x % y);
}
}
bool isPrime(int num)
{
if (num <= 1)
{
return false;
}
f... | ALGO | 0.999921 | 3.686895 |
d8e9abbf-2fb3-4347-a83b-304255270d2a | OMAsati1/DSA_REPO | 69.cpp | #include <iostream>
#include <queue>
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 *insertIntoBST(Node *&root, int d)
{
if (root == NULL)
{
root ... | ALGO | 0.999921 | 4.369528 |
c9198d2f-8459-4f3b-a8c8-3480b9b3ac79 | drowe67/cml | source/RateMatch.cpp | #include <math.h>
#include <mex.h>
#include <Matrix.h>
#include <stdlib.h>
/* main function that interfaces with MATLAB */
void mexFunction(
int nlhs,
mxArray *plhs[],
int nrhs,
const mxArray *prhs[] )
{
double *input, *output_p;
int X_i, e_ini, e_plus, e_minus;
int m... | ALGO | 0.999238 | 4.344996 |
7af58425-c56d-4c96-936c-4e2b8c909792 | yaman-694/DS | 329-longest-increasing-path-in-a-matrix/longest-increasing-path-in-a-matrix.cpp | class Solution {
public:
map<pair<int,int>, int> dp;
int dfs(vector<vector<int>>& matrix, int i, int j){
int maxi = 0;
if(dp.count({i,j})){return dp[{i,j}];}
int r[] = {-1,0,1,0};
int c[] = {0,1,0,-1};
for(int k = 0;k<4;k++){
int nr = i+r[k];
int... | ALGO | 0.999996 | 5.926147 |
573b8b50-7d97-493b-aec7-6d4766e87a0d | Vipin0218/CodeChefSolutions | BiryaniClass.cpp | #include <iostream>
using namespace std;
int main() {
int t;
cin>>t;
while(t--) {
int x,y;
cin>>x>>y;
cout << x*y << endl;
}
return 0;
}
| ALGO | 0.998006 | 5.06079 |
c76020d0-68b6-4a19-b235-d380b3f58f3a | poshithNandyala/cp-pratice | anonymous/TLE/1200/other peoples/13.cpp | #include <bits/stdc++.h>
using namespace std;
int a[100008], b[100008];
signed main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int tc;
cin >> tc;
while (tc--)
{
int n, m, k = 0;
cin >> n >> m;
for (int i = 1; i <= m; ++i)
cin >> a[i];
... | ALGO | 0.999918 | 3.838403 |
f3c77809-db4a-4e95-921d-bf44edd38093 | JosepHyv/Contest-Archive | OFMI-entrenamientos/greedy/estudiando.cpp | #include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define mset(x,y) memset(x,y,sizeof(x))
#define raya cerr<<"====================\n";
using namespace std;
typedef long double ld;
typedef ... | ALGO | 0.999973 | 4.597672 |
3cfba291-4ac0-45c8-9f97-807b04e95913 | techavenger123/LeetSolutions | 2825. Make String a Subsequence Using Cyclic Increments.cpp | class Solution {
public:
static bool canMakeSubsequence(string& str1, string& str2) {
const int n1=str1.size(), n2=str2.size();
char c2=str2[0];
int i, j;
for(i=0, j=0; i<n1 && j<n2; i++){
char c1=str1[i];
if (c1==c2 ||c1+1==c2 || (c1=='z' && c2=='a'))
... | ALGO | 0.999924 | 6.064622 |
5e1ea9ab-e0f7-41da-b2a5-f8bad5728be0 | TakuKobayashi/cluburo | app/cocos2d/tools/simulator/libsimulator/lib/ProjectConfig/SimulatorConfig.cpp |
#include "SimulatorConfig.h"
#include <sstream>
SimulatorConfig *SimulatorConfig::_instance = NULL;
SimulatorConfig *SimulatorConfig::getInstance()
{
if (!_instance)
{
_instance = new SimulatorConfig();
}
return _instance;
}
SimulatorConfig::SimulatorConfig()
{
_screenSizeArray.push_back... | CONFIG | 0.87579 | 4.28234 |
734e0108-9c5e-4d42-94e0-70404b94d368 | Prakashsaw/COTD-1 | COTD-Prog-on-vscode/CODT-PR-01(01/01/COTD-PR-21.cpp | class Solution {
public:
int minEatingSpeed(vector<int>& piles, int h) {
int i, size = piles.size();
int max = 1000000000;
int s, ans, mid, min = 1;
while(min<=max)
{
mid = min + (max - min) / 2;
//cout << mid << "\n";
s = 0;
fo... | ALGO | 0.999947 | 5.700023 |
80e72a7a-401a-434d-8d5c-cd2f27c1b9b5 | arsiddik7615/AlgorithmBatch3-main | Algo by Rahat SIr/Module 17/floyed_warshell.cpp | #include<bits/stdc++.h>
using namespace std;
const int INF=1e7;
int main()
{
int n,e;
cin>>n>>e;
int dis[n+1][n+1];
for (int i = 1; i <=n; i++)
{
for (int j = 1; j <=n; j++)
{
dis[i][j]=INF;
if(i==j) dis[i][j]=0;
}
}
while (e--)
{
... | ALGO | 0.999972 | 3.57576 |
4d1012f9-9194-4bf4-bc13-2df5882e02ad | darkosarajkic997/ARSudokuSolver | DLLs/BoardFinderLibrary/TestDLL/TestDLL.cpp | #include <iostream>
#include <opencv2/opencv.hpp>
#include"BoardFinderLibrary.h"
#include"RANSACHomography.h"
void drawLinesOnImageAndDisplay(int* lines, int numberOfLines, cv::Mat_<unsigned __int8> image, int colorRGB = 255, bool display = true)
{
float rho, theta, a, b;
int x0, x1, x2, y0, y1, y2;
for (int index... | ALGO | 0.98989 | 3.120838 |
799b95e8-5e4d-4d78-8038-2eb2250fb8f6 | rune2002/coding-study | programmers/heap1.cpp | #include <string>
#include <vector>
#include <queue>
#include <iostream>
using namespace std;
priority_queue<int, vector<int>, greater<int>> s;
int solution(vector<int> scoville, int K) {
for (int i : scoville)
s.push(i);
int answer = 0;
while (s.top() < K && s.size() > 1) {
int t1 = ... | ALGO | 0.99978 | 5.580523 |
8779b8de-9ca5-4f60-8689-8804710ad01b | sarvex/leetcode-swift | solution/1400-1499/1401.Circle and Rectangle Overlapping/Solution.cpp | class Solution {
public:
bool checkOverlap(int radius, int xCenter, int yCenter, int x1, int y1, int x2, int y2) {
int dx = x1 > xCenter ? x1 - xCenter : (x2 < xCenter ? xCenter - x2 : 0);
int dy = y1 > yCenter ? y1 - yCenter : (y2 < yCenter ? yCenter - y2 : 0);
return dx * dx + dy * dy <= r... | ALGO | 0.999878 | 5.661847 |
a0982309-98ab-4b6a-8454-0a9a6ae49331 | ureternalreward/magnetic-force | glm/test/core/core_func_integer_bit_count.cpp | // This has the programs for computing the number of 1-bits
// in a word, or byte, etc.
// Max line length is 57, to fit in hacker.book.
#include <stdio.h>
#include <stdlib.h> //To define "exit", req'd by XLC.
#include <ctime>
unsigned rotatel(unsigned x, int n)
{
if (static_cast<unsigned>(n) > 63) {printf("rotat... | ALGO | 0.999176 | 4.663313 |
473e25d4-444d-4572-9cf1-a2e88794514c | Eshaancoding/DQN | Pong.cpp | #include <iostream>
#include <stdlib.h>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
using namespace std;
class Pong {
private:
int pongX;
int pongY;
int pongVelX;
int pongVelY;
int width;
int height;
int playerX = 0;
int paddleWidth;
public:
int score ... | ALGO | 0.998642 | 4.382371 |
c7a842df-63cb-4e67-a4a5-8a81f4371bfa | soundscool11/algorithm-coding-test-prep | inflearn/cpp-lecture/07-repair-word.cpp | #include <stdio.h>
#include <iostream>
using namespace std;
int main() {
freopen("input.txt", "rt", stdin);
char word[101], newWord[101];
int p=0;
scanf("%[^\n]", word);
for(int i=0; word[i]!='\0'; i++) {
if(word[i] != ' ') {
if(word[i]>=65 && word[i]<=90) {
newWord[p++] = word[i] + 32;
}
... | ALGO | 0.979695 | 4.193925 |
818bc9f7-ed54-4137-b373-f08955adac37 | deeptechlabs/cyberweapons | Encryption/crypto32/md2.cpp | // md2.cpp - modified by Wei Dai from Sun Microsystems's md2.c
#include "pch.h"
#include "md2.h"
NAMESPACE_BEGIN(CryptoPP)
MD2::MD2()
: buf(64)
{
Init();
}
void MD2::Init()
{
memset(buf, 0, 64);
len = 0;
}
void MD2::Update(const byte *input, unsigned int length)
{
while (length)
{
unsigned int lenInc = STD... | ALGO | 0.999903 | 7.048189 |
dd04b7d1-931f-4184-830c-27771b196275 | seanx92/PekingU-Online-Judge | POJ1088/main.cpp | #include <iostream>
#define NIL 99999999
int height[105][105];
int dp[105][105];
int R,C;
using namespace std;
int dfs(int,int);
int main()
{
int max=0,tmp,m,i,j;
cin>>R>>C;
for(i=1;i<=R;i++)
for(j=1;j<=C;j++)
cin>>height[i][j];
for(m=0;m<=R+1;m++){ //Ҫʼ
height... | ALGO | 0.999864 | 4.277321 |
e41ea12f-a66f-4900-9f32-a02b49765b2f | emanlaicepsa/codes | cf1257D.cpp | #include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(false);cin.tie(0);
using namespace std;
using ll=long long;
using pii=pair<int,int>;
#define fi first
#define se second
stack<pii,vector<pii>> ts;
queue<int,list<int>> mons;
pii arr[200005];
vector<pii> heroes;
int main(){
IOS;
int t;
cin>>t;
while(t--){
w... | ALGO | 0.999782 | 3.736949 |
08a833f7-12d8-42b3-8994-9381250a9a2b | leonardcser/leetcode | solutions/409_longest_palindrom.cpp | // Time complexity: O(n)
// Space complexity: O(1)
#include <string>
using namespace std;
constexpr int ALPHABET_LEN = 26;
class Solution {
public:
int longestPalindrome(string s) {
int lower[ALPHABET_LEN] = {0};
int upper[ALPHABET_LEN] = {0};
for (char ch : s) {
if (ch >=... | ALGO | 0.99988 | 6.443989 |
6075193f-31b3-466d-8c64-78018b6997f2 | ishandutta2007/codeforces | romawhite/normal/264/B.cpp | //#pragma comment(linker, "/STACK:32777216")
#include <iostream>
#include <vector>
#include <set>
#include <cstdio>
#include <cmath>
#include <string>
#include <algorithm>
#include <map>
#include <queue>
#include <memory.h>
#include <fstream>
#include <time.h>
#include <sstream>
using namespace std;
#define next gdfs... | ALGO | 0.999988 | 3.319131 |
f7ae359b-6e52-41db-b260-5c9cb614480d | ishandutta2007/codeforces | cekavis/normal/704/B.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 5005;
int n, s, e, f[N], a[5][N];
ll ans;
ll d(int x, int y){
return (ll)abs(a[0][x]-a[0][y])+a[3+(x<y)][x]+a[1+(y<x)][y];
}
int main() {
scanf("%d%d%d", &n, &s, &e);
for(int i=0; i<5; ++i) for(int j=1; j<=n; ++j) scanf("%d", a[i]+j);
... | ALGO | 0.999964 | 3.611122 |
4ab91fc3-bb6b-4aa0-9415-a778f862a587 | gdangelo/CarND-MPC-Project | src/Eigen-3.3/doc/snippets/Tutorial_solve_triangular.cpp | Matrix3f A;
Vector3f b;
A << 1,2,3, 0,5,6, 0,0,10;
b << 3, 3, 4;
cout << "Here is the matrix A:" << endl << A << endl;
cout << "Here is the vector b:" << endl << b << endl;
Vector3f x = A.triangularView<Upper>().solve(b);
cout << "The solution is:" << endl << x << endl;
| ALGO | 0.999587 | 3.055453 |
f676442d-63a7-4ec5-9478-7024828c9056 | yellowishcloud/yellowishblue | lab4_6/lab6/l.cpp | #include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
using namespace std;
bool isValid(const string& s, int n){//это важно чтобы isdigie can work meaning it won't modify the original string but can access it efficiently.& is a rederence
int cnt = 0;
for(size_t i=0; i<s.size();i++){
... | ALGO | 0.9956 | 4.915654 |
9d5b5411-0006-43fc-a34e-acc9863a54f6 | miguelsndc/competitive-programming-lib | Solutions/cses/RangeQ/Range_Update_Queries.cpp | #include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define vi vector<int>
#ifdef CARNEDESOOOL
#define debug(...) dbg(#__VA_ARGS__, __VA_ARGS__)
template <typename... T>
void dbg(const char* names, T... args) {
const char* p = names;
((c... | ALGO | 0.999727 | 5.275925 |
778e29c8-94c1-4207-a1f0-733b9a82da20 | candeocampo/Repaso-AyED | Repaso C++/Integrador2023.cpp | #include<iostream>
#include<stdio.h>
using namespace std;
// ----------------------------------- ejercicio 1 ----------------------------------------------
// a)
int Promedio_Notas(int nota1, int nota2, int nota3)
{
int suma = nota1 + nota2 + nota3;
return (suma / 3);
}
// b)
void Vector_Ordenado(int vec[])... | ALGO | 0.997537 | 4.203159 |
1f414a09-a4b4-4e2d-a873-58e626857481 | Yongdream/Lcode | 11.盛最多水的容器.cpp | /*
* @lc app=leetcode.cn id=11 lang=cpp
*
* [11] 盛最多水的容器
*/
// @lc code=start
class Solution {
public:
int maxArea(vector<int>& height) {
int maxarea = 0;
int left = 0;
int right = height.size() - 1;
while (left < right)
{
int w = right -left;
i... | ALGO | 0.99998 | 6.893115 |
47330543-190f-45ac-b2ac-a662ed61f3f6 | jugshaurya/recursion-CN | return_subset_sum_equal_to_k_2.cpp | int subsetSumToK(int input[], int n, int startIndex, int output[][50], int k) {
if(startIndex == n) {
if(k == 0) {
output[0][0] = 0;
return 1;
}
else {
return 0;
}
}
int smallOutput1[1000][50], smallOutput2[1000][50];
int size1 = subsetS... | ALGO | 0.999883 | 5.003644 |
92bddccf-5632-45c8-b725-5b19ae6dfc07 | nicholaspcr/CompetitiveProgramming | cf/r664/c.cpp | #include <bits/stdc++.h>
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define all(x) x.begin(), x.end()
using namespace std;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
typedef long long ll;
template <typename T> void max_self(T& a, T b){
a = max(a,b);
}
... | ALGO | 0.999988 | 4.383305 |
1d4fd11c-b42f-4771-af97-176fcb351145 | Lee-clipse/algorithm-repository | Graph/G5_2589.cpp | #include <iostream>
#include <cstring>
#include <queue>
#include <string>
using namespace std;
void a() {int a=0;for(int i=0;i<4000000000;i++)a=i*i;}
const int maxN = 50;
int M, N;
string map[maxN];
bool visited[maxN][maxN];
int cnt[maxN][maxN];
int treasureMap[maxN][maxN];
int dx[4] = {0, 1, 0, -1};
int dy[4] = {... | ALGO | 0.999688 | 3.579352 |
553a67ec-1da9-45cd-ab14-e87a66e9ed34 | enriconi/beecrowd | 1245.cpp | #include <iostream>
#include <cstring>
using namespace std;
int main()
{
int n;
while (cin >> n) {
int num, aux = 0;
char c;
int shoes[61];
memset(shoes, 0, sizeof(shoes));
for (int i = 0; i < n; i++) {
cin >> num >> c;
if (c == 'D') {
if (shoes[num] < 0) aux++... | ALGO | 0.994376 | 3.561126 |
3f39c944-1029-4514-88ca-b848e1c4bc06 | paokakis/eclipse-pc | sources/Box2D/Collision/b2CollideCircle.cpp | #include "b2Collision.h"
#include "Shapes/b2CircleShape.h"
#include "Shapes/b2PolygonShape.h"
void b2CollideCircles(
b2Manifold* manifold,
const b2CircleShape* circleA, const b2Transform& xfA,
const b2CircleShape* circleB, const b2Transform& xfB)
{
manifold->pointCount = 0;
b2Vec2 pA = b2Mul(xfA, circleA->m_p);
... | ALGO | 0.998271 | 7.710979 |
0eaa54b2-8ab6-498b-8647-1170f903bce5 | necuro/Prata | chapter7/task2/task2.cpp | #include <iostream>
#include <string>
using std::cin;
using std::cout;
using std::endl;
using std::string;
int main(void)
{
const int SIZE = 10;
double arr[SIZE];
double middle = 0;
double tmp = 0;
int i = 0;
for( i; i != SIZE; i++ )
{
cout << "Enter value " << i + 1 << ": ";
cin >> ... | ALGO | 0.994965 | 3.447516 |
2cbfefb3-ea57-4d73-9fce-d3f3508a557f | gaolingshan/leetcode | Rotate List/Source.cpp | // Rotate List
// Author: flashhack
// Update: 2014-12-16
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
using namespace std;
/**
* Definition for singly... | ALGO | 0.999964 | 4.781912 |
51f804e4-83ee-4fcf-bd28-0200d92aea59 | SimeonHristov99/aoc_2021 | day14/extended_polymerization.cpp | #include <iostream>
#include <fstream>
#include <vector>
const int SIZE = 26;
#if 0
const char *FILENAME = "sample.txt";
#else
const char *FILENAME = "input.txt";
#endif
void init_grid(long grid[][SIZE])
{
for (int i = 0; i < SIZE; ++i)
{
for (int j = 0; j < SIZE; ++j)
{
grid[i][j... | ALGO | 0.999664 | 5.50688 |
1abd3a58-64cd-4ede-bd51-e036f9a89405 | bzz13/timus | 1727/1727.cpp | #include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
using namespace std;
int getDigitSum(int i)
{
auto res = 0;
while(i > 0)
{
res += i % 10;
i /= 10;
}
return res;
}
struct N
{
int v;
int s;
N& operator=(const N& other)
{
v=other.v;
s=other.s;
return *this;
}
};
bool o... | ALGO | 0.999951 | 4.55072 |
25a7b14b-2c74-43ea-86b1-7f463b140f7e | pleumssr/Project8 | Project8/Source.cpp | #include<stdio.h>
int main()
{
int x, i, j;
scanf_s("%d", &x);
for (i = 0; i < x; i++)
{
for (j = 0; j < x; j++)
{
if (i == 0 || i == x - 1 || j == 0 || j == x - 1)
{
printf("*");
}
else printf(" ");
}
printf("\n");
}
return 0;
} | ALGO | 0.99995 | 3.277777 |
86c97031-7774-4f87-a4a0-299a5c38a104 | 0xpye/cp | code/207.readtime.cpp | #include <bits/stdc++.h>
#define FOR(i, a, b) for(int i = (a); i <= (b); i++)
#define FORR(i, a, b) for(int i = (a); i >= (b); i--)
#define maxn 100005
using namespace std;
int n, m;
long long p[maxn], h[maxn];
bool d[maxn];
bool check(long long mid){
int x = 1;
FOR(i, 1, n)
{
if(abs(h[i] - p[x]) > ... | ALGO | 0.999963 | 3.862529 |
54c1c4c5-9bd0-4c33-a2f4-53218e0444e8 | Veda-rathna/CPP | output/Class.cpp | #include<iostream>
using namespace std;
int main(){
int num, i;
cin>>num;
for (i=2;i<=num-1;i++){
if (num%i==0){
cout<<"number is not a prime number";
break;}
if (i== num){
cout<<"The number is a prime number";}
}
return 0;
} | ALGO | 0.999402 | 3.345869 |
eb0ee182-6ae2-4758-ba2c-97a11d89c95f | ILDAR1976/c_core | factorization_integer/factorization_integer.cpp | #include <stdio.h>
#include <math.h>
int main()
{
long long n, d, k;
printf("Enter n:\n");
scanf_s("%lld", &n);
printf("Factorization of integer number:\n");
d = 2; k = 0;
while (d <= n) {
if (n % d == 0) {
printf("%lld ", d);
++k; // number of prime factors
... | ALGO | 0.999622 | 3.893148 |
fcc967ec-c05d-4ac8-b185-751440b30e62 | fransschreuder/qucs_cvs | qucs-core/src/components/devices/triac.cpp | #if HAVE_CONFIG_H
# include <config.h>
#endif
#include "component.h"
#include "device.h"
#include "devstates.h"
#include "triac.h"
#define NODE_A1 0 /* anode 1 */
#define NODE_A2 1 /* anode 2 (cathode) */
#define NODE_GA 2 /* gate */
#define NODE_IN 3 /* internal node */
using namespace device;
// Constructor for t... | TOOL | 0.947734 | 7.482839 |
891607f7-3bff-4692-ae90-3f607d5b5100 | spcl/cppless-clang | llvm/examples/Kaleidoscope/Chapter5/toy.cpp | #include "../include/KaleidoscopeJIT.h"
#include "llvm/ADT/APFloat.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/LLVMCont... | ALGO | 0.913807 | 4.509803 |
c91997bd-e211-4361-93c7-77180cda6373 | Avhad-Shashwat/Standard-Problems | Arrays/WindowSlinding(Naive).cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int arr[]={1,8,30,-5,20,7};
int k=3;
int max_sum=INT_MIN;
for(int i=0;i<6-k+1;i++)
{
int sum=0;
for(int j=0;j<k;j++)
{
sum+=arr[i+j];
}
max_sum=max(sum,max_sum);
}
cout<<max_sum;
}
| ALGO | 0.999636 | 3.851777 |
f1741915-f7cc-44b8-9cd3-15db304e5f23 | Debajyoti-Shit/LeetHub | 1631-path-with-minimum-effort/1631-path-with-minimum-effort.cpp | #define pii pair<int, pair<int,int>>
class Solution {
public:
//Directions (top, right, bottom, left)
const int d4x[4] = {-1,0,1,0}, d4y[4] = {0,1,0,-1};
int minimumEffortPath(vector<vector<int>>& h) {
int n = h.size(), m = h[0].size();
//min-heap
priority_queue <pii, vector<pi... | ALGO | 0.999987 | 5.817273 |
8cdd0b84-b189-49dc-9371-0564c81c31cc | ishandutta2007/codeforces | everule/normal/1637/C.cpp | #include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
using namespace std;
using ll = long long int;
template<typename T>
ostream& operator+(ostream& out, const vector<T> &vec){
for(const auto &x : vec){
out<<x<<" ";
}
out<<"\n";
return out;
}
template<typename T>
ostream& operator*... | ALGO | 0.999885 | 4.718129 |
892a616b-a082-4b0f-af6d-e0396413b91f | nuran-nahadi/code | aloo.cpp | #include<stdio.h>
#include<math.h>
int stringLength(char s[])
{
int i=0;
while (s[i]!='\0')
{
i++;
}
return i;
}
int main()
{
int n;
scanf("%d",&n);
char str[n][100001];
int alpha[n][26]={{}};
for (int i = 0; i < n; i++)
{
scanf("%s ",str[i]);
for (int... | ALGO | 0.999971 | 3.682662 |
5aed221a-f2d1-41d1-a2ee-68bd5d53886a | rocket0l4/codeforces | 2mar.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin >> t;
while (t--)
{
int count, ans = 0;
int n;
cin >> n;
int arr[n];
string a = "MEOW";
string b = "meow";
for (int i = 0; i < n; i++)
{
cin >> arr[i];
... | ALGO | 0.999851 | 3.983564 |
f356161a-07a0-4dfd-aa7a-3ddf73755e2b | V1KR4M0001/Coding-Blocks-Feb-2025 | String 2D Array Assignment/String Compression.cpp | /*
Take as input S, a string. Write a function that does basic string compression. Print the value returned. E.g. for input “aaabbccds” print out a3b2c2d1s1.
Input Format
A single String S
Constraints
1 < = length of String < = 1000
Output Format
The compressed String.
Sample Input
aaabbccds
Sample Output
a3b2c2d1s... | ALGO | 0.999986 | 4.74178 |
2cb6aa38-7f2c-4689-bd8d-373df57dd8bf | tommy1900/Path-Planning-Frenet-Frame-Optimal-Trajectory-Generation-JMT | src/Eigen-3.3/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_colwise.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
int main()
{
Eigen::MatrixXf mat(2,4);
mat << 1, 2, 6, 9,
3, 1, 7, 2;
std::cout << "Column's maximum: " << std::endl
<< mat.colwise().maxCoeff() << std::endl;
}
| ALGO | 0.999423 | 3.779679 |
1ffae186-c04b-4bd7-a81d-7a9d5fd81c3b | ishandutta2007/codeforces | p_b_p_b/normal/1246/C.cpp | #include<bits/stdc++.h>
clock_t t=clock();
namespace my_std{
using namespace std;
#define pii pair<int,int>
#define fir first
#define sec second
#define MP make_pair
#define rep(i,x,y) for (int i=(x);i<=(y);i++)
#define drep(i,x,y) for (int i=(x);i>=(y);i--)
#define go(x) for (int i=head[x];i;i=edge[i].nxt)
#d... | ALGO | 0.999943 | 3.660622 |
5374100f-b8ff-4fd6-82ba-6f880ad2fad8 | ayushh201/DSA2025 | Graph/minTime.cpp | class Solution {
private:
int dfs(int curr,int parent,unordered_map<int,vector<int>> adj,vector<bool>& hasApple){
int time=0;
for(int &child : adj[curr]){
if(child == parent) continue;
int timeFromChild = dfs(child,curr,adj,hasApple);
if(timeFromChild>0 || has... | ALGO | 0.999945 | 5.799238 |
183242a1-bedf-448e-a5eb-ac41047b50c3 | MohitBansal321/dsa-Practise | Graph/Graph Striver/Prim algo MST.cpp | class Solution
{
public:
//Function to find sum of weights of edges of the Minimum Spanning Tree.
int spanningTree(int V, vector<vector<int>> adj[])
{
priority_queue<pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>> pq;
vector<int> vis(V,0);
// {wt,node};
pq.push({0,... | ALGO | 0.999958 | 5.195292 |
4d0e39c6-1750-4c83-b0d6-caa7e61d912d | vss021/365-Day-Coding-Challenge | Day-4/problem2.cpp | #include <iostream>
#include <vector>
#include <unordered_map>
using namespace std;
class Solution {
public:
// Recursive solution without memoization
int numDecodingsRecursiveNoMemo(string& s, int index) {
if (index == s.length()) {
return 1; // Empty string is a valid decoding
}
... | ALGO | 0.99991 | 7.483783 |
3517eb21-90d9-4891-88e1-640f5335023f | YinRuizhe/CS106B | C1-C4/E02.13/E02.13.cpp |
/*
* 模拟原子的半衰期
* 10000个原子,原子每年的衰变的概率为0.5
*/
#include <iostream>
#include "random.h"
using namespace std;
int main()
{
int atomNum = 10000;
int live = 0;
int year = 0;
double probability = 0.3;//死亡概率
//用数组来记录该原子是否存在
bool* arr = new bool[atomNum];
for (int i = 0; i <atomNum; i++)
{
... | ALGO | 0.997857 | 3.743941 |
58c2c512-bfbd-4c8c-b189-434c35484189 | Teoluud/Introduzione-alla-programmazione | lab2/es7.cpp | // funzione ricorsiva per la potenza
#include<iostream>
using namespace std;
int count1 = 0;
int count2 = 0;
int potenza_1(int a, int n) {
if(n==0)
return 1;
int res;
res = a*potenza_1(a, n-1);
::count1++;
return res;
}
int potenza_2(int a, int n) {
if(n==0)
return 1;
int ... | ALGO | 0.999403 | 4.791745 |
15fcbd09-149c-4b79-ae92-22356bb5c0f6 | Icemore/homework | spring_2014/cpp/hw1/main.cpp | #include <iostream>
#include <vector>
#include <string>
#include <limits>
#include <memory.h>
int dx[] = {0, 1, 1, 1, 0, -1, -1, -1};
int dy[] = {-1, -1, 0, 1, 1, 1, 0, -1};
const int rows = 6;
const int cols = 7;
const char marks[] = {'x', 'o'};
const int lookaheadDepth = 5;
const double threshold = 500;
const int m... | ALGO | 0.999039 | 5.232327 |
5f6082b8-03da-4818-b2b3-4a36978c25f8 | srinath-chakravarthy/ligghts | src/fix_template_multiplespheres.cpp | /* -------------------------------------------------------------------------
Thanks to Chris Stoltz (P&G) for providing
a Fortran version of the MC integrator
------------------------------------------------------------------------- */
#include <cmath>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#includ... | ALGO | 0.997018 | 6.827257 |
8213b61e-5bb8-4c52-9999-a54cf8cf5297 | clockzhong/ASUSWRT_RT-AC1200GPlus | release/src/router/APP-IPK/DM-ipk/crypto++/dsa.cpp | // dsa.cpp - written and placed in the public domain by Wei Dai
#include "pch.h"
#ifndef CRYPTOPP_IMPORTS
#include "dsa.h"
#include "nbtheory.h"
NAMESPACE_BEGIN(CryptoPP)
size_t DSAConvertSignatureFormat(byte *buffer, size_t bufferSize, DSASignatureFormat toFormat, const byte *signature, size_t signatureLen, DSASi... | TOOL | 0.85414 | 7.707673 |
00752c33-17e8-4581-8950-b730b54d863d | big-quantum/all_code | competition/school-20240815-contest/T2_teacher.cpp | // #include<bits/stdc++.h>
// using namespace std;
// const int N = 100010, M = 400010;
// int n, m, s;
// int h[N], hs[N], e[M * 2], ne[M * 2], idx; // 邻接表
// int dfn[N], low[N], timestamp;
// int stk[N], top; // 栈
// int id[N], dcc_cnt;
// int dep[N], fa[N][18]; // lca
// int q[N]; // 队列
// void add(int h[], int ... | ALGO | 0.999989 | 4.951298 |
b48df03e-ee52-4b9a-9367-ce1b8b55245d | Murad501/Phitron | Contests/AtCoder/ABC 404/A_Not_Found.cpp | // 03/05/2025 18:00
#include <bits/stdc++.h>
using namespace std;
#define nl '\n'
#define int long long
#define all(x) x.begin(), x.end()
#define ll long long int
#define yes cout << "YES" << '\n'
#define no cout << "NO" << '\n'
#define cyes cout << "Yes" << '\n'
#define cno cout << "No" << '\n'
#define minus cout << -... | ALGO | 0.999972 | 3.892124 |
8495cdf9-5d1c-44bd-9dba-0319597faf7c | monish-1/Codeforces-Practice-Ladder | B_Airport.cpp | #include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define ll long long
#define endl '\n'
#define xx ' '
#define what_is(x) cerr << #x << " is " << x << endl;
#define all(x) (x).begin(), (x).end()
#define f(i, n) for (int i = 0; i < n; i++)
#define w(x) int x;cin >> x;while (x--)
#define fast ios_b... | ALGO | 0.999997 | 3.430252 |
9ec706a1-37ed-4e99-9c06-37814d56ca61 | PutinCoinPUT/putincoinsource | boost_1_58_0/libs/numeric/odeint/examples/molecular_dynamics.cpp | #include <boost/numeric/odeint.hpp>
#include <vector>
#include <iostream>
#include <random>
using namespace boost::numeric::odeint;
using namespace std;
#define tab "\t"
const size_t n1 = 16;
const size_t n2 = 16;
struct md_system
{
static const size_t n = n1 * n2;
typedef std::vector< double > vector_type... | ALGO | 0.999802 | 4.901106 |
f9a8cb2d-7502-4ffc-bf5d-83b4e285d44b | RohitVishwakarma8840/DSA | Queue 2/Reverse_Queue_Gfg.cpp | lass Solution
{
public:
queue<int> rev(queue<int> q)
{
stack<int>st;
while(!q.empty()){
st.push(q.front());
q.pop();
}
while(!st.empty()){
q.push(st.top());
st.pop();
}
... | ALGO | 0.999415 | 5.21565 |
72aba9d0-115c-4109-8214-8c04e7601490 | Denniszhaoo/Cplusplus | 4. Making Decisions/4.4 The if\else Statement/Example 4.8.cpp | #include <iostream>
using namespace std;
int main() {
int number;
cout << "Enter an integer and I will tell you if it is odd or even. ";
cin >> number;
if (number%2==0)
cout << number << " is even.\n";
else
cout << number << " is odd.\n";
}
/*
Enter an integer and I will tell yo... | ALGO | 0.986716 | 3.906154 |
7c1b6a4c-67b8-4939-b46c-769858da3bbf | yeetholmes619/Codeforces | duel/b.cpp | //Author = Anirudh Srikanth (yeetholmes619) [B20CS006]
#include<bits/stdc++.h>
#define curtime chrono::high_resolution_clock::now()
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#define timedif(start,end) chrono::duration_cast<chrono::nanoseconds>(end - start).count()
using namespace st... | ALGO | 0.999948 | 4.12276 |
ed1166ca-07f8-45f0-b982-7f267061e3be | niranjan-2024/cpp-DSA | strings & character arrays/String compression.cpp | class Solution {
public:
int compress(vector<char>& str) {
int i=0;
int ansIndex=0;
while(i<str.size()){
int j=i+1;
while(j<str.size() && str[i]==str[j]){
j++;
}
str[ansIndex++]=str[i];
int count=j-i;
if(count>1){
string s=to_strin... | ALGO | 0.999996 | 6.392311 |
146d7106-7b81-40bc-b8a5-8c8e49aca043 | CandySiX-Testing/frameworks_av | media/libstagefright/codecs/mp3dec/src/pvmp3_crc.cpp | /*
------------------------------------------------------------------------------
PacketVideo Corp.
MP3 Decoder Library
Filename: pvmp3_crc.cpp
Functions:
getbits_crc
calculate_crc
Date: 09/21/2007
------------------------------------------------------------------------------
REVI... | TOOL | 0.999292 | 6.677954 |
0c67edc8-7648-4aa3-98c3-2ed5c34651c4 | PiyushSingh26022004/CPP_LeetCode_Solutions | 2433. Find The Original Array of Prefix Xor.cpp | class Solution {
public:
vector<int> findArray(vector<int>& pref) {
int prev = pref[0];
for (int i = 1; i < pref.size(); i++) {
pref[i] ^= prev;
prev ^= pref[i];
}
return pref;
}
};
| ALGO | 0.999994 | 5.465137 |
d211e042-1adb-4eef-b42d-a0b0de970049 | Eric036/RZ-V2L-FaceRecognition-demo | src/eigen3/doc/examples/Tutorial_ArrayClass_addition.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace Eigen;
using namespace std;
int main()
{
ArrayXXf a(3,3);
ArrayXXf b(3,3);
a << 1,2,3,
4,5,6,
7,8,9;
b << 1,2,3,
1,2,3,
1,2,3;
// Adding two arrays
cout << "a + b = " << endl << a + b << endl << endl;
// Subt... | ALGO | 0.935808 | 3.642258 |
645640c2-45d4-4929-8ac7-680e1087a712 | odwjo/OJ | leetcode_cn_1.cpp | class Solution {
public:
vector<int> twoSum(vector<int>& nums, int target) {
vector<int> vi(nums.size());
std::generate(vi.begin(), vi.end(), [n = 0] () mutable { return n++; });
sort(vi.begin(), vi.end(), [&](int a, int b){ return nums[a] < nums[b]; });
for (size_t i = 0; i != nums... | ALGO | 0.999969 | 6.290773 |
122e2aad-15e2-4069-8eac-7f36684823b3 | Shwet310/LeetCode__Practice | 1460-make-two-arrays-equal-by-reversing-subarrays/1460-make-two-arrays-equal-by-reversing-subarrays.cpp | class Solution {
public:
bool canBeEqual(vector<int>& target, vector<int>& arr) {
vector<int> cnt1(1001);
vector<int> cnt2(1001);
for (int& v : target) {
++cnt1[v];
}
for (int& v : arr) {
++cnt2[v];
}
return cnt1 == cnt2;
}
}; | ALGO | 0.999726 | 5.993339 |
7faedb1b-18f5-401b-95c8-3e24d31f35c3 | 4865sj/HE_kernel | stats/ciphertext/standard deviation/standard_deviation_kernel_test_n2.cpp | #include "openfhe.h"
#include <time.h>
#include <random>
#include <fstream>
#include <chrono>
#include <ctime>
using namespace std;
using namespace lbcrypto;
using namespace chrono;
Ciphertext<lbcrypto::DCRTPolyImpl<bigintdyn::mubintvec<bigintdyn::ubint<unsigned int> > > >
sqrt(Ciphertext<lbcrypto::DCRTPolyImpl<bigin... | ALGO | 0.993117 | 4.676644 |
03c8c188-4974-4684-975c-834d11a974b3 | ishandutta2007/codeforces | .o/normal/911/G.cpp | #include <bits/stdc++.h>
using namespace std;
struct node{
int val;
int lazy[100];
int ss, ee, fan;
int l, r;
node(){}
node(int ss, int ee, int fan){
this->val = 0;
this->ss = ss;
this->ee = ee;
this->fan = fan;
this->l = this->r = -1;
for(int i=0... | ALGO | 0.999992 | 3.922099 |
7a0ec8c8-6361-4217-8e28-2c895cc7e959 | sriramsanthosh/LeetCode | Maximum Weight Node - GFG/maximum-weight-node.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 maxWeightCell(int N, vector<int> Edge)
{
// code here
unordered_map<int, int> m;
int maxi = INT_MIN;
int ans =... | ALGO | 0.999893 | 5.767848 |
515fc2bf-6e41-497e-8f13-394e59482a78 | atakhanow/CPP-algo.ubtuit.uz | 003.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int s,h;
cin >> s >> h;
double a;
a = (2.0 * s) / h;
printf("%.2f", a);
}
| ALGO | 0.968496 | 3.089017 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.