uuid stringlengths 36 36 | repo_name stringlengths 5 123 | relative_path stringlengths 5 4k | content stringlengths 33 2.85M | category stringclasses 6
values | algo_rel_score float64 0.85 1 | quality_score float64 3 8.76 |
|---|---|---|---|---|---|---|
395c5bc1-dc47-4f5c-b01e-3955ace388cb | BinomialSheep/CompetitiveCpp | AtcoderContest/AHC014/14_高速化.cpp | #pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
// デバッグ用マクロ:https://naskya.net/post/0002/
#ifdef LOCAL
#include <debug_print.hpp>
#define debug(...) debug_print::multi_print(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (static_cast<void>(0))
#e... | ALGO | 0.999832 | 3.650981 |
ed3a95dd-1567-4e42-be37-91f22e7aedb5 | RushiVachhani/codeforces-solutions | 472A.cpp | /*
* Author: Rushi Vachhani
* Platform: Codeforces
* Problem_ID: 472A
* Language: C++
*/
#include<bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
if(n%2==0) {
cout << n-4 <<" " << 4;
}
else {
cout<< n-9... | ALGO | 0.999577 | 4.070873 |
2da0d8cc-654e-4c26-a9d1-18e70220e2f9 | vishalrangras/P10-Model-Predictive-Control | src/Eigen-3.3/doc/examples/DenseBase_template_int_middleCols.cpp | #include <Eigen/Core>
#include <iostream>
using namespace Eigen;
using namespace std;
int main(void)
{
int const N = 5;
MatrixXi A(N,N);
A.setRandom();
cout << "A =\n" << A << '\n' << endl;
cout << "A(:,1..3) =\n" << A.middleCols<3>(1) << endl;
return 0;
}
| ALGO | 0.887526 | 3.154174 |
eee1caab-0534-44ff-9bc1-4cc56640d5f9 | raincross7/code-similarity | codes/train_code/problem257/problem257_303.cpp | #include<bits/stdc++.h>
using namespace std;
int n,m,k,ans;
int a[10][10];
char x;
int h[10],w[10];
void dfs(int u){
if(u==n+m+1){
// for(int i=1;i<=n;++i)cout<<h[i]<<" ";
// for(int j=1;j<=m;++j)cout<<w[j]<<" ";cout<<endl;
int s=0;
for(int i=1;i<=n;++i)
for(int j=1;j<=m;++j){
if(h[i]||w[j]) continue;
... | ALGO | 0.999957 | 3.709756 |
2205e7c8-d656-4179-a1c6-ddf549170471 | mehedihasan8226/C-_and_data-structure_with_phitron | week_11/Module 40/graph_implimentation.cpp | #include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> edgeweightpair;
class Graph{
int v;
list<edgeweightpair> *adj;
public:
Graph(int v){
this->v = v;
adj = new list<edgeweightpair> [v];
}
void addEdge(int u, int v, int w){
adj[u].push_back(make_pair(v,w));
... | ALGO | 0.999993 | 4.290263 |
6492fc9c-894e-4d03-8241-39bc6aa8ec62 | adorableChowhound/translation_app | nmt/tools/mosesdecoder/moses/HypothesisStackNormal.cpp | // $Id$
#include <algorithm>
#include <set>
#include <queue>
#include "HypothesisStackNormal.h"
#include "TypeDef.h"
#include "Util.h"
#include "Manager.h"
#include "util/exception.hh"
using namespace std;
namespace Moses
{
HypothesisStackNormal::HypothesisStackNormal(Manager& manager) :
HypothesisStack(manager)
{... | ALGO | 0.981025 | 6.145042 |
1a74b5d4-1ba4-491d-b80f-10b296c9621f | MikaelVallenet/R-Type | libs/boost/libs/regex/tools/generate/tables.cpp | /*
* LOCATION: see http://www.boost.org for most recent version.
* FILE tables.cpp
* VERSION see <boost/version.hpp>
* DESCRIPTION: Generates code snippets programatically, for cut-and
* paste into regex source.
*/
#include <boost/config.hpp>
#include <map>
#include <... | TOOL | 0.939961 | 3.638132 |
986f6eba-4721-48c3-bc32-6cce606b21c2 | cakoshakib/range-lis | novel/short_query.cpp | #include "rlis.h"
#include <math.h>
#include <algorithm>
#include <limits>
using namespace std;
void RLIS::r_range_tree(Node *node, map<int, PatienceNode*>& B_beta) {
// Construct tree that allows for log(n) r_range_max computation
int start = node->start, mid = node->mid, end = node->end;
// maximum base ... | ALGO | 0.999868 | 4.426799 |
b23b44e0-7861-47f3-b7bb-d14b45a11f6d | Lucas3H/NepsAcademy-Solucoes | Programacao_basica/Repeticao_While/premio_do_milhao.cpp | //Link: https://neps.academy/lesson/134
#include<iostream>
using namespace std;
int main(){
int n, i=0, a, s=0, dias=0;
cin>>n;
while(i<n){
cin>>a;
s = s + a;
i++;
if(s<1000000){
dias++;
}
}
cout << dias+1;
return 0;
}
| ALGO | 0.999363 | 3.465841 |
aeee54bc-0efb-4e4c-8d46-bb72e6fb8a64 | Cattmonkey/openWork | webWork_backup/webflask/templates/recipes/broydn.cpp | #include <cmath>
#include <limits>
#include "nr.h"
using namespace std;
Vec_DP *fvec_p;
void (*nrfuncv)(Vec_I_DP &v, Vec_O_DP &f);
void NR::broydn(Vec_IO_DP &x, bool &check, void vecfunc(Vec_I_DP &, Vec_O_DP &))
{
const int MAXITS=200;
const DP EPS=numeric_limits<DP>::epsilon();
const DP TOLF=1.0e-8, TOLX=EPS, STP... | ALGO | 0.999991 | 5.362097 |
ba6b5225-1f28-4d41-b023-62715a43eec3 | satyaswarup129/Data-Structure-And-Algorithms | Day-128/potd/lc-Find the Original Typed String I.cpp | class Solution {
public:
int possibleStringCount(string word) {
int count = 0;
for(int i = 1; i < word.length(); i++) {
if(word[i] == word[i-1])
count++;
}
return count+1; //+1 for when Alice does no long press
}
};
puts 'Hello world!'
| ALGO | 0.999252 | 4.243427 |
f323f2c7-44cd-414e-94bd-42eeb9e9f1f0 | sunilkumarmaurya786693/solution-leedcode-codechef-codeforces-gfg-interviewbits-hackerEarth-HackerRank | leetcode/math/13_Roman_to_integer.cpp | // 13. Roman to Integer
// Easy
// 7423
// 442
// Add to List
// Share
// Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M.
// Symbol Value
// I 1
// V 5
// X 10
// L 50
// C 100
// D 500
// M ... | ALGO | 0.999683 | 6.091523 |
f36fbd18-f00c-45fe-9e24-fc9a26df5806 | Karthika2623/Google-Map-Using-Live-Location | 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.998784 | 6.761023 |
8d502a8d-1f98-4f4f-8938-f57f5d831589 | root-jeong/BOJ | ~9999/1789_수들의 GKQ.cpp | #include <iostream>
using namespace std;
int main() {
unsigned long long S;
cin >> S;
unsigned long long a = 0;
unsigned long long cnt = 1;
while (a <= S) {
a += cnt;
cnt++;
}
cout << cnt - 2 << endl;
} | ALGO | 0.998386 | 3.212277 |
854191ad-c376-45c8-b376-cf05beec105b | Prateek-16/Leetcode_Solutions | 0236-lowest-common-ancestor-of-a-binary-tree/0236-lowest-common-ancestor-of-a-binary-tree.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
TreeNode* lowestCommonAncestor(TreeNode* root, TreeNode* p, TreeNode* q) {
if(root==NUL... | ALGO | 0.999981 | 5.937329 |
7fa10473-fc9f-40d2-973e-23549d0d6da5 | lucasZyh/cpp-Project | C++提高编程/03string-容器/test03.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
void test03() {
string s1 = "hello world";
string s2 = "helloworld";
if (s1.compare(s2) == 0) {
cout << "s1 等于 s2" << endl;
}
else {
cout << "s1 不等于 s2" << endl;
}
}
void test04() {
string s1 = "abcdef";
for (int i = 0; i < s... | TOOL | 0.920719 | 3.145149 |
f80aa4a0-5e82-4fe5-be0e-13fce55d5089 | bireshwar67/Data_Structures | Sorting/minMovesToSeat.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
class Solution
{
public:
int minMovesToSeat(vector<int> &seats, vector<int> &students)
{
sort(seats.begin(), seats.end());
sort(students.begin(), students.end());
int ans = 0;
for (int i = 0; i < sea... | ALGO | 0.999948 | 5.738502 |
3ee5e6a6-6451-44b9-95d2-d3448cb670bf | shubhi-arora/6Companies30days | Microsoft/q7_unit_area_region.cpp | // { Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution
{
public:
//Function to find unit area of the largest region of 1s.
int findMaxArea(vector<vector<int>>& grid) {
// Code here
int area=0;
for(int i=0;i<grid.size();i++)
... | ALGO | 0.99994 | 6.305113 |
8ab0aa7e-d954-4fd3-935d-8eb7a3d3ccd2 | SAURABHMISHRA55/CPP-Striver-A2Z | Step_9_Stacks_and_Queues/.INTERVIEW-TYPE-PROBLEMS/05-TRAPPING-RAINWATER.CPP | #include <bits/stdc++.h>
using namespace std;
// VERY VERY IMP PROBLEM -> IT WAS ASKED IN MICROSOFT INTERVIEW THIS YEAR, ALL THE POSSIBLE APPROACHES WERE ASKED (2023) (ON-CAMPUS)
// BRUTE FORCE --> Time ~ O(n^2)
/* If we observe carefully the amount the water stored at a particular index is the minimum of maximum ele... | ALGO | 0.999846 | 6.832918 |
5837ecb2-b4bf-4aed-a997-858d5cf845e0 | varshap17/DSA | Strings/remove all adjacent duplicates in string II.cpp | string removeDuplicates(string s, int k)
{
string ans="";
stack<pair<char,int>> st;
int n=s.length();
if(n<k)
{
return s;
}
for(int i=0;i<s.length();i++)
{
if(st.empty() || st.top().first!=s[i])
{
st... | ALGO | 0.999992 | 5.436934 |
d0c34c46-53d9-4fa6-9617-94f8d0263aa1 | rickytan/LeetCode | serach-for-a-range/main.cpp | #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
class Solution {
public:
vector<int> searchRange(int A[], int n, int target) {
int start = 0;
int end = n;
int mid;
while (start <= end) {
mid = (start + end) / 2;
if (A[mid] > t... | ALGO | 0.999943 | 6.009295 |
14f848e0-574d-4ac0-95d3-2f9ce9cb0076 | ArmanKumar21/python-cpp-html-programs-projects | Cpp/MergeTwoBst.cpp | // Program to merge two BSTs
#include <bits/stdc++.h>
using namespace std;
// Structure of a BST Node
class Node
{
public:
int val;
Node *left;
Node *right;
Node(int data = 0)
{
this->val = data;
this->left = nullptr;
this->right = nullptr;
}
};
// Function to merge tw... | ALGO | 0.999996 | 5.971168 |
d146bbe1-efc5-4a66-b6d5-bf0db2d563e1 | H874589148/data-structure | 数据结构实验3/10.19/队列.cpp | #include<stdio.h>
#include<stdlib.h>
#include<stdbool.h>
typedef struct LNode{
int data;
struct LNode *next;
}LNode,*LinkList;
typedef LinkList Queueptr;
typedef struct{
Queueptr front;
Queueptr rear;
}LinkQueue;
int main()
{
void CreateQueue_L(LinkQueue &Q);
void DestroyQueue_L(LinkQueue &Q);
void EnQueue_L(Li... | ALGO | 0.999891 | 3.079767 |
4f9cc7ac-a280-45e3-b944-689ad7c6c294 | gautamop01/Daily-Goals-Of-Coding | Code Forces/Asterisk_Minor_Template.cpp | B is Here 🔥🔥🔥🔥🔥🔥🔥
//B
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define MOD 1000000007
#define SIZE 1e6+2
#define endl "\n"
void solve() {
string a,b; cin>>a>>b;
ll n=a.size(),m=b.size();
if(n==1 and m==1){
if(a==b){
cout<<"YES"<<endl;
cout<<... | ALGO | 0.999966 | 4.257326 |
8870d013-8ad4-4573-8f8f-9966f56efd70 | NaveenKumar-n4v/Leetcode | 57-insert-interval/57-insert-interval.cpp | class Solution {
public:
vector<vector<int>> insert(vector<vector<int>>& intervals, vector<int>& newInterval) {
intervals.push_back(newInterval);
sort(intervals.begin(), intervals.end());
vector<int> temp = intervals[0];
vector<vector<int>>ans;
for(auto i : ... | ALGO | 0.999987 | 6.121526 |
7098c880-3218-4e90-8a50-43572b5d57df | VishalBh4r4mbe/DataStructuresAndAlgorithms | contest/D. Powerful array.cpp | #include<bits/stdc++.h>
#define MAXN 200010
#define MAXX 1000010
using namespace std;
int block;
long long arr[MAXN+1],freq[MAXX+1],sol[MAXN+1];
inline long long int hilbertOrder(int x, int y, int pow, int rotate) {
if (pow == 0) {
return 0;
}
int hpow = 1 << (pow-1);
int seg = (x < hpow) ? (
(y < hpow) ? 0 : 3... | ALGO | 0.999947 | 3.675195 |
4089d772-6c99-49ef-90da-b270e468010d | bm-mit/Codeforces | 427B_PrisonTransfer.cpp | //* 204128241 May/01/2023 17:33UTC+7 Minh4893IT B - Prison Transfer GNU C++17 Accepted 62 ms 4700 KB
#include <bits/stdc++.h>
using namespace std;
using sint = signed int;
#define ll long long
#define ull unsigned ll
#define int ll
#define ss stringstream
#define uset unordered_set
#define umap unordered_map
#define ... | ALGO | 0.999904 | 4.424044 |
78b8371f-0d00-44d3-86b2-6b3d98e5f66a | van-huffel/eth-mavt | notes/cmea_projects/Project 1/project1_handout/corona_dirk/dirkconv.cpp | #include "writer.hpp"
#include <Eigen/Core>
#include <Eigen/LU>
#include <vector>
#include <iostream>
#include <chrono>
#include "coronaoutbreak.hpp"
#include "dirksolver.hpp"
//----------------mainBegin----------------
int main(int argc, char** argv) {
double T = 450;
CoronaOutbreak outbreak(0,0,0,0,0,0.03,0... | ALGO | 0.999346 | 5.721104 |
4c435c77-b736-4168-ad68-f44683fece8c | GnatishinMikhail/MyLabs | Laboratory 6/Lab6-5.cpp | #include <iostream>
#include <cmath>
using namespace std;
int main() {
setlocale(LC_ALL, "Rus");
float x, y;
cout << "Введите аргумент функции: \n";
cin >> x;
y = 4 * pow(x - 3, 6) - 7 * pow(x - 3, 3) + 2;
cout << "Значение функции y = 4(x-3)^6 - 7(x-3)^3 + 2: \n" << y << endl;
return 0;
}
| ALGO | 0.998784 | 4.021428 |
19bf9a86-e6e6-45cb-a9fc-3407cce54c53 | sahilwep/DSA-Workspace | Leetcode/Medium/59_Spiral_Matrix_II.cpp | /*
// 59. Spiral Matrix II
// Problem Statement:
-> Given a positive integer n, generate an n x n matrix filled with elements from 1 to n2 in spiral order.
// Example:
Example 1:
Input: n = 3
Output: [[1,2,3],[8,9,4],[7,6,5]]
Example 2:
Input: n = 1
Output: [[1]]
//... | ALGO | 0.999919 | 6.178291 |
e8ea3704-55cb-406f-9859-00a8b72e2222 | afroozsheikh/DS_final_project | Project69/Source.cpp | #include <iostream>
#include <cstdlib>
#include<fstream>
#include<map>
#include<string>
#include<vector>
using namespace std;
map<char, string> ourmap;
#define MAX_TREE_HT 100
struct MinHeapNode {
char data;
unsigned freq;
struct MinHeapNode* left, *right;
};
struct MinHeap {
unsigned size;
unsigned capacity... | ALGO | 0.999905 | 3.797045 |
5fa6791a-0d6f-4d2a-a735-99b911b740a5 | theArcticOcean/CLib | VTKLearn/sortCirclePts/main.cpp | #include <vtkSmartPointer.h>
#include <vtkProperty.h>
#include <vtkSelectPolyData.h>
#include <vtkSphereSource.h>
#include <vtkClipPolyData.h>
#include <vtkProperty.h>
#include <vtkPolyDataMapper.h>
#include <vtkLODActor.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkRenderWindow.h>
#include <vtkRenderer.h>
#in... | ALGO | 0.939663 | 3.932788 |
6c2cfa8d-b4d2-4565-b269-5fad79d4ee9f | ishandutta2007/codeforces | egor.lifar/normal/908/E.cpp | /*
@@@@@@@@@@@@@@@@PP!!__......::ii@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@NNGG@@MM..............MM$$oo@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@... | ALGO | 0.999995 | 4.252771 |
e955f6e3-8c49-44ed-aef8-069cb68486bd | MdFaizan7397/Strivers-SDE-Sheet-challenge | At least two greater elements - GFG/at-least-two-greater-elements.cpp | //{ Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution{
public:
vector<int> findElements(int a[], int n)
{
sort(a,a+n);
vector<int>ans;
for(int i=0;i<n-2;i++){
ans.push_back(a[i]);
}
return ans;
}
};
//{ ... | ALGO | 0.999579 | 5.524882 |
4ab077fa-c435-4e4f-a774-a5a138311d11 | smsh0722/PS | problems/1149.cpp | #include <iostream>
#include <vector>
using namespace std;
const int MAXPLUS1 = 1000 * 1000 + 1;
void BFS( int level, const vector< int[3] >& rgbList, vector< vector<int> >& levelIdxMin, const int N )
{
for ( level; level < N - 1; level++ ){
int nextLevel = level + 1;
vector< vector<int> > dstCase... | ALGO | 0.997331 | 4.574433 |
f88961ad-e2ce-4260-8059-8f89bfb91abe | Sumonta056/Learning-DataStructure-and-Algorithms | ACM-Library-master-copy/String/Palindromic Tree.cpp | //Palindromic Tree
//Complexity : O(n) memory and O(n) time
#include<bits/stdc++.h>
using namespace std;
#define INF 1e9
#define MAX 300005
#define ff first
#define ss second
#define pii pair<int,int>
struct node{
int next[26];
int minPos; //Position in string where this node ff occurs
int occurrenc... | ALGO | 0.99999 | 3.909017 |
c0d9920b-b8fe-43ae-ba9b-b1adc5db3b69 | imujdeci/ToDoApp | ToDo/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.998778 | 6.785645 |
28eca974-d1d7-4dd8-b502-25e8e1975e3d | VaishnavShelke/DS-Algo | BST/Count pairs from two BSTs whose sum is equal to a given value x.cpp | #include <bits/stdc++.h>
using namespace std;
// Count pairs from two BSTs whose sum is equal to a given value x
/*
But important thing is that you learnt inorder traversal ITERATIVE
*/
struct Node {
int data;
Node* left, *right;
};
Node* getNode(int data)
{
Node* new_node = (Node*)malloc(sizeof(Node)... | ALGO | 0.999981 | 4.743454 |
16e00460-433a-42a0-9164-d8fef8bd0f8e | goropikari/CompetitiveProgramming | atcoder/arc161/b.cpp | // https://atcoder.jp/contests/arc161/tasks/arc161_b
// 2025年07月13日 13時12分56秒
#include <bits/stdc++.h>
using namespace std;
// #include <atcoder/all>
// using namespace atcoder;
// using mint = modint998244353;
// using mint = modint1000000007;
// using vmint = vector<mint>;
// modint::set_mod(10);
// using mint = modi... | ALGO | 0.999388 | 5.22236 |
12136e03-6e9b-4bac-82d0-4bd32538e1f4 | Evertume/PP1 | assignment_2/B.cpp | #include <iostream>
using namespace std;
int main() {
int n;
n >= 1;
n <= 100;
cin >> n;
if ( n % 2 == 1)
cout << "Super";
else if ( n % 2 == 0 && n >=6 && n <= 20)
cout << "Super";
else cout << "Not Super";
return 0;
} | TOOL | 0.97977 | 3.120855 |
cfed0b51-649f-4cc2-8f81-1be31fff0d19 | siddiqui-zeeshan/Leetcode | Code/Flip Equivalent Binary Trees.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
bool flipEquiv(TreeNode* root1, TreeNode* root2) {
if ((root1==NULL && root2!=NULL)... | ALGO | 0.999995 | 6.360544 |
47b3d90f-3748-46d3-bc33-f1093c02a07b | ishandutta2007/codeforces | alpha_q/normal/1326/D1.cpp | #include <bits/stdc++.h>
using namespace std;
const int A = 26;
const int N = 2000010;
char s[N], a[N];
int t, n, pal[N], z[N];
int main() {
cin >> t;
while (t--) {
scanf("%s", s);
n = strlen(s);
int at = -1;
while (at < n - 1 and s[at + 1] == s[n - 1 - at - 1]) ++at;
if (at == n - 1) {
... | ALGO | 0.999968 | 4.036615 |
729fdf08-06d4-4692-af05-1d2b677af128 | ncchen99/Competitive-Programming | ZeroJudge/a233 排序法~~~ 挑戰極限.cpp | #include<bits/stdc++.h>
using namespace std;
int arr[1000000]={0};
int main(){
int n;
cin>>n;
for(int i=0;i<n;i++) cin>>arr[i];
sort(arr,arr+n);
for(int i=0;i<n;i++) cout<<arr[i]<<" ";
}
| ALGO | 0.999904 | 3.514511 |
a488b2e6-a06e-45ef-89d9-cddf5b4fc21e | sauravsaxena7/DSA-C-Coding | recursion/Height_of_binary_tree_using_recursion.cpp | #include<bits/stdc++.h>
using namespace std;
class Node
{
public:
int data;
Node *left;
Node *right;
Node(int val){
data=val;
left=right=NULL;
}
};
Node* buildTree(string str){
// cout<<"saurav suman "<<str<<endl;
if(str.length()==0 || str[0]=='N')
return NULL;
vector<char> ip;
for(int i=0;i<str.len... | ALGO | 0.999822 | 5.302279 |
95ac1dd7-56b3-4d9c-9c04-ff80f963f23e | octupole/testDD | Parallel/fftw3mpi.cpp | /*
* fftw3mpi.cpp
*
* Created on: Feb 11, 2020
* Author: marchi
*/
#include "fftw3mpi.h"
namespace Parallel {
fftw3mpi::fftw3mpi(int nx, int ny, int nz) {
int isInitialized;
MPI_Initialized(&isInitialized);
try{
if(!isInitialized) throw string("MPI must be intialized before calling pfft!");
}catch(co... | ALGO | 0.930668 | 5.061034 |
e6d1e4d2-b42b-44b7-bdd8-80f09bbabcbb | duongtrieuelec/LeetSolve | cpp-leetcode/leetcode189-rotate-array_two_pointers_solution.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
class Solution
{
public:
void rotate(vector<int> &nums, int k)
{
int n = nums.size();
if (nums.empty() || (k % n) == 0) return;
int nowIndex = 0;
int temp, cur = nums[0];
// 双指针
... | ALGO | 0.999968 | 5.663034 |
d0755f93-5827-40f8-95f5-ce8528ff59b2 | shatakshishukla17/6companies30days-ShatakshiShukla | SerializAndDeserializeBinaryTree.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Codec {
public:
// Encodes a tree to a single string.
string serialize(TreeNode* root) {
if(!root) re... | ALGO | 0.999469 | 6.205658 |
435898e9-955f-4cbf-98c2-a40665de57ad | Abhishekjha002/Competitive_programming | Recursion/Aeroplane_question.cpp | #include <iostream>
using namespace std;
int Board[13][5] = {0};
int originalBoard[13][5] = {0};
int maxCoins = 0;
int dirN[3] = {-1,0,1};
void Blast(int row)
{
for(int i=row, count = 0; i>=0 && count < 5; i--, count++)
{
for(int j=0;j<5;i++)
{
if(Board[i][j] == 2)
{
... | ALGO | 0.999782 | 4.119859 |
d2bf1e98-3c12-479a-a75f-baf21e70a90d | Yashi2002/CPP_LEC | chapter_10_templates/stack_class.cpp | #include<iostream>
using namespace std;
const int MAX= 20;
template<class t>
class stack
{
private:
t arr[MAX];
int top;
public:
stack()
{
top = -1;
}
void push(t data)
{
arr[++top]=data;
}
pop()
{
return arr[top--];
}
int size()
{
... | ALGO | 0.968045 | 4.345612 |
59d203e4-cdc5-4532-a5dd-f79136947932 | LihengGong/computer_graphics | OpenGL_2d/ext/eigen/unsupported/doc/examples/MatrixSine.cpp | #include <unsupported/Eigen/MatrixFunctions>
#include <iostream>
using namespace Eigen;
int main()
{
MatrixXd A = MatrixXd::Random(3,3);
std::cout << "A = \n" << A << "\n\n";
MatrixXd sinA = A.sin();
std::cout << "sin(A) = \n" << sinA << "\n\n";
MatrixXd cosA = A.cos();
std::cout << "cos(A) = \n" << cos... | ALGO | 0.984799 | 5.878768 |
d43facba-90aa-4af2-8351-cb55927f1039 | kiyoshiiriemon/simple_lio_localization | src/map_matcher.cpp | #include "map_matcher.h"
#include <pcl/common/transforms.h>
using namespace small_gicp;
using namespace simple_lio_localization;
static std::vector<Eigen::Vector4f> pcl_to_vecarray(const PointCloudPCL &cloud)
{
std::vector<Eigen::Vector4f> points;
for (const auto &point: cloud.points) {
points.emplace... | ALGO | 0.911908 | 6.034815 |
9aa45f30-518a-47fb-a750-2ed7257da6df | Manan007224/street-coding | Leetcode/word_search.cpp | #include <bits/stdc++.h>
using namespace std;
typedef vector<vector<char>> vcc;
class Solution {
public:
bool exist(vector<vector<char>>& board, string word) {
if(board.size()==0) return 0;
if(board[0].size()==0) return 0;
return dfs(board,"",word,0,0);
}
bool dfs(vcc &b, string cr, string... | ALGO | 0.999563 | 5.523991 |
d14dc33d-7a32-4128-8cee-0a71449f5d58 | trailofbits/llvm-sanitizer-tutorial | llvm/lib/CodeGen/SelectionDAG/ResourcePriorityQueue.cpp | #include "llvm/CodeGen/ResourcePriorityQueue.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/SelectionDAGNodes.h"
#include "llvm/CodeGen/TargetLowering.h"
#include "llvm/CodeGen/TargetSubtargetInfo.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostre... | ALGO | 0.987276 | 7.543655 |
69169727-b777-4402-96fa-075459a886b1 | Adivatsa/Coding | String/reversePair.cpp | string reverseParentheses(string s) {
//Take one stack for storing characters inside it
//Approach
//if found any open bracket then insert into stack
//if found any letter just check if stack is not empty then push into stack
//otherwise concatenate to output string ... | ALGO | 0.9997 | 4.311515 |
9b1d1a0c-2626-4c14-be71-b4d92ff9b1ed | KatsuyaKikuchi/ProgrammingContest | AtCoder/AtCoder Beginner Contest/ABC203/B.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> pll;
#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(40)
const ll MOD = 1000000007;
const ll INF = (ll) 1e15;
int main() {
cin.tie(0);
ios::sync_with_s... | ALGO | 0.999414 | 3.573129 |
1a216788-642c-4c7e-9535-488a659f285d | Sampurn44/DSA | codeforces/divb.cpp | #include <bits/stdc++.h>
using namespace std;
void answer(){
int n;
cin>>n;
int dev[n];
for(int i=0; i < n; i++){
cin>>dev[i];
}
set<int>ved;
for(int i=0; i < n; i++){
ved.insert(dev[i]);
}
if(ved.size() == n){
cout<<"YES"<<endl;
}
else{
cout<... | ALGO | 0.999703 | 3.899373 |
aaf475f8-0ac6-44de-b1c4-25a69b870b89 | taobear/OnlineJudge | LeetCode/DynamicProgramming/leetcode494/findTargetSumWays.cpp | #include "findTargetSumWays.h"
#define MAX_ARRAY_NUM 20
#define MAX_ARRAY_SUM 1000
int g_sumWaysNum[MAX_ARRAY_NUM][MAX_ARRAY_SUM * 2];
int helper(int* nums, int numsSize, int S)
{
if (numsSize <= 0) {
return S == 0 ? 1 : 0;
}
int ret = 0;
if (S + nums[numsSize - 1] < 1000) {
if (g_su... | ALGO | 0.999987 | 5.493828 |
36b17b68-2c51-42e9-baea-dc8aeb0ee95b | OwaisK4/Competitive-Programming | CSES/Stick_Lengths.cpp | #include <bits/stdc++.h>
#define all(a) a.begin(), a.end()
#define seed chrono::high_resolution_clock::now().time_since_epoch().count()
#define file_read(filepath) freopen(filepath, "r", stdin);
#define file_write(filepath) freopen(filepath, "w", stdout);
#define fastio \
ios::sync_with_stdio(fals... | ALGO | 0.999903 | 4.899098 |
7e2b57be-2ed5-4287-bbef-5671547a6d3a | qnhat2004/Thuat-toan-ung-dung | Finetest/Phan-tich-N-thanh-tong-M-so.cpp | #include<bits/stdc++.h>
using namespace std;
int m, n;
int tmp[100];
void print() {
cout << n << " = " << tmp[0];
for (int i = 1; i < m; i++)
cout << "+" << tmp[i];
cout << endl;
}
void gen(int i, int sum) {
if (i == m) {
if (sum == n) {
print();
}
return;
}
for (int j = 1; j <= n; j++) {
if (sum +... | ALGO | 0.999342 | 3.370002 |
d7ec232a-e2f4-4acc-b04b-fc2423a122d2 | pnnv/hyprland-dotfiles | VSCodium/User/History/2e1f31e6/9dOl.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
void snu() {
int n; cin >> n;
vector <int> p(n);
for (int i = 0; i < n; i++) cin >> p[i], p[i]--;
string s; cin >> s;
vector <int> b(n), vis(n), cyc, tmp(n), c(n);
function <int(int)> f = [&](int cur) {
int x = 0;
if(vis[p[cur]] == 0) {
... | ALGO | 0.999982 | 4.766023 |
fde9df94-f301-40b0-919f-8574ed3321a6 | YilinZhang107/my_c | Program_design/c++/homework2/4.cpp | #include<bits/stdc++.h>
using namespace std;
class Accout{
private:
int num;
string name;
string password;
double balance;
static double rate; //活期年利率
public:
Accout(int n,string nm,string p,double b){
num = n;
name = nm;
passw... | TOOL | 0.935516 | 4.126854 |
5d8967d2-1f59-4e5c-9ee8-03d10cba680b | ahmedmagdy492/My-Computer-Archeticture-Study | projects/6/project/Hack_Assembler/src/Utils.cpp | #include "include/Utils.h"
#include <fstream>
#include <sstream>
std::vector<std::string>* Utils::Split(std::string& inputStr, char delim) const
{
std::vector<std::string>* output = new std::vector<std::string>();
std::string outputStr;
for (int i = 0; i < inputStr.length(); ++i) {
if (inputStr[i] != delim) {
... | TOOL | 0.943511 | 5.830474 |
9576b1cc-628b-4952-8e8e-d45357881009 | kasa021/atcoder-archives | abc261/abc261_c_41889691_AC.cpp | /*
* Author: kAsA02
* Submission URL: https://atcoder.jp/contests/abc261/submissions/41889691
* Submitted at: 2023-06-01 10:01:29
* Problem URL: https://atcoder.jp/contests/abc261/tasks/abc261_c
* Result: AC
* Execution Time: 446 ms
*/
#include <bits/stdc++.h>
#include <cmath>
#if __has_include(<atcoder/all>)
... | ALGO | 0.999621 | 5.284977 |
14893007-6b7b-46bd-ab87-9e9ff526e5d2 | ShrikrishnaR-2004/cpp-program-for-UCSD | universal_string.cpp | #include <iostream>
#include <string>
#include <queue>
#include <map>
#include <vector>
#include <set>
#include <algorithm>
#include <iterator>
#include <sstream>
#include <stdio.h>
#include <math.h>
using namespace std;
#define fora(i, f, t) for(int i = f; i<t; i++)
#define KMER 10
#define DATASIZE 5396
typedef vecto... | ALGO | 0.999982 | 4.140175 |
98cbd60b-ece2-411d-8f1c-bfc32053abb1 | NikolaySmirnov14/Lab | Лабораторная 2/Lab2_1.cpp | #include <stdio.h>
#include <math.h>
int main()
{
float x1, y1, x2, y2;
float r;
printf("Введите координаты x и y первой точки \n");
scanf("%f\n", &x1);
scanf("%f", &y1);
printf("Введите координаты x и y второй точки \n");
scanf("%f\n", &x2);
scanf("%f", &y2);
r=pow((x1-x2), 2) + pow((y1-y2), 2);
printf("Расстояние меж... | ALGO | 0.999274 | 3.735543 |
1df183eb-31bf-4770-ad63-09a38c75a41c | mannubhai1/DSA_LAB | dsa_Sample_graph/strongly_connected.cpp | // C++ Implementation of Kosaraju's algorithm to print all SCCs
#include <iostream>
#include <list>
#include <stack>
using namespace std;
class Graph
{
int V; // No. of vertices
list<int> *adj; // An array of adjacency lists
// Fills Stack with vertices (in increasing order of finishing
// times). The top element... | ALGO | 0.999792 | 6.422852 |
404447c4-3989-4647-8bf6-b57492f05ef5 | albbeltran/Bullground-IntroCourse-Exercises | M5-Switch/Ejercicios/Ejercicio2.cpp | /* Escribir un programa que pregunta al usuario un nmero del 1 al 7 e indique el dia
de la semana correspondiente. */
#include<iostream>
#include<string>
using namespace std;
int main() {
int num;
string dia;
cout<<"Ingresa un numero: "; cin>>num;
switch(num) {
case 1:
dia = "Lunes";
break;
case 2... | TOOL | 0.937117 | 3.296161 |
75e0aa9c-dcce-49a0-963f-6495dc34466b | ishandutta2007/codeforces | greencis/normal/285/A.cpp | #include <iostream>
using namespace std;
int n,k;
int main()
{
cin >> n >> k;
if (k == 0) {
for (int i = 0; i < n; ++i)
cout << i+1<<" ";
return 0;
}
cout << n << " ";
for (int i = k; i > 0; --i)
cout << i << " ";
for (int i = k+1; i < n; ++i)
cout... | ALGO | 0.999923 | 3.210257 |
5def8b68-c698-4825-b4cb-cca544a728eb | NoahWangZhi/cpp_algorithm | 11乘最多水的容器/11乘最多水的容器/11乘最多水的容器.cpp | // 11乘最多水的容器.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
//
#include "pch.h"
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int maxArea(vector<int>& height) {
if (height.size() <= 1) return -1;
int h;
int i = 0, j = height.size() - 1, res = 0;
int restemp = 0;
while (i < j) {
if (he... | ALGO | 0.999758 | 5.95595 |
1617f308-96cf-480b-8b1b-56b4643097fd | CedricDeVon/C_CPP_Practice_Sandbox | Sources/Personal___MatrixRowReversal___1/main.cpp | #include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
int main(void)
{
// std::ios_base::sync_with_stdio(false);
// std::cin.tie(NULL);
// std::cout.tie(NULL);
unsigned int a, b;
std::cin >> a >> b;
double c[a][b];
double* pa, *pb;
std::string outpu... | ALGO | 0.975383 | 3.152866 |
0c8c0ac6-50da-467b-bb56-a994644e4171 | nnonnoon/AbstractDataType | week1/Split.cpp | #include <iostream>
using namespace std;
int main()
{
int n;
cin >> n;
do {
int digit = n%10 ;
cout << digit << endl;
n/=10;
}while(n>0);
}
| ALGO | 0.999893 | 4.513982 |
c528f706-c22c-4914-8840-c47b927f6e52 | ptiw-rep/LeetCodePractice | 543-diameter-of-binary-tree/543-diameter-of-binary-tree.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.999844 | 6.54622 |
09a350e0-d6cf-4f9b-a8ae-36bc53b9efba | scyllacore/algorithm | C++ 풀이/acmicpc.net/2146(다리 만들기) - BFS.cpp | #include <iostream>
#include <algorithm>
#include <queue>
using namespace std;
int mapNN[100][100];
int dis[100][100];
int n,ans=99999;
struct pos {
int y, x;
};
int dy[] = { -1,1,0,0 };
int dx[] = { 0,0,-1,1};
void areaBFS(int y,int x,int area) {
queue<pos> bfsQ;
bfsQ.push({ y,x });
mapNN[y][x] = area;
int... | ALGO | 0.999878 | 3.70711 |
05cec5ff-0ef8-490d-81ed-5bbdd6a832ca | Kartikay-Mehrotra/Leetcode | 2593-find-score-of-an-array-after-marking-all-elements/2593-find-score-of-an-array-after-marking-all-elements.cpp | class Solution {
public:
long long findScore(vector<int>& nums) {
int n=nums.size();
vector<int> vis(n+1,0);
vector<pair<int,int>> v;
for(int i=0;i<n;i++)
{
v.push_back({nums[i],i});
}
sort(v.begin(),v.end());
long long ans=0;
for(i... | ALGO | 0.999985 | 5.129705 |
2b657273-2520-4007-bf0a-824937f28834 | Ziklon/algorithms | uva/10166.cpp | /*
ID: winftc2
PROG: in.txt
LANG: C++
*/
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#incl... | ALGO | 0.9996 | 3.655411 |
94b8b800-f3c9-4379-a718-0e4447c41615 | GuillermoGomezdr/MyC-code | 25_repaso/pila/pila.cpp | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <strings.h>
#define Max_Pila 100
struct TCoord{
int x;
int y;
};
struct TPila{
struct TCoord *data[Max_Pila];
int cima;
};
struct TCoord *valor_random(){
struct TCoord *nueva;
nueva = (struct TCoord *) malloc(sizeof(struct TCoord));
nueva -> ... | ALGO | 0.926904 | 3.589786 |
8b9c039b-6c73-41ee-a690-650d2b92f626 | Hieu0112/Data-Structure-and-Algorithms-ptit | 1SinhKeTiep/5HoanViKeTiep.cpp | #include<bits/stdc++.h>
using namespace std;
main(){
int t,n;
cin>>t;
while(t--)
{
bool check=false;
cin>>n;
int a[n];
for(int i=0;i<n;i++)
cin>>a[i];
for(int i=n-1;i>0;i--)
{
int x=i;
if(a[i]>a[i-1])
{
check=true;
for(int j=x;j<n;j++)
{
if(a[j]>a[i-1]&&a[j]<a[i]){
x... | ALGO | 0.999943 | 3.485168 |
f61e55a1-fcdb-4f13-9e1d-d7516f10a822 | emilymryan/LAMMPS-SPH-Source-Code | src/USER-OMP/pair_beck_omp.cpp | /* ----------------------------------------------------------------------
Contributing author: Axel Kohlmeyer (Temple U)
------------------------------------------------------------------------- */
#include "omp_compat.h"
#include "pair_beck_omp.h"
#include <cmath>
#include "atom.h"
#include "comm.h"
#include "forc... | ALGO | 0.999803 | 6.846341 |
fe5f3fbf-c997-4867-9c7a-45d69e6340bd | tanishq6818/DSA | POTD MAY 6TH/GFG POTD.cpp | // Given a Binary Tree of n nodes, find all the nodes that don't have any siblings. You need to return a list of integers containing all the nodes that don't have a sibling in sorted order (Increasing).
// Two nodes are said to be siblings if they are present at the same level, and their parents are the same.
// Note... | ALGO | 0.999984 | 6.034858 |
b64a7642-1d7f-4439-9c6c-ddde2953cfed | ishandutta2007/codeforces | lucasr/normal/449/A.cpp | #include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <list>
#include <algorithm>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
using namespace std;
#define all(x) x.begin(),x.end()
#define bits(... | ALGO | 0.999986 | 3.51166 |
c33cbb9a-3714-455e-b8b4-fa50c5d50ac8 | ishandutta2007/codeforces | xiaoziya/normal/908/G.cpp | #include<stdio.h>
#include<iostream>
using namespace std;
const int maxn=705,mod=1000000007;
int n,ans,inv9;
int num[maxn],mul[maxn],cnt[10],C[maxn][maxn],muld[10][maxn],imuld[10][maxn],cc[10][maxn];
string s;
inline void inc(int &x,int y){
x+=y;
if(x>=mod)
x-=mod;
}
int ksm(int a,int b){
int res=1;
while(b){
i... | ALGO | 0.999989 | 4.212521 |
f8722cba-2dea-4836-8a21-b65fa98566ca | Jinouwen/SpiNeMap | CARLsim5/doc/source/tutorial/3_plasticity/src/main_plasticity.cpp | #include <carlsim.h>
#include <stdio.h>
#include <vector>
int main() {
// ---------------- CONFIG STATE -------------------
// create a network with nPois Poisson neurons and nExc excitatory output
// neurons
CARLsim sim("plasticity simulation", GPU_MODE, USER, 2);
int nPois = 100; // 100 input neurons
int nExc ... | ALGO | 0.897035 | 4.355017 |
8d4b8423-ab95-44c4-982e-230422e05324 | hotridung/fundcoin | src/sync.cpp | #include "sync.h"
#include "util.h"
#include <boost/foreach.hpp>
#ifdef DEBUG_LOCKCONTENTION
void PrintLockContention(const char* pszName, const char* pszFile, int nLine)
{
printf("LOCKCONTENTION: %s\n", pszName);
printf("Locker: %s:%d\n", pszFile, nLine);
}
#endif /* DEBUG_LOCKCONTENTION */
#ifdef DEBUG_LOC... | TOOL | 0.974589 | 5.741077 |
dd884fc3-3844-4fdf-92f3-9485947c4445 | ankit-2706/Basics_of_Cpp | functions & arrays/FA16.CPP |
//~~~~~~~~~~~~~~~``````````````INSERTION OF AN ARRAY```````````~~~~~~~~~~~~~~
#include<iostream>
#include<climits>
using namespace std;
int main(){
int n , m ;
cout << " Enter the size of the Array1 : " << " " ; // taking size input of an array..
cin >> n;
cout << " Enter the size of the Array2 :... | ALGO | 0.999355 | 4.026455 |
88eb83ae-b119-4414-a0a3-ced827dc78cd | GustavoPolicarpo/maratona | URI/STRINGS/1222 - Short Story Competition.cpp | // Author: Gustavo Policarpo
// Name: Short Story Competition
// Level: 6
// Category: STRINGS
// URL: https://www.beecrowd.com.br/judge/en/problems/view/1222
#include<bits/stdc++.h>
//LIFE IS NOT A PROBLEM TO BE SOLVED
using namespace std;
#define rep(i,a,b) for(int i = int(a); i < int(b) ; i++)
#define pb push_ba... | ALGO | 0.999881 | 3.337736 |
d037aa61-a0fc-4eda-9185-6725c67aee8d | mohnishunity3ddev/Shoora | engine/physics/broadphase.cpp | #include "broadphase.h"
#include <math/math.h>
#include <utils/sort/sort.h>
b32
ComparePseudoBodies(const pseudo_body &A, const pseudo_body &B)
{
b32 Result = (A.Value <= B.Value);
return Result;
}
// NOTE: Sort the bodies based on their bounds along a given axis.
// WE can't for example, choose the z-axis si... | ALGO | 0.995787 | 6.089297 |
2e58d6ba-3f96-4ffc-9c8a-9b6753a7ab63 | DinuAndreiRazvan/Proiecte_LICEU | Probleme structuri/560.cpp | /*
5
13
108
6
24
56
*/
#include<iostream>
using namespace std;
struct numar_div
{
int nr;
int div;
};
int main()
{
int n,i,d,k,j;
cin>>n;
numar_div a[100],aux;
for(i=0;i<n;i++)
{
cin>>a[i].nr;
d=2;
k=0;
while(d<=a[i].nr/2)
{
if(a[i].nr%d... | ALGO | 0.999935 | 3.048114 |
8905a96b-1696-4efc-87bd-e8f837b87851 | rajendrachy/OOPS-IN-2024-SEP | TESTPAD FULL PRACTICE/1BASIC/INTRODUCTION/CODING/capital.cpp | #include<iostream>
#include<string>
// Include headers as needed
using namespace std;
void capitalizeFirstChar(string &str)
{
for (int i = 0; i < str.size(); i++) {
if (i == 0 || isspace(str[i - 1])) {
str[i] = toupper(str[i]);
} else {
str[i] = tolower(str[i]);
}
... | ALGO | 0.999323 | 4.083992 |
a12fa687-1917-4cfa-8abe-d4b914463481 | rovinbhandari/Programming_Scripting | ProgrammingCompetitions/ACM-ICPC/ACM-ICPC_12/Amritapuri/online contest/ACM-ICPC Amritapuri 2012 Online Competition Accepted Solutions/C/cpp/00014231_C_SUMRANGE_amicpc120072.cpp | #include<iostream>
#include<list>
#include<climits>
#include<cmath>
#include<algorithm>
#include<stack>
#include<vector>
#include<cstring>
#include<map>
#include<queue>
#include<set>
#include<string>
#include<cstdio>
using namespace std;
int main() {
int t;
int ans;
int n, L, H, *l;
int flag;
cin >> t;
int a[1100... | ALGO | 0.999668 | 3.104454 |
e77760ac-d2a5-4c0f-bf5e-682d8d644d22 | EagleEyeKestrel/Leetcode | 1-100/74. 搜索二维矩阵/template的副本.cpp | class Solution {
public:
bool searchMatrix(vector<vector<int>>& matrix, int target) {
int m = matrix.size(), n = m ? matrix[0].size() : 0;
if (!m || !n) return false;
int i = 0, j = n - 1;
while (i < m && j >= 0) {
if (matrix[i][j] == target) return true;
if (... | ALGO | 0.999968 | 6.329541 |
0dd85118-2b65-4322-9275-980a981f1b37 | Kamel1bss/Problem-solving | Assiut sheets - Newcomers/Sheet #2 (Loops)/X - Convert To Decimal 2.cpp | #include <iostream>
#include <cmath>
using namespace std;
int main ()
{
int t;
cin >> t;
while(t--)
{
int a;
cin >> a;
int counter = 0;
while( a > 0)
{
int digit = 0;
digit = a % 2;
if (digit == 1)
counter++;
... | ALGO | 0.99963 | 4.565572 |
d9081023-3411-42aa-bf34-b95cd3284fa6 | teenujoshi/DSA | DATA STRUCTURE/SLL.cpp | #include <iostream>
using namespace std;
class Node{
public:
int val;
Node* next;
Node(){
val = 0;
next = NULL;
}
Node(int val){
this->val = val;
next = NULL;
}
Node(int val , Node*next){
this->val = val;
this->next = next;
}
};
class S... | ALGO | 0.999031 | 3.815346 |
2e8de995-0266-49c6-862e-658ea350f828 | Ayandip244/GFG_POTD | 30.05.2025.cpp | class Solution {
public:
int findMaxFork(Node* root, int k) {
// code here
int ans=INT_MIN;
while(root){
if(root->data <=k){
ans=max(ans,root->data);
root=root->right;
}
else{
root =root->left;
... | ALGO | 0.999994 | 4.969787 |
d6bcc94a-7e47-4fba-a454-4cc69d4392c5 | lussatisantos/Curso-C- | 03/funcao recursiva.cpp | # include <iostream>
using namespace std;
void contador(int num, int cont=0);
int main() {
contador(20);
return 0;
}
void contador(int num, int cont) {
cout << cont << "\n";
if (num > cont) {
contador(num, ++cont);
}
}
| ALGO | 0.992943 | 4.001362 |
ab42f7b6-8ffa-4245-be23-4cbd2c7330aa | LeeJ1nHyeong/Baekjoon | GOLD/G4_13975_파일 합치기 3.cpp | #include <iostream>
#include <queue>
using namespace std;
int main(void) {
int t;
cin >> t;
// 오버플로우 방지를 위해 long long으로 변수 타입 설정
for (int i = 0; i < t; i++)
{
priority_queue<long long, vector<long long>, greater<long long>> pq;
int n;
cin >> n;
long long ans = ... | ALGO | 0.999937 | 4.933564 |
a123da68-0933-4183-b099-1a84ff834ff3 | tu-27-6/code-C-PTIT | prime14.cpp | #include <iostream>
#include <cmath>
using namespace std;
typedef long long ll;
bool checkSnt(ll n) {
if (n<2) {
return false;
}
for (int i=2; i<=sqrt(n); i++) {
if (n%i==0) {
return false;
}
}
return true;
}
void prime14(ll n) {
for (ll i=0; i*i<=n; i++) {
if (checkSnt(i)) {
cout<<i*i<<" ";
}
... | ALGO | 0.999322 | 4.870423 |
3934a9ac-9b62-4a4e-9d2a-047df09d8902 | gautamabhinav/DSA-Coding-Ninjas | 1st Part/lecture5.cpp/InvertedNumber.cpp | #include <iostream>
using namespace std;
int main(){
int n;
cin>>n;
int i=1;
while(i<=n){
int j=1;
while(j<=n-i+1)
cout<<n-i+1;
cout<<endl;
i++;
}
} | ALGO | 0.999916 | 3.709956 |
46a35cce-a152-48f9-81c1-2047e0e9c238 | sarvex/leetcode-elixir | solution/0200-0299/0218.The Skyline Problem/Solution.cpp | class Solution {
public:
vector<pair<int, int>> getSkyline(vector<vector<int>>& buildings) {
set<int> poss;
map<int, int> m;
for (auto v : buildings) {
poss.insert(v[0]);
poss.insert(v[1]);
}
int i = 0;
for (int pos : poss)
m.inser... | ALGO | 0.999977 | 6.494827 |
68f28170-3f4f-4f40-857a-8f36c994d8de | ishandutta2007/codeforces | cldp/normal/949/B.cpp | #include <iostream>
#include <vector>
#include <cmath>
#include <cstring>
#include <algorithm>
using namespace std;
const int MAXN = 1010;
const int INF = 1000000007;
const double PI = acos(-1.0);
long long find_0(long long A, long long B, long long C);
long long find_1(long long A, long long B, long long C) {
i... | ALGO | 0.999982 | 3.552641 |
86f91ceb-f9e5-46d0-9807-b9e83f8e5b04 | danielhO9/PS | CODEFORCES/1993C.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n, k;
ll a[200000];
void solve() {
cin >> n >> k;
for (int i = 0; i < n; ++i) cin >> a[i];
ll maxa = 0ll;
ll l = k, r = k;
for (int i = 0; i < n; ++i) maxa = max(maxa, a[i]);
// cout << maxa << ' ';
for (int i = 0; i < n; ++i) {
if (a[i] ... | ALGO | 0.999774 | 3.884907 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.