uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
1641d748-2986-43cf-9912-029423399e61 | prachiparwani234/project-student-data | 1.cpp | #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
int main() {
int n;
// Ask user for the number of names
std::cout << "Enter the number of names: ";
std::cin >> n;
// Clear the input buffer before taking string inputs
std::cin.ignore();
// Vector to ho... | ALGO | 0.994791 | 6.587473 |
9fedfd3a-e1c1-465d-a6d6-325ecc01fd3b | dinhtai1104/ctdl_gt_D18 | COntest5/30.cpp | #include<bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
struct MT
{
long long a[2][2];
MT()
{
a[0][0] = 0;
a[0][1] = 1;
a[1][0] = a[1][1] = 1;
}
};
MT operator * (MT a, MT b)
{
MT x;
for (int i = 0; i < 2; i++)
{
for (int j = 0; j < 2; j++)
{
x.a[i][j] = 0;
for (int k = 0; k < 2; k+... | ALGO | 0.999861 | 4.197527 |
7215da84-b829-4ac3-8185-045a7cdc7dc4 | KetanABSoft/NewFollowUp | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.9988 | 6.76073 |
eaedd18e-981e-45a3-b4fe-26e6eb9910dd | SenseLogic/MYST | BOOST/boost_1_76_0/libs/compute/perf/perf_reverse_copy.cpp | #include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>
#include <boost/compute/system.hpp>
#include <boost/compute/algorithm/reverse_copy.hpp>
#include <boost/compute/container/vector.hpp>
#include "perf.hpp"
int rand_int()
{
return static_cast<int>((rand() / double(RAND_MAX)) * 25.0);
}
... | ALGO | 0.960963 | 5.542444 |
e7eb071c-1660-4066-aaf9-915a3936b5c7 | mkp0/CP | CodeForce/C - Parsa's Humongous Tree.cpp | #include <bits/stdc++.h>
#define IOS \
ios::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
#define ll long long
#define pi (3.141592653589)
#define all(x) (x).begin(), (x).end()
#define vi vector<int>
#define vll vector<long long>
#define pii pair<int, int>
#define pll pair<... | ALGO | 0.999637 | 4.046185 |
dfe916d4-5325-4c75-bfbf-82ea7c7430a4 | sanjaytharagesh31/codestuff | problems/power_rec.cpp | #include<iostream>
using namespace std;
int power(int x, int n){
if(n == 1)
return x;
int smallAnswer = power(x, n-1);
return x * smallAnswer;
}
int main(){
int x, n;
cin >> x >> n;
cout << power(x, n) << endl;
return 0;
}
| ALGO | 0.999973 | 5.025785 |
14041135-d40d-4dbb-a95a-e78e4e3960fe | hfudev/leetcode-cpp | 3.longest-substring-without-repeating-characters.cpp | /*
* @lc app=leetcode id=3 lang=cpp
*
* [3] Longest Substring Without Repeating Characters
*
* https://leetcode.com/problems/longest-substring-without-repeating-characters/description/
*
* algorithms
* Medium (28.11%)
* Likes: 5369
* Dislikes: 283
* Total Accepted: 897K
* Total Submissions: 3.2M
* Te... | ALGO | 0.999693 | 6.274056 |
06fa3b1b-c270-4082-8fd5-aa71a494a8ff | profetaRecursivo/proyecto2025 | practice/phi/H_Laser_Mirrors.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
const ll INF = 1e18;
const int tam = 100050;
vector<int> phi(tam + 1);
void euler() {
for (int i = 0; i <= tam; i++) phi[i] = i;
for (int i = 2; i <= tam; i++) {
if (phi[i] == i) {
for (int j = i; j <= tam; j += i) ... | ALGO | 0.999686 | 5.111571 |
cd64fffa-a1da-40f4-bdf4-2ba0a1e383ea | codingksj/Baekjoon-Solution | 백준/09000~09999/09000~09099/09009.cpp | #include<iostream>
#include<sstream>
#include<bitset>
#include<set>
#include<unordered_map>
#include<map>
#include<vector>
#include<queue>
#include<deque>
#include<stack>
#include<tuple>
#include<algorithm>
#include<string>
#include<numeric>
#include<functional>
#include<cmath>
#include<cctype>
#include<cstring>
#inclu... | ALGO | 0.999815 | 5.070218 |
f2979c65-798e-4660-adef-007025ac4ac5 | Githubiswhat/LeetCode | C++/src/Solution1_100/Solution5.cpp | //
// Created by windows on 2023/3/2.
//
#include "Solution5.h"
#include <functional>
#include <iostream>
#include <vector>
#include <unordered_set>
#include <unordered_map>
#include <string>
using namespace std;
#include <vector>
string Solution::longestPalindrome(string s) {
int n = s.size();
if (n < 2){
... | ALGO | 0.999872 | 6.00017 |
b5a96e48-1bae-4eac-8675-934f585ea1e1 | ishandutta2007/codeforces | teja349/normal/768/E.cpp | //teja349
#include <bits/stdc++.h>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip>
//setbase - cout << setbase (16); cout << 100 << end... | ALGO | 0.999942 | 3.806928 |
ce1636e4-0dce-43f5-81e5-cf89c1d3bd11 | AlvarezTDV/Ejercicios-de-arreglos | ejercicio20.cpp | #include <iostream>
#include <string>
using namespace std;
// FUNCION PARA CALCULAR EL PROMEDIO ANUAL DE VENTAS
double calcularPromedioVentas(double ventas[], int numMeses) {
double sumaVentas = 0.0;
for (int i = 0; i < numMeses; i++) {
sumaVentas += ventas[i];
}
return sumaVentas / numMeses;
}... | TOOL | 0.998007 | 5.818119 |
d2bc0b28-0ed7-4201-84bc-55390619b669 | Yousha34/Array-manipulation | RotateArray.cpp | #include<iostream>
using namespace std ;
void my_function( int arr[], int starting_pt, int ending_pt ){
for( int i = starting_pt, j = ending_pt ; i < j; i++, j-- ){
arr[i] = arr[i] + arr[j] ;
arr[j] = arr[i] - arr[j] ;
arr[i] = arr[i] - arr[j] ;
}
return ;
}
int main()... | ALGO | 0.99997 | 3.286051 |
e44a6c20-3aa5-4b8c-b2d1-d579a4af567e | keeganryan/flatter | src/math/mpfr_blas.cpp | #include "mpfr_blas.h"
#include <cassert>
#include "problems/matrix_multiplication/tri_matmul.h"
#include "workspace_buffer.h"
static mpfr_rnd_t rnd = mpfr_get_default_rounding_mode();
void copy(unsigned int n, mpfr_t* x, unsigned int incx, mpfr_t* y, unsigned int incy) {
for (unsigned int i = 0; i < n; i++) {
... | ALGO | 0.998527 | 6.356065 |
226d42fe-1c11-49c5-8da5-9342c1efaaf4 | minogump/Leetcode | 66-PlusOne/PlusOne.cpp | #include <iostream>
#include <vector>
using namespace std;
class Solution {
public:
vector<int> plusOne(vector<int> &digits) {
if (digits.size() == 0) return vector<int>(1,1);
int carry = 1;
for (int i = digits.size()-1; i >= 0; --i) {
if (carry == 1) {
digits... | ALGO | 0.999589 | 5.808894 |
de91f634-5033-4525-b11b-b197b8910eab | PrakritiGupta06/DSA | adjacentMatrix.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
//n=no. of nodes && m=no. of edges
int n, m;
cin >> n >> m;
//declaring adjacent 2D matrix of [n+1][n+1]size =>SC=O(n^2){better is using adjacent list}
int adj[n + 1][n + 1];//n+1 for 1 based indexing
for (int i = 0; i < m;i++)
{
... | ALGO | 0.999951 | 4.590382 |
bf075c10-ae25-4f13-bebf-09f32ca30227 | SophyaTs/VI_semester | RO/module1/Lab8/simple.cpp | #include <stdlib.h>
#include <stdio.h>
#include "mpi.h"
#include <time.h>
#include <sys/time.h>
#include <chrono>
void print_matrix(double *m, int n) {
int row, col;
for (row=0; row<n;row++){
for (col=0; col<n;col++){
printf("%.0f\t", m[row*n+col]);
}
printf("\n");
}
printf("\n");
}
int mai... | ALGO | 0.999046 | 4.074783 |
a48b4484-8448-4e14-ac1f-394309314c90 | AlmightyToastz/Source-SDK-Base-Ultimate | mp/src/game/shared/achievements_hlx.cpp | #include "cbase.h"
#ifdef GAME_DLL
// this gets compiled in for HL2 + Ep(X) only
#if ( defined( HL2_DLL ) || defined( HL2_EPISODIC ) ) && ( !defined ( PORTAL ) )
#include "baseachievement.h"
#include "prop_combine_ball.h"
#include "combine_mine.h"
#include "basegrenade_shared.h"
#include "basehlcombatweapon_shared.h... | ALGO | 0.881435 | 6.172215 |
2fa4b996-bb00-4927-8951-94bb07f4bfbb | ANI-IN/leetcode | 0867-transpose-matrix/0867-transpose-matrix.cpp | class Solution {
public:
vector<vector<int>> transpose(vector<vector<int>>& matrix) {
int n=matrix.size();
int m=matrix[0].size();
vector<vector<int>> ans(m,vector<int>(n,0));
for(int i=0;i<n;i++)
{
for(int j=0;j<m;j++)
{
... | ALGO | 0.999991 | 6.322731 |
0a8245fc-746b-4247-bce5-45a65a157b3f | Snigdha-clo/dsalab1 | lab10/lab11/11b.cpp | #include <iostream>
using namespace std;
const int TABLE_SIZE = 10;
const int EMPTY = -1;
const int DELETED = -2;
class HashTable{
private:
int table[TABLE_SIZE];
public:
HashTable(){
for(int i = 0; i< TABLE_SIZE; i++){
table[i] = EMPTY;
}
}
... | ALGO | 0.999255 | 5.33613 |
b9a4bf63-799b-4739-ab69-0c112a4e1705 | chinmayjainnnn/CPP | 1791-richest-customer-wealth/richest-customer-wealth.cpp | class Solution {
public:
int maximumWealth(vector<vector<int>>& accounts) {
int max=0;
for(int i=0; i<accounts.size();i++ )
{
int sum=0;
for(int j=0; j<accounts[0].size();j++ )
{
sum+=accounts[i][j];
if(sum>max){max=sum;}
... | ALGO | 0.999126 | 5.911774 |
fb7c7671-e9ec-4dc9-9454-6ea78ad15496 | has2/Problem-Solving | boj-solved.ac/Silver1/2302.cpp | #include <cstdio>
#include <cstring>
#include <vector>
using namespace std;
int N,M,dp[41],ans=1;
int sol(int n){
if(n<=1) return 1;
int& ret = dp[n];
if(ret!=-1) return ret;
ret=sol(n-1)+sol(n-2);
return ret;
}
int main(){
vector<int> v;
scanf("%d%d",&N,&M);
v.push_back(0);
for(int ... | ALGO | 0.999977 | 3.778375 |
4080ad44-9e92-4a3d-aca9-06a615d2f1f0 | miiitomi/atcoder | CountDown/typical90/h.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e+9 + 7;
int main() {
int N;
string S;
cin >> N >> S;
string atcoder = "atcoder";
vector<vector<ll>> dp(8, vector<ll>(N+1, 0));
dp[7].assign(N+1, 1);
for (int i = 6; i >= 0; i--) {
char c = atcoder... | ALGO | 0.999975 | 4.62219 |
8396c834-cdce-4d31-9b5f-77db3dcc20e1 | zia002/Data-Structure-and-Algorithm | Sorting/Shell sort.cpp | //Shell Sort
#include<bits/stdc++.h>
using namespace std;
void shellsort(int arr[],int n)
{
int i,j,gap;
for(gap=n/2 ; gap>=1 ; gap=gap/2)
{
for(j=gap; j<n ; j++)
{
for(i=(j-gap) ; i>=0 ; i=(i-gap))
{
if(arr[i+gap]>arr[i])
{
... | ALGO | 0.999951 | 4.131767 |
ba22d44f-df01-467c-a145-08e5f92bf3f1 | Fusion3Design/F3slic3r | src/slic3r/GUI/TextLines.cpp | #include "TextLines.hpp"
#include <GL/glew.h>
#include "libslic3r/Model.hpp"
#include "libslic3r/Emboss.hpp"
#include "libslic3r/TriangleMeshSlicer.hpp"
#include "libslic3r/Tesselate.hpp"
#include "libslic3r/AABBTreeLines.hpp"
#include "libslic3r/ExPolygonsIndex.hpp"
#include "libslic3r/ClipperUtils.hpp"
#include ... | TOOL | 0.954388 | 6.178145 |
c64f49d6-27dd-4a78-bc58-526e5698dbdc | st117209/2023-cpp-autumn | 2024.03.29-homework-8/Project4/№10.cpp | #include<iostream>
struct SEdge {
int a;
int b;
int w;
SEdge(int a = 0, int b = 0, int w = 1) : a(a), b(b), w(w) {}
SEdge(const SEdge& src) : a(src.a), b(src.b), w(src.w) {}
~SEdge() {}
void set(int a, int b, int w)
{
this->a = a;
this->b = b;
this->w = w;
}
friend std::ostream& operator<<(std::ostream... | ALGO | 0.999809 | 4.258731 |
84d23fe1-0571-41d7-89f9-8785d3a336ab | keoniburns/parallelized-Phase-Vocoder | smb_starter.cpp | #include <math.h>
#include <stdio.h>
#include <string.h>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <vector>
#include "AudioFile.h"
#define M_PI 3.14159265358979323846
#define MAX_FRAME_LENGTH 8192
using std::cout;
using std::endl;
using std::setprecision;
using std::string;
using std::vector... | ALGO | 0.991129 | 5.01223 |
a6a722b3-9154-4bfd-b36c-93e38a886417 | Ramyrashad127/c- | KMP.cpp | #include <bits/stdc++.h>
using namespace std;
// دالة لحساب lps = longest prefix which is also suffix
vector<int> computeLPS(const string &pattern) {
int m = pattern.size();
vector<int> lps(m);
int len = 0; // طول الـ prefix اللي هو برضه suffix
lps[0] = 0; // أول واحد دايمًا صفر
int i = 1;
wh... | ALGO | 0.999804 | 6.027974 |
14c84968-f08b-429c-9f07-9fff51feda18 | ViceroyFaust/AdventOfCode2020 | Day4/PassportProcRemakeP2.cpp | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
std::vector<std::string> splitString(const std::string& str, std::string delim = " ") {
typedef std::string::size_type index;
std::vector<std::string> output;
index start = 0U;
index end = str.find(delim);
while (end != st... | ALGO | 0.943482 | 5.510303 |
05e40d8b-b248-4b62-b20f-8ee53821e6a4 | abhishekbathena/Data-structures-and-Algorithms-Q-A | 2130-maximum-twin-sum-of-a-linked-list/2130-maximum-twin-sum-of-a-linked-list.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
int pairSum(ListNode*... | ALGO | 0.99999 | 5.492082 |
73a415c6-6980-43ca-997e-4cf861ad4c6f | cbraghav/CPP-LV-Sampoorna | Lect 35 Graphs 3/floodfill.cpp | class Solution {
public:
void dfs(vector<vector<int>>& image, int sr, int sc, int initcolor,
int finalcolor) {
if (sr >= 0 and sr < image.size() and sc >= 0 and
sc < image[sr].size() and image[sr][sc] != initcolor) {
return;
}
image[sr][sc] = finalcolor;... | ALGO | 0.999659 | 6.204903 |
9f9be9c3-143c-4c18-8987-cf5867c7769e | metanmai/LeetCode-Submissions | 2256-minimum-average-difference/2256-minimum-average-difference.cpp | class Solution {
public:
int minimumAverageDifference(vector<int>& nums) {
int n = nums.size(), minDiff = INT_MAX, minIndex;
vector<long> leftAvg(n), rightAvg(n);
leftAvg[0] = nums[0], rightAvg[n - 1] = nums[n - 1];
for(int i = 1; i < n; i++)
{
leftAvg[i]... | ALGO | 0.999973 | 6.72884 |
e0735141-d6be-426b-80d6-abc963602d48 | ragib04/DSA | 3788-maximum-unique-subarray-sum-after-deletion/3788-maximum-unique-subarray-sum-after-deletion.cpp | class Solution {
public:
int maxSum(vector<int>& nums) {
bitset<101> seen=0;
int sum=0, M=-100;
for(int x: nums){
M=max(M, x);
if (x>=0 && !seen[x]){
sum+=x;
seen[x]=1;
}
}
return seen==0?M:sum;
}
}; | ALGO | 0.999932 | 5.83899 |
2ccd2d43-8a64-4e3b-851c-744da8d0b748 | acme31/acme-oss-02 | pointerEX.cpp | /* Quiz #10 다음 이차원배열을 출력하세요.
int c[3][5] = { {1, 3, 5, 77, 9}, {10, 20, 3, 4, -1}, {0, 0, 8, 5, 3} };
(1) 이중 for문 이용
(2) 단일 for문 이용 (힌트: 포인터 사용)
*/
/*
#include<iostream>
using namespace std;
int main(){
int c[3][5] = { {1, 3, 5, 77, 9}, {10, 20, 3, 4, -1}, {0, 0, 8, 5, 3} };
for (int i=0; i<15; i++){
co... | ALGO | 0.997235 | 3.017114 |
767a5f99-d8d7-40d9-850f-73ce32a61319 | 0xnomy/second-semester-cpp | Assignment 1.cpp | #include <iostream>
#include <limits>
using namespace std;
struct Course
{
int ID;
string CourseName;
string teacher;
int fee;
int creditHours;
int printAll()
{
cout << "ID: "<< ID <<
"Course Name: "
<< CourseName << endl
<< "Teacher: "
... | TOOL | 0.853021 | 3.251779 |
e9a02ddd-019d-4d53-b996-cd3c5094b88f | suraj101998/LeetCodeSolutions | 1600-1699/1662.Check If Two String Arrays are Equivalent/Solution.cpp | class Solution {
public:
bool arrayStringsAreEqual(vector<string>& word1, vector<string>& word2) {
return reduce(word1.cbegin(), word1.cend()) == reduce(word2.cbegin(), word2.cend());
}
}; | ALGO | 0.999525 | 6.44279 |
f29dafd2-0be0-4bb2-9343-e1188014f825 | Maverick161/Extraclase_app | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998859 | 6.785645 |
5c5202db-dcc0-467e-b485-b4e082492eef | lclpsoz/competitive-programming | ATC/atc-abc177/B.cpp | #include "bits/stdc++.h"
#include "ext/pb_ds/tree_policy.hpp"
#include "ext/pb_ds/assoc_container.hpp"
using namespace std;
////////////// Prewritten code follows. Look down for solution. ////////////////
#define x first
#define y second
#define LEN(x) ((int)(x).size())
#define ALL(x) x.begin(), x.end()
using ll = long... | ALGO | 0.999986 | 4.03439 |
f5ebd602-ae7d-4ca1-a3eb-9e14298f8566 | moharamfatema/algorithms-problem-solving | sum of strings/sumOfStr.cpp | #include <iostream>
#include <string>
#include <math.h>
std::string addStrings(std::string num1, std::string num2)
{
const int n = num1.length();
const int m = num2.length();
const int minLength = (n < m) ? n : m;
const int maxLength = (n > m) ? n : m;
char sum[maxLength + 2];
sum[maxLength + ... | ALGO | 0.99898 | 5.451061 |
08feb814-d7a2-40eb-8d2c-5ceff6feaf21 | okuraofvegetable/AtCoder | atcoder.jp/acl1/acl1_a/Main.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define eps 1e-9
#define INF 2000000000 // 2e9
#define LLINF 2000000000000000000ll // 2e18 (llmax:9e18)
#define all(x) (x).begin(), (x).end()
#define sq(x) ((x) * (x))
#ifndef LOCAL
#define dmp(...) ;
#else
#d... | ALGO | 0.999884 | 4.591395 |
b2478217-1e1e-431a-ba3b-bfb20201b979 | ysyisyourbrother/Galaxy-MNN | tools/train/source/nn/Distributions.cpp | #include "Distributions.hpp"
#include <cmath>
namespace MNN {
namespace Express {
void Distributions::uniform(const int count, const float min, const float max, float *r, std::mt19937 gen) {
std::uniform_real_distribution<float> dis(min, max);
for (int i = 0; i < count; i++) {
r[i] = dis(gen);
}
}... | TOOL | 0.916611 | 4.361592 |
eb0e2385-7c51-4dfb-a1f9-91b1064b9066 | huiwang17/Algorithm | T/leetcode/editor/en/[220]Contains Duplicate III.cpp | /**
Given an integer array nums and two integers k and t, return true if there are
two distinct indices i and j in the array such that abs(nums[i] - nums[j]) <= t
and abs(i - j) <= k.
Example 1:
Input: nums = [1,2,3,1], k = 3, t = 0
Output: true
Example 2:
Input: nums = [1,0,1,1], k = 1, t = 2
Output: true
Ex... | ALGO | 0.999895 | 6.626966 |
bae84078-bb50-49fc-8de8-9942c4dc51a3 | TheActualRen/DSA | leetcode/roadmap/04. Binary Search/2. Search a 2D Matrix/main.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution {
public:
bool searchMatrix(vector<vector<int>> &matrix, int target) {
int rows = matrix.size();
int cols = matrix[0].size();
int low = 0;
int high = rows * cols - 1;
while (low <= high) {
int mp = low + (high - low) / 2;
int m_val =... | ALGO | 0.999761 | 5.722137 |
8df4cc2e-2ec4-4021-81dd-4a2f450ba628 | raincross7/code-similarity | codes/train_code/problem149/problem149_119.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
long long int n;
cin>>n;
vector<long long> a(n);
for(long long i=0; i<n; i++) cin>>a[i];
sort(a.begin(), a.end());
a.erase(unique(a.begin(), a.end()), a.end());
if(a.size()%2!=0) cout<<a.size()<<endl;
else if(a.size()%2==0) cout<<a.size... | ALGO | 0.999323 | 3.768739 |
62df5043-2406-4c63-b19d-6d3699ce76df | shobhitexp/DSA_jain_university | recursion.cpp | #include<iostream>
using namespace std;
int factorial(int n);
int main() {
int n;
cout << "Enter a positive integer: ";
cin >> n;
cout << "Factorial of " << n << " = " << factorial(n);
return 0;
}
int factorial(int n) {
if(n > 1)
return n * factorial(n - 1);
else
return 1;
}
-----------------------------
output:- ... | ALGO | 0.999866 | 4.469374 |
b4dbb006-caae-4467-8acb-8adb11a69a2b | hhhnnn2112/NOI-ACcode-Explanation | Explanation2/P3082.cpp | #include <bits/stdc++.h>
using namespace std;
string c, s;
int t[1020][26];
int f[1020];
int g[1020];
int main()
{
cin >> c >> s;
int n = c.size();
int m = s.size();
for (int i = 1; i <= m; i++)
{
int u = t[i - 1][s[i - 1] - 'a'];
t[i - 1][s[i - 1] - 'a'] = i;
for (int j = 0; j < 26; j++)
{
t[i][j] = t[... | ALGO | 0.999988 | 3.569205 |
e2c47197-db19-4c4c-b032-15bf1b49f2e9 | Shruti12130/Leetcode-Problems | 0089-gray-code/0089-gray-code.cpp | class Solution {
public:
vector<int> grayCode(int n) {
//Every time we just twiced the values in the prev result and
//new values are just made by setting (n-1)th bit to 1,
//iterating from right in the prev result ;
vector<int> ans;
ans.push_back(0);
... | ALGO | 0.999974 | 5.878147 |
038ccd03-c196-46b4-a4cd-eb1225aaf921 | mewhotheboss/CodeForces | 785A_Anton_and_Polyhedrons.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n,sum=0;
string s;
cin>>n;
while(n--)
{
cin>>s;
if(s == "Tetrahedron")
{
sum = sum + 4;
}
else if(s == "Cube")
{
sum = sum + 6;
}
else if(s == "Oc... | ALGO | 0.997575 | 4.755151 |
e451ea1f-cd5e-4f4b-bf83-c4d966a8c7e7 | savari-jawale/Cryptography-and-Network-Security-Programs | HillCipher.cpp | #include <iostream>
#include <vector>
#include <string>
#include <cmath>
using namespace std;
// Function to find the modular inverse of a number modulo 26
int modInverse(int a, int m) {
for (int x = 1; x < m; x++) {
if ((a * x) % m == 1)
return x;
}
return -1; // In case the modular i... | ALGO | 0.999921 | 6.550829 |
84f61d4c-5973-436d-b4f2-b512c8c8248c | rosekc/cpp | acm/contest/2016/inter/test.cpp | #include <iostream>
#include <cmath>
using namespace std;
const int wr[ 4 ] = { -1, 0, 1, 0 };
const int wc[ 4 ] = { 0, 1, 0, -1 };
int chooseWay();
int main()
{
int r, c;
int pace = 5;
cin >> r >> c;
int lab[ r ][ c ];
int f[ r ][ c ] = { 600 };
int g[ r ][ c ] = { 600 };
int h[ r ][ c ];
bool open[ r ][ ... | ALGO | 0.999683 | 3.62224 |
ec98c0ef-5606-4d51-a294-f5f7f0789dad | shivam77726/master | CPP/LMS-Inheritance/checkInData.cpp | #include "includes.h"
#include "class.h"
#include <bits/stdc++.h>
bool Book:: checkInData(char *author, char *title)
{
char *s1=author;
char *s2=title;
char *s3=Author;
char *s4=Title;
#ifdef DEBUG
cout<<__FILE__<<" "<<__func__<<": Begin"<<endl;
#endif
/* transform(s1, s1+strlen(s1), s1, ::toupper);
tra... | TOOL | 0.85969 | 3.42909 |
f0d2b5d2-575a-4d8d-8c78-1ae77e3372be | zouwuhe/tottori_cvlab | calibrate_based on stored data1/calibration.cpp | //ԻkinectϣʵּʻԱҰԶȡϵͳúҪʵָϵͳIJ궨
//УƻͨrgbͼѡȡԼڿӵ㣬ʵʱȡϵй۲ݣھС
//УЩ۲ݣڱʵһϵвı궨kinect1kinect2 ơ˵߷ƫУ
//observed quantity:r1,r2,r3,Px,Py,Pz,Qx,Qy,Qz;
//parameter:theta,phi,omega,alpha,beta,X0,Y0,Z0 corresponding to x[0],x[1]... ...x[7];
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <cv.h>
#in... | ALGO | 0.996551 | 3.806711 |
33a37356-ba09-4031-ace1-e9209831e34e | longpth/RoLabsSlam | ThirdParty/eigen/doc/examples/TemplateKeyword_simple.cpp | #include <Eigen/Dense>
#include <iostream>
using Eigen::MatrixXf;
void copyUpperTriangularPart(MatrixXf& dst, const MatrixXf& src) {
dst.triangularView<Eigen::Upper>() = src.triangularView<Eigen::Upper>();
}
int main() {
MatrixXf m1 = MatrixXf::Ones(4, 4);
MatrixXf m2 = MatrixXf::Random(4, 4);
std::cout << "... | ALGO | 0.99531 | 5.294886 |
78888bab-6827-4630-8250-7eb15239ad3c | ayerhssb/DSA-PREP | Unique Length-3 Palindromic Subsequences.cpp | class Solution {
public:
int countPalindromicSubsequence(string s) {
unordered_map<char,pair<int,int>> mp;
int cnt=0;
for(int i=0;i<s.size();i++){
if(mp.find(s[i])==mp.end()){
mp[s[i]].first=i;
mp[s[i]].second=i;
}
else{
... | ALGO | 0.999898 | 6.293203 |
3430049d-f9ea-455e-bfa8-2911005043d0 | jeongwwon/CodingTest | 6/드래곤 앤 던전.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n, attack, t[130005], a[130005], h[130005], lo, hi, ret;
bool check(ll mid) {
ll mxHP = mid;
ll init_attack = attack;
for (int i = 0; i < n; i++) {
if (t[i] == 2) {
mid = min(mxHP, mid + h[i]);
init_attack += a[i];
}
else {
ll cnt =... | ALGO | 0.999939 | 3.530479 |
ffb1822a-fc76-4948-a863-26aef3e74184 | shiver/blaze-lib | blazemark/src/armadillo/Complex8.cpp | //=================================================================================================
//=================================================================================================
//*************************************************************************************************
// Includes
//****... | ALGO | 0.993975 | 4.883544 |
bfae2c9a-03dc-444c-8765-31b64025b83d | Anik-Modak/CompetitiveProgramming | Timus Online judge/1209. 1, 10, 100.timus.cpp | #include<bits/stdc++.h>
using namespace std;
string a;
void abc(){
int n=10,m=5;
string b="1000";
a="1101001000";
while(n<=999999)
{
b=b+'0';
a=a+b;
n=n+m;
m++;
}
}
int main()
{
int i,n,t;
abc();
cin>>t;
for(i=1;i<=t;i++)
{
scanf("%d",... | ALGO | 0.999127 | 3.023133 |
83f4f56d-d99e-4a82-8697-7f1dee575f34 | alfariqicrypto/jagoancoin | src/key.cpp | #include <key.h>
#include <arith_uint256.h>
#include <crypto/common.h>
#include <crypto/hmac_sha512.h>
#include <random.h>
#include <secp256k1.h>
#include <secp256k1_recovery.h>
static secp256k1_context* secp256k1_context_sign = nullptr;
/** These functions are taken from the libsecp256k1 distribution and are very ... | TOOL | 0.928436 | 7.198978 |
e4db1506-0bbb-4915-b451-3b8e8082cd46 | Riya-Rawat12/DAA | DFS.cpp | #include<bits/stdc++.h>
using namespace std;
void addedge(vector<int>adj[],int u,int v)
{
adj[u].push_back(v);
adj[v].push_back(u);
}
void dfs(vector<int> adj[],bool visited[],int u)
{
visited[u]=true;
cout<<u<<" ";
for(auto it:adj[u])
{
if(!visited[it])
dfs(adj,visited,it);
... | ALGO | 0.999887 | 4.850773 |
6819082e-28e1-4edd-a86e-7521532f0133 | t0iki/programCompetition | yukicoder/29.cpp | #include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctype.h>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#i... | ALGO | 0.999815 | 3.909654 |
ef6e03b7-206b-48ff-9c5f-6f62112d822a | lalor/leetcode | chenhao/algorithms/removeElement/removeElement.cpp | // Source : https://oj.leetcode.com/problems/remove-element/
// Author : Hao Chen
// Date : 2014-06-19
/**********************************************************************************
*
* Given an array and a value, remove all instances of that value in place and return the new length.
*
* The order of element... | ALGO | 0.999733 | 6.236334 |
b4229aef-4b4d-4364-8e5b-18ff81c9b706 | ahmed-f-alrefaie/CEXSY | Workers/CPU/ThreadWorker.cpp | #include "ThreadWorker.h"
#include "../../common/Timer.h"
#include "fmath.hpp"
#include <algorithm>
/* bool* threads_done;
bool master_thread_done;
int total_threads;
std::vector<std::thread> workers;
std::thread* master_thread;
double** t_intens;
double* g_freq;
double* g_intens;
double* g_energies;
... | TOOL | 0.989687 | 3.650717 |
2237b4c2-4ad6-4fac-a941-1cb640e1f573 | crispychris101/csce121 | zybooks/7. Designing a Class and UML/7.6 Vector push_back/7.6.1_Making_and_using_vectors_1.cpp | #include <iostream>
#include <vector>
using namespace std;
int main() {
vector<int> numberVector;
int value;
int i;
value = 0;
while (value != -1) {
cin >> value;
if (value != -1) {
numberVector.push_back(value);
}
}
for (i = 0; i < numberVector.size(); ++i) {
cout << numberVector... | ALGO | 0.995834 | 3.627635 |
0d7c51e7-4fc3-4643-a5cb-22015f9b1a5a | raincross7/code-similarity | codes/train_code/problem183/problem183_19.cpp | #include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long ll;
typedef pair<ll, ll> PLL;
typedef vector<int> VI;
typedef vector<char> VC;
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<ll> VLL;
typedef vector<PLL> VP;
const static int INF = 1000000000;
const stati... | ALGO | 0.999972 | 4.242835 |
633e99a5-5393-454e-94c9-92cce7a65922 | Dyyt587/OCS2_ROS2 | ocs2_core/src/loopshaping/LoopshapingDefinition.cpp | #include "ocs2_core/loopshaping/LoopshapingDefinition.h"
#include <iostream>
namespace ocs2 {
LoopshapingDefinition::LoopshapingDefinition(LoopshapingType loopshapingType, Filter filter, matrix_t costMatrix)
: loopshapingType_(loopshapingType), filter_(std::move(filter)), R_(std::move(costMatrix)) {
if (filter... | ALGO | 0.967907 | 6.260059 |
2bd48fd0-a19c-4ab5-a6c6-2ad5ca06c562 | ishandutta2007/codeforces | axs7384/normal/1511/E.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
const int mod=998244353;
const int N=300005;
vector<char> c[N];
inline int ksm(int x,int y)
{
if (y<0)
return 0;
int ans=1;
for (;y;y/=2,x=(ll)x*x%mod)
if (y&1)
ans=(ll)ans*x%mod;
return ans;
}
int n,m,f[N],S,ans,p;
int main()
{
scanf("%d%d",... | ALGO | 0.999919 | 3.915251 |
1da8d4bb-63d1-4e49-a54f-312c2a3fc0f7 | byhorn/cpp | template/special.cpp |
template <typename T>
T absoluteValue(T value) {
return value < 0 ? -value : value;
}
template <> // Specialized template function for absolute value of double
double absoluteValue(double value) {
std::cout << "specialized function for double type" << std::endl;
return value < 0 ? -value : value;
}
int main(void)... | TOOL | 0.97218 | 6.181348 |
8e08082e-dfe8-43c3-8644-f2baaf380dc4 | jhn5052/BOJsolution | NandM4.cpp | #include<iostream>
#include<vector>
using namespace std;
int N, M;
vector<int> v;
void recur(int num){
if(num == M){
for(int i = 0; i < M; i++){
cout << v[i] << ' ';
}
cout << '\n';
return;
}
for(int i = 0; i < N; i++){
if(num >= 1 && v[num-1] > i+1){
... | ALGO | 0.999934 | 4.039432 |
8b090229-ee37-4395-a27d-e4028237e8e0 | bhpayne/learn-cplusplus | labfiles_from_zip/examples/4/4-33/4-33.cpp | //
// 4-33.cpp
//
#include <iostream>
using namespace std;
#include "Loan.h"
double sumLoans(Loan *loans, int howmany);
double avgInterest(Loan *loans, int howmany);
int main()
{
Loan loans[] = { Loan("mike", 30, 100000,8.0),
Loan("susan", 20, 75000),
Loan("erin", 10)
... | TOOL | 0.853002 | 4.187562 |
a60236e9-a347-4342-91c5-9e53668d5fdc | SuvratZZZ/solved | solved/codevitaR2/cv2g.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#ifndef ONLINE_JUDGE
#include <chrono>
#endif
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update... | ALGO | 0.992397 | 4.793515 |
63af41a5-5fe7-4476-b8c8-5bae26d7e5bf | barkhayadav12/Striver-SDE-Sheet-Challenge | Day 25 Dynamic Programming 2/q1_egg_dropping_problem.cpp | // this gives tle
// no. of attempts dhundhna hai (min)
// Question? Worst case mein kitne floors check krne honge, unn worst cases mein se min nikalni hai
class Solution
{
public:
int solve(int k, int n, vector<vector<int>> &dp)
{
// base case
// agar no. of floors 0 hua toh 0 attempts krne hon... | ALGO | 0.999852 | 6.041543 |
264aeeb1-aa73-40d6-9e8d-d57bff16f07b | Gal-Erdene-dreamer/Competitive-Programming | Olympiad/Spoj_Level5/RGB7390.cpp | #include <bits/stdc++.h>
using namespace std;
int fac (int a){
if(a == 1)
return 1;
else
return a * fac(a - 1);
}
int main(){
string s;
cin >> s;
int i;
sort(s.begin(), s.end());
int count[9], c = 0;
for(i = 0; i < 9; ++i)
count[i] = 1;
for(i = 0; i < s.length(); ++i){
if(s[i] == s[i+1]){
count... | ALGO | 0.999971 | 3.630854 |
626dfc12-ce52-4b8e-8745-225b16edc8ef | theanujsinha01/DSA-in-CPP | ARRAY/array_reverse.cpp | #include <bits/stdc++.h>
using namespace std;
vector<int> reverseArray(vector<int>& arr) {
int start = 0, end = arr.size() - 1;
while(start < end) {
swap(arr[start], arr[end]);
start++;
end--;
}
return arr; // Return the reversed array
}
int main() {
vector<int>arr = {... | ALGO | 0.999624 | 5.627086 |
958d13f7-7897-4907-866e-5931eeddfbbf | bzz13/timus | 1214/1214.cpp | #include <iostream>
using namespace std;
int main()
{
long x,y;
cin >> x >> y;
if (x <= 0 || y <= 0 || (x+y) % 2 == 0)
cout << x << " " << y;
else
cout << y << " " << x;
return 0;
} | ALGO | 0.999793 | 4.086309 |
6c839b60-7427-42e1-aefb-543eb8e2cfe3 | dbeniamine/Sofa_old | applications/projects/meshconv/tesselate.cpp | #include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <flowvr/render/mesh.h>
using namespace flowvr::render;
using ftl::Vec3f;
void projectOnSphere(Vec3f& p, Vec3f center, float radius)
{
p -= center;
p = p * (radius / p.norm());
p += center;
}
void projectOnSphere(Vec3f& p,Vec3f& n, Vec3f c... | ALGO | 0.984143 | 5.997533 |
351e88e1-814f-4c74-8a2a-3e31a802a0c0 | taegon98/PS-Cpp | 프로그래머스/lv1/92334. 신고 결과 받기/신고 결과 받기.cpp | #include <string>
#include <vector>
#include <map>
using namespace std;
map<string, int> mp, check, info;
vector<int> answer;
vector<string> v[1001];
vector<int> solution(vector<string> id_list, vector<string> report, int k) {
int idx = 0;
for (auto var : id_list) {
mp[var] = 0;
info[var] ... | ALGO | 0.999828 | 5.379604 |
ebdc7d9f-a7af-4993-93e2-6bf5e4395fc0 | liaojh1998/Competitive-Programming | SGU/Volume 1/Problemset/131.cpp | //Title: Hardwood Floor
//Type: State Compression + DP
//Solution: Still got to do more of this. State compression (into bits) + Dynamic Programming.
#include <cstdio>
#include <cstring>
#define binary(i) (1<<i)
#define empty(a, i) (!(a&binary(i)))
int N, M, max;
long long temp[1<<9], ans[1<<9];
void dfs(int a, int b, ... | ALGO | 0.999939 | 4.084173 |
359f9c1b-3941-4f13-9ea6-129cb7106b06 | MarshTheBacca/dotto-cpp | src/game.cpp | #include "game.h"
#include <algorithm>
#include <format> // std::format
#include <iostream>
#include <map>
#include <memory> // std::shared_ptr
#include <optional>
#include <ranges>
#include <set>
#include <sstream>
#include <string>
#include <tuple> // std::apply
#include <utility> // std::pair
#include <vector... | TOOL | 0.856175 | 6.525545 |
680c5b7f-901d-4dce-bdb0-d067cd3bab32 | marineliii/to_do_app | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998733 | 6.76775 |
898d3bc0-375d-4ef4-b469-d2eb9a86aafb | ImpulsE21x/Liceum-Informatika | Sapi/main.cpp | #include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main()
{
ifstream fin("hok.txt");
int n, m;
fin>>n>>m;
string honapok[12] = {"januar", "februar", "marcius", "aprilis", "majus", "junius", "julius", "augusztus", "szeptember", "oktober", "november", "december"};
s... | ALGO | 0.999382 | 3.126307 |
074c60eb-75c5-4855-ab93-3a94c70b3a8f | AndersonFCanel/C-PassoAPasso | examples/FactorialofaNumber#cpp#1/FactorialofaNumber#cpp#1.cpp | /*
Summary: Factorial is represented using '!', so five factorial will be written as (5!),n factorial as (n!).
n! = n*(n-1)*(n-2)*(n-3)...3.2.1 and zero factorial is defined as one i.e. 0! = 1.
*/
//Calling the Header File.
#include<iostream>
//Declaring the main function
int main()
{
//Tells the compiler th... | ALGO | 0.999792 | 4.976655 |
6149581b-fdb4-4a1f-b331-dbb6f1be5a2b | Me-k-01/ISIR | src/objects/sphere.cpp | #include "sphere.hpp"
namespace RT_ISICG
{
bool Sphere::intersect( const Ray & p_ray, const float p_tMin, const float p_tMax, HitRecord & p_hitRecord ) const
{
float t1;
float t2;
if ( _geometry.intersect( p_ray, t1, t2 ) )
{
if ( t1 > p_tMax ) { return false; } // first intersection too far
if ( t1... | ALGO | 0.906259 | 6.093155 |
3422879e-0334-4b0d-a095-70becd41e575 | alimdneaz/cpp_main_course_apna_college_last | 008_heap/129_sortHeap.cpp | #include"bits/stdc++.h"
#define vi vector<int>
#define rep(i,a,b) for(int i=a;i<b;i++)
using namespace std;
//! coded some bug
void heapify(vi &a,int n,int i){
int maxId = i;
int l = 2*i+1;
int r =2*i+2;
// checking the right and left child
if(l<n && a[i]>a[maxId]){
maxId = l;
}
if(r... | ALGO | 0.999953 | 3.92461 |
d300be3e-d5ee-4ed4-9998-d0bc44663795 | PainterLyu/llyy-EdgeLLM-Cpp-Inference | llyy.cpp/ggml/src/ggml-sycl/norm.cpp | #include "norm.hpp"
static void norm_f32(const float* x, float* dst, const int ncols, const float eps,
const sycl::nd_item<3>& item_ct1, sycl::float2* s_sum, int block_size) {
const int row = item_ct1.get_group(2) * item_ct1.get_local_range(1) +
item_ct1.get_local_id(1);
const int tid = item_ct1.ge... | ALGO | 0.977161 | 5.909599 |
60019efe-ca50-4705-a297-e264a443234c | JPOliverio/StiffnessMatrixMaker | eigen/unsupported/doc/examples/MatrixExponential.cpp | #include <unsupported/Eigen/MatrixFunctions>
#include <iostream>
using namespace Eigen;
int main()
{
const double pi = std::acos(-1.0);
MatrixXd A(3,3);
A << 0, -pi/4, 0,
pi/4, 0, 0,
0, 0, 0;
std::cout << "The matrix A is:\n" << A << "\n\n";
std::cout << "The matrix exponential ... | ALGO | 0.999812 | 3.706936 |
4f7f15e8-1e08-4eaf-96ce-677d3bd6bf76 | koba-e964/contest | atcoder/codefestival2014-qualb/c.cpp | #include <iostream>
#include <vector>
#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
using namespace std;
typedef long long int ll;
typedef vector<int> VI;
const int Q = 26;
VI to_freq(const string &s) {
VI f(Q);
REP(i, 0, s.length()) {
f[s[i] - 'A']++;
}
return f;
}
int main(void){
string a, b, c;
... | ALGO | 0.999972 | 3.638138 |
bd8014d2-d0ae-4683-8281-6b65ada4915a | Jai4/Algorithms | src/HackerEarth/Algorithms/Graphs/AgitatedChandan.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
typedef list<pll> lpll;
typedef vector<ll> vll;
typedef vector<pll> vpll;
typedef queue<pll> qpll;
#define sz size_t
#define forn(i,a,b) for(sz i=a;i<b;i++)
#define mp make_pair
#define pb push_back
class agitated
{
ll T,n,... | ALGO | 0.999863 | 3.764178 |
98db3d90-9fae-4e89-b7b4-7c7832bd54a4 | furyzenblade/ShadowPlay_Patcher | utils.cpp | #include "utils.h"
#include <algorithm> // For std::transform
#include <iostream> // For std::hex
#include <sstream> // For std::ostringstream
#include <iomanip> // For setfill
#include <unordered_map> // For std::unordered_map
#include <conio.h> // For _getch()
std::wstr... | TOOL | 0.98594 | 4.208509 |
de2b40df-3cfe-4d45-b2e5-5dad88efbb20 | maricarmen5/jutge-my-repository | src/X60152.cpp | #include <iostream>
using namespace std;
int main ()
{
char conductor;
double nivell_alcohol;
int anys = 0;
cin >> conductor >> nivell_alcohol;
if (conductor == 'p') cin >> anys;
if ((conductor == 'p' or (conductor == 'n' and anys < 2)) and
(0.15 < nivell_alcohol or (2 <= anys and 0.25 <... | ALGO | 0.985384 | 4.338995 |
f69c54a6-fc43-454b-9014-5bf30401e5b8 | kks227/BOJ | 1200/1236.cpp | #include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main(){
string input;
bool row[50]={0}, col[50]={0};
int rowcnt=0, colcnt=0;
int N, M;
cin >> N >> M;
for(int i=0; i<N; i++){
cin >> input;
for(int j=0; j<M; j++){
if(input[j] == 'X'){
if(!col[j]){
col[j] = true;... | ALGO | 0.99995 | 4.3182 |
c483cc99-aeb4-484a-b2be-5dd6f5aabda6 | tan5166/Leetcode-Solution | 114. Flatten Binary Tree to Linked List/main.cpp | #include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
using namespace std;
struct TreeNode
{
int val;
TreeNode *left;
TreeNode *right;
TreeNode() : val(0), left(nullptr), right(... | ALGO | 0.999924 | 5.487923 |
ec84dce5-ed3c-4d49-8e42-e753f0d2d378 | Xnco/Data-Structures-and-Algorithms | TitleProject_Cpp/0442_数组中重复的数据.cpp |
#pragma region 442_ظ
/*
һ a1 a[i] n nΪ鳤ȣ, ЩԪسζԪسһΡ
ҵгεԪء
Բõκζռ䲢O(n)ʱ临Ӷڽ
ʾ
:
[4,3,2,7,8,2,3,1]
:
[2,3]
ԴۣLeetCode
ӣhttps://leetcode-cn.com/problems/find-all-duplicates-in-an-array
ȨСҵתϵٷȨҵתע
*/
class Solution {
public:
// a[i] ±, ȡֵظres
//Runtime : 100 ms, faster than 97.64 % of C++ online submissions for Find Al... | ALGO | 0.999957 | 5.100286 |
264e9c81-8297-4ff4-a587-9173b8a97afe | Vijitverm1234/DSA-Revision-Journey- | GreedyAlgorithm/Hard/LRU_implement.cpp | class Node{
public:
int key;
int val;
Node* prev;
Node* next;
Node(int key,int val): key(key),val(val),prev(NULL), next(NULL){}
};
class LRUCache {
private:
void remove(Node* node){
Node* prevnode=node->prev;
Node* nextnode=node->next;
prevnode->next=nextnode;
nextnode... | ALGO | 0.99985 | 6.137558 |
a9a124ee-d18b-435f-97ba-ea77dbb794ab | geekquad/AlgoBook | cpp/sorting/BubbleSort.cpp | #include<iostream>
using namespace std;
void swapping(int &a, int &b)
{
int temp;
temp = a;
a = b;
b = temp;
}
void display(int *array, int size)
{
for(int i = 0; i<size; i++)
cout << array[i] << " ";
cout << endl;
}
void bubbleSort(int *array, int size)
{
for(int i = 0; i<size; i++)
{
... | ALGO | 0.999837 | 4.348713 |
d6c989a9-4b79-465c-8a8c-8998243ba6c0 | TosakaUCW/CompetitiveProgramming | Old/Luogu/[Luogu P1377] [TJOI2011]树的序.cpp | #include <stdio.h>
#include <algorithm>
#include <memory.h>
int read(int x = 0, int f = 0, char ch = getchar())
{
while (ch < 48 or ch > 57) f = ch == 45, ch = getchar();
while (48 <= ch and ch <= 57) x = x * 10 + ch - 48, ch = getchar();
return f ? -x : x;
}
const int N = 1e5 + 5;
int stk[N], top, a[N], ls[N], r... | ALGO | 0.999994 | 3.758845 |
b2b11cfe-9ce5-42c9-9e8c-04151bf6b3e4 | lbhsos/AlgoStudy | 2step_cpp/dfs/TargetNumber.cpp | #include <string>
#include <vector>
#include <iostream>
using namespace std;
int dfs(int sum, int idx,vector<int> numbers, int target){
if (sum == target && idx == numbers.size()) return 1;
if (idx >= numbers.size()) return 0;
int cur = numbers[idx];
return dfs(sum+cur, idx+1,numbers, target) +... | ALGO | 0.999904 | 5.39413 |
20d52006-a1df-4644-aba7-6d189482904c | faisalkn-71/XPSC | Week-8/Day-2/D_Divide_and_Equalize.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl "\n"
map<int, int> mp;
void prime(int n){
for(int i=2; i*i<=n; i++){
while(n%i==0){
n = n/i;
mp[i]++;
}
}
if(n>1) mp[n]++;
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(... | ALGO | 0.999469 | 4.418087 |
e8534b3a-3d32-48b6-b64a-7e9444baec0d | bachtran02/competitive-prog | CPC-meeting/21-22/01-13/E_-_Cheating_Amidakuji.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
ios::sync_with_stdio(false); cin.tie(nullptr);
int n, m; cin >> n >> m;
vector<int> arr(m + 1);
for (int i = 1; i <= m; i++)
cin >> arr[i];
vector<int> b(n + 1);
iota(b.begin(), b.end(), 0);
for (int i = 1; i <= m; i++){
... | ALGO | 0.999991 | 3.798973 |
a483476b-0847-4e36-aa36-a3d5d4309306 | alexandraback/datacollection | solutions_1482494_0/C++/Fory/Unit1.cpp | #include <stdio.h>
#include <algorithm>
#include <vector>
using namespace std;
struct TJuego{
int una,dos;
};
operator <(const TJuego &a,const TJuego &b)
{
if (a.dos!=b.dos){
return a.dos<b.dos;
}
return a.una>b.una;
}
int mejor;
int N;
int memoria[1001][2002];
void busca(vector<TJuego>&jue... | ALGO | 0.999657 | 3.751218 |
11abb28f-d82e-470a-8e3a-9cbb9ec47977 | NickLennonLiu/cpp | dsa/PA/PA1a/1-4/final/risk_1014.cpp | #include <iostream>
using namespace std;
/*
Honor Code:
- Discussed with:
关于根据p,q查询低风险/中风险天数的二分查找方法,曾与贾启珑讨论
关于维护区间最大值的的实现,曾与贾启珑讨论
关于基本数据类型long long int的选取,曾与龚然同学讨论
- Reference:
DSA2020Fall lecturenote 04.S+Q.XA.Steap+Queap.pdf
*/
// 归并排序
void mergeSort(long long int *s,long long int *t)
{
if (s == t || s == t - ... | ALGO | 0.999884 | 4.077463 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.