uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
818409e8-9987-49bc-bc01-60ab6d61f991 | coolpps/100Algorithm | 68.把数组拍成最小的数/68.把数组拍成最小的数/68.把数组拍成最小的数.cpp | // 68.ijС.cpp : ̨Ӧóڵ㡣
//
#include "stdafx.h"
//ȫϮ
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
/*
õ,Ҳַ
2ɵĿmnmn,˵32,321,ô3232132132,ʱ32132СģͬʱַȽ32132<32321
*/
// Compare two numbers in strNumber1 and strNumber2
// if [strNumber1][strNumber2] > [strNumber2][strNumber1],
// return value > 0
// if [strNumber1]... | ALGO | 0.999591 | 4.240698 |
19d9ea2b-9a65-41cf-8090-84883f74fae8 | ishandutta2007/codeforces | i_love_tanya_romanova/normal/542/A.cpp | #include <bits/stdc++.h>
using namespace std;
#define jjs(i, s, x) for (int i = (s); i < int(x); i++)
#define jjl(i, x) jjs(i, 0, x)
#define ji(x) jjl(i, x)
#define jj(x) jjl(j, x)
#define jk(x) jjl(k, x)
#define jij(a, b) ji(a) jj(b)
#define ever ;;
#define foreach(x, C) for (auto& x : (C))
#define INF ((int) 1e9+10)... | ALGO | 0.999981 | 4.24178 |
f63fb71e-bf47-4464-a7d1-1daa6ec56899 | sanjeevWeb/leetcode_practice | Display longest name - GFG/display-longest-name.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:
string longest(string names[], int n)
{
int maxi = 0;
string temp = "";
for(int i=0;i<n;i++){
... | ALGO | 0.99994 | 6.167363 |
10a4ff9a-bbdb-41f8-8b63-ee5965c4493b | kingkk31/BOJ | source code/1057_토너먼트.cpp | #include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <queue>
#include <vector>
#include <stack>
#include <set>
#include <map>
#include <list>
#include <string>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <malloc.h>
#include <functional>
#include <time.h>
#pragma warning(disable:49... | ALGO | 0.999919 | 3.365936 |
5bb43186-a2b7-440f-8008-4cf90e142cb9 | 1m188/algorithm | 蓝桥杯/第7届/个人赛省赛/C语言A组/剪邮票.cpp | /*
剪邮票
如【图1.jpg】, 有12张连在一起的12生肖的邮票。
现在你要从中剪下5张来,要求必须是连着的。
(仅仅连接一个角不算相连)
比如,【图2.jpg】,【图3.jpg】中,粉红色所示部分就是合格的剪取。
请你计算,一共有多少种不同的剪取方法。
请填写表示方案数目的整数。
注意:你提交的应该是一个整数,不要填写任何多余的内容或说明性文字。
*/
#include "queue"
#include "iostream"
const bool Judge(bool stamp[30]) //BFS判断连通
{
std::queue<int> isConnectQueue = std::queue<int>... | ALGO | 0.999319 | 4.19474 |
dcb82470-8499-4954-b6cd-e2b446a71bd3 | ishandutta2007/codeforces | .tx/normal/732/C.cpp | #include <bits/stdc++.h>
using namespace std;
template<typename T>
void sci(T& t) {
cin >> t;
}
template<typename T, typename... Ts>
void sci(T& t, Ts&... ts) {
sci(t);
sci(ts...);
};
#define scid(vars...) int vars; sci(vars)
#define scidl(vars...) lint vars; sci(vars)
#define scidd(vars...) double vars;... | ALGO | 0.999914 | 4.175005 |
ca785549-b37e-4fe8-8435-54e86f7c3f92 | kriishukla/CP_Solution | Atcoder/C++ 20 (gcc 12.2)/abc367_b/56791077.cpp | #include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define endl '\n'
using pii=pair<lli,lli>;
#define MP make_pair
#define F first
#define ld long double
#define S second
#define all(o) o.begin(),o.end()
lli M=1e9+7;
using mll = map<lli,lli>;
using vi = vector<lli>;
using vvi = vector<vector<lli>>... | ALGO | 0.999825 | 3.643476 |
de06c9b5-a898-4214-89a2-b58bff7815c6 | yanqi1811/DL | jianzhi-offer/字符串的排列.cpp | /*
链接:https://www.nowcoder.com/questionTerminal/fe6b651b66ae47d7acce78ffdd9a96c7
来源:牛客网
输入一个字符串,按字典序打印出该字符串中字符的所有排列。例如输入字符串abc,则打印出由字符a,b,c所能排列出来的所有字符串abc,acb,bac,bca,cab和cba。
输入描述:
输入一个字符串,长度不超过9(可能有字符重复),字符只包括大小写字母。
*/
/*
递归思路,先从左往右固定一个字符,让后面所有字符依次与其交换位置,然后递归执行,
递归返回后继续对刚交换的字符再交换回来,以保持输入字符串不变。
以这种方式遍历所... | ALGO | 0.999908 | 5.660896 |
60f8e88f-5500-40d2-8f5a-199280b96bd3 | JhollRibeiro/Flutter-Cod3r-Projeto_Perguntas | 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 |
319efe0b-8709-4602-b004-771e08897c1d | rbnpontes/REngine-Atomic | Source/ThirdParty/spirv-tools/source/lint/divergence_analysis.cpp | #include "source/lint/divergence_analysis.h"
#include "source/opt/basic_block.h"
#include "source/opt/control_dependence.h"
#include "source/opt/dataflow.h"
#include "source/opt/function.h"
#include "source/opt/instruction.h"
namespace spvtools {
namespace lint {
void DivergenceAnalysis::EnqueueSuccessors(opt::Instr... | ALGO | 0.978494 | 7.593058 |
4015fda3-3b41-42e4-a114-74adcf481137 | injeChoi/Problem_Solving | BOJ/BOJ_4948_베르트랑공준.cpp | #include <iostream>
#include <math.h>
#include <vector>
using namespace std;
#define SIZE 123456*2
int SOE[SIZE+1];
int main(int argc, char const *argv[]) {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
for (int i = 2; i <= SIZE; i++)
SOE[i] = i;
for (int i = 2; i <= sqrt(SIZE); i++... | ALGO | 0.999611 | 3.815442 |
d841e45e-59eb-42d2-88b6-bea32f1c1e18 | andrefakhoury/competitive-programming | problems/solutions/Brazilian Summer School/Summer School 2019/Dia 8/G.cpp | #include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define mk make_pair
typedef long long ll;
typedef pair<int, int> pii;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const int MAXN = 1e5 + 5;
struct Dinic {
const long long flow_inf = 1e18;
struct... | ALGO | 0.999748 | 4.045348 |
08207eef-a943-4226-a27e-b739facf6ea3 | sabarivijayan/car-rental-flutter | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998733 | 6.76775 |
c95dfd75-c3ba-4048-b5aa-aa89187c1c2b | saidheerajnvs29/ncrwork | cpp programming/assignment1/prog5.cpp | #include<iostream>
using namespace std;
class distance2;
class distance1
{
int dis_m,dis_cm;
public:
distance1()
{
dis_m=dis_cm=0;
}
distance1(int dm,int dcm)
{
dis_m=dm;
dis_cm=dcm;
}
void display()
{
cout<<"the result is "<<dis_m<<" metre,"<<dis_cm<<" centimetres"<<endl;
}
friend distance1 sum1(... | TOOL | 0.938764 | 3.434187 |
6264f028-c68f-472e-8253-a48f89b042c1 | techstormteam/08-phonegap-netcastdigital | netcastdigital/platforms/android/submodules/externals/openh264/codec/encoder/core/src/mv_pred.cpp | #include "mv_pred.h"
#include "ls_defines.h"
namespace WelsSVCEnc {
//basic pMv prediction unit for pMv width (4, 2, 1)
void PredMv (const SMVComponentUnit* kpMvComp, int8_t iPartIdx, int8_t iPartW, int32_t iRef, SMVUnitXY* sMvp) {
const uint8_t kuiLeftIdx = g_kuiCache30ScanIdx[iPartIdx] - 1;
const uint8_t kuiTopI... | ALGO | 0.999115 | 5.271092 |
21cc44f2-06c6-4ec0-b399-a0bd140e7d1e | SINS-Lab/SEA-SAFARI | src/xyz_process.cpp | #include "xyz.h"
#include "vec_math.h"
#include "string_utils.h"
#include <cstdio>
#include <string>
#define THREADCOUNT 6
class Particle
{
public:
std::string atom;
Vec3d position;
Vec3d momentum;
Vec3d velocity;
double mass;
int id;
int nearby;
void fromXYZ(XYZ_Single input, int ind... | ALGO | 0.986487 | 5.430892 |
6c5685df-e2fe-4a8e-aa48-be4a69c23778 | Pankhuri-R/DSA_Cpp | Recursion/tiling.cpp | #include <bits\stdc++.h>
using namespace std;
int totalWays(int n)
{
if (n == 1)
{
return 1;
}
if (n == 0)
{
return 0;
}
int count = 0;
count += totalWays(n - 1) + totalWays(n - 2);
return count;
}
int main()
{
cout << totalWays(4);
return 0;
} | ALGO | 0.999991 | 5.518535 |
d64e9db7-9b53-4505-8cf1-fe44a2b47142 | interactivevislab/TrianglePlugin-UE5 | TrianglePlugin/Source/libigl-static/include/infinite_cost_stopping_condition.cpp | IGL_INLINE void igl::infinite_cost_stopping_condition(
const std::function<void(
const int,
const Eigen::MatrixXd &,
const Eigen::MatrixXi &,
const Eigen::MatrixXi &,
const Eigen::VectorXi &,
const Eigen::MatrixXi &,
const Eigen::MatrixXi &,
double &,
Eigen::RowVectorXd &)> & cost_... | ALGO | 0.996632 | 4.643597 |
9a320de8-20ea-4eec-adbb-4c317f4562af | ishandutta2007/codeforces | .o/normal/255/A.cpp | #include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<algorithm>
#include<vector>
#include<string>
#include<set>
#include<memory.h>
#include<map>
#include<assert.h>
int n;
int a[3],r;
char res[3][20]={"chest","biceps","back"};
int main(){
scanf("%d",&n);
for(int i=0;i<n;i++){
int d; scanf("... | ALGO | 0.999663 | 3.50374 |
4f9d310e-ba77-460e-acd2-9c7205f69f70 | AbdoWael2003/Graduation-Project-QAgent2.0- | FlowChartGeneration/CPPSamples/Sample941/sample_code941.cpp | #include <tuple>
#include <vector>
std::pair<bool> check_element(const std::tuple<int, int, int>& test_tup, const std::vector<int>& check_list) {
bool res = false;
for (const auto& ele : check_list) {
if (std::get<0>(test_tup) == ele || std::get<1>(test_tup) == ele || std::get<2>(test_tup) == ele) {
... | TEST | 0.912861 | 5.849955 |
21502ef4-b61a-41c7-9eb1-6d8469f83162 | Shenjiaqi/sgu | 481/chk.cpp | #include <iostream>
#include <gmpxx.h>
using namespace std;
int main()
{
int n;
freopen("in","r",stdin);
freopen("o1","w",stdout);
scanf("%d",&n);
mpz_class ans(0);
for(int i=3;i<n;++i)
{
mpz_class a=n;
for(int j=n-1;j>n-i;--j)
a*=j;
mpz_class b=1;
for(int j=0;j<n-i-1;++j)
b*=n... | ALGO | 0.999908 | 3.478659 |
0fd1e9bc-e64e-454d-bf8d-c695fc964fc0 | kazisaif23/Codeforces | A_Twin_Permutations.cpp | #include <bits/stdc++.h>
using namespace std;
#define fastread() (ios_base::sync_with_stdio(false), cin.tie(NULL));
using ll = long long;
using ld = long double;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vi>;
... | ALGO | 0.999904 | 4.247581 |
26adfaa5-e525-4cb0-87cf-2a601b5110b0 | iarseny/OlimpiadProgramming | lesson 1/task.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int knapSack(int W, int wt[], int val[], int n)
{
if (W == 0 || n == 0) {
return 0;
}
if (wt[n - 1] > W) {
return knapSack(W, wt, val, n - 1);
} else {
return max(knapSack(W, wt, val, n - 1), val[n... | ALGO | 0.999968 | 5.578568 |
32f2ffe3-0bb4-4b76-95e2-5c37e37b90c6 | EliahKagan/old-practice-snapshot | main/leap-year/leap-year.cpp | #include <iostream>
namespace {
bool is_leap_year(int n)
{
return n % 4 == 0 && (n % 400 == 0 || n % 100 != 0);
}
}
int main()
{
auto t = 0;
for (std::cin >> t; t > 0; --t) {
auto n = 0;
std::cin >> n;
std::cout << (is_leap_year(n) ? "Yes" : "No") << '\n';
}
}
| ALGO | 0.999828 | 5.600366 |
bbb1efac-0e37-431f-a07a-6c445b18ed5b | Abhay-yadav966/DSA-in-Cpp | Backtracking/Optamised_Max_Subarray.cpp | #include<iostream>
#include<vector>
#include<limits.h>
using namespace std;
// This problem is also known as Kadane's Algorithm
int main(){
vector <int> arr = { -2, -3, 4, -1, -2, 1, 5, -3};
int sum = 0;
int maxi = INT_MIN;
for( int i = 0; i < arr.size(); i++ ){
sum = sum + arr[i];
... | ALGO | 0.999953 | 4.672751 |
b9982bf3-2df4-4931-93bf-78590f6506d1 | manojyerra/OpenGL | 3DModelLoaders/ObjToFLMNew/source/UtilFuncs.cpp | #include "UtilFuncs.h"
#include "DefinesAndIncludes.h"
short UtilFuncs::ConvFloatToShort(float val)
{
int intVal = val * 100000;
int sign = (intVal < 0) ? -1 : 1;
if(sign == -1)
intVal = -intVal;
int intVal4 = (intVal / 10) + ((intVal % 10) > 5 ? 1 : 0);
return (short)intVal4*sign;
}
float UtilFuncs::ConvS... | TOOL | 0.885365 | 4.095895 |
b723b5f4-14ab-4a6f-b2c3-ad33f537c1df | Pawan77777/Lab-daa | Week 2/Ques2/Ques2.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin>>t;
while(t--) {
int n;
cin>>n;
int arr[n];
for(int i = 0; i < n; i++)
cin>>arr[i];
vector<int> v;
for(int i = 0; i < n; i++) {
int k = n - 1;
int j = i +... | ALGO | 0.999938 | 4.191123 |
ac3ca2e4-8490-4aa1-a99e-9deb3fa65597 | dydgus1052/Algorithm-in-cpp | Programmers/Level3/Level3-야근 시간.cpp | #include <string>
#include <vector>
#include <algorithm>
using namespace std;
#include <queue>
long long answer = 0;
long long solution(int n, vector<int> works) {
priority_queue<int> q;
for(int i=0; i<works.size(); i++)
{
q.push(works[i]);
}
while(true)
{
if(q.em... | ALGO | 0.999916 | 4.27435 |
0bc92f3b-d272-4788-98bd-24eafba4f2a8 | leclauss/VLCM | src/vlcm/precompute.cpp | #include <vector>
#include <cmath>
#include <cstring>
#include "precompute.h"
constexpr const double FLATNESS_EPSILON = 1e-13;
TimeSeriesInfo::TimeSeriesInfo(const std::vector<double> &time_series, double corr_threshold) {
threshold = corr_threshold;
len = time_series.size();
auto ts_a = new double[len];... | ALGO | 0.999549 | 7.002985 |
e7171c7b-fa8a-491b-b7c4-d767ca46dbf3 | ShantoOBS/Interview_DS_Algorithm | Linked List/Merge Two Sorted Lists.cpp | /* Scroll below to see JAVA code also */
/*
Company Tags : 24*7 Innovation Labs, Amazon, Drishti-Soft, Flipkart, Goldman Sachs, Microsoft, Paytm, Payu, Snapdeal, Visa
Leetcode Link : https://leetcode.com/problems/merge-two-sorted-lists/
*... | ALGO | 0.9999 | 6.378921 |
08f641e2-a6d0-46bc-ba2b-279f519295f7 | wabiverse/Blender | intern/iksolver/intern/IK_Solver.cpp | /** \file
* \ingroup intern_iksolver
*/
#include "../extern/IK_solver.h"
#include "IK_QJacobianSolver.h"
#include "IK_QSegment.h"
#include "IK_QTask.h"
#include <list>
using namespace std;
class IK_QSolver {
public:
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
IK_QSolver() : root(NULL)
{
}
IK_QJacobianSolver solve... | ALGO | 0.993598 | 5.92044 |
a5e3f71e-59cb-4d00-aa39-cea683f75832 | austinsonger/Coding-Challenges | Hackerrank/C++/STL/Deque-STL/main.cpp | #include <algorithm>
#include <cstdio>
#include <deque>
using namespace std;
int main() {
int T, N, K;
int element;
scanf("%d", &T);
while (T--) {
int maximum = 0;
deque<int> elements;
scanf("%d %d", &N, &K);
while (N--) {
scanf("%d", &element);
... | ALGO | 0.999816 | 4.172401 |
9699137c-05d1-467c-895a-ddb32b328746 | puz91/datastructure | algorithm/dinamicprogramming/chocolate.cpp | #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main() {
int n, k;
cin >> n >> k; // รับค่าจำนวนชิ้นช็อกโกแลต (n) และขนาดของเซ็ต S (k)
// สร้าง dp array สำหรับเก็บจำนวนวิธีที่จะแบ่งช็อกโกแลตในแต่ละจำนวนชิ้น
vector<int> dp(n+1, 0); // dp[i] หมายถึงจำนวนวิธีที่แบ่งช็อก... | ALGO | 0.999993 | 4.917732 |
c28b95b2-34ff-4a21-bada-8541c35ecb7f | ishandutta2007/codeforces | sankear/normal/309/C.cpp | #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <bitset>
#include <queue>
#include <deque>
#include <stack>
#include <complex>
#include <cassert>
using namespace std;
#define pb ... | ALGO | 0.999985 | 4.035034 |
668b42c3-15d0-4137-8c82-a599888215d6 | Vivashwan/LeetCodes | 740-delete-and-earn/delete-and-earn.cpp | class Solution {
private:
int func(vector<int>&nums, int n, unordered_map<int, vector<int>>&mp, vector<int>&dp)
{
for(int ind=n-1; ind>=0; ind--)
{
int lastInd = mp[nums[ind]].back();
if(mp[nums[ind]+1].size()>0)
{
lastInd = mp[nums[ind]+1].ba... | ALGO | 0.999661 | 5.741012 |
de87423e-ac87-458f-af5d-3704bb1582cb | Seo-Faper/Data_Structure_with_C | ProblemSolve/1251.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
string reverse(string w)
{
string re = "";
for (int i = w.size() - 1; i >= 0; i--)
{
re += w[i];
}
return re;
}
int main()
{
string s;
cin >> s;
string word1 = "";
string word2 = "";
string wo... | ALGO | 0.999977 | 4.282388 |
b946e5ac-985b-4d20-a9a7-0df3578c9f5f | PHAMTIEN04/C-C-Exercises | tinhgiatria.cpp | #pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#include <bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int x; cin >> x;
long long c ;
if(x >= 10){
c = pow(x,3) + 5*x;
}else{
c = pow(x,2) -... | ALGO | 0.999884 | 4.422858 |
a1d4efbd-e48f-4f0d-8636-48c05eb19adf | Ishrak-Tawsif/Accepted-Codes | Ishrakk_Tawsif-ac/UVA/11417/7728252_AC_80ms_0kB.cpp | #include<bits/stdc++.h>
using namespace std;
#define mx 503
int gcd(int a, int b){
if(a == 0) return b;
else return gcd(b%a,a);
}
int pre_gen(int n){
int sum=0;
for(int i=1; i<n; i++){
int s=0;
for(int j=i+1; j<=n; j++) s += gcd(i,j);
sum += s;//cout<<s<<endl;
}
retur... | ALGO | 0.999519 | 4.380842 |
0f2eaf00-7429-4c06-9db4-1a3dc44c5989 | ishandutta2007/codeforces | 6aren/normal/1153/C.cpp | #include<bits/stdc++.h>
using namespace std;
int n;
string s;
int main() {
ios::sync_with_stdio(false); cin.tie(0);
//freopen("in", "r", stdin);
cin >> n;
cin >> s;
if (s[0] == '(' || s[0] == '?') s[0] = '(';
else return cout << ":(", 0;
if (s[n - 1] == ')' || s[n - 1] == '?') s[n - 1] = ')';
else return cou... | ALGO | 0.99993 | 3.799327 |
9535f483-7b6f-497c-b37c-3ff6dfde6f5c | zakki/openhsp | hsp3ll/llvm/lib/CodeGen/SlotIndexes.cpp | #include "llvm/CodeGen/SlotIndexes.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetInstrInfo.h"
using namespace llvm;
#define DEBUG_TYPE "slotindexes"
char SlotIndexes::ID = 0;
INITIALIZE_PA... | TOOL | 0.905604 | 7.865968 |
efee610d-2eeb-44e3-a729-782d81b5b850 | sourav-9091/DSA-SYNTEX | DSA ALL/QUEUE/c++/circularQueueLL.cpp | #include <iostream>
using namespace std;
class Node{
public:
int data;
Node* next;
};
class Queue{
private:
Node* front;
Node* rear;
public:
Queue();
~Queue();
void enqueue(int x);
int dequeue();
bool isEmpty();
void display();
};
Queue::Queue() {
front = nullptr;
... | ALGO | 0.999569 | 4.747472 |
4ddb2757-9779-46e6-b730-11156776e861 | lyccrius/OI-Solution | CDQZ/1001-Challenge 1.cpp | #include <iostream>
const int maxN = 1e5;
const int maxM = 1e5;
const int logN = 17;
int n, m;
int a[maxN + 10];
char op; int x, y;
struct SegmentTree {
struct Node {
int val;
int lson;
int rson;
} node[maxN * 4 + maxM * logN + 10];
int ncnt;
int root[maxM + 10];
int Clo... | ALGO | 0.999896 | 5.045012 |
7301cf11-27b0-4f51-8358-57158accbc29 | nimit1jain/DSA-Questions | heaps/implementation_by_array.cpp | #include <iostream>
using namespace std;
void heapify(int arr[], int n, int i)
{
int largest = i;
int l = 2 * i + 1;
int r = 2 * i + 2;
if (l < n && arr[l] > arr[largest])
{
largest = l;
}
if (r < n && arr[r] > arr[largest])
largest = r;
if (largest != i)
{
sw... | ALGO | 0.999968 | 4.554527 |
3ace410d-2891-4f2f-bf26-6b3fddbf5937 | gitkrypton18/CPP_PROBLEMS_LAB | LAB 5+6/55_no-of_oddinarray.cpp | // PROGRAM TO READ AN ARRAY OF 10 INTEGERS AND COUNT TOTAL NO OF ODD AND TOTAL NO. OF EVEN
#include <iostream>
using namespace std;
int main() {
int n = 10, arr[n], even = 0, odd = 0;
for (int i = 0; i < n; i++) {
cout << "Enter the array elements: ";
cin >> arr[i];
if (arr[i] % 2 == 0... | ALGO | 0.997677 | 5.280769 |
17952465-e22b-42e5-8874-94f26ed62e70 | ishandutta2007/codeforces | farhod_farmon/normal/1083/E.cpp | #include <bits/stdc++.h>
#define fi first
#define se second
#define ll long long
const int N = 1000010;
using namespace std;
int n;
pair < pair < int, int >, long long > p[N];
vector < int > v;
vector < pair < long long, long long > > g;
long double inter(int i, int j)
{
return (long double)(g[j].se - g[i]... | ALGO | 0.99979 | 4.042013 |
68092b21-9268-49f0-99b5-c8159f1c40f0 | Ubaid-Manzoor/Interview_Practice | Data Structures Problems/Heap/Implementation/Implementation_of_MinHeap/main.cpp | #include <iostream>
#include <vector>
using namespace std;
class MinHeap {
private:
bool isLeaf(int pos){
if(leftChild(pos) >= size)
return true;
return false;
}
int leftChild(int parentIndex){
return 2 * parentIndex + 1;
}
int rightChild(int parentIndex){
... | ALGO | 0.999891 | 4.055859 |
764267f6-9013-41be-a78c-6981bc1af269 | ResurrectionRemix/android_development | perftests/panorama/feature_stab/db_vlvm/db_utilities_poly.cpp | /* $Id: db_utilities_poly.cpp,v 1.2 2010/09/03 12:00:10 bsouthall Exp $ */
#include "db_utilities_poly.h"
#include "db_utilities.h"
/*****************************************************************
* Lean and mean begins here *
****************************************************... | ALGO | 0.999712 | 5.252677 |
1fe6f431-ca64-4113-aa41-b0c7a65e04f0 | saketh1999/DSA_MASTERY | Medium/Shortest path in Directed Acyclic Graph/shortest-path-in-directed-acyclic-graph.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 {
private:
void dfs(map<int,list<pair<int,int> >> &adjlist, stack<int>&topo,vector<bool> &visited,int v)
{
visited[v]=true;
... | ALGO | 0.999963 | 5.864928 |
79d71497-b2ad-4474-ad99-58ab8f60bfe9 | minakshikataria2001/cpp_codes | listADT.cpp | #include<iostream>
using namespace std;
class node{
public:
int data;
node* next;
node(int x){
data = x;
next = NULL;
}
};
void insertAtTail(node* &head,int val){
node* n = new node(val);
if(head==NULL){
head=n;
return;
}
node* temp = head;
... | ALGO | 0.999074 | 4.003249 |
84197789-ba62-411d-80a3-480ccd5d8f97 | LanZBoY/LeetCodeWithCpp | basic.cpp | #include <iostream>
using namespace std;
int main() {
const int LENGTH = 5;
int arr[LENGTH] = {10, 20, 30, 40, 50};
cout << &arr << endl;
cout << &arr + 1 << endl;
/*
可以透過這神奇的方法,取得Array長度
但不常使用,也不建議使用。
除了可讀性較差外,如果是指標指向Array首個位址
這個方法會失效。
*/
cout << *(&arr + 1) - arr << ... | ALGO | 0.88883 | 3.406511 |
5bcd5ffd-a58c-4f8b-b812-66e6a14a7713 | nguyenvanlinh1105/Data-Structures-and-Algorithms | Bt chuong 3/bai1.cpp | #include <stdio.h>
#include <stdlib.h>
#include<string.h>
//?nh nghia c?u trc c?a m?t nt trong cy
struct SV {
char maSV[10];
char hoTen[20]
};
struct Node {
char name[50];
struct Node* L;
struct Node* R;
};
// Hm d? t?o m?t nt m?i
struct Node* createNode(char name[]) {
struct Node* newNode = new Nod... | ALGO | 0.999925 | 3.670548 |
8e86472a-723d-4f8c-8045-49764a6c3d7d | imec-csa/gem5 | src/systemc/tests/systemc/misc/semantic/2.3/T_2_3_5_1/T_2_3_5_1.cpp | /*****************************************************************************
T_2_3_5_1.cpp --
Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
*****************************************************************************/
/**************************************************************************... | ALGO | 0.950118 | 4.153344 |
50c62705-b3b8-40a4-b923-6b3c25541cc3 | tirthankarhalder/dsaCP | Others/prime_Check.cpp | #include<bits/stdc++.h>
using namespace std;
#define ln "\n"
#define nl cout<<ln;
int main()
{
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
int n,sum =0,flag=0;
cin>>n;
if(n==1){
cout<<"Not googly";
}
else{
i... | ALGO | 0.998103 | 3.634319 |
497d90dd-674a-4324-aa9e-10c8df431aed | Biswajits2/RDS-Project | RDS_Project/src/filter.cpp | /*
Comp Eng 3DY4 (Computer Systems unsigned integration Project)
Department of Electrical and Computer Engineering
McMaster University
Ontario, Canada
*/
#include "dy4.h"
#include "filter.h"
#include <iostream>
#include <iomanip>
#include <fstream>
#include <vector>
#include <complex>
#include <cmath>
#include <algor... | ALGO | 0.99901 | 4.974722 |
a43a35ad-af5e-467a-ab8b-cd0c18582f70 | sayzs1/514finalproject | second device code/second device/src/edge-impulse-sdk/tensorflow/lite/micro/kernels/elu.cpp | #include "edge-impulse-sdk/tensorflow/lite/kernels/internal/reference/elu.h"
#include <algorithm>
#include <limits>
#include "edge-impulse-sdk/tensorflow/lite/c/common.h"
#include "edge-impulse-sdk/tensorflow/lite/kernels/internal/cppmath.h"
#include "edge-impulse-sdk/tensorflow/lite/kernels/internal/quantization_uti... | ALGO | 0.984285 | 7.166768 |
3b2ccf99-9bb7-46d1-9233-e4cca8516e64 | guider/Snorlax | leetcode/stack/1678-Goal-Parser-Interpretation.cpp |
#include <vector>
#include <string>
#include <stack>
using namespace std;
class Solution {
public:
string interpret(string command) {
string res = "";
stack<char> st;
for (auto c : command) {
if (c == 'G') res += c;
else if (c == ')') {
if (st.top(... | ALGO | 0.998005 | 4.535477 |
9ea297e1-2372-4d96-8e9a-040ae88ae246 | buaadf/learncpp | 5_9_1.cpp | #include<iostream>
int main()
{
using namespace std;
cout<<"Please enter 2 numbers:\n";
cout<<"Enter the smaller number:";
int min;
cin>>min;
cout<<"Enter the larger number:";
int max;
cin>>max;
int sum = 0;
for(int i=min;i<=max;i++)
{
sum = sum+i;
}
cout<<"The sum of numbers between "<<min<<" and "<<max... | ALGO | 0.977391 | 3.849488 |
eb9ab453-7d22-4e30-9723-3c77001ced3c | AmitKumarDubey110/Placement_Preparation_2023 | Dynamic Programming/931. Minimum Falling Path Sum.cpp | class Solution {
public:
int minFallingPathSum(vector<vector<int>>& A) {
const int n = A.size();
for (int i = 1; i < n; ++i)
for (int j = 0; j < n; ++j) {
int mini = INT_MAX;
for (int k = max(0, j - 1); k < min(n, j + 2); ++k)
mini = min(mini, A[i - 1][k]);
A[i][j] +=... | ALGO | 0.999931 | 6.563262 |
c8e8e0fe-08c1-4e19-9514-9dea8c4895d6 | Cryptic-dev1/Akitacoin | src/crypto/chacha20.cpp | // Based on the public domain implementation 'merged' by D. J. Bernstein
// See https://cr.yp.to/chacha.html.
#include "crypto/common.h"
#include "crypto/chacha20.h"
#include <string.h>
constexpr static inline uint32_t rotl32(uint32_t v, int c) { return (v << c) | (v >> (32 - c)); }
#define QUARTERROUND(a,b,c,d) \
... | ALGO | 0.999409 | 6.900703 |
346fa082-ec4a-4dfd-9da5-092f0f192bbc | Request2609/codeOfPractice | letcode/不同路径.cpp | #include <iostream>
#include <vector>
class Solution {
public:
int uniquePaths(int m, int n) {
std::vector<std::vector<int>>ls(n, std::vector<int>(m, 0)) ;
int col = 0 ;
int row = 0 ;
ls[row][col] = 1 ;
int maxs = ls[row][col] ;
for(int i=0; i<n; i++) {
fo... | ALGO | 0.999967 | 4.556127 |
1f37a808-7a8e-4536-92d6-db3a7a4e16ca | aggarwalmanish/coding_practice | Recursion/large_factorial.cpp | vector<int> factorial(int N){
// code here
vector<int> res;
if(N==1) {
res.push_back(N);
return res;
}
vector<int> next_fact = factorial(N-1);
int digits = 0;
int curr = N;
while(curr>0) {
curr = curr/10;
... | ALGO | 0.999977 | 5.546149 |
05f2e9ea-10e8-4ea8-9aa2-07936957b2b4 | peshe/FMI-SDP-2024 | Практикум/Компютърни науки/A група/Week 4/solutions/6_MaxQueue.cpp | #include <iostream>
#include <queue>
#include <stdexcept>
class MaxQueue
{
private:
std::queue<int> mainQueue;
std::deque<int> maxQueue;
public:
void enqueue(int value)
{
mainQueue.push(value);
while (!maxQueue.empty() && maxQueue.back() < value)
{
maxQueue.pop_back... | ALGO | 0.996817 | 6.248519 |
829cf568-b5e0-40ed-b80c-b3184f5ab82c | raihansikdar/STL | STL/8.4.Map_Erase_Count_find.cpp | #include<iostream>
#include<map>
#include<iterator>
using namespace std;
int main()
{
freopen( "input.txt","r", stdin);
freopen( "my_output.txt","w", stdout);
map<int,string> mp;
mp[1] = "Raihan";
mp[2] = "Mamun";
mp[3] = "Afridi";
mp.insert({4,"Amir"}); //also
mp.erase(1); // key ... | ALGO | 0.983075 | 3.871878 |
73823851-179f-4e4d-84e0-7a18dfb10dd3 | AyushSahay1902/DSA-CP | TCSNinja/AmountCalculations.cpp | /*
Amount calculation
A doctor has a clinic where he serves his patients. The doctor’s consultation fees are different for different groups of patients, depending on their age. If the patient’s age is below 17, fees is 200 INR. If the patient’s age is between 17 and 40, fees is 400 INR. If the patient's age is above 40... | ALGO | 0.985728 | 5.306682 |
77fc88a9-e2ad-4789-9f67-9f2fc40503f2 | childast/LeetCode-problems | 144-binary-tree-preorder-traversal/144-binary-tree-preorder-traversal.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.999965 | 6.322103 |
7736b73c-4f33-4062-bd85-c9b1af802b2f | zhangjunxiongjie/sundry | VS-project/Sort-Arithmet/Select-Sort/select.cpp | //ĿʵŻѡ,Լԭѡ
#include <iostream>
#include <time.h>
#define NUM 10
#define MAX 100
void Random_initial(int* object) //ʼ
{
srand((unsigned)time(NULL)); //ʼ
for (int number = 0; number < NUM; number++)
{
object[number] = rand() % MAX;
}
}
void Select_initial(int* result)//ԭʼѡ,
{
for (int number = 0; number < NUM... | ALGO | 0.999667 | 3.641982 |
1b476497-d97f-432e-8840-f7a81c6335ab | ishandutta2007/codeforces | fateice/normal/933/A.cpp | #include<bits/stdc++.h>
#define L long long
using namespace std;
int n,x[2010],f[2010][5],a[5]={0,1,2,1,2};
int main()
{
//freopen(".in","r",stdin);
//freopen(".out","w",stdout);
int i,j;
scanf("%d",&n);
for(i=1;i<=n;i++)
scanf("%d",&x[i]);
for(i=1;i<=n+1;i++)
for(j=1;j<=4;j++)
f[i][j]=max(f[i-1][j],f[... | ALGO | 0.999867 | 3.263031 |
2f7fdb77-54b4-4d89-95ea-3b0b9f08766e | wilcorook/advent-of-code-2021 | src/day02/day02.cpp | #include <string>
#include <vector>
#include "../util/util.h"
int day02puzzle1()
{
int horizontal = 0;
int depth = 0;
std::vector<std::string> input;
std::string fileName = "day02.txt";
// size 2 * amout of lines
input = getStringsFromFile(fileName.c_str(), 2000);
for (int i = 0; i < inpu... | ALGO | 0.924533 | 5.390583 |
61b01c9d-ca11-4b12-ab75-604d1d3c0226 | AmanDhimanD/Leet-Code | GFGs/Mathematical/Prime Numbers.cpp | long long int largestPrimeFactor(int N){
// code here
vector<long long int>ans;
for(int i=2;i<=N;i++){
while(N%i ==0){
ans.push_back(i);
N/=i;
}
}
sort(ans.begin(),ans.end());
//long long int an... | ALGO | 0.999759 | 4.378281 |
097d2d21-ac0f-410e-9a79-df28c3ea879d | ibrahim-mo/CarND-Path-Planning-Project | src/Eigen-3.3/doc/examples/TutorialLinAlgExComputeSolveError.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main()
{
MatrixXd A = MatrixXd::Random(100,100);
MatrixXd b = MatrixXd::Random(100,50);
MatrixXd x = A.fullPivLu().solve(b);
double relative_error = (A*x - b).norm() / b.norm(); // norm() is L2 norm
cout << "The ... | ALGO | 0.99955 | 3.625966 |
3fd60824-8dff-4a41-ae06-1c38371361e9 | goutamoff7/C_PROGRAMMING | pattern/PTRN-P31.CPP | #include<stdio.h>
#include<conio.h>
void main()
{
int i,j,k,n;
clrscr();
printf("Enter the Range= ");
scanf("%d",&n);
for(i=n;i>=1;i--)
{
for(j=1;j<i;j++)
printf(" ");
for(k=j;k<=n;k++)
{
if(k==n||i==1||k==i)
printf("*");
else
printf(" ");
}
printf("\n");
}
getch();... | ALGO | 0.999817 | 3.229721 |
d1d3ecf2-db13-4e98-945b-d8cbe499edc2 | Hisham-Elyas/floweres_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.998733 | 6.76775 |
42678246-d3ac-440a-bef1-f555a1e0af9e | rootid/fft | data_struct/containsDuplicate-1.cpp | //Contains Duplicate II
//Given an array of integers and an integer k, find out whether there are two
//distinct
//indices i and j in the array such that nums[i] = nums[j] and the difference
//between i and j is at most k.
#include<iostream>
#include<vector>
#include<algorithm>
#include<unordered_map>
#include<unordere... | ALGO | 0.996735 | 5.3926 |
7815dc96-4bb7-4c6c-ba06-a5a2bafe124c | nuk6/gfg_ibit_leet_soln | leet_min_domino_rotations.cpp |
// Q: https://leetcode.com/problems/minimum-domino-rotations-for-equal-row/
class Solution {
public:
int minDominoRotations(vector<int>& a, vector<int>& b) {
int n = a.size();
int cnt[7];
for(int i = 0; i < 7; ++i) cnt[i] = 0;
for(int i = 0; i < n; ++i){
if(a[i] != b[i]... | ALGO | 0.999985 | 5.809017 |
650b2c0d-d372-4101-b20c-7b96947446cc | maeri-project/FEATHER | LayoutLoop/layoutloop/src/applications/simple-mapper/simple-mapper.cpp | #include <fstream>
#include <iomanip>
#include "util/accelergy_interface.hpp"
#include "applications/simple-mapper/simple-mapper.hpp"
//--------------------------------------------//
// Application //
//--------------------------------------------//
Application::Application(config::Co... | TOOL | 0.92757 | 5.824923 |
d46419dc-cfe5-41c0-9f10-235af4b71cde | enoughio/DSA | array/easy/sortColor.cpp | #include <bits/stdc++.h>
using namespace std;
void sortColors(vector<int>& nums) {
int n = nums.size();
int mid = 0, left = 0, right = nums.size()-1;
while(mid <= right)
{
if(nums[mid] == 0)
{
swap(nums[mid], nums[left... | ALGO | 0.999866 | 5.859284 |
aa437973-8a21-4c6d-865b-40a706c6319c | theovrx/Advent-of-Code-2024 | 3/3.2/main.cpp | #include <iostream>
#include <string>
#include <fstream>
#include <regex>
int resolveMatch(std::string exp, bool& isEnabled){
if (exp == "do()"){
isEnabled = true;
return 0;
}
else if(exp == "don't()"){
isEnabled = false;
return 0;
}
if (!isEnabled){
retur... | ALGO | 0.96296 | 4.243635 |
1e89a243-cd5d-4bd0-9dc0-1a7d8dfd3b5c | Sonryle/JoePhys | JoePhys/src/Spring.cpp | #include <JoePhys/Vec2.hpp>
#include <JoePhys/Spring.hpp>
void Spring::Update(double dt)
{
// for runge kutta sample k1
// -------------------------
vec2 diff = particleA->pos - particleB->pos;
vec2 force = normalize(diff) * (resting_length - length(diff));
force *= stiffness;
// Accelerate particle's spring a... | ALGO | 0.99774 | 5.433577 |
f8ba4a18-65b3-4958-9d2a-f4f40ea3b406 | USW-Semicolon/Algorithm-Study | 2024-1/Week_8/한윤아/1. 숫자_야구.cpp | /*문제 조건
1~9까지의 서로 다른 숫자 세 자리 => 0과 같은 숫자가 존재하면 안됨
123~987까지 수로 브루트포스
정답의 경우의 수 계산
예상되는 정답 수와 입력 값의 위치와 값이 같으면 S, 위치는 다른데 값이 같으면 B
number[1000] 배열 1로 초기화 => 조건에 안맞으면 0으로 바꿈 => 마지막까지 1인 경우 확인*/
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<string>
#include<cstring>
using namespace std;
int number[1000]; //... | ALGO | 0.996598 | 3.821477 |
bcfae580-c4fc-43bf-8418-0888c36ca672 | ishandutta2007/codeforces | realcomplex/normal/1438/E.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, int> pii;
#define fi first
#define se second
#define mp make_pair
#define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
const int N = (int)2e5 + 100;
ll A[N];
ll p[N];
int main(){
fastIO;
int n;
cin >> n;
... | ALGO | 0.999946 | 3.588629 |
07da3ed6-d70a-4f60-b543-2f78f374fed3 | checkoutb/LeetCodeCCpp | ge2500/LT2566_2023-02-19_Maximum_Difference_by_Remapping_a_Digit.cpp |
#include "../header/myheader.h"
class LT2566
{
public:
// D D
//int minMaxDifference(int num) {
// int min_v = num, max_v = num;
// for (int i = 0; i < 10; ++i) {
// int lo = 0, hi = 0, mul = 1;
// for (int n = num; n; n /= 10) {
// bool replace = n % 10 ==... | ALGO | 0.999915 | 5.682757 |
579901b3-faa8-49ad-966b-e72422b6279e | rkdalsdl98/toonflix | 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 |
53d6474a-ce78-4fc8-8f91-2dd49b7c65f7 | helloobaby/llvm_msvc | clang-tools-extra/clangd/refactor/tweaks/ExtractFunction.cpp | #include "AST.h"
#include "FindTarget.h"
#include "ParsedAST.h"
#include "Selection.h"
#include "SourceCode.h"
#include "refactor/Tweak.h"
#include "support/Logger.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/Decl.h"
#include "clang/AST/DeclBase.h"
#include "clang/AST/NestedNameSpecifier.h"
#include "clang/... | TOOL | 0.919311 | 5.933158 |
a75cd58d-04fe-41a4-af7d-0080816bb94f | LordPsyan/LordPsyanBots-classic | dep/recastnavigation/Recast/Source/RecastArea.cpp | #include <float.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include "Recast.h"
#include "RecastAlloc.h"
#include "RecastAssert.h"
/// @par
///
/// Basically, any spans that are closer to a boundary or obstruction than the specified radius
/// are marked... | ALGO | 0.998167 | 6.063802 |
a3f2d12a-adcb-4478-9b98-eaf53f99b875 | defUserName-404/Online-Judge | CodeForces/71A.cpp | #include <cstring>
#include <iostream>
using namespace std;
void out(char in[101])
{
int i = 0, j = strlen(in) - 1;
if (strlen(in) <= 10)
cout << in << endl;
else
{
cout << in[i] << strlen(in) - 2 << in[j] << endl;
}
}
int main()
{
int n;
char word[101];
cin >> n;
... | ALGO | 0.999348 | 3.379629 |
42836c7a-6797-4180-a2fc-d0dcef4a6da3 | oliverchen5285/cpp_rep | Euler/euler3.cpp | #include <iostream>
#include <string>
using namespace std;
void add_factors(long n){
long temp_n = n;
int i = 2;
while(true){
while(n % i == 0){
cout << i << endl;
n /= i;
}
if(i == 2){
i += 1;
}
else{
i += 2;
}... | ALGO | 0.999863 | 4.305077 |
6c66e4c0-9f97-4b5d-a144-f1e934506270 | mdmasleuddin76/Compiler_Lab | Lab1/DFA.cpp | #include <bits/stdc++.h>
using namespace std;
bool checkdfa(int j, vector<int> final, vector<vector<int>> table, string input)
{
for (int i = 0; i < input.size(); i++)
{
int x = input[i] - '0';
if (x > table[j].size())
{
return false;
}
j = table[j][x];
if (j < 0)
{
return false;
}
}
for (int ... | ALGO | 0.999937 | 5.059338 |
3e69c08e-41f2-4ac1-b5d0-a820d2b1a82f | sky-bro/AC | leetcode.com/0855 Exam Room/main.cpp | #include <iostream>
#include <set>
using namespace std;
class ExamRoom {
private:
set<int> seats;
int n;
public:
ExamRoom(int N) {
n = N;
seats.clear();
}
int seat() {
if (seats.empty()) {
seats.insert(0);
return 0;
}
int res = 0;
int diff = (*seats.begin()) - 0;
... | ALGO | 0.999874 | 5.864961 |
e83eb52f-b445-47d3-8dbd-4960f358b7b4 | palmenros/competitive-programming | ed-judge/Solutions/91-ActorMasVisto/91-ActorMasVisto-Martin.cpp | #include <iostream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <algorithm>
using namespace std;
//Para hacer hashes de pairs
struct pair_hash {
template <class T1, class T2>
std::size_t operator () (const std::pair<T1, T2>& p) const {
auto h1 = std::hash<T1>{}(p.... | ALGO | 0.999721 | 5.017902 |
11deb141-09d2-43b7-9913-0e3aa8522e85 | WEGFan/Algorithm-Contest-Code | online-judge/POJ/POJ 3750.cpp | #include <iostream>
#include <cstdio>
#include <list>
using namespace std;
int main()
{
int n;
cin >> n;
string name;
list<string> children;
for (int i = 0; i < n; i++)
{
cin >> name;
children.push_back(name);
}
int w, s;
scanf("%d,%d", &w, &s);
list<string>::ite... | ALGO | 0.999879 | 3.065631 |
7147d431-35a6-4573-ad12-320ca1c434ea | Migelo/pygad | pygad/C/src/absorption_spectra.cpp | #include <random>
#include "absorption_spectra.hpp"
#include "voigt.hpp"
static inline bool in_lims(double v, double *v_lims) { return (v_lims[0] <= v) and (v <= v_lims[1]); }
template <bool particles>
void _absorption_spectrum_multiple_los(size_t N, // number of particles/cells
... | ALGO | 0.998237 | 4.734436 |
a0dc03a2-d98e-4389-989d-84c1c743d979 | GooDongWoo/ProblemSolving | 프로그래머스/2/42747. H-Index/H-Index.cpp | #include <string>
#include <vector>
#include <algorithm>
using namespace std;
int bisect(vector <int> list,int target){
int start,end,mid;
start=0;
end=list.size()-1;
while (start<=end){
mid=(start+end)/2;
if(list[mid]<target){
start=mid+1;
}
else{
... | ALGO | 0.999965 | 6.242976 |
352703b0-48e6-425a-8c00-251736499be1 | RogerD044/DSA-Collection | Samsung RnD/Sarath/cycle_detection.cpp | #include<iostream>
using namespace std;
int n,m;
int a[100][100],rs[100],visited[100],path[100];
int rv,inx=0,flag=0;
void swap(int *xp,int *yp) {
int temp=*xp;
*xp=*yp;
*yp=temp;
}
void bubblesort(int a[],int n) {
bool swapped;
for(int i=0;i<n-1;i++) {
for(int j=0;j<n-i-1;j++) {
swapped=false;
if(a[... | ALGO | 0.999957 | 3.74955 |
a9a916b7-7180-4289-998e-b447e566a7d5 | projectxcel/projectxcl | src/bloom.cpp | #include <bloom.h>
#include <primitives/transaction.h>
#include <hash.h>
#include <script/script.h>
#include <script/standard.h>
#include <random.h>
#include <streams.h>
#include <math.h>
#include <stdlib.h>
#include <algorithm>
#define LN2SQUARED 0.4804530139182014246671025263266649717305529515945455
#define LN2 0... | ALGO | 0.957656 | 7.220339 |
bc9ce394-d135-4e10-90c0-2039028f0927 | manikanta2901/ubuntu | .history/codingChallenges/cpp/Codechef/longChallenges/Year2021/January/ChefAndAnts_20210112143441.cpp | #include<bits/stdc++.h>
#include<vector>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<iterator>
#include<string>
#include<map>
#define vv vector
#define F first
#define S second
#define MP make_pair
#define EXECUTE_FASTER ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define printM... | ALGO | 0.999946 | 3.775549 |
1de9613f-0199-4e2d-9fe2-83ba5c1d68f9 | dominatorVJ/LeetCode_GFG_Daily_Ques | 1287-element-appearing-more-than-25-in-sorted-array/1287-element-appearing-more-than-25-in-sorted-array.cpp | class Solution
{
public:
int findSpecialInteger(vector<int> &arr)
{
unordered_map<int, int> mp;
for (int i: arr)
{
mp[i]++;
}
int maxi = 0, ans = 0;
for (auto a: mp)
{
if (a.second > m... | ALGO | 0.999839 | 5.17939 |
2be19b50-c939-4b82-9e73-ccb2818afd44 | pedrodparkes/sceneSegmentation | OpenCvPlayground/cppSamplesBkp/points_classifier.cpp | #include "opencv2/core.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/ml.hpp"
#include "opencv2/highgui.hpp"
#ifdef HAVE_OPENCV_OCL
#define _OCL_KNN_ 1 // select whether using ocl::KNN method or not, default is using
#define _OCL_SVM_ 1 // select whether using ocl::svm method or not, default is using
#include "o... | ALGO | 0.931107 | 3.510448 |
164081b2-5d26-4915-9b9d-530f323c5b78 | ankushchimnani/DSA-Must-Do-Questions | 26_GCD/Ideal Solutions/greatestCommonDivisor.cpp | #include <bits/stdc++.h>
using namespace std;
int greatestCommonDivisor(int a, int b) {
// Recursive function to find GCD of a and b
if (b == 0)
return a;
return greatestCommonDivisor(b, a % b);
}
int main() {
int a = 10, b = 6;
cout << greatestCommonDivisor(a, b) << endl;
return 0;
} | ALGO | 0.998853 | 5.549134 |
2a98452e-4fd9-40b6-be55-39040b6e229f | Saha-Kamalika/cpp-programming | Understanding C++/coding questions/accenture/NBaseNotation.cpp | #include<bits/stdc++.h>
using namespace std;
string convertToNBaseNotation(int num,int n){
unordered_map<int,char> mp;
mp[0]=0,mp[1]='1',mp[2]='2',mp[3]='3',mp[4]='4',mp[5]='5',mp[6]='6',mp[7]='7',mp[8]='8',mp[9]='9',mp[10]='A',mp[11]='B',mp[12]='C',mp[13]='D',mp[14]='E',mp[15]='F',mp[16]='G',mp[17]='H',mp[18]=... | ALGO | 0.999904 | 4.566257 |
d50e8ee0-a688-41a5-9f42-f755e9533e40 | hpuma/CSC21200 | Algorithm/bfs_main.cpp | #include <iostream>
#include <vector>
#include <queue>
#include <iomanip>
#include "header/hw6q1.h"
#include "header/hset.h"
#include "header/ivertex.h"
using namespace std;
// FUNCTIONS TO BUILD THE GRAPH
// makeGraph, creates an empty matrix with specified labels
// build: The graph to build on.
// beginLetter: Bui... | ALGO | 0.998646 | 4.256596 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.