uuid stringlengths 36 36 | repo_name stringlengths 5 123 | relative_path stringlengths 5 4k | content stringlengths 33 2.85M | category stringclasses 6
values | algo_rel_score float64 0.85 1 | quality_score float64 3 8.76 |
|---|---|---|---|---|---|---|
e7726d51-037e-4b2e-b856-946b75230d56 | mdkhurshidjahan/C-plus-plus-Practice | findnumber2.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
int a,b,c,i;
cin>>a>>b>>c;
for(i=a; i<=b; i++)
{
if(i==(c*2))
{
cout<<i<<"\n";
return 0;
}
else if(i==c)
{
... | ALGO | 0.999935 | 3.368602 |
14fc9441-5d4f-42ef-bf9d-82b9ccd01755 | huzaifa9999/leetcode-practice | ZigZag Tree Traversal - GFG/zig-zag-tree-traversal.cpp | //{ Driver Code Starts
//Initial Template for C++
#include <bits/stdc++.h>
using namespace std;
#define MAX_HEIGHT 100000
// Tree Node
struct Node {
int data;
Node* left;
Node* right;
};
// Utility function to create a new Tree Node
Node* newNode(int val) {
Node* temp = new Node;
temp->data = val... | ALGO | 0.999872 | 6.270234 |
68b4286a-757b-4bb8-ae7c-cdcf1b36754a | alexandraback/datacollection | solutions_5634697451274240_0/C++/fagu/B.cpp | #include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <string>
#include <cassert>
#include <cmath>
#include <cstring>
#include <functional>
using namespace std;
typedef vector<i... | ALGO | 0.995772 | 3.780433 |
48a06250-32b3-4eb4-a311-44c9a8ceb433 | amorsara/Exercises-Sara-Amor | TwitterTowers/TwitterTowers.cpp | #include <iostream>
#include <cstdlib>
#include <stdio.h>
using namespace std;
void menu();
void rectangle(int width, int height) {
if (abs(height - width) > 5) {
cout << "Area : " << width * height << endl;
}
else {
cout << "perimeter : " << (width + height) * 2 << endl;
}
menu();... | ALGO | 0.984748 | 3.485519 |
ff41d8cc-b8d7-48fb-9724-b3348fd0fc76 | AdamRLukaitis/Simple-Encrypted-Arithmetic-Library---SEAL | SEAL/util/polyfftmult.cpp | #include "util/uintcore.h"
#include "util/polycore.h"
#include "util/uintarith.h"
using namespace std;
namespace seal
{
namespace util
{
namespace
{
void do_fft_base(const uint64_t *operand1, const uint64_t *operand2, int coeff_count_power, int coeff_uint64_count, uint64_t *result,... | ALGO | 0.99909 | 6.272127 |
bed0ebe6-07fe-4ddf-8ba7-e7956201e873 | TerryKingston/schoolbloc | project_implementation/flask_app/angr-z3-angr/src/ast/substitution/unifier.cpp | #include"unifier.h"
#include"ast_pp.h"
void unifier::reset(unsigned num_offsets) {
m_todo.reset();
m_find.reset();
m_size.reset();
}
/**
\brief Find with path compression.
*/
expr_offset unifier::find(expr_offset p) {
buffer<expr_offset> path;
expr_offset next;
while (m_find.find(p, next)) ... | ALGO | 0.867845 | 5.353438 |
0a06bb06-dc63-4343-97ae-80b16273d16f | AdarshGaur/Competitive-Programming | Codeforces/Codeforces Round #790 (Div. 4)/D. X-Sum.cpp | // https://github.com/AdarshGaur/Competitive-Programming
// Author : @AdarshGaur
#include <bits/stdc++.h>
using namespace std;
#define int int64_t
#define endl "\n"
typedef pair<int,int> pii;
typedef vector<int> vi;
// Source : https://codeforces.com/blog/entry/76087
vector<string> vec_splitter(string s) {
s += ','... | ALGO | 0.999788 | 5.656758 |
e9e19c53-609c-4b82-a5e5-4b6e0f420710 | Ash-codes18/Lpu-colab-CPP-DSA-Soln | CSE-205 DSA/Unit-6/Lecture-40/Ishu.cpp | #include <iostream>
using namespace std;
int divisionMethod(int key, int tableSize)
{
return key % tableSize;
}
int main() {
int tableSize = 10;
int numKeys, k;
cin >> numKeys;
int keys[numKeys];
for (int i = 0; i < numKeys; i++) {
cin >> keys[i];
}
cin >> k;
int hashTa... | ALGO | 0.999952 | 5.268778 |
c1b53a80-1f3a-4a22-ab00-9a6445eb8ad6 | GiovanniBellorio/BaseCamp18 | minimum_spanning_tree/mst.cpp | #include <stdio.h>
#include <limits.h>
#include <cstdio>
#include <cassert>
#define N_MAX 10001
int graph[N_MAX][N_MAX];
int N, M;
int a, b, c;
int minKey(int key[], bool mstSet[]){
int min = INT_MAX, min_index;
for (int v = 0; v < N; v++)
if (mstSet[v] == false && key[v] < min)
min = k... | ALGO | 0.999926 | 4.575766 |
193d0883-50fc-4125-a498-db84c68eaa9e | osalbahr/Learn-Programming | adventofcode/2019/day02_2.cpp | #include <iostream>
using namespace std;
#define REPORT(X) cout << #X << " = " << (X) << endl
vector<int> getOpcodes()
{
vector<int> opcodes;
int opcode;
char comma;
while (cin >> opcode) {
opcodes.push_back(opcode);
cin >> comma;
}
return opcodes;
}
int main()
{
vector... | ALGO | 0.999699 | 4.583368 |
d5c9e539-54da-4010-aac3-713db7c85ebf | NOT-REAL-GAMES/Tremor | vm_bytecode.cpp | #include "vm_bytecode.hpp"
#include <fstream>
#include <iostream>
#include <algorithm>
#include <ranges>
#include <print>
#include <cstring>
namespace tremor::vm {
// Magic number for Q3VM format
constexpr int32_t VM_MAGIC = 0x12721444;
// Helper to read from a binary file
template<typename T>
st... | TOOL | 0.934038 | 7.19027 |
b056e54f-c528-4510-8c39-95540e4ba166 | JunHaHwang98/C_Homework | 피보나치 수열 반복.cpp | #include <stdio.h>
int iter_fibo(int n)
{
int i;
int f0, f1, fi;
f0 = 0;
f1 = 1;
if (n == 0) return 0;
else if (n == 1) return 1;
else
{
for (i = 2; i <= n; i++)
{
fi = f0 + f1;
f0 = f1;
f1 = fi;
}
}
return fi;
}
int main(void)
{
int iter_fibo(int n);
int n;
... | ALGO | 0.999822 | 4.402263 |
7b8d4cc5-ab5e-47c3-8542-5ccfd5e4bc11 | akashvadnala/DSA_implementations | GFG/2. Count the triplets.cpp | class Solution{
public:
int countTriplet(int arr[], int n)
{
unordered_map<int,int> m;
int c=0;
for(int i=0;i<n;i++) m[arr[i]]++;
for(int i=0;i<n;i++){
for(int j=i+1;j<n;j++){
if(m.find(arr[i]+arr[j])!=m.end()) c++;
}
}
return c;
}
};
// Expected Time ... | ALGO | 0.999948 | 6.269225 |
5357b0c8-f623-467a-8118-d8b4291b8613 | ishandutta2007/codeforces | andreasyan/normal/1106/F.cpp | #include <bits/stdc++.h>
using namespace std;
#define m_p make_pair
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
mt19937 rnf(2106);
const int N = 105;
const int M = 998244353;
int gcdd(int a, int b, int& x, int& y)
{
if (a == 0)
{
x = 0;
y = 1;
return b;
}
... | ALGO | 0.999996 | 3.755116 |
fc5677ce-4bcd-4f5b-a212-3380f30fa0f0 | jennybehre/Control_and_Trajectory_Tracking_for_Autonomous_Vehicle | project/pid_controller/eigen-3.3.7/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.999836 | 3.790203 |
045e14d2-dcf0-4c7c-9fa7-ef07aa6781de | KatsuyaKikuchi/ProgrammingContest | JOI/2020/Prelim2/B.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> pll;
#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)
const ll MOD = 1000000007;
const ll INF = (ll) 1e15;
pll A[100005];
int main() {
ll N;
cin >>... | ALGO | 0.999831 | 4.147957 |
c867ff57-8303-4b70-8db6-2e92f5b54a49 | ishandutta2007/codeforces | lawrenceli/normal/615/D.cpp | #include <cstdio>
#include <iostream>
#include <algorithm>
#include <map>
#include <ios>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int maxn = 200100;
const int mod = 1e9 + 7;
const int mod2 = 1e9 + 6;
map<int, int> mp;
int ar[maxn], num[maxn];
int suf[maxn];
int exp(int b, int e)... | ALGO | 0.999984 | 4.154587 |
22d32916-b18f-4396-bdc7-0e09a4d90c43 | IsratJahan09/LeetCode | EASY/867. Transpose Matrix.cpp | class Solution {
public:
vector<vector<int>> transpose(vector<vector<int>>& matrix) {
int n = matrix.size();
int m = matrix[0].size();
vector<vector<int>>res(m, vector<int>(n));
for(int i = 0; i<n; i++){
for(int j = 0; j<m; j++){
// swap(matrix[i][j], res[... | ALGO | 0.999941 | 6.268618 |
400580c8-f900-4715-96b8-fc7443fcc2ce | icse26-anonymous/llvm2kittel | lib/Core/ConstraintEliminator.cpp | #include "llvm2kittel/ConstraintEliminator.h"
#include "llvm2kittel/IntTRS/Constraint.h"
// C/C++ includes
#include <fstream>
#include <iostream>
#include <set>
#include <sstream>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
class CVC4Eliminate : public EliminateClass
{
public:
virtual bool shouldE... | ALGO | 0.997523 | 6.972411 |
1dc7013c-aa5b-4b7e-a7ca-2f411ce680ad | VVLtowl/DoubleLinkedList1-4 | DoubleLinkedList/main.cpp | /*********************************************************
* @brief NCbN\[ǧ\
* @date 2022/10/17
********************************************************/
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <iostream>
#include "ScoreData.h"
#include "DoubleLinkedList.h"
#in... | ALGO | 0.982453 | 4.301015 |
15c964e2-0f9d-4111-97f3-c53b7fd62b23 | DarthXibalba/Leetcode-Questions | Google/3_TreesAndGraphs/RobotRoomCleaner/RobotRoomCleaner.cpp | #include <map>
using namespace std;
class Robot {
virtual bool move();
virtual void turnLeft();
virtual void turnRight();
virtual void clean();
};
class Solution {
public:
bool roomCleaned = false;
map<pair<int, int>, bool> room;
void cleanRoom(Robot& robot)
{
mapCell(0, 0, t... | ALGO | 0.998663 | 5.666454 |
e3a7a403-d053-4611-8b22-d3a72ef4c4a5 | TaniaBansal/C-practice | Day-001-100/Day-005/ArrayQues/RecordBreaker/main.cpp | /* Isyana is given the number of visitors at her local theme park on N consecutive
days. The number of visitors on the i-th day is Vi
. A day is record breaking if it
satisfies both of the following conditions:
● The number of visitors on the day is strictly larger than the number of
visitors on each of the previous ... | ALGO | 0.9975 | 5.126557 |
78d11e11-2945-4d3d-babd-6ce68c9259e2 | punnapavankumar9/coding-platforms | codechef/nov 10/practice/step 1/FLOW009.cpp | #include <iostream>
#include <iomanip>
using namespace std;
int main(){
int t;
cin >> t;
while(t--){
int q, p;
cin >> q >> p;
double res = p * q;
if(q > 1000){
cout << fixed << setprecision(6) << res - res*0.1 << "\n" ;
}else{
cout << fixed <... | ALGO | 0.999264 | 3.868322 |
e4bad2c1-4077-4dbd-a3fb-4a4c252b1839 | Swapnil1163github/cpp | cpp9.cpp | #include <iostream>
using namespace std;
// Function to read two double type numbers from the keyboard
void read(double& num1, double& num2) {
cout << "Enter the first number: ";
while (!(cin >> num1)) {
cin.clear();
cout << "Invalid input. Please enter a valid number: ";
while (cin.ge... | ALGO | 0.913138 | 6.503307 |
03ec361a-0d6f-446c-9cbb-ae0d87a1ea22 | ishandutta2007/codeforces | krijgertje/normal/401/A.cpp | #include <algorithm>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <list>
#include <climits>
#include <cassert>
#include <ctime>
#include... | ALGO | 0.999728 | 3.530185 |
62c9d0eb-07c5-4296-8e94-4fe82aa84cdb | lshpku/gem5-runahead | src/systemc/tests/systemc/misc/synth/combo/switch5/switch5.cpp | /*****************************************************************************
switch5.cpp --
Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
*****************************************************************************/
/****************************************************************************... | TOOL | 0.98155 | 4.533247 |
aeb47055-ee39-452f-b588-c3c72ee0b10d | MHRipon01/problem-solving-leetcode | First_Hundred/p56_atcoder.cpp | // https://atcoder.jp/contests/abc222/tasks/abc222_a?lang=en
// #include <bits/stdc++.h>
// using namespace std;
// int main()
// {
// int n;
// cin >> n;
// string s = to_string(n);
// int length = 4 - s.length();
// for (int i = 1; i <= length; i++)
// {
// s = '0' + s;
// }
//... | ALGO | 0.999944 | 5.67232 |
c74bd2fc-6e7e-4701-adf0-c7f074ae9937 | kenway1102/LeetCode_solutions | Pattern 19 - GFG/pattern-19.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
void printTriangle(int n) {
// code here
for(int i =0 ; i <n;i++){
for(int j =0 ;j<n - i; j++)
cout<<"*";
for(int j = 0; j<i ; j++)
... | ALGO | 0.999893 | 5.691392 |
ddb11aad-330c-467f-93e4-587ececfb155 | Zimse12345/Code | Codeforces_Contest/CF1614/D2.cpp | #include <cstdio>
#include <algorithm>
#include <cstring>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <iostream>
#include <cstdlib>
#include <ctime>
#define int long long
using namespace std;
inline int read(){int qrx=0,qry=1;char qrc=getchar();
while(qr... | ALGO | 0.99991 | 3.775361 |
b73d3910-7010-4cc4-8952-1c220c11b554 | RoboticOceanographicSurfaceSampler/ardusub-ice-launcher | libraries/AC_PID/AC_PI_2D.cpp | /// @file AC_PI_2D.cpp
/// @brief Generic PID algorithm
#include <AP_Math/AP_Math.h>
#include "AC_PI_2D.h"
const AP_Param::GroupInfo AC_PI_2D::var_info[] = {
// @Param: P
// @DisplayName: PID Proportional Gain
// @Description: P Gain which produces an output value that is proportional to the current error... | ALGO | 0.999145 | 5.868154 |
32940211-2b0a-4e7d-8e15-fa258f795304 | SimonCqk/Algorithm_Problems | Algorithm_Problems/online_judge/剑指offer/重建二叉树.cpp | /*
ijǰĽؽö
*/
#include<iostream>
#include<vector>
#include<exception>
typedef std::vector<int>::iterator iter;
struct BinaryTreeNode
{
int value;
BinaryTreeNode* left;
BinaryTreeNode* right;
BinaryTreeNode(const int& val) :
value(val), left(nullptr), right(nullptr) {}
};
BinaryTreeNode* ConstructCore(iter preor... | ALGO | 0.999999 | 5.373914 |
af551aa6-60ec-46d0-88ba-4661dcfe9c56 | felipemunozm/cplusplus-learning | tests/minus/minus.cpp | #include "minus.hpp"
int myminus(int* x, int& y) {
return *x - y;
}
| TOOL | 0.905224 | 4.803957 |
498ee032-c938-4a21-8a46-a5cb06ebf1e3 | codingNoob12/algorithm-study | cpp/바킹독_알고리즘/해시/13414.cpp | #include <bits/stdc++.h>
#define X first
#define Y second
using namespace std;
int k, l;
unordered_map<string, int> m;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cin >> k >> l;
for (int i = 1; i <= l; i++) {
string id;
cin >> id;
m[id] = i;
}
vector<pair<string, int>> v(m.begin(), m.end());
sort... | ALGO | 0.999595 | 3.082802 |
ebb927dd-b27b-4a8e-89d2-021dfe5bbe01 | KDE/ksudoku | src/generator/sudokuboard.cpp | #include "sudokuboard.h"
#include "debug.h"
#include "ksudoku_logging.h"
#include "state.h"
#include "mathdokugenerator.h"
#include <KLocalizedString>
#include <KStandardGuiItem>
#include <QElapsedTimer>
#include <QRandomGenerator>
#include <cstdio>
#include <ctime>
SudokuBoard::SudokuBoard (SKGraph * graph)
... | ALGO | 0.985613 | 6.643463 |
5deffc8d-5b6d-4e00-bbea-cab387c54843 | rfratto/accidental-noise-library | Noise/implicitcellular.cpp | #include "implicitcellular.h"
namespace anl
{
CImplicitCellular::CImplicitCellular() : CImplicitModuleBase(), m_generator(0)
{
setCoefficients(1,0,0,0);
}
CImplicitCellular::CImplicitCellular(ANLFloatType a, ANLFloatType b, ANLFloatType c, ANLFloatType d) : CImplicitModuleBase(), m_generator(0)
{
setCoeffi... | ALGO | 0.939998 | 3.702841 |
46337894-e2c1-4d1b-b9ba-d304230530eb | cavanj-pats/Exercises_CPP | fibonacci_rec.cpp | //Fibonacci Lab
//print out fibonacci numbers based on user input
//fibonacci_rec.cpp
#include <iostream>
//#include <stdlib.h> //for conversion of command line argument to int
using namespace std;
int fib(int n);
int main(){
int n=0;
int counter=0;
//int fib=1;
//int outFib = 0;
//int inFib = 0;
... | ALGO | 0.994318 | 4.406181 |
1e434a7d-657f-4abb-81d6-4566fb4b8f8b | u-wyh/luogu-code | P9823.cpp | #include<bits/stdc++.h>
using namespace std;
#define int long long
const int MOD = 998244353;
const int MAXN = 1e7+5;
int n,k;
int fac[MAXN];
int inv[MAXN];
int f[MAXN];
int g[MAXN];
int power(int a,int b){
int ans=1;
while(b){
if(b&1){
ans=(a*ans)%MOD;
}
b>>=1;
a=... | ALGO | 0.999973 | 5.009065 |
ed2a1bd3-51ac-4678-be5d-3340baccc522 | infinity-boi/DSA-codes | 032singleInSortedArray.cpp | // https://leetcode.com/problems/single-element-in-a-sorted-array/
// Binary Search
#include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
vector<int> nums;
for(int i=0; i<n; i++){
int x;
cin>> x;
nums.push_back(x);
}
cout<< singleNonDuplicate(nums);
... | ALGO | 0.999991 | 5.541159 |
fd4e4db9-f7a0-4af6-858a-766adcfaeb2a | nneven/csci-104 | homework-resources/hw8_tests/testing_utils/Utility.cpp | #include "Utility.h"
#include <algorithm>
#include <stdexcept>
#include <iostream>
#include <fstream>
// trim from start
std::string <rim(std::string &s)
{
s.erase(s.begin(), std::find_if(s.begin(), s.end(),
std::not1(std::ptr_fun<int, int>(std::isspace))));
return s;
}
// trim from end
std::str... | TOOL | 0.933997 | 5.70411 |
800176ab-cca9-482b-a044-5a39591995e6 | famousyub/fluttermob | HealWiz/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.998565 | 6.76073 |
7ac52839-8751-4a3a-bdfd-b3b47aeb8626 | XinShepherd/study-cpp | exercises-2/main.cpp | //
// Created by Fuxin on 2019/10/17.
//
#include <string>
#include <iostream>
using std::string;
using std::cout;
using std::cin;
using std::endl;
int main(){
cout << "Please enter your name: ";
string name;
cin >> name;
string greeting = "Hello, " + name + "!";
cout << endl;
const int pad =... | TOOL | 0.901675 | 3.693646 |
1ad30509-4459-4f12-a14e-b89143f495e7 | gahara086/AtCorderPromblems-BootCampForBeginners | Medium100/8.cpp | #include <bits/stdc++.h>
#include <algorithm>
#include <cmath> // abs() for float, and fabs()
#include <cstdlib> // abs() for integer
#include <iostream>
#include <string>
using namespace std;
bool debug_flag = true;
void logint1(int n) {
if (debug_flag) cout << "arg_1 = " << n << endl;
}
void logint2(int n... | ALGO | 0.999396 | 3.735978 |
063116cc-ad51-45d4-8054-5ef68aadcf18 | stanford-cs149/asst1 | prog3_mandelbrot_ispc/mandelbrotSerial.cpp | static inline int mandel(float c_re, float c_im, int count)
{
float z_re = c_re, z_im = c_im;
int i;
for (i = 0; i < count; ++i) {
if (z_re * z_re + z_im * z_im > 4.f)
break;
float new_re = z_re*z_re - z_im*z_im;
float new_im = 2.f * z_re * z_im;
z_re = c_re + n... | ALGO | 0.999705 | 5.766954 |
7eb3c793-405b-4eac-aef4-cdad3489855f | Abdul-Moiz31/DSA-Zero-to-Hero | Recursion/Backtracking.cpp | // ------------------------ Backtracking __________________
// Doing the same thing were doing in recursion but the opther way round
// We start with the solution and then we backtrack to find all the solutions
#include <bits/stdc++.h>
using namespace std;
// Print (1 -> N) numbers
// void printNum1(int i){
// ... | ALGO | 0.999811 | 5.047193 |
01b07fe2-31bc-4fe2-8221-8e1e51296ded | dh434/leetcode | tree/988. 从叶结点开始的最小字符串.cpp | /*
给定一颗根结点为 root 的二叉树,书中的每个结点都有一个从 0 到 25 的值,分别代表字母 'a' 到 'z':值 0 代表 'a',值 1 代表 'b',依此类推。
找出按字典序最小的字符串,该字符串从这棵树的一个叶结点开始,到根结点结束。
(小贴士:字符串中任何较短的前缀在字典序上都是较小的:例如,在字典序上 "ab" 比 "aba" 要小。叶结点是指没有子结点的结点。)
示例 1:
输入:[0,1,2,3,4,3,4]
输出:"dba"
示例 2:
输入:[25,1,3,1,3,0,2]
输出:"adz"
示例 3:
输入:[2,2,1,null,1,0,null,0]
输出:"abc"
提示:
给... | ALGO | 0.999968 | 6.411579 |
e36cd14c-8d72-47bf-9fcb-9b1edd339897 | ItWasItIs/boost | libs/statechart/example/Handcrafted/Handcrafted.cpp | //////////////////////////////////////////////////////////////////////////////
// This is a quick-and-dirty handcrafted state machine with two states and two
// transitions employing GOF-visitation (two virtual calls per event).
// It is used to make speed comparisons with Boost.Statechart machines.
///////////////////... | ALGO | 0.947119 | 7.064229 |
fc7b3ca1-bbed-4a77-8994-e7da890cc6a0 | Minnggg/CPP-CODEPTIT | cpp0430.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int t;
cin >> t;
while(t--)
{
int n;
cin >> n;
int a[1005]={};
int minn=1e9,maxx=-1e9;
while(n--)
{
int x;
cin >> x;
minn=min(minn,x);
maxx=max(maxx,x);
a[x]++;
... | ALGO | 0.999751 | 4.057866 |
2fcee1f8-d93a-4a2c-b788-46fbcce31808 | Surya-760/Leetcode_problems | 34-find-first-and-last-position-of-element-in-sorted-array/34-find-first-and-last-position-of-element-in-sorted-array.cpp | class Solution {
public:
vector<int> searchRange(vector<int>& nums, int target) {
int l=0,h=nums.size()-1;
vector<int>a(2,-1);
while(l<=h)
{
int m=l+(h-l)/2;
if(nums[m]==target)
{
a[0]=m;
h=m-1;
}
... | ALGO | 0.999909 | 6.449338 |
d96bd728-b99b-4262-bae6-c523e6d665c0 | savvastj/CSC111 | ReverseAndStoreDigits.cpp | // ReverseAndStoreDigits.cpp
#include <iostream>
#include <cstdlib>
using namespace std;
int main() {
int n;
int answer = 0;
cout << "Give me a number > 0: ";
cin >> n;
if (n <= 0) {
cout << "Input error\n";
exit(1);
}
while (n > 0) {
answer = answer*10 + n%10;
n = n/10;
}
cout << answer << endl;
retu... | ALGO | 0.999832 | 4.73577 |
cd82322a-d871-4995-97c9-50164bef44d1 | tyagipriyanshi79/Data-structures-and-algorithm-questions | Graph/representation.cpp | #include<iostream>
using namespace std;
// Adjacency Matrix representation
//the adjacency matrix initially 0
//int count = 0;
const int n = 1e3+10;
int vertArr[n][n];
int main() {
int n,m;
cin>>n>>m;
for(int i = 0; i < m; i++){
int u , v ;
cin >> u >> v ;
vertArr[u][v] = 1 ;
... | ALGO | 0.999977 | 3.31518 |
1335be54-14ae-40cb-857e-461439194b66 | yftsai/uva-online-judge | problem_set_volumes/volume_08/861.cpp | // #search
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
// Function place returns the number of ways to place k bishops on
// diagonal k, k+2, k+4, ... on a n*n board.
int place(int n, size_t k, int d, vector<pair<int, int>> &bishops)
{
if (bishops.size() == k)
return 1;
... | ALGO | 0.99968 | 4.805151 |
2c70ae26-c903-4417-9e9c-56b595583483 | dskym/Algorithm | LeetCode/117/Solution.cpp | class Solution {
public:
Node* connect(Node* root) {
queue<pair<Node*, int>> q;
Node* before = NULL;
int depth = 0;
q.push({root, 0});
while(!q.empty()) {
auto t = q.front();
q.pop();
if(t.first == NULL)
... | ALGO | 0.999991 | 5.936861 |
17997f0c-f397-4267-85c7-96a29a35da9e | sweet12prof/cpp | Revsions/Functions/CrapsGame/craps.cpp | #include <iostream>
#include <iomanip>
#include <random>
#include <ctime>
using std::cin;
using std::cout;
using std::endl;
std::default_random_engine engine{static_cast<unsigned int>(time(0))};
std::uniform_int_distribution<int> RandomInt (1, 6);
int generateRandomNumber();
int numOnSpinFunc();
void spinFunc();
int... | ALGO | 0.992802 | 5.328984 |
b51d3175-6766-4f1c-9cda-09daa33e7896 | celestialxevermore/BaekjoonOnlineJudge | Baekjoon/Baekjoon/비밀 지도.cpp | //#include<stdio.h>
//#include<iostream>
//#include<algorithm>
//#include<stack>
//#include<string>
//#include<math.h>
//using namespace std;
//
//string test;
//stack<int>n;
//stack<string> s;
//
//
//int main() {
// cin >> test;
// int ans = 0;
//
//
// for (int i = 0; i < test.size(); i++) {
// int input=0;
//
... | ALGO | 0.999588 | 3.392541 |
7a10008d-5551-4b0d-87a4-36141a9c4bd1 | Tintinnit/leeter | May/3355.cpp | #include <iostream>
#include <vector>
using namespace std;
// 3355. Zero Array Transformation I
class Solution {
public:
bool isZeroArray(vector<int>& nums, vector<vector<int>>& queries) {
int n = nums.size();
vector<int> delta(n + 1, 0);
for (auto& q : queries) {
int l = q[0... | ALGO | 0.999787 | 6.79056 |
fd13d2de-8a86-4d1d-b8a8-543e983d6614 | NaveenKumar-n4v/Leetcode | 102-binary-tree-level-order-traversal/102-binary-tree-level-order-traversal.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.999945 | 6.060095 |
382fde05-26c4-40d0-a482-6db9c26fb0b1 | BuildAndRelease/skia | tools/random_parse_path.cpp | #include "include/utils/SkRandom.h"
#include "tools/random_parse_path.h"
const struct Legal {
char fSymbol;
int fScalars;
} gLegal[] = {
{ 'M', 2 },
{ 'H', 1 },
{ 'V', 1 },
{ 'L', 2 },
{ 'Q', 4 },
{ 'T', 2 },
{ 'C', 6 },
{ 'S', 4 },
{ 'A', 4 },
{ 'Z', 0 },
};
bool gEasy... | TOOL | 0.917554 | 4.640921 |
8be4ddda-eafa-44e5-8740-52430b85354d | yashgupta18/Data-structures-and-algorithms | STACKS/validateIfstackOprn.cpp | #include <iostream>
#include <vector>
#include <stack>
using namespace std;
bool validateStackSequences(vector<int> &pushed, vector<int> &popped) {
int n= popped.size();
// maintain count of popped elements
int j = 0;
// an empty stack
stack <int> st;
for(int i = 0; i < n; i++){
... | ALGO | 0.999325 | 5.787522 |
9253184b-6bc7-488f-b850-b20d68e238a3 | hn-agnihotri29/competitive-winner | Leetcode/94. Binary Tree Inorder Traversal.cpp | vector<int> inorderTraversal(TreeNode* root) {
stack<TreeNode*> st;
vector<int> inorder;
TreeNode* node = root;
while(true) {
if(node != NULL) {
st.push(node);
node = node->left;
} else {
if(st.empty() == true) bre... | ALGO | 0.999982 | 6.066789 |
2f9c9ad7-2cda-4e46-a068-f5e35730d24e | rumisle/llvm-project | libcxx/test/std/algorithms/alg.nonmodifying/alg.is_permutation/is_permutation_pred.pass.cpp | // <algorithm>
// template<class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
// constexpr bool // constexpr after C++17
// is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
// ForwardIterator2 first2, BinaryPredicate pred);
#include <algorithm>
#include <funct... | TEST | 0.97781 | 7.424625 |
c6bd75c6-b613-4901-8980-4fc7f94e0cb3 | leowindows7/LearningC-C- | 105_huff_all/buildTree.cpp | #include "node.h"
Node * buildTree(uint64_t * counts) {
//WRITE ME!
priority_queue_t myPQ;
for (int i = 0; i < 257; i++) {
if (counts[i] != 0) {
myPQ.push(new Node(i, counts[i]));
}
}
while (myPQ.size() > 1) {
Node * nodeOne = myPQ.top();
myPQ.pop();
Node * nodeTwo = myPQ.top();
... | ALGO | 0.997441 | 4.366703 |
54d8b7bb-5a44-4cab-9dd6-3f3901ee5e77 | hasinfarhan/ACM-Notebook | String/z algorithm.cpp | #include <bits/stdc++.h>
#define MAXN 100005
using namespace std;
typedef long long ll;
string s;
int z[MAXN];
void Z_Algo()
{
int L=0,R=0;
z[0]=s.length(); // should be set to 0 if the problem demands only proper substrings.
for(int i=1;i<s.length();i++) {
if(i>R) {
L=i;
... | ALGO | 0.999583 | 4.111917 |
5d450767-0323-4221-b5fb-383289c997ec | checkoutb/LeetCodeCCpp | ge3000/LT3093_2024-04-02_Longest_Common_Suffix_Queries.cpp |
#include "../header/myheader.h"
class LT3093
{
public:
// Runtime
// 414ms
// Beats49.76%of users with C++
// Memory
// 818.14MB
// Beats65.14%of users with C++
// node->str = str1; node2->str = str1; node->str = "1"; str1 == "1", node2->str=="1"
vector<int> stringIndices(vector<string>& wordsContainer,... | ALGO | 0.999789 | 5.72694 |
6af014e7-ab99-47a7-bf09-8c3eb3610641 | sourabhossain/codeforces | A/980.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
string s;
int a = 0, b = 0;
cin >> s;
for(char c : s) {
(c == '-')? a++ : b++;
}
(!b || !(a % b))? puts("YES") : puts("NO");
return 0;
}
| ALGO | 0.999902 | 4.08742 |
e450f655-d914-4cdf-a987-3bcce5accd81 | playbar/algorithm | cpp/shuffleTheArray/ShuffleTheArray.cpp | // Source : https://leetcode.com/problems/shuffle-the-array/
// Author : Hao Chen
// Date : 2020-10-02
/*****************************************************************************************************
*
* Given the array nums consisting of 2n elements in the form [x1,x2,...,xn,y1,y2,...,yn].
*
* Return th... | ALGO | 0.999966 | 6.577216 |
e4d64f50-a75d-4c25-b643-209efd2dff83 | k-kmw/algorithm | C++/기타/유니온 파인드/1976 여행 가자.cpp | #include <bits/stdc++.h>
using namespace std;
int n, m;
int p[205];
void make_set() {
for (int i = 1; i <= n; i++) {
p[i] = i;
}
}
int find(int n) {
if (n == p[n]) return n;
return p[n] = find(p[n]);
}
void merge(int a, int b) {
int rootA = find(a);
int rootB = find(b);
if (rootA... | ALGO | 0.999996 | 4.371294 |
396d3549-0344-46cf-a636-a8540547227f | hallmar/Fjol | Firmware/DaisySP/Source/Effects/decimator.cpp | #include "decimator.h"
using namespace daisysp;
void Decimator::Init()
{
downsample_factor_ = 1.0f;
bitcrush_factor_ = 0.0f;
downsampled_ = 0.0f;
bitcrushed_ = 0.0f;
inc_ = 0;
threshold_ = 0;
}
float Decimator::Process(float input)
{
int32_t temp;
... | ALGO | 0.989803 | 4.722351 |
2a130e80-f914-4fd6-b3fb-86ec94df91b5 | notYnoj/Programming-Questions-in-CPP | Codeforces/Contests/Div 3/1020/A.cpp |
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define all(x) x.begin(), x.end()
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vvi vector<vector<int>>
using namespace std;
// Everything Else thats new :D
template <typename T> //custom output stream operator for... | ALGO | 0.99991 | 4.611326 |
0f2778bf-8e8a-4e8f-8b16-0b0782738d5b | RishikeshDwivedi-99/LeetCode | 2324-find-triangular-sum-of-an-array/find-triangular-sum-of-an-array.cpp | class Solution {
public:
int triangularSum(vector<int>& nums) {
int n = nums.size();
for(int size = n; size > 1; size--) {
for(int i = 0; i < size - 1;i++) {
nums[i] = (nums[i] + nums[i+1]) % 10;
}
}
return nums[0];
}
}; | ALGO | 0.999968 | 6.515992 |
4c10219c-5f6e-46d9-b9ef-2da596aebb26 | KaranKaira/Questions-Algorithms | BackTracking/WordBreak1.cpp | //Given an input string and a dictionary of words, find out if the input string can be segmented into a space-separated sequence of dictionary words.
//See following examples for more details.
// Consider the following dictionary
// { i, like, sam, sung, samsung, mobile, ice,
// cream, icecream, man, go, mango}
// ... | ALGO | 0.999049 | 5.620065 |
cf870923-598d-4c6e-a9f0-065b117fe896 | Queenbanda/BED-COM-37-22 | lab practises/COM221_LAB_TASK_3/OperatorsPresence.cpp | #include <iostream>
using namespace std;
int main(){
int a = 20;
int b = 10;
int c = 15;
int d = 5;
int e;
e = (a + b) * c / d; //(30 * 15) / 5
cout<<"value of (a + b) * c / d is: " << e <<endl;
e = ((a + b) * c) / d; //(30 * 15) /5
cout<<"value of ((a + b) * c / d) is:" ... | ALGO | 0.996501 | 3.421617 |
8159e70d-ede7-4d9b-938e-ba31a653d7b3 | Newtom171-yp/Daily-Code | Triplets_with_given_sum.cpp | vector<vector<int>> findTriplets(vector<int>arr, int n, int K) {
vector<vector<int>> ans;
int start,end;
sort(arr.begin(),arr.end());
for(int i = 0; i < n-2; i++){
start = i+1;
end = n-1;
while(start < end){
if(arr[i]+arr[start]+arr[end] == K){
ans.push_back({arr[i],arr[start],arr[end]});
int temp1... | ALGO | 0.999875 | 5.195677 |
d468b07d-4037-4109-94f6-a1a6462fd414 | ThibaultGH/Navier-Stokes | build_dir/doc/snippets/compile_MatrixBase_cwiseInverse.cpp | static bool eigen_did_assert = false;
#define eigen_assert(X) if(!eigen_did_assert && !(X)){ std::cout << "### Assertion raised in " << __FILE__ << ":" << __LINE__ << ":\n" #X << "\n### The following would happen without assertions:\n"; eigen_did_assert = true;}
#include <iostream>
#include <Eigen/Eigen>
#ifndef M_PI... | TOOL | 0.922576 | 3.46386 |
d9d91fd1-6e40-4ce3-b6ec-dda006f921e3 | seunghyukcho/algorithm-problems-solved | codeforces/div2/571/C.cpp | #include <iostream>
#include <string>
using namespace std;
int main()
{
string a, b;
cin >> a >> b;
int cnt1 = 0, cnt2 = 0, ans = 0;
for(auto ch : b)
cnt2 += (ch == '1' ? 1 : 0);
for(int i = 0; i < b.size(); i++)
cnt1 += (a[i] == '1' ? 1 : 0);
ans += (cnt1 + cnt2) % 2 == 1 ? 0 : 1;
for(int i = 1; i + b.... | ALGO | 0.999981 | 4.206789 |
6ef17048-83b6-44ea-af35-3fe761289fe9 | Kawser-nerd/CLCDSA | Source Codes/CodeJamData/12/52/15.cpp | #include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <map>
#include <queue>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
typedef long long int64;
typedef unsigned long long uint64;
typedef long double real;
#ifdef WIN... | ALGO | 0.999846 | 3.809555 |
d1887430-520e-430d-a80a-9b23c39086e0 | randbatch-md/lammps-rbe | tools/phonon/green.cpp | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "green.h"
#include <complex>
#include "global.h"
/*******************************************************************************
* The class of Green is designed to evaluate the LDOS via the Green's Function
* method. The meaning ... | ALGO | 0.999229 | 5.927241 |
436500f5-edc6-4982-89f7-b2a2006023c3 | 22MH1A42G5/LeetCode | 1497-design-a-stack-with-increment-operation/design-a-stack-with-increment-operation.cpp | class CustomStack {
public:
vector<int>st;
int n;
CustomStack(int maxSize) {
n = maxSize;
}
void push(int x) {
if(st.size() < n)
st.push_back(x);
}
int pop() {
if(st.size()==0)
return -1;
int te = st[st.size()-1];
st.pop_back();
... | ALGO | 0.999698 | 5.685033 |
90ed1405-8599-4c15-87c5-9812942a6caf | krishnactive/CP-and-DSA-Questions | Number theory/longlong.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
long long t;
cin>>t;
while(t--){
int n,lll=0;
long long sum=0;
vector<long long>v;
int count =0;
cin>>n;
for(int i=0;i<n;i++){
long long x;
cin>>x;
... | ALGO | 0.999684 | 3.652513 |
44d6b2ac-a54c-4bbb-9a28-650d26931550 | Priyansh6/mdp-loop-cloning | llvm/clang-tools-extra/clang-include-fixer/SymbolIndexManager.cpp | #include "SymbolIndexManager.h"
#include <cmath>
#include "find-all-symbols/SymbolInfo.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/Path.h"
#define DEBUG_TYPE "clang-include-fixer"
namespace clang {
namesp... | TOOL | 0.995193 | 7.767067 |
1c3be563-1ae2-494e-886a-530e1c6e0931 | daehee87/fuzzcoin-llvm-wasm | llvm/lib/CodeGen/GlobalISel/Localizer.cpp | #include "llvm/CodeGen/GlobalISel/Localizer.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/Analysis/TargetTransformInfo.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/TargetLowering.h"
#include "llvm/InitializePasses.h"
#include "llvm/Support/Debug.h"
#define DEBUG_TYPE "localizer"
using na... | TOOL | 0.858206 | 7.929558 |
c3b16307-ba1d-4849-a416-bf55a6324803 | abhishekolympics/My_daily_leetcode_solutions | rotate image .cpp | class Solution {
public:
void rotate(vector<vector<int>>& matrix) {
for(int i=0;i<matrix.size();i++)
{
for(int j=0;j<=i;j++)
{
swap(matrix[i][j],matrix[j][i]);
}
}
for(int i=0;i<matrix.size();i++)
{
reverse(matri... | ALGO | 0.999984 | 6.244095 |
94883148-4c37-40a5-ae89-218579bccc97 | rohan8789/Data-Structures-and-Algorithms | GeeksForGeeksPractice/05_Searching/06_Count1s.cpp | #include<bits/stdc++.h>
using namespace std;
int count2(int *arr, int n)
{
int c=0;
for(int i=n-1; i>=0; i--)
{
if(arr[i]!=0)
c++;
else
break;
}
return c;
}
#include<bits/stdc++.h>
using namespace std;
int count(int *arr, int n)
{
int l=0;
int h=n-1... | ALGO | 0.999973 | 4.568743 |
5df74e22-ec8a-4402-8d26-ef275ab59346 | Hikabu/cpp | cpp09/ex02/PmergeMeDeq.cpp | #include "PmergeMeDeq.hpp"
#include "PmergeMe.hpp"
void PmergeMeDeq::fill_pairs(std::deque<int> &v, std::deque<std::pair<int, int> > &pairs)
{
std::deque<int>::iterator it = v.begin();
while(it != v.end())
{
std::pair<int, int> p;
p.first = *it;
it++;
if (it != v.end()){
... | ALGO | 0.999603 | 4.598523 |
b64cb210-c6d8-493d-a148-ea394fae7264 | btrunghieu/Training-in-Usaco | Bronze/Basic Complete Search/DiamondCollector.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
freopen("diamond.in", "r", stdin);
freopen("diamond.out", "w", stdout);
int n, k, maxa = 0;
cin >> n >> k;
int a[1006];
for (int i=1; i<=n; i++){
cin >> a[i];
maxa = max (a[i],maxa);
}
int res = 1, ans = 0;
for (... | ALGO | 0.999855 | 3.930484 |
a2c63156-3626-418f-b2b4-090d22be95c0 | SnoopyCodes/code | cf/contest/1018/d.cpp | #include <bits/stdc++.h>
using namespace std;
using i64 = long long;
const int MOD = 1e9 + 7;
const i64 INF = 4e18 + 7e9;
#define emp emplace
#define emb emplace_back
#define pob pop_back
void solve() {
int N; cin >> N;
vector<array<int, 2>> pts(N);
for (int i = 0; i < N; i++) {
cin >> pts[i][0]... | ALGO | 0.999666 | 5.921235 |
70346e4f-500a-4219-9d4a-b100cc88806a | ishandutta2007/codeforces | krijgertje/normal/1402/C.cpp | #include <algorithm>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <cstring>
#include <list>
#include <cassert>
#include <climits>
#inclu... | ALGO | 0.999819 | 3.947084 |
6b43c832-1b8d-43ad-8d8d-b53edf760b72 | rizwanahmedit23/striver-sde-sheet | Arrays-I/3.NextPermutation.cpp | class Solution {
void reverse(vector<int>& nums, int si){
int i=si, j=nums.size()-1;
while(i<=j){
swap(nums[i], nums[j]);
i++;j--;
}
}
public:
void nextPermutation(vector<int>& nums) {
int i, j;
for(i=nums.size()-2;i>=0;i--){
if(num... | ALGO | 0.999994 | 5.699011 |
7881d61b-90cd-4b1e-b0a3-5f57edce3d97 | HaKkaz/Competitive-Programming | leetcode/1129.cpp | class Solution {
public:
vector<int> shortestAlternatingPaths(int n, vector<vector<int>>& redEdges, vector<vector<int>>& blueEdges) {
const int maxn = 105;
const int inf = 1e9;
vector<int> G[2][maxn];
vector<vector<int>> dis(2, vector<int>(n,inf));
for (int i = 0; i < redEdg... | ALGO | 0.999554 | 5.574384 |
d294e071-0210-4f57-b756-b7fd77e898b8 | SourabhNarwal/DSA | Alternate positive and negative numbers - GFG/alternate-positive-and-negative-numbers.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
//User function template for C++
class Solution{
public:
void rearrange(int arr[], int n) {
if(n<2)
{return;}
int temparr[n];
int i=0;
int j=0;
int k=0;
while(i<n&&j<n&&k<n)
{... | ALGO | 0.999894 | 5.952475 |
8527c5fd-2911-442e-8452-b65ceced9417 | SharmaRithik/Profile-NewGVN | llvm-project/llvm/lib/CodeGen/RegAllocEvictionAdvisor.cpp | #include "RegAllocEvictionAdvisor.h"
#include "AllocationOrder.h"
#include "RegAllocGreedy.h"
#include "llvm/CodeGen/LiveRegMatrix.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/RegisterClassInfo.h"
#include "llvm/CodeGen/VirtRegMap.h"
#include "llvm/IR/Module.h"
#include "llvm/InitializePasses.h"
... | ALGO | 0.969297 | 7.435903 |
ef6b05d0-d5e3-46eb-b441-f9966b8b1221 | suqiang0313/leetcodeByChapter | DFS/leetcode98.ValidateBinarySearchTree.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
// solution 1
class Solution {
public:
bool isValidBST(TreeNode* root)
{
if(root==NULL)
{
return t... | ALGO | 0.999997 | 5.801671 |
70047fda-04fa-4580-9468-c4b1dd0c6b1b | wangzhecoder/ORB_SLAM_WITH_WEBCAM2 | my_mono.cpp | #include<iostream>
#include<algorithm>
#include<fstream>
#include<chrono>
#include<opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include<System.h>
using namespace std;
const string CamURL = "http://<IP_ADDRESS>:8085/";
const int fps = 30;
double getTimeStamps(int frameNum,int fps);
bool LoadCamIm... | TOOL | 0.887061 | 4.604014 |
27c7c168-1db3-4931-a86c-7c4529bc0465 | yashmaniya0/DS-and-Algorithms-CPP | segment_tree_template.cpp | /*
Author : YASH MANIYA (codheck_0) [B20CS033]
Template : https://github.com/yashmaniya0/DS-and-Algorithms-CPP/blob/master/segment_tree_template.cpp
Already fallen,
Now is the time to RISE !!!
*/
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>... | ALGO | 0.999615 | 5.096533 |
f1f46a7d-f47a-4939-a555-c2628dbea2e3 | Renumber/algorithm | ch18.prefix sum/2559/2559.cpp | /*
매일 아침 9시에 학교에서 측정한 온도가 어떤 정수의 수열로 주어졌을 때, 연속적인 며칠 동안의 온도의 합이 가장 큰 값을 알아보고자 한다.
예를 들어, 아래와 같이 10일 간의 온도가 주어졌을 때,
3 -2 -4 -9 0 3 7 13 8 -3
모든 연속적인 이틀간의 온도의 합은 아래와 같다.
1, -6, -13, -9, 3, 10, 20, 21, 5
이때, 온도의 합이 가장 큰 값은 21이다.
또 다른 예로 위와 같은 온도가 주어졌을 때, 모든 연속적인 5일 간의 온도의 합은 아래와 같으며,
-12, -12, -3, 14, 31, 28
이때, 온... | ALGO | 0.999929 | 4.295008 |
8ae66c6a-10ed-460b-b841-ea7cf9bb5752 | jh280722/online-judge | solve/codeforce/20200307/A.cpp | #include <bits/stdc++.h>
#define MAX 4097
#define INF 1000000000
#define all(v) v.begin(), v.end()
#define pii pair<int,int>
#define ll long long
#define vi vector<int>
#define vii vector<ll>
#define f(i,a,j) for(int i=a;i<j;i++)
using namespace std;
int n, m, k, t;
int dr[] = { 0,-1,0,1 };
int dc[] = { -1,0,1,0 };
in... | ALGO | 0.999898 | 4.497465 |
8ec4e875-f9d2-4f8a-873d-215f998f5e62 | rashid642/cp | extra/GrundyNumber.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define index2(i, j) cout << "(" << i << "," << j << ") "
#define index3(i, j, k) cout << "(" << i << "," << j << "," << k << ") "
#define tv(v) for(auto it: v) cout << it << " "; cout << endl
const int mod = 1e9 + 7;
// Problem Link - https://lightoj... | ALGO | 0.999986 | 4.681089 |
72e1d1cb-2765-4069-82c0-7eb9a1e259d8 | KuhuChawla/6Companies30days | Walmart/removeColoredPieces.cpp | //brute force solution passed
bool winnerOfGame(string colors) {
if(colors.size()<3){
return false;
}
int countA = 0;
int countB = 0;
for(int i=0;i<colors.size()-2;i++){
if(colors[i]=='A' && colors[i+1]=='A' && colors[i+2]=='A'){
countA++;... | ALGO | 0.999038 | 5.023098 |
71467c67-4b27-4f01-aab2-21890fa05429 | AlaminHossain01052000/competitve-programming | Graph/connectedComponentPracitce/cf-learning-language.cpp | // https://codeforces.com/problemset/problem/277/A
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+10;
vector<int> graph[N];
bool visited[N];
void dfs(int node){
visited[node]=true;
for(auto &child:graph[node]){
if(!visited[child])dfs(child);
}
}
int main(){
int n,m;
cin>>n>>m;
... | ALGO | 0.999938 | 3.832125 |
ee125889-9c33-4a34-bb05-8a3c94c0e791 | rohankale-18/CodeforcesCodes | contest_1843A.cpp | #include<bits/stdc++.h>
using namespace std;
#define int long long int
#define mod 1000000007
#define endl "\n"
#define fio ios_base::sync_with_stdio(false); cin.tie(NULL);
int32_t main(){
fio;
int t;
cin>>t;
while(t--){
int n,ans=0;
cin>>n;
vector<int> v;
for(int i=0;i<n;i+... | ALGO | 0.999615 | 4.537339 |
79597af9-83b8-4cf3-b6f9-7e5a08b6e3bb | pductrungg/DSA_241_Lab | Sort(part1)/shell.cpp | static void sortSegment(T* start, T* end, int segment_idx, int cur_segment_total) {
// TODO
int size = end - start;
for (int curr = segment_idx + cur_segment_total; curr < size; curr += cur_segment_total) {
int tmp = start[curr];
int i;
for (i = curr - cur_segment_total; i >= 0 && st... | ALGO | 0.999751 | 4.076502 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.