uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
5bb91899-e83a-4709-81a8-bef5200c5f6f | rafiul-arefeen/CSE-4304 | Lab_14/D_Energetic_Propagation.cpp | #include <bits/stdc++.h>
class SegmentTree
{
private:
int *segment;
int *lazy;
int n;
std::vector<int> input;
void init(int node, int b, int e)
{
if (b == e)
{
segment[node] = input[b];
return;
}
else
{
int left = node... | ALGO | 0.999497 | 5.398605 |
75eec1bb-22fc-45c8-946e-6eaf2ff5c312 | 113bommy/LogicalErrorFixCodeT5 | logicalErrorFix_CodeT5_no_LineNumber/model/cpp/cpp_gold/gold_72.cpp | #include <bits/stdc++.h>
using namespace std;
void fastIO() {
ios_base::sync_with_stdio(false);
cout.setf(ios::fixed);
cout.precision(10);
cout.tie(nullptr);
cin.tie(nullptr);
}
template <class T>
T power(T N, T P) {
return (P == 0) ? 1 : N * power(N, P - 1);
}
template <class T>
T GCD(T A, T B) {
return (A % B == 0) ?... | ALGO | 0.999999 | 3.887188 |
8ed8a36b-6f5f-4216-ad82-ed94114bd02c | bikashkumaryadav/LeetCode-ProblemSets | 1760-minimum-limit-of-balls-in-a-bag/1760-minimum-limit-of-balls-in-a-bag.cpp | class Solution {
public:
int minimumSize(vector<int>& nums, int maxOps) {
int low = 1, high = *max_element(nums.begin(), nums.end());
while (low < high) {
int mid = low + (high - low) / 2;
int ops = 0;
for (int n : nums) if ((ops += (n - 1) / mid) > maxOps) break;... | ALGO | 0.99995 | 5.946846 |
22fed383-2598-4fee-bda7-c1fe19aab31e | CoderMayhem/namanDoesCP | contest/cfMay20/2.cpp | #include<bits/stdc++.h>
#include<math.h>
using namespace std;
// Function to reverse a string
void reverseStr(string& str)
{
int n = str.length();
// Swap character starting from two
// corners
for (int i = 0; i < n / 2; i++)
swap(str[i], str[n - i - 1]);
}
bool isPalindrome(string str){... | ALGO | 0.999947 | 4.593077 |
900f7664-adb5-4981-b380-92c71bde4b95 | chauthevi2004/IT003.N21.CTTN | maketest.cpp | #include <bits/stdc++.h>
using namespace std;
bool cmp(double a, double b) {
return a > b;
}
int main()
{
const int MAX = 1000000;
srand(time(NULL));
vector<double> vt;
string testcase[10] = {"test1.txt", "test2.txt", "test3.txt", "test4.txt", "test5.txt", "test6.txt", "test7.txt", "test8.txt", "t... | TEST | 0.956451 | 3.773977 |
2034333f-0f1f-4a83-a055-7ebe1309d8c2 | Klaraaorban/IT_class_lic | karak/main.cpp | #include <iostream>
#include <cstring>
using namespace std;
int v[20],n;
char a[20];
void kiir(){
for(int i=1;i<=n;i++) cout<<a[v[i]];
cout<<endl;
}
bool megoldas(int k){
return(k==n);
}
void vank(int k,bool &vk){
v[k]++;
vk=(v[k]<n);
}
void joelem(int k, bool &je){
je=true;
for(int i=1;i<k;i++){
if(v[i]==v[k]) je=... | ALGO | 0.999891 | 3.501842 |
36d2de3f-3a7f-4750-9ba8-9b04e91f99cc | pavanbaloju/data-structures-and-algorithms | striver-sde-sheet/122.InordersuccessorInBST.cpp | #include <iostream>
using namespace std;
// Definition for a binary tree node
struct TreeNode
{
int val;
TreeNode *left;
TreeNode *right;
TreeNode(int x) : val(x), left(NULL), right(NULL) {}
};
// Problem Statement:
// Given a binary search tree (BST), find the in-order successor of a given node in th... | ALGO | 0.999999 | 7.28816 |
8ec1c07c-d533-4b08-9440-6beb901c053b | Rishita1304/Leetcode | 1256-rank-transform-of-an-array/rank-transform-of-an-array.cpp | class Solution {
public:
vector<int> arrayRankTransform(vector<int>& arr) {
map<int,int> m;
vector<int> ans;
int cnt=1;
for(auto i:arr) m[i]++;
for(auto i:m){
m[i.first] = cnt;
cnt++;
}
for(int i=0;i<arr.size();i++) ans.push_back(m[arr[... | ALGO | 0.999984 | 5.902753 |
fdfd02d1-bdca-4fe8-a89a-02c0c951744a | mingyEx/leetcode-parser-old | main.cpp |
#include<vector>
#include<string>
#include<map>
#include<algorithm>
#include <unordered_map>
#include<iostream>
#include<bitset>
#include<algorithm>
#include<fstream>
#include<numeric>
#include<queue>
#include<functional>
#include<iomanip>
#include<variant>
#include<cassert>
#include<memory>
#include<typeinfo>
#inclu... | ALGO | 0.998735 | 3.593824 |
df944cd2-4b33-46ad-920d-2e9036479589 | Nic-bit/essential | boost-1.85.0/libs/geometry/doc/src/examples/geometries/polygon.cpp | // Boost.Geometry
// QuickBook Example
//[polygon
//` Declaration and use of the Boost.Geometry model::polygon, modelling the Polygon Concept
#include <iostream>
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/geometries.hpp>
namespace bg = boost::geometry;
int main()
{
typedef bg::model::poin... | TOOL | 0.944158 | 7.549366 |
a621f36b-2e9e-40b2-aa1d-2f3280c6b9a7 | tfg1434/cp | CerealCodes/E.cpp | #include <bits/stdc++.h>
using namespace std;
using pll = pair<long long, long long>;
#define ll long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define eb emplace_back
#define vi vector<ll>
#define vb vector<bool>
#define f0(i,a) for(ll i=0;i<(a);i++)
#defi... | ALGO | 0.999896 | 5.561718 |
f016fbd4-f91d-44dd-a851-193f3322313a | ishandutta2007/codeforces | xyf007/normal/1566/F.cpp | #include <algorithm>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
template <typename T>
void checkmax(T &x, T y) {
if (x < y) x = y;
}
template <typename ... | ALGO | 0.999985 | 4.554924 |
2831e84f-9a7e-4672-9f1a-1abc55df63f3 | jagadishchakma/cse-fundamentals-course-with-phitron | course_DS/module_15_stack_queue_practice_01/problem_02.cpp | #include <bits/stdc++.h>
using namespace std;
class Node{
public:
int val;
Node* next;
Node* prev;
Node(int val){
this->val = val;
next = NULL;
prev = NULL;
}
};
class Stack{
public:
Node* head = NULL;
Node* tail = NULL;
int sz = 0;
void push(int val){... | ALGO | 0.999976 | 4.096467 |
cb647aec-56b6-4510-bc20-7dbbc1a91664 | ishandutta2007/codeforces | _ss/normal/1280/B.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pii pair<int,int>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define all(vr) vr.begin(),vr.end()
const ll N=1e5+10,mod=1e9+7,inf=1e18;
int a[110][110],m,n;
int main()
{
//freopen("ss.i... | ALGO | 0.999979 | 4.853561 |
2c40a87d-a652-4c43-8fd9-dd626e5ff6eb | ishandutta2007/codeforces | maspy/normal/1638/D.cpp | #line 1 "/home/maspy/compro/library/my_template.hpp"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pi = pair<ll, ll>;
using vi = vector<ll>;
using u32 = unsigned int;
using u64 = unsigned long long;
using i128 = __int128;
template <class T>
using vc = vector<T>;
template <class T>
using v... | ALGO | 0.999826 | 3.64665 |
67375742-cfe9-4847-afe2-7cfda8445b14 | SequoiaDB/SequoiaDB | thirdparty/boost/libs/math/src/tr1/cyl_bessel_kf.cpp | extern "C" float BOOST_MATH_TR1_DECL boost_cyl_bessel_kf BOOST_PREVENT_MACRO_SUBSTITUTION(float nu, float x) BOOST_MATH_C99_THROW_SPEC
{
return c_policies::cyl_bessel_k BOOST_PREVENT_MACRO_SUBSTITUTION(nu, x);
}
| TOOL | 0.851599 | 3.030694 |
8500f183-78b0-4639-9c81-390acad4deed | ritikaradh/learnDSA | DSA/Greedy/MinAbsDiff.cpp | #include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
using namespace std;
void print(vector<int> &vec){
int n = vec.size();
for(int i=0; i<n; i++){
cout<<vec[i]<<", ";
}cout<<endl;
}
int minAbsDif(vector<int> &arr1, vector<int> &arr2){
int n = arr1.size();
vector<i... | ALGO | 0.99995 | 4.820375 |
9fa88169-9d2f-4562-8aef-0ac9039ffcf0 | raincross7/code-similarity | codes/train_code/problem457/problem457_454.cpp | #include <bits/stdc++.h>
#define PI 3.14159265359
#define NIL (-1)
#define LL long long
using namespace std;
const int64_t MOD = 1e9 + 7;
const int INF = INT_MAX;
int main() {
int N, M;
cin >> N >> M;
vector<int> A(N), B(N);
for (int i = 0; i < N; i++) cin >> A[i] >> B[i];
vector<vector<int>> v(1e5 + 1);
for (... | ALGO | 0.999985 | 3.680887 |
5110c24b-c0dc-410e-98b1-201c2baa508f | vothvu/Competitive-Programming | LightOJ/ACSol/1008 - Fibsieve`s Fantabulous Birthday.cpp | /*
ID: Vu Vo
PROG: 1008 - Fibsieve`s Fantabulous Birthday
LANG: C++
*/
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <cmath>
using namespace std;
#define inpFile(name) freope... | ALGO | 0.997028 | 3.562982 |
7b216c06-7e1f-466a-933d-39757f745986 | c-s-n-v-7-7/TestGit | CP/MaxSumTreeDp.cpp | #include<iostream>
#include<unordered_set>
using namespace std ;
int pre[101] ;
int dp[101] ;
unordered_set<int> g[101] ;
int max ( int a , int b )
{
return (a>b)? a:b ;
}
int maxSum ( int s )
{
int val = 0 ;
for ( auto it=g[s].begin() ; it!=g[s].end() ; ++it )
{
if ( pre[*it] ==-1 )
{
dp[*it] = max ... | ALGO | 0.999696 | 3.914226 |
4e1164d3-e340-4d84-87e7-562b5b58a3af | ishandutta2007/codeforces | n_z__/normal/40/B.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n,m,x;
cin>>n>>m>>x;
n-=2*x-1,m-=2*x-1;
if(min(n,m)<0)cout<<0;
else cout<<max(n+m,1);
} | ALGO | 0.999957 | 3.436953 |
1e680a9e-277c-403a-a75d-7e09f9c7da1f | GitDhamani/CPP-Coding-Challenges | Sorting an STL Priority Queue of Person Objects by Age.cpp | #include <iostream>
#include <queue>
#include <string>
class Person
{
std::string name;
int age;
public:
Person(std::string n, int a) : name{n}, age{a} {}
bool operator<(const Person& obj) const
{
return (this->age < obj.age);
}
std::string getname() const {return name;}
... | ALGO | 0.947813 | 5.308856 |
b79eb057-7e91-4ceb-9d3d-f46efc3a669c | claner2804/Algorithms-and-Datastructures-HW04-02 | selection_sort.cpp | //
// Created by Claudia Steiner on 14.06.24.
//
#include "selection_sort.h"
#include <vector>
// Function to perform selection sort
void selectionSort(std::vector<int>& arr) {
int n = arr.size();
for (int i = 0; i < n - 1; i++) {
int min_idx = i;
for (int j = i + 1; j < n; j++) {
i... | ALGO | 0.99962 | 6.294843 |
2ce9793a-dd31-4e5f-87b8-bb8465219127 | aboutwonjun/POSCO_SF5th | C++_Practice_/0423_반복문/practice2_1부터N까지합.cpp | //1부터 n까지의 합 구하기
#include <iostream>
// int main()
// {
// std::cout << "1부터 n까지의 합 구하기";
// "숫자(양의 정수)를 입력하세오 :";
// int num;
// std::cin >> num;
// int res;
// for (1; 1 <= num; num++);
// {
// }
int main()
{
std::cout << "1부터 n까지의 합 구하기" << std::endl;
std::cout ... | ALGO | 0.988122 | 5.190972 |
09854f7c-90c3-4ae8-a5d6-0bf3b44a3231 | zhubo240/leetcode | string/5-Longest-Palindromic-Substring/src/5-Longest-Palindromic-Substring.cpp | #include <iostream>
#include <string>
#include <vector>
#include <iterator>
using namespace std;
class Solution {
public:
string longestPalindrome(string s) {
//check
string evens;
init(s, evens);
vector<int> dp(evens.size(), 0);
int farIdx = 1;
int farCenter = 0;
dp[0] = 1;
for (unsigned i = 1; i < ... | ALGO | 0.999776 | 4.720318 |
428b4afa-d73c-4b80-bd5c-17eee8362549 | sebbbin/Boj | [PCCP 기출문제] 1번 붕대 감기.cpp | #include <string>
#include <vector>
#include <iostream>
using namespace std;
int solution(vector<int> bandage, int health, vector<vector<int>> attacks) {
int acsize= attacks.size();
int maxtime = attacks[acsize-1][0];
int blood = health;
int seqtime=0;
int j=0;
for(int i=1; i<=maxtime; i++){... | ALGO | 0.999666 | 3.779789 |
1ab403e2-044b-43f2-9667-49ba0f3b190d | zonkytm/dz_3_6_7 | dz_3_6_7/buble_sort_realisation.cpp | #include "buble_sorting.h"
void bubble_sorting(int* arr, int size) {
for (int i = 0; i < size; i++)
{
for (int j = 0; j < size - 1; j++)
{
if (arr[j] > arr[j + 1])
{
int bufer_i = arr[j];
arr[j] = arr[j + 1];
arr[j + 1] = bufer_i;
}
}
}
}
void bubble_sorting(double* arr, int size) {
f... | ALGO | 0.999759 | 3.665304 |
8af0de46-8bbe-498a-80a1-2715d5cde48e | GregWagner/Udemy-DSA-Courses | Coding-Minutes/Data_Structures_and_Algorithms_Level_Up/Section_18_Dynamic_Programming_2D/count_subsequence.cpp | /*
* Given 2 strrings, find the number of times the second string
* occurs as a subsequence inn the first string.
* s1 = "ABCDCE"
* s1 = "ABC"
* output 2
*/
#include <iostream>
#include <vector>
// recursive solution
int countSub(const std::string &a, const std::string &b, int m, int n) {
if ((m == -1 && n =... | ALGO | 0.999813 | 6.441617 |
7161b918-0dae-4979-aa29-b03e08102a42 | abdullah624/Algo-Design-and-Analysis | Lab1/Task3.cpp | #include<bits/stdc++.h>
using namespace std;
int Multi(int K){
double a = 0.64;
int m = 100010, r;
r = floor(m*(K*a-floor(K*a)));
return r;
}
int main()
{
int k;
cin>>k;
cout<<Multi(k)<<endl;
} | ALGO | 0.999516 | 3.047706 |
a917cea1-d344-4f93-8eef-4bb2030c4f03 | suzushi-tw/c-practice | detect cycle.cpp | #include<stdio.h>
#include<stdlib.h>
struct node{
int num;
struct node *next=NULL;
};
typedef struct node node;
void print_linked_list(node *root_node){
node* iternode = root_node;
while(iternode != NULL){
printf("%d ", iternode->num);
iternode = iternode->next;
}
}
int detectcycle(node *root_node){
node... | ALGO | 0.999932 | 3.012281 |
7136eebb-19a3-4cdc-a720-d47d42e1da50 | Kamrul101/cpp_practice | contest/181 edu/2.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl "\n"
#define MOD 1000000007
#define mem(a,b) memset(a, b, sizeof(a) )
// const int mx =2e5+123;
// int a[mx];
int main() {
optimize();
... | ALGO | 0.999918 | 4.064405 |
d7be9676-b8a2-46cc-b6eb-9861a90c1a04 | LuJianBuPing/LeetCode | LeetCode/P125.cpp | #include "LeetCode.h"
class Solution {
public:
bool isPalindrome(string s) {
bool result = true;
for (int i = 0, j = s.length() - 1; i < j;++i,--j)
{
while (i < s.length() && !isalnum(s[i])) ++i;
while (j >= 0 && !isalnum(s[j])) --j;
if (j >= 0 && i < s.length())
{
if (tolower(s[i]) != tolow... | ALGO | 0.99805 | 5.9303 |
f034654e-1c96-4283-ad11-a5e1cf8e5650 | anshulgupta48/Rohit-Negi-DSA-Sheet | solutions/2. String/57. Longest-Distinct-Characters-in-a-String.cpp | // ******** Given a string S, find the length of the longest substring with all distinct characters ********
// <======== Example ========>
// Input: S = "geeksforgeeks"
// Output: 7
// Input: S = "aaa"
// Output: 1
// Expected Time Complexity ==> O(|S|).
// Expected Auxiliary Space ==> O(K), where K is Constant.
i... | ALGO | 0.984565 | 3.934793 |
f2998e01-0370-41f7-b45a-e79cb26fd0ba | chinhan1405/DSAAsm | Lab1/ArrayList.cpp | #include <iostream>
using namespace std;
template <class T>
class ArrayList {
protected:
T* data; // dynamic array to store the list's items
int capacity; // size of the dynamic array
int count; // number of items stored in the array
public:
ArrayList(){capacity = 5; count = 0; data = new... | TOOL | 0.960675 | 4.609262 |
7be689af-4082-4712-bc84-2e17d7e92bea | miiitomi/atcoder | mayocon/20231005/5.cpp | // https://atcoder.jp/contests/abc306/tasks/abc306_e
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int N, K, Q;
cin >> N >> K >> Q;
multiset<ll> U, L;
for (int k = 0; k < K; k++) U.insert(0);
for (int k = 0; k < N-K; k++) L.insert(0);
ll tmp = 0;
vector<l... | ALGO | 0.999778 | 4.012369 |
44662ccc-fe1a-4ebd-a6f9-2cd02129b832 | ishandutta2007/codeforces | koosha_mv/normal/41/D.cpp | #include <bits/stdc++.h>
#include<algorithm>
using namespace std;
#define f(i,a,b) for(ll i=a;i<b;i++)
#define f_(i,a,b) for(ll i=a;i>=b;i--)
#define ll long long
#define pb push_back
const int N=103,e=1e6;
ll dp[N][N][11],n,m,k,mx=-1,an;
string a[N],s;
int dfs(int x,int y,int mod){
if(x==1){cout<<y+1<<endl;return 0;}... | ALGO | 0.999954 | 3.191927 |
92618e61-26dd-47b8-b37a-6eb28814d27d | Theodore9696/Command_and_Conquer_Generals | Generals/Code/Tools/mangler/wlib/sem4.cpp | /******************************************************************************\
sem4.cpp Neal Kettler
Simple Posix semaphore class
This is useful because the constructor will automatically call sem_init
and you don't have to worry about it. It also allows for other semaphore
libraries if y... | TOOL | 0.939436 | 5.776085 |
99f7d7e2-ec56-4fb6-a6b5-fead8b20c1d2 | Batishavo/Competitive-programing | 2024/05-mayo/01/70. Climbing Stairs.cpp | class Solution {
private:
int memo[50];
public:
int climbStairs(int n) {
if(n == 1){
return 1;
}
if(n == 2){
return 2;
}
if(n<=0){
return 0;
}
if( memo[n] == 0){
if( memo[n-1]==0 ){
memo... | ALGO | 0.999962 | 5.807092 |
9f5ca7b2-c0f2-4f92-b2b2-69e5a8091fe9 | hustwcw/CPPStandardLibraryExample | algo/bsearch1.cpp | #include "algostuff.hpp"
using namespace std;
int main()
{
list<int> coll;
INSERT_ELEMENTS(coll,1,9);
PRINT_ELEMENTS(coll);
// check existence of element with value 5
if (binary_search(coll.begin(), coll.end(), 5)) {
cout << "5 is present" << endl;
}
else {
cout << "5 is n... | ALGO | 0.997987 | 5.049217 |
f97cf5eb-8cdb-40b7-8e12-ca11621bf799 | kalam714/beecrowd-solution | 1012.cpp | #include <cstdio>
#include <cmath>
int main()
{
double a;
double b;
double c;
scanf("%lf", &a);
scanf("%lf", &b);
scanf("%lf", &c);
printf("TRIANGULO: %.3lf\n", .5*a*c);
printf("CIRCULO: %.3lf\n", 3.14159*pow(c, 2));
printf("TRAPEZIO: %.3lf\n", ((a+b)/2)*c);
printf("QUADRADO: %.3lf\n", pow(b,2));
printf("... | ALGO | 0.994478 | 3.191553 |
2fb72b90-85cf-4624-b93f-b72eec4cd0e6 | amrit-paudel/Learning-CPP | basic c++ programs/reversing any number.cpp | //PASSING AN ARRAY TO A function
// WE WILL ALSO SEE HOW ARRAY AND POINTERS ARE VERY CLOSLY CONNECTED
// WE CAN ACCESS WHOLE ARRAY IF WE KNOW THE BASE ADDRESS OF AN ARRAY BY POINTER ARITHMATIC.
// Arrays always consumes the memory in increased well manared order.
#include<iostream>
using namespace std;
int sum(int *p... | ALGO | 0.995984 | 3.873252 |
7e257d94-07ed-4a42-97b0-5b72ff299dc0 | mr2rm/solutions | legacy/UVa/11876.cpp | #include <iostream>
#include <cmath>
using namespace std;
int dp[1000000];
int t, sq, x, I, n, cnt, a, b, p, q;
int BST (int l, int h, int val)
{
if (l == h)
return l;
int mid = (l + h) / 2;
if (dp[mid] == val)
return mid;
else if (val < dp[mid])
return BST (l, mid-1, val);
else
return BST (mid+1, h, va... | ALGO | 0.999769 | 4.072208 |
2c181d02-743d-4e85-ab60-86bddb115baf | Ahsanulhoq/HackerRank | Plus Minus.cpp | #include <bits/stdc++.h>
using namespace std;
vector<string> split_string(string);
// Complete the plusMinus function below.
void plusMinus(vector<int> arr) {
double p=0,n=0,l=0;
for(int i=0;i<arr.size();i++)
{
if(arr[i]>0)
{
p++;
}
else if(arr[i]<0)
{
... | ALGO | 0.999666 | 4.518525 |
53e13427-1a30-4d9f-93a8-3dcb2230f93c | ishandutta2007/codeforces | shubham__36/normal/1075/C.cpp | #include <bits/stdc++.h>
#include <set>
#include <list>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> p32;
typedef pair<ll,ll> p64;
typedef p... | ALGO | 0.999908 | 3.547667 |
ac4369b1-f3de-4581-a74b-d272da6be0cd | sahmad11/ParallelDistributedComputing | Assignment 3/page_rank_parallel.cpp | #include "core/graph.h"
#include "core/utils.h"
#include <iomanip>
#include <iostream>
#include <stdlib.h>
#include <thread>
#include <stdexcept>
#include <atomic>
#define DEFAULT_STRATEGY "1"
#ifdef USE_INT
#define INIT_PAGE_RANK 100000
#define EPSILON 1000
#define PAGE_RANK(x) (15000 + (5 * x) / 6)
#define CHANGE_I... | ALGO | 0.999762 | 4.581806 |
9fc1f097-6d44-4592-bac4-4e5e682eb382 | robertwyb/Computer-graphic-assignments | computer-graphics-meshes/shared/eigen/doc/examples/Tutorial_ArrayClass_mult.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace Eigen;
using namespace std;
int main()
{
ArrayXXf a(2,2);
ArrayXXf b(2,2);
a << 1,2,
3,4;
b << 5,6,
7,8;
cout << "a * b = " << endl << a * b << endl;
}
| ALGO | 0.994673 | 3.527115 |
f7db4bfb-9053-4e43-8a1f-c3a5a638c394 | agiacobbi/CPSC223 | DICTIONARYCHAINING/stack.cpp | // stack.cpp
// Abstract Data Type Stack:
// data object is a stack where the most-recently-added (or top) item
// is most-easily accessible
// operations on a stack:
// create an empty stack
// delete memory or "destroy" the stack
// add a new item as the most-recently-added ... | TOOL | 0.956358 | 6.157861 |
c102bc86-b3bc-41e3-80c4-dc38ee756071 | louisrli/project-euler | src/euler/archives/pe23.cpp | /* A perfect number is a number for which the sum of its proper divisors is exactly equal to the number. For example, the sum of the proper divisors of 28 would be 1 + 2 + 4 + 7 + 14 = 28, which means that 28 is a perfect number.
A number n is called deficient if the sum of its proper divisors is less than n and it is... | ALGO | 0.999888 | 5.061399 |
16d768fb-2406-4419-bc21-59af54ac5867 | pdharmas/Fairy-Stockfish | src/thread.cpp | #include <cassert>
#include <algorithm> // For std::count
#include "movegen.h"
#include "partner.h"
#include "search.h"
#include "thread.h"
#include "uci.h"
#include "syzygy/tbprobe.h"
#include "tt.h"
#include "xboard.h"
namespace Stockfish {
ThreadPool Threads; // Global object
/// Thread constructor launches the ... | ALGO | 0.993681 | 6.492033 |
af45113c-cda5-4c3e-9e12-6f0eb1824e4d | Wtecandy/ge | src/util/bip32.cpp | #include <sstream>
#include <stdio.h>
#include <tinyformat.h>
#include <util/bip32.h>
#include <util/strencodings.h>
bool ParseHDKeypath(const std::string& keypath_str, std::vector<uint32_t>& keypath)
{
std::stringstream ss(keypath_str);
std::string item;
bool first = true;
while (std::getline(ss, item... | TOOL | 0.912652 | 6.036141 |
198de837-1254-403a-9e13-aa4a8094b357 | woobba94/algorithm | Project_codingTest/0095_2920.cpp | //#include <iostream>
//using namespace std;
//
//int arr[8] = {};
//bool isAscending();
//bool isDescending();
//
//int main()
//{
// for (int i = 0; i < 8; i++)
// {
// cin >> arr[i];
// }
//
// if (isAscending()) cout << "ascending";
// else if (isDescending()) cout << "descending";
// else cout << "mixed";
//}
//
... | ALGO | 0.999715 | 3.81023 |
71277629-7144-425d-b0f7-6fb77a8c28fc | marjanhasan/Basic-CPP | can_you_do_it.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin >> n;
if (n <= 0)
{
for (int i = n; i < 2; i++)
{
cout << i << " ";
}
cout << endl;
}
else
{
for (int i = 1; i <= n; i++)
{
cout << i << " ";
... | ALGO | 0.999555 | 3.613574 |
ed5ddc4b-4797-4b8c-98dd-bca8bbaa8270 | ArunabhPrakash/DSA_Codes_AP | my solutions/3.string/compressstring.cpp | #include<iostream>
#include<string>
using namespace std;
string compressString(string str){
int n = str.length();
string output;
for(int i=0;i<n; i++){
int count = 1;
while(i< n-1 and str[i+1] == str[i]){//redundant, could have done in o(n), just check if same as next then count++,when dif just concat
c... | ALGO | 0.99999 | 4.741508 |
3c4d06e6-5e3e-44c7-99f5-b45ebaa03b6e | linouk23/leetcode | 647.cpp | // 647. Palindromic Substrings - https://leetcode.com/problems/palindromic-substrings
#include "bits/stdc++.h"
#include "gtest/gtest.h"
using namespace std;
class Solution {
private:
vector<deque<bool>> dp;
void run_is_palindrome_dp(const string &s) {
int n = (int)s.length();
dp.resize(n, deq... | ALGO | 0.999577 | 6.882 |
d3c203f0-e693-440a-bc1c-f37d4e419ef3 | actium/codeforces | 1100/30/1132a.cpp | #include <iostream>
void answer(unsigned v)
{
std::cout << v << '\n';
}
void solve(unsigned c1, unsigned c3, unsigned c4)
{
if (c1 != c4)
return answer(false);
answer(c3 == 0 || c1 > 0);
}
int main()
{
unsigned c1, c2, c3, c4;
std::cin >> c1 >> c2 >> c3 >> c4;
solve(c1, c3, c4);
... | ALGO | 0.999517 | 4.403579 |
9ad55a64-44e3-452a-9686-e20b657206ab | fuwutu/CodeForces | 333A - Secrets.cpp | //4188836 Jul 27, 2013 4:31:25 PM fuwutu 333A - Secrets GNU C++0x Accepted 30 ms 0 KB
#include <iostream>
using namespace std;
int main()
{
long long n;
cin >> n;
while (n % 3 == 0)
{
n /= 3;
}
cout << n / 3 + 1 << endl;
return 0;
}
| ALGO | 0.999852 | 3.830521 |
68349819-b73d-4575-90fa-7a1bd0149c70 | debojyoti-majumder/CompCoding | yearEnd2018/intToRoman.cpp | // Problem URL: https://leetcode.com/problems/integer-to-roman/description/
#include <iostream>
#include <vector>
using namespace std;
class Solution {
private:
vector<string> _indexedStrings;
public:
Solution() {
_indexedStrings.push_back("I");
_indexedStrings.push_back("V");
... | ALGO | 0.998641 | 6.699678 |
21b30f7b-8e4a-4591-9ecd-e2765b51ed14 | daffaajhh/simulasiburungboro | Daffa irdina ahamd PKDB.cpp | #include <bits/stdc++.h>
using namespace std;
// tinggimax=v^2*sin^2s/20
int main()
{
cout << "Prediksi Ketinggian Dicapai Boro\n";
cout << "================================\n";
float s, v, t;
int status = 0;
cout << "Masukkan sudut penerbangan burung : ";
cin >> s;
cout << endl;
cout <... | ALGO | 0.998396 | 4.495903 |
fd5e4a5b-d08c-4089-92d9-791108d2476a | folkertvanheusden/nothello | board.cpp | #include <cassert>
#include <cstring>
#include <cstdio>
#include <optional>
#include "board.h"
#include "str.h"
board::board(const bool set_initial)
{
memset(disks, 0x00, sizeof disks);
if (set_initial)
set_fen("8/8/8/3ox3/3xo3/8/8/8");
}
board::board(const std::string & fen)
{
memset(disks, 0x00, sizeof disks)... | ALGO | 0.983842 | 6.065457 |
c719c170-601e-4e39-a265-db3f711441e6 | sofdev-ms/Codeforces | #585-div2/C.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
ll t;
t = 1;
//cin >> t;
while(t--)
{
ll n;
cin >> n;
string a;
string b;
cin >> a >> b;
ll na = 0;
ll nb = 0;
vector < int > inda;
vector < in... | ALGO | 0.999833 | 3.425652 |
8a094a4a-e3ba-411e-9bf9-72203e5d7692 | ishandutta2007/codeforces | andrew/normal/1195/A.cpp | #include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("-O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#define fi first
#define se second
#define p_b push_back
#define pll pair<ll,ll>
#define m_p make_pair
#define all(x) x.... | ALGO | 0.999971 | 4.303069 |
d22614d5-2891-447d-b7b8-a22b91f6dcb4 | Mwako/deps | boost/libs/graph/example/mcgregor_subgraphs_example.cpp | #include <fstream>
#include <iostream>
#include <string>
#include <boost/lexical_cast.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/filtered_graph.hpp>
#include <boost/graph/graph_utility.hpp>
#include <boost/graph/iteration_macros.hpp>
#include <boost/graph/mcgregor_common_subgraphs.hpp>
#inclu... | ALGO | 0.990444 | 6.218061 |
62d4541d-717f-45a6-aeff-06708aa872a8 | Shaykat/UVA | 686 Goldbach's Conjecture (II).cpp | #include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
using namespace std;
const int a=32800;
int array[a];
int main()
{
int i,j,sn=0;
array[0] =1;
sn = sqrt((double)a);
for(i=3;i<=sn;i+=2)
{
if(array[i] == 0)
{
for(j= i*i;j<a;j+=2*i)
{
... | ALGO | 0.999886 | 3.314685 |
c3faafc9-071f-46d6-b39c-b8415bd6a14b | DASE-iDDS/FDBKeeper | src/Storages/examples/merge_selector.cpp | #include <iostream>
#include <IO/ReadBufferFromFileDescriptor.h>
#include <IO/ReadHelpers.h>
#include <Storages/MergeTree/SimpleMergeSelector.h>
/** This program tests merge-selecting algorithm.
* Usage:
* ./merge_selector <<< "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20"
* clickhouse-client --query="SELE... | ALGO | 0.972853 | 3.900143 |
21ff0be8-2136-4659-97cc-500724c89028 | xinfeng1i/AlgorithmSolution | ProjectEuler/1_50/Problem#41.cpp | #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <array>
#include <ctime>
#include <cmath>
using namespace std;
bool isPrime(long n);
long largestPandigitalPrime(int nDigit);
bool isPandigital(long n);
int main()
{
clock_t time_begin = clock();
#if 0 // Method 1
const ... | ALGO | 0.998613 | 5.880317 |
4dc5fd36-da8a-480e-adea-d4448de06a0a | TemelGunaydin/UdemyC-Course | Section11/FunctionParamters/main.cpp | // Section 11
// Function Parmameters
#include <iostream>
#include <string>
#include <vector>
using namespace std;
void pass_by_value1(int num);
void pass_by_value2(string s);
void pass_by_value3(vector<string> v);
void print_vector(vector<string> v);
void pass_by_value1(int num) {
num = 1000;
}
void pass_by_va... | TOOL | 0.990537 | 4.720795 |
3d614aff-fdc9-4e05-b170-1b04362a0b16 | sulmone/boost_1_53_0 | libs/graph/example/boost_web_graph.cpp | template <class Distance>
class calc_distance_visitor : public boost::bfs_visitor<>
{
public:
calc_distance_visitor(Distance d) : distance(d) { }
template <class Graph>
void tree_edge(typename boost::graph_traits<Graph>::edge_descriptor e,
Graph& g)
{
typename boost::graph_traits<Graph>::v... | ALGO | 0.999716 | 4.907742 |
70865fc3-1199-4abd-9fb4-239854aa124d | sid-rh/MyLeetcode | 118.Pascal-Triangle/PascalTriangle.cpp | #include<iostream>
#include<bits/stdc++.h>
using namespace std;
vector<vector<int>> generate(int numRows) {
vector<vector<int>> ans(numRows);
for(int i=0;i<numRows;i++)
{
ans[i].resize(i+1);
ans[i][0]=1;
ans[i][i]=1;
for(int j=1;j<i;... | ALGO | 0.999932 | 4.367344 |
17f21fb6-6a96-4d87-b541-b6aac16f537c | alanmusabek/Algorithms-and-Data-Structures | ICPC_otbor/4.cpp | #include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
int n;
cin >> n;
long long x;
cin >> x;
vector<long long> v(n);
for (int i = 0; i < n; i++)
{
long long in;
cin >> in;
v.at(i) = in;
}
int a... | ALGO | 0.999918 | 3.560166 |
863a9d3e-6b4a-424f-b05a-227af8981810 | shubhrajyotidey305/Leetcode | Minimum increment/decrement to make array non-Increasing - GFG/minimum-incrementdecrement-to-make-array-non-increasing.cpp | // { Driver Code Starts
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution{
public:
int minOperations(int *a,int n)
{
int cnt = 0;
priority_queue<int, vector<int>, greater<int>> pq;
for(int i=0; i<n; i++){
if(!pq.empty()... | ALGO | 0.999878 | 5.61643 |
5c70dd9e-86ab-4a93-a665-ef743a9e4dc6 | PhicoinProject/Phicoin-Miningcore-V2 | src/Native/libcryptonight/xmrig/base/crypto/sha3.cpp | /* -------------------------------------------------------------------------
* Works when compiled for either 32-bit or 64-bit targets, optimized for
* 64 bit.
*
* Canonical implementation of Init/Update/Finalize for SHA-3 byte input.
*
* SHA3-256, SHA3-384, SHA-512 are implemented. SHA-224 can easily be added.
... | ALGO | 0.9646 | 7.675233 |
f066c10b-ae17-4893-a284-1fd51b3452b5 | muiruat/ProblemSolving | 0x03 배열/알파벳 개수/my-solution.cpp | #include <iostream>
using namespace std;
int a[26];
int main(void)
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
string s;
cin >> s;
for (int i = 0; i < s.length(); i++)
a[s[i] - 'a']++;
for (int i = 0; i < 26; i++)
cout << a[i] << ' ';
return 0;
} | ALGO | 0.999916 | 4.306747 |
9eb6e0f8-07df-423c-b243-5e62a1a1c137 | rifatr/Competitive-Programming | Old_items/Vjudge/Hashing/M.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1e9 + 123, base = 1e9 + 7;
ll power(ll n, ll x)
{
if (x == 0)
return 1;
ll p = 1LL;
while (x--)
p = (p * n) % mod;
return p;
}
ll Hash(string s)
{
ll n = (ll) s.size(), x = 0LL;
for (ll i = 0; i < n; i++)
x = ((x * ba... | ALGO | 0.999993 | 5.228836 |
bed00065-611d-4e52-98fb-621cebdda06b | Raunak-Kumar7/Leetcode_DSA | BitManipulation/2568ImpossibleOR.cpp | //Some Observations:
//1. When we take OR of 2 --> O/P will always be greater than the larger of the 2 elements --> a|b >=max(a,b)
//2. So, If an element is not present in array it has to be formed by elements lesser than itself
//3. Hence if 1 is not present in array it can never be formed --> Ans = 1... | ALGO | 0.999883 | 5.684083 |
5ade4daa-0e94-48d9-8b17-46d5fc48394a | qtcyy/LeetCode-Record-3.17 | 数据结构/chapter7/7.2/No1722/main.cpp | #include <iostream>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
class Solution {
private:
vector<int> f;
int find(int x) {
if (f[x] == x)
return x;
return f[x] = find(f[x]);
}
void merge(int x, int y) {
x = find(x);
y = fin... | ALGO | 0.999945 | 5.820967 |
4894f7f4-4500-4907-970e-49179b328042 | suanhaitech/cppstudy2023 | July-C++/32.cpp | // 结构作为参数
#include <iostream>
#include <cstring>
using namespace std;
void printBook( struct Books book );
// 声明一个结构体类型 Books
struct Books
{
char title[50];
char author[50];
char subject[100];
int book_id;
};
int main()
{
Books Book1; // 定义结构体类型
Books Book2; // 定义结构体类型 Books 的变量
// Book1 详述
s... | TOOL | 0.984961 | 4.179087 |
30d471fa-a661-4e44-8f6e-efb6e325d631 | ishandutta2007/codeforces | krk/normal/1272/D.cpp | #include <bits/stdc++.h>
using namespace std;
const int Maxn = 200005;
int n;
int a[Maxn];
int L[Maxn], R[Maxn];
int res;
int main()
{
scanf("%d", &n);
for (int i = 1; i <= n; i++) {
scanf("%d", &a[i]);
L[i] = 1;
if (i && a[i - 1] < a[i]) L[i] += L[i - 1];
res = max(res, L[i])... | ALGO | 0.999953 | 4.216159 |
4d71b11f-0d9c-4a05-95a9-ab7f70a9d1ea | VinayakJamadar/PICT | TE/SEM 6/LP2/AI/AStarAlgorithm/aStarAlgorithm.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, e, u, v, w;
cin >> n >> e;
vector<pair<int, int>> graph[n];
for (int i = 0; i < e; i++) {
cout << "Enter Edge as source, destination and weight" << endl;
cin >> u >> v >> w;
graph[u].push_back({v, w});
gr... | ALGO | 0.999998 | 4.147413 |
2967e62b-fed0-402e-85e6-922e0eadd768 | hthuwal/competitive-programming | old/interview_bit/maximum-sum-triplet.cpp | /**
* https://www.interviewbit.com/problems/maximum-sum-triplet/
* Solution: https://www.geeksforgeeks.org/find-maximum-sum-triplets-array-j-k-ai-aj-ak/
**/
#include<bits/stdc++.h>
using namespace std;
int getLargestNumberSmallerThan(set<int> &numbersToTheLeft, int key) {
// Number just greater than or equal to... | ALGO | 0.999948 | 4.671101 |
607f8b69-fb13-4c6b-a847-1d6e7cbb1a9e | utkarshmaken/cp | codeforces div2/652/D.cpp | #include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
#define f(i,a,b) for(int i = a;i<b;i++)
#define rep(i,a,b) for(int i = a;i<=b;i++)
#define fd(i,a,b) for(int i = a;i>b;i--)
#define repd(i,a,b) for(int i = a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define fi first
#define se ... | ALGO | 0.999903 | 3.975274 |
0c1ac4cd-952b-4ae9-be7a-1822da1115a7 | iamcalledned/platform_frameworks_base_pre404 | media/libstagefright/codecs/amrnb/common/src/weight_a.cpp | /*
Pathname: ./audio/gsm-amr/c/src/weight_a.c
------------------------------------------------------------------------------
REVISION HISTORY
Description: Put file into template and first pass at optimization.
Description: Made changes based on comments from the review meeting. Used
pointers instead of inde... | ALGO | 0.999577 | 6.017359 |
63a25f1e-2716-47c3-a55b-16fb71c1444a | Eduardo-Barreto/bilu | src/astar.cpp | #include "bilu/astar.hpp"
#include <algorithm>
#include <cstdint>
#include <iostream>
#include <queue>
#include <unordered_map>
#include <array>
namespace bilu {
AStar::AStar(Grid &grid) : grid(grid) {}
std::vector<Node> AStar::findPath(const Node& start, const Node& end) {
auto cmp = [](Node* left, Node* right... | ALGO | 0.99992 | 5.777369 |
eb0cda5a-324b-48f9-b3e6-ec8897f6297b | jigyansunanda/Leetcode-Practice | 0508-most-frequent-subtree-sum/0508-most-frequent-subtree-sum.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.999995 | 6.162876 |
e0c3834c-13c9-4fca-8d16-7b7477f5332c | Riturajsingh22/gitdemo | vowel.cpp | #include <iostream>
using namespace std;
int main() {
char ch;
cout << "Enter a character: ";
cin >> ch;
// Check if input is an alphabet
if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z')) {
// Convert to lowercase for simplicity
char lowerCh = tolower(ch);
// Check... | ALGO | 0.989782 | 6.810275 |
70635e33-ce98-4e2d-b5a3-c203e94d9196 | krozv/codetree-TILs | 240621/남녀노소 구분짓기/sex-and-age.cpp | #include <iostream>
using namespace std;
int main() {
int sex, age;
cin >> sex >> age;
if (sex == 0){
if (age >= 19){
cout << "MAN";
}
else {
cout << "BOY";
}
}
else {
if (age >= 19){
cout << "WOMAN";
}
else ... | ALGO | 0.99467 | 3.771163 |
76d9dc02-ade3-4acc-b383-29aefc08d3b2 | can378/AlgorithmStudy | AlgorithmBJ/bj30804_2.cpp | #include <iostream>
#include <vector>
#include <map>
using namespace std;
int main() {
//INPUT
int N; cin >> N;
vector<int>fruits(N,0);
for (int i = 0; i < N; i++) {
cin >> fruits[i];
}
//CHECK
int left = 0;
map<int, int>dic;
int maxLeng = 0;
for (int right = 0; right < N; right++) {
dic[fruits[right]]... | ALGO | 0.999976 | 4.720049 |
597756cc-47ee-47f4-a639-5917fb4f30d7 | ayushmaan703/Right-one | C++/Recursion/recursionOnArray-Strings/maxElementOfArray/meoa.cpp | #include <iostream>
#include <cmath>
using namespace std;
int maxNum(int *arr, int idx, int n)
{
int maxVal=-1;
if (idx == n - 1)
return arr[idx];
return max(arr[idx],maxNum(arr, idx + 1, n));
}
int main()
{
int arr[5] = {5, 9, 4, 8, 3};
cout<< maxNum(arr, 0, 5);
return 0;
} | ALGO | 0.999882 | 4.441749 |
215444e0-a0bd-4097-8892-2dbabbe73c42 | SurajTopal/Algorithm-Course-Program | 15. Stack/StackUsingLinkedList.cpp | #include <stdio.h>
#include <iostream>
#include<stdlib.h>
using namespace std;
struct stack
{
int data;
struct stack *next;
};
struct stack *top = NULL;
void push (int no)
{
struct stack *temp = new stack ();
temp->data = no;
temp->next = NULL;
if (top == NULL)
{
top = temp;
}
else
{... | ALGO | 0.998606 | 4.179992 |
3d7ba6ca-25a1-42e5-a17e-65a7c1b711dc | Ayan564/Data_Structure_Course | 11. Sorting/mergeSort.cpp | #include <stdio.h>
#include <stdlib.h>
void merge(int A[], int l, int mid, int h)
{
int i = l, j = mid + 1, k = l;
int B[100];
while (i <= mid && j <= h)
{
if (A[i] < A[j])
B[k++] = A[i++];
else
B[k++] = A[j++];
}
for (; i <= mid; i++)
B[k++] = A[... | ALGO | 0.999987 | 4.839509 |
510cfcf3-3fed-4430-b05d-3f0d0c440c63 | phillima-classroom/C103 | Aula-04-Bubble/bubbleSortAluno.cpp | #include <iostream>
//Exercicio para ordenar com bubble Sort um array de struct de Aluno, pela matricula
using namespace std;
struct Aluno{
int mat;
int npa;
};
//Funcao de ordenação "por bolha" (Bubble Sort)
void bubbleSort(Aluno *V, int N){
Aluno aux;
int fim = N;
bool continua = false;
do
... | ALGO | 0.997822 | 4.957627 |
b78fc9c4-c3b8-47fe-93bd-d797ef37f96c | Andwerpz/Competitive-Programming-Practice | - cpp -/nonacademicproblem.cpp | #include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
// typedef __int128 lll;
// typedef __float128 lld;
using namespace std;
//Codeforces - 1986F
//it's pretty obvious that we want to remove a bridge, as if we didn't remove a bridge, nothing would happen.
//note that when we do remove some bridge,... | ALGO | 0.999916 | 5.772564 |
1932ca1f-77a9-433c-a11c-62d41789345b | ishandutta2007/codeforces | karry5307/normal/1084/C.cpp | #include<bits/stdc++.h>
using namespace std;
typedef int ll;
typedef long long int li;
const ll MAXN=2e5+51,MOD=1e9+7;
ll n,syk,ccc;
char ch[MAXN];
inline ll read()
{
register ll num=0,neg=1;
register char ch=getchar();
while(!isdigit(ch)&&ch!='-')
{
ch=getchar();
}
if(ch=='-')
{
... | ALGO | 0.999864 | 3.708814 |
8de31a7a-486f-4772-9740-7f347b0cc57b | takahiro-kubota/AtCoder_CPP | mylib/grid.cpp | void rot90_clkwise(vector<string>& a){ // must be recutanglar
ll h = a.size(), w = a[0].size();
vector<string> b(w, string(h, '-'));
rep(i, w) rep(j, h) b.at(i).at(j) = a[h-1-j][i];
a = b;
} | ALGO | 0.999504 | 4.181716 |
e375d841-17f5-417e-8fc6-355407e573f0 | dhirajpatra/arduino_iot | libraries/Arduino_ESP32_OTA/src/decompress/utility.cpp | /**************************************************************************************
INCLUDE
**************************************************************************************/
#include "utility.h"
/**************************************************************************************
CONST
***********... | TOOL | 0.994884 | 5.404902 |
9847d21e-3659-49d2-9423-30144310898f | PaukIsUha/optimizing_formating_code | predictions/submissions-aizu-coop-gpt35/Codenet/p00776/563216952/response_3.cpp | The given code generates all possible permutations of a string and prints them in lexicographically sorted order. However, there are several areas of the code that can be optimized.
1. Avoiding unnecessary memory usage:
- The `vector<string> vs` is used to store all the permutations. However, there is no need to st... | ALGO | 0.999922 | 7.721731 |
16e4364b-9c15-48e9-8b1f-1659cf17ffa0 | pingjuiliao/softbound | llvm-project-13.0.0.src/libcxx/test/std/algorithms/alg.sorting/alg.min.max/min_init_list.pass.cpp | // UNSUPPORTED: c++03
// <algorithm>
// template<class T>
// T
// min(initializer_list<T> t);
#include <algorithm>
#include <cassert>
#include "test_macros.h"
int main(int, char**)
{
int i = std::min({2, 3, 1});
assert(i == 1);
i = std::min({2, 1, 3});
assert(i == 1);
i = std::min({3, 1, 2}... | TEST | 0.994588 | 4.9407 |
8ab6b64b-0147-473d-aa5e-f0257a9db64f | mahendra150/dsa_with_example | 1664-ways-to-make-a-fair-array/1664-ways-to-make-a-fair-array.cpp | class Solution {
public:
int waysToMakeFair(vector<int>& nums) {
int n= nums.size();
int prefixEven=0;
int prefixOdd=0;
int suffixEven=0;
int suffixOdd=0;
for(int i=0;i<n;i++){
if(i&1)prefixOdd+= nums[i];
else pre... | ALGO | 0.999885 | 5.85329 |
82379378-ba35-4f10-b5d2-69339f666854 | KaloyanYonov/SDA | Tests/Test5/Анаграма на изречение/solution.cpp | #include <iostream>
#include <map>
#include <string>
bool canFormSentence(std::map<std::string, int> &firstSentenceWords, std::map<std::string, int> &secondSentenceWords) {
for (auto &word : secondSentenceWords) {
if (firstSentenceWords[word.first] < word.second) {
return false;
}
}... | ALGO | 0.999947 | 5.926373 |
acb49704-dec0-41f9-8aab-676732192b42 | zriyansh/yet-another-dsa-prep-repo | magic_stick.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int t, x, y;
cin >> t;
for (int i = 0; i < t; i++)
{
cin >> x >> y;
if((x==2 || x ==3) && y <4 ) cout <<"YES\n";
else if(x > 3) cout <<"YES\n";
else if(x==1 && y ==1 ) cout <<"YES\n";
else cout<<"NO\n";
... | ALGO | 0.998937 | 3.9283 |
65f6a1fa-4875-4ad9-be45-7510c898347f | fashioncrazy9/BeginningVisualCplusplus2010 | Ex3_02/Ex3_02.cpp | #include <iostream>
using std::cin;
using std::cout;
using std::endl;
int main(void){
long number(0L);
cout << endl << "Enter an integer number less than 2 billion: ";
cin >> number;
// number % 2L -> if its 0 it means false, if it's non-zero it means true
// its equivalent to number % 2L != 0
if(number % 2L){... | ALGO | 0.998479 | 3.783307 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.