uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
9c509d5a-ee5a-44b1-adba-f4c1e40811cf | nobdefender/icpc | math/big_integer.cpp | #include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<string>
#include<cmath>
#include<stack>
#include<iomanip>
#include<fstream>
#define all(x) (x).begin(), (x).end()
#define endl "\n"
using namespace std;
class big_integer {
// основание системы счисления (1 000 000 000)
... | ALGO | 0.996197 | 3.974651 |
b3d778f7-ad22-48e6-a5bf-72b2b218dbc3 | HaiderL48/shop_shoes | 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.998756 | 6.772262 |
f7362472-19ec-4571-b9b3-4b8fd89ab1a9 | durgesh-4526/Leetcode-Daily-challenge | 4_april_1721.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* swapNodes(L... | ALGO | 0.999999 | 5.657709 |
1341f7f0-9fc8-44da-8612-3165050eb51e | prabhjotschugh/DSA-Solutions | 0373-find-k-pairs-with-smallest-sums/0373-find-k-pairs-with-smallest-sums.cpp | class Solution{
public:
vector<vector<int>> kSmallestPairs(vector<int>& nums1, vector<int>& nums2, int k){
int n = nums1.size();
int m = nums2.size();
priority_queue<pair<int, pair<int, int>>> maxHeap;
for(int i=0; i<n; i++){
for(int j=0; j<m; j++){
int s... | ALGO | 0.999992 | 5.61465 |
f889b34b-9fbf-44be-b689-ad214c5e0d3d | Morales7nl21/Compiladores2021 | Practica2/main.cpp | /*
Este programa regresa un AFD en un .txt determinado como AfnToAFD.txt
*/
#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include "clasesAFN.hpp"
#include "../Practica1/clases.hpp"
using namespace std;
void menu();
void leerArchivoAFN();
void imprimeEstados();
void imprimeTransiciones();
void g... | ALGO | 0.974015 | 3.430741 |
8ca8602d-f248-4166-b9ca-19ea2bdcc597 | namanjain2602/Leetcode-solutions | 0046-permutations/0046-permutations.cpp | class Solution {
public:
void solver(vector<int>& nums, vector<vector<int>>&ans,int ind)
{
if(ind==nums.size())
{
ans.push_back(nums);return;
}
for(int i=ind;i<nums.size();i++){
swap(nums[i],nums[ind]);
solver(nums,ans,ind+1);
swap(nums[i],nu... | ALGO | 0.999997 | 6.266594 |
fd8b1680-ec7c-46a0-bf34-56e965c54e8c | Dan920-Dev/SImuLab | Lab_01/Scripts/main10.cpp | #include <iostream>
using namespace std;
void murcielago(string);
char clave(char l);
int main(){
string cad;
cout << "Ingrese una cadena: \n";
getline(cin, cad);
murcielago(cad);
return 0;
}
void murcielago(string cad){
for (int i = 0; i < cad.size(); i++)
{
char cad1 = cad... | ALGO | 0.996859 | 3.946362 |
aa503e68-7909-4bc9-8608-885508430894 | vss021/365-Day-Coding-Challenge | Day-45/problem2.cpp | #include <string>
#include <unordered_map>
#include <climits>
using namespace std;
class Solution {
public:
string minWindow(string s, string t) {
int sSize = s.size(), tSize = t.size();
unordered_map<char, int> charCount;
int minWindowLength = INT_MAX;
int startIdx = 0;
... | ALGO | 0.999997 | 7.604109 |
aebc1f59-7ba6-4fc2-8b20-179fb6a04e72 | TheDev05/CARDIO | CodeForces/Rating 800/A_Sum_of_2050.cpp |
/*
StayWithKarma & repeat this,
"Hare Krishna Hare Krishna, Krishna Krishna Hare Hare,
Hare Rama Hare Rama, Rama Rama Hare Hare !!"
Username: TheDev05, Happy Coding <3
*/
#include <bits/stdc++.h>
using namespace std;
/* Limits */
#define imax INT_MAX
#define imin INT_MIN
/* Pairs */
#define pi pair<ll,... | ALGO | 0.999855 | 3.9719 |
a9e0cf52-aafe-463b-8ea5-71a262af6fd0 | ghosthunter99/competitive-programming | codeforces/make two disjoint set of string without using sl map( hashing problem).cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod=1e9+9;
const int p=31;
vector<pair<int,int> >hashes;
void make_hash(string s,int pos){
int n=s.size();
int hash_val=0,pow=1;
for(int i=0;i<n;i++){
hash_val=( ((s[i]-'a'+1)*p*pow)%mod)%mod;
pow=p*pow;
}
hashes.push_back(make_pair(ha... | ALGO | 0.999989 | 3.928198 |
e9957286-6d07-4b5c-8fba-e2cf6c811c22 | mohdbsaid/marlin-PET-Filament | buildroot/share/PlatformIO/variants/MARLIN_F4x7Vx/variant.cpp | #include "pins_arduino.h"
#ifdef __cplusplus
extern "C" {
#endif
// Digital PinName array
const PinName digitalPin[] = {
PA_0, // Digital pin 0
PA_1, // Digital pin 1
PA_2, // Digital pin 2
PA_3, // Digital pin 3
PA_4, // Digital pin 4
PA_5, // Digital pin 5
PA_6, // Digital pin 6
PA_7, // Dig... | CONFIG | 0.917435 | 6.185098 |
cbdad1ce-e95f-40c1-9993-0a67738a8ea7 | ishandutta2007/codeforces | tdpencil/normal/1105/B.cpp | #include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//#include <iterator>
#pragma GCC optimize("Ofast") // optimizes doubles + vectors
//using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int MAXN = 1e6, M ... | ALGO | 0.999848 | 4.308022 |
a71fc6f7-1ebd-4078-bb26-eca80729719e | Jiwan/RADS | thirdparty/boost/libs/random/test/histogram.cpp | #include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <boost/random.hpp>
void plot_histogram(const std::vector<int>& slots, int samples,
double from, double to)
{
int m = *std::max_element(slots.begin(), slots.end());
const int... | ALGO | 0.924805 | 5.671612 |
6eaa3be6-21fd-4da6-9577-7b36d4a5d5dc | Saif-000001/xpsc_latest | Week14/Day1/Two_Vessels.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#ifdef LOKAL
#include "DEBUG_TEMPLATE.h"
#else
#define HERE
#define debug(args...)
#endif
const int MOD = 1000000007;
const int N = 2e5 + 5;
typedef pair<int, int> pii;
void TEST_CASES()
{
int a, b, c;
cin >> a >> b >> ... | ALGO | 0.999753 | 4.3097 |
ba296f4f-8413-4da6-8f03-2435b60b4a61 | Ashutoshmzp1221/Practice_codes | c++ practice/recursion.cpp | #include <stdio.h>
int RecursiveLS(int arr[], int value, int index, int n)
{
int pos = 0;
if(index >= n)
{
return 0;
}
else if (arr[index] == value)
{
pos = index + 1;
return pos;
}
else
{
return RecursiveLS(arr, value, index+1, n);
}
ret... | ALGO | 0.9999 | 4.48314 |
77f2cfbf-12e3-4c28-822e-679db5c92c60 | SoftSimu/SymPhas | lib/src/dft.cpp | #include "dft.h"
iter_type symphas::dft::next_block_i(iter_type i, len_type full_len,
len_type block_count) {
iter_type count = full_len / block_count,
rem = full_len - (count * block_count);
return count * i + std::min(i, rem);
}
template <typename T>
inline void... | ALGO | 0.998113 | 5.210741 |
c1c64e23-3ec8-45e4-b194-45d6013da957 | MayankK-20/Cpp_experience | pattern/hollow butterfly.cpp | #include<iostream>
using namespace std;
int main(){
int n;
cin>>n;
for (int a=1; a<=n; a++) {
for (int b=1; b<=a; b++) {
if (b==1 || b==a) {cout<<"* ";}
else {cout<<" ";}
}
for (int c=1; c<=(2*(n-a)); c++) {cout<<" ";}
for (int b=1; b<=a; b++) {
... | ALGO | 0.999913 | 3.302774 |
3b3df3d9-5939-4a17-9460-9f64a531409f | yakomaxa/pdp_plusplus | src/PDPDistanceMatrix.cpp | #include "PDPDistanceMatrix.hpp"
PDPDistanceMatrix::PDPDistanceMatrix() {
// Default constructor
}
std::vector<std::vector<int>> PDPDistanceMatrix::getDist() {
return dist;
}
void PDPDistanceMatrix::setDist(std::vector<std::vector<int>>& dist) {
this->dist = dist;
}
int PDPDistanceMatrix::getNclose() {... | ALGO | 0.955252 | 5.529651 |
9b20ce47-8513-436d-bdc7-d4c5b5d510a6 | PratypartyY2K/UDEMY_DSA | Recursion/subset_sum.cpp | /*
Given a set of non-negative integers, and a value sum, determine if there is a subset of the given set with sum equal to given sum and count the number of such subsets.
Input
-----
arr = [10,12,15,6,19,20]
sum = 16
Output
------
16
*/
#include <iostream>
#include<cstring>
#include<vector>
#include<algorithm>
using... | ALGO | 0.999938 | 5.262926 |
ff838b00-99d6-4228-8a3d-19e39db41230 | WayneWei228/Algorithm | KickStart/2022/RoundD/qs1.cpp | #include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
struct Solution {
int N, M;
double ans = 0.0;
vector<int> A;
void Solve() {
scanf("%d%d", &N, &M);
A.resize(N);
for (int i = 0; i < N; i++) {
scanf("%d", &A[i]);
}
sort(A.be... | ALGO | 0.99957 | 4.885965 |
165f0a79-e170-4110-a9a2-9b5c9d4deb4d | sjm150/ps | codeforces/rounds/919/d.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll lim = 1e18;
int main() {
cin.tie(0); ios_base::sync_with_stdio(0);
int t; cin >> t;
while (t--) {
int n, q; cin >> n >> q;
ll sz = 0;
bool over = false;
map<ll, int> arr;
set<ll> mod;
... | ALGO | 0.999519 | 3.741339 |
a7d604c5-f81d-46b6-b025-8813565cf10d | chasseneige109/PS | 백준_단계별/최소신장트리/17472국룰코드.cpp | #include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;
int N, M;
int board[10][10];
int dy[4] = { -1, 1, 0, 0 };
int dx[4] = { 0, 0, -1, 1 };
struct Edge {
int u, v, w;
bool operator<(const Edge& e) const {
return w < e.w;
}
};
vector<Edge> edges;
int pa... | ALGO | 0.999913 | 5.481079 |
b75f255e-4ecf-4245-8aba-e11db63d31d5 | 403ABHIJEET/Data-Structure-Algorithm | Permutaion/permutationForGeneralArray.cpp | #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
void helper(vector<int> &a,vector<vector<int>> &ans,int idx) {
if(idx==a.size()) {
ans.push_back(a);
return;
}
for(int i=idx; i<a.size(); i++) {
if(i!=idx && a[i]==a[idx])
continue;
swap... | ALGO | 0.999992 | 4.439479 |
942c6a89-d015-4d2d-9f13-ca69e64d53bb | jasondgo/VEXcodePrereq | Section1Solutions/q41.cpp | #include <iostream>
#include <cmath>
/*
Question 41:
Create a program that prompts the user to enter the lengths of three sides of a triangle.
Store the values in variables and use the Law of Sines to calculate one of the angles using the `asin()` function.
Display the angle in degrees using `cout`.
*/
int ma... | ALGO | 0.99958 | 5.32132 |
8a7662e7-77f9-4cf0-b453-166028385c3c | ishandutta2007/codeforces | mr.robot_28/normal/949/B.cpp | #include<bits/stdc++.h>
using namespace std;
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
long long n;
cin >> n;
int q;
cin >> q;
while(q--)
{
long long x;
cin >> x;
long long l = 1, r = n;
while(true)
{
if(x % 2 == 1)
{
cout << (x + 1) / 2 << "\n";
... | ALGO | 0.99999 | 3.659763 |
ef74edc5-8aee-466a-bb69-b33e04580826 | sarvex/leetcode-cpp | solution/0800-0899/0871.Minimum Number of Refueling Stops/Solution.cpp | class Solution {
public:
int minRefuelStops(int target, int startFuel, vector<vector<int>>& stations) {
priority_queue<int> q;
stations.push_back({target, 0});
int ans = 0, prev = 0;
for (auto& s : stations) {
int d = s[0] - prev;
startFuel -= d;
w... | ALGO | 0.999946 | 5.845615 |
4a1ab5c7-d113-44e9-8400-5129c64bbb80 | cfce/chilin | software/bedtools-2.17.0/src/utils/bedFile/bedFile.cpp | #include "bedFile.h"
/***********************************************
Sorting comparison functions
************************************************/
bool sortByChrom(BED const &a, BED const &b) {
if (a.chrom < b.chrom) return true;
else return false;
};
bool sortByStart(const BED &a, const BED &b) {
if (a... | TOOL | 0.908526 | 5.300295 |
fe19e120-ce34-4731-931d-a2cfd8d52271 | khaledatia25/cp-problems-solutions | codeforces/div3-913/B.cpp | /*
-------------------------------------------- ==============
| Buggy Code Written By Khaled Waleed ^_^ | | For Fun |
-------------------------------------------- ==============
*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#inclu... | ALGO | 0.999844 | 5.615985 |
d7b691a7-0cbf-4d3c-9053-bc29f847a02b | Manishgupta200/Strivers-A2Z-DSA | C++ Test/Search_In_Rotated_Sorted_Array.cpp | // https://practice.geeksforgeeks.org/problems/search-in-a-rotated-array4618/1?utm_source=gfg&utm_medium=article&utm_campaign=bottom_sticky_on_article
// https://www.codingninjas.com/codestudio/problems/search-in-rotated-sorted-array_1082554?source=youtube&campaign=love_babbar_codestudio2&utm_source=youtube&utm_medium=... | ALGO | 0.999976 | 5.838382 |
fbbfd155-d27d-477e-a470-b2b4e2114ef3 | IanThomasICT/personal-practice | cpp/anagram.cpp | #include <iostream>
#include <algorithm>
using namespace std;
// Task: Given a string, identify which of the 4 choices are an anagram of the string
int main()
{
string word = "test";
// Prompt for string
cout << "Enter a word and we'll find the anagram: ";
cin >> word;
// Sort string
sort(w... | ALGO | 0.999173 | 4.173604 |
67a8ea06-b55e-4eef-8f29-634866ff1b71 | ericliang/matplotlib | tags/v0_86/matplotlib/agg23/src/ctrl/agg_spline_ctrl.cpp | #include "ctrl/agg_spline_ctrl.h"
namespace agg
{
//------------------------------------------------------------------------
spline_ctrl_impl::spline_ctrl_impl(double x1, double y1, double x2, double y2,
unsigned num_pnt, bool flip_y) :
ctrl(x1, y1, x2, y2, flip... | TOOL | 0.889445 | 6.355007 |
dc0fa212-a681-47fc-9cd9-6e858a697b74 | khaledatia25/cp-problems-solutions | vjudge-extracted-solutions/UVA/967/38602364_AC_280ms_0kB.cpp | //// To infinity and beyond
#include <bits/stdc++.h>
#define fast cin.tie(0),cin.sync_with_stdio(0),cout.tie(0)
#define space " "
#define MOD 1000000007
#define dbl double
#define ll long long
using namespace std;
void init(){fast;}
/*
"وَتَوَكَّلْ عَلَى ٱلْحَىِّ ٱلَّذِى لَا يَمُوتُ"
*/
int t =1,n,m=1, ... | ALGO | 0.999738 | 3.875093 |
699b282c-eb8b-4304-a11a-8c7b5bbca730 | patelsneh18/GeeksForGeeks-DSA-Workshop | Week 1/Mathematics/P05-rootsOfQuadratic.cpp | #include <bits/stdc++.h>
using namespace std;
vector<int> quadraticRoots(int a, int b, int c)
{
float A = a;
float B = b;
vector<int> ans;
long long D = b * b - 4 * a * c;
if (D > 0) {
float x1 = floor((-B + sqrt(D))/(2*A));
float x2 = floor((-B - sqrt(D))/(2*A));
i... | ALGO | 0.99994 | 4.630242 |
384c8ec0-525c-40bf-bcfe-a437d4a7d18e | AbuJubair7/CP | Contests/Codeforces/Codeforces Round 881 (Div. 3)/a.cpp | /*........... বিসমিল্লাহির রাহমানির রাহীম .................
Author: jubs
Date: 20 June 2023
*/
#include <bits/stdc++.h>
using namespace std;
#define BOOST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR(i,n) for(ll i = 0 ; i<n ; i++)
#define endl "\n"
#define pb push_back
//#define jubs
... | ALGO | 0.999942 | 5.788399 |
fca4a15c-c057-4eda-8fb4-2db849ba8a1c | p7373993/BeakJoon | 11651.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n, x, y;
cin >> n;
vector<vector<int>> vec(200001);
for (int i = 0; i < n; i++)
{
cin >> x >> y;
vec[y + 100000].push_back(x);
}
for (int i = 0; ... | ALGO | 0.999884 | 4.458979 |
26ba2876-c0a5-4f71-bcce-f3c8441317b7 | valderyaya/Competitive-Programming | Luogu/P1387.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define REP(i,n) for(int i=0;i<(n);++i)
#define REP1(i,a,b) for(int i=(a);i<=(b);++i)
#define em emplace_back
#define ALL(x) (x).begin(),(x).end()
#define mkp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>
#... | ALGO | 0.999908 | 3.387792 |
3e14342f-e64d-4b4f-8fbb-336ce8f72022 | yaserbelal/IEEE-CS-25 | Rookies/Task3/Number of Pairs.cpp | #include <iostream>
#include <algorithm>
using namespace std;
#define ll long long
ll countPairs(ll* a, ll n, ll l, ll r) {
ll count = 0;
sort(a, a + n);
for (ll i = 0; i < n - 1; ++i) {
ll low = i + 1, high = n - 1;
while (low <= high) {
ll mid = low + (high - low) / 2;
... | ALGO | 0.99987 | 4.676514 |
4d778e45-d1be-4cdb-a469-3808e60201db | muskan89/LeetCode | 135-candy/135-candy.cpp | class Solution {
public:
int candy(vector<int>& ratings) {
int n=ratings.size();
vector<int>candies(n,1);
int ans=0;
for(int i=1;i<n;i++){
if(ratings[i-1]<ratings[i] ){
candies[i]=candies[i-1]+1;
}
}
for(int i=n-2;i>=0;i--){
... | ALGO | 0.999999 | 6.285409 |
7701b632-92db-4229-b76a-a838ee4f0280 | whquddn55/Algorithm_BojSolves | 13000/13977.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
ostream& operator<<(ostream& os, const pii& pai) {
os << pai.first << ' ' << pai.second;
return os;
}
istream& operator>>(istream& is, pii& pai) {
is >> pai.first >> pai.second;
return is;
}
#ifdef ONLINE_JUDGE
#defi... | ALGO | 0.999934 | 4.844244 |
233a41cb-827e-4052-ba57-aa02c074880d | DhruvSharma4435/Coding | 0021-merge-two-sorted-lists/0021-merge-two-sorted-lists.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 * solve(List... | ALGO | 0.999986 | 5.785223 |
16af33ca-dfb9-45f0-9372-73168d6df473 | tanvirrahmanaz/Data_Structure_-_Algorithm | LeetCode/Math/9palindrome.cpp | #include <iostream>
using namespace std;
int main() {
class Solution {
public:
bool isPalindrome(int x) {
int i=x,rem=0,result=0 ;
if(x < 0){
return false;
}
else{
while(x != 0){
result = result * 10 + x % 10;
rem = x%10;
... | ALGO | 0.999832 | 5.823646 |
67f724e1-8872-4c92-b875-95e77ada85d0 | fmi-lab/up-2018-kn-group2-sem | ex10/sum.cpp | #include <iostream>
using namespace std;
int main() {
// row col
int a[2][3];
int b[2][3];
int sum[2][3];
for (int i = 0; i < 2; i++) { // n
for (int j = 0; j < 3; j++) { // m
cout << "Enter value for a[" << i << "][" << j << "]: ";
cin >> a[i][j];
}
}
for (int i = 0; i < 2; i++... | ALGO | 0.998761 | 3.51226 |
0cd46ac0-5f63-4c7d-af93-d11700b15281 | anatoliy281/HandyMath | main.cpp | /******************************************************************************
Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl,
C#, OCaml, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog.
Code, Compile, Run a... | TEST | 0.88229 | 4.521703 |
29725ead-c323-4d17-a3f9-c3a073cd3ad3 | haowanwuyifan/data_structure_and_algorithm | 字符串匹配/boyer_moore.cpp | /*------------------------------------------------------------------------------
* @file BRUTE_FORCE.CPP
* @author FIRMWARE TEAM
* @date 2024/02/17 12:04:47
* @brief THIS FILE PROVIDES ALL THE FIRMWARE FUNCTIONS.
* -----------------------------------------------------------------------------
/* Define t... | ALGO | 0.999734 | 5.292718 |
9907a9cf-a1a9-469d-ba37-5c1880d2fb37 | mytitanium/Titanium-Core-1.0 | src/messagesigner.cpp | #include <key_io.h>
#include <hash.h>
#include <validation.h> // For strMessageMagic
#include <messagesigner.h>
#include <tinyformat.h>
#include <utilstrencodings.h>
bool CMessageSigner::GetKeysFromSecret(const std::string& strSecret, CKey& keyRet, CPubKey& pubkeyRet)
{
keyRet = DecodeSecret(strSecret);
if (!k... | TOOL | 0.934508 | 6.778008 |
35964d04-a62d-4a64-a6c0-c2e8cb28e718 | Hong-kee/Problem-Solving | AlgorithmProject/BaekJoon1343.cpp | #include <iostream>
using namespace std;
int main() {
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
string s, answer; cin >> s;
int cnt = 0, cntA = 0, cntB = 0;
for (int i = 0; i < s.length(); i++) {
if (s[i] == '.') { // . Դ?
if (cnt % 2 != 0) { //ٵ X Ȧ?
cout << -1; //
return 0;
}
else ... | ALGO | 0.999699 | 4.018617 |
89cf663c-e639-4104-8797-3b8a57c2f969 | shubhampathak09/dynamic-programming-and-arrays | dynamic programing imp questions/max xor pair sum.cpp | #include<bits/stdc++.h>
using namespace std;
struct trienode
{
// int data;
struct trienode*left;
struct trienode*right;
trienode()
{
left=NULL;
right=NULL;
}
};
void insert(int val,struct trienode*root)
{
struct trienode*curr=root;
for(int i=31;i>=0;i--)
{
int b=(1<<i)&val;
if(b==0)
{
... | ALGO | 0.999928 | 4.62945 |
908891ad-149a-45db-912e-eeaa05127204 | Manos-Ar/Progtech | 2nd/specker_game.cpp | #include <iostream>
#include <stdexcept>
using namespace std;
class Move{
public :
Move (int sh, int sc, int th, int tc){
source_heap = sh;
source_coins = sc;
target_heap = th;
target_coins = tc;
}
int getSource() const{
return source_heap;
}
int getSourceCoins() const {
return ... | ALGO | 0.988451 | 3.908823 |
8dfb2aac-4d96-4a9e-a6dc-3ab7c947db61 | sumanbabum/TestAZureBoards | snippets/cpp/VS_Snippets_CLR_System/system.Random/cpp/uniquearray1.cpp | // <Snippet11>
using namespace System;
public enum class Suit { Hearts, Diamonds, Spades, Clubs };
public enum class FaceValue { Ace = 1, Two, Three, Four, Five, Six,
Seven, Eight, Nine, Ten, Jack, Queen,
King };
// A class that represents an individual ... | ALGO | 0.931932 | 6.143572 |
3c146b4d-ffa8-421a-81a7-351939162bb5 | shaiyona336/Algorithem-shai-jonathan | linkedList.cpp | #include "LinkedList.h"
#include <iostream>
using namespace std;
// Node class constructor
Node::Node(int data) {
this->data = data;
this->next = nullptr;
}
// LinkedList class constructor
linkedList::linkedList() {
head = nullptr;
}
// Insert a new node at the head of the list
void linkedList::insertAtH... | ALGO | 0.903917 | 4.723646 |
5f4a13c1-33a2-4249-9629-e3a3feae2b7d | FeRhodium/oicode | Codeforces/848D.cpp | #include <bits/stdc++.h>
template <typename T> T inverse(T a, T m) {
T u = 0, v = 1;
while (a != 0) {
T t = m / a;
m -= t * a, std::swap(a, m);
u -= t * v, std::swap(u, v);
}
assert(m == 1);
return u;
}
template <typename T> class Modular {
public:
using Type = typename std::decay<decltype(T::value)>::type;... | ALGO | 0.999952 | 4.878488 |
307b25f3-77b8-49a3-8e68-677c79665033 | byungsujeong/Foreigner | venv/Lib/site-packages/pystan/stan/lib/stan_math/lib/boost_1.69.0/libs/bimap/example/mi_to_b_path/mi_bidirectional_map.cpp | /******************************************************************************
Boost.MultiIndex
******************************************************************************/
#include <boost/config.hpp>
//[ code_mi_to_b_path_mi_bidirectional_map
#include <iostream>
#include <boost/tokenizer.hpp>
#include <boost/m... | ALGO | 0.988849 | 6.431124 |
2c40bd11-c015-4a9a-b07c-f154badd8471 | adai183/CarND-Path-Planning-Project | src/Eigen-3.3/unsupported/doc/examples/EulerAngles.cpp | #include <unsupported/Eigen/EulerAngles>
#include <iostream>
using namespace Eigen;
int main()
{
// A common Euler system by many armies around the world,
// where the first one is the azimuth(the angle from the north -
// the same angle that is show in compass)
// and the second one is elevation(the angl... | ALGO | 0.989945 | 5.125681 |
02750850-7eb0-41ab-aca6-7dfa58d6a277 | JasonCeng/MultipartyPSI-Pro | thirdparty/linux/miracl/miracl_osmt/source/curve/ps_big.cpp | /*
* C++ class to implement a power series type and to allow
* arithmetic on it
*
* WARNING: This class has been cobbled together for a specific use with
* the MIRACL library. It is not complete, and may not work in other
* applications
*
* See Knuth The Art of Computer Programming Vol.2, Chapter 4.7
*/
#i... | ALGO | 0.990214 | 3.42893 |
aa05d3da-4407-4c8e-b492-2eba8f0069a9 | asifmajeed04/Portfolio | 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.998859 | 6.785645 |
906d356c-18b4-4407-a71f-1c8a73aad46b | momomo546/atcoder | ABC/348/b.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr... | ALGO | 0.999978 | 4.863925 |
65dc1cf0-70eb-48f9-8bd8-1a0cfa2089c1 | AmitJNV-IIIT/GFG-Contest-Problems | Difficulty: Easy/Maximize Array Value After Rearrangement/maximize-array-value-after-rearrangement.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
int Maximize(vector<int> &arr) {int n=arr.size();
long long int s=0,m=1e9+7;
sort(arr.begin(),arr.end());
for(long long i=0;i<n;i++){
s+=(arr[i]*i);
}return s %m;
//... | ALGO | 0.999488 | 6.340624 |
2c1b2520-d628-48e1-a564-106913a41c12 | KhaledAbdelgalil/competitive-programming-book | chapter 3/problems/Complete Search/Iterative(Two Nested Loops)/12583.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
std::ifstream in ("input");
std::streambuf * cinbuf = std::cin.rdbuf (); //save old buf
std::cin.rdbuf (in.rdbuf ()); //redirect std::cin to in.txt!
int t;
cin>>t;
for(int tt=0;tt<t;tt++){
cout<<"Case "<<tt+1<<": ";
int... | ALGO | 0.999227 | 3.66569 |
0f7cd1c8-849c-456f-ab31-216faa5afa31 | BongoJuniorrr/CP-Code | qn_xaudx.cpp |
//"----------------------------------------------------------------------------------------"
//"- Author: Hirobi aka BongoJuniorr"
//"- School: Le Quy Don High School for the Gifted"
//"- Date: dd/mm/yyyy"
//"- Problem: "
//"- File: "
//"- I/O File: "
//"----------------------------------------------------------------... | ALGO | 0.999282 | 3.80107 |
dcc9ba4f-5dc6-403a-9009-9bdccb5dbf58 | mashiat-null/IWTlab | map/following_string.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define dl double
#define nl endl
#define all(v) v.begin(), v.end()
#define pb push_back
#define yes cout << "YES" << endl
#define no cout << "NO" << endl
int main()
{
int t;
cin >> t;
while (t--)
{
int n;
cin >> n;
string s;
... | ALGO | 0.999896 | 4.470797 |
aafe0431-63e3-406e-b45d-3e63d8bb8628 | tonmoy197/Road_to_1400_on_Codeforces | C_Chamo_and_Mocha_s_Array.cpp | #include <iostream>
#include <locale>
#include <vector>
#include <map>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
int tt; cin >> tt;
while( tt -- ){
int n; cin >> n;
vector<int> a(n);
for(auto &x : a) cin >> x;
int ans = 0;
for(int i = 0; i < n - 1; i ++){
... | ALGO | 0.999371 | 4.343835 |
ffd19c0d-d089-46a6-8d18-84ccaf24da34 | Mannat-Rai/Cpp-basics | rotated_half_pyramid.cpp | #include<iostream>
using namespace std;
int main()
{
//Program to print 180 deg rotated half pyramid.
int i , j , n;
cout<<"Enter n : "<<endl;
cin>>n;
for( i = 1 ; i <= n ; i++){
for( j = 1 ; j <= n ; j++){
if( j <= n - i ){
cout<<" ";
}
... | ALGO | 0.99983 | 3.783971 |
63a025a0-af88-4e02-8a68-237c591ddb67 | sezer1/daily_practice | data_structures_and_algorithm/day40/main.cpp | #include <iostream>
using namespace std;
struct AGACDUGUMPTR{
int data;
struct AGACDUGUMPTR *sol;
struct AGACDUGUMPTR *sag;
};
AGACDUGUMPTR *dugumekle(AGACDUGUMPTR *agacptr,int veri){
if(agacptr==NULL){
agacptr=(AGACDUGUMPTR *)malloc(sizeof(AGACDUGUMPTR));
if(agacptr!=NULL){
agacptr->data=ve... | ALGO | 0.999927 | 3.956326 |
19ab1dd4-7526-46c4-9f9e-fa231d0f6332 | NguyenTrieu903/C-C-_exercises | code chuong 5/lietkeTapcon.cpp | #include<iostream>
#define SIZE 50
using namespace std;
void xuat(int a[], int n);
void sinhNhiPhan (int n);
int dem=0;
int main() {
int n;
cin>>n;
sinhNhiPhan(n);
cout<<dem;
}
void sinhNhiPhan (int n) {
int a[SIZE]= {0};
int i;
do {
i=n-1;
xuat(a,n);
while(i>=0 && a[i]==1) {
a[i]=0;
i--;
}
if (i... | ALGO | 0.999802 | 3.66454 |
e7c9f355-1db5-45bb-a861-acb156a9d00b | rohitbhure65/DSA-WITH-CPP | Searching Technique/binary_search.cpp | #include <iostream>
using namespace std;
// An iterative binary search function.
int binarysearch(int arr[], int size, int key)
{
int r = 0;
int l = size - 1;
while (r <= l)
{
int mid = r + (l - r) / 2;
// Check if x is present at mid
if (arr[mid] == key)
return mid;... | ALGO | 0.999504 | 5.51378 |
c51c30c9-3b22-4ec2-81bf-1e3f1183c640 | kimtaemin1324/C-Programing | 배열을 이용한 최대최소 구하기/2023_07_16/2023_07_16/main.cpp | #include <stdio.h>
#include <time.h>
#include <stdlib.h>
#define SIZE 7
int main() {
srand(time(NULL));
int arr[SIZE] = { rand() % 100 };
int max = arr[0];
int min = arr[0];
for (int i = 1; i < SIZE; i++) {
if (arr[i] > max) {
max = arr[i];
}
if (arr[i] < min) {... | ALGO | 0.989124 | 3.838344 |
2c49265f-69ad-42e6-a148-0cd6de15aefb | rexstjohn/Scanplay | iOS/Core/CCBox2D/Xcode 3/cocos2d CCBox2D Application/libs/Box2D/Dynamics/Joints/b2PrismaticJoint.cpp | #include <Box2D/Dynamics/Joints/b2PrismaticJoint.h>
#include <Box2D/Dynamics/b2Body.h>
#include <Box2D/Dynamics/b2TimeStep.h>
// Linear constraint (point-to-line)
// d = p2 - p1 = x2 + r2 - x1 - r1
// C = dot(perp, d)
// Cdot = dot(d, cross(w1, perp)) + dot(perp, v2 + cross(w2, r2) - v1 - cross(w1, r1))
// = -dot... | ALGO | 0.999481 | 7.646193 |
b652b847-3297-4cb4-81d5-259335884b3e | whogurdevil/DSLAB | Programs/7DLStudent.cpp | #include<iostream>
#include<cstring>
using namespace std;
//Employee class to store data
class Employee{
public:
string ssn;
string name;
string dept;
string designation;
float sal;
string phno;
};
//DLL Node structure
class DLLNode{
public:
Employee emp... | ALGO | 0.985983 | 6.591431 |
e728d873-b058-42e4-a7e7-98c8c6af21f2 | ljianhui/Data-Structure | QuickSort/quicksort3_1.cpp | #include <iostream>
using namespace std;
/*******
ʹֵѡȡŦֵ
Сֵڵ0λ
ֵλã
ֵΪŦ뵹ڶݽλ
ݴС
*******/
typedef int DataType;
void QuickSort(DataType *data, int data_size);
void QSort(DataType *data, int left, int right);
DataType Median3(DataType *data, int left, int right);
void Swap(DataType &x, DataType &y);
void BubbleSort(DataT... | ALGO | 0.999987 | 4.476538 |
56c0d973-1fd8-458e-9f9d-84dbf2f54db3 | Timur41k-cmd/HomeWork | lab_10/lab_10_2.cpp | #include <iostream>
using namespace std;
void numFind(int arr[10],int max[2],int index_list[2]){
for(int x=0;x<10-1;x++){
if((arr[x]+arr[x+1])>(max[0]+max[1])){
max[0] = arr[x];
max[1] = arr[x+1];
index_list[0] = x;
index_list[1] = x+1;
}
}
... | ALGO | 0.999592 | 3.76036 |
a4101668-f8a8-4cd4-95ce-01a2d895e8a3 | shiva-shankar22/cpp | arrays/setZerosinMatrix.cpp | #include<vector>
#include<iostream>
using namespace std;
void setZero(int i,int j,vector<vector<int>> &mat,int n,int m){
for(int k=0;k<n;k++)
mat[k][j]=0;
for(int k=0;k<m;k++)
mat[i][k]=0;
}
void solve(vector<vector<int>> &mat){
int n=mat.size();
int m=mat[0].size();
vec... | ALGO | 0.999086 | 4.023593 |
26d41ada-5307-4061-baa7-27186f1290f1 | SharifulCSECoU/Numerical-Method | Source Code/Interpolation Through Backward Difference.cpp | #include<bits/stdc++.h>
using namespace std;
int n;
double x[100],y[100],d1[100],d2[100],d3[100],d4[100],d5[100],p;
double fun(void)
{
double sum;
sum=y[n-1]+p*d1[n-1]+p*(p+1)*d2[n-1]*(1/2.0)+p*(p+1)*(p+2)*d3[n-1]*(1/6.0)+p*(p+1)*(p+2)*(p+3)*d4[n-1]*(1/24.0)+p*(p+1)*(p+2)*(p+3)*(p+4)*d5[n-1]*(1/120.0);
re... | ALGO | 0.999916 | 3.525022 |
616fcf2d-97c6-454f-8910-d541d2bbca2e | michimani/atcoder | abc/201-300/289/cpp/a.cpp | #include <iostream>
using namespace std;
int main()
{
string s;
cin >> s;
for (auto &c : s)
{
if (c == '1')
{
cout << '0';
}
else
{
cout << '1';
}
}
cout << endl;
return 0;
} | ALGO | 0.999912 | 4.562318 |
76224791-e03c-4ac3-bdb0-9001780b47cf | MSP07/LeetCode-Solutions-CPLUSPLUS | HeightChecker.cpp | /*approach
make another array with same elements
sort it and check for given condition with increasing the var*/
class Solution{
int heightChecker(vector<int>& heights){
vector<int>expected = heights;
sort(expected.begin(),expected.end());
int cnt = 0;
for(int i=0;i<heights.size(... | ALGO | 0.999964 | 5.516688 |
c37f6383-bb26-4f1a-8728-0b1977049d87 | Sillyplus/Solution | Tyvj/p1597.cpp | #include <iostream>
using namespace std;
long gcd(long a, long b) {
if (a % b == 0) {
return b;
} else return gcd(b, a % b);
}
int main(int argc, const char * argv[])
{
long n, m;
cin >> n >> m;
if (gcd(n, m) == 1) {
cout << "YES" << endl;
} else {
cout << "IMPOSSIBLE"... | ALGO | 0.999899 | 3.988913 |
79425bab-93c8-4ccd-b04b-2aa5a0b8acc3 | Abraao8levi/ED2024 | Listas Simplesmente Encadeadas/main.cpp |
#include <iostream>
#include <climits>
struct Node {
int info; // Informacao salva pelo usuario na lista
Node *next; // Ponteiro para o proximo elemento da lista
Node(int info, Node *next){
this->info = info;
this->next = next;
};
};
void printNodes(Node* head){
Node* temp = head... | ALGO | 0.991537 | 5.004154 |
6a13ecbe-b1da-4d4f-9d98-19e8c3745a85 | mzssbqd/learning-code | algorithmic problem/ACM practice/union/p1706.cpp | #include<iostream>
#include<unordered_map>
using namespace std;
#define lowbit(x) ((x) & (-x))
unordered_map<int,int> ind;
int arr[10];
void print(int n)
{
for(int i = 1;i <= n; i++ )
{
printf("%5d",arr[i]);
}
printf("\n");
}
void dfs(int mask,int k,int n)
{
if(mask == 0)
{
pri... | ALGO | 0.999909 | 3.977352 |
80050f33-1090-446a-b9bc-54c6c54fa2fd | SanghunOh/Algorithm | BOJ/MST/1922.cpp | #include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;
typedef struct _graph{
int v1;
int v2;
int w;
}graph;
bool Comp(graph& a, graph& b){
return a.w < b.w;
}
int findParent(vector<int> parent, int x){
while(x != parent[x])
x = parent[x];
return x;
}
void unionSet(... | ALGO | 0.999992 | 4.842883 |
5eff87df-a3ad-4c26-ae99-0d9b1146d2c9 | ANI-IN/leetcode | 1358-number-of-substrings-containing-all-three-characters/1358-number-of-substrings-containing-all-three-characters.cpp | class Solution {
public:
int numberOfSubstrings(string s) {
int n=s.size();
int i=0,j=0,ans=0;
unordered_map<char,int> m;
while(j!=s.size())
{
m[s[j]]+=1;
while(m['a'] && m['b'] && m['c'])
{
ans+=(n-j);
... | ALGO | 0.999969 | 5.891718 |
06d20d5b-f261-43d0-a883-12f8acb0d7dd | ishandutta2007/codeforces | hellkitsune/normal/10/A.cpp | #include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <sstream>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <map>
#include <set>
#include <list>
#include <queue>
#include <stack>
#include <vector>
using namespace std;
#define pb push_back
#define mp make_pair
#defin... | ALGO | 0.99984 | 3.579551 |
0400f948-d622-4849-900a-daf5e56ae281 | Vavius/cocos_sph | SPH/libs/Box2D/Collision/b2CollideEdge.cpp | #include <Box2D/Collision/b2Collision.h>
#include <Box2D/Collision/Shapes/b2CircleShape.h>
#include <Box2D/Collision/Shapes/b2EdgeShape.h>
#include <Box2D/Collision/Shapes/b2PolygonShape.h>
// Compute contact points for edge versus circle.
// This accounts for edge connectivity.
void b2CollideEdgeAndCircle(b2Manifold*... | ALGO | 0.999798 | 7.506626 |
af7e5511-f67d-4726-99c0-9de6b828f924 | Algue-Rythme/ACM | louisB_524.cpp | #include <algorithm>
#include <cstdio>
#include <array>
#include <vector>
using namespace std;
int main() {
array<bool, 32> isPrime; isPrime.fill(true);
for (int n = 2; n < int(isPrime.size()); ++n) {
for (int j = 2; j*j <= n; ++j) {
if (n % j == 0) {
isPrime[n] = false;
... | ALGO | 0.999873 | 4.10391 |
777455e0-5666-44c3-91c0-dbe411742616 | qgxx/template | DataStructure/DSU(DisjointSetUnion).cpp | // 并查集
#include <algorithm>
using namespace std;
const int maxn = 1e5 + 10;
int p[maxn], sz[maxn], h[maxn];
int find(int x) {
return (p[x] == x ? x : p[x] = find(p[x]));
}
/**
* @brief 按秩合并(启发式合并),减慢退化
*
* @param h[] : 树高上界
* @param x
* @param y
*/
void merge(int x, int y) {
int px = find(x), py... | ALGO | 0.99995 | 4.009169 |
bb275cbc-8642-4630-a880-5085f1aa424c | Ph0en1xGSeek/ACM | LeetCode/sword2/006.cpp | class Solution {
public:
vector<int> twoSum(vector<int>& numbers, int target) {
int size = numbers.size();
vector<int> res(2);
int left = 0;
int right = size - 1;
while(left < right) {
if (numbers[left] + numbers[right] < target) {
++left;
... | ALGO | 0.999976 | 6.495605 |
6da2692a-6871-4153-a489-5b9727689dcd | pratiksaha/practice | mathematical/nearestLesserPrimeNumber.cpp | //to find the nearest prime less than n
#include<bits/stdc++.h>
#define MAX 1000000
using namespace std;
vector<int> primes;
void sieve() {
int n = MAX;
int nNew = sqrt(n);
int marked[n/2+500] = {0};
for (int i=1; i<=(nNew-1)/2; i++)
for (int j=(i*(i+1))<<1; j<=n/2; j=j+2*i+1)
ma... | ALGO | 0.999956 | 4.418016 |
d8c92b36-c47e-4f91-80bd-6abd1d27fafd | uday1874533/C-O-D-E-C-H-E-F | KALKI.cpp | #include <bits/stdc++.h>
using namespace std;
// PRABHAS AS KALI
// AMITABH AS ASHWADDHAMA
// KAMAL HASAN AS KALI
// DEEPIKA
// DISHA PATANI
// NTR AS PARASURAM
// DQ, NANI, VDK, RGV , RAJAMOULI ......
int main() {
int t;
cin>>t;
while(t--){
int n;
cin>>n;
int a, b;
vector<... | ALGO | 0.999892 | 3.82151 |
c7c01807-439e-4f79-ae5b-1258f02e9a97 | codemistic/Data-Structures-and-Algorithms | CPP/Problems/Leetcode-198-HouseRobber.cpp | class Solution {
public:
int fun(vector<int>& nums, int n,vector <int>& dp)
{
if(n==0) return nums[n];
if(n<0) return 0;
if(dp[n] != -1) return dp[n];
int pick = nums[n] + fun(nums, n-2,dp);
int notPick = 0 + fun(nums,n-1,dp);
return dp[n] ... | ALGO | 0.999933 | 5.871395 |
717fb5a4-d7ba-4201-bbe3-400e94de1ab2 | ASHISH-GITHUB2495/RESOURCES | 2.BASIC MATH (NUMBER THEORY)/segmented seive of eratosthenes.cpp | #include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll long long int
#define mp make_pair
#define mt make_tuple
#define mod 100000
#define for1(k,n) for(ll i=k;i<n;i++)
#define for2(k,n) for(ll j=k;j<n;j++)
#define E cout<<endl
#define max 50000
#define IOS ios_base:: sync_with_stdio(false);cin.t... | ALGO | 0.99992 | 3.570492 |
840d3c97-fb51-4bed-bb10-fe6322636c13 | raincross7/code-similarity | codes/train_code/problem264/problem264_139.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
ll ans = 0;
int main()
{
ll n ;
cin >> n ;
vector<ll> a(n+1);
rep(i, n+1){
cin >> a[i];
}
vector<ll> aa(n+1);
aa[n]=a[n];
rep(i,n)aa[n-i-1]=aa[n-i]+a[n-i-1];
aa[0]=1;
rep(i,n){
if(aa[i]-a[i]<=0){... | ALGO | 0.999838 | 3.443667 |
2a33d40e-8f33-4e29-9d06-748c188b8978 | Sumit4399/Problem-Solving | Maximum Profit - GFG/maximum-profit.cpp | // { Driver Code Starts
// Initial template for C++
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
// User function Template for C++
class Solution {
public:
int maxProfit(int k, int n, int prices[]) {
// code here
int dp[n+1][k+1][2];
memset(dp,0,sizeof(d... | ALGO | 0.99978 | 5.550876 |
d8b67ae4-07ba-4ef2-aa92-580df1290cad | KaziRifatAlMuin/Online-Judges | Codeforces/Archive/D_Lecture_Sleep.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int const N = 2e5 + 7;
const int MOD = 998244353;
ll maxSubArraySum(vector<ll> a, ll size, ll k) {
ll ans = INT_MIN, sum = 0;
for (ll i = 0; i < size; i++) {
if (i < k) {
sum += a[i];
ans = sum;
} el... | ALGO | 0.99997 | 4.063941 |
2cb0510c-bec6-4d85-9f01-54a834d7e269 | OpenCAXPlus/OpenCAXPlus | OpenDigitalTwin-main/tools/gmsh/Mesh/DivideAndConquer.cpp | // Triangulation using a divide and conquer algorithm
//
// The main idea is to be able to merge two Delaunay triangulations
// into a single one (see the 'Merge' function). Points are then
// separated into two groups, then each group into two, ... until
// having 1, 2 or 3 points (the triangulation is then trivial).
... | ALGO | 0.999485 | 4.469657 |
818659ea-6b05-454c-86d1-00eab6f3a30b | sangyong-99/algorithm_study | algorithm_study/programmers/Level_2/방문 길이.cpp | //
// 방문 길이.cpp
// algorithm_study
//
// Created by Shin Sangyong on 10/6/24.
//
#include <iostream>
using namespace std;
int dx[] = {0, -1, 0, 1};
int dy[] = {-1, 0, 1, 0};
bool datas[11][11][4];
int solution(string dirs) {
int answer = 0;
int x = 5, y = 5;
for(char c: dirs) {
int dir ... | ALGO | 0.999665 | 4.547484 |
83b2a6ec-2231-46a0-9f95-48200bbddbed | tori209/Algorithm_Solving_List | baekjoon/2446.cpp | /****************************
2446
: - 9
****************************/
#include <iostream>
#include <cstring>
using namespace std;
int main() {
char* str;
int n;
cin >> n;
for (int i = 0; i < n; i++) {
for (int j = 0; j < i; j++) cout << ' ';
for (int j = 2*(n - i) - 1; j > 0; j--) cout << '*';
cout <<... | ALGO | 0.999975 | 3.71296 |
878c410b-54e8-4b64-8395-d2b7db860f68 | splucs/Competitive-Programming | Codeforces/Gym/101041 I Brazilian Open Cup, Federal University Of Uberlandia/K.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
string s;
char c;
int b = 0;
while (cin>>s){
c = s[s.size()-1];
if (c=='-')b=max(0,b-1);
else b++;
}
cout<<b<<endl;
} | ALGO | 0.999206 | 3.739674 |
8909c044-2904-4fb7-9919-7f86ac5116b0 | sriragavip/sriragavip-6Companies30DaysChallenge-Arsh_Goyal | Adobe/13.Dungeon Game.cpp | class Solution {
public:
int calculateMinimumHP(vector<vector<int>>& dungeon) {
if(dungeon.empty())
return 0;
const int M = dungeon.size(), N = dungeon.front().size();
vector<vector<int>> dp(M, vector<int>(N, INT_MAX));
for(int i = M - 1; i >= 0; i--) {
... | ALGO | 0.999522 | 6.344438 |
75cd2bbc-3da0-434c-811b-7e6952105f2d | lemon0910/leetcode | Longest Palindromic Substring/Longest Palindromic Substring.cpp | class Solution {
public:
string longestPalindrome(string s) {
int dp[1000][1000];
memset(dp, 0, sizeof(dp));
int len = s.size();
if(0 == len)
return "";
for(int i = 0; i < len; ++i)
{
dp[i][i] = 1;
}
int maxlen = 1;
int sta... | ALGO | 0.999993 | 5.16944 |
05f8282d-2a17-49dc-acf2-bae39d6a9920 | tejaspandure/Logic-Building-Programms | program282.cpp | #include<iostream>
using namespace std;
int Addition(int iNo)
{
int iSum = 0;
int i = 1;
while(i <= iNo)
{
iSum = iSum + i;
i++;
}
return iSum;
}
int main()
{
int iValue = 0, iRet = 0;
cout<<"Enter number : "<<endl;
cin>>iValue;
iRet = Addition(iValue);
c... | ALGO | 0.998922 | 3.881939 |
afc6c906-d21b-455a-b8ad-851462cf4198 | Doldrums/Conspectus | School/Algorithms/sorts/insertion_sort.cpp | /**
* Insertion Sort algorithm for array of elements with arbitrary type
* Main idea is to split array into "sorted" and "unsorted" part.
* Every iteration "sorted" part increases and "unsorted" decreases by one;
*
* @tparam T Arbitrary type of elements
* @param array Array of sorting elements
* @param... | ALGO | 0.999901 | 5.163759 |
0670ec86-b2c2-457d-966c-4aae8d67edea | rohitkr963/PW-DSA | FUNCTIONS/ASSIGNMENT QUESITONS/oddNumber.cpp | #include<iostream>
using namespace std;
void square (int n,int r){
for(int i = n; i<=r; i++){
if(i%2!=0)
{
cout<<i<<" ";
}
}
}
int main(){
int a;
cout<<"enter first number";
cin>>a;
int b;
cout<<"enter second number";
cin>>b;
square(a,b);
} | ALGO | 0.998882 | 3.140277 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.