uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
738530dc-51ee-4850-8467-7175984cd015 | Rishabhcodes65536/RISHABH_CP | B/B_Spoilt_Permutation.cpp | #include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ff first
#define ss second
#define pb push_back
#define int long long
#define lb lower_bound
#define ub upper_bound
#define eb empla... | ALGO | 0.999871 | 3.341084 |
610f558d-9f08-47d1-a419-531ebf9962ad | luozzzam/exam-grading | exams/exercises/14_class_destruct/main.cpp | #include "../exercise.h"
// READ: 析构函数 <https://zh.cppreference.com/w/cpp/language/destructor>
// READ: RAII <https://learn.microsoft.com/zh-cn/cpp/cpp/object-lifetime-and-resource-management-modern-cpp?view=msvc-170>
/// @brief 任意缓存容量的斐波那契类型。
/// @details 可以在构造时传入缓存容量,因此需要动态分配缓存空间。
class DynFibonacci {
size_t *c... | ALGO | 0.878286 | 5.794847 |
82f632d5-c192-4af8-8fed-1fa35136d709 | username6452728464/dmchain | eos/libraries/libfc/libraries/ff/libff/algebra/curves/alt_bn128/alt_bn128_pp.cpp | /** @file
*****************************************************************************
* @author This file is part of libff, developed by SCIPR Lab
* and contributors (see AUTHORS).
* @copyright MIT license (see LICENSE file)
***********************************************************************... | ALGO | 0.97535 | 6.273318 |
529bae94-ab88-43a0-af94-d71d77945ab7 | kmjp/procon | atcoder/arc101-150/arc137/e.cpp | #include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define FORR2(x,y,arr) for(auto& [x,y]:arr)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define ... | ALGO | 0.999837 | 4.446197 |
4f918852-43e6-4d44-8569-13617058061d | ETdan/competitive-programming | fib.cpp | class Solution {
public:
int fib(int n) {
if(n>2)
return fib(n-1) + fib(n-2);
else if(n==0)
return 0;
else
return 1;
}
};
| ALGO | 0.999958 | 5.969864 |
bd0ef581-d9ee-453d-8cb6-3d56a3d38790 | ComputerProgrammerStorager/DataStructureAlgorithm | CLRS/Math/AngleBetweenHandsofaClock.cpp | /*
Given two numbers, hour and minutes, return the smaller angle (in degrees) formed between the hour and the minute hand.
Answers within 10-5 of the actual value will be accepted as correct.
Example 1:
Input: hour = 12, minutes = 30
Output: 165
Example 2:
Input: hour = 3, minutes = 30
Output: 75
Example 3:
Input:... | ALGO | 0.999841 | 6.603592 |
8e393ebf-d3b7-4bfe-b962-0884b3df5c5a | mikelovato/data-structure | Intervithm/romantointeger.cpp | class Solution1 {
public:
int romanToInt(string s) {
int ret = toNumber(s[0]);
for (int i = 1; i < s.length(); i++) {
if (toNumber(s[i - 1]) < toNumber(s[i])) {
ret += toNumber(s[i]) - 2 * toNumber(s[i - 1]);
} else {
ret += toNumber(s[i]);
... | ALGO | 0.999763 | 6.113482 |
2080d5ab-ef4d-4e51-bce5-d6965f305174 | johnny6464/UVA | UVA100-9999/UVA872.cpp | #include<iostream>
#include<vector>
#include<set>
#include<map>
using namespace std;
struct Node {
bool isVisited = false;
set<char> parent;
};
void backtrack(map<char, Node>& relation, vector<char>& sequence, char now, bool& isCycle) {
if (sequence.size() == relation.size()) {
for (auto iter = sequence.begin();... | ALGO | 0.999984 | 5.254108 |
1302938d-cbd2-4219-8dae-2b257020d310 | phungdinhtrung/flutter-tutorial | app_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.998076 | 6.776823 |
c2c4e89c-db68-460c-9b03-b7e8645122af | kimyu0218/algorithm | Baekjoon/4000-4999/4256.cpp | #include <iostream>
#include <vector>
using namespace std;
// 1. 전위 순회 : 루트의 위치는 알 수 있지만 서브 트리의 경계 알 수 없음
// 2. 중위 순회 : 루트를 중심으로 왼쪽, 오른쪽 서브 트리가 나뉨
vector<int> preorder, inorder_idx;
void divide(int idx, int left, int right) { // (idx : 루트 위치)
if(left > right) return; // conquer
int root = preorder[idx];
... | ALGO | 0.999991 | 4.839108 |
8780ae1d-200d-4577-a3fe-4cb2830a07e6 | willcruse/aoc-24 | day-22/part_2.cpp | #include <cstddef>
#include <fstream>
#include <ios>
#include <iostream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
vector<string> read_file(string filename) {
vector<string> lines = vector<string>();
ifstream test_file;
test_file.open(filename, io... | ALGO | 0.999767 | 3.916503 |
69ef80e4-574a-41c1-8504-cf2d5c357aeb | Sai-Ganesh123/CSA5114 | Hill cipher if a chosen plaintext attack can be mounted.cpp | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define MOD 26
// Function to calculate the modulo inverse of a number a with respect to m
int modInverse(int a, int m) {
a = a % m;
for (int x = 1; x < m; x++) {
if ((a * x) % m == 1) {
return x;
}
}
return -1; // In... | ALGO | 0.999994 | 4.036397 |
aacd7096-410b-4427-93da-239800d0e99a | FlexibleSUSY/FlexibleSUSY-generated | models/SMSSM/SMSSM_susy_beta_Yd.cpp | #include "SMSSM_susy_parameters.hpp"
#include "wrappers.hpp"
namespace flexiblesusy {
#define INPUT(parameter) input.parameter
#define TRACE_STRUCT susy_traces
/**
* Calculates the 1-loop beta function of Yd.
*
* @return 1-loop beta function
*/
Eigen::Matrix<double,3,3> SMSSM_susy_parameters::calc_beta_Yd_1_loop... | TOOL | 0.878692 | 6.030193 |
d4b56586-8ba6-417c-91bb-fa729804a1f6 | lhvogado/Checar | libraries/tess-two/jni/com_googlecode_tesseract_android/src/dict/stopper.cpp | #include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <math.h>
#include "stopper.h"
#include "ambigs.h"
#include "ccutil.h"
#include "const.h"
#include "danerror.h"
#include "dict.h"
#include "efio.h"
#include "helpers.h"
#include "matchdefs.h"
#include "pageres.h"
#include "params.h"
#include "ratngs.h"
... | ALGO | 0.986182 | 3.830626 |
ead25234-980b-4e26-a06b-32a8ff2d0ed0 | qiaozishun4/CSP2024_BJ | BJ-Junior/answers/BJ-J01681/poker/poker.cpp | #include<bits/stdc++.h>
using namespace std;
map<string,int> mp;
int main(){
freopen("poker.in","r",stdin);
freopen("poker.out","w",stdout);
int n;
cin>>n;
for(int i=1;i<=n;i++){
string a;
cin>>a;
mp[a]++;
}
cout<<52-mp.size();
return 0;
}
| ALGO | 0.993762 | 3.814427 |
f23909bc-6bbb-498f-bcbd-6d87de4c359f | kunaldas01/Cpp-Programs | 22_Tree/25_Morris_Traversal.cpp | // Morris Traversal
// Time --- O(n)
// Space --- O(1)
#include <iostream>
#include <queue>
using namespace std;
class node
{
public:
int data;
node *left;
node *right;
node(int data)
{
this->data = data;
this->left = NULL;
this->right = NULL;
}
};
void buildTreeLOT(no... | ALGO | 0.999995 | 6.184937 |
f9ae8ba7-64d2-46ef-8c48-513800e96b29 | BangKartavya/GFG | Distinct Occurrences/main.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
/*You are required to complete this method*/
class Solution
{
public:
int mod = 1e9+7;
int helper(string s,string t,int i,int j,vector<vector<int>>& dp) {
if(j<0) return 1;
if(i<0) return 0;
... | ALGO | 0.999968 | 6.432011 |
29179206-f4b9-4af2-8a86-6a61d6a796cb | ishandutta2007/codeforces | tzc_wk/normal/1279/F.cpp | #include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/hash_policy.hpp>
using namespace std;
//using namespace __gnu_pbds;
#define fi first
#define se second
#define fill0(a) memset(a, 0, sizeof(a))
#define fill1(a) memset(a, -1, sizeof(a))
#define fillbig(a) memset(a, 63, sizeof(a))
... | ALGO | 0.999952 | 3.04792 |
65bd9abf-8c6b-423d-bbb0-9ed96910f870 | vishal-v-kulkarni/Data_Structures_Algorithms | 14_Matrices/upper_triangle_cpp.cpp | #include <stdio.h>
#include <stdlib.h>
#include <iostream>
using namespace std;
class UpperTriangle
{
private:
int n;
int *A;
public:
UpperTriangle(int n)
{
this->n = n;
int size = (n * (n + 1)) / 2;
A = new int[size];
}
void Scan();
void Set(int i, int j, int x);... | ALGO | 0.998994 | 3.65037 |
2d23d260-1383-4150-accb-3b71bc5cb5a3 | infinidb/mysql | extra/yassl/taocrypt/src/rabbit.cpp | #include "runtime.hpp"
#include "rabbit.hpp"
namespace TaoCrypt {
#define U32V(x) (word32)(x)
#ifdef BIG_ENDIAN_ORDER
#define LITTLE32(x) ByteReverse((word32)x)
#else
#define LITTLE32(x) (x)
#endif
// local
namespace {
/* Square a 32-bit unsigned integer to obtain the 64-bit result and return */
/* the up... | ALGO | 0.99957 | 6.201396 |
05215445-fead-47a1-8ea9-722355772db6 | riteshkumar005/Data-Structures-And-Algorithms | String/CheckPalindrome.cpp | #include <iostream>
#include <string>
using namespace std;
bool checkPalindrome(string str){
int low = 0;
int high = str.length() - 1;
while(low < high){
if(str[low] != str[high]){
return 0;
}else {
low ++;
high --;
}
}
return 1;... | ALGO | 0.993604 | 4.688766 |
83ec3fb6-c7ca-4162-975e-6ad0c6f2516e | honood/leetcode | solutions/0287-find-the-duplicate-number.cpp | // HoNooD
// 2024.05.30 22:45
// 287. Find the Duplicate Number
// https://leetcode.com/problems/find-the-duplicate-number/description/
//
// Note: You must solve the problem without modifying the array `nums` and uses
// only constant extra space.
auto __unsync_ios_stdio = ios::sync_with_stdio(false);
auto __untie_c... | ALGO | 0.999833 | 7.243434 |
d49f9662-9376-4fba-9180-53078339b064 | Sandip-Kanzariya/GFG-LeetCode | Sum of all divisors from 1 to n - GFG/sum-of-all-divisors-from-1-to-n.cpp | //{ Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
//User function Template for C++
class Solution
{
public:
// Observation
// O(N)
long long sumOfDivisors(int N)
{
long long ans = 0;
for(int i = 1;i <= N;i++){
... | ALGO | 0.999729 | 6.276106 |
7a11fe6c-437f-4174-a0d4-7d027f04551a | rirubelhossain/strings-cpp | suffix automaton.cpp | #include<string.h>
const int MAXLEN = 300; // maximal length of the line
const int K = 4; // size of the alphabet
struct state
{
int length, link;
int next [K];
bool termimal;
};
state st [MAXLEN * 2 -1];
int sz = 0;
int last; // points to the "last" state, ie, then, that is the longest path from Init
voi... | ALGO | 0.999965 | 3.386577 |
81f49abf-3289-41b7-9ef2-122769b22025 | Mohmmadali7517/CPP-Programs | Program16.cpp | #include<iostream>
using namespace std;
typedef unsigned int UINT;
UINT SwapByte(UINT iNo)
{
return (iNo & 0x00FFFF00) | (iNo << 24) | (iNo >> 24);
}
int main()
{
UINT iValue = 0, iRet = 0, i , j;
cout<<"Enter number\n";
cin>>iValue;
iRet = SwapByte(iValue);
cout<<"Data is : "<< iRet<<"... | ALGO | 0.997872 | 4.807808 |
f3c2997b-6ca9-48a6-840b-5d69717c95bb | zxyDEDIRE/ACM_CODE | CodeForces/Codeforces Round 811 (Div. 3)/b.cpp | /*
嵌套变量重复
特殊样例 0 1 2 n
数组越界
开long long
*/
#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
using ll=long long;
using pii=pair<int,int>;
const int maxn=1e6;
int p[maxn];
bitset<maxn>vis;
int n;
void solve()
{
cin>>n;
vis.reset();
for(int i=1;i<=n;i++)
cin>>p[i];
for(int i=n;i>=1;i--)
... | ALGO | 0.999972 | 4.192942 |
4c0b5384-2f3f-449c-9092-fc178bead39a | mohammad-hajiebrahimi/Online_judge | Atcoder/131/A.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pld;
#define all(x) (x).begin(),(x).end()
#define Sort(x) sort(all(x))
#define sep ' '... | ALGO | 0.990734 | 3.686441 |
8396b86b-00be-4eb7-ac27-6b8a02ec0cc3 | 01anuraganand/DSA | Programming Pathshala/Gearing Up/Arrays And Dynamic Arrays/dzy loves chessboard.cpp | #include <iostream>
#include <vector>
using namespace std;
int main()
{
int n, m;
cin>>n>>m;
vector<vector<char>> cell(n, vector<char>(m));
for(int i = 0; i<n; i++)
{
for(int j = 0; j<m; j++)
cin>>cell[i][j];
}
for(int i = 0; i<n; i++)
{
for(int j = 0; j<m; j+... | ALGO | 0.999975 | 3.667204 |
0ba224f6-1f4a-4e12-a2aa-0fafb7cf1c37 | movingrock/Baekjoon | SWEA/D2/1284. 수도 요금 경쟁 D2 Attack/수도 요금 경쟁 D2 Attack.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
int main(int argc, char** argv)
{
int test_case;
int T;
cin >> T;
for (test_case = 1; test_case <= T; ++test_case)
{
int p, q, r, s, w;
cin >> p >> q >> r >> s >> w;
int a = w * p;
int b;
if (w <= r) {
... | ALGO | 0.998413 | 3.705086 |
8a7a4256-9a7c-41ec-935a-6331ca0a15f4 | AkhdanFirdaus/belajarCpp | Sesi 1/16_soal uts praktikum AP1 nomor 2b.cpp | //menampilkan kata menjadi angka
#include <iostream>
#include <string>
using namespace std;
int main()
{
string kata;
cout << " MASUKKAN 0 ATAU 1 \n";
cout << "============================\n";
cout << "masukkan kata= ";
cin >> kata;
if (kata == "nol")
{
cout << "0" << endl;
}
else if (kata == "sa... | TOOL | 0.954603 | 3.912629 |
8f5f1fe6-1757-4c2c-9268-a95bb7fe48e6 | DebopamParam/DSA | Love Babbar DSA/Code/lc_L5.cpp | #include <iostream>
using namespace std;
int main()
{
/*
Write a function that takes an unsigned integer and returns
the number of '1' bits it has (also known as the Hamming weight)
Input: n = 00000000000000000000000000001011
Output: 3
Explanation: The input binary string 0000000000000000000... | ALGO | 0.999549 | 5.419927 |
b34a1953-ede4-4ff1-a9e6-d21bb6482fb8 | ShowravKormokar/CPP-Program-3rd-semester | Lab-Work/04-problem-10.cpp | #include<iostream>
using namespace std;
class A
{
protected:
int p;
public:
void set_p()
{
cin>>p;
}
};
class B: protected A
{
public :
int q;
void set_q()
{
set_p();
cin>>q;
}
void sum()
{
cout<<p+q;
}
};
int main()
{
B ob2;
ob2.se... | ALGO | 0.919354 | 3.364595 |
47438a51-51ee-4155-89a9-4871cdca3d9d | KurisZ/leetcodeC- | algorithms/cpp/reverseLinkedList/reverseLinkedList.II.cpp | // Source : https://oj.leetcode.com/problems/reverse-linked-list-ii/
// Author : Hao Chen
// Date : 2014-07-05
/**********************************************************************************
*
* Reverse a linked list from position m to n. Do it in-place and in one-pass.
*
* For example:
* Given 1->2->3->4->5-... | ALGO | 0.9999 | 5.275836 |
5b5a9c68-eca8-4e22-9858-ac3d0257ef7b | tanushkaaaa/competitive-coding | 2551-apply-operations-to-an-array/apply-operations-to-an-array.cpp | class Solution {
public:
vector<int> applyOperations(vector<int>& nums) {
int n=nums.size();
for(int i=0;i+1<n;i++){
if(nums[i]==nums[i+1]){
nums[i]=2*nums[i];
nums[i+1]=0;
}
}
int i = 0;
for(auto n: nums){ // collect all noon zero values... | ALGO | 0.999948 | 5.480132 |
392d3bfd-77ba-4d50-be8d-b4aa0ba0c496 | yogibala/leetcode | solutions/1326. Minimum Number of Taps to Open to Water a Garden/1326.cpp | class Solution {
public:
int minTaps(int n, vector<int>& ranges) {
vector<int> nums(n + 1);
for (int i = 0; i <= n; ++i) {
int l = max(0, i - ranges[i]);
int r = min(n, i + ranges[i]);
nums[l] = max(nums[l], r - l);
}
int ans = 0;
int end = 0;
int farthest = 0;
for (i... | ALGO | 0.99994 | 6.256053 |
ac6e6ff2-adc6-4668-9641-e09ee2f8793f | TusiimeManziAlex/eat_smile | 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.99887 | 6.783439 |
7fe0c1df-043f-4659-bc70-30bdb48abdc4 | Riaj509/Leetcode | 417-pacific-atlantic-water-flow/417-pacific-atlantic-water-flow.cpp | class Solution {
vector<vector<int>> vis = vector<vector<int>>(210,vector<int>(210));
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
int pasific = 0,atlantic = 0;
public:
vector<vector<int>> pacificAtlantic(vector<vector<int>>& heights) {
vector<vector<int>>v;
int n = heights.size(... | ALGO | 0.999867 | 6.441217 |
0fb46d35-a744-4e69-aff7-ab2ff1584aa1 | WilderStill/C-Programs | 洛谷/主题库/P1419 寻找段落.cpp | #include<bits/stdc++.h>
#define qhd deq[hd]
#define qtl deq[tl]
#define db double
#define M 114514
#define eps 1e-10
using namespace std;
int n,s,t,b[M],deq[M];
db a[M],sum[M];
bool check(double x)
{
int hd=1,tl=0;
for(int i=1;i<=n;++i)a[i]=b[i]*1.0-x;
sum[0]=0;
for(int i=1;i<=n;++i)sum[i]=sum[i-1]+a[i]... | ALGO | 0.999842 | 3.627658 |
c975eecb-70c1-40a6-9823-e25f46a8c47e | IshankGera/DSA | recursion_palindrome.cpp | #include<iostream>
using namespace std ;
bool ispalindrome(string str ,int l , int r){
if(l<r)
ispalindrome(str , l+1 , r-1);
if(str[l]!=str[r])
return 0 ;
else{
return 1 ;
}
}
int main(){
string str ;
cout << "enter the string : " ;
cin >> str... | ALGO | 0.999967 | 4.257512 |
9727f2f0-0892-4196-876b-32d25d1ff217 | moinhameed27/Ultimate-DSA | Tree/Binary Tree/Maximum Depth of Binary Tree.cpp | // Leetcode : https://leetcode.com/problems/maximum-depth-of-binary-tree/description/
// [C++]-----------------------------------------------------------------------------------------------------------------------
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* ... | ALGO | 0.999926 | 6.736946 |
d9870d84-618a-48e4-bd02-a838d56d6493 | bravegag/eigen-magma | bench/spbench/sp_solver.cpp | // Small bench routine for Eigen available in Eigen
// (C) Desire NUENTSA WAKAM, INRIA
#include <iostream>
#include <fstream>
#include <iomanip>
#include <Eigen/Jacobi>
#include <Eigen/Householder>
#include <Eigen/IterativeLinearSolvers>
#include <Eigen/LU>
#include <unsupported/Eigen/SparseExtra>
//#include <Eigen/Sp... | ALGO | 0.997561 | 4.29849 |
9c04529a-d7e4-4f6f-bb95-d921a78967b7 | mhw-Parker/autoaim-rm2022-SWJTU | Predictor/Predictor.cpp | //
// Created by tyy on 2022/1/19.
//
#include "Predictor.h"
Predictor::Predictor() : waveClass(5000,300,1000),
omegaWave(3,600,1000),
poseAngle(CV_PI,600,1000) {
predict_pts.assign(4,Point2f(0,0));
// 初始化参数:初始弹速,响应时间
InitParams();
Refresh();
}
/**
*... | ALGO | 0.890997 | 3.723447 |
44d77a21-cd00-4335-935b-0b7c911b5e50 | SpacemanCra1g/ShockSolver | 1D/Com_Branch/SR-HD/src/VarConvert.cpp | #include "../include/DomainClass.hpp"
#include "../include/Parameters.h"
// Most of the structure of this code is taken from the PLUTO solver
// So lots of credit to those authors
#define ENERGY_SOLVE 0
#define PRESURE_FIX_SOLVE 1
#define MIN_DENSITY 1.e-5
void Domain::Prims2Cons(double *Uin, double *Uout, int start... | ALGO | 0.999728 | 4.172118 |
7c697892-16d7-437a-b8d9-e23e492a0a29 | vuquangsang/VQS | kingdom.cpp | /* Vu Quang Sang from Le Khiet High School for Gifted */
#include <bits/stdc++.h>
using namespace std;
//#define ll int
#define lg(x) __lg(x)
#define alla(a,n) a+1,a+n+1
#define el "\n"
#define all(x) x.begin(),x.end()
#define pb push_back
#define ll long long
#define fi first
#define ... | ALGO | 0.999868 | 3.971374 |
cb1fcbfa-396f-49cf-b8cf-d4bf68e4af4f | Aryan-Gupta2003/Leetcode-solutions | 2. Medium/boat_people.cpp | // Leetcode problem statement link
// https://leetcode.com/problems/boats-to-save-people/
// You are given an array people where people[i]
// is the weight of the ith person, and an infinite
// number of boats where each boat can carry a
// maximum weight of limit. Each boat carries at
// most two people at the same t... | ALGO | 0.999971 | 5.561865 |
359c0020-81a5-491b-8079-d786c00c092e | 2atharva21/c- | 4_Loops in C++/mastering-in-for-loop/q3.cpp | #include <iostream>
using namespace std;
int main(){
int n;
cout<<"enter the number:";
cin>>n;//input
int factorial=1;//store
for(int i=1; i<= n;i++){
factorial*=i;
cout<<factorial<<endl;
}
}
| ALGO | 0.999828 | 3.808075 |
5bad8bfe-576f-490e-aba2-eb2fa2c4de89 | ash255/algorithm | SHA1/SHA1.cpp | /*
@Date: 2018/12/9
@Version: 1.0.0
@Author: MJS
@Description: SHA1 arithmetic
input: <=2^64bit(512bit pre package)
output: 160bit(SHA1 value)
*/
#include "SHA1.h"
#include<stdio.h>
#ifndef nullptr
#define nullptr NULL
#endif
/* the first bit is 1, the rest bits are 0*/
const uint8_t padding[64] = {... | ALGO | 0.996151 | 4.246877 |
eab7eee4-5ea9-446e-966a-8459649bc865 | minifuwu/FreeCAD | src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_FaceSide.cpp | // File : StdMeshers_FaceSide.hxx
// Created : Wed Jan 31 18:41:25 2007
// Author : Edward AGAPOV (eap)
// Module : SMESH
//
#include "StdMeshers_FaceSide.hxx"
#include "SMDS_EdgePosition.hxx"
#include "SMDS_MeshNode.hxx"
#include "SMESHDS_Mesh.hxx"
#include "SMESHDS_SubMesh.hxx"
#include "SMESH_Algo.hxx"... | TOOL | 0.925481 | 5.785388 |
d2a0f519-7e51-4223-b075-20c0775fef12 | Massimo223/Esercitazione_5_STL | src/Utils.cpp | #include "Utils.hpp"
double distanza_tra_due_punti (double x_1, double y_1, double x_2, double y_2) {
return sqrt(pow(x_2 - x_1,2) + pow(y_2 - y_1,2));
}
double area_del_poligono (const vector<Cell0D>& vertici, const Cell2D& poligono) {
if (poligono.NumVertices < 3) {
std::cerr << "C'è un errore: un poligo... | TOOL | 0.909306 | 4.845987 |
36a47914-9df4-4b6e-9b9c-f8fee41502fc | 928166876/sortFunction | mergesort.cpp | #include <iostream>
#include <vector>
using namespace std;
//归并排序递归向量版(稳定,非原地)
void func(vector<int>& nums, vector<int>& tmp, int start, int end){
if(start >= end) return;
int len = end - start;
int start1 = start; int mid = start + len / 2;
int end1 = mid;
int start2 = mid + 1; int end2 = end;
... | ALGO | 0.999992 | 4.966337 |
d95e246b-898b-45cb-bc7a-80edb9cec6e3 | ishandutta2007/codeforces | dmitrygrigorev/normal/1483/C.cpp | #include <bits/stdc++.h>
#define ll long long
#define db long double
#define x first
#define y second
#define mp make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
using namespace std;
vector<ll> rmq;
void upd(int i, int l, int r, int index, ll val) {
if (r-l==1) {
rmq[i] = val;
return;
}
... | ALGO | 0.99995 | 3.587223 |
aa6fcb83-9fc0-4f6f-90e6-2a02c11b6f62 | Deepak7308/C-language | patrn1.cpp | #include <iostream>
using namespace std;
int main(){
int n;
cin>>n;
int i=1,j=1;
while(i<=n){
while(j<=n){
cout<<" * ";
}
cout<<endl;
}
} | ALGO | 0.999755 | 3.619126 |
df58046b-4fae-464c-81c6-32b298b75afb | rlagksql219/algorithm | BOJ/Greedy/20044 Project Teams.cpp | #include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
/*
if Ƽ min ū ʱȭϰ Ǯµ װ ó ..
Һθ Ȯϰ Ǯ !!
*/
int main() {
int n;
vector<int> v;
int ans = 0;
cin >> n;
for (int i = 0; i < 2 * n; i++) {
int tmp;
cin >> tmp;
v.push_back(tmp);
}
sort(v.begin(), v.end(... | ALGO | 0.999949 | 3.703033 |
5f5ddd39-1c85-4f1f-97b7-7e2a4b9ce872 | ishandutta2007/codeforces | cescmentation_folch/normal/123/D.cpp | #include<bits/stdc++.h>
using namespace std;
const int S = 27;
struct node { int len, link, next[S]; };
struct tree_node { int t0[S], t1[S], next[S], k; };
typedef long long ll;
const int N = 200010;
int sz, last;
node v[N];
tree_node tree[N];
int T[N], Tsz;
inline void init() {
sz = 1; last = 0; v[0].len = 0; v... | ALGO | 0.999976 | 4.124224 |
61408d7a-8f6f-487a-9453-503138a59f2d | A-BCDe/BOJ-Solutions | Problems/2751.cpp | #include <stdio.h>
#include <algorithm>
int main() {
int n;
scanf("%d", &n);
auto a = new int[n];
for (int i = 0; i < n; i++) {
scanf("%d", &a[i]);
}
std::sort(a, a + n);
for (int i = 0; i < n; i++) {
printf("%d\n", a[i]);
}
delete[] a;
} | ALGO | 0.999495 | 3.697454 |
46dd1c45-64dc-44ae-a83c-e48a9e7c7c61 | bluepika2/highway-driving | src/Eigen-3.3/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_reductions_operatornorm.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace Eigen;
using namespace std;
int main()
{
MatrixXf m(2,2);
m << 1,-2,
-3,4;
cout << "1-norm(m) = " << m.cwiseAbs().colwise().sum().maxCoeff()
<< " == " << m.colwise().lpNorm<1>().maxCoeff() << endl;
cout << "infty-norm(m... | ALGO | 0.999486 | 4.076589 |
5cfb1d3a-fb6a-475a-a9d1-12042954a2af | src-lua/CIn_Algorithms | Algorithms/Data Structures/ClosedHashTable.cpp | #include <bits/stdc++.h>
#define endl '\n'
using namespace std;
template <typename keyType, typename valueType>
class ClosedHashTable {
public:
ClosedHashTable(size_t n) {
this->__size = 0;
this->hash_size = n;
this->table = vector<pair<keyType, valueType>*>(n, nullptr);
}
~Clos... | ALGO | 0.969152 | 5.194111 |
5582f96c-4884-46a1-9eb0-50a3cb5ddbba | OceanMixingGroup/fcsFirmware | fcsAdcPacket/fcsReducedPacket.cpp | #include <fcsReducedPacket.h>
void calculateDRPacket(adcVoltsPacket *pSrcBuffer, reducedPacket *pDstBuffer, uint16_t blockSize)
{
/**
* @brief Performs data reduction process from chiDR.h
* @param[in] *pSrcBuffer pointer to structure float32_t raw voltages
* @param[out] *pDstBuffer pointer to st... | ALGO | 0.999201 | 4.225995 |
c3b13ac3-b3e7-47ed-a459-3d5d2cfd070c | raincross7/code-similarity | codes/train_code/problem265/problem265_330.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
int N,K;
cin >> N >> K;
unordered_map<int,int> cnt;
int diff=0;
for(int i=0;i<N;i++) {
int x;cin >> x;
if(cnt[x]==0) diff++;
cnt[x]++;
}
vector<int> v;
for(auto p : cnt) {
v.pus... | ALGO | 0.999923 | 4.076403 |
5603f8d8-0f9f-4e87-94a5-d57499a80358 | sagarthecoder/Problem_Solving | UVA_Solution/uva_369_ Combinations.cpp | #include <bits/stdc++.h>
#define ll long long
using namespace std;
ll dp[101][101];
ll go(ll n,ll r)
{
if(dp[n][r])return dp[n][r];
if(r==0)return 1;
if(r==n)return 1;
if(r==1)return n;
return dp[n][r]= go(n-1,r-1)+go(n-1,r);
}
int main()
{
ll n,m;
while(true)
{
scanf("%lld %lld... | ALGO | 0.999886 | 4.558542 |
dff11b75-aca6-48d5-aa4d-581947c52ad9 | luonginfosec/DSA | WEEK5-6/CONTEST_XAU_TB/B19.cpp | // Thoi gian troi qua khong the quay tro lai. LuongVD <3, AC AC AC PLEASE
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t;
cin >> t;
cin.ignore();
string s;
map<string, int> mp;
while (t--)
{
... | ALGO | 0.997872 | 3.589304 |
c79eb150-26cc-4f84-b99d-6551f147c4eb | purebluee/Leetcode | cpp/187-RepeatedDNASequences.cpp | class Solution {
public:
vector<string> findRepeatedDnaSequences(string s) {
unordered_map<string, int> map;//records the counting of DNA sequence
vector<string> res;
if (s.size() <= 10){
return res;
}
for (int i = 0; i <= s.size() - 10; i++){
string s... | ALGO | 0.998635 | 5.19148 |
f7eeb70d-1ebd-4ce2-b55f-47116cc3d515 | suwitiki/suwitiki-ENGCE117-Programming | HW12/hw12.5/HW12.5.cpp | /*
HR ของบริษัทเน็ตเวิร์คทำการกรอกข้อมูลพนักงานลงไปในระบบคำนวณฐานภาษีเพื่อเตรียมส่งยอดภาษีสู่ฝ่ายบัญชี โดยจะหักภาษี ณ ที่จ่าย 7% ของเงินเดือนที่ได้ ให้คุณคำนวณภาษีพนักงานทั้งหมดที่บริษัทของคุณต้องชำระภายในปีนี้ (กรอกเลข -1 ถือเป็นการสิ้นสุดการกรอก และทำการสรุปผลภาษีที่ต้องชำระภายในปีนี้) และสร้างฟังก์ชันที่ระบุคนที... | ALGO | 0.995676 | 3.611543 |
4978d537-6106-4c1b-ae05-1f67100f58fd | wallwpcab/pr4-primary | part2/src/dfs-client-p2.cpp | #include <map>
#include <regex>
#include <vector>
#include <string>
#include <thread>
#include <fstream>
#include <errno.h>
#include <csignal>
#include <iostream>
#include <iomanip>
#include <getopt.h>
#include <unistd.h>
#include <algorithm>
#include <sys/inotify.h>
#include <grpcpp/grpcpp.h>
#include "dfs-utils.h"
#... | TOOL | 0.968028 | 6.642817 |
b8ab7e04-8e87-48bb-a53d-91736d0cccad | RAGHUNANDANSHARMA01/c-Plus-plus-programming2 | c language pratisce.cpp | #include<stdio.h>
#include<conio.h>
#include<stdlib.h>
struct node
{
int data;
clrscr();
struct node*next;
}
*front=NULL,*rear=NULL;
void insert(int);
void delete();
void display();
void main()
{
int value,choice;
printf("\n""queue implememnt using linked list::\n");
while(1)
{
printf("\n*********MENU*******\n... | ALGO | 0.999826 | 3.443501 |
78ee6a80-c53a-4e6d-93ab-4794d6a7e86e | splucs/Competitive-Programming | URI/1226.cpp | #include <cstdio>
typedef long long int ull;
typedef struct bignum{
int num[25];
int tam;
} bignum;
bignum convert(ull n){
bignum res;
res.tam=0;
ull aux=n;
while(aux>0){
res.tam++;
aux/=10;
}
aux=n;
for(int i=res.tam-1; i>=0; i--){
res.num[i]=aux%10;
aux/=10;
}
return res;
}
ull convert_to_norma... | ALGO | 0.999789 | 3.864392 |
5b9c3bb6-1962-47e4-9000-909ab9fb419b | darshansapnar/copydsa | LinkedList.cpp | #include<iostream>
using namespace std;
class node{ //creaion of single node
public:
int val;
node* next;
node (int data){
val = data;
next = nullptr;
}
};
//INSERTION AT BEGINNING
void insertAtBeginning(node* &head ,int val){
node* new_node = new node(val); ... | ALGO | 0.999368 | 5.345281 |
8f239bfb-1221-43d1-9c50-5244080b1d0f | alessandro-bugatti/guida_territoriali | materiali/problemi territoriali/2004_poldo_territoriali/PoldoRicorsioneMemorizzazione.cpp | #include <stdio.h>
#include <stdlib.h>
#define MAX 100
#define PESOMAX 100000
FILE*in,*out;
int panini[MAX];
int mangiati[MAX];
int N;
int poldo(int pos, int ultimo)
{
if(pos==N) return 0;
int mangio=1, nonmangio=0;
//printf("%d %d\n",pos, ultimo);
if (mangiati[pos]!=-1) return mangiati[pos];
//printf("Nuovo\n"... | ALGO | 0.999794 | 3.267065 |
9cf54f58-1383-4c4a-83ae-c62e17a04c7e | OUDON/emtumble | Ball.cpp | #include "Ball.hpp"
void Ball::step()
{
if (direction == 0) return;
y++;
x += direction;
}
| TOOL | 0.913895 | 4.250268 |
f7fd86bb-d18f-449c-801a-51bc913ca5e0 | YttriumWillow/OI | Problems/T296878.cpp | /*
FileName: T_296878_UOI-R_1_磁铁.cpp
+ randomhash: 6eb39d76780cbd15a360accb
Author: fengziyi
+ base64: ZmVuZ3ppeWk=
+ MD5: 9b0454ce8364ba54b28c8b9b7f9dafc7
Date: 2022/12/10 星期六
Time: 17:12:27
+ Unix Timestamp(second): 1670663547
Encoding: UTF-8
+ Encodeing Tes... | ALGO | 0.999743 | 5.120738 |
2dd0b6bf-f6ca-4828-9012-53a9dd1512b4 | d-justen/duckdb-polr | extension/icu/third_party/icu/i18n/numparse_decimal.cpp | #include "unicode/utypes.h"
#if !UCONFIG_NO_FORMATTING
// Allow implicit conversion from char16_t* to UnicodeString for this file:
// Helpful in toString methods and elsewhere.
#ifndef UNISTR_FROM_STRING_EXPLICIT
#define UNISTR_FROM_STRING_EXPLICIT
#endif
#include "numparse_types.h"
#include "numparse_decimal.h"
#inc... | TOOL | 0.953215 | 7.678563 |
d3eeffa6-a465-4541-9cff-b3521feaba9a | krpraveen0/cpp-resource | oops/employee.cpp | #include<iostream>
using namespace std;\
class Employee{
public:
int emp_id;
string emp_name;
string emp_role;
string emp_dept;
float emp_salary;
float total_experience;
void getPromotion(){
if(total_experience > 2){
emp_salary = em... | TOOL | 0.870357 | 3.846676 |
fd71448b-25d6-447f-b898-d0d06ee779c0 | anmamun0/dsa-algo-workbook | DSA/Week 3 Doubly&List&Cycle/MODULE_9 Insert_Delete/1_Double_Linked_list.cpp | #include <bits/stdc++.h>
using namespace std;
class Node
{
public:
Node *prev;
int val;
Node *next;
Node(int val)
{
this->val = val;
this->next = NULL;
this->prev = NULL;
}
};
void Print_Normal(Node *head){
Node *temp = head;
... | ALGO | 0.999865 | 4.696941 |
b193806b-ba91-49fd-a5ed-98dcf22e54a5 | simpla-fusion/SimPla | src/simpla/geometry/GeoAlgorithm.cpp | //
// Created by salmon on 17-10-30.
//
#include "GeoAlgorithm.h"
#include <vector>
namespace simpla {
namespace geometry {
bool CheckPointInBox(nTuple<Real, 2> const &p, nTuple<Real, 2> const &bMin, nTuple<Real, 2> const &bMax) {
return bMin[0] <= p[0] && p[0] <= bMax[0] && //
bMin[1] <= p[1] && p[1]... | ALGO | 0.999189 | 6.049155 |
e59dc054-91ed-4e2a-b51d-e51c79175866 | ombhayde/Leetcode | 3201-distribute-candies-among-children-ii/distribute-candies-among-children-ii.cpp | class Solution {
public:
long long distributeCandies(int n, int limit) {
auto comb2 = [](int n) {
return 1LL * n * (n - 1) / 2;
};
if (n > 3 * limit) {
return 0;
}
long long ans = comb2(n + 2);
if (n > limit) {
ans -= 3 * comb2(n - ... | ALGO | 0.999997 | 5.646016 |
393bd778-57ca-4959-a0f2-101d21baf4a0 | qianli1/leetcode | _704_BinarySearch/_704_BinarySearch.cpp | #include <vector>
using namespace std;
/**
* 本代码来自 CSON 官方视频课程,由 @CSON 提供
* 题目来源: http://leetcode.com
* CSON 致力于在 CS 领域内帮助中国人找到工作,让更多海内外国人受益
* 讲师: Edward Shi
* 官方网站: https://cspiration.com
* 版权归 CSON 所有, 禁止 转载!
*/
class _704_BinarySearch {
/**
* 704. Binary Search
* Given a sorted (in ascending order) in... | ALGO | 0.999993 | 6.594061 |
6bfb008c-915e-4666-a0ed-5a81704a653c | Nullray/ICT | software/workload/firesim/host/firesim-lib/lib/boost/libs/compute/example/fizz_buzz.cpp | #include <iostream>
#include <boost/compute/system.hpp>
#include <boost/compute/algorithm/copy.hpp>
#include <boost/compute/algorithm/accumulate.hpp>
#include <boost/compute/algorithm/exclusive_scan.hpp>
#include <boost/compute/container/vector.hpp>
#include <boost/compute/utility/dim.hpp>
#include <boost/compute/util... | ALGO | 0.998584 | 7.154435 |
699d1a13-efd4-4bce-86d1-ed3486451625 | chimaagu/shoppit | android/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.998501 | 6.783439 |
0460b951-eb1e-4924-acff-af7aa87d9a49 | CarloNicolini/paco | src/paco/paco.cpp | #include <algorithm>
#include <iostream>
#include <string.h>
#include <sstream>
#include <igraph.h>
#ifdef UNIX
#include <sys/time.h>
#endif
#ifdef WIN32
#ifndef strcasecmp
#define strcasecmp _stricmp
#endif
#endif
#ifndef WIN32
#include <unistd.h>
#else
#include <Windows.h>
#endif
#include <Eigen/Sparse>
#include "... | ALGO | 0.999883 | 5.859486 |
2f7d3cbc-b5d1-4f7d-b301-b70060167899 | KaustubhSagale/cpp.. | main-10.cpp | #include <iostream>
using namespace std;
// A function to heapify the array.
void MaxHeapify(int a[], int i, int n)
{
int j, temp;
temp = a[i];
j = 2*i;
while (j <= n)
{
if (j < n && a[j+1] > a[j])
j = j+1;
// Break if parent value is already greater than child value.
if (temp > a[j])
break;
// Swi... | ALGO | 0.999916 | 4.171005 |
264d192a-9310-433f-9e8b-5bc1ea1f1237 | Aadarshg087/competitive-programming | TLE Eliminators Course/Stack, Queues/ValeriyAndDeque.cpp | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
// Macros
#define ll long long int
#define endl "\n"
void solve()
{
ll n, q;
cin >> n >> q;
deque<int> d;
vector<ll> operations(q);
for (int i = 0; i < n; i++)
{
int temp;
cin >> temp;
d.push_back(temp);
... | ALGO | 0.999491 | 4.042756 |
687a054d-f0e4-4510-87d6-27aaae0224c2 | Kirozoki/Concurrency | 76__3rd_section/85.local_queue/main.cpp | #include <atomic>
#include <numeric>
#include <vector>
#include <iostream>
#include <functional>
#include <future>
#include <list>
#include <thread>
#include "common_thread_safe_queue.h"
#include "common_objs.h"
#include "utils.h"
class thread_pool_l_work_queue {
private:
std::atomic_bool done;
threadsaf... | TOOL | 0.997168 | 4.375472 |
a27f69a6-71ad-4e84-a07e-23093747c699 | aryanchalotraa/prac2 | leetcode/prblm75.cpp | //https://leetcode.com/problems/contains-duplicate/
#include<iostream>
#include<vector>
#include<map>
#include<unordered_set>
using namespace std;
bool unordered_set_containsDuplicate(vector<int> nums) {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
unordered_set<int> s;
for(int i:nums... | ALGO | 0.997408 | 5.416995 |
e976e3b3-b913-440e-99b1-d49e45512626 | AyushAntil007/LeetCode_Problems | 54-spiral-matrix/spiral-matrix.cpp | class Solution {
public:
vector<int> spiralOrder(vector<vector<int>>& matrix) {
vector<int> ans;
int n = matrix.size();
int m = matrix[0].size();
int left = 0, right = m - 1, bottom = n - 1, top = 0;
while (top <= bottom && left <= right) { //cxheck boundary condition
... | ALGO | 0.999998 | 6.319111 |
70cc34a7-24ce-414b-bcd4-20f26cf9eca0 | Bipin-Paudel/Cpp-Practices | c++ assignment/returningObject.cpp | #include <iostream>
using namespace std;
class complex
{
int a,b;
public:
void setData(int x,int y)
{
a=x;
b=y;
}
complex addComplex(complex c1,complex c2)
{
complex temp;
temp.a=c1.a+c2.a;
temp.b=c1.b+c2.b;
return temp;
}
void display()
{
cout<<"("<<a<<"+"<<b<<"i"<<")"<<endl;
}
};
int main() {
complex m,n,p,r;
int... | TOOL | 0.921102 | 3.991388 |
b61b27f1-1dfd-4cd1-9bdf-c8b0c55d4328 | sandialabs/GenTen | tpls/kokkos/core/src/impl/Kokkos_hwloc.cpp | #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
#define KOKKOS_IMPL_PUBLIC_INCLUDE
#endif
#define DEBUG_PRINT 0
#include <iostream>
#include <sstream>
#include <algorithm>
#include <Kokkos_Macros.hpp>
#include <Kokkos_Core.hpp>
#include <Kokkos_hwloc.hpp>
#include <impl/Kokkos_Error.hpp>
/*--------------------------------------... | TOOL | 0.983897 | 7.179396 |
028dc4f6-6dd6-4442-88da-413b2483fafa | Crush12999/Algorithm-log | 2022_Spring Camp/src/com/ataraxia/每日一题/div1/day8_摘桃子.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll>PII;
const int N = 200010;
ll f[N], s[N], e[N];
int main()
{
ll n,k;
cin >> n;
map<ll, ll>mymap;
ll m, res = 0, sum = 0, num;
int l = 0, r = 0;
cin >> k;
vector<int>v(n + 1), s(n + 1);
for (int i = 1; i <= n; i++)
{
cin ... | ALGO | 0.999873 | 3.361074 |
c32fffb8-7c5e-4721-9090-ac2fa1d57da1 | hieupham1103/TINHOC | ONLINE OJ/CODEFORCES/Contest kho dam/CF ROUND/DIV 2/Codeforces Round #889 div 2/D.cpp | #include<bits/stdc++.h>
#define ii pair <int,int>
#define fi first
#define se second
#define int long long
#define double long double
#define endl '\n'
#define all(x) x.begin(), x.end()
using namespace std;
const int maxN = 1e5 + 10;
const int inf = 1e18;
int seg[maxN * 4];
void update(int i, int left, int right, in... | ALGO | 0.999831 | 3.541023 |
b8f0c038-e0c3-4920-8a4a-a545e72c72f8 | ohfuckinglucy/Smth | First/ON C++/TP/Class(3)/26var/main.cpp | #include <iostream>
#include <vector>
#include <cmath>
using namespace std;
class Square {
private:
double side_length;
public:
Square(double side_length) {
this->side_length = side_length;
}
double calculateDiagonal() const {
return side_length * sqrt(2);
}
double calculate... | ALGO | 0.996199 | 5.302229 |
f7a4ea5e-a948-43ee-9950-b19dce26bb6a | enochjung/acmicpc_net | 01/1065.cpp | #include <stdio.h>
int n, res;
int main()
{
scanf("%d", &n);
res = (n<100? n : 99);
for(int i=100; i<=n; i++)
{
int v = i;
int a, r;
bool flag = true;
a = (v/10)%10;
r = v%10-a;
v /= 100;
while(v)
{
if(v%10 != a-r)
{
flag = false;
break;
}
a = a-r;
v /= 10;
}
if(fl... | ALGO | 0.999492 | 3.476416 |
248c53bf-f4d1-4288-aef9-84d311304d3a | Shivayayy/DataStructureAndAlgorithm | 0540-single-element-in-a-sorted-array/0540-single-element-in-a-sorted-array.cpp | class Solution {
public:
int singleNonDuplicate(vector<int>& nums)
{
int low =0;
int high =nums.size()-1;
if(nums.size()==1)return nums[0];
if(nums[low]!=nums[low+1])return nums[low];
if(nums[high]!=nums[high-1])return nums[high];
low =1;
high =nums.size(... | ALGO | 0.999977 | 5.650001 |
7accded8-e6d5-487e-aa48-c1ad5c9b11d5 | Baixiaochi9449/Python_algorithm | 王道/第十章:数据结构二/10.4散列表/谁是你潜在的朋友.cpp | #include <iostream>
#include <map>
#include <vector>
using namespace std;
int main(){
int n,m;
while(cin >> n >> m){
vector<int> person(n);
map<int,int> books;
for(int i=0;i<n;i++){
cin >> person[i] ;
books[person[i]]++;
}
for(int i=0;i<n;i++){
... | ALGO | 0.999957 | 3.772306 |
e5480957-bd43-4fe3-b179-605578601aea | 99-wood/OIcode | 暑假集训/2/zjd/c.cpp | #include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm>
#include<stack>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<bitset>
#define rep(i,a,b) for(int i=a;i<=(b);++i)
#define frep(i,a,b) for(int i=a;i<(b);++i)
#define drep(i,... | ALGO | 0.999955 | 3.397541 |
2d02fa6b-9a59-4d65-900c-11a4d992b6d1 | vikkastiwari/competitive-coding-questions | DSA-450/02Matrix/10commonElements.cpp | // question link: https://www.geeksforgeeks.org/common-elements-in-all-rows-of-a-given-matrix/
#include <bits/stdc++.h>
using namespace std;
vector<int> findCommon(vector<vector<int>> &nums)
{
vector<int> common;
unordered_map<int, int> map;
// marking all row 0 elements as present
for (int j = 0; j ... | ALGO | 0.999931 | 5.520595 |
4d4343f6-5ea5-43a5-92fc-e2054455229c | sidhant-khamankar/DSA_Ka_14 | Topic_wise_LeetCode_C++/sliding-window_medium/567_permutation_in_string-microsoft.cpp | /*
* @lc app=leetcode id=567 lang=cpp
*
* [567] Permutation in String
*/
// @lc code=start
class Solution
{
public:
// did not get
// Neetcode solution On*26 time On*26 space
// Leetcode solution approaches
bool isEmpty(vector<int> arr)
{
for (int i = 0; i < arr.size(); i++)
{
... | ALGO | 0.999879 | 6.855052 |
45094501-5101-458a-9338-fe7fe441533d | BHAVISHAYA/LeetCode-Questions | 0289-game-of-life/0289-game-of-life.cpp | class Solution {
public:
void gameOfLife(vector<vector<int>>& board) {
int n = board.size();
int m = board[0].size();
vector<vector<int>> ans(n, vector<int> (m, 0));
int delRow[] = {-1, -1, 0, 1, 1, 1, 0, -1};
int delCol[] = {0, 1, 1, 1, 0, -1, -1, -1};
for(int i = 0 ... | ALGO | 0.999948 | 6.57056 |
6623d6ba-9509-492a-9d9e-05b4180b2e1f | ishandutta2007/codeforces | petelgeuseromaneeconti/normal/1648/C.cpp | #include<bits/stdc++.h>
#ifdef xay5421
#define D(...) fprintf(stderr,__VA_ARGS__)
#define DD(...) D(#__VA_ARGS__ "="),debug_helper::debug(__VA_ARGS__),D("\n")
#include"/home/xay5421/debug.hpp"
#else
#define D(...) ((void)0)
#define DD(...) ((void)0)
#endif
#define pb push_back
#define eb emplace_back
#define SZ(x) ((in... | ALGO | 0.999981 | 3.903966 |
68696a27-cc0b-481a-bee9-02cc6c91af24 | Simoxii48/CPP | 05- Algorithms & Problem Solving Level 2/28- Problem #28 (My Solution)/28- Problem #28 (My Solution).cpp | #include <iostream>
#include <cstdlib>
using namespace std;
int randomNumber(int from, int to) {
return rand() % (to - from + 1) + from;
}
void fillArrayWithRandomNumbers(int arr[100], int& length) {
cout << "Please enter the array number of elements to fill : ";
cin >> length;
for (int i = 0; i < le... | TOOL | 0.991179 | 4.143179 |
45e5f595-dbf4-433c-a098-409ec0537ab9 | Arin016/DSA | STL/38diversifythearray.cpp | #include<bits/stdc++.h>
using namespace std;
#define int long long
int mod = 1e9+7;
void solve(){
int n, k;
cin>>n>>k;
map<int, int> mp;
for(int i=0;i<n;i++){
int x;
cin>>x;
mp[x]++;
}
int ans = (n*(n-1))/2;
priority_queue<int> pq;
for(auto x:mp){
if(x.se... | ALGO | 0.999772 | 4.518234 |
f6413c5f-6d01-4453-8176-5979e36f5c5c | AvanishShukla20/Leetcode-problems | 14-longest-common-prefix/longest-common-prefix.cpp | class Solution {
public:
string longestCommonPrefix(vector<string>& strs) {
//INTUITION ->
//first we sort the strs vector
//now we look for the first different character in first and last member of sorted strs , because before that different character all characters will be same in every ot... | ALGO | 0.999904 | 5.680036 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.