uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
01c6422f-ebe0-4397-8e18-17a7aef8f017 | Kartik-Mathur/CPP-MayBatch | L14-Recursion-weekday/2_StringToInteger.cpp | #include <iostream>
using namespace std;
int stringToInt(char *a, int n) {
// base case
if (n == 0) {
// Agar array mei elements hi nahi hai, toh uski integer value 0 hi hogi
return 0;
}
// recursive case
int last_digit = a[n - 1] - '0';
int value = stringToInt(a, n - 1);
return value * 10 + last_digit;
}
... | ALGO | 0.99893 | 3.691488 |
f4ecdd80-3297-4cb2-874c-080f1ba99f86 | mehedynoman11/Cpractises-main | Prefix sum and Binary search/ranged_sum_query.cpp | #include <iostream>
using namespace std;
int main() {
int N, Q;
cin >> N >> Q;
int a[N];
for(int i=0;i<N;i++) {
cin >> a[i];
}
int prefixSum[N];
prefixSum[0] = a[0];
for(int i=1;i<N;i++) {
prefixSum[i] = a[i] + prefixSum[i-1];
}
// for(int i=0;i<N;i++) {
// ... | ALGO | 0.999942 | 4.50077 |
4777e0d1-ac58-4032-abf1-f23a86fd8c05 | ishandutta2007/codeforces | yeongtree/normal/1371/A.cpp | #include <iostream>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int T; cin >> T;
while(T--)
{
int n; cin >> n;
cout << (n +1) /2 << '\n';
}
} | ALGO | 0.999743 | 4.95692 |
adf75a69-3b5e-4a15-834a-2f6df88a29ed | Dcoder10M/DSA-solved-questions | 0010-regular-expression-matching/0010-regular-expression-matching.cpp | class Solution {
public:
bool isMatch(string s, string p) {
int n=s.size(),m=p.size();
vector<vector<bool>> dp(n+1,vector<bool>(m+1,0));
// using vector<vector<int>> instead of bool can allow MLE
// as bool takes 1byte space and int takes 4 byte
dp[0][0] = true;
... | ALGO | 0.999688 | 5.569606 |
ad3a79cd-bbe3-418c-90fd-ec6a8d4b56a4 | MaksimKischenko/FlutterSamples | Flutter_Study/10.DidUpdateWidget/did_update_widget/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.997685 | 6.797273 |
f1f1b8c3-6538-47a8-9b99-ab71b3e4f5b3 | 27Divashree/Leetcode | 0493-reverse-pairs/0493-reverse-pairs.cpp | class Solution {
public:
int solveRec(vector<int>& nums)
{
int n = nums.size();
long long reversePairsCount = 0;
for(int i=0;i<n-1;i++)
{
for(int j=i+1;j<n;j++)
{
if(nums[i]>2*(long long)nums[j])
reversePairsCount++;
... | ALGO | 0.999721 | 5.271408 |
5fe42daf-562f-48a6-b47c-4876872b303d | aistha11/BscCSIT | sem2/oop/lab4/lab404.cpp | /*
class=finder
data members= an integet array of size 10
function=getdata() to assign values, largest() to find largest number
*/
#include <iostream>
#include <iomanip>
//#include <string.h>
using namespace std;
class finder
{
int arr[10];
public:
void getdata (int ar[]);
void largest ();
};
i... | ALGO | 0.995359 | 3.609537 |
aa5ccf0e-4a2a-44fe-93b8-fea70cf1dc44 | AK16092003/Semester-1-Turbo-C-programs | PRAC_ARM.CPP | #include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int n;
scanf("%d",&n);
int ans = 0;
int n1 = n;
while(n!=0){
int ld = n%10;
ans = ans + ld*ld*ld ;
n = n/10;
}
if (n1 == ans) printf("The given number is armstrong\n");
else printf("The given number is not a armstrong number\n");
getch();
}
| ALGO | 0.99995 | 3.642284 |
389dbcc0-7c7c-4fbe-9964-5c361df2f862 | theSupermacy/code | ppath.cpp | //http://www.spoj.com/problems/PPATH/
#include <iostream>
#include <list>
#include <cmath>
using namespace std;
int PrimeArr[10000];
void seive();
bool checkPrime(int);
int main(){
int t;
cin>>t;
seive();
//cout<<checkPrime(1033)<<checkPrime(1030)<<endl;
int visited[10001];
while(t--){
list<int> queue;
int p... | ALGO | 0.999669 | 4.256572 |
d520a1ba-3027-4c8b-9dab-404ad30a7d76 | anuragdvd/LeetCodeSolutions | DP/Unique-paths.cpp | /* Problem Link :: https://leetcode.com/problems/unique-paths
dp(i,j) = number of ways to reach cell (i,j)
dp[i,j] = dp[i+1][j] + dp[i][j+1]
/*
class Solution {
public:
int uniquePaths(int m, int n) {
int dp[m][n];
memset(dp,0,sizeof(dp));
for(int i=0;i<m;i++)
{
dp[i][... | ALGO | 0.999784 | 6.156635 |
e7094184-400c-40e8-b34d-fc6f7d08c9c5 | amrav/pres_plus | lib/Transforms/Utils/SSAUpdater.cpp | #include "llvm/Transforms/Utils/SSAUpdater.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/TinyPtrVector.h"
#include "llvm/Analysis/InstructionSimplify.h"
#include "llvm/IR/CFG.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/Module.h"
#includ... | TOOL | 0.995651 | 3.183319 |
82233819-1a62-4db8-88e3-92b98b214b58 | ROCm-Developer-Tools/llvm-project | llvm/lib/CodeGen/DetectDeadLanes.cpp | #include "llvm/CodeGen/DetectDeadLanes.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/TargetRegisterInfo.h"
#include "llvm/InitializePasses.h"
#include "llvm/Pass.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
using namesp... | ALGO | 0.990097 | 7.882379 |
9b6b1801-a160-4678-bfdb-ee7fb3f97015 | nc-77/algorithms | ACM/学军/b.cpp | #include<bits/stdc++.h>
#define ll long long
#define debug(x) cout<<#x<<'='<<x<<endl
#define set0(x) memset(x,0,sizeof(x))
using namespace std;
const int inf=0x3f3f3f3f;
const int maxn=2e6+10;
int a[maxn],dx[maxn],dy[maxn],res;
vector<int>g[maxn];
void dfs(int now,int par,int *d)
{
for(int i=0;i<g[now].size();i++)
... | ALGO | 0.999948 | 3.773181 |
7132d609-aa33-4928-8893-04576492b8e7 | shraddha8866/code-cpp | n15.cpp | #include<bits/stdc++.h>
using namespace std;
vector<int> ans(vector<int> arr,int k){
int n=arr.size();
vector<int> ars;
for(int i=0;i<n;i++){
for(int j=i+1;j<n;j++){
if(arr[i]+arr[j]==k){
ars.push_back(i);
}
}
}
return ars;
}
int main(){
int... | ALGO | 0.999821 | 3.764481 |
7e6614e5-0937-4a40-a855-0ca2bcee6804 | trungtran0689/myflappybird | cocos2d/cocos/ui/UITextField.cpp | #include "ui/UITextField.h"
#include "platform/CCFileUtils.h"
NS_CC_BEGIN
namespace ui {
static int _calcCharCount(const char * pszText)
{
int n = 0;
char ch = 0;
while ((ch = *pszText))
{
CC_BREAK_IF(! ch);
if (0x80 != (0xC0 & ch))
{
++n;
}
... | TOOL | 0.922184 | 6.487772 |
5660791c-bf09-48e0-af8a-dde8577accd1 | Dice101mahi/CP | MIN-MEX_Cut.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define llu long long unsigned
#define ld long double
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl '\n'
#define pb push_back
#define bp pop_back
#define pf push_front
#define fp pop_front
#define pp pop_up
#define m... | ALGO | 0.99992 | 4.137941 |
a910c76a-ae46-4904-a1ca-35b1d7874d9c | daniel-zint/offsets-and-remeshing | src/selfinter_repair/main.cpp | #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Surface_mesh.h>
#include <CGAL/Polygon_mesh_processing/IO/polygon_mesh_io.h>
#include <CGAL/Polygon_mesh_processing/repair_self_intersections.h>
#include <CGAL/boost/graph/Euler_operations.h>
#include <fstream>
#include <algorithm>
#include... | ALGO | 0.931237 | 5.781291 |
242de50e-bcdb-4425-9499-00efb8e8e7c2 | HoangDucAn/facebook-clone1 | code mang2.cpp | #include<stdio.h>
#include<math.h>
void nhap(int a[],int n){
printf("nhap cac phan tu trong mang\n");
for(int i=0;i<n;i++){
scanf("%d",&a[i]);
}
}
int sum(int a[],int n){
int tong=0;
for(int i=0;i<n;i++) tong+=a[i];
return tong;
}
int main(){
int n, a[100];
scanf("%d",&n);
nhap(a,n);
for(int i=0;i<n;... | ALGO | 0.996627 | 3.001554 |
700d6e19-3dd8-4916-aebd-8912c96752f1 | aayush-kattel/BIT | lab c++/lab 01/Q-3.cpp | /*
*Date: 2082/02/05
*C++ Programming Lab
*Lab-No: 01
*Faculty: BIT
*Name: Aayush Kattel
*(Q-3)Write a program to find xy using function
*/
#include<iostream>
using namespace std;
int find(int x,int y);
int main(){
int x=3,y=2;
int r;
r=find(x,y);
cout<<"Result="<<r;
}
int find(int x,int y){
int i,ans=1;
for(... | ALGO | 0.999819 | 4.40744 |
3eb40d83-cadf-42c1-aae0-fac4b5e94551 | haomingw/Codeforces | 380-389/386/F.cpp | #include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <utility>
#include <algorithm>
#include <map>
#include <unordered_map>
using namespace std;
#define REPP(i,a,b) for(int i=(a); i < (b); ++i)
#define REP(i,a) for(int i ... | ALGO | 0.999954 | 3.553151 |
255229b6-6c05-42ba-abe2-41e42c4a9d7b | Hengdang-Killer/DSA-Solutions | 1002-find-common-characters/1002-find-common-characters.cpp | class Solution
{
private:
const vector<string> a = {"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"};
public:
vector<string> commonChars(vector<string>& words)
{
vector<int> freq(26, 1000), temp(26, 0);
for(auto &itr : words)
... | ALGO | 0.999939 | 5.654399 |
d3b76450-0bc8-49ab-9674-c1662f4824d8 | danielsantosdasilva/Estruturas-de-dados-cpp | ED/Questionário 3/ex_01_03_parenteses_validos.cpp | #include <iostream>
#include <stack>
#include <string>
using namespace std;
bool isValidString(const string& entrada) {
stack<char> st;
bool valid = true;
for (char c : entrada) {
if (c == '(' || c == '[' || c == '{') {
st.push(c);
} else if (c == ')' || c == ']' || c == '}') ... | ALGO | 0.992529 | 6.153676 |
b1c6319f-265e-46fe-b3ac-c7c2e5f00c4c | cbkpar/BOJ | boj_33702.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int iK;
cin >> iK;
if (iK % 2 == 0)
{
cout << "0" << "\n";
}
else
{
cout << "8" << "\n";
}
return 0;
}
| ALGO | 0.99944 | 3.894909 |
b33ebce1-f936-4edc-b9a0-00a0f695bfa9 | yakuri354/cp | sbor/reg_jan24/d3/d_40.cpp | // #pragma GCC optimize("Ofast")
// #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#include <iostream>
#include <vector>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <algorithm>
#include <random>
using namespace std;
using ll = long long;
using ull = unsigned long long... | ALGO | 0.99944 | 4.464446 |
1f450ec2-e5b7-4c4b-bee4-81297d4d05f0 | sushskvnitn/ds_algo | binary_trees/diameter_of_bt.cpp | // diameter : no of nodes in longest path between any 2 leaves
// algorithm:
// if daimeter through node then dia = left height + right hright + 1
// if not then max of left height + right height
#include <bits/stdc++.h>
using namespace std ;
struct Node{
int data;
Node* left,*right;
Node(int val){
... | ALGO | 0.99996 | 5.283801 |
93e1c347-c1a8-43c1-902e-fe27d8820a82 | MeDoRa0/responsive_dash_board | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.9988 | 6.76073 |
2467c005-5f55-455e-9c30-f9a773a26f36 | Ajay8309/DSA-codes | Recursion/QuickSort.cpp | #include<iostream>
using namespace std;
int partition(int a[] , int s , int e ){
int pivot = a[s];
int cnt = 0;
for(int i = s+1 ; i <= e ; i++){
if(a[i] <= pivot){
cnt++;
}
}
int pivotIndex = s + cnt;
swap(a[pivotIndex] , a[s]);
// Left and right part s... | ALGO | 0.999991 | 5.056462 |
9658aef4-99f2-4103-9bfd-7918caf5517f | yash-gargji/codeforces-solution | C_Lazy_Narek.cpp | #include<bits/stdc++.h>
using namespace std;
int func(int i, int ind, unordered_map<int,vector<vector<int>>>& mp, vector<vector<int>>& dp) {
if(i == dp.size()) {
return -2*ind;
}
if(dp[i][ind] != INT_MIN) {
return dp[i][ind];
}
int take = mp[i][ind][0] + func(i+1, mp[i][ind][1], mp,... | ALGO | 0.999971 | 5.17435 |
6a7e0f65-2ff2-4257-9f94-2ed863644968 | ishandutta2007/codeforces | nikolapesic2802/normal/1161/C.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
#define ll long long
#define pb push_back
#define sz(x) (int)(x).size()
#define mp make_pair
#define f first
#define s second
#define all(x) x.begin(), x.end()
#define D(x) cerr << #x << " is " <<... | ALGO | 0.99999 | 3.953875 |
391e5d88-f7c0-4589-a7ea-f3917930fde5 | alexandraback/datacollection | solutions_5690574640250880_0/C++/Sharph/c.cpp | // Compiler: g++-4.8 (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
// Flags: -O2 -Wall -g -std=c++0x
// Aina häviää
#include <iostream>
#include <cmath>
#include <cstring>
using namespace std;
int R, C, M, O;
bool G[50][50];
int main() {
cin.sync_with_stdio(false);
int T;
cin >> T;
for(int t = 0; t < T; ++t) {
ci... | ALGO | 0.998746 | 4.207409 |
8e73b76d-1b2b-4745-86e9-ebee177feaa8 | vucongtuanduong/cpp-codeptit | LAB/lab1/3/3_2.cpp | #include <bits/stdc++.h>
using namespace std;
void testCase() {
int n;
cin >> n;
int a[n];
map<int, int> mp;
for (int i = 0; i < n; i++) {
cin >> a[i];
mp[a[i]] ++;
}
for (int i = 0; i < n; i++) {
if (mp[a[i]] >= 2) {
cout << a[i];
return;
... | ALGO | 0.999848 | 4.81635 |
33f25563-e95d-42ac-96df-041c6a5efee8 | vtandon1204/DSA-Sheet | 04. Binary Search/BS on 2D arrays/06.RotateMatrixby90.cpp | #include <bits/stdc++.h>
void rotate(vector<vector<int>> &mat)
{
int n = mat.size();
// 1. Transpose
for (int i = 0; i < n - 1; i++)
{
for (int j = i + 1; j < n; j++)
{
swap(mat[i][j], mat[j][i]);
}
}
// 2. reverse
for (int i = 0; i < n; i++)
{
... | ALGO | 0.999968 | 5.207776 |
23ef03ec-cb6c-45cc-b2a0-f1846d935618 | szperz/project-euler | 1.cpp | /* Problem 1
If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
Find the sum of all the multiples of 3 or 5 below 1000. */
#include <iostream>
int main() {
int suma = 0;
for(int i = 1; i < 1000; i++) {
if(i % 3 == 0) {
suma = suma ... | ALGO | 0.999824 | 4.352954 |
0a8a9a7a-b569-4df5-861b-f14b7cbfaf2a | tkejr/DSA | Recursion/LastIndex.cpp | int lastIndex(int input[], int size, int x) {
/* Don't write main().
Don't read input, it is passed as function argument.
Return output and don't print it.
Taking input and printing output is handled automatically.
*/
if (size < 0)
return -1;
// Return Statement
if (input[s... | ALGO | 0.999282 | 3.631621 |
6a54c875-59ca-4785-8d0a-3c5301d62939 | ngthanhtrung23/CompetitiveProgramming | codeforces/101240/A.cpp |
#include <sstream>
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <set>
#include <stack>
#include <map>
#include <string>
#include <queue>
#include <bitset>
#define int long long
#define ... | ALGO | 0.999791 | 4.038199 |
07cb676e-26bc-472e-80dd-ade24dc56c29 | pm306/procon | ABC/190/F2.cpp | #include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
using pll = pair<ll, ll>;
constexpr char ln = '\n';
constexpr long long INF = 1LL<<60;
constexpr double EPS = 1e-9;
#define all(v) v.begin(), v.end()
#define rep(i, n) for(int i=0;i<(n);i++)
#define rept... | ALGO | 0.999958 | 3.866949 |
7ec23c48-5e9f-4ec0-897b-19ba111e1b93 | drewphillips/CPP_Programs_ENG276 | 2_8_1_LAB_Convert_to_seconds.cpp | #include <iostream>
using namespace std;
int main() {
int seconds;
int minutes;
int hours;
cin >> seconds;
cin >> minutes;
cin >> hours;
minutes = (60 * hours) + minutes;
seconds = (60 * minutes) + seconds;
cout << seconds << " seconds" << endl;
return 0;
}
| ALGO | 0.985324 | 4.542308 |
8cbea3c4-3275-48db-bdac-1fe5b09108c5 | SodiumJu/NTU_Data_Structure | Project 1/pagerank.cpp | #include "functions.h"
string strline;
int prefix_len = 4;
vector<vector<float> > read_pages(string& dir_name,float ratio,Hash& hash_search, vector<string>& reverse_index) {
vector<string> files = getdir(dir_name);
int dim=files.size()-2+1; //add page 500 (total 501 pages)
//int dim=files.size()-2;//minus .. an... | ALGO | 0.999602 | 3.836922 |
a27ad0cf-2bff-4329-bc6e-a693d2be9222 | deepam20050/competitive-programming | solutions/1433D.cpp | #include "bits/stdc++.h"
using namespace std;
#ifdef DEBUG
#include "../algo/debug.hpp"
#else
#define debug(...)
#endif
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define sz(x) int((x).size())
#define all(x) begin(x), end(x)
#define eb emplace_back
using lli = long long;
using pii = pair < int, int >;
con... | ALGO | 0.999968 | 4.515336 |
0a251600-12c9-4310-a745-7b5953fdd08d | SimonN/Lix | src/lix/lix_upd.cpp | /*
* lemupd.cpp
*
* Was tut ein Lixxie in einem Update? Dies ist allerdings nur der grosse
* Rahmen, der das Zusammenspiel aller Lixxiee mit den interaktiven Objekten
* regelt. Einzel-Landbearbeitung findet in den Funktionen statt, die ueber
* Lixxie::update() aufgerufen werden.
*
*/
#include <cmath> // Knockb... | ALGO | 0.996739 | 5.193788 |
b51cbb78-a705-4678-8f98-331c5f581f93 | topling/topling-ark | src/terark/fsa/nest_trie_dawg.cpp | #include <cstring>
#include "nest_trie_dawg.hpp"
#include "fsa_cache_detail.hpp"
#include "nest_louds_trie_inline.hpp"
#include "dfa_mmap_header.hpp"
#include "tmplinst.hpp"
namespace terark {
template<class NestTrie, class DawgType>
NestTrieDAWG<NestTrie, DawgType>::~NestTrieDAWG() {
if (this->mmap_base) {
IsTerm... | TOOL | 0.947397 | 7.036778 |
20e718c3-f698-400c-9c29-a2b796794e5f | LouisaNicole/ZJU_Courses | ADS/project5/src/huffman.cpp | #include <iostream>
#include <string>
#include <queue>
#include <vector>
using namespace std;
int weight[0x40];
char character[0x40];
int wpl;
typedef struct _HNode
{
int weight;
char ch = 'z' + 1;
struct _HNode *left_child;
struct _HNode *right_child;
} HNode;
typedef HNode *HTree;
struct cmp
{
... | ALGO | 0.999964 | 4.104686 |
6232b96e-a390-4009-b2ee-7e7edece5d1f | metta-systems/metta | src/runtime/libc++/test/algorithms/alg.sorting/alg.binary.search/lower.bound/lower_bound_comp.pass.cpp | // <algorithm>
// template<ForwardIterator Iter, class T>
// requires HasLess<Iter::value_type, T>
// Iter
// lower_bound(Iter first, Iter last, const T& value);
#include <algorithm>
#include <functional>
#include <vector>
#include <cassert>
#include "../../../iterators.h"
template <class Iter, class T>
void
... | TEST | 0.998672 | 6.520569 |
8b743612-ae7d-45b8-b824-8905c50abce2 | CorentinDumery/garment-flattening | app/procrustes_test.cpp | /**
* @author Corentin Dumery
* @brief Finds the best reflection between two similar lines in a least squares sense,
* and forces reflectability
* @date 2022-02-04
*
*/
#include <igl/opengl/glfw/Viewer.h>
#include <igl/opengl/glfw/imgui/ImGuiHelpers.h>
#include <igl/opengl/glfw/imgui/ImGuiMenu.h>
#include <cmath... | ALGO | 0.994104 | 5.401345 |
59623d04-899b-4091-bff4-0415f9b6f36a | HarromPS/Languages | C++ OOPs/chapter_08/easy_friend_function.cpp | #include<iostream>
#include<cstdio>
using namespace std;
// Forward declaration that class B is defined later
// or else how compiler will know that friend function uses class B private data
class B;
class A
{
int num1;
// Statement of class A that friend wala function is its friend
// which takes ... | ALGO | 0.938852 | 4.690365 |
7771f9ee-07bd-4c92-b4eb-9ace2b7e93ab | AnkitaLpatil/LogicalPrograms | program317.cpp | #include<iostream>
using namespace std;
typedef class node
{
public:
int data;
struct node *next;
struct node *prev;
node()
{
data = 0;
next = NULL;
prev = NULL;
}
node(int value)
{
data = value;
... | ALGO | 0.995955 | 4.206132 |
f8bc856b-9f82-4ede-a19a-aed6b35f7c24 | master-Turbo/projects | module 18/18.5.2/main.cpp | #include<iostream>
using namespace std;
int counting_ways(int n)
{
cout << std::string(level, '\t') << "n = " << n << endl;
if (n < 0) return 0;
if (n == 0) return 1;
// cout << n << endl;
return counting_ways(n - 1) + counting_ways(n - 2) + counting_ways(n - 3);
}
int main()
{
cout <<... | ALGO | 0.999991 | 4.12869 |
12e8a18a-3523-4344-9e6b-7f0c8829be65 | skief/festo-coding-challenge-2023 | chapter2/puzzle1.cpp | #include <iostream>
#include <vector>
#include <map>
#include <string>
#include "keyTools.h"
using namespace std;
int main(){
map<int, Hammer> hammers = readHammers("inputs/hammer_collection.txt");
vector<string> keys = readKeys("inputs/21_keymaker_forge.txt");
for (size_t i = 0; i < keys.size() % KEYS_... | ALGO | 0.997454 | 4.890465 |
b7e3bf65-83c2-4771-bf67-a723138a7a8a | mahboobali09771/leetcode | 0171-excel-sheet-column-number/0171-excel-sheet-column-number.cpp | class Solution {
public:
int titleToNumber(string str) {
int n = str.length();
long long sum = 0;
long long a = 1;
for(int i=n-1;i>=0;i--){
char ch = str[i];
long long c = (int)ch-64;
c *= a;
sum += c;
a *= 26;
}
return... | ALGO | 0.999975 | 6.505875 |
32a37fa7-8856-4c57-be7b-a02c83a09141 | Apdaanu/projectEuler | summation_of_primes.cpp | //not optimized at all
#include<bits/stdc++.h>
#define for_int(i, val) for(int i=2; i<val; ++i)
using namespace std;
bool isPrime(int a){
bool flag = true;
for_int(i, a/2+1){
if(a%i == 0){
flag = false;
break;
}
}
return flag;
}
int main(){
long long int ans = 0;
for(int i=2; i<20000... | ALGO | 0.998731 | 4.046641 |
e0f8b36c-5f71-4fa6-823e-570d068e0868 | AB17-collab/iNeuron_assignment_16 | quest10.cpp | #include<iostream>
#include<vector>
using namespace std;
int checkTheRowWithMaxOnes(vector<vector<int> > a){
vector<int> rows(a.size());
for(int i=0; i<a.size(); i++){
int count = 0;
for(int j=0;j<a[0].size();j++){
if(a[i][j]==1)
count++;
}
rows[i] = c... | ALGO | 0.999822 | 4.589422 |
c1f57faa-ac21-4018-a76a-4edc6db456d3 | Ujjwalmittal1907/data-structure-and-algorithm | c++/h recursion/1print_n.cpp | #include<iostream>
using namespace std;
void print_cou(int n){
// recursive base
if (n==0){
return ;
}
// recursive relation
print_cou(n-1);
cout << n << endl;
}
void count(int n){
// recursive base
if(n==0){
return ;
}
// recursive relation
count(n-1);
cout << n ;
}
in... | ALGO | 0.999494 | 3.89202 |
c60d5d63-d24c-48dc-ba4c-ab843620cff7 | 2018331109/BCS-ORBITAX | COLLABORATIVE-78/G.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define yes cout<<"YES"<<endl;
#define no cout<<"NO"<<endl;
#define neg cout<<-1<<endl;
#define ff first
#define ss second
const int mod = 1e9 + 7;
const int md = 998244353;
const int INF = 1e18;
void solve()
{
int n, d;
... | ALGO | 0.999963 | 4.579181 |
63b0f2e2-e5d6-4796-bef0-72e929448674 | niciki/coursera | the C++ Modern Development specialization/2. yellow belt/week_1/4.cpp |
#include <iostream>
#include <map>
#include <vector>
using namespace std;
/*
enum class Lang {
DE, FR, IT
};
struct Region {
string std_name;
string parent_std_name;
map<Lang, string> names;
int64_t population;
};
*/
bool operator<(const Region& a, const Region& b){
return tie(a.std_name, a.parent_std... | ALGO | 0.983398 | 4.180696 |
a9ee33d9-4e9e-4aa5-8cee-9450742b9cc1 | hyf212/algorithm | 初级补充包/4.manacher算法/part2-最小表示法/最小循环覆盖2.cpp | #include <bits/stdc++.h>
using namespace std;
int n, nxt[200002];
char s[200002];
inline void getmin(char s[]) {
n = strlen(s + 1);
int j = 0;
nxt[1] = 0;
for (int i = 2; i <= n; i++) {
while (j && s[i] != s[j + 1])
j = nxt[j];
if (s[i] == s[j + 1])
++j;
nxt[i] = j;
}
n -= nxt[n];
for (int l = 1; ... | ALGO | 0.999984 | 3.98491 |
b4e30242-ffec-4fac-b5da-6f83cc13298b | vsandstrom/dsp-headers | bkp/delay.cpp | /* ˚◊˚ */
#include "buffer.hpp"
#include "delay.hpp"
#include "dsp_math.h"
#include "interpolation.hpp"
#include <cstddef>
using namespace dspheaders;
//////////////////////////////////////////////////////////
//////////////////// CONSTRUCTORS: ///////////////////////
////////////////////////////////////////////////... | TOOL | 0.90156 | 5.839143 |
b4940507-2e0a-4d08-8434-9c5a9d1d5614 | duanjiateng/Re-behave | 222-count-complete-tree-nodes.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
struct TreeNode
{
int val;
TreeNode *left;
TreeNode *right;
TreeNode(int x) : val(x), left(NULL), right(NULL... | ALGO | 0.999763 | 6.303269 |
ce3ce414-6d58-4ec6-a93e-94cec7c7bf3b | ravenblackhart/ImageProcessing | opencv/sources/modules/core/src/lda.cpp | #include "precomp.hpp"
#include <iostream>
#include <map>
#include <set>
namespace cv
{
// Removes duplicate elements in a given vector.
template<typename _Tp>
inline std::vector<_Tp> remove_dups(const std::vector<_Tp>& src) {
typedef typename std::set<_Tp>::const_iterator constSetIterator;
typedef typename s... | ALGO | 0.999417 | 6.232382 |
30f27152-838f-4406-9eff-e7ced801c9ea | kapoorz/cpptopics | codeforces/contest/481/div3/c.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> llpair;
vector<ll> sum;
llpair mapit(ll x)
{
llpair ans;
vector<ll>::iterator ptr = lower_bound(sum.begin(), sum.end(), x);
ll d = ptr - sum.begin();
ans.first = d + 1;
ans.second = x - (d != 0 ? sum[d - 1]... | ALGO | 0.999878 | 3.986506 |
734b9a0d-08f1-4b4e-8c2a-e4dbd04d625b | sumanmkumarr/coding | c++/repeated_character.cpp | #include <iostream>
using namespace std;
#include<string>
int main()
{
string c;
cin>>c;
int arr[128]={0};
for(int i=0;i<c.length();i++)
{
int a=c[i];
arr[a]++;
}
for(int i=0;i<128;i++)
{
if(arr[i]>0){
char t=i;;
cout<<t<<" "<<arr[i]... | ALGO | 0.999553 | 3.489979 |
218ff7d7-abb4-4b4a-9cd6-eadd23ad0392 | PiperBetle/MyCode | U106687 平行的直线.cpp | #include<iostream>
#include<cstring>
#include<string>
#include<cstdio>
#include<ctime>
#include<cmath>
#include<algorithm>
#include<cstdlib>
#include<iomanip>
using namespace std;
int s(int a,int b)
{
if(b==0)return a;
return s(b,a%b);
}
int gcd(int a,int b)
{
if((a*b)>0)return s(a,b);
else return -(abs(a),abs(b));... | ALGO | 0.999838 | 3.627165 |
127e2680-ff19-4d20-bb30-bcbce0b554fa | mQfZ/competitive-programming | src/cf/contest/1917/C/main.cpp | #include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include <debug.h>
#else
#define dbg(...) 0
#define dbgn(...) 0
#endif
int main() {
ios::sync_with_stdio(0); cin.tie(0);
int tt; cin >> tt;
while (tt--) {
int n, k, d; cin >> n >> k >> d;
vector<int> a(n); for (auto& x : a) cin >> ... | ALGO | 0.999683 | 3.982417 |
7dcf07bc-e8ea-417f-8bd4-433b482bad03 | sqmedeiros/sblp2023-time-vs-energy | 2185-Prime_Multiples/c++/fast/5411679.cpp | //Dinar Perseüs
#include<bits/stdc++.h>
#define ll long long int
#define fo(i,n) for (int i = 0; i < n; i++)
#define Fo(i,n,m) for(int i=n;n<m?i<m:i>m;n<m?i++:i--)
#define cy cout<<"YES\n"
#define cn cout<<"NO\n"
#define ce cout<<'\n'
#define pu push_back
#define po pop_back
#define vi vector<ll>
const int mod= 1e9+7;
... | ALGO | 0.999963 | 3.48171 |
cc5b24cf-579f-4675-bdef-2c13de223384 | TazoArT-27/CF_Problem_Solving | tempCodeRunnerFile.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int n, sum = 0;
cin >> n;
for(int i = 1; i <= n; i++){
if(i % 2 != 0){
sum -= i;
}
else sum += i;
}
cout << sum << endl;
return 0;
} | ALGO | 0.999841 | 4.435426 |
bd3b89c0-2317-4da8-a17a-07a827104317 | Vivekdhakad04/Leetcode---POTD | 0054-spiral-matrix/0054-spiral-matrix.cpp | class Solution {
public:
vector<int> spiralOrder(vector<vector<int>>& matrix) {
int m = matrix.size();
int n = matrix[0].size();
vector<int> result;
int left = 0, top = 0, down = m - 1, right = n - 1;
while(left <= right && top <= down)
{
//left to right... | ALGO | 0.999997 | 6.471355 |
d055ef0c-b4af-4e5b-97ec-94d41463dd1b | ishandutta2007/codeforces | physics0523/normal/1729/B.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t;
cin >> t;
while(t>0){
t--;
int n;
string s,res;
cin >> n >> s;
int i=n-1;
while(i>=0){
int v;
if(s[i]=='0'){
v=(s[i-2]-'0')*10+(s[i-1]-'0');
i-=3... | ALGO | 0.997542 | 3.949785 |
ef16e848-db8b-42ff-acc2-c3f2ad9e6e31 | cryptozeny/anzucoin2nd | src/merkleblock.cpp | #include <merkleblock.h>
#include <hash.h>
#include <consensus/consensus.h>
#include <utilstrencodings.h>
CMerkleBlock::CMerkleBlock(const CBlock& block, CBloomFilter* filter, const std::set<uint256>* txids)
{
header = block.GetBlockHeader();
std::vector<bool> vMatch;
std::vector<uint256> vHashes;
v... | ALGO | 0.99851 | 6.175004 |
5cd963cc-d3df-4acf-ba7f-ef98e0008ba8 | lucasturci/Games | Asteroids/tests/convex_hull.cpp | #include <algorithm>
#include <assert.h>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <memory.h>
#include <numeric>
#inc... | ALGO | 0.999966 | 4.75275 |
1981f3c3-ba19-4e0e-b0e5-0b92c390dbe7 | zkxshg/Test_of_LeetCode | 1000-2000/1081_Smallest_Subsequence_of_Distinct_Characters.cpp | // greedy + stack
class Solution {
public:
string smallestSubsequence(string text) {
vector<bool> seen(26, false);
vector<int> freq(26, 0);
for(char ch : text)
freq[ch - 'a']++;
stack<char> st;
for(int i=0; i<text.size(); i++){
char ch... | ALGO | 0.999995 | 6.378255 |
793a3ad8-c795-48c5-90a8-6ec5356fd7ae | rupak-prog/Mtech2sem | TopicNet/part3.cpp | #include <iostream>
#include <chrono>
#include <random>
#include <queue>
using namespace std;
double max(double a,double b){
return a>b?a:b;
}
double Exponential(double x)
{
double z;
do
{
z = ((double) rand()/RAND_MAX);
}
while ((z==0) || (z==1));
return((-x)*log(z));
}
// Drive... | ALGO | 0.98136 | 4.488338 |
d1dee513-5834-4541-a9b6-e2884b503af7 | Rahul-Singh4/Placement | Day12/Q3_sort.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
vector<int> nums(n);
for(int i=0;i<n;i++){
cin>>nums[i];
}
sort(nums.begin(),nums.end());
if(nums[0]!=nums[1]){
cout<<nums[0]<<endl;
}
else if(nums[n-1]!=nums[n-2]){
cout<<nums[n-1]<<endl;
}
else {
for(int i=1;i<n-1;i++){
if... | ALGO | 0.999964 | 3.45697 |
7b34ded5-14cb-4353-8750-860c64ee93ba | sarvex/leetcode-fish | solution/1200-1299/1290.Convert Binary Number in a Linked List to Integer/Solution.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
int getDecimalValue(L... | ALGO | 0.999967 | 5.805252 |
81ff4815-45b0-4e36-9f7c-56250628ee98 | gyanprakash03/CPP-Repo | sum_of_even.cpp | #include<iostream>
using namespace std;
// sum of even numbers till N
int main(){
int N,i;
int sum=0;
cin >> N;
for (i=2;i<=N;i+=2) {
sum += i;
}
cout << sum << endl;
} | ALGO | 0.9996 | 4.138278 |
700d636a-d900-462e-8050-bd74b5c5da6e | ishandutta2007/codeforces | __zmf__/normal/1070/K.cpp | /*
ever17
*/
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#include <bits/stdc++.h>
using namespace std;
#define int long long
inline int read()
{
int sum = 0, nega = 1;
char ch = getchar();
while (ch > '9' || ch < '0')
{
if (ch == '-') nega = -1;
... | ALGO | 0.999987 | 3.626634 |
ee9ec7e9-f0bb-4204-937a-660a235eeba4 | namdeft/1v1-Leetcode | Binary Search/Binary Search/solution.cpp | class Solution {
public:
int search(vector<int>& nums, int target) {
int mid;
int left = 0;
int right = nums.size() - 1;
while (left <= right) {
mid = (left + right) / 2;
if (target == nums[mid]) {
return mid;
}
if... | ALGO | 0.999878 | 6.507432 |
c9c298c1-89e3-424d-bd2c-eefa5663bfcf | MJ111/algorithm-snippet | algorithmic-problem/algosrc/problems/lis/lis.cpp | #include<cstring>
#include<iostream>
#include<string>
#include<vector>
using namespace std;
int lis(const vector<int>& A) {
// 기저 사례: A 가 텅 비어 있을 때
if(A.empty()) return 0;
int ret = 0;
for(int i = 0; i < A.size(); ++i) {
vector<int> B;
for(int j = i+1; j < A.size(); ++j)
if(A[i] < A[j])
B.push_back(A[j]... | ALGO | 0.999986 | 4.015489 |
06ee600e-0f1b-4e3d-9e1e-45011ad4f096 | FBDr/6lowpanstars | src/ndnSIM/NFD/tools/nfdc/help.cpp | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
#include "help.hpp"
#include "format-helpers.hpp"
#include <ndn-cxx/util/logger.hpp>
#include <unistd.h>
namespace nfd {
namespace tools {
namespace nfdc {
NDN_LOG_INIT(nfdc.Help);
const int LIST_COMMAND_NAME_COLUM... | TOOL | 0.904505 | 6.976129 |
3f68d956-1887-4190-9460-635cb398cb8b | yzzupgo/MFTCG | Data/abc136_b/ohmor/ac/6713860.cpp | #include <iostream>
#include <cmath>
using namespace std;
int main() {
int n, k;
cin >> n;
k = log10(n);
int odd = 0;
for (int i = 0; i <= k; i++) {
if (i%2==0 && i!=k){
odd += (10 * pow(10, i)) - (1 * pow(10, i));
}if (i%2==0 && i==k) {
odd+= n - pow(10, i) + 1;
}
}
cout << odd << endl;
return 0;
}
| ALGO | 0.998971 | 3.605803 |
267d7135-4f1d-437c-83a8-44e21664c672 | Swara-IITB/Mastering_CP_SOC_2025 | Solved_Problems/Week4/CSES/Coin_Combinations_I_CSES.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll const M = 1e9+7;
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
ll x,n;
cin >> x >> n;
vector<ll> coins(x);
for(ll i=0; i<x; i++){
cin >> coins[i];
}
vector<ll> ways(n+1);
ways[0] = 1;
for(ll i=1; i<=... | ALGO | 0.999976 | 4.45618 |
dac3cbc4-6eec-440d-8810-132d6a6a756d | Morek999/OMSCS_Taiwan_Leetcode | Jason/Jason_0042_20200119.cpp | /*
The key idea of this problem is that the volume of the water can be trapped in index i
vol = min(max(h[0:i-1]), max(h[i:end]) - h[i]
so if we do brutal force, loop through the vector and then search maximum element on left and right side, it's O(n^2) time complexity
and fortunately it will pass. Sp... | ALGO | 0.999991 | 6.897068 |
b4145481-daba-4360-9b64-aeeeffa65bfc | venkataKoushik/recursion-cpp | prob1.cpp | #include<bits/stdc++.h>
using namespace std;
void print(int i,int n)
{
if(i==n)return;
cout<<"Koushik"<<endl;
print(i+1,n);
}
int main()
{
int i=0,n=5;
print(i,n);
return 0;
} | ALGO | 0.999206 | 3.377196 |
39a40a59-295f-43cb-ac35-3af2987c7aeb | AyushiGautam2084/ObjectOrientedProgramming | Q3_26Aug.cpp | #include <iostream>
using namespace std;
class values
{
private:
int i;
static int takeVal;
static int giveVal;
public:
void input();
void output();
void show();
};
int values::takeVal=0;
int values::giveVal=0;
void values::input()
{
cout<<"Enter a number:... | TOOL | 0.895014 | 4.802306 |
349d83bd-4d06-4876-b502-84400fec1614 | tanishkamishra2110/Recursion | allindex.cpp | #include<iostream>
using namespace std;
int allIndexes(int input[], int size, int x, int output[]) {
if(size == 0){
return 0;
}
int m = allIndexes(input, size-1, x, output);
if(input[size - 1] == x){
output[m] = size-1;
return m+1;
}else{
return m;
}
}
int main(){
... | ALGO | 0.999901 | 4.656039 |
f1ccf7e4-3eb5-45cf-83e8-5b56df220288 | abxd39/C-primery-5th | CppPrimer-master/ch10/ex10_12.cpp | //! @Alan
//! Exercise 10.12:
//! Write a function named compareIsbn that compares the isbn() members of two Sales_data objects.
//! Use that function to sort a vector that holds Sales_data objects.
//!
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include "../ch07/ex... | ALGO | 0.989675 | 6.144614 |
4184a16e-a7f5-4014-9f9f-f90729ebd777 | jameskkk/UVCCamera | opencv_2.4.13.2/sources/modules/legacy/src/blobtrackingccwithcr.cpp | #include "precomp.hpp"
/* Blob (foreground-pixel connected-component) tracking with collision resolution.
*
* For entrypoints into the literature see:
*
* A Tutorial on Particle Filters for Online Nonlinear/Non-Gaussian Bayesian Tracking
* Arulampalam &t al, 2001, 15p
* http://www-clmc.usc.edu/publications/A/... | ALGO | 0.996843 | 6.263961 |
c132f369-94c8-4bfb-97f7-49b06f5f0fa6 | yuriYanZeXuan/ICPC | BlueBridgeExercise/CutSequence.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N=1e5+10;
int n;
LL m;
int w[N],q[N];
LL f[N];
multiset<LL> S;
void remove(LL x){
auto it=S.find(x);
S.erase(it);
/*直接写S.erase(x)会将所有x删除*/
}
int main(){
cin>>n>>m;
for(int i=1;i<=n;i++){
cin>>w[i];
if(w[i]>m... | ALGO | 0.999993 | 3.490556 |
3322d92b-71b1-443d-8bed-6fd0e9592065 | rookzeno/kprlibrary | C++/グラフ.cpp | struct edge { int to, cap, rev, cost; };
vector<edge> G[MAX_V];
void add_edge(int from, int to, int cap, int cost = 0){
G[from].push_back(edge{ to, cap, (int)G[to].size(),cost });
G[to].push_back(edge{ from,0,(int)G[from].size() - 1,-cost });
}
| ALGO | 0.999395 | 4.178422 |
6fb0c2aa-32a0-41f4-9269-92413526a899 | surya02112002/Leetcode_DSA | 125-valid-palindrome/valid-palindrome.cpp | class Solution {
public:
bool isPalindrome(string s) {
int n=s.size();
string a;
string b;
for(int i=0; i<n ;i++){
if(isalpha(s[i])|| isdigit(s[i])){
a.push_back(tolower(s[i]));
}
}
b=a;
reverse(a.begin(),a.end());
... | ALGO | 0.999928 | 6.33089 |
fe64af1f-2772-42ab-aedb-959475792e55 | rvgpu/rvgpu-llvm | clang-tools-extra/pseudo/lib/Bracket.cpp | #include "clang-pseudo/Bracket.h"
namespace clang {
namespace pseudo {
namespace {
struct Bracket {
using Index = unsigned;
constexpr static Index None = -1;
enum BracketKind : char { Paren, Brace, Square } Kind;
enum Direction : bool { Open, Close } Dir;
unsigned Line;
unsigned Indent;
Token::Index To... | ALGO | 0.941742 | 7.801978 |
60834d7d-2639-4df6-bc26-91644c37ea95 | infotoarchit2012/ArchitKumarSingh_DS_2A | DS3.cpp | #include<iostream>
using namespace std;
int main()
{
int a[10],n,element,i;
cout<<"Archit Kumar Singh\n";
cout<<"Enter the size of the array\n";
cin>>n;
cout<<"Enter elements of the array in the sorted order\n";
for(i=0;i<n;i++)
{
cin>>a[i];
}
cout<<("Enter element to be inse... | ALGO | 0.99996 | 4.0449 |
efcc4c2c-2472-4e95-a681-561523f2cdd1 | Jatin-Kumar-Thakur/D_S_A | 8_Tree/1_Binary_Tree.cpp | #include <iostream>
using namespace std;
class node
{
public:
int data;
node *next;
node *left;
node *right;
node(int data)
{
this->data = data;
this->left = NULL;
this->right = NULL;
}
};
node *binary_tree()
{
node *root; // root=newnode
int data;
cout <... | ALGO | 0.999524 | 4.478368 |
1d1e7ebc-5ea0-4895-a222-4cbe6b2be139 | raincross7/code-similarity | codes/train_code/problem457/problem457_108.cpp | #include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
int main() {
int n, m;
cin >> n >> m;
priority_queue<int> q;
vector<vector<int>> v(m);
rep(i, n) {
int a, b;
cin >> a >> b;
if (a > m) continue;
v[m-a].pu... | ALGO | 0.999943 | 3.383216 |
96a0e7fc-4e6d-458d-b7bb-4061ec49c2cb | raincross7/code-similarity | codes/train_code/problem351/problem351_205.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
string x,y;
cin>>x>>y;
if(x==y)
{
cout<<"="<<endl;
}
else if(x>y)
{
cout<<">"<<endl;
}
else
{
cout<<"<"<<endl;
}
return 0;
}
| ALGO | 0.999991 | 3.466405 |
6102d9e0-dfb5-41cb-86c6-05d06de0a1c7 | AhmedZahran02/Problem-Solving-Sheet | Codeforces/B/088-Minimum Ternary String.cpp | #include<bits/stdc++.h>
#define fast1() ios_base::sync_with_stdio(false)
#define fast2() cin.tie(NULL)
#define infile() freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#define all(v) v.begin(),v.end()
#define sortv(vec) sort(all(vec)) //sort vector
#define getdiff(v1,v2,dist) set_difference(all(v... | ALGO | 0.999984 | 3.528468 |
aa476fff-1fdc-4126-a639-3eee174d2418 | Voltline/ECNU_Online_Judge | 1009斜角.cpp | #include <iostream>
using namespace std;
int main()
{
int n{0};
cin >> n;
int** matrix = new int*[n];
for (int i = 0; i < n; i++) {
matrix[i] = new int[n];
}
for (int i = 0; i < n; i++) {
matrix[i][i] = n;
for (int j = i+1; j < n; j++) {
matrix[i][j] = n - (j - i);
matrix[j][i] = n - (j - i);
}
}
... | ALGO | 0.999762 | 3.510884 |
7fc939ec-36ab-41c9-83de-4b15394f8687 | Harsh-Vardhan-Upadhyay/DSA-LeetCode- | LOOPS_AND_PATTERNS/if_condition.cpp | #include <iostream>
using namespace std;
int main(int argc, char const *argv[])
{
// int i;
// int sum;
// int n;
// cin>>n;
// i = 1;
// sum = 0;
// while (i<=n)
// {
// sum = sum + i;
// cout<<sum<<endl;
// i = i+1;
// }
// cout <<sum ;
//Prime numb... | ALGO | 0.998828 | 3.396429 |
1d124daf-8703-43af-81c9-162743368a57 | alfandialamshach/Insertionsort_152 | Insertion sort/Insertion sort.cpp | #include <iostream>
using namespace std;
int arr[20]; // Membuat Array dengan panjang 20
int n; // Membuat Variable inputan n
void input() { // Procedure input
while (true)
{
cout << "Masukkan jumlah data pada array : "; // Membuat inputan jumlah elemen array
cin >> n; // Memanggil variable inpu... | ALGO | 0.998872 | 3.752731 |
7a57348a-6646-49de-81b8-3903cf293ecb | ahsabshiraz/gfg-question | 5.ARRAY/14stockpart1.cpp | #include <iostream>
#include <cmath>
using namespace std;
int maxProfit(int price[], int start, int end)
{
if (end <= start)
return 0;
int profit = 0;
for (int i = start; i < end; i++)
{
for (int j = i + 1; j <= end; j++)
{
if (price[j] > price[i])
{
... | ALGO | 0.999896 | 5.623872 |
571f1879-5b67-45a2-9780-618a0fbe425f | Grachik13/Informat1ka | bisection1.cpp | #include <iostream>
#include <math.h>
#include <stdio.h>
#include <time.h>
using namespace std;
double f(double x) {
return sin(x);
}
int main() {
double middle;
double a = -1;
double b = 5;
double eps = 1e-5;
while (fabs(a - b) > eps) {
middle = (b + a) / 2; // середина текущего отрезка
if (f(... | ALGO | 0.999902 | 4.316317 |
1d813aee-095f-4f5b-b057-3a8d0a389b58 | Aman24114/leetcode-imp | 3548-find-the-count-of-good-integers/find-the-count-of-good-integers.cpp | #define ll long long
class Solution {
public:
ll countGoodIntegers(int n, int k)
{ ll result=0;
unordered_set<string>st;
int d=(n+1)/2;
int s=pow(10, d-1);
int e=pow(10,d)-1;
for(int n1=s;n1<=e;n1++)
{
string lh=to_string(n1);
... | ALGO | 0.999747 | 5.045205 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.