uuid stringlengths 36 36 | repo_name stringlengths 5 123 | relative_path stringlengths 5 4k | content stringlengths 33 2.85M | category stringclasses 6
values | algo_rel_score float64 0.85 1 | quality_score float64 3 8.76 |
|---|---|---|---|---|---|---|
749d12ed-d7f0-4037-9748-63f8edc94f44 | kkisic/Procon | CPP/AtCoder/other/joi2009yo/d.cpp | #include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <iomanip>
#define int long long int
#define rep(i, n) for(int i = 0; i < (n);... | ALGO | 0.999866 | 4.264071 |
b9521181-d6b7-46dd-90d9-6306d3db9fd4 | educatedpolarbear/Rep3 | TimMAX.cpp | #include <bits/stdc++.h>
using namespace std;
int M = 1e9+7;
int main()
{
int N;
cin>>N;
while(N--)
{
int a;
cin>>a;
long long C[a];
for (long long i=0; i<a; i++) cin>>C[i];
sort(C,C+a);
long long total = 0;
for (long long i=1; i<a; i++) total = (total + i*C[i]) %M;
cout<<total<<endl;
}
}
| ALGO | 0.999831 | 3.74721 |
e462f948-b92b-41d6-b726-a3a5cd3ee1fb | linciss/Cpp-School | CodeWars/Murmināšana/main.cpp | #include <iostream>
#include <string>
class Accumul
{
public:
static std::string accum(const std::string &s)
{
std::string result;
for (int i = 0; i < s.length(); i++)
{
result += toupper(s[i]);
for (int j = 0; j < i; j++)
{
result += ... | ALGO | 0.998606 | 5.796245 |
a311ceee-3466-4d6d-83c5-250cdb5a3e10 | hecoding/EDA-TAIS-DA | TAIS/practicas/prac1/probar-mont.cpp |
#include "../tiposdelprofesor/ColaPrio.h"
bool menorer(const int& a, const int& b) {
return a < b;
}
bool mayore(const int& a, const int& b) {
return a > b;
}
int maine(int argc, char* argv[]) {
ColaPrio<int, menorer> colamin { };
ColaPrio<int, mayore> colamax { };
bool seguir { true };
int entrada { };... | ALGO | 0.998977 | 4.255373 |
b562b357-179c-47d7-b33e-8becd2ca7db7 | horagong/CarND-MPC-Project | src/Eigen-3.3/doc/examples/Tutorial_BlockOperations_vector.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace std;
int main()
{
Eigen::ArrayXf v(6);
v << 1, 2, 3, 4, 5, 6;
cout << "v.head(3) =" << endl << v.head(3) << endl << endl;
cout << "v.tail<3>() = " << endl << v.tail<3>() << endl << endl;
v.segment(1,4) *= 2;
cout << "after 'v.segment(1,4) *= 2', v... | ALGO | 0.991648 | 3.093805 |
d2327550-ed50-49c2-aacf-599c79e08088 | reaper2171/dsa | linkedlists/RevKnodes.cpp | #include <bits/stdc++.h>
using namespace std;
class Node{
public:
int data;
Node* next;
Node(int data){
this->data = data;
this->next = NULL;
}
};
Node* getKthNode(Node* temp, int k){
Node* t = temp;
int cnt = 0;
while(t!=NULL){
cnt+... | ALGO | 0.999971 | 4.165637 |
44af0e05-aff2-42ac-94a5-62ab8bc9573a | xin-lover/leetcode-explore | main23.cpp | #include <cstdio>
#include <string>
#include <vector>
using namespace std;
bool isSubsequence(string s, string t) {
//思路:主要的问题在于t会非常大,如何快速求解是这个问题的关键
//先用普通遍历法求解
// if(s.empty())
// {
// return true;
// }
// if(s.size() > t.size())
// {
// return false;
// }
/... | ALGO | 0.999965 | 3.743474 |
2feaf87b-adf4-4f21-a4bd-95ec8c62f7c8 | Namchee/ngel33t | probs/1306.cpp | #include <queue>
#include <vector>
using namespace std;
class Solution {
public:
bool canReach(vector<int>& arr, int start) {
queue<pair<int, int> > q;
q.push({ start, 0 });
vector<bool> visited(arr.size(), false);
while (!q.empty()) {
pair<int, int> p = q.front();
... | ALGO | 0.999997 | 5.378139 |
b38e5712-3204-41cf-8abb-321afe39b302 | sseleman95/COJ | c++/2322 - Electrical Outlets.cpp | #include <stdio.h>
int main(void)
{
int t, k, ok, p;
scanf("%d", &t);
while (t--)
{
scanf("%d", &k);
p = 1;
while (k--)
{
scanf("%d", &ok);
p += (ok - 1);
}
printf("%d\n", p);
}
return 0;
} | ALGO | 0.999348 | 3.146208 |
d6487de8-a279-4070-a843-f280cad1830d | William-J-Daniels/DanielsAms326 | RootFinding/examples/newton_example.cpp | #include <newtonraphson.h>
#include <cmath>
double MyFunc(double input);
int main()
{
auto Test = roots::NewtonRaphson(MyFunc);
std::cout << Test.find_root(3.1415) << std::endl;
return 0;
}
double MyFunc(double input)
{
return (std::pow(input-5.4, 2));
}
| ALGO | 0.999774 | 4.497097 |
326f4ade-62e8-400b-8500-dbb799f27589 | LuizEscobarC/C-language-learning | Linguagem C/Estruta condicional e de Repetição/exercicio nivel 11 Repetição e If.cpp | #include <stdio.h>
#include <stdlib.h>
int main()
{
char frase [100];
int cont, qtd_imprimir;
printf("Digite a frase que deseja imprimir de no maximo 100 caracteres: \n");
gets(frase);
printf("Agora quantas vezes deseja imprimir na tela?\n");
scanf("%d", &qtd_imprimir);
for (cont = 1; cont <= qtd_imprimir; con... | ALGO | 0.987736 | 3.011288 |
8e3b728e-9945-4e0d-955b-461ad95c984f | kmjp/procon | codeforce/501-540/519/a.cpp | #include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;
#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZER... | ALGO | 0.999963 | 3.810861 |
a56721b3-99c9-40c0-b878-5236051b7055 | AlejandroSPosada/data_structure_and_algorithms | maths/power.cpp | /*
Idea behind:
b ^ a = (b^(a/2))^2
7^4 = 7^2 * 7^2, instead of 2*2*2*2
3^8 = 3^4 * 3^4, instead of 2*... 8 times
5^11 = 5^5 * 5^5 * 5, instead of 5*... 11 times
*/
/*
3^11
3^11 = (3^5)^2 * 3
3^5 = (3^2)^2 * 3
3^2 = (3^1)^2
3^1 = (3^0)^2 * 3
*/
#include<bits/stdc++.h>
using namespace std;
int power1(int a, int b)... | ALGO | 0.999925 | 4.752505 |
14b5f134-4404-4748-ba36-142e4ed96699 | yunsanghum/yun | ArduSub/Attitude.cpp | #include "Sub.h"
// get_pilot_desired_angle - transform pilot's roll or pitch input into a desired lean angle
// returns desired angle in centi-degrees
void Sub::get_pilot_desired_lean_angles(float roll_in, float pitch_in, float &roll_out, float &pitch_out, float angle_max)
{
// sanity check angle max parameter
... | ALGO | 0.975227 | 5.571428 |
da53ca14-3ef6-448b-93da-f0f588cd4bfc | RamazanFIT/algorithms | div4_1/t6.cpp | // Bismillah
// لا إله إلا الله محمد رسول الله
#include <bits/stdc++.h>
#define ENDL "\n"
#define ff first
#define ss second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define endd return 0;
#define int ll
#define int ll
#define repeat(x) for(int _ = 0; _ < x... | ALGO | 0.999882 | 4.605189 |
c81553d3-b222-4bf5-87cd-2b2899e30267 | Cedric-Perauer/SFND-Kalman_Filter | C++/UKF/UKF_Augmented_State/main.cpp | #include <iostream>
#include "ukf.h"
using Eigen::MatrixXd;
using Eigen::VectorXd;
UKF::UKF() {
Init();
}
UKF::~UKF() {
}
void UKF::Init() {
}
/**
* Programming assignment functions:
*/
void UKF::AugmentedSigmaPoints(MatrixXd* Xsig_out) {
// set state dimension
int n_x = 5;
// set augmented dimensi... | ALGO | 0.99523 | 5.646253 |
4ce937e4-3945-4ef9-96bd-5dfdfd906f2e | Crowbar1024/myAlgorithms | String/kmp.cpp | #include "myheader.h"
// 28 medium 字符串匹配,haystack中needle部分的第一个下标,没有包括就返回-1
// https://www.zhihu.com/question/21923021/answer/281346746
void getNext(string& pattern, vector<int>& next) {
next[0] = -1;
int i = 0, j = -1; // i是后缀第一个的下标,j是前缀第一个的下标
while (i < pattern.size()-1) { // 知乎的边界是是错的,因为是先+1再赋值
i... | ALGO | 0.99956 | 4.701948 |
7143d99e-1817-4752-a0a1-2aa1581815d1 | EwhaKing/AltuBitu_Algorithm_Study | Haeun/[220221] 분할 정복/[boj] 1244_스위치켜고끄기.cpp | #include <iostream>
#include <vector>
#include <string>
using namespace std;
void switchTarget(vector<bool>& switchList, int target)
{
switchList[target] = !switchList[target];
}
void girlSwitch(vector<bool>& switchList, int myNum)
{
int lastNum = switchList.size() - 1;
switchTarget(switchList, myNum);
if (myNum =... | ALGO | 0.999986 | 3.514807 |
8958521f-9b36-4003-93ed-7a9c992f4d2b | adrijacs/DSA-Practice | DP/MaxAltSubseqSum.cpp | #include<bits/stdc++.h>
using namespace std;
class Solution{
public:
static int maxSumAlt(int index, vector<int>&arr,vector<int>&dp ){
if(index==0)return arr[index];
if(index<0)return 0;
if(dp[index]!=-1)return dp[index];
int pick=arr[index]+maxSumAlt(index-2,arr,dp);
int nonpick=0 + maxSumAlt(index-1,arr,dp)... | ALGO | 0.999986 | 4.936471 |
96eba4ca-c92c-437b-8a5d-f7832ebe0941 | Mulab11/cntt2016-hw1 | TC-SRM-577-div1-1000/c_sunshine.cpp | #include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<vector>
using namespace std;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int maxp=2555,maxe=100005,inf=maxe;
class BoardPainting
{
public:
int n,m;
char s[55][55];
int head[maxp],adj[maxe],f[maxe],... | ALGO | 0.999748 | 3.381648 |
c70ccd3f-9dc4-466a-8eb1-c4b37df1e2e8 | trqminh/cp-code | cpp/Trie/Contacts.cpp | //https://www.hackerrank.com/challenges/contacts/problem
#include <bits/stdc++.h>
using namespace std;
#define MAX 26
struct Node
{
Node *child[MAX];
int cntPass;
};
Node *newNode()
{
Node *p = new Node;
p->cntPass = 0;
for (int i = 0; i < MAX; i++)
{
p->child[i] = NULL;
}
return p;
}
void addWord(Node... | ALGO | 0.999679 | 4.954768 |
3a7f5cab-e847-4b3e-85cf-8e97446b72a4 | Vish-001/LeetCode | 0876-middle-of-the-linked-list/0876-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.999911 | 5.833707 |
4f97f106-a2f1-449f-8683-75e9733a7def | goldenhand76/StructuralAnalysisOpenMP | src/BoundaryConditionsOpenMP.cpp | #include "BoundaryConditionsOpenMP.h"
#include <omp.h>
// Function to apply boundary conditions (fixed nodes and loads)
void BoundaryConditions::applyBoundaryConditions(std::vector<std::vector<double>>& K_global, std::vector<double>& F, const std::vector<int>& fixedNodes, const std::vector<Load>& loads) {
// Apply... | ALGO | 0.999525 | 6.706428 |
4891b700-1145-452f-9327-1ab13edbd9b1 | MPSLab-ASU/ccf | llvm-project/llvm/tools/llvm-profgen/PerfReader.cpp | static cl::opt<bool> ShowMmapEvents("show-mmap-events", cl::ReallyHidden,
cl::init(false), cl::ZeroOrMore,
cl::desc("Print binary load events."));
static cl::opt<bool> ShowUnwinderOutput("show-unwinder-output",
... | TOOL | 0.974649 | 4.854348 |
99720b43-107c-4005-a10b-7b77ae5f4b38 | RobertoAguirre/cucuygame | Library/PackageCache/com.unity.ide.visualstudio@2.0.16/Editor/COMIntegration/COMIntegration~/COMIntegration.cpp | #include <iostream>
#include <sstream>
#include <string>
#include <filesystem>
#include <windows.h>
#include <shlwapi.h>
#include <fcntl.h>
#include <io.h>
#include "BStrHolder.h"
#include "ComPtr.h"
#include "dte80a.tlh"
constexpr int RETRY_INTERVAL_MS = 150;
constexpr int TIMEOUT_MS = 10000;
// Often a DTE call m... | TOOL | 0.955694 | 6.957276 |
eaa0c6f0-b62a-494b-a289-375117d80ba7 | gilbertoalexsantos/judgesolutions | Solved/UVA/@UVA 1237 - Expert Enough/1237 - Expert Enough.cpp | //Author: Gilberto A. dos Santos
//Website: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=3678
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;
int t, d, l, h, q, p;
int ll[10000], rr[10000];
char m[10000][21];
int getK(... | ALGO | 0.999513 | 3.42681 |
a42651cc-b5b3-4159-a450-055425385e7a | Kuliyalrashmi/DSA_Questions | 2491-divide-players-into-teams-of-equal-skill/2491-divide-players-into-teams-of-equal-skill.cpp | class Solution {
public:
long long dividePlayers(vector<int>& skill) {
sort(skill.begin(),skill.end());
long long total_skill=0;
for(auto s:skill)
{
total_skill+=s;
}
int n=skill.size();
total_skill/=(n/2);
int start=0,end=n-1;
long... | ALGO | 0.999975 | 5.442802 |
fc22a777-50af-4311-a1ef-3f9ee44fed47 | flagflag/FlagGG | 3rd/bgfx/bimg/3rdparty/libsquish/squish.cpp | #include "squish.h"
#include "colourset.h"
#include "maths.h"
#include "rangefit.h"
#include "clusterfit.h"
#include "colourblock.h"
#include "alpha.h"
#include "singlecolourfit.h"
namespace squish {
static int FixFlags( int flags )
{
// grab the flag bits
int method = flags & ( kDxt1 | kDxt3 | kDxt5 | kBc4 | kBc5 ... | TOOL | 0.851183 | 7.224774 |
c2e19fad-92ee-41e9-9dce-e87854425296 | Lee-HoJin/BaekJoon | 13. 정렬/2750_수정렬하기/test.cpp | #include <iostream>
using namespace std;
#include "test.h"
int main ( void ) {
int i, n;
cin >> n;
int *input = new int[n];
for ( int i = 0; i < n; i++ ) {
cin >> input[i];
}
// bubble_sort(input, n);
// selection_sort( input, n );
// insertion_sort( input, n );
// quick... | ALGO | 0.999882 | 4.597402 |
fc05b514-c96a-495e-97e5-163995e4f3e6 | castle-engine/castle-engine | tools/build-tool/data/android/services/sound/app/src/main/cpp/sound/openal-soft/alc/effects/equalizer.cpp | #include "config.h"
#include <algorithm>
#include <array>
#include <cstdlib>
#include <functional>
#include <iterator>
#include <utility>
#include "alc/effects/base.h"
#include "almalloc.h"
#include "alspan.h"
#include "core/ambidefs.h"
#include "core/bufferline.h"
#include "core/context.h"
#include "core/devformat.h... | TOOL | 0.929169 | 6.946591 |
b86ac782-ce77-49c2-9cc9-bc07a1966ba6 | Tinganz/speech_ncnn | ncnn/src/layer/arm/unaryop_arm.cpp | #include "unaryop_arm.h"
#include <math.h>
#if __ARM_NEON
#include <arm_neon.h>
#include "neon_mathfun.h"
#endif // __ARM_NEON
#include "arm_usability.h"
#include "cpu.h"
namespace ncnn {
UnaryOp_arm::UnaryOp_arm()
{
#if __ARM_NEON
support_packing = true;
#if NCNN_ARM82
support_fp16_storage = cpu_support_... | ALGO | 0.992389 | 7.278126 |
c7d28d90-a3a9-4701-8da4-c3773fac9063 | kelvin926/korea_univ_computer_language_2 | 과제02/ch02_02.cpp | // 2021271424 ̷Ƽа
// 01_ch02_02.cpp
#include <iostream>
using namespace std;
int main()
{
float num[5], max;
int i;
cout << "5 Ǽ Է϶>>";
for (i = 0; i < 5; i++)
{
cin >> num[i];
}
max = num[0];
for (i = 1; i < 5; i++)if (max < num[i])max = num[i];
cout << " ū = [" << max ... | ALGO | 0.981039 | 3.507793 |
183c9327-aaae-46a9-bf6f-3e4648dad0e7 | DingTom23/PTA-Problem-Solution | Session2/3-6.cpp | #include <iostream>
#include <string>
using namespace std;
class Vehicle {
protected:
string NO; // 车牌号
public:
Vehicle(string no) : NO(no) {} // 构造函数初始化车牌号
virtual void display() = 0; // 纯虚函数,用于输出费用
};
class Car : public Vehicle {
private:
int guest; // 载客数
int weight; // 重量
public:
Car(strin... | TOOL | 0.929878 | 5.238741 |
2e945d2d-5cf6-4fb6-beee-4e0dc71abb01 | Dongubak/BOJ-REMIND | Prefix Sum/크리스마스인형.cpp | #include <bits/stdc++.h>
#define ll long long
#define MOD 20091101
using namespace std;
int D[100000 + 1];
int psum[100000 + 1];
int cnt[100000 + 1];
int getClosestCommonMod(int i) {
if(i <= 0) return -1;
int findMod = psum[i];
int j;
for(int j = i - 1; j >= 0; j--) {
if(psum[j] == findMod) {
retur... | ALGO | 0.999738 | 3.872045 |
c822b582-abc5-4f26-9811-4abb91f5f0be | Flate0n/CPP_2023 | task_M08.cpp | //M08 (4б) Функция get_angle() принимает три числа - длины трех сторон треугольника и возвращает значение угла
// (в градусах), расположенного напротив первой стороны.
//Разрешено использовать обратные тригонометрические функции из библиотеки math.h.
// Введите проверку на корректность значений аргументов (>0).#include... | ALGO | 0.998273 | 4.894063 |
4e68ea5b-f2e3-48b9-850f-028c9c8649bb | ZodiacNumblzw/LZW-ACM-Template | LZW_ACM_Template/Data Structure/线段树 by_sjf.cpp | //sjf߶
struct Segment_Tree
{
#define type int
#define ls (id<<1)
#define rs (id<<1|1)
int n,ql,qr;
type a[MAX],v[MAX<<2],tag[MAX<<2],qv;
void pushup(int id)
{
}
void pushdown(int id)
{
if(!tag[id]) return;
}
void build(int l,int r,int id)
{
tag[id]=0;
if(l==r)
{
v[id]=a[l];
return;
}
... | ALGO | 0.999706 | 3.764361 |
acf78b14-5d3e-4975-b482-b9587a132a0c | mushanshanshan/LeetCode | 104. Maximum Depth of Binary Tree tr.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.999815 | 6.485412 |
86002865-fd2f-4970-9fcb-aa33880dcd67 | OpenPrinting/splix | src/rendering.cpp | #include "rendering.h"
#include "qpdl.h"
#include "page.h"
#include "cache.h"
#include "errlog.h"
#include "colors.h"
#include "request.h"
#include "printer.h"
#include "compress.h"
#include "document.h"
#ifndef DISABLE_THREADS
#include <pthread.h>
#include "semaphore.h"
static Document document;
static Semaphore _lo... | WEB | 0.881035 | 5.038711 |
b716b83e-3a0d-4ae9-a7ab-cea5a84d60ee | ankitmawle/VSDSquadron_pro_Edge_AI | sifive_tensorflow_lite_micro_implementation/sifive_hifive1_empty_1/tflm_src/tensorflow/lite/kernels/internal/common.cpp | #include "tensorflow/lite/kernels/internal/common.h"
#include <assert.h>
namespace tflite {
// Single-rounding MultiplyByQuantizedMultiplier
#if TFLITE_SINGLE_ROUNDING
int32_t MultiplyByQuantizedMultiplier(int32_t x, int32_t quantized_multiplier,
int shift) {
TFLITE_DCHECK(quant... | ALGO | 0.983347 | 7.353066 |
e8473e41-08ab-4c92-8877-7d1c4649685e | KyumKyum/StudyingAlgorithm | Algorithm Assignments/Rod Cutting/Rodcutting.cpp | //2019014266_LimKyuMin_AlgorithmAnalysis(13:00~14:30)
#include <stdio.h>
int p[101];
int r[101];
int s[101];
int main(void){
int n = 0;
int i = 0;
int j = 0;
int max = 0;
scanf("%d",&n);
p[0] = 0;
s[0] = 0;
for(i = 1; i <= n; i++)
scanf("%d",&p[i]);
for(i = 0; i <= n; i++){
max = 0;
for(j = 1; j <... | ALGO | 0.999997 | 3.037766 |
59761c61-c39d-4b10-ab62-40b5fdc85b12 | M-Salameh/codeforces-problems | Q - Maximum GCD.cpp | #include <bits/stdc++.h>
#define int long long
#include <math.h>
#define endl '\n'
using namespace std;
int tc=1;
int n;
int a,b;
int LCM(int x , int y)
{
int a = __gcd(x,y);
return (x*y)/a;
}
int gcd_sum (int x)
{
int ans=0;
int y=x;
while (x>0)
{
ans += x%10;
x/=10;
}
... | ALGO | 0.999901 | 4.962633 |
c61d5bbd-f8b6-44fd-9b4d-2a705cdda630 | SeefAlmostafa/Programming | software_test/software_test.cpp |
using namespace std;
#include <iostream>
void ZaehleZchn(int&, int&);
void ZaehleZchn(int& VokalAnzahl, int& Gesamtzahl) {
char Zchn;
cin >> Zchn;
while ((Zchn >= 'A') && (Zchn <= 'Z') && (Gesamtzahl < INT_MAX))
{
if ((Zchn == 'A') || (Zchn == 'E') ||
(Zchn == 'I') || (Zchn == 'O') ||
(Zchn == 'U'))
{
... | ALGO | 0.975482 | 4.412223 |
a2677718-77c5-4446-bc6e-73d8ac689519 | liaohuangg/RfCgraTrans | llvm/clang-tools-extra/clang-tidy/llvm/IncludeOrderCheck.cpp | #include "IncludeOrderCheck.h"
#include "clang/Frontend/CompilerInstance.h"
#include "clang/Lex/PPCallbacks.h"
#include "clang/Lex/Preprocessor.h"
#include <map>
namespace clang {
namespace tidy {
namespace llvm_check {
namespace {
class IncludeOrderPPCallbacks : public PPCallbacks {
public:
explicit IncludeOrderP... | TOOL | 0.858264 | 7.849045 |
36f0d7a2-03cc-42fc-841c-31d2d2f4e1eb | sarvex/leetcode-chez | solution/0600-0699/0673.Number of Longest Increasing Subsequence/Solution.cpp | class Solution {
public:
int findNumberOfLIS(vector<int>& nums) {
int maxLen = 0, ans = 0, n = nums.size();
vector<int> dp(n, 1), cnt(n, 1);
for (int i = 0; i < n; ++i) {
for (int j = 0; j < i; ++j) {
if (nums[i] > nums[j]) {
if (dp[j] + 1 > dp... | ALGO | 0.999997 | 6.371733 |
612950b0-6b9c-4457-95e6-09e6641606e8 | b2389085/src | gnu/llvm/lldb/source/Plugins/SymbolFile/NativePDB/PdbUtil.cpp | #include "PdbUtil.h"
#include "DWARFLocationExpression.h"
#include "PdbIndex.h"
#include "PdbSymUid.h"
#include "llvm/DebugInfo/CodeView/CVTypeVisitor.h"
#include "llvm/DebugInfo/CodeView/SymbolDeserializer.h"
#include "llvm/DebugInfo/CodeView/TypeDeserializer.h"
#include "llvm/DebugInfo/PDB/Native/DbiStream.h"
#incl... | TOOL | 0.8913 | 4.695806 |
99c4eace-285f-4aac-b381-540402b91de8 | atef7534/codeforces1000 | #313 GCD vs LCM/solve.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <limits>
#include <string>
#include <cmath>
#include <set>
void solve();
int main(void)
{
int t;
std::cin >> t;
while (t--)
solve();
return 0;
}
void solve()
{
int n;
std::cin >> n;
std::cout << "1 " << n - 3 << ... | ALGO | 0.999492 | 3.583356 |
22d10ce6-e51e-41c0-b954-67a7d90ee0a5 | Malav-g-01/Algorithms-DS-STL | LinkedList All operations.cpp | /*
ENJOY CP !!!!!
Author :- Malav Gajjar
*/
#include<bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/trie_policy.hpp>
//using namespace __gnu_pbds;
using namespace std;
#define ll long long int
#define ld long double
#define mod ... | ALGO | 0.999739 | 3.17395 |
0f6d2d40-6693-4d6a-8c84-65d430c0e2a6 | Alber-Neto/codigos | uri1002.cpp | #include <iostream>
#include <iomanip>
using namespace std;
int main() {
double raio,n=3.14159;
cin >>raio;
cout << fixed << setprecision(4);
cout <<"A="<< n*raio*raio <<endl;
return 0;
} | ALGO | 0.996328 | 3.871412 |
9a11f01d-a9f0-4077-8c6d-3e7ac0a7317b | xi-guo-0/leetcode-solutions | cpp/0318-maximum-product-of-word-lengths.cpp | class Solution {
public:
int maxProduct(vector<string> &words) {
int ans = 0;
vector<unsigned> m(words.size(), 0);
for (int i = 0; i < words.size(); ++i)
m[i] = str2int(words[i]);
for (int i = 0; i < words.size(); ++i) {
for (int j = 0; j < i; ++j) {
if ((m[i] & m[j]) == 0 && ans <... | ALGO | 0.999777 | 5.707036 |
b244a137-c617-4b53-aa7a-b71d8b6f3a05 | zimpha/acm-icpc | ZOJ/vol17/ZOJ_2686.cpp | #include <cstdio>
#define MAXN 20
int a[MAXN];
int n;
int main()
{
int test;
int i,flag;
int count;
scanf("%d",&test);
while (test--)
{
scanf("%d",&n);
for (i=0;i<n;i++)
scanf("%d",&a[i]);
flag=0;
count=0;
for (i=0;i<n;i++)
if (a[... | ALGO | 0.999302 | 3.800296 |
c558459d-cd4f-4f14-8b6a-d6dff8830dae | towa-is-tmt/2023aaib3 | week06/week06-3.cpp | class Solution {
public:
bool judgeCircle(string moves) {
int x=0, y=0;
for(char c : moves){
if(c=='U') y++;
if(c=='D') y--;
if(c=='L') x--;
if(c=='R') x++;
}
if(x==0 && y==0) return true;
return false;
}
};
| ALGO | 0.999519 | 6.145144 |
b4c9512c-551d-4fe5-a579-82bad4edd446 | mpowrd/2ndYearSoftwareEngineering | FirstTerm/CPPProgramming/Práctica/Práctica/Ej4_T2.cpp | /*Escribe un programa que acepte como entrada desde teclado un nmero natural mayor que cero
y d como salida el resultado de sumar dos a dos los dgitos que aparecen en posiciones
simtricas respecto al dgito central dentro del nmero dado como entrada. Por ejemplo:
*/
#include <iostream>
#include <array>
using namespace s... | ALGO | 0.999929 | 4.705566 |
46ba716d-e279-4ddc-8022-5cf192b20f17 | yash0patel/progress-path | cpp/Exercise/fun103.cpp | // 103.Function to find maximum from the array elements ( passing array as argument )
#include <iostream>
#include <string.h>
using namespace std;
void max( int [], int);
int main()
{
int a[5], i, n = 5;
for(i = 0 ; i <n ; i++)
{
cin>>a[i];
}
max( a, n);
}
void max(int x[5], int n)
{
int i , max1;
max1=x[0];
... | ALGO | 0.999253 | 4.164366 |
90e30c49-0780-4b15-8104-70c638a4a375 | iamlvv/Some-basic-stuff-about-C- | anotherfiletocheck.cpp | #include <iostream>
#include <string>
#include <algorithm>
using namespace std;
struct Node {
int data;
Node* next = NULL;
};
struct LList {
Node* head = NULL;
};
class Fraction {
private:
int numerator, denominator;
public:
Fraction() {
this->numerator = 0;
this->denominator = ... | TOOL | 0.991143 | 4.966335 |
5935f5b3-1d52-4931-891f-891e5cc68a63 | dongheuw/ICPC-related | 2015-summer/0714/b.cpp | #include <cstdio>
#include <cstring>
#include <algorithm>
#define fo(i,a,b) for (int i = a;i <= b;i ++)
using namespace std;
const int maxn = 1005;
int T,cas,M,a[maxn];
int main()
{
freopen("b.in","r",stdin);
freopen("b.out","w",stdout);
scanf("%d",&T);
while (T --)
{
scanf("%d%d",&cas,&M);
int sum = 0;
... | ALGO | 0.999929 | 3.108658 |
0520785f-74a8-4b80-99c8-3fead8520100 | letelete/algorithms-and-data-structures | codeforces/practice/000253_B.cpp | #include <bits/stdc++.h>
#pragma GCC target("popcnt")
#define fastIO \
std::cin.tie(0); \
std::cout.tie(0); \
std::ios::sync_with_stdio(0);
template <typename T>
using v = std::vector<T>;
template <typename T>
using q = std::queue<T>;
template <typename T>
using pq = std::priority_queue<T>;
template <typ... | ALGO | 0.999951 | 4.775961 |
a81c0c08-f2ab-419e-84e6-90ce824a4fdb | Shreyanshsingh23/Competitive-Programming | A_Fancy_Fence.cpp | #include <bits/stdc++.h>
using namespace std;
#define ShreyanshSinghGautam cin.tie(nullptr);cout.tie(nullptr);ios::sync_with_stdio(false);
#define int long long
#define ln '\n';
#define all(x) x.begin(), x.end()
#define MAX LLONG_MAX
#define MIN LLONG_MIN
#define sz(x) x.size()
#define vi vector<int>
#define v vecto... | ALGO | 0.999607 | 4.366346 |
357e8640-61fa-4f81-a1ba-529ce09e2d2a | kamalnathdhekwar/competitive-programming | PrependandAppend.cpp | // *** ... जय श्री राम ... ***//
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define all(x) x.begin(),x.end()
#define for(i,a,b) for(ll i = a ; i<b ; i++)
#define forr(j,c,d) for(ll j = c ; j>=d ; j--)
#define yes cout<<"yes"<<endl
#define no ... | ALGO | 0.999916 | 4.182025 |
43f02751-b690-483d-979e-29c522bd62a4 | pingchungchang/CP | j008.cpp | #include <bits/stdc++.h>
using namespace std;
int n,m;
const int mxn = 505;
bool paths[mxn][mxn],visy[mxn];
int matchx[mxn],matchy[mxn];
bool dfs(int now){
for(int i = 1;i<=n;i++){
if(!paths[now][i]||visy[i])continue;
visy[i] = true;
if(!matchy[i]||dfs(matchy[i])){
matchy[i] = ... | ALGO | 0.999885 | 3.800708 |
09bf38a4-f622-4b21-9ed9-b7496e883b91 | jwanglof/TDP004 | André/Labb3/uppg4.cpp | #include <iostream>
#include <vector>
#include <sstream>
#include "Roman.cpp"
using namespace std;
int main(int argc, char *argv[])
{
vector<string> convertedSentence;
string inputFromFile;
unsigned input;
unsigned decimalSum;
unsigned romanSum;
while (cin >> inputFromFile) {
if (input = atoi(inputFromFil... | TOOL | 0.945775 | 4.915709 |
d8202d55-066d-40ca-93e5-77fc63cdecdf | MrE-Fog/navigate2coin | src/key.cpp | #include <key.h>
#include <arith_uint256.h>
#include <crypto/common.h>
#include <crypto/hmac_sha512.h>
#include <random.h>
#include <secp256k1.h>
#include <secp256k1_recovery.h>
static secp256k1_context* secp256k1_context_sign = nullptr;
/** These functions are taken from the libsecp256k1 distribution and are very ... | TOOL | 0.933932 | 7.293393 |
5f2401a4-01cb-4a95-9955-47169f593908 | StrangeMin/codetree-TILs | 240427/안전 지대/comfort-zone.cpp | #include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <climits>
using namespace std;
int N, M, K;
bool row[11];
bool column[11];
int board[51][51];
bool visited[51][51];
int ret = INT_MIN;
int dx[4] = { -1,0,1,0 };
int dy[4] = { 0,-1,0,1 };
void findFloodedArea(int y, int x, int k) {
... | ALGO | 0.999974 | 4.668386 |
067aff62-c3a8-4559-ac8b-b1c18001c115 | honggoonin/SoftMark | llvm-6.0.0/lib/Transforms/Utils/FlattenCFG.cpp | #include "llvm/ADT/SmallPtrSet.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/InstrTypes.h"
#include "llvm/IR/Instruction.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/Value.h"
#include "llvm/... | ALGO | 0.99306 | 7.63086 |
91292d65-8969-41b3-b0b0-1196c1aedbe6 | Sachleen095/DSA | 42-trapping-rain-water/trapping-rain-water.cpp | class Solution {
public:
int trap(vector<int>& height) {
//brute force using leftMax and rightMax
int n=height.size();
vector<int> prefix(n,0);
vector<int> suffix(n,0);
int ans=0;
prefix[0]=height[0],suffix[n-1]=height[n-1];
for(int i=1;i<n;i++) {
... | ALGO | 0.99999 | 6.796985 |
a72f92a0-ff22-4ad8-bd4c-c8ff95ed5adc | dh434/leetcode | tx50/136. 只出现一次的数字.cpp | /*
给定一个非空整数数组,除了某个元素只出现一次以外,其余每个元素均出现两次。找出那个只出现了一次的元素。
说明:
你的算法应该具有线性时间复杂度。 你可以不使用额外空间来实现吗?
示例 1:
输入: [2,2,1]
输出: 1
示例 2:
输入: [4,1,2,1,2]
输出: 4
*/
class Solution {
public:
int singleNumber(vector<int>& nums) {
int res = nums[0];
for(int i = 1;i<nums.size();++i)
res ^= nums[i];
... | ALGO | 0.999919 | 5.561709 |
76819bd1-3799-425c-9d9a-e29ff844bd9b | k28611-nits/Leetcode-Solutions | 1025-divisor-game/1025-divisor-game.cpp | class Solution {
public:
bool divisorGame(int n) {
return n%2==0;
}
}; | ALGO | 0.999945 | 5.556705 |
75d979ae-0595-4f2b-b0dd-3f60ae33078e | CodeTrans-Research/RefuTra | result/translate/transcoder/java2cpp2/cpp_eval/NEXT_POWER_OF_2_2.cpp | #include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <fstream>
#include <iomanip>
#include <bits/stdc++.h>
using namespace std;
unsigned int f_gold ( unsigned int n ) {
n --;
n |= n >> 1;
n |= n >> 2;
n |= n >> 4;
n |= n >> 8;
n |= n >> 16;
n ++;
return n;
}
int f_filled ... | ALGO | 0.995703 | 5.558169 |
b78570f8-f7fc-4e08-bf18-ea8fb64a1b99 | srijon-32/CP-Library | Math Related/Permutation & Combination/C_How_Does_the_Rook_Move.cpp | /* SRIJON
SINGHA
SAMANTA */
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define nl "\n"
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define yes cout << "YES" << nl
#define no cout << "NO" << nl
#define fi first
#define sec ... | ALGO | 0.999523 | 4.661813 |
cfb34fbc-8b5c-491d-a3e0-acd6db52fe9a | Xvedarito/C-Labs | repos/Sem2Lab4Task11/Sem2Lab4Task11.cpp | // Sem2Lab4Task11.cpp : Этот файл содержит функцию "main". Здесь начинается и заканчивается выполнение программы.
//
#include <iostream>
#include <conio.h>
using namespace std;
struct Stack {
unsigned char info;
Stack* next;
};
Stack* InS(Stack* peak, unsigned char in) {
Stack* temp = new Stack;
temp-... | ALGO | 0.999711 | 3.581512 |
6e15da75-d955-4e8a-9d7a-47b29a7994b7 | Rodrigo61/GUAXINIM | treino8/i.cpp | #include<bits/stdc++.h>
#define MAXN 1005
using namespace std;
typedef long long ll;
#define EPS 1e-9
struct point {
ll x, y;
point(){
x = y = 0ll;
}
point(ll _x, ll _y): x(_x), y(_y){
}
};
struct vec{
ll x, y;
vec(ll _x, ll _y): x(_x), y(_y){
}
};
vec toVec(point a, point b){
return vec(b.x - a.x, b.y... | ALGO | 0.999856 | 3.929234 |
a929d5e8-76eb-470a-ad80-2775603edcb8 | shamikh1014/ES | ss23.cpp | // 123. Kth element of two sorted arrays.
#include<bits/stdc++.h>
using namespace std;
int main(){
int t;
cin>>t;
while(t--){
long long int m, n, k, ans=-1;
cin>>m>>n>>k;
long long int a[m], b[n], idx=0;
for(int i=0;i<m;i++){
cin>>a[i];
}
f... | ALGO | 0.999988 | 4.151065 |
21165d39-a3bd-4890-9fb2-9485ce700d02 | khstudent-mit/plpractical | 10.pallindrome deque.cpp | #include <iostream>
class Deque {
struct Node {
char data;
Node* next;
Node* prev;
Node(char value) : data(value), next(nullptr), prev(nullptr) {}
};
Node* front;
Node* back;
public:
Deque() : front(nullptr), back(nullptr) {}
// Adds a character to the back of... | ALGO | 0.999643 | 7.014404 |
5c2e8bc2-1ffb-4744-b9be-471e205c1ed0 | noko206/AtCoder | e869120-selection/89.cpp | // clang-format off
#include <bits/stdc++.h>
using namespace std;
#if __has_include(<atcoder/all>)
#include <atcoder/all>
using namespace atcoder;
#endif
#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__,R... | ALGO | 0.999949 | 3.986551 |
0b3315c8-aa9c-4a8f-b3b4-6c777b67c23f | gehad-Ahmed30/sheet1-alazhar-15-26 | project_18/main.cpp | #include <iostream>
using namespace std;
int main()
{
int n,year,reminderday,month,day;
cin>>n;
cout<<n/365<<" years"<<endl;
n=n%365;
cout<<n/30<<" months"<<endl;
cout<<n%30<<" days"<<endl;
return 0;
}
| ALGO | 0.982934 | 3.422662 |
d6114b7f-459a-4a82-a0e7-34607572977c | HaiZeizhouyuan/HZOJ | 585.cpp | /*************************************************************************
> File Name: 585.cpp
> Author: zhouyuan
> Mail: <EMAIL>
> Created Time: 2020年09月13日 星期日 09时56分19秒
************************************************************************/
#include<iostream>
#include<cstdlib>
#include<algorithm>
using nam... | ALGO | 0.999907 | 3.885287 |
23d67243-3132-48ae-8948-868d300fde16 | abdellatif71/Flask-Honeypot-Logging-System | venv/lib/python3.12/site-packages/sklearn/svm/src/liblinear/tron.cpp | #include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include "tron.h"
#ifndef min
template <class T> static inline T min(T x,T y) { return (x<y)?x:y; }
#endif
#ifndef max
template <class T> static inline T max(T x,T y) { return (x>y)?x:y; }
#endif
static void default_print(const char *buf)
{... | ALGO | 0.999677 | 5.845381 |
f22d8cd5-acf0-4a32-89ba-faf89a3ae3d5 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_9282_119.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, m, k;
cin >> n >> m >> k;
if (n <= m && n <= k) {
cout << "Yes";
} else {
cout << "No";
}
return 0;
}
| ALGO | 0.999973 | 3.71915 |
e7badd2e-7a22-44ce-bcac-1fc900cae52e | ishandutta2007/codeforces | gmusya/normal/961/E.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#define ll long long
using namespace std;
vector <ll> t(800001);
void update(ll v, ll tl, ll tr, ll pos, ll val) {
if (tl == tr) {
t[v] += val;
return;
}
ll tm = (tl + tr) / 2;
if (pos <= tm) {
update(v * 2, tl, tm, pos, val);
t[v]++;
}
else {... | ALGO | 0.999864 | 3.844439 |
1458ab12-9653-45ba-87fb-64b3e0455c88 | def-au1t/AGH_2_ASD | zad/zad_13_dijkstra.cpp | //Zadanie 1+2. Dijsktra + najkrótsze ścieżki na podst. parenta
#include <iostream>
#include <climits>
using namespace std;
const int n = 9;
void print_path(int parent[], int v){
if(parent[v]==-1) {
return;
}
print_path(parent, parent[v]);
cout << v << " -> ";
}
int min_dist(int* d, int* vis... | ALGO | 0.999841 | 3.912449 |
8095dead-456b-474c-a9b0-5951589edc91 | HP3-16/When-i-used-do-cpp | c++-stl-practise/lists_.cpp | #include<iostream>
#include<vector>
#include<list>
using namespace std;
void print(list<int> &ls){
for(list<int>::iterator it = ls.begin();it!=ls.end();it++){
cout<<*it<<"\t";
}
cout<<endl;
}
int main(){
list<int> nums = {1,2,3,4,5,6};
print(nums);
//Size
list<int> nums2 = nums;
... | TOOL | 0.950224 | 3.892068 |
d59b4cd0-33bf-41ad-b94e-88ca268df682 | Shapooo/leetcode | 2558.从数量最多的堆取走礼物.cpp | #include <cmath>
#include <queue>
using namespace std;
/*
* @lc app=leetcode.cn id=2558 lang=cpp
*
* [2558] 从数量最多的堆取走礼物
*/
// @lc code=start
class Solution {
public:
long long pickGifts(vector<int>& gifts, int k)
{
priority_queue<int> pq(gifts.begin(), gifts.end());
long long total {};
... | ALGO | 0.999861 | 5.806274 |
b850218b-cb83-4bcc-bcb8-df0fe6f39beb | holim0/Algo_Study | cpp/카드 놓기(5568).cpp | #include<iostream>
#include<algorithm>
#include<string>
#include<set>
using namespace std;
int n, k;
int card[11];
set<string> s;
int main(){
cin>>n>>k;
for (int i = 0; i < n; i++)
{
cin>>card[i];
}
sort(card, card+n);
do{
string val="";
for (int i = 0; i < k; i++... | ALGO | 0.999947 | 3.938577 |
c3e27204-b40f-40d5-ac10-198febe69950 | Shivamagr1812/Semester-4-Course-Material | CS 342/Codes/Assignment 1/Question 1/base64.cpp | #include<bits/stdc++.h>
using namespace std;
static const char* B64_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
static const int B64_INDEX_TABLE[256] =
{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0... | TOOL | 0.975208 | 4.813663 |
4d327caf-d642-4f52-b7ae-127bae1f8121 | mehulsr/AudioFingerPrinting | jni/boost_1_59_0/libs/spirit/classic/phoenix/example/fundamental/sample2.cpp | #include <vector>
#include <algorithm>
#include <iostream>
#include <boost/spirit/include/phoenix1_operators.hpp>
#include <boost/spirit/include/phoenix1_primitives.hpp>
using namespace std;
using namespace phoenix;
int
main()
{
int init[] = { 2, 10, 4, 5, 1, 6, 8, 3, 9, 7 };
vector<int> c(init, init + 10);
... | ALGO | 0.990308 | 4.786512 |
2682a6ad-292a-4c82-83dc-c8cdf2c96ddd | Ashh98/LeetCode-Problems | 0518-coin-change-ii/0518-coin-change-ii.cpp | class Solution {
public:
int change(int amount, vector<int>& coins) {
vector<int> dp(amount+1, 0);
dp[0] = 1;
for (auto& coin : coins) {
for (int i = 0; i < dp.size(); i++) {
if (i - coin >= 0) dp[i] += dp[i-coin];
}
}
... | ALGO | 0.999885 | 6.22997 |
a3d19895-028a-4ec2-8637-417bc1883bda | JustinCheeramattathil/Promilo | 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.9988 | 6.76073 |
049ec935-6a34-4191-8d9e-e26c7b51eb21 | Jony1754/f_color_palette_solution_202230 | 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.998841 | 6.783336 |
f6776221-ce85-488f-925b-434b770e7449 | andyluo03/cpt | practice/random/1676G.cpp | #include <bits/stdc++.h>
#define set_io ios_base::sync_with_stdio(false); cin.tie(NULL);
#define endl "\n"
typedef long long ll;
using namespace std;
template<class T>
int amin(T a, T b){
if(a < b) return a;
return b;
}
template<class T>
int amax(T a, T b){
if(a > b) return a;
return b;
}
void solu... | ALGO | 0.999865 | 4.578227 |
c3191901-bc17-4869-b40b-a10ea67bbd10 | loaden/qtcreator | src/libs/utils/elfreader.cpp | #include "elfreader.h"
#include "qtcassert.h"
#include <QDir>
#include <QDebug>
#include <new> // std::bad_alloc
namespace Utils {
quint16 getHalfWord(const unsigned char *&s, const ElfData &context)
{
quint16 res;
if (context.endian == Elf_ELFDATA2MSB)
res = qFromBigEndian<quint16>(s);
else
... | TOOL | 0.901169 | 5.603629 |
bda7685f-153a-4208-97ad-254924d56066 | chintansuthar72/DSA | verticalOrderBinaryTree.cpp | #include<bits/stdc++.h>
using namespace std;
#define endl "\n"
unordered_map<int,vector<int>> vertical; // dist,array
void order(int i, int dist, vector<int>& tree){
if(i >= (int) tree.size()){
return;
}
vertical[dist].push_back(tree[i]);
order(2*i + 1, dist-1, tree);
order(2*i + 2, dist+1, tree);
}
int main()... | ALGO | 0.999995 | 4.340354 |
2cde69bc-740f-4965-8a6d-0375f94f23ac | XDoodler/Algorithms | Negative Cycle in graph.cpp | int a[MAX][MAX];
bool negativeCycle() //Returns true if there is a negative cycle
{
vector<int> dis(n, 0);
rep(k,1,n) {
rep(i,0,n) {
rep(j,0,n) {
if(dis[i]+a[i][j]<dis[j]) {
dis[j]=dis[i]+a[i][j];
}
}
}
}
rep(i,... | ALGO | 0.999656 | 3.642125 |
4941e2b4-c838-471d-91ef-c1ece7a47a8e | Nivaskumark/packages_apps_Nfc | nci/jni/PeerToPeer.cpp | /*
* Communicate with a peer using NFC-DEP, LLCP, SNEP.
*/
#include "PeerToPeer.h"
#include <android-base/stringprintf.h>
#include <base/logging.h>
#include <nativehelper/ScopedLocalRef.h>
#include "JavaClassConstants.h"
#include "NfcJniUtil.h"
#include "llcp_defs.h"
#include "nfc_config.h"
using android::base::S... | TOOL | 0.865653 | 3.856238 |
7c22aa2f-9071-4e1b-9c82-3029695b9d02 | hacch141/Coding-Practice | LeetCode/0035.Search-Insert-Position.cpp | // 35. Search Insert Position
class Solution {
public:
int bfs(int start, int end, vector<int>& nums, int target) {
if(start > end) return start;
int mid = (start+end)/2;
if(nums[mid]==target) return mid;
else if(target<nums[mid]) {
return bfs(start,mid-1,nums,target);... | ALGO | 0.999995 | 6.288268 |
5ec6b6de-62b3-4950-b830-dea42bd8e706 | aadarshahebsingh/Leetcode-DSA- | 3754-maximum-manhattan-distance-after-k-changes/3754-maximum-manhattan-distance-after-k-changes.cpp |
class Solution {
public:
int maxDistance(string s, int k) {
int ans=0,north=0,south=0,east=0,west=0;
for(int i=0;i<s.length();i++){
char c=s[i];
if(c=='N')north++;
else if(c=='S')south++;
else if(c=='W')west++;
else east++;
i... | ALGO | 0.99999 | 5.417742 |
03e633c9-0dc6-412e-a4c0-1c31fe9dd6b8 | kishanrajput23/Hacktoberfest_2021 | C++/pascals_triangle.cpp | #include <iostream>
using namespace std;
int main()
{
int rows, coef = 1;
cout << "Enter number of rows: ";
cin >> rows;
for(int i = 0; i < rows; i++)
{
for(int space = 1; space <= rows-i; space++)
cout <<" ";
for(int j = 0; j <= i; j++)
{
if (j =... | ALGO | 0.999655 | 3.879338 |
d3aa36f6-f44c-4a89-8e02-2f8f8df9e7dd | uthantvicentin/Competitive-Programming | URIOJ/C++/1514.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int n,m;
while(cin >> n >> m and n){
int cont = 4;
int mat[n][m];
bool feztodas = false;
bool nenhuma = false;
for(int i = 0 ; i < n ; ++i){
int fez = 0;
for(int j = 0 ; j < m ; ++j){
cin >> mat[i][j];
if(mat[i][j] == 1)
fez++;
... | ALGO | 0.999904 | 3.620126 |
02d22402-2181-440f-928a-f2a2ca75cc69 | xinchengxx/algorithm_contest | codeforces/Codeforces Global Round 20/C.cpp | #include <bits/stdc++.h>
using namespace std;
void solve() {
int n;
cin >> n;
int eq = 0;
vector<int> a(n + 1);
for (int i = 1; i <= n; i++) {
cin >> a[i];
if (a[i - 1] == a[i]) eq++;
}
if (eq == 0 || eq == 1) {
cout << 0 << endl;
return;
}
int l = 1;
// 找到第一段连续的;
while (a[l] != a[l + 1]) l++;
... | ALGO | 0.999857 | 4.502206 |
3f00b1e4-2e43-48bf-a725-0ff99b12666b | NafiHasan/HabiJabi | C++/CSEDU/CSEDU 2022/Assignment/Lab 3/f.cpp | #include <stdio.h>
int main()
{
bool prime[100010];
for (int i=0; i<100010; i++)prime[i]=true;
prime[1]=false;
for (int i=2; i*i<=100010; i++){
if (prime[i]){
for (int j=i+i; j<100010; j+=i){
prime[j]=false;
}
}
}
long long int sum[100010];... | ALGO | 0.999897 | 3.917747 |
80509298-7af7-4244-93b8-494368185bb0 | juhyeonkwon/algorithm | 문자열/1032.cpp | #include <iostream>
using namespace std;
#define MAX 51
char text[MAX][MAX];
int main() {
int N;
cin >> N;
for (int i = 0; i < N; i++) {
scanf("%s", text[i]);
}
char* result = text[0];
if (N == 1) {
cout << result;
}
else {
for (int i = 1; i < N; i++) {
for (int k = 0; k < MAX; k++) {
if(res... | ALGO | 0.999787 | 3.435945 |
a9f6dcca-48b7-4fc0-9e7a-d38f6914f5f7 | manikanta2901/ubuntu | .history/codingChallenges/cpp/Codechef/longChallenges/August/ChefAndWeddingArrange_20200809202756.cpp | #include<bits/stdc++.h>
#include<vector>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<iterator>
#include<string>
#include<map>
#define vv vector
#define F first
#define S second
#define MP make_pair
#define EXECUTE_FASTER ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define printM... | ALGO | 0.999861 | 3.390229 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.