uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
0c7c33b6-26ad-4977-ac71-29ac5d31e23e | adehgha/ppm3d | Eigen/doc/examples/QuickStart_example2_fixed.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace Eigen;
using namespace std;
int main()
{
Matrix3d m = Matrix3d::Random();
m = (m + Matrix3d::Constant(1.2)) * 50;
cout << "m =" << endl << m << endl;
Vector3d v(1,2,3);
cout << "m * v =" << endl << m * v << endl;
}
| ALGO | 0.997351 | 3.375595 |
53d24f1b-aa0f-4ea6-be2c-637474897a59 | Anaghan007/Cpp | Friend Function/smallest.cpp | #include<iostream>
using namespace std;
class Test
{
private:
int x, y;
public:
void input()
{
cout << "Enter First Number:";
cin >> x;
cout << "Enter Secound Number:";
cin >> y;
}
friend void find(Test t);
};
void find(Test t)
{
if (t.x < t.y)
{
cout <<... | ALGO | 0.989365 | 3.932492 |
8e317f8d-512d-4832-b5c0-f554336b387d | Ayuphys789/competitive_programming | atcoder/abc/abc220/d.cpp | /**
* Author: Ayuphys
* Problem Number: abc220-d
* Title: FG operation
* Link to the Problem: https://atcoder.jp/contests/abc220/tasks/abc220_d
* Link to the Submission: https://atcoder.jp/contests/abc220/submissions/65722140
* Difficulty: 664
*/
#include "/home/ayuphys789/competitive_programming/template/templ... | ALGO | 0.99936 | 4.651928 |
bf1cb468-4bf4-4745-ac1f-0cdf12d5fb94 | kamilszymczak1/my_solutions | cf/contests/1680/d.cpp | #include <cstdio>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <bitset>
using namespace std;
bool Itr(long long a, long long b, long long c, long long d) {
if(a > c) {
swap(a, c);
swap(b, d);
}
return c <= b;
}
bool Check(long long x0, long long a, long l... | ALGO | 0.999957 | 3.838864 |
b4a8f43a-62e3-4fb5-8a79-42b6485eddec | hjiang13/LLMs-in-IR | POJ-104/69/35.cpp | #include <iostream>
using namespace std;
int main()
{
char ca[250],cb[250];
int *a,*b,*c,l,i,j;
cin >> "%s %s",ca,cb);
l=strlen(ca);
if(strlen(cb)>strlen(ca))
l=strlen(cb);
a=(int *)malloc(sizeof(int)*l);
b=(int *)malloc(sizeof(int)*l);
c=(int *)malloc(sizeof(int)*(l+1));
for(i=0; i<l; i++)
{
a[i]=0;
b[i]=0;
c[i]=0;
}... | ALGO | 0.999951 | 3.06642 |
6abab73f-76d0-49d1-a230-ddbaaa72b09c | kritirikhi/DataStructuresAndAlgorithms | bitManipulationTasks.cpp | #include <iostream>
using namespace std;
bool isOdd(int n){
return n&1;
}
int getBit(int n,int i){
int mask=1<<i;
mask=mask&n;
if(mask>1){
return 1;
}
else if(mask==0){
return 0;
}
}
int setBit(int n,int i){
int mask=1<<i;
mask=mask|n;
return mask;
}
int clea... | ALGO | 0.999391 | 4.037539 |
2e6b906e-0565-444c-b766-0645ca8d0a33 | Capzera/Cpp | LGOJ/P2068.cpp | #include <bits/stdc++.h>
using namespace std;
long long n, m, x, y, tree[400010];
char op;
inline int lowbit(int x) {
return x & (-x);
}
inline void add(int x, int k) {
for (; x <= n; x += lowbit(x)) tree[x] += k;
}
inline long long get(int x){
long long ans = 0;
for (; x; x -= lowbit(x)) ans += tree[x];
return... | ALGO | 0.999904 | 4.62872 |
62abd882-576e-479b-81f0-374317c7a615 | GuacheSuede/MSSubmission1234567890 | submission/bollinger/boost_1_69_0/libs/graph/example/topo_sort.cpp | typedef std::pair<std::size_t,std::size_t> Pair;
/*
Topological sort example
The topological sort algorithm creates a linear ordering
of the vertices such that if edge (u,v) appears in the graph,
then u comes before v in the ordering.
Sample output:
A topological ordering: 2 5 0 1 4 3
*/
int
main(int ... | ALGO | 0.998693 | 6.224144 |
11ef2901-cfb2-469d-b72e-8f84691e568c | 3AceShowHand/algorithms-cpp | array/pivotIndex.cpp | #include <iostream>
#include <vector>
#include <numeric>
using namespace std;
int pivotIndex(const vector<int>& nums) {
int total = accumulate(nums.begin(), nums.end(), 0);
int leftSum = 0;
for (int i = 0; i < nums.size(); ++i) {
if ((leftSum * 2 + nums[i]) == total) {
return i;
... | ALGO | 0.999882 | 6.678205 |
96f980cd-4a3b-46e8-9971-046d7c2f7cc2 | HYU-GradProj/pytorch-run-length-impl-cpp | third_party/ComputeLibrary/src/runtime/CL/functions/CLGEMMLowpMatrixMultiplyCore.cpp | #include "arm_compute/runtime/CL/functions/CLGEMMLowpMatrixMultiplyCore.h"
#include "arm_compute/core/CL/ICLTensor.h"
#include "arm_compute/core/Error.h"
#include "arm_compute/core/Helpers.h"
#include "arm_compute/core/TensorInfo.h"
#include "arm_compute/core/Types.h"
#include "arm_compute/core/Validate.h"
#include "a... | ALGO | 0.948645 | 6.74557 |
5936bf45-11f1-43e8-8810-75dc1ef27de0 | sourik10/Striver-SDE-Sheet | pascalTriangle.cpp | // https://www.youtube.com/watch?v=6FLvhQjZqvM&list=PLgUwDviBIf0rPG3Ictpu74YWBQ1CaBkm2&index=9
#include <bits/stdc++.h>
vector<vector<long long int>> printPascal(int n){
vector<vector<long long int>> r(n);
for(int i=0;i<n;i++){
r[i].resize(i+1);
r[i][0]=r[i][i]=1;
for (int j = 1; j < i; j++) {
... | ALGO | 0.999909 | 4.188393 |
971f171b-2fd2-445b-8cdd-0f1811f9d86b | a220932/adv-pd | Q7.cpp | #include<iostream>
using namespace std;
int main() {
string str;
getline(cin, str);
int n = 0;
for (int i = 0; i < str.length(); i++){
char c = str[i];
if (c>='0' && c<='9'){
n*=10;
n += (c-'0');
}
}
while(n-- > 0) {
int point[101] = {0};
getline(cin, str);
int max = -1, t = 0;
for ... | ALGO | 0.999561 | 3.346432 |
deb2e135-d014-4d95-9a66-d977679b8e6d | Yadhu-S/BulletPhysicsPlugin | Source/ThirdParty/BulletPhysicsEngineLibrary/bullet3/examples/SharedMemory/plugins/stablePDPlugin/SpAlg.cpp | #include "SpAlg.h"
#include <iostream>
cSpAlg::tSpVec cSpAlg::ConvertCoordM(const tSpVec& m0, const tVector& origin0, const tVector& origin1)
{
return ConvertCoordM(m0, origin0, origin1, tMatrix::Identity());
}
cSpAlg::tSpVec cSpAlg::ConvertCoordM(const tSpVec& m0, const tVector& origin0, const tMatrix& R0,
... | ALGO | 0.996928 | 6.020428 |
05be727d-175d-45ea-9148-d6342742017b | DavyYvad/UnrealEngine-release | Engine/Plugins/Runtime/AudioSynesthesia/Source/AudioSynesthesiaCore/Private/FFTPeakPitchDetector.cpp | #include "FFTPeakPitchDetector.h"
#include "AudioSynesthesiaCoreLog.h"
#include "PeakPicker.h"
#include "DSP/Dsp.h"
#include "DSP/FFTAlgorithm.h"
#include "DSP/FloatArrayMath.h"
namespace Audio
{
namespace FFTPeakPitchDetectorIntrinsics
{
constexpr int32 PeakPickerMinSize = 2;
int32 PowerScalePeakPickerValue(f... | ALGO | 0.923974 | 6.28728 |
65bf66ae-184c-4b1b-8b49-01aa7dcbc15c | kovidH333/Leetcode | 1437-minimum-insertion-steps-to-make-a-string-palindrome/1437-minimum-insertion-steps-to-make-a-string-palindrome.cpp | class Solution {
public:
int minInsertions(string s) {
string s1 = s;
reverse(s1.begin(),s1.end());
int n = s.size();
vector<int> prev(n+1,0),curr(n+1,0);
for(int i=1; i<=n; i++){
for(int j=1; j<=n; j++){
if(s[i-1]==s1[j-1]) curr[j] = 1 + prev[j-1... | ALGO | 0.999992 | 6.132007 |
814036b3-763d-422b-bbe9-3622f8c150e1 | 9624420393/software-engineering | module-3(fundamental of c)/topic-4/question_15.cpp | //Store 5 numbers in array and sort it in ascending order//
#include <stdio.h>
int main()
{
int i,j,a,number[30];
// input of array//
printf("Enter the numbers \n");
for(i=0;i<5;i++)
{
scanf("%d",&number[i]);
}
// logic built for ascending wh... | ALGO | 0.999855 | 4.078514 |
103d8b42-e150-4dc2-9161-4c9a28771b9e | JoaoDanielRufino/Online-Judges | LeetCode/how_many_numbers_are_smaller_than_the_current_number.cpp | class Solution {
public:
int count(vector<int>& nums, int val) {
int count = 0;
for(int x : nums) {
if(x >= val)
break;
count++;
}
return count;
}
vector<int> smallerNumbersThanCurrent(vector<int>& nums) {
... | ALGO | 0.99999 | 6.230081 |
6077c897-3b4a-4782-bf0a-253dfe2d7d05 | Arabela08/Pork-Sisig | InsertionSort2.cpp | #include <iostream>
using namespace std;
class GradeSheet {
public:
string name;
string id;
double calculus;
double physics;
double mmw;
double electrical;
double discrete;
double average;
double computeAverage() {
average = (calculus + physics + mmw + electrical + discrete... | ALGO | 0.988693 | 5.829204 |
725ed81f-46cb-4f17-94ee-9a1eb842cbb1 | POANING/FYP | FYP/opencv-4.x/modules/gapi/samples/face_detection_mtcnn.cpp | #include <algorithm>
#include <cctype>
#include <cmath>
#include <iostream>
#include <limits>
#include <numeric>
#include <stdexcept>
#include <string>
#include <vector>
#include <opencv2/gapi.hpp>
#include <opencv2/gapi/core.hpp>
#include <opencv2/gapi/imgproc.hpp>
#include <opencv2/gapi/cpu/gcpukernel.hpp>
#include ... | TOOL | 0.978166 | 6.637559 |
fd817ea7-fd3a-4fb5-9fd6-66f452ea3a21 | kyelithzavhU/parcial2_2corte_5semestre | 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.998809 | 6.763549 |
3ad2b1bc-8592-474a-9dce-e39a1cc08c18 | Yashw12/Graph | 6_Dijikstra.cpp |
/* Intuition: Dijkstra's algorithm is used to find the shortest path from a source node to all other nodes in a weighted graph.
It works by maintaining a priority queue of nodes to explore, always expanding the least costly node first. */
/* Algorithm Steps:
1. Initialize a distance array with infinity for all nodes... | ALGO | 0.999994 | 6.63408 |
2756a195-4695-465f-88eb-e420bdac5d48 | xiaoyaoshengy/Live2DQMLDemo | Framework/Math/CubismMath.cpp | #include "CubismMath.hpp"
namespace Live2D {namespace Cubism {namespace Framework {
const csmFloat32 CubismMath::Pi = 3.1415926535897932384626433832795f;
const csmFloat32 CubismMath::Epsilon = 0.00001f;
csmFloat32 CubismMath::DegreesToRadian(csmFloat32 degrees)
{
return (degrees / 180.0f) * Pi;
}
csmFloat32 Cub... | ALGO | 0.995195 | 7.325441 |
b0454f0f-8c0f-4745-bd79-617e342dede4 | felix-berg/fbg | demos/vectorFieldSketch.cpp | #include "fbg.hpp"
#include <vector>
using namespace fbg;
class Grid : public Context {
public:
Grid(int cell_size, const LoopWin & window)
: m_cell_size { cell_size }
{
if (window.width() % m_cell_size != 0 ||
window.height() % m_cell_size != 0)
throw std::runtime_error("Windo... | TOOL | 0.950186 | 5.530809 |
869eabf1-a1c0-43ed-8f17-2533a4863a96 | chaidamu519/MPC_Project | src/Eigen-3.3/lapack/lu.cpp | #include "common.h"
#include <Eigen/LU>
// computes an LU factorization of a general M-by-N matrix A using partial pivoting with row interchanges
EIGEN_LAPACK_FUNC(getrf,(int *m, int *n, RealScalar *pa, int *lda, int *ipiv, int *info))
{
*info = 0;
if(*m<0) *info = -1;
else if(*n<0) ... | ALGO | 0.998131 | 5.799321 |
667cffe6-349a-4b88-9725-8e62d09ff146 | ishandutta2007/codeforces | tommyr7/normal/1237/C1.cpp | #include <bits/stdc++.h>
using namespace std;
#define Maxn 50007
int n,x[Maxn],y[Maxn],z[Maxn];
map<pair<int,int>,vector<pair<int,int> > >s;
map<int,vector<pair<int,int> > >ss;
vector<pair<int,int> >sss;
int main()
{
scanf("%d",&n);
for (int i=1;i<=n;i++)
scanf("%d%d%d",&x[i],&y[i],&z[i]);
for (int ... | ALGO | 0.999987 | 3.422507 |
8f0c8128-b3a6-4f3f-b246-55f6fd0d4bf9 | sinian666/codes_41_14 | cpp_副本12/chapter_sorting/insertion_sort.cpp | /**
* File: insertion_sort.cpp
* Created Time: 2022-11-25
* Author: Krahets (<EMAIL>)
*/
#include "../utils/common.hpp"
/* 插入排序 */
void insertionSort(vector<int> &nums) {
// 外循环:base = nums[1], nums[2], ..., nums[n-1]
for (int i = 1; i < nums.size(); i++) {
int base = nums[i], j = i - 1;
/... | ALGO | 0.999948 | 6.157312 |
672aebd5-5765-413a-8390-d31f5abddb93 | Altu-Bitu-5/Altu-Bitu-KongJina | 05_우선순위큐/디스크_컨트롤러.cpp | #include <vector>
#include <iostream>
#include <queue>
#include <algorithm>
using namespace std;
// 비교 구조체
struct cmp {
bool operator()(vector<int> a, vector<int> b) {
return a.at(1) > b.at(1);
}
};
int solution(vector<vector<int>> jobs) {
int answer = 0;
int current_time = 0; // 현재시간
i... | ALGO | 0.999985 | 5.721213 |
70257edd-0c6c-462a-a683-94fcafcb1ade | write2maka/2021-Algo-1-Coursera-Princeton | week-1-union-find/src/Percolation.cpp | /*
* Percolation.cpp
*
* Created on: Sep 4, 2021
* Author: maaya
*/
// creates n-by-n grid, with all sites initially blocked
#include <Percolation.h>
#include <iostream>
using namespace std;
#define CLOSED 0
#define OPEN 1
Percolation::Percolation(int n) : matrix(n, vector<int>(n)), unionFind(n*n) {
// ... | ALGO | 0.991277 | 5.15095 |
932639ea-d6c2-4e6e-89ec-c5edcaccfda6 | Kovidsai/My_CP_Learning | cp31/cp900/31.cpp | #include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using lld = long double;
// #define int ll
#define MOD 1000000007
#define MOD1 998244353
#define INF 1e18
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define ff first
#define ss second
#define PI 3.1415... | ALGO | 0.999955 | 4.152948 |
b3ea263f-82ce-4f6b-95e1-025e9369832c | KanishkRAJ29/Leetcode | 0115-distinct-subsequences/0115-distinct-subsequences.cpp | /*class Solution {
public:
const int MOD = 1e9 + 7;
int numDistinct(string s, string t) {
int n=s.size();
int m=t.size();
vector<vector<long long>> dp(n+1,vector<long long>(m+1,0));
if(m>n)return 0;
if(m==n){
if(s==t)return 1;
else return 0;
}
for (int i = 0; i <= n; ... | ALGO | 0.999998 | 6.67996 |
9d2a16dc-44b7-4cfb-a61a-b8d1cf0f2283 | xhdhr10000/alg | usaco/1.2.3_friday.cpp | /*
ID: xhdhr203
LANG: C++
TASK: friday
*/
#include <stdio.h>
#include <stdlib.h>
int leapYear(int year) {
return year % 100 == 0 ? !(year % 400) : !(year % 4);
}
int main(int argc, char const *argv[])
{
FILE *fin = fopen("friday.in", "r");
FILE *fout = fopen("friday.out", "w");
const int days[12] = { ... | ALGO | 0.999855 | 3.269585 |
cc6c9ef7-ad48-4421-862c-de163da4628f | ung-steven/competitive_programming | Olympiads Work/Week 4/GlobeX Cup '18 S1 - Code Copiers.cpp | #include <bits/stdc++.h>
#define MEM(a, b) memset(a, (b), sizeof(a))
#define PI 3.1415926535897932384626433832795
#define endl '\n'
#define exists(s, e) (s.find(e)!=s.end())
#define WHILE(n)
#define pb push_back
#define f first
#define s second
#define UNI(vec) vec.erase(std::unique(vec.begin(), vec.end()),vec.end());... | ALGO | 0.999903 | 3.587775 |
1f2fbdff-559e-43eb-a5b7-db1ab7612e77 | Narunaru1436/AtCoderSolutions2 | abc339/b/main.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int H, W, N;
cin >> H >> W >> N;
int dx[4] = { -1, 0, 1, 0 };
int dy[4] = { 0, 1, 0, -1 };
vector<vector<char>> grit(H, vector<char>(W, '.'));
// 0:↑ 1:→ 2:↓ 3:←
int dir = 0;
int x = 0, y = 0;
int i, j;
for (i = 0; i ... | ALGO | 0.999931 | 3.969392 |
48df1a4c-7bb1-4e2f-b40f-1b0e7da8e885 | Tapesh-Vashisth/Leetcode_Solutions | 335_Self_Crossing.cpp | #include <iostream>
#include <vector>
using namespace std;
bool isSelfCrossing(vector<int>& distance) {
vector <pair <long long, long long>> lines;
long long x = 0;
long long y = 0;
lines.push_back({x, y});
for (int i = 0; i < distance.size(); i++) {
if (i % 4 == 0) {
y += dist... | ALGO | 0.999874 | 3.874492 |
4177ed46-c7da-48ec-84ef-2ce87823777a | raincross7/code-similarity | codes/train_code/problem455/problem455_175.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
using namespace std;
typedef long long ll;
int main(void){
ll n, a[100010];
cin >> n;
for (int i = 0; i < n; i++) cin >> a[i];
ll ans = 0, mn = 2;
ans += a[0] - 1;
//cout << ans << endl;
for (int i = 1; i < n;... | ALGO | 0.999681 | 3.435393 |
b70910d8-0c7b-4d3e-815d-645dacbb9ad9 | Coder-Vippro/Code | Main-Workspace/16112023/friendnum/friendnum.cpp | #include <bits/stdc++.h>
using namespace std;
int tonguoc(int n)
{
int tong = 0;
for (int i = 1; i <= n; i++)
{
if (n % i == 0)
{
tong += i;
}
}
return tong;
}
bool kt(int n, int m)
{
int tong1 = tonguoc(n);
int tong2 = tonguoc(m);
if (tong1 == m && t... | ALGO | 0.999981 | 5.113174 |
8f5773e6-9dec-46b6-a004-6b9afe182136 | nazeer-18/Leetcode-GFG_solved | Length of the longest substring - GFG/length-of-the-longest-substring.cpp | //{ Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution{
public:
int longestUniqueSubsttr(string s){
//code
int a[26]={0},i=0,n=s.length(),cnt=0,maxi=1,b[26];
for(;i<26;i++) b[i]=-1;
for(i=0;i<n;i++){
if(a[s[i]-'a']>=1... | ALGO | 0.999785 | 6.216862 |
45780668-e53b-41e1-a934-b08072d5391a | Lee-DongWon/SWExperts_Problems | SW Experts/D2/D2_1976.cpp | #include <iostream>
using namespace std;
int main() {
int t;
cin >> t;
for (int i = 1; i <= t; i++) {
int hour, hour1, hour2;
int minute, minute1, minute2;
cin >> hour1 >> minute1 >> hour2 >> minute2;
minute = minute1 + minute2;
hour = hour1 + hour2;
if (minute >= 60) {
minute -= 60;
hour++;
... | ALGO | 0.997445 | 3.839787 |
93ee3f13-4c02-4bfc-80e3-d12eca265a84 | honeyspoon/flutter-ffi-test-sox | android/.cxx/cmake/debug/armeabi-v7a/third/sox/src/amr/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cor_h_x.cpp | /*
------------------------------------------------------------------------------
Filename: cor_h_x.cpp
------------------------------------------------------------------------------
*/
/*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------... | ALGO | 0.999888 | 4.835138 |
26e9e20e-63b3-477b-904c-643403f1d63f | Ayush-Pandey0/GFG-DAILY | nextpermutation.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution {
public:
void nextPermutation(vector<int>& arr) {
int n = arr.size();
int i = n - 2;
// Step 1: Find the first index i such that arr[i] < arr[i+1]
while (i >= 0 && arr[i] >= arr[i + 1]) {
i--;
}
... | ALGO | 0.999975 | 5.704204 |
03307da1-c130-4c7d-a97f-3abd1436d326 | kestrel-labs/superspreader | arduino/health_monitor/health_monitor_core.cpp | // Originally from game_rules_2.py
// Game
#include "health_monitor_core.h"
namespace {
/** @returns amount to increase @p health_state value by, given @p exposures */
health_t exposure_increase(HealthState const health_state, ExposureEvent const exposures) {
if (is_immune(health_state.health) || is_infected(hea... | ALGO | 0.954989 | 5.172749 |
2bc7d156-3ecb-4a35-917b-d747a3439b42 | DevinChang/cpp | code_modified_20150323/1/21.cpp | #include <iostream>
#include "Sales_item.h"
int main()
{
Sales_item trans1, trans2;
std::cout << "ISBNͬۼ¼" << std::endl;
std::cin >> trans1 >> trans2;
if (compareIsbn(trans1, trans2))
{
std::cout << "ϢISBN۳۶ƽۼΪ " << trans1 + trans2 << std::endl;
}
else
{
std::cout << "ۼ¼... | TOOL | 0.891834 | 5.117518 |
76930cff-0f97-4806-8f44-7d8141967fc0 | abansal15/codeforces-solutions | 1742B.cpp | // Jai shree ram
#include<bits/stdc++.h>
using namespace std;
int main(){
int t;
cin>>t;
while(t--){
int n,count=0;
cin>>n;
int arr[n];
for(int i=0;i<n;i++){
cin>>arr[i];
}
sort(arr,arr+n);
for(int i=1;i<n;i++){
if(arr[i-1]==arr... | ALGO | 0.999947 | 4.10984 |
5ca15af8-6f53-4fd8-b251-7735e51e9112 | abhishek18124/PPCPPJune2022 | 02 - July/Lecture 13 - 24thJuly2022/003CharArrays_KRotate.cpp |
#include<iostream>
using namespace std;
int main() {
char str[100] = "codingblocks";
int n = strlen(str);
int k = 3;
// 1. shift all the characters 'k' steps to the right
for(int i=strlen(str); i>=0; i--) {
str[i+k] = str[i];
}
// 2. move the last k characters to the front
for(int i=0, j=n; i<k; i++, j+... | ALGO | 0.999607 | 3.522113 |
1c0c6a6e-c20b-4344-84ab-3fcb51190cf2 | allipurHari/DS | Nov-22/stack/implement-stack-using-queues.cpp | https://leetcode.com/problems/implement-stack-using-queues/
class MyStack {
public:
queue<int> q1, q2;
int currq;
MyStack() {
currq = 1;
}
void push(int x) {
if(currq == 1)
q1.push(x);
else
q2.push(x);
}
int pop() {
if(currq ... | ALGO | 0.999456 | 5.91029 |
d6f477ca-7ac6-4672-89f6-37a35749b38f | HeeraRana247453/DSA_Program | p13NoOfSetBits.cpp | // Calculate the no. of set bits in numbers
#include<iostream>
using namespace std;
int bitCal(int a,int b){
int count=0;
int b1,b2;
while(a>0){
b1 = a&1;
if(b1==1){
count++;
}
a = a>>1;
}
while(b>0){
b2 = b&1;
if(b2==1){
count... | ALGO | 0.999638 | 5.344447 |
7cb2f82b-9659-4d30-a91a-feb0f4b7ec28 | vishal2005025/cp | D_Are_You_a_Procrastinator.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
string s;
cin>>s;
if(s=="?") cout<<"NO"<<endl;
}
| ALGO | 0.99973 | 3.345167 |
a00aba5b-8819-4d83-90e3-152b04b39b1c | IpsRuslanTu/OPD_Saper | main/saperFunc.cpp | #include "saperFunc.h"
#include <vector>
#include <time.h>
#include <cstdlib>
void placeMines(std::vector<std::vector<int>> &arrLogic, std::vector<std::vector<int>> &arrView,
int minSize, int maxSize, int signEmpty, int signMine, int signUnopen, int difficultyGame)
{
std::srand(time(0));
for (i... | ALGO | 0.989562 | 4.1112 |
6555aac5-e78c-4d8b-8a18-6f2369ee9819 | priya-thv/dsa-practice | graphs/find smallest set of vertices.cpp | class Solution {
public:
vector<int> findSmallestSetOfVertices(int n, vector<vector<int>>& edges) {
vector<int>indegree(n);
for(int i=0;i<edges.size();i++){
indegree[edges[i][1]]++;
}
vector<int>v;
for(int i=0;i<n;i++){
if(indegree[i]==0){
... | ALGO | 0.999973 | 6.247961 |
a5292b8a-a0fa-4258-b444-5ccbcabaf949 | nashmuhandes/LAD | src/playsim/p_3dfloors.cpp | #include "p_local.h"
#include "p_lnspec.h"
#include "p_maputl.h"
#include "filesystem.h"
#include "g_level.h"
#include "p_terrain.h"
#include "d_player.h"
#include "p_spec.h"
#include "g_levellocals.h"
#include "actorinlines.h"
//==========================================================================
//
// 3D Floo... | TOOL | 0.934845 | 5.899662 |
8e49673a-d096-4daa-a95a-5f54ac2cb021 | honey-pot1674/ccpp-study | 양한석src/양한석src/AGUCE.cpp | #include <iostream>
using namespace std;
int main() {
cout.precision(10);
float da, db, x, tmp;
cin >> da >> db >> x;
if (db > da) {
tmp = db;
db = da;
da = tmp;
}
cout << (100 * da * db) / (db * x + da * (100 - x));
} | ALGO | 0.999696 | 3.681349 |
e798ae07-1c59-40c3-ae2d-29424cf4a7bd | TotallyNotAB0t/MathExtrusion | Extrusion/ThirdParty/Bullet3/src/BulletCollision/CollisionDispatch/btConvexConcaveCollisionAlgorithm.cpp | #include "btConvexConcaveCollisionAlgorithm.h"
#include "LinearMath/btQuickprof.h"
#include "BulletCollision/CollisionDispatch/btCollisionObject.h"
#include "BulletCollision/CollisionShapes/btMultiSphereShape.h"
#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h"
#include "BulletCollision/CollisionShapes... | ALGO | 0.999052 | 7.238217 |
6fad9c46-b770-4eea-92a6-48548e5c9dad | lclpsoz/competitive-programming | ARCHIVE/2018-09-02-0830/545D.cpp | #include <bits/stdc++.h>
using namespace std;
////////////// Prewritten code follows. Look down for solution. ////////////////
#define x first
#define y second
#define pb push_back
#define foreach(x, v) for (typeof (v).begin() x=(v).begin(); x !=(v).end(); ++x)
#define For(i, a, b) for (int i=(a); i<(b); ++i)
#define ... | ALGO | 0.99994 | 4.39845 |
ad65d617-ef0f-4d09-a99d-a3c9ef0bfc77 | PiperBetle/MyCode | CF954F Runner's Problem.cpp | #include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#define int long long
using std::cin;using std::cout;
constexpr int kN=1e4+7,MOD=1e9+7;
int b[kN<<1],lb,c[4][kN<<1],s[4];
struct matrix{
int data[4][4],size;
matrix(){memset(data,0,sizeof data);}
matrix(const int &x):size(x){memset(data,0,size... | ALGO | 0.999966 | 3.686669 |
68c8f9e3-dd38-445d-92d2-e670a0662c9c | novrion/util | math/Euler_step_method.cpp | #include <iostream>
#include <cmath>
inline double Derivative(const double x, const double y) {
return 2 * sqrt(y);
}
int main() {
double xs, xe, ys, ye;
double step;
std::cout << "x start: ";
std::cin >> xs;
std::cout << "x end: ";
std::cin >> xe;
std::cout << "y start: ";
std:... | ALGO | 0.999889 | 3.728021 |
bb619eea-4d78-45bf-a855-46ec5f6f6b0c | rares-gh-pisoi/pbinfo | Clasa 10/meditatie/teme/20.10.2024/moscraciun2/moscraciun2/main.cpp | #include <iostream>
#include <algorithm>
using namespace std;
struct Magazin {
int pr;
int c;
};
Magazin v[101];
void sortsir(Magazin v[],int n){
int ok=0;
while(ok==0){
ok=1;
for(int i=1;i<n;i++){
if(v[i].pr>v[i+1].pr){
ok=0;
Magazin aux=v[i... | ALGO | 0.999972 | 4.087347 |
d9f7e1a8-cb41-4fd0-a099-9879978313c5 | raincross7/code-similarity | codes/train_code/problem136/problem136_257.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <functional>
using namespace std;
const int MOD = 1e9+7;
using ll = long long;
using vi = vector<int>;
#define rep(i, n) for (int i = 0; i < n; i++)
#define ALL(x) x.begin(), x.end()
int main() {
string s,t;
cin >> s >> t;
sor... | ALGO | 0.999997 | 4.222156 |
49271528-b5b3-4551-8db6-b7c4ccc7239b | commcheck396/Leetcode | 400.cpp | class Solution {
public:
int findNthDigit(int n) {
long last=1;
long times=10;
long tmp;
int i;
for(i=1;;i++,times*=10){
tmp=(times-last)*i;
if(n<=tmp)break;
else{
last=times;
n-=tmp;
continue... | ALGO | 0.999835 | 6.108063 |
76a998ae-2c7b-491d-9303-815ca6789409 | tush-tr/archive-dsa-old | dsa-one/mathematics/modulo.cpp | #include<iostream>
using namespace std;
// Calculate factorial print result modulo of M where
// M = 1000000007
int main(){
int M = 1000000007;
int n;
cin>>n;
int fact = 1;
for(int i=2;i<=n;i++){
fact = (fact*i)%M;
}
cout<<fact<<endl;
} | ALGO | 0.999981 | 5.159808 |
1f69eaf2-4a82-4ca8-a4ff-2e952790801c | jochongs/codetree-TILs | 240223/두 번의 연산/two-operations.cpp | #include <iostream>
using namespace std;
int main() {
// 여기에 코드를 작성해주세요.
ios_base :: sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int a;
cin >> a;
if(a % 2 != 0) {
a += 3;
}
if(a % 3 == 0) {
a /= 3;
}
cout << a;
return 0;
} | ALGO | 0.999831 | 4.070023 |
899e8713-7600-4c97-8d0c-23cf6d0806f7 | LuuMing/HomeWork | cc/LeetCode/20.Valid_Parentheses/1.cpp | class Solution {
public:
bool isValid(string s) {
stack<char> S;
for(int i = 0; i < s.size(); i++)
{
if(s[i] == '('||s[i] == '['||s[i] == '{')
S.push(s[i]);
else
{
if( S.empty())
return false;
... | ALGO | 0.998798 | 4.649386 |
997e3b68-1f66-4ffe-ab0c-94c8e064f506 | mycbxzd1/myCppCode | other-system/上海计算机学会/2024年12月月赛/排名查询.cpp | #include<bits/stdc++.h>
using namespace std;
#define int long long
template<typename T>
class segtree
{
private:
vector<T> tree;
int n,root,n4,end;
T range_sum(int l,int r,int cl,int cr,int p)
{
if(l<=cl&&cr<=r)return tree[p];
int m=cl+(cr-cl)/2;
T sum=0;
if(l<=m)
... | ALGO | 0.999989 | 4.447685 |
b5acc970-5fd3-4fd0-ac65-1df80e0f65e9 | iclalKayacan/3301456_193301095 | 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.998859 | 6.785645 |
1ce67f94-0eaa-4cb3-8c81-212526ffe674 | Mohit-Aasirwal/My-CPP-Programs | First Year Codes/Linkedlistpractice.cpp | #include <iostream>
using namespace std;
class Node
{
public:
int data;
Node *next;
// constructor
Node(int d)
{
this->data = d;
this->next = NULL;
}
// destructor
~Node()
{
int value = this->data;
// memory free
if (this->next != NULL)
... | ALGO | 0.999502 | 4.8764 |
21fabdc3-0c69-4d32-ae03-2e0ea7bf9d47 | XianMengxi/AutoAim_HUST | src/pose_estimate/src/Predictor.cpp | //
// Created by Doctor-James on 2021/11/11.
//
#include "Predictor.h"
namespace ly
{
#define GRAVITY 9.79338
Predictor::Predictor()
{
normal_kalman_filter = new NormalKalman();
lcm_debug = new LcmDebug();
ekf_filter = new NormalEKF();
}
Predictor::~Predictor()
{
de... | ALGO | 0.872449 | 3.668129 |
036bc671-7f67-4e14-b760-640291e3b550 | Fumuran/Random-Cpp-tasks | Segment_tree.cpp | #include <iostream>
#include <vector>
unsigned int Tree_func(unsigned int a, unsigned int b)
{
return a - b;
}
class SegmentTree
{
private:
std::vector<unsigned long long> tree;
unsigned int n;
void build(unsigned int v, unsigned int left, unsigned int right, const std::vector<unsigned long long> &in... | ALGO | 0.999728 | 5.447522 |
bb6b2e30-2f0a-46e7-8c1c-942a92f6bcab | divaadinda19/giza | GIZA++-v2/model2to3.cpp | #include "model3.h"
#include "utility.h"
#include "Globals.h"
#define _MAX_FERTILITY 10
double get_sum_of_partitions(int n, int source_pos, double alpha[_MAX_FERTILITY][MAX_SENTENCE_LENGTH_ALLOWED])
{
int done, init ;
double sum = 0, prod ;
int s, w, u, v;
WordIndex k, k1, i ;
WordIndex num_parts = 0 ;
/... | ALGO | 0.999372 | 4.839242 |
3bfda381-05a4-4085-994e-1850876280af | psycho-pomp/LeetCode | 1361-validate-binary-tree-nodes/1361-validate-binary-tree-nodes.cpp | class Solution { // YAA
public:
int find(int node, int par[]) {
if(node == par[node]) return node;
return par[node] = find(par[node], par);
}
void join(int u, int v, int par[], int ran[]) {
u = find(u, par);
v = find(v, par);
if(ran[u] > ran[v]) {
par[v] ... | ALGO | 0.99996 | 5.423704 |
aceb21a3-bf46-498d-8fa8-998bf9df6bb0 | Pavelprosnaperkiller2007/StudentCppRevisionTask03Project | StudentCppRevisionTask03Project/task03.cpp | #include "tasks.h"
/* Task 03. Rectangular World (2) [прямоугольный мир]
*
* В прямоугольном мире есть свинья, раскормленная до размеров параллелепипеда.
* Определите, может ли основание свиньи полностью поместиться в прямоугольную лужу грязи,
* заданную сторонами А и B.
*
* Примечание
* Не забудьте использовать "защи... | ALGO | 0.997486 | 4.300829 |
d4fe7bc0-ba5e-456a-a752-75b501ccdd5c | txemagon/firefox-symlinks | gfx/skia/src/core/SkScalar.cpp | #include "SkMath.h"
#include "SkScalar.h"
SkScalar SkScalarInterpFunc(SkScalar searchKey, const SkScalar keys[],
const SkScalar values[], int length) {
SkASSERT(length > 0);
SkASSERT(keys != NULL);
SkASSERT(values != NULL);
#ifdef SK_DEBUG
for (int i = 1; i < length; i++)
... | ALGO | 0.998948 | 4.93237 |
b242e9d1-65c0-4fb2-9832-2ce0d66368d6 | Proli23/Ardupilot | ArduPlane/Attitude.cpp | #include "Plane.h"
/*
calculate speed scaling number for control surfaces. This is applied
to PIDs to change the scaling of the PID with speed. At high speed
we move the surfaces less, and at low speeds we move them more.
*/
float Plane::calc_speed_scaler(void)
{
float aspeed, speed_scaler;
if (ahrs.air... | TOOL | 0.984957 | 5.94367 |
0fc90167-04e0-4d17-a89c-1b98435af264 | VerdanShandilya/leetcodeSol | 419-battleships-in-a-board/battleships-in-a-board.cpp | class Solution {
public:
void eraser(vector<vector<char>>& board,int i,int j){
int n=board.size();
int m= board[0].size();
if(i<0 || j<0 || i==n || j==m || board[i][j]=='.'){
return;
}
board[i][j]='.';
eraser(board,i+1,j);
eraser(board,i,j+1);
... | ALGO | 0.999744 | 6.203798 |
0195e974-d274-4847-ac2d-85d1cd756440 | inusedname/PROPTIT | algo/quaylui/BCQUEEN.cpp | #include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef double db;
#define endl "\n"
int n, res;
bool hang[30], cheochinh[30], cheophu[30];
void Try(int i)
{
for (int j = 1; j <= n; j++)
{
if (hang[j] == 0 && cheoch... | ALGO | 0.999533 | 3.321969 |
fcb4f780-ac7d-4127-9e71-3330fbdf2d74 | KWiewiora/AiSD_Krzysztof_Wiewiora | Lista2/Zad2/main.cpp | #include <iostream>
// mamy porównanie n-1
int max_1(int t[], int n)
{
int x = t[n];
while (n--)
{
if (x < t[n])
{
x = t[n];
}
}
return x;
}
// funkcja pomocnicza do sprawdzenia która liczba jest większa
int max_1(int a, int b) { return a > b ? a : b; }
// mam... | ALGO | 0.999742 | 5.009431 |
ba4484d6-a14f-43c5-8d52-d3bf1b2cf933 | arturremizov/Leetcode | 1399.Count-Largest-Group.cpp | #include <iostream>
#include <unordered_map>
using namespace std;
class Solution {
public:
int countLargestGroup(int n) {
int maxGroupSize = 0;
unordered_map<int, int> groups;
for (int num = 1; num <= n; ++num) {
int sum = sumOfDigits(num);
groups[sum]++;
... | ALGO | 0.999906 | 7.315004 |
bd5b569d-ce79-4706-bd2c-d4f69971d056 | mab1998/map_app02 | tesseract-3.05.02/ccstruct/rejctmap.cpp | #include "host.h"
#include "rejctmap.h"
#include "params.h"
BOOL8 REJ::perm_rejected() { //Is char perm reject?
return (flag (R_TESS_FAILURE) ||
flag (R_SMALL_XHT) ||
flag (R_EDGE_CHAR) ||
flag (R_1IL_CONFLICT) ||
flag (R_POSTNN_1IL) ||
flag (R_REJ_CBLOB) ||
flag (... | ALGO | 0.891888 | 4.81064 |
f6b32d99-f939-47f2-afbc-f4dbdb8be1bc | yezhangxiang/LeetCode | src/SudokuSolver/SudokuSolver.cpp | #include <iostream>
#include <vector>
using namespace std;
void print(vector<vector<char> > &board)
{
for (int i = 0; i < 9; ++i)
{
for (int j = 0; j < 9; ++j)
{
cout << board[i][j] << " ";
}
cout << endl;
}
cout << endl;
}
class Solution {
public:
void solveSudoku(vector<vector<char> > &board) {
int... | ALGO | 0.998698 | 5.979067 |
91dab317-fa66-4770-91fb-6519a272ac5d | AshishKhatkar/ICPC-Practice | Ashish/TopCoder/Div1A/BinaryCode.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define MOD 1000000007
using namespace std;
class BinaryCode {
public:
vector <string> decode(string);
};
vector <string> BinaryCode::decode(string message) {
vector<char> res1, res2;
res1.push_back('0');
res2.push_back('1');
int len = message... | ALGO | 0.999987 | 4.404267 |
bc4c55db-7ec5-4d47-bef4-97449bc91145 | klay9502/Learning | 단계별 문제/08_기본수학2/1929.cpp | #include <iostream>
using namespace std;
void Eratos(int m, int n);
int main(void)
{
int n = 0;
int m = 0;
// 처리속도 UP, C의 입출력 사용안됌!
cin.tie(NULL);
ios::sync_with_stdio(false);
// 1 <= m <= n <= 1,000,000
cin >> m >> n;
Eratos(m, n);
return 0;
}
void Eratos(int m, int n)
{
if (n <= 1) return;
bool* ... | ALGO | 0.999931 | 3.737008 |
ffab1568-97fd-41aa-a468-4e69c1613d95 | rdivi297/DSA | 0641-design-circular-deque/0641-design-circular-deque.cpp | class MyCircularDeque {
vector<int> q;
int f;
int r;
int size;
int capacity;
public:
MyCircularDeque(int k) {
q=vector<int>(k);
f=0;
r=k-1;
size=0;
capacity=k;
}
bool insertFront(int value) {
if(isFull()) return false;
f=(f-1+c... | ALGO | 0.999047 | 5.813982 |
c52a27d8-842d-47ef-91ff-07433428bcc5 | TheMrAI/cp | codeforces/143/a.cpp | #include <bits/stdc++.h>
using namespace std;
auto main() -> int
{
ios::sync_with_stdio(0);
cin.tie(0);
auto t = int64_t{ 0 };
cin >> t;
auto count = 0;
while (t--) {
auto p = 0;
auto v = 0;
auto t = 0;
cin >> p >> v >> t;
if (p + v + t >= 2) { ++count; }
}
cout << count << endl;... | ALGO | 0.999375 | 4.78774 |
46806f1a-3fd7-457b-9376-c8cd8305a716 | ayushranjan237/LeetCode | 0204-count-primes/0204-count-primes.cpp | class Solution {
public:
int countPrimes(int n) {
vector<bool>prime(n+1, true);
int count=0;
prime[0] = prime[1] = false;
for(int i=2; i<n; i++){
if(prime[i]){
count++;
for(int j=2*i; j<n; j=j+i){
prime[j]=false;
... | ALGO | 0.999923 | 5.554389 |
6620b97e-ae27-4abb-b2dc-63338727139f | akashdas95/leetcode_solving | Matrix/2661. First Completely Painted Row or Column.cpp | //Brute Force
//TLE
class Solution {
public:
bool checkRowPainted(vector<vector<int>>& mat, int row) {
for(int col = 0; col < mat[0].size(); col++) {
if(mat[row][col] > 0) {
return false;
}
}
return true;
}
bool checkColPainted(vector<vecto... | ALGO | 0.999991 | 6.044199 |
3efd6d6e-a5ec-4bba-860e-dfd66cb6cf6b | cmiyachi/CygWinAlgorithms | Google/MockPhone/session1/networkDelayTime.cpp | /*
There are N network nodes, labelled 1 to N.
Given times, a list of travel times as directed edges times[i] = (u, v, w), where u is the source node, v is the target node, and w is the time it takes for a signal to travel from source to target.
Now, we send a signal from a certain node K. How long will it take for a... | ALGO | 0.999952 | 6.094079 |
232569d0-129b-46e2-9e1b-2abaa799b0f4 | CPCFI-org/lectures | 2-Non-linear-data-structures/Lecture-4-NLDS-without-Built-in-Libraries-III/1-Fenwick-Tree/ch2_10_fenwicktree_ds.cpp | #include <cstdio>
#include <vector>
using namespace std;
typedef vector<int> vi;
#define LSOne(S) (S & (-S))
class FenwickTree {
private:
vi ft;
public:
FenwickTree() {}
// initialization: n + 1 zeroes, ignore index 0
FenwickTree(int n) { ft.assign(n + 1, 0); }
int rsq(int b) { ... | ALGO | 0.999831 | 4.210283 |
31f297dd-b2bf-4cae-a75f-8ba384dc7775 | ashmanmode/code-samples | GfG/try.cpp | #include <bits/stdc++.h>
using namespace std;
#define maxsiz 1000000
#define F first
#define S second
#define si(a) scanf("%d",&a)
#define sl(a) scanf("%llu",&a)
#define pi(a) printf("%d",a)
#define pl(a) printf("%llu",a)
#define fr(i,k,n) for(int i = k ; i < n ; i++ )
#define mp(a,b) make_pair(a,b)
#define pb(a) push... | ALGO | 0.970889 | 3.4951 |
93a257af-ea9c-4ed1-adf0-7b4e4a66a80e | ishandutta2007/codeforces | dacin21/normal/911/G.cpp | #pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
/*
* keeps the array as a union of sored ranges, where each range is stored in a BBST
* runs in amortized O((N+Q) (l... | ALGO | 0.99998 | 4.334334 |
30d616e9-38fb-4f2b-940f-6a30178bbb94 | Pastanaut/Marlin-2.1-for-Ender-3-Pro-with-3D-Touch | Marlin/src/feature/backlash.cpp | #include "../inc/MarlinConfigPre.h"
#if ENABLED(BACKLASH_COMPENSATION)
#include "backlash.h"
#include "../module/motion.h"
#include "../module/planner.h"
axis_bits_t Backlash::last_direction_bits;
xyz_long_t Backlash::residual_error{0};
#ifdef BACKLASH_DISTANCE_MM
#if ENABLED(BACKLASH_GCODE)
xyz_float_t Back... | TOOL | 0.951218 | 6.724175 |
280fab9d-25b9-42d9-976f-d2ce02b5c77c | davehardy20/Marlin-2.0.x-SKR-Mini-E3-v1.2 | Marlin/src/lcd/fontutils.cpp | /**
* @file fontutils.cpp
* @brief help functions for font and char
* @author Yunhui Fu (<EMAIL>)
* @version 1.0
* @date 2016-08-19
* @copyright GPL/BSD
*/
#include "../inc/MarlinConfig.h"
#if HAS_SPI_LCD
#include "ultralcd.h"
#include "../Marlin.h"
#endif
#include "fontutils.h"
uint8_t read_byt... | TOOL | 0.864088 | 5.407602 |
43432663-18f7-4b5b-83b9-4532f79f4cc1 | phrock/acm | uva/253-Cube_painting/2.cpp | #include <cctype>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <bitset>
#include <deque>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string... | ALGO | 0.999767 | 4.262367 |
e067b9fd-877b-4a82-a68d-71c0bfbdb1e4 | Nayrit/CodeForces | A_Max_Plus_Size.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
vector<int> a,b;
for (int i = 0; i < n; i++){
int x;
cin >> x;
a.push_back(x);
}
fo... | ALGO | 0.999824 | 4.444483 |
70c6efc1-92c5-4475-8811-b812c45218b2 | PRIYESHSINGH24/DSA | CODE360/QUICKSORT1.CPP | #include <bits/stdc++.h>
int partition(vector<int> &arr,int s, int e){
int pivot =arr[s];
int cnt=0;
for(int i=s+1; i<=e; i++)
{ if(arr[i]<=pivot){
cnt++;
}
}
int pivotIndex =s+cnt;
swap(arr[pivotIndex],arr[s]);
//left and right part
int i=s,j=e;
while(i<pivotIn... | ALGO | 0.999991 | 5.372955 |
1b628ad3-fa6d-4f3f-ae6f-9b86ec74d38a | tienit150198/ACM | codeforces/363B/main.cpp | #include <bits/stdc++.h>
#define ll long long int
#define fi fist
#define se second
#define pb push_back
#define mp make_pair
#define is insert
#define _auto int main()
#define Acepted return 0;
#define ipair pair<ll,ll>
#define spair pair<string,string>
#define debug(a,st,en) {for(ll i = st; i <= en ; i++) {cout << a[... | ALGO | 0.999973 | 4.332351 |
a65cff89-9081-4ced-9102-1bf8286ee9e2 | omar-besbes/competitive-programming | solutions/CSES/Introductory Problems/1092 - Two Sets.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, sum;
cin >> n;
sum = n * (n + 1) / 2;
if (sum & 1)
cout << "NO\n";
else if (n % 4 == 0) {
cout << "YES\n";
cout << n / 2 << "\n";
for (int i = 1; i <= n / 2; i += 2) cout << i << " " << n - i + 1 << " ";
cout... | ALGO | 0.999704 | 3.482203 |
cd692873-d76f-4f88-8272-6241e528c95a | fsq/hackerrank | Lonely Integer.cpp | #include "stdc++.h"
int main() {
int n, s = 0, x;
cin >> n;
FOR(i, n) {
cin >> x;
s ^= x;
}
cout << s << endl;
return 0;
} | ALGO | 0.999969 | 4.085873 |
225a80e1-bdb5-49c5-b3a6-7e33f7fa0caa | arpan-dey-xo/GeeksForGeeks-POTD | 12-02-25.cpp | class Solution {
public:
void tree(Node* root,vector<int>&ans) {
if(!root) return;
tree(root->left,ans);
ans.push_back(root->data);
tree(root->right,ans);
}
int kthSmallest(Node *root, int k) {
vector<int>ans;
tree(root,ans);
if... | ALGO | 0.999993 | 5.688241 |
11ee9d98-9f09-4ed8-aa81-2ac3e49a3e26 | nhat1368/tu-hoc-code | 14.3.cpp | #include <stdio.h>
int main()
{
int n;
printf("Enter n=");
scanf ("%d", &n);
int k=0, temp=0;
while (temp<n) {
++k;
temp=temp+k;
}
printf("K: %d\nSum:%d\n",k,temp);
return 0;
}
| ALGO | 0.998041 | 3.109935 |
cfa870f2-0fd0-489b-8282-1cb8cc790ffc | EkanshGupta-02/LeetCode-Solution | Bottom View of Binary Tree - GFG/bottom-view-of-binary-tree.cpp | // { Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
#define MAX_HEIGHT 100000
// Tree Node
struct Node
{
int data;
Node* left;
Node* right;
};
// Utility function to create a new Tree Node
Node* newNode(int val)
{
Node* temp = new Node;
temp->data = val;
temp->left = NULL;
... | ALGO | 0.999835 | 6.405159 |
53bda17e-a969-4063-bf6a-c3be5965814d | czerwonawykapturek/a41rrews | ri23jhr4io23_2/utils.cpp | #include <cstdio>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cstdlib>
#include <iostream>
#define KEYCHARS 16
#define STATES 256
#define LINELEN 8
#define KEYLEN 16
#define BYTESMAX 8
using namespace std;
int binaryToDecimal(char* binary)
{
int x = 0;
int result = 0;
int len = strlen... | ALGO | 0.999869 | 3.527914 |
e4b5a9fc-6ec4-4de2-9d37-8c7762afa720 | see3p00/ACM_code-base | ACM个人模版/树形dp(权值倍数统计).cpp | // 树上路径统计
// 统计 u-v路径权值和为xxxx的倍数
// 输出数量
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) static_cast<int>((x).size())
#define pii pair<int,int>
typedef long long ll;
typedef unsigned long long ull;
const int maxn=2e4+100;
std::vector<pii>G[maxn];int n;
ll dp[maxn][2019... | ALGO | 0.999943 | 3.891645 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.