uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
b7b7c305-58cc-4106-bace-654dc8d58328 | svn2github/minimosd-extra | trunk/librariesOK/AP_Math/vector3.cpp | /// -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*-
#include "AP_Math.h"
#define HALF_SQRT_2 0.70710678118654757
// rotate a vector by a standard rotation, attempting
// to use the minimum number of floating point operations
template <typename T>
void Vector3<T>::rotate(enum Rotation rotati... | ALGO | 0.977799 | 7.28955 |
14275bbc-bb03-4f59-906b-464202f7926f | DavidBShan/Competitive-Programming2022-2024 | OlympiadLevelThree/Apr 29/GFSSOC15WS1.cpp | #include <bits/stdc++.h>
using namespace std;
vector<long long> biVec;
void decToBi(long long n){
long long i = 0, num = n;
while(n != 0){
biVec.push_back(n%2);
n = n / 2;
}
}
int main(){
long long N; cin >> N;
decToBi(N);
for(long long i = 0; i < biVec.size();i++){
cout << "1";
}
} | ALGO | 0.999963 | 4.416682 |
16563981-3d2a-4c61-a75e-939ee2dbe6ff | autowarefoundation/autoware_universe | simulator/autoware_dummy_perception_publisher/test/src/test_signed_distance_function.cpp | #include "autoware/dummy_perception_publisher/signed_distance_function.hpp"
#include <gtest/gtest.h>
#include <tf2/LinearMath/Quaternion.h>
#include <tf2/LinearMath/Transform.h>
#include <tf2/LinearMath/Vector3.h>
#include <cmath>
#include <limits>
#include <memory>
namespace autoware::dummy_perception_publisher
{
... | TEST | 0.851463 | 7.572553 |
183036ed-10af-4cec-817d-f65698b9e653 | Lqs66/boost_1_74_0 | libs/numeric/odeint/examples/integrate_times.cpp | #include <iostream>
#include <boost/numeric/odeint.hpp>
using namespace std;
using namespace boost::numeric::odeint;
/*
* simple 1D ODE
*/
void rhs( const double x , double &dxdt , const double t )
{
dxdt = 3.0/(2.0*t*t) + x/(2.0*t);
}
void write_cout( const double &x , const double t )
{
cout << t << '\t... | ALGO | 0.999779 | 7.280291 |
cece82df-004c-47f8-857b-1b418cbf9d57 | tamaraltahan/330Lab1 | 330Lab1/330Lab1.cpp |
#include <iostream>
#include <vector>
#include <cassert>
using namespace std;
void populateList(vector<int> vect, int n); //fill values with n random values
int calculateMedian(vector<int> vect); //calculate Median value
int recursivePrint(vector<int> vect, int n); //print out values of list recursively
int main()... | ALGO | 0.999508 | 5.287211 |
db6004a1-b99f-495f-8167-b813cf5f1875 | mixedethan/AVL-Tree-Student-Records | src/AVLTree.cpp | #include "AVLTree.h"
//AVL Tree constructor
AVLTree::AVLTree(){
this->root = nullptr;
this->nodeCount = 0;
}
//AVL Tree destructor
AVLTree::~AVLTree() { //AVL Tree destructor
delete root;
}
//Node Getter
Node* AVLTree::getRoot() {
return root;
}
//Root Setter
void AVLTree::setRoot(Node* newRoot) {
... | ALGO | 0.967285 | 5.238965 |
ac13adad-e280-47b7-8d31-a73a082366dd | leomaster2018/LOUD-Mining-Webchain-AMD | src/Cpu.cpp | #include <libcpuid.h>
#include <math.h>
#include <string.h>
#include "Cpu.h"
bool Cpu::m_l2_exclusive = false;
char Cpu::m_brand[64] = { 0 };
int Cpu::m_flags = 0;
int Cpu::m_l2_cache = 0;
int Cpu::m_l3_cache = 0;
int Cpu::m_sockets = 1;
int Cpu::m_totalCores = 0;
si... | TOOL | 0.94438 | 6.083666 |
b736343e-5e77-49fe-aecf-676255a6863b | goldpirat/Programming_in_CPP | A12/a12p4/testfraction.cpp | /*
CH-230-A
a12 p4.cpp
Flori Kusari
<EMAIL>
*/
#include <iostream>
#include "fraction.h"
using namespace std;
int main()
{
// create and print fractions with given parameters
Fraction a(4, 2);
Fraction b(17, 11);
Fraction c(5);
cout << "Three fractions with set parameters:" << endl;
cout << a << en... | TOOL | 0.885849 | 4.840674 |
b538ac5d-7721-48fe-8045-1e4cbc81977e | p-podsiadly/llvm-stm8 | libcxx/test/std/containers/associative/multiset/equal_range.pass.cpp | // <set>
// class multiset
// pair<iterator,iterator> equal_range(const key_type& k);
// pair<const_iterator,const_iterator> equal_range(const key_type& k) const;
#include <set>
#include <cassert>
#include "test_macros.h"
#include "min_allocator.h"
#include "private_constructor.h"
int main(int, char**)... | TEST | 0.874793 | 5.294887 |
01ec6902-213a-4df6-9bdd-10877d8e012d | OLDMONEY0/ALGORITHMS-AND-DATA-STRUCTURES | LAB8/d.cpp | #include<bits/stdc++.h>
using namespace std;
unordered_map <size_t, size_t> mp;
size_t cnt = 0;
void count(string t, string s){
size_t n = t.size();
size_t m = s.size();
long long h[n];
long long p[n];
long long q = 1e9;
p[0] = 1;
for(size_t i = 1; i < max(n, m); ++i){
p[i] = (p[i ... | ALGO | 0.999978 | 4.045088 |
2724ac30-adf8-4808-b655-be5df50ce0a8 | sarvex/leetcode-kotlin | solution/1600-1699/1610.Maximum Number of Visible Points/Solution.cpp | class Solution {
public:
int visiblePoints(vector<vector<int>>& points, int angle, vector<int>& location) {
vector<double> v;
int x = location[0], y = location[1];
int same = 0;
for (auto& p : points) {
int xi = p[0], yi = p[1];
if (xi == x && yi == y)
... | ALGO | 0.999968 | 5.448708 |
74a27bbb-c282-450c-bf61-0b9c83515117 | alpathyb/flutter_Muhammad-Fajar-Al-Fath | 11_Introduction flutter Widget/praktikum/flutter1/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.998171 | 6.797273 |
71d57ea7-98fb-4723-9562-6b7f96cf08cd | KhushiSonkusare/LeetCode | Maximum_Score_After_Splitting_a_String.cpp | class Solution {
public:
int maxScore(string s) {
int zeros = 0, ones = 0;
int maxScore = 0;
for (char c : s) {
if (c == '1') ones++;
}
for (int i = 0; i < s.length() - 1; i++) {
if (s[i] == '0') {
zeros++;
} else {
... | ALGO | 0.99996 | 5.937067 |
4f2c3cd6-20fa-4262-954a-a6768d1ba86d | lDeathlWhisperl/LETI | Programming/Course_1/Practical-work-2/Practical work 2/Practical work 2.cpp | #include <iostream>
#include <windows.h>
#include "Functions.h"
using namespace std;
int main()
{
setlocale(LC_ALL, "");
ShowWindow(GetForegroundWindow(), SW_SHOWMAXIMIZED); //fullscreen
char ask = '#';
const int SIZE = 100;
int sorted[SIZE],
unsorted[SIZE],
userNum;
task1(s... | ALGO | 0.968841 | 3.85098 |
db5ea32f-ad1d-4765-8a4d-08b1b8b2fa86 | baunilla/android_device_xiaomi_stone | gps/utils/loc_misc_utils.cpp | #define LOG_NDEBUG 0
#define LOG_TAG "LocSvc_misc_utils"
#include <stdio.h>
#include <string.h>
#include <inttypes.h>
#include <dlfcn.h>
#include <math.h>
#include <log_util.h>
#include <loc_misc_utils.h>
#include <ctype.h>
#include <fcntl.h>
#include <inttypes.h>
#ifndef MSEC_IN_ONE_SEC
#define MSEC_IN_ONE_SEC 1000UL... | TOOL | 0.961056 | 5.910943 |
054103b3-29bc-49c5-bfab-284a5f8af65e | RisshabSingla/GFG-Solutions | Medium/Longest consecutive subsequence/longest-consecutive-subsequence.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution{
public:
// arr[] : the input array
// N : size of the array arr[]
//Function to return length of longest subsequence of consecutive integers.
int findLongestConseqSubseq(int arr[], int n)
... | ALGO | 0.999523 | 5.590312 |
d09005bd-b7e9-4f9b-acbe-aaf94bf3ff5c | shreejitverma/SDE-Interview-Prep | competitive-programming/Binary Trees/Construct Binary Tree from Inorder & Preorder Traversal.cpp | /*
https://practice.geeksforgeeks.org/problems/construct-tree-1/1
Construct Tree from Inorder & Preorder
Medium Accuracy: 36.26% Submissions: 56727 Points: 4
Given 2 Arrays of Inorder and preorder traversal. Construct a tree and print the Postorder traversal.
Example 1:
Input:
N = 4
inorder[] = {1 6 8 7}
preorder[]... | ALGO | 0.99999 | 5.854719 |
6e8a6da9-a7ad-4f68-850a-a21f68a290c8 | zebulon0/HW6 | DFTTester.cpp | #include <iostream>
#include "DFT.h"
#define SQR(x) x*x
using namespace std;
int main()
{
double inImpulse[8] = {1,0,0,0,0,0,0,0};
int inImpulseLen = sizeof(inImpulse) / sizeof(double);
double inImpulseShift[8] = {0,1,0,0,0,0,0,0};
int inImpulseShiftLen = sizeof(inImpulseShift) / sizeof(double);
c... | TEST | 0.963907 | 5.291368 |
54dab2a6-2e4f-4441-b351-6c119c9f034b | luishpmendes/mofjssp | src/instance/instance.cpp | #include "instance/instance.hpp"
#include <algorithm>
#include <limits>
namespace mofjssp {
void Instance::compute_primal_bound() {
double max_processing_time = 0.0;
std::vector<double> working_time(this->num_machines, 0.0);
this->primal_bound.resize(this->num_objectives, 0.0);
this->primal_bound.ass... | ALGO | 0.996999 | 6.629636 |
504a7251-205a-4f67-bce2-6fee40ada331 | Owmicron/CPStuff | Codeforces/YellowCards.cpp | #include<bits/stdc++.h>
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#pragma comment(linker, "/stack:200000000")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
typedef long long ll;
typedef string str;
typedef... | ALGO | 0.999485 | 3.352786 |
c3f3f1c8-bd7d-4614-8d48-103cf86bbf4c | yash-gargji/codeforces-solution | V_Reverse_a_Substring.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
string s;
cin>>s;
string b = s;
reverse(s.begin(),s.end());
stack<int>st;
int f,r;
int flag = 0;
for(int i = 0;i<s.size();i++){
while( !st.empty() && s[i] > s[st.top()]){
... | ALGO | 0.999917 | 3.137334 |
830d8cc7-8a0f-4682-b0b7-74119afec52a | paliwalsafal/Competitive_Programming | SPOJ/Cards.cpp | #pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define rep(... | ALGO | 0.999779 | 4.833527 |
e0058d5b-2ac5-4e30-ab1e-2b53b2899a0c | Samratrpal01/Practicing-Coding | 206-reverse-linked-list/206-reverse-linked-list.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
ListNode* reverseList... | ALGO | 0.999544 | 5.678188 |
f4a4c6ac-d19f-4eba-b0c2-ae84ce09ee34 | ishandutta2007/codeforces | mahdi_jfri/normal/26/B.cpp | #include <iostream>
#include <stack>
using namespace std;
int main()
{
stack <char> a;
string s;
cin >> s;
int n=s.size();
for (int i = 0; i < n; i++)
{
if(!a.empty() && a.top()=='(' && s[i] == ')')a.pop();
else a.push(s[i]);
}
cout << n-a.size();
} | ALGO | 0.999286 | 3.841783 |
3f14562c-1377-4042-afd9-99fdf5190307 | dinhnguyen28/spro4 | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998859 | 6.785645 |
394f15d2-5fce-4287-9f0b-889a02f83954 | zhengbinbin-coder/CPP | leetcode--连续子数组的最大和--leetcode--最大子序和.cpp | https://leetcode-cn.com/problems/lian-xu-zi-shu-zu-de-zui-da-he-lcof/
https://leetcode-cn.com/problems/maximum-subarray/
class Solution {
public:
int maxSubArray(vector<int>& nums) {
if(nums.size()==0) return -1;
int sum=nums[0]; // 定义以第i个元素结尾的连续字串最大和sum--初始把sum设为以第0个元素结尾的连续字串最大和
in... | ALGO | 0.999836 | 5.257648 |
adb451d3-2170-4d5b-bac5-05ea8a733b86 | sarvex/leetcode-lua | solution/0600-0699/0691.Stickers to Spell Word/Solution.cpp | class Solution {
public:
int minStickers(vector<string>& stickers, string target) {
queue<int> q{{0}};
int ans = 0;
int n = target.size();
vector<bool> vis(1 << n);
vis[0] = true;
while (!q.empty()) {
for (int t = q.size(); t; --t) {
int st... | ALGO | 0.999957 | 6.036833 |
5eb05ba5-6ac5-4342-828c-fb0dcb5f35ae | sqmedeiros/sblp2023-time-vs-energy | 1084-Apartments/c++/slow/2945849.cpp | /**
* Author : DoTran
* Last edit : 13 08 2021
**/
#include <bits/stdc++.h>
using namespace std;
/**
* #ifndef _CP_TEMPLATE_
* #define _CP_TEMPLATE_
**/
#define init() freopen("inp.txt", "r", stdin); freopen("out.txt", "w", stdout)
#define db_problem() cout.precision(10)
#define fastio() ios_base::sync_wit... | ALGO | 0.999972 | 3.69257 |
68facb64-5451-4515-bb73-6a30752203fc | nckuasrlab/QOPS | qcor-pgo/examples/qcor_demos/pnnl_tutorials/2_observables/basic_vqe.cpp | __qpu__ void ansatz(qreg q, double theta) {
X(q[0]);
Ry(q[1], theta);
CX(q[1], q[0]);
}
int main() {
// Create the Hamiltonian
auto H = -2.1433 * X(0) * X(1) - 2.1433 * Y(0) * Y(1) + .21829 * Z(0) -
6.125 * Z(1) + 5.907;
auto optimizer = createOptimizer("nlopt");
ObjectiveFunction opt_functio... | ALGO | 0.999966 | 3.264609 |
ae4817ff-f336-47b3-b42b-8dd143c60604 | alwinyang91/openCV | opencv-4.7.0/modules/ml/src/knearest.cpp | #include "precomp.hpp"
#include "kdtree.hpp"
/****************************************************************************************\
* K-Nearest Neighbors Classifier *
\****************************************************************************************/
... | ALGO | 0.998963 | 6.805709 |
ccdf6c2a-0060-45ba-86be-cc1c6be0137b | wuhanstudio/TinyRayTracer | TinyRayTracer/TinyRayTracer.cpp | #define _USE_MATH_DEFINES
#include <limits>
#include <cmath>
#include <iostream>
#include <fstream>
#include <vector>
#include "geometry.h"
#define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h"
#define STBI_MSC_SECURE_CRT
#define STB_IMAGE_WRITE_IMPLEMENTATION
#include "stb_image_write.h"
#define CHANNEL_NUM 3
in... | ALGO | 0.97245 | 3.926271 |
119cbfe4-0fd7-46b5-861c-4010931bee2d | ishandutta2007/codeforces | roundgod/normal/982/C.cpp | #include<bits/stdc++.h>
#define MAXN 100005
#define INF 1000000000
#define MOD 1000000007
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int n,k,sz[MAXN];
vector<int> G[MAXN];
void dfs(int v,int p)
{
int res=1;
for(int i=0;i<G[v].size();i++)
{
if... | ALGO | 0.99994 | 4.310538 |
653cd492-0364-4e9f-8af1-a39553e93328 | OlegRS/SGEN | src/engines/stochastic/events/Prot_hop_forward.cpp | #include "../../../../include/junctions/Junction.hpp"
void Junction::Prot_hop_forward::operator()() {
auto& location = *((Junction*)p_location);
location.p_to->protein_creation();
location.p_from->protein_decay();
}
| ALGO | 0.992525 | 4.968771 |
605dd4b0-fb07-4da7-8db2-e4692fcceda2 | MoisesVillasmil/TAREA-PROGRAMACION-II-8-03-2023 | PAR IMPAR 8-3-2023.cpp | #include<stdio.h>
#include<stdlib.h>
int impar(int m);
int par(int m) {
if (m == 0) {
return 1;
}
else{
return impar(m - 1);
}
}
int impar(int m) {
if (m == 0){
return 0;
}
else{
return par(m - 1);
}
}
int main(){
int m;
printf("Ingrese el numero: ");
scanf("%d", &m);
printf("el numero es: %d \n"... | ALGO | 0.999867 | 3.24913 |
400c755c-f152-4690-86b0-8b80b8350014 | Kareen12/Gfg-Practice-Questions | GFG Problems/Vertical Traversal of Binary Tree.cpp | class Solution
{
public:
//Function to find the vertical order traversal of Binary Tree.
vector<int> verticalOrder(Node *root)
{
//Your code here
vector<int> ans;
if(!root) return ans;
// Map contains mpping from row->col->sare nodes. Sre nodes ko store karne ke liye mult... | ALGO | 0.999994 | 5.849827 |
6562d167-db95-40e1-9a66-010267dc468d | LisnychaNastia/Intrestring_features1 | Prefabs-e/Library/PackageCache/com.unity.ide.visualstudio@2.0.11/Editor/COMIntegration/COMIntegration~/COMIntegration.cpp | #include <iostream>
#include <sstream>
#include <string>
#include <filesystem>
#include <windows.h>
#include <shlwapi.h>
#include "BStrHolder.h"
#include "ComPtr.h"
#include "dte80a.tlh"
constexpr int RETRY_INTERVAL_MS = 150;
constexpr int TIMEOUT_MS = 10000;
// Often a DTE call made to Visual Studio can fail after ... | TOOL | 0.952547 | 6.947423 |
10367a7b-648e-471c-8b22-9162d78371fc | urvesh254/30DaysOfCode-PhoenixClub | day-14-of-30/Sum Of Two Numbers/C++/yash1402_.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> arr(n);
for (auto &ele: arr) cin >> ele;
int k;
cin >> k;
for (int i = 0; i < n; i++) {
for (int j = i + 1; j < n; j++) {
if (arr[i] + arr[j] == k) {
cout << "true" << endl;
return 0;
... | ALGO | 0.999923 | 4.589054 |
c33e27e0-4451-4795-bccb-635d1f4e22fd | Fabho/codeforces_solution | 96A - Football/main.cpp | #include <iostream>
#include <cstdio>
using namespace std;
int main()
{
string input;
while (cin >> input)
{
if (input.length() > 7 && input.find("1111111") != string::npos || input.find("0000000") != string::npos)
printf("YES\n");
else
printf("NO\n");
}
r... | ALGO | 0.995567 | 3.376375 |
8696a967-01c0-41d6-b613-d3d2715b7f7f | Daek-You/Algorithm | C++/Programmers/Lv.2/최솟값 만들기.cpp | #include <vector>
#include <algorithm>
using namespace std;
int solution(vector<int> A, vector<int> B)
{
int answer = 0;
sort(A.begin(), A.end());
sort(B.begin(), B.end(), greater<int>());
for(int i = 0; i < A.size(); i++)
answer += (A[i] * B[i]);
return answer;
} | ALGO | 0.999923 | 4.853178 |
083b3228-d695-4164-9c3c-c4795b7e4525 | anshyyy/CPP | Codeforces/11A.cpp | #include <bits/stdc++.h>
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define loop(i,a,n) for(int i=a;i<n;i++)
typedef long long ll;
const ll INF = 1e9+7;
const ll MOD = 998244353;
using namespace std;
void solve(){
ll n,d,count=0;
cin>>n>>d;
ll arr[n];
loop(i,0,n)ci... | ALGO | 0.999905 | 4.04726 |
b2b784de-1be4-4f7f-8ab0-32d8fd897f6f | purboindra/movie_app_bloc | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.9988 | 6.76073 |
f717a6e0-6196-40de-ad36-4b2247a5610a | FishingDonut/roguelike_cmd | src/map_construction/is_colliding.cpp | #include "entity/room.h"
#include "map_construction/is_colliding.h"
bool isColliding(Room rooms[], int roomCount, Room newRoom, int padding = 1)
{
for (int i = 0; i < roomCount; i++)
{
Room other = rooms[i];
bool overlapX = newRoom.x - padding < other.x + other.width + padding &&
... | TOOL | 0.913956 | 5.364257 |
00e28f86-b347-4ce2-9e28-6fc849177795 | AnimismFudan/Templates | GuoYu/NetworkFlow/costflow(spfa).cpp | //7.8 G
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <iostream>
#include <algorithm>
#define LL long long
using namespace std;
int ans, flow, Test, pt, l, r, S, T, N, x;
int st[110], ne[1010], go[1010], c[1010], w[1010], p[1010];
int dist[110], vis[110], q[100010];
void Add (int x, int y, int cc, in... | ALGO | 0.999064 | 3.41811 |
b041413a-c1a7-49e3-a595-1a944022d654 | duanabao/program-design | 2020年度分享/第三次课程分享/马辰-排序与双指针/MergeSort.cpp | #include <iostream>
using namespace std;
const int maxn = 5000;
int a[maxn];
void Merge(int A[], int l1, int r1, int l2, int r2) {
int i = l1, j = l2;//˫ָ룬ָиСֵ
int temp[maxn], index = 0;//tempΪʱ飬indexΪ±
//ȡС
while (i <= r1 && j <= r2) {
temp[index++] = (A[i] <= A[j]) ? A[i++] : A[j++];
}
//Ѿһй鲢ֻ꣬һʣԪη
while (i ... | ALGO | 0.999976 | 3.674101 |
7c62c5ab-1c70-472e-9843-4d9efa3c89eb | xinfeng1i/AlgorithmSolution | leetcode/324 Wiggle Sort II.cpp | #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
// һ
// ӴС飬Ȼзֳ֣ǰ벿Ϊlarger
// ΪsmallerȻlargerλãsmallerԪطżλ
// ʱ临Ӷ O(nlogn), ռ临Ӷ O(n)
void wiggleSort(vector<int>& nums) {
sort(nums.begin(), nums.end(), greater<int>());
int n = (int) nums.size();
vector<int> la... | ALGO | 0.999968 | 4.802656 |
363e9808-f974-4108-8560-e66753548686 | choijaewon323/PS | 백준/슬라이딩 윈도우/20437.cpp | #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
vector<vector<int>> alphabet;
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int t;
cin >> t;
for (int test = 0; test < t; test++)
{
string w;
int k;
cin >> w;
cin >> k;
alpha... | ALGO | 0.999882 | 4.130097 |
adb0a6b9-ca88-40d8-b243-fe68a88ebb78 | FaadCoder/Leetcode-Solutions | container-with-most-water/container-with-most-water.cpp | class Solution {
public:
int maxArea(vector<int>& height) {
int start = 0,end = height.size()-1;
int maxAreas = 0;
while(start<=end)
{
maxAreas = max(maxAreas,(end-start)*min(height[start],height[end]));
if(height[start]<=height[end])
... | ALGO | 0.999956 | 6.644079 |
9d16bede-1102-4789-88f7-afa42f5d8f06 | ahmeds3aid/poitnt-counter-progect-using-ststemanagement_getx | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.9988 | 6.76073 |
ab01f117-8a1d-401f-bbae-d4d0559ebcd8 | Scyther2/leetcode | #611.cpp | class Solution {
public:
int triangleNumber(vector<int>& nums) {
int n=nums.size();
int ans=0;
sort(nums.begin(),nums.end());
for(int i=n-1;i>=0;i--)
{
int l=0;
int r=i-1;
while(l<r)
{
... | ALGO | 0.999909 | 6.097254 |
e211938c-4872-4956-97cf-8b62f2eae638 | Terpodia/Competitive-Programming | Problems Solved/Codeforces/Interactive/Interactive LowerBound.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set =
tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
void _scan(int &x) { scanf("%d", &x); }
vo... | ALGO | 0.999923 | 3.65796 |
b8a87d08-9547-495b-9951-00ff0b79f0d8 | AbuzarHassan14/C-and-DSA-Programs | swap alternate/swap alternate.cpp | //sawp alternate in which we just swap two element of an array with each other
//e.g if array is {1,2,3,4,5,6} then OUTPUT will be {2,1,4,3,6,5}
#include<iostream>
using namespace std;
void settingArray(int arr[], int size) {
cout << " Enter Element in array " << endl;
for (int i = 0; i < size; i++) {
cin >> arr... | ALGO | 0.999224 | 4.495555 |
fd398952-decb-4799-89aa-fbbf5a9f5912 | IoannisKapotis/AMS595 | CplusplusProj1/CHWQ1.cpp | #include <iostream>
using namespace std;
int main() {
int n;
cout << "Enter a Number:";
cin >> n;
switch (n) {
case -1:
cout << "Negative One";
break;
case 0:
cout << "Zero";
break;
case 1:
cout << "Positve One";
break;... | TOOL | 0.950805 | 3.281104 |
5238dfd9-9646-460a-8df2-081914c74ad2 | Kaelygon/cubeprime | singlePrimeCube.cpp | //oeis A157026
//
//g++ -std=c++11 ./singlePrimeCube.cpp -o singlePrimeCube
//
//Finds P for P^3=A^3+B^3+C^3 where P is prime and A,B,C are unique positive integers
//singlePrimeCube [thread] [thread count] [start] [P]
//
using namespace std;
#include "functions.h"
#define logSearch 1
int main( int argc, char *argv... | ALGO | 0.998894 | 3.502398 |
4f71da9c-1833-444a-a662-4ebfa34ea372 | BaharSlmn/storm-bn | bn-mc-transformer/src/storm/environment/solver/MinMaxSolverEnvironment.cpp | #include "storm/environment/solver/MinMaxSolverEnvironment.h"
#include "storm/settings/SettingsManager.h"
#include "storm/settings/modules/MinMaxEquationSolverSettings.h"
#include "storm/utility/constants.h"
#include "storm/utility/macros.h"
namespace storm {
MinMaxSolverEnvironment::MinMaxSolverEnvironment() {
... | ALGO | 0.964178 | 7.116176 |
9ef93e81-53f6-4ae2-a10b-8c23a634a765 | muhesh-kumar/programming | cpp/tricks/Usage of move() function.cpp |
// Author: Muhesh Kumar
#include<bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
vector<int> v = {1,2 , 3, 4};
vector<int> w = move(v);
cout << "v: ";
for (auto i: v) cout << i << " ";
cout << "\n";
cout << "w: ";
for (auto i: w) cout << i << " ";
return... | ALGO | 0.996467 | 3.186424 |
d1d143da-20ab-4665-9518-ecdcde3e3720 | superkunn/qy | My-ACM-Template/03_Data Structure/03_Line_Tree_Union.cpp | int ls[MAX<<6],rs[MAX<<6],val[MAX<<6],d[MAX],rt[MAX],cnt;
void update(int &x,int l,int r,int p,int v)
{
x=++cnt;if(l==r){val[x]=v;return;}
int mid=(l+r)>>1;
if(p<=mid) update(ls[x],l,mid,p,v);
else update(rs[x],mid+1,r,p,v);
val[x]=min(val[ls[x]],val[rs[x]]);
}
int merge_(int u,int v)
{
if(!u) r... | ALGO | 0.999869 | 3.794048 |
8fd6ed75-0eb0-4906-a02f-252a551cd08d | TheFenrisLycaon/DSA-C-- | cp/CodeForces/0900-0999/996B.cpp | #include <cstdio>
#include <vector>
int main(){
long n; scanf("%ld", &n);
std::vector<long> a(n); for(long p = 0; p < n; p++){scanf("%ld", &a[p]);}
long mint(1e9 + 7), entry(-1);
for(long p = 0; p < n; p++){
long cand = p + n * ((a[p] - p + (n - 1)) / n);
//printf("%ld -> %ld\n", p, ca... | ALGO | 0.999978 | 3.815141 |
93cd562b-f440-43dd-9f7e-0324e3340d94 | wolfgangfengel/GPU-Zen-3 | 4-Tools-of-the-Trade/21-Animating-water-using-profile-buffer/lib/eigen-3.3.7/doc/examples/DenseBase_middleCols_int.cpp | #include <Eigen/Core>
#include <iostream>
using namespace Eigen;
using namespace std;
int main(void)
{
int const N = 5;
MatrixXi A(N,N);
A.setRandom();
cout << "A =\n" << A << '\n' << endl;
cout << "A(1..3,:) =\n" << A.middleCols(1,3) << endl;
return 0;
}
| ALGO | 0.931679 | 3.133398 |
93039d85-b6e8-415b-b791-e26faea5ad00 | bigbillfighter/OJ_Solved | job/企业机试/携程2024秋招/2.cpp | #include<bits/stdc++.h>
using namespace std;
const int max_n = 1005;
int crt_map[max_n][max_n] = {-1};
typedef long long ll;
// y o u
// o y u
// u y o
ll cal_tri(int crt, int m, int n, int x, int y){
int fir[4] = {0, 0, 0, 0}; // left, up, right, down
int sec[4] = {0, 0, 0, 0}; // left, up, right, down
... | ALGO | 0.999322 | 4.070377 |
631e59d7-6565-4625-b0b1-059c97697308 | jiangshen95/UbuntuLeetCode | RangeSumQuery2D-Immutable.cpp | #include<iostream>
#include<vector>
using namespace std;
class NumMatrix {
private:
vector<vector<int> > sums;
public:
NumMatrix(vector<vector<int> > matrix) {
int m = matrix.size();
if(m == 0) return;
int n = matrix[0].size();
sums = vector<vector<int> >(m, vector<int>(n));
for(int i... | ALGO | 0.999528 | 5.021453 |
a1bbf86d-e887-47c5-8fb0-1c6dd593f291 | Vikram125609/noob-to-candidate-master | Codeforces/2 A LEVEL/Expression.cpp | #include <iostream>
using namespace std;
int main()
{
int a, b, c;
cin >> a >> b >> c;
int max1 = a + b + c;
int max2 = a + b * c;
int max3 = a * b + c;
int max4 = a * b * c;
int max5 = (a + b) * c;
int max6 = a * (b + c);
int result = max(max(max1, max2), max(max3, max4));
resul... | ALGO | 0.999879 | 3.95775 |
0ddb1cee-7c7f-4222-ac57-b45fa2deee6e | Devansh0012/LearnYard-DSA-practice | Arrays/subArrays.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cout << "Enter the size of array: ";
cin >> n;
int arr[n];
cout << "Enter the elements of array: ";
for(int i=0 ; i<n ; i++){
cin >> arr[i];
}
cout << "Array is:\n";
for(int i = 0; i < n; i++){
cout << ... | ALGO | 0.985187 | 3.855203 |
e56c6e03-72d0-4bb3-896a-a87e9381af35 | Sefayet-Alam/Competitive-Programming-Classical-Problems | Codeforces EDU ITMO course solutions/Suffix Array/Step_4/A_Suffix_Array_and_LCP.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
// VVI
#define fast \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
#define ll long long
#define SZ(a)... | ALGO | 0.999932 | 4.305415 |
8b8ec88f-84d5-4ad3-8a1b-55a71f3311a3 | Harshkumar50/New_walk | Smallest Positive Missing.cpp | class Solution {
public:
// Function to find the smallest positive number missing from the array.
int missingNumber(vector<int> &arr) {
// Your code here
int n=arr.size();
sort(arr.begin(),arr.end());
int small=1;
for(int num:arr){
if(num==small){
... | ALGO | 0.999934 | 4.811113 |
29b53b35-cf7c-4e44-9f8e-f70db9cb50b8 | Pierre-Terdiman/PEEL_PhysX_Edition | PEEL_Externals/5_6_0_GitHub/source/physxvehicle/src/rigidBody/VhRigidBodyFunctions.cpp | #include "foundation/PxMat33.h"
#include "foundation/PxTransform.h"
#include "vehicle2/PxVehicleParams.h"
#include "vehicle2/rigidBody/PxVehicleRigidBodyFunctions.h"
#include "vehicle2/rigidBody/PxVehicleRigidBodyStates.h"
#include "vehicle2/rigidBody/PxVehicleRigidBodyParams.h"
#include "vehicle2/suspension/PxVehic... | ALGO | 0.971456 | 7.195518 |
26a7227b-8069-4c11-a5ca-3017a02ba979 | elderz6/cpp-cursoAlura | curso2/printLetters.cpp | #include<iostream>
#include "./interfaces/printLetters.hpp"
void printLetters(const std::string& secretWord, const std::map<char, bool> correctPositions){
for(char letter : secretWord){
if(correctPositions.find(letter) != correctPositions.end()) std::cout << letter << " ";
else std::cout << "_ ";
... | TOOL | 0.882613 | 4.504225 |
603b5003-13e2-4836-9a73-8472e7f05360 | JayTheCoder77/Striver-Dsa | Heaps/Hard/KmostFreq/optimal1.cpp | class Solution {
public:
vector<int> topKFrequent(vector<int>& nums, int k) {
unordered_map<int , int> mpp;
vector<int> ans;
priority_queue<pair<int,int>> maxHeap;
for(int i = 0 ; i < nums.size() ; i++) mpp[nums[i]]++;
for(auto const& pair_e : mpp)
maxHeap.push({p... | ALGO | 0.999997 | 6.429273 |
180a12b9-3f43-4c68-a9fc-53a2ea69e81e | Madcow1313/webserv | config/Config.cpp | #include "Config.hpp"
#include "RequestConfig.hpp"
Config::Config(): _path(DEFAULT_CONFIG_PATH){}
Config::Config(std::string const &path): _path(path) {}
Config::~Config(){}
void Config::setPath(std::string const &path){
_path = path;
}
std::vector<ServerConfig> Config::getServers(){
return _servers;
}
Config::... | CONFIG | 0.986715 | 5.23093 |
52c5445a-b1fe-43e0-b6b9-895c4741462e | jimidovich/momi | eigen3/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_broadcast_simple_rowwise.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
int main()
{
Eigen::MatrixXf mat(2,4);
Eigen::VectorXf v(4);
mat << 1, 2, 6, 9,
3, 1, 7, 2;
v << 0,1,2,3;
//add v to each row of m
mat.rowwise() += v.transpose();
std::cout << "Broadcasting result: " << std::... | ALGO | 0.998107 | 4.296038 |
b42c01c6-0d9a-41a3-b26b-7315a8fc9275 | RajeshKumarYadav12/C-Codes | selectionsort.cpp | #include<iostream>
using namespace std;
void selectionsort(int a[],int n)
{
for(int i=0;i<n-1;i++)
{
int minindex=i;
for(int j=i+1;j<n;j++)
{
if(a[j] < a[minindex])
{
minindex=j;
}
}
int t=a[i];
a[i]=a[minindex];
a... | ALGO | 0.99996 | 4.202713 |
690934cd-61a0-4dea-a3e4-178d649c3242 | Zadid13/CodeForces | 1850C.cpp | #include <bits/stdc++.h>
using namespace std;
#define optimize() \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
#define endl "\n"
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(vec) vec.begin(), v... | ALGO | 0.998963 | 4.454872 |
72d154c2-4ff9-4f9c-9e0d-2c7e18c96e48 | Dahshatking/ADA_college | ADA Lab/tower of hanoi/TowersOfHanoi.cpp | #include <iostream>
#include <vector>
#include <chrono>
using namespace std;
using namespace std::chrono;
// Recursive function to solve Tower of Hanoi
void TOH(int n, int A, int B, int C)
{
if (n >= 1)
{
TOH(n - 1, A, C, B);
// Move nth disk from A to C
TOH(n - 1, B, A, C);
}
}
//... | ALGO | 0.999685 | 7.089023 |
4853852d-2b38-4e97-93b6-242eca6be439 | AnthonyValverde/CS-10-Labs | week8/lab2.cpp | // Global const values for intersect return value
#include <iostream>
using namespace std;
const int OK = 0;
const int DIV_ZERO = 1;
// FIXME Add intersect function here
int intersect(double& xi, double& yi, double& a1, double& b1, double& a2, double& b2)
{
xi =(b2 - b1) / (a2 - a1);
yi = a1 * xi... | ALGO | 0.997435 | 4.279929 |
fbfac1e7-9caa-40ec-916c-59fcc1c62704 | Vanshita2608/C-Codes | pointer 5.cpp | //pointer
#include<iostream>
#include<stdlib.h>
using namespace std;
int main()
{
int x = 7 , y ;
cout<<"Addresses are as below:"<<endl;
cout<<"Add. of x = "<<&x<<endl;
cout<<"Add. of y = "<<&y<<endl;
//cout<<"Add. of p = "<<&p<<endl;
int *p = &y;
cout<<endl<<"Values are as below:"<<endl;
... | ALGO | 0.987847 | 3.463767 |
5c8a0f23-c082-42a2-8e31-a903d30f74b8 | Thimilius/Hyperion | hyperion/source/ecs/component/components/utilities/camera_utilities.cpp | //----------------- Precompiled Header Include -----------------
#include "hyppch.hpp"
//--------------------- Definition Include ---------------------
#include "hyperion/ecs/component/components/utilities/camera_utilities.hpp"
//---------------------- Project Includes ----------------------
#include "hyperion/core/a... | TOOL | 0.956771 | 7.646693 |
ab732c83-b717-4463-851d-bf19933bbc6b | tannerb32/crtmp | common/src/platform/android/androidplatform.cpp | #ifdef ANDROID
#include "platform/android/androidplatform.h"
#include "platform/endianess/endianness.h"
#include "utils/logging/logging.h"
string alowedCharacters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
static map<int, SignalFnc> _signalHandlers;
AndroidPlatform::AndroidPlatform() {
}
A... | TOOL | 0.938809 | 4.830912 |
d0fa856b-93c4-471e-a094-0993589be238 | jhasan2026/Road_To_Grandmaster | 2_Data_Structure_and_Algorithm/9_Recursion/1_factorial.cpp | #include "iostream"
using namespace std;
int fact(int n){
if(n==0){
return 1;
}
return n * fact(n-1);
}
int main(){
cout<<fact(6);
} | ALGO | 0.999721 | 4.606405 |
ca52ab98-3226-4e7a-9205-be553e15f234 | andrewqt/Competitive-Programming | CodeForces/_0995_A_Tesla/_0995_A_Tesla.cpp |
// Problem : A. Tesla
// Contest : Codeforces - Codeforces Round #492 (Div. 1) [Thanks, uDebug!]
// URL : https://codeforces.com/problemset/problem/995/A
// Memory Limit : 256 MB
// Time Limit : 3000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)
#include <bits/stdc++.h>
using namespace std;
int ... | ALGO | 0.999878 | 3.572668 |
f041a7d6-361b-410e-bd00-9680da75a9d9 | SOFTK2765/PS | BOJ/1949.cpp | #include <bits/stdc++.h>
using namespace std;
int a[10001], dp[10001];
vector<vector<int>> adj(10001);
int dfs(int pos, int pre, bool s)
{
int adjsize = adj[pos].size(), res = 0;
for(int i=0;i<adjsize;i++)
if(adj[pos][i]!=pre)
{
if(s) res += dfs(adj[pos][i], pos, false);
... | ALGO | 0.99968 | 3.863635 |
4561e0fe-39cc-4bd9-b402-44657231191c | acs-pa/pa-lab | demo/lab02/03-cuie/cuie.cpp | #include <algorithm> // sort
#include <iostream> // cout
#include <limits> // numeric_limits
#include <utility> // pair
#include <vector> // vector
using namespace std;
bool point_in_interval(const pair<int, int>& interval, int point) {
return point >= interval.first && point <= interval.second;
}
bool right_edge... | ALGO | 0.999843 | 5.482701 |
235940bb-ba48-4a02-9ec8-07510f6f2fc1 | dvt32/code-journey | C++/Uni-Ruse/1. Intro to Programming/06.01.2015.18.05.cpp | /* Димитър Валериев Трифонов, КН, 50Б, 146518 */
/*
1. Зададен е едномерен масив от цели числа А0, А1,...,Аn-1.
Да се състави програма, която създава нов масив а0, а1,...,аn-1,
като стойността на аi е равна на броя на цифрите на Аi.
*/
#include "stdafx.h"
using namespace std;
#include <iostream>
#include <stdlib.h>... | ALGO | 0.999487 | 4.204945 |
0fdb1f72-fa24-4d79-bfbd-ec5a82717f80 | BSanandu88/Coding-questions | Additional/problems/MAXMEX.CPP | /* Chef has a sequence of positive integers A1,A2,…,AN. He wants to choose some elements of this sequence (possibly none or all of them) and compute their MEX, i.e. the smallest positive integer which does not occur among the chosen elements. For example, the MEX of [1,2,4] is 3.
Help Chef find the largest number of e... | ALGO | 0.999876 | 4.499057 |
1588b0fc-a9cb-4eb1-9761-c626ea975205 | HassanMahmoudd/DataStructures-Algorithms | Anagram-Pattern-Search/Anagram-Pattern-Search/Source.cpp | #include<set>
#include<map>
#include<list>
#include<iomanip>
#include<cmath>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<complex>
#include<sstream>
#include<iostream>
#include<fstream>
#include<iterator>
#include<algorithm>
#include<numeric>
#include<utility>
#include<functional>
#include... | ALGO | 0.999976 | 4.717715 |
bc5e9d23-a78a-4f77-b07a-37f19a5270f1 | positively4th/mth | src/core/tfunction0.cpp | #include "tfunction0.h"
#include <debug.h>
#include <math.h>
#include <string>
#include <stlstringtools.h>
#include <tpointerstack.h>
#include <stdarg.h>
//#include "tderivative.h"
#include "tfmatrix.h"
#include "tmathtools.h"
#include "tadd.h"
#include "tsub.h"
#include "tmul.h"
#include "tdiv.h"
#include "tpow.h"
... | TOOL | 0.926418 | 5.477094 |
5668b3fb-0223-45d7-89c2-e11dbd7cccd6 | AhmedEzzatG/competitiveProgramming | TIMUS/1350.cpp | #include<bits/stdc++.h>
#include<unordered_map>
#include<unordered_set>
using namespace std;
#define ll long long
#define endl '\n'
#define RT(v) return cout<<v,0
#define sz(v) (int)(v.size())
#define all(v) v.begin(),v.end()
#define clr(v,val) memset(v,val,sizeof(v))
#define watch(x) cout<<(#x)<<" = "<<x<<endl
#define... | ALGO | 0.999919 | 5.013823 |
41edeba7-6c14-47a2-bd76-2fbab2886862 | northyg/Data-Structures | Project4-Website-Binary-Search-Tree/website.cpp |
/************************************/
// Giselle Northy
// CS260, Fall 2019
// Project 4: This project utilizes a binary search tree (BST) to store
// websites and their info such as keyboard, rating, topic, summary and address
// File Name: website.cpp
/************************************/
#include <cstdlib>
#incl... | TOOL | 0.989977 | 4.696812 |
520e578a-8678-401a-a1db-4ec612991fab | PinochetLab/DX12 | extern/assimp/code/PostProcessing/OptimizeMeshes.cpp | /** @file OptimizeMeshes.cpp
* @brief Implementation of the aiProcess_OptimizeMeshes step
*/
#ifndef ASSIMP_BUILD_NO_OPTIMIZEMESHES_PROCESS
#include "OptimizeMeshes.h"
#include "ProcessHelper.h"
#include <assimp/SceneCombiner.h>
#include <assimp/Exceptional.h>
using namespace Assimp;
static const unsigned int N... | ALGO | 0.856353 | 7.222455 |
eaa23611-f746-4840-80e1-6681b40dad22 | ayushsaini12/OS-codes | srtf.cpp | #include <iostream>
#include <stdlib.h>
using namespace std;
void input_burst_arrival_time(int burst_time[],int process[],int arrival_time[])
{
cout<<"Enter burst time and arrival time for four processes : "<<endl;
for(int i=0;i<4;i++)
{
process[i]=i;
cout<<"Enter burst time: "<<endl;
cin>>burst_tim... | ALGO | 0.999992 | 3.279093 |
1fa8801e-b0bd-4405-8371-7f0c8f26e7df | JANN4TUL-FERDOUS/Codeforces-Solutions | jannatul.cse7.bu/contest/1433B.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int t,n,i;
cin>>t;
while(t--){
cin>>n;
int s=0,s1=0,s2=n;
int a[n];
for(i=0;i<n;i++){
cin>>a[i];
}
for(i=0;i<n;i++){
if(a[i]==1) break;
else s1++;
}
fo... | ALGO | 0.999754 | 3.952739 |
d91735d3-95df-4934-b95c-98f86f43e520 | rashcasm/CPP-DSA | 8_0-1-2_arrange.cpp | #include<iostream>
using namespace std;
void sort(int *a, int size)
{
int i=0, j=0, k=size-1;
while(j<k)
{
if(a[j]==0)
{
swap(a[i], a[j]);
i++;
j++;
}
else if (a[j]==1)
{
j++;
}
else
{
... | ALGO | 0.999894 | 4.051437 |
4f2bbe62-747a-465f-8297-cdcd72e7f291 | ishandutta2007/codeforces | um_nik/normal/914/D.cpp | #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
using namespace st... | ALGO | 0.999897 | 4.150187 |
e157d3bd-14e9-4b64-bbe2-077f8343bdc2 | riyabaranwal/Decode-with-C-- | DP3/mCoins.cpp | #include<iostream>
#include<vector>
using namespace std;
int main(){
int k , l ,m;
//m= no. of games
cin>>k>>l>>m;
vector<bool>dp(1000005,0);//0 = losing state
dp[1] = 1;//1=winning state
dp[k] = 1;
dp[l] = 1;
//1 waala compute karne ka jarurat nhi h n kyonki 1 ka humesha 1 hi hoga base condition h ... | ALGO | 0.99995 | 3.979303 |
40eff176-7476-49db-a724-0fddbbf654ba | KirtiSharma0/Conditionals | 10.cpp | //take 3 input and check if they are the side of triangle
#include<iostream>
using namespace std;
int main(){
int a,b,c;
cout<<"Enter side a =";
cin>>a;
cout<<"Enter side b =";
cin>>b;
cout<<"Enter side c =";
cin>>c;
if(a+b>c && b+c>a && c+a>b){
cout<<"Its a triangle";
}
... | ALGO | 0.982322 | 3.373206 |
c7c41eb9-fa60-49d0-bd3d-4b3883b99cc0 | GeneLiuXe/University-Subject-Library | Data-Structure/Experiment/Ex9-BinaryTree/pre+mid=post.cpp | #include <iostream>
using namespace std;
void solve(int l1,int r1,int l2,int r2,int *s1,int *s2,int len)
{
for(int i = l2; i <= r2; i++){
if(s2[i] == s1[l1]) //在中序遍历中找到根节点位置,然后变成剩下两棵树的递归
{
solve(l1+1,l1+i-l2,l2,i-1,s1,s2,len);
solve(l1+i-l2+1,r1,i+1,r2,s1,s2,len);
cout << s1[l1]; //根节点最后输出,即是前序遍历
if(l... | ALGO | 0.999979 | 3.284041 |
c7c9ee59-8dfa-4e3a-ba5a-ba5e04e330c2 | ArushNo1/Competitive-Programming | CF/681C.cpp | #pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef tree<int,null_type,less<int>,rb_tree_tag,
tree_order_statistics_node_update> indexed_set;
typedef vector<int> vi;
typedef vect... | ALGO | 0.999775 | 4.257948 |
5ed349c9-c20d-41aa-8a4b-eb0d30c47464 | whynotfu/cpp_uni_books | cpp_lang/Deque_6/task2/task2.cpp | #include "MyDequeP.h"
#include <iostream>
// Определение ориентации трех точек
int orientation(const Point& A, const Point& B, const Point& C) {
return (B.x - A.x) * (C.y - B.y) - (B.y - A.y) * (C.x - B.x);
}
// Пузырьковая сортировка точек относительно `R`
void sortPoints(Point points[], int n, const Point& R) {... | ALGO | 0.99996 | 5.391493 |
b18e4d0a-3b4c-45b7-92e6-e5b39d4c63c3 | AndrewJRichardson/Real-Time-Rendering | Libs/glm/test/gtx/gtx_fast_trigonometry.cpp | #include <glm/gtc/type_precision.hpp>
#include <glm/gtx/fast_trigonometry.hpp>
#include <glm/gtx/integer.hpp>
#include <glm/gtx/common.hpp>
#include <glm/gtc/constants.hpp>
#include <glm/gtc/ulp.hpp>
#include <glm/gtc/vec1.hpp>
#include <glm/trigonometric.hpp>
#include <cmath>
#include <ctime>
#include <cstdio>
#includ... | TEST | 0.975863 | 6.183665 |
ac07e951-a428-4a7d-840e-c295d412b621 | kawaiikaorichan/High_Poly_DC | sadx-mod-loader/mod-loader-common/ModLoaderCommon/IniFile.cpp | /**
* SADX Mod Loader
* INI file parser.
*/
#include "stdafx.h"
#include "IniFile.hpp"
#include "TextConv.hpp"
#include "Utils.hpp"
// Needed for CP_UTF8 if stdafx.h doesn't have windows.h.
#ifndef WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN
#endif
#include <windows.h>
#include <algorithm>
#include <cctype>
... | TOOL | 0.942757 | 3.729033 |
9cf4fc51-ebed-4628-8f49-622ff1a2dec7 | ishandutta2007/codeforces | sugarrr/normal/1566/D2.cpp | #include <algorithm>
#include <array>
#include <cassert>
#include <type_traits>
#include <vector>
#ifdef _MSC_VER
#include <intrin.h>
#endif
namespace atcoder {
namespace internal {
int ceil_pow2(int n) {
int x = 0;
while ((1U << x) < (unsigned int)(n)) x++;
return x;
}
constexpr int bsf_constexpr(unsi... | ALGO | 0.999691 | 4.673052 |
225f675c-9a9a-45f3-a365-ee50deb18cb0 | BhomikTomar/CP-DSA | 1100/subseq_addition.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
vector<long long> arr(n);
for (int i = 0; i < n; i++) {
cin >> arr[i];
}
... | ALGO | 0.999834 | 5.228956 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.