uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
6ce47090-f49c-42df-953b-122e1b866ab4 | suryamajhi/ITMODataStructure | SegmentTree/SegmentTreeSum.cpp | #include<bits/stdc++.h>
using namespace std;
const int N = 0;
struct segtree {
int size;
vector<long long> sums;
void init(int n) {
size = 1;
while(size < n) size *= 2;
sums.assign(2 * size, 0LL);
}
void build(vector<int> &a, int x, int lx, int rx) {
if (rx - lx == 1) {
if (lx < (int)a.size()) {... | ALGO | 0.999905 | 4.805081 |
12dead9c-17ce-4894-b396-279f4418b1a2 | ishandutta2007/codeforces | hs-black/normal/617/E.cpp | #include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <cmath>
using namespace std;
const int N = 500050;
int bl;
struct node {
int l, r, num;
bool operator < (const node &i) const {
int lb = (l - 1) / bl, rb = (i.l - 1) / bl;
if (lb != rb) return lb < rb;
... | ALGO | 0.999993 | 3.828569 |
68a098e9-d660-427d-a1ce-cda8bdc7789a | aahadraza/BSCS-POF-2021 | LAB 4-3.cpp | #include<iostream>
using namespace std;
int main()
{
int num=57;
num++;
cout<<"post increment by 1 the number is:"<<num<<endl;
++num;
cout<<"pre increment by 1 the number is:"<<num<<endl;
num=num+1;
cout<<"after increasing by 1 the number is:"<<num<<endl;
num--;
cout<<"post decrement by 1 the number is:"<<nu... | ALGO | 0.99474 | 3.018928 |
0ce9771d-91b0-4dc4-9b87-6c1947e2fc45 | rainliu/leetcode | src/191NumberOf1Bits/191NumberOf1Bits.cpp | class Solution {
uint8_t LUT[256];
public:
Solution(){
for(int i=0; i<256; ++i){
int c = 0;
for(int j=0; j<8; ++j){
c += (i>>j)&0x1;
}
LUT[i]=c;
}
}
int hammingWeight(uint32_t n) {
uint8_t* p = (uint8_t*)&n;
... | ALGO | 0.997287 | 6.226771 |
d7ac33ad-a194-4f1b-a818-c042d5efc356 | alexandraback/datacollection | solutions_2463486_0/C++/sudarshans/Source.cpp | #include <cstdio>
#include <cmath>
#include <ciso646>
#include <iostream>
using namespace std;
void findbounds(int start, int end, int& lowerbound, int& upperbound){
lowerbound=floor(sqrt(start));
upperbound=ceil(sqrt(end));
}
int palindrome(int input){
int digits[15];
int i;
for(i=0; input>0; digits[i]=input%1... | ALGO | 0.998833 | 4.50701 |
bd3f4d2c-d903-4a98-97bc-5acea44a7734 | raincross7/code-similarity | codes/train_code/problem042/problem042_16.cpp | #include<iostream>
#include<vector>
#include<cstdlib>
template<typename T>
void fin(T const& t){ std::cout << t << std::endl; exit(0); }
int main() {
std::cin.tie(0); std::ios::sync_with_stdio(false);
int N, M; std::cin >> N >> M;
std::vector<std::vector<int>>G(N);
for(int i = 0; i < M; ++i) {
int a, b; st... | ALGO | 0.999845 | 4.713437 |
88ca3244-2e71-42a4-aa72-91cf8832aba8 | surepay123456/leetcode_train | src/leetcode/src/图论/1020飞地的数量.cpp | #include "header.h"
class Solution {
public:
int numEnclaves(vector<vector<int>> &grid) {
// DFS 写法
int m = grid.size(), n = grid[0].size();
vector<vector<bool>> visited =
vector<vector<bool>>(m, vector<bool>(n, false));
int result = 0;
for (int i = 0; i < m... | ALGO | 0.999854 | 5.902647 |
e075044a-53ed-496a-a15e-2018c6923e1c | Tauseefmalikk/.cpp | basics/fun3.cpp | #include <iostream>
using namespace std;
int add (int num1,int num2)
{
int sum=num1+num2;
return sum;
}
int main()
{
int x,y;
cout << "Enter the value of x" << endl;
cin >> x;
cout << "Enter the value of y" << endl;
cin >> y;
int ans=add(x,y);
cout << "The sum of" << x << "and" <<... | TOOL | 0.993684 | 4.53863 |
85c816a3-39a0-4048-9df9-399bbbf4b70c | rafliher/cambodiactftraining | rev/week10-playtogether/justsimpleencryption/chall.cpp | #include <iostream>
#include <string>
#include <bitset>
#include <cstdbool>
#include <vector>
#include <sstream>
using namespace std;
const int BLOCK_SIZE = 128;
const int BYTE_COUNT = BLOCK_SIZE / 8;
const int NIBBLE_SIZE = 4;
const int NIBBLE_COUNT = BLOCK_SIZE / NIBBLE_SIZE;
const int ROUND_NUMBER = 10;
bitse... | ALGO | 0.999892 | 5.072807 |
45feada3-8891-459a-bea6-0ab479c8832a | Zyp1e/algorithm_model | 图论/网络流/最大流.cpp | /*https://www.luogu.com.cn/problem/P3376*/
#include<bits/stdc++.h>
#define int long long
using namespace std;
#define endl '\n'
const int N=5e3+10;
int n,m,s,t;
int e[N*N],w[N*N],nex[N*N],h[N],idx=1;
int pre[N];
int mf[N];//s~v上的流量上限
void add(int a,int b,int c){
e[++idx]=b;
w[idx]=c;
nex[idx]=h[a];
h[a]... | ALGO | 0.999972 | 4.817415 |
4cf8aeee-bd3b-408f-8d88-e3e85ab1d35d | Shahraaz/Old_CPlusPlus | Compete2/adapawns.cpp | //Optimise
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define f first
#define s second
#define pb push_back
#define mp make_pair
const long long mod = 1000000007;
bool fun(ll n)
{
if (n & 1)
return true;
return false;
}
int main()
{
ios_base::sync_... | ALGO | 0.999827 | 4.813667 |
e742d988-cbee-498c-9a55-696988528e4e | Ritwik7631/Leetcode_Solutions | 295-find-median-from-data-stream/find-median-from-data-stream.cpp | #include <queue>
#include <stdexcept>
class MedianFinder {
public:
std::priority_queue<int, std::vector<int>, std::less<int>> small; // max-heap
std::priority_queue<int, std::vector<int>, std::greater<int>> big; // min-heap
MedianFinder() {}
void addNum(int num) {
if (small.empty() |... | ALGO | 0.999969 | 6.420107 |
673f8164-1e29-4d50-a482-0dfffcdc7cbb | alicia6174/Finite-state-machine | Rec2ItrAck/main.cpp | #include <stdio.h>
#include <iostream>
#include <vector>
using namespace std;
struct Frame
{
Frame(int n = 0, int k = 0, int s = 0):
arg_m(n),
arg_n(k),
st(s)
{}
int arg_m;
int arg_n;
int st;
int local_tmp;
int ret;
};
//Construct a class of Stack by myself.
templ... | ALGO | 0.99977 | 3.949887 |
afd700bc-dbca-45dc-9659-ffc27d5bd598 | wildcat-rocketry/llvm | clang-tools-extra/clang-tidy/readability/InconsistentDeclarationParameterNameCheck.cpp | #include "InconsistentDeclarationParameterNameCheck.h"
#include "clang/AST/ASTContext.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include <algorithm>
#include <functional>
using namespace clang::ast_matchers;
namespace clang {
namespace tidy {
namespace readability {
namespace {
AST_MATCHER(FunctionDecl, has... | TOOL | 0.858016 | 7.896933 |
a3dcf17c-668b-4f9d-9e73-c216b2ae9c08 | SmilingBytes/Competitive-Programming | Codeforces/Edu 21 Div. 2/A_Lucky_Year.cpp | /**
* author: ismail
* created: 11.02.2020 12:07:43
**/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define sz(a) a.size()
#define all(a) a.begin(), a.end()
#define w(a) std::cerr << #a << " : " << (a) << "\n";
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int n;
... | ALGO | 0.999253 | 4.048741 |
2ef6bbc2-1a3f-4350-a4ff-c32b98bcd44e | ishandutta2007/codeforces | noam13/normal/839/C.cpp | #include <bits/stdc++.h>
//#define int long long
//#define vi vector<int>
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define ii pair<int,long long>
#define x first
#define y second
#define all(x) x.begin(), x.end()
using namespace std;
vector<vector<int> > g;
long double heightOfLeavs(int cur){
if ... | ALGO | 0.999317 | 4.143455 |
4b8b5bc6-5b09-457b-9a88-2858ed556c4d | ishikasinha-d/6Companies30days | Intuit[Day 21-25]/LargestNumberInKswaps_Q4.cpp | class Solution
{
public:
/*
Approach 1: find all pairs and check if the no. formed is max
each recurive call will make n^2 further recursive calls and there will be k such call
TC: ((n^2)^k)
Approach 2: starting from left, swap the digits with max digit pres... | ALGO | 0.999973 | 5.656878 |
6d5c38d7-b0fd-49bb-adde-dae6724d1353 | ujjwalkumardas/program.cpp | 6th.cpp/4th.cpp | #include<iostream>
using namespace std;
void printable(int arr[],int n){
for(int i=0;i<n;i++){
cout<<arr[i];
}cout<<endl;
}
void swapi(int arr[],int no){
for(int i=0;i<no;i+2){
if(i+1<no){
swap(arr[i],arr[i+1]);
}
}
}
int main(){
int arr[6]={1,2,3,4,5,6};
swapi(arr,6);
printable(arr,6);... | ALGO | 0.996301 | 4.181207 |
27d641e2-8579-4260-bc15-448b88548618 | soodaayush/codeforces | Contests/codeforces-round-996-div2/twoFrogs.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int t;
cin >> t;
while (t--) {
int n, a, b;
cin >> n >> a >> b;
if (abs(b - a) % 2 == 0) {
cout << "YES" << endl;
} else {
cout << "NO" << endl... | ALGO | 0.999697 | 4.530935 |
edd86b74-4a93-4856-b452-41e8018d661f | rounakraj401/CRACK-INTERN | 0744-find-smallest-letter-greater-than-target/0744-find-smallest-letter-greater-than-target.cpp | class Solution {
public:
char nextGreatestLetter(vector<char>& letters, char target) {
int t=target-'a';
int n=letters.size();
vector<int>vec(n);
for(int i=0;i<n;i++)
vec[i]=letters[i]-'a';
if(t>vec[n-1])return vec[0]+'a';
int l=0;
... | ALGO | 0.999384 | 5.677735 |
6a0c9634-06a9-455a-8447-ce6a208bbdbe | shivanshsanoria1/LeetcodeSolutions | CPP [1-500]/111.minimum_depth_of_binary_tree [2].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.999973 | 6.794875 |
8005709e-7fe9-44ff-88c3-8942c6bab389 | sonvule59/CUDA_and_OpenMP | weakLLM_openMP_examples/hpc_coder_OpenMP_Translated_v1/s192008613_omp.cpp | #include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <set>
#include <sstream>
#include <numeric>
#include <bitset>
#include <complex>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cm... | ALGO | 0.988791 | 3.379158 |
8671b451-0e14-4877-905b-b035998dc99d | eskoruppa/PolyMC | MCStep/MCStep.cpp | #include "MCStep.h"
MCStep::MCStep(Chain * ch,const std::vector<long long int> & seedseq) :
// Set State Variables
chain(ch),
seedseq(seedseq),
BPS(*ch->get_BPS()),
pos(ch->get_bp_pos()),
triads(ch->get_triads()),
states(ch->get_states()),
num_bp(ch->get_num_bp()),
num_bps(ch->get_num_bps()),
disc_len(ch->get_disc_len... | ALGO | 0.971165 | 5.296264 |
e77681f0-b920-4058-a06f-9fa4e2a45c63 | DimaAndreev30/yandex-alg-2021 | 1 контест/C.cpp | #include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <array>
#include <cctype>
using phone_t = std::array<char, 11>;
phone_t readPhone(std::istream& input)
{
phone_t number{"8495"};
std::string str;
std::getline(input, str);
for (int i = str.size() - 1, k = 10; i >= 0; i--)
... | ALGO | 0.996232 | 4.278996 |
bc499a5c-cd89-44af-b33e-02549e1856e9 | fractalismx/programasVillanueva | MetodosNumericos/MNI/NewtonRaphsonModificado.cpp | #include<iostream>
#include<cstdlib>
#include<cmath>
using namespace std;
double Validar(void);
double Num(double A);
double Ren(double A);
double Funcion(double A);
double FuncionD(double A);
double FuncionD2(double A);
void NRM (double A, const double E);
int main(void)
{
double a,e;
char o;
do
{
cout<... | ALGO | 0.999849 | 3.0546 |
bc631f67-04b8-4b35-93a3-361b56acf248 | EthanMatei/STAR2.7.8a | source/SpliceGraph_swScoreSpliced.cpp | /*
* Created by Fahimeh Mirhaj on 6/18/19.
*/
#include "SpliceGraph.h"
#define macro_CompareScore(score1,scoreMax,dirInd,dirIndMax) if(score1>scoreMax){dirIndMax=dirInd;scoreMax=score1;}
SpliceGraph::typeAlignScore SpliceGraph::swScoreSpliced
(const char *readSeq, const uint32 readLen, c... | ALGO | 0.997166 | 3.7663 |
930e70fb-ba40-4d3c-a9a3-a4709218962b | yanshiwei/leetcode-go | cpp/907_stack.cpp | class Solution {
/*
题目:
给定一个整数数组 arr,找到 min(b) 的总和,其中 b 的范围为 arr 的每个(连续)子数组。
由于答案可能很大,因此 返回答案模 10^9 + 7 。
题解:
暴力方法:枚举所有子数组,然后逐个求最小值
进一步,可以求最小值为arr[i]的区间个数,也就是遍历每一个值,求出以它为最小值的区间数目。
如何求其个数呢,方法是找到左右两边最近的更小值的位置left,right
那么在(left,i]选择区间左边,[i,right)选择区间右边,
那么这时候组合的子序列肯定都是以arr[i]为最小值
求... | ALGO | 0.999993 | 5.714876 |
78b614a7-55d5-44c7-a791-c9d11c56ffcf | sergeystoma/tinyvnc | src/cryptoppmin/idea.cpp | // idea.cpp - written and placed in the public domain by Wei Dai
#include "pch.h"
#include "idea.h"
#include "misc.h"
NAMESPACE_BEGIN(CryptoPP)
static const int IDEA_KEYLEN=(6*IDEA::ROUNDS+4); // key schedule length in # of word16s
#define low16(x) ((x)&0xffff) // compiler should be able to optimize this away if w... | ALGO | 0.999671 | 7.408644 |
608b6135-29ef-4f78-89e3-8ab663269e2e | Noushil-Sharma/DSA_CPP | lecture100/kosaraju's.cpp | #include<bits/stdc++.h>
using namespace std;
// namespace std;
void dfs(int node , unordered_map<int,bool>&vis, stack<int> &st, unordered_map<int , list<int>>&adj){
vis[node]=true;
for(auto nbr: adj[node]){
if(!vis[nbr]){
dfs(nbr,vis,st,adj);
}
}
//topo logic
st.push(no... | ALGO | 0.999857 | 5.487496 |
351ccd09-9b62-43a2-b26d-f2e891e7ce45 | garvitvirmani/CPP_Local | test-2/a.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#ifndef ONLINE_JUDGE
#include "DEBUG.h"
#else
#define debug(x)
#endif
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
ll tt = 1, n = 0, m = 0, k = 0, t = 0;
cin >> tt;
while (tt--)
{
ll ... | ALGO | 0.999914 | 4.918856 |
b35e073b-3c9a-426e-a1cf-d3a253afd328 | blaz-kranjc/AoC-2020 | src/day5.cpp | #include "input_file_loader.h"
#include <range/v3/all.hpp>
#include <fmt/core.h>
#include <string>
#include <cinttypes>
#include <vector>
constexpr std::uint64_t seat_id(std::string_view pass) {
std::uint64_t id{ 0 };
for (; !pass.empty(); pass = pass.substr(1)) {
id <<= 1;
id |= static_cast<uint64_t>(pas... | ALGO | 0.947976 | 5.982242 |
d86c3631-0f06-4afc-8dc9-7d3a6bcdb324 | ziyu211/infinigen | worldgen/terrain/source/cpu/elements/upsidedown_mountains.cpp | // Authors: Zeyu Ma
#include "header.h"
extern "C" {
void call(
size_t size,
float3_nonbuiltin *positions,
float *sdfs,
float *auxs
) {
using namespace data;
int n_auxiliaries = 1;
if (auxs == NULL) n_auxiliaries = 0;
#pragma omp parallel for
... | ALGO | 0.993153 | 3.856032 |
d4225c9b-3aa4-499a-b1fc-0d8aa0474394 | josuerom/Competitive-Programming | Contests/CodeForces/May22/Round 479/Two-gram.cpp | #include <bits/stdc++.h>
#define endl '\n'
#define debug(X) cout << #X << " = " << X << endl
#define fori(i,b,e) for (int i = (b); i < (e); ++i)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
const int oo = 1e9;
int main() {
ios_base::sync_with_stdio(false); cin.tie(0... | ALGO | 0.999936 | 4.061434 |
95b437e5-2d0f-43df-819d-bd7f5ea70ee6 | mingsjtu/OJ_exercise | pku19信科/A数与字符串.cpp | //http://bailian.openjudge.cn/xly2019/A/
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<string>
using namespace std;
int main()
{
int n;
while (cin >> n)
{
if (n == 0)
return 0;
if (n < 9)
{
cout << n << endl;
continue;
}
if (n >= 9 && n < 99)
{
cout << 9 <... | ALGO | 0.999391 | 3.786625 |
e55502fe-377b-44c7-baf7-f0fd41e20c55 | Ishita-Trivedi/DailyDSA | Count Inversions - GFG/count-inversions.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution{
long long int count=0;
public:
// arr[]: Input Array
// N : Size of the Array arr[]
// Function to count inversions in the array.
void merge(long long arr[],long long low,long long mid,long ... | ALGO | 0.999812 | 6.081203 |
e0a783e7-44ac-4bd1-88d9-9f954a57c2ff | pclubiitk/Spring-Camp-25 | CP/Suvan/CP_Assignment_1 Suvan/SPOJ_Aggressive_cows.cpp | #include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef set<int> s;
#define sz(a) int((a).size())
#define pb push_back
#define all(c) (c).begin(), (c).end()
#define present(c, x) ((c).find(x) != (c).end())
void fast_io() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
}
int main() {
... | ALGO | 0.999999 | 4.09548 |
42fa7776-95f6-4dde-bc03-96df8f327f04 | d3xture/CPP-University | if-else-statements/Vowel-Consonant-Identifier/main.cpp | #include <iostream>
using namespace std;
int main()
{
char ch = 'c';
cout << "Enter the letter: ";
cin >> ch;
if (ch == 'a')
{
cout << "This is a vowel";
}
else if (ch == 'e')
{
cout << "This is a vowel";
}
else if (ch == 'i')
{
cout << "This is a vo... | ALGO | 0.915742 | 3.047134 |
a7a4fc2c-fb4c-4703-9ba9-42d0d6a854c7 | penaandrew12/PenaAndrew_CIS5_Spring2017 | Homework/HW Assignment #2/Gaddis_8thEd_Ch3_Prob_#8_Widget/main.cpp | /*
* File: main.cpp
* Author: Andrew Pena
* Created on March 9, 2017, 3:51 PM
* Purpose: Number of Widgets on Pallets
*/
//System Libraries
#include <iostream> //Input - Output Library
#include <iomanip> //Library
using namespace std; //Name-space under which system libraries exist
//User Libraries
//Globa... | ALGO | 0.980471 | 4.434911 |
4ea8d2ea-36bd-4f9b-a940-6d268237040e | gudwh14/algorithm | c++/swea/3차원 농부.cpp | #include<iostream>
#include<algorithm>
#include <climits>
#include <cstring>
using namespace std;
int n, m;
int c1, c2;
int cow[500000];
int min_distance = INT_MAX;
auto binarySearach(int horse_z) {
int left = 0, right = n - 1;
int mid = (left + right) / 2;
if (cow[left] > horse_z) {
return 0;
}
if (cow[rig... | ALGO | 0.999941 | 3.611051 |
2be5f27a-1f89-4d34-97b5-6345ca2d1604 | AbhishekChauhan9036/Advance-DSA-NS | BST [In Class]/count_Leaves_Of_Binary_Tree.cpp | #include <bits/stdc++.h> // header file includes every Standard library
using namespace std;
int main() {
int n;
cin>>n;
int left=0,right=0,count=0;
for(int i=0;i<n;i++) {
cin>>left;
cin>>right;
if(left==-1 && right==-1) count++;
}
cout<<count;
return 0;
} | ALGO | 0.99957 | 3.664298 |
c7739544-f209-4b04-bcf5-55a996b088a4 | aakashmaity/codeforces | 1669.cpp | #include <bits/stdc++.h>
using namespace std;
void solve()
{
int rating;
cin >> rating;
if (1900 <= rating)
{
cout << "Division 1" << endl;
}
else if (1600 <= rating && rating <= 1899)
{
cout << "Division 2" << endl;
}
else if (1400 <= rating && rating <= 1599)
{
... | ALGO | 0.998829 | 4.695124 |
369edd4f-894b-4319-a058-82e145350c23 | chikai-ito/Library-The_atama | enjapma/main-library/dice.cpp | #include <bits/stdc++.h>
using namespace std;
// using namespace atcoder;
// using mint = long double;
// using mint = atcoder::modint998244353;
// using mint = atcoder::modint1000000007;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P> T;
typedef pair<ll, vector<ll>> Pd;
const ll INF = 3e18;
const... | ALGO | 0.999925 | 3.78834 |
b0b98f85-8432-47ed-9192-f8dd5d24cafd | TrakJohnson/mines-cpp-chaleur | includes/eigen-3.4.0/doc/special_examples/Tutorial_sparse_example.cpp | #include <Eigen/Sparse>
#include <vector>
#include <iostream>
typedef Eigen::SparseMatrix<double> SpMat; // declares a column-major sparse matrix type of double
typedef Eigen::Triplet<double> T;
void buildProblem(std::vector<T>& coefficients, Eigen::VectorXd& b, int n);
void saveAsBitmap(const Eigen::VectorXd& x, int... | ALGO | 0.992181 | 5.514443 |
ff31cbb9-9416-4abe-b784-3f032b33c540 | Keyur2311/DSA | GRAPHS/BIPARTITE_GRAPH_USING_BFS.cpp | #include <bits/stdc++.h>
using namespace std;
bool checkForBipartite(int src, vector<int> graph[], int *color)
{
queue<int> q;
q.push(src);
color[src] = 1;
while (!q.empty())
{
int node = q.front();
q.pop();
for (auto it : graph[node])
{
if (color[it] =... | ALGO | 0.99998 | 5.691025 |
3e8cfdd5-f338-4fc6-9226-22ef5ffdd6b8 | NimishToshniwal/Codeforces-Solved | 1500-1999/1829A.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < n; i++)
#define rep1(i, n) for (ll i = 1; i <= n; i++)
int main()
{
ios::sync_with_stdio(false);
int t;
cin >> t;
while (t--)
{
string s = "codeforces";
string k;
cin >>... | ALGO | 0.999396 | 4.091751 |
547ac51a-8316-47c0-bcdd-5b6cb4fdfe68 | vantuan0128/DSA_PTIT | DSA01016.cpp | #include<bits/stdc++.h>
using namespace std;
int OK=0, X[50], N, K;
void in(){
cout<<"(";
for(int i=1;i<=K;i++) {
cout << X[i];
if(i!=K) cout<<" ";
}
cout << ")"<<" ";
}
void sinh(){
int i = K, j, a, b, c;
while(X[i]==1) i--;
if(i==0) OK = 1;
else{
X[i]--; a = K - i +1;
b ... | ALGO | 0.999751 | 5.04351 |
528dd3c3-cb9a-4945-8b3e-5e80936121c8 | ngng628/competitive-programming | atcoder/ABC/ABC110/C/main.cpp | # include <bits/stdc++.h>
# include <atcoder/all>
# ifndef ngng628_library
# define ngng628_library
# define int long long
# define float long double
# define fi first
# define se second
# define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i,n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
# define rr... | ALGO | 0.999995 | 5.428435 |
7ab27fb5-e327-4020-b7ad-228e10c6df17 | robahall/cpp_tutorial | control_flow/p7_7_3/inverted_triangle.cpp | #include <iostream>
// Loop between 1 and 5
int main()
{
int outer{ 5 };
while (outer >=1)
{
//loop between 1 and outer
int inner{1};
while (inner <= outer)
{
std::cout << inner << ' ';
++inner;
}
//print a new line at the end of each row
std::cout << '\n';
--outer;
}
return 0;
}
| TOOL | 0.921334 | 3.558696 |
3ac5efe3-ccfe-414c-a787-b6d51c9ad3e4 | krishna9809/DSA-with-cpp | Day005/Functions/11.cpp | // Check num is Prime or Not
#include<iostream>
using namespace std;
bool isPrime(int n){
for(int i = 2;i<n;i++){
if(n%i==0){
return 0;
}
}
return 1;
}
int main()
{
int n;
cout<<"Enter the number to check it is Prime or not:"<<endl;
cin>>n;
int result = isPrime(... | ALGO | 0.999842 | 3.825552 |
81ee6020-5206-4878-b938-7d6f4cf7e766 | cs17b012/ParallelComputingAssignment3 | ParallelComputingAsst-3/a9.cpp | #include <iostream>
#include <omp.h>
#include <vector>
#include <random>
int main(int argc, char* argv[]){
if(argc<4) {
std::cout<<"Matrix sizes not provided\n";
return 0;
}
int m,n,o;
m= atoi(argv[1]);
n=atoi(argv[2]);
o = atoi(argv[3]);
double a[m][n], b[n][o], c[m][o];
double lbound = 0;
double uboun... | ALGO | 0.998184 | 3.370394 |
44b5a140-9e37-442b-b427-3a30b97d8dc1 | hassanrahim26/LEETCODE | SEARCHING/EASY/Count Negative Numbers in a Sorted Matrix/Code.cpp | /*
PROBLEM LINK:- https://leetcode.com/problems/count-negative-numbers-in-a-sorted-matrix/
*/
class Solution {
public:
int countNegatives(vector<vector<int>>& v) {
int n = v.size(), m = v[0].size();
int i = n - 1, j = 0, count = 0;
while(i >= 0 && i < n && j >= 0 && j < m)
... | ALGO | 0.999982 | 6.412725 |
81021cb7-d561-4b06-b74b-45d04c3b266d | ishandutta2007/codeforces | derekfeng/normal/842/D.cpp | #include<bits/stdc++.h>
using namespace std;
const int D=18;
int n,m,s[2][1048600],sz[1048600],lz[1048600];
void built(int id,int d){
if(d<0)return;
s[0][id]=id<<1,s[1][id]=id<<1|1;
built(id<<1,d-1),built(id<<1|1,d-1);
}
void ins(int id,int x,int d){
if(d<0){
sz[id]=1;
return;
}
if((1<<d)&x)ins(s[1][id],x,d-1... | ALGO | 0.999969 | 4.696559 |
e6e089c3-227c-4f9f-8ea5-dc31eeef4b82 | BinomialSheep/CompetitiveCpp | AtcoderContest/ARC144/B5.cpp | #include <bits/stdc++.h>
// デバッグ用マクロ:https://naskya.net/post/0002/
#ifdef LOCAL
#include <debug_print.hpp>
#define debug(...) debug_print::multi_print(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (static_cast<void>(0))
#endif
using namespace std;
using ll = long long;
using vi = vector<int>;
using vl = vector<lo... | ALGO | 0.999876 | 4.077603 |
186608bc-8f90-42c5-b8ee-76d79b9a1db4 | khushisinha20/Data-Structures-and-Algorithms | Stack/largest_area_in_histogram.cpp | //leetcode.com/problems/largest-rectangle-in-histogram/
#include <bits/stdc++.h>
using namespace std;
class Solution {
public:
vector<int> nextSmallerToLeft(vector<int>& heights) {
vector<int> nsl(heights.size());
stack<pair<int, int>> previousHeights;
for (int i = 0; i < heights.... | ALGO | 0.999965 | 6.670517 |
57e7171d-f3ae-451c-840f-5724d9a2d464 | KhoiBui16/Fullhouse_Code_Online | DSA/Contest/07. ThuatToanSinh/Bai_12/Bai12_ThamKhao.cpp | #include <bits/stdc++.h>
using namespace std;
string s;
void Solve()
{
cin >> s;
string bin = "";
bin = s[0];
for (int i = 1; i < s.size(); i++)
{
int n = bin.size() - 1;
if (bin[n] != s[i])
bin += "1";
else
bin += "0";
}
cout << bin << endl... | ALGO | 0.999918 | 4.184719 |
6950770c-5fa2-410a-b537-9caea4d8a4a4 | soaresgiovanna/Logica-de-Programacao | FuncãoDataDiaDaSemana.cpp | #include <iostream>
using namespace std;
bool dv (int d, int m, int a)
{
if (d < 32 && m < 13 && a > 0)
{
if(a % 4 == 0 && a % 100 != 0 || a % 400 == 0 && m == 1 ||m == 3 ||m == 5 ||m == 7 ||m == 8 ||m == 10 ||m == 12 && d == 31 || m == 4 ||m == 6 ||m == 9 ||m == 11 && d == 30 || m == 2 && d== 29)
... | ALGO | 0.999912 | 3.935334 |
ba58ecd0-ad75-4d68-801e-dabd9d864a8a | qiaozishun4/CSP2024_BJ | BJ-Senior/answers/BJ-S01129/duel/duel.cpp | #include<iostream>
#include<map>
using namespace std;
map<int,int> mp;
int main(){
ios::sync_with_stdio(0);
freopen("duel.in","r",stdin);
freopen("duel.out","w",stdout);
int n;
cin >> n;
int ans = 0;
for(int i = 0; i < n; i++){
int x;
cin >> x;
mp[x]++;
ans ... | ALGO | 0.999856 | 3.928485 |
8ffe429c-3f9b-4241-8254-1c8b563ae43f | mantognini/Image-Skeletonisation | src/serial/Skeleton.cpp | #include "Skeleton.hpp"
#include "Image.hpp"
#include <SFML/System/Clock.hpp>
#include <array>
#include <utility>
static auto constexpr FOREGROUND = BWImage::BLACK;
static auto constexpr BACKGROUND = BWImage::WHITE;
using Position = std::pair<int, int>;
Position makePosition(int x, int y) { return std::make_pair(x,... | ALGO | 0.969961 | 6.516927 |
23f0529d-ddaa-4106-98c5-5a13cef22a7b | haris71rc/Leetcode | 2323-minimum-bit-flips-to-convert-number/minimum-bit-flips-to-convert-number.cpp | class Solution {
public:
int minBitFlips(int start, int goal) {
int ans=start^goal;
int count=0;
for(int i=0;i<32;i++){
if(ans&(1<<i)) count++;
}
return count;
}
}; | ALGO | 0.999961 | 5.713349 |
b8c6a681-a435-4005-8a55-b84284eac3c3 | PulakC01/LeetCode | 847-shortest-path-visiting-all-nodes/847-shortest-path-visiting-all-nodes.cpp | class Solution {
public:
int shortestPathLength(vector<vector<int>>& graph) {
queue<vector<int>> q;
int n = graph.size();
int req = (1 << n) - 1;
map<int, set<int> > visited;
for (int i = 0; i < n; i++) {
q.push({ 0 | (1 << i), i });
}
if (n == 1)
... | ALGO | 0.999808 | 5.507354 |
2316ce85-5173-4c83-8d5a-adc902752057 | ffaarrsun/leetcode_2024 | 12.26 242.valid-anagram.cpp | /*
* @lc app=leetcode id=242 lang=cpp
*
* [242] Valid Anagram
*/
// @lc code=start
class Solution {
public:
bool isAnagram(string s, string t) {
unordered_map <char , int> arrs,arrt;
for(char c:s) //Mstring
{
arrs[c]++;
}
for(char c:t)
{
a... | ALGO | 0.999864 | 6.170068 |
f56341ea-a09e-4e9a-989f-76c79592de0b | netcan/recipes | cpp/metaproggramming/parser_combinator/main.cpp | /*************************************************************************
> File Name: main.cpp
> Author: Netcan
> Descripton: ParserCombinator
> Blog: https://netcan.github.io/
> Mail: <EMAIL>
> Created Time: 2020-09-12 19:56
********************************************************************... | TOOL | 0.959405 | 7.171085 |
00bd02ed-37d8-4aee-b111-3cc620938a0b | AdAstraSaturn/godot-custom | modules/jolt_physics/misc/jolt_math_funcs.cpp | /**************************************************************************/
/* jolt_math_funcs.cpp */
/**************************************************************************/
/* This file is part of: */
/* ... | ALGO | 0.997274 | 6.854738 |
dafeb9a3-bfda-49c7-9e7e-f7fefa98d529 | nikhiljohnykaruthedath/csci520_inverse_kinematics | adolc/sourceCode/ADOL-C/examples/additional_examples/timing/sgenmain.cpp | #define _SGENMAIN_C_
/****************************************************************************/
/* INCLUDES */
#include <adolc/adolc.h>
#include "../clock/myclock.h"
#include <cstdlib>
#include <time.h>
/*********************************************... | TOOL | 0.974238 | 5.596532 |
81237a52-eb84-4fd5-91cf-d90742cd7396 | jordanlee008/Code | USACO/Feb2017Gold/visitfj1/visitfj_usaco_solution_2.cpp | #include <iostream>
#include <fstream>
#include <vector>
#include <queue>
using namespace std;
int dr[] = {0, 1, 2, 3, 2, 1, 0, -1, -2, -3, -2, -1, -1, 1, 0, 0};
int dc[] = {3, 2, 1, 0, -1, -2, -3, -2, -1, 0, 1, 2, 0, 0, -1, 1};
int main() {
ifstream fin ("visitfj.in");
ofstream fout ("visitfj.out");
int N, T... | ALGO | 0.999785 | 3.776196 |
84374454-c401-406d-b6ce-6d7a81904b35 | KhaledAbdelgalil/competitive-programming-book | chapter 5/problems/Programming Exercises related to Ad Hoc Mathematics problems/Mathematical Simulation (Brute Force), Harder/10025.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
std::ifstream in ("input");
std::streambuf * cinbuf = std::cin.rdbuf (); //save old buf
std::cin.rdbuf (in.rdbuf ()); //redirect std::cin to in.txt!
int t;
cin >> t;
bool first = true;
while(t--){
if(!first) cout << endl;
... | ALGO | 0.99988 | 4.210031 |
8bcda66a-257b-4deb-847f-8aa40578f6e1 | iCoder0020/Competitive-Coding | CF-old/684/C.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
void add_and_change(pair<int,int>p, vector<vector<char>>&A, vector<pair<int,int>>&moves)
{
moves.push_back(p);
int x = p.first, y = p.second;
assert(x>=0 && x<A.size() && y>=0 && y<A[0].size());
if(A[x][y] == '0')
A[x][y] = '1';
else
A[x][y... | ALGO | 0.999925 | 3.868324 |
a7d08aec-51da-4fe5-bf72-ed75f458ec57 | IHRSI/LeetCode | 0204_Count_Primes.cpp | //Goated simplified for TC=22ms
//Precomputed only once in TC=O(nloglogn)
//Rest all the test cases run in O(1)
//SC O(N+N)~O(N) - Defined globally - 32MB
const int N=5*1e6+1;
int prime_ct[N]={0};
bool is_pri[N];
bool precompute=false;
void sieve(){
for(int i=0;i<N;++i) is_pri[i]=1;
is_pri[0]=is_pri[1]=0;
f... | ALGO | 0.999435 | 5.516531 |
e41e2d60-8b75-4404-8ccc-307beb9cc58e | etoo31/leetcode-solutions | 0131-palindrome-partitioning/0131-palindrome-partitioning.cpp | class Solution {
public:
vector<vector<string>>ans;
vector<string>part;
vector<vector<string>> partition(string s) {
dfs(0 , s);
return ans;
}
void dfs(int i , string& s)
{
if (i == s.size())
{
ans.push_back(part);
return;
}
... | ALGO | 0.999936 | 5.977355 |
915b9b9c-0d3c-4b3e-a8ad-dc0527cab183 | JunBinLiang/Road-To-1900 | 算法/网络流/最大流/CF-510E(二分图变形匹配最大流+2300).cpp | #include <string>
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <string.h>
using namespace std;
const int N = 310, M = 100000 + 10, INF = 1e8;
int n, m, S, T;
int f[M], to[M]; //流量
int d[N], cur[N]; //分层图
struct E {
int v, ei;
};
vector<E> g[N];
int ei = 0;
void add(vecto... | ALGO | 0.999971 | 3.717949 |
d905420d-d292-4145-82a9-8690b21e0d6b | DanyloIKM723a/TESTjob | zadanie5.cpp | #include <iostream>
// A function for sorting elements in an array in ascending order
void bubbleSort(int arr[], int n) {
for (int i = 0; i < n - 1; ++i) {
for (int j = 0; j < n - i - 1; ++j) {
if (arr[j] > arr[j + 1]) {
// Exchange items if they are out of order
... | ALGO | 0.999938 | 6.00193 |
5d1dfae8-53ce-4630-852d-25be4ec7be06 | ayushgoyal04/Learning-Journey | Learning-DSA/Training placement classes/Contest on Sorting Techniques/K.cpp | #include <iostream>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
// Custom comparison function for sorting
bool compare(pair<int, int> &a, pair<int, int> &b) {
// If frequencies are equal, sort in non-decreasing order
if (a.second == b.second)
return a.first < b.first;
... | ALGO | 0.999992 | 6.345677 |
69973ec5-6d11-4cf2-8b6b-9ab12fa6fefc | ayushman17/Competitve-coding | Codechef/Contests/LRNDSA03/SAVKONO.cpp | #include <bits/stdc++.h>
#define ll long long
#define tc int t;cin>>t;while(t--)
#define IOS ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define in_txt freopen("input.txt","r",stdin)
#define endl '\n'
using namespace std;
int main()
{
IOS;
// in_txt;
tc{
ll z,n,count=0,sum=0,k,a;
priority_... | ALGO | 0.999957 | 3.643754 |
b2014a98-c968-4ab0-ad6b-b56196642fa5 | HadyAhmed00/MyChallenge | July 2022/day8/Summer_Camp.cpp | //
// Created by Hady Ahmed on 7/6/2022.
//
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <stack>
#define ll long long
#define modl 1000000007
#define f(i, k, n) for (ll i = k; i < n; i++)
using namespace std;
void Summer_Camp(){
string arr[1001... | ALGO | 0.998619 | 4.048927 |
0980c1ff-88cb-4b6e-b28f-3da7f4d4ea39 | betterafter/problem-solving | baekjoon/Else/Olympic.cpp | using namespace std;
bool compare(pair<pair<int, int>, pair<int, int> > &a, pair<pair<int, int>, pair<int, int> > &b){
if(a.first.second != b.first.second) return a.first.second > b.first.second;
else if(a.second.first != b.second.first) return a.second.first > b.second.first;
else return a.second.second >... | ALGO | 0.999965 | 3.746405 |
db375b1b-8c22-469a-9cdf-43ccb4018bed | uedsonsouza/beecrowd | extremelyBasic.cpp | // Read 2 variables, named A and B and make the sum of these two variables, assigning its result to the variable X. Print X as shown below. Print endline after the result otherwise you will get “Presentation Error”.
// Input
// The input file will contain 2 integer numbers.
// Output
// Print the letter X (uppercase)... | ALGO | 0.998005 | 4.701476 |
bf6ee74e-3e34-49c6-ba29-ca09ccbc318c | trdln/ADS-Autumn-2021 | Additional/History/ADS2020-main/!Quizes/AlgoFinal2/A.cpp | #include <bits/stdc++.h>
using namespace std;
deque<int> boris;
deque<int> nursik;
void boris_take()
{
boris.push_back(boris.front());
boris.push_back(nursik.front());
boris.pop_front();
nursik.pop_front();
}
void nursik_take()
{
nursik.push_back(boris.front());
nursik.push_back(nursik.front());... | ALGO | 0.999933 | 3.913352 |
fefb563d-48e9-4f17-b394-3d46f671e8cb | EveerDrof/IS27 | kupriyanov.cpp | #include "pch.h"
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
#define _USE_MATH_DEFINES
#include <string.h>
#include <math.h>
#pragma warning(disable : 4996)
using namespace std;
struct pixel
{
unsigned char b;
unsigned char g;
unsigned char r;
};
struct point
{
int X, Y;
};
#pragma pac... | ALGO | 0.932449 | 3.575314 |
f28ff03a-ab8e-449e-9c4a-0c53a30f0046 | MilanKovacevic52/programiranje | z1/main.cpp | #include <iostream>
using namespace std;
int main()
{
int n,m=1,i;
cout << "Unesite zeljeni broj: ";
cin >> n;
for(i=1;i<=n;i++)
{
m*=i;
}
cout << "Faktorijel unesenog broja je:" << m;
return 0;
}
| ALGO | 0.999828 | 4.210544 |
482e8f0c-bda8-4995-890a-e181b5b7fdde | afikur/UVA-Solutions | 10812 Beat the Spread!.cpp | /*
Afikur Rahman (afikur)
UVA 10812
Date: 20.02.17
*/
#include <iostream>
#include <cmath>
using namespace std;
int main() {
int tc,x,y,t1,t2;
cin>>tc;
while(tc--) {
cin>>x>>y;
if(x < y) cout<<"impossible"<<endl;
else if(y == 0) cout<<x<<" "<<y<<endl;
else {
... | ALGO | 0.99946 | 3.916527 |
4edd0b2b-0b7f-4ad0-8099-2b95eb493c06 | Nishithjupally/DataStructures | ds/CS18BTECH11018_Prob4.cpp | #include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> vertexpair;
vector<bool> directed,sourcevec;
// d.assign()
int counter = 0; //for component
class Graph //class with all attributes
{
public:
int n;
list<int> *adjacency;
list< pair<int, int> > *adj;
Graph(int x)
{
n = x;
adjacency = new l... | ALGO | 0.999765 | 3.737246 |
e52d42c1-d31b-4a99-8878-c3045a3dfa01 | AdarshSorout/Leetcode | 0025-reverse-nodes-in-k-group/0025-reverse-nodes-in-k-group.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:
ListNode* reverse(Lis... | ALGO | 0.999984 | 5.94388 |
14bc1203-5f3c-41cb-9261-ddc53872db71 | Aadish-Sanghvi/DSA | Recursion/phoneComb.cpp | // some mistake in code
#include <iostream>
#include<iostream>
#include<vector>
using namespace std;
vector<string> key = {"", "","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz"};
vector<string> ans;
void helper(int a[], int n, string temp, int i){
if(i == n){
ans.push_back(temp);
return;
}... | ALGO | 0.999848 | 4.579525 |
ac5c531a-9572-4e08-855e-53e53c408d38 | ZhilinCheng/ZhiliChengBarcuch | ZhilinHW2/Zhilin Cheng Level 2 HW submission/1.7/1.7.3/1.7.3/Print.cpp | /* Predict what will be printed on the screen */
#include <stdio.h>
#define PRD(a) printf("%d", (a) ) // Print decimal
#define NL printf("\n"); // Print new line
// Create and initialize array
int a[] = { 0, 1, 2, 3, 4 };
int main()
{
int i;
int* p;
for (i = 0; i <= 4; i++) PRD(a[i]); // 1 it will show 01234
N... | ALGO | 0.993177 | 3.551794 |
c0121e0a-1ff9-43ff-b63d-a49800cc06bc | gedorinku/llvm-65816 | llvm/lib/CodeGen/SelectionDAG/ScheduleDAGVLIW.cpp | #include "ScheduleDAGSDNodes.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/CodeGen/ResourcePriorityQueue.h"
#include "llvm/CodeGen/ScheduleHazardRecognizer.h"
#include "llvm/CodeGen/SchedulerRegistry.h"
#include "llvm/CodeGen/SelectionDAGISel.h"
#include "llvm/CodeGen/TargetInstrInfo.h"
#include "llvm/CodeGen/Targe... | ALGO | 0.888852 | 6.793476 |
4fb7a37c-b4f6-4ac5-8232-368ab3a142f9 | yashchavan02/DSA | String/RomanToDecimal.cpp | #include<iostream>
#include<string>
using namespace std;
int InDecimal(char ch){
switch((char)toupper(ch)){
case 'I':
return 1;
case 'V':
return 5;
case 'X':
return 10;
case 'L':
return 50;
case 'C':
return 100;
... | ALGO | 0.999418 | 4.898139 |
8669faaf-d414-4124-974d-4baf78c1fa0c | charge72002/URS_Athena_Cpp | athena-public-version-Copy/src/pgen/twoibw.cpp | // C headers
// C++ headers
#include <iostream> // endl
#include <sstream> // stringstream
#include <stdexcept> // runtime_error
#include <string> // c_str()
// Athena++ headers
#include "../athena.hpp"
#include "../athena_arrays.hpp"
#include "../coordinates/coordinates.hpp"
#include "../eos/eos.hpp"
#incl... | ALGO | 0.984645 | 5.021163 |
c99176c1-8343-4483-963c-13362a83488a | xckx1019/Data-Structure | BST.cpp | #include <iostream>
using namespace std;
struct Node
{
int data;
Node *left;
Node *right;
};
Node *getNewNode(int data)
{
Node *newNode = new Node();
newNode->data = data;
newNode->right = NULL;
newNode->left = NULL;
return newNode;
}
Node *Insert(Node *root, int data)
{
if (root ... | ALGO | 0.999963 | 5.892066 |
989ee3c1-7d8b-4841-9aba-ab41d011abd5 | gordijb/SP2023 | Laboratoriski/2_nedela/5cifrenSpecial.cpp | //Да се напише програма каде од стандарден влез се внесува еден 5 цифрен број.
// Програмата печати 1 доколку бројот е специјален, а 0 во спротивно.
//
//Еден број е специјален доколку за него важи дека е делив со збирот на својата втора
// и трета цифра и првата,третата и петтата цифра се во строго
//растечки редослед... | ALGO | 0.999111 | 3.919796 |
04c38142-205e-45d5-8ce2-f37054b45a23 | AkelaDumindu/flutter_authentication | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998733 | 6.76775 |
06789d76-3f69-4436-b68f-2ee664b6d17c | bgrimstad/splinter | thirdparty/Eigen/unsupported/bench/bench_svd.cpp | // Bench to compare the efficiency of SVD algorithms
#include <iostream>
#include <bench/BenchTimer.h>
#include <unsupported/Eigen/SVD>
using namespace Eigen;
using namespace std;
// number of computations of each algorithm before the print of the time
#ifndef REPEAT
#define REPEAT 10
#endif
// number of tests of t... | TEST | 0.99526 | 6.26191 |
72965d91-b937-4364-bc41-15ced53d977e | ehnryx/acm | codeforces/1179/a.cpp | #include <bits/stdc++.h>
using namespace std;
#define _USE_MATH_DEFINES
#define For(i,n) for (int i=0; i<n; i++)
#define FOR(i,a,b) for (int i=a; i<=b; i++)
#define Down(i,n) for (int i=n-1; i>=0; i--)
#define DOWN(i,a,b) for (int i=b; i>=a; i--)
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii... | ALGO | 0.999991 | 3.596112 |
d18aa5e9-eed0-4ef9-8b06-5fcddd2e7f7f | yqw1212/fuzztruction-llvm17.0.6 | libcxx/test/std/algorithms/alg.sorting/alg.min.max/max_init_list.pass.cpp | // UNSUPPORTED: c++03
// <algorithm>
// template <class T>
// T
// max(initializer_list<T> t);
#include <algorithm>
#include <cassert>
#include "test_macros.h"
int main(int, char**)
{
int i = std::max({2, 3, 1});
assert(i == 3);
i = std::max({2, 1, 3});
assert(i == 3);
i = std::max({3, 1, 2... | TEST | 0.982538 | 5.856247 |
92af5c9f-063c-436d-a266-8a31e173db12 | Aryaan-Chauhan-01/Cpp | Coding_questions/Fractionalknapsack.cpp | #include <bit/stdc++.h>
using namespace std;
struct Item
{
int profit,weight;
Item(int profit,int weight)
{
this->profit=profit;
this->weight=weight;
}
};
static fractionalKnapsack(int W,struct Item arr[],int N)
{
sort(arr,arr+N,cmp);
double finalvalue=0.0;
for(int i=0;i<N;i++)
{
if(arr[i]<=W)
{
W-... | ALGO | 0.999853 | 4.141549 |
a759ea94-8a75-4e18-b733-2033eec47f59 | muwasifk/competitive-programming | DMOJ/dmopc16c4p2.cpp | #include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
using namespace std;
struct batch{
int start, end, points;
};
batch batch[(int)1e6+3];
vector<int> failedcases;
int main(){
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int b; cin >> b;
... | ALGO | 0.999069 | 3.929168 |
1ef74a74-4522-4b19-b7aa-afa6695daa34 | UtkarshJain05/DSA | 5. BINARY SEARCH/1. BS on 1D Arrays/P10 - Single Element In Array/P10-Optimal.cpp | // Search Single Element In Array.(Optimal) --> TC : O(logN) SC : O(1)
#include <bits/stdc++.h>
using namespace std;
int fnc(vector<int> &arr)
{
int n = arr.size();
if (n == 1)
return arr[0];
if (arr[0] != arr[1])
return arr[0];
if (arr[n - 1] != arr[n - 2])
return arr[n - 1... | ALGO | 0.999917 | 4.98893 |
9004f7e8-3049-4741-bcdf-3874f7cf59f1 | priyadarshii786/LeetCode-Array-Easy | 121-best-time-to-buy-and-sell-stock/best-time-to-buy-and-sell-stock.cpp | class Solution {
public:
int maxProfit(vector<int>& prices) {
//jai ganesh
int maxProfit = 0;
int minPrice = INT_MAX;
for(int i=0;i<prices.size();i++)
{
minPrice = min(minPrice, prices[i]);
maxP... | ALGO | 0.999723 | 6.246619 |
2a24e8f2-04c9-492d-b4de-275ddbff6429 | yosefk/Tinymation | tinylib/image_dijsktra.cpp | #include <cstdint>
#include <algorithm>
#include <queue>
const float NO_PATH_DIST = 1000000; //output value for coordinates unreachable via non-zero points from the non-zero point closest to cx, cy
struct IDPoint
{
float dist;
int16_t x;
int16_t y;
bool operator<(const IDPoint& p) const { return dist < p.dist; }... | ALGO | 0.997762 | 4.765118 |
531f68f9-3512-43ac-a8b2-32c081143cc6 | GitHub-AmanBhardwaj/LeetCode-Problems | 1284-four-divisors/four-divisors.cpp | class Solution {
public:
int sumFourDivisors(vector<int>& nums) {
vector<int>factt;
vector<int>fact;
for(int i=0;i<nums.size();i++){
for(int j=1;j*j<=nums[i];j++){
if(nums[i]%j==0){
fact.push_back(j);
if(j!=nums[i]/j){
... | ALGO | 0.999915 | 6.154797 |
836d3caf-15dc-4eb7-aae4-f6e099995f89 | wonkyum-kim/introduction-to-algorithms | chapter 2/2.3-2 merge_sort_without sentinel.cpp | #include <algorithm>
#include <iostream>
#include <numeric>
#include <random>
#include <utility>
#include <vector>
std::mt19937 gen(std::random_device {}());
void merge(std::vector<int>& A, const int p, const int q, const int r)
{
int n1 = q - p + 1;
int n2 = r - q;
std::vector<int> L;
std::vector<in... | ALGO | 0.999817 | 5.53964 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.