uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
448b711a-aaf2-4f9b-871f-ae40ed067afe | ZJU-FAST-Lab/EGO-Planner-v2 | swarm-playground/formation_ws/src/uav_simulator/so3_quadrotor_simulator/include/ode/libs/numeric/odeint/examples/solar_system.cpp | #include <iostream>
#include <boost/array.hpp>
#include <boost/numeric/odeint.hpp>
#include "point_type.hpp"
//[ container_type_definition
// we simulate 5 planets and the sun
const size_t n = 6;
typedef point< double , 3 > point_type;
typedef boost::array< point_type , n > container_type;
typedef boost::array< dou... | ALGO | 0.999546 | 5.893465 |
9804e9d8-994f-43db-9b75-7e93cb96f425 | Khushisrivastava9/GFG-Practice | Easy/Count numbers containing 4/count-numbers-containing-4.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
int countNumberswith4(int n) {
int cnt=0;
for(int i=4;i<=n;i++){
int n=i;
while(n>0){
if(n%10==4){
cnt++;
... | ALGO | 0.999621 | 6.060059 |
8dd065a6-300c-44f2-ae7a-55afac0bd3c1 | bear-zd/aTen-fetch | aten-src-ATen/native/nested/NestedTensorTransformerFunctions.cpp | #include <ATen/native/nested/NestedTensorTransformerFunctions.h>
#include <ATen/ATen.h>
#include <ATen/NativeFunctions.h>
#include <ATen/NestedTensorImpl.h>
#include <ATen/native/nested/NestedTensorUtils.h>
#include <c10/util/Exception.h>
#include <optional>
#include <string_view>
namespace at::native {
namespace {
... | TOOL | 0.931554 | 6.235224 |
75886973-695e-4e1b-9a95-4e880c3a2beb | ishandutta2007/codeforces | nikarabika/normal/1428/F.cpp | //sobskdrbhvk
//remember...
#include <bits/stdc++.h>
using namespace std;
typedef long long int LL;
typedef long double LD;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;
#define PB push_back
#define MP make_pair
#define L first
#define R second
#define smin(x, y) (x) = min((x), (y))
#define smax(x, y) (x) = ... | ALGO | 0.999932 | 4.395208 |
621d6cb2-fef5-4a06-af6a-30f66198bc3e | burakssen/advent-of-code | 2015/c++/6/main-part-1.cpp | #include <iostream>
#include <fstream>
#include <string>
#include <sstream>
void get_action(std::string line, std::string &action, int &startx, int &starty, int &endx, int &endy)
{
std::string temp;
char comma;
std::stringstream ss(line);
if (line[0] == 't' && line[1] == 'u')
ss >> temp >> acti... | ALGO | 0.976763 | 5.652952 |
6b515f89-a518-4357-ac5a-9a9b07b6aa2b | umangja/CompetitiveProgrammingSolution | codeforces/1354/E.cpp | /*input
*/
// assic value of ('0'-'9') is(48 - 57) and (a-z) is (97-122) and (A-Z) is(65-90) and 32 for space
// #pragma GCC target ("avx2")
// #pragma GCC optimization ("O3")
// #pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.... | ALGO | 0.999951 | 3.782162 |
ad8aa7a8-8e26-44ef-9cef-ee67d01f8687 | arnav-snowleo/myLeetcodeRepo | 1208-get-equal-substrings-within-budget/1208-get-equal-substrings-within-budget.cpp | // SLIDING WINDOW
// maximum length of a substring - think of -- SLIDING WINDOW
class Solution {
public:
int equalSubstring(string s, string t, int maxCost) {
int n = s.length(), maxi =INT_MIN,i=0,j=0,cost=0;
while(j<n){
// STEP 1
cost += abs(... | ALGO | 0.99999 | 6.160897 |
a4ff0d15-aa01-4f0e-8ad0-a97b7e5a6dba | KhanAhmadYeaseen/OLD-DSA | digit_primes.cpp | #include<bits/stdc++.h>
using namespace std;// third parameter of sort ..... jei operator er jonno true sevabe kaj korbe .... sekhane caile condition lagano jabe ....
long long int se_si;
bitset<1000010>bs;//boundary is the size ....... use in prime
vector<long long int>primes; // use in prime
typedef unsigned long lon... | ALGO | 0.999683 | 4.166875 |
77056215-7cbb-4bc2-ac93-df82af6a081c | ishandutta2007/codeforces | syury/normal/23/D.cpp | //#pragma GCC optimize("Ofast,unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,tune=native")
#include<bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define X first
#define Y second
#define mp make_pair
typedef long long ll;
typedef unsigned long lon... | ALGO | 0.999908 | 3.978324 |
a20bb160-5503-4110-a103-e01386ae5ecb | 1000ms/Codeforces-Solutions | Delix_Round,Spring_2021/b.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define OJ \
freopen("input.txt", "r", stdin); \
freopen("output.txt", "w", stdout);
ll bp(ll a,ll b,ll mod=LONG_LONG_MAX){
a%=mod;
ll res=1;
while(b>0){
if(b&1) res=res*a%mod;
a=a*a%mod;
b/=2;
}
retur... | ALGO | 0.999272 | 3.561065 |
7974605a-6db7-4075-8e82-6bc982f314b9 | rohanshenoy145/15_418-Final-Project | code/boruvka_ds.cpp | #include <iostream>
#include <unordered_set>
#include <unordered_map>
#include <vector>
#include <set>
#include <random>
#include <climits>
#include <iostream>
#include <fstream>
#include <string>
#include <getopt.h>
#include <DisjointSets.h>
#include <chrono>
using namespace std;
struct Edge {
size_t u;
size... | ALGO | 0.99925 | 4.900703 |
32833d38-83fe-4e4f-b72b-9a68e3dbbd82 | Jiheyy/study | 15685.cpp | #include <iostream>
#include <vector>
#include <cmath>
using namespace std;
struct Dragon {
int x, y, d, g;
};
int n, res;
vector <Dragon> dragon;
int map[101][101];
const int dy[4] = {0, -1, 0, 1};
const int dx[4] = {1, 0, -1 ,0};
void solve() {
for(int i=0; i<dragon.size(); i++) {
int curve_size = 0;
int ... | ALGO | 0.999793 | 3.882612 |
71616d82-d964-4aeb-ab28-1e61f81e334b | aninditacse/C-and-CPP | C and CPP/BINARY.CPP | #include<stdio.h>
#include<conio.h>
void main()
{
int n,i,a[20],k,f,l,m;
clrscr();
printf("Enter the number of elements\n");
scanf("%d",&n);
printf("Enter %d integers\n",n);
for(i=0;i<n;i++)
scanf("%d",&a[i]);
printf("Enter the searching element\n");
scanf("%d",&k);
f=0;
l=n-1;
m=(f+l)/2;
while(f<=l)
{
if(a[m]<k)
f... | ALGO | 0.999418 | 3.259202 |
e8034487-ddde-412e-be8a-9fd2808eb1f9 | sindy01/IT1103_2025January | Lecture Slide Codings/Lecture 7/example9.cpp | //Lecture 7 Slide 21 - Cstring Manipulation Functions
#include <iostream>
#include <cstring>
using namespace std;
int main()
{
char message1[] = "SLIIT NORTHERN UNI";
char message2[] = "UNI ";
char message3[10] = "SLIIT";
cout << strlen(message1) << endl;
cout << strlen(message2) << endl;
cout << strlen(... | TOOL | 0.993013 | 4.052478 |
89a4068b-26d1-42ca-aede-4e84899d28d1 | lalor/leetcode | chenhao/algorithms/populatingNextRightPointersInEachNode/populatingNextRightPointersInEachNode.cpp | // Source : https://oj.leetcode.com/problems/populating-next-right-pointers-in-each-node/
// Author : Hao Chen
// Date : 2014-06-19
/**********************************************************************************
*
* Given a binary tree
*
* struct TreeLinkNode {
* TreeLinkNode *left;
* TreeLink... | ALGO | 0.999849 | 4.666276 |
27890646-558c-45dc-8aee-3d074867fac2 | jonK341/MasterNoder2 | src/zmn2/zmn2module.cpp | #include "zmn2/zmn2module.h"
#include "zmn2chain.h"
#include "libzerocoin/Commitment.h"
#include "libzerocoin/Coin.h"
#include "hash.h"
#include "main.h"
#include "iostream"
bool PublicCoinSpend::Verify(const libzerocoin::Accumulator& a, bool verifyParams) const {
return validate();
}
bool PublicCoinSpend::valida... | TOOL | 0.857887 | 5.853317 |
d37dd7d0-39ea-4257-938c-05bdd5d63dce | NidoSen/CMU15-445 | src/execution/topn_executor.cpp | #include "execution/executors/topn_executor.h"
namespace bustub {
TopNExecutor::TopNExecutor(ExecutorContext *exec_ctx, const TopNPlanNode *plan,
std::unique_ptr<AbstractExecutor> &&child_executor)
: AbstractExecutor(exec_ctx), plan_(plan), child_executor_(std::move(child_executor)) {}
... | ALGO | 0.963857 | 6.583006 |
eb354eeb-f8a9-4dde-8af5-75c2277ddaba | kennyfs/competitive-programming | Codeforces/1553/d.cpp | #include <iostream>
#define Hirasawa_Yui_My_Wife ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
int main(){
Hirasawa_Yui_My_Wife
int t;
cin>>t;
while(t--){
string s,t;
cin>>s>>t;
int l=s.size(),n=t.size();
if(n>l){cout<<"No\n";continue;}
int start=0;
if((l-n)%2)start=1;
int j=0;/... | ALGO | 0.99991 | 4.880959 |
a14bf568-1544-433f-ae0d-19edee5af43e | Kanishk-Srivastava/Code | 0016-3sum-closest/0016-3sum-closest.cpp | class Solution {
public:
int threeSumClosest(vector<int>& nums, int target) {
int closestSum = INT_MAX;
int ans;
sort(nums.begin(), nums.end());
for (int i = 0; i < nums.size(); i++) {
int j = i + 1;
int k = nums.size() - 1;
while (j < k) {
... | ALGO | 0.999994 | 6.378471 |
f485eeed-2f21-4c7d-a225-a20f92c0d4e2 | mindsphere/mongo | src/third_party/icu4c-57.1/source/i18n/alphaindex.cpp | #include "unicode/utypes.h"
#if !UCONFIG_NO_COLLATION
#include "unicode/alphaindex.h"
#include "unicode/coll.h"
#include "unicode/localpointer.h"
#include "unicode/normalizer2.h"
#include "unicode/tblcoll.h"
#include "unicode/uchar.h"
#include "unicode/ulocdata.h"
#include "unicode/uniset.h"
#include "unicode/uobject... | TOOL | 0.984197 | 3.543686 |
3c835d26-2d75-4d11-a336-bdf21b0c1f9c | junaiddshaukat/DSA-LeetCode-Solutions | 1013-fibonacci-number/fibonacci-number.cpp | class Solution {
public:
int fib(int n) {
if(n==0 || n==1)return n;
return fib(n-1)+fib(n-2);
}
}; | ALGO | 0.999979 | 5.727923 |
9d80b583-4f30-4734-9f0d-528aa039e7a2 | datouxyz/TPMPlusPlus | Tpm++/eigen-3.4.0/bench/spbench/sp_solver.cpp | // Small bench routine for Eigen available in Eigen
// (C) Desire NUENTSA WAKAM, INRIA
#include <iostream>
#include <fstream>
#include <iomanip>
#include <Eigen/Jacobi>
#include <Eigen/Householder>
#include <Eigen/IterativeLinearSolvers>
#include <Eigen/LU>
#include <unsupported/Eigen/SparseExtra>
//#include <Eigen/Sp... | ALGO | 0.991812 | 4.29849 |
5946a2cf-7d76-4ed3-b724-4c873fa61484 | ishandutta2007/codeforces | cldp/normal/920/C.cpp | #include <iostream>
#include <vector>
#include <cmath>
#include <cstring>
#include <algorithm>
using namespace std;
const int MAXN = 200010;
const int INF = 1000000007;
const double PI = acos(-1.0);
int x[MAXN];
string Q;
int y[MAXN];
int main() {
ios_base::sync_with_stdio(false);
int N;
cin >> N;
fo... | ALGO | 0.999999 | 4.341712 |
da419d8c-07d8-4cd5-82ea-ad617415adca | t4ichi/algo-method | 動的計画法 (DP)/3 章:部分和問題とナップサック問題/q1.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int n,m;
cin >> n >> m;
vector<int> a(n-1);
for(int i = 0;i < n-1;i++) cin >> a[i];
vector<vector<bool>> dp(n,vector<bool>(m));
dp[0][0] = true;
for(int i = 0;i < n-1;i++){
for(int j = 0;j < m;j++){
if(!dp[i][j])... | ALGO | 0.999973 | 3.590261 |
217ee324-acc7-4f89-9808-88c9f725a782 | tatvlogs0312/Data-Structure-and-Algorithms-C- | Sort/sapxep2.cpp | #include <iostream>
using namespace std;
void nhap(int *a, int n)
{
for (int i = 0; i < n; i++)
{
cout << "Nhap a[" << i << "] : ";
cin >> a[i];
}
}
void xuat(int *a, int n)
{
for (int i = 0; i < n; i++)
{
cout << a[i] << " ";
}
}
void insertionSort(int *a, int n)
{
int pos;
for (int i = 1; i < n; i++... | ALGO | 0.999857 | 4.244062 |
e18eda1b-81fe-40f5-abf9-665b6593c3be | PRIME3015/L3- | C_Woodcutters.cpp | // राधाकृष्ण राधाकृष्ण राधाकृष्णराधाकृष्ण राधाकृष्ण राधाकृष्ण राधाकृष्ण राधाकृष्ण राधाकृष्ण राधाकृष्ण राधाकृष्ण राधाकृष्ण राधाकृष्ण राधाकृष्ण राधाकृष्ण राधाकृष्ण राधाकृष्णराधाकृष्ण राधाकृष्ण राधाकृष्ण
// राधाकृष्ण राधाकृष्णराधाकृष्ण राधाकृष्णराधाकृष्णराधाकृष्ण राधाकृष्ण राधाकृष्णराधाकृष्ण राधाकृष्ण राधाकृष्णराधाकृष्ण र... | ALGO | 0.999842 | 4.337759 |
47e7c77b-a501-4c6f-a21d-31e7b689443b | AuraRobotics/aura-rcss-codebase | src/chain_action/actgen_deep_pass.cpp | //
// Created by armanaxh on ۲۰۱۹/۱۰/۵.
//
#include "actgen_deep_pass.h"
#include "action_state_pair.h"
#include "predict_state.h"
#include "../utils/allocators/player_relationship.h"
#include "../cafe_model.h"
#include "pass.h"
#include "../utils/rcsc_utils.h"
#include "field_analyzer.h"
#include <rcsc/player/player... | ALGO | 0.997372 | 3.918735 |
fc8ff766-94df-4374-95df-c302a267c156 | ishandutta2007/codeforces | joyfun/normal/668/D.cpp | #include <cstdio>
#include <cstring>
#include <algorithm>
#include <map>
using namespace std;
const int N = 100005;
map<int, int> S;
struct OP {
int tp, ti, a, id;
void read(int id) {
scanf("%d%d%d", &tp, &ti, &a);
this->id = id;
}
bool operator < (const OP& c) const {
retur... | ALGO | 0.999834 | 3.935578 |
7e868484-9918-4811-82b0-e1248c613740 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_2304_1.cpp | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 5, MAXK = 205, Mod = 1e9 + 7;
char buf[1 << 12], *pp1 = buf, *pp2 = buf, nc;
int ny;
inline char gc() {
return pp1 == pp2 &&
(pp2 = (pp1 = buf) + fread(buf, 1, 1 << 12, stdin), pp1 == pp2)
? EOF
: *pp1++;
}... | ALGO | 0.999958 | 4.490354 |
4849215a-0134-4696-8cb4-f802efa73aae | Spchfonn/code | prob solve/week04/bipartite.cpp | #include<bits/stdc++.h>
using namespace std;
list<int> arr[100010], q;
int mark[100010];
int main(){
int k, n, m, u, v, ans;
cin >> k;
while(k--){
ans = 0;
cin >> n >> m;
while(m--){
cin >> u >> v;
arr[u].push_back(v);
arr[v].push_back(u);
... | ALGO | 0.999969 | 4.262799 |
97c8caf2-3957-4b06-a810-1e76a8216587 | shubhkamble26/C-for-DSA | divisible_by_2_3.cpp | #include<iostream>
using namespace std;
int main(){
#ifndef ONLINE JUDGE
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
#endif
int n;
cin>>n;
if(n%2==0 && n%3==0){
cout<<"Divisible by 2 and 3"<<endl;
}
else if(n%2==0 || n%3==0){
if(n%2==0)... | ALGO | 0.999746 | 3.982364 |
0b9c7e71-7e0d-43ae-9305-173a69727caa | mensenvau/solutions_lets_crack_it | week4/day4/solutions.cpp | // add
bool compareChildVector(vector<int> a, vector<int> b)
{
return (a[1] < b[1]);
}
int Solution::solve(vector<vector<int>> &A)
{
sort(A.begin(), A.end(), compareChildVector);
int count = 1, end = A[0][1];
for (int i = 1; i < A.size(); i++)
{
if (A[i][0] > end)
{
// c... | ALGO | 0.999908 | 5.247705 |
7002422a-fcf4-4c43-a300-33813f903e2a | alexandraback/datacollection | solutions_2645486_0/C++/Satyamshivam/pro2.cpp | #include <stdio.h>
#include <math.h>
int main()
{
freopen("test2.in", "r", stdin);
freopen("out.txt", "w", stdout);
int E, R, n, i, k, gain, m1, x, te, j, Enow, yes, m, dist;
scanf("%d", &te);
for(i=1; i<=te; i++)
{
scanf("%d%d%d", &E, &R, &n);
int v[n+1];
for(j=0; j<n; j++)
scanf("%d", &v[j]);
Enow = E;
... | ALGO | 0.999935 | 3.242338 |
9f5c87a1-1eef-47a9-b6fc-2b986b7ff6c1 | lijunray/LeetCode | cpp/easy/110-Balanced Binary Tree.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
private:
int depth(TreeNode* root) {
if (!root) {
return 0;
}
retur... | ALGO | 0.999923 | 6.824076 |
5141f11c-1030-4af7-8d31-dec1cb9d2a81 | biointec/browniealigner | src/readcorrection.cpp | #include <thread>
#include <string>
#include <iomanip>
#include "library.h"
#include "readcorrection.h"
#include <algorithm>
using namespace std;
// ============================================================================
// ALIGNMENT METRICS CLASS
// =============================================================... | ALGO | 0.987699 | 5.897021 |
a476e3db-5e80-4565-b992-1784fc0f0612 | heavenMOJANG/ICPC | .history/programmes_C_Cpp/HDU/2025“钉耙编程”中国大学生算法设计春季联赛(2)/1003_20250314191606.cpp | #pragma GCC optimize(1)
#pragma GCC optimize(2)
#pragma GCC optimize(3, "Ofast", "inline")
#include <bits/stdc++.h>
#define int long long
using namespace std;
constexpr int INF = 0x7fffffff;
struct Query {
int l, r, id;
bool operator < (const Query& q) const { return r < q.r; }
};
struct FenwickTree {
int n... | ALGO | 0.99948 | 4.277518 |
6d894001-1f42-4771-be5d-6247baf7bb83 | dapin1490/coding-study | BOJ/cpp/15964.cpp | #include <iostream>
using namespace std;
int main()
{
// 빠른 입출력
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
long long a, b;
cin >> a >> b;
cout << (a + b) * (a - b);
return 0;
}
| ALGO | 0.999288 | 4.157932 |
4782fc9a-55b9-4ba4-8774-77d7051c37a1 | NK-codeman0001/Leetcode-Submissions | 1751-maximum-number-of-events-that-can-be-attended-ii/1751. Maximum Number of Events That Can Be Attended II.cpp | class Solution {
public:
int BS(int index,vector<vector<int>>&events,int value)
{
int lo = index;
int hi = events.size()-1;
int req = -1;
while(hi>=lo)
{
int mid = lo+(hi-lo)/2;
if(events[mid][0] > value)
{
req = mid;
hi = mid-1;
}
else lo = mid+1;
... | ALGO | 0.99977 | 5.986176 |
264421f5-bbe9-49d7-a6ae-3a7b10f9e73d | Prayag2003/data-structures-and-algorithms | String/reverseWords.cpp | #include <bits/stdc++.h>
using namespace std;
string reverseWords(string s)
{
// NOTE: Trimming the start and the end
int start = 0, end = s.size() - 1;
while (start <= end && s[start] == ' ')
start++;
while (end >= start && s[end] == ' ')
end--;
// NOTE: Split the words
vector... | ALGO | 0.999678 | 5.498652 |
63086d96-ebac-4c10-9d0b-15662962cb85 | ishandutta2007/codeforces | aryanc403/normal/975/C.cpp | //for(auto a: x);
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
#include<stdio.h>
#define fo(i,n) for(i=0;i<(n);++i)
#define LLI long long int
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define MAX 1000002
#define MOD 1000000007
LLI T,n,in,i,m,j,k,q;
vector <L... | ALGO | 0.999576 | 3.371194 |
c68cdd23-89ed-4432-b35e-fcc1882ca860 | Ehsanul-Karim-Pappu/backup_code_repo | uHunt/UVA-Solutions-master/10079 Pizza Cutting.cpp | #include <iostream>
using namespace std;
int main()
{
long long num;
while (cin >> num, num >= 0)
cout << ((num * (num + 1)) / 2 + 1) << '\n';
} | ALGO | 0.999773 | 4.213105 |
e4dfe1a2-66b6-4c45-9a05-913e6bd0efab | AdarshGaur/Competitive-Programming | Google/Kickstart 2022/Coding Practice with Kick Start Session #1/Sample Problem.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int test;cin>>test;
for(int t=1; t<=test; t++){
int n, m;cin>>n>>m;
int candy=0;
for(int i=0; i<n; i++){
int x;cin>>x;
candy += x;
}
int gave = candy/m;
int left = candy - (gave*m);
... | ALGO | 0.999956 | 3.386797 |
515e92b6-2302-4592-9d49-f76c9e6e8aa3 | ellen24k/Algorithm | C++/프로그래머스/0/120891. 369게임/369게임.cpp | #include <string>
#include <vector>
using namespace std;
int solution(int order) {
int answer = 0;
while (order){
int is_clap_num = order % 10;
order /= 10;
if (is_clap_num == 3 or is_clap_num == 6 or is_clap_num == 9) answer++;
}
return answer;
} | ALGO | 0.997527 | 5.287934 |
bcbf1455-6724-4ad3-926d-6df53aea5ee1 | surajiyer26/My-Codeforces-Submissions | peculiar_apple_tree.cpp | #include <bits/stdc++.h>
using namespace std;
#define vi vector <int>
#define vii vector <pair<int,int>>
#define vvi vector <vector<int>>
#define pb push_back
#define mp make_pair
#define all(a) a.begin(), a.end()
#define allr(a) a.rbegin(), a.rend()
#define rep(a,b,c) for(int a {b}; a<c; ++a)
#define repr(a,b,c) for... | ALGO | 0.999738 | 4.166478 |
80353442-d710-4c5f-894c-d27d354f14c0 | hound77/leetcode-solutions | Largest Rectangle in Histogram.cpp | class Solution {
public:
int largestRectangleArea(vector<int>& arr) {
int res=INT_MIN;
int n=arr.size();
stack<int>st;
for(int i=0;i<n;i++)
{
while(st.empty()==false && arr[st.top()]>=arr[i])
{
int pos=st.top();
st.pop()... | ALGO | 0.999967 | 6.44653 |
68e67c4d-2720-49dd-a681-ea65689f0d5a | Priyansh-15/Strivers-A2Z-DSA-CourseSheet | Step 1/Step 1.5/[GFG]fibonacci_nmber.cpp | //{ Driver Code Starts
//Initial function template for C++
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
//User function template for C++
class Solution
{
public:
//Function to return list containing first n fibonacci numbers.
vector<long long> printFibb(int n)
{
//code... | ALGO | 0.999614 | 6.208037 |
0c7257af-8d46-493f-969d-598c9338fea2 | Sora233/ACM-ICPC | HDU/1384差分约束.cpp | #include<cstring>
#include<cstdio>
#include<queue>
#include<iostream>
#include<algorithm>
#define pb push_back
#define pii pair<int,int>
#define LL __int64
#define INF 0x7fffffff
#define LLINF 0x7fffffffffffffff
using namespace std;
const int N =55005;
struct eg{
int u, v, w;
eg(){}
eg(int a, int b, int c) ... | ALGO | 0.999857 | 3.837912 |
3790fd78-cce7-439b-81d8-a70dd379b1c7 | hsinyv/Algorithm_Exercise | Advanced_Level/A1058 A+B in Hogwarts.cpp | /***********************************************
* Program Ability Test Advanced Level Practice
* No.1058 A+B in Hogwarts
* Date: 2021/03/12
***********************************************/
/***********************************************
* Core Mission: calculate addition in specific rule
* Point:
***************... | ALGO | 0.993441 | 4.060475 |
b0108b99-9233-4710-83df-0d46380cb2cf | poornesh-tata/Leetcode-GFG_solved | 0645-set-mismatch/0645-set-mismatch.cpp | class Solution {
public:
vector<int> findErrorNums(vector<int>& nums) {
int sum=0;
vector<int> ans;
unordered_map<int,int> hash;
for(auto it:nums) sum+=it;
for(auto it:nums)
{
hash[it]++;
if(hash[it]==2)
{
ans.push... | ALGO | 0.999855 | 5.415975 |
b6f2c1d9-9907-463a-aead-5ae9dd6862ca | Taohid0/Contest-programming-problems-and-graph | v day 2016 g/main.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{ios_base::sync_with_stdio(false);cin.tie(0);
long long n,value;
vector<long long>v1;
cin>>n;
unsigned long long n1=0,n2=0;
for(int i=0;i<n;i++)
{
cin>>value;
v1.push_back(value);
}
for(int i=0;i<n;i++)
{
... | ALGO | 0.999858 | 3.575826 |
1fa21489-414e-4108-b37b-e3b8d04ea293 | YingHaoD/sophmore | 算法实验/project/max.cpp | //#include <iostream>
//#include <math.h>
//#include <algorithm>
//#include <vector>
//using namespace std;
//
//int isMax(vector<int> a, int begin, int end)
//{
// if (begin == end)
// {
// return a[end];
// }
// int mid = (begin + end) / 2;
// return max(isMax(a, begin, mid), isMax(a, mid + 1, e... | ALGO | 0.999805 | 3.922395 |
99816536-6984-42b0-b32a-464601151a29 | ashik0072/CSA1460-COMPILER-DESIGN-PROGS | Compiler-Design-CSA1460-main/string is grammar or not.cpp | #include<stdio.h>
#include<conio.h>
#include<string.h>
int main() {
char string[50];
int flag,count=o;
printf("The grammar is: S->aS, S->Sb, S->ab\n");
printf("Enter the string to be checked:\n");
gets(string);
if(string[0]=='a') {
flag=0;
for (count=1;string[count-1]!='\0';count++) {
if(string[count]=='b... | ALGO | 0.99867 | 3.1861 |
09be1db4-b099-4d89-b877-0de68b99d7e6 | gopoma/competitive-programming | events/archive/Problemset/1353B.cpp | #pragma GCC optimize(3,"Ofast","inline")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
#define MACRO(code) do {code} while (false)
#define DBG(x) MACRO(cerr << #x << " ... | ALGO | 0.999981 | 4.116656 |
02e04cd4-df89-409c-bf09-0fbc6bf34ad9 | himanshu231204/DSA | Linkedlist/Medium Problem SLL/middleNode.cpp | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
class Node {
public:
int data;
Node* next;
Node(int data1, Node* next1) {
data = data1;
next = next1;
}
Node(int data1) {
data = data1;
next = nullptr;
}
};
// Brute force
Node *findMiddle(... | ALGO | 0.999821 | 6.171798 |
ceecb0e5-843e-480f-9cad-cbc2f259792c | NotOneWest/Algorithm-Study | 0x08/1725.cpp | #include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const double PI = acos(-1);
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n; cin >> n;
stack<pair<ll,ll> > st;
ll ... | ALGO | 0.999886 | 4.204502 |
15c78843-b27e-4dcc-a547-71949e1796a4 | nehakumari2003/DSA-Leetcode | Search2Dmatrix2.cpp | /*Write an efficient algorithm that searches for a value target in an m x n integer matrix matrix. This matrix has the following properties:
Integers in each row are sorted in ascending from left to right.
Integers in each column are sorted in ascending from top to bottom.*/
#include <iostream>
#include <vector>
usi... | ALGO | 0.999986 | 6.727727 |
05c11099-9f8e-4f64-ab35-3305fddc1d4e | 0wovv0/Project-2 | SourceCode/Submittion/408-92-5663/test.cpp | #include <iostream>
using namespace std;
int n;
int arr[1000000];
int arr2[1000000];
void merge_sort(int l, int r)
{
if(l == r) return;
merge_sort(l, (l+r)/2);
merge_sort((l+r)/2 + 1, r);
// Trộn
int tmp;
int i = l, j = (l+r)/2+1, pos = l;
while(pos <= r)
{
if(i > (l+r)/2)
... | ALGO | 0.999971 | 4.579831 |
fb164c1c-f5fb-4b3f-b0e6-37a7c9bce9ad | satya-supercluster/DSA | 12-bit-manipulation/problems/problems/problem0006.cpp | /*
Problem 0006: Bitwise AND Range
Description:
Find bitwise AND of numbers in given range.
Difficulty: Medium
Topics: Problems
Example:
Input:
Output:
Constraints:
-
Approach:
1.
2.
3.
Time Complexity: O()
Space Complexity: O()
*/
#include <bits/stdc++.h>
using namespace std;
class Solution {
public:
... | ALGO | 0.999166 | 6.094559 |
c89ecc80-e9d4-4abf-a179-f13457f73114 | Meghanasveeramallu/Leetcode | 980. Unique Paths III.cpp | class Solution {
int m, n;
vector<int> dx = {-1, 1, 0, 0};
vector<int> dy = {0, 0, -1, 1};
public:
bool isvalid(int i, int j){
return i >= 0 and j >= 0 and i < m and j < n;
}
int dfs(int i, int j, int left, pair<int, int> dest, vector<vector<int>> &grid){
if (left == -1 and pai... | ALGO | 0.999942 | 5.900811 |
daa08d64-d46b-459f-8368-36330fc4f271 | xmuyulab/sparkSTARsolo | STAR/source/genomeSAindex.cpp | #include "genomeSAindex.h"
#include "TimeFunctions.h"
#include "SuffixArrayFuns.h"
#include "ErrorWarning.h"
void genomeSAindex(char * G, PackedArray & SA, Parameters & P, PackedArray & SAi, Genome &mapGen)
{
mapGen.genomeSAindexStart = new uint [mapGen.pGe.gSAindexNbases+1];
mapGen.genomeSAindexStart[0]=0;
... | ALGO | 0.997025 | 5.455307 |
319261e4-0fb6-477f-a53a-b6aaca323462 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_239_23.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = double;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
bool f(ll a, ll b) {
if (a == 0) return false;
if (!f(b % a, a)) return true;
ll x = b / a, mod = b + 1;
return ((x % mod) % 2) == 0;
}
int main() {
ios::sync_with_st... | ALGO | 0.999964 | 5.354058 |
53efd215-2c37-49c5-8183-76c07d403b1b | tsudalab/ppelr | PPELR/main.cpp | #include <iostream>
#include <fstream>
#include <algorithm>
#include <random>
#include "RPCServer.hpp"
#include "RPCClient.hpp"
#pragma GCC diagnostic push
#pragma clang diagnostic ignored "-Wshorten-64-to-32" // Stupid Boost lib is not yet completely 64bit-friendly
#include "boost/thread/thread.hpp"
#include "boost/... | DATA | 0.984382 | 4.550228 |
9319e94a-aa07-47d8-8d26-f756d74f20bf | newjinr/Competitive-Programming | findPairSum.cpp | // Complete the findPair() function below.
/*
For your reference:
SinglyLinkedListNode {
int data;
SinglyLinkedListNode* next;
};
To create a new node use below constructor
SinglyLinkedListNode(int node_data)
*/
class DoublyLinkedListNode
{
public:
int data;
DoublyLinkedListNode *next = NULL;
DoublyLinke... | ALGO | 0.999903 | 5.528017 |
a932763d-d90e-41ae-8942-e9c86906e445 | JsimonH/CPP | CQueue.cpp | /*
用两个栈实现一个队列。队列的声明如下,请实现它的两个函数 appendTail 和 deleteHead ,分别完成在队列尾部插入整数和在队列头部删除整数的功能。
(若队列中没有元素,deleteHead 操作返回 -1 )
输入:
["CQueue","appendTail","deleteHead","deleteHead"]
[[],[3],[],[]]
输出:[null,null,3,-1]
*/
class CQueue {
stack<int> st1;
stack<int> st2;
public:
CQueue() {}
void appendTail(int va... | ALGO | 0.999576 | 5.654485 |
583cfc8d-f41a-4293-9420-640c0fddfe22 | sabbirahmedfahim/ProblemSolving | Codeforces/B_Subsequence_Update.cpp | // resolved
#include <bits/stdc++.h>
#define nl '\n'
#define ll long long int
#define all(c) c.begin(),c.end()
#define print(c) for(auto e : c) cout << e << " "; cout << nl
using namespace std;
void solve()
{
int n, l, r; cin >> n >> l >> r;
vector<int> a(n + 1); // 1-based
for (int i = 1; i <= n; i++)
... | ALGO | 0.999842 | 4.724685 |
bcf24139-760c-4491-b3f4-8dc599c815d2 | SakshamSahgal/Competitive-Programming | Codeforces + Codechef/Largest Family.cpp | #include<iostream>
#include<cstring>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<cmath>
#include<climits>
#define lli long long int
#define GO_FAST ios_base::sync_with_stdio(0);ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
// basic debugging macros
lli __i__,__j__;
lli inf = 9e18;
#defin... | ALGO | 0.999814 | 4.249168 |
887b99e2-975c-49f3-b157-387c5efec13a | businessdohyeon/BaekJoon | #11659.cpp | /*
BaekJoon No
#11659
*/
#include <iostream>
using namespace std;
void setDefault(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
}
int main(){
setDefault();
int size, cnt;
cin >> size >> cnt;
int input[size];
int result[size+1];
result[0] = 0;
... | ALGO | 0.999874 | 3.911009 |
8c8f4ce7-2109-4a90-bc93-15890b626b13 | bbppooii/c | 打印菱形图形/源.cpp | #define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
int main() {
int n = 7;
int mid = n / 2;
for (int i = 0; i < n; i++) {
int numStars = i <= mid ? 2 * i + 1 : 2 * (n - i - 1) + 1;
int numSpaces = (n + 4 - numStars) / 2;
for (int j = 0; j < numSpaces; j++) {
printf(" ... | ALGO | 0.999813 | 4.173328 |
ebf7f839-b6e9-44a6-ab7f-8d8e83e46bf5 | rakjija/Dart-Flutter_study | Flutter_Bloc_Essential_Course/my_counter_cubit/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.998217 | 6.797273 |
b69443c4-bc75-4038-b416-54c029fd19d5 | anuanu0-0/dsa-practice | 02_graphs/002_bfs.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution {
public:
// Function to return Breadth First Traversal of given graph.
vector<int> bfsOfGraph(int V, vector<int> adj[]) {
vector<int> bfs;
queue<int> q;
vector<bool> vis(V, false);
q.push(0);
vis[0]... | ALGO | 0.999967 | 5.804656 |
03313079-f125-4249-9f9d-265b15f3b659 | Oracoin-Project/Oracoin | src/chainparams.cpp | #include "assert.h"
#include "chainparams.h"
#include "main.h"
#include "util.h"
#include <boost/assign/list_of.hpp>
using namespace boost::assign;
struct SeedSpec6 {
uint8_t addr[16];
uint16_t port;
};
#include "chainparamsseeds.h"
//
// Main network
//
// Convert the pnSeeds6 array into usable address ... | TEST | 0.91913 | 6.763827 |
5a6b0848-867f-4a16-8995-5c172032e8a1 | chetan0402/LeetCode | 20.cpp | #include<string>
#include<stack>
using namespace std;
class Solution {
public:
bool isValid(string s) {
stack<char> st;
for(auto c:s){
if(c=='(' || c=='{' || c=='[') st.push(c);
else{
if(st.empty()) return false;
... | ALGO | 0.999655 | 6.307536 |
0ac729db-f2ca-427b-a17b-2d302b88e88b | devpeshawari/Problem-Solving | 1849-maximum-absolute-sum-of-any-subarray/maximum-absolute-sum-of-any-subarray.cpp | class Solution {
public:
int maxAbsoluteSum(vector<int>& nums) {
int n = nums.size();
int currSum = 0;
int maxPositive = 0;
int maxNegative = 0;
int sol = 0;
for(int i = 0; i < n; i++){
currSum+=nums[i];
if(currSum > 0){
sol = m... | ALGO | 0.99999 | 5.874873 |
bdffc12f-4119-4032-9b96-0fe5601b2d8b | whuzk/tg-ecp-ufrgs | matlab/realtime/source/msfcn_templatebuilder.cpp | /*=========================================================================
* msfcn_templatebuilder.cpp
*
* Title: S-Function block implementation of max/min searching.
* Author: Diego Sogari
* Modified: 11/June/2014
*
*=======================================================================*/
#define S... | ALGO | 0.979999 | 7.101487 |
59563909-b5e3-4816-a808-13f1f726b3d4 | lewis-revill/agc-llvm-project | clang/test/ASTMerge/var-cpp/Inputs/var1.cpp |
template <typename T>
constexpr T my_pi = T(3.1415926535897932385L); // variable template
template <> constexpr char my_pi<char> = '3'; // variable template specialization
template <typename T>
struct Wrapper {
template <typename U> static constexpr U my_const = U(1);
// Variable template partial specializat... | TOOL | 0.953725 | 5.687288 |
ec45ba3c-30df-4aa6-a6b6-9f2265ae3247 | freezerspace/Leetcode | 0967-minimum-falling-path-sum/0967-minimum-falling-path-sum.cpp | class Solution {
public:
int minFallingPathSum(vector<vector<int>>& matrix) {
int n=matrix.size();
int m=matrix[0].size();
vector<vector<int>>dp(n,vector<int>(m,0));
for(int j=0;j<m;j++)dp[0][j]=matrix[0][j];
for(int i=1;i<n;i++){
for(int j=0;j<m;j++){
... | ALGO | 0.999991 | 6.206988 |
db8d550e-4f7e-4cc6-bbc1-00364ea44498 | Marcus-techtile/Mobile_robot_controllers | src/robot_controllers/robot_dynamic_controllers/include/eigen/doc/examples/Tutorial_BlockOperations_block_assignment.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace std;
using namespace Eigen;
int main()
{
Array22f m;
m << 1,2,
3,4;
Array44f a = Array44f::Constant(0.6);
cout << "Here is the array a:" << endl << a << endl << endl;
a.block<2,2>(1,1) = m;
cout << "Here is now a with m copied into its cent... | ALGO | 0.972045 | 3.290376 |
5d2dc0ca-aa40-4cec-b33e-855fcecdd09b | xieh1987/MyLeetCodeCpp | 0219 Contains Duplicate II.cpp | class Solution {
public:
bool containsNearbyDuplicate(vector<int>& nums, int k) {
unordered_map<int,int> mymap;
for (int i=0;i<nums.size();++i) {
if (mymap.find(nums[i])!=mymap.end()&&i-mymap[nums[i]]<=k) return true;
else mymap[nums[i]] = i;
}
return false;
... | ALGO | 0.999812 | 5.95011 |
f1031172-2e94-48d8-bff4-07dd5cdb7367 | JialiangHan/genetic_algorithm_using_bezier | src/piecewise_cubic_bezier.cpp | /**
* @file piecewise_cubic_bezier.cpp
* @author Jialiang Han (<EMAIL>)
* @brief this class generate a piecewise cubic bezier curve
* @version 0.1
* @date 2021-12-28
*
* @copyright Copyright (c) 2021
*
*/
#include "piecewise_cubic_bezier.h"
namespace GeneticAlgorithm
{
void PiecewiseCubicBezier::GetAn... | ALGO | 0.988698 | 4.049898 |
f6eac235-9433-4453-b186-54f0ed4218a8 | faiyaz103/Competitive-Programming | Number-Theory/Modular-Arithmetic/combinatorics_basic.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1e9+7, N=10000000;
ll fct[N+1],invfct[N+1];
ll modular_exponentiantion(ll base, ll power){
ll res=1;
while(power>0){
if(power%2!=0){
res=(res*base)%mod;
power-=1;
}
base=(base*bas... | ALGO | 0.999969 | 5.077763 |
48f2d68b-c495-437f-ba25-ccd20a574a52 | sikefield3/double-square | src/primetester.cpp | #include "primetester.h"
bool PrimeTester::isPrimeTrial(BNUM n) const{
if (n == 2 or n == 3 or n == 5){
return true;
}
if (n % 2 == 0 or n % 3 == 0 or n % 5 == 0){
return false;
}
int nStep = 2;
for (BNUM j=7;j*j <= n;j+=nStep){
if (n % j == 0){
return false;
}
nStep = nStep * 2 % 6;
}
return true... | ALGO | 0.998002 | 5.011482 |
75b06f59-021b-4772-8435-a31fdc096e72 | anudeeps28/cpp_DSA-From-Scratch | Strings/checking_anagram.cpp | #include<iostream>
using namespace std;
// using hash table
int main()
{
char A[] = "decimal";
char B[] = "medical";
int i, H[26] = {0};
// filling hash table with 1s
for ( i = 0; A[i] != '\0'; i++)
{
H[A[i]-97]+= 1;
}
// checking back hash table with all elements repeating
... | ALGO | 0.999956 | 3.655295 |
00202f05-11f1-45e2-82b7-b79e6a8ba7d7 | moshexx/CPP-Projects | cpp_fs/quizzes/memcpy.cpp | // #include <iostream>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define WORD_SIZE (sizeof(size_t))
void *Memcpy(void *dest, const void *src, size_t n)
{
char *runner = (char *)dest;
for (; 0 < n; --n)
{
*runner = *(char *)src;
src = *(char **)&src + 1;
++runner;... | ALGO | 0.928356 | 3.508731 |
784bc84a-0553-48c4-b467-ae6a4f3712fa | robertsdionne/textengine | libraries/glm-0.9.5.2/test/gtx/gtx_simd_mat4.cpp | #define GLM_FORCE_RADIANS
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/quaternion.hpp>
#include <glm/gtc/random.hpp>
#include <glm/gtx/simd_vec4.hpp>
#include <glm/gtx/simd_mat4.hpp>
#include <iostream>
#include <cstdio>
#include <ctime>
#include <vector>
#if(GLM_ARCH != GLM_ARCH_PU... | TEST | 0.985324 | 6.313516 |
70958856-3c80-404e-9fb3-5ccce2f09a4f | soomrack/MR2024 | KhomenkoVS/Matrix2.cpp | #include <stdlib.h>
#include <stddef.h>
#include <stdio.h>
#include <iostream>
#include <string>
#include <cstring>
#include <math.h>
#include <cstdlib>
using namespace std;
typedef double elem;
class Matrix_exception: public std::exception
{
private:
std::string message;
public:
Matrix_ex... | ALGO | 0.972024 | 3.634995 |
74e87243-4a24-4ee9-8107-fdf4d92d8e54 | 4C-multiphysics/4C | src/beaminteraction/src/4C_beaminteraction_crosslinker_handler.cpp | #include "4C_beaminteraction_crosslinker_handler.hpp"
#include "4C_binstrategy_meshfree_multibin.hpp"
#include "4C_fem_discretization.hpp"
#include "4C_io.hpp"
#include "4C_io_pstream.hpp"
#include "4C_linalg_utils_sparse_algebra_math.hpp"
#include <Teuchos_TimeMonitor.hpp>
#include <unordered_set>
FOUR_C_NAMESPACE... | TOOL | 0.979356 | 4.790082 |
0e473513-ad84-441a-8305-c26d1f55dad6 | TheSebgon/Kattis | Spavanac/Spavanac.cpp | #include <iostream>
int main()
{
int hours, minutes, alarm = 45;
std::cin >> hours >> minutes;
if (minutes >= alarm)
{
minutes -= alarm;
std::cout << hours << ' ' << minutes;
}
else if (minutes < alarm)
{
if (hours == 0)hours = 24;
hours -= 1;
m... | ALGO | 0.999072 | 5.62906 |
7c0c55fd-425c-48b5-a203-71ba631a38d2 | RiyanWardhana22/CPP | training/07-11-2023/looping2.cpp | #include <iostream>
using namespace std;
int main()
{
int i,j; //deklarasi sekaligus inisiasi
i=1;j=1;
while (i <= 10) //pengaturan keadaan
{
cout << j << " "; //cetak output kebawah
i++; //langkah
j=j+2;; //laju untuk j
}
cout<<endl;
} | ALGO | 0.867354 | 3.908395 |
ddd368a3-805b-4250-afe5-a5a6c3573e48 | raincross7/code-similarity | codes/train_code/problem129/problem129_387.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
ll x, y;
cin >> x >> y;
ll ans;
if (x % y == 0) {
// xの倍数はすべてyの倍数となってしまう。
ans = -1;
} else {
ans = x;
}
cout << ans << endl;
return 0;
}
| ALGO | 0.999906 | 4.003363 |
88a616a3-b1c3-4f6b-8af7-175b29521469 | yancouto/competitive-programming | ojs/cc/cheftma.cpp | #include <bits/stdc++.h>
using namespace std;
#define fst first
#define snd second
typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
#define pb push_back
#define for_tests(t, tt) int t; scanf("%d", &t); for(int tt = 1; tt <= t; tt++)
template<typename T> inline T abs(T t) { return t < 0?... | ALGO | 0.999932 | 3.293144 |
139e3e88-032b-4fa9-b82f-975c70d84e0d | ishandutta2007/codeforces | hollwoq_pelw/normal/1243/B2.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld;
#define all(x) (x).begin(), (x).end()
#define sz(x) (x).size()
#define pb push_back
#define mp make_pair... | ALGO | 0.999993 | 5.060321 |
c810a3ce-accf-43d0-b790-c13e87483d05 | zxas56555/DataStructureTraining | 课本给的答案/ch02/LinkListDelDup/LinkList.cpp | #include "LinkList.h"
template <class ElemType>
LinkList<ElemType>::LinkList() {
first=new Node<ElemType>; /*ͷ*/
first->next=NULL; /*ͷָΪ*/
}
template <class ElemType>
LinkList<ElemType>::LinkList(ElemType a[], int n) {
Node<ElemType> *r, *s;
first = new Node<ElemType>; /*ͷ*/
r = first; /*βָʼ*/
for(int i=0; i<... | TOOL | 0.926878 | 3.942097 |
fcabe67b-73b0-4ebf-8f8b-34ef245010c2 | Yeluorag/ACM-ICPC-Code-Library | CQU Training/杭电2015.11新生赛/1005.cpp | #include <algorithm>
#include <iostream>
#include <sstream>
#include <cstring>
#include <cstdio>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <cmath>
#include <set>
#include <map>
using namespace std;
typedef long long LL;
#define mem(a, n) memset(a, n, sizeof(a))
#define ALL(v) v.beg... | ALGO | 0.999941 | 3.822123 |
c7fe0996-4f5d-4bf2-a2b9-c2f42c2b33be | adam85-hub/Informatyka | Klasa 2/Pliki tekstowe/pl7 matura PP1/program.cpp | #include <iostream>
#include <fstream>
#include <vector>
using namespace std;
int main() {
ifstream f("cyfry.txt");
vector<int> ros;
int l, k;
int parzyste = 0;
unsigned int max_suma = 0;
unsigned int min_suma = -1;
int m, mi;
while(!f.eof()){
f >> l;
if(f.fail()) bre... | ALGO | 0.99989 | 3.721371 |
a813107e-9141-4433-a177-025c539210a8 | GrootTheDeveloper/OLP-ICPC | 800+BAI_CODE_HAY/Code/fc131_travel.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int chain[N], face[N], pos[N], top[N], nex[N], sz[N], a[N];
int cur_chain, cur_pos;
vector<int> g[N];
long long bit[N];
int n, q;
void update(int idx, int val)
{
for (; idx <= n; idx += idx & -idx)
bit[idx] += val;
}
long long get(int l, int r)
... | ALGO | 0.999941 | 4.516571 |
5779d69e-7b93-418c-bca2-dd4f4abb57cb | KeerthanaPravallika/DSA | 50Questions/Hashmap/validAnagram.cpp | /*
Link: https://leetcode.com/problems/valid-anagram/description/
Given two strings s and t, return true if t is an anagram of s, and false otherwise.
Example 1:
Input: s = "anagram", t = "nagaram"
Output: true
Example 2:
Input: s = "rat", t = "car"
Output: false
*/
// 1st approach
class Solution {
publi... | ALGO | 0.999925 | 6.668375 |
05788bb4-f18c-4c50-adad-a83751504abb | divyanshusharma3031/leetcode | Carpet into Box - GFG/carpet-into-box.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:
int carpetBox(int A, int B, int C, int D){
//code here
int ans=1e9;
// A->C
// B->D
int oa=A;
... | ALGO | 0.999319 | 5.537429 |
fe36d52f-946e-4b03-b272-f65269638ff7 | rohitjuyal21/DSA | 16_2D_Array/intro.cpp | #include <iostream>
using namespace std;
bool isPresent(int arr[][4], int key, int m, int n)
{
for (int i = 0; i < m; i++)
{
for (int j = 0; j < n; j++)
{
if (arr[i][j] == key)
{
return true;
}
}
}
return false;
}
int main()
... | ALGO | 0.999412 | 4.018309 |
a2f0362a-3217-4acf-925e-8e797f7296d8 | loki-engr/CtrlHair | wrap_codes/wrap_triangle/useful_code/libigl/include/igl/intrinsic_delaunay_cotmatrix.cpp | template <typename DerivedV, typename DerivedF, typename Scalar>
IGL_INLINE void igl::intrinsic_delaunay_cotmatrix(
const Eigen::MatrixBase<DerivedV> & V,
const Eigen::MatrixBase<DerivedF> & F,
Eigen::SparseMatrix<Scalar>& L)
{
Eigen::Matrix<Scalar, Eigen::Dynamic, 3> l_intrinsic;
DerivedF F_intrinsic;
re... | ALGO | 0.998337 | 7.028543 |
05871151-65c6-453c-8c95-5e66e61edef2 | ThisIsGagan19/daily_code_challenge | gfg/2024_7_july/c++/25_array_to_bst.cpp | // TIME COMPLEXITY
// O(n)
// SPACE COMPLEXITY
// O(n)
// CODE
class Solution {
public:
Node* solve(vector<int>& nums, int l, int r){
if(l > r) return NULL;
if(l == r){
return new Node(nums[l]);
}
int mid = l + (r-l)/2;
Node* root = new Node(nums[mid... | ALGO | 0.999987 | 7.201437 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.