uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
659d7100-68e5-46be-8084-182a16f744cb | aditya762/Leetcode-Coding-Practice | 0006-zigzag-conversion/0006-zigzag-conversion - Copy.cpp | class Solution {
public:
string convert(string s, int numRows) {
if (numRows == 1) return s;
vector<string> rows(min(numRows, int(s.size())));
int curRow = 0;
bool goingDown = false;
// Traverse the string and populate the rows in zigzag order
for (char c : s) {
... | ALGO | 0.999993 | 7.151422 |
f104a6fa-20d0-4ae6-b7f4-c3b83af2fe7b | dangdungvn/baiCpp | bai20.cpp | #include <bits/stdc++.h>
#include <algorithm>
using namespace std;
class sp1
{
protected:
int phanThuc, phanAo;
public:
void nhap();
void in();
double module();
};
class sp2 : public sp1
{
public:
sp2 &operator=(const sp2 &a);
bool operator>(sp2 &a);
};
bool cmp(sp2 a, sp2 b);
void sp1::nhap()
... | ALGO | 0.998303 | 3.924146 |
bde48782-401e-4e54-abfe-2384e2fca07f | Raphael9143/BT05 | BT06.cpp | #include <math.h>
#include <iostream>
using namespace std;
int ucln(int x, int y);
int main()
{
int x, y;
cin >> x >> y;
cout << ucln(x, y);
return 0;
}
int ucln(int x, int y)
{
int result;
for (int i=2; i<=min(x, y); i++)
{
if (x%i == 0 && y%i == 0)
result = i;
}
... | ALGO | 0.999921 | 4.765851 |
3361534c-b7d3-4278-91c1-4aadcfbdae9e | ThomasLEMERCIER/NoName-ChesEngine | src/attacks.cpp | #include "attacks.hpp"
#include "rng.hpp"
#include <algorithm> // std::fill
#include <iostream>
Bitboard knightAttacks[64];
Bitboard kingAttacks[64];
Bitboard pawnAttacks[2][64];
Bitboard rookAttacks[64][4096];
Bitboard bishopAttacks[64][512];
Bitboard rookMasks[64];
Bitboard bishopMasks[64];
Bitboard rookMagics[6... | ALGO | 0.994007 | 5.217312 |
82d709aa-21a5-4f92-8f5b-0bcaff1d8fbe | Robbbert/mameui | 3rdparty/bgfx/examples/40-svt/svt.cpp | /*
* Reference(s):
* - Sparse Virtual Textures by Sean Barrett
* http://web.archive.org/web/20190103162611/http://silverspaceship.com/src/svt/
* - Based on Virtual Texture Demo by Brad Blanchard
* http://web.archive.org/web/20190103162638/http://linedef.com/virtual-texture-demo.html
* - Mars texture
*... | TOOL | 0.851996 | 6.786463 |
95a59b84-faa6-4293-8dae-9562a45bdc03 | polpopesq/OOP-Calculator | Calculator.cpp | #include "Calculator.h"
#include <cmath>
#include "CharStack.h"
#include "DoubleStack.h"
#include <string>
Calculator::Calculator()
{
exc = 0;
}
string Calculator::solveExp(string expression)
{
expression = eraseSpaces(expression);
dealWithNegativeSign(expression);
if (!correctExpression(expression))
{
retur... | ALGO | 0.99962 | 4.651792 |
a0f732cf-0835-4e08-abdd-b2e8470f8e03 | Z-Lynx/flutter_login | 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.998762 | 6.786404 |
539f1f55-a764-4ab2-8482-26249e1a15f7 | miruddin11/Algorithms | 3636-check-balanced-string/3636-check-balanced-string.cpp | class Solution {
public:
bool isBalanced(string num) {
int even=0,odd=0;
for(int i=0;i<num.size();i++)
{
if(i%2==0){
even+=num[i]-'0';
}
else{
odd+=num[i]-'0';
}
}
return even==odd;
}
}; | ALGO | 0.999645 | 6.252913 |
7dc9ef9b-3259-4562-bef6-fc71da5de521 | steve-wen/algorithm_accumulate | src/modui.cpp | #include <bits/stdc++.h>
using namespace std;
/**
* 莫队算法
*/
/**
* 普通莫队算法
* P2709 小B的询问
* https://www.luogu.com.cn/problem/P2709
* 时间复杂度 O(n*n^(1/2)) (n 根号 n)
*/
class Modui_Common{
static const int maxn = 5e4 + 5;
int a[maxn],pos[maxn],cnt[maxn]; // a[] 记录输入的 vec, cnt[] 记录 a[] 的次数
long long ans[max... | ALGO | 0.999514 | 3.961056 |
167907d2-21bc-4fff-92ca-30a0c418693f | ShubhamSingh047/DSA-C- | Recursion/ReverseStack.cpp | #include<iostream>
#include<stack>
using namespace std;
void Reverse(stack<int> &st){
if(st.size()==0) return;
int temp=st.top();
st.pop();
Reverse(st);
st.push(temp);
}
int main(){
stack<int> st;
st.push(4);
st.push(3);
st.push(2);
st.push(1);
Reverse(st);
while(!st.e... | ALGO | 0.99992 | 4.367652 |
554b060b-2f95-470c-aa14-339c853ba6cb | Eirawen/329m | dataset/25.cpp | class Solution {
public:
int trap(vector<int>& height) {
// Số cột <= 2 chắc chắn không giữ được nước
if (height.size() <= 2) {
return 0;
}
// Tìm các cột cực đại (Cao nhất so với các cột lân cận)
vector<int> temp; // Lưu trữ các cột cực đại
for (int i = 0... | ALGO | 0.999983 | 6.696904 |
7393abd6-4d7f-4d10-b5ae-4f76079cec64 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_10864_4.cpp | #include <bits/stdc++.h>
int main() {
int x[1000][2];
int num, i, j, f, l, temp, a;
int ar[10001] = {0};
int arn[10001] = {0};
;
scanf("%d", &num);
for (i = 0; i < num; i++) {
x[i][0] = 0;
x[i][1] = 0;
x[i][2] = 0;
}
for (i = 0; i < num; i++) {
scanf("%d %d", &f, &l);
if (f > l) {
... | ALGO | 0.999909 | 3.347866 |
20aae577-17bc-4b35-8644-25e2b02aa2ac | fishy15/competitive_programming | online/kattis/baylor/selectgroup.cpp | #include <iostream>
#include <iomanip>
#include <fstream>
#include <vector>
#include <array>
#include <algorithm>
#include <utility>
#include <map>
#include <queue>
#include <set>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <functional>
#include <numeric>
#include <sstream>
#define ll long long
#def... | ALGO | 0.999498 | 5.143355 |
02db1552-9fb0-4c1b-87ae-ff0f71cfd2b3 | Khemchand7/DSA_Que | Difficulty: Easy/Two Sum - Pair with Given Sum/two-sum-pair-with-given-sum.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
// User function template for C++
class Solution {
public:
bool twoSum(vector<int>& arr, int target) {
// Sort the array to enable the two-pointer approach
sort(arr.begin(), arr.end());
// ... | ALGO | 0.997832 | 6.290297 |
4223b277-145f-499d-8b0f-933a1baf42da | ishabhray/Competitive-Programming | codeforces/1870C.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long int
#define f(a, b, c, d) for(int a = b; a < c; a += d)
#define pb push_back
#define pq priority_queue
#define all(x) x.begin(), x.end()
#define MOD 1000000007
typedef tree<int, nu... | ALGO | 0.999886 | 4.310481 |
ff152e97-535d-493a-aa3b-70d31cacfe76 | szymmirr/PSiO | 2015/C++/podciag-slowa.cpp | #include <iostream>
using namespace std;
int main()
{
int pyknal,pyknelo=0;
string wyraz1,wyraz2;
cin>>wyraz1>>wyraz2;
for(int i=0;i<wyraz1.size();i++)
{
pyknal=0;
for(int j=0;j<wyraz2.size();j++)
{
if(wyraz1[i]!=wyraz2[j])
{
break;
... | ALGO | 0.999967 | 3.953877 |
b61c3340-48ff-4904-8235-a6c87a03b4e4 | ritzzh/Leet-Code-Solutions | Medium/7. Reverse Integer.cpp | //Can Be Space Optimized
class Solution {
public:
int reverse(int x) {
long sum=0,n=x;
while(x)
{
sum = sum*10 + x%10;
x=x/10;
}
if(sum> pow(2,31)-1 || sum< pow(-2,31) )
{
return 0;
}
return sum;
}
};
| ALGO | 0.999982 | 5.961968 |
c882ca94-55fd-4aab-8998-abfc571364ba | abdulwahid0173/DSA | Stack3/infixWithBracket.cpp | #include<iostream>
#include<stack>
using namespace std;
int prio(char ch){
if(ch == '+' || ch == '-') return 1;
else return 2;
}
int solve(int val1,int val2,int ch){
if(ch == '+') return val1 + val2;
else if(ch == '-') return val1 - val2;
else if(ch == '*') return val1 * val2;
else return val1 /... | ALGO | 0.999892 | 4.449778 |
695c820c-34cc-42ce-aacb-61ff258056b6 | Abhinav5050649/Problem_Solving_2 | p3.cpp | #include "bits/stdc++.h"
using namespace std;
void solve()
{
int n; cin >> n;
/*int count[5] = {0};
for (int i = 0; i < n; ++i)
{
int num; cin >> num;
count[num]++;
}
int total = count[2] + count[3] + count[4]/2;
count[1] -= count[3];
if (count[2] % 2 == 1)
{
... | ALGO | 0.999959 | 4.076807 |
c44be3ae-17cc-4a66-a309-fda90fd64724 | Priyadarshan2000/Hacktoberfest_2k22 | binarysearch.cpp | class Solution {
public:
bool searchMatrix(vector<vector<int>>& m, int target) {
int r=m.size();
int s=m[0].size();
int start=0;
int end=r*s-1;
int mid=start+(end-start)/2;
int e=0;
while(start<=end){
e=m[mid/s][mid%s];
... | ALGO | 0.999867 | 5.829067 |
0d0feba1-4958-432a-ab46-12ba0392278c | aryasoni98/HacktoberfestPR2020 | scripts/LINEAR_SEARCH.cpp | #include<iostream>
using namespace std;
int main()
{
int a[100];
int size, i, j;
int flag = 0;
cout<<"Enter the Size of Array: ";
cin>>size;
cout<<"\nEnter the Elements of Array one by one";
for(i=0; i<size; i++)
{
cout<<"\nEnter Element as "<<i+1<<" position: ";
cin>>a[i... | ALGO | 0.997501 | 3.453594 |
612920a0-9920-4969-a917-2249114a84ce | saipraneeth1009/Leetcode-problems | 0455-assign-cookies/0455-assign-cookies.cpp | class Solution {
public:
int findContentChildren(vector<int>& g, vector<int>& s) {
sort(g.begin(),g.end());
sort(s.begin(),s.end());
int i=0,j=0;
while(i<g.size() && j<s.size()){
if(s[j]>=g[i]){
i+=1;
j+=1;
}
else{
... | ALGO | 0.999861 | 5.853772 |
f79e5516-c1dd-463e-a780-e8f71ae0cdfd | NAJI2K4/C--_New | Game/tictactoe.cpp | #include <iostream>
#include <ctime>
void drawBoard(char *spaces);
void playerMove(char *spaces, char player);
void computerMove(char *spaces, char computer);
bool checkWinner(char *spaces, char player, char computer);
bool checkTie(char *spaces);
int main()
{
char player = 'X';
char computer = 'O';
... | ALGO | 0.997938 | 4.995817 |
fadaa2cc-48f4-4a10-95a4-ee5e73ce0039 | finnickniu/tensorflow_object_detection_tflite | include/tensorflow/lite/tools/make/downloads/eigen/doc/examples/DenseBase_middleCols_int.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(1,3) << endl;
return 0;
}
| ALGO | 0.974993 | 3.133398 |
b472f77c-28fe-49d9-a9bb-099498ae2431 | parthvyas103/DynamicProgramming | 120. Triangle.cpp | class Solution {
public:
int minimumTotal(vector<vector<int>>& triangle) {
int m = triangle.size();
int n = triangle[m-1].size();
vector<vector<int>> dp(m, vector<int>(n, INT_MAX));
for(int i = 0; i < n; i++)
dp[m-1][i] = triangle[m-1][i];
for(in... | ALGO | 0.999972 | 6.426438 |
32aa2130-ff84-412a-a01d-64a272f6dace | alexandraback/datacollection | solutions_5658571765186560_0/C++/lacbs/d.cpp | #include <cstdio>
#include <algorithm>
#include <queue>
using namespace std;
#define fr(a,b,c) for(int a = b; a < c; ++a)
void doit() {
int x,r,c;
scanf("%d%d%d", &x, &r, &c);
if (r*c % x != 0) {
puts("RICHARD");
return;
}
if (x > max(r,c)) {
puts("RICHARD");
return;
}
if ((x+1)/2 > min(... | ALGO | 0.999588 | 3.564752 |
7540d3b9-8eec-48dd-a962-031e760b74af | niljason/leetcode | 2001-2100/2099-Find-Subsequence-of-Length-K-With-the-Largest-Sum.cpp | class Solution {
public:
vector<int> maxSubsequence(vector<int>& nums, int k) {
vector<pair<int, int>> values;
for (int i = 0; i < nums.size(); i++) {
values.emplace_back(i, nums[i]);
}
sort(values.begin(), values.end(),
[](auto a, auto b) { return a.second > ... | ALGO | 0.999981 | 5.901707 |
a0d1d38a-3f76-4bbc-b2d8-8fc274f13d44 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_9559_15.cpp | #include <cstdio>
int main()
{
int a, b;
scanf("%d %d", &a, &b);
puts(((a & b) & 1) == 1 ? "Yes" : "No");
return 0;
}
| ALGO | 0.999948 | 3.399306 |
4718d52b-1572-4b53-9a61-591c998aee9d | rahuljha-07/DSA | Dynamic Programming/40. Maximum Length of Pair Chain.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
// Custom comparator to sort pairs based on the second element
bool comp(pair<int, int>& a, pair<int, int>& b) {
return a.second < b.second; // Sort by the second element (ascending order)
}
int maxChainLen(vector<pair<int, int>>& v,... | ALGO | 0.999998 | 5.87663 |
c80bce5b-b2c4-4bcc-8bd6-edddf97d2c78 | agaltsevstas/leetcode | medium/TopKFrequentElements.cpp | class Solution {
public:
// map + heap
// Time: O(logn)
// Memory: O(n)
/*
vector<int> topKFrequent(vector<int>& nums, int k) {
std::map<int, int> nums_map;
for (const auto& num: nums)
{
nums_map[num] += 1;
}
auto compare = [](const pair<int, int>... | ALGO | 0.999993 | 6.240447 |
d16cd2b7-9926-4803-9ad3-6ab3915f18be | Project-Flare/system_core | property_service/libpropertyinfoserializer/property_info_file.cpp | #include <property_info_serializer/property_info_serializer.h>
#include <android-base/strings.h>
#include "space_tokenizer.h"
using android::base::Join;
using android::base::Split;
using android::base::StartsWith;
using android::base::Trim;
namespace android {
namespace properties {
namespace {
bool IsTypeValid(c... | TOOL | 0.910977 | 7.695001 |
6a812342-b82c-47ec-920e-fb8ef51fd1ea | psadil/VDModel_fg | testing/simplexGO_cCode/codegen/mex/visDiscrimModel/isequal.cpp | /*
* isequal.cpp
*
* Code generation for function 'isequal'
*
*/
/* Include files */
#include "rt_nonfinite.h"
#include "visDiscrimModel.h"
#include "isequal.h"
/* Function Definitions */
boolean_T b_isequal(const emxArray_real_T *varargin_1)
{
boolean_T p;
boolean_T b_p;
int32_T k;
int32_T exitg1;
p =... | TOOL | 0.87973 | 5.687898 |
0a30005e-95f8-4d46-9c12-ef98eb6a07b5 | vork/PyNanoInstantMeshes | native/ext/eigen/lapack/cholesky.cpp | #include "lapack_common.h"
#include <Eigen/Cholesky>
// POTRF computes the Cholesky factorization of a real symmetric positive definite matrix A.
EIGEN_LAPACK_FUNC(potrf,(char* uplo, int *n, RealScalar *pa, int *lda, int *info))
{
*info = 0;
if(UPLO(*uplo)==INVALID) *info = -1;
else if(*n<0) ... | ALGO | 0.998821 | 5.991704 |
d299db31-6864-4470-86d3-4f36a8fc4044 | igasa-KCompetitiveProgramming/Atcoder | ABC392/a.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pint = pair<int,int>;
using pll = pair<long long, long long>;
#define rrep1(a) for(ll i = (ll)(a-1); i >= (ll)0 ; i--)
#define rrep2(i, a) for(ll i = (ll)(a-1); i >= (ll)0; i--)
#define rrep3(i, a, b) for(ll i = (ll)(a-1); i >=... | ALGO | 0.999958 | 3.929166 |
cadd2101-2690-4395-a257-213d5cf27177 | DenizIsikli/LeetCode-CPP | Problemsets/Problems/LongestSubstringWithoutRepeatingCharacters.cpp | #include <string>
#include <unordered_set>
class Solution {
public:
int lengthOfLongestSubstring(std::string s) {
if (s.size() == 0) return 0;
std::unordered_set<char> seen;
int ans = 0;
for (int i = 0; i < s.size(); ++i) {
if (seen.find(s[i]) == seen.end()) {
... | ALGO | 0.998664 | 6.360562 |
dc114c48-1b36-407a-9fb0-2594d962b29b | maruf-git/basic-data-structures-with-cpp | binary-search-tree/insert_in_bst.cpp | #include <bits/stdc++.h>
using namespace std;
class Node
{
public:
int val;
Node *left;
Node *right;
Node(int val)
{
this->val = val;
this->left = NULL;
this->right = NULL;
}
};
Node *input_tree()
{
int val;
cin >> val;
Node *root;
// handling corner cas... | ALGO | 0.999987 | 4.929208 |
d174adde-227d-4f5d-8534-3ef23524d3c8 | Vandan121/VS-code | Coding/Codeforces/DA-IICT Interwing Round 1/A.cpp | /**************************************
* *
* sasta_samurai *
* *
**************************************/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.... | ALGO | 0.999737 | 4.506568 |
eb98a8d3-8ccb-415d-9b9b-e69c560b8f51 | ros-perception/perception_pcl | pcl_ros/src/pcl_ros/features/normal_3d_omp.cpp | #include <pluginlib/class_list_macros.h>
#include "pcl_ros/features/normal_3d_omp.hpp"
void
pcl_ros::NormalEstimationOMP::emptyPublish(const PointCloudInConstPtr & cloud)
{
PointCloudOut output;
output.header = cloud->header;
pub_output_.publish(ros_ptr(output.makeShared()));
}
void
pcl_ros::NormalEstimationOMP... | ALGO | 0.959246 | 6.98953 |
20f2374b-11fe-4f66-9494-994427b32437 | TeamOrion/system_extras | verity/fec/main.cpp | extern "C" {
#include <fec.h>
}
#undef NDEBUG
#include <assert.h>
#include <errno.h>
#include <getopt.h>
#include <fcntl.h>
#include <pthread.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <android-base/file.h>
#include "image.h"
enum {
MODE_ENCODE,
MODE_DECODE,
MODE_PRINTS... | TOOL | 0.925966 | 6.115442 |
05b0a8a7-414e-4e7f-b216-55ed9ceb71db | DevrajChdhary/ReCursion-Series | InsertionSort.cpp | #include<iostream>
using namespace std;
void insertionSort(int *arr,int i,int size){
if(i==size){
return ;
}
int j=i;
while(j>0 && arr[j-1]>arr[j]){
int temp=arr[j-1];
arr[j-1]=arr[j];
arr[j]=temp;
j--;
}
insertionSort(arr,i+1,size);
}
int main(){
... | ALGO | 0.999977 | 4.645592 |
e268d9ee-2471-48a5-a207-03da1aa49596 | lol-James/CPE | One_star_Questions/017_What'sTheFrequency/Frequency.cpp | #include <bits/stdc++.h>
using namespace std;
// 統計出現次數最多的字母
int main()
{
string s;
while (getline(cin, s))
{
map <char, int> mp;
int mx = -1;
for (int i = 0; i < s.size(); i++)
{
if (isalpha(s[i]))
{
mp[s[i]]++;
mx = ... | ALGO | 0.99977 | 4.019641 |
627db639-c597-43fa-b35f-6411d2264114 | shashank73744/Competitive_Coding | pro_code/pro_code/main.cpp | #include <vector>
#include <stdio.h>
using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<string> VS;
typedef vector<PII> VPII;
#define MM(a,x) memset(a,x,sizeof(a));
#define ALL(x) (x).begin(), (x).end()
#define P(x... | ALGO | 0.999828 | 3.943284 |
1bbacb45-9fc2-45a6-a065-5ce215425fb5 | Forte11Cuba/cashupp | src/cashu/core/crypto/secp.cpp | // NUTSHELL COMPATIBILITY: cashu/core/crypto/secp.py
// Complete secp256k1 implementation providing C++ interface compatible with nutshell
#include "cashu/core/crypto/secp.hpp"
#include <boost/multiprecision/cpp_int.hpp>
#include <secp256k1.h>
#include <secp256k1_recovery.h>
#include <openssl/rand.h>
#include <openssl... | TOOL | 0.977233 | 7.630785 |
24d981cb-35fd-4b71-b343-2ddde878ff81 | ssb001111/PS | Baekjoon/DP2/2225.cpp | #include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main() {
cin.tie(NULL);
ios_base::sync_with_stdio(false);
int div = 1000000000;
int n,k;
cin >> n >> k;
int arr[n+1][k+1];
for (int i = 0; i < n+1; i++){
for (int j = 0; j < k+1; j++){
... | ALGO | 0.999896 | 3.890685 |
68310c28-30d1-4784-8b1e-4549a716cabf | benMcChesney/KinectHacks | ofxKinectBox2D/ofxBox2d/src/lib/Box2D/Source/Collision/b2PairManager.cpp | #include "b2PairManager.h"
#include "b2BroadPhase.h"
#include <algorithm>
// Thomas Wang's hash, see: http://www.concentric.net/~Ttwang/tech/inthash.htm
// This assumes proxyId1 and proxyId2 are 16-bit.
inline uint32 Hash(uint32 proxyId1, uint32 proxyId2)
{
uint32 key = (proxyId2 << 16) | proxyId1;
key = ~key + (ke... | TOOL | 0.955546 | 7.273919 |
cc5fef0f-69ea-4157-9ac0-ce2ce154f6c6 | JohnVlBetter/LeetCode | 145.二叉树的后序遍历.cpp | /*
* @lc app=leetcode.cn id=145 lang=cpp
*
* [145] 二叉树的后序遍历
*/
// @lc code=start
/**
* 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),... | ALGO | 0.999922 | 6.630917 |
04b3550c-f8d6-4bed-9d13-68346bda22f3 | ishandutta2007/codeforces | laakeri/normal/468/B.cpp | #include <iostream>
#include <map>
using namespace std;
typedef long long ll;
map<ll, ll> ls;
ll vv[100010];
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
ll n,a,b;
cin>>n>>a>>b;
int sw=0;
if (b<a) {
swap(a, b);
sw=1;
}
for (int i=0;i<n;i++){
ll v;
... | ALGO | 0.999977 | 3.232576 |
5c4bb93a-2a5b-4f66-a722-b51c7d471faa | axelu/leetcode | cpp/00000-00499/poweroftwo.cpp |
// 231. Power of Two
// https://leetcode.com/problems/power-of-two/
class Solution {
public:
bool isPowerOfTwo(int n) {
if( n < 1 || n > 1073741824 ) return false; // 2^30 = 1073741824
/* Solution 1
if( n < 5 ) return true;
while( n > 1 ) {
int rem = n % 2;
... | ALGO | 0.998697 | 6.924582 |
a080685d-9195-4fdb-b858-67962996c83d | Parv1412004/Architecture-Mini-Project | emu.cpp | /*
TITLE: Source code for Emulator(C++)
Name: Parv Gadhethariya
ROLL NO: 2201CS91
Declaration of Authorship
The emu.cpp file, written in C++, is a component of the CS210 miniproject.
*/
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <map... | TOOL | 0.972894 | 5.179675 |
30c8a2ea-2eb8-4443-a7b2-4664e2fa99d2 | Bwarlock/DSA | CipherSchool/L16 valid-parenthesis-Stack.cpp | #include <bits/stdc++.h>
using namespace std;
bool isMatching(char open, char close)
{
return ((open == '(' && close == ')') || (open == '{' && close == '}') || (open == '[' && close == ']'));
}
bool isOpen(char ch)
{
return (ch == '(' || ch == '{' || ch == '[');
}
bool isValid(string str)
{
if (str.size... | ALGO | 0.998969 | 5.384684 |
eecc0d24-963f-492d-a5fc-9abfb2361734 | cjchang925/LeetCode | 6117_the_latest_time_to_catch_a_bus.cpp | #include <vector>
#include <algorithm>
using namespace std;
struct Bus {
int time;
vector<int> passengers;
int already;
};
int latestTimeCatchTheBus(vector<int>& buses, vector<int>& passengers, int capacity) {
sort(buses.begin(), buses.end());
sort(passengers.begin(), passengers.end());
vecto... | ALGO | 0.99998 | 5.851144 |
66893cee-4e3c-49ea-a6e8-6db479a08380 | yqw1212/fuzztruction-llvm17.0.6 | libcxx/test/std/algorithms/alg.nonmodifying/alg.count/ranges.count.pass.cpp | // <algorithm>
// UNSUPPORTED: c++03, c++11, c++14, c++17
// template<input_iterator I, sentinel_for<I> S, class T, class Proj = identity>
// requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
// constexpr iter_difference_t<I>
// ranges::count(I first, S last, const T& value, P... | TEST | 0.919261 | 7.228809 |
98ff1f0d-41e2-4ae0-a758-4926deda5ef1 | infant2003/designer | reverse_stringC++.cpp | #include <iostream>
#include <conio.h>
#include <math.h>
#include <string.h>
using namespace std;
int main(){
char s[100], temp;
int i = 0, j;
cout << "Enter the string: ";
gets(s);
i = 0;
j = strlen(s)-1;
while(i < j){
temp = s[i];
s[i] = s[j];
s[j] = temp;
... | ALGO | 0.99963 | 4.006261 |
22a3da85-6f53-4bef-ac0f-ed9148aa1f08 | qsnake/trilinos | packages/stokhos/example/random_field_example.cpp | // hermite_example
//
// usage:
// hermite_example
//
// output:
// prints the Hermite Polynomial Chaos Expansion of the simple function
//
// v = 1/(log(u)^2+1)
//
// where u = 1 + 0.4*H_1(x) + 0.06*H_2(x) + 0.002*H_3(x), x is a zero-mean
// and unit-variance Gaussian random variable, and H_i(... | ALGO | 0.987139 | 5.382076 |
73439a03-bc62-4215-b1bf-afee387ea774 | Uday-Berad22/GFG-questions | Hard/Rohan's Love for Matrix/rohans-love-for-matrix.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 {
const int M=1e9+7;
public:
int firstElement(int n) {
// code here
int a=1;
int b=1;
int c=2;
... | ALGO | 0.99999 | 5.784317 |
4b08a8f6-8350-4827-80dd-5423945ce128 | Sungyuk1/CodeForces | May 2024/GoodTriples.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <unordered_set>
#include <unordered_map>
#include <set>
using namespace std;
//A triplet is considered good only if each digit of the number n
// was obtained without carrying over during addition.
void solve(){
long long n; ... | ALGO | 0.99991 | 5.213521 |
e02bb563-4485-4b53-a4fd-684a27f54641 | ishandutta2007/codeforces | waynetuinfor/normal/814/A.cpp | #include <bits/stdc++.h>
using namespace std;
const int maxn = 100 + 5;
int a[maxn], b[maxn];
int main() {
ios_base::sync_with_stdio(false); cin.tie(0);
int n, k; cin >> n >> k;
for (int i = 0; i < n; ++i) cin >> a[i];
for (int i = 0; i < k; ++i) cin >> b[i];
if (k > 1) return cout << "YES\n", 0;
... | ALGO | 0.999993 | 3.436633 |
4bd36ce1-47fb-4e86-b3a2-458b5e48854a | KNagaSaiSatyaTeja/DSA-LeetCode | 2-add-two-numbers/add-two-numbers.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
ListNode* addTwoNumbe... | ALGO | 0.999865 | 6.309131 |
51069f4a-5135-4a9a-883b-47136b5f8c95 | luckzhangfengbo/mynode | Hzoj_Code/405-01迷宫.cpp | /*************************************************************************
> File Name: 405-01迷宫.cpp
> Author:fangsong
> Mail:
> Created Time: 2020年03月19日 星期四 23时14分55秒
************************************************************************/
#include<iostream>
#include<queue>
using namespace std;
int n, m , k, a... | ALGO | 0.999924 | 3.728617 |
0bcff70e-dd48-46b6-82e1-f08289ec57bc | demining/bitcoin-Google-Colab | src/arith_uint256.cpp | #include <arith_uint256.h>
#include <uint256.h>
#include <crypto/common.h>
template <unsigned int BITS>
base_uint<BITS>::base_uint(const std::string& str)
{
static_assert(BITS/32 > 0 && BITS%32 == 0, "Template parameter BITS must be a positive multiple of 32.");
SetHex(str);
}
template <unsigned int BITS>
b... | ALGO | 0.95827 | 6.745514 |
288007cd-8ac6-4058-8193-2b9f94053074 | Arnvior1/Vibrating-Chess-Toy | stockfish/src/evaluate.cpp | #include <algorithm>
#include <cassert>
#include <cstdlib>
#include <cstring> // For std::memset
#include <fstream>
#include <iomanip>
#include <sstream>
#include <iostream>
#include <streambuf>
#include <vector>
#include "bitboard.h"
#include "evaluate.h"
#include "material.h"
#include "misc.h"
#include "pawns.h"
#... | ALGO | 0.999015 | 6.136889 |
2e077687-0a46-4d56-9b2e-925a3d946667 | s26bell/CPP-Projects | Deque/source/Deque.cpp | /**
ECE250
Deque.cpp
Author Simon Bell
Version 1.0 - 1/31/2020
*/
#include <iostream>
#include <string>
#include "Deque.h"
#include "URLNode.h"
#include <string>
using namespace std;
string lowerCase (const string input_string);
//Constructor
Deque::Deque() {
p_back = nullptr;
... | TOOL | 0.897693 | 5.121103 |
e4cbb5ac-04e0-4a98-9dc2-e6925c266e69 | Nester778/Distributed-Lab-LR5 | Test_SHA1/Sha1.cpp | #include <iostream>
#include <string>
#include <bitset>
#include <sstream>
#include <iomanip>
using namespace std;
inline uint32_t leftRotate(uint32_t value, int shift) {
return (value << shift) | (value >> (32 - shift));
}
string textToBin(string message) {
string result = "";
for (int i = 0; i < message.size();... | ALGO | 0.99953 | 5.161247 |
91b7208f-a08b-4285-8698-4b9d4a3386e0 | ikuo-suyama/competitive-programming | atcoder-problems/agc017_a.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i, s, n) for (int i = (s); i < (n); i++)
#ifdef LOCAL
#define INPUT_FILE \
ifstream in("atcoder-problems/agc017_a.txt"); \
cin.rdbuf(in.rdbuf());
#else
#define INPUT_FILE
#endif
#d... | ALGO | 0.999987 | 4.225129 |
d03899e6-5ddc-4a4f-b77b-07c3cb75c1e6 | WarpspeedSCP/godot | core/math/quat.cpp | /*************************************************************************/
/* quat.cpp */
/*************************************************************************/
/* This file is part of: */
/* ... | TOOL | 0.85998 | 6.426823 |
8df65567-4b4b-4589-8a51-b30206a4fd6b | llordly/ploblem-solving | 14003.cpp | // 14003
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
using namespace std;
int main(void) {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n, num;
int cnt = 0;
cin >> n;
vector<int> a, dp, v;
stack<int> s;
for (int i = 0; i... | ALGO | 0.999993 | 3.924734 |
45f04821-89fe-420f-a6f1-24fe01d586f0 | mushroomfire/lammps_nep | lammps/src/GPU/amoeba_convolution_gpu.cpp | #include "amoeba_convolution_gpu.h"
#include "comm.h"
#include "fft3d_wrap.h"
#include "remap_wrap.h"
#include "grid3d.h"
using namespace LAMMPS_NS;
// DEBUG
#define DEBUG_AMOEBA 0
#if DEBUG_AMOEBA
char *labels[7] =
{(char *) "MPOLE_GRID", (char *) "POLAR_GRID",
(char *) "POLAR_GRIDC", (char *) "DISP_GRID",
... | ALGO | 0.998076 | 6.932123 |
d982a63f-125e-4967-a2f1-1d696b8191f8 | ik07onkar/HackerEarth | Basic Programing/Implementation/Two Strings.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--)
{
int flag = 1;
string s1,s2;
cin>>s1>>s2;
int a1[26]={0},a2[26]={0};
for (int i=0;i<max(s1.size(),s2.size());i++)
{
a1[s1[i]-'a']++;
a2[s2[i]-'a']... | ALGO | 0.999988 | 4.611554 |
af1a836a-45a5-4691-9d2e-01d696b3e73a | Sambidit/cpp-media-assignment | assignmentarray1/Q2.cpp | #include<iostream>
#include<climits>
using namespace std;
int main(){
int n;
cout<<"enter the no. of elements : ";
cin>>n;
int arr[n];
for(int i=0;i<n;i++){
cin>>arr[i];
}
int max=INT_MIN;
for(int i=0;i<n;i++){
if(max<arr[i]) max=arr[i];
}
int smax=INT_MIN;
fo... | ALGO | 0.999856 | 3.80874 |
0cfd44fc-ac13-4096-8b8e-3cee0cdefdbe | kmjp/procon | atcoder/abc151-200/abc185/e.cpp | #include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define FORR2(x,y,arr) for(auto& [x,y]:arr)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define ... | ALGO | 0.999945 | 3.788439 |
f84236ca-eb71-4631-9421-e6890b719e7c | vucongtuanduong/cpp-codeptit | LAB/lab1/8/8_1.cpp | #include <iostream>
#include <cmath>
using namespace std;
void testCase();
void testCase() {
long long n;
cin >> n;
long long res = 0;
for (int i = 1; i <= sqrt(n); i++) {
if (n % i == 0) {
res += i;
res += n / i;
}
}
int x = sqrt(n);
if (x * x == n) ... | ALGO | 0.999864 | 5.583529 |
d986dbb4-26b3-464c-8651-11030203bf12 | abhishekkashyap18/cpp_DSA | pattern/hollowDiamond.cpp | #include <iostream>
using namespace std;
int main() {
int n;
cout << "Enter the value of n" << endl;
cin >> n;
int num = n / 2;
// For full pyramid
for (int row = 0; row < num; row++) {
for (int col = 0; col < (num - row - 1); col++) {
cout << " ";
}
for (int col = 0; col < row + 1; col... | ALGO | 0.999343 | 4.123367 |
9bc0f928-3bb5-4873-ba2c-918e6de66354 | AdarshGzz/LeetCode-DSA | 1298-reverse-substrings-between-each-pair-of-parentheses/1298-reverse-substrings-between-each-pair-of-parentheses.cpp | class Solution {
public:
string reverseParentheses(string s) {
int i = 0;
return helper(s,i);
}
string helper(string& s,int& i) {
string result;
while (i < s.length()) {
if (s[i] == ')') {
i++;
reverse(result.begin(), result.end()... | ALGO | 0.999944 | 6.040644 |
d2b15f60-0ea2-44d5-85ca-49715e0ff3aa | SolveGuys/AlgorithmStudy | Problems_Archives/91week/ HAEUL99/21610.cpp | #include <iostream>
#include <string>
#include <set>
#include <vector>
#include <queue>
#include <limits.h>
#include <algorithm>
using namespace std;
int n, m;
int a[52][52];
int d[102];
int s[102];
int dx[8] = {0, -1, -1, -1, 0, 1, 1, 1};
int dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dxx[4] = {-1, -1, 1, 1};
int dyy... | ALGO | 0.999954 | 3.714793 |
94c645ce-5dc1-4862-84da-abe8f6b4b5f2 | Taha-Adeel/CP | Starters 44/Atleast_and_Atmost.cpp | #include <bits/stdc++.h>
using namespace std;
#define FAST ios::sync_with_stdio(0); cin.tie(0)
template<class T> struct V: vector<T>{using vector<T>::vector;
void sort_asc() {sort(this->begin(), this->end());}
void sort_dsc() {sort(this->begin(), this->end(), greater<T>());}
friend ostream& operator<<(ostream& out... | ALGO | 0.999661 | 4.055248 |
b10a26b5-7925-4d19-96d6-ae46bb829d43 | adi8900/native- | cmds/installd/otapreopt.cpp | #include <algorithm>
#include <inttypes.h>
#include <limits>
#include <random>
#include <regex>
#include <selinux/android.h>
#include <selinux/avc.h>
#include <stdlib.h>
#include <string.h>
#include <sys/capability.h>
#include <sys/prctl.h>
#include <sys/stat.h>
#include <android-base/logging.h>
#include <android-base... | TOOL | 0.954944 | 7.528074 |
7ef01d3d-c6cb-40ee-9b5b-f52fb38369d5 | haopham24/CTDL-GT2021 | CTDL_dem_so_thanh_phan_lien_thong.cpp | #include <bits/stdc++.h>
using namespace std;
bool ktra[1100];
vector<vector<int> > G(1100);
void dfs(int u)
{
ktra[u]=1;
for(int i=0;i<G[u].size();i++)
{
int v=G[u][i];
if(ktra[v]==0)
{
dfs(v);
}
}
}
int main()
{
int t; cin >> t;
while(t--)
{
int V,E;
cin>>V>>E;
G.resize(0);
G.resize... | ALGO | 0.999879 | 4.724301 |
c8c0d6bc-23d1-4080-9daa-48c079ae7650 | rakibul-wdp/phitron | basic-data-structures/module-23_stl-priority-queue-map-set/23-3_custom-compare-class/again_custom_compare.cpp | #include <bits/stdc++.h>
using namespace std;
class Student
{
public:
string name;
int roll;
int marks;
Student(string name, int roll, int marks)
{
this->marks = marks;
this->roll = roll;
this->name = name;
}
};
class cmp
{
public:
bool operator()(Student a, Student b)
{
if (a.marks > ... | ALGO | 0.999547 | 4.443128 |
5a5d22fc-d7fc-45a8-b93b-66af425a2b87 | 00e3/mrohiobruh | thankyou/naphack/naphack/Utils/Math.cpp | #include "Math.h"
#include "../pandora.hpp"
#include "../SDK/Classes/Player.hpp"
#include "../SDK/variables.hpp"
#include <algorithm>
#include <numeric>
#include <xmmintrin.h>
static Vector DirBetweenLines( const Vector& a, const Vector& b, const Vector& c, const Vector& d ) {
const Vector d1 = ( b - a );
const Vec... | ALGO | 0.986804 | 4.797948 |
26181848-e3b2-478c-a2ee-cacb84454b55 | NanoTcodes/CS254---220001013 | Lab-6/1.cpp | #include<bits/stdc++.h>
using namespace std;
vector<int> topsort(vector<int>adj[],vector<int>indegree,int v){
//bool visited[v];
vector<int>top{};
// for(bool vis:visited){
// vis=false;
// }
queue<int>q;
for(int i=0;i<v;i++){
if(indegree[i]==0){
q.push(i);
}... | ALGO | 0.999995 | 4.971455 |
40ab6e53-c2ea-4f89-9349-d0a21a885f4b | golfrumors/CodeForces | 1300-1399/1335/1335A-CandiesAndTwoSisters.cpp | #include <iostream>
#include <math.h>
using namespace std;
#define int long long
signed main()
{
int t, res = 0; cin >> t;
while(t--)
{
int n; cin >> n;
if(n%2==0){
res = ceil((n/2) - 1);
cout << res << "\n";
}
else{
res = ceil(n/2);
cout << res << "\n";
}
}
}
| ALGO | 0.999363 | 4.611055 |
35cfc1d3-2ed1-4b76-a108-eba1b92d20cc | niharika2k00/Compititive_Programming_and_LeetCode-problem-solutions | Dynamic_Programming/53.maximum-subarray.cpp | // https://leetcode.com/problems/maximum-subarray/
class Solution
{
public:
// Kaldane's Algotithm
int helper1(vector<int> &vec, int len)
{
int currSum = 0, maxSum = 0, count = 0;
// All Negetive elements present in the array [-1] OR [-2,-1]
for (int i = 0; i < len; i++)
... | ALGO | 0.999975 | 5.751454 |
e85102bf-65f3-45f4-b5b5-aedba6c070d3 | raincross7/code-similarity | codes/train_code/problem237/problem237_356.cpp | #include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,n) for(int i=(a); i<(n); i++)
#define all(v) v.begin(), v.end()
#define fi first
#define se second
#define sz(x) int(x.size())
using namespace std;
using ll = long long;
using P = pair<int ,int>;
const int INF = 1001001001;
const int MOD... | ALGO | 0.99992 | 4.340793 |
fcaafbf6-e795-4bcf-8143-3db35f3bf073 | amitpatle10/Problems | At Coder/Contest/begineer 210/A_Cabbages.cpp | #include <iostream>
#include <unordered_map>
#include <unordered_set>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric... | ALGO | 0.994738 | 3.42825 |
46408a4a-8022-4561-9c0d-aaa8a1e1b149 | H-Shen/MyCodeCollection | Kattis/drivingrange.cpp | #pragma GCC optimize("Ofast")
#include <bits/extc++.h>
using namespace std;
using namespace __gnu_pbds;
using ll = long long;
namespace FastIO {
static constexpr int MAXSIZE = 1024 * 1024;
static char inputBuffer[MAXSIZE];
static char *ptr1 = inputBuffer + MAXSIZE;
static char *ptr2 = inputBuffer + M... | ALGO | 0.999753 | 4.614497 |
723f05ce-949e-48a4-a78e-5a44bcca83c3 | MojoisMojo/DSA | C/Sort/sort_box.cpp | #include<bits/stdc++.h>
#define F(i,n,m) for(int i=n;i<=m;i++)//谢谢洛谷大佬@xiangge
using namespace std;
const int BUCKET_NUM = 10;
const int MAXN = 10;
struct ListNode
{
explicit ListNode(int i = 0):mData(i), mNext(NULL) {}
ListNode *mNext;
int mData;
};
ListNode *insert(ListNode *head, int val) {... | ALGO | 0.999849 | 3.921297 |
acd5f4cd-9c91-493b-a5b8-7167c7886152 | ishandutta2007/codeforces | mrkastep/normal/574/A.cpp | #include <stdio.h>
#include <vector>
#include <cstdlib>
#include <map>
#include <time.h>
#include <string>
#include <algorithm>
#include <queue>
#include <assert.h>
using namespace std;
#define For(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define pb push_back
#define mp make_pair
#defin... | ALGO | 0.999341 | 3.671926 |
2eca1aeb-1278-4d3b-ad70-b5c7da62d069 | hynseok/algorithm | legacy/swea/04-05-2.cpp | #ifndef _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
#endif
#include<stdio.h>
#include<bits/stdc++.h>
using namespace std;
#define CMD_MKDIR 1
#define CMD_RM 2
#define CMD_CP 3
#define CMD_MV 4
#define CMD_FIND 5
#define NAME_MAXLEN 6
#define PATH_MAXLEN 1999
#define MAX_NODE 50001
/////////////////////... | ALGO | 0.997383 | 4.023475 |
fda7e1c9-9124-4dd0-b4df-b56340d1261c | nx503a/platform_frameworks_av | media/libstagefright/codecs/mp3dec/src/pvmp3_mdct_6.cpp | /*
------------------------------------------------------------------------------
PacketVideo Corp.
MP3 Decoder Library
Filename: mdct_18.cpp
Date: 09/21/2007
------------------------------------------------------------------------------
REVISION HISTORY
Description:
-------------------------------... | ALGO | 0.999193 | 6.146664 |
6c2194b6-107f-4deb-b992-f46b64ac48af | redoy1102/URI-First-100-Problems-Solution | 1186.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
char O;
double M[12][12], sum = 0, c=0;
cin>>O;
for(int i = 0; i < 12; i++){
for(int j = 0; j < 12; j++){
cin>>M[i][j];
}
}
for(int k = 11; k >= 1; k--){
for(int l = 12-k; l < 12 ; l++){
sum... | ALGO | 0.999228 | 3.366256 |
c6b7e054-1d21-4ded-94ac-e2c661dfac0a | tinatiansjz/algorithm-learning-2019 | codeforces/R531_1102_div3/D.cpp | // https://codeforces.com/contest/1102/standings
// 2019/1/11 10:27
#include <iostream>
#include <cstdio>
#include <vector>
#include <deque>
using namespace std;
int main(){
// freopen("in.txt", "r", stdin);
ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
int n; cin >> n;
string s; cin >> ... | ALGO | 0.999993 | 3.760112 |
3c5ccfc8-2030-47c5-89e2-0c6444153740 | motabarul4199/DSA-PRACTICE | Infix to Postfix Conversion.cpp | #include<iostream>
#include<stack>
using namespace std;
bool isOperator(char c)
{
if(c=='+'||c=='-'||c=='*'||c=='/'||c=='^')
{
return true;
}
else
{
return false;
}
}
int precedence(char c)
{
if(c == '^')
return 3;
else if(c == '*' || c == '/')
return 2;
else if(c == '+' || c == '-... | ALGO | 0.9998 | 4.795938 |
5ec525dd-880d-4f9b-96e5-88b4a1c85910 | Shaf3eii/Problem-Solving-Library | DP_problems/Growing_game.cpp | // ﷽
// وَأَنْ لَيْسَ لِلْإِنْسَانِ إِلَّا مَا سَعَى
// Problem : https://codeforces.com/gym/104375/problem/G
// "From the river to the sea, Palestine is Free"
// Seek knowledge from the Cradle to the Grave.
// Never Give up -- Life is too short to make mistakes and learn from them -- Learn from other... | ALGO | 0.999967 | 3.485416 |
ff02f999-95f2-416e-94ec-5446f6507d95 | figaro-san/competive_programming | atcoder/Coins/Coins.cpp | #include <bits/stdc++.h>
using namespace std;
int main(void) {
int A, B, C, X;
int cnt = 0;
cin >> A >> B >> C >> X;
for (int i = 0; i <= A; i++) {
for (int j = 0; j <= B; j++) {
for (int k = 0; k <= C; k++) {
if ((i*500 + j*100 + k*50) == X) {
cnt++;
}
}
}
}
cout << cnt << endl;
}
| ALGO | 0.995708 | 3.895704 |
59f515e1-3096-4373-9be4-2c6b6ef66f84 | rmallela0426/LeetCodeProblems | Medium/98-ValidateBinarySearchTree.cpp |
/*
* Author: Raghavendra Mallela
*/
/*
* LeetCode 98: Validate Binary Search Tree
*
* Given the root of a binary tree, determine if it is a valid binary search tree (BST).
* A valid BST is defined as follows:
* . The left subtree of a node contains only nodes with keys less than the node's key.
* . The right... | ALGO | 0.999983 | 6.717616 |
450a432b-35be-4422-acb1-a37720809063 | Ewenwan/MVision | opencv_app/Basic/image_Processing/Sobel_ker.cpp | /*
Sobel 算子x方向、y方向导数 合成导数
一个最重要的卷积运算就是导数的计算(或者近似计算).
为什么对图像进行求导是重要的呢? 假设我们需要检测图像中的 边缘 球图像梯度大的地方
【1】Sobel算子
Sobel 算子是一个离散微分算子 (discrete differentiation operator)。
它用来计算图像灰度函数的近似梯度。
Sobel 算子结合了高斯平滑和微分求导。
假设被作用图像为 I:
在两个方向求导:
水平变化: 将 I 与一个奇数大小的内核 G_{x} 进行卷积。比如,当内核大小为3时, G_{x} 的计算结果为:
G_{x} = [-1 ... | ALGO | 0.99625 | 5.598973 |
636ebc63-ae73-46c0-8d32-3a979cfeefa2 | zhuango/leetCode | cppForLeetcode/729_MyCalendarI.cpp | #include <tuple>
#include <vector>
using namespace std;
class MyCalendar {
typedef tuple<int, int> Interval;
private:
vector<Interval> single;
public:
MyCalendar() {
}
bool book(int start, int end) {
int overstart = 0;
int overend = 0;
for (Interval & inter... | ALGO | 0.999947 | 6.067605 |
38f24e08-e0b9-4372-b0d3-78641d2ba754 | tjk922215/LeetCode | container-with-most-water.cpp | class Solution {
public:
int maxArea(vector<int> &height) {
// IMPORTANT: Please reset any member data you declared, as
// the same Solution instance will be reused for each test case.
int lp = 0, rp = height.size() - 1;
int res = 0;
while(lp < rp) {
res = max(res... | ALGO | 0.999904 | 6.54009 |
4698f698-7c84-4920-8054-21c6a4773ee2 | bharatr21/leetcode-problems | 0020-valid-parentheses/0020-valid-parentheses.cpp | class Solution {
public:
bool isValid(string s) {
stack<char> st;
for(char ch: s) {
switch(ch) {
case '{':
case '(':
case '[': {st.push(ch); break;}
case '}': {
if(st.empty() || st.top() != '{') return fa... | ALGO | 0.999006 | 6.406275 |
04a76ca6-ed1e-4b28-a29e-e987cce8f8b5 | muratgorgl/CPlusPlus | 08.arrays/arraysExample2.cpp | #include <stdio.h>
#include <iostream>
using namespace std;
void arrayPlus(int arr[], int size){
for(int i=0 ; i<size ; i++){
arr[i] = arr[i] + 1;
}
}
int main(){
int arr[] = {1,2,3,4,5,6,7};
arrayPlus(arr, 7);
for(int i=0 ; i<7 ; i++){
cout << arr[i] << ", ";
}
} | ALGO | 0.997499 | 3.791263 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.