uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
90fee57d-f62b-41fc-9d75-4e0b69d58f41 | aryang23/DSA | Stacks/Stack STL.cpp | //Stack STL
//By Aryan Grover(@aryang23)
//Will Add more in this soon
#include<iostream>
#include<stack>
using namespace std;
int main()
{
stack<int> s;
for(int i=0;i<5;i++)
{
s.push(i*i);
}
while(!s.empty())
{
cout<<s.top()<<endl;
s.pop();
}
}
//Push, Pop, Top ALl in O(1)
| ALGO | 0.983947 | 4.087251 |
4424ecfe-e328-47fc-81e7-f21c6ead05d9 | dbdbais/Coding_Interview_C_plusplus | BaekJoon/etc/[11650] 좌표 정렬하기.cpp | //
// Created by newbi on 2023-08-08.
//
#include<iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
int n;
cin >> n;
vector<pair<int,int>> vec;
for(int i=0;i<n;i++) {
int a,b;
cin >> a>>b;
vec.push_back(make_pair(a,b));
}
sort(vec.begin()... | ALGO | 0.999927 | 4.845908 |
5cc483ff-7848-49de-bcba-cd6ac033829e | PranshuSrivastava/Data-Structures-And-Algorithms | 56-merge-intervals/56-merge-intervals.cpp | #include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define yes cout << "YES" << '\n';
#define no cout << "NO" << '\n';
#define deb(x) cout << #x << "=" << x << endl
#define all(x) x.begin(), x.end()
#define nline cout << '\n';
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << end... | ALGO | 0.999999 | 5.195334 |
73c82727-087b-4135-9042-0730b172c182 | naoto0804/atcoder_practice | contests/abc/17/174/c.cpp | // ctrl+shift+b
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
co... | ALGO | 0.999702 | 4.113523 |
7e0234b1-8c00-46e5-b0bc-ab3c4ad4a4fd | plilja/hrank | cpp/xor_seq/xor_seq.cpp | #include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
int main() {
int q;
cin >> q;
for (int i = 0; i < q; ++i) {
ll l, r;
cin >> l >> r;
ll res = 0;
ll acc = 0;
ll sumS = 4LL * (l / 4LL);
for (ll j = sumS; j < l; ++j) {
... | ALGO | 0.999895 | 4.202419 |
c576d562-4345-419b-9143-0caaac5b9d18 | mariaaktermukti/vjudge | J_wet_shark_and_odd_and_even.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>> n;
vector<int> num(n);
long long sum=0;
int min_Odd= 1e9+1;
for(int i=0;i<n;i++)
{
cin>> num[i];
sum= sum+num[i];
if(num[i] % 2 != 0)
{
min_Odd= min(min_Odd, num[i]);
}
}
... | ALGO | 0.999983 | 4.030256 |
10e95ffb-9d4a-4be4-9281-e1ddb8315c8e | raincross7/code-similarity | codes/train_code/problem076/problem076_67.cpp | #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, start, end) for (int i = (start); i <= (int)(end); i++)
int main(){
int n,m;
cin >> n >> m;
vector<int> height(n);
vector<int> cond(n,1);
rep(i,n){
int h;
cin >> h... | ALGO | 0.999928 | 3.572026 |
b3de63de-554e-4bd6-846a-87c3bc8558a9 | chopndolphy/LearnOpenGL | lib/glm/test/gtx/gtx_pca.cpp | #define GLM_ENABLE_EXPERIMENTAL
#include <glm/glm.hpp>
#include <glm/gtx/pca.hpp>
#include <glm/gtc/epsilon.hpp>
#include <glm/gtx/string_cast.hpp>
#include <cstdio>
#include <vector>
#if GLM_HAS_CXX11_STL == 1
#include <random>
#endif
#if GLM_COMPILER & GLM_COMPILER_CLANG
# pragma clang diagnostic push
# pragma clan... | TEST | 0.939478 | 6.839382 |
4d6ff2db-2c22-4ba5-92a7-aadc647333aa | ramatiharaa/AlgoritmaPemrogramanDanStrukturData | Pertemuan 8/Tugas 6(Tambahn).cpp | #include <iostream>
using namespace std;
int main() {
int x, bil = 0; //Declare variable
cout << "Masukkan nilai pembatas akhir: "; //Tampilkan info untuk memasukan pembatas akhir
cin >> x; // Fungsi untuk memasukkan inputan ke dalam variable x
do { //Lakukan perintah
if(bil >= x) //kondisi jika bilangan le... | ALGO | 0.999654 | 3.00265 |
a721566b-b42a-4044-9afc-8c393a8a7427 | yash-gargji/codeforces-solution | D_Three_Activities.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t;
cin>>t;
while(t--){
int n;
cin>>n;
vector<pair<int,int>>p1,p2,p3;
for(int i = 0;i<n;i++){
int num;
cin>>num;
... | ALGO | 0.999785 | 3.809886 |
8754e6e0-345c-4a24-9df7-1022371663c7 | chunag24/project_euler | 2nd/euler15.cpp | /*************************************************************************
> File Name: euler15.cpp
> Author:
> Mail:
> Created Time: Sun 4 Apr 15:19:01 2021
************************************************************************/
#include<iostream>
using namespace std;
int ans[25][25];
int main(){
for ... | ALGO | 0.999676 | 4.608542 |
d4c7c553-423e-4d7a-a44c-2d7cecd18b16 | Casal2/CASAL2 | CASAL2/source/Processes/Age/TransitionCategoryByAge.cpp | /**
* @file TransitionCategoryByAge.cpp
* @author Scott Rasmussen (<EMAIL>)
* @github https://github.com/Zaita
* @date 10/12/2014
* @section LICENSE
*
* Copyright Casal2 Project 2024 - https://github.com/Casal2/
*
*/
// headers
#include "TransitionCategoryByAge.h"
#include <limits>
#include <numeric>
#inclu... | TOOL | 0.896963 | 6.404205 |
3101362a-2644-4cd9-b5ac-a089b6c3430e | dbwls387/Data-Structure | W06/Ex06/ex2.cpp | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
typedef struct {
int coef;
int expo_x, expo_y;
} Term;
Term *recognize(char *expr);
int main()
{
char expr[30];
int coef, exp_x, exp_y;
scanf("%s", expr);
Term *t = recognize(expr);
printf("%d %d %d\n", t->coef, t->expo_x, t->expo_y)... | ALGO | 0.989132 | 3.453564 |
f24694f4-8a98-4ec2-9ab5-0442ea323125 | abhishekanand-02/DSA | Array/Easy/Ques9.cpp | /*
Problem Statement:Find the number that appears once, and other numbers twice.
*/
// Solution: 1
int findUnique(vector<int> &arr) {
// code here
unordered_map<int , int> freq;
for(int i=0;i<arr.size(); i++){
freq[arr[i]]++;
}
for(auto it: freq){
if(it... | ALGO | 0.999749 | 5.381247 |
06feb8fd-3778-4075-880a-cdf30e428a85 | liaojh1998/Competitive-Programming | USACO/Section 3/3.4/rockers.cpp | /*
ID: liaojh11
PROG: rockers
LANG: C++
*/
//Title: Raucous Rockers
//Type: DP
//Complexity: O(NMT)
//Solution: Similar to 0-1 Bounded Knapsack
//State: dp[i][j] represent the maximum amount of songs that can stored on i disks with j minutes each
//Transition: dp[i][j] = max(dp[i][j], max(dp[i][j-weight], dp[i-1][T]) +... | ALGO | 0.99979 | 4.354074 |
efb769a7-bf06-42aa-b2f5-91f1da0b7249 | franky90237/LeetCode | Medium_173. Binary Search Tree Iterator.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.281182 |
87852377-eacd-4cec-9eb0-feb68daaf8f4 | st129061/c-2024-autumn | 2024.10.01-Homework-3/Project5/Source.cpp | #include <iostream>
int main( int argc, char *argv[] )
{
int N = 0;
int ans_number = 0;
scanf_s("%d", &N);
for (int i = 0; i < N; ++i)
{
for (int j = 0; j < N; ++j)
{
int is_road = 0;
scanf_s("%d", &is_road);
if (is_road == 1)
{
if (i == j)
{
ans_n... | ALGO | 0.999781 | 4.6424 |
42c1a59f-e06c-4d7c-9660-f617f52b946f | SilverHL/Leetcode | 116.填充每个节点的下一个右侧节点指针.cpp | #include <iostream>
/*
* @lc app=leetcode.cn id=116 lang=cpp
*
* [116] 填充每个节点的下一个右侧节点指针
*/
class Node {
public:
int val;
Node* left;
Node* right;
Node* next;
Node() : val(0), left(NULL), right(NULL), next(NULL) {}
Node(int _val) : val(_val), left(NULL), right(NULL), next(NULL) {}
Nod... | ALGO | 0.99955 | 5.688834 |
ff8bdae1-e49e-42a1-b018-c78356e41f8e | chopperdodo/leetcode | final/set-matrix-zeroes.cpp | class Solution {
public:
void setZeroes(vector<vector<int> > &matrix) {
int m = matrix.size();
int n = m > 0 ? matrix[0].size() : 0;
bool first_row_zeroed = false, first_column_zeroed = false;
for (int i = 0; i < m; i++) {
for (int j = 0; j < n; j++) {
// ... | ALGO | 0.998919 | 6.317074 |
b3831b97-aa8c-4afc-9611-c791ad72176b | andyli029/mysql-server-mysql-8.0.30 | extra/icu/icu-release-69-1/source/common/ucharstriebuilder.cpp | #include "unicode/utypes.h"
#include "unicode/ucharstrie.h"
#include "unicode/ucharstriebuilder.h"
#include "unicode/unistr.h"
#include "unicode/ustring.h"
#include "cmemory.h"
#include "uarrsort.h"
#include "uassert.h"
#include "uhash.h"
#include "ustr_imp.h"
U_NAMESPACE_BEGIN
/*
* Note: This builder implementation... | TOOL | 0.947013 | 7.364531 |
8ea7c725-af62-4e66-9933-f07390cb64c2 | shishirRsiam/CSE-Fundamentals-With-Phitron | 5. XPSC - Problem Solving Club/Week 4/Day 5/Possible_or_Not.cpp | #include<bits/stdc++.h>
#define str string
#define ll long long
#define by "nothing";
#define pi pair<ll,ll>
#define vec vector<ll>
#define py cout<<"YES\n"
#define pn cout<<"NO\n"
#define pb(x) push_back(x)
#define bee(x) x.begin(), x.end()
#define loop(s,i,n) for(int i=s;i<n;i++)
#define code ios::sync_with_stdio(fa... | ALGO | 0.999181 | 4.469752 |
748b2ac1-9e91-492c-9e79-f6d31bab27d4 | lzyrapx/Algorithmic_Template | Graph-theory/Shortest-path/SPFA(1).cpp | /*
SPFA O(k*E)
对于一般稀疏图,k=2~3.稠密图最坏情况可达到O(V^2)
如果存在负权环返回1,否则返回0
*/
/*
The efficiency of the SPFA algorithm depends on the structure of the graph:
the algorithm is often efficient, but its worst case time complexity is still O(nm)
and it is possible to create inputs that make the algorithm as slow as th... | ALGO | 0.999929 | 4.675741 |
363f75e9-43d4-4fae-9736-680eb52fa6c0 | BharathGadi/Leetcode-Daily-problems-PTOD- | 1402. Reducing Dishes.cpp | class Solution {
public:
int maxSatisfaction(vector<int>& satisfaction) {
sort(satisfaction.begin(),satisfaction.end());
int ans=0;
int res=0;
int c=1;
int sum=0,ind=-1;
bool flag=true;
for(int i=0;i<satisfaction.size();i++)
{
// cout<<sati... | ALGO | 0.999975 | 5.213338 |
9e4d9cf0-0aed-4f41-8389-243afc2624fb | windrew/Baekjoon_ac_codes | 2449.cpp | #include <stdio.h>
#include <algorithm>
using namespace std;
#define inf 100000
int n,k,dp[205][205][35];
int c[205],ans=inf;
int main()
{
int i,j,l,p;
scanf("%d %d",&n,&k);
for(i=0;i<n;i++)
{
scanf("%d",&c[i]);
}
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
fo... | ALGO | 0.999753 | 3.196806 |
6ef448e0-fc9d-4243-8cc0-7468d371692a | warzes/TempGame | src/Temp/PolygonsSubtraction.cpp | #include "stdafx.h"
#include "PolygonsSubtraction.h"
#include "CSGPolygonPath.h"
template<class T> const std::vector<CSGPolygon<T>>& PolygonsSubtraction<T>::subtractPolygons(const CSGPolygon<T>& minuendPolygon, const CSGPolygon<T>& subtrahendPolygon) const {
bool subtrahendInside;
return subtractPolygons(minuendPoly... | ALGO | 0.982729 | 6.1934 |
defa4acc-5b8d-4c42-92ea-f8799677817b | m4nn4t/DSA | iterativePreorderTraversalTREE.cpp | #include<bits/stdc++.h>
#include<stack>
using namespace std;
class TreeNode{
public:
int data;
TreeNode* left;
TreeNode* right;
TreeNode(int data1,TreeNode* left1,TreeNode* right1){
data=data1;
left=left1;
right=right1;
}
TreeNode(int data1){
data=data1;
... | ALGO | 0.999959 | 5.209792 |
bfd0315b-d5e9-49cc-871b-6f8c4863b21b | ishandutta2007/codeforces | amethyst0/normal/792/A.cpp | /*AMETHYSTS*/
//#pragma comment(linker, "/STACK:1000000000")
#include <cstdio>
#include <iostream>
#include <ctime>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <set>
#include <cstdlib>
#include <ctime>
#include <cassert>
#include <bitset>
#include <fstream>
#inc... | ALGO | 0.999947 | 3.508627 |
86b019e2-48d7-450f-95ae-a2ff0187506f | le-incroyable1-dev/dsa_archive | sar_phod_lo_apna_idhar/bit/trees/BSTiterator.cpp | #include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define fi first
#define sec second
typedef long long ll;
typedef long double ld;
#define pii pair<ll,ll>
#define vi vector< ll >
#define vvi vector< vi >
#define vpi vector< pii >
#define vvpi vector< vpi >
#... | ALGO | 0.999658 | 4.197756 |
980bbec6-9d77-4dfd-8ee5-fde9c0396422 | mustafasaydam/LeetCode-Training | 1458-max-dot-product-of-two-subsequences/1458-max-dot-product-of-two-subsequences.cpp | class Solution {
public:
int maxDotProduct(vector<int>& nums1, vector<int>& nums2) {
int size1 = nums1.size();
int size2 = nums2.size();
vector<vector<int>> dp(size1, vector<int>(size2));
dp[0][0] = nums1[0] * nums2[0];
for(int i = 1; i < size1; i++)
dp[i... | ALGO | 0.999992 | 6.383526 |
35492cea-8be1-4bd5-8299-29fd4a4fce59 | ajayjangid-51/dsa | dsasolve/solve/leetcode/coins_in_a_line.cpp | #include <bits/stdc++.h>
using namespace std;
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define sz(x) x.size()
#define ll long long
#define pint unsigned int
#define pb push_back
#define vb vector<bool>
#define vi vector<int>
#define vs vector<string>
#define vvi vector<vi>
#defin... | ALGO | 0.999912 | 4.695049 |
008de7cf-2be6-44d3-b46c-5c99abd5870b | Kartz4code/pNMPC_CODEGEN | pNMPC/src/genCCodeMayer.cpp | #include "PNMPCGEN.hpp"
void PNMPCGEN::genCCodeMayer()
{
/*
=============================================================================================================
__ __ _______ ___ _______ _______ .______ _______ __ __ _______
| | | | | ____| / \ | \ | ... | TOOL | 0.986226 | 4.135501 |
08cf31d8-50cc-4832-9e05-fae556df70df | threalwinky/cp_notebook | from_other_people/kactl-main/kactl-main/stress-tests/strings/MinRotation.cpp | #include "../utilities/template.h"
#include "../../content/strings/MinRotation.h"
int min_rotation2(string& v) {
int n = sz(v);
string w = v; w.insert(w.end(), all(v));
int j = 0;
rep(i,1,n) {
if (vi(w.begin() + i, w.begin() + i + n) <
vi(w.begin() + j, w.begin() + j + n)) j = i;
}
return j;
}
void testPe... | ALGO | 0.99992 | 4.334723 |
ba59c71d-0011-42f7-ae57-29ef06295bbb | Souheyl7Gouadria/leetcode-solutions | 1302-delete-characters-to-make-fancy-string/1302-delete-characters-to-make-fancy-string.cpp | class Solution {
public:
string makeFancyString(string s) {
int cnt = 1;
string resp = "";
resp+=s[0];
for(int i=1;i<s.size();i++){
if(s[i] == resp.back()){
if(cnt == 1){
resp+=s[i];
cnt++;
}
... | ALGO | 0.999991 | 6.102713 |
f1ffacbb-d4b5-4fdc-a7da-ced369d2a738 | HimanshuBaurai/STRIVER-SDE-SHEET-CHALLENGE-2023 | largestRectangle.cpp | #include <bits/stdc++.h>
int largestRectangle(vector < int > & heights) {
stack<int>stk;
int n=heights.size();
vector<int>leftFirstMin(n);
for(int i=0;i<n;i++){
while(!stk.empty() && heights[stk.top()]>=heights[i]) stk.pop();
if(stk.empty()) leftFirstMin[i]=-1;
else leftFirstMin[i]=stk.top... | ALGO | 0.999726 | 6.025015 |
c126b17b-3461-4879-a795-2da71507a074 | thuansan/m5tasmotafi | lib/libesp32_ml/tf_lite_esp32/src/tensorflow/lite/kernels/kernel_util.cpp | #include "tensorflow/lite/kernels/kernel_util.h"
#include <stdint.h>
#include <stdlib.h>
#include <algorithm>
#include <complex>
#include <limits>
#include <memory>
#ifndef ARDUINO
#include <string>
#endif // ARDUINO
#include "tensorflow/lite/c/builtin_op_data.h"
#include "tensorflow/lite/c/common.h"
#include "tens... | TOOL | 0.875509 | 3.229682 |
09fe37c6-de95-4f57-a88d-f623002d8e9f | hmk252/ARC-9th-place | 2020_icecuber/src/evals.cpp | // clang-format off
#include "precompiled_stl.hpp"
using namespace std;
#include "utils.hpp"
#include "read.hpp"
#include "visu.hpp"
#include "core_functions.hpp"
#include "image_functions.hpp"
#include "normalize.hpp"
#include "spec.hpp"
#include "image_functions2.hpp"
// clang-format on
int rcDiff(Image_ img)
{
... | ALGO | 0.983394 | 4.941729 |
3b66dd60-db44-451f-8bf1-c20fa19e4ce9 | ksin-dev/algorithm | leetcode/top_k_frequent_words.cpp | #include <iostream>
#include "gtest/gtest.h"
#include <map>
#include <queue>
using namespace std;
using string_counter = pair<string, int>;
struct pair_less_count
{
bool operator()(string_counter &x, string_counter &y)
{
if (x.second == y.second)
return x.first > y.first;
else
return x.second <... | ALGO | 0.999952 | 6.231349 |
f5ba659e-af5c-4df7-8cdb-e26514577f75 | Meyuki-hell/POTD_LEETCODE | numOfWays.cpp | /*class Solution {
public:
vector<vector<long long> > dp;
long long mod = 1e9 + 7;
long long solve(vector<int> &num){
if(num.size() <= 1) return 1;
vector<int>l, r;
for(int i =1; i < num.size(); i++){
if(num[i] > num[0]){
r.push_back(num[i]);
... | ALGO | 0.999988 | 5.3435 |
9202b268-fd06-4d5e-952e-fa280ed309bd | Lessica/HikariSummer | libcxx/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/eval.pass.cpp | // <random>
// template<class IntType = int>
// class negative_binomial_distribution
// template<class _URNG> result_type operator()(_URNG& g);
#include <random>
#include <numeric>
#include <vector>
#include <cassert>
#include "test_macros.h"
template <class T>
inline
T
sqr(T x)
{
return x * x;
}
void
test1()... | TEST | 0.897507 | 6.214032 |
803613e4-faa5-4bf5-9791-9263e9da49ec | andreferdinan1/Pemograman_flutter | utsdart/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.998684 | 6.76073 |
9f99ee7e-4014-4f3f-a351-f9f3ee2aadbb | PYChih/CppPrimer | ch04_expressions/exercise_4_04.cpp | //g++ exercise_4_04.cpp && ./a.out
/*
- 練習4.4: 為下列的運算式加上括弧,顯示它是如何被估算的。編譯這個運算式(不帶括弧的)並印出結果來驗證你的答案。
`` 12 / 3 * 4 + 5 * 15 + 24 % 4 /2``
*/
#include<iostream>
#include <string>
using std::string;
using std::cout;
using std::cin;
using std::endl;
int main(){
cout<< "ans: "<<12 / 3 * 4 + 5 * 15 + 24 % 4 /2<<endl;
... | TOOL | 0.998253 | 4.466874 |
2102d934-f5f7-41fc-8ac0-b6d237bdfde8 | ishandutta2007/codeforces | boook/normal/1005/A.cpp | /*input
7
1 2 3 1 2 3 4
*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define REP(i , j , k) for(int i = j ; i < k ; ++i)
#define RREP(i , j , k) for(int i = j ; i >= k ; --i)
#define A first
#define B second
#define mp make_pair
#define pb emp... | ALGO | 0.999976 | 3.285773 |
2950a08e-feda-476b-9b45-90134971e099 | Sillyplus/Solution | Timus/1004.cpp | #include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
using namespace std;
const int MN = 110;
const int INF = 1e8;
int n, m, num, ans;
int mp[MN][MN], dis[MN][MN], pre[MN][MN];
int path[MN];
void get_path(int a, int b) {
if (pre[a][b]) {
get_path(a, pre[a][b]);
... | ALGO | 0.999994 | 3.668266 |
be05e60e-1d35-4ac6-b8ad-da391cef300d | SnowySparks/Algorithm_Solve | CodeTree/DP/아이템을 적절히 고르는 문제/동전.cpp | #include <iostream>
#include <vector>
using namespace std;
int dp[10001];
int main() {
ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
const int inf = 1e9;
int n, m;
cin >> n >> m;
vector<int> coins(n);
for (int i = 1; i <= m; ++i) dp[i] = inf;
for (int i = 0; i < n; ++i) cin >> c... | ALGO | 0.999994 | 4.498498 |
8b3aba27-6ed6-4a90-9d75-ff6882c75dd6 | srgntpop/LeetcodeChallenges | valid-anagram.cpp | class Solution {
public:
bool isAnagram(string s, string t) {
int sLen = s.length();
int tLen = t.length();
if (sLen != tLen){
return false;
}
vector<int> freqs(26, 0);
vector<int> freqt(26, 0);
int idxs = 0;
int idxt = 0;
for (int ... | ALGO | 0.999979 | 6.504021 |
52c07866-feda-4d0b-9113-4843c6f07e83 | n3wzd/Programmers | 2021 KAKAO BLIND RECRUITMENT - 매출 하락 최소화.cpp | #include <iostream>
#include <vector>
using namespace std;
vector<int> childs[300001], sales;
int cache[300001][2];
int DP(int n, int must) {
if (cache[n][must] != -1)
return cache[n][must];
if (childs[n].size() == 0)
return must ? sales[n] : 0;
cache[n][must] = sales[n];
for (int c : c... | ALGO | 0.999576 | 4.556355 |
e260b10a-889a-4546-9b2d-1b9700000d3b | nerd-sourav/x | GFG POTD/DECEMBER/26_d.cpp |
#include <bits/stdc++.h>
using namespace std;
class Solution{
public:
void precompute()
{
// Code Here
}
long long solve(long long l, long long r){
// Code Here
long long count = 0;
for(int i=0; i<64&&(1<<i)<r; i++){
for(int j=i+1; j<64; j++){
for(i... | ALGO | 0.999879 | 5.446628 |
3c3853c4-6245-483b-bb4d-4d87cd46d899 | 17Aryan/Leetcode-Submissions | 0263-ugly-number/0263-ugly-number.cpp | class Solution {
public:
bool isUgly(int n) {
while(n>1){
if(n%2==0)
n=n/2;
else if(n%3==0)
n=n/3;
else if(n%5==0)
n=n/5;
else
break;
}
if(n==1)
return true;
el... | ALGO | 0.999956 | 5.861276 |
64404f5b-45ec-4943-baf9-a5d726449519 | hsiehhRPI/Project | DataStructures/Labs/ds_lab3/compute_squares.cpp | #include <iostream>
#include <cmath>
void compute_squares(int a[], int b[], unsigned int n) {
int *p;
int *t;
t = b;
for (p = a; p<a+n; p++) {
*t = pow(*p, 2);
std::cout << *t << std::endl;
t++;
}
}
int main() {
int a[5] = {1,2,3,4,5};
int b[5] = {};
compute_squares(a,b,5);
} | ALGO | 0.990389 | 3.884024 |
99c0f8d9-05da-425a-b2c9-db1ec58e0538 | yuki1ssad/CppMultiThread | main_04.cpp | /*
互斥量概念、用法、死锁演示
1、互斥量 --> 是个类对象,理解为锁。多个线程尝试用 lock() 成员函数来对这把锁加锁,只有一个线程能成功上锁,没成功的线程卡在 lock() 这里不断地尝试上锁
1.1 lock(), unlock() 要成对使用
1.2 std::lock_guard类模板
防止程序员忘记 unlock()
取代 lock(), unlock(), 用了 std::lock_guard 就不能使用 lock(), unlock(),反之亦然
std::lock_guard<std... | TOOL | 0.974579 | 4.166101 |
31ee6964-d497-42fa-a702-c6822db318dd | ishankinger/Data-Structures-and-Algorithms | STRINGS/iking_107.cpp | // ***************** CHECK WHETHER GIVEN TWO STRINGS ARE ISOMORPHIC OR NOT *****************
// ISOMORPHIC MEANS EACH ELEMENT OF THE STRINGS HAVE ONE TO ONE MAPPING
#include<bits/stdc++.h>
using namespace std;
int main(){
string s1,s2; cin>>s1>>s2;
if(s1.size()!=s2.size()){
cout<<"no"<<"\n";
r... | ALGO | 1 | 5.028595 |
af20c8ed-dea4-4b79-a7e7-1451ce7ba7dd | Plain-Andy-legacy/android_frameworks_av | media/libstagefright/codecs/amrnb/common/src/syn_filt.cpp | /*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include <string.h>
#include "syn_filt.h"
#include "cnst.h"
#include "basic_op.h"
#include "basic_op.h"
/*-----------------------------... | ALGO | 0.999701 | 5.2198 |
1b1b0b40-7ff1-4983-bdef-092f7bc66faf | zzhou292/JZ-projectlets | LeetDaily/0077_combinations/combinations.cpp | // Author: Jason Zhou
#include "../general_include.h"
using namespace std;
class Solution {
public:
void dfs(vector<vector<int>>& res, vector<int>& cur_sol, int& n, int& k, int start){
// backtracking terminal conditions
if(cur_sol.size()==k) res.push_back(cur_sol);
for(int i = start; i <... | ALGO | 0.999946 | 5.687382 |
5cf4183e-8c56-48be-b0a3-3283364c01e0 | lc-3-2/llvm | lldb/source/Host/common/GetOptInc.cpp | #include "lldb/Host/common/GetOptInc.h"
#if defined(REPLACE_GETOPT) || defined(REPLACE_GETOPT_LONG) || \
defined(REPLACE_GETOPT_LONG_ONLY)
// getopt.cpp
#include <cerrno>
#include <cstdlib>
#include <cstring>
#if defined(REPLACE_GETOPT)
int opterr = 1; /* if error message should be printed */
i... | TOOL | 0.877295 | 6.707003 |
03be0a6d-5eb8-4cdd-bfa0-8ad4f210bb64 | ABI-Software/ICMA | CPP/FittingRefinedLVModel/src/alglib/optimization.cpp | #include "stdafx.h"
#include "optimization.h"
// disable some irrelevant warnings
#if (AE_COMPILER==AE_MSVC)
#pragma warning(disable:4100)
#pragma warning(disable:4127)
#pragma warning(disable:4702)
#pragma warning(disable:4996)
#endif
using namespace std;
/////////////////////////////////////////////////////////////... | ALGO | 0.999265 | 5.734746 |
2446bc71-4454-4791-a3ef-c9b88d444a3f | tj1023/CodeSolve | BOJ/BOJ_2252.cpp | #include <iostream>
#include <vector>
#include <queue>
using namespace std;
struct Node {
int num, degree = 0;
vector<int> edge;
};
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int n, m, a, b, count = 0;
cin >> n >> m;
vector<Node> nodes(n + 1);
for (int i = 1; i <= n; i++)
nodes[i].... | ALGO | 0.999995 | 4.925858 |
dadcd4fd-69d7-468e-b476-c7ab482bfe4c | anusha2009/leetCodeSubmissions | 3430-count-days-without-meetings/count-days-without-meetings.cpp | class Solution {
public:
int countDays(int days, vector<vector<int>>& meetings) {
sort(meetings.begin(), meetings.end());
vector<vector<int>> mergedMeetings;
int count = 0;
for(auto meeting : meetings) {
if(mergedMeetings.empty() || mergedMeetings.back()[1] < meeting[0]) ... | ALGO | 0.999968 | 5.838456 |
81befa89-0fd4-479e-9c0f-6d0fc23e85ad | Varshamalode7/DSAL_SEM4 | Assignment_12.cpp | // Implementation of a direct access file -Insertion and deletion of a
// record from a Direct Access File.
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
class HashTable
{
int address[10];
public:
HashTable()
{
for (int i = 0; i < 10; i++)
{
add... | ALGO | 0.940883 | 4.517982 |
59bdd8eb-aba2-46cd-96cd-6ae3cf1e4b3b | lantimilan/topcoder | leetcodenew/symmetric-tree.cpp | /**
* symmetric-tree.cpp
* https://oj.leetcode.com/problems/symmetric-tree/
*
* Definition for binary tree
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
bool isSymmetric(TreeNode ... | ALGO | 0.999967 | 6.466874 |
71a18c0e-cafb-431d-a4e2-623ddee4bf4a | memorax/memorax | src/constraint_container1.cpp | #include "constraint_container1.h"
bool ConstraintContainer1::check_uniqueness(const std::set<Constraint*,valcmp> &s){
for(std::set<Constraint*,valcmp>::const_iterator it = s.begin(); it != s.end(); it++){
std::set<Constraint*,valcmp>::const_iterator it2 = it;
it2++;
std::string s_it = (*it)->to_string()... | ALGO | 0.984614 | 4.22882 |
a44e9cf6-39da-4b6d-bdb1-cba2d1d288f7 | arnald999/gfg | linkedlist/Stack&Queue/queue.cpp | #include <iostream>
using namespace std;
class Node
{
public:
int data;
Node *next;
};
class Queue
{
public:
Node *front, *rear;
};
Queue *createQueue()
{
Queue *q = new Queue();
q->front = q->rear = NULL;
return q;
}
void enqueue(Queue *q, int k)
{
Node *temp = new Node();
temp->data = k;
temp->next ... | ALGO | 0.999425 | 4.267487 |
a6b040e0-5557-47bc-895b-8f6c3d7e04f0 | deepakbairagi/Data-Structure | C++/LINKED LIST/CloneList_RandomPointer.cpp | struct Node {
int data;
Node *next;
Node *arb;
Node(int x) {
data = x;
next = NULL;
arb = NULL;
}
};
//Function to clone a linked list with next and random pointer.
Node *copyList(Node *head) {
// Your code here
Node* curr=head;
Node* next;
while(curr!=NULL)... | ALGO | 0.998992 | 4.115138 |
c065a204-06bf-4089-aee4-e152007db3e7 | jahemni/stanford-algorithms-specialization | Divide and Conquer, Sorting and Searching, and Randomized Algorithms/Week 1/(merge_sort_static.cpp | // merge_sort_static.cpp
// ---------------------------------------------
// Classic Merge Sort using fixed-size temporary arrays
// ---------------------------------------------
// This version uses stack-allocated arrays `L[]` and `R[]` for merging.
// Simpler to understand, but less memory-efficient for large arrays... | ALGO | 0.999996 | 6.856194 |
3dc7ccb7-cd2f-4c23-81ee-c2bb61f7cf00 | Beyonder230/data-structure | sparse_matrix_array/sparse_matrix_class.cpp | #include <cstddef>
#include <iostream>
#include <istream>
#include <ostream>
using namespace std;
class Element
{
public:
int i;
int j;
int x;
};
class Sparse
{
private:
int m;
int n;
int num;
Element *ele;
public:
Sparse(int m, int n, int num)
{
th... | ALGO | 0.996942 | 3.6255 |
0341796a-c4ec-4fdb-bb3c-51d7c11fa390 | raincross7/code-similarity | codes/train_code/problem439/problem439_429.cpp | //Radhe Radhe
#include<bits/stdc++.h>
#define ll long long
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define mod 1000000007
using namespace std;
int main()
{
fast_io
ll i,t,n,j,k,sum=0,cpn;
string s;
cin>>n;
ll a[n];
for(i=0;i<n;i++) cin>>a[i];
sort(a,a+... | ALGO | 0.999535 | 3.453826 |
a67ebfcc-8461-49a3-9c01-3ac8b6983f97 | AtiQ-Rahman/Practice-Problems | multiples.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int x;
for (int i = 200; i >0; i--)
{
if(i%3==0) cout<<i<<endl;
}
return 0;
} | ALGO | 0.997733 | 3.130587 |
119d38ed-eed1-46d4-b449-230bae83c18f | dipu626/Code-Template | Data Structure/Mo's Algorithm/mo.cpp | /*
Problem : F - Range Set Query
OJ : atcoder.jp
Statement : We have N colored balls arranged in a row from left to right; the color of the i-th ball from the left is Ci
You are given Q queries. The i-th query is as follows: how many different colors do the L-th through R-th balls from the l... | ALGO | 0.999931 | 4.836241 |
b1560752-f16b-41d9-b49f-de1f79366324 | md-julfikar/leetcode | jumpgame2.cpp | #include<bits/stdc++.h>
using namespace std;
int solve(const vector <int> nums, int i)
{
if(i+nums[i]>=nums.size()-1) return 1;
int mx=INT_MIN;
int cur=0;
for(int j=1; j<=nums[i]; j++)
{
if(i+j<nums.size()&&nums[i+j]+j>mx){
mx=nums[j+i]+j;
cur=i+j;
}
}
... | ALGO | 0.999961 | 4.058416 |
97b67a70-0e6e-4a66-ba31-f8158cb80617 | ishandutta2007/codeforces | liti/normal/313/C.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
using namespace std;
int main()
{
long long m;
cin >> m;
vector<long long> num;
int n = log2( m ) / 2 ;
// cout << n << endl;
long long tmp;
for(long i = 0 ; i < m ;i++)
{
cin >> tmp;
num.push_back(tmp);
}
sort( num.begin() , n... | ALGO | 0.999984 | 3.836119 |
db8f1fe9-e189-4f7f-a93b-ba4bdd50b8a2 | notwatermango/cp-submissions | atcoder/abc244/G.cpp | #include <bits/stdc++.h>
using namespace std;
typedef int64_t i64;
typedef int32_t i32;
i32 water = !not!iscntrl(isupper(isgraph(iscntrl(ispunct(isalpha(EOF))))));
#define mango(x)
#define fastmango cin.tie(nullptr)->sync_with_stdio(water)
#define precisemango(x) cout << fixed << setprecision(x)
#ifdef notwatermango
... | ALGO | 0.999993 | 3.8394 |
f0a69b99-7dc0-43a0-9ddd-2ef6f4d55151 | lxxjs/LiquidHazard | LiquidHazard-1.0.0/LiquidHazard/Box2D/Collision/Shapes/b2PolygonShape.cpp | #include <Box2D/Collision/Shapes/b2PolygonShape.h>
#include <new>
b2Shape* b2PolygonShape::Clone(b2BlockAllocator* allocator) const
{
void* mem = allocator->Allocate(sizeof(b2PolygonShape));
b2PolygonShape* clone = new (mem) b2PolygonShape;
*clone = *this;
return clone;
}
void b2PolygonShape::SetAsBox(float32 hx,... | ALGO | 0.985807 | 7.902519 |
0996cf0c-4dc4-4f18-9a97-fb35de71aeb8 | walkccc/LeetCode | solutions/755. Pour Water/755.cpp | class Solution {
public:
vector<int> pourWater(vector<int>& heights, int volume, int k) {
int i = k;
while (volume-- > 0) {
while (i > 0 && heights[i] >= heights[i - 1])
--i;
while (i + 1 < heights.size() && heights[i] >= heights[i + 1])
++i;
while (i > k && heights[i] == h... | ALGO | 0.999991 | 5.879878 |
565e92dd-af91-454c-a843-0d4dfc28e7ee | apppies/CompetitiveProgramming | Kattis/temperatureconfusion.cpp | // https://open.kattis.com/problems/temperatureconfusion
#include <iostream>
#include <string>
#include <algorithm>
int main(){
std::string line;
while (std::getline(std::cin, line)){
auto slash = line.find('/');
auto a = stoi(line.substr(0, slash));
auto b = stoi(line.substr(slash + 1... | ALGO | 0.999435 | 5.339849 |
daa4a0e6-4943-4891-abd1-eb980d1f16b9 | shubhamj99/CPPCodes | Linked List/Linked List-K Append.cpp | #include<iostream>
using namespace std;
class node{
public:
int data;
node*next;
node(int d){
data=d;
next=NULL;
}
};
void insertAtTail(node*&head,int data){
if(head==NULL){
head=new node(data);
return;
}
node*tail=head;
while(tail->next!=NULL){
... | ALGO | 0.999991 | 3.537282 |
be7fcd9d-8db3-48bd-8ec4-f970b2445825 | retr0717/leetcode-ques | dynamic-prog/trianglePathRecur.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution {
private:
int MinPath(int i , int j, vector<vector<int>> arr, int n)
{
if(i == n-1) return arr[n-1][j];
int down = arr[i][j] + MinPath(i+1, j, arr, n);
int diag = arr[i][j] + MinPath(i+1, j+1, arr, n);
return min(do... | ALGO | 0.999994 | 5.931682 |
e6396474-69a4-4505-bfc4-85e38f519034 | phuongpham145/codecpp | MangMotChieu/12_LietKeChiaHet.cpp | /*
Cho mảng một chiều các số nguyên không âm,
đếm các số nguyên dương x > 1 sao cho tất cả các phần tử trong mảng đều chia hết cho x.
*/
#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b)
{
if (b == 0)
return a;
return gcd(b, a % b);
}
int main()
{
int n;
cin >> n;
int a[n]... | ALGO | 0.999984 | 4.170468 |
8657d9a4-d942-46da-9f0a-938c06a4c033 | EshanthPatyal/Leet_solns | 3209-minimum-number-of-coins-for-fruits/minimum-number-of-coins-for-fruits.cpp | class Solution {
public:
int recur(vector<int>&dp,int idx,vector<int>&p){
if(idx>=p.size())return 0;
if(dp[idx]!=-1)return dp[idx];
int cur=INT_MAX;
for(int j=idx+1;j<=2*idx+2;j++){
cur=min(cur,recur(dp,j,p));
}
return dp[idx]=cur+p[idx];
}
int mi... | ALGO | 0.999957 | 5.769172 |
4729785b-3213-4e97-8e34-0287f7f2b326 | demining/dogecoin-Google-Colab | src/wallet/crypter.cpp | #include "crypter.h"
#include "crypto/aes.h"
#include "crypto/sha512.h"
#include "script/script.h"
#include "script/standard.h"
#include "util.h"
#include <string>
#include <vector>
#include <boost/foreach.hpp>
int CCrypter::BytesToKeySHA512AES(const std::vector<unsigned char>& chSalt, const SecureString& strKeyData... | TOOL | 0.914989 | 7.5791 |
6cbba564-cf41-4cff-884e-62f09f36899b | ajunior/cp | uri/Cpp/1143.cpp | #include <iostream>
#include <cmath>
using namespace std;
int main() {
int n;
cin >> n;
for (int i = 1; i <= n; i++) {
cout << i << " " << pow(i,2) << " " << pow(i,3) << endl;
}
return 0;
} | ALGO | 0.989263 | 3.559929 |
317b4e9f-16b7-48c9-8a44-fbdfecc42b62 | warzes/FanWorlds | src/BulletLib/BulletSoftBody/btDeformableMultiBodyConstraintSolver.cpp | #include "btDeformableMultiBodyConstraintSolver.h"
#include "BulletReducedDeformableBody/btReducedDeformableBodySolver.h"
#include <iostream>
// override the iterations method to include deformable/multibody contact
btScalar btDeformableMultiBodyConstraintSolver::solveDeformableGroupIterations(btCollisionObject** bodi... | ALGO | 0.997105 | 5.780165 |
e26def2a-bb83-4f11-baa7-c4aa06ca230b | ApurvSardana/LeetCode | 268-Missing-Number.cpp | class Solution {
public:
int missingNumber(vector<int>& nums) {
long long len = nums.size();
long long sum = (len*(len + 1)) / 2;
long long sum2 = 0;
for(int i = 0; i < len; i++)
sum2 += nums[i];
return sum - sum2;
}
}; | ALGO | 0.999935 | 5.484596 |
a42c5ca1-013c-4913-bbf6-3860a8430fd3 | pmoulon/IPOL_AC_RANSAC | src/third_party/sift_anatomy/lib_sift.cpp | /**
* @file lib_sift.c
* @brief A simplified interface to the anatomy with standard parameters.
*
*
* @author Ives Rey-Otero <<EMAIL>>
*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "lib_sift.h"
#include "lib_sift_anatomy.h"
#include "lib_keypoint.h"
#include "lib_util.h"
static struct s... | TOOL | 0.962116 | 5.477604 |
20abe718-ec26-45b8-bdcb-347f6b55d4a3 | Anubhav12345678/competitive-programming | MAXCHUNKSTOMAKESORTEDIIARRAYVVVVIMPLEETCODE.cpp | //QUESTION
/*
This question is the same as "Max Chunks to Make Sorted" except the integers of the given array are not necessarily distinct,
the input array could be up to length 2000, and the elements could be up to 10**8.
Given an array arr of integers (not necessarily distinct), we split the array into some number ... | ALGO | 0.999978 | 5.591186 |
80468714-21c0-4e8d-9e43-48ba77194e7d | 22jinwoO/CodingTest | 프로그래머스/0/120817. 배열의 평균값/배열의 평균값.cpp | #include <string>
#include <vector>
using namespace std;
double solution(vector<int> numbers) {
int sum=0;
double answer = 0;
for(int i=0; i<numbers.size();i++)
{
sum+=numbers[i];
}
answer=(double)sum/numbers.size();
return answer;
} | ALGO | 0.995932 | 4.741934 |
fe8d08ae-a2e5-4db3-b9f2-f39537222a5e | theneuronarc/LeetCodeAlgorithms | src/populate_next_pointers.cpp | /*
https://leetcode.com/problems/populating-next-right-pointers-in-each-node/
https://leetcode.com/problems/populating-next-right-pointers-in-each-node-ii/
*/
#include "std_headers.h"
/**
* Definition for binary tree with next pointer.
* struct TreeLinkNode {
* int val;
* struct TreeLinkNode *left, *right, *next;
*... | ALGO | 0.999102 | 4.428586 |
47ea7be5-4476-4200-bf92-eef1466ce88d | ishandutta2007/codeforces | egor.lifar/normal/549/B.cpp | #include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <algorithm>
#include <string>
#include <string.h>
#include <sstream>
#include <queue>
#include <map>
#include <set>
using namespace std;
int n;
int a[200000];
vector<int> v[101];
bool flag[200000];
int main() {
cin >> n;
for (int i =... | ALGO | 0.999928 | 3.005811 |
a52eb296-ac93-4b6b-870d-0d9a046b3fd9 | oscarmorand/ANI3D_Project | src/implicit_surface/implicit_surface.cpp | #include "implicit_surface.hpp"
using namespace cgp;
static void update_normals(std::vector<vec3>& normals, int number_of_vertex, grid_3D<vec3> const& gradient, std::vector<marching_cube_relative_coordinates> const& relative_coords)
{
// Compute the normal using linear interpolation of the gradients
for (int k = 0;... | ALGO | 0.998779 | 5.599016 |
12788da8-b717-4309-be1a-8a88ac22f490 | yamkush/GSRelightFourier | r3dg-rasterization/third_party/glm/test/core/core_func_integer_bit_count.cpp | // This has the programs for computing the number of 1-bits
// in a word, or byte, etc.
// Max line length is 57, to fit in hacker.book.
#include <cstdio>
#include <cstdlib> //To define "exit", req'd by XLC.
#include <ctime>
unsigned rotatel(unsigned x, int n)
{
if (static_cast<unsigned>(n) > 63) { std::printf("r... | ALGO | 0.998994 | 4.846448 |
69d1b24c-8f16-4960-bcf7-35c8b21720c8 | yplusplus/aabbyy | 20140211/f.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 100010;
struct point
{
int x,y;
friend bool operator < (const point &p,const point &q) {
if(p.x == q.x) return p.y < q.y;
return p.x < q.x;
}
}a[N];
int main()
{
int n;
bool flag = false;
while(scanf("%d",&n) != EOF) {
for(int i = 1; i <= n; i +... | ALGO | 0.999468 | 3.10579 |
eb527f62-2373-42fe-8d29-165722175346 | ishandutta2007/codeforces | i_love_tanya_romanova/normal/161/E.cpp | /*
*/
//#pragma comment(linker, "/STACK:16777216")
#define _CRT_SECURE_NO_WARNINGS
#include <fstream>
#include <iostream>
#include <string>
#include <complex>
#include <math.h>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <stdio.h>
#include <stack>
#include <algorithm>
#include <list>
#in... | ALGO | 0.999645 | 4.011562 |
fcb9b431-95bf-4459-bdd5-d9236a3196c2 | suziyxm/llvm-cherrypick | lldb/test/API/functionalities/data-formatter/frameformat_smallstruct/main.cpp | struct Pair {
int x;
int y;
Pair(int _x, int _y) : x(_x), y(_y) {}
};
int addPair(Pair p)
{
return p.x + p.y; // Set break point at this line.
}
int main() {
Pair p1(3,-3);
return addPair(p1);
}
| ALGO | 0.966956 | 4.707062 |
9f4c3441-dc7c-40a5-8997-1a8c97501b59 | ishandutta2007/codeforces | humbertoyusta/normal/997/B.cpp | #include<bits/stdc++.h>
using namespace std;
/// Pragmas:
//#pragma GCC optimize("Ofast","unroll-loops","omit-frame-pointer","inline") //Optimization flags
//#pragma GCC option("arch=native","tune=native","no-zero-upper") //Enable AVX
//#pragma GCC target("avx2") //Enable AVX
/// Macros:
#define int long long
#define f... | ALGO | 0.999608 | 4.291821 |
71db18ea-8c31-470f-8464-54df19f377de | vgnshiyer/Data-Structures-and-Algorithm-Solutions | Algorithms/Dynamic Programming/Catalan Numbers/nBSTs.cpp | #include <bits/stdc++.h>
using namespace std;
/*Given the value 'n', find the number of ways to construct a binary search tree with n nodes.*/
/*
state: dp[i] => number of ways to construct a BST with i nodes.
transition: dp[i] => sum(dp[k]dp[i-1-k]) where k ranges from 0 to i
base case: dp[0] = dp[1] = 1;
*/
int dp[1... | ALGO | 0.999977 | 5.308234 |
b563b2c0-08e0-4a33-a525-70c8110538e2 | Kavin1421/Leetcode-Solution | 1800-1899/1823.Find the Winner of the Circular Game/Solution.cpp | class Solution {
public:
int findTheWinner(int n, int k) {
if (n == 1) return 1;
int ans = (findTheWinner(n - 1, k) + k) % n;
return ans == 0 ? n : ans;
}
}; | ALGO | 0.999997 | 5.909733 |
c5429b50-5c41-4571-b045-9749d9215553 | devnowk/Algorithm-Study | it 취업을 위한 알고리즘 문제풀이 (with CC++)/79. 원더랜드 - Prim MST(최소스패닝트리) 알고리즘 - priority_queue 활용.cpp | #include <stdio.h>
#include <algorithm>
#include <queue>
struct Node // 목표 정점과 가중치 값
{
int n; // 목표 정점
int val; // 가중치 값
Node(int a, int b)
{
n = a;
val = b;
}
bool operator<(const Node &b)const
{
return val>b.val; // b가 작으면 true (최소 힙)
}
};
int ch[30]; // 노드를 방... | ALGO | 0.999933 | 4.338684 |
e16ff4e1-bbdc-4560-a19d-5aecca8ade9a | jhinkoo331/leetcode | solution/0096____Unique_Binary_Search_Trees/96_Unique_Binary_Search_Trees.cpp | #include <vector>
using namespace std;
class Solution {
public:
int numTrees(int n) { //* when n = 0, return 1 as well.
vector<int> v(n + 1, 0);
v[0] = 1;
for(int i = 1; i <= n; ++i){ //* tree's size is `n`
for(int ii = 0; ii < i; ++ii){
v[i] += v[ii] * v[i - 1 - ii];
}
}
return v[n];
}
};
int... | ALGO | 0.999984 | 6.202647 |
fad37d48-6584-4b4e-b641-ef2656c8edc4 | Siriayanur/DSA | SearchingSorting/110kDiffPair.cpp |
/*
Brute Force o(n*n)
Sort + Search =>
o(nlogn) + binarysearch(arr[i]+k,range(i+1,n-1));
Sort + Iterate =>
o(nlogn) + i->0 and j->n-1 ++ and -- according to the sum
*/
#include <bits/stdc++.h>
using namespace std;
bool findPairWithDiffk(int a[], int n, int k)
{
sort(a, a + n);
int i = 0, ... | ALGO | 0.999948 | 4.569506 |
6d278cc0-f8e3-4e23-ab92-26d203ed6d89 | Moongss/ps | Baekjoon/20000-29999/25644.cpp | #include <bits/stdc++.h>
#define endl "\n"
#define fastio cin.tie(0)->sync_with_stdio(0)
using namespace std;
#define x first
#define y second
#define all(v) v.begin(), v.end()
#define compress(v) sort(all(v)), v.erase(unique(all(v)), v.end())
#define lower(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define upper... | ALGO | 0.999938 | 3.940137 |
f0edfa1d-935e-48b8-beb3-621346667c37 | Siriayanur/DSA | Heaps/340kthSmallestElement.cpp | #include <bits/stdc++.h>
//Naive solution
int kthSmallest(int a[], int l, int r, int k)
{
//code here
priority_queue<int, vector<int>, greater<int>> p;
for (int i = l; i <= r; i++)
{
p.push(a[i]);
}
while (k > 1)
{
// cout << p.top() << " ";
p.pop();
k--;
... | ALGO | 0.999994 | 4.983033 |
9bbd16f2-76b3-4bac-90fb-77252875c5eb | huudung0607/DSA-CONTEST-Sap-xep-Tim-kiem | Sắp xếp mảng.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
int n; cin >> n;
int a[n];
for(int i = 0; i < n; i++){
cin >> a[i];
}
int left = -1, right = -1;... | ALGO | 0.99993 | 3.642899 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.