uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
c927ae72-cd7f-49b7-a01f-6bb71b4d7460 | rusucosmin/courses | ubb/acm/onis2016-r2/d.cpp | #include <stdio.h>
#include <iostream>
#include <vector>
#include <queue>
#include <string.h>
#include <fstream>
#include <set>
#include <bitset>
using namespace std;
const int maxn = 100005;
const int oo = 0x3f3f3f3f;
vector <int> g[maxn];
int n, m, diam[maxn], diamup[maxn], up[maxn], depth[maxn];
inline void dfs_... | ALGO | 0.999796 | 4.636136 |
d21db300-5a7a-4672-a903-2001e51f61e2 | Joaco-gavernet/competitive-programming | cses/introductory-problems/tower-of-hanoi.cpp | #include <bits/stdc++.h>
using namespace std;
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
// neal Debugger
template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; }
template<typename T_container, type... | ALGO | 0.999887 | 3.749136 |
5a7d620d-3d4e-482b-a947-5a161cb236ab | Benyuga/CppHackerRank | C++/Easy/Variable Sized Arrays.cpp | #include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
/* Enter your code here. Read input from STDIN. Print output to STDOUT */
int n,q,k,i,j,x;
vector<vector<int>> answer;
vector<int> temp;
cin>>n>>q;
for(;n!=0;--n){
... | ALGO | 0.999772 | 3.311594 |
d5ddc7f1-2204-4fd9-9dfa-cd49e7bec027 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_12155_13.cpp | #include <bits/stdc++.h>
using namespace std;
bool checkempty(vector<vector<char>> &a, int i, int j) {
if (i - 1 >= 0) {
if (a[i - 1][j] == '*') {
return false;
}
}
if (i + 1 < a.size()) {
if (a[i + 1][j] == '*') {
return false;
}
}
if (j - 1 >= 0) {
if (a[i][j - 1] == '*') {
... | ALGO | 0.999974 | 4.403269 |
f6b8e02d-617a-4db0-ab58-5ef90d20cfdd | sara-1129/-My-DSA-Portfolio | 1894-merge-strings-alternately/merge-strings-alternately.cpp | class Solution {
public:
string mergeAlternately(string word1, string word2) {
int n = word1.size();
int m = word2.size();
int i = 0;
int j = 0;
string ans = "";
while(i < n || j < m)
{
if(i < n)
{
ans += word1[i];
... | ALGO | 0.999966 | 5.893861 |
b6baaec8-72df-4310-9b39-6d5e4d5720c5 | Moustafa25MM/Problem-Solving-using-c-plus-plus | 469A -I Wanna Be the Guy.cpp | #include <iostream>
#include <bits/stdc++.h>
using namespace std;//469A -I Wanna Be the Guy
int main()
{
int n;
cin >> n;
int arr[n+1];
int p,q,level;
cin >> p;
for (int i =0;i<p;i++){
cin >> level;
arr[level] = 1;
}
cin >> q;
for (int i =0;i<q;i++){
... | ALGO | 0.99964 | 3.30386 |
68054e9b-9da0-4da6-b1a4-4afda5b412e8 | anmolkmr/leetcode_solutions | 1354-find-players-with-zero-or-one-losses/find-players-with-zero-or-one-losses.cpp | class Solution {
public:
vector<vector<int>> findWinners(vector<vector<int>>& matches) {
vector<int> ans0,ans1;
map<int,int> mp;
for(auto it:matches)
{
mp[it[1]]++;
}
for(auto it:mp)
{
if(it.second==1)ans1.push_back(it.first);
}
f... | ALGO | 0.999821 | 5.643816 |
227f5b77-41df-4048-b3f0-346c61060442 | MRYoungITO/CPP_Learning | Secondary_Pointer/函数指针/函数指针.cpp | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
int compare_int(const void *a, const void *b) {
//printf("compare_int , ɧŶ!\n");
int *a1 = (int *) a;
int *b1 = (int *) b;
//printf("a ĵַ: 0x%p, b ĵַ: 0x%p\n", &a, &b);
return *a1 - *b1;
}
int compare_char(const void *a, const void *b) {
//printf("comp... | ALGO | 0.999286 | 4.183255 |
e20ac6e2-efe2-4318-824f-f7711b715b1f | SahilKasare/Leetcode-Solutions | 3163-string-compression-iii/3163-string-compression-iii.cpp | class Solution {
public:
string compressedString(string word) {
std::string answer;
int i = 0;
while (i < word.size()) {
char c = word[i];
int count = 0;
while (i < word.size() && word[i] == c && count < 9) {
count++;
i++;
... | ALGO | 0.999996 | 6.419317 |
97291799-3e0d-4246-9e79-47a40786aa64 | Pavankundrapu/leetcode_submissions | 2047-find-a-peak-element-ii/find-a-peak-element-ii.cpp | class Solution {
public:
int find(vector<vector<int>>& mat,int rows,int cols,int currentcol)
{
int max = -1;
int row = 0;
for(int i = 0;i<rows;i++)
{
if(mat[i][currentcol] > max)
{
max = mat[i][currentcol];
row = i;
... | ALGO | 0.999981 | 5.613572 |
17553f71-2b29-4f0b-b2ad-0bd8f61e535a | paul2705/OI | contact/EFZ/18.11.6/2018.11.06成七/source/\272\274\266\376-\263\365\310\375-\301\372\314\354\375\214/picture.cpp | #include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<vector>
#define N (1000010)
#define inf (0x7f7f7f7f)
#define rg register int
#define Label puts("NAIVE")
typedef long double ld;
typedef long long LL;
typedef unsigned long long ull;
using namespace std;
int n,m,n1,m1,cnt... | ALGO | 0.999606 | 3.110736 |
d51f7eac-078c-4a56-b5bf-8b41bd2503fa | vtil-project/VTIL-SymEx | expressions/expression.cpp | namespace vtil::symbolic
{
// Returns the number of constants used in the expression.
//
size_t expression::count_constants() const
{
if ( is_constant() )
return 1;
return ( lhs ? lhs->count_constants() : 0 ) +
( rhs ? rhs->count_constants() : 0 );
}
// Returns the number of variables used in the expre... | TOOL | 0.938803 | 7.770657 |
eeac11ad-45c3-4688-88f1-8616c186387e | candy5005k/Programs-1-to-500 | program182.cpp | #include<iostream>
using namespace std;
int CountCapital(char str[])
{
int iCnt = 0;
while(*str != '\0')
{
if((*str == 'a') || (*str == 'e') || (*str == 'i') || (*str == 'o') || (*str == 'u') || (*str == 'A') || (*str == 'E') || (*str == 'I') || (*str == 'O') || (*str == 'U'))
{
... | ALGO | 0.998641 | 4.8882 |
9c9cbd1f-dfec-45b1-b4b9-24d6da24469a | PabloMira12/PilasListas | Cola.cpp | #include "Cola.h"
#include<iostream>
using namespace std;
Cola::Cola(int T)
{
Limite = T - 1;
Tope = -1;
Vcola = new int[T];
}
void Cola::Encolar(int d)
{
Tope++;
Vcola[Tope] = d;
}
int Cola::Desencolar()
{
int r = Vcola[0], I = 1;
while (I <= Tope)
{
Vcola[I - 1] = Vcola[I];
I++;
}
Tope--;
return r;
... | ALGO | 0.991296 | 4.263743 |
754b19c0-8f26-4061-bbf2-6968a3f8987d | sharmadeepak1999/leetcode-problems | 0031-next-permutation/0031-next-permutation.cpp | class Solution {
public:
void nextPermutation(vector<int>& nums) {
int i = nums.size() - 1;
int j = -1;
while(i > 0) {
if(nums[i - 1] < nums[i]) {
j = i - 1;
break;
}
i--;
}
if(j == -1) {
reverse(... | ALGO | 0.99999 | 5.38332 |
a9ef64ce-14c7-4a05-a4f7-f74d199f6b56 | NikitaOrehov/Iterator | main.cpp | #include <iostream>
#include <vector>
#include "IntArr.h"
#include "MyForwardList.h"
int main(){
MyForwardList<int> f;
f.AddNode(15);
f.AddNode(20);
f.AddNode(15);
f.AddNode(20);
f.AddNode(4);
f.AddNode(15);
std::cout << f << "\n";
int array[2]{ 15, 4 };
f.DeleteElem(array, 2);
... | ALGO | 0.97575 | 3.82825 |
4d41c591-8a34-48a8-a1fc-9e7d73e5b6d6 | Gondir33/EducationCppstuff | yandex6/yandex7.cpp | #include <iostream>
int main() {
long long n, m, t;
std::cin >> n >> m >> t;
long long l = 0, r = std::min(n, m), mid, res;
while (l < r) {
mid = (l + r + 1) / 2;
res = mid * (2 * n + 2 * m - 4 * mid);
if (res < t)
l = mid;
else if (res == t) {
l = mid;
break;
}
else
r = mid - 1;
}
if (r... | ALGO | 0.999935 | 3.744095 |
4e49a45a-d9fb-4e5f-9f94-51d7b2434be4 | ankur-kayal/Contests | codeforces/1474/C.cpp | #include <algorithm>
#include <bits/stdc++.h>
#include <cstdint>
using namespace std;
//----------------------------------- DEBUG -----------------------------------
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
enable_if<sizeof dud<c>(0) x 1... | ALGO | 0.999847 | 3.974472 |
8f862eb9-eb14-459f-8cd0-443e74855981 | ylwang0425/algorithm-learn | 3.11/3.11.7.cpp |
//
// Created by wyl on 2022/3/11.
//
#include<bits/stdc++.h>
using namespace std;
const int N = 1010;
int n1,n2,m;
vector<int> G[N];
int match[N];
bool used[N];
bool find(int x){
for(int i=0;i<G[x].size();i++){
int j = G[x][i];
if(!used[j]){
used[j]=true;
if(match[j]==0||f... | ALGO | 0.999542 | 4.194345 |
00989602-2335-4a1e-9a7f-f4009c5104d8 | AncelCarson/School-Projects | CS1/C++/Average_mk2.cpp | #include <iostream>
using namespace std;
int main ()
{
// Ancel Carson
float number, subTotal, divisor, theAverage;
divisor = 0;
subTotal = 0;
cout << "Enter your first number.\n";
cin >> number;
divisor = 1;
subTotal = number;
while (true)
{
cout << "Enter your next number. If you ... | TOOL | 0.98961 | 3.146098 |
db6ecad1-9c1d-4d6b-9a96-367ee260efc1 | mennamoussa/simple_to_do | 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 |
4bf21692-b826-427a-a1de-f16ad1fed9ba | ShyamB123/Learning_cpp | NumberTheory/ModuloProperties.cpp | #include<bits/stdc++.h>
#define mod 10000007
using namespace std;
int main()
{
int a,b;
cin>>a>>b;
// 1. (a+b)%mod = (a%mod + b%mod)%mod
if((a+b)%mod == (a%mod + b%mod)%mod)
cout << "same"<<endl;
// 2. (a-b)%mod = (a%mod - b%mod + mod)%mod
if((a-b)%mod == (a%mod - b%mod + mod)%mo... | ALGO | 0.999985 | 3.541515 |
8d84522d-2392-4e06-ae44-8e07444cd83a | rampa2510/dsa | .ccls-cache/@Users@rampa2510@Desktop@algo/ArrayProblems@invertDigit.cpp | #include <iostream>
using namespace std;
int main() {
string s, t;
int c = 0, n;
cin >> s;
for (char z : s) {
t = s;
if (c != 0 || t[0] != '9') {
n = t[c] - '0';
if (n >= 5) {
n = 9 - n;
t[c] = n + '0';
if (t < s)
s = t;
}
}
c++;
}
cout <... | ALGO | 0.999959 | 4.76884 |
892c075b-1b6f-4205-a075-06b24b749e9d | mdh-planner/EpistemicPlanning | eigen-master/doc/examples/DenseBase_middleCols_int.cpp | #include <Eigen/Core>
#include <iostream>
int main() {
int const N = 5;
Eigen::MatrixXi A(N, N);
A.setRandom();
std::cout << "A =\n" << A << '\n' << std::endl;
std::cout << "A(1..3,:) =\n" << A.middleCols(1, 3) << std::endl;
return 0;
}
| ALGO | 0.972544 | 3.566208 |
8b48b8b1-0644-4ab6-8af1-a23c6047f4cf | MingzhenY/code-warehouse | CodingWebsites/WHU_OJ/Volume4/P1358.cpp | #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#define LL long long
using namespace std;
int main(){
freopen("P1358.txt","r",stdin);
int t,a,b;
scanf("%d",&t);
while(t-->0){
scanf("%d%d",&a,&b);
LL ANS = (LL) a * b - a - b;
cout<<ANS<<endl;
}
... | ALGO | 0.999752 | 4.060879 |
95fb2440-c5fc-4260-8b2b-289d2a5e3444 | Hasanul-Bari/contests | Educational Codeforces Round 99 (Rated for Div. 2)/C. Ping-pong.cpp | #include<bits/stdc++.h>
#define faster ios :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define ull unsigned long long
#define pb push_back
const double PI = acos(-1.0);
using namespace std;
int main()
{
faster
int t,x,y;
cin>>t;
while(t--)
{
cin>>x>>y;
c... | ALGO | 0.999696 | 3.905736 |
c237c24e-b12d-4ac6-bf59-ebdc7155ea54 | zxyDEDIRE/ACM_CODE | 多校/2023“钉耙编程”中国大学生算法设计超级联赛(4)/7321.cpp | /*
嵌套变量重复 特殊样例 0 1 2 n 数组越界 开long long
清空 建图别用vector
*/
#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define pp(x) array<int,x>
using ull=unsigned long long;
using ll=long long;
using pii=pair<int,int>;
using pdd=pair<double,double>;
const int dx[]={0,0,1,-1,1,-1,1,-1};
const int dy[]={1,-1,0,0,1,-1... | ALGO | 0.999976 | 4.440402 |
6d081a59-c745-4142-a60c-30ecba313937 | aleksanderZak7/SPOJ | C++/Liczby Pierwsze.cpp | #include <cmath>
#include <iostream>
bool is_prime(const int& number)
{
if (number <= 1)
return false;
for (int i = 2; i <= sqrt(number); ++i)
if (number % i == 0)
return false;
return true;
}
int main()
{
int n;
int number;
std::cin >> n;
while (n--)
{
... | ALGO | 0.999884 | 5.739816 |
717dc765-95a8-4bee-9117-8e3c175431e4 | TBoehm/greedynode | src/rpcblockchain.cpp | #include "checkpoints.h"
#include "main.h"
#include "rpcserver.h"
#include "sync.h"
#include "util.h"
#include <stdint.h>
#include "json/json_spirit_value.h"
using namespace json_spirit;
using namespace std;
void ScriptPubKeyToJSON(const CScript& scriptPubKey, Object& out, bool fIncludeHex);
double GetDifficulty(c... | WEB | 0.909732 | 6.233338 |
a10584a0-9dc4-4f2a-acf5-f966a21eeece | Kuro-orzz/CP | Marisaoj/Level_2/STL/Containers_c++_in_standard_template_library/659.cpp | #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;
using ordered_set = tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>;
#define ll long long
#define MOD (ll)(1e9+7)
#define all(x) (x).b... | ALGO | 0.999974 | 4.418664 |
1c808402-76d1-45ef-983b-b3ca34836108 | randomyan/sofa | SofaKernel/framework/sofa/helper/system/FileRepository.cpp | #include <sofa/helper/system/FileRepository.h>
#include <sofa/helper/system/SetDirectory.h>
#include <sys/types.h>
#include <sys/stat.h>
#if defined(WIN32)
#include <windows.h>
#include <direct.h>
#elif defined(_XBOX)
#include <xtl.h>
#else
#include <unistd.h>
#endif
#include <boost/filesystem.hpp>
#include <boost/lo... | TOOL | 0.873571 | 6.227884 |
b1368a72-a3d9-410f-b70e-8d2f113bd68e | jongtae0509/codetree-TILs | 231122/자연수면 출력/output-only-natural-number.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int a,b; cin >> a >> b;
if(a>0) for(int i=0;i<b;i++) cout << a;
else cout << 0;
} | ALGO | 0.999841 | 3.226285 |
400bb40c-6f6a-4bc2-a1c8-9d3a7f26ec22 | ii-shimul/computer_algorithms_codes | lab_final_topics/4_Merging_Sorted_Array.cpp | #include <bits/stdc++.h>
using namespace std;
void merging(int A[], int B[], int C[], int m, int n) {
int i = 0, j = 0, k = 0;
while (i < m && j < n) {
if (A[i] < B[j]) {
C[k] = A[i];
k++; i++;
}
else {
C[k] = B[j];
k++; j++;
}
}
for (; i < m; i++)
{
C[k] = A[i];
... | ALGO | 0.999989 | 3.662235 |
0f4f6fa6-6c0c-4c19-8965-3d60ef435627 | spiritysdx/2021-Algorithm-design | 强连通分支.cpp | //显示中文
#define _CRT_SECURE_NO_WARNINGS
#include <windows.h>//用于函数SetConsoleOutputCP(65001);更改cmd编码为utf8
#include <ctime>
//函数结果状态代码
#define TRUE 1
#define FALSE 0
#define OK 1
#define ERROR 0
#define INFEASIBLE -1
#define ... | ALGO | 0.999638 | 3.452744 |
3ffd6e81-d9ea-4eb2-838c-7fbaf6bc447d | junstat/CppLearning | LeetCode/Q1699/Q1658/solution1/Solution.cpp | #include <vector>
#include <numeric>
using namespace std;
class Solution {
public:
int minOperations(vector<int> &nums, int x) {
int target = accumulate(nums.begin(), nums.end(), 0) - x;
if (target < 0) return -1;
int ans = -1, left = 0, sum = 0, n = nums.size();
for (int right = 0... | ALGO | 0.999974 | 5.699573 |
f9125f2d-1c90-4789-bf76-97d55f7000ba | ishandutta2007/codeforces | emilan/normal/714/B.cpp | #include <bits/stdc++.h>
using namespace std;
inline void ioThings() {
ios::sync_with_stdio(0);
cin.tie(0);
#ifdef LOCAL
freopen("io\\in.txt", "r", stdin);
freopen("io\\out.txt", "w", stdout);
#endif
}
using ll = long long;
#define debug(x) cerr << #x << ": <" << (x) << ">\n"
#define dotc() i... | ALGO | 0.999955 | 4.03927 |
f60e18f9-b526-4ae0-b9cb-9f31ed3b9a90 | rishab1128/LeetCode-Problems | reachable-nodes-in-subdivided-graph/reachable-nodes-in-subdivided-graph.cpp | class Solution {
public:
int reachableNodes(vector<vector<int>>& edges, int maxMoves, int n)
{
vector<pair<int,int>>adj[n];
for(int i=0; i<edges.size() ; i++)
{
int u=edges[i][0] , v=edges[i][1] , w=edges[i][2];
adj[u].push_back({v,w+1});
adj[v].push_... | ALGO | 0.99998 | 6.017999 |
166f9992-f39d-4056-9ed5-cc077782c6ae | Antarikchya-Prathisthan-Nepal/PX4-Autopilot | src/modules/ekf2/EKF/height_control.cpp | /**
* @file height_control.cpp
*/
#include "ekf.h"
void Ekf::controlHeightFusion(const imuSample &imu_delayed)
{
checkVerticalAccelerationBias(imu_delayed);
checkVerticalAccelerationHealth(imu_delayed);
#if defined(CONFIG_EKF2_BAROMETER)
updateGroundEffect();
controlBaroHeightFusion();
#endif // CONFIG_EKF2_B... | TOOL | 0.952938 | 7.45045 |
bd270384-c452-4039-b226-b16793f9d1d1 | aufanam/Competitive-Programming | 1433B.cpp | #include <bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
// code
int t, n, a, z, m;
bool start;
cin >> t;
while (t--)
{
cin >> n;
z = m = start = 0;
while (n--)
{
cin >>... | ALGO | 0.999709 | 4.585763 |
450f5a96-c128-4a60-88d6-2b34d5dd290c | Vinay-Yadav01/CrackYourInternship | 3600-find-the-k-th-character-in-string-game-i/3600-find-the-k-th-character-in-string-game-i.cpp | class Solution {
string f(string str) {
string ans = "";
for (char ch : str) {
ans += (ch - 'a' + 1) % 26 + 'a';
}
return ans;
}
public:
char kthCharacter(int k) {
string str = "a";
while (str.size() <= k) {
string next_str = f(str);
... | ALGO | 0.999912 | 4.62142 |
eeda1de1-7f2d-4d67-a2c4-5bc25b34fa88 | Lycheus/shore-llvm | llvm/lib/CodeGen/ExpandMemCmp.cpp | #include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/ConstantFolding.h"
#include "llvm/Analysis/TargetLibraryInfo.h"
#include "llvm/Analysis/TargetTransformInfo.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/CodeGen/TargetLowering.h"
#include "llvm/CodeGen/TargetPassConfig.h"
#include "llvm/CodeGen/Targe... | TOOL | 0.974003 | 7.891063 |
66079ba9-e97e-44fb-9990-5699879d9e01 | vserousov/Algorithms-Course | String Prefix Function Algorithms/main.cpp | #include <iostream>
#include <string>
using namespace std;
/*
Name + Surname: Serousov Vitaly
Group: 201(1)SE
Date: 02.12.2014
Task: String algorithms
IDE: Microsoft Visual Studio 2010
*/
// Find substring positions.
// Complexity O(n*m).
void find_substring_positions(string str, string substr);
// Find largest bor... | ALGO | 0.998144 | 4.731861 |
ad21a9cd-e193-46b4-bc5d-afb716806320 | Ash-codes18/Cpp_DSA | Programs/general/Apna college/10_break.cpp | #include <iostream>
using namespace std;
int main(){
for(int i=1; i<10; i++){
if(i==7){
break;
}
cout << i << endl;
}
return 0;
} | ALGO | 0.916005 | 3.048962 |
6589a8e3-446d-4559-99a0-921e802c6923 | mebsahle/Infix-Prefix-Postfix | main.cpp | #include <bits/stdc++.h>
#include "Stack.h"
using namespace std;
//doubt
int findprecedence(char ch)
{
switch (ch)
{
case'+':
case'-':
return 1;
case'*':
case'/':
case'%':
return 2;
case'^':
return 3;
}
}
Stack s1;
char ch;
char infix[100],postfix[100],prefi... | ALGO | 0.998432 | 4.20575 |
3a230887-4873-4d71-bd9f-a862f3cffe80 | artiam99/GeeksforGeeks | 15 Advanced Data Structures/6 N-Ary Trees/1 N-Ary Tree Basics.cpp | #include <bits/stdc++.h>
using namespace std;
struct Node
{
char key;
vector<Node*> child;
Node(char data)
{
key = data;
}
};
int Depth(Node* root)
{
if(!root) return 0;
int mx = 0;
for(int i = 0 ; i < root->child.size() ; i++)
mx = max(mx , Depth(root->child[i]));
return mx + 1;
}
void DFS(No... | ALGO | 0.999866 | 4.473224 |
7fec5784-8af7-4ce9-9559-af4f6bb3fb86 | Vaishnavi-Patil08/codes100 | Show_off.cpp | #include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include<bits/stdc++.h>
using namespace std;
void dfs(int n, int m,vector<vector<int>> &original,int i, int j)
{
if(i<0 || j<0 || i>n-1 || j>m-1 || original[i][j] != 1)
return;
if(original[i][j] == 1)
{
... | ALGO | 0.999925 | 4.287673 |
1e5ddafd-b09d-49c9-ad47-d882ed6a8d37 | Shruthi111/Cpp-Programs | Arraysandmatrix/matrixsearch.cpp | #include<iostream>
using namespace std;
int main(){
int n,m;
cin>>n>>m;
int a[n][m];
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
cin>>a[i][j];
}
}
int target;
cin>>target;
int r=0,c=m-1;
int flag=0;
while(r<n && c>=0){
if(a[r][c]==target){
... | ALGO | 0.999864 | 4.305913 |
fa2c079d-2c48-49ae-ac57-6dca8ec5a58e | ntxq/PS-Baekjoon | 2000~2999/2316.cpp | #include <algorithm>
#include <iostream>
#include <queue>
#include <vector>
bool bfs(int s, int t, const std::vector<std::vector<int>>& adj,
const std::vector<std::vector<bool>>& capacity,
std::vector<int>& parent) {
std::queue<int> q;
std::fill(parent.begin(), parent.end(), -1);
q.push(... | ALGO | 0.998547 | 4.510973 |
1333c621-ef3a-4525-90d1-0f73ac9a42fe | YeKYLI/leetcode | 待整理/leetcode-0.2.0/solution/2800-2899/2832.Maximal Range That Each Element Is Maximum in It/Solution.cpp | class Solution {
public:
vector<int> maximumLengthOfRanges(vector<int>& nums) {
int n = nums.size();
vector<int> left(n, -1);
vector<int> right(n, n);
stack<int> stk;
for (int i = 0; i < n; ++i) {
while (!stk.empty() && nums[stk.top()] <= nums[i]) {
... | ALGO | 0.99995 | 6.022643 |
3f5abd7b-f374-4b5d-88f5-c676c7119d50 | dhruvrjain/DSA | Leet_Code/Day_76_Add_Two_Numbers.cpp | /**
* 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 *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
ListNode* addTwoNumbe... | ALGO | 0.999933 | 6.278582 |
81f88db3-1880-4fb4-a2f9-62c15d09741d | orion-core/coin | src/node/psbt.cpp | #include <coins.h>
#include <consensus/amount.h>
#include <consensus/tx_verify.h>
#include <node/psbt.h>
#include <policy/policy.h>
#include <policy/settings.h>
#include <tinyformat.h>
#include <numeric>
namespace node {
PSBTAnalysis AnalyzePSBT(PartiallySignedTransaction psbtx)
{
// Go through each input and bui... | ALGO | 0.925863 | 6.181936 |
4925ee3f-7775-4e9b-8eb9-a19175492d9b | Harsh-91221/DSA-CODES | SWITCH AND FUNCTIONS/alpha.cpp | #include <iostream>
using namespace std;
int main()
{
int r, s, j, k, n, q;
cin >> q;
cin >> n;
switch (q)
{
case 1:
for (int i = 1; i <= n; i++)
{
r = n % 10;
s = s + r;
n = n / 10;
}
cout << s << endl;
break;
case... | ALGO | 0.998581 | 3.253046 |
fad655be-c499-44ad-a960-70d669711a08 | juruo-c/ACM | 22.09/22.09.02/CF1114F.cpp | #include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <cmath>
using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
const int N = 400005, mod = 1000000007;
int n, m;
int a[N];
int p[305];
bool vis[305]... | ALGO | 0.999868 | 3.959726 |
58af330a-4371-4a0c-9507-6740f431aee8 | Sunil93021/Xchange-Learn-Flutter-Project | xchange_learn/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.99841 | 6.76775 |
64c3f72c-8c82-4ecf-82c5-147f7e211afd | Gautumn/CodingInterviewChinese2-Xcode | 38_01_StringPermutation/38_01_StringPermutation/main.cpp | //==================================================================
// 《剑指Offer——名企面试官精讲典型编程题》代码
// 作者:何海涛
//==================================================================
// 面试题38:字符串的排列
// 题目:输入一个字符串,打印出该字符串中字符的所有排列。例如输入字符串abc,
// 则打印出由字符a、b、c所能排列出来的所有字符串abc、acb、bac、bca、cab和cba。
#include <cstdio>
#define Meth... | ALGO | 0.999301 | 4.838473 |
56921e4e-5064-4d85-b216-7678db0e7765 | gregbell26/TSA-Software-2019 | Acrylic_Backend/BackendAPIs/AcrylicAudio/AudioAPIs/OpenAL/alc/mixer/mixer_sse2.cpp | #include "config.h"
#include <xmmintrin.h>
#include <emmintrin.h>
#include "alu.h"
#include "defs.h"
template<>
const ALfloat *Resample_<LerpTag,SSE2Tag>(const InterpState*, const ALfloat *RESTRICT src,
ALuint frac, ALuint increment, const al::span<float> dst)
{
const __m128i increment4{_mm_set1_epi32(static... | ALGO | 0.996378 | 6.225313 |
eb93fd71-05e9-40a8-98dc-cc2ad7fba2ba | Ivan-71-ua/Competitive-Programming | LeetCode/482.cpp | #include <bits/stdc++.h>
class Solution {
public:
std::string licenseKeyFormatting(std::string s, int k) {
std::vector<std::string> res;
std::string tmp;
for (int i = s.size() -1; i >= 0; i--)
{
if(tmp.size() == k) {
std::reverse(tmp.begin(), tmp.end());
res.push_back(tmp);
tmp = "";
if(isa... | ALGO | 0.999869 | 5.809863 |
ec0d006a-e505-4887-a2bd-2a01c62b9ef0 | ArunabhPrakash/DSA_Codes_AP | png_codes/Coding-Problems-master/HashTable/quickbrownfox.cpp | #include<iostream>
#include<unordered_set>
#include<climits>
using namespace std;
string s = "thequickbrownfoxjumpsoverthehighbridge";
string words[] = {"the","fox","thequickbrownfox","jumps","lazy","lazyfox",
"highbridge","the","over","bridge","high","tall","quick","brown"};
int min_bars_helpers(string s,string word... | ALGO | 0.999801 | 4.416298 |
fa0d9b34-8a08-45bd-81ea-e548e5465faa | LyuLumos/Three-People-in-Qingqing-Grassland | 模板/树状数组.cpp | int a[maxn],c[maxn]; ///a[i]¼ֵc[i]¼[i-lowbit(i)+1,i]ĺ
int ask(int x) ///ѯ1~xǰ O(logn)
{
int ans = 0;
for(;x;x-=(x&-x)) ans+=c[x];
return ans;
}
void add(int x,int y) ///a[x]+y O(logn)
{
for(;x<=n;x+=(x&-x)) c[x]+=y;
}
int query(int k) ///O(logn)ѯkС
{
int ans=0,sum=0;
for(int i=20;i>=0;--i)
... | ALGO | 0.999892 | 3.869488 |
ccee9829-187e-4949-9aaa-ac181212543e | sinian666/codes_82_1 | cpp_副本15/chapter_hashing/hash_map.cpp | /**
* File: hash_map.cpp
* Created Time: 2022-12-14
* Author: msk397 (<EMAIL>)
*/
#include "../utils/common.hpp"
/* Driver Code */
int main() {
/* 初始化哈希表 */
unordered_map<int, string> map;
/* 添加操作 */
// 在哈希表中添加键值对 (key, value)
map[12836] = "小哈";
map[15937] = "小啰";
map[16750] = "小算";
... | TOOL | 0.907338 | 5.393631 |
d8c6ee9f-fd86-4f41-9f2c-21beffdb654d | ishandutta2007/codeforces | matrixcascade_qwq/normal/1512/E.cpp | //Author:MatrixCascade
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define clr(f, n) memset(f, 0, sizeof(int) * (n))
#define cpy(f, g, n) memcpy(f, g, sizeof(int) * (n))
#define rev(f, n) reverse(f, f + n)
#define pir pair<int, int>
#define mkp make_pair
#define fst it->first
#define s... | ALGO | 0.999597 | 3.334254 |
4b328c7e-d9e7-4af0-ad0a-25ac86ff603d | Dajtbaeva/ADS_2022 | cm/contest1/del.cpp | #include <bits/stdc++.h>
using namespace std;
struct ListNode{
int val;
ListNode * next;
ListNode(int val){
this -> val = val;
this -> next = NULL;
}
};
struct DoublyLinkedList{
int sz;
ListNode *head;
ListNode *tail;
DoublyLinkedList(){
this -> sz = 0;
... | ALGO | 0.999889 | 3.584776 |
45c34d62-9294-4291-be3c-61fd94d34fae | jun-pac/PS | 230122/3set/D.cpp | //
//./D<test
#include <bits/stdc++.h>
#define cediv(a,b) ((a)%(b)==0?((a)/(b)):((a)/(b))+1)
#define fi first
#define se second
#define pb push_back
using namespace std;
typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
template<typename T>
inline T umax(T &u, T v){return u = max(u, v)... | ALGO | 0.999893 | 3.118893 |
c36342bf-d148-4f79-a87a-1c4cfb477bab | PhloxHopkins/PhloxSelection | code/likelihood.cpp | #include "likelihood.h"
#include <iostream>
using std::cout;
#include <string>
using std::string;
#include <fstream>
using std::ifstream;
#include <sstream>
using std::stringstream;
using std::istringstream;
//likelihood function
double MakeLikelihood (vector<double>& predict,vector<int> obs){
double LH=0;
do... | ALGO | 0.999219 | 4.69808 |
e7cedb82-d088-48ee-b05d-5017dec2edbd | Tanishgupta007/DSA-CPP | 76.STL_list.cpp | #include<iostream>
#include<list>
using namespace std;
int main()
{
list<int> l;
l.push_back(2);
l.push_front(1);
for(int i:l){
cout<<i<<" ";
}
cout<<endl<<"After erase"<<endl;
l.erase(l.begin());
l.erase(l.begin());
for(int i:l){
cout<<i<<" ";
}
} | ALGO | 0.969073 | 3.809504 |
88d97fa5-1e8e-4fbd-ab8e-3c15234b4ef1 | adityarai2109/DSA | 01_AB_CSES/Subordinates.cpp | #include <bits/stdc++.h>
using namespace std;
#define max(a, b) ((a < b) ? b : a)
#define min(a, b) ((a > b) ? b : a)
#define mod 1e9 + 7
#define INF 1000000000000000003
typedef long long int ll;
typedef vector<int> vi;
typedef pair<int, int> pi;
int solve(ll val, map<ll, vector<ll>> &m, vector<ll> &ans)
{
if (m[v... | ALGO | 0.999941 | 3.605959 |
cc50c798-cdca-4a2a-ac54-dd69691a63f7 | kkisic/Procon | CPP/AtCoder/arc/083/e.cpp | #include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <iomanip>
#define int long long int
#define rep(i, n) for(int i = 0; i < (n);... | ALGO | 0.999968 | 3.934363 |
ba363df1-2bcd-4a00-ac23-a88c3d372e5f | raamkashyap/InterviewBit | Graphs/SnakeandLadder.cpp | int Solution::snakeLadder(vector<vector<int> > &A, vector<vector<int> > &B) {
unordered_map<int , int> hash;
for(auto p : A)
hash[p[0]] = p[1];
for(auto p : B)
hash[p[0]] = p[1];
queue<pair<int , int>> q;
q.push({1 , 0});
bool vis[101] = {};
vis[1] = true;
while(q.size()... | ALGO | 0.999846 | 4.984235 |
def236e7-4fdc-4ae2-87cd-43e12644668b | Freze27/OpSecondSemesterITMO | Work7/main.cpp | #include <iostream>
#include <algorithm>
#include <iterator>
template<typename T>
class RingBuffer {
private:
T *b;
int size;
int capacity;
public:
class Iterator {
private:
T *pointer;
public:
Iterator(T *p) : pointer(p) {}
T &operator*() const {
return *pointe... | TOOL | 0.982123 | 4.957325 |
dbbeccd3-30ca-4fee-8e7e-9a358f77aa75 | KartavyaKothari/lpu_k20hs | week5/captitalize_str.cpp | // Lovedeeps attempt at second string problem
#include<bits/stdc++.h>
using namespace std;
int main(){
string str;
getline(cin,str);
str[0]= toupper(str[0]);
for(int i=0;i<str.size();i++){
if(str[i]==' '){
str[i+1] = toupper(str[i+1]);
}
}
cout<<str;
... | ALGO | 0.999849 | 3.998895 |
70c9219e-b897-485c-9b2e-34503132180e | ishandutta2007/codeforces | mustang98/normal/914/F.cpp | #pragma GCC optimize("Ofast", "unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,avx,avx2") // WINDOWS ONLY
#include <bits/stdc++.h>
using namespace std;
char ch[110000],c[10],s[110000];
bitset<100010>x[30],ans,one;
int n,m;
int main(){
scanf("%s",ch+1); n=strlen(ch+1);
for (int i=1;i<=n;i++) x[ch[i]-'a'][i... | ALGO | 0.999861 | 3.980403 |
c89331c5-6e58-4beb-93d4-02dcda08d9d2 | andreyDagger/2nd-year-A-SD-lab | NT_Math_B.cpp | #include <bits/stdc++.h>
#define int long long
using namespace std;
mt19937 gen(chrono::steady_clock::now().time_since_epoch().count());
int mul(int a, int b, int mod) {
return ((__int128)a * (__int128)b) % mod;
}
int binpow(int a, int p, int mod) {
if (!p) return 1;
if (p & 1) return mul(a, binpow(a, p ... | ALGO | 0.999823 | 4.860468 |
d0154e00-12c5-4fc2-89d7-bfd69a8d2c24 | jhstaudacher/EPIC | src/index/AbsolutePowerIndexG.cpp | #include "index/AbsolutePowerIndexG.h"
#include "Array.h"
#include "Logging.h"
#include "lint/GlobalCalculator.h"
#include <iostream>
epic::index::AbsolutePowerIndexG::AbsolutePowerIndexG(Game* g)
: RawBanzhaf() {
if (g->getNumberOfNullPlayers() > 0 && !g->getFlagNullPlayerHandling()) {
throw std::invalid_argume... | ALGO | 0.999424 | 4.830324 |
aef5c9ee-1874-428d-977c-92362040f983 | Ankur123451/ankur-assam | interpreter/llvm/src/lib/Analysis/ScalarEvolutionNormalization.cpp | #include "llvm/Analysis/ScalarEvolutionNormalization.h"
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/Analysis/ScalarEvolutionExpressions.h"
using namespace llvm;
/// TransformKind - Different types of transformations that
/// TransformForPostIncUse can do.
enum TransformKind {
/// Normalize - Normalize accordi... | TOOL | 0.934662 | 6.143797 |
fa484947-a22f-43a1-8d4f-b5abdc015819 | Rodrigo61/GUAXINIM | SPOJ/EKO/main.cpp | #include "bits/stdc++.h"
using namespace std;
#define db(x) cerr << #x << " == " << x << endl
#define all(container) container.begin(), container.end()
#define mp(i,j) make_pair(i,j)
#define pb push_back
typedef pair<int,int> pii;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef vector<pi... | ALGO | 0.999995 | 4.579808 |
c6b46bca-a5ff-443f-92f0-e666034de6cd | aditya74841/Dsa-notes | CharandString/validpalindrome.cpp | #include <bits/stdc++.h>
using namespace std;
bool valid(char a)
{
if ((a >= 'a' && a <= 'z') || (a >= 'A' && a <= 'z') || (a >= '0' && a <= '9'))
{
return 1;
}
return 0;
}
bool checkpalidrome(string s)
{
string temp;
for (int i = 0; i < s.length(); i++)
{
if (valid(s[i]))
... | ALGO | 0.999934 | 4.951951 |
cfc0dcd3-95b2-40b7-b34a-586095468773 | shreychoudhary07/DAA | PCS-409/Week_7/bellmanFord.cpp | #include <bits/stdc++.h>
using namespace std;
struct node {
int u;
int v;
int wt;
node(int first, int second, int weight) {
u = first;
v = second;
wt = weight;
}
};
void bellman_ford(vector<node> edges, int n, int src) {
vector<int> dist(n, 10000000);
vector<int> par... | ALGO | 0.999985 | 4.680008 |
43c7fc51-4dc6-4431-b4ef-02ab1c87e16f | nadimmorol890/XPSC | Week 7/Day 1/B_Maximise_Score.cpp | #include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(NULL);
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
}
ve... | ALGO | 0.999898 | 4.577487 |
6668a7ed-4046-4f3b-9b4e-04c3e1f16d93 | Natali969/calc | src/CalcManager/CEngine/RationalMath.cpp | #include "Header Files/RationalMath.h"
using namespace std;
using namespace CalcEngine;
Rational RationalMath::Frac(Rational const& rat)
{
PRAT prat = rat.ToPRAT();
try
{
fracrat(&prat, RATIONAL_BASE, RATIONAL_PRECISION);
}
catch (uint32_t error)
{
destroyrat(prat);
thr... | TOOL | 0.915599 | 6.429286 |
b0ca8d4c-09b1-4aa9-a205-a2d245e55f02 | TortoiseWrath/competitive-programming | solutions/goldbachs-sieve.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
std::vector<int> primes = {};
bool isPrime(int n) {
return std::find(primes.begin(), primes.end(), n) != primes.end();
}
void sieve(int n) {
bool flags[n + 1] = {0};
for(int i = 2; i <= n; i++) {
flags[i] = true;
}
for(int i = 2; i <=... | ALGO | 0.999913 | 4.75424 |
abe9af2e-caa1-445b-86c9-964113f8cbb4 | cpt-r3tr0/hackerrank-algorithms | Bit-Manipulation/sansa-and-XOR.cpp | #include<iostream>
using namespace std;
int main(){
int t;
cin >> t;
while(t--){
long n;
cin >> n;
long a[n+2];
for(long i = 0 ; i < n ; i++){
cin >> a[i];
}
long answer = 0;
for(long i = 0 ; i < n ; i=i+2){
answer = answer ^ ... | ALGO | 0.999904 | 3.756666 |
13b5b1e5-5e6f-48fc-a15e-1a7ed3a1b7d0 | Aleena-Mishra-10/Data-Structure | Queue/Rotten Oranges.cpp | bool isSafe(vector<vector<int>>&mat,int n,int m,int i,int j){
return (i>=0 && i<n && j>=0 && j<m && mat[i][j]==1);
}
int rotOranges(vector<vector<int> > &matrix, int R, int C)
{
int timer=-1;
queue<pair<int,int>>q;
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
if(mat[i][j]==2){
... | ALGO | 0.999928 | 5.308968 |
e66faee8-ef45-4270-b2b4-5ea2af17ee72 | liu-chunzhang/cpp_primer_5ed_exercise_solution | 第16章 模板与泛型编程/16.06 练习集合/练习 16.07/main.cpp | // ֤ϰ16.7е뷨ڱҪĵط˵
#include <iostream>
using namespace std;
template<typename T, size_t N>
constexpr size_t size( const T( &t )[N] ) ;
int main() {
int a[ 10 ] = { 1 , 1 , 2 , 3 , 5 , 8 , 13 , 21 } , b[] = { 1 , 1 , 2 , 3 , 5 , 8 , 13 , 21 } ;
cout << size( a ) << endl;
cout << size( b ) << endl;
return... | ALGO | 0.915489 | 4.968826 |
316cf06b-0810-42ed-b2fb-cb9977db7dd5 | KhaiJP/AtCoder | ABC/<100/060/C++/A.cpp | #include<iostream>
using namespace std;
int main(){
string A, B, C; cin >> A >> B >> C;
if(A.back() == B[0] && B.back() == C[0]){
cout << "YES" << endl;
}else{
cout << "NO" << endl;
}
return 0;
} | ALGO | 0.999889 | 3.402735 |
695468c2-8b1c-4480-bb1d-ba78f5f0596a | gauravbyte/cpp_codes | LeetCodes/leetcode/editor/en/[1337]The K Weakest Rows in a Matrix.cpp | The K Weakest Rows in a Matrix
the-k-weakest-rows-in-a-matrix
/**
You are given an m x n binary matrix mat of 1's (representing soldiers) and 0's
(representing civilians). The soldiers are positioned in front of the civilians.
That is, all the 1's will appear to the left of all the 0's in each row.
A row i is weak... | ALGO | 0.99999 | 6.778666 |
09eaeabc-afc8-4980-94e3-371bef0b74a3 | devanshi-code/DSA | HASHING/unordered_map.cpp | #include<bits/stdc++.h>
#include<unordered_map>
using namespace std;
int main()
{
unordered_map<string,int>umap;
umap["prince"]=44;
umap["gfg"]=22;
umap["helloworld"]=35;
// for(auto x:umap)
// {
// cout<<x.first<<" "<<x.second<<endl;
// }
for(auto itr=umap.begin();itr!=umap.end(... | TOOL | 0.994576 | 3.855439 |
383efc15-ca47-4107-92ef-6db78fed8fd2 | RainbowRain9/C-- | Algorithm/PTA/L1-046-整除光棍.cpp | /*
* @Author: RainbowRain9
* @Date: 2025-04-08 20:49:59
* @LastEditTime: 2025-04-08 22:49:02
* @FilePath: \C++\Algorithm\PTA\L1-046-整除光棍.cpp
* @Description:
*/
/**************************************************
* 题目描述:
* 给定一个不以5结尾的奇数x,找到最小的s和n,使得x乘以s等于一个由n个1组成的光棍数。
* 输出s和n,用空格分隔。
*
* 示例 1:
* 输入:31
... | ALGO | 0.999863 | 4.616631 |
002c513b-5109-46fa-882b-938dc4830d63 | Flesymeb/Design-Analysis_of_Algorithms | Code/HW01/1-4/1-4.cpp | /*****************************************************************//**
* \file 1-4.cpp
* \brief ijʼĿҾﵽĿ״̬С
* IJתһеĽ״̬еĽҡ
* \author Hyoung Yan
* \date 2024 03 05
*********************************************************************/
#include<iostream>
#include<string.h>
using namespace std;
#de... | ALGO | 0.999967 | 4.927853 |
2664ec2c-08bb-48c0-8901-229eb3e44707 | Sookmyung-Algos/2021algos | algos_assignment/3rd_grade/손유진_wwwyes24com/week4/21735.cpp | #include <iostream>
#include <algorithm>
using namespace std;
int a[1000010];
int n, m;
int maxsnow = 0;
int dfs(int time, int cur, int size) {
maxsnow = max(maxsnow, size);
if (time == m || cur == n) {
return maxsnow;
}
dfs(time + 1, cur + 1, size + a[cur + 1]);
dfs(time + 1, cur + 2, size / 2 + a[cur + 2]... | ALGO | 0.999975 | 3.814383 |
ee9fc912-afc1-456a-a50c-bf269aeb1757 | vidhsss/Data-stractures-and-algorithms | Greedy algo/temple.cpp | #include<iostream>
#include<algorithm>
#define ll long long
using namespace std;
int main() {
ll x[100000],y[100000];
int n;
cin>>n;
for(int i=0;i<n;i++)
{
cin>>x[i]>>y[i];
// cout<<x[i]<<" "<<y[i]<<endl;
}
sort(x,x+n);
sort(y,y+n);
ll deltax=x[1]-x[0]-1;
ll deltay=y[1]-y[0]-1;
if (n>=2){
for(int i=2;... | ALGO | 0.999587 | 3.853499 |
fd59e553-da7f-462a-8297-b0a09057faf2 | quangpham10212004/Codeforces | Rudolf and the Ticket.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define Mod 1000000007
#define pb push_back
void Code(){
int n,m,k;
int count=0;
cin >>n>>m>>k;
int b[1005],c[1005];
for(int i=1;i<=n;i++) cin>>b[i];
for(int i=1;i<=m;i++) cin>>c[i];
... | ALGO | 0.999878 | 3.545771 |
6cb44b5b-ba4d-4199-afb9-fd9c4ce717eb | Lessica/HikariSummer | compiler-rt/lib/scudo/standalone/tools/compute_size_class_config.cpp | #include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <algorithm>
#include <vector>
struct Alloc {
size_t size, count;
};
size_t measureWastage(const std::vector<Alloc> &allocs,
const std::vector<size_t> &classes, size_t pageSize,
size_t ... | ALGO | 0.946625 | 5.857042 |
6b615c51-973c-443f-9285-fbf235e9c6f4 | rakib54/Algorithm-and-problem-solving | Stack/Maximum Width Ramp.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
class Solution
{
public:
int maxWidthRamp(vector<int> &nums)
{
stack<int> st;
int n = nums.size();
// big to small
for (int i = 0; i < n; i++)
{
if (st.empty() || nums[st.top()] > nums[i])
{
st.push(i);
... | ALGO | 0.999895 | 5.894961 |
74291ad9-5ed0-421e-9a3b-088d6a20bef5 | prasachin/DSA | recursion/subset.cpp | #include <bits/stdc++.h>
using namespace std;
/* TYPES */
#define ll long long
#define pii pair<int, int>
#define pll pair<long long, long long>
#define vi vector<int>
#define vll vector<long long>
#define vs vector<string>
#define vvll vector<vector<long long>>
#define vpi vector<pair<int, int>>
#define vpll vector<... | ALGO | 0.999976 | 4.139847 |
d4d63875-2e9e-4c25-920d-60939dacc2ff | zakki/openhsp | hsp3dish/extlib/src/BulletCollision/Gimpact/btGImpactQuantizedBvh.cpp | /*! \file gim_box_set.h
\author Francisco Leon Najera
*/
#include "btGImpactQuantizedBvh.h"
#include "LinearMath/btQuickprof.h"
#ifdef TRI_COLLISION_PROFILING
btClock g_q_tree_clock;
float g_q_accum_tree_collision_time = 0;
int g_q_count_traversing = 0;
void bt_begin_gim02_q_tree_time()
{
g_q_tree_clock.reset();
}... | ALGO | 0.998441 | 7.063347 |
52fca63b-c090-488c-af7f-e7f0948eb160 | Hafiz-Sakib/CPP-for-CP | CSES Problem Solving/All/solutions/1638 - Grid Paths.cpp | /*
Problem Name: Grid Paths
Problem Link: https://cses.fi/problemset/task/1638
Author: Sachin Srivastava (mrsac7)
*/
#include<bits/stdc++.h>
using namespace std;
template<typename... T>
void see(T&... args) { ((cin >> args), ...);}
template<typename... T>
void put(T&&... args) { ((cout << args << " "), ...);}
template<... | ALGO | 0.999948 | 3.935714 |
cef63a3f-3a2b-4cd1-9e42-f9e4b42ee021 | ruvus/auto | src/perception/filters/polygon_remover/test/test_polygon_remover.cpp | #include <common/types.hpp>
#include <lidar_utils/point_cloud_utils.hpp>
#include <geometry_msgs/msg/polygon.hpp>
#include <random>
#include <memory>
#include "gtest/gtest.h"
#include "polygon_remover/polygon_remover.hpp"
using PointCloud2 = sensor_msgs::msg::PointCloud2;
using Polygon = geometry_msgs::msg::Polygon;
u... | TEST | 0.864393 | 7.671577 |
719e021c-2ffc-4a1a-8bb9-cf0984971720 | divyangbotadara5656/Assignment_M4 | 03_05_triangle.cpp | #include <iostream>
using namespace std;
class Polygon {
private:
int side1; // Length of side 1
int side2; // Length of side 2
int side3; // Length of side 3
public:
// Constructor to initialize the lengths of the polygon's sides
Polygon(int s1, int s2, int s3) {
side1 = s1;
side2... | ALGO | 0.978692 | 5.167167 |
2a416930-cda2-4138-8417-7e7537087ef5 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_2752_11.cpp | #include <bits/stdc++.h>
using namespace std;
ifstream fin("A.in");
int n, x, cnt, ans;
int main() {
cin >> n;
for (int i = 1; i <= n; ++i) {
cin >> x;
if (x == -1) {
if (cnt == 0) {
++ans;
} else
--cnt;
} else
cnt += x;
}
cout << ans;
}
| ALGO | 0.999954 | 3.872715 |
aa58b74b-dbb8-4101-b509-d0d6456a4de4 | Ismail-Upal/CP-Campaign | TLE 31/1200/C_Differential_Sorting.cpp | #include<bits/stdc++.h>
using namespace std;
#define opt() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define tc int t; cin >> t; for (int _ = 1; _ <= t; _++)
using ll = long long;
#define endl '\n'
#define sz(x) (ll)(x).size()
//-------------------------------------------
int32_t main()
{
opt();
... | ALGO | 0.999308 | 3.739291 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.