uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
d73198e5-81c4-4595-a827-710810e7e8bb | hecrw/Data-structures | tree_functions.cpp | #include <iostream>
#include <stack>
#include <algorithm>
using namespace std;
template <typename T>
struct node {
T data;
node* left, * right;
node(T val) : data(val), left(nullptr), right(nullptr) {};
void preorder(node<T>* root) {
if (root == nullptr) return;
cout << root->data << " ";
preorder(root->righ... | ALGO | 0.999949 | 4.706635 |
1fba752c-6d73-4a2c-b781-72c724e3a6ea | haitovs/codes-store | c++/nQueensAllSolutions.cpp | #include <bits/stdc++.h>
using namespace std;
const int BOARD_SIZE = 8; // Change this to any N value for N-Queens problem
int solutionCount = 0;
int queenPositions[BOARD_SIZE + 1]; // Index from 1 to BOARD_SIZE for easier readability
// Function to check if the current configuration is valid (no conflicts)
bool is... | ALGO | 0.999901 | 5.809362 |
ffa126c4-8b34-4491-85ef-54b5310a4a43 | Gurshrutisingh/Online_Judge | back-end/codes/4a1336dd-8eaf-4a1f-aa5b-75f1a135ff75.cpp | #include <bits/stdc++.h>
using namespace std;
int missingNumber(int array[], int n) {
int sum = 0;
for(int i=0;i<n-1;i++) sum += array[i];
return n*(n+1)/2 - sum;
}
int main(){
int n;
cin>>n;
int arr[n-1];
for(int i=0;i<n-1;i++){
cin>>arr[i];
}
cout<<missingNumber(arr,n)<<" ";
return 0;... | ALGO | 0.999839 | 3.545797 |
9023bac6-74ac-421c-8af7-f196d539e7e3 | talinke/lammps_langevin | src/EXTRA-MOLECULE/angle_gaussian.cpp | #include "angle_gaussian.h"
#include "atom.h"
#include "comm.h"
#include "domain.h"
#include "error.h"
#include "force.h"
#include "math_const.h"
#include "memory.h"
#include "neighbor.h"
#include <cmath>
#include <cstring>
using namespace LAMMPS_NS;
using namespace MathConst;
static constexpr double SMALL = 0.001;... | ALGO | 0.958885 | 6.380057 |
101583d4-d442-4fdf-9c50-4c4dc8362406 | caio-felipee/exercicios | icpc/helping_the_transit.cpp | // caio-felipee
//
#include <bits/stdc++.h>
using namespace std;
constexpr int MAX { 10'010 };
vector<int> adj[MAX], rev[MAX];
bitset<MAX> visited;
void dfs(int u, vector<int>& order)
{
if (visited[u])
return;
visited[u] = true;
for (auto v : adj[u])
dfs(v, order);
order.emplace_... | ALGO | 0.999621 | 4.724223 |
91a53304-09fa-451b-9e38-7ff9f26e790e | abufarhad/Codeforces-Problems-Solution | 467B Fedor and New Game.cpp | #include<bits/stdc++.h>
#include<stdio.h>
using namespace std;
#define ll long long
#define scl(n) cin>>n;
#define scc(c) cin>>c;
#define fr(i,n) for (ll i=0;i<n;i++)
#define fr1(i,n) for(ll i=1;i<=n;i++)
/*
tmp=bitset<20>(a[m]).to_string();
fr(i, m)
{
... | ALGO | 0.999861 | 3.6505 |
c37fcc3d-023d-40df-9a57-cdb17bebcdca | sm823zw/leetcode | 1319-number-of-operations-to-make-network-connected/1319-number-of-operations-to-make-network-connected.cpp | class Solution {
public:
void dfs(vector<int>adj[], int n, int i, vector<bool>&vis){
vis[i] = true;
for(int j=0;j<adj[i].size();j++){
if(!vis[adj[i][j]]){
dfs(adj, n, adj[i][j], vis);
}
}
}
int makeConnected(int n, vector<vector<int>>... | ALGO | 0.999892 | 5.777127 |
4795efe6-7ed2-4154-8e47-79d6a2df765c | to0d/leetcode | LT039301/LT039301.cpp | #include <lt_help/lt.h>
#define MASK_BIT_8 0x80
#define MASK_BIT_87 0xC0
#define MASK_BIT_876 0xE0
#define MASK_BIT_8765 0xF0
#define MASK_BIT_87654 0xF8
class Solution {
public:
bool validUtf8(vector<int>& data) {
int i = 0, size = data.size();
while(i < size)
{ int v0 = data[i];
... | ALGO | 0.978642 | 6.322937 |
da598b5c-26da-4e5b-80ca-84bfbc83b3e6 | JayBansod/cpp-code | Assignment/Day 10/Assi9.cpp | #include<iostream>
#include<crtdbg.h>
using namespace std;
class Node {
public:
int data;
Node* prev = nullptr;
Node* next = nullptr;
};
class LinkList {
public:
void addElement(Node*& head, int data) {
Node* newNode = new Node;
newNode->data = data;
// list is empty
if... | ALGO | 0.999903 | 5.733003 |
64bacea4-f628-47ff-9b23-9efe8d02c682 | pranavajith/CP-Practice | A_Divisible_Array.cpp | #include <bits/stdc++.h>
#include <iostream>
#include <set>
#include <cmath>
#include <map>
#include <sstream>
#include <deque>
#include <algorithm>
#include <limits>
#include <iomanip>
using namespace std;
#define ll long long
// #define TxtIO freopen("input.txt","r",stdin); freopen("output.txt","w",stdout); freopen... | ALGO | 0.999777 | 4.576749 |
575ca8b6-fd73-4315-a9e7-e8dfc1cb5bc3 | VIJAYKUMAR2435/Github_code | Difficulty: Medium/Iterative Postorder/iterative-postorder.cpp | //{ Driver Code Starts
//Initial Template for C++
#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... | ALGO | 0.999878 | 6.794937 |
913286c6-2988-4d84-ac83-1d3faac35131 | Stenardt-9002/LeetCode-Practice | POTD/2022/October/(9-10-22)-653-Two_sum_IV.cpp | // https://leetcode.com/problems/two-sum-iv-input-is-a-bst/
#include <bits/stdc++.h>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds ;
typedef long long int ll;
#define DEBUG_var 1
#define fastIO ios_base::sync_with_stdio(false);cin.tie(0);c... | ALGO | 0.999982 | 5.549002 |
846c105c-edec-4265-8f6f-d611ff377937 | zixinren/cocos2dx3.6- | tools/simulator/libsimulator/lib/ProjectConfig/ProjectConfig.cpp |
#include <sstream>
#include "ProjectConfig/ProjectConfig.h"
#include "ProjectConfig/SimulatorConfig.h"
#ifdef _MSC_VER
#define strcasecmp _stricmp
#endif
#if defined(_WINDOWS)
#define DIRECTORY_SEPARATOR "\\"
#define DIRECTORY_SEPARATOR_CHAR '\\'
#else
#define DIRECTORY_SEPARATOR "/"
#define DIRECTORY_SEPARATOR_CHA... | TOOL | 0.98755 | 5.933113 |
b5c2e778-c6c5-4eb9-bd0b-e377028b0483 | melwinalm/leetcode-cpp | advent-of-code-2024/day2/part2.cpp | #include <stdio.h>
#include <bits/stdc++.h>
using namespace std;
bool isIncreasing(vector<int> &arr){
for(int i = 1; i < arr.size(); i++){
if(1 <= arr[i] - arr[i-1] && arr[i] - arr[i-1] <= 3){
continue;
}
else{
return false;
}
}
return true;
}
b... | ALGO | 0.997997 | 3.542922 |
dcc67c2c-a163-4623-bec8-93298eea8334 | Sahil12S/LeetCode | CPP2/NumbersWithEvenNumberOfDigits.cpp | // https://leetcode.com/problems/find-numbers-with-even-number-of-digits/
#include <iostream>
#include <vector>
using namespace std;
int findNumbers(vector<int>& nums);
int main()
{
vector<int> nums = { 555, 901, 482, 1771 };
cout << findNumbers(nums) << endl;
return 0;
}
int findNumbers(vector<int>& n... | ALGO | 0.998654 | 6.202651 |
33fc9bc4-5dae-43c1-a70c-660a5b6f3824 | rrupom/total-placement-practice | 01. Programming Languages/C++ Basic/pointer/pointer_application1.cpp | #include<bits/stdc++.h>
using namespace std;
void swap(int *p, int *q) {
int temp = *p;
*p = *q;
*q = temp;
}
int32_t main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int x = 10, y = 20;
cout << "Before swaping x and y : " << x << " " << y << endl;
swap(&x, &y);
cout << "Aft... | ALGO | 0.99626 | 3.951283 |
9a1a5357-f1f3-4822-98bd-abeb2e9830fa | viant/vec | blas/cpp/int32_amd64.cpp | #include <immintrin.h>
const uint32_t AVX2 = 1;
const uint32_t AVX512 = 2;
void inc_int32(int32_t* vec, int32_t constant, uint64_t info) {
uint32_t *infoPart = (uint32_t *) &info;
uint32_t size = infoPart[0];
uint32_t feature = infoPart[1];
int chunks = 0;
__m256i constant_vec = _mm256_set1_epi32... | ALGO | 0.978459 | 5.311633 |
1ba8d17f-2b70-4280-9289-08cd0d1e50e8 | BetterOIer/competitive-cpp-code-backup | AtCoder/AT_agc018_a.cpp | #include<iostream>
using namespace std;
long long n,k,a[100005],maxn;
long long gcd(long long m, long long n){
while (n != 0){
long long t = m % n;
m = n;
n = t;
}
return m;
}
int main(){
cin>>n>>k>>a[0];
maxn=a[0];
for(int i=1;i<n;i++)
{
cin>>a[i];
a[0]=gcd(a[... | ALGO | 0.999977 | 3.735837 |
e2e4dc08-d37b-4e75-bd70-4653783e2bec | Raynxxx/Contest | CodeLib/Dynamic Programming/ZOJ 3769 Diablo III.cpp | /*
** ZOJ 3769 Diablo III
** Created by Rayn @@ 2014/08/12
*/
#include <cstdio>
#include <iostream>
#include <vector>
#include <tr1/unordered_map>
#include <cstring>
#include <algorithm>
using namespace std;
using namespace std::tr1;
const int MAXM = 50000 + 10;
struct Equip
{
int D, T;
Equip() {}
Equip(in... | ALGO | 0.999659 | 4.319687 |
dae23162-58ca-4776-80a8-3686ea13110b | suky637/great_war | src/engine/battle.cpp | #include "engine/battle.h"
BattleResult BattleSystem::simulateBattle(BattleData battleData) {
float enemyMultiplier = battleData.enemyDefending ? 3 : 2;
float playerMultiplier = battleData.enemyDefending ? 2 : 3;
// TODO: adding randomness
// Checking the ratio of forces
float forceDifference = b... | ALGO | 0.982195 | 4.961149 |
b86f007c-47ed-49fd-9517-a4088556cdc2 | externalxdpro/LeetcodeSolutions | CPP/MaximumDifferenceBetweenEvenAndOddFrequencyII_3445.cpp | // 3445. Maximum Difference Between Even and Odd Frequency II
// Difficulty: Hard
// You are given a string s and an integer k. Your task is to find the maximum
// difference between the frequency of two characters, freq[a] - freq[b], in a
// subs of s, such that:
// subs has a size of at least k.
// Charact... | ALGO | 0.999731 | 6.258549 |
6bfb032d-3993-4fcd-ab14-5669aeaa9ec0 | dhnanj2/CP_Kit | Strings/RemaiderWith7.cpp | /*
Given a number as string(n) , find the remainder of the number whe it is divided by 7
You only need to complete the function remainderwith7() that takes string n as parameter and returns an integer which denotes the remainder of the number when its divided by 7
Constraints:
1<=length of n <=10^5
*/
/* ... | ALGO | 0.999759 | 4.888721 |
4802848f-9b30-4b42-a78c-a15fdafbd79c | EviSijben/MM-MO-GOMEA | src/Semantics/SemanticLibrary.cpp | /*
*/
/*
* File: SemanticLibrary.cpp
* Author: virgolin
*
* Created on July 5, 2018, 9:11 PM
*/
#include "GPGOMEA/Semantics/SemanticLibrary.h"
using namespace std;
using namespace arma;
SemanticLibrary::SemanticLibrary(bool normalize_outputs, bool linear_parse_library) {
this->normalize_outputs = nor... | ALGO | 0.999622 | 5.314187 |
13488d0e-d991-420f-88a0-2b8181930a8d | nmpogg/TRR2 | dem_so_dinh_tru.cpp | #include <iostream>
using namespace std;
int n, a[25][25];
bool chuaxet[25];
void input(){
cin >> n;
for(int i = 1; i <= n; i++){
for(int j = 1; j <= n; j++){
cin >> a[i][j];
}
}
}
void Reinit(){
for(int i = 1; i <= n; i++){
chuaxet[i] = true;
}
}
void DFS(in... | ALGO | 0.999819 | 3.06978 |
066e7195-c392-4c70-a7da-571cfc274edf | mclindino/Pthreads | ProducerAndConsumer.cpp | #include <iostream>
#include <list>
#include <pthread.h>
using namespace std;
//CRIA STRUCT REFERENTE AO BUFFER
typedef struct
{
list<int> *buffer;
int v, t;
}BUFFER, *thread_BUFFER;
//CRIA AS FUNCOES PARA PRODUZIR E CONSUMIR
void *produce(void * arg);
void *consume(void * arg);
//INSTANCIA VARIAVEIS NECESSARIAS... | ALGO | 0.993201 | 4.357906 |
99521288-eadb-4aa8-a03b-296a721a08f4 | DamianArado/LeetCode-tracker | 2461-maximum-sum-of-distinct-subarrays-with-length-k/2461-maximum-sum-of-distinct-subarrays-with-length-k.cpp | class Solution {
public:
long long maximumSubarraySum(vector<int>& nums, int k) {
long long maxSum = 0, sum = 0;
unordered_set<int> seen;
int i = 0;
for(int j = 0; j < size(nums); ++j) {
while(i < j and (seen.count(nums[j]) or size(seen) >= k)) {
sum -= n... | ALGO | 0.999918 | 6.206305 |
2185a3be-51d6-4ad9-ac09-19755e644d7b | gap-prog/Competitive-Programming | solutions/codeforces/practice/1873C_target_practice.cpp | // CodeForces Problem Link: https://codeforces.com/contest/1873/problem/C
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 10;
int matrix[MAXN][MAXN] = {
{1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
{1, 2, 2, 2, 2, 2, 2, 2, 2, 1},
{1, 2, 3, 3, 3, 3, 3, 3, 2, 1},
{1, 2, 3, 4, 4, 4, 4, 3, 2, 1},
{1, 2, 3, 4... | ALGO | 0.998525 | 4.732389 |
060c82ae-8c60-450d-a08a-dfc9261a22ee | ooleksyuk/CarND-MPC-Quizzes | mpc_to_line/src/Eigen-3.3/test/sparseLM.cpp | #include "main.h"
#include <Eigen/LevenbergMarquardt>
using namespace std;
using namespace Eigen;
template <typename Scalar>
struct sparseGaussianTest : SparseFunctor<Scalar, int>
{
typedef Matrix<Scalar,Dynamic,1> VectorType;
typedef SparseFunctor<Scalar,int> Base;
typedef typename Base::JacobianType JacobianT... | TEST | 0.990663 | 6.130261 |
27863a8c-4b39-4834-88d7-7422074e562f | Tagore22/Project | Project1/9251.cpp | #include <iostream>
#include <vector>
#include <string>
using namespace std;
string strA, strB;
vector<vector<int>> cashe;
int calcul(int a, int b)
{
if (a >= strA.size())
return 0;
int& ans = cashe[a][b + 1];
if (ans != -1)
return ans;
ans = 0;
for (int i = b + 1; i < strB.size()... | ALGO | 0.999941 | 5.033947 |
6965191b-d00d-4406-8616-ba2a23bb13ef | marcoschaiben/Programacao_pratica_Marcos_David_Julia | CODIGO/CPosicaoAguaInjetadaDykstra.cpp | #include "CPosicaoAguaInjetadaDykstra.h"
using namespace std;
#include <cmath>
vector <double> CPosicaoAguaInjetadaDykstra::VazaoInjecao(double _krw,double _mw,double _largura,double _dp, std::vector <double> _k, double _bw, double _comprimento, std::vector <double> _espessurac, double _M)
{
double A;
for (int... | ALGO | 0.998006 | 3.85168 |
e1e778a8-d9bf-47e6-8e36-0b5ae6bec100 | deepusinghrawat/C-- | Ass8.cpp | #include <iostream>
using namespace std;
int main (){
int num,i;
cout <<"enter your table";
cin>>num;
for(i=1;i<=10;i++){
cout << i*num << "\n";
}
} | ALGO | 0.985725 | 3.174679 |
aa8b53d5-6336-4bc5-b198-6a3c79be43d3 | vishal2376/dsa-algorithms | stack/stack_linked.cpp | #include <iostream>
using namespace std;
class Stack {
private:
struct Node {
int data;
Node *next;
};
Node *top;
public:
Stack() {
top = nullptr;
}
bool isEmpty() {
if (top == nullptr) {
return true;
} else {
return false;
... | ALGO | 0.934959 | 5.947991 |
5aa7af10-386b-42ac-9e3e-ff96c5aea577 | NaVIn69/AlgoZenith_DSA | graph2/Colour_Tree.cpp | #include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl "\n"
int n,m;
vector<vector<int>>g;
vector<int>vis;
void solve(){
cin>>n>>m;
g.resize(n+1);
for(int i=0;i<n;i++){
int a,b;
cin>>a>>b;
g[a].push_back(b);
g[b].push_back(a);
}
vis.resize(n+1... | ALGO | 0.99953 | 4.771314 |
24fd386d-5c11-4b08-9f54-b9121730759c | HalykCoin/halykcoin | tests/core_tests/chaingen.cpp | #include <vector>
#include <iostream>
#include <sstream>
#include "include_base_utils.h"
#include "console_handler.h"
#include "p2p/net_node.h"
#include "cryptonote_basic/cryptonote_basic.h"
#include "cryptonote_basic/cryptonote_basic_impl.h"
#include "cryptonote_basic/cryptonote_format_utils.h"
#include "cryptonote... | TEST | 0.853393 | 5.670667 |
feec77a1-f0dc-4e74-a8fc-7a37cbc54e5b | Krystaall/Programs-using-linked-lists | stack_ll.cpp | #include<iostream>
using namespace std;
class Node{
public:
int val;
Node* next;
Node(){
val=0;
next= NULL;
}
Node(int v){
val=v;
}
};
class stack_ll{
public:
Node* top;
int c=0;
stack_ll(){
top= NULL;
}
bool isEmpty(){
if(top==NULL){
return true;
}
else{
return false;
}
}
void push(int v)... | ALGO | 0.998043 | 3.956085 |
2fad1e1d-8371-48a3-963d-06c806ab0e11 | faniajime/CI0117-2020-S2 | Laboratorios/Laboratorio_7/count_primes_parallel/count_primes_parallel.cpp | #include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include<omp.h>
#include <math.h>
using namespace std;
bool isPrime(int number){
if(number<2){
return false;
}
if (number == 2){
return true;
}
if (number % 2 == 0){
return false;
}
int last = (int)sqrt(numb... | ALGO | 0.998797 | 3.778614 |
66748506-ba2d-4b99-87d9-10ac9aa1ae4d | Priyanshu2410/DSA | AtoZ/Binary search tree/Practice Problem/Floor from BST_CN.cpp | int Floor(BinaryTreeNode<int> *node, int input)
{
/*Write your code here.
*Don't write main().
*Don't take input, it is passed as function argument.
*Don't print output.
*Taking input and printing output is handled automatically.
*/
int ceil=-1;
while(node){
if(node->data==input)
return input;
els... | ALGO | 0.999999 | 4.418376 |
4dec8acd-4b9f-4209-82e6-6fa9af3fdf81 | QuanNM-PTIT/Data_Structures_and_Algorithms_PTIT | Stack/DSA07005 - BIỂU THỨC TƯƠNG ĐƯƠNG.cpp | // Created by Nguyễn Mạnh Quân
#include<bits/stdc++.h>
using namespace std;
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define sz size()
#define ll long long
#define FOR(i, a, b) for(int i = a; i <= b; i++)
#define FORD(i, a, b) for(int i = a; i >= b; i--)
#define F(i, a, b) for(int... | ALGO | 0.999954 | 4.812889 |
f7a532f7-6bbe-48fe-9baa-d0b4577007c6 | ryuspace/Algorithm | SWEA/1952.cpp | /*1952번 수영장
풀이 : 이번 월에 이용 안했으면 다음 월로 패스
이용 했으면 가능한 모든 이용권을 사용하는 경우를 찾는다.
*/
#include <iostream>
#include <algorithm>
using namespace std;
int t;
int n;
int gap[4];
int day[12];
int minn = 1e9;
void dfs(int cnt,int sum)//cnt는 현재 달
{
if (cnt > 12)
return;
if (cnt == 12)
{
minn = min(minn, sum);
return;
}
if (d... | ALGO | 0.999806 | 3.388031 |
b401cafe-1269-4293-8c9a-401e31eeb30d | sazidansari9634/journo_blog_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 |
2ae2e109-a561-4cd0-b885-d7585e67d8f4 | koybasimuhittin/cses-solutions | cpp/tree-algorithms/subtree_queries.cpp | #include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define f1 first
#define s2 second
#define pb push_back
#define mp make_pair
#define int long long
#define fri(a) freopen(a,"r",stdin);
#define fro(a) freopen(a,"w",stdout);
const int MOD = 1e9 + 7;
const int N = 2e5 + 5;
int n, q, seg[8 * N], in[N], ou... | ALGO | 0.999846 | 4.100615 |
c8aeba52-6ac1-4ec2-891a-1ca0817fa36e | Next-Gen-UI/Code-Dynamics | Leetcode/0989. Add to Array-Form of Integer/0989.cpp | class Solution {
public:
vector<int> addToArrayForm(vector<int>& num, int k) {
for (int i = num.size() - 1; i >= 0; --i) {
num[i] += k;
k = num[i] / 10;
num[i] %= 10;
}
while (k > 0) {
num.insert(begin(num), k % 10);
k /= 10;
}
return num;
}
};
| ALGO | 0.999543 | 6.491415 |
d1cc5ad3-2872-4733-be43-589bc2a3655e | Miltonbhowmick/Interview-Questions | samsung r&d/Given a node in a binary tree, we had to find the sum of all the nodes at a distance k from this node.cpp | #include<iostream>
using namespace std;
int f,k;
struct Node{
int data;
Node *left;
Node *right;
Node *parent;
};
struct Node* newNode(int data){
struct Node *temp=new Node();
temp->data=data;
temp->left=NULL;
temp->right=NULL;
temp->parent=NULL;
return temp;
}
struct Node* Inser... | ALGO | 0.999997 | 3.517735 |
3b1fa462-94da-437e-82c7-90cc5d94edc0 | vivek-panchal/Leetcode-Daily-Challenge-2024- | 25th March 2024 || Find All Duplicates in an Array.cpp | class Solution {
public:
vector<int> findDuplicates(vector<int>& nums) {
map<int,int> mp;
vector<int> ans;
int n=nums.size();
for(int i=0;i<n;i++){
if(mp[nums[i]]==0){
mp[nums[i]]++;
}
else{
ans.push_back(nums[i]);
... | ALGO | 0.999874 | 5.690733 |
2eec294d-458b-472d-9460-79965df68699 | kasa021/atcoder-archives | abc285/abc285_d_38079421_AC.cpp | /*
* Author: kAsA02
* Submission URL: https://atcoder.jp/contests/abc285/submissions/38079421
* Submitted at: 2023-01-15 14:22:25
* Problem URL: https://atcoder.jp/contests/abc285/tasks/abc285_d
* Result: AC
* Execution Time: 259 ms
*/
#include <bits/stdc++.h>
#include <cmath>
#if __has_include(<atcoder/all>)
... | ALGO | 0.999989 | 5.190877 |
0a236023-38fa-48fa-a48e-ae5405aaf296 | POC-2025/leetcode | lcof2/剑指 Offer II 088. 爬楼梯的最少成本/Solution2.cpp | class Solution {
public:
int minCostClimbingStairs(vector<int>& cost) {
int a = 0, b = 0;
for (int i = 1; i < cost.size(); ++i) {
int c = min(a + cost[i - 1], b + cost[i]);
a = b;
b = c;
}
return b;
}
}; | ALGO | 0.999944 | 6.230235 |
651500b4-7ece-43fa-9431-221597a51775 | abhi061201/GFG-LEETCODE-CODINGNINJA-SOLUTION | Day 55/338. Counting Bits leetcode.cpp | class Solution {
public:
vector<int> countBits(int n) {
vector<int>ans;
ans.push_back(0);
for(int i=1 ; i<=n ;i++ ){
vector<int> v;
go(i,v);
int count=0;
for(auto it : v){
if(it==1)count++;
}
ans.push_back... | ALGO | 0.999974 | 5.802355 |
a7ddc9eb-b67a-4dca-bac2-8e14cedb08ad | praveshtiwari150/foundation_dsa | 1.patterns/16.cpp | /*
Pattern 16
D
C D
B C D
A B C D
*/
#include<iostream>
using namespace std;
int main(){
int n;
cin >> n;
int row = 1;
while(row <= n){
int col = 1;
char ch = 'A' + n - row;
while(col <= row ){
cout << ch << " ";
ch = ch + 1;
... | ALGO | 0.999747 | 4.008271 |
3aa7b313-45e8-4563-a186-48ce37c89008 | elixered/leetcode | 315-count-of-smaller-numbers-after-self/315-count-of-smaller-numbers-after-self.cpp | class Solution {
public:
void merge(vector<int> &count, vector<pair<int, int> > &v, int left, int mid, int right) {
vector<pair<int, int> > tmp(right-left+1);
int i = left;
int j = mid+1;
int k = 0;
int cnt = 0;
while (i <= mid && j <= right) {
if (v[i].fi... | ALGO | 0.999996 | 5.875131 |
f86f2840-a0f6-493d-bcf4-f102750f0c50 | harith-s/cs101lab | newfile.cpp | main_program {
int a;
cout << "type the number your want cubed";
cin >> n;
cout << n*n*n << endl;
}
| TOOL | 0.989718 | 3.537201 |
15167397-f77d-47b8-a238-b29f6c5b6f2d | yazanassad3/Data-Structure | Data2/aaaaa.cpp | /*#include <iostream>
using namespace std;
enum error { success, underflow, out };
struct node {
int data = 0;
node*next;
node() {
next = 0;
}
node(int el, node* n = 0) {
data = el;
next = n;
}
};
class list {
node* h1 = 0, * t1 = 0;
public:
list();
bool is_empty();
void print();
int size();
void ad... | ALGO | 0.998823 | 3.8434 |
d8ef560a-7ff3-4754-9a3c-a8a0266755ad | ThanhToan2111/1000-b-i-t-p-code-c-a-th-y-Khang | bai45.cpp | #include<bits/stdc++.h>
using namespace std;
int tichchuso(int n)
{
if(n<10) return n;
else return n%10 * tichchuso(n/10);
}
int main()
{
int n;
cin>>n;
cout<<tichchuso(n);
return 0;
} | ALGO | 0.999668 | 3.800138 |
a8d05aa0-2e9b-43b9-8779-23510e2446c0 | Alberl-Lee/blinkUI | third_party/skia/src/utils/SkParsePath.cpp | #include "SkParsePath.h"
#include "SkParse.h"
static inline bool is_between(int c, int min, int max)
{
return (unsigned)(c - min) <= (unsigned)(max - min);
}
static inline bool is_ws(int c)
{
return is_between(c, 1, 32);
}
static inline bool is_digit(int c)
{
return is_between(c, '0', '9');
}
static inl... | TOOL | 0.893364 | 6.00067 |
d4bf7a8c-1fb8-46f7-b271-419f4cd6db7f | aeremin/Codeforces | alexey/Solvers/4xx/498/Solver498A.cpp | #include <Solvers/pch.h>
#include "math/sign.h"
using namespace std;
// Solution for Codeforces problem http://codeforces.com/contest/498/problem/A
class Solver498A
{
public:
void run();
};
void Solver498A::run()
{
int64_t xH, yH;
cin >> xH >> yH;
int64_t xU, yU;
cin >> xU >> yU;
int64_t nRo... | ALGO | 0.999741 | 4.87577 |
0c146d00-f58c-40da-bc50-df0424b1fe65 | KshitijGupta07/Leetcode__-problems | 103-binary-tree-zigzag-level-order-traversal/binary-tree-zigzag-level-order-traversal.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.99999 | 6.20862 |
fd371095-9534-402f-b57e-0a5d94548af4 | A-lioth/Cpp_Program | LeetCode/双指针/T524_Longest-Word-in-Dictionary-through-Deleting.cpp | #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
string findLongestWord(string s, vector<string> &dictionary)
{
sort(dictionary.begin(), dictionary.end(), [](string &a, string &b)
{
if(a.length() == b.length()) return a < b;
return ... | ALGO | 0.999527 | 4.653284 |
a250b5ee-79f0-447a-8d9f-aecafd997dce | upupupahah/pupu | 1st semester/2.4/2.4.cpp | #include <iostream>
int main()
{
int N;
std::cin >> N;
if (N % 2 == 0 or N <= 3)
{
std::cout << "error";
return 0;
}
else
{
for (int i = 0; i <= N; i++)
{
if (i % 2 != 0)
{
for (int q = 1; q <= (N - i) / 2; q++)
{
std::cout << " ";
}
for (int j = 0; j < i; j++)
std::cout <... | ALGO | 0.99991 | 4.11429 |
b9e9436c-2f1d-469d-8e3e-628cc671e7c1 | DibloTempest/ThinhLucifer | CPP/ARRSORT.cpp | #include <bits/stdc++.h>
using namespace std;
long long n;
long double a[11], dem;
int main()
{
freopen("ARRSORT.inp", "r", stdin);
freopen("ARRSORT.out", "w", stdout);
cin >> n;
for (long long i = 1; i <= n; i++)
{
cin >> a[i];
}
sort(a + 1, a + n + 1);
for (long long i = 1; i <... | ALGO | 0.99993 | 3.768726 |
c880305a-0353-416b-aabe-84a508c185d5 | raincross7/code-similarity | codes/train_code/problem494/problem494_378.cpp | #include <bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb emplace_back
#define mp make_pair
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
const int32_t inf = 1001001001;
const int64_t infll = 1001001001001001001ll;
const int dx[] = {0, -1, 1, 0, -1, 1, -1, 1}... | ALGO | 0.999919 | 3.982467 |
f0099dcd-65a5-41c7-bd16-9ac2cce99948 | beelisais2793/FX | Synthesizer/Waves/tfp/thirdparty/eigen-3.3.4/doc/examples/TutorialLinAlgExSolveLDLT.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main()
{
Matrix2f A, b;
A << 2, -1, -1, 3;
b << 1, 2, 3, 1;
cout << "Here is the matrix A:\n" << A << endl;
cout << "Here is the right hand side b:\n" << b << endl;
Matrix2f x = A.ldlt().solve(b);
cout << "... | ALGO | 0.999879 | 3.807622 |
ef988f70-c0d1-407d-ab95-75f4fb39bd67 | za233/Polaris-Obfuscator | src/libcxx/test/std/algorithms/alg.sorting/alg.set.operations/set.union/set_union_comp.pass.cpp | // <algorithm>
// template<InputIterator InIter1, InputIterator InIter2, typename OutIter,
// CopyConstructible Compare>
// requires OutputIterator<OutIter, InIter1::reference>
// && OutputIterator<OutIter, InIter2::reference>
// && Predicate<Compare, InIter1::value_type, InIter2::value_type... | TEST | 0.946971 | 6.828393 |
9220aa74-7516-460f-b104-bc62341bc89c | trf-robosoft-workshop/trf--robospark-2020 | RoboSpark-VivekMankar/4-7-2020_OOPS_Task-2_Spurthi_Bhat/Task2_Rank.cpp | #include <bits/stdc++.h>
using namespace std;
class Student{
public:
string name;
int Rollno;
int Year;
double cgpa;
void Input(){
cout << "Enter the Important Details:"<<endl;
cout << "Name:" <<endl;
cin >> name;
cout << "Roll no:" << endl;
cin >> Rollno;
cout << "Year:" << endl;... | TOOL | 0.892368 | 3.277064 |
03ff488c-e660-4a35-a74f-e8fd064245bf | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_1854_8.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
string s; cin >> s;
bool bad = s[0] == s[1] || s[1] = s[2] || s[2] = s[3];
cout << (bad ? "Bad" : "Good") << endl;
} | ALGO | 0.999385 | 4.004311 |
2bf28d04-8c0d-460a-9be0-a873957690a0 | vibhor376/TLE-CP-Sheet-Solutions | 800 Level Questions/C_Target_Practice.cpp | struct TrieNode
{
TrieNode *links[26];
int cnt = 0;
bool flag = false;
bool contains(int x)
{
return links[x] != NULL;
}
void put(char ch, TrieNode *node)
{
links[ch - 97] = node;
}
TrieNode *get(int x)
{
return links[x];
}
void increment()
... | ALGO | 0.999975 | 4.947704 |
59cdb7d2-265d-48b2-94e5-52d083897980 | N-Kulagin/Abel | Abel/src/OptimizationProblems/qprog.cpp | #include "pch.h"
#include "OptimizationProblems/qprog.h"
qprog_Result qprog(const Eigen::MatrixXd& G, const Eigen::VectorXd& c, const Eigen::MatrixXd& A, const Eigen::VectorXd& b, const Eigen::MatrixXd& B, const Eigen::VectorXd& d,
double tol, size_t max_iter)
{
int m = (int)A.rows();
int n = (int)A.cols();
int ... | ALGO | 0.999715 | 6.526135 |
590bfae2-d5ba-4b2d-910e-8760e0c47068 | DaneshCode/cpp-Practice | c++/ConsoleApplication35.cpp | #include <iostream>
using namespace std;
int main()
{
int Dani[4][4];
cout << "adad bede satr aval matris 4 * 4 : ";
for (int i = 0; i < 4; i++)
for (int j = 0; j < 4; j++)
cin >> Dani[i][j];
for (int i = 0; i < 4; i++)
{
for (int j = 0; j < 4; j++)
{
cout << " " << Dani[i][j] << " ";
}
cout <... | ALGO | 0.976094 | 3.12503 |
41d13c59-1afe-42dc-b16c-bb9df857a702 | nirvana369/UVA-problem-solved | 245.cpp | /*
Hoang Linh
*/
#include <cstdlib>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <iostream>
#define fi "245.inp"
#define fo "245.out"
/**/
using namespace std;
/**/
char a[1000000][60];
long da;
/**/
void cutstr(int vt)
{
long i;
char... | ALGO | 0.97264 | 3.065767 |
566c7339-8e93-42ef-93c6-bb789d233ad7 | BAPGAP/hanyang | Algorithm/백준/이항계수 3/main.cpp | #include <iostream>
using namespace std;
long long pac(int x){
if(x == 1) return 1;
if(x == 2) return 2;
if(x == 3) return 6;
if(x == 4) return 24;
long long A = (x * (x-1))%1000000007;
A = (A * (x-2))%1000000007;
A = (A * (x-3))%1000000007;
return (A * pac(x-4))%1000000007;
}
int m... | ALGO | 0.999994 | 4.682998 |
b56632de-8937-4d5a-9a4c-f7e81baeedd9 | raunakdwivedi03/DSA | 0198-house-robber/0198-house-robber.cpp | class Solution {
public:
int rob(vector<int>& nums) {
int n=nums.size();
if(n==1)
return nums[0];
int prePrev=0;
int prev=nums[0];
for(int i=2;i<=n;i++){
int skip=prev;
int steal=nums[i-1]+prePrev;
int temp=max(skip,steal);
... | ALGO | 0.999887 | 5.733967 |
66d43e04-9b08-4348-bfbb-78437e5b25ee | ssharma1991/autonomous-car-highway-driving | src/Eigen-3.3/lapack/svd.cpp | #include "lapack_common.h"
#include <Eigen/SVD>
// computes the singular values/vectors a general M-by-N matrix A using divide-and-conquer
EIGEN_LAPACK_FUNC(gesdd,(char *jobz, int *m, int* n, Scalar* a, int *lda, RealScalar *s, Scalar *u, int *ldu, Scalar *vt, int *ldvt, Scalar* /*work*/, int* lwork,
... | ALGO | 0.998704 | 5.526819 |
bf311ab2-2610-4eff-a0f4-f42a1c9c8d7e | Sadi-Hurayv/Competitive-Programming | Online Judge/SPOJ/Binary Search/Shake Shake Shaky.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
// For Loop
#define fi(i, a, c) for (ll i = (a); i < (c); i++)
#define fd(i, a, c) for (ll i = (a); i > (c); i--)
#define fe(it, a) for (auto it : a)
// Pair
#define pi pair<int, int>
#define pll pair<ll, ll>
#define ... | ALGO | 0.999956 | 4.470375 |
3c09ca5e-64b5-40ea-acc1-e325cf1885a4 | meaningful96/DataStructure_and_Algorithm | DataStructure/C++/1_Stack_Full.cpp | #include <iostream>
#define MAX 6
using namespace std;
int STACK[MAX], TOP;
// stack initialization
void initStack()
{
TOP = -1;
}
//Check it is empty or not
int isEmpty()
{
if(TOP == -1)
return 1;
else
return 0;
}
//Check stack os full or not
int isFull()
{
if(TOP == MAX -1)
return 1;
else
return 0;
... | ALGO | 0.911196 | 3.910374 |
510b1d1a-1af1-4e0f-9705-68d004147d83 | ustcyyw/algorithm | luogu/string/kmp/CF954I.cpp | /**
* @Time : 2025/1/2-4:32 PM
* @Author : yyw@ustc
* @E-mail : <EMAIL>
* @Github : https://github.com/ustcyyw
* @desc : CF954I 2200 状态压缩 暴力枚举 kmp
*/
/*
* 只有6个字符 最多5次操作
* b > a, c > a, d > a, e > a, f > a
* 那么所有字符都会变成a, 两个字符串必然相等
*
* 所以只需要考虑
* 1次操作:将1个字符变为另外5个字符中的一个
* ...
* 4次操作:选择4个字母 变成另外的2个字母
... | ALGO | 0.999993 | 5.153265 |
b99949a9-a511-4ddc-a7da-5c7698ea71c3 | Prerna9802/LeetCode | 1339-maximum-product-of-splitted-binary-tree/1339-maximum-product-of-splitted-binary-tree.cpp | class Solution {
public:
long int total=0;
long int all(TreeNode* root){
if(!root){
return 0;
}
total+=root->val;
all(root->left);
all(root->right);
return total;
}
long int ans=0;
long int dfs(TreeNode* root,long int &ans){
if(!roo... | ALGO | 0.99999 | 5.608159 |
f892024c-f1a6-48fe-8e75-e691c2ec5dcf | Sachindebug/LeetCode-Problems | 3110-score-of-a-string/3110-score-of-a-string.cpp | class Solution {
public:
int scoreOfString(string s) {
int res = 0;
for(int i=1;i<s.length();i++) res+=abs(s[i]-s[i-1]);
return res;
}
}; | ALGO | 0.999953 | 5.498716 |
c942b654-0f94-419b-8703-b5be5ac39332 | cdh-hub/leetcode | 1653.使字符串平衡的最少删除次数.cpp | /*
* @lc app=leetcode.cn id=1653 lang=cpp
*
* [1653] 使字符串平衡的最少删除次数
*/
// @lc code=start
class Solution {
public:
int minimumDeletions(string s) {
int cnt = 0;
for (char ch: s) cnt += 1 - ch + 'a';
int ans = cnt;
for (char ch: s) ans = min(ans, cnt += ((ch - 'a') << 1) - 1);
... | ALGO | 0.999925 | 6.417984 |
27dbeb17-561d-4f54-b59f-cddb5137e6b8 | tasnim-zeba/Problem-Solving | Codeforces/1644C.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
ll t,n,i,j,x,k;
cin>>t;
while(t--)
{
cin>>n>>x;
ll a[n+1],p[n+1],len[n+1];
for(i=0;i<n;i++)
{
cin>>a[i];
}
p[0]=0;
p[1]=a[0];
for(i=1;i<=n;i++)
... | ALGO | 0.999816 | 3.280619 |
b8633144-884b-47f2-88d1-5dcada36e574 | ewaty/Model-Predictive-Control | Ipopt-3.12.7/Ipopt/src/Algorithm/Inexact/IpInexactLSAcceptor.cpp | #include "IpInexactLSAcceptor.hpp"
#ifdef HAVE_CMATH
# include <cmath>
#else
# ifdef HAVE_MATH_H
# include <math.h>
# else
# error "don't have header file for math"
# endif
#endif
// for sprintf
#ifdef HAVE_CSTDIO
# include <cstdio>
#else
# ifdef HAVE_STDIO_H
# include <stdio.h>
# else
# error "don't have header ... | TOOL | 0.984597 | 5.271692 |
8b7594d4-f1c0-47bc-88ec-b3ef3e7598ab | Krishnaprasad15/Codeforces | 800/C_Word_Game.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
void solve(){
int n;
cin>>n;
unordered_map<string,int> mp;
vector<string> a,b,c;
for(int i=0;i<n;i++){
string x;
cin>>x;
mp[x]++;
a.push_back(x);
}
for(int i=0;i<n;i++){
string x;
... | ALGO | 0.999728 | 4.552066 |
76c430a5-2b2c-4397-a078-9b3fc0afab1e | Dattpal/DSA | prims algo.cpp |
#include <iostream>
using namespace std;
// Number of vertices in the graph
#define V 5
// A utility function to find the vertex with
// minimum key value, from the set of vertices
// not yet included in MST
int minKey(int key[], bool mstSet[])
{
// Initialize min value
int min = INT_MAX, min_index;
for... | ALGO | 0.999955 | 5.057215 |
015f255b-e4e5-482d-9303-8ad7cd8ea0f8 | reo0105/atcoder | contest/2023_09_09_beginner/tmp.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MOD 998244353
typedef pair<int, int> pii;
int main()
{
int n, x, y;
cin >> n >> x >> y;
vector<int> p(n-1), t(n-1);
for (int i = 0; i < n-1; i++) cin >> p[i] >> t[i];
int q;
cin >> q;
vector<ll> type(840, 0);
... | ALGO | 0.999907 | 4.106678 |
ddb3dd71-c258-4b73-a939-87a667083e84 | EASINTUHA/Coding-Journey-reset | April 2025 past/A_Expression.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define ff first
#define ss second
#define pb push_back
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x)... | ALGO | 0.999969 | 3.955865 |
84c090ca-d45c-4aa5-a2ce-334e92515db4 | chammoru/Q1View | opencv-4.3.0/samples/cpp/tutorial_code/core/discrete_fourier_transform/discrete_fourier_transform.cpp | #include "opencv2/core.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/imgcodecs.hpp"
#include "opencv2/highgui.hpp"
#include <iostream>
using namespace cv;
using namespace std;
static void help(char ** argv)
{
cout << endl
<< "This program demonstrated the use of the discrete Fourier transform (D... | ALGO | 0.98272 | 6.214012 |
e339a77d-5bc0-413b-ae1c-014c75c279c6 | manikanta2901/ubuntu | .history/codingChallenges/cpp/Codechef/longChallenges/August/smallestKmp_20200807203340.cpp | #include<bits/stdc++.h>
#include<vector>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<iterator>
#include<string>
#include<map>
#define vv vector
#define F first
#define S second
#define MP make_pair
#define EXECUTE_FASTER ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define printM... | ALGO | 0.999982 | 4.26996 |
2bee234a-4cad-4265-84c3-27f22164c7fd | Jaan19867/AlgoZenith | Theory/Bit Manipulation/practise.cpp | #include <iostream>
using namespace std;
int n;
long long a,b,i;
int main() {
cin>>n;
while(n--){
cin>>a>>b;
for(i=1;(a|i)<=b;i<<=1) a|=i;
cout<<a<<endl;
}
} | ALGO | 0.999856 | 3.782585 |
c24f7ae1-cb29-470f-983f-880310d0b9fd | gajgeospatial/boost_1_81_0 | libs/bimap/example/mi_to_b_path/bidirectional_map.cpp | // Boost.Bimap Example
//-----------------------------------------------------------------------------
// This example shows how to construct a bidirectional map with
// multi_index_container.
// By a bidirectional map we mean a container of elements of
// std::pair<const FromType,const ToType> such that no two element... | ALGO | 0.970683 | 6.412298 |
f496928f-b2d6-4e5a-8f71-24d507be2459 | sushant054/Numerical_computing | guassJacobi/MatrixClass.cpp | #include "MatrixClass.hpp"
// Default constructor
Matrix::Matrix() {
mat = nullptr; // Initialize matrix pointer to null
rows = cols = 0; // Initialize rows and columns to 0
}
// Parameterized constructor
Matrix::Matrix(int r, int c) : rows(r), cols(c) {
mat = new double* [rows]; // Allocate memory for ro... | ALGO | 0.99951 | 6.699389 |
9e2dc010-d8cf-4a0e-98b3-03be0c04bad8 | shivam5643/Striver_SDE_Sheet_challenge_2023 | SubSetSum.cpp | #include <bits/stdc++.h>
bool subsetSumToK(int n, int k, vector<int> &arr) {
int dp[n+1][k+1];
for(int i=0;i<n+1;i++){
for(int j=0;j<k+1;j++){
if(i==0){
dp[i][j]=0;
}
if(j==0){
dp[i][j]=1;
}
}
}
for(int i=1;... | ALGO | 0.999859 | 5.013218 |
7657f82a-b984-41d6-b9a8-34f83302536d | Tsanami/num-methods-lab02-paris-gun | odesolver.cpp | #include "odesolver.hpp"
#include <iostream>
#include <cmath>
#include "atmosphere.h"
// Реализация методов класса ODESolver
ODESolver::ODESolver(double eps, double minSt, double maxSt)
: epsilon(eps), minStep(minSt), maxStep(maxSt) {}
std::vector<double> ODESolver::derivative(const std::vector<double>& state... | ALGO | 0.999742 | 6.282485 |
4bbb80de-8795-49f5-b9e4-24f34c0879b2 | ahmedsaed/LeetCode-Solutions | 17-letter-combinations-of-a-phone-number/17-letter-combinations-of-a-phone-number.cpp | class Solution {
public:
vector<string> letterCombinations(string digits) {
map<int, vector<char>> mp;
vector<string> result;
if (digits.empty()) return {};
result.push_back("");
mp[0] = {};
mp[1] = {};
mp[2] = {'a', 'b', 'c'};
mp[3] ... | ALGO | 0.999937 | 6.786931 |
e39603b9-c8fe-499a-87c9-bb40c1259004 | Dwarikanath1502/Linked_list | sort0sand1s.cpp | #include <iostream>
using namespace std;
class Node
{
public:
int data;
Node *next;
};
void push(Node **head_ref, int data)
{
Node *new_node = new Node();
new_node->data = data;
new_node->next = (*head_ref);
(*head_ref) = new_node;
}
Node *sortList(Node *head)
{
Node *temp = head;
int... | ALGO | 0.999997 | 5.115971 |
4717a466-56be-4f8f-9957-2d9e40af2dd9 | utyujinn/Competitive-programming | atcoder/abc367/b.cpp | #include<iostream>
using namespace std;
int main(){
string x;
cin>>x;
int id=x.size()-1;
while(x[id]=='0')id--;
if(id==x.size()-4){
for(int i=0;i<x.size()-4;i++){
cout<<x[i];
}
}else{
for(int i=0;i<id+1;i++){
cout<<x[i];
}
}
cout<<endl;
}
| ALGO | 0.999813 | 3.576406 |
92c8f31c-c708-4e5d-9337-06d09149cfa4 | SRAM-BCS/SRAM-frontend | 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 |
f92fa4a5-97fe-48b5-b863-89f5dfc9faa6 | aritradev/My-practice-Problem | B_Lamps.cpp | #include <bits/stdc++.h>
using namespace std;
#define cobra_69xp
#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using ll = long long int;
using ull = unsigned long long int;
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define in insert
#define pb push_back
#define ... | ALGO | 0.99994 | 4.505353 |
d9e80718-602a-4209-bdc9-ace844197f72 | ishandutta2007/codeforces | 1.618/normal/1391/A.cpp | #include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <utility>
#include <queue>
using namespace std;
typedef long long ll;
typedef long double ldouble;
void solve() {
int n;
cin >> n;
for (int i = 1; i <= n; i++) cout << i << " ";
cout << endl;
}
int main() {... | ALGO | 0.99922 | 4.133785 |
1467e6a7-ef26-4ae8-8c3c-c09cb03cf7ca | heavenMOJANG/ICPC | .history/Codeforces/CF1946/B_20240322231245.cpp | #pragma GCC optimize(1)
#pragma GCC optimize(2)
#pragma GCC optimize(3,"Ofast","inline")
#include<bits/stdc++.h>
#define int long long
using namespace std;
constexpr int inf=0x7fffffff;
constexpr int mod=1e9+7;
void solve(){
int n,k;cin>>n>>k;
vector<int>a(n);
int res=0;
for(int i=0;i<n;++i) cin>>a[i],r... | ALGO | 0.999912 | 4.536634 |
6a1f2cc2-6c38-4380-a0c0-f0075ff849f4 | Moazgamal/LeetCode-Problems | 2414-move-pieces-to-obtain-a-string/2414-move-pieces-to-obtain-a-string.cpp | class Solution {
void distributeleft(vector<int> &v, string &target, stack<int>lcopy)
{
for(int i =0; i< target.size(); i++)
{
if(target[i] == 'L')
{
int idx = lcopy.top(); lcopy.pop();
if(i-1>=0)
{
if(v[... | ALGO | 0.99999 | 5.013232 |
3195df8e-6f9c-4067-9162-d9650191a938 | MOUAD-BAKAOUI/Challenges-last | fonction/ex6.cpp | //#include<stdio.h>
//
//int add(int a , int b){
//
// return a+b;
//}
//
//int soustr(int a , int b){
//
// return a-b;
//}
//
//int mult(int a , int b){
//
// return a*b;
//}
//
//int main(){
//
// int x,y;
// printf("entrer deux nombres:\n"); scanf("%d %d",&x , &y);
//
//// printf("choisit l'opration afficher ... | TOOL | 0.958001 | 3.470419 |
6560a5aa-8854-4470-aacd-5b4aaf47cb65 | AyushiVadariya/DSA-C- | Lab_Manual/EX_2.cpp | #include <iostream>
#include <stack>
#include <cctype>
#include <string>
using namespace std;
int precedence(char op) {
if (op == '^')
return 3;
else if (op == '*' || op == '/')
return 2;
else if (op == '+' || op == '-')
return 1;
else
return 0;
}
bool isOperator(char c... | ALGO | 0.99993 | 6.139092 |
c3570022-eb6f-4314-99f3-eb63e16106ef | SnowArtics/Coding-Test_Study | implementation/소수 구하기.cpp | #include <bits/stdc++.h>
using namespace std;
vector<int> IsPrime(int m, int n) {
vector<int> primes;
vector<bool> isPrime(n+1, true);
isPrime[1] = false;
for (int i = 2; i * i < n+1; ++i) {
if (!isPrime[i]) continue;
for (long long j = i * i; j < n+1; j+=i) {
isPrime[j] = false;
}
}
for (int i = m; ... | ALGO | 0.999933 | 3.703035 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.