uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
bf89bc24-bf97-469f-a47a-d0ba9ebc0a82 | JonayedMohiuddin/CP_Templates | LCM_SUM_FORMULA.cpp | #include <stdio.h>
using namespace std;
void phi_1_to_n(int n)
{
vector<int> phi(n + 1);
phi[0] = 0;
phi[1] = 1;
for (int i = 2; i <= n; i++)
phi[i] = i - 1;
for (int i = 2; i <= n; i++)
for (int j = 2 * i; j <= n; j += i)
phi[j] -= phi[i];
} | ALGO | 0.999664 | 4.126893 |
f265b56d-b388-4097-861c-40b605b4057b | lamgiahung112/leetcode-cpp | InsertIntervals.cpp | #include <bits/stdc++.h>
using namespace std;
bool comp (vector<int> a, vector<int> b) {
if (a[0] < b[0]) {
return true;
} else if (a[0] > b[0]) {
return false;
} else {
return a[1] < b[1];
}
}
vector<vector<int>> insert(vector<vector<int>>& intervals, vector<int>& newInterval... | ALGO | 0.999979 | 5.109321 |
3c2eaa2d-160d-44fb-a6b8-66ccecf353e4 | Remonhasan/codeforces | Codeforces (Rating Wise)/800/Strange-Splitting.cpp | // author: remonHasan
#include<bits/stdc++.h>
#include <vector>
#include <algorithm>
using namespace std;
#define ll long long
#define VI vector < int > v;
#define PR pair < int, int >
#define RAB(i, a, b) for (int i = a; i < b; i++)
#define Brain for(auto &it:v)
#define PB push_back
#define IS getline(cin, s);
#defin... | ALGO | 0.999912 | 4.036186 |
3874278b-2563-4d6e-9071-ee1e8a949bca | paqao/TournamentAnalysisSFI | Experiments/Swiss.cpp | #include "Swiss.h"
#include "../Fixtures/RoundRobinGenerator.h"
#include "../MatchResolvers/StandardMatchResolver.h"
#include "../Fixtures/KnockoutGenerator.h"
#include "../Fixtures/Lose2Cup/WinnerLadderGenerator.h"
#include "../Fixtures/Lose2Cup/FirstLosersGenerator.h"
#include "../Fixtures/Lose2Cup/MergedRoundGenerat... | ALGO | 0.994383 | 5.675298 |
fff2d534-89f2-4dac-804b-6e81764537e1 | Theqiqi/PushBoxEasyx | PushBoxConsole/console.cpp | #include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <stdbool.h>
#include <Locale.h>
//推箱子的元素:空地0 墙1 目的地2 箱子3 玩家4 箱子在目的地 5 玩家在目的地 6
enum Mine
{
SPACE, //空地
WALL, //墙
DEST, //目的地
BOX, //箱子
PLAYER //玩家
};
//当前关卡
int level = 0;
//定义一个二维数组,用来表示退箱子的地图
int map[3][10][10] =
{
{
{0,0,0,0,0,0,0,0,0,0},
{0,... | ALGO | 0.999619 | 3.164991 |
f9c8a00f-a03b-4ea0-a7c1-9f0155fe0277 | palilo815/ps | baekjoon/4000/4949.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
cin.tie(0), cout.tie(0);
ios::sync_with_stdio(0);
string s;
while (1) {
getline(cin, s);
if (s == ".") break;
int invalid = 0;
stack<char> stk;
for (char c : s) {
if (c == '(' || c == '[')
... | ALGO | 0.999858 | 5.180995 |
80900cdd-135d-475a-a2db-6cf0cbfe5239 | AlanNDewitt/POO-en-C- | C++/punteros2.cpp | #include <iostream>
using namespace std;
int main()
{
int N,x;
int *puntero;
int suma = 0;
system("clear");
cout<<"De que tamaño quieres el arreglo : ";
cin>>N;
int arreglo[N];
puntero = arreglo;
system("clear");
for (int i = 1; i < N+1; ++i)
{
cout<<"\ningresa el dato "<<i<<": ";
cin>>*puntero;... | ALGO | 0.987139 | 3.511167 |
e8884b5f-c48a-4b2f-8d0c-6a343e474083 | yuv-raj-25/pizza-youtube | .history/main_20230817191752.cpp | #include <iostream>
#include <sstream>
#include <vector>
#include <string>
int calculate(std::string input) {
std::string operation;
std::vector<int> numbers;
// Split input into operation and numbers
size_t commaPos = input.find(',');
if (commaPos != std::string::npos) {
operation = input... | ALGO | 0.996451 | 6.645041 |
a369ccc4-40c7-432b-b725-1b9498cbf4b0 | chris-sophos/ocomp | C2/C2P83_.cpp | #include <iostream>
#include <cmath>
using namespace std;
struct pos {
int x, y;
};
int dist(pos&, pos&);
ostream& operator<<(ostream& c, pos& p) {
c << p.x << " " << p.y << endl;
return c;
}
int main() {
int xs, ys;
cin >> xs >> ys;
pos startpos;
cin >> startpos.x >> startpos.y;
pos posxmx = startp... | ALGO | 0.999065 | 3.530073 |
7038cc9b-72a5-4c72-8547-5345e9d81974 | mdaffabdul/M.Daffa.A.M_LabAlgo | Pertemuan 3/Tugas/Tugas Pertemuan 3_Luas Lingkaran.cpp | #include <iostream>
using namespace std;
int main() {
int r;
const float pi = 3.14286;
cout << "Kalkulator Luas Lingkaran!" << endl;
cout << "Masukkan jari jari lingkaran = ";
cin >> r;
float hasil = pi * r * r;
cout << endl;
cout << "Luas lingkarannya adalah:" << en... | TOOL | 0.960401 | 4.271135 |
c3c5de31-c7c4-4422-9b7a-0a1889f63ed0 | 51mans0n/Algorithms | 5lab/3ex.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <cstdlib>
using namespace std;
int main() {
int n, x;
cin >> n >> x;
vector<int> rows(n);
for (int i = 0; i < n; i++) {
cin >> rows[i];
}
sort(rows.begin(), rows.end(), greater<int>());
long long revenue ... | ALGO | 0.999957 | 4.426664 |
8c1d9717-8cd2-49f9-9f81-afaf7b487257 | azhangwei/leetcodeforme | Minimum Depth of Binary Tree.cpp | //#include <iostream>
//#include <vector>
//
//using namespace std;
//
//struct TreeNode
//{
// int val;
// TreeNode *left;
// TreeNode *right;
// TreeNode(int x) : val(x), left(NULL), right(NULL) {}
//};
//
//int minDepth(TreeNode *root);
//
//int main()
//{
// TreeNode *ro=new TreeNode(1);
// TreeNode *le=new TreeNod... | ALGO | 0.999768 | 5.567297 |
bdd6e94a-f086-49b4-b738-59130e547e05 | kmjp/procon | codeforce/edu/121-160/149/f.cpp | #include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define FORR2(x,y,arr) for(auto& [x,y]:arr)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define ... | ALGO | 0.999842 | 3.965038 |
c422010a-3493-4794-bee4-c07ce6fb88fe | mySoftSnail/MyCodingTestStudy | 백준/1182_부분수열의 합.cpp | #include <bits/stdc++.h>
using namespace std;
int n, s;
int arr[25];
int cnt = 0;
void func(int cur, int tot) {
if (cur == n) {
if (tot == s) cnt++;
return;
}
func(cur + 1, tot);
func(cur + 1, tot + arr[cur]);
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cin >> n >> s;
for (int i = 0; i < n; ++i... | ALGO | 0.999964 | 3.736841 |
8a00fee3-84a6-4409-9f05-57ef5316cdab | aashirisrar/CS2001-DSA-Assignments | Lab/Lab 2/Q4.cpp | #include <iostream>
#include <vector>
using namespace std;
int binarySearch(vector<int> arr, int x)
{
int mid; // 1
int l = 0; // 1
int h = arr.size() - 1; // 1
while (l <= h) // lgn
{
// Calculating mid
mid = (l + h) / 2; // lgn
if (arr[mid] ==... | ALGO | 0.999971 | 5.884121 |
8bf14249-e62f-4f25-9d8c-8d033937f92e | syedmahihossen/luvlearning | class8 STL/Sherlock.cpp | #include <bits/stdc++.h>
using namespace std;
bool cmp(pair<string, int> &a, pair<string, int> &b)
{
if (a.second == b.second)
return a.first< b.first;
return a.second > b.second;
}
void solve()
{
vector<pair<string, int>> v;
int n;
cin >> n;
while (n--)
{
int k;
stri... | ALGO | 0.999418 | 4.742863 |
c603dfbc-82ce-4717-bb8c-5c8bc59ed928 | rishabh27goel/DSA-Extra-Questions | CSES Problem Set/Introductory Problems/Apple_Division.cpp | #include <iostream>
#include <vector>
#include <limits.h>
#include <math.h>
using namespace std;
#define ll long long
ll findMinDiff(int n, vector<int> &arr) {
ll totalSum = 0;
for(int j = 0; j < n; j++) {
totalSum += arr[j];
}
ll power = pow(2, n);
ll minDiff = LLONG_MAX;
for(int j ... | ALGO | 0.999896 | 4.247786 |
7e99bfd2-5a1f-4f87-8e84-ad51143ac5f0 | josehpg98/Algorithms | A-II_2019.2/ExerciciosemAula/Lista8/exe3.cpp | #include<iostream>
#include<cstdlib>
#include<cstdio>
#include<cstring>
using namespace std;
void fatorial(int *x);
main()
{
setlocale(LC_ALL,"portuguese");
int x = 0, y = 0,*px,*py;
cout<<"informe um valor para x: " << endl;
// etapa 1
cin>>x;
px = &x;
py = &y;
cout<<"etapa2 | atribuir ... | ALGO | 0.999769 | 3.215479 |
b4643b7d-bd11-4feb-9c62-c2a56ef779ce | rsa332/MTECH_PROJECT | CAV/Scripts/src/Eigen-3.3/doc/examples/Tutorial_ArrayClass_interop_matrix.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace Eigen;
using namespace std;
int main()
{
MatrixXf m(2,2);
MatrixXf n(2,2);
MatrixXf result(2,2);
m << 1,2,
3,4;
n << 5,6,
7,8;
result = m * n;
cout << "-- Matrix m*n: --" << endl << result << endl << endl;
result = m.array() * ... | ALGO | 0.994876 | 4.306757 |
213d03c3-ef75-4730-beb9-9e08e5752abc | joshualass/CP | Solutions/Default/playingwithstones.cpp | // https://onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=4228
/* 2 observations to make
if a number is odd, we can do floor division on the number until it's even.
This represents the other player optimally picking the number of stones to 'rebalance' the number
i.e. if you start w... | ALGO | 0.999803 | 5.379323 |
818358e1-37de-4377-9e3d-47613733a169 | thisisyourfahi/Extra | Primes between 1 to N.cpp | #include <bits/stdc++.h>
using namespace std;
bool PrimeChecker(int i){
for(int j = 2; j * j <= i; j++){
if(i % j == 0){
return false;
}
}
return true;
}
void PrintThePrimes(int n){
for(int i = 2; i <= n; i++){
if(PrimeChecker(i)){
cout << i << " ";
... | ALGO | 0.999732 | 4.908911 |
8dc90d9c-b4af-41a8-a3b4-f11e473afcf5 | gatskov/Search-Engine | src/ConverterJSON.cpp | #include "ConverterJSON.h"
const int LINE_LENGTH = 46;
const int HEADER_SPACER = 15;
//static members initialization -------------------------
ConverterJSON* ConverterJSON::instance = nullptr;
ConverterJSON* ConverterJSON::getInstance()
{
if (instance == nullptr)
{
instance = new ConverterJSON();
... | TOOL | 0.874962 | 4.908963 |
366ccbec-2609-4b77-b645-381d7d85025d | Omair95/A_prototype_MPEG-G_encoder | boost_1_66_0/libs/graph/example/print-out-edges.cpp | using namespace boost;
template < typename Graph, typename VertexNamePropertyMap > void
read_graph_file(std::istream & graph_in, std::istream & name_in,
Graph & g, VertexNamePropertyMap name_map)
{
typedef typename graph_traits < Graph >::vertices_size_type size_type;
size_type n_vertices;
typena... | ALGO | 0.945474 | 5.833385 |
601f9f2a-25c5-4f05-b598-eb02b685194d | tanguy-kabore/basic-flutter-student-management | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.9988 | 6.76073 |
2cbe18f6-db80-4925-bb2a-8ec9bb62e992 | ChrisSun06/Position-Based-Fluid-Simulation | extern/libigl/python/py_igl/py_boundary_conditions.cpp | m.def("boundary_conditions", []
(
const Eigen::MatrixXd& V,
const Eigen::MatrixXi& Ele,
const Eigen::MatrixXd& C,
const Eigen::MatrixXi& P,
const Eigen::MatrixXi& BE,
const Eigen::MatrixXi& CE,
Eigen::MatrixXi& b,
Eigen::MatrixXd& bc
)
{
assert_is_VectorX("P", P);
Eigen::VectorXi Pv;
if (P.size() ... | ALGO | 0.900592 | 4.896288 |
f8009d3b-b56b-4476-ba24-c544e7251097 | vfolunin/archives-solutions | LeetCode/479.cpp | class Solution {
public:
int largestPalindrome(int size) {
if (size == 1)
return 9;
int p = 1;
for (int i = 0; i < size; i++)
p *= 10;
for (int i = p - 1; 1; i--) {
string s = to_string(i);
s.insert(s.end(), s.rbegin()... | ALGO | 0.99975 | 6.094117 |
d9933af9-f90e-4fb8-8981-2a46ec271de6 | KMU-FMCL/opencv | modules/features2d/src/affine_feature.cpp | /*
Guoshen Yu, Jean-Michel Morel, ASIFT: An Algorithm for Fully Affine
Invariant Comparison, Image Processing On Line, 1 (2011), pp. 11-38.
https://doi.org/10.5201/ipol.2011.my-asift
*/
#include "precomp.hpp"
#include <iostream>
namespace cv {
class AffineFeature_Impl CV_FINAL : public AffineFeature
{
public:
... | ALGO | 0.992557 | 6.87281 |
803c0c65-02ef-4bb8-8801-0c4b2b5993b6 | Kyungbaee/TIL | 프로그래머스/1/77484. 로또의 최고 순위와 최저 순위/로또의 최고 순위와 최저 순위.cpp | #include <string>
#include <vector>
#include <algorithm>
using namespace std;
vector<int> solution(vector<int> lottos, vector<int> win_nums) {
vector<int> answer;
int winCount = 0, zeroCount = 0;
for(int num : lottos){
if(find(win_nums.begin(), win_nums.end(), num) != win_nums.end())
... | ALGO | 0.999087 | 4.962879 |
a145e321-363c-4271-b8d9-edc4e119e91d | jameslu216/LeetCode-365-Days-Challenge | Day 35 814. Binary Tree Pruning.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.9998 | 6.031486 |
e8405f5c-524c-4ded-be36-beed7b1f7594 | TomorrowIppo/ROKA_BOJ | Just/BOJ_1780.cpp | #include <bits/stdc++.h>
#define MAX 2187 + 1
#define endl "\n"
using namespace std;
int board[MAX][MAX];
int n;
int cnt_, cnt_0, cnt_1;
void dc(int n, int x, int y)
{
bool is_all_same = true;
int init_value = board[x][y];
for(int i = x; i < x + n; i++)
for(int j = y; j < y + n; j++)
... | ALGO | 0.999926 | 4.325662 |
ac6addf6-db79-4ccd-8e12-767cee62ead8 | lakshmanaram/Competitive-programming | codechef/January Challenge 17/RESERVOI.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
long t;
cin>>t;
string yes = "yes";
string no = "no";
while(t--) {
int n,m;
cin>>n>>m;
vector<string> arr(n);
for(int i=0;i<n;i++)
cin>>arr[i];
bool flag = true;
for(int i=0;i<n;i++) {
for(int j=0;j<m;j++) {
if (arr[i][j] == 'B'){
... | ALGO | 0.999921 | 4.429245 |
8140135e-73f8-4adc-9ec9-154fdf096c84 | LimJeonghyun/CodingTestStudy | Practice/B_28701.cpp | #include <iostream>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cout.tie(NULL);
cin.tie(NULL);
int N;
long long sum = 0;
cin >> N;
for (int i = 1; i <= N; i++)
{
sum += i;
}
cout << sum << '\n';
sum *= sum;
cout << sum << '\n';
sum ... | ALGO | 0.999826 | 3.65827 |
493e87e9-b813-4505-86fb-d65a83b9b0ca | kzvd4729/Algorithms-DataStructures | Segment-Trees/pointUpdate-rangeMin-withIndex.cpp | /*
point update range min with index
*/
pair<int,int>seg[5*N+2];
void build(int node,int lo,int hi)
{
if(lo==hi){seg[node]={aa[lo],lo};return ;}
int md=(lo+hi)/2;
build(node*2,lo,md);build(node*2+1,md+1,hi);
seg[node]=min(seg[node*2],seg[node*2+1]);
}
void upd(int node,int lo,int hi,int id,int vl)
{
if(lo==hi... | ALGO | 0.999879 | 4.255211 |
806c25b1-f2ad-4109-aed8-c6a34674b216 | JoanaMota/LearnCPP | Algorithms/Trees/is_same.cpp | #include <iostream>
struct TreeNode
{
int val;
TreeNode *left;
TreeNode *right;
TreeNode() : val(0), left(nullptr), right(nullptr) {}
TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {}
};
bool isSameT... | ALGO | 0.999391 | 5.310488 |
5da5ef32-4695-4e4d-ae08-5df2661b595f | kshitijmishra27/DSA-practice | Lowest Common Ancestor in a Binary Tree - GFG/lowest-common-ancestor-in-a-binary-tree.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// Tree Node
struct Node
{
int data;
Node* left;
Node* right;
Node(){
data = 0;
left = right = NULL;
}
Node(int x){
data = x;
left = right = NULL;
}
};
// } Driver Code Ends
/* A binary tre... | ALGO | 0.999982 | 6.374219 |
c0d0446b-7805-44ea-930e-9830b18fc697 | SpidiMun/2-Semester | Лаб. Работа № 13/Лаб. Работа № 13/Лаб. Работа № 13.cpp | #include <iostream>
using namespace std;
int Board[8][8];
void Set_Queen(int I, int J)
{
int i, j;
for (i = 0; i < 8; i++)
{
Board[i][J] += 1;
}
for (j = 0; j < 8; j++)
{
Board[I][j] += 1;
}
if (I >= J)
{
i = I - J;
j = 0;
}
else
{
i = 0;
j = J - I;
}
while (i < 8 && j < 8)
{
Board[i][j] +... | ALGO | 0.999438 | 3.590512 |
2a43f047-ff9f-41b4-a271-8cba17da75f8 | lovethiscode/boost | libs/geometry/doc/src/examples/algorithms/discrete_frechet_distance_strategy.cpp | //[discrete_frechet_distance_strategy
//` Calculate Similarity between two geometries as the discrete frechet distance between them.
#include <iostream>
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/point.hpp>
#include <boost/geometry/geometries/linestring.hpp>
int main()
{
namespace bg = boo... | ALGO | 0.999292 | 7.199414 |
23354622-015f-4b63-b83c-9de779942800 | mrktj/PuzzleHero | Classes/extensions/sha1.cpp | /*
Contributors:
Gustav
Several members in the gamedev.se forum.
Gregory Petrosyan
*/
#include "sha1.h"
namespace sha1
{
namespace // local
{
// Rotate an integer value to left.
inline const unsigned int rol(const unsigned int value,
const unsigned int steps)
{
... | ALGO | 0.999454 | 6.477012 |
23a61f74-1174-40c6-8276-06e15d9a6d8a | altynbek132/yandex_CPP_specialization | 2__yellow_belt/week_4/002-chast-mnozhiestva/solution.cpp | //
// Created by Addmin on 13.12.2020.
//
#ifdef MASLO
#include "solution.h"
#endif
#include <vector>
#include <algorithm>
#include <iostream>
//
// Created by Addmin on 13.12.2020.
//
//#pragma once
#include <vector>
#include <algorithm>
#include <iostream>
#include <set>
using namespace std;
template<typename T... | ALGO | 0.998994 | 4.507865 |
0c792137-6b96-483a-bb9b-2d83e6816af2 | raincross7/code-similarity | codes/train_code/problem434/problem434_473.cpp | #include<cstdio>
#define no {puts("Impossible");return 0;}
using namespace std;
int n,m,a[1005];
inline int read(){
int ret=0;bool f=0;char ch=getchar();
while(ch>'9'||ch<'0') f^=ch=='-',ch=getchar();
while(ch<='9'&&ch>='0') ret=ret*10+ch-'0',ch=getchar();
return f?-ret:ret;
}
int main(){
n=read();
for (int i=1;i... | ALGO | 0.999965 | 3.434642 |
c363eab8-c02a-4575-99a2-8ca09693a59a | lcultx/fork-om3d | 3DObjectManipulation/3rdparty/pbrt/3rdparty/openexr-1.7.0/ImfHuf.cpp | //-----------------------------------------------------------------------------
//
// 16-bit Huffman compression and decompression.
//
// The source code in this file is derived from the 8-bit
// Huffman compression and decompression routines written
// by Christian Rouet for his PIZ image file format.
//
//-----------... | ALGO | 0.99584 | 6.579604 |
b4e6da84-2f46-44f3-8c0c-4c8f72978738 | abhishekudupa/boost-local | boost_1_57_0/libs/polygon/benchmark/voronoi_benchmark_segments.cpp | // Boost.Polygon library voronoi_benchmark.cpp file
// See http://www.boost.org for updates, documentation, and revision history.
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <fstream>
#include <numeric>
#include <vector>
#include <utility>
#include <boost/random/mersenne_twister.hpp>
#includ... | TEST | 0.984622 | 6.895944 |
bba81c44-e5d4-45b1-a3c2-0e40d8790f31 | satyam24-11/code | A_Div_7.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define make_fast \
std::ios_base::sync_with_stdio(false); \
std::cin.tie(NULL);
const int mod = 1000000007;
void answer()
{
int n;
cin >> n;
int x=n%7;
int ans = -1;
if(x==0){
cout << n << e... | ALGO | 0.999759 | 4.935839 |
95e40e14-b3ad-497a-a01c-167f0f9403a5 | hjiang13/LLMs-in-IR | POJ-104/34/2512.cpp | #include <iostream>
using namespace std;
main()
{
int n;
cin >> "%d",&n);
while (n!=1)
{
if (n%2==1)
cout << "%d*3+1=%d\n",(n-1)/3,n=n*3+1);
else
cout << "%d/2=%d\n",n*2,n=n/2);
}
cout << "End");
} | ALGO | 0.999909 | 3.578696 |
e4a15f70-8371-48bc-b08b-96d92d4e757a | MaximSlyusarenko/Discrete-math-lab | Fourth term/Lab 2. Suffix data structures/Suffix array/main.cpp | #include <iostream>
#include <cmath>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <set>
#include <map>
using namespace std;
string s;
int p[500000], c[500000], pnew[500000], cnew[500000], cnt[500000];
int main()
{
freopen ("array.in", "r", stdin);
freopen ("array.out", "w", stdout);
... | ALGO | 0.999975 | 3.040155 |
fde8296b-ea44-4950-ad68-56397335bb0c | arifparvez14/Basic-and-competetive-programming | Basic-Programming/Pattern/Number/pattern38.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int i,j,N,k=1;
cin>>N;
for(i=1;i<=N;i++)
{
for(j=1;j<=i;j++)
{
if(i==1 || i==N || j==1 || j==i)
cout<<"1";
else
cout<<"0";
}
cout<<endl;
}
return 0;
... | ALGO | 0.999943 | 3.051112 |
cb9f28d8-6c9f-4010-9355-b80ea0d38161 | jeul2/bj_test_0408_div2 | bj_test_0408_div2/5_problem.cpp | /*
1~N fn(N)̶Ҷ
fn(a) x fn(a+1) x fn(b-1) x fn(b) 14579 ϴ α ۼ.
-------
1+2+3 = 6
1+2+3+4 = 10
1+2+3+4+5 = 15
= 900
a(a+1)*0.5
3*4 *4*5 *5*6
2 2 2
3 * 16 * 25 * 6
2 2 2
m (m+1)^2 (n-1)^2 n^2 n+1
2^(m-n+1)
*/
#include <stdio.h>
int fnSumUntilNumber(int nNumber);
int main()
{
int nM;
int nN;
int nRe... | ALGO | 0.999952 | 4.373402 |
5e754dfc-9b17-40f4-abf9-2154300d07ed | fadyat/ITMO-PROBLEMS | algorithms/term1/intro/sort.cpp | #include <bits/stdc++.h>
typedef long long ll;
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
int main()
{
freopen("smallsort.in", "r", stdin);
freopen("smallsort.out", "w", stdout);
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int n;
cin >> n;
vec... | ALGO | 0.999979 | 4.376335 |
ce914ad3-8490-4e62-9475-406928939421 | joonyjin/data_structure | DS_2021105403_LAB06/DS_2021105403_LAB06/5/B/main.cpp | #include <iostream>
#include "SortedType.h"
using namespace std;
int main() {
SortedType<int> list01;
list01.InsertItem(1);
list01.InsertItem(3);
list01.InsertItem(5);
list01.InsertItem(7);
list01.InsertItem(1);
list01.InsertItem(11);
list01.DeleteItem(1);
int mi;
list01.ResetList();
for (int i = 0; i < li... | ALGO | 0.987337 | 4.181316 |
83160c58-0cf2-4abd-a4b3-8dffa7fadde9 | chobaa/cpp-algorithm | icpc/cpp/2239.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
int board[9][9];
bool row[9][9];
bool col[9][9];
bool square[9][9];
int cnt = 0;
void fill_block(int i, int j, int target, bool a)
{
row[j][target] = a;
col[i][target] = a;
square[(i / 3) * 3 + j / 3][target... | ALGO | 0.999839 | 4.843436 |
54c49fbb-b7be-4025-a614-e1ac9203cc37 | savitansh/Contest-Programs | interview_qtn3.cpp | /*
@author savitansh
find merging point of 2 lists
2. swap alternating nodes
3. all nodes at odd places come at start and all even nodes appended
in reverse order to list of odd nodes
*/
#include <iostream>
using namespace std;
struct node{
int data;
struct node *next;
};
struct node *t1,*t2,*t3;
struct node *cr... | ALGO | 0.999923 | 3.530539 |
e21a5b1d-d2be-4d55-bcbf-cdbc8033e6f0 | hardikhere/Data-Structures | binary-search-tree.cpp | // Binary Search Tree - Implemenation in C++
// Simple program to create a BST of integers and search an element in it
#include<iostream>
using namespace std;
//Definition of Node for Binary search tree
struct BstNode {
int data;
BstNode* left;
BstNode* right;
};
// Function to create a new Node in heap
BstNode* ... | ALGO | 0.99996 | 5.803025 |
6df64d64-b534-4c95-a8d2-1fd5afef3a33 | goelayush89/Data-Structure-and-Algorithms- | 0231-power-of-two/0231-power-of-two.cpp | class Solution {
public:
bool isPowerOfTwo(int n) {
if(n==1) return true;
if(n%2!=0 || n==0) return false;
return isPowerOfTwo(n/2);
}
}; | ALGO | 0.998196 | 6.095846 |
8c4276a8-8c49-4828-8037-de2d501eec73 | Yosuamuliawan19/algorithm-bank | Leetcode_submissions/problems/add_digits/solution.cpp | class Solution {
public:
int addDigits(int num) {
while (num / 10 != 0){
int next = 0;
while (num != 0){
next += (num%10);
num /= 10;
}
num = next;
}
return num;
}
}; | ALGO | 0.999889 | 6.29624 |
a1d2e0fa-42a6-4b46-a09e-fd8c6df058ef | Sahilsingh0507/DSAInCpp | 05_bitwiseOperator/10.cpp | // another way of writing for loop
// For Loop understanding
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cout << "Enter the value of n: " << endl;
cin >> n;
cout << "Printing count from 1 to n" << endl;
int i = 1;
for (;;)
{
if (i <= n)
{
co... | ALGO | 0.996191 | 3.256317 |
725da922-2802-4247-a431-39a9f2130290 | CVH95/Montpellier | Lab7/ex4_3.cpp | // Exercise 4.3
#include <iostream>
#include <fstream>
#include <rw/rw.hpp>
#include <rwlibs/pathplanners/rrt/RRTPlanner.hpp>
#include <rwlibs/pathplanners/rrt/RRTQToQPlanner.hpp>
#include <rwlibs/proximitystrategies/ProximityStrategyFactory.hpp>
#include <vector>
#include <math.h>
#include <numeric>
#include <algor... | ALGO | 0.999395 | 6.192119 |
813969bd-f632-4f54-a47a-4656e5841271 | SHUBHAMK1239/Cpplab | 2b_largest_of_three_num.cpp | #include<iostream>
using namespace std;
inline float lar(float a, float b ,float c=75 )
{
return ((a>b&&a>c)?a:b>c?b:c);
}
int main()
{
float x,y,z;
cout<<"\nEnter three numbers:\n";
cin>>x>>y>>z;
cout<<"Largest= "<<lar(x,y,z);
cout<<"\nTaking 3rd number as 75\n";
cout<<"\nEnter two numbers:\n";
cin>>x>>y;
cout<<"\n... | ALGO | 0.983992 | 3.377692 |
d201b5ee-afce-4230-86eb-edff7d59c49c | marcpp97/TFG-Ajedrez | Assets/StreamingAssets/Stockfish.Program/win/sf_13/src/bitbase.cpp | #include <cassert>
#include <vector>
#include <bitset>
#include "bitboard.h"
#include "types.h"
namespace {
// There are 24 possible pawn squares: files A to D and ranks from 2 to 7.
// Positions with the pawn on files E to H will be mirrored before probing.
constexpr unsigned MAX_INDEX = 2*24*64*64; // stm * ... | ALGO | 0.997893 | 7.131259 |
9d896685-88ed-4c1f-871a-25d4a365bd9b | punkproger/Project-Euler | Problem 12/main.cpp | #include <iostream>
#include <cmath>
int main()
{
int divisiors = 0 , count = 4 ;
int value = 6 ;
while( divisiors < 500 )
{
divisiors = 0 ;
value += count ;
for( int i = 1 ; i < sqrt( value ) + 1 ; ++i )
if( value % i == 0 )
divisiors += 2 ;
++count ;
}
std::cout << value << '\t' << divisiors... | ALGO | 0.999682 | 4.842995 |
315d465f-c7d8-4e08-85aa-aa2d0b0f26a0 | Ayush05G/Cpp_DSA | Data Structures & Algorithms/C++ STL/list.cpp | #include<iostream>
#include<list>
using namespace std;
int main() {
list<int> first;
first.push_back(10);
first.push_back(20);
first.push_back(30);
//10->20->30
first.insert(first.begin(), 100);
//100->10->20->30
cout << first.size() << endl;
first.erase(first.begin(), first.end(... | TOOL | 0.951027 | 3.085454 |
f9cfc7fd-1dee-4252-948c-ad62bbc83b88 | CyberBoyAyush/Data-Structures-And-Algorithms | 0_Questions/LeetCode/3_Binary_Search/1_BS_on_1D/SearchinRotatedSortedArrayII.cpp | // Search in Rotated Sorted Array II
// https://leetcode.com/problems/search-in-rotated-sorted-array-ii/
#include<vector>
using namespace std;
class Solution {
public:
bool search(vector<int>& arr, int k) {
int n = arr.size();
int low = 0;
int high = n-1;
while(low<=high){
int mid = (low... | ALGO | 0.99998 | 5.827024 |
ce597324-cd16-4716-b111-375a1a0cac85 | AriaCurrency/aRIA | src/util/asmap.cpp | #include <map>
#include <vector>
#include <assert.h>
#include <crypto/common.h>
namespace {
constexpr uint32_t INVALID = 0xFFFFFFFF;
uint32_t DecodeBits(std::vector<bool>::const_iterator& bitpos, const std::vector<bool>::const_iterator& endpos, uint8_t minval, const std::vector<uint8_t> &bit_sizes)
{
uint32_t va... | ALGO | 0.971007 | 6.219506 |
528b1f09-7a4c-4227-8c10-326dd9636d73 | WilliamMajanja-zz/google_hashcode | 2019/qualification/solutions/evgen/launcher.cpp | #include "solution.h"
#include "../../base/calculate_score.h"
#include <unistd.h>
int main(int argc, char** argv) {
ASSERT(argc == 3, "wrong number of arguments: " << argc)
DBG("debug mode")
LOG("srand: " << atoi(argv[1]))
string test_name(argv[2]);
LOG("test name: " << test_name)
srand(atoi(argv[1]));
... | ALGO | 0.988992 | 4.847943 |
d5829c60-2db9-4681-bab6-72cea544d90e | yangmingzi/MyLeetcode | 165-Compare Version Numbers.cpp | /*
ompare two version numbers version1 and version2.
If version1 > version2 return 1, if version1 < version2 return -1, otherwise return 0.
You may assume that the version strings are non-empty and contain only digits and the . character.
The . character does not represent a decimal point and is used to separate numbe... | ALGO | 0.999557 | 4.649441 |
7f07e032-18f5-4697-8f3a-55552f501152 | gaurav12devloper/6Companies30days | Google/Number-of-Good-Leaf-Nodes-Pairs.cpp | /*
1530. Number of Good Leaf Nodes Pairs
https://leetcode.com/problems/number-of-good-leaf-nodes-pairs/description/
*/
class Solution {
public:
unordered_map<TreeNode*,TreeNode*>parent;
unordered_set<TreeNode*>leaf;
void addParent(TreeNode* root){
if(root==NULL) return;
if(root->left==NULL... | ALGO | 0.99998 | 6.625898 |
f92e613e-4ab9-4895-9a39-ad3ebc411694 | BashuMiddleSchool/Bashu_OnlineJudge_Code | pub/1009.cpp | #include<iostream>
using namespace std;
int main() {
int a,b,c,d;
cin >> a >> b;
c= a/b ;
d= a% b;
cout << c << " " << d;
return 0;
} | ALGO | 0.999758 | 4.135919 |
3955963f-7eac-4e3e-9750-7b8f49fc83de | trgtanhh04/codechill | DSA/SapXepTimKiem/B26_TImKiemCapSoCoHieuBangX.cpp | #include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int MOD = 1e9 + 7;
int main()
{
int n , x ; cin >> n >> x;
int a[n]; map<int, int>mp;
for(int &x : a)
{
cin >> x;
mp[x] = 1;
}
for(int i = 0 ; i < n ;i++)
{
if(a[i] > x && mp[a[i] - x] == 1)
... | ALGO | 0.99997 | 3.926077 |
65e2203f-64e3-4872-ae91-11db52804c26 | Md-Noman-Biswas/Codeforces_problems | B_Monsters_Attack.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define nl "\n"
#define YES cout << "YES\n"
#define NO cout << "NO\n"
#define pb push_back
#define llmx LONG_LONG_MAX
#define llmn LONG_LONG_MIN
#define mod 1000000007
const int N = 1e5 + 7;
void solve(){
ll n, k;
cin >> n >> k;
vector<ll> p... | ALGO | 0.999945 | 4.02032 |
0ff29d63-006f-4207-8553-fd79d7032b8e | 3dtof/DemoApplications | TinTin/simple_people_tracking/Horus.cpp | /*!
* ============================================================================
*
* @addtogroup Horus
* @{
*
* @file Horus.cpp
* @version 1.0
* @date 1/7/2016
*
* @note People tracking class
*
* Copyright(c) 20015-2016 Texas Instruments Corporation, All Rights Reserved.q
* TI makes NO WARRANTY a... | ALGO | 0.979857 | 5.986238 |
2fdc0492-b88a-46b6-9e4b-989950b655fe | GrootTheDeveloper/OLP-ICPC | 800+BAI_CODE_HAY/Code/toposort.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
vector <int> topo;
vector <int> g[1001];
bool visited[100001];
int in[1001],n,m;
void dfs(int u)
{
visited[u] = true;
for (int v : g[u])
if (!visited[v]) dfs(v);
topo.push_back(u);
}
void kahn()
{
queue <int> q;
for (int i = 1; i <= n; i++) i... | ALGO | 0.999996 | 4.74353 |
c03b1bf4-49ee-49c4-bf89-12bacc44e5bf | raincross7/code-similarity | codes/train_code/problem214/problem214_37.cpp | #include <bits/stdc++.h>
#define pb push_back
#define fi first
#define se second
#define ins insert
#define sz(x) (long long)x.size()
typedef long long ll;
typedef long double ld;
const int N = 1e5 + 5;
const ld pi = 3.141592653;
const ll MOD = 1e9 + 7;
const ll mod = 998244353;
const ll INF = __LONG_LONG_MAX__;
using... | ALGO | 0.999981 | 4.040135 |
b0849854-01fd-4eee-9667-554c4ddc9373 | zenith82114/boj-solve | src/13308.cpp | /*
* Q13308 - Dijkstra's alg.
* Date: 2023.11.8
*/
#include<bits/stdc++.h>
using namespace std;
using i64 = int64_t;
vector<pair<int, int> > adj[2501];
int price[2501];
i64 dist[2501][2501];
int main() {
ios_base::sync_with_stdio(false); cin.tie(0);
int n, m; cin >> n >> m;
for (int x = 1; x <= n; ++... | ALGO | 0.999879 | 4.62525 |
82be471b-f355-424a-b007-9e3d654b5aba | oxgersa/bitcoin | src/test/util/blockfilter.cpp | #include <test/util/blockfilter.h>
#include <chainparams.h>
#include <node/blockstorage.h>
#include <validation.h>
using node::ReadBlockFromDisk;
using node::UndoReadFromDisk;
bool ComputeFilter(BlockFilterType filter_type, const CBlockIndex* block_index, BlockFilter& filter)
{
LOCK(::cs_main);
CBlock block... | TOOL | 0.908405 | 6.779096 |
83d86239-6b42-4815-988e-25692172be0b | liushubosov/Leetcode_Cplusplus | Leetcode_1598.cpp | /*
* 1598. 文件夹操作日志搜集器
每当用户执行变更文件夹操作时,LeetCode 文件系统都会保存一条日志记录。
下面给出对变更操作的说明:
"../" :移动到当前文件夹的父文件夹。如果已经在主文件夹下,则 继续停留在当前文件夹 。
"./" :继续停留在当前文件夹。
"x/" :移动到名为 x 的子文件夹中。题目数据 保证总是存在文件夹 x 。
给你一个字符串列表 logs ,其中 logs[i] 是用户在 ith 步执行的操作。
文件系统启动时位于主文件夹,然后执行 logs 中的操作。
执行完所有变更文件夹操作后,请你找出 返回主文件夹所需的最小步数 。
示例1:
输入:logs = ["d1/","d2/","... | ALGO | 0.997103 | 5.642228 |
5edb20ce-4bf5-461e-922f-e073f26989a2 | ShubhranshuSanjeev/oj-submissions | Codeforces/217A.cpp | #include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <unordered_map>
#include <map>
#define ll long long int
#define pii pair<int,int>
#define FOR(i, st, ed) for(int i = int(st); i < int(ed); i++)
#define divide(l, h, idx) int mid = ... | ALGO | 0.999731 | 4.687841 |
979b994c-5466-4e99-ae03-5cef55df2de3 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_9109_8.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 2e6, MOD = 1e9 + 7;
const long double EPS = 0.000000001;
pair<long long, long long> p[N];
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
long long x, x1, y, y1, n, ans1 = INT_MAX;
cin >> n >> x >> y >> x1 >> y1;
vector<pair<long long, long ... | ALGO | 0.99984 | 3.829039 |
065adb17-6bd8-4db6-a28a-fcde485f9bb9 | LuChenYa1/STM32 | STM32_HAL/STM32G431_HAL/MyCodeBlueCup/HAL_C11/Drivers/CMSIS/NN/Examples/ARM/arm_nn_examples/gru/arm_nnexamples_gru.cpp | /**
* @ingroup groupExamples
*/
/**
* @defgroup GRUExample Gated Recurrent Unit Example
*
* \par Description:
* \par
* Demonstrates a gated recurrent unit (GRU) example with the use of fully-connected,
* Tanh/Sigmoid activation functions.
*
* \par Model definition:
* \par
* GRU is a type of recurrent neura... | ALGO | 0.906199 | 7.46982 |
484571c1-f54d-4d26-a611-a9bbaa137746 | yvodelaere/aoc2021_day_9 | test/heightmap_test.cpp | #include <iostream>
#include <sstream>
#include "../src/heightmap.h"
bool dimensionTest(HeightMap& aHeightMap)
{
bool result = true;
result &= aHeightMap.size() == 5;
result &= aHeightMap[0].size() == 10;
if (!result)
{
std::cout << "TEST: " << __FUNCTION__ << " failed" << std::endl;
}
return result;... | ALGO | 0.898338 | 6.209675 |
31a31b20-647c-4fdc-9195-56b1b01bd464 | vaibhavrepo07/programrepo1 | factfromuptoyou.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int fact , n ;
cin>>n;
for(int i=1;i<=10;i++)
{
fact = n *fact ;
n=n+1;
}
cout<<"The factorial is = "<<fact <<endl;
return 0;
}
| ALGO | 0.99995 | 3.571043 |
5b5b5ce0-fb04-44ab-8327-2aa8c090ec0e | HKUST-Aerial-Robotics/Fast-Planner | uav_simulator/so3_quadrotor_simulator/include/ode/libs/numeric/odeint/examples/solar_system.cpp | #include <iostream>
#include <boost/array.hpp>
#include <boost/numeric/odeint.hpp>
#include "point_type.hpp"
//[ container_type_definition
// we simulate 5 planets and the sun
const size_t n = 6;
typedef point< double , 3 > point_type;
typedef boost::array< point_type , n > container_type;
typedef boost::array< dou... | ALGO | 0.999606 | 5.884721 |
981b8dac-5311-4ad5-a2f2-d07887da231c | 1468362286/Algorithm | CodeForces/884C/14254685_AC_93ms_788kB.cpp | #include <iostream>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;
typedef _int64 ll;
const int maxn =100010;
int a[maxn];
int vist[maxn];
vector<int> vec;
int main()
{
//freopen("in.txt","r",stdin);
int n,i,j;
while(cin>>n)
{
for( i = 1 ; i <= n ; i++)
a[i]=-1,vist[i]=0;
for( ... | ALGO | 0.999912 | 3.368448 |
3cdeb109-4847-4fa4-81ad-983754e20270 | lukkylug/learningcpp | sorts/sort.cpp | /*
* selectioonsort.cpp
*
* Created on: Apr 9, 2018
* Author: a
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "sort.h"
#define num 10
int a[num];
int b[num];
int cc[10];
void p() {
for (int i = 0; i < num; i++) {
printf("%d ", a[i]);
}
}
void swap(int *a, ... | ALGO | 0.999561 | 3.979261 |
1b0e54a4-c0a3-488f-b525-362e69706d1a | tanishqg5325/CodeChef | SPOJ/ARBITRAG.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
int t = 1,n,m,i; string str,str1,str2; double d;
cin>>n;
while(n)
{
double dp[n][n];
memset(dp, 0, sizeof(dp));
unordered_map<string, int> curr;
... | ALGO | 0.999885 | 4.094767 |
967b41a5-dcee-4e21-8619-abfac22171c9 | wxc575843/c | hdu5430.cpp | #include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <algorithm>
using namespace std;
int gcd(int x,int y){
return !y?x:gcd(y,x%y);
}
int main(){
int t;
cin>>t;
while(t--){
int n... | ALGO | 0.999649 | 4.181443 |
4402cc8a-93f9-42d0-b165-cc948d3efcbb | samarth29jc/Leetcode | 214-shortest-palindrome/shortest-palindrome.cpp | class Solution {
public:
string shortestPalindrome(string s) {
int count = kmp(string(s.rbegin(), s.rend()), s);
return string(s.rbegin(), s.rend()).substr(0, s.length() - count) + s;
}
private:
int kmp(const string &txt, const string &patt) {
string newString = patt + '#' + txt;
... | ALGO | 0.999988 | 6.312429 |
34df3b64-6b83-47f3-a79a-49deb9e1819a | marialynne/Advanced-Algorithms | non-attacking-queens/Non_attacking_queens/non-attacking-queens.cpp | // #include<bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <list>
#include <iterator>
#include <functional>
#include <numeric>
#include <utility>
#include <iomanip>
#in... | ALGO | 0.999928 | 5.211644 |
040445a1-d7af-42e1-ade3-883337ee8335 | itoi10/algorithm | tessoku/a17.cpp | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int N, A[100009], B[100009], dp[100009];
int main() {
cin >> N;
for(int i = 2; i <= N; i++)
cin >> A[i];
for(int i = 3; i <= N; i++)
cin >> B[i];
// 動的計画法
dp[1] = 0;
dp[2] = A[2];
for(int i = 3... | ALGO | 0.999998 | 3.686802 |
12355192-9c0e-427c-aeee-c0db24ceafc3 | Ishwarendra/CompetitiveProgramming | CodeForces/GNU C++20 (64)/1981B_Turtle and an Infinite Sequence /1981_B__generator.cpp | #include "bits/stdc++.h"
#ifdef LOCAL
#include "/Users/ishwar/Debug/debug.h"
#else
#define print(...) 1;
#endif
using i64 = long long;
std::mt19937 rng(std::chrono::steady_clock::now().time_since_epoch().count());
template<class T = int>
T get_rand(T l, T r)
{
assert(l <= r);
return std::uniform_int_dist... | TOOL | 0.937872 | 4.213877 |
18e9b47e-ea03-4c8a-bdf0-ec046c89150c | ashok191/CRYPTOGRAPHY-AND-NETWORK-SECURITY | PROG_3.cpp | #include <stdio.h>
#include <string.h>
#include <ctype.h>
#define SIZE 5
char keyMatrix[SIZE][SIZE];
void generateKeyMatrix(const char *key) {
int i, j, k = 0;
int filled[26] = {0};
for (i = 0; i < strlen(key); i++) {
if (!filled[toupper(key[i]) - 'A']) {
keyMatrix[k / SIZE][k % SIZE... | ALGO | 0.999749 | 5.301123 |
ce1970e5-6f39-4c29-94bf-3cb04ee87196 | StrongerProgrammer7/Algorithm-of-computing-math | Cubic_spline_interpolation/Cubic_spline_interpolation.cpp | // Cubic_spline_interpolation.cpp : Этот файл содержит функцию "main". Здесь начинается и заканчивается выполнение программы.
//
#include <iostream>
#include <fstream>
#define COUNT_POINT 6
#define PI 3.1415926
using namespace std;
double function(double);
double* divorceSLAU_iteration(double** matrix, double* y);
d... | ALGO | 0.999546 | 3.142987 |
7b3b8ded-f7fc-4f68-b047-c6ecac257e82 | Siddeshwar002/DSA-again | Stack/remove-k-digits.cpp | #include "stack"
#include "vector"
using namespace std;
class Solution {
public:
string removeKdigits(string num, int k) {
stack<int> st;
int i = 0;
while(i < num.size()) {
while(k > 0 && !st.empty() && st.top() > num[i] - '0') {
st.pop();
k--;
... | ALGO | 0.999954 | 6.827522 |
78c2e223-bc0f-471d-82ea-974e0d955185 | ishandutta2007/codeforces | holyk/normal/1417/F.cpp | #include <cstdio>
#include <cctype>
#include <cstring>
#include <algorithm>
#include <vector>
namespace FastIn {
template <class T>
inline void readInt(T &w) {
char c, p = 0;
while (!isdigit(c = getchar())) p = c == '-';
for (w = c & 15; isdigit(c = getchar()); w = w * 10 + (c & 15));
if (p) w = -w;
}
templat... | ALGO | 0.999883 | 4.32202 |
24b2d566-b1bf-468a-9944-09e91b63a004 | ishandutta2007/codeforces | peti1234/normal/1632/E2.cpp | #include <bits/stdc++.h>
using namespace std;
const int c=300005, k=20;
int w, n, szint[c], fel[c][k], ans[c], d;
vector<int> sz[c], l[c];
bool v[c];
void dfs(int a) {
v[a]=true;
d=max(szint[a], d);
for (int i=1; i<k; i++) {
fel[a][i]=fel[fel[a][i-1]][i-1];
}
for (auto x:sz[a]) {
i... | ALGO | 0.999993 | 4.42968 |
4fdbcd02-1582-4f39-97ae-b6394df97eda | fsq/hackerrank | Funny String.cpp | #include "stdc++.h"
int main() {
int q;
cin >> q;
string s;
while (q--) {
cin >> s;
bool ok = true;
for (int i=0, j=SZ(s)-1; i+1<j; ++i, --j)
if (abs(s[i+1]-s[i]) != abs(s[j]-s[j-1])) {
ok = false;
break;
}
cout << ... | ALGO | 0.997722 | 4.274325 |
703e79e2-6ca1-4693-a623-a54993d82d30 | remote-android/platform_external_swiftshader | third_party/LLVM/lib/Bitcode/Writer/ValueEnumerator.cpp | #include "ValueEnumerator.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Constants.h"
#include "llvm/DerivedTypes.h"
#include "llvm/Module.h"
#include "llvm/ValueSymbolTable.h"
#include "llvm/Instructions.h"
#include <algorithm>
using namespace llvm;
static bool isIntegerValue(cons... | TOOL | 0.976044 | 4.593793 |
ee694428-1484-4069-b48d-d57a9f032648 | amar-linux/cplusplus | c++/cof/1/1-basic/21_mult_arra_2.cpp | #include<iostream>
using namespace std;
int main(){
int arr[10]={1,2,3,4,5,6,7,8,9,10};
for (int i=0; i< 10; i++){
cout << "printing table of " << i << endl;
for (int j =0; j < 10; j++){
cout << (arr[i] * arr[j]) << ", " << flush;
}
cout << endl;
}... | ALGO | 0.984161 | 3.791828 |
3af600a8-51a8-4451-9410-63a309951c16 | zak-soussi/Competitive_Programming_Codeforces | CodeForces/GNU C++20 (64)/1603A | Di-visible Confusion/210174677.cpp | #include <bits/stdc++.h>
#pragma GCC target("bmi,bmi2,lzcnt,popcnt")
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
typedef long long ll;
typedef long double ld;
#define pi pair<int,int>
#define pll pair<ll,ll>
#define all(x) x.begin(), x.end()
const char nl = '\n';
const int infiniint = I... | ALGO | 0.99983 | 4.133662 |
5279b423-09bd-4d05-a4d3-5193f3b4aee9 | zhh2005757/slambook2_in_Docker | slambook2/3rdparty/Pangolin/src/utils/file_utils.cpp | #include <pangolin/platform.h>
#include <pangolin/utils/file_utils.h>
#ifdef _WIN_
# define WIN32_LEAN_AND_MEAN
# include <Windows.h>
# include <Shlobj.h>
#else
# include <dirent.h>
# include <sys/types.h>
# include <sys/stat.h>
# include <sys/signal.h>
# include <stdio.h>
# include <string.h>
# include <un... | TOOL | 0.99427 | 5.957066 |
19993cd3-f966-4b26-82e3-89626c81aeaa | MuhammadAqib-coder/whatsappclone | 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 |
87a44c6e-06f7-4f21-864a-1f5c3e09527a | Mehedi-Hasan-Rabbi/Online-Judge-Solution | CodeForces/793 A. Oleg and shares.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.999914 | 3.845357 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.