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 |
|---|---|---|---|---|---|---|
c0dec85a-b487-43d2-8528-2853cbe6b245 | muscleJoah/Algorithm-Study | LeetCode/Medium/Sum Of Square Numbers.cpp | //leetcode 633
class Solution {
public:
bool judgeSquareSum(int c) {
for(int i=0 ;i <=sqrt(c) ; i++){
int mod = c - i*i;
double temp = sqrt(mod);
if(temp == (int)temp)
return true;
}
return false;
}
};
| ALGO | 0.999953 | 5.337644 |
01c367c3-e91d-4033-9bf1-3f6cff2a6b0d | karthvya07/day4 | binarytodecimal.cpp | //binary to decimal conversion
#include<iostream>
using namespace std;
int main(){
int n;
cin>>n;
int add=0;
int power=1;
while(n>0){
int mod=n%2;
add=add+(mod*power);
power=power*10;
n=n/2;
}
cout<<add;
} | ALGO | 0.999959 | 4.437548 |
dd716e29-54e9-4c70-930e-f3733f1e7412 | DeveshKumar8423/DSA-Sheets | Fraz Leetcode/Maths/add_binary.cpp | class Solution {
public String addBinary(String a, String b) {
int carry=0;
String result="";
int i=0;
int alen=a.length();
int blen=b.length();
while(i<alen||i<blen||carry!=0){
int x = 0;
if(i<alen && a.charAt(alen-1-i) =='1') x = 1;
int y = 0;
if(i<blen && b... | ALGO | 0.995563 | 3.832721 |
5ec46edb-96e3-4a97-b091-5e5b71c7ee53 | feng-ruijie/CPL | csp2024/T1-S.cpp | #include<iostream>
#include<algorithm>
using namespace std;
const int N = 1e5 + 7;
int a[N],n,b[N];
int main(){
// freopen("a1.in","r",stdin);
// freopen("a1.out","w",stdout);
scanf("%d",&n);
for(int i=1;i<=n;i++) scanf("%d",&a[i]);
sort(a+1,a+n+1);
int sum = 1, tot = 0;
for(int i=2;i<=n;i++){... | ALGO | 0.99996 | 3.40156 |
1f1b6fe4-63ae-4cfe-a69c-1ffe128f0350 | i-Swati/Leetcode | 2448-count-number-of-bad-pairs/2448-count-number-of-bad-pairs.cpp | class Solution {
public:
long long countBadPairs(vector<int>& nums) {
//Optimal approach
//bad pairs= total pairs - good pairs
//tp= n(n-1)/2
//gp--> j-i==nums[j]-nums[i] //j-nums[j]==i-nums[i]
long long n= nums.size();
unordered_map<int, int> mp;
long long... | ALGO | 0.999986 | 5.532415 |
d5964fd3-9533-4057-b9bc-bc2a4f658a75 | oxygen-hunter/Flashboom | data/big-vul-100/add_attention_code/Phi/top0-100/distribute-repeating-integers-Solution.canDistribute/177789_DoS_Exec_Code_Overflow.cpp | poppler_page_prepare_output_dev (PopplerPage *page,
double scale,
int rotation,
gboolean transparent,
OutputDevData *output_dev_data)
{
CairoOutputDev *output_dev;
cairo_surface_t *surface;
double width, height;
int cairo_width, cairo_height, cairo_rowstride, rotate;
unsigned char *cairo_d... | ALGO | 0.986967 | 4.704006 |
2586c2af-3b3c-47f6-983a-ecbf8bd9fc98 | Spongebob-mo/autoware.universe-main | common/signal_processing/src/butterworth.cpp | #include "signal_processing/butterworth.hpp"
#include <rclcpp/logging.hpp>
#include <iomanip>
#include <numeric>
#include <sstream>
/**
* @brief Computes the minimum of an analog Butterworth filter order and cut-off frequency give
* the pass and stop-band frequencies and ripple magnitude (tolerances).
* @param... | ALGO | 0.933649 | 6.508801 |
e928ec79-2de3-4c63-a50f-93ace6562b93 | ByteBug01/Leetcode_DSA | 1293-three-consecutive-odds/1293-three-consecutive-odds.cpp | class Solution {
public:
bool threeConsecutiveOdds(vector<int>& arr) {
int n = arr.size();
for(int i = 0; i <= n - 3; i++){
if(arr[i] % 2 == 1 && arr[i+1] % 2 == 1 && arr[i+2] % 2 == 1){
return true;
}
}
return false;
}
}; | ALGO | 0.999744 | 5.553608 |
5047f367-ec57-46d3-b2cf-078a3b0c9627 | raincross7/code-similarity | codes/train_code/problem179/problem179_447.cpp | #include <iostream>
#include <cstdio>
#include <cstdlib>
using namespace std;
typedef long long ll;
const int N = 100100;
int n, k;
ll a[N];
ll sum[N];
ll pref[N], suf[N];
int main()
{
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
scanf("%d%d", &n, &k);
for (int i = 0; i < n; i++)
... | ALGO | 0.999841 | 3.880488 |
3f177287-5bcc-4b23-82c8-445adc85a6b4 | ishandutta2007/codeforces | 4et_llpuyhbljl/normal/276/B.cpp | #pragma comment(linker, "/STACK:2759095000")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,abm,mmx,tune=native")
#include<vector>
#include<iostream>
#include<stack>
#include<cmath>
#include<algorithm>
#include<set>
#include<map>
#include<string>
#include<tupl... | ALGO | 0.999994 | 4.31471 |
c96f2126-eeca-44b6-99b7-ba3bb8c7b2b5 | pratikp2/Turing_Tasks | Task-75558/Turn1-ModelB.cpp | #include <iostream>
#include <thread>
#include <queue>
#include <condition_variable>
#include <mutex>
#include <atomic>
#include <chrono>
// Message struct
struct Message {
int data;
};
// Constants
const int NUM_WORKERS = 3;
const int MAX_MESSAGES = 10;
// Global variables
std::queue<Message> messageQueue;
std:... | ALGO | 0.98991 | 6.278228 |
a5081f80-0789-405e-bddc-c2ffd1a8ca9f | chiyueOfgit/SmartObliquePhotography | libigl/include/igl/copyleft/cgal/cell_adjacency.cpp | #include "cell_adjacency.h"
template <typename DerivedC>
IGL_INLINE void igl::copyleft::cgal::cell_adjacency(
const Eigen::PlainObjectBase<DerivedC>& per_patch_cells,
const size_t num_cells,
std::vector<std::set<std::tuple<typename DerivedC::Scalar, bool, size_t> > >&
adjacency_list) {
const size_t ... | TOOL | 0.850918 | 5.150003 |
64f6156a-6b03-4f7d-a235-0e135f294320 | olaid/atcoder | PracticeA.cpp | // PracticeA - Welcome to AtCoder
#include <stdio.h>
int main()
{
int a, b, c;
char s[101];
// 整数の入力
scanf("%d", &a);
// スペース区切りの整数の入力
scanf("%d %d", &b, &c);
// 文字列の入力
scanf("%s", s);
// 出力
printf("%d %s\n", a + b + c, s);
return 0;
}
#include <stdio.h>
int main()
{
int ... | TOOL | 0.98122 | 3.346681 |
d0404290-de08-478f-b58a-9ff955a487f5 | mgoodfel/SeaOfMemes | Milligram/mg2D/Source/Generic2D/Old/Polygon/mgSubPolygon.cpp | #include "stdafx.h"
#ifdef SUPPORT_GEN2D
#ifdef DEBUG_MEMORY
const char THIS_FILE[] = __FILE__;
#define new new(THIS_FILE, __LINE__)
#endif
#include "mgPolyTypes.h"
#include "mgSubPolygon.h"
//! Constructor.
/*! Note that the ownership of the vertex array is transferred.
*/
mgSubPolygon::mgSubPolygon(
VECTOR2D ... | ALGO | 0.983232 | 5.310392 |
b5c947a8-e797-4731-8f74-a1ed6696041c | keshav-1303/CP_to_study | Max Flow Dinic 2.cpp | //
// Dinic's maximum flow
//
// Description:
// Given a directed network G = (V, E) with edge capacity c: E->R.
// The algorithm finds a maximum flow.
//
// Algorithm:
// Dinic's blocking flow algorithm.
//
// Complexity:
// O(n^2 m), but very fast in practice.
// In particular, for a unit capacity graph,
//... | ALGO | 0.999968 | 5.546889 |
b8541e93-78d6-4185-91c4-4f13a2445319 | risal-shefin/Competitive-Programming | CodeForces/Solutions/216A.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int a, b, c;
cin >> a >> b >> c;
cout << ( a * b * c - (a - 1) * (b - 1) * (c - 1) ) << endl;
} | ALGO | 0.999963 | 4.283429 |
509167e1-1366-43aa-8283-f1d2036815ed | xupeiwust/nextfoam-cfd | ThirdParty-2405/sources/boost/boost_1_74_0/libs/geometry/doc/src/examples/algorithms/assign_box_corners.cpp | // Boost.Geometry (aka GGL, Generic Geometry Library)
// QuickBook Example
//[assign_box_corners
//` Shows how four point can be assigned from a 2D box
#include <iostream>
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/box.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
using namespace boo... | TOOL | 0.920058 | 7.237854 |
cb47443c-837b-4f99-80db-75c3fc1107af | duckdb/duckdb-test-staging | third_party/mbedtls/library/gcm.cpp | /*
* http://csrc.nist.gov/publications/nistpubs/800-38D/SP-800-38D.pdf
*
* See also:
* [MGV] http://csrc.nist.gov/groups/ST/toolkit/BCM/documents/proposedmodes/gcm/gcm-revised-spec.pdf
*
* We use the algorithm described as Shoup's method with 4-bit tables in
* [MGV] 4.1, pp. 12-13, to enhance speed without using... | ALGO | 0.998447 | 6.722478 |
1c3eff10-8534-4f82-9289-1112d404c637 | aurastejeroiu/DSA | L3/Multime.cpp | #include "Multime.h"
#include "IteratorMultime.h"
#include <iostream>
Node::Node(TElem elem, PNod urm, PNod ant) {
this->e = elem;
this->urm = urm;
this->ant = ant;
}
TElem Node::element() {
return this->e;
}
PNod Node::urmator() {
return this->urm;
}
PNod Node::anterior() {
return this->ant;
}
Multime::Mul... | TOOL | 0.92215 | 4.81102 |
343920de-e88d-4324-a66d-23de9514a59b | guilhermevieirasilvagoncalves/URI | bee3096.cpp | #include <bits/stdc++.h>
using namespace std;
long long countdigits(int n){
if(n <= 1)
return n;
else{
double x = ((n * log10(n / M_E)) + (log10(2 * M_PI * n) / 2.0));
return floor(x) + 1;
}
}
int main(int argc, char const *argv[])
{
int N;
cin >> N;
long long int ... | ALGO | 0.999654 | 3.913241 |
c53a298e-dc34-4a05-bc9c-facd993ca0ed | Ibn-Omar-Romel/Competitive_Programming_Codeforces | Solved/A_Double_Cola.cpp | #include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <bitset>
#include <cstdio>
#include <limits>
#include <vector>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <fstream>
#include <numeric>
#inc... | ALGO | 0.999943 | 3.365023 |
b939abe9-1190-47ec-9673-6c11ba67d994 | Cuda-Chen/leetcode_pratice | 1268/solution_naive.cpp | // naive (brute-force)
class Solution {
public:
vector<vector<string>> suggestedProducts(vector<string>& products, string searchWord) {
vector<vector<string>> result;
sort(products.begin(), products.end(), [](const string &a, const string &b) {
if(a.compare(0, b.size(), b) == 0
... | ALGO | 0.999976 | 6.40604 |
ab8274ec-4b43-466c-b2bb-643e2bb23f4e | abahnasy/conpra | week_10/ProblemC.cpp | //
// Created by abahnasy on 28.06.20.
//
#include <bits/stdc++.h>
using namespace std;
# define ERROR 0.000001f;
#define PI 3.14159265358979323846f;
struct Point {
double x;
double y;
};
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.precision(17);
// redirect input stream t... | ALGO | 0.997614 | 4.385835 |
5ce2c58c-bfea-49ee-b710-63b6c671e628 | trannguyenducan/trannguyenducan_MonC | Chapter_2/Bt_17.cpp | // Chuong tirnh tinh so tien mua co phieu
#include <iostream>
using namespace std;
int main()
{
double GiaGoc = 35.00;
char SoLuong = 350;
double GiaBan = GiaGoc * SoLuong;
double HoaHong = GiaBan * 0.02;
double Tong = GiaBan + HoaHong;
cout << "Gia co phieu chua tinh hoa hong: " << GiaBan << en... | TOOL | 0.985498 | 3.978022 |
b2985b30-d149-4055-a49f-9071f6e06203 | AdvTrainEvalSrcDomain/adv-train-evaluation-source-code-domain | code-imitator/data/dataset_2017/dataset_2017_8/VGel/8294486_5681755159789568_VGel.cpp | #include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <string>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <set>
#include <map>
#include <queue>
#include <vector>
#define LL long long
#define CLR(a,x) memset(a,x,sizeof(a))
using namespace std;
const double DINF=(doubl... | ALGO | 0.999918 | 3.629846 |
ddbdbb43-3e5e-4b11-b0f2-1f7fb40c1a80 | OzzieIsaacs/winmerge-qt | ext/boost_1_70_0/libs/compute/perf/perf_set_symmetric_difference.cpp | #include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>
#include <boost/compute/system.hpp>
#include <boost/compute/algorithm/set_symmetric_difference.hpp>
#include <boost/compute/container/vector.hpp>
#include "perf.hpp"
int rand_int()
{
return static_cast<int>((rand() / double(RAND_MAX)) ... | ALGO | 0.974242 | 6.406789 |
99ac2772-7457-41f9-83bc-3ee38fcd12db | Imranf620/Data-Structure-and-Algo | forloop.cpp | #include <iostream>
using namespace std;
int main()
{
// int n;
// cout << "Enter the value of n: " << endl;
// cin >> n;
// int sum = 0;
// for (int i = 1; i <= n; i++)
// {
// sum += i;
// }
// cout << "Sum of first " << n << " natural numbers: " << sum << endl;
// fo... | ALGO | 0.997694 | 3.72602 |
f151379b-6309-4ae0-b0b2-640ee3b84aba | rahul-goel/CompetitiveProgramming | USACO/Closing the Farm.cpp | /*
Created by Rahul Goel.
*/
#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;
template < typename T >
using ordered_set = tree<T, n... | ALGO | 0.99998 | 4.720503 |
83fd95d7-ada4-4c59-be2f-37821b2c7964 | angrammenos97/ece_projects | Object-oriented Programming/Part C/ImmunityCompetition.cpp | #include "ImmunityCompetition.h"
using namespace std;
void ImmunityCompetition::compete(Team &team, ImmunityAward immunityAward)
{
string winner = "";
int maxIndex = -1;
float maxValue = -1;
for(int i = 0; i < 10; i++)
{
if (maxValue < team.getPlayers()[i].getPower() && team.getPlayers()[... | ALGO | 0.998263 | 3.924002 |
1ba8b272-b23c-46b6-ae40-ad1142361ec0 | checkedc/checkedc-llvm-project | libcxx/test/std/containers/sequences/vector/vector.cons/initializer_list.pass.cpp | // UNSUPPORTED: c++03
// <vector>
// vector(initializer_list<value_type> il);
#include <vector>
#include <cassert>
#include "test_macros.h"
#include "min_allocator.h"
#include "asan_testing.h"
int main(int, char**)
{
{
std::vector<int> d = {3, 4, 5, 6};
assert(d.size() == 4);
assert(is_contiguous_co... | TEST | 0.856266 | 4.4617 |
783e26f7-0794-4f60-800d-93e5a4d5a98f | nextpointer/dsa-journey | Tree/BinarySearchTree/03_findfloor.cpp | #include <bits/stdc++.h>
using namespace std;
struct Node
{
int data;
Node *left;
Node *right;
Node(int value)
{
data = value;
left = right = NULL;
}
};
class Solution{
public:
int floor(Node* root, int x) {
if (root == NULL)
return -1;
int floo... | ALGO | 0.999994 | 5.159677 |
0e31ef03-2a7a-4981-9d1b-77c80ff0a6db | TheHarshal30/CPP-DSA-CP | Codeforces & Leetcode/CommonPrefixes.cpp | /* Code by Harshal Rudra(harshal_3073)*/
#include<bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL)
#define rep(i,n) for(int i=0;i<n;i++)
#define ll long long int
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define scanit for(int i=0;i<n;i++) cin>>v[i]
#define vll vector<ll>
#def... | ALGO | 0.99962 | 3.277256 |
970a14b4-424f-4d5d-ac4e-1833d1d3cf11 | nz0001na/face_enhancement | code_frontalize/frontalize.0.1.3/calib/calib.cpp | #include <stdio.h>
#include <iostream>
#include <sstream>
#include <opencv/cv.h>
#include <mex.h>
#include <util.h>
#include <vector>
#include <cmath>
#include "POSIT.h"
using namespace std;
#define printf mexPrintf
const string programName = "calib";
enum MatlabInEnum {
MATLAB_IN_WIDTH = 0,
MATLAB_IN_HEIGHT,
MAT... | ALGO | 0.975378 | 3.965836 |
625ee89d-259c-47d6-91e0-42a1228b7e88 | yaneurao/YaneuraOu | source/eval/material/evaluate_material.cpp | #include "../../config.h"
#if defined(EVAL_MATERIAL)
#include "../../types.h"
#include "../../position.h"
#include "../../evaluate.h"
// パラメーターの自動調整フレームワーク
#include <array>
#include <cmath>
#include <algorithm> // for std::min()
#include <numeric> // for std::accumulate()
#define SIZE_OF_ARRAY(array) (sizeof(array)... | ALGO | 0.998932 | 4.830999 |
8b8f187d-e280-437f-b345-ae2bca072e2f | Sudhir769/Sudhirleet769 | Difficulty: Easy/Swap and Maximize/swap-and-maximize.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// long long int maxSum(int arr[], int n);
// } Driver Code Ends
class Solution {
public:
long long maxSum(vector<int>& arr) {
int n = arr.size();
sort(arr.begin(), arr.end());
int i=0, j=n-1;
long long... | ALGO | 0.99874 | 6.128226 |
fb595d43-77da-4895-81d6-27a2cc735d12 | Derek-Scheuerman/Coding-1-cpp | Help/Aaron-Example/main.cpp | #include <cstdlib> // Includes the necessary library for random number generation
#include <ctime> // Includes the necessary library to seed the random number generator
#include <iostream> // Includes classes like cin for input and cout for output.
#include <string> // This library offers a set of classes and functions... | TOOL | 0.959577 | 6.574216 |
d0f746a2-cddd-4753-bdb0-40f9e8d9aef5 | sachaservan/spdz_mpc | src/Math/modp.cpp | #include "modp.h"
#include "Zp_Data.h"
#include "Exceptions/Exceptions.h"
/***********************************************************************
* The following functions remain the same in Real and Montgomery rep *
***********************************************************************/
void modp::randomize(PR... | ALGO | 0.959727 | 3.275115 |
6e7bdb53-b4e8-4ca4-b950-728ad7d7e3fc | Stephenalexngo/Java-Cpp-Programs | KattisC++/modulo.cpp | #include<bits/stdc++.h>
using namespace std;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<int> vi;
typedef vector<double> vdb;
typedef vector<long> vl;
typedef vector<long long> vll;
typedef pair<int,int> ii;
typedef stack<long long> sll;
typedef stack<long> sl;
typedef stack<char> sc;
typedef st... | ALGO | 0.999199 | 3.4139 |
948714b1-3587-48d3-a498-4545fbccf1da | woodcoding/HUAS_ACM | 2017_summer_acmcode/self pratice/POJ - 3259/main.cpp | #include <iostream>
#include <cstdio>
#include <queue>
#include <vector>
using namespace std;
const int inf=0x3f3f3f3f;
const int maxn=505;
int dis[maxn], inq[maxn], cnt[maxn];
vector<pair<int, int> > E[maxn];
int f, n, m, w;
void init(){
for(int i=0;i<maxn;i++){
dis[i]=inf;
E[i].clear();
... | ALGO | 0.99997 | 4.383836 |
a7ab660d-3a08-453c-8b10-870d8ec59355 | roalgo-discord/arhiva-educationala | docs/codes/misc/trie/sol_cuvinte.cpp | #include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7, N = 3e5 + 1;
struct Mint {
int val;
Mint(int x = 0) { val = x % mod; }
Mint(long long x) { val = x % mod; }
Mint operator+(Mint oth) { return val + oth.val; }
Mint operator*(Mint oth) { return 1LL * val * oth.val; }
Mint oper... | ALGO | 0.999993 | 4.666188 |
2d4dbcb7-525c-4c7e-b83f-aa7e7536f3b5 | Altudy/solutionheejoon | LeetCode/1047. Remove All Adjacent Duplicates In String.cpp | class Solution {
public:
string removeDuplicates(string S) {
string ans;
int idx(0);
ans.push_back(S[0]);
for (int i = 1; i < S.length(); i++)
{
if (S[i] == ans[idx]) {
ans.pop_back();
idx--;
}
else {
... | ALGO | 0.999965 | 6.411392 |
3d3b3c51-57aa-4a63-ad4b-c3a54bd9a315 | hoshinon57/Algorithm | AtCoder/ABC401-500/ABC411-420/ABC412-E-2.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <cstdint>
using namespace std;
typedef long long ll;
// const ll INF64 = 1LL << 60;
const ll INF64 = ((1LL<<62)-(1LL<<31)); // 10^18より大きく、かつ2倍しても負にならない数
const int INF32 = 0x3FFFFFFF; // =(2^30)-1 10^9より大きく、かつ2倍しても負... | ALGO | 0.999947 | 5.049993 |
178f4fa8-c566-4f85-b4b9-0825983e82e0 | JSchoeberl/netgen-test | libsrc/general/hashtabl.cpp | /**************************************************************************/
/* File: hashtabl.cpp */
/* Author: Joachim Schoeberl */
/* Date: 01. Jun. 95 */
/***********... | ALGO | 0.994603 | 5.530684 |
93a063b8-e027-4b75-b122-64be1ef83346 | 00Spartacus/DSP-Python-and-Algorithm-C-Lab-codes | Lab 1-8/Algo Lab 8/Dij.cpp | #include<bits/stdc++.h>
#define N 1000
#define ll long long
using namespace std;
vector<pair<ll,ll>>v[N];
ll n,e;
void djikstra(ll src)
{
vector<int> dis(N, INT_MAX);
vector<bool> vis(N, false);
priority_queue<pair<ll,ll>> qu;
dis[src]=0;
qu.push({0,src});
while(!qu.empty())
{
ll ... | ALGO | 0.999961 | 4.000029 |
bc8ac5e3-385b-4cb0-aa9b-e048aced8c91 | vfolunin/archives-solutions | LeetCode/841.cpp | class Solution {
void dfs(vector<vector<int>> &graph, int v, vector<int> &visited) {
visited[v] = 1;
for (int to : graph[v])
if (!visited[to])
dfs(graph, to, visited);
}
public:
bool canVisitAllRooms(vector<vector<int>> &graph) {
vector<int> visited(g... | ALGO | 0.999784 | 6.377099 |
c0878151-bea6-4034-9d96-7c2fdc7e629b | Beau-Will/cpp_project | compititions/HDUOJ比赛/2025钉耙编程春季联合训练/第七场/1007.cpp | #include<bits/stdc++.h>
using namespace std;
using i128 = __int128;
using u64 = unsigned long long;
#define cc(x) cout << fixed << setprecision(x)
#define int long long
const int N = 2e5 + 10, M = N * 2;
struct Node {
int v, w, ne;
} e[M];
int idx = 1, h[N];
void add(int a, int b, int c) {
e[++idx] = {b, c, h[a]... | ALGO | 0.999892 | 4.436985 |
9acf2672-2f9b-40e4-9653-c4b48bf1cef6 | BibhabenduMukherjee/AdvancedCPP | code_bloating.cpp | #include <iostream>
// A simple template class performing arithmetic operations
template <typename T>
class Arithmetic {
public:
T add(T a, T b) { return a + b; }
T subtract(T a, T b) { return a - b; }
T multiply(T a, T b) { return a * b; }
T divide(T a, T b) { return b != 0 ? a / b : 0; }
};
// When ... | TOOL | 0.895937 | 7.019401 |
87fcd6f8-14c6-44e0-ab95-7128a6b8e7dc | komalkvy/LEET_CODE | 947-online-election/online-election.cpp | class TopVotedCandidate {
public:
unordered_map<int,int>mpp;
map<int, int>timelyMax;
TopVotedCandidate(vector<int>& persons, vector<int>& times) {
int leader = -1, maxVote = 0;
for(int i=0;i<times.size();i++){
mpp[persons[i]]++;
if (mpp[persons[i]] >= maxVote) {
... | ALGO | 0.999992 | 5.87518 |
1bb953f2-c109-4a34-ae29-3084a1fef0bd | amod404/DSA_notes_inC- | Phase-3/lec83.cpp | // backtracking - 02 the N-queen problem
#include<iostream>
#include<cstdlib>
#include<vector>
#include<stack>
#include<queue>
#include<string>
#include<map>
#include<unordered_map>
using namespace std;
void addSolution(vector<vector<int>> & ans, vector<vector<int>> & board,int n){
vector<int> temp;
for(int ... | ALGO | 0.999779 | 5.259236 |
1e3815d4-ebc8-49db-a728-6d7079c78202 | lorecioni/ImageSplicingDetection | source/illuminants/illumestimators/grayworld/grayworldestimator.cpp | #include "grayworldestimator.h"
#include "common/color.h"
#include "common/derivative.h"
#include "common/mask.h"
#include "common/statistics.h"
#include <opencv2/imgproc/imgproc.hpp>
#include <iostream>
namespace illumestimators {
GrayWorldEstimator::GrayWorldEstimator(int n, int p, double sigma) :
m_n(n),
m_p(p),... | ALGO | 0.986768 | 6.093537 |
25c8c7f5-c2f0-4cee-a815-dfcf20daaf03 | Tofsir7/Competitive-Programming | Hijibiji/MergeSort.cpp | #include <iostream>
using namespace std;
void Merge(int a[], int lb, int ub, int mid)
{
int i, j, k, temp[ub-lb+1];
i = lb;
k = 0;
j = mid + 1;
while (i <= mid && j <= ub)
{
if (a[i] < a[j])
{
temp[k] = a[i];
k++;
i++;
}
else
... | ALGO | 0.999942 | 4.562995 |
d1de3081-824e-4043-8700-a5831a856b84 | ishandutta2007/codeforces | doped.silicon/normal/1307/D.cpp | // clang-format off
#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;
#ifndef ritick
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,a... | ALGO | 0.999985 | 4.241514 |
1f63bfe4-dd8d-42d1-96c6-aa1b06fec20f | qscez2001/Data-Structure | sample_code/queue/circular/main1.cpp | //環狀佇列
//使用環狀佇列加上Tag處理資料:新增.刪除.輸出
#include<iostream>
using namespace std;
#define MAX 5
class Cqueue
{
private:
char item[MAX][20];
int front;
int rear;
//tag為記憶front所在是否有儲存資料, 0為沒有存放資料, 1為有存放資料
int tag;
public:
Cqueue();
void enqueue_f(void);
void dequeue_f(void);
void list_f(void);
};
Cqueue::Cqu... | ALGO | 0.994683 | 3.638472 |
a9954ae0-3899-48e9-99b0-c102390183ae | alexmaruichen/code | data structure/kd tree/2648.cpp | #include <stdio.h>
#include <algorithm>
using namespace std;
const int maxn=500010;
struct point
{
int x,y;
}p[maxn];
bool cmpx(const point &a,const point &b)
{
return a.x<b.x;
}
bool cmpy(const point &a,const point &b)
{
return a.y<b.y;
}
inline int dis(const point &a,const point &b)
{
return abs(a.x-b.x)+abs(a.y-... | ALGO | 0.999979 | 4.561817 |
7ec62014-0541-4914-91ba-99942ccae047 | Gin101/CS101 | luogu/P2014.cpp | #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
const int maxN = 301;
int num[maxN] = {0};
int dp[maxN][maxN] = {0};
struct Node {
int val = 0;
int next = 0;
} e[maxN];
int dfs(int u) {
int sum = 0;
int tmp = num[u];
while (tmp) {
sum += dfs(e[tmp].val) + 1... | ALGO | 0.999856 | 3.745507 |
8705d605-5657-423d-b87c-739683e79e1a | gvnee/dataStructures-Algorithm | codeforces/520B-graph.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define sz(x) int((x).size())
#define debug(x) cerr<<#x<<": "<<(x)<<"\n"
#define pb push_back
const int MxN = 100000;
void f(){
int n, m;
cin>>n>>m;
queue<pair<int, int>> q;
int dst[MxN] = {};
bool visited[MxN] = {};
q.push({n, 0});
... | ALGO | 0.999985 | 3.523564 |
ea9e8d1d-952b-4edc-bd8b-42e9ce11223a | shanto-datta/cplusplus | calc.cpp | // Your First C++ Program
#include <iostream>
using namespace std;
int main() {
int a, b;
cin >> a >> b;
double c = a / b;
cout << c << endl;
return 0;
}
| ALGO | 0.983731 | 4.343536 |
f9e0d2ab-3fc8-4f32-96d6-ca71192085ab | ytxhao/ytxplayerlib | android_armv7a/contrib/libx265/tmp/x265_2.5/source/common/predict.cpp | #include "common.h"
#include "slice.h"
#include "framedata.h"
#include "picyuv.h"
#include "predict.h"
#include "primitives.h"
using namespace X265_NS;
#if _MSC_VER
#pragma warning(disable: 4127) // conditional expression is constant
#endif
PredictionUnit::PredictionUnit(const CUData& cu, const CUGeom& cuGeom, int p... | ALGO | 0.94612 | 6.017196 |
27da41e3-8d46-4c81-8b58-e716561bf457 | anshuKumar99/Leetcode | Leetcode_1669_Merge In Between Linked Lists.cpp | /*
LEETCODE LINK : https://leetcode.com/problems/merge-in-between-linked-lists/description/
You are given two linked lists: list1 and list2 of sizes n and m respectively.
Remove list1's nodes from the ath node to the bth node, and put list2 in their place.
Build the result list and return its head.
Example 1:
Inp... | ALGO | 0.999901 | 5.425741 |
e1ea201c-b01d-4979-aa6e-8961339ee555 | ji-sang-geun/KW_Class_Study | Programming_Cpp_2020/Assignment2/Assignment2-6.cpp | #include <iostream> // Input / output standard header file definition
using namespace std;
class ThreeSixNine // Define Class 369
{
public: // We declare void print369 in public.
void print369(int number)
{
int number1 = 1; // Initialize to 1 because number starts at 1
int simbol;
while (number1 <= number) //... | ALGO | 0.984077 | 5.522581 |
33447ca7-f632-48c1-920b-7f5bf8ebc946 | GregWagner/Udemy-DSA-Courses | Coding-Minutes/Data_Structures_and_Algorithms_Essentials/Section_12_Backtracking/Exercises/n_queens.cpp | #include <iostream>
bool validSpot(int n, int board[][20], int x, int y) {
// check columns
for (int k {}; k < x; ++k) {
if (board[k][y]) {
return false;
}
}
// check left diagonal
int i { x };
int j { y };
while (i >= 0 && j >= 0) {
if (board[i][j]) {
... | ALGO | 0.999635 | 6.026082 |
092b58d1-0396-4be3-b89b-f77ddc3fd404 | saurav935/Emojify | opencv-master/opencv-master/samples/cpp/tutorial_code/gapi/porting_anisotropic_image_segmentation/porting_anisotropic_image_segmentation_gapi.cpp | /**
* @brief You will learn how port an existing algorithm to G-API
* @author Dmitry Matveev, <EMAIL>, based
* on sample by Karpushin Vladislav, <EMAIL>
*/
#include "opencv2/opencv_modules.hpp"
#ifdef HAVE_OPENCV_GAPI
//! [full_sample]
#include <iostream>
#include <utility>
#include "opencv2/imgproc.hpp"
#include ... | ALGO | 0.992284 | 6.573453 |
1c5bd720-6c28-40cd-993b-673603f23022 | trishit78/CP-Journey | codechef/starters/18.10.23/GCD_and_LCM.cpp | #include<bits/stdc++.h>
using namespace std;
#define int long long
const int MOD = 1e9 + 7;
const int INF = LLONG_MAX >> 1;
int gcd(int x, int y) {
while (y != 0) {
int t = x;
x = y;
y = t % x;
}
return x;
}
signed main()
{
ios::sync_with_stdio(false);
cin.tie(NULL);
int tc;
cin >>... | ALGO | 0.999985 | 4.044607 |
5589281f-f4ae-44d3-812c-99282b77b4e2 | anushthakur/LEETCODE | leetcode1406.cpp | //1406. Stone Game III
#include<bits/stdc++.h>
using namespace std;
//FRAZ
//https://youtu.be/HsY3jFyaePU
class Solution
{
public:
int dp[50001];
int help(vector<int>& stoneValue,int i)
{
if(i>=stoneValue.size()) return 0;
if(dp[i]!=-1) return dp[i];
else
{
int ans=INT_MIN;
ans=max(a... | ALGO | 0.999941 | 5.207278 |
4ec92f8f-9fe4-4dd6-8224-ba34b5c79752 | demon90s/cpplab | cpplabs/algorithm/non_modifying_algorithms/min_element.cpp | /*
min_element
寻找范围中最小的元素
min_element(first, last)
使用 operator< 比较元素
min_element(fist, last, comp)
使用二元比较函数 comp 比较元素
返回范围中最小的元素的迭代器,若有多个最小的元素,返回首个这种元素的迭代器。范围为空返回 last 。
*/
#include <algorithm>
#include <vector>
#include <iostream>
void Test1()
{
std::vector<int> vec {1, 2, 99, 33, ... | ALGO | 0.999072 | 5.703338 |
2c924f33-b493-42eb-9846-14b5a3dbafdb | fuyushiphilip/Coursera-Data-Structure-And-Algorithms-by-University-of-California-San-Diego | 1_Algorithmic-Toolbox/week6_dynamic_programming2/1_maximum_amount_of_gold/1_maximum_value_of_gold.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define ll long long
ll gold(int W, const vector<int> weights) {
vector<int> c(W + 1);
for (int i = 0; i < weights.size(); ++i) {
for (int j = W; j >= weights[i]; --j) {
c[j] = max(c[j], c[j - weights[i]] + weights[i]);
}
}... | ALGO | 0.999992 | 4.550171 |
ee2354a7-547d-4056-b96b-1a5fe7e39099 | sieusaodienanhvv/des | queue.cpp | #include <iostream>
#include <cstdio>
using namespace std;
void Enqueue(char queue[], char element, int& rear, int arraySize) {
if(rear == arraySize)
cout<<"OverFlow"<<endl;
else {
queue[rear] = element;
rear++;
}
}
void Dequeue(char queue[], int& front, int rear... | ALGO | 0.999033 | 3.161091 |
397a2bb6-8e07-4390-8390-b1bb651a8724 | saipavan2702/my-leetcode | problems/mirror_reflection/solution.cpp | class Solution {
public:
int mirrorReflection(int p, int q) {
while(p%2==0 and q%2==0)
{
p>>=1;
q>>=1;
}
return 1-p%2+q%2;
}
}; | ALGO | 0.999789 | 4.967781 |
8fc91300-5483-469c-82a9-93b8504a15be | sungho8/algorithm | 16943.cpp | #include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int ans = -1;
string A, B;
int main()
{
cin >> A >> B;
sort(A.begin(), A.end()); // next_permutation을 할때는 무조건 sort가 먼저 와야한다.
do
{
if (A[0] == '0')
continue;
if (stoi(A) < stoi(B))
... | ALGO | 0.999848 | 4.412351 |
789fc5a2-d4ba-4633-a4a6-5676e9252a9f | ragnar-vallhala/C-- | codeforce.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
vector<int> step(int diff,vector<int> &act, vector<int> &exp,vector<int> &ans ){
ans.clear();
for(int i{};act.size()>0;i){
vector<int> delta;
for(int j{};j<exp.size();j++){
delta.push_back(abs(act[i]-exp... | ALGO | 0.999978 | 4.452929 |
c882721d-5f8e-4b29-bd47-b286d7041918 | ProgrammingIncluded/RaspberryConway | source/hashlife.cpp | #include "app.hpp"
#include "quadtree.hpp"
#include "rle_loader.hpp"
#include <iostream>
#include <cstring>
#include <chrono>
#include <thread>
#define DEBUG 1
// Where the render window should be relative to screen coordinates
static lint POS_X = 0;
static lint POS_Y = 0;
// Set by main to allow scaling to be dyna... | TOOL | 0.864278 | 5.740827 |
ee9b83f3-18b4-472d-9152-7a7803618258 | happysnail2357/ThankYouCard-TemperatureModule | ThankyouCard/cards.cpp | //
// cards.cpp
//
// by Paul Puhnaty - 4/5/2024
//
// A program to simulate the Minotaur's "Thank you" card fiasco
//
/* * * Headers * * */
#include "../linkedlist.hpp"
#include "bag.hpp"
#include <iostream>
#include <vector>
#include <thread>
#include <atomic>
#include <stdlib.h>
#include <time.h>
#define S... | TOOL | 0.948276 | 4.283369 |
11cb3118-2a95-44c0-9aed-97cee695ae06 | changeworld/hackerrank | domains/cpp/stl/vector-sort.cpp | #include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
int n;
scanf("%d", &n);
std::vector<int>v(n);
for (int i = 0; i < n; i++) {
scanf("%d", &v[i]);
}
std::sort(v.begin(), v.end());
for (int i = 0; i < n; i++... | ALGO | 0.999711 | 3.915854 |
a6e9bd5e-ace5-4d26-9d51-c04a95764992 | khkim6040/CSED233 | PA_3 v6/PA_3 v6/mst.cpp | #include "mst.h"
#include <iostream>
#include <string>
using namespace std;
string MultiWayTree::preOrder() {
string output;
_preOrder(output, _root);
if (!output.empty())
output.pop_back();
return output;
}
void MultiWayTree::_preOrder(string& output, MultiNode *cur) {
if(cur == NULL)
return;
// std::cout... | ALGO | 0.999899 | 4.058273 |
a438ecfa-0de9-4636-b318-34f913b1cc52 | yn1323/burger-sauce | 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.998809 | 6.763549 |
31a341c3-9811-401b-97f9-550c35252063 | beet-stuffs/hardware_google_pixel | thermal/utils/thermal_info.cpp | #include "thermal_info.h"
#include <android-base/file.h>
#include <android-base/logging.h>
#include <android-base/properties.h>
#include <android-base/strings.h>
#include <json/reader.h>
#include <cmath>
#include <unordered_set>
namespace aidl {
namespace android {
namespace hardware {
namespace thermal {
namespace ... | TOOL | 0.954954 | 6.613595 |
6b925050-cebd-4193-9181-d1138013c96f | joshuaxiao13/USACO | 2017-2018 Season/US Open/Silver/multiplayerMoo.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pi;
typede... | ALGO | 0.999564 | 4.22566 |
b488010e-616c-4cd0-83d6-9591b24f1506 | AdvTrainEvalSrcDomain/adv-train-evaluation-source-code-domain | code-imitator/data/dataset_2017/dataset_2017_8_formatted_macrosremoved/gultai4ukr/5304486_5697460110360576_gultai4ukr.cpp | #include <bits/stdc++.h>
using namespace std;
int main(int argc, char **argv) {
ifstream fin("/home/roman/CodeliteProjects/Competitive/GCJ17_R1A/in.txt");
ofstream fout("/home/roman/CodeliteProjects/Competitive/GCJ17_R1A/out.txt");
int t;
fin >> t;
for (int testcase = 0; testcase < t; ++testcase) {
int ... | ALGO | 0.999697 | 3.651279 |
500f1e07-bcaa-4d1f-83e1-219587efdf12 | PIYUSHDAHLE/CPP-Programs | 07-conandbreak.cpp | #include<iostream>
using namespace std;
int main()
{
system("cls");
int pm=4000;
//neha only go out in odd days
for (int date=1; date<=30; date++)
{
if (date%2==0)
{
continue;
}
if (pm==0)
{
break;
}
pm=pm-300;
... | ALGO | 0.997057 | 3.553514 |
762c0481-cbc4-4437-bc62-061ebdb41b8d | hazerMf/Code-Ptit | BT/ki12324/no.cpp | #include<iostream>
#include<vector>
#include<string>
using namespace std;
bool chk(string s,int des){
int dem=0;
for(int i=0;i<s.length();i++){
if(s[i]=='1') dem++;
}
return dem == des;
}
void sinh(int len,int des,string s){
if(s.length()==len&&chk(s,des)){
for(int j=0;j<s.length()... | ALGO | 0.999571 | 3.809576 |
90cb67c6-f1ba-48ee-8465-be2d3fcc4e97 | pyPrarthan/Data-Structure-and-Aglorithm | Arrays/max&minInArray.cpp | //GeeksforGeeks
#include <iostream>
#include <limits.h>
using namespace std;
int setmini(int A[], int N)
{
int mini = INT_MAX;
for (int i = 0; i < N; i++)
{
if (A[i] < mini)
{
mini = A[i];
}
}
return mini;
}
int setmaxi(int A[], int N)
{
int maxi = INT_MIN;
... | ALGO | 0.998193 | 4.753298 |
b76b4101-052d-48ba-8d39-435305081740 | 8thMay03/DSA | CTDL_006.LocDuLieuTrungTrongDSLKDon.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
map<int,int> mp;
int n;
cin >> n;
int a[n];
for(int i=0;i<n;i++){
cin >> a[i];
mp[a[i]]=1;
}
for(int i=0;i<n;i++){
if(mp[a[i]]){
cout << a[i]<<" ";
mp[a[i]]--;
}
}
} | ALGO | 0.99998 | 3.418697 |
5ef2c684-0300-4ff9-8835-bd301e1750e3 | Surajv311/myCforces | old/codechef/other rated contests/march starters/1_T20MCH.cpp | /*
///////////////////////////////////////////
//Question/Info
Possible Victory Problem Code: T20MCH
Chef is playing in a T20 cricket match. In a match, Team A plays for 20 overs. In a single over, the team gets to play 6 times, and in each of these 6 tries, they can score a maximum of 6 runs. After Team A's 20 overs... | ALGO | 0.999889 | 3.483527 |
122c1d43-d754-42af-94c1-b138091477fc | tscott8/cs235 | assign01/driver.cpp | /***********************************************************************
* Program:
* Assignment 01, Set of Integers
* Brother Ercanbrack, CS235
* Author:
* Tyler Scott
* Summary:
*
*
*
*
* Estimated: 5.0 hrs
* Actual: 10 hrs
*
***************************************************... | TOOL | 0.965334 | 3.905944 |
83220905-3f59-4d57-b68b-934d866532a4 | stratisproject/UnrealEnginePlugin | Source/ThirdParty/Wallet/Private/Mnemonic.cpp | #include "Mnemonic.h"
#include "trezor/bip39.h"
#include "trezor/bip39_english.h"
#include <algorithm>
#include <cassert>
#include <cstring>
#include <string>
#include <vector>
namespace TW {
const int Mnemonic::SuggestMaxCount = 10;
std::string Mnemonic::generateMnemonic()
{
char buffer[BIP39_MAX_WORDS * (BIP... | TOOL | 0.951499 | 7.313727 |
82aa9bab-7dc0-4058-bae5-ee703ac90186 | BlueBug12/PDA_2021 | Lab2/src/FM.cpp | #include "FM.hpp"
FM::FM(const std::string & file_name, float ratio){
case1 = 0;
case2 = 0;
case3 = 0;
case4 = 0;
_left_num = 0;
_right_num = 0;
stop = false;
readInput(file_name);
min_cut = getCutSize();
best_balance = std::min((float)_left_num/cell_num,(float)_right_num/cell_n... | ALGO | 0.999369 | 4.248807 |
fb7f07a2-e3cb-4138-8235-8a29398a4232 | passwort1967/DeviceLocator | device-locator-main/src/lib/locator.cpp | #include "locator.h"
// Libs
#include "ArduinoLog.h"
#include "WiFi.h"
// Static Variables
State Locator::state;
Network Locator::networks[MAX_WIFI];
Network *Locator::foundNetworks[MAX_WIFI];
Vector Locator::devicePosition;
bool Locator::newDevicePosition;
float Locator::distanceThreshold;
int Locator::networkCount;... | ALGO | 0.989429 | 5.336957 |
b97f10e4-f82a-4ebd-b9b1-184bf5cceb10 | lusul/micmac | BenchElise/bench/b_0_48_2.cpp | #include "StdAfx.h"
static bool ImCox = false;
static Pt2di SzI(156,166);
static Im2D_U_INT1 Im1()
{
if (ImCox)
return Im2D_U_INT1::FromFile("/home/pierrot/Data/Cox/pm-14.pgm");
Im2D_U_INT1 I(SzI.x,SzI.y);
static const INT NbV = 4;
INT SzV[NbV] = {1,2,4,8};
REAL PdsV[NbV] = {1,1,1... | ALGO | 0.997229 | 3.777131 |
955dff02-e1fa-4f5c-8b75-827769041774 | kaidul/LeetCode_problems_solution | source-code/Verify_Preorder_Serialization_of_a_Binary_Tree.cpp | class Solution {
public:
bool isValidSerializationRecur(int& currPos, int& nextTokenPos, string const& preorder) {
if(nextTokenPos >= preorder.length()) {
return false;
}
currPos = nextTokenPos;
int commaPos = preorder.find(',', currPos);
if(comm... | ALGO | 0.999465 | 6.15856 |
896b48c1-b49d-4219-953d-89444c1738b3 | elhamAm/physicalBasedSimulationsProject | libigl/include/igl/point_in_circle.cpp | IGL_INLINE bool igl::point_in_circle(
const double qx,
const double qy,
const double cx,
const double cy,
const double r)
{
return (qx-cx)*(qx-cx) + (qy-cy)*(qy-cy) - r*r < 0;
}
| ALGO | 0.988649 | 4.560913 |
a4899610-6ef1-4a06-a96e-1d39191b0a34 | sdawson167/bpg2 | src/C14PhaseProvider.cpp | #include "C14PhaseProvider.h"
#define _USE_MATH_DEFINES
#include <math.h>
FieldProvider C14PhaseProvider::generateInitialCondition(int gridSize) {
// initialize field provider variables:
const int N = gridSize;
int* gridSizes = (int*) malloc(3 * sizeof(int));
gridSizes[0] = 2 * N; gridSizes[1] = 2 * N; gri... | ALGO | 0.916562 | 4.807986 |
87ad4200-93d2-40ec-9216-676134e72b1b | Khairul-Anam-Mubin/CSES-Solutions | sorting and searching/ferris wheel.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n; cin >> n;
long long x; cin >> x;
long long p[n + 1];
for (int i = 0; i < n; i++) cin >> p[i];
sort(p , p + n);
int ans = 0;
int l = 0 , r = n - 1;
for (int i = l; i < r; r--) {
if (x - p[i] >= p[r]) {
... | ALGO | 0.999914 | 3.79226 |
b3ff1342-d7d6-4fe9-b7a2-d0b2c459b5a7 | paVlaDog/Labs | Alg/lab1sem/1dDonation.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
using namespace std;
int main() {
long long n, Ai = 0, Bi = 0, maxi = 0, inMax = 0, whereAns;
long long sumBefA = 0, countBetAB = 0, sumAftB = 0;
cin >> n;
vector <int> A(n);
vector <int> B(n);
for (int i = 0; i < n; i++) {
cin >>... | ALGO | 0.999976 | 3.926653 |
fc4373df-a259-4124-8146-8ef8723545c0 | vanilla-wow/ScriptDevZero | scripts/kalimdor/teldrassil.cpp | /* ScriptData
SDName: Teldrassil
SD%Complete: 100
SDComment: Quest support: 938
SDCategory: Teldrassil
EndScriptData */
/* ContentData
npc_mist
EndContentData */
#include "precompiled.h"
#include "follower_ai.h"
/*####
# npc_mist
####*/
enum
{
SAY_AT_HOME = -1000323,
EMOTE_AT_HOME = -1000324,
... | TOOL | 0.889181 | 6.014636 |
f3932107-8581-458f-9ae6-1ae6abb33c09 | ayushpratap27/DSA-NonStop | Array/Array Prac/flipAndInvertImage.cpp | #include<bits/stdc++.h>
using namespace std;
vector<vector<int>> flipAndInvertImage(vector<vector<int>>& image) {
int n=image.size();
//for(int i=0;i<n;i++) {
// vector<int>& row = image[i];
// reverse(row.begin(), row.end());
//}
for(int i=0;i<image[0].size();i++){
reverse(image[... | ALGO | 0.999814 | 6.114684 |
2666b69a-036f-4fe0-8224-d28429b1b68c | Suhail7985/DSA | CPP/11_LinkedList/k_reversal.cpp |
//k reversal of linked list
#include<iostream>
using namespace std;
class Node{
public:
int data;
Node* next;
Node(int val){
data = val;
next = NULL;
}
};
void kReversal(Node* &head ){
Node* prevptr = NULL;
Node* currptr = head;
Node* nextptr;
int k = 3;
i... | ALGO | 0.999893 | 3.953754 |
ef375994-2995-4912-ba84-a89fdfdb2193 | PaukIsUha/optimizing_formating_code | predictions/submissions-aizu-cot-gpt4/Codenet/p02349/763358054/response_7.cpp | #include <bits/stdc++.h>
using namespace std;
typedef int64_t ll;
const int maxn = 100005;
ll S[maxn];
int n, q;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin >> n >> q;
for (int i = 0; i < q; i++) {
bool op;
cin >> op;
if (op) {
int k;
cin >> k;
ll ans = 0;
... | ALGO | 0.998379 | 3.872859 |
925e799d-35d0-4c7c-ab28-3a95b8182bf1 | Tastypotato245/boj | 2/21591/main.cpp | // https://www.acmicpc.net/problem/21591
// github/Tastypotato245/boj
#include <iostream>
#include <algorithm>
using namespace std;
int w1, h1, w2, h2;
void Solve()
{
cin >> w1 >> h1 >> w2 >> h2;
if (w1 - w2 >= 2 && h1 - h2 >= 2)
cout << 1;
else
cout << 0;
}
int main(void)
{
ios::sync_with_stdio(... | ALGO | 0.999489 | 3.462064 |
cf7acfea-359e-410a-9fe5-20db2108d0df | TURING132/Game | leetcode/n0451-Sort_Characters_By_Frequency.cpp | #include <unordered_map>
#include <vector>
#include <string>
#include <queue>
using namespace std;
class Solution {
public:
static bool cmp(const pair<char, int> & a, const pair<char, int> & b){
return a.second < b.second;
}
string frequencySort(string s) {
priority_queue<pair<char, int>, ... | ALGO | 0.999994 | 6.142248 |
b8283959-0ca3-4126-9de2-48ad1e1de18e | muhammad-alamin1/converter-of-number | src/converter.cpp | #include <iostream>
#include <cmath>
#include "../include/converter.h"
using namespace std;
// defenation of binary to decimal
long int Converter::binary_to_decimal_converter(long long int binary_number)
{
long int decimal_num = 0;
unsigned int power = 0, digit;
while(this->binary_number != 0){
d... | ALGO | 0.922004 | 3.033062 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.