uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
3c058d30-35cc-4b63-87da-7776e9f6c022 | faterazer/LeetCode | 2641. Cousins in Binary Tree II/Solution.cpp | #include <queue>
using namespace std;
/**
* 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)
,... | ALGO | 0.999995 | 6.632053 |
4dcb6d06-785f-48ea-bc58-f2ce5258a674 | Johniel/contests | atcoder/code-festival-2015-qualb/C/main.cpp | // atcoder/code-festival-2015-qualb/C/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/
#include <bits/stdc++.h>
#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))
using namespace std;
template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << ... | ALGO | 0.999953 | 3.999748 |
cbbe74a9-4608-4785-91e8-75b1a1d0b4ab | taewook0307/Programmers | 프로그래머스/1/12932. 자연수 뒤집어 배열로 만들기/자연수 뒤집어 배열로 만들기.cpp | #include <vector>
std::vector<int> solution(long long n)
{
std::vector<int> answer;
answer.reserve(11);
while (n != 0)
{
answer.push_back(n % 10);
n /= 10;
}
return answer;
} | ALGO | 0.999589 | 5.903598 |
27a6cf80-c79b-4cfa-bda8-da51b0464bc6 | namankedia24/Delta-Hedging-C- | stock.cpp | #include "stock.h"
using namespace std;
void Stock::init() {
S0 = 100.0;
mu = 0.05;
T = 1.0;
sigma = 0.2;
N = 12;
}
Stock::Stock() {
init();
}
Stock::Stock(double S0, double mu, double time, double vol, double N)
: S0(S0), mu(mu), T(time), sigma(vol), N(N) {}
Stock::~Stock() {}
vector<... | ALGO | 0.997658 | 4.014287 |
3ceeafe6-9c3f-4606-9967-712ae0088cad | ishandutta2007/codeforces | aidos/normal/316/B2.cpp | #include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
typedef long long ll;
typedef long double ld;
const int maxn = (int)1e6 + 10;
const int mod = (int)1e9;
const int inf = (1<<30) - 1;
int p[maxn];
int a[maxn];
int n;
int x;
int dp[maxn];
int u[maxn];
int dfs(int v) {
u[v] = 1;
if(a[v] ... | ALGO | 0.999994 | 3.713498 |
97c22be4-b394-43e6-8fed-9a9f299d082e | MaciejKmieciak/AiSD2425 | lista 3/kody/lista3_part4.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <chrono>
#include <fstream>
#include <random>
using namespace std;
vector<int> DPActivitySelector(const vector<int>& s, const vector<int>& f) {
int n = s.size() - 1;
vector<vector<vector<int>>> dp(n + 1, vector<vector<int>>(n + 1));
for (... | ALGO | 0.995978 | 6.240011 |
2f82afbd-ad99-4d49-ada3-e34f0ab8d04e | Mohitbisht3031/lpu_CPPDSA_STP25 | Day23/reduendant.cpp | #include<bits/stdc++.h>
using namespace std;
bool redundantPair(string str){
stack<char>stk;
string op="+-/*%";
for(char ch : str){
if(ch == '(' || op.find(ch) != string::npos){
stk.push(ch);
}else{
bool f = 0;
while(!stk.empty() && stk.top() != '('){
... | ALGO | 0.999902 | 4.314377 |
5b32139e-e48f-4270-89b2-14d3b35becb5 | nyankiti/algorithm_job | atCoderEnv/problems/APG4b/o_STLの関数/o.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int A, B, C;
cin >> A >> B >> C;
cout << max(max(A, B), C) - min(min(A, B), C) << endl;
return 0;
} | ALGO | 0.999872 | 4.042325 |
d0a86fdb-b206-4d8b-827e-0043ef70c0e1 | MKG0007/DSA_Practice_Questions | 0912-sort-an-array/0912-sort-an-array.cpp | class Solution {
public:
void mergeSort(vector<int> &arr , int low , int high){
if(low>=high) return ;
int mid = (low+high)/2;
mergeSort(arr , low , mid);
mergeSort(arr , mid+1 , high);
mergeParts(arr , low , mid , high);
}
void mergeParts(vector<... | ALGO | 0.999996 | 5.895761 |
b86fcd2d-d184-4da9-8f19-d54944eedcb6 | Swaraj-pal/test | DSA Assignments/Essential C and C++ concepts/String.cpp | #include <iostream>
using namespace std;
int prime(int &x)
{
int count=0;
for(int i=2;i<x;i++)
{
if(x%i==0)
count++;
}
if(count==0)
return 1;
else
return 0;
}
int nearprime(int &x)
{
int y,min;
y=x;
}
int main()
{
return 0;
} | ALGO | 0.999525 | 3.18101 |
423a6c62-c12e-4fef-af72-1c1c98050a5a | sandialabs/RUBRIC | RUBRIC/nanonet/caller_2d/pair_align/nw_align.cpp | #include <algorithm>
#include <nw_align.h>
using namespace std;
namespace PairAlign {
int32_t NWAlign::Align(const vector<int>& sequence1, const vector<int>& sequence2,
vector<AlignPos>& alignment) {
int len1 = int(sequence1.size());
int len2 = int(sequence2.size());
diagScores.... | ALGO | 0.998719 | 5.016623 |
d02c9c28-a835-4772-b587-d71fedaa0b4f | HaykDavis/CPP-Module | Module 08/ex01/Span.cpp | #include "Span.hpp"
Span::Span() { }
Span::Span(unsigned int const &n) : N(n){
arr.reserve(N);
}
Span::Span(const Span& other){
*this = other;
}
Span &Span::operator=(Span const &other){
for (unsigned int i = 0; i < this->N; i++)
this->arr[i] = other.arr[i];
return (*this);
}
unsigned int Span::longest... | ALGO | 0.970059 | 5.041837 |
f721fbf3-a69f-430c-951e-d29ed89a9a15 | SkyLoaderr/xray-short-story | SDK/sources/MagicSoftware/FreeMagic/Source/Numerics/MgcEuler.cpp | #include "MgcEuler.h"
using namespace Mgc;
//----------------------------------------------------------------------------
Euler::Euler (int iDim, Real fStep, Function* aoF)
:
ODE(iDim,fStep,aoF)
{
}
//----------------------------------------------------------------------------
Euler::Euler (int iDim, Real fSte... | ALGO | 0.862804 | 4.798076 |
f26f93b4-ae34-448b-8516-2d2d42e2850b | ankur-357/Leetcode-submission | Odd or Even - GFG/odd-or-even.cpp | //{ Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution{
public:
string oddEven(int N){
int mask = 1;
if((N & mask) == 0){
return "even";
}
else
return "odd";
}
};
//{ Driver Code Starts.
int main()... | ALGO | 0.999829 | 5.685474 |
e7dd92d1-7eb1-4ed8-bedf-ef65eec9d6b1 | kimsg125/Baekjoon | 이항_계수_1.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
void solve() {
int N, K, a=1, b=1;
cin >> N >> K;
for (int i = 0; i < K; i++)
{
a*=(N-i);
b*=(i+1);
}
cout << a/b;
}
int32_t main() {
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
sol... | ALGO | 0.999736 | 4.362626 |
7f847eb5-2ef7-46ce-92a5-c29755f2f14a | StevenMaMei/Competitive-Programming | Contest/Codeforces/Div3_611/A/main.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int t; cin>>t;
while(t--){
int tt = 24*60;
int hh,mm; cin>>hh>>mm;
tt -= hh*60+mm;
cout<<tt<<endl;
}
return 0;
}
| ALGO | 0.993031 | 3.157161 |
fa9effb1-f036-4644-8156-26e692e2d328 | goelayush7/LEETCODE | 42-trapping-rain-water/trapping-rain-water.cpp | class Solution {
public:
int trap(vector<int>& height) {
int ans = 0;
int n = height.size();
int lsf[100000];
int rsf[100000];
lsf[n-1] = height[n-1];
for(int i =n-2; i>=0 ; i--){
lsf[i] = max(lsf[i+1],height[i]);
}
rsf[0]=height[0];
... | ALGO | 0.999986 | 6.591725 |
7b474aeb-ffd7-47b9-87ce-2988ba719091 | ishandutta2007/codeforces | tute7627/normal/679/A.cpp | //#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
//#define endl '\n'
#define lfs cout<<fixed<<setprecision(10)
#define ALL(a) (a).begin(),(a).end()
#define ALLR(a) (a).rbegin(),(a).rend()
#define spa << " " <<
#define fi first
#define se second
#define MP make_pair
#define MT make_tuple
#define... | ALGO | 0.999792 | 3.598053 |
cf07eb5f-d22e-4aef-9aa9-63099f871173 | student-Imran/Codes | cfKefaandFirstSteps.cpp | #include<bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define pb push_back
#define ll long long int
#define all(v) (v).begin(),(v).end()
#define set_bits __builtin_popcountll
int dp[10000][10000];
int lis(int b[],int n1)
{
if(n1<1)
{
return 0;
}
if(dp[n1][n1]!=-1)
{
return dp[... | ALGO | 0.999824 | 4.444975 |
0642f5dc-0722-48f2-9b6d-99914c8b0a61 | SanskarDhyani98/Leetcode_Daily_Streak | 5jan_lis.cpp | #include<bits/stdc++.h>
using namespace std;
class Solution {
public:
//dp[i]-->minimum last element of any subsequence of length i
int lengthOfLIS(vector<int>& nums) {
// int n=nums.size();
// vector<int> dp(n+1,1e5);
// dp[0]=-1e5;
// for(int i=0;i<=n-1;i++)
// { int curr... | ALGO | 0.999909 | 5.095323 |
6bb0994d-ec74-4204-88b1-66e75210f0cb | hellosaferide/maze-game | code4.cpp | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include<conio.h>
#include<Windows.h>
#include "stack.h"
typedef struct{
int x;
int y;
}position;
//洢Թջṹ
typedef struct
{
int maze[10][10];
position pos;//ڴ洢ﵱǰλ
}Maze;
typedef struct
{
Maze* bottom;
Maze* top;
}Stack;
Stack* StackCreate();
void Stack... | ALGO | 0.998843 | 3.349988 |
e60daf04-de6a-4151-b613-71457766112c | sarvex/leetcode-intercal | basic/sorting/MergeSort/Main.cpp | #include <iostream>
using namespace std;
const int N = 1e6 + 10;
int n;
int nums[N];
int tmp[N];
void merge_sort(int nums[], int left, int right) {
if (left >= right) return;
int mid = (left + right) >> 1;
merge_sort(nums, left, mid);
merge_sort(nums, mid + 1, right);
int i = left, j = mid + 1, ... | ALGO | 0.999967 | 4.577616 |
e04fa372-bc1a-47b1-9ac8-9a136752ca0a | iankury/CPP | Math/Binomial Coefficients Expansion.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
#define FASTIO() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
const int N = 200005, M = 1000000007, BIG = 0x3f3f3f3f;
int ct = 0;
int n;
string s, v1, v2;
/*
SAMPLE IN... | ALGO | 0.999649 | 4.102796 |
fa18328c-60bb-45de-bd1c-79ebb53aae62 | GARlMAN/leetcode | 0209-minimum-size-subarray-sum/0209-minimum-size-subarray-sum.cpp | class Solution {
public:
int minSubArrayLen(int target, vector<int>& nums) {
int ans = INT_MAX;
int sum = 0;
int element = 0;
int i = 0;
while(i < nums.size()){
if(sum < target)
sum += nums[i];
while(sum >= target){
sum ... | ALGO | 0.999993 | 6.291028 |
912027cb-8288-46a9-8796-89f1f1be580a | ishandutta2007/codeforces | chitanda/normal/848/A.cpp | #include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mkp make_pair
#define fi first
#define se second
#define ll long long
#define M 1000000007
#define all(a) a.begin(), a.end()
int k;
int f[10010];
int main(){
scanf("%d", &k);
f[1] = 0;
for(int i = 2; i <= 1000; ++i)
f[i] = f[i - 1] + i - 1... | ALGO | 0.999903 | 3.347456 |
858ab1bc-752a-465d-8089-ea9b0d7fd94c | jaredramey/AutomationTest_Playground | Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/Collision/PBDCollisionSolver.cpp | #include "Chaos/Collision/CollisionApplyType.h"
#include "Chaos/Collision/PBDCollisionConstraint.h"
#include "Chaos/CollisionResolution.h"
#include "Chaos/CollisionResolutionTypes.h"
#include "Chaos/CollisionResolutionUtil.h"
#include "Chaos/Evolution/SolverBodyContainer.h"
#include "Chaos/Particle/ParticleUtilities.h"... | ALGO | 0.998779 | 7.064059 |
646717ab-41f5-4a59-bef6-b10eaf39cc5f | xyokei/data_structure | algorithm/22_batchtaskflow.cpp | //
// Created by AutumnSigni on 2023/10/23.
//
// 批处理作业调度
/**
* n 个作业集合 每个作业先由机器1处理,再由机器2处理。作业i需要机器j的处理时间 mij
* 给点力n个作业 最佳作业调度方案,使其完成时间和最小
* 解空间:排列树
* 按套路写
* if(i>n) 最底层了
* 比较当前解 与 最优解
* 设定最优解
* else
* 计算完成时间之和
* 可行性约束函数 到当前作业的完成时间为止比最优解还大 ->总是剪掉左分支
* ... | ALGO | 0.999991 | 5.266318 |
fcfd8c0b-022c-4226-b346-e89fbc7b94b1 | Zararest/2_3_Matrix | src/main.cpp | #include "./headers/Matrix.hpp"
#define MATRIX_SIZE 15
int main(){
std::ifstream inp_stream("../bin/input.txt");
std::ofstream out_stream("../bin/output.txt");
Matrix<long> new_matr(MATRIX_SIZE, MATRIX_SIZE, inp_stream);
std::cout << new_matr.determinant() << std::endl;
new_matr.dump(out... | ALGO | 0.969402 | 4.852996 |
2f104ce6-ae62-48e7-ad01-7c7414e640c6 | PterodonRecovery/pterodon | env_test.cpp | #include <string>
#include <stdlib.h>
#include <vector>
#include <chrono>
#include <unistd.h>
#include <fstream>
#include <dirent.h>
#include <sys/stat.h>
#include <errno.h>
#include <sys/types.h>
#include <signal.h>
#include <sys/wait.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <linux/fs.h>
#define PTERO_AN... | TOOL | 0.936321 | 5.080193 |
4fb5b533-a84e-49b5-997c-1e03d3da9630 | jemalo08/FUNCIONES | INTRODUCCION/MAYOR.cpp | #include <iostream>
#include <stdio.h>
#include <stdlib.h>
using std::cout;
using std::cin;
using std::endl;
void MAX(int f, int g){
if(f>g){
cout << "El numero mayor es " <<f <<endl;
}
else if(f<g){
cout << "El numero mayor es " <<g <<endl;
}
else
cout << "ERROR 404 XD" << endl;
}
int main(){
int a,b... | ALGO | 0.98646 | 3.426838 |
e08fcdd1-3180-4fa6-a288-8e725c6fe3f4 | hzc1111/opencv_contrib | modules/videostab/samples/videostab.cpp | #include <string>
#include <iostream>
#include <fstream>
#include <sstream>
#include <stdexcept>
#include "opencv2/core.hpp"
#include <opencv2/core/utility.hpp>
#include "opencv2/video.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/videoio.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/videostab.hpp"
#inc... | TOOL | 0.894576 | 5.794038 |
ce536e31-ada1-4e6d-85d7-8a2484ec331c | ishandutta2007/codeforces | -is-this-fft-/normal/1701/F.cpp | #include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
struct Seg {
ll cnt, sum, sumsq;
Seg (ll _cnt = 0, ll _sum = 0, ll _sumsq = 0) : cnt(_cnt), sum(_sum), sumsq(_sumsq) {}
void apply (ll add) {
sumsq += 2 * add * sum + add * add * cnt;
sum += add * cnt;
}
};
Seg merge ... | ALGO | 0.999931 | 4.192701 |
55412d79-bc63-457c-88c2-e50084f95ff6 | trunghai95/MyCPCodes | Codeforces/624B.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int n;
ll a[30];
int main()
{
cin >> n;
for (int i = 0; i < n; ++i)
cin >> a[i];
sort(a, a+n);
reverse(a, a+n);
ll res = 0, mx = 2e9;
for (int i = 0; i < n; ++i)
{
ll tmp = min(mx, a[i]);
mx = tmp-1;
res += tmp;
if (mx == 0)
... | ALGO | 0.999926 | 3.789272 |
46222e80-7dd2-402f-bb8c-df0eed589b56 | mystic-01/LeetCode | 0352-data-stream-as-disjoint-intervals/0352-data-stream-as-disjoint-intervals.cpp | class SummaryRanges {
private:
set<int> s;
public:
SummaryRanges() {
};
void addNum(int value) {
s.insert(value);
};
vector<vector<int>> getIntervals() {
vector<vector<int>> ans;
for (auto &it : s) {
if (ans.size() && it == ans[ans.size() - 1][1] + ... | ALGO | 0.999837 | 6.231969 |
e51ae734-3453-4aaa-ae7e-5a17b77777be | jenniferpresto/ccLab_Fall_2012 | bouncingBallsArray/src/testApp.cpp | /*
An Array of Bouncing Balls
Jennifer Presto
December 1, 2012
Balls that bounce off the wall and each other;
Color changes on key press.
*/
#include "testApp.h"
//--------------------------------------------------------------
void testApp::setup(){
// set window title
ofSetWindowTitle("Bouncing Bal... | ALGO | 0.990111 | 5.533608 |
2b3f5c32-53a0-4b13-b7ed-4611afc41994 | ehmprah/coregrounds | server/ThirdParty/boost/boost_1_67_0/libs/compute/perf/perf_stl_set_symmetric_difference.cpp | #include <vector>
#include <algorithm>
#include <iostream>
#include "perf.hpp"
int rand_int()
{
return static_cast<int>((rand() / double(RAND_MAX)) * 25.0);
}
int main(int argc, char *argv[])
{
perf_parse_args(argc, argv);
std::cout << "size: " << PERF_N << std::endl;
std::vector<int> v1(std::floor... | ALGO | 0.939256 | 5.836029 |
92bfaa88-18d1-419c-9af6-725faf8bf8e7 | noy72/csacademy-solved | Second_Minimum.cpp | #include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x) cerr << #x << " = " << (x) << endl;
using namespace std;
template<typename T>
ostream& operator << (ostream& os, vector<T>& v){
rep(i,v.size(... | ALGO | 0.999428 | 3.367246 |
ed915b8a-b351-414b-bb86-c269991968dd | borhanur-rahman/Data_Structure_lab | Data Structure_lab_Practice/Graph/BFS.cpp | #include<bits/stdc++.h>
using namespace std;
struct node{
char data;
int check;
struct node *next;
struct edge *out;
};
struct edge {
struct node *in;
struct edge *nextedge;
};
typedef struct node *nodeptr;
typedef struct edge *edgeptr;
queue<nodeptr>que;
nodeptr newNode(char data)
{
nodeptr temp=(n... | ALGO | 0.999906 | 3.799511 |
75ecd970-b9e8-49cc-b931-72046a605789 | Ishwarendra/CompetitiveProgramming | CodeForces/GNU C++20 (64)/1561C _ Deep Down Below/160421207.cpp | #include <bits/stdc++.h>
#ifdef LOCAL
#include <F:\CPP\Debug\debug.h>
#else
#define trace(x...) 1;
#define print(x...) 1;
#endif
using i64 = long long;
void solve()
{
int n;
std::cin >> n;
std::vector<std::vector<int>> a(n);
for (int i = 0; i < n; ++i)
{
int k;
std::cin >>... | ALGO | 0.999858 | 4.833356 |
506c573b-07df-41aa-a6f5-e6b248a7fd15 | dunblx05/boj | SWEA/Unrated/5656. [모의 SW 역량테스트] 벽돌 깨기/[모의 SW 역량테스트] 벽돌 깨기.cpp | #include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <stack>
#include <cstring>
using namespace std;
#define endl '\n'
typedef long long ll;
// 상하좌우 이동을 위한 방향 배열
int dx[] = {-1, 0, 1, 0}; // 상, 우, 하, 좌
int dy[] = {0, 1, 0, -1};
int answer; // 최소 블록 수
int T, N, W, H; // 테스트 케이스 수, 공 발... | ALGO | 0.999835 | 5.350029 |
d4f1c692-a63d-440a-ba88-fe0ea8ac9513 | codingksj/Baekjoon-Solution | 백준/05000~05999/05400~05499/05462.cpp | #include<iostream>
#include<sstream>
#include<bitset>
#include<set>
#include<unordered_map>
#include<map>
#include<vector>
#include<queue>
#include<deque>
#include<stack>
#include<tuple>
#include<algorithm>
#include<string>
#include<numeric>
#include<cmath>
#include<cctype>
#include<cstring>
#include<iomanip>
#include<... | ALGO | 0.999984 | 4.174899 |
5ae7d1fd-9ddf-403c-a089-42420a56b253 | draperlaboratory/hope-llvm-project | mlir/lib/Conversion/VectorToLoops/ConvertVectorToLoops.cpp | #include <type_traits>
#include "mlir/Conversion/VectorToLoops/ConvertVectorToLoops.h"
#include "mlir/Dialect/VectorOps/VectorOps.h"
#include "mlir/EDSC/Builders.h"
#include "mlir/EDSC/Helpers.h"
#include "mlir/IR/AffineExpr.h"
#include "mlir/IR/AffineMap.h"
#include "mlir/IR/Attributes.h"
#include "mlir/IR/Builders.h... | ALGO | 0.977998 | 7.476949 |
e01c4957-6961-481f-aeef-ff8b69f18232 | hk-117/UVa_solves | vol 106/p10611.cpp | #include<bits/stdc++.h>
#define R(i,a,b,c) for(int i=a;i<b;i+=c)
using namespace std;
int main(){
int n;
cin>>n;
int lachimps[n];
R(i,0,n,1){
cin>>lachimps[i];
}
int q,h;
cin>>q;
R(i,0,q,1){
cin>>h;
auto sh= lower_bound(lachimps,lachimps+n,h);
auto tl= upp... | ALGO | 0.999987 | 3.54437 |
69ee6670-3c2c-4c52-b99c-beb9e85c5945 | jiangshen95/UbuntuLeetCode | LinkedListRandomNode3.cpp | #include<iostream>
#include<vector>
using namespace std;
struct ListNode {
int val;
ListNode *next;
ListNode(int x) : val(x), next(NULL) {}
};
class Solution {
private:
ListNode *head;
public:
/** @param head The linked list's head.
Note that the head is guaranteed to be not null, so it contains at l... | ALGO | 0.998335 | 3.941822 |
81c07554-4cbc-47da-a1da-33f42c1dab57 | duydang2311/code-forces | 800/263A-Beautiful-Matrix.cpp | #include <iostream>
int abs(int n) {
return (n >= 0) ? n : -n;
}
int main() {
const int size = 5;
int matrix[size][size];
for(int i = 0; i != size; i++) {
for(int j = 0; j != size; j++) {
std::cin >> matrix[i][j];
if(matrix[i][j]) {
std::cout << abs(j - 2) + abs(i - 2);
return 0;
}
}
}
ret... | ALGO | 0.999763 | 4.084157 |
b92c1e3a-ad04-4e6b-89dd-89591b441335 | yellowjigi/algorithm | leetcode/trapping_rain_water/stack_comment.cpp | //
// 2020-02-03
// LeetCode
// 42. Trapping Rain Water
// Accepted; commented ver.
#include <iostream>
#include <vector>
#include <stack>
using namespace std;
class Solution {
// Item to store on a stack
struct S {
int diff;
int index;
};
public:
int trap(vector<int>& height) {
... | ALGO | 0.99999 | 7.18444 |
64b0c2ab-9adc-47e1-88cc-23a0278f2453 | Sampurankishoresrivastava/question_practice | stater38-2.cpp | #include <iostream>
using namespace std;
int main(){
int t;
cin>>t;
while(t--){
int n,x,k;
cin>>n>>x>>k;
int a=n*x;
if(a<=k){
cout<<"Yes"<<endl;
}
else{
cout<<"No"<<endl;
}
}
return 0;
} | ALGO | 0.99916 | 3.532465 |
bf007fae-d767-447b-b180-804a8b35d8ec | jcastaneda30/ExerciseAlgorithms | Codeforce/2024/CodeForcesCpp/1400C.cpp | #include<iostream>
#include<vector>
#include<set>
#include<unordered_set>
#include<map>
#include<unordered_map>
#include<algorithm>
#include<string>
using namespace std;
int main(){
ios_base::sync_with_stdio(false), cin.tie(NULL);
int t;
cin>>t;
while(t--){
string cadena;
int x,n;
... | ALGO | 0.99959 | 4.045054 |
955acb6a-68e4-48c6-94c7-d8c191869632 | f-zyj/ACM | 按 OJ 分类/HDU/f-HDU-2112-HDU Today/f-HDU-2112-HDU Today/main.cpp | //#include <iostream>
//#include <string>
//#include <cstring>
//#include <vector>
//#include <queue>
//#include <map>
//
//using namespace std;
//
///*
// * 使用优先队列优化Dijkstra算法
// * 复杂度O(ElongE)
// * 注意对vector<Edge> E[MAXN]进行初始化后加边
// */
//
//const int INF = 0x3f3f3f3f;
//const int MAXN = 10010;
//
//struct qNode
//... | ALGO | 0.999913 | 4.25938 |
843df858-a09c-4ccb-9af0-b8fd66f3c520 | itsMuhammadtalha/Data-Structures | StackLinkedList/stackUsingLinkedList.cpp | #include <iostream>
using namespace std;
struct node
{
int data;
node *next;
};
class Stack
{
private:
node *top;
public:
Stack() : top(NULL) {}
~Stack() {}
private:
node *createNode(int value)
{
node *newNode = new node;
newNode->data = value;
newNode->next = NUL... | ALGO | 0.991561 | 5.251983 |
58673617-0f56-4770-9489-82a52974517a | qsnake/trilinos | packages/teuchos/example/BLAS/cxx_main.cpp | #include "Teuchos_BLAS.hpp"
#include "Teuchos_Version.hpp"
int main(int argc, char* argv[])
{
std::cout << Teuchos::Teuchos_Version() << std::endl << std::endl;
// Creating an instance of the BLAS class for double-precision kernels looks like:
Teuchos::BLAS<int, double> blas;
// This instance provides the ac... | TOOL | 0.89614 | 3.762892 |
c84dd077-7178-447a-aaf7-bf4b684a2471 | egonSchiele/OpenCV | samples/cpp/distrans.cpp | #include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <stdio.h>
using namespace cv;
void help()
{
printf("\nProgram to demonstrate the use of the distance transform function between edge images.\n"
"Usage:\n"
"./distrans [image_name -- default image is stuff.jpg]\n"
);
... | ALGO | 0.94086 | 5.350165 |
79a4f0ea-b3e2-425f-8cfb-ea8b4c5cb4e2 | Mohammed-yousuf123/8310804172_parvam_cec_mohammedyousuf | day5/day6/day8/prg3.cpp | /*sorting the array in even index spaces{13, 7, 6, 4, 3, 15, 18, 20}*/
#include <iostream>
using namespace std;
int main()
{
int size;
cout << "Enter the number of elements: ";
cin >> size;
int arr[size];
cout << "Enter the elements: ";
for (int i = 0; i < size; i++)
{
cin >> arr[i];... | ALGO | 0.988322 | 4.156141 |
51308f01-d1c9-4e27-ab10-d624cc764f08 | Bot1822/Auto-calibration-with-semantic-information | test/src/orbslam2.cpp | /*
* This file is part of ORB-SLAM2
*
* 单目相机初始化
* 用于平面场景的单应性矩阵H(8中运动假设) 和用于非平面场景的基础矩阵F(4种运动假设),
* 然后通过一个评分规则来选择合适的模型,恢复相机的旋转矩阵R和平移向量t 和 对应的3D点(尺度问题)。
*
*
*【0】2D-2D点对 求变换矩阵前先进行标准化 去 均值后再除以绝对矩
* 单目初始化特征点 归一化 坐标均值为0 一阶绝对矩为1
* mean_x = sum( ui) / N mean_y = sum(vi)/N
* 绝对矩 mean_x_dev = sum(abs(ui - mean_x))/ N ... | ALGO | 0.998423 | 5.493759 |
0195a489-a583-488f-a021-d4b66e375f75 | open-vela/external_libopencore-amr | opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/noise_gen_amrwb.cpp | /*
------------------------------------------------------------------------------
Filename: noise_gen_amrwb.cpp
------------------------------------------------------------------------------
INPUT AND OUTPUT DEFINITIONS
int16 * seed seed for the random ng
---------------------------------------------... | ALGO | 0.917859 | 5.455442 |
62c6ea1a-1b19-4e95-89af-603cf961df31 | LnwZaZaToon/Algorithm | nqueenpermu.cpp | #include <iostream>
using namespace std;
void swap(int *a, int *b) {
int temp = *a;
*a = *b;
*b = temp;
}
void printSolution(int x[],int end) {
for (int i = 0; i < end; i++) {
cout << x[i] << " ";
}
cout << endl;
}
void permute(int x[], int start, int end) {
if (start == end) {
... | ALGO | 0.999991 | 4.451633 |
455f0b7c-a6df-4f95-b041-46d4f4d69cd1 | Vanilla-chan-nya/Contest_Code | CodeForces/1942/C2-zmq.cpp | #include<iostream>
#include<algorithm>
#include<cstdio>
#include<string>
#include<cstring>
#include<cmath>
#include<map>
#include<set>
#include<queue>
#include<vector>
#include<limits.h>
using namespace std;
#define ll int
signed main(){
ll T;
cin>>T;
while(T--){
ll n,x,y;
cin>>n>>x>>y;
ll p;
ll yy=y;
ll ... | ALGO | 0.999873 | 3.300676 |
6715bd9a-fc95-44e0-a6ea-7b9f2943db97 | ShivanshGupta02/DSA | 1306-jump-game-iii/1306-jump-game-iii.cpp | class Solution {
public:
// simulating bfs using queue
Solution(){
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
}
bool canReach(vector<int>& arr, int start) {
int n=arr.size();
queue<int>q;
q.push(start)... | ALGO | 0.999994 | 5.568332 |
e270e57a-288c-4dee-9f38-34b736126319 | davidmartinezhi/leetcode | David Martínez/Medium/Heap/TopKFrequentElements.cpp | #include <iostream>
#include <vector>
#include <queue>
#include <unordered_map>
using namespace std;
class Solution {
public:
vector<int> topKFrequent(vector<int>& nums, int k) {
/*
info
input: integer array "nums" and int "k"
output: "k" most frequent elements
... | ALGO | 0.999964 | 5.986307 |
70157238-4786-4199-90e7-0eb9f1cd178d | crimson000000/OIcode | AT/AT_agc058_c.cpp | #define LOCAL
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
inline ll read()
{
ll x = 0, f = 1;
char ch = getchar();
while(ch < '0' || ch > '9')
{
if(ch == '-') f = -1;
ch = getchar();
}
while(ch >= '0' && ch <= '9')
{
... | ALGO | 0.999965 | 4.384314 |
40694ed4-096b-4dcf-8c38-5a661ae01ae2 | Tahsin005/Problem-Solving | Week 18+/A_Rudolf_and_the_Ticket.cpp | #include<bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
int tt; cin >> tt; while (tt--) {
int n, m, k; cin >> n >> m >> k;
vector<int> a(n);
vector<int> b(m);
for (int i = 0; i < n; i++) cin >> a[i];
for (int i = 0; i < m; i++) cin >> b[i];
int c... | ALGO | 0.999781 | 3.94607 |
c9b65ad6-0755-4d6e-a630-bbbb76a4b654 | thiago9864/estrutura_de_dados1 | Exercicios Slide/Exercicios Slide ED/TADMatrizTriangular.cpp | #include <iostream>
#include <cmath>
#include "TADMatrizTriangular.h"
using namespace std;
TADMatrizTriangular::TADMatrizTriangular(int n){
_n = ((n + 1) * n) / 2;
mat = new int[_n];
}
TADMatrizTriangular::~TADMatrizTriangular()
{
delete [] mat;
}
bool TADMatrizTriangular::verifica(int i, int j){
if(... | ALGO | 0.996845 | 3.597542 |
9e152f2c-fcc8-4bab-97c7-0be8ec59af06 | wsmoses/Tapir-compiler-rt | lib/cilksan/old/mem_access.cpp | #include <inttypes.h>
#include "cilksan_internal.h"
#include "mem_access.h"
extern void report_race(uintptr_t first_inst, uintptr_t second_inst,
uintptr_t addr, enum RaceType_t race_type);
// get the start and end indices and gtype to use for accesing the readers /
// writers lists; the gtype... | TOOL | 0.861555 | 5.391504 |
fd45b02a-714c-40ab-a323-50f385722fa9 | black-shadows/LeetCode-Topicwise-Solutions | C++/sliding-window-maximum.cpp | // Time: O(n)
// Space: O(k)
class Solution {
public:
vector<int> maxSlidingWindow(vector<int>& nums, int k) {
deque<int> dq;
vector<int> max_numbers;
for (int i = 0; i < nums.size(); ++i) {
while (!dq.empty() && nums[i] >= nums[dq.back()]) {
dq.pop_back();
... | ALGO | 0.999982 | 6.466404 |
2470a45f-7bb3-4b5f-8c41-5607e1fb75c7 | projectarcana-aosp/platform_external_libcxx | test/std/containers/associative/map/map.modifiers/insert_initializer_list.pass.cpp | // UNSUPPORTED: c++98, c++03
// <map>
// class map
// void insert(initializer_list<value_type> il);
#include <map>
#include <cassert>
#include "min_allocator.h"
int main()
{
{
typedef std::pair<const int, double> V;
std::map<int, double> m =
{
... | TEST | 0.861871 | 5.842242 |
1ceb37b8-ec36-4227-acbe-fb36662cfcbf | xiumuya/DataStructure | chapter8/excise16.cpp | #include "graph.cpp" //图的基本运算算法
int visited[MAXV]; //全局变量数组
void Cycle(AdjGraph *G,int u,int v,int d,bool &has)
{ //调用时has置初值false,d为-1
ArcNode *p; int w;
visited[u]=1; d++; //置已访问标记
p=G->adjlist[u].firstarc; //p指向顶点u的第一个邻接点
while (p!=NULL)
{ w=p->adjvex;
if (visited[w]==0) //若顶点w未访问,递归访问它
Cycle... | ALGO | 0.999793 | 3.619923 |
aac8ebcf-5f9a-46f9-b4bb-c91b2d6d91cf | unclezhou486/ACM-Solutions | Mix/2023/“华为杯”杭州电子科技大学2023新生编程大赛/1004智能车(我的做法).cpp | #include <bits/stdc++.h>
using namespace std;
const int N=5e4+10;
int t;
int n,c;
int a[N];
int b[N];
//bitset<50010> dp;
bool check(int x){
//bitset<50010> dp;
for(int i=1;i<=c;i++){
if(!b[i]) continue;
bitset<510> dp;
for(int j=1;j<=c;j++){
dp[j]=0;
}
dp[... | ALGO | 0.999976 | 3.906076 |
dcee74dd-f853-43b8-a244-0ecaf933f953 | ahhcash/CP | ProjectEuler/problem704.cpp | #include <bits/stdc++.h>
using namespace std;
long factorial(long n){
long prod=1;
for(long i=n;i>=1;i--)
prod*=i;
return prod;
}
int g(long n, long m){
long choose=factorial(n)/(factorial(n-m)*factorial(m));
//cout << choose << endl;
int x=0;
while(choose%2==0){
x++;
... | ALGO | 0.999712 | 4.397242 |
3cdcba39-7c26-466b-b07e-cf8909662b3d | MVARUNREDDY8203/LEETCODE_- | 0049-group-anagrams/0049-group-anagrams.cpp | class Solution {
public:
vector<vector<string>> groupAnagrams(vector<string>& strs) {
map<map<char, int>, vector<string>> mp;
int n = strs.size();
for (int i=0; i<n; i++) {
map<char, int> ump;
for (auto c: strs[i]) ump[c]++;
mp[ump].push_back(strs[i]);
... | ALGO | 0.999993 | 6.444928 |
6d1388f5-8198-464d-9a8a-5045bdaac666 | user-of-github/CPP | LinearAlgebra/Library/EquationSystemSolver/equation_system_solver.cpp | #include "equation_system_solver.hpp"
namespace LinearAlgebra
{
template<typename ValueType>
Vector <ValueType> EquationSystemSolver::Cramer(const Matrix <ValueType> &coefficients_matrix,
const Vector <ValueType> &free_coefficients_vector)
{
auto ... | ALGO | 0.999263 | 5.96573 |
33d3d0a6-baa0-42d6-87ef-e0715290e128 | GuacheSuede/MSSubmission1234567890 | submission/rsi/boost_1_69_0/libs/multiprecision/example/floating_point_examples.cpp | #include <boost/math/constants/constants.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/math/special_functions/gamma.hpp>
#include <boost/math/special_functions/bessel.hpp>
#include <iostream>
#include <iomanip>
#if !defined(BOOST_NO_CXX11_HDR_ARRAY) && !defined(BOOST_NO_CXX11_LAMBDAS) && !(def... | TOOL | 0.984792 | 6.896376 |
0db2d5bf-5d97-42f0-b5fe-95a74041e5dd | master-hkshenoycse/CP | Contests/Leetcode/Weekly_428/LC_3389.cpp | #include<bits/stdc++.h>
using namespace std;
class Solution {
public:
//ooperation 3 is optimal for only chnaging adjancent elements
int solve(vector<int> &cnt,int x){
vector<int> dp(26,INT_MAX);
dp[0]=min(abs(cnt[0]),abs(x-cnt[0]));
for(int i=1;i<26;i++){
dp[i]=dp[i-1]+min... | ALGO | 0.999992 | 5.147259 |
370640ff-1862-44e8-8b1c-26ed554de113 | kirillukashev/School_project | Sorting-on-list/merge_sort_on_list.cpp | #include<bits/stdc++.h>
using namespace std;
struct node2 {
int data;
node2* next;
node2* prev;
};
void ins_head(node2*& L) {
node2* q = new node2;
int val;
cin >> val;
q->data = val;
q->prev = nullptr;
q->next = nullptr;
if (L == nullptr) {
L = q;
} else {
... | ALGO | 0.999981 | 4.030024 |
e714320e-00ae-4962-bc44-bcf96cb7981e | hnefatl/earley-parser | src/earley.cpp | #include "earley.h"
#include <assert.h>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <queue>
Parser::Parser(const Symbol start, const std::vector<Rule> rules,
const std::map<Symbol, std::set<std::string>> poS)
: startSymbol(start), rules(makeRuleMapping(ru... | ALGO | 0.994511 | 5.390159 |
385457e7-6771-49a9-84b7-a755e3bff572 | sarvex/leetcode-racket | lcof/面试题44. 数字序列中某一位的数字/Solution.cpp | class Solution {
public:
int findNthDigit(int n) {
int k = 1, cnt = 9;
while (1ll * k * cnt < n) {
n -= k * cnt;
++k;
cnt *= 10;
}
int num = pow(10, k - 1) + (n - 1) / k;
int idx = (n - 1) % k;
return to_string(num)[idx] - '0';
... | ALGO | 0.999928 | 6.768263 |
b7d90eea-2707-491e-9055-37d19f0c51e9 | tzhenghao/KnightBoard | KnightEngine.cpp | #include "KnightEngine.h"
#include <cassert>
#include <limits.h>
#include <algorithm>
using namespace std;
// Estimated total cost from start to goal through y.
unordered_map<int, int> fScore;
// REQUIRES: A given position.
// EFFECTS: Returns a hash value for the position (Used by unordered_map).
int toHash(const P... | ALGO | 0.999644 | 4.708424 |
577a601a-378f-4db6-a415-314430877e6e | jlecorre/hlinvasion | SourceCode/dlls/schedule.cpp | //=========================================================
// schedule.cpp - functions and data pertaining to the
// monsters' AI scheduling system.
//=========================================================
#include "extdll.h"
#include "util.h"
#include "cbase.h"
#include "monsters.h"
#include "animation.h"
#includ... | TOOL | 0.878361 | 6.161037 |
3107b5a8-ff66-4a56-b218-1b9f6a4e9f3d | AOSP-JF-MM/platform_frameworks_av | media/libstagefright/codecs/amrnb/common/src/q_plsf_3.cpp | /*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include <string.h>
#include "q_plsf.h"
#include "typedef.h"
#include "lsp_lsf.h"
#include "reorder.h"
#include "lsfwt.h"
/*------------------------... | ALGO | 0.999484 | 5.832959 |
921cd262-8ad7-420b-8d62-ad96eb5ef539 | may5hap/CPP-learning | 公司笔试/9-8华为/3.cpp | //#include<vector>
// we have defined the necessary header files here FOR this problem.
// IF additional header files are needed IN your program, please IMPORT here.
#include <iostream>
//using namespace std;
int main()
{
int m,n;
int matrix[110][110];
// vector<vector<int> > matrix;
char ch;
int t... | ALGO | 0.998826 | 3.664177 |
22517d3a-773c-41e8-8954-de6da9faabeb | DuyTran1234/1000ExerciseC- | Chuong 9 - Mang cau truc/bai662.cpp | #include <iostream>
#include <math.h>
using namespace std;
void xuat(struct DUONGTHANG a[], int n);
void nhap(struct DUONGTHANG a[], int &n);
struct DIEM diemQua2DuongThang(struct DUONGTHANG a, struct DUONGTHANG b);
bool kiemTraBaDuongDongQuy(struct DUONGTHANG a[], int n);
struct DUONGTHANG
{
int a;
int b;
};
struct ... | ALGO | 0.995882 | 4.232451 |
f116a06e-6492-4db0-a751-c34b2de9b1d6 | ishandutta2007/codeforces | peti1234/normal/954/I.cpp | #include<bits/stdc++.h>
#define rep(i,x,y) for (int i=(x); i<=(y); i++)
using namespace std;
const int c=26;
int n, m, fa[c], t[c][c], ans;
string x, y;
int getfa(int x){
if (fa[x]==x) return x;
return fa[x]=getfa(fa[x]);
}
int main() {
ios_base::sync_with_stdio(false), cin.tie(0);
cin >> x >> y;
n=x.size... | ALGO | 0.999982 | 3.562357 |
7037c924-d248-4d73-a940-18064be94f48 | sharmista2shastry/Data-Structures-and-Algorithms | Recursion/staircase.cpp |
int staircase(int n){
/* Don't write main().
* Don't read input, it is passed as function argument.
* Return output and don't print it.
* Taking input and printing output is handled automatically.
*/
if(n == 0)
return 1;
int w1 = 0, w2 = 0, w3 = 0;
if(n-1 >= 0)
w1 = sta... | ALGO | 0.999987 | 4.279379 |
6e2f5b45-0cc4-4e8a-b434-f09c5d9c901d | deepakvit007/LeetCode | 2235-add-two-integers/2235-add-two-integers.cpp | class Solution {
public:
int sum(int num1, int num2) {
ios::sync_with_stdio(false); cin.tie(nullptr);
return num1+num2;
}
}; | ALGO | 0.994369 | 4.861637 |
b5548907-4598-417c-86d8-b1ff0375912c | Saitof/jcad | JCAD3_Basic/src_202006/Symmetry.cpp | /////////////////////////////////////////////////////////////////////////////
// Ώ̎ҏW암
// Symmetry.cpp
//---------------------------------------------------------------------------
// LastEdit : 2010/01/20 by M.Fukushima
/////////////////////////////////////////////////////////////////////////////
#include <math.h>
#in... | ALGO | 0.994915 | 3.43801 |
96b5b247-3485-4ff6-8155-c7f5ce5b4eda | DamianArado/LeetCode-tracker | 1498-number-of-subsequences-that-satisfy-the-given-sum-condition/1498-number-of-subsequences-that-satisfy-the-given-sum-condition.cpp | class Solution {
public:
int numSubseq(vector<int>& nums, int target) {
sort(begin(nums), end(nums));
int n = size(nums), l = 0, r = n - 1, ans = 0, MOD = 1e9 + 7;
vector<int> powers(n, 1);
// power of 2
for(int i = 1; i < n; ++i)
powers[i] = (powers[i - 1] * 2) ... | ALGO | 0.999997 | 6.192429 |
3bb05e68-d828-4b0e-818a-6f6cd0ba7c51 | harshjoshiiii/leetcode | 0882-peak-index-in-a-mountain-array/0882-peak-index-in-a-mountain-array.cpp | class Solution {
public:
int peakIndexInMountainArray(vector<int>&nums) {
int n=nums.size();
//edge case
if(n==1) return 0;
if(nums[0]>nums[1]) return 0;
if(nums[n-1]>nums[n-2]) return n-1;
int low=1;
int high=n-2;
while(low<=high)
{
... | ALGO | 0.99999 | 5.717481 |
b237c95d-7038-4531-95f5-f538d5afe48e | mailtoharutyunyan/LeetCode-Solutions | solutions/0704. Binary Search/0704.cpp | class Solution {
public:
int search(vector<int>& nums, int target) {
const auto it = ranges::lower_bound(nums, target);
return (it == nums.cend() || *it != target) ? -1
: distance(nums.begin(), it);
}
};
| ALGO | 0.999848 | 6.641888 |
ceb2d41a-933b-424b-9407-445478b3f0f3 | benjaminhuanghuang/ben-leetcode | 1038_Binary_Search_Tree_to_Greater_Sum_Tree/solution.cpp | /*
1038. Binary Search Tree to Greater Sum Tree
https://leetcode.com/problems/binary-search-tree-to-greater-sum-tree/
*/
#include <functional>
#include "common/TreeNode.h"
using namespace std;
/*
https://zxi.mytechroad.com/blog/leetcode/leetcode-weekly-contest-135-1037-1038-1039-1040/
Solution: Recursion: right, ro... | ALGO | 0.999973 | 6.280441 |
0558c5d8-4bee-4d8d-9d35-e59d29b90199 | ttoino/feup-aed | TP04/funSortProblem.cpp | #include "funSortProblem.h"
#include <algorithm>
#include <list>
FunSortProblem::FunSortProblem() {}
//-----------------------------------------------------------------
// a)
// T(n) = O(n log n)
// S(n) = O(1)
void FunSortProblem::expressLane(vector<Product> &products, unsigned k) {
// O(n log n)
std::sort... | ALGO | 0.999025 | 5.130779 |
94a10b7b-9337-4537-bde6-c5d9c1a6012d | Abhishek-k30/DSA | 2207-maximize-number-of-subsequences-in-a-string/2207-maximize-number-of-subsequences-in-a-string.cpp | class Solution {
public:
long long maximumSubsequenceCount(string text, string pattern) {
char a=pattern[0];
char b=pattern[1];
int n=text.size();
string t1=a+text;
string t2=text+b;
vector<long long> pt1(n+1,0);
vector<long long> pt2(n+1,0);
... | ALGO | 0.999992 | 6.062684 |
3ecc186b-6d0e-4252-aa77-fc470434e48f | ishandutta2007/codeforces | krijgertje/normal/1714/E.cpp | #include <algorithm>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <cstring>
#include <list>
#include <cassert>
#include <climits>
#inclu... | ALGO | 0.999711 | 4.081021 |
99dea179-3bbe-48a9-bc42-b9187e34ecc0 | mikity-mikity/KingOfMonsters | eigenwrapper/libigl-main/libigl-main/include/igl/copyleft/cgal/segment_segment_squared_distance.cpp | // http://geomalgorithms.com/a07-_distance.html
template < typename Kernel>
IGL_INLINE bool igl::copyleft::cgal::segment_segment_squared_distance(
const CGAL::Segment_3<Kernel> & S1,
const CGAL::Segment_3<Kernel> & S2,
CGAL::Point_3<Kernel> & P1,
CGAL::Point_3<Kernel> & P2,
typename Kernel::FT & dst... | ALGO | 0.999819 | 6.293522 |
68f97fcc-b86e-44c5-9795-8a2501abf73b | pavannaiik/LeetCode | 0073-set-matrix-zeroes/0073-set-matrix-zeroes.cpp | class Solution {
public:
void setZeroes(vector<vector<int>>& matrix) {
int rows=matrix.size();
int cols=matrix[0].size();
int row0=1,col0=1;
for(int i=0;i<rows;i++){
if(matrix[i][0]==0){
col0=0;
break;
}
}
for(in... | ALGO | 0.998971 | 6.117557 |
fc75cc3d-ca50-4b91-9778-6d207d416e31 | uxth/leetcode | cpp/348.design-tic-tac-toe.cpp | /*
Question
Formatted question description: https://leetcode.ca/all/348.html
Assume the following rules are for the tic-tac-toe game on an n x n board between two players:
A move is guaranteed to be valid and is placed on an empty block.
Once a winning condition is reached, no more moves are allowed.
A player who su... | ALGO | 0.999762 | 7.186064 |
ed23229d-da27-4afe-874e-e94e79e8c777 | DivyanshTiwari23/Proj_Map-Reduce_Framework | main.cpp | #include <bits/stdc++.h>
using namespace std;
#include "mapper.h"
#include "shuffle.h"
#include "reducer.h"
int mappers = 2;
int reducers = 2;
int main(int argc, char ** argv)
{
if(argc > 2)
{
mappers = atoi(argv[1]);
reducers = atoi(argv[2]);
}
else if(argc > 1)
{
mappers... | ALGO | 0.998809 | 4.237242 |
b54ae7a1-ef08-408a-81d1-2ec323e39b27 | SinBin10/DSA | Leetcode/103-binary-tree-zigzag-level-order-traversal/binary-tree-zigzag-level-order-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.999994 | 6.132463 |
8a42ed52-f1e7-43bd-b9e8-6d97b806c27c | ML-UCV/ML-CodeBert-DistinctSolutions | Raw Dataset/schi/aib/test/7d050cc0-137c-11eb-9f6e-309c234925a0.cpp | #include <bits/stdc++.h>
using namespace std;
int aib[30010], v[30010];
int n;
void update(int poz, int val)
{
for (int i = poz; i <= n; i += (i & -i))
aib[i] += val;
}
int sum(int poz)
{
int s = 0, i;
for (i = poz; i >= 1; i -= (i & -i))
s += aib[i];
return s;
}
int caut(int st, int dr, int p)
{
int val... | ALGO | 0.999992 | 3.78757 |
f90012e0-481b-427a-bd01-2a9eb837bb35 | raincross7/code-similarity | codes/train_code/problem173/problem173_54.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
ll n;
cin >> n;
ll ans = 0;
vector<ll> a;
for(ll i = 1; i * i <= n; i++){
if(n % i == 0){
ll k = n / i;
a.push_back(i);
a.push_back(k);
}
}
for(int i = 0; i ... | ALGO | 0.999948 | 4.127067 |
6e67482c-f08b-4e9f-926b-03c563be3334 | Ritwiksrivastava0809/C-tutorial | array8.cpp | // sub array
#include <iostream>
using namespace std;
int main()
{
int n;
cout<<"enter size of array: ";
cin>>n;
int arr[n];
for(int i=0; i<n; i++)
{
cin>>arr[i];
}
int curr = 0;
for(int i=0; i<n; i++)
{
curr = 0;
for(int j=i; j<n; j++)
... | ALGO | 0.999806 | 3.382782 |
7bdbc3ed-b7d1-4076-8953-a34d336c54e6 | gastonsegura2908/AlgYEstrucDeDatos | TP1---AyE/main.cpp | #include "./Lector/lector.hpp"
#include "./Procesador/procesador.hpp"
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
// validamos la entrada al programa
if (argc != 2)
{
cout << "\nUso: main <file.txt>" << endl;
return 1;
}
Pila<string> *instrucciones =... | TOOL | 0.854974 | 3.45673 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.