uuid stringlengths 36 36 | repo_name stringlengths 5 123 | relative_path stringlengths 5 4k | content stringlengths 33 2.85M | category stringclasses 6
values | algo_rel_score float64 0.85 1 | quality_score float64 3 8.76 |
|---|---|---|---|---|---|---|
5c256080-a2ea-4085-80cc-ffbc94b3a0f1 | pratapaditya1997/leetcode | medium/120/sol.cpp | const int INF = 1e7 + 5;
class Solution {
public:
int minimumTotal(vector<vector<int>>& a) {
int n = a.size(), m = a[n-1].size();
if (n == 1) return a[0][0];
vector<vector<int>> dp(n, vector<int>(n, INF));
dp[0][0] = a[0][0];
int ans = INF;
for (int... | ALGO | 0.999968 | 5.261653 |
93fe16fb-73ae-49f2-8370-e278454b5fff | david20571015/Introduction-to-Computers-and-Programming | lab8/1.cpp | #include<stdio.h>
int GCD(int a, int b){
if(b==0)
return a;
return GCD(b,a%b);
}
int LCD(int a, int b){
return a*b/GCD(a,b);
}
int main(void){
int n,ans;
scanf("%d",&ans);
while(scanf("%d",&n)){
ans=LCD(n,ans);
}
printf("%d",ans);
return 0;
}
| ALGO | 0.999924 | 3.586309 |
8966b93a-be96-45ee-ae13-4c93fc53a1c8 | mwojcik12121/hamiltonian-path-finder | hamilton/widok.cpp | #include <iostream>
#include "funkcje.h"
void wyswietlPomoc()
{
std::cout << "\nPomoc:\nBy prawidlowo uruchomic program, nalezy podac dwa parametry w postaci plikow o rozszerzeniu .txt poprzedzone odpowiednimi przelacznikami (-i dla pliku wejsciowego, -o dla pliku wyjsciowego) oraz rozdzielone pojedynczymi spacjami.... | ALGO | 0.991713 | 4.808521 |
cc4c6de3-fb91-4a50-8fcd-64474e4cabd2 | denis-gubar/Leetcode | Array/0674. Longest Continuous Increasing Subsequence.cpp | class Solution {
public:
int findLengthOfLCIS(vector<int>& nums) {
if (nums.empty()) return 0;
int result = 1;
int current = 1;
int prev = nums[0];
for (int n : nums)
{
if (n <= prev)
{
result = max(result, current);
current = 1;
}
else
{
++current;
result = max(result, curre... | ALGO | 0.999939 | 6.331584 |
e3599f90-1018-4a4f-8c0a-de01c64f975f | NGC-2372/TACR-CPP | Library/eigen/unsupported/doc/examples/MatrixPower.cpp | #include <unsupported/Eigen/MatrixFunctions>
#include <iostream>
using namespace Eigen;
int main()
{
const double pi = std::acos(-1.0);
Matrix3d A;
A << cos(1), -sin(1), 0,
sin(1), cos(1), 0,
0 , 0 , 1;
std::cout << "The matrix A is:\n" << A << "\n\n"
"The matrix power A^(pi/4) is:\n"... | ALGO | 0.999813 | 3.790203 |
2976fa5f-6cfa-435d-9880-4fe5d8c79407 | willbrasic/Algorithmic_Pricing_Recommendation_Systems_Competition | No_RS_Het_theta_gamma/main.cpp | ///////////////////////////////////////////////////////////////////////////
// Sellers Q-learning Varying (gamma, theta_1)
//
// William Brasic
// The University of Arizona
// <EMAIL>
// williambrasic.com
// January 2024
//
// This script simulates sellers using Q-learning pricing
// algorithms engaging in price compet... | ALGO | 0.99784 | 3.600776 |
0773051d-7493-487d-8176-7e8f83a5ef07 | sajalprajapati/Take-you-forward | Dynamic Porgamming/2-D dp/Traingle Problem PART i/recursive_Approach.cpp | class Solution {
public:
int helper(int i,int j,int n,vector<vector<int>>& triangle)
{
if(i==n-1)
{
return triangle[i][j];//we don't have here a fixed ending ....
}
int down=triangle[i][j]+helper(i+1,j,n,triangle);
int diagonally=triangle[i][j]+helper(i+1,j+... | ALGO | 0.999994 | 6.383949 |
810e1bcf-8850-432d-9dc7-6cbb3c426c28 | qingguang/lammps-sph | lib/gpu/ljcl_cut_gpu.cpp | /* ----------------------------------------------------------------------
Contributing authors: Mike Brown (ORNL), <EMAIL>
------------------------------------------------------------------------- */
#include <iostream>
#include <cassert>
#include <math.h>
#include "ljcl_cut_gpu_memory.h"
using namespace std;
st... | ALGO | 0.986425 | 5.624824 |
26ccd6cd-4d47-48c8-875d-16fd5dd0dd0b | genesi/firefox | gfx/angle/src/compiler/spooky.cpp | // Spooky Hash
// A 128-bit noncryptographic hash, for checksums and table lookup
// By Bob Jenkins. Public domain.
// Oct 31 2010: published framework, disclaimer ShortHash isn't right
// Nov 7 2010: disabled ShortHash
// Oct 31 2011: replace End, ShortMix, ShortEnd, enable ShortHash again
#include <memory.h>
... | ALGO | 0.967252 | 6.431903 |
ad3821b1-9e73-4cd5-b2a2-61b07cd6faac | pietro-stangherlin/hdgm_em | src/optim/golden_search.cpp | //https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/numerical_methods/golden_search_extrema.cpp#L1
/**
* \file
* \brief Find extrema of a univariate real function in a given interval using
* [golden section search
* algorithm](https://en.wikipedia.org/wiki/Golden-section_search).
*
* \see brent_method_ext... | ALGO | 0.999995 | 6.313578 |
7e614085-8075-458a-b587-2f8ad55c8136 | tang415a/algorithms | numbers/oddThree.cpp | // Given an integer array where each number appears twice except three numbers,
// find out these three numbers. For example, the array is
// [1,3,2,5,3,8,5,4,6,1,7,7,4], then output 2, 6, 8.
#include <stdio.h>
bool oddThree(int *arr, int siz, int &one, int &two, int &three) {
int res = 0, i = 0;
for (; i < siz; ... | ALGO | 0.999925 | 4.957713 |
caaeda28-8e87-4c98-a4b3-aff247057354 | onecode369/CompetitiveProgramming | USACO/738.cpp | #include<bits/stdc++.h>
typedef long long ll;
#define int ll
#define DEBUG(x) cerr << #x << " = " << x << endl
#define MOD 1000000007
#define INF INT_MAX
#define reset(arr,n,i) fill(arr, arr+n, i)
#define iseql(a,b) ((abs(a-b) - 1e-9 < 0) ? 1 : 0)
using namespace std;
void solve(){
int n;
cin >> n;
vect... | ALGO | 0.999909 | 4.365661 |
cdee9b5b-ea2a-4661-9c19-6501a3efa71c | 4141amitkumar/DSA_CODES | 150print1toN.cpp | //Print 1 to n (without extra parameter) --->after recursive call;
#include <iostream>
using namespace std;
void print(int n){
if(n==0) return ; //base case
print(n-1); //pahle function recall
cout<<n<<endl; //kaam uske baad *********
}
int main(){
cout<<"Enter the value of n:";
int n;
... | ALGO | 0.998504 | 4.663866 |
1f100d5f-9e73-44e0-a1de-2c57115f4169 | MaxiCM/android_packages_apps_Snap | jni/feature_stab/db_vlvm/db_utilities_indexing.cpp | /* $Id: db_utilities_indexing.cpp,v 1.3 2011/06/17 14:03:31 mbansal Exp $ */
#include "db_utilities_indexing.h"
#include "db_utilities.h"
/*****************************************************************
* Lean and mean begins here *
**********************************************... | ALGO | 0.997848 | 5.427917 |
f43a458c-5ad8-400d-8cb2-419e5e1bfe6d | ishandutta2007/codeforces | winniechen/normal/1060/D.cpp | #include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <queue>
#include <iostream>
#include <bitset>
#include <set>
using namespace std;
#define N 100005
#define ll long long
int n,a[N],b[N];ll ans;
int main()
{
scanf("%d",&n);ans=n;
for(int i=1;i<=n;i++)scanf("%d%d",&a... | ALGO | 0.999953 | 3.590727 |
8e697720-5a48-4750-a115-736faff8f3f6 | 18-RAJAT/ONLINE-JUDGE | A_Wallet_Exchange.cpp | #include<bits/stdc++.h>
using namespace std;
#define int long long
void sol()
{
int a,b;
cin>>a>>b;
cout<<((a+b)%2==1?"Alice":"Bob")<<endl;
}
signed main()
{
int t;
cin>>t;
while(t--)
{
sol();
}
return 0;
} | ALGO | 0.999943 | 4.288643 |
e8ce34be-4ac6-420e-90bc-d3ff7e16ae45 | AbylayDalabay/algo-ysda | contest_4/C.cpp | #include <cassert>
#include <ios>
#include <iostream>
#include <iterator>
#include <memory>
#include <vector>
struct Node {
int value;
std::shared_ptr<Node> left_child;
std::shared_ptr<Node> right_child;
Node(int value) : value(value), left_child(nullptr), right_child(nullptr) {}
Node(int value, ... | ALGO | 0.999965 | 5.621446 |
8ad12f69-ca08-405a-9a55-e01d82159a7a | HuaiLeiTang/slam_ros | path_planning/simplifyPath.cpp | #include <string>
#include "simplifyPath.h"
#include "lineFitting.h"
using std::vector;
//Given an array of points, "findMaximumDistance" calculates the GPS point which have largest distance from the line formed by first and last points in RDP algorithm. Returns the index of the point in the array and the distance.
c... | ALGO | 0.999773 | 4.052277 |
e0267ba3-a4eb-4635-a2aa-5ad1719f0bfd | Deepthi2021/algo | Code/C++/Top-View.cpp | /*
QUES : Top view of a binary tree is the set of nodes visible when the tree is viewed from the top. Given a binary tree, print the top view of it. The output nodes can be printed in any order.
A node x is there in output if x is the topmost node at its horizontal distance. Horizontal distance of left... | ALGO | 0.999995 | 5.155651 |
f0560522-a0c4-4059-85b7-90a71daef7ca | Kyan820815/leetcode | lc16xx/lc1636.cpp | //-- Q: 1636. Sort Array by Increasing Frequency
//--- method 1: bucket sort
class Solution {
public:
vector<int> frequencySort(vector<int>& nums) {
vector<int> cnt(201, 0);
for (int i = 0; i < nums.size(); ++i) {
++cnt[nums[i]+100];
}
sort(nums.begin(), nums.end(), [&cn... | ALGO | 0.999971 | 5.965328 |
24e2327c-db44-44ab-ae27-2250d9f7bf16 | YadlaMani/neetcode.io-solutions | Linked-List/Merge-K-Sorted-Lists.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
ListNode* mergeLists(... | ALGO | 0.999942 | 6.000085 |
1b7faf36-1de8-4f85-af53-359930812b32 | Sunnyjha007/Dynamic_Programming | Palindrome Partitioning 4.cpp | bool ispali(string& s, int i, int j,vector<vector<int>>& dp) {
if (i >= j) return true;
if (dp[i][j] != -1) return dp[i][j];
if (s[i] == s[j]) return dp[i][j] = ispali(s, i + 1, j - 1,dp);
return dp[i][j] = false;
}
bool checkPartitioning(string s) {
int n = s.size();
vector<vector<int>> dp... | ALGO | 0.999986 | 5.114776 |
0f0dc36f-3e0d-482e-a13b-af80c9cc0f58 | jongyeon95/ReStartCoding | [23971] ZOAC 4/23971.cpp | #include <iostream>
using namespace std;
int main() {
int H, W, N, M;
cin >> H >> W >> N >> M;
int rows = (H + N) / (N + 1);
int cols = (W + M) / (M + 1);
int max_people = rows * cols;
cout << max_people << endl;
return 0;
} | ALGO | 0.993202 | 3.736608 |
789308fd-2069-4f9f-b88c-c07275e442e4 | hanm/llvm | lib/CodeGen/SelectionDAG/ResourcePriorityQueue.cpp | #include "llvm/CodeGen/ResourcePriorityQueue.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/SelectionDAGNodes.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetLowering.h"
#include "llvm/Target/TargetMachine.h"
#i... | ALGO | 0.945222 | 7.147455 |
ee6612a1-3d95-49ce-8ebc-74a01e264615 | Achira16/My_codes | 3.cpp | #include<bits/stdc++.h>
using namespace std;
void func(vector<vector<int>>& g,int src,int dest,vector<int>& res)
{
queue<int> q;
q.push(src);
vector<bool> vis(g.size(),0);
vis[src] = 1;
while(!q.empty())
{
int u = q.front();
q.pop();
for(int v:g[u])
{
... | ALGO | 0.999981 | 4.196713 |
20bea4c4-2764-4476-839f-fe1c6718ac09 | dongju2-lee/algorithm-BOJ- | num11399.cpp | #include <cstdio>
#include <algorithm>
using namespace std;
int P[1000];
int main(){
int N = 0, i = 0;
scanf("%d", &N);
for (int i = 0; i < N; i++){
scanf("%d", &P[i]);
}
sort(P, P + N);
for (int i = 1; i < N; i++){
P[i] = P[i - 1] + P[i];
}
int sum = 0;
for (int i = 0; i < N; i++){
sum += P[i];
}
... | ALGO | 0.999909 | 3.720477 |
bcf3a12c-619e-44a3-9aaf-0b325af7327b | fuzh97/leetcode | code/0033.搜索旋转排序数组.cpp | /*
* @lc app=leetcode.cn id=33 lang=cpp
*
* [33] 搜索旋转排序数组
*/
// @lc code=start
class Solution {
public:
int search(vector<int>& nums, int target) {
int n = nums.size();
if (n == 0) return -1;
if (n == 1) {
if (nums[0] == target)
return 0;
else
... | ALGO | 0.999972 | 6.295415 |
3883adb6-4c2e-42be-be83-6e599def1f21 | lammps/lammps | src/APIP/pair_pace_fast_apip.cpp | /* ----------------------------------------------------------------------
Contributing author: David Immel (<EMAIL>, FZJ, Germany)
------------------------------------------------------------------------- */
#include "pair_pace_fast_apip.h"
#include "atom.h"
#include "atom_vec_apip.h"
#include <cstring>
using na... | TOOL | 0.933061 | 5.367152 |
80f402e1-2c02-42ee-bd65-452b88b5cf58 | oxygen-hunter/Flashboom | data/leetcode_cpp/combinationSum.cpp | // Time Complexity: O(n!)
// Space Complexity: O(1)
class Solution {
public:
vector<vector<int> > combinationSum(vector<int> &candidates, int target) {
sort(candidates.begin(), candidates.end());
vector<vector<int> > ans;
vector<int> v;
dfs(candidates, target... | ALGO | 0.999991 | 6.45613 |
84fd1ad6-f5ff-43dd-b15f-a2d091506797 | nikhiljha625/Cp_All_questions | C_Make_it_Alternating.cpp | #include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#pragma GCC optimize("Ofast")
#define ll long long
#define pb push_back
#define all(v) v.begin(),v.end()
#define ff second
#define ss second
#define pyes cout << "YES" << "\n"
#define ... | ALGO | 0.999924 | 5.3549 |
9057dffd-6cc6-4c4c-b3b8-a932604b84c8 | YoLynx/Daily-DSA-Dose | Trees/same_trees.cpp | // Problem link : https://leetcode.com/problems/same-tree/
// Just do any traversal and comapre the values of the nodes at each step.
class Solution {
public:
bool isSameTree(TreeNode* p, TreeNode* q) {
if(p==nullptr || q==nullptr) return (p==q);
return (p->val==q->val) && isSameTree(p->left, q->le... | ALGO | 0.999991 | 6.979201 |
6483162c-f1cc-435f-8609-2334e01a779e | wincle626/HLS_Bambu | src/HLS/scheduling/scheduling.cpp | /**
* @file scheduling.cpp
* @brief Base class for all scheduling algorithms.
*
*
* @author Matteo Barbati <<EMAIL>>
* @author Fabrizio Ferrandi <<EMAIL>>
* @author Christian Pilato <<EMAIL>>
* $Revision$
* $Date$
* Last modified by $Author$
*
*/
#include "scheduling.hpp"
#include "hls.hpp"
#include "hls_ma... | ALGO | 0.973915 | 3.388685 |
a7d9d280-094a-4c1c-9ddb-e102c9df3573 | trilinos/Trilinos | packages/belos/tpetra/test/Issue_3235.cpp | #include "BelosLinearProblem.hpp"
#include "BelosTpetraAdapter.hpp"
#include "BelosBlockGmresSolMgr.hpp"
#include "Tpetra_Core.hpp"
#include "Tpetra_CrsMatrix.hpp"
#include "Tpetra_Map.hpp"
#include "Tpetra_MultiVector.hpp"
#include "Tpetra_Operator.hpp"
int main(int argc, char *argv[]) {
using Teuchos::Array;
us... | ALGO | 0.95092 | 4.647416 |
5ce121c3-0d1e-41a9-a706-e81aa15e6872 | uaskh/Competitive_Programming | Spoj/BITMAP.cpp | #include<bits/stdc++.h>
using namespace std;
const int mx=1e5+5;
int main(){
int test;
scanf("%d",&test);
while(test--){
string s;
vector<string> vs;
queue <pair<int,int>> pos;
pair<int,int> trol;
int n,m;
scanf("%d%d",&n,&m);
int** arr=new int*[n];
for(int i=0;i<n;i++)
arr[i]=new int[... | ALGO | 0.999919 | 3.700145 |
25180bff-c374-4df3-982e-90b647784028 | OrangeJeon/2023AlgorithmStudy-Week9 | Week9/bj_1697.cpp | #include <iostream>
#include <vector>
#include <queue>
using namespace std;
bool isCheck[100010];
int main() {
int T;
int N, M, K;
int X, Y;
int answer = 0;
cin >> N >> K;
queue<pair<int, int>> q;
q.emplace(N, 0);
while (!q.empty()) {
int locate = q.front().first;
int... | ALGO | 0.999954 | 3.735497 |
31a4b3f6-5036-41e0-b590-3d3562422e64 | PavithaDissanayake/210146N | Lab 9/Hash_Table_with_Chaining.cpp | #include <iostream>
#include "linkedlist.cpp"
using namespace std;
struct HashTable{
int MAX_LENGTH = 4;
int MAX_CHAIN_LENGTH = 2;
LinkedList * password = new LinkedList[MAX_LENGTH];
bool isFull(){
bool full = true;
int count = 0;
for (int i = 0; i < MAX_LENGTH; i++){
... | ALGO | 0.983002 | 4.061609 |
1651997d-59de-4441-8bcd-c8be8acb15f3 | Jopepato/Informatica | 3Anio/primerCuatri/FSIV/Practica2/funciones.cpp | #include "funciones.hpp"
void help(){
cout << "Ayuda con los comandos: " << endl;
cout << "-h: Muestra la ayuda del programa" << endl;
cout << "-i nombreImagen: Imagen que se va a cargar para el programa" << endl;
cout << "-m nombreMascara: Nombre de la mascara a usar" << endl;
cout << "-r radio: Radio que vamos... | TOOL | 0.975611 | 3.713361 |
48b6a538-49a4-468b-973e-77e842492efa | Guo-lab/LeetCode | 2021一刷26题/45.跳跃游戏-ii.cpp | /*
* @lc app=leetcode.cn id=45 lang=cpp
*
* [45] 跳跃游戏 II
*/
// @lc code=start
class Solution {
public:
int jump(vector<int>& nums) {
int cover = 0, previousCover = 0;
int steps = 0;
int flag = 0;
if (nums.size() == 1) return 0;
for (int i = 0; i <= cover; i++) {
cover = max(i + nums[... | ALGO | 0.999983 | 6.313226 |
f63d84ff-5756-407c-aafd-b5a4b5c79087 | DukeHuangWP/GoExample-GoCV-Install-In-Windows | opencv-4.6.0/3rdparty/carotene/src/convert_depth.cpp | #include "common.hpp"
#include <cstring>
namespace CAROTENE_NS {
#ifdef CAROTENE_NEON
namespace {
template <int shift>
void lshiftConst(const Size2D &size,
const u8 * srcBase, ptrdiff_t srcStride,
s16 * dstBase, ptrdiff_t dstStride)
{
size_t roiw16 = size.width >= 15 ? size.wi... | ALGO | 0.982378 | 6.209934 |
7dc8874d-af3d-457b-89cb-4360f8601b6a | raincross7/code-similarity | codes/train_code/problem083/problem083_357.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
ios_base:: sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
ll n,m,r;cin>>n>>m>>r;
vector<ll> a(r);for(ll i=0;i<r;i++)cin>>a[i],a[i]-=1;
ll dist[n][n];
for(ll i=0;i<n;i++)for(ll j=0;j<n;j++)dist[i][j]=1e12;
... | ALGO | 0.999934 | 3.88944 |
21ede508-cc09-4f6c-beb1-a895c43ae737 | shantanuk09/competitive-programming | Kattis/temperature.cpp | #include <iostream>
#include <iomanip>
using namespace std;
int main(){
double x, y;
cin >> x >> y;
y--;
if(y < 0.5 && x == 0) cout << "ALL GOOD" << endl;
else if(y < 0.5) cout << "IMPOSSIBLE" << endl;
else cout << setprecision(9) << - x / y << endl;
return 0;
} | ALGO | 0.999606 | 3.984807 |
61e0d360-7108-48a2-9225-f21ba6272e2e | sabinleee/solve-problems | BOJ/C++/1000~2000/1764.cpp | #include <cstdio>
#include <vector>
#include <algorithm>
#include <iostream>
using namespace std;
int main()
{
int n, m;
scanf("%d%d", &n, &m);
vector<string> v;
vector<string> v_result;
v.resize(n);
for (int i = 0; i < n; i++) {
cin>>v[i];
}
sort(v.begin(), v.end());
string str;
for (int j = 0; j < m;... | ALGO | 0.999981 | 3.896954 |
a68bc24b-95e9-4bf9-9dc9-434eff8d22cb | ishandutta2007/codeforces | alexluchianov/normal/1119/E.cpp | #include <iostream>
using namespace std;
#define ll long long
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#define MAX(a, b) (((a) < (b)) ? (b) : (a))
int main()
{
int n;
cin >> n;
ll result = 0, sum = 0;
for(int i = 1;i <= n;i++){
int a;
cin >> a;
int val = MIN(a / 2, sum);
result += val;
... | ALGO | 0.99987 | 3.608534 |
0633c434-926a-44b7-8f11-54a61eb7153d | abhisheknaiidu/dsa | DSA/Trees/bottom-view.cpp | #pragma GCC optimize("Ofast")
#include <algorithm>
#include <bitset>
#include <deque>
#include <iostream>
#include <iterator>
#include <string>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <vector>
#include <unordered_map>
#include <unordered_set>
using namespace std;
void abhisheknaiidu()... | ALGO | 0.999883 | 4.282376 |
bb508e29-7190-4571-a84b-712f84581d3d | JolynLin/firstFlutter | 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 |
704e7b5d-fd8e-4611-a720-aa9dc82dcc05 | abdallawahba/problem-solving | cpp_codeforces/Tram.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
long long a,b,mx=0;
long long x=0;
for(int i=0;i<n;i++){
cin>>a>>b;
x+=b;
x-=a;
mx=max(mx,x);
}
cout<<mx<<endl;
return 0;
} | ALGO | 0.99987 | 3.584372 |
8e2e66ad-0b86-459c-801f-518313460ae4 | ajit1810/codeXflutter | practical8/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.998004 | 6.76073 |
994f9ae1-bfee-4bc4-850c-00339910425a | cyruxOP/-CrackYourPlacement | 2095-delete-the-middle-node-of-a-linked-list/2095-delete-the-middle-node-of-a-linked-list.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
ListNode* deleteMiddl... | ALGO | 0.999879 | 5.743286 |
e948f5a6-b638-4285-b46b-5dc3003e57ab | vishal11912056/StriverSdeSheetChallenge | Binary Tree/Preorder Traversal.cpp | void f(TreeNode *root,vector<int> &v)
{
if(!root)
{
return;
}
v.push_back(root->data);
f(root->left,v);
f(root->right,v);
}
vector<int> getPreOrderTraversal(TreeNode *root)
{
vector<int> v;
f(root,v);
return v;
}
| ALGO | 0.999853 | 5.345928 |
70963a48-dee3-4a5f-bdd0-46d349c7b17d | ArpitSingla/Competitve-Programming-CP | Coding Ninjas/Binary Trees/Is Balanced.cpp | // Following is the Binary Tree node structure
/**************
class BinaryTreeNode {
public :
T data;
BinaryTreeNode<T> *left;
BinaryTreeNode<T> *right;
BinaryTreeNode(T data) {
this -> data = data;
left = NULL;
right = NULL;
}
};
***************/
int depth(BinaryTree... | ALGO | 0.999707 | 5.698387 |
f3066424-dfce-46e0-a3ef-09fe7d88052d | Hariraghavn0212/LeetCode-Programs | 932-monotonic-array/monotonic-array.cpp | class Solution {
public:
bool isMonotonic(vector<int>& nums) {
bool inc = true;
bool dec = true;
for(int i= 1; i<nums.size();++i){
if(nums[i]>nums[i-1]){
dec= false;
}
if(nums[i]<nums[i-1]){
inc = false;
}
... | ALGO | 0.999957 | 5.839776 |
f78f8cf0-fb8b-4c5e-9060-fb71313c9a14 | mazen-alasas/Problem-Solving | LeetCode/Practice Sheet/Arrays & Hashing/27. Remove Element.cpp | // O(n)
class Solution {
public:
int removeElement(vector<int>& nums, int val) {
int n = 0;
for(int i = 0; i < nums.size(); i++){
if(nums[i] != val){
nums[n] = nums[i];
n++;
}
}
return n;
}
};
| ALGO | 0.999855 | 6.140873 |
4301f8d2-558d-43e8-938d-ab5168144257 | VARTIOMIES/ohjelmointi-2-cplusplus | student/08/reverse_polish/main.cpp | #include <iostream>
#include <vector>
using namespace std;
string delete_empty(string s)
{
string newstr = "";
for (unsigned int i=0;i<s.size();i++)
{
if (s.at(i)!=' ')
{
newstr.push_back(s.at(i));
}
}
return newstr;
}
int main()
{
cout<<"Input an expressi... | ALGO | 0.999864 | 4.172738 |
3caa240e-a2d4-41ed-96dd-fe0c62355012 | SandaliF/DSA_InclassLabs | HeapSort.cpp | #include <iostream>
#include <vector>
using namespace std;
// function to heapify the tree
void heapify(int arr[], int n, int root)
{
// build heapify
int maximum = root; //Assign the position of root to maximum
int left = 2*root + 1; //position of Left child node
int right = 2*root + 2; //position of... | ALGO | 0.999972 | 4.42801 |
57aaa822-796b-4a7d-864d-d8fd46a0296a | cshung/Competition | Competition/SPOJ_LITE_1.cpp | #include "stdafx.h"
// http://www.spoj.com/problems/LITE/
#include "SPOJ_LITE_1.h"
//#define VERIFY_BALANCE
//#define LOG_SUMMARY
//#define LOG_AVL_OPERATIONS
//#define LOG_QUERY_STEPS
#include <iostream>
#include <algorithm>
#include <map>
#include <vector>
#include <stack>
using namespace std;
const int left_to... | ALGO | 0.999941 | 3.908832 |
7c99f4fd-2ae7-4761-9615-d0bd026c2a7a | cathyxingchang/leetcode | leetcode_c++/6. ZigZag Conversion(M).cpp | #include <iostream>
#include <stdio.h>
#include <vector>
#include<algorithm>
#include<string>
#include<vector>
using namespace std;
//6. ZigZag Conversion
class Solution {
public:
string convert(string s, int numRows) {
vector<string> zigRow;
string result = "";
int k = 2 * numRows - 2;
//三行
for (int i = 0;... | ALGO | 0.999984 | 4.260155 |
34266c9d-23a3-4436-94d1-65ef76f41b33 | MasterNodesME/mnme | src/core_read.cpp | #include "core_io.h"
#include "primitives/block.h"
#include "primitives/transaction.h"
#include "script/script.h"
#include "serialize.h"
#include "streams.h"
#include <univalue.h>
#include "util.h"
#include "utilstrencodings.h"
#include "version.h"
#include <boost/algorithm/string/classification.hpp>
#include <boost/... | TOOL | 0.872319 | 7.181216 |
e444f2bf-23bb-4bbb-aed0-911e20d186ba | iamAmanrajput/DSA | 141/index.cpp | // 160. Intersection of Two Linked Lists
#include <iostream>
using namespace std;
/**
* Definition for singly-linked list.
*/
struct ListNode
{
int val;
ListNode *next;
ListNode(int x) : val(x), next(NULL) {}
};
class Solution
{
public:
ListNode *getIntersectionNode(ListNode *headA, ListNode *headB... | ALGO | 0.999907 | 5.858351 |
69e92611-b936-4e6b-bcd7-b8875f02740c | KUMARSANDIPROY/leetcode | Geek and his Binary Strings - GFG/geek-and-his-binary-strings.cpp | // { Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution{
public:
int prefixStrings(int N)
{
// Your code goes here
vector<long long> dp(N+1,0);
dp[0]=1;
dp[1]=1;
int mod=1e9+7;
for(int i=2;i<=N;i++)
{
for(int j=0;... | ALGO | 0.999993 | 6.300524 |
9b1a7741-4e9c-4a48-b784-e4c69c05bc27 | rajrohan10899/LeetCode-Problems | 2891-maximum-beauty-of-an-array-after-applying-operation/2891-maximum-beauty-of-an-array-after-applying-operation.cpp | /*
Approach-1 (Converting to Intervals and Using Deque)
Idea: Convert each number in the array to a range [num - k, num + k] and determine the maximum overlapping ranges.
Steps:
Generate ranges(intervals) and sort them by start points.
Use a deque to track overlapping ranges dynamically.
Update the maximum count of ov... | ALGO | 0.999967 | 6.086334 |
6854a0de-8c8c-4d0e-91f1-496fe674b113 | Amylo-jh/baekjoon | Temp_Contest/1212-2.cpp | #include <iostream>
#include <string>
#include <vector>
using namespace std;
int main()
{
vector <int> arr(5);
int n;
string str;
cin >> n >> str;
for(int i = 0; i < n; i++)
{
if(str[i] == 'u')
{
arr[0]++;
}
else if(str[i] == 'o')
{
... | ALGO | 0.995906 | 3.865314 |
cc631d88-1524-47e6-9542-dc8c7c6ff87c | JasonHutton/WhiteWaterCalculusRapids | Comp8051/Box2D/b2World.cpp | #include "b2World.h"
#include "b2Body.h"
#include "b2Fixture.h"
#include "b2Island.h"
#include "b2PulleyJoint.h"
#include "b2Contact.h"
#include "b2ContactSolver.h"
#include "b2Collision.h"
#include "b2BroadPhase.h"
#include "b2CircleShape.h"
#include "b2EdgeShape.h"
#include "b2ChainShape.h"
#include "b2PolygonShape.h... | ALGO | 0.976227 | 5.04885 |
c7b447b1-0297-4953-90d3-6f353046b802 | akk312000/Codeforces-solution | sample2.cpp | #include <bits/stdc++.h>
using namespace std;
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(0);
#define endl "\n"
#define ull unsigned long long
#define pb push_back
typedef long long ll;
typedef pair<int, int> pii;
const int MOD = 1000000007;
signed main()
{
#ifndef ONLINE_JUDGE
freopen("i... | ALGO | 0.999613 | 4.626819 |
9b3bca97-815b-4543-ac62-5d3ab594944a | mdiqbalism/DSA | BASIC/A14_Pattern.cpp | #include<iostream>
using namespace std;
int main(){
int n;
cin>>n;
int i=0;
while (i<n)
{
int j=0;
while (j<=i)
{
char ch ='A'+i;
cout<< ch <<" ";
j++;
}
cout<<endl;
i++;
}
return 0;
} | ALGO | 0.998443 | 3.879326 |
0c21ad63-333f-412a-bd16-c105bb712dd5 | Ismail-Upal/CP-Trash | Solved Problem/A_Two_Friends.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define dl double
#define endl "\n"
#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int main()
{
optimize();
ll t;cin>>t;
while(t--){
ll n;cin>>n;
vector<ll>v(n+1);
for(int i=1;i<=n;i++... | ALGO | 0.999468 | 3.805148 |
ed1570be-528f-44fb-8cc6-c6cb7af7c339 | muhammadalmuzahid/ACM-Library | AdHoc/U128.cpp | typedef unsigned long long int U64;
struct U128{
U64 lo, hi;
static const U64 bmax = -1;
static const size_t sz = 128;
static const size_t hsz = 64;
inline U128() : lo(0), hi(0) {}
inline U128(unsigned long long v) : lo(v), hi(0) {}
inline U128 operator-() const {return ~U128(*this) + 1;}
... | ALGO | 0.999756 | 3.627076 |
4370c6b4-0d42-48d1-8deb-5855bc5f39e6 | K0nnyaku/Code | Data/CSP-JS2021二轮提高组数据/SD-00912/airport/airport.cpp | #include<bits/stdc++.h>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#define pr pair < int,int >
#define forever() while(true)
#define mkp(x,y) make_pair(x,y)
#define get_time() (clock()/1000.0)
#define out(x) write(x),putchar(' ')
#define writen(x) write(x),putchar('\n')
using namespace std;
inline ... | ALGO | 0.999944 | 3.789515 |
202b9816-34f7-4527-b046-18fd0765b4de | ishandutta2007/codeforces | danya.smelskiy/normal/791/A.cpp | #include <bits/stdc++.h>
using namespace std;
long long n,m;
int main(){
cin>>n>>m;
for (int i=0;i<100;++i){
if (n>m) {
cout<<i;
return 0;
}
n*=3;
m+=m;
}
} | ALGO | 0.999906 | 3.555035 |
e0cac17a-e32b-48d3-867c-43a0225a27e6 | ishandutta2007/codeforces | subscriber/normal/13/C.cpp | #include<stdio.h>
#include<iostream>
#include<vector>
#include<math.h>
#include<algorithm>
#include<memory.h>
#include<map>
#include<queue>
using namespace std;
int a[5555],id[5555],u[5555],n,e=0;
pair<int,int>q[5555];
long long f[5555],q1[5555],q2[5555],ans=1e15;
int main(){
// freopen("1.in","r",stdin);
// freope... | ALGO | 0.999959 | 3.416119 |
3ea5190a-a753-4fe2-8b2c-375ea572d78e | utkarshmaken/cp | div2_C/704.cpp | #include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
#define f(i,a,b) for(int i = a;i<b;i++)
#define rep(i,a,b) for(int i = a;i<=b;i++)
#define fd(i,a,b) for(int i = a;i>b;i--)
#define repd(i,a,b) for(int i = a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define fi first
#define ... | ALGO | 0.999954 | 3.875892 |
d2a3f244-1559-4ac0-a24a-e6a8a79320e6 | Octobug/notes | algorithms_and_data_structures/leetcode/stack/e_00020_valid_parentheses/main.cpp | #include <iostream>
#include <stack>
#include <vector>
using namespace std;
class SolutionDumb
{
public:
bool isValid(string s)
{
stack<char> stk;
for (int i = 0; i < s.size(); i++)
{
if (s[i] == '(' || s[i] == '{' || s[i] == '[')
{
stk.push(s[i... | ALGO | 0.999354 | 5.901779 |
b57b99a3-cb87-42c7-b49e-b8d693de66c6 | Devansh-745/My-LeetCode-Solutions | 3761-maximum-difference-between-even-and-odd-frequency-ii/3761-maximum-difference-between-even-and-odd-frequency-ii.cpp | class Solution {
public:
int getState(int count_a, int count_b) {
int parity_a = count_a % 2; //odd : parity will be 1 , even : parity will be 0
int parity_b = count_b % 2;
if(parity_a == 0 && parity_b == 0) return 0; //even even (00)
if(parity_a == 0 && parity_b == 1) return 1; //e... | ALGO | 0.999917 | 5.536009 |
b813a274-98f7-4562-a926-0f2b447af37f | chainpluschainplus/ajmchain | protocol/impl/Book.cpp | //------------------------------------------------------------------------------
//==============================================================================
#include <ripple/protocol/Book.h>
namespace ripple {
bool
isConsistent (Book const& book)
{
return isConsistent(book.in) && isConsistent (book.out)
... | TOOL | 0.995791 | 6.713103 |
cfc7036a-168f-481d-a8c7-c8f1f36da834 | weronikaablouei/po | 321.cpp | #include <algorithm>
#include <array>
#include <functional>
#include <iostream>
#include <accountssettingspaneinterop.h>
#include <string_view>
//komentarz Aleksander Wolak
int main()
{
std::array<int, 10> s{5, 7, 4, 2, 8, 6, 1, 9, 0, 3};
auto print = [&s](std::string_view const rem)
{
for (aut... | TOOL | 0.9638 | 5.008823 |
51cf33e2-74bb-4fa4-82b5-39f1d45e7930 | ishandutta2007/codeforces | rajat1603/normal/843/D.cpp | #include "bits/stdc++.h"
using namespace std;
const int N = 1e5 + 5;
const long long inf = 1e15 + 15;
int n , m , q;
int a[N] , b[N] , c[N];
vector < int > v[N];
long long pot[N];
long long dist[N];
priority_queue < pair < long long , int > > pq;
bool visited[N];
void solve(){
for(int i = 1 ; i <= n ; ++i){
dist[i]... | ALGO | 0.999696 | 4.084811 |
5dfc4cf0-504e-4e6c-aaf6-0a308e5e87ae | IrinaMBejan/Personal-work-contests | Algorithmics/Problems from various contests/expresie2.cpp | #include <fstream>
#include <string>
#include<cstdlib>
#define nmax 100001
using namespace std;
ifstream fin("expresie2.in");
ofstream fout("expresie2.out");
string s,s1;
int i, poz;
char sym;
int ok[150];
string init(string s)
{
string s1;
int i, len = s.size();
for (i=0;i<len;i++)
if (s[i]>='a' && s[i]<='z')
... | ALGO | 0.999938 | 3.360619 |
33244503-693d-44e2-9569-f8e167bf8700 | SCS2017/Leetcode-Solution | 链表/24_Swap_Nodes_in_Pairs.cpp | /*
Given a linked list, swap every two adjacent nodes and return its head.
You may not modify the values in the list's nodes, only nodes itself may be changed.
Example:
Given 1->2->3->4, you should return the list as 2->1->4->3.
*/
#include <iostream>
#include <vector>
using namespace std;
struct ListNode {
int... | ALGO | 0.999996 | 5.353813 |
b95e7c49-1a0e-4d7a-bcde-9883af27c3fc | ishandutta2007/codeforces | ssrs_/normal/1364/C.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];
}
multiset<int> st;
map<int, int> mp;
for (int i = 0; i <= n; i++){
st.insert(i);
mp[i]++;
}
for (int i = 0; i < n; i++){
if (st.count(a[i])){
... | ALGO | 0.999999 | 3.803111 |
5c03a6fc-7ccc-4000-8625-e4c68a1c9cfe | GabrielCortizo/Competitive-Programming-3 | Introduction/Ad Hoc Problems/Game(Card)/UVa11678_CardsExchange.cpp | #include <bits/stdc++.h>
#define rep(i,b,c) for(int i = b;i<c;i++)
using namespace std;
vector<int> pree(int a){
int maximo,last = -1;
vector<int> va;
rep(i,0,a){
scanf("%d",&maximo);
if(maximo ==last)
continue;
last = maximo;
va.push_back(maximo);
}
return va;
}
int main(){
int a,b,last,min... | ALGO | 0.999789 | 3.536573 |
791345a4-c9eb-4776-a635-315a1706c0b6 | juniorandrade1/Competitive-Programming | Codeforces/educational31/D.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair< ll, ll > ii;
typedef vector< ll > vi;
typedef vector< ii > vii;
#define INF 0x3F3F3F3F
#define LINF 0x3F3F3F3F3F3F3F3FLL
#define pb push_back
#define mp make_pair
#define pq priori... | ALGO | 0.999988 | 4.379754 |
fbd415fb-a28e-440b-8078-963939916a44 | Adarshkumbar/Data-Structures-And-Algorithms | Stack/17_SmallestNumberOnLeft.cpp | // Smallest number on left
// medium
/*
Given an array a of integers of length n, find the nearest smaller number for every element such that the smaller element is on left side.If no small element present on the left print -1.
Example 1:
Input: n = 3
a = {1, 6, 2}
Output: -1 1 1
Explaination: Th... | ALGO | 0.999985 | 4.770317 |
d01a8ba5-bdf2-4973-85b1-f1c1414549d5 | safana-me/Ardu-pilot | libraries/AC_PID/AC_P_1D.cpp | /// @file AC_P_1D.cpp
/// @brief Generic P algorithm
#include <AP_Math/AP_Math.h>
#include "AC_P_1D.h"
const AP_Param::GroupInfo AC_P_1D::var_info[] = {
// @Param: P
// @DisplayName: P Proportional Gain
// @Description: P Gain which produces an output value that is proportional to the current error value
... | ALGO | 0.999249 | 5.970104 |
a7cbb936-797d-4d1d-94b1-596bc345dfa5 | alexandraback/datacollection | solutions_5708921029263360_0/C++/IlyarSM/main.cpp | #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <ctime>
#include <cstdio>
#include <string>
#include <sstream>
#include <queue>
#include <map>
#include <vector>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <set>
#include <unordered_map>
#include <memory>
#include <bitset>
#include <f... | ALGO | 0.998028 | 3.099678 |
cf296356-4cce-4d7f-b98d-175bf4fbb517 | prashastipathak9/DSA | DSA2/linearSearch.cpp | #include<iostream>
using namespace std;
bool linearSearch(int arr[], int n, int key)
{
for(int i=0;i<n;i++)
{
if(arr[i]==key)
{
return true;
}
}
return false;
}
int main()
{
int n, arr[100], e;
cout<<"Enter array size and then its elements: "<<endl;
cin>>n;
for(int i=0;i<n;i++)
{
cin>>arr[i];
}
cou... | ALGO | 0.999806 | 4.304792 |
0f468c2e-60bf-409d-8c28-cee1b9b4226f | kyaryunha/Simulated-Annealing | 20200328 BOJ 2582 동전뒤집기2.cpp | #include<bits/stdc++.h>
#define magic ios_base::sync_with_stdio(false);cin.tie(nullptr)
using namespace std;
#define pii pair<int,int>
double p,k,T,colder_k;
int numcnt;
int N;
struct child{
int score;
char arr[33][33];
}first,E1,E2,best,lastbest;
int calc_score(child &a){
int score = 0;
for(int i=1;... | ALGO | 0.998935 | 3.289441 |
d189b507-53e0-4ef6-8e71-e47e72dbb6fc | ishandutta2007/codeforces | heart_blue/normal/126/C.cpp | #include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bi... | ALGO | 0.999984 | 3.668625 |
8fcd1392-c223-4faa-a4cd-37a7a9c5a043 | daehan-86/daehan-86-baekjoon_algorithm_StepByStep | baekjoon_StepByStep/20 RECURSIVE/24060.cpp | #include<iostream>
#include<vector>
using namespace std;
vector<int>v;
vector<int>tmp;
int c,k,result=-1;
void merge(int p,int q,int r){
int i=p,j=q+1,t=0;
while(i<=q&&j<=r){
if(v[i]<=v[j]) tmp[t++]=v[i++];
else tmp[t++]=v[j++];
}
while(i<=q)tmp[t++]=v[i++];
while(j<=r)tmp[t++]=v[j++];
i=p;t=0;
while(i<=r){
... | ALGO | 0.999998 | 3.630425 |
26d947b7-3cb6-4047-82b9-3b8ce2f71c8b | bipul1532/DSA-Leetcode | 136-single-number/single-number.cpp | class Solution {
public:
int singleNumber(vector<int>& nums) {
int xor1=0;
for(int i=0;i<nums.size();i++){
xor1=xor1^nums[i];
}
return xor1;
}
}; | ALGO | 0.999971 | 5.584754 |
7bfdd925-5152-4577-8b44-30cfdef0c266 | raincross7/code-similarity | codes/train_code/problem458/problem458_369.cpp | #include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
using namespace std;
int main() {
string S;
cin>>S;
int ans=S.size()-2;
while(true){
bool check=true;
S.pop_back();
S.pop_back();
for(int i=0;i<S.size()/2;i++){
if(S[i]!=S[i+S.size()/2]){
check=false... | ALGO | 0.999857 | 3.290116 |
52622f82-07ed-47aa-bc64-1d002019348d | yyxa/leetcode | problems/1337. The K Weakest Rows in a Matrix.cpp | /*
1337. The K Weakest Rows in a Matrix
You are given an m x n binary matrix mat of 1's (representing soldiers) and 0's (representing civilians).
The soldiers are positioned in front of the civilians. That is, all the 1's will appear to the left of all the 0's in each row.
A row i is weaker than a row j if one of the... | ALGO | 0.999884 | 6.195632 |
7a55c7d7-66af-4d29-9b68-f74689774b1b | ishandutta2007/codeforces | ilya_msu/normal/860/A.cpp | #define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/STACK:256000000")
#define _USE_MATH_DEFINES
#include<iostream>
#include<vector>
#include<string>
#include<stack>
#include<algorithm>
#include<cmath>
#include<set>
#include<queue>
#include<sstream>
#include<utility>
#include<map>
#include<ctime>
#include<cstdio>
... | ALGO | 0.999988 | 3.348162 |
54b2339d-5e4d-4be6-b6be-d118e5dee1ef | bhavyawig/Competitive-Programming | Favorite Sequence codeforces.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
int j;
for(j=0;j<t;j++)
{
int n;
cin>>n;
int a[n],b[n];
int i,p=0,w=n-1;
for(i=0;i<n;i++)
{
cin>>a[i];
}
for(i=0;i<n;i=i+2)
{
b[i]... | ALGO | 0.999686 | 3.271967 |
4e2c57fc-92a4-4709-ab80-5a038d150628 | Lililica/WokshopN1 | src/Tramage/main.cpp | #include <sil/sil.hpp>
#include "random.hpp"
#include <vector>
#include <iostream>
std::vector<std::vector<float>> generateBayerLevel(int level){
if(level == 0){
std::vector<std::vector<float>> bayerInit{
{ 0.f , 2.f},
{ 3.f , 1.f}
};
return bayerInit;
}
std:... | ALGO | 0.997635 | 4.031261 |
54727266-1b0e-4e54-9a43-7baca31a214f | developertouch/doitnow | 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 |
c0a6e248-42f8-4288-bad7-491d60103e99 | vsaikiran234/leetcode | 0036-valid-sudoku/0036-valid-sudoku.cpp | class Solution { // class Solution {
public: // public:
bool isValidSudoku(vector<vector<char>>& board) { // bool isValidSuduko(vector<vector<char>& board)
unordered_set<string> seen; // unordered_set<string> seen;
for (int i = 0; i < 9; ++i) // for (int i = 0; i < 9; ++i)
for (int j = 0; j < 9; ++j)... | ALGO | 0.998567 | 6.663931 |
cd154891-a32b-4edb-b688-17924364f1cc | Andwerpz/Competitive-Programming-Practice | - cpp -/needforspeed.cpp | #include <bits/stdc++.h>
typedef long long ll;
typedef __int128 lll;
typedef long double ld;
using namespace std;
//ICPC World Finals 2017 - E
ld epsilon = 1E-10;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n, t; cin >> n >> t;
vector<pair<int,int>> segs(n);
for(auto &x: se... | ALGO | 0.999955 | 4.478821 |
8aafd4da-409f-477d-9b03-8c97dd89a1f0 | Om21610018/DSA-Codes | merge2sortedarrays.cpp | //* Merge two sorted arrays :
#include <bits/stdc++.h>
using namespace std;
void mergetwosortedarrays(vector<int> &v1, vector<int> &v2, vector<int> &v3)
{
// 3 pointer approach
int i = 0, j = 0, k = 0;
while (i < v1.size() && j < v2.size())
{
if (v1[i] < v2[j])
{
v3[k] = v1[i... | ALGO | 0.99997 | 5.096816 |
1f285208-1297-49a9-8ce9-6db1e3303505 | ghozt777/cp | leetcode/c++/dp/combination-sum-4/main.cpp | // link: https://leetcode.com/problems/combination-sum-iv/
class Solution {
public:
int combinationSum4(vector<int>& nums, int target) {
vector<uint32_t > dp(1001,0);
for(int x:nums) dp[x]=1;
for(int n=1;n<=target;n++){
for(int i=0;i<nums.size();i++){
if(n-nums[i... | ALGO | 0.999932 | 6.473763 |
2473adca-ceff-49ea-973b-aea4428687da | rdtek/ECGViewer | beatanalyzer/EPBeatAnalyzer/EPBeatAnalysis/EPLib/QRSDET.CPP | #include <mem.h> /* For memmov. */
#include <math.h>
#include "qrsdet.h"
#define PRE_BLANK MS200
// External Prototypes.
int QRSFilter(int datum, int init) ;
int deriv1( int x0, int init ) ;
// Local Prototypes.
int Peak( int datum, int init ) ;
int median(int *array, int datnum) ;
int thresh(int qmedian, int nmed... | ALGO | 0.998584 | 6.150739 |
875994bd-17c8-4169-8477-b2a0ba7597e6 | parveshbarak/CppCompetitiveProgramming | Codechef/CodeChef CookOff/JAN2022/MEANMAX.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define mod 1000000007
#define inf 1e18
#define pb emplace_back
#define vi vector<ll>
#define vs vector<string>
#define pii pair<ll,ll>
#define vp vector<pair<ll,ll>>
#define mp make_pair
#define pq_max priority_queue<ll>
#def... | ALGO | 0.999945 | 4.197002 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.