uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
addad585-ae2c-4b07-943f-1451a42184eb | bironu/SDL2_Lua_OpenGL | src/task/Interpolator.cpp | #include "task/Interpolator.h"
#define _USE_MATH_DEFINES
#include <cmath>
std::function<double(double)> InterpolatorFactory::create(InterpolatorType type)
{
switch(type) {
case InterpolatorType::AccelerateDecelerate:{
return [](double input)->double{
return (float)(std::cos((input + 1.0) * M_PI) / 2.0) + 0.5;
... | ALGO | 0.904985 | 6.090068 |
434c5d58-615e-435f-b229-b430fd44c0d6 | CEllis18/ECS122B-Program2 | ntuple.cpp | #include <iostream> //for I/O purposes, and debugging
#include <fstream> //for reading files
#include <vector> //vector is useful and easy to manage
#include <cmath> //for pow() function
#include <fstream> //for file I/O
#include <string> //for string
#include <cstring> //for strlen
using namespace std;
bool DEBUG_... | ALGO | 0.99965 | 4.199255 |
12c03f4c-41f5-414a-9aa5-5367b1c3667f | nicriz/dose-model-root | MonteCarlo/AA10 LP-102 PIE1/source/Source.cpp | #include "../headers/Source.h"
#include "TMath.h"
#include <iostream>
/* LIST OF REFERENCES
[1] AA10 - Accident Analysis Report - Public: Water leakage in Monolith Vessel, ESS-0052199
[2] ESS - Activity transport and dose calculation models and tools used in safety analyses at ESS, ESS-0092033
*/
double instant_relea... | TOOL | 0.969996 | 5.316727 |
ad9908af-3858-4401-bffb-d90bf6d7ffa5 | vanci/SAD | SAD_v3.1/SAD.cpp | #include <cstdio>
#include <memory>
#include <cassert>
#include "SAD.h"
int ADS::nvar = 0;
int ADS::nnz_pd = 0;
int ADS::maxNNZ_pd = 0;
int* ADS::cooRow = 0;
int* ADS::cooCol = 0;
float* ADS::pd = 0;
void ADS::Initialize()
{
Clear();
nvar = 0;
nnz_pd = 0;
maxNNZ_pd = (1<<28);
cooRow = new int[maxNNZ_pd];
cooCo... | ALGO | 0.99966 | 4.256534 |
77c0305b-2bb8-4a59-878e-4537013cface | ASK1995/Leetcode | 2413.cpp | class Solution {
public:
int smallestEvenMultiple(int n) {
if(n % 2 == 0) {
return n;
}
return n*2;
}
}; | ALGO | 0.999458 | 6.15305 |
7f49ca2c-a35d-49d9-8164-168accf8f800 | maverickreal/leetcode-solutions | 2262-total-appeal-of-a-string/2262-total-appeal-of-a-string.cpp | typedef long long ll;
#define endl '\n'
const ll mod = 1e9 + 7;
class Solution {
public:
long long appealSum(const string& s) {
ll sz = s.length();
vector<ll>dp(sz), lasPos(26);
lasPos[s.front()-'a']++;
++dp.front();
for (ll i = 1;i < sz;++i) {
dp[i] = dp[i - 1] ... | ALGO | 0.999961 | 5.233813 |
36554cf2-630d-4737-b997-81d7b9766608 | kscott27/AlgoExpert | BoggleBoard/BoggleBoard.cpp | #include <vector>
using namespace std;
namespace helpers {
struct TrieNode {
unordered_map<char, TrieNode*> childNodes;
TrieNode* prevNode;
};
struct Trie {
Trie();
void addWord(string word);
TrieNode* root;
TrieNode* currentNode;
char endSymbol;
};
void travers... | ALGO | 0.999931 | 6.605269 |
180308f1-cd20-4f0d-9381-1542953bac36 | danielhirt/flutter-win-password-generator | 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.998693 | 6.797273 |
ee2c3b30-eb02-4be7-a699-608adc26dad3 | hemere/my-program | kyopro/arc/arc026/b.cpp | //問題:https://atcoder.jp/contests/arc026/tasks/arc026_2
//提出:https://atcoder.jp/contests/arc026/submissions/15659607
//2020-08-03AC
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
ll n;
cin >> n;
ll cnt = 1;
for(ll i=2; i*i<=n; ++i){
if(i*i == n){
cnt += i;
}
el... | ALGO | 0.999977 | 4.991555 |
8c68348f-c0fe-45e4-ae81-9cd08ec8a697 | Brave123555/leetcod1 | solution/1600-1699/1639.Number of Ways to Form a Target String Given a Dictionary/Solution.cpp | class Solution {
public:
int numWays(vector<string>& words, string target) {
const int mod = 1e9 + 7;
int m = target.size(), n = words[0].size();
vector<vector<int>> cnt(n, vector<int>(26));
for (auto& w : words) {
for (int j = 0; j < n; ++j) {
++cnt[j][w[... | ALGO | 0.999993 | 6.429691 |
c1720beb-41a3-4ead-80d9-f266ad1bff22 | kanishkachaudhary-03/flight-management-system- | boost_1_88_0/libs/parameter/test/literate/predicate-requirements0.cpp |
#include <boost/parameter.hpp>
BOOST_PARAMETER_NAME((_graph, graphs) graph)
BOOST_PARAMETER_NAME((_visitor, graphs) visitor)
BOOST_PARAMETER_NAME((_root_vertex, graphs) in(root_vertex))
BOOST_PARAMETER_NAME((_index_map, graphs) in(index_map))
BOOST_PARAMETER_NAME((_color_map, graphs) in_out(color_map))
#include <boo... | ALGO | 0.995878 | 6.548259 |
94428ef4-3ed7-4b17-bb68-e273d4111d8d | Akshit56/DSA-Practice | Hash Maps/q1.cpp | #include <iostream>
#include <unordered_map>
using namespace std;
int main()
{
string a = "Lovebabbar";
unordered_map<char, int> m;
for (int i = 0; i < a.length(); i++)
{
m[a[i]]++;
}
for (auto i : m)
{
cout << i.first << " : " << i.second << endl;
}
} | ALGO | 0.99871 | 4.135427 |
8e272bd1-03bc-42dd-990d-c3ca99eeadc1 | hardeepsingh34/CPlusPluscodes | programd88.cpp | #include<iostream>
using namespace std;
bool isSorted(int arr[],int size){
if(size==0||size==1){
return true;
}
if(arr[0]>arr[1]){
return false;
}else{
bool a =isSorted( arr+1, size-1);
return a;
}
}
int main(){
int arr[8]={2,3,4,5,6,7,12,15};
cout<<isSorted(arr,8);
} | ALGO | 0.999965 | 4.40564 |
7a31f967-52a0-4562-b306-4a8879970789 | AnasImloul/Leetcode-Solutions | scripts/algorithms/N/Nonnegative Integers without Consecutive Ones/Non-negative Integers without Consecutive Ones.cpp | // Runtime: 8 ms (Top 30.65%) | Memory: 6.5 MB (Top 20.12%)
class Solution {
public:
int dp[31][2];
vector<int> f(){
vector<int> res(31, 1);
dp[1][0]=0;
dp[1][1]=1;
for(int i=2; i<31; i++){
dp[i][0]=dp[i-1][0]+dp[i-1][1];
dp[i][1]=dp[i-1][0];
}
... | ALGO | 0.999972 | 5.736491 |
495da498-5f01-457e-aeac-0f2e9736ed8b | CanhForresten/Eksamen | ReEksamen_sommeren_2024/Opgave1/lotto.cpp | #include"lotto.h"
#include"Binomial.h"
using namespace std;
//Opgave 1b)
double lottoRowProbability(int r){
double kombi = binomialCoefficient(7, 36);
double chance = r/kombi;
return chance;
}
//Opgave 1 e)
double vikingLottoRowProbability(int r){
double kombi = binomialCoefficient(6, 48)*5;
... | ALGO | 0.996531 | 3.461336 |
c85075a6-6331-455b-8eba-3e0bb19b9c0f | ishandutta2007/codeforces | dpair/normal/1404/B.cpp | #include <bits/stdc++.h>
using namespace std;
template <typename T>
inline void read(T &x){
x = 0;int fu = 1;
char c = getchar();
while(c > 57 || c < 48){
if(c == 45) fu = -1;
c = getchar();
}
while(c <= 57 && c >= 48){
x = (x << 3) + (x << 1) + c - 48;
c = getchar()... | ALGO | 0.999965 | 3.845687 |
c0d8847e-c02f-441d-8147-a0cd0715c461 | dotAlgorithm/algorithm | programmers/lv0/n 번째 원소부터.cpp | // authored by jihwankim
// 23-10-30 AM 06:15
#include <string>
#include <vector>
using namespace std;
vector<int> solution(vector<int> num_list, int n) {
vector<int> answer(num_list.begin() + n - 1, num_list.end());
return answer;
}
/*
num_list, n
n° Һ ұ Ʈ
assign ˾ƺ
decltype ˾ƺ.
*/
// AM 06:16
| ALGO | 0.999862 | 4.668669 |
7cb9fa03-8072-4084-9494-a4d583d6535e | midmelody/ToolsITK | HierarchicalCurveSkeletons/HighDiverg/HighDiverg.cpp | // Find high divergence points of a vector field
// --- Input: 1. normalized 3D vector field
//
// dFx dFy dFz
// divergence = ----- + ----- + -----
// dx dy dz
//
// --- Output: highest ...% divergence point list
// --- Author: Nicu D. Cornea, Vizlab, Rutgers University
//... | ALGO | 0.999165 | 4.865502 |
b3db8fe9-9a53-41df-bc2a-df44a0cbad55 | Sanket-landge/C-CPP-Hands-on | 180Pyramid.cpp | #include<iostream>
using namespace std;
int main()
{
int n;
cin>>n;
for(int i=1;i<=n;i++){
for(int j=1;j<=n-i;j++){
cout<<" ";
}
for(int k=1;k<=i;k++){
cout<<"* ";
}
cout<<endl;
}
return 0;
}
| ALGO | 0.999793 | 3.570605 |
0aba6daf-9f3e-414d-a064-83bfc4a57cf0 | ketan-suthar/Algorithms | Greedy Algorithms/Job Sequencing Problem/JobSequencingProblem(N_Square).cpp | #include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;
struct job
{
char id;
int dead;
int profit;
};
bool comparison(job a, job b)
{
return (a.profit > b.profit);
}
void maximumProfitJobs(job jobs[], int n)
{
if(n==0)
return 0;
if(n==1)
cout<<jobs[0].id<<" "<<jobs[0].dead<<"... | ALGO | 0.998337 | 3.942372 |
b5bba225-2150-40f3-ad1f-958011e8278a | alenaolifirenko/Computer-Science-2021 | 2.3/task2.cpp | #include <iostream>
std::size_t hash(const char * s)
{
std::size_t h = 0U;
for( const char* p = s; *p != '\0'; ++p)
{
h = h * 31 + static_cast < unsigned int > (*p);
}
return h % 128;
}
std::size_t hash_double( double d)
{
double* pd = &d;
char* c = (char*) pd;
std::cout << sizeof(double) << std:... | ALGO | 0.979097 | 5.40271 |
dea4f19f-aea1-477e-8b11-d53fa22c4c17 | Amrita156/Leetcode_Amrita | 1458-sort-integers-by-the-number-of-1-bits/1458-sort-integers-by-the-number-of-1-bits.cpp | class Solution {
public:
static bool cmp(int a , int b )
{
int p = __builtin_popcount(a);
int q = __builtin_popcount(b);
if(p==q){
return (a<=b);
}
else{
return (p<q);
}
}
vector<int> sortByBits(vector<int>& arr) {
sort(arr.begin(),arr.end(),cmp);
... | ALGO | 0.999996 | 5.734941 |
28a467a3-6998-4339-92e6-1a7682182bbf | GOOTEAKIM/algo | C++/programers_basic/programers_basic/p_181847.cpp | #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
string solution(string n_str) {
int start = 0;
while (start < n_str.length() && n_str[start] == '0') {
start++;
}
return n_str.substr(start);
} | ALGO | 0.998386 | 5.205213 |
80794901-fe66-4efe-a1ef-8d99cb6d2995 | Hadeel-Abdeljalil/MyLeetCodeSolutions | 0013-roman-to-integer/0013-roman-to-integer.cpp | class Solution {
public:
int romanToInt(string s) {
unordered_map<char, int> m;
m['I'] = 1;
m['V'] = 5;
m['X'] = 10;
m['L'] = 50;
m['C'] = 100;
m['D'] = 500;
m['M'] = 1000;
int ans = 0;
for(int i = 0; i < s.length(); i++){
... | ALGO | 0.999898 | 6.223623 |
4b3f897e-709e-4370-8ed8-432f690220a7 | csoneson/Rhisat2 | src/aligner_swsse.cpp | #include <string.h>
#include "aligner_sw_common.h"
#include "aligner_swsse.h"
/**
* Given a number of rows (nrow), a number of columns (ncol), and the
* number of words to fit inside a single __m128i vector, initialize the
* matrix buffer to accomodate the needed configuration of vectors.
*/
void SSEMatrix::init(
... | TOOL | 0.947643 | 5.65489 |
93ea262d-7a6b-4444-9dfa-79454972de87 | Mehedi-Hasan-Rabbi/Online-Judge-Solution | CodeForces/1620 B. Triangles on a Rectangle.cpp | // In the name of Allah the merciful.
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define endl '\n'
#define yes cout << "YES" << endl
... | ALGO | 0.998819 | 3.673379 |
83a7e1c7-e433-4151-b572-77f224c16c33 | vryy/kratos_bcn3 | external_libraries/vexcl/examples/complex_simple.cpp | #include <iostream>
#include <complex>
#include <vector>
#include <vexcl/vexcl.hpp>
//---------------------------------------------------------------------------
// Complex multiplication:
//---------------------------------------------------------------------------
VEX_FUNCTION(cl_double2, cmul, (cl_double2, a)(cl_d... | ALGO | 0.999233 | 6.046774 |
082cc80e-82cf-4691-876b-a45bd0de4dcf | tursunbekzat/Algorithms_2022 | Lectures/Safargaliev/Graph/graph.cpp | #include <iostream>
#include <vector>
#include <map>
#include <queue>
using namespace std;
vector<vector<int>> g;
int n = 5;
bool used[5];
// glubina
void dfs(int v)
{
cout << "Current vertex: " << g[v][0] << "\n";
used[v] = true;
for (int i(0); i < g[v].size(); i++)
{
int to = g[v][i];
... | ALGO | 0.99989 | 4.856973 |
c49a3fb7-1483-46e2-9a2c-5aaf9e185a50 | NikitaUssyukin/PP1_2024_Fall | Lectures/G2/Week08/f.cpp | #include <iostream>
using namespace std;
void mutateArray(int a[], int n) {
for(int i = 0; i < n; ++i) {
a[i] *= 2;
}
}
void printArray(int a[], int n) {
for(int i = 0; i < n; ++i) {
cout << a[i] << ' ';
}
cout << endl;
}
int main() {
int n;
cin >> n;
int a[n];
... | ALGO | 0.999393 | 4.296188 |
ce9cbf30-756d-4b15-84e2-514b09d1c3d3 | nlzy/triton-gfx906 | third_party/f2reduce/f2reduce.cpp | #include "f2reduce.h"
#include <string.h>
#include <stdlib.h>
#if defined(_MSC_VER)
#define RESTRICT __restrict
#define NO_INLINE __declspec(noinline)
#elif defined(__GNUC__)
#define RESTRICT __restrict__
#define NO_INLINE __attribute__ ((noinline))
#endif
namespace f2reduce {
void swap_rows(uint64_t* RESTRICT x, u... | ALGO | 0.999289 | 5.782392 |
30aef220-8b5a-4650-a14c-23ae88d884e5 | cryptogogue/vol-node-cpp | src/volition/Miner.cpp | #include <volition/Block.h>
#include <volition/BlockODBM.h>
#include <volition/BlockSearchPool.h>
#include <volition/Digest.h>
#include <volition/FileSys.h>
#include <volition/HTTPMiningMessenger.h>
#include <volition/InMemoryBlockTree.h>
#include <volition/Miner.h>
#include <volition/MinerLaunchTests.h>
#include <voli... | ALGO | 0.984927 | 7.024287 |
ae7028b7-8ae1-49e2-8239-31b1ef916e67 | ANYCUBIC-3D/AnycubicSlicer_Prusa | src/libigl/igl/ismember.cpp | template <
typename DerivedA,
typename DerivedB,
typename DerivedIA,
typename DerivedLOCB>
IGL_INLINE void igl::ismember(
const Eigen::MatrixBase<DerivedA> & A,
const Eigen::MatrixBase<DerivedB> & B,
Eigen::PlainObjectBase<DerivedIA> & IA,
Eigen::PlainObjectBase<DerivedLOCB> & LOCB)
{
using namespace ... | ALGO | 0.993861 | 6.500557 |
02040d4d-c974-42a4-98e8-b7747325fd13 | vbonnici/grafe-sim | analysis/data/p04001/s351049270.cpp | #include<bits/stdc++.h>
using namespace std;
using ll=long long;
int main(){
string S;
cin>>S;
ll sum=0;
for(int bit=0;bit<(1<<S.size()-1);bit++){
ll t=S[0]-'0';
for(int i=0;i<S.size()-1;i++){
if(bit&(1<<i)){
sum+=t;
t=S[i+1]-'0';
}else{
t=t*10;
t+=S[i+1]-'0';... | ALGO | 0.999833 | 4.42962 |
ffc10f4a-25d2-4007-8b54-c47ddc7a457d | robotflow-initiative/rfmove | extern/include/bfl/smoother/backwardfilter.cpp | #include "backwardfilter.h"
#define StateVar SVar
// Constructor
template<typename SVar>
BackwardFilter<SVar>::BackwardFilter(Pdf<SVar>* prior)
: _prior(prior),
_timestep(0)
{}
template<typename SVar>
BackwardFilter<SVar>::~BackwardFilter(){}
template<typename SVar>
BackwardFilter<SVar>::BackwardFilter(const ... | ALGO | 0.996941 | 4.887619 |
ce3ab6bb-d35c-45cb-bfd0-b015ce321c85 | sysulic/ABS | VAL/State.cpp | #include "State.h"
#include "Exceptions.h"
#include "LaTeXSupport.h"
#include "Plan.h"
#include "Proposition.h"
#include "RobustAnalyse.h"
#include "Validator.h"
#include "main.h"
#include <cmath>
#include <sstream>
using std::cerr;
using std::stringstream;
using std::nan;
//#define list std::list
//#define map std::... | TOOL | 0.927788 | 5.304801 |
be8e90a3-2fea-4c25-b779-8d19a3182d58 | vishwanath-ek/ProgrammingPractice | C++/trickyPrograms/Trees/removeBSTNodeOutsideRange.cpp | #include <iostream>
#include "TreeNode.h"
using std::cout;
using std::endl;
void printInorderTraverse(Node *node){
if(!node){
return;
}
printInorderTraverse(node->left);
cout << node->data << " ";
printInorderTraverse(node->right);
}
void printInorderTraversal(Node *node){
if (!node){
... | ALGO | 0.999408 | 4.201348 |
29564d23-60a9-4ccb-9742-7f6e693f90ef | alexandraback/datacollection | solutions_5630113748090880_0/C++/bimaoe/B.cpp | #include <stdio.h>
#include <algorithm>
#include <map>
using namespace std;
int main (void) {
int t;
scanf ("%d", &t);
for (int c = 1; c <= t; c++) {
printf ("Case #%d: ", c);
int n;
scanf ("%d", &n);
map<int, int> cnt;
for (int i = 0; i < 2*n-1; i++) {
for (int j = 0; j < n; j++) {
int x;
sca... | ALGO | 0.999088 | 3.318461 |
11cd2578-25c2-48c0-a52e-97bad31f392a | jose-rZM/PLShell | src/parser/slr1_parser.cpp | #include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <unordered_set>
#include <vector>
#include "../../include/grammar.hpp"
#include "../../include/slr1_parser.hpp"
#include "../../include/symbol_table.hpp"
#include "../../include/tabulate.hpp"
SLR1Parse... | ALGO | 0.989875 | 5.261511 |
1847916f-524f-4588-868f-a3f38f088fd9 | CarterLeBlanc/TicTacToe | TicTacToe/TicTacToe.cpp | #include "pch.h"
#include <iostream>
using namespace std;
//Sets the grid for all available moves
char grid[10] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' };
int checkWin()
{
//If all of the spaces match in the top row, return 1
if (grid[1] == grid[2] && grid[2] == grid[3])
{
return 1;
}
//If all... | ALGO | 0.995936 | 5.542321 |
c2208b2f-6b1f-45bc-ba45-6159848830e6 | ZhanXiaoSheng/github-test | cpp/sfo_25_combine_two_sorted_linked_lists_s1/sfo_25_combine_two_sorted_linked_lists_s1.cpp | /*
* File: sfo_25_combine_two_sorted_linked_lists_s1.cpp
* Created Time: 2021-12-09
* Author: Krahets (<EMAIL>)
*/
#include "../include/include.hpp"
// ===== Solution Code =====
class Solution {
public:
ListNode* mergeTwoLists(ListNode* l1, ListNode* l2) {
ListNode* dum = new ListNode(0);
ListNode... | ALGO | 0.999972 | 6.061096 |
c0e5ed7c-57ad-491e-a184-23f13ecf0997 | rahul17081998/Data-Structure | code_cpp/self pased DSA/Greedy/LEETCODE/Two-City-Scheduling.cpp | /*A company is planning to interview 2n people. Given the array costs where costs[i] = [aCosti, bCosti],
the cost of flying the ith person to city a is aCosti, and the cost of flying the ith person to city b is bCosti.
Return the minimum cost to fly every person to a city such that exactly n people arrive in each city... | ALGO | 0.999967 | 5.959763 |
31a7560b-bca0-471e-84db-3cac8777ab0a | mapsme/omim | routing/leaps_postprocessor.cpp | #include "routing/leaps_postprocessor.hpp"
#include "base/assert.hpp"
#include "base/logging.hpp"
#include "base/non_intersecting_intervals.hpp"
#include "base/scope_guard.hpp"
#include <algorithm>
#include <iterator>
#include <sstream>
#include <utility>
namespace
{
using namespace routing;
class NonIntersectingSe... | ALGO | 0.999739 | 6.365126 |
f86b7b97-82fb-44ce-a852-90be8129ca32 | Prayag2003/Standard_Template_Library | Questions/MonksBirthdayParty.cpp | // https://www.hackerearth.com/problem/algorithm/monks-birthday-party/
#include <iostream>
#include <set>
using namespace std;
#define ll long long int
int main()
{
int t;
cin >> t;
while (t--)
{
ll n;
cin >> n;
set<string> ss;
while (n--)
{
string s... | ALGO | 0.999534 | 5.200969 |
926fb478-40ad-4cbc-abd3-7224dbcfde62 | rastaval/virtualbox | src/VBox/Runtime/common/table/avlrpv.cpp | /* $Id: avlrpv.cpp $ */
/** @file
* IPRT - AVL tree, void *, range, unique keys.
*/
#ifndef NOFILEID
static const char szFileId[] = "Id: kAVLPVInt.c,v 1.5 2003/02/13 02:02:35 bird Exp $";
#endif
/*******************************************************************************
* Defined Constants And Macros ... | ALGO | 0.902052 | 5.568395 |
e6854c95-4347-4377-9c34-3bd31d71a8e3 | walkccc/LeetCode | solutions/2791. Count Paths That Can Form a Palindrome in a Tree/2791.cpp | class Solution {
public:
long long countPalindromePaths(vector<int>& parent, string s) {
// A valid (u, v) has at most 1 letter with odd frequency on its path. The
// frequency of a letter on the u-v path is equal to the sum of its
// frequencies on the root-u and root-v paths substract twice of its
... | ALGO | 0.999945 | 6.078446 |
a370625c-886a-4a46-8f2e-8227fe5368d9 | ishandutta2007/codeforces | shzhang/normal/1608/A.cpp | #include <cstdio>
#include <algorithm>
#include <vector>
#include <set>
#include <cstdlib>
#include <utility>
#include <cmath>
#include <queue>
#include <stack>
#include <cstring>
using namespace std;
#define ll long long
#ifndef ONLINE_JUDGE
#define debug(format, ...) fprintf(stderr, \
"%s:%d: " format "\n", __... | ALGO | 0.998399 | 3.773163 |
470d2fa3-e58b-4b57-9600-f78fcbe3f3a4 | Jhonathan-Pizarra/Cpp | Ejericios/EPN/Actuaciones/SBimestre/01022017.cpp | #include<iostream>
#include<string.h>
using namespace std;
int lineal(int array[], int numero); //Prototipo de arreglo
int main(){
int n;
int array[10];
for(int j=0; j<10; j++){
cout<<"Ingrese un numero: ";
cin>>array[j];
}
cout<<endl;
cout<<"Ingrese un numero a buscar: ";
cin>>n;
cout<<endl... | ALGO | 0.998955 | 3.854306 |
471e7edc-983d-4f61-8b41-50d2fa24f8cc | nglong14/CP | CSP_M1/CLASSROOM.cpp | #include<bits/stdc++.h>
using namespace std;
#define int long long
const int maxn=1e5+7, mod=1e9+7;
int f[maxn], inv[maxn];
int t, n, m;
int power(int a, int b, int mod)
{
if (b == 0) return 1;
int t = power(a, b / 2, mod);
t = (t * t) % mod;
if (b % 2 == 1) t = (t * a) % mod;
return t%mod;
}
int... | ALGO | 0.999974 | 5.013977 |
e0a8d422-bad4-4992-bb55-045783a60078 | gtkn/atcoder | ABC_268_G.cpp | //title
#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
#define rep(i,n) for (ll i = 0; i < (n); ++i)
#define rep1(i,n) for (ll i = 1; i <= (n); ++i)
#define repr(i,n) for (ll i = (n)-1; i >= 0; --i)
#define rep1r(i,n) for (ll i = (n); i > 0; --i)
#define bit(n,k) ((n>>k)&1... | ALGO | 0.999984 | 4.500895 |
d816f72b-e4d3-4d38-834c-55f2da02ba52 | CloverTinTin/CppPrimerStudy | chapter_03/string/stringPractise/stringtest.cpp | #include <iostream>
#include <string>
#include <cctype>
using namespace std;
int main()
{
string line;
while(getline(cin, line))
{
for(auto &c: line)
c = toupper(c);
cout << line << '\n';
}
// decltype(line.size()) punct_cnt = 0;
// while(getline(cin, line))
// {
// for(auto c: line)
// if(ispunct(c))
/... | TOOL | 0.989894 | 4.544993 |
4b22f158-4945-4563-ac5b-2def7e66644a | ishandutta2007/codeforces | rubikun/normal/1712/D.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define fi first
#define ... | ALGO | 0.999924 | 4.528704 |
87de13f6-8ca1-4c45-9630-bd76a870faf6 | Autokade/Cpp-practice | Trees/AVL/LR_and_RL.cpp | #include <iostream>
using namespace std;
class Node {
public:
Node* lchild;
int data;
Node* rchild;
int height;
};
class AVL {
public:
Node* root;
AVL() { root = nullptr; }
// Helper methods for inserting
int NodeHeight(Node* p);
int BalanceFactor(Node* p);
Node* LLRotation(N... | ALGO | 0.999979 | 6.033185 |
a8e02854-c1fd-44f7-9750-2cbda9261d04 | MilosS2024/godot | thirdparty/misc/pcg.cpp | #include "pcg.h"
uint32_t pcg32_random_r(pcg32_random_t* rng)
{
uint64_t oldstate = rng->state;
// Advance internal state
rng->state = oldstate * 6364136223846793005ULL + (rng->inc|1);
// Calculate output function (XSH RR), uses old state for max ILP
uint32_t xorshifted = ((oldstate >> 18u) ^ oldst... | ALGO | 0.950994 | 6.352406 |
e890273f-01e3-498b-bde6-c3e6623bf360 | keshavsingh4522/hacktoberfest | DSA/Strings/sort_subsequences.cpp | #include <bits/stdc++.h>
using namespace std;
void printSubsequence(string input, string output)
{
if (input.empty()) {
cout << output << endl;
return;
}
// output is passed with including
// the Ist characther of
// Input string
printSubsequence(input.substr(1), output + input[0]);
// output is passed ... | ALGO | 0.999944 | 5.467994 |
6110d93d-a343-4a7b-a848-3eb5dc7cb05d | nqdat2002/My-Source | Luyencode.net/CNT7.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
ll M= 1000000007;
ll pow(ll a, ll n){
if(n == 1) {
return a;
} else {
ll temp = (ll)pow(a, n/2);
if(n % 2 == 0)
return (temp%M * temp%M)%M;
else
return ((temp%M * temp%M)%M%M *a%M) %M;
... | ALGO | 0.99988 | 3.9279 |
48be3a69-0c44-45c5-aa41-6c5c7c834cdd | Abdelrhmansersawy/Competitive-Programming-solution | The 2023 ICPC Egyptian Collegiate Programming Contest (Qualifications Day 4)/L.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i , st , ed) for(int i = st; i < ed; i++)
#define f first
#define s second
#define all(v) v.begin() , v.end()
#ifndef ONLINE_JUDGE
#define debug(x) cerr << #x << ": " << x << '\n';
#else
#define debug(x)
#endif
int main(){
ios::sync_wi... | ALGO | 0.998327 | 3.816238 |
a894eb0c-b54f-4138-9963-5abb2453f389 | NurMuhammadCSE/SWE-I-Interview-Problems | Graph/Algorithms/Floyd-Warshall.cpp | #include<bits/stdc++.h>
using namespace std;
class Solution {
public:
void shortestDistance(vector<vector<int>>& mat) {
int n = mat.size();
for(int i=0; i<n; i++){
for(int j=0; j<n; j++){
if(mat[i][j] == -1){
mat[i][j] = 1e9;
}
... | ALGO | 0.999982 | 4.819355 |
007bc249-5cf3-494c-9da5-a97b2be08444 | thegamer1907/Code_Analysis | Implementation/1596.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
string team;
cin>>team;
int i,c=1;
for(i=1;i<team.length();i++)
{
if((team.at(i-1)==team.at(i)))
{
++c;
}
else if((team.at(i-1)!=team.at(i)))
{
c=1;
}
... | ALGO | 0.999961 | 3.618219 |
0087095a-8717-441c-9b67-f85e4a81702c | subhamk12/cses-solutions | collecting_numbers.cpp | #include <bits/stdc++.h>
#define vi vector<int64_t>
#define pb push_back
#define ff first
#define ss second
#define vii vector<pair<int64_t,int64_t>>
#define loop(i, m, n) for (int64_t i=m;i<n;i++)
using namespace std;
int64_t take(){
int64_t x;cin>>x;return x;
}
int32_t main()
{
int64_t n=take();
vii nums(n,... | ALGO | 0.999728 | 4.334479 |
c4f928ff-3574-4a63-8020-da006797a462 | Vijay1770/Top-100-codes | 35_half_pyramid.cpp | #include <iostream>
using namespace std;
// HALF PYRAMID
// int main()
// {
// int rows;
// cout << "Enter number of rows: ";
// cin >> rows;
// for (int i = 1; i <= rows; i++)
// {
// for (int j = 1; j <= i; ++j)
// {
// cout << "* ";
// }
// cout << "\... | ALGO | 0.989675 | 4.851565 |
b02613c7-9335-4013-b2b7-b111e24b06fb | JuShuai-gif/learn_cpp_hj | peng/RAII_pointer/vector_test.cpp | #include <iostream>
#include <vector>
#include <algorithm>
int sum = 0;
void fun(int v){
sum += v;
}
int main()
{
// 判断C++标准
std::cout << __cplusplus << std::endl;
// Vector的一种赋值方式 C++98
std::vector<int> v1(4);
v1[0] = 0;
v1[1] = 1;
v1[2] = 2;
v1[3] = 3;
for (size_t i = 0; i... | ALGO | 0.945433 | 4.050426 |
9c3bbdff-62fa-4eee-beb7-7a143a1dd43b | ivanrafli14/CP-Archives | USACO_FamilyTree.cpp | #include <bits/stdc++.h>
//#define int long long
//#define mp make_pair
#define pii pair<int,int>
#define pb push_back
#define fi first
#define se second
#define BOOST ios_base::sync_with_stdio(false);cin.tie(NULL);
using namespace std;
//int range 1e9
//ll range 1e18
//double > float
// 1sec -> 1e8
const int MOD = 1e... | ALGO | 0.999779 | 3.950382 |
b8f34a0e-ba54-49e6-a9e0-2b3fd359b9e1 | liuhuxian/ORB_SLAM2_renzhendehu | Thirdparty/g2o/g2o/core/optimization_algorithm_gauss_newton.cpp | #include "optimization_algorithm_gauss_newton.h"
#include <iostream>
#include "../stuff/timeutil.h"
#include "../stuff/macros.h"
#include "solver.h"
#include "batch_stats.h"
#include "sparse_optimizer.h"
using namespace std;
namespace g2o {
OptimizationAlgorithmGaussNewton::OptimizationAlgorithmGaussNewton(Solve... | ALGO | 0.998499 | 6.723323 |
f062f016-38da-4c0b-8e76-48b6b412125c | 1119-2916/competitive-programming | atcoder/arc/043/a.cpp | #include <bits/stdc++.h>
using namespace std;
#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb ... | ALGO | 0.999466 | 3.810537 |
19141a5c-7b1a-42c6-b66e-84f15c13789b | bolunli11/boost-1_71_0 | libs/phoenix/example/lambda.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <boost/phoenix/scope.hpp>
#include <boost/phoenix/core.hpp>
#include <boost/phoenix/operator.hpp>
#include <boost/phoenix/function.hpp>
namespace lazy_stuff
{
using boost::phoenix::function;
struct for_each_impl
{
typedef void re... | TOOL | 0.938624 | 4.706051 |
c33dc70e-f081-495c-9e1a-676a72dd324c | Khyatikumari/Metacrafter-Avalanche-Module-3 | 1628-count-submatrices-with-all-ones/1628-count-submatrices-with-all-ones.cpp | class Solution {
public:
int numSubmat(vector<vector<int>>& mat) {
int r = mat.size(), c = mat[0].size(), ans = 0;
vector<int> h(c);
for (int i = 0; i < r; i++) {
for (int j = 0; j < c; j++) h[j] = mat[i][j] ? h[j] + 1 : 0;
vector<int> sum(c);
stack... | ALGO | 0.999946 | 5.570712 |
9a28d1ea-b50a-4c51-a0b5-05ccfb8ba5e0 | noochila/-DSA- | 1983-maximum-population-year/1983-maximum-population-year.cpp | class Solution {
public:
int maximumPopulation(vector<vector<int>>& logs) {
vector<int> a(2060);
for(auto it:logs)
{
a[it[0]]+=1;
a[it[1]]-=1;
}
for(int i=1;i<=2050;i++)
a[i]+=a[i-1];
return max_element(a.begin(),a.end())-a.begin();
... | ALGO | 0.999535 | 5.386583 |
b5e9efc9-18ca-44d0-aa64-41ee0ee03146 | sergadin/110-2023 | Krasnov_DE/3_sem/test3/main.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <stdexcept>
using namespace std;
class VectorClock{
private:
vector<int> clock;
int process_id;
public:
// constructor
// make this with using initialization list
// :
VectorClock(int N, int k) : process_id(k), clock(N,0){
... | ALGO | 0.994401 | 5.189783 |
a276f25f-9cfe-4168-8e3f-f236818e7ace | box-cs/aoc2023 | 04-12-2023/04-12-2023.cpp | #include "../lib/io.hpp"
#include <iostream>
#include <map>
#include <ranges>
#include <sstream>
#include <string>
#include <vector>
using std::string;
using std::stringstream;
using std::vector;
namespace ranges = std::ranges;
namespace views = std::views;
typedef std::map<int, int> CardDict;
int getMatches(auto nu... | ALGO | 0.998581 | 5.184223 |
bfb53c52-4c5d-40ab-a0c0-f8d3a95cecf0 | Ziklon/algorithms | cfc/200D.cpp | #include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <ctime>
#define al... | ALGO | 0.999511 | 3.723827 |
4c98c784-6484-44c0-89f9-1c0fadd7e8df | askdfjlas/cp-algorithms | geometry/convex_hull.cpp | #include <bits/stdc++.h>
using namespace std;
#define FOR(x,n) for(int x=0;x<n;x++)
#define FORR(x,a,b) for(int x=a;x<=b;x++)
using ld = long double;
using ll = long long;
typedef pair<int,int> ii;
constexpr auto eps = 1e-8;
inline int sgn(ld x) { return (abs(x) <= eps) ? 0 : (x < 0 ? -1 : 1); }
inline int sgn(ll x) ... | ALGO | 0.999999 | 5.705617 |
ac243be8-54d5-40c4-bfc4-12905c077d50 | CoderOJ/contests | CodeForces/cts/1556/f/main.cpp | #include <bits/stdc++.h>
#include "/home/jack/code/creats/Scanner.hpp"
#include "/home/jack/code/creats/log.hpp"
#include "/home/jack/code/creats/range.hpp"
#include "/home/jack/code/creats/util.hpp"
#include "/home/jack/code/creats/Vector.hpp"
// #include "/home/jack/code/creats/STree.hpp"
// #include "/home/jack/cod... | ALGO | 0.999894 | 4.203098 |
95c16076-19c9-4e2f-be67-da899255f96a | giacomini/esc15 | hands-on/vectorization/NeuNetNaive.cpp | #include<cmath>
#include<limits>
#include<array>
#include<vector>
#include<random>
// c++ -Ofast -fopenmp -mavx2 -mfma NeuNetNaive.cpp -fopt-info-vec -ftree-loop-if-convert-stores
// --param max-completely-peel-times=1
#include <omp.h>
// #define SCALAR
#include "approx_vexp.h"
template<typename T>
T sigmoid(T x)... | DATA | 0.99327 | 3.768797 |
0a719047-7c1f-47b9-88b4-420681fc1353 | margulan-murataly/pp1-cpp | Lab_3/F.cpp | #include <iostream>
using namespace std;
int main() {
char c;
cin >> c;
int n = int(c);
if (n >= 97)
{
n = n - 32;
cout << char(n) << endl;
}
else {
n = n + 32;
cout << char(n) << endl;
}
return 0;
} | TOOL | 0.948874 | 4.00911 |
cb6b963a-e755-4d9f-88c7-281a7b58b2f3 | USTCLuo/CG_25 | Framework2D/src/assignments/3_PoissonImageEditing/seamless_clone.cpp | #include "seamless_clone.h"
#include <Eigen/Sparse>
#include <iostream>
#include <vector>
namespace USTC_CG
{
// 获取指定坐标的像素值
int SeamlessClone::g(int x, int y, int channel)
{
// 检查坐标是否在图像范围内
if (x < 0 || x >= src_img_->width() || y < 0 || y >= src_img_->height())
{
retur... | ALGO | 0.955995 | 4.977998 |
f88a8ee6-1e8b-4fa0-b1fa-b4f3d598c189 | revue-starlight/Algorithm | Codeforces/1527E.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 3.5e4+100, K = 105;
const ll MAXX = 0x3f3f3f3f3f3f3f3f;
ll tree[N*4],lazy[N*4],dp[K][N],s[N];
inline int lson(int x){return x<<1;}
inline int rson(int x){return x<<1|1;}
void build(int x,int l,int r){
if (l==r){
tree[x]=s[l];
... | ALGO | 0.999905 | 3.808965 |
f8ae405d-d7e5-484b-b38c-4faf8a0f26bc | Kanchii/Online_Judge_Problems | Codeforces/116B_Little_Pigs_and_Wolves.cpp | #include <bits/stdc++.h>
using namespace std;
#define INF 0x3f3f3f3f
#define max(a,b) ((a) > (b) ? (a) : (b))
#define min(a,b) ((a) < (b) ? (a) : (b))
#define MAX 100000
#define mp make_pair
#define pb push_back
#define fori(n) for(int i = 0; i < n; i++)
#define forsi(s, n) for(int i = s; i < n; i++)
#define forj(n) ... | ALGO | 0.999432 | 3.756658 |
68091352-adf3-4357-a49f-f9ee3c0c77cc | ishandutta2007/codeforces | kaitokid/normal/1153/C.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int n;
string s;
int main()
{
ios::sync_with_stdio(0);
cin>>n>>s;
if(n%2==1){cout<<":(";return 0;}
int l=0,r=0;
for(int i=0;i<n;i++){if(s[i]=='(')l++;if(s[i]==')')r++;}
l=n/2-l;
r=n/2-r;
if(l<0||r<0){cout<<":(";return 0;}
int d=0;
for(int i=0;i<n-1;i... | ALGO | 0.999899 | 3.957363 |
1bfd08ab-c97c-4139-b8f3-038635c989fa | UTP-TriforceX/Programming-Contest | Maraton/Triforce/dice.cpp | #include <bits/stdc++.h>
#define endl '\n'
using namespace std;
int main(){
int gunnar,emma,ans1=0,ans2=0;
for(int i=0; i<4; i++){
cin>>gunnar;
ans1 += gunnar;
}
for(int i=0; i<4; i++){
cin>>emma;
ans2 += emma;
}
if(ans1 > ans2){
cout<<"Gunnar"<<endl;
}
else{
if(ans2 > ans1){
cout<<"Emma"<<en... | ALGO | 0.999963 | 4.180024 |
607b74dd-4e15-4b4b-a3b7-3d21d2938daa | fazd/Maraton | B.Two-gram.cpp | #include<bits/stdc++.h>
using namespace std;
int main ()
{
int n;
cin>>n;
string str;
cin>>str;
int max = 0;
string gram;
for(int i = 0; i < n-1; i++){
string subs = str.substr(i,2);
//cout<<"subs: "<< subs <<"\n";
int cont = 0;
for(int j = 0; j < n-1; j++){
string temp = str.substr(j,2);
//cout<... | ALGO | 0.999912 | 3.123957 |
e8b5c199-196a-479c-ba94-36daaa6031da | phutruonnttn/CPP_Code_Giai_Thuat | CARD1/main.cpp | #include <bits/stdc++.h>
using namespace std;
long long n,a[200],f[105][105];
int main()
{
freopen("CARD.inp","r",stdin);
freopen("CARD.out","w",stdout);
cin >> n;
for (long i=1; i<=n; i++)
cin >> a[i];
memset(f,-1,sizeof(f));
for (long i=1; i<=n-2; i++)
f[i][i+2]=a[i]*a[i+1]*a... | ALGO | 0.99936 | 3.517781 |
c980aaf5-5f90-4359-b32c-923c93993a16 | zhiliuhuang/.leetcode | 628.三个数的最大乘积.cpp | /*
* @lc app=leetcode.cn id=628 lang=cpp
*
* [628] 三个数的最大乘积
*/
// @lc code=start
class Solution {
public:
int maximumProduct(vector<int>& nums) {
sort(nums.begin(),nums.end());
int size=nums.size();
int max=nums[size-1]*nums[size-2]*nums[size-3];
int a=nums[0]*nums[1]*nums[size-... | ALGO | 0.99997 | 5.634741 |
3db75306-0a60-46d3-913d-3c586191902c | meiavy/doom-legacy | src/engine/g_state.cpp | /// \file
/// \brief Part of GameInfo class implementation.
/// Methods related to game state changes.
#include "g_game.h"
#include "g_player.h"
#include "g_team.h"
#include "g_map.h"
#include "g_mapinfo.h"
#include "g_level.h"
#include "g_pawn.h"
#include "command.h"
#include "cvars.h"
#include "n_connection.h"
#i... | ALGO | 0.856365 | 5.020438 |
5a338d8c-3e5f-484e-9801-71c8a6028a8e | woodycatliu/leetcode | 0797_AllPathsFormSourceToTarget/797.cpp | #include <iostream>
#include <vector>
using namespace std;
class Solution {
typedef vector<vector<int>> Graph;
int endPoint;
public:
vector<vector<int>> allPathsSourceTarget(vector<vector<int>>& graph) {
endPoint = graph.size() - 1;
Graph res;
vector<int> path;
dfs(graph,... | ALGO | 0.999854 | 5.555881 |
cc211c4d-45f0-487d-b745-b1c125834870 | centemians/Coding | Hacker Earth/Danny/Danny/main.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
int n,k,num;
cin>>n>>k;
vector <int> a(n),b;
for(int i=0;i<n;i++){
cin>>a[i];
}
for(int i=0;i<n;i++){
for(int j=i+1;j<n;j++){
num = abs(a[i]-a[j]);
b.push_back(nu... | ALGO | 0.999954 | 3.752544 |
1511a94f-d048-492c-9415-71796b666b61 | bubble501/CLOModel | CLOModelLib/CommonFunctions.cpp | #include "CommonFunctions.h"
#include <QDate>
#include <QRegularExpression>
#include <QStringList>
#include <QList>
#include <qmath.h>
#include <QDir>
#include <QTextStream>
#include <QDate>
#include "BloombergVector.h"
#include "DayCountVect.h"
#include <boost/math/tools/roots.hpp>
#include <QStack>
#include "Abstract... | TOOL | 0.969983 | 4.815996 |
bf4c81c5-85cd-4488-9b09-bbcb655ba86a | quocdung2603/ALL_OF_C | CodeForces/B_Luntik_and_Subsequences.cpp | #include <bits/stdc++.h>
using namespace std;
#define nl << '\n'
#define fi first
#define se second
#define vec(type,name) vector<type>name
#define yes cout << "YES"
#define no cout << "NO"
#define int long long
#define double long double
#define pb push_back
#define all(r) r.begin(), r.end()
#define rall(r) r.rbegin()... | ALGO | 0.999913 | 4.851508 |
c88704ce-e261-4081-9361-cc239f547a8c | vishalvu7/vishalvu7.dragndrop | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998733 | 6.76775 |
c28d7d4d-7434-4603-96c5-73718355d1ac | shivam-droid/DSA | LinkedList/20_Remove_Duplicates_DLL.cpp | class Solution
{
public:
Node * removeDuplicates(struct Node *head)
{
// Your code here
Node* temp=head;
Node* temp2 = temp->next;
while(temp2!=NULL)
{
if(temp->data==temp2->data)
{
temp->next=temp2->next;
... | ALGO | 0.999779 | 5.48156 |
07554dcc-73c6-499b-ae4d-ca09605e3c51 | JeffLegendPower/cp-codes | usaco/Find and Replace/Problem_1_Find_and_Replace.cpp | // https://usaco.org/index.php?page=viewproblem2&cpid=1281&lang=en
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define ll long long
#define plli pair<ll, int>
#define pll pair<ll, ll>
#define pii pair<int, int... | ALGO | 0.999943 | 3.609197 |
fe7bd2dc-517c-437b-854c-92b1b3f161b6 | tyokinuhata/procon | AOJ/ITP1/05D_Structured_Programming.cpp | #include <iostream>
using namespace std;
bool include3(int n) {
while (n) {
if (n % 10 == 3) return true;
n /= 10;
}
return false;
}
void call(int n) {
for (int i = 1; i<= n; i++)
if (i % 3 == 0 || include3(i)) cout << ' ' << i;
cout << endl;
}
int main () {
int n;
... | ALGO | 0.998431 | 4.309249 |
00676708-bf3e-4c8a-86aa-db9dbbb50c98 | zffffw/pta | advance/1084.cpp | #include <iostream>
#include <string>
using namespace std;
int main() {
char s[1000] = {0};
char c;
int fl[256] = {0};
scanf("%s\n", s);
while((c = getchar()) != '\n') {
fl[c] = 1;
}
int flag[256] = {0};
int i = -1;
while(s[++i]) {
c = s[i] >= 'a' && s[i] <= 'z' ? s[i... | ALGO | 0.999815 | 3.863305 |
99430385-f038-4297-b748-0428231f34e5 | markverick/ioi-training | skgrader/C - Count on a tree.cpp | #include<bits/stdc++.h>
#define X first
#define Y second
#define MP make_pair
using namespace std;
int n,w[200005],mp[200005],p[20][200005],h[200005],x,L[200005],R[200005],ar[200005];
pair<int,int> s[200005];
vector<int> adj[200005];
typedef struct node
{
node *l=NULL,*r=NULL;
int s=1;
}node;
typedef node* pnode;
pno... | ALGO | 0.999995 | 4.059725 |
0e9adbd5-fc3a-4197-b515-cb3ebe36fe28 | jvillegasd/Others_Comp_Prog_contests | ACM-ICPC Maraton Nacional de Programacion Colombia 2018/A.cpp | #include <bits/stdc++.h>
#define pb push_back
#define pf push_front
#define pob pop_back
#define fp first
#define sp second
#define mp make_pair
#define ins insert
#define uEdge(u, v) g[u].pb(v), g[v].pb(u)
#define uwEdge(u, v, w) g[u].pb({v, w}), g[v].pb({u, w})
#define dEdge(u, v) g[u].pb(v)
#define dwEdge(u, v, w) g... | ALGO | 0.98952 | 3.42465 |
73d43196-5a64-4e54-838d-b9d8691fd02e | chiquibitrian/lammps-induced-dipole-polarization-pair-style | src/USER-OMP/pair_morse_omp.cpp | /* ----------------------------------------------------------------------
Contributing author: Axel Kohlmeyer (Temple U)
------------------------------------------------------------------------- */
#include "math.h"
#include "pair_morse_omp.h"
#include "atom.h"
#include "comm.h"
#include "force.h"
#include "neighbo... | ALGO | 0.999714 | 6.768407 |
69b15045-664c-47df-879d-4e31de56c42a | sumitanand027/Leetcode-Problem-solved | 240-search-a-2d-matrix-ii/240-search-a-2d-matrix-ii.cpp | class Solution {
public:
bool searchMatrix(vector<vector<int>>& mat, int tar) {
int n = mat.size();
int m = mat[0].size();
int i = 0 , j = m - 1;
while( i < n && i >= 0 && j >= 0 && j < m ) {
if( mat[i][j] == tar ) {
return true;
} els... | ALGO | 0.999974 | 6.172549 |
41664520-177b-4126-8df8-7f96477ce646 | monksmojo/c-plus-plus-dojo | as2_toupper1.cpp | #include<iostream>
#include<string.h>
#include <stdio.h>
using namespace std;
char array[50];
void insert();
void upper();
void show();
int main()
{
cout << "welcome to the program \n to convert a string into upper case" << '\n';
insert();
upper();
show();
}
void insert()
{
char ch ;
int i=0;
cout << "e... | TOOL | 0.854768 | 3.625578 |
31c54c01-f75f-4ea9-9be5-b81ced066030 | pablomuniz/QuasarQuant | ql/experimental/credit/onefactorcopula.cpp | /* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
#include <ql/experimental/credit/onefactorcopula.hpp>
using namespace std;
namespace QuantLib {
//-------------------------------------------------------------------------
Real OneFactorCopula::conditionalProbability(Real p, Rea... | ALGO | 0.998304 | 6.973014 |
489d29bb-9826-48c4-b302-ccb3a8624c45 | EuJota/Estudos_C | Lógica de Programação/Avaliacoes/av2012.2-q1.cpp | #include <stdio.h>
main(){
int decimal, octal, aux, c,d,u;
scanf("%d",&octal);
if(octal<=777&&octal>0){
c = octal/100;
aux = octal%100;
d= aux/10;
u = aux%10;
decimal = (c*(8*8))+(d*8)+(u*1);
printf("%d",decimal);
}else{
printf("numero fora do intervalo");
}
}
| ALGO | 0.996152 | 3.505981 |
38fe270f-945f-450c-bb31-6e18d5a8c0cc | thanhqng1510/Algorithm | BinPackingProblem.cpp | #include <iostream>
using namespace std;
int NextFit(int* weight, int n, int bin_capacity) {
int num_bin = 1, cur_bin_capacity = bin_capacity;
for (int i = 0; i < n; ++i) {
if (weight[i] > cur_bin_capacity) {
++num_bin;
cur_bin_capacity = bin_capacity - weight[i];
}... | ALGO | 0.999928 | 6.135996 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.