uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
31b5f8e3-f0c1-463e-9a09-e9783ef02b56 | ZashJie/Cpp_Primer_Answer-personal-analysis | Chapter 10/10_35.cpp | #include <iostream>
#include <iterator>
#include <vector>
using namespace std;
int main() {
vector<int> v{ 1,2,3,4,5,6,7,8,9 };
for (auto it = prev(v.cend()); true; it--) {
cout << *it << endl;
if (it == v.cbegin()) break;
}
return 0;
} | ALGO | 0.998158 | 3.492386 |
7227a0e4-42ec-4117-b97f-6ac47fbc0086 | anshumangarg5410/MyLeetcode | 0121-best-time-to-buy-and-sell-stock/0121-best-time-to-buy-and-sell-stock.cpp | class Solution {
public:
int maxProfit(vector<int>& prices) {
int buy = prices[0]; int profit = 0;
for(int i = 0; i<prices.size(); i++) {
int temp = 0;
if(i != prices.size() - 1) buy = min(buy, prices[i]);
if (buy != prices[i] && prices[i] >= buy) {
... | ALGO | 0.999826 | 6.227591 |
0963f698-e5d8-4a3b-86b6-cdac2d85a1e2 | venkatachandu4444/Compiler-Design | Compiler Design/compiler design program 35.cpp | #include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
// Global variables
char *input;
int pos;
// Function prototypes
int expression();
int term();
int factor();
void error();
// Function to consume the next character in the input
void consume(char expected) {
if (*input == expected)
... | ALGO | 0.99977 | 6.268498 |
51125c7a-73bf-4298-9f29-f5c3e653fbc4 | lgc1112/ReTriple | libs/hwui/Interpolator.cpp | #define LOG_TAG "Interpolator"
#include "Interpolator.h"
#include <cmath>
#include <cutils/log.h>
#include "utils/MathUtils.h"
namespace android {
namespace uirenderer {
Interpolator* Interpolator::createDefaultInterpolator() {
return new AccelerateDecelerateInterpolator();
}
float AccelerateDecelerateInterpo... | ALGO | 0.960396 | 6.085423 |
1780006c-1337-42a9-8ae0-75ca1dde1953 | Ayesha3137/Ayesha-Zaheed | lab 8 tasks/task 2 while loop.cpp | #include<iostream>
using namespace std;
int main()
{
int i=1,j;
while(i<=10)
{
int j=0;
while(j<=5)
{
cout<<j<<"*"<<i<<"="<<i*j<<"\t";
j++;
}
cout<<endl;
i++;
}
return 0;
}
| ALGO | 0.997226 | 3.429385 |
b64ed38a-bbd4-4488-b53d-b68d32cc6baa | Al-amen/leetcode | 0075-sort-colors/0075-sort-colors.cpp | class Solution {
public:
void sortColors(vector<int>& nums) {
sort(nums.begin(),nums.end());
}
}; | ALGO | 0.99923 | 5.844316 |
d4514e29-20e9-4219-b0d8-52c008496e4f | Saipraneeth7754/foc | foc 6.cpp | #include<stdio.h>
int main()
{
int i, number, Sum = 0;
printf("\n Please Enter the Maximum Limit Value : ");
scanf("%d", &number);
printf("\n Odd Numbers between 0 and %d are : ", number);
for(i = 1; i <= number; i++)
{
if ( i%2 != 0 )
{
printf("%d ", i);
Sum = Sum + i;
}
}
... | ALGO | 0.99973 | 3.471703 |
2e923b15-9df1-43ef-af93-eda0f027dec2 | ishandutta2007/codeforces | pb0207/normal/869/C.cpp | #include<iostream>
#include<cstring>
#include<algorithm>
#include<cstdio>
using namespace std;
typedef long long ll;
const int N=5e3+1e1+7,P=998244353;
ll a,b,c,fac[N],rev[N];
ll qpow(ll a,ll b)
{
ll ret=1;
while(b)
{
if(b&1)
ret=ret*a%P;
b>>=1;
a=a*a%P;
}
return ret;
}
void pre()
{
fac[0]=1;
for(in... | ALGO | 0.999961 | 4.576981 |
c2b92dc2-84d2-45bb-b7e0-98a0e32c762c | NafiHasan/HabiJabi | C++/CSEDU/CSEDU 2022/Assignment/Assignment/struct_2.cpp | #include <stdio.h>
int gcd(int a, int b){
if(b==0)return a;
else return gcd(b, a%b);
}
int lcm(int a, int b){
int x=gcd(a,b);
return a*b/x;
}
typedef struct{
int p;
int q;
}rational;
void add (int p1, int q1, int p2, int q2){
int x=lcm(q1,q2)/q1*p1;
int y=lcm(q1,q2)/q2*p2;
int g ... | ALGO | 0.999561 | 4.198255 |
3d2b1184-a544-4928-ad09-6605130a24b7 | jeewon-kim1127/ROS2-VINS-FUSION-GRIDMAP | vins/src/factor/pose_local_parameterization.cpp | #include "pose_local_parameterization.h"
bool PoseLocalParameterization::Plus(const double *x, const double *delta, double *x_plus_delta) const
{
Eigen::Map<const Eigen::Vector3d> _p(x);
Eigen::Map<const Eigen::Quaterniond> _q(x + 3);
Eigen::Map<const Eigen::Vector3d> dp(delta);
Eigen::Quaterniond dq... | ALGO | 0.980203 | 6.093532 |
ccfc1a37-60a5-49d8-84c4-cf26084b5823 | OpenXRay/xray-soc-history | xrCore/Xr_ini.cpp | #include "stdafx.h"
#pragma hdrstop
#include "fs_internal.h"
XRCORE_API CInifile *pSettings = NULL;
CInifile* CInifile::Create(const char* szFileName, BOOL ReadOnly)
{ return xr_new<CInifile>(szFileName,ReadOnly); }
void CInifile::Destroy(CInifile* ini)
{ xr_delete(ini); }
bool sect_pred(const CInifile::Sect *x, L... | TOOL | 0.946819 | 4.286688 |
0fe4adb7-355a-4d67-b4a0-a440e4d6030b | jiyapalrecha35/Google.github.io | codes/quadtree.cpp | // Definition for a QuadTree node.
class Node {
public:
bool val;
bool isLeaf;
Node* topLeft;
Node* topRight;
Node* bottomLeft;
Node* bottomRight;
Node() : val(false), isLeaf(false), topLeft(nullptr), topRight(nullptr), bottomLeft(nullptr), bottomRight(nullptr) {}
Node(bool _va... | ALGO | 0.999747 | 6.554048 |
a286d9f0-bb56-4523-ba35-16575e3e466d | Carlosma7/Fundamentos-de-Programacion | Sesion 15/Cuadrado.cpp | /***************************************************************************/
// FUNDAMENTOS DE PROGRAMACIN
// GRADO EN INGENIERA INFORMTICA
//
// CURSO 2015-2016
// (C) CARLOS MORALES AGUILERA
//
// Sesin 14
// Ejercicio Cuadrado
//
/***************************************************************************/
#incl... | ALGO | 0.993924 | 3.755484 |
3d57ed25-5bd2-4e55-bd0f-c26571f8d664 | cvdong/Ncnn_deploy | Source/src/layer/mips/sigmoid_mips.cpp | #include "sigmoid_mips.h"
#if __mips_msa
#include <msa.h>
#include "msa_mathfun.h"
#endif // __mips_msa
#include "mips_usability.h"
#include <math.h>
namespace ncnn {
Sigmoid_mips::Sigmoid_mips()
{
#if __mips_msa
support_packing = true;
#endif
}
int Sigmoid_mips::forward_inplace(Mat& bottom_top_blob, const Op... | ALGO | 0.993691 | 5.903913 |
e4221c98-5c67-40dc-8a57-558f443e082d | joysarkar18/code-chef-problems- | Divisible_by_3.cpp | #include<bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[])
{
int t;
cin>>t;
for(int i= 0 ; i< t ; i++){
int a , b;
cin>>a>>b;
int d = 0;
while(a%3!=0 and b%3!=0){
if(a<=b){
b=abs(a-b);
}
else{
... | ALGO | 0.999919 | 4.048124 |
ffcc97e1-6792-4afb-827e-b95ddb1cbff7 | Keshav1707/Submissions | B_Array_Recoloring.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define di(x) \
ll x; \
cin >> x
#define vecll vector<ll>
#define sz(x) ((int)(x).size())
#define pb push_back
#define po pop_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define endl "\n"... | ALGO | 0.999801 | 4.829239 |
af3bf3e4-090d-4ff9-836d-9444de4b6245 | wooyn730/Problem-Solving | 프로그래머스/0/181862. 세 개의 구분자/세 개의 구분자.cpp | #include <string>
#include <vector>
using namespace std;
vector<string> solution(string myStr) {
vector<string> answer;
vector<int> jump;
myStr = 'a' + myStr + 'a';
for (int i=0; i<myStr.length(); i++)
if (myStr[i] == 'a' || myStr[i] == 'b' || myStr[i] == 'c')
jump.push_back(i... | ALGO | 0.999046 | 4.056721 |
415e91f0-4c21-49fa-b9b8-c26a0035e8aa | torgiren/szkola | semestr_6/genetyczne/03/mysga.cpp | /******************************************************************************/
/* Ten plik, kazdy moze sobie zorganizowac po swojemu */
/* Prosze tylko ustawic ponizsze dwie definicje: */
/* - pierwsza defincja to nazwisko osoby lub nazwiska grupy piszacej kod ... | ALGO | 0.963529 | 5.736473 |
22e05dbe-aad2-4008-951f-1fefa7c9fee7 | luv2027/cp_problems | cp65.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int n, m;
cin >> n >> m;
vector< int > a(m);
for(int i=0; i<m; i++){
cin >> a[i];
}
long long c = a[0] -1;
for(int i=0; i<m-1; i++){
if(a[i+1] < a[i]){
c += n - a[i] + a[i+1];
}
else if(a[... | ALGO | 0.999926 | 3.392993 |
02cf99ff-db0d-409a-b807-a402bffd9cac | ishandutta2007/codeforces | joisino/normal/492/A.cpp | #include <bits/stdc++.h>
#define FOR(i,a,b) for( int i = (a); i < (int)(b); i++ )
#define REP(i,n) FOR(i,0,n)
#define YYS(x,arr) for(auto& x:arr)
#define ALL(x) (x).begin(),(x).end()
#define SORT(x) sort( (x).begin(),(x).end() )
#define REVERSE(x) reverse( (x).begin(),(x).end() )
#define pb emplace_back
#define mp ma... | ALGO | 0.999972 | 3.954509 |
75ed99ae-9c0a-4b42-a7d9-b20402f74bf3 | rquispeg/phpdesktop | phpdesktop-msie/random.cpp | // The srand2_mix() function is by Jonathan Wright:
// http://stackoverflow.com/a/323302/623622
// The random() function is by Ryan Reich:
// http://stackoverflow.com/a/6852396/623622
// The code was modified a bit.
// The random() fallback is by Mark B:
// http://stackoverflow.com/a/5009006/623622
#include "random.... | TOOL | 0.986251 | 6.046931 |
3912b506-b205-4003-a692-54f3ee45cc7c | anmamun0/cp-problem-solving-zone | Week_2/Week2_Practive/Day_4/L_Array_Cloning_Technique.cpp | #include <bits/stdc++.h>
typedef long long ll;
#define vec vector<int>
#define loop(i,s,n) for (int i = s; i <n; i++)
#define asort(v) sort(v.begin(), v.end())
#define rsort(v) sort(v.begin(), v.end(),greater<>())
#define isEven(x) (x%2 == 0)
#define yes cout << "YES\n"
#define no cout << "NO\n"
#define enter cout << ... | ALGO | 0.999863 | 5.000419 |
0ee50257-73cd-4b95-a775-03813e67691f | Mareamkhaled/stop_watch | 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 |
658a7949-e48a-422e-bc2e-2f0f9f612ae8 | KellyFrog/OI-sources | codeforces/contest/1142/c/c.cpp | /*
* Author: ChenKaifeng@codeforces
* Create Time: 2023.06.17, 21:08:$%s$ (UTC +8)
*/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pf push_front
#define rep(i, s, t) for (int i = s; i <= t; ++i)
#define per(... | ALGO | 0.999722 | 4.911072 |
5dbce899-934f-480c-bb9a-f3a8f73e4e3c | xuda25/C-study | blog/graph.cpp | #include <iostream>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <queue>
using namespace std;
class GraphAdjMat
{
public:
GraphAdjMat(const vector<int>& ver, const vector<vector<int>>& edges) : vertices(ver), adjMat(edges) {}
/*获取顶点个数 */
int size() const
{
retu... | ALGO | 0.999617 | 4.911826 |
4f992710-d179-4354-91e3-2b1998c5a925 | cuzoaru90/cube-scrambler | Game.cpp | #include <iostream>
#include <string>
#include <fstream>
#include <vector>
#include <algorithm>
#include "Cube.h"
#include "Solver.h"
#include "Match.h"
using namespace std;
// Check mystery word to see if it can be solved by scrambler.
void checkStrings(string x, vector<Cube> y, vector<Match> z)
{
int letterIndex ... | TOOL | 0.966946 | 4.244605 |
2317df02-d6de-4aea-b400-4910c0c6f647 | BaoSiZe-bot/luogu-codes | P_2486_SDOI_2011_染色.cpp | #include <algorithm>
#include <cassert>
#include <cstdio>
#include <utility>
using ll = long long;
const ll INF = 2e11;
const int N = 2e5 + 5, M = 4e5 + 5;
struct Edge
{
int v, p;
} e[M];
int ed[N], cnt;
inline void add(int u, int v)
{
e[++cnt] = {v, ed[u]};
ed[u] = cnt;
}
struct dat
{
int l, r;
l... | ALGO | 0.999988 | 4.574925 |
e468cd3c-4803-4668-99f7-ed411b62d014 | satyamgupta0202/Interview-Preparation | 40-combination-sum-ii/40-combination-sum-ii.cpp | class Solution {
public:
vector<vector<int>>ans;
void solve(vector<int>&a, int target , vector<int>&path , int indx , int sum){
if(sum == target){
ans.push_back(path);
return;
}
if(sum>target || indx>a.size())
{
return;
} ... | ALGO | 0.999977 | 5.421854 |
c260bd00-f69c-4848-9ed2-1e7b1a06db9e | avplayer/proxy | third_party/boost/libs/compute/perf/perf_set_symmetric_difference.cpp | #include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>
#include <boost/compute/system.hpp>
#include <boost/compute/algorithm/set_symmetric_difference.hpp>
#include <boost/compute/container/vector.hpp>
#include "perf.hpp"
int rand_int()
{
return static_cast<int>((rand() / double(RAND_MAX)) ... | ALGO | 0.965528 | 6.411322 |
7a38bbf8-367c-4c20-a48e-8f44d43ca588 | DhavalMavani/DSA_Leetcode | 0032-longest-valid-parentheses/0032-longest-valid-parentheses.cpp | class Solution {
public:
int longestValidParentheses(string s) {
int n=s.size(),left=0,right=0,ans=0;
for(int i=0;i<n;i++){
if(s[i]=='(') left++;
else right++;
if(right>left) left=0,right=0;
else if(left==right) ans=max(ans,2*right);
}
... | ALGO | 0.999679 | 6.038258 |
21d12997-5ea0-4a48-acd3-755dd3297055 | JoseRFJuniorLLMs/SelfDrivingCar | CarND-Model-Predictive-Control-P10-master/src/Eigen-3.3/bench/spbench/test_sparseLU.cpp | // Small bench routine for Eigen available in Eigen
// (C) Desire NUENTSA WAKAM, INRIA
#include <iostream>
#include <fstream>
#include <iomanip>
#include <unsupported/Eigen/SparseExtra>
#include <Eigen/SparseLU>
#include <bench/BenchTimer.h>
#ifdef EIGEN_METIS_SUPPORT
#include <Eigen/MetisSupport>
#endif
using namesp... | ALGO | 0.995585 | 4.273294 |
8f087d72-0411-48be-9273-dc9a8589f716 | Rahulverma0711/Codeforces-Codechef-Solutions | A_Arithmetic_Array.cpp | //जय हिन्द
//Jai Hind
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
typedef pair<int, int> pii;
typedef pair<ll, ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpii;
typedef vector<pl> vpl;
typedef vector<vi> vvi;
typedef ve... | ALGO | 0.999383 | 3.895411 |
4f8d1334-4c67-4131-a5c8-377e14a0e724 | WickedNekomata/NekoEngine | Source/MathGeoLib/include/Geometry/Line.cpp | /** @file Line.cpp
@author Jukka Jylnki
@brief Implementation for the Line geometry object. */
#include "Line.h"
#include "Ray.h"
#include "LineSegment.h"
#include "../Math/float3x3.h"
#include "../Math/float3x4.h"
#include "../Math/float4x4.h"
#include "OBB.h"
#include "../Math/Quat.h"
#include "Frustum.h"
#include ... | ALGO | 0.986525 | 6.769594 |
160eee01-e638-47b9-94bb-39881d646349 | saifurrahman1701/Algorithm | Math/Matrix Exponentiation/o1_ME_recursive.cpp | /*
* Author: BrownFalcon
*/
//Time Complextiy: O(k^3 * log n) ; where we have a k*k matrix
//Space Complextiy: O(k^3 * log n)
#include<bits/stdc++.h>
using namespace std;
struct matrix {
int mat[2][2];
};
matrix mul(matrix A, matrix B) {
matrix C;
for(int row = 0; row<2; row++) {
for(int col = 0... | ALGO | 0.999892 | 3.798828 |
ea883169-b3a1-44d6-b8a4-01681c8cfea6 | gapiyka/ASD-Labs | Lab1.cpp | #include <stdio.h>
int main()
{
// 4x^2 + 2 x (-15; 3]
//y=
// 3x^3 / 4 - 5 x (-N; -30] U (20; +N)
float input;
float y_value = 0;
printf("Please input your X-number\n");
scanf_s("%f", &input);
if (input > -15) {
if (input <= 3) {
y_value = (4 * inp... | ALGO | 0.999719 | 4.108925 |
98717b82-2ddf-40c8-8028-fd0fe5b54cdb | SanD94/CodeChef | chefdete.cpp | #include <iostream>
using namespace std;
int main(){
int N, report;
cin >> N;
int *arr = new int[N+1];
for(int i=0;i<N;i++){
cin >> report;
arr[report]++;
}
int res = 0;
for(int i=0;i<=N;i++)
if(!arr[i]) cout << i << " ";
cout << endl;
return 0;
}
| ALGO | 0.999753 | 3.243186 |
7f8e955c-ca0e-410b-b779-29f0ffdd6040 | GhostFrankWu/SUSTech_CS205_C-Cpp_2020F | Assignments/A3_dotProduct/read.cpp | #include "dot.h"
#include<fstream>
/*****************************************************************************
˴ļΪڰ汾ʹãռɵİ汾пԺӣ
ǶTXTļв³
====sizeofɷͨ궨Ż
¼¼˳ĺʱTΪԵλ
**********************************************************************************/
struct vectous {
float v;
}vec[2];
char ch_in[129];
vectous& operator>... | ALGO | 0.927873 | 3.46765 |
7247f7ba-d363-46a6-ab12-ac7a647a3317 | nikhilsharma-github/DSA-Solved-Problems | Binary Search/CountOccurencesOfOneInBinaryArray_GFG.cpp | #include <bits/stdc++.h>
using namespace std;
#define deb(x) cout << #x << "=" << x << endl
void parray(int a[], int n)
{
for (int i = 0; i < n; i++)
{
cout << a[i] << " ";
}
cout << endl;
}
int countoccurences(int a[],int n,int x,int l,int r)
{
cout<<"x is : "<<x<<endl;
while(l<=r)
... | ALGO | 0.999428 | 4.862022 |
c8ca35f0-334e-410c-b45f-88182a9797c3 | koreasunoo/algorithm | baekjoon/10870.cpp | #include <bits/stdc++.h>
#include <vector>
using namespace std;
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
vector<int> v(25);
int n;
cin>>n;
n++;
v.at(1) = 0;
v.at(2) = 1;
if(n<=2){
cout<<v.at(n);
}
else{
for(int i = 3; i<=n; i++){
v.at(i) = v.at(i-1) + v.at(i-2);
}
cou... | ALGO | 0.999992 | 3.805302 |
75b18665-7daa-4784-9e6b-8d8cab0d23bb | rishi058/CP-DSA | CSES/04_Graph Algorithms/28_Mail Delivery.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define all(v) v.begin(), v.end()
#define F(a,b,i) for (int i = a; i < b; i++)
#define Rev(a,b,i) for (int i = a; i >= b; i--)
#define RISHI ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
template <typename dStruct>
void print(dStruct& vName)... | ALGO | 0.999974 | 4.263705 |
b9c21dce-2f9e-487c-8865-1e2a6f85829b | Irumyuui/knowledge-tree-for-xcpc | 数学/筛法/埃筛.cpp | #include <bits/stdc++.h>
template <std::size_t N>
std::pair<std::bitset<N>,std::vector<int>> GetPrimeList() {
using i64 = int64_t;
std::bitset<N> no_prime{};
std::vector<int> prime;
no_prime[0] = no_prime[1] = 1;
for (int i = 2; i < no_prime.size(); i ++) {
if (!no_prime[i]) {
p... | ALGO | 0.999722 | 4.098085 |
4ab6fec9-90e9-4a03-8c31-20995cc802b2 | sanjaykukreti136/leetcode-solutions | 124-binary-tree-maximum-path-sum/124-binary-tree-maximum-path-sum.cpp | /**
* Definition for a binary tree node.
* 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), l... | ALGO | 0.999974 | 6.241447 |
546b7af5-51a9-4ea9-a663-4cb2a57f5158 | ujjwald7/C--Templates | LCA_Template_Binary Lifting.cpp | const int maxm = 2*1e5+5; //nodes in graph
// 000000000000000 - based indexing
vector<vector<int>>graph,up;
int enter[maxm],leave[maxm];
int timer,n,l;
void dfs(int v, int p)
{
enter[v] = timer;
timer++;
up[v][0] = p;
for (int i = 1; i <= l; ++i)
up[v][i] = up[up[v][i-1]][i-1];
for (in... | ALGO | 0.999881 | 4.538721 |
cc749faf-2c1a-4915-ba67-f87969068fdc | JosteinDagestad/BaliWeb | BaliCode/opencv-4.x/3rdparty/openexr/IlmImf/ImfHuf.cpp | //-----------------------------------------------------------------------------
//
// 16-bit Huffman compression and decompression.
//
// The source code in this file is derived from the 8-bit
// Huffman compression and decompression routines written
// by Christian Rouet for his PIZ image file format.
//
//-----------... | ALGO | 0.992111 | 6.422013 |
90eac99f-561b-4132-a29c-fa8be121a57c | shruti380/DSA-SOLUTION | Difficulty: Medium/Smallest Divisor/smallest-divisor.cpp | class Solution {
public:
int smallestDivisor(vector<int>& arr, int k) {
// Code here
int n=arr.size();
int l=1;
int maxEle=*max_element(arr.begin(),arr.end());
int h=maxEle+k;
int ans=h;
while(l<=h){
int mid=l+(h-l)/2;
int cnt=0;
... | ALGO | 0.999951 | 4.896758 |
bcd770c1-9642-4da7-869c-9b64f1b0af19 | vipinkarthic/My-Cp-journey | 2107A.cpp | #include<bits/stdc++.h>
using namespace std;
#define mod (1000000007)
#define INF INT_MAX
#define FOR(a, c) for (int(a) = 0; (a) < (c); (a)++)
#define FORL(a, b, c) for (int(a) = (b); (a) <= (c); (a)++)
#define FORR(a, b, c) for (int(a) = (b); (a) >= (c); (a)--)
typedef long long int ll;
typedef vector<int> vi;
t... | ALGO | 0.999821 | 3.718431 |
80e96d8a-b688-479d-80d9-4916b5195f91 | wang12d/ProgrammingPractices | OJ/uva12627.cpp | #include <iostream>
#include <vector>
using std::vector;
using std::cin;
using std::endl;
using std::cout;
using ll = long long;
ll
f(int k, int i)
{
if (i == 0) {
return 0;
}
if (i == 1) {
return 1 << k;
}
if (k == 0) {
return 1;
}
if (i & 1) {
return f(k-... | ALGO | 0.999232 | 3.830961 |
f0e9034a-b2ca-4237-854d-5b861c793f09 | ShucunZhao/Leetcode | C++/17Hot100(TopLiked)/994RottingOranges/solwithBFS&counting.cpp | class Solution {
public:
int orangesRotting(vector<vector<int>>& grid) {
int m = grid.size();
int n = grid[0].size();
// cout<<"m:"<<m<<endl;
// cout<<"n:"<<n<<endl;
int fresh = 0;
queue<pair<int,int> > Q;
for(int i=0;i<m;i++){
for(int j=0;j<n;j++)... | ALGO | 0.999949 | 5.871122 |
99c68c11-f3df-4447-9b74-86324fd6a177 | ameliasaurus/CSE1342 | Exercises/Functions/FunctionCalls_Key/Q_11/main.cpp | //Exercise1_FunctionCalls_Key
//Question 11
/*
E. int truncateDecimal(float decimal);
Write some code in which you call and appropriately utilize function E.
*/
#include <iostream>
using namespace std;
int truncateDecimal(float decimal);
int main() {
float decimal = 2.7451;
int noDecimal = truncateDecimal(de... | ALGO | 0.989362 | 4.499093 |
d1fb4950-316d-4ed0-8c9c-ed7c73766e3e | Nih1tGupta/Leetcode-GFG | Basic/First and last occurrences of X/first-and-last-occurrences-of-x.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
vector<int> firstAndLast(vector<int> &arr, int n, int x) {
vector<int>v;
for(int i=0;i<n;i++){
if(arr[i]==x)
v.push_back(i);
}
if(v.empty... | ALGO | 0.99984 | 6.058031 |
cd2729b4-af14-4480-9bee-35b9048ff998 | sonapraneeth-a/competitive-programming_submissions | platforms/binarysearch/practice/medium/178__postfix-notation-evaluation/solutions.cpp | // clang-format off
/**
* FILE DESCRIPTION
*
* Filename: 178__postfix-notation-evaluation/solutions.cpp
* Created on: 05 September 2021
* Last modified: 05 September 2021
* Author: sonapraneeth_a
* Description: BinarySearch submission for 'Postfix Notation Evaluation' problem
*/
/**... | ALGO | 0.999945 | 5.918669 |
c5c4bd05-ca3a-4a20-8f3b-caecc1256482 | pswalia2u/Cprog_placements | recursion_factorial/main.cpp | #include <iostream>
using namespace std;
void fact(int no,int f,int i)
{
if(i>0)
{
f=f*i;
i--;
fact(no,f,i);
}
else{
cout<<"factorial="<<f;
}
}
int main()
{
int no;
cout<<"Enter the no:";
cin>>no;
fact(no,1,no);
return 0;
}
| ALGO | 0.999793 | 3.707094 |
d9134dcb-9865-44b1-973e-1dbe1bbfdabc | NeoMaster831/CodeStuff | BOJ/Google Kickstart 2020 Round A/O.CPP | #include <iostream>
#include <algorithm>
using namespace std;
#define int long long
int N, B, A[100001];
int solve() {
cin >> N >> B;
for (int i = 1; i <= N; i++) {
cin >> A[i];
}
sort(A + 1, A + N + 1);
int ans = 0;
for (int i = 1; i <= N; i++) {
if (B < A[i]) break;
... | ALGO | 0.999853 | 4.914514 |
db82a243-5408-4d9d-b72c-219ca0b8aa11 | Nemo21/Random-Bullshit-Go | CodeForces Questions/CodeForces First 100/WaterMelon.cpp | #include <iostream>
#include <string>
using namespace std;
int main(){
int weight;
cin>>weight;
if(weight==2){
cout<<"NO";
return 0;
}
if(weight%2==0){
weight=weight/2;
if(weight%2==0){
cout<<"YES";
return 0;
}
else{
... | ALGO | 0.999944 | 3.41647 |
a42364be-0508-455a-ac31-3709ed18be6b | gun5046/algorithmStudy | 17281.cpp | #include <iostream>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <algorithm>
#include <utility>
#include <cstring>
#include <string>
#include <sstream>
#include <math.h>
#include <list>
#include <deque>
#include <vector>
using namespace std;... | ALGO | 0.999921 | 3.552877 |
97e97b62-cb78-41f2-a290-73dc566a06fc | kakitgogogo/leetcode | 315.cpp | #include<iostream>
#include<vector>
#include<cstdlib>
using namespace std;
struct BST
{
int val;
int count;
BST *left,*right;
BST(int v,int c=0,BST *l=NULL,BST *r=NULL):
val(v),count(c),left(l),right(r){}
};
void insert(BST *&root,int num,int &ret)
{
if(root==NULL)
{
root=new BST(num);
return;
}
if(num>... | ALGO | 0.99997 | 4.43045 |
bcd86c69-48c9-43f5-8126-39f45eb0205f | majkimge/CompetitiveProgrammingCode | jtm21/main.cpp | #include <bits/stdc++.h>
#define lld long long
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define MAX 20009
#define INF 1000000
#define MOD 255
using namespace std;
lld dp[100];
lld poty[100];
lld f(lld n){
if(n==0)return 1;
if(n%2==0)return 4*f(n/2)-n-3;
return f(n-1) + 2... | ALGO | 0.999909 | 3.990846 |
ba651ab7-f995-4173-90a6-c045a8e19b01 | Glory-Day/Solutions | Baekjoon/Cpp/1086.cpp | #include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
int n, k;
ll cache1[16][3];
ll cache2[51];
ll map[35001][101];
ll gcd(ll a, ll b) {
return b == 0 ? a : gcd(b, a % b);
}
ll dfs(int a, int b) {
if (a == (1 << n) - 1) return b == 0;
if (map[a][b] != -1) return map[a][b]... | ALGO | 0.999965 | 4.702493 |
6035e0ca-5bfb-42df-b523-e718f36d5432 | Thomas9191/mycode | src/boss.cpp | #include <iostream>
#include <fstream>
#include <array>
#include <vector>
#include <cstdlib>
#include <ctime>
#include <string>
#include <sstream>
#include <cassert>
#include <set>
#include <map>
#define INF 0x7FFFFFFF
#define P std::pair<int,int>
struct Point {
Point() : Point(0, 0) {}
Point(float x, float y) ... | ALGO | 0.997681 | 5.01895 |
f8ef980c-41ed-4649-a1a4-232378b1f894 | Blaster2398/DSA | Graphs/BFS-DFS-adj_list/BFS_disconnected.cpp | //here we are basically computing the number of edges in a adj list therefore
//the time compexity of the prog is O(V+E) the V is there so as to ger the
//coernor case when none of the node is connected
#include<bits/stdc++.h>
using namespace std ;
//this is for ndirected graphs
void addEdge(vector<int> adj[], int ... | ALGO | 0.999714 | 5.774574 |
2c251dec-7965-4332-bac9-4d5fbef05ffc | voldigoad-7/leetcode-gfg-solutions | 45-jump-game-ii/45-jump-game-ii.cpp | class Solution {
public:
int jump(vector<int>& nums) {
int current=0;
int farthest=0;
int jumps=0;
for(int i=0;i<nums.size()-1;i++)
{
farthest=max(farthest,i+nums[i]);
if(i==current)
{
current=farthest;
... | ALGO | 0.999978 | 6.037666 |
22f15162-738c-4c8b-b9c8-1ab1b1999583 | Infinities-pro/Infinities | third_party/mlas/lib/sgemm.cpp | #include "mlasi.h"
//
// Define the number of rows from matrix A to transpose to a local buffer.
//
// N.B. AVX processes a maximum of 4 rows, FMA3 processes a maximum of 6
// rows, and AVX512F processes a maximum of 12 rows.
//
#define MLAS_SGEMM_TRANSA_ROWS 12
//
// Define the parameters to execute se... | ALGO | 0.985552 | 6.118332 |
fe45a2b1-bbd1-4274-b449-d923e1143e31 | Fahim-2001/Problem-Solving | Codeforce/A Problems/HQ9+_133A.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
string p;
bool m = false;
cin >> p;
for (int i = 0; i < p.size(); i++)
{
if (p[i] == 'H' || p[i] == 'Q' || p[i] == '9')
{
m = true;
break;
}
}
if (m)
{
cout << "YES" << en... | ALGO | 0.998298 | 4.055997 |
24fdd316-d696-4c0a-9355-5ebc8e5e212f | ishandutta2007/codeforces | potassium/normal/1465/B.cpp | #pragma GCC optimize ("O3", "unroll-loops")
//#pragma GCC target ("avx2")
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define all(x) (x... | ALGO | 0.999795 | 4.550392 |
fa878ed4-0768-4cd1-9857-ded2f0790de5 | jgndev/structy-2024 | cpp/tree_includes/src/solution.cpp | #include "solution.h"
bool Solution::treeIncludes(Node *root, std::string target) {
// early return if the root node is nullptr.
if (root == nullptr) {
return false;
}
// stack for storing the nodes.
std::stack<Node *> stack;
// push the root node onto the stack.
stack.push(root);
// while the s... | ALGO | 0.999521 | 6.411924 |
fd2f5752-cd93-4d78-b3e3-61086f5069d6 | AhsanAyub/parallel_programming | OpenMP/min_max.cpp | #include <iostream>
#include <stdlib.h>
#include <omp.h>
using namespace std;
const int n = 1000000000;
int main(int argc, char* argv[])
{
// Compute the run time
double start_time = omp_get_wtime();
if (argc < 2)
{
cerr << "Usuage: ./program <No. of Thread>" << endl;
return -1;
}
// S... | ALGO | 0.999921 | 3.7528 |
987de471-1449-4061-89be-a25de02104f6 | hashoak/Leetcode-Solved | 2542@maximum-subsequence-score.cpp | class Solution {
public:
long long maxScore(vector<int>& n1, vector<int>& n2, int k) {
vector<pair<int,int>> v;
for(int i=0;i<n1.size();i++) v.emplace_back(n2[i],n1[i]);
sort(v.begin(),v.end(),greater{});
long long s=0;
priority_queue<int,vector<int>,greater<int>> pq;
... | ALGO | 0.999973 | 4.859065 |
8a0906f5-c0dd-434a-a953-e128b13b3a3f | mbfibat/cses-solution | Solutions/CSES 1112/main.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
const int mod = 1e9 + 7;
int n, m;
string s;
vector<int> p(111);
void build_pre()
{
for (int i = 1; i < m; i++)
{
int cur = p[i - 1];
while (cur > 0 && s[cur] != s[i])
cur = p[cur - 1];
p[i] = cur + (s[cur] == s[i]);
}
}
int aut[111]... | ALGO | 0.999973 | 5.069862 |
b8bef0ea-6ef5-4989-9189-aed349ae8cbb | XiaohanLei/GaussNav | GaussianConstruction/diff-gaussian-rasterization-w-depth/third_party/glm/test/core/core_func_matrix.cpp | #include <glm/ext/matrix_relational.hpp>
#include <glm/ext/matrix_transform.hpp>
#include <glm/ext/scalar_constants.hpp>
#include <glm/mat2x2.hpp>
#include <glm/mat2x3.hpp>
#include <glm/mat2x4.hpp>
#include <glm/mat3x2.hpp>
#include <glm/mat3x3.hpp>
#include <glm/mat3x4.hpp>
#include <glm/mat4x2.hpp>
#include <glm/mat... | TEST | 0.911778 | 6.702728 |
d0422e4a-50ba-41bc-9cd8-e7e3ea297cde | alifalhasan/CP-code-vault | Codeforces/Educational Round/Educational Codeforces Round 68 (Rated for Div. 2)/B - Yet Another Crosses Problem/57059712.cpp | #include<bits/stdc++.h>
using namespace std;
#define S scanf
#define P printf
#define G getline
#define SZ size()
#define C clear()
#define B begin()
#define F front()
#define T top()
#define E end()
#define EM empty()
#define V vector
#define Q queue
#define DQ deque
#define PQ priority_queue
#define ST stack
#define ... | ALGO | 0.999505 | 4.528371 |
0559af56-8139-4b8a-9c93-fd4ee3f01d0c | ihabawad18/problem-solving-questions | Cses/Inroductory/Chessboard_and_Queens.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<vector<int>> vvi;
typedef vector<vll> vvll;
typedef vector<pair<int, int>> vpi;
typedef vector<vpi> vvpi;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;... | ALGO | 0.999595 | 4.585166 |
e9d788f7-f7b6-4475-bcd6-8520654bbdac | zenki209/DSA-Framework-and-LeetCode | LeetCode Solving/Logic/maxArea.cpp | class Solution {
public:
int maxArea(vector<int>& height) {
int result = INT_MIN;
int left = 0;
int right = height.size() - 1;
// When we decrease the width => must keep the higher height
// because area ~ height and width
while(left < right){
int area = m... | ALGO | 0.999976 | 6.927091 |
b448cbe2-a094-4a93-a13d-d1a941f52bbf | cahnz1/CMSC-435 | proj2/hide.cpp | #include "trace.h"
#include <string>
#include <sstream>
#include <fstream>
#include <iostream>
#include <getopt.h>
#define cimg_display 0
#include "CImg.h"
#ifdef __APPLE__
#define MAX std::numeric_limits<double>::max()
#else
#include <values.h>
#define MAX DBL_MAX
#endif
using namespace cimg_library;
using namespace... | ALGO | 0.997693 | 4.230505 |
2dbe38f2-8e0c-4970-94da-bdd7d8b4e78e | yzzupgo/MFTCG | Data/abc170_b/dante23/wa/14309796.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <iomanip>
#include <list>
#include <queue>
#include <stack>
#include <map>
#define modulus 1000000007
#define ll long long
using namespace std;
int main(){
int x, y;
cin... | ALGO | 0.999912 | 3.151875 |
310d437c-896e-4f44-8f0f-717e4f3bbb9b | FeiZhan/Algo-Collection | answers/leetcode/Remove Duplicates from Sorted List II/Remove Duplicates from Sorted List II.cpp | //@result 166 / 166 test cases passed. Status: Accepted Runtime: 12 ms Submitted: 2 minutes ago You are here! Your runtime beats 8.24% of cpp submissions.
// 2014-12-24
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
... | ALGO | 0.999981 | 5.675779 |
f42006e0-e5bb-4446-93a4-820e3c805741 | aminjonshermatov/competitive_programming | atcoder/arc/140/A.cpp | #include <bits/stdc++.h>
#ifdef LOCAL
#include "debug.hpp"
#else
#define dbg(...) 42
#endif
constexpr void scan(auto&& ... args) noexcept { (std::cin >> ... >> args); }
constexpr void print(auto&& ... args) noexcept { ((std::cout << args << ' '), ...); }
constexpr void println(auto&& ... args) noexcept { print(std::f... | ALGO | 0.999985 | 5.164011 |
cd7dee66-a4c6-48d9-91ae-c70f8a25f3b6 | frejur/aoc-2024-cpp | source/day_16/maze.cpp | #include "maze.h"
#include "keys.h"
#include "path.h"
#include <array>
namespace {
bool pos_is_xy(
size_t pos, int x, int y, int w)
{
return static_cast<int>(pos) == (y * w) + x;
}
} // namespace
constexpr std::array<int, 4> aoc24_16::Maze::dir_flags_;
aoc24_16::Maze::Maze(
std::unique_ptr<aoc24::Dyn_bitset... | ALGO | 0.988612 | 6.266333 |
12843149-eec6-4562-b9c3-8c666f7ffddc | milkyway20021012/Leetcode | two-pointers/merge-sorted-array.cpp | class Solution {
public:
void merge(vector<int>& nums1, int m, vector<int>& nums2, int n) {
int end1 = m - 1;
int end2 = n - 1;
int index = m + n - 1;
while(end1>=0 && end2>=0){
if(nums1[end1] > nums2[end2]){
nums1[index--] = nums1[end1--];
}
... | ALGO | 0.99997 | 5.353912 |
e015c9b1-d7ec-4657-ad9a-625c04443116 | Manku-Vignesh/Cryptography-and-Network-Security-CSA5117 | 2.Monoalphabetic Caesar Cipher.cpp | #include <stdio.h>
#include <string.h>
#include <ctype.h>
void monoalphabeticSubstitution(char *plaintext, char *ciphertext, char *key) {
int i;
int len = strlen(plaintext);
for (i=0; i < len; i++) {
if(isalpha(plaintext[i])) {
char currentChar = tolower(plaintext[i]);
int index = currentChar-'a';
ciphertext[i... | ALGO | 0.999166 | 3.755336 |
180dbd47-e332-49da-ba5a-f8b2337ae81b | soleilwd/CppLab | CppLab/Permutation.cpp | /*
* Permutation.cpp
*
* Created on: Aug 7, 2014
* Author: smart
*/
#include <vector>
#include <algorithm>
#include <iostream>
using namespace std;
int nextChoice(const std::vector<bool>& v)
{
std::vector<bool>::const_iterator iter = std::find(v.begin(), v.end(), false);
if (iter==v.end())
return -1;
... | ALGO | 0.999251 | 5.396998 |
dcf1d8dd-6e0f-4b2b-b75f-32d834ef0ce5 | kkmk11/Codes_CPP | SafeNodes_BFS.cpp | // There is a directed graph of n nodes with each node labeled from 0 to n - 1. The graph is represented by a 0-indexed 2D integer array graph where graph[i] is an integer array of nodes adjacent to node i, meaning there is an edge from node i to each node in graph[i].
// A node is a terminal node if there are no outg... | ALGO | 0.999992 | 5.171261 |
3ad274f4-043c-4786-af14-7af519197794 | NazarSmith228/Competitive_Programming | Solved Problems/Першокласники/algo.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
long long n,m;
cin >> n >> m;
if(m == 1 && n % 6 == 0)
{
cout << "Life is business";
return 0;
}
if(m % 6 == 0){
... | ALGO | 0.999906 | 3.036611 |
a609d323-72db-4b1b-8e5c-3da6a57b0ee9 | IreGambara/Projects_CPP | C++_Module02/ex03/main.cpp | #include <iostream>
#include "Fixed.hpp"
#include "Point.hpp"
bool bsp(Point const a, Point const b, Point const c, Point const point);
int main(void)
{
Point a(Fixed(0), Fixed(0));
Point b(Fixed(10), Fixed(0));
Point c(Fixed(10), Fixed(10));
std::cout << bsp(a, b, c, Point(Fixed(9), Fixed(9))) << std::endl;
re... | ALGO | 0.987746 | 5.060069 |
12714609-07db-4f49-90eb-7206ac942706 | anuragmukherjee2001/test | Assignment 6/Fimdimg_volume_of_shapes.cpp | #include<iostream>
using namespace std;
int volume(int a){
return a * a * a;
}
int volume(int a, int b){
return 2 * (a * b);
}
int volume(int a, int b, int c){
return a * b * c;
}
int main(){
// cout << "Hello world" << endl;
int a, b, c, d, e, f;
cout << "Enter the length, breadth and heigh... | TOOL | 0.920751 | 3.157362 |
2bcef01e-fd8d-422f-9845-e53977d52a02 | viftode4/Code-Forces | A - Life of a Flower/main.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int t = 0;
cin >> t;
while (t--) {
int n, x, ant=-1;
cin >> n;
int start = 1;
while(n--)
{
cin>>x;
if(start!=-1)
{
if(ant==x&&x==1)
sta... | ALGO | 0.999916 | 3.914761 |
a254b8b6-6e88-475f-af07-ee887c53fc18 | snowholt/ParticlePhysicsSimulation | Octree.cpp | #include "Octree.hpp"
#include <immintrin.h> // Add this for AVX intrinsics
Octree::Octree(const char* name) {
// Implementation of Octree constructor
}
bool Octree::checkCollision(const __m256& position, float radius) const {
// Implementation of collision detection
return false;
}
| ALGO | 0.954776 | 6.978069 |
04aa9216-ca56-4385-be0c-5ad5af99e593 | bhargavbijjam/DSA-LeetCode | 0908-middle-of-the-linked-list/0908-middle-of-the-linked-list.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
ListNode* middleNode(... | ALGO | 0.999854 | 5.8769 |
5f4ca2f5-9d3c-46f8-a703-9f97b6b7a08c | umar-07/Competitive-Programming-questions-with-solutions | SIMPSTAT/main.cpp | #include <bits/stdc++.h>
#include<iomanip>
using namespace std;
int main()
{
int t;
cin >> t;
while(t--)
{
int n, k;
cin >> n >> k;
int arr[n];
for(int i=0; i<n; i++)
cin >> arr[i];
sort(arr, arr+n);
for(int i=0; i<k; i++)
arr[i]=0... | ALGO | 0.999759 | 3.472882 |
6138419c-371d-44e1-a062-232ff91ef8c4 | yasoobkamili/ugv_ws | src/ugv_else/gmapping/openslam_gmapping/particlefilter/particlefilter_test.cpp | #include <stdlib.h>
#include <iostream>
#include <fstream>
#include "particlefilter.h"
using namespace std;
#define test(s) {cout << s << " " << flush;}
#define testOk() {cout << "OK" << endl;}
struct Particle{
double p;
double w;
inline operator double() const {return w;}
inline void setWeight(double _w) {w=_w... | ALGO | 0.998156 | 4.032654 |
839642a8-7371-474c-9a83-b9ea119fae00 | Pedro-Mendes/competitiveProgramming | leetcode/topInterviewQuestions/easy/intersectionArrays.cpp | /* https://leetcode.com/problems/intersection-of-two-arrays-ii/submissions/
git@Pedro-Mendes */
class Solution {
public:
vector<int> intersect(vector<int>& nums1, vector<int>& nums2) {
map <int,int> m;
vector<int> answer;
for(int i=0; i<nums1.size();i++){
m[nums1[i]] +=1;
... | ALGO | 0.999971 | 5.764127 |
14ea0774-4d02-407f-9a13-d19fd9c579ea | VBITproject/vbit | src/crypto/sha1.cpp | #include "crypto/sha1.h"
#include "crypto/common.h"
#include <string.h>
// Internal implementation code.
namespace
{
/// Internal SHA-1 implementation.
namespace sha1
{
/** One round of SHA-1. */
void inline Round(uint32_t a, uint32_t& b, uint32_t c, uint32_t d, uint32_t& e, uint32_t f, uint32_t k, uint32_t w)
{
... | ALGO | 0.998309 | 7.495188 |
6a58d9ec-9a62-4bf4-ab79-5b689164612c | adityaa30/programs | Divide And Conquer/MaxSubarraySum.cpp | #include <bits/stdc++.h>
#include <limits.h>
#define li long long int
using namespace std;
li MaxSubarraySum(li arr[], li n) {
li maxEndingHere = 0, maxSoFar = 0;
for(li i = 0; i < n; ++i) {
maxEndingHere = arr[i];
if (maxEndingHere < 0) maxEndingHere = 0;
if(maxSoFar < maxEndingHere) ... | ALGO | 0.999936 | 5.199354 |
d0ea99cf-cf96-4aa5-94c2-5de32cd7a9e2 | Showrov-CoU/Codeforces-Solution | A_Madoka_and_Math_Dad.cpp | #include <bits/stdc++.h>
using namespace std;
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define PI 2*acos(0.0)
#define ll long long int
#define ull unsigned long long int
#define yes cout<<"YES"<<endl
#define no ... | ALGO | 0.999964 | 3.909793 |
e53e3d52-6365-4814-b3b8-a0fd92cac1a2 | adib3552/codeforce | Reverse Madness.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int t;
cin>>t;
while(t--){
int n,k;
cin>>n>>k;
string s;
cin>>s;
int l[k],r[k];
for(int i=0; i<k; i++){
cin>>l[i];
}
for(int i=0; i<k; i++){
cin>>r[i];
}
... | ALGO | 0.999986 | 3.739065 |
0521265f-6c1a-4842-ad8a-dcdf03f452b8 | MousamS26/CODECHEF | NOPAL.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
#ifndef ONLINE_JUDGE
freopen("in.txt", "r", stdin);
freopen("out.txt", "w", stdout);
#endif
int tt = 1;
cin >> tt;
while (tt--)
{
int n, x(0);
cin >> n;
for (int i = 0; i < n; i++)
{
if (x == 26)
x = 0;
cout << char(x + 97);
x++;
... | ALGO | 0.999502 | 4.022337 |
6f702898-58a5-4cb3-9fe2-f46362ce3b56 | T-Ageishi/AtCoder | support/technique/ユークリッドの互除法.cpp | #include <bits/stdc++.h>
using namespace std;
int count = 0;
/**
* 最大公約数を返す
*/
long long euclidean(long long A, long long B) {
// ベースケース
if (B == 0) {
return A;
}
// 再帰ステップ
return euclidean(B, A % B);
}
long long gcd(long long A, long long B) {
while (A >= 1 && B >= 1) {
if (A < B) {
B =... | ALGO | 0.99981 | 4.930558 |
070c1dcb-931f-4146-a25b-3a164962b900 | vigneshsnaik/leetcode-solutions | 0019-remove-nth-node-from-end-of-list/0019-remove-nth-node-from-end-of-list.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
ListNode* removeNthFr... | ALGO | 0.999965 | 5.976926 |
933d3d3a-f0da-42e6-b595-e3732a20477e | xzhseh/translation-validator | alive2_snapshot/tools/alive.cpp | #include "smt/smt.h"
#include "smt/solver.h"
#include "tools/alive_parser.h"
#include "util/config.h"
#include "util/file.h"
#include "util/version.h"
#include <cstdlib>
#include <iostream>
#include <string_view>
#include <vector>
using namespace IR;
using namespace tools;
using namespace util;
using namespace std;
s... | TOOL | 0.97496 | 6.033531 |
104dec95-0617-41d7-b4ca-532ac0ed5e84 | DevendraRahangdale/DSA-CPP | Assignment4.cpp | #include<iostream>
using namespace std;
int binarySearch(int a[],int low,int high,int x){
int mid=low+(high-low)/2;
while(low<=high){
if(a[mid]<x){
low=mid+1;
}
else if(a[mid]==x){
return mid;
}
else{
high=mid-1;
}
mid=(low+high)/2;
}
... | ALGO | 0.999882 | 4.804881 |
52db7b13-8a93-4339-b6d4-d644329094cd | rafid211/online-judge-solution | codeforces/A. Expression.cpp | #include <bits/stdc++.h>
using namespace std;
#define i64 long long
#define input freopen("input.txt", "r", stdin)
#define output freopen("output.txt", "w", stdout)
#define fast_io ios_base::sync_with_stdio(0);cin.tie(0);
#define mp make_pair
#define pii pair<int,int>
#define pss pair<string,string>
#define fi first
#d... | ALGO | 0.999854 | 3.873652 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.