uuid
string
repo_name
string
relative_path
string
content
string
category
string
algo_rel_score
float64
quality_score
float64
d0237a3e-40fd-4b9e-8e59-9d481de644e3
keshish-kumar/CPP
0957-minimum-add-to-make-parentheses-valid/0957-minimum-add-to-make-parentheses-valid.cpp
class Solution { public: int minAddToMakeValid(string s) { stack<char> st; int ans=0; for(int i=0;i<s.size();i++){ if(s[i]=='('){ st.push('('); } else{ if(!st.empty()){ st.pop(); } ...
ALGO
0.999247
5.972423
a7703e92-4f70-4d1a-a96e-efa260a5e1cf
jonathanventura/multi-camera-motion
test/so3.cpp
#include <Eigen/Core> #include <Eigen/Geometry> Eigen::Matrix3d skew3(const Eigen::Vector3d &v ) { Eigen::Matrix3d s; s << 0, -v[2], v[1], v[2], 0, -v[0], -v[1], v[0], 0; return s; } Eigen::Matrix3d so3exp(const Eigen::Vector3d &r) { if ( r.norm() < 1e-10 ) return Eigen::Matrix3d::Identity...
ALGO
0.991399
6.201019
f5b56b92-b883-4c7c-b2ab-4d72d8465cd5
Samsung/Vyond
chipyard-1.11.0/sims/firesim/platforms/f1/aws-fpga/Vitis/examples/xilinx_2021.2/cpp_kernels/lmem_2rw/src/host.cpp
/******************************************************************************* Description: Vitis Vector Addition to utilize both Ports of BRAM memory *******************************************************************************/ #include "xcl2.hpp" #include <vector> #define DATA_SIZE 4096 int main(int argc, char...
ALGO
0.93248
5.739226
c259055f-c0dc-4278-ac96-4ac85b7351fc
kevinpruvost/boost_openvdb
libs/metaparse/example/compile_to_native_code/main.cpp
#include <boost/metaparse/repeated.hpp> #include <boost/metaparse/sequence.hpp> #include <boost/metaparse/lit_c.hpp> #include <boost/metaparse/last_of.hpp> #include <boost/metaparse/space.hpp> #include <boost/metaparse/int_.hpp> #include <boost/metaparse/foldl_reject_incomplete_start_with_parser.hpp> #include <boost/me...
ALGO
0.917616
6.728292
ee0950c9-5aea-4817-af06-62718eeac7b4
113bommy/deepmind_codecontests_refine
cpp_source_filter_file/cpp_train_1416_7.cpp
#include <bits/stdc++.h> using namespace std; const long long int mod = 1e9 + 7; long long int fexpo(long long int a, long long int b) { if (b == 0) return 1LL; if (b == 1) return a; if (b == 2) return a * a; if (b % 2 == 0) return fexpo(fexpo(a, b / 2), 2); else return a * fexpo(fexpo(a, (b - 1) / 2)...
ALGO
0.99748
3.98653
f6eb181e-afda-482b-980b-ff4733f737df
ianvet31/data_structures-algorithms
lab_dict/fac.cpp
/** * @file fac.cpp * Contains factorial-calculating functions both utilizing and not * utilizing memoization. * * @author Matt Joras * @date Winter 2013 */ #include "fac.h" #include <iostream> #include <map> #include <cstring> #include <stdexcept> using namespace std; const string USAGE = "USAGE: fac [NUM] ...
ALGO
0.999258
7.550655
58ab24bc-a525-4425-9394-8124cf5c1e54
AndryRafam/Algo-Dojo
Element/Climb_Stairs.cpp
/* You are climbing a staircase. It takes n steps to reach the top. * Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top? * Time complexity: O(N) * Space complexity: O(N) */ #include <bits/stdc++.h> using namespace std; class Solution{ public: static int climbS...
ALGO
0.999953
5.576219
d26a57d9-9dc3-4bdc-865e-a763c7fc8885
jarekkt/step2mach
sources/mach_plugin/link/crc16.cpp
#include "crc16.h" /* CRC16 Definitions */ static const uint16_t crc_table[256] = { 0x0000, 0x1189, 0x2312, 0x329b, 0x4624, 0x57ad, 0x6536, 0x74bf, 0x8c48, 0x9dc1, 0xaf5a, 0xbed3, 0xca6c, 0xdbe5, 0xe97e, 0xf8f7, 0x1081, 0x0108, 0x3393, 0x221a, 0x56a5, 0x472c, 0x75b7, 0x643e, 0x9cc9, 0x8d40, 0xbfdb, 0xae52, 0xd...
ALGO
0.98222
5.969576
1ec5e213-936e-4ff3-8ef6-f52a96b34b3f
atharvahamdapure/DSA
14pattern9.cpp
/* Draw this pattern 1 2 3 3 4 5 4 5 6 7 */ #include <iostream> using namespace std; int main() { int n; cin >> n; int row = 1; while (row <= n) { int col = 1; int count = row; while (col <= row) { cout << count << " "; ...
ALGO
0.999811
4.450012
d8edffbd-aa4b-481c-bcec-e3f8e29c0fda
wuxingogo/QQhulian
cocos2d/plugin/jsbindings/manual/pluginxUTF8.cpp
#include "pluginxUTF8.h" namespace pluginx { #define CCLOGERROR(...) do {} while(0) #ifndef NULL #define NULL 0 #endif int cc_wcslen(const unsigned short* str) { int i=0; while(*str++) i++; return i; } /* Code from GLIB gutf8.c starts here. */ #define UTF8_COMPUTE(Char, Mask, Len) \ if (Char <...
TOOL
0.88476
6.108515
37ea5aba-a7d7-483e-aec1-cc5c5fc4e7bc
nocotan/algorithms
atcoder/Cpp/DDCC2017/C.cpp
#include <bits/stdc++.h> using namespace std; #define int long long int memo[200001]; signed main() { int n, c; cin >> n >> c; vector<int> v(n); for(int i=0; i<n; ++i) cin >> v[i]; sort(v.begin(), v.end()); int ans = 0; int cnt = 0; int l = 0; int r = n-1; while(true) { ...
ALGO
0.999987
3.875896
c3c35c66-dfaa-4942-99f6-f8dc29361f9c
w9PcJLyb/w9-pathfinding
w9_pathfinding/src/mapf.cpp
#include "include/mapf.h" bool has_collision(const vector<int>& positions, const vector<int>& next_positions, bool edge_collision) { std::unordered_map<int, int> node_to_agent; for (size_t i = 0; i < next_positions.size(); i++) { int node_id = next_positions[i]; if (node_to_agent.count(node_id)...
ALGO
0.99957
5.054125
a3cd4421-d8aa-4bea-835a-823b6734c8fa
win32ss/skia
src/base/SkSharedMutex.cpp
#include "src/base/SkSharedMutex.h" #include "include/private/base/SkAssert.h" #include "include/private/base/SkSemaphore.h" #include <cinttypes> #if !defined(__has_feature) #define __has_feature(x) 0 #endif #if __has_feature(thread_sanitizer) /* Report that a lock has been created at address "lock". */ ...
TOOL
0.910966
7.835272
818c09d2-3b4f-496b-8646-fd51fbbed0dc
shah-antriksh/Coding
Arrays/increasing-subsequence-of-length-three-with-maximum-product.cpp
//http://www.geeksforgeeks.org/increasing-subsequence-of-length-three-with-maximum-product/ #include<iostream> using namespace std; int main() { int n; cin>>n; int arr[n]; for (int i=0;i<n;i++) cin>>arr[i]; int lb[n],rb[n]; int temp=arr[0]; lb[0]=temp; for (int i=1;i<n;i++) { if(arr[i-1]>temp) {...
ALGO
0.999921
3.061861
de95405d-8bfb-4385-9da3-1d7182b5237e
anusha2402/LeetCode-Questions
34-find-first-and-last-position-of-element-in-sorted-array/find-first-and-last-position-of-element-in-sorted-array.cpp
class Solution { public: vector<int> searchRange(vector<int> &nums, int target) { vector<int> v(2, -1); if (nums.size() == 0) return v; for (int i = 0; i < nums.size(); ++i) { if (nums[i] == target) { v[0] = i; ...
ALGO
0.999957
6.489285
4c20a6a6-2e08-4f02-a84f-adbdba1d630d
PochecoPachico/Procon
AtCoder/ABC/131/b.cpp
#include <iostream> #include <cmath> #include <vector> #include <string> #include <algorithm> using namespace std; #define FOR(i, a, b) for(int i = (a); i < (b); i++) #define REP(i, n) FOR(i, 0, n) #define ASC(c) sort((c).begin(), (c).end()) #define DESC(c) sort((c).begin(), (c).end(), greater<int>()) #define DUMP(x...
ALGO
0.999874
3.213191
1f76849a-7c15-45fc-83c6-a275623ae288
aryashsaxena/leetcode_problems
Delete nodes having greater value on right - GFG/delete-nodes-having-greater-value-on-right.cpp
//{ Driver Code Starts #include<bits/stdc++.h> using namespace std; struct Node { int data; Node* next; Node(int x){ data = x; next = NULL; } }; void print(Node *root) { Node *temp = root; while(temp!=NULL) { cout<<temp->data<<" "; temp=temp->next; ...
ALGO
0.999948
5.457193
b13b3400-6de2-4d10-abbb-58a61d1d1c9b
poweredbypigeon/Competitive-Programming-Solutions
USACO/USACO2016JanSilverP1.cpp
#include <bits/stdc++.h> using namespace std; typedef unsigned long long ull; typedef long long ll; typedef vector<int> vi; typedef vector<vector<int>> vvi; typedef vector<double> vd; typedef vector<vector<double>> vvd; typedef vector<ull> vull; typedef vector<vector<ull>> vdull; typedef unsigned int ui; typedef pair...
ALGO
0.999915
4.961056
5a620384-c21f-4dba-9163-af0329e9a4af
r-destron/CEC_sectionA_rollno56
Graph_Questions/BFS.cpp
#include<iostream> #include<list> #include<queue> #include<vector> using namespace std; class Graph{ int V; list<int> *adj; public: Graph(int V){ this->V=V; adj=new list<int>[V]; } void addEdge(int V,int W){ adj[V].push_back(W); //add W node to V'...
ALGO
0.99998
4.946082
6281278b-cfde-48a2-a20c-b19bf7224897
harshitpathak027/dsa-practice
secondlargestefficient.cpp
#include<iostream> using namespace std; int secondlargest(int arr[],int n){ int second = -1,largest = 0; for(int i =1;i<n;i++){ if(arr[i]>arr[largest]) { second = largest; largest = i; } else if(arr[i]!=arr[largest]){ if(second==-1||arr[i]>arr[largest]){ secon...
ALGO
0.999916
4.177479
b802f365-32f1-4c48-b8c5-39000dafabae
yudou2018/LearningNotes
Algorithm/NIOTest0703/05_生成有效的IP.cpp
#include <iostream> #include <vector> using namespace std; class Solution{ // LeetCode 93 vector<string> ans; vector<int> segs; string s; int n=0; void dfs(int begin){ if(segs.size()==4){ // 如果已经有了4段 if(begin==n){ // 并且已经遍历完了 说明找到了4段合法的 string str; for(int& seg:segs){ str += to_string(seg)+'.'...
ALGO
0.999808
5.313365
14f23afa-f420-498e-93ed-915af96be539
RavenColEvol/competitive-journey
Easy/Codechef/NOCHANGEBRUTEFORCE.cpp
#include<bits/stdc++.h> #define test(t) for(cin>>t;t;--t) #define rep(i,n) for(ll i=0;i<n;i++) #define repr(i,k,n) for(ll i=k;i<n;i++) #define repr_r(i,n) for(ll i=n-1;i>=0;i--) #define pb push_back #define f first #define sec second #define in cin>> #define out cout<< #define optimize ios_base::sync_with_stdio(0);cin....
ALGO
0.999957
3.19765
42945d85-a64d-4c55-b364-48c3dcbd29a0
tusharkashyap2768/MY-DSA-JOURNEY
trees/Kth Ancestor in a Tree .cpp
Node* solve(Node*root,int &k,int node) { if(root == NULL) return NULL; if(root->data == node) { return root; } Node*leftans=solve(root->left,k,node); Node*rightans=solve(root->right,k,node); if(leftans != NULL && rightans == NULL) { k--; if(k<=0) ...
ALGO
0.999999
4.806701
86468690-b179-45c3-bc89-3b3c144b8ab3
hosenarafat/Codeforces-Problems-Solution
922B Magic Forest.cpp
#include<bits/stdc++.h> #include<stdio.h> using namespace std; #define ll long long #define scl(n) scanf("%lld", &n) #define scf(n) scanf("%lf", &n) #define pfl(x) printf("%lld\n",x) int main() { ll m,n,t,b,c,d,i,j,k,x,y,z,l,q,r; ll cnt=0,ans=0; scl...
ALGO
0.999585
3.737798
9d6918d4-a838-4b9b-9150-09138985753d
yuhehhuang/leetcode
0714-best-time-to-buy-and-sell-stock-with-transaction-fee/0714-best-time-to-buy-and-sell-stock-with-transaction-fee.cpp
class Solution { public: int maxProfit(vector<int>& prices, int fee) { vector<vector<int>>dp(prices.size(),vector<int>(2,0)); dp[0][0]=-prices[0]-fee; for(int i=1;i<prices.size();i++){ dp[i][0]=max(dp[i-1][0],dp[i-1][1]-prices[i]-fee); dp[i][1]=max(dp[i-1][1],prices[i...
ALGO
0.999882
5.606199
4b96c653-4b89-4c66-8e2e-dd982ae8fc62
Yaman-bot/leetcode
Shortest path in Undirected Graph having unit distance - GFG/shortest-path-in-undirected-graph-having-unit-distance.cpp
//{ Driver Code Starts // Initial Template for C++ #include <bits/stdc++.h> using namespace std; // } Driver Code Ends // User function Template for C++ class Solution { public: vector<int> shortestPath(vector<vector<int>>& edges, int N,int M, int src){ // code here vector<int> adj[N]; f...
ALGO
0.999963
6.024695
df5a72d8-d87a-4ef4-accc-a33184a6e3fd
blender/blender
extern/bullet2/src/BulletSoftBody/btDeformableContactProjection.cpp
#include "btDeformableContactProjection.h" #include "btDeformableMultiBodyDynamicsWorld.h" #include <algorithm> #include <cmath> btScalar btDeformableContactProjection::update(btCollisionObject** deformableBodies, int numDeformableBodies, const btContactSolverInfo& infoGlobal) { btScalar residualSquare = 0; for (int ...
ALGO
0.999712
5.951631
d42e30d8-05f3-4f16-8dac-09860f9651d0
Jxint001/OJ_homework
HW15_LCA_Tree_dp/ACMOJ2176/ds_prob.cpp
#include <cstdio> #include <utility> typedef long long ll; const int maxn = 2e5+5; ll c[maxn]; struct Edge{ int to, next; }e[maxn << 1]; int n, q, head[maxn<<1], lg[maxn], st[maxn][32], deep[maxn]; ll diff[maxn], ans[maxn], add[maxn]; inline void prelog(int n) { lg[1] = 0; lg[2] = 1; for (ll i = 3; i < n; ...
ALGO
0.999917
4.197876
b77b680d-9716-4b65-889c-aee9ada00565
mgood7123/llvm_18
llvm/lib/Analysis/DominanceFrontier.cpp
#include "llvm/Analysis/DominanceFrontier.h" #include "llvm/Analysis/DominanceFrontierImpl.h" #include "llvm/Config/llvm-config.h" #include "llvm/IR/Dominators.h" #include "llvm/IR/Function.h" #include "llvm/IR/PassManager.h" #include "llvm/InitializePasses.h" #include "llvm/Pass.h" #include "llvm/Support/Compiler.h" #...
TOOL
0.989975
7.734156
1580d6ef-5899-41e7-99cd-18814492cf35
bilgekaganpamuk/At-l-m-University-homework-and-projects
Cmpe226/homework/pamuk_bilgekagan_hw1.cpp
#include "linkedlist.h" #include <iostream> #include <cassert> //Bilge Kaðan Pamuk using namespace std; int posi=0;// global variable for search function template <typename B> class ConvertableLinkedList{ private: LinkedList<LinkedList<B> > list; LLNode<LinkedList<B> > *current=NULL; void convertToCircular() { ...
ALGO
0.997782
3.348235
d2483cc1-d7b5-4895-a46e-1a47e24dd58e
squaresLab/BatFix
results/transcoder/translations/java/PROGRAM_TO_FIND_REMAINDER_WITHOUT_USING_MODULO_OR_OPERATOR_2.cpp
int getRemainder ( int num , int divisor ) { while ( num >= divisor ) { num -= divisor ; } return num ; }
ALGO
0.993352
4.171478
aaf57cdb-af8b-44ad-be2c-91a80953a942
jooyae/SWU_Learning
Algorithm/TwowaySort_template.cpp
#include <iostream> using namespace std; const int SIZE = 15; int L[SIZE] = { 10,4,7,1,-2,12,28,66,9,3,5,7,6,21,11 }; //ǻ ˰ - 2wayպ ˰ // ȯ T(n) = 2T(n/2) + n, ü ȸ = O(nlogn) // 2 պ ġ 뷮 2n void print_data() { for (int i = 0; i < SIZE; i++) cout << " " << L[i] << " "; cout << endl; } void merge(int L[], int ...
ALGO
0.999887
4.034762
e8d5bc94-b9f5-4cf1-a436-6ea6d33c42ad
liuxiaocs7/AlgorithmLearn
LeetCode_C++/1091.二进制矩阵中的最短路径.cpp
/* * @lc app=leetcode.cn id=1091 lang=cpp * * [1091] 二进制矩阵中的最短路径 */ // @lc code=start class Solution { public: int shortestPathBinaryMatrix(vector<vector<int>>& grid) { int n = grid.size(); if(!n) return -1; int ans = 0; vector<vector<bool>> vis(n, vector<bool>(n)); queu...
ALGO
0.999979
6.479185
7e849d19-ceb6-4768-983c-e676074a1056
Margeli/Physics2
Phy4/Box2D/Box2D/Dynamics/Contacts/b2ChainAndPolygonContact.cpp
#include <Box2D/Dynamics/Contacts/b2ChainAndPolygonContact.h> #include <Box2D/Common/b2BlockAllocator.h> #include <Box2D/Dynamics/b2Fixture.h> #include <Box2D/Collision/Shapes/b2ChainShape.h> #include <Box2D/Collision/Shapes/b2EdgeShape.h> #include <new> b2Contact* b2ChainAndPolygonContact::Create(b2Fixture* fixtureA...
ALGO
0.988495
6.405189
79f4cfb2-525f-48ab-980f-c9814c405ae1
AnkitVarshney01/My-Coding-Playground
CodeChef/Equal_MEX.cpp
#include <iostream> #include <string> #include <algorithm> #include <climits> #include <vector> #include <stdlib.h> #include <map> #include <queue> #include <stack> #include <set> #include <functional> #include <random> #include <numeric> #include <iomanip> #include <chrono> #include <cmath> #include <cassert> #include...
ALGO
0.999966
4.724127
31ddc589-9569-4487-abe0-8681da0f4105
imarqs/matlabCode
schoolarchive/Compuphys/phys05/drivenMain.cpp
/* drivenMain.cpp Ben Postlethwaite Physics 410 Assignment 4 *** Main *** */ #include <cmath> #include <iostream> #include <cstdlib> #include <fstream> #include "drivenHeaders.h" using std::endl; using std::ofstream; using std::cout; using std::cerr; int main(int numargs,char* args[]) { ...
ALGO
0.999606
4.523893
1d6c3b5f-110b-43ad-b0ac-019c6c2fc030
zzctommy/public-source-code
码库/CF987A Infinity Gauntlet.cpp
#include<bits/stdc++.h> using namespace std; inline int rd() { int x=0,f=1;char ch=getchar(); while(!isdigit(ch)){if(ch=='-')f=0;ch=getchar();} while(isdigit(ch))x=x*10+ch-'0',ch=getchar(); return f?x:-x; } map<string,string>mp; map<string,bool>mp2; int n,m; signed main() { mp["purple"]="Power"; mp["green"]="Time...
ALGO
0.998787
3.530686
c445d65a-c431-4822-903f-656b219639b9
kristofe/GameEngine
SupportLibraries/bullet-2.76/src/BulletMultiThreaded/btGpu3DGridBroadphase.cpp
///The 3 following lines include the CPU implementation of the kernels, keep them in this order. #include "BulletMultiThreaded/btGpuDefines.h" #include "BulletMultiThreaded/btGpuUtilsSharedDefs.h" #include "BulletMultiThreaded/btGpuUtilsSharedCode.h" #include "LinearMath/btAlignedAllocator.h" #include "LinearMath/btQu...
ALGO
0.941922
7.425585
bc7fdcad-821f-4099-a0a2-f3bde6379b4f
NikoSoftware/Algorithm
ACM solved the question with Corresponding number/No.2H.cpp
#include<stdio.h> #include<string.h> int k[100000],flag[100000]; int cha(int x) { if(k[x]==x) return x; return k[x]=cha(k[x]); } void bing(int x,int y) { x=cha(x); y=cha(y); if(x!=y) k[x]=y; } int main() { int z=0,a,b,x,y; while(scanf("%d%d",&a,&b)&&a!=0&&b!=0) { z++; ...
ALGO
0.999673
3.373363
f94261a4-8eb6-487a-8ecd-4eaaea70aaf8
sarvex/leetcode-piet
solution/1000-1099/1014.Best Sightseeing Pair/Solution.cpp
class Solution { public: int maxScoreSightseeingPair(vector<int>& values) { int ans = 0, mx = values[0]; for (int j = 1; j < values.size(); ++j) { ans = max(ans, values[j] - j + mx); mx = max(mx, values[j] + j); } return ans; } };
ALGO
0.999989
6.178896
20a38f4f-0125-4a0d-a914-792ab33d08d2
kpsafvan/Codeforces
contest 22 - Copy/c.cpp
#include<iostream> #include<string.h> using namespace std; int main() { int i,t; cin>>t; int k,j,n,m; for(j =0;j<t;j++) { cin>>n>>m; int x[m],y[m]; for(i=0;i<m;i++) cin>>x[i]>>y[i]; int num=0; for(i=0;i<m;i++) { if(x[i]!=y[i]) num++; } cout<<num<<"\n"; } }
ALGO
0.999701
3.219704
f6bf2700-2707-4c66-88d5-3ac6b41d66b3
psiku/FHSalzburg-Cryptology
Lab2/02/test.cpp
// exercise PKC_02 #include "RSACreator.h" #include <gmpxx.h> int main() { // My program was runnig slow, so chatGPT suggested to initialize the randomState for all random operations instead of initializing it in every function like I did // so technically I wrote that 3 lines of code in my methods, but I thi...
ALGO
0.950249
5.175713
f0aeccb6-f179-46b9-8ce0-b135b640cfd3
SHUBH-GUPTA1/DSA
hcf.cpp
#include <iostream> using namespace std; int main() { int n,x,y,r; cout<<"enter the value of x and y"<<endl; cin>>x>>y; while(true) { n=y; r=x%y; x=y; y=r; if(y==0) { break; } } cout<<"hcf is"<<n; }
ALGO
0.99977
3.266162
185ed036-b8f6-4925-a5a8-aef4be13a92f
gpunit2417/CPP
shortestpathdag.cpp
#include<iostream> #include<unordered_map> #include<list> #include<stack> #include<vector> #include<limits.h> using namespace std; class graph{ public: unordered_map<int, list<pair<int, int> > > adj; void addEdge(int u, int v, int weight){ pair<int, int> p = make_pair(v, weight); adj[u].push...
ALGO
0.999975
4.91195
1797a571-8b23-44ad-ab9e-d4e04ec2dfe5
XunshanMan/Object-oriented-SLAM
src/plane/PlaneExtractor.cpp
#include "PlaneExtractor.h" #include "src/symmetry/PointCloudFilter.h" #include <src/config/Config.h> namespace EllipsoidSLAM { bool compare_func_plane_dis(g2o::plane* &p1, g2o::plane* &p2) { Vector3d cam_pose(0,0,0); double dis1 = p1->distanceToPoint(cam_pose); double dis2 = ...
ALGO
0.992079
5.20126
337b7848-19ab-4069-ab1e-190db6f2c6a6
InclinedScorpio/coding_ultimate_series
binarysearch.com/medium/string/reverse_words_sequel.cpp
// https://binarysearch.com/problems/Reverse-Words-Sequel /** * LOGIC: Main logic was to understand that stack and deque will be required * - Deque advantage comes during these times when operations from both end needs to be performed * - once understood, only coding part and checking edge cases is there * * COM...
ALGO
0.999937
6.462139
5a8ceea6-5b4b-4145-86ce-2cd8e6105935
xczhang07/leetcode
cpp/middle/spiral_matrix.cpp
class Solution { public: vector<int> spiralOrder(vector<vector<int>>& matrix) { vector<int> ret; if(matrix.size() == 0 || matrix[0].size() == 0) return ret; int m = matrix.size(); int n = matrix[0].size(); int top = 0; int left = 0; int right = n-1...
ALGO
0.999995
6.54492
2fc6168b-07ce-4022-9cce-739c8610e907
gale34/SWExpertAcademy
P1251/main.cpp
#include <iostream> #include <vector> #include <cmath> #include <cstdio> using namespace std; double minRoute(vector<pair<int, int> >& islands); double calculateDist(pair<int,int>& a, pair<int,int>& b); int main() { freopen("input.txt","r",stdin); int testCase; cin >> testCase; for(int i = 0; i < t...
ALGO
0.999666
4.371
0a39b5da-d996-4159-a5ff-ddd7052c87b5
LeeHann/algorithm
Baekjoon/10870_피보나치수5.cpp
#include <bits/stdc++.h> using namespace std; int f(int n) { if (n==1) return 1; else if (n==0) return 0; return f(n-1) + f(n-2); } int main() { int n; scanf("%d", &n); printf("%d", f(n)); return 0; }
ALGO
0.999989
4.039637
55962f30-9dc5-4b37-8e44-da3dc6f8dfb5
SatoshiBall101/hw5
wordle.cpp
#ifndef RECCHECK // For debugging #include <iostream> // For std::remove #include <algorithm> #include <map> #include <set> #endif #include "wordle.h" #include "dict-eng.h" using namespace std; // Add prototypes of helper functions here void findAnswers(set<string> &possibleAnswers, string &currentGuess, map<char, ...
ALGO
0.975544
5.763711
42303783-65ce-45da-a51c-dca1e31508d5
harshitsuman1/Cpp-Codes
SubsetsArray.cpp
#include <bits/stdc++.h> using namespace std; vector<vector<int>> helper(vector<int>& res, vector<int> &nums, int i) { if (i == nums.size()) { vector<vector<int>> v; v.push_back(res); return v; } vector<vector<int>> v1 = helper(res, nums, i + 1); res.push_back(nums[i]); v...
ALGO
0.999821
5.054797
d8cbc8e9-cc1b-4b6e-b1e5-4aeb7f45d268
mizuy/seqtool
c/main.cpp
#include "bisearch.h" #include <boost/program_options.hpp> #include <fstream> #include "nucleotide.h" // Na 33mM, K 0mM, Mg 6.5mM, Primer 0.5uM const PCRCondition defaultPCRCondition(0.0, 0.05f, 0.0015, 0.000001); const PCRCondition myPCRCondition(0.033, 0.0, 0.0065, 0.0000005); namespace po = boost::program_optio...
DATA
0.877645
5.491443
7c67002a-b063-44f1-9ee3-80ac3595e677
Afees01/aug_30
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
787fe66a-a7eb-4661-b71e-14260a9bd365
novedevo/CMPT128
src/system-of-particles.cpp
#include<iostream> #include<list> #include<vector> #include<utility> #include<cmath> using namespace std; pair<vector<double>, vector<double>> halve(const vector<double> & m, const vector<double> & s) { if (m.empty()||m.size()!=s.size()||s.empty()) { cout<<"Please enter correct set of values"; ...
ALGO
0.994975
4.369439
46cf0f65-d653-41f3-997c-b85770004864
zeyongj/LeetCode
1550-three-consecutive-odds/1550-three-consecutive-odds.cpp
class Solution { public: bool threeConsecutiveOdds(vector<int>& arr) { int count = 0; // Initialize count to keep track of consecutive odd numbers for (int num : arr) { // Iterate through each element in the array if (num % 2 != 0) { // Check if the current element is odd ...
ALGO
0.999855
6.029072
b5036e85-38ae-492a-8dd7-7e6adb284145
kanishkasah20/DSA-Supreme2.0-code
17_Dynamic Prog Level1/class4_dp_LPS.cpp
// ---Leetcode-516 [longestPalindromeSubseq] /* class Solution { public: int solveUsingTabulationSO(string a, string b) { //vector<vector<int> > dp(a.length()+1, vector<int>(b.length()+1, 0)); vector<int> curr(a.length()+1, 0); vector<int> next(a.length()+1, 0); for(int j_index=b.len...
ALGO
0.999462
5.610635
42c41e4d-6fba-4bad-8a22-71ef3381c58d
tommy16102/2022-algorithm-study
2022/18주차/이호준/순위 검색.cpp
/******************************************************************* Algorithm Study 2021 Kakao Blind 순위검색 level 2 2022/08/31 이호준 # 아이디어 1. 경우의 수 -> 비트마스킹을 이용해 표현 -> db를 생성해 나중에 탐색에 유용 2. 이분탐색 -> Yes or No Decision Problem *******************************************************************/ #include <string> #include <...
ALGO
0.999239
5.205884
c4af2113-2611-44e6-8175-c2c1fcc6a409
captainCool7/Programs-in-Cpp
recursion/reverse_stack.cpp
#include <bits/stdc++.h> using namespace std; stack<int> s; void reverse() { if (s.size() == 0) return; reverse(); } int main() { for (int i = 1; i < 5; i++) { s.push(i); } int n = s.size(); }
ALGO
0.99926
3.307686
d0061e9c-a78f-4995-bfee-e2c41fb462e7
Mayur-Mhatre/LP3
DAA/A5.cpp
// N queens using backtracking #define N 4 #include <stdbool.h> #include <stdio.h> void printSolution(int board[N][N]) { for (int i = 0; i < N; i++) { for (int j = 0; j < N; j++) printf(" %d ", board[i][j]); printf("\n"); } } // function to check whether the position i...
ALGO
0.999896
4.433342
192bab3f-6acf-49d0-a8f0-da6697512916
sofyagaranina/cpp_stl_course
string_task2/string_task2/main.cpp
// // main.cpp // string_task2 // // Created by Софья Гаранина on 01.04.2025. // Дана строка s, состоящая из слов и пробелов. // Требуется: // Вернуть длину последнего слова в строке. #include <iostream> #include <string> #include <sstream> #include <vector> int main() { std::string line; std::getline(std...
ALGO
0.985497
5.273855
b3779fdf-dbd5-4c66-a128-80c2285c42dd
geroigeroi/WhiteBelt
read_output_table/read_output_table/main.cpp
// // main.cpp // read_output_table // // Created by Mister on 08.11.2020. // #include <iostream> #include <fstream> #include <string> #include <iomanip> #include <vector> int main() { // /Users/mister/Desktop/Cpp/read_output_table/input.txt std::ifstream inputData("/Users/mister/Desktop/Cpp/read_out...
ALGO
0.980156
5.753757
29953211-f39f-489d-b555-0a44b70d0010
dattocngan/Cplusplus
tongtu1denn.cpp
#include <bits/stdc++.h> using namespace std; int main () { int t; cin >> t; while (t--) { long long n; cin >> n; cout << n*(n+1)/2 << endl; } return 0; }
ALGO
0.999673
5.333236
e641f8f7-7760-4b9e-bf6b-ecc3fb0fff49
cds-ruc/PIM-ANNS
third-party/faiss_upmem/faiss/utils/extra_distances.cpp
// -*- c++ -*- #include <faiss/utils/extra_distances.h> #include <omp.h> #include <algorithm> #include <cmath> #include <faiss/impl/AuxIndexStructures.h> #include <faiss/impl/DistanceComputer.h> #include <faiss/impl/FaissAssert.h> #include <faiss/utils/utils.h> namespace faiss { /**********************************...
ALGO
0.998762
7.509325
a507a9e6-bd13-4534-9cd4-8db30e02a300
goyalyash82/GFG
Difficulty: Easy/Min sum formed by digits/min-sum-formed-by-digits.cpp
class Solution { public: long long int minSum(int arr[], int n) { // Your code goes here if(n==1) return arr[0]; sort(arr,arr+n); int right=n-1,left=0; long long num1=0,num2=0; for(int i=0;i<n;i++){ if(i&1) num1=num1*10+arr[i]; else num2=num2...
ALGO
0.999838
5.821405
3668e2a6-831f-4c95-acff-bd5773572621
alexandraback/datacollection
solutions_2749486_0/C++/YuMS/B.cpp
#include <cstdio> void deal(int T) { int x, y; char first, second; scanf("%d%d", &x, &y); printf("Case #%d: ", T + 1); if (x > 0) { first = 'W'; second = 'E'; } else { first = 'E'; second = 'W'; x = -x; } for (int i = 0; i < x; i++) { printf("%c", first); printf("%c", second); } if (y > 0) { f...
ALGO
0.999876
3.220973
6bbeea9d-c5bb-469c-b0d5-3d97f66efbac
ValveSoftware/eigen
lapack/lu.cpp
#include "common.h" #include <Eigen/LU> // computes an LU factorization of a general M-by-N matrix A using partial pivoting with row interchanges EIGEN_LAPACK_FUNC(getrf,(int *m, int *n, RealScalar *pa, int *lda, int *ipiv, int *info)) { *info = 0; if(*m<0) *info = -1; else if(*n<0) ...
ALGO
0.9991
5.816968
06726f58-4d5c-41c2-8622-37c67b85ba81
ishandutta2007/codeforces
wild_hamster/normal/1299/B.cpp
#include <utility> #include <iostream> #include <cmath> #include <deque> #include <string> #include <time.h> #include <stack> #include <vector> #include <map> #include <set> #include <sstream> #include <algorithm> #include <bitset> #define pii pair<ll,ll> #define X first #define Y second #define mp make_pair typedef ...
ALGO
0.999988
4.3738
b7e2866e-0582-4f62-8cb1-e12b30e4d15e
harshitgupta2610/Leetcode
77-combinations/combinations.cpp
class Solution { public: vector<vector<int>> result; void solve(int start,int n, int k,vector<int> &temp){ if(k==0){ result.push_back(temp); return; } if(start>n){ return; } temp.push_back(start); solve(start+1,n,k-1,temp); ...
ALGO
0.999995
6.035798
6deb42a5-ec7c-4c98-96b0-3089a0836926
HyeongDo/Algorithm
boj_1541.cpp
#include<iostream> #include<algorithm> using namespace std; string inp; bool flag; int main(void){ cin>>inp; for(int i=0;i<inp.size();i++){ // cout<<inp[i]<<endl; if(inp[i]=='-'){ } } return 0; }
ALGO
0.998851
3.166238
f883c939-f4dc-4c0c-a584-40e6637b7172
p-hlp/CTAGDRC
Source/dsp/LookAhead.cpp
#include "include/LookAhead.h" #include <algorithm> #include "../JuceLibraryCode/JuceHeader.h" /*Credits to Daniel Rudrich for the idea https://github.com/DanielRudrich/SimpleCompressor/blob/master/docs/lookAheadLimiter.md */ LookAhead::~LookAhead() { rawBuffer = nullptr; } void LookAhead::prepare(double fs, doub...
ALGO
0.995018
5.351879
5d4eb843-3b13-4c88-85c2-e1d8cf6f76c5
ishandutta2007/codeforces
neal/normal/1553/A.cpp
#include <algorithm> #include <array> #include <bitset> #include <cassert> #include <chrono> #include <cmath> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <random> #include <set> #include <vector> using namespace std; // htt...
ALGO
0.997648
4.744597
fa68f2c6-04e1-41bb-b091-c44f1ad550a8
sinian666/codes_102_2
cpp_副本15/chapter_tree/binary_tree.cpp
/** * File: binary_tree.cpp * Created Time: 2022-11-25 * Author: Krahets (<EMAIL>) */ #include "../utils/common.hpp" /* Driver Code */ int main() { /* 初始化二叉树 */ // 初始化节点 TreeNode *n1 = new TreeNode(1); TreeNode *n2 = new TreeNode(2); TreeNode *n3 = new TreeNode(3); TreeNode *n4 = new TreeN...
ALGO
0.998433
5.482699
7c1f93d2-b1c9-4d47-b26f-78d0cd948d2a
adityaamit18/DSA
Strings/LC3110 - 3110. Score of a String.cpp
class Solution { public: int scoreOfString(string s) { int ans=0; for(int i=1;i<s.length();i++){ ans = ans + abs(s[i]-s[i-1]); } return ans; } };
ALGO
0.999955
5.52291
cd7beee5-c522-401d-bcb8-a75854f50ff9
mangosR2/mangos3
dep/tbb/src/perf/fibonacci_impl_tbb.cpp
#include <cstdio> #include <cstdlib> #include "tbb/task_scheduler_init.h" #include "tbb/task.h" #include "tbb/tick_count.h" extern long CutOff; long SerialFib( const long n ) { if( n<2 ) return n; else return SerialFib(n-1)+SerialFib(n-2); } struct FibContinuation: public tbb::task { lon...
ALGO
0.999702
4.686569
421039ce-9411-4870-a265-806a140271c0
m-altaifi/high-in-my-tuxedo
Cpp/0-HelloWorld/main.cpp
#include <iostream> #include <string> #include <vector> using namespace std; int main() { vector<string> msg{"Hello", "C++", "World", "from", "VS Code."}; for (const string &word : msg) { cout << word << " "; } cout << endl; getchar(); return 0; }
TOOL
0.919102
3.989549
17a1329a-6ecb-4695-85a4-1ed922cee05d
shahidul-brur/OnlineJudge-Solution
Codeforces/764_B - Timofey and cubes.cpp
/*=================================*\ Md. Shahidul Islam CSE, BRUR Rangpur, Bangladesh mail: <EMAIL> FB : fb.com/shahidul.brur Blog: shahidul-brur.blogspot.com \*=================================*/ #include<bits...
ALGO
0.999947
3.322644
6867bae6-8ef9-40ee-b76c-1247b91b13da
Tejasmagdum2309/-CrackYourPlacement
LL/83. Remove Duplicates from Sorted 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* deleteDupli...
ALGO
0.999975
5.765571
5a6e02e1-69e9-4cab-8f7e-60f612e59c04
sidharthsharma96/CODING
Codechef/Contests/NOV challenge/CHEFSEG.cpp
#include<iostream> #include<math.h> #include<iomanip> using namespace std; int main() { unsigned long long x,k,t; cin>>t; while(t--) { cin>>x>>k; cout<<fixed<<setprecision(6)<<(x*(1+2*(k-pow(2,(int)log2(k)))))/pow(2,(int)log2(k)+1)<<endl; } return 0; }
ALGO
0.999934
3.425962
e04f7e7b-f2fe-4bb4-89ce-8550a6038674
kushagraVerma/DAA
Assignment 2/Ford-Fulkerson.cpp
#include <bits/stdc++.h> #include "timer.hpp" #define int long long int using namespace std; /** * Finds a path from a given source to a sink * @param n number of vertices in the residual graph * @param source source vertex number * @param sink sink vertex number * @param residualGraph A residual graph in adjacen...
ALGO
0.999653
5.141622
b9ece758-fe72-4ce8-91b7-d65fe6add81a
ZikXewen/Submissions
laptop/Codeforces/cf_100551E.cpp
#include <bits/stdc++.h> #define ii pair<int, int> using namespace std; const int X = 1e5 + 5; int p[X], lef[X], N, M, Q, ct; bool an[X]; ii g[X]; vector<ii> lv[X], rv[X]; stack<ii> stk; int fd(int u){return p[u] < 0? u : fd(p[u]);} void un(int id){ auto [u, v] = g[id]; u = fd(u), v = fd(v); if(u == v) return; if(p...
ALGO
0.999847
4.776608
f686c81b-88f6-4415-bc3d-bedaf374f759
ishandutta2007/codeforces
doped.silicon/normal/1099/B.cpp
#include <bits/stdc++.h> using namespace std; #define rep(i,n) for (long long i = 0, _n = (n); i < _n; i++) #define debug(x) cout<<#x<<": "<<x<<endl #define arr1d(a,n) cout << #a << " : "; fr(_,1,n) cout << a[_] << ' '; cout << endl; #define arr1d0(a,n) cout << #a << " : "; rep(_,n) cout << a[_] << ' '; cout << endl; ...
ALGO
0.999974
3.718552
4a6b4f76-ad92-411e-8f74-f9a61e9ec6cd
txgcwm/code_study
cplusplus/boost/boost_1_63_0/libs/sort/example/generalizedstruct.cpp
// See http://www.boost.org/libs/sort for library home page. #include <boost/sort/spreadsort/string_sort.hpp> #include <boost/sort/spreadsort/float_sort.hpp> #include <time.h> #include <stdio.h> #include <stdlib.h> #include <algorithm> #include <vector> #include <iostream> #include <fstream> #include <string> using s...
ALGO
0.999134
4.783165
79976843-4b46-4f0a-829e-d4c2af64e495
SuyashJoshi179/ProgramsForProblems
ICPC/Prelims/A.cpp
#include <bits/stdc++.h> #include <random> #include <fstream> using namespace std; typedef long long ll; typedef long double ld; typedef pair<int, int> pi; typedef pair<ll, ll> pl; typedef pair<double, double> pd; typedef vector<ll> vl; typedef vector<int> vi; typedef vector<vector<int>> vvi; typedef vector<vector<ll...
ALGO
0.999703
4.228496
3b782491-ef1a-4834-bb4f-fb8aaf3fdd49
daniel-maxwell/Advisor-Bot
AdvisorMain.cpp
#include "AdvisorMain.h" AdvisorMain::AdvisorMain() { } void AdvisorMain::init() { std::string input; currentTime = orderBook.getEarliestTime(); previousTime = ""; welcome(); while(true) { input = getUserInput(); processUserInput(input); } } void AdvisorMain::welcome() { ...
TOOL
0.886648
4.185461
b7502a54-f823-42d8-b7cf-015f8d786174
priyanshsingh/Cpp-learning
DSAlgo/Data_St/queue_array.cpp
#include <iostream> #include <string> using namespace std; class Queue { private: int rear; int front; int arr[5]; public: Queue() { int rear = -1; int front = -1; for (int i = 0; i < 5; i++) { arr[i]==0; ...
ALGO
0.93827
4.813499
522a317e-3281-4d10-a2a8-71cf957410e6
Bluburry/Advent-of-Code-2024
day4/src/xmas_search.cpp
#include "aoc_day4.hpp" char xmas_array[] = "XMAS"; /** * @brief recursively searching in the defined direction, * checking a char array that contains "XMAS" * @param words vector of strings that contain the words to find * @param i index i * @param j index j * @param searching index of "XMAS" array currently s...
ALGO
0.997541
5.494146
f65c39c4-5981-44fb-a327-91e03ff9ea40
Suvrat-Ketkar/LeetCode
cpp/Fibonacci Number.cpp
// The Fibonacci numbers, commonly denoted F(n) form a sequence, called the Fibonacci sequence, // such that each number is the sum of the two preceding ones, starting from 0 and 1. That is, // F(0) = 0, F(1) = 1 // F(n) = F(n - 1) + F(n - 2), for n > 1. // Given n, calculate F(n). class Solution { public: int fi...
ALGO
0.999983
6.012229
5ede5e00-e585-4b4e-8415-937ecdfea7a7
harshsharma78/data-structures-and-algorithms
Stack & Queue/questack0.cpp
// dequeue(pop) costly // Queue using Stack #include <iostream> #include <stack> using namespace std; class que { public: stack<int> s1; stack<int> s2; void push(int x) { s1.push(x); } int pop() { if (s1.empty() && s2.empty()) { return -1; } ...
ALGO
0.998877
4.690051
634a11b4-bb7f-49cf-8756-e86b90b2e723
mySoftSnail/MyCodingTestStudy
백준/1026_보물.cpp
#include <bits/stdc++.h> using namespace std; int n; int a[52]; int b[52]; int main() { ios::sync_with_stdio(0); cin.tie(0); cin >> n; for (int i = 0; i < n; ++i) cin >> a[i]; for (int i = 0; i < n; ++i) cin >> b[i]; sort(a, a + n); sort(b, b + n, greater<int>()); int ans = 0; for (int i = 0; i < n; +...
ALGO
0.999982
3.291619
3f469576-827b-47a7-9816-a475add826e4
mishun/tangles-legacy
cpp/src2/Tangles/draw.cpp
#include <cassert> #include <ctime> #include <cmath> #include <vector> #include <string> #include <iostream> #include <stdexcept> #include <Graph/PSPrinter.h> #include <Geometry/Geometry.h> #include <Topology/EmbeddedGraph.h> #include <Draw/CircleDrawer.h> #include "TangleGraph.h" using namespace Graph; using Geometry...
ALGO
0.977729
4.438752
1591e7cc-7c3e-4555-8b60-b4876e333526
elkurjak/HW.-7
.ccls-cache/@home@runner@Time-function/main.cpp
#include <iostream> using namespace std; //declare parameter for the time functions void time(int seconds, int hours, int minutes, int secs){ //user input cin>>seconds; //formulas for converting seconds hours= (seconds/3600) % 60; minutes = (seconds /60) % 60; secs = seconds % 60; cout << hours << " Hour...
ALGO
0.903708
4.80375
60ef0c02-25ab-4e80-84a6-937a4e5e0f20
Yawn-Sean/Daily_CF_Problems
daily_problems/2024/05/0522/personal_submission/cf1132c_jy_xiaoying.cpp
//链接:https://codeforces.com/problemset/problem/1132/C #include<bits/stdc++.h> using namespace std; const int MAX=5010; int diff[MAX]; int cnts[MAX]; //区间[0...i]上 diff上有几个位置为 1 int vis[MAX]; //区间[0...i]上 有几个位置为 非0(被粉刷过) int l[MAX]; int r[MAX]; int n,m; void build(){ for(int i=0;i<...
ALGO
0.999959
3.864609
9448faeb-1f59-45f6-9b59-79ccd23ea874
ChipKerchner/Eigen
doc/special_examples/Tutorial_sparse_example.cpp
#include <Eigen/Sparse> #include <vector> #include <iostream> typedef Eigen::SparseMatrix<double> SpMat; // declares a column-major sparse matrix type of double typedef Eigen::Triplet<double> T; void buildProblem(std::vector<T>& coefficients, Eigen::VectorXd& b, int n); void saveAsBitmap(const Eigen::VectorXd& x, int...
ALGO
0.99871
5.514443
8ec45b3f-e18e-411e-aa71-1a7f0f896d96
Cobb-Yoo/Algorithms
BOJ/2302 극장 좌석/2302 극장 좌석.cpp
#include <iostream> using namespace std; int arr[41]; int brr[41]; void init(){ arr[1] = 1; arr[2] = 2; for(int i=3;i<41;i++) arr[i] = arr[i-1] + arr[i-2]; } int main(){ long long answer = 1; int n, m; cin >> n >> m; init(); brr[0] = 0; for(int i=1;i<=m;i++) cin >> brr[i]; for(int i=1;i<=m;i++) if(...
ALGO
0.999996
3.753933
1daf8391-9d1f-4602-9680-848cb3967487
YashRohan07/Data-Structure-and-Algorithm
Sorting/Insertion Sort.cpp
#include<iostream> #include<conio.h> using namespace std; int main() { cout<<"Enter the size of the array : "; int n; cin>>n; cout<<"Enter Elements for the array : "; int arr[n]; for(int i=0; i<n; i++) { cin>>arr[i]; } // Syntex For Insertion Sort for(int i=1; i<n; i+...
ALGO
0.999831
3.740836
74c84252-8f99-485f-ac47-5285e9c9f16d
Leejeuk213/codetree-TILs
240412/메이즈 러너/maze-runner.cpp
#include<iostream> #include<map> #include<vector> using namespace std; int maze[11][11]; int n,m,z; map<int,pair<int,int>> runner; map<int,int> runner_state; // 1이면 퇴장 map<int,int> runner_score; // 1이면 퇴장 int dx[4]={-1,1,0,0}; int dy[4]={0,0,-1,1}; int e_x,e_y; int result = 0; int is_over(){ for(int i = 1; i<=...
ALGO
0.999893
4.121649
031781a1-a7dc-40a6-bb5f-8b1df3fdd72b
abtinahmdi/olympiad-codes
most unstable array.cpp
#include<bits/stdc++.h> using namespace std; int main() { int t, n, m; cin >> t; for(int i = 1; i <= t; i++){ cin >> n >> m; cout << min(2,n - 1) * m << endl; } }
ALGO
0.999714
3.91847
a4ad3cdf-9699-49fb-900b-6c325d860138
B-Nick/problemsolving
HackerRank/Mathematics/Fundamentals/Basic/Easy/SherlockAndDivisors/src/main.cpp
#include <bits/stdc++.h> using namespace std; string ltrim(const string &); string rtrim(const string &); /* * Complete the 'divisors' function below. * * The function is expected to return an INTEGER. * The function accepts INTEGER n as parameter. */ int divisors(int n) { if (n < 1 || n > 1000000000) thro...
ALGO
0.997969
6.057275
f2426107-219a-4620-9274-0b32de34bfbb
IldySilva/vmake
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
00918777-3daf-43ed-8bac-d4031da33f32
perlakay/Advanced-data-structres-practice
treetraversal.cpp
#include <iostream> using namespace std; //two tree traversal algorithms //BFS first seachred the width DFS starts with depth //refer to video for visualization of how they work //here we focus on DFS //there are 3 //preorder, inrdoer, and postorder //preorder, print data left child roiht child //inorder left chil...
ALGO
0.999922
5.119308