uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
87ca783a-ab67-412e-a9ea-8e8104559b88 | HYOUNJUNROH/Brachytherapy_qa_1_1_0 | Brachytherapy_qa/opencv/sources/modules/imgproc/src/bilateral_filter.dispatch.cpp | #include "precomp.hpp"
#include <vector>
#include "opencv2/core/hal/intrin.hpp"
#include "opencl_kernels_imgproc.hpp"
#include "bilateral_filter.simd.hpp"
#include "bilateral_filter.simd_declarations.hpp" // defines CV_CPU_DISPATCH_MODES_ALL=AVX2,...,BASELINE based on CMakeLists.txt content
/***********************... | ALGO | 0.994321 | 6.537889 |
7a146cbb-84ea-4b8b-b814-a5eae6423a0e | cpvrlab/SLProject4 | externals/libigl/include/igl/copyleft/marching_cubes.cpp | #include "marching_cubes.h"
#include "marching_cubes_tables.h"
#include <unordered_map>
extern const int edgeTable[256];
extern const int triTable[256][2][17];
extern const int polyTable[8][16];
template <typename DerivedValues, typename DerivedPoints, typename DerivedVertices, typename DerivedIndices, typename Deri... | ALGO | 0.998748 | 7.09467 |
8b64ca46-e292-4321-9f6c-cd76c10ae3a1 | deviant7/SoC-CP | Checkpoint-1/non-neetcode + SoC PS 1/bubsort new.cpp | #include<iostream>
using namespace std;
void bubsort(int a[],int n){
for(int i=n-1;i>0;i--)
for(int j=0;j<i;j++){
if(a[j+1]<a[j]){
int temp=a[j];
a[j]=a[j+1];
a[j+1]=temp;}}}
int main(){
int n; cin>>n;
int a[n];
for(int i=0;i<n;i++)
cin>>a[i];
bubsort(a,n);
for(int i=0;i<n;i++)
cout<<a[i]<<' ';
}
| ALGO | 0.999962 | 4.118036 |
6d4575bd-e0f1-4720-a90d-08c6f0822905 | Manav0111/week3-DP1-CipherSchools | video30/OptimalBinarySearch.cpp | #include <bits/stdc++.h>
using namespace std;
int sum(int freq[], int i, int j);
int optCost(int freq[], int i, int j)
{
if (j < i)
return 0;
if (j == i)
return freq[i];
int fsum = sum(freq, i, j);
int min = INT_MAX;
for (int r = i; r <= j; ++r)
{
int cost = optCost(freq, i, r - 1) +
optCost(fre... | ALGO | 0.999944 | 4.936496 |
2b2ab4a6-daba-4a4e-a122-5d065ae81d29 | CrutoSJ/GFG-Leetcode_CPP-Python | #Leetcode-Daily/846.cpp | // #Question:-
// Link-> https://leetcode.com/problems/hand-of-straights/
// Date - 06/06/24
// #Solution:-
#include<bits/stdc++.h>
using namespace std;
class Solution {
public:
bool isNStraightHand(vector<int>& hand, int gS) {
int n = hand.size();
if(n%gS != 0) return false;
unordered_... | ALGO | 0.999931 | 6.048685 |
e6121aae-cc75-4245-b7d4-c0cc26ed506c | Padm0069/Leetcode-DSA | 0721-accounts-merge/0721-accounts-merge.cpp | class Solution {
public:
vector<vector<string>> accountsMerge(vector<vector<string>>& accounts) {
std::vector<int> parent(accounts.size(), 0);
std::unordered_map<std::string, int> email_id;
// We gather all the e-mails and the group in whick thet belong
// We make groups for... | ALGO | 0.999922 | 6.255063 |
11dbadaa-6998-47fa-8603-88506ba2b6cd | Daipuwei/JianZhiOffer | JZ28-数组中出现次数超过一半的数字/JZ28.cpp | #include <iostream>
#include <vector>
#include <map>
using namespace std;
class Solution {
public:
int MoreThanHalfNum_Solution(vector<int> numbers) {
if(numbers.size() == 0){
return 0;
}
if(numbers.size() == 1){
return numbers[0];
}
map<int,int> Map;
int size = numbers.siz... | ALGO | 0.999848 | 4.330422 |
0a434a23-c6f6-41d4-8b06-b9f926c62502 | CommunicoPublic/iris | tags/iris-0.1.17/tests/ConditionVariableTest.cpp | // C++ Includes
#include "ConditionVariable.hpp"
#include "Debug.hpp"
#include "Mutex.hpp"
#include "STLSstream.hpp"
#include "STLString.hpp"
#include <stdio.h>
#include <string.h>
#include <sysexits.h>
#include <unistd.h>
using namespace IRIS;
#define C_MAX_ITERATIONS 10
#define NOT_READY -1
#define READY 0
... | ALGO | 0.875142 | 5.634593 |
85ecff91-c393-488b-bb40-05b8786dc90b | cloud5252/Addtocart-3 | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998733 | 6.76775 |
605649b1-4646-410d-ab07-e6504191a353 | KamalKumarSahu554/DSA | 06 Bitwise Operators & Data Type Modifiers/03-practice.cpp | #include <iostream>
using namespace std;
// Reverse an intiger
int reverseInt(int num)
{
int reversedNumber = 0;
while (num != 0)
{
int remainder = num % 10;
reversedNumber = (reversedNumber * 10) + remainder;
num /= 10;
}
return reversedNumber;
}
bool powerOfTwo(int num)
{
while (num > 1)
... | ALGO | 0.992936 | 4.81701 |
67938bd7-8c60-4da6-9c8a-9eed3e6cbd8e | Xpccccc/leetcode_library2 | no_525/main.cpp | //
// https://leetcode.cn/problems/contiguous-array/
// 525. 连续数组
class Solution {
public:
int findMaxLength(vector<int>& nums) {
// 前缀和 + 哈希表
// 转化 : 把所有0变为-1
// 找和为0的最长子数组
for (auto& e : nums) {
if (e == 0)
e = -1;
}
int len = 0;
... | ALGO | 0.999937 | 6.157661 |
adc3811d-d7c2-4aa0-8dfa-49ad150df5c7 | ImOBxx/GeeksForGeeks | StructComplexNumbers.cpp | #include <iostream>
using namespace std;
struct complx
{
int real, imag;
};
int main()
{
complx n1, n2, n3;
cout << "Enter Number: ";
cin >> n1.real;
cout << "Enter Number: ";
cin >> n1.imag;
cout << "Enter Number: ";
cin >> n2.real;
cout << "Enter Number: ";
cin >> n2.imag;
... | ALGO | 0.893408 | 3.709199 |
4f3c11f4-6eb5-44bc-a6ee-b73c06ec4a31 | hhhguany/altcoin | src/pubkey.cpp | #include "pubkey.h"
#include "eccryptoverify.h"
#ifdef USE_SECP256K1
#include <secp256k1.h>
#else
#include "ecwrapper.h"
#endif
bool CPubKey::Verify(const uint256 &hash, const std::vector<unsigned char>& vchSig) const {
if (!IsValid())
return false;
#ifdef USE_SECP256K1
if (secp256k1_ecdsa_verify((co... | TOOL | 0.854231 | 6.378423 |
db6bec39-aedd-4d2a-bf5d-65e5040251b2 | ishandutta2007/codeforces | kristevalex/normal/1661/F.cpp | #include <bits/stdc++.h>
using namespace std;
#define FAST ios_base::sync_with_stdio(false); \
cin.tie(nullptr); \
cout.tie(nullptr)
using ll = long long;
using ld = long double;
using uint = unsigned int;
using ull = unsigned long long;
template<typename T>
using pair2 = pai... | ALGO | 0.999964 | 4.234661 |
e890dcff-0c82-4c54-8eca-d182b23fccd5 | caoshen/codehdu | 1054.cpp | /* #1054
dp
dp[r][0] ʾ r Ϊ r ʿ Сֵ
dp[r][1] ǷʿСֵ
dp[r][0] = dp[j][1] j Ϊ r ӽڵ
dp[r][1] = min( dp[j][1],dp[j][0] ) + 1
*/
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cstring>
using namespace std;
const int MAXN = 2000;
vector<int> g[MAXN];
int vis[MAXN], dp[MAX... | ALGO | 0.999668 | 4.608886 |
3a410222-bb77-4706-b3ab-04b11ae5972f | Filikec/competitive-programming | kattis/Anttyping.cpp | #include <iostream>
#include <string>
#include <list>
#include <vector>
#include <set>
using namespace std;
int Count[9][9],First;
long long Best = 10000000;
void getSeconds(vector<int> &num){
int Dist[9][9];
Count[num[0]-1][First-1]++;
for (int i=0;i<num.size();i++){
for (int j=i;j<num.size();... | ALGO | 0.999685 | 3.868352 |
dc58a080-8c64-42f6-8901-f77dff053c85 | Vodyanoy-Q/List | ListMain.cpp | #include <stdio.h>
#include "List.h"
#include "colors.h"
int main()
{
Node * cur = NULL;
AddNode(&cur, 100);
Node * head = cur;
for (int i = 0; i < 10; i++)
{
AddNode(&cur, (i + 2) * 100);
cur = cur->next;
}
Node * ret = 0;
NodeFind(head, &ret, 700);
printf("Node ... | ALGO | 0.994076 | 3.327356 |
40e1a032-767e-4f1d-b810-7b50af294ffe | soyaoki/IntroCarND-Optimize-Histgram-Filter | optimized_code/move.cpp | #include "headers/move.h"
#include "headers/zeros.h"
using namespace std;
// OPTIMIZATION: Pass large variable by reference
vector< vector <float> > move(int dy, int dx,
vector < vector <float> > &beliefs)
{
int height, width;
height = beliefs.size();
width = beliefs[0].size();
vector < vector <float> > newGr... | ALGO | 0.999542 | 4.490115 |
95cefbd5-9549-4864-8705-7e026cc4aa4f | martineidger/Labs_1sem | ОАиП/laba9/zad2/zad2.cpp | #include <iostream>
using namespace std;
int fun(float x);
int main()
{
float a, b, s = 0, h = 0, x = 0, n=200, s1 = 0, s2 = 0, i = 1;
cin >> a >> b;
h = (b - a) / (2 * n);
x = a + 2 * h;
do {
s2 = s2 + (1 + pow(x, 3));
x = x + h;
s1 = s1 + (1 + pow(x, 3));
x = x + h;
i++;
} while (i < n);
s = (... | ALGO | 0.999858 | 4.222764 |
8f8e00cf-de29-4386-b901-db92c607d24c | jereyes4/Wahl_Chains | src/Wahl.cpp | #include"Wahl.hpp" // string, to_string
#include"Searcher.hpp" // Searcher_Wrapper, queue, priority_queue, single_invariant, double_invariant, p_extremal_invariant and their hashes
#include"Algorithms.hpp"
#include<fstream> // ifstream
#include"Writer.hpp" // export_jsonl, less_by_n, less_by_length, stable_sort
#ifdef... | TOOL | 0.984177 | 3.951389 |
d46551f4-bf0a-4062-8bf7-6875f3d798eb | timprepscius/GeometricTools | WildMagic5/LibMathematics/Containment/Wm5ContEllipsoid3.cpp | #include "Wm5MathematicsPCH.h"
#include "Wm5ContEllipsoid3.h"
#include "Wm5ApprGaussPointsFit3.h"
#include "Wm5Quaternion.h"
namespace Wm5
{
//----------------------------------------------------------------------------
template <typename Real>
Ellipsoid3<Real> ContEllipsoid (int numPoints, const Vector3<Real>* points... | ALGO | 0.999672 | 6.859686 |
a3590b6a-24f3-4356-b91b-2f86fbc8ecfe | j42xiong/Competitive-Programming | DMOJ/VM7WC '16 #3 Gold - Hello, Officer./VM7WC '16 #3 Gold - Hello, Officer./main.cpp | #include <bits/stdc++.h>
using namespace std;
#define scan(x) do{while((x=getchar())<'0'); for(x-='0'; '0'<=(_=getchar()); x=(x<<3)+(x<<1)+_-'0');}while(0)
char _;
#define pb push_back
#define MOD 1000000007
#define MAXN 1000
#define INF 0x3f3f3f3f
typedef pair<int, int> pii;
typedef long long ll;
typedef unsigned l... | ALGO | 0.999915 | 4.590079 |
9beea46b-5590-40d0-813d-c1b00d762771 | ravigod22/CompetitiveProgrammingUNI | Codeforces/2009/b.cpp | #include <bits/stdc++.h>
using namespace std;
const int maxn = 500 + 5;
char grid[maxn][maxn];
int n;
void solve() {
cin >> n;
vector<int> ans;
for (int i = 0; i < n; ++i) {
for (int j = 0; j < 4; ++j) {
cin >> grid[i][j];
}
}
for (int i = 0; i < n; ++i) {
for (i... | ALGO | 0.999794 | 4.792462 |
0fce2f54-bd00-411a-a9c5-5d73088b3397 | Zengrane/ardupilot | libraries/Filter/SlewCalculator2D.cpp | /*
The SlewCalculator2D filter calculates a slew rate useful for detecting
oscillations in a 2-axis PID controller.
*/
#include "SlewCalculator2D.h"
SlewCalculator2D::SlewCalculator2D() :
xlimiter(slew_rate_max, slew_rate_tau),
ylimiter(slew_rate_max, slew_rate_tau)
{
}
// apply filter to sample and calc... | TOOL | 0.963304 | 6.608823 |
df8538fb-436f-4d06-8ff5-7ae64eebb438 | ViswesB/AlgorithmsWS | ShortestPathInBinaryMatrix.cpp | /*
1091. Shortest Path in Binary Matrix
Medium
Given an n x n binary matrix grid, return the length of the shortest clear path in the matrix. If there is no clear path, return -1.
A clear path in a binary matrix is a path from the top-left cell (i.e., (0, 0)) to the bottom-right cell (i.e., (n - 1, n - 1)) such that:... | ALGO | 0.999975 | 6.428907 |
4d2dc8bc-da06-4eaa-aaf3-3aff43600844 | summer1210/DSA | 232-implement-queue-using-stacks/232-implement-queue-using-stacks.cpp | class MyQueue {
public:
stack<int> s1;
stack<int> s2;
/** Initialize your data structure here. */
MyQueue() {
}
void push(int x) {
while(!s1.empty()) {
s2.push(s1.top());
s1.pop();
}
s2.push(x);
while(!s2.empty()) {
... | ALGO | 0.999189 | 5.524436 |
4ebb7d48-b8f1-471e-8c6b-f40fdcf91110 | Jbernardiss/codeStylometryResearch | data/dataset-v2/molamola/molamola-a1-2021-worldFinals.cpp | #include <bits/stdc++.h>
using namespace std;
#define Fi first
#define Se second
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define szz(x) (int)(x).size()
#define rep(i, n) for(int i=0;i<(n);i++)
typedef tuple<int, int, int> t3... | ALGO | 0.999818 | 3.520312 |
aca25411-97aa-44e9-a222-e7f920ae6116 | ishandutta2007/codeforces | meaningiess/normal/1076/E.cpp | #include<iostream>
#include<cstring>
#include<cstdio>
#include<vector>
#define ll long long
#define N 300010
using namespace std;
ll c[N],a[N];int n;
struct fck{int a,b;};vector<fck> v[N];
int nxt[N<<1],fir[N<<1],to[N<<1],cnt,dep[N];
void lnk(int u,int v) {nxt[++cnt]=fir[u],fir[u]=cnt,to[cnt]=v;}
void add(int x,int k){... | ALGO | 0.999968 | 3.764699 |
a4e184a7-8bc7-4d4d-a809-9285e7c79fd3 | zrss/LeetCode | CombinationSumIII.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
class Solution {
public:
vector<vector<int>> combinationSum3(int k, int n) {
vector<vector<int>> rel;
if (k == 0) {
return rel;
}
int curSum = 0;
vector<int> tmp;
aux(k, n, 1... | ALGO | 0.999893 | 6.054328 |
0c23e9c2-d4b3-41dd-bc46-d9b1ac8dad1f | kewal-godhane/cpp-dsa | 6_function/5_check_pythagorian_triplet.cpp | #include<iostream>
#include<cmath>
using namespace std;
bool triplet(int p,int h,int b)
{
int a,x,y;
a=max(h,max(p,b));
if(a==p)
{
x=h;
y=b;
}
else if(a==h)
{
x=p;
y=b;
}
else
{
x=h;
y=p;
}
if(a*a==(x*x)+(y*y))
{
... | ALGO | 0.999177 | 3.71421 |
01da4001-568f-46c3-9047-387ea071d1a5 | pdet/cqc | 2020/Nov/27-nov/predatory-butterflies.cpp | #include <cassert>
#include <vector>
#include <iostream>
#include <fstream>
#include <chrono>
using namespace std;
using namespace chrono;
//! Complete the activity_notifications function below.
int activity_notifications(vector<int>& expenditure, int d) {
int notifications = 0;
const int half_d = d >> 1;
const... | ALGO | 0.993243 | 5.66059 |
c5fe718e-9273-49e8-afd6-f94df8d8b472 | ShivaanjayNarula/LeetCode | 0020) Valid Parentheses.cpp | class Solution {
public:
bool isValid(string s) {
stack<char> ans;
int n = s.size();
int i = 0;
while(i < n)
{
if(s[i] == ')' && ans.size() > 0 && ans.top() == '(')
{
ans.pop();
}
else if(s[i] == '}' && ans.size(... | ALGO | 0.997867 | 6.332953 |
0a309eb2-c85d-4d82-b6a6-ebf8880b5438 | jeevan01/python-extra-class | opencv/modules/video/src/bgfg_gaussmix2.cpp | /*//Implementation of the Gaussian mixture model background subtraction from:
//
//"Improved adaptive Gaussian mixture model for background subtraction"
//Z.Zivkovic
//International Conference Pattern Recognition, UK, August, 2004
//http://www.zoranz.net/Publications/zivkovic2004ICPR.pdf
//The code is very fast and per... | ALGO | 0.982669 | 6.469879 |
691b637e-2bcc-46df-b067-87d0021144ee | truEngineer/made_ads | week10/task_C.cpp | #include <iostream>
#include <algorithm>
#include <vector>
std::vector<std::vector<int>> adj_list;
std::vector<int> color;
std::vector<int> answer;
bool cycle;
void dfs(int v) {
if (color[v] == 2) {
return;
}
color[v] = 1;
for (int u : adj_list[v]) {
if (color[u] == 1) {
... | ALGO | 0.999988 | 4.551298 |
42a9b670-a572-4ab4-a3ea-d2734564c633 | AnasAbdullh/Soultions_ProblemsAndSolving_Level1 | 040.cpp | #include <iostream>
#include <cmath>
using namespace std;
float ReadPositiveNumber(string Message)
{
float Number = 0;
do
{
cout << Message << endl;
cin >> Number;
} while (Number <= 0);
return Number;
}
float TotalBillAfterServiceAndTax(float TotalBill)
{
TotalBill = TotalBill... | TOOL | 0.910118 | 3.867129 |
c74667c6-2296-4cbd-ad79-87bef9cd4242 | kevinforsterch/Unicoin | src/pubkey.cpp | #include <pubkey.h>
#include <secp256k1.h>
#include <secp256k1_recovery.h>
namespace
{
/* Global secp256k1_context object used for verification. */
secp256k1_context* secp256k1_context_verify = nullptr;
} // namespace
/** This function is taken from the libsecp256k1 distribution and implements
* DER parsing for EC... | TOOL | 0.934627 | 7.37433 |
b7476c41-b4d0-4e0a-938d-3320d27b7bb8 | Md-Ikbal-Hasan/10_Problem_Solving_Code | 11_Data structure and Algorithm/5inserting_node_at_the_end_single_linkedlist.cpp | #include<bits/stdc++.h>
using namespace std;
struct node{
int data;
struct node *link; //self referential structure
};
void add_at_end(struct node *head, int data)
{
struct node *ptr, *temp;
ptr = head;
temp = (struct node*)malloc(sizeof(struct node));gf
temp->data = data;
temp->link = NULL;
whil... | ALGO | 0.998909 | 3.556553 |
dc38ab49-8037-4a06-a626-b8141e02f046 | 082-Rishikant/DSA-NITT | DP by Aditya verma/1_V1_Subset_Sum.cpp | #include<iostream>
#include<vector>
using namespace std;
vector<vector<bool>> t(1001, vector<bool>(1001, false));
bool subsetSum(int arr[], int n, int s)
{
for (int i = 0; i <= n; i++)
for (int j = 0; j <= s; j++)
if(j==0)
t[i][j]=true;
else if(j!=0 || i==0)
... | ALGO | 0.999874 | 4.344964 |
ea07b8b8-e070-43cf-a30c-1a4e77ba5600 | aru01/graphs | H_zadacha.cpp | #include <iostream>
using namespace std;
int n,m, x,y, a[1000][1000];
int main() {
cin>>n>>m;
for(int i=0; i<m; i++)
{
cin>>x>>y;
a[x][y]=1; // отличие от неоритированного - ток один вариант без зеркальности
}
for(int i=1; i<=n; i++) //пробегаемся по ... | ALGO | 0.999896 | 3.393998 |
26957746-fe0e-41b5-bdeb-349c1f8d49ad | zakariaCHOUKRI/CPP-CP | 2024/cses dp/Counting Towers.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 1e9 + 7;
ll t, n, small, big, small_temp, big_temp;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);cout.tie(0);
cin >> t;
while (t--) {
cin >> n;
small = 1;
big = 1;
for ... | ALGO | 0.999824 | 4.479928 |
42433c30-febe-442c-b790-2357d03f0619 | nadimmorol890/XPSC | Week 10/Super Zone/Day 2/E_Interesting_Subarray.cpp | #include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(NULL);
ll t;
cin >> t;
while (t--) {
ll n;
cin >> n;
vector<ll> a(n);
for (ll i = 0; i < n; i++) {
cin >> a[i];
}
bool f... | ALGO | 0.999561 | 3.597228 |
4639a24d-642b-4738-a5f1-5d6068ba98df | miyatis/atcoder | arihonn/3_1/test2.cpp | // #include <bits/stdc++.h>
#include <stdlib.h>
#include <stdio.h>
#include <iostream>
#include <cmath>
#include <atcoder/all>
#include <set>
#include <map>
#include <atcoder/all>
#include <unordered_map>
#include <unordered_set>
using namespace std;
using namespace atcoder;
using mint = modint998244353;
#define rep(i... | ALGO | 0.99989 | 3.970913 |
276c3a1a-d673-4382-9cc7-f037a042e127 | jonathanirvings/toki-open-2018 | toki-open-2018-group/grader_server.cpp | #include "group.h"
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <istream>
#include <vector>
static void wrongAnswer() {
puts("WA");
exit(0);
}
int main() {
int N;
if (scanf("%d", &N) != 1) {
wrongAnswer();
}
std::vector<int> X(N), Y(N);
for (int i = 0; i < N; ++i) {
if (... | ALGO | 0.999304 | 4.092696 |
735bd821-c601-43b1-8183-26bf68fc0e85 | tech-saurabh382/Dsa-Suprem-2.0 | Char Arrays & Strings/Class-1/Length_Of_String.cpp | #include <iostream>
#include <string.h>
using namespace std;
int findLength(char ch[], int size)
{
int index = 0;
while (ch[index] != '\0')
{
index++;
}
return index;
// int length = 0;
// for (int i = 0; i < size; i++)
// {
// if (ch[i] == '\0')
// {
// ... | TOOL | 0.968151 | 3.441567 |
f13ad06e-0e11-4eff-9731-f1e96de6044c | youyc22/data-and-alagorithm | oj2-军训排队/oj2-yyc.cpp | //用两个数组模拟双向链表
#include"stdio.h"
#pragma warning(disable:4996)
int main()
{
int N = 0;
int j = 0;
int a[3] = { 0 };
int next[100000] = { 0 };
int prev[100000] = { 0 };
next[0] = 1;
prev[0] = -1;
next[1] = -1;
prev[1] = 0;
scanf("%d", &N);
while (N--)
{
scanf("%d", &a[0]);
switch (a[0])
{
case 1:
... | ALGO | 0.999994 | 3.961118 |
07e8e866-fcfb-4508-b5d9-2ff5eb76a4b5 | shareone2/HaiZeiOJ | 159打印图形三.cpp | #include <iostream>
using namespace std;
int main() {
char c;
cin >> c;
for (int i = 0; i <= (int)c - 'A'; i++) {
for (int j = 0; j < i; j++) {
cout << ' ';
}
cout << (char)((int)c - i);
for (int j = (int)c - i - 1; j >= 'A'; j--) {
cout << (char)j;
... | ALGO | 0.999544 | 3.871068 |
2aefbb64-d587-444c-9a7a-f3d0fe9aafba | biplob-kb/Basic-data-structures | Week-05/Module-17(Binary Tree Implementation)/create_binary_tree.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;
}
};
int main()
{
Node *root = new Node(10);
Node *a = new Node(20);
Node *b = new Node... | ALGO | 0.999124 | 3.127349 |
ad77aaa9-bda4-412b-9bc5-6a412e48f34e | slowy07/software-engineer-cheatsheet | dsa/dsa/array/cpp/search_element.cpp | #include <iostream>
using namespace std;
int search(int arr[], int n, int x) {
for(int i = 0; i < n; i++) {
if (arr[i] == x)
return i;
}
return -1;
}
int main() {
int arr[] = {30, 50, 40, 5, 12, 222}, x= 12;
cout<<"search index "<<search(arr, 4, x);
} | ALGO | 0.998916 | 4.777041 |
c169b68f-1125-47a7-b876-52a54aa6e1d5 | Dudeslam/ERTS | Project/Convolution_IP.prj/conv_2d.cpp | #include "conv_2d.h"
bool borders_ok(int y, int x){
return (0 < y && y < HEIGHT && 0 < x && x < WIDTH);
}
// Defines the actual calculation for one output value.
template <int ROW, int COLUMN>
int convolution_step(data_t (&window)[ROW][COLUMN], int y, int x, int (&kernel)[ROW][COLUMN]){
#pragma HLS INLINE
int resul... | ALGO | 0.998728 | 4.279138 |
7e51fdc1-1a57-4b65-a78b-6b142b391acc | pouriaafshari/Contests-CPP | Atcoder BC 204/B.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
int ans = 0;
cin >> N;
for (int i = 0; i < N; i++) {
int T;
cin >> T;
if (T > 10) {
ans += T - 10;
}
}
cout << ans;
}
| ALGO | 0.999442 | 3.928083 |
753726a7-1962-46c1-8624-9b3b89377a0f | raghuvanshraj/Competitive-Programming-Archive | Coding Ninjas/magic_grid.cpp | #include <bits/stdc++.h>
using namespace std;
int magicGrid(int **input, int r, int c)
{
int **energy = new int*[r];
for(int i = 0; i < r; i++)
{
energy[i] = new int[c];
}
energy[r-1][c-1] = 1;
for(int i = r-2; i >= 0; i--)
{
energy[i][c-1] = 0-input[i][c-1]+energy[i+1][c-1];
if(energy[i][c-1] <= 0)
{... | ALGO | 0.999754 | 4.419838 |
0d9d21b7-52c2-46b8-98bf-9a7b66d836a0 | panditakshay402/Hacktoberfest | C++/Equilateral_Algorithm.cpp | // Explanation:
// Include the necessary header file <bit/stdc++.h> to enable input and output operations.
// Create the main function, the entry point of the program.
// Declare three variables (side1, side2, and side3) to store the lengths of the three sides of the triangle.
// Prompt the user to input the length... | ALGO | 0.999511 | 5.775734 |
19d52efc-2ec2-4ec0-b030-41410ca890df | Tinky1224/CppLearning | codeforces/cf_479A.cpp | #include <iostream>
#include <algorithm>
int main(){
int a, b, c;
std::cin >> a >> b >> c;
std::cout << std::max({a+b+c,a*b*c,(a+b)*c,a*(b+c)}) << std::endl;
return 0;
} | ALGO | 0.999645 | 4.214008 |
f1758844-216a-475a-a980-c1254d8d1418 | human88/terracoin | src/rpcblockchain.cpp | #include "main.h"
#include "bitcoinrpc.h"
using namespace json_spirit;
using namespace std;
void ScriptPubKeyToJSON(const CScript& scriptPubKey, Object& out);
double GetDifficulty(const CBlockIndex* blockindex)
{
// Floating point number that is a multiple of the minimum difficulty,
// minimum difficulty = 1... | WEB | 0.892883 | 6.565449 |
6e748406-6727-468e-8719-683fc05a9bc1 | WS-only/code | test/test2.cpp | /*
룬в
*/
#include<iostream>
#include<fstream>
#include<iomanip>
using namespace std;
#define M 20000
//µʸ
typedef struct
{
char danci[19];//浥??
int count;//¼ʸ,ּ??
}sq;
int main()
{
sq word[M];
sq t_word;
int K,n=0,i,j;
FILE *fp;
char ch;
fp=fopen("E://1ѧϰ////㷨//ʵ//input.dat","r");//ȡļ... | ALGO | 0.998887 | 3.097774 |
6dbcf5e7-9c78-4730-af12-7346d5dd6c57 | harpreet-22/DSA-450-Questions | Arrays/29_TrappingRainWater.cpp | class Solution {
public:
int trap(vector<int>& height) {
//Two Pointer Approach
int left = 0;
int right = height.size() -1;
int left_max = 0, right_max =0, ans =0;
while(left < right){
if(height[left] < height[right]){
height[left] >= left_max ... | ALGO | 0.999972 | 6.843637 |
cdf7602b-5117-4518-ae01-e347f6de8548 | ctyVegetableDog/leetcode | helloLeet/0084.cpp | //dp[left] and dp[right] (good ques)
class Solution {
public:
int largestRectangleArea(vector<int>& heights) {
if (heights.empty()) return 0;
int sz = heights.size();
vector<int> left(sz, -1);
vector<int> right(sz, -1);
left[0] = -1;
right[sz - 1] = sz;
for (... | ALGO | 0.999947 | 6.421597 |
271c612a-aa2c-44e7-9799-3a0b177617d6 | nilesh7757/CodeForces-Solution | 579A - Raising Bacteria.cpp | #include<bits/stdc++.h>
using namespace std;
// Binary Representation of
// 𝑥
// =
// 536870911
// x=536870911:
// 11111111111111111111111111111
// (
// 29 ones in total
// )
// 11111111111111111111111111111(29 ones in total)
// Each
// 1
// 1 in the binary representation corresponds to adding a bacterium to cover a... | ALGO | 0.999968 | 5.458528 |
b8d2fb7c-a5c0-4541-867b-98f4450e11d8 | donghancheng85/Hancheng_Code_Repo | Design_Patterns_in_Modern_CPP/Behavior_Patterns/Template/template_pattern_exercise.cpp | #include <iostream>
#include <vector>
#include <complex>
#include <tuple>
using namespace std;
struct Creature
{
int attack, health;
Creature(int attack, int health) : attack(attack), health(health) {}
};
struct CardGame
{
std::vector<Creature> creatures;
CardGame(const std::vector<Creature> &creatu... | ALGO | 0.999557 | 4.905772 |
5d801713-8801-4b25-9935-992603c2314f | c3df321a/QUT_Data_Structure | DataStructHomeWork/project3/Bitree/Bitree.cpp | //BiTree.cpp
#include"BiTree.h"
#include"Queue.cpp"
#pragma once
template <class DataType>
BiTree<DataType>* BiTree<DataType>::CreatTree()
{
DataType Data;
BiTree* Leaf = new BiTree;
std::cin >> Data;
if (Data == '#')
{
Leaf = nullptr;
}
else
{
Leaf->m_Data = Data;
... | ALGO | 0.999626 | 3.887337 |
1c53a1bd-0821-4de2-9e97-93ba946b3118 | reviczky/webkit-bti | Source/WebCore/Modules/webaudio/RealtimeAnalyser.cpp | #include "config.h"
#if ENABLE(WEB_AUDIO)
#include "RealtimeAnalyser.h"
#include "AudioBus.h"
#include "AudioNode.h"
#include "AudioUtilities.h"
#include "FFTFrame.h"
#include "VectorMath.h"
#include <JavaScriptCore/Float32Array.h>
#include <JavaScriptCore/Uint8Array.h>
#include <algorithm>
#include <complex>
#inclu... | TOOL | 0.880659 | 7.405349 |
92165a60-1514-44cc-9e07-e524b36c4079 | FduAruba/AtmoModel | src/commfun.cpp | #include "commfun.h"
/* string */
extern void modifyPath(IO char* src)
{
trimSpace(src);
cutSep(src);
}
extern void trimSpace(IO char* src)
{
int i = 0, ps = 0, pe = 0;
int len = (int)strlen(src);
char str[MAXCHARS + 1] = { '\0' };
if (len <= 0) { return; }
strcpy(str, src);
for (i = 0, ps = 0; i < len; i++... | TOOL | 0.990496 | 3.557345 |
d0e6e564-67b3-4461-973b-901fe9d8a060 | aman1-2/Programming-Pratice | C++ Programs/7 Functions/9_Assign_Ques3.cpp | /*
Question 3 : Write a function which takes 2 numbers as parameters (a & b) and
outputs : a^2 + b^2 + 2*ab.
*/
#include<iostream>
using namespace std;
void function(int a, int b){
cout<<a*a<<"+"<<b*b<<"+"<<2*a*b;
return;
}
int main(){
int a,b;
cout<<"a = ";
cin>>a;
cout<<"b = ";
cin>>... | ALGO | 0.995432 | 3.906428 |
8d8f8a00-1a6b-4f6a-88d0-fdc7cef746ba | ishandutta2007/codeforces | pavelkunyavskiy/normal/43/B.cpp | #include <iostream>
#include <fstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <ctime>
#include <set>
#include <map>
#include <vector>
#include <string>
#include <deque>
#include <queue>
#include <stack>
#include <algorithm>
#define mp make_pair
#define pb push_back
using nam... | ALGO | 0.999945 | 3.456043 |
e16eb2ce-9e7a-4fae-a2b1-8154cbf67211 | Ayusohm432/Coding | ProblemOfTheDay/Geeksforgeeks/10.11.2024_Union of Two Sorted Arrays with Distinct Elements.cpp | /*
Problem Link : https://www.geeksforgeeks.org/problems/union-of-two-sorted-arrays-with-distinct-elements/1
*/
/*Union of Two Sorted Arrays with Distinct Elements
Given two sorted arrays a[] and b[], where each array contains distinct elements , the task is to return the elements in the union of the two arrays in so... | ALGO | 0.999933 | 5.588302 |
12671691-a412-455d-8324-c64dfa88372a | tushar6263/Data-Structure-and-Algorithm-Problems- | LEETCODE-QUESTIONS/fibonacci.cpp | // Question link:-https://leetcode.com/problems/fibonacci-number/description/
// Solution:-
//class Solution {
// public:
// int fib(int n) {
// if(n==0){
// return 0;
// }
// else if(n==1){
// return 1;
// }
// el... | ALGO | 0.999991 | 6.341249 |
4516e0eb-930d-4e80-8366-042495eee855 | anon-iiswc24/LLMServingSim | astra-sim/extern/network_backend/ns3/astra-sim/extern/network_backend/garnet/gem5_astra/src/systemc/tests/systemc/misc/user_guide/chpt10.1/paramadd.cpp | /*****************************************************************************
paramadd.cpp --
Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
*****************************************************************************/
/***************************************************************************... | ALGO | 0.983864 | 5.820003 |
44204028-4c5d-4236-a762-af26e45ea89a | SyedHanzalaAli/OOP | OOP LAB/LAB 01/01.cpp | // Write a C++ program to check whether a given number is prime or not. Allow the user to input a
// number and display whether it's prime or not?
#include <iostream>
using namespace std;
int main()
{
int n;
bool isPrime = true;
cout << "enter a number ";
cin >> n;
if (n <= 1)
{
cout ... | ALGO | 0.996366 | 3.630677 |
1c5e969f-8b5b-4afb-b6a1-5f3d042c7812 | g11002/cpp_practice_dsa | matrix/matrix2.cpp | #include <iostream>
using namespace std;
const int R = 4, C = 4;
void bTraversal(int mat[R][C])
{
if(R == 1)
{
for(int i = 0; i < C; i++)
cout << mat[0][i] << " ";
}
else if(C == 1)
{
for(int i = 0; i < R; i++)
cout << mat[i][0] << " ";
}
else
{
for(int i = 0; i < C; i++)
cout << mat[0][i] << " ... | ALGO | 0.99995 | 3.879439 |
5a254a9e-a0f7-496b-90d0-cd3b3bacb935 | vijaymanikantareddy/LeetCode_GFG_solved | 1889-check-if-number-is-a-sum-of-powers-of-three/1889-check-if-number-is-a-sum-of-powers-of-three.cpp | class Solution {
public:
bool checkPowersOfThree(int n) {
while(n > 1){
if(n%3 == 2) return false;
n /= 3;
}
return true;
}
}; | ALGO | 0.999479 | 5.766915 |
ca07e2c8-02e2-41c8-bd57-08fe1b6785d9 | hrefjeff/gantt | process.cpp | /****************************************************
Names : Jeffrey Allen
Date : CS420 Spring 2014
Assignment : Assignment 11, Group 3
Description :
Due Date: November 20, 2012
*****************************************************/
#include "process.h"
using namespace std;
Process... | TOOL | 0.903508 | 3.639498 |
c19c478a-db78-4065-892f-d54926385e1b | Shivam-officials/DSA-supreme-3.0 | 5.Char Array And String/Lecture 2/6. minimumTimeDifference.cpp | // https://leetcode.com/problems/minimum-time-difference/description/
#include <algorithm>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
// Converts a time in "HH:MM" format to total minutes since 00:00
int hourToMinutes(string &time) {
int h1 = s... | ALGO | 0.998879 | 6.716619 |
b454b2f7-d728-483f-b0c8-ba556ec8bf42 | amirbarda/ShellFEM | include/igl/AtA_cached.cpp | #include <iostream>
#include <vector>
#include <utility>
template <typename Scalar>
IGL_INLINE void igl::AtA_cached_precompute(
const Eigen::SparseMatrix<Scalar>& A,
igl::AtA_cached_data& data,
Eigen::SparseMatrix<Scalar>& AtA)
{
// 1 Compute At (this could be avoided, but performance-wise it will not ma... | ALGO | 0.999405 | 5.413241 |
25bdfd49-aaae-494b-a298-7c140d2f6876 | omkaranu04/CP_DSA | CP Conclave IITM/PS4/p3.cpp | #include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[])
{
int n, k, count = 0;
cin >> n >> k;
int a[n];
for (int i = 0; i < n; i++)
{
cin >> a[i];
}
for (int i = 0; i < n; i++)
{
if (a[i] >= a[k - 1] && a[i] > 0)
count++;
}
... | ALGO | 0.99994 | 3.732218 |
8fb5710e-2e9d-4f6f-b075-cdf1574f7eca | KartikKoli/DSA | BST/recursive_search.cpp | #include<iostream>
using namespace std;
class node{
public:
int data;
node* left;
node* right;
node(int key){
data=key;
left=NULL;
right=NULL;
}
};
bool search(node* root,int key){
if(root==NULL) return false;
else if(root->data==... | ALGO | 0.999957 | 4.999942 |
961f5bf2-cc7f-4402-820d-e35676a8124f | ChouGiGiNYCU/LDPC | BP_EachPCM/CBP.cpp | #include<iostream>
#include<fstream>
#include<cmath>
#include<ctime>
#include<stdlib.h>
#include<stdio.h>
#include<string>
#include "random_number_generator.h"
#include "UseFuction.h"
#define frame_error_lowwer_bound 400
double phi(double x){
double yy = tanh(x / 2);
if (fabs(yy) < 1e-14)
yy = 1e-14;
... | ALGO | 0.999038 | 3.758747 |
4e39faef-558d-42e2-8438-7fbefd602329 | pioui/algorithms_ece | LabExercise2/kcredits/1credits.cpp | #include <iostream>
#include <vector>
#include <algorithm>
// Binary search left is always -1
int BSIndexLIS(std::vector<int>& v, int right, int value)
{
int left=-1;
while (right - left > 1)
{
int mid = left + (right - left)... | ALGO | 0.99995 | 4.331485 |
90f1e823-1751-4d3c-937f-f4ef89dd48b2 | ANONDO1250/Data_STRUCTURE_IN_CPP | Unique_Sorted.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
// Take input of the test caase
int lol;
cin >> lol;
while (lol--)
{
// create the set
set<int> st;
// creater the priority_queue
priority_queue<int> pq;
// Take input
int n;
cin >> ... | ALGO | 0.999921 | 5.120633 |
b8c40d51-2465-4aac-955d-fc80ac8371dd | 44kemox44/Circuit_Lib | src/Circuit.cpp | #include "Circuit.h"
#include <limits> // Ensure this is included
const double INF = 1e9; // Define a large constant to represent "infinity"
void Circuit::connect(int node1Idx, int node2Idx, std::shared_ptr<CircuitComponent> component) {
connections[node1Idx][node2Idx].push_back(component);
}
double Circuit::cal... | ALGO | 0.99954 | 6.078255 |
074f9aea-036b-4418-80cd-f74f1503b40b | XAlearnerer/LeetCode | 1-100/81.SearchInRotatedArray2_旋转数组的查找.cpp | //
// Created by zhao on 18-11-24.
//
#include <iostream>
#include <vector>
using namespace std;
class Solution {
public:
bool search(vector<int>& nums, int target) {
int left = 0, right = nums.size() - 1;
while (left <= right)
{
int mid = (left + right) / 2;
if (nu... | ALGO | 0.999963 | 5.931297 |
fc09fce0-6d40-4164-a086-069db493d1ba | apaarkamal/LPU_10Jan | multisource_example_maze_landmine.cpp | #include<bits/stdc++.h>
#define int long long int
using namespace std;
#define db(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) { cout << name << " : " << arg1 << '\n'; }
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&.... | ALGO | 0.999785 | 4.410942 |
eaa51f2b-8e79-49ef-bebc-aff735ef4025 | jaesunglee9/acmicpc | 01149.cpp | // template for competitive programming
// also don't forget cout << '\n'
// don't use c style input
#include <bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n; cin >> n;
vector<int> r(n);
vector<int> g(n);
vector<int> b(n);
for (int i = 0; i < n; i++) ... | ALGO | 0.998523 | 4.595441 |
7c805139-0a4d-4a55-81e5-7f794bfa8b42 | Dashbah/Algorithms_2 | semester1/contest_dop/main.cpp | #include <iostream>
#include <vector>
#include <cmath>
// здесь корневая декомпозиция не совсем подходит(или вовсе), так как
// массив постоянно изменяется
enum operation { sum, xor_ };
class Structure {
private:
std::vector<int> vector_;
// size_t size;
std::vector<int> sqrt_vec_;
operation op_;
... | ALGO | 0.999188 | 5.491019 |
d2a5740e-90b8-4cad-91bd-a0380f3c74cb | mrcouts/Nyquist-Attack | MOD/StopBandMatched/StopBandFilter/src/StopBandFilter.cpp | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <lv2.h>
#include "MatchedFilters.h"
/**********************************************************************************************************************************************************/
#define PLUGIN_URI "http://portalmod.co... | TOOL | 0.869073 | 4.998872 |
a2e30075-cc64-4e65-b3eb-fea75615eacd | Rohit-Yadav-47/DSA-Questions | wave array.cpp | for(int i=0;i<n;i=i+2){
if(i%2==0){if(arr[i+1]>arr[i])swap(arr[i+1],arr[i]);}
else{if(arr[i+1]<arr[i])swap(arr[i+1],arr[i]);}
}
//also works because sorted
for(int i=0;i<n;i=i+2){if(i==n-1) break;
swap(arr[i],arr[i+1]);}
| ALGO | 0.999846 | 3.661703 |
66ab95cd-1388-4d9f-b659-69530b1b644c | fish47/leetcode | src/010_regular-expression-matching.cpp | #include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
class Solution
{
private:
class RegexPiece
{
private:
char m_chPieceChar;
char m_chQuantity;
public:
static const char kCharWildCard = '.';
static const char kChar... | ALGO | 0.998951 | 5.501933 |
485f3013-eec8-4f05-a79c-a0978dd1194e | ayush0211-block/cpp | Alice_and_Marks.cpp | #include <bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int x,y;
cin>>x>>y;
if(x/y==2){
cout<<"Yes"<<endl;
}
else{
cout<<"No"<<endl;
}
return 0;
} | ALGO | 0.999718 | 3.335584 |
57555aa2-917d-4861-805d-de5705dc8a47 | SaqlainAveiro/Competitive-Programming-Solves | CodeForces/Adjacent Replacements.cpp | #include<bits/stdc++.h>
using namespace std;
#define FastIO ios_base :: sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define read(in) freopen("Input.txt","r",stdin)
#define write(out) freopen("Ouput.txt","w",stdout)
#define pf printf
#define sf scanf
#define fr(i,n) for(i=1 ; i<=n ; i++)
#define fr1(i,x,n) for(i=x... | ALGO | 0.999512 | 3.522459 |
6357b3b8-a37d-4c37-a952-1824fd8dae0a | ishandutta2007/codeforces | tiramister/normal/1221/F.cpp | #if __has_include("../library/Basic/Debug.hpp")
#include "../library/Basic/Debug.hpp"
#else
/* ----- Header Files ----- */
// IO
#include <cstdio>
#include <iomanip>
#include <ios>
#include <iostream>
// algorithm
#include <algorithm>
#include <cmath>
#include <numeric>
// container
#include <vector>
#include <arr... | ALGO | 0.999963 | 4.323399 |
a7b47be4-993a-490b-8219-2bdd220fb40d | threalwinky/cp_notebook | from_other_people/ICPC Codebook/CodeBook/Graph/Max Cost General Matching.cpp | #include <bits/stdc++.h>
using namespace std;
// Cap ghep co trong so lon nhat - Thay Hoang
#define MCM MaxCostMatching
namespace MaxCostMatching {
#define dist(e) (lab[e.u] + lab[e.v] - g[e.u][e.v].w * 2)
const int maxn = 1e3 + 5;
const int oo = (int) 1e9;
struct Edge {
int u, v, w;
} g[maxn][m... | ALGO | 0.999875 | 3.85813 |
c28176cb-9da3-4943-8c9e-f31a7fd3923a | hkj9057/ProblemSolving | Project1/Project1/test.cpp | #include <iostream>
#include <fstream>
#include <string>
#include <regex>
using namespace std;
int main() {
ifstream file("C:/Users/hkj90/Desktop/test.txt");
string line;
string content;
// б
while (getline(file, line)) {
content += line + "\n";
}
// int, char, string شϴ
... | ALGO | 0.882564 | 4.00084 |
75d2832a-44dc-4772-b1a9-b8ce20af315b | ishandutta2007/codeforces | rubikun/normal/1540/C1.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define fi first
#define ... | ALGO | 0.999771 | 3.729278 |
9a16a1ba-01e7-48d5-947c-e7afeec4a3ce | akshaydubey05/Leetcode_Solutions | 515-find-largest-value-in-each-tree-row/find-largest-value-in-each-tree-row.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.999994 | 5.947246 |
01030480-e112-4a8d-8082-760072268613 | r03er7/algorithms | SOURCE/pierd.cpp | #include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
using namespace std;
typedef vector<int> VI;
typedef long long LL;
#define FOR(x, b, e) for(int x = b; x <= (e); ++x)
#define FORD(x, b, e) for(int x = b; x >= (e); --x)
#define REP(x, n) for(int x = 0; x < (n... | ALGO | 0.999969 | 4.518939 |
03c42584-b290-4644-94ba-46fa3152d3e2 | melgust/algoritmos-basicos | ejercicio1.cpp | //Programa que solicita un numero y establece si es par o impar
//Autor: Melvin Cali
//Fecha: 24/07/2021
#include <iostream>
using namespace std;
int main() {
int n;
cout << "Ingrese el numero: ";
cin >> n;
cout << endl;
if (n % 2 == 0) {
cout << "El numero es par";
} else {
cout << "El numero es impar";
}
... | ALGO | 0.997051 | 3.803302 |
6c2af2b2-35da-42ee-ba5a-05b325da00b4 | kaloyankoyuv/codeforces-solutions | problems/Two Arrays And Swaps/solution.cpp | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin >> t;
while (t--) {
int n, k;
cin >> n >> k;
int a[n];
for (int i=0; i<n; i++) {
cin >> a[i];
}
int b[n];
for (int i=0; i<n; i++) {
cin >> b[i];
}
sort(a, a + n);
... | ALGO | 0.999979 | 3.272135 |
033af2de-6512-42d4-b0ae-e6ae7496da4e | Curious-Goblin/DSA-Sheet | SpiralMatrix.cpp | #include <iostream>
#include <vector>
using namespace std;
/* OPTIMAL SOLUTION TIME COMPLEXITY = O(N*N) SPACE COMPLEXITY = O(N*N)
class Solution {
public:
vector<int> spiralOrder(vector<vector<int>>& matrix) {
int m = matrix.size(), n = m ? matrix[0].size() : 0, u = 0, d = m - 1, l = 0, r = n - 1, p = 0;
... | ALGO | 0.999985 | 4.341702 |
bb742fb2-ad85-410b-afcd-d9d522c14a04 | Ayushyadav04/leetcode-solution | 0496-next-greater-element-i/0496-next-greater-element-i.cpp | class Solution {
public:
int imp(stack<int>& s,stack<int>& s1,int k){
int ans=-1;
int t,y;
while(k!=s.top()){
t=s.top();
s.pop();
s1.push(t);
}
while(!s1.empty() && k>s1.top()){
y=s1.top();
s1.pop();
s.pu... | ALGO | 0.999907 | 5.40469 |
686b7cf5-371f-412a-8bda-f8fe02e97119 | dkdkdsa/Data_Structure | RNFYRHWK/1로만들기.cpp | #include<iostream>
using namespace std;
int arr[1000000] = {};
int main() {
int res;
cin >> res;
for (int i = 2; i <= res; i++) {
arr[i] = arr[i - 1] + 1;
if (i % 2 == 0) {
arr[i] = min(arr[i], arr[i / 2] + 1);
}
if (i % 3 == 0) {
arr[i] = min(arr[i], arr[i / 3] + 1);
}
}
cout << arr[res]... | ALGO | 0.999989 | 3.857433 |
fae178ab-8d05-4fa8-bb05-8f53b4723f70 | immortaltw/MPC-Project | src/Eigen-3.3/unsupported/doc/examples/MatrixPower.cpp | #include <unsupported/Eigen/MatrixFunctions>
#include <iostream>
using namespace Eigen;
int main()
{
const double pi = std::acos(-1.0);
Matrix3d A;
A << cos(1), -sin(1), 0,
sin(1), cos(1), 0,
0 , 0 , 1;
std::cout << "The matrix A is:\n" << A << "\n\n"
"The matrix power A^(pi/4) is:\n"... | ALGO | 0.999625 | 3.790203 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.