uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
f20c10fe-99f6-4913-b4ed-5d07dc7bdfd1 | DoHoangAnh2007/codeforces_master | B-set/441B.valera and fruits.cpp | #include<bits/stdc++.h>
typedef long long int ll;
using namespace std;
int main()
{
ll i,j,k;
ll n,v,temp;
ll count=0;
cin>>n>>v;
map<ll,ll> mp;
for(i=0;i<=3001;i++)
mp[i]=0;
for(i=0; i<n; i++)
{
cin>>j>>k;
mp[j]+=k;
}
ll ager, ajke;
for(i=0;i<=3001... | ALGO | 0.999929 | 3.39054 |
c74a0b89-f933-484b-82aa-10614ecea233 | tienvuiet/tienvuviet-C-session6 | luyentap6.cpp | #include<stdio.h>
int main(){
for(int i=1;i<=100;i++){
if(i%5==0&&i%3==0){
printf("FizzBuzz\n %d",i);
}
else if(i%3==0){
printf("Fizz\n %d",i);
}else if(i%5==0){
printf("Buzz\n %d", i);
}
}
return 0;
}
| ALGO | 0.999387 | 3.63818 |
e170fa46-197b-40e0-ae93-a2c3ec98c405 | RCSS-IR-CHALLENGE/Challenge_lib | rcsc/ann/rbf.cpp | // -*-c++-*-
/*!
\file rbf.cpp
\brief Basic Radial Basis Function Network class Source File.
*/
/////////////////////////////////////////////////////////////////////
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "rbf.h"
#include <random>
#include <algorithm>
#include <numeric>
#include <string>
#inc... | ALGO | 0.986829 | 6.083369 |
28b48b64-5064-43d4-be07-5dff7f585d21 | Rajveer-CSE-27/Coding-Journey-CPP | Graph/Striver series/53 most stones removed.cpp | // || जय जय जय बजरंग बली ||
#include<bits/stdc++.h>
using namespace std;
#define ll long long
/**
https://www.youtube.com/watch?v=OwMNX8SPavM&list=PLgUwDviBIf0oE3gA41TKO2H5bHpPd7fzn&index=53
https://www.geeksforgeeks.org/problems/maximum-stone-removal-1662179442/1?utm_source=youtube&utm_medium=collab_striver_ytdescrip... | ALGO | 0.999774 | 5.289817 |
b263cbd4-ad30-44f1-b28b-92861d3e8ee9 | HiddenCcash/model-predictive-control | src/Eigen-3.3/doc/examples/TutorialLinAlgComputeTwice.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main()
{
Matrix2f A, b;
LLT<Matrix2f> llt;
A << 2, -1, -1, 3;
b << 1, 2, 3, 1;
cout << "Here is the matrix A:\n" << A << endl;
cout << "Here is the right hand side b:\n" << b << endl;
cout << "Computing LLT... | ALGO | 0.999903 | 3.145425 |
5ea56125-06ba-4cd3-8237-4279a3063568 | ddark/ecl-core | src/server/scripts/EasternKingdoms/boss_kruul.cpp | /* ScriptData
SDName: Boss_Kruul
SD%Complete: 100
SDComment: Highlord Kruul are presumably no longer in-game on regular bases, however future events could bring him back.
SDCategory: Bosses
EndScriptData */
#include "ScriptPCH.h"
#define SPELL_SHADOWVOLLEY 21341
#define SPELL_CLEAVE 20677
#def... | TOOL | 0.890765 | 6.245036 |
f60a45cb-2c78-42c8-a9dc-510dfcc95d63 | animeshsahu80/Interviewbit-solutions | capture_regions_on_board.cpp |
void dfs(vector<vector<char> > &A,int i,int j){
if(i<0 || j<0 || i>=A.size() || j>=A[0].size() || A[i][j]=='X' || A[i][j]=='#')
return;
A[i][j]='#';
dfs(A,i+1,j);
dfs(A,i,j-1);
dfs(A,i-1,j);
dfs(A,i,j+1);
return;
}
void Solution::solve(vector<vector<char> > &A) {
// Do not write... | ALGO | 0.999647 | 5.255087 |
8a45af75-fab4-4de5-abb2-5423cffa5863 | Mohamed-ELshamy-1/Problem-Solving-Essay | Is it rated.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int Size;
cin >> Size;
int flag = 0;
int temp = 0;
int otherFlag = 0;
for(int i=0; i<Size; i++) {
int score1, score2;
cin >> score1 >> score2;
// rated
if(score1 != score2) {
flag = 1;
... | ALGO | 0.999884 | 5.107326 |
68db1de8-a171-44ec-98ad-f1c7904fc882 | joybhuiya36/Problem-Solving | Leetcode/Programming Skills II/Day 19/1797.cpp | class AuthenticationManager {
unordered_map<string,int> mp;
int time;
public:
AuthenticationManager(int timeToLive) {
time=timeToLive;
}
void generate(string tokenId, int currentTime) {
mp[tokenId]=currentTime+time;
}
void renew(string tokenId, int currentTime) {
... | ALGO | 0.980381 | 6.014356 |
255f8a09-aa7f-4eaa-9fbc-faab4a41e508 | Ankit77760/Stack-And-Queues | LRUCache.cpp | class LRUCache
{
public:
class node
{
public:
int key;
int val;
node *next;
node *prev;
node(int key, int val)
{
this->key = key;
this->val = val;
}
};
node *head = new node(-1, -1);
node *tail = new node(-1, -1);
... | ALGO | 0.998415 | 5.94742 |
bbb6e9db-be67-4632-bda7-88473bcfa3f3 | hari659tri/Grind_CP_Hard | 0342-power-of-four/0342-power-of-four.cpp | class Solution {
public:
bool isPowerOfFour(int n) {
if(n==1) return true;
if(n<=0||n%4!=0) return false;
return isPowerOfFour(n/4);
}
}; | ALGO | 0.999636 | 5.809764 |
d99907a4-1097-48c6-bc8c-d9b97457fcff | AntoineTalaat/Compilers-Project | src/SubsetConstruction.cpp | //
// Created by veror on 12/3/2023.
//
#include "nfa.h"
#include "subset_construction.h"
#include <iostream>
#include <fstream>
// Utils utils;
bool debug = false;
bool first = true;
SubsetConstruction::SubsetConstruction(NFA nfa) {
this->nfa = nfa;
}
void SubsetConstruction::setAlphabet(std::set <char> alphab... | ALGO | 0.998298 | 6.076325 |
4b919a57-8b75-43c0-8540-25ee8ab7cdd0 | KrzBan/Plagiarism-Detector | Projekt/project/app/mainwindow.cpp | #include "mainwindow.h"
#include "ui_mainwindow.h"
#include "levenshteindistance.h"
#include "simplealg.h"
#include "prepare.h"
#include "utils.h"
#include <iostream>
#include <QStateMachine>
#include <QHistoryState>
#include <QFileDialog>
#include <QListView>
#include <QTreeView>
#include <QDebug>
#include <QString>
#... | TOOL | 0.899119 | 5.791425 |
e6c240b5-efcf-4804-b9fc-3e9fd70c6c72 | adityapranavbhuvanapalli/leetcodes | 2161-stock-price-fluctuation/stock-price-fluctuation.cpp | class StockPrice {
public:
unordered_map<int, int> pricePerTime; //(time, price)
priority_queue<pair<int, int>> maxHeap;
priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> minHeap;
int latestTime;
StockPrice() {
}
void update(int timestamp, in... | ALGO | 0.99926 | 6.321492 |
e9abbbdc-4401-4578-83d1-222589d4c93c | ManishKrShahi/Leetcode-Solutions | 40-combination-sum-ii/40-combination-sum-ii.cpp | class Solution {
public:
void helper(int index, int target, vector<int>&candidates, vector<vector<int>>&ans, vector<int>&ds){
if(target == 0){
ans.push_back(ds);
return;
}
for(int i = index; i< candidates.size(); i++){
if(candidates[i] > target)
... | ALGO | 0.999989 | 6.424029 |
00e9f02f-143a-48be-ae8f-93a7555a0b91 | luqili/vultus | lib/3rdParty/Eigen/bench/bench_gemm.cpp |
// g++-4.4 bench_gemm.cpp -I .. -O2 -DNDEBUG -lrt -fopenmp && OMP_NUM_THREADS=2 ./a.out
// icpc bench_gemm.cpp -I .. -O3 -DNDEBUG -lrt -openmp && OMP_NUM_THREADS=2 ./a.out
// Compilation options:
//
// -DSCALAR=std::complex<double>
// -DSCALARA=double or -DSCALARB=double
// -DHAVE_BLAS
// -DDECOUPLED
//
#include... | TOOL | 0.903746 | 5.840695 |
ed3871f5-7f89-4132-ac45-e0db122bc64c | szymonrychu/ArduinoPlatformController | platformio/shared_libs/SimpleFOC/src/common/foc_utils.cpp | #include "foc_utils.h"
// function approximating the sine calculation by using fixed size array
// uses a 65 element lookup table and interpolation
// thanks to @dekutree for his work on optimizing this
__attribute__((weak)) float _sin(float a){
// 16bit integer array for sine lookup. interpolation is used for bette... | TOOL | 0.998271 | 6.900334 |
46f54f25-3df1-40a0-ba7e-4a151269c471 | mjwybrow/dunnart | libogdf/src/energybased/CoinTutteLayout.cpp | /*
* $Revision: 1.1 $
*
* last checkin:
* $Author: gutwenger $
* $Date: 2007-12-07 16:35:45 +0100 (Fri, 07 Dec 2007) $
***************************************************************/
#ifdef USE_COIN
#include <ogdf/energybased/CoinTutteLayout.h>
#include <ogdf/basic/GraphCopyAttributes.h>
#include <ogdf/... | ALGO | 0.999909 | 6.284879 |
696ccc56-73fd-43b7-8e94-54059820e3b5 | aquatiko/Leetcode-tracker | Till June 9th/Filling Bookcase Shelves.cpp | class Solution {
public:
int dp[1002][1002];
int m_cap;
int minHeightShelves(vector<vector<int>>& books, int shelf_width) {
memset(dp, -1, sizeof(dp));
m_cap = shelf_width;
return solve(books, 0, 0, 0);
}
int solve(vector<vector<int>> &books, int capacity, int pos, int heig... | ALGO | 0.999966 | 6.025392 |
52e40df3-e189-4754-b9c3-5a8df43ac1b5 | rahulkumarguptaa/coding-ninjas-data-structure | Backtracking/Sudoku Solver.cpp | /*
Coding Ninjas has provided you a 9*9 sudoku board. The board contains non zero and zero values. Non zero values lie in the range: [1, 9]. Cells with zero value indicate that the particular cell is empty and can be replaced by non zero values.
You need to find out whether the sudoku board can be solved. If the sudoku... | ALGO | 0.999773 | 5.692431 |
8494692c-1f42-408a-86ca-fdcfc9fc55cb | ShelpAm/competitive_programming | luogu/problem/P5016/main.cpp | #include <array>
#include <cmath>
#include <cstddef>
#include <iostream>
#include <numeric>
#include <ranges>
#include <string_view>
#include <vector>
using ::std::size_t;
// constexpr bool debug{false};
template<typename T> T read()
{
T tmp;
std::cin >> tmp;
return tmp;
}
template<typename value_t> class inpu... | ALGO | 0.999669 | 3.554696 |
cfd09db5-3763-42d5-9bb1-6502c1889625 | JuncoDH/CompetitiveProgramming | online_judges/UVA/10034 - Freckles.cpp | // Virtual contest with time(NULL)
// https://uhunt.onlinejudge.org/vcontest/4ef2ee1843d616061b9cdd2a96239196
#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define fi first
#define se second
using ll = long long;
using ld = long double;
using vi = vector<int>;
ld dist(ld a, ... | ALGO | 0.999615 | 4.745318 |
2400224f-f768-42c1-a79a-51a53ea96347 | ilyachalov/lafore-book-examples | Lafore-exercise-solutions/chapter_15/15chapter_02exercise.cpp | // исходный текст программы сохранен в кодировке UTF-8 с сигнатурой
// 15chapter_02exercise.cpp
// Требуется написать программу, которая применяет алгоритм sort к массиву
// слов, введенных пользователем, и выводит результат на экран. Для вставки
// слов в массив требуется применить метод push_back, а для вывода масси... | ALGO | 0.999778 | 5.048007 |
34c213ee-9f51-4464-b25c-a13d10019f95 | thomasxm/Akira-obfuscator | libc/src/math/generic/log2f.cpp | #include "src/math/log2f.h"
#include "common_constants.h" // Lookup table for (1/f)
#include "src/__support/FPUtil/FEnvImpl.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/__support/FPUtil/PolyEval.h"
#include "src/__support/FPUtil/except_value_utils.h"
#include "src/__support/FPUtil/multiply_add.h"
#include ... | ALGO | 0.998951 | 6.948813 |
d5b8deff-3938-4dfd-851f-b04a40099645 | meilleur777/Competitive_Programming | BOJ/cpp/1072.cpp | #include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); i++)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> intp;
void init_code() {
ios_base::sync_with_stdio(false); cin.tie(NULL);
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", ... | ALGO | 0.999883 | 3.979686 |
a097b0b9-4f24-4327-9c51-86c13b144810 | dirtyfilthy/llvm-project-14.0.6 | libcxx/test/std/algorithms/alg.sorting/alg.min.max/min_init_list_comp.pass.cpp | // UNSUPPORTED: c++03
// <algorithm>
// template<class T, class Compare>
// T
// min(initializer_list<T> t, Compare comp);
#include <algorithm>
#include <functional>
#include <cassert>
#include "test_macros.h"
int main(int, char**)
{
int i = std::min({2, 3, 1}, std::greater<int>());
assert(i == 3);
... | TEST | 0.993023 | 5.65264 |
43597a26-6027-4944-8b30-78d6ed3d5507 | GiovanaACosta/MobCidadeFlutter | 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 |
6ec1d676-bba3-475d-a9da-d4188459c63f | IMCG/icoding | OJLeetCode/PascalTriangle.cpp | /*Given numRows, generate the first numRows of Pascal's triangle.
For example, given numRows = 5,
Return
[
[1],
[1,1],
[1,2,1],
[1,3,3,1],
[1,4,6,4,1]
]
*/
#include <iostream>
#include <vector>
using namespace std;
class Solution {
public:
vector<vector<int> > generate(int numRows) {
vector<vector<i... | ALGO | 0.999855 | 5.42352 |
f2ecaffe-e7a4-4ba6-9e6a-b5a9230f46b0 | AlexanderJamesBecoy/ETHZ-RobotX-rss-workspace | src/lib/ocs2/ocs2_test_tools/ocs2_qp_solver/src/QpSolver.cpp | #include "ocs2_qp_solver/QpSolver.h"
#include <Eigen/LU>
#include <numeric>
#include <tuple>
namespace ocs2 {
namespace qp_solver {
/**
* Extracts the problem state and inputs dimensions as well as number of constraints from a linear quadratic approximation
* Looks at the size of the flowmap derivatives of the dyn... | ALGO | 0.998537 | 7.087381 |
03ef8c2d-caf5-4126-8f65-e210b4e83903 | Toysoft/OpenViX-Enigma2_Jan_27_2019 | lib/gdi/region.cpp | #include <lib/gdi/erect.h>
#include <lib/gdi/epoint.h>
#include <lib/gdi/region.h>
#include <lib/base/eerror.h>
#undef max
#define max(a,b) ((a) > (b) ? (a) : (b))
#undef min
#define min(a,b) ((a) < (b) ? (a) : (b))
/*
Region code.
A region is basically a list of rectangles. In this implementation,
rectangles ... | TOOL | 0.913063 | 7.370716 |
8d609111-7e7c-49cb-90f8-b77bdbaf62ab | zixuan-chen/Sjtu-OJ | 1212.cpp | #include <stdio.h>
#include <iostream>
#include <fstream>
using namespace std;
template <class elemType>
class seqQueue
{
private:
elemType * elem;
int maxSize;
int front, rear;
void doubleSpace(){
elemType * tmp = new elemType[2 * maxSize];
int i = 0;
while((i + front) % maxSize != rear){
tmp[i] = elem[(i... | ALGO | 0.999965 | 3.42207 |
59b0c559-8f59-433c-b27b-db813f1ae9ac | bruno-avr/competitive-programming | kattis/firefly.cpp | #include "bits/stdc++.h"
using namespace std;
#define optimize ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define endl "\n"
#define ll long long
#define ld long double
#define pii pair<ll,ll>
#define fi first
#define se second
#define pb push_back
#define all(x) x.begin(),x.end()
#define INF ... | ALGO | 0.999976 | 4.415293 |
8e136b64-e292-442c-a3b1-b2d9d0e03f3c | g0odg4mebrother/nyuthon_method | ConsoleApplication46/ConsoleApplication46.cpp | #include <iostream>
#include <cmath>
using namespace std;
double F(double x) {
return sin(x);
}
double Trapezoidalrule(double (*func)(double), double a, double b, int n) {
double h = (b - a) / n;
double sum = 0.5 * (func(a) + func(b));
for (int i = 1; i < n; ++i) {
sum += func(a + i * h);
... | ALGO | 0.998398 | 5.526721 |
b836149a-4a7d-4d46-8253-17249d6114c1 | doja117/cpp | busyMan.cpp | #include<iostream>
#include<vector>
#include<utility>
#include<algorithm>
using namespace std;
bool cmp(pair<int,int>p1,pair<int,int>p2){
if (p1.first==p2.first){
if (p1.second<p2.second) return true;
else return false;
} return true;
}
int solve(vector<pair<int,int>>v){
if (v.size()==0... | ALGO | 0.999918 | 5.329692 |
59619d66-c167-4842-8c10-0b78dac39d8b | Sumonta056/My-Codes | BASIC Pratices/prime number.cpp | #include <iostream>
using namespace std;
int main()
{
int n;
cin >> n;
int d=0,d1;
for(int i = 2 ; i<n ; i++)
{
if (n%i!=0) d1=0;
if(n%i==0) d1=1;
d=d+d1;
}
if(d==0) cout<<"prime number";
else cout<<"not prime number";
}
| ALGO | 0.999855 | 3.948331 |
b262531f-ec27-449e-9fec-c55ab2c54ab6 | backspacer303/Kretanja-prostora-i-SLERP-animacija | eigen/doc/examples/TutorialLinAlgComputeTwice.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main()
{
Matrix2f A, b;
LLT<Matrix2f> llt;
A << 2, -1, -1, 3;
b << 1, 2, 3, 1;
cout << "Here is the matrix A:\n" << A << endl;
cout << "Here is the right hand side b:\n" << b << endl;
cout << "Computing LLT... | ALGO | 0.999954 | 3.145425 |
b00e58d3-9106-49a4-a707-1572d5a97177 | mouhanad-alaskari/CP-Codes | LIS_BIT.cpp | /**
*
* Author: Mouhanad
* Lang: GNU C++14
*
**/
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define ii pair < int , int >
#define LS pair < ll , string >
typedef long long ll;
const int inf = 1<<30;
const int N =1000100 , mod = 1000000007;
int n , a[N] , k ;
ll bit[N][4];
void add ( ... | ALGO | 0.999809 | 3.70363 |
78522d5e-e5e4-4e61-b852-0ff76f1a790b | ThoseBygones/ACM_Code | CodeForces/CodeForces 807A.cpp | #include <bits/stdc++.h>
using namespace std;
#define MAXN 1005
int a[MAXN],b[MAXN];
int main()
{
int n;
scanf("%d",&n);
for(int i=1; i<=n; i++)
scanf("%d%d",&a[i],&b[i]);
for(int i=1; i<=n; i++)
{
if(a[i]!=b[i])
{
puts("rated");
return 0;
}... | ALGO | 0.999938 | 3.977775 |
9a6fbc23-dc20-413b-ae2b-511ad308d017 | AYUSHMOHANJHA/Code4CP | MustDoCoding/Greddy/MaxChain.cpp | //Time complexity : O(N*log(N))
#include <bits/stdc++.h>
using namespace std;
struct val{
int first;
int second;
};
int maxChainLen(struct val p[],int n);
int main() {
int t;
cin>>t;
while(t--)
{
int n;
cin>>n;
val p[n];
for(int i=0;i<n;i++)
{
cin>>p[i].first>>p[i].second;
}
cout<<maxChainLe... | ALGO | 0.99974 | 4.607736 |
9d8606fd-0b5a-4b27-ad8b-4dcb04124277 | jonh14lk/Competitive_Programming | Problem Solving/Final 2023/c.cpp | // essa solução não passava na hora da prova no BOCA, mas passa no codeforces
#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;
#define int long long int
const __int128 mod = (1ll << 62) - 1;
const __int128 c = 1e11 ... | ALGO | 0.999991 | 4.024758 |
c8933a06-d4f0-4df2-b9b4-2f151dcfd7e1 | Serenata2/MyProblemSolving | 백준/15822.cpp | #include <iostream>
#include <cstdio>
#include <cmath>
#define MAX_N 2000
using namespace std;
int N; //
int X[MAX_N + 1]; // X
int Y[MAX_N + 1]; // Y
int D[MAX_N + 1][MAX_N + 1];
int main(void)
{
cin >> N;
for (int i = 1; i <= N; i++) {
scanf("%d", &X[i]);
}
scanf("%d", &Y[1]);
// ʱȭ
D[1][1] = (X[1] - ... | ALGO | 0.999932 | 3.459194 |
fd79c244-5415-457f-ac77-ddb4712bd9f4 | vigneshu/CrackingTheCodingInterviewe | Chapter1/Q8.cpp | // Example program
#include <iostream>
#include <string>
bool isSubString(std::string str,std::string substr)
{
return ((str.find(substr) == -1)?false:true);
}
bool isRotated(std::string str1,std::string str2)
{
//return true
if(str2.length()!=str1.length)
return false;
bool isRotated = false;
... | ALGO | 0.999152 | 5.752446 |
fe4034b7-1267-4022-b60b-22429266bacd | lamphanviet/competitive-programming | light-online-judge/accepted-solutions/1030 - Discovering Gold.cpp | //============================================================================
// Author : LAM PHAN VIET - <EMAIL>
// Problem Name :
// Time Limit : .000s
// Description :
//============================================================================
#include <algorithm>
#include <bitset>
#include <cctype>
#... | ALGO | 0.999644 | 3.436539 |
74d68ab7-be57-4529-b3e8-8ea4781d0777 | Sakura1124/ZJU-DScode | 01/ex2.cpp | #include <stdio.h>
void MaxSubSeqSum4(int a[], int n) //复杂度为O(n);
{
int start = 0, end = n - 1, tmp = 0, tmp2 = 0, flag = 1, flag2 = 1;
int thisSum = 0, maxSum = 0;
for (int i = 0; i < n; i++)
{
if (a[i] == 0 && flag == 1)
{ //找到第一个0
flag = 0;
tmp2 = i;
}... | ALGO | 0.999928 | 3.256664 |
0c3390a6-ba51-4264-b3e1-a2f2c9a05cb4 | Diwakar1111/neumorphism | 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 |
b884322c-0f3c-4d24-88d2-def1571c9cac | rafalh26/Cpp | AlgorithmFun/AlgorithmFun/main.cpp | #include <iostream>
#include <cstdlib>
#include <ctime>
#include <vector>
#include <algorithm>
using namespace std;
void fillVector(vector<int>& myVector);
void printVector(const vector<int>& myVector);
void countFives(const vector<int>& myVector);
void sortVector(vector<int>& myVector);
int main()
{
vector<int> my... | ALGO | 0.99903 | 3.69137 |
c6e7b667-81de-445f-8e8b-c19b65f29aa0 | ledmer/CSC222 | Excercises/ch04/compare.cpp | #include <iostream>
#include <math.h>
#include <stdlib.h>
#include <string.h>
using namespace std;
void compare(int a, int b){
if (a > b){
cout << a << " it's greater than " << b << endl;
}
else if (a < b){
cout << a << " it's less than " << b << endl;
}
else {
cout << a << " it's the same as " << b << end... | ALGO | 0.990951 | 3.665685 |
15defc15-d041-49db-a371-c6f2ae8e1cd4 | Srishtik16/Leetcode-Submissions | 0769-max-chunks-to-make-sorted/0769-max-chunks-to-make-sorted.cpp | class fenwick_tree{
private:
vector<int> BIT;
public:
fenwick_tree(int n){
BIT.resize(n + 1, 0);
}
int query(int i){
int res = 0;
while(i >= 0){
res += BIT[i];
i = (i & (i + 1)) - 1;
}
return res;
}
void update(int i, int val){
... | ALGO | 0.999995 | 5.693648 |
c5e1c7f1-9cfe-433e-9ddf-07b7e86234eb | AlecVitoCeppetelliSpano/OpenSees | SRC/analysis/integrator/HHTGeneralized.cpp | // $Revision$
// $Date$
// $URL$
// Written: Andreas Schellenberg (<EMAIL>)
// Created: 10/05
// Revision: A
//
// Description: This file contains the implementation of the HHTGeneralized class.
#include <HHTGeneralized.h>
#include <FE_Element.h>
#include <FE_EleIter.h>
#include <LinearSOE.h>
#include <AnalysisModel.... | ALGO | 0.960543 | 4.442831 |
5818fabd-0291-42a2-be1a-52fa4c0be1ee | vita-student-projects/trafficsign_detection_pifpaf_gr5 | src/openpifpaf/csrc/src/cifdet.cpp | #include <algorithm>
#include <cmath>
#include <queue>
#include "openpifpaf/decoder/cifdet.hpp"
#include "openpifpaf/decoder/utils/cif_hr.hpp"
#include "openpifpaf/decoder/utils/cif_seeds.hpp"
#include "openpifpaf/decoder/utils/occupancy.hpp"
namespace openpifpaf {
namespace decoder {
int64_t CifDet::max_detections... | DATA | 0.981711 | 6.33593 |
f9a227cd-c516-469b-9dad-cb03bab8f676 | gabriele-0201/codeProblems | codeforces/queueAtSchool/queueatSchool.cpp | #include<iostream>
using namespace std;
int main(void) {
int n,t;
string q;
cin >> n;
cin >> t;
cin >> q;
for(int i = 0; i < t; i++) {
for(int j = 0; j < n; j++) {
if(q[j] == 'B' && q[j + 1] == 'G') {
q[j] = 'G';
q[j + 1] = 'B';
j++;
}
}
}
cout << q;
}
| ALGO | 0.999804 | 3.469591 |
fe118d3a-8ec6-400f-9110-7663a71c1259 | ritankarsaha/Competitive-Programming | Div_2/1903a.cpp | #include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<math.h>
#include<utility>
#include<stack>
#include<list>
#include<map>
using namespace std;
int main()
{
int t;
cin >> t;
while(t--){
int n,k;
cin >> n >> k;
vector<int>arr;
int num;
for(int i=0;i<n;i++){
... | ALGO | 0.999908 | 3.786064 |
3048ad82-51fc-4a69-a936-ac0b0ed59c04 | diegoado/advanced-algorithms | Basic/structures/BrokenKeyboard.cpp | /*
* University Federal of Campina Grande
* Student: Diego Adolfo Silva de Araújo
* Registry: 113210090
* Discipline: Algoritmos Avançados
*
* URI - Online Judge
* Problem: 1451 - Subsequences
* Time limit per test: 1 second
* Memory limit per test: 256 megabytes
* Input: standard input
* Output: standard ou... | ALGO | 0.999335 | 4.45469 |
8150e3b4-e412-49cd-9252-4894f7411c63 | deepam20050/competitive-programming | solutions/CF1623C.cpp | #include "bits/stdc++.h"
using namespace std;
#define sz(x) int((x).size())
#define all(x) begin(x), end(x)
#define eb emplace_back
#define em emplace
#define mp make_pair
#define F first
#define S second
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
using lli = long long;
using pii = pair < int, int >;
const... | ALGO | 0.999601 | 4.015664 |
19460fca-ca12-4ad7-9b50-6a12e56a17d3 | DevTwos/Kudi | 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 |
d10aa9a3-f7b4-462d-b381-0e45775a5ee9 | CubixPro/Transfer | Geeksforgeeks/bridgeOfAGraph.cpp | #include<bits/stdc++.h>
using namespace std;
/*
int root(int Arr[ ],int i)
{
while(Arr[ i ] != i) //chase parent of current element until it reaches root.
{
i = Arr[ i ];
}
return i;
}
modified union function where we connect the elements by changing the root of one of the element
in... | ALGO | 0.999786 | 5.108938 |
78debc94-1718-4147-a287-1e852d9cf6e1 | jhih-ching-yeh/GDSC-fight_leetcode | 551. Student Attendance Record I/sol 2.cpp | //sol 2.
class Solution {
public:
bool checkRecord(string s) {
return !std::regex_search(s, std::regex("A.*A|LLL"));
}
};
| ALGO | 0.98915 | 5.119778 |
38fa618d-7880-497c-a8b0-d96523c28fb8 | 0xpye/cp | code/230.shortcut.cpp | //Pye
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i = (a); i <= (b); i++)
#define FORR(i, a, b) for(int i = (a); i >= (b); i--)
#define pair pair <int, int>
#define maxn 100005
using namespace std;
int n, m, T, d[maxn], tr[maxn];
long long ans, c[maxn];
vector <pair> a[maxn];
vector <int> edge[maxn];
void dfs... | ALGO | 0.999974 | 4.721474 |
8a90d050-d307-44d3-944a-ba7fd72a110d | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_7013_7.cpp | #include <bits/stdc++.h>
using namespace std;
long long dp[55][55];
double comb[55];
int a[55];
int main(int argc, char **argv) {
int n, p;
int tot = 0;
double res = 0;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a[i];
tot += a[i];
}
cin >> p;
if (tot <= p) {
cout << n << endl;
return... | ALGO | 0.999876 | 3.520728 |
4767ecd1-6042-49e5-b405-a0a1e2d16f52 | AnAnYa0806/Coding-Ninja-Solved- | cpp notes/pattern 5.cpp | #include<iostream>
using namespace std;
int main() {
int n;
cin>>n;
int i = 1;
int k = 1;
while(i <= n) {
int j = 1;
while(j <= i){
cout<<k;
k--;
j++;
}
cout<<endl;
i++;
}
}
| ALGO | 0.999958 | 3.756117 |
d7d01cf6-da96-47a8-94e9-9e3b27b6be8f | liguigui/mandliya-algorithms_and_data_structures | bit_manipulation/multiply_by_7.cpp | /**
* Problem : Muliply a number by 7 by using bit manipulation.
* Approach : left shift n by 3 --> 8n
* Therefore 7n = 8n - n;
*/
#include <iostream>
int multiply_by_7( int number )
{
return ((number << 3) - number);
}
int main()
{
std::cout << "Enter a number:";
int num;
std::cin >> num;
std::cout << ... | ALGO | 0.999768 | 5.540632 |
e084295c-de84-4b02-a4d8-71f620c08576 | Berserxx/Royalpay | 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 |
f380efbf-b4a7-4c48-a5af-6b3504e0704c | Aleena-Mishra-10/Data-Structure | Binary Tree/checking_of_children_sum_property.cpp | #include<bits/stdc++.h>
using namespace std;
struct node{
int data;
struct node *left;
struct node *right;
};
void preorder(struct node *root);
struct node *insert();
bool checking_of_children_sum_property(struct node *root);
struct node *insert(){
int x;
struct node *new_node=(struct node*)malloc(sizeof(struct n... | ALGO | 0.999945 | 4.539614 |
b7bc90a4-d637-4979-9e19-49c648d0a245 | yutianwu/leetcode | codes/Container_With_Most_Water.cpp | class Solution {
public:
int maxArea(vector<int>& height) {
int front = 0, back = height.size() - 1, result = 0;
while (front < back) {
result = max(result, min(height[front], height[back]) * (back - front));
if (height[front] <= height[back])
front++;
... | ALGO | 0.99996 | 6.719511 |
e4f4c905-9359-4b55-93ea-a2312cf5973e | arafatmisbawebdeveloper/ProblemSolutionForCodeforcses | TornLuckyTicket.cpp | #include<bits/stdc++.h> //
using namespace std;
#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl '\n'
#define OR ||
typedef double dl;
typedef long long ll;
int main()
{
optimize();
ll n;
cin>>n;
vector<int>v(n);
ll ans = n;
ll even = 0,... | ALGO | 0.999959 | 4.186943 |
d1c29988-c65c-4a0d-a96c-02c4b606e72a | razimantv/leetcode-solutions | Solutions/T/top-k-frequent-words/Solution.cpp | // https://leetcode.com/problems/top-k-frequent-words
class Solution {
public:
vector<string> topKFrequent(vector<string>& words, int K) {
unordered_map<string, int> m;
for (const string& s : words) ++m[s];
set<pair<int, string>> sorted;
for (const auto& [k, v] : m) {
sorted.insert({-v, k});
... | ALGO | 0.99996 | 6.776321 |
5ea4e80f-94d8-47ff-a79c-0914bc8839ac | swaralichine/Leetcode-Solutions | 74-search-a-2d-matrix/74-search-a-2d-matrix.cpp | //Time Complexity=O(log(row*column))
//Space Complexity=O(1)
class Solution
{
public:
bool searchMatrix(vector<vector<int>>& matrix, int target)
{
int m=matrix.size();
if(m==0)
{
return false;
}
int n=matrix[0].size();
//Binary search
... | ALGO | 0.999977 | 6.197955 |
8fba99bc-9390-4456-bc65-6da37522fb52 | Noodle96/computer-Security | Lab01/main.cpp | #include <bits/stdc++.h>
using namespace std;
fstream fileIn, fileOut;
bool cmp(pair<long long, char> &pairA, pair<long long, char> &pairB){
return pairA.first >= pairB.first;
}
string function01(string line){
string ans;
for(int e = 0 ; e < (int)line.size(); e++){
/* si es -157 => viene un caracter especial*/
... | ALGO | 0.995041 | 3.389426 |
e0126fb5-a89c-4035-bcf8-0f3893f2887b | hsheric0210/Algorithm-Coding | cpp/BOJ/2661.wrong-1.cpp | // Olympiad > 한국정보올림피아드 > KOI 1997 > 중등부 1번
#define _CRT_SECURE_NO_WARNINGS // 망할 VCRT
#include<iostream>
#include<cstring>
#include<cstdlib>
using namespace std;
int i, j, k, l, x, y, z, N;
char s[105];
int cmp(int i, int j, int len) { return (i < 0 || j < 0) ? -2 : strncmp(s + i, s + j, len); }
int bad(int i)
{
for ... | ALGO | 0.999844 | 3.018105 |
8aa5649a-51e8-4716-891e-538fd0c8e861 | MupLever/algorithmsAndDataStructures | binary_search_tree.cpp | #include <iostream>
template<class T>
class Queue {
private:
struct Node {
Node* next;
T data;
Node(const T& _data) : data(_data), next(nullptr) {}
};
public:
Queue() : size(0), head(nullptr) {}
Queue(const Queue&) = delete;
Queue& operator=(const Queue&) = delete;
~Queu... | ALGO | 0.999913 | 4.705996 |
ebe94d1d-80b8-4cc6-a9c5-e16e618fa030 | codescoop/Play-with-Data-Structures | exercise_01_fundamentals/06_traffic_odd_even.cpp | /*
Problem: Due to an immense rise in Pollution, transport minister is back with the Odd and Even Rule.
The scheme is as follows, each car will be allowed to run on Sunday
if the sum of digits which are even is divisible by 4 or sum of digits which are odd in that number is divisible ... | ALGO | 0.999738 | 5.274913 |
927de1fc-9457-4cc1-81f4-2c9946068392 | sarvex/leetcode-machine | solution/1700-1799/1764.Form Array by Concatenating Subarrays of Another Array/Solution.cpp | class Solution {
public:
bool canChoose(vector<vector<int>>& groups, vector<int>& nums) {
auto check = [&](vector<int>& a, vector<int>& b, int j) {
int m = a.size(), n = b.size();
int i = 0;
for (; i < m && j < n; ++i, ++j) {
if (a[i] != b[j]) {
... | ALGO | 0.999957 | 6.198433 |
88a55f1f-dfc4-478a-b503-f20dd8b96207 | DoraemonOS-Base/android_system_core | libziparchive/unzip.cpp | #include <errno.h>
#include <error.h>
#include <fcntl.h>
#include <getopt.h>
#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <time.h>
#include <unistd.h>
#include <set>
#include <string>
#include <android-base/file.h>
#include <android-base/strings.h>... | TOOL | 0.984277 | 6.291152 |
27ec2ccc-b215-42c0-bb55-1b1ac97a3823 | SubhradeepSS/LeetCode-Solutions | cpp/Binary Tree Level Order Traversal II.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.999982 | 6.40842 |
5fa89f7e-94f4-479d-a767-428b41f2bfb8 | darienmt/CarND-Path-Planning-Project-P1 | src/Eigen-3.3/bench/sparse_cholesky.cpp | // #define EIGEN_TAUCS_SUPPORT
// #define EIGEN_CHOLMOD_SUPPORT
#include <iostream>
#include <Eigen/Sparse>
// g++ -DSIZE=10000 -DDENSITY=0.001 sparse_cholesky.cpp -I.. -DDENSEMATRI -O3 -g0 -DNDEBUG -DNBTRIES=1 -I /home/gael/Coding/LinearAlgebra/taucs_full/src/ -I/home/gael/Coding/LinearAlgebra/taucs_full/build/lin... | ALGO | 0.992059 | 4.147974 |
2120ec10-f9c4-4c9c-84c0-3fa168cfc8c0 | ajaffer/CarND-Path-Planning-Project | src/Eigen-3.3/doc/examples/QuickStart_example2_fixed.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace Eigen;
using namespace std;
int main()
{
Matrix3d m = Matrix3d::Random();
m = (m + Matrix3d::Constant(1.2)) * 50;
cout << "m =" << endl << m << endl;
Vector3d v(1,2,3);
cout << "m * v =" << endl << m * v << endl;
}
| ALGO | 0.990561 | 3.375595 |
0c01bd80-09d3-416d-adf9-9f8759334b56 | Nyoutaaa/pa_sdm632_common | gps/core/ContextBase.cpp | #define LOG_NDEBUG 0
#define LOG_TAG "LocSvc_CtxBase"
#include <dlfcn.h>
#include <cutils/sched_policy.h>
#include <unistd.h>
#include <ContextBase.h>
#include <msg_q.h>
#include <loc_target.h>
#include <loc_pla.h>
#include <loc_log.h>
namespace loc_core {
#define SLL_LOC_API_LIB_NAME "libsynergy_loc_api.so"
#define... | CONFIG | 0.891186 | 6.293383 |
38501aac-bf90-464a-9926-d233fdb5eb40 | YazanZebak/CompetitiveProgramming | Codeforces/CF431-D2-D.cpp | /*
Idea :
- We will search n by binary search , such function is monotone.
- Because the amount of numbers with exactly k 1-bits on a segment n+2 ... 2·(n+1) more or equal than amount of such numbers on segment n+1 ... 2·n.
- Last statement is correct, because of n+1 and 2·(n+1) have equals number of 1-bits.
... | ALGO | 0.99997 | 5.266841 |
dec2d575-9683-453a-a64b-c26a63307522 | Rodagui/UVa-Solutions | 11713 - Abstract Names.cpp | /*11713 - Abstract Names*/
#include <iostream>
#include <vector>
using namespace std;
int main(){
int casos;
cin>>casos;
cin.ignore();
while(casos--){
string word1;
string word2;
getline(cin,word1);
getline(cin, word2);
if(word2.size()!= word1.size()){
cout<<"No\n";
continue;
}
int n=0;
... | ALGO | 0.999978 | 4.837209 |
7576f686-4cd8-443f-915d-90931a13905f | Kalin0x0/bitcoin | src/util/settings.cpp | #include <fs.h>
#include <util/settings.h>
#include <tinyformat.h>
#include <univalue.h>
#include <fstream>
#include <map>
#include <string>
#include <vector>
namespace util {
namespace {
enum class Source {
FORCED,
COMMAND_LINE,
RW_SETTINGS,
CONFIG_FILE_NETWORK_SECTION,
CONFIG_FILE_DEFAULT_SECTION
}... | TOOL | 0.992844 | 7.20819 |
51bc4dc0-a274-4025-bfd4-646d2625ff12 | shuvo129/Compiler-Design-CSE3142 | Compiler Lab/Binary_number.cpp | #include<bits/stdc++.h>
using namespace std;
bool isBinary(char str[]){
//if(strlen(str)<2) return 0;
if(str[0]!='0') return 0;
for(int i=1;str[i];i++){
if(str[i]!='1'&&str[i]!='0') return 0;
}
return 1;
}
int main(){
char str[1000];
cin>>str;
if(isBinary(str)){
puts("... | ALGO | 0.996686 | 4.463874 |
fca3e707-00b9-44bc-8844-2ee51b77d96b | SatooRu65536/univ-img-proc | week12/prog01/main.cpp | #include <iostream>
#include <opencv2/opencv.hpp>
#define TARGET_IMG_FILE "bg.jpg"
#define TEMPLATE_IMG_FILE "face.jpg"
int main(int argc, const char* argv[]) {
cv::Mat src_img, template_img, compare_img, result_img;
// 入力画像
src_img = cv::imread(TARGET_IMG_FILE, cv::IMREAD_COLOR);
if (src_img.empty()) {
... | ALGO | 0.983235 | 4.240426 |
a5dcdef2-f92b-4e53-8190-9b87434b5ba6 | ishandutta2007/codeforces | yousef_salama/normal/1662/F.cpp | #include <bits/stdc++.h>
using namespace std;
struct segtree{
vector <long long> tree;
int n;
segtree(int n): n(n){
tree.resize(4 * n + 20, -(1 << 30));
}
void update(int i, int L, int R, int u, int val){
if(u < L || R < u)return;
if(L == R){
tree[i] = val;
... | ALGO | 0.999728 | 4.111348 |
3bc73fbc-19aa-45da-8c92-f300eef2382c | Nishikawa5/Competitive-Programming | Beecrowd/passando_o_professor_jacques_no_beecrowd/Maratona de Programação da SBC 2018/festival.cpp | #include <bits/stdc++.h>
using namespace std;
struct Show{
int start, end;
int musics;
int stage;
};
bool operator< (Show a, Show b) {
if (a.start != b.start) {
return a.start < b.start;
}
return a.end < b.end;
}
int fill_dp(int curr_pos, int mask, int stage_num, int total_shows, vecto... | ALGO | 0.999314 | 3.833814 |
88aa7e92-ceea-48f2-9fce-7b765e6131ae | MaxiCM/android_packages_apps_OTAUpdates | jni/boost_1_57_0/libs/graph/example/cycle_canceling_example.cpp | #include <boost/graph/cycle_canceling.hpp>
#include <boost/graph/edmonds_karp_max_flow.hpp>
#include "../test/min_cost_max_flow_utils.hpp"
int main() {
boost::SampleGraph::vertex_descriptor s,t;
boost::SampleGraph::Graph g;
boost::SampleGraph::getSampleGraph(g, s, t);
boost::edmonds_karp_max_flow(g, ... | ALGO | 0.992087 | 4.922384 |
5b38d504-0a3a-41db-a369-e9ab404ec3e3 | ishandutta2007/codeforces | als123/normal/1537/F.cpp | #include<cstdio>
#include<algorithm>
#include<iostream>
#include<cstring>
#include<vector>
using namespace std;
typedef long long LL;
const LL N=200005;
LL T;
LL n,m;
LL a[N],b[N];
vector<int> vec[N];
bool tf;
LL dep[N];
void dfs (LL x,LL fa)
{
dep[x]=dep[fa]+1;
LL siz=vec[x].size();
for (LL u=0;u<siz;u++)
{
LL y... | ALGO | 0.999963 | 3.786332 |
ff0382a4-7c08-4340-a714-5feb0b218025 | oshadamax/MyCplusplus | root/Games/Tic-Tac-Toe/AI.cpp | #include "AI.h"
#include <iostream>
AI::AI() : win(false) {}
bool AI::isWinner() const {
return win;
}
void AI::winner() {
win = true;
}
int AI::move(char B[][3]) {
// std::cout << "AI MOVES" << std::endl;
int total_void = 0;
int pos[9];
for (int i=0; i < 3; i++)
for (int j=0; j < 3; j++){
... | ALGO | 0.999218 | 4.782836 |
cf8d0c6a-a7a2-497a-9191-98a17e341cee | agrawalsajal02/Interviews-Preparation-and-Cp | Old CP repo competetive-coding/4 month -coding challange/3 part - graph theory -18mar-28 mar/dijkstra's algorithm/efficient way.cpp | //https://www.youtube.com/watch?v=NR4fpjuxnPA
//video link
#include<bits/stdc++.h>
using namespace std;
//cv
template<typename T>
class Graph{
unordered_map<T, list<pair<T,int> > > m;
public:
void addEdge(T u,T v,int dist,bool bidir=true){
m[u].push_back(make_pair(v,dist));
if(bidir){
... | ALGO | 0.999846 | 4.463659 |
2f5ea819-bcc9-4f03-8d62-7809a17d8df7 | khanhtc1202/cp | leetcode/prepare/1352.cpp | /*
https://leetcode.com/problems/product-of-the-last-k-numbers/
*/
#include <bits/stdc++.h>
using namespace std;
class ProductOfNumbers {
vector<int> prefix;
int size = 0;
public:
ProductOfNumbers() {
prefix.push_back(1);
size = 0;
}
void add(int num) {
if (num == 0) {
... | ALGO | 0.999947 | 6.191906 |
9af889b1-6827-4c1c-9575-507e9d0c0e85 | ucsb-cs24-f24/cs24-f24-sections | week07/1544-make-string-great.cpp | #include <iostream>
#include <stack>
#include <string>
using namespace std;
class Solution {
public:
string makeGood(string s) {
if(s.size() <= 1){
return s;
}
stack<char> l;
for(int i = 0; i < s.size(); i++){
if(l.empty()){
l.push... | ALGO | 0.999937 | 6.121975 |
54819a9b-4a3d-4abc-b512-925e88f2ca2c | ishandutta2007/codeforces | cuizhuyefei/normal/849/D.cpp | #include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<queue>
#include<vector>
#define fi first
#define se second
#define pb push_back
#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define rep(i,a,b) for (int i=a; i<=b; i++)
#define per(i,a,b) for (int i=a; i>=b; i--)... | ALGO | 0.999669 | 3.036407 |
59eb2cac-c177-471e-9c52-5e1303d5ef59 | Ashraftalaat/delivery | 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 |
d5a3f163-0578-43bd-8312-fab3d1bff454 | gopoma/competitive-programming | edu/misc/CountHowManyInRange.cpp | // sometimes pragmas don't work, if so, just comment it!
// #pragma GCC optimize(3,"Ofast","inline")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2")
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "helpers/debug.h"
#else
#define dbg(...) 0
#define chk(...... | ALGO | 0.999971 | 4.832003 |
91c7a91d-d0ea-492d-934c-70565f218747 | eddelbuettel/stackoverflow | 55797031/answer.cpp | #include <Rcpp.h>
#include <RcppEigen.h>
// [[Rcpp::depends(RcppEigen)]]
// [[Rcpp::export]]
Eigen::MatrixXd myfun(Eigen::Map<Eigen::MatrixXd> a,
Eigen::Map<Eigen::MatrixXd> b) {
Eigen::MatrixXd res = a * b;
return res;
}
/*** R
myfun(matrix(2,2,2), matrix(3,2,2))
myfun(matrix(as.numeric(1:... | ALGO | 0.988784 | 5.332006 |
3a658cf3-843d-4436-9eb0-e25600d58f37 | junsan/flutter_app | 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 |
1ce39374-ea45-41d1-b034-b4b6ecf6d59f | qiangrw/cracking-the-coding-interview | LeetCode/flatten-binary-tree-to-linked-list.cpp | class Solution {
public:
void flatten(TreeNode *root) {
if(root == nullptr) return;
if(root->left == nullptr && root->right == nullptr) return;
flatten(root->left);
flatten(root->right);
TreeNode *tmp = root->right;
root->right = root... | ALGO | 0.999908 | 5.801399 |
5aa2d64d-70f1-443a-aeb4-960acf7e87b1 | 007havegone/Algorithm | KMP及其优化/main.cpp | /*
ʵֵKMP㷨ԴĴ洢λô0ʼ
ٽ㼴ģʽjǰûκηͬӴʱnext[j]=-1
صλ1ʼ
*/
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
const int N = 1000;
int Next[N];
int NextVal[N];
// On+m nΪȣmΪģʽ
// On*m
int index_BF(const string& s,const string& t, int pos) {//posʼҵ㣬λ1ʼ
int i = pos - 1, j = 0;
int lens = s.length()... | ALGO | 0.999909 | 3.902631 |
df4a8ba3-fd70-4d84-ab48-e29aa4d0e1b2 | gustavomuller99/Algo | Templates/Strings/Suffix Array/main.cpp | #include <bits/stdc++.h>
using namespace std;
/* p -> suffix sort, c -> classes */
vector<int> p, c, lcp;
string s;
/* sort the cyclic shifts of a string, append '$' at the end to sort
* suffixes. */
void sort_suffixes() {
int n = s.size();
const int alphabet = 256;
vector<int> cnt(max(alphabet, n), 0)... | ALGO | 0.999973 | 4.151299 |
ad6219d2-0c95-427c-a7c8-e24330a4d63d | nikhil767raj/Codeforces-solutions | CF-1364B.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main() {
int t; cin >> t;
while (t--) {
int n, k = 0; cin >> n;
vector < int > v, vt;
for (int i = 0; i < n; i++) {
int elem; cin >> elem;
v.push_back(elem);
}
vt.push_back(v[0]);
k = 2;
int j = 0;
... | ALGO | 0.999917 | 3.726911 |
f9baffab-7b0c-4c5e-92a9-632ca0d3724b | king-yyf/cpcode | leetcode/lcb90/1.cpp | #ifdef sigma-yyf
#include "/Users/yangyf/Desktop/cpcode/leetcode/lc_help.hpp"
#endif
using namespace std;
#define all(c) (c).begin(), (c).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define f0(e) for(int i = 0; i < (e); ++i)
#define f1(e) for(int i = 1; i <= (e); ++i)
#define f2(i,e) ... | ALGO | 0.999896 | 4.778837 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.