uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
840bd2a9-4aea-4e36-9907-87eba40e985c | thegamer1907/Code_Analysis | contest/1542588421.cpp | #include <map>
#include <set>
#include <stack>
#include <cmath>
#include <queue>
#include <vector>
#include <cstdio>
#include <string>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <algorithm>
using namespace std;
const int max_n = 5, inf = 1011111111;
const long double eps = 1e-8;
i... | ALGO | 0.999199 | 3.111098 |
556d5873-ffbd-4bd8-9ba2-97b95982f988 | chengyiwei/algorithm | nowcoder/2024winter_camp_1/D/D0.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const LL INF = 1e9;
const int maxn = 1e5+5;
int n,m;
LL a[maxn];
map<LL,int> num;
set<LL> st;
bool check(LL x){
LL now = 1;
for(int i=1;i<=n;i++){
LL p = a[i] + x;
now *= p;
if(now==0 || abs(now) > INF) return 0;
}
... | ALGO | 0.999943 | 3.957441 |
06cd1a89-66b7-4937-8f03-f9a83c935423 | ishandutta2007/codeforces | avinashkartik/normal/1690/E.cpp | #include<bits/stdc++.h>
using namespace std;
#define GODSPEED ios:: sync_with_stdio(0);cin.tie(0);cout.tie(0);cout<<fixed;cout<<setprecision(15);
#define f first
#define s second
#define newl cout<<"\n";
#define pb push_back
#define mset(a,x) memset(a,x... | ALGO | 0.999892 | 3.441806 |
88eae613-74d5-4cb3-8e6a-5646e5a20456 | ishandutta2007/codeforces | 137_345_2814/normal/914/E.cpp | #include<cstdio>
#include<map>
#include<set>
using namespace std;
#define N 200050
int n,m,k,sz[N],vis[N],dis[N],mx[N],head[N],cnt,a,b,c,val,ans,tmp;
int s1[N*7],s2[N*7];
long long Ans[N];
char s[N];
struct edge{int t,next;}ed[N*2];
void adde(int f,int t){ed[++cnt]=(edge){t,head[f]};head[f]=cnt;ed[++cnt]=(edge){f,head[... | ALGO | 0.99985 | 3.552491 |
778492a7-9572-4c30-8940-b36c19152527 | nathanzhu144/practices | workspace/temp1/987_vert_ord_BST.cpp | /* Nathan Zhu Sunday Stockton, CA. 9:24 pm June 19th, 2020. I watched a william lin video of him doing 150 questions in 12 hours lol. OK my dude.
* Leetcode 987 | medium | medium
* Category: binary tree, hard part is figuring out how to break ties correctly.
*/
#include <vector>
#include <unordered_map>
#include <... | ALGO | 0.999995 | 6.042427 |
129d7c87-0059-4801-87d2-04efd88b6461 | JinMinghan18/mass | 寒假day4D - Frogger.cpp | #include <iostream>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#define maxn 300
#define INF 0x3f3f3f3f
using namespace std;
double mmp[maxn][maxn];
double dis[maxn];
bool vis[maxn];
int n;
struct node
{
double x,y;
}m[300];
int main()
{
int t = 1;
while(scanf("%d",&n)!=EOF && n)
{
for(int i=1;i<=... | ALGO | 0.998953 | 3.52567 |
5fb54b89-2e44-4553-b893-5380a976e841 | Lee-jisang/BOJ-Programmers-Hub | 프로그래머스/lv2/12909. 올바른 괄호/올바른 괄호.cpp | #include<string>
#include <iostream>
#include <stack>
using namespace std;
bool solution(string s) {
stack<char> st;
for(int i=0; i<s.length(); i++){
if(st.empty() || st.top() == s[i]) st.push(s[i]);
else if(st.top() != s[i]) {
if(st.top() == ')') continue;
else st.pop()... | ALGO | 0.998017 | 5.221735 |
fb886921-293e-4c92-b8a6-57e0f54ce58a | arijitsaha2002/CSES-SOLUTION | Mathematics/Stick_Game.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define M 1000000007
#define INPUT(N, arr) for (int i = 0; i < N; cin >> arr[i], i++)
#define newline '\n'
#define FOR(i, N) for (int i = 0; i < N; i++)
#define blankchar ' '
#define Point pair<int, int>
// tree<int, null_type, less<int>, rb_tree_tag, ... | ALGO | 0.999914 | 3.12813 |
21e32ece-7426-44f5-bd02-7d84bd0cee3f | c8ef/Bustub | src/optimizer/order_by_index_scan.cpp | #include <algorithm>
#include <memory>
#include "binder/bound_order_by.h"
#include "catalog/catalog.h"
#include "catalog/column.h"
#include "catalog/schema.h"
#include "common/exception.h"
#include "common/macros.h"
#include "execution/expressions/column_value_expression.h"
#include "execution/expressions/constant_val... | ALGO | 0.99547 | 7.510412 |
0720d029-63d0-49cb-bbb5-6f11bb935813 | ishandutta2007/codeforces | joeywheeler/normal/549/F.cpp | #include <bits/stdc++.h>
#define FO(i,a,b) for (int i = (a); i < (b); i++)
#define sz(v) int(v.size())
using namespace std;
struct RT {
static constexpr int N = 300005;
typedef pair<int,int> T;
T v[4*N];
static constexpr T IDENTITY = {-2e9,-2e9};
T op(const T &a, const T &b) {
return max(a,b);
}
T q(int i... | ALGO | 0.999988 | 3.811068 |
78008cd9-479c-4626-b3b6-a3ee9ce78ae3 | enfycius/RTK-GPS | test/Eigen/doc/examples/tut_arithmetic_matrix_mul.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace Eigen;
int main()
{
Matrix2d mat;
mat << 1, 2,
3, 4;
Vector2d u(-1,1), v(2,0);
std::cout << "Here is mat*mat:\n" << mat*mat << std::endl;
std::cout << "Here is mat*u:\n" << mat*u << std::endl;
std::cout << "Here is u^T*mat:\n" << u.transpo... | ALGO | 0.998574 | 3.818773 |
4a024740-ad39-4db3-90df-13f2ce61780c | alesmk/Assignments-DHCN | Assignment4/fastflow/tests/distributed/dwordcount/dwordcountH.cpp | /* -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
* The Source produces a continuous stream of lines of a text file.
* The Splitter tokenizes each line producing a new output item for each
* word extracted. The Counter receives single words from the line
* splitter and counts h... | DATA | 0.91159 | 6.033893 |
d9dc3d10-3c99-493e-9d30-7e45c91efeb6 | jiale-gdyd/gui_project | project/gui/lvgl/src/libs/thorvg/tvgSwMath.cpp | #include "../../lv_conf_internal.h"
#if LV_USE_THORVG_INTERNAL
#include "tvgMath.h"
#include "tvgSwCommon.h"
/************************************************************************/
/* Internal Class Implementation */
/**********************************************************... | ALGO | 0.996656 | 5.976981 |
665134fd-09f6-4721-919e-60d9908253ff | evga7/Practice_Algorithm_01 | BOJ_1052.cpp | #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <string.h>
#include <queue>
#include <stack>
using namespace std;
int N, K;
int res = 0;
void solve()
{
int M = N;
while (1)
{
int cnt = 0;
int temp = M;
while (temp > 0)
{
if (temp % 2 == 1... | ALGO | 0.999962 | 4.274841 |
61865277-8caa-4110-acb3-0c1e6427f8e1 | 27-aditya/LeetSols | 0005-longest-palindromic-substring/0005-longest-palindromic-substring.cpp | class Solution {
private:
string expandCenter(string s, int left, int right){
while(left >= 0 && right <= s.size() && s[left] == s[right]){
left--;
right++;
}
return s.substr(left+1, right-left-1);
}
public:
string longestPalindrome(string s) {
int n =... | ALGO | 0.99999 | 6.481799 |
54d044a1-a80b-4195-a68a-c7fc9723d7fc | s3ansh33p/CPBounce | calc.cpp | #include "calc.hpp"
extern void main2(); //in file main.cpp
//Global variables
#ifdef PC
SDL_Window *win;
SDL_Renderer *renderer;
SDL_Texture *texture;
int width;
int height;
#else
//uint16_t *vram; //this got moved to sdk/calc/calc.hpp
uint8_t debugprintline = 0;
#endif
extern "C"
#ifdef PC
int main(){
#els... | TOOL | 0.895381 | 3.803436 |
65b4a3a9-bc10-4fcd-898f-da825657135d | chaitanya-cloud08/DSA-learning | patterns/nineteen.cpp | #include <iostream>
using namespace std;
void star(int n) {
int spaces = 0;
// Upper part
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= n - i; j++) { // Fix loop condition
cout << "*";
}
for (int j = 0; j < spaces; j++) {
cout << " ";
}
... | ALGO | 0.999972 | 5.696981 |
b125b439-fc2b-478a-8d23-13d24e579827 | super626/CocosVRDemo | cocos2d/cocos/3d/CCOBB.cpp | #include "3d/CCOBB.h"
NS_CC_BEGIN
#define ROTATE(a,i,j,k,l) g=a.m[i + 4 * j]; h=a.m[k + 4 * l]; a.m[i + 4 * j]=(float)(g-s*(h+g*tau)); a.m[k + 4 * l]=(float)(h+s*(g-h*tau));
static Mat4 _getConvarianceMatrix(const Vec3* vertPos, int vertCount)
{
int i;
Mat4 Cov;
double S1[3];
double S2[3][3];
S... | ALGO | 0.998341 | 6.076499 |
9c65c42f-7a30-4093-9fe2-dff257e903bd | Pooh1223/Online-Judge | Uva/10082.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
string s = "`1234567890-=QWERTYUIOP[]\\ASDFGHJKL;'ZXCVBNM,./";
string a;
while(getline(cin,a)){
for(int i = 0;i < a.length();++i){
if(a[i] != ' '){
for(int j = 0;j < s.length();++j){
if(s[j] == a[i]){
cout << s[j - 1];
break;
... | ALGO | 0.999645 | 3.669823 |
1bc5ee7d-82b1-452f-94c0-613d35379481 | krishnadhar00/13_All_Sorting | 03_Insertion_Sort.cpp | // Repeatedly take element from unsorted subarray and insert in sorted subarray at its correct position.
// We start with second element of the array as first element in the array is assumed to be sorted.
// Compare second element with the first element and check if the second element is smaller then swap them.
// Move... | ALGO | 0.999989 | 6.263076 |
31edb14b-df71-4e36-9da2-3256f78dbc45 | codeAntu/LeetCode-problems | cpp/binary-tree-preorder-traversa.cpp | #include "iostream"
#include "math.h"
#include "vector"
#include "map"
using namespace std;
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, Tree... | ALGO | 0.999956 | 5.808962 |
d6a0e32f-b2f5-49b6-8cf3-d451d843a05d | ishandutta2007/codeforces | mangooste/normal/1257/D.cpp | #include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <iomanip>
#include <string>
#include <fstream>
#include <unordered_set>
#include <unordered_map>
#include <cassert>
#include <cstdio>
#include <ctime>
ty... | ALGO | 0.999975 | 4.633013 |
c8c13104-9fe4-47fc-9cc1-152f9b065ced | Agnik04/Cpp-OOPS | Basics/Matrix_m.cpp | #include "Matrix.h"
int main()
{
int row, column;
cout << "Give the size of row : ";
cin >> row;
cout << "Give the size of column : ";
cin >> column;
Matrix a1(row, column);
Matrix a2(row, column);
Matrix res(row, column);
cout << "A1 INPUT" << endl;
a1.take_input();
c... | ALGO | 0.96101 | 4.275111 |
722bc254-46a3-494c-9f8f-98923fdd85fa | Eric19991104/Algorithm | 0-1 背包問題/Binary Knapsack With Branch and Bound(Best First Search).cpp | #include<bits/stdc++.h>
using namespace std;
struct item
{
int profit;
int weight;
double cp;
};
struct node
{
int level;
int profit;
int weight;
double bound;
bool operator > (const node &s)const
{
return bound < s.bound;
}
};
int knapsack(int,int,item []);
bool compare_item(item,item);
double profit_bound... | ALGO | 0.999995 | 3.968876 |
a4a156bd-d855-4462-949b-5ba2adbd6de9 | tomohide-itt/Libigl_Proj | 610_CSGTree_original/include/igl/edge_vectors.cpp | #include "edge_vectors.h"
#include <Eigen/Geometry>
#include "per_face_normals.h"
#include "PI.h"
template<typename DerivedV,typename DerivedF,typename DerivedE,
typename DerivedoE, typename Derivedvec>
IGL_INLINE void
igl::edge_vectors(
const Eigen::MatrixBase<DerivedV> &V,
const... | ALGO | 0.991186 | 6.696792 |
0b54498c-75bd-422e-b07a-6364c5f45426 | bakashigure/my_leetcode_solutions | 98.验证二叉搜索树.cpp | /*
* @lc app=leetcode.cn id=98 lang=cpp
*
* [98] 验证二叉搜索树
*/
#include <bits/stdc++.h>
using namespace std;
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(in... | ALGO | 0.999859 | 7.270204 |
9300713e-8372-4ded-a483-fb904c4fbae4 | xtf0214/CPP | Contest/GPLT/GPLT2023/2023天梯赛选拔赛1/5.cpp | #include <iostream>
using namespace std;
int main() {
int i, k = 0, s = 0, x; // i表示月份,k表示每月剩余的钱,s表示存款,x表示预算
for (i = 1; i <= 12; i++) {
cin >> x;
if (k + 300 - x >= 0) {
s += (k + 300 - x) / 100 * 100;
k = (k + 300 - x) % 100;
} else {
cout << "-" << ... | ALGO | 0.997928 | 3.045139 |
69675d4e-8da6-4282-81b0-265b3e996f51 | TALWTN/talwtn | SDK/third_party/boost_1_69_0/boost/random/example/weighted_die.cpp | //[weighted_die
/*`
For the source of this example see
[@boost://libs/random/example/weighted_die.cpp weighted_die.cpp].
*/
#include <boost/random/mersenne_twister.hpp>
#include <boost/random/discrete_distribution.hpp>
boost::mt19937 gen;
/*`
This time, instead of a fair die, the probability of
rolling ... | ALGO | 0.999819 | 5.644499 |
b75ae965-d22e-41e2-b950-739fbb716a3f | hajimeIppo-cmd/cp-codes | Codeforces/Codeforces Round #638 (Div. 2)/B.cpp | #include <bits/stdc++.h>
#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
using namespace std;
const int INF = 1e9 + 7;
int main() {
cin.tie(NULL); cout.tie(NULL);
ios_base::sync_with_stdio(false);
int T; cin >> T;
while (T--) {
int N, K;
cin >> N >> K;
vector<int> arr(N + 5), ans... | ALGO | 0.99965 | 4.692036 |
a8dbd42d-8f43-48c3-be33-8a41727a93ee | Kulezi/potyczki_algorytmiczne | 2025/runda1/fin/fin.cpp | // Rozwiązanie do zadania 'Finaliści [1C]' z Potyczek Algorytmicznych 2025.
// Autor rozwiązania: Paweł Putra
// Złożoność czasowa: O(n)
// Złożoność pamięciowa: O(n)
// Punkty: 10
#include <iostream>
#include <string>
using namespace std;
int32_t main() {
ios_base::sync_with_stdio(0);
int n;
cin >> n;
... | ALGO | 0.999789 | 4.094637 |
ea36643e-5b52-4fec-90b6-091684ed59cb | suhaskvittal/foresight-cpp | src/routing_private.cpp | /*
author: Suhas Vittal
date: 28 February 2022
*/
#include "../include/foresight.h"
#include <algorithm>
#include <parallel/algorithm>
#include <unordered_map>
#include <stdlib.h>
#include <math.h>
double _cost(std::shared_ptr<solution_kernel> k) {
return k->completed_2qubit_gates == 0 ? ((double)k->... | ALGO | 0.999913 | 4.834294 |
129fd1f5-c087-470f-84ba-021cd4c559a0 | sarvex/leetcode-csh | solution/0300-0399/0343.Integer Break/Solution.cpp | class Solution {
public:
int integerBreak(int n) {
if (n < 4) {
return n - 1;
}
if (n % 3 == 0) {
return pow(3, n / 3);
}
if (n % 3 == 1) {
return pow(3, n / 3 - 1) * 4;
}
return pow(3, n / 3) * 2;
}
}; | ALGO | 0.999994 | 6.298215 |
f217fd95-6d20-473b-bd2a-4ef7574af4eb | zziri/study | ps/BOJ/2206 벽 부수고 이동하기.cpp |
/**
* @author Jihoon Jang
*/
#include <iostream>
#include <queue>
#define SIZE 1001
using namespace std;
int map[SIZE][SIZE];
bool visited[2][SIZE][SIZE];
int dx[] = {0, 1, 0, -1};
int dy[] = {-1, 0, 1, 0};
typedef struct qnode
{
int x, y, distance, crash;
qnode(int x, int y, int d, int c):x(x), y(y), dista... | ALGO | 0.999931 | 3.658988 |
ca34cfac-5cee-4cea-888c-1bff891355e8 | GeMixl/ConstraintDynamicsModel | src/InteractionNetwork.cpp | /*
* InteractionNetwork.cpp
*
* Created on: Sep 8, 2010
* Author: mgernot
*/
#include "InteractionNetwork.h"
inline double signum(double val) {
if (val < 0.) return (-1.);
else return (1.);
}
void InteractionNetwork::updateNetwork() {
for (unsigned int r = 0; r < F->P_count; r++) {
// flip particles ... | ALGO | 0.999804 | 4.701546 |
ff34fbda-e164-4581-9eb5-134e01df120f | ishandutta2007/codeforces | gabrijel/normal/1293/A.cpp | #include <bits/stdc++.h>
using namespace std;
#define REP(i, a, b) for(int i = a; i < b; i++)
map <int, bool> ne;
int main()
{
int t;
cin >> t;
int n, s, k;
REP(tt, 0, t)
{
ne.clear();
cin >> n >> s >> k;
int x;
REP(i, 0, k)
{
scanf("%d", &x);
ne[x] = 1;
}
int br = 0;
while(1)
{
if(s ... | ALGO | 0.999908 | 3.289539 |
6767bff0-7de7-47d0-a686-5b18aee3c202 | theshameem/LeetCode-Problems-Solutions | 0443-string-compression/0443-string-compression.cpp | class Solution {
public:
int compress(vector<char>& chars) {
int pos = 0;
for(int i = 0; i < chars.size(); i++){
int cnt = 1;
while(i + 1 < chars.size() && chars[i] == chars[i + 1]){
++cnt, ++i;
}
chars[pos++] = chars[i];
st... | ALGO | 0.999989 | 6.358678 |
31e9c6d1-5b2d-40b3-9fc5-6285ca5806c6 | DreamChaser-luzeyu/NKDataTypeNew | Data-Structures-Algorithms-and-Applications-in-cpp-master/all codes in book/Data Structures, Algorithms, & Applications in C++, 2nd Edition/testBellmanFord.cpp | // test graph::bellmanFord
#include <iostream>
#include "graph.h"
#include "adjacencyWDigraph.h"
#include "adjacencyWGraph.h"
#include "linkedWDigraph.h"
#include "linkedWGraph.h"
using namespace std;
void main(void)
{
const int numberOfTypes = 4;
const noEdge = 100;
// create a graph of each weighted type
... | TEST | 0.99886 | 5.501678 |
6639d574-8540-40d9-ae26-88aae6bb0891 | Aaditya-Kumar-Mittal/Striver-DSA-Course | Stacks/CPP_Stack_Postfix_To_Prefix_Conversion.cpp | #include <bits/stdc++.h>
using namespace std;
/*
Function to check if a character is an operand (A-Z, a-z, 0-9).
Operands are characters or digits that will be pushed onto the stack.
Returns true if the character is an operand, false otherwise.
*/
bool isOperand(char ch)
{
if (
(ch >= 'A' && ch <= ... | ALGO | 0.999693 | 7.342984 |
5d112afc-3101-42e2-90d9-ebbd7fa1ccba | suzumiyayuhi/AlgorithmTraining | hdoj/ACM_Steps/chapter1/section2/rightmost .cpp | #include<iostream>
using namespace std;
int main()
{
int n,i,j,k,l;
int m;
cin>>n;
while(n--)
{
cin>>m;
i=m%10;
j=i*i%10;
k=j*i%10;
l=k*i%10;
switch(m%4)
{
... | ALGO | 0.999942 | 4.024423 |
54d1bc74-a538-454a-a0a4-6f0631641c71 | liangkaiwen/baxter_project | src/object_modeling/tmp/object_modeling/object_model/OLD_CODE/dump_frames.cpp | #include "stdafx.h"
#include <boost/thread/thread.hpp>
#define MEASURE_FUNCTION_TIME
#include <pcl/common/time.h> //fps calculations
#include <pcl/io/openni_grabber.h>
#include <pcl/visualization/point_cloud_handlers.h>
#include <pcl/visualization/pcl_visualizer.h>
#include <pcl/visualization/image_viewer.h>
#include ... | TOOL | 0.89263 | 5.164901 |
f24c39b0-5f9e-4711-b3d1-dbd58ee80d25 | Dup4/competitive-programming | BZOJ/1061/a.cpp | #include <bits/stdc++.h>
using namespace std;
typedef double db;
const db eps = 1e-10;
int sgn(db x) {
if (fabs(x) < eps)
return 0;
return x < 0 ? -1 : 1;
}
struct LP {
int m, n;
vector<int> B, N;
vector<vector<db> > D;
LP() {}
LP(vector<vector<db> > &A, const vector<db> &b, const v... | ALGO | 0.999971 | 3.688938 |
069e55ac-6692-4da1-a97f-7bb36de6e7ca | Mh-Magdy/planning_project | project/starter_files/eigen-3.3.7/unsupported/test/BVH.cpp | #include "main.h"
#include <Eigen/StdVector>
#include <Eigen/Geometry>
#include <unsupported/Eigen/BVH>
namespace Eigen {
template<typename Scalar, int Dim> AlignedBox<Scalar, Dim> bounding_box(const Matrix<Scalar, Dim, 1> &v) { return AlignedBox<Scalar, Dim>(v); }
}
template<int Dim>
struct Ball
{
EIGEN_MAKE_ALIGN... | TEST | 0.993268 | 6.337957 |
ddabf71f-368b-44f9-8898-8aa3aa888f62 | RydKrm/Competitive_Program | Codeforces/116B little pigs and wolfs.cpp | #include<iostream>
#include<string>
using namespace std;
int main(){
int n,i,j,m,cnt=0,p;
cin>>n>>m;
char str[n+5][m+5];
for(i=0;i<n;i++) cin>>str[i];
for(i=0;i<n;i++){
for(j=0;j<m;j++){
if(str[i][j]=='W'){
if(str[i][j-1]=='P'||str[i][j+1]=='P'||str[i-1][j]=='P'||str[i+1][j]=='P'){
cnt++;
... | ALGO | 0.9995 | 3.522904 |
712ee690-9192-49c3-9390-ee176a41832c | Mehedi259/problemSolving | InteristingDrink.cpp | // Mehedi Hasan Mridul
#include<bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n;
cin >> n;
vector <int> v(n);
vector <int> f(1e5+1);
vector <int> pf(1e5+1);
for(int i=1;i<n;i++)
{
cin >> v[i];
... | ALGO | 0.999718 | 3.958499 |
5dd8a97e-5131-4f89-9496-71afc0d7ee9a | rosynirvana/UVa | 11057.cpp | #include <iostream>
#include <ios>
#include <vector>
#include <algorithm>
int main()
{
std::ios_base::sync_with_stdio(false);
int n;
while(std::cin >> n){
std::vector<int> price;
for(int i=0; i!=n; ++i){
int temp;
std::cin >> temp;
price.push_back(temp);
}
int money;
std::ci... | ALGO | 0.999968 | 3.759237 |
b0c88063-ba68-448d-a129-079cf36b8227 | ImLexsus/lexsus | C++/Tutor C++/27 Latihan dadu acak/Dadu.cpp | #include<iostream>
#include<cstdlib> //mengandung fungsi random
using namespace std;
int main(){
char lanjut;
while(true){
cout << "Lempar dadu? (y/n)";
cin >> lanjut;
if(lanjut == 'y'){
cout << 1 + (rand() % 6) << endl; // 1+ agar nilai random dimulai dari 1
}else... | TOOL | 0.946709 | 3.831032 |
cf9d1533-10e1-40dd-b67e-d0c4eb9b625d | anaveragehuman/csci13600-labs | lab_04/src/cross.cpp | #include <algorithm>
#include <iostream>
#include <sstream>
#include "main.hpp"
void muhfunc(std::stringstream *ssnek, std::string *yu, unsigned int *ar,
unsigned int *el) {
(*yu).replace((*el)++, 2, MUH_SPACE_CHAR);
(*yu).replace(--(*ar), 2, MUH_CHAR_SPACE);
*ssnek << *yu;
}
std::string cross(int size) {
... | ALGO | 0.870368 | 5.447197 |
1bbdb8fe-2cc5-4e98-8786-f673fabf1886 | davidmallasen/AceptaElReto | 0445-SemanaInformatica/0445.cpp | /**
* Problema 0445: Semana de la informatica
*
* Fase local Ada Byron 2018. Equipo MineFinder:
* David Mallasen Quintana
* Ivan Prada Cazalla
* Alvaro Rodriguez Garcia
*/
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <functional>
#define gc getchar_unlocke... | ALGO | 0.999806 | 4.268198 |
d4ad3033-7161-409e-a072-0ad48a1266fd | ocha98/compro | poj/1703.cpp | #include <stdio.h>
#include <vector>
#include <math.h>
using namespace std;
const int MAX_N = 1e5;
struct WeightedUnionFind{
vector<int> par;
vector<int> weight;
WeightedUnionFind(int n):par(n, -1), weight(n,0){}
void init(){
fill(par.begin(), par.end(), -1);
fill(weight.begin(), weig... | ALGO | 0.999905 | 4.6498 |
0f539922-efee-4cc5-b9bc-4155bb97ca3f | SagarNarsingani/DS-Algo | DSA-essentials/Arrays/Exercise/see_again/pascal_triangle.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int N = 6;
vector<vector<int>> v;
v.push_back({1});
v.push_back({1, 1});
for(int i = 1; i < N; i++){
vector<int> subv = {1};
for(int j = 0; j < int(v[i].size())-1; j++){
subv.push_back(v[i][j]+v[i][j+1]);
}
subv.push_... | ALGO | 0.999807 | 3.089644 |
3f40527f-fac7-461e-a4ff-a1d878a5cad2 | FFMG/myoddweb.piger | myodd/boost/libs/compute/perf/perf_stable_partition.cpp | #include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>
#include <boost/compute/system.hpp>
#include <boost/compute/algorithm/stable_partition.hpp>
#include <boost/compute/container/vector.hpp>
#include "perf.hpp"
int rand_int()
{
return static_cast<int>((rand() / double(RAND_MAX)) * 25.0);... | ALGO | 0.997037 | 6.12738 |
620e5786-498d-46b5-9502-2bf37d045fce | lindayukeyi/Stylit | thirdparties/opencv/sources/3rdparty/carotene/src/reduce.cpp | #include "common.hpp"
#include <cstring>
namespace CAROTENE_NS {
void reduceColSum(const Size2D &size,
const u8 * srcBase, ptrdiff_t srcStride,
s32 * dstBase)
{
internal::assertSupportedConfiguration();
#ifdef CAROTENE_NEON
memset(dstBase, 0, size.width*sizeof(s32));
s... | ALGO | 0.996672 | 6.186884 |
8dbe0fc6-8d9c-4c45-94af-0c058b450782 | mankotia412vishal/DSA-Conqueror | DSA 4th Year/Gfg POTD/consectuvive_1s.cpp | int solve(int n, vector<vector<int>> input2)
{
vector<vector<int>> adj(n + 1);
for (auto it : input2)
{
adj[it[0]].push_back(it[1]);
}
queue<int> q;
q.push(0);
// vector<int>vis(n,false);
// vis[0]=true;
bool falg = true;
while (!q.empty())
{
int size = q.s... | ALGO | 0.999958 | 3.963821 |
e384786c-9609-485f-b266-b2eb7c866200 | PealMazumder/Online-Judges | Uva/12250LanguageDetection.cpp | #include<iostream>
#include<string>
using namespace std;
int main()
{
string input;
for(int i=1;;i++)
{
cin>>input;
if(input=="#")
break;
else if(input=="HELLO")
cout<<"Case "<<i<<": "<<"ENGLISH"<<endl;
else if(input=="HOLA")
cout<<"Case "<<i<<": "<<"SPANISH"<<endl;
else if(input=="HALLO"... | ALGO | 0.968746 | 3.707556 |
a8012bef-d55b-4be3-b379-2d8d0f47b6c0 | prince2520/Data-Structure-and-Algorithm | Challenges - Linked Lists/insterectingPoint.cpp | #include <bits/stdc++.h>
using namespace std;
class Node
{
public:
int data;
Node *next;
Node(int d)
{
data = d;
next = NULL;
}
};
// This function gets two arguments - the head pointers of the two linked lists
// Return the node which is the intersection point of these linked lis... | ALGO | 0.999944 | 4.226596 |
bcc1f71a-ea46-40bb-9b99-ac0d42f40353 | mur6/opencv-wasm-safari-build-test | opencv-4.5.2/opencv-4.5.2/samples/cpp/tutorial_code/features2D/Homography/decompose_homography.cpp | #include <iostream>
#include <opencv2/core.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/calib3d.hpp>
using namespace std;
using namespace cv;
namespace
{
enum Pattern { CHESSBOARD, CIRCLES_GRID, ASYMMETRIC_CIRCLES_GRID };
void calcChessboardCorners(Size boardSize, float squareSize, vector<Point3f>& corners,... | ALGO | 0.998947 | 5.402737 |
240ba85e-3420-4eac-a68e-e825173bc154 | leslieyip02/leetcode | completed/0002.cpp | #include <iostream>
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) {}
};
class Solution {
public:
ListNode* addTwoNumbers(ListNode* l1, ListNod... | ALGO | 0.999987 | 6.214575 |
c6e80124-2eea-4f68-b165-0a9fd1b53b5f | Tipriest/AlgorithmPractice | leetcode/greedy/3170.cpp | #include <algorithm>
#include <iostream>
#include <unordered_set>
#include <vector>
#include <math.h>
#include <limits.h>
#include <stack>
using namespace std;
class Solution {
public:
string clearStars(string s) {
// 维护两个stack,一个用于找现在的
stack<char> st1, st2;
unordered_map<char, int> umap;
umap[s[0]]++... | ALGO | 0.999943 | 4.078198 |
00345318-1943-4b31-ac34-f6fd0ab785fc | KeyaRaniMondal/Problem-Solving | Greedy/D.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n, pos = 0, neg = 0;
cin >> n;
int arr[n];
for (int i = 0; i < n; ++i)
{
cin >> arr[i];
}
for (int i = 0; i < n; ++i)
{
if (arr[i] < 0)
neg += arr[i];
else
pos += arr[i];
}
... | ALGO | 0.999983 | 4.575117 |
9fbb72ce-c0ae-4f18-8a42-b2f1877e0a50 | plazagonzalezd/Shorter-Path | Graph.cpp | #include "Graph.h"
#include <list>
#include <fstream>
#include <iterator>
using namespace std;
//Public Functions--------------------------------------------
/*
The constructor of the graph
pre condition: none
post condition:
adjList.size() = nrVetices
costs.size() = nrVertices
path.size() = nrVertices
known... | ALGO | 0.999569 | 4.494803 |
f7aee668-0258-4d37-8f45-e02ed896ad4d | MersadBase/MersadBase | Geometry/HalfLine.cpp | #include <cmath>
#include <HalfLine.h>
#include <Vector.h>
#include <Defines.h>
#include <Line.h>
#include <Circle.h>
#include <Degree.h>
#include <Logger.h>
using namespace std;
using namespace Degree;
HalfLine::HalfLine(Point point, Point point2)
{
Vector tempVector(Point(point2 - point));
HalfLine temhLine;
te... | ALGO | 0.997011 | 4.84919 |
ddf5a679-a1b4-4dbf-9dfe-850be03893ef | Omni-HuB/Competitive_Programiing_CP | edu152div2/B.cpp | #define ll long long
using namespace std;
bool comparePair(pair < int , int > p1 , pair < int , int > p2)
{
if(p1.first < p2.first)
{
return false;
}
else if(p1.first > p2.first)
{
return true;
}
return p1.second < p2.second;
}
void solve()
{
int num; cin >> num;
... | ALGO | 0.999817 | 3.265675 |
ff77f838-4fa4-482d-8327-06696d3e70bb | Xiangyu-Hu/SPHinXsys | tests/2d_examples/test_2d_FVM_double_mach_reflection/common_compressible_FVM_classes.cpp | #include "common_compressible_FVM_classes.h"
namespace SPH
{
//=================================================================================================//
CompressibleAcousticTimeStepSizeInFVM::
CompressibleAcousticTimeStepSizeInFVM(SPHBody &sph_body, Real min_distance_between_nodes, Real acousticCFL)
... | ALGO | 0.998237 | 5.908169 |
cea9f781-f385-4f20-b286-5b504819f2c5 | samiksha-dev/C-DSA-Practice- | Questions/ReverseNo.cpp | #include<iostream>
using namespace std;
int main(){
int num,rem,rev=0;
cout<<"Enter the No.";
cin>>num;
while(num!=0){
rem=num%10;
rev=rev*10+rem;
num=num/10;
}
cout<<rev;
} | ALGO | 0.999866 | 3.966557 |
583a4873-4eae-4a14-8188-107dee7d92f3 | ariofrio/cs140-hw5 | life.cpp | /*
Homework 5 : The Game of Life.
Team member 1 : John Doe
Team member 2 : Jane Doe
*/
// Function declarations file
#include "life.h"
// Debugging flag. Set to 0 during performance evaluation
int *livecount;
using namespace std;
int cilk_main(int argc, char **argv)
{
unsigned int n;
unsigned int iter;
int *a;
... | ALGO | 0.999472 | 3.912628 |
be5412c3-e3c8-458d-beb6-2b5a1ba49e72 | ErzhongHoo/DataStructure_code | 第2章/LinkListTest.cpp | /**
* @brief 单链表操作示范
*
* @author zhonghu e
* Contact: <EMAIL>
*/
#include"LinkList.h"
#include<iostream>
using namespace std;
int main() {
LinkList L; //将L定义为LinkList类型变量==实例化单链表为L,返回指向该结点的指针(指向头结点)
InitList(L); //初始化线性表
cout << "单链表已初始化,返回头结点地址:" << L << endl;
int a[]={66,55,44,33,22,11... | ALGO | 0.972732 | 3.798206 |
e86325f8-8ad8-4441-9d53-d4159bce34fb | rahulnagurtha/Mycode | interviewbit/reverseList.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
pair<ListNode*,ListNode*> recurse(ListNode *start) {
if(start->next == NULL) return make_pair(start,start);
pair<ListNode*,ListNode*> ret = recurse(start->nex... | ALGO | 0.999967 | 5.404758 |
8f42718d-2982-44d6-99d5-453698712894 | nmhienbn/Competitive-Programming | Mr.Minh/flower/flower (3).cpp | #include <bits/stdc++.h>
#define fi(i, a, b) for(int i = (a), _b = (b); i <= _b; i++)
#define fid(i, a, b) for(int i = (a), _b = (b); i >= _b; i--)
#define gb(x, i) (((x) >> (i)) & 1)
#define pii pair<int,int>
#define pb push_back
#define ll long long
#define Irelia "flower"
const int maxn = 55, mod = 1e9 + 7;
using na... | ALGO | 0.99997 | 4.318291 |
af2f7bac-cb2f-4059-b10e-6b787b6b4451 | Hausdorffcode/leetcode_cpp | Median of Two Sorted Arrays.cpp | //https://leetcode.com/problems/median-of-two-sorted-arrays/#/description
//暴力归并
//time O(n+m), space O(n+m)
class Solution {
public:
double findMedianSortedArrays(vector<int>& nums1, vector<int>& nums2) {
int len = nums1.size() + nums2.size();
vector<int> aux(len);
int p = 0, q = 0;
... | ALGO | 0.999992 | 6.277713 |
5e4a09de-adbd-4c23-a744-5308138cf4c9 | GTG-hub/CS254 | Lab 7/Q7_2/Q7_2.cpp | //Garima Upadhyay
//220001029
// Given an array of jobs where every job has a deadline and associated profit if the job is
// finished before the deadline. It is also given that every job takes a single unit of time,
// so the minimum possible deadline for any job is 1. Maximize the total profit if jobs are
// schedule... | ALGO | 0.999983 | 4.918572 |
d5606bce-9e87-428c-977f-17753259a0d8 | jamesliu96/vector.h | test.cpp | #include <iostream>
#include "Vector.h"
using namespace std;
int main(int argc, char *argv[])
{
Vector v(1, 2, 3);
Vector z(5.2, 12, 3.1429);
Vector s = v + v;
Vector m = v & z;
double n = v ^ z;
Vector u = v * 2;
double q = v < z;
cout<<"v=("<<v.A()<<","<<v.B()<<","<<v.C()<<")"<<endl;
... | ALGO | 0.986915 | 3.522456 |
d6b71958-b509-499c-97c9-040c6f757f9d | SatvikaCh21/C-and-DS | loop 1.cpp | #include<stdio.h>
int main (){
int a,i,range;
printf("enter a number and enter range");
scanf("%d %d",&a,&range);
i=1;
while(i<=range)
{
printf("\a%d X %d=%d:\n",a,i,a*i);
i++;
}
return 0;
}
| ALGO | 0.996446 | 3.018516 |
1246514c-0e80-4869-b58b-eecaba5603b7 | ishandutta2007/codeforces | stevenkplus/normal/358/B.cpp | #include <cstdio>
const int MAXN = 300100;
char A[MAXN];
char B[MAXN];
int N;
void pt(char **ptr) {
**ptr = '<';
++*ptr;
**ptr = '3';
++*ptr;
}
int main() {
scanf("%d", &N);
char *ptr = A;
pt(&ptr);
for(int i = 0; i < N; ++i) {
scanf("%s", ptr);
while (*ptr) ++ptr;
pt(&ptr);
}
scanf... | ALGO | 0.999927 | 4.079418 |
5d3552a5-0f30-4eb8-a0e0-0dd3efec041e | heppyn/VoxelGame | VoxelGame/src/engine/L-systems/RandomGrammar.cpp | #include "RandomGrammar.h"
#include <sstream>
LSystems::Detail::RandomGrammar::RandomGrammar(std::string axiom, std::map<char, std::vector<std::string>>&& productions)
: Axiom_(std::move(axiom)), Productions_(productions) {}
std::string LSystems::Detail::RandomGrammar::Derivate(int numDerivation, unsigned salt) co... | ALGO | 0.935791 | 6.293798 |
dbb073d2-b1d6-4edd-bffa-59442c0be087 | Kavin-Java-Developer/RestAPI_with_http-and-builder | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998733 | 6.76775 |
b22f7b89-01d2-428c-995a-b521e53fd79b | ishandutta2007/codeforces | qingyu/normal/1381/A2.cpp | #include <bits/stdc++.h>
const int N = 1e5 + 50;
int n, m;
inline char nc()
{
static char buf[1000000], *p1 = buf, *p2 = buf;
return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1000000, stdin), p1 == p2) ? EOF : *p1++;
}
inline int read()
{
int res = 0, neg = 1; char ch;
do
{
ch = nc();
if (ch == '-') ne... | ALGO | 0.999992 | 4.028467 |
f3bc8db8-3f7e-4e22-887c-dbc928f4da6f | Arman20021/Hacker-Rank | Replace_Word.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin >> t;
while (t--)
{
string a, b;
cin >> a >> b;
while (1)
{ int z = a.find(b);
if (z != -1)
{
a.erase(z, b.size());
a.insert(a.begin() +... | ALGO | 0.999891 | 3.96975 |
bf814621-3d91-45e2-b268-29cab36150a4 | ryan-shen/uva-online-judge | UVa591 - Box of Bricks/UVa591 - Box of Bricks/main.cpp | #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <cstring>
using namespace std;
int main(int argc, const char * argv[]) {
int n, test = 1;
while(scanf("%d", &n) != EOF && n != 0){
int arr[n], avg = 0;
for(int i=0; i<n; i++){
scan... | ALGO | 0.999219 | 3.17995 |
b312d86e-6365-4729-a6f2-36abb3a3dedf | Perceptronica/na-labs | triagonal.cpp | #include "matrix.h"
#include <nlohmann/json.hpp>
using namespace std;
using json = nlohmann::json;
std::vector<long double> createDiags(const Matrix &M, std::size_t x,
std::size_t y, std::size_t n) {
std::vector<long double> diag(n);
for (std::size_t i = 0; i < n; ++i) {
d... | ALGO | 0.998993 | 6.153779 |
3f8ec9ac-b752-4591-af6c-d5c5d1acaf41 | strengthen/LeetCode | C++/666.cpp | __________________________________________________________________________________________________
class Solution {
public:
int pathSum(vector<int>& nums) {
if (nums.empty()) return 0;
int res = 0;
unordered_map<int, int> m;
for (int num : nums) {
m[num / 10] = num % 10;
... | ALGO | 0.999929 | 6.715126 |
4dc48788-a835-4c90-bb5c-d056185cfdda | serglockhart/nd-fa19-fundcomp-cpp | music_note_freq.cpp | #include <iostream>
#include <math.h>
using namespace std;
int main() {
double fZero;
double r;
double fN;
double frac;
cin >> fZero;
frac = (double)1/12;
r = pow(2.0, frac);
for (int n = 0; n < 5; n++)
{
fN = fZero * pow(r, n);
printf("%.2f", fN);
if (n... | ALGO | 0.999612 | 3.083916 |
e3d6df31-cccc-4099-84fc-2936f9418299 | Baplisca/LeetCode-Submission | 49-group-anagrams/49-group-anagrams.cpp | class Solution
{
public:
vector<vector<string>> groupAnagrams(vector<string> &strs)
{
map<string, vector<string>> mp;
for (int i = 0; i < strs.size(); i++)
{
string str = strs[i];
sort(str.begin(), str.end());
mp[str].push_back(strs[i]);
}
... | ALGO | 0.999998 | 6.336804 |
d58ba097-d98b-46b1-a749-1e45eba174a7 | pathakshrikant26/C- | Hackerearth/basic Programming/recursivefunction.cpp | #include <bits/stdc++.h>
using namespace std;
int recursive(int x, int y)
{
if (x == 0)
{
// y = y + 1;
return (y + 1) % 1000;
}
if (x > 0 && y == 0)
{
return recursive(x - 1, 1) % 1000;
}
if (x > 0 && y > 0)
{
return recursive(x - 1, recursive(x, y - 1));... | ALGO | 0.999938 | 4.610931 |
3c978824-feef-4007-bf69-fb9e454cd71a | RMGDFT/rmgdft | NEGF/Common/writeout_matrix_p.cpp | #include "negf_prototypes.h"
/************************** SVN Revision Information **************************
** $Id$ **
******************************************************************************/
#include <float.h>
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
#include "main.... | TOOL | 0.989805 | 3.606055 |
d25d01fe-b762-4d13-b9d8-bbe91e3fb511 | jiturajsharma/C_plush_plush_In_Class | Loops/Loops1/WhileLoop/while.cpp | #include<iostream>
using namespace std;
int main(){
// int i = 1;
// for(;i<=10;){
// cout<<i<<endl;
// i++;
// }
int i =1;
while(i<=10){
cout<<i<<endl;
i++; // if we switch up then one extra print
}
} | TOOL | 0.973876 | 3.063042 |
c8319292-5407-4e8d-bebb-777f685b794d | mizuirorivi/kyopuro | ABC047proB.cpp | #include<bits/stdc++.h>
using namespace std;
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define SZ(x) ((int)(x).size())
#define debug(x) cerr << #x << ": " << x << '\n'
#define INF 999999999
typedef long long int Int;
typedef pair<int,int> P;
using ll... | ALGO | 0.999716 | 3.942436 |
d98992e9-585e-422f-97d4-7b507112e565 | ysxGitHub/Cplusplus | DataStructure/贪心算法/摆动序列.cpp | /*
如果连续数字之间的差严格地在正数和负数之间交替,则数字序列称为 摆动序列 。第一个差(如果存在的话)可能是正数或负数。仅有一个元素或者含两个不等元素的序列也视作摆动序列。
例如, [1, 7, 4, 9, 2, 5] 是一个 摆动序列 ,因为差值 (6, -3, 5, -7, 3) 是正负交替出现的。
相反,[1, 4, 7, 2, 5] 和 [1, 7, 4, 5, 5] 不是摆动序列,第一个序列是因为它的前两个差值都是正数,第二个序列是因为它的最后一个差值为零。
子序列 可以通过从原始序列中删除一些(也可以不删除)元素来获得,剩下的元素保持其原始顺序。
给你一个整数数组 nums ,返回 nums 中作为 摆动序列 ... | ALGO | 0.999997 | 5.801504 |
27f15daf-dac6-491a-8f68-28993a2533b3 | gfandrade10/Generic-Code | MajorityVote.cpp | #include <iostream>
#include <vector>
typedef struct{
char letter;
int count = 0;
}Map;
std::vector<Map> LetterPool(std::vector<std::string> input){
Map buffer;
std::vector<Map> Pool;
bool flag;
for(int i=0; i<(int)input.size(); i++){
flag = true;
for(int j=0; j<(int)Pool.size(... | ALGO | 0.999757 | 5.296477 |
867b37c0-dfdc-4233-8d6c-ab0d4c00b1f6 | Vishal-raj-1/Language-Proficiency-In-CPP | Conditional_statements.cpp | #include<iostream>
using namespace std;
int main()
{
int n;
cin >> n;
if(n == 1)
cout << "one";
else if(n == 2)
cout << "two";
else if(n == 3)
cout << "three";
else if(n == 4)
cout << "four";
else if(n == 5)
cout << "five";
else if(n == 6)
... | ALGO | 0.983385 | 3.663162 |
8d030930-dd06-4aee-80c1-04588dca677b | ishandutta2007/codeforces | ce_wa_tle/normal/1148/E.cpp | #include<bits/stdc++.h>
#define rep(i,l,r) rfor(ll i=l;i<=r;i++)
#define per(i,l,r) rfor(ll i=l;i>=r;i--)
#define ref(i,l,r) rfor(ll i=l;i<r;i++)
#define rfor(x...) for(register x)
#define IO(x...) freopen(#x".in","r",stdin),freopen(#x".out","w",stdout)
typedef long long ll;const ll N=1.5e6+7,mod=1e9+7,mod2=mod*mod,inf... | ALGO | 0.99999 | 3.107529 |
08a250d4-df3a-4128-94d0-878eee2ff573 | ssatwik975/leetcode-solutions | solutions/2067-maximum-number-of-points-with-cost/solution.cpp | class Solution {
public:
long long maxPoints(vector<vector<int>>& P) {
long long m = P.size(), n = P[0].size();
vector<long long> pre(n);
for (int i = 0; i < n; ++i) pre[i] = P[0][i];
for (int i = 0; i < m - 1; ++i){
vector<long long> lft(n, 0), rgt(n, 0), cur(n, 0);
... | ALGO | 0.999967 | 5.164106 |
ba39d4da-e8aa-4151-90e3-16d73797dc3b | itsnotTalha/CPP | MergeSort.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int a[] = {1, 3, 5, 7, 9}, b[] = {2, 4, 6, 8};
vector<int> ans;
int i = 0, j = 0;
// Merge two sorted arrays
while (i < 5 && j < 4) {
if (a[i] < b[j]) {
ans.push_back(a[i++]);
} else {
ans.push_back(... | ALGO | 0.999964 | 4.277235 |
452677d6-15c8-468f-8f6d-3716983e358e | Trodek/CutScene-Manager-Research | Motor2D/Box2D/Box2D/Collision/b2BroadPhase.cpp | #include <Box2D/Collision/b2BroadPhase.h>
b2BroadPhase::b2BroadPhase()
{
m_proxyCount = 0;
m_pairCapacity = 16;
m_pairCount = 0;
m_pairBuffer = (b2Pair*)b2Alloc(m_pairCapacity * sizeof(b2Pair));
m_moveCapacity = 16;
m_moveCount = 0;
m_moveBuffer = (int32*)b2Alloc(m_moveCapacity * sizeof(int32));
}
b2BroadPha... | TOOL | 0.916804 | 6.892823 |
68d96bdd-84a3-4336-a9c9-dcfb2ebbcc77 | st115592/2023-cpp-autumn | 2024.03.29-homework-8/task3/main.cpp | #include<iostream>
struct SEdge {
int a;
int b;
int w;
SEdge(int a = 0, int b = 0, int w = 1) : a(a), b(b), w(w) {}
SEdge(const SEdge& src) : a(src.a), b(src.b), w(src.w) {}
~SEdge() {}
void set(int a, int b, int w)
{
this->a = a;
this->b = b;
this->w = w;
}
friend std::ostream& operator<<(std::ostream... | ALGO | 0.99931 | 4.173767 |
62662951-cda6-43b3-9701-4e299a7fe253 | ishandutta2007/codeforces | krijgertje/normal/294/A.cpp | #include <algorithm>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <list>
#include <climits>
#include <cassert>
#include <ctime>
#include... | ALGO | 0.999915 | 3.654739 |
78c4a689-b608-4fdd-90d4-9e5b6929638f | Sakshi-Sutar/cpp | radix.cpp | #include<bits/stdc++.h>
using namespace std;
void count(int arr[], int n, int radix)
{
int count[10]={};
for(int i=0; i<n; i++)
count[(arr[i]/radix)%10]++;
for(int i=1; i<10; i++)
count[i]=count[i]+count[i-1];
int b[n]={};
for(int i=n-1; i>=0; i--)
b[--count[(arr[i]/radix)%10]]=arr[i];
for(int i=0; i<n... | ALGO | 0.999947 | 4.800207 |
34315ff0-d8e9-4083-baa7-96fca58b805e | kong430/PS | BOJ/1931.cpp | #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
/*ȸ ð ª ߴٰ Ʋ.
ð , ٸ ð */
bool compare(pair<int, int> a, pair<int, int> b)
{
if(a.second<b.second) return true;
else if(a.second>b.second) return false;
if(a.first<b.first) return true;
else return false;
}
int main(v... | ALGO | 0.999967 | 4.520432 |
ecb2905e-fa4f-480a-868a-18eccf4bb2b6 | atinm/scidb | engines/stockfish/movegen.cpp | #include <cassert>
#include "movegen.h"
#include "position.h"
namespace {
template<CastlingRight Cr, bool Checks, bool Chess960>
ExtMove* generate_castling(const Position& pos, ExtMove* moveList, Color us, const CheckInfo* ci) {
static const bool KingSide = (Cr == WHITE_OO || Cr == BLACK_OO);
if (pos.c... | ALGO | 0.959217 | 7.008488 |
be4888a3-c5d9-4a5b-ada3-ffb352ed122b | mitchellnouhan/leetCode | Streams/productOfLastKNumbersBruteForce.cpp | class ProductOfNumbers {
public:
vector<int> stream;
ProductOfNumbers() {
}
void add(int num) {
stream.push_back(num);
}
int getProduct(int k) {
int res = 1;
int end = stream.size() - 1;
for(int i = 0; i < k; i++){
res *= stream[end - i];
... | ALGO | 0.999958 | 5.877551 |
32d42a24-d4af-4c4d-93a6-11986dbca786 | subhajitm/c-cpp-projects | pass_pointer_by_ref.cpp | #include<iostream>
using namespace std;
void func(int* &p);
int main() {
int a = 2;
int *pt;
pt = &a;
cout << "before func call "<< *pt << endl;
cout << "address pf pt before call "<<pt<<endl;
func(pt);
cout << "address of pt after call "<<pt<<endl;
cout << "After func call "<<*pt;
return 0;
}
v... | TOOL | 0.979228 | 3.886994 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.