uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
aad28152-057b-47c0-a4ad-e4dfaecb8b54 | v1otusc/algo_sum | [13] 树/树的递归/leetcode-101-symmetric-tree.cpp | /*
* @Description:
*
* 判断一个二叉树,输出一个布尔值,表示该树是否对称
*
* @输入输出说明:
*
* 输入一个二叉树,输出一个布尔值,表示该树是否对称。
*
* @题目思路:
*
* 将判断两个子树是否相等或对称的题目解法叫做四步法:
*
* (1) 如果两个子树都为空指针,则它们相等或对称
* (2) 如果两个子树只有一个为空指针,则它们不相等或不对称
* (3) 如果两个子树根节点的值不相等,则它们不相等或不对称
* (4) 根据相等或对称要求,进行递归处理。
*
* @LastEditors: zzh
* @LastEditTime: 2021-04-08 14... | ALGO | 0.999991 | 6.095719 |
f4ebede0-1042-44f0-9859-e7bbbe51ad57 | PRANEET-C/dsa | selectionsort1.cpp | #include <iostream>
using namespace std;
void selectionSort(int ar[],int size){
for(int i=0;i<size-1;i++){
for(int j=i+1;j<size;j++){
if(ar[j]<ar[i]){
swap(ar[i],ar[j]);
}
}
}
}
int main(){
int n;
cin>>n;
int arr[n];
for(int i=0;i<n;i++){
... | ALGO | 0.999968 | 4.924822 |
2ed0a478-126b-4b46-8e2d-747b54835fad | atanughosh01/Leetcode-grinder | 229-majority-element-ii/229-majority-element-ii.cpp | // O(n) time | O(n) Space | n = nums.size();
class Solution_1 {
public:
vector<int> majorityElement(vector<int> &nums) {
int n = nums.size();
unordered_map<int, int> freq;
vector<int> res;
for (int &x : nums) freq[x]++;
for (auto &[key, val] : freq) {
if (val > n/... | ALGO | 0.999979 | 5.611841 |
6885af9a-32dd-4c54-a457-6df8100cb624 | Matthewlele/AVS-Computation-Systems-Architectures | paralelization/parallel_builder/tree_mesh_builder.cpp | /**
* @file tree_mesh_builder.cpp
*
* @author Matus Bicanovsky <<EMAIL>>
*
* @brief Parallel Marching Cubes implementation using OpenMP tasks + octree early elimination
*
* @date 15.12.2023
**/
#include <iostream>
#include <math.h>
#include <limits>
#include "tree_mesh_builder.h"
TreeMeshBuilder::Tr... | ALGO | 0.9845 | 7.673685 |
61f19c5d-8870-4cd1-9fc0-ed2d6399727f | alvinpiter/competitive-programming | AtCoder/ABC/132/E.cpp | #include<bits/stdc++.h>
using namespace std;
#define MAXN 100000
#define INF 10000000
int N, M, S, T, dist[MAXN + 3][3];
vector<int> adj[MAXN + 3];
int main() {
cin >> N >> M;
for (int i = 1; i <= M; i++) {
int u, v;
cin >> u >> v;
adj[u].push_back(v);
}
cin >> S >> T;
fo... | ALGO | 0.999986 | 4.020828 |
d6ee35d9-9206-4bf7-a97b-64b2f9907cc2 | RakibulAzadd/Competetive-Programming | 04. Graph/02. Graph Representation/code.cpp |
#include <bits/stdc++.h>
using namespace std;
vector<int> v[100001];
int main()
{
int n, m;
cin >> n >> m;
int x, y;
while (m--)
{
cin >> x >> y;
v[x].push_back(y);
v[y].push_back(x);
}
for (int i = 1; i <= n; i++)
{
cout << i ;
for (int j = 0; j... | ALGO | 0.999953 | 4.417277 |
2c67a931-6ad2-4767-bd2e-171865daeba3 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_7952_6.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
clock_t tStart = clock();
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
long long n, m;
cin >> n >> m;
long long center = 1;
long long mx = INT_MIN;
if (m == 0) {
goto lbl;
}
long long arr[1001];
memset(arr, 0, siz... | ALGO | 0.999977 | 3.355859 |
43325a34-46e5-4acc-9fbf-3f0f1fd04a20 | iam-talhaa/smit_Academy_practise | 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 |
7fb132f9-aec1-488d-a65c-20fdc34e8eac | redbird-arch/push-multicast-artifact | push-multicast/benchmarks/parsec-3.0/pkgs/apps/facesim/src/Public_Library/Grids/TRIANGLE_MESH.cpp | using namespace PhysBAM;
//#####################################################################
// Destructor
//#####################################################################
TRIANGLE_MESH::
~TRIANGLE_MESH()
{
delete neighbor_nodes;
delete incident_triangles;
delete adjacent_triangles;
delete segment_mesh;
... | TOOL | 0.971513 | 7.520256 |
decdc987-cfde-42f6-a6ac-d76f4830b64a | Koditake/leetcode | 1942-the-number-of-the-smallest-unoccupied-chair/1942-the-number-of-the-smallest-unoccupied-chair.cpp | class Solution {
public:
int smallestChair(vector<vector<int>>& times, int targetFriend) {
priority_queue<pair<int, int>, vector<pair<int, int>>,
greater<pair<int, int>>>
leavingQueue;
int targetArrival = times[targetFriend][0];
sort(times.begin(), times.e... | ALGO | 0.999983 | 6.190938 |
ab19cde8-ceaa-43b2-b185-7f647373748b | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_9189_2.cpp | #include <bits/stdc++.h>
using namespace std;
void first() {
long long n, m, a, b;
cin >> n >> m >> a >> b;
if (b == m || a == n)
cout << abs(n - a) + abs(m - b) << endl;
else
cout << abs(n - a) + abs(m - b) + 2 << endl;
}
int main() {
int t;
cin >> t;
while (t--) first();
}
| ALGO | 0.999707 | 4.345258 |
027cfea5-f82d-4409-9f7f-3f35a96f161d | pczuppon/AMRWithinHost | Fig3_Survival_proba/death/sim_death.cpp | #include <iostream>
#include <cmath>
#include <numeric>
#include <algorithm>
#include <fstream>
#include <gsl/gsl_rng.h>
#include <gsl/gsl_randist.h>
// g++ -std=c++11 sim_death.cpp `pkg-config --libs gsl` command for compiling
using namespace std;
// Sensitive strain parameters
#define bS 2.5 // birth rate... | ALGO | 0.999911 | 6.389192 |
802e029d-0084-4ba5-871e-96d7a41d80c6 | abufarhad/Programming | AAA (CODE) Programming tools(Fuad)/string algo/KMP/kmp_own.cpp |
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(i=a;i<b;i++)
#define repr(i,a,b) for(i=a;i>=b;i--)
#define LL long long
#define ull unsigned long long
#define scl(n) scanf("%lld", &n)
#define scf(n) scanf("%lf", &n)
#define sci(n) scanf("%d", &n)
#define scii(n,m) scanf("%d %d",&n,&m)
#define sc... | ALGO | 0.999958 | 3.278802 |
e0a9d578-c9c8-4788-b776-95f520085592 | shizzleclover/SideQuest-Mark-II | 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 |
dd3d0034-a674-4f79-8d44-e28bbeacc18d | ishandutta2007/codeforces | eecs/normal/1609/B.cpp | #include <bits/stdc++.h>
using namespace std;
const int maxn = 100010;
int n, q, ans;
char s[maxn];
int main() {
scanf("%d %d %s", &n, &q, s + 1);
auto query = [&](int i) {
return i >= 1 && s[i] == 'a' && s[i + 1] == 'b' && s[i + 2] == 'c';
};
for (int i = 1; i <= n - 2; i++) {
ans += ... | ALGO | 0.999824 | 3.903945 |
89d77fe5-7ff6-4d1d-9575-3216648971ab | pkeyela/Cpp-and-C_sharp-projetcs | ZFraction/ZFraction.cpp | #include<iostream>
#include<stdexcept>
#include "ZFraction.h"
using namespace std;
ZFraction::ZFraction(int num,int den){
if(den==0)
throw runtime_error("0 can not be the denominator!");
else {
if(den>0){
m_numerator=num;
m_denominator=den;
}
if(den<0){
... | TOOL | 0.908962 | 4.796585 |
6315069f-6d7c-43e8-8cd4-c6d96724bdf6 | vivek-gorantla2005/DSA | binary_search/iterative-code.cpp | #include<iostream>
#include<vector>
#include<algorithm> // For sort
using namespace std;
int main(){
vector<int> arr = {1, 2, 3, 4, 134, 121, 45, 21, 145, 66, 34};
sort(arr.begin(), arr.end());
int low = 0;
int high = arr.size() - 1;
int tar = 121;
while (low <= high) {
int mid = (l... | ALGO | 0.999958 | 5.652702 |
be70734e-c02a-42e8-be6c-22dfba7f2332 | Gabriel-Sembenelli/cp | graphs/SCCs.cpp | /*
Kosaraju, 1979
References:
https://cp-algorithms.com/graph/strongly-connected-components.html
http://professor.ufabc.edu.br/~carla.negri/cursos/2023Q3-TG/aula15.pdf
Complexity: O(V + E)
*/
int visited[MAXN], comp[MAXN], components=0;
vector<int> order, adj1[MAXN], adj2[MAXN];
void dfs1(int at){
visited[at] = ... | ALGO | 0.999896 | 5.995545 |
763c138a-9c70-4f3b-8499-8b53d8c18c58 | sourcegraph/lsif-clang | libcxx/test/std/algorithms/alg.modifying.operations/alg.unique/unique_pred.pass.cpp | // <algorithm>
// template<ForwardIterator Iter, EquivalenceRelation<auto, Iter::value_type> Pred>
// requires OutputIterator<Iter, RvalueOf<Iter::reference>::type>
// && CopyConstructible<Pred>
// constexpr Iter // constexpr after C++17
// unique(Iter first, Iter last, Pred pred);
#include <algo... | TEST | 0.966895 | 6.530209 |
e8c25137-4c85-464b-b74c-24c7ff14f8f2 | zeberity123/cppLesson | exercise/v12/14/FunctionTemplateStaticVar.cpp | #include <iostream>
using namespace std;
template <typename T>
void ShowStaticValue(void)
{
static T num=0;
num+=1;
cout<<num<<" ";
}
int main(void)
{
ShowStaticValue<int>();
ShowStaticValue<int>();
ShowStaticValue<int>();
cout<<endl;
ShowStaticValue<long>();
ShowStaticValue<long>();
ShowStaticValue<long>(... | TOOL | 0.897242 | 3.584348 |
e43483f3-1b40-4773-9e70-3cb134f3908a | Dawnbrightsu/JadeCore4.3.4 | src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/instance_dark_portal.cpp | /* ScriptData
SDName: Instance_Dark_Portal
SD%Complete: 50
SDComment: Quest support: 9836, 10297. Currently in progress.
SDCategory: Caverns of Time, The Dark Portal
EndScriptData */
#include "ScriptMgr.h"
#include "InstanceScript.h"
#include "dark_portal.h"
#include "Player.h"
#include "TemporarySummon.h"
#include "S... | TOOL | 0.911419 | 6.059661 |
b1405879-e576-4c56-ab5c-96a724c991cd | lalrada/Algorithm | BOJ/행성 터널.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
struct coor {
int num, x, y, z;
};
struct info {
int from, to, dist;
};
int N, x, y, z, ans;
int parent[100001];
vector<coor> planets;
vector<info> dist;
bool cmpX(coor a, coor b) {
return a.x < b.x;
}
bool cmpY(coor a, coor b) {
... | ALGO | 0.999613 | 4.14423 |
2419bf7c-eb97-4cc3-b529-967e9b6f83a8 | Cesar1R/ProgramacionCompetitiva | UVA/uva10684.cpp | #include<bits/stdc++.h>
using namespace std;
pair<int, int> dp[10000+1];
void dp_fill (vector<int> & bets) {
memset(dp, 0, sizeof(dp));
dp[0] = {bets[0], 0};
for(int i = 1; i < bets.size(); i++){
if(dp[i-1].first + bets[i] > bets[i]){
dp[i] = {dp[i-1].first + bets[i], dp[i-1].se... | ALGO | 0.999913 | 3.651556 |
0a3a32bc-dfcd-469d-a001-4e97350ba4c0 | yousuf-cse-bd/StandardTemplateLibrary | UniqueNumberGenerator1.cpp | /**
* @file UniqueNumberGenerator1.cpp
* @author Md. Yousuf Ali (<EMAIL>)
* @brief Unique Number Generator | C++ Programming Example
* @version 0.1
* @date 2022-05-31
* @since ThursDay; 08:49 AM
* @copyright Copyright (c) 2022
* @institute: Dept. of CSE, Varendra University, Rajshahi, Bangladesh
*/
#include ... | ALGO | 0.99209 | 4.944193 |
535f734e-7dc4-493d-8e6c-6abb5abcdbd8 | MakinoRuki/Codeforces | ER57/1096C.cpp | #include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <cmath>
#include <queue>
#define eps 1e-7
#define M 31
#define N 500005
#define SZ 200000002
using namespace std;
type... | ALGO | 0.999583 | 3.766199 |
fda1e0ee-b466-4f17-b46e-4e7ea12d873f | vbonnici/grafe-sim | analysis/data/p01140/s693712886.cpp | #define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() {
ios::sync_with_stdio(false); cin.tie(0);
int n, m;
while (cin >> n) {
cin >> m;
if (n == 0 && m == 0) return 0;
vector<int> h(n), w(m);
for (int i = 0; i < n; i++) {
cin >> h[i];
}
for (int i = 0;... | ALGO | 0.999805 | 3.259942 |
d6bf004b-3e08-4f64-b7eb-a4f7592f04e1 | thomaskf/iqtree2_fix | simulator/alisimulatorheterogeneityinvar.cpp | //
// alisimulatorheterogeneityinvar.cpp
// model
//
// Created by Nhan Ly-Trong on 23/03/2021.
//
#include "alisimulatorheterogeneityinvar.h"
AliSimulatorHeterogeneityInvar::AliSimulatorHeterogeneityInvar(Params *params, double invar_prop) :
AliSimulatorHeterogeneity(params) {
invariant_proportion = invar_pro... | ALGO | 0.996772 | 4.45295 |
af6da10f-9e0c-4910-8b4e-701585a095eb | poomstas/learn_cpp | vectors/1d_vector_playground.cpp | #include <iostream>
#include <vector>
using namespace std;
int piecewise_difference(vector<int> one, vector<int> two); // function declaration
int main() {
vector<int> vector_one = {5, 10, 27};
vector<int> vector_two = {3, 17, 12};
for(int i=0; i < vector_one.size(); i++){
cout << vector_one[i] ... | ALGO | 0.991301 | 4.848723 |
14139be9-0a71-4e00-8a25-86eb50cd9045 | tsssni/pat | 1043_Is_It_a_Binary_Search_Tree.cpp | #include <iostream>
#include <functional>
#include <memory>
using namespace std;
struct node {
node(int val) {
this->val = val;
}
int val;
unique_ptr<node> left{};
unique_ptr<node> right{};
};
int main() {
int n;
cin >> n;
vector<int> tree(n);
for(auto& t : tree) {
... | ALGO | 0.999999 | 4.548697 |
1e035285-2a25-4bc9-a421-2690cee5ccc7 | MIJI-H/CodingTest | 프로그래머스/2/42626. 더 맵게/더 맵게.cpp | #include <bits/stdc++.h>
using namespace std;
//가장 맵지않은 스코빌 지수 + (두번째로 맵지않은 스코빌 지수 *2)
//모든음식이 k이상일때 까지 반복
// 최소 횟수를 return
// 오름차순으로 정렬,우선순위 큐
// 1개 밖에 남지 않았을경우,
int solution(vector<int> scoville, int K) {
int answer = 0;
priority_queue<int, vector<int>, greater<int>> pq(scoville.begin(), scoville.end());
... | ALGO | 0.999208 | 5.27126 |
52768c37-9f08-4ab8-8484-05f6d15a2cc5 | mhassanashraf812/Algorithms-and-Data-Structures-Coursera | WEEK6/tree-orders.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#if defined(__unix__) || defined(__APPLE__)
#include <sys/resource.h>
#endif
using std::vector;
using std::ios_base;
using std::cin;
using std::cout;
class TreeOrders {
int n;
vector <int> key;
vector <int> left;
vector <int> right;
public:... | ALGO | 0.999989 | 4.783582 |
623555bd-82cb-4ade-8a5f-b6191541712f | MaxDumbledore/BUAA_Numerical_Analysis | NumericalAnalysisT8/Matrix.cpp | //
// Created by 40461 on 2021/11/27.
//
#include "Matrix.h"
#include <iostream>
#include <iomanip>
using namespace std;
Matrix::Matrix(int _n) : n(_n), data(n * n) {}
Matrix::Matrix(int _n, std::initializer_list <std::initializer_list<double>> list) : n(_n), data(n * n) {
int i = 0;
for (auto &row: list) {... | ALGO | 0.999406 | 3.938647 |
6cb2d023-b897-4503-8f5f-96ea0df8279d | Aman18111625/LeetCode-Solutions | XOR Game - GFG/xor-game.cpp | // { Driver Code Starts
// Initial Template for C++
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
// User function Template for C++
class Solution{
public:
int xorCal(int k){
// code here
if(k==1) return 2;
int n=1;
while(n<=k){
if((n^(n+1))==k... | ALGO | 0.999834 | 5.741865 |
3be3fe6a-8b53-4857-8b48-b77a70dcff36 | Haribala-09/hyprdots | User/History/-7b90a568/xcMs.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution
{
public:
static constexpr int N = 1e5 + 1, mod = 1e9 + 7;
std::vector<int> primes;
void sieve()
{
std::bitset<N> is_prime;
is_prime.set();
is_prime[0] = is_prime[1] = false;
primes.reserve(317);
for ... | ALGO | 0.999957 | 4.875797 |
1a08be79-ef3a-4da5-a6fb-eb7651ecb6a1 | jcazevedo/leetcode | src/0684-redundant-connection.cpp | // 684. Redundant Connection
// https://leetcode.com/problems/redundant-connection/
#include <vector>
using namespace std;
class UnionFind {
private:
vector<int> p, rank;
public:
UnionFind(int N) {
rank.assign(N, 0);
p.assign(N, 0);
for (int i = 0; i < N; i++) { p[i] = i; }
}
int findSet(int ... | ALGO | 0.999509 | 6.105809 |
996dac91-fed4-4eef-945a-9d9fe0fb34bb | rofi93/Codeforces | C. Gennady the Dentist.cpp | /* -------------------------------- */
/* Name: MD. Khairul Basar */
/* Institute: HSTU */
/* Dept: CSE */
/* Email: <EMAIL> */
/* -------------------------------- */
#include <bits/stdc++.h>
/* all header files included */
#define fs first
#define sc ... | ALGO | 0.999878 | 3.500581 |
4273f4b8-e1e5-4d50-82bc-6248f2082525 | Alejandromo125/Box2D_GroupProject | Box2D/Box2D/Collision/b2Distance.cpp | #include <Box2D/Collision/b2Distance.h>
#include <Box2D/Collision/Shapes/b2CircleShape.h>
#include <Box2D/Collision/Shapes/b2EdgeShape.h>
#include <Box2D/Collision/Shapes/b2ChainShape.h>
#include <Box2D/Collision/Shapes/b2PolygonShape.h>
// GJK using Voronoi regions (Christer Ericson) and Barycentric coordinates.
int3... | ALGO | 0.999984 | 4.163515 |
074cbde7-e120-4a6c-82e7-2ef91cf1e18a | ljyws/graduation_project | firmware/ctrl_g4/Ctrl/utils.cpp | #include "utils.hpp"
#include "board.h"
int mod(const int dividend, const int divisor)
{
int r = dividend % divisor;
if (r < 0) r += divisor;
return r;
}
// @brief: Returns number of microseconds since system startup
uint32_t micros(void)
{
uint32_t ms, cycle_cnt;
do {
ms = HAL_GetTick();
... | TOOL | 0.982864 | 5.810468 |
aa0bcaba-717b-4a6a-86c8-ce427e35dcbb | svanegas/programming_seminar | Just Code It. programming handbok/src/longest_palindromic_subsequence.cpp | int lps(const string &str) {
int n = str.size();
int i, j, cl;
int L[n][n];
for (i = 0; i < n; i++) L[i][i] = 1;
for (cl = 2; cl <= n; cl++) {
for (i = 0; i < n - cl + 1; i++) {
j = i + cl - 1;
if (str[i] == str[j] && cl == 2) L[i][j] = 2;
else if (str[i] == str[j]) L[i][j] = L[i+1][j-1]... | ALGO | 0.99896 | 5.324571 |
26c92c15-8a39-4384-83bb-15e5d158d511 | ankit039/Competitive_Programming_Solutions | HackerRank/InsertANodeLinkedList.cpp | #include <iostream>
using namespace std;
class node{
public:
int data;
node *link;
};
node *global=NULL;
node *arr;
void insert(int n)
{
arr=new node();
if(global==NULL)
{
global=arr;
arr->data=n;
arr->link=NULL;
}
else
arr->link=glob... | ALGO | 0.998832 | 3.96038 |
c5d97fb6-9b99-4e19-80f4-eb9a27be2b97 | thevkp/DSA | Graphs/bfsAdjMat.cpp | #include <iostream>
#include <vector>
#include <unordered_map>
#include <queue>
using namespace std;
class Graph{
private:
vector<vector<int>> adjM;
int nodes;
void bfsUtil(int node, unordered_map<int, bool>& visited){
queue<int> q;
q.push(node);
while(... | ALGO | 0.99926 | 5.660823 |
0137d9b8-e7c3-43ff-8c54-4e6f54f5e23c | mquig42/AdventOfCode2024 | src/day12.cpp | #include "day12.h"
Day12::Day12()
{
dayNumber = 12;
}
void Day12::load(File file)
{
while(file.available())
{
grid.push_back(file.readStringUntil('\n'));
}
numRows = grid.size();
numCols = grid[0].length() - 1; //Ignore trailing CR
file.close();
char c;
std::unordered_set<... | ALGO | 0.997867 | 5.153322 |
ca781b99-e745-4c7c-bbe5-b92e915ef5a3 | ishandutta2007/codeforces | barichek/normal/1188/A1.cpp | #pragma GCC optimize("O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define files(name) name!=""?freopen(name".in","r",stdin),freopen(name".out","w",std... | ALGO | 0.999772 | 4.233963 |
09824c9c-a17e-4978-95f0-d14156f368a4 | mirceadino/parallel-and-distributed-programming | lab7-1/generator.cpp | #include <bits/stdc++.h>
using namespace std;
int kSeed;
int kN, kM;
int kMinVal;
int kMaxVal;
int main(int argc, char** argv) {
if (argc < 4) {
fprintf(stderr,
"usage: %s <n> <min> <max> [<seed>]\n",
argv[0]);
return 0;
}
sscanf(argv[1], "%d", &kN);
sscanf(argv[2], "%d", &kM... | ALGO | 0.968081 | 3.921542 |
d6896965-2b3a-4072-b483-dcac860d28a9 | mutalibcs/Competitive-programming | Library/Math/Find_Odd_in_Range/findEven.cpp | #include <bits/stdc++.h>
using namespace std;
int findEven() {
int low, high;
cin >> low >> high;
int odd = (high-low)/2;
if(low%2!=0 || high%2!=0) {
odd++;
}
return (high-low+1)-odd;
}
int main() {
cout << findEven() << endl;
} | ALGO | 0.999737 | 3.982529 |
43b28ed3-28c8-4792-aa71-7097b858669e | the-t3ch-wizard/Dsa-Practice | CodingNinjas/Reverse Linked List(1).cpp | // link: https://www.codingninjas.com/studio/problems/reverse-the-singly-linked-list_799897?leftPanelTab=0
#include <bits/stdc++.h>
/****************************************************************
Following is the class structure of the LinkedListNode class:
template <typename T>
class LinkedListNode
... | ALGO | 0.999933 | 5.386361 |
89d694cd-5749-4f1f-840d-cab14bcf1919 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_10705_6.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int n,m,a=0;cin>>n;
m=n;
while(m>0){
a+=m%10;
m=m/10;
}
if(n%a==0)cout<<"Yes"<<endl;
else cout<<"No"<<endl;
}
| ALGO | 0.999949 | 3.364844 |
eec216ce-9675-499b-965c-1e0b2066354c | sy-project/yuuna | DirectXTex-main/DirectXTex/DirectXTexNormalMaps.cpp | #include "DirectXTexP.h"
using namespace DirectX;
using namespace DirectX::Internal;
namespace
{
#pragma prefast(suppress : 25000, "FXMVECTOR is 16 bytes")
inline float EvaluateColor(_In_ FXMVECTOR val, _In_ CNMAP_FLAGS flags) noexcept
{
XMFLOAT4A f;
static XMVECTORF32 lScale = { { { 0.2125f... | ALGO | 0.983549 | 7.582268 |
c5de14ef-e123-439c-82fa-b0f2834be5d1 | ZERstar/Leetcode | 0231-power-of-two/0231-power-of-two.cpp | class Solution {
public:
bool isPowerOfTwo(int n) {
return n>0 && (n & (n-1))==0;
}
}; | ALGO | 0.996308 | 6.387643 |
678c6341-e3ee-4593-8152-82c328538eee | vawait/ACM | HDU/HDU5325 Crazy Bobo.cpp | /*
* Author: vawait
* Created Time: 2015/7/28 13:46:17
* Problem: HDU5325 Crazy Bobo
*/
#include<cstdio>
#include<iostream>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<vector>
#include<queue>
#include<stack>
#include<ctime>
using na... | ALGO | 0.999895 | 3.759703 |
19b6bb7e-cfea-4a6a-94cf-3d8891522f44 | MckinleyX/competition | team_build/team_build.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
vector<vector<int>> graph;
vector<bool> team;
vector<bool> visited;
bool fill(int pers, bool adj)
{
bool poss = true;
team[pers] = !adj;
visited[pers] = true;
for(int p : graph[pers])
{
if(!visited[p])
poss &= fill(p,!adj);
else
poss &= ... | ALGO | 0.999979 | 4.661969 |
e8998531-0866-4466-b730-46225f95c9de | Danishdbu/Cplusplus | ratproblem.cpp | # include <iostream>
# include <vector>
using namespace std;
bool isSafe(int i, int j, int row, int col, int arr[][4],
vector<vector<bool> > &visited) {
if( ((i>=0 && i < row) && (j >= 0 && j< col)) &&
(arr[i][j] == 1 ) &&
(visited[i][j]==false)) {
return true;
}
else {
return false;
}
}
... | ALGO | 0.999966 | 4.474608 |
454b5163-7dab-4113-8d83-e1c288d6b659 | Bayashat/My-C_Plus_Plus | Tasks/KBTU/Lab/11/a.cpp | #include <iostream>
using namespace std;
int main()
{
string s[7] = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
int n = sizeof(s) / sizeof(s[0]);
string ss;
cin >> ss;
for(int i = 0; i < n; i++)
{
if(ss == s[i])
{
cout << n-i;
}
}
return 0;
} | ALGO | 0.99976 | 3.717581 |
1782ed18-e963-4000-9be4-97dc4d8b9a63 | sayanpramanik2012/Hacker-Rank-Solutions | CCT B3 - Greedy Rayinshi.cpp | #include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<cmath>
#include<utility>
#include<set>
#include<vector>
#include<map>
#include<deque>
#include<queue>
#include<stack>
#define maxn 1005
#define INF 0x3f3f3f3f
#define LL long long
#define ULL unsigned long long
#define E... | ALGO | 0.999709 | 3.048908 |
7c493890-1d2d-4808-97dd-a80008b50f22 | sanket0708/SdeSheet | 1976-number-of-ways-to-arrive-at-destination/1976-number-of-ways-to-arrive-at-destination.cpp | class Solution {
public:
int countPaths(int n, vector<vector<int>>& roads) {
vector<long >ways(n , 0); int mod = 1e9+7;
vector<long > dist(n , LONG_MAX);
vector<pair<long , long >> adj[n];
for(auto it:roads)
{
adj[it[0]].push_back({it[1],it[2]});
... | ALGO | 0.999958 | 5.72169 |
5b5a41d6-a32c-48df-ad83-58186145aff1 | anandj123/gcpdemo | codeforces/EDU99/a.cpp | #include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<numeric>
#include<set>
#include<assert.h>
#include<queue>
#include<stack>
#include<unordered_set>
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define en... | ALGO | 0.999036 | 4.438293 |
5effb384-b320-4998-8937-226b1bd37948 | showmic96/Online-Judge-Solution | LightOJ/1031/8830683_AC_108ms_1808kB.cpp | // In the name of Allah the Most Merciful.
#include<bits/stdc++.h>
using namespace std;
int n;
int dp[123][123][2];
int ar[123];
int f(int l , int r , int w)
{
//cout << l << " " << r << " " << w << endl;
if(l>r)return 0;
if(dp[l][r][w]!=-1)return dp[l][r][w];
int value1 = INT_MIN , value2 = INT_MIN... | ALGO | 0.999913 | 3.726298 |
2814666f-e1f8-4d15-9b48-704d1d624850 | dart-mol/lab_oop | LR3/LR33/LR33.cpp | #include <iostream>
#include <list>
#include <fstream>
#include <algorithm>
#include <string>
using namespace std;
/*
Реализовать класс текстовых файлов, с помощью которого и
осуществлять взаимодействие с текстовыми файлами. В данном классе
реализовать операции чтения и записи. К
тому же реализовать дополнительный... | TOOL | 0.872382 | 4.391811 |
0094baa7-095a-44cc-a822-8cb3646878de | Leapense/problems | 13778번: Parliamentary Rankings/Parliamentary Rankings.cpp | #include <bits/stdc++.h>
using namespace std;
struct MP {
string name;
int score;
} mp_info[121];
int main() {
int N;
cin >> N;
for (int i = 0; i < N; i++) {
int I;
cin >> I;
string name;
getline(cin, name);
if (!name.empty() && name[0] == ' ') name = nam... | ALGO | 0.998695 | 3.622917 |
5c3e0bd2-696a-4d1f-ae2a-942f0d4bc7b9 | jagonmoy/Number-Theory | Concepts of Number Theory/Euler Phi/Euler Phi for a Number N/Code.cpp | ll euler_phi(ll n) {
ll result = n ;
for ( ll i = 2 ; i*i <= n ; i++) {
if ( n % i == 0 ) {
while(n%i == 0) n /= i ;
result -= result/i ;
}
}
if ( n > 1) result -= result/n ;
return result ;
}
| ALGO | 0.99976 | 4.303117 |
c89cf844-c93a-4e50-a956-ba1fd81fe9d8 | peterzheng98/SomeOJExercises | codeforce1040A.cpp | /*
* codeforce 1040A : 贪心裸题
* Status: AC(53/53)
* Time: Sep 8, 2018
*/
#include<iostream>
using namespace std;
const int maxn = 20 + 7;
int n, a, b;
int sum = 0;
int seq[maxn];
int main(){
cin >> n;
cin >> a >> b;
int minAB = (a > b ? b : a);
for(int i = 0;i < n; ++i) cin >> seq[i];
if(n % 2 == 1) sum += (se... | ALGO | 0.99987 | 3.742123 |
39aa01da-ff85-4c89-8adf-cbf2f2a8aa82 | duny31030/My_road_of_ACM | 各种OJ/ny1112.cpp | #include <iostream>
#include <cstdio>
#include <map>
#include <string>
using namespace std;
int main()
{
int n;
scanf("%d",&n);
while(n--)
{
int m;
scanf("%d",&m);
map<string,int> a;
int ans = 0;
string str;
//scanf("%d",&m);
cin >> str;
... | ALGO | 0.999454 | 3.632057 |
a8b688ff-3335-421c-bd4e-20803a35da94 | eryktr/BPTree | AnotherTree/Node.cpp | #include <cstdlib>
#include <vector>
#include <utility>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <string>
struct Node
{
std::vector<std::pair<int, Node*>> fields;
size_t max_num_of_elems;
size_t current_num_of_elems;
Node(size_t max_num_of_elems)
{
this -> max_num_... | TOOL | 0.870591 | 3.704902 |
00662769-f270-4dcf-aed9-a1a2b7d96653 | pm306/procon | ABC/147/D.cpp | #include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
constexpr char ln = '\n';
constexpr long long INF = 1LL<<60;
constexpr double EPS = 1e-9;
#define all(v) v.begin(), v.end()
#define rep(i, n) for(int i=0;i<(n);i++)
#define rept(i, j, n) for(int i=(j); i... | ALGO | 0.999987 | 4.594361 |
3c6360da-f5fa-465c-8559-3b85a8db1616 | PaukIsUha/optimizing_formating_code | predictions/submissions-aizu-coop-gpt4/Codenet/p00908/410110747/response_6.cpp | #include <bits/stdc++.h>
using namespace std;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, 1, 0, -1};
const int dx2[4] = {-1, 0, 2, 1};
const int dy2[4] = {0, 2, 1, -1};
struct Coordinate {
int x;
int y;
int turn;
};
class Compare {
public:
bool operator()(const Coordinate &l, const Coordinate &r) ... | ALGO | 0.999726 | 4.850914 |
a8226d98-2ef3-486c-ac15-f079e1c79384 | mehtaparivesh/codeforces | E_Bus_Video_System.cpp | #include <bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
// using namespace __gnu_pbds;
using namespace std;
#define ll long long int
#define ld long double
#define mod 1000000007
#define inf 1e18
#define endl "\n"
#define pb emplace_back
#define vi vector<ll>
#define vs vector<string>
#define pii pair<ll, ll... | ALGO | 0.999993 | 3.978017 |
38ce8abd-6218-4c12-b372-53389b56e93b | Md-DinIslam/All_Contest | Contest/STARTERS 114/Christmas_Candy.cpp | /* GREEN UNIVERSITY OF BANGLADESH
Md DinIslam, Batch-221
*/
#include <bits/stdc++.h>
using namespace std;
void solve() {
int n;
cin >> n;
int v[n];
for (int i = 0; i < n; ++i) {
cin >> v[i];
}
int ans = 0, mxV = v[0];
for (int i = 1; i < n; ++i) {
if (v[i] > mxV)
... | ALGO | 0.999573 | 5.821727 |
70cc9463-c6f2-4f37-bfc4-993d1e648bbd | raincross7/code-similarity | codes/train_code/problem426/problem426_196.cpp | #include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
typedef long long lint;
const int INF = 1e7;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define trep(i, k, n) for (int i = (k); i < (int)(n); ++i)
typedef pair<int, int> P;
#define H 1001
#define W 1001
int h, w;
int sx, sy;
int gx, gy;
char c[... | ALGO | 0.999847 | 3.767292 |
9dc4eb2b-740c-4417-9031-115cbd889d9b | Fishiro/mycode | CandCPP/C folder/Tinhphuontrinh.cpp | #include <math.h>
#include <stdio.h>
int main() {
int a, b, c;
double delta;
printf("PHAN MEM GIAI PHUONG TRINH BAC 2\n");
printf("Hay nhap gia tri A: ");
scanf("%d", &a);
printf("Hay nhap gia tri B: ");
scanf("%d", &b);
printf("Hay nhap gia tri C: ");
scanf("%d", &c);
delt... | ALGO | 0.998909 | 3.817655 |
6b3fd227-0827-419d-a55c-93a1f5706557 | ChunYu-Chen/Algorithm-Projects | Project2/4.a_Mergesort3/Mergesort3.cpp | #include <fstream>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
void mergeSort(vector<int>& left, vector<int>& mid, vector<int>& right, vector<int>& sorted_numbers)
{
int L = left.size(); // to get the size of left vector
int M = mid.size(); // to get the size... | ALGO | 0.999771 | 4.366273 |
ebd0eb4f-fcd8-49a3-bed1-33c64b909930 | mght5/Ardupilot- | libraries/AP_Math/quaternion.cpp | /// -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*-
#pragma GCC optimize("O3")
#include "AP_Math.h"
// return the rotation matrix equivalent for this quaternion
void Quaternion::rotation_matrix(Matrix3f &m) const
{
float q3q3 = q3 * q3;
float q3q4 = q3 * q4;
float q2q2 = q2 * q2... | ALGO | 0.989065 | 6.382221 |
11196a91-3d23-4b7f-8ca9-a4cf71e04684 | DionysiosB/CodeForces | 0300-0399/320A-MagicNumbers.cpp | #include <iostream>
using namespace std;
int main(){
string line; getline(cin, line);
string output = "YES";
long index = 0; const long length = line.size();
while(index < length){
if(line[index] != '1'){output = "NO";break;}
else {
if(index < length - 2 && line[index + 1] =... | ALGO | 0.999819 | 3.857238 |
f4698578-084d-4ad8-a7b0-3798a1492040 | dldbdud314/ps-study | 10773.cpp | #include <iostream>
#include <stack>
using namespace std;
int main(){
int n;
cin >> n;
stack<int> s;
int sum = 0;
for(int i = 0; i < n; i++){
int num;
cin >> num;
if(num == 0){
sum -= s.top();
s.pop();
}
else{
sum += num;... | ALGO | 0.999962 | 4.443372 |
432d8bcd-b82b-4c52-b016-551d13bf690e | mohitpunyani/Leetcode-and-gfg | Reverse a string using Stack - GFG/reverse-a-string-using-stack.cpp | //{ Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
char* reverse(char *str, int len);
int main()
{
long long int t;
cin>>t;
while(t--)
{
char str[10000];
cin>>str;
long long int len=strlen(str);
char *ch=reverse(str,len);
for(int i=0;i<len;i++)
... | ALGO | 0.999786 | 5.410225 |
e602a304-6b74-48bd-8b1a-ed7f2a685cdf | ragu-manjegowda/self-driving-car | Term03-PathPlanning-SemanticSegmentation-and-Systems/P1-Path-Planning/src/Eigen-3.3/test/denseLM.cpp | #include <iostream>
#include <fstream>
#include <iomanip>
#include "main.h"
#include <Eigen/LevenbergMarquardt>
using namespace std;
using namespace Eigen;
template<typename Scalar>
struct DenseLM : DenseFunctor<Scalar>
{
typedef DenseFunctor<Scalar> Base;
typedef typename Base::JacobianType JacobianType;
typed... | TEST | 0.982753 | 5.862647 |
16498655-e6a4-4b0c-ac2c-b56754a71c64 | Dizww/Games101-HW | pa6/Assignment6/BVH.cpp | #include <algorithm>
#include <cassert>
#include "BVH.hpp"
BVHAccel::BVHAccel(std::vector<Object*> p, int maxPrimsInNode,
SplitMethod splitMethod)
: maxPrimsInNode(std::min(255, maxPrimsInNode)), splitMethod(splitMethod),
primitives(std::move(p))
{
time_t start, stop;
time(&start);... | ALGO | 0.998632 | 5.847078 |
45a28b53-c4f9-4533-95ab-1b350498a1e6 | shivamxverma/cses-solution | introductory/Coin_Piles.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int t;cin>>t;
while(t--){
int x,y;cin>>x>>y;
int n1x = x%2,n2x = x/2,n1y = y%2,n2y = y/2;
if(n1x+n2x == n1y+n2y){
if(x == y){
if((x+y)%3==0)cout << "YES\n";
else cout << "NO\n";
}
else cout <<... | ALGO | 0.999899 | 4.926931 |
41b02410-b5ce-45d2-bb35-9ff7069ca93c | ishandutta2007/codeforces | alexandr_ts/normal/133/B.cpp | #include <bits/stdc++.h>
#define fr(i, n) for (ll i = 0; i < n; i++)
#define frab(i, a, b) for (ll i = a; i < b; i++)
#define pb push_back
#define mp make_pair
using namespace std;
typedef pair <long long, long long> pr;
typedef long long ll;
typedef long double ld;
const ll MOD = 1e6 + 3;
const ll INF = 2e9;
const ... | ALGO | 0.999955 | 3.832653 |
6e5b8507-40cf-4ccf-ac39-4a115389ed89 | Facre/peloton-bwtree | src/backend/index/bwtree_index.cpp | #include "backend/common/logger.h"
#include "backend/index/bwtree_index.h"
#include "backend/index/index_key.h"
#include "backend/storage/tuple.h"
namespace peloton {
namespace index {
template <typename KeyType, typename ValueType, class KeyComparator,
class KeyEqualityChecker>
BWTreeIndex<KeyType, ValueTy... | TOOL | 0.905036 | 7.044678 |
1c0ae373-4c6f-4ff6-b3de-170e803d2ca8 | Mwako/deps | boost/libs/dynamic_bitset/example/example1.cpp | // An example of setting and reading some bits. Note that operator[]
// goes from the least-significant bit at 0 to the most significant
// bit at size()-1. The operator<< for dynamic_bitset prints the
// bitset from most-significant to least-significant, since that is
// the format most people are used to reading.
//
... | TOOL | 0.915212 | 6.222385 |
448d0cba-548e-4142-bb22-e0dfbad5be83 | gilgen/BIGTREETECH-SKR-mini-E3 | firmware/V1.2/Marlin-2.0.7.2-SKR-mini-E3-V1.2/Marlin/src/gcode/bedlevel/G35.cpp | #include "../../inc/MarlinConfig.h"
#if ENABLED(ASSISTED_TRAMMING)
#include "../gcode.h"
#include "../../module/planner.h"
#include "../../module/probe.h"
#include "../../feature/bedlevel/bedlevel.h"
#if HAS_MULTI_HOTEND
#include "../../module/tool_change.h"
#endif
#define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE... | TOOL | 0.978802 | 6.470242 |
6c64a46d-49cf-490b-8d26-e37416f30c52 | satya-supercluster/DSA | 06-hashing/sets/problems/problem0003.cpp | /*
Problem 0003: Happy Number
Description:
Determine if number is happy using hash set to detect cycles.
Difficulty: Medium
Topics: Sets
Example:
Input:
Output:
Constraints:
-
Approach:
1.
2.
3.
Time Complexity: O()
Space Complexity: O()
*/
#include <bits/stdc++.h>
using namespace std;
class Solution {
pu... | ALGO | 0.999683 | 6.240777 |
c5fee91c-c0f0-4d6c-a1e3-a181eed720fb | raincross7/code-similarity | codes/train_code/problem339/problem339_451.cpp | #include<bits/stdc++.h>
using namespace std;
int main (void){
long long int r = 0;
cin >> r;
r = r*r;
cout << r <<endl;
return 0;
} | ALGO | 0.924882 | 3.106791 |
fa07b22b-6362-45d9-8b61-654ab4ccb7b9 | imposter883/string_Codeforces | 131A.cpp | #include <iostream>
using namespace std;
int main()
{
string s;
char u;
bool c = true;
cin >> s;
for(int i = 1; i < s.length(); i++)
{
if(islower(s[i]))
{
c = false;
}
}
if(c == true)
{
for(int j = 0; j < s.length(); j++)
{
... | ALGO | 0.997957 | 4.400731 |
395d3149-9673-4f64-b2e2-5539afcc034a | ishandutta2007/codeforces | ylwang/normal/1451/C.cpp | #include<bits/stdc++.h>
#define For(i, j, k) for(int i = (j); i <= (k); i++)
using namespace std;
int read() {
int x = 0; char c = ' ';
for(; !isdigit(c); c = getchar()) ;
for(; isdigit(c); c = getchar()) x = x * 10 - '0' + c;
return x;
}
const int MAXN = 1e6 + 5;
int n, K, q[MAXN], p[MAXN]; char s[MAXN], t[MAXN];
... | ALGO | 0.99999 | 3.927148 |
237a95e3-35e5-48b5-99b9-efe37ac5d7fa | jorgehr2/GPCFIIS25-1 | semana_9_binary_ternary_search/binary.cpp | #include <bits/stdc++.h>
#define pb push_back
#define inic ios_base::sync_with_stdio(false);
#define inic2 cin.tie(NULL);
#define inic3 cout.tie(NULL);
#define all(s) s.begin(), s.end()
using namespace std;
typedef int ll;
typedef long double ld;
#define Rep0(i, n) for (ll i = 0; i < (ll)n; i++)
#define Rep1(i, n) for ... | ALGO | 0.999983 | 4.150476 |
17da7609-d64f-413d-8790-4eb6f9c48e09 | learning-process/ppc-2025-threads | tasks/omp/nasedkin_e_strassen_algorithm/src/ops_omp.cpp | #include "omp/nasedkin_e_strassen_algorithm/include/ops_omp.hpp"
#include <omp.h>
#include <algorithm>
#include <cmath>
#include <vector>
namespace nasedkin_e_strassen_algorithm_omp {
bool StrassenOmp::PreProcessingImpl() {
unsigned int input_size = task_data->inputs_count[0];
auto* in_ptr_a = reinterpret_cast<... | ALGO | 0.998996 | 6.430295 |
73ee78e5-435c-48b4-94f9-2e5be4974e57 | mohitkrsuman/DSAsheet | Day-2/twoSum.cpp | /*
Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.
You may assume that each input would have exactly one solution, and you may not use the same element twice.
You can return the answer in any order.
Example 1:
Input: nums = [2,7,11,15], targe... | ALGO | 0.999948 | 6.288648 |
c5fb727e-30af-454c-b750-fb0bc6d81808 | Sunny5130/leetCode_practice | 48-rotate-image/rotate-image.cpp | class Solution {
public:
void rotate(vector<vector<int>>& matrix) {
int n=matrix.size();
for(int i=0;i<n;i++){
for(int j=i+1;j<n;j++){
swap(matrix[i][j],matrix[j][i]);
}
}
for(int i=0;i<n;i++){
reverse(matrix[i].begin(),matrix[i].end... | ALGO | 0.999978 | 6.33193 |
f991947e-88ac-42d9-bef4-e7b5e390746e | Rajsoni03/Data-Structure-in-CPP | Dynamic Programming/1D DP/B4.cpp | // Frog Jump
// minium energy required to reach 0 to N th
// can jump 1 step or 2 step
// energyLoss = abs(energy[i] - energy[i-1])
// bottom up / tabular formet
// Space optimization
// time = O(n)
// space = O(1)
#include <iostream>
#include <vector>
#include <climits>
using namespace std;
int minEnergy(int n, v... | ALGO | 0.999991 | 4.468604 |
98768690-f263-4f76-baa4-67d07ade7d87 | ArsenyCheplyukov/Asmp-Task-Solving | beautiful_pattern/beautiful_pattern/beautiful_pattern.cpp | // beautiful_pattern.cpp : Этот файл содержит функцию "main". Здесь начинается и заканчивается выполнение программы.
//
#include "pch.h"
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
struct inputFile
{
std::vector<std::string> pattern;
};
inputFile reading()
{
inputFile input = {};
... | ALGO | 0.999716 | 3.667844 |
e231c98a-a90d-4e16-a76a-ab153398d4c4 | YourName0729/competitive-programming | Kattis/incognito.cpp | //
// https://open.kattis.com/problems/incognito
#include <bits/stdc++.h>
#define For(i, n) for (int i = 0; i < n; i++)
#define Forcase int __t = 0; cin >> __t; while (__t--)
#define pb push_back
#define ll long long
#define ull unsigned long long
#define ar array
using namespace std;
const int MOD = 1e9 + 7;
const ... | ALGO | 0.999842 | 4.286747 |
4c065888-dccb-4476-bd58-b47f39946d74 | raincross7/code-similarity | codes/train_code/problem281/problem281_163.cpp | #include <iostream>
#include <cstdlib>
#include <list>
#include <map>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
int main(void)
{
int N;
cin >> N;
int64_t a[100000];
int64_t p = 1;
for (int i = 0; i < N; ++i)
{
cin >> a[i];
if (a[i] == 0)
... | ALGO | 0.999464 | 3.757332 |
824cfc78-7053-4c0c-8a91-d520b2e5ebcf | sarvex/leetcode-odin | solution/1800-1899/1827.Minimum Operations to Make the Array Increasing/Solution.cpp | class Solution {
public:
int minOperations(vector<int>& nums) {
int ans = 0, mx = 0;
for (int& v : nums) {
ans += max(0, mx + 1 - v);
mx = max(mx + 1, v);
}
return ans;
}
}; | ALGO | 0.999988 | 6.221878 |
418b777e-e66e-4406-9150-0615434005d8 | Johniel/contests | atcoder/tdpc/M/main.cpp | // atcoder/tdpc/M/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/
#include <bits/stdc++.h>
#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))
using namespace std;
typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;
template<typename P... | ALGO | 0.999747 | 4.069161 |
e830ab91-0be6-48c6-a717-aac0d7b0a4b7 | DDunda/Little32 | Little32/src/L32_BigInt.cpp | #include "L32_BigInt.h"
#include <stdexcept>
#include <string>
namespace Little32
{
BigInt::BigInt() : bits({}), negative(false) {}
BigInt::BigInt(uint64_t value) :
bits({}),
negative(false)
{
if (value == 0) return;
bits.push_back(value);
}
BigInt::BigInt(int64_t value) :
bits({}),
negative(false... | TOOL | 0.94734 | 6.37273 |
f94e832b-aa92-4c02-9710-09ff3be59abc | hatsu3/curator | 3rd_party/faiss/faiss/gpu/test/demo_ivfpq_indexing_gpu.cpp | #include <cmath>
#include <cstdio>
#include <cstdlib>
#include <random>
#include <sys/time.h>
#include <faiss/gpu/GpuAutoTune.h>
#include <faiss/gpu/GpuCloner.h>
#include <faiss/gpu/GpuIndexIVFPQ.h>
#include <faiss/gpu/StandardGpuResources.h>
#include <faiss/index_io.h>
double elapsed() {
struct timeval tv;
... | ALGO | 0.992788 | 5.855887 |
0b250bdd-c80a-47ed-939f-4ec4c14eaaf2 | PrachiiBB/-6companies30days | Amazon/Question_9.cpp | #include <bits/stdc++.h>
using namespace std;
int isValid(vector<vector<int>> mat)
{
int maxi = 15;
int n = 9;
//setting the matrix
for (int i = 0; i < n; i++)
{
for (int j = 0; j < n; j++)
{
int temp = mat[i][j] % maxi;
if (temp)
{
... | ALGO | 0.999078 | 4.478686 |
d2f92239-ea6b-4ccc-a611-8cd8d28cc1f5 | satyajit-patel/algoCamp | array/subarray/practice/2260. Minimum Consecutive Cards to Pick Up.cpp | /*
Constraints:
1 <= cards.length <= 10^5
0 <= cards[i] <= 10^6
f(n) = O(n)
Input: cards = [3,4,2,3,4,7]
Output: 4
Explanation:
We can pick up the cards
[3,4,2,3] which contain a matching pair of cards with value 3.
Note that picking u... | ALGO | 0.999963 | 5.751557 |
4aba0260-623e-4b67-afe5-e03b39cc6d09 | Alvikh/PPB-Alvi | app_produk/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.998179 | 6.76073 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.