uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
d599db67-06d4-4976-a687-7e5333407223 | DimitarSht/Informatics_9B_2024_2025 | Grade_8/Първи срок/Седмица_13_If_въведение_13_12_2023/if_statement.cpp | #include<iostream>
using namespace std;
int main()
{
int x, sum = 0;
cin>>x;
if(x > 0)
{
sum = sum + x;
cout<<sum;
}
else if(x < 0)
{
cout<<x;
}
else
{
cout<<sum;
}
return 0;
}
| ALGO | 0.999868 | 3.756747 |
55613dd3-fe87-4614-9c8d-7e8c269c0f5a | pexip/os-llvm-toolchain-19 | openmp/runtime/src/kmp_lock.cpp | /*
* kmp_lock.cpp -- lock-related functions
*/
#include <stddef.h>
#include <atomic>
#include "kmp.h"
#include "kmp_i18n.h"
#include "kmp_io.h"
#include "kmp_itt.h"
#include "kmp_lock.h"
#include "kmp_wait_release.h"
#include "kmp_wrapper_getpid.h"
#if KMP_USE_FUTEX
#include <sys/syscall.h>
#include <unistd.h>
// ... | TOOL | 0.908196 | 3.802227 |
25927bae-a186-448f-b9f6-18e1603f2803 | ishandutta2007/codeforces | barichek/normal/1575/L.cpp | //#pragma GCC optimize("Ofast", "unroll-loops")
//#pragma GCC target("sse", "sse2", "sse3", "ssse3", "sse4", "avx")
#ifdef __APPLE__
# include <iostream>
# include <cmath>
# include <algorithm>
# include <stdio.h>
# include <cstdint>
# include <cstring>
# include <string>
# include <cstdlib>
# include <vector>
# inclu... | ALGO | 0.99982 | 4.042086 |
eb10df61-4705-4c80-bf5c-1e8af388bbe3 | ishandutta2007/codeforces | newbiewzs/normal/1539/B.cpp | #include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
const int N=100005;
int n,Q;
int sum[N][26];
char s[N];
int main()
{
scanf("%d%d",&n,&Q);
scanf("%s",s+1);
for(int i=1;i<=n;i++)
{
memcpy(sum[i],sum[i-1],sizeof(sum[i]));
sum[i][s[i]-'a']++;
}
while(Q--)
{
i... | ALGO | 0.999925 | 3.886965 |
a3814b95-2f87-461e-909f-45fa7b3bd2dd | ishandutta2007/codeforces | cheissmart/normal/1004/B.cpp | #include <bits/stdc++.h>
#define IO_OP std::ios::sync_with_stdio(0); std::cin.tie(0);
#define F first
#define S second
#define V vector
#define PB push_back
#define MP make_pair
#define EB emplace_back
#define ALL(v) (v).begin(), (v).end()
#define debug(x) cerr << #x << " is " << x << endl
using namespace std;
typede... | ALGO | 0.999961 | 3.101775 |
3ceb5771-b70d-4821-9910-9be49791303d | IshyWishy17/Competitive-Coding | codeforces/mex_destruction.cpp | #include <iostream>
#include <string>
#include <bits/stdc++.h>
using namespace std;
void solve() {
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; i++) cin >> a[i];
bool flag = true;
for (int i = 0; i < n; i++) {
if (a[i] > 0) flag = false;
}
if (flag) { cout << "0\n... | ALGO | 0.999954 | 4.584411 |
18ae8227-1d38-4cc0-9b26-464cd6aa0469 | mohsinenur/URIOnlineJudge | Triangle_1929.cpp | #include<iostream>
using namespace std;
main()
{
int A, B, C, D;
cin >> A >> B >> C >> D;
if (((A+B < C) && C > D && A+B >= D))
{
cout << "S" << endl;
}else
{
cout << "N" << endl;
}
return 0;
}
| ALGO | 0.999612 | 3.16236 |
8f9a0a33-b88f-4e0a-8c83-2ddf58008c29 | ltkk/cpp-tutorial | day17/continue-ex.cpp | #include <iostream>
using namespace std;
int main()
{
cout << "continue vs for ex:\n";
for (int i = 0; i < 100; i++)
{
if (i % 2 == 0)
{
continue;
}
cout << i << "\t";
}
cout << "\ncontinue vs while ex:\n";
int i = 0;
while (i < 100)
{
... | ALGO | 0.97955 | 4.150139 |
2a8f1f0d-8f91-4986-be49-4ad8cce28d85 | ishmeet09/DSA | Linked List/1_Reverse.cpp | #include<iostream>
using namespace std;
/* 3 variables , 4 steps
*/
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:
List... | ALGO | 0.999953 | 4.88535 |
7f89c360-7578-4147-b69d-957a5c3b66dc | wslee/popl21_artifacts | euphony/thirdparty/z3/src/tactic/arith/bound_propagator.cpp | #include "tactic/arith/bound_propagator.h"
#include<cmath>
// -------------------------------
// Bound Relaxation configuration
//
// The idea is to minimize errors in floating point computations
//
// If RELAX_BOUNDS is undefined, then bound relaxation is disabled.
// Otherwise, lower bounds l are relaxed using the f... | ALGO | 0.998344 | 7.34475 |
5b1d2d56-ad73-4213-86a9-344597c836c7 | Myung-Hyun/Data-Structure-Practice | Chapter5/Unsorted List/DeleteItem_main.cpp | #include <iostream>
#include "UnsortedType.h"
using namespace std;
template<class ItemType>
void MergeLists(UnsortedType<ItemType>& list1, UnsortedType<ItemType>& list2, UnsortedType<ItemType>& result);
int main()
{
UnsortedType<int> list1;
list1.InsertItem(5);
list1.InsertItem(2);
list1.InsertItem(3);
list1.I... | ALGO | 0.995558 | 4.757462 |
d64b34bd-d84d-4fa0-ae34-26f13bf93b55 | silvercyrex/Climber-7-Vanilla-Marlin | Marlin/src/gcode/bedlevel/G35.cpp | #include "../../inc/MarlinConfig.h"
#if ENABLED(ASSISTED_TRAMMING)
#include "../gcode.h"
#include "../../module/planner.h"
#include "../../module/probe.h"
#include "../../feature/bedlevel/bedlevel.h"
#if HAS_MULTI_HOTEND
#include "../../module/tool_change.h"
#endif
#define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE... | TOOL | 0.982222 | 6.319565 |
87870206-0f46-4eff-86c6-01e074808a57 | ishandutta2007/codeforces | daklqw/normal/1083/F.cpp | #include <bits/stdc++.h>
const int MAXN = 200010;
int A[MAXN], B[MAXN], C[MAXN], n, K, Q;
typedef std::vector<int> VI;
int c0, d0;
const int BLO = 512;
int pool[MAXN / BLO + 2][1 << 14], poolb;
struct blk {
VI A; int tag;
int * hav;
int get(int x) { return A[x] ^ tag; }
void init() {
if (A.size() < BLO) hav = NU... | ALGO | 0.99985 | 4.335261 |
fea0e2eb-7335-45b7-9821-dcd78c668c15 | SemyonMalykh/KiwiFilter | include/eigen/blas/double.cpp | #define SCALAR double
#define SCALAR_SUFFIX d
#define SCALAR_SUFFIX_UP "D"
#define ISCOMPLEX 0
#include "level1_impl.h"
#include "level1_real_impl.h"
#include "level2_impl.h"
#include "level2_real_impl.h"
#include "level3_impl.h"
double EIGEN_BLAS_FUNC(sdot)(int* n, float* x, int* incx, float* y, int* incy... | ALGO | 0.99849 | 4.726407 |
6c798b26-12b5-43d9-a36e-11be51b528b8 | Familyye/ollvm-19 | libcxx/test/std/algorithms/alg.modifying.operations/alg.replace/pstl.replace_copy.pass.cpp | // UNSUPPORTED: c++03, c++11, c++14
// UNSUPPORTED: libcpp-has-no-incomplete-pstl
// template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2, class T>
// ForwardIterator2
// replace_copy(ExecutionPolicy&& exec,
// ForwardIterator1 first, ForwardIterator1 last,
// ... | TEST | 0.883385 | 6.408719 |
2e065fe1-4d36-4165-a745-8412e3c8d56a | nanaezheng/ACM-ICPC-code | Dynamic Programming/soj6135.cpp | using namespace std;
int main()
{
long long n,m,h,sum=0,a[100000];
long long s=(-1000000000);
cin>>n>>m;
for(int i=1; i<=n; i++)
cin>>a[i];
// sort(a+1,a+1,compare);
for(int h=1; h<=n; h++)
for(int j=h+1; j<=n; j++)
for(int i=j+1; i<=n; i++)
{
... | ALGO | 0.999985 | 4.1675 |
7fe23e44-7de1-4ea5-95d4-8110b5a5bce1 | Osorio-Raquel/Practica_03Osorio | Ejercicio_03_06.cpp | // Materia: Programación I, Paralelo 2
// Autor: Raquel Osorio Mamani
// Fecha creación: 05/09/2023
// Fecha modificación: 05/09/2023
// Número de ejericio: 6
// Problema planteado: Generar una matriz NxN, que se llene con la serie de Fibonacci.
#include <iostream>
using namespace std;
int main() {
int N;
... | ALGO | 0.999442 | 4.30161 |
ab847543-e03e-49fc-8465-032468abaff7 | KD-lab-Open-Source/Perimeter | Source/Render/tilemap/TileMap.cpp | #include <set>
#include "StdAfxRD.h"
#ifdef PERIMETER_D3D9
#include "D3DRender.h"
#endif
#include "TileMap.h"
#include "Scene.h"
#include "ObjLibrary.h"
#include "../../Game/Region.h"
#include "Font.h"
#include "PoolManager.h"
#include "TileMapRender.h"
#include "ClippingMesh.h"
static void fillVisPoly(uint8_t *buf, s... | TOOL | 0.902311 | 3.754777 |
7a4ba72e-0cff-4d9e-95de-2aabfe038b04 | ProgramTraveler/leetcode | Leetcode_Question/283.移动零.cpp | /*
* @lc app=leetcode.cn id=283 lang=cpp
*
* [283] 移动零
*/
// @lc code=start
class Solution {
public:
void moveZeroes(vector<int>& nums) {
int left = 0, right = 0;
while (right < nums.size()) {
if (nums[right] != 0) { //当前元素非0
swap(nums[left], nums[right]); //交换左右两指针的... | ALGO | 0.999803 | 6.393656 |
261b9085-5320-4c0e-b166-f69020adf73c | vikram-rathore1/competitive_programming | hackerearth/battle_of_bots/battle_of_bots_taunt_1.cpp | #include<bits/stdc++.h>
using namespace std;
int total_moves, max_chances = 7;
void play(vector<vector<int> > pieces, map<pair<int, int>, bool > occupied, int chance_number) {
if (chance_number > max_chances) return;
//cout << "Chance #" << chance_number << endl;
vector<vector<int> > pieces_now;
map... | ALGO | 0.999871 | 3.860862 |
e70b5132-a34b-4bbb-92f6-fddf7ed672d0 | tjgolubi/boost | libs/numeric/interval/examples/filter.cpp | #include <boost/numeric/interval.hpp>
#include <iostream>
namespace dummy {
using namespace boost;
using namespace numeric;
using namespace interval_lib;
typedef save_state<rounded_arith_opp<double> > R;
typedef checking_no_nan<double, checking_no_empty<double> > P;
typedef interval<double, policies<R, P> ... | ALGO | 0.99998 | 6.619447 |
e01f5ede-6b75-4cc4-954e-5633b9b8cd2d | ishandutta2007/codeforces | andreasyan/normal/922/D.cpp | #include <iostream>
#include <algorithm>
#include <string>
using namespace std;
const int N=100005;
long long pat(string s)
{
int m=s.size();
int p=0;
long long ans=0;
for(int i=0;i<m;++i)
{
if(s[i]=='s')
++p;
else
ans+=p;
}
return ans;
}
struct ban
{
string c;
};
bool operator<(const ban& a,const ban... | ALGO | 0.999636 | 3.370302 |
18b8bb9f-6bb9-439b-bea1-0138e745e990 | laomd-2/practice | tsp/main.cpp | #include <iostream>
#include <fstream>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <ctime>
using namespace std;
#define INF INT_MAX
vector<int> rowReduce(vector<vector<int>>& reduced_matrix) {
size_t n = reduced_matrix.size();
vector<int> row(n, INF);
for (int i = 0... | ALGO | 0.999853 | 4.059016 |
53de8b67-df75-473d-b39e-f4c0d2b7ad37 | sarvex/leetcode-brainfuck | solution/1700-1799/1773.Count Items Matching a Rule/Solution.cpp | class Solution {
public:
int countMatches(vector<vector<string>>& items, string ruleKey, string ruleValue) {
int i = ruleKey[0] == 't' ? 0 : (ruleKey[0] == 'c' ? 1 : 2);
return count_if(items.begin(), items.end(), [&](auto& v) { return v[i] == ruleValue; });
}
}; | ALGO | 0.998049 | 6.507593 |
c0687c66-ec1d-4a12-8b02-7e93f4a4124f | prakharsri23/git_workshop | first n prime.cpp | #include <stdio.h>
int main ()
{
int n;
int i=3;
int j;
int count,c;
printf ("Enter limit: ");
scanf("%d",&n);
if (n>=1)
{
printf("The first %d prime number are: ", n);
printf("2 ");
}
for (count=2;count<=n;i++)
{
for(c=2;c<i;c++)
{
if(i%c==0)
break;
}
if(c==i) //c is prime
{
printf("%d ",i);
co... | ALGO | 0.999686 | 3.195143 |
0300fafe-1e90-40de-aee7-b2ca3bfae451 | ishandutta2007/codeforces | tob123/normal/1214/D.cpp | #include <bits/stdc++.h>
using namespace std;
#define sz(x) ((int) (x).size())
typedef long long ll;
typedef pair<int,int> pii;
int N, M;
vector<string> S;
vector<vector<char>> B;
vector<vector<char>> B2;
int main(){
cin >> N >> M;
S.resize(N);
B.resize(N+2);
B2.resize(N+2);
for(int i=0; i<N; i++){
cin >> S[i... | ALGO | 0.999783 | 3.87245 |
300b2bd4-6ded-41a2-b816-c32998663186 | SudiptoDasSukanto/MyLibrary_OfAlgorithom | DP/knapsack01.cpp | #include<bits/stdc++.h>
using namespace std;
void print(vector<vector<int>>&p){
}
void knapsack(vector<vector<int>>&list,int n , int w){
vector<vector<int>>p(n+1,vector<int>(w+1));
for(int i=0 ; i<=w ;i++) p[0][i] = 0;
for(int i=1 ; i<=n ;i++) p[i][0] = 0;
for(int i=1 ; i<=n ;i++){
for(i... | ALGO | 0.999949 | 3.590018 |
71577803-e0ca-4ba6-9f12-41444307fbfb | mrmh-code/My_problem_solution_different_OJ | 2.CodeForces/53.A. Pangram.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
string s;
cin>>s;
for(int i=0; i<n; i++){
s[i]=tolower(s[i]);
}
sort(s.begin(),s.end());
int count=0;
for(int i=0; i<n; i++){
if(s[i]!=s[i+1]){
count++;
}
}
if(... | ALGO | 0.999997 | 3.943297 |
d2f742e9-777f-4ea7-8af4-1022e8279666 | AOSP-Porting/platform_frameworks_av | media/libstagefright/codecs/amrwb/src/agc2_amr_wb.cpp | /*
------------------------------------------------------------------------------
Filename: agc2_amr_wb.cpp
Date: 05/08/2007
------------------------------------------------------------------------------
REVISION HISTORY
Description:
-------------------------------------------------------------------------... | ALGO | 0.999954 | 5.915693 |
90b1ea6b-119f-4f0f-af56-8bf09978d55a | GSedi/ICPC-ACM-Programming-Contest | contests/JE.cpp | #include <iostream>
#include <vector>
using namespace std;
/*string del(string s){
string a = "";
for(int i = 0; i < s.length()-1; i++){
if(s[i] == s[i+1]){
for(int j = 0; j < i; j++){
a+=s[j];
}
for(int j = i+2; j < s.length(); j++){
a+=s[j];
}
return del(a);
}
}
return s;
}
*/
string de... | ALGO | 0.999992 | 3.548041 |
6c3ae5ec-d5c0-45b6-ad4c-932cf4b35640 | Etsuya233/CodeSyncEtsuya | Sunnywhy/5.1.3.ProbablestackValidPop.cpp | #include <cstdio>
#include <stack>
using namespace std;
int main() {
int n;
scanf("%d", &n);
stack<int> s;
int x, nowMax = 0;
bool isValid = true;
for (int i = 0; i < n; i++) {
scanf("%d", &x);
if (x > nowMax) {
for (int j = nowMax + 1; j <= x; j++) {
s.push(j);
}
nowMax = x;
}
if (s.top() !... | ALGO | 0.999987 | 3.922611 |
d434d6dd-377b-4ab9-b183-92300d9386a8 | omnichal/DSA | DSA SB32/DSA/Assignment_3.cpp | #include <iostream>
using namespace std;
int cqueue[5];
int front = -1, rear = -1, n=5;
void insertCQ(int val) {
if ((front == 0 && rear == n-1) || (front == rear+1)) {
cout<<"Queue Overflow \n";
return;
}
if (front == -1) {
front = 0;
rear = 0;
} else {
if (rea... | ALGO | 0.990678 | 4.226286 |
a57974db-ecd8-42e8-8637-d824c7fe7150 | vbonnici/grafe-sim | analysis/data/p04001/s589157938.cpp | #include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
using ll=long long;
typedef pair<int,int> P;
const int INF=1e9;
int main(){
string s;
cin>>s;
ll ans=0;
int n=s.size();
rep(i,1<<(n-1)){
ll allsum=0,sum=s[0]-'0';
for(int j=1;j<n;j++){
if... | ALGO | 0.999877 | 4.044719 |
b4caf37c-3915-4e38-b68f-91b50f0daed4 | yashchitale96/Leetcode | Reverse a string using Stack - GFG/reverse-a-string-using-stack.cpp | //{ Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
char* reverse(char *str, int len);
int main()
{
long long int t;
cin>>t;
while(t--)
{
char str[10000];
cin>>str;
long long int len=strlen(str);
char *ch=reverse(str,len);
for(int i=0;i<len;i++)
... | ALGO | 0.999787 | 5.336481 |
69ff6504-ad16-45ec-98e7-12ec0138168e | ddamik/AlgoChallenging | AlgoChallenging/7562.cpp | #include <cstdio>
#include <queue>
using namespace std;
int dirX[8] = { -1,-2,-2,-1,1,2,2,1 };
int dirY[8] = { -2,-1,1,2,2,1,-1,-2 };
int map[333][333];
int visited[333][333];
typedef pair<int, int> P;
int main() {
int n;
int t;
scanf("%d", &t);
while (t--) {
queue<P> que;
scanf("%d", &n);
int x, y... | ALGO | 0.99945 | 3.990144 |
b4e17c40-ece5-4f99-acc0-857600f5072c | CodderPrince/Other_Practice | Other's Practice/C_Can_I_Square.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007 // 1e9 + 7
#define PI 3.14159265358979323846 // acos(-1)
#define nl "\n"
/*
const ll n = 1e5 + 10;
ll hashArray[n];
void createHashArray()
{
int j = 0;
for (int i = 1; i < n; i ++)
{
hashArray[j] =... | ALGO | 0.999029 | 4.324468 |
56a7a8eb-f0fb-4328-baea-ec6bdb8fce1e | zty624/IntroPhyCom | hw5/leastpath.cpp | #include <iostream>
#include <vector>
#include <cstdlib>
using namespace std;
int leastPath(int n) {
double **heap = new double*[n];
for (int i = 0; i < n; i++) {
heap[i] = new double[i + 1] {0};
}
int **path = new int*[n - 1];
for (int i = 0; i < n - 1; i++) {
path[i] = new int[i +... | ALGO | 0.999 | 3.296479 |
da890d65-82a4-44ab-b23f-6dd95bc4a451 | MuhammetAkgoz/-C-Workspace | OrganizeSayilar.cpp | #include<stdio.h>
int main(){
int sayi,yenisayi;
printf("Lutfen bir sayi giriniz:");
scanf("%d",&sayi);
int a,b,c;
a=sayi%10;
yenisayi=sayi/10;
b=yenisayi%10;
c=yenisayi/10;
int toplamC=1;
int toplamB=1;
int toplamA=1;
for(int i=a; i>=1 ;i--){
toplamA= toplamA*i;
}
for(int i=b; i>=1 ;i--){
... | ALGO | 0.999409 | 3.59356 |
dbdb130a-7642-420f-a317-77702dce1439 | rajat2295/EveryStep | examples/flutter_view/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.998207 | 6.770068 |
ea64062e-ac9e-452b-8393-863917275a67 | noko206/AtCoder | abc/201-250/235/e3.cpp | #include <bits/stdc++.h>
using namespace std;
#define _overload3(_1,_2,_3,name,...) name
#define _REP(i,n) REPI(i,0,n)
#define REPI(i,a,b) for(int i=int(a);i<int(b);++i)
#define REP(...) _overload3(__VA_ARGS__,REPI,_REP,)(__VA_ARGS__)
#define ALL(a) (a).begin(),(a).end()
#define ALLR(a) (a).rbegin(),(a).rend()
typedef... | ALGO | 0.999961 | 4.173643 |
952a4d54-5c51-463b-b54c-97e1f50a18d1 | Mansipawar22/Data-Structure-and-Alogorithim | Data Structure & Algorithim/3. Searching/2. Binary Search.cpp | //Binary Search Tree Implementation
/*
So in the Binary Search Iteration Approuch is more Effictive Compare to Recursive Solution
cur it Required O(1) Auxilary space Compare to Recursive approuch which required O(log(n))
*/
#include<iostream>
using namespace std;
//Iterative Solutionink
//T(n)=> O(log(n))
//A(s)=> O(... | ALGO | 0.999993 | 6.150005 |
e7a38a29-2ed0-47ed-ae5f-f1ebf360c499 | trankhai07/cautruc | DSA8005(so_nhi_phan_1_den_n).cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int x,n;
cin >> x;
while(x--){
cin >> n;
queue<string>q;
q.push("1");
while(n--){
string s = q.front();
q.pop();
string s1 = s+"0"; q.push(s1); // cộng 0 trc vì queue sẽ lấy phần tử đầu ti... | ALGO | 0.999974 | 4.007714 |
5f173fe2-ec3e-4653-a6bf-48c6ea0f6e4f | tsksnhr/programming_contest | atcoder/abc063c.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long ;
using P = pair<ll, ll>;
const ll INF = 1e16;
void solver(int N, vector<int> &s, int &ans){
int sum{};
for(auto iter = s.begin(); iter != s.end(); ++iter) sum += *iter;
sort(s.begin(), s.end());
bool ... | ALGO | 0.999898 | 5.112765 |
e6dcc02a-d30f-4124-98b1-7d1df69b13cf | SandeepVallabaneni/quiz | 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.998859 | 6.785645 |
4755bd8c-2375-44b7-8f80-8e445aa8d217 | seewindcn/pycocos2d | lib/extensions/GUI/CCScrollView/CCSorting.cpp | #include "CCSorting.h"
NS_CC_EXT_BEGIN
class CCSortedObject : public CCObject, public CCSortableObject
{
public:
CCSortedObject() : objectID(0) {}
virtual void setObjectID(unsigned int objectID) { this->objectID = objectID; }
virtual unsigned int getObjectID() { return objectID; }
private:
unsigned in... | TOOL | 0.932317 | 5.397114 |
14825cc2-a368-4e84-ba24-c23e15bf3a7b | Tech-Fear/Data-Structures-Algorithms | Leetcode/502-ipo/ipo.cpp | class Solution {
public:
int findMaximizedCapital(int k, int w, vector<int>& profits, vector<int>& capital) {
int n = profits.size();
vector<pair<int, int>> projects(n);
for (int i = 0; i < n; ++i) {
projects[i] = {capital[i], profits[i]};
}
sort(project... | ALGO | 0.999991 | 5.675302 |
0b937946-ecf0-47a5-aac7-01a8f3de0c3c | MelasMalephar/DSA | 99-recover-binary-search-tree/99-recover-binary-search-tree.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.999998 | 6.472157 |
33e9b256-0330-4261-845c-0f7e9161f05b | IoanaGabor/competitive-programming-problems | infoarena/nasa.cpp | #include <iostream>
#include <fstream>
#include <bitset>
#define SQRTMAX 46340
using namespace std;
ifstream f("nasa.in");
ofstream g("nasa.out");
long long a,b,rez;
bitset <SQRTMAX> ciur;
int aux[SQRTMAX];
int main(){
f>>a>>b;
for(long long i=1;i<=SQRTMAX;i++){
aux[i]=1;
ciur[i]=0;
}
... | ALGO | 0.999698 | 3.800208 |
76a3f529-638b-440c-b80b-ea24b1636eee | safwankdb/DSA-Prep-Cpp | InterviewBit/Palindrom String.cpp | //https://www.interviewbit.com/problems/palindrome-string/
#include<bits/stdc++.h>
using namespace std;
int isPalindrome(string A) {
int i = 0, j = A.size() -1;
while(j >= i+1){
if(!isalnum(A[i])){
i++;
continue;
} else if (!isalnum(A[j])){
j--;
... | ALGO | 0.999827 | 5.327614 |
a5e75e76-bcc2-4e6e-9049-878b2d50cd9e | tejesh2410/MasterCP | week2/cf1559A.cpp | #include <iostream>
using namespace std;
int main(){
int T; cin >> T;
while(T--){
int n; cin >> n;
int l; cin >> l; int k;
for(int i = 1; i < n; i++){
cin >> k;
l &= k;
}
cout << l << "\n";
}
} | ALGO | 0.99984 | 3.35361 |
24e25201-b31b-4f66-b759-7bd723819c2d | erwincoumans/temprepo | examples/VoronoiFracture/btConvexConvexMprAlgorithm.cpp | #include "btConvexConvexMprAlgorithm.h"
//#include <stdio.h>
#include "BulletCollision/NarrowPhaseCollision/btDiscreteCollisionDetectorInterface.h"
#include "BulletCollision/BroadphaseCollision/btBroadphaseInterface.h"
#include "BulletCollision/CollisionDispatch/btCollisionObject.h"
#include "BulletCollision/Collision... | ALGO | 0.99983 | 4.123226 |
6e9da798-a5c2-4327-a639-9cf455708a7a | FahadHasan8386/All_Contest | problem2.cpp | #include <iostream>
using namespace std;
int main() {
int T;
cin >> T;
for (int i = 1 ; i <= T ; i++) {
int P, L;
cin >> P >> L;
int literacyRate = (L * 100) / P;
if (literacyRate >= 75) {
cout << "YES" << endl;
} else {
cout << "NO" << end... | ALGO | 0.999725 | 5.003961 |
13296d31-8fe7-47ee-8fdf-f60d5f1493d8 | NatdanaiHS/POSN_Computer_camp1_2024Edition | 63_Richly sort.cpp | #include <bits/stdc++.h>
using namespace std;
struct A{
int x,y;
bool operator<(const A &o)const{
if(x!=o.x)return x<o.x;
return y>o.y;
}
};
int main(){
cin.tie(nullptr)->sync_with_stdio(false);
int n;cin>>n;
vector<A> init(n);
for(A &e:init)cin>>e.x>>e.y;
sort(init.begi... | ALGO | 0.999905 | 4.926735 |
41837116-4f6c-4274-9eae-57544a841697 | Roshan4560/Cpp_PROGRAMMING | ARRAY/selectionsort.cpp | /* SORTING
Selection sort */
# include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cout<<"Enter the number:";
cin>>n;
int arr[n];
cout<<"numbers are:";
for(int i=0; i<n; i++){
cin>>ar... | ALGO | 0.999912 | 4.248852 |
698b533d-9d5e-4fe8-a034-c5f52460816a | ishandutta2007/codeforces | holyk/normal/1009/C.cpp | #include<bits/stdc++.h>
#define REP(i,a,b) for(int i=(a);i<=(b);++i)
#define DEC(i,a,b) for(int i=(a);i>=(b);--i)
#define dbg(...) fprintf(stderr,__VA_ARGS__)
using namespace std;
template<typename T,typename U> inline bool smax(T&x,const U&y){return y>x?(x=y,1):0;}
template<typename T,typename U> inline bool smin(T&x,... | ALGO | 0.999798 | 3.48587 |
0e356349-9ba3-414f-a9e3-ad0682680c51 | Deniis000/Homework | IntrestingTasks/task7.cpp | #include <iostream>
bool prime(int num) {
if (num < 2) return false;
for (int i = 2; i * i <= num; i++) {
if (num % i == 0) return false;
}
return true;
}
void pair_of_primes(int n) {
for (int i = n; i <= 2 * n - 2; i++) {
if (prime(i) && prime(i + 2)) {
std::cout << i << " " << i + 2 << std::endl;
}
}... | ALGO | 0.998712 | 5.089175 |
2ba59acb-2227-4820-a8cd-1ae92b75f7db | TiCavalaro/Cpp-Studies | ArvoreBinariaOO(1)/ArvoreBinariaOO/ArvoreBinaria.cpp | /*
* File: ArvoreBinaria.cpp
* Author: aluno
*
* Created on 27 de Fevereiro de 2020, 20:23
*/
#include "ArvoreBinaria.h"
#include <cstdlib>
#include "iostream"
#include "No.h"
#include <stddef.h>
using namespace std;
ArvoreBinaria::ArvoreBinaria() {
this->raiz=NULL;
}
ArvoreBinaria::ArvoreBinaria(const ... | ALGO | 0.999623 | 4.501219 |
d05c0612-ce43-49ba-9460-c9e02f33e83d | NishuSharma18/ImportantQuestions | RodCutting.cpp | #include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define iv(v) for(auto & v1:v) cin>>v1
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define removeDuplicate(v) v.erase(unique(all(v)),v.end())
#define yes cout<<"YES\n";
#def... | ALGO | 0.999835 | 3.579525 |
127e62fb-1fda-41ad-9af4-654cb5ade088 | intjarmansuri/Leetcode | String/1704-Determine_if_String_Halves_Are_Alike.cpp | #include<bits/stdc++.h>
using namespace std;
bool halvesAreAlike(string s) {
int n = s.length();
int mid = n/2;
int i = 0, j = mid;
int countA = 0, countB = 0;
unordered_set<char>vowels{'a','e','i','o','u','A','E','I','O','U'};
while(i < n/2 && j < n) {
if(vowels.find(s[i]) != vowels... | ALGO | 0.99979 | 5.935407 |
b5532bc9-3902-47a6-abff-dbf00250987e | AndrewSigorskih/ROSALIND_problems | Bioinformatics-Textbook-Track/BA10A.cpp | #include <iostream>
#include <fstream>
#include <sstream>
#include <iterator>
#include <limits>
#include <vector>
#include <unordered_map>
using std::string;
using std::vector;
long int STR_MAX = std::numeric_limits<std::streamsize>::max();
using Matrix = std::unordered_map<string, std::unordered_map<string, double>>;... | ALGO | 0.998901 | 4.738149 |
a8bad3a2-d714-4521-b172-809f64e8fd21 | Yijun-Jeon/BaekjoonOnlineJudge | 백준/Gold/16928. 뱀과 사다리 게임/뱀과 사다리 게임.cpp | #include <stdio.h>
#include <queue>
#define MAX_N 100
using namespace std;
int trap[MAX_N+1];
bool visited[MAX_N+1];
bool checkPosValid(int nextPos){
if(nextPos > MAX_N)
return false;
if(visited[nextPos])
return false;
return true;
}
int BFS(){
queue<pair<int,int> > q;
q.push(make_pair(1,0));
while(!q.e... | ALGO | 0.99998 | 3.950559 |
9fb7c328-1732-4983-b194-1caec9742f56 | vedanty3/dsa-codeground | leetcode-gfg-solutions/gfg-solutions/Detect Loop in linked list.cpp | // https : // practice.geeksforgeeks.org/problems/detect-loop-in-linked-list/1/?page=1&category[]=Linked%20List&curated[]=1&sortBy=submissions#
class Solution
{
public:
bool detectLoop(Node *head)
{
if (head == NULL or head->next == NULL)
{
return false;
}
Node *slo... | ALGO | 0.999905 | 5.557233 |
1eeaceae-5cd9-49d0-a602-53619520eea1 | adhirajChauhan/MCA_CPPDSA_1_Cipherschools | DSA/03_2d_Arrays/04.cpp | #include<iostream>
#include<vector>
using namespace std;
int main(){
// vector<int> vec1 = {1,2,3,4};
vector<vector<int>> v1 = {{1,2,3}, {4,5}, {6,7,8}};
for(int i = 0; i < v1.size(); i++){
for(int j = 0; j<v1[i].size(); j++){
cout << v1[i][j] << " ";
} cout << endl;
}
} | ALGO | 0.99196 | 4.176661 |
8b282815-b89b-4bf8-8caa-7f7582892bd7 | rohandarandale1144/GFG_to_GitHub | Medium/Hands of Straights/hands-of-straights.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
bool isStraightHand(int N, int groupSize, vector<int> &hand) {
// code here
if(N % groupSize!=0)
return false;
map<int, int>mp;
for(int i=0;i<N;i++)... | ALGO | 0.999374 | 5.751649 |
b41e2afe-0868-4f15-b157-dd7d799c8124 | Shrushti58/OOPCGL | SelectionSort.cpp | #include<iostream>
using namespace std;
int n;
#define size 10
template<class T>
void sel(T A[size])
{
int i,j,min;
T temp;
for(i=0;i<n-1;i++)
{
min=i;
for(j=i+1;j<n;j++)
{
if(A[j]<A[min])
min=j;
}
temp=A[i];
A[i]=A[min];
A[... | ALGO | 0.999169 | 3.804486 |
895cf5f0-0674-433d-a39c-0502684be237 | raincross7/code-similarity | codes/train_code/problem498/problem498_161.cpp | #include <iostream>
#include <vector>
#include <numeric>
#include <utility>
#include <algorithm>
using namespace std;
using Int = int64_t;
Int solve() {
int N;
cin >> N;
vector<int> A(N), B(N);
for (auto& i : A) cin >> i;
for (auto& i : B) cin >> i;
if (accumulate(A.begin(), A.end(), (Int)0) < a... | ALGO | 0.99999 | 3.992104 |
fc9b2b8a-5017-41be-b750-ef192136ce2c | sherwyndd/cses-solutions | Tree Algorithms/Finding a Centroid.cpp | /*
Harder not smarter
*/
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define IOS ios::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define nl "\n"
typedef pair<int,int> p;
const int N = (1e6) + 7;
const int N2 = (1e3) + 7;
const int INF = (1e18);
const int base = 311;
const int MOD = (1e... | ALGO | 0.998953 | 5.159851 |
290ac72f-11d9-4dde-8252-103b59619e6a | fejmiqaz/SP | 9/ex59.cpp | #include<iostream>
#include<cstring>
using namespace std;
/* Write a program to check how many palindrome sentences an array of characters has. */
char letters(char f[101]){
char letters[100];
int j = 0;
for(int i = 0; i < strlen(f); i+=2){
if(isalpha(f[i])){
letters[j] = f[i];
... | ALGO | 0.999564 | 4.482795 |
ffa04347-e0f4-45d9-885d-6b5e25dff6f5 | 10Maruf/CODEFORCES-Problem | ChipAndRibbon.cpp | /*maruf_bro*/
#include <bits/stdc++.h>
using namespace std;
#define IO \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL)
#define ld long double
#define ll long long
#define vec vector<ll>
#define pb push_back
#define fcin(n) \
for ... | ALGO | 0.999559 | 4.590566 |
b19a76b9-01af-43c3-97a3-ea030063c2a6 | alexandraback/datacollection | solutions_5631572862566400_0/C++/Zips/main.cpp | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<algorithm>
#define max_N 1003
using namespace std;
int T;
int N;
int TO[max_N];
int cyc[max_N];
int ST[max_N];
int top;
void findcyc(int j){
int isin = 0;
for(int i=0; i<top; i++){
if(ST[i] == j) isin = i;
}
if(isin != 0){
for(i... | ALGO | 0.999775 | 4.240335 |
5990f298-c120-4579-aa05-d227593879d6 | Krishrajput1107/Data-Structure-Algorithms | practicerecursion.cpp/lecture35/Quicksort.cpp | #include<iostream>
using namespace std;
int partition(int arr[],int s,int e){
int cnt=0;
int pivot=arr[s];
for(int i=s+1;i<=e;i++){
if(arr[i]<pivot){
cnt++;
}
}
int i=s;
int j=e;
int pivotIndex=s+cnt;
swap(arr[s],arr[pivotIndex]);
while(i<pivotIndex && j>p... | ALGO | 0.999968 | 4.9423 |
fb48b25c-d245-487c-9434-d3311b2f88e6 | shinchan367/interview_DS | queue/sequential digits.cpp | //Example 1:
//Input: low = 100, high = 300
//Output: [123,234]
//Example 2:
//Input: low = 1000, high = 13000
//Output: [1234,2345,3456,4567,5678,6789,12345]
class Solution {
public:
vector<int> sequentialDigits(int low, int high) {
queue<int>q;
for(int i=1;i<=9;i++){
q.push(... | ALGO | 0.999913 | 5.761778 |
1957424c-4735-4085-8299-175a3bbdcf7b | SonarOpenCommunity/sonar-cxx | cxx-squid/src/test/resources/parser/examples/algo/minmax1.cpp | #include <cstdlib>
#include "algostuff.hpp"
using namespace std;
bool absLess (int elem1, int elem2)
{
return abs(elem1) < abs(elem2);
}
int main()
{
deque<int> coll;
INSERT_ELEMENTS(coll,2,8);
INSERT_ELEMENTS(coll,-3,5);
PRINT_ELEMENTS(coll);
// process and print minimum and maximum
co... | ALGO | 0.99649 | 5.232082 |
ba20ef00-a78c-4299-9d70-512b68ac11e0 | simon-stahlberg/mimir | src/search/algorithms/iw.cpp | #include "mimir/search/algorithms/iw.hpp"
#include "mimir/common/printers.hpp"
#include "mimir/formalism/problem.hpp"
#include "mimir/search/algorithms/brfs.hpp"
#include "mimir/search/algorithms/brfs/event_handlers.hpp"
#include "mimir/search/algorithms/iw/event_handlers.hpp"
#include "mimir/search/algorithms/iw/even... | ALGO | 0.993557 | 5.06057 |
fbd67117-e21a-4c83-9a0a-d8d224d1f257 | Asceticm/AlgorithmPractice | audition/3MaxSumofChildArray.cpp | #include <iostream>
using namespace std;
int maxSum(int *a, int n)
{
int sum = 0;
int b = 0;
for(int i=0; i < n; i++)
{
if(b <= 0)
b = a[i];
else
b += a[i];
if(sum < b)
sum =b;
}
return sum;
}
int main()
{
int a[10] = {1,-2,3,10,... | ALGO | 0.999896 | 4.316423 |
ca7ad23f-1b7d-4d4e-ab4d-15dd4351e18b | ishandutta2007/codeforces | mr.ilchi/normal/321/C.cpp | /*
* in the name of god
*
*
*
*
*
*
*
*
*/
#include <iostream>
#include <fstream>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <algorithm>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map... | ALGO | 0.999969 | 4.060019 |
fe490fe0-0842-4e00-9ae7-469fa4b08ee1 | slanzi00/instantons-monte-carlo | lattice-solutions/src/lattice.cpp | #include "lattice.hpp"
double AnharmonicPotential::operator()(double x)
{
return std::pow(x * x - eta * eta, 2);
}
Lattice::Lattice(AnharmonicPotential const& potential) : m_potential{potential}
{
for (size_t i = 0; i != sv::n_lattice_points; ++i) {
#if defined COLD_START
positions[i] = COLD_START;
#elif defi... | ALGO | 0.997371 | 5.311601 |
b0ab5662-297d-48b9-aeb5-0cb234ee66f1 | gmrabbi/Academic-Code | 1st year 2nd semester/before exam/5_function/ex_3_practice.cpp | #include <iostream>
using namespace std;
void zeroSmaller(int &a , int &b)
{
if(a>b)
b=0;
else
a=0;
}
int main()
{
int a = 2 , b=4;
cout<<a<<" "<<b<<endl;
zeroSmaller(a, b);
cout<<a<<" "<<b<<endl;
return 0;
}
| ALGO | 0.99916 | 3.17663 |
ac15dc7c-dae8-49db-968e-7835db9817fb | giovannikurniawan/CourseNet-algorithm-and-data-structure | koding coba coba/Untitled1.cpp | #include <stdio.h>
#include <string.h>
int main(){
int i;
int val=0;
int angka [10] = {4, 6, 23, 12, 76, 45, 42, 96, 47, 9}
int b = 99;
for (i=0; i<10; i++){
if (angka[i]) == b);{
val =1;
break;
}
}
if (val == 1){
printf("Data Ditemukan!!!");
}
else {
printf("Data tidak ditemukan");
}
return 0;
}
| ALGO | 0.996111 | 3.21612 |
bbbd4465-351f-4d4b-96a9-c03b04c61eee | ishandutta2007/codeforces | dmitriy.belichenko/normal/431/A.cpp | #pragma GCC optimize("Ofast")
#include <iostream>
#include <map>
#include <vector>
#include <deque>
#include <algorithm>
#include <bitset>
#include <cstring>
#include <math.h>
#include <string>
#include <set>
#include <iomanip>
#include <bitset>
#include <random>
#include <complex>
#include <random>
#include <cassert>
... | ALGO | 0.999711 | 3.822676 |
9c3f0cd8-a840-4e95-8046-451fb9e9a200 | Ayush29Ayush/leetcode-gfg-problems | 0347-top-k-frequent-elements/0347-top-k-frequent-elements.cpp | /*
MY YOUTUBE VIDEO ON THIS Qn : https://www.youtube.com/watch?v=GLw4WbJdYLw
Company Tags : Amazon, Accolite
Leetcode Qn Link : https://leetcode.com/problems/top-k-frequent-elements/
*/
//Approach-1 (Using min-heap) - TC : O(nlog(n-k))
class Solution {
public:
typedef pair<... | ALGO | 0.999988 | 6.407034 |
16192294-854e-497d-8162-cf06c07ea382 | adrielsumathipala/Stanford-CS-106B | Ngrams/src/ngrams.cpp | /* N-gram Random Writer Program
* CS 106B Assignment 2: Part B
* Author: Adriel Sumathipala
* This program takes in a text file and then randomly generates new text
* in a similar style using a hidden Markov model.
*/
//Standard C++ Libraries:
#include <cctype>
#include <cmath>
#include <fstream>
#include <iostre... | TOOL | 0.969004 | 7.154117 |
d391dcd9-2636-4902-a6e6-df5f8e194a6e | nkirov/nkirov.github.com | 2020/CSCB325/lectures/sources/bsearch.cpp | // bsearch.cpp
#include <iostream>
#include <vector>
#include <cstdlib>
#include <ctime>
using namespace std;
int binary_search(vector<int> v, int from, int to, int a)
{
if (from > to) return -1;
int mid = (from + to) / 2;
int diff = v[mid] - a;
if (diff == 0) return mid; /* v[mid] == a */
els... | ALGO | 0.999621 | 5.304327 |
941472c0-8fe4-4eee-933c-9de86226c28f | chiggum/spoj | OTHER SOLN/IMMERSED.cpp | #include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
int main() {
int T;
cin >> T;
for(int t = 0; t < T; ++t) {
long double P;
int c;
cin >> P >> c;
long double low = 0.0, high = 13.0, mid;
double log10P = log10(P);
for(int i = 0; i < 25; ++i) {
mid = (low + high)*0.5;
doub... | ALGO | 0.999734 | 3.645326 |
16f93b7a-b308-4bdc-a100-794906c379ce | ayush9009/Placement-Drive-Classes | GFG FindPatterns.cpp | class Solution{
public:
int numberOfSubsequences(string s, string w){
// code here
int ans=0;
// aabbccdd
// * * * ,*denotes particular subequence is visited(taki hum same seq. multiple times na cnt kare)
// ******
while(1){
int i=0,j=0;
... | ALGO | 0.999954 | 5.341645 |
ddbac750-3e25-449b-bceb-7711ba21d943 | akaimody123/Traffic_light_classification | Ipopt-3.12.7/Ipopt/src/Algorithm/IpAugRestoSystemSolver.cpp | #include "IpAugRestoSystemSolver.hpp"
#include "IpCompoundMatrix.hpp"
#include "IpCompoundSymMatrix.hpp"
#include "IpCompoundVector.hpp"
#include "IpSumSymMatrix.hpp"
#include "IpDiagMatrix.hpp"
#include "IpLowRankUpdateSymMatrix.hpp"
namespace Ipopt
{
#if COIN_IPOPT_VERBOSITY > 0
static const Index dbg_verbosity = ... | ALGO | 0.999661 | 6.167529 |
a729e9b5-54b3-4495-9976-1edc907560e5 | ishandutta2007/codeforces | ftiasch/normal/908/C.cpp | #include <algorithm>
#include <cmath>
#include <cstdio>
const int N = 1000;
int n, r, x[N];
double y[N];
int main()
{
scanf("%d%d", &n, &r);
for (int i = 0; i < n; ++ i) {
scanf("%d", x + i);
}
for (int i = 0; i < n; ++ i) {
double& yy = y[i] = r;
for (int j = 0; j < i; ++ j) ... | ALGO | 0.999982 | 3.454726 |
ae0f07ab-fd36-4f9f-acc3-25fe76dbd763 | OtakuTotipotent/CPP | CPP-DSA/NumberSystem/DecimalToOctal.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int deci;
cout << "Enter decimal number : ";
cin >> deci;
int ans = 0, p = 1; // p : 10^0, 10^1, 10^2, . . .
while (deci > 0)
{
int rem = deci % 8;
deci /= 8;
ans += p * rem;
p *= 10;
}
cout << ... | ALGO | 0.994578 | 4.963198 |
1a72bded-b176-418c-8cbf-8e5e076c74ec | GSNCunha/Marlin-Renato | buildroot/share/PlatformIO/variants/MARLIN_F4x7Vx/variant.cpp | #include "pins_arduino.h"
#ifdef __cplusplus
extern "C" {
#endif
// Digital PinName array
const PinName digitalPin[] = {
PA_0, // Digital pin 0
PA_1, // Digital pin 1
PA_2, // Digital pin 2
PA_3, // Digital pin 3
PA_4, // Digital pin 4
PA_5, // Digital pin 5
PA_6, // Digital pin 6
PA_7, // Dig... | CONFIG | 0.917435 | 6.185098 |
bfaf8697-a821-4823-9214-35f3b97e0fb1 | s3yoonpark/2024AOC | 2b.cpp | #include <bits/stdc++.h>
#define int long long
#define ssize(x) (int)x.size()
using namespace std;
bool good(vector<int>& x) {
for (int ii=0; ii<ssize(x); ii++) {
vector<int> u;
for (int j=0; j<ii; j++) u.push_back(x[j]);
for (int j=ii+1; j<ssize(x); j++) u.push_back(x[j]);
bool work = 1;
... | ALGO | 0.99974 | 4.670285 |
8bab5eef-a87d-421d-94f6-af833dc63c4f | Aarnachauhan/DSA- | Dynamic prog /0 1 knapsack.cpp | naukri . com
recursion
tc-o(2^n)
sc-
#include <bits/stdc++.h>
int f(int ind , int maxi , vector<int> &wt , vector<int> &val){
if(ind==0){
if(wt[0]<= maxi) return val[0];
else return 0;
}
int nottake=f(ind-1 , maxi , wt , val);
int take=INT_MIN;
if(wt[ind]<=maxi){
take=val[ind] + f(ind-1 , maxi-wt[ind], ... | ALGO | 0.999997 | 5.699617 |
05c8ce98-5fd8-4566-963e-94bcb36136eb | lequochaidevh/arduPilot | libraries/AP_RangeFinder/AP_RangeFinder_VL53L0X.cpp | /*
driver for ST VL53L0X lidar
Many thanks to Pololu, https://github.com/pololu/vl53l0x-arduino and
the ST example code
*/
#include "AP_RangeFinder_VL53L0X.h"
#if AP_RANGEFINDER_VL53L0X_ENABLED
#include <utility>
#include <AP_HAL/AP_HAL.h>
#include <AP_HAL/utility/sparse-endian.h>
#include <stdio.h>
extern ... | TOOL | 0.854912 | 6.593059 |
2e8ec897-380c-4ce1-a869-8718dab03190 | ishandutta2007/codeforces | rxdoi/normal/492/E.cpp | #include<cstdio>
using namespace std;
const int Maxn=1e6+19;
int n,m,dx,dy,x,y,t;
int A[Maxn],Ans[Maxn];
int main()
{
scanf("%d%d%d%d",&n,&m,&dx,&dy);
for (int i=0;i<n;i++) A[x]=y,(x+=dx)%=n,(y+=dy)%=n;
while (m--)
{
scanf("%d%d",&x,&y);
Ans[(y-A[x]+n)%n]++;
}
for (int i=0;i<n;i++) if (Ans[i]>Ans[t]) t=i;
... | ALGO | 0.999976 | 3.902051 |
911c2eb5-b70f-4d84-9e6d-df9b4097b6d5 | AditiKandhway/30daysofcodewithgfg | Solution28.cpp | class Solution{
public:
int min_sprinklers(int gallery[], int n)
{
// code here
int arr[n];
memset(arr,-1,sizeof(arr));
for(int i=0;i<n;i++)
{
if(gallery[i]==0)
{
arr[i]=max(arr[i],i);
continue;
}
... | ALGO | 0.999961 | 5.149523 |
fc890b57-4c87-49da-a0c7-c033f7689664 | lucasg1/sard_dataset_without_bias | dataset/Juliet-1/69381-v1.0.0/src/testcases/CWE122_Heap_Based_Buffer_Overflow/s04/good_CWE122_Heap_Based_Buffer_Overflow__cpp_CWE806_char_memcpy_65b.cpp | namespace NAMESPACE0
{
void FUN0(char * data);
void FUN1()
{
char * data;
void (*funcPtr) (char *) = FUN0;
data = new char[100];
memset(data, 'A', 50-1);
data[50-1] = '\0';
funcPtr(data);
}
}
namespace NAMESPACE0
{
void FUN0(char * data)
{
{
char dest[50] = "";
memcpy(dest... | TOOL | 0.872005 | 3.240638 |
8e46f3fb-8f1c-49b8-aa2e-46d3a07a38af | Venkat-Gowtham/Leet_Code_Problems | 560-subarray-sum-equals-k/subarray-sum-equals-k.cpp | class Solution {
public:
int subarraySum(vector<int>& nums, int k) {
unordered_map<int,int>mp;
int cur =0;
int c = 0;
mp[0]=1;
for(int i = 0;i<nums.size();i++){
cur+=nums[i];
int rem = cur - k;
if(mp.find(rem)!=mp.end()){
c+... | ALGO | 0.999938 | 6.035153 |
169bea54-8133-4ca1-891d-e7644862b422 | towsif45/leetcode-solutions | 15_3Sum.cpp | class Solution {
public:
vector<vector<int>> threeSum(vector<int>& nums) {
int n = nums.size();
sort(nums.begin(), nums.end());
vector<vector<int>> ans;
for(int i=0; i<n; i++){
for(int j=i+1, k=n-1; j<n && k>j;){
if(nums[i] == -nums[j]-nums[k]){
... | ALGO | 0.999958 | 5.669739 |
66c6fee3-e50a-4fcc-a779-46d2457862a9 | txxxxc/competitive-programming | ABC_234/b/first/index.cpp | #include <bits/stdc++.h>
using namespace std;
#define debug(arg) std::cerr << #arg << ": " << (arg) << '\n'
#define INF ((1LL<<62)-(1LL<<31))
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
using ll = long long;
using P = pair<int, int>;
using Graph = vector<vector<int>>;
dou... | ALGO | 0.999809 | 3.891265 |
2ce55f02-f7f8-40d8-93a3-b2f0fc35768e | marinvhs/coding | uva/Volume CXVII/11737.cpp | #include <cstdio>
const int N = 10000;
int h[N], w[N];
int abs(int a){ return a < 0 ? -a : a; }
int main(void){
for(int cnum = 1, n; scanf("%d", &n) == 1; ++cnum){
int a, b, d1, d2, min = 100000, no = 0;
for(int i = 0; i < n; ++i){
scanf("%d %d", &a, &b);
d1 = abs(a - b);
if(a == b) no = 1;
if(d1 < mi... | ALGO | 0.999672 | 3.599334 |
961a06a7-2cd9-4b1c-822b-cb960d8a9dc6 | timothyshull/algorithms_scratchpad_old | ll_ex_10.cpp | #include <iostream>
using namespace std;
template<typename T>
class List {
struct Node {
T data;
Node* next;
Node(T d, Node* n = 0) : data(d), next(n) { }
};
Node* head;
public:
List(Node* h = 0) : head(h) { }
~List();
void insert(Node* loc, T d);
void push_ba... | ALGO | 0.995638 | 4.419654 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.