uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
c651d2d7-7441-4b92-b044-9e20c5e002da | DreamingCats/Solutions_of_Algorithm_Notes | 第06章 C++标准模板库(STL)介绍/6.7 stack的常见用法详解/stack-pop.cpp | #include <stack>
#include <iostream>
using namespace std;
int main(){
stack<int> s;
int n,k,a,i;
cin>>n>>k;
if(n==k){
cout<<"empty stack";
}
else{
for(i=0;i<n;i++){
cin>>a;
s.push(a);
}
for(i=0;i<k;i++){
s.pop();
}
cout<<s.top();
}
return 0;
}
| ALGO | 0.999392 | 3.32731 |
5692eb6a-6850-42dd-8525-3fcac4bb04a1 | CaHHaL/DSAwithCPP | Day268_Form the Largest Number.cpp | // Given an array of integers arr[] representing non-negative integers, arrange them so that after concatenating all of them in order, it results in the largest possible number. Since the result may be very large, return it as a string.
// Examples:
// Input: arr[] = [3, 30, 34, 5, 9]
// Output: 9534330
// Explanatio... | ALGO | 0.999953 | 6.360322 |
aae9f279-a95f-4f6c-971f-0aa647b2fe89 | atef7534/codeforces1000 | #643 Tokitsukaze and Enhancement/solve.cpp | /**
* author: atef_ai
* created: 24 Jul
*/
#include <iostream>
int main(void)
{
int n;
std::cin >> n;
if (n % 4 == 2) {
std::cout << 1 << " B\n";
}
else {
if (n % 4 == 0) {
std::cout << 1;
} else if (n % 4 == 1) {
std::cout << 0;
} else if (n % 4 == 3) {
std::cout << 2;
... | ALGO | 0.999882 | 3.682802 |
f995e9ae-9c26-413a-98a5-f54ec2041b97 | ishandutta2007/codeforces | yamunaku/normal/1136/B.cpp | #include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define SP <<" "<<
#define MOD 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
typedef long long LL;
typedef long double LD;
int main(){
int n,k;
cin >> n >> k;
cout << n+1+min(n-k,k-1)+n-1+n << endl;
retur... | ALGO | 0.999938 | 3.092009 |
19ffe76a-3f03-45c2-9242-3cbf5c141c0c | ahmedalashii/to_do_hive | 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 |
6fd3b4bd-073f-4288-9136-421fcc35b912 | christophers090/learningC | moc interviews/interview2/bitwise_operations_tutorial.cpp | // ==========================================================================
// bitwise_operations_tutorial.cpp - Understanding Bit Manipulation in C++
// ==========================================================================
#include <iostream>
#include <cstdint> // For fixed-width types like uint8_t
#include <i... | TOOL | 0.951603 | 7.539092 |
2a42106c-086b-4dd5-9ac9-4b9a3e7d3c48 | Daniel-Alvarez-Sil/Competitive_Programming | Concepts/Dynamic Programming/Algoritmia_ArrayLands_Challenge.cpp | #include <bits/stdc++.h>
using namespace std;
void resolver(int n, vector<int>& array, vector<pair<int,int>>& queries){
int dp[n][n];
for (int f = 0; f < n; f++){
for (int j = f + 1; j < n; j++){
dp[f][j] = abs(array[f] - array[j]);
}
}
for (int f = 2; f < n; f++){
... | ALGO | 0.999969 | 5.070636 |
8789e26b-98a4-4716-8115-290c7a489e31 | AshvinBa/CPP_Programs-2 | Questions/print_the_numbers_or_Even_or_Odd.cpp | #include<iostream>
using namespace std;
int main(){
int n,m;
cout<<"\nEnter the numbers: ";
cin>>n>>m;
for(int i=n;i<=m;i++)
{
if(i==1)
{
cout<<"\nOne.";
}
else if(i==2)
{
cout<<"\nTwo.";
}
else if(i==3)
{
... | ALGO | 0.999787 | 3.333862 |
4a26f4ff-38c2-4658-8702-96f5cf1d2724 | manikanta2901/ubuntu | .history/codingChallenges/cpp/Codechef/longChallenges/Year2021/January/FairElections_20210101172229.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.999998 | 3.180226 |
ace735f0-45ad-4e6d-ae41-dabdd05fee59 | E3SM-Project/E3SM | components/homme/src/share/cxx/GllFvRemapImpl.cpp | #include "GllFvRemapImpl.hpp"
#ifdef MODEL_THETA_L
// GllFvRemap can't run with preqx_kokkos because preqx_kokkos does not provide
// EquationOfState or ElementOps. But we need this to build for use in the
// eam-hommexx test.
# include "EquationOfState.hpp"
# include "ElementOps.hpp"
#endif
namespace Homme {
typedef... | ALGO | 0.974112 | 3.877175 |
29293abc-3ea2-4560-b9f9-e16a7bfc794b | atharv-bhadange/LeetCode | 0295-find-median-from-data-stream/0295-find-median-from-data-stream.cpp | class MedianFinder {
public:
priority_queue<int> decre;
priority_queue<int, vector<int>, greater<int>> incre;
bool even = true;
MedianFinder() {
}
void addNum(int num) {
even = !even;
if(!even) {
decre.push(num);
incre.push(decre.top());
d... | ALGO | 0.999974 | 6.082663 |
f60d5621-3fe1-404a-914a-b9afc1b1b462 | sanketdisale871/DSA | 3344-minimize-manhattan-distances/minimize-manhattan-distances.cpp | class Solution {
public:
typedef int ll;
int minimumDistance(vector<vector<int>>& a) {
ll n = a.size();
multiset<ll>st;
multiset<ll>st2;
for(auto it:a){
st.insert(it[0]+it[1]);
st2.insert(it[0]-it[1]);
}
ll ans = INT_MAX;
// for... | ALGO | 0.999988 | 5.295968 |
0a451118-49cf-4729-8f86-6d2f118740aa | gcjjyy/acmicpc | 2742.cpp | #include <stdio.h>
int main() {
int N;
scanf("%d", &N);
for(int i = N; i >= 1; --i) printf("%d\n", i);
return 0;
} | ALGO | 0.998475 | 3.894036 |
3714944d-bc9b-4229-8236-2cb0ea56152d | Forte-NaoP/Problem-Solving | 프로그래머스/2/389480. 완전범죄/완전범죄.cpp | #include <string>
#include <vector>
using namespace std;
bool dp[41][121][121];
int solution(vector<vector<int>> info, int n, int m) {
dp[0][0][0] = true;
for (int i = 0; i < info.size(); ++i) {
for (int j = 0; j <= n; ++j) {
for (int k = 0; k <= m; ++k) {
if (dp[i][j... | ALGO | 0.999969 | 5.882942 |
fa37308a-a5c4-40d9-b77e-1721008bb2e4 | oxygen-hunter/Flashboom | data/big-vul-100/add_attention_code/MixtralExpert/top0-100/recover-the-original-array-Solution.recoverArray/177852_DoS_Overflow.cpp | parse_object(JsonLexContext *lex, JsonSemAction *sem)
{
/*
* an object is a possibly empty sequence of object fields, separated by
* commas and surrounded by curly braces.
*/
json_struct_action ostart = sem->object_start;
json_struct_action oend = sem->object_end;
JsonTokenType tok;
if (ostart != ... | ALGO | 0.961117 | 5.310272 |
25f94de9-cd4d-494f-90a0-71aafc62fab8 | 20km-shimakaze/SthCode | code/codeforce/R/#801(div2)/C.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define int long long
int n,m;
int s[1003][1003];
int ma[1003][1003],mi[1003][1003];
void solve()
{
cin>>n>>m;
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
cin>>s[i][j];
}
}
for(int ... | ALGO | 0.999651 | 3.915416 |
cac0ad23-bc4e-4185-9024-b7e2cfbff60a | lssfau/walberla | src/mesa_pd/domain/BlockForestDomain.cpp | #include "BlockForestDomain.h"
#include <core/debug/CheckFunctions.h>
#include <core/math/AABB.h>
#include <core/mpi/MPIManager.h>
namespace walberla {
namespace mesa_pd {
namespace domain {
/// \post neighborSubdomains_ is sorted by rank
BlockForestDomain::BlockForestDomain(const std::shared_ptr<blockforest::BlockF... | ALGO | 0.998586 | 6.180201 |
3243478a-8e3c-4f97-a18e-7a2928be721a | Safiullah2000/TranslatorApp | 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 |
a12dc6d8-6902-4eb2-aa9a-97bafb85ee0e | ffallrain/lammps_waterbox | src/compute_orientorder_atom.cpp | /* ----------------------------------------------------------------------
Contributing author: Aidan Thompson (SNL)
Axel Kohlmeyer (Temple U)
------------------------------------------------------------------------- */
#include <string.h>
#include <stdlib.h>
#include "compute_orientorder_a... | ALGO | 0.999705 | 5.934433 |
11d8566c-e928-4936-b7d4-23139eedecca | nvbangg/CodePTIT | DSA/DSA10004_DuongDiVaChuTrinhEulerVoiDoThiVoHuong.cpp | #include <bits/stdc++.h>
using namespace std;
#define endl '\n'
int V, E, u, v;
vector<vector<int>> G;
void testCase()
{
cin >> V >> E;
G.clear();
G.resize(V + 1);
while (E--)
{
cin >> u >> v;
G[u].push_back(v);
G[v].push_back(u);
}
int odd_deg = 0;
for (int i =... | ALGO | 0.999657 | 5.266795 |
c3004064-ab6e-4461-8eff-5f371f49362e | protik0939/codeforces_problemset | 1000 Ratings/A_Free_Cash.cpp | /*
________________________________________________________________
.......
....... ...
.. .......... .
. . .
. .. ,*.////.
. .... ..****
,*,** //,,.***
*,,,,..,,.,*
,....... | ALGO | 0.999281 | 4.332348 |
bcfe5571-e1e2-487b-ac4a-2f465840fc99 | cirquity/cirquity | src/miner/Miner.cpp | //////////////////
#include "Miner.h"
//////////////////
#include <common/CheckDifficulty.h>
#include <common/StringTools.h>
#include <crypto/crypto.h>
#include <crypto/random.h>
#include <iostream>
#include <miner/BlockUtilities.h>
#include <system/InterruptedException.h>
#include <utilities/ColouredMsg.h>
namespace... | ALGO | 0.997643 | 6.654727 |
c4142e14-3381-42c8-a4e3-c93f46b5f044 | j129008/leetcode | cpp/two_sum.cpp | #include<iostream>
#include<vector>
#include<map>
using namespace std;
class Solution {
public:
// Bruce Force
vector<int> twoSumBF(vector<int>& nums, int target) {
for(int i=0; i<nums.size(); i++)
for(int j=i+1; j<nums.size(); j++)
if( (nums[i]+nums[... | ALGO | 0.999538 | 5.447162 |
59709d3c-280f-4841-9738-39c69c582ac5 | SecurityQQ/CPlusPlus_MIPT_Algorithms | HashTable/MIPT_TASK_3_2/MIPT_TASK_3_2/main.cpp | #include <iostream>
typedef long long ll;
ll getNumbersOfPartitions(int n, int t);
int main(int argc, const char * argv[]) {
int n;
scanf("%d", &n);
printf("%lld", getNumbersOfPartitions(n, n));
return 0;
}
ll getNumbersOfPartitions(int n, int t) {
ll numbersOfPartitions[n + 1][t + 1];
for( ... | ALGO | 0.999971 | 4.943258 |
53b293bd-ba35-4837-8ea3-1fd55c2fe24c | Scethsy/gpp_samples | CompProg/CompProg2/T2Array.cpp | #include <iostream>
using namespace std;
void InputValidation(int *x) {
while (!(cin >> *x)) {
cout << "Error! Invalid Input, Please enter a valid integer number" << endl;
cin.clear();
cin.ignore(1214, '\n');
}
}
int findnum (int nums[], int x, int y) {
int ans = 0;
for(int i = 0; i < x;... | ALGO | 0.993089 | 3.993267 |
a039f45f-ea34-461b-897b-731902f5da09 | ishandutta2007/codeforces | lzr_010506/normal/812/A.cpp | #include <bits/stdc++.h>
using namespace std;
int a[5][5];
int main()
{
for(int i = 1; i <= 4; i ++)
for(int j = 1; j <= 4; j ++)
cin >> a[i][j];
for(int i = 1; i <= 4; i ++)
{
if(a[i][4] == 0) continue;
for(int j = 1; j <= 3; j ++) if(a[i][j]) {cout << "YES"; return 0;}
int k = i + 1;
if(k > 4) k -= 4... | ALGO | 0.999849 | 3.281878 |
bbcfcbf5-4f34-4fe9-8071-82eda34b052f | CJSBinder-User/CJSBinder | experiment/correctness_efficiency/groundtruth/cpp/EQUILIBRIUM_INDEX_OF_AN_ARRAY_1.cpp | #include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <fstream>
#include <iomanip>
#include <bits/stdc++.h>
using namespace std;
int f_gold ( int arr [ ], int n ) {
int sum = 0;
int leftsum = 0;
for ( int i = 0;
i < n;
++ i ) sum += arr [ i ];
for ( int i = 0;
i < n;
++ i )... | ALGO | 0.999693 | 5.644315 |
5ab77cc0-17c9-44d5-b52e-5ee2e55a65af | Charleyhoo/C-basic-plus | basic/Fabonacci Optimize/O(N^2).cpp | #include <iostream>
#include <algorithm>
using namespace std;
int main()
{
long aFunc(int n){
if (n <= 1) return 1;
else return aFunc(n - 1) + aFunc(n - 2);
}
} | ALGO | 0.999752 | 4.021491 |
9700d4f6-845c-4017-9cf9-0490547f5061 | Saikat-too/Competitive_Programming_Grinding | Codeforces/RandomPractice/2014c.cpp | #include "bits/stdc++.h"
#include <vector>
using namespace std;
#define ll long long
void solve() {
ll n;
cin >> n;
vector<ll> a(n);
ll half = n / 2;
ll sum = 0;
for (int i = 0; i < n; i++) {
cin >> a[i];
sum += a[i];
}
sort(a.begin(), a.end());
if (n == 1 || n == 2) {
cout << -1 << '\n'... | ALGO | 0.999678 | 5.086084 |
9e3971b1-1412-4c2a-8f13-81c2a25bab9e | DevJaiswal79/DataStructureLab | Lab02/Lab2_Q1.cpp | // 1. WAP to generate a Fibonacci series up to n terms.
// Input Input number of terms: 10
// Output Fibonacci series: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34
#include <iostream>
using namespace std;
void fibonacciSeries(int x)
{
int a = 0;
int b = 1;
int c;
cout << a << " " << b << " ";
while (x--)
{... | ALGO | 0.999075 | 3.943661 |
153e758f-4f8d-4967-8eec-4e7820a9a610 | Soham-Chaudhuri/My-CPP-practice | 1692D.cpp | #include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long double ld;
typedef long long int lli;
typedef pair<int, int> pii;
typedef vector<vector<lli>> vvlli;
typedef vector<lli> vlli;
typedef vector<ull> vull;
typedef pair<lli, lli> plli;
#define max3(a,b,c) max(max((a),(b)),(c))
#defin... | ALGO | 0.999738 | 4.538922 |
7b28e6c0-9392-403e-9048-6efe6fc3db0a | nandini-mp/LeetCode | 504-base-7/base-7.cpp | class Solution {
public:
string convertToBase7(int num) {
if (num==0) return "0";
string result;
string sign="-";
int yes=0;
if (num<0)
yes=1;
num=abs(num);
while (num!=0)
{
int digit=num%7;
result.insert(0,to_string... | ALGO | 0.999799 | 5.480469 |
912553ec-86e3-4da2-9c42-60d01a3fce83 | herjmoo/research | tools/pin-2.13-62732-gcc.4.4.7-linux/source/tools/CacheClient/br_test.cpp | //
// ORIGINAL_AUTHOR: Ady Tal
//
// This tool test the big-region binary. We know that the region
// is about > 1000 instructions. Since we want to create a region
// larger than 64K, we create inlined analysis routine larger
// than 50 bytes for each instructions.
// Use fat instcoun.
// Sample usage:
// ... | ALGO | 0.851639 | 7.186532 |
4bc7199e-15d2-4bbd-93ab-c950bc7139eb | Lowhuhn/LaserControl | LaserCamera/LaserCameraCSaC.CLib/fcd_3.cpp | #include <ios>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <queue>
#define uchar unsigned char
struct MyPoint{
int X;
int Y;
};
struct MyPoint2{
int X;
int Y;
double Val;
//MyPoint2(int x, int y, NUM val) : X(x), Y(y), Val(val) {}
bool operator < (const MyPoint2& other) const{
return V... | TOOL | 0.944868 | 3.275266 |
bc720da6-1fdd-4013-b079-397a12a6e2c9 | MaYatao/studydemo | OpenJDK12/src/java.base/share/native/libjimage/imageDecompressor.cpp | #include "jni.h"
#include "imageDecompressor.hpp"
#include "endian.hpp"
#ifdef WIN32
#include <windows.h>
#else
#include <dlfcn.h>
#endif
typedef jboolean (JNICALL *ZipInflateFully_t)(void *inBuf, jlong inLen,
void *outBuf, jlong outLen, char **pmsg);
static ZipInflateFull... | TOOL | 0.900087 | 4.426089 |
161a4398-e1f8-4687-9e2d-f16bdb1deb10 | ViralChauhan54467/meetwebapp.github.io | 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 |
9128bb87-370d-4158-8677-2e81f2d0b6ab | essenius/EllipseFit | src/MathUtils.cpp | #include "MathUtils.h"
namespace EllipseMath {
bool isAboutEqual(const double& a, const double& b, const double& epsilon) {
return fabs(a - b) <= epsilon;
}
double sqr(const double& a) {
return a * a;
}
int modulo(const int a, const int b) {
return (b + a % b) % b;
}
double sign(const double& a) {
i... | TOOL | 0.984038 | 6.614275 |
61cbf54c-37df-4481-a5a9-035cc95e3eb3 | MdRafidulIslam/xpsc-week1 | 166 Practise/costly_permution.cpp | #ifndef ONLINE_JUDGE
#else
#define dbg(...)
#endif
#include <bits/stdc++.h>
#define int long long
#define ll long long
#define pii pair<ll, ll>
#define yes cout << "YES" << endl
#define no cout << "NO" << endl
#define cyes cout << "Yes" << endl
#define cno cout << "No" << endl
#define minus cout << -1 << endl
#define ... | ALGO | 0.999878 | 4.64708 |
65edcf7d-59da-4899-8a36-93e1f513ac62 | moonbuck/EssentiaSwift | CommonSource/C++/algorithms/rhythm/loopbpmestimator.cpp | #include "loopbpmestimator.h"
#include "essentiamath.h"
using namespace std;
namespace essentia {
namespace standard {
const char* LoopBpmEstimator::name = "LoopBpmEstimator";
const char* LoopBpmEstimator::category = "Rhythm";
const char* LoopBpmEstimator::description = DOC("This algorithm estimates the BPM of audio ... | ALGO | 0.997304 | 7.047924 |
def0c8af-e17f-4935-a2f8-5555f40cc072 | redjasm/FYS3150 | project4/src/PhaseTrans.cpp | #include "IsingModel.hpp"
#include <omp.h>
#include <fstream>
#include <iomanip>
#include <vector>
#include <string>
#include <chrono>
// Helper function for linearly spaced temperatures
std::vector<double> linspace(double start, double end, int num)
{
std::vector<double> result(num);
double step = (end - star... | TOOL | 0.992483 | 6.415094 |
a28ba91c-2b26-4bd1-b2b9-22f84cad115b | rds1983/SealangSharp | llvm/lib/CodeGen/InlineSpiller.cpp | #include "LiveRangeCalc.h"
#include "Spiller.h"
#include "SplitKit.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/MapVector.h"
#include "llvm/ADT/None.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.... | TOOL | 0.957212 | 5.394826 |
eb67732e-e685-47f3-a42d-e6639435854a | Ereh11/CompetitiveProgramming | Binary Search and Two Pointers/Aggressive cows.cpp | #include <bits/stdc++.h>
#define ll long long
#define FastIO ios_base::sync_with_stdio(NULL); cin.tie(0); cout.tie(0);
using namespace std;
bool Can(int val, int k, vector<int>& v)
{
int cnt = 1, pref = v[0];
for (int i = 1; i < v.size(); i++)
if (v[i] - pref >= val) cnt++, pref = v[i];
return cnt... | ALGO | 0.999982 | 4.212806 |
1f6cb311-42c0-4052-abd8-f5e19df4cb1a | ChuangRoy/RoyChuangs-Code | Algo/ISCOJ/4445.cpp | #include <bits/stdc++.h>
using namespace std;
int main () {
ios_base::sync_with_stdio(false);
cin.tie(0);
unsigned int a, b;
cin >> a >> b;
cout << a + b << endl;
return 0;
} | ALGO | 0.996782 | 3.836817 |
695783c0-13a1-461f-833b-44979d8ebe22 | FeiSun/Inside-Out | PhraseRep/main.cpp | //g++ main.cpp PhraseRep.cpp -op2v -I/usr/local/include/eigen/ -std=c++11 -O3 -march=native -funroll-loops -lm -fopenmp
#include "PhraseRep.h"
void help()
{
cout << "Phrase vector estimation toolkit v 0.6" << endl << endl;
cout << "Options:" << endl;
cout << "Parameters for training:" << endl;
cout << "\t-train <... | TOOL | 0.863793 | 6.077919 |
4ee56ca6-e31f-4e84-b07e-b5e14b1ac33c | Mrsandman327/windows-book-code-c- | Professional C++, 3rd Edition/c17_code/Lambdas/callback.cpp | #include <vector>
#include <iostream>
#include <functional>
#include <algorithm>
using namespace std;
void testCallback(const vector<int>& vec, const function<bool(int)>& callback)
{
// Using range-based for loop
for (const auto& i : vec) {
// Call callback. If it returns false, stop iteration.
... | ALGO | 0.998308 | 5.880938 |
fb9ad66e-7f60-418a-95f3-d54d18c4b3cd | ranaaalihaider/C_plus_plus | Code With Harry/tut7_3.cpp | #include<iostream>
using namespace std;
float x=455;
//Now we willl use refrence variable its mean that one variable will use value of other variable
float & y=x;
//Now y is a variable that is usisng value of x now thses are same
int main(){
cout<<x<<endl<<endl;
cout<<y;
return 0;
} | ALGO | 0.970604 | 3.316101 |
4a9031eb-e131-4864-887b-b34a51d3acfd | hasatsrnkn/Bilkent-CS201-202 | CS-202/Homework 2/BSTNode.cpp | /**
* Title : Binary Search Trees
* Author : Mehmet Hasat Serinkan
* ID: 21901649
* Section : 1
* Assignment : 2
* Description : BSTNode.cpp
*/
#include <iostream>
using namespace std;
class BSTNode {
public:
BSTNode();
BSTNode( const int& item, BSTNode* left = NULL, BSTNode* right = NULL);
private:
int ... | ALGO | 0.999583 | 3.58792 |
0a3c693f-5072-4fe5-b024-270b2ef09db5 | danieltrt/SBFL | benchmarks/python/COUNTS_PATHS_POINT_REACH_ORIGIN_1.cpp | #include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <fstream>
#include <iomanip>
#include <cstdlib>
#include <string>
#include <vector>
#include <queue>
#include <fstream>
#include <iomanip>
#include <vector>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#incl... | ALGO | 0.999918 | 5.697689 |
9987f605-edbf-4d45-a2db-7410730d3ef6 | YLXS19/algorithm_template | 哈夫曼编码.cpp | //哈夫曼编码
#include<bits/stdc++.h>
using namespace std;
string str;
int n[27],l,aws,a,b;
int main(){
int i;
while(cin>>str){
if(str=="END")return 0;
memset(n,0,sizeof(n));
l=str.size();
for(i=0;i<l;i++){
if(str[i]=='_')n[26]++;
else n[str[i]-'A']++;
}
priority_queue<int,vector<int>,greater<int>>q;
aw... | ALGO | 0.99908 | 3.120785 |
03f4e7f8-8037-43ac-a3b1-dc88973da8f5 | lorryaze/EDA--Projeto2 | random.cpp | #include <stdio.h>
#include <stdlib.h>
#include<time.h>
int main (void){
int array[13];
int i;
srand(time(0));
for ( i = 0; i < 13; i++) { // fill array
array[i] = i;
printf("%d,", array[i]);
}
printf("\n done with population \n");
printf("here is the final array\n");
for ( i = 0; i < 13; i++) { //... | ALGO | 0.993788 | 3.809353 |
6016dd40-3511-49f4-b9ce-db089c0f3baf | qh4869/GOBANG2019 | src/cAI.cpp | #include "cRole.h"
cAI::cAI()
{
int i, j;
for (i = 0; i<15; i++)
for (j = 0; j<15; j++)
{
PlayerChart[i][j] = 0;
AIChart[i][j] = 0;
}
}
void cAI::AIAlgorithm(cBoard oBoard, int PlayerColor, int type)
{
int ColorNow;
if (PlayerColor == BLACK && type == PLAYER || PlayerColor == WHITE && type == AI)//ͱ
... | ALGO | 0.99281 | 3.205231 |
3b263a50-d478-4d61-8265-fd780756d336 | xu582/Note | CS/C++/Dev-C++/ExerciseBook/05.17/05.17.cpp | #include <stdio.h>
#include <stdlib.h> // ṩ systemrandsrand ԭ
#include <time.h> // ṩ time ԭ
#include "SqList.h" //**02 Ա**//
// ݹֵ
int Algo_5_17_1(SqList L, int len);
// ݹСֵ
int Algo_5_17_2(SqList L, int len);
// ݹ
int Algo_5_17_3(SqList L, int len);
// ݹ
double Algo_5_17_4(SqList L, int len);
// ݹƽ
... | ALGO | 0.999501 | 3.19919 |
7a567bfb-2837-45eb-b19f-2417ecedbcd0 | Souvik5051/C-Programming | Recursion.cpp/Find-maximum-number.cpp | #include <iostream>
#include<limits.h>
using namespace std;
void maximumNumber(int arr[],int n,int i,int& max){
//Base Condition
if(i>=n){
return;
}
if(arr[i]>max){
max=arr[i];
}
maximumNumber(arr,n,i+1,max);
}
int main(){
int arr[]={23,34,12,56,66};
int n=5... | ALGO | 0.9999 | 4.60179 |
74667afb-05d7-42bb-b1b4-9bf0260fcbdb | TTstacks/Tetris | Tetris/Tetris.cpp | #include "Tetris.h"
#include <algorithm>
#include <iostream>
Tetris::Tetris()
: dX(0), delta(0.4f), dropDistance(kArrH - 1)
{
srand(static_cast<unsigned int>(time(nullptr)));
window.create({ kScreenW * 2, kScreenH }, "Tetris");
window.setFramerateLimit(60);
InitNextTetromino();
Init();
Update();
}
bool Tetris:... | ALGO | 0.886693 | 6.329235 |
c80ec19a-d16a-4063-ae4f-fabb17a39281 | lazzerialberto/sim_numerica | lezione_7/NSL_SIMULATOR/SOURCE/random.cpp | /****************************************************************
*****************************************************************
_/ _/ _/_/_/ _/ Numerical Simulation Laboratory
_/_/ _/ _/ _/ Physics Department
_/ _/_/ _/ _/ Universita' degli Studi di Milano
_/ _/ ... | TOOL | 0.987599 | 3.159069 |
77a52962-8356-4867-95ae-f8995ab9db6c | hey-its-ashu/c-and-cpp | 30DaysOfHackerRank/18.cpp | #include <iostream>
using namespace std;
class Solution
{
string stack = "";
string queue = "";
//Write your code here
public:
void pushCharacter(char ch)
{
stack = stack + ch;
}
void enqueueCharacter(char ch)
{
queue = ch + queue;
... | ALGO | 0.999984 | 5.667754 |
06985804-6e26-4a30-ad35-f9ffbe80779c | youxiao/yxbase | buildtools/third_party/libc++/trunk/test/std/algorithms/alg.nonmodifying/alg.count/count.pass.cpp | // <algorithm>
// template<InputIterator Iter, class T>
// requires HasEqualTo<Iter::value_type, T>
// Iter::difference_type
// count(Iter first, Iter last, const T& value);
#include <algorithm>
#include <cassert>
#include "test_iterators.h"
int main()
{
int ia[] = {0, 1, 2, 2, 0, 1, 2, 3};
const unsi... | TEST | 0.954531 | 6.016634 |
aebc930c-ee51-489a-b8fc-d0136371954e | beet-aizu/library | combinatorics/surjection.cpp | #ifndef call_from_test
#include <bits/stdc++.h>
using namespace std;
#define call_from_test
#include "enumeration.cpp"
#undef call_from_test
#endif
//BEGIN CUT HERE
// put n distinct balls into k distinct boxes
template<typename M>
M surjection(int n,int k){
using E = Enumeration<M>;
E::init(k);
M res(0);
for... | ALGO | 0.999638 | 4.015152 |
013bffe8-4a06-4889-8ae8-bfc5698aeee4 | ShubhamPokhariyal/cpp_questions | cpp_questions/Attribute_Parser.cpp | #include<iostream>
#include<vector>
#include<string>
using namespace std;
bool checkTag(string n,int j){
if(n[j]=='t'){
if(n[j+1]=='a'){
if(n[j+2]=='g'){
return true;
}
}
}
return false;
}
int main(){
int n,q,tagn=0;
string input;
cin >>... | ALGO | 0.988913 | 3.166925 |
a1277bb0-9189-4a1b-8cb6-bdf1833f3ef3 | sarvex/leetcode-io | solution/0800-0899/0850.Rectangle Area II/Solution.cpp | class Node {
public:
int l, r, cnt, length;
};
class SegmentTree {
public:
vector<Node*> tr;
vector<int> nums;
SegmentTree(vector<int>& nums) {
this->nums = nums;
int n = nums.size() - 1;
tr.resize(n << 2);
for (int i = 0; i < tr.size(); ++i) tr[i] = new Node();
... | ALGO | 0.999971 | 5.988089 |
63776c58-1234-461f-9248-3cb4ac0470c0 | FMI-IP-2024-2025/ip-kn1-group3-practicum-2024-2025 | week_06/solutions/ex5.cpp | #include <iostream>
unsigned int const ALPHA_SIZE = 26;
bool areAnagrams(char const* s1, char const* s2) {
//тук броят на срещанията има значение, така че няма
//как хистограмата да е булев масив
unsigned int hist1[ALPHA_SIZE] {}, hist2[ALPHA_SIZE] {};
while (*s1) {
if (*s1 >= 'a' && *s1 <= 'z')
... | ALGO | 0.999862 | 4.616794 |
ca02d44a-c116-4248-87bd-9f1fdd359282 | joydip007x/CompetitiveCodeArchive | UVA/524/17005772_PE_0ms_0kB.cpp | ///*/////////////////// /// *
/*// author-joydip007x /// *
/ */// <^> <^ <^> <^> /// *
///*<^> Never tired :)<^>:V*///
//*/*** Never Give UP ***///
/// Date<^>XX/08/2018 *///
#include<bits/stdc++.h>
using namespace std;
#define loop(i,L,U) for(long long int i=(long long int)L;i<U;i++)
#define l... | ALGO | 0.999585 | 4.069665 |
79f463a2-9249-4965-9ea4-4d6c3d77f39a | juarezpaulino/coderemite | problemsets/UVA/12085.cpp | /**
*
* Author: Juarez Paulino(coderemite)
* Email: <EMAIL>
*
*/
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
void print(int a, int b) {
if (a == b) { cout << "0" << to_string(a) << endl; return; }
string A = to_string(a), B = to_string(b), c = "";
int k; while (A[k] == B[k]) k++;
... | ALGO | 0.999141 | 3.649569 |
f8301396-fdbc-4ac8-ada4-77bb9a790b5b | i-pu/riscv-llvm-target | llvm-project/libc/src/math/nearbyintl.cpp | #include "src/math/nearbyintl.h"
#include "src/__support/common.h"
#include "utils/FPUtil/NearestIntegerOperations.h"
namespace __llvm_libc {
LLVM_LIBC_FUNCTION(long double, nearbyintl, (long double x)) {
return fputil::roundUsingCurrentRoundingMode(x);
}
} // namespace __llvm_libc
| TOOL | 0.965739 | 5.754161 |
eedd6a09-ae0e-4c7a-bd0d-26dc94adbf64 | xingjinglu/ParaFinder | utils/TableGen/DAGISelEmitter.cpp | #include "CodeGenDAGPatterns.h"
#include "DAGISelMatcher.h"
#include "llvm/Support/Debug.h"
#include "llvm/TableGen/Record.h"
#include "llvm/TableGen/TableGenBackend.h"
using namespace llvm;
namespace {
/// DAGISelEmitter - The top-level class which coordinates construction
/// and emission of the instruction selector... | TOOL | 0.949505 | 7.682724 |
34c1ca49-a352-43d4-a183-e83c0bcdb164 | DominicS99/Competitive-Programming | Kattis/ghostleg.cpp | #include <iostream>
#include <vector>
using namespace std;
int main() {
int n, m, a;
cin >> n >> m;
vector<int> d(n+1);
for (int i = 1; i <= n; i++) d[i] = i;
while (m--) {
cin >> a;
swap(d[a], d[a+1]);
}
for (int i = 1; i <= n; i++) {
cout << d[i] << endl;
}
return 0;
}
| ALGO | 0.999996 | 4.08621 |
8a4d8ad9-73e2-4699-9c15-f8a7477b174e | libretro/neocd_libretro | src/libretro_bios.cpp | #include <lists/dir_list.h>
#include <string>
#include <vector>
#include "archive.h"
#include "bios.h"
#include "libretro_bios.h"
#include "libretro_common.h"
#include "libretro_log.h"
#include "memory.h"
#include "neogeocd.h"
#include "path.h"
#include "stringlist.h"
// Load each file from the list and test for vali... | TOOL | 0.866088 | 6.442762 |
81a530bc-97f5-4c1c-87b4-77f95a88581f | squaresLab/BatFix | results/transcoder/python/semantics/FIND_A_TRIPLET_THAT_SUM_TO_A_GIVEN_VALUE_2.cpp | #include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <fstream>
#include <iomanip>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <numeric>
#include <algorithm>
using namespace std;
bool f_gold ( int A [ ], int arr_size, int sum )... | ALGO | 0.998258 | 5.122494 |
818488a4-7179-49d5-8b56-cad563222388 | madhav-bits/Coding_Practice | leetRepeatedSubstrPattern.cpp | /*
*
//**********************************************************459. Repeated Substring Pattern.***************************************************
Given a non-empty string check if it can be constructed by taking a substring of it and appending multiple copies of the substring together. You
may assume the given str... | ALGO | 0.998797 | 6.716473 |
7bdbd285-1973-4279-8f1b-5ac28dd4aef4 | rajuahmed118124r/XCPSC | Binary_Search/lower_bound_with_BS.cpp | ///BISMILLAHIR RAHMANIR RAHIM
///============================
#include<bits/stdc++.h>
using namespace std;
#define Raju ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long... | ALGO | 0.99997 | 5.16953 |
94dcc9c2-afae-4e48-9b41-1d0366bf2124 | kcalbCube/PVC-16 | include/boost_1_78_0/libs/spirit/example/x3/calc/calc8/vm.cpp | #include "vm.hpp"
namespace client
{
void vmachine::execute(std::vector<int> const& code)
{
auto pc = code.begin();
auto locals = stack.begin();
stack_ptr = stack.begin();
while (pc != code.end())
{
switch (*pc++)
{
case op_neg:
... | ALGO | 0.888561 | 5.281187 |
00a878d8-f989-4a0a-ae6f-800837a8b702 | blaiman89/OpenSees-2.4.0-Modified | SRC/element/forceBeamColumn/HingeRadauTwoBeamIntegration.cpp | // $Revision: 1.5 $
// $Date: 2008-12-03 23:43:16 $
// $Source: /usr/local/cvs/OpenSees/SRC/element/forceBeamColumn/HingeRadauTwoBeamIntegration.cpp,v $
/*
* Reference
Scott, M. H. and G. L. Fenves. "Plastic Hinge Integration Methods for
Force-Based Beam-Column Elements." Journal of Structural Engineering,
132(2):24... | ALGO | 0.993686 | 6.364949 |
026425bb-9426-4682-b76e-3c392bb2be33 | COP3530/Programming-Problems | Shorts/Graphs/bellmanfored/test-unit/test.cpp | #include "../src/bellmanfored.h"
#define CATCH_CONFIG_MAIN
#include "catch.hpp"
/*
To check output (At the sortable directory):
g++ -std=c++14 -Werror -Wuninitialized -o test test-unit/test.cpp && ./test
*/
TEST_CASE("Function: graph 1", "[given]") {
vector<vector<pair<int, int>>> graph = ... | TEST | 0.991092 | 6.263192 |
a1145020-3b01-4bfa-99f6-a372698fa3b2 | anoop-2205/C-Basics-and-DSA | array/maxmimunandminimumarray.cpp | /*--------print the maximum and minimum value of an array! -------------------*/
#include<iostream>
using namespace std;
int getMax(int num[],int n){
int max = INT8_MIN;
for(int i=0;i<n;i++){
if(num[i]>max){
max=num[i];
}
}
return max;
}
int getMin(int num[],int n){
i... | ALGO | 0.999433 | 4.224767 |
3ea55561-b8c4-45ad-9525-814498c73391 | Manish-kasera/DSACPPLearnin-Coding-Ninja- | Trees/vectorUse.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
// declaring a vector
vector <int> v;
// taking input in a vector
for(int i=0;i < 5;i++)
{
int x ;
cin >> x;
v.push_back(x);
}
// printing the vector
for(auto x : v)
{
cout << x <<" " ;
}
cout << endl;
for(int i=0;i < v.size()... | ALGO | 0.998719 | 3.360606 |
e44e591a-b0c3-4909-85ff-ac4e12c67300 | manikanta2901/ubuntu | .history/imp/cpp/DataStructures/trees/creatingTree_20200623164847.cpp | #include<bits/stdc++.h>
using namespace std;
struct Node{
int data;
Node* left;
Node* right;
};
Node* newNode(int a){
Node* node = new Node();
node->data = a;
node->left = NULL;
node->right = NULL;
return node;
}
Node* insertLevelOrder(vector<int> arr,Node* root,int i){
if(i < arr... | ALGO | 0.999931 | 4.879134 |
3394f36b-ac52-495d-bea0-811842665db2 | devgoel186/Leetcode-Solutions | n-th-tribonacci-number/Accepted/9-8-2021, 9_45_02 PM/Solution.cpp | // https://leetcode.com/problems/n-th-tribonacci-number
class Solution {
public:
int tribonacci(int n) {
long long a = 0;
long long b = 1;
long long c = 1;
long long d = 0;
while(n--)
{
d = (a + b + c);
a = b;
b = c;
... | ALGO | 0.999983 | 6.372753 |
8eb636c4-67fc-4930-83a6-9096380c2032 | dndkwk/CPP_programming | ch5/5_prac_5.cpp | #include <iostream>
using namespace std;
class Circle {
int radius;
public:
Circle(int r) { radius = r; }
int getRadius() { return radius; }
void setRadius(int r) { radius = r; }
void show() { cout << " " << radius << " " << endl; }
};
void increaseBy(Circle& a, Circle& b) {
int r = a.getRadius() + b.getRadius(... | ALGO | 0.972282 | 5.065362 |
11a73f03-5f39-496e-8979-7b6c97039bf7 | leetmdgus/JongManBook | src/7. divide_and_conquer/7.1_fastSum/main.cpp | #include <iostream>
using namespace std;
int fastSum(int n ) {
// 기저 사례
if(n == 1) return 1;
if(n % 2 == 1) return fastSum(n-1) + n;
return 2*fastSum(n/2) + (n/2)*(n/2);
}
int main(void) {
cout << fastSum(10);
} | ALGO | 0.999765 | 4.506926 |
d67ed763-4de9-48d8-9a0d-185106165712 | draconewman/OOP-assignments | Ans/Assignment 6 ans/rough/6.1.cpp | #include <iostream>
#include <fstream>
using namespace std;
class book
{
char author[100],publisher[100],title[100];
int bookid;
int Copy;
float price;
public:
book(int x)
{
bookid=x;
}
book()
{
cout<<"Enter title:";cin>>title;
cout<<"Enter author:";cin>>auth... | TOOL | 0.933346 | 5.440955 |
2cd02325-7c9e-41be-b020-76a284c018c4 | tuananh2807/BTL-CTDL-GT-LE_TUAN_ANH | CODE_CTDL/Chuong_ 3_DEQUY/Fibonacy.cpp | #include <iostream>
using namespace std;
//Ham de quy tinh Fibonaci
int fibonacci(int n) {
if (n == 0)
return 0;
else if (n == 1)
return 1;
else
return fibonacci(n - 1) + fibonacci(n - 2);
}
int main() {
int n;
cout << "Nhap n: ";
cin >> n;
cout << "So Fib... | ALGO | 0.99903 | 3.796135 |
e242f996-53d0-4afa-aa1b-fd644c46c3e5 | octupole/openTRJ | Saxs/RhoSaxsBSP.cpp | /*
* RhoSaxsBSP.cpp
*
* Created on: Aug 19, 2015
* Author: marchi
*/
#include "RhoSaxsBSP.h"
void RhoSaxsBSP::__Density(const int pq,const AtomsD * y, vector<size_t> & ind, string myType
,vector<double> & wei){
Type=myType;
AtomsD x{*y};
int order=BSpline::Order();
int nx0=static_cast<int>(nnx);
in... | ALGO | 0.963326 | 3.375031 |
8803399b-28a6-47aa-9a26-3ea06be0efbd | SEOICodeGroup/LYY | VIRTUALJUDGE/POJ/3264/BASIC.cpp | #include <iostream>
#include <algorithm>
#include <string>
#include <iomanip>
#include <cstdio>
using namespace std;
typedef pair<int,int> P;
const int MAXN = 200005, INF = 99999999;
int N,n,Q; P dat[2 * MAXN - 1];
void init(int n_)
{
n = 1 ;
while(n < n_) n <<= 1 ;
for(int i = 0; i < 2 * n - 1 ; i++)
{... | ALGO | 0.999878 | 4.04607 |
47043831-e9ba-44e9-8d81-320e776699bc | sarahp31/Graph_MaxClique_Optimizer | AbordagemExaustiva/abordagem_exaustiva.cpp | #include <iostream>
#include <fstream>
#include <vector>
#include <chrono>
using namespace std;
// Função para verificar se um subconjunto de vértices forma um clique
bool is_clique(const vector<vector<bool>>& graph, const vector<int>& vertices) {
// Iterar sobre todos os pares de vértices do subconjunto
for... | ALGO | 0.999608 | 6.55944 |
6af0d2e0-7bb4-4894-914d-9f0c151ef946 | H-Shen/MyCodeCollection | 校招Collection/Others/程序员代码面试指南/转圈打印矩阵.cpp | // https://www.nowcoder.com/practice/8ae3701849ae450dac56ad2b704fa57d
#include <bits/stdc++.h>
using namespace std;
vector<int> printMatrix(vector<vector<int> > mat) {
vector<int> result;
int n = static_cast<int>(mat.size());
if (n == 0) {
return result;
}
int m = static_cast<int>(mat[0... | ALGO | 0.99998 | 3.949667 |
684da1fe-7a61-480c-a6d6-051bdb00871d | ChenMiaohong/Smart-Gateway-Design | jsoncpp/src/lib_json/json_writer.cpp | #if !defined(JSON_IS_AMALGAMATION)
#include "json_tool.h"
#include <json/writer.h>
#endif // if !defined(JSON_IS_AMALGAMATION)
#include <cassert>
#include <cstring>
#include <iomanip>
#include <memory>
#include <set>
#include <sstream>
#include <utility>
#if __cplusplus >= 201103L
#include <cmath>
#include <cstdio>
#... | TOOL | 0.864179 | 7.281776 |
7e7efe0e-0f16-4d16-8f27-21f4d08bc1dd | TranTrungTruc99/demo | bai42.cpp | #include <iostream>
using namespace std;
int main()
{
int n,i,s,x;
cout << "nhap n: ";
cin >> n;
s = 0;
for ( i = 1; i < n / 2; i++)
{
if ((s + i) < n)
{
s = s + i;
}
else
{
break;
}
}
x = i - 1;
cout ... | ALGO | 0.999712 | 3.134542 |
cf3299d0-b26b-4fb5-b323-5b3be414e670 | Tushar-Thorat-2001/DSA | recursion/subset.cpp | // find the poweset or subset of the given string abc
#include<iostream>
using namespace std;
void ps(string str,int index,string output){
if(index == str.length()){
cout<<output<<endl;
return ;
}
char ch = str[index];
// exclude
ps(str,index+1,output);
// include
output.pus... | ALGO | 0.999924 | 4.328203 |
3fdfe70f-46ca-46f2-9247-7ca88d4187f9 | hanjaeng/Backup1st | flutter_getx/material_desigen_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.998677 | 6.772262 |
192d81c3-b586-4737-ad45-83af2f2de9b8 | QuantuM1o1/TicTacToe | Grid.cpp | #include <iostream>
#include <iomanip>
#include "Grid.h"
Grid::Grid()
{
dimension = 1;
}
void Grid::setDimension(int x)
{
dimension = x;
createVector();
}
int Grid::getDimension()
{
return dimension;
}
void Grid::createVector()
{
int ... | TOOL | 0.971135 | 4.471013 |
2af0ff4a-1fa9-4c27-9664-b0873534426a | showmanlee/HowCanISolveThisQuestion | BOJ/21000/21665.cpp | // Миша и негатив
// https://www.acmicpc.net/problem/21665
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(void) {
cin.tie(NULL);
ios_base::sync_with_stdio(false);
int n, m;
cin >> n >> m;
vector<vector<char>> board(n, vector<char>(m));
for (int i = 0; i < n... | ALGO | 0.999929 | 5.075742 |
5fd6cd93-dd3e-4987-ab61-ed87776468b1 | 3000ye/MacOS-ACM | LeetCode/100.相同的树.cpp | #include <bits/stdc++.h>
using namespace std;
/*
* @lc app=leetcode.cn id=100 lang=cpp
*
* [100] 相同的树
*/
// @lc code=start
struct TreeNode {
int val;
TreeNode *left;
TreeNode *right;
TreeNode() : val(0), left(nullptr), right(nullptr) {}
TreeNode(int x) : val(x), left(nullptr), right(nullptr) {... | ALGO | 0.99998 | 6.882634 |
c8ba2fc3-bcc3-499f-97c9-048c7c80f981 | tem-mahadi/Solution-to-Problems | minimumQueries.cpp | #include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;
class SparseTable {
vector<vector<int> > st;
vector<int> log_table;
int n;
public:
SparseTable(const vector<int>& arr) {
n = arr.size();
int max_log = log2(n) + 1;
st.assign(n, vect... | ALGO | 0.999995 | 6.709719 |
7bfdb340-0b1b-4a09-bff9-80f368257e93 | Xdydy/OJCode | codeforces/比赛题解/Educational Codeforces Round 128 (Rated for Div. 2)/c.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define maxn (int)(1e6 + 10)
#define IOS ios::sync_with_stdio(0);
#define FFF freopen("out", "w", stdout);
int n;
string s;
int ans[maxn];
int pre1[maxn], pre0[maxn];
int suf1[maxn], suf0[maxn];
bool check(int mid) {
bool flag = 0;
for ( int i... | ALGO | 0.999981 | 4.141388 |
85e11b46-8fab-4a27-a069-537c12586b7c | zhangchunbao515/leetcode | leetcode-08/LC283.cpp | class Solution {
public:
void moveZeroes(vector<int>& nums) {
int fast = 0;
int slow = 0;
while (fast < nums.size()) {
if (nums[fast] != 0) {
nums[slow++] = nums[fast++];
}
else
fast++;
}
while (slow < nums.size())
nums[slow++] = 0;
}
}; | ALGO | 0.999969 | 6.244815 |
844f2a56-9e05-46ea-a190-091d48de2abb | sjtao98/Leetcode_backup_2 | 1165-single-row-keyboard/1165-single-row-keyboard.cpp | class Solution {
public:
int calculateTime(string keyboard, string word) {
vector<int> mp(26, -1);
for(int i = 0; i < keyboard.length(); ++i){
mp[keyboard[i]-'a'] = i;
}
int dis = 0;
int i = 0, j = 0;
for(char s : word){
j = mp[s-'a']... | ALGO | 0.999961 | 5.878823 |
1a55d76b-ff1d-4b79-b13f-5461a3decef7 | blankanano/projeto_lista_de_tarefas | 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 |
69f75e2e-0b68-498f-ad94-bdf982ef5e60 | sairudraksh/DSA | 1114-binary-search-tree-to-greater-sum-tree/binary-search-tree-to-greater-sum-tree.cpp | class Solution {
public:
void find(TreeNode* root,int &sum){
if(root==NULL) return;
find(root->right,sum);
sum+=root->val;
root->val=sum;
find(root->left,sum);
}
TreeNode* bstToGst(TreeNode* root) {
int sum=0;
find(root,sum);
return root;
... | ALGO | 0.999911 | 4.855067 |
3edb11ee-106c-494d-bbed-3b0471c7a282 | Roger-luo/MAGMA | src/zgetf2_nopiv.cpp | /*
-- MAGMA (version 2.0) --
Univ. of Tennessee, Knoxville
Univ. of California, Berkeley
Univ. of Colorado, Denver
@date
@precisions normal z -> s d c
*/
#include "magma_internal.h"
/***************************************************************************//**
Purpose
... | ALGO | 0.999277 | 6.099735 |
8c543ea1-03bd-42dc-b0d4-b75108fb3ad8 | sonalisingh18/Algorithms_and_Problems | Graphs/DFS/PT07Z.cpp | /*
Sonali Singh
Question link: https://www.spoj.com/problems/PT07Z/
*/
#include <bits/stdc++.h>
using namespace std;
#define MAX 100009
bool check[MAX]={false};
int total=0;
int dfs(vector<int> v[],int root)
{
int m,m1=-1,m2=-1;
check[root]=1;
for(int i=0;i<v[root].size();i++)
{
if(!check[v[r... | ALGO | 0.998299 | 4.151982 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.