uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
c82eeb6b-eba5-46bc-a9cb-9d6816d7d671 | Abdul8081/c-_practice_code | Recursion/subset_of_duplicate_array_number.cpp | #include<iostream>
#include<vector>
using namespace std;
void f(vector<int> org, int idx, vector<int> ans, vector<vector<int>> &anss, bool flag){
if(idx==org.size()){
anss.push_back(ans);
return;
}
int x = org[idx];
if(org.size()==1){
if(flag==1) f(org, idx+1, ans, anss, 1);
... | ALGO | 0.999992 | 4.306404 |
6dfaceac-4bed-4dbb-92bc-bb6cf3925467 | TRUEJASONFANS/ProgrammingPractice | 去哪网2015春季笔试题目/p1.cpp | #include<iostream>
#include<vector>
using namespace std;
/**
注意其单调性
**/
int binarySearch(int a[],int s,int e,int target) {
while(s<e) {
int mid = (s+e)/2;
if(a[mid]==target) return mid;
if(a[mid]>target) {
e = mid - 1;
}
else {
s = mid + 1;
}
}
return -1;
}
int findLocation(int a[],int s,int e,int... | ALGO | 0.999972 | 4.741351 |
b9cefd66-b5d6-4bdc-aaf2-073d49c3ae99 | DanielTakeshi/gym-cloth | render/ext/libzmq/perf/benchmark_radix_tree.cpp | #if __cplusplus >= 201103L
#include "radix_tree.hpp"
#include "trie.hpp"
#include <chrono>
#include <cstddef>
#include <cstdio>
#include <random>
#include <ratio>
#include <vector>
const std::size_t nkeys = 10000;
const std::size_t nqueries = 1000000;
const std::size_t warmup_runs = 10;
const std::size_t samples = 1... | TEST | 0.946987 | 6.492575 |
542f718d-dfae-4931-ad24-f025df0ab6ba | srivastavaritik/DSA | 149-max-points-on-a-line/149-max-points-on-a-line.cpp | class Solution {
public:
int maxPoints(vector<vector<int>>& points) {
int result = 0;
for(int i = 0 ; i < points.size() ; ++i) {
unordered_map <long double, int> h;
int same = 1, localmax = 0;
for(int j = i+1 ; j < points.size() ; ++j) {
if(points[i... | ALGO | 0.999952 | 5.59937 |
901d7da5-4220-4f05-97c7-8f3eaa8863d3 | HLennart/Absl | Public/absl/strings/internal/charconv_bigint.cpp | #include "absl/strings/internal/charconv_bigint.h"
#include <algorithm>
#include <cassert>
#include <string>
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace strings_internal {
namespace {
// Table containing some large powers of 5, for fast computation.
// Constant step size for entries in the kLargePowersOfFive t... | ALGO | 0.997819 | 7.56364 |
f5b6c02d-5ae1-488b-9f6b-648a12dda7ae | vpatel95/online_programming | hackerrank/project_euler/002.cpp | // Project Euler #2 - https://www.hackerrank.com/contests/projecteuler/challenges/euler002/problem
#include <iostream>
#define ull unsigned long long
using namespace std;
ull solve (ull n) {
if (n < 2) return 0;
if (n == 2) return 2;
ull res = 2, f = 1, s = 2, t;
while (n >= (t = (f+s))) {
i... | ALGO | 0.999898 | 6.11645 |
0de325e4-64ab-4b94-8e63-5bb931a38ace | Mallchad/experiments | c++/leetcode_binary_instructions.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), left(left), right(right)... | ALGO | 0.99997 | 6.058614 |
262744db-220c-4397-aabe-3cacb4291442 | capn-21/Cpp | new fun .cpp | #include <iostream>
using namespace std;
void halo(int a,int b){
int c;
c=a+b;
cout<<"the answer is "<<c<<endl;
}
int main(){
halo(45,3);
}
| ALGO | 0.99803 | 3.80423 |
d4c2edce-6a8f-4e27-8394-c31bf855b878 | Cmput416F21/PyGlueTokenizer | CodeGen-main/data/transcoder_evaluation_gfg/cpp/DIFFERENT_WAYS_SUM_N_USING_NUMBERS_GREATER_EQUAL_M.cpp | #include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <fstream>
#include <iomanip>
#include <bits/stdc++.h>
using namespace std;
int f_gold ( int n, int m ) {
int dp [ n + 2 ] [ n + 2 ];
memset ( dp, 0, sizeof ( dp ) );
dp [ 0 ] [ n + 1 ] = 1;
for ( int k = n;
k >= m;
k -- ) {
... | ALGO | 0.99992 | 5.25022 |
e55d60aa-791d-4357-86a7-70a6d6235a4d | ViscLu/A8_Edu_App_Dublinn | Box2D/Dynamics/b2ContactManager.cpp | #include <Box2D/Dynamics/b2ContactManager.h>
#include <Box2D/Dynamics/b2Body.h>
#include <Box2D/Dynamics/b2Fixture.h>
#include <Box2D/Dynamics/b2WorldCallbacks.h>
#include <Box2D/Dynamics/Contacts/b2Contact.h>
b2ContactFilter b2_defaultFilter;
b2ContactListener b2_defaultListener;
b2ContactManager::b2ContactManager()... | ALGO | 0.95199 | 6.955931 |
6ea5c76b-cb05-4a91-9514-e5eb13f5f255 | jramos69/platform_frameworks_av | media/libmedia/StringArray.cpp | //
// Sortable array of strings. STL-ish, but STL-free.
//
#include <stdlib.h>
#include <string.h>
#include <media/StringArray.h>
namespace android {
//
// An expanding array of strings. Add, get, sort, delete.
//
StringArray::StringArray()
: mMax(0), mCurrent(0), mArray(NULL)
{
}
StringArray:: ~StringArray(... | TOOL | 0.969967 | 6.404926 |
54ccf9ea-d823-4fe1-9dca-5ca6aa8779fd | 31b0n3/CODE_TRAINING | C++/C++/Homework/Bai_tap_ung_dung/02_Xuc_xac/Xuc_xac.cpp | #include<iostream>
using namespace std;
int main(){
int a[500]={0};
int T;
cin>>T;
for(int i = 0;i<T;i++){
cin>>a[i];
}
for(int i = 0;i<T;i++){
cout<<7-a[i]<<endl;
}
return 0;
} | ALGO | 0.999462 | 3.095149 |
beb705cd-61df-424f-b517-3cf2e8771fb9 | Iintercooler/Algoritmos-1 | Ejercicios1/FuncAux.cpp | #include "FuncAux.h"
//#ifndef FUNCAUX_CPP
//#define FUNCAUX_CPP
struct NodoListaAux {
int dato;
bool esVacio;
NodoListaAux *sig;
NodoListaAux(int x, bool vacio) : dato(x), esVacio(vacio), sig(NULL) {}
NodoListaAux() : dato(-1), esVacio(true), sig(NULL) {} //constructor por defecto
};
/*
struct NodoABNivel {
i... | TEST | 0.94409 | 3.755859 |
8c9516cc-54c5-402a-9ea5-968f83516a29 | KIMBIBLE/algorithm_solving | codeplus/10819.cpp | /*
* # 10819 : 차이를 최대로
* - 문제
* N개의 정수로 이루어진 배열 A가 주어진다. 이 때, 배열에 들어있는
* 정수의 순서를 적절히 바꿔서 다음 식의 최대값을 구하는 프로그램을 작성하시오.
* |A[0] - A[1]| + |A[1] - A[2]| + ... + |A[N-2] - A[N-1]|
*
* - 입력
* 첫째 줄에 N (3 ≤ N ≤ 8)이 주어진다. 둘째 줄에는 배열 A에 들어있는
* 정수가 주어진다. 배열에 들어있는 정수는 -100보다 크거나 같고, 100보다 작거나 같다.
*
* - 출력
* 첫째 줄에 배... | ALGO | 0.999979 | 4.691254 |
66347536-c6fc-4372-9dcb-5e691e58bb13 | lucas-gab46/poo | fracao.cpp | #include <iostream>
using namespace std;
class Fracao {
private:
int num;
int den;
friend Fracao operator*(Fracao f1, Fracao f2);
friend ostream &operator<<(ostream&, saida, const Fracao & f );
saida << f1.num << "/" << f1.den;
return saida;
public:
Fracao() {
num = 0;
den = 1;
}
... | ALGO | 0.993944 | 4.724239 |
db464368-5ebd-4528-bef8-0e6ba59afee6 | menaehab/Codeforces-Solutions | 1001 - 2000 problems/B_Complicated_GCD.cpp | #include <iostream>
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <iomanip>
#include <string>
#include <set>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#define ll long long
#define el '\n'
#define all(arr) arr.begin(), arr.end()
#define ... | ALGO | 0.999893 | 3.406941 |
5cea1b9c-ba44-48e5-9a93-41a3ea3dd3ee | JovicicLazar/advent-of-code2024 | day3/main.cpp | #include <iostream>
#include <fstream>
#include <string>
#include <sstream>
#include <vector>
#include "types.hpp"
namespace {
const std::string INPUT_FILE_NAME = "puzzle_input.txt";
}
std::string load_data(const std::string& path_to_input) {
std::ifstream input_file(path_to_input);
if (!input_file.is_op... | ALGO | 0.999625 | 6.151597 |
ee57d5fa-749b-4650-a785-d3b4731b81b7 | ANARCYPHER/simple-cpp-botnet | host/xtea.cpp | #include <iostream>
#include <fstream>
#include <stdint.h>
#include <cstring>
using namespace std;
#define BLOCK_SIZE 8
unsigned int key[4] = { 0xDEAD, 0xDEAD, 0xDEAD, 0xDEAD };
void encipher(unsigned int num_rounds, uint32_t v[2], uint32_t const key[4])
{
unsigned int i;
uint32_t v0 = v[0], v1 = v[1], sum = 0, de... | ALGO | 0.992477 | 3.986131 |
a2c9b39a-670a-4bb6-9c2b-238abf74ceb3 | Vinay-Rastogi/LeetCode | 501. Find Mode in Binary Search Tree.cpp | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
struct TreeNode {
int val;
TreeNode *left;
TreeNode *right;
TreeNode(int x) : val(x), left(NULL), right(NULL) {}
};
class Solution {
vector<int> result;
int maxFreq = 0;
void helper(TreeNode* cur, int & curval, int & rep... | ALGO | 0.999993 | 5.669569 |
3cd6df58-e5a4-46e0-bda6-4313e313b8e0 | MayankK806926/DSA | Algorithm->TopologicalSort(DFS).cpp | // Topological sorting for Directed Acyclic Graph (DAG) is a linear ordering of vertices such that for every directed edge u -> v, vertex u comes before v in the ordering.
class Solution {
private://TC->o(n+E) & SC->O(3*n)
void dfs(int node,vector<int>& vis,vector<vector<int>>& adj,stack<int>& st){
vis[no... | ALGO | 0.999999 | 6.752657 |
d99a5ee5-607f-48bc-99ac-eef96490382b | Harashporiya/Strivers_Sheet_A2Z | Strivers_A_to_Z_DSA_COURSE/oops/exceptionHandel/Validindexofarray.cpp | #include<iostream>
using namespace std;
void VaildIndexArray(int a[], int n, int index){
try{
for(int i=0;i<n;i++){
if(i == index){
throw a[i];
}
}
for(int i=0;i<n;i++){
if(i != index){
throw 'n';
}
}
}catch(int ar){
cout<<ar<... | ALGO | 0.997831 | 4.328039 |
090f779f-2502-4701-8c41-2c1187fadad9 | mcelis13/C-Plus-Plus | IncludeHeaderFile/main.cpp | #include <iostream>
#include "safestuff.h"
using namespace std;
int main()
{
cout << "Surprise, Surprise!" << endl;
cout << "The combination is (once again)" << endl;
cout << SafeCracker(12) << endl;
return 0;
}
| TOOL | 0.909343 | 3.194223 |
8d582628-47e8-4a93-af15-15f42fcf0fe2 | barrett24/Algorithms | 이전것/9012.cpp | #include <iostream>
#include <string>
using namespace std;
string val(string s){
int cnt = 0;
for(int i=0; i<s.size(); i++){
if(s[i]== '('){
cnt += 1;
}else if(s[i]==')'){
cnt -= 1;
}
if (cnt < 0) {
return "NO";
}
}
if(cnt==0){... | ALGO | 0.999625 | 4.747561 |
0482fca3-8d9e-4236-9c17-024b83fc5636 | SerCharles/LeetCode | substring/substring/main.cpp | #include<iostream>
#include<string>
using namespace std;
int pi[100000] = { 0 };
string base_str;
void get_pi()
{
pi[0] = -1;
int p = -1;
for (int i = 1; i < base_str.size(); i++)
{
while (p >= 0 && base_str[p + 1] != base_str[i])
{
p = pi[p];
}
if (base_str[p + 1] == base_str[i])
{
p++;
}
pi[i... | ALGO | 0.999995 | 3.688344 |
cd362b62-2525-41e0-ac8b-63ff03ed0e68 | aburifat/ProblemSolving | Solve-By-Topic/Algebra/Fundamentals/Extended Euclidean Algorithm/Euclid Problem-UVA-10104.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll exGCD(ll a, ll b, ll &x, ll &y)
{
if(b==0){
x=1;
y=0;
return a;
}
ll x1,y1;
ll d=exGCD(b,a%b,x1,y1);
x=y1;
y=x1-(a/b)*y1;
return d;
}
int main()
{
ios_base::sync_with_stdio(false);cin.tie(0);c... | ALGO | 0.999819 | 3.72064 |
63abc263-516a-4bc4-aa16-57efafbe937c | stone-SJH/Computer-Version | HW3-Morphological operations2/Q1-Potato Skin&Skeleton/Skeleton2.cpp | #include "opencv.h"
/*˶δΪοϵԭеZhangϸ㷨Դ룬ҽԭIplImageӿʵΪMatӿʵ֣bugдmain*/
void thin(const Mat &src, Mat &dst, const int iterations)
{
const int height = src.rows - 1;
const int width = src.cols - 1;
if (src.data != dst.data)
{
src.copyTo(dst);
}
int n = 0, i = 0, j = 0;
Mat tmpImg;
uchar *pU, *pC, *pD;
bool isF... | ALGO | 0.993298 | 5.132031 |
6dc3ec78-eacd-4f51-aa90-98e7bef96d53 | versenyi98/programming-contests | UVa Online Judge/00591 - Box of Bricks/main.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
int tc = 0;
while (cin >> n, n) {
int num[n];
int sum = 0;
for (int i = 0; i < n; i++) {
cin >> num[i];
sum += num[i];
}
int avg = sum / n;
int ct = 0;
f... | ALGO | 0.999193 | 3.889444 |
5d57565f-3192-4eef-aaeb-8be2cc80beaf | AllenTamrazian/RacingGame | Library/PackageCache/com.unity.ide.visualstudio@2.0.22/Editor/COMIntegration/COMIntegration~/COMIntegration.cpp | #include <iostream>
#include <sstream>
#include <string>
#include <filesystem>
#include <windows.h>
#include <shlwapi.h>
#include <fcntl.h>
#include <io.h>
#include "BStrHolder.h"
#include "ComPtr.h"
#include "dte80a.tlh"
constexpr int RETRY_INTERVAL_MS = 150;
constexpr int TIMEOUT_MS = 10000;
// Often a DTE call m... | TOOL | 0.94874 | 6.933585 |
2a6b7183-62f1-49d5-984a-6050169d106e | ImLexsus/lexsus | C++/Tutor C++/24 Segitiga siku-siku/SegitigaSK.cpp | #include<iostream>
using namespace std;
int main()
{
int n;
cout << "Masukkan panjang pola segitiga: ";
cin >> n;
cout<< "pola 5\n";
for ( int i = 1; i <= n; i++)
{
for ( int j = n; j > i; j--)
{
cout<< " ";
}
for ( int k = 1; k <= (i*2-1); k++)... | ALGO | 0.999712 | 3.367868 |
696d9ec7-eb41-4582-8dc6-7d7379758286 | ishandutta2007/codeforces | .tx/normal/1275/B.cpp | #include <iostream>
using namespace std;
int main() {
int a, b, c, d, e, f;
cin >> a >> b >> c >> d >> e >> f;
int ans = 0;
for (int i = 0; i <= min(a, d); i++) {
int j = min(min(d - i, b), c);
ans = max(ans, i * e + j * f);
}
cout << ans << "\n";
return 0;
} | ALGO | 0.999809 | 3.563642 |
763eeabd-db5e-4db8-86a3-82bcf62aade5 | holusojivhictor/Morningstar | 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.998667 | 6.789978 |
b52c6b8f-9d8e-4767-ae79-85eff2b3ce0e | felipefoschiera/Competitive-Programming | Codeforces/580A.cpp | // Codeforces 580A - Kara and First Steps
// Felipe G. Foschiera
#include <cstdio>
const int MAX = 101010;
int A[MAX];
inline int max(int a, int b) { return a > b ? a : b; }
int main(){
int N;
while(scanf("%d", &N) != EOF){
for(int i = 0; i < N; i++)
scanf("%d", &A[i]);
int max_l... | ALGO | 0.99928 | 4.088807 |
495d03b8-4061-46a8-9c6e-6e0bcd552e6e | jaguardado123/chucknorris | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998733 | 6.76775 |
577c9e59-12b4-46d3-a574-d88a84b8f746 | DPChanny/ps | Baekjoon/2750_2.cpp | #include<iostream>
#include<list>
using namespace std;
int n, ns[1'000];
list<int> rns;
int main(void) {
cin >> n;
for (int _n(0); _n < n; _n++)
cin >> ns[_n];
for (int _n(0); _n < n; _n++) {
list<int>::iterator m(rns.begin());
while(m != rns.end() && ns[_n] > *m) m++;
rns.insert(m, ns[_n]);
}
for (list... | ALGO | 0.999978 | 3.601288 |
0d4440b7-7357-46ef-b72b-ca8f0cf74aa9 | Alextz307/Algorithms-Library | Manacher.cpp | const int NMAX = 1e6;
int dp[NMAX][2], l[2], r[2];
void Manacher() {
string s;
cin >> s;
int N = s.size();
long long ans = 0;
r[0] = r[1] = -1;
for (int i = 0; i < N; ++i)
for (int par = 0; par < 2; ++par) {
int flag = !par;
int k = (i > r[par]) ? par : min(dp[l[par] + r[par] + flag - ... | ALGO | 0.999936 | 5.529336 |
72345b8a-a172-4939-b50f-7a704eedb71d | 99monisha/90-DAYS-DSA-CHALLENGES | STRING/pro-15/frequency.cpp | /*
The frequency of: a is 1
The frequency of: h is 1
The frequency of: i is 1
The frequency of: m is 1
The frequency of: n is 1
The frequency of: o is 1
The frequency of: s is 1
*/
#include<bits/stdc++.h>
using namespace std;
int main()
{
char str[100]="monisha";
int i;
int freq[200]={0};
for(i=0;str[... | ALGO | 0.996557 | 3.58416 |
c89e1759-7d25-4c7a-b2f6-a06a03b51055 | default1360/bulletlib-2.81-rev2613 | Extras/ConvexDecomposition/ConvexBuilder.cpp | #include "float_math.h"
#include "ConvexBuilder.h"
#include "meshvolume.h"
#include "bestfit.h"
#include <assert.h>
#include "cd_hull.h"
#include "fitsphere.h"
#include "bestfitobb.h"
unsigned int MAXDEPTH = 8 ;
float CONCAVE_PERCENT = 1.0f ;
float MERGE_PERCENT = 2.0f ;
CHull::CHull(const ConvexResult &result)
{
... | ALGO | 0.993299 | 6.139929 |
13d989dc-5cbb-4a84-ac51-d4e1c0c56462 | AndresGarciaEscalante/Path-Planning-Autonomous-Car | CarND-Path-Planning-Project/src/Eigen-3.3/doc/snippets/MatrixBase_all.cpp | Vector3f boxMin(Vector3f::Zero()), boxMax(Vector3f::Ones());
Vector3f p0 = Vector3f::Random(), p1 = Vector3f::Random().cwiseAbs();
// let's check if p0 and p1 are inside the axis aligned box defined by the corners boxMin,boxMax:
cout << "Is (" << p0.transpose() << ") inside the box: "
<< ((boxMin.array()<p0.array(... | ALGO | 0.984742 | 3.469832 |
df04ffc4-840b-4984-a990-f6ee89ce50fa | Vikramaditya-Ghadage/Codes | C++/SDE_SHEET/Array1/MaxProfitStock.cpp | #include<bits/stdc++.h>
using namespace std;
// Time-Complixity: O(N) it's a Linear
int maxProfit(vector<int> nums,int n)
{
int min_element=INT_MAX;
int max_profit=INT_MIN;
for(int i=0;i<n;i++)
{
min_element=min(min_element,nums[i]);
max_profit=max(max_profit,(nums[i]-min_element));
... | ALGO | 0.999811 | 5.221907 |
24ab02d5-82e9-4dca-9150-c70933fae399 | shyamal2411/DSA-Practice | Cpp_Misc/multiplicationTable.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int n,m,ans = 0;
//program for multiplication table
cin>>n>>m;
for(int i = 1; i <= m; i++){
// ans += n*i;
cout<<n<<"*"<<i<<"="<<n*i<<endl;
}
return 0;
} | ALGO | 0.999804 | 3.894426 |
af95cb37-b054-4d31-8a33-21bc2165682e | JeanFurstoss/AtomHIC | src/SteinhardtDescriptors.cpp | #include "SteinhardtDescriptors.h"
#include "AtomHicConfig.h"
#include <cmath>
#include <complex>
#include <omp.h>
#include <iomanip>
#include <sh/spherical_harmonics.h>
using namespace std;
SteinhardtDescriptors::SteinhardtDescriptors(AtomicSystem *_MySystem):Descriptors(_MySystem){
this->name = "Steinhardt";
rea... | ALGO | 0.994094 | 5.145004 |
7438e156-93ee-4ae9-8d44-4a5151f4b852 | Szymi76/Codeforces | A. Combination Lock.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n,moves = 0;
string startLock,endLock;
cin>>n>>startLock>>endLock;
for(int i=0; i<n; i++)
{
char startZnak = startLock[i];
char endZnak = endLock[i];
int startNum = int(startZnak - 48);
int endNum = int... | ALGO | 0.999402 | 3.533984 |
2a5f7fe1-8398-4a29-97c5-6d3a283f401d | tacoder/Project-euler-solutions | project_euler-17.cpp | /*question
*
* Number letter counts
* Problem 17
*
* If the numbers 1 to 5 are written out in words: one, two, three, four, five, then there are 3 + 3 + 5 + 4 + 4 = 19 letters used in total.
* If all the numbers from 1 to 1000 (one thousand) inclusive were written out in words, how many letters would be used?
... | ALGO | 0.999019 | 5.431057 |
12dbb9e8-e001-454a-9479-d15ec738bd74 | gaurav-singh1998/Cpp_practice_questions | divide_and_conquer/quick_sort.cpp | #include<bits/stdc++.h>
using namespace std;
int getPivot(int* arr, int s, int e)
{
int i=s-1;
int pivot=arr[e];
for(int j=s; j<e; j++)
{
if(arr[j]<pivot)
{
i++;
swap(arr[i], arr[j]);
}
}
swap(arr[i+1], arr[e]);
return i+1;
}
void quick_sort(... | ALGO | 0.999968 | 5.439064 |
d820e2f7-c141-4c18-ba5d-66d82630ef10 | zordican/CodingAlgo | Tree/inorder.cpp | #include<iostream>
#include<bits/stdc++.h>
using namespace std;
struct Node{
int data;
struct Node* left;
struct Node* right;
Node(int val){
data=val;
left=right=nullptr;
}
};
void inorder(struct Node* node){
if(node==nullptr)
return;
inorder(node->left);
cou... | ALGO | 0.999841 | 4.109488 |
fbf0df7b-3d5e-438f-9798-b9a4ee61de49 | lewissbaker/llvm | lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/bitset/main.cpp | #include <bitset>
#include <stdio.h>
template<std::size_t N>
void fill(std::bitset<N> &b) {
b.set();
b[0] = b[1] = false;
for (std::size_t i = 2; i < N; ++i) {
for (std::size_t j = 2*i; j < N; j+=i)
b[j] = false;
}
}
template<std::size_t N>
void by_ref_and_ptr(std::bitset<N> &ref, std::bitset<N> *pt... | TOOL | 0.953985 | 3.790956 |
3ba117a5-3089-4e08-b31d-e68f1d48c267 | aalto-intelligent-robotics/lamide | ndt_tools_lamide/ndt_fuser_lamide/src/ndt_fuser_from_depth_lamide.cpp | // Evaluation using TUM data set.
#include <ndt_fuser_lamide/ndt_fuser.h>
#include <pointcloud_vrml/pointcloud_utils.h>
#include <iostream>
#include <boost/thread/thread.hpp>
#include <boost/program_options.hpp>
#include <cv.h>
#include <highgui.h>
#include <pcl/io/io.h>
#include <pcl/io/pcd_io.h>
#include <pcl/commo... | DATA | 0.917336 | 5.947423 |
a6f6d02c-ea1f-4b31-950c-da684bda2346 | cechallenge/2025 | llvm/clang-tools-extra/clangd/HeaderSourceSwitch.cpp | #include "HeaderSourceSwitch.h"
#include "AST.h"
#include "SourceCode.h"
#include "index/SymbolCollector.h"
#include "support/Logger.h"
#include "support/Path.h"
#include "clang/AST/Decl.h"
#include <optional>
namespace clang {
namespace clangd {
std::optional<Path> getCorrespondingHeaderOrSource(
PathRef Origina... | TOOL | 0.923527 | 6.874902 |
e9ac5eb7-765f-487e-b0a9-82d9cd6e4ca2 | elssm/leetcode | 平方数之和.cpp | #include<stdio.h>
#include<math.h>
bool judgeSquareSum(int c) {
int i=0,j=sqrt(c),num;
if(sqrt(c)>46340)
return false;
if(c<2)
return true;
else{
while(i<=j){
num=i*i+j*j;
if(num==c)
return true;
else if(num<c)
... | ALGO | 0.998122 | 3.594907 |
e0537915-51a2-4a05-a077-520ab497bc56 | jmvalois/Sherlock_Compilation | SRC_DI2/analysis/integrator/TRBDF2.cpp | // $Revision: 1.1 $
// $Date: 2009-03-20 18:36:30 $
// $Source: /usr/local/cvs/OpenSees/SRC/analysis/integrator/TRBDF2.cpp,v $
// Written : fmk
// Created : 02/09
//
// Description: This file contains the implementation of the TRBDF2 class.
// ref: K.J.Bathe, "Conserving Energy and Momentum in Nonlinear Dynamics: A Si... | ALGO | 0.99262 | 6.7637 |
ef8c50de-52df-4449-b101-6b6f3f257dc4 | yousuf7902/CF_Auto_Generate | codeforces/1537/A.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
int t;
cin >> t;
while (t--)
{
int n, sum = 0;
cin >> n;
int arr[n];
for (int i = 0; i < n; i++)
{
cin >> arr[i];
sum = sum + arr[i... | ALGO | 0.99981 | 4.036796 |
0f54807c-4532-4c22-b223-ca1dc484c2b3 | overclocked-2124/RVCE-Coding-Bootkit | Resources/DSA/Free-Resources/Exhaustive DSA Questions by Topic/Arrays/37_repeatingAndMissingElement.cpp | /**
* Finding the repeating element and missing element
* array[] = {3,1,2,5,3}
* A = 3 , B = 4
* Since 3 is appearing twice and 4 is missing
*/
#include<iostream>
#include<vector>
using namespace std;
/**
* Brute Solution
* TC : O(N^2)
* SC : O(1)
*/
vector<int> brute(vector<int> nums){
int n = nums.size... | ALGO | 0.999748 | 5.495176 |
a536917a-39e4-4495-a44f-62605bfeab5a | Hritvi16/astro_guide_astro | 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 |
4a9fa387-2fe6-44ac-a6f0-835ed0df105b | iamAbhi1992/SCALER_JULY_2024 | 17 Backtracing/02 DSA: Backtracking 2/Kth Symbol - Hard.cpp | // https://www.scaler.com/academy/mentee-dashboard/class/297913/homework/problems/31788?navref=cl_tt_lst_nm
// Problem Description
// On the first row, we write a 0. Now in every subsequent row, we look at the previous row and replace each occurrence of 0 with 01, and each occurrence of 1 with 10.
// Given row numbe... | ALGO | 0.999951 | 4.225904 |
e6dfdd57-f0ec-44fa-8910-144be733a00c | boostpro/boost-release | libs/iterator/example/reverse_iterator.cpp | #include <boost/iterator/reverse_iterator.hpp>
#include <boost/cstdlib.hpp>
#include <iostream>
#include <iterator>
#include <algorithm>
int main()
{
int x[] = { 1, 2, 3, 4 };
boost::reverse_iterator<int*> first(x + 4), last(x);
std::copy(first, last, std::ostream_iterator<int>(std::cout, " "));
std::cout << s... | TOOL | 0.914046 | 4.15839 |
ec46819e-5fee-4045-b417-254d495a4090 | Maksasj/megaboost | libs/circular_buffer/example/bounded_buffer_comparison.cpp | // Comparison of bounded buffers based on different containers.
#include <boost/circular_buffer.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/thread/condition.hpp>
#include <boost/thread/thread.hpp>
#include <boost/timer/timer.hpp>
#include <boost/call_traits.hpp>
#include <boost/bind.hpp>
#include <deque>
#i... | TOOL | 0.872503 | 7.033121 |
8ab8d6fb-c364-4bcb-b27d-32927b9687d6 | matcha-bingsu/ALGORITHM | 연결 리스트/1406_stl.cpp | //https://www.acmicpc.net/problem/1406 [에디터]
#include <bits/stdc++.h>
using namespace std;
int main(void)
{
ios::sync_with_stdio(0);
cin.tie(0);
list<char> L;
string arr;
int t;
char order;
list<char>::iterator it;
cin >> arr;
for(char e : arr)
L.push_back(e);
it = L.... | ALGO | 0.999787 | 4.532017 |
83fc69b8-297b-4979-8c38-1f6885b57fbd | fwdzh/cp_code | XCPC/Nowcoder-Summer-2025/7/J.cpp | /*
第一章 陨落的天才
“斗之力,三段!”
望着测验魔石碑上面闪亮得甚至有些刺眼的五个大字,
少年面无表情,唇角有着一抹自嘲,紧握的手掌,
因为大力,而导致略微尖锐的指甲深深的刺进了掌心之中,带来一阵阵钻心的疼痛…
“萧炎,斗之力,三段!级别:低级!”测验魔石碑之旁,一位中年男子,
看了一眼碑上所显示出来的信息,语气漠然的将之公布了出来…
中年男子话刚刚脱口,便是不出意外的在人头汹涌的广场上带起了一阵嘲讽的骚动。
“三段?嘿嘿,果然不出我所料,这个'天才'这一年又是在原地踏步!”
“哎,这废物真是把家族的脸都给丢光了。”
“要不是族长是他的父亲,这种废物,早就被驱赶出家族,任其自生自灭了,哪还有机会待在家族中白吃白喝。... | TOOL | 0.931611 | 3.367558 |
a24b6563-e31b-461b-a517-8e8aeef02df0 | sargun4/leetcode | Easy/Intersection of Two Linked Lists/intersection-of-two-linked-lists.cpp | //{ Driver Code Starts
//
#include <bits/stdc++.h>
using namespace std;
struct Node
{
int data;
Node *next;
Node(int val)
{
data=val;
next=NULL;
}
};
Node* inputList(int size)
{
Node *head, *tail;
int val;
cin>>val;
head = tail = new Node(val);
while(... | ALGO | 0.999866 | 5.182938 |
9432a267-a920-49eb-86e7-1f07e02b353d | coolwind0202/AtCoder | cpp_problems/abc075_b.cpp | #include <iostream>
#include <vector>
using namespace std;
bool isValidIndex(int H, int W, int y, int x)
{
if (y < 0 || H <= y)
return false;
if (x < 0 || W <= x)
return false;
return true;
}
int main(void)
{
int H = 0, W = 0;
cin >> H >> W;
vector<string> s(H);
vector<vector<int>> a(H);
for... | ALGO | 0.999778 | 4.44067 |
5a0f910c-8804-4942-9fea-1e4f2e821c5c | plantainjuice/leetcode_book | 24.swap-nodes-in-pairs.cpp | /*
* @lc app=leetcode id=24 lang=cpp
*
* [24] Swap Nodes in Pairs
*/
// @lc code=start
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode... | ALGO | 0.999935 | 6.626673 |
a735fc43-9663-46ca-a347-3166dfa12a88 | UtkarshGupta17/questions | 3276-minimum-number-of-pushes-to-type-word-ii/3276-minimum-number-of-pushes-to-type-word-ii.cpp | class Solution {
public:
int minimumPushes(string word) {
vector<int> vt(26,0);
for(auto& c : word){
vt[c-'a']++;
}
sort(vt.begin(),vt.end(),greater<int>());
int res = 0;
for(int i = 0 ; i < 26 ; i++){
int freq = vt[i];
int press = (i/8) + 1;
... | ALGO | 0.999991 | 5.451427 |
2f832e0c-ff7d-4582-98f1-1ba7d5c095e3 | fffelix-huang/Waimai | codes/Data-Structure/segtree-beats.cpp | struct segtree_beats {
static constexpr ll INF = numeric_limits<ll>::max() / 2.1;
struct alignas(32) Node {
ll sum = 0, g1 = 0, l1 = 0;
ll g2 = -INF, gc = 1, l2 = INF, lc = 1, add = 0;
};
ll n, log;
vector<Node> v;
segtree_beats() {}
segtree_beats(int _n) : segtree_beats(vector<ll>(_n)) {}
segtree_beats(con... | ALGO | 0.999933 | 5.093015 |
0db2665c-e875-42f3-9594-561a3d26a9ee | imMadhavMohan/DSA | LinkedList/midOfLL.cpp | #include <iostream>
#include <algorithm>
using namespace std;
class Node{
public:
Node* next;
int val;
Node(int val):val(val), next(nullptr) {
}
};
Node* insertNodeBegin(Node* node, Node* head){ // insertion in beginning
if(head == nullptr)
return node;
N... | ALGO | 0.999533 | 5.221591 |
445dcfb1-656a-4b77-96ec-7ef1f25054c0 | ganesh2shiv/jump-ninja | andengine-physicsbox2d-extension/jni/Box2D/Collision/Shapes/b2PolygonShape.cpp | #include "Box2D/Collision/Shapes/b2PolygonShape.h"
#include <new>
b2Shape* b2PolygonShape::Clone(b2BlockAllocator* allocator) const
{
void* mem = allocator->Allocate(sizeof(b2PolygonShape));
b2PolygonShape* clone = new (mem) b2PolygonShape;
*clone = *this;
return clone;
}
void b2PolygonShape::SetAsBox(float32 hx,... | ALGO | 0.976758 | 7.930733 |
577e5451-8b82-4768-a4d5-e101f4e6a57d | JoUnhee/Algorithm | BOJ/BOJ_5427.cpp | #include<cstring>
#include<iostream>
#include<algorithm>
#include<queue>
using namespace std;
int w, h;
int T;
int ret;
char map[1000][1000];
bool visit[1000][1000];
bool visit2[1000][1000];
int dx[4] = { -1,0,1,0 };
int dy[4] = { 0,-1,0,1 };
queue<pair<int, int>> fire;
queue<pair<int, int>> q;
bool escape(int x, ... | ALGO | 0.999882 | 4.426301 |
58a3b4bd-5e6b-4f60-befa-9d634a32a08d | catarinaopires/cal_20_21 | CAL-Quickstart/TP1/ex6.cpp | // By: Gonçalo Leão
#include "exercises.h"
#include <algorithm>
bool Activity::operator==(const Activity &a2) const {
return start == a2.start && finish == a2.finish;
}
bool Activity::operator<(const Activity &a2) const {
return finish < a2.finish;
}
std::vector<Activity> earliestFinishScheduling(std::vecto... | ALGO | 0.999085 | 6.109744 |
f5ad4e42-3b87-41b1-b847-ea763e03de28 | sdwalker233/ICPC | HDU/BestCoder/#75(2016.3.12)/1004打表.cpp | #include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
int n;
int nxt[5010],fr[5010];
bool vis[5010];
void fuck()
{
int i,cur;
memset(vis,0,sizeof(vis));
//scanf("%d",&n);
for(i=1;i<=n;i++){
fr[i]=i-1;
nxt[i]=i+1;
}
fr[1]=n;nxt[n]=1;cur=n;
for(int t=1;t<n;t++){
... | ALGO | 0.999706 | 3.528298 |
a15b07cd-057e-4756-a327-b93c1a11e403 | kunyavskiy/competitive-programming-archive | UniversalCup/20241019/E.cpp | #include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#includ... | ALGO | 0.999802 | 3.891317 |
710266f2-31f3-4dee-9ed3-a009f83f4424 | calm-lab/online-judge | 1759.cpp | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
bool check(string &password) {
int ja = 0;
int mo = 0;
for (char x : password) { //모음 2개이상, 자음 1개여야 하는 조건을 체크
if (x == 'a' || x == 'e' || x == 'i' || x == 'o' || x == 'u') {
mo += 1;
... | ALGO | 0.999958 | 4.032647 |
c58929d8-b3c3-4906-b599-d313f814016b | hashoak/CPP-programs | 22-6-2@deletion_in_doubly_linked_list.cpp | #include<bits/stdc++.h>
using namespace std;
class node
{
public:
int data;
node* prev,*next;
node(int val)
{
prev=NULL;
data=val;
next=NULL;
}
};
void insertAtTail(node* &head, int val)
{
node* n=new node(val);
if(head==NULL)
{
head=n;
retu... | ALGO | 0.999785 | 4.309772 |
c77874e3-ec1b-4dc9-9d28-13843a7391f3 | Munesanz/GuardianOMP | llvm/tools/llvm-exegesis/lib/SnippetGenerator.cpp | #include <array>
#include <string>
#include "Assembler.h"
#include "Error.h"
#include "MCInstrDescView.h"
#include "SnippetGenerator.h"
#include "Target.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Twine.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/FormatVa... | TOOL | 0.936376 | 7.66828 |
50e2e1ee-877b-4ce4-a348-96849cf58c5a | BigUrsula/ursa | src/crypto/aes.cpp | #include <crypto/aes.h>
#include <crypto/common.h>
#include <assert.h>
#include <string.h>
extern "C" {
#include <crypto/ctaes/ctaes.c>
}
AES128Encrypt::AES128Encrypt(const unsigned char key[16])
{
AES128_init(&ctx, key);
}
AES128Encrypt::~AES128Encrypt()
{
memset(&ctx, 0, sizeof(ctx));
}
void AES128Encryp... | TOOL | 0.963622 | 7.611703 |
fb9bb2a0-aa71-4829-a5da-fe3ad62a245a | Mosina916/CBNOIDAOCT21 | Lecture16/permutation.cpp | #include<iostream>
using namespace std;
void permuattion(char *in,int i){
// base case
if(in[i]=='\0'){
cout<<in<<endl;
return;
}
// recursive case
for(int j=i;in[j]!='\0';j++){
swap(in[i],in[j]);
permuattion(in,i+1);
swap(in[i],in[j]);//bracktracking
}
}
int main(){
char inp[100];
cin>>inp;//abc
per... | ALGO | 0.999873 | 4.27942 |
ae2a4364-a5a6-4e55-9fb6-6d349490e22c | PootieT/explain-then-translate | CodeGenMirror/data/transcoder_evaluation_gfg_fixed/cpp/NTH_EVEN_LENGTH_PALINDROME.cpp | #include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <fstream>
#include <iomanip>
#include <bits/stdc++.h>
using namespace std;
string f_gold ( string n ) {
string res = n;
for ( int j = n . length ( ) - 1;
j >= 0;
-- j ) res += n [ j ];
return res;
}
//TOFILL
int main() {
... | TEST | 0.961706 | 5.032367 |
0defe35f-b528-4d7e-9618-f91795c09a72 | 6604062630030/Homework | lab/graph_1/graph1_6.cpp | #include <bits/stdc++.h>
using namespace std;
class Graph {
private:
unordered_map<int, vector<int>> g;
int nVertex;
int shortestPath(int src, int dest) { // shortest path ver. undirected/directed unweight BFS
map<int, int> distance;
distance[src] = 0;
queue<int> q;
q.push(src);
while (!q... | ALGO | 0.999788 | 4.186591 |
5bf1117d-5338-4c1a-8e33-1a36c30e031d | starryeye/algorithm-problem-hub | 프로그래머스/2/42584. 주식가격/주식가격.cpp | #include <string>
#include <vector>
#include <stack>
using namespace std;
vector<int> solution(vector<int> prices) {
int n = prices.size();
vector<int> answer(n, 0);
stack<int> rising_stock; // 가격이 떨어지지 않은 시점(index)들을 모은다.
for (int i = 0; i < n; i++) {
while (!rising_s... | ALGO | 0.999733 | 5.98089 |
2783685d-69b7-4090-8e5f-769456aabdd2 | McKay42/McEngine | McEngine/libraries/bullet/include/BulletCollision/NarrowPhaseCollision/btContinuousConvexCollision.cpp | #include "btContinuousConvexCollision.h"
#include "BulletCollision/CollisionShapes/btConvexShape.h"
#include "BulletCollision/NarrowPhaseCollision/btSimplexSolverInterface.h"
#include "LinearMath/btTransformUtil.h"
#include "BulletCollision/CollisionShapes/btSphereShape.h"
#include "btGjkPairDetector.h"
#include "btPo... | ALGO | 0.999588 | 4.88414 |
1f2a8389-b237-4089-99a2-82f3c525b9d1 | zongxinqi/Code | C-C++/acm/robberies.cpp | #include<bits/stdc++.h>
using namespace std;
const int maxn = 10010;
int main()
{
ios::sync_with_stdio();
cin.tie();
int t;cin>>t;
while(t--){
double p;int m; cin>>p>>m;
int mo[maxn] = {0};
double pi[maxn] = {0};
double dp[maxn] = {0};
int sum = 0;
for(int i = 1;i <= m;i++){
cin>>mo[i]>>pi[i];
sum... | ALGO | 0.999971 | 3.363419 |
8d5f900e-4708-437c-8998-ae4bcea70159 | redpanda321/Icefox | ios5/mozilla-central/content/base/src/nsTextFragmentSSE2.cpp | // This file should only be compiled if you're on x86 or x86_64. Additionally,
// you'll need to compile this file with -msse2 if you're using gcc.
#include <emmintrin.h>
#include "nscore.h"
#include "nsAlgorithm.h"
namespace mozilla {
namespace SSE2 {
static inline bool
is_zero (__m128i x)
{
return
_mm_movem... | ALGO | 0.978532 | 6.184844 |
e35d74ef-8d4f-499f-9efa-16f8670fb8a8 | Sandi2156/TLE-Eliminators-Level-2-Problems | 14-graphs/32_dark_roads.cpp | #include <bits/stdc++.h> // This will work only for g++ compiler.
#define for0(i, n) for (int i = 0; i < (int)(n); ++i) // 0 based indexing
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i) // 1 based indexing
#define forc(i, l, r) for (int i = (int)(l); i <= (int)(r); ++i) // closed interver from l to r r inclu... | ALGO | 0.999952 | 4.72753 |
432c4911-a6e6-4b22-863a-e0adc564ab77 | cxlove/ACM_ICPC | Online_judge/poj/poj_3832.cpp | #include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#define lson step << 1
#define rson step << 1 | 1
using namespace std;
typedef long long LL;
const int N = 100005;
struct Scan_line {
int y , x1 , x2 , f;
Scan_line () {}
Scan_line (int _y , int _x1 , int _x2 , int _f)... | ALGO | 0.999027 | 3.116375 |
92800ee3-10e7-480a-af3e-cf0396ef09ee | itachi1101/CodeForces | Ladder/Ladder_B/queue_at_school.cpp | #include<bits/stdc++.h>
using namespace std;
#define mem(x,y) memset(x,y,sizeof(x))
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define MOD 1000000007
#define PI 3.141592653589793
#define setBitCount(x) __builtin_popcount(x)
#define all(a) (a).begin(), (a).end()
#define all_r(a) (a).rbe... | ALGO | 0.999838 | 4.251363 |
139be37d-9576-48a6-88e5-7d7f4b91d894 | AnimismFudan/Animism | 2016-10-26-2016-2017 ACM-ICPC NEERC Southern Subregional Contest/K/spj.cpp | #include <bits/stdc++.h>
using namespace std;
int Test, N, M, pt, S, T, l, r;
bool ok;
char s1[400010], s2[400010];
int st[400010], ne[2000010], go[2000010];
int q[400010], in[400010], out[400010];
void Add(int x, int y){
ne[++pt] = st[x];
st[x] = pt;
go[pt] = y;
}
int main(){
freopen("K.in", "r", stdin);
scanf... | ALGO | 0.999827 | 3.74084 |
eb8d0829-0dd0-4101-939b-082b4ad1f207 | kminami0/AtCoder | atcoder.jp/abc216/abc216_c/Main.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define all(v) begin(v), end(v)
#define sz(v) v.size()
#define INF 1e18+999999
#define EPSILON 1e-14
template <typename T>
bool chmax(T &a, cons... | ALGO | 0.999975 | 5.079608 |
aab0f56d-d60e-419b-9fe0-90329bc1d663 | harshil93/Competitive-Programming | codechef/oct challenge/yetanothergirl.cpp | #include <iostream>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <stack>
#include <map>
#include <set>
using namespace std;
#define PR(x) cout << #x " = " << x << "\n";
int main(){
int t;
scanf("%d",&t);
w... | ALGO | 0.99986 | 3.589893 |
f2ec27ec-9e52-4322-a9b9-df46505eadad | WeakBoss/arcsim | thirdInclude/alglib/diffequations.cpp | #ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif
#include "stdafx.h"
#include "diffequations.h"
// disable some irrelevant warnings
#if (AE_COMPILER==AE_MSVC) && !defined(AE_ALL_WARNINGS)
#pragma warning(disable:4100)
#pragma warning(disable:4127)
#pragma warning(disable:4611)
#pragma warning(disable:4702)
#prag... | ALGO | 0.998259 | 7.033234 |
0e9be027-c69a-4bf4-99da-a39d27e3d4dd | ttamx/Competitive-Programming | atcoder/dp/C_Vacation.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e5+5;
int n;
ll a[N],b[N],c[N],dp[N][3];
int main(){
cin.tie(nullptr)->sync_with_stdio(false);
cin >> n;
for(int i=1;i<=n;i++)cin >> a[i] >> b[i] >> c[i];
for(int i=1;i<=n;i++){
dp[i][0]=max(dp[i-1][1],dp[i-1][2... | ALGO | 0.999939 | 3.968697 |
de8e8dd7-a377-4c9d-858c-b488d526b169 | LineNo2/PS | class_5/class_5_essentials/2623.cpp | #include <bits/stdc++.h>
#define MAX_N 1001
#define endl "\n"
using namespace std;
int N, M;
vector<int> orders[MAX_N];
int inorder[MAX_N];
int program_order[MAX_N];
int main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int cnt, from, to;
cin >> N >> M;
for(int i = 0 ; i < M... | ALGO | 0.999995 | 4.363739 |
4e3ae7e7-5f4c-4f03-96d7-59efb34fe9fb | jcazevedo/leetcode | src/1146-snapshot-array.cpp | // 1146. Snapshot Array
// https://leetcode.com/problems/snapshot-array/
#include <utility>
#include <vector>
using namespace std;
class SnapshotArray {
private:
int snapId;
vector<vector<pair<int, int>>> values;
public:
SnapshotArray(int length)
: snapId(0), values(vector<vector<pair<int, int>>>(leng... | ALGO | 0.965846 | 6.369237 |
42275692-98a6-49f2-93e6-5e354420af37 | ArthurSyngL/Programa--o | ATP/Lista6-p3/Questao03.cpp | #include <iostream>
using namespace std;
int potencia(float X, float Z){
int i, pot = 1;
for(i = 0; i<Z; i++){
pot = pot * X;
}
return pot;
}
int main(){
float x1, x2, z1, z2;
cin>>x1>>x2>>z1>>z2;
if(potencia(x1, z1)>potencia(x2, z2))
cout<<"Potencia 1";
else cout<<"Pot... | ALGO | 0.997319 | 3.848732 |
99ffb484-370d-47f0-b1cf-afe2bddc410c | Mulab11/cntt2016-hw1 | TC-SRM-595-div1-250/qiaoranliqu.cpp | #include<cstdio>
#include<algorithm>
#include<cstring>
#include<vector>
using namespace std;
#define N 1005
int i,j,m,n,p,k,vis[N];
class LittleElephantAndIntervalsDiv1{
public:
long long getNumber(int n,vector<int> L,vector<int> R)
{
m=R.size(); long long ans=1;
for (i=m-1;i>=0;--i)
{
... | ALGO | 0.999752 | 3.72091 |
0adb2169-13ad-42f9-9465-4185a6e1f218 | YttriumWillow/OI | Problems/P1939.cpp | // Problem: P1939 【模板】矩阵加速(数列)
// Contest: Luogu
// URL: https://www.luogu.com.cn/problem/P1939
// Memory Limit: 125 MB
// Time Limit: 1000 ms
// Created Time: 2023-03-04 14:40:48
#include <iostream>
#include <cstring>
#define i64 long long
#define reg register
#define qwq puts("fzy qwq ~");
u... | ALGO | 0.999963 | 4.479445 |
b6b03d36-a3da-4fc2-b5e5-a110610ec286 | rollschild/hackerrank | WireRemoval.cpp | #include <bits/stdc++.h>
using namespace std;
vector<vector<int>> forest(100001);
vector<bool> occupied(100001);
vector<int> tree(100001);
int n = 0;
long long nodes = 0;
long long total_distance = 0;
void dfs(int root, int distance) {
occupied[root] = 1;
tree[root] = 1;
for(auto i : forest[root]) {
... | ALGO | 0.999572 | 4.510282 |
ac73e3c9-ab76-4e4c-87b0-d6463462b9e1 | matheuscr30/UVA | Problem Solving Paradigms/166 - Making Change/166 - Making Change.cpp | #include <bits/stdc++.h>
#define endl '\n'
using namespace std;
typedef long long int ll;
vector<ll>vet;
ll buy, dp[10][1005];
ll solve(ll current, ll sum)
{
if (current >= 6 || sum < 0)
return INT_MAX;
if (sum == 0)
return 0;
ll &re = dp[current][sum];
if (re != -1)
return re;
ll ans, n1, n2;
n1 = ... | ALGO | 0.997057 | 3.390625 |
ebe6c73c-2e6f-496e-b050-99e7ca75f864 | kobe24o/LeetCode | algorithm/leetcode5379.stone-game-iii.cpp | class Solution {
public:
string stoneGameIII(vector<int>& stoneValue) {
int i, n = stoneValue.size(), sum = 0;
vector<int> dp(n+3,0);
for(i = n-1; i >= 0; --i)
{
sum += stoneValue[i];
dp[i] = max(max(sum-dp[i+3], sum-dp[i+2]),sum-dp[i+1]);
}
if... | ALGO | 0.999981 | 5.663184 |
fbdbabdd-daf1-4326-a315-b4e030303b13 | romeorizzi/portafoglioVoti_public | Algoritmi/2019-07-30/all-CMS-submissions/2019-07-30.09:45:31.638023.VR434292.online_budget_opt.cpp | /**
* user: VR434292
* fname: EMPORIO
* lname: MARCO
* task: online_budget_opt
* score: 0.0
* date: 2019-07-30 09:45:31.638023
*/
/**
* Template per soluzione in c++ per il problema online_budget_opt
*
* Romeo Rizzi, 2019-07-28
*
*/
#include <cassert>
#include <iostream>
using namespace std;
const int MAX_N... | ALGO | 0.999517 | 3.860152 |
ae20e56f-f580-48c1-96ac-af159923b2d1 | shiva92/Contests | Learning/Contests/Codechef/Mar/Long/STRPALIN_PalindromincSub.cpp | #include <cstdio>
#include <bitset>
#include <cstring>
#define vi vector<int>
#define all(v) v.begin(),v.end()
#define pii pair<int,int>
#define mp make_pair
using namespace std;
int main() {
#ifndef ONLINE_JUDGE
freopen("/home/shiva/Learning/1.txt", "r", stdin);
freopen("/home/shiva/Learning/2.txt", "w", stdout);
#e... | ALGO | 0.99999 | 4.20086 |
926efd65-b961-4b52-a2c9-55561c5fc25e | AnkitChauhan19/DSA | DAC/MinMax.cpp | #include <iostream>
#include <vector>
#define MIN 99999999
#define MAX -99999999
using namespace std;
vector<int> DACminmax(int A[], int i, int j, int min, int max){
if(i == j){
min = A[i]; max = A[i];
vector<int> arr = {min, max};
return arr;
}
else if(i == j - 1){
if(A[i] ... | ALGO | 0.999982 | 4.285297 |
de07ec60-6536-4e16-9735-a68af532b18b | AayushkumarPathak/C-DSA-OOPs | Stack&Queue/stack1.cpp | #include<iostream>
using namespace std;
//using LinkedList
class Node{
public:
int data;
Node* next;
Node(int data){
this->data = data;
this->next = NULL;
}
};
class Stack{
private:
Node* head;
public:
Stack(){
this->head = NULL;
}
bool isEmpty()... | ALGO | 0.99982 | 4.768452 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.