uuid stringlengths 36 36 | repo_name stringlengths 5 123 | relative_path stringlengths 5 4k | content stringlengths 33 2.85M | category stringclasses 6
values | algo_rel_score float64 0.85 1 | quality_score float64 3 8.76 |
|---|---|---|---|---|---|---|
d1481be6-ac27-408d-9e7a-2441f2095e5e | MURAD10000/Ashishgup1-Competitive-Coding | LCA (with Time Traversal DFS).cpp | int tim=0;
int parent[LG][N];
int tin[N], tout[N], level[N];
void dfs(int k, int par, int lvl)
{
tin[k]=++tim;
parent[0][k]=par;
level[k]=lvl;
for(auto it:g[k])
{
if(it==par)
continue;
dfs(it, k, lvl+1);
}
tout[k]=tim;
}
int walk(int u, int h)
{
for(int i=LG-1;i>=0;i--)
{
if((h>>i) & 1)
u = paren... | ALGO | 0.999785 | 4.398741 |
f457f34b-e271-4e06-a9fe-78f8584701d3 | aamir-ops/Competitive-Programming | UVA/UVA12582.cpp | #include <iostream>
#include <vector>
#include <sstream>
#define rep(a,b,c) for(int c=a;c < b; c++)
#define ntc(n) (char) (n + 'A')
#define ctn(n) n - 65
#define ALPN 26
using namespace std;
typedef vector<char> VC;
typedef vector<int> VI;
typedef stringstream SS;
int main()
{
string str;
SS sst;
int cc = 0,cn =... | ALGO | 0.999804 | 3.728679 |
f1c9e534-25d6-43e3-8a2a-964aa6ce2c68 | mole-cash/molecash | src/chain.cpp | #include <chain.h>
/**
* CChain implementation
*/
void CChain::SetTip(CBlockIndex *pindex) {
if (pindex == nullptr) {
vChain.clear();
return;
}
vChain.resize(pindex->nHeight + 1);
while (pindex && vChain[pindex->nHeight] != pindex) {
vChain[pindex->nHeight] = pindex;
p... | ALGO | 0.999494 | 6.937927 |
f2d4ecba-6b8f-48eb-9426-6ac2ea5bf90f | archallumin/ac | BOJ/20001 - 30000/25304.cpp | #include <iostream>
using namespace std;
int main(void) {
int x, n, a, b, tot = 0;
cin >> x;
cin >> n;
while (n--) {
cin >> a >> b;
tot = tot + (a * b);
}
if (x == tot) cout << "Yes\n";
else cout << "No\n";
return 0;
} | ALGO | 0.999891 | 3.770065 |
8e4793d5-3b0b-4dae-bb33-0e0a6e9603b8 | nck404/tui-hoc-cpp | mang1/36.cpp | #include <iostream>
#include <unordered_set>
using namespace std;
int main() {
int N;
cin >> N;
int sum = 0;
unordered_set<int> prefixSum;
bool found = false;
for (int i = 0; i < N; i++) {
int num;
cin >> num;
sum += num;
if (prefixSum.find(sum) != prefixSum.end... | ALGO | 0.99994 | 4.291679 |
a5c42841-b12e-4770-82ff-3008d66e8b89 | CTranLam/DSA-28tech | Ly thuyet so + to hop/Tong hop/b16 uoc so nt lon nhat.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
int t; cin >> t;
while(t--){
int n; cin >> n;
int ans=0;
for(int i=2 ; i<=sqrt(n) ; i++){
while(n%i==0){
ans=i;
n/=i;
}
}
if(n>1) ans=n;
cout << ans << endl;
}
}
| ALGO | 0.999934 | 5.000125 |
c102d3da-2f59-419e-8975-487de0cb18e9 | gandhi56/Competitive-Programming | leetcode/prison-calls-after-n-days/cells.cpp | #include <bits/stdc++.h>
using namespace std;
vector<int> prisonAfterNDays(vector<int>& cells, int N) {
char x = 0;
for (int i = 0; i < 8; ++i){
x |= cells[i]<<i;
}
while (N--){
int tmp;
for (int i =0 ; i < 8; ++i){
if (i == 0){
tmp = x&(1<<7);
x ^= (1<<7);
}
else if (x&(i+1) == tmp){
... | ALGO | 0.999997 | 5.092503 |
8050050d-db99-40a7-b9fa-6ec60ecaf5b2 | knknkn1162/ant_competitive_solution | 2.1.1/agc006_a.cpp | #include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstd... | ALGO | 0.999874 | 3.633059 |
49bc856d-0794-4c2a-b1e0-d3eb4863d50c | joker-eph/llvm-unified | clang/lib/Analysis/ThreadSafetyTIL.cpp | #include "clang/Analysis/Analyses/ThreadSafetyTIL.h"
#include "clang/Analysis/Analyses/ThreadSafetyTraverse.h"
using namespace clang;
using namespace threadSafety;
using namespace til;
StringRef til::getUnaryOpcodeString(TIL_UnaryOpcode Op) {
switch (Op) {
case UOP_Minus: return "-";
case UOP_BitNot: re... | ALGO | 0.992815 | 4.435511 |
1b2b7d6e-e893-440f-bf95-a40409eeb022 | MUCS714/DRT-PNEC | src/featureTracker/parameters.cpp | #include "featureTracker/parameters.h"
#include <iostream>
#include <opencv2/calib3d/calib3d.hpp>
#include <opencv2/core/eigen.hpp>
#include <opencv2/imgproc/imgproc.hpp>
using namespace std;
using namespace cv;
double INIT_DEPTH;
double MIN_PARALLAX;
double ACC_N, ACC_W;
double GYR_N, GYR_W;
vector<Eigen::Matrix3d>... | CONFIG | 0.931804 | 4.841162 |
f88bb8dc-3194-4f91-8a9d-8bb8dd8d8cec | Sarwar05/LightOJ | 1038 - Race to 1 Again.cpp | // http://sarwar05.blogspot.com/2018/06/1038-Race-to-1-Again.html
#include<bits/stdc++.h>
using namespace std;
double dp[100001];
vector<int> divisor[100001];
double fun(int num)
{
if(num==1) return 0;
if(dp[num]!=-1) return dp[num];
double ret = 0;
for(int i=0; i<divisor[num].size(); i++){
ret+... | ALGO | 0.999528 | 4.16242 |
a7888392-752e-4475-a327-1128492ad128 | even-realities/EvenDemoApp | 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.998799 | 6.776823 |
dc070c3c-4adc-4ef4-a746-50681dc5f88b | libinghope/my-code-diaries | 005-数据结构与算法/exercises/145.二叉树的后序遍历.cpp | /*
* @lc app=leetcode.cn id=145 lang=cpp
*
* [145] 二叉树的后序遍历
*
* https://leetcode-cn.com/problems/binary-tree-postorder-traversal/description/
*
* algorithms
* Hard (70.94%)
* Likes: 281
* Dislikes: 0
* Total Accepted: 69.9K
* Total Submissions: 98.3K
* Testcase Example: '[1,null,2,3]'
*
* 给定一个二叉树,... | ALGO | 0.999964 | 6.447274 |
e7962bdd-45f9-4236-b939-ef1ce8d63c25 | yonghaason/HElib_new | olds/old/src/FHE.cpp | #include "FHE.h"
#include <queue> // used in the breadth-first search in setKeySwitchMap
#include "timing.h"
#include "binio.h"
/******** Utility function to generate RLWE instances *********/
// Choose random c0,c1 such that c0+s*c1 = p*e for a short e
void RLWE(DoubleCRT& c0,DoubleCRT& c1, const DoubleCRT &s, long... | ALGO | 0.9982 | 4.97101 |
2a8ad4da-aa48-4769-ba6c-10467f6c75c2 | XwanXuanX/abstract-nonsense | cf/106C.cpp | #include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
/*********************************************************************************************************************************************************/
#define SFINAE(x, ...) template <class, class = void> struct x : std::false_type {}; templa... | ALGO | 0.999961 | 5.580436 |
89f80735-4af2-4488-8167-40891bd7908d | rabelhmd/LeetCode | 0124-binary-tree-maximum-path-sum/0124-binary-tree-maximum-path-sum.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.999984 | 6.490731 |
e3057389-e88a-4796-8c66-dfbf18318a69 | PCWin12/projects | RandomPractice/pathfinder/queue.cpp | #ifndef __QUEUE_CPP
#define __QUEUE_CPP
#include "queue.h"
#include <cstring>
#include <iostream>
using namespace std;
Queue::Queue()
{
}
/*{
List l = temp;;
int le = l.Length();
ListItem* arr[le];
for(int i=0; i<le ; i++)
{
arr[i]= (l.GetHead());
l.... | TOOL | 0.955662 | 4.009673 |
1e0008e0-6e0f-4aa5-a4b5-379f781699f3 | Seann0425/LeetCode | finished/1857. Largest Color Value in a Directed Graph.cpp | #include <bits/stdc++.h>
using namespace std;
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) {}
};
struct TreeNode {
int val;
TreeNode *left;
TreeNode *righ... | ALGO | 0.999574 | 5.75089 |
84bcd6ba-aba0-46a2-a72d-bd8b24830c33 | pranavjawale01/cp.exe | CodeForces/1154-A-Restoring Three Numbers/1154-A-Restoring Three Numbers.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define ull unsigned long long
#define vi vector<int>
#define vll vector<long long>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define all(x) x.begin(), x.end()
#define pb push_back
#define ff first
#define ... | ALGO | 0.99965 | 3.650913 |
36e0bd02-fda5-44c2-aae1-a9c026eb0579 | pcw109550/problem-solving | Baekjoon/1753.cpp | #include <bits/stdc++.h>
using namespace std;
#define INF 3000000
int main(void) {
ios::sync_with_stdio(false); cin.tie(nullptr);
int V, E, K, x, y, weight; cin >> V >> E >> K;
vector<pair<int, int> > edge[V + 1];
for (int i = 0; i < E; i++) {
cin >> x >> y >> weight;
edge[x].push_back(... | ALGO | 0.99997 | 4.319085 |
80ea4870-206b-4ade-9203-b3295f5560aa | AshutoshPathak1765/DSA-WITH-STRIVER | LEETCODE/Best_Time_to_Buy_and_Sell_Stock.cpp | /*
Problem Link:- https://leetcode.com/problems/best-time-to-buy-and-sell-stock/description/
YT Link:- https://www.youtube.com/watch?v=1pkOgXD63yU&list=PLot-Xpze53leOBgcVsJBEGrHPd_7x_koV&index=1
*/
class Solution {
public:
// Approach:- buy at less price sell at more price
int maxProfit(vector<int>& prices) {
... | ALGO | 0.999967 | 6.200055 |
ba274a5a-9786-4184-9547-ced244ca4721 | CedricKuang/LeetCode | easy/1304.find-n-unique-integers-sum-up-to-zero.cpp | /*
* @lc app=leetcode id=1304 lang=cpp
*
* [1304] Find N Unique Integers Sum up to Zero
*/
// @lc code=start
#include <vector>
using namespace std;
class Solution {
public:
vector<int> sumZero(int n) {
vector<int> ans;
for (int i = -1 * (n / 2); i < 0; i++)
ans.push_back(i);
... | ALGO | 0.999319 | 6.308034 |
5639aceb-847a-4052-bd35-606aa1197b87 | gepeszoli/latorendszer | locator.cpp | #include "project.h"
using namespace cv;
using namespace std;
using namespace Project;
// Function to ignore the found circles that have a longer or smaller radius than the limit
void DropCirclesByRadius( vector<Vec3f>& input, vector<Vec3f>& output , float radiusL, float radiusH );
// Locate the two marker circles
voi... | ALGO | 0.987475 | 4.386014 |
60299542-4789-42cf-ab3d-0d3cc5010d6e | YoungCIoud/PracticeOfFishAcmer | 2024_2025winter/nk1/K.cpp | #include<bits/stdc++.h>
#ifdef LOCAL_MACHINE
#define debug(...) printf(__VA_ARGS__)
#define sp() system("pause")
#define IOS
#else
#define debug(...)
#define sp()
#define IOS std::ios::sync_with_stdio(false), std::cin.tie(0), std::cout.tie(0)
#endif
using i64 = long long;
using u64 = unsigned l... | ALGO | 0.999982 | 4.644627 |
64d82355-3b35-4860-a3e6-58eec17854aa | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_1947_9.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
unsigned long long int a, b;
cin >> a >> b;
if (log(a) + log(log(b)) < log(b) + log(log(a)))
cout << ">" << endl;
else if (log(a) + log(log(b)) > log(b) + log(log(a)))
cout << "<" << endl;
else
cout << "=" << endl;
return 0;
}
| ALGO | 0.999914 | 3.58118 |
4b474c69-d410-424f-b799-cb04780e5067 | Aviral-Dwivedi-0/Leetcode | 2707-merge-two-2d-arrays-by-summing-values/merge-two-2d-arrays-by-summing-values.cpp | class Solution {
public:
vector<vector<int>> mergeArrays(vector<vector<int>>& nums1, vector<vector<int>>& nums2) {
// METHOD 1
vector<vector<int>> answer;
int i=0;
int j=0;
int n=nums1.size();
int m=nums2.size();
vector<int> temp;
while(i<n && j<m){
... | ALGO | 0.999952 | 5.922506 |
6eff7078-cec3-4432-aeeb-5908650d8d50 | SunnyYeahBoiii/EveryDayCode | Code của Sunny/CodeForces/train/Restricted RPS/a.cpp | // Link :
// Author : MinhPhuongVu A.K.A SunnyYeahBoii
/*
Code Ideal: I'm too lazy for something like this .__.
*/
#include "bits/stdc++.h"
using namespace std;
#define NAME "remizdabest"
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#defin... | ALGO | 0.999864 | 3.722508 |
0d3cc58e-6f0a-46cb-b4dd-1939a36ca9a2 | iCoder0020/Competitive-Coding | CF-old/627/B.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
int32_t main()
{
int T;
cin>>T;
while(T--)
{
int N;
cin>>N;
int A[N];
for(int n = 0; n<N; n++)
cin>>A[n];
bool poss = false;
for(int i = 0; i<N; i++)
for(int j = i+2; j<N; j++)
if(A[i] == A[j])
poss = true;
if(poss)
... | ALGO | 0.999649 | 4.036735 |
7d0bac5b-fa00-4689-a86a-78d230e59043 | ehnryx/acm | usp-icmc-2018-cf101875/b.cpp | #include <bits/stdc++.h>
using namespace std;
#define _USE_MATH_DEFINES
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
// DON'T USE THESE MA... | ALGO | 0.999978 | 4.601838 |
66943930-1618-4671-8dec-72389b86efb3 | sschott20/ALibm | half16/hexpm1.cpp | #include <stdio.h>
#include <iostream>
#include <gmp.h>
#include <mpfr.h>
#include <inttypes.h>
#include <math.h>
#include <bits/stdc++.h>
#include <random>
#include <soplex.h>
#include <cstdlib>
#include "half.hpp"
#include <math.h>
#include <bitset>
#include <iomanip>
#include "luts.h"
#include "hhelper.hpp"
using n... | ALGO | 0.995297 | 3.841318 |
ddb91767-7241-4a64-9a85-16cbb577fcd0 | csh-apprentice/Time_Based_SL | src/OPENMP/reaxff_forces_omp.cpp | // clang-format off
#include "reaxff_omp.h"
#include "error.h"
#include "pair_reaxff_omp.h"
#include "reaxff_api.h"
#include <cmath>
using namespace LAMMPS_NS;
namespace ReaxFF {
/* ---------------------------------------------------------------------- */
static void Compute_Bonded_ForcesOMP(reax_system *syste... | ALGO | 0.998067 | 6.998442 |
6237bc3c-18fc-403f-acfd-a3fc15482b9e | YuliaKorolenko/ct | 6sem/ML/Dnew/main.cpp | #include <iostream>
#include <vector>
#include <map>
#include <cmath>
#include <set>
#define double long double
using namespace std;
enum Type {
var = 0,
tnh = 1,
sgm = 2,
mul = 3,
sum = 4,
had = 5
};
std::map<std::string, Type> typeMap = {{"var", Type::var},
... | ALGO | 0.999898 | 3.228781 |
1d860154-c66d-445f-b418-9823e470ae0a | reliak/moonpdf | ext/sumatra/ext/unrar/sha1.cpp | #include "rar.hpp"
/*
SHA-1 in C
By Steve Reid <<EMAIL>>
100% Public Domain
Test Vectors (from FIPS PUB 180-1)
"abc"
A9993E36 4706816A BA3E2571 7850C26C 9CD0D89D
"abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"
84983E44 1C3BD26E BAAE4AA1 F95129E5 E54670F1
A million repetitions of "a"
34AA973C D4C4DAA4... | ALGO | 0.996542 | 6.395986 |
53ed3390-c98a-4e5b-ae3c-e15ddf0ee7e5 | manavchawla98/cpp-programs | Holiday Homework/10. 3 digits and largest/10. 3 digits and largest/main.cpp | // Program to print largest of three numbers.
#include <iostream>
using namespace std;
int main()
{
int a,b,c;
cout << "Enter three numbers : ";
cin >> a >> b >> c;
if (a>b && a>c)
cout << a << " is greatest." << endl;
else if (b>a && b>c)
cout << b << " is greatest." << ... | ALGO | 0.999737 | 3.795646 |
a7657859-4f0a-48dc-a30c-242796890d58 | franshamk/scantest | deps/boost_1_82_0/libs/graph/example/ordered_out_edges.cpp | /*
IMPORTANT:
~~~~~~~~~~
This example appears to be broken and crashes at runtime, see
https://github.com/boostorg/graph/issues/149
*/
#include <boost/config.hpp>
#include <iostream>
#include <functional>
#include <string>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/properties.hpp>
... | TEST | 0.996641 | 6.608915 |
d8bba444-f9f7-40d0-b3f1-f3aa3a39affd | anujak1802/C- | e1.cpp | #include<iostream>
using namespace std;
int main()
{
int a=5,d=2,n,an=0,S=0;
cin>>n;
an=a+(n-1)*d;
for(int i=1;i<=n;i++)
{
an=a+(i-1)*d;
cout<<"Term"<<i<<"="<<an<<" ";
S = S + an;
}
cout<<"Sum= "<< S <<endl;
return 0;
} | ALGO | 0.999813 | 3.227396 |
02b7b1c7-de9a-473d-b12d-a0627a2dfff0 | marsellacell/STD_Marsella_Dwi_Julianti_2311104004 | 06_Double-Linked_List_Bagian_1/02_Pengenalan_CPP_Bagian_2/02_Pengenalan_CPP_Bagian_2/TP/SOAL_03.cpp | // #include <iostream>
// using namespace std;
// int main(){
// int bil[10];
// bil[0] = 1;
// bil[1] = 4;
// bil[2] = 5;
// cout << bil[0] << endl;
// cout << bil[1] << endl;
// cout << bil[2] << endl;
// cout << bil[0] + bil[1] + bil[2] << endl;
// return 0;
// } | ALGO | 0.998054 | 3.827408 |
6c8c1dc3-b35b-4339-b01d-0c9f0f4dc171 | agustinmoretti/UTN | AEDD - Algoritmo y Estructura de Datos/Guias Campus AEDD/Guia 18/Ejercicio 1/Ejercicio 1.cpp | #include <iostream>
#include <fstream>
#include <cctype>
using namespace std;
bool esNum(char c){
if(c>='0' and c<='9'){
return true;
}
return false;
}
bool esChar(char c){
if((c>='a' and c<='z') or (c>='A' and c<='Z')){
return true;
}
return false;
}
int main(int argc, char *argv[]) {
ifstream archivo;
ar... | TOOL | 0.878947 | 3.702661 |
6da61eb7-7d42-4e3a-b3ec-2cd82541a746 | RomVargas/algoritmosJPN | C++/FourNumbersSum.cpp | #include <vector>
#include <unordered_map>
#include <algorithm>
using namespace std;
vector<vector<int>> fourNumberSum(vector<int> array, int targetSum) {
unordered_map<int, vector<vector<int>>> allPairSums;
vector<vector<int>> quadruplets{};
for(int i = 1; i < array.size() - 1; i++) {
for (int j = i+1; j < arra... | ALGO | 0.999785 | 5.378897 |
6a41e7dc-d694-4f70-a392-346d8d869731 | RaviDeepu/atomicCPP | Strings/removeAdjacentDuplicates.cpp | /*
Recursively remove all adjacent duplicates
Given a string, recursively remove adjacent duplicate characters from string. The output string should not have any adjacent duplicates. See following examples.
Input: azxxzy
Output: ay
First "azxxzy" is reduced to "azzy". The string "azzy" contains duplicates,
so it is... | ALGO | 0.999337 | 5.820806 |
90c26764-069f-4877-b19a-a6d9cddcae1d | EmptyDust/Algorithm-Codes-and-writeups | codes/-0x30_competition/-0x33_codeforces/global_27/C_Alya_and_Permutation.cpp | #include <bits/stdc++.h>
#define ranges std::ranges
#define views std::views
using u32 = unsigned;
using i64 = long long;
using u64 = unsigned long long;
using pii = std::pair<int, int>;
using a3 = std::array<int, 3>;
using a4 = std::array<int, 4>;
const int N = 1e6;
const int MAXN = 1e6 + 10;
const int inf = 1e9;
... | ALGO | 0.999918 | 4.824782 |
a0947bc6-1841-47db-a5b6-d6377c7b9ad4 | shubham-up-47/CP_Codes | Number Theory/printing_primes_upto_n.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
bool checkPrime1(int n) // O(n)
{
int factorsCount = 0;
for(int i=1; i<=n; i++)
{
if(n%i == 0)
factorsCount++;
}
return (factorsCount==2);
}
bool checkPrime2(int n) // O(Vn) = root n
{
... | ALGO | 0.999676 | 3.79081 |
463527c0-5dd4-4bb1-bbdf-0773daad5719 | ishandutta2007/codeforces | fedoseev.timofey/normal/1319/G.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
mt19937 rnd(time(0));
const int P = rnd() % (int)1e9 + 10;
const int MA = 1e9 + 7, MB = 1e9 + 9;
int mul(int a, int b, int md) {
return ((ll)a * b) % md;
}
void add(int &a, int b, int md) {
a += b;
if (a >= md) a -= md;
}
void sub(int &a, ... | ALGO | 0.999911 | 4.046349 |
456e1565-ffe3-4352-9fd1-c5590829e529 | damiankawerski/PodstawyProgramowania | Do1Kolokwium/Lab_4_Tablice/Czesc1/zadanie6.cpp | #include <iostream>
using namespace std;
int main() {
const int N = 5;
float arr1[N];
float arr2[N];
for(int i = 0 ; i < N ; i++) {
cin >> arr1[i];
}
for(int i = 0 ; i < N ; i++) {
cin >> arr2[i];
}
float scalar = 0;
for(int i = 0 ; i < N ; i++) {
scalar += a... | ALGO | 0.999716 | 3.187886 |
57003878-78a0-457a-9678-21a7aa09ed24 | sarvex/leetcode-clojure | solution/1900-1999/1945.Sum of Digits of String After Convert/Solution.cpp | class Solution {
public:
int getLucky(string s, int k) {
string t;
for (char c : s) t += to_string(c - 'a' + 1);
s = t;
while (k--) {
int t = 0;
for (char c : s) t += c - '0';
s = to_string(t);
}
return stoi(s);
}
}; | ALGO | 0.999828 | 6.133164 |
fc20a42a-bd63-40b8-bbb1-2325a8eb4cfa | Rehan0705/CODING | LinearSearch.cpp | #include <bits/stdc++.h>
using namespace std;
int largest(int arr[], int n)
{
int i;
int max = arr[0];
for (i = 1; i < n; i++)
if (arr[i] > max)
max = arr[i];
return max;
}
int main()
{
int arr[] = {10, 324, 45, 90, 9808};
int n = sizeof(arr) / sizeof(arr[0]);
cout ... | ALGO | 0.998478 | 4.304664 |
ed31f4e3-53d1-4dd8-a79f-e081dae65d1a | Tomson0119/Coding-Challenge | BaekJoon/Gold/치킨 배달.cpp | #include <iostream>
#include <vector>
#include <cmath>
using namespace std;
int getDistance(const pair<int,int>& a, const pair<int,int>& b)
{
return abs(a.first - b.first) + abs(a.second - b.second);
}
int getMinDist(const vector<int>& picks, const vector<vector<int>>& distance)
{
int dist = 0;
for (const vector<... | ALGO | 0.999875 | 4.581364 |
69e92d13-9f1e-4df9-8ed4-f82108489f30 | kei1107/algorithm | problems/yukicoder/No0121.cpp | #include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<c... | ALGO | 0.999829 | 3.84173 |
3f8c9fe9-83b7-445d-8f2d-c7417aa45419 | rdkit/rdkit | Code/GraphMol/AdjustQuery.cpp | #include <RDGeneral/BoostStartInclude.h>
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/json_parser.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/tokenizer.hpp>
#include <RDGeneral/BoostEndInclude.h>
#include <vector>
#include <algorithm>
namespace RDKit {
namespace {
bool isMappe... | TOOL | 0.917963 | 6.240859 |
b49822cf-3161-4a1c-b8f5-f4e410b9e67f | ishandutta2007/codeforces | serg3000/normal/1091/C.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
#include <set>
#include <queue>
#include <deque>
#include <unordered_set>
#include <map>
#include<unordered_map>
#include <bitset>
#include <random>
#include <ctime>
using namespace std;
#define int long long
signed main() {
... | ALGO | 0.999842 | 4.206418 |
4697fb79-951e-4b37-a66c-cbf49850c7e9 | rcoops/opengl_spring_simulation | raaLinkedList/rpcSort.cpp | #include "rpcSort.h"
raaLinkedList g_pllNodeByWorldSystem[csg_uiNumberOfWorldSystems];
raaLinkedList g_pllNodeBy1980WorldSystem[csg_uiNumberOf1980WorldSystems];
raaLinkedList g_pllNodeByContinent[csg_uiNumberOfContinents];
/* no need for these functions to be available in other files */
raaLinkedList* mergeSortNodeL... | ALGO | 0.999372 | 5.820588 |
da082d39-fa91-4b6a-a452-21f08b94cddf | Tapesh-Vashisth/Leetcode_Solutions | Subarray_sum_divisible_by_k.cpp | #include <iostream>
#include <vector>
#include <unordered_map>
using namespace std;
int subarraysDivByKBrute(vector<int>& nums, int k) {
int total = 0;
vector <int> store;
for (int i = nums.size() - 1; i >= 0; i--) {
for (int j = 0; j < store.size(); j++) {
if ((nums[i] + store[... | ALGO | 0.999857 | 5.606231 |
674e4265-93bc-411b-88be-7e5c1af37f08 | muhammadalmuzahid/ACM-Library | Graph/Tree/DominatorTree (for Any Directed Graph).cpp | #define Max 1000000
#define sz(u) u.size()
#define pb push_back
struct DominatorTree {
vector <int> g[Max], tree[Max],bucket[Max],rg[Max];
int sdom[Max],dom[Max],label[Max],arr[Max],rev[Max],T;
int papa[Max]; //store u's dominator in papa[u]
int n,m,par[Max],dsu[Max];
int Find(int u,int x=0) {
... | ALGO | 0.999945 | 4.029815 |
cf9abddd-1d98-4b70-ae8f-9752eeae9361 | afif-xcode/SdeSheetChallenge | Backtracking/printPermutations_sting.cpp | void permute(string &s,int left,int right,vector<string>&ans){
if(left==right) ans.push_back(s);
for(int i=left;i<=right;i++){
swap(s[left],s[i]);
permute(s,left+1,right,ans);
swap(s[left],s[i]);
}
}
vector<string> findPermutations(string &s) {
// Write your code here - code by A... | ALGO | 0.999868 | 5.468457 |
45b84571-aa6e-4a1c-bbca-6d608097706d | jailsonevora/yandex-cpp-for-competitive-programming | Yandex 4.5/D.My_timeAndNewHouses.cpp | #include <iostream>
#include <cmath>
#include <tuple>
using namespace std;
struct my_time
{
long long day = 0, hour = 0, minute = 0, second = 0;
void set(my_time& builtTimeSec){
day = builtTimeSec.day;
hour = builtTimeSec.hour;
minute = builtTimeSec.minute;
second = builtTimeS... | ALGO | 0.985269 | 3.860466 |
74fce582-3829-4b44-b84a-8fa802cca49b | jash139/codechef-solutions | GROUPS.cpp | #include<bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int t;
for(cin>>t; t--;) {
string s;
cin>>s;
int n = s.length();
int t = 0, ans = 0;
for(int i = 0; i < n; ++i) {
if (s[i] == '0') {
t = 0;
} else {
if (t == 0) {
ans... | ALGO | 0.999856 | 4.516497 |
7c092851-0ebb-4245-8714-e55e2f4d4f0f | ttylinux/cppPrimer | chapter6/6_10.cpp | #include<iostream>
using std::cout;
using std::cin;
using std::endl;
void change(int *one, int *two)
{
int temp = (*one);
(*one) = (*two);
(*two) = temp;
}
int main()
{
int one =10;
int two = 100;
cout <<"one:"<<one<<endl;
cout <<"two:"<<two<<endl;
change( &one, &two);
cout << " new : " << endl;
... | ALGO | 0.9935 | 3.998595 |
07dc4745-c7d2-4fa8-9c2f-3eed67aaaec6 | Sarwar05/LightOJ | 1019 - Brush (V).cpp | #include<bits/stdc++.h>
using namespace std;
#define mx 101
int mat[mx][mx];
void floyd(int n)
{
for(int k=1; k<=n; k++){
for(int i = 1; i<=n; i++){
for(int j = 1; j<=n; j++)
mat[i][j] = min(mat[i][j], mat[i][k]+mat[k][j] );
}
}
}
int main()
{
int tc,n,m,a,b,c;
... | ALGO | 0.999843 | 3.904049 |
f43a28ca-949d-47d7-88d5-6ccfdd968596 | saurabh-kadian/Euler | solutions/pe44.cpp | #include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <algorithm>
using namespace std;
int main()
{
long long int pent[5000],mindiff = 999999;
for(int i=0;i<5000;++i)
pent[i] = (i*(3*i-1))/2;
for(int i=1;i<5000;++i){
for(int j=i+1;j<5000;++j){
long l... | ALGO | 0.999743 | 3.547263 |
721155c0-2180-4bdd-bf4f-28b28feabeb9 | SayandeepB9/Codeforces | solved/1872E.cpp | #pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,popcnt,lzcnt")
// #pragma GCC target("avx2,sse4.2,bmi,bmi2,popcnt,lzcnt")
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mod 998244353
#define fr(i, a, b) for (ll i = a; i < b; i++)
#define rev(i, a, b) for (ll i = a; ... | ALGO | 0.999898 | 4.6027 |
3151f87e-53ab-4af0-8b46-a597409dff37 | novt-vtable-less-compiler/novt-llvm | llvm-novt/lib/CodeGen/LiveRangeShrink.cpp | #include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/ADT/iterator_range.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/MachineOperand.h"
#include... | ALGO | 0.991901 | 7.951464 |
28800207-9b06-48de-b7cf-ef825d778d86 | toantang/AlgorithmCodeLearn | Medium/multiplyTable.cpp | #include <bits/stdc++.h>
using namespace std;
int ans;
int len = 0;
vector<int> v;
void multiplyTable(int n, int k) {
int x = sqrt(k);
if (x * x == k) {
if (x <= n) {
ans++;
}
for (int i = 1; i < x; i++) {
if (k%i == 0) {
if (i <= n && k/i <= n... | ALGO | 0.999494 | 4.466325 |
c64b6348-abdb-47c2-a487-73fbd1a6431a | chicagoedt/revo_robot | lane_finding/calibration/calibrate.cpp | <<<<<<< HEAD
#include <iostream>
#include <sstream>
#include <time.h>
#include <stdio.h>
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/calib3d/calib3d.hpp>
#include <opencv2/highgui/highgui.hpp>
using namespace cv;
using namespace std;
class Settings
{
public:
Settings(... | TOOL | 0.881672 | 4.943951 |
17e99e36-a294-41d8-9ffd-7667f303780d | ishandutta2007/codeforces | for_the_love/normal/581/C.cpp | #include <bits/stdc++.h>
using namespace std;
#define PB push_back
#define MP make_pair
typedef double DB;
typedef long long LL;
typedef pair <int, int> PI;
const DB eps = 1e-8;
const int N = 1e5 + 7;
const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;
int cnt[10][11];
int n, k, x;
int main(){
scanf("%d%d", &n, ... | ALGO | 0.999748 | 3.603752 |
ec8a1422-d4e9-4fa3-8093-8b4d4774555b | lipenghui8/Learn-Algorithm | CSP/C++算法/字符串分值和/main.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
char a[100000];
ll check(int i,int j)
{
char b[j-i+1];
int len=j-i+1;
for(int p=0;p<len;p++)
b[p]=a[i+p];
sort(b,b+len);
ll n=unique(b,b+len)-b;
return n;
}
int main()
{
cin>>a;
ll sum=0;
int len=strlen(a);
... | ALGO | 0.999933 | 4.003972 |
cc449995-77b8-4e6e-9329-1f1c310e624a | mrzli-other/bvhviewer | BVHViewer_DataAccess/BvhParser.cpp | #include <sstream>
#include <exception>
#include "BvhParser.h"
#include "BvhReader.h"
namespace BVHViewer_DataAccess
{
using namespace BVHViewer_DataObjects;
using std::string;
using std::stringstream;
using std::exception;
using std::stack;
using std::vector;
BvhParser::BvhParser()
{
... | TOOL | 0.876756 | 4.793692 |
981ed47c-caea-4557-85aa-c11e6a510576 | marioyc/Online-Judge-Solutions | SPOJ/Classical/8002 - Horrible Queries.cpp | #include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
long long sum[4 * 100000],childSum[4 * 100000];
long long query(int node, int l, int r, int a, int b){
if(l > b || r < a) return 0;
long long ret = (min(b,r) - max(a,l) + 1) * sum[node];
if(a <= l && r <= b) ret += c... | ALGO | 0.998714 | 4.005331 |
2dc14870-55c4-4103-bd61-46b5db417e10 | Argentusz/ParallelsComputing | Lab2/task1.cpp | #include <stdio.h>
#include <mpi.h>
#include <random>
#define rid_t int
#define COMM_SIZE 4
typedef struct {
rid_t rank;
rid_t aReceiver;
rid_t bReceiver;
rid_t aSender;
rid_t bSender;
int aGenerated;
int bGenerated;
int a;
int b;
} MailInfo;
MailInfo getMailInfo(int rank) {
... | ALGO | 0.999127 | 4.946887 |
77cc88d2-f4df-48bf-b5a6-8142007ae9b2 | shivang16/software-interview-preparation | interviewPrep/Google/rangeSumQueryMutable.cpp | // https://leetcode.com/problems/range-sum-query-mutable/
class NumArray {
private:
vector <int> arr;
vector <int> seg;
int n;
void buildTree(int ind,int low,int high){
if(low==high){
seg[ind] = arr[low];
return;
}
int mid = (low+high)/2;
buildTree... | ALGO | 0.999935 | 7.091871 |
57ecdc30-0356-44d4-9926-b8550733efa2 | anubhvshrma18/PepCoding-Solutions | Level-1/13. Stack and Queues/2. Balanced_Brackets.cpp | #include<bits/stdc++.h>
using namespace std;
bool balBrac(string s){
stack<char> st;
bool check=true;
for(int i=0;i<s.length();i++){
if(s[i]=='{' || s[i]=='[' || s[i]=='('){
st.push(s[i]);
}
else if(s[i]=='}'){
if(st.size()==0){
return false;
... | ALGO | 0.999669 | 5.476692 |
936a13d2-4929-4919-bdb3-d6fdd2f6cdb2 | mjayalam/Problems-Solutions | RedDeProgramacionCompetitiva/2015/11ABRIL/H_PascalsTriangleSumofLevels.cpp | #include <stdio.h>
#define MOD 1000007
typedef long long int lli;
using namespace std;
lli sums[10000];
lli expBin(lli a,lli n){
if(n == 0) return 1;
if(n == 1) return a;
lli nextPow = expBin(a, n/2);
nextPow = (nextPow * nextPow) % MOD;
if(n % 2 == 0)
return nextPow;
return (nextPow * a) % MOD;
}
int ... | ALGO | 0.999871 | 3.773602 |
21549b57-6ac5-4b18-8cdb-1e7558192adf | lastvirgo266/AlgorithmProblem | Programmers/BruteForce_03_v2.cpp | #include <string>
#include <vector>
using namespace std;
int solution(vector<vector<int>> baseball) {
int answer = 0;
for(int i = 123; i<=987; i++){
string expect = to_string(i);
if(expect[0] == expect[1] || expect[1] == expect[2] || expect[2] == expect[0])
contin... | ALGO | 0.998763 | 5.006979 |
1b8a8598-07fc-4539-ad7f-062446745eef | tanzil7890/practice-c- | DSAlgo/Arrays/ADT/Arraycpluplusclass.cpp | /* #include <iostream>
using namespace std;
class Array{
private:
int *A; //To dynamically create an array.
int size; //Size of an array I want
int length; //Number of elements that are present in the array
public:
Array() //Non-parameterized constructor
{
... | ALGO | 0.991956 | 5.433388 |
93e4891a-a983-4b30-b444-babeff91cc8e | zkFHE/zkOpenFHE | src/core/lib/lattice/trapdoor.cpp | /*
Provides the utility for sampling trapdoor lattices as described in https://eprint.iacr.org/2017/844.pdf,
https://eprint.iacr.org/2018/946, and "Implementing Token-Based Obfuscation under (Ring) LWE" as described in
https://eprint.iacr.org/2018/1222.pdf.
*/
#ifndef _SRC_LIB_CRYPTO_SIGNATURE_TRAPDOOR_CPP
#def... | ALGO | 0.989933 | 6.061237 |
a25a478f-52b8-4668-b186-6c58ebb8af47 | reevacodes/DSA_ARRAY | pattern9.cpp | #include<bits/stdc++.h>
using namespace std;
void print(int n){
for(int i=0;i<n;i++){
// space
for(int j=0; j<=n-i-1; j++){
cout<<" ";
}
// star
for(int j=0; j<2*i+1; j++){
cout<<"*";
}
// space
for(int j=0; j<n-i-1; j++){
cout<<" ";
... | ALGO | 0.999952 | 4.003569 |
517e700d-6bc3-42e2-97ba-a8d62b70cdd8 | saady789/DSA-Practice | Hashmaps/SumOfUniqueElements.cpp | // class Solution {
// public:
// int sumOfUnique(vector<int>& nums) {
// map<int,int> mp;//<value,frequency>
// for(int i=0;i<nums.size();i++){
// if(mp.find(nums[i]) == mp.end()){
// mp[nums[i]] = 1;
// }
// else mp[nums[i]]++;
// }
// ... | ALGO | 0.999537 | 6.006967 |
073e7254-415e-48f9-9498-e49d37cfd559 | jeongjihyunn/codetree-TILs | 240813/정수 세 개 입력받아 출력/take-three-integers-and-output.cpp | #include <iostream>
using namespace std;
int main() {
int a,b,c;
cin>>a>>b>>c;
cout<<a<<" "<<b<<" "<<c;
// 여기에 코드를 작성해주세요.
return 0;
} | ALGO | 0.99338 | 3.983302 |
0c0844c4-6cb5-40f0-bce1-9024d1939edc | Infinity-Intellect/90_days_DSA | Day7/sudokuSolver.cpp | class Solution {
public:
bool isValid(vector<vector<char>>& board,
int row, int col, char ch) {
for(int i=0; i<9; i++) {
if(board[row][i] == ch) {
return false;
}
if(board[i][col] == ch) {
return false;
}
if(board[3*(row/3) ... | ALGO | 0.99939 | 6.755955 |
f4eba9a3-417b-4956-8a27-564b50279c31 | Samsung/ONE | compiler/circle-mpqsolver/src/pattern/PatternResolver.cpp | #include "PatternResolver.h"
#include <map>
#include <set>
#include <vector>
using namespace mpqsolver::pattern;
using LayerParam = luci::CircleQuantizer::Options::LayerParam;
namespace
{
/**
* SUBGRAPH PATTERN
* LayerNorm := (ifm - |ifm|) / sqrt(|(ifm - |ifm|)^2| + eps)
* - |x|: mean of x
* - Below dia... | ALGO | 0.912166 | 6.538237 |
cce828ee-c29a-4353-9699-6869b38be770 | ForgingAhead/ACM-Codility-LeetCode | ACM JOJ practice/ugly1751.cpp | #include<stdio.h> //only by 2 3 5
int main(){
int count=0;
int val;
while(count<1500){
if(count==0)val=1;
else if(count==1)val=2;
else if(count==2)val=3;
else if(count==3)val=4;
else if(count==4)val=5;
else{
while(1){
val++;
int num=val;
while(num%2==0)num/... | ALGO | 0.999946 | 3.534784 |
96edbe03-0eb0-4242-b1c8-d6e5fa745273 | flowerfx/cc2dx_design_fw | cocos2dx-lib/tests/cpp-tests/Classes/BugsTest/Bug-1174.cpp | //
// Bug-1174
// http://code.google.com/p/cocos2d-iphone/issues/detail?id=1174
//
#include "Bug-1174.h"
USING_NS_CC;
int check_for_error( Vec2 p1, Vec2 p2, Vec2 p3, Vec2 p4, float s, float t );
int check_for_error( Vec2 p1, Vec2 p2, Vec2 p3, Vec2 p4, float s, float t )
{
// the hit point is p3 + t * ... | TEST | 0.873752 | 5.748969 |
54ae424b-fab9-442f-b895-c09f196e0451 | ChavaNitinsaichowdary/Coding | 0022-generate-parentheses/0022-generate-parentheses.cpp | class Solution {
public:
void helper(int i,int j,string& o,string& c,string t,vector<string>& ans){
if(j>i)return;
if(i==o.size() && j == c.size()){
ans.push_back(t);
return;
}
if(i==o.size()){
helper(i,j+1,o,c,t+')',ans);
return;
... | ALGO | 0.999889 | 5.839726 |
30309bcd-30a2-4f49-9479-58ea8022df84 | delicm/cses | Range Queries/Pizzeria Queries/main.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long int
int n, N = 1, m;
vector <tuple<int, int, int, int>> tree;
bool ifLeft(int p)
{
while(p > 1)
{
if(p % 2 == 1) return false;
else p /= 2;
}
return true;
}
bool ifRight(int p)
{
return ifLeft(p+1);
}
void updat... | ALGO | 0.999901 | 4.610801 |
7114d2a7-58d4-4df8-95a7-b59b141d0870 | javadev/LeetCode-in-All | src/main/cpp/g0001_0100/s0074_search_a_2d_matrix/Solution.cpp | // #Medium #Top_100_Liked_Questions #Array #Binary_Search #Matrix #Data_Structure_I_Day_5_Array
// #Algorithm_II_Day_1_Binary_Search #Binary_Search_I_Day_8 #Level_2_Day_8_Binary_Search
// #Udemy_2D_Arrays/Matrix #Top_Interview_150_Binary_Search #Big_O_Time_O(endRow+endCol)_Space_O(1)
// #2024_05_26_Time_0_ms_(100.00%)_... | ALGO | 0.999915 | 6.882712 |
ef232512-d4f2-44e0-838f-0cede92f05cb | TuanVuNguyen89/V-s-Notebook | MATRIX.cpp | const int Mod = 1e9 + 7;
const int sz = 2;
struct MATRIX {
int d[sz][sz];
MATRIX() {
memset(d, 0, sizeof d);
}
friend MATRIX operator * (MATRIX A, MATRIX B) {
MATRIX C;
for (int i = 0; i < sz; i++)
for (int j = 0; j < sz; j++)
for (int k = 0; k < sz... | ALGO | 0.999883 | 4.035931 |
409c57d6-06bd-4ca0-9017-adda0b440bff | joserandu/Segundo-Semestre | Estrutura de Dados 1/Listas, Filas e Pilhas/Intro conceito de listas_Pilha.cpp | #include <stdio.h>
#include <locale.h>
/*
- Funcionalidades a serem implementadas na estrutura PILHA
Insero, remoo, Topo (mostra o elemento que est no topo da pilha
mas no o remove) , verificao se a pilha est vazia, verificao se a
pilha est cheia.
*/
#define TAM_MAX 100
int main() {
setlocale(LC_ALL, "Portugue... | ALGO | 0.987144 | 4.535184 |
d1a338d6-95eb-425a-a749-e72b26e8013c | gogo40/GoGo40-keygen | win_deps/fips140/rsa.cpp | // rsa.cpp - written and placed in the public domain by Wei Dai
#include "pch.h"
#include "rsa.h"
#include "asn.h"
#include "sha.h"
#include "oids.h"
#include "modarith.h"
#include "nbtheory.h"
#include "algparam.h"
#include "fips140.h"
#if CRYPTOPP_DEBUG && !defined(CRYPTOPP_DOXYGEN_PROCESSING) && !defined(CRYPTOPP_... | ALGO | 0.980684 | 7.829356 |
0d17b8c4-6bc0-44f4-a9e8-b7737220478a | LuloTchicourel/TP1 | Ejercicio3/main.cpp | #include <iostream>
#include <vector>
#include <memory>
#include <cstdlib>
#include <ctime>
#include "Character_Factory/Character_Factory.hpp"
using namespace std;
int main(){
srand(time(nullptr));
int num_warriors = 3 + rand() % 5; // rango 3-7
int num_wizards = 3 + rand() % 5; // rango 3-7
vector... | TOOL | 0.856388 | 4.868637 |
6e8e6813-a503-4dfc-9a80-3ac495652fb3 | Saleh7127/CPP-solution-by-Fellow_junior | Codeforces/cf1462A.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define test int t; cin>>t; for(int cs=1;cs<=t;cs++)
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
test
{
ll a[10000],b,c,d,e,f,i,j,k,l;
cin>>b;
for(i=1; i<=b; i++)
{
... | ALGO | 0.999905 | 3.385206 |
8d9349c2-7b49-48e0-a52f-682139e13a3e | Veljko28/cpp-data-algrtms | codeforces/8/LineToCashier.cpp | #include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <numeric>
#include <string>
#include <cstring>
#include <set>
using namespace std;
#define ll long long
#define sync ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
template<typename... T>
void read(T& ...args) {
((cin >> arg... | ALGO | 0.999331 | 3.538451 |
0abd04ca-7e40-4f80-9eef-d40603a22e49 | TangliziGit/icpc-code | algorithms/graph/poj-1511-2.cpp | #include <queue>
#include <cstdio>
#include <vector>
#include <cstring>
using namespace std;
const int maxn=1e6, maxm=maxn;
const long long INF=1LL<<60;
struct Edge{
int to, dis, next;
}edges[maxm+5], redges[maxn+5];
int size, rsize, head[maxn+5], rhead[maxn+5];
inline void addEdge(int from, int to, int dis){
... | ALGO | 0.999954 | 4.364252 |
e2f3c82d-3bfe-4cad-a36d-f4d63edbd2a9 | vinaymourya24/DSA_Questions | String/Split With Minimum Sum.cpp | class Solution {
public:
int splitNum(int num) {
string s = to_string(num);
sort(s.begin(),s.end());
string n1,n2;
for(int i=0; i<s.size(); i++)
{
if(i&1)
{
n2.push_back(s[i]);
}
else
{
... | ALGO | 0.999924 | 5.543157 |
fbfed0ca-530d-4d46-9967-d424372869a1 | doocs/leetcode | solution/1900-1999/1989.Maximum Number of People That Can Be Caught in Tag/Solution.cpp | class Solution {
public:
int catchMaximumAmountofPeople(vector<int>& team, int dist) {
int ans = 0;
int n = team.size();
for (int i = 0, j = 0; i < n; ++i) {
if (team[i]) {
while (j < n && (team[j] || i - j > dist)) {
++j;
}
... | ALGO | 0.999967 | 5.473316 |
df7fd456-494a-4f2e-bdbb-6225fd1dd0f1 | Prahmodh-Raj1/DSA-Solutions | Graphs/BFS & DFS/Kefa and Park.cpp | //prob link: https://codeforces.com/problemset/problem/580/C
//TC: O(N)
#include<bits/stdc++.h>
typedef long long int ll;
#define pp pair<ll,ll>
#define dbg printf("in");
#define NL printf("\n");
#define pi 3.1416
#define Size 100010
#define inf 1000000000000
#define max2(a,b) ((a<b)?b:a)
#define max3(a,b,c) max2(m... | ALGO | 0.999891 | 4.002244 |
4adcfd98-16e2-49bc-91b1-a5a4485a4f4a | Mark-Yazemboski/AERSP-424 | Week 07 Participation/Decimal_To_Octal.cpp | #include <iostream>
#include <string>
#include<math.h>
using namespace std;
string Decimal_to_Octal(int Decimal){
string Octal_Number;
int Length_Base_8_Number = log(Decimal) / log(8);
for (int i = Length_Base_8_Number;i>=0;i--){
int Digit = Decimal / pow(8, i);
Octal_Number += to_string... | ALGO | 0.988423 | 5.16821 |
ca945562-ec11-4042-a3f5-c47dca20aca4 | cfreeze111/ncnn_face_rec | third_party/ncnn/src/layer/concat.cpp | #include "concat.h"
namespace ncnn {
Concat::Concat()
{
one_blob_only = false;
support_inplace = false;
}
int Concat::load_param(const ParamDict& pd)
{
axis = pd.get(0, 0);
return 0;
}
int Concat::forward(const std::vector<Mat>& bottom_blobs, std::vector<Mat>& top_blobs, const Option& opt) const
{
... | ALGO | 0.927862 | 5.855212 |
912aa6b0-1eff-4329-b6c8-3b71f848c92c | bokusunny/atcoder-archive | atcoder.jp/abc033/abc033_d/Main.cpp | #include <bits/stdc++.h>
using namespace std;
struct Point {
long double x, y;
Point operator-(const Point& other) { return Point{x - other.x, y - other.y}; }
double get_rad() { return atan2(y, x); }
};
const long double EPS = 1e-11;
int main() {
int N;
cin >> N;
vector<Point> P(N);
for (int i = 0; i... | ALGO | 0.999728 | 4.576773 |
a45b6a39-7cc2-4b67-8de1-ba0c7c647ae4 | noman5945/Coding-Problems-and-Contests | Codeforces/div2_chips_on_board.cpp | #include<bits/stdc++.h>
using namespace std;
using li = long long;
void solve(){
long long n,ain,bin,sumA=0,sumB=0,sum=0;
cin>>n;
vector<li> a;
vector<li> b;
long long min_1=INT_MAX;
long long min_2=INT_MAX;
for(int i=0;i<n;i++){
cin>>ain;
a.push_back(ain);
min_1=min... | ALGO | 0.999931 | 3.753859 |
64e606bd-9f87-4567-9d79-c28f88e8642d | rohit-yadavv/DSA-Questions | babbar sheet sol/Array/35. find median.cpp | //? https://www.geeksforgeeks.org/problems/find-the-median0527/1
class Solution {
public:
int find_median(vector<int> v){
sort(v.begin(), v.end());
int n = v.size();
int res;
if (n%2==1) {
res = v[n/2];
} else {
res = (v[(n/2)-1] + v[n/2])/2;
... | ALGO | 0.99992 | 5.706823 |
2a7c3dcf-46e5-45a5-98ae-0d3d84fc6d64 | pjreddie/RayTracer | CImg/examples/mcf_levelsets3d.cpp | #include "CImg.h"
using namespace cimg_library;
#undef min
#undef max
// Apply the Mean curvature flow PDE
//-----------------------------------
template<typename T> CImg<T>& mcf_PDE(CImg<T>& img, const unsigned int nb_iterations,
const float dt=0.25f, const float narrow=4.0f) {
... | ALGO | 0.99985 | 6.04529 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.