uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
9179db5d-0914-4361-9c95-a761bbaca2f7 | kyohei8937/ProgramingContest | _other/marason.cpp | #include <bits/stdc++.h>
#include <random>
using namespace std;
#define int long long
const int INF = 1LL << 60;
const int MOD = 1000000007;
// ใใฏใญ
#define rep(i,n) for(int i=0;i<n;++i)
#define rep2(i,n,m) for(int i=n;i<m;++i)
#define ALL(x) (x).begin(),(x).end()
// ไพฟๅฉ้ขๆฐ
// ...ๆๅฐๅคใปๆๅคงๅคไบคๆ
template<class T> inline bool ... | ALGO | 0.99978 | 3.905501 |
38c7c0f6-323f-4db6-bc60-c99b85aaf9ae | ishandutta2007/codeforces | mr.ilchi/normal/338/A.cpp | /*
* in the name of god
*
*
*
*
*
*
*
*
*/
#include <iostream>
#include <fstream>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <algorithm>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map... | ALGO | 0.999952 | 3.69665 |
c48bc0f3-7ef4-4a69-bdcf-fec8891669c6 | noobermin/electro | Etest/Etest.cpp | #include "noob3d/prim.hpp"
#include <vector>
#include <iostream>
#define ELECTRO_USE_NATURAL
#include "electro.hpp"
using namespace noob3d;
using namespace electro;
typedef vector3d v3;
typedef scalar sc;
#define N 20000
int main()
{
auto E = [](v3 r, sc t)
{ return v3(1,0,0); };
auto B = [](v3 r, sc t)... | TOOL | 0.873043 | 3.107321 |
7f4f59d4-5915-4211-ac2f-339dcfb1c70f | trunghai95/MyCPCodes | Codeforces/733C.cpp | #include <bits/stdc++.h>
using namespace std;
typedef pair<int,char> pic;
#define F first
#define S second
int n, k, a[510], b, kk;
vector<pic> res;
bool proc(int u, int v) {
if (u == v) return true;
int mxi = u;
for (int i = u + 1; i <= v; ++i) {
if (a[i] > a[mxi]) {
mxi = i;
} else if (a[i] == a[mxi]) ... | ALGO | 0.999994 | 3.074619 |
f9a831e3-ceb0-4312-a04e-535c6ccbc020 | KethanPilla/Strategy-based-Game | strategy files/Strategy22.cpp |
#include "Strategy22.h"
Strategy22::Strategy22(){}
int Strategy22::MakeDecision(void){
if(movesleft<=3){
return movesleft;
}
if(movesleft==4){
return 1;
}
if(movesleft >=5 && movesleft <=7){
return movesleft-4;
}
else{
return 2;
}
}
/* Method for finding above algorithm: I noticed that if game rea... | ALGO | 0.995999 | 3.94098 |
20595cca-60fa-4497-b040-19fdf5354fad | dassatyaki/Codeforces-Solutions- | 433B - Kuriyama mirai's stone.cpp | #include <bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
ll n,m;
cin >> n;
ll v[n]={0},b[n]={0};
for(ll i=1;i<=n;++i)
{
cin >> v[i];
b[i]=v[i];
}
sort(b+1,b+n+1);
for(ll i=2;i<=n;++i)
{
b[i]+=b[i-1],v[i]+=v[i-1];
... | ALGO | 0.999082 | 3.96552 |
c33528c1-b0df-4c6d-8e2a-b0fce3da3c1c | yyashh/LeetcodeAlgo | DistributeCandies.cpp | class Solution {
public:
int distributeCandies(vector<int>& candyType) {
int m,c=1;
sort(candyType.begin(),candyType.end());
m=candyType[0];
for(int i=0;i<candyType.size();i++){
if(m!=candyType[i]){
c++;
m=candyType[i];
}
... | ALGO | 0.999975 | 5.832069 |
e3bc8b1b-f04c-460b-8c2b-4ea01ec3fd76 | Aditya-devp/Contributershub | C++/Vertical_Order_Traversal_of_Binary_Tree.cpp | //problem link: https://leetcode.com/problems/vertical-order-traversal-of-a-binary-tree/
/**
* 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(nullp... | ALGO | 0.999994 | 6.228056 |
624ba2fd-3afb-4bfd-80a7-739ec4346afa | devjit-sarkar/leet | Practice/Count Hills and Valleys in an Array/sol.cpp | class Solution {
public:
int countHillValley(vector<int>& nums) {
int count = 0;
int n = nums.size();
vector<int> m;
// cout<<((true)?prev:nums[0])<<endl;
for(int i = 0; i<n-1; i++){
if(nums[i] != nums[i+1]){
m.push_back(nums[i]);
}
... | ALGO | 0.999988 | 5.074825 |
e040bfb2-88d1-4dc2-b359-a543cf168d54 | geminiApiDevKorea/diary_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.998756 | 6.772262 |
8c02e568-6ba4-4930-b509-0778284916a7 | cp-itb/contests | IDEAFUSE2018/qualification/H-TurfaJauhYa.cpp | /**
* Contest : IDEAFUSE 2018 Qualification
* Team : TurfaJauhYa
* Author : Yonas Adiel
* Problem : H - Live Length Archiver
*/
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define vi vector<int>
#define pii pair<int,int>
#define pll... | ALGO | 0.999887 | 3.614845 |
f7aa8cc5-5bcf-4bf5-80f9-e35be4b1c48a | Jackarain/tinyrpc | third_party/boost/libs/sort/example/reverseintsample.cpp | // See http://www.boost.org/libs/sort for library home page.
// Caution: this file contains Quickbook markup as well as code
// and comments, don't change any of the special comment markups!
#include <boost/sort/spreadsort/spreadsort.hpp>
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
... | ALGO | 0.992917 | 4.58563 |
18b47e1b-c69f-4b00-8f71-ea9e37d5f615 | AMIRIOX/MyLuoguRepo | luogu/P2392.cpp | #include <iostream>
#include <cstdio>
#include <climits>
using namespace std;
const int maxn = 1000;
int minn = 0;
int s1,s2,s3,s4;
int a[maxn],b[maxn],c[maxn],d[maxn];
int __time = 0,right=0,left=0;
int* p;
void dfs(int lv,int size,int _left,int _right){
if(lv==size+1){
minn=min(minn,(_right>_left ? _right... | ALGO | 0.999885 | 3.008174 |
c0013dce-20bf-418a-a1fa-045b3e859e1e | Vidhichib123/Vidhi-Chib-2023a1r041-CPP-lab | gfg_array_index.cpp | #include<iostream>
using namespace std;
class index
{
private: int n,a[100],x;
public: index()
{
int size;
cout<<"Enter the size of array";
cin>>size;
n=size;
}
public: void array()
{
cout<<"Enter the elements of array\n";
for(int i=0;i<n;i++)
... | ALGO | 0.969226 | 3.761101 |
97408d0f-f21a-43d2-b07a-a375e07c6a6b | tarekchy30/DSA | 03. Array Item Searching.cpp | // Online C++ compiler to run C++ program online
#include <iostream>
using namespace std;
// Array element Searching ๐
int main() {
int arr[10];
int n;
int size;
int flag =0;
cin>>size;
cout<<"Enter array elements: ";
for(int i=0; i<size; i++){
cin>>arr[i];
}
... | ALGO | 0.998951 | 5.599058 |
d15ee8d6-a4e8-4e30-9c41-dabce6ebbaba | SAMIUL-35/my_codeforces_contest | div_4_944/Clock_and_Strings.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define op() \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
int main ()
{
op();
ll t;
cin>>t;
while (t--)
{
ll a,b,c,d;
cin>>a>>b>>c>>d;
ll m = min(a, b);
... | ALGO | 0.999778 | 3.76137 |
616ca3f8-7e44-43ee-8e3b-f4b4a2361719 | jhn5052/BOJsolution | 2638.cpp | #include <iostream>
#include <queue>
#include <cstring>
using namespace std;
int N, M;
int cnt = 0;
int visit[101][101];
int map[101][101];
int dir[4][2] = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}};
bool isRange(int y, int x){
if(y >= 0 && x >= 0 && y < N && x < M){
return true;
}
return false;
}
void B... | ALGO | 0.999844 | 4.154056 |
6313c0a0-9e05-4421-bbf7-49aa4213b93a | wsehjk/algorithm | cpp/string_search/robin-karp.cpp | // string search algorithm using string hash
// note: hash match cannot guarantee string match.
| ALGO | 0.97198 | 5.037992 |
d099ed51-cb13-4f15-bff6-35dd77bf4e67 | GitmeRiz/notes | 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 |
1a727f8c-1f01-4b2c-9475-749de82283b3 | Alvence/CPXC | CPXC_loss/opencv2.14/nbayes.cpp | #include "precomp.hpp"
#include <math.h>
CvNormalBayesClassifier::CvNormalBayesClassifier()
{
var_count = var_all = 0;
var_idx = 0;
cls_labels = 0;
count = 0;
sum = 0;
productsum = 0;
avg = 0;
inv_eigen_values = 0;
cov_rotate_mats = 0;
c = 0;
default_model_name = "my_nb";
}
... | ALGO | 0.995387 | 6.529631 |
00b47eb2-6fbf-4d50-8ab5-13312277b7ec | ehnryx/acm | codeforces/1114/d.cpp | #include <bits/stdc++.h>
using namespace std;
#define _USE_MATH_DEFINES
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef complex<ld> pt;
typedef vector<pt> pol;
const char nl = '\n';
const int INF = 0x3f3f3f3f;
const ll INFLL = 0x3f3f3f3f3f3f3f3f;
const ll MOD = 1e9+7;
const ld EPS = 1... | ALGO | 0.999981 | 4.672721 |
4a5fdf2d-a2c5-405a-bc35-1c6ce7e4a270 | Sifathislam/PhitronAllPrograms | DSA/ALGORITHMS/Week 1/Module 2.5ParcticeDay/MaximumCountofPositiveIntegerandNegativeInteger.cpp | // https://leetcode.com/problems/maximum-count-of-positive-integer-and-negative-integer/description/
// class Solution {
// public:
// int maximumCount(vector<int>& nums) {
// if(nums[0] > 0) return nums.size();
// if(nums[nums.size() - 1] < 0) return nums.size();
// int neg = 0;
//... | ALGO | 0.999887 | 5.253512 |
9bd6debe-a3ae-46e8-9212-508877d7d308 | GusdittoRNB/flutter_application_1 | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.9988 | 6.76073 |
ac3b43b5-1b2a-4acf-837a-60f6eabbd674 | Geetansh01/oops-cwh-codes | tut19_FuctionOverloading.cpp | #include<iostream>
using namespace std;
//Function Overloading
int volume(int l, int b, int h){
return l*b*h;
}
float volume(int r, int h){
return 3.14*r*r*h;
}
float volume(int r){
return (4/3)*3.14*r*r*r;
}
int main(){
cout<<"Volume of Cuboid:"<<volume(3,4,5)<<endl;
cout<<"Volume of Cylinder:... | ALGO | 0.948102 | 3.654156 |
d5a8f345-2f52-4089-bb31-3108272ea6b5 | fabianpro/rugmad | interpreter.cpp | // Definimos el entorno de ejecuciรณn
typedef struct {
int variables[256]; // Asumiendo que las variables son identificadores simples de un solo carรกcter
} Environment;
void executeAST(ASTNode *node, Environment *env);
void executeShow(ASTNode *node) {
printf("%s\n", node->left->value);
}
void executeRepeat(A... | ALGO | 0.850755 | 6.938093 |
c1eb7d29-2dbf-4172-9bab-62a0056c5366 | nandiniindrale/Nandini-2020BIT012 | indicrants/10.cpp | #include <bits/stdc++.h>
using namespace std;
void fact(int n)
{
if (n == 0)
{
return;
}
fact n * fact(n - 1);
}
int main()
{
int n;
cin >> n;
fact(n);
return 0;
} | ALGO | 0.999913 | 4.612225 |
f72e0ba5-27d0-43f6-b91a-9a8c2ca608ea | shishirRsiam/CSE-Fundamentals-With-Phitron | 2. C++ For DSA/Module 7/counting_sort.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
string name;
cin>>name;
// sort(name.begin(),name.end());
// cout<<name;
int frq[26]={0};
for(char c:name)
{
frq[c-'a']++;
}
for(char i='a';i<='z';i++)
{
for(int j=0;j<frq[i-'a'];j++)
cout<<i;
}... | ALGO | 0.999901 | 3.692249 |
75996eab-9ef7-498c-9d0a-c09ef320a85d | sarvex/leetcode-holy-c | solution/1200-1299/1286.Iterator for Combination/Solution.cpp | class CombinationIterator {
public:
int size;
string cs;
int curr;
CombinationIterator(string characters, int combinationLength) {
int n = characters.size();
curr = (1 << n) - 1;
reverse(characters.begin(), characters.end());
cs = characters;
size = combinationLe... | ALGO | 0.999942 | 5.837918 |
c40127e9-91be-4c3b-9df4-4d2affb96690 | sodabeans/Algorithm | Baekjoon/Miscellaneous/c and cpp files/2442.cpp | #include <iostream>
#include <string>
using namespace std;
int main(){
int n, i, j;
cin >> n;
for (i = 1; i <= n; i++){
for (j = 0; j < (n - i); j++){
cout << " ";
}
for (j = 0; j < (2 * i - 1); j++){
cout << "*";
}
cout << "\n";
}
... | ALGO | 0.999969 | 4.079079 |
968d1b0b-dc5a-4dc8-a07e-7b6542530e2d | raincross7/code-similarity | codes/train_code/problem129/problem129_357.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int x, y;
cin >> x >> y;
if (x % y == 0) {
cout << -1 << '\n';
} else {
cout << x << '\n';
}
}
| ALGO | 0.999894 | 3.917168 |
58fdfa5a-d042-430e-bb89-536e905327c1 | Oaik/problems-solution | codeforces/contest/1105/b/48650098.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define all(v) ((v).begin()),((v).end())
#define sz(x) ((int) (x).size())
#define clr(a,b) memset(a,b,sizeof(a))
const double EPS = 1e-8;
const double pi = acos(-1);
int dcmp(double a, double b) {
return fabs(a - b) <= EPS ? 0 : a < b ? -1 : 1;
... | ALGO | 0.999542 | 3.124882 |
9af4980d-2168-44b1-a3bb-f05fc17c4c38 | 13750404/2025aaia | week04/week04-3.cpp | /// week04-3.cpp
/// ีฆU for j GX@ C++
#include <stdio.h>
int main()
{
int N = 5;
for(int i=0; i<N; i++){
printf("%d ", i);
} ///qq 0 }l
printf("\n"); ///
for(int i=1; i<=N; i++){
printf("%d ", i);
} ///Hq 1 }l
printf("\n"); ///
for(int i=N-1; i>=0; i--){
printf(... | ALGO | 0.999756 | 3.286302 |
c67f1dfb-d869-4d80-8d97-858a0d0f3d02 | PJayB/jk2src | CODE-mp/jpeg-6/jcdctmgr.cpp | #define JPEG_INTERNALS
#include "jinclude.h"
#include "jpeglib.h"
#include "jdct.h" /* Private declarations for DCT subsystem */
/* Private subobject for this module */
typedef struct {
struct jpeg_forward_dct pub; /* public fields */
/* Pointer to the DCT routine actually in use */
forward_DCT_method_ptr do_... | ALGO | 0.995535 | 6.539783 |
4342fc2d-6e98-4c01-83af-63e13850cb09 | beyanger/leetcode | algorithm/cpp/617.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
TreeNode* mergeTrees(TreeNode* t1, TreeNode* t2) {
if (t1 == 0 && t2 == 0) return 0;
TreeNo... | ALGO | 0.999993 | 6.351242 |
e0e234e2-a9a8-4301-bb14-a5d581b311ec | Francis1408/LeetCode | Medium/11.cpp | // MEDIUM - 11. Container With Most Water
// SOLUTION - The volume will always be limited to the lowest edge of the container
// So you calculate the currentVol, check if it is bigger and then move the pointer
// from the edge which is smaller, in order to attemp to find an edge which is bigger
#include<iostream>
#in... | ALGO | 0.999926 | 6.473403 |
fd3d5aa3-c240-4a62-a6d7-22ff3a5f2c0c | fabiatan/leetcode | STLarray.cpp | #include <iostream>
#include <array>
using namespace std;
void print_array(array<int, 20> data) {
for (int i=0; i<data.size();i++) {
cout << data[i] << '\t';
}
cout << '\n';
}
int main() {
array<int, 20> data = {1,2,3};
print_array(data);
int k = 3;
int* guess = &k;
*guess = ... | TOOL | 0.869099 | 3.474528 |
91baeba7-f7e4-4e15-82e2-9cb8ec1a6021 | rezagvn/Face-Recognition | opencv-master/modules/dnn/src/layers/softmax_layer.cpp | #include "../precomp.hpp"
#include "layers_common.hpp"
#include "../op_cuda.hpp"
#include "../op_halide.hpp"
#include "../op_inf_engine.hpp"
#include "../ie_ngraph.hpp"
#include "../op_vkcom.hpp"
#include <algorithm>
#include <stdlib.h>
using std::max;
#ifdef HAVE_OPENCL
#include "opencl_kernels_dnn.hpp"
using namesp... | ALGO | 0.991565 | 7.56012 |
f6019b31-e334-47f3-a46b-a8b1d293c710 | vicoslab/legit | src/common/math/geometry.cpp | /* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4; tab-width: 4 -*- */
#include "common/math/geometry.h"
#include "common/utils/utils.h"
#include "common/utils/debug.h"
#include <stdio.h>
#include <stdlib.h>
#include <opencv2/imgproc/imgproc.hpp>
using namespace legit;
using namespace legit::common;
Matrix3... | ALGO | 0.997528 | 5.549082 |
03d06b2d-11af-4fef-8ec1-1491740d10c7 | its-Saurabh23/DSA | Babbar_phase_2.cpp/Recursion_4.cpp | #include<bits/stdc++.h>
using namespace std;
void reversee(string& str,int i,int j){
cout<<" call recieved for "<<str<<endl;
// base case
if(i>j){
return ;
}
swap(str[i++],str[j--]);
// recursive call
reversee(str,i,j);
}
int main(){
string name ="ABCD";
cout<<endl;
reversee... | ALGO | 0.999775 | 4.689065 |
30938437-d4b7-4b4b-a20b-07595f9cae7e | Marcus-techtile/Mobile_robot_controllers | src/robot_controllers/robot_dynamic_controllers/include/eigen/doc/examples/TutorialInplaceLU.cpp | #include <iostream>
struct init {
init() { std::cout << "[" << "init" << "]" << std::endl; }
};
init init_obj;
// [init]
#include <iostream>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main()
{
MatrixXd A(2,2);
A << 2, -1, 1, 3;
cout << "Here is the input matrix A before decompositi... | ALGO | 0.999659 | 3.799226 |
11449b26-4a5d-4a09-9647-28fbe261feab | tim7en/SedSatV2_electron | resources/app/R-Portable-Win/library/Rcpp/unitTests/cpp/dispatch.cpp | #include <Rcpp.h>
using namespace Rcpp ;
template <typename T>
T first_el_impl(const T& x) {
T res(1);
res[0] = x[0];
return res;
}
// [[Rcpp::export]]
SEXP first_el(SEXP x) {
RCPP_RETURN_VECTOR(first_el_impl, x);
}
template <typename T>
T first_cell_impl(const T& x) {
T res(1, 1);
res(0, 0) ... | TOOL | 0.976473 | 5.070723 |
4751622b-7198-42d5-86b3-e467ade93c86 | sun-jaeyun/flutter_study | image_carousel/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.997769 | 6.786404 |
0676a301-651a-485a-99b3-86ee21904cf9 | noureldin-khaled/workspace | C++/UVA/Newspaper.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int t;
scanf("%i",&t);
while(t--)
{
int m;
scanf("%i",&m);
map<char, int> mp;
while(m--)
{
char c;
int v;
scanf(" %c%i",&c,&v);
mp[c] = v;
}
int l;
scanf("%i\n",&l);
double res = 0;
while(l--)
{
string line;
get... | ALGO | 0.992421 | 3.968592 |
c5ef1413-4e2e-4b08-84eb-a52dd0962554 | yubaoliu/Algorithm | CPPExample/example/p2956.cpp | //https://www.luogu.com.cn/problem/P2956
#include <iostream>
#include<cstring>
using namespace std;
bool a[240 + 5][240 + 5];
void func(int x, int y, int s, int t)
{
for (int i = x; i <= s; i++)
for (int j = y; j <= t; j++)
a[i][j] = 1;
}
int main()
{
int m, n, c; // m: rows; n: cols; c: num... | ALGO | 0.999873 | 3.800215 |
65b070fe-9e7f-407c-baf2-83970dd988ef | kiptechie/hackerank | 30 - days of code/Testing/testing.cpp | /*
Day 27: Testing
This problem is all about unit testing.
Your company needs a function that meets the following requirements:
For a given array of n integers, the function returns the index of the element with the minimum value in the array. If there is more than one element with the minimum value, the returned ind... | TEST | 0.887275 | 7.425164 |
58c54fa4-0d8d-4f9a-8482-7ffbe7071a40 | apavlenko/android-ndk | sources/cxx-stl/llvm-libc++/libcxx/test/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter.pass.cpp | // <queue>
// template <class InputIterator>
// priority_queue(InputIterator first, InputIterator last);
#include <queue>
#include <cassert>
int main()
{
int a[] = {3, 5, 2, 0, 6, 8, 1};
int* an = a + sizeof(a)/sizeof(a[0]);
std::priority_queue<int> q(a, an);
assert(q.size() == an - a);
assert(... | TEST | 0.946142 | 4.36952 |
7808b959-2b88-4b36-9665-987feb1f24d3 | panda959595/boj_algorithm | boj_algorithm/1120.cpp | #include <iostream>
#include <string>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
string a, b;
cin >> a >> b;
int ans = a.length();
for (int i = 0; i <= b.length() - a.length(); i++) {
int temp = 0;
for (int j = 0; j < a.length(); j++) {
if (a[j] != b[i + j]) {
temp++;... | ALGO | 0.999847 | 3.555229 |
e864223a-5ad8-4c73-80b4-0d95890be0da | nico0129/Quantlib | ql/experimental/finitedifferences/fdsimpleextoujumpswingengine.cpp | /* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*! \file fdsimpleextoujumpswingengine.cpp
\brief Finite Differences engine for simple swing options
*/
#include <ql/termstructures/yieldtermstructure.hpp>
#include <ql/experimental/processes/extouwithjumpsprocess.hpp>
#include <ql/ex... | ALGO | 0.997798 | 7.383923 |
f6d06e9e-7346-46e2-baa4-0ddf5ed2e62e | Leaves333/competitive-programming | cf/2032/c.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int t; cin >> t;
while (t--) {
int n; cin >> n;
vector<int> arr(n);
for (int i = 0; i < n; i++) {
cin >> arr[i];
}
sort(arr.begin(), arr.end());
vector<int> pair_sums(n - 1);
for (int i = 0; i < n - 1; i++) {
pair_sums[i] = arr[i] + arr... | ALGO | 0.999965 | 5.105584 |
f685d752-6028-4aa9-9370-ec9f482576c2 | devhysterical/LeetCode_300BCTN | ConvertSortedArray _to_BinarySearchTree/108.cpp | /*
https://leetcode.com/problems/convert-sorted-array-to-binary-search-tree/description/
1. The sortedArrayToBST function is the main entry point, which takes the sorted array nums.
2. It calls the helper function sortedArrayToBSTHelper, passing the array, left, and right indices.
3.In the sortedArrayToBSTHelper funct... | ALGO | 0.999997 | 7.413105 |
081eb482-ee80-457f-b5a7-c173c775b096 | sandeep-git-box/mission-peace-interview | C++/Number Theory Algorithms/Sieve of Eratosthenes.cpp | #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
const int MAX = 1000*1000;
const int LMT = 1000;
vector<bool> prime(MAX+1,true);
int seiveEratosthenes(){
prime[0] = prime[1] = false;
for(int i = 2; i <= LMT; i++){
if(prime[i]){
for(int j = i + i; j <= MAX ; j ... | ALGO | 0.997925 | 4.918923 |
07050044-5f7b-4f1d-b82d-bb62a565da2e | ishandutta2007/codeforces | burnedchicken/normal/1130/B.cpp | #include <bits/stdc++.h>
#include <bits/extc++.h>
using namespace std;
using namespace __gnu_pbds;
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,avx,avx2,tune=native")
#define int long long
#define ull unsigned long long
#define ld long double
#define rep(a) rep1(i,a)
#define rep1(i... | ALGO | 0.99997 | 4.285347 |
e57d0986-85cb-4b86-9b0f-297d3395c7c1 | MostafaMohamed2001/C-Data-Structure | .history/hello_20240714171558.cpp | #include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <math.h>
using namespace std;
int main() {
int n , o=0,e =0;
cin >> n;
int arr[n];
for (int i = 0; i < n-1; i++){
cin >> arr[i];
}
sort(arr, arr + n);
for (int i =0; i < n; i+=2){
e += ... | ALGO | 0.999933 | 3.754006 |
10311e3a-58fc-414d-9b4c-d4e05c1bb3d8 | cabbagecabbagecabbage/Competitive-Programming | CodeForces Solutions/1437C _ Chef Monocarp/113669014.cpp | #pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
using namespace std;
// #include <ext/pb_ds/assoc_container.hpp>
// using namespace __gnu_pbds;
template<typename T> void in(T& x){ cin >> x; }
template<typename T, typename... Args> void in(T& x, Args&...args){ cin >> x, in(args.... | ALGO | 0.999727 | 4.891502 |
1cd81aad-1d3f-4b2c-be99-1fe43b0c5c82 | ishandutta2007/codeforces | gmusya/normal/1566/A.cpp | #include <iostream>
using namespace std;
typedef long long ll;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int t;
cin >> t;
while (t--) {
ll n, s;
cin >> n >> s;
ll pos = n / 2 + 1;
ll L = 0, R = 1e9;
while (L != R) {
ll M = (L + R + 1) / 2;
if (M * pos <= s) {
... | ALGO | 0.999935 | 3.672577 |
858f4933-1fb9-4ca5-8a15-2ead17f9884d | KunalNarkhedePatil/LogicBuilding | ProblemsOnPatterns/ReversedPyramidPattern.cpp | /*
Enter the number of rows
5
Enter the number of columns
5
-------------------------
* * * * * * * * *
* * * * * * *
* * * * *
* * *
*
--------------------------
*/
#include <iostream>
using namespace std;
class Demo
{
public:
int iRows;
int iCols;
Demo(int iRows, int iCols)
{
... | ALGO | 0.998006 | 4.277501 |
9b3742e4-514c-4b41-ab31-9755ecedc529 | DarkCoder13/Data-Structures | removeduplicatesofstring.cpp | //remove consecutive duplicates of string e.g ccoooding-->coding
#include<iostream>
#include<cstring>
using namespace std;
void removeDuplicates(char a[]){
int l=strlen(a);
if(l==1 || l==0){
return ;
}
int previous=0;
int current;
for(current=1;current<l;current++){
if(a[current]... | ALGO | 0.999926 | 4.152142 |
0bb1eb0e-76d6-4eec-b6f1-78573cc8c463 | ishandutta2007/codeforces | kostia244/normal/1433/C.cpp | #pragma GCC optimize("O2,unroll-loops")
#pragma GCC target("avx,avx2,sse,sse2,ssse3,sse4,sse4.1")
#include <bits/stdc++.h>
#define all(x) x.begin(), x.end()
using ll = long long;
#define int ll
using namespace std;
const int maxn = 1<<19;
const int inf = 1e18;
int32_t main() {
ios::sync_with_stdio(0);
int t;
cin >> ... | ALGO | 0.99983 | 4.093858 |
d3e26557-80e3-4038-b574-a4947d345a98 | ishandutta2007/codeforces | tfg/normal/1451/D.cpp | #include <iostream>
#include <vector>
#include <chrono>
#include <random>
#include <cassert>
std::mt19937 rng((int) std::chrono::steady_clock::now().time_since_epoch().count());
int main() {
std::ios_base::sync_with_stdio(false); std::cin.tie(NULL);
int t;
std::cin >> t;
while(t--) {
long long n, k;
std::cin ... | ALGO | 0.999255 | 4.254204 |
c202f87c-b39f-4600-8bff-b041112c35d1 | om1024bhosale/Daily-DSA-Practice | Math/Leetcode/50-pow-x-n.cpp | /*
link -> https://leetcode.com/problems/powx-n/description/
Implement pow(x, n), which calculates x raised to the power n (i.e., xn).
Example 1:
Input: x = 2.00000, n = 10
Output: 1024.00000
Example 2:
Input: x = 2.10000, n = 3
Output: 9.26100
Example 3:
Input: x = 2.00000, n = -2
Output: 0.25000
Explanation: 2-2... | ALGO | 0.999926 | 7.046473 |
4f4a9cbf-717d-4675-aa84-0264e2a36e48 | mshoe/DiffMPMAnimator3D | deps/igl/copyleft/cgal/point_mesh_squared_distance.cpp | template <
typename Kernel,
typename DerivedP,
typename DerivedV,
typename DerivedF,
typename DerivedsqrD,
typename DerivedI,
typename DerivedC>
IGL_INLINE void igl::copyleft::cgal::point_mesh_squared_distance(
const Eigen::PlainObjectBase<DerivedP> & P,
const Eigen::PlainObjectBase<DerivedV> & V,
c... | ALGO | 0.999067 | 6.87568 |
d885bfac-6499-493d-86db-122dc132745c | KhaledKammoun/LeetCode | Easy/1221. Split a String in Balanced Strings/1221. Split a String in Balanced Strings.cpp | class Solution {
public:
int balancedStringSplit(string s) {
int som = 0 , l=0,r=0 ,len= s.length();
for (int i = 0 ;i< len ; i++){
if (s[i]=='R')
r++ ;
else
l++ ;
if (l==r){
som++ ;
l=r=0 ;
... | ALGO | 0.999731 | 5.634111 |
ee8039db-f81d-4728-820c-5c04f0e21b3e | Adwin2/Ray_CS_log | C++/WareHouse/Algorithm_prac/luogu/easy08.cpp | //#include<iostream>
//using namespace std;
//#include<bitset>
//#include<vector>
//#include<string>
//class Solution {
//public:
// string addBinary(string a, string b) {
// if (a[0] == '0' && b[0] == '0') {
// string a = "0";
// return a;
// }
// bitset<10000> b1(a);
// bitset<10000> b2(b);
// bitset<10000> ... | ALGO | 0.99986 | 4.775755 |
8f0abe5d-bbd9-4b47-8b14-1d82eaafcb74 | KrishikaThapar-24/POTD | feb18.cpp | //18 feb 2025
class Solution {
public:
string smallestNumber(string pattern) {
int n = pattern.length();
string num = ""; //(n+1) //index 0 to index n
int counter = 1;
stack<char> st;
for(int i = 0; i <= n; i++) {
st.push(counter + '0');
counter++;
... | ALGO | 0.999826 | 5.963094 |
d22a7b98-d247-486a-a337-fa2c56e539db | LuoQinXuan/Cplusplus-Primer-Plus-example | chapter05/formore.cpp | // formore.cpp -- more looping with for
#include<iostream>
const int ArSize = 16; // example of external declaration
int main()
{
long long factorials[ArSize];
factorials[1] = factorials[0] = 1LL;
for(int i = 2; i < ArSize; i++)
{
factorials[i] = i * factorials[i-1];
}
for(int i = 0; i < ArSize; i++)
{
std:... | ALGO | 0.999288 | 3.094039 |
1bbf3140-df72-4424-9207-33b3940ff7e2 | tingxueren/cstudy | cplusplusprimer/source/11/elim-dups.cpp | #include "algs_preamble.h"
#include <fstream>
using std::ifstream;
#include <cstddef>
using std::size_t;
int main()
{
vector<string> words;
// copy contents of each book into a single vector
string next_word;
while (cin >> next_word) {
// insert next book's contents at end of words
words.push_back(next_word);
... | ALGO | 0.997851 | 4.575926 |
3d219fb9-b061-4289-9e56-b295ec990209 | TuanHung1149/DSA_Report | Test_genarate.cpp | #include <bits/stdc++.h>
using namespace std;
#define N (long long)(1e6)
string s;
double a, b, c;
double arr[N + 5];
int main(int argc, char* argv[])
{
s = argv[1];
s = "./Testcase/input" + s + ".inp";
mt19937 mt(time(nullptr));
freopen(s.c_str(), "w", stdout);
for(int i = 1; i <= N; i++)
{
... | ALGO | 0.999537 | 3.294587 |
8e5ee566-38a4-4fd8-9baf-b0b124eb8d4b | Irinaa21/MP | miMP/ejercicios/rel_t2_p2/ej_24.cpp | /*Realizar una funciรณn que acepte una matriz de enteros y devuelva el nรบmero de columnas
รบnicas de la matriz, es decir, aquellas para las que NO existe otra columna en la matriz
con los mismos valores*/
#include <iostream>
#include <string>
using namespace std;
//!Metodo modificado, no coger de aqui
void readMatrix(... | ALGO | 0.999384 | 4.486941 |
c4434c33-1339-4bea-bdcb-f23660af6be3 | RationalKuma4/ClubAlgoritmia | ProblemaI/main.cpp | #include <iostream>
#include <vector>
using namespace std;
struct Hotel
{
int PrecioPersona;
vector<int> CamasDisponiblesFin;
Hotel(int precioPersona)
{
PrecioPersona = precioPersona;
}
};
int main()
{
int n, b, h, w;
while (cin >> n >> b >> h >> w)
{
vector<Hotel> ho... | ALGO | 0.999263 | 3.679268 |
e12dbc8b-2078-4854-afe4-61179bb9c6fb | PhoenixNil/Data-structure-and-algorithm | PAT/1028.cpp | #include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
typedef struct student
{
string ID;
string name;
int grade;
} learner;
vector<struct student> students;
int comp1(learner a, learner b)
{
return a.ID < b.ID;
}
int comp2... | ALGO | 0.999509 | 4.217945 |
304591a3-f8c1-4c62-a46b-db276ee970c6 | modgeosys/geos | source/operation/overlay/EdgeSetNoder.cpp | #include <vector>
#include <geos/operation/overlay/EdgeSetNoder.h>
#include <geos/geomgraph/Edge.h>
#include <geos/geomgraph/index/EdgeSetIntersector.h>
#include <geos/geomgraph/index/SimpleMCSweepLineIntersector.h>
#include <geos/geomgraph/index/SegmentIntersector.h>
using namespace std;
using namespace geos::algori... | ALGO | 0.972713 | 5.274004 |
152687d3-6329-4975-8edd-231f0fdae245 | xamarin/Urho3D | Source/ThirdParty/Bullet/src/BulletSoftBody/btSoftBodyHelpers.cpp | ///btSoftBodyHelpers.cpp by Nathanael Presson
#include "btSoftBodyInternals.h"
#include <stdio.h>
#include <string.h>
#include "btSoftBodyHelpers.h"
#include "LinearMath/btConvexHull.h"
#include "LinearMath/btConvexHullComputer.h"
//
static void drawVertex( btIDebugDraw* idraw,
const btVector3& x,btScal... | TOOL | 0.928206 | 5.091721 |
5b0ede3a-4e82-4284-8259-7dec1f0efbee | toproof25/OK-problem-solving | ํ๋ก๊ทธ๋๋จธ์ค/0/181862.โ
์ธโ
๊ฐ์โ
๊ตฌ๋ถ์/์ธโ
๊ฐ์โ
๊ตฌ๋ถ์.cpp | #include <string>
#include <vector>
#include <iostream>
using namespace std;
vector<string> solution(string myStr) {
vector<string> answer;
string str = "";
for (int i=0; i<myStr.size(); ++i) {
if (myStr[i] > 'c') {
str += myStr[i];
if (i==myStr.size()-1)
... | ALGO | 0.996741 | 4.574127 |
dae85765-cc86-44d4-8759-d1acf1e1ee2e | rohan-g0re/Leetcode_practice | Day4/diameter_of_BT.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.999986 | 6.795956 |
5ca464cf-4d6b-4433-b6cc-c1986e9e1d6b | parthtyagii/DSA-Codes | MidPointRunner.cpp | #include <iostream>
using namespace std;
class node
{
public:
int data;
node *next;
// constructor:
node(int data)
{
(this)->data = data;
next = NULL;
}
};
void insertAtHead(node *&head, int d)
{
if (head == NULL)
{
head = new node(d);
return;
}
... | ALGO | 0.999898 | 4.085773 |
a08de9b7-a0f4-49c4-a88a-846b38058d33 | 260058433/LeetCode | src/025_ReverseNodesInKGroup.cpp | #include "ListNode.cpp"
class ReverseNodesInKGroup {
public:
ListNode *reverseKGroup(ListNode *head, int k) {
if (k <= 1)
return head;
ListNode **p = &head;
while (*p != nullptr) {
ListNode *q = *p;
int i = 1;
while (q->next != nullptr && i !=... | ALGO | 0.999924 | 5.45351 |
5f0e5af6-c41f-414e-8008-f91879d91403 | Ri-Nai/CompetitionCode | ACM/2024-2025-1/ๆญ็ตๅคๆ ก/7/Hold_em_Shark.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline")
#pragma GCC optimize("-fgcse")
#pragma GCC optimize("-fgcse-lm")
#pragma GCC optimize("-fipa-sra")
#pragma GCC optimize("-... | ALGO | 0.999905 | 5.425023 |
98dc9b92-89b4-4b98-b51b-1aa990079ac1 | AmitPinhas/Work | advcpp/iq/Codility/Lesson 7 - Stacks and Queues/Nesting/nesting.cpp | // https://app.codility.com/demo/results/trainingY35J9M-CHF/
int solution(string &S)
{
int result = 1;
size_t leftBracket = 0;
for(auto element: S)
{
if(element == '(')
{
++leftBracket;
}
else
{
if(0 == leftBracket)
{
... | ALGO | 0.987787 | 3.91831 |
67b06544-a845-4b3c-8d34-147e65018247 | Amylo-jh/baekjoon | 10000s/10871.cpp | #include <iostream>
#include <vector>
using namespace std;
int main()
{
vector<int> num;
int X;
int length;
int counter = 0;
int tmp;
cin >> length >> X;
while (counter < length)
{
cin >> tmp;
num.push_back(tmp);
counter++;
}
counter = 0;
while (counter < length)
{
if (num[counter] < X)
{
c... | ALGO | 0.999948 | 3.097665 |
243ab1ef-83d3-48cb-bdd3-863a89d6d82b | ishandutta2007/codeforces | takio/normal/519/A.cpp | #include <bits/stdc++.h>
#define LL long long
using namespace std;
const int N = 100100;
int v[1010];
int main () {
// freopen ("in.txt", "r", stdin);
char c;
v['q'] = 9; v['r'] = 5; v['b'] = 3; v['n'] = 3; v['p'] = 1; v['k'] = 0;
v['Q'] = -9; v['R'] = -5; v['B'] = -3; v['N'] = -3; v['P'] = -1; v['K']... | ALGO | 0.998946 | 4.428894 |
a774b9aa-d17b-4917-a0b0-98642e2ce85f | sqmedeiros/sblp2023-time-vs-energy | 1636-Coin_Combinations_II/c++/rand30/3208532.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n,k;
cin >> n >> k;
vector<int> coins(n);
for (auto &i : coins) cin >> i;
vector<vector<int>> dp(n+1, vector<int>(k+1,0));
for (int i = 0; i <= n; i++)
{
dp[i][0] = 1;
}
for (int riga = 1; riga <= n; r... | ALGO | 0.999989 | 4.81145 |
71d33f0f-4a85-4252-aa76-9dbea61441f2 | openglredbook/examples | src/12-imageprocessing/12-imageprocessing.cpp | /* $URL$
$Rev$
$Author$
$Date$
$Id$
*/
// #define USE_GL3W
#include <vermilion.h>
#include "vapp.h"
#include "vutils.h"
#include "vbm.h"
#include "vmath.h"
#include <stdio.h>
BEGIN_APP_DECLARATION(ImageProcessingComputeExample)
// Override functions from base class
virtual void Initialize(cons... | TOOL | 0.870951 | 6.71929 |
60324755-cd2f-4e82-ae70-32b59092454a | LuthfiMayoga44/Semester2 | Tugas/Tugas 11/11.1.cpp | #include <iostream>
#include <vector>
#include <limits>
#include <set>
#include <map>
using namespace std;
void tambahkanSisi(map<char, vector<pair<char, int> > >& graf, char u, char v, int w) {
graf[u].push_back(make_pair(v, w));
graf[v].push_back(make_pair(u, w));
}
int dijkstra(map<char, vector<pair<char,... | ALGO | 0.999943 | 5.567081 |
0ceeaeb6-ad19-4129-b29b-c31cbc4e4a23 | baofuhann/FISCO_BCOS_FL | deps/src/boost/libs/math/example/bernoulli_example.cpp | #pragma warning (disable : 4100) // unreferenced formal parameter.
#pragma warning (disable : 4127) // conditional expression is constant.
//#define BOOST_MATH_OVERFLOW_ERROR_POLICY ignore_error
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/math/special_functions/bernoulli.hpp>
#include <iostream... | ALGO | 0.996225 | 5.106843 |
ae0092f1-f4fd-4376-b691-b15ca003546b | henrylai9168/opencv_and_fltk | opencv/sources/samples/cpp/intersectExample.cpp | /*
* Author: Steve Nicholson
*
* A program that illustrates intersectConvexConvex in various scenarios
*/
#include "opencv2/imgproc.hpp"
#include "opencv2/highgui.hpp"
using namespace cv;
using namespace std;
// Create a vector of points describing a rectangle with the given corners
static vector<Point> makeRect... | ALGO | 0.999209 | 6.691697 |
b8815819-16f0-494c-917e-f94feb0ee34c | tin10401/CodeForces | Museum_CEOI17_museum.cpp | //โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
//โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
//โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
//โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
//โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
//โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
// __________________
// | ________________ |
// || ____ ||
// ||... | ALGO | 0.999922 | 4.387818 |
c4988039-91b3-44d5-8748-95464c961a43 | PRANAVJARANDE/Leetcode-Solutions | hard/Shortest Path Visiting All Nodes.cpp | class Solution {
public:
int shortestPathLength(vector<vector<int>>& adj)
{
int n=adj.size();
if(n==1)return 0;
queue<pair<int,int>>q1;
vector<vector<int>>vis(n,vector<int>((1<<n),0));
for(int i=0;i<n;i++)
{
q1.push({i,(1<<i)});
vi... | ALGO | 0.999964 | 5.321122 |
8a376358-bb24-476c-aa3f-548d72371fa0 | yubaoliu/Algorithm | CPPLib/src/dynamic_progamming.cpp | #include "dynamic_programming.h"
// ๆฏๅฆๅญๅจไธไธชๆนๆก๏ผไฝฟๅ
ถๅไธบS, arr={3, 34, 4, 12, 5, 2}
bool whetherSumIsS(int arr[], int n, int S)
{
if (S == 0)
return true;
if (n == 0)
{
return (arr[0] == S);
// if (arr[0] == S)
// return true;
// else
// return false;
}
... | ALGO | 0.999847 | 3.687768 |
98e6a8f3-3c55-472e-861c-df6e652229e5 | rt-kill/CompetitiveProgramming | LeetCode/Hard/minimum-sum-of-values-by-dividing-array/main.cpp | #include <bits/stdc++.h>
using namespace std;
/* Macros {{{ */
/* A lot of this is from some of Benq's submissions
[https://codeforces.com/profile/Benq]
Ugly af to the eyes, but with vim fold its barable
Hopefully c++20 concepts can make all this stuff must cleaner */
/* Basics {{{ */
using ll = long lon... | ALGO | 0.999993 | 5.545561 |
7fe8a0e3-206b-4e41-8e39-041befdc0b40 | Nikhilsharmaiiita/LeetcodeCracker | sort-an-array/sort-an-array.cpp | class Solution {
public:
vector<int> sortArray(vector<int>& nums) {
sort(nums.begin(),nums.end());
return nums;
}
}; | ALGO | 0.999897 | 5.819174 |
9e39aeab-55e7-4216-a0b7-f76dfe83ac0e | dimock/shallow | source/engine.cpp | #include "engine.h"
#include "MovesGenerator.h"
#include "Helpers.h"
namespace NEngine
{
void Engine::SearchContext::reset()
{
sdata_.reset();
sres_.reset();
eval_.reset();
clearStack();
for (auto& m : moves_) {
m = SMove{true};
}
stop_ = false;
}
void Engine::SearchContext::clearStack()
{
for (a... | ALGO | 0.957601 | 6.468603 |
e6b669f9-9240-4a41-b982-4ab45411e454 | harry-dev98/CompetitiveCodingSolutions | codeforces/1380A_ThreeIndices.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int t, n;
cin>>t;
while(t--){
cin>>n;
vector<int> P(n);
for(int& _: P)cin>>_;
bool ans = 0;
for(int i=1; i<n-1; i++){
if(P[i] > P[i-1] && P[i] > P[i+1]){
ans = true;
... | ALGO | 0.999676 | 3.410136 |
c40aae78-a1ae-47ab-818e-40718db629d8 | Sravanthkande/LeetCode | 0783-search-in-a-binary-search-tree/0783-search-in-a-binary-search-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.99999 | 6.23586 |
767a7364-7dcb-4197-81ef-3ad4755b1fc9 | ishandutta2007/codeforces | vepifanov/normal/248/A.cpp | #include <cstdio>
#include <numeric>
#include <iostream>
#include <vector>
#include <set>
#include <cstring>
#include <string>
#include <map>
#include <cmath>
#include <ctime>
#include <algorithm>
#include <bitset>
#include <queue>
#include <sstream>
#include <deque>
using namespace std;
#define mp make_pair
#define ... | ALGO | 0.999972 | 3.935165 |
87ff14ed-ba4b-4b00-9285-7a64a745642f | syafiraarif/194_ConditionalStatement | Bilangan A dan Bilangan B/Bilangan A dan Bilangan B.cpp | //
#include <iostream>
using namespace std;
int main()
{
int nbilA, nbilB;
string status;
srand(time(0));
nbilA = rand() % 6;
nbilB = rand() % 2;
if (nbilA == nbilB) {
status = "sama besar";
}
else if (nbilA > nbilB) {
status = "bilangan A lebih besar dari bilangan B";
}
else {
status = "bilangan... | ALGO | 0.998644 | 3.346095 |
173d5eb8-9c04-40fd-818b-dacb037e60d3 | ishandutta2007/codeforces | rushcheyo/normal/1156/E.cpp | #include<bits/stdc++.h>
using namespace std;
int n,p[200005],q[200005],lg2[200005],mx[20][200005],ans;
int better(int x,int y){
return p[x]>p[y]?x:y;
}
int query(int l,int r){
int x=lg2[r-l+1];
return better(mx[x][l],mx[x][r-(1<<x)+1]);
}
void solve(int l,int r){
if(l>r)return;
int m=query(l,r);
// printf("%d %d... | ALGO | 0.999958 | 3.555655 |
cc96f60c-566b-4dad-98ba-76ebe1ecebbd | FaAwZaSh/CSE-106-DSA-1 | Week-7/Submission folder/2205147/2205147_dfs.cpp | #include<iostream>
#include<vector>
#include<stack>
using namespace std;
void dfs(int node, vector<vector<int>> &adjList, vector<int> &visited, int cc){
stack <int> s;
s.push(node);
visited[node] = cc;
while(!s.empty()){
node = s.top();
s.pop();
for(int i = 0; i < adjList[node... | ALGO | 0.99999 | 4.682865 |
7fe41fab-6802-403d-9028-67a1c766dc17 | jayanshchauhan/Leetcode-for-SDE | 2116-check-if-a-parentheses-string-can-be-valid/2116-check-if-a-parentheses-string-can-be-valid.cpp | class Solution {
public:
bool canBeValid(string s, string locked) {
std::stack<int> leftStack, starStack;
for(int i = 0; i < s.length(); i++) {
if(locked[i] == '0'){
s[i] = '*';
}
}
for(int i = 0; i < s.length(); i++) {
... | ALGO | 0.999353 | 5.381566 |
48939ee6-37e3-457e-9f12-d63d7a7bb6f1 | validity-check/AstroPi | .venv/Lib/site-packages/sklearn/svm/src/liblinear/tron.cpp | #include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include "tron.h"
#ifndef min
template <class T> static inline T min(T x,T y) { return (x<y)?x:y; }
#endif
#ifndef max
template <class T> static inline T max(T x,T y) { return (x>y)?x:y; }
#endif
static void default_print(const char *buf)
{... | ALGO | 0.99963 | 5.858219 |
ac85841d-1a55-410d-834d-5b7b13c7a3bf | orehusLina/uni-bullshit | inf-proga/8. trees/1del.cpp | #include <iostream>
#include <string>
#include <stack>
using namespace std;
struct tree { // ััััะบัััะฐ ะดะตัะตะฒะพ
int inf;
tree *left; // ัะบะฐะทะฐัะตะปั ะฝะฐ ะปะตะฒะพะณะพ ัะตะฑะตะฝะบะฐ
tree *right; // ัะบะฐะทะฐัะตะปั ะฝะฐ ะฟัะฐะฒะพะณะพ ัะตะฑะตะฝะบะฐ
tree *parent; // ัะบะฐะทะฐัะตะปั ะฝะฐ ัะพะดะธัะตะปั
};
tree *node(int x) { // ัะพะทะดะฐะฝะธะต ะฝะพะฒะพะณะพ ัะทะปะฐ
... | ALGO | 0.999937 | 4.371777 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.