uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
926bc627-78de-4201-8ed1-1eadfacb10d1 | uglyboy-topprog/LabsPSTU24 | sem2.gitkeep/3.3.gitkeep/3.3.cpp | #include <iostream>
using namespace std;
int main()
{
int t, tmp;
const int n = 5;
int k = 3;
int arr[n] = { 11, 32, 56, 87, 96 };
for (int i = 0; i < n; i++)
{
cout << arr[i] << " ";
}
cout << endl;
for (int i = 0; i < k; i++)
{
tmp = arr[n - 1];
for (int j = n - 1; j > 0; j--)
{
arr[j] = arr... | ALGO | 0.999471 | 3.204905 |
b69b2c33-d4fa-43c6-9ec7-4eef4a509292 | byronknoll/cmix | src/mixer/lstm-layer.cpp | #include "lstm-layer.h"
#include "sigmoid.h"
#include <math.h>
#include <algorithm>
#include <numeric>
namespace {
void Adam(std::valarray<float>* g, std::valarray<float>* m,
std::valarray<float>* v, std::valarray<float>* w, float learning_rate,
float t, unsigned long long update_limit) {
const float beta... | ALGO | 0.999051 | 6.36645 |
9e386e06-4073-4044-848a-37e419592c74 | dunan/MultiVariatePointProcess | 3rd-party/igl/outer_element.cpp | template <
typename DerivedV,
typename DerivedF,
typename DerivedI,
typename IndexType,
typename DerivedA
>
IGL_INLINE void igl::outer_vertex(
const Eigen::PlainObjectBase<DerivedV> & V,
const Eigen::PlainObjectBase<DerivedF> & F,
const Eigen::PlainObjectBase<Derive... | ALGO | 0.999252 | 5.910754 |
3ee6806e-e64a-4f8f-886d-c0e9d280bf5b | willstudy/LeetCode | max_profit.cpp | /*
Say you have an array for which the ith element is the price of a given stock on day i.
If you were only permitted to complete at most one transaction (ie, buy one and
sell one share of the stock), design an algorithm to find the maximum profit.
*/
/*
* 用max_sofar记录当前最大的子数组,如果为0就重新计算
* 当最大子数组的值为负数时,max_sofar应为很小... | ALGO | 0.99992 | 5.743731 |
71823057-6016-47fe-baf1-5afd29eb96f3 | Amit7055/Assignments | C--Assignments/Assign8.cpp | /*
8.Print the average of three numbers entered by the user by creating a class named 'Average' having a
function to calculate and print the average without creating any object of the Average class.
*/
#include<iostream>
using namespace std;
class avearge
{
private:
int a,b,c;
static int call;
public:
avearge... | ALGO | 0.976503 | 3.729583 |
00a95dc4-c94d-40fe-9e23-f84050d8e398 | loupiot666/luogu | 递归/P1025.cpp | //递增选数
#include<cstdio>
int n,k,cnt;
void dfs(int num,int sum,int time)
{
if(time==k)
{
if(sum==n) cnt++;
return;
}
for(int i=num;sum+i*(k-time)<=n;i++)//剪枝,只用枚举到sum+i*(k-cur)<=n为止
dfs(i,sum+i,time+1);
}
int main()
{
scanf("%d%d",&n,&k);
dfs(1,0,0);
printf("%d",cnt... | ALGO | 0.999889 | 3.320344 |
ee64a190-eb34-4c67-af2b-4859edaf27cc | RedSnow389/CP_Templates | matmul.cpp | vvl matmul(vvl a, vvl b){
ll n=a.size(),i,j,k;
vvl c(n, vl(n));
fr(i,n) fr(j,n) fr(k,n) (c[i][j]+=a[i][k]*b[k][j])%=mod;
return c;
}
vvl matexp(vvl a, ll x){
ll i,j,n=a.size();
if(x==0){
vvl c(n, vl(n));
fr(i,n) fr(j,n) if(i==j) c[i][j]=1;
return c;
}
vvl c=exp(a,x/2);
if(x%2) return mul(c,mul(c,a));
... | ALGO | 0.999906 | 4.021174 |
59ac77ac-3ec4-410b-ae86-29dc2bd4acc0 | 21111019Harry/CPP-Problems | Problems on array/24.cpp | #include<iostream>
#include<bits/stdc++.h>
using namespace std;
void pairsum(int brr[], int length,int value);
int main()
{
int *arr = NULL;
int size = 0, no = 0;
cout<< "Enter the size:-";
cin>>size;
cout<< "Enter the no:-";
cin>>no;
arr = new int[size];
for(int i = 0; i < size... | ALGO | 0.999948 | 3.59415 |
d6334aec-8c7c-4009-bc81-49ac02853010 | LazyPlanet/MX-Architecture | ThirdParty/boost_1_63_0/libs/coroutine2/example/fibonacci.cpp | #include <cstdlib>
#include <iostream>
#include <boost/coroutine2/all.hpp>
int main() {
boost::coroutines2::coroutine< int >::pull_type source(
[]( boost::coroutines2::coroutine< int >::push_type & sink) {
int first = 1, second = 1;
sink( first);
sink( second);
... | ALGO | 0.940522 | 4.227357 |
0424741b-a4bf-43d5-8e8a-19c967192117 | Winter0016/thuat-toan-c- | luyen tap/bai6(find negative number in list)/main.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
int n;
do {
cout << "Nhap so luong ban muon nhap: ";
cin >> n;
if (n == 0) {
cout << "It's not funny bro, try again!!! -_-"<< endl;
}
} while (n == 0);
vector<int>... | ALGO | 0.999763 | 4.578763 |
9d585409-a5c7-434c-84e3-f4104aa8446b | alvinpiter/competitive-programming | USACO/2014_mar_gold_sabotage.cpp | #include<bits/stdc++.h>
using namespace std;
#define MAXN 100000
/*
Observation:
Suppose we have a sequence Si and a number x. If we convert all Si to Si - x and
take the sum and the result is < 0, then the average of Si is less than x.
Proof:
(S1 - x) + (S2 - x) + .. + (Sn - x) < 0
(S1 + S2 + .. + Sn) - x*n < 0
(S1 +... | ALGO | 0.999975 | 4.162826 |
622eb6c3-5895-43e5-a376-88b7ffb95b58 | muazhussain/Blind-75-and-Beyond | 03. Dynamic Programming/House Robber/House Robber - better.cpp | // Problem link: https://leetcode.com/problems/house-robber/
// Time: O(n)
// Space: O(n)
class Solution {
private:
int calc(int index, vector<int>& nums, vector<int>& dp) {
if(index == 0) {
return nums[0];
}
if(index < 0) {
return 0;
}
if(dp[index] != -1) {
return dp[index];
}
int pick = nums[... | ALGO | 0.999969 | 6.156889 |
ceeb1f90-deaf-4de1-8bdb-d00839eccd42 | undertaj/CrackYourPlacement | Dynamic_Programming/Easy/Ones_and_Zeroes.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution {
// z is zeroes o is ones
int dp[101][101][601];
int subset(int z, int o, int index, vector<pair<int,int>>& v){
if(index == v.size()|| (z == 0 && o == 0))
return 0;
if(dp[z][o][index] != -1)
return dp[z]... | ALGO | 0.99997 | 5.85278 |
7fd9de0c-b8b2-4e2c-99e8-897cd22c67a7 | JorgeIba/Competitive-Programming-Problems | Training Camp 2023 Medellín/Contest 7/E.cpp | #include <bits/stdc++.h>
#define endl '\n'
#define lli long long int
#define ld long double
#define all(v) v.begin(), v.end()
#define fastIO(); ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define SZ(s) int(s.size())
#define debugg(x) cerr << #x << " = " << x << endl;
#define forn(i, n) for(int i = 0; i < (... | ALGO | 0.999951 | 4.715065 |
3254b9b7-db1e-4486-bf78-521ccf06c529 | Siddhant-15/-6Companies30days | Goldman Sachs/Print Anagrams Together.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution
{
public:
vector<vector<string>> Anagrams(vector<string> &string_list)
{
vector<vector<string>> ans;
unordered_map<string, vector<string>> m;
for (int i = 0; i < string_list.size(); i++)
{
string s = strin... | ALGO | 0.999979 | 5.966171 |
b95d8634-556f-4aac-8958-9c06beb16d12 | TamakiShoei/SimpleLibrary2D_01 | SimpleLibrary2D_01/SimpleLibrary2D_01/Lib/DirectXTexNormalMaps.cpp | #include "DirectXTexP.h"
using namespace DirectX;
namespace
{
#pragma prefast(suppress : 25000, "FXMVECTOR is 16 bytes")
inline float EvaluateColor(_In_ FXMVECTOR val, _In_ CNMAP_FLAGS flags) noexcept
{
XMFLOAT4A f;
static XMVECTORF32 lScale = { { { 0.2125f, 0.7154f, 0.0721f, 1.f } } };
... | ALGO | 0.970093 | 7.596168 |
f0ea6d48-ed15-4463-82e3-0874ea9dc8eb | skygupta07/CP | 30_extremelyRound.cpp | #include <bits/stdc++.h>
using namespace std;
void solve(){
int n;
cin>>n;
int ans = 0;
// int arr[] = {1,2,3,4,5,6,7,8,9};
for (int power=0; power<6; power++){
for (int i=1; i<=9; i++){
int generatedNum = i*pow(10,power);
if (generatedNum <= n) ans += 1;
... | ALGO | 0.997977 | 5.466061 |
c25d97c7-c48c-4212-8a3c-7ac2f14c3a3a | alexeybliznyuk/cpp_studying | depth_first_search.cpp | #include <iostream>
//using namespace std;
class treeNode {
public:
int val;
treeNode* parent;
treeNode* left;
treeNode* right;
/*treeNode() {
int val = 0;
treeNode* parent = nullptr;
treeNode* left = nullptr;
treeNode* right = nullptr;
}*/
/*treeNode(int data) {
int val = data;
treeNode* parent = ... | ALGO | 0.999933 | 4.387597 |
b2bd5278-5718-4146-b452-3c749f13ee65 | YANGLEQUN/wangdao | ch3_栈、队列和数组/1_栈/template.cpp | #include <bits/stdc++.h>
using namespace std;
#define maxsize 5
typedef struct {
int stack[maxsize];
int top;
} Stack;
// 初始化栈
void initStack(Stack &S) {
S.top = -1;
}
// 判空
bool isEmpty(Stack &S) {
return S.top == -1;
}
// 判满
bool isFull(Stack &S) {
return S.top == maxsize - 1;
}
// 入栈
bool push(Stack &... | ALGO | 0.99929 | 4.010792 |
ff0d5d87-bc04-428e-a3e7-acf9960dccd5 | ishandutta2007/codeforces | thebes/normal/1312/F.cpp | #include <bits/stdc++.h>
#define DEBUG 1
using namespace std;
namespace output{
void __(short x){cout<<x;}
void __(unsigned x){cout<<x;}
void __(int x){cout<<x;}
void __(long long x){cout<<x;}
void __(unsigned long long x){cout<<x;}
void __(double x){cout<<x;}
void __(long double x){cout<<x... | ALGO | 0.999935 | 3.599506 |
cd8d2d9a-f25f-4c7e-a63c-1b5a95488a8b | aniket-2003-das/GFG-Problems | Day18_Arithmetic_Number.cpp | //{ Driver Code Starts
// Initial Template for C++
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
// User function Template for C++
class Solution{
public:
int inSequence(int A, int B, int C){
// code here
if(A==B && C==0) return 1;
int n = (B-A);
if(... | ALGO | 0.99979 | 5.400081 |
82737e2c-cbec-45cb-af62-343d15af8161 | OgnjenArsenijevic/RAF-Design-and-Analysis-of-Algorithms | Week 1 (Greedy - part1)/v1z7.cpp | ///v1z7
///Author: Ognjen Arsenijevic
///Time Complexity O(n)
#include <iostream>
#include <vector>
using namespace std;
int n,k;
vector<int> v;
vector<int> flags;
int main()
{
ios_base::sync_with_stdio(0);
cin>>n>>k;
for(int i=0;i<n;i++)
{
int in;
cin>>in;
v.push_back(in);
... | ALGO | 0.999978 | 3.699301 |
b05146ed-e9be-48e5-a91b-f223f23ef1be | sar-gupta/network-algorithms | bit-stuffing.cpp | #include<bits/stdc++.h>
using namespace std;
string server(string data)
{
cout<<"\nReceived: "<<data;
for(int i=0;i<data.size();i++)
{
if(data.size()-i>=5 && data[i]=='1' && data[i+1]=='1' && data[i+2]=='1' && data[i+3]=='1' && data[i+4]=='1' && data[i+5] != '0')
{
return "Error";
}
if(data... | ALGO | 0.9967 | 4.774032 |
7c308ba1-4ea2-4c4b-b198-2512f710f059 | xakep8/cp_solutions | soldier_and_bananas.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int k,n,w,cost=0;
cin>>k>>n>>w;
for(int i=1;i<=w;i++){
cost+=(i*k);
}
if(cost>n){
cout<<cost-n;
}
else{
cout<<"0";
}
} | ALGO | 0.999938 | 3.383409 |
cf8b82a8-6e46-47e9-b3d4-c0dc0a017fbc | phytec-mirrors/platform-frameworks-av | media/libstagefright/codecs/amrnb/enc/src/l_negate.cpp | /*
------------------------------------------------------------------------------
INPUT AND OUTPUT DEFINITIONS
Inputs:
L_var1 = 32 bit long signed integer (Word32) whose value falls
in the range : 0x8000 0000 <= L_var1 <= 0x7fff ffff.
Local Stores/Buffers/Pointers Needed:
None
Global Stores/... | TOOL | 0.987783 | 5.666788 |
04445a11-fa1c-4b28-88a0-53a0a28f5fd7 | kinhoy/practice_code | 1041_Be_Unique.cpp | /* 1041 Be Unique */
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n, temp, num[100001], count[10001];
scanf("%d", &n);
int p = n;
while (n--)
{
scanf("%d", &temp);
num[n] = temp;
count[temp]++;
}
int flag = 1;
while (p--)
{
if (count... | ALGO | 0.999941 | 4.465615 |
53fdb340-a351-4fc0-be14-9cf44443dbfb | vfolunin/archives-solutions | LeetCode/2259.cpp | class Solution {
public:
string removeDigit(string number, char digit) {
string res;
for (int i = 0; i < number.size(); i++)
if (number[i] == digit)
res = max(res, number.substr(0, i) + number.substr(i + 1));
return res;
}
}; | ALGO | 0.999918 | 6.312632 |
a1d5c1ef-22f6-4eb7-b77f-3b70ca0405db | kunalgupta016/DSA-in-CPP | ARRAY/charArray.cpp | #include <iostream>
#include<string>
using namespace std;
char tolower(char ch){
if(ch>='a' && ch<='z'){
return ch;
}
else{
char temp = ch;
temp = temp - 'A' + 'a';
return temp;
}
}
int getLength(char name[]){
int count=0;
for(int i=0;name[i]!='\0';i++){
... | ALGO | 0.999554 | 3.863672 |
7ebda81f-7c85-4dc6-b81a-e0c9efcd3a08 | njrafi/Competitive-Programming-Solutions | CodeForces/101864F - Football Free Kick - 41436631.cpp | #include <bits/stdc++.h>
#ifndef ONLINE_JUDGE
#define gc getchar
#define pc putchar
#else
#define gc getchar_unlocked
#define pc putchar_unlocked
#endif
using namespace std;
#define vi vector<int>
#define si set<int>
#define vs vector<string>
#define pii pair<int, int>
#define vpi vector<pii>
#define pri priority_queue... | ALGO | 0.998826 | 3.881545 |
7a5bde40-b516-4240-9638-a4a42d68e672 | raincross7/code-similarity | codes/train_code/problem385/problem385_159.cpp | #include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <math.h> // sqrt
#include <map> // map
#inc... | ALGO | 0.999905 | 3.739776 |
3b537eaa-8856-4d6b-a2ee-18ecfcdca621 | PrinceSadariya/PPT-Program-PW | Module 1 - DSA/Assignment 2 - Arrays/q7.cpp | // Question 7
// An array is monotonic if it is either monotone increasing or monotone decreasing.
// An array nums is monotone increasing if for all i <= j, nums[i] <= nums[j]. An array nums is
// monotone decreasing if for all i <= j, nums[i] >= nums[j].
// Given an integer array nums, return true if the given arra... | ALGO | 0.999933 | 5.964469 |
52ecd561-09a8-4f7f-b2f5-e4dc8ff5c2c1 | TrainingByPackt/Advanced-CPlusPlus | Lesson8/Activity01/Speller2.cpp | #include <iostream>
#include <vector>
#include <set>
#include <fstream>
#include <iterator>
#include <set>
#include <unordered_set>
#include <algorithm>
#include "Timer.h"
using namespace std;
// This method must return a vector containing the strings in vecText that are not in vecDict
vector<int> getMisspelt(const ... | TOOL | 0.932034 | 5.685826 |
78929878-a740-4979-a590-68067feea1e3 | Jawad-Alotaibi/introduction_to_programming | ArithmeticOperators.cpp/AlgorithimsLevel1/Problem15.cpp | #include <iostream>
using namespace std;
int main() {
short a , b;
cout << "Enter the first side of the rectangle\n";
cin >> a;
cout << "Enter the second side of the rectangle\n";
cin >> b;
short area = a * b;
cout << "The rectangle is: " << area;
return 0;
} | TOOL | 0.878804 | 3.466774 |
16e0ab38-050b-4279-9762-b2f44c1282af | ashmit2c1/codechef_ashmit2c1 | Remove_Bad_elements.cpp | #include<bits/stdc++.h>
using namespace std;
#define lint long long
#define forloop(x,y) for(int i=x;i<y;i++)
#define secondfor(x,y) for(int j=x;j<y;j++)
#define print(x) cout << x << "\n";
#define output(arr) for(int i=0;i<arr.size();i++){cout<<arr[i]<<" ";}
#define asort(v) sort(v.begin(), v.end())
#define dsort(v) s... | ALGO | 0.999164 | 4.234511 |
32058e7e-b268-4d32-81a4-957b683f2572 | InvincibleSarthak/Competitive-Programming | BuildSegmentTrees.cpp | //To print the minimum number in the index range qs and qe using the concept of segment trees.
//To update a number present at index i by incrementing inc in it.
#include<iostream>
using namespace std;
void updateTree(int *tree, int ss, int se, int i, int inc, int index){
if(ss==se){
tree[index]+=inc;
... | ALGO | 0.999984 | 3.926661 |
1c118346-224d-49df-bf23-7b9c85fa8256 | UtkarshDevrani/Placement-Preparation-Module | 7_JULY/Delete a given Node when a node is given.(….cpp | class Solution {
public:
void deleteNode(ListNode* node) {
ListNode* prev;
while(node->next!=NULL)
{
node->val=node->next->val;
prev=node;
node=node->next;
}
prev->next=NULL;
}
}; | ALGO | 0.999912 | 5.879869 |
b0f41e23-35b3-40e7-8581-04318b18a348 | shrutishishodia/Cryptography | fibbonaci.cpp | #include<iostream>
using namespace std;
main()
{
int n, c, first = 0, second = 1, next;
cout << "Enter the number of terms of Fibonacci series you want" << endl;
cin >> n;
cout << "First " << n << " terms of Fibonacci series are :- " << endl;
for ( c = 0 ; c < n ; c++ )
{
if ( c <= 1 )
... | ALGO | 0.999547 | 3.397757 |
260bae44-3e83-4213-ab9e-d65890133543 | salah-sorour-dev/Algorithms-Problem-Solving-Level-2 | problem 9.cpp | // problem 5.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include <iostream>
#include <string>
using namespace std;
int ReadPositiveNumber(string Message)
{
int Number = 0;
do
{
cout << Message;
cin >> Number;
} while (Number <= 0);
return Number;
}
int CountDig... | ALGO | 0.998574 | 5.514506 |
b59ec22a-4b62-4ea2-9c49-7268d8bd946f | sarahasan17/DSA_Practise | dp_partitions_with_given_diff_tabular.cpp | int findWays(vector<int>& arr, int k)
{
vector<vector<int>> dp(arr.size(),vector<int> (k+1,0));
int n=arr.size();
if(arr[0]==0){
dp[0][0]=2;
}
else{
dp[0][0]=1;
}
if(arr[0]!=0 && arr[0]<=k){
dp[0][arr[0]]=1;
}
for(int i=1;i<n;i++){
for(int tar=0;tar<=k;tar++){
int ntake=dp[i-1][tar];
int take=0;
... | ALGO | 0.999984 | 4.91753 |
e4b5c788-9a84-49b4-b6da-d6067e40a7c5 | AjajAlam1399/data-structure_and_algorithms | Graph-question-striv/28-Floyd Warshall Algorithm/Floyd Warshall Algorithm.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution
{
public:
void shortest_distance(vector<vector<int>> &matrix)
{
// Code here
int n = matrix.size();
for (int i = 0; i < n; i++)
{
matrix[i][i] = 0;
for (int j = 0; j < n; j++)
{
... | ALGO | 0.999934 | 5.003965 |
4023ec8e-f4bc-4765-87c9-41d65f308f3d | PlacementPrep100/Graphs | All paths from source to target.cpp | //All paths
//Question link:https://leetcode.com/problems/all-paths-from-source-to-target/
class Solution {
public:
vector<vector<int>> allpath;
int n;
void printPath(vector<vector<int>>& graph,int s, vector<bool>& visited,vector<int>ans){
visited[s]=true;
ans.push_back(s);
... | ALGO | 0.999921 | 6.117052 |
aa2a588f-1d96-401e-bf15-f527769c55fc | CArnoud/C_Arnoud_Calibrated_Detector | src/QuantizedGradientChannel.cpp | #include "QuantizedGradientChannel.h"
void QuantizedGradientChannel::readGradientHistogram(cv::FileNode histNode)
{
enabled = histNode["enabled"];
orientationChannels = histNode["nOrients"];
useSoftBinning = histNode["softBin"];
useHogNormalization = histNode["useHog"];
clipHog = histNode["clipHog"];
binSize =... | ALGO | 0.972355 | 4.45343 |
97efe228-6ad9-48e7-8942-5cc478a7332e | WenShihKen/uva | Leetcode/Find Numbers with Even Number of Digits.cpp | class Solution
{
public:
int findNumbers(vector<int> &nums)
{
int ans = 0;
for (auto i : nums)
{
int count = 0;
while (i)
{
count++;
i /= 10;
}
if (count % 2 == 0)
{
an... | ALGO | 0.999735 | 5.783095 |
b9b4bcfb-0605-48ff-af0a-2b5644b6473e | nikutek/POLLUB | Semestr 2/algorytmika/lab12/main.cpp | #include <iostream>
using namespace std;
struct Node {
int key;
Node* left;
Node* right;
Node* parent;
};
Node* createNode(int key, Node* parent) {
Node* newNode = new Node();
newNode->key = key;
newNode->left = newNode->right = nullptr;
newNode->parent = parent;
return newNode;
}
... | ALGO | 0.999727 | 5.853768 |
4823cd54-9cb1-4bd1-8d4f-82739575f658 | matoilic/thesis | Libraries/opencv/modules/features2d/src/brief.cpp | #include "precomp.hpp"
#include <algorithm>
#include <vector>
#include <iostream>
#include <iomanip>
using namespace cv;
inline int smoothedSum(const Mat& sum, const KeyPoint& pt, int y, int x)
{
static const int HALF_KERNEL = BriefDescriptorExtractor::KERNEL_SIZE / 2;
int img_y = (int)(pt.pt.y + 0.5) + y;
... | ALGO | 0.967066 | 6.192305 |
a3c26a4c-4ffc-43e2-b5d1-3160d14b13f1 | p-podsiadly/llvm-stm8 | clang-tools-extra/clang-tidy/misc/ConfusableTable/BuildConfusableTable.cpp | #include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/ConvertUTF.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/raw_ostream.h"
using namespace llvm;
int main(int argc, char *argv[]) {
auto ErrorOrBuffer = MemoryBuffer::getFile(argv[1], true);
if (!ErrorOrBuffe... | TOOL | 0.924877 | 5.490996 |
0ce0ae84-ac60-4348-8a1f-6181d75ab885 | brucehart/adventofcode | 2023/D10/d10p2.cpp | #include <iostream>
#include <string>
#include <vector>
#include <unordered_set>
#include <utility>
#include <queue>
#include <cmath>
// Custom hash function for pair<int, int> to use in unordered_set
struct pair_hash {
std::size_t operator()(const std::pair<int, int>& p) const {
return std::hash<int>()(p.... | ALGO | 0.999962 | 6.879983 |
63cd39ff-d31f-4712-844f-b8a5c2f24451 | varuogm/Not-Much-Important | CC/BigNumStringADD.cpp |
### problem name ECPC10C
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
string findSum(string str1, string str2)
{
// Before proceeding further, make sure length of str2 is larger.
if (str1.length() > str2.length())
swap(str1, str2);
// Take an empty string for sto... | ALGO | 0.999927 | 5.525902 |
f2465342-6913-4003-a889-a02f0685d354 | stevenbai0724/DMOJ-Solutions | VM7WC/vmss7wc15c4p3.cpp | //https://dmoj.ca/problem/vmss7wc15c4p3
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
cin.tie(nullptr)->sync_with_stdio(false);
int n, m;
cin>>n>>m;
vector<vector<pair<int,int>>>adj(n);
int ans = 0;
for(int i=1;i<=m;i++){
int x,y,w;
cin>>x>>y... | ALGO | 0.999966 | 4.384516 |
21780222-2b70-4e37-8198-b8e7cbccac1d | HowToSaveMyLife/HPC | HPC.cpp | # include <iostream>
# include <vector>
# include <string>
# include "HP_complex.h"
# include <vld.h>
using namespace std;
int main() {
//测试用例,不支持的d = a + b + c类似的计算,会造成内存泄漏,仅能c = a + b
string s1, s2, s3, s4;
s1 = "54861";
s2 = "-456218";
s3 = "77991";
s4 = "-4611";
HP_int a_int, b_int, c_int;
a_int = s1;
b_i... | TOOL | 0.973885 | 3.609008 |
d8add369-b4fd-4e42-a854-30106b01f933 | UPRM-CIIC4010-F24/LoopArraysAndVectorsLectures | loops/prefix_postfix.cpp | #include <iostream>
using namespace std;
void print_array_content(int arr[]) {
int size = sizeof(arr) / sizeof(arr[0]);
for(int i = 0; i < size; i++) {
cout << arr[i] << " ";
}
cout << endl;
}
void prefix_exmaple() {
int arr[] = {1, 2, 3, 4, 5};
int i = 0;
cout << "i starts at: " ... | ALGO | 0.982556 | 3.912577 |
21d7b781-6d79-47d1-9acd-4d286be833a2 | Algurina/Algurina | стр 39№8.cpp | #include <iostream>
using namespace std;
int main()
{
const int n = 4; //razmer
int matrix[n][n];//opredeliaem tip elementov v matrice
int matrixr[n][n];//resultat raboty
int i, j;
for (i = 0; i < n; i++)
for (j = 0; j < n; j++)
{
cout << "[" << (i + 1) << "][" << (j + 1) << "]=";
cin >> matrix[i][j];/... | ALGO | 0.99934 | 3.33924 |
ca194142-8ed9-4cf1-9f3e-3dc3fbc4d018 | Erik-Debye/CSC121-Coursework | Week 8/W8Q4/w8q4.cpp | /*
Erik Debye || 12.03.2022
Week 8 -- Problem 4
Recusion & Factorials
New commands:
*/
#include <iostream>
#include <vector>
using namespace std;
//functions
int findFact(int num);
int main()
{
//all nums to be factorialed
vector<int> nums = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
for (int num : nums) {
... | ALGO | 0.99881 | 6.017881 |
b2014133-7ca8-4d74-9c27-38185249d383 | sachink55/DataStructures-and-Algorithms | Recursion/Debug/p1.cpp | #include<bits/stdc++.h>
using namespace std;
bool isPowerOfFour(int n) {
if(n<=1){
return false;
}
if(n%4!=0){
return false;
}
return isPowerOfFour(n/4);
}
int main(){
int ans = isPowerOfFour(16);
cout << "isPowerOfFour : " << ans;
return 0;
} | ALGO | 0.998965 | 4.754353 |
ab8f0b01-4725-42e5-85fc-fc7bb4867427 | abdallamaher/competitive_programming | Math/Algebra/B. Passwords.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
#ifdef LOCAL
freopen("input.txt", "r", stdin);
#endif
int n, k;
scanf("%d %d", &n, &k);
int ar[105] = {};
for (int i = 0; i < n; i++) {
string s; cin >> s;
ar[s.size()]++;
}
string ss; cin >> ss;
int mxS = ss.size();
int su... | ALGO | 0.999915 | 3.911035 |
2e42faf8-c490-4712-bf40-141f7a123851 | ethanhe42/caffe-pro | src/caffe/solvers/rmsprop_solver.cpp | #include <vector>
#include "caffe/sgd_solvers.hpp"
namespace caffe {
#ifndef CPU_ONLY
template <typename Dtype>
void rmsprop_update_gpu(int N, Dtype* g, Dtype* h, Dtype rms_decay,
Dtype delta, Dtype local_rate);
#endif
template <typename Dtype>
void RMSPropSolver<Dtype>::ComputeUpdateValue(int param_id, Dtype r... | ALGO | 0.990933 | 7.295526 |
df3e7073-c93a-4560-9283-463b5401c82d | 2411Shravan/leetcode-DSA | singlenumber.cpp | // Given a non-empty array of integers nums, every element appears twice except for one. Find that single one.
// You must implement a solution with a linear runtime complexity and use only constant extra space.
// Example 1:
// Input: nums = [2,2,1]
// Output: 1
// Example 2:
// Input: nums = [4,1,2,1,2]
// Output... | ALGO | 0.999813 | 6.006367 |
fd7c073f-5cd9-4ba5-83af-d5d05c76dacb | Sandesh040602/cp | bit(inversion_count).cpp | int n;
int MAXN;
vector<int>BIT(10005);
void update(int ind, int val){
// dbg(ind)
for(;ind<=10;ind+=(ind&(-ind))){
BIT[ind]+=val;
}
}
int sum(int ind){
int count = 0;
for(;ind>0;ind-=(ind&(-ind))){count+=BIT[ind];}
return count;
}
// Solution
void solve(){
cin>>n; vector<int>v(n+... | ALGO | 0.999986 | 4.228456 |
d15cf432-72a7-4457-bc83-68c1adf8f013 | right-x2/Algorithm_study | 15683.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int arr[10][10];
int tmp[10][10];
int n,m;
int mn = 64;
vector< pair<int,int> > v;
int spay(int a, int b,int k,int idx)
{
if(k==0)
{
for (int i = b+1; i < m; ++i)
{
if(arr[a][i]==0) arr[a][i]=idx;
... | ALGO | 0.99979 | 4.515196 |
d8b6106b-ea26-4e7e-a3c5-cbc6ca3daf38 | hjiang13/LLMs-in-IR | POJ-104/98/2545.cpp | #include <iostream>
using namespace std;
int main()
{
int i;
int count;
char *buf;
char **words;
int line_word_count = 0;
cin >> "%d", &count);
words = (char **)malloc(count * sizeof(char *));
for (i = 0; i < count; i++) {
buf = (char *)malloc(41 * sizeof(char));
cin >> "%s", buf);
*(words + i) = buf;
}
for (i = 0; ... | TOOL | 0.972275 | 3.736401 |
190cf4d8-94b8-4e10-8fcb-0a6260f57717 | Momen-Wagdy/Searching | SearchingAndSorting/src/SelectionSort.cpp | #include "SelectionSort.h"
void SelectionSort::sort(std::vector<int>& array) {
int n = array.size();
for (int i = 0; i < n - 1; ++i) {
int minIndex = i;
for (int j = i + 1; j < n; ++j) {
if (array[j] < array[minIndex]) {
minIndex = j;
}
}
... | ALGO | 0.999633 | 5.543835 |
e556875c-6a80-47c0-aa7d-54080d3b1e9d | Anish168/Utsav_Session | Recursion/solverSolver.cpp | #include <iostream>
#include <math.h>
using namespace std;
bool kyamainumdalsktahu(int mat[9][9], int i, int j, int num, int n)
{
// row
for (int k = 0; k < n; k++)
{
if (mat[i][k] == num)
{
// means wo number already present h.
return false;
}
}
// c... | ALGO | 0.999791 | 5.655501 |
eb897515-412b-4e1e-a41f-0b6d750dffaf | PrathamTech/cpp | Day 6/list.cpp | #include<iostream>
#include<list>
using namespace std;
int main()
{
list<int> l;
l.push_back(10);
l.push_front(12);
for(int i:l)
cout<<i<<" ";
cout<<endl;
l.erase(l.begin());
cout<<"After erase : ";
for(int i:l)
cout<<i<<" "<<endl;
cout<<"Size of list : "<<l.size()<<e... | ALGO | 0.988609 | 3.548833 |
eaf8115c-4065-47ee-ba2b-92618d82f9b6 | Lazaro1/firstFlutterProject | 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 |
b6c8b5fd-738e-4f67-b48e-c1f7b7dd1d40 | anuvratnehra/leetcode | Median of BST - GFG/median-of-bst.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
#define MAX_HEIGHT 100000
// Tree Node
struct Node {
int data;
Node *left;
Node *right;
Node(int val) {
data = val;
left = right = NULL;
}
};
float findMedian(struct Node* node);
// Function to Build Tree
Node* ... | ALGO | 0.999969 | 6.513197 |
3b5af550-f7c0-4515-b8bc-5c370a7d52fe | Samius-Sazin/CODE | Programming/STL_C++/4_Set/4_Multi_Set.cpp | #include<bits/stdc++.h>
using namespace std;
void Print_Multi_Set(multiset <string> &s);
int main(){
//DECLARE
multiset <string> s;
//INITIALIZE
s.insert("ab");
s.insert("ef");
s.insert("cd");
Print_Multi_Set(s);
/*Multi Set Size : 3
... | ALGO | 0.918663 | 4.66607 |
2c2bf4e2-ec3d-4cc6-8429-f57fc3980313 | lwzhenglittle/Stop-Class-2019 | 2018/P5020.cpp | // luogu-judger-enable-o2
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int a[2000010];
int dp[2000010];
int n,T;
int ans;
void init(){
memset(a,0,sizeof(a));
memset(dp,0,sizeof(dp));
ans=0;
dp[0]=1;
}
void work(){
init();
scanf("%d",&n);
for(int i=1;i<=n;i++){
scanf("%d",&a[i])... | ALGO | 0.999722 | 3.867224 |
5377fa66-c216-4aa8-a325-7d34d08cdff2 | lucic71/llvm-ub-free | lldb/test/API/functionalities/postmortem/minidump/fizzbuzz.cpp | // A sample program for getting minidumps on Windows.
#include <iostream>
bool
fizz(int x)
{
return x % 3 == 0;
}
bool
buzz(int x)
{
return x % 5 == 0;
}
int
main()
{
int *buggy = 0;
for (int i = 1; i <= 100; ++i)
{
if (fizz(i)) std::cout << "fizz";
if (buzz(i)) std::cout << "bu... | ALGO | 0.972106 | 5.18412 |
1aa0ed56-b25e-4744-bf47-0e0c59299fb7 | equilibrium-eosdt/eosdt | contracts/eosdtgovernc/src/applicator.cpp | #include "eosdtgovernc.hpp"
namespace eosdt {
void eosdtgovernc::apply_ctrsetting(const ds_string &json, const std::map <ds_account, ds_account> &cntract_types,
const ds_account &pos_account, const char *pos_name) {
ctrsettings_table ctrsettings(pos_account, pos_acco... | CONFIG | 0.868823 | 6.006883 |
df2827c5-f879-4949-8e3e-64108647da90 | Sameerjha236/Leetcode | 1971-find-if-path-exists-in-graph/1971-find-if-path-exists-in-graph.cpp | class Solution {
public:
bool validPath(int n, vector<vector<int>>& edges, int src, int dst) {
vector<int> adj[n];
for(auto i: edges)
{
int a = i[0], b = i[1];
adj[a].push_back(b);
adj[b].push_back(a);
}
vector<bool> vis(n,1);
queue... | ALGO | 0.999975 | 6.097812 |
5f49a242-247f-4483-9f5d-b83d699bfa41 | haomingw/Codeforces | 420-429/422/B.cpp | #include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <utility>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <cassert>
using namespace std;
#define REPP(i,a,b) for(int i=(a); i < (b); ++i)
#define ... | ALGO | 0.999977 | 3.305309 |
a720baa4-ee00-4d1d-86d2-6a16b089b88e | knasan/rrn | rrn.cpp | #include "rrn.hpp"
#include <iostream>
#include <string>
#include <algorithm>
#include <sstream>
#include <vector>
#include <iterator>
#include <boost/filesystem.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <boost/filesystem/exception.hpp>
#include <boost/algorithm/string.hpp>
namespace fs = boost::fi... | TOOL | 0.955476 | 3.854257 |
ef62866a-720d-452c-b544-92b32b52d611 | ChaomengOrion/CompetitiveSave | Luogu/P_2880_USACO_07_JAN_Balanced_Lineup_G.cpp | #include <bits/stdc++.h>
//#define CFMode
using i64 = long long;
#define TRACE(x) std::cout << "TRACE: " << #x << " = " << (x) << std::endl;
#define DEBUG(...) std::cerr << "DEBUG: " << __VA_ARGS__ << std::endl;
#define DEBUGV(vec, size) std::cerr << #vec << " = " << '['; for (int i = 0; i < size; i++) { std::cerr <<... | ALGO | 0.999975 | 5.0667 |
df12d8d7-e699-4e1f-bb8b-36969224c0e9 | YankhotovDenny/C-Algoritmy | Tree/Source1.cpp | #include <iostream>
#include <vector>
#include <list>
#define std::cout
class Node
{
public:
Node* left = NULL;
Node* right = NULL;
Node* parent = NULL;
int key;
Node(Node* _parent, int value) {
parent = _parent;
key = value;
}
int add(Node* root, int value)
{
... | ALGO | 0.999901 | 4.977504 |
dbc30eee-ae90-4441-a7fc-652c52a4bf54 | ArchitKumar1/LeetCode-Submissions | process-tasks-using-servers/Wrong Answer/5-30-2021, 10:43:38 AM/Solution.cpp | // https://leetcode.com/problems/process-tasks-using-servers
class Solution {
public:
vector<int> assignTasks(vector<int>& servers, vector<int>& tasks) {
set<tuple<int,int>> st;
int n = servers.size();
int m = tasks.size();
int pos= 0;
set<tuple<int,int,int>> ms;
for... | ALGO | 0.999996 | 6.158323 |
4af725a0-f09e-43a4-bd9c-fb250f48b418 | LASER-UMASS/Themis | subjectSystems/B,F/algorithm.cpp | #include <iostream> // for std::cout
#include <fstream>
#include <utility>
#include<vector>
#include<string>
#include<math.h>
#include <ios>
#include <stdlib.h>
#include <time.h>
using namespace std;
typedef pair<int,int> disc_attr;//pair of attribute index and the value of that attribute which is bei... | ALGO | 0.995763 | 3.28054 |
e97a0d86-b79f-40a6-a749-96fb8c3c77a9 | ishandutta2007/codeforces | ashishgup/normal/1353/B.cpp | #include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long
const int N = 1e5 + 5;
int n, k;
int a[N], b[N];
int32_t main()
{
IOS;
int t;
cin >> t;
while(t--)
{
cin >> n >> k;
for(int i = 1; i <= n; i++)
cin >> a[i]... | ALGO | 0.999985 | 3.377868 |
051cba2a-2b02-43bd-84a9-ce795ca481b1 | cavallo5/cpp_scripts | src/conversioni_basi_qualsiasi.cpp | #include <iostream>
#include <cstdlib>
#include <string>
using namespace std;
void ConvBQualsB10(string numero, int base, int &valore) {
int n = numero.size(); //numero di cifre
int i = 0;
valore = 0;
int cifra;
while (i < n) {
cifra = numero[i] - '0';
valore = valore * base + cifr... | ALGO | 0.993893 | 4.731632 |
1a4048dc-4f51-4160-8aa6-ad4aa3d0492e | pLogicador/cpp_problem_solving | cppComoProgramar/c5/EX5.22/main.cpp | #include <iostream>
using namespace std;
int main()
{/*
// a)
int x, y;
cout << "Enter x and y for check !( x < 5 ) && !( y >= 7 ): ";
cin >> x >> y;
bool result1 = !( x < 5 ) && !( y >= 7 );
bool result2 = !(( x < 5 ) || ( y >= 7));
if (result1 == result2)
{
cout << result1 ... | ALGO | 0.966396 | 3.053673 |
1827cad2-8688-46b4-aac8-c395b26a56e4 | CyberShrek/ssu_tasks | Семестр 2/Практические задания/Графы.cpp | #include "Графы.h"
void Графы::run() {
// Создание графа и списков смежности
build_graph(await_ranged_int_input("Введите количество вершин графа", 0, 100));
// Работа с графом
print_adjacency_list();
explore_vertices();
}
void Графы::build_graph(int size) {
adjacency_list = vector<set<int>>(s... | ALGO | 0.929115 | 4.516705 |
df08dff9-b75e-4810-af55-79ad5c474402 | mehedihasan826/Codeforces | 155 A. I_love_mehed.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
while(cin>>n){
int arr[n+5];
for(int i=0;i<n;i++)
cin>>arr[i];
int maxi=arr[0], mini=arr[0], cnt=0;
for(int i=1;i<n;i++){
if(arr[i]>maxi){
cnt++;
maxi=arr[i];
... | ALGO | 0.99965 | 3.885451 |
2e7c761c-3b89-4735-b10e-620f7cc59dfa | asu-crypto/mpsica | thirdparty/linux/boost/libs/geometry/doc/src/examples/algorithms/difference.cpp | // Boost.Geometry (aka GGL, Generic Geometry Library)
// QuickBook Example
//[difference
//` Shows how to subtract one polygon from another polygon
#include <iostream>
#include <list>
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/polygon.hpp>
#in... | ALGO | 0.966054 | 6.462214 |
4965a49a-8086-40f2-984a-3e6ff98be50c | ishandutta2007/codeforces | sooke/normal/1202/B.cpp | #include <bits/stdc++.h>
int dis[10][10];
std::string s;
int solve(int x, int y) {
for (int i = 0; i <= 9; i++) {
for (int j = 0; j <= 9; j++) { dis[i][j] = 1e9; }
}
for (int i = 0; i <= 9; i++) {
dis[i][(i + x) % 10] = dis[i][(i + y) % 10] = 1;
}
for (int k = 0; k <= 9; k++) {
... | ALGO | 0.999945 | 3.693538 |
291a9c9f-2761-4527-bf1a-7889fc040865 | Naeem739/CP | Modular_Division.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> Pair;
#define endl '\n'
#define all(a) (a).begin(), (a).end()
void answer();
ll power(ll x, ll y, ll mod){
ll ans = 1;
while(y){
if(y & 1) ans = ans * x % mod ;
x = x * x % mod;
y >>= 1;
}
return ans; ... | ALGO | 0.999983 | 4.903337 |
0867cd25-6e2d-4f01-bf78-d6474cc67c49 | ashutosh1598/Codeforces | 493a.cpp | #include"iostream"
#include"cmath"
#include"vector"
#include"algorithm"
#include"set"
#include"map"
#include"string"
#include"unordered_map"
using namespace std;
typedef long long ll;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
string x,y;cin>>x>>y;
int n;cin>>n;
map<char,string>te... | ALGO | 0.996777 | 3.37801 |
589fe38d-db6d-4221-97ca-7d84e45ddaac | AV2409/DSA_Codes | LinkedList/reverse_LL.cpp | #include <bits/stdc++.h>
using namespace std;
class Node
{
public:
int data;
Node *next;
Node(int data1, Node *next1)
{
data = data1;
next = next1;
}
Node(int data1)
{
data = data1;
next = nullptr;
}
};
void insertionAtHead(Node *&head, int val)
{
... | ALGO | 0.999962 | 5.250134 |
4c1438f5-0f84-4854-9fac-171219e9191d | Petkub/toi-zero | A1_C++/A1-004.cpp | #include <bits/stdc++.h>
using namespace std;
const char nl = '\n';
int main()
{
cin.tie(nullptr);ios::sync_with_stdio(false);
int e, m, f;
cin >> e >> m >> f;
if (e >= 10 / 2 && m >= 40 / 2 && f >= 50 / 2) {cout << "pass" << nl;}
else {cout << "fail" << nl;}
return (0);
} | ALGO | 0.993307 | 3.777495 |
83f3f6b3-ff96-4dde-b093-1d4243a4128f | beninbf-zz/CodePath | ExtraProblems/Graphs/CountBasins/OptimalSolution1.cpp | #include <bits/stdc++.h>
#include <vector>
#include <algorithm>
using namespace std;
string ltrim(const string &);
string rtrim(const string &);
vector<string> split(const string &);
vector<int> find_basins(vector< vector<int> > matrix) {
int row_count = matrix.size();
int col_count = matrix[0].size();
... | ALGO | 0.999874 | 5.712605 |
a17922a5-3422-49a5-8937-d0c28705ddb2 | ishandutta2007/codeforces | greencis/normal/621/B.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
int n,x,y;
ll diag1[3005],diag2[3005];
ll ans;
int main()
{
ios_base::sync_with_stdio(0);
cin >> n;
while (n--) {
cin >> x >> y;
++diag1[10... | ALGO | 0.999783 | 4.55153 |
b69ff3b9-83e5-4e09-81d0-0cf0b31621d2 | josephjafetrizo/RizoPuenteJoseph-Tareas- | practica_1/practica1e3.cpp | #include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <math.h>
int main()
{
system("color 71");
int r,h;
float g,v,a;
const float pi=3.1416;
printf("este programa calcula el valor del volumen y area de un cono \ncon los valores de radio y altura");
printf("\ningrese la altura ");
... | ALGO | 0.977058 | 3.283703 |
85802795-67e3-4497-8577-8166f85d312d | Recedivies/Coding-Exercises | problem-topics/dfs/ABCPATH.cpp | #include <bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
//typedef tree<int,null_type,less<int>,rb_tree_tag, tree_order_statistics_node_update> indexed_set;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef string str;
... | ALGO | 0.999393 | 5.533826 |
8d77d2d3-3fe0-4653-97c6-a3c0945087aa | labote/BaekJOON-Problems- | CodingTest/Algorithm/QuickSort.cpp | #include <iostream>
using namespace std;
int data[9]={7,6,5,8,3,5,9,1,6};
void QuickSort(int start, int end){
if(start>=end){ // 원소가 1개인 경우
return;
}
int pivot=start,i=start+1,j=end;
int temp;
while(i<=j){
while(i<=end && data[i]<=data[pivot]){
i++;
}
... | ALGO | 0.999924 | 4.142637 |
9326a068-5e8b-49d6-b40d-0243df61b7a1 | liadaboiko/pkr_lab.3.4.rec | Source.cpp | #include <iostream>
using namespace std;
struct Node {
int data;
Node* next;
};
Node* createCircularList(const int* arr, int size, int index = 0, Node* first = nullptr) {
if (index == size) {
return first;
}
Node* node = new Node{ arr[index], nullptr };
if (index == 0) {
fir... | ALGO | 0.999823 | 5.655269 |
32ab1095-62f4-4c2b-ac0f-63dd82e2e4e8 | shantanu2002git/GFG-QS | Easy/Right View of Binary Tree/right-view-of-binary-tree.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// Tree Node
struct Node
{
int data;
Node* left;
Node* right;
};
// Utility function to create a new Tree Node
Node* newNode(int val)
{
Node* temp = new Node;
temp->data = val;
temp->left = NULL;
temp->right = NULL;
r... | ALGO | 0.99951 | 6.426289 |
77a78d59-6bdb-42d9-87c5-9d6e48239f19 | 21omkarsase/DSA | Stack/easy/ImplementQueueusingStacks.cpp | // 232. Implement Queue using Stacks
// Easy
// 6.3K
// 362
// Companies
// Implement a first in first out (FIFO) queue using only two stacks. The implemented queue should support all the functions of a normal queue (push, peek, pop, and empty).
// Implement the MyQueue class:
// void push(int x) Pushes element ... | ALGO | 0.995488 | 6.374443 |
cbb2a261-0b96-4ec5-b9c9-ba1b224ae705 | danielorkae/lp1-atv1 | q2/stack.cpp | #include <iostream>
#include "stack.hpp"
/// @brief Adiciona um elemento ao final da pilha.
/// @param s A pilha.
/// @param value O elemento a ser adicionado.
void stack_push(vector<int> &s, int value)
{
s.push_back(value);
}
/// @brief Retorna o último elemento da pilha.
/// @param s A pilha.
/// @return O últi... | TOOL | 0.95267 | 4.734268 |
56e2fca0-c457-42c5-8433-565a6b8c160b | RudolfWeeber/espresso-alt | src/core/hat.cpp | /** \file soft_sphere.cpp
*
* Implementation of \ref soft_sphere.hpp
*/
#include "hat.hpp"
#include "communication.hpp"
#ifdef HAT
int hat_set_params(int part_type_a, int part_type_b,
double Fmax, double r)
{
IA_parameters *data = get_ia_param_safe(part_type_a, part_type_b);
if (!data) return ES_ERROR;... | TOOL | 0.995635 | 5.473607 |
9b21563f-a1e1-4efb-86d9-f904c631a1bd | Orca0917/Algorithm | BaekjoonOnlineJudge/5648.cpp | #include <bits/stdc++.h>
#define ll long long
#define pii pair<int, int>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int n; cin >> n;
vector<ll> v;
while (n--) {
string s; cin >> s;
reverse(s.begin(), s.end());
... | ALGO | 0.999352 | 5.254871 |
9e78896b-c552-4c21-aa4e-08f2977b5b39 | alexandraback/datacollection | solutions_6404600001200128_0/C++/NALP/A.cpp | #ifdef NALP_PROJECT
#pragma hdrstop
#else
#define _SECURE_SCL 0
#endif
#define _CRT_SECURE_NO_DEPRECATE
#pragma comment(linker, "/STACK:200000000")
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <cctype>
#include <cmath>
#include <algorithm>
#include <utility>
#include <cassert>
#include <set>
#inclu... | ALGO | 0.998303 | 3.621356 |
ffa13ea0-2b10-4801-8e67-ff44cbd6d84f | capnmav77/Core-Programming | STL/DSA/Greedy/Candy.cpp | /*
MY YOUTUBE VIDEO ON THIS Qn : https://www.youtube.com/watch?v=YUT13Koh5Jg
Company Tags : Amazon
Leetcode Link : https://leetcode.com/problems/candy/
*/
//Approach-1
//T.C : O(n)
//S.C : O(2*n) ~ O(n) But using 2 Extra Arrays
class Solution {
public:
int candy(vector<int>... | ALGO | 0.999997 | 6.424638 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.