uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
4e2e3d06-84ca-4436-8b50-da0e7364b0e9 | rolandVi/Competitive-programming-database | LeetCode/Daily/Count_Days_Without_Meetings.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
class Solution {
public:
int countDays(int days, vector<vector<int>>& meetings) {
sort(meetings.begin(), meetings.end());
int end = 0;
for (auto const& m : meetings) {
int s = m[0];
int f = m[1];
... | ALGO | 0.999976 | 5.366361 |
a230c538-9ab4-4626-a6b7-e02f939004d5 | CUB3D/Advent-of-Code | 2015/Day-5/Day-5/Day-5.cpp | // Day-5.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <string>
#include <iostream>
#include <fstream>
#include <vector>
bool hasDissalowed(std::string str)
{
if (str.find("ab") != std::string::npos || str.find("cd") != std::string::npos || str.find("pq") != std::string::... | ALGO | 0.992666 | 5.277283 |
86c3371e-33f0-437c-a7ac-92b0645bd909 | syanguo/skia | docs/examples/SkPath_arcto_conic_parametric2.cpp | REG_FIDDLE(SkPath_arcto_conic_parametric2, 512, 512, false, 0) {
/** Add a weighted quadratic bezier from the last point, approaching control point
(x1,y1), and ending at (x2,y2). If no moveTo() call has been made for
this contour, the first point is automatically set to (0,0).
If the starting point is (x0,... | ALGO | 0.998825 | 6.511607 |
29016f1f-ffb1-4bfd-aaf3-2f5fdae13774 | SempaiTakoo/olympiad-programming | 0_basic_tasks/r2.cpp | #include <iostream>
#include <string>
#include <vector>
using namespace std;
vector<int> computeLPS(const string& pattern) {
int m = pattern.length();
vector<int> lps(m, 0);
int len = 0;
int i = 1;
while (i < m) {
if (pattern[i] == pattern[len]) {
len++;
lps[i] = l... | ALGO | 0.999939 | 6.064052 |
0b9999ff-2d2c-40e3-9622-210056876ee3 | ErdongXiao/pybullet_legged_gym | mpc_controller/third_party/eigen3/include/unsupported/doc/examples/MatrixSinh.cpp | #include <unsupported/Eigen/MatrixFunctions>
#include <iostream>
using namespace Eigen;
int main()
{
MatrixXf A = MatrixXf::Random(3,3);
std::cout << "A = \n" << A << "\n\n";
MatrixXf sinhA = A.sinh();
std::cout << "sinh(A) = \n" << sinhA << "\n\n";
MatrixXf coshA = A.cosh();
std::cout << "cosh(A) = \n"... | ALGO | 0.987857 | 5.890235 |
fccda9e4-dac6-442a-98c3-9eaab4104936 | andyli029/mysql-server-mysql-8.0.30 | storage/ndb/src/kernel/blocks/dbtux/DbtuxBuild.cpp | #include "Dbtux.hpp"
#define JAM_FILE_ID 373
struct mt_BuildIndxCtx
{
Uint32 indexId;
Uint32 tableId;
Uint32 fragId;
Dbtup* tup_ptr;
Dbtux::TuxCtx * tux_ctx_ptr;
NdbMutex * alloc_mutex_ptr;
};
Uint32
Dbtux_mt_buildIndexFragment_wrapper_C(void * obj)
{
return Dbtux::mt_buildIndexFragment_wrapper(obj);
}... | ALGO | 0.907609 | 6.383009 |
5ba86ada-00bd-4cad-a92b-8304e21fbe2d | SahilDantani/cp | binary_search/lower_upper_bound.cpp | #include<bits/stdc++.h>
using namespace std;
int lower_bound(vector<int>&v,int element){
int lo=0,hi=v.size()-1;
int mid;
while(hi-lo>1){
int mid = (hi+lo)/2;
if(v[mid]<element){
lo = mid+1;
}else{
hi = mid;
}
}
if(v[lo] == element){
r... | ALGO | 0.999967 | 5.331519 |
f07dacb0-02c3-4178-a731-9b068e6cb58a | raghuvanshraj/Competitive-Programming-Archive | Coding Ninjas/Practice/hasan_trip.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long double ld;
struct City {
int x;
int y;
int f;
};
ld operator -(City a, City b) {
ld diffX = (ld)abs(a.x - b.x);
ld diffY = (ld)abs(a.y - b.y);
return sqrt(abs(pow(diffX, 2) + pow(diffY, 2)));
}
ld maxHappiness(City *cities, int n) {
ld *happiness ... | ALGO | 0.999007 | 3.698184 |
d2c98678-5cf2-4d34-8f93-5a03e4e0dd48 | Dras227/solve-dsa-problems | HASHING - mike and hashtrick.cpp | #include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl "\n"
#define rep(i,n) for (i = 0; i < n; ++i)
#define repr(i,k,n) for (i = k; i <= n; ++i)
#define IOS ios_base::sync_with_stdio(false)
int convertString(string data){return atoi(data.c_str());}
string convertString(int data){stringstrea... | ALGO | 0.999939 | 3.673371 |
9de77f1b-d2ed-43fa-bf5c-7ab546b504d1 | MgwenaHulela/EEE4113-Monitoring-African-Penguin-During-Molting | Electronics and Controls Subsystem/Libraries/SD/src/SD.cpp | /*
Implementation Notes
In order to handle multi-directory path traversal, functionality that
requires this ability is implemented as callback functions.
Individual methods call the `walkPath` function which performs the actual
directory traversal (swapping between two different directory/file handles
al... | TOOL | 0.951111 | 3.165682 |
473f2000-938d-465b-97f6-2959cb30b49f | kensuke-harada/graspPlugin | PRM/RRT.cpp | // -*- mode: c++; indent-tabs-mode: nil; c-basic-offset: 4; tab-width: 4; -*-
#include "Roadmap.h"
#include "RoadmapNode.h"
#include "ConfigurationSpace.h"
#include "RRT.h"
using namespace PathEngine;
static bool debug=false;
//static bool debug=true;
#ifdef ENABLE_RRT_MULTITHREAD
#if !(EIGEN_VERSION_AT_LEAST(3,2,0)... | ALGO | 0.999819 | 3.662412 |
f60ef87d-d48c-45e1-925d-3921a80078cc | archana-9430/DSA-Practice | Level - 2/Binary Tree/Is Height Balanced.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.999813 | 6.398064 |
6ad52a15-871f-4db1-b02c-a1f5d72d1b30 | mearth99/Problem | Prev_solve_problem/백준다시풀기/BFS/벽부수고이동하기3.cpp | #include <bits/stdc++.h>
using namespace std;
#define MAX 1001
int arr[MAX][MAX] = {0};
bool visited[MAX][MAX][11] = {0};
int N,M,K;
int dy[4] = {1,-1,0,0};
int dx[4] = {0,0,1,-1};
struct moves{
int y,x,k,sun,cnt;
};
void solution(){
int minv = INT32_MAX;
cin >> N >> M >> K;
for(int i=0;i<N;i++){
string temp;
... | ALGO | 0.999851 | 4.046258 |
b2c01179-45af-4cda-acc7-ecf48bd5aae3 | bishopfunc/AtCoder | typical90/lv4/72.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MAX_N 16
#define INF (int)1e8
// DFSでバックトラック
char C[MAX_N][MAX_N];
const vector<int> dx = {0, 0, -1, 1};
const vector<int> dy = {1, -1, 0, 0};
bool finished[MAX_N][MAX_N];
int H, W;
bool check_idx(int x, int y) {
if (0 <= x && x <= H - 1 &... | ALGO | 0.999938 | 4.845295 |
4cc80577-7e69-440a-80e3-a9ea27587678 | g2022614/Kakomon | 3年/アルゴリズム論(2017)/7-2/7-2/Source.cpp | #include <stdio.h>
#define swap(type,x,y) {type t=x; x=y; y=t;}
#define NUM 5
/* count0:r, count1: */
int count0 = 0, count1 = 0; /* O[oϐƂď@*/
void selsort(int a[], int n); /* vg^Cv@*/
int main(void){
int i,x[NUM];
printf("Input integer number %d times \n", NUM);
for (i = 0; i<NUM; i++) {
printf("x[%d]:", i);
... | ALGO | 0.999964 | 3.817439 |
ab95c0ff-63d0-4025-b34a-b368a73490c8 | Antgo99/LeetCode_study | KamaCoder/26.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
while(n--){
string ss;
cin>>ss;
int minOpt = 0;//最小操作数
/*思路:1.统计每个字母出现的频率
2.每次删除两个相同的字母,新增一个未出现的字母;如果字母全部都出现就将所有新增的字母转化为一个特定的字母,
3.转化的这个特定的字母每删除两个就会新增一个,实际上每次操作只删除一个
... | ALGO | 0.999962 | 3.620825 |
4923974a-e593-49f1-a643-5db5130d7732 | steveLauwh/Algorithms | Tree/LeetCode-Tree/Path Sum/PathSum.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:
bool hasPathSum(TreeNode* root, int sum) {
if (!root) {
return false;
... | ALGO | 0.999971 | 6.197875 |
b7244c95-e03c-4d36-ad9f-b3afa94027af | AIxiaodi4Ever/leetcode_in_cpp | 01x数组/0011_maxArea_TwoPointer.cpp | class Solution {
public:
int maxArea(vector<int>& height) {
int left = 0, right = height.size() - 1;
int ret = 0;
while (left != right) {
ret = max(ret, min(height[left], height[right]) * (right - left));
if (height[left] <= height[right]) ++left;
else --r... | ALGO | 0.999936 | 6.629981 |
240ee535-b0b0-47c4-bfe6-87ff37f02598 | KailasMahavarkar/interview-prep | Google Interview Questions/DuplicatesBasedONProperties.cpp | #include <algorithm>
#include <climits>
#include <iostream>
#include <iterator>
#include <string>
#include <unordered_map>
#include <vector>
#pragma GCC optimize("O3,unroll-loops")
using namespace std;
class DSU {
public:
vector<int> parent;
vector<int> rank;
void unionSet(int x, int y) {
int p... | ALGO | 0.997363 | 6.448784 |
8e23bae0-4e1e-44e9-b692-4bdbebd1b15b | ChyhrynetsYevhenii/TestLinux | calculator.cpp | #include "calculator.h"
int Calculator::Add (double a, double b)
{
<<<<<<< HEAD
return a + b;
=======
return a + b + 0.5;
>>>>>>> 5f6a75a (fix truncation error)
}
int Calculator::Sub (double a, double b)
{
return Add (a, -b);
}
int Calculator::Mul (double a, double b)
{
return a * b + 0.5;
}
int Calcul... | TOOL | 0.949616 | 4.581917 |
fe36ca39-cba6-4e22-b326-87aae060f68b | AkanshaMundel/crackyourinternship | 94-binary-tree-inorder-traversal/94-binary-tree-inorder-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.999985 | 6.5768 |
067e6fa3-4d39-4580-aedc-640ad585fba8 | Sagarbha1991/com.example.trilinos | packages/ifpack/example/Ifpack_ex_Factory.cpp | #include "Ifpack_ConfigDefs.h"
#ifdef HAVE_MPI
#include "Epetra_MpiComm.h"
#else
#include "Epetra_SerialComm.h"
#endif
#include "Epetra_CrsMatrix.h"
#include "Epetra_MultiVector.h"
#include "Epetra_LinearProblem.h"
#include "Galeri_Maps.h"
#include "Galeri_CrsMatrices.h"
#include "Teuchos_ParameterList.hpp"
#include "... | ALGO | 0.997365 | 4.670782 |
a5584e03-31bf-4880-8699-b3962c889831 | khaledsliti/CompetitiveProgramming | Codeforces/CF1551/C.cpp | // Guess Who's Back
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define endl '\n'
#define D(x) cerr << #x << " = " << (x) << '\n'
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
typedef long long ll;
const int N ... | ALGO | 0.999914 | 5.238551 |
50fa5d52-0bdc-4de1-8f5b-7b8ae9d441d3 | thegamer1907/Code_Analysis | DP/1731.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
string s;
vector< pair<int,int> >ab,ba;
cin>>s;
int sz=s.size()-1;
for(int i=0;i<sz;i++)
{
if(s[i]=='A'&&s[i+1]=='B')
ab.push_back(make_pair(i,i+1));
if(s[i]=='B'&&s[i+1]=='A')
ba.push_... | ALGO | 0.99999 | 3.647761 |
24060559-7a68-4bd1-b8e7-961d679fe6d7 | invoxico-ashish/CPP_test | cmath.cpp | #include <iostream>
#include <cmath>
using namespace std;
int main()
{
double result = floor(1.2);
cout << result;
double resultTwo = pow(2, 3);
cout << resultTwo;
return 0;
} | ALGO | 0.986263 | 3.050712 |
6db06cd2-d6c1-47f7-8fb5-3d556be98f63 | Priyank2912/6Companies30Days | Intuit/03. Find the missing number in the string.cpp | int missingNumber(const string &s)
{
/* VERY IMP QUES!!!!*/
int len = s.size();
int max_window = min(6, len / 2);
for (int w = 1; w <= max_window; ++w)
{
int last_num = 0;
int num = 0;
bool malyu = true;
bool gayu = false;
int ans = -1;
for (int i =... | ALGO | 0.99603 | 4.251152 |
c992e40a-aa11-409e-b671-793e74558f70 | Amandaa-S/ayudantia-algoco | Ayudantia_BusquedaExhaustiva/vendedor_viajero/tsp_next_permutation.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <climits>
int calcular_costo_ruta(const std::vector<int> &ruta,
const std::vector<std::vector<int>> &distancias)
{
int costo = 0;
for (size_t i = 0; i < ruta.size() - 1; ++i)
{
costo += distancias[ruta[i]][r... | ALGO | 0.999959 | 5.36054 |
a22f7af0-22da-4592-bfed-80e880ce7995 | rgkavodkar/gdm_p1_degree_count | Problem_1_CPP_implementation/MapReduce/MainTest.cpp | /*
* MainTest.cpp
*
* Created on: 18-Sep-2014
* Author: rg_kavodkar
*/
#include <iostream>
#include <fstream>
#include <cmath>
#include <string>
#include <cstdlib>
#include "Worker.h"
#include "Utilities.h"
using namespace mapreduce;
using namespace std;
int main(int argc, char* argv[]) {
long threshold ... | DATA | 0.929919 | 4.067741 |
4803d334-23f7-4af1-80c8-77def120d65b | John-Holik/LeetCode | Challenges/Easy/RichestCustomerWealth.cpp | /* You are given an m x n integer grid accounts where accounts[i][j] is the amount of
money the ith customer has in the jth bank. Return the wealth that the richest customer has.
My Solution: */
#include <vector>
using namespace std;
class Solution{
public:
int maximumWealth(vector<vector<int>> &accounts){
... | ALGO | 0.999027 | 5.735907 |
48a9ea4b-f5a8-45dd-9cf8-3c046de81b79 | eggag32/Competitive-Programming | CSES/Range Sum Queries II.cpp | #pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) debug(x) debug(y);
#define repn(i, a, b) for(int i... | ALGO | 0.999732 | 4.537865 |
39cee2cf-f03d-4c3b-ba58-82760142c295 | fishy15/competitive_programming | online/cses/sort_search/sliding_cost.cpp | #include <iostream>
#include <iomanip>
#include <fstream>
#include <vector>
#include <array>
#include <algorithm>
#include <utility>
#include <map>
#include <queue>
#include <set>
#include <cmath>
#define ll long long
#define eps 1e-8
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3f
// ... | ALGO | 0.999977 | 3.193005 |
bccd51a9-2d6f-43da-9bcc-65c99d38a2f8 | NanningR/AoC | 2024/day1/part1/part1.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int n = 1000;
int answer = 0;
vector<int> a;
vector<int> b;
while (n--)
{
int q, w;
cin >> q >> w;
a.push_back... | ALGO | 0.999862 | 3.796211 |
7654457a-be7a-4d87-a1df-8cd2936abba2 | bohdan-kov/KPI.Base-Programing.1-Sem.Lab-6 | Task #2/ConsoleApplication1/ConsoleApplication1.cpp | #include <iostream>
using namespace std;
int base[10];
void input_array (){
cout << "Input numbers array: " << endl;
for (int i = 0; i < 10; i++) {
cout << "Input number #" << i + 1 << " ";
cin >> base[i];
}
}
int main()
{
input_array();
int max_elem[2]; //Масив для зберігання ма... | ALGO | 0.999432 | 3.618669 |
7cb9500f-5541-45fb-bf0a-156ae7be3899 | maitesin/blog | future_and_promise_2016_09_11/thread/two_threads.cpp | #include <iostream>
#include <functional>
#include <thread>
void accum_up_to(int value, int & result) {
int accum = 0;
for (int i = 0; i <= value; ++i) {
accum += i;
}
result = accum;
}
int main()
{
int result1, result2;
std::thread t1(accum_up_to, 50, std::ref(result1));
std::thread t2(accum_up_to,... | ALGO | 0.998456 | 6.508949 |
0776323a-1e56-43b2-b1a5-4535690b198a | ishandutta2007/codeforces | potassium/normal/1202/B.cpp | #pragma GCC optimize ("Ofast")
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/tree_policy.hpp>
#define INF 2147483647
#define LLINF LLONG_MAX
#define PI ... | ALGO | 0.999833 | 3.753486 |
f19a52fd-f14f-495e-a33e-a2280a534cf6 | siddharth-kumar182002/DSA | D_Unnatural_Language_Processing.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(__null);
int t;
cin>>t;
while(t--){
long long n;
cin>>n;
string s;
cin>>s;
string ans="";
ans=ans+s[0];
for (int i = 1; i < n; i++)
{
ans+=s[i];
if(s[i]=='a' || s[i]=='e'){
if(i+2<n && (s... | ALGO | 0.999626 | 3.205423 |
0b00c830-216b-4cfe-aaa1-8c8c76c270fd | c-o-d-e-y-o-d-a/vollit | vollit_wallet/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.998364 | 6.76775 |
6dd2ffa9-d9f1-4670-a63e-e649830fe8d1 | syoh0708/algorithm | baekjoon/silver/1/6118(숨바꼭질)/6118.cpp | #include <bits/stdc++.h>
using namespace std;
vector<int> e[20005];
int n, m, max_dist, cnt, ans, dist[20005];
bool vis[20005];
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cin >> n >> m;
for (int i = 0; i < m; i++) {
int u, v; cin >> u >> v;
e[u].push_back(v);
e[v... | ALGO | 0.999938 | 4.38287 |
f06c524e-4230-469e-9275-b46aafaf681b | prakashpandey16/coding | c++/vector/VectorATAndSort.cpp | #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
vector<int>v;
v.push_back(4);
v.push_back(5);
v.push_back(56);
v.push_back(45);
v.push_back(23);
v.push_back(454);
// cout<<v.at(2);// at basically use for access of of variable.
// cout<<endl<... | ALGO | 0.998649 | 3.756323 |
83ed892f-aac9-4e2f-9840-bec73ff46cfd | kronberh/FRepo | OneDrive/Рабочий стол/ITStep/C++/Lesson19_Git(Snake)/Source.cpp | #include <iostream>
#include <Windows.h>
#include <conio.h>
#include <windows.graphics.h>
#include "Cursor.h"
#include "GameWindow.h"
#include "Food.h"
using namespace std;
HANDLE output = GetStdHandle(STD_OUTPUT_HANDLE);
void MainSnake(COORD snake[], int size,char symbol, int width, int height, COORD start );
vo... | TOOL | 0.957515 | 4.852143 |
4a8aafda-8bfa-43ee-96e7-5166447f46e7 | ridionDEV/codingTest | codingtest/Algorithm/1245.cpp | #include <iostream>
#include <string>
#include <queue>
using namespace std;
int dx[8] = {-1,-1,-1,0,0,1,1,1};
int dy[8] = {1,0,-1,1,-1,1,0,-1};
int main(void){
struct Pos
{
int x=0;
int y=0;
};
int n,m;
int board[100][70];
bool visit[100][70] = {false};
int count = 0;
... | ALGO | 0.999898 | 3.684896 |
2d53ebc2-4972-4a26-9d47-4055cdd227a0 | MDLTokenDev/MDL | src/rpcserver.cpp | #include "rpcserver.h"
#include "base58.h"
#include "init.h"
#include "main.h"
#include "random.h"
#include "sync.h"
#include "ui_interface.h"
#include "util.h"
#include "utilstrencodings.h"
#include <boost/bind.hpp>
#include <boost/filesystem.hpp>
#include <boost/foreach.hpp>
#include <boost/iostreams/concepts.hpp>
... | WEB | 0.919493 | 3.080195 |
dd16567d-32c8-4ef3-8a93-9c7abda0af69 | saidarsannbr/Cpp-Code-Repo-for-Reference | lec_19_function_overloading.cpp | /* Overloading
--------------------
Using something for multiple scenarios or actions.
Polymorphism - Something that has different forms,
*/
#include<iostream>
using namespace std;
int sum(int a, int b){
cout<<" Using funcion having 2 arguments "<<endl;
return a+b;
}
int sum(int a, int b , int c){
cout<... | TOOL | 0.900001 | 4.245114 |
a9356bf0-b2a9-40a7-8911-534429b0f968 | LiuSC98/acg-LiuSC98 | task07/main.cpp | #include <iostream>
#include <filesystem>
#include <limits>
#include <tuple>
#include <random>
#include <optional>
#include <cmath>
//
#define STB_IMAGE_WRITE_IMPLEMENTATION
#include "stb_image_write.h"
#define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h"
#include "Eigen/Core"
#include "Eigen/Geometry"
#ifndef M_PI... | ALGO | 0.986712 | 6.234321 |
c21f22f0-903b-4686-a791-cc4800b8403c | Cabbage-Cat/Algorithm-competition | U4/E4.5.cpp | #include <bits/stdc++.h>
using namespace std;
int r,c,n;
struct Command{
char s[5];
int r1,c1,r2,c2;
int A,index[12];
}Cmd[10000];
int exeCmd(int& r0,int& c0){
for (int i=0;i<n;i++){
if (Cmd[i].s[0] == 'E'){
if (Cmd[i].r1 == r0 && Cmd[i].c1 == c0){
r0 = Cmd[i].r2;c0... | ALGO | 0.999753 | 3.752471 |
beb9c98a-32e4-44b9-913b-95fc2ab61347 | DropB1t/IntervalJoinBenchmarks | comparison_wf/src/test_comparison.cpp | #include<string>
#include<vector>
#include<iostream>
#include<chrono>
#include<windflow.hpp>
#include"../includes/element.hpp"
#include"../includes/common.hpp"
using namespace std;
using namespace chrono;
using namespace wf;
#define PROBE_LEN 2000000
#define BASE_LEN 1000000
atomic<long> sent_tuples; // total number... | ALGO | 0.983828 | 4.758506 |
867bd319-0f32-4106-a6ad-11ff7f1201bf | Alan-Yao-666/cmake_planning_demo | third_party/eigen-3.4.0/unsupported/test/NumericalDiff.cpp | #include <stdio.h>
#include "main.h"
#include <unsupported/Eigen/NumericalDiff>
// Generic functor
template<typename _Scalar, int NX=Dynamic, int NY=Dynamic>
struct Functor
{
typedef _Scalar Scalar;
enum {
InputsAtCompileTime = NX,
ValuesAtCompileTime = NY
};
typedef Matrix<Scalar,InputsAtCompileT... | TEST | 0.925786 | 6.171012 |
f923e748-9713-43f0-b2b3-f32788be5a02 | jihadsamarji/Ball-Plate-Control | Software/Arduino/Touchscreen Assets/WithStepper/RunningMedian.cpp | //
// FILE: RunningMedian.cpp
// AUTHOR: Rob.Tillaart at gmail.com
// VERSION: 0.1.14
// PURPOSE: RunningMedian library for Arduino
//
// HISTORY:
// 0.1.00 - 2011-02-16 initial version
// 0.1.01 - 2011-02-22 added remarks from CodingBadly
// 0.1.02 - 2012-03-15 added
// 0.1.03 - 2013-09-30 added _sorted flag, mino... | ALGO | 0.999581 | 6.190411 |
7cab2623-8057-4402-be55-f7f4372c4e32 | UpCoder/Leetcode | 4SumII.cpp | //
// Created by Liang on 2019-09-02.
//
#include <vector>
#include <iostream>
#include <map>
#include <unordered_map>
using namespace std;
class Solution {
public:
void sum2Solution(vector<int>& C, vector<int>& D, unordered_map<int, int>& record){
for(auto c: C){
for(auto d: D){
... | ALGO | 0.999727 | 5.798819 |
0cd5ad82-ec19-4334-82a4-5752725392fe | payalsinghz/Functions | functions/productOf2No.cpp | #include<iostream>
using namespace std;
int prod(int a, int b){
return a*b;
}
int main(){
cout<<prod(2,4);
return 0;
} | ALGO | 0.997809 | 3.91559 |
7fe94dd9-eea0-4c59-bfe2-b94ded6dfd25 | rishabh1073/Data-Structure | Sorting/Practical 8.cpp | #include<iostream>
using namespace std;
void insertionsort(int a[],int n)
{
int i,j,k,temp,m;
for(i=0;i<n;i++)
{
m=a[i];
j=i;
while(a[j-1]>m && j>0)
{
a[j]=a[j-1];
j--;
}
a[j]=m;
}
}
int main()
{
int i,a[20],n;
cout<<"Enter... | ALGO | 0.999947 | 3.725759 |
69f8495d-0fe4-4c54-91e3-8eae0a9512e8 | devdrx/cp-submissions | C_Alice_s_Adventures_in_Cutting_Cake.cpp | #include "bits/stdc++.h"
#define int long long
#define uint unsigned long long
#define vi vector<int>
#define vvi vector<vi>
#define vb vector<bool>
#define vvb vector<vb>
#define fr(i, n) for (int i = 0; i < (n); i++)
#define rep(i, a, n) for (int i = (a); i <= (n); i++)
#define nl cout << "\n"
#define dbg(var) cerr <... | ALGO | 0.999949 | 4.384576 |
e0d6358a-0360-4a26-96b8-f4d50dbf2029 | Anik-Modak/CompetitiveProgramming | Codeforces/Devu, the Singer and Churu, the Joker.cf.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n,m,ans=0;
cin>>n>>m;
int a,s=0,i;
for(i=0;i<n;i++){
cin>>a;
if(i<n-1){
s+=a+10;
ans+=2;
}
else s+=a;
}
if(s>m) cout<<-1<<endl;
else{
ans+=(m-s)/5;
cout<<an... | ALGO | 0.999853 | 3.456806 |
60618c42-ceba-4737-9d1e-57e1ea1f54c1 | MingYanWoo/Leetcode | 面试题06. 从尾到头打印链表.cpp | // 面试题06. 从尾到头打印链表
// 输入一个链表的头节点,从尾到头反过来返回每个节点的值(用数组返回)。
// 示例 1:
// 输入:head = [1,3,2]
// 输出:[2,3,1]
// 限制:
// 0 <= 链表长度 <= 10000
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
... | ALGO | 0.999694 | 5.402526 |
fe6bb329-a286-4fe1-9452-419b3be4e110 | BabaSambar/CSES-Questions | Number Spiral.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
ll t; cin >> t;
while(t--)
{
ll r, c; cin >> r >> c;
ll p = max(r, c);
p = p*p - p + 1;
if(r < c)
{
ll d = c - r;
if(c % 2 == 0) p-=d;
else p+=d;
... | ALGO | 0.999759 | 4.420444 |
8982fc16-381d-4b15-bb54-c657a7ac1a5d | saltsmall/CodingPractice | Programmers/pTile.cpp | #include <string>
#include <vector>
using namespace std;
/*
[변의 길이]
X0 = 1
X1 = X0
X2 = X1 + X0
X3 = X2 + X1
X4 = X3 + X2
...
Xn = Xn-1 + Xn-2
[둘레]
L1 = 1* X1 : 4
L2 = L1 + X1*2 :6
L3 = L2 + X2*2 :10
L4 = L3 + X3*2 :16
...
Ln = Ln-1 + Xn-1*2
*/
long l... | ALGO | 0.999944 | 4.057398 |
570f3d83-9e97-4e6c-abd7-3e6b8687da05 | nishan2001/NMlab1 | newton_raphson.cpp | #include<iostream>
#include<math.h>
using namespace std;
double Fun(double x){
return cos(x)+ 5*x - 6;
}
double derivative(double x){
return 5 - sin(x);
}
void Newton(double a, double error){
double x = a;
int iteration = 0;
while (fabs(Fun(x)) > error) {
double fa = Fun(x);
double... | ALGO | 0.999974 | 4.749159 |
eff82404-6a77-495d-bc95-659dab4f9baa | niraj9504/LeetCode-solutions | Minimum times A has to be repeated such that B is a substring of it - GFG/minimum-times-a-has-to-be-repeated-such-that-b-is-a-substring-of-it.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
//User function Template for C++
class Solution {
public:
bool isSubString(string s,string s2){
int i=0,n=s2.size();
// while(s[i]!=s2[0])i++;
// cout<<s.substr(i)<<endl;
// return s.substr... | ALGO | 0.999864 | 5.904925 |
2e4e263a-e12a-4c14-a540-3b50b92c4249 | asherushare/DSA-with-Codehelp | 1_Fundamentals/pattern4.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int row;
int col;
cout << "Enter row number: ";
cin >> row;
cout << "Enter column number: ";
cin >> col;
for(int i = 0; i < row; i++) {
for(int j = 0; j < row - i; j++) {
cout << "*";
}
cout << endl;
}
return 0;
} | ALGO | 0.994968 | 4.829336 |
dc9f3334-f573-4f19-bcfe-609ae2037a70 | gaurav-prajapati1/learning-cpp | Swap_2.cpp | #include<iostream>
using namespace std;
int main () {
int x = 10;
int y = 20 ;
cout << "Before swapping: x = " << x << ", y = " << y << "\n";
x = x * y; // x = 30
y = x / y; // y = 6
x = x / y; //
cout << "After swapping: x = " << x << ", y = " << y << "\n";
return 0;
} | ALGO | 0.997204 | 3.260168 |
1c6c3a4a-5a67-4dce-881e-f5a6365bc26d | NelviusGrey/Nelvius-Bank-App | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998733 | 6.76775 |
32f911a4-6a4e-4d44-bb70-f733c86865d8 | gmh5225/EasyMapParser | src/EasyMapParserLib.cpp | #include "EasyMapParserLib.h"
#include <stdlib.h>
#include <stdio.h>
#include <io.h>
#include <iostream>
#include <fstream>
#include <ostream>
#include <regex>
namespace EasyMapParserLib {
MapParser::MapParser()
{
mSymbols.clear();
mImageBase = 0;
}
const std::vector<Symbol> &
MapParser::GetSymbols() const
{... | TOOL | 0.891135 | 5.240171 |
faf3b4f2-95c3-4664-8e24-8a21ce758eef | pinak22dhir/Coding-Wallah-by_pinak- | lecture 48/sliding2.cpp | #include<iostream>
#include<vector>
using namespace std;
// int longest(string str,int k){
// int s=0;
// int e=0;
// int zero_count=0;
// int max_length=0;
// for(int i=0;i<str.size();i++){
// if(str[i]==0){
// zero_count++;
// }
// while(zero_count<k){
// e++;
// }
// while(zero_count>k){
// if(st... | ALGO | 0.999237 | 5.458724 |
462299e7-3ded-4bdd-90c8-91af31b90fb0 | NUC-NCE/algorithm-codes | codes - ac/HDU/6103/10396374_AC_936ms_1668kB.cpp | #include <cstdio>
#include <iostream>
#include <cstring>
#include <string>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <vector>
#include <set>
#include <stack>
#include <map>
#include <cmath>
#include <functional>
#include<ctime>
using namespace std;
typedef long long... | ALGO | 0.99986 | 4.253561 |
dd7f738f-934d-468f-994b-1e915d41cec6 | Tejas-Santosh-Nalawade/LEETCODE-DAILY-QUESTION-SOLVING | 2640-maximum-number-of-integers-to-choose-from-a-range-i/maximum-number-of-integers-to-choose-from-a-range-i.cpp | class Solution {
public:
int maxCount(vector<int>& banned, int n, int maxSum) {
unordered_set<int> bannedSet(banned.begin(), banned.end());
int count = 0;
for (int num = 1; num <= n; num++) {
if (bannedSet.count(num)) continue;
if (maxSum - num < 0) return count;
... | ALGO | 0.999947 | 6.470208 |
e73f5fa1-7deb-4fc4-8470-dab7a2e18e69 | TeamViperOS/android_frameworks_av | media/libstagefright/codecs/amrwb/src/band_pass_6k_7k.cpp | /*
------------------------------------------------------------------------------
Filename: band_pass_6k_7k.cpp
Date: 05/08/2004
------------------------------------------------------------------------------
REVISION HISTORY
Description:
---------------------------------------------------------------------... | ALGO | 0.999867 | 5.574719 |
ffbc7029-4bdb-48a2-bbfd-d1f472fab3cb | baxkspace/algorithm-Xplosion | Programmers/조이스틱/driedfish-and-cheese/solution.cpp | #include <string>
#include <algorithm>
using namespace std;
int solution(string name) {
int answer = 0;
int n = name.length();
int turn = n-1;
for(int i=0;i<n;i++){
if(name[i]-'A'<14)
answer += name[i]-'A';
else
answer += 'Z'-name[i]+1;
int index = i+1;
... | ALGO | 0.999891 | 5.004714 |
62480e83-390d-4c77-b035-22b7773f753c | CGVanWyk/COS132 | Prac 3 - Palindrome/Palindrome.cpp | #include<iostream>
#include<string>
using namespace std;
int main()
{
string numberInput;
cout << "Enter a nonzero positive number: ";
getline(cin,numberInput);
if (numberInput == "0")
{
cout << "Error you have entered " << numberInput<<" which is an invalid number"<<endl;
}
else
{
string numberReverse;
string... | ALGO | 0.999054 | 3.735624 |
71d7a61b-d35d-40ab-92cd-7ae4dc1fa257 | Shell-Wataru/AtCoder | Codeforces/649/A.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <queue>
#include <set>
#include <iomanip>
#include <map>
#include <cmath>
#include <iterator> // std::rbegin, std::rend
#include <functional>
using namespace std;
using ll = long long;
int solve()
{
ll n, x;
scanf("%lld%lld", &n,... | ALGO | 0.998486 | 3.590101 |
9b31bdcf-bd44-4810-bdbe-78b82e39f640 | rishirajsurti/codechef | easy/cooling.cpp | #include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int main(){
int t;
cin>>t;
int i,n;
for(i=0;i<t;i++){
cin>>n;
vector<int> wpie,wlim;
int j,k;
for(j=0;j<n;j++){
cin>>k;
wpie.push_back(k);
}
for(j=0;j<n;j++){
cin>>k;
wlim.push_back(k);
}
stable_sort(wpie.begin(... | ALGO | 0.999865 | 3.402878 |
38b6e609-b661-4c40-b977-c86709a141a3 | Prakash-Jha-Dev/SPOJ | CTTC.cpp | #include <bits/stdc++.h>
using namespace std;
void solve()
{
int n,x;
cin>>n;
stack<int>s;
vector< int >child(n+1,0);
n+=n;
s.push(0);
for(int i=1;i<=n;i++)
{
cin>>x;
if(x==s.top())
{
s.pop();
}
else
{
child[s.top()]++;
s.push(x);
}
}
n/=2;
for(int i=1;i<=n;i++) cout<<i<<" -> "<<chil... | ALGO | 0.999921 | 4.186675 |
918aabcf-210c-40e2-a97f-e39be39343b3 | harman-dev1/week4 | sample2.cpp | #include<iostream>
using namespace std;
main()
{
int purchaseAmount=10;
float discount;
discount=purchaseAmount-(purchaseAmount/100)*10;
cout<<"Payable amount:"<<discount;
} | ALGO | 0.985407 | 3.09409 |
5a1b25c1-0366-4b87-bd5e-37700f4525f4 | Grizzlyess/Programming-Competicion | square.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int t,l,r,d,u;
cin>>t;
for (int i = 0; i < t; i++)
{
cin>>l>>r>>d>>u;
if(l==r==d==u)
cout<<"Yes"<<endl;
else
cout<<"No"<<endl;
}
return 0;
} | ALGO | 0.999338 | 3.39288 |
cc9da638-e550-4fa9-9058-878f2b8bf366 | vishaldhaygude01/SDESheetChallenge | Day1_Array/pascal_traingle.cpp | class Solution {
public:
vector<vector<int>> generate(int numRows) {
vector<vector<int>> ans(numRows);
for(int i=0;i<numRows;i++){
ans[i].resize(i+1);
ans[i][0] = ans[i][i] = 1;
for(int j=1;j<i;j++){
ans[i][j] = ans[i-1][j-1] + ans[i-1... | ALGO | 0.999965 | 5.649342 |
112717d6-4562-4fcb-a0bb-f20dcd8d510e | RyoSci/AtCoder | ABC/ABC189/d1.cpp | // #define _GLIBCXX_DEBUG
#include <algorithm>
// #include <atcoder/all>
// #include <atcoder/modint>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
// using namespace atco... | ALGO | 0.999972 | 5.307983 |
c0fb7236-2538-40a5-8d74-498e5f6999dd | Devetak/1.58bitLLM | src/core_utils.cpp | #include "core_utils.h"
#include <stdint.h>
#include <iostream>
#include <stdio.h>
void inner_product_bitwise_inplace(int8_t* r, int32_t a, int8_t* b) {
*r = 0;
int prod;
for(int i = 0; i < 16; ++i){
prod = (a & 3) == 0 ? 0 : ((a & 3) == 1 ? 1 : -1);
*r += b[15 - i] * prod;
a = a >... | ALGO | 0.998194 | 5.261068 |
dd0aa510-593a-4a71-be29-dd842b3f6b92 | thejenish16/DSA-WITH-CPP | ch-8 array/exam/Q-3.cpp | #include <iostream>
using namespace std;
main()
{
int row, col;
cout << "Enter Row Size : ";
cin >> row;
cout << "Enter Column Size : ";
cin >> col;
int arr[10][10], trans[10][10];
cout << endl
<< "2D Array Input" << endl
<< endl;
for (int i = 0; i < row; i++)
{
... | ALGO | 0.991468 | 4.758962 |
93b15d82-b0d0-4a6f-8c52-7a8634cf2ce1 | theoden42/code-store | codeforces/Codeforces Round 909 (Div. 3)/temp.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
vector<int> a(n);
for(int i = 0; i < n; i++){
cin >> a[i];
}
stack<pair<int,int>> st;
vector<int> res(n);
for(int i = n - 1; i >= 0; i--){
while(!st.empty() && st.top().first <= a[i]){
st.pop();
}
if(st.empty()){
res[i] =... | ALGO | 0.999937 | 3.975413 |
f9659558-7cff-4cb4-ba04-add097dd7e8d | ishandutta2007/codeforces | boook/normal/598/D.cpp | /*input
5 6 3
******
*..*.*
******
*....*
******
2 2
2 5
4 3
*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define REP(i,j,k) for(int i = j ; i < k ; ++i)
#define RREP(i,j,k) for(int i = j ; i >=k ; --i)
#define A first
#define B secon... | ALGO | 0.999892 | 3.437207 |
1210c562-9c7b-4b3c-a042-80f17b4dc329 | NasimALJr/Codeforces-Problem | Codeforces 144A Arrival of the General.cpp | #include <bits/stdc++.h>
using namespace std;
int main ()
{
int n;
cin>>n;
int a[n];
for(int i=0;i<n;i++)
{
cin>>a[i];
}
int max=a[0];
int min = 9999;
for(int i=0;i<n;i++)
{
if(a[i]>max)
{
max = a[i];
}
else if(a[i]<min)
... | ALGO | 0.99996 | 3.421272 |
de57329c-af17-4df1-b5de-b80913e1f3a5 | hpc/cce-mpi-openmpi-1.6.4 | ompi/contrib/vt/vt/extlib/otf/tools/otfprofile/comparison_clinkage.cpp | #include <fstream>
#include <iostream>
#include <map>
#include <set>
#include <vector>
#include "comparison.h"
using namespace std;
/* type for pairs in the distance map of CLINKAGE
* ('Pair' struct in datastructs.h doesnt contain a less operator that's needed for the map) */
typedef pair <uint64_t, uint64_t> StdPa... | ALGO | 0.999121 | 4.741921 |
64920bfe-8b5b-4831-b5a2-4e9710c70a60 | dodonut/Competitive-Programming | UVA-CP3/Introduction/AD HOC/chess/696_How_many_knights.cpp | #include <iostream>
#include <math.h>
#include <algorithm>
using namespace std;
int knights(int rows, int col)
{
int Min = min(rows, col);
int Max = max(rows, col);
if (Min == 1)
return Max;
if (Min == 2)
{
int r = Max % 4;
int d = Max / 4;
switch (r)
{
case 1:
return d * 4 + 2;... | ALGO | 0.999258 | 5.516497 |
4bbe4fc7-8882-40f8-bf27-edd6baf687d4 | code-grey/CPP-Programming-fork | starpattern.cpp | #include <iostream>
using namespace std;
int main(){
int a;
cout<<"Input the number\n";
cin>>a;
for(int i=0;i<a;i++){
for(int j=0;j<=i;j++){
cout<<" * ";
}
cout<<endl;
}
} | ALGO | 0.999817 | 3.727912 |
871ec3d0-0aab-4d7c-a530-65a1ad1cb11a | b-chae/AlgorithmStudy | baekjoon/자료구조/13334.cpp | #include <iostream>
#include <queue>
using namespace std;
struct node{
int x, y;
bool operator< (const node & a) const{
if(y==a.y) return x > a.x;
return y > a.y;
}
};
int N, M;
priority_queue<node> pq;
priority_queue<int> include;
int main(){
ios::sync_with_stdio(0);
cin.tie(0)... | ALGO | 0.999907 | 4.172049 |
46c8423c-f75a-4301-8497-f6c626fa3de1 | RichieZhl/folly | folly/experimental/settings/Settings.cpp | #include <folly/experimental/settings/Settings.h>
#include <map>
#include <folly/Synchronized.h>
namespace folly {
namespace settings {
namespace detail {
namespace {
using SettingsMap = std::map<std::string, SettingCoreBase*>;
Synchronized<SettingsMap>& settingsMap() {
static Indestructible<Synchronized<SettingsM... | TOOL | 0.912892 | 7.840611 |
a5d6ea11-9a36-4629-b72a-40d12db2414e | athyathanasia01/Data-Structure-Assistant-2024 | 5/material 5 - stack/stackWithArray_2.cpp | #include <iostream>
using namespace std;
int maks = 5, top = 0;
string book[5];
void PushBook(string data){
if(top >= maks){
cout << "Data is full" << endl;
} else {
book[top] = data;
top++;
}
}
void DisplayBook(){
cout << "Book Stack Data" << endl;
cout << "===============" << endl;
for(int i = maks-1;... | ALGO | 0.925493 | 4.306906 |
8b4f9694-6089-4664-865c-a4b35475d156 | mont-y-001/CppCourse | MergeSortR.cpp | #include<iostream>
using namespace std;
void merge(int *arr,int s,int e){
int mid = s + (e-s)/2;
int len1 = mid + 1 -s;
int len2 = e - mid;
int *left = new int[len1];
int *right = new int [len2];
int mainArrayIndex = s;
for(int i = 0;i<len1;i+... | ALGO | 0.999936 | 5.118404 |
05f3c3e4-f383-4360-b036-d0d0a58c953e | LeMonADE-project/LeMonADE-GPU | src/LeMonADEGPU/core/mainColorBFM.cpp | #include <array>
#include <cstdlib> // atol
#include <stdint.h> // uint8_t, uint32_t (cstdint seems to be C++11)
#include <cstring>
#include <exception>
#include <fstream> // getline
#include <iostream>
#include <map>
#include <sstream>
#include <string>
#in... | TOOL | 0.888446 | 5.927655 |
16af214c-4378-4202-ad4c-37f0f9f5a38d | jin3811/BAEKJOON | 6219.cpp | #include <iostream>
#include <vector>
using namespace std;
bool isTrue(int target, const int n) {
while (target) {
if (target % 10 == n) return true;
else target /= 10;
}
return false;
}
int main () {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int a, b, d;
int... | ALGO | 0.999667 | 4.306178 |
5cabdbcc-5909-49cd-b0d9-9b7b741bab9f | rupav/cp | competitive_coding/contests/544/544D.cpp | #include<bits/stdc++.h>
using namespace std;
#define fr(i,n) for(int i=0; i<n; i++)
#define rep(i, st, en) for(int i=st; i<=en; i++)
typedef long long ll;
typedef pair<int, int> pii;
ll mod = 1e9+7;
int main(){
int n;
cin>>n;
int a[n], b[n], c[n];
fr(i, n){
cin>>a[i];
}
fr(i, n){
... | ALGO | 0.999943 | 3.623535 |
907c0fb1-2f3a-4285-8e44-73dd3ea9a62f | jai-dalmotra/Leet-Code | #763. Partition Labels.cpp | class Solution {
public:
vector<int> partitionLabels(string s) {
// Step 1: Store the last occurrence of each character
unordered_map<char, int> last_index;
for (int i = 0; i < s.length(); i++) {
last_index[s[i]] = i;
}
vector<int> partitions;
int start = 0, max_end = 0;
//... | ALGO | 0.999716 | 6.888042 |
7e7787ac-3242-4d01-abfc-99cbbb4da9ca | MdRifathSharker/Competitive-programming | OOPlab51a.cpp | #include<bits/stdc++.h>
using namespace std;
class square{
int a;
public:
void get_data(){
int x;
cin>>x;
a=x;
}
friend class rectangle;
};
class rectangle{
int c,b,p,q;
public:
void get_data(){
int y,z,p,q;
cin>>z;
b=z;
square n1;
... | ALGO | 0.99935 | 3.872355 |
774caffa-04ee-4a26-8687-d31365b41d9d | joint12/study | data_structure_10_trie_tree.cpp | #include <iostream>
struct Node
{
int count = 0;
Node* child[26];
Node()
{
for (int i = 0; i < 26; ++i)
{
this->child[i] = NULL;
}
}
};
Node* root = new Node;
void Init(void)
{
}
void Insert(char in[])
{
Node* current = root;
for (int i = 0; in[i] != NULL; ++i)
{
if (current->child[in[i] - 'a']... | ALGO | 0.999645 | 4.773378 |
db60edfb-f482-4d96-8c73-fcdf05610530 | Divesh1602/Leetcode | 0890-find-and-replace-pattern/0890-find-and-replace-pattern.cpp | class Solution {
public:
bool ispossible(string str1,string str2){
unordered_map<char,char> m;
vector<bool> v(26,false);
for(int i=0;i<str1.length();i++){
char ch1=str1[i],ch2=str2[i];
if(m[ch1] && m[ch1]!=ch2)
return false;
if(!m[ch1] && v... | ALGO | 0.999967 | 6.170445 |
ac77dc2f-4fa8-48b6-93ec-9bdb230f6f74 | HosseinDahaei/CodeForces_Solutions | Solutions/72644608.cpp | #include <iostream>
using namespace std;
int arr[1000000+100];
int main()
{
int n;
cin>>n;
char c;
int one=0;
scanf("%c",&c);
for(int i=1;i<=n;i++)
{
scanf("%c",&c);
if(c=='(') arr[i]=0;
else arr[i]=1;
if(arr[i]) one++;
}
if(n!= 2*one)
{... | ALGO | 0.999929 | 3.420426 |
d3c7a874-911f-44f4-a0a8-14b31d49a098 | GunjanShakya/DSA | 1202-smallest-string-with-swaps/1202-smallest-string-with-swaps.cpp | class Solution {
public:
int find(vector<int>& ds, int i) {
return ds[i] < 0 ? i : ds[i] = find(ds, ds[i]);
}
string smallestStringWithSwaps(string s, vector<vector<int>>& pairs) {
vector<int> ds(s.size(), -1);
vector<vector<int>> m(s.size());
for (auto& p : pairs) {
auto i = find(ds, p[0]), j = find(ds... | ALGO | 1 | 5.946033 |
cd12389f-1c73-4cae-8726-941c7bb62621 | RheinX/LeetCode | 101-200/113_PathSumII.cpp | //Description
//Given a binary tree and a sum, find all root - to - leaf paths where each path's sum equals the given sum.
//
//For example :
//Given the below binary tree and sum = 22,
//Solution :
//just as the pervious problem,we just change it by the BFS
#include<iostream>
#include<vector>
using namespace std;
s... | ALGO | 0.999748 | 5.6397 |
4d7471f8-beb1-4be6-9f6f-1cb17d082964 | Joker-Yi/408-postgraduate | Data structure/linearList/seqList_delete.cpp | //
// Created by Yee on 2021/8/24.
//
#include <stdio.h>
// 定义最大容量
#define MAXSIZE 10
typedef struct {
int data[MAXSIZE];
int length; // 当前数组长度
} SeqList;
// 初始化顺序表
void initList (SeqList &L) {
L.length = 0; //初始化当前数组长度
}
// 顺序表的插入 i:插入的位置(位序) 1起始 e: 插入的元素
// 时间复杂度 问题规模:n=L.length
// 最好情况: 新元素插入到表尾 不需要移... | ALGO | 0.992373 | 3.045785 |
55569ead-40e6-45a6-928c-453257a6cc6e | Mohamed-elsaprot/popular | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998859 | 6.785645 |
1a71d961-0a7f-43c3-8404-ca8465dc9014 | danilovict2/Competitive-Programming-Problems | Codeforces/DominatedSubarray/DominatedSubarray.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define pb push_back
#define pii pair<int, int>
#define vi vector<int>
#define mp make_pair
#define forn(i, j, n) for (int i = (j); i < n; ++i)
#define INF 0x3f3f3f3f
template <typename... T>
void read(T &...args)
{
((ci... | ALGO | 0.999786 | 4.29633 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.