uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
55c3bf1e-661c-434c-8d52-e7156068e78f | nathanielthurston/thesis | TestSearch.cpp | #include "TestSearch.h"
#include "GL2C.h"
#include <vector>
#include <queue>
#include <string>
using namespace std;
extern int g_maxWordLength;
void print(GL2C& m, const char* what) {
Complex center = m.a / m.c;
Complex height = 1.0 / m.c;
printf("%10s%9g+%9gI\t%9g+%9gI\n%10s%9g+%9gI\t%9g+%9gI\n",
what, m.a.rea... | ALGO | 0.999536 | 5.437038 |
21a348a7-1de2-4ddf-beb0-8861415f6b2d | VinayKokate22/DSA | 300625.cpp | class Solution {
public:
int findLHS(vector<int>& nums) {
sort(nums.begin(),nums.end());
int start=0;
int end=0;
int n=nums.size();
int ans=0;
while(end<n){
while(nums[end]-nums[start]>1){
start++;
}
if((nums[en... | ALGO | 0.999958 | 5.822245 |
dbc93c63-9d5c-4a44-8de9-3d733d3178c1 | Jerez4real/Practica_c- | Funciones/plantillas_de_funcion.cpp | /*Plantillas de Funcion
Ejemplo: sacar el valor absoluto de un numero.*/
#include<iostream>
using namespace std;
//Prototipo de Funcion
template <class TIPOD> //prefijo de la plantilla, para usar un tipo de dato en general
void mostarAbs(TIPOD numero); //funcion
int main(){
int num1 = -4;
float num2 = -56.... | TOOL | 0.958967 | 4.590759 |
1878856e-6399-481d-8f75-ee156e4e47a7 | jonijura/cpp | Samples/MeshGeneration2/localts1.cpp | #include "../../GFD/Types/Random.hpp"
#include "../../GFD/Mesh/BuilderMesh.hpp"
#include "../../GFD/Mesh/PartMesh.hpp"
#include "../../GFD/Discrete/Dec.hpp"
#include "../../GFD/Output/MeshDrawer.hpp"
#include <algorithm>
#include <iomanip>
#include <filesystem>
#include <iostream>
#include <chrono>
using namespace std;... | ALGO | 0.99887 | 3.457193 |
0b9f19e7-5809-4e0f-a6d1-3bc18b5988b8 | songjun-wu/1D_hydrological_model | model/Grid/constant_functions.cpp | #include "Basin.h"
double Basin::getSatVaporPressure(const double &T){ // T in C and e in Pa
return 611 * expl((17.3 * (T-273.15))/(T +0.15 ));
}
double Basin::Calculate_beta(const double &theta, const double &fieldcap){
double beta;
beta = (theta >= fieldcap) ? 1.0 : 0.25*powl( 1 - cos( theta * PI / fieldcap ) ,... | ALGO | 0.989376 | 5.251596 |
84f41694-03f2-4cd2-acb1-8e041b6fcff9 | Swapnil-008/DynamicProgramming | ClimbingStairs.cpp | #include <iostream>
#include <vector>
using namespace std;
int climbStairsDP(int n)
{
if (n <= 2)
{
return n;
}
vector<int> dp(n + 1, 0);
dp[1] = 1;
dp[2] = 2;
for (int i = 3; i <= n; i++)
{
dp[i] = dp[i - 1] + dp[i - 2];
}
return dp[n];
}
int climbStairsMemoiza... | ALGO | 0.99997 | 5.394756 |
1612fe0e-252d-476d-8975-be018ed6181a | PakinDioxide/TOI-zero | A3/A3-021.cpp | /*
author : PakinDioxide
created : 02/04/2025 17:51
task : A3-021
*/
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main() {
ios::sync_with_stdio(0), cin.tie(0);
int n, k;
cin >> n >> k;
ll a[n];
for (auto &e : a) cin >> e;
sort(a, a+n);
ll x = k*a[0... | ALGO | 0.999953 | 3.898402 |
cc494d3f-be50-42fd-aab1-849a7e4ab67c | francisconassif/MAC0214---Extracurricular-Activities-2024.2- | Assuntos/Guloso/incendioflorestal.cpp | #include <bits/stdc++.h>
using namespace std;
#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
#define f first
#define s second
#define pb push_back
#define dbg(x) cout << #x << " = " << x << endl
#define FOR(i, a, n) for(ll i = a; i < n; i++)
#define int long long
typedef long long ll;
typedef ... | ALGO | 0.999989 | 3.571223 |
126bcfc5-a556-43b6-ad2d-222dbc60fc63 | Runarok/GeeksForGeeks-solutions | Difficulty: Easy/Decreasing Sequence/decreasing-sequence.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
int minMoves(vector<int>& arr, int k) {
// Initialize the answer to track the minimum moves
long _answer = 0;
// Traverse through the array to process each pair of adjacen... | ALGO | 0.999703 | 6.135108 |
0cc9ead4-4a31-4395-b459-2e44efdb7f67 | syoh0708/algorithm | baekjoon/silver/3/15988(1, 2, 3 더하기 3)/15988.cpp | #include <iostream>
using namespace std;
long long a[1000001];
int main(void) {
int t;
cin >> t;
a[1] = 1;
a[2] = 2;
a[3] = 4;
for (int i = 4; i <= 1000000; i++) {
a[i] = (a[i-1] + a[i-2] + a[i-3]) % 1000000009LL;
}
while (t--) {
int n;
cin >> n;
c... | ALGO | 0.99976 | 4.077871 |
a80da06a-87d6-467c-b63a-023800988e32 | fyzel527/UnrealEngine-4.24Toon | Engine/Source/ThirdParty/PhysX3/PhysX_3.4/Source/GeomUtils/src/convex/GuConvexHelper.cpp | #include "GuConvexHelper.h"
#include "GuGeometryUnion.h"
#include "GuInternal.h"
#include "PsUtilities.h"
using namespace physx;
using namespace Gu;
// PT: we can't call alloca in a function and we want to avoid defines or duplicating the code. This makes it a bit tricky to write.
void Gu::getScaledConvex( PxVec3*& s... | ALGO | 0.993724 | 7.730185 |
b59a4359-2ec5-467b-ac28-1db6be733a7a | Masa-kuchii/V2V | src/netbuild/NBEdgeCont.cpp | /****************************************************************************/
/****************************************************************************/
/****************************************************************************/
/// @file NBEdgeCont.cpp
/// @author Daniel Krajzewicz
/// @author Jakob Erdma... | TOOL | 0.982905 | 6.313345 |
9f9c4616-3621-4028-97f9-24cfc392aa3d | KraitOPP/Codeforces | B_Zero_Array.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl "\n"
#define inp(a,n) for(int i=0;i<n;i++) cin>>a[i];
#define vi vector<int>
#define ll long long
const int inf = 1e18,mod=1e9+7;
signed main(){
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n;
cin>>... | ALGO | 0.999858 | 4.204209 |
eb2f8da0-ebce-45f3-9ecb-f073dcecd0d4 | Yashmenaria1/Leetcode_daily_solutions | 552. Student Attendance Record II.cpp | class Solution {
public:
int checkRecord(int n) {
vector<vector<vector<int>>> dp(n+1, vector<vector<int>>(2, vector<int>(3, 0)));
dp[0][0][0] = 1;
const int MOD = 1e9 + 7;
for (int i = 0; i < n; ++i) {
for (int A = 0; A < 2; ++A) {
for (int L = 0; L < 3; ++L) {
... | ALGO | 0.999941 | 5.374242 |
cd022fc9-4fdd-43b3-aed7-79cc2fc52757 | biyotte/Code_of_gunwookim | BOJ_solve/10047.cpp | #include <bits/stdc++.h>
#define x first
#define y second
#define pb push_back
#define all(v) v.begin(),v.end()
#pragma gcc optimize("O3")
#pragma gcc optimize("Ofast")
#pragma gcc optimize("unroll-loops")
using namespace std;
const int INF = 1e9;
const long long llINF = 1e18;
const int mod = 998244353;
typedef long l... | ALGO | 0.999973 | 3.86924 |
3098fddc-7ada-4a3a-b564-1c072c3efcd1 | gabrielforster/data-structure-catolica | 02-class/exe_13.cpp | #include <iostream>
using namespace std;
int main () {
int x, result = 1;
cout << "Type a interger number: ";
cin >> x;
for (int i = 1; i <= x; i++) {
result*= i;
}
cout << "The factorial of " << x << " is: " << result << endl;
return 0;
}
| ALGO | 0.996051 | 4.279311 |
bbcc01e7-9025-4172-9e77-8569f59e3ee4 | iamwkatie/caffe-posenet | examples/cpp_classification/classification.cpp | #include <caffe/caffe.hpp>
#ifdef USE_OPENCV
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#endif // USE_OPENCV
#include <algorithm>
#include <iosfwd>
#include <memory>
#include <string>
#include <utility>
#include <vector>
#ifdef USE_OPENCV
using names... | DATA | 0.96077 | 7.697945 |
db78cb36-1b84-436e-870d-3ac21da424e0 | RakibulRanak/Solved-ACM-problems | hackerRank/Picking Numbers.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n,t;
cin>>n;
map<int,int>m;
for(int i=0;i<n;i++)
{
cin>>t;
m[t]++;
}
int sum=0;
for(int i=2;i<=100;i++)
{
if(m[i]+m[i-1]>sum)
sum=m[i]+m[i-1];
}
cout<<sum<<endl;
return 0;
}... | ALGO | 0.999689 | 3.356213 |
b7be7411-0eb1-4568-a699-95b4ce5814b6 | ROCm-Developer-Tools/llvm-project | llvm/lib/CodeGen/RegAllocBasic.cpp | #include "AllocationOrder.h"
#include "LiveDebugVariables.h"
#include "RegAllocBase.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/CodeGen/CalcSpillWeights.h"
#include "llvm/CodeGen/LiveIntervals.h"
#include "llvm/CodeGen/LiveRangeEdit.h"
#include "llvm/CodeGen/LiveRegMatrix.h"
#include "llvm/CodeGen/LiveSt... | ALGO | 0.940324 | 7.852623 |
17333cc1-9888-43b7-a6c4-2d19d048cef6 | 192211003/CSA0406-OS | CSA0406-OS day 1/7.non-preemptive SJF algorithm..cpp | #include <stdio.h>
typedef struct {
int process_id;
int arrival_time;
int burst_time;
} Process;
void sjf(Process processes[], int n) {
int waiting_time[n], turnaround_time[n];
for (int i = 0; i < n; i++) {
waiting_time[i] = 0;
turnaround_time[i] = 0;
}
for (int i = 0; i ... | ALGO | 0.999984 | 4.113202 |
0a6083d8-27cb-486c-a137-302f1f1bee03 | qpwoeirut/competitive-programming | LexingtonInformaticsTournament/2020/Standard/fishy.cpp | #include <iostream>
#include <iomanip>
#include <fstream>
#include <vector>
#include <array>
#include <algorithm>
#include <utility>
#include <map>
#include <queue>
#include <set>
#include <cmath>
#include <cstdio>
#include <cstring>
#define ll long long
#define ld long double
#define eps 1e-8
#define MOD 1000000007
... | ALGO | 0.999303 | 4.173018 |
5f52460a-18dd-4fb2-92f4-1dc4504cb68d | UpanshuSharmaUNSW/Parareal-algorithm | Harmonic potential in 1d/main.cpp | #include"algorithm.hpp"
int main(void)
{
// srand(time(NULL));
//srand48(1);
// cerr<<RAND_MAX;
gaussien g;
input I;
I.load();
// initial conditions for the particle are drawn from N(0,1/beta) with beta=3 (see burn-in code with seed 120)
particle X0(I);
X0.q = -0.386593;
X0... | ALGO | 0.998059 | 3.019282 |
4a8c92a4-060f-4cdd-9e01-2270fecaaf3e | PhoenixAthens/DataStructures-Essentials | DataStructures-Essentials/CodeForces/Tram.cpp | #include <iostream>
using std::cout;
using std::cin;
using std::max;
int main(){
int n;
cin >> n;
int maxC{INT_MIN};
int running{0};
int exit,enter;
while(n--){
cin >> exit >> enter;
running-=exit;
running+=enter;
maxC=max(maxC,running);
}
cout << maxC << ... | ALGO | 0.999816 | 3.837601 |
a9046b6f-4741-4bd8-aaa2-7f991f36f46f | justdotheg/Algorithm | 알고리즘/프로그래머스/Level2/프린터/복습.cpp | #include <string>
#include <vector>
#include <utility>
#include <iostream>
#include <algorithm>
using namespace std;
int getMaxIdx(vector<pair <int, int>>& vp){
int max = 0; int idx = 0;
for(int i=0;i<vp.size();i++){
if(vp[i].first > max){
max = vp[i].first;
idx = vp[i].second;... | ALGO | 0.99986 | 5.435834 |
37b67713-4806-407a-804f-dde343501bc6 | jackbdu/nature-of-code-2024-openframeworks | chapter9/Example_9_3_Smarter_Rockets/src/Population.cpp | #include "Population.h"
void Population::setup(float _mutationRate, int length, int lifeSpan) {
mutationRate = _mutationRate;
generations = 0;
for (int i = 0; i < length; ++i) {
shared_ptr<DNA> dna = make_shared<DNA>();
dna->setup(lifeSpan);
Rocket rocket;
rocket.setup(320, 220, dna);
popula... | ALGO | 0.98863 | 5.392331 |
0069bc6e-d797-4077-913a-57acba74eb02 | dubey1akash/Data-Structure-and-Algorithm | Find Pivot Index.cpp | class Solution {
public:
int pivotIndex(vector<int>& nums) {
int n = nums.size();
int sum = 0;
for(auto &x : nums){
sum+=x;
}
int cs = 0;
for(int i=0; i<n; i++){
int ls = cs;
int rs = sum-cs-nums[i];
if(ls == rs){
... | ALGO | 0.999914 | 6.140974 |
b9f4c5fd-ab8e-4934-a4a2-48b56c0101fe | CunZy/codetree-TILs | 250704/짝수만 2로 나누기/divide-even-numbers-by-2.cpp | #include <iostream>
using namespace std;
int n;
int arr[50];
void doing(int x[]) {
for(int i = 0; i < n; ++i) {
if(x[i] % 2 == 0) {
x[i] /= 2;
}
}
}
int main() {
cin >> n;
for (int i = 0; i < n; i++) {
cin >> arr[i];
}
// Please write your code here.
... | ALGO | 0.999968 | 4.855281 |
d321351f-2d1e-43a0-9e9e-9396c997e193 | gaurav9926/Codeforces-2023 | problemset/1860B.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin >> t;
while (t--)
{
long m, k, a1, ak;
cin >> m >> k >> a1 >> ak;
long Mrem = 0, akrem = 0, ans = 0;
// give all ak
if ((m / k) >= ak)
{
Mrem = m - (k)*ak;
ak = ... | ALGO | 0.999571 | 3.026293 |
d1f48f9e-e0e4-48db-9d1b-c3d7bc1f5f12 | MrCostinha/FUP | Lista 2/3.cpp | /*3. Faça uma função que receba como parâmetro 3 números inteiros e retorne o MMC (Mínimo Múltiplo
Comum) deles.*/
#include <iostream>
#include <clocale>
#include <cwchar>
using namespace std;
int mdc(int n1, int n2, int n3) {
for (int i = 1; i <= n1 && i <= n2 && i <= n3; i++) {
if (n1%i == 0 && n2%i == ... | ALGO | 0.990292 | 5.01414 |
7fc831d5-5175-4730-ab4e-7b801138e57e | RandyKwoun/CodeChef-Randy-Kwoun | Begginer_Level/Chef_On_Date_Folder/Chef_On_Date.cpp | #include <iostream>
using namespace std;
int main(void)
{
int iT;
cin >> iT;
while(iT--)
{
int iMoney, iBill;
cin >> iMoney >> iBill;
if(iMoney >= iBill)
cout << "YES" << endl;
else
cout << "NO" << endl;
}
return 0;
} | ALGO | 0.998923 | 4.248464 |
ece003fe-ef3d-400f-b8a9-72b71764c410 | Ashishmangal06/FaceMaskDatasetMLAIProject | opencv-master/opencv-master/samples/cpp/tutorial_code/features2D/Homography/homography_from_camera_displacement.cpp | #include <iostream>
#include <opencv2/core.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/calib3d.hpp>
using namespace std;
using namespace cv;
namespace
{
enum Pattern { CHESSBOARD, CIRCLES_GRID, ASYMMETRIC_CIRCLES_GRID };
void calcChessboardCorners(Size boardSize, float square... | ALGO | 0.999067 | 4.185647 |
51a18138-6744-49d6-9fe5-da000b466912 | Sourav61/Leetcode-Practice | 90-subsets-ii/90-subsets-ii.cpp | class Solution {
private:
void findCombi(int ind,vector<int> &nums,vector<int> &ds,vector<vector<int>> &ans){
ans.push_back(ds);
for(int i=ind;i<nums.size();i++){
if(i!=ind && nums[i] == nums[i-1])
continue;
ds.push_back(nums[i]);
findComb... | ALGO | 0.999961 | 6.02766 |
d00ed073-29b6-4285-8ed4-132ebb01cf8b | RobertLuo1/iccv2023_RVOS_Challenge | UNINEXT/detectron2/layers/csrc/nms_rotated/nms_rotated_cpu.cpp | namespace detectron2 {
template <typename scalar_t>
at::Tensor nms_rotated_cpu_kernel(
const at::Tensor& dets,
const at::Tensor& scores,
const double iou_threshold) {
// nms_rotated_cpu_kernel is modified from torchvision's nms_cpu_kernel,
// however, the code in this function is much shorter because
... | ALGO | 0.996126 | 7.662067 |
3e4f82a8-1dee-49bb-8d42-a66a085a3f0d | HeloisaJ/Competitive_Programming_Questions_Solved | spoj/ELEVTRBL.cpp | #include<bits/stdc++.h>
using namespace std;
vector<bool> visited;
long f, s, g, u, d, quant;
bool possivel;
void calculo(long andarAtual){
if(visited[andarAtual]){
possivel = false;
return;
}
visited[andarAtual] = true;
if(andarAtual == g){
possivel = true;
}
else if(a... | ALGO | 0.99949 | 3.794182 |
07814bc9-39b5-4588-a3b4-9d31ca018728 | usbport11/PhysicLevelMapFog | classes/system/Random.cpp | #include "Random.h"
unsigned int RandomChance(unsigned int n) {
//chance = (100 / n) %
if(n <= 1) return 1;
return (rand() % n > n - 2);
}
int RandomValue(int Min, int Max) {
if(Min > Max) return 0;
if(Min == Max) return Min;
return rand() % (Max - Min + 1) + Min;
}
| ALGO | 0.93622 | 3.888103 |
1a812f0e-d04d-4ccd-8287-94b72366c902 | ABILLEST/my-code-learning | C++/c++程序设计教程/TV+Remote.cpp | #include <iostream>
#include <string>
using namespace std;
class Television
{
int volume,mode,channel;
static int TVcount,DVDcount;
public:
Television(){volume=50;mode=1;TVcount++;}
void print();
static int getTVcount(){return TVcount;}
static int getDVDcount(){return DVDcount;}
int getMode(){return mode;}
int... | ALGO | 0.992052 | 3.801711 |
d4232cca-9c4d-465d-aaa1-74a8e41eece4 | princeofcrows/--cp | contest/hackercup/2023/round1/B_1_Sum_41_Chapter_1.cpp | #include <bits/stdc++.h>
using namespace std;
// Data type
#define int long long
#define ll long long
#define pii pair<int, int>
#define piii pair<int, pii>
#define vi vector<int>
#define vll vector<long long>
#define vpi vector<pii>
#define mii map<int, int>
#define msi map<string, int>
#define si set<int>
#define s... | ALGO | 0.999521 | 4.640313 |
6b7c54ac-033b-41ac-9350-5e600f7cfb70 | NadineAB/SPH-ISP-WCSPH | damBreak/customOutput.cpp | #include "customOutput.h"
#include "sph.h"
#include "misc.impl.h"
#include "dataLL.impl.h"
using namespace Nsph;
inline void calcEnstrophyAndAveDens(Cparticle &p,CglobalVars &g) {
g.custom[0] += 0.5*p.mass*pow(p.vort[0],2)/p.dens;
g.custom[1] += p.mass*dot(p.vhat,p.fv)/p.dens;
g.custom[2] += p.mass*dot(p.vha... | ALGO | 0.995181 | 4.735351 |
1f1d636a-1057-4f78-a46c-e6240082f42a | XateroX/pokerogue_with_random | 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 |
cd0bb644-1615-4bba-a493-4f874cb46325 | Hoang-DH/CPP_PTIT | CODE_PTIT_ENG/EP05003_UNIQUE_NUMBER_IN_A_FILE.cpp | #include <iostream>
#include <iomanip>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string>
#include <set>
#include <fstream>
using namespace std;
typedef long long ll;
typedef double db;
const long long mod = 1e9 + 7;
#define fastread() (ios_base:: sync_with_stdio(false),cin.tie(NULL));
int main... | ALGO | 0.999891 | 3.466226 |
b7ea744d-2e5a-4507-8c69-456920d5c7b4 | sharmakavya7/Codeforces_solutions | A_I_Wanna_Be_the_Guy.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <string>
#include <map>
#include <climits>
#include <iterator>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <utility>
#include <deque>
#include <que... | ALGO | 0.99983 | 3.509783 |
a07ca96e-aed3-43ec-93bd-216f8244fbf0 | suzumiyayuhi/LeetCodeTrain | 随便做/回溯/N 皇后 II.cpp | class Solution {
public:
int totalNQueens(int n)
{
int res = 0;
vector<vector<int>> board(n, vector<int>(n, 0));
sub(board, 0, res);
return res;
}
void sub(vector<vector<int>> &board, int cur, int &res)
{
if(cur == board.size())
{
res++... | ALGO | 0.999951 | 6.624617 |
7bf20309-3b3a-4f18-97c1-de884889ed26 | Cooper4111/Project-Euler | EU1.cpp | #include <cstdio>
#include <fstream>
#include <string>
#include <iostream>
using namespace std;
/*
If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
Find the sum of all the multiples of 3 or 5 below 1000.*/
/* BASIC SOLUTION*/
int multi(... | ALGO | 0.99967 | 4.310238 |
9aee632c-5051-4c0e-afc2-c5d3dbd8859d | satyajit-patel/rev | 15_implementation/900/B. Sale.cpp | #include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl "\n"
#define vi vector<int>
#define vvi vector<vector<int>>
// -----------------------------------------------------
void solve() {
int n, m; cin>>n>>m;
vi a(n);
for(auto& it: a) {cin>>it;}
int maxSum = INT_MIN;
i... | ALGO | 0.99998 | 4.701806 |
a2c26f29-7497-4965-a38b-c322aeff040c | ishandutta2007/codeforces | ikatanic/normal/741/E.cpp | #include <algorithm>
#include <cassert>
#include <cstring>
#include <iostream>
#include <functional>
using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define TRACE(x) cout << #x << " = " << x << endl
#define _ << " _ " <<
typedef long long llint;
const int MAX... | ALGO | 0.999968 | 3.673873 |
709b66e1-1a0b-4a71-8eb8-fce5651d163f | tin10401/CodeForces | E_Stack_Sorting.cpp | //████████╗██╗███╗░░██╗██╗░░░░░███████╗
//╚══██╔══╝██║████╗░██║██║░░░░░██╔════╝
//░░░██║░░░██║██╔██╗██║██║░░░░░█████╗░░
//░░░██║░░░██║██║╚████║██║░░░░░██╔══╝░░
//░░░██║░░░██║██║░╚███║███████╗███████╗
//░░░╚═╝░░░╚═╝╚═╝░░╚══╝╚══════╝╚══════╝
// __________________
// | ________________ |
// || ____ ||
// ||... | ALGO | 0.999956 | 3.904324 |
592bda2d-8f24-44ba-85d4-d22ef04a3541 | zhaomengjiao123/LeetCode | L30.cpp | // 串联所有单词的子串
#include<iostream>
#include<algorithm>
#include<vector>
#include<sstream>
#include<unordered_set>
#include<unordered_map>
using namespace std;
// 我的思路是吧words存储起来,然后从 s截取等长字符串检查
vector<int> findSubstring(string s, vector<string>& words) {
// 先存储words
int m = words.size();
int n = words[0].size... | ALGO | 0.999652 | 4.167987 |
b52f74ac-6d0a-43b2-a61a-a28a49a0d484 | jainhardik120/CodeX | CPP/StackReverse.cpp | #include <iostream>
#include <stack>
using namespace std;
void insertAtBottom(stack<int> &st, int ele)
{
if (st.empty())
{
st.push(ele);
return;
}
int topele = st.top();
st.pop();
insertAtBottom(st, ele);
st.push(topele);
}
void reverse(stack<int> &st)
{
if (st.empty())... | ALGO | 0.999956 | 4.769747 |
e22c8f27-50bb-43e1-9d4e-a1dc7f1e5dcc | aw-junaid/Computer-Science | Programming Fundamentals/Cplusplus/C-Plus-Plus-Algorithms/hashing/sha1.cpp | /**
* @file
* @author [tGautot](https://github.com/tGautot)
* @brief Simple C++ implementation of the [SHA-1 Hashing
* Algorithm](https://en.wikipedia.org/wiki/SHA-1)
*
* @details
* [SHA-1](https://en.wikipedia.org/wiki/SHA-1) is a cryptographic hash function
* that was developped by the
* [NSA](https://en.wik... | ALGO | 0.999591 | 7.43846 |
50b461f0-bd53-4014-8d1f-ac88984ee209 | raincross7/code-similarity | codes/train_code/problem010/problem010_53.cpp | #pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,... | ALGO | 0.999983 | 3.799358 |
02df1012-8276-49d9-99a7-7281ea6346d3 | ishandutta2007/codeforces | arayi/normal/1428/F.cpp | //Arayi
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <math.h>
#include <vector>
#include <cstring>
#include <ctime>
#include <set>
#include <bitset>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <iomanip... | ALGO | 0.999972 | 4.063956 |
53f031b3-2035-4fdc-8377-cb95b94997a4 | ishandutta2007/codeforces | heart_blue/normal/412/B.cpp | #include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#incl... | ALGO | 0.999989 | 3.302321 |
99be20d1-b8b1-441f-8ea7-41cb49bbbd56 | thomaslee0131/competitive-programming | inteception.cpp | #include<iostream>
using namespace std;
int main(){
int t;
cin>>t;
for(int I=1;I<=t;I++){
int n;
cin>>n;
for(int J=0;J<n+1;J++){
int p;
cin>>p;
}
if(n%2==0){
cout<<"Case #"<<I<<": "<<0<<endl;
}
else{
cout... | ALGO | 0.997767 | 3.113105 |
e696ab1d-d1bb-4796-b74f-8aac0e7d1b70 | utkarsh-gith/Leetcode | LeetCodeProblems-CPP/2466. Count Ways To Build Good Strings.cpp | class Solution
{
public:
const int mod = 1000000007;
int countWays(vector<int> &dp, int len, int zero, int one)
{
if (len == 0)
{
return 1;
}
if (len < 0)
{
return 0;
}
if (dp[len] != -1)
{
return dp[len];
... | ALGO | 0.999923 | 5.381936 |
da6fbf4d-77d6-4e4f-878b-3672292cadb8 | mdshadesh/-LightOJ-Problem-Solutions | 1053.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int C;
cin>>C;
int i=1;
while(C--){
vector<int> x;
for(int j=0;j<3;j++)
{
int y;
cin>>y;
x.push_back(y);
}
sort(x.begin(),x.end());
if(x[0]+x[1]>x[2])
{
... | ALGO | 0.999704 | 4.058421 |
d7ca4f6b-3f61-4dca-a931-7913ae8e2843 | BakrN/vortex | sim/simx/execute.cpp | #include <iostream>
#include <stdlib.h>
#include <unistd.h>
#include <math.h>
#include <bitset>
#include <climits>
#include <sys/types.h>
#include <sys/stat.h>
#include <assert.h>
#include <util.h>
#include <rvfloats.h>
#include "warp.h"
#include "instr.h"
#include "core.h"
#include "tensor_core.h"
using namespace vor... | ALGO | 0.975003 | 4.549868 |
0af6d538-ef22-442b-9637-f8309a0368fa | Gayane05/CodeSignal_2021 | Largest Number.cpp | #include <iostream>
//Given an integer n, return the largest number that contains exactly n digits.
//
//Example
//
//For n = 2, the output should be
//largestNumber(n) = 99.
int largestNumber(int n)
{
int number = 0;
while (n > 0)
{
number += 9 * pow(10, n - 1);
--n;
}
return number;
}
// NBYM
//int large... | ALGO | 0.999556 | 6.581302 |
14904ece-ba7f-4e37-b37c-abe7f60ec249 | Beisenbek/kbtu-2018-fall-lecture-samples | pp1/Friday/week7/107_3.cpp | #include <iostream>
#include <sstream>
using namespace std;
int main(){
stringstream ss;
string t, line;
string best = "";
getline(cin, line);
ss << line;
while(ss >> t){
if(best.size() < t.size()){
best = t;
}
}
cout << best.size() << endl;
cout << ... | ALGO | 0.999448 | 3.834187 |
f5daf80c-8741-44fd-988b-78b26a660ae3 | radoslawniewiadomski/Fondamenti2023-2024 | lezioni/E27/main.cpp | #include <iostream>
using namespace std;
//funzione aggiunge 1 ad ogni elemento di //un array
void add1(int* a, int size)
{
//void add1(int a [], int size) {
for (int* pi=a; pi<a+size; pi++)
(*pi)+=1;
}
int main()
{
int s[] = {1,2,3,4,5};
add1(s,5);
for (int i=0; i<5; i++)
cout << s... | TOOL | 0.981443 | 3.680556 |
e24efe2b-a6d4-4261-926f-19860b775ff2 | Gkbinqi/CS106L | lecture-code/lecture09/main.cpp | #include <iostream>
#include <type_traits>
#include <unordered_set>
#include <vector>
#include "utils.hpp"
/* ========================================================================= *
* Template Functions: *
* Min function ... | TEST | 0.96021 | 7.080908 |
17fdf09e-a1c8-40c3-8e38-7cb72e225dc4 | komalshinde-dev/DataStructures_Lab_SEM3 | randomization/drunkards_walk.cpp | #include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
const int row=50;
const int col=50;
int Tile[row][col];
void display_tiles(int M,int N)
{
int m=M,n=N,i=0,j=0;
cout<<"\n\nTiles to walk are-\n\n\n";
for(i=0;i<m;i++)
{
for(int k=0;k<n;k++)
{
cout<<" ___";
}
cout<<endl;
f... | ALGO | 0.999508 | 4.861156 |
737d98bb-85f0-41eb-b359-055d5d71df3f | profornnan/Problem-Solving | BOJ/슬라이딩 윈도우/20437-문자열 게임 2.cpp | #include <iostream>
#include <algorithm>
#include <string>
using namespace std;
constexpr int INF = 987654321;
int main(void) {
cin.tie(nullptr)->sync_with_stdio(false);
int T;
cin >> T;
while (T--) {
string str;
int K;
cin >> str >> K;
int minLen = INF;
int maxLen = -1;
for (char ch = 'a'; ch <=... | ALGO | 0.999676 | 5.025169 |
ac285ad9-f7b1-4726-bd16-a49d1a316e32 | davefol/c-punts | codeforces/1646/b.cpp | #include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>
using namespace std;
void solve(int n, vector<int> ar) {
sort(ar.begin(), ar.end());
int sum_blue = ar[0];
int sum_red = ar[n-1];
int blue_index = 0;
int red_index = n-1;
int blue_count = 1;
int red_count = 1;
... | ALGO | 0.999985 | 4.536499 |
608b64b0-e049-4f15-939c-386db20b0d2e | shivanibhat24/CPP-Programs | Leetcode Programs/shortestcommonsupersequence.cpp | #define LC_HACK
#ifdef LC_HACK
const auto __ = []() {
struct ___ {
static void _() { std::ofstream("display_runtime.txt") << 0 << '\n'; }
};
std::atexit(&___::_);
return 0;
}();
#endif
class Solution {
public:
string shortestCommonSupersequence(string const& str1, string const& str2) {
... | ALGO | 0.999987 | 6.069757 |
011268e6-861f-4ba8-affc-b9b453b6dbbc | praveen12kumar/Data-Structures | 05 arrays/striver/print_subarray_with_max_sum.cpp | /*
Given an array arr[], the task is to print the subarray having maximum sum.
Examples:
Input: arr[] = {2, 3, -8, 7, -1, 2, 3}
Output: 11
Explanation: The subarray {7, -1, 2, 3} has the largest sum 11.
*/
#include<bits/stdc++.h>
using namespace std;
vector<int> maximumsumSubarray(vector<int> &arr)
{
//Write your... | ALGO | 0.99994 | 5.42594 |
4a0abaa7-230f-4476-96d5-e1f82d9f8717 | sparsh2002/Placement-Course-cpp | codeforces/strings/13_Letter.cpp | #include<bits/stdc++.h>
#include<unordered_map>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vii;
typedef vector<ll> vl;
typedef vector<vl> vvl;
#define rep(i,a,b) for(int i=a ; i<b ; i++)
long long... | ALGO | 0.999985 | 3.574404 |
4187555a-94c9-4eb8-a227-01d80e9ec061 | Aryanlanghanoja/NBS_2025 | 28-08-2025/Aryan_Langhanoja/first_last.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution
{
private:
int Insert_Position(vector<int> &arr, int target, bool search)
{
int left = 0;
int right = arr.size() - 1;
int idx = -1;
while (left <= right)
{
int mid = left + (right - left) / 2;
... | ALGO | 0.999985 | 6.137037 |
fb705fa0-10ba-4714-ae3e-bd4959ca9274 | PrasadB2003/oops | dsa/dsareal/stl vector.cpp | #include<iostream>
#include<list>
using namespace std;
// list
void display(list<int> &lst){
list<int> ::iterator it;
for(it=lst.begin();it != lst.end();it++){
cout<<*it<<" "<<endl;
}
}
int main(){
list<int> list1;
list1.push_back(1);
list1.push_back(2);
list1.push_back(3);
list1.push_back(4);
list... | TOOL | 0.982632 | 3.094191 |
71b10cab-a6e0-4643-bf2f-b72ee2092831 | abhisingh2244/leetcode | 326-power-of-three/326-power-of-three.cpp | class Solution {
public:
bool isPowerOfThree(int n) {
double val = (log10(n)/log10(3));
if(val == floor(val) && val != -1.0 / 0.0){
return true;
}
return false;
}
}; | ALGO | 0.998782 | 5.806555 |
63a8fe95-fbdf-4be3-9ca1-f8a739f65aa4 | Xeomuz/Doom-Port-Source-Code | Zandronum/dumb/src/it/filter.cpp | #if defined(_DEBUG) && defined(_MSC_VER)
#include <crtdbg.h>
#endif
#if defined(_M_IX86) || defined(_M_X64) || defined(__i386__) || defined(__amd64__)
#ifdef _MSC_VER
#include <intrin.h>
#endif
#include <xmmintrin.h>
#define HAVE_SSE_VERSION 1
#endif
#include <math.h>
#include "dumb.h"
extern "C" {
#include "interna... | ALGO | 0.897073 | 3.513681 |
0539cff3-b6c9-49d3-9b72-6f81c7dbed6f | 5hawon/Competitive_Programming | F_Gardening_Friends.cpp | #include <bits/stdc++.h>
using namespace std;
// defines...
#define ll long long
#define tata return;
#define pb push_back
#define mp make_pair
#define in insert
#define run \
ios_base::sync_with_stdio(false); \
cin.tie(NULL);
#define YES cout << "YES" << endl;
#define NO cout << "NO"... | ALGO | 0.999944 | 4.372641 |
e969d64c-ca7f-4f5c-9367-75150fe4637b | lazybing/language_learning | CPP_Language_Learning/arrfun4.cpp | // arrfun1.cpp -- functions with an array argument
#include <iostream>
const int ArSize = 8;
int sum_arr(const int *begin, const int *end);
int main()
{
int sum;
int cookies[ArSize] = {1, 2, 4, 8, 16, 32, 64, 128};
std::cout << cookies << " = array address, ";
std::cout << sizeof cookies << " = size... | ALGO | 0.996065 | 5.427333 |
43321cd2-8a40-4356-b75f-ae8cb7768086 | sherylll/hls-deep-lstm | stacked_lstm_src/firmware/stacked_lstm.cpp | /*
simulation does not work due to large array size; internal compiler error returned
converted from hidden_states_digit_4_stacked.txt
h3[27]: 522 1951 61829 64947 38 2091 61706 1650 1792 63128 3196 1587 62951 64103 2081 566 65275 2632 64275 62165 1161 65055 64603 156 3673 64460 64967 2105 757 65509 2973 2793 63878 118... | ALGO | 0.974859 | 5.152729 |
83570ea8-af14-4d8f-b6e6-cfb4032d7994 | Karelito00/problems | Usaco/change.cpp | #include <bits/stdc++.h>
using namespace std;
int table[1001];
int z[11];
int main()
{
freopen("change.in","r",stdin);
freopen("change.out","w",stdout);
int m,mon;
cin>>m>>mon;
for(int i=0;i<mon;i++){
cin>>z[i];
}
sort(z,z+mon);
for(int i=z[0];i<=m;i++){
table[i]=i;
... | ALGO | 0.999937 | 3.581427 |
89025b8f-7d91-41b2-af3b-ad729a535f76 | zahintapadar/bettify | 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 |
79911753-5624-408e-9fcd-370560fa6173 | Corei13/contest-programming-codes | UVA/10048.cpp | #include <bits/stdc++.h>
using namespace std;
#define x first
#define y second
#define mp make_pair
#define pb push_back
#define sz(a) (int)(a.size())
#define all(a) a.begin(), a.end()
typedef unsigned long long ll;
typedef vector <int> VI;
typedef vector <VI> VVI;
typedef pair <ll, int> PI;
typedef vector <PI> VPI;... | ALGO | 0.999969 | 4.232081 |
ade5c5ac-b2c7-47a2-b2d6-47ead8662521 | fkanehiro/openhrp3 | server/UtDynamicsSimulator/sDIMS/colinfo.cpp | /**
* colinfo.cpp
* Create: Katsu Yamane, 04.03.05
*/
#include "colinfo.h"
//#define VERBOSE
int ColModel::LineIntersection(PQP_CollideResult& cres, const fVec3& p1, const fVec3& p2)
{
static PQP_REAL T[3], RR[3][3];
static PQP_REAL P1[3], P2[3];
fVec3 pos(joint->abs_pos);
fMat33 att(joint->abs_att);
T[0] = ... | TOOL | 0.919864 | 5.064364 |
4de46117-3e08-4221-b258-b856c98a1861 | shudhanshu435/LeetCode | 2610-closest-prime-numbers-in-range/2610-closest-prime-numbers-in-range.cpp | class Solution {
public:
vector<int> Sieve(int n){
vector<bool>isPrime(n+1,true);
vector<int>prime;
isPrime[0]=isPrime[1]=false;
for(int i=2;i*i<=n;i++){
if(isPrime[i]){
for(int j=i*i;j<=n;j+=i){
isPrime[j]=false;
}
... | ALGO | 0.999993 | 4.870337 |
39a64d2b-876a-4520-b4c2-6ec969e8e5a1 | strengthen/LeetCode | C++/391.cpp | __________________________________________________________________________________________________
sample 76 ms submission
auto gucciGang = []() { std::ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); return 0; }();
class Solution {
private:
struct hash_pair {
size_t operator() (const pair<int, int... | ALGO | 0.999623 | 5.423371 |
fffd834f-cfaf-4fbd-9625-62a573131332 | shafayetejaman/CLI-projects | extractText/files/week 03/day 4/D_Matryoshkas.cpp | // https://codeforces.com/problemset/problem/1790/D
#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 pair<int, int> pii;
typedef vector<int> vi;
typedef vector<char> vc;
... | ALGO | 0.999721 | 5.267137 |
166a5e62-8caa-44e2-a377-afafc9859104 | harshjoshiiii/leetcode | 0846-hand-of-straights/0846-hand-of-straights.cpp | class Solution {
public:
bool isNStraightHand(vector<int>& hand, int groupSize) {
map<int,int>mp;
for(auto i:hand)
mp[i]++;
while(mp.empty()!=true){
int a = mp.begin()->first;
for(int j=0;j<groupSize;j++){
if(mp.find(a+j) == mp.end()) retu... | ALGO | 0.999963 | 5.891504 |
9a1517d9-40df-4ac9-b18a-c836582e2f3b | sb-baifeng-sb/boost | libs/numeric/odeint/examples/ublas/lorenz_ublas.cpp | #include <iostream>
#include <boost/numeric/odeint.hpp>
#include <boost/numeric/ublas/vector.hpp>
typedef boost::numeric::ublas::vector< double > state_type;
void lorenz( const state_type &x , state_type &dxdt , const double t )
{
const double sigma( 10.0 );
const double R( 28.0 );
const double b( 8.0 / ... | ALGO | 0.99988 | 6.94108 |
4efb70ab-0a09-487e-bf07-83f238bf4ec4 | tomn2804/Kanalysis | External Dependencies/boost_1_74_0/tools/inspect/inspect.cpp | // inspect program -------------------------------------------------------------------//
// This program recurses through sub-directories looking for various problems.
// It contains some Boost specific features, like ignoring "bin",
// and the code that identifies library names assumes the Boost directory
// st... | TOOL | 0.872804 | 5.760201 |
845237ea-16a2-460a-9f5c-013372a285cb | Byeong-Su/algorithm | SW Expert for CT/2058.cpp | //자릿수 더하기
//https://swexpertacademy.com/main/code/problem/problemDetail.do?problemLevel=1&contestProbId=AV5QPRjqA10DFAUq&categoryId=AV5QPRjqA10DFAUq&categoryType=CODE&problemTitle=&orderBy=FIRST_REG_DATETIME&selectCodeLang=ALL&select-1=1&pageSize=10&pageIndex=1
#include <iostream>
#include <vector>
#include <algorithm... | ALGO | 0.999822 | 5.126091 |
ee17356d-8ccc-4ff3-b494-e3be31d58b45 | pingjuiliao/softbound | llvm-project-13.0.0.src/compiler-rt/lib/tsan/rtl/tsan_fd.cpp | #include "tsan_fd.h"
#include "tsan_rtl.h"
#include <sanitizer_common/sanitizer_atomic.h>
namespace __tsan {
const int kTableSizeL1 = 1024;
const int kTableSizeL2 = 1024;
const int kTableSize = kTableSizeL1 * kTableSizeL2;
struct FdSync {
atomic_uint64_t rc;
};
struct FdDesc {
FdSync *sync;
int creation_tid;
... | TOOL | 0.885456 | 6.908645 |
c6a1e718-f106-443d-9533-ab83af65fec6 | eae11/algorithm | zyr/algoritm/src/main/java/com/douma/_1_day_数组技巧/_27/代码实现_C++.cpp | public:
int removeElement1(vector<int>& nums, int val) {
if (nums.size() == 0) return 0;
int slow = 0;
int fast = 0;
while (fast < nums.size()) {
if (nums[fast] != val) {
nums[slow] = nums[fast];
slow++;
}
fast++;
... | ALGO | 0.999907 | 5.770472 |
c6efa0f1-d14d-4be5-ac0b-2bf235d49bdd | dairui/niuone-ardupilot | ArduCopter/commands.cpp | // -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*-
#include "Copter.h"
/*
* the home_state has a number of possible values (see enum HomeState in defines.h's)
* HOME_UNSET = home is not set, no GPS positions yet received
* HOME_SET_NOT_LOCKED = home is set to EKF origin... | TOOL | 0.903842 | 7.363109 |
5f008ccb-6560-4915-9f9d-b48c0ecdb9b2 | Ferruccio1984/OblivionAerial-HeliPilot | libraries/Filter/LowPassFilter.cpp | //
/// @file LowPassFilter.cpp
/// @brief A class to implement a low pass filter without losing precision even for int types
/// the downside being that it's a little slower as it internally uses a float
/// and it consumes an extra 4 bytes of memory to hold the constant gain
#include "LowPassFilter.h... | TOOL | 0.981399 | 5.459754 |
b4098ffc-691b-484c-ba01-352cf5f343e8 | dib-lab/kProcessor | ThirdParty/sdsl-lite/benchmark/suffix_trees/src/time_and_space_cst.cpp | #include <sdsl/suffix_trees.hpp>
#include <fstream>
#include <chrono>
using namespace sdsl;
using namespace std::chrono;
using timer = std::chrono::high_resolution_clock;
typedef CST_TYPE cst_type;
const size_t NUM_REPETITIONS = 10000;
const size_t BURST_SIZE = 10000;
std::default_random_engine &get_generator() {
... | TEST | 0.965406 | 6.111157 |
98f9eeb5-a550-41c6-a605-60d3ddd73d74 | MrHDMai/Algorithm-and-Design | 05. RadixSort/RadixSort.cpp | #include <iostream>
#include <vector>
using namespace std;
const int DIGIT_RANGE = 4; // Digits range from 0 to 3
const int DIGITS_PER_NUMBER = 10;
// Counting sort on digit position `pos`
void countingSort(vector<vector<int>>& arr, int pos) {
int n = arr.size();
vector<int> count(DIGIT_RANGE, 0);
ve... | ALGO | 0.999976 | 6.198283 |
13103d34-c902-46bf-a1fd-e5494c09c3ad | Gurmeet-Rana/DAA | week8/Prims.cpp | //SPANING TREE IS A TREE WHICH CONTAINS N NODES WITH N-1 NODES WITH NO CYCLE
#include<iostream>
#include<queue>
#include<unordered_map>
#include<vector>
using namespace std;
int prims(unordered_map<int,vector<pair<int,int>>> &adj)
{
priority_queue<pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>> pq;
... | ALGO | 0.999914 | 5.312386 |
7d02b3b6-421c-4e99-9282-aa1ee7777a0f | z0san/WebCraft | lib/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 ((unsigned)n > 63) {printf("rotatel, n out of ... | ALGO | 0.998846 | 4.574697 |
4b46751e-ae16-4c9f-a782-53d41b6c1fbe | darkshuige/codecode | c code/P2704 [NOI2001] 炮兵阵地 状态压缩dp,滚动数组优化.cpp | #include<iostream>
#define jiasu ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define int long long
#define endl "\n"
#define lc p<<1
#define rc p<<1|1
using namespace std;
const int maxn=110;
const int maxm=1<<11;
//状态压缩dp
//用二进制表示状态,用十进制储存状态
//用位运算筛选出合法状态
//用位运算判断状态转移的条件
//计算时每个类累加上一行的兼容类
int n,k,cnt,m;
int s[... | ALGO | 0.999831 | 3.4259 |
eac5c269-4f00-4ec7-9dab-8b1cf8cf7869 | ishandutta2007/codeforces | amethyst0/normal/1662/I.cpp | //#pragma comment(linker, "/STACK:1000000000")
#pragma GCC optimize("Ofast,no-stack-protector")
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <algorithm>
#include <memory.h>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <cmath>
#include <ctime>
#include <limits.h>
#include <ra... | ALGO | 0.999747 | 3.194626 |
e11783aa-c7ba-4659-8708-dfeeb72b01f2 | raincross7/code-similarity | codes/train_code/problem480/problem480_491.cpp | #include<bits/stdc++.h>
#define fast ios::sync_with_stdio(false), cin.tie(0);
#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define endl '\n'
const int N = 1e5+10;
const ll INF = 1e15;
using namespace std;
vector<pair<int,ll>> Graph[N];
vector<ll> d;
void dijkstra... | ALGO | 0.999934 | 4.131757 |
2ae5a7ef-65e7-4f85-bdd2-b63bf8e02f6b | Reveroftrillion/BOJ | BOJ/11724/Main.cpp | #include <iostream>
#include <vector>
using namespace std;
vector<vector<int>> graph;
vector<bool> visited;
void dfs(int node)
{
visited[node] = true;
for (int next : graph[node])
{
if (!visited[next])
{
dfs(next);
}
}
}
int main()
{
ios::sync_with_stdio(false);... | ALGO | 0.999853 | 5.726693 |
e147805f-f333-4c7b-b9fe-745b48bfdb0f | Lalaandrea/OmegaUp | Fracciónmixta.cpp | #include <iostream>
#include <tgmath.h>
using namespace std;
int main() {
long long int n, m, b, aux1, aux2;
cin >> n >> m;
if( n % m == 0){
cout << n / m << endl;
}
else{
aux1 = int(floor( n / m));
aux2 = n - aux1 * m;
cout << aux1<<" "<< aux2 << "/" << m << endl;
}
return 0;
} | ALGO | 0.999793 | 4.304197 |
773f8b15-cd2d-4253-9107-c02c49deabbc | daralim1987/cmpsci3130 | cmpsci3130/project#3/BST.cpp | #include<iostream>
#include<cstdlib>
using namespace std;
struct node
{
int key;
struct node *leftChild, *rightChild;
};
//Function to build a new node
struct node *newNode(int item)
{
struct node *tmp = (struct node *)malloc(sizeof(struct node));
tmp->key = item;
tmp->leftChild = tmp->rightChild... | ALGO | 0.999964 | 4.939333 |
240f4125-982a-4b29-a651-e192587a14b6 | HC-Chang/LeetCode | complete/629.k-inverse-pairs-array.cpp | /*
* @lc app=leetcode id=629 lang=cpp
*
* [629] K Inverse Pairs Array
*/
// @lc code=start
class Solution
{
public:
int kInversePairs(int n, int k)
{
int dp[n + 1][k + 1];
memset(dp, 0, sizeof(dp));
for (int i = 0; i <= n; ++i)
dp[i][0] = 1;
int mod = 1e9 + 7;
... | ALGO | 0.999978 | 6.443342 |
d05c2144-88dc-4e6f-a117-57237deee2de | Zapryanovx/FMI-SDA-2024-PREP | Week 05/Additional/SI Exams Listed List Tasks/remove_all.cpp | // https://www.hackerrank.com/contests/sda-2021-2021-test-2-test/challenges/challenge-3111/problem
void SinglyLinkedList::removeAll(int X)
{
Node* res = new Node(0);
res->next = head;
Node* curr = res;
while (curr->next)
{
if (curr->next->value == X)
{
Node* nextNode =... | ALGO | 0.998826 | 3.344047 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.