uuid
string
repo_name
string
relative_path
string
content
string
category
string
algo_rel_score
float64
quality_score
float64
3b3ef878-bf2e-40ad-9217-bfb478744b81
mxuexxmy/2019HolidaysTrain
ICPC/前向星.cpp
#include<bits/stdc++.h> using namespace std; int main(){ int a[1010]; int t; cin >> t; while(t--){ int n; cin >> n; for(int i = 0; i < n; i++){ cin >> a[i]; } int qu; cin >>qu; while(qu--){ int l, r; cin >> l >> r; if(l == r){ cout << a[l -1] <<endl; }else{ vector<int> b(a+l, a...
ALGO
0.999933
4.340432
a15ce250-7e11-4a22-8e68-b045e3556750
alejandro-medici/LSIRRBULL
libs/physics/src/BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.cpp
#include "BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.h" #include "BulletCollision/CollisionDispatch/btCollisionObject.h" #include "BulletCollision/CollisionShapes/btCompoundShape.h" #include "BulletCollision/BroadphaseCollision/btDbvt.h" #include "LinearMath/btIDebugDraw.h" #include "LinearMath/btAa...
ALGO
0.999021
6.798911
11b0ca12-0177-4f9c-9e49-19045a1a90f4
AlexanderPro/Stepik
YandexIntroCpp/1_10/1_10_4.cpp
/* Переведите символ в верхний регистр. Входные данные Вводится единственый символ. Выходные данные Если введеный символ является строчной буквой латинского алфавита, то выведите такую же заглавную букву. В противном случае выведите тот же символ, который был введен. Sample Input: b Sample Output: B */ #include <i...
ALGO
0.91741
5.31928
808ff22e-19e5-43e7-9d67-787bb5446889
janmlam/TDT4102
oving1/opp.cpp
#include <iostream> using namespace std; //a) int max(int a, int b) { if(a>b) { cout <<"A is greater than B" << endl; return a; } else { cout << "B is greater than or equal to A" << endl; return b; } } //c) int fibonacci(int n) { int a = 0; int b = 1; cout << "Fibonacci numbers:" << endl; for(int i=1; i...
ALGO
0.996181
3.168273
0bf37b8d-6f96-40be-8505-035f42864dd3
kiprasmel/competitive-programming
codeforces/cf1430/cf1430b-barrels.cpp
#pragma GCC optimize ("O3") #pragma GCC target ("sse4") #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; const ll INF = (1e9 + 7); #if (0 || defined(DEBUG)) && !defined(EVAL) #define LOG(x) std::cout << x << "\n" #define LOGS(x) std::cout << x << " " #define LO(x)...
ALGO
0.999938
4.281817
f10cb662-19b9-4b02-8d01-2f473cd39d3c
ishandutta2007/codeforces
waterfalls/normal/651/A.cpp
#include <bits/stdc++.h> using namespace std; int a,b; int main() { scanf("%d%d",&a,&b); int ans = 0; while (a>0 && b>0) { if (a>b) swap(a,b); if (b<=1) break; ans+=1; a+=1; b-=2; } printf("%d\n",ans); return 0; }
ALGO
0.99978
3.567271
c9bc648b-f33d-4bfb-a0c5-b92c38e23755
NanoClem/Picture_processing
synth_img1/TP01/Cercle.cpp
//DECOOPMAN Clément #include <iostream> #include <math.h> using namespace std; #include "Cercle.hpp" //Constructeur Cercle::Cercle(float _centreX, float _centreY, float _rayon, unsigned int _nbpoints) : centreX(_centreX), centreY(_centreY), rayon(_rayon), nbpoints(_nbpoints), coords(nullptr) //, points(nullptr) { ...
TOOL
0.967293
3.261546
018bc1ae-70e9-4e77-9e10-f6ce9d82418b
sarvex/leetcode-assembly
solution/0800-0899/0864.Shortest Path to Get All Keys/Solution.cpp
class Solution { public: const static inline vector<int> dirs = {-1, 0, 1, 0, -1}; int shortestPathAllKeys(vector<string>& grid) { int m = grid.size(), n = grid[0].size(); int k = 0; int si = 0, sj = 0; for (int i = 0; i < m; ++i) { for (int j = 0; j < n; ++j) { ...
ALGO
0.999922
5.620574
1ddbb4f0-8e2b-44dc-afee-1cfd5d99d38a
VRaj361/DataStructure
Recursion/ReplaceCharacter.cpp
#include<iostream> using namespace std; string replaceCharacter(string str,char c,char r){ if(str.length()==0){ return str; } char c1; if(str.at(0)==c){ c1=r; }else{ c1=str.at(0); } string s=replaceCharacter(str.substr(1),c,r); return c1+s; } int main(){ cout<...
ALGO
0.999843
3.663389
0f5e61fe-9a9d-4596-aa8e-4396c823ccbe
merge34/hometask
semester_1/homework_12/problem_2/main.cpp
#include <iostream> #include <fstream> #include <vector> #include <algorithm> #include <iterator> #include "dsu.h" using namespace std; struct Edge { int from, to; int length; }; using Graph = vector<Edge>; ostream &operator<<(ostream &outputStream, Edge edge) { outputStream << edge.from << ' ' << edge.to << ' '...
ALGO
0.999547
4.295998
759c16e1-4005-4dd1-b511-61af5d23697d
Bilkis-A-Dalia/Algorithm
Module-2.5/count_negative_num.cpp
class Solution { public: int countNegatives(vector<vector<int>>& grid) { int m = grid.size(); int n = grid[0].size(); int c = 0; for (int i = m - 1; i >= 0;i--) { for (int j = m - 1; j >= 0;j--) { if (grid[i][j] < 0) { c++; } ...
ALGO
0.999983
6.288014
1dea8f7c-36ad-43d2-9962-70a1a490106a
svn2github/qmcpack
qmcpack-coral/src/LongRange/TwoDEwaldHandler.cpp
namespace qmcplusplus { void TwoDEwaldHandler::initBreakup(ParticleSet& ref) { LR_rc=ref.Lattice.LR_rc; LR_kc=ref.Lattice.LR_kc; Sigma=LR_kc; //determine the sigma while(erfc(Sigma)/LR_rc>1e-16) { Sigma+=0.1; } app_log() << " TwoDEwaldHandler Sigma/LR_rc = " << Sigma ; Sigma/=LR_rc; app_log() ...
ALGO
0.966752
3.677429
4e835f9a-e9a5-4e35-a62a-12e5219b7360
Sean0628/competitive_programming
atcoder/abc/abc184/a.cpp
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); ++i) using ll = long long; using P = pair<int, int>; int main() { int a, b, c, d; cin >> a >> b >> c >> d; int ans = a*d - b*c; cout << ans << endl; return 0; }
ALGO
0.999725
4.249257
eb55cf78-d5a0-4509-8d16-bc075e9260c1
Duckyson/CW
电子表格.cpp
#include<stdio.h> #include<string.h> int main(){ int r,c,i,l; scanf("%d %d",&r,&c); int a[100][100]; for(i=0;i<r;i++){ for(l=0;l<c;l++){ scanf("%d",&a[i][l]); } } int n,x,y; char str[3]; scanf("%d",&n); for(;n>0;n--){ getchar(); scanf("%s",&str); if(strcmp(str,"SR")==0){ scanf("%d %d",&x,&y); ...
ALGO
0.999563
3.125831
6a2f9662-d526-4fe6-8cce-ec4021d1f4e6
ishandutta2007/codeforces
timmyfeng/normal/840/C.cpp
#include <bits/stdc++.h> using namespace std; template <int M> struct modint { int val = 0; modint() {} modint(int a) : val(a) { while (val < 0) { val += M; } while (val >= M) { val -= M; } } modint(long long a) : val(a % M) { if (val < 0) { val += M; } } mo...
ALGO
0.99998
4.485913
a96e24ad-4b3e-4c6a-8123-e6e63921687e
Shubham-Raj-25/LeetCode-Solutions
2076-sum-of-digits-of-string-after-convert/2076-sum-of-digits-of-string-after-convert.cpp
class Solution { public: int getSum(string s, int k){ if(k == 0) return stoi(s); int sum = 0; for(char c : s) sum += c - '0'; if(sum >= 10) return getSum(to_string(sum),k-1); return sum; } int getLucky(string s, int k) { str...
ALGO
0.999928
5.190468
484023ad-41e9-4ae9-84a5-9b474ed39017
ishandutta2007/codeforces
kizen/normal/1097/B.cpp
#include <bits/stdc++.h> using namespace std; int N; int arr[24], f; void sol(int pos, int val){ if(pos==N+1){ if(((val+360000)%360)==0) f = 1; return; } sol(pos+1, val+arr[pos]); sol(pos+1, val-arr[pos]); } int main(){ scanf("%d", &N); for(int i=1;i<=N;++i) scanf("%d", arr+i...
ALGO
0.999896
3.687437
e562ad82-a87e-4e66-af91-6c11fa8ec30a
IMpcuong/toy-projects
codeforces/B_1454.cpp
#include <algorithm> #include <bits/stdc++.h> #include <cmath> // clang++ -isystem . -std=c++20 -g -Wall -Wextra -O3 tmpl.cpp -o out using namespace std; template <typename A, typename B> ostream &operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; } template <type...
ALGO
0.999706
5.418272
ed30a1b7-1c24-4c69-8ce6-38ff59990400
badoil/cpp
algorithm/week2(dfs,bfs)/dfs.cpp
// connected component // 가장 기본적인 깊이우선 탐색 예제 // 종화는 21세기 유명한 방구쟁이다. 종화는 방구를 낄 때 "이러다... 다 죽어!!" 를 외치며 방구를 뀌는데 // 이렇게 방귀를 뀌었을 때 방귀는 상하좌우 네방향으로 뻗어나가며 종화와 연결된 "육지"는 모두 다 오염된다. // "바다"로는 방구가 갈 수 없다. 맵이 주어졌을 때 종화가 "이러다... 다 죽어!!"를 "최소한" 몇 번외쳐야 모든 맵을 오염시킬 수 있는지 말해보자. 1은 육지며 0은 바다를 가리킨다. // 범위 // 1 <= N <= 100 // 1 <= M...
ALGO
0.999949
4.479465
dd92d656-0f61-4184-9edb-d8828697af0e
trinhvanvinh/cocos-2d-js-Tutorial
frameworks/cocos2d-x/cocos/2d/CCAutoPolygon.cpp
#include "2d/CCAutoPolygon.h" #include "poly2tri/poly2tri.h" #include "base/CCDirector.h" #include "renderer/CCTextureCache.h" #include "clipper/clipper.hpp" #include <algorithm> #include <math.h> USING_NS_CC; static unsigned short quadIndices9[]={ 0+4*0,1+4*0,2+4*0, 3+4*0,2+4*0,1+4*0, 0+4*1,1+4*1,2+4*1, 3+4*...
ALGO
0.997678
4.487389
7ee04242-74fd-4849-a68f-6ff9dee94754
NehaVerma14/CE2018_rn58_rn59_BST
linkedBST.cpp
#include "linkedBST.h" #include <iostream> using namespace std; int main() { cout<<"***Binary Tree Linked List Implementation***"<<endl<<endl; LinkedBST tree; //adding data tree.add(50); tree.add(90); tree.add(41); tree.add(254); tree.add(15); tree.add(125); tree.add(47); ...
ALGO
0.999779
5.456988
57d79982-2b2f-4361-a108-1e25c5b132c7
ishandutta2007/codeforces
mangooste/normal/1236/B.cpp
#include <algorithm> #include <cmath> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <random> #include <set> #include <string> #include <vector> using namespace std; using ll = long long; using pii = pair<int, int>; // #define int long long #define all(a) a.begin(),...
ALGO
0.999996
5.072726
4f2b3194-cfab-49ec-9a3a-68d6a46d9b35
ghulam2545/dsa
recursion/count_down.cpp
#include <iostream> using namespace std; void count_down(int n) { if (n < 0) return; cout << n << ' '; count_down(n - 1); } int main() { count_down(13); return 0; }
ALGO
0.999804
5.482061
01f8cad4-7c07-4dd9-bd15-7ff9b7326bad
solareenlo/atcoder
05_AtCoder-Beginner-Contest/abc112/C/C_001-WA.cpp
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < (n); i++) using namespace std; using ll = long long; const int dx[4] = {0, 1, 0,-1}; const int dy[4] = {-1,0, 1, 0}; int main(){ cin.tie(0)->sync_with_stdio(false); int n; cin >> n; int N = 101; vector<vector<int> > p(N, vector<int>(N, 0)); REP(i...
ALGO
0.999822
3.712298
164434d0-b19f-4950-ba1f-fa8765b6307f
uniking/study-linux-Demo
hadoop/ml/bandit-algorithms/eigen-3.2.4/doc/examples/TutorialLinAlgComputeTwice.cpp
#include <iostream> #include <Eigen/Dense> using namespace std; using namespace Eigen; int main() { Matrix2f A, b; LLT<Matrix2f> llt; A << 2, -1, -1, 3; b << 1, 2, 3, 1; cout << "Here is the matrix A:\n" << A << endl; cout << "Here is the right hand side b:\n" << b << endl; cout << "Computing LLT...
ALGO
0.999954
3.145425
741f0ddd-5373-497a-a52b-c8095efe133e
rPankaj05/Leetcode_Solutions
0239-sliding-window-maximum/0239-sliding-window-maximum.cpp
class Solution { public: vector<int> maxSlidingWindow(vector<int>& nums, int k) { vector<int> ans; deque<int> dq; for(int i=0;i<nums.size();i++){ if(!dq.empty() and i-dq.front()>=k) dq.pop_front(); while(!dq.empty() and nums[dq.back()]<nums[i]) dq.pop_back(); ...
ALGO
0.999992
6.346598
3aee73ec-0167-4dad-941a-230efbb520d0
alibaba/sionnx
llvm/lib/Analysis/IntervalPartition.cpp
#include "llvm/Analysis/IntervalPartition.h" #include "llvm/Analysis/Interval.h" #include "llvm/Analysis/IntervalIterator.h" #include "llvm/Pass.h" #include <cassert> #include <utility> using namespace llvm; char IntervalPartition::ID = 0; INITIALIZE_PASS(IntervalPartition, "intervals", "Interval Par...
ALGO
0.986373
7.577348
42f08904-9bf2-4900-9519-23d777aaba0b
MichaelJohmson/passport
Codeforces/1368/andorsquare.cpp
#include <bits/stdc++.h> using namespace std; int main(){ int powers[21] = {}; //we compile the amount of "powers" of two present in total, then create numbers based on passing through the array and taking at most one of each power if present. //this is because of the nature of AND and OR - we can think of the OR re...
ALGO
0.999919
4.936857
7edc1dd1-a73f-4a83-912c-aaae0126ff21
rudrakh22/CodingNinjas-DSA-course
DynamicProgramming2/LootHouse.cpp
#include<iostream> using namespace std; //brute force int lootHouse(int *input,int n){ if(n<0){ return 0; } int a=input[n]+lootHouse(input,n-2); int b=lootHouse(input,n-1); return max(a,b); } //mmemoisation int lootHouse_mem(int *input,int n,int* output){ if(n<0){ return 0; }...
ALGO
0.99998
4.086599
643a077a-ffa5-4a40-b3c8-6bd6a2e4aae5
Tiger1994/LeetCode
Q94.cpp
#include<vector> #include<stack> using namespace std; //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: void inorder(TreeNode *t, vector<int> &result){ if (!t) return; i...
ALGO
0.999998
6.395293
6a30dcff-01f1-4836-8341-15f23ee36163
Vinaykumarkajjapu2311/DailyLeetCodeSolutions
0965-unique-email-addresses/0965-unique-email-addresses.cpp
class Solution { public: int numUniqueEmails(vector<string>& emails) { unordered_set<string>st; for(auto str:emails) { int i=0; int n=str.size(); while(true) { if(str[i]=='@')break; if(str[i]=='+') ...
ALGO
0.999428
5.839921
f7150ec8-42fa-4e8b-a81e-b4dfa23a6942
moon1198/Leetcode
graph/solution417.cpp
#include <bits/stdc++.h> using namespace std; int dir[4][2] = {0, 1, 1, 0, 0, -1, -1, 0}; void recur417_0(vector<vector<int>>& heights,vector<vector<vector<bool>>>& flag, int i , int j, int index) { flag[i][j][index] = true; for (int k = 0; k < 4; ++ k) { int nextx = i + dir[k][0]; int nexty ...
ALGO
0.999973
5.377115
908085c9-3a64-4af4-8ecf-d9f7c4d0e306
Smith-Br/Contest
MARISAOJ/473.cpp
#include <iostream> #include <algorithm> #include <cstdio> #include <vector> #include <cstring> #include <string> #include <cmath> #include <utility> #include <map> #include <set> #include <queue> #include <stack> using namespace std; typedef long long ll; #define endl '\n' #define pb push_back #define ff first #def...
ALGO
0.999904
3.2738
74159844-01d4-4c70-836f-6b887f9707fb
kamyu104/LintCode
C++/word-break.cpp
// Time: O(n * l^2), l is the max length of the words. // Space: O(n) class Solution { public: /** * @param s: A string s * @param dict: A dictionary of words dict */ bool wordBreak(string s, unordered_set<string> &dict) { const int n = s.length(); size_t max_len = 0; f...
ALGO
0.998694
6.203636
e8a60e3f-642f-4fec-bba6-5798e9edaea8
RoadToExclusivity/OOP_Lab2
lab2_task1/lab2_task1/Perform.cpp
#include "stdafx.h" #include "Perform.h" void Perform(vf &a) { if (!a.size()) { return; } auto res = minmax_element(a.begin(), a.end()); float min = *res.first, max = *res.second; float product = min * max; transform(a.begin(), a.end(), a.begin(), [product](float n) -> float { return (n < 0) ? n * product ...
ALGO
0.996429
4.382063
cbfe7a97-562b-40e3-94de-3381b940b0a0
pavnvar/algo-toolbox
solutions/week5_dynamic_programming1/4_longest_common_subsequence_of_two_sequences/lcs2.cpp
#include <iostream> #include <vector> using std::vector; int lcs2(vector<int> &a, vector<int> &b) { //write your code here return std::min(std::min(a.size(), b.size()), c.size()); } int main() { size_t n; std::cin >> n; vector<int> a(n); for (size_t i = 0; i < n; i++) { std::cin >> a[i]; } size_...
ALGO
0.9999
4.325328
cfdd9fd8-59ca-4b12-a2ab-a8f60c1392ae
Kaditya67/leetcode-submissions
LeetCode/2434-design-a-number-container-system/design-a-number-container-system.cpp
class NumberContainers { public: //Space : O(n) unordered_map<int, int> idxToNum; unordered_map<int, priority_queue<int, vector<int>, greater<int>>> numToIdx; NumberContainers() { //do nothing } void change(int index, int number) { idxToNum[index] = number; //O(1) ...
ALGO
0.99996
5.675351
1e1bafbd-72bc-4eba-8eff-70be4d497ce3
TNishimoto/rlbwt_iterator
src/debug/sampling_sa_main.cpp
#include <cassert> #include <chrono> //#include "../common/cmdline.h" //#include "../common/print.hpp" //#include "../common/io.h" #include "../include/rlbwt_iterator.hpp" #include "../include/bwt.hpp" #include "stool/include/io.hpp" #include "stool/include/cmdline.h" #include "stool/include/debug.hpp" using namespa...
ALGO
0.993536
5.113114
7b7ebcce-07fd-4347-b36b-f51ebbda9d29
ZJU-warren/LeetCode
0034.cpp
class Solution { public: int LowerBound(int key, vector<int>& nums){ int left = 0, right = nums.size(); while(left < right){ int mid = (left + right) / 2; if(nums[mid] < key) left = mid + 1; else right = mid; ...
ALGO
0.999992
6.238019
bd52a60a-029e-4c13-ab84-e4659641d91f
omkarlenka/leetcode
find_eventual_safe_states_lc802.cpp
#include <iostream> #include <unordered_map> #include <unordered_set> #include <vector> using namespace std; class Solution { bool dfs(unordered_map<int,vector<int>> &M, int current, unordered_map<int,bool> &visited, unordered_set<int> &local_visited){ if(local_visited.find(current) != local_visited.end()...
ALGO
0.999979
5.703639
9a5e2da3-57fc-4af8-b477-ce45993db8a2
emanueljuliano/Competitive_Programming
cf/cf_611/c2.cpp
#include <bits/stdc++.h> using namespace std; #define _ ios_base::sync_with_stdio(0);cin.tie(0); #define endl '\n' #define pb push_back typedef long long ll; mt19937 rng((int) chrono::steady_clock::now().time_since_epoch().count()); // testing cf rejudge 3 int main(){ _ int n; cin >> n; vector<int> v(n); for(aut...
ALGO
0.999994
3.929636
ee3c152b-afd3-42d8-8f1e-312bca0d7b08
neurorishika/TurnerLab_FlyBaVR_Controller
Unused Code/FicTrac v2.0 (Not Working Well !!)/fictrac2_source/src/geometry.cpp
#include "geometry.h" #include "CameraModel.h" #include "SquareRT.h" #include "Logger.h" #include <opencv2/opencv.hpp> #include <cmath> // sqrt, cos, sin #include <vector> using cv::Mat; using cv::Point; using cv::Point2d; using cv::Rect; using std::vector; using std::string; /// /// Fit a plane to 3D points us...
ALGO
0.999314
6.079914
d11c30c3-5f42-4e7d-bea5-da94f9c76568
shashanktaneja/Leetcode
0151-reverse-words-in-a-string/0151-reverse-words-in-a-string.cpp
class Solution { public: string reverseWords(string &s) { int i=0; int n = s.size(); string ans; string cur=""; vector<string> v; while(i<n){ if(s[i]==' '){ if(cur!=""){ v.push_back(cur); } ...
ALGO
0.999982
6.10533
b0f95b81-bb62-4695-90b1-671c04dfaa49
yongwhan/codeforces
1175C.cpp
#include<bits/stdc++.h> using namespace std; int a[200005]; int main() { int t; cin>>t; while(t--) { int n,k; cin>>n>>k; for (int i=1; i<=n; i++) cin>>a[i]; int i,j; for(i=j=1;i+k<=n;i++) if(a[i+k]-a[i]<a[j+k]-a[j]) j=i; cout<<(a[j]+a[j+k])/2<<endl; } return 0; }
ALGO
0.999968
3.335379
e4b3dd41-c303-45c0-8962-b5d47fa20ee7
yummydum/atcoder
168/a.cpp
#include <bits/stdc++.h> using namespace std; using ll = long long; #define _GLIBCXX_DEBUG #define rep(i, c) for (int i = 0; i < (int)c; i++) #define debug(x) cout << #x << " = " << x << endl #define print(x) cout << x << endl; const ll MOD = 1000000007; int main() { int N; cin >> N; N = N % 10; if (N ...
ALGO
0.997499
3.468447
0c6981ca-2a99-4cc4-9b0b-73a05f4f487f
okcd00/CDKeeper
Online_training/2017 MUTC/多校联合01 标程及数据/标程/1005.cpp
#include <cstdio> #include <algorithm> #include <unordered_map> namespace int128_t { typedef unsigned long long ULL; const int BLEN = 40; const ULL BASE = (1ULL << BLEN) - 1; // [0, BASE] struct BigInt { ULL upp, low; BigInt() : upp(0), low(0) {} BigInt(int _low) : upp(0), low(_low) {} BigInt(ULL _upp, ULL...
ALGO
0.99993
3.422621
8c1a5f04-0ae2-488c-9a64-7d59bbf140ac
yushroom/Kinect2
stereo_calib/stereo_calib.cpp
#include "opencv2/calib3d/calib3d.hpp" #include "opencv2/highgui/highgui.hpp" #include "opencv2/imgproc/imgproc.hpp" #include <vector> #include <string> #include <algorithm> #include <iostream> #include <iterator> #include <stdio.h> #include <stdlib.h> #include <ctype.h> using namespace cv; using namespace std; stat...
TOOL
0.922063
6.051083
9fbefe4a-1eef-49a6-babf-499105fe6bfd
SeonJun-Hwang/PS
Binary Search/2110.cpp
/* 2110 ġ Binary Search 2019 02 12 - - */ #include <iostream> #include <algorithm> #include <vector> using namespace std; const int MAX = 200000; bool exist[MAX + 1]; int main() { ios_base::sync_with_stdio(false); cin.tie(0); int n, c; cin >> n >> c; vector<int> v(n); for (int i = 0; i < n; i++) ci...
ALGO
0.999998
4.164933
deb4ad38-2e85-4692-8d12-5464c0517b60
BorjaAdayUCM/Programacion-Competitiva
UVA/350.cpp
#include <iostream> #include <vector> #include <set> using namespace std; int main() { int numCasos = 1; int Z, I, M, L; cin >> Z >> I >> M >> L; while (Z != 0 || I != 0 || M != 0 || L != 0) { vector<int> vect = vector<int>(); set<int> conjunto; int longuitud = -1; while (vect.size() == conjunto.size()) ...
ALGO
0.999581
3.348665
654afb2b-2fd4-4f9f-8e52-d991bfa7a032
chanwowow/Algorithm-Study
Certi/Pro/마법문자열/user.cpp
#define MAXTRIE 20000 ///>>>>"??? 26^3 #define MAXUNION 100000 #include <unordered_map> #include <unordered_set> #include <list> #include <vector> #include <memory.h> using namespace std; int parent[MAXUNION]; int newTrieID; unordered_set <int> trieID_Q; //vector <int> strID_Q; int findParent(int trieID) { int p...
ALGO
0.997585
3.129332
dba12a07-fbb4-4b20-b56b-185bd3fc10ac
pkkj/ACM-ICPC-OJ-Code
ICPC.Regional/2006.Beijing/la3662.cpp
// 2006 Beijing: Another Minimum Spanning Tree // ACM-ICPC Live Archive 3662 #include <cstdio> #include <cstring> #include <cmath> #include <algorithm> using namespace std; #define N 100005 #define BIG 100000000 const int INF = 1 << 30; struct POINT { int x, y; void get() { scanf("%d%d", &x, &y); } void print() ...
ALGO
0.999902
4.171838
ff782719-1a0a-4bdd-92cc-c7c981dea078
anas8180/chat_app_gpt
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
bd0868ac-5fb5-4a70-acac-430288d65e57
FiNly17/ftp
lab9osn/lab9osn/lab9osn.cpp
//V13 //#include <iostream> //using namespace std; //int dnx(int n, int x) { // if (x == 1) return 1; // else if ((n % x == 0) && (x > 1)) return dnx(n, x - 1) + 1; // else if ((n % x != 0) && (x > 1)) return dnx(n, x - 1); // else cout << "Ошибка!"; //} //int main() { // setlocale(LC_ALL, "rus"); // cout << "Найдем ре...
ALGO
0.999622
4.717281
4ae7b0a8-12eb-492d-ba30-5df040afb4ec
alexandraback/datacollection
solutions_5695413893988352_0/C++/yoyoyo/b.cpp
#include <iostream> #include <cstdio> #include <algorithm> #include <vector> #include <cmath> #include <cstring> using namespace std; void solve() { char c[20], j[20]; int cn[20] = {0}; int jn[20] = {0}; scanf("%s%s", c, j); int l = strlen(c); for(int i = 0; i < l; i++){ if(c[i] == '?') cn[i] = -1; else ...
ALGO
0.999913
3.103882
60244fd6-b1d7-4f38-b041-c8c29f1e2175
Lonely-DM/SIT315
M3.T1P/mpi_matrix_multiply.cpp
#include <mpi.h> #include <iostream> #define N 100 // Matrix size void matrixMultiply(int A[N][N], int B[N][N], int C[N][N], int start, int end) { for (int i = start; i < end; i++) { for (int j = 0; j < N; j++) { C[i][j] = 0; for (int k = 0; k < N; k++) { C[i][j] +...
ALGO
0.999991
5.402105
cf9b1fc7-4c6d-47cb-942c-4b408fd863b0
NaveenKumarDongre/Cplusplus-Programming
C++ Pointers/Pointers1.cpp
#include<iostream> using namespace std; int main(){ // Data variable int x = 10; // Address variable int* p; p = &x; cout << p << endl; cout << x << endl; cout << *p << endl; (*p++); cout << p << endl; cout << *p << endl; (*p)++; cout << x << endl; ...
TOOL
0.860354
3.790242
2cc4f775-fd07-4f6f-9d8a-98916efc0e51
C0D1NG/Programming
C++/Glitches_Palindrome number.cpp
#include<iostream> using namespace std; int main() { int i,digit,number,rev; cout<<"enter a number which is positive : "<<endl; cin>>number; i=number; do { digit = number % 10; rev = (rev * 10) + digit; number = number / 10; } while (number != 0); cout << "The reverse...
ALGO
0.999583
3.348322
b3db4061-c5f7-456e-854f-f012267c01cc
jesuswr/cp-codes-and-problems
B.NickandArray.cpp
#include <iostream> using namespace std; int numbs[int(1e5)+5]; int main() { int n; scanf("%d", &n); int aux = 0; int mn = 1e7; int minind; for (int i = 0; i < n; ++i) { scanf("%d", &aux); if (aux >= 0) aux = -aux - 1; numbs[i] = aux; if (numbs[i] < mn ) { mn = numbs[i]; minind = i; } } i...
ALGO
0.99998
3.678504
e8908354-5c8c-48eb-8d4c-ad385a5350d1
phuong-dinhmai/Cpp
Graph/UVA 11831.cpp
#include <bits/stdc++.h> using namespace std; int n,m,len; char a[100][100]; char s[50000]; int x,y; char dir; int ans; void test(char c) { if (c == 'F') { if (dir == 'N') if (x > 0 && a[x-1][y] != '#' && x < n) x--; if (dir == 'S') if (x < n - 1 && a[x+1][y] != '#' && x < n) x++; if (dir == 'L') if...
ALGO
0.9998
3.479733
37f60d64-6301-457f-9e82-be5c1aa69afc
Raghavjajooc123/DSA-Practice
StriverSheet/Day17/leftView.cpp
void leftViewHelper(Node* root, int level, int& maxL, vector<int>& ans){ if(root == NULL) return; if(level>maxL){ ans.push_back(root->data); maxL = level; } leftViewHelper(root->left, level+1, maxL, ans); leftViewHelper(root->right, level+1, maxL, ans); return; } vector<int> left...
ALGO
0.999954
5.347756
7285b5d6-370b-492b-9c67-fa54eb632fc3
Many2333/image_segmentation
boost_1_63_0/libs/geometry/index/example/benchmark3.cpp
// Boost.Geometry Index // Additional tests #include <iostream> #include <boost/geometry.hpp> #include <boost/geometry/index/rtree.hpp> #include <boost/chrono.hpp> #include <boost/foreach.hpp> #include <boost/random.hpp> #include <set> int main() { namespace bg = boost::geometry; namespace bgi = bg::index; ...
TEST
0.911872
6.063844
cb8a28f0-8511-45b8-b1b6-64aa4bc86f1a
roytanmay/codeforces-contests
ECR169/a.cpp
#include <bits/stdc++.h> using namespace std; int mod = 1000000007; #define int long long #define pyes cout << "YES" << endl #define pno cout << "NO" << endl signed main() { int t = 1; cin >> t; while (t--) { int n; cin >> n; vector<int> x(n); for (int i = 0; i < n; i+...
ALGO
0.990998
3.725441
3ec6d114-c719-4d21-ad6b-b26641c37644
sarvex/leetcode-carbon
solution/2000-2099/2062.Count Vowel Substrings of a String/Solution.cpp
class Solution { public: int countVowelSubstrings(string word) { int ans = 0; int n = word.size(); for (int i = 0; i < n; ++i) { unordered_set<char> t; for (int j = i; j < n; ++j) { char c = word[j]; if (!isVowel(c)) break; ...
ALGO
0.99986
6.635048
d68556d2-89e5-4bde-b54f-d7c8a56b0f92
nh246/Learned-C_plus-plus
cddc.cpp
#include <iostream> #include <string> #include <vector> using namespace std; // Define a structure for storing book information struct Book { string title; string author; int publicationYear; }; // Function to display menu options void displayMenu() { cout << "1. Add a new book\n"; cout << "2. Vi...
TOOL
0.947288
7.078187
b3ad5bcf-6eb3-4808-abb4-0bb491ccd799
kanavbengani/Cplusplus-Exercises
Edoflip/MultUsingRec.cpp
#include <iostream> using namespace std; int multiply(int a, int b) { if (b == 0) { return 0; } int recursion = multiply(a, b - 1); return a + recursion; } int main() { int a, b; cin >> a >> b; cout << multiply(a, b); }
ALGO
0.999887
4.51282
31f02ea8-0c43-45e5-9473-d8aaac90323f
Aniketdimri/hackerrank-questions
Trapping_Rain_Water.cpp
#include<bits/stdc++.h> using namespace std; int trap(int arr[], int n) { int left[n]; int right[n]; int water = 0; left[0] = arr[0]; for (int i = 1; i < n; i++) left[i] = max(left[i - 1], arr[i]); right[n - 1] = arr[n - 1]; for (int i = n - 2; i >= 0; i--) right[i] =...
ALGO
0.999863
5.957618
05cd8b5f-e281-443a-a523-3d477f696138
AryanKatariya/Cplusplus--DSA
array/containDuplicate.cpp
#include<iostream> #include<vector> #include<algorithm> using namespace std; bool containsDuplicate(int arr[],int n) { sort(arr,arr+n); for(int i=0;i<n-1;++i){ if(arr[i] == arr[i+1]){ return true; } } return false; } int main(){ int arr[] = {1,2,3,1}; int n = sizeof(arr...
ALGO
0.999054
4.171231
f43e08d7-8de9-4bb8-9e75-38939d1968ee
almishra/metadirective
clang-tools-extra/clang-tidy/utils/OptionsUtils.cpp
#include "OptionsUtils.h" namespace clang { namespace tidy { namespace utils { namespace options { static const char StringsDelimiter[] = ";"; std::vector<std::string> parseStringList(StringRef Option) { SmallVector<StringRef, 4> Names; Option.split(Names, StringsDelimiter); std::vector<std::string> Result; ...
TOOL
0.937851
7.261842
fad33443-2a75-46c7-a92b-a7c427e5e6c4
quanglm1998/competitive-programming
codeforces/1336/b.cpp
#include <bits/stdc++.h> using namespace std; const int N = 300010; int n[3]; pair<int, int> a[N]; int l[3][N], r[3][N]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int tc; cin >> tc; while (tc-- ){ cin >> n[0] >> n[1] >> n[2]; int cur = 0; for (int i = 0; i < 3; i...
ALGO
0.999861
4.10457
8dfa2fb3-5d9e-467d-983f-7e8de1ca20cb
themanjeetkr/DSA-PRACTICE
Patterns/p3.cpp
#include<iostream> using namespace std; int main(){ int n; cin>>n; int i=1; while (i<=n) { int j=1; while (j<=n) { cout<<j; j=j+1; } cout<<"\n"; i++; } }
ALGO
0.999952
3.888729
e07d532b-aeff-47e4-ab4b-617fe558a022
nazfisa/Problem-Solving
hackerrank/19.cpp
#include<bits/stdc++.h> using namespace std; int main() { int max=0,t1,t2,p,c,j,i; cin>>p>>t1>>t2; int a[t1],b[t2]; for(i=0; i<t1; i++) { cin>>a[i]; } for(i=0; i<t2; i++) { cin>>b[i]; } for(i=0; i<t1; i++) { for(j=0; j<t2; j++) { ...
ALGO
0.999826
3.337769
52403704-b869-4b2e-9fe6-976b180041b7
pathadeTush/Problems-450
stack-queues/310-sortStackUsingRecursion.cpp
// { Driver Code Starts #include <bits/stdc++.h> using namespace std; class SortedStack { public: stack<int> s; void sort(); }; void printStack(stack<int> s) { while (!s.empty()) { printf("%d ", s.top()); s.pop(); } printf("\n"); } int main() { int t; cin >> t; whi...
ALGO
0.999847
5.962572
cff2f408-0369-4099-8923-fef60d862ec1
xray-storage/OP-Engine
SDK/boost_1_30_0/libs/numeric/ublas/doc/samples/matrix_range_project.cpp
#include <boost/numeric/ublas/matrix.hpp> #include <boost/numeric/ublas/io.hpp> int main () { using namespace boost::numeric::ublas; matrix<double> m (3, 3); for (unsigned i = 0; i < m.size1 (); ++ i) for (unsigned j = 0; j < m.size2 (); ++ j) project (m, range (0, 3), range (0, 3)) (i,...
ALGO
0.997757
3.738381
36d2911c-5b9a-4487-a02a-d27d3d80a005
flexflow/flexflow-serve
src/ops/aggregate_spec.cpp
#include "flexflow/ops/aggregate_spec.h" #include "flexflow/utils/hip_helper.h" #include <hip/hip_runtime.h> namespace FlexFlow { __global__ void aggspec_forward_kernel(float **exp_preds, int const *exp_assign, float *output, int n, ...
ALGO
0.975574
5.9114
7c1c56c5-b45d-417c-bf89-44f70d96a6d8
jagrut08/cpp11
LC1/5.1.7.cpp
#include <iostream> #include <memory> #include <vector> #include <utility> // for std::swap struct TreeNode { int val; std::shared_ptr<TreeNode> left, right; TreeNode(const int v = 0) : val(v), left(nullptr), right(nullptr) {} ~TreeNode() {} TreeNode(const TreeNode& n) : val(n.val), left(n.left), right(n.right) ...
ALGO
0.999972
6.259896
e4a49f9e-63ac-4b7b-b533-3cf5bfc935fb
ash1852/llvm-15-compat-pinpoint
llvm/lib/Analysis/ConstraintSystem.cpp
#include "llvm/Analysis/ConstraintSystem.h" #include "llvm/ADT/SmallVector.h" #include "llvm/Support/MathExtras.h" #include "llvm/ADT/StringExtras.h" #include "llvm/Support/Debug.h" #include <string> using namespace llvm; #define DEBUG_TYPE "constraint-system" bool ConstraintSystem::eliminateUsingFM() { // Implem...
ALGO
0.999561
7.314735
0a8cbe3a-b833-4f1e-8d4a-a7e067bce8b4
K14KHaNaSa/bojPractice
26767.cpp
#include <iostream> using namespace std; int main(void) { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n; cin >> n; for (int i = 1; i <= n; i++) { if (i % 77 == 0) { cout << "Wiwat!\n"; } else if (i % 11 == 0) { cout << "Super!\n"; } else if (i % 7 == 0) { cout << "Hurra!\n"...
ALGO
0.999584
3.425094
37df1b30-e868-4735-959f-8b397e7d13ca
KrishnoMD305/Leetcode
191. Number of 1 Bits/Solution.cpp
class Solution { public: int hammingWeight(int n) { int cnt = 0; while(n>0){ if(n&1){ cnt++; } n >>= 1; } return cnt; } };
ALGO
0.999932
6.219963
c86442bd-051a-4878-b257-18e6ecaa9194
dmsenter89/learningProgramming
Cpp/finance/simple_tree.cpp
/* Simple Tree * * Calculates the price of an option for a three period time frame * given volatility, rate of return/interest rate, initial price of * the stock and strike price. * * =========================== * * Step 1: Get variable values from user, CLI * Step 2: Compute an up and down depending on stock...
ALGO
0.999943
6.381243
05c4f8a4-d693-4cd1-bef6-d58503b07705
raincross7/code-similarity
codes/train_code/problem077/problem077_460.cpp
#include <bits/stdc++.h> typedef long long ll; #define ALL(l) (l).begin(),(l).end() #define rep(i,n) for(ll (i)=0;(i)<(n);(i)++) #define rep2(i, s, n) for (int i = (s); i < (int)(n); i++) using namespace std; //const ll mod = 1000000007; //const ll maxn = 1000000000; //----------------------------------------------...
ALGO
0.999747
4.97217
7e4d345d-1f49-4130-80c7-30f2cc239608
Dboire9/CPP
CPP08/ex01/Span.cpp
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* Span.cpp :+: :+: :+: ...
ALGO
0.95749
4.865028
e5a1dd74-eda7-48bf-b7f0-0885f3fc427c
matcher9131/AtCoder-Repo
abc319/e/main.cpp
#include <iostream> #include <vector> #include <string> #include <algorithm> #include <iomanip> #include <cmath> #include <climits> #include <cfloat> #include <utility> #include <map> #include <set> #include <stack> #include <queue> #include <unordered_map> #include <unordered_set> #include <cassert> #include <numeric>...
ALGO
0.99984
3.961849
23796993-f7af-40f3-8d5c-b30147026e4f
KF93/ORB-SLAM2
Thirdparty/g2o/g2o/core/optimization_algorithm_levenberg.cpp
// Modified Raul Mur Artal (2014) // - Stop criterium (solve function) #include "optimization_algorithm_levenberg.h" #include <iostream> #include "../stuff/timeutil.h" #include "sparse_optimizer.h" #include "solver.h" #include "batch_stats.h" using namespace std; namespace g2o { OptimizationAlgorithmLevenberg::...
ALGO
0.999854
6.444931
a162dfde-0d83-4892-a48a-34dbe353373d
RhoNit/dynamic-programming
3D-DP/best_time_to_buy_and_sell_stocks_3.cpp
class Solution { public: int maxProfit(vector<int>& prices) { // int n = prices.size(); // int buy_flag = 1; // int limit = 2; // int index = 0; // vector<vector<vector<int>>> dp(n+1, vector<vector<int>>(2, vector<int>(3, -1))); // return solveMemo(prices, index, bu...
ALGO
0.999912
6.130535
33106af5-560b-4e7f-9763-651ffb26350c
llluiop/cppleetcode
Reverse String/main.cpp
#include <iostream> #include <string> using namespace std; class Solution { public: string reverseString(string s) { for (size_t i = 0; i < s.length()/2; i++) { char tmp = s[i]; s[i] = s[s.length() - i-1]; s[s.length() - i - 1] = tmp; } return s; } }; int main() { Solution s; std::cout << s.r...
ALGO
0.992619
5.179859
0ded2da5-c083-4fb3-a08a-c93cb812f8b7
MaulikVarshney/JobPrep
Patterns/12.cpp
#include<bits/stdc++.h> using namespace std; void print(int a){ for(int i=0;i<a;i++){ for(int j=1;j<=i+1;j++)cout<<j; for(int k=1;k<=2*(a-i)-2;k++)cout<<" "; for(int l=i+1;l>0;l--)cout<<l; cout<<endl; } } int main(){ int n; cout<<"Enter upper limit you want = "...
ALGO
0.999901
4.007455
6f478f37-a668-4df4-8d36-357c0406b7c5
SamsDRGMods/DRGLib
DRGLib UE project/Plugins/Modio/Source/ThirdParty/NativeSDK/ext/asio/asio/src/examples/cpp11/executors/fork_join.cpp
#include <asio/execution.hpp> #include <asio/static_thread_pool.hpp> #include <algorithm> #include <condition_variable> #include <memory> #include <mutex> #include <queue> #include <thread> #include <numeric> using asio::static_thread_pool; namespace execution = asio::execution; // A fixed-size thread pool used to im...
ALGO
0.998425
7.596829
926396d4-8b21-4035-a141-083cfc29bfa9
min9813/algorithm_contest
contest/abc154/a.cpp
#include <iostream> #include <functional> #include <cstdio> #include <algorithm> #include <cmath> #include <vector> #include <string> #include <set> #include <queue> #include <map> #include <iomanip> #include <complex> #include <random> #include <bitset> #include <list> // #include <prettyprint.hpp> using namespace std...
ALGO
0.999662
3.692449
bb59a91a-2fed-4d60-a544-2c1899f3876f
vedantpople4/LeetCode
389-find-the-difference/389-find-the-difference.cpp
class Solution { public: char findTheDifference(string s, string t) { sort(s.begin(), s.end()); sort(t.begin(), t.end()); for(int i=0;i<s.length();i++){ if(s[i]!=t[i]) return t[i]; } return t[s.length()]; } };
ALGO
0.999916
6.244204
48e99190-c1b6-4480-831f-72ddd4af4135
Diseqoff/Programaci-n
Bloque 4/ejercicio_5.cpp
#include <iostream> #include <conio.h> using namespace std; int main() { int numero = 0, suma = 0; do { cout<<"Digite un numero: "; cin>>numero; if (numero > 0) { suma += numero; } } while ( ((numero < 20) || (numero > 30)) && ((numero != 0)));...
ALGO
0.953021
3.093696
a4826d6d-aa5e-4b60-afb1-c37e7038b199
RaviKumar1123/DSA0150-C-
test.3.17.cpp
#include <iostream> using namespace std; void reverseString(const char* str) { const char* end = str; while (*end) { ++end; } --end; while (end >= str) { cout << *end; --end; } cout << endl; } int main() { const char* str = "Hello"; reverseString(str); r...
ALGO
0.983452
5.816504
7bf1b392-ae95-4e3f-9fc5-58f6f639713d
XeniaDem/ABC
ABCtask2/main.cpp
#include <fstream> #include <time.h> #include "container.h" #include <unistd.h> // Сообщение об ошибке void errMessage1() { printf("Incorrect input data!\n"); } //------------------------------------------------------------------------------ // Получение входного файла FILE *get_input_file(char *argv[]) { if (...
ALGO
0.990049
4.204937
9e78c8bd-6d94-425a-a1ae-e03505f5a8c6
vivek2188/Study
C++ Programming/activity.cpp
#include <bits/stdc++.h> using namespace std; bool comp(pair<int,int>p1,pair<int,int>p2){ if(p1.second<p2.second) return true; return false; } int main(){ int t; cin >> t; while(t--){ int n; cin >> n; vector<pair<int,int> >v; int start[n],end[n]; for...
ALGO
0.999951
3.877883
8a06dd28-27b5-41f9-a728-fbda8b6c703d
ShaipLovchali/Sofia-University
Intro-To-Programming/Week07-Practicum-Tasks-19.11/Task5 - Matrix/Task5 - Matrix.cpp
#include <iostream> #define SIZE 256 using namespace std; int main() { int matrix[SIZE][SIZE] = {}; int n; cin >> n; for (size_t i = 0; i < n; i++) { for (size_t j = 0; j < n; j++) { cin >> matrix[i][j]; } } int equals; bool find = false; for (size_t i = 0; i < n; i++) { bool isValid = true; f...
ALGO
0.999681
4.063727
9e77607e-d761-4df6-8290-f5b1d6d0d1f5
Yashwanth137/GFG-Potd
2024/07 - July/14. Segregate 0s and 1s/Solution.cpp
class Solution { public: void segregate0and1(vector<int> &arr) { int left = 0, right = arr.size() - 1; while (left < right) { while (arr[left] == 0 && left < right) left++; while (arr[right] == 1 && left < right) right--; ...
ALGO
0.999912
5.263257
2488b81d-2f5b-44b5-8acc-c6ac9532c438
Zhenghao-Liu/LeetCode_problem-and-solution
0050.Pow(x,n)(重要)/solution_binary.cpp
//二分法 class Solution { public: double myPow(double x, int n) { if (n==0) return 1; else if (n==1) return x; else if (n==-1) return 1.0/x; double multiple=myPow(x*x,n/2),remainder=myPow(x,n%2); return multiple*remain...
ALGO
0.999978
5.48076
b1691afd-f6ce-439e-9d14-171b613043f2
5511lin/Programming-by-doing
C++/Challenge1/challenge1-4.cpp
#include <iostream> using namespace std; int findSum(int n, int a, int b) { int sum = 0; for (int i = 0; i < n; i++) if (i % a == 0 || i % b == 0) sum += i; return sum; } int main() { int n, a, b; cout << "N: "; cin >> n ; cout << "Number A: "; cin >> a; c...
ALGO
0.999502
3.842748
03826aef-e6a4-4fc7-a863-ba858a65929d
ishandutta2007/codeforces
zqyyy/normal/1395/A.cpp
#include <cstdio> #include <cctype> #define re register using namespace std; inline int read(){ int f=1,r=0;char c=getchar(); while(!isdigit(c))f^=c=='-',c=getchar(); while(isdigit(c))r=(r<<1)+(r<<3)+(c^48),c=getchar(); return f?r:-r; } int r,g,b,w,q; inline void work(){ r=read(),g=read(),b=read(),w=read(); q=(r&...
ALGO
0.999526
3.146507
be16611f-f919-4c40-a964-258b115b09ac
ShadowSlayer03/Data-Structures-in-C
Data Structures C./Imp Algorithms/Knapsack_problem_Dynamic_Programming.cpp
#include <iostream> #include <vector> using namespace std; void solveKnapsack(vector<vector<int>>& v, int m, int n, vector<int>& profits, vector<int>& weights) { int w, i; for (i = 1; i <= n; i++) { for (w = 1; w <= m; w++) { if (weights[i] > w) v[i][w] = v[i - 1][w]; ...
ALGO
0.999988
4.52313
98d38c22-0203-454d-ab1d-29a969b10988
miiitomi/atcoder
ABC/abc344/f.cpp
#include <bits/stdc++.h> using namespace std; using ll = long long; const ll INF = 1e+18; void chopt(pair<ll, ll> &p, pair<ll, ll> q) { if (p.first > q.first || (p.first == q.first && p.second < q.second)) p = q; } void solve() { int N; cin >> N; vector<ll> v; vector<vector<ll>> P(N, vector<ll>(N)...
ALGO
0.999748
3.856001