uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
4fd42e7b-c626-4fa0-a6fe-612a2e82b9d2 | Taohid0/C-and-C-Plus-Plus | test 1002/main.cpp | #include <bits/stdc++.h>
using namespace std;
bool prime[100001] = {false};
void isPrime(){
prime[0] = true;
prime[1] = true;
for(int i = 2;i*i<=100000;i++){
if(!prime[i]){
for(int j = i*i;j<=100000;j+=i){
... | ALGO | 0.999035 | 4.212573 |
2789e7ea-2ec8-42c0-95a6-854cce4d3f2c | ghdeo/solved.ac | 1912.cpp | #include <iostream>
#include <vector>
using namespace std;
int main(){
int n;
cin >> n;
vector<int> v(n);
for(int i=0; i<n; i++)
cin >> v[i];
vector<int> d(n);
d[0]=v[0];
for(int i=1; i<n; i++){
d[i]=v[i];
if(d[i]<d[i-1]+d[i])
d[i]+=d[i-1];
}
... | ALGO | 0.999838 | 3.688046 |
0a88e29f-c252-4b00-9729-c3f46ae139da | clark-ethan9595/CS112 | lab9/BST.cpp | /* BST.cpp defines binary search tree methods.
* Joel Adams, for CS 112 at Calvin College.
* Student Name: Ethan Clark
* Date: April 21, 2015
*/
#include "BST.h"
/*
* Constructor for BST Class
* Set myRoot (which is a Node) to NULL
* Set myNumItems to 0
* Created by Ethan Clark
* April 22, 2015
* Lab9 for C... | ALGO | 0.999072 | 5.795239 |
14807256-2888-4bc0-a46b-adaa28a08f09 | Vishal7698/C-and-C-plus-plus-codes | Marvellous Infosystems C++ Programs/Function_Template2.cpp | #include<iostream>
#include<conio.h>
using namespace std; //global namespace std
template <class T> //template syntax
T division(T num1,T num2) // c++ function template
{
T ans; //t... | ALGO | 0.877454 | 4.357038 |
cee4b7db-861f-4ab2-a243-a36ede4b4bab | Rahul-kumar-Pandey/DSA | stack&queues/LFU.cpp | /*
##LFUCache(int capacity) Initializes the object with the capacity of the data structure.
##int get(int key) Gets the value of the key if the key exists in the cache. Otherwise, returns -1.
##void put(int key, int value) Update the value of the key if present, or inserts the key if not already present.
When the ca... | ALGO | 0.999386 | 6.184536 |
2a8191b3-aca0-4608-bf23-6f4c61fd94df | 0-jij-0/CompetitiveProgramming | Problems Archive/0000 - 0999/0693 - Circles.cpp | #include <iostream>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
typedef long long ll;
struct Frac {
ll num, denum; Frac() {}
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
Frac(ll _n, ll _d) {
ll g = gcd(abs(_n), abs(_d));
num = abs(_n) / g; denum = abs(_d) / g;
if ((_n < ... | ALGO | 0.9997 | 5.184546 |
41817bfd-7fab-42bd-85d7-fdad27b90603 | Justpenz233/ConformableMechanism | Engine/ThirdParty/libigl/tutorial/610_CSGTree/get_mesh.cpp | #include "get_mesh.h"
#include <igl/copyleft/cgal/CSGTree.h>
void get_mesh(
const Eigen::MatrixXd &VA,
const Eigen::MatrixXi &FA,
const Eigen::MatrixXd &VB,
const Eigen::MatrixXi &FB,
const Eigen::MatrixXd &VC,
const Eigen::MatrixXi &FC,
const Eigen::MatrixXd &VD,
const Eigen::MatrixXi ... | ALGO | 0.986889 | 6.235878 |
e6e2ae0e-3478-4c1f-81f9-11ae40aea931 | NaserAnjum21/HackerRank-Codes | Algorithms/DP/Kingdom Division.cpp | #include <bits/stdc++.h>
#define LL long long
using namespace std;
const int N = 1e5 + 5;
const LL mod = 1e9 + 7;
int n, u, v;
vector<int> adj[N];
vector<bool> vis(N, 0);
LL dp[N][2];
void dfs(int u)
{
vis[u] = 1;
LL s0 = 1, s1 = 1;
for (int v : adj[u])
{
if (vis[v])
continue;
... | ALGO | 0.999884 | 4.918314 |
99b92865-427a-482d-b29e-76c88aeae255 | lurenjia399/games202homework | hw2/Assignment2/prt/ext/eigen/doc/examples/Tutorial_BlockOperations_corner.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace std;
int main()
{
Eigen::Matrix4f m;
m << 1, 2, 3, 4,
5, 6, 7, 8,
9, 10,11,12,
13,14,15,16;
cout << "m.leftCols(2) =" << endl << m.leftCols(2) << endl << endl;
cout << "m.bottomRows<2>() =" << endl << m.bottomRows<2>() << endl << ... | ALGO | 0.998592 | 4.092313 |
c8474a99-004c-46c3-aa78-0564a658e46f | sheyua/LAMMPS-QTB | src/fix_tmd.cpp | /* ----------------------------------------------------------------------
Contributing authors: Paul Crozier (SNL)
Christian Burisch (Bochum Univeristy, Germany)
------------------------------------------------------------------------- */
#include "mpi.h"
#include "math.h"
#include "stdlib.... | ALGO | 0.995352 | 6.120679 |
d0c678e2-d00e-41f5-9066-2529c41b0e6f | JHRobotics/mesa9x | mesa-23.1.x/src/amd/compiler/aco_scheduler.cpp | #include "aco_builder.h"
#include "aco_ir.h"
#include "common/amdgfxregs.h"
#include <algorithm>
#include <unordered_set>
#include <vector>
#define SMEM_WINDOW_SIZE (350 - ctx.num_waves * 35)
#define VMEM_WINDOW_SIZE (1024 - ctx.num_waves * 64)
#define POS_EXP_WINDOW_SIZE 512
#define SMEM_MAX_MOVES (64 - ... | ALGO | 0.997324 | 4.254158 |
6db98992-84e6-4b03-a2f6-a532045a3c8c | shivamk2745/CP | targetPractice.cpp | #include<bits/stdc++.h>
#include <iostream>
using namespace std;
int helper(int n,int m ,vector<vector<char>>& mat){
int cnt=0;
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
if(mat[i][j]=='X'){
int dist = min({i, j, n - i - 1, m - j - 1});
cnt += (dist + 1);
... | ALGO | 0.998987 | 5.386782 |
fbce66e3-5f5e-4f17-8b9d-3aa555aad250 | ishandutta2007/codeforces | karry5307/normal/1264/B.cpp | #include<bits/stdc++.h>
using namespace std;
typedef int ll;
const ll MAXN=1e5+51;
ll pos;
ll x[4],y[4],res[MAXN];
inline ll read()
{
register ll num=0,neg=1;
register char ch=getchar();
while(!isdigit(ch)&&ch!='-')
{
ch=getchar();
}
if(ch=='-')
{
neg=-1;
ch=getchar()... | ALGO | 0.999972 | 3.019325 |
5a37549b-da56-4085-a62c-80ace2dea209 | aprochoi/flutter_prac | download_test/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.998278 | 6.785645 |
587e9304-c8bd-40a6-8c58-234c9cf80010 | cdh-hub/leetcode | 623.在二叉树中增加一行.cpp | /*
* @lc app=leetcode.cn id=623 lang=cpp
*
* [623] 在二叉树中增加一行
*/
// @lc code=start
/**
* 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)... | ALGO | 0.999989 | 6.865132 |
bee4f857-e763-425e-8193-3f0a7f670d47 | augmate/augmate-libzxing-cpp | core/src/zxing/common/reedsolomon/ReedSolomonDecoder.cpp | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
#include <iostream>
#include <memory>
#include <zxing/common/reedsolomon/ReedSolomonDecoder.h>
#include <zxing/common/reedsolomon/ReedSolomonException.h>
#include <zxing/common/IllegalArgumentException.h>
#include <zxing/IllegalStateException.h>... | ALGO | 0.999518 | 6.508055 |
a21290ff-4984-460b-851a-32e10df01212 | RecStore/RecStore | third_party/gpudirect-nvme/include/freestanding/libcxx/test/std/algorithms/alg.sorting/alg.min.max/max_element.pass.cpp | // <algorithm>
// template<ForwardIterator Iter>
// requires LessThanComparable<Iter::value_type>
// Iter
// max_element(Iter first, Iter last);
#include <algorithm>
#include <random>
#include <cassert>
#include "test_macros.h"
#include "test_iterators.h"
std::mt19937 randomness;
template <class Iter>
void
t... | TEST | 0.938168 | 6.164785 |
28aca10b-68b5-4654-99e1-ff2173909dfb | vallagenakisu/my-github | new codes/chemistry.cpp | #include <bits/stdc++.h>
#define f(i, n) for (int i = 0; i < n; i++)
using namespace std;
void sol()
{
int n, k;
cin >> n >> k;
string a;
cin >> a;
// cout << a << endl;
map<char, int> mp;
for (int i = 0; i < a.size(); i++)
{
mp[a[i]]++;
}
int odd = 0, even = 0;
for (... | ALGO | 0.999969 | 4.541658 |
a52b8801-2d46-4c6a-91b2-22ad42dd4ed2 | mudit870/LeetCode | 11-container-with-most-water/11-container-with-most-water.cpp | class Solution {
public:
int maxArea(vector<int>& height) {
int left=0,right=height.size()-1,area=0;
while(left<right){
area=max(area,min(height[left],height[right])*(right-left));
if(height[left]>height[right])
right--;
else
left++... | ALGO | 0.999949 | 6.517665 |
68adbbae-8713-45fd-a3a3-41c7fc2b962d | ishandutta2007/codeforces | zlt1117/normal/1438/F.cpp | #pragma GCC optimize(4)
#include<bits/stdc++.h>
#define FOR(i,a,b) for(int i=a;i<=b;++i)
#define REP(u) for(int i=p[u];i!=-1;i=e[i].nxt)
#define ll long long
#define rd (rand()<<16^rand())
#define PII pair<int,int>
#define pb push_back
#define sz(x) (int)(x.size())
#define gc getchar()//(_p1==_p2&&(_p2=(_p1=_buf)+fread... | ALGO | 0.999934 | 3.122535 |
f12cc100-784e-4d8f-8f05-49b36795a8ca | YoganshWagh/Leetcode | 1897-redistribute-characters-to-make-all-strings-equal/Approach_3.cpp | class Solution {
public:
bool makeEqual(vector<string>& words) {
//Approach 3: Using STL.
int count[26] = {0};
int n = words.size();
for( string x : words )
for( char y : x ) count[y -'a']++;
//& is used to access all outside values in lambda function.
... | ALGO | 0.999876 | 5.960031 |
f37f8ee6-40f4-4ec5-8005-346905b7623b | tmsnn/ADS2022 | LAB8/test.cpp | #include <iostream>
#include <unordered_set>
#include <vector>
using namespace std;
long long MOD = 1011148561;
long long X = 31;
int main() {
string s;
cin >> s;
vector<long long> p_pows(s.size());
p_pows[0] = 1;
for (int i = 1; i < s.size(); i++) {
p_pows[i] = (p_pows[i - 1] * X) % MOD;
}
vector<... | ALGO | 0.999956 | 4.55709 |
8837d3cc-b2db-4a03-9c12-6bdb2baedd1f | qquynh217/DSA | bo_sung_phan_tu.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll P = 1e9 + 7;
int main()
{
int t;
cin >> t;
while (t--)
{
int n;
cin >> n;
int a[10000];
for (int i = 0; i < n; i++)
cin >> a[i];
sort(a, a + n);
int dem = 0;
fo... | ALGO | 0.99966 | 4.224399 |
e0a3f6fd-8a82-42b0-bd15-36f2f97e1fe9 | bfcool200299/Fish-Tank | z/Drivers/CMSIS/NN/Examples/ARM/arm_nn_examples/gru/arm_nnexamples_gru.cpp | /**
* @ingroup groupExamples
*/
/**
* @defgroup GRUExample Gated Recurrent Unit Example
*
* \par Description:
* \par
* Demonstrates a gated recurrent unit (GRU) example with the use of fully-connected,
* Tanh/Sigmoid activation functions.
*
* \par Model definition:
* \par
* GRU is a type of recurrent neura... | ALGO | 0.940227 | 7.464193 |
632bc5a6-6141-4433-87a4-379c36f17cd7 | 2mulin/brushQuestion | LeetCode/algorithm/901_1000/919_inserter.cpp | /**
* @date 2022/7/25
* @author 2mu
* @brief medium 完全二叉树插入器
*
* 1. 实现insert
* 完全二叉树:出最后一层之外,其它每一层都是满的节点。现在要求是插入一个节点之后,
* 仍然保持完全二叉树的结构。
*
* 有条规律,即完全二叉树的最后一个非叶子节点在数组的位置。
*
* 时间复杂度:构造是层次遍历O(N), insert操作是O(1)
* 空间复杂度:O(N)
*
* 2. 优化空间
* 1. 数组没必要记录所有的节点。只需要用队列按顺序记录**没有完整左右孩子的节点**。每次取出队列首元素,补充其孩子节点。若是左... | ALGO | 0.999967 | 6.271132 |
8876a65b-e560-42b0-8b33-c5bb95d4e3f5 | ishandutta2007/codeforces | for_the_love/normal/346/A.cpp | #include <map>
#include <cmath>
#include <queue>
#include <cstdio>
#include <vector>
#include <cstring>
#include <sstream>
#include <iostream>
#include <algorithm>
using namespace std;
int n, g, a[105];
int gcd(int a, int b){if (!b) return a; return gcd(b, a % b);}
int main(){
scanf("%d", &n);
for (int i = 1;... | ALGO | 0.999969 | 4.009638 |
89734ddd-8e7f-4122-9634-bea29b0d80d9 | Signior-X/cp | binary_search/bisect_multiset.cpp | #include <bits/stdc++.h>
using namespace std;
int main () {
multiset<int> ms;
ms.insert(5);
ms.insert(13);
multiset<int>::iterator it = ms.upper_bound(4);
cout << *it << "\n";
return 0;
} | ALGO | 0.999879 | 4.175621 |
8861fe36-e04f-4b82-91f2-18d046de0bb7 | Sid532001/c-c- | fvwf.cpp | #include<iostream>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--)
{
int x,y,n,z;
cin>>x>>y>>n;
int count=0;
if((0<=z<=x && (x^z)<(y^z)))
{
count++;
cout<<count;
}
}
return 0;
}
| ALGO | 0.999632 | 3.471393 |
ee2604c1-7663-4c61-8580-0005e8d6c139 | kurrrru/library_checker | datastructure/point_add_range_sum/implicit_treap.cpp | #include <iostream>
#include <cassert>
#include <vector>
struct monoid_sum_add
{
static long long query_op(long long a, long long b)
{
return (a + b);
}
static long long query_id()
{
return (0);
}
static long long update_op(long long a, long long b)
{
return (a + b);
}
static long long update_id()
{
... | ALGO | 0.999901 | 5.448079 |
053a5d62-51df-4b3e-84ce-69b4a330889d | Xuding0829/CompetitiveProgramming | Src/Acwing/蓝桥杯C++AB组辅导课/第一讲 递归与递推/递归实现组合型枚举.cpp | #include <bits/stdc++.h>
// #include <iostream>
// #include <algorithm>
#define int long long
using namespace std;
const int N = 100;
int n, m;
bool st[N];
int way[N]; // 存储方案
/*
1.0版本 —— 未进行剪枝
void dfs(int u, int start)
{
if (u > m)
{
for (int i = 1; i <= m; i++)
cout << way[i] << ' '... | ALGO | 0.999957 | 3.825866 |
a43a6f6c-fa8c-4e55-b261-b61b3c527414 | luiz-marcio-faria-de-aquino-viana/memorizacao_dinamica_de_traces_com_reuso_de_valores_de_instrucoes_de_acesso_a_memoria | reuso-2.0.4-20000819/supersim-dtm/disq.cpp | #include<stdio.h>
#include"all.h"
/////////////////////////////////////////////////////////////
///// CDisqItem
void CDisqItem::SetItem(CIDec _idec)
{
*((CIDec*) this) = _idec;
}
CDisqItem& CDisqItem::operator=(CDisqItem& _di)
{
*((CIDec*) this) = *((CIDec*) & _di);
RedundantInst = _di.RedundantInst;
TraceDa... | TOOL | 0.852133 | 4.247758 |
0330d703-743a-4042-92b3-059bc23f1aa5 | shamikh1014/code | lastIndexOfX.cpp | #include<iostream>
using namespace std;
int lastIndexOfX(int a[], int size, int x){
if(size==0){
return -1;
}
if(a[size-1]==x){
return size-1;
}
int smallAns=lastIndexOfX(a, size-1, x);
return smallAns;
}
int main(){
int n;
cin>>n;
int a[100];
for(int i=0;i<n... | ALGO | 0.99977 | 5.716851 |
c2b1c26b-54b4-42e9-9c52-a70d6ae8eff3 | gpospelov/BornAgain | Fit/Kernel/Kernel.cpp | // ************************************************************************************************
//
// BornAgain: simulate and fit reflection and scattering
//
//! @file Fit/Kernel/Kernel.cpp
//! @brief Implements class Kernel.
//!
//! @homepage http://www.bornagainproject.org
//! @license GNU General ... | TOOL | 0.933556 | 6.732647 |
d6b3e434-307e-4a02-9bdb-1947ad4781de | igasa-KCompetitiveProgramming/Atcoder | ABC315/c.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pint = pair<int,int>;
using pll = pair<long long, long long>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i,n) for (int i = 1; i <= (int)(n); i++)
#define YesNo(bool) if(bool) cout << "Yes" << endl; else cout << "No" << end... | ALGO | 0.999965 | 3.861134 |
898f2551-b9c4-4556-920a-0741184b26f8 | K0nnyaku/Code | Data/CSP-JS2021二轮提高组数据/SD-00303/airport/airport.cpp | #include<iostream>
#include<cstring>
#include<string>
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;
const int INF=0x3f3f3f;
long long n,mm1,mm2;
long long a[100010],b[100010];
long long x[100010],y[100010];
long long sum,num,ans;
long long fa,fx;
long long enda[100010],endx[100010];
long lon... | ALGO | 0.999819 | 3.11902 |
d51c31fb-1e18-46f5-af89-d030fb4637b3 | sh-sho1kat/CODEFORCES | Micro1 Contest #12/A_easy.cpp | #include <bits/stdc++.h>
using namespace std;
// 2025-05-15 21:25:33
#define fastio ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
#define mod 1000000007
#define inf (1LL << 62)
#define all(x) x.begin(), x.end()
#define eb push_back
#define ff first
#define ss second
#define yes cout << "YES" << nl
#d... | ALGO | 0.999843 | 4.180248 |
94a73588-3c38-4be7-8c73-4ffc932753c8 | Niteshsingh102005/FOCP | Assignment - Cpp/Question-1.cpp | // question 1
#include <iostream>
using namespace std;
//prototype
void Factors(int n);
void NextPrime(int n);
void Prime(int n);
void Prime(int n) {
if(n <= 1){
cout<<"The number is not prime :"<<n<< endl;
return;
}
for (int i=2;i<=n / 2;i++) {
if (n%i== 0) {
cout<<"this number ... | ALGO | 0.99671 | 4.078772 |
10dfcf73-22c7-4ec6-ae2c-b986e5c5415d | passagemath/upstream-gfan | src/app_tropicalhomotopy.cpp | /*
* app_tropicalhomotopy.cpp
*
* Created on: Jan 16, 2015
* Author: anders
*/
#include <assert.h>
#include "gfanlib_circuittableint.h"
#include "parser.h"
#include "printer.h"
#include "gfanapplication.h"
#include "log.h"
#include "myassert.h"
typedef gfan::CircuitTableInt32 mvtyp;
#include "gfanlib_tro... | ALGO | 0.96212 | 3.949662 |
c49519d1-1a6c-4962-945c-d00a38668278 | ankitapal1804/Ds_Algo | rearrange array in O(1) extra space.cpp | #include<bits/stdc++.h>
using namespace std;
void arrange(long long arr[], int n) {
int m=n;
for(int i=0;i<n;i++)
{
arr[i]=arr[i]+(arr[arr[i]]%m)*m;
}
for(int i=0;i<n;i++)
{
arr[i]=arr[i]/m;
}
}
int main(){
int t;
cin>>t;
while(t--){
int n;
... | ALGO | 0.999933 | 3.266794 |
ff84727c-4994-4f8e-8ba4-59156ef98285 | yash2411-cmd/placement_prep | greedy/boats_to_save_people.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution
{
public:
int numRescueBoats(vector<int> &people, int limit)
{
sort(people.begin(), people.end());
int low = 0;
int n = people.size();
int high = n - 1;
int count = 0;
while (low <= high)
{
... | ALGO | 0.999973 | 5.681919 |
47ee00b4-58c4-433d-b548-a878a6e4a55e | TacticalMeow/animation-fun | igl/copyleft/cgal/points_inside_component.cpp | #include <CGAL/AABB_tree.h>
#include <CGAL/AABB_traits.h>
#include <CGAL/AABB_triangle_primitive.h>
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include <cassert>
#include <list>
#include <limits>
#include <vector>
namespace igl {
namespace copyleft
{
namespace cgal {
namespace poin... | ALGO | 0.999336 | 7.418013 |
0a6ce2f8-e59e-4d36-a7c5-fd6691203e52 | ishandutta2007/codeforces | rama_pang/normal/1399/D.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(0);
cin.tie(0), cout.tie(0);
int T;
cin >> T;
while (T--) {
int n;
cin >> n;
string s;
cin >> s;
vector<int> ans(n);
int cur = 0;
for (int i = 0; i < n; i++) {
if (s[i] == '0') {
ans[i] ... | ALGO | 0.999975 | 4.461302 |
8dfa3bf8-7921-4a79-8b2d-2f66ff38171f | ishandutta2007/codeforces | ivan100sic/normal/292/E.cpp | #include <cstdio>
#include <cstring>
#include <algorithm>
#define MAXN 131072
#define OFFS 131071
using namespace std;
struct cvor{
int farba,vreme,rmc;
};
cvor Tree[2*MAXN];
int tm;
void farbaj(int l,int r,int boja){
tm++;
l+=OFFS;
r+=OFFS;
while (l<=r){
while (l%2==0 && Tree[l/2].rmc <... | ALGO | 0.999864 | 3.613864 |
17b2aafc-29c1-40d3-b82d-8f6af0b36f35 | cyrxdzj/CYRXDZJ-OI-01 | std/tree/tree_testlib_validator3.cpp | #include "testlib.h"
using namespace std;
const int MAXN=1e5,MAXA=1e9,MAXC=(1<<6)-1;
int n;
int cfa[MAXN+5];
int find_cfa(int x)
{
if(x==cfa[x])
{
return x;
}
return cfa[x]=find_cfa(cfa[x]);
}
int main(int argc, char* argv[]) {
registerValidation(argc, argv);
n=inf.readInt(1,MAXN,"n");
inf.readEoln();
for(i... | ALGO | 0.999191 | 3.716678 |
bc19266d-72c7-4329-8fec-36a4d2ab21e4 | j03m/cpp-practice | dynamic/recursive-perms.cpp | #include <iostream>
#include <string>
#include <unordered_set>
using namespace std;
unordered_set<string> getPermutations(const string& inputString){
unordered_set<string> permutations;
cout << "input: " << inputString << "\n";
if (inputString.length() <= 1){
//when our algo break down strings, eve... | ALGO | 0.99981 | 5.753432 |
eb8c9049-4874-4d88-b89a-8e6d29e0cd6e | junghyeonsu/algorithm-cpp | CodeUp/1075.cpp | //CodeUp 1075
#include <iostream>
using namespace std;
int main() {
int a;
scanf("%d", &a);
while (a != 0) {
printf("%d\n", --a);
}
return 0;
} | ALGO | 0.999802 | 3.633358 |
f1e086c5-735b-432c-936d-e2ed4007612c | jaiswalsandeep508/Ds-Algo-practice | Recursion/n^p/power.cpp | #include<iostream>
using namespace std;
int power(int n, int p)
{
if(p==0)
{
return 1;
}
int prevpower=power(n, p-1);
return n*prevpower;
}
int main()
{
int n,p;
cout<<"Enter the value of n and p: ";
cin>>n>>p;
cout<<endl<<"n^p: "<<power(n,p);
return 0;
} | ALGO | 0.99986 | 5.334041 |
1898a661-0f3c-4bec-9e06-8466313a8c08 | Mohd-3/Codeforces-Solutions | Normal/1245/A.cpp | #include <bits/stdc++.h>
#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
const int INF = 0x3f3f3f3f;
const double pi = acos(-1);
using ll = long long;
using namespace std;
int t, a, b;
int main() {
scanf("%d", &t);
while (t--) {
scanf("%d%d", &a, &b);
if (__... | ALGO | 0.999079 | 4.910294 |
ce00ee47-e4cf-4cb6-8501-3e43b2af9bd1 | adityajamwal02/CSES_ProblemSet | Mathematics/Exponentiation.cpp | /// CSES : Exponentiation
#include<bits/stdc++.h>
using namespace std;
long long mod=1e9+7;
long long power(long long a, long long b){
if(b==0) return 1;
if(b%2==0){
return ((power(a,b/2)%mod)*(power(a,b/2)%mod))%mod;
}else{
return (a*(power(a,b-1)%mod))%mod;
}
}
int main(){
int ... | ALGO | 0.999906 | 4.632911 |
279054d7-8627-4088-9fd9-10fad1d1ddd9 | JJJIEYYDS/- | daimaqu/atcoder/abc/312/E.cpp | #include<iostream>
#include<cstring>
#include<algorithm>
#include<iomanip>
#include<vector>
#include<map>
#include<queue>
#include<set>
#include<cmath>
using namespace std;
typedef pair<int,int> PII;
typedef pair<long long,long long> PLL;
typedef long long ll;
const int N=150,INF=0x3f3f3f3f,mod=998244353;
int n,m,k;... | ALGO | 0.999613 | 3.879514 |
f69a8d39-b692-4424-bd45-6ec0bcb7eb4d | behitek/acm-epu | SPOJ/cpp/spoj/classical/AMZSEQ.cpp | #include <algorithm>
#include <cstdio>
#include <cstring>
#include <deque>
#define m2 std::make_pair
typedef std::pair<int, int> p2;
int a[1010][3];
int main() {
//freopen("input.txt", "r", stdin);
int n;
scanf("%d", &n);
a[1][0] = a[1][1] = a[1][2] = 1;
for (int i = 2; i <= n; ++i) {
a[i][0] = a[... | ALGO | 0.999911 | 3.027145 |
05142c13-7608-495b-b3c3-88b638461d23 | itsadityakr/daily-code-challenge | day-10/_45_find_the_middle_element_of_linked_list.cpp | // https://leetcode.com/problems/middle-of-the-linked-list/description/
#include<bits/stdc++.h>
#define endl "\n"
using namespace std;
struct Node {
int data;
Node* next;
Node(int data) {
this->data = data;
next = nullptr;
}
};
Node* middleNode(Node* head) {
if (head == nullptr) r... | ALGO | 0.999944 | 5.263588 |
60997539-ecb2-4bab-ac56-88cbdcd85924 | vinci-grape/Rectifier | output/ChatGPT/codenet/Java/C++/s321216487.cpp | #include <iostream>
#include <string>
using namespace std;
int main() {
string S;
cin >> S;
string begin;
string end;
string answer;
for (int i = 0; i < S.length(); i++) {
for (int j = 0; j < S.length(); j++) {
begin = S.substr(0, i);
end = S.substr(j, S.length... | ALGO | 0.9999 | 3.53843 |
c03bfa84-90af-46e7-9563-21a00233bf0b | NewUU-CS111-Fall2023/week-6-recursion-and-heap-sort-Jorabekisoqov | src/Task4.cpp | #include <iostream>
#include <cmath>
using namespace std;
static int checker=2;
void CheckIfPrime(int a, int check){
if(a==2){
cout<<"YES";
return;
}
if(a%check==0){
cout<<"NO";
return;
}
if(check> ::sqrt(a)){
cout<<"YES";
return;
}
CheckIfPrime(a,check+1)... | ALGO | 0.99939 | 4.398664 |
f923fcb1-d259-431a-ba6d-2886f14265f6 | thebird-/ts-stream-server-client | boost_1_61_0/libs/spirit/example/qi/compiler_tutorial/calc6.cpp | ///////////////////////////////////////////////////////////////////////////////
//
// Yet another calculator example! This time, we will compile to a simple
// virtual machine. This is actually one of the very first Spirit example
// circa 2000. Now, it's ported to Spirit2.
//
// [ JDG Sometime 2000 ] pre-boo... | ALGO | 0.997027 | 7.720603 |
6b88e00f-a0da-469a-8704-4739f013e366 | Livinfly/AlgorithmPromble_Code | USACO/Chapter4/1007-街头竞速@@@@.cpp | #include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <vector>
using namespace std;
const int N = 55;
int n;
bool g[N][N], st1[N], st2[N];
vector<int> res1, res2;
inline void dfs(int u, int p, bool st[])
{
st[u] = true;
for(int i = 0; i <= n; i ++)
if(g[u][i] && !st[i] && i ... | ALGO | 0.999132 | 3.423038 |
79dc92d6-5033-4c6a-825a-63abf706cf84 | Piash-Akbar/DSA_Practices | Arrays and Vectors/SortingAlgorithms/NextPermutation.cpp | // lt code prob 31
#include<iostream>
#include<vector>
#include <bits/stdc++.h>
using namespace std;
// lexicography
void nextPermutation(vector<int> &A){
// find the pivot
int pivot = -1, n=A.size();
for(int i = n-1; i>=0;i--){
if(A[i]<A[i+1]){
pivot = i;
break;
... | ALGO | 0.999988 | 4.738581 |
afef622e-784f-4494-b44a-86f4f52ecab0 | rk94655/cppCode | SlidingWindow/maxSumSubarrayOfSizekSecondApproach.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int arr[] = {5,1,8,3,4};
int n = sizeof(arr)/sizeof(int);
int k=3;
vector<int> ans;
int i=0,j=0;
int sum=0,maxsum=0;
int t=0;
while(j<n)
{
sum+=arr[j];
if(j-i+1==k)
{
maxsum = max(maxsum,sum);
sum-=arr[i];
i++;
}
j++;
}
cout << ma... | ALGO | 0.999869 | 3.949423 |
ac40dc63-2c4a-45f6-b569-77ce5b43caf2 | Demopeu/Algorithm_Study_songjeong | Algorithm/10Week(2024.03.28 ~ 2024.04.03)/Implementation/C++/Baekjoon_10828_김동현.cpp | #include <iostream>
#include <string>
// c++은 stack 모듈이 있다
// top,size,pop,push,empty,swap 자동 탑재
//swap은 두 스택의 내용을 바꾸고 싶을 때 사용
#include <stack>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cout.tie(0); cin.tie(0);
stack<int> stacks;
int N,answer;
string mission;
cin >> N;
for (int i = 0... | ALGO | 0.999534 | 4.663273 |
0862fe15-fd94-4762-a7ba-d08f6701e34a | vidsinghal/Cornucopia | HashEnabledLLVM/compiler-rt/lib/tsan/rtl/tsan_fd.cpp | #include "tsan_fd.h"
#include "tsan_rtl.h"
#include <sanitizer_common/sanitizer_atomic.h>
namespace __tsan {
const int kTableSizeL1 = 1024;
const int kTableSizeL2 = 1024;
const int kTableSize = kTableSizeL1 * kTableSizeL2;
struct FdSync {
atomic_uint64_t rc;
};
struct FdDesc {
FdSync *sync;
int creation_tid;
... | TOOL | 0.851921 | 6.933522 |
a5c9bd16-d5da-43a2-ad22-84708deeb2ee | cyb3rb34s7/Leetcode-prog | 54-spiral-matrix/54-spiral-matrix.cpp | class Solution {
public:
vector<int> spiralOrder(vector<vector<int>>& a) {
int m=a.size() ,n=a[0].size() ;
int startRow=0,startCol = 0 ,endRow = m-1,endCol = n-1 ;
vector<int> res ;
while(startRow<=endRow and startCol<=endCol){
//print first row
... | ALGO | 0.99999 | 5.563591 |
60af139c-dd9a-4dfc-9525-0af83cb53cff | pastgonex/Algorithm_Ultimate | NX数据结构/06_栈.cpp | #include <iostream>
using namespace std;
const int N = 1e3 + 10;
int stack[N];
int n;
int tt = 0;
int main(void)
{
printf("请输入要存入几个数: ");
scanf("%d", &n);
for (int i = 0; i < n; i++)
scanf("%d", &stack[tt++]);
printf("初始化成功!\n");
int judge = 1;
while (tt != 0 && judge)
{
... | ALGO | 0.986434 | 3.954738 |
430df7aa-0bc1-4de9-9c79-08aabfa48704 | ami-megarac/OSSW-LTS-v13 | Core/UnModified_OpenSource/mariadb-10.3/mariadb-10.3-10.3.31/extra/yassl/src/yassl_imp.cpp | /* yaSSL source implements all SSL.v3 secification structures.
*/
#include "runtime.hpp"
#include "yassl_int.hpp"
#include "handshake.hpp"
#include "asn.hpp" // provide crypto wrapper??
#include <my_attribute.h>
namespace yaSSL {
namespace { // locals
bool isTLS(ProtocolVersion pv)
{
if (pv.major_ >= 3 && p... | ALGO | 0.890616 | 7.404325 |
c414b827-a31e-4848-8077-5ef7e078c7f5 | Danielbook/TNG033_-_Programmering_i_C- | Lectures/Lecture13/exemple2.cpp | /***************************************************************************
* TNG033: F 13 *
* 1. Read a sequence of user given integers *
* 2. Store the user given values in a list, but without repeated values *
* 3. Display ... | ALGO | 0.999883 | 5.158606 |
b01563a8-5248-44cb-9aa3-32aa8ae4a909 | Yeonho-Lee/2024-Algorithm-Study | yoonsang/Week 08/acmicpc11478.cpp | #include <iostream>
#include <string>
#include <unordered_set>
using namespace std;
string temp, slice;
unordered_set<string> m;
int cnt=0;
int main(){
ios_base::sync_with_stdio(0); cin.tie(0);
cin >> temp;
for(int i=1;i<=temp.length();i++){
for(int j=0;j<=temp.length()-i;j++){
m.insert(... | ALGO | 0.999597 | 5.665979 |
4e726865-03e2-4c73-8b1a-7c31e10bdda4 | tashobi02/Obi_CP_Snippets | Data_Structures/Trie/Trie1.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long int lli;
#define enl "\n"
void fast() {
ios_base::sync_with_stdio(false);
cin.tie(0);
}
struct Node {
Node* links[26];
bool flag = false;
bool containsKey(char ch) { return (links[ch - 'a']) != NULL; }
void put(char ch, Node* node... | ALGO | 0.999868 | 5.065887 |
cd382756-1295-4f12-861b-d01bf955dff2 | auxten/gingko | src/limit.cpp | /**
* limit.cpp
*
* Created on: 2011-8-4
* Author: auxten
**/
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <sys/types.h>
#include <unistd.h>
#include <errno.h>
#include <fcntl.h>
#include <pthread.h>
#include "gingko.h"
///mutex for up bandwidth limit
static pthread_mutex_t g_bw_up_mut... | TOOL | 0.986341 | 4.884719 |
7595f62f-8310-4070-acd8-cfcaad9ec50a | selmo-lyz/Autodidacticism | School/project/backpropagation/main.cpp | #include <iostream>
#include <vector>
#include <list>
#include <string>
#include <random>
#include <ctime>
#include <cmath>
#include <fstream>
using namespace std;
class Layer {
public:
Layer(int unit, int input_dim = 0, string activation = "sigmoid") {
this->unit = unit;
this->input_dim = input... | DATA | 0.918103 | 3.102761 |
82e2a4d2-bdae-4640-b3c3-5f061d0cfea1 | xueran1991/CarND-Path-Planning-Project | src/Eigen-3.3/doc/examples/Tutorial_BlockOperations_corner.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace std;
int main()
{
Eigen::Matrix4f m;
m << 1, 2, 3, 4,
5, 6, 7, 8,
9, 10,11,12,
13,14,15,16;
cout << "m.leftCols(2) =" << endl << m.leftCols(2) << endl << endl;
cout << "m.bottomRows<2>() =" << endl << m.bottomRows<2>() << endl << ... | ALGO | 0.997266 | 4.092313 |
43bd225b-11b1-4b26-9a9b-596f8ba56a83 | ravirraj/FDS | assign12.cpp | #include<iostream>
#define MAX 10
using namespace std;
struct que {
int arr[MAX];
int front, rear;
};
void init(struct que *q) {
q->front = -1;
q->rear = -1;
}
void print(struct que q) {
int i;
i = q.front;
while (i != q.rear) {
cout << "\t" << q.arr[i];
i = (i + 1) % MAX... | ALGO | 0.992099 | 4.105386 |
50d11582-ae0c-4ccf-9f41-c66426039a07 | yqtaowhu/DataStructureAndAlgorithm | programming/836.矩形重叠.cpp | /*
* @lc app=leetcode.cn id=836 lang=cpp
*
* [836] 矩形重叠
*/
// @lc code=start
class Solution {
public:
// 方法1: 逆向思维,不重叠地方情况
bool isRectangleOverlap(vector<int>& rec1, vector<int>& rec2) {
return !(rec1[2] <= rec2[0] || // left
rec1[3] <= rec2[1] || // bottom
rec... | ALGO | 0.999553 | 6.107011 |
7a84543f-c2d4-4409-aa0e-fbc6829b4f52 | Alberl-Lee/blinkUI | third_party/skia/src/pathops/SkOpCubicHull.cpp | #include "SkPathOpsCubic.h"
static bool rotate(const SkDCubic& cubic, int zero, int index, SkDCubic& rotPath)
{
double dy = cubic[index].fY - cubic[zero].fY;
double dx = cubic[index].fX - cubic[zero].fX;
if (approximately_zero(dy)) {
if (approximately_zero(dx)) {
return false;
}... | ALGO | 0.99942 | 5.958028 |
d0a1404c-46f7-4bde-a1fb-bdaa22160f1f | iasifahm02/Leetcode-Soln | 153-find-minimum-in-rotated-sorted-array/find-minimum-in-rotated-sorted-array.cpp | class Solution {
public:
int findMin(vector<int>& nums) {
int low = 0, high = nums.size()-1;
int ans = 0;
while(low <= high){
int mid = low + (high-low)/2;
if(nums[mid] >= nums[0]){
low = mid+1;
}
else{
... | ALGO | 0.999991 | 5.972233 |
18bea4d3-cd17-4ed5-aabd-0e9714687b72 | irori-gthb/atcoder | abc1xx/abc182/abc182_c.cpp | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
using ll = long long;
int main() {
string N;
cin >> N;
int calc = 0;
rep(i, N.size()) calc += N[i] - '0';
if (calc % 3 == 0) {
cout << 0 << endl;
return 0;
}
rep(i, N.size()) {
if ((calc - N[i] - '0'... | ALGO | 0.999957 | 3.824029 |
d6093881-b49f-4848-ab12-80720bcac761 | Tolisz/Simulation_PR3 | source/jelly_simThread.cpp | #include "jelly_simThread.hpp"
#include <iostream>
#include <glm/geometric.hpp>
jelly_simThread::jelly_simThread(
std::shared_ptr<bezierCube> cube,
std::shared_ptr<collisionFrame> colFrame,
std::shared_ptr<simulationParameters> simParams) :
m_bCube{cube},
m_cFrame{colFrame},
m_simParams{simParams}
{
}
jell... | ALGO | 0.99394 | 6.15495 |
8df62a81-f4f9-4f94-8d7f-2919f6d49edc | SindhuVardhan/CSA0679-DAA | merg sort.cpp | #include <stdio.h>
void merge(int arr[], int l, int m, int r) {
int i, j, k;
int n1 = m - l + 1;
int n2 = r - m;
// Create temporary arrays
int L[n1], R[n2];
// Copy data to temporary arrays L[] and R[]
for (i = 0; i < n1; i++)
L[i] = arr[l + i];
for (j = 0; j < n2; j++)
... | ALGO | 0.999997 | 5.908218 |
ffd2b2a8-c350-4294-8614-9d1fea5a0f21 | udontur/cs | hkoi/PL18C.cpp | //WHAT https://math.stackexchange.com/questions/3126495/prove-that-any-number-that-is-not-a-power-of-2-can-be-expressed-as-a-sum-of-two
#include <bits/stdc++.h>
using namespace std;
int main() {
int tt;
cin>>tt;
while(tt--){
int k;
cin>>k;
if(k&(k-1)) cout<<"Yes\n";
else cout... | ALGO | 0.99968 | 4.435704 |
8c91c33d-605b-43d1-a9b5-09b7058aaa23 | prathampithalia/CP | AtCoder/ABC_328/A_Not_Too_Hard.cpp | // #include <iostream>
#include<bits/stdc++.h>
using namespace std;
#define all(a) a.begin(),a.end()
#define fi first
#define se second
#define pb push_back
#define pyes cout<<"YES"<<endl
#define pno cout<<"NO"<<endl
#define ce cout<<endl
#define forr(i,n) for(int i=0 ; i<n ; i++)
#define pvec(x) for(auto &a : x){cou... | ALGO | 0.999925 | 3.719117 |
dcc9db21-47df-42ed-9ec7-e2fe716bb89a | Ivan-71-ua/Competitive-Programming | LeetCode/189_2.cpp | #include <bits/stdc++.h>
class Solution {
public:
void rotate(std::vector<int>& nums, int k) {
int kk = k % nums.size();
std::vector<int> tp(nums.begin(), nums.end());
for (int i = 0; i < nums.size(); i++)
{
nums[(i + kk) % nums.size()] = tp[i];
}
}
};
int main() {
Solution ans;
std::v... | ALGO | 0.999911 | 5.634372 |
fcd5fbaf-751a-4adf-a317-c0ff795060b7 | ishanarang21/DSA-questions | bubble-sort.cpp | #include <iostream>
using namespace std;
void bubblesort(int arr[],int n)
{
for(int round=1;round<n-1;round++)
{
for(int j=0;j<n-round;j++)
{
if(arr[j]>arr[j+1])
{
swap(arr[j],arr[j+1]);
}
}
}
}
void printarray(int arr[],int n)
{
for(i... | ALGO | 0.999929 | 4.75513 |
f76a262f-6da5-4adc-b3db-42310b5605ba | Ultimecia1463/iot-work | libraries/RageFire-project-1_inferencing/src/edge-impulse-sdk/tensorflow/lite/micro/kernels/round.cpp | #include "edge-impulse-sdk/tensorflow/lite/kernels/internal/reference/round.h"
#include "edge-impulse-sdk/tensorflow/lite/c/common.h"
#include "edge-impulse-sdk/tensorflow/lite/kernels/internal/tensor_ctypes.h"
#include "edge-impulse-sdk/tensorflow/lite/kernels/kernel_util.h"
#include "edge-impulse-sdk/tensorflow/lite... | ALGO | 0.882382 | 7.885247 |
6ae7b767-7f4a-4efa-98a2-1883c913a749 | ishandutta2007/codeforces | ftiasch/normal/219/A.cpp | #include <cstdio>
#include <cstring>
using namespace std;
const int N = 1000;
int n, k, counter[26];
char string[N + 1];
int main() {
scanf("%d%s", &k, string);
n = strlen(string);
memset(counter, 0, sizeof(counter));
for (int i = 0; i < n; ++ i) {
counter[string[i] - 'a'] ++;
}
for (... | ALGO | 0.999946 | 4.400694 |
a3094c99-9f64-4c03-9f6b-958be5238f0f | ishandutta2007/codeforces | hitonanode/normal/1142/D.cpp | #include <bits/stdc++.h>
using namespace std;
using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).... | ALGO | 0.999907 | 3.842201 |
b0da0ad2-eeea-4d97-ab2c-d7fdba3b8877 | limon2009/ACM-UVA-Online-Judge-solution | 10066.cpp | #include <stdio.h>
#include <string.h>
#define MAX 120
/* 10000 */
int X[MAX],Y[MAX];
int i,j,m,n,c[MAX][MAX],b[MAX][MAX];
int LCSlength() {
for (i=1;i<=m;i++) c[i][0]=0;
for (j=0;j<=n;j++) c[0][j]=0;
for (i=1;i<=m;i++)
for (j=1;j<=n;j++) {
if (X[i-1]==Y[j-1]) {
c[i][j]=c[i-1][j-1]+1;
b[i][j]=1;... | ALGO | 0.999613 | 3.350109 |
d82b8259-f91e-43d4-bb82-58d1a8ffac58 | TUTvision/Online-Panoptic-3D | dlib/examples/config_reader_ex.cpp | /*
This is an example illustrating the use of the config_reader component
from the dlib C++ Library.
This example uses the config_reader to load a config file and then
prints out the values of various fields in the file.
*/
#include <dlib/config_reader.h>
#include <iostream>
#include <fstream>
#inc... | TOOL | 0.890419 | 7.675443 |
758eb757-674e-402e-91c8-9a821cfc19c0 | Singhshubham1211/DSA | Binary Tree Zigzag Level Order Traversal.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.999992 | 6.235622 |
00ae602f-d928-4361-884e-f141340f0fa7 | RoadlyInc/DSOPP | test/tools/src/savitzky_golay_filter.cpp | #include "test/tools/savitzky_golay_filter.hpp"
#include <cmath>
#include <cstddef>
#include "common/settings.hpp"
#include "energy/motion/se3_motion.hpp"
namespace dsopp {
namespace test_tools {
namespace {
/** calculate Savitzky-Golay coefficients. */
template <energy::motion::Motion Motion>
Eigen::VectorX<typenam... | ALGO | 0.993731 | 6.681309 |
65b2c860-122f-4510-b914-97963ea2e238 | javalosv/files | eigen-eigen-b30b87236a1b/doc/examples/tut_arithmetic_dot_cross.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace Eigen;
using namespace std;
int main()
{
Vector3d v(1,2,3);
Vector3d w(0,1,2);
cout << "Dot product: " << v.dot(w) << endl;
double dp = v.adjoint()*w; // automatic conversion of the inner product to a scalar
cout << "Dot product via a matrix product... | ALGO | 0.998803 | 4.042919 |
b97b112e-dcc0-4bee-a38f-57a79b17c5e6 | HONGYU-LEE/TheWayToAlgorithm | Leetcode/leetcode-670/solution.cpp | class Solution {
public:
//贪心
int maximumSwap(int num) {
string str(to_string(num)); //转成字符串好比较数字
vector<int> maxArr(str.size(), - 1);
int maxIndex = maxArr.size() - 1;
//第一趟扫描,从右向左记录下该节点右边最大节点的下标
for(int i = maxArr.size() - 1; i >= 0; i--)
{
//如果当前数字... | ALGO | 0.999973 | 5.94522 |
29b4d21c-737d-4bba-a3dd-9b7098082c6d | amlogic-openlinux-p230/amlogic | frameworks/av/media/libstagefright/codecs/m4v_h263/dec/src/find_min_max.cpp | /*
------------------------------------------------------------------------------
INPUT AND OUTPUT DEFINITIONS
Inputs:
input_ptr = pointer to the buffer containing values of type UChar
in a 2D block of data.
min_ptr = pointer to the minimum value of type Int to be found in a
square bloc... | ALGO | 0.999972 | 6.63482 |
851d5ebf-7688-4f52-a19e-4702470182c4 | AdaCore/z3 | src/ast/rewriter/bit2int.cpp | #include "ast/ast_pp.h"
#include "ast/ast_ll_pp.h"
#include "ast/for_each_ast.h"
#include "ast/rewriter/bit2int.h"
bit2int::bit2int(ast_manager & m) :
m(m), m_bv_util(m), m_rewriter(m), m_arith_util(m), m_cache(m, false), m_bit0(m) {
m_bit0 = m_bv_util.mk_numeral(0,1);
}
void bit2int::operator()(expr * n... | ALGO | 0.910138 | 6.43658 |
7eef8c55-b0c9-45a3-b300-6ae028fa02f0 | oxygen-hunter/Flashboom | data/big-vul-100/add_attention_code/Phi/top0-100/find-the-largest-palindrome-divisible-by-k-Solution.largestPalindrome/177865_DoS.cpp | PatternMatch(char *pat, int patdashes, char *string, int stringdashes)
{
char c,
t;
if (stringdashes < patdashes)
return 0;
for (;;) {
switch (c = *pat++) {
case '*':
if (!(c = *pat++))
return 1;
if (c == XK_minus) {
patdashes--;
for (;;) {
while ((t = *strin... | ALGO | 0.998789 | 5.191381 |
76eaa47d-b6e3-41fc-b1c7-14887893820c | ishandutta2007/codeforces | aidos/normal/1398/B.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 5e5 + 123;
const int mod = 1e9 + 7;
string s;
void solve() {
cin >> s;
vector<int> v;
v.push_back(0);
for(int i = 0; i < s.size(); i++) {
if(s[i] == '1') v.back()++;
else v.push_back(0);
}
sort... | ALGO | 0.999976 | 4.029854 |
62a8f64a-66c6-4f59-ac85-5cbfa47d5c57 | Koweiyi/LC_cpp | 693.交替位二进制数.cpp | /*
* @lc app=leetcode.cn id=693 lang=cpp
*
* [693] 交替位二进制数
*
* https://leetcode-cn.com/problems/binary-number-with-alternating-bits/description/
*
* algorithms
* Easy (60.47%)
* Likes: 64
* Dislikes: 0
* Total Accepted: 13.7K
* Total Submissions: 22.7K
* Testcase Example: '5'
*
* 给定一个正整数,检查他是否为交替位... | ALGO | 0.999642 | 6.306747 |
608df8f4-32e6-4072-8380-d80e0645cac8 | parasguglani1/competitive_coding | Codeforces/virtual contests/813 div2/B_Woeful_Permutation.cpp | #include <bits/stdc++.h>
using namespace std;
using namespace chrono;
#define ff first
#define ss second
#define int long long
using ll = long long;
#define setbits(x) __builtin_popcountll(x)
#define zrobits(x) __builtin_ctzll(x)
#define mod 1000000007
#define inf 1e18
#define PI 3.1415926535897932384626
#define ps(x,... | ALGO | 0.999752 | 4.153069 |
1ff59ad9-d8cd-402a-876c-ae33bcb18a77 | 20kaushik02/leetcode-gulag | 338-counting-bits/driver.cpp | #include "soln.hpp"
int main()
{
int n = 7;
vector<int> answer{0, 1, 1, 2, 1, 2, 2, 3};
Solution soln;
cout << "Counted bits correctly? " << soln.test(n, answer) << endl;
return 0;
} | ALGO | 0.99975 | 6.091553 |
6fef2c60-632a-455a-af06-764ab6f0c2d8 | Winterleaf/DNT-Torque3D-V1.1-MIT-3.0 | Engine/source/math/mEase.cpp | // NOTE: methods on the EaseF convenience class
#include "math/mMath.h"
#include "math/mEase.h"
#include "core/strings/stringFunctions.h"
EaseF::EaseF()
{
dir = 0;
type = 0;
param[0] = param[1] = -1.0f;
}
EaseF::EaseF(const EaseF &ease)
{
this->dir = ease.dir;
this->type = ease.type;
this->param[0] = ease.para... | TOOL | 0.959345 | 6.466948 |
cba8c6a2-986d-4536-9218-d76c5c83d61c | MD-SHussain/CPC23 | Week 6/Greater sum tree.cpp | #include <bits/stdc++.h>
using namespace std;
// function to convert bst into greater sum tree
int sum=0;
void greatertree(tree* &root, int &sum)
{
if(root)
{
greatertree(root->right,sum);
int data=root->val;
root->val+=sum;
sum+=data;
greatertree(root->left,sum);
}
}
| ALGO | 0.999908 | 4.000743 |
cabf1829-0ede-4e69-80de-3c35efa862e6 | sketchc89/codeForces | contests/689_2/stringgen.cpp | #include <bits/stdc++.h>
using namespace std;
// int count(int row, int col, vector<vector<int>>& mat) {
// int R = mat.size();
// int C = mat[0].size();
// queue<pair<pair<int, int>, int>> q;
// int max_depth = 0;
// q.emplace(make_pair(make_pair(row, col), 1));
// while (!q.empty()) {
// ... | ALGO | 0.999609 | 3.325572 |
65361320-3a6a-4360-8bb0-92fbcc83ba6f | bcod-diffusion/bcod | src/sac_scheduler.cpp | #include <bcod/sac_scheduler.hpp>
#include <bcod/utils.hpp>
#include <torch/torch.h>
#include <Eigen/Dense>
#include <opencv2/opencv.hpp>
#include <random>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <vector>
#include <array>
#include <memory>
#include <mutex>
#include <atomic>
#include <chrono>
#... | ALGO | 0.927307 | 6.191172 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.