uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
86397fab-7f95-4933-b996-29a133799f69 | irajankumar/CPP-Fun | hckrstl/main.cpp | #include <iostream> // std::cout
#include <algorithm> // std::lower_bound, std::upper_bound, std::sort
#include <vector> // std::vector
int main () {
int myints[] = {10,20,30,30,20,10,10,20};
std::vector<int> v(myints,myints+8); // 10 20 30 30 20 10 10 20
std::sort (v.begin(), v.end()); ... | ALGO | 0.999529 | 4.507007 |
0b9f4a92-1651-4a06-b2db-a1ca25060cd3 | Abhinay8506/Stringsrevision. | Palindromic Substrings.cpp | class Solution {
public:
/*bool palindrome(string s){
int n=s.length();
for(int i=0;i<=n/2;i++){
if(s[i]!=s[n-i-1])
{
return false;
}
}
return true;
}*/
int palicount(string s,int l,int r){
int count=0;
while(... | ALGO | 0.999988 | 6.268758 |
e41e5182-d815-46fe-8f92-78ae55191321 | weixsong/algorithm | leetcode/8.cpp | #include <iostream>
using namespace std;
class Solution {
public:
int myAtoi(string str) {
int idx = 0;
while (str[idx] == ' ')
{
idx++;
}
bool negative = false;
if (str[idx] == '-')
{
negative = true;
idx++;
}
... | ALGO | 0.998385 | 4.865842 |
62d7e11f-da38-4490-9767-09d2221444c4 | sp4ghet/comp | abc176/a.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vint = vector<int>;
using vvint = vector<vint>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vchar = vector<char>;
using vvchar = vector<vchar>;
using vp = vector<P>;
using vpp = vector<pair<P, P>>;
using vvp ... | ALGO | 0.999325 | 4.444135 |
4655fbd7-e593-4606-abe6-5687dc0ad6d0 | truongcongthanh2000/TrainACM-ICPC-OLP | 2020 ICPC Vietnam Southern Provincial/B.cpp | #pragma GCC diagnostic ignored "-Wunused-parameter"
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define INP "OB"
#define OUT "OB"
const long long INF_LL = 1e17;
const int INF = 1e9 + 100;
const int MOD = 1e9 + 7;
const int Base = 311;
const double EPS = 1e-7;
const int BLOCK = 1000;
const... | ALGO | 0.992148 | 4.438433 |
bd1ee810-2971-4430-838d-42807f27c0c9 | XDEv11/Codeforces | Edu_Round_168/A.cpp | //#pragma GCC optimize ("O3")
#include <iostream>
#include <string>
using namespace std;
namespace {
void solve() {
string s{};
cin >> s;
int n{s.size()};
for (int i{0}; ; ++i) {
if (i + 1 == n || s[i] == s[i + 1]) {
for (int j{0}; j <= i; ++j) cout << s[j];
cout << (s[i] == 'z' ? 'y' : 'z');
... | ALGO | 0.99908 | 4.573678 |
847556d5-04ec-4dcf-bb7e-ae34a760701f | Suvrojyoti/APS-2020 | Codeforces_Submissions/1101C.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define f first
#define s second
int main()
{
ll t;
cin >> t;
while(t--)
{
ll n,tmp=-1,mx=0,l,r;
cin >> n;
pair<ll,pair<ll,ll> > arr[n];
ll ans[n];
for (int i=0; i<n; i++)
{
... | ALGO | 0.999966 | 3.3921 |
50e0162b-faba-47ee-80fc-d4e390b14214 | ArminEttenhofer/thesis_sweet_coupling | sweet/src/programs/PDE_SWESphere2D/TimeOld/PDESWESphere2DTS_l_irk_na_sl_nr_settls_uv_only.cpp | /*
* Author: Martin SCHREIBER <<EMAIL>>
*/
#include "PDESWESphere2DTS_l_irk_na_sl_nr_settls_uv_only.hpp"
bool PDESWESphere2DTS_l_irk_na_sl_nr_settls_uv_only::implementsTimesteppingMethod(const std::string &i_timestepping_method)
{
timestepping_method = i_timestepping_method;
if (i_timestepping_method == "l_irk_n... | ALGO | 0.991652 | 6.247294 |
269d5432-085e-4bfc-8bbc-c00f60e3d869 | ishandutta2007/codeforces | keshi/normal/327/D.cpp | //In the name of GOD
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll maxn = 500 + 100;
const ll mod = 1e9 + 7;
const ll inf = 1e18;
#define fast_io ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb push_back
#define pll pair<ll, ll>
#define F first
#define S second
ll n, m;... | ALGO | 0.999853 | 3.279645 |
796a0da6-9a78-474c-9769-b53ad821aee9 | rinavazz/Ejercicios-FDP | array1.cpp | #include <iostream>
using namespace std;
int main() {
int N;
cout << "Cantidad de números: ";
cin >> N;
int arr[N];
cout << "Introduce los números:\n";
for(int i = 0; i < N; i++) {
cin >> arr[i];
}
int suma = 0;
for(int i = 0; i < N; i++) {
suma += arr[i];
}
... | ALGO | 0.954111 | 4.425792 |
f16857db-856f-4c9e-9ab8-9e5401a8d8e9 | gajgeospatial/Geos-3.11.1 | src/algorithm/hull/ConcaveHull.cpp | #include <geos/algorithm/hull/ConcaveHull.h>
#include <geos/algorithm/hull/HullTri.h>
#include <geos/algorithm/hull/HullTriangulation.h>
#include <geos/geom/Coordinate.h>
#include <geos/geom/Geometry.h>
#include <geos/geom/GeometryFactory.h>
#include <geos/geom/Polygon.h>
#include <geos/operation/overlayng/CoverageUni... | ALGO | 0.999302 | 7.378818 |
047cf4e1-5f57-4ffb-9651-95be2b54416c | aagammehta999/DSA | map.cpp | #include <iostream>
#include <map>
#include <unordered_map>
using namespace std;
int main()
{
unordered_map<string, int> m;
// insert
// pehla tarika
pair<string, int> p = make_pair("aagam", 3);
m.insert(p);
// dusra tarika
pair<string, int> pair2("Love", 2);
m.insert(pair2);
// ... | TOOL | 0.948859 | 4.66175 |
ef6d6043-6b12-40be-ba9d-a49b4060f829 | hardik302001/leetcode | problems/same_tree/solution.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.999958 | 6.603775 |
b8bd2931-2a38-477b-adac-562b5875ab51 | Sushil2002/Problem-Solving | B_Remove_Prefix.cpp | #include <bits/stdc++.h>
#include <iostream>
typedef long long ll;
using namespace std;
// ASCII of 'a'-97,'z'-123,'A'-65,'Z'-90,'0'-48,'9'-57
bool sortby(const pair<ll, ll> &a, const pair<ll, ll> &b)
{
return a.second < b.second;
}
signed main()
{
ll t;
cin >> t;
while (t--)
{
ll n;
... | ALGO | 0.999507 | 4.102827 |
3673267d-a14d-44ca-ae4f-8d219361eb1f | chirag1992m/geeky | HackerRank/30 Days of Code/binary_search_trees.cpp | /*
Binary Search Trees
https://www.hackerrank.com/challenges/30-binary-search-trees
*/
#include <iostream>
#include <cstddef>
using namespace std;
class Node{
public:
int data;
Node *left;
Node *right;
Node(int d){
data = d;
left = NULL;
right =... | ALGO | 0.999884 | 6.049805 |
34245a9e-9096-4d2c-b4a8-9c62df5839b7 | nanahoshi114/PC-code-save | others/月赛 微信步数.cpp | #include <iostream>
#include <algorithm>
#include <utility>
using namespace std;
using ll = long long;
const int MAXN = 100005;
ll n, m, k;
ll sum, bic[MAXN];
pair<ll, ll> wat[MAXN];
int main(){
ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
cin >> n >> m >> k;
for(int i = 1; i <= m; i++){
cin >> w... | ALGO | 0.999941 | 3.403368 |
e9dd510f-5859-4c02-9a3f-74890e564237 | habanero-rice/hclib | test/performance-regression/full-apps/qmcpack/src/QMCHamiltonians/NonLocalECPotential_CUDA.cpp | #include "QMCHamiltonians/NonLocalECPotential_CUDA.h"
#include "QMCHamiltonians/NLPP.h"
#include "Particle/MCWalkerConfiguration.h"
namespace qmcplusplus
{
NonLocalECPotential_CUDA::NonLocalECPotential_CUDA
(ParticleSet& ions, ParticleSet& els, TrialWaveFunction& psi,
bool usePBC, bool doForces) :
NonLocalECPotent... | ALGO | 0.98529 | 5.833973 |
44bf9574-3abb-4204-8f3e-41fc0bddfd94 | tomo1010blue/AtCoder | ABC/ABC172/A.cpp | #include <bits/stdc++.h>
#include <atcoder/all>
#define fi first
#define se second
#define repl(i, l, r) for (int i = l; i < r; ++i)
#define rep(i, r) repl(i, 0, r)
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define sz(x) ((int) (x).size())
... | ALGO | 0.999208 | 3.433395 |
8f37469d-436b-4702-8a12-4cd60cf51239 | cran/AMISforInfectiousDiseases | src/compute_weight_matrix_empirical_histogram.cpp | #include <RcppArmadillo.h>
#include "functions.h"
//' @title Compute weight matrix using empirical Radon-Nikodym derivative (Rcpp version)
//' @description Compute matrix describing the weights for each parameter sampled, for each
//' location. One row per sample, one column per location. Each weight
//' is compute... | ALGO | 0.999848 | 6.507457 |
238f643f-de5f-4f21-806c-9946260fd951 | SantiagoBaezDuic/UTN-AyED-Ejercicios | 1.2.1/Ejercicio26.cpp | #include <iostream>
using namespace std;
/*
Consigna:
Sea un conjunto de valores numéricos que finaliza al ingresar un 0 (cero), informar
cuál es el mínimo valor considerando sólo aquellos que pertenecen al intervalo [-16, 27].
*/
int main()
{
int num;
cout << "Ingrese valores númericos, finaliza al ingresar ... | ALGO | 0.996989 | 5.013586 |
a9de4266-912b-436f-8cfe-42744c43959e | mahmudul35/data-structure | Problem/bear and big bro.cpp | #include<iostream>
using namespace std;
int main()
{
int a,b,i=0;
cin>>a>>b;
while(true)
{
i++;
a=a*3;
b=b*2;
if(a>b)
break;
}
cout<<i<<endl;
return 0;
}
| ALGO | 0.999827 | 3.703757 |
0c13713f-6d60-4442-8612-20cf13831a26 | ldorelli/curso_de_verao_maratona_icmc | Problemas/Contando_Pares/2.cpp | #include <iostream>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <utility>
#include <cstring>
#include <string>
#include <cstdio>
#include <cmath>
#include <cstdlib>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
t... | ALGO | 0.999945 | 3.038334 |
dd746a0e-9d7a-4361-b486-ea319bca1f4c | wasit7/toi | minstep/minstep.cpp | #include <iostream>
#include <algorithm>
#define LARGE 40000
using namespace std;
int F(int x, int* C){
if(C[x]<LARGE) return C[x];
int minch;
if(x<=1){
C[x]=0;
return 0;
}
else{
int i;
minch=F(x-1,C);
if(x%2==0){
i=F(x/2,C);
if(i<minc... | ALGO | 0.999902 | 3.346572 |
1253e8ef-3933-45ba-ab6d-75ca1f6ea82e | KailasMahavarkar/interview-prep | Codeforces/1000/bogosort_codeforces_B.cpp | #include <algorithm>
#include <climits>
#include <iostream>
#include <iterator>
#include <tuple>
#include <vector>
using namespace std;
#pragma GCC optimize("O3,unroll-loops")
// [ 3, 2, 3, 2 ]
// +-----+------+-----------+
// | i | a[i] | i - a[i] |
// +-----+------+-----------+
// | 0 | 3 | -3 |
// | ... | ALGO | 0.999794 | 5.460337 |
8d3e8be5-5252-495a-9c53-98e38336dd74 | kinggreat24/dv-loam | orb_slam2/Thirdparty/LidarIris/LidarIris.cpp | #include "LidarIris.h"
#include "fftm/fftm.hpp"
cv::Mat1b LidarIris::GetIris(const pcl::PointCloud<pcl::PointXYZ> &cloud)
{
cv::Mat1b IrisMap = cv::Mat1b::zeros(80, 360);
for (pcl::PointXYZ p : cloud.points)
{
float dis = sqrt(p.data[0] * p.data[0] + p.data[1] * p.data[1]);
float yaw = (at... | ALGO | 0.968747 | 3.619372 |
d7a13998-cefd-49ba-9807-f7854c1986d1 | redmonsteroid/3practice | 1.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <unordered_set>
using namespace std;
struct Student {
string first_name;
string last_name;
};
// Функция для вывода списка студентов
void print_students(const vector<Student>& students) {
for (const auto& student : stud... | ALGO | 0.999568 | 6.317253 |
00a62da7-5867-4983-80f4-92e314a92018 | KOMALDEWNANI/PROBLEM---SOLVING | Arrays/DuplicatesInArray.cpp | class Solution{
public:
vector<int> duplicates(int arr[], int n) {
// code here
set<int> s;
int i = 0;
while(i<n){
if(arr[i] != arr[arr[i]])
swap(arr[i], arr[arr[i]]);
else
i++;
}
for(int i = 0 ; i < n; i++){
... | ALGO | 0.999764 | 4.945278 |
b6a7dd44-524d-42e7-89ca-e3489fda79df | csiefer2/TrilinosMirror2 | packages/shylu/shylu_dd/core/src/epetra/shylu_probing_operator.cpp | #include <Epetra_Operator.h>
#include <Epetra_CrsMatrix.h>
#include <Epetra_LinearProblem.h>
#include <Amesos_BaseSolver.h>
#include <Ifpack_Preconditioner.h>
#include <Epetra_MultiVector.h>
#include <Teuchos_Time.hpp>
#include "shylu_probing_operator.h"
// TODO: 1. ltemp is not needed in the all local case.
ShyLU_Pr... | ALGO | 0.993286 | 5.991473 |
d3277ad5-2b7e-4972-9f7a-6a53ce316332 | vidit8patel/Solutions | Replace O's with X's - GFG/replace-os-with-xs.cpp | // { Driver Code Starts
// Initial Template for C++
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
// User function Template for C++
class Solution{
public:
void dfs(vector<vector<char>> &mat,int i, int j, int n, int m)
{
if(i<0 || j<0 || i>=n || j>=m || mat[i][j]!='O')
return;
mat... | ALGO | 0.999713 | 5.982913 |
3210175a-d6ed-4879-8779-59f82f050547 | CarloNicolini/GibbsGibbs | src/eigen/doc/examples/class_VectorBlock.cpp | #include <Eigen/Core>
#include <iostream>
using namespace Eigen;
using namespace std;
template<typename Derived>
Eigen::VectorBlock<Derived>
segmentFromRange(MatrixBase<Derived>& v, int start, int end)
{
return Eigen::VectorBlock<Derived>(v.derived(), start, end-start);
}
template<typename Derived>
const Eigen::Vec... | TOOL | 0.950124 | 4.383477 |
f57b464c-6702-4b46-8718-0e7a21e243e7 | Adi1222/Coding-Interview-Preparation | Leetcode/Graph/JumpGame3.cpp | /*
Given an array of non-negative integers arr, you are initially positioned at start index of the array. When you are at index i, you can jump to i + arr[i] or i - arr[i], check if you can reach to any index with value 0.
Notice that you can not jump outside of the array at any time.
*/
class Solution
{
public:
... | ALGO | 0.999998 | 5.644053 |
ea3a4575-277e-49de-8f15-d1717915d837 | eric-meyer/silly_goose_times | Chapter01/1_3.cpp | /*Write a program that calculates how much a garden
center spent to make a flower garden display */
#include <iostream>
#include <iomanip>
using namespace std;
int main(void)
{
double soil_cost, seeds_cost, fence_cost, total_cost;
//determine cost of soil
cout<<"How much did the soil cost?\n";
cin>>s... | TOOL | 0.86265 | 4.560111 |
fb782f16-fe72-4f99-ae04-724d11ad9e08 | Adi2209/DSA | 0427-construct-quad-tree/0427-construct-quad-tree.cpp | /*
// Definition for a QuadTree node.
class Node {
public:
bool val;
bool isLeaf;
Node* topLeft;
Node* topRight;
Node* bottomLeft;
Node* bottomRight;
Node() {
val = false;
isLeaf = false;
topLeft = NULL;
topRight = NULL;
bottomLeft = NULL;
... | ALGO | 0.999768 | 6.15199 |
76682f24-41db-449e-9b3f-f7f7b7407c5f | genericSpecimen/problem-solving | hackerrank/counting_valleys.cpp | #include <iostream>
int main() {
int n;
std::cin >> n;
std::string path;
std::cin >> path;
int altitude = 0;
int num_valleys = 0;
for(int i=0;i<path.length();i++) {
if(path[i] == 'U') {
altitude++;
if(altitude == 0) num_valleys++;
} else if(path[i] ... | ALGO | 0.999584 | 5.016065 |
f7df37f4-1060-4f69-902c-3e538be9906c | WeDot-Engine/WeDot | thirdparty/embree/kernels/bvh/bvh_builder_twolevel.cpp | #if !defined(_CRT_SECURE_NO_WARNINGS)
#define _CRT_SECURE_NO_WARNINGS
#endif
#include "bvh_builder_twolevel.h"
#include "bvh_statistics.h"
#include "../builders/bvh_builder_sah.h"
#include "../common/scene_line_segments.h"
#include "../common/scene_triangle_mesh.h"
#include "../common/scene_quad_mesh.h"
#define PROFI... | ALGO | 0.960322 | 6.24169 |
c6bd79ed-eebc-455f-a7cc-5d6fa4029387 | ArtiGaund/Leetcode | 1334-find-the-city-with-the-smallest-number-of-neighbors-at-a-threshold-distance/1334-find-the-city-with-the-smallest-number-of-neighbors-at-a-threshold-distance.cpp | class Solution {
public:
int findTheCity(int n, vector<vector<int>>& edges, int Threshold) {
vector<pair<int,int>> adj[n];
for(auto e:edges)
{
adj[e[0]].push_back({e[1],e[2]});
adj[e[1]].push_back({e[0],e[2]});
}
priority_queue<pair<int,int>,vector<pai... | ALGO | 0.999995 | 6.197282 |
4c3c3ab7-2c1f-41ef-a8d2-ae507a76147a | meherajmithun/problem-solving | codeforces/A_Lever.cpp | // IN THE NAME OF ALLAH
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
#define print(x) cout << x << '\n'
#define mod 1000000007
int dx[] = {0, 0, +1, -1};
int dy[] = {+1, -1, 0, 0};
// int dx[] = {+1, 0, -1, 0, +1, +1, -1, -1};
// int dy[] = {0, +1, 0, -1, +1, -1, +1, -1};
voi... | ALGO | 0.999957 | 4.292848 |
4c57dd57-8f24-4620-8a6e-3d307f3b0884 | windyanggreni/utsmobile_windyanggreni | 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 |
b6ff6bdd-af19-4b9a-a0ff-9d6ffdefc31d | robot-control-frame/rcf_control_ros1 | rcf_control/rcf_common/src/filters.cpp | #include "rcf_common/filters/filters.h"
#include "rcf_common/math_utilities.h"
namespace rcf_filters {
/*---------------------------------RampFilter---------------------------------*/
template<typename T>
RampFilter<T>::RampFilter(T acc, T dt) {
acc_ = acc;
dt_ = dt;
RampFilter::clear();
}
template<typename T>
... | TOOL | 0.942357 | 5.957854 |
aa087881-e273-4eda-b8a5-ad678f759820 | CTSRD-CHERI/llvm | tools/llvm-dwarfdump/Statistics.cpp | #include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringSet.h"
#include "llvm/DebugInfo/DIContext.h"
#include "llvm/DebugInfo/DWARF/DWARFContext.h"
#include "llvm/DebugInfo/DWARF/DWARFDebugLoc.h"
#include "llvm/Object/ObjectFile.h"
#define DEBUG_TYPE "dwarfdump"
using namespace llvm;... | TOOL | 0.905129 | 7.890661 |
62def181-8c84-45c8-84f7-e3883038c688 | lzh12139/MySolutions | training/20200110-day1/I.cpp | #include<bits/stdc++.h>
using namespace std;
typedef pair<double,double> pii;
#define ff first
#define ss second
pii p[10010];
struct FastIO {
static const int LEN=1<<18|1;
char buf[LEN],wbuf[LEN];
int s=0,t=0,wpos=0;
inline int read(){
return (s==t)&&(t=(s=0)+fread(buf,1,LEN,stdin)),s==t?-1:buf[s++];
}
inline ... | ALGO | 0.999779 | 3.429219 |
47ae3e74-3efb-4aba-bc28-d13f0a2566b1 | KonstantinVrunouski/practicalworks-KonstantinVrunouski | laboratory-task-2/main1.cpp | /*
1.Написать программу, которая для заданного натурального числа:
проверяет, различны ли цифры в записи числа (массив и строки не использовать)
*/
#include <iostream>
int32_t inputNumber(const char * message = "Input number:")
{
int32_t num;
std::cout << message << '\n';
std::cin >> num;
if (num <= 0... | ALGO | 0.989629 | 5.228491 |
1a9b0704-7aed-4764-8962-a2eda0bfabee | Serfossalot/CollegeProjects | BubbleSort/BubbleSort/Source.cpp | #include <iostream>
using namespace std;
void bubbleSort(int arr[], int n) {
for (int i = 0; i < n - 1; i++) {
bool swapped = false;
for (int j = 0; j < n - i - 1; j++) {
if (arr[j] > arr[j + 1]) {
// swap elements
int temp = arr[j];
arr[j... | ALGO | 0.999918 | 5.797749 |
7a028a9b-3fdc-482e-9113-5904da66f80e | Alastair7/dm-grimoire-app | 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 |
21be0b78-84bf-4cb2-80f6-5eeefad875eb | RodrigoFASantos/PINT | projeto_mobile/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.998307 | 6.776823 |
e74da869-dc55-4e39-98bc-68c1f060ebc2 | projectchrono/chrono | src/chrono/fea/ChContactSurfaceSegmentSet.cpp | #include <set>
#include "chrono/physics/ChSystem.h"
#include "chrono/utils/ChUtilsGeometry.h"
#include "chrono/fea/ChMesh.h"
#include "chrono/fea/ChElementCableANCF.h"
#include "chrono/fea/ChElementBeamANCF_3243.h"
#include "chrono/fea/ChElementBeamANCF_3333.h"
#include "chrono/fea/ChElementBeamEuler.h"
#include "ch... | ALGO | 0.97951 | 5.842154 |
91d5f1c5-01b8-4b31-8d75-f7688b752e05 | IshanChand/DAA-LAB-ASSIGNMENTS | week5/ques1.cpp | #include<bits/stdc++.h>
using namespace std;
void findmax(vector<char>&v,int &max,char &rak)
{
vector<int>count(256,0);
for(int i=0;i<v.size();i++)
{
int xx=v[i];
count[xx]++;
if(max<count[xx])
{
max=count[xx];
rak=xx;
}
}
}
int main()
{
int... | ALGO | 0.999916 | 3.548355 |
0623a06f-4290-4c7b-bb40-fd96e9a3fbd4 | king7282/algorithm | boj/Others/1373.cpp | #include <iostream>
#include <string>
#include <algorithm>
int main(void) {
std::ios::sync_with_stdio(false);
std::cin.tie(0);
std::string input, result;
std::cin >> input;
for (int i = (int)input.size() - 1; i >= 0; i -= 3) {
int tmp = 0, x = 1;
for (int j = i; j > std::max(i - 3, -1); j--) {
tmp += (... | ALGO | 0.9999 | 4.006175 |
393e5bb1-484e-4b34-8e8b-df70ec6751bf | mainak9830/bustub-20221128-2022fall | src/optimizer/sort_limit_as_topn.cpp | #include "optimizer/optimizer.h"
namespace bustub {
auto Optimizer::OptimizeSortLimitAsTopN(const AbstractPlanNodeRef &plan) -> AbstractPlanNodeRef {
// TODO(student): implement sort + limit -> top N optimizer rule
return plan;
}
} // namespace bustub
| ALGO | 0.993599 | 5.227697 |
6acacae4-e0ff-4a49-9c25-19eb6a8fde2a | JannatulLima9575/competitive-programming | Dimik OJ/Dimik-p1.cpp |
// # check even or odd number
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
while (n--) {
int num;
cin >> num;
if (num % 2 == 0) {
cout << "even" << endl;
} else {
cout << "odd" << endl;
}
}
return 0;
}
| ALGO | 0.999768 | 5.25151 |
9e559228-fee1-4089-970b-9310a38c2200 | liemroym/competitive_programming | Codeforce/registration_system.cpp | #include <bits/stdc++.h>
#include <string>
using namespace std;
#define LL long long
#define ull unsigned long long
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define printV(vi) fo(i, 0, vi.size()) cout << vi[i] << ' '
#define fo(i, s, n) for (LL i = s; i < n; i++)
#define INF 10e10+7
#define __gcd gcd... | ALGO | 0.999416 | 4.961324 |
f89a7d4c-761f-4712-a704-f5f4661cf5c9 | rahul228646/DSA-and-CP | Binary Search/Find The Distance Value.cpp | class Solution {
public:
int binarySearch(vector<int>& arr2, int target, int d){
int lo = 0, hi = arr2.size()-1, mid= 0;
while(lo<=hi) {
mid = (lo+hi)/2;
if(abs(arr2[mid]-target) <= d) return 1; // trying to find a value that will make target invalid i.e abs(arr2[mid]-target)... | ALGO | 0.999941 | 5.719539 |
ebbc9b04-23c8-41d9-a24a-bcaf7af7339b | cactus6053/baekjoon-code | code/2565.cpp | #include<iostream>
using namespace std;
int n;
int A[101];
int B[101];
int result[101];
int upper_BS(int *arr,int n,int key){
int start=0;
int end=n;
int mid;
while(end>start){
mid=(start+end)/2;
if(arr[mid]>=key){
end=mid;
}
else{
start=mid+1;
}
}
return end;
}
int main(){
cin>>n;
int lo... | ALGO | 0.999948 | 3.250643 |
020e5bf5-0fb0-4d68-92dd-ef2007fe18af | sjcjjcjssdssjc/gem5_simd | src/systemc/tests/systemc/misc/v1.0/dash2/speed.cpp | /*****************************************************************************
speed.cpp -- Definition of the speedometer.
Original Author: Ali Dasdan, Synopsys, Inc.
*****************************************************************************/
/*************************************************************... | ALGO | 0.93261 | 5.895144 |
51967de3-bea2-4ce4-acbb-cdadfece1f17 | zmwangx/Project-Euler | 025/025.cpp | #include <iostream>
#include <cmath>
const int NUMBER_OF_DIGITS = 1000;
int main() {
double numerator = std::log(std::sqrt(5)) +
(NUMBER_OF_DIGITS - 1) * std::log(10);
double denominator = std::log((std::sqrt(5) + 1) / 2);
std::cout << std::ceil(numerator / denominator) << ... | ALGO | 0.999253 | 4.303358 |
c5f8fa83-ce24-4e1f-be7e-af09d11211dc | Domain-Cmap/assignments-day-1-to-day-9-EKLAVYAKUMAR22BCS13380 | day4/medium/p2.cpp | #include <iostream>
using namespace std;
void reverseQueue(queue<int>& q) {
if (q.empty()) {
return;
}
int data = q.front();
q.pop();
reverseQueue(q);
q.push(data);
}
int main() {
queue<int> q;
q.push(5);
q.push(24);
q.push(9);
q.push(6);
q.push(8);
q.push(4);... | ALGO | 0.999895 | 4.654771 |
aa2fdc09-c6a2-4dab-ad10-611ddb77942b | roytam1/gecko28a1-vc8 | intl/icu/source/i18n/csrmbcs.cpp | #include "unicode/utypes.h"
#if !UCONFIG_NO_CONVERSION
#include "csmatch.h"
#include "csrmbcs.h"
#include <math.h>
U_NAMESPACE_BEGIN
#define ARRAY_SIZE(array) (sizeof array / sizeof array[0])
#define min(x,y) (((x)<(y))?(x):(y))
static const uint16_t commonChars_sjis [] = {
// TODO: This set of data comes from ... | TOOL | 0.948462 | 6.401443 |
f48fbc84-5c84-48b7-843b-b028cdb1a61d | ordinarv/ACM | OJ/HDU/2025.cpp | #include<iostream>
#include<cstring>
using namespace std;
int main()
{
char s[110];
while(cin>>s)
{
int len=strlen(s);
char max='A';
for(int i=0;i<len;i++)
if(s[i]>=max)
max=s[i];
for(int i=0;i<len;i++)
{
cout<<s[i];
if(s[i]==max) cout<<"(max)";
}
cout<<endl;
}
return 0;
}
| ALGO | 0.99829 | 3.333787 |
114827a8-2bd6-4465-8eda-bfec57480d37 | mohite-abhi/Exercise-Solution-for-balagurusamy-s-Object-Oriented-Programming-with-c-plus-plus | read_name_no_pg_358.cpp | #include<iostream>
#include<iomanip>
#include<boost/lexical_cast.hpp>
#include<fstream>
using namespace std;
class contact
{
private:
string name;
int telephone;
public:
void update(int no, string filename)
{
telephone=no;
fstream ff;
ff.open(filename,ios::app);
ff<<endl<<name<<" "<<no;
... | TOOL | 0.858616 | 4.689795 |
10e2acc8-f0b3-479b-a0c0-135ebe6c2191 | StarkPrince/warHammer | cpp/dataTypes/graphs.cpp | #include <iostream>
#include <vector>
#include <list>
using namespace std;
class Graph
{
int V;
list<int> *l; //declarction of list
public:
Graph(int v)
{
V = v;
l = new list<int>[V];
}
void addEdge(int i, int j, bool isundir = true)
{
l[i].push_back(j);
if... | ALGO | 0.998154 | 5.071318 |
fde3aa2a-6b54-4e20-abaa-b12d0eae2adb | betterafter/problem-solving | programmers/2018_summer_winter_coding_4.cpp |
// 문제 이름 : 배달
#include <iostream>
#include <vector>
#include <queue>
#include <math.h>
using namespace std;
int map[51][51];
vector<vector<int> > vmap(51);
int solution(int N, vector<vector<int> > road, int K) {
int answer = 0;
for(int i = 0; i < 51; i++){
for(int j = 0; j < 51; j++){
... | ALGO | 0.999845 | 4.382479 |
db128a23-daec-4bcf-bbc0-450fbf0da48e | Bakser/My_Algorithm_Templates | 图论/最大团/搜索n smaller than100.cpp | //f[i]ʾ1-nĵγɵţһi
//q[i]ʾǰŴСii㶼бߵĵ
#include<cstdio>
const int N(101);
int n,map[N][N],f[N],q[N][N],ans,tot;
inline void dfs(int dep,int num)
{
if(!num)return (void)(dep>ans?ans=dep:0);
for(int i(1),x,tot(0);i<=num;tot=0,i++)
{
if(num-i+1+dep<=ans||dep+f[x=q[dep][i]]<=ans)return;//֦
for(int j(i+1);j<=num;j++)
... | ALGO | 0.999626 | 3.565142 |
dd6f0220-a85c-44d3-a164-f87b1e52caa0 | sumsung-levelup-course/sumsung-levelup-course | jeongmee/block.cpp | const int MAX_NUM = 30000;
const int NONE = -1;
const int KEY = 4305;
struct Node {
int idx;
Node* prev;
Node* next;
Node() {
idx = NONE;
prev = next = 0;
}
Node(int i, Node* ptr) {
idx = i;
next = ptr->next;
prev = ptr;
ptr->next->prev = ptr->next = this;
}
};
struct Column {
bool check;
int blo... | ALGO | 0.999797 | 3.525152 |
90117a08-5825-432d-9ba1-0435a21f609b | raincross7/code-similarity | codes/train_code/problem075/problem075_253.cpp | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1 << 29;
int main() {
int x;
cin >> x;
int small = x % 100;
int large = (x-small) / 100;
int cnt_100 = 0;
int p[5] = {5, 4, 3, 2, 1};
rep(i, 5) {
if ... | ALGO | 0.999803 | 4.406925 |
c2863365-f069-492b-be45-82e80dc8cbcf | sakshammaggu/Codeforces-Problems | 96A_Football/96A_Football.cpp | #include <iostream>
#include <string>
using namespace std;
bool solve(string &s) {
int n = s.length();
for (int i=0; i<n-1; i++) {
int cnt = 1;
for (int j=i+1; j<n; j++) {
if (s[i] == s[j]) {
cnt++;
} else {
break;
}
}
... | ALGO | 0.999913 | 5.158136 |
4ed93ea2-c6c1-4407-a65f-e6e8ee3a821d | bhushankirve/C_CPP_JAVA | 151to200/Program188.cpp | #include<iostream>
using namespace std;
typedef unsigned int UINT;
/*
op1 op2 & | ^
1 0 0 1 1
0 1 0 1 1
1 1 1 1 0
0 0 0 0 0
*/
// iNO 0000 0000 1110 0... | ALGO | 0.999299 | 5.290186 |
0ecfe0dd-a555-430c-adfb-74e38bebb302 | petemus/BAEKJOON | Project1/Sort2_2.cpp | // Sort2 > 2. ϱ2(2751) // algorithms ǰ
// , , , , ( ð ),
// -> O(nlongn)
// n 10 ־ ð n^2 ˰ Ǯ ->
// !! δ ð ʰ..
#include <iostream>
using namespace std;
int n;
int* arr;
void heapify(int n) {
// root ü ݺ
for (int i = 1; i < n; i++) {
int child = i;
do {
int parent = (child - 1) / 2;
if (ar... | ALGO | 0.999968 | 4.93518 |
ed101555-f840-443f-bd66-8ea748190b9e | ya7sh/oct2022 | C++/Pattern printing/11Left_Half_Pyramid.cpp | // *
// * *
// * * *
// * * * *
#include<iostream>
using namespace std;
int main()
{
int r;
cout << "\nHow many row you will enter: ";
cin >> r;
for(int i=0; i<r; i++)
{
for(int j=0; j<=i; j++)
{
cout << "* ";
}
cout << "\n";
}
} | ALGO | 0.985791 | 3.537308 |
1f33ba46-4de2-4352-9bc7-42561f6112e1 | cmottao/CompetitiveProgrammingSolutions | codeforces/E/1921.cpp | // Made by Cristian Motta (cmottao)
#include <bits/stdc++.h>
using namespace std;
void solve() {
int h, w, xa, ya, xb, yb; cin >> h >> w >> xa >> ya >> xb >> yb;
int dif = xb - xa;
if(dif < 1) cout << "Draw" << '\n';
else {
int ma = (dif + 1) / 2, mb = dif / 2;
if((dif & 1) && (max(1,... | ALGO | 0.999791 | 4.282109 |
4cccdf88-1fe6-4e14-97bf-8f1e23ca1413 | richardmg/dachshund | src/corelib/tools/qhash.cpp | // for rand_s, _CRT_RAND_S must be #defined before #including stdlib.h.
// put it at the beginning so some indirect inclusion doesn't break it
#ifndef _CRT_RAND_S
#define _CRT_RAND_S
#endif
#include <stdlib.h>
#include "qhash.h"
#ifdef truncate
#undef truncate
#endif
#include <qbitarray.h>
#include <qstring.h>
#incl... | TOOL | 0.974814 | 6.23944 |
fc0c2588-c1d8-4925-a1fa-22eec77defdf | MD-STU/project1224 | 0531_STACK1.cpp | //#include<stdio.h>
//
//
//void main()
//{
// int stack_buff[256];
// int top = 0, value, choice;
// bool while_flag = true;
//
// while (while_flag)
// {
// printf("[stack]\n1.push\n2.pop\n: ");
// scanf("%d", &choice);
//
// switch (choice)
// {
// case 1:
// printf("stack Էּ : ");
// scanf("%d", &value... | ALGO | 0.962505 | 3.575433 |
5283fda1-421b-4db6-9022-08b60c6e59a0 | QBlockQ/pqc-bitcoin | src/test/fuzz/utxo_snapshot.cpp | #include <chain.h>
#include <chainparams.h>
#include <coins.h>
#include <consensus/consensus.h>
#include <consensus/validation.h>
#include <node/blockstorage.h>
#include <node/utxo_snapshot.h>
#include <primitives/block.h>
#include <primitives/transaction.h>
#include <serialize.h>
#include <span.h>
#include <streams.h>... | TEST | 0.855415 | 6.408701 |
3d38b178-90e1-46d9-8b8d-68a0fec582da | Devansh8954/program-cpp | DSA/Recursions 1a/Tower_of_Hanoi.cpp | /*
Tower of Hanoi is a mathematical puzzle where we have three rods and n disks. The objective of the puzzle is to move all disks from source rod to destination rod using third rod (say auxiliary). The rules are :
1) Only one disk can be moved at a time.
2) A disk can be moved only if it is on the top of a rod.
3) No d... | ALGO | 0.999994 | 5.888068 |
da3f65b8-9e2d-486f-988b-0e3d38aa2a2c | tienpm/competitive-programming | codeforces/909D3/B.cpp | #include <bits/stdc++.h>
using namespace std;
void solve() {
int32_t n;
cin >> n;
vector<int64_t> a(n);
for (int32_t i = 0; i < n; i++)
cin >> a[i];
int64_t mae = 0;
for (int32_t k = 1; k <= n; k++) {
if (n % k == 0) {
int64_t minn = (int64_t)1e18, maxx ... | ALGO | 0.999758 | 4.877439 |
2cbbe0d9-6f97-4872-bc21-26e55a00e45c | Kodsport/kth-challenge-2019 | typecharts/submissions/accepted/ar.cpp | // Author Alexander Rass
#include <bits/stdc++.h>
using namespace std;
const int MAXE = 1.1e5;
const int MAXN = 1.1e5;
string result_string;
bool has_types[MAXN][4];
int mark[MAXN];
int get_type(char c){
if(c == 'x')return 0;
if(c == '-')return 1;
if(c == '=')return 2;
if(c == '+')return 3;
assert(f... | ALGO | 0.999984 | 3.955112 |
77eac238-9304-4b91-92c1-3f0ed488b699 | Jikky1618/AtCoder | ABC/ABC300-349/ABC336/d.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#ifdef LOCAL
#include <debug_print.hpp>
#define debug(...) debug_print::multi_print(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (static_cast<void>(0))
#endif
int main(){
cin.tie(nullptr);
ios::sync_with_stdio(false);
cout << fixed... | ALGO | 0.999898 | 4.64058 |
51942885-674c-4264-81cd-7ce7e6efe212 | 7oSkaaa/LeetCode_DailyChallenge_2023 | 01- January/12- Number of Nodes in the Sub-Tree With the Same Label/12- Number of Nodes in the Sub-Tree With the Same Label (Noura Algohary).cpp | // Author: Noura Algohary
class Solution {
public:
// A Deep First Search function which visits all children of a node before going back
vector<int> dfs(int node, int parent, vector<vector<int>>& adj, string& labels, vector<int>& ans)
{
vector<int> child_cnt; // to store the child counts
v... | ALGO | 0.999889 | 6.191794 |
99bea3ed-bc46-4a00-9f8f-2448f0ae0f8e | ygtxr1997/XTryOn | third_party/m2fp_mmcv/deform_attention/ops/csrc/pytorch/modulated_deform_conv.cpp | #include "csrc_dipu/diopirt/diopirt_impl.h"
using dipu::diopi_helper::toDiopiScalar;
using dipu::diopi_helper::toDiopiTensorHandle;
#endif
void modulated_deformable_im2col_impl(
const Tensor data_im, const Tensor data_offset, const Tensor data_mask,
const int batch_size, const int channels, const int height_i... | ALGO | 0.912144 | 5.361598 |
7b42ef64-b234-4994-9a49-288dc10c7630 | frankyzf/myleetcode | lengthofLongestSubstr.cpp | #include "common.h"
class Solution {
public:
int lengthOfLongestSubstring(string s) {
int max = 0;
int loc[256];
memset(loc, -1, sizeof(loc));
int start = 0;
for(int i = 0; i < s.length(); ++i)
{
if(loc[s[i]] != -1)
{
for(int j ... | ALGO | 0.999768 | 5.668767 |
6e016a3d-3b69-4911-b228-4c8adf71f496 | aishwary11/ds-algo-in-c- | linkedlist/LL.cpp | #include <bits/stdc++.h>
using namespace std;
class Node {
public:
int data;
Node* next;
public:
Node(int data1, Node* next1 = nullptr) {
data = data1;
next = next1;
}
};
int getLength(Node* head) {
Node* temp = head;
int len = 0;
while (temp != nullptr) {
len... | ALGO | 0.999222 | 5.064925 |
3d1b74e4-e344-482c-ba88-c1844001d5aa | lokeshkumar80/gfg | 45_longest_valid_parenthesis.cpp | // // DO IT AGAIN .....IT WAS POTD and Help taken...
// class Solution {
// public:
// int maxLength(string& s) {
// stack<int> st;
// int maxlength = 0;
// int last_invalid = -1;
// for (int i = 0; i < s.length(); i++) {
// if (s[i] == '(') {
// ... | ALGO | 0.993534 | 4.476333 |
bef736e0-291a-4bfa-a43a-11cc341d6ee8 | Shibam008/CPP_programe | Stack/insert_elem_in_sorted_stack.cpp | #include <bits/stdc++.h>
using namespace std;
void insertAtSortedStack(stack<int> &st, int element) {
// base case
if(st.empty() || element > st.top()) { // **** handle empty case is the most imp part
st.push(element);
return;
}
// handle one case
int temp = st.top();
st.pop();
... | ALGO | 0.999941 | 4.996992 |
09c8edb6-1847-4973-87d2-3a9f03be8348 | MikierXXV/EDA | EXAMS/X64801_Es_ciclic.cpp | #include <iostream>
#include <vector>
#include <queue>
using namespace std;
typedef vector<vector<int>> Grafo;
bool es_ciclic(const Grafo& g) {
int n = g.size();
vector<int> ge(n, 0);
for(int u = 0; u < n; ++u){
for (int v: g[u]) ++ge[v];
}
queue<int> Q;
for(int u = 0; u < n; ++u)
if (ge[u] == 0) Q... | ALGO | 0.999933 | 5.275706 |
03cbe1f2-0869-489c-8760-751f28c93384 | KhaledHegazy222/Problem-Solving | UVA/10870/main.cpp |
#include <bits/stdc++.h>
#define all(x) x.begin(),x.end()
typedef unsigned long long ull;
typedef long long ll;
using namespace std;
int MOD = 1e9;
int k,n,B[15],C[15];
void print(vector<vector<int>> x){
for(int i = 0;i<x.size();i++){
for(int j = 0;j < x[0].size();j++){
cout << x[i][j] << "... | ALGO | 0.999927 | 3.627492 |
298f33f7-f442-4ed7-8da3-28687aace55d | Mechanic-S1-4-1/NULLTerminatedLines | NULLTerminatedLines/main.cpp | #include <iostream>
#include <Windows.h> //для того чтоб компилятор понимал русский язык строки
using namespace std;
int StrLen(char str[]);
void to_upper(char str[]);
void to_lower(char str[]);
void shrink(char str[]);
bool is_palindrome(char str[]);
void remove_symbol(char str[], char symbol);
bool is_integer(cha... | ALGO | 0.952084 | 3.182877 |
f8cd6d5d-0153-4972-bb92-75dcc2c39439 | hardikk65/DSA | 3330-modify-the-matrix/modify-the-matrix.cpp | class Solution {
public:
vector<vector<int>> modifiedMatrix(vector<vector<int>>& matrix) {
for(int col = 0;col < matrix[0].size();col++){
int maxx = -1;
for(int row = 0;row < matrix.size();row++){
if(matrix[row][col] == -1 && maxx == -1){
for(int r... | ALGO | 0.999942 | 5.908093 |
8dda2a2d-c71e-44f1-bb9a-29ae307cac2a | dmkalchev18/AMASS | AMASS/asio-1.18.1/src/examples/cpp03/spawn/parallel_grep.cpp | #include <asio/dispatch.hpp>
#include <asio/post.hpp>
#include <asio/spawn.hpp>
#include <asio/strand.hpp>
#include <asio/thread_pool.hpp>
#include <boost/bind/bind.hpp>
#include <fstream>
#include <iostream>
#include <string>
using asio::dispatch;
using asio::spawn;
using asio::strand;
using asio::thread_pool;
using ... | TOOL | 0.955863 | 6.392813 |
3da9b357-19fd-4b11-b78e-7dc325ccc159 | ishandutta2007/codeforces | i_love_tigersugar/normal/900/C.cpp | #include<bits/stdc++.h>
#define FOR(i,a,b) for (int i=(a),_b=(b);i<=_b;i=i+1)
#define FORD(i,b,a) for (int i=(b),_a=(a);i>=_a;i=i-1)
#define REP(i,n) for (int i=0,_n=(n);i<_n;i=i+1)
#define FORE(i,v) for (__typeof((v).begin()) i=(v).begin();i!=(v).end();i++)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#defi... | ALGO | 0.999944 | 3.901657 |
4a325ada-80ee-40ee-a295-731e876dfc4f | EPCCed/MPI_OpenMP_tasks_OmpSs | ipic3d/grids/Grid3DCU.cpp | /* This release was prepared by Dana Akhmetova <<EMAIL>>/<<EMAIL>> on behalf of the INTERTWinE European Exascale Project <http://www.intertwine-project.eu> */
#include <mpi.h>
#include "Grid3DCU.h"
#include "Collective.h"
#include "MPIdata.h"
#include "Alloc.h"
#include "Com3DNonblk.h"
#include "debug.h"
#include "ipi... | ALGO | 0.997235 | 3.318816 |
62e50f18-be66-485d-a92b-ba694dcfde9d | jee-van24/LeetCode | 2387-partition-array-such-that-maximum-difference-is-k/2387-partition-array-such-that-maximum-difference-is-k.cpp | class Solution {
public:
int partitionArray(vector<int>& nums, int k) {
int cnt=1;
sort(nums.begin(),nums.end());
int curr_num=nums[0];
for(int i=1;i<nums.size();i++){
if(nums[i]-curr_num>k){
cnt++;
curr_num=nums[i];
}
}... | ALGO | 0.999949 | 5.754961 |
8a29aaea-d610-4998-aca6-8e36fd0f9978 | dangdan2807/learning-c | Training/B-Equal_Distance.cpp | #include <bits/stdc++.h>
using namespace std;
double tinh1(int xi, int xj, int yi, int yj)
{
return (abs(xi - xj) + abs(yi - yj));
}
double tinh2(int xi, int xj, int yi, int yj)
{
return sqrt((xi - xj) * (xi - xj) + (yi - yj) * (yi - yj));
}
int main(int argc, char const *argv[])
{
int x[] = {0, 0, 0, -... | ALGO | 0.999883 | 4.186133 |
56f40719-ff45-45d9-8aac-7df87b8f0298 | AdrianGarridoPantaleon/ED | EJERCICIOS INICIALES ESTRUCTURAS DE DATOS/Ejercicio5/factorial.cpp | #include <iostream>
using namespace std;
int main()
{
int numero;
int resultado;
int aux;
int condicion;
cout<<"introduce el numero a calcular: ";
cin>>numero;
condicion=numero;
aux=numero-1;
for(int i=0; i<condicion-1; i++){
numero=numero*aux;
aux--;
}
... | ALGO | 0.999829 | 3.0535 |
48b93cc8-733d-4918-9b99-b5e3e3c2aac8 | MatiasCaamal/pokemon_app_8sc | pokemon_app_8sc/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.998849 | 6.76775 |
60ada9ea-b391-4bc1-8e47-33c25cb5bb95 | king-yyf/cpcode | atcoder/abc311/b.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ar2 = array<int, 2>;
using ar3 = array<int, 3>;
using ar4 = array<int, 4>;
#define all(c) (c).begin(), (c).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define f0(e) for(int i = 0; i < (e); ++i)
#define f1(e) for... | ALGO | 0.999731 | 4.675963 |
e7ab14dd-251a-4806-a8db-74f9bc571a39 | AmHackish/codeforces-solution | 841A.cpp | #include <bits/stdc++.h>
using namespace std;
#define lli long long int
int main()
{
ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
int n,k;
cin >> n >> k;
string s;
cin >> s;
vector<int> v(26);
for(int i=0;i<s.length();i++)
v[s[i]-'a']++;
sort(v.begin(),v.end());
int cnt=0;
bool l =... | ALGO | 0.999999 | 4.481223 |
cc531198-38d3-4f5e-af12-58a4cfe71654 | davrec72/clang-meta | llvm/lib/CodeGen/InlineSpiller.cpp | #include "LiveRangeCalc.h"
#include "Spiller.h"
#include "SplitKit.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/MapVector.h"
#include "llvm/ADT/None.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.... | TOOL | 0.955397 | 5.588775 |
5ed55b6b-fc26-49d0-bd53-5f3dddef8f1e | GraspCS/CPP-Programs | samples/PalindromeNumber.cpp | #include <iostream>
using namespace std;
/**
* A program to check if a number is palindrome or not
* @Author - GraspCS
* Feel free to learn from the code
* And to modify as per your needs
*/
// This function will reverse the given number and return it
int reverse(int n) {
int r = 0;
while (n > 0) {
... | ALGO | 0.999526 | 4.134276 |
6f9f5634-0af4-4504-9be6-b86e7ccef59d | hajimeIppo-cmd/cp-codes | Baekjoon OJ/13000-13999/13504.cpp | #include <bits/stdc++.h>
using namespace std;
const int MAXC = 2;
struct trie {
trie* child[MAXC];
bool term;
trie() {
fill(child, child + MAXC, nullptr);
term = false;
}
~trie() {
for (int i = 0; i < MAXC; i++)
if (child[i]) delete child[i];
}
void insert(int x, int key = 31) {
if (key == -1) ter... | ALGO | 0.999912 | 4.571403 |
d1dbc0f2-a716-43f4-ae18-230dd6ae2fa8 | baislsl/Algorithm | leetcode/c++/135Candy.cpp | /**
There are N children standing in a line. Each child is assigned a rating value.
You are giving candies to these children subjected to the following requirements:
Each child must have at least one candy.
Children with a higher rating get more candies than their neighbors.
What is the minimum candies you must give?... | ALGO | 0.999996 | 5.709124 |
3828e11f-394c-4b1e-806f-a99402a2bd06 | AdamC19/supreme-eureka | src_day16/day16.cpp |
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstdint>
#include <cstring>
#include <cmath>
#include <fstream>
#include <iostream>
#include <map>
#include <sstream>
#include <string>
#include <vector>
#include <fcntl.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include "util.h"
static const i... | ALGO | 0.999822 | 4.555014 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.