uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
9bd00782-3c90-4485-9c56-515de77f2356 | aditya-sar/LeetCode | 1224-minimum-falling-path-sum-ii/minimum-falling-path-sum-ii.cpp | class Solution {
public:
int n;
int ans = INT_MAX;
vector<vector<int>> dp;
int dfs(vector<vector<int>> &grid, int row, int col) {
if(col < 0 || col >= n) {
return INT_MAX;
}
if(row == n-1) {
return grid[row][col];
}
if(dp[row][col] != -1) ... | ALGO | 0.999983 | 6.384083 |
53c60e1c-c4fc-43ed-82d8-a03d489375da | novrion/MOSES | src/government.cpp | #include "government.h"
#include "moses.h"
#include "moses_impl.h"
#include "labour.h"
#include "household.h"
#include "bank.h"
#include <iostream>
namespace moses {
Government::Government(const Moses& moses_ref,
const std::array<double, MAXT>& qchtxva1,
const std::array<double, MAXT>& qchtxva2,
con... | ALGO | 0.962462 | 5.111215 |
20f7a46f-9fcc-42ea-ba1b-ca39ebf97444 | dezfuture/CODEFORCES | @1100/B_Divisors_of_Two_Integers.cpp | #include <bits/stdc++.h>
using namespace std;
#define fast_io \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(0);
void solve()
{
int n;
cin >> n;
multiset<int> m;
for (int i = 0; i < n; ++i)
{
int x;
cin >> x;
... | ALGO | 0.999949 | 4.22038 |
afd37497-128f-40b8-a351-777b165ceef2 | AyushAg06/coding | tuf_practice/array_6.cpp | // rotate the array by d places to the left.
#include<bits/stdc++.h>
using namespace std;
void leftrotate(vector<int>&nums,int d)
{
d=d%nums.size();
int n=nums.size();
int temp[d];
for(int i=0;i<d;i++)
{
temp[i]=nums[i];
}
for(int i=d;i<n;i++)
{
nums[i-d]=nums[i];
}
... | ALGO | 0.999968 | 4.711102 |
11a90711-ef58-44e8-86bc-679a194c0a93 | trcamnguyen/NMLT | Bai103/Bai103.cpp | #include <iostream>
#include <cmath>
using namespace std;
float Tong();
int main()
{
cout << "Ket qua: " << Tong();
return 0;
}
float Tong()
{
float s = 0, e = 1;
int i = 1;
while (e >= pow(10, -6))
{
e = (float)1 / i;
s = s + e;
i = i + 2;
}
return s;
}
| ALGO | 0.998216 | 3.605763 |
6ac88198-ebb7-4ff9-9fe7-aa0207dd0f08 | Icefin/LeetCode | 1799-maximize-score-after-n-operations/1799-maximize-score-after-n-operations.cpp | class Solution {
public:
int backtrack(vector<int>& nums, int mask, int pairsPicked, vector<int>& memo) {
// If we have picked all the numbers from 'nums' array, we can't get more score.
if (2 * pairsPicked == nums.size()) {
return 0;
}
// If we already solved this sub-p... | ALGO | 0.999941 | 6.011741 |
2cb714f1-e9cb-4b2f-adae-509687d5e3f3 | davidjacobo/algo | graph_theory/scc.cpp | #include <iostream>
#include <vector>
#include <stack>
#define NOT_SEEN -1
#define MAX_V 1000
using namespace std;
typedef vector<int> vi;
int dfs_low[MAX_V], dfs_num[MAX_V];
bool to_process[MAX_V];
int vertex_counter, scc_counter;
stack<int> s;
vi graph[MAX_V];
void clear(int v){
for(int i=0;i<v;++i){
... | ALGO | 0.999939 | 4.437868 |
a1919ad6-5cf8-4b44-918b-4f279d686057 | Yeah-Kun/Cpp | practice/6.27.cpp | #include<iostream>
using namespace std;
int MySum(initializer_list<int> int_list)
{
int count = 0;
// for(auto num_ptr = int_list.begin(); num_ptr == int_list.end(); ++num_ptr){
// count += *num_ptr;
// }
for(auto num : int_list){
count += num;
}
return count;
}
int main(int argc, char const *argv[])
{
std... | ALGO | 0.981448 | 4.545008 |
c3f04d98-c8a1-4ab8-a21a-48c640baeb49 | harini-1597/geeksforgeeks | WaveArray.cpp | void convertToWave(vector<int>& arr, int n){
int i;
if(n%2==0){
for(i=0; i<n-1; i+=2){
swap(arr[i], arr[i+1]);
}
}
else{
for(i=0; i<n-1; i+=2){
swap(arr[i], arr[i+1]);
}
}
}
| ALGO | 0.998627 | 3.911647 |
93dc1202-7ae7-4b48-b5c7-26d4572c9127 | jigjnasu/discrete_mathematics_and_its_applications | chapter_4_number_theory_and_cryptography/4.6_cryptography/exercises/repo/problem_15.cpp | #include <cstdio>
#include <string>
#include <vector>
const int block = 4;
const char space = ' ';
const std::vector<int> cipher = {3, 1, 4, 2};
void swap(char& a, char& b) {
const char t = a;
a = b;
b = t;
}
void strip(std::string& message) {
for (std::size_t i = 0; i < message.size(); ++i)
... | ALGO | 0.999924 | 4.600408 |
3778ee24-c73d-41ce-bb98-513a9f978008 | ishandutta2007/codeforces | littlebeetle/normal/1201/C.cpp | #include<cstdio>
#include<algorithm>
using namespace std;
const int N=200002;
typedef long long ll;
ll n,k,i,a[N],l,r,mid,s;
int main(){
scanf("%I64d%I64d",&n,&k);
for(i=1;i<=n;i++)
scanf("%I64d",a+i);
sort(a+1,a+n+1);
l=a[n+1>>1];
r=1ll<<40;
while(l<r){
mid=l+r+1>>1;
s=0;
for(i=n+1>>1;i<=n;i++)
if(mid... | ALGO | 0.999976 | 3.821372 |
03f074bb-84d9-425a-a643-29c0ddaab5b1 | whitehorsetzm/MeshRefiningLib | MeshRefining/boundary.cpp | #include <cassert>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include "boundary.h"
#include "lookup_table.h"
using std::map;
using std::multimap;
using std::set;
using std::vector;
template <int NoNodes>
struct OrderedNodes
{
OrderedNodes() {}
OrderedNodes(const idx_t indices[]) { init(in... | ALGO | 0.997653 | 6.25073 |
ffe386ef-022b-463b-be3c-90016bd685f3 | victorsenam/treinos-old | time/imampamento2015/s02/e05/J.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 100007;
vector<int> adj[N];
int deg[N];
int t, n, a, b, ss;
queue<pair<int, int> > q;
pair<int, int> aux;
int main () {
scanf("%d", &t);
while (t--) {
scanf("%d", &n);
if (n == 1) {
printf("0\n");
continue;
... | ALGO | 0.999883 | 4.487175 |
1c4d56e2-2286-48bb-815d-6350dfae72d0 | TyrnBlnks/TyronGraphicProject | Libraries/include/glm/test/perf/perf_matrix_div.cpp | #define GLM_FORCE_INLINE
#include <glm/ext/matrix_float4x4.hpp>
#include <glm/ext/matrix_double4x4.hpp>
#include <glm/ext/matrix_transform.hpp>
#include <glm/ext/matrix_relational.hpp>
#include <glm/ext/vector_float4.hpp>
#if GLM_CONFIG_SIMD == GLM_ENABLE
#include <glm/gtc/type_aligned.hpp>
#include <vector>
#include <... | TEST | 0.943648 | 6.64033 |
8dbd5c1e-438c-4c93-9f44-16da4539e6fe | Gal4way/OpenPose | src/openpose/utilities/fileSystem.cpp | #include <openpose/utilities/fileSystem.hpp>
#include <algorithm> // std::replace
#include <cctype> // std::isdigit
#include <cstdio> // std::fopen
#include <cstring> // std::strncmp
#ifdef _WIN32
#include <direct.h> // _mkdir
#include <windows.h> // DWORD, GetFileAttributesA
#elif defined __unix__ || defined _... | TOOL | 0.914642 | 5.506975 |
baed5fbc-f547-4884-bc00-82cc9b72857f | vphuong712/CPP-PTIT | CPP0311.cpp | #include<bits/stdc++.h>
using namespace std;
int main() {
int t;
cin >> t;
while(t--) {
string str;
cin >> str;
map<char, int> m;
for(int i = 0; i < str.size(); i++) {
m[str[i]]++;
}
cout << m.size();
}
}
| ALGO | 0.999886 | 4.551089 |
da818f26-6d3f-420f-bab3-d993b459bd49 | davimedio01/competitive-programming | CSES Problems/Introductory Problems/TwoSets.cpp | /*
Author: Davi Augusto Neves Leite
Date: 02/05/2022
Compile with args: -O2 -Wall -Wextra
Execute with args: < input.txt > output.txt
In terminal for Compile (code = name of file): g++ -O2 -Wall -Wextra code.cpp
In terminal for Execute: ./a.out < input.txt > output.txt
Primeiramente, analisar os casos bases:
n = 1 ... | ALGO | 0.999578 | 3.962843 |
28b35038-8941-4ac8-beed-e0e9db2721d8 | kidclone3/CP | template/Graph/Dijkstra.cpp | const int inf = 1e9;
vvii G;
vi d;
void dijkstra(){
int n = G.size();
priority_queue<ii, vii, greater<ii>> pq;
pq.push(ii(0, 1));
while(pq.size()){
int u = pq.top().se,
du = pq.top().fi;
pq.pop();
if (du!=d[u]) continue;
FOR(i, G[u].size()){
int... | ALGO | 0.999976 | 5.266072 |
f8438b5e-58ae-465f-a8b7-be0fc36176b7 | Mmao-fan/Aftercalss-Homework | 练习3——控制结构/10.数字单词.cpp | #include<bits/stdc++.h>
using namespace std;
char c;
int main(){
cin >> c;
switch (c){
case '0' :
cout << "Zero";
break;
case '1' :
cout << "One";
break;
case '2' :
cout << "Two";
break;
case '3' :
cout << "Three";
break;
case '4' :
cout << "Four";
break;
case '5' :
cou... | ALGO | 0.985117 | 3.707358 |
45dc8b38-e610-47be-b4d7-6568616ca903 | moti9/iCode | dsa/Graph/flood_fill.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007
void dfs(int sr, int sc, vector<vector<int>> img, vector<vector<int>> &ans, int inColor, int nColor, int drow[], int dcol[])
{
ans[sr][sc] = nColor;
int n = img.size();
int m = img[0].size();
for (int i = 0; i < ... | ALGO | 0.999528 | 4.81867 |
c9866442-fa93-4564-aa31-f6bfecdc08f5 | Zhaoyibinn/LVI-SAM-Study | 相关环境/gtsam/gtsam/3rdparty/Eigen/lapack/eigenvalues.cpp | #include "lapack_common.h"
#include <Eigen/Eigenvalues>
// computes eigen values and vectors of a general N-by-N matrix A
EIGEN_LAPACK_FUNC(syev,(char *jobz, char *uplo, int* n, Scalar* a, int *lda, Scalar* w, Scalar* /*work*/, int* lwork, int *info))
{
// TODO exploit the work buffer
bool query_size = *lwork==-1;... | ALGO | 0.998319 | 4.671507 |
c1243bd4-c93e-49dd-9c58-3962941eb5d8 | mdturin/CodeRed | 6 - Dynamic Programming/CSES - Dynamic Programming/Elevator Rides.cpp | #include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ii = pair<int,int>;
#define ff first
#define se second
int n, m, w, a[22];
int main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr); cout.tie(nullptr);
cin >> n >> w; m = (1<<n);
vector<ii> dp(m, ii(n, 0));
for(int i=... | ALGO | 0.999985 | 4.1882 |
4f986fc6-ab37-4bf6-bd93-539e209213d6 | raviii21/Leetcode-Codes | intersection-of-two-arrays/2-12-2023, 6_06_16 PM/intersection-of-two-arrays.cpp | // Link: https://leetcode.com/problems/intersection-of-two-arrays
/** Submission Info:
*
* AUTHOR: Ravi Savsani
* TITLE: intersection-of-two-arrays
* RUNTIME: 11 ms
* MEMORY: 10.2 MB
* DATE: 2-12-2023, 6:06:16 PM
*
*/
// Solution:
class Solution {
public:
vector<int> intersection(vector<int>& nums1,... | ALGO | 0.999969 | 5.874467 |
06d7d5ed-7a08-4dae-aef6-86df1a7353aa | flick-23/leetcode | 0735-asteroid-collision/0735-asteroid-collision.cpp | class Solution {
public:
vector<int> asteroidCollision(vector<int>& arr) {
int n = arr.size();
stack<int> st;
vector<int> ans;
for (int i = 0; i < n; i++) {
int curr = arr[i];
bool destroyed = false;
// Check only when one is moving right, the othe... | ALGO | 0.999987 | 6.062672 |
d929fd54-1d2f-431e-b7da-19f96b4f3c00 | niaokedaoren/LeetCode_Solution | Solutions/insert-interval.cpp | /**
* Definition for an interval.
* struct Interval {
* int start;
* int end;
* Interval() : start(0), end(0) {}
* Interval(int s, int e) : start(s), end(e) {}
* };
*/
class Solution {
public:
vector<Interval> insert(vector<Interval> &intervals, Interval newInterval) {
// Start typin... | ALGO | 0.999968 | 5.823987 |
9d01689b-d0eb-4ec1-a345-c36566451674 | devincody/CS179homework | lab2/transpose_host.cpp | #include <cassert>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <cuda_runtime.h>
#include "transpose_device.cuh"
#include "ta_utilities.hpp"
/*
* NOTE: You can use this macro to easily check cuda error codes
* and get more information.
*
* Modified from:
* http://stackoverf... | ALGO | 0.963992 | 6.380444 |
4e8af1cb-c798-4b14-84f0-dea46db9faec | indahmutia/AP_1 | PERTEMUAN 6/fungsi.cpp | #include <iostream> //header untuk c++
#include <cstdlib> // untuk system("cls")
using namespace std;
// Fungsi tanpa nilai balikan
void tampilkanpesan() {
cout << "=== SELAMAT DATANG DI AP 1 ===" << endl;
}
// Fungsi dengan nilai balikan
int tambah(int a, int b) {
return a + b; //mengembalikan hasil penjumla... | ALGO | 0.989186 | 5.617703 |
a0ffd8bf-b7a0-45dd-88a5-7148d6ceb711 | shazaElnagar/gradApp | 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 |
8d6f46d8-baab-41e7-a120-03c4a1ba1825 | vfolunin/archives-solutions | EOlymp/8864.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 a, b;
cin >> a >> b;
cout << ((a > 0) == (b > 0));
} | ALGO | 0.999571 | 3.330172 |
09dd078c-6eb8-4f6e-80b0-b7f1e01ce36c | raincross7/code-similarity | codes/train_code/problem319/problem319_17.cpp | #include <iostream>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <queue>
#include <deque>
#include <map>
#include <unordered_map>
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define repr(e,x) for(auto& e:x)
usi... | ALGO | 0.999572 | 3.285563 |
df60c3b1-5260-4f5b-9e9c-e3d5e5e5ef5b | sinian666/codes_102_4 | cpp_副本42/chapter_hashing/array_hash_map.cpp | /**
* File: array_hash_map.cpp
* Created Time: 2022-12-14
* Author: msk397 (<EMAIL>)
*/
#include "../utils/common.hpp"
/* 键值对 int->String */
struct Entry {
public:
int key;
string val;
Entry(int key, string val) {
this->key = key;
this->val = val;
}
};
/* 基于数组简易实现的哈希表 */
class A... | TOOL | 0.922781 | 5.642146 |
be465459-c069-4239-9bb4-b962a66874a7 | HardikDDeore12/Leetcode | 2170-count-number-of-maximum-bitwise-or-subsets/count-number-of-maximum-bitwise-or-subsets.cpp | class Solution {
public:
int countMaxOrSubsets(vector<int>& nums) {
int n = nums.size();
int mx = 0;
int count = 0;
//there are 2^n subset... and each subset can be represented in i
//for eg i = 5, 101 include first element, exclude second element, include third element
for (int i... | ALGO | 0.999981 | 5.977438 |
8b77808a-420e-4ca0-91fa-1421d2ce11f4 | souravdev33/Codeforces | last2digit.cpp | #include<iostream>
using namespace std;
int main()
{
long long a,b,c,d,x;
cin>>a>>b>>c>>d;
a=a%100;
b=b%100;
c=c%100;
d=d%100;
x=a*b*c*d;
cout<<x;
return 0;
} | ALGO | 0.998381 | 3.295698 |
30782c69-b1f3-4707-b0ac-e58ba7ee6dc4 | vrangr1/competitive-programming | contests/tlx/regular_open_contests/troc_37/b.cpp | /***************************************************
* Author : Anav Prasad
* Nick : vrangr
* Created : Sat Aug 3 19:52:39 IST 2024
****************************************************/
#include <bits/stdc++.h>
#define debug(...) (void)42
#ifdef LOCAL
#undef debug
#include <algo/debug.hpp>
const bool ... | ALGO | 0.999984 | 3.94045 |
6273e451-8747-4787-aeb8-a5b063b2e41a | StevenL2017/Codeforces | problem/archive/597/597C.cpp | #include <iostream>
#include <cstdio>
#include <climits>
#include <cmath>
#include <cstring>
#include <string>
#include <array>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <algorithm>
#include <functional>
using namesp... | ALGO | 0.999969 | 4.404212 |
64132a0b-1bc0-4271-ace3-f796350f6109 | Varlode/Code | CodeCpp/HSG VL/HSG_11 17_18/doicho.cpp | #include<bits/stdc++.h>
using namespace std;
const int maxN=1e3+9;
int n, m, u, v, a[maxN][maxN];
int main() {
freopen("doicho.inp", "r", stdin);
freopen("doicho.out", "w", stdout);
cin >> m >> n >> u >> v;
for (int i = 1; i <= m; i++) {
int k = i; if (i == u) k = v; else if (i == v) k = u;
... | ALGO | 0.999529 | 3.029532 |
c04c48c0-db32-43b6-b464-25ec3c74c17c | hoonti06/problem-solving | cpp/SWEA/success/2382-simulation.cpp | #include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <functional>
#include <cstring>
using namespace std;
#define MAX_N 102
int N, M, K;
int dx[4] = { -1, 1, 0, 0 };
int dy[4] = { 0, 0, -1, 1 };
int board[MAX_N][MAX_N];
int isVisited[MAX_N][MAX_N][2]; // 0 : 총합, 1 : 방... | ALGO | 0.999874 | 4.323247 |
28416473-46f8-4863-9b58-f73130fb9e19 | Nitin-vohra92/Trees | Count nodes.cpp | // Following is the given TreeNode structure.
/**************
template <typename T>
class TreeNode {
public:
T data;
vector<TreeNode<T>*> children;
TreeNode(T data)
{
this->data = data;
}
~TreeNode()
{
for (int i = 0; i < children.size(); i++)
{
... | ALGO | 0.999448 | 5.844451 |
d033000d-3393-4e94-93fe-db24d964be48 | tanus786/CP-Codes-HackOctober-Fest-2023 | C++ STL/Chocolate Distribution Problem.cpp | // C++ program to solve chocolate distribution
// problem
#include <bits/stdc++.h>
using namespace std;
// arr[0..n-1] represents sizes of packets
// m is number of students.
// Returns minimum difference between maximum
// and minimum values of distribution.
int findMinDiff(int arr[], int n, int m)
{
// if there are... | ALGO | 0.999981 | 5.460355 |
9fdc441f-4980-4adf-aad7-8f969ab948fe | redsand/bl4ckJack | bl4ckJack/boost_1_45_0/libs/spirit/example/qi/calc3.cpp | ///////////////////////////////////////////////////////////////////////////////
//
// A calculator example demonstrating the grammar and semantic actions
// using phoenix to do the actual expression evaluation. The parser is
// essentially an "interpreter" that evaluates expressions on the fly.
//
// [ JDG June 29,... | TOOL | 0.923469 | 7.50854 |
3f58a0f2-05c0-4770-afc2-d4426ced28d0 | ZJU-DAILY/HNSW-Flash | third_party/eigen/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_broadcast_simple_rowwise.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
int main() {
Eigen::MatrixXf mat(2, 4);
Eigen::VectorXf v(4);
mat << 1, 2, 6, 9, 3, 1, 7, 2;
v << 0, 1, 2, 3;
// add v to each row of m
mat.rowwise() += v.transpose();
std::cout << "Broadcasting result: " << std::endl;
std::cout << mat... | ALGO | 0.996831 | 4.432505 |
8249bf2d-d084-41e5-8fe6-1b15e6d5579a | Vikas2201/Programming-In-C | Function and Recursion/Pair-star.cpp | /* Given a string S, compute recursively a new string where identical chars
that are adjacent in the original string are separated from each other by a "*". */
#include<bits/stdc++.h>
using namespace std;
void modify(string& str , string& out , int start = 0)
{
out = out + str[start];
if(start == str.length... | ALGO | 0.999944 | 4.233382 |
e2f216c3-cd0c-4077-8986-b661c11dd1a6 | anuj108/Codeforces | k-string.cpp | #include <bits/stdc++.h>
using namespace std;
#define ar array
#define ll long long
const int MAX_N = 1e5 + 1;
const ll MOD = 1e9 + 7;
const ll INF = 1e9;
void solve()
{
int n;
cin >> n;
string s, new_s;
cin >> s;
int flag = 0;
string ans = "";
sort(s.begin(), s.end());
for (int i = 0; i... | ALGO | 0.999851 | 4.178063 |
d2f2ecbe-d3b4-4cae-b277-7cd90332efe8 | hzfsls/leetcode-supercrawl | data/0374.guess-number-higher-or-lower/code_snippets/sol.cpp | /**
* Forward declaration of guess API.
* @param num your guess
* @return -1 if num is higher than the picked number
* 1 if num is lower than the picked number
* otherwise return 0
* int guess(int num);
*/
class Solution {
public:
int guessNumber(int n) {
}
}; | ALGO | 0.999941 | 5.933308 |
c87e28de-40c6-4237-8ceb-a623d2d3b609 | Huqicheng/Test | input.cpp | #include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <string.h>
#include <strings.h>
#include <sys/types.h>
#include <sys/time.h>
#include <unistd.h>
#include <errno.h>
#include <limits.h>
#include "helper.h"
/*
* An example of using mutex that is shared by multiple threads.
* We have three reader t... | ALGO | 0.980878 | 4.560212 |
eee01914-6290-4e6f-8b4d-6b47522f2ff0 | Muhammad-Aqib-92/C-Practice | BottomUpApproachofCUTROD.cpp | #include <iostream>
#include <climits>
using namespace std;
int cutRodBottomUp(int price[], int n) {
int dp[n + 1];
dp[0] = 0; // No rod means no profit
for (int len = 1; len <= n; len++) {
int maxProfit = INT_MIN;
// Try cutting the rod into pieces of length i (1 to len)
for (int... | ALGO | 0.999966 | 5.689772 |
3bf011e0-2096-4024-a2f6-321610b9df28 | sanken5/C_data | 03.cpp | /**
þ̬ʵ˳İλҲ
*/
#include<stdio.h>
#define MaxSize 10 //Ա
typedef int ElemType;
typedef struct{
ElemType data[MaxSize]; //þ̬""Ԫ
int length; //˳ĵǰ
}SqList; //˳Ͷ(̬䷽ʽ)
void InitList(SqList &L){ //ûԪصĬֵ
L.length=0;
}
//˳LĵkλòԪe
bool ListInsert(SqList &L, int i, int e){
if(i<1||i>L.length+1) /... | ALGO | 0.998418 | 3.037585 |
0db35009-d1bb-4c64-ba2d-5dd490fc4a52 | AakashKumar-Code/LeetCode-Daily_Practice | 6-zigzag-conversion/zigzag-conversion.cpp | class Solution {
public:
string convert(string s, int numRows) {
int n=s.length();
int m=numRows-1;
vector<vector<string>>arr(numRows, vector<string>(n, ""));
int row=0, col=0;
int ind=0;
while(ind<n){
if(row<=0){
row=0;
... | ALGO | 0.999997 | 6.072855 |
314e6a8b-7005-4a78-b247-ac1f5765d278 | dnyaneshmore2001/Searching-Techniques | Searching4.cpp | #include<iostream>
using namespace std;
class ArrayX{
public:
int *Arr;
int iSize;
ArrayX(int iValue);
~ArrayX();
void Accept();
void Display();
};
ArrayX::ArrayX(int iValue){
this->iSize=iValue;
this->Arr=new int[iSize];
}
ArrayX::~ArrayX(){
... | TOOL | 0.967345 | 3.176105 |
41776127-c165-45ee-89d9-773a1d041ba4 | sarahef2/RLT_Memory | src/SurvUni/Surv_Uni_3_One_Split_Cat.cpp | // **********************************
// Reinforcement Learning Trees (RLT)
// Survival
// **********************************
// my header file
# include "../RLT.h"
using namespace Rcpp;
using namespace arma;
void Surv_Uni_Split_Cat(Split_Class& TempSplit,
const uvec& obs_id,
... | ALGO | 0.998389 | 5.375963 |
ea56efce-4aa2-43fa-aa0a-53a644a8168c | Dyryamo/algorithm | 牛客/sec-B.cpp | #include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#define N 105
using namespace std;
int max(int x,int y){
return x>y?x:y;
}
int main(){
int n,m,h;
int w[N],v[N];
int dp[N];
while((scanf("%d",&n),n!=0)){
scanf("%d%d",&m,&h);
memset(dp,0,sizeof(dp));
for(int i=0;i<n;i++){
scanf(... | ALGO | 0.999901 | 3.492979 |
57af7890-5079-42e7-9c59-d962761e6660 | pavel-ryzhov/global_vars | runs/003485.cpp |
#include <vector>
#include <iostream>
#include <fstream>
#include <set>
#include <stack>
#include <algorithm>
using namespace std;
template<class F,class S,class T> class trio{
public:
F first;
S second;
T third;
trio(F f,S s,T t){
first=f;
second=s;
third=t;
}
trio(){
}
};
int length,M,ansLength;
int... | ALGO | 0.999568 | 3.542077 |
07a8cc30-3837-43db-aa4f-fe5a28faaaa1 | thesaravanakumar/competative-programming | codeforces/800/1415A-PrisonBreak.cpp | #include <bits/stdc++.h>
#define ll long long int
#define w(t) int t; cin>>t; while(t--)
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define mii map<int,int>
#defin... | ALGO | 0.998827 | 3.565692 |
b1119abe-4c3f-4270-8450-5a604d0979d5 | WenKSo/MeshEditor | ext/eigen/bench/bench_norm.cpp | #include <typeinfo>
#include <iostream>
#include <Eigen/Core>
#include "BenchTimer.h"
using namespace Eigen;
using namespace std;
template<typename T>
EIGEN_DONT_INLINE typename T::Scalar sqsumNorm(T& v)
{
return v.norm();
}
template<typename T>
EIGEN_DONT_INLINE typename T::Scalar stableNorm(T& v)
{
return v.sta... | TEST | 0.979591 | 6.681669 |
7511e41e-b8f7-40f5-a23a-6e36ca816b33 | SudhakarKuma/Programming-in-C-Cpp | Interview-Questions/Backtracking/findUniqueSubsetsAddingUptoN.cpp | /*
Find unique sets of integers that add up to '15' from the following array: [4, 5, 6, 89, 23, 5, 2, 3, 5].
For the above mentioned array, we should have:
output = [ 4, 5, 6 ],
[ 2, 3, 4, 6 ],
[ 2, 3, 5, 5 ],
[ 5, 5, 5 ]
*/
#include <iostream>
#include <vector>
#include <algorithm>
using na... | ALGO | 0.999576 | 6.367836 |
134c677a-6752-4b9a-832f-8473d23483ff | Mikadun/Projects | projects/transitive_closure_matrix.cpp | #include <iostream>
using namespace std;
int main()
{
int n;
cin >> n;
bool g[n][n], res[n][n];
for( int i = 0; i < n; i++ )
for( int j = 0; j < n; j++ )
{
cin >> g[i][j];
res[i][j] = g[i][j];
}
for( int m = 0; m < n; m++ )
for( int i = 0; i < n; i++ )
for( int j = 0; j < n; j++ )
for( int k... | ALGO | 0.999946 | 3.994872 |
54b3a99c-5b8a-47d7-8fd4-35757e47534d | Hornb00k/C_2022 | lesson_4_work_1.cpp | #include <iostream>
#include <string>
using namespace std;
int main()
{
int a;
string z[10]={
"ноль", "один","два","три","четыре",
"пять","шесть","семь","восемь","девять"
};
cout<<"Введите число";
cin>>a;
cout<<z[a];
return 0;
}
| ALGO | 0.999273 | 4.021876 |
49d77a02-9788-460d-b4ca-8c73679159f4 | RydKrm/Competitive_Program | Codeforces/1263A Sweet Problem.cpp | #include<iostream>
#include<algorithm>
using namespace std;
int main(){
int t,n,ar[10],p,cnt;
cin>>t;
while(t--){
cnt=0;
cin>>ar[0]>>ar[1]>>ar[2];
sort(ar,ar+3);
if((ar[0]-1)+(ar[1]-1)==ar[2]){
cnt++;
ar[0]--;ar[1]--;
}
if(ar[1]==ar[2]){
cnt++;
ar[0]--;ar[1]--;
}
//for(int i=0;i<3;i++... | ALGO | 0.999685 | 3.866974 |
ef24083b-4191-4da1-a70d-6452274ee816 | sarvex/leetcode-rockstar | solution/0800-0899/0870.Advantage Shuffle/Solution.cpp | class Solution {
public:
vector<int> advantageCount(vector<int>& nums1, vector<int>& nums2) {
int n = nums1.size();
vector<pair<int, int>> t;
for (int i = 0; i < n; ++i) t.push_back({nums2[i], i});
sort(t.begin(), t.end());
sort(nums1.begin(), nums1.end());
int i = 0,... | ALGO | 0.999999 | 6.068687 |
ca0d32c8-eed2-46c4-9904-1294d46a03f4 | ishandutta2007/codeforces | w0nsh/normal/1672/D.cpp | #include <bits/stdc++.h>
#define FOR(i, n) for(int i = 0; i < (n); ++i)
#define REP(i, a, b) for(int i = (a); i < (b); ++i)
#define TRAV(i, a) for(auto & i : (a))
#define SZ(x) ((int)(x).size())
#define X first
#define Y second
#define PR std::pair
#define MP std::make_pair
typedef long long ll;
typedef std::pair<int, ... | ALGO | 0.999975 | 4.233539 |
60da7fbb-e339-4ed1-bdcc-81b1fa4ccb36 | Funkyfal/CrMe_labs | Lab_3/AntonLab3CrM.cpp | #include <iostream>
#include <fstream>
#include <vector>
#include <bitset>
#include <cstdint>
#include <cstring>
using namespace std;
const int IP[64] = {
58, 50, 42, 34, 26, 18, 10, 2, 60, 52, 44, 36, 28, 20, 12, 4,
62, 54, 46, 38, 30, 22, 14, 6, 64, 56, 48, 40, 32, 24, 16, 8,
57, 49, 41, 33, 25, 17, 9, ... | ALGO | 0.989 | 5.568714 |
51f819aa-887b-473d-82a4-a0967d21290e | itsme-aparna/DSA-Resources | 1008-construct-binary-search-tree-from-preorder-traversal/1008-construct-binary-search-tree-from-preorder-traversal.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.407646 |
d4a0ca60-a0ae-4625-aa24-f0ab8f36e658 | beschulz/juce_emscripten | modules/juce_audio_utils/gui/juce_AudioThumbnail.cpp | struct AudioThumbnail::MinMaxValue
{
MinMaxValue() noexcept
{
values[0] = 0;
values[1] = 0;
}
inline void set (const char newMin, const char newMax) noexcept
{
values[0] = newMin;
values[1] = newMax;
}
inline char getMinValue() const noexcept { return... | TOOL | 0.878556 | 5.970637 |
13779456-16f0-4ddb-afc8-12f9f6785c9f | yanshiwei/leetcode-go | cpp/179.cpp | class Solution {
public:
/*
给定一组非负整数 nums,重新排列每个数的顺序(每个数不可拆分)使之组成一个最大的整数。
*/
string largestNumber(vector<int>& nums) {
vector<string>cpy;
for(int i=0;i<nums.size();i++){
cpy.push_back(to_string(nums[i]));
}
//自定义排序 A+B < B+A
sort(cpy.begin(),cpy.end(),[](co... | ALGO | 0.999971 | 5.967648 |
1e05241c-6aa3-43af-a404-b6a75049ec00 | darkl/clintprograms | lab03/cpp/PolySolv.cpp | #include <iostream>
#include <map>
#include <vector>
#include <regex>
using namespace std;
map<int, int> parse_polynomial(const string& input_str) {
map<int, int> poly;
std::regex x_regex(R"(([+-]?\d*)(x)?(?:\^(\d+))?)");
auto words_begin = sregex_iterator(input_str.begin(), input_str.end(), x_regex);
... | ALGO | 0.999977 | 5.83832 |
d0b4b8ca-5dbc-48ad-b4d8-01ac8e0e2d86 | leonardo-lim/codeforces | fancyfence.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int t, a;
cin >> t;
while (t--) {
cin >> a;
if (360 % (180 - a) == 0) cout << "YES" << endl;
else cout << "NO" << endl;
}
return 0;
}
| ALGO | 0.999776 | 4.09125 |
c583ce9c-efa6-486e-b586-8ead3d60b2cd | Sergio72111/lab_7 | boost/libs/multiprecision/example/gauss_laguerre_quadrature.cpp | // This example uses Boost.Multiprecision to implement
// a high-precision Gauss-Laguerre quadrature integration.
// The quadrature is used to calculate the airy_ai(x) function
// for real-valued x on the positive axis with x.ge.1.
// In this way, the integral representation could be seen
// as part of a scheme to cal... | ALGO | 0.999655 | 7.676931 |
5af278ac-0a55-4e8f-b8cc-e607faf28fa3 | ahmedbelal3228/Problem_Solving-using-cpp | CountCharInString.cpp | #include <iostream>
#include <vector>
#include <string>
#include <limits>
using namespace std;
/*
Problem:
Count how many times a specific character is repeated in a string,
first case-sensitively, then case-insensitively.
This problem helps practice:
- Loops
- Conditionals
- Character and... | TOOL | 0.990714 | 6.457785 |
b4085449-e3b1-4ffc-a7a9-cd6e4840fa82 | tanvirtareq/codeforces | 1443D.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define ld long double
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpll vector<pll>
#define vpii v... | ALGO | 0.999883 | 3.962953 |
e9a10157-be38-455b-81e6-1457b8d3f32a | yipu3/algorithm-practice | ST2014/24/test.cpp | #include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<climits>
#include<algorithm>
#include<vector>
#include<stack>
#include<set>
#include<queue>
#include<map>
#include<cmath>
#include<sstream>
#include<string>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
int m... | ALGO | 0.977479 | 3.139149 |
dfd55b68-2ed1-497e-97de-2daf3ce106fc | satyajit-patel/algoCamp | array/two_pointer/practice/2485. Find the Pivot Integer.cpp | /*
Constraints:
1 <= n <= 1000
f(n) = O(n^2 logn)
Input: n = 8
Output: 6
Explanation:
6 is the pivot integer since: 1 + 2 + 3 + 4 + 5 + 6 = 6 + 7 + 8 = 21.
*/
int pivotInteger(int n) {
vector<int> prefixSum(n), suffixSum(n);
int pSum = 0... | ALGO | 0.99994 | 6.187922 |
4e030da1-ab3b-43f6-b868-05e8b2bfbb4d | AnsonHooL/Coding_Note | leetcode/【动态规划】121_Ⅱ.买卖股票的最佳时期(无限次交易).cpp | //
// Created by lenovo on 2020/12/28.
//
/**
* 给定一个数组,它的第 i 个元素是一支给定股票第 i 天的价格。
设计一个算法来计算你所能获取的最大利润。你可以尽可能地完成更多的交易(多次买卖一支股票)。
注意:你不能同时参与多笔交易(你必须在再次购买前出售掉之前的股票)。
示例 1:
输入: [7,1,5,3,6,4]
输出: 7
解释: 在第 2 天(股票价格 = 1)的时候买入,在第 3 天(股票价格 = 5)的时候卖出, 这笔交易所能获得利润 = 5-1 = 4 。
随后,在第 4 天(股票价格 = 3)的时候买入,在第 5 天(股票价格 = 6)的时候卖... | ALGO | 0.999804 | 5.792452 |
cb1e6581-2130-4927-82ca-102d0c09d7b5 | gustavomuller99/Algo | Templates/Graph - General/Eulerian Path/main.cpp | #include <bits/stdc++.h>
using namespace std;
/*
* path that goes through every edge once
*/
vector<int> euler;
vector<vector<pair<int, bool>>> g;
void euler_path(int u) {
stack<int> s;
vector<int> deg(g.size());
for (int i = 0; i < g.size(); ++i) {
deg[i] += g[i].size();
}
s.push(u);... | ALGO | 0.999628 | 4.333408 |
f3f85aee-a570-4406-9624-ceca81dc2592 | devjwsong/2019-spring-cpp-seminar | src/Array_Index.cpp | #include <iostream>
using namespace std;
int main() {
int arr[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
int *p = arr;
cout<<p[0]<<endl;
cout<<p[2]<<endl;
cout<<p[5]<<endl;
return 0;
} | ALGO | 0.956409 | 3.045768 |
6239cb75-e608-4651-8ba8-fc36dfa0ce37 | VinhTA-Computer-Master/CCF-20.04 | llvm-project/libcxx/test/std/algorithms/alg.modifying.operations/alg.rotate/rotate_copy.pass.cpp | // <algorithm>
// template<ForwardIterator InIter, OutputIterator<auto, InIter::reference> OutIter>
// constexpr OutIter // constexpr after C++17
// rotate_copy(InIter first, InIter middle, InIter last, OutIter result);
// Older compilers don't support std::is_constant_evaluated
// UNSUPPORTED: clang-4, ... | TEST | 0.97516 | 7.487388 |
a037351e-c9fe-4a41-9326-d205cdbaff47 | DenisGrudin1n/Portfolio-Website | 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 |
da618bf9-025d-4cca-b3c2-2efde2373648 | jarrett-taylor-repos/CodingChallenges | LeetCode/0041 - First Missing Positive/main.cpp | #include <iostream>
#include <vector>
using namespace std;
bool IsNegativeOrGreaterThan(int val, int size) {
if(val <= 0) return true;
if(val > size) return true;
return false;
}
int firstMissingPositive(vector<int>& nums) {
if(nums.size()== 0) return 1;
//on first loop get rid of all values larg... | ALGO | 0.999918 | 4.965715 |
b70994a4-cd8f-4b85-a40c-fbeed63ea454 | thomasballinger/endless-web | source/Mask.cpp | #include "Mask.h"
#include "ImageBuffer.h"
#include "Logger.h"
#include <algorithm>
#include <cmath>
#include <limits>
using namespace std;
namespace {
// Trace out outlines from an image frame.
void Trace(const ImageBuffer &image, int frame, vector<vector<Point>> &raw)
{
const uint32_t on = 0xFF000000;
cons... | TOOL | 0.967411 | 7.129123 |
3a1f405b-3bee-4183-a7f3-210af91d52e5 | omartood/MI_Profile | 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 |
c582cada-12c1-4747-9056-896819a24d32 | Ishan-77/DSA | Floor in BST - GFG/floor-in-bst.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
struct Node {
int data;
Node *right;
Node *left;
Node(int x) {
data = x;
right = NULL;
left = NULL;
}
};
int floor(Node *root, int x);
Node *insert(Node *tree, int val) {
Node *temp = NULL;
if (... | ALGO | 0.999958 | 4.935183 |
fd099d99-b3ab-419e-b865-0ba9953f47c2 | tedsong2001/PIC-10B | TicTacToe/TicTacToe/main.cpp | #include <iostream>
#include <string>
#include <vector>
using namespace std;
class Player {
public:
// constructor
/**
Constructor makes a player, given a name and token, with score of 0
@param NAME player's name
@param TOKEN player's token ('x' or 'o')
*/
Player(const string NAME, cons... | ALGO | 0.998478 | 6.038961 |
cf514626-8b16-476d-b937-0692c7ff2b72 | Gaurav-88074/MCA | SEM2/ALGO/heapsort.cpp | #include<iostream>
#include<vector>
using namespace std;
void displayArray(vector<int> &array){
cout<<"Displaying Your Array..."<<endl;
for (int i = 0; i < array.size(); i++){
cout<<array[i]<<" ";
}
cout<<endl;
}
void swap(vector<int> &array,int a,int b){
int temp = array[a];
array[a] =... | ALGO | 0.999808 | 4.767241 |
3e68d368-b22f-489f-bfb8-03bd487595d9 | Sermelyan/Texnopark | algorithms/graph/ArcGraph.cpp | //
// Created by ser on 15.12.2019.
//
#include <cassert>
#include <vector>
#include "ArcGraph.hpp"
ArcGraph::ArcGraph(unsigned int count) : arcs(count * 2), count(count) {}
ArcGraph::ArcGraph(const IGraph &graph) : ArcGraph(graph.VerticesCount()) {
for (int i = 0; i < graph.VerticesCount(); i++)
for (c... | ALGO | 0.990444 | 5.7437 |
16f54610-4aa6-4cb3-9242-be77566a46d6 | happylun/StyleTransfer | 3rdparty/libigl/include/igl/intersect.cpp | template <class M>
IGL_INLINE void igl::intersect(const M & A, const M & B, M & C)
{
// Stupid O(size(A) * size(B)) to do it
// Alec: This should be implemented by using unique and sort like `setdiff`
M dyn_C(A.size() > B.size() ? A.size() : B.size(),1);
// count of intersects
int c = 0;
// Loop over A
fo... | ALGO | 0.999554 | 5.46318 |
fa8c26c9-9467-4328-9b8c-6518a73facd4 | RMGDFT/rmgdft | ON/Common/diag_eig_matrix.cpp | /************************** SVN Revision Information **************************
** $Id$ **
******************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <float.h>
#include <assert.h>
#include "blacs.h"
#include "main.h"
#include "prototypes_on.h... | ALGO | 0.999596 | 3.918628 |
5075eb47-a06d-4a08-b354-2f937f511cb8 | tirthankar95/Codes | LeetCode/MinimumMovesToEqualArray.cpp | typedef long long ll;
class Solution {
public:
int minMoves2(vector<int>& nums) {
//MEAN doesn't work.
/*int n=nums.size();
ll sum=0;
for(int i=0;i<n;i++)sum=sum+(ll)nums[i];
int avg0=(int)(sum/n);int avg1=ceil((double)sum/(double)n);
cout<<avg0<<" "<<avg1<<endl;
... | ALGO | 0.999939 | 5.764513 |
935ba08b-03d7-4244-a25f-0215c178b9ae | Ctapchuk/android_system_core | fs_mgr/libsnapshot/snapuserd_server.cpp | #include <arpa/inet.h>
#include <cutils/sockets.h>
#include <errno.h>
#include <netinet/in.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <unistd.h>
#include <android-base/logging.h>
#include "snapuserd.h"
#include "snapuserd_server.h"
namespace ... | WEB | 0.883577 | 7.352231 |
a392aa18-9a93-4044-8338-31c43e2abe8c | ishandutta2007/codeforces | temotoloraia/normal/339/C.cpp | #include <bits/stdc++.h>
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define LL long long int
#define LEFT(a) ((a)<<1)
#define RIGHT(a) (LEFT(a) + 1)
#define MID(a,b) ((a+b)>>1)
#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
using namespace std;
int n;
vector<int> v... | ALGO | 0.999992 | 3.240047 |
8340365e-6c1f-4147-9682-44a6023ea896 | kamilszymczak1/my_solutions | poi/XXVIII/licznik_dlugu.cpp | #include <iostream>
#include <set>
using namespace std;
const int MAX_N = 100007, zero = 0, nine = 1;
const int num[2] = {0, 9};
struct Interval {
int a, b;
Interval(int _a, int _b) : a(_a), b(_b) {}
};
struct Comp {bool operator() (Interval x, Interval y) const {return x.a < y.a;}};
int number[2][MAX_N], ... | ALGO | 0.999836 | 3.315385 |
d29892e1-a360-459b-8c1c-2121e336a603 | Sharmi999/Practice | e.cpp | //multiplication table of a given integer
#include<iostream>
using namespace std;
int main()
{
int n;
cout<<"Enter the number to get its multiplication table";
cin>>n;
for(int i=1;i<=10;i++)
{
cout<<n<<"*"<<i<<"="<<n*i<<endl;
}
return 0;
} | ALGO | 0.992148 | 3.237083 |
9c46d049-1878-4f73-ba4f-de903f019d12 | hello-aaditya/leetcode-solutions | 1298-reverse-substrings-between-each-pair-of-parentheses/1298-reverse-substrings-between-each-pair-of-parentheses.cpp | class Solution {
public:
string reverseParentheses(string s) {
string result = "";
stack<int> lastSkipLength;
for(int i=0; i<s.length(); i++)
{
if(s[i] == '(')
{
lastSkipLength.push(result.length());
}
else if(s[i] >= 'a... | ALGO | 0.999933 | 5.709231 |
62b73797-3215-458c-83ef-40955e611314 | ibndias/riscv-llvm | libcxx/test/std/containers/associative/set/contains.pass.cpp | // UNSUPPORTED: c++03, c++11, c++14, c++17
#include <cassert>
#include <set>
// <set>
// bool contains(const key_type& x) const;
template <typename T, typename V, typename B, typename... Vals>
void test(B bad, Vals... args) {
T set;
V vals[] = {args...};
for (auto& v : vals) set.insert(v);
for (aut... | TEST | 0.90882 | 6.687612 |
09c055e0-9572-46d7-aec5-b3a64e38dedc | RAHULRAJSONU/algorithms | Graphs/FloydWarshall.cpp | /**************************************************************************************
Floyd-Warshall algorithm finding shortest distance between all
pairs of vertices in graph. Works in O(N^3)
Based on problem 95 from informatics.mccme.ru
http://informatics.mccme.ru/mod/statements/view.php?id=218#1
... | ALGO | 0.999971 | 4.481357 |
44e75449-dbed-4290-900b-7b09446801ec | Zhlee0311/compiler_lab | lab2_3/src/main.cpp | #include "nfa.hpp"
#include "dfa.hpp"
#include "mdfa.hpp"
#include "share.hpp"
#include "state_nfa.hpp"
#include "state_dfa.hpp"
#include "state_mdfa.hpp"
std::unordered_map<char, int> Share::precedence = {
{'*', 3}, // 闭包
{'@', 2}, // 连接
{'|', 1}, // 或
{'(', 0},
{')', -1}};
std::unordered_set<cha... | ALGO | 0.990121 | 4.636477 |
b56d1943-4a9f-4c7d-9eb2-35abb19752cc | soniamayumi12/Trabajo-Mayumi | ejercios libro 13/lib5.7.cpp | #include <cstdlib>
#include <iostream>
#define pi 3.2141592
using namespace std;
int main()
{
float radio, area, volumen;
do
{
cout << "valor del radio positivo " << endl;
cin >> radio;
} while (radio <= 0);
// fin entrada de datos
area = 4 * pi * radio * radio;
volumen = 4.0 / 3 * pi * radio * radio * radio;
cout <... | ALGO | 0.98313 | 3.181021 |
f2f3b5be-1f65-4607-a31f-dcaeee2d116e | dankex/compv | gesture/grt/GRT/Util/Cholesky.cpp | #include "Cholesky.h"
namespace GRT{
Cholesky::Cholesky(){
debugLog.setProceedingText("[DEBUG LUdcmp]");
errorLog.setProceedingText("[ERROR LUdcmp]");
warningLog.setProceedingText("[WARNING LUdcmp]");
success = false;
N = 0;
}
Cholesky::Cholesky(Matrix<double> &a) : N(a.getNumRows()), el(a) {
... | ALGO | 0.999874 | 5.074009 |
f59bad47-717a-4ccb-b138-05377c95684c | kpratyush12345/Striver-SDE-Sheet-Challenge | Day 11/61_Nth_Root_Of_M.cpp | // Binary Search Approach - TC: O(N x log(M x 10^d)) SC: O(1)
// ------------------------------------------------------------
// In order to find the Nth root of any given integer we are gonna use Binary Search.
// Step 1: Take low and high. Low will be equal to 1 and high will be M. We will take the mid of low and h... | ALGO | 0.999802 | 6.054098 |
969b0f6f-56bb-4aae-a5b7-95ff2199dd3a | Sachindebug/LeetCode-Problems | 2463-minimum-recolors-to-get-k-consecutive-black-blocks/2463-minimum-recolors-to-get-k-consecutive-black-blocks.cpp | class Solution {
public:
int minimumRecolors(string blocks, int k) {
int count = 0;
int mn = INT_MAX;
for(int i = 0;i<k;i++){
if(blocks[i]=='W') count++;
}
mn = min(mn,count);
for(int i = k;i<blocks.size();i++){
count+=blocks[i]=='W';
... | ALGO | 0.999915 | 5.468001 |
6922ff0a-804c-42e5-87bc-7f3aeec84568 | haadi777/personalFinanceApp | 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 |
672c1fde-a0ad-4e4f-8c5b-e844f4e4d926 | NimishSinghChouhan/LeetCode | 008. String to Integer (atoi).cpp | class Solution {
public:
int myAtoi(string str) {
if (str.size() == 0) return 0;
int cur = 0;
while (cur < str.size() && str[cur] == ' ') cur++;
if (cur == str.size() || (!isdigit(str[cur]) && str[cur] != '+' && str[cur] != '-')) return 0;
int end = cur + 1;
while (isdigit(str[end])) end++;
string s = st... | ALGO | 0.999372 | 5.093919 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.