uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
654e2af7-0cc8-4251-92a9-6fb7d6db6efb | The-Artist-CN/Algorithm | interview/string/Solution_01_02.cpp | #include <iostream>
#include <string>
#include <algorithm>
using namespace std;
bool canPermute(string s1, string s2) {
// ๅฆๆ้ฟๅบฆไธๅ๏ผ็ดๆฅ่ฟๅ false
if (s1.length() != s2.length()) {
return false;
}
// ๅฏน s1 ๅ s2 ่ฟ่กๆๅบ๏ผๅๅฐๆๅบ๏ผ
sort(s1.begin(), s1.end()); // ๆญฃ็กฎ่ฐ็จ sort
sort(s2.begin(), s2.end()); ... | ALGO | 0.999924 | 5.734543 |
f2285260-2e5d-4ca7-98f0-7e7d7d9ef14a | lucastarche/aotd | Searching/011-BinarySearch.cpp | //Binary Search
//Reduces the search space in half with every comparison, by taking advantage of the fact that the array is sorted. Needs O(n log n) preprocessing, but then always runs in O(log n).
//Best case complexity: O(1)
//Average case complexity: O(log n)
//Worst case complexity: O(log n)
#include <bits/stdc++.h... | ALGO | 0.999992 | 5.812551 |
b0436bd6-684e-4089-8a5e-962e494d6426 | ekgns33/ProblemSolving | boj/p1106.cpp | //
// Created by ๋ฌธ๋คํ on 2023/11/23.
//
/*
*
* main goal : C๋ช
์ด์์ ๊ณ ๊ฐ์ ์ํด ํฌ์ํ๋ ๋์ ์ต์๊ฐ.
*
* c๋ช
์ผ๋ ๋์ ์ต์๊ฐ๋ง ๊ตฌํ๋ฉด๋จ.
*
* i๋ช
์ผ๋ ๋์ ์ต์๊ฐ์?
* 0 ~ i-1์์ i์ ๋๋ฌํ ์ ์๋ ๋ฐฉ๋ฒ๋ค ์ค ๊ฐ์ฅ ์์ ํฌ์๊ฐ.
*
*
* */
#include <bits/stdc++.h>
using namespace std;
int main(void) {
ios::sync_with_stdio(0);
cin.tie(0);
int C, N;
cin >> ... | ALGO | 0.999899 | 5.092665 |
22a01c36-6af6-405a-8afc-9e5cb58e2a09 | ioanstoica/FMI | An_2/Sem_II/AA/lab/lab4/codificare.cpp | // https://cms.fmi.unibuc.ro/problem/genetici1
#include <bits/stdc++.h>
using namespace std;
string TO(double x, double a, double d, int l)
{
string s;
int n = (x - a) / d;
for (int i = 0; i < l; i++)
{
s += (n % 2) + '0';
n /= 2;
}
reverse(s.begin(), s.end());
return s;
}
double FRO... | ALGO | 0.997193 | 4.078263 |
9d3b6180-62a3-494c-9160-6b9fc2e04fcf | raincross7/code-similarity | codes/train_code/problem086/problem086_123.cpp | #include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cmath>
#include<cstdio>
#include<queue>
#include<deque>
#include<map>
#include<stack>
#include<set>
#include<tuple>
using namespace std;
typedef pair<int,int> ii;
typedef long long ll;
typedef pair<ll,ll> pll;
const int INF=1e9;
const ll ... | ALGO | 0.999994 | 3.196225 |
40ccbee7-5a8e-410b-aac1-8f10d86fb9c9 | Ayush1thakur/VS_Code-notes | c++/Array_01.cpp | /*Find num of 7 in c*/
#include <iostream>
using namespace std;
int main(){
int arr[100] = {1,7,5,7,6,9,7};
int flag = 0;
for (int i=0 ; i<=100 ; i++){
cin>>arr[i];
}
for (int j=0 ; j<=100 ; j++){
if (arr[j]==7){
flag++;
continue;
}
else{
... | ALGO | 0.998894 | 3.317468 |
8ca503b9-37d7-41f2-a792-fe31f3e4d81b | rhdeng/Codes | ch3/UVa1583.cpp | // UVa1583(LA3355) Digit Generator
// Rujia Liu
#include<stdio.h>
#include<string.h>
#define maxn 100005
int ans[maxn];
int main() {
int T, n;
memset(ans, 0, sizeof(ans));
for(int m = 1; m < maxn; m++) {
int x = m, y = m;
while(x > 0) { y += x % 10; x /= 10; }
if(ans[y] == 0 || m < ans[y]) ans[y] = m... | ALGO | 0.999888 | 4.545897 |
ad14b7e6-c773-427c-86c6-3a3227f7328b | DeanChensj/LeetCode | Medium/330_Patching-Array.cpp | #include <iostream>
#include <queue>
#include <vector>
#include <string>
using namespace std;
int minPatches(vector<int>& nums, int n) {
long missingLeastSum = 1;
int pathCnts = 0, i = 0;
while (missingLeastSum <= n) {
if (i >= nums.size() || nums[i] > missingLeastSum) {
... | ALGO | 0.999684 | 4.604589 |
6d2820a6-fb86-4f39-9b8d-02e415679053 | jampio/jampog | code/game/g_mover.cpp | #include "bg_public.h"
#include "../cgame/cg_local.h"
#include "g_functions.h"
#include "objectives.h"
#include "g_local.h"
#include "../icarus/IcarusInterface.h"
int BMS_START = 0;
int BMS_MID = 1;
int BMS_END = 2;
extern void G_SetEnemy( gentity_t *self, gentity_t *enemy );
void CalcTeamDoorCenter ( gentity_t *ent... | ALGO | 0.921262 | 3.962722 |
7b1d8256-120f-487a-99b7-403156fe2082 | hi-ogawa/practice | codeforces/contest/1457/e/main.cpp | // AFTER EDITORIAL, WIP
// NOTE: this is incorrect.
#include <bits/stdc++.h>
using namespace std;
#define ALL(X) (X).begin(), (X).end()
#define FOR(I, X, Y) for (auto I = decltype(Y)(X); I < (Y); ++I)
using ll = int64_t;
using ull = uint64_t;
namespace std {
template<class ...Ts> istream& operator>>(istream& ... | ALGO | 0.999939 | 4.592734 |
3ba1dd59-1e11-4d16-89bd-0e60117c5ac1 | Runarok/GeeksForGeeks-solutions | Difficulty: Basic/C++ STL | Set 3 (map)/c-stl-set-3-map.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
void add_value(map<int,int> &m,int x,int y);
int find_value(map<int,int> &m,int x);
void print_contents(map<int,int> &m);
int main() {
// your code goes here
int t;
cin>>t;
while(t--)
{
map<int,int> m;
int q;
cin>>q;
while(q--)
{
c... | ALGO | 0.994315 | 4.990972 |
6f2a03d7-715f-472b-a295-0e54f06b300f | Adarshkumbar/Data-Structures-And-Algorithms | POTD/01_NumberOf1Bits.cpp | // Number of 1 Bits
// Given a positive integer N, print count of set bits in it.
/*Input:
N = 6
Output:2
Explanation:
Binary representation is '110'
So the count of the set bit is 2.
*/
//{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
//... | ALGO | 0.999832 | 6.231041 |
14601d99-3ada-443f-9a62-c1a28cd781c9 | adityaranjan182/cpp-practice | Arrays/array-10.cpp | /*Given an array A of positive integers. Your task is to find the leaders in the array.
An element of array is leader if it is greater than or equal to all the elements to
its right side. Also, the rightmost element is always a leader.
*/
#include <bits/stdc++.h>
using namespace std;
// Function to find the leaders... | ALGO | 0.999921 | 4.878137 |
fb72761d-67e0-404b-b152-57dbd5cdf529 | adityasrathore/Codes | LeetCode/1137. N-th Tribonacci Number.cpp | class Solution {
public:
int t[38];
int solve(int n){
if(n==0)
return 0;
if(n==1 || n==2)
return 1;
if(t[n]!=-1)
return t[n];
return t[n]=solve(n-1)+solve(n-2)+solve(n-3);
}
int tribonacci(int n) {
memset(t,-1,sizeof(t));
... | ALGO | 0.999988 | 5.80697 |
b32b4a42-d478-456a-8f41-0100312a4bf3 | ishandutta2007/codeforces | aqt/normal/590/D.cpp | #include <bits/stdc++.h>
using namespace std;
int N, K, S;
int arr[155];
long long dp[2][155][12000];
//k, pos, swapval
int main(){
cin >> N >> K >> S;
for(int i = 1; i<=N; i++){
cin >> arr[i];
}
long long ans = 0;
if(N*(N-1)>>1 <= S){
sort(arr, arr+1+N);
for(int i= 1; i<=... | ALGO | 0.999981 | 3.911507 |
1f393c86-5ace-4ce7-aceb-384e44c27e35 | Mirocidij/ACMP | cpp/ACMP854.cpp | #include <iostream>
#include <math.h>
#include <string>
using namespace std;
int main() {
int tr, tc;
string str;
cin >> tr >> tc >> str;
switch (str[0]) {
case 'f':
if (str[1] == 'a') {
cout << tr;
} else {
cout << min(tr, tc);
... | ALGO | 0.997377 | 3.657096 |
246c9410-0538-4fb8-a93f-45967e9518bb | ermine27/competitive-programming | src/atcoder/abc/236/236-c.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); ++i)
int main() {
int n,m;
cin >> n >> m;
vector<string> s(n);
map<string,int> t;
rep(i,n) cin >> s[i];
string str;
rep(i,m){
cin >> str;
t[str]=1;
}
rep(i,n) cout << (t.co... | ALGO | 0.999807 | 4.727104 |
09966967-21f0-469b-959d-f3c383a237ea | lisnb/leetcode | leetcode/Triangle/ๆบ.cpp | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
class Solution {
public:
int minimumTotal(vector<vector<int> > &triangle) {
for (int level = triangle.size() - 2; level >= 0; --level)
{
for (auto i = 0; i < triangle.at(level).size(); ++i)
{
... | ALGO | 0.999942 | 5.412336 |
d84e35de-a539-4e79-beb6-63ddacd241e1 | valentine9510/Leetcode-Solutions | Blind75 Questions/Datastructures_And_Algorithms/Permutations_Backtracking/generate_parantheses.cpp | #include <bits/stdc++.h>
using namespace std;
/*
Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.
Example 1:
Input: n = 3
Output: ["((()))","(()())","(())()","()(())","()()()"]
Example 2:
Input: n = 1
Output: ["()"]
Constraints:
*/
/*
bool isBalanced(string... | ALGO | 0.999847 | 6.629798 |
de89ef15-c5e1-42c3-afef-132ba3536f64 | nguyet0901/08CNPM_0850080087_Nguyen-Thi-Thanh-Nguyet_TH5 | Bai1/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.998505 | 6.783439 |
3cd2adea-ca94-4cb9-8b6b-4fcac39b2690 | thegamer1907/Code_Analysis | contest/1542589621.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 101;
string a[N];
string s;
int n;
int main () {
#ifdef LOCAL
freopen ("in", "r", stdin);
#endif
ios_base :: sync_with_stdio (0);
cin.tie (0);
cin >> s;
cin >> n;
for (int i = 1; i <= n; ++i) {
cin >> a[i];
}
... | ALGO | 0.99995 | 3.849967 |
f0d7c961-270a-4d63-beb6-57a932b4f281 | ajha1054/codes | Circular Linked List.cpp | #include <iostream>
using namespace std;
struct node
{
int val;
node *next;
};
node *start;
void insert(int x)
{
node *t = start;
if (start != NULL)
{
while (t->next != start)
{
t = t->next;
}
node *n = new node;
t->next = n;
n->val = x;
n->next = start;
}
else
{
node *n = new node;
n->... | ALGO | 0.99577 | 4.271244 |
f2c4b048-9ade-44a5-bf96-e301bb7101b9 | koba-e964/contest | csacademy/round-78/xor-transform.cpp | #include <iostream>
#include <vector>
#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define DEBUGP(val) cerr << #val << "=" << val << "\n"
using namespace std;
typedef long long int ll;
typedef vector<int> VI;
struct SplitMix64 {
unsigned long long nextInt() {
unsigned long long z = (x += 0x9E377... | ALGO | 0.99978 | 3.945131 |
517c3e99-5367-434a-bf7f-ece843eabc5c | ainan-ahmed/UVA-Solved-Problems | UVA 524 (Prime Ring Problem).cpp | #include <bits/stdc++.h>
#define PI acos(-1)
using namespace std;
#define MX 32
vector<int>ans;
bool taken[17];
int n;
int primes[MX];
bool flag[MX];
void sieve()
{
for(int i=4;i<=MX;i+=2)
flag[i]=1;
int sq=sqrt(MX)+1;
int total=0;
for(int i=3;i<=sq;i+=2)
{
if(fla... | ALGO | 0.999878 | 4.004705 |
d3db033d-1591-477c-b929-137b952ffe5a | WD-Projects/cpp-programs | sorting/insertion_sort.cpp | #include <iostream>
using namespace std;
void insertionSort(int a[], int low, int high)
{
for (int j = low + 1; j < high; j++)
{
int temp = a[j];
int i = j - 1;
while ((temp < a[i]) && i >= 0)
{
a[i + 1] = a[i];
i--;
}
a[i + 1] = temp;
... | ALGO | 0.999819 | 4.878318 |
330d7852-d829-4213-b5ec-7edba7ef766f | Falstring/smolderforge-core-709f33c6e865 | src/server/scripts/EasternKingdoms/Karazhan/boss_maiden_of_virtue.cpp | /* ScriptData
SDName: Boss_Maiden_of_Virtue
SD%Complete: 100
SDComment:
SDCategory: Karazhan
EndScriptData */
#include "ScriptPCH.h"
#define SAY_AGGRO -1532018
#define SAY_SLAY1 -1532019
#define SAY_SLAY2 -1532020
#define SAY_SLAY3 -1532021
#define SAY_REPENTANC... | TOOL | 0.872441 | 6.716614 |
769b82af-f2a3-4c77-800d-503a74bbe8ef | tscui/CTCI | Chapter 5 | Bit Manipulation/Q5.3/c++.cpp | int next(int x) {
int max_int = ~(1<<31);
int num = count_one(x);
if(num == 0 || x == -1) return -1;
for(++x; count_one(x) != num && x < max_int; ++x);
if(count_one(x) == num) return x;
return -1;
}
int previous(int x) {
int min_int = (1<<31);
int num = count_one(x);
if(num == 0 || ... | ALGO | 0.999615 | 4.101048 |
fb75ede6-a787-4b12-97ff-efda7a8d4981 | javagovindsharma/leetscode | solution/0700-0799/0731.My Calendar II/Solution.cpp | class MyCalendarTwo {
public:
MyCalendarTwo() {
}
bool book(int startTime, int endTime) {
++m[startTime];
--m[endTime];
int s = 0;
for (auto& [_, v] : m) {
s += v;
if (s > 2) {
--m[startTime];
++m[endTime];
... | ALGO | 0.999944 | 6.103529 |
785b0e4b-5aa0-4794-9cfc-f7573e596c38 | Mayanklakhina/Leetcode-Practice-Problems | 1833-maximum-ice-cream-bars/1833-maximum-ice-cream-bars.cpp | class Solution {
public:
int maxIceCream(vector<int>& costs, int coins) {
sort(costs.begin(), costs.end());
int count = 0;
// covering edge case
if(coins < costs[0]){
return 0;
}
for(int i = 0; i < costs.size(); i++) {
... | ALGO | 0.999583 | 6.029819 |
046d501d-94e2-454d-871b-0fd882905f14 | foy4748/Phitron | Semester3/Week2/Day2/g_spell_check.cpp | #include <bits/stdc++.h>
#define endl "\n"
//#define ll long long int
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
// Write your code here
string spelling = "Timur";
sort(spelling.begin(), spelling.end());
int T;
cin >> T;
while (T--) {
int N;
cin >> N;... | ALGO | 0.999958 | 6.233534 |
7ecc1587-45d6-482d-8063-893a521c1f8a | kumar21-crypto/DSA_PRACTICE_2022 | Tree/preorder_traversal.cpp | #include<bits/stdc++.h>
using namespace std;
class Node
{
public:
int data;
Node* left;
Node* right;
Node* createnode(int data);
void preorder(Node* p);
};
// 4
// / \
// 1 6
// / \
// 5 2
// root -> left -> right
Node* Node :: createnode(int data)
{
No... | ALGO | 0.999926 | 4.922715 |
086a2397-0390-4c01-b917-7fafcbf23935 | ichraqBelmahi/TP6-IDC | IDC_3D/libigl/include/igl/copyleft/cgal/piecewise_constant_winding_number.cpp | template < typename DerivedV, typename DerivedF>
IGL_INLINE bool igl::copyleft::cgal::piecewise_constant_winding_number(
const Eigen::PlainObjectBase<DerivedV> & V,
const Eigen::PlainObjectBase<DerivedF> & F)
{
Eigen::Matrix<CGAL::Epeck::FT,Eigen::Dynamic,3> VV;
Eigen::Matrix<typename DerivedF::Scalar,Eigen::Dy... | ALGO | 0.997971 | 5.366938 |
df5e6eec-9eae-46af-b075-60f583a5ac6e | ainan-ahmed/UVA-Solved-Problems | UVA 11500 (Vampires).cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define mkp make_pair
#define pii pair<int,int>
#define piii pair<pii,int>
#define vi vector<int>
#define PI acos(-1)
#define a... | ALGO | 0.998442 | 3.709542 |
16efa219-c69a-4012-9cf4-95c29343310a | ACELab-SHU/LCTES-25-Artifact | zoozve/mlir/lib/Dialect/Affine/Utils/Utils.cpp | #include "mlir/Dialect/Affine/Utils.h"
#include "mlir/Dialect/Affine/Analysis/Utils.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Affine/IR/AffineValueMap.h"
#include "mlir/Dialect/Affine/LoopUtils.h"
#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#includ... | ALGO | 0.982515 | 8.328005 |
4e620c73-75e2-4702-9892-713583912472 | wisdompeak/LeetCode | Greedy/3012.Minimize-Length-of-Array-Using-Operations/3012.Minimize-Length-of-Array-Using-Operations.cpp | class Solution {
public:
int minimumArrayLength(vector<int>& nums)
{
sort(nums.begin(), nums.end());
for (int i=1; i<nums.size(); i++)
if (nums[i]%nums[0]!=0)
return 1;
int i = 0;
while (i<nums.size() && nums[i]==nums[0])
i++;
... | ALGO | 0.999892 | 5.188452 |
57ef8fb9-a10e-455a-806e-ce886d7457c3 | Kanis-Fatema-Shanta/LeetCode | 1.Longest Common Prefix.cpp | class Solution {
public:
string longestCommonPrefix(vector<string>& strs){
int n =strs.size();
string ans;
sort(strs.begin(), strs.end());
string a = strs[0];
string b = strs[n-1];
for(int i =0; i< a.size(); i++){
if(a[i] == b[i]){
ans += ... | ALGO | 0.999831 | 5.622683 |
1b4db323-01a3-42a2-9302-0eb27d51f11a | bear24rw/gamingcape_fceu | src/drivers/common/scale3x.cpp | #include "../../types.h" //mbg merge 7/17/06 added to get rid of __restrict__ in msvc
#include "scale3x.h"
#include <assert.h>
/***************************************************************************/
/* Scale3x C implementation */
static inline void scale3x_8_def_border(scale3x_uint8* __restrict__ dst, const sc... | ALGO | 0.93711 | 5.940704 |
1ccc5c20-7cff-48bb-af3e-f010e670347f | Saifahmeed/CodeForces-Solutions | Code/Mishka_and_Game.cpp | #include <bits/stdc++.h>
#define mp make_pair
#define SAIFf ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
typedef long double ld;
typedef long long ll;
const ll oo = LONG_LONG_MAX;
const ll mod = 1e9 + 7;
using namespace std;
vector<char> alph = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k',... | ALGO | 0.99996 | 3.923662 |
1b694c28-5d63-40f0-b9a7-86eb4f65a668 | quanghm/UVA-online-judge | heap.cpp | /*
* heap.cpp
*
* Created on: May 4, 2015
* Author: Quang Hoang
*/
#include<iostream>
using namespace std;
class MaxPQ{
private:
int keys[500];
int N=0;
void swim(int k){
while (k>1&&less(k/2,k)){
exch(k/2,k);
k/=2;
}
}
void sink(int k){
while (2*k<=N){
int j=2*k;
if (j<N&& less(j,j+... | ALGO | 0.999637 | 4.06908 |
c96f5e9d-5ae1-4ccc-b8f6-6d69d255810c | drgnbon/Venio | dependencies/eigen-3.4.0/doc/examples/QuickStart_example2_dynamic.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace Eigen;
using namespace std;
int main()
{
MatrixXd m = MatrixXd::Random(3,3);
m = (m + MatrixXd::Constant(3,3,1.2)) * 50;
cout << "m =" << endl << m << endl;
VectorXd v(3);
v << 1, 2, 3;
cout << "m * v =" << endl << m * v << endl;
}
| ALGO | 0.999393 | 3.497552 |
b5100d4f-1655-4b8e-ab54-ceb75557ded0 | ishandutta2007/codeforces | benq/normal/1556/G.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = long double; // or double, if TL is tight
using str = string; // yay python!
// pairs
using pi = pair<int,int>;
using pl = pair<ll,ll>;
using pd = pair<db,db>;
#define mp make_pair
#define f first
#define s second
#define tcT template<c... | ALGO | 0.999864 | 4.896253 |
e8c08f72-5f38-43cc-900b-017cae9d225d | meowmeow321/cp-snippets | some good fuckin snippets/USACO-master/Contests/USACO Solutions/2019-20/Open/Silver/cereal.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef double db;
typedef string str;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef pair<db,db> pd;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<db> vd;
typedef vector<str> vs;
typedef... | ALGO | 0.999947 | 3.637546 |
71bf7077-8edb-408e-b4d4-90a79daa8444 | ishandutta2007/codeforces | green_gold_dog/normal/731/A.cpp | #include <bits/stdc++.h>
typedef long long ll;
using namespace std;
const ll INF = 1'000'000'000'000'000;
template<typename T>
bool assign_min(T& a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template<typename T>
bool assign_max(T& a, T b) {
if (a < b) {
a = b;
return true;
}
return fal... | ALGO | 0.999683 | 3.636028 |
8e94e51d-a1f1-4424-8959-855917d8c676 | Clarathms/Linguagem-C | sequencia.cpp | #include <stdio.h>
int main () {
int n,ns1,k,ns2,i,j;
printf("Quantos nmeros sero colocados em S1? "); // Definir S1
scanf("%d",&n);
printf("\n");
int matn [n]; // vetor de n
for (int i = 0 ; i < n ; i++) {
printf("Digite o %d nmero (de 1 a 100): ",i+1);
scanf("%... | ALGO | 0.993929 | 3.034703 |
5c1c877f-3aee-49bf-9815-5c3912bf2b90 | Gemechu-Asfaw/Leetcode-Problems | Two_Sum/submission3.cpp | class Solution {
public:
vector<int> twoSum(vector<int>& nums, int target) {
vector<int> ans(2,-1);
for (int i=0; i<nums.size(); i++){
for (int j=i+1; j<nums.size(); j++){
if (nums[i]+nums[j] == target){
ans[0] = i;
ans[1] = j;
... | ALGO | 0.999735 | 6.244181 |
9e6995e0-631b-4484-ad8e-5217b4d84ad3 | GeeKY03/cppcodesolutions | hfjhfdjfhfjdjfjdfjdh.cpp | #include<iostream>
using namespace std;
#define ll long long int
int main(){
ll t;
cin>>t;
while(t--){
ll a,b,c;
cin>>a>>b>>c;
ll half= abs(a-b);
if(half==1){
cout<<-1<<endl;
}
else if((a>2*half)||(b>2*half)||(c>2*half)){
cout<<-1<<endl;
}
else{
if(c<=half){
cout<<c+half<<endl;
}
... | ALGO | 0.999943 | 4.100659 |
d6081464-cad2-4a21-9691-7b7082c40b6d | ishandutta2007/codeforces | molamola/normal/737/A.cpp | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <iostream>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pi;
#defi... | ALGO | 0.999972 | 3.132792 |
2a1cfae1-a4ef-4dfd-aaef-3aa547824569 | milanow/LeetCodePractice | 400+/410_Split_Array_Largest_Sum.cpp | /* 410. Split Array Largest Sum
* Binary search. canSplit function calculates if "mid" can be sumed up by numbers in nums
* If when target is reached, a "cut" is performed to cut out a subarray.
* If cuts is not enough, then the target, aka mid, cannot be reached. Then left = mid+1
* because mid cannot be reached. ... | ALGO | 0.999985 | 6.258725 |
5d932a7d-2447-40a1-9fab-f57df5fce95c | ashitoshk/-6companies30days | Goldman Sachs/5.Ugly numbers.cpp | #include <bits/stdc++.h>
using namespace std;
#define ull unsigned long long
class Solution{
public:
// #define ull unsigned long long
/* Function to get the nth ugly number*/
ull getNthUglyNo(int n) {
// code here
ull arr[n];
ull ia=0,ib=0,ic=0, m2=2,m3=3,m5=5,next=1;
arr[0]=1;
for(int i=1;i<n... | ALGO | 0.999982 | 4.985178 |
285090be-7470-4f6e-b4c6-4d0aed9612b1 | chency-june/HDOJ_my_answer | 2037.cpp | #include <iostream>
#include <algorithm>
using namespace std;
const int maxn = 100;
struct Show {
int s, e;
} show[maxn];
bool cmp_e(Show a, Show b) {
return a.e < b.e;
}
int main(void) {
int n;
while (cin >> n, n > 0) {
for (int i = 0; i < n; i++) {
cin >> show[i].s >> show[i].... | ALGO | 0.999759 | 4.069671 |
44437516-ec6a-4383-92ac-048d29df8cd9 | PaukIsUha/optimizing_formating_code | predictions/submissions-aizu-coop-gpt4/Codenet/p02271/456459619/response_9.cpp | #include <iostream>
#include <vector>
#include <cstring>
using namespace std;
int main() {
int n, t;
cin >> n;
vector<int> N(n);
for (int i = 0; i < n; i++) {
cin >> N[i];
}
cin >> t;
vector<int> dp(20000, false);
dp[0] = true;
for (int i = 0; i < n; i++) {
for (int j = dp.size() - 1; j >= N[... | ALGO | 0.999805 | 4.327626 |
c4348d71-cb54-4fe0-a422-0ab3835a2aa2 | wj1224/algorithm_solve | swea/cpp/swea_1208.cpp | #include <iostream>
using namespace std;
int T, Testcase, N;
int map[100];
int maxValue = -10000;
int minValue = 10000;
int maxValueind;
int minValueind;
int res;
int main() {
Testcase = 10;
for (T = 0; T < Testcase; T++) {
cin >> N;
for (int i = 0; i < 100; i++) {
cin >> map[i];
}
for (int i = ... | ALGO | 0.999587 | 3.488682 |
9e69b48b-8efe-4213-802e-f4d6f11ba9f9 | ashrafulhoda789/Codeforces-Solution | C_Premutation.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t;
cin >> t;
map<int,int> mp;
while(t--){
int n;
cin >> n;
vector<vector<int>> v(n,vector<int>(n-1));
vector<int> p(n,0);
vector<int> freq... | ALGO | 0.999988 | 4.520539 |
7775471f-c25d-4eee-95b5-4ebde3d48ebf | jeongukchoi/Algorithms | ํ๋ก๊ทธ๋๋จธ์ค/1/131128.โ
์ซ์โ
์ง๊ฟ/์ซ์โ
์ง๊ฟ.cpp | #include <string>
#include <map>
#include <algorithm>
using namespace std;
string solution(string X, string Y) {
string answer = "";
map<char, int> XCount, YCount, MatchCount;
// X์ Y์ ๊ฐ๊ฐ ๋ํ๋๋ ์ ์์ ๊ฐฏ์ ์ธ๊ธฐ
for (char c : X) XCount[c]++;
for (char c : Y) YCount[c]++;
// 9 ~ 0 ๋ด๋ฆผ์ฐจ์์ผ๋ก ... | ALGO | 0.999861 | 5.152778 |
ec4ba9d7-93d1-4ac0-8d99-fd48d9523dce | sarvex/leetcode-c | solution/1400-1499/1466.Reorder Routes to Make All Paths Lead to the City Zero/Solution.cpp | class Solution {
public:
int minReorder(int n, vector<vector<int>>& connections) {
unordered_map<int, vector<pair<int, bool>>> g;
for (auto& e : connections) {
int u = e[0], v = e[1];
g[u].push_back({v, true});
g[v].push_back({u, false});
}
vector<... | ALGO | 0.999971 | 5.599451 |
ead91c4b-8b59-4efb-b2fb-a02cd7228241 | meem-5971/XPSC_Practice | Week 9 Day 9/A_Bestie.cpp | #include<bits/stdc++.h>
#define ll long long
using namespace std;
void solve(){
int n;
cin>>n;
vector<int>a(n+1);
bool t=0;
for(int i=1;i<=n;i++){
cin>>a[i];
if(a[i]==1){
t=1;
}
}
int p=a[1];
for(int i=2;i<=n;i++){
p=__gcd(p,a[i]);... | ALGO | 0.99984 | 3.989953 |
e2f1b149-fdd9-443d-a085-570b4d8ec0da | maksymtosik/cpp-map-template | TestMap.cpp | #include "Employee.h" // Defines class Employee
#include "Map.h" // Defines template Map<Key, Value>
#include "BookInfo.h" // Defines class BookInfo
typedef unsigned ... | TOOL | 0.937253 | 3.849774 |
4571f993-3f82-4958-84ba-141de763350f | BBBBchan/C_CPP_ACM | acmๅจ่ฎญ/20190324/ProblemE.cpp | #include <stdio.h>
#include <string.h>
#include <set>
#define SIZE 2501
using namespace std;
long long n_NumA[SIZE];
long long n_NumB[SIZE];
long long n_Res[SIZE][3];
long long n_Ans[SIZE];
long long n_TotNum;
long long n_Flag;
set<int> s_Num;
int main()
{
while (scanf ("%lld", &n_TotNum) != EOF)
{
n_Flag = 0;
... | ALGO | 0.999217 | 3.252709 |
14869cd5-de4b-4990-9a95-1781c53dba75 | namyaloangel/travel-app | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.99887 | 6.783439 |
23823a0c-c961-4cba-9ca2-86fd9d0fc269 | liuxueyang/cpp | codeforces/contest/1007_div2/2071C.cpp | #include <algorithm>
#include <array>
#include <cassert>
#include <chrono>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#in... | ALGO | 0.999942 | 4.315416 |
79968563-09d9-4e56-bca3-0d905e287d05 | Vis7044/Leetcode | 1608-special-array-with-x-elements-greater-than-or-equal-x/1608-special-array-with-x-elements-greater-than-or-equal-x.cpp | class Solution {
public:
int specialArray(vector<int>& nums) {
sort(nums.begin(),nums.end());
int l = 0;
int h = nums[nums.size()-1];
int ctr=0;
while(l<=h){
ctr=0;
int mid = l+(h-l)/2;
for(int i=0; i<nums.size(); i++){
... | ALGO | 0.999958 | 5.69486 |
49c65cfb-00fd-4672-a769-58e610c6bdf8 | WONILLISM/Algorithm | 03_Programmers/level3-5/level3-5/level3-5/number_game(12987).cpp | #include<cstdio>
#include<iostream>
#include<vector>
#include<string>
#include<queue>
#include<deque>
#include<set>
#include<algorithm>
#define endl '\n';
#define ll long long
#define PII pair<int,int>
#define PIS pair<int,string>
using namespace std;
// 1 3 5 7
// 2 2 6 8
int solution(vector<int> A, vector<int> B) {... | ALGO | 0.999581 | 3.744096 |
d8bef721-99c8-4079-9b52-7835a58f23c6 | z1908144712/ExamCode | LeetCode/238/main.cpp | #include <iostream>
#include <vector>
using namespace std;
class Solution {
public:
vector<int> productExceptSelf(vector<int>& nums) {
vector<int> res(nums.size(), 0);
res[0] = 1;
for (int i = 1; i < nums.size(); i++) {
res[i] = res[i - 1] * nums[i - 1];
}
int R ... | ALGO | 0.999986 | 5.474318 |
f4a301ea-6df2-4073-9725-3d99201cb9b8 | stdstring/leetcode | Algorithms/Tasks.1001.1500/1267.CountServersThatCommunicate/solution.cpp | #include <algorithm>
#include <functional>
#include <unordered_map>
#include <vector>
#include "gtest/gtest.h"
namespace
{
class Solution
{
public:
[[nodiscard]] int countServers(std::vector<std::vector<int>> const &grid) const
{
typedef std::pair<size_t, size_t> TCoord;
auto coordHash = [](T... | ALGO | 0.999743 | 6.94604 |
187ca136-0f3c-48af-ad78-f49afe95e620 | akkybm/Leetcode_July-21 | Day9_LIS.cpp | // O(nlogn) solution
class Solution {
public:
int lengthOfLIS(vector<int>& a) {
int n = a.size();
const int INF = 1e9;
vector<int> d(n+1, INF);
d[0] = -INF;
for (int i = 0; i < n; i++) {
int j = upper_bound(d.begin(), d.end(), a[i]) - d.begin();
if (d[j-1] < a[i] &&... | ALGO | 0.999982 | 5.867509 |
5f0ee9b3-2043-4328-94f1-99d4f1544c4f | logicistaken/Experimental-3D-Game-Unity | Library/PackageCache/com.unity.ide.visualstudio@2.0.16/Editor/COMIntegration/COMIntegration~/COMIntegration.cpp | #include <iostream>
#include <sstream>
#include <string>
#include <filesystem>
#include <windows.h>
#include <shlwapi.h>
#include <fcntl.h>
#include <io.h>
#include "BStrHolder.h"
#include "ComPtr.h"
#include "dte80a.tlh"
constexpr int RETRY_INTERVAL_MS = 150;
constexpr int TIMEOUT_MS = 10000;
// Often a DTE call m... | TOOL | 0.955793 | 6.937841 |
fc4c8c47-890d-4005-a36b-39372a8d9129 | Anshullakhera/DSA-CPP | DP/Total Decoding Messages.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
int countWays(string &digits) {
// Code here
int mod = 1e9 + 7, n = digits.size();
int prev1 = 1, prev2 = 1;
for(int i = 2; i <= n; i++) {
int curr = 0;
... | ALGO | 0.999858 | 6.83229 |
e91eaa95-4715-4ddd-a84c-c48c6904e7d8 | ishandutta2007/codeforces | eureka/normal/240/A.cpp | #include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cst... | ALGO | 0.999842 | 3.341166 |
5ac6a355-2c30-4763-a531-3993fc6593e0 | shamkharyan/LeetCode | LinkedList/876_Middle_of_the_Linked_List.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
ListNode* middleNode(... | ALGO | 0.999765 | 5.760434 |
87593f9c-f576-459f-96c2-4f6e4a3ae802 | syqwq-OMG/oi | acwing/3.cpp | #include <algorithm>
#include <array>
#include <bitset>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <unordered_map>
#include <vector>
using namespace std;
// #define int long long
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> PII;
type... | ALGO | 0.999984 | 4.265447 |
14288af2-ff3a-4993-9642-6020710d9c05 | namirinz/Competition-Code | TOI/TOI15/medal.cpp | #include <bits/stdc++.h>
using namespace std;
int n,total = 0;
int num1,num2,num;
int main(){
priority_queue<int,vector<int>,greater<int>> base;
priority_queue<int> height;
scanf("%d",&n);
for (int i=0;i<n;i++){
scanf("%d",&num);
height.push(num);
}
for (int i=0;i<n;i++){
... | ALGO | 0.999958 | 3.39506 |
83141d34-c8af-42ca-b51f-ef9f57d36594 | lingna233/lingna-Cpp-learning | code/usestok2.cpp | /*
usestok2.cpp -- using the Stock class
*/
// compile with stock20.cpp
#include <iostream>
#include "stock20.h"
const int STKS = 4;
int main()
{
// create an array of initialized objects
Stock stock[STKS] = {
Stock("NanoSmart", 12, 20.0),
Stock("Boffo Objects", 200, 2.0),
Stock("Monolithic Obelisks", 130, 3... | ALGO | 0.903904 | 3.790765 |
d926d41f-8c84-40a0-958e-b88215ff0285 | eliot-exdev/boost-morphos | libs/geometry/doc/src/examples/algorithms/azimuth_strategy.cpp | // Boost.Geometry
// QuickBook Example
//[azimuth_strategy
//` Shows how to calculate azimuth in geographic coordinate system
#include <iostream>
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/point.hpp>
int main()
{
namespace bg = boost::geometry;
using point_type = bg::model::point<doub... | TOOL | 0.990067 | 6.732757 |
90f68f0c-2c82-497d-9fe7-3649069e5e09 | kinston18/Cpp_phase_II | Recursion/walking.cpp | #include<iostream>
using namespace std;
void reachHome(int src, int dest){
cout<< "source " << src <<" destination " << dest <<endl;
//base case
if(src==dest){
cout<< " paunch gya " <<endl;
return ;
}
//processing - ek step aage badh jaao
src++;
//recursive call
reachHome(src, de... | ALGO | 0.999929 | 3.2839 |
5be7c6f1-dfa6-48f9-9a28-286bf0b31c7d | dvtdat/cp | cses/1639.cpp | //
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef long long ll;
typedef long double ld;
const ll infLL = 2e18 + 7;
const int inf = 2e9 + 7;
const int maxN = 200010;
const ll MOD = 998244353;
const double eps = 1e-12;
void solve()
{
string s1, s2; ci... | ALGO | 0.999962 | 4.945193 |
3c8a01f5-7d12-4f73-be2c-37528996fd2a | Itsrohit819/Competitive-Programming | Colour_Blindeness.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int m;
cin >> m;
for(int j=0;j<m;j++){
int n,flag=0;
cin >> n;
string a,b;
cin >> a >> b;
for(int i=0;i<n;i++){
if(a[i]=='R'){
if(b[i]=='B' || b[i]=='G'){
flag=1;
}
}
if(b[i]=='R'){
if(a[i]=='B' || a[i]=='G'){
flag=1;
... | ALGO | 0.999697 | 4.079512 |
e3c7e8c4-a66f-4409-b441-252591319265 | nonothing/pac-man-cocos2dx | Pacman/cocos2d/extensions/Particle3D/PU/CCPUParticleFollower.cpp | #include "CCPUParticleFollower.h"
#include "extensions/Particle3D/PU/CCPUParticleSystem3D.h"
NS_CC_BEGIN
// Constants
const float PUParticleFollower::DEFAULT_MAX_DISTANCE = 3.40282e+038f;
const float PUParticleFollower::DEFAULT_MIN_DISTANCE = 10.0f;
//-----------------------------------------------------------------... | TOOL | 0.884616 | 6.535335 |
66f3023b-a9d2-471c-bb4f-067ed28767b6 | DerrickPikachu/Leetcode | submission/Construct_Binary_Search_Tree_from_Preorder_Traversal.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 {
private:
void insert(TreeNode* node, int value) {
if (value > node->val) {
if (!nod... | ALGO | 0.99999 | 6.325088 |
084a051e-3ae6-4aba-b714-5ba89731bfd6 | Patel7Manav/Leetcode-Solutions | 0451-sort-characters-by-frequency/0451-sort-characters-by-frequency.cpp | class Solution {
public:
string frequencySort(string s) {
unordered_map<char,int>m;
for(int i=0;i<s.length();i++)
{
m[s[i]]++;
}
priority_queue<pair<int,char>>p;
for(auto it:m)
{
p.push({it.second,it.first});
}
string ans=... | ALGO | 0.999976 | 6.033383 |
46ce8b03-a90e-473c-ab07-065b9c852e92 | sanketdisale871/DSA | 3229-minimum-cost-to-make-array-equalindromic/minimum-cost-to-make-array-equalindromic.cpp | class Solution {
private:
bool isPalindrome(string str){
string t = str;
reverse(str.begin(),str.end());
return str==t;
}
public:
typedef long long int ll ;
long long minimumCost(vector<int>& nums) {
ll n = nums.size();
sort(nums.begin(),nums.end());
ll cost1 = 0;
... | ALGO | 0.999977 | 5.599571 |
4137c0e6-166f-4ce8-bdc3-d451d6c8fd51 | ygtxr1997/AlgorithmLearningTraining | Learning/kuangbin/Chapter04-ShortestPath-Easy/O-LightOJ 1074/LightOJ1074-optimize.cpp | #include <iostream>
#include <cstring>
using namespace::std;
const int maxn = 202;
const int maxm = 80010; // ๆๅคง่พนๆฐ
const int INF = 0x3f3f3f3f;
typedef struct Node {
int point, cost, next;
} Node;
Node Edges[maxm]; // ่พน่กจ
int head[maxn]; // head[px]=่ฏฅ็น้ปๆฅ็ๆๅไธๆก่พนๅจ่พน่กจไธญ็็ดขๅผ
int T; // T ็ปๆฐๆฎ
int n, m, q; // n ไธชไบคๅ, m ๆก่ทฏ, q ไธชๆฅ... | ALGO | 0.999986 | 4.080238 |
d3ce1ba3-544b-4e12-a5ca-8cdada297236 | Thenaidn/codetree_practice | 241115/์ปดํจํฐ์ ํจ๊ปํ๋ ์ซ์ ๊ฒ์ 2/play-number-game-with-computer-2.cpp | #include <iostream>
#include <algorithm>
#include <climits>
using namespace std;
int game_duration(long long m, long long a, long long b) {
int min_turns = INT_MAX;
int max_turns = 0;
for (long long num = a; num <= b; num++) {
int turns = 0;
long long left = 1, right = m;
while (l... | ALGO | 0.999677 | 4.85152 |
21da76e1-5635-4d80-9eee-ca464dab17b8 | liamslj13/programming-problems | codeforces/2117B.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
void solve() {
int n;
cin>>n;
cout<<1<<' '; // elem 1
for (int i = n; i > 2; i--) cout<<i<<' ';
cout<<2<<'\n'; // elem 2
}
int main() {
int t;
cin>>t;
while (t--) solve();
}
| ALGO | 0.999738 | 4.607527 |
4a2379ed-7a28-482e-9010-26856e1c5499 | 2DGD-F0TH/2DGD_F0TH | dynamic_listings/C++/default/collisiondetection/naive_reaction.cpp | // Naive collision reaction with rectangles
void update(float dt){
// ...
player.position = player.position + player.speed * dt;
// Refer to your favourite collision detection and broad/fine passes
if (collision(player, object)){
if (player.x_speed > 0){ // going right
player.positi... | ALGO | 0.996766 | 4.888418 |
552863c9-b41e-48fd-8784-a3d7749b317a | zzilla/CodeCollection | OwnCode/ipCamera/Live555/liveMedia/RTSPCommon.cpp | #include "RTSPCommon.hh"
#include "Locale.hh"
#include <string.h>
#include <stdio.h>
#include <ctype.h> // for "isxdigit()
#include <time.h> // for "strftime()" and "gmtime()"
static void decodeURL(char* url) {
// Replace (in place) any %<hex><hex> sequences with the appropriate 8-bit character.
char* cursor = url... | TOOL | 0.894574 | 5.969094 |
956a4783-5545-49f6-a9ab-38330831a47a | Lu-Weiyan/yolov5_ncnn_ros | yolov5_ncnn/src/layer/normalize.cpp | #include "normalize.h"
namespace ncnn {
Normalize::Normalize()
{
one_blob_only = true;
support_inplace = true;
}
int Normalize::load_param(const ParamDict& pd)
{
across_spatial = pd.get(0, 0);
across_channel = pd.get(4, 1);
channel_shared = pd.get(1, 0);
eps = pd.get(2, 0.0001f);
eps_mode... | DATA | 0.909136 | 5.972805 |
f973c502-0ffb-46fb-91e4-1c25291551c9 | abkaswan/INTERVIEW_PREPARATION_2025 | DSA_questions/Problem_33_topic_dynamicProgramming/deleteAndEarn_dp_tabulation.cpp | // time complexity ; O(n + m) where m is the maximum number in array : nums == total O(m+n)
// space complexity : O(m) to store the vector v + O(m) size for the dp == total O(2m)
#include <iostream>
#include <vector>
using namespace std;
class Solution {
public:
int deleteAndEarn(vector<int>& nums) {
// t... | ALGO | 0.999978 | 6.219381 |
3e248425-7a6f-4cc8-9c78-2e9a0d124b42 | vain-man/cpp-impl | Kadane's Algorithm MAXIMUM MINIMUM SUBARRAY.cpp | // #pragma GCC optimize("Ofast")
// #pragma GCC optimize ("unroll-loops")
// #pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define db double
#define ll long long int
#define ld ... | ALGO | 0.999986 | 4.872492 |
fb6c5095-5d43-461f-b04b-2a0f2fdae509 | abhinavsatheesh/Programming | C++/MathematicalPrograms/3DShapes/AreaAndPerimeterOfCylinder.cpp | #include <iostream>
#include <string>
#include <math.h>
using namespace std;
int main() {
int radius, height;
double tsa, lsa, c, a;
double PI = atan(1)*4;
cout << "Enter the Radius";
cin >> radius;
cout << "Enter the Height";
cin >> height;
c = 2*PI*radius;
a = PI*pow(radius, 2);
tsa = 2*PI*radius*(radius+... | ALGO | 0.972538 | 3.984327 |
368bc2b6-67d0-425f-ae33-7fcfd46e7333 | qwaker00/Olymp | Trains/21112014/A/hax.cpp | #include <iostream>
#include <cstdio>
#include <cassert>
#include <cstdlib>
#include <algorithm>
using namespace std;
typedef long long ll;
int T, J1, J2, B1, B2;
ll pnum, dnum, den;
ll len(int miv, int mav) {
if (miv > mav) return 0;
return mav - miv + 1;
}
int have(int x, int y) {
if (x >= J1 && x <= J2 && y >... | ALGO | 0.999757 | 4.404425 |
f024af55-0856-4d84-8bdd-f6e04236dbdb | raincross7/code-similarity | codes/train_code/problem127/problem127_374.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
int32_t main() {
int h1,m1,h2,m2,k;
cin>>h1>>m1>>h2>>m2>>k;
m1 = h1*60 + m1;
m2 = h2*60 + m2;
int ans = m2 - m1 - k;
cout<<ans<<endl;
} | ALGO | 0.999856 | 4.232894 |
99ed0e38-461e-476b-807e-b89f821269a4 | javagovindsharma/leetscode | solution/2200-2299/2217.Find Palindrome With Fixed Length/Solution.cpp | class Solution {
public:
vector<long long> kthPalindrome(vector<int>& queries, int intLength) {
int l = (intLength + 1) >> 1;
long long start = pow(10, l - 1), end = pow(10, l) - 1;
vector<long long> ans;
for (int& q : queries) {
long long v = start + q - 1;
i... | ALGO | 0.999482 | 5.704207 |
91038abc-3cba-47b4-8de9-4b801877e033 | KangwooChoi/LeetCode | 0206-reverse-linked-list/0206-reverse-linked-list.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
ListNode* reverseList... | ALGO | 0.9996 | 5.821609 |
24aa48ed-4684-4ed0-b3c6-22d7d56e82d6 | GnaneswaraReddyAmbu/rental_ui_app | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998733 | 6.76775 |
1460c8cc-7cab-4dbb-acc7-698dad9fbc9f | 1tassianak/app_music | 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 |
798ccdec-3414-4674-9ea0-b51b76a3d4b2 | devanshV18/DSA | BST/insertInBST.cpp | #include<iostream>
using namespace std;
struct TreeNode {
int value; // Value of the node
TreeNode* left; // Pointer to the left child
TreeNode* right; // Pointer to the right child
// Constructor to initialize the node
TreeNode(int val) : value(val), left(nul... | ALGO | 0.999971 | 3.6854 |
c45fce01-fd99-47bc-b007-3b03e24a0b28 | CollegicoinCLG/collegicoin | src/collegicoin-cli.cpp | #include "chainparamsbase.h"
#include "clientversion.h"
#include "rpcclient.h"
#include "rpcprotocol.h"
#include "util.h"
#include "utilstrencodings.h"
#include <boost/filesystem/operations.hpp>
#include <univalue.h>
#define _(x) std::string(x) /* Keep the _() around in case gettext or such will be used later to tra... | WEB | 0.952066 | 6.950236 |
6e0656f2-a8cc-40dc-a152-ad387a62f59e | avivajpeyi/programming_puzzles | cpp_solutions/grille/grille/Vajpeyi_grille.cpp | /*
GRILL DECRYPTION
Take an encrypted message and the corresponding grille and decrypt it.
T he grille given might be invalid, i.e., the
holes used do not allow every location in the grid to be used during the encryption process. If this is
the case, then you must indicate that you canโt decrypt the message.
... | ALGO | 0.999705 | 5.456183 |
bbbbd4b7-33fd-4cf5-b2d1-8f79e385f1f9 | snewptl/stationaryTraveller | old-memory/Round#722_div2/E.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=3e5+5;
vector<int>e1[maxn],e2[maxn];
int n,dfn,ans;
int le[maxn],ri[maxn];
void dfs1(int u){
le[u]=++dfn;
for(auto v:e2[u]){
dfs1(v);
}
ri[u]=dfn;
}
set<pair<int,int>>s;
void dfs2(int u,int sum){
ans=max(ans,sum);
for(auto v:e1[u]... | ALGO | 0.99941 | 3.976429 |
b2cad299-37a0-41d0-8536-5fa574162f63 | Dot4diw/MachineLearningWithCpp | Perceptron/eigen-3.4.0/unsupported/doc/examples/MatrixSquareRoot.cpp | #include <unsupported/Eigen/MatrixFunctions>
#include <iostream>
using namespace Eigen;
int main()
{
const double pi = std::acos(-1.0);
MatrixXd A(2,2);
A << cos(pi/3), -sin(pi/3),
sin(pi/3), cos(pi/3);
std::cout << "The matrix A is:\n" << A << "\n\n";
std::cout << "The matrix square root of A is:... | ALGO | 0.999314 | 3.930508 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.