uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
494030c4-3e99-4c91-b93b-dc9b538559a8 | chenhuanguang/leetCode-nowCoder | LeetCode/数组/只出现一次的数字.cpp | class Solution {
public:
int singleNumber(vector<int>& nums) {
int res = 0;
for (const auto& e : nums)
{
res ^= e;
}
return res;
}
}; | ALGO | 0.999948 | 5.804219 |
d85a7ccf-a339-44cc-adaf-0e75649978ee | sabboshachi/DSA_ProblemSolves | Problem Solving/01. Programing Contest DataStructure and Algorithm [Book]/Chapter_2 (C Review)/Exercise2.11.cpp | // Given a coordinate, you have to tell which quadrant it is in.
#include<iostream>
#include<cmath>
#include<string.h>
using namespace std;
int main(){
int x,y;
cout << "Enter the coordinate of the point: " << endl;
cin >> x;
cin >> y;
if(x>0 && y>0){
cout << "The point is in First Qua... | ALGO | 0.998846 | 4.358274 |
0003fa75-f42a-4dbe-af51-15d91dedbde4 | NotImplemented/prewritten_algorithms | strings/knuth-morris-pratt.cpp | vector<int> prefix(const std::string& sample)
{
vector<int> result(sample.size() + 1);
int i = 0;
int j = result[0] = -1;
while (i < sample.size())
{
while (j > -1 && sample[i] != sample[j])
j = result[j];
i++;
j++;
if (sample[i] == sample[j])
... | ALGO | 0.999525 | 5.454621 |
cae60382-f23d-46f3-81f6-8d7a7f20fc83 | me-heer/Algorithm-Implementations | Insertion Sort/main.cpp | #include <iostream>
using namespace std;
void insertion_sort(int *);
int main()
{
int a[5];
cout << "Enter 5 elements: " << endl;
for(int i=0;i<5;i++)
{
cout << i << ": ";
cin >> a[i];
}
insertion_sort(&a[0]);
for(int i=0;i<5;i++)
{
cout << a[i] <<endl;
}
}... | ALGO | 0.99992 | 3.956205 |
dcd5b480-5926-4195-b3e2-1b9a0a2bef6c | jordirocha/FIB | PRO1_2025_PRIMAVERA/Vectors/inversio_de_sequencies.cpp |
#include <iostream>
#include <vector>
using namespace std;
int main()
{
int a;
while (cin >> a)
{
vector<int> elements(a);
for (int i = 0; i < a; i++)
cin >> elements[i];
if (a == 1)
cout << elements[0] << endl;
else
{
for (int i... | ALGO | 0.99982 | 3.775536 |
16c9dca4-c01b-4d40-8d6c-b240c6b0bacb | apple-pie-h/Cpp | Programiz Cpp Challenges/Level: Very Easy/is a multiple of ten.cpp | string isMultipleOfTen(int num) {
if(num%10==0)
return "Yes";
else
return "No";
}
| ALGO | 0.976031 | 3.380139 |
bebf5c1a-44ee-4ef6-8ad4-78585a595a35 | escudero89/pdifich | CImg-1.5.4/examples/mcf_levelsets3d.cpp | #include "CImg.h"
using namespace cimg_library;
#undef min
#undef max
// Apply the Mean curvature flow PDE
//-----------------------------------
template<typename T> CImg<T>& mcf_PDE(CImg<T>& img, const unsigned int nb_iterations,
const float dt=0.25f, const float narrow=4.0f) {
... | ALGO | 0.999735 | 6.04529 |
9f0708ae-b1d5-4ef1-8332-25aff96395a7 | yhmun/OpenKODE-Framework | 01_Develop/libXMGraphics/Source/FTGLES/FTContour.cpp | #include "FTContour.h"
static const unsigned int BEZIER_STEPS = 5;
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
void FTContour::AddPoint(FTPoint point)
{
if(pointList.empty() || (point != pointList[pointList.size() - 1]
&& point != pointList[0]))
{
point... | ALGO | 0.98603 | 6.389245 |
1afc3f0b-30ce-4d7f-8c8d-118fc0abbfee | EltajGafarli/LeetCode | leetcode442.cpp | class Solution {
public:
vector<int> findDuplicates(vector<int>& nums) {
vector<int>result;
for(int i = 0;i<nums.size();i++){
int n = abs(nums[i]);
if(nums[n - 1] < 0){
result.push_back(n);
}else{
nums[n - 1] *= -1;
}
}
return result;
}... | ALGO | 0.999987 | 5.750343 |
59fda11d-c233-4b60-8b2b-e99a6f521cae | Jackarain/boost | libs/math/src/tr1/ellint_3l.cpp | extern "C" long double BOOST_MATH_TR1_DECL boost_ellint_3l BOOST_PREVENT_MACRO_SUBSTITUTION(long double k, long double nu, long double phi) BOOST_MATH_C99_THROW_SPEC
{
return c_policies::ellint_3 BOOST_PREVENT_MACRO_SUBSTITUTION(k, nu, phi);
}
| TOOL | 0.894661 | 3.602596 |
e6d143b5-61fc-4ecd-b8bc-9d7cc76c9f9d | ddupg/ACM_Code | HDU/5301.cpp | #include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;
int n, m, x, y;
int main()
{
while(cin>>n>>m>>x>>y)
{
if(n>m)swap(n, m), swap(x, y);
int ans=(min(n, m)+1)/2;
int l=y, r=m-y+1, u=x-1, d=n-x;
if(min(l, r)>ans && x-1!=n-x)
... | ALGO | 0.999831 | 3.222045 |
7de84094-759d-435f-b1f9-6c55b8dc03d5 | sunnnyy04/competitive_programming | C_Stable_Groups.cpp | #include <bits/stdc++.h>
using namespace std;
//--------------------------------------------------------------//
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<long long> vl;
typedef vector<vector<long long> > vvl;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<char> vc;
t... | ALGO | 0.999944 | 3.201488 |
df8658e2-d77b-4779-a337-46bb58e948ae | Volvram/labs | Intoduction to programming/L.14/Percents.cpp | #include<iostream>
using namespace std;
int main(){
float p, k=0, s=1000;
cin >> p;
p=p/100;
while(s<=1100){
s=s+s*p;
k++;
}
cout << "Months:" << k << " " << "Sum:" << s;
return 0;
}
| ALGO | 0.997256 | 3.327643 |
5dc74588-4427-42c6-ae8b-fb70589d839d | SA-K1B/Problem-Solving | Categorically/math/cf1303b.cpp | #include<bits/stdc++.h>
#define ll long long int
#define db double
#define pb push_back
#define mp make_pair
#define Max 10000000000000000
#define Min -10000000000000000
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) (a * (b / gcd(a, b)))
using namespace std;
ll M=1000000007;
ll mod(ll x){
return ((x%M + M)%M)... | ALGO | 0.999755 | 3.532333 |
65ee198b-cca6-4fd0-bd26-64c5f785984d | lc-3-2/llvm | llvm/lib/CodeGen/RegAllocScore.cpp | #include "RegAllocScore.h"
#include "llvm/ADT/DenseMapInfo.h"
#include "llvm/ADT/ilist_iterator.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/MachineBlockFrequencyInfo.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/MachineInstrBundleIte... | ALGO | 0.937877 | 6.594407 |
517a4002-b95b-43a5-8402-7a446a53c1ef | Masters-Akt/CS_codes | leetcode_sol/890-Find_And_Replace_Pattern.cpp | //Method 1
class Solution {
public:
vector<string> findAndReplacePattern(vector<string>& words, string pattern) {
vector<string> ans;
for(int i=0;i<words.size();i++){
if(pattern.size()==words[i].size()){
bool check = true;
for(int j=0;j<pattern.size()-1;j+... | ALGO | 0.99992 | 6.431071 |
b86fa11e-17af-44c0-bd33-de615f2d3615 | JhosefRea/epn-introduction-C- | Práctica4/Ejer9.cpp | #include <iostream>
using namespace std;
int pedirDato();
int main(){
int x;
float factorial = 1;
x = pedirDato();
for(int i = x; i >=1 ; i--){
factorial *= i;
}
cout << "El factorial de: " << x << " es: " << factorial << endl;
return 0;
}
int pedirDato(){
int num;
do... | ALGO | 0.998133 | 3.394758 |
8cbf9153-965f-4cb6-837b-a1dc80b66e1e | ishandutta2007/codeforces | phirasit/normal/443/B.cpp | #include <stdio.h>
#include <string.h>
char str[310];
int k;
int main() {
scanf("%s%d", str, &k);
int l = strlen(str);
int mx = 0;
for(int i = 1;2*i <= l+k;i++) {
for(int p = 0;p+2*i <= l+k;p++) {
bool err = false;
for(int j = p;j < p+i;j++) {
if(j+i < l && str[j] != str[j+i]) {
err = true;
}... | ALGO | 0.999929 | 3.262365 |
91ef1afd-6bff-4f80-9092-dbe41092b102 | ishandutta2007/codeforces | newbiewzs/normal/1490/E.cpp | #include<bits/stdc++.h>
#define int long long
using namespace std;
inline int read(){
char c=getchar();int s=0;while(c<'0' or c>'9')c=getchar();
while(c>='0' and c<='9')s=s*10+c-'0',c=getchar();return s;
}
const int N=2e5+55;
int T,n;
int s[N],da[N];
struct node{
int val,id;
}a[N];
int cmp(node x,node y){
return x.... | ALGO | 0.999981 | 3.72763 |
1a78c01a-34d8-45e3-90c7-e9cf0b4082d6 | Hardrocker17Ashok/Data-Structure-algorithms | array/matrix_multi.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
// your code goes here
int t;
cin>>t;
while(t--){
int num;cin>>num;
string s;cin>>s;
int length=s.size();
int c1=0;
if(length<4){
cout<<"yes"<<endl;
}
else{
for(int i=0;i<4;i++){
if(s[i]=... | ALGO | 0.999704 | 4.811083 |
ea6e5109-8fa8-4415-8583-ff10c86ed035 | tanasinp/2110327-ALGORITHM-DESIGN | grader/ex07m1_knapsack/main.cpp | #include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
using namespace std;
int n;
double W;
double v[101],w[101];
double ans = 0;
int sol[101];
vector<pair<double,pair<double,double>>> r;
bool customComparator(const pair<double, pair<double, double>>& a, const pair<double, pair<double, double>>& b) {
... | ALGO | 0.999862 | 4.128615 |
41625a32-0f2d-467b-aec0-daa92de4fb19 | aanupam29/codeforces-problems | 499C - Crazy Town.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
ll x1, y1;
cin>>x1>>y1;
ll x2, y2;
cin>>x2>>y2;
int n;
cin>>n;
int ans = 0;
for (int i = 0; i < n; i++)
{
ll a, b, c;
cin>>a>>b>>c;
ll res1 = a*x1 + b*y1 + c;
ll res2 = a*x2 + b*y2 + c;
if (res1/abs(res1) != res2/abs(r... | ALGO | 0.999809 | 3.947853 |
00a5d243-5454-4560-a4b1-279c63a2eac8 | sailfishos-mirror/llvm-project | libcxx/test/std/numerics/rand/rand.dist/rand.dist.samp/rand.dist.samp.plinear/eval_param.pass.cpp | // <random>
// template<class RealType = double>
// class piecewise_linear_distribution
// template<class _URNG> result_type operator()(_URNG& g, const param_type& parm);
#include <algorithm> // for sort
#include <cassert>
#include <cmath>
#include <cstddef>
#include <limits>
#include <random>
#include <vector>
#... | TEST | 0.992061 | 4.725524 |
bd5e2485-7dd4-48d6-9113-0180a4796f61 | aujasvit/competitive-programming | Miscellanous/minimizing_coins.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define mp make_pair
#define pii pair<int, int>
#define fr first
#define sc second
#define all(a) a.begin(),a.end()
signed main() {
ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
int n, x;
cin >> n >> x;
vecto... | ALGO | 0.999989 | 4.366106 |
98762c40-68f3-4267-ab68-f16e26ea1570 | gihop/AlgorithmStudy | Retry/Retry/타겟_넘버.cpp | #include <string>
#include <vector>
using namespace std;
int answer = 0;
void dfs(vector<int> numbers, int target, int idx, int now){
if(idx == numbers.size()){
if(now == target) answer++;
return;
}
dfs(numbers, target, idx+1, now+numbers[idx]);
dfs(numbers, target, idx+1, now-numbers[... | ALGO | 0.999945 | 5.498408 |
89e27b80-408d-4b68-a641-996d8b7a2cd2 | joker-eph/llvm-project-with-mlir | libcxx/test/std/utilities/template.bitset/bitset.members/op_and_eq.pass.cpp | // test bitset<N>& operator&=(const bitset<N>& rhs);
#include <bitset>
#include <cstdlib>
#include <cassert>
#include "test_macros.h"
#if defined(TEST_COMPILER_CLANG)
#pragma clang diagnostic ignored "-Wtautological-compare"
#elif defined(TEST_COMPILER_C1XX)
#pragma warning(disable: 6294) // Ill-defined for-loop: i... | TEST | 0.994127 | 7.741803 |
4c6b3c9f-a1a6-42ce-a831-d622902cd440 | bawejagb/LeetCode_Solutions | 0237-delete-node-in-a-linked-list/0237-delete-node-in-a-linked-list.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
void deleteNode(ListNode* node) {
node->val = node->next->val;
node->next = node->next->next;
}
}; | ALGO | 0.999717 | 5.612188 |
fae33128-78ef-4f05-931f-f3dfe2ec3739 | himel5113/Problem_solving- | 758A.Holiday Of Equality.cpp | #include <bits/stdc++.h>
#define ll long long
#define ld long double
#define endl '\n'
#define allV(V) (V).begin(), (V).end()
#define allA(arr, size) arr, arr+size
#define sortV(V) sort(allV(V))
#define revV(V) reverse(allV(V))
#define sortA(arr, size) sort(allA(arr, size))
#define revA(arr, size) reverse(allA(arr, siz... | ALGO | 0.999946 | 4.126697 |
a61cc6a7-874d-4ad1-a5be-cc3671b0dc3e | KangInyeong/codetree-TILs | 240123/특정 조건의 온전수 구하기/print-onjeonsu.cpp | #include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
for(int i=1; i<=n; i++){
if(i % 2 == 0)
continue;
if(i % 10 == 5)
continue;
if(i % 3 == 0 && i % 9 != 0)
continue;
cout << i << " ";
}
return 0;
} | ALGO | 0.999714 | 3.262965 |
0282f40b-2d2b-4557-bf43-9bdb3e3a35be | SaurabPoudel/Cpp-learning | Basic C++/pattern19.cpp | #include <iostream>
using namespace std;
/*
for n = 4
1
121
12321
1234321
*/
int main(){
int n;
cout <<"Enter a number : "<<endl;
cin >>n;
for(int i=1;i<=n;i++){
//print 1st triangle
for(int x = 1;x<=(n-i);x++){
cout << " ";
}
// print 2nd triangle
... | ALGO | 0.999873 | 4.218265 |
a5ed0243-235a-4dd8-9b42-fc5c5702797a | yqtaowhu/programming | leetcode/pascalTriangle/pascalTriangle.II.cpp | // Date : 2016.08.05
// Author : yqtao
// https://github.com/yqtaowhu
/**********************************************************************************
*
* Given an index k, return the kth row of the Pascal's triangle.
*
* For example, given k = 3,
* Return [1,3,3,1].
*
* Note:
* Could you optimize your algori... | ALGO | 0.999853 | 6.154841 |
6ae4aa61-ae2e-4ee1-af00-a69a5a9a93eb | JaroslavUrbann/Pommerman | agents/eisenach/pommerman_cpp/src/agents/simple_agent.cpp | #include "bboard.hpp"
#include "agents.hpp"
#include "strategy.hpp"
#include "step_utility.hpp"
using namespace bboard;
using namespace bboard::strategy;
namespace agents
{
bool _CheckPos(const State& state, int x, int y)
{
return !util::IsOutOfBounds(x, y) && IS_WALKABLE(state.board[y][x]);
}
SimpleAgent::Simp... | ALGO | 0.993442 | 4.846405 |
a9d7506a-e634-44cd-982f-819a6d80a472 | Um-ded/problem-solving | Codeforces Codes/199.Prob1006C(Three Parts of the Array).cpp | ///*/////////////////////////////*///
/// IN THE NAME OF ALMIGHTY ALLAH ///
///*/////////////////////////////*///
///*////////////////////*///
/// Author : SAIFULLAH29 ///
///*////////////////////*///
///*//////////////////////////////////////////*///
/// "When you want something, all the universe ///
/// conspires ... | ALGO | 0.999976 | 5.243066 |
d191a6d1-add5-49a7-8264-56785dc22e6d | josephxiao8/USACO | 2019-2020/Silver/Feb/clocktree.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned int ui;
typedef unsigned long ul;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typ... | ALGO | 0.999848 | 3.970302 |
2190fcf9-cec9-4f6a-9d8f-220452f663ca | AkshayKohad/Leetcode-Problems | Graphs/Is Graph Bipartite?.cpp | class Solution {
public:
bool dfs(vector<vector<int>>& graph,int src,int parent,vector<int>&visited,int color)
{
visited[src]=color;
for(auto x : graph[src])
{
if(visited[x]==0)
{
bool res = dfs(graph,x,src,visited,3-color);
if... | ALGO | 0.999933 | 6.159322 |
b74ae654-2687-453e-998a-87ecee3ca1a9 | veblen34/DL_final | Decompose_retrieval/Dessert-main-v4/deps/eigen/blas/double.cpp | #define SCALAR double
#define SCALAR_SUFFIX d
#define SCALAR_SUFFIX_UP "D"
#define ISCOMPLEX 0
#include "level1_impl.h"
#include "level1_real_impl.h"
#include "level2_impl.h"
#include "level2_real_impl.h"
#include "level3_impl.h"
double BLASFUNC(dsdot)(int* n, float* x, int* incx, float* y, int* incy)
{
... | ALGO | 0.998401 | 5.081567 |
a6c02429-dbfa-49d2-af41-c34de9799979 | jota-atn/StructComparisons | C/tests/arraylist/test_get_element_meio.cpp | #include <iostream>
#include <fstream>
#include <vector>
#include <chrono>
#include <random>
#include "../../include/cpp/array_list.hpp"
#include "../../include/cpp/output.hpp"
using namespace std;
using namespace chrono;
auto test_get_meio(ArrayList& array_list, int n) {
auto inicio = high_resolution_clock::now... | ALGO | 0.899511 | 5.202018 |
f43f3ccd-608b-46d1-b7e2-a370c948abbd | bachtran02/comp-prog | atCoder/old/C_Kaprekar_Number.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(false);
int n, k;
cin >> n >> k;
int f;
f = n;
while(k--){
string curr = to_string(f);
priority_queue<char> descending;
for(char c: curr){
descending.push(c);
}
int... | ALGO | 0.999954 | 3.854016 |
44c22729-470c-4e27-911b-0a85f50dbb82 | ishandutta2007/codeforces | 777777777plus/normal/1262/F2.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 2e5+5;
const ll mod = 998244353;
int n,k,a[N];
ll ans;
ll fac[N],rev[N];
ll qpow(ll a,ll b){
ll r=1;
while(b){
if(b&1)r=r*a%mod;
b>>=1;a=a*a%mod;
}
return r;
}
void prepare(){
int i;
for(i=fac[0]=1;i<N;++i)fac[i]=fac[i-1]*i%m... | ALGO | 0.999974 | 4.313056 |
965b0867-25f5-4608-9f0c-534c6fc904ef | alex8937/Leetcode | 101. Symmetric Tree.cpp |
Definition for a binary tree node.
struct TreeNode {
int val;
TreeNode left;
TreeNode right;
TreeNode(int x) val(x), left(NULL), right(NULL) {}
};
class Solution {
public
bool isSymmetric(TreeNode root) {
if(!root) return true;
return isSymmetric(root - right, root ... | ALGO | 0.999961 | 6.439474 |
53c49ad7-1551-4877-b838-bc36d8e88640 | chvj7567/algorithm | sort/quick_sort.cpp | #include <iostream>
using std::cout;
using std::endl;
#define SWAP(X, Y, T) ((T)=(X), (X)=(Y), (Y)=(T))
void quick_sort(int arr[], int left, int right) {
if (left >= right) {
return;
}
int i = left + 1, j = right, tmp;
while (i <= j) {
while (arr[i] <= arr[left] && i <= right) {
i++;
}
while (arr[j]... | ALGO | 0.999982 | 5.272292 |
d26a788d-6c25-45fe-a9eb-23839cdda619 | QbitQuantum/Basics | Исходники/kigpainter.cpp | void KigPainter::drawCurve( const CurveImp* curve )
{
// we manage our own overlay
bool tNeedOverlay = mNeedOverlay;
mNeedOverlay = false;
QPen pen = mP.pen();
// this stack contains pairs of Coordinates ( parameter intervals )
// that we still need to process:
std::stack<workitem> worksta... | ALGO | 0.99233 | 4.949006 |
0edf0fab-f110-4381-b78d-6254c5cf694a | ishandutta2007/codeforces | greymanesilverfang/normal/1132/C.cpp | #include <algorithm>
#include <iostream>
const int N = 5005;
int n, q, l[N], r[N], f[N], len[N];
struct TQuery {
int l, r, id;
TQuery(int _l = 0, int _r = 0, int _id = 0) : l(_l), r(_r), id(_id) {}
} lq[N], rq[N];
int solve(int id)
{
int res = 0, cur = 0;
for (int i = 1; i <= n; ++i)
res += !!(cur += f[i]);
for... | ALGO | 0.999852 | 4.094101 |
6af320f2-93f7-4ed6-ab10-cc0bd7fc0304 | MandarinIndia/CSESProblemSet | IntroductoryProblems/creatingString.cpp | #include<bits/stdc++.h>
using namespace std;
template <typename A> ostream& operator<< (ostream &cout, vector<A> const &v) {cout << '['; for(int i = 0; i < v.size(); i++) {if (i) cout << ','; cout << v[i];} return cout << ']';}
template <typename A> istream& operator>> (istream& cin, vector<A> &x){for(int i = 0; i < x... | ALGO | 0.999967 | 4.597346 |
38338590-9908-40c7-b818-583d634c4d59 | Gaurav0807/Data_Structure | Array/Linear_Search.cpp | #include<bits/stdc++.h>
using namespace std;
#Complexicity :- O(n)
int main()
{
int arr[]={1,2,3,4,5,6,7,8,9,10};
int n=sizeof(arr)/sizeof(arr[0]);
int n1=9,mid=0,i;
for(i=0;i<n;i++)
{
if(arr[i]==n1)
{
mid=i;
break;
}
}
cout<<"Element"<<n1<<"Found at"<<i<<endl;
}
| ALGO | 0.999194 | 4.077765 |
c3618430-441c-4faa-a4a0-5bcb7474e1f4 | qnx-ports/eigen | bench/benchmarkX.cpp | // g++ -fopenmp -I .. -O3 -DNDEBUG -finline-limit=1000 benchmarkX.cpp -o b && time ./b
#include <iostream>
#include <Eigen/Core>
using namespace std;
using namespace Eigen;
#ifndef MATTYPE
#define MATTYPE MatrixXLd
#endif
#ifndef MATSIZE
#define MATSIZE 400
#endif
#ifndef REPEAT
#define REPEAT 100
#endif
int mai... | ALGO | 0.962677 | 3.365346 |
61ae8121-b777-4474-838d-a3635a0413f9 | raincross7/code-similarity | codes/train_code/problem183/problem183_5.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
const ll mod = 1000000007;
int inv(int n){
if(n == 1)return 1;
return (mod - mod/n)*1LL*inv(mod%n)%mod;
}
int main(){
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
cout<<se... | ALGO | 0.999978 | 4.817455 |
d7c38906-fe90-409f-a606-fe91ba992953 | Susovan88/DSA | Queue/ReverseLastKthElementsfromqueue.cpp | #include <iostream>
#include <queue>
#include <stack>
using namespace std;
void displayQueue(queue<int> &qu){
cout<<" =>> ";
for(int i=0;i<qu.size();i++){
int a=qu.front();
qu.pop();
cout<<a<<" ";
qu.push(a);
}
cout<<endl;
}
void reverseLastKthElements(queue<int>&qu,in... | ALGO | 0.998963 | 4.336263 |
7c508a44-14cd-4953-8f94-bbacbb739f30 | luckcul/LeetCode | algorithms/Delete Node in a BST/Delete Node in a BST.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
TreeNode* deleteNode(TreeNode* root, int key) {
if(!root) return NULL;
if(root... | ALGO | 1 | 6.468809 |
03a982c5-ad57-4a2f-9df3-597186fadcc3 | JacopoMereu/GAS2021-TrapezoidalMap | GAS_2122_TrapezoidalMaps/cg3lib/cg3/utilities/map.cpp | /*
* This file is part of cg3lib: https://github.com/cg3hci/cg3lib
* This Source Code Form is subject to the terms of the GNU GPL 3.0
*
* @author Alessandro Muntoni (<EMAIL>)
*/
#include "map.h"
#include <algorithm>
namespace cg3 {
/**
* @ingroup cg3core
* @brief this function flips a std::map on a std::multi... | TOOL | 0.97799 | 4.613916 |
63509091-eec6-4955-99ad-1b6bb7a8a2ae | Valet78/skillbox | 1-10/4 Construction of the if condition/4.2_z3/main.cpp | /*
Задача 3. Модуль числа.
Напишите программу, которая вычисляет модуль числа.
Подсказка: чтобы обратить знак числа в переменной ‘x’ надо писать вот так: x = - x.
*/
#include <iostream>
int main() {
int inNum = 0;
std::cout << "Для определения модуля целого числа" << std::endl;
std::cout << "укажите его: ";
... | ALGO | 0.999046 | 4.426695 |
afe33023-a358-4f89-84d5-0b3c4acd4dc7 | felrock/projectEuler | problem21.cpp | #include <iostream>
int properDivisorsSum(int number)
{
int sum = 0;
for (int i=1; i < number; ++i)
{
if (number % i == 0)
{
sum += i;
}
}
return sum;
}
bool isAmicable(int number)
{
int sum_a = properDivisorsSum(number);
int sum_b = properDivisorsSum(sum_a);
return number == sum_b &... | ALGO | 0.99961 | 5.881005 |
e3cd44db-700f-4a37-afcf-ff8a259b2b73 | ProdriveTechnologies/pd_cpu_compiler | libcxx/test/std/algorithms/alg.modifying.operations/alg.unique/unique_copy_pred.pass.cpp | // <algorithm>
// template<InputIterator InIter, class OutIter,
// EquivalenceRelation<auto, InIter::value_type> Pred>
// requires OutputIterator<OutIter, RvalueOf<InIter::value_type>::type>
// && HasAssign<InIter::value_type, InIter::reference>
// && Constructible<InIter::value_type, InIter... | TEST | 0.979793 | 6.314727 |
40b79a7d-77ff-45ed-8234-fd7a2979588c | vachsargsyaan/Cpp_Modules | Module08/ex01/Span.cpp | #include "Span.hpp"
Span::Span()
{
this->N = 0;
}
Span::Span(unsigned int N)
{
this->N = N;
}
Span::Span(const Span &other)
{
this->N = other.N;
this->arr = other.arr;
}
Span::~Span()
{}
Span& Span::operator =(const Span &other)
{
if (this != &other)
{
this->N = other.N;
this->arr = other.arr;
}
retur... | ALGO | 0.972283 | 4.678909 |
751819a4-f74d-4bf8-8f9e-23d7ee2f7b03 | joopixel1/CSES | GFG/Array Algo/greedy/connect_n_ropes_with_min_cost.cpp | #include <iostream>
#include <set>
using namespace std;
using ll = long long;
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
ll n, t;
cin >> n;
multiset<ll> s;
for(ll i=0; i<n; i++){
cin >> t;
s.insert(t);
}
ll cost = 0;
while(s.size() > 1){
ll a = *s.be... | ALGO | 0.999955 | 4.392449 |
90e56b29-1262-430b-8615-716ffd6144e6 | liang-man/oceanbase | src/sql/engine/expr/ob_expr_prior.cpp | #define USING_LOG_PREFIX SQL_ENG
#include "sql/engine/expr/ob_expr_prior.h"
#include "share/object/ob_obj_cast.h"
#include "sql/engine/expr/ob_expr_result_type_util.h"
#include "sql/session/ob_sql_session_info.h"
#include "sql/engine/ob_exec_context.h"
#include "sql/engine/connect_by/ob_nl_cnnt_by_with_index_op.h"
nam... | ALGO | 0.856277 | 4.778807 |
f339cd39-c58e-4e71-928e-ee35eea96b1d | philomely/cpptraining | practice/main.cpp | //Given a linked list, reverse the nodes of a linked list k at a time and return its modified list.
//
//If the number of nodes is not a multiple of k then left-out nodes in the end should remain as it is.
//
//You may not alter the values in the nodes, only nodes itself may be changed.
//
//Only constant memory is all... | ALGO | 0.998773 | 3.827713 |
0505d361-6cac-43b7-afc2-4b98b7f42891 | ayush931/C-Plus | Problems on Recursion 6/sumOfAllSubsets.cpp | // Given an array of integers, print sums of all subsets in it. Output sums can be printed in any order.
#include <iostream>
#include<vector>
using namespace std;
void f (int *arr, int n, int i, int sum, vector<int> &result) {
// base case
if (i == n) {
result.push_back(sum);
return;
}
... | ALGO | 0.999777 | 5.8895 |
347fa598-915b-421a-af76-b06358db41a1 | TheMatrixMaster/kattis | common algo/allpairsshortestpaths.cpp | #include<iostream>
#include<queue>
#include<map>
#include<cstring>
#include<limits.h>
using namespace std;
typedef pair<int, int> pii;
int dist[155][155];
int visited[155];
map<int, vector<pii>> edges;
auto comp = [](pii a, pii b) { return a.second >= b.second; };
priority_queue<pii, vector<pii>, decltype(comp)> pq... | ALGO | 0.999905 | 4.083317 |
c53813a7-0177-4ed7-9554-37130188ffad | tr0j4n034/SPOJ | ARRPRM.cpp | #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
//#include <unordered_map>
#include <utility>
#include <cassert>
#include <iomanip>... | ALGO | 0.999777 | 3.590416 |
cf5f4707-cc69-49cf-83d0-c3ce28364072 | shravanrn/nacl-llvm | lib/Transforms/InstCombine/InstCombineMulDivRem.cpp | #include "InstCombineInternal.h"
#include "llvm/Analysis/InstructionSimplify.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/PatternMatch.h"
using namespace llvm;
using namespace PatternMatch;
#define DEBUG_TYPE "instcombine"
/// simplifyValueKnownNonZero - The specific integer value is used in a context
/// ... | TOOL | 0.987056 | 7.76315 |
d6df0be1-0418-4205-87f9-a464eaba909b | mmp97/Algorithms | c++/simple_frequency_sort.cpp | #include <map>
#include <vector>
#include <algorithm>
std::vector<int> solve(std::vector<int> vec) {
std::map <int, int> count{};
for(int& v : vec)
count[v] = count.find(v) != count.end() ? count[v] + 1 : 0;
std::sort(vec.begin(), vec.end(), [&](int a, int b){ return (count[a]>count[b]) || (count[a]==count[... | ALGO | 0.999981 | 5.165721 |
b2a15c7b-376f-48ee-8867-6e0358b8aba2 | Bhumika-Raut/PlayWise | 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 |
5a8956d1-390e-4076-a344-f9a809c95ab3 | axaish/Cpp | Lab Day3/Unit 1/05. sum of n num using for loop.cpp | #include <iostream>
using namespace std;
int main()
{
int n;
cout << "Enter the value of n: ";
cin >> n;
int sum = 0;
int num;
cout << "Enter the numbers: ";
for (int i = 0; i < n; ++i)
{
cin >> num;
sum += num;
}
cout << "The sum of " << n << " natural numbers is: " << sum << endl;
return 0;
}
| ALGO | 0.994835 | 3.485729 |
6234da7d-4c3f-4ba8-bd0a-064c59c3b174 | MoeinGhaniyoun/LLVM-SLH-RISCV | mlir/lib/Transforms/Utils/TopologicalSortUtils.cpp | #include "mlir/Transforms/TopologicalSortUtils.h"
#include "mlir/IR/OpDefinition.h"
using namespace mlir;
/// Return `true` if the given operation is ready to be scheduled.
static bool isOpReady(Operation *op, DenseSet<Operation *> &unscheduledOps,
function_ref<bool(Value, Operation *)> isOperan... | ALGO | 0.937363 | 7.984494 |
d10e0716-cb57-471b-a75e-22405cb8b397 | Gameunkulus/UPGRDC--Homework-4.3 | HomeworkUPGRD-4.3/HomeworkUPGRD-4.3.cpp | // HomeworkUPGRD-4.3.cpp : Этот файл содержит функцию "main". Здесь начинается и заканчивается выполнение программы.
//
#include <iostream>
using namespace std;
template<class T>
class Сounter {
private:
int sum = 0;
int count = 0;
public:
Сounter() {};
T& operator()(T value)
{
if (value... | TOOL | 0.950236 | 5.193443 |
e55edbe2-6fb9-4835-b563-45d91c2517a4 | ishandutta2007/codeforces | tourist/normal/575/E.cpp | #include <bits/stdc++.h>
using namespace std;
const int MAX = 100000;
const int N = 400010;
int x[N], y[N];
long long dist[N];
int km;
inline bool cmp(int i, int j) {
int xi = x[i] - x[km];
int yi = y[i] - y[km];
int xj = x[j] - x[km];
int yj = y[j] - y[km];
long long vmul = xi * 1LL * yj - xj * 1LL * yi;... | ALGO | 0.999873 | 4.608147 |
21d44523-d2ff-4d0b-9c2b-5c5d52d9f7d8 | Shubham-k/GeeksforGeeks | Difficulty: Basic/Implement stack using array/implement-stack-using-array.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
class MyStack {
private:
int arr[1000];
int top;
public:
MyStack() { top = -1; }
int pop();
void push(int);
};
// } Driver Code Ends
// Function to push an integer into the stack.
/*
class MyStack
{
private:
int arr[10... | ALGO | 0.998175 | 6.245098 |
9d722ed0-4196-4420-bdb0-61168aad0b8c | j42xiong/Competitive-Programming | DMOJ/Frog 1/Frog 1/main.cpp | #include <bits/stdc++.h>
using namespace std;
#define scan(x) do{while((x=getchar())<'0'); for(x-='0'; '0'<=(_=getchar()); x=(x<<3)+(x<<1)+_-'0');}while(0)
char _;
#define pb push_back
#define MOD 1000000007
#define MAXN 1000
#define INF 0x3f3f3f3f
typedef pair<int, int> pii;
typedef long long ll;
typedef unsigned l... | ALGO | 0.99998 | 4.082266 |
5ac55aab-b473-46db-8d3d-59c92949bf35 | chandrakeshram/Recursion | CountSort.cpp | /*********************CHANDRAKESH RAM***************************/
/*=======================PROBLEM STATEMENT==============*/
#include <bits/stdc++.h>
using namespace std;
void countSort(int arr[],int n){
int k=arr[0];
for(int i=0;i<n;i++){
k=max(k,arr[i]);
}
int count[10]={0};
for(int i=0;i<... | ALGO | 0.999977 | 5.05476 |
bd463db1-c02a-4ac9-bfc4-192907fbff1f | ishandutta2007/codeforces | vercingetorix/normal/1742/F.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <ctype.h>
#include <queue>
#include <cstring>
#include <set>
#include <bitset>
#include <map>
#include <chrono>
#include <random>
#include <unordered_map>
#include <stdio.h>
using namespace std;
typedef long long ll;
typedef long do... | ALGO | 0.999625 | 3.900922 |
9a81b5e1-7651-42ee-a3ee-0798dcd5cedf | vukbyk/suspiria | dep/bullet3-master081320/examples/ThirdPartyLibs/openvr/samples/shared/Matrices.cpp | #include <cmath>
#include <algorithm>
#include "Matrices.h"
const float DEG2RAD = 3.141593f / 180;
const float EPSILON = 0.00001f;
///////////////////////////////////////////////////////////////////////////////
// transpose 2x2 matrix
///////////////////////////////////////////////////////////////////////////////
Mat... | ALGO | 0.999888 | 7.258609 |
f8964520-acf9-4987-80eb-f6d7bc81fb9d | nahian-147/cpp_projects | hello_cgal/cgal/src/AABB_face_graph_triangle_example.cpp | // Author(s) : Pierre Alliez
#include <iostream>
#include <CGAL/Simple_cartesian.h>
#include <CGAL/AABB_tree.h>
#include <CGAL/AABB_traits.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/AABB_face_graph_triangle_primitive.h>
typedef CGAL::Simple_cartesian<double> K;
typedef K::FT FT;
typedef K::Point_3 Point;
typed... | ALGO | 0.999455 | 7.134335 |
d0d4e8f9-f889-4e34-8f7f-8d5c5ade2c92 | ayyappareddynandipati/LEETCODE | 0342-power-of-four/0342-power-of-four.cpp | const auto __ = []() {
struct ___ {
static void _() {
std::ofstream("display_runtime.txt") << 0 << '\n';
}
};
std::atexit(___::_);
return 0;
}();
class Solution {
public:
bool isPowerOfFour(int n) {
return n > 0 and (n & (n - 1)) == 0 and (n - 1) % 3 == 0;
}... | ALGO | 0.999157 | 5.794441 |
b74ce95f-db60-42ec-a082-84b448a41210 | hse-spb-2020-cpp/practice-suvorov | 04-201001/solution/11-map-alter-value.cpp | #include <cassert>
#include <map>
using Container = std::map<int, double>;
using ContainerIterator = Container::iterator;
void increase_keys(ContainerIterator begin, ContainerIterator end) {
for (auto it = begin; it != end; ++it) {
it->second += 10;
}
}
int main() {
Container data = {
{2,... | TOOL | 0.973806 | 4.701842 |
d3e0e793-7faf-4dcb-a337-e60cf4e429ed | PASApipeline/PASA_Lite | pasa-plugins/pasa_cpp/common_subs.cpp | #include "common_subs.h"
#include <iostream>
using namespace std;
void swap_ints(int& i, int& j) {
int temp = i;
i = j;
j = temp;
}
int min (int a, int b) {
if (a < b) {
return (a);
} else {
return (b);
}
}
int min (vector<int>& myList) {
if (myList.size() == 0) {
cerr << "Can't determine m... | TOOL | 0.918662 | 4.560974 |
ee1ffabb-563b-401c-9cbb-7e5c7006fac9 | kndtty/ProCon | AtCoder/enterprise/m_solutions_b.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <numeric>
using namespace std;
typedef long long ll;
long long GCD(long long a, long long b){if(b==0)return a;return GCD(b,a%b);}
int main() {
string S; cin >> S;
int k = 0;
... | ALGO | 0.999758 | 3.945256 |
b8674597-55fa-4270-a101-2e3ff3ff82b9 | Bishal05das/codeforces | cf72G.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
int arr[n+1];
arr[0]=1;
arr[1]=1;
for(int i=2;i<=n;i++){
arr[i]=arr[i-1]+arr[i-2];
}
cout<<arr[n]<<"\n";
} | ALGO | 0.999963 | 4.22684 |
05092297-cee3-4385-8c00-16a5168b717c | atsu8864/Atcoder | abc/205/a.cpp | #include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
#define rep(i, n) for (int i = 0; i < (n); ++i)
using ll = long long;
using P = pair<int,int>;
const long double PI = (acos(-1));
const int MOD = 1e9+7;
int main() {
int a, b;
cin >> a >> b;
double ans;
ans =... | ALGO | 0.94394 | 3.17168 |
46ee79d4-d30d-46e2-9b17-548eb9386f90 | fredwhite/Backup | 760.cpp | #include<stdio.h>
#include<stdlib.h>
#include<string>
#include<vector>
#include<string.h>
#include<algorithm>
using namespace std;
char stra[350];
char strb[350];
vector<string> out;
bool cmp(string a,string b){
int tmp;
tmp=a.compare(b);
if(tmp>=0){
return false;
}else{
return true;
}
}
int... | ALGO | 0.999972 | 3.379189 |
170d65f5-bf61-4354-841d-c73723fb89f2 | g0del-esch3r-bach/graphen-funktionen | eigen-3.4.0/doc/examples/Tutorial_BlockOperations_corner.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace std;
int main()
{
Eigen::Matrix4f m;
m << 1, 2, 3, 4,
5, 6, 7, 8,
9, 10,11,12,
13,14,15,16;
cout << "m.leftCols(2) =" << endl << m.leftCols(2) << endl << endl;
cout << "m.bottomRows<2>() =" << endl << m.bottomRows<2>() << endl << ... | ALGO | 0.998567 | 4.092313 |
94d7ff75-86ed-454c-aed0-77cc79faba76 | FMI-SU-Data-Structures-2022-2023/inf-homework-1-testing-stangel-1 | src/application.cpp | #include <iostream>
#include "solution.h"
int main(int argc, char* argv[])
{
if (argc != 2) {
std::cout << "Usage: checker.exe \"<expression>\"\n";
return 1;
}
std::cout << argv[1] << "\n" << (isCorrect(argv[1]) ? "correct" : "NOT correct") << "\n";
} | ALGO | 0.965327 | 6.042077 |
c4a30777-bd00-4d02-8544-b3e0aa07ae63 | ab4295/C_plusplus_Training | Cpp(6)/exercise/pe07/pe07-10.cpp | // pe07-10.cpp
#include <iostream>
using namespace std;
double add(double x, double y); // ϱ
double sub(double x, double y); //
double mul(double x, double y); // ϱ
double div(double x, double y); //
double calculate(double x, double y, double (*pf)(double, double));
int main()
{
double (*pf[4]) (double, doubl... | ALGO | 0.999543 | 4.359344 |
95edc141-a02f-476f-b3e7-f86022c40eec | XXXLight/C_plus_plus | 状态压缩/猜字谜.cpp | #include<bits/stdc++.h>
#include<unordered_map>
using namespace std;
class Solution {
public:
vector<int> findNumOfValidWords(vector<string>& words, vector<string>& puzzles) {
unordered_map<int, int> count;
for (string &word : words) {
int mask = 0;
for (char ch : word)
mask |= (1 << (ch - 'a'));
++c... | ALGO | 0.999667 | 5.754154 |
790c4649-d1a3-4859-954c-88e416aa1c46 | Gabroide/DevelopingAnEngine | 04_Cap04/MathGeoLib/include/Geometry/AABB.cpp | /** @file AABB.cpp
@author Jukka Jylnki
@brief Implementation for the Axis-Aligned Bounding Box (AABB) geometry object. */
#include "AABB.h"
#include "../Math/MathFunc.h"
#ifdef MATH_ENABLE_STL_SUPPORT
#include <iostream>
#include <utility>
#endif
#include "Frustum.h"
#include "LineSegment.h"
#include "Line.h"
#inclu... | ALGO | 0.952838 | 7.036994 |
6fe2a361-a7e6-4827-b0bb-fe488c28ea4f | Jatin5760/DSA-Supreme-Batch | 05)Functions/fun.cpp | #include<iostream>
using namespace std;
void printNumber(int num) // Pass by value matlab copy create karna.
{
// Is function me jo int num hai wo copy value hai. aur actual value wala variable main function me hai.
cout<<num<<endl;
}
int main()
{
int a = 5;
printNumber(a);
... | TOOL | 0.889222 | 4.405147 |
5d905796-8a01-4747-8444-677e4ae256f1 | YILINQ/biharmonic_distance | libigl/include/igl/adjacency_list.cpp | #include "verbose.h"
#include <algorithm>
template <typename Index, typename IndexVector>
IGL_INLINE void igl::adjacency_list(
const Eigen::MatrixBase<Index> & F,
std::vector<std::vector<IndexVector> >& A,
bool sorted)
{
A.clear();
A.resize(F.maxCoeff()+1);
// Loop over faces
for(int i = 0;i<F... | ALGO | 0.976628 | 5.363037 |
d52de498-13fc-48e9-90ab-18f63a148ae2 | mohamedneinahasan/EC_Alogrithms | HillClimbing.cpp | #include<iostream>
#include<vector>
#include<ctime>
#include<cstdlib>
using namespace std;
const int GRID_SIZE = 10;
// Function to generate a random grid with values between 1 and 100
void generateRandomGrid(vector<vector<int>>& grid) {
for (int i = 0; i < GRID_SIZE; i++) {
vector<int> row;
for (... | ALGO | 0.999995 | 5.670892 |
1fe90016-1870-4406-a442-762c17cd7cb8 | Gopal2003/Codes | Brain Olympic/CPP/Linked list/HR_again.cpp | #include<iostream>
using namespace std;
struct Node
{
Node *next;
int data;
Node(int d)
{
data=d;
next=NULL;
}
};
Node *insert_begin(Node *head,int x)
{
Node *temp = new Node(x);
temp->next = head;
return temp;
}
Node *insert_end(Node *head,int x)
{
Node *temp=new ... | ALGO | 0.999955 | 4.380603 |
eff5dcfe-5064-454e-9542-5da597b10764 | zz92118/games101 | hw2/rasterizer.cpp | // clang-format off
//
// Created by goksu on 4/6/19.
//
#include <algorithm>
#include <vector>
#include "rasterizer.hpp"
#include <opencv2/opencv.hpp>
#include <math.h>
rst::pos_buf_id rst::rasterizer::load_positions(const std::vector<Eigen::Vector3f> &positions)
{
// id --> positions ӳ
auto id = get_next_id... | ALGO | 0.920888 | 6.038064 |
d4fe4ea7-bea9-4c96-abba-87ada238cd7b | Daniel-192211044/CSA5166-Cryptography | 35.cpp | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
// Function to encrypt plaintext using one-time pad Vigenre cipher
void encrypt_vigenere(const char *plaintext, const int *key, size_t key_length, char *ciphertext) {
size_t i, j = 0;
for (i = 0; i < strlen(plaintext); i++) {
... | ALGO | 0.999374 | 4.41724 |
4c9d64f0-b82e-4761-adfa-0aea69ea63db | snehiljha/Intro-to-C--CodingNinja | InterestingAlphabets.cpp | #include <iostream>
using namespace std;
int main()
{
int n;
cin >> n;
int i = 1;
char j;
j = 64 + n;
while ( i <= n ){
int k = 1;
while( k <= i){
cout << j;
k++;
j++;
}
j = 65 + n - i;
cout << endl;
i++;
j--;
}
} | ALGO | 0.999672 | 3.57372 |
6a57aa7d-e60e-414a-8354-df1bf6996732 | Xdydy/OJCode | atcoder/277/b.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[maxn];
int main() {
set<string> st;
cin >> n;
for ( int i = 1 ; i <= n ; i++ ) {
st.insert(s[i]);
ci... | ALGO | 0.999803 | 4.217409 |
85945000-4a79-4062-8fd3-a4a4e8c643c3 | TD2106/Competitive-Programming | SGCT/Indiana Jones.cpp | #include <bits/stdc++.h>
#define bug(x) cout << #x << " = " << x << endl
#define fr(x) freopen(x,"r",stdin)
#define fw(x) freopen(x,"w",stdout)
#define all(x) x.begin(),x.end()
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define reset(x) memset(x,0,sizeof(x))
#define up(i,l,r) for(int i... | ALGO | 0.999958 | 3.330076 |
ee66453f-46f4-4f64-958d-ecb1e03de814 | naufalamr17/strukData | UAS/teori/stack.cpp | // Program stack
// Nama Kelompok : RRN
// Kelas : 2E-Teknik Informatika
#include <bits/stdc++.h>
using namespace std;
// mendefinisikan batas stack
const int ukuranStack = 200;
int stackS = 0, stackT = 0;
// mendefinisikan stack dengan array
array<string, ukuranStack> s;
array<string, ukuranStack> t;
// cek stack... | ALGO | 0.994179 | 4.312116 |
2b53c7ac-74f3-445d-a7d6-c7b88f270417 | Abhijayshah/LeetCode-Practice | 2320-find-all-k-distant-indices-in-an-array/2320-find-all-k-distant-indices-in-an-array.cpp | class Solution {
public:
vector<int> findKDistantIndices(vector<int>& nums, int key, int k) {
vector<int> result;
int n = nums.size();
// Find all positions where nums[j] == key
vector<int> keyIndices;
for (int i = 0; i < n; ++i) {
if (nums[i] == key) {
... | ALGO | 0.999991 | 6.427613 |
a995f525-c6f5-435f-8801-70d5e6e9a933 | Aziz-755/Competitive-Programming | Dynamic Programming/2292 Optimal Keypad.cpp | #include <iostream>
#include <algorithm>
#include <iomanip>
#include <ios>
#include <cmath>
#include <vector>
#include <set>
#include <bitset>
#include <map>
using namespace std;
#define FAST ios::sync_with_stdio(0), cin.tie(0)
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define endl '\... | ALGO | 0.999975 | 4.003 |
48b88150-222e-4bde-9b86-ad384869a192 | Revan220/Study | 4-5 Practice/DumpBarmen5_6.cpp | #include <iostream>
using namespace std;
int main(){
int DayOfBirth, MonthOfBirth, YearOfBirth;
int TodayDay, TodayMonth, TodayYear;
cout<<"Введите год, месяц и день рождения: ";
cin>>YearOfBirth>>MonthOfBirth>>DayOfBirth;
cout<<"Введите текущий год, месяц и день: ";
cin>>TodayYear>>TodayM... | TOOL | 0.925486 | 4.044148 |
ea6d819f-e4bd-4837-b5d5-6ef38bcb2c6b | coding-pandaa/Data-Structure-Algorithm | Arrays/EASY/SecondLargest1.cpp | //Find the second largest element in the array
//Better approach
//TC-> O(n+n) -> O(2n)
#include<bits/stdc++.h>
using namespace std;
int secondLargestElement(vector<int> &v,int n)
{
int largest = -1;
for(int i=0;i<n;i++)
{
if(v[i]>largest)
{
largest=v[i];
}
}
int ... | ALGO | 0.999886 | 4.260941 |
51e6234c-5228-49a2-a404-37a7838c861f | YoganshWagh/Leetcode | 2540-minimum-common-value/Approach_1.cpp | //QUESTION: https://leetcode.com/problems/minimum-common-value/description/
//REFERENCE: https://youtu.be/S2u88Gzby0U?si=WsF0mudUtP7rZ8s8
//Approach 1: Using Extra Space.
//T.C = O(n+m), where n and m are size of nums1 and nums2 and each element is traversed once.
//S.C = O(n), amount of space used to store elements of... | ALGO | 0.999981 | 6.156184 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.