uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
ec924b19-2b71-4cdd-8586-abc40ab7c4d4 | yongwhan/codeforces | 977A.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;
int main() {
cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
int n,k; cin>>n>>k;
for (int i=0; i<k; i++)
if(n%10) n--;
else n/=10;
cout << n << endl;
return 0;
}
| ALGO | 0.999916 | 3.655197 |
710fe457-8386-42fa-9bcf-46ab20b354fc | rajpratap29/DSA | 6_MoreLoops/power.cpp | #include<iostream>
using namespace std;
int main(){
float num;
cout<<"Enter number to find power: ";
cin>>num;
float power;
cout<<"Enter power(exponent) for a number: ";
cin>>power;
float powerOfNum = 1;
bool flag = true;
if(power < 0){
flag = false;
power = -power;
... | ALGO | 0.999368 | 4.485416 |
5555e342-4be6-41e2-a6af-a0938ce20129 | neel-kumar/cpp | usaco/towers.cpp | #include <bits/stdc++.h>
using namespace std;
using lb = long double;
using ll = long long;
int main() {
int n; cin >> n;
multiset<int> ts;
while(n--) {
int b; cin >> b;
auto ub = ts.upper_bound(b);
if(ub != ts.end())
ts.erase(ub);
ts.insert(b);
}
cout <... | ALGO | 0.999487 | 4.079561 |
6a71a037-4a0d-436d-9b17-0da9c4e50b76 | Student-Team-Projects/Graph-Editor-Android | app/src/main/cpp/triangulate.cpp | //
// Created by kasia on 18.01.23.
//
#include "triangulate.h"
#include <utility>
#include <vector>
#include <algorithm>
#include <stack>
#include <iostream>
std::vector<Vertex*> make_graph(int n, std::vector<std::pair<int, int>> edges_input){
std::vector<Vertex*> V;
for (int i = 0; i < n; ++i) {
V.... | ALGO | 0.999698 | 6.243486 |
85814a87-8fe8-4d97-bafe-028c8830ec57 | hvats16/Cpp_Programs | Graph/ListWeightedGraph.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int n,m;
cin>>n>>m;
vector<pair<int,int>> adj[n+1];
adj.push_back(make_pair(3,4));
for(int i=0;i<m;i++){
int u,v,wt;
cin>>u>>v>>wt;
adj[u].push_back(make_pair(v,wt));
adj[v].push_back(make_pair(u,wt));
}
... | ALGO | 0.999969 | 3.987751 |
23d6f0d3-52c3-4491-b39e-65ab57f9a6fc | JennBF/tareas_progra1 | PRACTICAS DE CAPITULOS C++/CAPITULO 6/Inciso6.54/main.cpp | #include <iostream>
#include <iomanip>
#include <random> // Librera para nmeros aleatorios modernos
#include <ctime> // Para obtener la semilla basada en el tiempo
using namespace std;
unsigned int tirarDados(default_random_engine& motor, uniform_int_distribution<unsigned int>& dado);
int main()
{
enum Es... | ALGO | 0.994518 | 4.923875 |
d2cda34d-3c60-4465-b1d3-45c898cab57e | Orang123/ACMAlgorithmExercises | 图论/最短路/负环/洛谷 P3385 判负环模板.cpp | #include<cstdio>
#include<cstring>
#include<queue>
#define N 3500//100
#define INF 0x3f3f3f3f
using namespace std;
//spfa bfsи
/*
:https://www.luogu.com.cn/problem/P3385
:https://www.luogu.com.cn/problem/P3385
˼·:spfaи
*/
struct node{
int to,w,next;
}edge[N<<1];
int cnt,vis[N],num[N],n,m,dis[N],head[N];
void addE... | ALGO | 0.999965 | 4.293781 |
6aa8859d-acfb-4b5b-9136-980088b386b4 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_1681_14.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
using ld = double;
const ld EPS = 1e-9;
const ll MOD = 1e6 + 3;
const ld PI = 3.141592653589793;
const int maxn = 5e5 + 100;
template <typename ForwardIter, typename Callback>
void forn(ForwardIter arr, int n, Callback c) {
int z = 1;
for (auto x = a... | ALGO | 0.999991 | 3.930563 |
fa827575-dab4-468a-9e77-4e2a6c2f3e08 | rushithakare766/Data-structure-and-Algorithm | Stack/Question4insertatbottomofstack.cpp | #include<iostream>
#include<stack>
using namespace std;
void solve(stack<int>&s,int x){
// base case
if(s.empty()){
s.push(x);
return ;
}
int num = s.top();
s.pop();
//recursive call
solve(s,x);
s.push(num);
}
int main(){
stack<int>s;
s.push(10);
s.push(20... | ALGO | 0.999985 | 4.252898 |
d845e403-27d8-4ac4-9fd8-1d7818b0d990 | Manant243/Problem-Solving | 0062-unique-paths/0062-unique-paths.cpp | class Solution {
public:
int dfs(int i, int j, int m, int n, vector<vector<int>>& dp){
if(i == m-1 && j == n-1){
return 1;
}
if(i >= m || j >= n) return 0;
if(dp[i][j] != 0){
return dp[i][j];
}
int cnt = 0;
cnt +=... | ALGO | 0.999938 | 6.535876 |
484cd106-c6fa-40df-af29-261e15280437 | tanyagupta0201/LeetCode-Problems-Solutions | C++/623_AddOneRowtoTree.cpp | // Name: Simarprit Virdi
// Date: 05/10/2022
class Solution
{
public:
TreeNode *addOneRow(TreeNode *root, int val, int depth)
{
if (depth == 1) // if depth is 1, then we have to simply add root
{
TreeNode *newNode = new TreeNode(val);
newNode->left = root;
re... | ALGO | 0.999996 | 6.486759 |
424bcde9-8713-494a-a906-99e65bbb795a | Stenardt-9002/LeetCode-Practice | Company_Wise/Mathworks/9-741_Cherry_pickup.cpp | // https://leetcode.com/problems/cherry-pickup/
#include <bits/stdc++.h>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds ;
typedef long long int ll;
#define DEBUG_var 1
#define fastIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
... | ALGO | 0.999923 | 5.501682 |
f2fd813d-2338-426a-a9e9-b91979fd4f32 | hanliutong/DS-in-cpp | arrStack.cpp | #include <iostream>
using namespace std;
template <class T>
class arrStack{
private: int maxSize;
int top;
T *st;//存放元素的数组
public: arrStack( int size);//构造函数-->给定长度的实例
arrStack();//创建一个顺序栈实例
~arrStack(); // 析构函数
void clear(); // 清空
bool push(T item);//入栈函数
bool pop(T& item); //出栈函数
bool getTop(T& i... | ALGO | 0.915904 | 3.999854 |
5a1b2762-4a90-4f28-92f0-93d60842d3ef | shahnursicherheit/codeforces | B. Gifts Fixing.cpp |
#include <bits/stdc++.h>
using namespace std ;
int main()
{
int t ;
cin >> t ;
while ( t-- )
{
int n ;
cin >> n ;
long a[n] , b[n] ;
long min_a = LONG_MAX , min_b = LONG_MAX ;
for ( int i = 0 ; i < n ; i++ )
{
cin >> a[i] ;
if ( m... | ALGO | 0.999988 | 3.435771 |
78df1be4-eafd-42cc-9391-3ec844eaacab | raincross7/code-similarity | codes/train_code/problem044/problem044_306.cpp | #include <bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
using namespace std;
using ll = long long;
const ll MOD = 1000000007LL; // = 10^9 + 7
const double PI = 3.14159265358979;
void solve()
{
int n, h;
cin >> n;
int old_h = 0;
int ans = 0;
... | ALGO | 0.99968 | 4.896292 |
85748b4a-7939-414d-bb8a-8181bf47aa39 | Liam-Westhall/HabitHammer | 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 |
1ec7332c-2f35-42ac-8771-8cae4aa6c359 | alireza-ahmadi/homework | 23.cpp | /*
http://alireza.es/homework/
Question: تعدادی عدد از ورودی خوانده، مجموع ان ها را نمایش دهد
*/
#include <iostream>
#include <conio.h>
using namespace std;
int main(){
int i=0,s=0,n,m;
cin >> n;
while(i<n){
cin >> m;
s = s+m;
i++;
}
cout << s;
getch();
return 0;
}
| ALGO | 0.999637 | 3.610437 |
b217d8d8-0a8d-48ef-b321-8505a7660d55 | mvyp/sim_pick_place | src/gpd_ros/src/filter.cpp |
#include <ros/ros.h>
// PCL specific includes PCL 的相关的头文件
#include <sensor_msgs/PointCloud2.h>
#include <pcl_conversions/pcl_conversions.h>
#include <pcl/point_cloud.h>
#include <pcl/point_types.h>
//滤波的头文件
#include <pcl/filters/voxel_grid.h>
#include <pcl/filters/passthrough.h>
//申明发布器
ros::Publisher pub;
//回调函... | DATA | 0.86012 | 4.460268 |
9bd65965-1404-43c9-979f-1421089a25f5 | sejkim2/baekjoon_cpp | graph_and_traversal/24445.cpp | #include <iostream>
#include <algorithm>
#include <queue>
#include <vector>
#define fast_io ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
using namespace std;
#define endl '\n'
int n, m, r, res = 1;
vector<vector<int> > graph;
queue<int> q;
bool visited[100001];
int result[100001];
void bfs(int vertex)
{
... | ALGO | 0.999985 | 3.919606 |
00e1d93a-33d3-4994-9ad3-e8010302dea0 | jahendrie/flappyjames | src/collision.cpp | /*******************************************************************************
* collision.cpp
*
* This file defines the functions used to check for collisions.
*
*******************************************************************************/
#ifndef UTIL_H
#include "util.h"
#endif
/*
------------------------... | ALGO | 0.998944 | 5.730091 |
380f4f97-79ce-4848-b58a-61eab42b2209 | ananas94/leetcode | course-schedule.cpp | class Solution {
public:
bool dfs(int z, vector<vector<int>>& courses, vector<int>& vis) {
vis[z] = 1;
for(auto it: courses[z]) {
if(vis[it] == 1 || (vis[it] == 0 && !dfs(it, courses, vis))) {
return false;
}
}
vis[z] = 0;
return true;
... | ALGO | 0.999607 | 6.308833 |
fa0fc892-3b1c-44c3-bf58-7fb594c3b3b5 | pradeeptosarkar/CodeChef | KNIGHT2.cpp | #include<bits/stdc++.h>
using namespace std;
#define endl "\n";
int andd(int p, int q, int n)
{
p+=q;
return p&n;
}
void display_yes()
{
cout<<"YES"<<endl;
}
void display_no()
{
cout<<"NO"<<endl;
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t;
cin>>t;
while(t--)
{
int a... | ALGO | 0.999282 | 4.039837 |
82c07b50-994d-4c17-bd0b-08d6b1ab47b6 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_9420_1.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 100005;
int n;
int len[N];
int energy[N];
int dp[N];
int cnt[N];
int f[N];
vector<int> graf[N];
void load() {
scanf("%d", &n);
for (int i = 0; i < n; i++) scanf("%d", &len[i]), cnt[len[i]]++;
for (int i = 0; i < n; i++) {
scanf("%d", energy + i);
... | ALGO | 0.999939 | 3.152076 |
ff65beb0-7ebc-4ecb-b896-6bb1988b550f | grallewellyn/isce2 | components/mroipac/correlation/src/cchz_wave.cpp | #include <vector>
#include <cmath>
#include <iostream>
#include <complex>
#include "DataAccessor.h"
int cchz_wave(int flag, DataAccessor* intAcc, DataAccessor* ampAcc, DataAccessor* corAcc, int bx)
{
/* interferogram line buffer, complex input data, row pointers */
std::complex<float> *bufcz;
std::complex<... | ALGO | 0.948258 | 3.165062 |
8c421f09-a777-4182-8dd5-6c9f79247b3c | DyingBunny/Subject | 整理彩球/Project1/Project1/源.cpp | #include <iostream>
#include <vector>
#include <numeric>
#include <limits.h>
#include<algorithm>
using namespace std;
int main()
{
int num;
cin >> num;
int tmp = num;
vector<int> v1;
while (tmp)
{
int a;
cin >> a;
v1.push_back(a);
tmp--;
}
if (v1.size() % 2 != 0)
{
cout << 0 << endl;
return 0;
... | ALGO | 0.999941 | 3.645577 |
c737c100-9cc3-4c02-be4f-b3b1ebd7236c | nineisprime/optimal-branch | getDirectedTree_MSversion.cpp | #include<math.h>
#include <yvals.h>
#if (_MSC_VER >= 1600)
#define __STDC_UTF_16__
#endif
#include<matrix.h>
#include<mex.h>
#include "OptimumBranching.hpp"
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]){
mxArray *weights_in_m;
double *weights, *tree_out;
int n;
int s,t,i;
const... | ALGO | 0.999793 | 4.377318 |
7a9e908c-a613-4411-97d8-9ee92ed89fd9 | Palash01-hazra/rubiks_cube_solver | main.cpp | //
// Created by Palash Hazra
//
#include <bits/stdc++.h>
//#include "Model/RubiksCube3dArray.cpp"
//#include "Model/RubiksCube1dArray.cpp"
//#include "Model/RubiksCubeBitboard.cpp"
#include "Solver/DFSSolver.h"
#include "Solver/BFSSolver.h"
#include "Solver/IDDFSSolver.h"
#include "Solver/IDAstarSolver.h"
//#include ... | ALGO | 0.996773 | 4.553801 |
99ed6953-d6fd-4213-817a-70dac6805ac2 | QuiverDance/Algorithm | study/15655.cpp | /*
N과 M(6)
*/
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int n, m;
vector<int> v;
void combi(int idx, vector<int> b){
if(b.size() == m){
for(int i = 0; i < m; i++) cout << b[i] << " ";
cout << '\n';
return;
}
for(int i = idx; i < n; i++){
... | ALGO | 0.999983 | 4.412655 |
8b02f0aa-96cc-4c85-8d69-ac8e0c999338 | ikamii/udacity-self-driving | nd013-c6-control/project/pid_controller/eigen-3.3.7/doc/examples/QuickStart_example2_fixed.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace Eigen;
using namespace std;
int main()
{
Matrix3d m = Matrix3d::Random();
m = (m + Matrix3d::Constant(1.2)) * 50;
cout << "m =" << endl << m << endl;
Vector3d v(1,2,3);
cout << "m * v =" << endl << m * v << endl;
}
| ALGO | 0.997653 | 3.375595 |
ce9ebdbc-6252-469f-8ac2-ad7ca9cb2edd | shahdhoss/Leetcode-solutions | 2656-maximum-sum-with-exactly-k-elements/2656-maximum-sum-with-exactly-k-elements.cpp | class Solution {
public:
int maximizeSum(vector<int>& nums, int k) {
int sum = 0;
sort(nums.begin(), nums.end());
for (int i = 0; i < k; i++) {
sum = sum + nums[nums.size() - 1];
nums[nums.size() - 1] = nums[nums.size() - 1] + 1;
}
return sum;
}
}; | ALGO | 0.999977 | 5.615105 |
56966832-eabf-4f9b-88ce-25172efc76a7 | GH-WEN/starviewer | starviewer/src/extensions/playground/perfusionmapreconstruction/perfusionmapcalculatormainthread.cpp | #include "perfusionmapcalculatormainthread.h"
#include "perfusionmapcalculatorthread.h"
#include "logging.h"
#include "series.h"
#include "volume.h"
#include "mathtools.h" // pel PI
// Qt
#include <QTime>
#include <QPair>
// VTK
#include <vtkMultiThreader.h>
// ITK
#include <itkCastImageFilter.h>
#include <itkVnlForw... | ALGO | 0.929133 | 4.670045 |
e5854d23-16d6-4aef-9993-5f2a55e0fa3e | pjungeblut/ChaosKITs | math/bigint.cpp | // Bislang keine Division. Multiplikation nach Schulmethode.
#define PLUS 0
#define MINUS 1
#define BASE 1000000000
#define EXPONET 9
struct bigint {
int sign;
vector<ll> digits;
// Initialisiert mit 0.
bigint(void) { sign = PLUS; }
// Initialisiert mit kleinem Wert.
bigint(ll value) {
if (v... | ALGO | 0.999263 | 3.867211 |
de9074af-203a-402d-9f4c-f00a40067899 | rakibunateed/Problem-Solving | F_Trulimero_Trulicina.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1e9 + 7;
#define nl '\n';
#define fast_io \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL);
#define all(x) x.begin(), x.end()
void result(ll n, ll m, ll k) {
ll x = (m ... | ALGO | 0.999853 | 4.036569 |
2fc33254-425d-4b90-a2c1-2264a75f25f0 | swastik2203/coding | Strings/7.cpp | //PERMUTATIONS OF STRINGS
#include <bits/stdc++.h>
using namespace std;
void Permutation(char S[], int k)
{
static int A[10] = {0};//to keep track of of index of array S and if the index already in used or not
int i; // if A[i] = 0 then i index is available of array S and viceversa
stat... | ALGO | 0.999989 | 5.321075 |
d9351fed-3e9f-41c8-9564-b535f3cdb932 | Lalitj2104/cpp | pattern/pattern16.cpp | #include <iostream>
using namespace std;
int main()
{
int n, i = 1;
cout << "enter the number";
cin >> n;
while (i <= n)
{
int space = n - i;
while (space)
{
cout << " ";
space -= 1;
}
int j = 1;
while (j <= i)
{
... | ALGO | 0.999918 | 3.822338 |
96cfeecc-d420-4545-9762-af60c689a812 | m4oughi/100DaysofCode | pureCPP/0033. Day 33/Multithreading Basics/002. Creating Threads/010. Creating Threads with Heavy Computation (Using sleep_for)/main.cpp | #include <iostream>
#include <thread>
#include <chrono>
void heavyComputation() {
std::cout << "Computation started..." << std::endl;
std::this_thread::sleep_for(std::chrono::seconds(3)); // Simulate heavy computation
std::cout << "Computation finished!" << std::endl;
}
int main() {
std::thread t1(hea... | TOOL | 0.859226 | 4.305742 |
0f7fe72c-cb82-44f4-ad41-0e5dc783cc23 | bretskiejr/glasscoin | glasscoin/src/zerocoin/Accumulator.cpp | /**
* @file Accumulator.cpp
*
* @brief Accumulator and AccumulatorWitness classes for the Zerocoin library.
*
* @author Ian Miers, Christina Garman and Matthew Green
* @date June 2013
*
* @copyright Copyright 2013 Ian Miers, Christina Garman and Matthew Green
* @license This project is... | TOOL | 0.865912 | 6.519381 |
b1dfb552-5b70-429a-8b6b-70d4534560d6 | FDU-VTS/LOL | src/fast_gicp/thirdparty/Eigen/doc/examples/TemplateKeyword_simple.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace Eigen;
void copyUpperTriangularPart(MatrixXf& dst, const MatrixXf& src)
{
dst.triangularView<Upper>() = src.triangularView<Upper>();
}
int main()
{
MatrixXf m1 = MatrixXf::Ones(4,4);
MatrixXf m2 = MatrixXf::Random(4,4);
std::cout << "m2 before copy:"... | TOOL | 0.977556 | 5.172663 |
58617de4-f0ce-4bfc-9c58-52714eabf75e | vbonnici/grafe-sim | analysis/data/p02257/s674967782.cpp |
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<ctype.h>
#include<cmath>
#include<iomanip>
using namespace std;
int main(void){
int n,a,b,count,c,w;
double d;
n=0;
b=0;
cin>>n;
//cout<<"n="<<n<<endl;
count=0;
for(a=0;a<n;a++){
cin>>b;
d=b;
//cout<<b<<" ";
for(w=0;w<=0;w++){
if(b==2... | ALGO | 0.999315 | 3.494083 |
1d8b7b2c-c03e-4277-8c8d-97ab7353826b | CharlieMartell/Compiler-Construction | mps/mp5/src/ADCE.cpp | //
//#include "llvm/Transforms/Scalar.h"
//#include "llvm/IR/BasicBlock.h"
//#include "llvm/IR/Instructions.h"
//#include "llvm/Pass.h"
//#include "llvm/Support/CFG.h"
//#include "llvm/Support/Compiler.h"
//#include "llvm/Support/InstIterator.h"
//#include "llvm/ADT/DepthFirstIterator.h"
//#include "llvm/ADT/SmallPtrSe... | ALGO | 0.893988 | 7.770345 |
29485613-d2ee-499e-8a87-160f0571a227 | pranayghosh18/leetcode | 486-predict-the-winner/predict-the-winner.cpp | class Solution {
public:
// bool PredictTheWinner(vector<int>& nums) {
// if(nums.size()&1 == 0) return true;
// int l(0),r(0);
// for(int i=0; i<nums.size()/2; i++){
// l += nums[i];
// r += nums[nums.size()-1-i];
// }
// int m = nums[nums.size()/2];
... | ALGO | 0.999968 | 5.571627 |
265a9699-66c1-46cd-8daa-a90fea5da51a | bornengineer/leetcode | 22-generate-parentheses/22-generate-parentheses.cpp | // Backtracking approach
// class Solution {
// public:
// void dfs(int o, int c, vector<string>& res, string s){
// // cout<<o<<" "<<c<<endl; // debugging
// // when both gets completely burned we will push the string "s" to res
// if(o == 0 && c == 0){
// res.push_back... | ALGO | 0.999802 | 6.465786 |
46c97504-6eec-4494-ab01-5320a766baaa | milphaser/WLP.POPCNT | 4.PopulationCount/1.(ASM)/2.WLP/2.8-bit/UnitMain.cpp | //---------------------------------------------------------------------------
#pragma hdrstop
#pragma argsused
#ifdef _WIN32
#include <tchar.h>
#else
typedef char _TCHAR;
#define _tmain main
#endif
#include <stdio.h>
#include <stdlib.h>
//#include <iostream>
#include "UnitMain.h"
//-----------------------------... | ALGO | 0.989773 | 3.950569 |
7b72aa88-87c6-459a-aaf5-a07b86f9d27b | ishandutta2007/codeforces | yousef_salama/normal/1446/B.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n, m;
cin >> n >> m;
string a, b;
cin >> a >> b;
vector < vector <int> > dp(n + 1, vector <int> (m + 1));
for(int i = n; i >= 0; i--)
for(int j = m; j >= 0; j--){
if(i == n || j == m... | ALGO | 0.999977 | 4.049747 |
1e5d7eeb-0685-4911-b816-c784895a0ab6 | vijaymanikantareddy/LeetCode_GFG_solved | Easy/Armstrong Numbers/armstrong-numbers.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:
string armstrongNumber(int n) {
// code here
int res = 0, dup = n;
while(n > 0){
int a = n%10;
... | ALGO | 0.99943 | 5.85165 |
009e90ef-9a61-4910-8a9d-6e5210303ed4 | samkimuel/problem-solving | BaekjoonOJ/1010BU.cpp | /**
* @file 1010BU.cpp
* @brief 다리 놓기
* @author Sam Kim (<EMAIL>)
*
* 문제 보자마자 조합(Combination)이 생각남
* BU방식으로 품 -> TD 으로 푸는 게 더 쉬울 듯
*
* d[n][m] : 강 서쪽 n개 사이트와 강 동쪽 m개 사이트를 다리로 연결하는 경우의 수
*/
#include <iostream>
using namespace std;
int d[30][30];
int main()
{
ios_base::sync_with_stdio(false);
cin.t... | ALGO | 0.999922 | 5.11722 |
73b5a112-3fbb-4f1f-b6d6-8b098b49188a | matthew-haines/RayTracer | src/material/fresnel.cpp | #include "fresnel.hpp"
#include "helpers.hpp"
#include <cmath>
double FresnelDielectric(double ndoti, double etaT, double etaI) {
if (ndoti < 0) {
std::swap(etaT, etaI);
}
double cosI = std::abs(ndoti);
double sinI = std::sqrt(std::max((double)0, 1 - square(cosI)));
double cosT = std::sqrt(... | ALGO | 0.995688 | 5.914674 |
94361a24-28f7-4855-9b97-39dd29da1eb2 | kxzhu0505/LSOracle_p | lib/boost/algorithm/minmax/example/minmax_timer.cpp | #include <utility>
#include <functional>
#include <algorithm>
#include <numeric>
#include <iterator>
#include <vector>
#include <list>
#include <set>
#include <iostream>
// What's the proper BOOST_ flag for <iomanip.h> vs <ios>
#include <iomanip>
#include <boost/timer.hpp>
#include <boost/algorithm/minmax.hpp>
templa... | TEST | 0.879075 | 6.421021 |
c475bb48-3282-4b5f-a4a2-fd91c59631c7 | lzlcs/Courses | Stanford_CS149/asst1/prog5_saxpy/main.cpp | #include <stdio.h>
#include <algorithm>
#include "CycleTimer.h"
#include "saxpy_ispc.h"
extern void saxpySerial(int N, float a, float* X, float* Y, float* result);
// return GB/s
static float
toBW(int bytes, float sec) {
return static_cast<float>(bytes) / (1024. * 1024. * 1024.) / sec;
}
static float
toGFLOPS(i... | ALGO | 0.993571 | 5.445806 |
b74eb291-4af6-4312-b6a8-bebd27101e47 | ishandutta2007/codeforces | spacevortex/normal/708/D.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N=150,E=N*10,inf=1e9;
ll n,m,S,T,cnt=1,ans=0,tim,top,num,W;
ll dis[N],he[N],vis[N],ins[N],stk[N],h[N];
queue<ll> que;
struct Edge
{
ll v,w,f,nxt;
}e[E];
void eadd(ll u,ll v,ll w,ll f)
{
cnt++;e[cnt].v=v;e[cnt].w=w;e[cnt].f=f;e[cnt].nxt=he[u];... | ALGO | 0.999971 | 4.170543 |
c5133b48-6b5d-4905-a983-2e8111b65b39 | Arbin97/Data_Structures | Arrays/Candles.cpp | #include<bits/stdc++.h>
#include<math.h>
#include<iomanip>
#include<algorithm>
using namespace std;
#define int long long int
int32_t main()
{
ios_base::sync_with_stdio(false);cin.tie(NULL); cout.tie(NULL);
int t;cin>>t;
while(t--)
{
int n; cin>>n;
int k=2;
while(1)
{
int res= pow(2,k)-1;
if(... | ALGO | 0.999807 | 4.233278 |
8c09cfd6-7adc-40a8-85e7-6da6979f1c0b | BSDArvitaClassroom/minggu-1-ArielHenryAvriza | flutter_application_3/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.99835 | 6.763549 |
becb3371-7e4b-4c08-b943-d20bcb0126c2 | adnan-nabil/LeetCode | 2602.cpp | class Solution
{
public:
vector<long long> minOperations(vector<int> &nums, vector<int> &queries)
{
sort(nums.begin(), nums.end());
vector<long long> answer;
int m = queries.size();
long long n = nums.size();
// prefix sum
long long sum[n], temp = 0;
su... | ALGO | 0.999935 | 5.447886 |
f151c9f0-4a24-43cc-bcc0-11dcd1711abd | AugmentedDesignLab/sumo-mirror | src/netbuild/NBAlgorithms.cpp | /****************************************************************************/
/****************************************************************************/
/// @file NBAlgorithms.cpp
/// @author Daniel Krajzewicz
/// @author Jakob Erdmann
/// @date 02. March 2012
/// @version $Id$
///
// Algorithms for networ... | ALGO | 0.999862 | 4.496696 |
1938e2f5-510c-4ece-a0e8-b0bf09bd3551 | adityak54/cp | before-aug-24/C_Omkar_and_Waterslide.cpp |
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define pi pair<int,int>
#define sortall(n) sort(n.begin(), n.end())
#define rsortall(n) sort(n.begin(), n.end(), greater<int>());
#define fr(a,b,c) for(int i=a;i<=b;i+=c)
#define rfr(a,b,c) for(int i=a;i>=b;i-=c)
#define pb push_back
// Input F... | ALGO | 0.998896 | 5.093948 |
fbfb6831-8924-48c0-8bcc-4c38a09aeef8 | ib13/Coding-Practice | Coding Ninjas/A5/A5-8.cpp | #include <iostream>
using namespace std;
int allIndexes(int input[], int size, int x, int output[])
{
if (size == 0)
return 0;
int ans = allIndexes(input + 1, size - 1, x, output);
for (int i = 0; i < ans; i++)
{
output[i]++;
}
if (input[0] == x)
{
for (int i = ans;... | ALGO | 0.999882 | 4.283029 |
ba81b378-13b3-4e65-b574-b5766dcc7934 | coxlab/boost_patched_for_objcplusplus | libs/bimap/example/tutorial_modify_and_replace.cpp | // VC++ 8.0 warns on usage of certain Standard Library and API functions that
// can be cause buffer overruns or other possible security issues if misused.
// See http://msdn.microsoft.com/msdnmag/issues/05/05/SafeCandC/default.aspx
// But the wording of the warning is misleading and unsettling, there are no
// po... | TEST | 0.900233 | 5.847426 |
7b5ca12e-4969-484a-b8d2-73fbbe97a009 | Aman2241/Self-Driving-Car | project_10_MPC_control/src/Eigen-3.3/doc/snippets/Tutorial_solve_triangular.cpp | Matrix3f A;
Vector3f b;
A << 1,2,3, 0,5,6, 0,0,10;
b << 3, 3, 4;
cout << "Here is the matrix A:" << endl << A << endl;
cout << "Here is the vector b:" << endl << b << endl;
Vector3f x = A.triangularView<Upper>().solve(b);
cout << "The solution is:" << endl << x << endl;
| ALGO | 0.999578 | 3.07381 |
67b79fac-17c4-48b1-814d-ae5e44c07385 | zainaliqureshi174/IfElsestatements | Greaterbetween2digits.cpp | #include <iostream>
using namespace std;
int main(){
int a, b;
cout<<"Enter first Number : ";
cin>>a;
cout<<"Enter second Number : ";
cin>>b;
if (a>b){
cout<<"First number is greater then second number.\n";}
else if (b>a){
cout<<"Second number is greater then first number.\n";}
else {
cout<<"Both numbers are ... | ALGO | 0.99872 | 3.166584 |
7a5f5ccb-36b6-4641-bd52-cc4d0f00f400 | Guyuena/Katago_ARM | katago_build_android/app/src/main/cpp/katago/program/play.cpp | #include "../program/play.h"
#include "../core/global.h"
#include "../core/fileutils.h"
#include "../program/playutils.h"
#include "../program/setup.h"
#include "../search/asyncbot.h"
#include "../dataio/files.h"
using namespace std;
//---------------------------------------------------------------------------------... | ALGO | 0.92563 | 5.999185 |
ab6d4c11-02d8-4635-b6d6-b7c3c7f8e57d | MeteorClear/PS | boj/cpp/boj_11286.cpp | // https://www.acmicpc.net/problem/11286
// 11286번 절대값 힙
// 우선순위 큐 문제
// 절댓값 기준 오름차순, 절댓값이 같으면 실제 값 오름차순으로 정렬하여 해결 가능
// 절대값, 실제값을 모두 사용하고 음수값을 사용하여 최소힙을 구현
#include <iostream>
#include <queue>
using namespace std;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
priority_queue<pair<int, int>> pq;
... | ALGO | 0.999994 | 5.408144 |
9dec85e3-14df-4621-b2fd-21323603816c | AryanChauhan25/CodingBlocks-AlgoCourse-Solutions | Stack, Queue & Deque/StrongestFighter.cpp | #include<bits/stdc++.h>
using namespace std;
int main() {
int n,k;
cin>>n;
int a[n];
for(int i = 0; i < n; i++) {
cin>>a[i];
}
cin>>k;
deque<int> q(k);
for(int i = 0; i < k; i++) {
while(!q.empty() && a[i] >= a[q.back()]) {
q.pop_back();
}
q.push_back(i);
}
for(int i = k; i < n; i++) {
cout<<a[q.... | ALGO | 0.999999 | 3.020385 |
0cc72330-a108-40f9-a33b-2ee2df06dfce | HellPicasso/Data-Structures-and-Algs | 10_factorial_using_recursion.cpp | #include<iostream>
using namespace std;
int fact(int n)
{
if(n==0||n==1)
return 1;
else
return n*fact(n-1);
}
int main()
{
int x;
cout<<"Enter a number"<<endl;
cin>>x;
cout<<"The factorial of "<<x<<" is "<<fact(x)<<endl;
return 0;
} | ALGO | 0.997952 | 4.122657 |
213413d4-e5fe-459f-9469-0a54d613fdb4 | alifalhasan/CP-code-vault | Codeforces/Codeforces Round/Codeforces Round 721 (Div. 2)/B2 - Palindrome Game (hard version)/116910556.cpp | #include<bits/stdc++.h>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
template<typename temp>using ordered_set = tree<temp, null_type, less_equal<temp>, rb_tree_tag,tree_order_statistics_node_update>;
//order_of_key(k) : Number of items str... | ALGO | 0.999868 | 4.357017 |
bd50426c-8a47-4a20-95bf-28ef02482844 | brinkqiang/dmopencv | samples/cpp/tutorial_code/features2D/feature_flann_matcher/SURF_FLANN_matching_Demo.cpp | #include <iostream>
#include "opencv2/core.hpp"
#ifdef HAVE_OPENCV_XFEATURES2D
#include "opencv2/highgui.hpp"
#include "opencv2/features2d.hpp"
#include "opencv2/xfeatures2d.hpp"
using namespace cv;
using namespace cv::xfeatures2d;
using std::cout;
using std::endl;
const char* keys =
"{ help h | ... | ALGO | 0.982547 | 5.788965 |
93b70da5-ae21-43a0-9534-0609818662af | dewank07/CodeForeces- | A_Marathon.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--){
int a,b,c,d;
cin>>a>>b>>c>>d;
int count=0;
if(a<b)
{
count++;
}
if(a<c)
{
count++;
}
if(a<d)
{
cou... | ALGO | 0.99945 | 3.126082 |
8ec1b3ae-a97f-4bcd-9c15-e2cd806df744 | nileshsahu07/DSA-With-CPP | Functions/Fibonacci.cpp | #include <iostream>
using namespace std;
int fib(int n){
int first = 0 ;
int second = 1;
int next = 0;
if(n==0 || n==1){
return n;
}else{
for(int i=2; i<=n; i++){
next = first + second;
first = second;
second = next;
}
}
return next;
}
int... | ALGO | 0.999931 | 4.298031 |
8219d2d2-5760-498c-98b9-cf8083058a38 | cfilelispapadopoulos/Computational-Mathematics | AFIIM/src/perm.cpp | #include "perm.hpp"
#include "qsort.hpp"
#include <iostream>
#include <algorithm>
// MPERM - Function that permutes rows and columns of square sparse matrix based on input integer permultation
// vector.
//
// Author: Christos K. Papadopoulos Filelis
// Assistant Professor
// Democritus Univers... | ALGO | 0.999893 | 5.135857 |
8adc985b-3348-40f9-b628-e3cde13bda48 | shumbul/DSA-Sheet | Day 64/177. DFS of Graph.cpp | class Solution {
public:
vector<int> dfs(vector<vector<int>>& adj) {
vector<int> ans;
set<int> visited;
dfs(0, adj, ans, visited);
return ans;
}
void dfs(int node, vector<vector<int>>& adj, vector<int>& ans, set<int>& visited){
ans.push_back(node); //Add the current... | ALGO | 0.999654 | 5.927975 |
78664348-e4a5-4fa9-b75a-50a5e6cbb5f8 | Losnen/AED | Vectores Dispersos/sparse_vector_t.cpp | #include "sparse_vector_t.hpp"
#include <cmath>
#include <iostream>
#include <iomanip>
using namespace std;
sparse_vector_t::sparse_vector_t(void):
val_(NULL),
n_(0),
nz_(0),
inx_(NULL)
{}
sparse_vector_t::sparse_vector_t(const vector_t& v, double eps):
val_(NULL),
n_(v.get_n()),
nz_(0),
inx_(NULL)
{
for(int i=... | ALGO | 0.853876 | 3.884072 |
a2a38ce1-a376-4f42-b335-5dd751ba4290 | milagjurovska/strukturno-programiranje-kodovi | rekurzija/labs 1.cpp | #include <iostream>
#define size 100
using namespace std;
int bara( int *niza, int i, int k, int brojach){
if (i<0) {
return brojach;
}
if (niza[i]==k) return bara(niza, i - 1, k, brojach + 1);
else return bara(niza, i - 1, k, brojach);
}
int main () {
int n, a[size], k, br=0;
cin>>n;... | ALGO | 0.999565 | 4.522547 |
189f30dc-b703-4601-aaa2-f629fc529953 | mindale/siaod | fibonach_prakt_1/fib_din.cpp | #include <iostream>
#include <cmath>
#include <list>
#include <windows.h>
using namespace std;
const int maxStaticSize = 10;
void fillArray(int arr[], int n, int &size){//заполнение списка
if (2 <= n <= 4)cout << "Введите " << n << " числа/чисел: ";
if (n == 1) cout << "Введите число: ";
for(int i = 0; i <... | ALGO | 0.994943 | 3.8161 |
fdb49119-4063-4cc2-8347-6d3e085384a8 | danilovict2/Competitive-Programming-Problems | USACO/Sleepy Cow Herding/main.cpp | /*
ID: danilos4
LANG: C++
TASK: herding
*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define pb push_back
#define pii pair<int, int>
#define vi vector<int>
#define vii vector<pair<int, int>>
#define MOD 9901
#define mp make_pair
#define sz(a) a.size()
#define for... | ALGO | 0.99992 | 3.705931 |
892ceb40-a4e1-4927-b7d6-315a92f5dd8d | Astha86/Cpp-with-DSA | Recursion/PrintVector.cpp | #include<bits/stdc++.h>
using namespace std;
void display(int x, vector<int> &v){
if(x==v.size()) return ;
cout<<v[x]<<" ";
display(x+1,v);
}
int main(){
int n;
cout<<"Enter the size of vector: ";
cin>>n;
vector<int> v(n);
for(int i=0; i<n; i++){
cin>>v[i];
}
display(... | ALGO | 0.999487 | 4.406618 |
fd22e223-57ff-4435-bd5a-1582e80e0b31 | CLSW/acm.timus.ru | 1567.cpp | # include <bits/stdc++.h>
using namespace std;
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
const int inf = (int)1e9 + 7;
const ... | ALGO | 0.99875 | 3.320945 |
ce22a2c3-8493-4439-9357-7e6cd0a37476 | almoidfahad/practice_cpp | Basic/if_else-While_loop&patterns/Pattern/4th_pattern.cpp | #include <iostream>
using namespace std;
int main()
{
int n;
cin >> n;
int row = 1;
while (row <= n)
{
int col = 1;
while (col <= row)
{
cout << "*";
col = col + 1;
}
cout << endl;
row = row + 1;
}
}
/*Output
n = 5
*
**
*... | ALGO | 0.999829 | 4.135128 |
73a333f5-e4a0-41c5-ba3c-f9e165aeea7f | itaishalom/FlutterMovieApp | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.9988 | 6.76073 |
a54e7c4e-61cd-440b-934f-3c500f8cf3a6 | Hrishi75/DSA | fibonacciseriesuptonthterm.cpp | #include<iostream>
using namespace std;
//naive approach
// int main() {
// int n = 5;
// if (n == 0) {
// cout << 0;
// } else if (n == 1) {
// cout << 0 << " " << 1 << "\n";
// } else {
// int fib[n + 1];
// fib[0] = 0;
// fib[1] = 1;
// for (int i = 2; i <= n; i++) {
// fib[i]... | ALGO | 0.999986 | 4.909585 |
01db926a-01df-45a0-a48a-9b843ea0bb7d | ftiasch/mithril | 2013-05-09/F.cpp | #include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <complex>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <c... | ALGO | 0.999941 | 4.198339 |
df1ed0d6-5b25-4b69-882e-ebf6d6720acb | chengluyu/SDU-Course-Materials | Digital Image Processing/2-1.cpp | #include <cmath>
#include <iostream>
#include <opencv2/opencv.hpp>
#include <opencv2/core.hpp>
#include <opencv2/highgui.hpp>
template <typename VectorType>
VectorType interpolate(const cv::Mat &src, double x, double y) {
int x1 = std::floor(x), x2 = std::ceil(x);
int y1 = std::floor(y), y2 = std::ceil(y);
... | ALGO | 0.865102 | 5.454524 |
12bbe4de-b30b-4c97-a286-a00973ff961e | antusaha970/My-source-code-DSA | leetcode/absoluteDiffK.cpp | #include <iostream>
#include <vector>
using namespace std;
int countKDifference(vector<int> &nums, int k)
{
int ans = 0;
for (int i = 0; i < nums.size(); i++)
{
for (int j = i; j < nums.size(); j++)
{
if (abs(nums[i] - nums[j]) == k)
{
ans++;
... | ALGO | 0.99964 | 5.071354 |
62161937-39fc-436a-8540-cc2e38dc67e8 | drt4243566/leetcode_learn | 面试真题/基础面试题/田忌赛马.cpp | // 经典田忌赛马
// 田忌和齐王都有长度为N的数组,代表n匹马的能力值;
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
void printMa(vector<int>& horse,string des){
cout << des+"的马:";
for(auto element:horse){
cout << element <<" ";
}
cout << endl;
}
int main(){
cout << "田忌赛马"<<endl;
in... | ALGO | 0.999918 | 3.594672 |
bf5e5061-0085-43ac-8ab8-21c92143d90d | snoopboopsnoop/advent-of-code-2021 | Day 07/AdventDay7Part1.cpp | #include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
using namespace std;
vector<string> readInput();
int getFuelCount(vector<int> crabs, int num);
//debug functions
template <typename T>
void printVector(vector<T> vector);
template <typename T>
void print... | ALGO | 0.999438 | 5.833274 |
e31f164e-d669-406f-9393-439e08469692 | kknaks/study | 코딩테스트/3th_week/3_K_31797_bfs+bfs.cpp | #include <bits/stdc++.h>
using namespace std;
const int max_n = 1504;
int r, c, visited_swan[max_n][max_n], visited[max_n][max_n], y, x, swanY, swanX, days;
int dy[4] = {-1, 0, 1, 0};
int dx[4] = {0, 1, 0, -1};
queue<pair<int, int>> swanQ, swan_tempQ, waterQ, water_tempQ;
char a[max_n][max_n];
void Qclear(queue<pair<... | ALGO | 0.999539 | 3.596763 |
72a41179-e82e-416e-8b0c-1f549246d329 | VIXELCoin/WalletVixel | src/llmq/quorums.cpp | #include <llmq/quorums.h>
#include <llmq/commitment.h>
#include <llmq/blockprocessor.h>
#include <llmq/dkgsession.h>
#include <llmq/dkgsessionmgr.h>
#include <llmq/utils.h>
#include <evo/specialtx.h>
#include <evo/deterministicmns.h>
#include <chainparams.h>
#include <masternode/node.h>
#include <masternode/sync.h>
#... | TOOL | 0.934333 | 4.247037 |
fd45f99c-9ed6-48ef-ac05-79ce23e0cb27 | Fighohji/Competitive-Programming | Record/PassRecord/cf897/D.cpp | #include <map>
#include <set>
#include <array>
#include <cmath>
#include <queue>
#include <stack>
#include <tuple>
#include <bitset>
#include <cctype>
#include <cstdio>
#include <random>
#include <string>
#include <vector>
#include <cassert>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <algorithm>... | ALGO | 0.999907 | 4.170959 |
901d0f91-a935-4f68-84fe-8133f68a9a1d | vaibhav-sharma-dev/DSA_Concepts | Arrays/kick_start_array_2.cpp | // Isyana is given the number of visitors at her local theme park on N consecutive days. The number of visitors on the i-th day is V₁. A day is record breaking if it satisfies both of the following conditions:
// The number of visitors on the day is strictly larger than the number of visitors on each of the previous d... | ALGO | 0.998505 | 4.137761 |
3e4cfdbc-238b-47b7-9672-d3ea3f3d6ca5 | tracy/Bluetune | ThirdParty/FhgAAC/libFDK/src/FDK_hybrid.cpp |
/* -----------------------------------------------------------------------------------------------------------
Software License for The Fraunhofer FDK AAC Codec Library for Android
Copyright 1995 - 2012 Fraunhofer-Gesellschaft zur Frderung der angewandten Forschung e.V.
All rights reserved.
1. INTRODUCTION
T... | ALGO | 0.998261 | 5.816382 |
ac90c11e-30c7-43c0-a29b-7ad19090b636 | gaurangg7/gaurang | Practice problems/String/code914.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution
{
public:
//Function to reverse words in a given string.
string reverseWords(string S)
{
// code here
stringstream ss(S); // Using stringstream to split the string by '.'
v... | ALGO | 0.999168 | 5.967694 |
cfe765a9-d239-4be2-b46e-fbe74972fa78 | AnmolManghera/LeetCode-Solutions | Maximum-Value-of-an-Ordered-Triplet-I.cpp | class Solution {
public:
long long maximumTripletValue(vector<int>& nums) {
int n = nums.size();
long long ans = 0;
vector<int>rangeDiffMax(n,-1);
int maxNo = nums[0];
for(int i = 1 ; i < n ; i++) {
if(maxNo - nums[i] >= 0) {
rangeDiffMax[i] = maxN... | ALGO | 0.999981 | 5.531 |
70b62fae-2bd6-4d5d-af73-c9703a975906 | UITSE2024/LuuDoThuatToan_Cpp_Function | Tuan/081/081.cpp | #include <iostream>
using namespace std;
float TinhTong(int, int);
int main()
{
int n, x;
cout << "\nNhap n = ";
cin >> n;
cout << "\nNhap x = ";
cin >> x;
cout << TinhTong(x, n);
return 0;
}
float TinhTong(int xx, int nn)
{
float s = 0;
int m = 1;
int i = 0;
while (i <= nn)
{
m = m * (xx + i);
s =... | ALGO | 0.998088 | 4.092143 |
9ce80a6d-0a00-45c8-951e-7d2f1660c895 | menaehab/Codeforces-Solutions | 0 - 1000 problems/Palindrome (string).cpp | #include <iostream>
using namespace std;
int main() {
string s;
cin >> s;
int length = s.length();
bool test = true;
for (int i = 0; i < length / 2; i++) {
if (s[i] != s[length - i - 1]) {
test = false;
break;
}
}
if (test) {
cout << "YES" << e... | ALGO | 0.999967 | 4.658536 |
acc24446-b887-42d1-980b-bf96d4bfd1b1 | HindzSight/Codes | Sem 3 DSA/Lab 1/Prac/set.cpp | #include <iostream>
#include<bits/stdc++.h>
using namespace std;
void RemoveDuplicate(int a[],int n)
{
set<int> s1;
for(int i=0;i<10;i++)
{
s1.insert(a[i]);
}
for(auto itr = s1.begin(); itr != s1.end(); itr++)
cout<<(*itr)<<" ";
}
int main() {
int n;
cin>>n;
int a[n];
for(int i=0;i<n;i++)
... | ALGO | 0.99859 | 4.324769 |
4338b64d-b060-4a9f-8e87-6e77465f94bb | AryanAngral/CPP-DSA | DAY-6/4_linklist.cpp | #include <iostream>
using namespace std;
class node
{
public:
int data;
node *next; // Self referencial pointer
};
void print( node* head ){
if(head==NULL){
cout<<"Empty";
}
else{
node * temp = head;
while (temp!=NULL) {
cout<<temp->data<<" "<<temp->next<<en... | ALGO | 0.9936 | 3.925643 |
1a39b9a1-afb2-4e6e-9c54-8b60bac83c72 | Nafisa-awal/sheet2 | loopP.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
long long row;
cin>>row;
for(long long line=row;line>=1;line--)
{
for(long long star=1;star<=line;star++)
{
cout<<"*";
}
cout<<endl;
}
}
| ALGO | 0.999955 | 3.881102 |
bcaa205f-24f3-4d9e-ae7b-62cff52e8179 | blackTiles/DSA_CPP | Patterns/InvertedHalfPyramid.cpp | #include<iostream>
using namespace std;
/*
*******
******
*****
****
***
**
*
*/
int main(){
int rows;
cout<<"No. of rows: ";
cin>>rows;
for(int i=rows;i>=1;i--){
for (int j=1;j<=i;j++){
cout<<"*";
}
cout<<endl;
}
return 0;
} | ALGO | 0.999804 | 3.990214 |
6d3c0729-c4d7-4b3e-b23b-31b44754e9bc | mirror/freedownload | FDMCustomized/FDMCustomized_lib/vmsDES.cpp | #include "StdAfx.h"
#include "vmsDES.h"
#include "libdes\des_locl.h"
#include "libdes\podd.h"
#include "libdes\sk.h"
#include "libdes\spr.h"
static int check_parity(des_cblock *key);
int des_check_key=0;
void des_set_odd_parity(des_cblock *key)
{
int i;
for (i=0; i<DES_KEY_SZ; i++)
(*key)[i]=odd_parity[(*key)[... | ALGO | 0.997952 | 5.463172 |
7186ec20-eaaa-4ad3-9ce7-8e0cad530cd2 | ishandutta2007/codeforces | forza_ferrari/normal/1654/A.cpp | #include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int t,n,a[1001];
int main()
{
cin>>t;
while(t--)
{
cin>>n;
for(int i=1;i<=n;++i)
cin>>a[i];
sort(a+1,a+n+1);
cout<<a[n-1]+a[n]<<'\n';
}
return 0;
} | ALGO | 0.999878 | 3.487828 |
c9025ce9-ad23-42d3-adc4-36043744d52e | weisongwen/GTSAM | gtsam/3rdparty/GeographicLib/examples/example-GeodesicExact.cpp | // Example of using the GeographicLib::GeodesicExact class
#include <iostream>
#include <exception>
#include <GeographicLib/GeodesicExact.hpp>
#include <GeographicLib/Constants.hpp>
using namespace std;
using namespace GeographicLib;
int main() {
try {
GeodesicExact geod(Constants::WGS84_a(), Constants::WGS84_... | ALGO | 0.991699 | 6.362921 |
c6e0178e-56a4-4d67-a538-67b695f98886 | ishandutta2007/codeforces | icecuber/normal/1148/E.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define x first
#define y second
int main() {
ios::sync_with_stdio(0); cin.tie(0);
int n;
cin >> n;
vector<pair<int,int>> a(n);
vector<int> b(n);
for (int i = 0; i < n; i++)
cin >> a[i].x, a[i].y = i+1;
for (int i = 0; i < n; i++)
... | ALGO | 0.999972 | 3.763764 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.