uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
73f222a6-7d51-4f19-bbc1-e9361d48ac4f | raincross7/code-similarity | codes/train_code/problem112/problem112_243.cpp | #include <string>
#include <sstream>
#include <iostream>
#define all(c) (c).begin(), (c).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second
using namespace std;
typedef pair<int ,int > P;
struct Node {
int value;
Node *... | ALGO | 0.999744 | 4.427932 |
90bbe520-df0f-4c0d-884e-dd06e75faec9 | abroadchen/test | src/main/c/sort/HZOJ-256.cpp | #include <algorithm>
#include <iostream>
using namespace std;
#define MAX_N 1000
int a[MAX_N + 5], b[MAX_N + 5], ind[MAX_N + 5];
int main (int argc, char *argv[]) {
int n;
cin >> n;
for (int i = 0; i <= n; i++) {
cin >> a[i] >> b[i];
ind[i] = i;
}
sort(ind + 1, ind + n + 1, [&](int... | ALGO | 0.999901 | 4.031941 |
394344f8-a6e8-4f5a-bb4e-dcfac12cb966 | IOSD/Algo | Insertion_sorting.cpp | //Sachin Singla
#include <iostream>
using namespace std;
int main(){
int n; //n is the number of elements entered by the user
cin >> n;
int arr[100]; //User must enter less than 100 elements
//input n elements from the user
for(int i = 0; i < n; ++i)
cin >> arr[i];
//INSERTION SORT
//sort all elements fr... | ALGO | 0.999974 | 4.341446 |
be8c5bd4-f4be-41fc-b92a-faac4b0936a5 | abrar-khan-alvi/CP | Week-09/Day-02/Coin_Piles.cpp | #include<bits/stdc++.h>
#define ll long long int
#define ld long double
#define endl '\n'
#define faster ios_base:: sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
int main()
{
faster;
ll t;
//t=1;
cin>>t;
while(t--){
ll a,b;cin>>a>>b;
if((2*a-b)%3 || (2*b-a)%3 || (2*a-b)<0 || (2*b-a)<0)
{
... | ALGO | 0.999834 | 4.384038 |
df9a587f-8441-439b-81c4-2b96895b04bc | hridoy1000/DSA_2 | all/a2/For Final/Divide _ Conquer/quick_sort.cpp | #include<bits/stdc++.h>
using namespace std;
int partitionn(int arr[],int lb,int ub)
{
int pivot = lb;
int start = lb;
int endd = ub;
while(start<endd){
while(arr[start]<=arr[pivot]){
start++;
}
while(arr[endd]>arr[pivot]){
endd--;
}
if(st... | ALGO | 0.99997 | 5.149103 |
14f5b479-3caa-4d61-a15f-b4f55e02263f | xpharry/coding-battle | leetcode/cpp/044.cpp | /**
* Code description
*
* Author: xpharry
* Date: 11/12/2018
*
* Data structure:
* Array
*
* Idea:
* - DP.
*
* Complexity:
* Time: O(?)
*
*/
class Solution {
public:
bool isMatch(string s, string p) {
int m = s.size(), n = p.size();
vector<vector<bool>> dp(m + 1, vector<bool... | ALGO | 0.999962 | 5.684878 |
b427a166-3ef1-4809-94fc-b3822303c13c | side-projects-all/works | Leetcodes/backtracking/q_51.cpp | /*
The n-queens puzzle is the problem of placing n queens on an n x n chessboard such that no two queens attack each other.
Given an integer n, return all distinct solutions to the n-queens puzzle. You may return the answer in any order.
Each solution contains a distinct board configuration of the n-queens' placement... | ALGO | 0.999897 | 6.940223 |
f5912c71-2fd9-4950-a440-b81526220cc6 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_12648_2.cpp | #include <bits/stdc++.h>
using namespace std;
const int maxn = 100000 + 10;
const int maxm = 330;
const long long oo = 1ll << 62;
int n, a[maxn], size, cnt, L[maxn], R[maxn], cntused[maxn];
long long sumused[maxn], suf[maxn], B[maxn];
bool used[maxn];
struct poi {
long long a, b;
int p;
};
vector<poi> hull[maxm];
p... | ALGO | 0.999982 | 3.589304 |
8bf6f560-b1ed-48cc-bd18-f3017021560b | mumba-org/mumba | third_party/boost/src/libs/math/example/lambert_w_diode.cpp | /*! brief Example of using Lambert W function to compute current through a diode connected transistor with preset series resistance.
\details T. C. Banwell and A. Jayakumar,
Exact analytical solution of current flow through diode with series resistance,
Electron Letters, 36(4):291-2 (2000)
DOI: doi.org/10.1049... | ALGO | 0.998505 | 6.080799 |
bc71c83f-6b3a-4da5-8ed2-c405434825f8 | Harsh1tSh/DSA-C- | Random/12.cpp | #include<iostream>
using namespace std;
int maximum_subarray_sum(int arr[], int n){
int cs = 0;
int largest = 0;
for(int i=0; i<n; i++){
cs = cs + arr[i];
if(cs<0){
cs = 0;
}
largest = max(largest,cs);
}
return largest;
}
int main(){
int arr[] = {... | ALGO | 0.999674 | 4.773098 |
e694a074-528c-4452-9af2-8985ea93b0ef | krishna-46/6thsem_Internship2023 | Python/opencv-master/modules/video/src/tracking/tracker_nano.cpp | // This file is modified from the https://github.com/HonglinChu/NanoTrack/blob/master/ncnn_macos_nanotrack/nanotrack.cpp
// Author, HongLinChu, <EMAIL>
// Adapt to OpenCV, ZihaoMu: <EMAIL>
// Link to original inference code: https://github.com/HonglinChu/NanoTrack
// Link to original training repo: https://github.com/... | ALGO | 0.988811 | 6.433546 |
453996c0-39be-43a9-8ab8-0f75a2956bd1 | MaximSlyusarenko/Discrete-math-lab | Third term/Потоки/Максимальный поток/maxflow1.cpp |
#include <iostream>
#include <cmath>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <set>
#include <utility>
#include <fstream>
#include <queue>
using namespace std;
long long n, m, a, b, c, d[1000], f[1000][1000], ans = 0, ptr[1000];
vector <int> g[1000], cap[1000];
bool bfs()
{
queue <lo... | ALGO | 0.999951 | 4.383286 |
e2796e40-2c95-4f12-b3b1-5ba22cf36afa | S-SHIBATA-PGM/comp-prog | pgm/ABC_Cpp/ABC_137_B.cpp | #include <bits/stdc++.h>
#define __STDC_FORMAT_MACROS
#define p64 PRId64
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR (i, 0, n)
#define ALL(f, x, ...) \
([&] (decltype ((x)) ALL) { ... | ALGO | 0.999293 | 3.691053 |
233c8432-0d91-4372-b8bf-ffc473076398 | proteus-core/libra | libra-llvm/libcxx/test/std/algorithms/alg.sorting/alg.min.max/ranges.min_element.pass.cpp | // <algorithm>
// UNSUPPORTED: c++03, c++11, c++14, c++17
// template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
// indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
// constexpr I ranges::min_element(I first, S last, Comp comp = {}, Proj proj = {});
//
// template<forward_r... | TEST | 0.990404 | 7.013471 |
e6553b03-fca9-45c9-8da0-ce261dabd8b6 | aryankashyap7/Codeforces-Conqueror | 230A-Dragons.cpp | // A. Dragons
// https://codeforces.com/problemset/problem/230/A
// Time 30 ms
// Memory 0 KB
// Rating 1000
#include <bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
// int str, n;
// int dragon[n], bonus[n];
// cin>>str>>n;
// for(int i=0;i<... | ALGO | 0.999935 | 3.763044 |
26f5b364-d947-4636-94ec-f8ead8a268e1 | hasiek/III-sem | Krypto/vigenere.cpp | // Vigenere's cypher for English texts, with the key repetition despite of EOF
// Katarzyna Huszcza, 20.11.2012
#include <stdio.h>
#include <iostream>
#include <string>
#include <cstdlib>
#include <fstream>
using namespace std;
char cyphering (char letter, int base, int n, string key, int modulo);
int main() {
... | ALGO | 0.999675 | 3.630398 |
c96d8e35-8a27-4be8-b548-2cf5beb479e4 | Gan-Tu/Cloth-Simulator | CGL/src/matrix3x3.cpp | #include "matrix3x3.h"
#include <iostream>
#include <cmath>
using namespace std;
namespace CGL {
double& Matrix3x3::operator()( int i, int j ) {
return entries[j][i];
}
const double& Matrix3x3::operator()( int i, int j ) const {
return entries[j][i];
}
Vector3D& Matrix3x3::operator[]( int j ) {
... | TOOL | 0.921097 | 6.917807 |
e8835906-5927-4e79-85af-71f897a5c4ae | habibur5/Competitive-Programming | sorting/merg.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int a[N];
void merge(int l, int r, int mid)
{
int l_size = mid - l + 1;
int L[l_size + 1];
int r_size = r - mid;
int R[r_size + 1];
for (int i = 0; i < l_size; i++)
L[i] = a[i + l];
for (int i = 0; i < r_size; i++)
... | ALGO | 0.999946 | 3.833767 |
0c1e2826-c347-40a6-9c20-6dd3c850d288 | CaptainCoder2024/solution02 | bitmask/h.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define task "h"
#define maxn 11
#define reset(arr) memset(arr, 0, sizeof(arr))
#define bit(x, i) ((x >> i) & 1)
#define inf 1000000007
int n, m;
int cnt = 0;
int f[100][9000]; // 3 ** 10
/*
1: /
2: \
*/
vector<int> tp[9000];
vector<int> k... | ALGO | 0.99997 | 3.815929 |
fa1c9a94-a02b-4d83-bdc8-e08da7dce1d4 | shivanshugarg12800/FAANGList-2.0 | ArrayString/10_productOfArrayExceptSelf.cpp | #include <bits/stdc++.h>
using namespace std;
vector<int> productExceptSelf(vector<int> &nums)
{
int temp = 1;
bool zero = false;
int zeroCount = 0;
for (auto itr : nums)
{
if (itr != 0)
{
temp *= itr;
}
else
{
zero = true;
... | ALGO | 0.99997 | 5.063281 |
32f7f74c-1f5b-46fe-9b8e-1f04ee3d9aed | fithisux/FSL | extras/include/boost/libs/graph/example/cycle-file-dep2.cpp | // can't do using namespace boost because then
// we get conflict with boost::default_dfs_visitor.
using namespace boost;
namespace std {
template <typename T >
std::istream& operator >> (std::istream & in, std::pair < T, T > &p)
{
in >> p.first >> p.second;
return
in;
}
}
typedef adjacency_list... | ALGO | 0.99834 | 5.398127 |
a15e6292-a8f8-4d14-9e47-04d5e99a7749 | stellaraccident/iree-forge | trees/llvm-project/clang-tools-extra/clang-tidy/ClangTidyOptions.cpp | #include "ClangTidyOptions.h"
#include "ClangTidyModuleRegistry.h"
#include "clang/Basic/LLVM.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/Errc.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/MemoryBufferRef.h"
#include "llvm/Support/Path.h"
#include "llvm/S... | TOOL | 0.966553 | 7.372462 |
f257927d-498e-4bf8-90e8-93367cf30ea4 | DOWN-ut/Planet_Of_Points | POP/cell.cpp | #include "cell.h"
#include "points.h"
#include "grid.h"
#include "math.h"
#include <iostream>
Cell::Cell(int x, int y, int z, float rcenter): nbPoints(0)
{
this->x = x;
this->y = y;
this->z = z;
//courbe en S
this->centerDistanceRatio = rcenter;
float d = (MAXNBPOINTS-MINNBPOINTS) ;
float... | ALGO | 0.9182 | 3.544009 |
b67b8b35-c897-418f-808a-89d40e266a55 | anud18/ds | hw3/btree.cpp | #include<bits/stdc++.h>
#include"BTREE.h"
using namespace std;
const int minValue = 1;
const int maxValue = 1 << 30;
const int SearchSize = 100000;
void runKsize(int k){
unsigned int seed = 1 + 100*1;
mt19937 gen(seed);
uniform_int_distribution<> r_val(minValue,maxValue);
int n = 1 << k;
vector<int>... | ALGO | 0.986204 | 3.478564 |
f33fe9d2-2121-46f4-88a7-fbed1b4169db | mvancompernolle/ai_project | data/FuzzyOperator.cpp | #include "FuzzyOperator.h"
#include "FuzzyElement.h"
#include "FuzzyMembershipFunction.h"
#include <LIMITS.H>
#include <cassert>
#include <cmath>
#define LEASTVALUE LONG_MIN
bool F_INTERSECTION_(const CFuzzyElement& Fv1, const CFuzzyElement& Fv2, const CFuzzyElement& Fv3, const CFuzzyElement& Fv4, CFuzzyElement* pFv... | ALGO | 0.999755 | 6.04075 |
ecac928b-9e0e-46aa-b714-a5c60dd8fd6d | vryy/kratos_bcn3 | applications/SwimmingDEMApplication/custom_strategies/schemes/terminal_velocity_scheme.cpp | //
// Author: Guillermo Casas <EMAIL>
//
// Project includes
#include "terminal_velocity_scheme.h"
namespace Kratos {
void TerminalVelocityScheme::UpdateTranslationalVariables(
int StepFlag,
Node& i,
array_1d<double, 3 >& coor,
array_1d<double, 3 >& displ,
... | ALGO | 0.999751 | 5.301763 |
61ba87ec-091d-40ac-88ca-c6a3ff63c05b | harshil6-lab/CPP | 4.2.cpp | // 4.2 Topic : Inheritance
#include <iostream>
using namespace std;
// Base class: Person
class Person {
protected:
string name;
int age;
public:
Person(string n, int a) {
name = n;
age = a;
}
void displayPerson() {
cout << "Name: " << name << ", Age: " << age << endl;
... | TOOL | 0.975932 | 6.638505 |
06457a24-8856-4666-a7d4-620f5e15168f | Ashik763/playing-at-codeforces | 1567A Domino Disaster.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int t,i,n,j;
string s;
cin >> t;
while(t--){
cin >> n;
cin >> s;
for(i=0;i<n;i++){
if(s[i] == 'U'){
s[i]='D';
}
else if(s[i] == 'D'){
s[i]='U';
... | ALGO | 0.99989 | 4.587247 |
8385ad09-d9db-4e5d-ab5f-72b08b3f342a | raincross7/code-similarity | codes/train_code/problem413/problem413_172.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(obj) (obj).begin(),(obj).end()
const int mod=1e9+7;
typedef pair<int,int> P;
typedef tuple<int,int,int> TP;
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
vector<int> a={1, 1, 1... | ALGO | 0.999973 | 3.524056 |
f97afdef-c1b6-42ad-9d8a-d0475e31d05d | tuqa99/Dorry-app | 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 |
f287a40f-bc7a-499d-a237-8be74a4e847f | akdemironur/adventofcode2024 | src/day03.cpp | #include <algorithm>
#include <fstream>
#include <iostream>
#include <regex>
#include <string>
struct Instruction {
size_t position;
std::string type;
int num1;
int num2;
};
struct Pattern {
std::regex regex;
std::string type;
};
std::array<Pattern, 3> patterns = {
{{std::regex("mul\\((\\d+),(\\d+)\\)... | ALGO | 0.998408 | 6.053938 |
48809adc-2f3b-46f9-b895-e47eb847e936 | csforallofficial/Leetcode-Solutions | 1578-minimum-time-to-make-rope-colorful/1578-minimum-time-to-make-rope-colorful.cpp | class Solution {
public:
int minCost(string colors, vector<int>& need) {
int n = colors.length();
int total_time=0;
for(int i=0; i<n-1; i++){
if(colors[i]==colors[i+1]){
total_time += min(need[i], need[i+1]);
need[i+1] = max(need[i], need[i+1]);
... | ALGO | 0.999858 | 6.209964 |
82019bf7-6ba5-4fed-a8fb-7fb5a653180e | oCreaCo/LOCATOR | PostgreSQL/llvm-project/llvm/tools/llvm-mca/CodeRegionGenerator.cpp | #include "CodeRegionGenerator.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/MC/MCParser/MCAsmLexer.h"
#include "llvm/MC/MCParser/MCTargetAsmParser.h"
#include "llvm/MC/MCStreamer.h"
#include "llvm/MC/MCTargetOptions.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/SMLoc.h"
#i... | TOOL | 0.939221 | 7.933828 |
0b803605-2ee0-4ce6-ba3d-76e0a2330f6f | zeropool/Vigoth | C#/Research/QuantLib-1.8/ql/math/copulas/plackettcopula.cpp | /* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
#include <ql/math/copulas/plackettcopula.hpp>
#include <ql/errors.hpp>
namespace QuantLib {
PlackettCopula::PlackettCopula(Real theta) : theta_(theta)
{
QL_REQUIRE(theta >= 0.0,
"theta (" << theta << ")... | ALGO | 0.8744 | 5.455579 |
4cdc9ab6-ffe8-40f1-be38-8a10ae05733d | ElleriumProject/Elleriumv2 | src/qt/rpcconsole.cpp | #include "rpcconsole.h"
#include "ui_rpcconsole.h"
#include "clientmodel.h"
#include "guiutil.h"
#include "peertablemodel.h"
#include "chainparams.h"
#include "main.h"
#include "rpcclient.h"
#include "rpcserver.h"
#include "util.h"
#include "json/json_spirit_value.h"
#include <openssl/crypto.h>
#ifdef ENABLE_WALLE... | TOOL | 0.863087 | 6.570991 |
058bbc10-e48e-4bea-9cb3-ecefa19ff2da | hjiang13/LLMs-in-IR | processed_data/DecompiledResuts_Human_x_164_O1/GPT35_Human_x_164_O1_decompiled/test/CPP_163.cpp | ```cpp
#include <vector>
void generate_integers(std::vector<int>& vec, int start, int end) {
if (end < start) {
int temp = start;
start = end;
end = temp;
}
std::memset(reinterpret_cast<void*>(&vec), 0, sizeof(vec));
int* start_ptr = &vec[0];
int* end_ptr = &vec[0] + 1;
... | TEST | 0.966419 | 6.227504 |
01c1fbd0-d71c-49cb-bfea-121e41f37883 | DikshantBadawadagi/DSA | chess.cpp | #include<iostream>
#include<bits/stdc++.h>
using namespace std;
void dfs(int row,int col,vector<string>&a,vector<vector<int>>&vis,bool flag){
int n=a.size();
int m=a[0].size();
vector<int>drow = {-1,0,1,0};
vector<int>dcol = {0,1,0,-1};
vis[row][col] = 1;
if(flag == true){
a[row][col]... | ALGO | 0.999969 | 3.852261 |
92dd87f2-2b5c-41bc-8f6d-ab7b6e043bbd | AnkitVarshney01/My-Coding-Playground | Codeforces/G_1_Teleporters_Easy_Version.cpp | #include <iostream>
#include <string>
#include <algorithm>
#include <climits>
#include <vector>
#include <stdlib.h>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <functional>
#include <random>
#include <numeric>
#include <iomanip>
#include <chrono>
#include <cmath>
#include <cassert>
#include... | ALGO | 0.999945 | 4.143771 |
c205fd57-506f-46ca-9be0-33c3a20beb20 | Hit301/Satellite | Dyn/deps/eigen-3.3.8/unsupported/test/polynomialsolver.cpp | #include "main.h"
#include <unsupported/Eigen/Polynomials>
#include <iostream>
#include <algorithm>
using namespace std;
namespace Eigen {
namespace internal {
template<int Size>
struct increment_if_fixed_size
{
enum {
ret = (Size == Dynamic) ? Dynamic : Size+1
};
};
}
}
template<typename PolynomialType>
Pol... | TEST | 0.944019 | 6.547149 |
20060959-3975-414e-ac77-9bfe0642432a | cyber-hoax/LeetCodeQues | 1325-delete-leaves-with-a-given-value/1325-delete-leaves-with-a-given-value.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.999871 | 6.266757 |
27319a4a-174f-4038-aba5-9677d1544691 | teseoch/CG-Spring-2023 | ext/eigen/doc/examples/Tutorial_ArrayClass_cwise_other.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace Eigen;
using namespace std;
int main()
{
ArrayXf a = ArrayXf::Random(5);
a *= 2;
cout << "a =" << endl
<< a << endl;
cout << "a.abs() =" << endl
<< a.abs() << endl;
cout << "a.abs().sqrt() =" << endl
<< a.abs().sqrt() << endl... | ALGO | 0.977961 | 3.146753 |
0880a8dd-1839-4f4b-a155-8b58058961fb | kademy-software/bai_tap_hsg_buoi2 | bai21.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
ll a,b; cin>>a>>b;
string s= to_string(a);
string s1= to_string(b);
if(a>b) cout<<s+s1; else cout<<s1+s;
}
| ALGO | 0.99958 | 4.546819 |
ca908d55-c160-4cac-a40e-40b1e2225571 | efeslab/nvm-file-indexing | api/p-hot/boost_1_73_0/libs/compute/perf/perf_stl_partition.cpp | #include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>
#include "perf.hpp"
int rand_int()
{
return static_cast<int>((rand() / double(RAND_MAX)) * 25.0);
}
bool less_than_10(int value)
{
return value < 10;
}
int main(int argc, char *argv[])
{
perf_parse_args(argc, argv);
std::c... | ALGO | 0.990745 | 6.031366 |
a0231b4c-69b9-4b98-ae63-e0f18d5f34ad | cubao/headers | include/igl/planarize_quad_mesh.cpp | namespace igl
{
template <typename DerivedV, typename DerivedF>
class PlanarizerShapeUp
{
protected:
// number of faces, number of vertices
long numV, numF;
// references to the input faces and vertices
const Eigen::MatrixBase<DerivedV> &Vin;
const Eigen::MatrixBase<DerivedF> &Fin;
... | ALGO | 0.999113 | 4.605238 |
5d88db40-a8fb-4c26-99f2-ebc058ccc8ee | adechan/computer-science-school | Undergrad/First Year/Programming in C/Elementary Algorithms/digitsSumEven.cpp | // It displays the sum of even digits of a number.
#include "stdafx.h"
#include <iostream>
int digitsSumEven(int n)
{
int sum = 0, cifra = 0;
while (n != 0)
{
cifra = n % 10;
n = n / 10;
if (cifra % 2 == 0) sum = sum + cifra;
}
return sum;
}
int main()
{
int n;
std::cout << "Spune un numar: ";
std::cin... | ALGO | 0.997441 | 5.865044 |
b876ce8f-57f8-4cce-8134-c4ec3ea254d3 | nczhang88pan/KlotskiSGX | klotski/llvmProgram/lldb/source/Utility/StringList.cpp | #include "lldb/Utility/StringList.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/Stream.h" // for Stream
#include "lldb/Utility/StreamString.h"
#include "llvm/ADT/ArrayRef.h" // for ArrayRef, makeArrayRef
#include <algorithm> // for min
#include <stdint.h> // for SIZE_MAX, uint32_t
#include <string.h> // f... | TOOL | 0.889758 | 6.852179 |
14744482-be01-4e82-92bf-7b26528df15f | VanadiumV/cpdays | range queries/space_optimization.cpp |
#pragma GCC optimize("O3,unroll-loops")
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace chrono;
using namespace __gnu_pbds;
#define fastio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define MOD 100000000... | ALGO | 0.999972 | 4.368007 |
13f29328-4bd9-40ee-ac75-e487007b511d | ishandutta2007/codeforces | vladprog/normal/1438/A.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
typedef long double ld;
typedef pair<int,int> pii;
#define x first
#define y second
signed main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int t;
cin>>t;
while(t--)
{
int n;
... | ALGO | 0.999757 | 3.775513 |
dee3ee48-8677-43a1-8b9d-c7625ba19c7e | ultrablitz798/archives | C++/Practical Exams/CAPILI_PE3.cpp | // === Original program starts below this line. Written 2016-05-11 ===
#include <iostream>
using namespace std;
int main()
{
//This identifies the variables to be used in the program
double head;
//This tells the user on what the program does.
cout << "This program will classify if the water's head of a dam is ... | TOOL | 0.991711 | 4.074831 |
4428393b-3c0c-4776-a2b4-eec2962d1764 | ishandutta2007/codeforces | bolshevik/normal/1540/A.cpp | #include<cstdio>
#include<algorithm>
using namespace std;
const int o=1e5+10;
int T,n,d[o];long long ans;
int main(){
for(scanf("%d",&T);T--;printf("%lld\n",ans),ans=0){
scanf("%d",&n);
for(int i=1;i<=n;++i) scanf("%d",&d[i]);
sort(d+1,d+n+1);
for(int i=2;i<=n;++i) ans+=d[i]-d[i-1];
for(int i=1;i<=n;++i) ans... | ALGO | 0.999479 | 3.075106 |
707456e5-35f9-4247-b2b0-ca56243cfc68 | Tonix22/FreeRTOSCourse | Classwork/TaskExecercise/Hints/hello_world_main.cpp | #include <stdio.h>
#include <inttypes.h>
#include "sdkconfig.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_chip_info.h"
#include "esp_flash.h"
#include "esp_system.h"
#include <iostream>
using std::cout;
using std::endl;
using std::runtime_error;
void Task1( void * pvParameters )
{
for... | TOOL | 0.905945 | 4.454888 |
b5a187ab-4425-42f1-a960-a33592d84bc2 | guptasneha12/POTD---LeetCode | Most Profitable Path in a Tree.cpp | class Solution {
public:
int mostProfitablePath(vector<vector<int>>& edges, int bob, vector<int>& amount) {
int n = amount.size();
vector<vector<int>> graph(n);
for (auto& edge : edges) {
graph[edge[0]].push_back(edge[1]);
graph[edge[1]].push_back(edge[0]);
... | ALGO | 0.999874 | 5.866286 |
e339819e-d3aa-4981-9b79-8c5e75f4a002 | KodlabPenn/kodlab_mjbots_sdk | examples/proprio_example.cpp | /* Example script running joints to their mechanical limits before switching direction. The functions to implement are
* Update and PrepareLog. In this example we run the motor forward until its
* position error is large enough to detect a obstacle, then switching directions
*/
#include "kodlab_mjbots_sdk/mjbots_co... | TOOL | 0.984941 | 5.7637 |
64092965-1565-4850-a477-36d59b92a1ee | Ru-hulu/Exploring-in-Uneven-Terrain | hybridA/src/node2d.cpp | #include "node2d.h"
using namespace HybridAStar;
// possible directions
const int Node2D::dir = 8;
// possible movements:8个方向相对中心(0, 0)的移动
const int Node2D::dx[] = { -1, -1, 0, 1, 1, 1, 0, -1 };
const int Node2D::dy[] = { 0, 1, 1, 1, 0, -1, -1, -1 };
//判断点是否在网络内
//单位是grid
bool Node2D::isOnGrid(const int width, const... | ALGO | 0.992311 | 4.072033 |
5e51b31c-10fd-4e51-8ffb-9ed433616f01 | ltran7233/fall-2022-135-lab-02-ltran7233 | valid.cpp | /*
Author: Lina Tran
Course: CSI-135
Instructor: Professor Genady Maryash
Assignment: Lab2A
Description: This program will ask the user to input a valid integer that is only between 1 and 99. If the integer goes below or above the conditions set, the program will loop and ask for a different integer until it fits the ... | TOOL | 0.901387 | 5.527695 |
32b1a233-ce58-44c9-8b3e-56fb106884a3 | codeplaysoftware/SYCL-For-CUDA-Examples | examples/distrib_batch_gemm/distributed-batch-gemm.cpp | #include <CL/sycl.hpp>
#include <CL/sycl/backend/cuda.hpp>
#include <algorithm>
#include <mpi.h>
#include <mpi-ext.h>
#include <numeric>
#include <stdio.h>
#include <stdlib.h>
#include <sycl_blas.h>
#define PRINT_DEBUG_MODE 1
int main(int argc, char **argv) {
/* Create a SYCL queue with the default device selector ... | ALGO | 0.968028 | 5.695024 |
7778c829-bde5-48d3-b747-531dd5575343 | amitsinghbhadouriya/OOPS-Question | Question-42.cpp | #include <iostream>
using namespace std;
template <typename T>
void swapValues(T &a, T &b) {
T temp = a;
a = b;
b = temp;
}
int main() {
int x = 5, y = 10;
cout << "Before swapping(int): x = " << x << ", y = " << y << endl;
swapValues(x,y);
cout << "After swapping(int): x = " << x << ", y =... | ALGO | 0.997257 | 5.74925 |
57c32c46-ca43-44bf-9e6d-abec5cd758d7 | Madhuu-k/Leetcode-Grind | Trees/Leetcode 99 Recover Binary Search Tree.cpp | // Problem Link: https://leetcode.com/problems/recover-binary-search-tree/
// Time Complexity: o(n)
/**
* 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),... | ALGO | 0.999998 | 6.581412 |
4f6c0c54-f547-40bb-b0ef-1c5a8cd7b3b6 | rcostadresch/Algoritmos-de-Ordenacao | quick.cpp | #include <stdio.h>
#include <time.h>
#include <stdlib.h>
class Quadrado {
private:
int id;
double area, lado;
void calcularArea(){
area = lado*lado;
}
public:
Quadrado(int id_entrada, double lado_entrada){
id = id_entrada;
lado = lado_entrada;
calcularArea();
}
Quadrado(){
}
~Quadrado(){
... | ALGO | 0.998475 | 4.293673 |
f6008434-7662-41e3-b717-ddb60b933bbb | ravi29125/GeeksForGeeks | Difficulty: Easy/Make the array beautiful/make-the-array-beautiful.cpp | //{ Driver Code Starts
// Initial Template for C++
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
// User function Template for C++
class Solution {
public:
vector<int> makeBeautiful(vector<int> arr) {
stack<int> s;
for(int i:arr){
if(s.empty()){
... | ALGO | 0.99982 | 6.292181 |
4f06a516-6136-47a4-a483-f3762a105157 | fangism/llvm | lib/CodeGen/LiveIntervalAnalysis.cpp | #include "llvm/CodeGen/LiveIntervalAnalysis.h"
#include "LiveRangeCalc.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/CodeGen/LiveVariables.h"
#include "llvm/CodeGen/MachineBlockFrequencyInfo.h"
#include "llvm/CodeGen/MachineDominators.h"
#inclu... | TOOL | 0.986834 | 7.61581 |
6d67a97f-4493-4543-adc0-b77f569489f0 | Codechef-SRM-NCR-Chapter/30-DaysOfCode-March-2021 | answers/tushartangri/Day17/Question1.cpp | #include <iostream>
using namespace std;
void findquadruple(int arr[],int n,int k)
{
int i,j,m,l;
for(i=0;i<=n-3;i++)
{
for(j=i+1;j<=n-2;j++)
{
int m=k-(arr[i]+arr[j]);
int low=j+1,high=n-1;
while(low<high)
if(arr[low]+arr[high]<m)
... | ALGO | 0.999918 | 4.165361 |
c26c844c-65bc-487e-a07f-627e6e5e04e9 | sahilkedare/6Companies30days | WALMART/7_subseq.cpp | https://practice.geeksforgeeks.org/problems/sorted-subsequence-of-size-3/1/
vector<int> find3Numbers(vector<int> arr, int N) {
int mn=arr[0];
int mx=INT_MAX;
int s=arr[0];
vector<int>ans;
for(int i=1;i<N;i++){
if(arr[i]==mn) continue;
else if(arr[i... | ALGO | 0.999989 | 4.981206 |
7a16ec8f-39c5-4bb4-81e6-0d9a8a624f96 | Kiids/OJ_Practice | 平方数之和.cpp | /*
һǸ c ҪжǷ a bʹ a^2 + b^2 = c
ʾ 1
룺c = 5
true
ͣ1 * 1 + 2 * 2 = 5
ʾ 2
룺c = 3
false
ʾ
0 <= c <= 2^31 - 1
*/
class Solution {
public:
bool judgeSquareSum(int c) {
long long l = 0, r = sqrt(c);
while (l <= r)
{
if (l * l + r * r == c)
return true;
else... | ALGO | 0.999715 | 5.480559 |
6f208f41-0062-4b35-9398-e6baa7cee199 | devCharlieP/PS_Baekjoon | 2164/소스.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <queue>
#define endl '\n'
using namespace std;
int main()
{
cin.tie(NULL);
ios_base::sync_with_stdio(false);
int N;
cin >> N;
queue <int> Q;
for (int i = 1; i <= N; i++)
{
Q.push(i);
}
while (Q.size() ... | ALGO | 0.999895 | 3.678457 |
203f0112-ab2c-4c7e-a65e-29f6117114b7 | TezaLeMon/Courses_gc | 作业首行检查/7-b28.cpp | // 1752762 1 κٴ
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <string.h>
#include <sstream>
#include <fstream>
#include <iomanip>
using namespace std;
#if defined _MSC_VER
#include <io.h>
#elif defined __linux || defined __linux__
#include <sys/types.h>
#include <dirent.h>
#endif
const char *PARA[] = {... | TOOL | 0.934189 | 3.142634 |
3e420b97-bfca-4008-beb9-e23c5f4f0301 | Sagar231/cpp_prac | selection_sort.cpp | #include<iostream>
using namespace std;
int main(){
int n;
cin>>n;
int arr[n];
for(int i=0;i<n;i++){
cin>>arr[i];
}
for(int i =0;i<n-1;i++){
for(int j =i+1;j<n;j++){
if(arr[j]<arr[i]){
int temp =arr[j];
arr[j] = arr[i];
... | ALGO | 0.999964 | 4.082023 |
f87aac5d-91c4-4405-b7b1-bf976fdc21b9 | nareshaluri/SelfDrivingCarProjects | ParticleFilter-Localization/src/particle_filter.cpp | /*
* particle_filter.cpp
*
* Created on: Dec 12, 2016
* Author: Tiffany Huang
*/
#include <random>
#include <algorithm>
#include <iostream>
#include <numeric>
#include <math.h>
#include <iostream>
#include <sstream>
#include <string>
#include <iterator>
#include "particle_filter.h"
using namespace std;
... | ALGO | 0.997105 | 4.765282 |
37d244b0-6e83-451b-8c5f-567516e2cb78 | SysCall97/My-Codeforces-solutions | B. Ania and Minimizing.cpp | /***************************************************************
* Name: KAZI NUR ALAM MASHRY *
* School: MAWLANA BHASHANI SCIENCE & TECHNOLOGY UNIVERSITY *
* CSE (14TH BATCH) *
***********************************************************... | ALGO | 0.999993 | 3.47682 |
21a5c0c6-5936-46dd-946a-a056d30d9a42 | ishandutta2007/codeforces | ikatanic/normal/1060/C.cpp | #include <algorithm>
#include <cassert>
#include <cstring>
#include <iostream>
#include <vector>
using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define TRACE(x) cout << #x << " = " << x << endl
#define _ << " _ " <<
typedef long long llint;
const int MAX = 2... | ALGO | 0.999969 | 4.229916 |
98d18538-33e5-4e6f-bfa4-3cf704016761 | seunghyukcho/algorithm-problems-solved | acm-icpc/Regional/South Korea/2018/Qualification/B.cpp | #include <iostream>
using namespace std;
static int a, b, n, w;
int gcd(int a, int b) { return a == 0 ? b : gcd(b % a, a); }
int main()
{
cin >> a >> b >> n >> w;
int x, y, ans[2] = { 0, 0 };
for(x = 1, y = n - 1; x < n; x++, y--)
{
if(a * x + b * y == w)
{
if(ans[0] == ... | ALGO | 0.999907 | 4.061556 |
3d689b28-e440-4c1b-ac4b-24e50819a3cf | KDE/android-qt | src/3rdparty/clucene/src/CLucene/search/DateFilter.cpp | #include "CLucene/StdHeader.h"
#include "DateFilter.h"
CL_NS_USE(index)
CL_NS_USE(util)
CL_NS_USE(document)
CL_NS_DEF(search)
DateFilter::~DateFilter(){
_CLDECDELETE( start );
_CLDECDELETE( end );
}
DateFilter::DateFilter(const DateFilter& copy):
start( _CL_POINTER(copy.start) ),
end ( _CL_PO... | TOOL | 0.86224 | 5.933051 |
a7b3c54e-1058-4608-8f70-e73ddfcc22d6 | m-liu/RAProcessor | sw_model/procSelect.cpp | #include <iostream>
#include <unistd.h>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <string.h>
#include <stdint.h>
#include "globalTypes.h"
void doSelect (CmdEntry cmdEntry){
uint32_t rowBuff[MAX_COLS];
uint32_t rowAddrOut = 0;
for (uint32_t memrow= cm... | ALGO | 0.939977 | 3.503002 |
82a8cd8f-b593-4729-8f14-b2521e0bcf79 | AlexSlayer69/LeetCode-Solutions- | 0464-can-i-win/0464-can-i-win.cpp | class Solution {
public:
bool canIWinDFSHelper(int runningSum, int maxChoosable, int target, int currState, vector<int>& gameState) {
if(gameState[currState] != 0) return (gameState[currState] > 0);
for(int num=1; num<= maxChoosable; num++) {
int numMask = 1 << (num-1);
... | ALGO | 0.999851 | 5.759331 |
fbf846fe-64b3-47b9-953b-c1cb3bfeccfb | s22018-pj-Oliwier-Kossak/subset_sum_problem_cpp | genetic_algorithm/ga.cpp | #include <iostream>
#include <fstream>
#include <stdio.h>
#include <limits.h>
#include <vector>
#include <string>
#include <cmath>
#include <limits>
#include <chrono>
#include <numeric>
#include <functional>
#include <iomanip>
#include "subset.h"
#include "ga.h"
void ga(int iter, int method, int population_size,std::v... | ALGO | 0.999981 | 3.88143 |
f2d3621b-df04-4eae-ba1a-dec655a6f5c7 | ThanhSon84/50_bai_tap_Cpp | BT42.cpp | //BT42.cpp
#include<iostream>
#include<string>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<cctype>
#include<cmath>
using namespace std;
struct Student
{
string MS;
string Hoten;
string Lop;
string Email;
};
void nhap_Thong_tin(struct Student& sv)
{
getline(cin,sv.MS);
getline(cin,sv.Hoten)... | ALGO | 0.975369 | 4.371927 |
c2bd9363-9a0a-47d2-88bb-3790af08248f | animeshf/Competitive_Programming | Codebook/All the Code/Maths and DP/Linear Algebra/XOR Shortest Path (Animesh).cpp | Copy
// http://codeforces.com/contest/845/problem/G: Compute XOR-Shortest Walk from 1 to N.
// Author: rekt_n00b
// Solution Sketch
// Let P be any path from 1 to N.
// The optimal solution can be written as P xor (C_1, C_2, ..., C_K) where each C_i is some simple cycle
// in the graph. Since there can be exponentiall... | ALGO | 0.999967 | 4.971754 |
7bd959f1-bd61-44e8-97c0-57aed6b4ac20 | yudility/codetree-TILs | 240903/3개의 선 2/three-lines-2.cpp | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
int n, x[20], y[20], ret;
int main() {
cin >> n;
for(int i=0; i<n; i++){
cin >> x[i] >> y[i];
}
for(int i=0; i<=10; i++){ // 선 하나 좌표 고르고
for(int j=0; j<=10; j++){ // 두번째 선 좌표 고르고
for(int k=0; k<=20; k++){ /... | ALGO | 0.99981 | 3.918898 |
5d42cfcc-2858-400d-a3fe-8048b3ccd4c3 | Aty-0/S2DE | Libs/boost_1_76_0/libs/phoenix/example/function.cpp | #include <vector>
#include <algorithm>
#include <iostream>
#include <boost/phoenix/core.hpp>
#include <boost/phoenix/function.hpp>
using boost::phoenix::function;
struct is_odd_
{
typedef bool result_type;
template <typename Arg>
bool operator()(Arg arg1) const
{
return arg1 % 2 == 1;
... | ALGO | 0.983678 | 5.852455 |
9cdf2167-c29c-4b4c-b0c7-9aecd932d3d3 | archanashinde87/ArrayDataStructureProblems | RearrangeArrayMaximumMinimumForm.cpp | // RearrangeArrayMaximumMinimumForm.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
/*
Input: arr[] = {1, 2, 3, 4, 5, 6, 7}
Output: arr[] = {7, 1, 6, 2, 5, 3, 4}
Input: arr[] = {1, 2, 3, 4, 5, 6}
Output: arr[] = {6, 1, 5, 2, 4, 3}
*/
#include <iostream>
void rearrange(int ar... | ALGO | 0.999841 | 5.204022 |
705ea62f-2792-4d3e-8d23-af69cf1c2b42 | GolamRabbani20/CPP | PROBLEM_SOLVING/CODE_FORCES/CF_58A (2).cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
string str; cin>>str;
cout<<(regex_match(str, regex(".*r.*a.*b.*b.*a.*n.*i.*")) ? "YES" : "NO");
}
| ALGO | 0.999103 | 3.411413 |
3a2348b5-cf14-4c33-82b5-b2a12a6cb540 | RealChaser/Cpp_Lecture | C++14_2/4_인라인함수1.cpp | #include <iostream>
using namespace std;
int Add1(int a, int b) { return a + b; }
inline int Add2(int a, int b) { return a + b; }
// ζ Լ Լ Ϳ ġȯɼ .
int main()
{
Add1(1, 2); // ȣ
Add2(1, 2); // ġȯ
int(*f )(int, int) = &Add2;
//------------------------------
int n;
cin >> n;
if (n == 0) f = &Add1;
//--... | ALGO | 0.970752 | 4.698055 |
3a793160-1fd0-4cf7-958c-5101122d9aeb | YashSharma/C-files | C++/Spoj/gopu.cpp | #include<iostream>
int main()
{ unsigned long long t,n,x,div;
scanf("%llu",&t);
while(t--)
{ scanf("%llu",&n);
do{
x=n; div=0;
while(x)
{ div+=(x%10);
x/=10;
}
}while(n++%div);
printf("%llu\n",n-1);
}
return 0;
} | ALGO | 0.999695 | 3.77914 |
998c6a46-4fb8-4599-991f-5e3d27baa46f | ThiagoFBastos/programacao-competitiva | codechef/Yet Another Tree Problem.cpp | #include "bits/stdc++.h"
using namespace std;
using i64 = long long;
using u64 = unsigned long long;
using i32 = int;
using u32 = unsigned;
using i16 = short;
using u16 = unsigned short;
using ld = long double;
using ii = pair<int, int>;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
struct DS... | ALGO | 0.999932 | 4.061838 |
0bd8f3d8-0982-480f-999b-e379c46f47c3 | aman3107/Revision_DSA_CPP | Basics_CPP/Arrays/reverse_array.cpp | #include <iostream>
using namespace std;
void print_array(int arr[], int n){
for(int i = 0; i < n; i++){
cout << arr[i] << " ";
}
}
void reverse(int arr[], int n){
int i = 0;
int j = n-1;
while(i < j){
int temp = arr[i];
arr[i] = arr[j];
arr[j] = temp;
i++;
... | ALGO | 0.998809 | 4.944517 |
a04fa3da-79df-4478-9d7a-0b8e40a9bd06 | braveheart12/Birake | src/crypto/hmac_sha256.cpp | #include "crypto/hmac_sha256.h"
#include <string.h>
CHMAC_SHA256::CHMAC_SHA256(const unsigned char* key, size_t keylen)
{
unsigned char rkey[64];
if (keylen <= 64) {
memcpy(rkey, key, keylen);
memset(rkey + keylen, 0, 64 - keylen);
} else {
CSHA256().Write(key, keylen).Finalize(rke... | ALGO | 0.985362 | 5.856034 |
05e03d0a-a4c8-4848-b1ed-827b5f6c7e1c | tommy16102/2022-algorithm-study | 2021/1주차/정환훈/완주하지 못한 선수.cpp | #include <string>
#include <vector>
#include <map>
using namespace std;
/*
푼 사람 : 정환훈 푼 날짜 : 2021/07
기본 아이디어 : map을 통해 참가자->참가자 수가 매칭되도록 만들고
거기서 map[완주자 이름]--을 해준다.
이제 map 값이 0보다 큰 선수가 완주하지 못한 선수다.
*/
string solution(vector<string> participant, vector<string> completion) {
string answer ... | ALGO | 0.999829 | 5.574128 |
59162b9b-0373-4d2b-a76e-614e3277cf09 | ishandutta2007/codeforces | natsugiri/normal/1338/D.cpp | #pragma GCC optimize ("O3")
// #pragma GCC target ("avx")
#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>
#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define NDEBUG
#define eprintf(...) do {} while (0)
#endif
#include<cassert>
usin... | ALGO | 0.99987 | 4.236089 |
71385e35-c5c0-4e67-bcaa-2218af6b1b0f | yuchuangu85/AOSP_Frameworks | base/tools/aapt2/filter/ConfigFilter.cpp | #include "filter/ConfigFilter.h"
#include "androidfw/ConfigDescription.h"
#include "androidfw/ResourceTypes.h"
using ::android::ConfigDescription;
namespace aapt {
void AxisConfigFilter::AddConfig(ConfigDescription config) {
uint32_t diff_mask = ConfigDescription::DefaultConfig().diff(config);
// Ignore the ve... | TOOL | 0.950521 | 6.681667 |
5e1d82d5-8b44-48da-aac7-72bbe39ad19e | sarvex/leetcode-assembly | solution/1200-1299/1239.Maximum Length of a Concatenated String with Unique Characters/Solution.cpp | class Solution {
public:
int maxLength(vector<string>& arr) {
int ans = 0;
vector<int> masks = {0};
for (auto& s : arr) {
int mask = 0;
for (auto& c : s) {
int i = c - 'a';
if (mask >> i & 1) {
mask = 0;
... | ALGO | 0.999944 | 5.627943 |
857f8b49-50bd-4c26-a698-dd41885d8c13 | osu-crypto/MiniPSI | libPSI/PRTY/PrtySender.cpp | #include "PrtySender.h"
#include <cryptoTools/Crypto/Commit.h>
#include <cryptoTools/Network/Channel.h>
#include <cryptoTools/Common/Timer.h>
#include "libOTe/Base/naor-pinkas.h"
#include <unordered_map>
namespace osuCrypto
{
using namespace std;
using namespace NTL;
void PrtySender::init(u64 myInputSize, u64 ... | ALGO | 0.945625 | 4.736858 |
04d0bdb8-bda6-4500-bc01-4dd394108988 | Alaxe/noi2-ranking | 2017/solutions/B/GCS-Varna/paint.cpp | #include <iostream>
#define MAXN 11002
using namespace std;
struct point{
int x, y;
};
struct rectangle{
point A, B, C, D;
int parent;
};
int w, h, n, tmpw, tmph, i, j, t, inside, par, area, tmpa;
rectangle r[MAXN];
point click, A1, B1, C1, D1, A2, B2, C2, D2;
bool isinside(rectangle r, point cl)
{
... | ALGO | 0.999723 | 3.599842 |
321a55bc-34a3-4252-869f-20e0d664dd3e | paulrahul/algo | practice/cpp/max_prod.cpp | // Given a rod of length N, find the maximum product
// of sub-lengths it can be broken down to.
//
// E.g. 5 can be broken down to 2,2,1 or 3,2 but the second
// division has a higher product (3 * 2). Similarly, for N = 10,
// the max product is 36 (2 * 2 * 3 * 3)
//
// Input format: N in each line.
// Output format: ... | ALGO | 0.999884 | 5.356833 |
da9113cb-f7c2-4b15-bc88-51ee3d50c239 | raincross7/code-similarity | codes/train_code/problem186/problem186_287.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, k;
scanf("%d%d", &n, &k);
// 1からはじまる配列なので、全部1にする
// 1要素かぶらせる形でk個分の区間でnを埋めてく
// 配列aに関係なく、kの区間の数が答え
// a / b の切り上げは、(a + (b - 1)) / b
// 既に1が一個あるのでa = n - 1。重ねる分b = k - 1。
int ans = (n - 1 + k - 2) / (k - 1);
printf("%d... | ALGO | 0.999311 | 3.484959 |
85798818-54d5-47db-934a-ac84ab7dbba5 | hmsirajul/mix.solve | STL/Find Max element.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
vector<int> v = {2,3,5,4,6,2,1,1,2,2,2} ;
//vector<int> :: iterator it = max_element(v.begin(),v.end());
//vector<int> :: iterator it = max_element(v.begin()+1,v.begin()+5); // index 1 to index 4 max value
int n = min_element(v.begin(),v.end())... | ALGO | 0.999327 | 4.162631 |
e59efa6f-07a5-4bd0-bbb6-dca6ba4b9e0a | mohsinenur/URIOnlineJudge | Preface.cpp | #include<iostream>
using namespace std;
main()
{
int a, b, quotient, reminder;
cin >> a;
cin >> b;
if (a>0 && b>0)
{
quotient = a / b;
reminder = (quotient - (a % b));
}else if (a>0 && b<0)
{
quotient = a / b;
reminder = (a - (quotient * b));
}else if... | ALGO | 0.99991 | 4.410095 |
dc68dad4-5706-416e-9163-f37ea44eea10 | TejasAdhikari/2-Data-Structures | Lec 11 - Introduction to BST/5_If_array_is_preorder.cpp | /* Given an array of numbers, return true if given array can
represent preorder traversal of a BST, else return false.
SOLUTION:
Simple Solution:
Do following for every node pre[i] starting from first one:
Find the first greater value on right side of current node.
Let the index of this n... | ALGO | 0.999987 | 6.058257 |
09fbb6c7-8708-41d3-a3f5-8aa419841272 | JacquesGomes/CompetitiveProgramming | Vector/Vector_2.cpp | #include <bits/stdc++.h>
using namespace std;
int main (){
int an, bn;
cin >> an;
vector<int> arrA;
for(int i=0; i<an; i++){
int x;
cin >> x;
arrA.push_back(x);
}
cin >> bn;
vector<int> arrB;
for(int i=0; i<bn; i++){
int x;
cin >> x;
arrB.push_back(x);
}
sort(arrA.begin(), arrA.end());... | ALGO | 0.999958 | 3.300149 |
4f120915-0ce4-44d1-95d8-cfe1a3e27f78 | dhruves1931/30daysofFlutter | 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.99887 | 6.783439 |
39f2d8c8-ae28-4457-8460-4f4fe7849067 | davidzwei/GPE | 11067-Cola.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int num;
while(cin >> num){
int res = num;
while(num >= 3){
res += num/3;
num = num/3 + num%3;
}
if(num == 2)
res++;
cout << res << endl;
}
}
// 8
// 8
// 2... | ALGO | 0.999944 | 3.744867 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.