uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
928ddd22-3d03-40fa-8931-8ad6082321af | qtumproject/qtum-bitcore | src/cryptopp/esign.cpp | // esign.cpp - written and placed in the public domain by Wei Dai
#include "pch.h"
#include "config.h"
// TODO: fix the C4589 warnings
#if CRYPTOPP_MSC_VERSION
# pragma warning(disable: 4589)
#endif
#include "esign.h"
#include "modarith.h"
#include "integer.h"
#include "nbtheory.h"
#include "algparam.h"
#include "sh... | ALGO | 0.966864 | 7.515773 |
fecd97d9-6866-4b8d-ab8e-39b61eac9649 | hztttt/Synergistic_Optimization | lammps_DeepSPIN/src/pair_tersoff_zbl.cpp | // clang-format off
/* ----------------------------------------------------------------------
Contributing author: Aidan Thompson (SNL) - original Tersoff implementation
David Farrell (NWU) - ZBL addition
------------------------------------------------------------------------- */
#include ... | ALGO | 0.990094 | 7.483635 |
28bf2b37-32b6-40af-8f6e-faf4b428026f | ARahmanAR/Cpp-learning | Functions/basicsFunctions.cpp | #include <iostream>
using namespace std;
void usa()
{
cout << "You are in USA" << endl;
cout << "How are you?" << endl;
return;
}
void bangladesh()
{
cout << "You are in Bangladesh" << endl;
cout << "How are you?" << endl;
return;
}
int main()
{
usa();
cout << endl;
cout << "Hello ... | TOOL | 0.929814 | 4.369258 |
62626fb5-f2d3-44a6-ad0b-7b027a110903 | binarybard-sanjana/1st | c++/callingfun.cpp | //Calling function in the function
#include <iostream>
using namespace std;
void accept(int *a,int *b);
void swap(int *a, int *b);
void print(int a, int b);
int main()
{
int a,b;
accept(&a,&b);
swap(&a,&b);
print(a,b);
return 0;
}
void accept(int *a,int *b)
{
cout<<"enter the values for a and b :";
... | ALGO | 0.999408 | 4.047504 |
6462235a-cf9f-4ffd-bb78-2620b969c6bd | priyanshimaurya/leetcode-Solution2 | 2845.cpp | #include<bits/stdc++.h>
using namespace std;
int countInterestingSubarrays(vector<int>& nums, int modulo, int k) {
int count=0;
for(int i=0;i<nums.size();i++){
if(nums[i]%modulo==k){
count++;
}
}
return count;
}
int main(){
vector<int>nums={3,2,4};
int modulo=2,k=1;
... | ALGO | 0.999575 | 4.435322 |
1a8b00a3-b015-4d4d-9850-ce7d28c6fc3c | SumeetYp/-6companies30days | Microsoft/Q12 Find All Four Sum Numbers.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution{
public:
// arr[] : int input array of integers
// k : the quadruple sum required
vector<vector<int> > fourSum(vector<int> &arr, int k) {
int N = arr.size();
vector<vector<int>> res;
sort(arr.begin(), arr.end());
... | ALGO | 0.999628 | 4.488114 |
d4f7ba0c-e157-4f35-83f1-403ca21dceef | ZakRipoll/ACM | Concurs 2016/X26694_en.cpp | #include <iostream>
#define MAX 500
using namespace std;
int main()
{
int aux, dimx, dimy, posx, posy, posxM, posxm, posyM, posym, contador;
char matrix[MAX][MAX];
bool acbar;
while( cin >> aux )
{
dimx = aux;
cin >> dimy;
for (int i = 0; i < dimx; ++i)
for (int j = 0; j < dimy; ++j)
cin >> ... | ALGO | 0.99933 | 3.747828 |
c4254760-3cd7-40d4-b6da-41f05fd3a4f5 | J-Rojas/Path-Planning-Demo | src/Eigen-3.3/unsupported/doc/examples/MatrixSinh.cpp | #include <unsupported/Eigen/MatrixFunctions>
#include <iostream>
using namespace Eigen;
int main()
{
MatrixXf A = MatrixXf::Random(3,3);
std::cout << "A = \n" << A << "\n\n";
MatrixXf sinhA = A.sinh();
std::cout << "sinh(A) = \n" << sinhA << "\n\n";
MatrixXf coshA = A.cosh();
std::cout << "cosh(A) = \n"... | ALGO | 0.975474 | 5.890235 |
76a2b1c0-52dd-4e9c-beff-8b9720fd82a2 | ou3slati/competitive-programming | Implementations/MyChecklist/Partitioning.cpp | //Never stop trying
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
#define boost ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
typedef string str;
typedef long long ll;
#define int ll
typedef double db;
typedef long double ld;
typedef pair<int,int> pi;
#define fi first
#define se... | ALGO | 0.999686 | 3.782612 |
a17dc24a-9793-4f00-a7eb-a5202af6b4cd | Wind134/CppLearn | 刷力扣/多维矩阵/59-螺旋矩阵2.cpp | /*
题目:
- 给你一个正整数n,生成一个包含1到n^2所有元素,且元素按顺时针顺序螺旋排列的nxn正方形矩阵matrix。
思路:54题的逆过程,当然,54题本身矩阵行列并不等。
- 对矩阵绕圈圈的过程;
*/
#include "../headfile/io_for_leetcode.h"
using namespace std;
vector<vector<int>> generateMatrix(int n)
{
vector<vector<int>> result(n, vector<int>(n)); // 初始化了一个矩阵matrix
int row_up = 0; // 上方... | ALGO | 0.999695 | 5.160197 |
2f5c0526-a9b2-443b-b6a7-bd124877127c | SWEG-2014-EC-Batch/Code-Elite | FoP-I/Kirubel-wondwoson/Ex2_Employe_salary.cpp | #include <iostream>
using namespace std;
int main()
{
int weekly_working_hr, bonus_rate, base_salary, gross_salary, net_salary, bonus_payment;
string employee_name;
cout<<"Emoloyee's name ";
cin>>employee_name;
cout<<employee_name<<"'s Weekly working hours ";
cin>>weekly_working_hr;
cout<... | ALGO | 0.987248 | 3.637542 |
0df9e382-6f47-43ac-9b65-eb6e1b16813a | JHANVILADIWALA/Leetcode | 0001-two-sum/0001-two-sum.cpp | class Solution {
public:
vector<int> twoSum(vector<int>& nums, int target) {
//using map
map<int,int>m;
vector<int>ans;
for(int i=0; i<nums.size(); i++){
int a=nums[i];
int b=target-nums[i];
// cout<<a<<" "<<m[a]<<endl;
auto... | ALGO | 0.999562 | 5.333896 |
c2c8bac2-f2a5-4ea3-ae2d-fd464c346a47 | JayGJJ/Algorithm_LeetCode | questions/199.二叉树的右视图.cpp | /*
* @lc app=leetcode.cn id=199 lang=cpp
*
* [199] 二叉树的右视图
*/
// @lc code=start
/**
* 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), ... | ALGO | 0.999907 | 6.762891 |
e381a942-3387-4c53-a6d2-fb5ac6561ab6 | Ayushluthra2001/LeetCode-CN-POTD | Isomorphic Strings.cpp | class Solution {
public:
bool isIsomorphic(string s, string t) {
unordered_map<char,int>map1,map2;
for(auto i : s){
map1[i]++;
}
for(auto i : t){
map2[i]++;
}
for(int i=1;i<s.length();i++){
if(s[i-1]==s[i]){
if(t[i-1... | ALGO | 0.999986 | 6.246201 |
71b57d06-d9bc-4d10-8f2d-be71440c9586 | Mohammad-Ashikul-Islam/Competitive_Programming | Codeforces/B. Three Threadlets.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef double dl;
... | ALGO | 0.99996 | 4.880455 |
ed9cc54f-35a7-4c13-aa2b-52a0f9dbc962 | apru02/LeetCode-ACs | 893-all-nodes-distance-k-in-binary-tree/all-nodes-distance-k-in-binary-tree.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
void inorder(TreeNode* root,vector<int> adj[]){
if(root == nullptr) return;
if(... | ALGO | 0.999998 | 5.836023 |
ae84ecd5-21a1-475c-a04e-10428dcdf995 | sarvex/leetcode-julia | lcci/17.12.BiNode/Solution.cpp | /**
* 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* prev;
TreeNode* convertBiNode(TreeNode* root) {
TreeNode* dummy = new Tr... | ALGO | 0.999979 | 6.194341 |
3afa84cf-3c51-46e2-a44b-5a2e17951a60 | noogler-eng/noob-dsa | contest/6.minimumSwapsToSort.cpp | // Minimum Swaps To Sort
// https://leetcode.com/contest/weekly-contest-450/problems/minimum-swaps-to-sort-by-digit-sum/?slug=smallest-index-with-digit-sum-equal-to-index®ion=global_v2
#include<iostream>
using namespace std;
// important question
class Solution {
public:
int minSwaps(vector<int>& nums) {
... | ALGO | 0.999961 | 6.205712 |
405ec7b5-8da8-4766-be0a-be0df59ae282 | khoadangtgfit/1000_BT_C- | 1000 bai tap c/mang mot chieu/liet ke cac hoan vi.cpp | #include <stdio.h>
#include <iostream>
//#include <Algorithm>
//int a[100]; int n;
using namespace std;
/* xuat phat tu n-1 lui ve dau day
- tim a[i], dau tien sao cho a[i]< a[i+1]
- kiem tra lai, neu i>0; thi
+ kiem tra tu cuoi len dau day, tim phan tu dau tien lon hon a[i],
doi cho c2 phan tu nay vs a[i]
+ dao nguoc ... | ALGO | 0.999962 | 3.896152 |
fc9d445f-21a1-4374-af98-a9b6c253834f | sumanpandit2058/Code-With-Harry--C-Programming | Code With Harry/traingle_Pattern.cpp | #include<iostream>
using namespace std;
int main(){
int n;
cin>>n;
int i=1;
int count =1;
while(i<=4){
int j=1;
while(j<=i){
cout<<count;
count= count +1;
j=j+1;
}
cout<<endl;
i=i+1;
}
} | ALGO | 0.999955 | 3.257982 |
5995af77-5119-4b96-8742-13e9a17c3736 | Helnex/LABS | 1 sem/Lab3/lab3.cpp | // #include <cmath>
// #include <iostream>
// using namespace std;
// const double epsilon = pow(10, -6);
// double f(double x)
// {
// return 3 * x - 4 * log(x) - 5;
// }
// int main()
// {
// double a, b, x;
// a = 2;
// b = 4;
// while (abs(b - a) > epsilon)
// {
// x = (a + b) / 2... | ALGO | 0.999986 | 4.496546 |
9764fd82-81d2-4f36-8a14-f702087b9684 | aewsion/M4RL | 4_testing_treatments_with_ST_based_TME/src/cellgrids.cpp | #include <iostream>
#include <random>
#include "cellgrids.h"
extern std::random_device rd;
CellGrids::CellGrids(int size) {
gs = size;
for(int i=0; i<gs; ++i){
for(int j=0; j<gs; ++j){
tc[i][j] = 0; //tumor cell
m0[i][j] = 0; //M0
m1[i][j] = 0; //M1
m2[... | ALGO | 0.952332 | 4.351879 |
3d21ab58-69a5-4fbf-9966-4eebdf699bc3 | ashutosh017/cp_journey | 094_grab_candies_cf.cpp | //#include <bits/stdc++.h>
#include<iostream>
using namespace std;
int main(){
int t;
cin>>t;
while(t--){
int n,even=0,odd=0;
cin>>n;
int arr[n];
for (int i = 0; i < n; i++)
{
cin>>arr[i];
if(arr[i]%2==0)even+=arr[i];
else odd+=arr... | ALGO | 0.999924 | 4.299174 |
354394bd-6368-434c-a7da-b3280ba3ad53 | DuyTaDinh/Code.ptit.TaDuy | DSA C++/DSA05015.cpp | #include <bits/stdc++.h>
using namespace std;
using ll= long long;
#define MOD 1000000007
ll dp[1005];
main() {
int t;
cin>>t;
while(t--) {
int n,k;
cin>>n>>k;
if(k>n) {
cout<<"0\n";
continue;
}
dp[0]=1;
for(int i=1;i<=k;i++) {
dp[i]=dp[i-1]*(n-i+1);
dp[i]%=MOD;
}
cout<<dp[k]<<endl;
}... | ALGO | 0.999956 | 4.429403 |
22cffe87-db2f-428b-8a08-2141a1e0cf1b | davehorton/pcap_ripper | deps/boost_1_65_1/libs/geometry/doc/src/examples/algorithms/simplify.cpp | // Boost.Geometry (aka GGL, Generic Geometry Library)
// QuickBook Example
//[simplify
//` Example showing how to simplify a linestring
#include <iostream>
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/linestring.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
/*< For this example we use ... | ALGO | 0.931331 | 7.447641 |
661a1fa5-7e01-4046-a9ab-53effbd5bfe2 | educhielle/codeforces | 1500/twosubstrings/main.cpp | #include <iostream>
#include <vector>
using namespace std;
inline void fastIO()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
}
int main()
{
fastIO();
vector<int> vab, vba;
for (int c1=' ', c0, i=0; (c0 = getchar()) != '\n'; i++)
{
if (c1 == 'A' && c0 == 'B')... | ALGO | 0.99993 | 3.925653 |
8815ab5f-f7ac-452c-a1ee-a9962fba0393 | linzingandrei/OrarUBB-Frontend | orarubb-mobile_frontend/widget_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.997865 | 6.76775 |
6a4bf844-2321-4fac-b438-4f215962cfeb | wy-luke/LeetCode | 640.求解方程.cpp | /*
* @lc app=leetcode.cn id=640 lang=cpp
*
* [640] 求解方程
*/
// @lc code=start
class Solution {
public:
string solveEquation(string equation) {
// cnt统计x的个数,sum统计其他数之和,num用于记录当前的数字
int cnt = 0, sum = 0, num = 0, sign = 1;
int n = equation.size();
for (int i = 0; i < n; ++i) {
... | ALGO | 0.999984 | 5.333137 |
b3cbded5-c3dc-4720-8a27-830a582bba4b | 42somoim/42somoim4 | junhypar/2.DP1주차/1.make1.cpp | #include <iostream>
int main()
{
int a;
std::cin >> a;
int cnt[a+1] = {0};
for(int i = 2; i <= a;i++)
{
cnt[i] = cnt[i - 1] + 1;
if (i%2 == 0)
{
if( cnt[i] > cnt[i/2] + 1)
cnt[i] = cnt[i/2]+1;
}
if (i%3 == 0)
{
if(cnt[i] > cnt[i/3]+1)
cnt[i] = cnt[i/3]+1;
}
}
std::cout << cnt[a];
}
| ALGO | 0.999384 | 3.629455 |
2f0aec2a-ebdf-4c67-b332-cfd0407718b4 | syedfairozpasha/refresh_CplusPlus | ReferenceAndPointers.cpp | #include<iostream>
using namespace std;
void funcwithrefargs(int refparam[],int size)
{
for (int ivar = 0; ivar<size;ivar++)
{
refparam[ivar] = refparam[ivar]+1;
// refparam++;
}
}
void funcwithrefargs2(int (&refparam)[4],int size)
{
for (int ivar = 0; ivar<size;ivar++)
{
refparam[ivar] = ref... | ALGO | 0.932708 | 4.545424 |
7c473b0b-70c3-43dd-a674-cbaba3251d08 | qaisarabbas0011/flutter_basic | 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 |
c7642ba0-4d74-4a6c-b55e-9687ddbcd617 | ishandutta2007/codeforces | ronnie007/normal/671/C.cpp | #include<iostream>
#include<stdio.h>
#include<cmath>
#include<algorithm>
#include<vector>
#include<set>
#include<queue>
#include<stack>
#include<map>
using namespace std ;
#define MAXN 200007
int n ;
int a[ MAXN ] ;
vector < int > v[ MAXN ] ;
long long mn[ 5 * MAXN ] ;
long long mx[ 5 * MAXN ] ;
long long sm[ 5 * M... | ALGO | 0.999948 | 3.893013 |
90ecac7a-eef8-43c1-ade4-9fea86e88f7e | vikashkumr/Competitive-Programming | Spoj/JULKA.cpp | #include<bits/stdc++.h>
using namespace std;
string add(string s1,string s2)
{
string ans;
if(s1.length()<s2.length())
{
swap(s1,s2);
}
int l1=s1.length();
int l2=s2.length();
int diff=l1-l2;
int carry=0,sum;
for(int i=l1-1;i>=diff;--i)
{
sum=(s1[i]-'0')+(s2[i-diff]-'0')+carry;
ans.push_back(su... | ALGO | 0.999973 | 4.712717 |
3831aeab-80e1-49ae-9755-97a8a7d1c8ed | AndrewGergis1997/data_structure_algorithms | wk07/stl/stl3.cpp | #include <iterator>
#include <vector>
#include <algorithm>
#include "test.hh"
using namespace std;
/**
* @brief Return an iterator which points to the first instance of the given value
* If the value is not found, return v.end()
* @param v vector to search for
* @param given the value to be searched
* @r... | ALGO | 0.956923 | 4.520349 |
b9237474-f427-4cf9-b010-14eddf42d7cd | WendellReis/Competitive-Programming | Maratonas/UFU/contest_10/escolar.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
long long Vt, Tr; cin >> Vt;
while(Vt != 0){
cin >> Tr;
cout << (int)(sqrt(4-Tr+Vt) - 2) << "\n"; //Resultado da eq. de segundo grau
cin >> Vt;
}
return 0;
} | ALGO | 0.999713 | 3.539164 |
d8869f0d-2bb6-4aa5-813a-85020ae1408d | ishandutta2007/codeforces | toxtricity/normal/1042/D.cpp | #include<bits/stdc++.h>
typedef long long ll;
const int N = 200010;
ll pre[N];
int c[N];
ll x[N];
void add(int sit, int value){
for (++ sit; sit < N; sit += sit & -sit){
c[sit] += value;
}
}
int query(int sit){
if (sit < 0) return 0;
int ret = 0;
for (++ sit; sit; sit -= sit & -sit){
... | ALGO | 0.999978 | 3.845181 |
ab637f4f-77b2-4fc9-bcf5-10c3fc8543a9 | akansha2026/DSA_CODES | Graph_series/numberOfDistinctIslands.cpp | #include <bits/stdc++.h>
using namespace std;
// setupIO
void setupIO(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
#ifndef ONLINE_JUDGE
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
#endif
}
pair<int,int> findRowAndCol(int r1, int c1, int r2, int c2){
if(... | ALGO | 0.999929 | 5.940788 |
3ac8d391-3794-4387-84d4-3b0e0a90e5d3 | CmMounir/collab-prac | Arafa/Minimum-Number-Game.cpp | class Solution {
public:
vector<int> numberGame(vector<int>& nums) {
vector<int> result;
sort(nums.begin(), nums.end());
for(int i = 0; i < nums.size()-1; i++) {
result.push_back(nums[i+1]);
result.push_back(nums[i]);
i++;
}
retu... | ALGO | 0.999999 | 5.321729 |
723891b2-495e-4787-a62f-3e46eb1f6f13 | SHIVAAYgod/POTD | GFGPOTD-main/OCT 29 22/potdgfg.cpp | //{ Driver Code Starts
// Initial Template for C++
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
// User function Template for C++
// struct Trie
// {
// struct Trie *link[26];
// bool flag=false;
// bool containskey(char ch)
// {
// return (ch-'a'!=NULL);
// }
// ... | ALGO | 0.999922 | 5.441156 |
8246b2bd-b97a-40aa-8346-9f640f787eef | ZejunMa/Simulation-mass-spring-1d | extern/libigl/include/igl/qslim_optimal_collapse_edge_callbacks.cpp | IGL_INLINE void igl::qslim_optimal_collapse_edge_callbacks(
Eigen::MatrixXi & E,
std::vector<std::tuple<Eigen::MatrixXd,Eigen::RowVectorXd,double> > &
quadrics,
int & v1,
int & v2,
std::function<void(
const int e,
const Eigen::MatrixXd &,
const Eigen::MatrixXi &,
const Eigen::MatrixXi &,
... | ALGO | 0.993391 | 5.949907 |
3aa18f6c-799f-4a8b-918d-e98faa67e8c8 | CPJ-BO/ToyRenderer | renderer/thirdparty/smhasher/src/lookup3.cpp | // lookup3 by Bob Jekins, code is public domain.
#include "Platform.h"
#define rot(x,k) (((x)<<(k)) | ((x)>>(32-(k))))
#define mix(a,b,c) \
{ \
a -= c; a ^= rot(c, 4); c += b; \
b -= a; b ^= rot(a, 6); a += c; \
c -= b; c ^= rot(b, 8); b += a; \
a -= c; a ^= rot(c,16); c += b; \
b -= a; b ^= rot(a... | ALGO | 0.999605 | 5.986148 |
f33960b6-2741-4250-8dba-26590b28ca7f | Yunji0000/CPP | ch06/3_ex03_rotation.cpp | #include <iostream>
#include <string>
using namespace std;
int main(){
string s;
cout << "문자열 입력(한글 안됨): " << endl;
getline(cin, s, '\n');
int len = s.length(); //문자열 길이
for(int i=0; i<len; i++){
string first = s.substr(0,1); //맨 앞의 문자 1개를 문자열로 분리
string sub = s.substr(1, len-1); ... | ALGO | 0.975105 | 3.911727 |
fdc24563-06b3-4bb8-a80c-2b615d6f2076 | Ashish-Chokhani/Competitive_Programming | atcoder/309D.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll maxiDepth(vector<ll>*adj,ll n1,ll n2,ll cur){
vector<ll>vis(n1+n2,0);
queue<pair<ll,ll>>q;
q.push({cur,0});
vis[cur]=1;
ll maxi=0;
while(!q.empty()){
ll node=q.front().first;
ll dis=q.front().second;
... | ALGO | 0.999617 | 3.893704 |
b4d16d8d-b84c-4956-95d0-d804bc39d8d8 | LuisLara22/ejercicios_progrmacion_basica | 16 DE MARZO/hallar el promedio.cpp | #include <iostream>
using namespace std;
int main() {
int arr[5];
float suma = 0, promedio;
// Pedir al usuario que ingrese los valores del arreglo
for (int i = 0; i < 5; i++) {
cout << "Ingrese el valor del elemento " << i << ": ";
cin >> arr[i];
}
// Calcular la suma de los... | ALGO | 0.996863 | 3.992737 |
29936788-4a2f-4660-9274-f337b2cd2ec2 | Ore-WaNeko/data_test | 1ststacc.cpp | #include <iostream>
#include <stack>
using namespace std;
int main() {
stack<int> A;
int x, n, ctr;
cout << "Enter The Size of the Stack : ";
cin >> x;
for (ctr = 1; ctr <= x; ctr++) {
cout << "Enter Any Element : ";
cin >> n;
A.push(n);
}
cout << "Stack Size : " ... | ALGO | 0.997641 | 4.575354 |
1f0079c8-0e1a-4903-8dba-14dee8bb1bf9 | jjiny0716/Algorithm | Codewars/c++/5kyu_Simple_Pig_Latin.cpp | #include <string>
#include <vector>
using namespace std;
#include <iostream>
string pig_it(string str)
{
string result = "";
vector<string> words;
int lastPos = 0;
for (int i = 0; i < str.size(); i++) {
if (str[i] == ' ') {
words.push_back(str.substr(lastPos, i - lastPos));
... | ALGO | 0.963206 | 5.038858 |
45216bbb-baec-40d0-ba7b-3a1f93a02b49 | shaikharshan/Cpp | pointers.cpp | #include<iostream>
using namespace std;
int main(){
//pointers
int a=3;
int* b= &a;
cout<<"address of a="<<&a<<endl;
cout<<"address of a="<<b<<endl;
//dereference operator
cout<<"value at a="<<*b;
int** c= &b;
cout<<"the value of b"<<*c;
cout<<"adress of b ="<<c;
return 0;
} | ALGO | 0.981634 | 3.09075 |
d95b4d50-450e-4e15-b6f3-ce095c1e3c08 | jagadeeshm007/leetcode | 207-course-schedule/course-schedule.cpp | class Solution {
public:
bool canFinish(int n, vector<vector<int>>& prerequisites) {
vector<vector<int>>res(n);
vector<int>deg(n,0);
for(auto i:prerequisites)
{
res[i[1]].push_back(i[0]);
deg[i[0]]++;
}
queue<int>q;
for(int i=0;i<n;i++)... | ALGO | 0.999812 | 6.423467 |
b0619894-8989-49c9-a7ee-569b1be53dc6 | cryoelite/CompCode | Problems/LC/1.cpp | // https://leetcode.com/problems/two-sum/description/
#define LOCAL
#include "../Helpers/common.h"
void start();
void output();
void localSetup();
void commonSetupAndCleanInit(); // needs to be cleaned up and setup, cleanup
// here because it resets results so must be
... | ALGO | 0.999959 | 5.940618 |
5405a91c-ffce-492a-b00f-e79e901f8600 | LINKHA/Auto3D | Auto3D/ThirdParty/Bullet/Bullet3OpenCL/ParallelPrimitives/b3BoundSearchCL.cpp | //Originally written by Takahiro Harada
//Host-code rewritten by Erwin Coumans
#define BOUNDSEARCH_PATH "src/Bullet3OpenCL/ParallelPrimitives/kernels/BoundSearchKernels.cl"
#define KERNEL0 "SearchSortDataLowerKernel"
#define KERNEL1 "SearchSortDataUpperKernel"
#define KERNEL2 "SubtractKernel"
#include "b3BoundSearchC... | ALGO | 0.99757 | 5.2929 |
be1f2743-0b19-419a-b1a5-2bbf68adfaf5 | sarvex/leetcode-ada | solution/0400-0499/0447.Number of Boomerangs/Solution.cpp | class Solution {
public:
int numberOfBoomerangs(vector<vector<int>>& points) {
int ans = 0;
for (const auto& p : points) {
unordered_map<int, int> cnt;
for (const auto& q : points) {
++cnt[(p[0] - q[0]) * (p[0] - q[0]) + (p[1] - q[1]) * (p[1] - q[1])];
... | ALGO | 0.999907 | 6.215004 |
86090a36-afa5-472e-99d0-6b126428f210 | ss5ssmi/OJ | codeforce/CF_1006A.cpp | #include<bits/stdc++.h>
using namespace std;
int main() {
int n,s[1000],maxx=0;
cin>>n;
for(int i=0;i<n;i++){
cin>>s[i];
maxx = max(maxx,s[i]);
}
for(int i=0;i<n;i++){
if(s[i]%2==0){
s[i]--;
}
}
for(int i=0;i<n;i++){
printf("%d",s[i]);
if(i!=n-1) printf(" ");
}
return 0;
}
| ALGO | 0.99994 | 3.811553 |
acf9a0e3-084a-4342-a47b-6b69975675fd | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_5457_6.cpp | #include <bits/stdc++.h>
using namespace std;
long long sigma(long long n) { return (n * (n + 1) / 2); }
long long MOD(long long x) {
if (x >= 0) return x;
return (-x);
}
bool great(long long a, long long b) { return a > b; }
long long max3(long long a, long long b, long long c) {
return (max(a, max(b, c)));
}
lo... | ALGO | 0.999961 | 4.41975 |
d84893ce-f625-4206-b3de-15109d339852 | MatteoHerz/Fisica_1Anno | Programmazione_C++/Laboratorio/P_3_8.cpp | #include<iostream>
#include<cmath>
#include<iomanip>
#include<cstdlib>
#include<ctime>
using namespace std;
int* alloca_vettore(int n){
int *v;
v=new int[n];
return v;
}
void dealloca_vettore(int *v){
delete[] v;
}
int* legge_vettore(int n){
int *v;
v=alloca_vettore(n); // alloca memoria per l'array
f... | ALGO | 0.971175 | 3.123574 |
059b85bb-59fc-496a-a4cc-afecd0155566 | Asem758/csc101-c-plus-plus-course-problem- | Personal_Practice/Decimal_to_binary.cpp | #include <iostream>
using namespace std;
void DecToBinary()
{
int n = 4;
int binary_number = 0;
int i = 1;
while (n)
{
binary_number = binary_number + n % 2 * 1;
i = i * 10;
n = n / 2;
}
cout <<"Binary number is: " << binary_number <<endl;
}
int main() {
DecToBinary();
retu... | ALGO | 0.999783 | 5.167041 |
f54f8980-80d6-4726-b9e5-2ef2c38dd8d6 | iamarghamallick/GeeksforGeeks-Solutions | Difficulty: Easy/Level order traversal/level-order-traversal.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
/* A binary tree node has data, pointer to left child
and a pointer to right child */
class Node {
public:
int data;
Node* left;
Node* right;
// Constructor
Node(int val) {
data = val;
left = nullptr;
... | ALGO | 0.998991 | 7.060864 |
c8635da6-4e68-41d8-be6b-e3a77ecd26f3 | yinchengtsinghua/YinchengCoin | chainparams.cpp | #include <chainparams.h>
#include <consensus/merkle.h>
#include <tinyformat.h>
#include <util.h>
#include <utilstrencodings.h>
#include <assert.h>
#include <chainparamsseeds.h>
static CBlock CreateGenesisBlock(const char* pszTimestamp, const CScript& genesisOutputScript, uint32_t nTime, uint32_t nNonce, uint32_t nB... | CONFIG | 0.940202 | 6.337671 |
0a8f9189-3c49-4726-8928-f7bcce8cbb11 | nikhilambekar1234/CPP-Language | advance/oops/function/with arg and return/with arg and return factorial.cpp | //factorial series
#include<iostream>
using namespace std;
int fun(int n)
{
int i,j=1,sum=0;
for(i=1;i<=n;i++)
{
j=j*i;
}
sum+=j;
return sum;
}
int main()
{
int i,j=1,n,sum=0;
cout<<"enter num:";
cin>>n;
sum=fun(n);
cout<<"factorial = "<<sum;
}
| ALGO | 0.999931 | 4.04359 |
363b39b9-2cbd-4611-8e70-43da07f2fea9 | sunwaylive/proactive-learning-on-scenes | DepthSensing/Include/Eigen_3.1.2/bench/quat_slerp.cpp | #include <iostream>
#include <Eigen/Geometry>
#include <bench/BenchTimer.h>
using namespace Eigen;
using namespace std;
template<typename Q>
EIGEN_DONT_INLINE Q nlerp(const Q& a, const Q& b, typename Q::Scalar t)
{
return Q((a.coeffs() * (1.0-t) + b.coeffs() * t).normalized());
}
template<typename Q>
EIGEN_DONT_INL... | ALGO | 0.995148 | 6.251565 |
957c3195-2c6b-4af7-97d5-075bac497c9b | yash-dhingra/DS_Codes | DS_Class/Trees/MKT_Ques/q1.cpp | //Q1. Level Print Zig-Zag
#include <iostream>
#include <cstdlib>
using namespace std;
struct Node
{
int data;
Node *rp, *lp;
};
struct stack_node
{
Node *data;
stack_node *next;
};
// Stack Begins
class stack
{
struct stack_node *top;
public:
void push(Node *new_data)
{
stack_... | ALGO | 0.999937 | 4.16425 |
f28279a7-644a-41bd-b9e5-213025581b0d | king-yyf/cpcode | luogu/nica_0623/i.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ar2 = array<int, 2>;
using ar3 = array<int, 3>;
using ar4 = array<int, 4>;
#define all(c) (c).begin(), (c).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define f0(e) for(int i = 0; i < (e); ++i)
#define f1(e) for... | ALGO | 0.998858 | 3.708314 |
89c8eef0-be7c-489c-932e-2f2039d4a117 | Hendrik240298/PhD_SupplementaryCode | ROM_NSE/dealII/include/eigen-3.4.0/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_colwise.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
int main()
{
Eigen::MatrixXf mat(2,4);
mat << 1, 2, 6, 9,
3, 1, 7, 2;
std::cout << "Column's maximum: " << std::endl
<< mat.colwise().maxCoeff() << std::endl;
}
| ALGO | 0.999785 | 3.779679 |
b1a60bb0-0713-47e8-a88c-994cab01eda4 | anujverma08/week1-KS005-CipherSchools | lecture5part1.cpp |
#include<iostream>
using namespace std;
int main(){
int x;
int a[5];
int a,b,c,d,e;
cout << "give 5 integers as input" << endl;
cin >> a >> b >> c >> d >> e;
cout << "reverse order is : " << e << d << c << b << a;
}
| ALGO | 0.998657 | 3.509759 |
3441e422-e83e-47d8-a1b1-5476005b41d8 | In1ecti0n/Cpp_PTIT | KTUOCSO002.cpp | #include <bits/stdc++.h>
using namespace std;
bool prime(int n){
if (n <= 1){
return false;
}
for (int i = 2; i <= sqrt(n); i++){
if (n % i == 0){
return false;
}
}
return true;
}
int uocsoprime(int n){
int dem = 0;
for (int i = 1; i <= n; i++){
... | ALGO | 0.999861 | 3.931397 |
00327532-f5a8-45db-a9cf-e7cbdb849d8a | artahadhahd/expression-parser | main.cpp | #include <iostream>
#include <iomanip>
#include <optional>
#include "tree.hpp"
// struct TreeNode {
// Token data;
// TreeNode* left;
// TreeNode* right;
// };
#include "lexer.hpp"
using ErrorType = std::string;
struct {
ErrorType err;
bool has_failed;
} compiler_state = {
"", false
};
std... | ALGO | 0.99365 | 5.400143 |
18b3158d-b75f-4e51-8225-3527f5832038 | nhattanho/LeetcodePractices | BinaryTree/199_Binary_Tree_Right_Side_View.cpp | class Solution {
public:
vector<int> rightSideView(TreeNode* root) {
if(root == NULL) return {};
vector<int>v;
queue<TreeNode*>q; /*Space O(n) <=> diameter of the tree*/
q.push(root);
while(!q.empty()){ /*Time O(n)*/
int size = q.size();
... | ALGO | 0.99998 | 6.210507 |
d0fd215a-d215-48c0-9499-50e0df6b65bf | ishandutta2007/codeforces | ppavic/normal/834/C.cpp | #include <cstdio>
#include <cmath>
using namespace std;
typedef long long int llint;
const llint INF = 1e6;
int n;
llint a,b;
llint llgcd(llint a,llint b){
if(!a || !b) return a + b;
if( a < b )
return llgcd(a,b%a);
return llgcd(b,a%b);
}
llint treci(llint lo,llint hi,llint x){
if(lo > hi) ... | ALGO | 0.999956 | 3.720972 |
26bbf784-6a52-4b24-a49e-c3e5e0b41753 | Wsh7Ash/LEETCODE | cpp/c1001-1500/1130.cpp | class Solution {
public:
int mctFromLeafValues(vector<int>& arr) {
int n = arr.size();
vector<vector<int>> dp(n, vector<int>(n, 0));
vector<vector<int>> maxLeaf(n, vector<int>(n, 0));
for(int i = 0; i < n; i++){
maxLeaf[i][i] = arr[i];
... | ALGO | 0.999836 | 5.694571 |
c92f33b8-06bf-4d9b-b3bf-1042565687c5 | mehedi-66/LeetCode | NeetCode150/008_271_Encode_and_Decode_String.cpp | #include<bits/stdc++.h>
using namespace std;
/*
Problem Statement:
Design an algorithm to encode a list of strings to s string the encoded string is then
sent over the network and is decoded back to the original list of strings
Example:
S: [ab, b, abc, d]
E.S: [xxxxxxxxxxxx]
D.S: [ab, b, abc, d]
A... | ALGO | 0.999905 | 5.055323 |
9872ff77-cd72-44ae-862d-f722d24da70d | Gaofei244617/Demo | lib/opencv/sources/modules/cudaimgproc/src/mean_shift.cpp | #include "precomp.hpp"
using namespace cv;
using namespace cv::cuda;
#if !defined (HAVE_CUDA) || defined (CUDA_DISABLER)
void cv::cuda::meanShiftFiltering(InputArray, OutputArray, int, int, TermCriteria, Stream&) { throw_no_cuda(); }
void cv::cuda::meanShiftProc(InputArray, OutputArray, OutputArray, int, int, TermCr... | ALGO | 0.925527 | 7.564939 |
7f7e4788-750a-4e1b-a936-1fb27074141b | embracemaking/BTT-SKR-Mini-E3-V3-Firmware-CR6SE | Marlin/buildroot/share/PlatformIO/variants/MARLIN_F103VE_LONGER/variant.cpp | #include "pins_arduino.h"
#ifdef __cplusplus
extern "C" {
#endif
// Digital PinName array
const PinName digitalPin[] = {
PA_0, //D0
PA_1, //D1
PA_2, //D2
PA_3, //D3
PA_4, //D4
PA_5, //D5
PA_6, //D6
PA_7, //D7
PA_8, //D8
PA_9, //D9
PA_10, //D10
PA_11, //D11
PA_12, //D12
PA_13, //D... | CONFIG | 0.867032 | 4.548084 |
908764dd-aa5f-4b31-a629-9ca0e861e898 | kotabrog/mycode_competition | AtCoder_Problems/ABC/B/183_Billiards/main.cpp | #include <bits/stdc++.h>
using namespace std;
// 小数点以下桁数
// fixed << setprecision(i)
int64_t gcd(int64_t a,int64_t b){return (a%b==0?b:gcd(b, a%b));}
int64_t lcm(int a,int b){return (int64_t)a*b/gcd(a, b);}
int factorial(int a){int b=1;while(a){b*=a--;}return b;} //13以下対応
bool is_prime(int a){if(a<=1)return false;for... | ALGO | 0.989874 | 3.193131 |
4776725b-96da-458f-b791-db437fb40eff | weizds/LeetCode | medium/62_Unique_Paths.cpp | class Solution {
public:
int uniquePaths(int m, int n) {
vector<vector<int>> dp(m + 1, vector<int>(n + 1, 0));
dp[1][1] = 1;
for(int i = 1; i <= m; ++i) {
for(int j = 1; j <= n; ++j) {
dp[i][j] = max(dp[i][j], dp[i - 1][j] + dp[i][j - 1]);
}
}
... | ALGO | 0.999912 | 6.550473 |
18207e24-d77b-433d-b18b-ef549ab89c12 | pendulating/DecisionTree | DecisionTree.cpp | // Matt Franchi // CPSC 2120 // Spring 2020
// Assignment 3 - DecisionTree class implementation file
#include "DecisionTree.h"
using namespace std;
// CONSTRUCTOR: Parameterized
DecisionTree::DecisionTree(set<Animal> & data )
{
string splitFeature = getSplit(data);
root = createTreeFor(data);
}
// DESTRUCTO... | ALGO | 0.950897 | 5.855814 |
1bdebcc8-f021-44d8-8d2a-8866e2951e70 | SurgicalSteel/Competitive-Programming | Kattis-Solutions/Secret Message.cpp | #include <bits/stdc++.h>
using namespace std;
string solve(string s)
{
string builder="";
int l=s.length();
int x=(int)ceil(sqrt((double) l));
string mat[x][x];
int pos=0;
for(int j=0;j<x;j++)
{
for(int i=0;i<x;i++)
{
if(pos<l)
{mat[i][j]=s.substr(pos,... | ALGO | 0.999981 | 4.495777 |
2339a949-4b8d-4c51-a11c-fec62c6a44df | blackdeman/masters-algorithms-course | 03_cache_miss/main_analyzed.cpp | #include <iostream>
#include <random>
#include <ctime>
#include "Cache.h"
//__declspec(align(16))
// __restrict
namespace {
/*
void MultSimple(const float* __restrict a, const float* __restrict b, float* __restrict c, int n)
{
for (int i = 0; i < n; ++i) {
for (int j = 0; j < n; ++j) {
c[i * n + j] = 0.f;... | TOOL | 0.924312 | 4.077578 |
6ac42e22-1b3b-45c7-996d-e8729cf69662 | 0xedb/algo-ds | c++/leetcode/1394. Find Lucky Integer in an Array.cpp | class Solution
{
public:
int findLucky(vector<int> &arr)
{
map<int, int> seen;
set<int> nums(arr.begin(), arr.end());
for (auto i : arr)
{
if (seen.find(i) != seen.end())
seen[i] += 1;
else
seen[i] = 1;
}
vector<int> lucky;
for (auto key : nums)
{
... | ALGO | 0.999778 | 5.394646 |
8a0fa606-8080-4b66-81ed-6d9a608fe4f7 | faheemmuhammed1133/Cpp | 26 problems (cpp)/23_sum_of_elements_in_row.cpp | #include <iostream>
using namespace std;
int main() {
int r,c;
cout<<"enter number of rows and columns you want:";
cin>>r>>c;
int x[r][c];
// input
for(int i = 0; i < r; ++i){
for (int j = 0; j < c; ++j) {
cout<<"enter element "<<i+1<<","<<j+1<<" of array";
cin>>... | ALGO | 0.999723 | 5.251157 |
9ce62a26-e16c-4653-bbff-0f1392c8d4f8 | pepper99/competitive-programming | atcoder/abc217/a.cpp | #include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
#define ff first
#define ss second
#define ll long long
#define vi vector... | ALGO | 0.999993 | 5.162811 |
0d0c6de7-9ad3-442b-ad43-3d83ae41b787 | ZJWang9928/PAT-Solutions | Basic/1065.cpp | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
int n, m;
int dou[100005], single[100005], ret[100005] = {0}, gus[100005] = {0};
int main() {
ios::sync_with_stdio(false);
memset(d... | ALGO | 0.999966 | 3.774208 |
83376881-1cad-42ed-bccd-752f4fbccfef | abusomani/Leetcode | Practice/is-graph-bipartite(dfs).cpp | class Solution
{
public:
bool dfs(vector<vector<int>> &graph, vector<int> &colors, int src, int color)
{
if (colors[src] != 0)
return colors[src] == color;
colors[src] = color;
for (auto &neighbor : graph[src])
if (!dfs(graph, colors, neighbor, -color))
... | ALGO | 0.999965 | 5.966846 |
edaa5e3e-5ed9-41cf-9e43-08485f1c44df | thalium/icebox | third_party/virtualbox/src/libs/xpcom18a4/xpcom/ds/nsVoidArray.cpp | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; c-file-offsets: ((substatement-open . 0)) -*- */
#include "nsVoidArray.h"
#include "nsQuickSort.h"
#include "prmem.h"
#include "nsCRT.h"
#include "nsString.h"
#include "prbit.h"
/**
* Grow the array by at least this many elements at a time.
*... | TOOL | 0.893629 | 6.920093 |
66c24dca-ca72-4aad-83ea-6dfa0bae15d7 | meekhumor/C- | 10_Special_Algorithm/Question_on_algorithm/Partition_of_array_sum.cpp | #include <bits/stdc++.h>
using namespace std;
int prefixsum(vector<int> nums, int si, int ei)
{
for(int i = 1; i < nums.size(); i++)
{
nums[i] += nums[i-1];
}
return nums[nums.size()-1];
}
int main()
{
system("clear");
int n;
cout<<"Enter size of array: ";
cin>>n;
vector<in... | ALGO | 0.99993 | 3.923106 |
030eb241-7796-4e35-b276-293faba65de8 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_4548_0.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
int ar[n], sum = 0;
for (int i = 0; i < n; i++) cin >> ar[i], sum += ar[i];
sort(ar, ar + n);
double avg = sum / (double)n;
int i = 0;
while (i < n && !(avg >= 4.5)) {
sum -= ar[i... | ALGO | 0.999941 | 4.172752 |
3484c614-a5e3-4591-9142-97d8eff2dcc4 | abhisingh2244/leetcode | 300-longest-increasing-subsequence/300-longest-increasing-subsequence.cpp | class Solution {
public:
int lengthOfLIS(vector<int>& arr) {
int n=arr.size();
vector<int> v;
v.push_back(arr[0]);
for(int i=1;i<n;i++){
if(arr[i]>v.back()) v.push_back(arr[i]);
else{
int ind=lower_bound(v.begin(),v.end(),arr[i])-v.begin();
... | ALGO | 0.999987 | 6.004844 |
d48d3d41-2d5c-416f-9150-260e73fd9f9b | ANLAB-KAIST/adios | dispatcher/deps/faiss/tests/test_mem_leak.cpp | #include <faiss/IndexFlat.h>
#include <faiss/IndexIVFFlat.h>
#include <faiss/utils/random.h>
#include <faiss/utils/utils.h>
#include <gtest/gtest.h>
using namespace faiss;
TEST(MEM_LEAK, ivfflat) {
size_t num_tfidf_faiss_cells = 20;
size_t max_tfidf_features = 500;
IndexFlatIP quantizer(max_tfidf_featur... | TEST | 0.892784 | 6.155814 |
bc6f6855-4eed-4441-abb3-8bc417c9e9fc | Ayushrak/DSA-ROHIT-NEGI | HEAP/DAY 190/KthElemMatrix.cpp | #include<iostream>
#include<bits/stdc++.h>
using namespace std;
int kthSmallest(int mat[MAX][MAX], int n, int k)
{
//Your code here
vector<pair<int,pair<int,int>>>temp;
for(int i=0;i<n;i++){
temp.push_back(make_pair(mat[i][0],make_pair(i,0)));
};
//create Min Heap
priority_queue<pair<int,pair<int,int... | ALGO | 0.999952 | 4.081323 |
8b480eb5-d9a4-4d72-a134-8b3fb2584654 | yusifaliyevpro/Competitive-Programming | LeetCode/Easy/193. Valid Phone Numbers.cpp | // 193. Valid Phone Numbers
// https://leetcode.com/problems/valid-phone-numbers/
#include <iostream>
using namespace std;
// No C++ template available.
| ALGO | 0.95176 | 5.016402 |
4106da14-08b5-48f5-aa36-3a77d8e14873 | Jackojc/aoc2020 | day2/main.cpp | #include <charconv>
#include <tuple>
#include <chrono>
#include <util.hpp>
#include <tinge.hpp>
#define ANKERL_NANOBENCH_IMPLEMENT
#include <nanobench.h>
auto parseln(const char*& str) {
int start = util::parse_int(str);
util::parse_char(str, '-');
int end = util::parse_int(str);
util::skip_whitespace(str);
... | ALGO | 0.871949 | 5.334432 |
32edeee2-9206-479f-8021-236d1b0ba674 | joeyjhg/AiV_VisionSW | opencv/sources/modules/calib3d/src/ptsetreg.cpp | #include "precomp.hpp"
#include <algorithm>
#include <iterator>
#include <limits>
#include "usac.hpp"
namespace cv
{
int RANSACUpdateNumIters( double p, double ep, int modelPoints, int maxIters )
{
if( modelPoints <= 0 )
CV_Error( Error::StsOutOfRange, "the number of model points should be positive" );
... | ALGO | 0.999041 | 6.006679 |
4d55aabe-a931-4c49-a60d-f04b9cfa73d2 | rakib181/Phitron | Week - 06/N.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
signed main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t;
cin >> t;
while(t--){
int n, k, l;
cin >> n >> k >> l;
vector<int> songs[6];
for(int i = 1; i <= n; i++){
int m, li;
... | ALGO | 0.999224 | 3.901401 |
cca87121-be2b-4e23-a9c2-d58206f00327 | MostlyFor/Algorithm_topic | !previous/programmeres-lv2/day9/시소 짝궁.cpp | #include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <iostream>
using namespace std;
long long solution(vector<int> weights) {
long long answer = 0;
map<float,int> m;
sort(weights.begin(), weights.end());
for(int i=0; i<weights.size(); i++){
m[weights[... | ALGO | 0.998865 | 3.977042 |
82bdb48e-262f-422f-8bbb-be2b51492c18 | rahedmir/academic | makaut/cpp/programs/basic/part -1/Area & Perimeter of a rectangle/area & perimeter.cpp | //a program to calculate area & perimeter of a rectangle.
#include <iostream>
using namespace std;
int main()
{
float l,b,a=0,p=0;
cout<<"Enter the value of length "<<endl;
cin>>l;
cout<<"Enter the value of breadth "<<endl;
cin>>b;
a=(l*b);
p=2*(l+b);
cout<<"Calculated area is "<<a<<" and perimeter i... | TOOL | 0.861987 | 3.539686 |
aad04f60-7dcc-40d6-bd10-22c8fb8d92af | aleax888/codeforces | 800/Love Story.cpp | #include <iostream>
#include <string>
using namespace std;
int main()
{
int t, ans;
cin >> t;
string cf = "codeforces", s;
for (size_t i = 0; i < t; i++)
{
ans = 0;
cin >> s;
for (size_t j = 0; j < 10; j++)
{
if (cf[j] != s[j])
{
... | ALGO | 0.999441 | 4.475147 |
190838e7-18de-455a-951e-16b89174bb73 | Shikhrar214/DSA-with-cpp | loop/even_number.cpp | #include <iostream>
using namespace std;
int main(){
int range ;
cout <<"enter range: ";
cin >> range;
for(int i = 1; i<=range; i++){
if(i%2==0){
cout<< i << endl;
}
}
return 0;
} | ALGO | 0.996855 | 3.476729 |
a5501e6b-b900-4eb5-9483-d00f1b09a84d | vfolunin/archives-solutions | EOlymp/10506.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <string>
using namespace std;
void dfs(vector<vector<int>> &graph, int v, vector<int> &visited) {
visited[v] = 1;
for (int to : graph[v])
if (!visited[to])
dfs(graph, to, visited);
}
int main(... | ALGO | 0.999652 | 4.69462 |
9d4929d5-64b1-4308-966a-4d70e486986e | alexmaruichen/code | binary/bzoj_2600.cpp | #include <stdio.h>
#include <algorithm>
using namespace std;
typedef long long ll;
const int maxn=100010;
ll r,l,b;
ll a[maxn];
ll sum[maxn];
ll ans;
bool check(ll l,ll r)
{
ll mid=(r+l+1)>>1;
ll sum1=(mid-l)*a[mid]-(sum[mid]-sum[l]);
ll sum2=sum[r]-sum[mid]-(r-mid)*a[mid];
return sum1+sum2>b;
}
int main()
{
scanf... | ALGO | 0.999971 | 3.815774 |
66351778-cb97-4710-8fd8-8b3fc7062ac3 | DATx-Protocol/DATx | datxchain/contracts/libc++/upstream/test/std/numerics/rand/rand.eng/rand.eng.lcong/eval.pass.cpp | // <random>
// template <class UIntType, UIntType a, UIntType c, UIntType m>
// class linear_congruential_engine;
// result_type operator()();
#include <random>
#include <cassert>
template <class T>
void
randu()
{
typedef std::linear_congruential_engine<T, 65539, 0, 2147483648u> E;
E e(1);
assert(e() ... | TEST | 0.854608 | 5.702198 |
b339bfc0-ea57-4eb4-a542-4b793943ceee | ishandutta2007/codeforces | klimoza/normal/1436/D.cpp | //#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,popcnt,abm,mmx,tune=native")
//#pragma GCC target("avx2")
//#pragma GCC optimize("no-stack-protector")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("fast-math")
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <math.h... | ALGO | 0.999983 | 3.926628 |
3a29f90d-3fc5-46a5-9243-22a103bd5a3d | bhagyesh-nimbalkar/DSA | Searching/tripletinsorted.cpp | #include <bits/stdc++.h>
using namespace std;
bool isPair(int* arr,int n,int x,int s)
{
int i=s,j=n-1;
while(i<j)
{
int sum = arr[i]+arr[j];
if(sum==x) return true;
else if(sum>x) j--;
else i++;
}... | ALGO | 0.999988 | 4.957773 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.