uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
6403a6e5-4d05-4c95-a5d5-b1c8a8150f17 | Rockstatata/CP-solves | CSES/Introductory/weirdalgo.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
long long int n;
cin>>n;
cout<<n<<" ";
while(n!=1){
if(n%2==0){
n/=2;
cout<<n<<" ";
}
else{
n=3*n+1;
cout<<n<<" ";
... | ALGO | 0.999978 | 4.878821 |
f1ca5697-d5e0-4054-8074-65e392fa246e | bMazoin/AdventOfCode | j3_p1.cpp | #include <iostream>
#include <sstream>
#include <vector>
#include <unordered_map>
#include <string>
using namespace std;
vector<string> split(const string &str, char delimiter) {
vector<string> vString;
string token;
istringstream tokenStream(str);
while (std::getline(tokenStream, token, delimiter)) {... | ALGO | 0.999423 | 5.110731 |
5902ef9f-1115-4cbd-b82b-e0b4f7a74ae4 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_13138_64.cpp | #include <bits/stdc++.h>
using namespace std;
map<long long int, long long int> ma;
vector<long long int> cases;
string s;
bool find(long long int len) {
long long int val = ma[len];
long long int a = 0;
long long int m = 1e9 + 9;
long long int p = 31, n = s.size(), i;
long long int p_pow = 1;
for (i = 1; i... | ALGO | 0.999991 | 3.102084 |
914f6177-9398-446e-b6c2-f3ec664e9cf2 | ishandutta2007/codeforces | dxqwq/normal/1108/E2.cpp | // Problem: E2. Array and Segments (Hard version)
// Contest: Codeforces - Codeforces Round #535 (Div. 3)
// URL: https://codeforces.com/contest/1108/problem/E2
// Memory Limit: 256 MB
// Time Limit: 2000 ms
//
// Powered by CP Editor (https://cpeditor.org)
// zhoukangyang
#include<bits/stdc++.h>
using namespace st... | ALGO | 0.999978 | 4.063423 |
22ca50c5-4c12-4525-a721-ef09248a53f0 | xilanma/btcutils | main.cpp | #include <iostream>
#include "utilstrencodings.h"
#include "uint256.h"
#include "hash.h"
#include <Python.h>
uint256 CheckMerkleBranch(uint256 hash, const std::vector<uint256>& vMerkleBranch, int nIndex)
{
if (nIndex == -1)
return 0;
for (std::vector<uint256>::const_iterator it(vMerkleBranch.begin()); ... | ALGO | 0.903933 | 5.950323 |
15d82777-805a-4e87-be10-590d2fb6103b | jingzhuwang/CLion | Exercises/4.5.cpp | //
// Created by on 2019/9/17.
//
#include <iostream>
using namespace std;
int findMax(int *nums,int start,int end){
if(start == end){
return nums[start];
}
int mid = (start + end) / 2;
int num1 = findMax(nums,start,mid);
int num2 = findMax(nums,mid+1,end);
if(num1 >= num2) return nu... | ALGO | 0.999376 | 3.983916 |
0ea419b8-6b6e-4c44-a7b3-02c258c40207 | ARAFATH-SH/Problem-Solving | Atcoder/Digits.cpp | #include<bits/stdc++.h>
using namespace std;
int32_t main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n,k;
cin>>n>>k;
int digits = 0;
while(n){
int last_digits = n%k;
digits++;
int drop_last_digit = n/k;
n = drop_last_digit;
}
cout<<digits<<'\n';
return 0;
} | ALGO | 0.999883 | 4.025574 |
fc47de7c-0f2d-4637-b970-aba76832688d | DikDns/Cpp-Journey | 1-cpp-dasar/36_latihan1_array/array.cpp | #include <iostream>
#include <array>
using namespace std;
int main()
{
// Welcome Teks
cout << "O-------------------------------------O\n";
cout << "|-------------------------------------|\n";
cout << "|-------------------------------------|\n";
cout << "|------> Selamat Datang <------|\n";
cout << "|--... | ALGO | 0.955712 | 3.338481 |
6907dadf-9288-49d8-b2e4-9bd737bbb8f9 | haram1117/AlgorithmStudy | Bronze/17094.cpp | //
// Created by haram on 2023-09-09
//
// Problem-Solving #17094
#include <iostream>
using namespace std;
int len;
string s;
int main(){
cin >> len >> s;
int cnt = 0;
for(auto const & elem : s){
if(elem == '2')
cnt++;
}
if(cnt > len - cnt)
cout << 2;
else if(cnt < l... | ALGO | 0.999444 | 3.424539 |
59694e18-92ba-4b9e-b349-8492bb33d55c | saadqaiser11/PD-Semester1 | Programing Fundamentals/PF Lab9/task6.cpp | #include <iostream>
using namespace std;
int largestNum(int list[], int num);
main()
{
int num;
cout << "Enter the number of elements: ";
cin >> num;
int list[num];
cout << "Enter " << num << " numbers, one per line: " << endl;
for(int x=0; x<num ; x++)
{
cin >> list[x];
}
... | ALGO | 0.990879 | 3.533954 |
670b61b2-7c3e-4694-ab13-af3c02eed9b8 | trungdangtapcode/Competitive-Programming-Notebook | archived/my_desktop_grade12/2022/vboard.cpp | #include<bits/stdc++.h>
using namespace std;
int n, a[505][505], q, x, y, u, v, sign[] = {1,-1};
int main(){
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
cin >> n;
for (int i = 1; i <= n; i++) for (int j = 1; j <= n; j++){
cin >> a[i][j];
a[i][j] = sign[(i+j)%2]*a[i][j] + a[i-1][j] + a[i][j-1] - a[i-1][j... | ALGO | 0.999881 | 4.366773 |
2f3b6fe3-2f80-4d6a-b872-bf4c697be823 | b2389085/src | gnu/llvm/llvm/lib/Analysis/LoopNestAnalysis.cpp | #include "llvm/Analysis/LoopNestAnalysis.h"
#include "llvm/ADT/BreadthFirstIterator.h"
#include "llvm/ADT/DepthFirstIterator.h"
#include "llvm/Analysis/ValueTracking.h"
using namespace llvm;
#define DEBUG_TYPE "loopnest"
#ifndef NDEBUG
static const char *VerboseDebug = DEBUG_TYPE "-verbose";
#endif
/// Determine whe... | TOOL | 0.91363 | 7.91153 |
83a65a43-9db7-4c4c-b238-e829b0f781e8 | shivam-369/practice | codechef/June challenge/bitwise_tuples.cpp | #include <iostream>
using namespace std;
#define MAX (10 * 10 * 10 * 10 * 10 * 10 * 10 * 10 * 10 + 7)
long long int power(long long int x, long long int y)
{
long long int ans = 1;
if (y == 0)
return 1;
else
y %= MAX;
x %= MAX;
while (y > 0)
{
if (y % 2)
{
... | ALGO | 0.999949 | 4.625717 |
910735a0-1856-40cd-aa38-b5abb7a197ed | raincross7/code-similarity | codes/train_code/problem380/problem380_91.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i, n) FOR(i,0,n)
int main(void){
int N,M,sum=0;
cin >> N >> M;
vector<int> A(M+10);
REP(i,M){
int A;
cin >> A;
sum += A;
}
if(N-sum < 0) cout << "-... | ALGO | 0.999928 | 3.262206 |
61be2e38-f139-457a-8670-ef408e18d30e | NYTCEE/LeetCode | 0162-find-peak-element/0162-find-peak-element.cpp | class Solution {
public:
int findPeakElement(vector<int>& nums) {
int l = 0; //定義變數l(左邊界)並初始化為0,即陣列的起始索引
int r = nums.size() - 1; //定義變數r(右邊界)並初始化為陣列的最後一個元素的索引
while (l < r) { //while迴圈,當l小於r時,繼續迴圈
const int m = (l + r) / 2; //計算l和r的中點索引,存在m中
if (nums[m] >= nums[m + 1])
... | ALGO | 0.999961 | 4.942194 |
8361b9db-f4aa-4c10-be5a-4bd574800cb7 | AbhinavShukla2020/Competitive-Programming | USACO/Gold/Graphs/Solved/MooTube.cpp | #include <iostream>
#include <vector>
#include <set>
#include <string>
#include <unordered_set>
#include <unordered_map>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <cassert>
#include <math.h>
using namespace std;
using pii = pair<int,int>;
using vi = vector<int>;
#define endl "\... | ALGO | 0.999959 | 4.286652 |
4e596c18-5ee6-4b2c-ae79-c59cfaee553c | foobarberis/42-common-core | cpp-modules/02/ex03/src/main.cpp | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.cpp :+: :+: :+: ... | ALGO | 0.974389 | 5.388976 |
94b32723-f055-40ef-b7e3-e7739bfb4109 | daviscoder/Leetcode_2016_Pass1 | 111. Minimum Depth of Binary 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:
int minDepth(TreeNode* root) {
if (root == NULL)
return 0;
if (root... | ALGO | 0.999937 | 6.666591 |
e25ba085-5832-47d1-a2b8-cb827399b1fa | SeokgyuYun/baekjoon | c++/1003.cpp | // 1003번: 피보나치 함수
#include <iostream>
using namespace std;
int main() {
int num_of_testcase, num;
int zero_and_one[41] = {0, 1, 1};
for (int i = 3; i < 41; i++)
zero_and_one[i] = zero_and_one[i - 1] + zero_and_one[i - 2];
cin >> num_of_testcase;
while (num_of_testcase--) {
cin >... | ALGO | 0.999952 | 4.476425 |
2b63f6c5-cff8-4a81-b784-b7ae1c3e8055 | runlnr/solid-octo-sniffle | Codeforces/367A - Sereja And Algorithm.cpp | #include <bits/stdc++.h>
#define ss second
#define ff first
#define endl "\n"
#define sp ' '
#define pback push_back
using namespace std;
typedef long long ll; typedef string str;
const ll MOD = 1e9+7, N = 1e5+7, J = 1e3+7;
//chetmeorroiroiorr
int ar[N][5];
str s;
void equ(int i, int ch) {
ar[i][ch] = ar[i-1][ch... | ALGO | 0.999748 | 3.94771 |
19446c6b-1a99-4818-91c3-79ec9357e60b | tudelft3d/3D_Urban_Mesh_Annotator | CGAL/examples/BGL_LCC/copy_lcc.cpp | #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/boost/graph/graph_traits_Linear_cell_complex_for_combinatorial_map.h>
#include <CGAL/boost/graph/copy_face_graph.h>
#include <iostream>
#include... | ALGO | 0.993524 | 5.887483 |
d991deca-e827-4258-9ee6-1084fa1e5bb7 | areian13/PS_BOJ | 3. Gold/Gold 5/[G5] 01660 캡틴 이다솜.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#define FastIO ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr)
using namespace std;
int main()
{
FastIO;
int n;
cin >> n;
vector<int> s;
int t = 1;
while (true)
{
int k = t * (t + 1) * (t + 2) / 6;
... | ALGO | 0.999902 | 4.500907 |
82c30d32-fcbf-4fbd-99dd-08ec03bbaefe | vikash18o19/Leetcode-and-Gfg | 103-binary-tree-zigzag-level-order-traversal/103-binary-tree-zigzag-level-order-traversal.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.999992 | 6.194214 |
5dca9399-8b91-4a67-9b5d-f7af090fc32e | raincross7/code-similarity | codes/train_code/problem233/problem233_320.cpp | #include<bits/stdc++.h>
#include<boost/variant.hpp>
using namespace std;
typedef long long ll;
typedef vector<boost::variant<bool, ll, int, string, double, char*, const char*>> any;
template<typename T> inline void pr(const vector<T> &xs){
for(int i=0; i<xs.size()-1; i++) cout<<xs[i]<<" ";
(xs.empty()?cout:(cout<<xs[... | ALGO | 0.999954 | 3.809925 |
245249ea-0344-43dc-9f80-a8cf8608fe89 | vallarasuk/LeetCode | solutions/1980. Find Unique Binary String/1980-2.cpp | class Solution {
public:
string findDifferentBinaryString(vector<string>& nums) {
string ans;
// Flip the i-th bit for each nums[i] so that `ans` is unique.
for (int i = 0; i < nums.size(); ++i)
ans += nums[i][i] == '0' ? '1' : '0';
return ans;
}
};
| ALGO | 0.999322 | 6.579353 |
255ca1c4-0ca0-4118-bfc8-fe5cdc79d45e | manikanta2901/ubuntu | .history/codingChallenges/cpp/DSA/basicOptimisationTechniques/string_20200623222231.cpp | #include<bits/stdc++.h>
#include<algorithm>
#define EXECUTE_FASTER ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
// #define loop(s,e) for(int i = s; i <= e; i++)
#define rep(e) for(int i = 0; i < e; i++)
#define printVect(vect,dataStruct) for(vector<dataStruct> :: iterator it = vect.begin(); it !=vec... | ALGO | 0.998779 | 3.330471 |
f11da01b-3808-49e4-8154-a030daa8d976 | Surbhi-Jain-02/Programming | Math/Reverse Integer.cpp | // Reverse digits of an integer.
// Example1:
// x = 123,
// return 321
// Example2:
// x = -123,
// return -321
// Return 0 if the result overflows and does not fit in a 32 bit signed integer
int Solution::reverse(int A) {
long long res=0;
int n = A;
while(n){
res=res*10+n%10;
if(res>... | ALGO | 0.999627 | 4.662162 |
25206126-c801-40f2-99af-339659613f3a | David-5-5/tutorial | cplus/leetcode/202503/algo1824.cpp | #include <bits/stdc++.h>
using namespace std;
// 动态规划 - 多维 DP
class Solution {
public:
int minSideJumps(vector<int>& obstacles) {
// 参考题解 动态规划
int n = obstacles.size();
vector<int> dp = {1, 0, 1}; // 每条赛道的初始侧跳次数
for (int i=1; i<n; i++) {
int minCnt = INT_MAX;
... | ALGO | 0.999913 | 4.934641 |
7928ff88-82c4-40f3-af66-fd7c5611ced3 | QuantumGhost/yuzu | src/common/fs/fs_android.cpp | #include "common/android/android_common.h"
#include "common/android/id_cache.h"
#include "common/assert.h"
#include "common/fs/fs_android.h"
#include "common/string_util.h"
namespace Common::FS::Android {
void RegisterCallbacks(JNIEnv* env, jclass clazz) {
env->GetJavaVM(&g_jvm);
native_library = clazz;
... | TOOL | 0.906779 | 6.638678 |
defb355a-8bb4-4f69-8105-12faf4d4f110 | omaffezzolli/Lince_Tech_ | academy_pratica_f1/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.998715 | 6.76073 |
14a0f866-9c07-45f1-aeab-8e9ee6467ba2 | zmd9220/object-trainning | 9-5/9-5/main.cpp | #include <iostream>
#include "quadratic.h"
#include <string>
#include <cmath>
using namespace std;
int main()
{
quadratic a(3, 7, 1);
quadratic c(2, 1, 3);
a.add(c);
cout << a.toString() << endl;
a.subtract(c);
cout << a.toString() << endl;
cout << a.solve() << endl;
} | ALGO | 0.964932 | 3.907889 |
056a7472-7449-45d6-b5a4-50c161b328f5 | ThePhong1803/cnn | inc/eigen3/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_visitors.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main()
{
Eigen::MatrixXf m(2,2);
m << 1, 2,
3, 4;
//get location of maximum
MatrixXf::Index maxRow, maxCol;
float max = m.maxCoeff(&maxRow, &maxCol);
//get location of minimum
MatrixXf::Index minRow, m... | ALGO | 0.999576 | 4.010038 |
74127330-37fe-40f9-a7f5-0641fab86060 | Debashish-hub/100-Days-Of-Coding | Day 10/Sort the numbers.cpp | // Sort the Numbers
// Some problems are like a mirage. They seem to have a different solution when you see it first but as you deep dive
// you realize the solution is something else.
// Next, we are going to solve one such problem.
// You are given an array consisting of 0's, 1's and 2's. Your task is to sort the a... | ALGO | 0.999974 | 6.002616 |
5699d077-ffc9-48bb-bb82-0b256a58bd9a | JLM2025/Pro1algoritmos | Tarifa de carros.cpp | #include <iostream>
using namespace std;
float calcularCargos(int horas) {
if (horas <= 3) {
return 2.00;
}
float cargoExtra = (horas - 3) * 0.50;
if (cargoExtra > 7.00) {
return 10.00;
}
return 2.00 + cargoExtra;
}
int main() {
int horas[3];
float cargos[3];
float total = 0;
for (i... | ALGO | 0.996928 | 4.768472 |
28940309-3188-470b-9f54-538613faaf85 | Rajugit07/DSA | Day-5/Classnote/primeno.cpp | #include <iostream>
#include <cmath>
using namespace std;
int main()
{
bool isPrime = true;
int n;
cout << "Enter a Number:";
cin >> n;
// for (int i = 2; i <= n - 1; i++)
// {
// if (n % i == 0)
// {
// isPrime = false;
// break;
/... | ALGO | 0.999381 | 3.431841 |
7424a7a7-ade6-4dde-9199-5ed567cf568d | Yeonji-Lim/ps-log | Algorithm/Graph/DisjointSet/DisjointSet_Cycle.cpp | #include <iostream>
using namespace std;
int V, E;
int parent[100];
bool cycle = false;
int find_parent(int child) {
if(parent[child] != child) {
parent[child] = find_parent(parent[child]);
}
return parent[child];
}
void union_parent(int x, int y) {
// int p_x = find_parent(x);
// int p_y ... | ALGO | 0.999965 | 5.323171 |
88543915-c817-4d61-a069-5b9f6146ebe9 | ArtMoc/Fibonacci | Fibonacci/main.cpp | #include <iostream>
using namespace std;
void Fibonacci(int f);
void main()
{
setlocale(LC_ALL, "");
int f = 0;
cout << "Enter the extreme limit of the series: "; cin >> f;
Fibonacci(f);
}
void Fibonacci(int f)
{
static int a = 0, b = 1, c = 1;
if (a > f)return;
cout << a << '\t';
c = (a = b) + (b = c);
Fibon... | ALGO | 0.999658 | 3.539916 |
29bef56c-0b5f-4dd2-b31d-55068c694325 | johnnysof/foxer666-node-multi-hashing | crypto/wild_keccak.cpp | // keccak.c
// 19-Nov-11 Markku-Juhani O. Saarinen <<EMAIL>>
// A baseline Keccak (3rd round) implementation.
#include "wild_keccak.h"
namespace crypto
{
const uint64_t keccakf_rndc[24] =
{
0x0000000000000001, 0x0000000000008082, 0x800000000000808a,
0x8000000080008000, 0x000000000000808b, 0x000000008000... | ALGO | 0.999822 | 6.705164 |
930986a3-47b8-4a16-b245-974c6d3edcee | qhb1001/For-that-dream | 丝雨小姐姐/qhb/temp.cpp | #include <iostream>
#include <queue>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
deque<int>dq;
dq.push_front(10);
cout << dq.back() << endl;
for (int i = 1; i <= 10; i += 2) dq.push_back(i);
for (auto it = dq.begin(); it != dq.end(); ++it)
cout << *it << endl;
}
| ALGO | 0.986207 | 3.837507 |
d21ed4ad-3c19-4c59-8d68-640335e11170 | yoru4890/coding_test | 프로그래머스/unrated/181931. 등차수열의 특정한 항만 더하기/등차수열의 특정한 항만 더하기.cpp | #include <string>
#include <vector>
using namespace std;
int solution(int a, int d, vector<bool> included) {
int answer = 0;
for(const auto& e : included){
if(e){answer += a;}
a+=d;
}
return answer;
} | ALGO | 0.99845 | 4.334004 |
197f3ea0-9502-4aa0-ad14-3b8b0276caea | r00tk1ts/leetcode-solution | algorithm/array/medium/nextPermutation.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
class Solution{
public:
void nextPermutation(vector<int>& nums){
if(nums.size() <= 1)
return ;
int target = nums.size() - 1;
while(--target >= 0){
if(nums[target] < nums[target+1]){
... | ALGO | 0.999987 | 4.723159 |
860b068b-d5c2-4747-b0f9-933318e0f9e1 | MahdisRezaei2/Data-Structures-and-Algorithm-C- | Labs/lab3/lab3.cpp |
#include <iostream>
// Recursive function to find the sum of number of paths
int numPathsFromHome( int street, int avenue){
// We have base cases here
if (street ==0 || avenue ==0){
return 1;
}
else{
/**
* if street or avenue is not equal to 0, we nee... | ALGO | 0.997572 | 4.789646 |
75a7b821-5610-4ad8-ad11-4ccc7e3d9e32 | tushar54594/LeetcodeQuestions | 230-kth-smallest-element-in-a-bst/230-kth-smallest-element-in-a-bst.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.99999 | 5.777947 |
d2fd6a96-7635-484c-ab5a-eb212bd55d6b | amanbhala/Leetcode | DP/DivisorGame.cpp | class Solution {
public:
bool divisorGame(int n) {
vector<bool>dp(n+1,false);
dp[0]=false;
dp[1]=false;
dp[2]=true;
dp[3]=false;
for(int i=4;i<=n;i++){
if(i%2!=0){
dp[i]=!dp[i-1];
}else{
for(int j=1;j<=n/2;j++){
... | ALGO | 0.999945 | 5.506855 |
56fe34a2-02bc-43af-b6e5-da23f0e84b0d | hege/ch24 | 2003_qual/A/Letters.cpp |
#include <string>
#include <stdio.h>
#include <conio.h>
#include <assert.h>
#include <libpng/png.h>
#include <TernaryGraph/bitvector.h>
struct sLetter
{
char name;
bit_vector *bitpic;
size_t count;
};
#ifdef _DEBUG
void waitBeforeExit()
{
printf("Press any key to exit...");
getch();
}
#endif
int main( int ... | TOOL | 0.980837 | 4.117877 |
b680aa43-be5b-4000-a974-6ba788c8632b | QiaoZhang0429/Cpp-Leetcode | BestMeetingPoint.cpp | class Solution {
public:
int minTotalDistance(vector<vector<int>>& grid) {
vector<int> rows;
vector<int> cols;
for(int i = 0; i < grid.size(); i++){
for(int j = 0; j < grid[0].size(); j++){
if(grid[i][j] == 1){
rows.push_back(i);
... | ALGO | 0.999974 | 6.336653 |
d1588c5c-73d8-4d04-92f4-c71bcae6f7a9 | uosorio/heroku_face | venv/boost_1_73_0/libs/graph/example/interior_pmap_bundled.cpp | #include <boost/config.hpp>
#include <iostream>
#include <algorithm>
#include <boost/graph/adjacency_list.hpp>
#include <boost/property_map/property_map.hpp>
#include <string>
using namespace std;
using namespace boost;
/*
Interior Property Map Basics
An interior property map is a way of associating properties
... | ALGO | 0.999729 | 5.044138 |
0243ac54-716f-450d-a606-9e90fd47f281 | zhiwei1988/LeetCode | 3-longest-substring-without-repeating-characters/solution.cpp | class Solution {
public:
int lengthOfLongestSubstring(string s) {
int n = s.length();
int left = 0;
int longest = 0;
unordered_set<char> chSet;
for (int i = 0; i < n; i++) {
char ch = s[i];
auto ret = chSet.insert(ch);
while (!ret.second) {... | ALGO | 0.999914 | 6.353357 |
97038de8-de8f-4d2f-b98e-fb242623d7cb | SumitM28/Cpp | 30_Greedy/04_survive.cpp | // Check if it is possible to survive on Island
#include <bits/stdc++.h>
using namespace std;
int minimumDays(int S, int N, int M)
{
int sunday = S / 7;
int buyingDays = S - sunday;
int totalFood = S * M;
int ans = 0;
if (totalFood % N == 0)
{
ans = totalFood / N;
}
else
{... | ALGO | 0.999939 | 3.995456 |
45483c73-0520-4328-aed4-83b272628351 | gzgreg/ACM | 2018-01-06/F.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;
int parent[1001];
int find(int x) { return x == parent[x] ? x : parent[x] = find(parent[x]); }
void merge(int x, int y) { parent[find(x)] = find(y); }
int main(){
ios::syn... | ALGO | 0.999999 | 3.855191 |
d41c7e4f-8989-42e9-8c53-80f03764baec | Vinasque/sorting-ed | Tree/main.cpp | #include <iostream>
#include <chrono>
#include <cstdlib>
#include "functions.h"
using namespace std;
using namespace functionsTree;
using namespace std::chrono;
int main()
{
Node<int>* root = nullptr;
root = insertNode(root, 42);
root = insertNode(root, 13);
root = insertNode(root, 11);
root ... | ALGO | 0.995889 | 3.145525 |
2e55cdfe-0de4-4d62-9959-be443255ef4d | sith228/vkr2021 | src_client/rotors_simulator/rotors_control/src/library/roll_pitch_yawrate_thrust_controller.cpp | #include "rotors_control/roll_pitch_yawrate_thrust_controller.h"
namespace rotors_control {
RollPitchYawrateThrustController::RollPitchYawrateThrustController()
: initialized_params_(false),
controller_active_(false) {
InitializeParameters();
}
RollPitchYawrateThrustController::~RollPitchYawrateThrustCon... | ALGO | 0.926812 | 7.261931 |
56b3c0a2-2c72-431c-8b8f-8d748a3661d5 | astha736/SoccerForOmniDriveRobot | src/navigation/global_planner/src/orientation_filter.cpp | #include <global_planner/orientation_filter.h>
#include <tf2/LinearMath/Matrix3x3.h>
#include <tf2/utils.h>
#include <tf2_geometry_msgs/tf2_geometry_msgs.h>
#include <angles/angles.h>
namespace global_planner {
void set_angle(geometry_msgs::PoseStamped* pose, double angle)
{
tf2::Quaternion q;
q.setRPY(0, 0, angl... | ALGO | 0.994241 | 6.874287 |
777fb40d-b2e6-4229-8459-bfeae8656dba | ComKinBio/biomassChemistryMBMFoam | biomassCombustion/eigen-3.4.0/unsupported/doc/examples/PolynomialSolver1.cpp | #include <unsupported/Eigen/Polynomials>
#include <vector>
#include <iostream>
using namespace Eigen;
using namespace std;
int main()
{
typedef Matrix<double,5,1> Vector5d;
Vector5d roots = Vector5d::Random();
cout << "Roots: " << roots.transpose() << endl;
Eigen::Matrix<double,6,1> polynomial;
roots_to_mo... | TEST | 0.998785 | 4.659281 |
f6de67c0-e0dd-45ee-9ff0-dd3afbb0465b | thejoelw/inverse-code-3 | src/main.cpp | #include <iostream>
#include <iomanip>
#include <assert.h>
#include "uintspy.h"
#include "algorithm.h"
int main(int argc, char *argv[])
{
/*
std::uint8_t input[] = {
'a', 'b', 'c', 'd'
};
std::uint32_t output[4];
md5<std::uint8_t, std::uint32_t>(input, 4, output);
for (unsigned int i... | TEST | 0.992849 | 6.090709 |
421932b0-cbd9-49da-a4e6-f5dc64650420 | umerghafoor/FAST-NUCES_work | C++/OOP/Assignment-1/q4.cpp | #include <iostream>
using namespace std;
/*Q4: Write a program that takes a pointer to array of integers.
Create a dynamic array of integers through CreateArray() function
(without recursion). After that pass it to the sum function to
calculate sum of perfect numbers using recursion.(10)
NOTE: A perfect number is a num... | ALGO | 0.995247 | 4.194702 |
16acb629-f196-429d-9666-ec7bb97cfbec | ashir98/EcoEats | 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.998784 | 6.761023 |
f2e42880-bd76-4577-b42a-fca78414a66d | nazmulh24/Basic_Data_Structures_CPP | Basic Data Structures/Week 1/24_06_09_module_2/prog_4.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
// vector<int> v = {5, 1, 3, 9, 4, 5, 3, 7, 5, 9};
// cout << v.back() << endl;
// cout << v[0] << endl;
// cout << v.at(3) << endl;
//
vector<int> v = {2, 5, 1, 7, 4, 9};
// vector<int>::iterator it;
// for (it = v.begin(); i... | ALGO | 0.94035 | 3.815283 |
a04f9550-f69e-4df8-8bc9-a964ee59e695 | riscv-spectre-mitigations/llvm_retpoline | llvm/lib/CodeGen/MachineVerifier.cpp | #include "llvm/ADT/BitVector.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/DepthFirstIterator.h"
#include "llvm/ADT/PostOrderIterator.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SetOperations.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
#include ... | TOOL | 0.905063 | 7.814706 |
009d546d-a15e-4de9-92d8-f11d78d6a90c | ishandutta2007/codeforces | hyperbolic/normal/1726/A.cpp | #include <stdio.h>
int x[100010];
int main()
{
int T;
scanf("%d",&T);
while(T--)
{
int a;
scanf("%d",&a);
for(int i=1;i<=a;i++) scanf("%d",&x[i]);
if(a==1)
{
printf("0\n");
continue;
}
int val;
val = x[2];
for(int i=2;i<=a;i++) val = val>x[i]?val:x[i];
int ans = -12345678;
ans = a... | ALGO | 0.999889 | 3.239639 |
90cb7b32-bf3a-4dea-9df0-7624272c25f4 | ndb796/python-for-coding-test | 7/2.cpp | #include <bits/stdc++.h>
using namespace std;
// 이진 탐색 소스코드 구현(재귀 함수)
int binarySearch(vector<int>& arr, int target, int start, int end) {
if (start > end) return -1;
int mid = (start + end) / 2;
// 찾은 경우 중간점 인덱스 반환
if (arr[mid] == target) return mid;
// 중간점의 값보다 찾고자 하는 값이 작은 경우 왼쪽 확인
else if ... | ALGO | 0.99996 | 6.470741 |
34410f1e-a875-4a62-94fe-fea8361611a5 | WEGFan/Algorithm-Contest-Code | online-judge/Luogu/Luogu 1801.cpp | #include <iostream>
#include <cstdio>
#include <queue>
using namespace std;
const int N = 2e5 + 7;
long long add[N], get[N];
priority_queue<long long> a;
priority_queue<long long, vector<long long>, greater<long long>> b;
int main()
{
int m, n;
scanf("%d %d", &m, &n);
for (int i = 1; i <= m; i++)
{
... | ALGO | 0.999965 | 3.202741 |
8b1b8c05-480a-44a4-ab46-0c803e2162c6 | sharma-aayush/cpp-competetive-stuff | C++/random/balance.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll F = 1000000000;
#define zero 0;
int main()
{
ll z = 0;
ll t;
cin >> t;
while(t--)
{
string str;
cin >> str;
ll len = str.length(), i,j, ans = 1000000000, alpha[26] = {0}, use[26], count =0;
for(i = 0; i < len; i++)
{
alpha[(int)str[... | ALGO | 0.999865 | 3.904209 |
f6e00984-4551-4499-9dd7-fa902922f8c7 | shivgupta198922/CodeForces-Master-in-cpp | 1657B.cpp | /*
~ Author : @tridib_2003
*/
#pragma GCC optimize("O3")
// #pragma GCC optimize("Ofast")
// #pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag,
tree_orde... | ALGO | 0.999321 | 3.714306 |
a2f226f2-63f3-413e-85f4-524b4a75153b | lcnzg/lammps-pi | src/npair_full_nsq_ghost.cpp | #include "npair_full_nsq_ghost.h"
#include "neigh_list.h"
#include "atom.h"
#include "atom_vec.h"
#include "molecule.h"
#include "domain.h"
#include "my_page.h"
#include "error.h"
using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */
NPairFullNsqGhost::NPairFullNsqGh... | ALGO | 0.950952 | 4.937032 |
0c2e51a1-44bc-4aa6-b974-3452e03a31ff | adelacvg/luogu | 动态规划3 区间与环形动态规划/P1880.cpp | #include<bits/stdc++.h>
using namespace std;
const int maxn=220;
int a[maxn];
int dp_min[maxn][maxn];
int dp_max[maxn][maxn];
int suf[maxn];
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
int n;
cin>>n;
for(int i=1;i<=2*n;i++)
for(int j=i+1;j<=2*n;j++)
dp_min[i][j]=1000000;
... | ALGO | 0.99995 | 3.490892 |
efb8ec23-9273-4a62-9498-35ec138e2c10 | harshjoeyit/CP | validate_binary_tree.cpp | #include <bits/stdc++.h>
using namespace std;
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(... | ALGO | 0.999987 | 6.204987 |
f18f091b-d0ac-460f-bab7-c767e2a8a9f8 | ishandutta2007/codeforces | timsei/normal/832/B.cpp | using namespace std;
#include<bits/stdc++.h>
char bef[1000001],af[1000001],good[1000001],pi[1000001];
int l,cnt,it;
bool well[256],flag = 0;
int main() {
scanf("%s",good);
int lw=strlen(good);
for(int i = 0;i < lw ;i ++ ) {
well[good[i]]=1;
}
scanf("%s",bef);
l = strlen(bef);it=-1;
for(int i = 0;i < l; i ++) {... | ALGO | 0.999985 | 3.56594 |
0635ed77-8334-42b1-8e09-51b59269c9a5 | svn2github/qmcpack | trunk/src/QMCTools/gto2slater.cpp | struct GTO2Slater
{
typedef GaussianCombo<double> GTOType;
typedef LogGrid<double> GridType;
bool Normalized;
GridType myGrid;
xmlNodePtr gridPtr;
map<string,xmlNodePtr> sPtr;
GTO2Slater():Normalized(false),gridPtr(0) {}
int parse(const char* fname);
bool put(xmlNodePtr);
void opt... | TOOL | 0.929633 | 6.210792 |
14fc664a-68fd-4f86-86da-fc6cae008ce5 | NhuQuynhLea/pro_thuat_toan | thuat toan sinh/F_sinh hoan vi.cpp | #include <bits/stdc++.h>
using namespace std;
int a[100], n, check;
void gen()
{
int i = n - 1;
while (i >= 1 && a[i] > a[i + 1])
i--;
if (i == 0)
check = 0;
else
{
int j = n;
while (a[i] > a[j])
j--;
swap(a[i], a[j]);
sort(a + i + 1, a + ... | ALGO | 0.999964 | 3.794594 |
6d325dda-085e-451d-9119-f2066eb96a69 | wpn-zju/LeetCode-Dump | dump-cn/348.design-tic-tac-toe.cpp | class TicTacToe {
public:
int n;
vector<int> reAVec;
vector<int> reBVec;
TicTacToe(int n) {
this->n = n;
reAVec = vector<int>(2 * n + 2, 0);
reBVec = vector<int>(2 * n + 2, 0);
}
int move(int row, int col, int player) {
return player * (player == 1 ? ++reAVec[row] == n | ++reAVec[n + col] == n | ((row =... | ALGO | 0.999596 | 6.13273 |
e4dd675c-6c2c-41e4-b1e8-e8497ba8376b | Ihtml/PAT | AdvancedLevel_C++/1013-Battle-Over-Cities-[图的遍历]-[连通分量]-25.cpp | #include <algorithm>
#include <cstdio>
using namespace std;
bool visit[1010];
int n, v[1010][1010];
void dfs(int node) {
visit[node] = true;
for (int i = 1; i <= n; i++) {
if (visit[i] == false && v[node][i] == 1)
dfs(i);
}
}
// 求去除了某个结点之后其他的图所拥有的联通分量数a
// 当a个相互分离的连通分量需要变为连通图的时候,只需要添加a-1... | ALGO | 0.999865 | 3.929404 |
7f3b9a0d-528d-422c-9df2-be373997406b | Equlnox/IITP-ACM-Notebook | code/graphs/Globalmincut.cpp | // Adj mat. Stoer-Wagner min cut algorithm.
// Running time:O(|V|^3)
typedef vector<int> VI;
typedef vector<VI> VVI;
const int INF = 1000000000;
pair<int, VI> GetMinCut(VVI &weights) {
int N = weights.size();
VI used(N), cut, best_cut;
int best_weight = -1;
for (int phase = N-1; phase >= 0; phase--) {
... | ALGO | 0.999968 | 4.70707 |
eb65a99a-a903-4d6c-ace2-53b9efeacb1a | competitive-verifier/zzz_idat50me_cpp_lib | test/aoj_2429.test.cpp | // competitive-verifier: PROBLEM https://onlinejudge.u-aizu.ac.jp/problems/2429
#ifndef call_include
#define call_include
#include <bits/stdc++.h>
using namespace std;
#endif
#include "graph/mincostflow_nega.cpp"
#include "structure/2d_array.cpp"
int main() {
int N;
cin >> N;
v2d<int> W(N, N), E(N, N);
v2d<char>... | ALGO | 0.998318 | 4.025684 |
b506fba4-9b0d-45eb-a7e9-a5480aad6743 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_8088_6.cpp | #include <bits/stdc++.h>
using namespace std;
void getre() {
int x = 0;
printf("%d\n", 1 / x);
}
void gettle() {
int res = 1;
while (1) res <<= 1;
printf("%d\n", res);
}
template <typename T, typename S>
inline bool upmin(T &a, const S &b) {
return a > b ? a = b, 1 : 0;
}
template <typename T, typename S>
i... | ALGO | 0.999942 | 4.637721 |
906b048f-ef89-4632-ba90-2d8f21137b6e | proydakov/codeforces | Codeforces_Round_#676/A/solution.cpp | #include <vector>
#include <cstdint>
#include <iostream>
#include <algorithm>
void solve()
{
std::uint64_t a, b;
std::cin >> a >> b;
auto const ixor = a ^ b;
std::cout << ixor << '\n';
}
int main()
{
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
std::cout.tie(nullptr);
in... | ALGO | 0.99994 | 5.066715 |
b84886d5-1473-4e5a-b943-6780add2bfb9 | AhJo53589/leetcode-cn | problems/count-of-smaller-numbers-after-self/SOLUTION.cpp |
//////////////////////////////////////////////////////////////////////////
vector<int> countSmaller(vector<int>& nums)
{
if (nums.empty()) return {};
if (nums.size() == 1) return { 0 };
vector<int> counts(nums.size(), 0);
vector<int> sort_nums;
sort_nums.push_back(nums[nums.size() - 1]);
size_t i = nums.size(... | ALGO | 0.999979 | 6.072444 |
7f483962-c8b9-4c2d-9942-7940e2a1232e | NotRin7/Palladium | src/util/strencodings.cpp | #include <util/strencodings.h>
#include <util/string.h>
#include <tinyformat.h>
#include <algorithm>
#include <cstdlib>
#include <cstring>
#include <errno.h>
#include <limits>
static const std::string CHARS_ALPHA_NUM = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
static const std::string SAFE_C... | TOOL | 0.988682 | 6.271759 |
9bd2d806-5dde-48dc-a16c-77f1bf401ddf | kifah-s/Problem_Solving | Gammal_Tech_Academy/2_C++_Programming_Language/Exercises/Pro_204_Clear_All_Elements_Program/Clear_All_Elements_Program_V1.cpp |
//* Clear All Elements Program (Version 1).
/*
* write a program to Add the elements 5, 9, 200, and -3 to
* a vector and Clear all elements from a vector.
! Output:
! Elements in vector: 0
*/
#include <iostream>
#include <array>
#include <vector>
#include <algorithm>
using namespace std;
void resultFun(vector<in... | ALGO | 0.96567 | 4.925353 |
78932cb5-d2c4-41de-a356-599aadff6dbb | pnookala/X-OpenMP | clang/tools/libclang/CIndexHigh.cpp | #include "CursorVisitor.h"
#include "CLog.h"
#include "CXCursor.h"
#include "CXSourceLocation.h"
#include "CXTranslationUnit.h"
#include "clang/AST/DeclObjC.h"
#include "clang/Frontend/ASTUnit.h"
#include "llvm/Support/Compiler.h"
using namespace clang;
using namespace cxcursor;
using namespace cxindex;
static void g... | TOOL | 0.888047 | 6.834373 |
82e1f83c-1059-48c2-a7e1-53921f06b65d | dangbach3107/PTIT_cpp | tamgiacvuong.cpp | #include<bits/stdc++.h>
#define f0(i, a) for(int i = 0; i < a; i++)
#define f1(i, a) for(int i = 1; i <= a; i++)
#define read ios::sync_with_stdio(false); cin.tie(nullptr);\
freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
using namespace std;
#define ll long long
int main(){
in... | ALGO | 0.999794 | 4.410302 |
9603ef97-f89b-45ee-a3c3-68b21253d606 | Chizer77/ALGPractices | Practice01/TEXQuotes.cpp | //输入
//输入由若干行包含偶数个双引号(" )字符的文本组成。输入由EOF字符结束。
//输出
//除了下述情况,输出的文本要和输入的一样:
//每对双引号中的第一个 " 被替换为两个` 字符,并且,每对双引号中的第二个 " 被替换为两个 ' 字符。
//来源:POJ 1488,UVA 272
#include<iostream>
using namespace std;
const char p[][5] = {"``", "''"};
int main() {
int k = 0;
char c;
while ((c = getchar()) != EOF) {
if(c == ... | ALGO | 0.999462 | 3.432369 |
e2c201ae-369c-4a68-9cec-87a77397fbb1 | jikongabc/test-jikong | xin6_12.cpp | #include<iostream>
#include<cstring>
#include<string>
using namespace std;
int a[100005], b[100005];
int main(){
int n, x;
int t = 0;
int res = 0;
cin >> n >> x;
for(int i = 0; i < n; i++){
cin >> a[i];
}
for(int i = 0; i < n; i++){
cin >> b[i];
}
for(int i = 0; i < n; i++){
if(b[i] == 1){
t += a[i];
... | ALGO | 0.999926 | 3.287869 |
84d3d0db-74e8-451e-a4a4-21354e3afd23 | kekeblom/mpm | include/igl/copyleft/cgal/signed_distance_isosurface.cpp | #include "../../AABB.h"
#include "../../per_face_normals.h"
#include "../../per_edge_normals.h"
#include "../../per_vertex_normals.h"
#include "../../centroid.h"
#include "../../WindingNumberAABB.h"
#include <CGAL/Surface_mesh_default_triangulation_3.h>
#include <CGAL/Complex_2_in_triangulation_3.h>
#include <CGAL/mak... | ALGO | 0.998859 | 6.437604 |
886005b8-03f0-4d21-91bb-5d419336a9de | ubAI6689/CodeForces | Practise/1000/B_Badge.cpp | #include <iostream>
#include <vector>
int main()
{
int n; std::cin>>n;
std::vector<int> v;
for (int i=0,x; i<n && std::cin>>x; i++)
v.push_back(x);
for (int i=1; i<=n; i++)
{
int array[n+1]={0};
array[i]++;
int index=v[i-1];
while(true)
{
... | ALGO | 0.999998 | 3.827528 |
f8b3c325-afe7-4bc8-8b63-541a59c3bf5b | duanjiaojiao316/LeetCode | C++/Leetcode/Solution540.cpp | #include <vector>
using namespace std;
/**
* LeetCode540
* 以O(logN)的时间复杂度
*/
class Solution {
public:
int singleNonDuplicate(vector<int>& nums) {
int low = 0, high = nums.size() - 1;
while (low < high) {
int mid = (high - low) / 2 + low;
if (nums[mid] == nums[mid ^ 1]) {
... | ALGO | 0.999924 | 5.418113 |
77e5f66e-38d8-4266-b2e2-05ea092e70dd | Xilinx/llvm-aie | libc/src/math/nvptx/fmaxf.cpp | #include "src/math/fmaxf.h"
#include "src/__support/CPP/bit.h"
#include "src/__support/common.h"
#include "src/__support/macros/config.h"
#include "src/__support/macros/optimization.h"
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(float, fmaxf, (float x, float y)) {
return __builtin_fmaxf(x, y);
}
} // names... | ALGO | 0.862952 | 6.381597 |
02af04ed-8945-4406-b8f3-829b27716177 | newmind/algorithm | cpp/p9663_N-Queen.cpp | #include <algorithm>
#include <iostream>
#include <string>
using namespace std;
const int N = 15;
bool _col[N] = {false,};
bool _slash[N * 2 - 1] = {false,}; // slash / , i = x+y
bool _slash2[N * 2 - 1] = {false,}; // back slash \ , i = 3+(x-y)
int g_count = 0;
void find_queen(int n, int y, int q_count) {
i... | ALGO | 0.999935 | 4.694485 |
6a54f527-f26a-40a8-99eb-d3839e92b469 | 6o9puH/Labs_PSTU | Sem_1/2_20/2_20.cpp | #include <iostream>
#include <cmath>
using namespace std;
int main()
{
float n, s, a;
int i = 1;
bool flag = false;
cin >> n >> s;
while (i <= n && !flag)
{
a = sin(n + i / n);
a = round(a * 10) / 10;
cout << n + i / n << "|" << a << endl;
if (a == s)
... | ALGO | 0.999822 | 3.192444 |
f138a233-7ea2-44eb-86de-e005c8424ad4 | DeepanshuLuhach/Codeforces | 204B_div1.cpp | /**
** Submission by DragonFist @Deepanshu Luhach
*/
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef map<unsigned long long,unsigned long long> mp;
int main()
{
ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
ull n,moves=0,min=INT_MAX,i=0;
... | ALGO | 0.999957 | 3.472109 |
367d5f29-28a1-439b-ab96-f149e2544dac | JeromeGJH/LeetCode | 0975_2.cpp | class Solution {
public:
int oddEvenJumps(vector<int>& arr) {
int l = arr.size();
if(l == 1){
return 1;
}
vector<pair<int, int>> dp(l, pair<int, int>(0, 0));
vector<pair<int, int>> next(l, pair<int, int>(-1, -1));
dp[l-1].first = 1;
dp[l-1].second... | ALGO | 0.999955 | 4.902681 |
4bc4232f-b774-439b-8754-21b420da6f18 | FiaDot/coding-test-cpp17 | bakjoon/dynamic_programming/rpg_min_cost.cpp | //
// Created by LEE GUNHO on 2023/03/23.
//
// RGB 거리 : https://www.acmicpc.net/problem/1149
#include <iostream>
using namespace std;
int main()
{
int house;
cin >> house;
long dp[1001][3] = {0L, }; // 값 커지니 타입 주의!, 초기화.
int cost[3];
for(int n=1;n<=house;n++)
{
cin >> cost[0] >> co... | ALGO | 0.997989 | 4.814844 |
f050c4e5-c3e5-4d53-a987-98b3d1705cb0 | Henrik-Yao/NEUQ-ACM-Solution | winter-day5/崔梓晖/7.cpp | #include <iostream>
#include <algorithm>
#include <cstdio>
using namespace std;
int t,n,c,a[100001];
int pd(int x)
{
int now=a[1];
int pos=1;
for(int i=2;i<=n;i++)
{
if(a[i]-now>=x)
{
now=a[i];
pos++;
}
if(pos>=c)
return 1;
}
return 0;
}
int main()
{
scanf("%d%d", &n,&c);
for(int i... | ALGO | 0.999998 | 3.705105 |
5c81dd37-b77a-4dc9-b4d4-32b61cab9890 | Rexx0801/codeptit_c_cpp | dayngoacdungdainhat.cpp | #include <iostream>
#include <stack>
using namespace std;
int main(){
int t;
cin>>t;
while(t--){
int dem = 0;
stack <int> s;
s.push(-1);
string X;
cin>>X;
for(int i = 0; i<X.size(); i++){
if(X[i] == '('){
s.push(i);
} else{
s.pop();
if(s.size()>0) dem = max(dem,i-s.top())... | ALGO | 0.999455 | 3.842701 |
c1c1241e-e55e-49eb-b275-f98bdfe71200 | Nayassyl/pp1 | lab88/b.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
int n;
cin >> n;
vector<int> v;
for ( int i = 0; i < n; i++){
int x;
cin >> x;
v.push_back(x);
}
for ( int i = n - 1; i >=0; i--){
cout << v[i] << " ";
}
} | ALGO | 0.99995 | 4.575421 |
8d042317-6fec-423b-a308-c276a9037a57 | m-in-the-power-of-3/librepilot_2017 | ground/gcs/src/libs/eigen/doc/examples/function_taking_ref.cpp | #include <iostream>
#include <Eigen/SVD>
using namespace Eigen;
using namespace std;
float inv_cond(const Ref<const MatrixXf>& a)
{
const VectorXf sing_vals = a.jacobiSvd().singularValues();
return sing_vals(sing_vals.size()-1) / sing_vals(0);
}
int main()
{
Matrix4f m = Matrix4f::Random();
cout << "matrix m:... | ALGO | 0.999786 | 5.283265 |
7e05b4b1-f9b6-49ce-85d7-006cb5a4a81f | raincross7/code-similarity | codes/train_code/problem378/problem378_44.cpp | #include<iostream>
using namespace std;
int main(){
long long a,i,x,y,z;
int n;
cin>>n;
x=1000000;
y=-1000000;
z=0;
for(i=0;i<n;i++){
cin>>a;
if(a<x)x=a;
if(a>y)y=a;
z+=a;
}
cout<<x<<" "<<y<<" "<<z<<"\n";
return 0;
} | ALGO | 0.999874 | 3.068464 |
14e17549-0e21-4f47-8278-3ec0a0acc5e8 | Rinnnt/CompetitiveProgramming | Baekjoon/14268.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define nl '\n'
ll nums[100001];
ll t[4 * 100001];
ll tstart[100001];
ll tend[100001];
vector<int> edges[100001];
ll timer = -1;
void euler_tour(int c, int p) {
tstart[c] = ++timer;
for (auto x : edges[c])
if (x != p)
euler_tour(x, c);... | ALGO | 0.99995 | 4.32066 |
42c18c46-00d2-4ddf-b502-30bfc576d026 | Spautov/HW_C | HW_4/HW_FUNC_4_5.cpp | #include <iostream>
void happy_num(int num);
int main()
{
int numbr;
do
{
std::cout << "Enter the 6th-place number: ";
std::cin >> numbr;
}
while(numbr<100000 || numbr> 999999 );
happy_num(numbr);
return 0;
}
void happy_num(int num)
{
int sum_left = 0;
int sum_right = 0;
... | ALGO | 0.989215 | 4.051919 |
60cae7c7-6cfb-4390-b7c0-35ee47d67ba4 | artificialdeligence/Codeforces-A-solutions | 266A.cpp | #include<bits/stdc++.h>
using namespace std;
string b;
int a,c;
int main(){
cin>>a>>b;
for(int i=0;i<a;i++){
if(b[i] == b[i+1]){
c++;
}
}
cout<<c;
} | ALGO | 0.999949 | 3.225336 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.