uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
2f264b24-a1ca-4bcb-b7e5-2b0cb7c21240 | ishandutta2007/codeforces | huangxiaohua/normal/1520/F2.cpp | #include <bits/stdc++.h>
using namespace std;
int i,j,n,m,a[200500],t,k,mp[200500];
void add(int x){for(;x<=n;x+=(-x&x)){a[x]++;}}
int get(int x){int res=0;for(;x;x-=(-x&x)){res+=a[x];}return res;}
int ask(int x){
int res;if(mp[x]!=-1){return mp[x]+get(x);}printf("? 1 %d\n",x);fflush(stdout);
scanf("%d",&res);mp[x]=... | ALGO | 0.999958 | 3.219956 |
10243371-11e1-409b-818b-6522ba58f160 | shawon39/DS-and-Algorithm-Recent | Data Structure/Graph/0-1 BFS.cpp | #include <bits/stdc++.h>
using namespace std;
// node maximum = 100
int n,e,start;
vector< pair<int,int> >edges[100];
int dist[100];
int zeroOneBFS(int s)
{
for(int i=1; i<=n; i++) {
dist[i] = INT_MAX;
}
deque <int> Q;
Q.push_back(s);
dist[s] = 0;
while( !Q.empty() )
{
i... | ALGO | 0.999959 | 3.899536 |
3c926beb-a3cb-47f1-a238-2da66fe90dcc | dementrock/acm | poj/Archives/new/7070532_AC_172MS_840K.cpp | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
struct sbt
{
int l,r,s,w;
} t[30001];
int tot,root,m,n,a[30001]={},b[30001]={};
void rightrotate(int &k)
{
int p=t[k].l;
t[k].l=t[p].r;
t[p].r=k;
t[p].s=t[k].s;
t[k].s=t[t[k].l].s+t[t[k].r].s+1;
k=p;
}
void leftrotate(int &k)
{
int p=t[k].r;
t[k].r=t[p].l... | ALGO | 0.999999 | 3.500652 |
537c20c4-fb50-4d64-b369-10b1a54c07f1 | sheshanathkumar/coding | aaaaaaaa.cpp | #include<bits/stdc++.h>
using namespace std;
bool canRepresentBST(int pre[], int n)
{
stack<int> s;
int root = INT_MIN;
for (int i=0; i<n; i++)
{
if (pre[i] < root)
return false;
while (!s.empty() && s.top()<pre[i])
{
root = s.top();
s.pop();
... | ALGO | 0.999978 | 4.237499 |
821484da-1b6e-4a71-b19d-706bbbc501ff | Ark-Aak/code_repo | 2024-11-18/barry.cpp | #include <bits/stdc++.h>
#define y1 __arknights
#define rep(i, a, b) for(int i = (a), i##end = (b); i <= i##end; i++)
#define _rep(i, a, b) for(int i = (a), i##end = (b); i >= i##end; i--)
#define ec first
#define fb second
#define dl make_pair
#define dk(...) make_tuple(__VA_ARGS__)
#define de(val) cerr << #val << "... | ALGO | 0.999946 | 3.96002 |
1b0d911e-6730-41c4-babd-e62bcb5b6121 | MijaTola/Codeforce | 707.cpp | #include <iostream>
#include <algorithm>
#include <queue>
#include <stack>
#include <vector>
#include <climits>
#include <map>
#include <set>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <deque>
#include <string>
#include <sstream>
#include <cstdlib>
using namespace std;
typedef ... | ALGO | 0.998862 | 3.972821 |
a436404f-deb2-4cf1-865a-2de10def57ca | DLR-SE/llvm | libcxx/benchmarks/algorithms/lower_bound.bench.cpp | #include <algorithm>
#include <numeric>
#include <random>
#include <vector>
#include "common.h"
namespace {
template <class ValueType>
struct LowerBound {
size_t Quantity;
mutable std::mt19937_64 rng { std::random_device{}() };
void run(benchmark::State& state) const {
runOpOnCopies<ValueType>(state, Quan... | TEST | 0.984332 | 5.404838 |
3925cac5-f697-493e-8509-0e501f37dbac | Ananya150204/Competitive-Programming | Striver/Implementation/Numbers_on_Whiteboard.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int t;
cin >> t;
while (t--){
int n;
cin >> n;
priority_queue<int> pq;
for (int i = 1; i <= n; i++){
pq.push(i);
}
cout << 2 << endl;
while (pq.size() > 1){
int first = p... | ALGO | 0.999915 | 3.7142 |
8c1aa98d-c83c-4c1c-b65d-5559f18ef564 | INHA-CTP/Problem_Solution | BOJ/1000~10000/2455/2455_지능형 기차.cpp | /*
author: Hyeoung Dong, Choi
date: 19.04.04
*/
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int A;
int B;
int result;
vector<int> k;
vector<int> ::iterator P;
int main()
{
for (int i = 0; i < 4; i++)
{
cin >> A >> B;
result += (B - A);
k.push_back(result);
}
sort(k.be... | ALGO | 0.999842 | 3.528698 |
f5a609bc-a94c-4865-b8ed-0f6fda33bc12 | polla-fattah/Collection-of-transformations | FAST/FAST1/FFT.CPP | #include <iostream.h>
struct comp
{
double real;
double imag;
};
//Operations
comp add(comp &num1,comp &num2)
{
comp temp;
temp.real=num2.real + num1.real;
temp.imag=num2.imag + num1.imag;
return temp;
}
comp multiply(comp num1,comp num2)
{
comp temp;
temp.real = num1.real * num2.real - num1.imag * num2.imag;
... | ALGO | 0.999643 | 3.471526 |
714c424d-96a1-41c7-943e-97141c709bc3 | scarpma/cpp_tutorial | class/constructorAndOperators/sol.cpp | #include <iostream>
#include <ostream>
using namespace std;
//Implement the class Box
//l,b,h are integers representing the dimensions of the box
// The class should have the following functions :
// Constructors:
// Box();
// Box(int,int,int);
// Box(Box);
// int getLength(); // Return box's length
// int getB... | ALGO | 0.994778 | 3.544079 |
8a26c7ab-9c09-4e74-9ffb-b6865f40bff5 | lhy-loveworld/LeetCode | 6_String/#657_JudgeRouteCircle.cpp | //#657. Judge Route Circle
//Medium
//Method:
//Complexity: Time O(N); Space O(1)
class Solution {
public:
bool judgeCircle(string moves) {
int hor = 0, ver = 0;
for (char c: moves) {
switch (c) {
case 'R':
hor++;
break;
... | ALGO | 0.99988 | 5.947011 |
eea44903-0bae-4d8c-ad64-b44eae6899b9 | screenovate/android-platform-frameworks-base | libs/hwui/ClipArea.cpp | #include "ClipArea.h"
#include "utils/LinearAllocator.h"
#include <SkPath.h>
#include <limits>
#include <type_traits>
namespace android {
namespace uirenderer {
static void handlePoint(Rect& transformedBounds, const Matrix4& transform, float x, float y) {
Vertex v = {x, y};
transform.mapPoint(v.x, v.y);
... | TOOL | 0.949655 | 7.184197 |
70a6e8a9-673d-43a1-ad06-7b5f8c38d468 | 7yzx/Hislam2_depth | thirdparty/eigen/bench/benchmarkX.cpp | // g++ -fopenmp -I .. -O3 -DNDEBUG -finline-limit=1000 benchmarkX.cpp -o b && time ./b
#include <iostream>
#include <Eigen/Core>
using namespace std;
using namespace Eigen;
#ifndef MATTYPE
#define MATTYPE MatrixXLd
#endif
#ifndef MATSIZE
#define MATSIZE 400
#endif
#ifndef REPEAT
#define REPEAT 100
#endif
int mai... | ALGO | 0.965638 | 3.371454 |
689943dd-223e-4bff-a55c-903928c5bcb4 | luismoax/Competitive-Programming---luismo | COJ_ACCEPTED/3743 - Anders Is Full Of Graphs.cpp | /*
Author: Luis Manuel Daz Barn (LUISMO)
Problem: 3743 - Anders Is Full Of Graphs
Online Judge: COJ
Idea: Combinatorics. Solution = SUM from i = 0 -> N - 2: P(N - 2, i) * i!
Solved using Dynamic Programming dp[i] = 1 + (i - 2) + (i - 2)*(i - 3)*dp[i - 2]
*/
#include<bits/stdc++.h>
// Types
#define ll long long
#de... | ALGO | 0.99991 | 4.302488 |
d5be392c-a7db-4b1a-a6e9-fed790cd4ebe | Richard-m-j/LeetCode | 108-convert-sorted-array-to-binary-search-tree/convert-sorted-array-to-binary-search-tree.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.999997 | 6.914642 |
dd8229d2-944d-45e3-b73d-97bec793c277 | jiangyc2024/NumCSE | Assignments/PolishedCodes/LeastSquares/SPAI/solution/main.cpp | #include <Eigen/Core>
#include <Eigen/SparseCore>
#include <iomanip>
#include <iostream>
#include "spai.hpp"
int main() {
std::cout
<< "Type 0 if you want to test spai(), 1 if you want to see the table of "
"needed iterations for CG w/ or w/out preconditioner.\n";
unsigned int input;
std::cin >> ... | ALGO | 0.982782 | 4.702873 |
551478f7-c623-4f6d-95d7-b079b346985e | zsx0728/UNIX-Network-Programming | algorithm_note_p95.cpp | #include <stdio.h>
#include <string.h>
const int maxn = 256;
bool judge(char str[])
{
int len = strlen(str);
for (int i = 0; i < len / 2; i++)
{
if (str[i] != str[len - 1 - i])
{
return false;
}
}
return true;
}
int main(void)
{
char str[maxn];
while(gets(str))
{
bool flag = judge(str);
if (flag ... | ALGO | 0.999963 | 3.415259 |
418e064a-e12e-4bb8-9746-8472e3585140 | ishandutta2007/codeforces | fishcathu/normal/1677/C.cpp | #include<bits/stdc++.h>
#define ls i<<1
#define rs i<<1|1
#define fi first
#define se second
#define min amin
#define max amax
#define pb push_back
using namespace std;
using ll=long long;
using pii=array<int,2>;
const int N=1E5+10;
const int inf=1E9;
template<typename T=int>T read(){T x;cin>>x;return x;}
template<type... | ALGO | 0.999365 | 3.683251 |
e94de143-bd9b-4411-8fa6-80644a1cffa5 | 0-jij-0/CompetitiveProgramming | Problems Archive/0000 - 0999/0843 - Mr. Kitayuta's Gift.cpp | #include <iostream>
#include <string>
using namespace std;
bool isPalindrome(string &s, int i, int j) {
while (i < j) if (s[i++] != s[j--]) return false;
return true;
}
bool makePalindrome(string &s) {
int i = 0, j = (int)s.size() - 1;
while (i < j) {
if (s[i] == s[j]) { i++; j--; continue; }
if (isPalindrome... | ALGO | 0.999708 | 5.811393 |
61382580-9433-4051-8f7f-a27009776b86 | rtama/6.837 | pset2/starter2/3rd_party/nanogui/ext/eigen/doc/examples/tut_matrix_coefficient_accessors.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace Eigen;
int main()
{
MatrixXd m(2,2);
m(0,0) = 3;
m(1,0) = 2.5;
m(0,1) = -1;
m(1,1) = m(1,0) + m(0,1);
std::cout << "Here is the matrix m:\n" << m << std::endl;
VectorXd v(2);
v(0) = 4;
v(1) = v(0) - 1;
std::cout << "Here is the vector v:\n... | ALGO | 0.998002 | 3.687909 |
85a7c281-b173-4adf-b189-50d56e661727 | jasonzliang/scalableMLAssignments | hw5/Galois-2.2.1/apps/betweennesscentrality/BetweennessCentralityOuter.cpp | /** Betweenness centrality application -*- C++ -*-
* @file
* @section License
*
* Galois, a framework to exploit amorphous data-parallelism in irregular
* programs.
*
* Copyright (C) 2013, The University of Texas at Austin. All rights reserved.
* UNIVERSITY EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES CONCERNING ... | ALGO | 0.997244 | 5.951808 |
cdc64672-c06b-4082-ac28-71f042d8f16a | reeWorlds/TicTacToe_TestingRL | TicTacToe_algorithms/TicTacToe_algorithms/QLearningPlayer.cpp | QLearningPlayer::QNode::QNode()
{
for (int i = 0; i < 9; i++)
{
a[i] = 0.0f;
}
}
QLearningPlayer::QLearningPlayer() : rng(chrono::high_resolution_clock::now().time_since_epoch().count())
{
Q = nullptr;
}
QLearningPlayer::~QLearningPlayer()
{
if (Q != nullptr)
{
delete[] Q;
}
}
void QLearningPlayer::readQ(... | ALGO | 0.949217 | 4.043571 |
c93cf9d3-ec64-43a4-bdb5-1800af1c92d0 | rafaelGuasselli/exercicios | judges/codeforces/gym/sbc-2025-0/b.cpp | #include <bits/stdc++.h>
using namespace std;
class OnlineKMP {
public:
string s;
int pi[100005];
int prev[100005][30];
OnlineKMP() {
s.clear();
memset(pi, 0, sizeof(int) * 100005);
for (int i = 0; i < 100005; i++) {
memset(prev[i], -1, sizeof(int) * 30);
}
}
void addChar(char c) {
int newChar = c... | ALGO | 0.999922 | 4.028504 |
226c6265-25df-4747-b1c0-e11c6e1f07ec | Aty-0/S2DE | Libs/boost_1_76_0/libs/geometry/doc/src/examples/algorithms/simplify_insert.cpp | // Boost.Geometry (aka GGL, Generic Geometry Library)
// QuickBook Example
//[simplify_inserter
//` Simplify a linestring using a back inserter
#include <iostream>
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/linestring.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
int main()
{
typ... | ALGO | 0.997348 | 7.542669 |
03228f59-09eb-49cf-b06a-bdc5243366d1 | wotkddl21/2020-Longwood-University | cryptography/lab1/affine.cpp | #include<iostream>
#include<string>
using namespace std;
int inverse[26]={0,1,0,9,0,21,0,15,0,3,0,19,0,0,0,7,0,23,0,11,0,5,0,17,0,25};
bool a_inverse[26]={0,1,0,1,0,1,0,1,0,1,0,1,0,0,0,1,0,1,0,1,0,1,0,1,0,1};
void decrypt(string);
bool CheckE(string);
bool CheckTAOINSHR(string);
char affine(int,int,char);
int main(... | ALGO | 0.999781 | 4.347116 |
274efb5e-df7c-4360-b123-46462766a08f | ishandutta2007/codeforces | risujiroh/normal/1394/C.cpp | #include <bits/extc++.h>
using namespace std;
template <class T> constexpr T inf = numeric_limits<T>::max() / 2.1;
auto chmin = [](auto&& a, auto b) { return b < a ? a = b, 1 : 0; };
auto chmax = [](auto&& a, auto b) { return a < b ? a = b, 1 : 0; };
int main() {
cin.tie(nullptr)->sync_with_stdio(false);
int n;
... | ALGO | 0.999936 | 5.816038 |
402c6c20-9020-4179-8eb5-74727ba0a6a8 | YooJaeJun/PS-Algorithm- | 프로그래머스/lv0/120897. 약수 구하기/약수 구하기.cpp | #include <string>
#include <vector>
#include <algorithm>
using namespace std;
vector<int> solution(int n) {
vector<int> answer;
for (int i=1; i<=n; i++)
{
if (n % i == 0)
{
answer.push_back(i);
}
}
return answer;
} | ALGO | 0.999624 | 5.640324 |
92046211-6c4f-49b7-9141-eef950c7ce28 | ishandutta2007/codeforces | i_love_tanya_romanova/normal/702/A.cpp | /*
I bear the seed of ruin
A golden age turned to stone
Elysium... to dust
For this, a tragic journey
A vision of a dying embrace
Scattered earth
Silence...
Where Echonia wept
I sank into the silent desert
Fallen am I,
In the solitude of a broken promise
...I cried alone
My empyrean is a scar
From the memory of her ... | ALGO | 0.9999 | 3.700005 |
d05134e0-6edf-4761-ae89-834e5c696562 | JCGit/cgame | client/frameworks/cocos2d-x/cocos/math/Quaternion.cpp | #include "Quaternion.h"
#include "base/ccMacros.h"
NS_CC_MATH_BEGIN
const Quaternion Quaternion::ZERO(0.0f, 0.0f, 0.0f, 0.0f);
Quaternion::Quaternion()
: x(0.0f), y(0.0f), z(0.0f), w(1.0f)
{
}
Quaternion::Quaternion(float xx, float yy, float zz, float ww)
: x(xx), y(yy), z(zz), w(ww)
{
}
Quaternion::Quater... | ALGO | 0.912657 | 7.359225 |
7d7a82f9-73ae-4d50-963e-a6679e4c96dd | CanhForresten/Eksamen | ReEksamen_sommeren_2024/Opgave2/Opgave2.cpp | using namespace std;
#include<iostream>
#include"functions.h"
int main()
{
//Opgave 2 c-1)
double measurements [] = {3.9,4.8,2.9,9.3,5.3,6.2};
size_t size = 6;
double min;
double max;
minmax(measurements, size, &min, &max);
//Opgave 2 c-2)
cout << "Min værdi er " << min << endl;
//Opgave 2 c-3)
cout << "Max... | ALGO | 0.975314 | 4.259194 |
2c22f9af-a435-42fc-b6e3-615c3b5675ca | lzyrapx/Codeforces | 23B(关系转化成图).cpp | the answer is not more than N-2. We'll prove that it's possible for N-2 people to stay (of course, if N>1).
The graph of friendship will be the following: take a complete graph on N vertices and delete one edge.
Then the degrees of two vertices equal N-2, and other degrees equal N-1. After the first two vertices are ... | ALGO | 0.999894 | 4.822892 |
14854d89-1372-4b76-b5c3-947151f3f26d | ishandutta2007/codeforces | flashmt/normal/1055/A.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n, s, a[2][1010];
cin >> n >> s;
for (int i = 0; i < 2; i++)
for (int j = 1; j <= n; j++)
cin >> a[i][j];
if (!a[0][1]) cout << "NO";
else if (a[0][s]) cout << "YES";
else
{
for (int i = s + 1; i <= n; i++)
if (a[0][i] &&... | ALGO | 0.999968 | 3.114446 |
0fd345c0-04cb-41b5-abe3-7c9b45406afc | sm4j/datastructs | Sort CPP/MergeSort.cpp |
#include <iostream>
#include <vector>
using namespace std;
// Function to merge two sorted arrays and return the merged sorted array
vector<int> merge(const vector<int>& left, const vector<int>& right) {
vector<int> merged;
size_t i = 0, j = 0;
// Merge sorted a... | ALGO | 0.999999 | 6.543657 |
e0e664a0-121e-4d22-875a-fb46a5f2002b | PaddyWan/gamelauncher | src/arg.cpp | #include "arg.hpp"
#include <algorithm>
#include <iostream>
#include <fstream>
#include <filesystem>
#include <string>
#include <vector>
#include <libxdgbasedir/libxdgbasedir.h>
using std::string;
using std::vector;
using std::string_view;
void print_usage(const char* name)
{
std::cout << "usage: " << name << "... | TOOL | 0.904483 | 4.200673 |
dc435903-2f9d-479d-98d7-401d6a6a92d6 | FFMG/myoddweb.piger | myodd/boost/libs/thread/example/shared_mutex.cpp | #define BOOST_THREAD_PROVIDES_SHARED_MUTEX_UPWARDS_CONVERSIONS
#define BOOST_THREAD_PROVIDES_EXPLICIT_LOCK_CONVERSION
#define BOOST_THREAD_PROVIDES_GENERIC_SHARED_MUTEX_ON_WIN
#include <iostream>
#include <boost/thread/mutex.hpp>
#include <boost/thread/shared_mutex.hpp>
#include <boost/thread/lock_algorithms.hpp>
#inc... | TEST | 0.986093 | 7.350971 |
2d8b6931-003b-480a-a61f-d3542dce9b1a | raincross7/code-similarity | codes/train_code/problem051/problem051_112.cpp | #include <iostream>
using namespace std;
signed main() {
int a, b, c; cin >> a >> b >> c;
cout << (a == b && b == c ? "Yes\n" : "No\n");
} | ALGO | 0.999961 | 4.260196 |
cd99349a-ba1d-4421-b0be-3f665344e84c | ishandutta2007/codeforces | peti1234/normal/722/D.cpp | #include <bits/stdc++.h>
using namespace std;
set<int,greater<int>> t;
int n;
int k=1;
int main()
{
cin >> n;
for (int i=1; i<=n; i++) {
int x;
cin >> x;
t.insert(x);
}
while (k!=0) {
k=*t.begin();
while (t.find(k)!=t.end()) {
k=k/2;
}
... | ALGO | 0.999983 | 4.083491 |
df70ec8d-1d8a-4531-8fe6-96f6cf6122a4 | xyzyzl/compprog | probs/cf/round649/a.cpp | // Time:
// Algorithms:
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
#define MAXN 1000005
#define FOR(i, n) for (int i = 0; i < n; i++)
#define FORR(j, i, n) for (int i = j; i < n; i++)
#define FORD(i, n) for (int i = n - 1; i >= 0; i--)
#define F1R(i, n) for (int i = 1; i <= n; i++)
#d... | ALGO | 0.999842 | 4.309628 |
96a4c207-d3ed-442f-ad78-2b3029df3eff | Vidit-Ostwal-zz/DSA-Codes | 94-binary-tree-inorder-traversal/94-binary-tree-inorder-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.999989 | 6.365944 |
a549b11e-31f0-4f20-9122-664ca2c3697a | meteoralpha23/Outscal_Assignments | NextGreaterElement.cpp | #include <iostream>
#include <stack>
using namespace std;
void nextGreaterElement(int nums1[], int nums1Size, int nums2[], int nums2Size, int result[]) {
int nextGreater[nums2Size];
stack<int> s;
for (int i = nums2Size - 1; i >= 0; --i) {
while (!s.empty() && s.top() <= nums2[i]) {
s... | ALGO | 0.999944 | 5.81158 |
f4f7650b-1f96-4579-b28a-17408cd4d839 | hhaminlee/24-PPS-Camp | week1/A017_이하민_20240705.cpp | #include <cmath>
#include <iostream>
using namespace std;
int main() {
string roomNum;
int max = 0;
cin >> roomNum;
int num[10] = {
0,
};
for (int i = 0; i < roomNum.length(); i++) {
num[roomNum[i] - '0']++;
}
num[6] = ceil((num[6] + num[9]) / 2.0);
num[9] = 0;
f... | ALGO | 0.99601 | 3.952724 |
89731647-10c7-415c-9455-d93e6801d20b | samuelloza/notas_uni | Programacion Competitiva/SemilleroProgramacion/Manual/src/ordenamiento_topologico.cpp | vector <int> g[MAXN]; // La lista de adyacencia
bool seen[MAXN]; // El arreglo de visitados para el dfs
vector <int> topo_sort; // El vector del ordemamiento
void dfs(int u){
seen[u] = true;
for (int i = 0; i < g[u].size(); ++i){
int v = g[u][i];
if (!seen[v]) dfs(v);
}
topo_sort.pu... | ALGO | 0.999904 | 4.638138 |
c4252d91-9d8b-496a-9e30-af19778d0585 | AshishPal8/DSA | 3.Hashing/hashing.cpp | #include <iostream>
#include <map>
using namespace std;
int main()
{
int n;
cin >> n;
int arr[n];
for (int i = 0; i < n; i++)
{
cin >> arr[i];
}
map<int, int> mpp;
for (int i = 0; i < n; i++)
{
mpp[arr[i]++];
}
int q;
cin >> q;
while (q--)
{
... | ALGO | 0.999889 | 4.642077 |
c3ee1f7a-f948-4505-b90e-454757a60860 | harsimran01099/Data-structure | recurssion_linklist_reverse.cpp | #include<stdio.h>
#include<conio.h>
#include<iostream>
using namespace std;
struct Node{
int data;
Node* next;
};
Node* head ;
void insert(int x,int y)
{
Node* temp =new Node();
temp->data=x;
temp->next=0;
if(y==1)
{
temp->next=head;
head=temp;
return;
}
Node* temp2 =head;
for(int i=0;i<y-2;i++)
{
... | ALGO | 0.999926 | 3.685496 |
2ae21b3f-fb84-4cf4-8f6d-a1ccbf4ebb96 | Shell-Wataru/AtCoder | Codeforces/ECR074/B.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <queue>
#include <set>
#include <iomanip>
#include <cmath>
#include <map>
using namespace std;
using ll = long long;
ll BASE_NUM = 1000000007;
void solve(){
ll n,r;
set<ll,greater<ll>> X;
cin >> n >> r;
for(int i = 0;i... | ALGO | 0.999933 | 3.415642 |
7f1dfecf-dc4a-42a7-9ad5-fe739aa7a022 | jalad-shrimali/Streak_2k23 | leetcode 377.cpp | class Solution(object):
def combinationSum4(self, nums, target):
dp = [0] * (target+1)
dp[0] = 1
for i in range(1, target + 1):
# update dp[i]
for d in nums:
if i >= d: dp[i] += dp[i-d]
return dp[target]
| ALGO | 0.999939 | 6.074372 |
b00426ad-3d38-4f93-929f-fb6fbfb21029 | Pallabch/DSA | DSAEssentialsCpp/Backtracking/StringPermutations.cpp | #include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <unordered_map>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> p32;
typedef pair<ll, ll> p64;
typedef pair<double, double> pdd;
typedef vector<ll> v64;
typedef vector<int> v32;
typedef vecto... | ALGO | 0.999932 | 4.317074 |
14b659ec-26de-400e-93d5-943575c3d4a9 | chalearn/missing-causal-relation | src/matlab/libs/CLOP/challenge_objects/clust/MixModels/libemBinomial.cpp | /* $Revision: 1.5 $ */
#include <mex.h>
#include <assert.h>
#include "mexarg.h"
#include "em.h"
//This is for BINOMIAL MIXTURES
//we need two inputs i.e. the number of mixtures and the input array
//we will output the probabilities and the priors of each mixture
//so we have two inputs first is a scalar
//the other ... | ALGO | 0.999517 | 3.994674 |
993032db-de65-487d-92d8-2c48940079b1 | ishandutta2007/codeforces | z18/normal/468/E.cpp | #include <bits/stdc++.h>
using namespace std;
typedef double db;
const int maxn = 1e5, maxk = 100, mod = 1e9 + 7;
int n, m, k, u[maxk + 3], v[maxk + 3], w[maxk + 3], cnt1, cnt2, id1[maxn + 3], id2[maxn + 3];
int f[maxk + 3], g[maxk + 3], c[maxk + 3], cnt[maxk + 3][maxk + 3], num[maxk + 3][maxk + 3], fact[maxn + 3];
bo... | ALGO | 0.999969 | 3.983548 |
411db656-3b3c-479c-b175-2c5f15416fdc | ishandutta2007/codeforces | bohun/normal/1634/B.cpp | #include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define per(i, a, b) for (int i = b; i >= a; i--)
#define cat(x) cerr << #x << " = " << x << endl
using ll = long long;
using namespace std;
ll t, n, x, y;
int main() {
cin.tie(0)->sync_with_stdio(0);
cin >> t;
while (t--) {
cin >> n >>... | ALGO | 0.999956 | 4.019667 |
d12f768b-f979-435a-a734-f42f4418b02c | Masuma-Afroz-Juthi/Tools-for-learning-DSA | 2_Data_Structure_And_Algorithm/15_DynamicProgramming/68_Max_Height_Cuboid_Mem.cpp | #include "iostream"
#include "algorithm"
#include "vector"
using namespace std;
bool check(vector<int> base,vector<int> newBox){
return (base[0] >= newBox[0]) && (base[1] >= newBox[1]) && (base[2] >= newBox[2]);
}
int solve(vector<vector<int>>& cuboids,int curr,int prev,vector<vector<int>> &dp) {
if(curr == ... | ALGO | 0.999362 | 5.062445 |
1a9a05da-2756-482a-9183-57331683301c | Practice3DVision/SLMaster | gui/thirdParty/FluentUI/zxing-cpp/core/src/pdf417/PDFDetector.cpp | #include "PDFDetector.h"
#include "BinaryBitmap.h"
#include "BitMatrix.h"
#include "ZXNullable.h"
#include "Pattern.h"
#include <algorithm>
#include <array>
#include <cstdlib>
#include <limits>
#include <list>
#include <vector>
namespace ZXing {
namespace Pdf417 {
static const int INDEXES_START_PATTERN[] = { 0, 4, 1... | ALGO | 0.995478 | 7.360814 |
118a35fa-713e-4700-836e-dec68c57f630 | goodstudyqaq/ACM | codeforces/1600-1699/1679/F.cpp | #include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "copypaste/debug.h"
#else
#define debug(...) 42
#endif
#define endl '\n'
typedef long long ll;
struct fast_ios {
fast_ios() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
cout << fixed << setprecision(10);
};
} fas... | ALGO | 0.99977 | 4.810906 |
589ddc46-c24d-44ea-bcf3-652e85c122b5 | u-t-autonomous/PX4_ROS_packages | min_snap/src/optimization.cpp | #include "stdafx.h"
#include "optimization.h"
// disable some irrelevant warnings
#if (AE_COMPILER==AE_MSVC)
#pragma warning(disable:4100)
#pragma warning(disable:4127)
#pragma warning(disable:4702)
#pragma warning(disable:4996)
#endif
using namespace std;
/////////////////////////////////////////////////////////////... | ALGO | 0.999103 | 6.933973 |
73c57426-1b1e-464d-9b08-6dd97c44fb88 | githubweek1/DSA | Mathematics/factorial.cpp | // C++ program to calculate factorial of a number
#include <iostream>
using namespace std;
// function prototype
int factorial(int n);
// main function
int main() {
int n;
cout << "n: ";
cin >> n;
cout << "Factorial: " << factorial(n) << endl;
}
// function to calculate factorial of a number
int fa... | ALGO | 0.99972 | 5.331131 |
f31ffb27-72ff-4dc0-b015-24e75c1ea839 | satishrdd/comp-coding | spoj/SCPC11B-16083007-src.cpp | #include <iostream>
#include<algorithm>
using namespace std;
int main() {
// your code here
int n;
while(true){
cin>>n;
if(n==0){
break;
}else{
int ar[n];
int br[n-1];
int flag = 1;
for(int i=0;i<n;i++){
cin>>ar[i];
}
sort(ar,ar+n);
for(int i =0;i<n-1;i++){
br[i] = ar[i+1... | ALGO | 0.998851 | 3.673796 |
0ea9ced0-fa66-4819-8980-d52763452023 | 21A91A05G9/GFG | Easy/Recursive sequence/recursive-sequence.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:
long long int m=1e9+7;
long long findSeq(int i,int cnt,int n){
if(cnt>n) return 0;
long long int s=1,temp=cnt;
... | ALGO | 0.999965 | 6.12453 |
3908e724-554a-4890-9d4c-e51b579c5157 | Hyp3R0d/AlgorithmCompetition | 动态规划/线性dp/题目/ACW5.cpp | #include<bits/extc++.h>
using i8 = signed char;
using u8 = unsigned char;
using i16 = signed short int;
using u16 = unsigned short int;
using i32 = signed int;
using u32 = unsigned int;
using f32 = float;
using i64 = signed long long;
using u64 = unsigned long long;
using f64 = double;
using i128 = __int128_t;
using u... | ALGO | 0.999849 | 4.583057 |
96813b6f-b7c1-4915-a85d-367bfb424b83 | TodorokiKohei/atcoder | 2020_08/17/kuzikatu/d.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, a, b) for(int i = a; i < b; i++)
#define all(x) (x).begin(),(x).end() // 昇順ソート
#define rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
ty... | ALGO | 0.999924 | 3.517239 |
f6e09a96-28c2-4d4c-9870-b873e171523e | gem5/gem5 | ext/systemc/src/sysc/datatypes/fx/scfx_pow10.cpp | /*****************************************************************************
scfx_pow10.cpp -
Original Author: Robert Graulich, Synopsys, Inc.
Martin Janssen, Synopsys, Inc.
*****************************************************************************/
/**********************************... | ALGO | 0.997118 | 6.098422 |
8e350896-3c86-4e4f-aa05-860c99bdf881 | Leanbow1708/Competetive-Programming | Arrays/Frequency Of Elements in O1 time.cpp | #include<bits/stdc++.h>
using namespace std;
void frequencycount(vector<int>& arr,int n)
{
for(int i = 0;i < n;i++)
arr[i]--;
for(int i = 0;i < n;i++)
{
int x = arr[i]%n;
arr[x] = arr[x]+n;
}
for(int i = 0;i < n;i++)
{
arr[i] = (arr[i]/n);
}
}
int main()
{
int n... | ALGO | 0.999787 | 3.291902 |
22864dc0-e8c2-4461-8cb8-29af031d529b | K0nnyaku/Code | Data/CSP-JS2021二轮提高组数据/SD-01044/airport/airport.cpp | #include<iostream>
using namespace std;
int main()
{
int a,b,c,m,n,q,s1[9],t1[9],s2[9],t2[9],num=0,i1,i2;
cout<<"ŵĸ"<<endl;
cout<<"ں࣬ʺ";
cin>>a>>b>>c;
for(m=0;m++;m<=n)
n=a-m;
{
for(q=1;q<10;q++)
{if(q%2==1)
cin>>s1[9]>>t1[9];
else cin>>s2[9]>>t2[9];
}
}
for(i1=0;i1++;i1<... | ALGO | 0.999847 | 3.11207 |
fc360bc0-b5e3-4bbb-b1e4-13f369a31f14 | mahadi-zulfiker/DS-Exam | Count_Me.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int T;
cin >> T;
cin.ignore();
while (T--) {
string S;
getline(cin, S);
vector<string> words;
vector<int> counts;
stringstream ss(S);
string word;
string mostFrequentWord;
int ma... | ALGO | 0.99987 | 5.301877 |
e4df4e59-209f-43bd-aa37-85584fc9f27e | AyaseCore/Noggit3 | Noggit3libs/Boost/libs/msm/doc/HTML/examples/BoostCon09Full.cpp | #include <vector>
#include <iostream>
#include <boost/mpl/vector/vector50.hpp>
#include <boost/msm/back/state_machine.hpp>
#include <boost/msm/front/state_machine_def.hpp>
#include <boost/msm/back/tools.hpp>
namespace msm = boost::msm;
namespace mpl = boost::mpl;
namespace // Concrete FSM implementation
{
// eve... | TOOL | 0.933193 | 7.016479 |
bc8a8f66-a245-4826-a0a0-035d8f4aad50 | Abhirup898/LAB-PROGRAMS-DSA-AND-OOPS- | 13.cpp | #include <iostream>
using namespace std;
class count{
private:
int value;
public:
count(){value=5;}
void operator ++(){//PREFIX
++value;
}
void operator ++(int){//POSTFIX
value++;
}
void display(){
cout<<value<<endl;
}
};
int main()
{
count c;
c++;
++c;
c.displa... | TOOL | 0.875485 | 4.158043 |
cb0384f8-1bf8-4c9b-80aa-26baa8e88e38 | BadagalaAdarsh/LeetCode | 221-maximal-square/221-maximal-square.cpp | class Solution {
public:
int maximalSquare(vector<vector<char>>& matrix) {
int H = matrix.size();
if(H == 0 || matrix[0].size() == 0){
return 0;
}
int W = matrix[0].size();
int answer = 0;
vector<vector<int>> dp(H, vector<int>(W));
... | ALGO | 0.99983 | 6.357591 |
3ff6effd-82e6-4248-ab9b-2c792abefffe | Prashant-dhakad/DSA-questions-in-Cpp | Array/ArrayQuestion02.cpp | //ArrayQuestion02 : Find the maximum value out of all the elements in the array.
#include <iostream>
using namespace std;
int main() {
int array[] = {3,7,18,9,11};
int size = sizeof(array)/sizeof(array[0]);
int max = array[0];
for(int i = 1 ; i<size ; i++){
if(array[i]>max){
max = array[i];
}
... | ALGO | 0.99653 | 4.187154 |
628bbd5c-7c95-4afd-997f-598dd7d70fc0 | xinjianLiu/gromacs_fhmd-langevin_localthermostat | src/testutils/cmdlinetest.cpp | /*! \internal \file
* \brief
* Implements classes from cmdlinetest.h.
*
* \author Teemu Murtola <<EMAIL>>
* \ingroup module_testutils
*/
#include "gmxpre.h"
#include "cmdlinetest.h"
#include <cstdlib>
#include <cstring>
#include <memory>
#include <new>
#include <sstream>
#include <vector>
#include "gromacs/co... | TEST | 0.88869 | 7.055059 |
c9035415-29fc-4af6-a99a-4bffeb2a6e44 | imlauzh/LeetCode | LeetCode/452.用最少数量的箭引爆气球.cpp | /*
* @lc app=leetcode.cn id=452 lang=cpp
*
* [452] 用最少数量的箭引爆气球
*
* https://leetcode-cn.com/problems/minimum-number-of-arrows-to-burst-balloons/description/
*
* algorithms
* Medium (50.71%)
* Likes: 425
* Dislikes: 0
* Total Accepted: 82.1K
* Total Submissions: 161.7K
* Testcase Example: '[[10,16],[2... | ALGO | 0.999935 | 6.165872 |
b744bddc-f6e7-416f-ba7e-ffa535db9c7a | ishandutta2007/codeforces | fuppy/normal/1696/C.cpp | //*
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
//*/
#include <bits/stdc++.h>
// #include <atcoder/all>
using namespace std;
// using namespace atcoder;
#define DEBUG(x) cerr << #x << ": " << x << endl;
#define DEBUG_VEC(v) \
... | ALGO | 0.999757 | 4.999091 |
2d4eef23-5727-46db-ab77-b6ecd900f338 | meghnaprabhu98/languagelearning | c++/task4.cpp | #include<iostream>
using namespace std;
int main(){
int sum=0,i;
int arr[4]={1,2,3,4};
for(int i=0;i<4;i++)
sum=sum+arr[i];
cout<<sum;
}
| ALGO | 0.999429 | 3.25179 |
20dd5fa0-1d97-473a-b557-df2e93c1e633 | haka913/boj | 2858.cpp | /*
* 2858.cpp
*
* Created on: 2019. 2. 18.
* Author: paul
*/
#include <iostream>
#include <algorithm>
using namespace std;
// 2L+2W-4=R
//LW=B+R
//LW-(2L+2W-4)=B
//(L-2)(W-2)=B
//L=(B+R)/W
int main() {
int R, B;
cin >> R >> B;
int RB = R + B;
// for(int i =3;i<=RB/3;i++){
// if(RB%i==0){
// L = RB/i... | ALGO | 0.999733 | 4.70578 |
a51a5d4f-0035-4fc6-a1e0-a3d53819a8a9 | brower/EC504_2023F | HW2_codes/find.cpp | #include <iostream>
#include <fstream>
#include <chrono>
#include <cstring>
using namespace std;
/***********************************************************
Main progam template for find by bisecton and dictonaruy
************************************************************/
// Global Variable -- We will learn more e... | ALGO | 0.996492 | 4.511808 |
ffc97cb0-51df-430b-8847-54199c5b4b59 | SeokhunEom/Coding_Test | 엘리스/트리 위의 게임.cpp | #include <bits/stdc++.h>
using namespace std;
struct Node {
int value = -1;
vector<int> child;
};
int n, u, v, max_depth;
vector<int> edge[100001];
vector<int> depth[100001];
Node tree[100001];
void make_tree() {
queue<int> q, temp;
q.push(1);
tree[1].value = 1;
depth[1].push_back(1);
for (int i = 2; ... | ALGO | 0.999977 | 4.794553 |
0a0f7226-3b34-4c65-89e4-9842d86e0718 | Rohith-Rao/DSA-codes | graphs/krushkal's mst.cpp | #include <iostream>
using namespace std;
struct node
{
int d;
int v1;
int v2;
};
void swap(node &a,node &b)
{
node t;
t=a;
a=b;
b=t;
}
void minheap(node arr[],int ind,node minH[],int &smin)
{
for (int j = 0; j < ind; j++)
{
minH[smin]=arr[j];
int x=smin;
while(x>0 && minH[(x-1)/2].d>minH[x].d)
{
... | ALGO | 0.999985 | 3.943915 |
7039ce63-e2b9-455a-941f-f742c7a872bb | jarrodnorwell/rpcs3droid | app/src/main/cpp/Emu/NP/rpcn_config.cpp | #include "stdafx.h"
#include "rpcn_config.h"
#include "../Utilities/File.h"
cfg_rpcn g_cfg_rpcn;
LOG_CHANNEL(rpcn_log, "rpcn");
void cfg_rpcn::load()
{
const std::string path = cfg_rpcn::get_path();
fs::file cfg_file(path, fs::read);
if (cfg_file)
{
rpcn_log.notice("Loading RPCN config. Path: %s", path);
fr... | CONFIG | 0.924405 | 5.837731 |
9f03ffaa-d597-43c2-87ff-c06e0ceea691 | sdycxx2279/myAlgorithm | 138.cpp | //
//@author Xiao Xu
//@create 2018-09-19 21:09
// Copy List with Random Pointer
//使用unordered_map两遍即可完成,但需要占用O(n)空间
#include <iostream>
#include <vector>
using namespace std;
struct RandomListNode {
int label;
RandomListNode *next, *random;
RandomListNode(int x) : label(x), next(NULL), random(NULL) {}
}... | ALGO | 0.989854 | 4.038919 |
71fbb8e1-e1b4-42f8-8917-0b5177451248 | hieupham1103/TINHOC | SCHOOL/LOP10/BackTracking/MONEY.cpp | #include<bits/stdc++.h>
using namespace std;
int n, m;
int a[1000];
int countP = 0;
void backTracking(int i, int sum){
// cout << sum << endl;
if (sum == m){
countP++;
return;
}
if (sum > m or i > n){
return;
}
backTracking(i + 1, sum);
backTracking(i + 1, sum + a[i... | ALGO | 0.999922 | 3.806205 |
bfa35d8e-e7b8-458f-9b98-55257b3b4a81 | yogeshkumar98103/Data-Structures-Assignment | Set 3/HashTable/Example.cpp | #include <iostream>
#include "HashTable.h"
int main(){
// auto module = LinearProbingModule<char, 17>();
// HashTable<char, int, 101, Open_Addressing> count(module);
HashTable<char, int> count;
count.set_default_value(0);
std::string s = "aghfbkanrtfakfagtfaugffavzfklrgmptgrhuqiekrqnvmfgjkhrfqr";... | TOOL | 0.914357 | 3.610555 |
b18091fb-a992-4a7d-8ec7-6a4b62abe021 | Jeevan-kumar-Raj/LeetCode-Algorithms-Solutions-Topicwise | set-mismatch.cpp | // Time: O(n)
// Space: O(1)
class Solution {
public:
vector<int> findErrorNums(vector<int>& nums) {
int x_xor_y = 0;
for (int i = 0; i < nums.size(); ++i) {
x_xor_y ^= nums[i] ^ (i + 1);
}
int bit = x_xor_y & ~(x_xor_y - 1);
vector<int> result(2);
for (... | ALGO | 0.999887 | 6.198069 |
dc9b5cc3-1031-494f-bd39-37a4731b330f | satyajeetramnit/My-Codes-CPP | decimalToOctal.cpp | #include<iostream>
using namespace std;
int reverse(int num){
int lastDigit;
int revNum=0;
while (num>0)
{
lastDigit=num%10;
revNum=revNum*10+lastDigit;
num=num/10;
}
return revNum;
}
int decimalToOctal(int num){
int decimal = 8;
int octal = 0;
while (num>... | ALGO | 0.997112 | 5.245282 |
24a5adef-68bf-4c50-a370-56d17355a888 | SauravSarkar-CodersArcade/NHCE-CPP-DSA | DataStructures/NonLinearDataStructures/Trees/BST/BST-Implementation.cpp | #include <iostream>
using namespace std;
class TreeNode {
public:
int data;
TreeNode* left;
TreeNode* right;
TreeNode(int value){
data = value;
left = nullptr;
right = nullptr;
}
};
void inOrderTraversal(TreeNode* root){ // LDR
if (root != nullptr){
inOrderTravers... | ALGO | 0.999993 | 6.046676 |
9bc39b1e-f5ee-4e04-86ed-8d9ce4a63399 | frankantony/beecrowd-solution | 2450.cpp | #include <cstdio>
using namespace std;
bool verifica_linha (int *mat, int N, int M, int linha) {
int coluna = -1;
for (int j = 0;j < M;j++) {
printf("processando: %d, ", mat[linha*N + j]);
if(mat[linha*N + j] != 0) {
coluna = j;
break;
}
}
printf("Coluna = %d\n", coluna);
for(int i = linha+1;i < N;i+... | ALGO | 0.999531 | 3.872076 |
652f2a7b-993a-44d8-a9e7-bc3f78de2586 | longnu/codetree-TILs | 240528/좌표평면 위의 균형 2/balance-on-coordinate-plane-2.cpp | #include <iostream>
#include <climits>
#define MAX_N 100
#define MAX_X 100
using namespace std;
int posx[MAX_N];
int posy[MAX_N];
int main() {
int n;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> posx[i] >> posy[i];
}
int answer = INT_MAX; // 매우 큰 값으로 초기화합니다.
for (int i = 0; i <= ... | ALGO | 0.999704 | 4.597549 |
6d4ced9d-2965-4452-84bc-1a749efb04e3 | lakshits11/LeetCode | 0703-kth-largest-element-in-a-stream/0703-kth-largest-element-in-a-stream.cpp | // By Lakshit Somani
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
static int pr = []()
{
std::ios::sync_with_stdio(false);
cin.tie(NULL);
return 0;
}();
// In min Heap, kth largest element will always be at the top.
class KthLargest
{
public:
priority_queue<int, vector<int>, gre... | ALGO | 0.999973 | 5.01048 |
24d8dfe1-ccf8-4d36-a021-94901e013d57 | poneciak57/OI-prep-2023-2024 | snippets/binary_lifting.cpp | #include <bits/stdc++.h>
#define LL_INF 1000000000000000007
typedef long long ll;
typedef std::string str;
typedef std::pair<ll, ll> llPair;
template <typename T>
using vec = std::vector<T>;
using namespace std;
// max_depth = 1048576
const int LOG = 20;
struct Node {
int parrent;
int up[LOG];
int depth;
v... | ALGO | 0.999926 | 4.791492 |
7cf08a98-d208-42df-a8c9-0679ab49ed67 | jlopez92/demo-apps | smallest and largest integers.cpp | #include<iostream>
#include<vector>
using namespace std;
//int function for largest parameter
//constant int vector is the input parameter
int largestInt(const vector<int>& vec){
int largest = vec[0]; // initialize int variable to hold the return int
for(int index = 0; index < vec.size(); index++){//for loop iterate... | ALGO | 0.999336 | 4.320989 |
b0864051-7187-449b-b5cd-dacafe61a5a7 | paul2705/OI | OJ/bzoj/bzoj1097.cpp | #include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<queue>
#include<bitset>
using namespace std;
const int MAXN=2e4+5;
const int MAXM=4e5+6;
const int MAXK=21;
const int MAXS=(1<<MAXK);
const int inf=1e9;
int n,m,k,x;
int edge,head[MAXN],nex[MAXM],tail[MAXM],w[MAXM];
int dist[MAXK+5][MAXK... | ALGO | 0.999958 | 4.058457 |
7de8ed0d-2902-4db4-b1b9-42b467b1b47b | Sreeharij/Learning-Space | DSA/stack/stack_using_array.cpp | #include <iostream>
using namespace std;
class stack{
public:
int top;
int size;
int *arr;
stack(int size){
this->size = size;
top = -1;
arr = new int[size];
}
~stack(){
delete[] arr;
}
bool isFull(){
if(top == size - 1){
return ... | ALGO | 0.986933 | 4.185782 |
9a3fc93a-a652-43f4-8694-2348928a50ee | shiningflash/Competitive-Programming-Resources | Dynamic-Programming/subset_Sum.cpp | #include <bits/stdc++.h>
using namespace std;
#define LLI long long int
const int mx = 1e5+5;
// complexity: exponential
bool isSubsetSumRec(int a[], int n, int sum) {
if (sum == 0) return true;
if (n == 0 && sum != 0) return false;
if (a[n-1] > sum) return isSubsetSumRec(a, n-1, sum);
return isSubset... | ALGO | 0.999951 | 5.115962 |
1b13c3c1-eda3-4048-bcb0-1b581a832ff1 | outrageousaddy76000/LeetCode-GeeksforGeeks | 0078-subsets/0078-subsets.cpp | class Solution {
public:
vector<vector<int>> ans;
void solve(vector <int> &nums,int index, vector <int> curr){
if(index==nums.size()){
ans.push_back(curr);
return;
}
//backtrack logic
//dont take
solve(nums,index+1,curr);
//take
cur... | ALGO | 0.999894 | 6.264068 |
1549c9a4-e62d-4494-9d18-7fed41c1dc14 | hasnat0006/CP_SOLUTION | Codeforces/Normal Round/Round 900 - 999/Round 934 (Div. 2)/1944C.cpp | //!-----------------------------------------------------!//
//! Author: YUSUF REZA HASNAT !//
//! Created: 16|03|2024 21:19:17 !//
//!-----------------------------------------------------!//
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
#defi... | ALGO | 0.999896 | 5.756722 |
ee41cb61-5443-48e4-91da-b1885256d80c | ishandutta2007/codeforces | rednextcentury/normal/915/F.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
vector<pair<int,pair<int,int> > > E;
int n;
int group[1000100];
vector<int> G[1000100];
long long cur=0;
void add(int u,int v)
{
for (auto x:G[u]){
G[v].push_back(x);
group[x]=v;
}
G[u].clear();
}
void dsu(long long c,int u,... | ALGO | 0.99995 | 3.857279 |
779da720-2af7-46f6-9323-6b88714778c8 | suhas25/LC-Solutions | Greedy/2214. Minimum Health to Beat Game.cpp | //
// Created by Suhas Reddy on 2/20/25.
//
// Use the armor to protect against the maximum damage.
class Solution {
public:
long long minimumHealth(vector<int>& damage, int armor)
{
long long total_damage=0;
int max_damage=0;
for(auto d:damage)
{
total_damage+=d;
max_damage = max(d, ... | ALGO | 0.996108 | 4.649443 |
5dc22c34-e462-4218-bb2a-c1847741b488 | GuacheSuede/MSSubmission1234567890 | submission/sma/boost_1_69_0/libs/yap/example/vector.cpp | #include <vector>
#include <iostream>
//[ vector_take_nth_xform
struct take_nth
{
template <typename T>
auto operator() (boost::yap::expr_tag<boost::yap::expr_kind::terminal>,
std::vector<T> const & vec)
{ return boost::yap::make_terminal(vec[n]); }
std::size_t n;
};
//]
// A sta... | TOOL | 0.876365 | 6.651552 |
1230ef2d-e570-4a49-a531-e901cb347821 | mdshadesh/CodeChef-Problem-Solution | BUDGET_.cpp | #include <bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
ll int a;
cin>>a;
while(a--)
{
ll int b, c, sum;
cin >> b >>c ;
sum = c * 30;
if(b >= sum)
{
cout<<"Yes"<<endl;
}
else{
co... | ALGO | 0.999876 | 3.327012 |
f7736622-9c21-4274-b3ce-10c5b029f450 | MmyGoal/OHHO | src/crypto/hmac_sha256.cpp | #include "crypto/hmac_sha256.h"
#include <string.h>
CHMAC_SHA256::CHMAC_SHA256(const unsigned char* key, size_t keylen)
{
unsigned char rkey[64];
if (keylen <= 64) {
memcpy(rkey, key, keylen);
memset(rkey + keylen, 0, 64 - keylen);
} else {
CSHA256().Write(key, keylen).Finalize(rke... | ALGO | 0.984756 | 5.853137 |
0ade0497-331c-44a1-8926-375d0d7f41fb | Big-Onche/Tesseract-Sauerbraten | src/engine/bih.cpp | #include "engine.h"
extern vec hitsurface;
bool BIH::triintersect(const mesh &m, int tidx, const vec &mo, const vec &mray, float maxdist, float &dist, int mode)
{
const tri &t = m.tris[tidx];
vec a = m.getpos(t.vert[0]), b = m.getpos(t.vert[1]).sub(a), c = m.getpos(t.vert[2]).sub(a),
n = vec().cross(b... | ALGO | 0.9994 | 5.673125 |
bc6b9c25-66ad-49e5-90fa-a3a1f520f41d | sandipshah-git/Test | cdc/Lab9.cpp | #include <iostream>
#include <string>
#include <stack>
using namespace std;
int main() {
string expression;
cout << "Enter an arithmetic expression : ";
getline(cin, expression);
// Find the position of '=' to separate variable and expression
size_t equal_pos = expression.find('=');
if (equal_... | ALGO | 0.99961 | 6.525202 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.