uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
29bac4fc-4eca-400d-a73c-df2475aa0432 | VishvmPatel/DSA | Strings/Questions/FindingDuplicatesInAString1.cpp | #include <iostream>
#include <vector>
#include <unordered_set>
#include <algorithm>
using namespace std;
// Compare with other letters
vector<char> findDuplicatesCompare(const string &s) {
unordered_set<char> duplicates;
int n = s.length();
for (int i = 0; i < n; i++) {
for (int j = i + 1; j... | ALGO | 0.999872 | 5.614799 |
c0b6b568-6514-4448-bace-5ee52274951d | fangda-cu/MultiTrackerDevelopment | ElTopo/eltopo3d/meshcutter.cpp | // ---------------------------------------------------------
//
// meshpincher.cpp
// Tyson Brochu 2011
//
// Identifies "singular vertices", defined as having more than one connected triangle neighbourhoods, and
// splits the mesh surface at these vertices.
//
// -------------------------------------------------... | ALGO | 0.999415 | 4.533632 |
3951e082-df4d-48ee-819b-3bf30f3bd809 | devashish-bhake/CSES_Solved_Problems | Two_Knights.cpp | #include<iostream>
using namespace std;
int main()
{
long long int n, i, final;
cin>>n;
for (i = 1; i <= n; i++)
{
final = (((i*i)*((i*i) - 1))/2) - (4*(i-1)*(i-2));
cout<<final<<endl;
}
} | ALGO | 0.999506 | 4.096465 |
ee23b589-1a7f-44b6-8c81-2aea0ccffbef | ismukhin/Sorting | my_sorting.cpp | #include "My_sorting.h"
#include <malloc.h>
#include <time.h>
#include <stdlib.h>
void swap(int* a, int* b) {
int temp = *a;
*a = *b;
*b = temp;
}
void BubbleSort(int* arr, int n) {
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - 1; j++) {
if (arr[j] > arr[j + 1]) {
swap(&arr[j], &arr[j + 1]);
}... | ALGO | 0.999988 | 4.010814 |
2d9e2ed7-cf04-4968-b628-b7ed1ff00a93 | vishalkandu01/leetcode_solution | 22-generate-parentheses/generate-parentheses.cpp | class Solution {
private:
void solve(int cnt1, int cnt2, int n, vector<string>& ans, string& op, int ind) {
if(ind >= n*2) {
ans.push_back(op);
return;
}
if(cnt1 < n and ind < n*2-1) {
op += '(';
solve(cnt1 + 1, cnt2, n, ans, op, ind+1);
... | ALGO | 0.999896 | 6.52844 |
49c4ee02-c00f-4985-9d7c-2df8645906dc | as3545/GFG-DSA-Questions | Multiply Array.cpp | /*
Calculate the product of all the elements in an array.
Example 1:
Input:
5
1 2 3 4 5
Output:
120
Example 2:
Input:
10
5 5 5 5 5 5 5 5 5 5
Output:
9765625
Your Task:
You don't need to read input or print anything. Your task is to complete the function product() which takes the array Arr[] and its size N as inp... | ALGO | 0.999933 | 6.058847 |
d8815077-c0b8-4050-819c-a5fff03977cf | tsnest/xray-2-2011 | sources/xray/animation/sources/mixing_n_ary_tree_weight_node.cpp | #include "pch.h"
#include "mixing_n_ary_tree_animation_node.h"
#include "mixing_n_ary_tree_weight_node.h"
#include "mixing_n_ary_tree_time_scale_node.h"
#include "mixing_n_ary_tree_addition_node.h"
#include "mixing_n_ary_tree_subtraction_node.h"
#include "mixing_n_ary_tree_multiplication_node.h"
#include "mixing_n_ary_... | ALGO | 0.851716 | 6.539732 |
9a192cdd-4deb-491f-945c-a05faf7a2860 | rohan-s-pandey/E-commerce-With-Flutter | 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 |
2ef94d3b-404e-4f3b-a9ea-ec91a274d3a1 | cjm571/Mu-Man | lib/boost_1_55_0/libs/range/test/algorithm_test/search_n.cpp | #include <boost/test/test_tools.hpp>
#include <boost/test/unit_test.hpp>
#include <boost/assign.hpp>
#include <algorithm>
#include <list>
#include <set>
#include <vector>
namespace
{
template<typename ForwardIterator, typename Integer, typename Value>
inline ForwardIterator
reference_search_n(ForwardItera... | TEST | 0.941903 | 7.500813 |
04937643-8c19-4d87-ade2-dbd927204471 | hardik121121/C-and-C-all-practice-programs | c++/pattern16.cpp | #include<bits/stdc++.h>
using namespace std;
/*
Pattern 16:-
A
BB
CCC
DDDD
EEEEE
*/
int main(){
int n;
cin >> n;
for(int i=0;i<n;i++){
char ch = 'A' + i ;
for(int j=0;j<=i;j++){
cout << ch;
}
cout << endl;
}
return 0;
} | ALGO | 0.999896 | 3.842579 |
eb0b0ee9-55b6-4cb6-b485-5cf560e8aa12 | RinCloud/TrickCatcher | Datasets/TrickyBugs/GenProgs/tc_generated_progs_cpp/p03652/p03652_num0_parsed.cpp | #include <bits/stdc++.h>
using namespace std;
const int MaxN = 303;
int n,m,a[MaxN][MaxN];
int p[MaxN],cnt[MaxN];
bool f[MaxN];
int main() {
scanf("%d%d",&n,&m);
for (int i=1;i<=n;++i) {
for (int j=1;j<=m;++j) {
scanf("%d",&(a[i][j]));
}
}
memset(f,0,sizeof f);
for (int ... | ALGO | 0.999941 | 3.479903 |
c30c9073-0ea0-43a4-806d-680647bd1baf | HackerDom/ructf-2013-final | services/database/Sources/cryptopp/ec2n.cpp | // ec2n.cpp - written and placed in the public domain by Wei Dai
#include "pch.h"
#ifndef CRYPTOPP_IMPORTS
#include "ec2n.h"
#include "asn.h"
#include "algebra.cpp"
#include "eprecomp.cpp"
NAMESPACE_BEGIN(CryptoPP)
EC2N::EC2N(BufferedTransformation &bt)
: m_field(BERDecodeGF2NP(bt))
{
BERSequenceDecoder seq(bt)... | ALGO | 0.939453 | 7.240125 |
a5ec53e4-6a3e-43d0-bee1-c3c583157dc7 | actilogi/angorafdtd | src/tfsf/Cflb.cpp | //Definition of the class "Cflb" for a TF/SF focused Hermite-Gaussian laser beam
#include "headers.h"
#include "Cflb.h"
#include "Cpw_fs.h"
#include "Cpw_2l.h"
#include "Cpw_ml.h"
//Uses TinyVector operations
#include <blitz/tinyvec2.h>
//definition of Cwf needed
#include "waveforms/Cwf.h"
//#define ANGORA_CFLB_U... | ALGO | 0.997415 | 3.754657 |
8b6f0984-a8d4-49ad-a2b4-e064ed4a176e | aryanSE7374/myCoding | coding/DSA/DSA-A2Z/03_Array/1_Easy/numberAppearOnce.cpp | #include<bits/stdc++.h>
using namespace std;
// brute : two loops count appearance, return as soon as find one with single appearance
// O(n^2)
// better soln : theta(N) , O(N^2) in case of unordered map , space : O(N/2)
// theta(NlogM) , in case of map , space : O(N/2)
class Solution {
public:
int singleNumbe... | ALGO | 0.999637 | 5.38379 |
f3bd662d-2782-4172-8579-bff67035f88f | shivammishra2004/Competitive_Programming_CPP | 746B.cpp | #include <bits/stdc++.h>
using namespace std;
#ifndef ONLINE_JUDGE
#define debug(x) cerr << #x <<" "; _print(x); cerr << endl;
#else
#define debug(x)
#endif
//#define int long long
#define MOD 1000000007
#define INF 1e18
#define fl(i,n) for(int i=0;i<n;i++)
#define sz(v) sort(v.begin(),v.end())
#define srt(v) sort(v.... | ALGO | 0.999969 | 3.179909 |
101e2018-b9f3-457c-bcc8-76e652eeaef7 | hoanxuanbach/Competitive-Programming | ICPC/Universal Cup/2nd/Stage 11 Nanjing/L.cpp | // Judges with GCC >= 12 only needs Ofast
// #pragma GCC optimize("O3,no-stack-protector,fast-math,unroll-loops,tree-vectorize")
// MLE optimization
// #pragma GCC optimize("conserve-stack")
// Old judges
// #pragma GCC target("sse4.2,popcnt,lzcnt,abm,mmx,fma,bmi,bmi2")
// New judges. Test with assert(__builtin_cpu_sup... | ALGO | 0.999884 | 4.521135 |
17cc1500-cd90-495e-895e-e3f0f56c3ef2 | NeKroFR/AdventOfCode | 2024/day03/part1.cpp | #include <vector>
#include <string>
#include <regex>
using namespace std;
int part1(const std::vector<std::string> &input)
{
int res = 0;
regex mul_pattern(R"(mul\((\d+),(\d+)\))");
for (const auto& line : input) {
sregex_iterator it(line.begin(), line.end(), mul_pattern);
sregex_iterator end;... | ALGO | 0.998824 | 5.552834 |
4478ec73-a686-4537-9647-888ae23473f9 | Craneplayz/CP-Archive | Codeforces/22A.cpp | #include <bits/stdc++.h>
using namespace std;
//Declarations
typedef deque<int> dqi;
typedef long long ll;
typedef map<int,int> mii;
typedef map<int,char> mic;
typedef map<char,int> mci;
typedef map<string,int> msi;
typedef map<string,pair<int,int>> mspii;
typedef map<string,map<int,int>> msmii;
typedef pair<int,i... | ALGO | 0.999964 | 3.956683 |
b21f0f6a-fafc-4890-8997-e03686cb0335 | plasmatic1/dmoj-solutions | cpp/coci14c3p5.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> p;
//n
const int MAX = 300001;
int n;
// sparse table
const int B_MAX = 19;
vector<int> sptable[B_MAX];
// input
char bi;
int bv, bw;
//dfs and graph theorying
vector<int> matrix[MAX];
int parent[MAX], size[MAX], top[MAX], d... | ALGO | 0.999544 | 4.09086 |
6c081528-9520-4191-ac6a-23cda9d5c78b | qiaozishun4/CSP2024_BJ | BJ-Junior/answers/BJ-J00942/poker/poker.cpp | #include<bits/stdc++.h>
using namespace std;
int n,ans=52;
string s;
map<string,bool>m;
int main(){
freopen("poker.in","r",stdin);
freopen("poker.out","w",stdout);
cin>>n;
while(n--){
cin>>s;
if(!m[s]){
m[s]=1;
ans--;
}
}
cout<<ans;
return 0;
} | ALGO | 0.995693 | 4.177137 |
19b52813-0916-405a-9376-f26f70ecd165 | JulioR10/Listas | main.cpp | #include <iostream>
#include <vector>
#include "listasimple.h"
using namespace std;
int main()
{
/*
cout << "Hello World!" << endl;
ListaSimple lista;
lista.push_back(TipoDato("algo"));
lista.push_back(TipoDato("algo mas"));
auto print = [](TipoDato& dato){
cout << pos << ": " << dato... | TOOL | 0.860624 | 4.884302 |
71b7b2c6-3310-4f65-9699-487062d7ddef | 13750404/2025aaia | week12/week12-6.cpp | // week12-6.cpp
//LeetCode 1920. Build Array from Permutation
//forj,}C ans[i] = nums[nums[i]]
class Solution {
public:
vector<int> buildArray(vector<int>& nums) {
int N =nums.size(); //}Cjp
vector<int> ans(N); //ansjpAONAp߬OAC++}C
for(int i=0; i<N; i++){
ans[i] = nums[nums[i]];/... | ALGO | 0.999982 | 5.655449 |
f85c28b9-9a4a-4d70-b343-a0df39f292ca | mballen-1/cp-solutions | cp/Codeforces/old_solutions/test.cpp | using namespace std;
#include <bits/stdc++.h>
#define all(x) x.begin(),x.end()
#define sz(x) ((int)x.size())
#define sqr(x) ((x)*(x))
#define pb push_back
#define eps 1e-9
typedef long long i64;
typedef unsigned long long ui64;
typedef string st;
typedef vector<int> vi;
typedef vector<st> vs;
typedef map<int,int> mii;
... | ALGO | 0.999989 | 3.852109 |
d590ded4-c865-4044-9003-284e049670a1 | jstringara/MC-FE | main.cpp | #include "model.hpp"
#include "option.hpp"
#include "matrix.hpp"
#include "vec.hpp"
#include "MC.hpp"
#include <iostream>
#include <chrono>
using BlackScholes = BlackScholes;
// define the normal distribution function
double N(double x) {
return 0.5 * erfc(-x / sqrt(2.0));
}
int main(int argc, char* argv[]){
... | ALGO | 0.98335 | 7.116531 |
6ca06362-d183-4e94-9a1c-6040f0dd0c64 | Hardyy00/Codeforces | 1400-rating/books.cpp | #include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i, a, b) for(int i=a;i<=b;i++)
#define all(a) (a).begin(), (a).end()
#define fauto(i,v) for(auto i : (v))
#define REPD(i,a,b) for(int i=a;i>=b;i--)
typedef long long ll;
typedef vector... | ALGO | 0.999992 | 4.556167 |
adbb4f35-2a9d-4b3e-9478-e92f44fd63eb | JunaidAlAbdullah/DS_in_cpp | DSA_Practice3.cpp | // Question: Take a singly linked list as input and print the size of the linked list.
// #include<bits/stdc++.h>
// using namespace std;
// class Node
// {
// public:
// int val;
// Node* next;
// Node(int val)
// {
// this->val = val;
// this->next = NULL;
// }
// };
... | ALGO | 0.999758 | 4.556798 |
d2dc0409-f538-499f-adba-e07a6bf29e95 | bisc67/Tribes | xCore/x_files/Implementation/x_plus.cpp | //==============================================================================
//
// x_plus.cpp
//
//==============================================================================
//==============================================================================
// INCLUDES
//========================================... | ALGO | 0.99998 | 6.075323 |
45dc91d9-7748-4166-baa9-ebf131a65fd1 | yadiqian/Codeforces | 1036B.cpp | /*
Yadi Qian
*/
#include <bits/stdc++.h>
using namespace std;
const double pi=acos(-1.0);
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef map<int,int> MPII;
typedef set<int> SETI;
typedef multiset<int> MSETI;
typedef long int i... | ALGO | 0.999958 | 3.979575 |
8bff0428-dd24-4211-b824-b4963ec7e597 | mufiye/PAT-Practice | Advanced Level/一些范式代码/math/素数判定及打表.cpp | bool isPrime(int n){
if(n <= 1) return false; //特判
int sqr = (int)sqrt(1.0 * n);
for(int i=2; i<=sqr; i++){
if(n%i == 0) return false; //n不是素数
}
return true; //n为素数
}
const int maxn = 101;
int prime[maxn], pNum = 0; //prime数组存放所有素数, pNum为素数个数
bool p[maxn] = {0}; //p[i] == true表示i是素数
void... | ALGO | 0.999171 | 3.350814 |
5161ffa9-aba6-4bfd-8007-21cc03452257 | raghuvanshraj/Competitive-Programming-Archive | Coding Ninjas/create_sieve.cpp | #include <iostream>
#include <bits/stdc++.h>
#define MAX 200
using namespace std;
vector<int> primes;
void createSieve()
{
bool sieve[MAX];
for(int i = 0; i < MAX; i++)
sieve[i] = true;
for(int i = 2; i < sqrt(MAX); i++)
{
if(sieve[i])
{
int temp = i;
for(int j = pow(i,2); j < MAX; j = i*(++temp))
... | ALGO | 0.994825 | 3.787425 |
24eb44be-4c64-4a5b-82b1-d8977456aa1e | ishandutta2007/codeforces | dreamoon_love_aa/normal/736/D.cpp | #include <bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y... | ALGO | 0.999994 | 3.602801 |
64445014-2c9c-4957-a91d-8f7a90ad81bf | miguelarauj1o/URI | src/UOJ_1037 - (677440) Accepted.cpp | #include <iostream>
using namespace std;
int main()
{
float n;
cin >> n;
if(n < 0 || n > 100){
cout << "Fora de intervalo" << endl;
}else{
if(n >= 0 && n <= 25){
cout << "Intervalo [0,25]" << endl;
}else if(n > 25 && n <= 50){
cout << "Intervalo (25,50]" << endl;
}else if(n > 50 && n <= 75){
co... | ALGO | 0.981234 | 4.091696 |
b024da6d-3c07-4eb4-be7b-c80e49601bde | TuringKi/llvm-project-12-wasi | llvm/lib/Analysis/DomTreeUpdater.cpp | #include "llvm/Analysis/DomTreeUpdater.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/Analysis/PostDominators.h"
#include "llvm/IR/Instructions.h"
#include "llvm/Support/GenericDomTree.h"
#include <algorithm>
#include <functional>
#include <utility>
namespace llvm {
bool DomTreeUpdater::isUpdateValid(
const Dom... | TOOL | 0.992743 | 7.932831 |
5f49cf2a-948f-4b51-a157-8b190904fb5e | Janmejay-Pandya/DS_code | CPT/leakyBucket.cpp | #include <bits/stdc++.h>
#include <chrono>
#include <thread>
using namespace std;
class Packet
{
// Packet class to simulate data packets.
int id, size;
public:
Packet(int id, int size)
{
// Constructor to initialize packets.
this->id = id;
this->size = size;
}
int getS... | ALGO | 0.928663 | 6.024115 |
98985bdb-9837-4c75-8cbe-96f46eb6db7a | fire63/ProjectA-card_matching | cocos2d/cocos/math/CCVertex.cpp | #include "math/CCVertex.h"
#include "base/ccMacros.h"
NS_CC_BEGIN
void ccVertexLineToPolygon(Vec2 *points, float stroke, Vec2 *vertices, unsigned int offset, unsigned int nuPoints)
{
nuPoints += offset;
if(nuPoints<=1) return;
stroke *= 0.5f;
unsigned int idx;
unsigned int nuPointsMinus = nuPoin... | ALGO | 0.992923 | 5.81487 |
c521e8ee-f964-49a9-b2d8-a02cab87f0fc | StepanRepo/AnTi-pipeline | src/frequency_response.cpp | #include"../lib/frequency_response.h"
#include"../lib/int_profile.h"
#include"../lib/raw_profile.h"
#include"../lib/custom_math.h"
#include"../lib/configuration.h"
#include"../lib/massages.h"
#include<vector>
#include<string>
#include<iostream>
#include<fstream>
using namespace std;
extern Configuration* cfg;
Frequ... | TOOL | 0.890473 | 4.460694 |
96a779d7-93c2-4abe-9b47-3cbcbce45c04 | Amankori2307/DS-Algo | revision/revision_20_nov_2021/18.cpp | // 18. Take input in 2d array and print
#include<iostream>
using namespace std;
int main(){
int n, m;
cin>>n>>m;
int arr[n][m];
for(int i=0; i<n; i++){
for(int j=0; j<m; j++){
cin>>arr[i][j];
}
}
for(int i=0; i<n; i++){
for(int j=0; j<m; j++){
c... | ALGO | 0.99723 | 3.37867 |
a237b1b2-888e-40e4-bffa-e13064d46b94 | chiachunho/NTUST_Exercise | OOP_C++/Homework/1234_textBasedHistogram/1234_textBasedHistogram/textBasedHistogram.cpp | // Student ID: B10615043
// Date: March 19, 2018
// Last Update: March 19, 2018
// Problem statement: This C++ program compute Text-based histogram.
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm> //to use "sort"
using namespace std;
int main()
{
vector<vector <int>> count;
int value;... | TOOL | 0.945344 | 5.379711 |
512b3710-5a3e-4183-b465-ea8d96b4bb52 | ArjunTa1war/codeforces | 1611b.cpp | #include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <numeric>
#define ll long long
using namespace std;
void solve()
{
int a,b;
cin>>a>>b;
cout<<min(min(a,b),(a+b)/4)<<"\n";
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t;
cin >> t;
... | ALGO | 0.999851 | 4.594016 |
9bb69040-ad4a-49da-b96b-ddefac2300bb | ishandutta2007/codeforces | ko_osaga/normal/545/E.cpp | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <limits.h>
#include <math.h>
#include <time.h>
#include <iostream>
#include <functional>
#include <numeric>
#include <algorithm>
#include <stack>
#include <queue>
#include <deque>
#include <vector>
#include <string>
#include <bitset... | ALGO | 0.999972 | 3.292787 |
918a98ef-ae8f-455b-b37b-a4486db61053 | Satya-100/GFG-problems | Difficulty: Medium/M-Coloring Problem/mcoloring-problem.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
bool isSafe(int node, int v, vector<pair<int, int>>& edges, vector<int>& color, int col){
for(auto it: edges){
int x = it.first;
int y = it.second;
if(x==node && ... | ALGO | 0.999417 | 6.386769 |
abbec40b-0261-4c64-9669-2902bf0fc3b6 | MdHamzaHossain/competitive-programming | solves/leetcode/2698_find-the-punishment-number-of-an-integer/CPP 2698_find-the-punishment-number-of-an-integer.cpp | class Solution
{
public:
bool doTheSplits(int acc, int curr, const string &chars, int s,
int target)
{
if (s == chars.length())
return target == acc + curr;
const int d = chars[s] - '0';
return doTheSplits(acc, curr * 10 + d, chars, s + 1, target) ||
... | ALGO | 0.999928 | 4.793948 |
4e43adf3-7fdc-44c8-b95c-2bc268c11015 | BorgwardtLab/SiNIMin | SiNIMin/C/methods/sinimin_func.cpp | /*
* @Author: guanja
* @Date: 2019-07-09 14:13:20
* @Last Modified by: guanja
* @Last Modified time: 2019-09-18 16:14:39
*/
#ifndef _sinimin_func_cpp_
#define _sinimin_func_cpp_
#include <iostream>
#include <iterator>
// Include C++ data classes.
#include <deque>
#include <vector>
#include <set>
#include <tuple>... | ALGO | 0.996708 | 5.354023 |
838f5ed1-84a3-4663-ac08-eddef13eeae8 | nono19972020/atcoder | ABC/ABC066/b.cpp | #include <iostream>
#include <cstdio>
using namespace std;
int main(){
string s;
cin >> s;
int n = s.size();
int length;
for(int i = 1; i < n/2; i++){
//cout << s.substr(0, n/2-i) << endl;
//cout << s.substr(n/2-i, n/2-i) << endl;
if(s.substr(0, n/2-i) == s.substr(n/2-i... | ALGO | 0.999636 | 3.272832 |
ad2c7a53-110e-46a3-a77f-14c7c0b6726b | jasojone/Cis17c2021 | cis17cMtP4.1/main.cpp | /*
* File: main.cpp
* Author: Jason
*
* Created on May 14, 2021, 11:05 PM
*/
#include <cstdlib>
#include <cmath>
#include <iostream>
using namespace std;
/* this program will find the O(N) for n! when n=1000
*
*/
int main(int argc, char** argv) {
int n = 1;
int x = 1;
while(n*x <= 10... | ALGO | 0.998964 | 4.647843 |
afb9ccbc-c0f2-4906-9da3-3d407e7de26d | yjkim0306/baekjoon | #2902.cpp | // KMP는 왜 KMP일까?
#include <iostream>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
string str, res = "";
cin >> str;
res += str[0];
for(int i = 1; i < str.length(); i++)
{
if(str[i] == '-')
res += str[i + 1];
}
... | ALGO | 0.999729 | 3.596133 |
291dbfba-d101-4114-9155-58ba76f56d6b | CoderSwarup/DSA_Mastery | 17_Pointers/6_Memory_Management/1_Stack_Heap.cpp | #include<iostream>
using namespace std;
int main(){
// Stack Memeory Allocation to Variable in C++ (Static)
int n = 10;
cout << "Static Memory Allocation : " << n << endl;
// Heap Memory Allocation to Variable in C++ (Dynamic)
int *ptr = new int;
*ptr = 129;
cout << "Dynamic Memory Allo... | ALGO | 0.937674 | 3.088253 |
67b40c56-a8ba-411c-bd78-44442f3f4af4 | tanishagandhi/LeetCode | 890-lemonade-change/lemonade-change.cpp | class Solution {
public:
bool lemonadeChange(vector<int>& bills) {
int five=0,tens=0;
for(int i=0;i<bills.size();i++){
if(bills[i]==5){
five++;
}
else if(bills[i]==10){
if(five){
tens++;
five-... | ALGO | 0.999348 | 6.136067 |
86d4000b-c5d0-4f04-8f03-4895a11e1eed | vineelkrish/Stack | ValidParanthesis.cpp | #include<bits/stdc++.h>
using namespace std;
class Solution {
public:
bool isValid(string s) {
stack<char> st;
for(auto i:s){
if(i == '(' || i == '{' || i == '[' ){ // If new bracket is introduced then me push it into our stack
st.push(i);
... | ALGO | 0.996709 | 5.800047 |
003a48b5-23d7-48e0-a89e-ac7eb4b91b79 | firedragonpzy/CSArmatureDemo | CSArmature/libs/Box2D/Dynamics/b2Island.cpp | #include <Box2D/Collision/b2Distance.h>
#include <Box2D/Dynamics/b2Island.h>
#include <Box2D/Dynamics/b2Body.h>
#include <Box2D/Dynamics/b2Fixture.h>
#include <Box2D/Dynamics/b2World.h>
#include <Box2D/Dynamics/Contacts/b2Contact.h>
#include <Box2D/Dynamics/Contacts/b2ContactSolver.h>
#include <Box2D/Dynamics/Joints/b2... | ALGO | 0.999952 | 5.837258 |
cb201410-e063-4710-a784-335f2ddb7554 | oscarklee/sunshine | src/upnp.cpp | /**
* @file src/upnp.cpp
* @brief todo
*/
#include <miniupnpc.h>
#include <upnpcommands.h>
#include "config.h"
#include "confighttp.h"
#include "main.h"
#include "network.h"
#include "nvhttp.h"
#include "rtsp.h"
#include "stream.h"
#include "upnp.h"
#include "utility.h"
using namespace std::literals;
namespace up... | WEB | 0.87398 | 6.620551 |
420fb4eb-8ea7-45e1-9510-8c94dc3005c2 | sangwoojun/bluedbm | utils/kronecker/merge.cpp | #include <stdio.h>
#include <string.h>
#include <stdint.h>
#include <stdlib.h>
#include <time.h>
#include <cstdio>
// returns true if a <= b
bool compare(uint64_t a[2], uint64_t b[2]) {
if ( a[0] > b[0] ) return false;
if ( a[0] < b[0] ) return true;
if ( a[1] > b[1] ) return false;
return true;
}
int main( int ... | ALGO | 0.968879 | 3.426738 |
2d617aa0-3774-401b-9a0e-0e01dc4c382d | ryzbaka/cpp_practice | cpp_practice/labs_session_2/exercises/lab_8/main.cpp | #include <iostream>
#include <vector>
using namespace std;
using Int32Bit = int;
using IntVector = vector<int>;
using array2d = vector<vector<int>>;
using functionPointer = void(*)(int &);
void add2(int &a){
a+=2;
}
int main(){
//function pointers example
void (*ptr)(int &);
ptr = add2;
int x... | TOOL | 0.919967 | 4.58932 |
5b8cb266-0f8b-4f71-a2a2-6b05e159f0ad | aralab-unr/LIMOwithGA | keyframe_bundle_adjustment/src/keyframe_rejection_scheme_flow.cpp | #include "internal/keyframe_rejection_scheme_flow.hpp"
namespace keyframe_bundle_adjustment {
KeyframeRejectionSchemeFlow::KeyframeRejectionSchemeFlow(double min_median_flow)
: min_median_flow_squared_(min_median_flow * min_median_flow) {
;
}
bool KeyframeRejectionSchemeFlow::isUsable(const Keyframe::Ptr&... | ALGO | 0.997747 | 6.197814 |
f360d01d-cfb5-4815-a212-0c9dee995698 | kaluginpeter/Algorithms_and_structures_tasks | CodeWars/6kyu/Sum_of_Digits_Digital_Root.cpp | // Digital root is the recursive sum of all the digits in a number.
//
// Given n, take the sum of the digits of n. If that value has more than one digit, continue reducing in this way until a single-digit number is produced. The input will be a non-negative integer.
//
// Examples
// 16 --> 1 + 6 = 7
// 942 ... | ALGO | 0.998668 | 7.127472 |
59761a43-8120-4388-aefd-de61cd80064c | raincross7/code-similarity | codes/train_code/problem398/problem398_7.cpp | #include <iostream>
using namespace std;
int main(){
int K, S;
cin >> K >> S;
int ans = 0;
for(int A=0; A<=K; A++){
for(int B=0; B<=K; B++){
if(0<=S-A-B && S-A-B<=K){
ans++;
}
}
}
cout << ans;
return 0;
} | ALGO | 0.999729 | 3.224666 |
28b14e79-0d31-495a-b983-43de11e3a161 | akihikoy/lfd_vision | include/lfd_vision/raytrace/doncross/torus.cpp | #include "algebra.h"
#include "imager.h"
namespace Imager
{
int Torus::SolveIntersections(
const Vector& vantage,
const Vector& direction,
double uArray[4]) const
{
// Set up the coefficients of a quartic equation for the intersection
// of the parametric equation P = ... | ALGO | 0.999114 | 5.911956 |
cc67bb77-edf8-43d5-b7d9-5ba87c4da143 | tuvaluhk/gem5_garnet3 | src/systemc/tests/systemc/misc/user_guide/chpt4.1/stage2.cpp | /*****************************************************************************
stage2.cpp --
Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
*****************************************************************************/
/*****************************************************************************... | ALGO | 0.998005 | 5.028528 |
3a3787d9-1b2e-4556-bba6-a62925c411e8 | kingh2160/Problems | 1826.cpp | #include <cstdio>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <unordered_map>
#include <unordered_set>
#include <fstream>
#include <cmath>
#include <ctime>
#include <vector>
#include <stack>
#include <queue>
#include <functional>
#include <list>
#include <deque>
#include <numeric>
#include <set... | ALGO | 0.999888 | 3.904281 |
bee72ece-3652-456a-a2e3-67131266e47c | UmbaDumba/codetree-TILs | 240725/둘 중 하나의 배수/multiple-of-either.cpp | #include <iostream>
using namespace std;
int main() {
// 여기에 코드를 작성해주세요.
int a;
cin >> a;
cout << ((a%3 == 0) || (a%5==0)) <<endl;
return 0;
} | ALGO | 0.999359 | 3.490571 |
4f658c6b-becf-4115-87dd-fc0917bc2756 | SeokjaeL/2023-2-VCpp | Midterm_Exam/201907011/201907011.cpp | #include <windows.h>
#include <math.h>
#define ID_BUTTON1 1
#define ID_BUTTON2 2
#define ID_BUTTON3 3
#define ID_BUTTON4 4
#define ID_BUTTON5 5
HWND hButton1, hButton2, hButton3, hButton4, hButton5;
POINT startPoint = { 0, 0 };
POINT endPoint = { 0, 0 };
int shape = 0;
HBRUSH hBrush;
bool isDrawing = false;
bool is... | TOOL | 0.954744 | 5.029305 |
2b438d20-e04a-4945-b71f-0b12cfde40ab | ehnryx/acm | bapc-2022-cf426004/k.cpp | #include <bits/stdc++.h>
using namespace std;
//%:include "utility/fast_input.h"
//%:include "utility/output.h"
using ll = long long;
using ld = long double;
constexpr char nl = '\n';
constexpr int MOD = 998244353;
constexpr ld EPS = 1e-9L;
random_device _rd; mt19937 rng(_rd());
//#define MULTI_TEST
void solve_main... | ALGO | 0.999926 | 5.276887 |
c8297890-d19f-4955-9bc5-4ce0591b6654 | CFOP2357/competitive_programing | codeforces/Codeforces Round #625 (Div. 2, based on Technocup 2020 Final Round)/E.cpp | #include <iostream>
#include <climits>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <unordered_map>
#include <unordered_set>
using namespace std;
/*
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
typedef tree<... | ALGO | 0.999869 | 3.640774 |
5ffd06ff-f278-4576-a399-05dd2571195c | ifish12/Dark-Textual | Frameworks/Blowfish Encryption/Source/Classes/misc.cpp | #include "misc.hpp"
using namespace std;
string base64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
string itos(int i, const int base)
{
if (base < 2 || base > 10 + 'Z' - 'A' + 1) return "";
string pre;
string s;
if (i < 0) {
pre = "-";
i = 0 - i;
}
do {
int digit = i % base;
c... | TOOL | 0.914625 | 4.349211 |
ce3be1fc-24c0-453f-949f-c42af16c197d | norlen/kattis | cpp/nodup.cpp | #include <iostream>
#include <unordered_set>
using namespace std;
int main() {
unordered_set<string> words;
string s;
getline(cin, s);
size_t pos = 0;
bool exists = false;
while ((pos = s.find(' ')) != string::npos) {
string ss = s.substr(0, pos);
if (words.count(ss) > 0) {
... | ALGO | 0.99992 | 4.746304 |
74ebb5ba-35fe-4f97-9094-10adad8bba59 | DISASTER-RUMBLING/CODE | 算法/Leetcode/Leetcode 2080. 区间内查询数字的频率.cpp | #define _CRT_SECURE_NO_WARNINGS
#include<vector>
#include<map>
using namespace std;
class RangeFreqQuery {
public:
map<int, vector<int>> mmp;
RangeFreqQuery(vector<int>& arr) {
int sz = arr.size();
for (int i = 0; i < sz; i++) {
mmp[arr[i]].push_back(i);
}
}
int ... | ALGO | 0.999839 | 5.584246 |
ef1a40e6-ca72-4b63-9fe8-9370ab4749ec | lovethiscode/boost | libs/graph/example/bucket_sorter.cpp | #include <boost/config.hpp>
#include <vector>
#include <iostream>
#include <stdlib.h>
#include <boost/pending/bucket_sorter.hpp>
int main()
{
using namespace std;
using boost::bucket_sorter;
const std::size_t N = 10;
vector< std::size_t > bucket(N);
for (std::size_t i = 0; i < N; i++)
{
... | ALGO | 0.996972 | 4.927099 |
9293732f-7442-40d3-8879-0354514a1aae | neha-meena-4/CrackYourPlacement | Day-1/valid-parentheses.cpp | class Solution {
public:
bool isValid(string str) {
int n=str.length();
if(str.length()%2 !=0) return false;//odd can never be valid
//Method-1:- Using switch statement
for(int i=0;i<(str.length()-1)/2;i++)
{
switch(str[i])
{
case '{': if(str[... | ALGO | 0.999566 | 6.310152 |
6fb8fba5-080e-408d-bec7-788a3a33f233 | sirelkhatim/Particle-Filter | src/particle_filter.cpp | /**
* particle_filter.cpp
*
* Created on: Dec 12, 2016
* Author: Tiffany Huang
*/
#include "particle_filter.h"
#include <math.h>
#include <algorithm>
#include <iostream>
#include <iterator>
#include <numeric>
#include <random>
#include <string>
#include <vector>
#include "helper_functions.h"
using std::string;... | ALGO | 0.991724 | 5.165623 |
72365129-0c3b-48e9-a274-87061caa15f3 | loquemedalagana/algorithm | boj_11952_zombie.cpp | #if 01
#include <iostream>
#include <queue>
#include <vector>
#include <algorithm>
#include <cstring>
#include <climits>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<ll, int> pli;
#define SIZE (int)1e5
#define INF LLONG_MAX
int N, M, K, S; ll P, Q;
vector<int> Zombie;
int danger[SIZE ... | ALGO | 0.999806 | 3.578224 |
f4713a00-88e3-40bb-9faa-6241623f19c6 | charuchauhan/NDN_Caching_Policies | examples/ndn-congestion-alt-topo-plugin.cpp | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
// ndn-congestion-alt-topo-plugin.cpp
#include "ns3/core-module.h"
#include "ns3/network-module.h"
#include "ns3/ndnSIM-module.h"
namespace ns3 {
/**
*
* /------\ 0 0 /------\
* | c1 |<-----+ ... | TEST | 0.973461 | 5.344375 |
0db5d1cb-94e2-4dc1-b376-577b4f1e313d | dingningpei/LLM_Semantics | serene-python-client-stp/stp/minizinc/chuffed-rel2onto_20170728/boost_1_87_0/libs/graph/example/ordered_out_edges.cpp | /*
IMPORTANT:
~~~~~~~~~~
This example appears to be broken and crashes at runtime, see
https://github.com/boostorg/graph/issues/149
*/
#include <boost/config.hpp>
#include <iostream>
#include <functional>
#include <string>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/properties.hpp>
... | TEST | 0.996185 | 6.615337 |
c4d8e9b5-ef27-45ae-984d-33f417e67a94 | astro-heree/Data-Structures | DSA/Linked List/Practice.cpp | #include <iostream>
using namespace std;
class Node
{
public:
int data;
Node *prev;
Node *next;
// Constructor
Node(int d)
{
this->data = d;
this->prev = NULL;
this->next = NULL;
}
~Node()
{
int value = this->data;
if (this->next != NULL)
... | ALGO | 0.999162 | 5.641767 |
767025e1-c0ce-40cb-bb46-440ceda6fa89 | Oaik/problems-solution | codeforces/contest/1009/b/47523373.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
vector<int> idx1;
vector<int> idx2;
int main() {
ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
cout << fixed << setprecision(0);
string str;
int n, numTwo = -1, ones = 0;
bool startWithTwo = false;
cin >> str;
if(str[0] == ... | ALGO | 0.999497 | 3.807519 |
66e16e34-6f11-4da2-966d-57056c413a79 | joaomarcos2803/competitive-programming | Uri/ad-hoc/1032.cpp | // https://www.beecrowd.com.br/judge/en/problems/view/1032
#include <iostream>
using namespace std;
int safePosition(int n, int prime[]) {
int sum = 0;
int i;
for (i = 1; i <= n; i++){
sum = (sum + prime[n-i]) % i;
}
return sum + 1;
}
int isPrime(int n) {
int i;
if (n == 2)
... | ALGO | 0.999935 | 4.133419 |
c6d3cd7d-a7d5-4ed8-970c-7d652965e082 | JmerklCode/ENSC251-Final-Project | templates.cpp | //----------------------------------------------------------------------------------------------------------------------
// 301398265 / 301394066 / 301386235 / 301399922
//
// Group 8
//----------------------------------------------------------------------------------------------------------------------
// All m... | TOOL | 0.910219 | 5.467059 |
a69b693a-cdf1-4911-a5d8-83c3a31edb64 | vlsi-test-lab/OpenEDA | packages/eigen-eigen-323c052e1731/doc/snippets/Tutorial_AdvancedInitialization_LinSpaced.cpp | ArrayXXf table(10, 4);
table.col(0) = ArrayXf::LinSpaced(10, 0, 90);
table.col(1) = M_PI / 180 * table.col(0);
table.col(2) = table.col(1).sin();
table.col(3) = table.col(1).cos();
std::cout << " Degrees Radians Sine Cosine\n";
std::cout << table << std::endl;
| ALGO | 0.946244 | 3.543272 |
40e8e753-61ac-4337-b483-580fc8712e8a | xhy3054/myopencv | cpp_opencv/08_feature2d_module/15_myHarris/myharris.cpp | #include "myharris.h"
using namespace cv;
// 这个函数功能模仿opencv库函数,只计算了harris响应值矩阵
void mycv::detectHarrisCorners(const Mat& imgSrc, Mat& imgDst, double alpha){
Mat gray;
if(imgSrc.channels() == 3){
cvtColor(imgSrc, gray, CV_BGR2GRAY);
}
else gray = imgSrc.clone();
gray.convertTo(gray, CV_64F);
... | ALGO | 0.999253 | 4.407275 |
df422801-bd7b-4a90-80a3-a72b60c37512 | afuu21/100daysofcode | day_79_avg-salary.cpp | class Solution {
public:
double average(vector<int>& salary) {
double max = DBL_MIN;
double min = DBL_MAX;
double sum = 0;
for(int i=0; i < salary.size(); i++){
sum += salary[i];
if(salary[i] < min)
min = salar... | ALGO | 0.9997 | 5.894617 |
f6b589b5-cb23-4d18-8696-b834d2f7ba5c | amanjha491/Leetcode_Solution | 2400-2499/2497.Maximum Star Sum of a Graph/Solution.cpp | class Solution {
public:
int maxStarSum(vector<int>& vals, vector<vector<int>>& edges, int k) {
int n = vals.size();
vector<vector<int>> g(n);
for (auto& e : edges) {
int a = e[0], b = e[1];
if (vals[b] > 0) g[a].emplace_back(vals[b]);
if (vals[a] > 0) g[b... | ALGO | 0.999989 | 5.793853 |
2d92f375-e4c7-41d2-bf76-124ad5c3d1b8 | ngng628/competitive-programming | atcoder/AHC/AHC003/archive/bunkatsu.cpp | // 90,573,157,472
# include <bits/stdc++.h>
# ifndef ngng628_library
# define ngng628_library
# define fi first
# define se second
# define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i,n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i,n) for(int i=(int)(n)-1; i>=0; --i)
# define rreps(... | ALGO | 0.999733 | 5.217866 |
5ac01a1e-fe19-4205-a52b-4cb55041cc68 | nosoul12/flip_coin | 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 |
4de891de-2a84-4d49-8028-d37244a71bfd | kazunetakahashi/atcoder | 2017/1115_ABC060/B.cpp | #include <iostream>
#include <iomanip> // << fixed << setprecision(xxx)
#include <algorithm> // do { } while ( next_permutation(A, A+xxx) ) ;
#include <vector>
#include <string> // to_string(nnn) // substr(m, n) // stoi(nnn)
#include <complex>
#include <tuple> // get<n>(xxx)
#include <queue>
#include <stack>
#include <... | ALGO | 0.999969 | 3.585773 |
e79761c6-f05f-40fa-83b6-c4e2647bca02 | Abdelaziz237/problems-algorithms | src/algorithms/KMP.cpp | #include <vector>
#include <string>
using namespace std;
void getLPS(int n, const string& pattern, vector<int>& lps) {
lps[0] = 0;
int i = 1;
int l = 0;
while (i < n) {
if (pattern[i] == pattern[l]){
l++;
lps[i] = l;
i++;
} else {
if (l ... | ALGO | 0.999887 | 6.152616 |
4114943a-fd94-47c4-82fe-a489cf86e1e6 | hek-git/problem_solving | boj/20240311_1987.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int R, C, ans, check[26];
pair<int, int> dir[4] = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}};
vector<string> map;
void dfs(pair<int, int> s, int cnt) {
for (int i = 0; i < 4; i++) {
int next_y = s.first + dir[i].first;
int ne... | ALGO | 0.999669 | 4.350032 |
952a6dc7-82b2-4174-948a-d8872fd84f93 | DivyaSharma0894/CPP_Code | Tree/iterativeinorder.cpp | #include<iostream>
#include<stack>
using namespace std;
class Node{
public:
int data;
Node* left;
Node* right;
Node(int val){
data=val;
left=right=NULL;
}
};
class tree{
Node* root;
public:
tree(){
root=NULL;
}
Node* getroot(){
return root;
... | ALGO | 0.999939 | 5.0271 |
84f368e8-ed99-451e-a268-3148a706ba3d | lsgwr/algorithms | Part13算法竞赛宝典/第一部资源包/第二章 基本结构/选择结构/计算运费.cpp | //˷
#include <iostream>
using namespace std;
int main()
{
int c,s;
float p,w,d,f;
cin>>p>>w>>s;
c=s/250; //csӳ
switch(c)
{
case 0:d=0;break;
case 1:d=2;break;
case 2:
case 3:d=5;break;
case 4:
case 5:
case 6:
case 7:d=8;break;
case 8:
case 9:
case 10:
case 1... | ALGO | 0.998638 | 3.251256 |
78140362-2487-42e3-b5a6-571e8d85ffee | MinchaoZhu/Qt-Project | minmax/func.cpp | #include "func.h"
#include "limits.h"
func::func()
{
}
int func::min(vector<int> vec){
int min = INT_MAX;
for(vector<int>::size_type i = 0;i<vec.size();++i){
min = min<vec[i]?min:vec[i];
}
return min;
}
int func::max(vector<int> vec){
int max = INT_MIN;
for(vector<int>::size_type i =... | ALGO | 0.99914 | 4.953576 |
de9c1be8-0ba0-4bb6-bec4-ac2301706450 | Himanshu241/Instagram-clone | 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.998859 | 6.785645 |
69611488-698b-4963-bb72-1f29496151e2 | surendiran04/Data-structures-and-Algorithms | Recursion/head & tail recursion.cpp | #include <iostream> //both fn takes time - O(n) , space - O(n)
using namespace std;
int head(int n){
if(n>0){
fun1(n-1); //fn is called initially then printing is done at retuning time
cout<<n<<endl;
}
return 0;
}
int tail(int n){
if(n>0){
cout<<n<<endl; //printed then the fn is called nothing performed... | ALGO | 0.999832 | 4.988485 |
551527b3-749f-4af9-b186-cae5137ee147 | masked-devil/LeetCode | 110-balanced-binary-tree/balanced-binary-tree.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.999907 | 6.379476 |
07659de7-171d-4228-9580-bfaa6b457ac3 | zlguo1996/leetcode | algorithms/cpp/#032_Longest Valid Parentheses.cpp | class Solution {
public:
int longestValidParentheses(string s) {
vector<int> lis;
for (int i=0; i<s.size(); i++) {
int c = s[i]=='('?1:0;
if (lis.empty()) {
lis.push_back(c);
}else{
// 之前有‘(’且当前为‘)’
... | ALGO | 0.999909 | 5.498678 |
0b8d4149-ac87-4fb6-99cc-34f5992d27e3 | solpie/PathSync | PathSync/pathsync.cpp | #define PATHSYNC_VER "v0.42BETA"
#include <windows.h>
#include <commctrl.h>
#include <shlobj.h>
#include <stdio.h>
#include <search.h>
#include <stdlib.h>
#include <time.h>
#include <ctype.h>
#include <shellapi.h>
#include "resource.h"
#include "../WDL/ptrlist.h"
#include "../WDL/wdlstring.h"
#include "../WDL/dirsca... | TOOL | 0.944798 | 4.846139 |
5e66a200-c968-431a-8d8e-673775ff25f1 | ThoseBygones/ACM_Code | CodeForces/CodeForces 897B.cpp | #include <bits/stdc++.h>
using namespace std;
#define MAXN 100005
#define LL long long
LL sum[MAXN];
LL getP(LL val)
{
LL temp=val;
while(temp)
{
val=val*10+temp%10;
temp/=10;
}
return val;
}
int main()
{
int n;
LL p;
scanf("%d%I64d",&n,&p);
for(int i=1; i<=1e5; i... | ALGO | 0.99991 | 3.590551 |
6a7984cb-1be4-4f75-b265-c81d61a57b5c | ishandutta2007/codeforces | endagorion/normal/1375/A.cpp | #include <bits/stdc++.h>
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define... | ALGO | 0.999741 | 3.347915 |
1897cbc7-5f6f-4f54-a2be-cf95269b7cd9 | ishandutta2007/codeforces | wangzhikun/normal/1037/A.cpp | // Author : WangZhikun
// Date : 2018.09.03
#include <cmath>
#include <queue>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
template<typename T> void read(T &x){
x = 0;ll f = 1;char ch = getchar();
while(!isdigit(ch)){if(... | ALGO | 0.999965 | 3.633687 |
2b470508-1230-4b90-9a7a-69abe56f4fed | KartikSindura/cp-solutions | C/88.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define lp(i, n) for (int i = 0; i < n; i++)
#define lps(start, n) for (int i = start; i <= n; i++)
ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
// ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
int main() {
int a, b;
cin >> a >... | ALGO | 0.999979 | 4.892214 |
ee422128-e412-432c-8e7e-df43a5ddadae | nikolapesic2802/Programming-Practice | At coder DP practice/Knapsack 1/main.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
#define ll long long
#define pb push_back
#define sz(x) (int)(x).size()
#define mp make_pair
#define f first
#define s second
#define all(x) x.begin(), x.end()
using namespace std;
using namespac... | ALGO | 0.999935 | 4.177484 |
f804e90c-31e6-4d83-910a-d6c2ec676b7a | simonyang0608/LeetCode | Array/2454.Next_Greater_Element_IV/C++/2454.Next_Greater_Element_IV.cpp | class Solution {
public:
vector<int> secondGreaterElement(vector<int> & nums)
{
//====================================//
// Input type: //
// - vector<int> ref. (nums vector) //
// Return type: //
// - vector<int> (result ... | ALGO | 0.999803 | 6.121789 |
65d8e986-7321-4ac1-b80e-ea5a33933373 | CodeTrans-Research/RefuTra | result/translate/starchat/java2cpp/c++_eval/FIND_NUMBER_TIMES_STRING_OCCURS_GIVEN_STRING_1.cpp | #include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <fstream>
#include <iomanip>
#include <bits/stdc++.h>
using namespace std;
int f_gold ( string a, string b ) {
int m = a . length ( );
int n = b . length ( );
int lookup [ m + 1 ] [ n + 1 ] = {
{
0 }
};
for ( int... | ALGO | 0.999906 | 5.625584 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.