uuid stringlengths 36 36 | repo_name stringlengths 5 123 | relative_path stringlengths 5 4k | content stringlengths 33 2.85M | category stringclasses 6
values | algo_rel_score float64 0.85 1 | quality_score float64 3 8.76 |
|---|---|---|---|---|---|---|
fb7c009c-5dde-4268-bfb0-0fe174109271 | Anamika0802/data-structures | questions/tree/bst.cpp | #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(int x, TreeNode *left, TreeNode *right) : val(x), left(left), r... | ALGO | 0.999979 | 4.283927 |
004240bb-d672-4346-b6de-b4eb0930f772 | Dipankar-Kumar-Singh/Codeforces | testing_max_range_apply_seg.cpp | #include<bits/stdc++.h>
using namespace std ;
class segmentTreeMAAXX
{
private:
int N = 1e6 + 10;
std::vector<int> seg , lazy , v ;
int mergeOP(int &a, int &b) {
return std::max(a,b) ;
}
public:
segmentTreeMAAXX(int n)
{
N = n;
v = std::vector<int>(n);
... | ALGO | 0.999847 | 4.009187 |
f8608ab0-d183-4bce-9fab-22fb4d520cf1 | openharmony-gitee-mirror/third_party_boost | libs/msm/doc/HTML/examples/Visitor.cpp | #include <iostream>
#include <string>
#include "boost/mpl/vector/vector30.hpp"
#include <boost/msm/back/state_machine.hpp>
#include <boost/msm/front/state_machine_def.hpp>
#include <boost/msm/back/tools.hpp>
using namespace std;
namespace msm = boost::msm;
namespace mpl = boost::mpl;
namespace // Concrete FSM imple... | TOOL | 0.924771 | 5.558647 |
43fb828e-12ba-4736-8d87-1cfdb6006d73 | MoogleAndChocobo/ACM-Learning | SolvedProblems/HDU/2001.cpp | #include <stdio.h>
#include <math.h>
int main()
{
double x1, y1, x2, y2;
while(~scanf("%lf%lf%lf%lf", &x1, &y1, &x2, &y2))
{
double length = sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
printf("%.2lf\n", length);
}
} | ALGO | 0.99886 | 3.629931 |
cb86e9df-023e-4a48-90a0-35af0ff4448f | ishandutta2007/codeforces | lqs2015/normal/779/C.cpp | #include<iostream>
#include<algorithm>
#include<cstdio>
using namespace std;
int a[222222],b[222222],c[222222],n,sum,k;
int main()
{
scanf("%d%d",&n,&k);
for (int i=1;i<=n;i++) scanf("%d",&a[i]);
for (int i=1;i<=n;i++)
{
scanf("%d",&b[i]);
sum+=b[i];
c[i]=a[i]-b[i];
}
sort(c+1,c+n+1);
for (int i=1;i<=k;i++... | ALGO | 0.999961 | 3.083404 |
5aff7767-df2f-45d8-8f23-4c45de53d1d6 | lsa0828/classFilesStorage | c++/chap7/7-1.cpp | #include <iostream>
using namespace std;
class Rect;
bool equals(Rect r, Rect s);
class Rect {
int width, height;
public:
Rect(int width, int height) { this->width = width; this->height = height; }
friend bool equals(Rect r, Rect s);
};
bool equals(Rect r, Rect s) {
if (r.width == s.width && r.height == s.height... | ALGO | 0.995519 | 4.124455 |
7bc100a3-b302-40d8-bd6d-a9df0349453e | LeeHyungGeol/Algorithm_BaekJoon | 백준_if문/재귀_별 찍기 - 10.cpp | //
#include <iostream>
using namespace std;
void star(int n, int x, int y);
char arr[6562][6562];
int main() {
int N;
cin >> N;
for (int i = 1; i <= N; i++) {
for (int j = 0; j <= N; j++) {
arr[i][j] = ' ';
}
}
star(N, N, N);
for (int i = 1; i <= N; i++) {
for (int j = 1; j <= N; j++) {
cout << a... | ALGO | 0.999963 | 3.437254 |
44c45f6c-27e7-41be-9a86-d40d3c2b0ace | zijun-lin/CarND-MPC-Quizzes | mpc_to_line/src/Eigen-3.3/doc/examples/DenseBase_template_int_middleRows.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.middleRows<3>(1) << endl;
return 0;
}
| ALGO | 0.90713 | 3.230579 |
7c4ed533-44c2-4c3e-92d0-64c9aaa6e60a | GustavoPolicarpo/maratona | URI/PARADIGMS/2169 - Help Leonardo!.cpp | // Author: Gustavo Policarpo
// Name: Help Leonardo!
// Level: 9
// Category: PARADIGMS
// URL: https://www.beecrowd.com.br/judge/en/problems/view/2169
#include<bits/stdc++.h>
//LIFE IS NOT A PROBLEM TO BE SOLVED
using namespace std;
#define rep(i,a,b) for(int i = int(a); i < int(b) ; i++)
#define pb push_back
#def... | ALGO | 0.998847 | 4.13108 |
e5c6d47f-6adb-4c09-b488-ec8720398b99 | anisahu99/Pepcoding-Pratice-CPP | Pepcoding_Dynamic_Programming_Level_1/MinCostInMazeTraversal.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n=2,m=2;
int arr[n][m]={{3,1},{4,3}};
// for(int i=0;i<n;i++){
// cout<<endl;
// for(int j=0;j<m;j++){
// cout<<arr[i][j];
// }
// }
int dp[n][m];
for(int i=n-1;i>=0;i--){
for(... | ALGO | 0.999946 | 3.313624 |
6f9c66ca-4229-480e-8b8d-97d3d41442b2 | rafa95359/PROGRAMACION-COMPETITIVA | semana2/BoyOrGirl.cpp | #include <bits/stdc++.h>
typedef long long ll;
using namespace std;
int main(){
string palabra;
cin>>palabra;
int letras=1;
for(int i=1;i<palabra.size();i++){
int j=i-1;
bool encontrado=false;
while(!encontrado && j>=0){
if( palabra[i]==palabra[j])encontrado=tru... | ALGO | 0.999513 | 4.023485 |
e31de1d4-3ad7-4dc2-b849-8a2ffd4d4af8 | Blue-Bug/AlgorithmProblems | Baekjoon/전구를 켜라/src.cpp | #include <iostream>
#include <queue>
using namespace std;
int n, m;
char graph[501][501];
int dir[8][2] =
{ {1,1},{-1,1},{1,-1},{-1,-1},
{0,1},{1,0},{0,-1},{-1,0} };
struct node {
int row, col, rotate;
char curDir;
};
struct cmp {
bool operator()(node a, node b) {
return a.rotate > b.rotate;
}
};
int bfs() ... | ALGO | 0.999996 | 4.582282 |
5ecd5e52-32eb-4cce-9c6b-1453ba277b56 | Ashwin20102000/ProblemSolving | Algorithms/Sorting/BubbleSort.cpp | #include<iostream>
using namespace std;
int32_t main(){
int arr[]={3,9,62,8,6,8,32,5,39};
int size= sizeof(arr)/sizeof(arr[0]);
for(int i=0;i<size-1;i++){
for(int j=0;j<size-1-i;j++){
if(arr[j]>arr[j+1]){
arr[j]^=arr[j+1];
arr[j+1]^=arr[j];
arr[j]^=arr[j+1];
}
}
}
for(int i=0;i<size;i++){
c... | ALGO | 0.99999 | 3.31109 |
dda1bd2a-15e9-49ce-aba7-99f10acecb6e | almasluffy/Algorithm-and-data-structures | Projects/Week2/Examples/find.cpp | #include <iostream>
#include <algorithm>
using namespace std;
int main(){
int n;
cin>>n;
int a[n];
int x,head = 0, tail = n-1;
bool ok = false;
for(int i=0;i<n;i++)
{
cin>>a[i];
}
cin>>x;
while(head<=tail)
{
int mid = (head + tail)/2;
if(a[mid]<x)
{
head = mid + 1;
... | ALGO | 0.999996 | 4.177413 |
6be451ac-8c2e-4132-ab92-4930a367517e | iCoder0020/Competitive-Coding | Codeforces/Codeforces Round #524 (Div. 2)/B. Margarite and the best present.cpp | /*
ID: iCoder0020
PROG: Margarite and the best present
LANG: C++
*/
#include <iostream>
using namespace std;
long long int pos_sum(long long int a, long long int b)
{
return ((b-a+2)*(a+b))/4;
}
long long int neg_sum(long long int a, long long int b)
{
return ((b-a+2)*(a+b)*(-1))/4;
}
int main()... | ALGO | 0.99941 | 3.968706 |
a616e64c-4f5a-4065-9e09-927626dcc0bf | UiNiNex/stk-code | lib/bullet/src/BulletCollision/BroadphaseCollision/btQuantizedBvh.cpp | #include "btQuantizedBvh.h"
#include "LinearMath/btAabbUtil2.h"
#include "LinearMath/btIDebugDraw.h"
#include "LinearMath/btSerializer.h"
#define RAYAABB2
btQuantizedBvh::btQuantizedBvh() :
m_bulletVersion(BT_BULLET_VERSION),
m_useQuantization(false),
//m_traversalMode(TRAVERSAL_STACKLESS_CACHE_FRIE... | ALGO | 0.997657 | 7.07844 |
6cb55f0e-cccf-45f2-b1b7-6af0b4b01ee9 | BenoGustavo/learning_C | C_projects/Lista 2/Restaurante por quilo Bem-Bão.cpp | /*6. O restaurante a quilo Bem-Bo cobra R$12,00 por cada quilo de refeio. Escreva um
algoritmo que leia o peso do prato montado pelo cliente (em quilos) e imprima o valor a pagar.
Assume que a balana j desconte o peso do prato.*/
#include<conio.h>
#include<stdio.h>
#include<iostream>
#include<locale.h>
float ValorD... | TOOL | 0.960873 | 3.516742 |
aee1538a-a3e3-45a0-8402-9812fdda4334 | CYRUS-STUDIO/LLVM | llvm/utils/PerfectShuffle/PerfectShuffle.cpp | #include <cassert>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <vector>
#define GENERATE_NEON
#define GENERATE_NEON_INS
struct Operator;
// Masks are 4-nibble hex numbers. Values 0-7 in any nibble means that it takes
// an element from that value of the input vectors. A value of 8 means the
... | ALGO | 0.992154 | 4.522406 |
c55f71b0-f0a0-4b4d-be62-2aeb3426ec21 | bhavyawig/Competitive-Programming | String Shifting atcoder.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
int main()
{
string s;
cin>>s;
string cpy,s1,cpy1,te,te1;
lli a=s.length();
s1=s;
cpy=s;te=s;
cpy1=s;te1=s;
for(lli i=0;i<s.length()-1;i++)
{
s1+=s1[0];
s1.erase(s1.begin()+0);
if(s1<cpy)... | ALGO | 0.999988 | 3.106001 |
a649fc9c-a7b1-42a3-9feb-d67df3da22d0 | say859462/CPP-codebook | AC_Code/CF-215A.cpp | #include<cstdio>
#include<iostream>
#include<cstring>
using namespace std;
int main()
{
int i,n,m,j;
int a[51],b[51];
int max;
int temp;
int count;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
scanf("%d",&m);
for(j=0;j<m;j++)
{
scanf("%d",&b[j]);
}
max=0;
count=0;
for(j=0;j<m;j++)
{
... | ALGO | 0.999801 | 3.049227 |
ea5a1938-e0d9-4773-9cf9-0ba16b0ba975 | hwfhc/process_simulator | test/test.cpp | template<class InputIt, class UnaryFunction>
UnaryFunction for_each(InputIt first, InputIt last, UnaryFunction f)
{
for (; first != last; ++first) {
f(*first);
}
return f;
}
std::vector<double> v{ 1.0, 2.2, 4.0, 5.5, 7.2 };
double r = 4.0;
std::for_each(v.begin(), v.end(), [&](double & v) { v += r; });
std::... | ALGO | 0.995278 | 6.024199 |
25c80e7a-8f87-4025-bcfc-3965dfa91bb4 | Iwannnn/oj | acwing/9_mul.cpp | #include <iostream>
#include <vector>
using namespace std;
vector<int> add(vector<int> &A, vector<int> &B) {
if (A.size() < B.size()) return add(B, A);
int t = 0;
vector<int> C;
for (int i = 0; i < A.size(); ++i) {
t += A[i];
if (i < B.size()) t += B[i];
C.push_back(t % 10);
t /= 10;
}
if (... | ALGO | 0.999955 | 4.521382 |
52d93941-258a-43df-9ed3-381d2b555945 | ShibboManshi/CS204 | MST.cpp | #include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> iPair;
void prim(vector<pair<int,int> > adjlist[], int n)
{
int weight[n];
int parent[n];
int visited[n] = {0};
for(int i=0;i<n;i++)
{
weight[i] = INT_MAX;
parent[i] = -1;
}
parent[0] = 0;
weight[0] = ... | ALGO | 0.999905 | 4.160985 |
f9eeb341-f187-4f16-adc5-deae953f998a | hbzou17/SecCoin | abcoffical/abcmultigpu/src/pqcrypto/sha256.cpp | #include "pqcrypto.h"
/**
@file sha256.c
*/
/* Various logical functions */
#define Ch(x,y,z) (z ^ (x & (y ^ z)))
#define Maj(x,y,z) (((x | y) & z) | (x & y))
#define S(x, n) RORc((x),(n))
#define R(x, n) (((x)&0xFFFFFFFFUL)>>(n))
#define Sigma0(x) (S(x, 2) ^ S(x, 13) ^ S(x, 22))
#d... | ALGO | 0.998547 | 5.627133 |
882c8c51-9844-4fc5-96f8-ab68383aa51b | RisingHub/C_CPP_code | Narcissistic_Number/Narcissistic_Number/main.cpp | #include <stdio.h>
#include <math.h>
int NumLen(int n)
{
int len = 0;
do{
n/=10;
len++;
}while(n);
return len;
}
int ifNar(int n)
{
int k = NumLen(n);
int t = n;
int ret = 0;
do{
ret += pow(t%10, k);
t /= 10;
}while(t);
if(ret == n) return 1;
... | ALGO | 0.999762 | 3.962088 |
92dbda51-844c-46cc-a7b8-f8e080a84045 | shyu61/program-competition | code/typical90/037_2.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
using ll = long long;
using P = pair<int, int>;
const int INF = 1001001001;
// 関連問題: https://atcoder.jp/contests/abc170/tasks/abc170_e
// 🔷初見でどうやったら解けるか
// クエリ問題なので各クエリ操作のボトルネックをまず特定する。
// (1)幼児の移動,(2)2つの幼稚園のmaxの更新,(3)全体のmi... | ALGO | 0.999977 | 4.926328 |
c551a854-0fd2-417a-873f-9826dd22c226 | awturner/awturner-phd | cpp/SimpleMesh/MeshFunctions.cpp | #include "MeshFunctions.h"
#include "vnl/algo/vnl_svd.h"
#include "Useful/ArrayVectorFunctions.h"
using namespace AWT;
bool AWT::SimpleMesh::checkHomogeneous(const SimpleMesh::Points& points, const double val)
{
const Index r = points.rows() - 1;
for (Index i = 0; i < points.cols(); ++i)
if (points(i, ... | TOOL | 0.997703 | 6.408819 |
ccb95026-df54-4767-bb0b-76847c4d584d | Hacv16/Competitive_Programming | Data Structures/Persistent_Segment_Tree(pointers).cpp | /*
A ideia eh fazer uma seg persistente usando ponteiros
Modelo eh o problema DQUERY (https://www.spoj.com/problems/DQUERY/)
Criado por Fernando, 23/01/2023 22:57
*/
#include <bits/stdc++.h>
using namespace std;
struct SegPersistente
{
int quant;
int ini, fim;
SegPersistente* e;
SegPersisten... | ALGO | 0.999743 | 4.767512 |
c62c3b4c-0d3c-4db1-956c-ffb357000be1 | LizaRummo/EVM_coursework | EVM_coursework/main.cpp | #include <Windows.h>
#include <string>
#include <iostream>
using namespace std;
int N = 0; //-
int T = 0; //
int T_stop = 0; //
int Pn = 100; //
int Kr = 100; //
int M; //
struct States {
//
string pr_reg = "_/REG\\"; //
string pr_wStart = "__[wM0"; //
string pr_wEnd ... | ALGO | 0.962437 | 3.112786 |
c99a191a-38c9-4491-b994-dc4a05fcfdb6 | RicardoFebra/IST-Thesis-LowPowerEdgeML4IoT | DataProcessing/aprox_fft/aprox_fft.cpp | #include "aprox_fft.h"
//---------------------------------lookup data------------------------------------//
byte isin_data[128]=
{0, 1, 3, 4, 5, 6, 8, 9, 10, 11, 13, 14, 15, 17, 18, 19, 20,
22, 23, 24, 26, 27, 28, 29, 31, 32, 33, 35, 36, 37, 39, 40, 41, 42,
44, 45, 46, 4... | ALGO | 0.998396 | 4.305156 |
1086d711-12ef-4ea8-9888-d12d0d58e2ba | AdnanMohamed/Algorithms-Programming-Exercises | BinaryTree/BinaryTree/BinaryTree.cpp | #include "BinaryTree.h"
BinaryTree::BinaryTree() // constructor
: _root(NULL), n(0) { }
int BinaryTree::size() const // number of nodes
{
return n;
}
bool BinaryTree::empty() const // is tree empty?
{
return size() == 0;
}
BinaryTree::Position BinaryTree::root() con... | ALGO | 0.9967 | 3.528308 |
8b435ece-4e6a-49ca-9f9b-46e201fcad4e | Charishma-Gowdu/Plagiarism-Detection-Tool-Implementation | phase2/jedisith/all_jedi.cpp | #if __has_include("final_battle.h")
#include "final_battle.h"
#elif __has_include("jedisith/final_battle.h")
#include "jedisith/final_battle.h"
#endif
/* You should NOT add ANY other includes to this file.
* Your task is to implement the "encode_tree" function as described
* in the file "tree.h". Read the instructio... | ALGO | 0.98437 | 5.825933 |
33ed8005-fe2e-4db9-9174-aa94714d54ad | vyshnavi299/C-language-0272 | Assignments/assignment 1 day 1/program 6 ans.cpp | #include <stdio.h>
int main() {
int amount, notes;
printf("Enter the amount: ");
scanf("%d", &amount);
// Calculation for 500 notes
notes = amount / 500;
amount %= 500;
if(notes != 0)
printf("Rs. 500 notes: %d\n", notes);
// Calculation for 100 notes
notes = amount / 100;
... | ALGO | 0.982547 | 4.134526 |
b3120b64-7c7d-4232-b333-733ce0fcc331 | omnirepo/frameworks_av | media/libstagefright/codecs/amrwb/src/synthesis_amr_wb.cpp | /*
------------------------------------------------------------------------------
Filename: synthesis_amr_wb.cpp
Date: 05/04/2007
------------------------------------------------------------------------------
REVISION HISTORY
Description:
--------------------------------------------------------------------... | ALGO | 0.999688 | 3.877183 |
072ff756-89c1-4d20-b32f-a1ebb18a6dfb | songtao-vip/android-core | mini_keyctl/mini_keyctl_utils.cpp | #include <mini_keyctl_utils.h>
#include <fstream>
#include <iterator>
#include <sstream>
#include <string>
#include <vector>
#include <android-base/logging.h>
#include <android-base/parseint.h>
namespace android {
namespace {
std::vector<std::string> SplitBySpace(const std::string& s) {
std::istringstream iss(s)... | TOOL | 0.956834 | 7.344575 |
05c37e4f-c129-4eff-b81c-ca450385563b | Jackarain/boost | libs/intrusive/test/stateful_value_traits_test.cpp | using namespace boost::intrusive;
class MyClass
{
public:
int int_;
MyClass(int i = 0)
: int_(i)
{}
friend bool operator<(const MyClass &l, const MyClass &r)
{ return l.int_ < r.int_; }
friend bool operator==(const MyClass &l, const MyClass &r)
{ return l.int_ == r.int_; }
frien... | TOOL | 0.869215 | 5.808401 |
d7105dd9-d4e8-45cc-9636-2479dda4f132 | liuq901/code | XMU/x_1002.cpp | #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cctype>
#include <ctime>
#include <cstdarg>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <vector>
#include <list>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#... | ALGO | 0.992858 | 3.662315 |
35b633bb-3a9b-49ef-8034-2a74c5315d52 | rumdice/study | algorithm-cpp/CodingTest/picnic.cpp | #include <cstdio>
#include <string>
#include <vector>
#include <iostream>
using namespace std;
// p.155 dz
// ľ
// n : л
// m : ģ
// 2 ¦
// : ¦ ִ
int n;
bool isFriends[10][10];
// i° л ¦ ã true, ƴϸ false
int countPair(bool taken[10])
{
// 1. - ¦ ã
bool finished = true;
for (int i = 0; i < n; i++) ... | ALGO | 0.999523 | 3.309505 |
3a67a8cc-04bd-42e4-9ef9-9e4e8b10eab2 | alimusa5/Operating-Systems | Tasks/Task4.cpp | #include <pthread.h>
#include <stdio.h>
#include<stdlib.h>
#include <sys/types.h>
#include <signal.h>
#include<sys/wait.h>
#include<string.h>
#include<unistd.h>
pthread_t t1,t2,t3,t4,t5;
char word[]={" "};
void *palindromic()
{
int flag = 0;
int n=sizeof(word);
for (int i = 0; i <= n / 2 ... | ALGO | 0.945225 | 3.414827 |
e14ce877-b854-44da-9681-5c0edfead59e | VadVergasov/OlympTasks | Gymn29/2019-2020/Republic/Train/I/main.cpp | #pragma GCC optimize("O2,no-stack-protector,unroll-loops")
using namespace std;
int main() {
ifstream in("input.txt");
ofstream out("output.txt");
long long l, r;
in >> l >> r;
for (long long i = 1; i <= 1e6; i++) {
long long cur = i * i * i;
long long l1 = 0, r1 = 1e9;
whi... | ALGO | 0.999865 | 4.447343 |
7c2fdee6-75e4-41dd-9b46-2da424a4a159 | alalhossain94/Algorithms | Module 16 Mid Term Exam/p5.cpp | #include <bits/stdc++.h>
#define pi pair<int, int>
using namespace std;
const int N = 105; // Increased to accommodate constraints
mint dist[N][N];
vector<pi> moves = {{-1, -2}, {-2, -1}, {-2, 1... | ALGO | 0.99992 | 5.759209 |
47b8fea9-4c85-4e21-bb8a-46066baa348e | ishandutta2007/codeforces | staniewzki/normal/1189/A.cpp | #include<bits/stdc++.h>
using namespace std;
using LL = long long;
using PII = pair<int, int>;
template<class T> int size(T && a) {
return a.size();
}
template<class L, class R> ostream& operator<<(ostream &out, pair<L, R> p) {
return out << "(" << p.first << ", " << p.second << ")";
}
template<class T> auto oper... | ALGO | 0.999987 | 3.644075 |
39ef9403-d59e-4306-aafd-d6a0819d905c | shubKibees/mycontent | css/day12.cpp | // There are n cities. Some of them are connected, while some are not. If city a is connected directly with city b, and city b is connected directly with city c, then city a is connected indirectly with city c.
// A province is a group of directly or indirectly connected cities and no other cities outside of the group... | ALGO | 0.999975 | 6.041803 |
efa04588-dfa6-4699-8ab8-372569991c38 | Stebbet/Radix_Counter | main.cpp | #include <iostream>
#include "radix.h"
#include <vector>
using namespace std;
int main() {
vector<int> unsorted;
int max_len = 0;
// Ask user for a number input
for(;;) {
int num;
cout << "Enter a number to add to the array or enter anything else to start" << endl;
cout << "> ... | ALGO | 0.999781 | 5.771255 |
dd3e7991-fb81-4e0d-9da5-bb8a3b784906 | Madhav-Ahuja27/DSA | pivotArr.cpp | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main() {
int arr[] = {7,9,1,2,3};
int n = sizeof(arr)/sizeof(arr[0]);
int s=0;
int e=n-1;
while(s<e){
int mid = s + (e-s)/2;
if(arr[mid]>arr[0]){
s=mid+1;
}else{
e=mid;
}
}
cout<<"Pivot number is: "<<arr[s]<... | ALGO | 0.999895 | 4.688551 |
fe249e35-7f28-4b41-83b5-2c2d067db865 | amit15000/cpp-DSA | Oops/Practice/Factory_Boxes.cpp | #include <bits/stdc++.h>
using namespace std;
//<-------------------- Yes, we can make constructor private----------------->
class Box
{
friend class BoxFactory;
friend void Show_Box(string name_of_box, const Box &a);
private:
int width;
static int borderWidth;
int height; // height of all boxes--... | TOOL | 0.86421 | 4.874972 |
ffc5789c-5ba1-4ffc-bfaf-211f8f4b9732 | Shubham0920/Daily-Leetcode-question | Valid Expression - GFG/valid-expression.cpp | //{ Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
bool valid(string str);
int main()
{
int t;
cin>>t;
cin.ignore();
while(t--)
{
string str;
getline(cin,str);
cout<<valid(str)<<endl;
}
return 0;
}
// } Driver Code Ends
bool valid(string s)
{
// ... | ALGO | 0.999141 | 6.194607 |
49c1570f-cfae-4fd8-aa0d-3ccb274dd308 | Shaheera854/gfg | Medium/Course Schedule/course-schedule.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
//User function Template for C++
class Solution
{
public:
vector<int> findOrder(int n, int m, vector<vector<int>> pre)
{
//code here
vector<int> adj[n];
vector<int> indegree(n,0);
for(... | ALGO | 0.999893 | 6.765041 |
2957fb82-61e3-41a2-ad07-8a5a47642a30 | qkrtjdrbs/algorithm | 5913.cpp | #include <bits/stdc++.h>
#define MAX 5
using namespace std;
int k, ans;
int dx[] = {0,0,-1,1};
int dy[] = {-1,1,0,0};
bool Map[6][6], visited[6][6];
bool check(){
for(int i=1;i<=MAX;i++){
for(int j=1;j<=MAX;j++){
if(!Map[i][j] && !visited[i][j]){
return false;
}
... | ALGO | 0.999825 | 4.274751 |
7e9b1281-29c8-43b7-8ee9-3c04ba7a5728 | Mhammedhelal/Problem-Solving | Problems/ICPC Asyut Sheets/Sheet #6 (Math - Geometry)/O. Big Add and Multiply.cpp | #include <bits/stdc++.h>
using namespace std;
// Function to add two large numbers represented as strings
string addLargeNumbers(const string &a, const string &b)
{
string result = "";
int carry = 0, sum = 0;
int i = a.size() - 1, j = b.size() - 1;
// Add digits from the back
while (i >= 0 || j >=... | ALGO | 0.999814 | 5.37175 |
52dba74c-20a5-4264-83b3-d2074b5a0c74 | KumbarVenkatesh/CPP-Data-Structures- | 07.Nested Recursion.cpp | #include<iostream>
using namespace std;
int fun(int n){
printf("%d\n ", n);
if(n>100){
return n-10;
}
else{
return fun(fun(n+11));
}
}
int main(){
int r;
r = fun(95);
printf("%d \n" ,r);
}
| ALGO | 0.999557 | 3.19385 |
81547880-0e4f-43ab-931e-d4d23814958b | redcapital/algo | timus/1502.cpp | #include <iostream>
using namespace std;
int main(int argc, char const *argv[])
{
typedef long long ll;
int n;
cin >> n;
int right = (n * (n + 1)) / 2;
ll ans = 0;
++n;
for (int i = 0; n >= 1; right -= i, i++, n--) {
ans += (ll)(i * n + right);
}
cout << ans << endl;
return 0;
}
| ALGO | 0.999783 | 3.936616 |
bad3a722-6561-48c8-9c40-5f54bb951b3d | SOFTK2765/PS | BOJ/10707.cpp | #include <bits/stdc++.h>
using namespace std;
int a[5];
int main()
{
for(int i=0;i<5;i++)
scanf(" %d", &a[i]);
if(a[2]<a[4])
{
if(a[0]*a[4]<a[1]+((a[4]-a[2])*a[3])) printf("%d", a[0]*a[4]);
else printf("%d", a[1]+((a[4]-a[2])*a[3]));
}
else
{
if(a[0]*a[4]<a[1])... | ALGO | 0.999891 | 3.571906 |
e910db23-c506-4706-9b9a-4a3cf78fc0a9 | rjjrbatarao/MarlinREXY | Marlin/src/feature/bedlevel/ubl/ubl_motion.cpp | #include "../../../inc/MarlinConfig.h"
#if ENABLED(AUTO_BED_LEVELING_UBL)
#include "../bedlevel.h"
#include "../../../module/planner.h"
#include "../../../module/stepper.h"
#include "../../../module/motion.h"
#if ENABLED(DELTA)
#include "../../../module/delta.h"
#endif
#include "../../../MarlinCore.h"
#include <m... | ALGO | 0.989204 | 7.586849 |
9a568238-2a7f-45b9-aac4-dc4142608caf | touchtt0205/lab18 | lab18_3.cpp | #include<iostream>
#include<cstdlib>
#include<ctime>
#include<vector>
using namespace std;
vector<int> randomVector(int);
void showVector(vector<int>);
int dotProduct(vector<int>,vector<int>);
int main(){
srand(time(0));
vector<int> x = randomVector(5);
vector<int> y = randomVector(5);
int z = dotProduct(x,y);
s... | ALGO | 0.979016 | 4.223701 |
b51eb26b-d604-46e1-a8e2-17be8301f78a | Ankurrawat-12/Questions | Lagranges_interPolation.cpp | #include<bits/stdc++.h>
using namespace std;
double interpolate(vector<vector<int>> f, int xi)
{
double result = 0; // Initialize result
for (int i=0; i<f.size(); i++)
{
double term = f[i][1];
for (int j=0;j<f.size();j++)
{
if (j!=i)
term *= (xi - f[j]... | ALGO | 0.999726 | 4.476289 |
d6b2927a-56a4-471f-b7f1-4a67e50adebd | niclasberg/biblbm | src/parallelism/parallelStatistics.cpp | /** \file
* The CombinedStatistics class -- generic implementation.
*/
#include "parallelism/mpiManager.h"
#include "parallelism/parallelStatistics.h"
#include <cmath>
namespace plb {
#ifdef PLB_MPI_PARALLEL
ParallelCombinedStatistics* ParallelCombinedStatistics::clone() const
{
return new ParallelCombinedStat... | ALGO | 0.923002 | 6.81503 |
237a8c5b-b3d9-43b7-a8a4-8476271e715d | SuperUserDone/FWEngine | WickedEngine/BULLET/BulletCollision/NarrowPhaseCollision/btPersistentManifold.cpp | #include "btPersistentManifold.h"
#include "LinearMath/btTransform.h"
btScalar gContactBreakingThreshold = btScalar(0.02);
ContactDestroyedCallback gContactDestroyedCallback = 0;
ContactProcessedCallback gContactProcessedCallback = 0;
///gContactCalcArea3Points will approximate the convex hull area using 3 points
... | ALGO | 0.960072 | 6.900665 |
5f54aa99-adb6-48f4-ad69-3c9a497cc86d | Lucas-RCS/Listas-de-Exercicios | 1º Semestre/C++/exercicios2lista/9-Velocidade.cpp | /*9. Construa um programa em que leia a velocidade mxima permitida em uma avenida e a velocidade com que o motorista estava dirigindo nela
e calcule a multa que uma pessoa vai receber, sabendo que so pagos:
a. 50 reais se o motorista estiver ultrapassado em at 10km/h a velocidade permitida;
b. 100 reais, se o motorista... | ALGO | 0.992956 | 3.597695 |
71e85ad3-fef7-4d0e-8f7f-290430d171f9 | Dipendra-Raghav/Leetcode | 0090-subsets-ii/0090-subsets-ii.cpp | class Solution {
public:
vector<vector<int>> res;
void solve(vector<int>& nums,vector<int> &ans,int i)
{
res.push_back(ans);
for(int k=i;k<nums.size();k++)
{
if(k>i && (nums[k]==nums[k-1]))
{
continue;
... | ALGO | 0.999984 | 5.823181 |
cf6d8008-f070-431a-8a07-14c60d8bd264 | jset-issta2024/jset | z3-4.4.1/src/tactic/core/der_tactic.cpp | #include"der.h"
#include"tactical.h"
class der_tactic : public tactic {
struct imp {
ast_manager & m_manager;
der_rewriter m_r;
imp(ast_manager & m):
m_manager(m),
m_r(m) {
}
ast_manager & m() const { return m_manager; }
... | ALGO | 0.911496 | 5.310813 |
d79118da-a035-445e-b762-15169c64cb30 | Yu-Gua/-Introduction-to-Computation-A-from-LXZ-s-class | 函数递归第一次/21.word statistics.cpp | #include <stdio.h>
#include <algorithm>
#include <string>
#include <iostream>
#include <vector>
bool isAlpha(char& c){
return((c>='a' && c<='z') || (c>='A' && c<='Z'));
}
bool isquote(char& c){
return(c==39);
}
std::string getword(std::string& tmp){
char c=std::cin.get();
bool alpha=isalpha(c) || isquo... | ALGO | 0.997127 | 3.788193 |
e16d47c6-cb4a-4c34-b1be-70468a4a99ab | NRGKing/knights-lib | src/knights/autonomous/movements/local/lateral.cpp | #include "knights/autonomous/controller.hpp"
#include "knights/autonomous/pid.hpp"
#include "knights/robot/chassis.hpp"
#include "knights/robot/drivetrain.hpp"
#include "knights/util/calculation.hpp"
#include "knights/util/position.hpp"
#include "pros/motors.h"
#include "pros/rtos.hpp"
#include <cmath>
void knights:... | ALGO | 0.996682 | 4.420686 |
538f8b6b-5d0b-44c9-b20a-f67792b1cc8b | diwakarrankawat/lcn_firm | 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.998693 | 6.797273 |
bd7d3b33-abaa-455c-919c-15d96f380f59 | asadnorouzi/carnd-path-planning | src/Eigen-3.3/unsupported/doc/examples/MatrixPower_optimal.cpp | #include <unsupported/Eigen/MatrixFunctions>
#include <iostream>
using namespace Eigen;
int main()
{
Matrix4cd A = Matrix4cd::Random();
MatrixPower<Matrix4cd> Apow(A);
std::cout << "The matrix A is:\n" << A << "\n\n"
"A^3.1 is:\n" << Apow(3.1) << "\n\n"
"A^3.3 is:\n" << Apow(3.3) << "\n\n"
... | ALGO | 0.99659 | 3.396939 |
d62aa215-de64-4fb9-a0d0-ff0c5d653d6a | ashokabairwaideology/Leet-code-problem | lcp/LCP 17. 速算机器人/Solution.cpp | class Solution {
public:
int calculate(string s) {
int x = 1, y = 0;
for (char& c : s) {
if (c == 'A')
x = x * 2 + y;
else
y = y * 2 + x;
}
return x + y;
}
}; | ALGO | 0.999701 | 5.488472 |
f00ac0b5-5acf-4d61-89af-65579b98e138 | OS2World/DEV-SAMPLES-IBM_OpenDoc | PriortyQ.cpp | #if defined(_PLATFORM_OS2_) || defined(_PLATFORM_WIN32_)
#include <ODPagtun.h>
#endif
#ifndef _PRIORTYQ_
#include "PriortyQ.h"
#endif
#ifndef _ODMEMORY_
#include "ODMemory.h"
#endif
#ifndef _ODUTILS_
#include "ODUtils.h"
#endif
#ifndef _ODEXCEPT_
#include "ODExcept.h"
#endif
#ifndef _ODDEBUG_
#include "ODDebug.h"
... | ALGO | 0.994813 | 6.29447 |
9f61a707-6b76-4df4-b181-d5ef809e868a | adensur/hackerrank | medium/leetcode/medium_top/2d_iterator/main.cpp | // https://leetcode.com/problems/flatten-2d-vector
class Vector2D {
private:
size_t index1 = 0;
size_t index2 = -1;
vector<vector<int>>& data;
void try_advance() {
if (index2 + 1 < data[index1].size()) {
++index2;
return;
}
index2 = 0;
++index1... | ALGO | 0.99236 | 7.145105 |
d5a99065-401b-4c40-b584-30ca4a952cc5 | santr4/DSA-2.0 | striver/binary trees/tut18.cpp | // ** Print root to node in the binary tree.
#include <bits/stdc++.h>
using namespace std;
struct TreeNode
{
int val;
TreeNode *left;
TreeNode *right;
TreeNode(int x)
{
val = x;
left = nullptr;
right = nullptr;
}
};
class Solution
{
public:
bool getPath(TreeNode *r... | ALGO | 0.999995 | 5.771573 |
472b0978-e91e-47d0-9ea9-22fba586ef27 | chill-cy/Data-Structure | 1.队列和栈/3.queue-7.cpp | /*************************************************************************
> File Name: 3.queue-7.cpp
> Author:jiangxiaoyu
> Mail:<EMAIL>
> Created Time: 2019年09月04日 星期三 10时49分02秒
************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
... | ALGO | 0.992417 | 4.196361 |
83a8132f-c287-4ab9-bba4-63dc8ca8faa0 | Hasanul-Bari/online-practice | uva/11503 - Virtual Friends.cpp | #include<bits/stdc++.h>
#define faster ios :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define ull unsigned long long
#define pb push_back
const double PI = acos(-1.0);
using namespace std;
map<string,string> p;
map<string,int> sz;
string find_set(string v)
{
if(v==p[v])
return v... | ALGO | 0.999952 | 4.468095 |
7464dce1-92a2-431a-83f5-0445c31b1614 | khadija1114/Online-Judge-Solutions | Codeforces/1688b.cpp | #include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//using orderedMultiset = tree<T ,null_type,std::less_equal<T>, rb_tree_tag,tree_order_statistics_node_update>;
#define ff first
#define ss second
#define bg begin()
#define en end()... | ALGO | 0.999565 | 4.403787 |
5aa718d6-324d-4a5c-9b2f-ac245b156dc2 | theSquaredError/Algorithms | ADSA Lab/lab-2/postfix.cpp | /*
Problem :- Given an expression E in the postfix representation, write a program to evaluate the value
of E, using stack data-structure.
*/
#include <stack>
#include <iostream>
#include <string.h>
#include <vector>
#include <cmath>
#include <bits/stdc++.h>
using namespace std;
bool isNumber(const string& str)
{
... | ALGO | 0.999429 | 5.620459 |
2341c50b-a2cb-44a6-8878-eb552d246701 | rakibul263/Data-Structure | STL Priority Queue Map and Set/priority_Queue_min_heap.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
priority_queue<int, vector<int>,greater<int>>pq;
while (true)
{
int x;
cin >> x;
if (x == 0)
{
int p;
cin >> p;
pq.push(p);//logN
}
else if (x == 1)
{
... | ALGO | 0.998614 | 3.861581 |
c5cccffc-e9c1-4916-8338-8ca22cab8ab2 | soltree12/2015_Spring_CGTermProject | CGTerm2/DirectionalLight.cpp | #include "DirectionalLight.h"
#include <iostream>
using namespace std;
void getRatio2(Vec p, Vec a, Vec b, Vec c, float &u, float &v, float &w)
{
Vec v0 = b - a, v1 = c - a, v2 = p - a;
float d00 = v0.dot(v0);
float d01 = v0.dot(v1);
float d11 = v1.dot(v1);
float d20 = v2.dot(v0);
float d21 = v2.dot(v1);
float ... | TOOL | 0.956917 | 3.965278 |
9a19d3e7-b97b-4acb-9a42-7949cac32104 | 2023-anik/My_Code_Archive | XPSC- 5/week 1/Day 7/prb 5(Word Game).cpp | #include<bits/stdc++.h>
using namespace std;
#define int long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define no cout<<"NO"<<'\n'
#define yes cout<<"YES"<<'\n'
#define endl '\n'
typedef vector<int> vi;
typedef pai... | ALGO | 0.99954 | 4.25331 |
d33463f2-57fb-4b29-9df7-48195bb67547 | joginderNrajput/Leetcode-Problems | Filling Bucket - GFG/filling-bucket.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
int solve(int n, vector<long long > &dp, int mod){
if(n == 1){
return 1;
}
if(n == 2){
return 2;
}
if(dp[n] != -1){
return dp[n]%mod... | ALGO | 0.999943 | 6.011954 |
ebcf6fce-d26e-436e-8716-4bf4a34e93ab | yasmineecosta/maratonas | MFP2024/testeB.cpp | #include <algorithm>
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#define MAX 10000
#define ll long long
#define lli long long int
using namespace std;
int main() {
int bit, seg, quant;
quant = 0;
for(int i=0; i<7;i++){
cin >> bit;
if(bit == 1){
quant++;
... | ALGO | 0.999723 | 3.426492 |
5a995d4c-a52f-4c37-9880-3cfda2242848 | AkshathKamath/Data-Structures-Algorithms | Basics/Basics/If_Else.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
/*age<18-> inelgible, age<57 eligible but >54 retirement soon, >57-> retirement*/
int age;
cin >> age;
if (age < 18)
{
cout << "Ineligible";
}
else if (age < 57)
{
cout << "Eligible";
if (age > 54)
... | TOOL | 0.998487 | 5.041512 |
4ff857c6-9735-4ae0-8c17-b2cccf7f9a07 | Sermitse/GTS_Plugin | src/Utils/Spring.cpp | #include <numbers>
#include "Utils/Spring.hpp"
namespace {
// Spring code from https://theorangeduck.com/page/spring-roll-call
float halflife_to_damping(float halflife, float eps = 1e-5f)
{
return (4.0f * std::numbers::ln2_v<float>) / (halflife + eps);
}
float damping_to_halflife(float damping, float eps = 1... | ALGO | 0.985106 | 6.889799 |
cb317536-79ab-4794-85a7-02071966c953 | felipegnunes/obi-solucoes | 2018/fase2/elevador.cpp | // Ordenação
#include <iostream>
using namespace std;
void selection_sort(int N, int v[])
{
for (int i = 0; i < N; i++)
{
int min = v[i], min_index = i;
for (int j = i + 1; j < N; j++)
{
if (v[j] < min)
{
min = v[j];
min_index =... | ALGO | 0.99996 | 3.975436 |
6bfcd27e-7f41-4c00-8096-a4d3cc70ce9d | biurci-scrivener/DGP | deps/geometry-central/src/pointcloud/point_cloud_heat_solver.cpp | #include "geometrycentral/pointcloud/point_cloud_heat_solver.h"
namespace geometrycentral {
namespace pointcloud {
PointCloudHeatSolver::PointCloudHeatSolver(PointCloud& cloud_, PointPositionGeometry& geom_, double tCoef_)
: tCoef(tCoef_), cloud(cloud_), geom(geom_) {
// WARNING: these routines mix indexing th... | ALGO | 0.998799 | 7.252308 |
39e396b9-be3c-4f30-8571-49b2d291e30f | shreejitverma/SDE-Interview-Prep | ACM ICPC/Sorting/Bubble Sort/C++/Bubble_Sort_2.cpp | #include <iostream>
using namespace std;
void bubbleSort(int A[],int n)
{
int i,j;
int temp;
for(i=0;i<n;i++)
{
for(j=0;j<n-i;j++)
{
if(A[j]>A[j+1])
{
temp=A[j];
A[j]=A[j+1];
A[j+1]=temp;
}
}
}
}
int main()
{
int n;
cout<<"Enter the size of the array\n";
cin>>n;
int a[n];
cout<<"E... | ALGO | 0.999673 | 4.091468 |
f8a5031c-ac64-4901-9a4d-79419c789b64 | businessdohyeon/BaekJoon | #28702.cpp | /*
BackJoon No.
#28702
*/
#include <iostream>
#include <string>
using namespace std;
int tryStringToInt(const string& str){
int result = 0;
for(int digit=str.size()-1, weight = 1; digit>=0; --digit, weight *= 10){
if(str[digit] < '0' || str[digit] > '9') return -1;
result += int(str[digit]... | ALGO | 0.999863 | 5.108603 |
78572018-ff59-4955-ab97-6391ef7dbf1b | vitorizkiimanda/CodingMixed | ICPC2016/A.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int t,n,nilai,counter=0;
scanf("%d", &t);
for(int i =1; i<=t;i++)
{
scanf("%d", &n);
for(int j=0;j<n;j++)
{
scanf("%d", &nilai);
if(nilai<60) counter++;
}
printf("Case #%d: %d\n", i,counter);
counter=0;
}
return 0;
}
| ALGO | 0.997274 | 3.244452 |
226daf62-334b-49d5-94cc-1162560e6166 | solanki018/DSA-SUMMER | Binary_search/answers/1_pow.cpp | #include <iostream>
#include <vector>
using namespace std;
class Solution {
public:
long long floorSqrt(long long n) {
long long left = 1;
long long right = n;
long long ans = 0;
while(left<right){
int mid = left + (right - left) / 2;
if(mid*mid<=n){
... | ALGO | 0.999949 | 4.779354 |
9452aa39-5bf9-49b5-af47-b1a5528b26a1 | vrahul7/vgcode | Git/Codes/30Days/Day14/Solution.cpp | Difference(vector<int> v) {
elements = v;
}
void computeDifference(){
maximumDifference = 0;
for(int i=0;i<elements.size();i++)
{
for(int j= i+1;j<elements.size();j++)
{
if(abs(elements[i]-elements[j])>maximumDifference... | ALGO | 0.999038 | 4.414493 |
dc56bb40-7635-40a6-8bfb-c522bba142d0 | o-zhongchong/leetcode | Leetcode/1739.cpp | class Solution {
public:
int minimumBoxes(int n) {
vector<int> bottom(1, 0), total(1, 0);
for(int i = 1; total[i-1] <= n; ++i)
{
bottom.push_back((1 + i) * i / 2);
total.push_back(total[i-1] + bottom[i]);
}
int h = total.size() - 2;
... | ALGO | 0.999996 | 6.303865 |
f914ec30-db1f-4aa1-85b1-b7fc3dc20db1 | abhishek3432/geeksforgeeks | Selection Sort.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
void swap(int *xp, int *yp)
{
int temp = *xp;
*xp = *yp;
*yp = temp;
}
// } Driver Code Ends
class Solution
{
public:
int select(int arr[], int i, int n)
{
// code here such that selectionSort() sorts arr[]
... | ALGO | 0.999896 | 6.330784 |
2e3a32c8-176c-4549-a101-c576dd8e589e | IvanRenison/ProgrammingProblems | Codeforces rounds/Codeforces rounds/Codeforces Round 142 (Div. 2)/A.cpp | // https://codeforces.com/contest/230/problem/A
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
#define fore(i, a, b) for (ull i = a; i < b; i++)
bool solve(ull s, vector<pair<ull, ull>> xys) {
ull n = xys.size();
sort(xys.begin(), xys.end());
fore(i, 0, n) {
if (s > xys[i].... | ALGO | 0.999859 | 3.845534 |
6d999884-c268-4ad5-8176-2b24765411bc | SunnyKokkula/Cpp_Practice_Problems | Reverse Number/main.cpp | #include <iostream>
using namespace std;
int main()
{
int n;
cin>>n;
int reverse =0;
while(n>0){
int lastdigit = n%10;
reverse = reverse*10 + lastdigit;
n = n/10;
}
cout<<reverse<<endl;
return 0;
}
| ALGO | 0.999891 | 4.647876 |
548eef68-321f-44ec-ab90-4f333311153d | KalkiEshwarD/LeetCode | TopInterview150/ArrayString/MergeSortedArray.cpp | #include <iostream>
#include <vector>
using namespace std;
void MergeSortedArray(vector<int>& nums1, int m, vector<int>& nums2, int n) {
// Initialize a temp vector
vector<int> temp;
// Initialize two pointers to point to the beginning of the two vectors.
int ptr1 = 0;
int ptr2 = 0;
// C... | ALGO | 0.999994 | 6.073061 |
07ed651e-d4e3-4239-90c4-2f06ce196ed5 | ishandutta2007/codeforces | noimi/normal/1462/C.cpp | #pragma region Macros
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define rep2(i, a, b) for(ll i = a; i <= b; ++i)
#define rep(i, n) for(ll i = 0; i < n; ++i)
#define rep3(i, a, b) for(ll i = a; i >= b; -... | ALGO | 0.999897 | 4.61448 |
9559bb76-9a6c-43ef-88d3-821abc8e3e21 | FierceCoder212/Random-Repo | PF LABS (CPP DEV)/SOLUTIONS/lab 03/Task-09/task-09.cpp | #include <iostream>//******************************************************************Libraries****************************************************************
#include <cmath>
#include <conio.h>
#include <stdlib.h>
using namespace std ;
main ()
{//********************************************************************... | TOOL | 0.974431 | 3.130494 |
46d77b26-fdbb-45b4-a1e7-ecd2a1c09dff | PaukIsUha/optimizing_formating_code | predictions/submissions-aizu-cot-gpt35/Codenet/p00881/828368555/response_3.cpp | #include <iostream>
#include <map>
#include <string>
#include <vector>
using namespace std;
map<pair<vector<int>, int>, int> mp;
int search(vector<int> &vi, int depth, int used, int m, int n) {
if (mp.count(make_pair(vi, used)))
return mp[make_pair(vi, used)];
int viSize = vi.size();
int mask = 1;
if (... | ALGO | 0.999628 | 4.860774 |
d771b2a7-7f72-4aab-918f-6fa4219f469b | Arijit1809/Leetcode | house-robber-ii/house-robber-ii.cpp | class Solution {
public:
int houseRobber(vector<int>& nums) {
int dp[nums.size()+1];
dp[0] = nums[0];
dp[1] = max(nums[0], nums[1]);
for (int i=2; i<nums.size(); i++)
dp[i] = max(dp[i-1], nums[i]+dp[i-2]);
return dp[nums.size()-1];
}
int rob(... | ALGO | 0.999912 | 6.031673 |
d5ea15a7-7795-4e80-ad00-d27c713f440a | eigenteam/eigen-git-mirror | bench/benchmarkSlice.cpp | // g++ -O3 -DNDEBUG benchmarkX.cpp -o benchmarkX && time ./benchmarkX
#include <iostream>
#include <Eigen/Core>
using namespace std;
using namespace Eigen;
#ifndef REPEAT
#define REPEAT 10000
#endif
#ifndef SCALAR
#define SCALAR float
#endif
int main(int argc, char *argv[])
{
typedef Matrix<SCALAR, Eigen::Dynam... | TOOL | 0.873017 | 3.688043 |
c7d4f93e-211a-493e-b663-47758724076a | Perthanakrit/algo-lab | lab02/closest/main.cpp | #include <iostream>
#include <vector>
#include <cmath>
using namespace std;
struct Point
{
long double x, y;
};
long double closestPair(vector<Point> &points);
int main()
{
int t;
cin >> t;
if (t < 1 || t > 20)
{
return 0;
}
while (t--)
{
int n;
cin >> n;
... | ALGO | 0.998345 | 5.440003 |
3e48d6b7-5d9b-48d7-bd45-5ce2f1ca0408 | mostafa-saad/ArabicCompetitiveProgramming | 18-Programming-4kids/10_homework_11_answer_1.cpp | // By Ayman Salah https://www.facebook.com/ayman.salah.abdelaziz
#include <iostream>
using namespace std;
int main() {
int a[200];
int n;
cin >> n;
for (int i = 0; i < n; i++)
cin >> a[i];
int result = 0;
// For every possible array length
// Try all possible sub-arrays
// Verify and sum
for (int len = ... | ALGO | 0.999894 | 4.125135 |
21e8d91c-63c5-4ceb-b97e-395497edab34 | TzuMinYang-NYCU-lecture-homework/1102_Computer-Animation-and-Special-Effects | project/CMU的可參考code/A2/code/include/eigen3.2.5/doc/examples/DenseBase_template_int_middleCols.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<3>(1) << endl;
return 0;
}
| ALGO | 0.95064 | 3.154174 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.