uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
b2790f02-050c-4e62-a18c-cf07d0ccc0b2 | zhangbowen-jpg/Code--Practice | euler21-1.cpp | /*************************************************************************
> File Name: euler21-1.cpp
> Author:
> Mail:
> Created Time: 2019年08月19日 星期一 14时56分18秒
************************************************************************/
#include<iostream>
#include<cmath>
#include<map>
#include<vector>
using name... | ALGO | 0.999815 | 4.188222 |
4a04103a-57a2-4bd9-a86b-ddfbbc1f8ade | osmandapp/OsmAnd-external-skia | src/effects/Sk2DPathEffect.cpp | #include "Sk2DPathEffect.h"
#include "SkReadBuffer.h"
#include "SkWriteBuffer.h"
#include "SkPath.h"
#include "SkRegion.h"
Sk2DPathEffect::Sk2DPathEffect(const SkMatrix& mat) : fMatrix(mat) {
fMatrixIsInvertible = mat.invert(&fInverse);
}
bool Sk2DPathEffect::filterPath(SkPath* dst, const SkPath& src,
... | TOOL | 0.891046 | 7.347433 |
873614a4-4852-4052-b9b9-b1c839b0839d | kenny1342/MCU | House-Controller/Frontend-MCU/lib/FastCRC/FastCRChw.cpp | //
// HW-calculations are 32BIT
//
// Thanks to:
// - Catalogue of parametrised CRC algorithms, CRC RevEng
// http://reveng.sourceforge.net/crc-catalogue/
//
// - Danjel McGougan (CRC-Table-Generator)
//
#include "Arduino.h"
#if defined(KINETISK)
#include "mk20dx128.h"
#include "FastCRC.h"
// =======================... | TOOL | 0.944865 | 5.82447 |
d4659e09-d91f-4e64-90e1-0b7dc0518a34 | mrak1990/kdv5-solver | kdv5/lib/eigen-eigen-5a0156e40feb/demos/mandelbrot/mandelbrot.cpp | #include "mandelbrot.h"
#include <iostream>
#include<QtGui/QPainter>
#include<QtGui/QImage>
#include<QtGui/QMouseEvent>
#include<QtCore/QTime>
void MandelbrotWidget::resizeEvent(QResizeEvent *)
{
if(size < width() * height())
{
std::cout << "reallocate buffer" << std::endl;
size = width() * height();
i... | ALGO | 0.886714 | 5.79494 |
59dbff8c-8af1-442c-acde-538ac78dda29 | aadilshabier/algorith-design-manual | 3-8.cpp | #include <bits/stdc++.h>
using namespace std;
enum Player {
O=0, X, TOTAL
};
enum class Result {
None, O, X
};
Result playerToResult(Player p)
{
switch(p) {
case O:
return Result::O;
case X:
return Result::X;
default:
assert(0);
}
}
template <size_t N>
class Board
{
public:
Board()
: mRows{0}
, mC... | ALGO | 0.999205 | 5.393053 |
2911d06c-ca75-4663-95d4-b5c18bf4d5fe | raincross7/code-similarity | codes/train_code/problem018/problem018_366.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;
int main() {
ios::sync_with_stdio(false);
string s;
cin >> s;
if (s[0] == 'S') {
if (s[1] == 'S') {
... | ALGO | 0.999734 | 3.105371 |
fbc6032a-b9f7-49dd-905d-726671ffd1f1 | edinakaknjo/CPPvjezba | CPPvjezba/ZSR5/Z33/main.cpp | //TP 2018/2019: ZSR 5, Zadatak 33
#include <iostream>
#include <vector>
using namespace std;
template<typename T>
vector<T> Funkcija(T x, T (*funk)(T), int n){
vector<T> vraceni;
for(int i=0; i<n; i++){
x=(*funk)(x);
vraceni.push_back(x);
}
return vraceni;
}
int pomocna(int br){
... | ALGO | 0.99926 | 4.61002 |
79c57635-c48a-4ded-8f4c-656cbe5af113 | dinglf1994/My-code | NEW2016/201603142101.cpp | #include<iostream>
#include<stdlib.h>
using namespace std;
#define OK 1
#define error -2
typedef int QElemType;
typedef int Status;
typedef struct QNode{
QElemType data;
struct QNode *next;
}QNode,*QueuePtr;
typedef struct {
QueuePtr front;
QueuePtr rear;
}LinkQueue;
Status InitQueue(LinkQueue &Q){
... | ALGO | 0.998368 | 3.613504 |
47858477-269d-49b8-9dfd-dbf7c4620b49 | mmmhj2/code-competitive | UVA/580/15854735_WA_0ms_0kB.cpp | #include <algorithm>
#include <iostream>
#include <fstream>
#include <cstring>
#include <vector>
#include <cmath>
using namespace std;
typedef long long i64;
const int MAXN = 40;
i64 f[MAXN], g[MAXN];
void prepare()
{
f[0] = f[1] = f[2] = 0;
g[0] = 1, g[1] = 2, g[2] = 4;
for(int i = 3; i <= 30; i++)
{
f[i] = 1... | ALGO | 0.999641 | 4.024941 |
276de5df-efed-40fe-bf7a-b78993f8736f | edge555/Online-Judge-Solves | LeetCode/3080. Mark Elements on Array by Performing Queries.cpp | class Solution {
public:
static bool comp(pair<int,int>&p1, pair<int,int>&p2){
if(p1.first==p2.first){
return p1.second<p2.second;
}
return p1.first<p2.first;
}
vector<long long> unmarkedSumArray(vector<int>& nums, vector<vector<int>>& queries) {
vector<pair<int,i... | ALGO | 0.999887 | 5.163613 |
f2008825-192d-40b4-8264-09d03a544d9e | lakshayslayer/Coding-Journey | add.cpp | // Lakshay's code
// Imagine we have a system that stores files, and these files can be grouped into collections. We are interested in knowing where our resources are being taken up.
// file1, size : 100, collection1
// file2, size: 50, collection2
//* file3, size: 100, null
// file4, size: 40, collection3
// file5, s... | ALGO | 0.9991 | 4.552265 |
3c1a0213-bc7b-4963-99b1-d90f4be13eaf | Zhangjsandy/Leetcode | leetcode10.cpp | class Solution {
public:
bool isMatch(string s, string p) {
if (p.empty()) return s.empty();
auto first_match = !s.empty() && (s[0] == p[0] || p[0] == '.');
if (p.length() >= 2 && p[1] == '*')
{
return isMatch(s, p.substr(2)) || (first_match && isMatch(s.substr(1), p));
... | ALGO | 0.999919 | 5.963692 |
17782ba7-7f88-4efb-a82a-0cbbf978b751 | f12-mou/CSE-204-Data_Structures_and_Algorithms_I_Sessional | Offline-4_BST/1905012/BinarySearchTree.cpp | #include<iostream>
#include<fstream>
#include<cstdlib>
#include<sstream>
#include<string>
#include "DictionaryADT.cpp"
#include "BSTNode.cpp"
using namespace std;
// Binary Search Tree Implementation for Dictionary ADT
template<typename Key, typename E>
class BST:public Dictionary<Key,E>
{
private:
BSTNode<Key,E>*... | ALGO | 0.996355 | 4.640726 |
f4294af1-0c69-425c-aa70-d7011430b857 | Doveqise/Cloud | Codes/C++/2106.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll dp[2000000][10], l, r;
int tot, a[2000000], k = 2;
ll mod = 1000000007;
ll qpow(ll b)
{
ll ret = 1, base = 10;
while (b)
{
if (b & 1)
ret = (ret * base) % mod;
base = (base * base) % mod;
b >>= 1;
... | ALGO | 0.999926 | 4.441024 |
27d268e9-0254-42b0-b5e8-f8657f5e10d5 | ssk4988/Coding | UCFPT/learn/backtracking/sudoku.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
using pd = pair<ld, ld>;
using vi = vector<int>;
using vl = vector<ll>;
using vd = vector<ld>;
using vpi = vector<pi>;
using vpl = vector<pl>;
using vpd = vector<pd>;
using vv... | ALGO | 0.998681 | 6.331457 |
40a90548-e3a2-47a8-b0c1-d7edda54df86 | israkul9/Uva-Problems- | Codes/p10370.cpp | #include<bits/stdc++.h>
using namespace std;
int main ()
{
float b,avg,ck,result;
int a[1000],i,j,N,C,m;
scanf("%d",&C);
for(m=0; m<C; m++)
{
scanf("%d",&N);
if(N>=1 && N<=1000)
{
b=0;
for(i=0; i<N; i++)
{
scanf("%d",&a[i]);... | ALGO | 0.999085 | 3.906331 |
66af86ea-dc1f-45e0-8bcb-d0e7fc5693df | fasyaaa/StackArray_177 | stackusingarray/stackusingarray.cpp | #include <iostream>
using namespace std;
class StackArray {
private :
int stack_array[5];
int top;
public :
//constructor
StackArray() {
top = -1;
}
void push() {
cout << "\nEnter an Element : ";
int element;
cin >> element;
if (top == 4) { //step 1
cout << "Number of data exceeds the limit." <... | ALGO | 0.986619 | 4.193725 |
78484fb7-8333-411d-a425-dca347e3bf60 | kirtijha014/Data-Structures-Algorithms | Recursion/fib.cpp | #include<iostream>
using namespace std;
int fib(int n)
{
int output1 = 0;
int output2 = 0;
if(n == 0)
{
return 0;
}
if(n == 1)
{
return 1;
}
output1 = fib(n-1);
cout<<"output1: "<<output1<<" ";
output2 = fib(n-2);
cout<<"output2: "<<output2<<" ";
//cout<<""<<output1+output2<<" ";
return output... | ALGO | 0.999973 | 4.217985 |
65e0ec6a-8efa-4b1c-87fd-a90c0298656d | Haribala-09/hyprdots | User/History/5ecddcaf/QJrr.cpp | #include <bits/stdc++.h>
using namespace std;
#define rev(ans) reverse(ans.begin(), ans.end())
#define mems(a, n) memset(a, n, sizeof(a))
#define pb push_back
#define fst first
#define scd second
#define int long long
using pii = pair<int, int>;
using pci = pair<char, int>;
void dbg_out() { cerr << endl; }
template ... | ALGO | 0.99997 | 4.416193 |
5db9ac5c-278f-4441-b68f-cc8ce148ad42 | Dofun2/backjun_algorithm | 11055Dp.cpp | #include <iostream>
#include <algorithm>
using namespace std;
long arr[1010];
long memo[1010];
int main() {
int n; cin >> n;
for (int i = 0;i < n;i++)
cin >> arr[i];
memo[0] = arr[0];
for (int i = 1; i <= n; i++)
{
int high = 0;
int witch = -1;
for (int j = i; j >= 0;j--)//ߺ ð ڿ ڿ ϱ ٿ
if (arr[i] > ... | ALGO | 0.999981 | 3.656997 |
371ddf1b-2dc0-447e-b80d-179fec13674f | 0kate/atcoder-practices | abc/131/c/main.cpp | #include <bits/stdc++.h>
#define rep(l, r) for (int i = (l); i < (r); i++)
typedef long long ll;
using namespace std;
template <typename T> T gcd(T a, T b) {
if (b == 0)
return a;
return gcd(b, a % b);
}
template <typename T> T lcm(T a, T b) {
return a * b / gcd(a, b);
}
void solve() {
l... | ALGO | 0.999843 | 4.249851 |
cb301fa1-73c2-47f7-b869-251d5a42fece | csblnc/st | test/check.cpp | //
// Created by huawei on 2023/4/17.
//
#include <fstream>
#include <iostream>
#include "check.h"
#include "dpll.h"
using namespace std;
bool checkSolve(Question& q, vector<int>& s);
void InitCheckSolve(std::string Fcnf, std::string Fsolve){
ifstream fcnf;
fcnf.open(Fcnf, ios::in);
string tmp;
Ques... | ALGO | 0.995819 | 4.43476 |
a7a41ade-1dfe-4abd-8bdc-817aa3baf9c6 | KimmiGYH/LeetCode_Notes_Public | Section03_Algo_DS_Basics/09-Dynamic-Programming/01-Fibonacci/Fibonacci1.cpp | #include <iostream>
#include <ctime>
using namespace std;
int num = 0;
// 递归求 Fibonacci 数列
int fib(int n) {
num++;
if (n == 0)
return 0;
if (n == 1)
return 1;
return fib(n-1) + fib(n-2);
}
int main() {
num = 0;
int n = 42;
time_t startTime = clock();
... | ALGO | 0.996864 | 5.330919 |
02f50d96-c46d-4b7d-af1f-ceae6f2387fb | Njeru254/OpenAI | deps/icu-small/source/common/uarrsort.cpp | #include <cstddef>
#include "unicode/utypes.h"
#include "cmemory.h"
#include "uarrsort.h"
enum {
/**
* "from Knuth"
*
* A binary search over 8 items performs 4 comparisons:
* log2(8)=3 to subdivide, +1 to check for equality.
* A linear search over 8 items on average also performs 4 compar... | ALGO | 0.999983 | 7.503741 |
3f87d57e-f52a-4c57-bf90-d07199d797c1 | predators46/my | extra/yassl/taocrypt/src/dsa.cpp | #include "runtime.hpp"
#include "dsa.hpp"
#include "sha.hpp"
#include "asn.hpp"
#include "modarith.hpp"
namespace TaoCrypt {
void DSA_PublicKey::Swap(DSA_PublicKey& other)
{
p_.Swap(other.p_);
q_.Swap(other.q_);
g_.Swap(other.g_);
y_.Swap(other.y_);
}
DSA_PublicKey::DSA_PublicKey(const DSA_PublicKey&... | TOOL | 0.971842 | 7.594802 |
10ecec38-7821-4961-90df-950c5c3e6ec8 | nitinnsharma234/leet_code | 3396-valid-word/valid-word.cpp | class Solution {
public:
bool isValid(string word) {
bool lengthValidity = word.size()>=3;
bool containsVowel=false;
bool containsConsonant=false;
bool containsNumber=false;
for(char x : word){
int asciiVal = (int)x;
if((asciiVal>=48 && asciiVal<=5... | ALGO | 0.997527 | 6.103099 |
07edb6b7-975b-406c-813c-a1c0cd17cdcc | HariishG/LeetCode | 0063-unique-paths-ii/0063-unique-paths-ii.cpp | class Solution {
public:
int uniquePathsWithObstacles(vector<vector<int>>& obstacleGrid) {
if (obstacleGrid[0][0]==1){
return 0;
}
int dp[obstacleGrid.size()][obstacleGrid[0].size()];
int ways=1;
for (int i=0; i<obstacleGrid.size(); i++){
if (obstacleG... | ALGO | 0.99944 | 5.937775 |
8e47a21f-c813-4f85-9e19-ccb0ef976841 | Ryedii/fla_project | parse.cpp | #include "parse.h"
#include "automata.h"
#include <fstream>
#include <iostream>
#include <algorithm>
#include <vector>
#include <sstream>
std::vector<std::string> scan(std::string line, char c = 0, char l = 0, char r = 0) {
std::vector<std::string> words;
if (l != 0) {
int n = line.find(r);
if ... | ALGO | 0.969877 | 3.913118 |
6423867e-fdb4-484b-a888-71c7b54b5069 | Ansh718/GFG | 2024/March 24/08-03-24.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
// User function template for C++
class Solution
{
public:
bool sameFreq(string s)
{
map<char, int> h;
map<int, int> a;
for (int i = 0; i < s.length(); i++)
{
h[s[i]]++;
... | ALGO | 0.99927 | 4.811121 |
560ea478-c66e-4af2-a665-9bbf86d521e8 | TheDev05/CARDIO | CPP Language/Topics/Functions/User_Defined/Project10.cpp | //**C program to pass two dimensional array (Two-D array) to a function.
#include <iostream>
#define colu 10
int get_sum(int num[][colu], int row, int col)
{
int sum = 0;
int j = 0, res_j;
for (int i = 0; i < row; i++)
{
res_j = j;
for (j; j < col; j++)
{
sum += n... | ALGO | 0.999852 | 5.126569 |
cd6a5cae-be3d-4a27-a2b3-45e3ad61797a | uniqss/leetcodecpp | bk/iai.sh.cn/20220602.cpp | #include <vector>
#include <limits.h>
#include <iostream>
#include <string>
using namespace std;
/*
这个平台出错根本没法查出错用例,输入输出强制和算法逻辑搅和在一起,简直让人大跌眼镜 长期刷会降低技术水平的,还是算了
*/
int main() {
string input;
string password;
cin.tie(0);
cin >> password;
int count = 0;
int curr_wait_seconds = 1;
int total_wa... | ALGO | 0.998238 | 3.774514 |
2853ed25-57f8-46c6-9fd7-fd129b6183f9 | torrescf/Data-Structure | Revisao Dredd/8.cpp | #include <iostream>
using namespace std;
int main () {
int l=10,c=10;
int matriz[l][c];
for(int i=0; i<l ; i++){
for(int j=0; j<c ; j++){
cin >> matriz[i][j];
}
}
int maiorElemento=matriz[0][0], linhaMinimax=0;
for(int i=0; i<l ; i++){
for(int j=0; j<c ; j++){
if(matriz[i][j] > maiorElemento){
... | ALGO | 0.999966 | 3.971232 |
9fa1fc6c-f14d-4cc1-9110-f395d16caba8 | apandia/DSA_Programs | Recursion/TowerOfHanoi.cpp | #include <iostream>
using namespace std;
//TC = O(2^n)
void towerOfHanoi(int n, string from, string helper, string to)
{
if(n == 0) return;
towerOfHanoi(n-1, from, to, helper);
cout<<from<<" -> "<<to<<endl;
towerOfHanoi(n-1, helper, from, to);
}
int main(int argc, char *argv[])
{
int n;
co... | ALGO | 0.999881 | 5.481738 |
05364657-bc97-46cf-9fc5-dc8076ad96c3 | openjdk/leyden | src/hotspot/share/gc/shenandoah/shenandoahNumberSeq.cpp | #include "gc/shenandoah/shenandoahNumberSeq.hpp"
#include "runtime/atomic.hpp"
HdrSeq::HdrSeq() {
_hdr = NEW_C_HEAP_ARRAY(int*, MagBuckets, mtInternal);
for (int c = 0; c < MagBuckets; c++) {
_hdr[c] = nullptr;
}
}
HdrSeq::~HdrSeq() {
for (int c = 0; c < MagBuckets; c++) {
int* sub = _hdr[c];
if (... | ALGO | 0.958394 | 6.836313 |
669817eb-f553-4987-8673-108f51e47d06 | dedoardo/polyfit | source/polyvec/polygon-tracer/align_inflections_to_half_space.cpp | // polyvec
#include <polyvec/polygon-tracer/align_inflections_to_half_space.hpp>
#include <polyvec/polygon-tracer/prune_edges_force_vertex.hpp>
#include <polyvec/core/log.hpp>
#include <polyvec/utils/matrix.hpp>
#include <polyvec/geometry/raster.hpp>
#include <polyvec/geometry/angle.hpp>
#include <polyvec/geometry/path... | ALGO | 0.999775 | 7.826353 |
6c773018-3cd0-49ca-ad4c-cfd157ce8706 | SousaPedroso/URI_Online_Judge_Solutions | matematica/c++/1028.cpp | #include <iostream>
#define endl '\n';
using namespace std;
int mdc(int x, int y){
return (y ==0 ? x: mdc(y, x%y));
}
int main() {
int N;
int F1, F2;
cin>> N;
while (N--){
cin>> F1>> F2;
cout<< mdc(F1, F2)<< endl;
}
return 0;
} | ALGO | 0.999798 | 3.920986 |
5afffbff-0477-4928-877f-165363b66a16 | hyfung/Leetcode_Solutions | 0912. Sort an Array/Solution.cpp | class Solution {
public:
vector<int> sortArray(vector<int>& nums) {
std::sort(nums.begin(), nums.end());
return nums;
}
};
| ALGO | 0.999959 | 6.121577 |
52196115-51e7-42de-aa8f-90a1eda59443 | qiuwenhui/micromouse_-simulator | old/v1/src/algo/FloodFill/FloodFill.cpp | #include "FloodFill.h"
#include <iostream>
#include <stack>
#include <queue>
#include <stdlib.h>
#include <utility>
#include <vector>
#include "Cellmod.h"
#include "SimpleCellmod.h"
void FloodFill::solve(sim::MouseInterface* mouse){
// Initialize the mouse pointer
m_mouse = mouse;
// Initialize the x a... | ALGO | 0.973282 | 6.085094 |
5bc83f15-2c05-4119-83e0-291d03f2e488 | RounakAgarwal2275/dsa-with-c-- | queue by stl.cpp | #include<iostream>
#include<queue>
using namespace std;
int main(){
queue<int>s;
s.push(5);
s.push(2);
s.push(3);
s.push(56);
s.pop();
s.pop();
if(s.empty()){
cout<<"queue is empty"<<endl;
}
else{
cout<<"queue is not empty"<<endl;
}
cout<<"the top ele of queue:"<<s.front... | ALGO | 0.989536 | 3.504404 |
c9fc8a9e-3bf9-4832-ab4d-4da0ba819615 | Ayu360/Dynamic-Programing | coinChangei.cpp | //Problem Name: Coin Change
//Problen Link: https://leetcode.com/problems/coin-change/submissions/872791920/
class Solution {
public:
int coinChange(vector<int>& coins, int amount) {
int sol[amount + 1];
sol[0] = 0;
for(int i = 1; i <= amount; i++)
sol[i] = amount + 1;
... | ALGO | 0.999954 | 5.953693 |
bbe626d5-c361-4c60-b69f-09b4f74294f7 | filipeemweb/learningCPP | CS50Remake/factorial.cpp | // Factorial calculator with user input number
#include <iostream>
//function prototype or declaration
int fact(int);
int main()
{
int x;
std::cout << "Enter a number to see it`s factorial: ";
std::cin >> x;
int result = fact(x);
std::cout << "Factorial of " << x << " = " << result << std::endl... | ALGO | 0.998578 | 5.324275 |
abb1d9ad-347c-49e3-a405-cedfb0332d08 | godra-y/pp1_2022 | 4.lab/4.D.cpp | #include <iostream>
using namespace std;
int main(){
int n;
cin>>n;
int a[n][n];
for(int i=0; i<n; i++){
for(int j=0; j<n; j++){
if(i==0){
cout<<j;
}
else if(j==0){
cout<<i;
}
else{
cout<<... | ALGO | 0.999471 | 3.126406 |
e7ae4f70-28a4-4826-86d7-62dadf8c1fb2 | IlliaOlenych/IlliaOlenych | KURSOVA/lexer.cpp | #include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "translator.h"
#include <locale>
// функція отримує лексеми з вхідного файлу F і записує їх у таблицю лексем TokenTable
// результат функції - кількість лексем
unsigned int GetTokens(FILE* F, Token TokenTable[], FILE* errFile)
{
States state = Start... | TOOL | 0.854646 | 3.622673 |
ae023912-6786-4da4-a576-ba15eb6985c1 | tohow06/2021FallDIP | HW6/B06611008_HW6/code/dwt2.cpp | #include "dwt2.h"
// Filter type
using namespace cv;
using namespace std;
dwt2::dwt2()
{
}
//--------------------------------
// signum
//--------------------------------
float dwt2::sgn(float x)
{
float res=0;
if(x==0)
{
res=0;
}
if(x>0)
{
res=1;
}
if(x<0)
{
... | ALGO | 0.998067 | 4.661356 |
47a78eea-8272-45b9-bf18-7670eb8b8936 | urvalkheni/CPP | Program/userdefineAndRecursion/factorialbyrecursion.cpp | #include<iostream>
using namespace std;
int factorial(int a){
if(a==0 || a==1){
// here we added this base case because the 0! and 1! is 1.
return 1;
}
return a * factorial(a-1);
}
int main(){
int n;
cout<<"Enter The Number to Find Factorial :: ";cin>>n;
cout<<"The Factorial of "... | ALGO | 0.998473 | 3.969311 |
7b413444-0b66-4d46-94ef-f8cd3b052bfc | Sanskar6000/DSA | Interview Questions/Graph/Rotten_oranges.cpp | //We will use Breadth First Search
//Taking rotten oranges in a queue
//Applying BFS
//For checking if all oranges are rotten
//We will keep count of all total oranges and oranges processed in a queue
//If both are not equal some oranges are left for decaying
int orangesRotting(vector<vector<int>>& grid) {
int rows... | ALGO | 0.999973 | 6.465819 |
e438e0ec-1bac-4918-8629-fcb42edcf903 | wwyf/oj | leetcode/970.强整数.cpp | /*
* @lc app=leetcode.cn id=970 lang=cpp
*
* [970] 强整数
*/
#include <vector>
using namespace std;
// @lc code=start
class Solution {
public:
vector<int> powerfulIntegers(int x, int y, int bound) {
// 尝试取得x、y 的幂的上下限
// 获得小于bound的所有x/y的幂的数
vector<int> xm; xm.push_back(1);
vector<int... | ALGO | 0.999832 | 6.008173 |
2bebc702-7892-46cf-ac9b-815536815637 | 2DGD-F0TH/2DGD_F0TH | dynamic_listings/C++/default/computer_science/binary_search.cpp | int binarySearch(int[] lst, int item){
int first = 0;
int last = lst.size() - 1;
while(first <= last){
// Find the middle element
int midpoint = (int) (first + last) / 2;
if (lst[midpoint] == item){
// We found it!
return midpoint;
}else{
i... | ALGO | 0.999761 | 4.659059 |
cb01b062-f0a7-4657-ba22-e0fc7c88502c | Farewellswind/Salted-fish-pond | 数据结构/并查集/kovanice(1.string很占内存 2.vector存图 80 超时———数组模拟邻接表——100 3.并查集缩点注意集合性质的归并).cpp | #include<iostream>
#include<cstring>
#include<vector>
#include<algorithm>
#include<fstream>
using namespace std;
//vector<int>pic[300001];
//vector<int>npic[300001];
struct E
{
int next,x,y;
}e[300001];
struct nE
{
int next,x,y;
}ne[300001];
int n,m,t,f[300001],vis[300001],nvis[300001],chil[300001],fa[300001],ans[300... | ALGO | 0.999965 | 3.371905 |
c44307ec-0ca4-450b-94f0-9a679751492c | mdshohed/CompetitiveProgramming | UVA Judge/10038 - Jolly jumper.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
//freopen( "in.txt", "r", stdin);
int n;
while(scanf("%d",&n) !=EOF ){
int ara[50006], v[50007];
for(int i = 0; i<n; i++) {
cin >> ara[i];
}
for (int i = 0; i<n-1; i++){
v[i] = abs(ara[i]... | ALGO | 0.999897 | 3.799467 |
b0b7d0a6-3499-4b6b-96f7-c54f6d2dc462 | mohit8890/DSA | chocolate_distribution.cpp | /**
* author: tanishq
* created: 22.10.2020
**/
#include <bits/stdc++.h>
#define int long long
using namespace std;
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int test_case;
cin >> test_case;
while (test_case--) {
int n, m;
cin >> n;
int a[n];
f... | ALGO | 0.999913 | 5.020784 |
c5b4f4e5-60f1-4560-9bb0-b85eae3e8c12 | GTnull/LeetCode | 129. Sum Root to Leaf Numbers.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution
{
public:
vector<int> nums;
int sumNumbers(TreeNode *root)
{
if (!root)
ret... | ALGO | 0.999971 | 6.38548 |
6995e97b-d688-4bce-b730-f4304ec4b8fa | w181496/OJ | LeetCode/540.Single_Element_in_a_Sorted_Array.cpp | // 二分搜
// 中間值判斷index是否為2的倍數
class Solution {
public:
int singleNonDuplicate(vector<int>& nums) {
int l = 0;
int r = nums.size() - 1;
while(l < r) {
int m = (l + r) >> 1;
if(m == 0 || m == nums.size() - 1) {
return nums[m];
} else {
... | ALGO | 0.999914 | 5.451886 |
ae41c74f-5d08-433b-a45a-d470205565c9 | TanishqBhargava/Hackerearth | Algorithms/Dynamic Programming/Introduction to Dynamic Programming 1/Phoebe's Melody.cpp | /*========================*\
| ID: tanishqbhargava2509 |
| LANG: C++ |
\*========================*/
//Tanishq Bhargava
#include<bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
long long t;
cin >> t;
while(t--)
{
long long n, k;
cin >> ... | ALGO | 0.999897 | 4.261802 |
ce7b2133-b124-4c9a-a2dc-51b067ae8f34 | kmjp/procon | leetcode/biweekly/041-080/056/1925.cpp | typedef signed long long ll;
#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) me... | ALGO | 0.999861 | 4.185529 |
0dbde75d-1ca6-46a9-8baa-1af2f6362122 | PrathameshJadhav30/Top-100-Codes | Top 100 Codes/05-Operations on Strings/22-Print all permutations of a given string in lexicographically sorted order/Printallpermutationsofagivenstringinlexicographicallsortedorder.cpp | #include <iostream>
#include <algorithm>
using namespace std;
void printPermutations(string str) {
// Sort the string in lexicographical order
sort(str.begin(), str.end());
// Print all permutations using do-while and next_permutation
do {
cout << str << endl;
} while (next_permutation(str... | ALGO | 0.999773 | 5.82542 |
ca5c2127-5a99-462c-a5f2-b99d40e4b45a | alphawizzflutterteam/billscan | 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.99887 | 6.783439 |
25d3dc52-1f16-4c4e-a331-013de27fe02a | woolparka/SelfDrivingCarProjects-ND | Term3-Vehicle-Dynamics-Automotive-Hardware/CarND-Path-Planning-Project/src/Eigen-3.3/doc/examples/tut_matrix_resize.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace Eigen;
int main()
{
MatrixXd m(2,5);
m.resize(4,3);
std::cout << "The matrix m is of size "
<< m.rows() << "x" << m.cols() << std::endl;
std::cout << "It has " << m.size() << " coefficients" << std::endl;
VectorXd v(2);
v.resize(5);
... | ALGO | 0.878217 | 3.882785 |
29dbd81e-b199-46ce-a6e1-94fa2cfd42d6 | SarvT/codetra | 2523. Closest Prime Numbers in Range.cpp | class Solution {
public:
vector<int> closestPrimes(int left, int right) {
int upperLimit = right;
vector<int> sieveArray = sieve(upperLimit);
vector<int> primeNumbers;
for (int num = left; num <= right; num++) {
if (sieveArray[num] == 1) primeNumbers.push_back(num);
... | ALGO | 0.99999 | 5.408382 |
2b1be206-81fa-4e10-b8fe-87c906c9b0d5 | SKundu312/Crack-Your-Internship | Backtracking/Hard/SudokuSolver.cpp | class Solution {
public:
bool isSafe(int row,int col,char c,vector<vector<char>>& board){
for(int k=0;k<9;k++){
if(board[row][k]==c) return false; // checking the row if similar char exists.
if(board[k][col]==c) return false; // checking the column if similar char exists.
if(board[3*(r... | ALGO | 0.999801 | 6.864811 |
a1656f81-7fb3-46b0-94bb-67e189df7935 | snumrl/ys2010 | PyCommon/external_libraries/BaseLib/math/nr/cpp/recipes/gser.cpp | #include <cmath>
#include <limits>
#include "nr.h"
using namespace std;
void NR::gser(DP &gamser, const DP a, const DP x, DP &gln)
{
const int ITMAX=100;
const DP EPS=numeric_limits<DP>::epsilon();
int n;
DP sum,del,ap;
gln=gammln(a);
if (x <= 0.0) {
if (x < 0.0) nrerror("x less than 0 in routine gser");
ga... | ALGO | 0.999425 | 4.029408 |
1d3bff37-2874-40e7-baef-8e7c9300d740 | aoyandong/algorithms | algorithms/no_tags_yet/merge_intervals.cpp | /**
* Definition of Interval:
* classs Interval {
* int start, end;
* Interval(int start, int end) {
* this->start = start;
* this->end = end;
* }
*/
bool compare(const Interval &a, const Interval &b){
return a.start<b.start;
}
class Solution {
public:
/**
* @param ... | ALGO | 0.999997 | 5.827214 |
8fc179d1-5804-4d79-a0e6-70b9255bb6ad | infEreb/crypto_tools | isnt_rsa/primes/primeNums.cpp | #include "primeNums.hpp"
using namespace prime;
CPrimeNums::CPrimeNums() {
m_primeNums = new std::list<CPrime *>();
}
CPrimeNums::~CPrimeNums() {
Clear();
}
std::list<CPrime *> *CPrimeNums::Get() { // returns list of prime nums
return m_primeNums;
}
bool CPrimeNums::i... | ALGO | 0.976283 | 3.451816 |
edbe6479-db63-41d8-9566-95197ee12fa8 | yzzupgo/MFTCG | Data/abc136_b/tic40/ac/6715166.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n,ans=0;
cin>>n;
for(int i=1; i<=n; i++) if(to_string(i).size()%2==1)ans++;
cout << ans <<endl;
}
| ALGO | 0.999542 | 4.139069 |
badb140a-a7d3-457c-aa67-34eebefbe981 | wofka72/Russian-AI-Cup-2014 | TacticsHockeyistsDefence.cpp | #include "MyStrategy.h"
#include "AllSystem.h"
#include "UsefulFunctions.h"
#include "constants.h"
#define PI 3.14159265358979323846
#define _USE_MATH_DEFINES
#include <cmath>
#include <cstdlib>
using namespace std;
using namespace model;
using namespace MySystem;
using namespace UsefulFunctions;
void TacticsHocke... | ALGO | 0.969333 | 4.611858 |
05f60cfe-79a9-4f67-9b12-729296517ba6 | selhatinenc/Algo | Algo/cpp_algo/jumping_on_clouds.cpp | //
// Created by selhatin on 30.1.2023.
//
#include <bits/stdc++.h>
using namespace std;
string ltrim(const string &);
string rtrim(const string &);
vector<string> split(const string &);
/*
* Complete the 'jumpingOnClouds' function below.
*
* The function is expected to return an INTEGER.
* The function accepts ... | ALGO | 0.999984 | 5.501147 |
38e02248-5573-4477-ad70-edaff9b6bef7 | TAHabib0012/Codeforces | A_Sakurako_s_Exam.cpp | /*............Bismillahir Rahmanir Raheem...............*/
#include <bits/stdc++.h>
using namespace std;
#define Tahmid ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#define LL long long int
#define ULL unsigned long long
#define endl '\n'
#define mem(v, x) memset(v, x, sizeof(v))
#define ceilin... | ALGO | 0.999959 | 5.222451 |
da482f15-ebd7-4b36-a80a-4a26ed73920d | OConnorThomas/Comp_4 | ps6 RandWriter/RandWriter.cpp | // Constructor:
RandWriter::RandWriter(string text, int k) : _K(k) {
// if order 0, the text IS the dictionary of probabilities
if (!k) {
MarkovModel[ORDERZERO].second.assign(text);
MarkovModel[ORDERZERO].first = static_cast<int>(text.size());
}
// else
// Append the first k+1 charac... | ALGO | 0.863919 | 6.573747 |
2a087352-6496-4ecf-a2ed-74750c81c60e | HPC-AI-Team/lammps-fugaku-threadpool-sc23 | src/fix_enforce2d.cpp | // clang-format off
#include "fix_enforce2d.h"
#include "atom.h"
#include "domain.h"
#include "error.h"
#include "modify.h"
#include "respa.h"
#include "update.h"
using namespace LAMMPS_NS;
using namespace FixConst;
/* ---------------------------------------------------------------------- */
FixEnforce2D::FixEnfor... | ALGO | 0.988159 | 7.504066 |
ece28c3e-f482-4c1c-8079-c45c837a825f | phate/jive | src/rvsdg/traverser.cpp | #include <jive/common.hpp>
#include <jive/rvsdg/graph.hpp>
#include <jive/rvsdg/notifiers.hpp>
#include <jive/rvsdg/region.hpp>
#include <jive/rvsdg/simple-node.hpp>
#include <jive/rvsdg/tracker.hpp>
#include <jive/rvsdg/traverser.hpp>
#include <jive/rvsdg/type.hpp>
#include <string.h>
using namespace std::placeholde... | ALGO | 0.997417 | 5.195069 |
05c88fc9-5ab3-405c-8949-b198025ca4e3 | komcat/komcat_CMakeProject2 | CMakeProject2/include/scanning/AdaptivePowerScanner.cpp | #include "AdaptivePowerScanner.h"
#include <iostream>
#include <iomanip>
#include <sstream>
#include <algorithm>
#include <cmath>
#include <chrono>
// Constructor
AdaptivePowerScanner::AdaptivePowerScanner(const ScanConfig& cfg)
: config(cfg), totalMeasurements(0) {
// Default measurement function (for testing)
... | ALGO | 0.996108 | 7.766735 |
7562286c-66dd-4851-a7a0-70ce2a78d8df | Linoliumer/AlgSys | AlgSys/IntegerNumbers/generalZNum.cpp | #include <iostream>
#include "generalZNum.h"
#include <vector>
#include <cmath>
numberZ XtoXArrayZ(long long int number) {
numberZ temp;
int olderCoefXA, remain;
if (number >= 0) temp.sign = 0;
else if (number < 0) {
temp.sign = 1;
number = number * -1;
}
olderCoefXA = 0;
i... | ALGO | 0.995202 | 3.415272 |
2f768f04-7416-4ecb-ae95-0b534c2cafee | thtfive/MyCRF | CRF3D/Tagger.cpp | #include <iostream>
#include <vector>
#include <iterator>
#include <cmath>
#include <string>
#include <sstream>
#include <tuple>
#include <set>
#include "Params.h"
#include "Common.h"
#include "Tagger.h"
#include "FeatureCapture.h"
#include "FeatureIndex.h"
#include "Path.h"
namespace CRF3D {
using std::string;
usin... | DATA | 0.971801 | 4.645627 |
727d070e-a57f-46e1-af9c-4eacdf16965e | punitkr03/dsa-library | week1/34.cpp | class Solution
{
public:
vector<int> searchRange(vector<int> &nums, int target)
{
int firstOcc = -1, lastOcc = -1;
for (int i = 0; i < nums.size(); i++)
{
if (nums[i] == target)
{
firstOcc = i;
break;
}
}
... | ALGO | 0.999926 | 6.498399 |
a7ec874c-0054-4143-b911-3909d25130d8 | scorpion007-zz/pixie | src/ri/irradiance.cpp | #include "irradiance.h"
#include "error.h"
#include "memory.h"
#include "shading.h"
#include "bundles.h"
#include "photonMap.h"
#include "surface.h"
#include "stats.h"
#include "texture.h"
#include "renderer.h"
#include "ri_config.h"
#include "debug.h"
#include "pointHierarchy.h"
#include "shaderPl.h"
const float weig... | ALGO | 0.996969 | 4.826152 |
0a536da4-f550-4593-848b-9406f9df6d3e | Aashu1303/GfG | Easy/Count the elements/count-the-elements.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:
vector<int> countElements(vector<int> &a, vector<int> &b, int n, vector<int> &query,
int q) {
//... | ALGO | 0.999777 | 5.738414 |
ae17484e-944c-42f0-bea7-79c26a984abe | ishandutta2007/codeforces | joeywheeler/normal/618/C.cpp | #include <bits/stdc++.h>
#define FO(i,a,b) for (int i = (a); i < (b); i++)
#define sz(v) int(v.size())
using namespace std;
typedef long long ll;
#define x first
#define y second
int n;
pair<ll,ll> p[100005];
ll sq(ll a) {
return a*a;
}
ll dst(pair<ll,ll> a, pair<ll,ll> b) {
return sq(a.x-b.x) + sq(a.y-b.y... | ALGO | 0.999823 | 4.214288 |
9d795efd-db25-4c94-8d5a-64bd1829b571 | yusmnn/CPP-DASAR | LatihanPemrograman/Rekursif.cpp | #include <iostream>
using namespace std;
int PangkatIterasi(int a, int b) {
int hasil = a;
for(int i = 1; i < b; i++) {
hasil = hasil * a;
}
return hasil;
}
int PangkatRekursif(int a, int b){
if(b <= 1){
cout << "Akhir dari rekursif\n";
return a;
} else {
cout <... | ALGO | 0.99985 | 5.081336 |
6c349c53-fafd-47f3-b2f0-9d6e18855ec1 | sindhuja90/IPMP_Tasks_Sindhuja | week4/bitManipulation/bitManipulation_6.cpp | // solution 1
#include <iostream>
using namespace std;
int getAbs(int n) {
int mask = n>>(sizeof(int)*8 - 1);
return ((n+mask)^mask);
}
int main() {
int n;
cin>>n;
cout<<getAbs(n);
return 0;
}
// solution 2
#include <iostream>
using namespace std;
int getAbs(int n) {
int mask = n>... | ALGO | 0.99991 | 4.820991 |
23d4f709-3a35-4cee-b413-fce36b888be8 | saipavan2702/my-leetcode | problems/path_sum/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.999821 | 6.396882 |
1ab0658f-de68-4d6e-95cf-e8d39026256d | aakaul/DSA-GCL-53 | Session8/C++/ReverseLinkedList.cpp | https://leetcode.com/problems/reverse-linked-list/
class Solution {
public:
ListNode* reverseList(ListNode* head) {
ListNode * curr = head;
ListNode * prev = NULL;
ListNode * N;
while(curr!=NULL)
{
N = curr->next;
curr->next = prev;
... | ALGO | 0.999467 | 5.593219 |
d10916f1-ea39-48b8-863b-187246029438 | rushiraj111/delectrum | src/kernel.cpp | /* @flow */
#include <boost/assign/list_of.hpp>
#include <boost/lexical_cast.hpp>
#include "db.h"
#include "kernel.h"
#include "script/interpreter.h"
#include "timedata.h"
#include "util.h"
using namespace std;
bool fTestNet = false; //Params().NetworkID() == CBaseChainParams::TESTNET;
// Modifier interval: time t... | ALGO | 0.990762 | 6.141087 |
9d1e9e90-506a-4fd9-9d03-59b287f3e6ca | reddevill007/Leetcode | leetcode121.cpp | /*
121. Best Time to Buy and Sell Stock
Easy
You are given an array prices where prices[i] is the price of a given stock on the ith day.
You want to maximize your profit by choosing a single day to buy one stock and choosing a different day in the future to sell that stock.
Return the maximum profit you ... | ALGO | 0.999773 | 6.48723 |
b23ff11c-87e6-40ea-bb2a-202d170975e3 | KadenKing/dsk_android | app/src/main/cpp/src/DSK.cpp | /********************************************************************************/
// We include required definitions
/********************************************************************************/
#include <DSK.hpp>
#include <android/log.h>
using namespace std;
/**************************************************... | ALGO | 0.949751 | 6.877817 |
206c3151-5423-42a9-8aee-bd4ae00c3886 | superdariobros22/code | codigos_c++/aceptaelreto/#757.cpp | #include<bits/stdc++.h>
using namespace std;
int main() {
int a;
cin >> a;
for (int i=0 ; i<a ; i++) {
string s;
cin >> s;
int max=0, tes=0;
for (int j=0 ; j<s.size() ; j++) {
if (s[j]=='T') {
tes++;
}
}
}
} | ALGO | 0.999305 | 3.692529 |
13295de0-0ab9-436f-afef-0c1f4e8545b6 | TheRealMJP/BakingLab | SampleFramework11/v1.02/HosekSky/ArHosekSkyModel.cpp | /* ============================================================================
This file is part of a sample implementation of the analytical skylight and
solar radiance models presented in the SIGGRAPH 2012 paper
"An Analytic Model for Full Spectral Sky-Dome Radiance"
and the 2013 IEEE CG&A paper
... | ALGO | 0.985719 | 6.629977 |
d07ca9d7-f130-49b2-b25e-9a7b92a71c6e | networksaphyra/pub-stomper-1600 | src/movetable.cpp | #include "../include/movetable.h"
MoveTable::MoveTable() {
init_knight_move_table();
init_bishop_move_table();
init_rook_move_table();
init_queen_move_table();
init_king_move_table();
}
void MoveTable::init_knight_move_table() {
for (SQUARE square = A1; square <= H8; square = static_cast<SQUARE>(square + ... | CONFIG | 0.936451 | 5.93086 |
fac36840-850d-4dd8-927f-37c2bd400e38 | ishandutta2007/codeforces | mr.ilchi/normal/374/C.cpp | /*
* in the name of god
*
*
*
*
*
*
*
*
*/
#include <iostream>
#include <fstream>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <algorithm>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map... | ALGO | 0.999735 | 3.862367 |
d210054a-a19f-45ae-aedf-e389ab7f292f | MyCodeBits/Term2-Udacity-CarND-MPC-Project | src/Eigen-3.3/unsupported/test/BVH.cpp | #include "main.h"
#include <Eigen/StdVector>
#include <Eigen/Geometry>
#include <unsupported/Eigen/BVH>
namespace Eigen {
template<typename Scalar, int Dim> AlignedBox<Scalar, Dim> bounding_box(const Matrix<Scalar, Dim, 1> &v) { return AlignedBox<Scalar, Dim>(v); }
}
template<int Dim>
struct Ball
{
EIGEN_MAKE_ALIGN... | TEST | 0.989561 | 6.337957 |
88228ada-d82a-4179-b8bc-9f130f12cc1d | ococrook/sugsvarsel | src/sugsclusterProbcpp.cpp | #include <RcppArmadillo.h>
#include "dtscaled_h.h"
// [[Rcpp::depends(RcppArmadillo)]]
using namespace Rcpp ;
NumericVector my_dt( NumericVector x, NumericVector df, int lg){
int m = x.size();
NumericVector res(m) ;
for( int i=0; i<m; i++)
{
res[i] = R::dt( x[i], df[i], lg ) ;
}
return res ;
}
arma:... | ALGO | 0.999594 | 6.810918 |
a9bde153-cc75-4ba2-9276-d3f754e97b23 | Smaran1832/The-Return | Library/PackageCache/com.unity.ide.visualstudio@2.0.11/Editor/COMIntegration/COMIntegration~/COMIntegration.cpp | #include <iostream>
#include <sstream>
#include <string>
#include <filesystem>
#include <windows.h>
#include <shlwapi.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 made to Visual Studio can fail after ... | TOOL | 0.958405 | 6.977724 |
3245bdb5-ab91-4eb5-b8ed-07f4800c9ade | Zu-rin/yukicoder | 1470.cpp | #include <iostream>
#include <vector>
#include <string>
#include <list>
#include <queue>
#include <algorithm>
#define rep(i, n) for(i = 0; i < (n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define MOD 1000000007
#define PI 3.14159265358979323846
#define INF 1 << 30
using namespace std;
... | ALGO | 0.99993 | 3.624731 |
39fdd90b-ab16-4a47-ab92-d24582733ecc | Avdh512/GeeksforGeeks | POTD/Day16/Find Kth permutation Question.cpp | Find Kth permutation
MediumAccuracy: 63.45%Submissions: 13K+Points: 4
Getting a High Paying Job Now Easier Than Today's Problem! Apply For Mega Job-A-Thon
Given two integers N (1<=N<=9) and K. Find the kth permutation sequence of first N natural numbers. Return the answer in string format.
Example 1:
Input: N = 4,... | ALGO | 0.999765 | 6.010214 |
56821dd7-664b-411c-9d13-0fb8a72c51a7 | edoc0322/ACMProblemSolving | UVa Online Judge/uva129/main.cpp | #include <iostream>
#include <string>
#include <string.h>
using namespace std;
int N,L;
char ans[100];
int counts = 0;
char maxAns[100];
void backtrack(int depth)
{
if(counts > N) return;
for(int i = 'A' ; i < 'A'+L;++i)
{
ans[depth] = i;
int len = depth + 1;
int half = len/2;
... | ALGO | 0.999557 | 3.273442 |
6038d345-f1ce-49f7-8ea7-71fd061a77a8 | amine0ech/CodeForces | A/Bear_and_Big_Brother.cpp |
/*
http://codeforces.com/contest/791/problem/A
*/
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#else
#define dbg(...)
#endif
#define ar array
#define ll long long
#define ld long double
#define sza(x) ((int)x.size())
#define all(a) (a).begin(), (a).end()
const int MAX_N = 1e5 + 5;
const ll MOD = 1e9... | ALGO | 0.999936 | 4.515021 |
34e2518d-a143-4ef3-b57c-f6bf697f8b18 | mayankAgg06/Leetcode-Solutions | 1219-longest-well-performing-interval/1219-longest-well-performing-interval.cpp | class Solution {
public:
int longestWPI(vector<int>& hours) {
int count=0,ans=0;
unordered_map<int,int> tracker;
for(int i=0; i<hours.size(); i++)
{
if(hours[i]>8)count++;
else count--;
if(count>0)ans=i+1;
else if(tracker.count(count... | ALGO | 0.999745 | 5.718657 |
845da3c3-8188-480c-856d-99128a2af4b9 | 81-28/AtCoder | archive/24_09_20/t_a61.cpp | // https://atcoder.jp/contests/tessoku-book/tasks/tessoku_book_bi
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n+1); i++)
#define pb(a) push_back(a)
#define all(v) v.begin(), v.end()
template<typename T>
using v = vecto... | ALGO | 0.999611 | 4.510167 |
054cdfdc-0383-493c-9843-ae7608443551 | syedamanalii/DSA | sortedStack.cpp | #include<iostream>
#include<stack>
using namespace std;
void sortedInsert(stack<int> &stack, int num){
//base case
if(stack.empty()|| (!stack.empty()&& stack.top()<num )){
stack.push(num);
return;
}
int n = stack.top();
stack.pop();
//recursive call
sortedInsert(stack, num... | ALGO | 0.999955 | 5.400357 |
7f02c376-a840-4ad3-8b5f-da501163b1ee | haHung-pre/DSA-PTIT | SORT-AND-SEARCH/Bài 2:Sắp xếp theo trị tuyệt đối.cpp | #include<bits/stdc++.h>
using namespace std;
bool cmp(int a,int b){
return abs(a)<abs(b);
}
int main(){
int n;
cin>>n;
int a[n];
for(auto &x:a)cin>>x;
stable_sort(a,a+n,cmp);
for(auto x:a)cout<<x<<" ";
}
| ALGO | 0.999958 | 3.845624 |
4a54197e-9463-479e-bb67-33b886bdc3e0 | thbonotto/libras-intel | src/correlation/Reconhecimento_imagem.cpp | /*********************************************************************
*
*
*
* Compare two images using different methods, including
* cross correlation.
*
*********************************************************************/
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <open... | ALGO | 0.993574 | 4.046494 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.