uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
9623d182-60cf-4e55-ad34-f583183ee2ea | MikMoreno/3013-Algorithms-Moreno | Assigments/P02/main.cpp | /*****************************************************************************
*
* Author: Miklos Moreno
* Label: P02
* Title: Processing in Linear Time
* Course: CMPS 3013
* Semester: Spring 2022
* Description:
*
* A linked list search program t... | ALGO | 0.997474 | 5.378728 |
ac678fc9-7372-44d3-bb28-74d494a63954 | Kapilraj9755/Project | CODING BLOCKS/Linkedlist/InsertLastelement.cpp | #include <bits/stdc++.h>
using namespace std;
struct node{
int data;
node*next;
node(int val){
data=val;
next=NULL;
}
};
node* creat(int n){
node*head=NULL;
node*last=NULL;
for(int i=0;i<n;i++){
int x;
cin>>x;
node*temp=new node(x);
if(head==NU... | ALGO | 0.998543 | 3.762717 |
83d9bf3d-c515-454b-aeb6-7713b49b5f68 | scott123159/Principles-and-Applications-of-Digital-Image-Processing | HW4/mainwindow.cpp | #include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QFileDialog>
#include <cmath>
#include <complex>
#include <fftw3.h> //使用快速傅立葉轉換函式庫
#include <opencv2/opencv.hpp> //使用離散傅立葉轉換函式庫
#include <random> //常態分布函式庫
using namespace cv; //opencv命名空間
double n = 2.25; ... | ALGO | 0.914685 | 4.218955 |
f930737f-b07c-4297-8873-cc901d469f16 | vmeomeo/FUB_FocusArea_AdvAlg | Assignment01/CPP/fmindex_pigeon_search.cpp | #include <sstream>
#include <seqan3/alphabet/nucleotide/dna5.hpp>
#include <seqan3/argument_parser/all.hpp>
#include <seqan3/core/debug_stream.hpp>
#include <seqan3/io/sequence_file/all.hpp>
#include <seqan3/search/fm_index/fm_index.hpp>
#include <seqan3/search/search.hpp>
int main(int argc, char const* const* argv) ... | ALGO | 0.955274 | 4.988372 |
cd777b2a-9d3b-4b0a-a108-370fea5a5b8f | AriskiRiyan/ariskiriyan-07.1.2021.0036 | tugas3.cpp | #include<iostream>
using namespace std;
int main()
{
int a,t;
float bagi=1/2,luas;
cout<<"masukan alas segitiga : ";
cin>>a;
cout<<"masukan tinggi segitiga : ";
cin>>t;
luas=0,5*a*t;
cout<<"luas segitiga adalah "<<luas;
return 0;
}
| ALGO | 0.996562 | 3.527025 |
b2c98109-0e02-4058-b109-49c4f020499e | Galaxy2416/bookstore | coding_life/Programer interview guide with CPP Code/cppcode/others/randXPowerK.cpp | #include <iostream>
#include <vector>
/*
假设函数 Math.random()等概率随机返回一个在[0,1)范围上的数,那么我们知道,在[0,x)区 间上的数出现的概率为 x(0<x≤1)。给定一个大于 0 的整数 k,并且可以使用 Math.random() 函数,请实现一个函数依然返回在[0,1)范围上的数,但是在[0,x)区间上的数出现的概率为 xk(0<x ≤1)。
*/
#include <cmath>
using namespace std;
double randXPower2()
{
return max( (double) rand() / (RAND_MAX), ... | ALGO | 0.996011 | 3.718581 |
2ba1bc9b-cb29-4720-a66b-3a6f003769e3 | Uzer447/Code | Codeforces/Margarite and the best present.cpp | #include <bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
int t;
cin >> t;
while (t--)
{
ll l,r;
cin>>l>>r;
l--;
ll leftsum=0;
ll rightsum=0;
if(l%2==0)
{
leftsum=l/2;
}
else
{
... | ALGO | 0.999717 | 3.943897 |
b4581132-0ea6-4cbf-8d3e-17fd08add546 | shahzaneer/Data-Structures-and-Algorithms | Codes/DS and Algo/Math/Armstrong.cpp | #include <iostream>
#include <cmath>
using namespace std;
//* What is an Armstrong Number?
// A number is thought of as an Armstrong number
// if the sum of its own digits raised to the power
// number of digits gives the number itself.
// For example, 0, 1, 153, 370, 371, 407 are
// three-digit Armstrong n... | ALGO | 0.999822 | 5.034969 |
d696b040-987c-4111-960d-5dcd58e1eedc | hselasky/usb4 | contrib/llvm-project/llvm/lib/Support/StringExtras.cpp | #include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/Support/raw_ostream.h"
#include <cctype>
using namespace llvm;
/// StrInStrNoCase - Portable version of strcasestr. Locates the first
/// occurrence of string 's1' in string 's2', ignoring case. Returns
/// the offset of s2 in s1 or... | TOOL | 0.948474 | 6.827849 |
1d9aa9f8-380a-4e1b-bf58-a03609f00edd | Ethan-Stephenson/CLionProjects | ProgrammingProject5/main.cpp | #include <iostream>
#include <fstream>
#include <string>
using namespace std;
//Reads the provided csv file and sets the values to the string and int array for the
//height, name, and city name of the data
void arrayDeclaration(ifstream&, string[][2], int[]);
//Sorts the data via height from largest to smallest using... | ALGO | 0.991643 | 4.393212 |
abded35b-9cdd-459b-8728-917a63caaef4 | riteshkushwaha7/DSA | Subarrays with K Different Integers.cpp | class Solution {
public:
int subarraysWithKDistinct(vector<int>& nums, int k) {
return atMostK(nums, k) - atMostK(nums, k - 1);
}
private:
int atMostK(vector<int>& nums, int k) {
int l = 0, r = 0, cnt = 0;
map<int, int> mpp;
while (r < nums.size()) {
mpp[nums[r]... | ALGO | 0.999851 | 6.622371 |
88f2d675-c25b-47e9-b30f-d57a82820575 | sidijju/Practice | 0723a.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
int main(){
vector<int> a;
int n;
for (int i = 0; i < 3; i++) {
cin >> n;
a.push_back(n);
}
sort(a.begin(), a.end());
cout << a[2] - a[1] + a[1] - a[0] << endl;
}
| ALGO | 0.999744 | 3.772442 |
fb818857-715d-422c-94ad-116a12e1ae6a | ShivamShrivastav26112005/DSA-C-REVISION | Part 3 Arrays/Part3_Arrays.cpp | // Problem on arrays -:
// Normal sorting -: using sort() fun.
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
void display(vector<int>& v){
for(int i=0; i<v.size(); i++){
cout<<v[i]<<" ";
}
cout<<endl;
}
int main(){
vector<int>v;
v.push_back(2);
v.push... | ALGO | 0.999982 | 5.052963 |
d26c60c3-0203-44b0-9e3a-d8a02b91aed6 | Erazor1980/CarND-MPC-Project | 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 |
f1ceca4f-ef7e-4200-80cc-399c33f59976 | Zobio/atCoder-works | work/tenkei51.cpp | #include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
#define uint unsigned int
#define ll long long
#define ull unsigned long long
#define ld long double
#define rep(i, n) for (long long i = 0; i < n; i++)
#define reps(i, n) for (long long i = 1; i <= n; i++)
#define rrep(i, n) ... | ALGO | 0.999988 | 3.491329 |
c8d8cc6f-87bc-4ed7-b1a1-b094fbcc6ae1 | Divyaantkj01/Phonebook-Directory | Edit Contacts.cpp | int EditContacts()
{
Node *temp=head;
cout<<"***********"<<endl;
cout<<" Press 1 if you want to Search By Name"<<endl;
cout<<" Press 2 if you want to Search By Number"<<endl;
int Ecommand;
cout<<" Enter the Command: ";
cin>>Ecommand;
if(Ecommand==1)
{
... | TOOL | 0.951568 | 3.070794 |
639a379f-306b-4448-9963-6d525ba9c5e3 | bewuethr/stroustrup-ppp | code_snippets/Chapter20/chapter.20.1.2-3.cpp |
//
// This is example code from Chapter 20.1.2 "Generalizing code" of
// "Programming -- Principles and Practice Using C++" by Bjarne Stroustrup
//
#include "std_lib_facilities.h"
//------------------------------------------------------------------------------
double* get_from_jack(int* count); // jack puts double... | ALGO | 0.999169 | 5.36421 |
c0a4d821-5382-4147-a47e-d0ec15fc0e61 | Project-Xtended/external_ComputeLibrary | src/core/CPP/kernels/CPPNonMaximumSuppressionKernel.cpp | #include "arm_compute/core/CPP/kernels/CPPNonMaximumSuppressionKernel.h"
#include "arm_compute/core/Helpers.h"
#include "arm_compute/core/Validate.h"
#include "src/core/helpers/AutoConfiguration.h"
#include "src/core/helpers/WindowHelpers.h"
#include <algorithm>
namespace arm_compute
{
namespace
{
Status validate_a... | ALGO | 0.921362 | 7.226637 |
25ec2156-b2b2-4892-acfb-53f8da299ef1 | Jody-Lu/Array | 154_find_min_in_rotated_array_II/find_min_II.cpp | #include <iostream>
#include <vector>
using namespace std;
class Solution
{
public:
int findMin(vector<int>& nums)
{
if(nums.size() == 1) return nums[0];
int pivot = 1;
while(pivot < nums.size())
{
if(nums[pivot - 1] <= nums[pivot]) ++pivot;
else
{
return min(nums[pivot], nums[0]);
}
}
... | ALGO | 0.999932 | 5.440836 |
1c97347c-ae7f-4144-97f5-6bee616ab9a0 | psychehose/LeetCode | 0217-contains-duplicate/0217-contains-duplicate.cpp | class Solution {
public:
bool containsDuplicate(vector<int>& nums) {
std::set<int> s(nums.begin(), nums.end());
return s.size() != nums.size();
}
}; | ALGO | 0.997841 | 5.898722 |
4b907568-01aa-4679-821a-86e80ece331e | Volgarenok/spbspu-labs-2024-tp-a | nikitov.dmitriy/T3/main.cpp | #include <iostream>
#include <fstream>
#include <iterator>
#include <functional>
#include <algorithm>
#include <vector>
#include <map>
#include "figures_struct.hpp"
#include "commands.hpp"
int main(int argc, char* argv[])
{
using namespace nikitov;
std::vector< Polygon > data;
if (argc == 2)
{
std::ifstre... | TOOL | 0.90677 | 4.834062 |
c5431004-59cb-452a-a55c-05385a18e657 | aryaman1802/dsa | 0_Intro_Problems/leetcode_231_power_of_2/cpp_soln.cpp | #include <iostream>
#include <math.h>
using namespace std;
bool isPowerOfTwo_v2(int n){
if(n > pow(2,30)){
return false;
}
else if(n < 1){
return false;
}
else{
// if the number of 1 bits is equal to 1
// then the number is a power of 2
int count=0;
w... | ALGO | 0.982234 | 4.763782 |
b004d76f-49d4-4966-9246-cc045c770c32 | lusul/micmac | src/uti_phgrm/CPP_GCPBascule.cpp | #include "StdAfx.h"
#include "Apero/Apero.h"
#define DEF_OFSET -12349876
// 1 X Y X2 XY Y2
int NLDDegFlagX[6] ={0 ,1 ,0 ,2 ,1 ,0 };
int NLDDegFlagY[6] ={0 ,0 ,1 ,0 ,1 ,2 };
extern const char* NamePolQuadXY[6];
// static const char * PolXY[6] = {"1","X","Y","X2","XY","Y2"};
int FlagOfDeg(const s... | TOOL | 0.982566 | 3.8892 |
180db4a4-875d-4348-a1bd-0b380cb721c8 | raviRB/SPOJ-backup | SILVER - Cut the Silver Bar.cpp | #include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
int main(){
int n;
cin>>n;
while(n!=0){
int num =2,count=1;
while(num<n)
{
num*=2;
count++;
}
if(num==n)
cout<<count<<"\n";
else
cout<<count-1<<"\n";
cin>>n;
}
return 0;
}
| ALGO | 0.999908 | 3.744913 |
0c133da0-8ed9-4aab-ad66-ecda998c6cc1 | haejin315/baekjoon | baekjoon15(백트래킹)/baekjoon15-5(9663_N-Queen).cpp | #include <iostream>
using namespace std;
bool lup[27] = { 0 };
bool ldo[27] = { 0 };
bool check[15];
int a[15];
int s = 0;
void z(int b, int n) {
if (b == n) {
s++;
return;
}
for (int i = 0; i < n; i++) {
if (check[i]) continue;
if (!lup[i + b] && !ldo[i - b + n - 1]) {
lup[i + b] = true;
ldo[i - b... | ALGO | 0.999754 | 3.83446 |
72deac91-6798-46d7-9d15-2785d5818c40 | Mobashara215/XPSC_with_phitron | week 6/day 2/string_game.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
int test;
cin>>test;
while(test--){
int p;
cin>>p;
string m;
cin>>m;
int zero=0,one=0;
for(int i=0;i<p;i++){
if(m[i]=='0'){
zero++;
}... | ALGO | 0.999762 | 5.017089 |
3582766b-72d0-443a-acfe-fa182cbae1cb | Omar622/ACM | ECPC 19/PRACTICE - C. Coffee.cpp | /* Do it! */
/* OMAR */
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
void init(){
cin.tie(0);
cout.tie(0);
cin.sync_with_stdio(false);
}
struct lst{
int s, m, l;
};
int main(){
// o:
init();
freopen("coffee.in", "r", stdin);
string coff, name, siz;
... | ALGO | 0.988017 | 3.444631 |
ab95baba-e648-4c81-b352-76eae502f682 | NJUSeclab/OCFI | ocfi/llvm/lib/CodeGen/MachineLoopUtils.cpp | #include "llvm/CodeGen/MachineLoopInfo.h"
#include "llvm/CodeGen/MachineLoopUtils.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/TargetInstrInfo.h"
using namespace llvm;
namespace {
// MI's parent and BB are clones of each other. Find the equivalent ... | TOOL | 0.984571 | 7.296523 |
1c043e18-03be-4d0f-b66e-f60940baf542 | danielhO9/PS | CODEFORCES/1914A.cpp | #include <bits/stdc++.h>
using namespace std;
void solution() {
int n; cin >> n;
string s; cin >> s;
int cnt[26];
for (int i = 0; i < 26; ++i) cnt[i] = 0;
for (auto i: s) {
++cnt[i - 'A'];
}
int ans = 0;
for (int i = 0; i < 26; ++i) {
if (cnt[i] >= i + 1) ++ans;
}
cout << ans << '\n';
return;
}
int mai... | ALGO | 0.99986 | 4.654462 |
2c5ac912-1232-45c7-9790-214ba515b10d | NE-Shahidul-Islam/Data_Structure_Assaignment | 2-1 DS/Graph/Q5_Graph_linkedList.cpp | #include <iostream>
#include <stdlib.h>
using namespace std;
struct Node {
int data;
Node* next;
};
typedef Node* node;
struct List {
node head;
void init() {
head = NULL;
}
void insert(int val) {
node newNode = (node)malloc(sizeof(Node));
newNode->data = val;
... | ALGO | 0.999941 | 4.418655 |
f97848ec-af5c-4272-bba6-82a2dfe4fcbb | codygeary/CVfunk-Modules | src/Ouros.cpp | #include "rack.hpp"
#include "plugin.hpp"
using simd::float_4;
const float twoPi = 2.0f * M_PI;
simd::float_4 twoPiSIMD = simd::float_4(twoPi);
using namespace rack;
template<typename T, size_t Size>
class CircularBuffer {
private:
T buffer[Size];
size_t index = 0;
public:
CircularBuffer() {
// ... | TOOL | 0.902116 | 6.236618 |
bdbc28b0-b16f-4bb4-ba09-66c5286ffe2e | HarshGalav/Leetcode-Best-Practice | 1547-minimum-cost-to-cut-a-stick/1547-minimum-cost-to-cut-a-stick.cpp | class Solution {
public:
int f(int left, int right, vector<int>& cuts, vector<vector<int>>& dp) {
if (left + 1 == right) return 0;
if (dp[left][right] != -1) return dp[left][right];
int cost = INT_MAX;
for (int i = left + 1; i < right; i++) {
int currentCost = (cuts[r... | ALGO | 0.999904 | 5.873456 |
5617ada6-53db-4e13-9fec-711a0171253c | sarvex/leetcode-ocaml | solution/2500-2599/2593.Find Score of an Array After Marking All Elements/Solution.cpp | class Solution {
public:
long long findScore(vector<int>& nums) {
int n = nums.size();
vector<bool> vis(n);
using pii = pair<int, int>;
priority_queue<pii, vector<pii>, greater<pii>> q;
for (int i = 0; i < n; ++i) {
q.emplace(nums[i], i);
}
long lo... | ALGO | 0.99999 | 4.889348 |
dc7f8d8a-8409-46cd-89fa-0e81c85e19f0 | TylerOvenden/4_stage_multi | Assembler/Assembler.cpp | /*
ESE 345 MIPS ASSEMBLER
Group 2: Robert Bacigalupo and Tyler Ovenden
*/
#include <iostream>
#include <string>
#include <algorithm>
#include <sstream>
#include <bitset>
#include <vector>
#include <fstream>
using namespace std;
enum class string_code {
M_ADDL,
M_ADDH,
M_SUBL,
M_SUBH,
LONG_MADDL,
... | ALGO | 0.955706 | 4.927832 |
201abcdd-1288-4f71-b1c9-3cd2df35e9ea | Sagarbha1991/com.example.trilinos | packages/ml/test/MLAPICompare/cxx_main.cpp | /* ******************************************************************** */
/* person and disclaimer. */
/* ******************************************************************** */
#ifndef HAVE_CONFIG_H
#define HAVE_CONFIG_H
#endif
#include "ml_config.h"
#include "ml_common... | TOOL | 0.971544 | 5.173414 |
41e2b0ac-86ee-405c-854c-5cc55ae53fc0 | goyalh4164/Data_Structure_Algorithm | Problems/692.Top K Frequent Words.cpp | #include <vector>
#include <map>
#include <algorithm>
#include <utility>
using namespace std;
class Solution {
public:
bool compare(pair<int,string> p1,pair<int,string> p2){
if(p1.first>p2.first) return true;
return p1.second<p2.second;
}
vector<string> topKFrequent(vector<string>& words, int k) {
m... | ALGO | 0.999976 | 6.130809 |
21e57b7b-6c72-4c3a-8cdc-dd856f43759b | qw225967/Bifrost | worker/src/rtc/sequence_manager.cpp | /*******************************************************
* @author : dog head
* @date : Created in 2023/6/16 10:55 上午
* @mail : <EMAIL>
* @project : worker
* @file : sequence_manager.cpp
* @description : TODO
*******************************************************/
#include "sequen... | ALGO | 0.875086 | 6.922015 |
06bd7c0e-d401-465b-a9aa-5a42e0430714 | DuckKnight-rpg/opencv | modules/gapi/src/compiler/passes/helpers.cpp | #include "precomp.hpp"
#include <algorithm> // copy
#include <unordered_map>
#include <unordered_set>
#include <ade/util/filter_range.hpp>
#include <opencv2/gapi/own/assert.hpp> // GAPI_Assert
#include "compiler/passes/helpers.hpp"
namespace {
namespace Cycles
{
// FIXME: This code is taken directly from AD... | ALGO | 0.979965 | 7.659398 |
526050bf-f54b-4ef2-aca0-dd90edfc5f76 | ololuki/Nonograms | core/solver/line/SingleDotsAroundFinishedBlocksSolver.cpp | #include "SingleDotsAroundFinishedBlocksSolver.h"
void SingleDotsAroundFinishedBlocksSolver::solve(const LineOfHints& hints, LineOfCells& cells) const
{
if (hints.size() == 0)
{
return;
}
if (hints.front().getBlockSize() == 0)
{
return;
}
drawDotsOnFirstBlock(hints, cells);
drawDotsOnLastBlock(hints, cel... | ALGO | 0.999438 | 4.981359 |
6ba9ae9d-0ae1-4d0d-9886-b205c66604de | Pushpendra9045/Data-structure | dynamicProgramming/maximum_cuts.cpp | #include<iostream>
#include <algorithm>
using namespace std;
int maximum(int x,int y,int z)
{
if(x>y && x>z)
return x;
if(y>x && y>z)
return y;
else
return z;
}
int find_maximum_cuts(int n,int a,int b,int c)
{
if(n<0)
return -1;
if(n==0)
return 0;
int res=maximum(find_maximum... | ALGO | 0.999975 | 4.071526 |
0414074f-277c-489e-9cf6-bc3b9ce505d1 | hiro1729/atcoder | ABC/ABC301-400/ABC366/G/O(N^2)/G.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
int N, M;
cin >> N >> M;
vector<ll> g(N);
for (int i = 0; i < M; i++) {
int u, v;
cin >> u >> v;
u--;
v--;
g[u] |= 1LL << v;
g[v] |= 1LL << u;
}
vector<ll> c(N);
ll C = 0;
for (int i = 0; i < N; i++) {
int k = -1;
... | ALGO | 0.999992 | 4.410271 |
891c549e-43df-42f3-8f22-a56f1a7c181b | VietKhoaTran/Code-C | 9f(3).cpp | #include <iostream>
#include <math.h>
using namespace std;
int main()
{ int n;
cin>>n;
int temp = 10;
int x=0;
int y=0;
int a=n;
int dem1=0;
int dem2=0;
int dem3=0;
while(a!=0){
dem1++;
a=a/10;
}
a = n;
for(int i = dem1 - 1 ; i >= 0; i = i - 2)
... | ALGO | 0.999946 | 3.582116 |
9925a5db-6671-4510-8ec7-77a96596c712 | MagaliValencia1/Proyecto | E_22.cpp | #include <iostream>
using namespace std;
int main(){
int num = 1;
while(num < 1000){
if(num % 2 == 0 && num % 7 == 0){
cout << num << endl;
}
num ++;
}
return 0;
}
| ALGO | 0.996612 | 3.586264 |
95048abc-ee99-428a-85cb-a55e6aeb5850 | Seyamalam/DMOJ | Ccc15j5.cpp | // Ivan Carvalho
// Solution to https://dmoj.ca/problem/ccc15j5
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 251;
// Ultimo, restam
int n, k;
int dp[MAXN][MAXN][MAXN];
int solve(int numero, int pessoas, int restam) {
if (pessoas == 0 && restam == 0) return 1;
if (restam < 0 || numero > restam ... | ALGO | 0.999954 | 3.657223 |
89c2fcbc-5199-4f4e-bbcc-d4d50393eb31 | ganlubbq/communication-system-simulation | OFDM/Pilot adaptation for LTE-A/Optimal pilot spacing/receiver.cpp | #include "define.h"
#include "receiver.h"
#include <cstdlib>
#include <cmath>
#include <fstream>
#include "modem.h"
#include "fft.h"
#include "turbo.h"
#include <iostream>
using namespace std;
//#define QUANTIZATION_BIT 2 // 1 for hard decision decoding
// Quantize the soft input x[]
inline void quanti... | ALGO | 0.999738 | 3.890704 |
6efa8805-62b9-4738-bba1-37f153e029ec | tamle29092004/LeVanTam_MonC | Chương 4/Program 4-1 tới 4-30/Program_4_22.cpp | // This program calculates a consultant's charges at $50
// per hour, for a minimum of 5 hours. The ?: operator
// adjusts hours to 5 if less than 5 hours were worked.
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
const double PAY_RATE = 50.0; // Hourly pay rate
const int MIN_HOURS = ... | ALGO | 0.998278 | 6.333117 |
d5614471-c6a0-4d4c-ab0e-31e10a325081 | redcapital/algo | advent-of-code/2022/12/01.cpp | #include <iostream>
#include <string>
#include <vector>
#include <cstring>
#include <map>
#include <sstream>
#include <cstdio>
#include <algorithm>
#include <queue>
using namespace std;
#define VI vector<int>
#define FOR(i,n) for(int i=0; i<n; i++)
#define FORE(i,n) for(int i=0; i<=n; i++)
#define FOS(i,s,n) for(int ... | ALGO | 0.999168 | 3.172891 |
7721a841-0195-4173-9dd8-836b3602cb8a | tty1538/algorithm | tiling2.cpp | #include <iostream>
using namespace std;
const int MOD = 1000000007;
int N;
int cache[101] = {0, };
int tiling(int N)
{
if(N <=1 ) return 1;
int &ret = cache[N];
if (ret != 0)
return ret;
return ((tiling(N-1) + tiling(N-2)) % MOD);
}
int main()
{
int T;
cin >> T;
for(int i=0; i<T; i++)
... | ALGO | 0.999876 | 4.894008 |
4bdf0f99-d551-4811-9a90-edb7cd9821bb | Nan-C01/Xpectrelabs-bootcamp-2024-marzo | 5-arrays-y-vectores/ejercicio3.cpp | // Crea un array con un tamaño de 10, inserta los valores numéricos que desees
// de la manera que quieras y muestra por pantalla la media de valores del array.
#include <iostream>
using namespace std;
char salida;
void mediaValores(int suma, int n) {
cout << suma / n;
}
int main() {
int arreglo[10] = {7,5... | ALGO | 0.989428 | 3.891567 |
08333d30-a598-4dcb-8c93-f41088d6f72a | Saccilotto/ppi_exploration | Fastflow/mandel/mandel_farm.cpp | #include <stdio.h>
#include "marX2.h"
#include <sys/time.h>
#include <math.h>
#include <iostream>
#include <chrono>
#include "ff/pipeline.hpp"
#include "ff/farm.hpp"
#define DIM 800
#define ITERATION 1024
using namespace ff;
//using namespace std;
void runPipe(int dim,double init_b,double step,double init_a,int ni... | ALGO | 0.999424 | 4.245044 |
eccddbec-6ce8-471e-9dd6-7e38c931a806 | DPS0340/DoItDataRithm | 01/Q13.cpp | #include <iostream>
#include <cstdio>
using namespace std;
int main() {
for(int i=1;i<10;i++) {
for(int j=1;j<10;j++) {
printf("%3d", i+j);
}
printf("\n");
}
}
| ALGO | 0.990894 | 3.687238 |
e9fb1e8c-e64d-4665-9d7b-07c757952e5c | hnyblom/Artificial-Intelligence-DD2380-2 | TTT3D/player.cpp | #include "player.hpp"
#include <cstdlib>
#include <cmath>
#include <tuple>
#include <vector>
#include <algorithm>
#include <limits>
#include <climits>
#include <cstdint>
/*
By: Hanna & Nicole
*/
namespace TICTACTOE3D{
using namespace std;
int rowDanger(const GameState &pState, int i, int j, int l, int cell){
if(... | ALGO | 0.999756 | 3.597625 |
95d91050-596e-4950-8e9d-c2b8688e257b | bluarry/daily_problem | 算法学习/动态规划/lcs(最长公共子序列).cpp | /*
* lcs问题是求两个字符串的最长公共子序列,子序列不必要连续;
*动态转移方程为:
*dp[i][j]表示序列长分别为i和j的最长公共子序列
* =max(dp[i][j]+1,dp[i+1][j],dp[i][j+1]) s[i]==t[i];
* dp[i+1][j+1]=
* =max(dp[i+1][j],dp[i][j+1]);
*
*
* /
*/
#include <iostream>
#include <string>
#include <cstring>
using namespace std;
int main()
{
str... | ALGO | 0.999926 | 4.198752 |
54f57a4c-dc5b-4d13-8268-98bd8a03c213 | IraShinking/CPP-Programming-Homework | DateComputor.cpp | #include<iostream>
using namespace std;
class Date
{
public:
Date(int y=0,int m=0,int d=0):year(y),month(m),day(d){}
void add(int i);
void minus(int j);
void operator++();
void operator--();
void operator++(int);
void operator--(int);
int dateComplutor(const Date &d2)const;
void... | ALGO | 0.969791 | 4.247007 |
9923dc60-08e2-4eec-93c9-b6a3c69cf868 | joaocarvoli/programming-logic | algorithms/easy/diagonalDifference.cpp | // Problem reference: https://www.hackerrank.com/challenges/diagonal-difference/problem
// Predefined complexities: size = O(1)
// Code complexity: O(N^2)
#include <iostream>
#include <bits/stdc++.h>
int diagonalDifference(std::vector<std::vector<int>> matrix){
int primary = 0, secondary = 0;
int matrixCol = int... | ALGO | 0.999976 | 5.714977 |
6485b665-68ac-4907-b78e-5772ab77fd4a | ishandutta2007/codeforces | tfg/normal/348/A.cpp | #include <iostream>
#include <vector>
#include <chrono>
#include <random>
std::mt19937 rng((int) std::chrono::steady_clock::now().time_since_epoch().count());
int main() {
std::ios_base::sync_with_stdio(false); std::cin.tie(NULL);
int n;
std::cin >> n;
std::vector<int> a(n);
long long l = 0, r = 2e9;
for(int i ... | ALGO | 0.999956 | 4.796158 |
7beb50f0-b570-4e3e-ad18-48095558b552 | samiulalimsaad/Phitron | 2nd Semester/Algorithm/MID/4_Can_Go.cpp | #include <bits/stdc++.h>
using namespace std;
#define pii pair<long int,long int>
const int N = 1e5 + 5;
vector<pii> arr[N];
long int visited[N];
long int dis[N];
long int n, e;
void dijkstra(int s) {
priority_queue <pii, vector<pii>, greater<pii>> pq;
pq.push({ 0,s });
dis[s] = 0;
while (!pq.empty(... | ALGO | 0.999973 | 4.269178 |
4e242a5c-2482-4320-8459-a548114ab580 | Bikubisw/Coding | DATA STRUCTURES AND ALGORITHMS/s.cpp | #include<iostream>
#include <algorithm>
using namespace std;
int FindUnique(int arr[], int size){
int ele=0;
for(int i=0;i<size;i++){
ele=ele^arr[i];
}
return ele;
}
int main() {
int size;
cin>>size;
int *input=new int[1+size];
for(int i=0;i<size;i++)
cin>>input[i];
cout<<FindUnique(in... | ALGO | 0.999925 | 4.078053 |
6148222f-1d23-4f06-886d-7eabd5c3c0ec | Harsh-Kumar-Mahto/Programs | 1_College/Cpp training/2_Patterns/1_Triangle.cpp | /*
$
$ $
$ $ $
$ $ $ $
$ $ $ $ $
*/
#include <iostream>
using namespace std;
int main()
{
int n;
cin >> n;
for (int i = 1; i <= n; i++)
{
for (int j = 1; j <= i; j++)
{
cout << '$' << " ";
}
cout << "\n";
}
return 0;
} | ALGO | 0.998863 | 3.285823 |
5ac40122-8f9a-4da5-ba45-431b53a66fd9 | prakashita/ADS | 8.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int a[10] = {2, 1, 0, 1, 2, 1, 1, 0, 0, 1}; // Initialize the array
int l = 0, m = 0, h = 9; // Initialize the pointers
while (m <= h) {
if (a[m] == 0) {
// Swap a[m] and a[l] and move l and m pointers forward
swap(... | ALGO | 0.999996 | 5.058261 |
66a0b9c1-e1a8-478e-bada-5d70449f2da8 | sunputawan/POSNC-Archive | POSNC/2564/pre-camp/2021 revision/08 - Backtracking/Pre Ex/premutation .cpp | #include <iostream>
//#include <vector>
#include <string>
using namespace std;
void permute(string s, string p,int n){
if(p.size()==n){
cout<<p<<endl;
return;
}
for(int i=0;i<s.size();i++){
if(s[i]==' ') continue;
char tmp_char = s[i];
p.push_back(s[i]);
s[i... | ALGO | 0.999946 | 3.905816 |
7e2804fd-445d-4f9a-97d2-0f82cd3e1861 | Arijit1809/Leetcode | high-five/high-five.cpp | class Solution {
private:
int K;
public:
vector<vector<int>> highFive(vector<vector<int>>& items) {
this->K = 5;
map<int, priority_queue<int, vector<int>, greater<int>>> allScores;
for (const auto &item: items) {
int id = item[0];
int score = item[1];
... | ALGO | 0.999915 | 5.831428 |
028e3b25-a96f-41ff-a79b-ee3698c18de7 | mehmeddemircan/C-PROJECTS | c++projects/tek-cift-ayristirma.cpp | #include <stdio.h>
#include <conio.h>
#include <math.h>
#include <iostream>
#include <algorithm>
using namespace std ;
int main() {
int sayilar ,ciftAdet = 0 , tekAdet = 0 , sayiAdet = 0 ;
// tek cift sayi ayristirma programi
cout << "ne kadar sayi girmek istiyorsunuz : " ;
cin >> sayiAdet ;
... | ALGO | 0.999278 | 4.203447 |
ac6a68d2-8168-4bea-9d6f-e651b12e164c | Dhanashri47/CodeX_Flutter | practical1/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.998303 | 6.763549 |
6c44d06e-8525-455c-8a33-fc6428d67316 | equadras/CompetitiveProgramming | Contests udesc/obi_contest/d.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int n, s; cin >> n >> s;
int v;
vector <int> pref(n+1);
map <int, int> mp;
mp[0] = 1;
int r = 0;
for(int i= 0; i < n; i++){
cin >> v;
pref[i+1] = pref[i] + v;
if(pref[i+1] >= s){
r += mp[pref[i+1... | ALGO | 0.999899 | 3.199996 |
0403c206-5d48-4cc3-8df9-9dac7c148d4a | Jackent2B/My-DSA | Array/mergedIntervals.cpp | //gfg
vector<pair<int,int>> overlappedInterval(vector<pair<int,int>> vec, int n) {
//code here
vector<pair<int,int>> mergedIntervals;
if(n==0)
return mergedIntervals;
sort(vec.begin(),vec.end());
pair<int,int> temp = vec[0];
for(auto i:vec){
if(i.first<=temp.secon... | ALGO | 0.999993 | 5.949393 |
41d6228d-81d2-4750-80fa-6a6f79f8ca4d | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_4752_1.cpp | #include <bits/stdc++.h>
const int N = 1 << 20;
int v[N];
long long pwm(long long n, long long p, long long m) {
long long ans = 1;
for (long long tmp = n; p > 0; p >>= 1, tmp = (tmp * tmp) % m)
if (p & 1) ans = (ans * tmp) % m;
return ans;
}
long long inv(long long n, long long m) { return pwm(n, m - 2, m); ... | ALGO | 0.999895 | 3.994968 |
43723167-46d0-42d8-b69f-af54aa6ee387 | showmic96/Online-Judge-Solution | LeetCode/Sum of Left Leaves.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.999835 | 6.243706 |
cab5768c-be6f-4c61-889f-d5059187ada5 | weidong-zhu/DE | src/dedup.cpp | //
// Created by victor on 6/1/17.
//
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <dirent.h>
#include <iomanip>
#include <sys/stat.h>
#include <unistd.h>
#include <sys/types.h>
#include <iostream>
#include <openssl/sha.h>
#include <openssl/md5.h>
#include "dedup.h"
#include "com_t.h"
dedup::d... | TOOL | 0.947099 | 3.246757 |
a904cd96-5f68-4048-abee-b36e0550e2f9 | bala-chandar12/DSA-C- | very_hard/[1410] Sun Loungers [VH].cpp | /*
#### Sun Loungers ####
A long stretch of beach is represented by a string of two characters 0 - free, 1 - occupied. Due to recent restrictions, a new person cannot take place next to another. There has to be one free place between two people lounging on the beach. Create a function to compute how many new people ... | ALGO | 0.998061 | 3.030277 |
83511397-679c-433d-aa7c-1947d937b858 | zs634134578/DailyTouch | leetcode_old/016beautifulString.cpp | /*
*
*/
#include<iostream>
#include<string>
#include<map>
using namespace std;
#define debug(x, y) std::cout << "(debug)" << x << y << std::endl;
#define print(x) std::cout << x << std::endl;
class Solution
{
public:
bool mapAnalyzer(map<char, int> &chMap)
{
int size = chMap.size();
map<c... | ALGO | 0.999996 | 3.87689 |
b5486431-8392-493e-bd93-e8cff8fd7360 | leggedrobotics/ocs2 | ocs2_core/src/constraint/StateConstraintCppAd.cpp | #include <ocs2_core/constraint/StateConstraintCppAd.h>
namespace ocs2 {
/******************************************************************************************************/
/******************************************************************************************************/
/***********************************... | TOOL | 0.988378 | 6.154406 |
b5f8425d-f64e-4d5e-ab3a-1ec78e5b7742 | vfolunin/archives-solutions | EOlymp/2315.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <string>
using namespace std;
int main() {
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
int size, queryCount;
cin >> size >> queryCount;
vector<int> a(size);
for (int &va... | ALGO | 0.999695 | 3.905026 |
5e7adec8-de15-4460-9eac-162fc0e39f83 | yashparmar15/Cpp-Codes | Winner.cpp | // The winner of the card game popular in Berland "Berlogging" is determined according to the following rules. If at the end of the game there is only one player with the maximum number of points, he is the winner. The situation becomes more difficult if the number of such players is more than one. During each round a ... | ALGO | 0.99992 | 4.613923 |
e17e2971-ef9c-4d53-8fba-53fee857d80e | solareenlo/atcoder | 05_AtCoder-Beginner-Contest/abc182/D/main.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll n, a, res, q, x, p;
int main() {
cin >> n;
while (n--)
{
cin >> a;
p += a;
q = max(q, p);
res = max(res, x + q);
x += p;
}
cout << res << '\n';
return 0;
}
| ALGO | 0.999763 | 3.754065 |
2607145c-c505-4a4e-a654-764cb6d0d4fe | hemanthgopisetty/My-Leetcode | 0072-edit-distance/0072-edit-distance.cpp | class Solution {
public:
//Easy Dynamic Programming => dfs+memo
int dfs(string& s1,string& s2,int m,int n,vector<vector<int>>&dp)
{
if(m==0)return dp[m][n]=n;
if(n==0)return dp[m][n]=m;
if(dp[m][n]!=-1)return dp[m][n];
if(s1[m-1]==s2[n-1])
{
... | ALGO | 0.999999 | 6.079545 |
21c970cc-5d9b-4533-b34a-3eba9d964b52 | dejisacc/Tugas-Project-Alpro | bab 7/GolUpahCase723.cpp | #include <iostream>
using namespace std;
//buatlah algoritma yang membaca nama dan jumlah jam kerja karyawan selama seminggu lalu hitung
//gaji mingguannya berdasarkan golongan karyawan
int main(){
const int JamNormal = 48; //perminggu
const int UpahLembur = 3000; //perjam
string nama;
char gol;
i... | ALGO | 0.98327 | 3.657031 |
0c8d864e-0e42-4b25-9be2-73c345d18bd0 | zhenyuen/grind75 | week1/buy_and_sell_stock.cpp | #include <vector>
class Solution {
public:
int maxProfit(std::vector<int>& prices) {
int max_profit = 0;
int buy_price = prices[0];
for (int i = 1; i < prices.size(); i++) {
if (buy_price > prices[i]) {
buy_price = prices[i];
} else {
... | ALGO | 0.999636 | 6.630269 |
cd290969-6674-484f-8b01-37dd4eff7699 | SprrowZ/CPlusLearn | demo1/chapter3.cpp | //
// Created by zhaozhenguo on 2022/3/15.
//
#include "chapter3.h"
using namespace std;
#include <iostream>
void testA() {
int a = 99;
const int &r = a;
cout << "a value:" << a << endl;
cout << "r value:" << r << endl;
}
void swapA(int &r1, int &r2) {
int temp = r1;
r1 = r2;
r2 = temp;... | ALGO | 0.992848 | 3.284747 |
8f8f5213-6a53-4271-a159-eb63a06f1c0d | thomas-moulard/choreonoid-deb | src/Body/ForwardDynamicsABM.cpp | /**
\file
\author Shin'ichiro Nakaoka
*/
#include "ForwardDynamicsABM.h"
#include "Body.h"
#include "Link.h"
#include "LinkTraverse.h"
#include "Sensor.h"
#include <cnoid/EigenUtil>
using namespace std;
using namespace cnoid;
static const bool debugMode = false;
static const bool rootAttitudeNormalizationEnabl... | ALGO | 0.99991 | 5.670852 |
64393c88-822c-48f5-ba27-e22fac9e0831 | PrinceJain1608/DSA | GFG/zig_zag_tree_traversal.cpp | class Solution{
public:
//Function to store the zig zag order traversal of tree in a list.
vector <int> zigZagTraversal(Node* root)
{
vector<int>ans;
stack<Node*>s1;
stack<Node*>s2;
if(root==NULL)
return ans;
s1.push(root);
while(!s1.empty() || !s2.em... | ALGO | 0.999986 | 5.453872 |
1a3c3184-1761-4c56-b9b6-de9efe8999e2 | regindex/suffixient-array | include/LZ/lz77index/tests/locate.cpp | #include <fstream>
#include <cstdio>
#include <cstdlib>
#include <unistd.h>
#include "../utils.h"
#include "../static_selfindex.h"
#include "../offsets.h"
#include <iostream>
#include <vector>
using namespace std;
/* Open patterns file and read header */
void pfile_info(unsigned int* length, unsigned int* numpatt){... | ALGO | 0.977616 | 3.29876 |
2660e8fb-d68a-4136-a830-cd6758be434d | ishandutta2007/codeforces | moririn2528/normal/1067/A.cpp | #include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<map>
#include<queue>
#include<deque>
#include<iomanip>
#include<tuple>
#include<cassert>
using namespace std;
typedef long long int LL;
typedef pair<int,int> P;
typedef pair<LL,int> LP;
c... | ALGO | 0.999922 | 3.774708 |
96ccd5d2-6298-4e77-a7d9-e19897229793 | s0metimes/aligothm | week7/1535_hello/1535_hello_youngwoo.cpp | #include <stdio.h>
#include <algorithm>
#define MAXN 20
#define MAXHP 100
using namespace std;
int hp[MAXN+1];
int pl[MAXHP+1];
int dp[MAXN+1][MAXHP+1];
int main(int argc, char const *argv[])
{
int N, i;
scanf("%d", &N);
for(i = 1; i <= N; i++) scanf("%d",&hp[i]);
for(i = 1; i <= N; i++) scanf("%d"... | ALGO | 0.999335 | 3.152742 |
bb8b4e4d-d553-4ede-b6d9-63bab46072c3 | K3v1lPh4m/EHC_training | Quick_Sort.cpp | /*
độ phức tạp thuật toán sẽ là O(log(n))
Bước 1: Lấy phần tử chốt là phần tử ở cuối danh sách.
Bước 2: Chia mảng theo phần tử chốt.
Bước 3: Sử dụng sắp xếp nhanh một cách đệ qui với mảng con bên trái.
Bước 4: Sử dụng sắp xếp nhanh một cách đệ qui với mảng con bên phải.
*/
#include<iostream>
using namespace std;
... | ALGO | 0.999974 | 4.875241 |
3d88d57d-bb20-4507-ac7a-cf77870c3ffe | a2k34lttct/vnoi_solution | match1.cpp | /*Code by Hoang Thai*/
#include <bits/stdc++.h>
#define pb push_back
#define ff first
#define ss second
#define BIT(x, i) (((x) >> (i)) & 1)
#define MASK(i) (1LL << (i))
#define bit_count(x) __builtin_popcount(x)
#define bit_countll(x) __builtin_popcountll(x)
#define fto(i, a, b) for (int i = (int) a; i <= (int) b; +... | ALGO | 0.99994 | 4.059171 |
d80e3225-827c-4f3e-813f-dd9fd4cd6692 | ksaveljev/HackerRank | Track 9/pairs.cpp | #include <iostream>
#include <algorithm>
using namespace std;
#define pow2(i) (1<<i)
#define bit(i) (1<<i)
#define isOdd(i) (i&1)
#define isEven(i) (!(i&1))
#define sz(i) i.size()
#define REP(i, b, n) for (int i = b; i < n; i++)
#define REPI(i, b, n) for (int i = b; i <= n; i++)
#define rep(i, n) REP(i, 0, n)
#define ... | ALGO | 0.999853 | 4.31097 |
15607721-9f3d-4c75-8cde-6d7e9cf99042 | sevana-ou/rtphone | src/libs/libevs/lib_enc/inov_enc.cpp | /*====================================================================================
EVS Codec 3GPP TS26.443 Nov 13, 2018. Version 12.11.0 / 13.7.0 / 14.3.0 / 15.1.0
====================================================================================*/
#include "options.h"
#include "cnst.h"
#include "prot.h"
#... | ALGO | 0.999094 | 3.742332 |
a0acdb37-4203-483f-97f7-e4d7b217d93a | Michael-M18/Mobile-Project | Mobile-Game/Library/PackageCache/com.unity.ide.visualstudio@2.0.16/Editor/COMIntegration/COMIntegration~/COMIntegration.cpp | #include <iostream>
#include <sstream>
#include <string>
#include <filesystem>
#include <windows.h>
#include <shlwapi.h>
#include <fcntl.h>
#include <io.h>
#include "BStrHolder.h"
#include "ComPtr.h"
#include "dte80a.tlh"
constexpr int RETRY_INTERVAL_MS = 150;
constexpr int TIMEOUT_MS = 10000;
// Often a DTE call m... | TOOL | 0.932623 | 6.939089 |
0f168f44-511f-4bae-abdf-6f07e8fc1f91 | clockzhong/WrapLAMP | Boost/libs/geometry/doc/index/src/examples/rtree/interprocess.cpp | //[rtree_interprocess
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/point.hpp>
#include <boost/geometry/geometries/box.hpp>
#include <boost/geometry/index/rtree.hpp>
#include <boost/foreach.hpp>
#include <boost/interprocess/managed_shared_memory.hpp>
#include <boost/interprocess/allocators/alloc... | TOOL | 0.995517 | 3.905131 |
9dcb6c30-83fc-421a-a44f-653636b98c8e | ChibiKev/Leetcode | 144. Binary Tree Preorder Traversal/solution.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.999992 | 6.437565 |
f6595b38-5a79-4a05-b026-e412733c080d | lenhat509/cpp-practice | 643 - Maximum Average Subarray I.cpp | #include <vector>
#include <limits>
using namespace std;
class Solution
{
public:
double findMaxAverage(vector<int> &nums, int k)
{
int sum = nums[0];
double maxAverage = numeric_limits<double>().lowest();
int left = 0;
int right = 0;
while (right < nums.size())
... | ALGO | 0.999696 | 6.292801 |
ca22e993-51d6-4c2e-9125-fc89ca0b6c3e | ishandutta2007/codeforces | pinkrabbit/normal/1316/F.cpp | #include <cstdio>
#include <algorithm>
typedef long long LL;
const int Mod = 1000000007, Inv2 = (Mod + 1) / 2;
const int MN = 300005, MQ = 300005, MS = 1 << 21 | 7;
int N, Q, A[MN], qpos[MQ], qval[MQ], D[MS], qP[MS], iqP[MS], C;
int _pw[MS], *pw = _pw + (MS / 2);
#define li (i << 1)
#define ri (li | 1)
#define mid ... | ALGO | 0.999917 | 3.97642 |
d6bd32d8-bbaf-48f0-a881-e43087e5d238 | Kiran-Chaitu/GFG_CODES | Difficulty: Medium/Job Sequencing Problem/job-sequencing-problem.cpp | class Solution {
public:
vector<int> jobSequencing(vector<int> &deadline, vector<int> &profit) {
// code here
int maxi = 0 , jc =0 , ans =0 ;
for(int i : deadline) if( i > maxi) maxi = i;
unordered_map<int,vector<int>> mp;
for(int i=0;i<deadline.size();i++){
mp[... | ALGO | 0.999961 | 5.727021 |
68b6dcfc-ff03-45b6-b03b-9100ca7a9b5f | musou1500/atcoder_answers | abc088/d.cpp | #include <bits/stdc++.h>
using namespace std;
int main(int argc, const char *argv[]) {
int h, w, cnt = 0;
cin >> h >> w;
vector<vector<char>> s(h, vector<char>(w));
for (auto &r : s) {
for (auto &c : r) {
cin >> c;
cnt += c == '#';
}
}
vector<vector<int>> costs(h, vector<int>(w, -1))... | ALGO | 0.999809 | 5.062488 |
d46bb90e-33a3-4c0a-bf92-97022d0303d0 | anil236/new-project | src/AppInstallerRepositoryCore/RepositorySearch.cpp | using namespace AppInstaller::Settings;
using namespace std::chrono_literals;
namespace AppInstaller::Repository
{
namespace
{
std::string GetStringVectorMessage(const std::vector<std::string>& input)
{
std::string result;
bool first = true;
for (auto const& ... | TOOL | 0.941039 | 7.403415 |
fcbe4484-5300-42cf-8ffa-102a298dc9a5 | dhnesh12/codechef-solutions | 04-CodeChef-Hard/325--Swapping mismatches.cpp | #include <stdio.h>
#define MAX(a,b) (a)>(b)?(a):(b)
#define MAXN 110000
int d[MAXN];
int n;
int prev[MAXN];
int v[MAXN];
int szpm, szv;
void mergesort(int low, int high)
{
int i, temp;
int mid;
int p1,p2;
int tn;
int pmax;
if(low == high)
{
return;
}
if(high - low == 1)
{
if(d[low] > d[high] + 1)
{
... | ALGO | 0.999998 | 3.781861 |
655c192b-258f-4cc4-9db6-e78a25d01705 | HaydenRoeder1/CS240-Data-Structures-and-Algorithms- | lab-5-spr19-HaydenRoeder1/Probe.cpp | #include "Probe.h"
#include <queue>
#include <vector>
#include <cstdlib>
#include "Planet.h"
#include "Star.h"
using namespace std;
vector<Planet> Probe::getHabitable(Star s){
vector<Planet> habitable;
for(auto &it : s.getPlanets()){
if(it.getType() == 'h' && it.getDistance() <= 140 && it.getDistance() >= 60){
... | ALGO | 0.992335 | 3.624634 |
88aa4a8b-dcd3-4c82-aa1f-561a94beb7b2 | ParkJunGyu26/codetree-TILs | 240816/줄 세우기/line-up-students.cpp | #include <iostream>
#include <algorithm>
using namespace std;
class Student {
public:
int height, weight, number;
Student(int h, int w, int n) {
height = h;
weight = w;
number = n;
}
Student() {}
};
bool cmp(Student a, Student b) {
if (a.he... | ALGO | 0.999534 | 4.826151 |
5380542a-6c5d-45dc-bf88-83eedef283e9 | rDuckDev/hello-languages | cpp/anagram/anagram.cpp | #include <iostream>
#include <fstream>
#include <set>
using namespace std;
// Reads all known words from a dictionary file
// (based on the Ubuntu wamerican package) and
// returns the set containing those words.
set<string> getWords () {
ifstream inputStream("dictionary.txt");
set<string> wordSet;
string word;
... | ALGO | 0.973537 | 5.44426 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.