uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
d3674b59-932b-4135-9cbf-fa14059d03b5 | sumonmd/Data-Structure- | 3rd maximum value from array.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int arr[]={454,3,234,23,98,12,234,454,34,98};
int a,b,c;
a=b=c=INT_MIN;
for(int i=0;i<10;i++){
if(arr[i]>a){
c=b;
b=a;
a=arr[i];
}
else if(arr[i]>b && arr[i]!=a){
c=b;
... | ALGO | 0.999771 | 3.680377 |
786a0d62-5013-42a4-b223-2fb22059bc2e | azurerazor/competitive-programming | Solutions/USACO/2019 January/sleepy-bronze.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
ifstream fin("sleepy.in");
ofstream fout("sleepy.out");
int n;
fin >> n;
vector<int> perm(n);
for (int i = 0; i < n; i++) fin >> perm[i];
int ans = 0;
for (int i = 1; i < n; i++) {
for (int j = 0; j < i; j++) {
... | ALGO | 0.999892 | 3.993642 |
b58bae0c-a33b-48f6-8eda-e12bc5f88e0e | kushalj/nd113-IntroToSDC | CPPBasics/while_and_for.cpp | #include <iostream>
int main() {
//TODO: Use this as a playground to write a for loop and if statements
// in the same program.
// For example, write a for loop that iterates from 0 to 80.
// If the iterator is greater than or equal to 0 but less than 10,
// output the phrase 'slow'
// I... | TOOL | 0.913472 | 3.551251 |
3415d5da-9bd0-4187-9097-2c28f564648a | Tim4ukys/Nonogram | cocos2d/cocos/math/Mat4.cpp | #include "math/Mat4.h"
#include <cmath>
#include "math/Quaternion.h"
#include "math/MathUtil.h"
#include "base/ccMacros.h"
NS_CC_MATH_BEGIN
Mat4::Mat4()
{
*this = IDENTITY;
}
Mat4::Mat4(float m11, float m12, float m13, float m14, float m21, float m22, float m23, float m24,
float m31, float m32, f... | TOOL | 0.978674 | 7.262756 |
bf9e47ab-4cf2-4c1a-a02e-b363ac7cca3c | joshpeterson/DevelopingConcurrentSoftware | Lectures/Introduction to MPI/MPI Gauss/Library/gauss_task.cpp | #include "gauss_task.h"
gauss_task::gauss_task() : sum_(0) {}
void gauss_task::map(unsigned int begin, unsigned int end)
{
for (auto i = begin; i <= end; ++i)
sum_ += i;
}
unsigned int gauss_task::reduce(unsigned int input)
{
sum_ += input;
return sum_;
}
int gauss_task::get_sum() const
{
re... | TOOL | 0.980043 | 4.543683 |
c43a252d-369b-4155-b0ab-262ca56e5ac3 | GhulamMustafaGM/ILoveProgramming | CountDiffNums.cpp | // positive, negative and zero numbers
#include<iostream>
using namespace std;
int main()
{
int countp = 0, count = 0, countz = 0, arr[10], a;
cout << "Enter 10 numbers:";
for (a = 0; a < 10; a++)
{
cin >> arr[a];
}
for(a=0; a<10; a++)
if (arr[a] < 0)
{
count++;
}
else if (arr[a] == 0)
{
coun... | ALGO | 0.996789 | 3.62791 |
fbe87d08-0405-4fcf-9f3f-653b2189df03 | tridipdowari/DSA | SearchingAndSorting/08_FirstBadVersion.cpp | // Problem: First Bad Version
// Link: https://leetcode.com/problems/first-bad-version/
// Difficulty: Easy
#include <iostream>
using namespace std;
// Time Complexity: O(log n)
// Space Complexity: O(1)
// Mock API
bool isBadVersion(int version) {
int bad = 4; // Simulated first bad version
return ver... | ALGO | 0.996689 | 7.047723 |
6ed65b2e-4cb8-4e60-9df4-3768ea541538 | temi724/Building-a-CRUD-app-with-flutter | 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 |
da1241f8-44cd-4bcb-83b5-d6559550c9db | Tsh007/DSA | combinedDsa/combinedDsa/DP/6_house_robber_2.cpp | ////
//// 6_house_robber_2.cpp
//// combinedDsa
////
//// Created by Tejash Singh on 27/10/24.
////
//
//#include <stdio.h>
//#include "bits/stdc++.h"
//
//
//using namespace std;
//
//
////recursive
////int customFunc(vector<int>&nums,int idx,int flag){
////
//// if(idx == 0){
//// if(flag)return 0;
/... | ALGO | 0.999915 | 5.475401 |
bd8d798e-96e4-4553-a79f-0ea4de394a17 | Remyuu/GAMES202-Homework | HW2/prt/ext/eigen/doc/examples/Tutorial_BlockOperations_print_block.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace std;
int main()
{
Eigen::MatrixXf m(4,4);
m << 1, 2, 3, 4,
5, 6, 7, 8,
9,10,11,12,
13,14,15,16;
cout << "Block in the middle" << endl;
cout << m.block<2,2>(1,1) << endl << endl;
for (int i = 1; i <= 3; ++i)
{
cout << "B... | ALGO | 0.991726 | 3.6853 |
75a8535b-744c-4e97-b093-0f7b64f49903 | MVARUNREDDY8203/LEETCODE_- | 3455-minimum-length-of-string-after-operations/minimum-length-of-string-after-operations.cpp | class Solution {
public:
int minimumLength(string s) {
int freq[26];
memset(freq, 0, sizeof(freq));
int n = s.size(), ans = s.size();
for (int i=0; i<n; i++) {
freq[s[i] - 'a']++;
if (freq[s[i] - 'a'] == 3) {
ans -= 2;
freq[s[i]... | ALGO | 0.99994 | 6.209776 |
70326459-13dd-4793-82e8-6644a46f4353 | gayathriravipati/Leetcode_solved_problems | 0513-find-bottom-left-tree-value/0513-find-bottom-left-tree-value.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.99999 | 6.1621 |
39cbbe15-ec28-4926-b782-db8e0d3fa985 | ninu222/word | 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.998859 | 6.785645 |
d9142d52-4f6f-4cd7-91de-b5c5ecd714a7 | Maserhe/LeetCode | 242.有效的字母异位词.cpp | /*
* @lc app=leetcode.cn id=242 lang=cpp
*
* [242] 有效的字母异位词
*/
// @lc code=start
class Solution {
public:
bool isAnagram(string s, string t) {
// 字母桶 的 使用。
// 单词数 相同, 字母的个数也要相同。
// 用两个字母桶
if (s.size() != t.size()) return false;
int bucket[26] = {0};
fo... | ALGO | 0.999919 | 6.014633 |
e460962c-f5c1-4db0-a6dd-4952889b1d94 | dongyulin89/dataStructure | 1. Queue/Queue_Circular.cpp | class MyCircularQueue{
private:
vector<int> data;
int head;
int tail;
int size;
public:
/* Initialize your data structure here. Set the size of the queue to be k. */
MyCircularQueue(int k){
data.resize(k);
head = -1;
tail = -1;
size = k;
}
/* Insert an ele... | ALGO | 0.998541 | 5.453021 |
6cbba9c8-1430-44bc-9f38-dce2a92c4ae2 | Laxmikant3/Leet-Dsa | 0104-maximum-depth-of-binary-tree/0104-maximum-depth-of-binary-tree.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.999746 | 6.71236 |
1a7e276a-1ac4-4322-a58e-838855a370ee | myCigar/Cpp-Primer | ch13/ex13_31_HasPtr.cpp | #include "ex13_31_HasPtr.h"
#include <iostream>
#include <algorithm>
#include <vector>
void swap(HasPtr& v1, HasPtr& v2)
{
using std::swap;
swap(v1.ps, v2.ps);
swap(v1.i, v2.i);
std::cout << "void swap(HasPtr& v1, HasPtr& v2)" << std::endl;
}
HasPtr& HasPtr::operator=(HasPtr v)
{
swap(*this, v);
... | TOOL | 0.996418 | 3.978144 |
b35a1a2d-7d0a-4db0-9ff7-b85f4e3af915 | coltenwebb/rt | main.cpp | #include "rtweekend.h"
#include "sphere.h"
#include "hittable_list.h"
#include "color.h"
#include "camera.h"
#include "material.h"
#include <iostream>
color ray_color(const ray& r, const hittable& world, int depth) {
if (depth <= 0) {
return color(0,0,0);
}
hit_record rec;
if (world.hit(r, 0.001, infin... | ALGO | 0.977855 | 5.390241 |
54f3742d-b74a-455e-bba8-81f568d58bac | xinyu-yang/dl.cpp | linear.cpp | #include <cassert>
#include <iostream>
#include <stack>
#include <vector>
#include <cmath>
#include <random>
#include "layer.h"
class Linear : public Layer {
private:
int inputSize_;
int outputSize_;
std::vector<std::vector<double>> weights_;
std::vector<double> biases_;
std::stack<std::vector<std:... | ALGO | 0.996048 | 5.327769 |
3d69e599-eda8-4037-a82b-2107d87c66fb | farhanraza967/Functions | Minimum number.cpp | #include <iostream>
using namespace std;
int minimum(int a, int b, int c){
int min = a;
if (b < min) min = b;
if (c < min) min = c;
return min;
}
int main(){
int x, y, z;
cout << "Enter three integers: ";
cin >> x >> y >> z;
int minNum = minimum(x, y, z);
cout << "The smallest number... | ALGO | 0.998398 | 4.179719 |
9c1d0cfd-32e7-4be5-89e4-e136952244cf | Oracynx/Source-Code | Problem/Luogu/P5431.cpp | #include <cstdio>
const int MaxN = 5e6 + 5;
long long n, mod, k;
long long a[MaxN];
long long s[MaxN];
long long p[MaxN];
int main()
{
scanf("%lld%lld%lld", &n, &mod, &k);
for (int i = 1; i <= n; i++)
{
scanf("%lld", &a[i]);
}
s[n] = a[n];
for (int i = n - 1; i >= 1; i++)
{
s... | ALGO | 0.999959 | 3.365128 |
d2cdd38e-33e5-40fb-bb1f-86e56ae770d8 | wangfuli217/ld_note | cheatsheet/ops_doc-master/cii/next/datastruct/tree/rbtree/cplus/RBTreeTest.cpp | /**
* C++ 语言: 二叉查找树
*
* @author skywang
* @date 2013/11/07
*/
#include <iostream>
#include "RBTree.h"
using namespace std;
int main()
{
int a[]= {10, 40, 30, 60, 90, 70, 20, 50, 80};
int check_insert=0; // "插入"动作的检测开关(0,关闭;1,打开)
int check_remove=0; // "删除"动作的检测开关(0,关闭;1,打开)
int i;
int ilen = (sizeof(a)) / (... | ALGO | 0.988019 | 4.637103 |
1aab9955-f890-42f0-a523-179f90d4536c | ProgramExecuter/StriverSDESheet | Day03-Arrays/14__PowerXN.cpp | // Time Complexity - O(logn)
// Space Complexity - O(1)
class Solution {
public:
double myPow(double x, int n) {
double ans = 1.0;
// Taking N as long long for the case n = INT_MIN
// since integer goes from -2^31 -> 2^31-1
// we have one less range in +ve side
lon... | ALGO | 0.999907 | 6.280087 |
23830a63-c2f9-4cf9-b0d1-4b4e0e50c0e0 | Shubhamt45054/6Companies30days | Microsoft/07_Bulls and Cows.cpp | // https://leetcode.com/problems/bulls-and-cows/description/
class Solution {
public:
string getHint(string s, string g) {
int x=0,y=0;
int n=s.size();
map<char,int> mp;
for(int i=0;i<n;i++){
if(s[i]==g[i]){
x++;
s[i]='X';
}
... | ALGO | 0.999938 | 5.774145 |
1d8d9c9c-201a-4f48-8a05-b152f9e8e613 | attnishit/Competitive-Programming | codeforces/Codeforces Global Round 5 by User nishit5/A - Balanced Rating Changes.cpp |
1237 A - Balanced Rating Changes.cpp GNU C++17 Accepted
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ldb = long double;
using pa = pair < ll, ll >;
using vec = vector < ll >;
#define pb push_back
#define F first
#define S second
#define f(i,x,n) for(ll i=x;i<n;i++)
#define all(c) c.begi... | ALGO | 0.999987 | 4.219997 |
8fe775c4-b6db-448b-9cc0-96bfed1007c9 | kaist-ina/stellatrain | backend/src/optim/sgd_naive.cpp | #include "sgd_naive.h"
void SGDNaive::optimize(torch::Tensor ¶m, const std::string &name, torch::Tensor &grad_values, torch::Tensor &grad_indices) {
// checkValidity(param, grad_values, grad_indices);
at::Tensor dense_grad = torch::zeros_like(param);
dense_grad.index_put_({grad_indices}, grad_values,... | ALGO | 0.970068 | 6.191415 |
6d8d763a-9973-4623-a4ea-31ec56160a5c | bsdshell/cpp | power2.cpp | #include<iostream>
#include<vector>
#include<string>
#include<cmath>
using namespace std;
//[file=power2.html title=""
bool power2(int n){
if(n == 0 || n == 1 )
return true;
else{
if(n % 2 != 0)
return false;
else
return power2(n/2);
}
}
bool fastPower2(i... | ALGO | 0.996033 | 4.570853 |
10642f8d-fb06-4b5e-9658-1dfe64065c47 | ashokabairwaideology/Leet-code-problem | solution/2100-2199/2156.Find Substring With Given Hash Value/Solution.cpp | class Solution {
public:
string subStrHash(string s, int power, int modulo, int k, int hashValue) {
long long h = 0, p = 1;
int n = s.size();
for (int i = n - 1; i >= n - k; --i) {
int val = s[i] - 'a' + 1;
h = ((h * power % modulo) + val) % modulo;
if (i ... | ALGO | 0.999983 | 6.297763 |
7d422351-a738-4ff4-88bf-48ba796d5d66 | ruds18/DSA-Practice | 0058-length-of-last-word/0058-length-of-last-word.cpp | class Solution {
public:
int lengthOfLastWord(string s) {
int len = 0, tail = s.length() - 1;
while (tail >= 0 && s[tail] == ' ') tail--;
while (tail >= 0 && s[tail] != ' ') {
len++;
tail--;
}
return len;
}
}; | ALGO | 0.999133 | 5.650458 |
e5c8556d-cf3a-4303-b1f6-8e3886eab80e | ishandutta2007/codeforces | quang/normal/1152/F2.cpp | #include <bits/stdc++.h>
using namespace std;
const int M = 4;
const int K = 13;
const int N = K * (1 << M) + 1;
const int MOD = 1000000007;
inline int add(int u, int v) {
return (u += v) >= MOD ? u - MOD : u;
}
inline int sub(int u, int v) {
return (u -= v) < 0 ? u + MOD : u;
}
inline int mul(int u, int v... | ALGO | 0.999968 | 3.741338 |
160d7c25-c694-4b19-b57e-db9121111fbb | OasisGallagher/SimpleGraphicEngine | Graphics/engine/src/camera.cpp | #include <cstring>
#include "camera.h"
#include "transformation.h"
#include "object.h"
#include "renderlist.h"
#include <functional>
#include "gdef.h"
#define ShadeModeGouraud
Camera::Camera(float ms, float rs, int viewportWidth) {
attribute.farPlane = 1000;
attribute.initPosition.Set(0, 12.f, -50);
attribute.look... | TOOL | 0.850464 | 5.805829 |
c448e890-0f0e-49f2-9dd5-b1307200c4de | devraghav14/DSA | Arrays/Integer Array Questions/UniqueElement.cpp | #include <iostream>
#include <vector>
using namespace std;
int findUnique(vector<int> arr)
{
int ans = 0;
for (int i = 0; i < arr.size(); i++)
{
ans = ans ^ arr[i];
}
return ans;
}
int main()
{
int arrayLength;
cout << "Enter the length of array : ";
cin >> arrayLength;
... | ALGO | 0.99837 | 5.369917 |
1d8f9dda-3cf0-49d1-9d24-d2e8d574bcb2 | chengshunzhang/my_leetcode | 1-100/37_Sudoku_Solver/37_Sudoku_Solver.cpp | #include <vector>
#include <iostream>
using namespace std;
struct grid {
int val;
int row;
int col;
int block;
grid(int v, int r, int c, int b): val(v), row(r), col(c), block(b) {}
};
class Solution {
public:
void solveSudoku(vector<vector<char> >& board) {
vector<grid> grids;
bool row[9][9] ... | ALGO | 0.999869 | 5.969816 |
e2b7f0e9-6918-4223-b99c-28aee4722e53 | lam-ntt/practice-at-ptit | dsa/DSA07013_tinh_gia_tri_bieu_thua_hau_to.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int t; cin >> t;
while(t--){
string s; cin >> s;
stack<int> st;
for(int i=0; i<s.size(); i++){
if(s[i]>='0'&&s[i]<='9') st.push(s[i]-'0');
else{
int a=st.top(); st.pop();
int b=st.top(); st.pop();
if(s[i]=='+') st.push(b+a);
else if... | ALGO | 0.999861 | 4.128951 |
888f8d65-457d-42fc-9806-b54e574f203f | GH2005/myLeetcodeSolutions | 122. Best Time to Buy and Sell Stock II.cpp | class Solution {
public:
int maxProfit(vector<int>& prices) {
int sum = 0;
for (int pos = 1; pos < prices.size(); pos++)
{
int diff = prices[pos] - prices[pos-1];
if (0 < diff) sum += diff;
}
return sum;
}
};
| ALGO | 0.999879 | 5.93887 |
da962b7e-bb40-4455-ae9d-5b192cc37649 | ivorymood/ALGORITHM | PROGRAMMERS/LEVEL_02/Q12899_ver2.cpp | //https://programmers.co.kr/learn/courses/30/lessons/12899
//124
#include <iostream>
#include <string>
#include <vector>
using namespace std;
string solution(int n) {
string answer = "";
// 3 012 = 124 412
char num[] = { '4', '1', '2' };
while (n > 0)
{
int rest = n % 3;
n /... | ALGO | 0.999767 | 5.398004 |
ed24501e-afc2-430c-a3f8-289b21ca38ce | qap2102/DSA-PTIT | QHD Fibo.cpp | #include <bits/stdc++.h>
using namespace std;
#define faster \
ios::sync_with_stdio(false); \
cin.tie(0); \
cout.tie(0);
#define ll long long
#define fi first
#define se second
const int MOD = 1e9+7;
const int N=1e6+5;
ll t,n,x,k;
int n1,x1,k1;
ll a[N], b[N], c[N*2];
vect... | ALGO | 0.999971 | 3.752098 |
9a743eef-af0f-4caa-bb99-ea7ccedba8c3 | Prajakta740/Cpp-Lab-Practicals | evenornot.cpp | // WAP to read a number and check wheather the number is even or odd.
#include<iostream>
using namespace std;
int main()
{
int n;
cout<<"\n enter the value.";
cin>>n;
if(n%2==0)
{
cout<<n<<" is even number.";
}
else
{
cout<<n<<" is odd number.";
}
return 0;
}
| ALGO | 0.989001 | 3.045169 |
b6389627-120e-4da1-9123-9313806d3b30 | QWERx29/Code | Luogu/B/B_2051.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int x, y;
cin >> x >> y;
if (x <= 1 && x >= -1 && y >= -1 && y <= 1)
cout << "yes";
else
cout << "no";
return 0;
} | ALGO | 0.999869 | 3.47092 |
ef8cc8bb-98d4-4440-9e9c-0f6ef1f65e9a | saranpn/Leetcode | Arrays/Create Target Array in the Given Order.cpp | // Source : https://leetcode.com/problems/create-target-array-in-the-given-order/
// Author : Saravana Kumar
/****************************************************************************************************
Given two arrays of integers nums and index. Your task is to create target array under the following rules:
... | ALGO | 0.999969 | 6.705091 |
fc83a372-4666-4224-be38-f4b9707c7470 | AkashSingh3031/Complete-LeetCode-Premium-Problems | 0251-flatten-2d-vector/0251-flatten-2d-vector.cpp | class Vector2D {
vector<vector<int>>::iterator i, iEnd;
int j = 0;
public:
Vector2D(vector<vector<int>>& vec2d) {
i = vec2d.begin();
iEnd = vec2d.end();
}
int next() {
hasNext();
return (*i)[j++];
}
bool hasNext() {
while (i != iEnd && j == (*i).size... | ALGO | 0.986962 | 6.409325 |
737f352e-b486-416c-a4e3-ed650ef1d884 | fsq/hackerrank | LCS Returns.cpp | #include "stdc++.h"
string a, b;
int n, m;
int main() {
ios::sync_with_stdio(false);
cin >> a >> b;
n = a.size(), m = b.size();
a.insert(a.begin(), ' ');
b.insert(b.begin(), ' ');
VVI f(n+4, VI(m+4));
VVI g(n+4, VI(m+4));
REP(i, 1, n)
REP(j, 1, m)
f[i][j] = a[i]==b... | ALGO | 0.999932 | 3.81798 |
973eec4b-7d8a-44de-9a13-d0a6d1f45dbc | Yu-Muro/kyoupuro_lib | ABC/ABC303/b.cpp | #include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
#define mp make_pair
#define pb(a) push_back(a)
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pll pair<ll, ... | ALGO | 0.999959 | 3.595589 |
dc5d2615-e193-410a-8efa-416c7c0388e1 | Karanjit08/LeetCode | 0796-rotate-string/0796-rotate-string.cpp | class Solution {
public:
bool rotateString(string s, string goal) {
string ans = s;
int i;
int n = s.length();
char ch;
int count=0;
while(count<n)
{
char ch = ans[0];
ans = ans.substr(1,n);
ans.push_back(ch);
... | ALGO | 0.999972 | 5.632062 |
33669ced-c0c3-4062-a9eb-c46a187c480e | himanshu062/geeksforgeeks-potd | Medium/2024/05-01-2024 - Count possible ways to construct buildings.cpp | //{ Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution{
public:
int TotalWays(int N)
{
// Code here
const long long mod = 1e9 + 7;
vector<vector<long long>> dp(N + 1, vector<long long> (2, 1));
for(int i = N - 1; i > -1; i--){
dp[... | ALGO | 0.99996 | 6.058889 |
6e467623-a850-4543-a987-45e3a5cc7730 | Zlin0509/Zlin_ACM | _Luogu/P3128 [USACO15DEC] Max Flow P.cpp | #include "bits/stdc++.h"
using namespace std;
const int N = 2e5 + 5;
int n, k, ans = 0;
vector<int> e[N];
int dep[N], fa[N][22], sum[N];
inline void dfs(int u, int f)
{
dep[u] = dep[f] + 1;
fa[u][0] = f;
for (int i = 1; i <= 19; i++)
fa[u][i] = fa[fa[u][i - 1]][i - 1];
for (int v : e[u])
... | ALGO | 0.999918 | 4.212362 |
ad61dd98-a3f5-4dc5-9049-26f711fe3c8f | ShauryaP8/CSES | Intro Problems/tower_of_hanoi.cpp | #include <iostream>
#include <vector>
using namespace std;
// A utility function to print a move
void printMove(int fromPeg, int toPeg) {
cout << fromPeg << " " << toPeg << endl;
}
// The recursive function to print the solution
void towerOfHanoi(int n, int fromPeg, int toPeg, int auxPeg, vector<pair<int, int>>& ... | ALGO | 0.999987 | 6.609094 |
0e93a644-8f80-45aa-8383-f6ea55a661a2 | qiaozishun4/CSP2024_BJ | BJ-Senior/answers/BJ-S01632/duel/duel.cpp | #include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int main(){
freopen("duel.in","r+",stdin);
freopen("duel.out","w+",stdout);
int listLength,attackTimes=0;
cin>>listLength;
int dataList[listLength],attackedList[listLength];
for(int i=0;i<listLength;i++){
cin>>d... | ALGO | 0.999951 | 3.153995 |
046e13e9-1ccd-4c6d-a6b6-d5eebb4d344a | ghali/gcb | GLOW/19/sproull/sproull.cpp | #include <iostream>
using std::cout;
using std::endl;
#include <cmath>
#include "raster_image/image.h"
#include "misc/clock.h"
//----------------Point_E2i_Begin----------------
struct Point_E2i {
int x, y;
Point_E2i(int x, int y) : x(x), y(y) {}
};
//----------------Point_E2i_End----------------
//-----------... | ALGO | 0.966277 | 4.08916 |
d3657069-97c2-41c0-a730-8b449eaa69e8 | AimarPaolo/CodeForces | prova11.cpp | /******************************************************************************
Online C++ Compiler.
Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.
******************************************... | ALGO | 0.999747 | 4.513155 |
3f27c28a-b03b-406e-9c50-191a6d821abd | SmartActiveNode2/san2 | crypto/ossl/osslmathimpl.cpp | /* =============================================================== @
* DragonSRP, C++ library implementing Secure Remote Protocol *
* Pavel Slechta <<EMAIL>> *
@ =============================================================== */
/* =============================================... | ALGO | 0.995651 | 5.37694 |
6b002cac-40a2-4662-ba17-4e5ed1755158 | shamsulhaquesami01/L-1-T-1 | cp/pyra_mid_.cpp | #include<iostream>
using namespace std;
int main(){
int n;
cin>>n;
for(int i=1; i<= n; i++){
int spaces = n-i;
for(int j=0; j<spaces; j++)
{
cout<<" ";
}
for(int j=0; j<i; j++)
{
if(j==0)
{
cout<<"*";
}
else
{
cout<<".*";
... | ALGO | 0.999939 | 3.770719 |
d1442cd2-579b-4de5-93f9-731e5616478f | jrzvnn/kattis-solutions | different.cpp | #include <bits/stdc++.h>
typedef long long ll;
using namespace std;
void solve() {
ll a, b;
while(cin >> a >> b) {
cout << abs(a - b) << '\n';
}
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
solve();
return 0;
}
| ALGO | 0.999852 | 3.822178 |
52b3f695-f57c-4d17-9e69-5fe542c8ee81 | chitrasaindane/CPP | Stack/infix_to_postfix.cpp | #include <iostream>
#include <stack>
#include <string>
using namespace std;
int precedence(char op) {
if (op == '+' || op == '-') return 1;
if (op == '*' || op == '/') return 2;
if (op == '^') return 3;
return 0;
}
bool isOperator(char c) {
return c == '+' || c == '-' || c == '*' || c == '/' || c ... | ALGO | 0.999494 | 6.181533 |
32a9237a-67de-4fbc-904b-ada4900dafc2 | manikanta2901/ubuntu | .history/SRM/placementPractice/HackerRank/DataStructure/ArrayManupulation_20210320134046.cpp | #include<bits/stdc++.h>
using namespace std;
int main() {
long int size ,queries,max=0,answer=0;
cin>> size >>queries;
vector<int>numbers(size + 1);
for(int i=0;i <queries;i++){
int numbers,b,sum;
cin >> a >> b >> sum;
numbers[a]+=sum;
if((b + 1) <= size ){
... | ALGO | 0.999457 | 3.880378 |
0ca8b6ac-5cce-4a08-b302-86ca7f8eb38b | ishandutta2007/codeforces | andr1y/normal/617/A.cpp | #include <bits/stdc++.h>
#define ld long double
#define ll long long
#define ull unsigned ll
#define pll pair<ll, ll>
#define itr(a) begin(a), end(a)
#define pb push_back
#define x first
#define y second
#define endl '\n'
#define FAST cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
#define FILES(namein, nameout)... | ALGO | 0.999856 | 4.087439 |
9e12b5db-2dba-4229-acc4-5482ea14a0d4 | MagicConchCpp/LeetCode | code/19.删除链表的倒数第n个节点.cpp | /*
* @lc app=leetcode.cn id=19 lang=cpp
*
* [19] 删除链表的倒数第N个节点
*/
// @lc code=start
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
#include <bits/stdc++.h>
#ifndef LISTNODE_H
#define LISTNODE_H
struct L... | ALGO | 0.999949 | 6.460318 |
0f8f3424-513a-4aea-aa42-033bb677bb01 | DerrickPikachu/Leetcode | submission/Smallest_Subtree_with_all_the_Deepest_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) {}
* };
*/
class Solution {
private:
TreeNode* target, *now;
bool helper(TreeNode* node, int& depth, int nowDepth = 1, boo... | ALGO | 0.999371 | 6.231492 |
867714f8-ad53-4b0c-85e4-bef6bc34bdf6 | jiji40/SAP | e.cpp | #define _CRT_SECURE_NO_WARNINGS
#define KEY_LENGTH 16
#define MESSAGE_CHUNK 160
#include <iostream>
#include <string.h>
#include <fstream>
#include <malloc.h>
#include <openssl/md5.h>
#include <openssl/aes.h>
#include <openssl/sha.h>
#include <openssl/applink.c>
#include <openssl/pem.h>
#include <openssl/rsa.h>
void g... | TOOL | 0.915891 | 4.070737 |
49363ef5-b26f-48c4-a3b2-827a256f6e25 | ladybouy/Simulation | src/main.cpp | #include <chrono>
#include <fstream>
#include <iostream>
#include <iomanip>
#include "MathUtlities.hpp"
#include <memory>
#include <string>
#include <vector>
#include "Simulation.hpp"
int main(int argc, char **argv)
{
// Constants
double mass = 0.145; // kg
double diameter = 0.075; // m
d... | ALGO | 0.960723 | 5.793219 |
f9bcb540-0514-40bd-8722-21eace7b0bac | sos0911/Physics_simulation_project | Final_term_project/include/Box2D/Dynamics/Contacts/b2ChainAndPolygonContact.cpp | #include "Box2D/Dynamics/Contacts/b2ChainAndPolygonContact.h"
#include "Box2D/Common/b2BlockAllocator.h"
#include "Box2D/Dynamics/b2Fixture.h"
#include "Box2D/Collision/Shapes/b2ChainShape.h"
#include "Box2D/Collision/Shapes/b2EdgeShape.h"
#include <new>
b2Contact* b2ChainAndPolygonContact::Create(b2Fixture* fixtureA... | ALGO | 0.992037 | 6.329686 |
28ea2404-644d-4fb4-9b7f-abd60ba750ae | jfedorov/gromacs | src/gromacs/mdlib/calcvir.cpp | /* This file is completely threadsafe - keep it that way! */
#include "gmxpre.h"
#include "calcvir.h"
#include "config.h" /* for GMX_MAX_OPENMP_THREADS */
#include <algorithm>
#include "gromacs/math/vec.h"
#include "gromacs/math/vectypes.h"
#include "gromacs/mdlib/gmx_omp_nthreads.h"
#include "gromacs/pbcutil/ishif... | ALGO | 0.999598 | 5.715299 |
03f9d73d-9c5d-4e88-bf4a-b9ab5a78539a | sarthidarji128/12Sarthi_23-27_Sem-1_100_CPP_Programs | project_92.cpp | #include <iostream>
using namespace std;
int main() {
int rows = 6;
int cols = 6;
for (int i = 1; i <= rows; i++) {
for (int j = 1; j <= cols; j++) {
if (i == 1 || i == rows || j == 1 || j == cols) {
cout << "*";
} else {
cout << " ";
... | ALGO | 0.879906 | 3.984655 |
206d85ce-6ea7-4429-b9e9-113aac092bde | Molmin/molmin.github.io | problem/46/code.cpp | // 2022.10.02
#include<bits/stdc++.h>
using namespace std;
const int mod=998244353;
long long power(long long x,long long n=mod-2){
if(n==0)return 1ll;
long long tmp=power(x,n>>1ll);
tmp=tmp*tmp%mod;
if(n&1ll)tmp=tmp*x%mod;
return tmp;
}
long long fac[100001],invfac[100001];
void initfac(int N){
... | ALGO | 0.99998 | 4.502265 |
47a432b3-4720-463f-886b-a2a9befded5a | ishandutta2007/codeforces | origenes/normal/1542/D.cpp | #include <bits/stdc++.h>
#include <utility>
namespace atcoder {
namespace internal {
// @param m `1 <= m`
// @return x mod m
constexpr long long safe_mod(long long x, long long m) {
x %= m;
if (x < 0) x += m;
return x;
}
// Fast moduler by barrett reduction
// Reference: https://en.wikipedia.org/wiki/B... | ALGO | 0.999566 | 4.586275 |
55288ac0-4a16-4c95-913b-678e81b0f26f | ShivPatel031/DSA | Graph/Find_the_City_With_the_Smallest_Number_of_Neighbors_at_a_Threshold_Distance.cpp | // Find the City With the Smallest Number of Neighbors at a Threshold Distance leetcode 1334
// There are n cities numbered from 0 to n-1. Given the array edges where edges[i] = [fromi, toi, weighti] represents a bidirectional and weighted edge between cities fromi and toi, and given the integer distanceThreshold.
//... | ALGO | 0.999995 | 6.732882 |
25dd4d23-2a54-450e-847f-50c84fbbe25f | windcry1/My-ACM-ICPC | SWUST OJ/0605.cpp | //Author:LanceYu
#include<iostream>
#include<string>
#include<cstring>
#include<cstdio>
#include<fstream>
#include<iosfwd>
#include<sstream>
#include<fstream>
#include<cwchar>
#include<iomanip>
#include<ostream>
#include<vector>
#include<cstdlib>
#include<queue>
#include<set>
#include<ctime>
#include<algorithm>
#includ... | ALGO | 0.999996 | 3.517821 |
7408c96a-0609-4a73-9725-6d7eaa6968d6 | michaelwh/robots-avrcode | pwm.cpp | #include <avr/io.h>
#include <inttypes.h>
#include <stdlib.h>
#include <avr/interrupt.h>
#include <util/delay.h>
#include "pwm.hpp"
#include "config.hpp"
/*
* pwm.cpp
*
* Created on: Apr 11, 2012
* Author: rt5g11
*/
PWM::PWM() {
//Sets the prescaler of the timer to
uint8_t sreg;
sreg = SREG;
//_target_v... | TOOL | 0.946549 | 4.989235 |
60413785-9933-47f8-b494-ec5787b7a522 | Iman-Howlader/Competitive-Programming | CSES Problem Set/Repetitions.cpp | /**
* Author : iman320
* Created: 2023-10-19 19:42:41
**/
#include <bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define nl '\n'
#define ll long long
#define ve vect... | ALGO | 0.999941 | 4.188207 |
952f1a9c-76aa-4e61-a707-77a0c556d5fd | ishandutta2007/codeforces | i_love_tigersugar/normal/920/C.cpp | #include<bits/stdc++.h>
#define FOR(i,a,b) for (int i=(a),_b=(b);i<=_b;i=i+1)
#define FORD(i,b,a) for (int i=(b),_a=(a);i>=_a;i=i-1)
#define REP(i,n) for (int i=0,_n=(n);i<_n;i=i+1)
#define FORE(i,v) for (__typeof((v).begin()) i=(v).begin();i!=(v).end();i++)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#defi... | ALGO | 0.999992 | 3.62777 |
a57ae9d1-9b01-4fe7-8edc-7586c6d2dbea | render3d/AKS | CUDA/NVIDIA_CUDA-11.4_Samples/7_CUDALibraries/simpleCUBLAS_LU/simpleCUBLAS_LU.cpp | /*
* This example demonstrates how to use the cuBLAS library API
* for lower-upper (LU) decomposition of a matrix. LU decomposition
* factors a matrix as the product of upper triangular matrix and
* lower trianglular matrix.
*
* https://en.wikipedia.org/wiki/LU_decomposition
*
* This sample uses 10000 matrices... | ALGO | 0.999478 | 4.054811 |
782994a6-cae1-4700-a65c-48cd59055504 | michaeleggers/Bayernstein | dependencies/bullet/src/Bullet3OpenCL/BroadphaseCollision/b3GpuParallelLinearBvhBroadphase.cpp | /*
This software is provided 'as-is', without any express or implied warranty.
In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it f... | ALGO | 0.972663 | 6.246934 |
8cc30dd9-4557-44f1-92cc-f4299b35aeb0 | kk-laoguo/ollvm-13 | llvm-project-13/libcxx/test/libcxx/ranges/range.adaptors/range.copy.wrap/no_unique_address.pass.cpp | // UNSUPPORTED: c++03, c++11, c++14, c++17
// UNSUPPORTED: libcpp-no-concepts
// UNSUPPORTED: gcc-10
// UNSUPPORTED: libcpp-has-no-incomplete-ranges
// This test ensures that <copyable-box> behaves correctly when it holds an empty type.
#include <ranges>
#include <cassert>
#include <utility>
bool copied = false;
bo... | TEST | 0.893878 | 6.736486 |
cf4efeb2-7ec7-44c4-87e1-6e72b2e75bb5 | protasov-ilja/BasicsofProjectActivitiesCpp | simple_progs/linear_equation.cpp | #include <cstdio>
int main()
{
//1. prompt user to enter coefficients
std::puts("please enter a and b for 'ax + b = 0':");
//2. read coefficients for equatio ax + b = 0
int a = 0;
int b = 0;
std::scanf("%d %d", &a, &b);
//3. slove equation ax + b = 0
//solution: x = -b/a
int x = -... | ALGO | 0.998923 | 3.947668 |
2fceef01-76ef-4936-adb9-65a20bab738f | Sardaar2003/CODING-DEVELOPMENT-SKILLS | C++/Stack_Basic_Way.cpp | #include <bits/stdc++.h>
using namespace std;
typedef struct stack
{
int capacity;
int top;
int *array;
} Stack;
Stack *intitial(int capacity)
{
Stack *st = (Stack *)malloc(sizeof(Stack));
st->capacity = capacity;
st->top = -1;
st->array = (int *)malloc(sizeof(int) * capacity);
}
bool isEmp... | ALGO | 0.999456 | 4.366865 |
add25adf-7697-4638-a64d-3728feee91d4 | Viper-10/Problem-Solving | hackerrank/Game of Two Stacks.cpp | #include <bits/stdc++.h>
using namespace std;
string ltrim(const string &);
string rtrim(const string &);
vector<string> split(const string &);
int dp(int maxSum, vector<int> &a, vector<int> &b)
{
int n = a.size(), m = b.size();
int ans = 0;
int64_t sum = 0;
int i;
for (i = 0; i < n; ++i)
{
sum += a... | ALGO | 0.999935 | 4.257695 |
6da56285-dd9a-4c0f-a329-5b09e5d59937 | heyimShivam/Algorithm | DP/GoldMineProblem.cpp | #include<bits/stdc++.h>
using namespace std;
int collectGold(vector<vector<int>> gold, int x, int y, int n, int m) {
if ((x < 0) || (x == n) || (y == m)) {
return 0;
}
int rightUpperDiagonal = collectGold(gold, x - 1, y + 1, n, m);
int right = collectGold(gold, x, y + 1, n, m);
int rightLowerDiagonal = collectG... | ALGO | 0.999955 | 4.790012 |
f0b7f1e6-dfe8-4352-a8ce-89ec01ca6b0d | llynv/CP-files | codeforce/1890B.cpp | #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#pragma GCC optimize("O3", "unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#define LINVG
#define int long long
#define ii pair<int, int>
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).... | ALGO | 0.999952 | 4.344982 |
0a09f1d4-8164-487c-851b-a394d2ac3dc1 | cran/emIRT | src/getExx_ordIRT.cpp | // -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 4 -*-
#include <RcppArmadillo.h>
using namespace Rcpp;
// // [[Rcpp::export()]]
arma::mat getExx_ordIRT(const arma::mat &Ex,
const arma::mat &Vx,
const int nN
){
int i;
arma::mat result(nN, 1);
#pra... | ALGO | 0.999013 | 3.989923 |
e9c4e497-1d31-4086-ae73-d6e310d4a88f | Aditya61101/DSA | 4.recursion/21.fibonnacci.cpp | #include<iostream>
#include<cstring>
using namespace std;
int printFibonacci(int n){
if (n==0||n==1){
return n;
}
int result=printFibonacci(n-1)+printFibonacci(n-2);
return result;
}
int main(){
int n=6;
int result=printFibonacci(n);
cout<<result;
} | ALGO | 0.999892 | 4.327731 |
b2c33bbb-3d21-4de8-98fe-848a52a49bbd | ISHU9958/-6Companies30DaysChallenge | RotateFunction.cpp | class Solution {
public:
int maxRotateFunction(vector<int>& nums) {
int n=nums.size();
vector<int>dp(n,0);
int maxi=INT_MIN;
int sum=0;
for(int i=0;i<n;i++){
dp[0]+=i*nums[i];
sum+=nums[i];
}
maxi=max(maxi,dp[0]);
for(int i=1... | ALGO | 0.999956 | 5.750943 |
e68a7607-bc9f-4276-810e-f8b7a779b8ef | arlose/ncnn-mobilenet-ssd | ncnn-mobilenet-ssd/src/layer/rnn.cpp | #include "rnn.h"
#include <math.h>
namespace ncnn {
DEFINE_LAYER_CREATOR(RNN)
RNN::RNN()
{
one_blob_only = false;
support_inplace = false;
}
RNN::~RNN()
{
}
#if NCNN_STDIO
#if NCNN_STRING
int RNN::load_param(FILE* paramfp)
{
int nscan = fscanf(paramfp, "%d %d", &num_output, &weight_data_size);
if (... | DATA | 0.949978 | 5.901944 |
ac69bca2-72b6-4726-ab1b-d2e8dc2880ad | aviksil/xbmc-eden-flattened-linaro | lib/libsquish/clusterfit.cpp | #include "clusterfit.h"
#include "colourset.h"
#include "colourblock.h"
#include <cfloat>
namespace squish {
ClusterFit::ClusterFit( ColourSet const* colours, int flags, float* metric )
: ColourFit( colours, flags )
{
// set the iteration count
m_iterationCount = ( m_flags & kColourIterativeClusterFit ) ? kMaxIt... | ALGO | 0.95622 | 6.823459 |
ecca6315-a63a-4795-af00-f1137f74e771 | VincentXWD/algorithm | HDOJ/hdoj5583.cpp | #include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <climits>
#include <complex>
#include <fstream>
#include <cassert>
#include <cstdio>
#include <bitset>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <ctime>
#include <set>
#include <map>
#include <cma... | ALGO | 0.999923 | 3.976835 |
a96639b0-5015-473b-b8ed-06294ea7202c | Hifza278/Data-Structure | stackArray.cpp | #include<iostream>
using namespace std;
class Stack
{
private:
int *arr;
int *top;
int size;
int count;
public:
Stack(int s)
{
arr = new int[s];
size = s;
count = -1;
top = arr;
}
bool isFull()
... | ALGO | 0.997218 | 3.854815 |
59bf66a4-8e86-43d0-bb79-4bbd214cc498 | priyeshwadhwa/ip | hash/easy/1213_intersection_of_three_sorted_arrays/intersection_of_three_sorted_arrays.cpp | #include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <list>
#include <tuple>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <regex>
#include <iostream>
#define CATCH_CONFIG_MAIN
#include "..\..\catch\catch.hpp"
using namespace std;
/*
Given three ... | ALGO | 0.999544 | 5.666127 |
bfcacaa1-0cf3-44fb-9f7e-c974e82d9dbc | elielprado/OJ | URI/1173.cpp | #include <iostream>
#include <vector>
#include <cmath>
using namespace std;
int main()
{
int n;
vector<int> v;
cin >> n;
for (int i = 0; i < 10; ++i)
{
v.push_back(n);
n += n;
}
for (int i = 0; i < 10; ++i)
cout << "N[" << i << "] = " << v[i] << endl;
return 0;
} | ALGO | 0.998304 | 3.475818 |
5a4c4613-1f60-4aa6-b909-ea4f2d8186d4 | abhaygupta08/Hacktober-2022 | Pattern printing/10Pattern.cpp | // * * * * *
// * A B C *
// * D E F *
// * G H I *
// * * * * *
#include<iostream>
using namespace std;
int main()
{
int n, x=1;
cout << ("\nEnter number of rows: ");
cin >> n;
for(int r=1; r<=n; r++)
{
for(int c=1; c<=n; c++)
{
if(r == 1 || r == n|| c == 1 || c == n... | ALGO | 0.997388 | 3.392397 |
b199a937-9b77-4d48-a23d-39ffdb9a9324 | SantiagoTaracena01/sdl-omp-screensaver | src/parallel-main.cpp | /**
* Universidad del Valle de Guatemala
* (CC3069) Computación Paralela y Distribuida
* Proyecto 01 - Screensaver con SDL y OpenMP
*
* Miembros del equipo de trabajo:
* - José Rodrigo Barrera García (20807)
* - Marco Pablo Orozco Saravia (20857)
* - Santiago Taracena Puga (20017)
*/
// Librerías necesarias ... | TOOL | 0.998365 | 5.359405 |
9e6603d6-242e-4a5f-8cb3-f8cb1fa6d921 | KnightChan/LeetCode-cpp | Source/p148 Sort List.cpp | #include "leetcode.h"
/**
Sort a linked list in O(n log n) time using constant space complexity.
*/
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
ListNode *mergeTwoLists(ListNode *l1, L... | ALGO | 0.999999 | 5.686588 |
c72f584a-6fb2-43ed-97da-cf5ed8e335b2 | Capzera/Cpp | LGOJ/第22届上海大学春季赛/F.cpp | #include <bits/stdc++.h>
using namespace std;
void solve() {
int n, b, x;
cin >> n;
vector<int> c(n);
priority_queue<vector<int>> pq, pq2;
for (auto& x : c) cin >> x;
for (int i = 0; i < n; i++) {
cin >> x;
if (c[i] == 1) pq.push({x, 1});
if (c[i] == 2) pq.push({x, 2});
if (c[i] == 3) pq2.push({x, 3});
}... | ALGO | 0.999966 | 3.860538 |
533ef44d-2301-4014-9819-8e274af4c8ee | shreejitverma/SDE-Interview-Prep | LeetCode/C++/closest-divisors.cpp | // Time: O(sqrt(n))
// Space: O(1)
class Solution {
public:
vector<int> closestDivisors(int num) {
vector<vector<int>> results = {divisors(num + 1), divisors(num + 2)};
return *min_element(cbegin(results), cend(results),
[](const auto& a, const auto& b) {
... | ALGO | 0.999972 | 6.338354 |
2dbd0b5e-d5a5-4ef2-819c-db41cc9a21ff | ZaBarudo/tiny-gpu-lang-backend | libc/src/stdbit/stdc_bit_ceil_us.cpp | #include "src/stdbit/stdc_bit_ceil_us.h"
#include "src/__support/CPP/bit.h"
#include "src/__support/common.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(unsigned short, stdc_bit_ceil_us, (unsigned short value)) {
return cpp::bit_ceil(value);
}
} // namespace LIBC_N... | TOOL | 0.899583 | 6.816877 |
9f1e3791-9027-437f-8aa2-808b4e64827d | Upendra48/To_do_app | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.9988 | 6.76073 |
9fc18f81-91e0-427a-90f0-7dcbc7991bbc | raincross7/code-similarity | codes/train_code/problem377/problem377_225.cpp | /*
* Author : Andrew J
*/
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
using ll = long long;
using ii = pair <ll , ll>;
void in(ll &x);
const ll N = 105;
const ll K = 1e5 + 10;
const ll M = 1e9 + 7;
ll n, k;
ll a[N], dp[N][K], ps[N][K];
ll subs(ll a , ll b) {
... | ALGO | 0.999985 | 4.131541 |
2bf25022-fbea-4320-b505-8ed0335f09e3 | Dim4x4777/day2 | mp/src/cryptopp/kalyna.cpp | // kalyna.cpp - written and placed in the public domain by Jeffrey Walton
// This code relied upon three sources. First was Oliynykov, Gorbenko, Kazymyrov, Ruzhentsev,
// Kuznetsov, Gorbenko, Dyrda, Dolgov, Pushkaryov, Mordvinov and Kaidalov's "A New Encryption
// Standard of Ukra... | ALGO | 0.998539 | 5.067818 |
709de215-b9d7-4304-acc4-3caac0f78e54 | ruleless/programming | alg/poj/archive/1146/6264092_AC_0MS_164K.cpp | #include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
int main()
{
// freopen("in.txt","r",stdin);
char c[60];
while(scanf("%s",c),strcmp(c,"#")!=0)
{
if(next_permutation(c,c+strlen(c)))
{
printf("%s\n",c);
}
else
{
printf("No Successor\n");
}
}
} | ALGO | 0.99997 | 3.031149 |
41b11c13-9daf-4d00-a3d9-1e290fe6bd17 | shahrier-antor/Solved_Problems_on_Leetcode | 0200-number-of-islands/0200-number-of-islands.cpp | class Solution {
public:
int numIslands(vector<vector<char>>& grid) {
int islands = 0;
int n = grid.size();
int m = grid[0].size();
vector<pair<int,int>> directions = {{1,0},{-1,0},{0,1},{0,-1}};
for(int i =0; i<n;i++){
for(int j = 0; j<m; j++){
... | ALGO | 0.999977 | 6.493412 |
9252ac1d-5e8e-461f-91d8-c335df95a247 | Jerling/jmpool | src/jmp_allocator.cpp | #include "jmp_allocator.h"
namespace jmp {
namespace details {
void big_alloc::add_to_free(big_node *node) {
auto pp = (big_node *)&free[0];
auto p = (big_node *)free->next;
while (nullptr != p && node > p) {
pp = p;
p = (big_node *)p->next;
}
if ((void *)(node->size + (char *)node) == (void *)p) {
... | ALGO | 0.861317 | 4.929861 |
6f4e0525-971d-4651-b862-b27defd8b2ff | notacallforhelp/contests | 1019DIV2/medspl.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define int long long
typedef long long ll;
typedef long double ld;
//ordered_sets
template <typename T>
using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tre... | ALGO | 0.999548 | 4.391908 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.