uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
d1b83737-7ba3-44b0-8829-591af6fa68a4 | yhc166188/play_algorithm | getDecimalValue/main.cpp | #include <iostream>
struct ListNode {
int val;
ListNode *next;
ListNode(int x) : val(x), next(NULL) {}
};
class Solution {
public:
int getDecimalValue(ListNode* head) {
ListNode* cur = head;
int ans = 0;
while (cur != nullptr) {
ans = ans * 2 + cur->val;
... | ALGO | 0.998949 | 5.653152 |
3ca6296f-e2c9-47a9-b420-a91010ae6db1 | Sudhanwa11/Data-Structures-And-Algorithms-In-cpp | ARRAYS CODES/Count Subarrays where max element appears atleast k times/csmektimes.cpp | class Solution {
public:
long long countSubarrays(vector<int>& nums, int k) {
int maxi = 0, i = 0, j = 0, n = nums.size();
unordered_map<int, int> mp;
long long ans = 0;
for (auto els : nums) {
maxi = max(maxi, els);
}
while (j < n) {
mp[num... | ALGO | 0.999915 | 6.116787 |
c2392475-b4aa-40fd-bbf8-9f1932a1d68c | ghibli613/cp-coding | coding/big_o/lv1/lect7/vasya_and_arrays.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
void solve()
{
int n; cin >> n;
vector<int> a(n);
for(int i = 0; i < n; i++) cin >> a[i];
int m; cin >> m;
vector<int> b(m);
for(int i = 0; i < m; i++) cin >> b[i];
int i_a = 0, i_b = 0;
int sum_a = 0, sum_b = 0;
i... | ALGO | 0.99995 | 3.728606 |
65052cf4-faf4-45b8-96f0-4884ca3d97d2 | Blanquette0315/CodingTest | Solo Study/행렬의 덧셈.cpp | #include <string>
#include <vector>
using namespace std;
vector<vector<int>> solution(vector<vector<int>> arr1, vector<vector<int>> arr2) {
vector<vector<int>> answer(arr1.size(), vector<int>(arr1[0].size(), 0));
for (int i = 0; i < arr1.size(); ++i)
{
for (int j = 0; j < arr1[0].size(); ++j)
... | ALGO | 0.999927 | 5.436862 |
9f186b92-2f02-4205-b423-c3a23aca4958 | checkoutb/LeetCodeCCpp | ge2100/LT2100_2022-03-05_Find_Good_Days_to_Rob_the_Bank.cpp |
#include "../header/myheader.h"
class LT2100
{
public:
// D D
// for (int i = 0; i < n-time; ++i) {
// if (i && security[i-1] >= security[i]) ++prefix;
// else prefix = 0;
// if (prefix >= time && suffix[i] >= time) ans.push_back(i);
// }
// 第 2,3个 for 合并
//Runtime: 2... | ALGO | 0.999991 | 5.180238 |
7aa0c5d2-cd0e-4518-8d82-b72b0da0ab43 | amity874/FaangInterviewPrep | Greedy/leetcode2294.cpp | #include<bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
using namespace std;
#define ll long long int
#define ld long double
#define mod 1000000007
#define inf 1e18
#define endl "\n"
#define pb emplace_back
#define vi vector<ll>
#... | ALGO | 0.999894 | 4.775356 |
c97ff59e-853c-4477-b990-ed5d1cb93734 | kaziabdullahfuad/Codeforces-Grind | 1300 lvl problems/balancedtunnel.cpp | #include<iostream>
#include<numeric>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
#include<set>
#include<unordered_set>
#include<unordered_map>
#include<map>
using namespace std;
#define ll long long
#define endl "\n"
#define debug(x) cout<<#x<<":"<<x<<endl;
#define all(x) (x).begin(),(x).end()... | ALGO | 0.999925 | 3.500963 |
a9ce7ab3-53a2-4bb1-bbd2-7dc068f62edc | grantathon/nquantlib64 | QuantLib/ql/models/shortrate/onefactormodels/extendedcoxingersollross.cpp | /* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
#include <ql/models/shortrate/onefactormodels/extendedcoxingersollross.hpp>
#include <ql/methods/lattices/trinomialtree.hpp>
#include <ql/math/distributions/chisquaredistribution.hpp>
namespace QuantLib {
ExtendedCoxIngersollRoss::Ex... | ALGO | 0.92762 | 7.486518 |
9dd78555-3619-4b4c-8c7e-959f439dde92 | Lcbc12/Compact | libff-master/libff/algebra/curves/edwards/edwards_g1.cpp | /** @file
*****************************************************************************
* @author This file is part of libff, developed by SCIPR Lab
* and contributors (see AUTHORS).
* @copyright MIT license (see LICENSE file)
***********************************************************************... | TOOL | 0.960335 | 7.108188 |
e1bb4a15-8c16-40a1-9b9e-2b797e2583ed | oxygen-hunter/Flashboom | data/leetcode_cpp/construct-binary-tree-from-inorder-and-postorder-traversal.cpp | // Time: O(n)
// Space: O(n)
/**
* 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:
TreeNode* buildTree(vector<int>& inorder, vector<int>& postorder... | ALGO | 0.999973 | 6.679031 |
139eea62-9673-4dd4-a898-3cd514bfcd76 | asvkarthick/LearnCPP | CPP_STL/chapter06/chapter06-10.cpp | // Algorithm
#include <iostream>
#include <algorithm>
#include <vector>
template<typename T>
void print(T t)
{
for(auto& x : t)
std::cout << x << std::endl;
}
template<typename T>
void print(std::initializer_list<T> t)
{
for(auto& x : t)
std::cout << x << std::endl;
}
int main(void)
{
std... | ALGO | 0.999347 | 4.664655 |
2220b8f5-4f45-4f4b-a381-37c5620ba71d | AliEmili/my-quera-solutions | daneshgahi/chape-moraba/main.cpp | #include <iostream>
using namespace std;
int main()
{
int n;
cin>>n;
for(int i=0 ; i<n ; i++){
for(int j=0 ; j<n ; j++){
if(i==0 || j==0 || i==n-1 || j==n-1){
cout<<"*";
}
else{
cout<<" ";
}
}
cout<<end... | ALGO | 0.999765 | 3.458682 |
bdea6e2c-1c45-4a59-9106-753a1b8d614a | buniatyann/Hackerrank | One Month Preparation/Week4/ArrayManipulation.cpp | #include <vector>
#include <algorithm>
/*
Time O(n + q) where q is the number of querries
Space O(n)
*/
long arrayManipulation(int n, std::vector<std::vector<int>> queries) {
// Create an array to store the difference of values.
std::vector<long> s(n + 1, 0); // Initialize with zeros
// Proce... | ALGO | 0.999855 | 6.200844 |
9d214be3-500b-4b74-b232-1a81efdb07b0 | opensource-hisense/SmartTV-SeriesVidaaU7_NT | oss/part1/cobalt/third_party/llvm-project/llvm/lib/Support/StringExtras.cpp | #include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/Support/raw_ostream.h"
using namespace llvm;
/// StrInStrNoCase - Portable version of strcasestr. Locates the first
/// occurrence of string 's1' in string 's2', ignoring case. Returns
/// the offset of s2 in s1 or npos if s2 cannot ... | TOOL | 0.952943 | 6.803111 |
20727226-ac67-4201-bbd8-7fd3b01e1ce6 | ishandutta2007/codeforces | kevinxiehk/normal/1615/A.cpp | #include <bits/stdc++.h>
#define mp make_pair
#define pb emplace_back
#define fi first
#define se second
#define int long long
#define ick cout<<"ickbmi32.9\n"
using namespace std;
bool isprime(int k) {
for(int i = 2; i <= sqrt(k); i++) if(k % i == 0) return false;
return true;
}
int bm(int a, int b, int mod) ... | ALGO | 0.999673 | 3.97561 |
d7e24eb6-6d03-4489-a4a0-cc73b6364ddb | weurus/PointCloudLibrary | doc/tutorials/content/sources/min_cut_segmentation/min_cut_segmentation.cpp | #include <iostream>
#include <vector>
#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>
#include <pcl/visualization/cloud_viewer.h>
#include <pcl/filters/filter_indices.h> // for pcl::removeNaNFromPointCloud
#include <pcl/segmentation/min_cut_segmentation.h>
int main ()
{
pcl::PointCloud <pcl::PointXYZ>::Ptr c... | ALGO | 0.953577 | 5.789178 |
2e308bb0-0e2f-4e58-8b5e-be77812d892a | tsuchi0410/AtCoder | problems/ABC/ABC198/D.cpp | #include <iostream>
#include <vector>
#include <unordered_set>
#include <algorithm>
#include <cmath>
using namespace std;
int main() {
string S1, S2, S3;
cin >> S1 >> S2 >> S3;
int N1 = S1.length();
int N2 = S2.length();
int N3 = S3.length();
unordered_set<char> S;
for (char c : S1)
... | ALGO | 0.999769 | 5.183277 |
f4bf9421-28b8-4614-aa38-f0bf8ab6d3a3 | MirageM/NeetCode-RoadMap-CPP | Arrays & Hashing/isAnagram28.cpp | class Solution {
public:
bool isAnagram(string s, string t) {
if(s.size() != t.size()) return false;
unordered_map<char,int> s_count;
unordered_map<char,int> t_count;
for(int i = 0; i < s.size(); i++){
s_count[s[i]]++;
t_count[t[i]]++;
}
for(in... | ALGO | 0.999976 | 6.395336 |
c60ba4cb-7228-401b-9046-f6c461b6e252 | jamarshon/Leetcode | 500-509/500KeyboardRow.cpp | /*
500. Keyboard Row
Given a List of words, return the words that can be typed using letters of
alphabet on only one row's of American keyboard like the image below.
American keyboard
Example 1:
Input: ["Hello", "Alaska", "Dad", "Peace"]
Output: ["Alaska", "Dad"]
Note:
You may use one character in the keyboard more t... | ALGO | 0.999255 | 6.572658 |
a28ceed9-2284-4bcb-a49c-e34db4cc37d6 | prishagoel/HP-Codewars | CodeWars/Lucky_Number/sol.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> a(n);
for (int &i : a) {
cin >> i;
}
for (int i : a) {
string s = to_string(i);
if (count(s.begin(), s.end(), '7')) {
cout << i ;
return 0;
}
}
cout << "DOES NOT EXI... | ALGO | 0.999317 | 3.865844 |
96ca3f0e-fd99-4950-9748-ea3cd24a4689 | YASSER-ABOOH/cppTraining | Assignments/030625/godNumber.cpp | #include<iostream>
#include<string>
#include<algorithm>
#include<vector>
using namespace std;
template<typename T1>
int godNumber(const T1& s)
{
int freq[10] = { 0 };
for (auto ch : s)
{
if (ch >= '0' && ch <= '9')
freq[ch - '0']++;
}
int maxdef = 0;
int mindef = 1000;
int i = 0;
for (;i <= 9;i++)
{
... | ALGO | 0.999547 | 3.981624 |
1b21682f-ee9d-4956-af83-16f582c6a4eb | ishandutta2007/codeforces | pechalka/normal/1225/B2.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <deque>
#include <set>
#include <string>
using namespace std;
int cnt[1000000];
int col[1000000];
int main(){
int t;
cin >> t;
for (int query = 1; query <= t; ++query) {
int n, k, d;
cin >> n >> k >> d;
vector<int> A(n);
... | ALGO | 0.999896 | 4.421891 |
dd0b3f2e-859f-4754-af3c-2d2714eca548 | Franciscofmv/cpp-homeworks | Module10/meeting.cpp | //*********************************************
// FILENAME: meeting.cpp
// PROGRAMMER: Francisco Moyet Vargas
// DATE: 08/02/2025
// COMPILER: Apple clang version 15.0.0 (clang-150<IP_ADDRESS>)
// REQUIRED: meeting.h, meeting.cpp
// PURPOSE: Implementation of the member functions of the
// Meeting class.
//*... | TOOL | 0.990024 | 5.849308 |
c7d8ebe1-4577-4df3-b1f7-c303de7e9e0c | haastregt/occlusion_tracking | occlusion_package/CGAL-5.5.2/examples/Hyperbolic_triangulation_2/ht2_example.cpp | #include <CGAL/Hyperbolic_Delaunay_triangulation_2.h>
#include <CGAL/Hyperbolic_Delaunay_triangulation_traits_2.h>
#include <CGAL/point_generators_2.h>
#include <CGAL/Timer.h>
#include <iostream>
#include <vector>
typedef CGAL::Hyperbolic_Delaunay_triangulation_traits_2<> Gt;
typedef Gt::Point_2 ... | ALGO | 0.999317 | 7.102727 |
981ce069-142f-48fa-999b-65d6e71cf9ba | MuhammadFauzanL/My-Learning-Cpp-Java-JavaScript- | c++/Operator.cpp | #include <iostream>
using namespace std;
int main(){
double Uang,biaya, UangTabungan , Bulan , uangDibutuhkan, Tahun ;
Uang = 2000000;
biaya= 500000;
UangTabungan = Uang-1000000;
Bulan =12;
cout << " Uang Pak Shaleh\n ";
cout << " Masukan Berapa Tahun cicilan yang diberikan ";
cin >> T... | ALGO | 0.997028 | 3.385516 |
74b362fe-02e0-4192-9eb6-f06bf547e5c8 | Ankur8789/LC-my-solutions | 2924-find-champion-ii/2924-find-champion-ii.cpp | class Solution {
public:
unordered_map<int,vector<int>> adj;
void dfs(int u,int& cnt,unordered_map<int,int>& vis)
{
vis[u]=1;
cnt++;
for(auto v: adj[u])
{
if(vis.find(v)==vis.end())
{
dfs(v,cnt,vis);
}
}
}
in... | ALGO | 0.999961 | 5.557341 |
ed26ffb7-4ae4-4de1-91c5-85fa0537f680 | Jirachotsaonram/100Problems | 99MeetingRoomsII.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
// ฟังก์ชันหาจำนวนห้องประชุมขั้นต่ำที่ต้องใช้
int minMeetingRooms(vector<pair<int, int>>& intervals) {
if (intervals.empty()) {
return 0;
}
// สร้างเวกเตอร์สำหรับเวลาเริ่มต้นและเวลาสิ้นสุด
vector<int> startTimes, ... | ALGO | 0.999998 | 6.866038 |
09382110-4b36-4b2e-9fe3-474e03bb2469 | Amitjaiswal213/Code | CODESPACE/C++/29_array2.cpp | //Find maximum value in Array
#include<iostream>
using namespace std;
int main(){
int n;
int array[100];
cout<<"Enter the size of array: ";
cin>>n;
for(int i=0;i<n;i++){
cout<<i<<" element: ";
cin>>array[i];
}
int max=array[0];
for(int i=1;i<n;i++){
if(arr... | ALGO | 0.999398 | 3.975436 |
5001d276-ede4-4adb-96f5-3c4d655964f8 | bodamanikanta/newrepo | TicTacToe.cpp | #include <iostream>
#include <string>
using namespace std;
char board[3][3] = {{'1','2','3'},{'4','5','6'},{'7','8','9'}};
int player = 1;
int choice;
void drawBoard()
{
cout << "Player 1 (X) - Player 2 (O)" << endl;
cout << endl;
cout << " | | " << endl;
cout << " " << board[0][0] << " ... | ALGO | 0.995955 | 4.829403 |
283e4308-5aa1-40d9-a108-3d7b27824b84 | 1091390146/algorithm | The sword refers to offer/12_exist.cpp | // 请设计一个函数,用来判断在一个矩阵中是否存在一条包含某字符串所有字符的路径。路径可以从矩阵中的任意一格开始,每一步可以在矩阵中向左、右、上、下移动一格。如果一条路径经过了矩阵的某一格,那么该路径不能再次进入该格子。例如,在下面的3×4的矩阵中包含一条字符串“bfce”的路径(路径中的字母用加粗标出)。
// [["a","b","c","e"],
// ["s","f","c","s"],
// ["a","d","e","e"]]
// 但矩阵中不包含字符串“abfb”的路径,因为字符串的第一个字符b占据了矩阵中的第一行第二个格子之后,路径不能再次进入这个格子。
//
// 示例 1:
// 输入:board ... | ALGO | 0.999688 | 6.284812 |
5b0d8cdd-7998-4fc8-acb4-8c73ac1c8439 | Scalpelapex/Interactive_Geometric_Deformation_Engine | deps/eigen/failtest/fullpivqr_int.cpp | #include "../Eigen/QR"
#ifdef EIGEN_SHOULD_FAIL_TO_BUILD
#define SCALAR int
#else
#define SCALAR float
#endif
using namespace Eigen;
int main()
{
FullPivHouseholderQR<Matrix<SCALAR,Dynamic,Dynamic> > qr(Matrix<SCALAR,Dynamic,Dynamic>::Random(10,10));
}
| TEST | 0.902336 | 3.150836 |
c32557d2-bf18-406a-b420-44bdf24e1bb2 | nextsimhub/NorESM-nextSIM | components/nextsim/src/dynamics/src/cgParametricMomentum.cpp | /*!
* @file ParametricMomentum.cpp
* @date 19 Nov 2024
* @author Thomas Richter <<EMAIL>>
*/
#include "cgParametricMomentum.hpp"
#include "BBM.hpp"
#include "Interpolations.hpp"
#include "MEB.hpp"
#include "ParametricTools.hpp"
#include "VectorManipulations.hpp"
#include "dgVisu.hpp"
#include "mevp.hpp"
namespace... | ALGO | 0.998013 | 5.14797 |
d9946089-6b14-4a3c-b96a-6f2f95392fd2 | dodokek/Mandelbrot-Fractal | mandelbrot.cpp | #include "./include/mandelbrot.hpp"
#define AVX_OPTIMIZE
#define DRAW
void StartDrawing()
{
float center_x = 0; // initial parameters
float center_y = 0;
float scale = 0.005f;
sf::Clock clock; // starts the clock
sf::Font font;
font.loadFromFile("img/SEASRN__.ttf");
sf::Text cycle... | ALGO | 0.968093 | 4.65493 |
4dc1e30f-616b-4bd1-b707-6bdc43b7d79c | abhaysp95/language_files | ncpp/practice/threading_in_c++/introduction/src/main.cpp | /** Questions:
1. What do you understand by thread and give one example ?
Ans -> In every application there's a 'default-thread which is main'. We
create other threads in side of this.
A thread is known as a lightweight process. Idea is to achieve parallelism
by dividing a process into multiple threads.
Fo... | ALGO | 0.981321 | 5.486899 |
4cf6a53c-0b99-4250-99eb-084bda1121ec | Noononda/codetree-TILs | 241115/정수 복사/copy-integer.cpp | #include <iostream>
using namespace std;
int main() {
int a = 3;
int b = 4;
b = a;
cout << a << " " << b << endl << a * b;
return 0;
} | ALGO | 0.98493 | 3.279631 |
26cd67ca-b392-41d9-9170-b14283d73e31 | RyanKPosey/assignment-2 | class/for-loop/multiplication-table.cpp | #include <iostream>
using namespace std;
int main() {
for(int i = 1; i <= 10; i++) {
for (int i2 = 1; i2 <= 10; i2++) {
cout << i * i2 << " ";
}
cout << endl;
}
} | ALGO | 0.987667 | 3.921607 |
5c57343f-05d5-4bdc-9c2a-167d5a298787 | zawminhtutx/100-DayOf-Flutter | watch_store_app/windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998948 | 6.76073 |
ed8c8f6b-7f34-446e-8052-57d2e899e2b2 | ishandutta2007/codeforces | fkguyx042/normal/39/J.cpp | #include<cstdio>
#include<algorithm>
#include<cstring>
#define seed 233
#define Mo 998244353
#define N 1000005
int hash[N],Ans[N],pow[N],i,j,sum;
char c[N],s[N];
using namespace std;
int main()
{
scanf("%s",c);
pow[0]=1; for (i=1;i<N;++i) pow[i]=1ll*pow[i-1]*seed%Mo;
scanf("%s",s); int len=strlen(s);
for (i=0;i<l... | ALGO | 0.999997 | 4.074514 |
628ea838-32d2-4b0f-a25e-4d1f178baf4f | MicDZ/Code | Codeforces/Practice/CF1042B.cpp | #include<bits/stdc++.h>
using namespace std;
#define MAXN 100000+10
#define INF 0x3f3f3f3f
int read() {
int x=0,f=1;
char ch=getchar();
while(ch>'9'||ch<'0'){if(ch=='-')f=-1;ch=getchar();}
while(ch<='9'&&ch>='0'){x=x*10+ch-'0';ch=getchar();}
return x*f;
}
int a[MAXN],s[MAXN],dp[15];
int main() {
... | ALGO | 0.999774 | 3.676802 |
596dedd0-a8d8-4730-ad47-c05ea7eff76f | ishandutta2007/codeforces | kaitokid/normal/946/B.cpp | #include <bits/stdc++.h>
using namespace std;
long long a,b;
int main(){
ios::sync_with_stdio(0);
cin>>a>>b;
while(true)
{
if(a==0||b==0){cout<<a<<" "<<b;return 0;}
if(a>=2*b){a=a%(2*b);continue;}
if(b>=2*a){b=b%(2*a);continue;}
cout<<a<<" "<<b;
return 0;
}
return 0;} | ALGO | 0.999912 | 3.426808 |
83e4c3b1-ae4f-49a6-8773-078bd4ebdd81 | leylaheydarova/Cpp-Practices | Lab works/Lab.2.w.4-4.cpp | /* N sets of nonzero integers are given. Each set contains at least 2 elements. A sign of completion of the set is the number of zero.
Find the number of sets whose elements increase */
#include <stdio.h>
int main () {
int n; // numbers
int m, k; // auxilary variables
int counts = 0;
while ( n != 0 ) {
sca... | ALGO | 0.999698 | 3.313206 |
0e1ebc2b-d1d5-4f5c-a18e-09bfd338619d | bmistlbe/RapidiX | RapidiX/FalkoRegularNNLO/nnlo_sub.cpp | #include "../FalkoRegularNNLO/nnlo_sub.hpp"
#include "../FalkoRegularNNLO/functions.hpp"
#include <cmath>
std::array<double, 6> nnlo_subtraction(double zb){
auto real_parts = prepare_real_parts(zb);
auto imag_parts = prepare_imag_parts(zb);
double xb = sqrt(1-zb);
double Z3 = 1.20205690315959428539973... | ALGO | 0.99786 | 4.446706 |
967c05a2-b6a0-42a1-a379-6619d3a37e9a | AndrewZhuCC/w800 | components/amrnb/src/common/src/norm_l.cpp | /*
Pathname: ./gsm-amr/c/src/norm_l.c
------------------------------------------------------------------------------
REVISION HISTORY
Description: Created separate file for the norm_l function. Sync'ed up
with the current template and fixed tabs.
Description: Updated module description to be the same a... | ALGO | 0.996354 | 6.369458 |
beb93c13-ca0e-4f9f-b856-e712ad5715dc | pi-rate14/C-codes | Coursera DSA Course/week 2/lcm.cpp |
#include<iostream>
using namespace::std;
long long gcd(long long n1, long long n2){
if (n2==0){
return n1;
}else{
long long temp = n1%n2;
gcd(n2,temp);
}
}
int main(){
long long n1,n2;
cin>>n1;
cin>>n2;
long long result = gcd(n1,n2);
cou... | ALGO | 0.99985 | 3.917396 |
9377f7ae-dc14-414f-bbd6-678f4ac8e296 | thestk/stk | src/Bowed.cpp | /***************************************************/
/*! \class Bowed
\brief STK bowed string instrument class.
This class implements a bowed string model, a
la Smith (1986), after McIntyre, Schumacher,
Woodhouse (1983).
This is a digital waveguide model, making its
use possibly subject to pa... | TOOL | 0.86489 | 6.695143 |
b5a59b2f-8b2c-40b7-9728-dd0d1c112b7f | omkarpatilkit/completeCpp | shiftZeroes.cpp | #include <iostream>
using namespace std;
void printArray(int a[], int size)
{
for (int i = 0; i < size; i++)
{
cout << a[i] << " ";
}
cout << endl;
}
void moveZeros(int a[], int size)
{
int zeroP = 0;
int intP = 0;
int i = 0;
while (i < size)
{
if (a[i] == 0)
... | ALGO | 0.999644 | 4.453265 |
9f81d079-9889-46e6-98c4-c82fc6f7f4e7 | swkajnBruceee/LeetCode | 1000-1999/T_1186_删除一次得到子数组最大和.cpp | #include<iostream>
#include<vector>
using namespace std;
class Solution {
public:
int maximumSum(vector<int> &arr) {
int ans = INT_MIN / 2, f0 = ans, f1 = ans;
for (int x: arr) {
f1 = max(f1 + x, f0);
f0 = max(f0, 0) + x;
ans = max(ans... | ALGO | 0.999892 | 5.383376 |
361587d2-2e18-4975-98c8-2e9348e42c7a | btrojan-official/Diament_Informatyka_2024-2025 | etap_3/zad42.cpp | #include <bits/stdc++.h>
using namespace std;
int tab[1000001];
bool is_primary(int n){
if(n==0 || n==1) return false;
if(n==2) return true;
for(int i=2;i*i<=n;i++){
if(n%i==0) return false;
}
return true;
}
int leng(char look_for, long long n){
}
int main(){
int n;
cin >> n;
... | ALGO | 0.999908 | 3.913618 |
314b1496-9c0b-4d33-9f1f-d503d6a1f282 | xinru43/MatrixAveragingToolbox | test/TestStieSparseBrockett.cpp |
#include "test/TestStieSparseBrockett.h"
using namespace ROPTLIB;
/*If the file is not compiled in Matlab and TESTSTIEBROCKETT is defined in def.h file, then using the following
main() function as the entrance. */
#if !defined(MATLAB_MEX_FILE) && defined(TESTSTIESPARSEBROCKETT)
/*Help to check the memory leakage pr... | TEST | 0.958384 | 6.078033 |
7e7d2313-1a2f-43bd-b9c4-840a49234e2e | gavinloverqq/Algorithm | algorithm/DP/p451张新华书数字分组2(01背包)/main.cpp | #include <iostream>
using namespace std;
int n,a[25],dp[100100];
int main() {
cin >> n;
int maxN = 0,sum = 0;
for (int i = 1; i <= n; ++i) {
cin >> a[i];
sum += a[i];
maxN = max(maxN,a[i]);
}
for (int j = 1; j <= n; ++j) {
for (int i = sum-maxN; i >= a[j]; --i) {
... | ALGO | 0.99988 | 3.220316 |
2a99617f-da79-4635-922b-35b8cf2a5458 | decenomy/SAPP | src/messagesigner.cpp | #include "base58.h"
#include "hash.h"
#include "main.h" // For strMessageMagic
#include "messagesigner.h"
#include "masternodeman.h" // For GetPublicKey (of MN from its vin)
#include "tinyformat.h"
#include "utilstrencodings.h"
bool CMessageSigner::GetKeysFromSecret(const std::string& strSecret, CKey& keyRet, CPubKey... | TOOL | 0.969524 | 7.218333 |
4ed7856d-e1a3-4ffa-9c86-e0723200d565 | Vasudeva-bit/My-Participation | CodeForces Questions/Contests/1826C.cpp | #include <bits/stdc++.h>
using namespace std;
int N = 1e6+100;
vector<int> min_div(N);
void solve() {
int n, m;
cin>>n>>m;
cout<<(n == 1 or min_div[n] > m ? "YES":"NO")<<endl;
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
for(int d=2;d*d<N;d++) {
if(min_div[d] == 0) {
... | ALGO | 0.999957 | 5.015407 |
a6360aad-ee2b-4483-8ca4-22a15c01d093 | zobaer-ahmed-zihad/journeyToCode | 02_Introduction to C++/Array of objects/counting_sort.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
int cnt[26] = {0};
for(int i = 0; i<n; i++){
char ch;
cin>>ch;
cnt[ch - 'a']++;
}
for(char i = 'a'; i<= 'z'; i++){
if(cnt[i - 'a'] > 0){
for(int j = 0; j<cnt[i-'a']; j++){
cout<<... | ALGO | 0.999951 | 3.690509 |
82c04801-8b71-44d9-b269-602e9ddb92c6 | G33k1973/CodingGames | PalindromeList(InterviewBit).cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
int Solution::solve(ListNode* A) {
if (A == 0)return 0;
vector<int> arr;
while (A != 0) {
arr.push_back(A->val);
A = A->next;
}
int n = int(arr.size());... | ALGO | 0.999928 | 4.545374 |
dfd48365-efda-416a-8736-a80805725276 | vaibhavmangla07/C-PLUS-PLUS | 05 Functions/50 Function.cpp | //Adding two Binary Numbers
#include <bits/stdc++.h>
using namespace std;
using namespace std::chrono;
int reverse(int n) {
int ans = 0;
while (n > 0) {
int lastdigit = n % 10;
ans = ans * 10 + lastdigit;
n /= 10;
}
return ans;
}
int addBinary(int a, int b) {
int ans... | ALGO | 0.999642 | 6.743856 |
6f5bd6bd-85f7-4d5b-aa09-184890a0ae50 | astrowander/chaosquad | odesolver.cpp | #include "odesolver.h"
static int number_of_steps[] = { 2,4,6,8,12,16,24,32,48,64,96,128, 192, 256, 384, 512, 768, 1024};
#define ATTEMPTS sizeof(number_of_steps)/sizeof(number_of_steps[0])
inline std::valarray <real_type> OdeSolver::f(real_type t, const std::valarray<real_type> &x)
{
//(*temp)[0]=sin(t);
// re... | ALGO | 0.999969 | 4.003561 |
de421324-bde1-45ee-a6fd-db6e110183a8 | HusseinYoussef/Interview-Preparation | leetcode/Medium/Populating Next Right Pointers in Each Node.cpp | #include <iostream>
#include <queue>
using namespace std;
class Node
{
public:
int val;
Node* left;
Node* right;
Node* next;
Node() : val(0), left(NULL), right(NULL), next(NULL) {}
Node(int _val) : val(_val), left(NULL), right(NULL), next(NULL) {}
Node(in... | ALGO | 0.99997 | 5.006615 |
6933fb3e-651b-4823-9dad-bea62ff3ef87 | cata-b/FLCDFiniteAutomaton | CharFAReader.cpp | #include "CharFAReader.h"
#include <fstream>
FA<char, char> CharFAReader::readFA(std::string filename)
{
using namespace std;
unordered_set<char> initial_states;
unordered_set<char> final_states;
vector<tuple<char, char, char>> transitions;
ifstream in(filename);
string line;
size_t step = 0;
while (getline(... | TOOL | 0.861478 | 5.57998 |
1e7a932f-7659-4df7-9ddb-2aa548feb985 | pranjalyadav-py/Leetcode | 199-binary-tree-right-side-view/binary-tree-right-side-view.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.999714 | 6.104063 |
1f0e5c35-8bc9-4216-b63e-63fea15ceadf | TD2106/Competitive-Programming | IUIOI/Angles.cpp | #include <bits/stdc++.h>
#define bug(x) cout << #x << " = " << x << endl
using namespace std;
typedef long long int ll;
int n,k,t;
vector<int> angle;
bool vis[365]={0};
void dfs(int u){
if(vis[u]) return;
vis[u]=1;
for(int i=0;i<angle.size();i++){
dfs((u+angle[i])%360);
dfs((u-angle[i]+360)%... | ALGO | 0.999979 | 3.738333 |
765344d7-6f98-42fd-9aac-1d9b8bfb5215 | kodekrafting/cplusplusmadness | interview1.cpp | #include <iostream>
using namespace std;
/* compiles == true */
/* this thing prints array ints in reverse order #interviewsuccess */
int figure_out_if_i_am_good_enough_to_program() {
int yes_or_no;
cin >> yes_or_no;
return yes_or_no;
}
void fight_imposters_syndrome_and_just_keep_going(int the_pressure_i... | ALGO | 0.996644 | 3.061532 |
aa4309ff-d223-4bb9-be8f-dd4b1f291ec8 | ishandutta2007/codeforces | sugarrr/normal/1076/C.cpp |
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp> namespace mp = boost::multiprecision; //mp::cpp_int
using namespace std;
typedef long long ll;
#define i_7 (ll)(1E9+7)
#define i_5 (ll)(1E9+5)
ll mod(ll a){
ll c=a%i_7;
if(c>=0)return c;
else return c+i_7;
}
typedef pair<int,int> i_i;
t... | ALGO | 0.99936 | 3.770604 |
f753288f-f2a6-4fb0-a0fd-f7553d404e85 | sumana2001/problems450 | arrays/kLargest.cpp | #include<bits/stdc++.h>
using namespace std;
void solve1(int arr[],int n,int k){
sort(arr,arr+n);
for(int i=n-1;i>n-1-k;i--){
cout<<arr[i]<<" ";
}
}
class MinHeap{
int size;
int *arr;
public:
MinHeap(int size, int input[]){
this->size=size;
this->arr=input;
buil... | ALGO | 0.999905 | 3.709753 |
1e38fde6-f1e5-44df-88f8-815db96c49e7 | MdRifathSharker/Competitive-programming | Monster_Monster.cpp | #include<bits/stdc++.h>
using namespace std;
int main ()
{
int t;
cin>>t;
while(t--){
long long int n,x;
cin>>n>>x;
vector<long long>a(n);
for(int i=0;i<n;i++){
cin>>a[i];
}
sort(a.rbegin(),a.rend());
for(int i=0;i<n;i++){
a... | ALGO | 0.999756 | 3.413557 |
a19c58d1-004f-4486-9501-d751930a9e3d | adrianaszhar/lab_desain-Analisis_Algoritma-Sorting | praktikum 9/Praktikum 9 latihan.cpp | #include <iostream>
using namespace std;
struct TreeNode{
int data;
TreeNode* left;
TreeNode* right;
TreeNode(int value) : data(value), left(NULL), right(NULL) {}
};
int main(){
int angka [10] = {1,2,3,4,5};
TreeNode* root = new TreeNode(angka[0]);
root->left = new TreeNode(angka[1]);
root->right =new T... | ALGO | 0.999728 | 3.885332 |
8864ef4a-7498-48e0-b7ce-a67035b3245e | ralfbiedert/openh264-rs | openh264-sys2/upstream/codec/decoder/core/src/parse_mb_syn_cabac.cpp | #include "parse_mb_syn_cabac.h"
#include "decode_slice.h"
#include "mv_pred.h"
#include "error_code.h"
#include <stdio.h>
namespace WelsDec {
#define IDX_UNUSED -1
static const int16_t g_kMaxPos [] = {IDX_UNUSED, 15, 14, 15, 3, 14, 63, 3, 3, 14, 14};
static const int16_t g_kMaxC2 [] = {IDX_UNUSED, 4, 4, 4... | ALGO | 0.988033 | 3.232418 |
32c6338b-2ece-4fcd-93f8-88b25895475f | LuisBarcenas14/Programacion-Competitiva | Otros/equilibra.cpp | #include <bits/stdc++.h>
using namespace std;
#define endl '\n'
vector<int> arr;
void equilibra(int n, int nivel, int maxi){
if(n>0 && nivel<=maxi){
if(n==1 && nivel==maxi){
arr.push_back(1);
cout<<"1 ";
}
else if(n==1){
arr.push_back(0);
cout<<"0 ";
}
//cout<<"n: "<<n<<"... | ALGO | 0.999994 | 3.420409 |
3f566c50-821c-4532-97fc-ea87e0b1a107 | ishandutta2007/codeforces | gawry/normal/97/C.cpp | #include<cstdio>
#include<algorithm>
#include<iostream>
using namespace std;
int n;
double p[110];
main(){
scanf("%d",&n);
for(int i=0;i<=n;i++)scanf("%lf",&p[i]);
double ans=p[0];
for(int i=1;i<=n;i++){
double x=min(1.0,0.5*n/i);
ans=max(ans,x*p[i]);
}
for(int i=0;i<=n;i++)for(int j=i+1;j<=n;j++){
... | ALGO | 0.99995 | 3.310467 |
cfb784cd-d910-4773-9b13-3c701a46db34 | MAA1117/DSA | cses/dp/paths.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const ll MAXN = 1000;
int main() {
ll n;
cin >> n;
char grid[n][n];
for (int i = 0; i < n; ++i) {
for (int j = 0; j < n; ++j) {
cin >> grid[i][j];
}
}
ll dp[MAXN][MAXN] = {0};
dp[0][0] = 1;
for (i... | ALGO | 0.999956 | 4.22514 |
c234ea91-0630-4a46-925e-8a1d78d7beda | Doveqise/OriginalProblems | DNF模拟赛Ⅰ/格兰之森/brute.cpp | using namespace std;
int main() {}
#include <cstdio>
#include <cctype>
#include <cstring>
#include <cstdlib>
#include <algorithm>
namespace OI {
typedef long long lld;
const int MXN = 500050;
const int DST = 1, NXT = 0;
int f[MXN], h[MXN], edge[MXN << 1][2], head[MXN];
lld val[MXN];
struct _Main {
void dfs(int nd, int... | ALGO | 0.999961 | 3.816772 |
7ca78321-0f07-4d96-a548-e8d52a913cd5 | KiraPein/-6Companies30Days | 2.Goldman Sachs/Day 7/447.number-of-boomerangs.cpp | /*
* @lc app=leetcode id=447 lang=cpp
*
* [447] Number of Boomerangs
*/
// @lc code=start
class Solution {
public:
long long int l(vector<int> p1,vector<int> p2)
{
int x1=p1[0];
int y1=p1[1];
int x2=p2[0];
int y2=p2[1];
long long int xx=(long long int)(x2-x1);
... | ALGO | 0.999845 | 6.28867 |
9bb62297-67d8-4d77-b37c-77924fd36f61 | luyiming112233/PatCodeRepo | PatCodeRepo/PatBasic/Basic1064.cpp | #include<cstdio>
#include<set>
using namespace std;
int main() {
int n,sum,num;
set<int> s;
scanf("%d", &n);
while (n--)
{
scanf("%d", &num);
sum = 0;
while (num!=0)
{
sum += (num % 10);
num /= 10;
}
s.insert(sum);
}
printf("%d\n", s.size());
int k = 0;
for (set<int>::iterator it = s.begin()... | ALGO | 0.999676 | 4.256506 |
158318c6-d79c-4f8f-869d-49e72640667b | LAKSHMANANSASIDHARAN/Daily-challenges-on-LeetCode-GFG | day59.cpp | /*Minimum Deletions to Make String K-Special
You are given a string word and an integer k.
We consider word to be k-special if |freq(word[i]) - freq(word[j])| <= k for all indices i and j in the string.
Here, freq(x) denotes the frequency of the character x in word, and |y| denotes the absolute value of y.
Return the m... | ALGO | 0.999979 | 6.500198 |
9a16b7d3-0091-4a29-9de4-1e5cdbd8c4aa | ishandutta2007/codeforces | alexluchianov/normal/123/E.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cassert>
#include <iomanip>
using ll = long long;
using ld = long double;
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#define MAX(a, b) (((a) < (b)) ? (b) : (a))
int const nmax = 100000;
std::vector<std::vector<int>> g;
int sz[1 + ... | ALGO | 0.999915 | 3.825146 |
21dd3083-50cf-4f03-9d91-346abbeed17c | swarajspatil158/cpp | Arrays/allNegativeToOneSide.cpp | #include <iostream>
using namespace std;
void NegativeToOneSide(int a[100], int n)
{
int left, right;
left = 0;
right = n - 1;
while (left < right)
{
if (a[left] < 0)
{
left += 1;
}
else
{
swap(a[left], a[right]);
right -= 1... | ALGO | 0.999982 | 4.311327 |
74dfa37a-aa73-4ab6-afde-e7ea6aa325aa | Ahnaf-41M/Codeforces_AtCoder | atcoder/abc162/C.cpp | #include<bits/stdc++.h>
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define min4(a,b,c,d) min(min(a,b),min(c,d))
#define max4(a,b,c,d) max(max(a,b),max(c,d))
#define count_one(a) __builtin_popcount(a) // Returns the number of set bits(1) in a number(a). In long long use __builtin_popcountl... | ALGO | 0.999952 | 3.727976 |
cd19dfaf-db95-454f-a4ce-9a4f3c44cb40 | Jibaru/data-structure-and-algorithms | 7.ARBOLES/EJERCICIOS/11.cpp | /*
11. Considere que no puede manejar memoria dinámica para representar
una estructura tipo árbol binario. Sin embargo, dadas las características
de la información, usted decide que la mejor estructura para su almacenamiento
y posterior uso es un árbol. Utilice un arreglo unidimensional, guardando
en cada casilla l... | ALGO | 0.999815 | 5.243339 |
21988e6f-6f02-405e-b1f3-5abe98e1bf59 | rh-97/Problem-Solving | Sort a stack - GFG/sort-a-stack.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;
while(t--)
{
SortedStack ... | ALGO | 0.999895 | 5.850002 |
19f70431-6021-4452-a0cd-6a25aa6188b3 | ishandutta2007/codeforces | sutaner/normal/1486/C1.cpp | #include <bits/stdc++.h>
#define rep(i, l, r) for (register int i = l; i <= r; i++)
#define per(i, r, l) for (register int i = r; i >= l; i--)
#define srep(i, l, r) for (register int i = l; i < r; i++)
#define sper(i, r, l) for (register int i = r; i > l; i--)
#define erep(i, x) for (register int i = h[x]; i; i = e[i].... | ALGO | 0.999967 | 3.179559 |
cd618b42-a811-448e-a042-789f133a8b84 | anisharma07/SEM5-LABS | COMPUTER GRAPHICS LAB/midEllipse.cpp | #include <iostream>
#include <graphics.h>
#include <math.h>
using namespace std;
int main()
{
int centerX = 250, centerY = 250, semiMajor = 170, semiMinor = 70;
int gd = DETECT, gm;
initgraph(&gd, &gm, (char *)"");
int decisionParam1 = semiMinor * semiMinor + (semiMajor * semiMajor) / 4 - semiMajor ... | ALGO | 0.998516 | 4.933197 |
1d9fa9b4-1500-4df1-9a99-8a8665507c66 | ishandutta2007/codeforces | semenar/normal/489/C.cpp | #include <iostream>
#include <algorithm>
#include <string>
#define SP << " " <<
using namespace std;
int main() {
int n, s;
cin >> n >> s;
if (s < 1 || s > 9 * n) {
if (s == 0 && n == 1) {
cout << "0 0";
}
else {
cout << "-1 -1";
}
}
else {
string a = "";
int tmp = s;
a += (char)(max(1, tmp ... | ALGO | 0.999559 | 3.526971 |
55d5132c-67b0-4491-aba5-32e04341ffc5 | atharva-yadav/leetcode-problem-solving | 3. Kth largest element - GFG/3.-kth-largest-element.cpp | // { Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution
{
public:
//Function to return kth largest element from an array.
int KthLargest(int arr[], int n, int k) {
// Your code here
priority_queue<int, vector<int>, greater<int>> pq;
... | ALGO | 0.999903 | 5.222963 |
926f9ed5-1e56-4997-9019-9bd15bea82d7 | trasz/chelsio | contrib/llvm/lib/Transforms/IPO/GlobalOpt.cpp | #define DEBUG_TYPE "globalopt"
#include "llvm/Transforms/IPO.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/ConstantFolding.h"
#include "llvm/Analysis/MemoryBuiltins.h"
#include... | TOOL | 0.865905 | 3.60683 |
2abe5541-7032-4006-857e-b968bc599978 | ishandutta2007/codeforces | chelly/normal/1372/C.cpp | #include<vector>
#include<set>
#include<map>
#include<queue>
#include<string>
#include<algorithm>
#include<iostream>
#include<bitset>
#include<functional>
#include<numeric>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cassert>
#include<cmath>
#include<iomanip>
#include<random>
#include<ctime>
#include<... | ALGO | 0.999927 | 3.746489 |
29e55a12-d0fa-4f44-baa2-22fbb31694e5 | ChristianYeh/2023aaib3 | week05/week05-1.cpp | //week05-1
#include <stdio.h>
#include <ctype.h>
int main()
{
char s[20];
scanf("%s",s);
for(int i=0;s[i]!=0;i++){
char c=s[i];
if(isupper(c))c=tolower(c);
else if(islower(c)) c=toupper(c);
printf("%c",c);
}
printf("\n");
}
| ALGO | 0.997857 | 4.334739 |
97a8ea8c-1c7a-44ca-8fac-cda897732668 | christianrusso/TAP2014 | cpp/otro.cpp | #include <cstdio>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
using namespace std;
int main(int argc, char **argv)
{
set<string> t;
string s, ss;
cin >> s;
unsigned int i, l = 1, z = s.size();
while (l <= z) {
t.clear();
for (i=0; i<z-l+1; i++... | ALGO | 0.999925 | 3.601717 |
d2fbf195-2ad0-4a27-9626-c8bf6a53ba37 | MirYeasirAbrar/CodeQuest-to-Career | Codeforces/ICPC-Preparation/ICPC Assiut University Community/Sheet #5 (Functions)/J_Average.cpp | #include <bits/stdc++.h>
using namespace std;
double find_sum(const vector<double>& a, int n) {
double sum = 0;
for(int i = 0; i < n; i++) {
sum += a[i];
}
return sum / n;
}
void solve() {
int n; cin >> n;
vector<double> a(n);
for(int i = 0; i < n; i++) cin >> a[i];
double avg... | ALGO | 0.985617 | 5.479024 |
a071960b-68cd-4dc8-b62f-465bc86ec28b | vinicius-r-silva/cpp-clustering | src/evaluation.cpp | #include "evaluation.hpp"
#include "distance_calculator.hpp"
#include "logger.hpp"
#include <cmath>
#include <iostream>
#include <numeric>
#include <vector>
double evaluation::calculate_silhouette_score(const std::vector<cluster> &clusters) {
std::vector<double> silhouette_scores;
for (int i = 0; i < clusters.siz... | ALGO | 0.9988 | 6.46916 |
69d3ca92-7fe1-4b17-b86d-bb2f77df8c69 | Prachi04Sharma/5th-Training | 96leetcode.cpp | //Leetcode problem 1572
//Approach 1
#include <iostream>
#include <vector>
using namespace std;
class Solution {
public:
int diagonalSum(vector<vector<int>>& mat) {
int n = mat.size();
int sum = 0;
for (int i = 0; i < n; ++i) {
sum += mat[i][i];
if (i != n - 1 - i) ... | ALGO | 0.999684 | 6.128748 |
dd1f6e91-f496-47a2-b22f-ce561fd2935c | UnknownGi/Codechef-Solution-Closed- | Beginner/Problem #40 - Gross Salary/sol.cpp | #include<iostream>
#include<ctype.h>
using namespace std;
int main( ) {
int t; cin >> t;
while ( t-- ) {
float b, gs, ds, hr;
cin >> b;
if( b < 1500 ) {
ds = b*0.90;
hr = b*0.10;
gs = b+ds+hr;
cout << gs << "\n";
} else {
ds = b*0.98;
... | ALGO | 0.999166 | 3.371939 |
127c9042-bb89-4882-842a-2eb68943b503 | quangrtit/PTIT_C | tam_giac_vuong.cpp | #include<stdio.h>
#include<math.h>
#include<stdlib.h>
int bs(long long arr[], int l, int r, long long x) {
while (l <= r) {
int mid = l + (r - l) / 2;
if (arr[mid] == x)
return mid;
else if (arr[mid] < x)
l = mid + 1;
else
r = mid - 1;
}
re... | ALGO | 0.999786 | 3.775492 |
b5d1ada8-d247-426d-bcac-c1fe9be79b82 | GeomirSolutions/fast-rdp | headers/include/igl/crouzeix_raviart_cotmatrix.cpp | template <typename DerivedV, typename DerivedF, typename LT, typename DerivedE,
typename DerivedEMAP>
void igl::crouzeix_raviart_cotmatrix(const Eigen::MatrixBase<DerivedV> &V,
const Eigen::MatrixBase<DerivedF> &F,
Eigen::SparseMatrix<L... | ALGO | 0.999598 | 6.051559 |
aaf18a18-c768-457b-a59e-117d60ae7b5c | MonalSD/Learn-C- | Array 2/q14.cpp | // Write a program to print array elements in reverse order using the swapping method.
#include<iostream>
using namespace std;
int main()
{
int a[100],i,n,sum=0,count=0;
cout<<"Size of array:";
cin>>n;
cout<<"Insert elements of Array:";
for(i=0;i<n;i++)
{
cin>>a[i];
}
int temp;
... | ALGO | 0.999809 | 4.221495 |
fc091d71-5145-4c17-af3a-23020f1bc5ac | FengLiang8/algo | hash_map_chaining.cpp | #include "./array_hash_map.cpp"
class HashMapChaining
{
private:
int size; // 键值对数量,Pair.size
int capacity; // hash map容量
double loadThres; // 触发扩容的负载因子阈值
int extendRatio; // 扩容倍数
vector<vector<Pair *>> buckets; // 桶数组。元素是由vector实... | ALGO | 0.972139 | 4.884457 |
84cedae8-5ae5-4414-a9cc-28abddc08c26 | poojadhoble32/c-c-projects | ReverseNum.cpp | #include<stdio.h>
int AddDigit(int iNo1)
{
int iDigit=0,iSum=0;
while(iNo1!=0)
{
iDigit=iNo1%10;
iSum=iSum+iDigit;
iNo1=iNo1/10;
}
return iSum;
}
int main()
{
int iValue=0,iRet=0;
printf("enter number\n");
scanf("%d",&iValue);
iRet=AddDigit(iValue);
printf("digits addition is : %d\n",iRet);
... | ALGO | 0.9989 | 3.544728 |
690e1b12-c851-46e6-987d-f00492208877 | aerth/aquaminer | src/miner.cpp | // Aquachain CPU Miner
#include <aquahash.h> // for argon2_context, arg...
#include <gmp.h> // for mpz_init, mpz_cmp
#include <stdint.h> // for uint8_t, uint32_t
#include <stdio.h> // for printf
#include <stdlib.h> // for malloc, exit, EXIT_...
#include <chrono> // for milliseconds
#include <cstrin... | ALGO | 0.990445 | 5.153572 |
0684434c-2239-4a7c-a369-88358324cb56 | Kaashish1111/Homework_solutions.cpp | day17_solutions/q7.cpp | // https://leetcode.com/problems/complement-of-base-10-integer/
class Solution {
public:
int bitwiseComplement(int n) {
if (n==0){
return 1;
}
int rem,binary=0,mul=1;
while(n != 0){
rem= n%2;
rem = rem ^ 1;
n /= 2;
binary ... | ALGO | 0.999984 | 6.175784 |
96a68d16-2641-44e5-9aef-485cc463a37c | akash1301/LightOj-Solution | 1264/main.cpp | /////////////////////// All Is Well /////////////////////////
#include <bits/stdc++.h>
#define FOR(i, s, e) for(int i=s; i<e; i++)
#define loop(i, n) for(int i=0; i<n; i++)
#define CIN ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define getint(n) scanf("%d", &n)
#define getlong(n) scanf("%lld", &n)
#defin... | ALGO | 0.999887 | 3.349739 |
16fe0ba0-e0d5-4f43-a38c-7d6b61efdbbe | nhphucqt/cs163-seminar | christofides/blossom5/PMshrink.cpp | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "PMimplementation.h"
PerfectMatching::Node* PerfectMatching::FindBlossomRoot(Edge* a0, bool clear_is_outer_flag, int& size)
{
Node* i;
Node* j;
Node* _i[2];
Node* r;
int branch;
size = -1;
_i[0] = ARC_HEAD(a0);
_i[1] = ARC_TAIL(a0);
branch ... | ALGO | 0.999607 | 3.928269 |
45784b20-fd07-4fa2-bef4-e961db323a17 | darrinwillis/FluenceRenderer | CMU462/src/matrix2x2.cpp | #include "matrix2x2.h"
#include <iostream>
#include <cmath>
using namespace std;
namespace CMU462 {
double& Matrix2x2::operator()( int i, int j ) {
return entries[j][i];
}
const double& Matrix2x2::operator()( int i, int j ) const {
return entries[j][i];
}
Vector2D& Matrix2x2::operator[]( int j )... | TOOL | 0.891883 | 6.948708 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.