uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
17de4262-7ee1-4810-89cd-144e3a391430 | leeyikjiun/cp-algorithms-data-structures | wheel_factorization.cpp | vector<int> wheelFactorization(int num, vector<int>& primes) {
vector<int> factors;
for (int prime : primes) {
if (prime * prime > num) break;
if (num % prime == 0) {
factors.push_back(prime);
while (num % prime == 0) num /= prime;
}
}
if (num > 1) factors... | ALGO | 0.999786 | 5.123427 |
dea42a71-e318-4928-a90f-183a328f2f0c | Prateek-rajput-007/LeetCode-Practice- | 2720-minimize-the-maximum-difference-of-pairs/2720-minimize-the-maximum-difference-of-pairs.cpp | class Solution {
public:
int minimizeMax(vector<int>& v, int p) {
sort(v.begin(),v.end());
int n = v.size();
int ans = v[n-1]-v[0];
int i=0,j=ans;
while(i<=j){
int m = (i+j)/2;
int total = 0;
int k = 0;
while(k<n-1){
if(v[... | ALGO | 0.999974 | 5.378479 |
57b66a3e-faf9-4384-bd2c-6cf94c3183cf | Shokkenn/Data-Structures-And-Algorithms | Stack/8 Stack getmin() inefficient.cpp | #include <bits/stdc++.h> // Includes all standard libraries
using namespace std;
// Class representing a stack with a method to get the minimum element
class Stack
{
int maxsize; // Maximum size of the stack
int minl; // Variable to keep track of the minimum element
int top; // Index of the top element... | ALGO | 0.99948 | 5.977073 |
877bf782-38b5-42ef-8701-d9ee354b1c52 | crownengine/crown | 3rdparty/bimg/3rdparty/nvtt/bc6h/zohone.cpp | // one region zoh compress/decompress code
// Thanks to Jacob Munkberg (<EMAIL>) for the shortcut of using SVD to do the equivalent of principal components analysis
#include "bits.h"
#include "tile.h"
#include "zoh.h"
#include "zoh_utils.h"
#include "nvmath/vector.inl"
#include "nvmath/fitting.h"
#include <string.h>... | ALGO | 0.989119 | 5.387089 |
4dcac47a-829c-4f37-90e1-29d2c2b2be30 | Evan077/cp | DSU.cpp | struct dsu{
vector<ll>parent;
vector<ll>size;
dsu(int n){
parent.resize(n+1);
size.resize(n+1);
for(int i=1;i<=n;i++){
parent[i]=i;
size[i]=1;
}
}
ll find(ll v){
if(parent[v]==v) return v;
return parent[v]=find(parent[v]);
}
void Union(ll a,l... | ALGO | 0.998962 | 3.335099 |
5e9806bb-a4de-4797-884c-0627da7934d9 | ishandutta2007/codeforces | podurem/normal/923/B.cpp | #include <bits/stdc++.h>
#define err(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
using namespace std;
typedef long long ll;
int main() {
int n;
cin >> n;
vector<int> V(n), T(n), G(n + 2);
vector<ll> P(n + 1), A(n + 1);
for (int i = 0; i < n; i++) cin >> V[i];
for (int i = 0; i < n; i++) cin >> T[i];
... | ALGO | 0.999992 | 3.387547 |
0fcc56d5-5193-4e82-bb78-e5747233d6a0 | sleepymole/acm-icpc | 51nod/1391.cpp | #include <cstdio>
#include <cstring>
const int maxn = 1000010;
char str[maxn];
int sum[maxn];
int main() {
scanf("%s", str);
int n = strlen(str);
for (int i = 1; i <= n; i++) {
sum[i] = sum[i - 1] + (str[i - 1] == '1' ? 1 : -1);
}
int Min = maxn + 10, p = -1;
for (int i = 1; i < n; i++)... | ALGO | 0.999996 | 3.728824 |
5f350e33-b7a2-49e8-918c-3f3492a1143c | PiperBetle/MyCode | multi.cpp | #include<iostream>
using namespace std;
int main()
{
int i,j,k,a,b,c,ans,flag=0;
int sum[301];
cin>>a>>b>>c;
for(i=1;i<=a;i++)
for(j=1;j<=b;j++)
for(k=1;k<=c;k++)
sum[i+j+k]++;
ans=sum[3];
for(i=4;i<=a+b+c;i++)
{
if(sum[i]>ans)ans=sum[i];
}
for(i=3;i<=a+b+c;i++)
{
if(sum[i]==ans)
{
if(!fla... | ALGO | 0.999989 | 3.35835 |
c18da442-56cd-47da-81d3-9a284d791c84 | GabrielSantaRosa/ITP | ITP/ListaDeMatrizesEVetores/Question2.cpp | #include <iostream>
using namespace std;
int main(){
int N;
cin >> N;
//Adicionei esse parametro a mais para deixar o exercicio
// mais dinamico
int Vector[N];
int SizeVector = sizeof(Vector) / sizeof(Vector[0]);
int Menor;
int posicion;
for(int i = 0; SizeVector > i; i++ )
... | ALGO | 0.999812 | 4.114913 |
d15a6795-3f7d-4482-a19d-3cebf449fefe | BaoTrung37/PTIT_Sources | SPOJ/BCTSP - Travelling Salesman Problem.cpp | //
#include <bits/stdc++.h>
#define pb push_back;
typedef long long i64;
typedef long i32;
const int mod = 1e9+7;
const int Max = 1e6+5;
using namespace std;
int n,a[15][15],check[15]={0},m = 100000000;
void BackTrack(int tong,int bd,int dem){
if(dem < n - 1 && tong < m){
for(int i = 1 ; i < n ; i++){
... | ALGO | 0.99992 | 3.507987 |
a9f427ba-234e-4d77-9d7a-9eb3b646cb33 | Nikhilgarg-123/CPP-Basics-concepts | optimised code of power of a number using recursion.cpp | #include <iostream>
using namespace std;
int power(int no,int pow){
if(pow==0){
return 1;
}
if(pow%2==0){
return power(no*no,pow/2);
}
else{
return no*power(no*no,(pow-1)/2);
}
return 0;
}
int main() {
cout<<"Hello Nikhil!"<<endl;
int x=power(10,3);
cout<<x;... | ALGO | 0.999822 | 3.733892 |
9e940c83-1ca3-4bfe-b7c1-0b26b4fcfd04 | sgc109/leetcode-solutions | house-robber-ii/house-robber-ii.cpp | class Solution {
int dp[103][2][2];
public:
int rob(vector<int>& nums) {
memset(dp, 0xc7, sizeof(dp));
int ans = nums[0];
dp[0][0][0] = 0;
dp[0][1][1] = nums[0];
for(int i = 1; i < nums.size(); ++i) {
int rob = 0;
int notRob = 0;
for(in... | ALGO | 0.999862 | 5.564143 |
8f15ed81-7013-455f-9dfd-c02e19105db4 | Abhishek23042001/Face_Mask_Recognition_Model | opencv-master/modules/dnn/src/caffe/caffe_importer.cpp | #include "../precomp.hpp"
#ifdef HAVE_PROTOBUF
#include <iostream>
#include <fstream>
#include <sstream>
#include <algorithm>
#include <google/protobuf/message.h>
#include <google/protobuf/text_format.h>
#include <google/protobuf/io/zero_copy_stream_impl.h>
#include "caffe_io.hpp"
#endif
namespace cv {
namespace dnn ... | TOOL | 0.882848 | 7.463537 |
f1da5ab1-ea53-4eaf-b0f5-81a535503fce | notaspacecowboy/leetcode | Solutions/C++/HashTable/GroupAnagrams.cpp | #include <iostream>
#include <unordered_map>
#include <vector>
#include <algorithm>
using namespace std;
class Solution {
public:
vector<vector<string>> groupAnagrams(vector<string>& strs) {
unordered_map<string, vector<string>> lookup;
for(auto& str: strs) {
string sortedStr {str};
... | ALGO | 0.999987 | 6.232053 |
52b59824-f5ee-4ead-814e-a6d739a531e8 | hashiryo/Library | test/aoj/CGL_3_A.test.cpp | // competitive-verifier: PROBLEM https://onlinejudge.u-aizu.ac.jp/courses/library/4/CGL/3/CGL_3_A
// competitive-verifier: ERROR 0.00000001
// competitive-verifier: TLE 0.5
// competitive-verifier: MLE 64
#include <iostream>
#include <iomanip>
#include "src/Geometry/Polygon.hpp"
using namespace std;
signed main() {
ci... | ALGO | 0.957912 | 4.414308 |
ca68f657-b2e4-4dfc-9d4c-329163567bfa | Mulab11/cntt2016-hw1 | TC-SRM-574-div1-1050/luoyuchu.cpp | #include <bits/stdc++.h>
using namespace std;
#define dig(...) fprintf(stderr, __VA_ARGS__)
template <class TAT>
void Ckmin(TAT &a, const TAT &b)
{
if (a > b) a = b;
}
template <class TAT>
void Ckmax(TAT &a, const TAT &b)
{
if (a < b) a = b;
}
typedef long long LL;
using namespace std;
const int maxn = 55;
cons... | ALGO | 0.999928 | 4.118651 |
c1b36523-b07e-444c-a658-f98123af8c73 | uthrasri/frameworks_av_AOSP_4.2.2_r1 | media/libstagefright/codecs/amrwb/src/synthesis_amr_wb.cpp | /*
------------------------------------------------------------------------------
Filename: synthesis_amr_wb.cpp
Date: 05/04/2007
------------------------------------------------------------------------------
REVISION HISTORY
Description:
--------------------------------------------------------------------... | ALGO | 0.999688 | 3.877183 |
c5c62e68-6ef9-4630-9598-fe087a1abc4d | Leandro-Rodrigues/Olimpiada-Brasileira-de-Informatica | OBI 2017/Fase2/frete.cpp | #include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define ulli unsigned long long int
#define INF 0x3f3f3f3f
#define LINF 0x3f3f3f3f3f3f3f3fLL
const int t = 105;
vector< pair<int, int> > grafo[t];
int distancia[t];
bool vis[t];
void dj(int s) {
memset(distancia, INF, sizeof distancia);
... | ALGO | 0.999919 | 4.339266 |
5597e4b8-7f06-405e-ac8f-eb68fd3f2665 | LaDaLo/Codeforces | Round667/1409F.cpp | #include <bits/stdc++.h>
#define fast_io ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
void solve() {
int N, K;
cin >> N >> K;
string s, t;
cin >> s;
cin >> t;
vector<vector<vector<int>>> dp(N + 1, vector<vector<int>>(N + 1, vector<int>(N + 1, -1)));
dp[0][0][0] ... | ALGO | 0.999979 | 4.283693 |
703b7855-787b-480e-9a00-0b91af2177b3 | juneharold/USACO | usaco_practice/gold/DP/hoof.cpp | #include <iostream>
#include <algorithm>
using namespace std;
const int MAX_N=1e5+5;
const int MAX_K=25;
int N, K;
int dp[MAX_N][MAX_K][4]={}; //1=hoof, 2=paper, 3=scissor
char fj[MAX_N]={};
int main()
{
freopen("hps.in", "r", stdin);
freopen("hps.out", "w", stdout);
cin >> N >> K;
for (int i=1; i<=N;... | ALGO | 0.999835 | 3.668599 |
0b0901fa-f438-4ff6-a1f0-9d20970c532c | PIslam19/Problem-Solving-Leetcode | 1009-complement-of-base-10-integer/1009-complement-of-base-10-integer.cpp | class Solution {
public:
int bitwiseComplement(int n) {
int m=n;
int mask=0;
if(n==0)
{
return 1;
}
while(m!=0)
{
mask=(mask<<1)|1;
m= m>>1;
}
int ans=(~n)&mask;
return ans;
}
}; | ALGO | 0.999973 | 6.130115 |
ec0f140a-419b-4320-ac29-5c9bee852a75 | SGGODE/lettcode-solved | 1266-minimum-time-visiting-all-points/1266-minimum-time-visiting-all-points.cpp | class Solution {
public:
int minTimeToVisitAllPoints(vector<vector<int>>& points) {
int ans = 0;
for(int i = 1; i < points.size(); i++) {
ans += max(abs(points[i][1] - points[i - 1][1]), abs(points[i][0] - points[i - 1][0]));
}
return ans;
}
}; | ALGO | 0.999845 | 5.800571 |
9ac052e9-f0fb-4b23-903d-0b78234fb300 | BinomialSheep/CompetitiveCpp | AtcoderContest/ABC267/E3.cpp | #include <bits/stdc++.h>
// デバッグ用マクロ:https://naskya.net/post/0002/
#ifdef LOCAL
#include <debug_print.hpp>
#define debug(...) debug_print::multi_print(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (static_cast<void>(0))
#endif
using namespace std;
using ll = long long;
using vi = vector<int>;
using vl = vector<lo... | ALGO | 0.999894 | 4.675436 |
980e74b2-12b2-45cb-a423-9f568471e5e5 | Ark-Aak/code_repo | Luogu/Eschaton.cpp | #ifdef ONLINE_JUDGE
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4.1,sse4.2,avx,avx2,popcnt")
#include <immintrin.h>
#include <emmintrin.h>
#endif
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = (a), i##end = (b); i <= i##end; i++)
#define... | ALGO | 0.99969 | 4.014637 |
b93d8fcb-30e8-4bdd-bf2c-9f1ade98aa62 | YaminiGarkoti/DSA | n_even_nos.cpp | #include<iostream>
using namespace std;
void even(int l,int n)
{
if(n==0)
return;
if(l%2==0)
{
cout<<l<<" ";
even(l+2,n-1);
}
else
even(l+1,n);
}
int main()
{
int n;
cin>>n;
even(1,n);
return 0;
} | ALGO | 0.999565 | 3.937436 |
2a6d638f-4e60-41f3-83a5-d9e412d41037 | ankita0335/-CrackYourInternship | 0560-subarray-sum-equals-k/0560-subarray-sum-equals-k.cpp | class Solution {
public:
int subarraySum(vector<int>& nums, int k) {
int n = nums.size();
int count = 0, sum = 0;
unordered_map<int, int> sumFreq;
sumFreq[0] = 1; // Initialize with a sum of 0
for (int i = 0; i < n; i++) {
sum += nums[i];
// Check if t... | ALGO | 0.999944 | 6.851665 |
30c1d2a0-4ef5-4b1d-b2a0-59594b281d9a | kmjp/procon | codeforce/181-200/cf189/a.cpp | #include <cstdlib>
#include <cstring>
#include <memory>
#include <cstdio>
#include <fstream>
#include <iostream>
#include <cmath>
#include <string>
#include <sstream>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
using namespace std;
#include <stdio.h>
#include ... | ALGO | 0.999967 | 3.929812 |
7ed01d47-6b62-4fb3-93ad-eb503f9fdfd5 | fjrobinson/LLVM-Latency-Critical-Load-Replacement | lib/CodeGen/LivePhysRegs.cpp | #include "llvm/CodeGen/LivePhysRegs.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineInstrBundle.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
using namespace llvm;
/// \brief R... | ALGO | 0.91689 | 7.944582 |
8943886f-d0c9-441f-8073-8fdcc91b3a2f | king-yyf/cpcode | luogu/d3/c.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ar2 = array<int, 2>;
using ar3 = array<int, 3>;
using ar4 = array<int, 4>;
#define all(c) (c).begin(), (c).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define f0(e) for(int i = 0; i < (e); ++i)
#define f1(e) for... | ALGO | 0.999909 | 4.232856 |
4be7ffe6-df44-4f42-b61b-0fb322a93879 | zjxeditor/FFTracker | ThirdParty/Eigen/bench/sparse_trisolver.cpp |
//g++ -O3 -g0 -DNDEBUG sparse_product.cpp -I.. -I/home/gael/Coding/LinearAlgebra/mtl4/ -DDENSITY=0.005 -DSIZE=10000 && ./a.out
//g++ -O3 -g0 -DNDEBUG sparse_product.cpp -I.. -I/home/gael/Coding/LinearAlgebra/mtl4/ -DDENSITY=0.05 -DSIZE=2000 && ./a.out
// -DNOGMM -DNOMTL
// -I /home/gael/Coding/LinearAlgebra/CSparse/... | ALGO | 0.998405 | 4.874496 |
2836e27d-1000-4d16-b73c-2653bdad8038 | jinyoung0612/Algorithm | c++/BOJ/bfs/7569.cpp | #include <iostream>
#include <vector>
#include <cstring>
#include <string>
#include <queue>
using namespace std;
#define MAX 101
int arr[MAX][MAX][MAX];
int M,N,H;
int dx[6]={0,0,0,0,1,-1};
int dy[6]={0,0,1,-1,0,0};
int dz[6]={1,-1,0,0,0,0};
struct tomato{
int x;
int y;
int z;
int day;
};
bool check... | ALGO | 0.999778 | 3.875281 |
04da1c9c-e3fa-4467-adc6-2ee83df635de | Liuwt1997/Wangdao-OJ-Guide | 最小公倍数/例4-5.cpp | /*
给定两个正整数,计算这两个数的最小公倍数
*/
#include <stdio.h>
int main(){
int a, b, temp, c;
while(scanf("%d%d", &a, &b) != EOF){
c = a * b;
while(b){
temp = a % b;
a = b;
b = temp;
}
printf("%d\n", c/a);
}
return 0;
}
//最小公倍数=a*b/最大公约数 | ALGO | 0.999892 | 3.80269 |
6da07ea6-9609-4b87-8cb3-5db9f749d937 | 269Seahorse/NDHU-CSIE-HW | S3/411221307-HW11.cpp | #include <bits/stdc++.h>
using namespace std;
template<class T>
class BinarySearchTree {
private:
struct Node {
T data;
Node *left, *right;
};
void inorder(Node *cur) {
if(!cur)
return;
inorder(cur->left);
cout << cur->data << " ";
inorder(cur->right);
}
Node *root;
public:
BinarySearchTree() : ro... | ALGO | 0.999416 | 4.402569 |
ecfcfa21-ee37-4495-8d2f-30166f6dce04 | Purav001/Leet-code | 209-minimum-size-subarray-sum/minimum-size-subarray-sum.cpp | class Solution {
public:
int minSubArrayLen(int target, vector<int>& nums) {
int n=nums.size();
int l=0,r=0;
int sum=0,len=1e9;
while(r<n){
sum+=nums[r];
while(sum>=target){
len=min(len,r-l+1);
sum-=nums[l++];
}
... | ALGO | 0.999994 | 6.430104 |
3f2221ca-c350-4963-95e8-b1a074794414 | teashock/studySB-CPP | 14-two_dimensional_array/14.8 .cpp | #include <iostream>
#include <vector>
void printField(char field[10][10]) {
std::cout << " ";
for (int i = 0; i < 10; i++) {
std::cout << i << " ";
}
std::cout << std::endl;
for (int i = 0; i < 10; i++) {
std::cout << i << " ";
for (int j = 0; j < 10; j++) {
std... | TOOL | 0.943975 | 3.716783 |
0c98aea3-73fb-462f-92ad-b6bd92dc62c3 | selva1632/Data-Structure-and-algorithm | Greedy/55. Jump Game/55. Jump Game.cpp | // problem link: https://leetcode.com/problems/jump-game/description/
#include<iostream>
#include<vector>
using namespace std;
class Solution {
public:
bool canJump(vector<int>& nums) {
int reach = 0;
int i = 0;
for (; i < nums.size() && i <= reach; i++) {
reach = max(reach, i ... | ALGO | 0.999945 | 5.923565 |
2c098371-43a5-42a5-a98c-89e1013eb1be | AlConta/ITP_Study | ITP/ITP_1_2_D/ITP_1_2_D.cpp | // ITP_1_2_D.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//
#include <iostream>
using namespace std;
int main()
{
int W, H, x, y, r;
cin >> W >> H >> x >> y >> r;
if (x < r || y < r) cout << "No\n";
else if (x > W - r || y > H - r) cout << "No\n";
else cout << "Yes\n";
return 0;
... | ALGO | 0.999399 | 3.834968 |
9a4aeb42-3fca-486a-8770-1536b9a4789a | Manash04/DataStructue-And-Algorithms | 0231-power-of-two/0231-power-of-two.cpp | class Solution {
public:
bool isPowerOfTwo(int n) {
if(n<1)return false;
if((n&(n-1)) == 0){
return true;
}
return false;
}
}; | ALGO | 0.997258 | 6.251608 |
1a33601f-cba7-49c2-b60f-b484a53a2250 | vmos-dev/external | eigen/bench/sparse_dense_product.cpp |
//g++ -O3 -g0 -DNDEBUG sparse_product.cpp -I.. -I/home/gael/Coding/LinearAlgebra/mtl4/ -DDENSITY=0.005 -DSIZE=10000 && ./a.out
//g++ -O3 -g0 -DNDEBUG sparse_product.cpp -I.. -I/home/gael/Coding/LinearAlgebra/mtl4/ -DDENSITY=0.05 -DSIZE=2000 && ./a.out
// -DNOGMM -DNOMTL -DCSPARSE
// -I /home/gael/Coding/LinearAlgebr... | ALGO | 0.997986 | 4.386344 |
6a51426a-a7c0-4fa9-89d5-2ddbc8e158df | AlexiaBojian1/Algorithms-and-Data-structure | coin-change/coin-change.cpp | class Solution {
public:
int coinChange(vector<int>& coins, int amount) {
vector<int> dp(amount+1, amount+1);
if(amount == 0) {
return 0;
}
dp[0] = 0;
for(int i = 1;i<= amount;i++) {
for(auto c : coins) {
if(i - c >= 0) {
... | ALGO | 0.999863 | 5.931538 |
23562430-ddda-4d97-8ba3-2154c2ce127e | ishandutta2007/codeforces | 137_345_2814/normal/527/E.cpp | #include<cstdio>
using namespace std;
#define N 400050
int fa[N],head[N],cnt,n,h[N][2],in[N],m,as[N][2],ct,ls,s[N][2];
struct edge{int t,next;}ed[N*2];
void adde(int f,int t){ed[++cnt]=(edge){t,head[f]};head[f]=cnt;ed[++cnt]=(edge){f,head[t]};head[t]=cnt;}
int finds(int x){return fa[x]==x?x:fa[x]=finds(fa[x]);}
void df... | ALGO | 0.999959 | 3.850684 |
9594f8b1-404c-4875-b434-b281d69ed84a | yrhiba/Competitive_Programming | Content/Algorithms, ADHOC & Data Structures/Leetcode/Medium/54.SpiralMatrix.cpp | /*
Topics: dfs math
link to the problem:
https://leetcode.com/problems/spiral-matrix
*/
int dc[] = {+1, 0, -1, 0};
int dr[] = {0, +1, 0, -1};
class Solution
{
private:
int n, m, visited = 101;
vector<int> ans;
void dfs(vector<vector<int>>& matrix, int i, int j, int dir)
{
ans.push_back(matrix[i][j]);
matrix[... | ALGO | 0.999996 | 6.553524 |
332a4613-ff47-450b-8d65-60082bd6d32c | MightyBhargava/cpp-sem7 | DAY-2 Class/palindrome.cpp | #include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main() {
string inputStr;
cout << "Enter a string: ";
cin >> inputStr;
string reversedStr = inputStr;
reverse(reversedStr.begin(), reversedStr.end());
if (inputStr == reversedStr) {
cout << "\"" << inputS... | ALGO | 0.997237 | 4.853992 |
b1ad757a-440b-4b19-8960-7dab0f599d15 | ishandutta2007/codeforces | bigbag/normal/500/D.cpp | #include <map>
#include <set>
#include <stack>
#include <cmath>
#include <queue>
#include <vector>
#include <cstdio>
#include <string>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <algorithm>
using namespace std;
const int max_n = 111111, inf = 1111111111;
int n, q, u[max_n], v[max_n], dist[max... | ALGO | 0.999894 | 3.842872 |
34817f8b-3c3a-4b6e-bfbb-9e6846a4fb49 | dhruv-yadav-nitj/striver-a2z-dsa-cpp | Step 04 ~ Binary Search/BOOK-ALLOCATION-PROBLEM-MOST-IMP.CPP | #include <bits/stdc++.h>
using namespace std;
// its the most famous problem on Binary Search applied on search space, its because if you solved this problem then you can solve most of the problem based on this pattern i believe
//{ Driver Code Starts
// Initial template for C++
#include <bits/stdc++.h>
using namesp... | ALGO | 0.999993 | 5.710746 |
92ba943d-d76c-40ed-8805-bf559fbddfa4 | qaisjp/inf-cg | cw3/pbrt-v3/src/lights/infinite.cpp | // lights/infinite.cpp*
#include "lights/infinite.h"
#include "imageio.h"
#include "paramset.h"
#include "sampling.h"
#include "stats.h"
namespace pbrt {
// InfiniteAreaLight Method Definitions
InfiniteAreaLight::InfiniteAreaLight(const Transform &LightToWorld,
const Spectrum &L, ... | ALGO | 0.889968 | 5.518349 |
11b27ae5-3347-4391-ab66-a9c50ab84a77 | bhavyakalra19/cpp_comp_prog_dsa | LevelUp/Bit Manipulation/addBinary.cpp | #include<bits/stdc++.h>
using namespace std;
class Solution {
public:
string addBinary(string a, string b) {
int n1 = a.length() - 1;
int n2 = b.length() - 1;
int carry = 0;
string ans;
while(n1 >= 0 || n2 >= 0 || carry == 1){
if(n1 >= 0){
carry +... | ALGO | 0.999941 | 5.991125 |
5cada18f-4aba-4504-8941-617a7bebbf19 | shanchi16/SDE-Sheet-challenge- | Day 9/combination-sum-ll.cpp | class Solution {
public:
void solve(vector<int>& c, int target, set<vector<int>>& s, int i, vector<int>& out){
if(target == 0){
s.insert(out);
return;
}
if(i >= c.size() || target<0) return;
if(c[i] <= target){
out.push_back(c[i]);
so... | ALGO | 0.999978 | 5.6128 |
62244ace-6447-4983-ac60-7031e5ae53f7 | shubham-deshmukh/CP-Contests | Codeforce/Hello 2024/a.cpp | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define all(x) x.begin(), x.end()
#define rep(i,start,end) for(i = start; start < end ? i < end : i > end; start < end ? i += 1 : i -= 1)
#define endl "\n"
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
// http://www.open-std.org/j... | ALGO | 0.999785 | 4.921368 |
93fa2aee-8dbc-4daa-b950-69fefdd11ec8 | kzrobin/CodeForce-solution | 0099-0100/A_Initial_Bet.cpp | #include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#define scll(n) scanf("%lld",&n)
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
typedef long long ll;
typedef unsigned long long ull;
using names... | ALGO | 0.99991 | 3.336679 |
464bfbc6-cc91-4260-b1bd-4703cc5cc352 | avcopan/MPACK | mlapack/library/Cgetf2.cpp | #include <mblas.h>
#include <mlapack.h>
void Cgetf2(INTEGER m, INTEGER n, COMPLEX * A, INTEGER lda, INTEGER * ipiv, INTEGER * info)
{
INTEGER i, j, jp;
REAL sfmin;
REAL Zero = 0.0, One = 1.0;
//Test the input parameters.
*info = 0;
if (m < 0) {
*info = -1;
} else if (n < 0) {
*info = -2;
... | ALGO | 0.999976 | 4.231415 |
719a206a-f76f-4cb7-8b12-a6b2ad418a51 | Shri029/Learning-cpp | Reverse.cpp | //Reversing Queue using Stack
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
using namespace std;
class MyQueue {
public:
stack<int> s1, s2;
void push(int x) {
s1.push(x);
}... | ALGO | 0.999622 | 4.401178 |
069a5d1b-ae25-42c0-b0cf-552a503f1bb0 | davidjie1949/performance-optimization-code | 05/07_prefetch_demo.cpp | // Compare
//
// g++ -O2 -std=c++17 07_prefetch_demo.cpp
// g++ -O2 -std=c++17 -DSEQUENTIAL_ACCESS 07_prefetch_demo.cpp
//
// Adapted from <URL:https://stackoverflow.com/a/50280085/816999>
//
#include <chrono> // std::chrono::*
#include <iomanip> // std::setprecision/setw
#include <ios> // std::left
#includ... | TEST | 0.989385 | 6.03028 |
16d98a18-d083-436f-b8dc-82bd5683bbd3 | Stefy1209/SDA | TAD Arbore Binar/IteratorAB.cpp | #include "AB.h"
#include "IteratorAB.h"
/// Best Case: Theta(1)
/// Worst Case: Theta(n)
/// Average Case: O(n)
IteratorInordine::IteratorInordine(const AB& _ab):ab(_ab) {
/* de adaugat */
Nod * aux = ab.root;
while(aux != nullptr)
{
stack_.push(aux);
aux = aux->left;
}
if(stack_.empty())
it = nullptr;
el... | ALGO | 0.999534 | 5.197892 |
a528a57d-35e3-40c0-88ce-4ab71e935fec | juruo-c/ACM | 22.07/22.7.17/ABC260B.cpp | #include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
using namespace std;
const int N = 1005;
int n, x, y, z;
struct S
{
int m, e, id;
}s[N];
bool cmpm(S a, S b)
{
if (a.m == b.m)
return a.id < b.id;
return a.m > b.m;
}
bool cmpe(S a, S b)
{
if (a.e == b.e)
return a.id < b.id;
re... | ALGO | 0.999959 | 3.007008 |
79ed7602-4f61-4c4c-9b41-54964fea147d | pharick/cpp | 2-year/1-recap/5.cpp | #include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
int main() {
int n;
cin >> n;
double res = sqrt(2);
for (int i = 0; i < n - 1; i++) {
res = sqrt(2 + res);
}
cout << fixed << setprecision(6)
<< res << endl;
return 0;
} | ALGO | 0.99772 | 3.633744 |
5c7c6daf-a476-4b6d-8a9b-74d61f181494 | alexandraback/datacollection | solutions_2692487_0/C++/Demasi/a.cpp | #include <stdio.h>
#include <stdlib.h>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;
#define MAX 128
int v[MAX];
int main(void)
{
int T, A, N;
scanf("%d", &T);
for(int caso = 1; caso <= T; caso++)
{
printf("Case #%d: ", caso);
scanf("%d %d", &A, &N);
... | ALGO | 0.999933 | 3.345728 |
544c87af-a8aa-4d63-ad3d-3229ea6f1a14 | razakrazu/Admin_spent_time | 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 |
6f700561-fa02-4061-b1e5-4fa5e4c0fd7e | bae-g-g/CPP | 2_algorithms/backtracking/3_9663.cpp | #include <iostream>
#include <vector>
int **map; // 퀸을 놓을 수 없는 자리를 표시하는 배열
int N; //입력받는 수
int ans = 0; // 재귀함수임으로 전역변수로 정답 체크.
/*
add 함수
map함수에,해당(x,y)자리에 퀸을 놓음으로써 다음번에 퀸을 놓을 수 없는 자리를 표시
del함수
map함수에,해당(x,y)자리에 퀸을 뺌으로써 퀸을 놓을 수 없던 자리를 놓을 수 있는 자리로 표시
*/
void add(int x,int y){
map[x][y]++;
for(... | ALGO | 0.999905 | 4.263049 |
0a81cfe7-a62a-476e-ad91-9253834a259a | ishandutta2007/codeforces | ei133333/normal/1185/D.cpp | #include<bits/stdc++.h>
using namespace std;
using int64 = long long;
const int mod = 1e9 + 7;
const int64 infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;
struct IoSetup {
IoSetup() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
cout << fixed << setprecision(10);
cerr << fixed << setpreci... | ALGO | 0.999985 | 3.94898 |
d5d2e49c-90e1-4dfc-989d-a5ae7c3827e0 | adarshjudoka212/IS_Practicals_-20201448- | 6_Hill_cipher_encryption.cpp | #include<iostream>
#include<vector>
using namespace std;
int main(){
int x,y,i,j,k,n;
cout<<"Enter the size of key matrix\n";
cin>>n;
cout<<"Enter the key matrix\n";
int a[n][n];
for(i=0;i<n;i++){
for(j=0;j<n;j++){
cin>>a[i][j];
}
}
cout<<"Enter the message to... | ALGO | 0.999977 | 3.805652 |
fe0a1c0a-d295-4da5-a9bd-45f30cf846a5 | gexiannan2/testwebsocket | include/boost_1_85_0/libs/local_function/example/gcc_lambda.cpp | #include <boost/config.hpp>
#ifndef __GNUC__
# error "GCC required (using non-standard GCC statement expressions)"
#else
#include "gcc_lambda.hpp"
#include <boost/detail/lightweight_test.hpp>
#include <algorithm>
int main(void) {
//[gcc_lambda
int val = 2;
int nums[] = {1, 2, 3};
int* end = nums + 3... | TEST | 0.852934 | 5.92433 |
ea7686e5-2e0e-4a61-bf29-226e1a5792e0 | Jadest13/problem-sloving | acmicpc/01xxx/01306.cpp | #include <iostream>
#include <algorithm>
#define MAX 1000001
using namespace std;
int N, M;
int ARR[MAX];
int SEG[MAX*4];
int seg_init(int n, int s, int e) {
if(s==e) return SEG[n] = ARR[s];
int m = (s+e)>>1;
return SEG[n] = max(seg_init(n*2, s, m), seg_init(n*2+1, m+1, e));
}
int seg_query(int n, int s, in... | ALGO | 0.999982 | 3.709626 |
eb064f45-5038-44ba-9f4c-6d15a070bba3 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_1719_1.cpp | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 1000005;
int num[MAXN], leftBracket[MAXN];
int main() {
string str;
cin >> str;
int count = 0, max = 0, times = 1;
for (int i = 0; i < str.size(); ++i) {
if (str[i] == '(')
leftBracket[++count] = i;
else if (count) {
int pairLeft... | ALGO | 0.99854 | 4.453484 |
95fec36b-f7a7-42c5-9de5-c6112affdc5d | thekill022/Constructor_0174 | Constructor(5)_0174/Constructor(5)_0174.cpp | #include <iostream>
using namespace std;
class buku { //pembuatan class buku
string judul;
public:
//pembuatan object prosedur setJudul()
buku setJudul(string judul)
{
//pemberian nilai member judul dalam object dengan menggunakan this
this->judul = judul;
//membuat pointer thi... | TOOL | 0.954753 | 4.39762 |
8fd61237-b5a7-41df-a614-232880eee37a | Aakash231217/Cp-Problems | GoodBinaryStrings.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin>>t;
while(t--){
string str;
cin>>str;
int n=str.size();
if(str[0]==str[n-1]){
cout<<n-2<<endl;
}
else cout<<2<<endl;
}
return 0;
}
| ALGO | 0.999841 | 3.853517 |
9f97b57d-4632-4af8-b6cc-21b08a266c8a | NowSharif/DSA | Arrays/missingElementFromArrayWithDuplicates.cpp | // Find missing element in an array which has duplicate elements in it
#include <iostream>
using namespace std;
//sorting + swapping ; TC=O(N); SC=O(1)
void printMissing2(int nums[], int n){
int i = 0;
while(i<n){
int index = nums[i];
if(nums[i]!=nums[index-1]){
swap(nums[i], num... | ALGO | 0.99969 | 4.919573 |
11ad5f24-3c86-40cf-bc72-54454ff81572 | AmanSinghh345/Data-Structure-and-Algorithm | Math/Easy/GCD/p3.cpp | // Print all divisors
#include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cout<<"Enter the Number : ";
cin>>n;
vector<int> arr;
for(int i=1;i<=n;i++){
if(n%i==0) cout<<i<<' ';
}
return 0;
} | ALGO | 0.999067 | 4.573334 |
77238004-dc56-4ce3-a426-e235e59f7696 | Xelerezex/learning-space | stepik-courses/stepik-introduction-to-programming-c++/1.7.for-loop-and-arrays/step-06/task_4.cpp | #include <iostream>
#include <vector>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> arr(n);
for (int i = 0; i < arr.size(); i++) {
cin >> arr[i];
}
for (int i = 1; i < arr.size(); i++) {
if (arr[i - 1] < arr[i]) {
cout << arr[i] << " ";
}
... | ALGO | 0.999941 | 4.096916 |
2217983f-344d-4304-ac51-e4b4ab1c3c79 | glerium/acm-life | codeforces/2048-div-1-2/E.cpp | #include <bits/stdc++.h>
#define endl '\n'
#define rep(i,x,y) for(int i=x;i<=y;i++)
using namespace std;
typedef long long ll;
constexpr int maxn = 2e5+10;
constexpr ll mod = 998244353;
void solve() {
int n,m; cin >> n >> m;
// n=1
// m==1: yes
// m>=2: no
// n=2
// m<=2: yes
// m>=3: no... | ALGO | 0.999733 | 4.263312 |
856160dc-95b5-4ac6-946b-659bb8ae6637 | gromacs/gromacs | src/gromacs/linearalgebra/gmx_blas/saxpy.cpp | #include "../gmx_blas.h"
void F77_FUNC(saxpy, SAXPY)(int* n_arg, float* da_arg, float* dx, int* incx_arg, float* dy, int* incy_arg)
{
int i, ix, iy;
int n = *n_arg;
float da = *da_arg;
int incx = *incx_arg;
int incy = *incy_arg;
if (n <= 0)
return;
if (incx != 1 || in... | ALGO | 0.999029 | 4.907608 |
2475dfe5-1784-4645-bb7a-3a7aa5326915 | ajpauwels/5AxLer | libs/Cura/utils/LinearAlg2D.cpp | #include "linearAlg2D.h"
#include <cmath> // atan2
#include "intpoint.h" // dot
namespace cura
{
float LinearAlg2D::getAngleLeft(const Point& a, const Point& b, const Point& c)
{
Point ba = a - b;
Point bc = c - b;
int64_t dott = dot(ba, bc); // dot product
int64_t det = ba.X * bc.Y - ba.Y * bc.X; ... | ALGO | 0.985575 | 5.423452 |
380f3b9e-0c9c-4c21-8893-cb1c88de5a27 | rahul-goel/CompetitiveProgramming | CodeForces/A/1395 A.cpp | /*
Created by Rahul Goel.
*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
/*******************************************************************************/
using namespace std;
using namespace __gnu_pbds;
template < typename T >
using ordered_set = tree<T, n... | ALGO | 0.999958 | 4.713128 |
f510af82-07db-4b6b-a9e8-09bbafd76310 | Eeman1113/Leetcode | Problems/2956.cpp | class Solution {
public:
int numberOfSets(int n, int maxDistance, vector<vector<int>>& roads) {
const int maxMask = 1 << n;
int ans = 0;
for (int mask = 0; mask < maxMask; ++mask)
if (floydWarshall(n, maxDistance, roads, mask) <= maxDistance)
++ans;
return ans;
}
private:
// Ret... | ALGO | 0.995664 | 6.058493 |
d7889266-6810-4c70-8446-c6c66656aab0 | madMAx43v3r/mmx-node | tools/calc_test_rewards.cpp | /*
* calc_test_rewards.cpp
*
* Created on: Oct 10, 2022
* Author: mad
*/
#include <mmx/BlockHeader.hxx>
#include <mmx/Transaction.hxx>
#include <mmx/ProofOfSpaceOG.hxx>
#include <mmx/NodeClient.hxx>
#include <vnx/vnx.h>
#include <vnx/Proxy.h>
using namespace mmx;
int main(int argc, char** argv)
{
std::m... | TEST | 0.866691 | 5.147439 |
89c8a940-72d4-4d9c-9fab-f8dff0d9f514 | solthx/leetcode | my_template.cpp | # include <iostream>
# include <cstring>
# include <map>
# include <algorithm>
# include <vector>
# include <cmath>
# include <sstream>
# include <unordered_map>
# define ull unsigned long long
# define BASE 37
# define ll long long
using namespace std;
//===============tri_tree==========================
struct tri_... | ALGO | 0.999843 | 3.36764 |
148effa2-87bf-43f2-bb40-1cd15deea63a | yueshinian/clone_planning | path_planner/src/smoother.cpp | #include "smoother.h"
using namespace HybridAStar;
//###################################################
// CUSP DETECTION
//###################################################
inline bool isCusp(const std::vector<Node3D>& path, int i) {
bool revim2 = path[i - 2].getPrim() > 3 ;
... | ALGO | 0.999873 | 3.75504 |
fe39a43e-93a8-48a4-b358-62ac925a2548 | Adam-Zhou-Hust/NowCoder | 校招真题/2017网易有道内推/restoreOriginalOrderOfqueue.cpp | // 图上画出大概出队的方向,可知,先把对头放入对尾部,然后再pop出一个队头
// 那么逆序回去,也即是,先让最后出队元素,插入辅助队列的对尾部,然后把辅助队
// 的队头元素出队并放入辅助队列对尾即可
// 依次迭代,发现最后得到的序列是原始队列序列的逆序
// 最后reverse一下即可
// 关键在于数据结构的选择
// 对于输入,用栈保存
// 辅助队列用队列表示就行
// 题目思路也非常清晰,关键是先找到规律,如何逆序回去,考察逆向思维
// 时间复杂度O(n),空间复杂度也是O(n)
#include <iostream>
#include <queue>
#include <stack>
using namespa... | ALGO | 0.999991 | 5.037989 |
3db62157-db1d-436e-8fe9-09270fa6885c | BitTzy/eggsam | interpolationsearchl.cpp | #include <iostream>
#include <vector>
using namespace std;
void printInitialArray(const vector<int>& arr) {
cout << "Initial array: ";
for (int num : arr) {
cout << num << " ";
}
cout << endl;
}
void printResult(int index, int key) {
if (index != -1) {
cout << "Element " << key <<... | ALGO | 0.99998 | 6.326832 |
d9531cd5-1109-440b-bb32-6fb278159795 | Hoony0321/CodingPractice | CodingPractice/CodingPractice_2020_03_14/codeup_2020_03_14/4572_영역구하기.cpp | #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
vector<vector<int>> MAP;
vector<vector<bool>> Visited;
int row;
int column;
vector<int> result;
int area = 0;
void DFS(int y, int x, bool first) {
if (Visited[y][x]) { return; }
Visited[y][x] = true;
if (MAP[y][x] != 0) { return; }
are... | ALGO | 0.99989 | 4.533134 |
90056250-2b2a-468b-9250-3a6605410cdb | agrawal-shivani/Data-structure. | bitwise_manipulation/unique_number_two.cpp | //We are given an array containing n numbers.All the number are present twice except for two numbers which are present only once.Find the unique no in linear time without using array extra space.
#include<iostream>
using namespace std;
int main(){
int n;
cin>>n;
int a[100];
int no;
int result=0;
for (int i ... | ALGO | 0.99997 | 3.767629 |
d5e1be06-7d41-4486-a863-f4f789fcd5a1 | Shaktiswarup07/GfG | Help Classmates - GFG/help-classmates.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:
vector<int> help_classmate(vector<int> arr, int n)
{
// Your code goes here
vector<int>v;
stack<in... | ALGO | 0.999962 | 6.376975 |
a9f08fc7-c66f-47db-9bff-3b4e89877ff3 | a-hamzah/LearningC | Examples/a_Array_pg_121.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int myArray[5], i, max;
for( i = 0; i <= 4; i++){
cout << "Enter the value for myArray[" << i << "]: ";
cin >> myArray[i];
//cout << myArray[i];
}
max = myArray[0];
for (i = 1; i <= 4; i++)
{
if(myArray[i... | ALGO | 0.999362 | 3.529808 |
39f7bc69-e227-4b66-ae78-b9855fd5d4f7 | ishandutta2007/codeforces | fsouza/normal/819/B.cpp | #include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <random>
#incl... | ALGO | 0.999992 | 3.977201 |
e6dd673e-e357-4245-9b6e-405243ccc3a7 | Bayashat/My-C_Plus_Plus | 5.C++提高编程/5.算法/1.遍历/2(Transform).cpp | /* 5.1.2 transform
** 功能 : 搬运容器到另一个容器中
**函数原型: transform(iterator beg1, iterator end1, iterator beg2, _func);
//beg1 源容器开始迭代器
//end1 源容器结束迭代器
//beg2 目标容器开始迭代器
//_func 函数或者函数对象 - 仿函数
*/
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
// 仿函数-1 : 搬运仿函数
// 此仿函数的作用是 如果有必要可以做一些逻... | ALGO | 0.976778 | 4.654892 |
43fbcfb1-486c-41a9-9658-336d8512ee2c | Guminsung/Algorithm | BOJ/16464.cpp | #include <iostream>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n, k;
cin >> n;
for (int i = 0; i < n; i++)
{
cin >> k;
while (k % 2 == 0 && k != 1)
k /= 2;
if (k == 1)
cout << "GoHanG... | ALGO | 0.999971 | 4.261492 |
d4f50a35-1e36-4126-9431-8d22db0030b6 | Abhinav7076/My-Codes | LeetCode-Solutions-master/C++/group-anagrams.cpp | // Time: O(n * glogg), g is the max size of groups.
// Space: O(n)
class Solution {
public:
vector<vector<string>> groupAnagrams(vector<string>& strs) {
unordered_map<string, vector<string>> groups;
for (const auto& str : strs) {
string tmp{str};
sort(tmp.begin(), tmp.end()... | ALGO | 0.999991 | 6.935735 |
a365875a-610f-4c2e-b2ae-ba3468d69102 | TSKsteff/Algoritmo_Volume_1 | C++_Basico/VTR17º/main.cpp | #include <iostream>
using namespace std;
int main()
{
int vtr[5],cont=0;
cout << " preencha o vetor " << endl;
for (int i=0; i<=4; i++){
cin>> vtr[i];
if (vtr[i]%2==0){
cont = cont +1;
}
for (int i=0; i<=4; i++){
cout << "vtr";
cout << vtr[i];
... | ALGO | 0.994339 | 4.323691 |
745f546a-ec2e-4cfc-8403-2fa2512169e0 | Jie-wen-x/hello_arithmetic | codes/cpp/chapter_stack_and_queue/linkedlist_deque.cpp | /**
* File: linkedlist_deque.cpp
* Created Time: 2023-03-02
* Author: krahets (<EMAIL>)
*/
#include "../utils/common.hpp"
/* 双向链表节点 */
struct DoublyListNode {
int val; // 节点值
DoublyListNode *next; // 后继节点指针
DoublyListNode *prev; // 前驱节点指针
DoublyListNode(int val) : val(val), prev(nullp... | ALGO | 0.999111 | 6.074214 |
62446b21-9e2d-411c-8e66-82361b0bb1f7 | anand-kumar007/Coding_in_Cplusplus | 18_Binary_search/2_AllocateMinPages.cpp |
/*
Given number of pages in n different books and m students. The books are arranged in ascending order of number of pages. Every student is assigned to read some consecutive books. The task is to assign books in such a way that the maximum number of pages assigned to a student is minimum.
how to check if a mid val... | ALGO | 0.999984 | 5.479085 |
bfa48134-50dd-41bf-8285-641120250532 | RakeshAnnareddy/Data-Structures-Programs | AVLTree.cpp | #include <iostream>
#include <fstream>
using namespace std;
// Node structure for AVL Tree
struct Node {
int key;
Node* left;
Node* right;
int height;
};
// Function to get the height of the tree
int height(Node* N) {
if (N == NULL)
return 0;
return N->height;
}
// Utility function to ... | ALGO | 0.999976 | 6.261411 |
6118d16c-3d87-47bf-b381-ad89b8c51d72 | nguyenhuudatcoder/THPTChuyenNTUCoder | FOOD.cpp | #include<bits/stdc++.h>
#define int long long
using namespace std;
int n,a,b,c;
main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin>>n>>a>>b>>c;
cout<<abs(n-a-b-c);
} | ALGO | 0.999684 | 3.501511 |
e700ceb1-0e79-4b5b-b1cf-95bed7302c66 | Bastow2000/Thunder-Generation | Source/SubModules/Strike.cpp | #include "Strike.h"
// Default constructor
Strike::Strike() :
AudioEffects(*(new juce::AudioBuffer<float>()), 0.0, 0, 0),
bufferSize_(0),
numChannels_(0),
numSamples_(0),
filterOrder_(0),
fftOrder_(0),
frequencyCutoff_(0),
isFiltering_(false),
buffer_(*(new juce::AudioBuffer<float>(... | TOOL | 0.884297 | 6.597668 |
7b596a87-bbd1-4d2d-b055-c34466ba394f | joshiishaan007/LeetCode | 2271-rearrange-array-elements-by-sign/rearrange-array-elements-by-sign.cpp | class Solution {
public:
vector<int> rearrangeArray(vector<int>& nums) {
vector<int> positiveNums;
vector<int> negativeNums;
for(int n : nums){
if(n>=0)
positiveNums.push_back(n);
else
negativeNums.push_back(n);
}
... | ALGO | 0.999913 | 5.605604 |
260496d1-6666-4537-bf32-16014cc6590d | reductant01/data-structures | 5장/진행상황.cpp | #include <iostream>
#include <cstdlib> // 난수 생성에 필요한 헤더
#include <ctime> // 난수 시드 초기화에 필요한 헤더
using namespace std;
const int HeapSize = 1000;
enum Boolean { FALSE, TRUE };
template <class Type>
class Element {
public:
Type key;
Element() {}
Element(Type key) :key(key) {}
};
template <class Type>
class MaxPQ {
p... | ALGO | 0.999444 | 4.862306 |
8dc6037d-2e57-42c0-ac23-2dd55e7c85f7 | raincross7/code-similarity | codes/train_code/problem147/problem147_484.cpp | #include <cstdio>
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#define MIN_INT -2147483648
#define MAX_INT 2147483647
#define MIN_LONG -9223372036854775808L
#define MAX_LONG 9223372036854775807L
#define PI 3.141592653589793238462643383279502884L
#define l... | ALGO | 0.999785 | 4.398049 |
96e7504e-9597-43dc-95c5-8ad823e7a05d | jiho7407/PS | BaekJoon/Morgorithm_Daily/2024-M4/0420/16940.cpp | #include <bits/stdc++.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
using namespace std;
typedef pair<int, int> pii;
void fastio(){
cin.tie(0);
cout.tie(0);
ios_base::sync_with_stdio(false);
}
int N;
vector<int> links[100001];
int order[100001];
queue<int> q;
void solve(){
cin >> ... | ALGO | 0.999989 | 4.215997 |
853397fe-9f4a-4a3d-923b-fd5028352c5f | rahadiankp/JOJ-latihan | punishpanda1.cpp | #include<iostream>
using namespace std;
int main() {
int T;
cin>>T;
for(int i=1; i<=T; i++) {
int N, K;
cin>>N>>K;
cout<< "Case #" << i << ": " << ((K+N)/N)+(K%N) << endl;
}
return 0;
}
| ALGO | 0.997544 | 4.217867 |
8a7e215f-d4de-48c7-8288-918513def687 | subhcodes/90daysofdsa | duplicateelement.cpp | #include<iostream>
using namespace std;
int findDuplicate(vector<int> &arr)
{
int ans = 0;
//XORing all array elements
for (int i = 0; i < arr.size(); i++)
{
ans = ans ^ arr[i];
}
//XOR [1,n-1]
for (int i = 1; i < arr.size(); i++)
{
ans = ans ^ i;
}
return ans... | ALGO | 0.999526 | 4.945575 |
372ac374-efc6-4354-bd2f-05ae8e0e9333 | Manavdandiwal/30Days6Companies | Total_Decoding_messages.cpp | /*
A top secret message containing letters from A-Z is being encoded to numbers using the following mapping:
'A' -> 1
'B' -> 2
...
'Z' -> 26
You are an FBI agent. You have to determine the total number of ways that message can be decoded, as the answer can be large return the answer modulo 109 + 7.
Note: An empty digi... | ALGO | 0.999959 | 6.163333 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.