uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
ed5c55fd-6d8e-42ed-b9d7-261a13e68ff4 | marlonwc3/cp-codes | Uva/Uva11340==Newspaper.cpp | #include <bits/stdc++.h>
#define _ printf("\n");
#define sc1(a) scanf("%d", &a)
#define sc2(a,b) scanf("%d %d", &a, &b)
#define sc3(a,b,c) scanf("%d %d %d", &a, &b, &c)
#define sc4(a,b,c, d) scanf("%d %d %d %d", &a, &b, &c, &d)
#define iz(b) if(b==0) { break; }
#define pb(a) push_back(a)
#define inf 0x3f3f3f3f
#define ... | ALGO | 0.978909 | 3.464117 |
94eb2d26-b981-4cdc-82d7-6d61f4a9b606 | rustem24liu/Programming-Principles--1 | map/upsA.CPP | #include <iostream>
using namespace std;
bool dad(string s){
int cnt = 0;
for(int i = 0; i< s.size(); i++){
if(s[i]>=48 && s[i]<=57){
return false;
}
}
return true;
}
int main(){
string s;
getline(cin, s);
string w;
for(int i = 0; i< s.size()+1; ++i){
if(s[i] != ' ' && i != s.size()){
w += s[i];
}... | ALGO | 0.999569 | 3.691147 |
86742d31-3398-465f-90f2-b36998814794 | SSB2000/Data-structures-and-Algorithms | 08042021/undirected-path.cpp | // Write a function, undirectedPath, that takes in an array of edges for an undirected graph and two nodes (nodeA, nodeB). The function should return a boolean indicating whether or not there exists a path between nodeA and nodeB.
#include <iostream>
#include <vector>
#include <map>
#include <utility>
#include <queue>... | ALGO | 0.999935 | 5.870951 |
845bc2ba-e432-4d30-8fcc-fb896a67298f | gursangat22/git-test | letusc++/STL HR set.cpp | #include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <set>
#include <algorithm>
using namespace std;
int main() {
/* Enter your code here. Read input from STDIN. Print output to STDOUT */
set<int>s;
int n,y,x;
cin>>n;
for(int i=0;i<n;i++)
{
cin>>x;
... | ALGO | 0.999872 | 3.815666 |
dca3470d-a354-460b-8b51-f4eb97bbfc04 | AdarshPatil04/DSA-Notes | Binary Tree/heightOfTree.cpp | /**
* Time Complexity: O(n)
* Space Complexity: O(n)
* @file heightOfTree.cpp
* @brief This file contains the implementation of a solution to find the height of a binary tree.
*
* The height of a binary tree is defined as the maximum number of edges in any path from the root node to a leaf node.
* This code defi... | ALGO | 0.999996 | 7.498203 |
8c4eda64-f741-46f6-b8e4-e7534aca4b30 | ar-0911/DSA | Data_Structures/postfixEval.cpp | #include<iostream>
#include<string>
using namespace std;
class Stack{
int top;
int arr[10];
public:
Stack(){
top=-1;
for(int i=0;i<10;i++){
arr[i]=0;
}
}
bool isEmpty(){
if(top==-1){
return true;
}
else{
return false;
}
}
bool isFull(){
if(top==9){
return tr... | ALGO | 0.999836 | 4.678118 |
56c95922-d6c4-4fb5-82be-e41c4e137dda | silverwhere/Self-Driving-Car-Nanodegree---Udacity | Project 7 - Highway Driving Path Planning/src/Eigen-3.3/doc/examples/class_CwiseUnaryOp.cpp | #include <Eigen/Core>
#include <iostream>
using namespace Eigen;
using namespace std;
// define a custom template unary functor
template<typename Scalar>
struct CwiseClampOp {
CwiseClampOp(const Scalar& inf, const Scalar& sup) : m_inf(inf), m_sup(sup) {}
const Scalar operator()(const Scalar& x) const { return x<m_... | ALGO | 0.912541 | 6.417363 |
22f8dfea-34f1-4e93-a403-7c9a0170faa0 | CassianoSF/topdown_shooter | trabalhos/jogo.cpp | #include <GL/glut.h>
#include <stdio.h>
#include <iostream>
#include <stdlib.h>
#include <string>
#include <math.h>
using namespace std;
class Coordenada{
public:
float x, y;
};
class Cor{
public:
float r, g, b;
Cor(): r(0.0f), g(0.0f), b(0.0f){ }
Cor(float red ,float green ,float blue): r(red), g... | ALGO | 0.917373 | 4.478551 |
895e6d9f-c1b1-4b42-9742-aed32d096658 | vidit1999/coding_problems | devdc51.cpp | #include <bits/stdc++.h>
using namespace std;
/*
Write a function areCurlyBracesMatched that takes in a
string s containing only { and/or } and returns true if s is properly matched, and false otherwise.
A string s is considered properly matched if the string is empty
or if every open brace has a corresponding close ... | ALGO | 0.994047 | 6.364248 |
7c95e59a-8f9c-4dcb-8f82-1e0772a25003 | FoxelSA/feature-suite | src/feature-match-sieve/src/feature-match-sieve.cpp | /*
Source - Includes
*/
# include "feature-match-sieve.hpp"
/*
Source - Entry point
*/
int main ( int argc, char ** argv ) {
/* Path variables */
char * fsMatchfile( NULL );
char * fsSievefile( NULL );
/* Reading variables */
int fsCount ( 0 );
/*... | ALGO | 0.941851 | 5.770569 |
7f6aa2ed-8fbf-4c29-91b9-1293dbb332e0 | SarbajitPbappy/CF-1100-1199 | 1156A-InscribedFigures.cpp | #include <cstdio>
int main(){
long n; scanf("%ld", &n);
long cnt(0);
long prev(-1), pprev(-1);
for(long p = 0; p < n; p++){
long a; scanf("%ld", &a);
if((a == prev) || (a == 2 && prev == 3) || (a == 3 && prev == 2)){cnt = -1; break;}
if((a == 1 && prev == 2) || (a == 2 && prev ... | ALGO | 0.999756 | 3.678255 |
98789406-71f4-454d-9976-ab69a56981bc | nerdcubed2002/leetcode | 0056-merge-intervals/0056-merge-intervals.cpp | class Solution {
public:
vector<vector<int>> merge(vector<vector<int>>& intervals) {
int n=intervals.size(),j=0;
sort(intervals.begin(),intervals.end());
vector<vector<int>>ret={intervals[0]};
for(int i=1;i<n;i++)
{
if(intervals[i][0]<=ret[j][1])
{
... | ALGO | 0.999999 | 6.052192 |
a6ebb347-1b20-4f11-84db-28c1c18e7da8 | dycha0430/Algorithm_Problem_Solving_Strategies | Dragon.cpp | #include <iostream>
#include <string>
#include <algorithm>
using namespace std;
char dragon_curve(int gen, int k, string str);
int n, p, l;
int main() {
int C;
cin >> C;
for (int test_case = 0; test_case < C; ++test_case) {
cin >> n >> p >> l;
for (int i = p; i < p + l; ++i) {
cout << dragon_curve(min(n,... | ALGO | 0.999728 | 3.921692 |
8889acc2-7829-496c-91e6-dfee5a94181f | wz2002zw/ROS_ROBOT | src/moveit_task_constructor/core/src/stages/compute_ik.cpp | /* Authors: Robert Haschke, Michael Goerner */
#include <moveit/task_constructor/stages/compute_ik.h>
#include <moveit/task_constructor/storage.h>
#include <moveit/task_constructor/marker_tools.h>
#include <moveit/task_constructor/fmt_p.h>
#include <moveit/planning_scene/planning_scene.h>
#include <moveit/robot_state... | TOOL | 0.992793 | 7.498549 |
50026f32-f04e-4dc8-86bd-64a23278177c | LITZLERTOTO/LITZLERTOTO | Engine/Source/ThirdParty/IntelEmbree/Embree270/src/tests/benchmark.cpp | #include "../include/embree2/rtcore.h"
#include "../include/embree2/rtcore_ray.h"
#include "../kernels/common/default.h"
#include "../kernels/algorithms/parallel_for.h"
#include <vector>
#if !defined(_MM_SET_DENORMALS_ZERO_MODE)
#define _MM_DENORMALS_ZERO_ON (0x0040)
#define _MM_DENORMALS_ZERO_OFF (0x0000)
#define ... | TEST | 0.961447 | 5.497934 |
1cadb06a-8f2d-4676-bec8-15d3b827ae03 | sonnh173341/TTUDSS | Train3/TAXI.cpp | #include<bits/stdc++.h>
#define Max 30
using namespace std;
int c[Max][Max];
int k, n;
int c_min = 1e6;
int min_cost = 1e6;
int cost = 0;
bool visited[Max];
void solution(int v){
int tmp = cost + c[v+n][0];
min_cost = min(tmp, min_cost);
}
void Try(int k, int pre_pos){ // tu vi tri pre_pos toi v
for(int v... | ALGO | 0.999835 | 3.503622 |
0c59eb95-952a-4b19-a550-3e86b53d2423 | BIT-zhaoyang/competitive_programming | uva00712.cpp | #include <bits/stdc++.h>
#define UNVISITED -1
#define POS_INF 1 << 25
#define NEG_INF -1 << 25
#define _ ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0), cout.precision(15);
using namespace std;
typedef long long int64;
typedef pair<int, int> ii;
int main(){ _
int depth, tc = 0;
while(cin >> depth, dept... | ALGO | 0.9994 | 3.209889 |
04061394-cc8f-4b4d-8577-81e7801e066c | mamun4122/My-Online-Judge-Submission | SPOJ/FACTCG2 - Medium Factorization.cpp | #include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorit... | ALGO | 0.999228 | 3.720159 |
e5a4ed4b-8ae9-4e7c-a5c6-59440defcce0 | DevleenaBanerjee/Stock_Prediction_ds | venv/Lib/site-packages/pystan/stan/lib/stan_math/lib/boost_1.69.0/libs/program_options/src/value_semantic.cpp | #define BOOST_PROGRAM_OPTIONS_SOURCE
#include <boost/program_options/config.hpp>
#include <boost/program_options/value_semantic.hpp>
#include <boost/program_options/detail/convert.hpp>
#include <boost/program_options/detail/cmdline.hpp>
#include <set>
#include <cctype>
namespace boost { namespace program_options {
... | TOOL | 0.989746 | 7.622782 |
dca8bb33-1a9a-4fa4-9ab9-342b770c2c72 | rare0b/training-atcoder | Contest/CodeQUEEN2023/C.cpp | #include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
using P = pair<int, int>;
//
int n, s, t;
void bfs(vector<vector<int>> &G, vector<int> &dis, int x) {
queue<int> q;
vector<bool> seen(n, false);
q.push(x);
seen[x] = true;
while (... | ALGO | 0.999902 | 4.855967 |
83a83ecd-bed5-4b24-8473-fd61dbe76d96 | akupiec/specttt | fft.cpp | #include "fft.h"
#include "ffft/FFTReal.h"
#include <cmath>
#include <iostream>
//using namespace FFT; // not working in windows
FFT::FFT::FFT(uint16 bufferSize, Window windowType) {
bufferFFT = bufferSize;
windowFFT = windowType;
}
void FFT::FFT::countFFT(double *array) {
ffft::FFTReal<double> fft (buff... | ALGO | 0.996758 | 4.981275 |
9a004b21-44e9-4448-a12d-2ad9620ef51f | Exalibur77/Data-Structure-and-Algorithm | Graph/NoOfIsland.cpp | //{ Driver Code Starts
#include <iostream>
#include <vector>
using namespace std;
// T.C - O(N*M) + O(N*M)[dfs]
// S.C - O(N*M)
// } Driver Code Ends
class Solution {
private:
void dfs(int row , int col , int n , int m , vector < vector<int>> &visited , vector<vector<char>>& grid){
// First... | ALGO | 0.99994 | 7.172605 |
057532ca-4885-46bb-8f42-f817309896ae | RaviKumar-Nemala/DATA-STRUCTURES | Trapping_Rain_Water.cpp | //{ Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution{
// Function to find the trapped water between the blocks.
vector < int >get_prefix ( int arr[] , int n )
{
int max_val = arr [ 0 ] ;
int i ;
vector < int > p... | ALGO | 0.999961 | 7.018933 |
5611f3f8-22b1-496f-8e77-1e4e51dbefe5 | GariFFon/C_plus_plus | C++/Basics/Area_of_Circle.cpp | //
// Area_of_Circle.cpp
// Basics
//
// Created by Gourav Dash on 29/07/24.
//
#include <stdio.h>
#include <iostream>
using namespace std;
int main7(){
int r;
float area;
cout<<"Enter Radius:"<<endl;
cin>>r;
area=3.1425f *r*r;
cout<<"Area is: "<<area<<endl;
return 0;
}
| ALGO | 0.990132 | 3.881821 |
f0c336bc-2730-43b7-ab45-2fd99fceddb4 | hsiuyee/CSES | Dynamic Programming/CSES Problem Set Projects.cpp | #include <algorithm>
// #include <bits/stdc++.h>
// #include <deque>
// #include <queue>
// #include <cmath>
#include <iostream>
// #include <stdio.h>
// #include <set>
// #include <map>
#include <vector>
using namespace std;
#define ll long long
#define fastio ios::sync_with_stdio(false), cin.tie(0);
#define pll pair<... | ALGO | 0.999905 | 4.477442 |
7753f546-73b8-498b-89e9-b9e88cbd78c8 | 202012092/Summer-Internship | Graph/Graph.cpp | #include <iostream>
#include <vector>
#include<map>
#include<list>
using namespace std;
class Graph
{
public:
int V;
map<int, bool> visited;
map<int, list<int>> adj;
list<int>* adj1;
Graph(int V);
void addEdge(int v, int w);
void DFS(int v);
void BFS(int s);
};
Graph::Graph(int V)
{
th... | ALGO | 0.999968 | 4.84613 |
b8e5c02f-d477-4baa-be09-ff65f30e6878 | kks227/BOJ | 10000/10093.cpp | #include <cstdio>
using namespace std;
int main(){
long long A, B;
scanf("%lld %lld", &A, &B);
if(A > B){
A += B;
B = A - B;
A = A - B;
}
printf("%d\n", A==B?0:B-A-1);
for(long long i=A+1; i<B; i++)
printf("%lld ", i);
return 0;
} | ALGO | 0.999983 | 3.163233 |
465665b5-88c1-4b6c-b4d9-a846913e747d | Cookiefan/ZigZag | Zigzag/September/Sep 02/BB.cpp | #include <bits/stdc++.h>
#define maxn 120000
using namespace std;
int f[maxn], g[maxn], h[maxn], p[maxn], phi[maxn];
int np[maxn];
vector<int> prime;
int n;
void get_prime(int n)
{
memset(np,0,sizeof(np));
phi[1]=1;
for (int i=2;i<=n;i++)
{
if (!np[i])
{
prime.push_back(i);
phi[i]=i-1;
}
for (int j=0... | ALGO | 0.999832 | 3.655989 |
01e08813-3bdf-44ac-940d-506e31a94766 | meilleur777/Competitive_Programming | BOJ/cpp/15681.cpp | #include <vector>
#include <string.h>
#include <iostream>
using namespace std;
int childNum[100002];
vector<int> edges[100002];
/*root Ʈ ϴ Ʈ ȯ*/
int solve(int root) {
int& ret = childNum[root];
if (ret != -1) return ret;
ret = 1;
for (int i : edges[root]) {
if (childNum[i] != -1) continue;
ret += solve(i)... | ALGO | 0.999927 | 4.163708 |
45fc9015-01d9-4dd9-9ae8-a45c32073d97 | leuneoe25/CK_Baekjoon_Algorithm | 1920 수 찾기/binarySearch.cpp | //#include <iostream>
//#include <vector>
//#include <algorithm>
//using namespace std;
//
//int binarySearch(vector<int> arr, int value, int low, int high)
//{
// if (low > high)
// return 0;
//
// int mid = (high + low) / 2;
//
// if (arr[mid] > value)
// return binarySearch(arr, value, low, mid - 1);
// else if (a... | ALGO | 0.999984 | 5.197224 |
6fca592b-4c36-496f-a678-8320296f7770 | rasel-33/problem-solving | UVa/11185 - Ternary.cpp | //Problem Link : https://onlinejudge.org/index.php?option=onlinejudge&Itemid=8&page=show_problem&problem=2126
#include<iostream>
#define ll long long
using namespace std;
int main(){
ll number;
while(cin>>number){
if(number < 0)
break;
if(number == 0)
cout<<0;
else{
int arr[100],cnt =0;
while... | ALGO | 0.999943 | 4.087381 |
0416c1d5-458d-4d01-b9c2-9566edaade25 | helaoutar/codeforces-solutions | Petr and a calendar/760A.cpp | //#pragma warning(disable : 4996)
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
int main()
{
ios::sync_with_stdio(false);
int m, d;
cin >> m >> d;
if (m == 1 || m == 3 || m == 5 || m == 7 || m == 8 || m == 10 || m == 12)
{
if (d >= 6)
cout <... | ALGO | 0.99986 | 3.773499 |
52e8d922-a193-4b90-99f0-3bd1fa9a4a8d | luciocf/CP-Problems | JOI/JOIOC/JOIOC 2018/bubble2.cpp | // JOI Open Contest 2018 - Bubble Sort 2
// Lúcio Cardoso
#include <bits/stdc++.h>
#include "bubblesort2.h"
using namespace std;
const int maxn = 1e6+10;
int n;
int num[maxn], soma[maxn];
int tree[4*maxn], lazy[4*maxn];
set<int> Pos[maxn];
void build(int node, int l, int r)
{
if (l == r)
{
tree[node] = -som... | ALGO | 0.99991 | 4.114337 |
d9a45283-a86f-4457-b67b-e4050824e318 | WayneWei228/Algorithm | AdventOfCode/2018/Solution/19_rewrite4.cpp | #include <cstdio>
using namespace std;
typedef long long int64;
const int64 a = 0;
int main() {
int64 e = 2 * 2 * 19 * 11 + 6 * 22 + 2;
if (a == 1) e += (27 * 28 + 29) * 30 * 14 * 32;
int64 answer = 0;
int64 d = 1;
while (d <= e) {
int64 f = 1;
while (f <= e) {
if (d *... | ALGO | 0.999524 | 3.857503 |
e3246077-5144-4ac7-9c22-071b416d6a47 | bankptrk/leetcode_exercise | 1574-maximum-product-of-two-elements-in-an-array/1574-maximum-product-of-two-elements-in-an-array.cpp | class Solution {
public:
int maxProduct(vector<int>& nums) {
int f_max = INT_MIN;
int s_max = INT_MIN;
for(auto num : nums){
if(num > f_max){
s_max = f_max;
f_max = num;
}else if(num > s_max) s_max = num;
}
return (f_max... | ALGO | 0.999948 | 5.557407 |
c67ba8d5-5a7e-4de0-b2f8-1f44a75eb20f | Shahid-Fahad/Online-Judge-Solution | Codeforces+Others/C_Basic_Diplomacy.cpp | ///Bismillahir Rahmanir Rahim
//ShzFahad
#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;
#define ll long long int
#define ld long double
#define pb push_back
#define ff first
#define ss second
#define case_(tc) cout <... | ALGO | 0.999981 | 3.771061 |
bd86967a-4297-4e31-875d-4f75a7a607fe | fsabrilb/Herramientas | Matrix.cpp | #include <iostream>
#include <stdlib.h>
#include <cmath>
#include <eigen3/Eigen/Dense>
#include <chrono>
/*------------------------------------------------CLASS MATRIX----------------------------------------------------------------*/
class Matrix{
private:
double *M; int N_rows,N_cols,N_rowsBlock,N_colsBlock;
public:... | ALGO | 0.999641 | 4.049217 |
8615dfb2-85b8-4097-98ab-03956f50c8e7 | Juandccc/Repositorio-de-Juan-Diego | LaboratorioBST.28-Ago.cpp | #include <iostream>
using namespace std;
struct Nodo {
int dato; //Dato a almacenar en el raiz
struct Nodo *left, *right;
};
struct Nodo *nuevoNodo(int dato) {
struct Nodo *temporal = new struct Nodo();
temporal->dato = dato;
temporal->left = temporal->right = NULL;
return temporal;
}
/*** Preorder ***/
void p... | ALGO | 0.999904 | 4.746606 |
4a9d5977-dea7-4a6b-ae20-152eb2882dbc | texmacs/mirror | src/src/Typeset/Page/new_breaker.cpp | #include "new_breaker.hpp"
/******************************************************************************
* Float placement subroutines
******************************************************************************/
bool
float_has (tree t, char c) {
if (N(t) < 2 || t[0] != "float") return false;
string s= as_str... | TOOL | 0.966277 | 3.983649 |
3df0081e-8471-46de-a1f3-f30cd7e52d03 | wolfcall/COMP371Final | ThirdParty/glm/test/core/core_func_integer_find_lsb.cpp | ///////////////////////////////////////////////////////////////////////////////////
/// OpenGL Mathematics (glm.g-truc.net)
///
/// Copyright (c) 2005 - 2015 G-Truc Creation (www.g-truc.net)
/// Permission is hereby granted, free of charge, to any person obtaining a copy
/// of this software and associated documentatio... | ALGO | 0.997348 | 5.151803 |
3646f8e6-c04d-4b21-b5f1-d41ef3b64a34 | Brando-code/Schroddy4KhonSham | initpot.cpp | //Class for initial potentials
#include <cmath>
#include <cstdlib>
#include "parameters.h"
#include "initpot.h"
InitialPot::~InitialPot() {}
InitialPot::InitialPot(double m, unsigned int l, double j): m_m(m), m_anglmomentum(l), m_spin(j) {};
/*===================================================================
* Woo... | ALGO | 0.97947 | 4.796437 |
6ebf84ef-c6b0-41ec-8c28-1b6ef501c0da | jitendrabhadoria1/competitiveprogramming | Advanced Graphs/edges_in_mst.cpp | // Edges in MST
// Send Feedback
// You are given a connected weighted undirected graph without any loops and multiple edges.
// Let us remind you that a graph's spanning tree is defined as an acyclic connected subgraph of the given graph that includes all of the graph's vertexes. The weight of a tree is defined as the... | ALGO | 0.999933 | 4.589237 |
7dd04624-8b67-4941-b25d-55d0973fd160 | KhalidUsman2024/Programming-Fundamentals-In-C-Plus-Plus | 4 Patterns/29 vertically flipped triangle of 123.cpp | #include<iostream>
using namespace std;
int main()
{
int n;
cout<<"Enter n :";
cin>>n;
for(int i=1; i<=n; i++)
{
for(int j=1; j<=n-i; j++)
{
cout<<" ";
}
for(int j=1; j<=i; j++)
{
cout<<j<<" ";
}
cout<<endl;
}
}
| ALGO | 0.999786 | 3.462552 |
243f0b75-bcf9-4c5b-b550-851d96129cb5 | Rajeshnds/Competitive-Programming | codeforces/dragonmas/contest/Finding_Shoes.cpp | #include<bits/stdc++.h>
using namespace std;
# define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
# define ll long long
const int N=2e5+5,mod=1e9+7;
ll _T;
ll n,m,x,y,k,a[N];
string s,t;
vector<ll>v;
set<ll>st;
map<ll,ll>mp;
pair<ll,ll>p[N];
void solve(){
cout<<n+max(0ll,n-m);
}
void read_file(){
f... | ALGO | 0.999152 | 4.054757 |
6fae9501-3108-4bf7-903b-b0cf1b3877fb | HariomJoshi/POTD | week6/7 February/pairWithSumLessThanTarget.cpp | //question -> https://leetcode.com/problems/count-pairs-whose-sum-is-less-than-target/description/
#include<bits/stdc++.h>
using namespace std;
// a simple O(n^2) solution would work here
class Solution {
public:
int countPairs(vector<int>& nums, int target) {
sort(nums.begin(), nums.end());
int... | ALGO | 0.999848 | 6.083341 |
8c4ca018-2232-4123-823e-3a4d8a539286 | Meir-Crombie/Beyond-code- | BTC-1-5-5785-TAL/q10.cpp | //#include <iostream>
//using namespace std;
//
//// Function to validate if a 9x9 Sudoku board is valid
//bool sudoku(int board[9][9]) {
// int row[9][10] = { 0 }, col[9][10] = { 0 }, box[9][10] = { 0 };
// for (int i = 0; i < 9; i++) {
// for (int j = 0; j < 9; j++) {
// int num = board[i][j];... | ALGO | 0.996639 | 7.528879 |
6cfa7cde-7251-4206-ac44-f4a8b644919a | finetglazer/finetglazer | DISLIKE OF THREES.cpp | #include<iostream>
using namespace std;
int div(int a)
{
if(a%10==3 || a%3==0) return 0;
else return 1;
}
int main()
{
int k;
cin>>k;
int j=1;
for(int i=1;i<=10000;i++)
{
if(div(i)){
if(j==k) cout<<i;
j++;
}
}
}
| ALGO | 0.999716 | 3.528492 |
efdacff7-254a-42a3-82be-785aae5d0fae | muniss950/leetCode | resultarr.cpp | #include <bits/stdc++.h>
#include <climits>
#include <filesystem>
#include <functional>
#include <queue>
#include <vector>
using namespace std;
class Solution {
public:
vector<int> resultsArray(vector<int> &nums, int k) {
int max;
vector<int> ans(nums.size() - k + 1, 0);
// vector<int>arr(nums.size(),0);
... | ALGO | 0.999898 | 4.226629 |
3b6bfcc1-0fc3-496f-b720-3d40bfe4a284 | souptikji/Competitive_Programming | Codechef/linecnt.cpp | #include<iostream>
#include<cstdio>
using namespace std;
main()
{
int c,cnt=0;
while((c=getchar())!=EOF){
if(c=='\n'){ cnt++; cout<<" CHECKED ";}
putchar(c);
}
cout<<endl;
... | ALGO | 0.996262 | 3.52375 |
ac0b206f-9fe7-4618-a175-52457d9a064c | ishandutta2007/codeforces | jeroenodb/normal/955/B.cpp | #include "bits/stdc++.h"
using namespace std;
#define all(x) begin(x),end(x)
template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; }
template<typename T_container, typename T = typename enable_if<!is_same<T_container, string>::va... | ALGO | 0.99999 | 3.719153 |
1ff98349-b307-4157-9a63-21422bfb9feb | MarcoZarate2/UC1_parte02_Zarate | Preg03.cpp | #include <iostream>
using namespace std;
int main (){
int cobro, horas;
cout << "Ingresa el valor de horas: ", cin >> horas;
cin.get();
cobro=0;
if(horas<=4)
cobro=6;
else{
cobro=6+(horas-4)*2;
}
cout << "Importe a pagar: " << cobro << endl;
return 0;
}
| ALGO | 0.949574 | 3.393936 |
147bd26d-4a7c-49ae-b229-f2e7a6479e47 | zongy17/Cage_AutoGen | include/igl/unproject_ray.cpp | template <
typename Derivedpos,
typename Derivedmodel,
typename Derivedproj,
typename Derivedviewport,
typename Deriveds,
typename Deriveddir>
IGL_INLINE void igl::unproject_ray(
const Eigen::MatrixBase<Derivedpos> & pos,
const Eigen::MatrixBase<Derivedmodel> & model,
const Eigen::MatrixBase<Derivedpr... | ALGO | 0.997293 | 6.13621 |
2f032308-c279-4cc9-9347-79ddb2472888 | inzamulsharafot2103006/Basic-Programming-Problems | Loops/lp9.cpp | #include<iostream>
#include<cmath>
using namespace std;
int main(){
int n;
cout<<"Enter Your Number : ";
cin>>n;
if(n==0){
cout<<"Generic Root is "<<n<<endl;
}
else{
int sum = 0,count = 0;
int a = n;
while(a!=0){
int r = a%10;
sum += r;
... | ALGO | 0.999363 | 3.538458 |
efd6e658-63e4-4197-872b-33b31148ea1d | openLB/openLB | examples/thermal/squareCavity2d/squareCavity2d.cpp | // natural convection of air in a square cavity in 2D
#include "olb2D.h"
#include "olb2D.hh" // use only generic version!
using namespace olb;
using namespace olb::descriptors;
using namespace olb::graphics;
using namespace std;
typedef double T;
// #define SMAGORINSKY
#ifdef SMAGORINSKY
#define NSDESCRIPTOR D... | ALGO | 0.999854 | 4.586944 |
1f6ae66b-9499-40a2-844d-377e1671dd10 | Kerrbty/tightvnc-2.8.23 | tightvnc-2.8.23/server-config-lib/ServerConfig.cpp | #include "ServerConfig.h"
#include "win-system/Environment.h"
#include "file-lib/File.h"
ServerConfig::ServerConfig()
: m_rfbPort(5900), m_httpPort(5800),
m_disconnectAction(DA_DO_NOTHING), m_logLevel(0), m_useControlAuth(false),
m_controlAuthAlwaysChecking(false),
m_acceptRfbConnections(true), m_useAuthentica... | TOOL | 0.910769 | 4.83836 |
6466f04f-f870-4672-9b86-2a28ac772da0 | vanshu778/programming | sprint_2/5_Diamond_pattern.cpp | //Write a program to create a diamond pattern with stars of a given size.
#include <iostream>
using namespace std;
void printDiamond(int size) {
// Upper part of the diamond
for (int i = 1; i <= size; i += 2) {
for (int j = 0; j < (size - i) / 2; j++) {
cout << " ";
}
for (... | ALGO | 0.977551 | 6.854846 |
f230b23e-be63-4b12-8cee-b7eb710faa19 | khusharth/DSA-practice | Coding-Ninja/Conditionals-and-Loops/checkCase.cpp | /*
Write a program that takes a character as input and prints either 1, 0 or -1 according to the following rules.
1, if the character is an uppercase alphabet (A - Z)
0, if the character is a lowercase alphabet (a - z)
-1, if the character is not an alphabet
Input format :
Single Character
Output format :
1 or 0 or ... | ALGO | 0.999302 | 4.141449 |
c94f916c-ba44-4b90-a6ca-bc257c5df1b0 | tokabe333/OkabeAtcoder | ABC_000to050/ABC_001/D-感雨時刻の整理.cpp | #include <algorithm>
#include <cmath>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
using namespace std;
const double PI = 3.141592653589793... | ALGO | 0.999585 | 4.002028 |
b33dc332-f211-4e09-b790-9823f49adec3 | Astha369/CPP_Problems | RADIX_SORT.cpp | /*
RADIX SORT ALGORITHM
PROBLEM DESCRIPTION:
Given an array arr[] of size N, use Radix Sort Algorithm to sort arr[] in ascending order.
Example 1:
Input :
N = 5
arr[] = {1, 9, 345, 2}
Output: 1 2 9 345
Example 2:
Input :
N = 10
arr[] = {10, 9, 8, 7, 6, 5, 4, 3, 2, 1}
Output: 1 2 3 4 5 ... | ALGO | 0.999872 | 6.630378 |
9ba04996-b398-4f4e-bb78-3d9763a3b0f4 | vikash2021/DSA-GeeksforGeeks | DP/CountWaysToNthStair(OrderMatters).cpp | #include<bits/stdc++.h>
using namespace std;
long long mod = 1000000007;
long long countWays(int);
int main()
{
int t;
cin >> t;
while(t--)
{
int m;
cin>>m;
cout<<countWays(m)<<endl; // Print the output from our pre computed array
}
return 0;
}
// function to count wa... | ALGO | 0.999944 | 5.092321 |
858b8e8c-9699-4fd4-b1ef-50d737bf0707 | RamamAgarwal/CP | UploadMoreRAM.cpp | #include <iostream>
using namespace std;
int main()
{
int t;
cin >> t;
while(t--)
{
int n,k;
cin >> n >> k;
cout << ((n-1)*k)+1 << endl;
}
return 0;
} | ALGO | 0.999804 | 3.660183 |
aef8d6cd-1d39-4af7-a518-f39a4d86f07e | Cpasjuste/boost | libs/geometry/doc/src/examples/arithmetic/dot_product.cpp | // Boost.Geometry
// QuickBook Example
//[dot_product
//` Calculate the dot product of two points
#include <iostream>
#include <boost/geometry.hpp>
#include <boost/geometry/arithmetic/dot_product.hpp>
#include <boost/geometry/geometries/adapted/boost_array.hpp>
namespace bg = boost::geometry; /*< Convenient namespa... | ALGO | 0.904368 | 5.822914 |
95ed75ef-190d-4796-aac3-d68d6f5bb6ef | girishetty/mytools | ArraysAndMatrix/MedianFilter/main.cpp | #include <vector>
// reverse the bits of a 32 bit integer.
uint32_t reverse(uint32_t num) {
uint32_t result = 0;
uint32_t mask = 0x01;
size_t count = 0;
while (num != 0) {
uint32_t bit = mask & num;
result = (result << 1) | bit;
num = num >> 1;
count++;
}
if (count != 32 && result !... | ALGO | 0.999338 | 6.377037 |
9328fb9e-5d9b-4861-adfc-92132ffed124 | sinian666/codes_41_16 | cpp_副本3/chapter_stack_and_queue/queue.cpp | /**
* File: queue.cpp
* Created Time: 2022-11-28
* Author: qualifier1024 (<EMAIL>)
*/
#include "../utils/common.hpp"
/* Driver Code */
int main() {
/* 初始化队列 */
queue<int> queue;
/* 元素入队 */
queue.push(1);
queue.push(3);
queue.push(2);
queue.push(5);
queue.push(4);
cout << "队列 q... | TOOL | 0.943959 | 5.111825 |
f36fb855-835a-435a-a7ca-247d8cdcda74 | ak47adarsh01/Leetcode-Solutions | 48-rotate-image/48-rotate-image.cpp | class Solution {
public:
void rotate(vector<vector<int>>& m) {
// first tranpose the matrix then rverse every row
int n = m.size();
for(int i=0; i<n; i++)
for(int j=0; j<i; j++)
swap(m[i][j], m[j][i]);
for(int i=0; i<n; i++)
... | ALGO | 0.999945 | 6.357836 |
03ad3a9a-1e90-4703-9c5a-7888f5763757 | ggs2ggs/bitcoin-vs2019 | src/wallet/MerkleTx.cpp | #include "MerkleTx.h"
#include <algorithm> // min/max
#include "validation.h"
#include "consensus/consensus.h"
const uint256 CMerkleTx::ABANDON_HASH(uint256S("0000000000000000000000000000000000000000000000000000000000000001"));
void CMerkleTx::SetMerkleBranch(const CBlockIndex* pindex, int posInBlock)
{
// Update... | ALGO | 0.992415 | 5.466004 |
fa7d704d-3489-42a6-8854-a7d9c1fa464f | 4R1FF1N/Infosec | C++/calculator.cpp | #include <iostream>
using namespace std;
int main() {
int first_number, second_number, sum;
cout << "Enter two integers bitch: ";
cin >> first_number >> second_number;
sum = first_number + second_number;
cout << first_number << " + " << second_number << " = " << sum;
return 0;
}
| TOOL | 0.996004 | 4.293029 |
b6f9f807-dd07-44af-bc98-cbed0c75e07e | yu1mu/algorithm-baekjoon | 0x03_array/1919.cpp | #include <iostream>
#include <string>
using namespace std;
int main(void){
ios::sync_with_stdio(0);
cin.tie(0);
string s1, s2;
cin >> s1 >> s2;
int arr1[26] = {};
int arr2[26] = {};
for (int i = 0; i < s1.size(); i++){
arr1[s1[i] - 'a']++;
}
for (int i = 0; i < s2.size(... | ALGO | 0.999913 | 3.811878 |
3959f505-b942-40ee-822b-aeb1f25ccc6d | yingling-group/lammps-mspin | src/EXTRA-PAIR/pair_cosine_squared.cpp | // clang-format off
/* ----------------------------------------------------------------------
Contributing authors: Eugen Rozic (University College London)
------------------------------------------------------------------------- */
#include "pair_cosine_squared.h"
#include "atom.h"
#include "comm.h"
#include "er... | ALGO | 0.970108 | 6.508756 |
59aad32f-6177-4a78-ba99-bdbde7d501cc | godcallsmegod/PE | PE13-1/PE13-1.cpp | #include <iostream>
#include "myAlg.h"
using namespace std;
/*
13ҵʹƽıεܳ
2024.12.14
*/
int main() {
double x[4], y[4];
//ıεĸ
cout << "밴˳ıεĸ(x,y)" << endl;
for (int i = 0; i < 4; i++) {
cout << "" << i + 1 << "";
cin >> x[i];
cin >> y[i];
};
//
myAlg::Quadrilateral Q(x, y);
cout << "ܳΪ" << Q.GetPerime... | ALGO | 0.997579 | 3.866648 |
45b653cd-5934-4e9e-8c40-4ba5ee1f4517 | barjinderpaul/Programming | University/cse 330/question 13 august.cpp | #include<iostream>
#include<vector>
#include<math.h>
using namespace std;
int main(){
vector<int> elements;
int k,m,mid=0,count=0;
cout<<"enter value of k and m";
cin>>k>>m;
for(int i=0;i<sqrt(m);i++){
if(k==m || k>m){
break;
}
for(int i=2;i<k;i++){
if(k%i==0){
elements.push_back(i);
}
}
i... | ALGO | 0.999958 | 3.770472 |
6cba5379-287f-4325-9d73-ce44578d9b59 | Abdob/opencv_contrib-4.5.2 | modules/rgbd/src/dynafu_tsdf.cpp | #include "precomp.hpp"
#include "dynafu_tsdf.hpp"
#include "marchingcubes.hpp"
namespace cv {
namespace dynafu {
using namespace kinfu;
// TODO: Optimization possible:
// * volumeType can be FP16
// * weight can be int16
typedef float volumeType;
struct Voxel
{
volumeType v;
float weight;
nodeNeighbours... | ALGO | 0.990737 | 7.445101 |
2939182a-bcc5-4041-b966-da0f2969612d | Huangyan0804/vjudge | CodeForces-1065A/CodeForces-1065A.cpp | #include <algorithm>
#include <iostream>
#include <string>
using namespace std;
int main()
{
int t;
cin >> t;
while (t--) {
int s, a, b, c;
cin >> s >> a >> b >> c;
long long ans = 0, num;
num = s / c;
long long free = num / a * b;
ans = num + free;
co... | ALGO | 0.999772 | 3.148436 |
bf60e62a-a25e-4a27-a22b-7b08f1389205 | ishandutta2007/codeforces | coderanshu/normal/1146/F.cpp | #include<bits/stdc++.h>
using namespace std ;
#define ll long long
#define pb push_back
#define all(v) v.begin(),v.end()
#define sz(a) (ll)a.size()
#define F first
#define S second
#define INF 2000000000000000000
#define popcount(x) ... | ALGO | 0.999645 | 3.867475 |
c7b5d624-ac45-4f8f-8d95-4272f3a77e52 | ValeriiKoniushenko/VaKon2D | dependencies/boost_1_80_0/libs/math/example/laplace_example.cpp | // laplace_example.cpp
// Example of using laplace (& comparing with normal) distribution.
// Note that this file contains Quickbook mark-up as well as code
// and comments, don't change any of the special comment mark-ups!
//[laplace_example1
/*`
First we need some includes to access the laplace & normal distributi... | TOOL | 0.972588 | 4.109363 |
b7d8effd-2745-46ab-8730-a236b9553448 | Soumithra-DNS/Problem_Solving | Codeforces/19740.cpp | #include <bits/stdc++.h>
using namespace std;
void solve()
{
int x, y; cin >> x >> y;
int ans = ( y + 1) / 2;
x = x - (ans * 7);
if(y & 1){
x -= 4;
}
if(x > 0){
ans += ( x / 15);
if(x % 15 != 0){
ans++;
}
}
cout << ans << "\n";
}
int main()
{... | ALGO | 0.999659 | 4.698343 |
b8b5c4a0-95e9-45fd-8b15-698f0dfa402f | koekvall/mmrr | src/convenience_funs.cpp | #include <RcppArmadillo.h>
// type = 1 means Normal, type = 2 Bernoulli, and type = 3 Poisson
// [[Rcpp::depends(RcppArmadillo)]]
arma::vec log1pexp(arma::vec x)
{
for(int ii = 0; ii < x.n_elem; ++ii){
if(x(ii) < 18){
x(ii) = std::log1p(std::exp(x(ii)));
} else{
x(ii) = x(ii) + std::exp(-x(ii));... | ALGO | 0.999838 | 6.925526 |
6d9cc34e-eec9-4cc1-aecc-aad716c00cc8 | namnguyen16082008/LUYENCODE | HIPHA.cpp | #include <bits/stdc++.h>
#define ll long long int
using namespace std;
ll n,a,ans=0;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin>>n;
for (ll i=1;i<=n;i++){
cin>>a;
ans+=(a==1)-(a==2);
}
cout<<abs(ans);
}
| ALGO | 0.999814 | 3.580933 |
154739a2-79c8-4971-a978-b4aac946f831 | ishandutta2007/codeforces | wlzhouzhuan/normal/1385/D.cpp | // Author: wlzhouzhuan
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define rint register int
#define rep(i, l, r) for (rint i = l; i <= r; i++)
#define per(i, l, r) for (rint i = l; i >= r; i--)
#define mset(s, _) me... | ALGO | 0.999973 | 4.372833 |
71e6e1b2-2b97-451d-8a1f-9d8a6a3ad3a0 | bilalrana8718/PDC-Project | src/Metis/metis.cpp | #include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <unordered_map>
#include <unordered_set>
#include <map>
#include <filesystem>
#include <chrono>
#include <iomanip>
#include <cstring>
using namespace std;
namespace fs = std::f... | TOOL | 0.986037 | 7.018815 |
5e223fda-34a6-4d3a-b2ec-91c131471aaf | gurjotsc/gcheema-cp | leetcode/easy/sqrt(x).cpp | class Solution {
public:
int mySqrt(int x) {
if (!x) return 0;
if(x == 1) return 1;
int lo = 0;
int hi = x;
int ans = 0;
// condition needs to be equal to because when you update lo, its possible that on the next iteration, hi decrease to mid - 1 which could be equal ... | ALGO | 0.999973 | 5.411393 |
636c5ad1-f59c-4551-9b35-921c18bd32d9 | ishandutta2007/codeforces | matthew99/normal/679/A.cpp | #include <bits/stdc++.h>
using namespace std;
#define REP(i, a, b) for (int i = (a), _end_ = (b); i < _end_; ++i)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define mp make_pair
#define x first
#define y second
#define pb push_back
#define SZ(x) (int((x).size()))
#define ALL(x) (x).begin(), (x).end()
template<t... | ALGO | 0.999687 | 3.697032 |
7960507b-0fc3-4ee6-b441-9255ab37834b | Xiarain/Rain_IMU | Eigen3/test/sparseLM.cpp | #include "main.h"
#include <Eigen/LevenbergMarquardt>
using namespace std;
using namespace Eigen;
template <typename Scalar>
struct sparseGaussianTest : SparseFunctor<Scalar, int>
{
typedef Matrix<Scalar,Dynamic,1> VectorType;
typedef SparseFunctor<Scalar,int> Base;
typedef typename Base::JacobianType JacobianT... | TEST | 0.981429 | 6.140821 |
dd88d5a3-0ad8-43f5-884c-e31ade37bf20 | zethuman/PP1 | Quiz/quiz2V3/i.cpp | #include <iostream>
#include <cmath>
using namespace std;
int main()
{
double a, b , c;
cin >> a >> b >> c;
if ( c == (sqrt(a*a + b*b)) || a == sqrt(c*c + b*b) || b == sqrt(a*a - c*c) || c == sqrt(b*b - a*a))
{
if (c != 0)
{
if (a != 0)
{
if (b != 0 )
{... | ALGO | 0.999986 | 3.951256 |
616018fe-3f66-43ab-81d1-9e781eb4e100 | raincross7/code-similarity | codes/train_code/problem223/problem223_243.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main(int argc, const char *argv[]) {
int n;
cin >> n;
vector<ll> va(n);
for (int i = 0; i < n; ++i) {
cin >> va[i];
}
auto c2 = [](ll n) -> ll { return n * (n - 1) / 2 + n; };
ll acc = 0, ans = 0;
int l, r;
l = r = 0;
... | ALGO | 0.999996 | 4.835297 |
5f03cbc1-4059-4383-8e96-ab5a41c222fc | baldvinj15/vika1 | verkefni/week1/services/computersservice.cpp | #include "services/computersservice.h"
#include "utilities/computerscomparator.h"
#include <algorithm>
using namespace std;
ComputersService::ComputersService()
{
}
vector<Computers> ComputersService::getAllComputers(string orderBy, bool orderAscending)
{
vector<Computers> computers = computersRepo.getAllCompu... | TOOL | 0.919424 | 5.382174 |
9f51a7d7-51a4-4972-85ae-8fa7662d89df | attitte/MRGSOLVE-R | inst/models/irm3.cpp | $PROB
# Model: `irm3`
- Indirect response model, type 3
- Stimulation of response production
- Two-compartment PK model
- Optional nonlinear clearance
- Source: `mrgsolve` internal library
- Date: `r Sys.Date()`
- Version: `r packageVersion("mrgsolve")`
$PARAM @annotated
CL : 1 : Clearanc... | ALGO | 0.999904 | 5.905808 |
c3d30dae-7fe1-456a-ad82-8c32e51b2ed9 | ishandutta2007/codeforces | hir180/normal/912/B.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int ... | ALGO | 0.999979 | 3.854083 |
183d3e03-1183-4a80-a5d5-9be85f921400 | Prakhar-FF13/Competitive-Programming | CodeForces/518B - Tanya and Postcard.cpp | #include<iostream>
#include<cstdio>
#include<string.h>
#include<climits>
#include<sstream>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<bitset>
#include<unordered_map>
#include<unordered_set>
#include<cmath>
#include<algorithm>
#include<numeric>
#include<functiona... | ALGO | 0.999906 | 3.734671 |
75c98ea5-7d86-4ae6-9063-9f7629dc873a | daotriet2005/VNOJ | icpc/krect.cpp | #include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> data;
typedef pair<int, pair<int, int> > pii;
#define forw(i,a,b) for (ll i=a;i<=b;i++)
#define forb(i,a,b) for (ll i=a;i>=b;i--)
#define fast {ios::sync_with_stdio(false); cin.tie(0); }
#define fi fir... | ALGO | 0.999735 | 3.729708 |
80790bb4-cd34-4d2b-b81f-d3447da8528a | JQBNguyen/ERDOS | find_a_trail.cpp | #include <vector>
#include <algorithm>
#include <fstream>
#include "cc_embedded_graph.h"
using namespace std;
void write_atrail_to_file(vector<Edge>& a_trail, int color, string shape, bool crossing_staples) {
// Output file name
string o = "";
string o1 = "";
if (color) {
o = "atrail_" + shap... | ALGO | 0.992966 | 4.128242 |
caf92197-e060-4e15-83e2-8a15fe965536 | raincross7/code-similarity | codes/train_code/problem202/problem202_376.cpp | #include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define VI vector<int>
#define MOD 1000000007
typedef long long int ll;
const ll INF=(ll)1e19;
//const int INF=(1<<30);
int main(){
int N;
cin ... | ALGO | 0.999887 | 3.876015 |
ef56e585-3883-42ec-b3d2-e2d7f4a0306b | ishandutta2007/codeforces | pllk/normal/575/F.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n, x;
ll a[5050];
ll b[5050];
ll dp[2][10101];
ll p[5050][2];
ll inf=1e16;
int main() {
cin >> n >> x;
set<ll> cset;
cset.insert(x);
for (int i = 0; i < n; i++) {
cin >> p[i][0] >> p[i][1];
cset.insert(p[i][0]);
cset.insert(p[i][1])... | ALGO | 0.999914 | 3.850021 |
7b658c54-0751-421a-a0fa-646eef2f5d40 | meherajmithun/problem-solving | codechef/More_Cookies.cpp | // IN THE NAME OF ALLAH
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
#define print(x) cout << x << '\n'
#define mod 1000000007
int dx[] = {0, 0, +1, -1};
int dy[] = {+1, -1, 0, 0};
// int dx[] = {+1, 0, -1, 0, +1, +1, -1, -1};
// int dy[] = {0, +1, 0, -1, +1, -1, +1, -1};
voi... | ALGO | 0.999988 | 4.088738 |
14cb9384-a94f-43f6-ad8b-5512dc8e1c18 | yash2411-cmd/placement_prep | stacks/questions/twostacks.cpp | // codestudio -> two stacks problem, basically design a data structure, which represents two stacks and only one array.
#include <bits/stdc++.h>
class TwoStack {
int *arr;
int top1;
int top2;
int size;
public:
// Initialize TwoStack.
TwoStack(int s) {
this->size= s;
top1= -1;
... | ALGO | 0.999443 | 4.929866 |
14d32ca5-d07c-453a-a960-f223c5ee11e1 | Avinash0308/GFGProblemOfTheDaySolution_2023 | FEB 16 2023 -- Good Stones Solution.cpp | class Solution{
public:
int stoneTraversal(vector<int>& arr, int idx, int n, vector<bool>& vis, vector<int>& dp){
if(idx >= n || idx<0) return 1;
if(dp[idx]!=-1) return dp[idx];
if(vis[idx]) return 0;
vis[idx] = 1;
return dp[idx] = stoneTraversal(arr, idx + arr[idx], n... | ALGO | 0.999981 | 5.092226 |
6472cbd3-19d6-4882-8066-49f134c7542f | William-King-Xeon/CampTraining | Day5/Solution&Std/std/card.cpp | #include <cstdio>
#include <algorithm>
#define inf 1000000007
#define N 500055
int n,i,x,y,top[N*2],bot[N*2],ans,hf,lst,p;
struct T
{
int v, f;
};
T a[N*2];
bool cmpv(const T &a, const T &b)
{
return a.v < b.v;
}
bool cmpf(const T &a, const T &b)
{
return a.f < b.f;
}
int main()
{
freopen("card.in", "r", std... | ALGO | 0.999472 | 3.495368 |
0a3e58f7-5407-410c-8a35-a04779a168bd | ishandutta2007/codeforces | babanin_ivan/normal/316/G1.cpp | #include <iostream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <map>
#include <ctime>
#include <vector>
#include <string>
using namespace std;
#define pb push_back
#define mp make_pair
typedef long long int64;
typedef long double ld;
const ld eps =... | ALGO | 0.999926 | 3.564001 |
9bbd4261-6bd3-4564-9197-e48cc4e7ae7d | abhilashgupta/course_projects | DSA_project/TeachMeCS213/bstdialog.cpp | #include "bstdialog.h"
#include "ui_bstdialog.h"
BSTDialog::BSTDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::BSTDialog)
{
ui->setupUi(this);
}
void BSTDialog:: paintEvent(QPaintEvent*)
{
update(); //erase everything and redraws
print(b.root());
}
void BSTDialog:: print(TreeNo... | TOOL | 0.9277 | 4.697295 |
3b0f86c8-aeb0-4084-bc1c-ae868de5d2bc | antonionicampos/MPC-Project | src/Eigen-3.3/doc/examples/TutorialLinAlgInverseDeterminant.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main()
{
Matrix3f A;
A << 1, 2, 1,
2, 1, 0,
-1, 1, 2;
cout << "Here is the matrix A:\n" << A << endl;
cout << "The determinant of A is " << A.determinant() << endl;
cout << "The inverse of A is:\n... | ALGO | 0.99943 | 4.186114 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.