uuid stringlengths 36 36 | repo_name stringlengths 5 123 | relative_path stringlengths 5 4k | content stringlengths 33 2.85M | category stringclasses 6
values | algo_rel_score float64 0.85 1 | quality_score float64 3 8.76 |
|---|---|---|---|---|---|---|
05a83a62-a511-445c-9d7a-56ac8b3a1ba2 | Devika03/Leetcode_Daily_progress | 0662-maximum-width-of-binary-tree/0662-maximum-width-of-binary-tree.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.999942 | 6.119091 |
e4d2ddc9-a7a4-48ab-9e8f-90a8eb95a653 | fgenesis/hwmf | democode/src/demolib/raster.cpp | #include "raster.h"
#include "draw.h"
raster::TriFilterResult raster::filterTris(uint8_t *triidxs, const ivec2 * const vs, const uint8_t *clipbuf, const raster::Tri *tris, uint16_t nTris)
{
uint8_t nFront = 0, nBack = 0;
for(uint16_t i = 0; i < nTris; ++i)
{
const raster::Tri tri = tris[i];
... | ALGO | 0.98502 | 6.801788 |
2487673b-171a-486e-be6b-0ae0a23810f4 | akifzaman/CP_Topics | Codeforces/DIV2(B)/OR in Matrix.cpp | #include <bits/stdc++.h>
using namespace std;
#define nl "\n"
#define mod 1000000007
#define sz(c) (int)c.size()
#define pb push_back
#define ff first
#define ss second
#def... | ALGO | 0.999884 | 3.176882 |
6fca5b63-cad2-4c2e-918a-763f4e001396 | ShivaKrishna-07/Striver-a2z | Trees/3.diameter_of_binarytree.cpp |
int diameterOfBinaryTree(TreeNode *root)
{
int diameter = 0;
height(root, diameter);
return diameter;
}
int height(TreeNode *root, int &diameter)
{
if (root == NULL)
return 0;
int lh = height(root->left, diameter);
int rh = height(root->right, diameter);
diameter = max(diameter, ... | ALGO | 0.999777 | 6.199196 |
25dcc1b2-60a0-4883-85a5-8bb8d309ece4 | UG4/ugcore | ugbase/lib_grid/refinement/hanging_node_refiner_multi_grid.cpp | #include <sstream>
#include "common/assert.h"
#include "lib_grid/algorithms/multi_grid_util.h"
#include "lib_grid/algorithms/selection_util.h"
#include "lib_grid/algorithms/debug_util.h"
#include "hanging_node_refiner_multi_grid.h"
#include "ref_mark_adjusters/mg_hnode_adjuster.h"
// Only required for debug saves
#inc... | ALGO | 0.975171 | 5.452816 |
7ea613e3-c418-4c95-88af-bd8e3b9066ed | KrastanDraganov/Competitions | BG/Olympiad/Municipal/C/2014/runners.cpp | #include<iostream>
#include<vector>
#include<utility>
#include<algorithm>
#define endl '\n'
using namespace std;
vector<pair<int,int>> times;
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin>>n;
for(int i=0;i<n;++i){
int num;
cin>>num;
times.push... | ALGO | 0.999987 | 3.317616 |
b48ff83a-6d2f-46b6-b3b6-d15afdfdb340 | tanyagupta0201/LeetCode-Problems-Solutions | C++/633_SumofSquareNumbers.cpp | // Name :- Pushkar Roy
// Date :- 05-10-2022
/*
Given a non-negative integer c, decide whether there're two integers a and b such that a2 + b2 = c.
Example 1:
Input: c = 5
Output: true
Explanation: 1 * 1 + 2 * 2 = 5
Example 2:
Input: c = 3
Output: false
*/
class Solution {
public:
// make function for check s... | ALGO | 0.999792 | 5.752131 |
bd790de5-a83d-4054-90f0-173b385f6284 | greatzero728/zero.icpc | Contest/atcoder/240713-AtCoder-Beginner-Contest-362/(A).cpp | #include<bits/stdc++.h>
#define y second
#define x first
using namespace std;
using INT = long long;
using pii = pair<int, int>;
int main() {
#ifndef ONLINE_JUDGE
freopen("in.in", "r", stdin);
//freopen("out.out", "w", stdout);
#endif
int R, G, B; scanf("%d %d %d", &R, &G, &B);
string s; cin>>s;
int ans;
if... | ALGO | 0.999111 | 4.610341 |
131784a2-bc29-4efe-97d7-829dbacb4ad5 | Hzzz123rfefd/opencl_learnning | 3rd_party/opencv/3rdparty/carotene/src/integral.cpp | #include "common.hpp"
namespace CAROTENE_NS {
void integral(const Size2D &size,
const u8 * srcBase, ptrdiff_t srcStride,
u32 * sumBase, ptrdiff_t sumStride)
{
internal::assertSupportedConfiguration();
#ifdef CAROTENE_NEON
uint32x4_t v_zero = vmovq_n_u32(0u);
// the first itera... | ALGO | 0.998503 | 5.724962 |
c0e85c9d-2b1d-4792-ab76-ac5a5f36c1b4 | luhaiya/PTA | 1_complexity_1.cpp | /*最大子列和问题,在线处理*/
int* max_sum_subarray(int length, int array[]){
int thisSum = 0, maxSum = 0;
int first_temp = 0, first = 0, last = 0, N = 0;
int all_negetive = 0;
int* res = new int[3];
for(int i = 0; i < length; i++){
thisSum += array[i];
N += 1;
if(thisSum ... | ALGO | 0.999674 | 4.019572 |
74c64820-2c5e-4446-877b-d243fc2455d1 | Santanujana2001/My-Leetcode-Solutions | 142-linked-list-cycle-ii/142-linked-list-cycle-ii.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
ListNode *detectCycle(ListNode *head) {
ListNode *f=head;
ListNode *s=head;
while(f && f->next){
... | ALGO | 0.999913 | 5.350062 |
e2c8444a-3a82-4486-9d9f-a31e5180eea3 | uw-advanced-robotics/aruw-mcb | aruw-mcb-project/src/aruwsrc/control/chassis/chassis_rel_drive.cpp | #include "chassis_rel_drive.hpp"
#include "tap/drivers.hpp"
#include "aruwsrc/robot/control_operator_interface.hpp"
#include "holonomic_chassis_subsystem.hpp"
using namespace tap::algorithms;
namespace aruwsrc::chassis
{
void ChassisRelDrive::computeDesiredUserTranslation(
aruwsrc::control::ControlOperatorInte... | TOOL | 0.854615 | 6.216785 |
c0f7e7fb-d052-4d5c-b6b4-9dfc13bb0582 | ShivPatel031/DSA | Tree/Sum_of_Left_Leaves.cpp | // Sum of Left Leaves leetcode 404 GFG
// Given the root of a binary tree, return the sum of all left leaves.
// A leaf is a node with no children. A left leaf is a leaf that is the left child of another node.
// Example 1:
// Input: root = [3,9,20,null,null,15,7]
// Output: 24
// Explanation: There are two left le... | ALGO | 0.99969 | 6.935501 |
3b0b4ea9-3d61-43c5-8691-b18bc4a2f2a1 | ashrafabuelrai/CSES-Solution | CSES-main/Mathematics/Exponentiation.cpp | #include<bits/stdc++.h>
#define ll long long
const long long mod = 1e9+7;
using namespace std;
ll power(ll a,ll b,ll mod)
{
ll rem,ans=1;
rem=a%mod;
while(b)
{
if(b%2)ans=(ans*rem)%mod;
rem=(rem*rem)%mod;
b/=2;
}
return ans;
}
int main()
{
ios::sync_with_stdi... | ALGO | 0.999834 | 4.518311 |
9efc0614-4085-4e5e-8d7d-8568ded11361 | imaxxs/cyton | functions/functionmanager.cpp | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <pthread.h>
#include <sys/time.h>
#include "evpath.h"
#include "revpath.h"
#include "gen_thread.h"
typedef struct resrc_rec {
float key_srng;
float key_erng;
int num_recs; // should be 120 isnt it
float *rec_val;
} resrc_rec, *... | DATA | 0.926086 | 3.038457 |
8e218b5d-809a-42fd-bc22-e65873497c12 | pl728/competitive-programming | main/B_Pleasant_Pairs.cpp | #include <bits/stdc++.h>
#define py puts("YES")
#define pn puts("NO")
#define pf puts("-1")
#define rep(i, a, b) for (int i = a; i < b; i++)
#define rev(i, a, b) for (int i = a; i >= b; i--)
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define sz(x) ((int)(x).size())
#define v vector
using ll = long long;... | ALGO | 0.999711 | 3.797506 |
18cb8c3d-94e2-4e84-ad41-39194e845517 | liaolong1024/algorithm | PAT/basic/1041-1050/cpp/B1046.cpp | #include <cstdio>
int main() {
int n, a1, a2, b1, b2, cntA = 0, cntB = 0;
scanf("%d", &n);
while (n-- > 0) {
scanf("%d%d%d%d", &a1, &a2, &b1, &b2);
int sum = a1 + b1;
if ((sum == a2 && sum == b2) || (sum != a2 && sum != b2)) {
continue;
} else if (sum == a2) {
... | ALGO | 0.997955 | 3.697025 |
dc506424-af93-4ada-833e-a69ff2f73529 | TNFSH-Programming-Contest/2024NHSPC-TNFSH-Final | pE/solution/correct.cpp | #include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define F first
#define S second
lli h[1000005], n, a, b, c, d, l, r, dp[6000005];
lli lim = 6e6;
multiset<lli> ms;
pair<lli, lli> p[5];
bool cmp(pair<lli, lli> a, pair<lli, lli> b){
return a.S*b.F>a.F*b.S;
}
lli get(lli x){
if(x<=lim)return dp[x... | ALGO | 0.999849 | 3.343747 |
c53437e5-a25c-430c-82e8-7c190cc7acab | cswaynecool/DRT | external_libs/matconvnet/matlab/src/bits/impl/im2row_cpu.cpp | // @file im2row_cpu.cpp
// @brief Stack image patches as matrix rows (CPU)
// @author Andrea Vedaldi
#include "im2row.hpp"
#include <string.h>
using namespace vl ;
using namespace vl::impl ;
/* ---------------------------------------------------------------- */
/* Hep... | ALGO | 0.881151 | 4.988763 |
1ca29269-a085-4619-bab9-ffacf6ed65d1 | simonmandlik/Competitive-programming-solutions | Codeforces/87A.cpp | #include <bits/stdc++.h>
using namespace std;
#define EPS (1e-10)
#define DEBUG(x) cout << "> " << #x << ": " << x << endl;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FORD(i, a, b) for (int i = (a); i >= (b); i--)
#define BE(c) c.begin(), c.end()
#define... | ALGO | 0.999939 | 4.221159 |
b7decd8e-e28f-4329-a9ad-0a39b74e3185 | ML-UCV/ML-CodeBert-DistinctSolutions | Raw Dataset/stramosi/dp_log/train/6e30590a-139a-11eb-a26b-309c234925a0.cpp | #include <fstream>
#include <cstring>
#include <algorithm>
using namespace std;
ifstream fin("stramosi.in");
ofstream fout("stramosi.out");
int i,n,m,nod,poz,j,t[18][250001],aux;
int main(){
fin>>n>>m;
for(i=1;i<=n;i++)fin>>t[0][i];
for(i=1,aux=2;aux<=n;i++,aux<<=1)for(j=1;j<=n;j++)t[i][j]=t[i-1][... | ALGO | 0.999978 | 3.374122 |
b66e551b-15f2-416d-9b3f-856cf3eb93c7 | YilinZhang107/my_c | LeetCode/553_m最优除法.cpp | #include<bits/stdc++.h>
using namespace std;
class Solution {
public:
//根据数学, 必须 1/(2/3/4/...)才能得到最大值
string optimalDivision(vector<int>& nums) {
string result = to_string(nums[0]);
for(int i=1; i<nums.size();i++){
result += "/"+to_string(nums[i]);
}
if(nums.size()>2... | ALGO | 0.999832 | 5.272976 |
a733e9dc-4327-4b58-8108-3a6cfdf4a7db | ifeldshteyn/tfe_log_changes | TheForceEngine/TFE_Jedi/Renderer/RClassic_Float/rwallFloat.cpp | #include <cstring>
#include <TFE_System/profiler.h>
#include <TFE_Jedi/Math/fixedPoint.h>
#include <TFE_Jedi/Math/core_math.h>
#include <TFE_Jedi/Level/rtexture.h>
#include "fixedPoint20.h"
#include "rwallFloat.h"
#include "rflatFloat.h"
#include "rlightingFloat.h"
#include "rsectorFloat.h"
#include "redgePairFloat.h... | ALGO | 0.985951 | 6.845235 |
0cc8f0c5-00c7-4e24-8d8e-fe955c02d077 | Mauricio-Bernuy/paralela-final-project | BrokenTriangleOMP.cpp | #include <omp.h>
#include <math.h>
#include <random>
#include <string>
#include <iostream>
#include "RngStream.h"
bool PRINT_ = false; // print debug info
bool RES_ONLY = false; // print debug info
int nT = 1; // number of threads
RngStream *RngArray;
// optimized condition, its obtuse if len is equal or lower tha... | ALGO | 0.998104 | 6.332441 |
0e63fb58-fe1b-497c-b6d4-449ad46aae01 | louistone/Leetcode | 101_4.cpp | // Author: Tong Xu
// Date: 1/1/2020
// How to write if using da lao's method
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
// da lao's solution
class Solution {
pub... | ALGO | 0.999936 | 6.687254 |
17f252d6-044e-480b-a17f-79b832fe970a | AzizulHakimFayaz/Random_problems | C-C++/C++_practice/Codeforce/sheet_codeforce/X_Two_intervals.cpp | #include "bits/stdc++.h"
using namespace std;
int main(){
int a,b,c,d;
cin>>a>>b>>c>>d;
if(b<c){
cout<<-1<<endl;
}
else{
cout<<c<<" "<<b<<endl;
}
} | ALGO | 0.999152 | 3.291285 |
988d3244-53bc-451f-886d-0d1ac7081dc0 | vg132/cpp_projects | LapLogger/LapLogger/Source/Crypt.cpp | #include "../include/Crypt.hpp"
BYTE* Crypt::Encrypt(BYTE* pbJamData, int nNumBytes)
{
BYTE *outputData=new BYTE[nNumBytes];
unsigned long *ptr=(unsigned long*)outputData;
unsigned long *pBlocks = (unsigned long *)pbJamData;
unsigned long lPattern = 0xB082F165;
for (int nNumBlocks = nNumBytes / 4; nNumBlocks > 0... | ALGO | 0.991597 | 3.183567 |
0899f2bb-2c9f-4762-be68-32ec1e312912 | OlafurAO/C-plus-plus-stuff-from-2016 | T-111-PROG/Forritun Æfing fyrir Lokapróf/Lokapróf/Dæmi/slys.cpp | #include <iostream>
using namespace std;
int main()
{
int accidents[20][140];
int weeks;
int currentWeek = 0;
cout << "Enter amount of weeks: " << endl;
cin >> weeks;
for(int i = 0; i < weeks; i++)
{
for(int j = 0; j < 7; j++)
{
cin >> accidents[currentWeek][j]... | ALGO | 0.995289 | 3.268679 |
e75dcda8-6d8e-4496-aab4-9625c5506230 | rafaelapsilverio/TPA | exemplo5.cpp | /*
Funo: somar dois nmeros
Autor e autor : Mikaela da Silva e Rafaela Petelin
Data de criao: 25/09/2019
Data de alterao: 25/09/2019
*/
#include <stdio.h>
#include <windows.h>
int main(){
int num1 = 0, num2 = 0, soma = 0;
printf("informe um numero inteiro: ");
//leia(num1);
scanf("%i", &num1);
printf("informe o ... | TOOL | 0.908643 | 3.377952 |
16d2456a-aa1d-475d-854e-07d4496b7175 | FlowSight/coding | neetcode 150/permutation.cpp | // 7 feb 2025
// came up with it myself..
// 15 mins..
// did dry run
// 1 compiler error..
// verdict : FAIL
// severity : sev3
// tODO : backtrack
class Solution {
public:
vector<vector<int>> permute(vector<int>& nums) {
sort(nums.begin(),nums.end());
vector<vector<int>> ans;
ans.push_ba... | ALGO | 0.999971 | 6.035195 |
f64b7d4e-448c-4888-93a0-57fabc7ff543 | Myamin4690/pd-6 | task2.cpp | #include<iostream>
#include<string>
using namespace std;
float CalculateAverage(float marksEng,float marksMath,float marksChem,float marksSocial,float marksBio ,string name);
string CalculateGrade(float average);
int main()
{ float marksEng, marksMath, marksChem, marksSocial, marksBio;
string name;
cout<<"Enter suden... | TOOL | 0.876273 | 4.348038 |
05faa885-e0b2-487f-81e1-31bbda6c074c | ishandutta2007/codeforces | riverhamster/normal/1139/C.cpp | #include <cstdio>
#include <cctype>
#include <cstring>
#include <algorithm>
using namespace std;
#define File(s) freopen(s".in", "r", stdin), freopen(s".out", "w", stdout)
typedef long long ll;
template<typename T> inline void in(T &x){ //Read Positive Integer.
register char ch; x = 0;
// register int f = 1;
while(i... | ALGO | 0.99999 | 4.074384 |
6d1c77fd-3705-4eea-9c3f-6cc467982db3 | H-Shen/MyCodeCollection | Kattis/ada.cpp | // https://open.kattis.com/problems/ada
//
#include <bits/extc++.h>
using namespace std;
using namespace __gnu_pbds;
int main() {
int n, val;
vector<int> A;
vector<int> tail;
scanf("%d", &n);
while (n--) {
scanf("%d", &val);
A.emplace_back(val);
}
tail.emplace_back(A.back(... | ALGO | 0.999872 | 3.992789 |
ead68f05-a8ca-42d4-b2a8-ba4158a61ff3 | Hexiaoming20151216/orocos-bfl-0.8.0_backpack | src/filter/EKparticlefilter.cpp | #include "EKparticlefilter.h"
#define MeasModel MeasurementModel
#define CV ColumnVector
namespace BFL
{
EKParticleFilter::EKParticleFilter(MCPdf<CV> * prior,
int resampleperiod,
double resamplethreshold,
int resamplescheme)
: ParticleFilter<ColumnVector,ColumnVector>(prior,NULL,
... | ALGO | 0.998691 | 4.888656 |
d18a1d9a-9218-4293-a9f2-0a38c3812523 | Ahmedramzysaid/Leetcode | 2807. Insert Greatest Common Divisors in 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:
int gcd(int a , int b)
... | ALGO | 0.99995 | 5.601232 |
04e26b67-daf2-42ff-bf12-62a0c442a77e | jayeshpatel8/Coding-Practise-using-Leetcode-Coding-Platform | problems/binary_tree_right_side_view/solution.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.999747 | 6.289135 |
49284c46-e856-43a7-b90a-926161feae5e | Jun0S2/AlgorithmStudy | 백준/2024_Algorithm/11725_트리의부모찾기.cpp | /**
* @date 2024.09.19
* @author June Park
* https://www.acmicpc.net/problem/11725
* Silver 2
* 일반 그래프
*/
#include <iostream>
#include <vector>
using namespace std;
int N; // 노드의 개수
vector<vector<int>> tree; // 인접 리스트 형태로 트리를 표현
vector<int> parent; // 각 노드의 부모 노드를 저장
vector<bool> visit... | ALGO | 0.999998 | 6.513921 |
55915966-c60f-468c-9a7e-27f09666bd6c | suletetes/algorithm-and-data-structures | 13_stack/parenthesisMatching.cpp | #include "stdio.h"
#include "stdlib.h"
struct node {
char data;
struct node *next;
} *top = NULL;
void push(char x) {
struct node *t;
t = (struct node *) malloc(sizeof(struct node));
if (t == NULL) {
printf("stack is full\n");
} else {
t->data = x;
t->next = top;
... | ALGO | 0.999191 | 3.965199 |
ffeda805-78f6-4d15-9292-a0729239a2ee | vothanhkiet/firmware-mod-kit | src/others/squashfs-3.2-r2-hg612-lzma/lzma443/C/Common/CommandLineParser.cpp | // CommandLineParser.cpp
#include "StdAfx.h"
#include "CommandLineParser.h"
namespace NCommandLineParser {
void SplitCommandLine(const UString &src, UString &dest1, UString &dest2)
{
dest1.Empty();
dest2.Empty();
bool quoteMode = false;
int i;
for (i = 0; i < src.Length(); i++)
{
wchar_t c = src[i];... | TOOL | 0.888163 | 5.728894 |
c9e6b9ef-f8fd-4c82-90a7-fe7bc8f69541 | rizqiputra4693/UTS_prakmobile | 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 |
90ce2cbd-8859-4ee4-96c0-005a1999ecfe | plewis/phycas | src/cpp/underflow_manager.cpp | #include <iostream>
#include <fstream>
#include <vector>
#include <numeric>
#include <limits>
#include "underflow_manager.hpp"
//double tmp_max_log_f = 0.0;
namespace phycas
{
/*----------------------------------------------------------------------------------------------------------------------
| Constructor.
*/
Un... | TOOL | 0.920969 | 6.116925 |
1d766df0-f61c-4388-934d-07aca4c91229 | lays03/Vscode | isInCircle/src/main.cpp | #include <iostream>
#include "Circle.h"
#include "point.h"
void isInCircle(Circle &c, Point &p){
int m_x = c.getCenter().getx();
int m_y = c.getCenter().gety();
int m_r = c.getr();
cout << "该圆的圆心坐标为:" << "(" << m_x << ", " << m_y << ")" << " ";
cout << "该圆的半径为:" << m_r << endl;
int dis = (p.g... | ALGO | 0.907342 | 4.001663 |
db60ada6-d8c9-40d8-8dec-3f9c6285945f | SI-Abid/Hello-world | Codeforces/1557a.cpp | #include "bits/stdc++.h"
using namespace std;
#define ll long long
#define ull unsigned long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define be begin()
#define en end()
#define rb rbegin()
#define re rend()
#define all(x) (x).begin(),(x).end()
#define out cout<<setprecision(20)
... | ALGO | 0.999289 | 4.448577 |
d3e4022a-594c-41b4-9a72-b8d2610e7d93 | boraswim/School-Projects | C++_Projects/ItA_Assignments/Lab Assignment 5_P1.cpp | // Bora Sevim
// 06.12.2021
// LabAssignment#5 P1
#include <iostream>
using namespace std;
void ac(int td,int tm,int ty,int bd,int bm,int by){
int ad,am,ay;
ay=ty-by;
am=tm-bm;
if(bm>tm){
ay-=1;
am+=12;
}
ad=td-bd;
if(bd>td){
am-=1;
switch(bm){
case 1:
ad+=31;
break;
case... | ALGO | 0.970067 | 3.744913 |
c821d6d2-ef88-43bf-ac93-246949eb3062 | Movazed/LeetCode_problem_Set_and_daily | 1509.MinimumDifferenceBetweenLargestandSmallestValueinThreeMoves.cpp | #include <vector>
#include <algorithm>
#include <iostream>
using namespace std;
class Solution {
public:
int minDifference(vector<int>& nums) {
int n = nums.size();
if (n <= 4) {
return 0;
}
sort(nums.begin(), nums.end());
int ans = nums[n-1] - nums[0];... | ALGO | 0.999967 | 6.004023 |
c5d4d2ac-b850-4d3b-a9df-f12670f9027c | EvelynLizbeth/CC2 | Laboratorio1/7.cpp | //EJERCICIO 7
#include<iostream>
using namespace std;
bool Primo(int numero) {
if (numero <= 1) {
return false;
}
if(numero == 2){
return true;
}
if (numero % 2 == 0) {
return false;
}
int cont = 3;
while ((cont * cont) <= numero) {
if (numero % cont =... | ALGO | 0.999617 | 4.041138 |
73f24676-15f1-497d-bc16-20db3d6ec5f6 | luwei0917/GlpG_Nature_Communication | src/USER-INTEL/dihedral_opls_intel.cpp | /* ----------------------------------------------------------------------
Contributing author: W. Michael Brown (Intel)
------------------------------------------------------------------------- */
#include <mpi.h>
#include <math.h>
#include "dihedral_opls_intel.h"
#include "atom.h"
#include "comm.h"
#include "memor... | ALGO | 0.996695 | 6.861934 |
2cd50e40-77fc-491f-b35f-67d6a03c451c | InacioAntonio/codigos-em-c-- | lista 5/Questão10.cpp |
/*#include <iostream>
using namespace std;
//quando linha for igual a coluna+1
int main(){
const int tam=2;
int linha,coluna,soma=0,media,matriz[tam][tam],i=0;
for(linha=0;linha<tam;linha++){
for(coluna=0;coluna<tam;coluna++){
cin >>matriz[linha][coluna];
if(linha==coluna+1){
soma+=mat... | ALGO | 0.999888 | 3.742494 |
36825150-7c39-4743-9ac4-586803110c91 | kundan6930/coding_contest | coderush/CodeRush October '23/Easy_Enough.cpp | #include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main (){
ll n;
cin>>n;
string s;
cin>>s;
vector<ll>pre(n+1),pre1(n+1);
pre[0]=0;
pre1[0]=0;
for(ll i=1;i<=n;i++)
{
if(s[i]=='1')
{
pre[i]=pre[i-1]+(i*i);
}
else
{
pre1[i]=pre[i-1];
}
if(s[i]=='0')
... | ALGO | 0.999426 | 3.524579 |
37fd4d4a-15a9-43fc-9100-1c5c5a703744 | ishandutta2007/codeforces | timmyfeng/normal/1144/A.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin >> n;
while (n--) {
string s;
cin >> s;
sort(s.begin(), s.end());
string ans = "Yes";
for (int i = 1; i < (int) s.size(); ++i) {
... | ALGO | 0.999989 | 5.634979 |
b203ad80-39a3-41c2-9b65-e84f6641b8e0 | embprg2000/SoftDefinedBlocks | src/SpecialBlocks/MorseCode/DecodeMorseCode.cpp | /*
* DecodeMorseCode.cpp
*
* Created on: Sep 21, 2016
* Author: evert
*/
// http://www.embedded.com/design/configurable-systems/4007653/DSP-Tricks-DC-Removal
#include <algorithm> // std::sort
#include <string>
#include "DecodeMorseCode.hpp"
ostream* sTmp;
template<class T>
inline short sign(T a) { re... | ALGO | 0.967924 | 4.984574 |
c95bb461-323e-485e-b6d3-f86bf2703919 | solthx/leetcode | String/1156. 单字符重复子串的最大长度.cpp | /*
问题分析:
如果字符串中的所有字符都相同,那么这个字符串是单字符重复的字符串。
给你一个字符串 text,你只能交换其中两个字符一次或者什么都不做,然后得到一些单字符重复的子串。返回其中最长的子串的长度。
示例 1:
输入:text = "ababa"
输出:3
示例 2:
输入:text = "aaabaaa"
输出:6
示例 3:
输入:text = "aaabbaaa"
输出:4
示例 4:
... | ALGO | 0.999833 | 5.825374 |
d7fc8ece-67d7-4eb1-8ea9-8d9c05184b34 | DPChanny/ps | Baekjoon/15988.cpp | #include<iostream>
using namespace std;
long long int dp[1000000]{1, 2, 4};
int main(void) {
int t, n, mn(3);
cin >> t;
for (int _t(0); _t < t; _t++) {
cin >> n;
if (n > mn) {
for (int _n(mn); _n < n; _n++)
dp[_n] = (dp[_n - 1] + dp[_n - 2] + dp[_n - 3]) % 1000000009;
mn = n;
}
cout << dp[n - 1]... | ALGO | 0.999942 | 3.861584 |
a1f4c04d-3333-4f8f-821f-dd88a4ee967b | ishandutta2007/codeforces | platelet/normal/1656/B.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using uint = unsigned;
using ull = uint64_t;
constexpr ll safe_mod(ll x, ll m) { return x %= m, x < 0 ? x + m : x; }
constexpr ll pow_mod_constexpr(ll x, ll n, int m) {
if(m == 1) return 0;
uint _m = m; ull r = 1, _x = safe_mod(x, m);
for... | ALGO | 0.999947 | 5.240776 |
7cd9486c-ad43-45c4-b443-781e35d5c414 | greeliyahu/Interview-type-problems | compress_string.cpp | // PROBLEM:
/*
Implement a method to perform basic string compression using the counts of repeated characters.
For example, the string aabcccccaaa would become a2blc5a3.
If the "compressed" string is not smaller than the original string, return the original string.
*/
// SOLUTION:
#include <iostream> // c... | ALGO | 0.999906 | 6.509832 |
47dba2f9-5663-47e5-97ab-d97b784e03d6 | 113bommy/LogicalErrorFixCodeT5 | logicalErrorFix_CodeT5_Linenumber/model/cpp/CodeT5_LineNumber_cpp_gold/Problem_156_gold_806.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int t = 1;
cin >> t;
while (t--) {
long long n;
cin >> n;
long long k;
cin >> k;
long long a[n], i;
long long sum = 0;
for (i = 0; i < n; i++) {
cin >> a[i];
sum += a[i];
}
sort(a, a + n);
long long c = 0;
... | ALGO | 0.999968 | 3.66708 |
ac77e82e-f453-4703-8ebc-61cd95b51533 | sarvex/leetcode-pharo | solution/1300-1399/1312.Minimum Insertion Steps to Make a String Palindrome/Solution.cpp | class Solution {
public:
int minInsertions(string s) {
int n = s.size();
int f[n][n];
memset(f, 0, sizeof(f));
for (int i = n - 2; i >= 0; --i) {
for (int j = i + 1; j < n; ++j) {
if (s[i] == s[j]) {
f[i][j] = f[i + 1][j - 1];
... | ALGO | 0.999971 | 6.15535 |
47d58bef-0805-42aa-959c-03f27ed14875 | cleanrock/flobby | src/gui/TextFunctions.cpp | #include "TextFunctions.h"
#include "log/Log.h"
#include <FL/filename.H> // fl_open_uri
#include <boost/algorithm/string.hpp>
#include <cctype>
#include <ctime>
// return pair with word before pos (up to pos) and pos of word start
// e.g. "asd gh|f ert" would return ["gh", 4]
// text must be none empty and end with a ... | TOOL | 0.875218 | 5.516417 |
38bbbf1d-edd8-47ea-8e65-3998c7f0ab20 | devanshsingh15/leetcode-solutions-cpp | 231. Power of Two.cpp | class Solution {
public:
bool isPowerOfTwo(int n) {
int ans=1;
for(int i=0;i<=30;i++){
if(ans==n)
return true;
if(ans<INT_MAX/2)
ans=ans*2;
}
return false;
}
};
| ALGO | 0.999441 | 6.050814 |
cec2503c-9b46-4f72-bb31-50ce77371a44 | rerun-io/mast3r-slam | mast3r_slam/backend/src/gn.cpp | #include "gn.h"
std::vector<torch::Tensor> gauss_newton_points(
torch::Tensor Twc, torch::Tensor Xs, torch::Tensor Cs,
torch::Tensor ii, torch::Tensor jj,
torch::Tensor idx_ii2jj, torch::Tensor valid_match,
torch::Tensor Q,
const float sigma_point,
const float C_thresh,
const float Q_thresh,
const int... | ALGO | 0.982357 | 6.237194 |
0e77709c-191d-42a1-8b6d-8eecbd70562e | Coach-Academy/Fall-1-2024 | Level 1/CPU - Standard - L1 - C107/Practice G2/Week 03/problemK.cpp | #include <iostream>
using namespace std;
int main() {
int n;
cin>>n;
bool lucky = true;
for(int i=1 ; i<=n ; i++){
if(n%i==0){
int tmp=i;
lucky = true;
while(tmp>0){
if(!(tmp%10 == 4 || tmp%10==7)){
lucky = false;
}
tmp/=10;
}
}
if(lucky == true) break;
}
if(lucky) cout<<"YES... | ALGO | 0.999521 | 4.33626 |
7f41a85a-9077-4072-b5c8-f2c122781241 | dvaitam/codeforces | 1000-1999/1600-1699/1680-1689/1681/solC.cpp | #include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define int long long
#define ff first
#define ss second
#define pob pop_back
#define pof pop_front
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define pii pair<int,int>
#defi... | ALGO | 0.999903 | 3.640844 |
15583895-f845-4e79-9437-fa960c0901c4 | Rsueyoshi1008/AppleUnlabeled_TeamCleate | 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 |
1f2a7884-900f-4e0b-8edc-b2b2eca669a0 | JulioMelo-Classes/lista-1-humberto789 | negativos5/src/main.cpp | #include <iostream>
using namespace std;
const int SIZE = 5; // input size.
/*
ok!
*/
int main(void)
{
int numero;
int qtd_negativos = 0;
for(int i=0; i<5; i++){
cin>>numero;
if(numero < 0){
qtd_negativos++;
}
}
cout<<qtd_negativos;
return 0;
}
| ALGO | 0.999672 | 4.59367 |
2cb83eb9-1af1-42ae-9490-d4f51acd3c79 | iliyars/Digit | InterfSolver/Tools/XYEllipse.cpp | #include "XYEllipse.h"
//=========================================================================
XYEllipse :: XYEllipse(double _Ax, double _By, double _Xc, double _Yc, double _Fi,
int _TypeLimits, int _TypeSystCoor)
{
Ax = _Ax;
By = _By;
Xc = _Xc;
Y... | ALGO | 0.908439 | 6.249856 |
2069c3c6-0b85-4c5e-8d08-7dd37be4db32 | nguyentrunghieu2411/baitap | BT03/Bai4.2.cpp | #include <iostream>
using namespace std;
int main()
{
int n;
cin >>n;
int a[n]={0};
a[0]=1;
cout << a[0]<<endl;
for(int i=1;i<n;i++)
{
for(int j=i;j>=1;j--) a[j]=a[j]+a[j-1];
for(int j=0;j<=i;j++) cout << a[j] << " ";
cout << endl;
}
return 0;
}
| ALGO | 0.999962 | 3.095646 |
dfacf561-e9b9-4529-ac84-51c7e718d832 | pacha2880/competitive_programming_codes | National Highway System.cpp | #include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// #include <ext/rope>
#define int ll
#define mp make_pair
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)a.size()
#define eq(... | ALGO | 0.999743 | 4.181087 |
94dadad3-2423-4959-96fb-da37d6304aa6 | metehkaya/Algo-Archive | Problems/AtCoder/Contests/Beginner_Contests/Contest_180/D.Takahashi_Unevolved.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long LL;
LL x,y,a,b,ans;
int main() {
scanf("%lld%lld%lld%lld",&x,&y,&a,&b);
LL score = 0;
while(true) {
LL diff = y-x-1;
ans = max(ans,score+diff/b);
if((y-1)/x < a)
break;
score++;
x *= a;
}
printf("%lld\n",ans);
return 0;
}
| ALGO | 0.999081 | 3.078256 |
3301f385-2a8c-4f22-b3de-d5fdec2e5ebf | esmf-org/esmf | src/Infrastructure/Mesh/src/Moab/mesquite/TargetMetric/ShapeSize/TShapeSize3DNB1.cpp | /** \file TShapeSize3DNB1.cpp
* \brief
* \author Jason Kraftcheck
*/
#include "Mesquite.hpp"
#include "TShapeSize3DNB1.hpp"
#include "MsqMatrix.hpp"
#include "TMPDerivs.hpp"
namespace MBMesquite
{
std::string TShapeSize3DNB1::get_name() const
{
return "TShapeSize3DNB1";
}
TShapeSize3DNB1::~TShapeSize3DNB1(... | ALGO | 0.994789 | 6.502551 |
cc31b913-455b-49e1-af24-612700b8b56b | farooqkz/gecko8110 | gfx/skia/skia/src/core/SkSharedMutex.cpp | #include "SkSharedMutex.h"
#include "SkAtomics.h"
#include "SkTypes.h"
#include "SkSemaphore.h"
#if defined(THREAD_SANITIZER)
/* Report that a lock has been created at address "lock". */
#define ANNOTATE_RWLOCK_CREATE(lock) \
AnnotateRWLockCreate(__FILE__, __LINE__, lock)
/* Report that the lock at address "loc... | TOOL | 0.873785 | 7.769649 |
eaff0dfc-9121-4d48-b450-7b5dd7fa4e95 | UltimateKyo/FCSA | Kyo/1-Intensive/Codes/special_1.cpp | #include <iostream>
using namespace std;
int num1,biggest;
int main(){
for(int i = 1; i <= 3; i++){
printf("Please enter number (%d out of 3):",i);
cin>>num1;
if (i==1){
biggest = num1;
}
else{
if(biggest<num1)
{
biggest = num1;
}
}
}
printf("The biggest number is %d\n",biggest);
}
| ALGO | 0.962201 | 3.417807 |
3351289c-7cff-4792-91a6-9ff55e9ad825 | pavigeetha/Data_Structures_ | lab10/lab10_q2_24011101081.cpp | #include <iostream>
#include <vector>
#include <unordered_map>
#include <string>
using namespace std;
void score();
int main(){
int t;
cout << endl;
cout << "Enter number of testcases: ";
cin >> t;
cout << endl;
for (int i=0; i<t; i++){
score();
cout << endl;
}
retu... | ALGO | 0.996852 | 4.334169 |
cda95f44-5a03-4848-b598-c28ffa2a2b57 | Pavankundrapu/leetcode_submissions | 199-binary-tree-right-side-view/binary-tree-right-side-view.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.999718 | 6.279849 |
a666cfd5-ce3f-4e77-9534-436477c3c778 | SIDLAD/CC | cses problemset/Tasks_and_Deadlines.cpp | #include <bits/stdc++.h>
const long double EPS = 1e-7;
const long long int INF = LONG_LONG_MAX/2;
const long long int M = (long long int) 1e9 + 7;//998'244'353;
using namespace std;
//insert policy here
//insert mintcode here
#if defined (ONLINE_JUDGE) || !__has_include (</home/sidlad/Desktop/Coding Folder/c and cpp ... | ALGO | 0.999982 | 4.495147 |
dde352a3-811e-48f3-83b3-4e20bfc9abf8 | betueltm/Unoesc | lab algo e estr/lista 1/ex1.cpp | #include <iostream>
using namespace std;
int main()
{
int n, i, acima_cinco = 0;
cout << "Informe a quantidade de alunos: ";
cin >> n;
float media = 0.0, temp = 0.0;
for (i = 0; i < n; i++)
{
cout << "Informe a nota do aluno " << i << ": ";
cin >> temp;
media += temp;
if ( temp > 5 )
{
acima_cinco... | TOOL | 0.993516 | 3.750055 |
1ff16054-7fcd-4911-9e22-4840140809f2 | fepfitra/sortTimeCounter | selection.cpp | #include <iostream>
#include <chrono>
#include <vector>
#include <cstdlib>
#include <cstring>
using namespace std;
void selectionSort(int arr[], int n) {
for (int i = 0; i < n - 1; i++) {
int min_idx = i;
for (int j = i + 1; j < n; j++) {
if (arr[j] < arr[min_idx])
min_idx = j;
}
if (m... | ALGO | 0.991387 | 5.934142 |
28851825-07c7-45dd-82bc-fcb24279595d | ZivFerdinand/CompetitiveProgramming | C++ Code/Favorite_Sequence.cpp | #include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <iomanip>
#include <map>
#define ll long long
using namespace std;
int main(){
int q;
cin >> q;
int n;
ll arr[1000];
while(q--){
cin >> n;
for(int i=0;i<n;i++)
cin >> arr[i];
//012 0123
for(int i=0;... | ALGO | 0.999575 | 3.149259 |
a64b115b-1e47-4bf8-a8c8-8d10b4c2ce2c | eggag32/Competitive-Programming | Codeforces/Two Hundred Twenty One (easy version.cpp | #pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cerr << #x << ": " << x << '\n'
#define debug2(x, y) debug(x), debug(y)
#define repn(i, a, b) for(int i ... | ALGO | 0.999939 | 3.627444 |
cc18dbc0-b4af-41db-bdb9-b0d7f9cc2cba | Garvit-g/RM-task-phase | C_tasks/week3/fib_recursion.cpp | #include <iostream>
using namespace std;
void fib(int n)
{
static int n1=0,n2=1,n3;
if(n>0)
{
n3=n1+n2;
n1=n2;
n2=n3;
cout << n3 << " ";
fib(n-1);
}
}
int main()
{
cout << "1 ";
fib(38);
}
| ALGO | 0.999936 | 3.503615 |
b6f46f58-3631-4412-931e-0301133af10a | cangxue/cx_quick_lua | frameworks/cocos2d-x/cocos/3d/CCOBB.cpp | #include "3d/CCOBB.h"
NS_CC_BEGIN
#define ROTATE(a,i,j,k,l) g=a.m[i + 4 * j]; h=a.m[k + 4 * l]; a.m[i + 4 * j]=(float)(g-s*(h+g*tau)); a.m[k + 4 * l]=(float)(h+s*(g-h*tau));
static Mat4 _getConvarianceMatrix(const Vec3* vertPos, int vertCount)
{
int i;
Mat4 Cov;
double S1[3];
double S2[3][3];
S... | ALGO | 0.998739 | 6.076499 |
2a4a454c-7523-439d-9cb2-336153baf441 | TaylorBisset/CS110_ComputerScience_Intro | CS110-P07_DistanceRateTime/DistanceRateAndTime/DistanceRateAndTime.cpp | // DistanceRateAndTime.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
double dist = 1; // dist = rate * time
double rate = 1; // rate = dist / time
double hours = 1; // time = dist / rate
int ma... | ALGO | 0.955424 | 5.669803 |
f70ee04c-1104-4946-9993-617fcd14be82 | ThoseBygones/ACM_Code | CodeForces/CodeForces 574B.cpp | #include <bits/stdc++.h>
using namespace std;
#define LL long long
#define MAXN 4005
#define INF 0x3f3f3f3f
int edge[MAXN][MAXN]; //ڽӾ
int degree[MAXN]; //Ķ
int u[MAXN],v[MAXN]; //߶ε˵
int n,m;
int main()
{
scanf("%d%d",&n,&m);
for(int i=1; i<=m; i++)
{
scanf("%d%d",u+i,v+i);
degree... | ALGO | 0.999634 | 3.858237 |
f01f2508-b92d-40f3-a6b0-673c56827225 | UnpureRationalist/myLeetcodeAnswer | 图/Floyd.cpp | /**
* @file Floyd.cpp
* @author your name (<EMAIL>)
* @brief Floyd 算法,用于解决全源最短路径问题,即对于给定图 G(V, E),求任意两个顶点之间的最短路径长度。时间复杂度为
* O(V^3)。由于时间复杂度较高,仅适用于顶点数最多几百的情况(300^3 = 27000000,10^7级)。
* 因为顶点不多,因此适合邻接矩阵存储图结构。
* @version 0.1
* @date 2024-05-10
*
* @copyright Copyright (c) 2024
*
*/
#include <bits/stdc++.h>
using... | ALGO | 0.999963 | 5.57563 |
cce89c84-4ff3-4896-bfc3-a8f002abb9bf | BlakeLindsay/Program10 | Program10_4.cpp | /*
Program Name: Average of Numbers
Programmer: Blake Lindsay
Course: CSC119144 Introduction to Programming C++ Spring 2022
Submission Date: 4/28/2022
This program will read all of the numbers stored in the "numbers.txt" file, and then calculate and display their average.
*/
// include directive - importing input/out... | TOOL | 0.887134 | 6.753624 |
c58c63a1-8b01-45fe-b7c7-b474ac1c76e9 | raincross7/code-similarity | codes/train_code/problem194/problem194_236.cpp | #include <iostream>
#include <vector>
using namespace std;
int parent(int p) {
return (p+1)/2-1;
}
int left(int p) {
return (p+1)*2-1;
}
int right(int p) {
return (p+1)*2;
}
int main() {
int H; cin >> H;
vector<int> heap(H);
for (int i = 0; i < H; i++) {
cin >> heap[i];
}
for (int i = 0; i < H; i... | ALGO | 0.99961 | 3.743868 |
7330dd73-de82-434c-8943-d0e3f4ed9aee | Dawoodsarfraz/CS2001-Data-Structures | codes(Lab-Practice-Assignments)/labtaskQ6.cpp | //Write a program that creates an even number of links in a link list and then finds
//the middle of the link list and insert a data item in the list.
#include<iostream>
using namespace std;
class node
{
public:
node *next;
int info;
node(int val)
{
info=val;
next=NULL;
... | ALGO | 0.999884 | 4.41062 |
e345a32f-b9a3-4774-8d93-cf796e8a9dec | ishandutta2007/codeforces | pb0207/normal/901/A.cpp | #include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
const int N=2e5+1e3+7;
int n,a[N];
bool ok=false;
int main()
{
scanf("%d",&n);
for(int i=0;i<=n;i++)
{
scanf("%d",&a[i]);
if(i!=0&&a[i]>1&&a[i-1]>1)
ok=true;
}
if(!ok)
{
puts("perfect");
return 0;
}
put... | ALGO | 0.999883 | 3.036473 |
a8fa37eb-82fc-45be-a31a-fa4b36f6bb20 | MDAsrafulhasan/Algorithm | W - 7/Module - 27/Minimum_Deletion_to_Make_Palindrome.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
string a;
cin >> a;
string b = a;
reverse(b.begin(), b.end());
int n = a.size();
int m = b.size();
int dp[n + 1][m + 1];
for (int i = 0; i <= n; i++)
{
for (int j = 0; j <= m; j++)
{
if (i == 0 ||... | ALGO | 0.999977 | 4.223666 |
6549c6d7-3ac9-427e-86d4-d40e4e468ca0 | kyungmax/AlgorithmStudy | dijkstra/1916.cpp | #include <iostream>
#include <map>
#include <vector>
#include <queue>
#include <limits.h>
using namespace std;
int city, bus; //city 1 to N
int s, g;
vector<vector<pair<int/*node*/, int/*cost*/>>> edge;
int dijkstra(){
vector <int> dist(1001, INT_MAX);
priority_queue <pair<int/*cost*/ , int /*node*/>> pq;
dist[s] =... | ALGO | 0.999794 | 3.839783 |
c3af5495-da19-4314-9f1c-607b8b89bdbb | jsrv07/Applied-problem-solving-in-CP | 24b1291_week5 Atharva/Check if Two Strings are Anagrams.cpp | class Solution {
public:
bool isAnagram(string s, string t) {
int n = s.length();
if(n != t.length()) return false;
int arr[26] = {0};
for(int i = 0; i < n; ++i){
++arr[s[i] - 'a'];
--arr[t[i] - 'a'];
}
for(int i = 0; i < 26; ++i... | ALGO | 0.999956 | 6.313372 |
127f4cad-edfd-4ee5-9b01-7709f520bdd0 | RinCloud/TrickCatcher | Datasets/TrickyBugs/GenProgs/tc_generated_progs_cpp/p03803/p03803_num5_parsed.cpp | #include<bits/stdc++.h>
using namespace std;
int n,m;
int main()
{
scanf("%d%d",&n,&m);
if(n==1 && m==1) printf("Draw");
else if(n==1) printf("Alice");
else if(m==1) printf("Bob");
else if(n>m) printf("Alice");
else if(m>n) printf("Bob");
else printf("Draw");
}
| ALGO | 0.999967 | 3.28597 |
d4a77803-9e7d-442f-b3d0-fc325b8ad43d | anish-g22/COA-LAB | Group-13 COA Mid-Sem Project/gpgpu-sim_distribution/src/intersim2/allocators/wavefront.cpp | // $Id: wavefront.cpp 5262 2012-09-20 23:39:40Z dub $
/*wavefront.cpp
*
*The wave front allocator
*
*/
#include "booksim.hpp"
#include "wavefront.hpp"
Wavefront::Wavefront( Module *parent, const string& name,
int inputs, int outputs, bool skip_diags ) :
DenseAllocator( parent, name, inputs, outputs ),
... | ALGO | 0.998925 | 5.688231 |
10723b61-cb16-420f-af24-99684c62af50 | hantwofish/recode | leetcode/leetcode/389.cpp | #include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
using namespace std;
class Solution {
public:
char findTheDifference(string s, string t) {
int data[26] = {0};
for(int i = 0 ; i < s.length(); i++){
data[ s[i] - 'a']++;
}
for(int i = 0; i < t.length... | ALGO | 0.999908 | 3.971817 |
6f276435-0ebb-4703-88d5-6590f38eb06e | atharv2001/APS-CodeLibrary | 84-BuySellStocks.cpp | #include<bits/stdc++.h>
using namespace std;
class Solution {
public:
int maxProfit(vector<int>& prices) {
int profit=0,n=prices.size();
for(int i=0;i+1<n;i++){
if(prices[i]<prices[i+1]){
profit+= (prices[i+1]-prices[i]);}
}
return profit;
}
};
int ma... | ALGO | 0.999683 | 4.985191 |
a0d4b625-17f9-4eaf-9c2b-05b6d5588b51 | rahulgarg55/LeetCode-GeeskforGeeks-Hustle | Height of Heap - GFG/height-of-heap.cpp | // { Driver Code Starts
//Initial template for C++
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
// User function Template for C++
class Solution{
public:
int heapHeight(int N, int arr[]){
// code here
return log2(N);
}
};
// { Driver Code Starts.
int main() {
i... | ALGO | 0.998958 | 5.609323 |
d35e1884-c73a-4a8b-b772-7f9a15c698db | sakurmoti/atcoder | ABC/269C.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
long long N;
cin >> N;
bitset<60> N_bit(N);
//cout << N_bit << endl;
vector<long long> ans(1,0); //配列ansに1となったところを記憶させていって徐々に増やすイメージ
int ans_size = 1; //push_backするので.size()を使うと無限ループしちゃう
for(int i = 0; i < 60; i++){
if(N_b... | ALGO | 0.999741 | 3.864296 |
af15ba33-fb3b-49b1-bcf9-814e4c996492 | isi-nlp/sbmt | sbmt_decoder/src/DLM.cpp | #include "sbmt/dependency_lm/DLM.hpp"
#include <graehl/shared/word_spacer.hpp>
#include <boost/tokenizer.hpp>
#include <sbmt/ngram/lw_ngram_lm.hpp>
#include <sbmt/ngram/big_ngram_lm.hpp>
#include <sbmt/ngram/cached_ngram_lm.hpp>
#include <string>
#include <vector>
#include <iostream>
#include <boost/function_output_ite... | ALGO | 0.977417 | 5.11795 |
8828b72a-f6d0-4a68-b0bd-5ccc878e7c6e | EagleEyeKestrel/Leetcode | 面试题/面试题 01.05. 一次编辑/template的副本.cpp | class Solution {
public:
bool oneEditAway(string first, string second) {
int m = first.size(), n = second.size();
if (m > n) return oneEditAway(second, first);
if (abs(m - n) > 1) return false;
if (m == n) {
int cnt = 0;
for (int i = 0; i < m; i++) {
... | ALGO | 0.999971 | 5.944374 |
a7c6b604-9efe-43e9-9dbc-ae2f26700186 | yellowjung/codingstudy | Solution/21610.cpp | #include <iostream>
using namespace std;
#define MAX (50 + 5)
int N, M;
int MAP[MAX][MAX];
int dr[] = {0, 0, -1, -1, -1, 0, 1, 1, 1};
int dc[] = {0, -1, -1, 0, 1, 1, 1, 0, -1};
int drr[] = {-1, -1, 1, 1};
int dcc[] = {-1, 1, 1, -1};
typedef struct st{
int r;
int c;
}RC;
RC cloud[MAX * MAX] = { 0 };
int ccn... | ALGO | 0.999946 | 4.067426 |
a1ff337d-dadd-415f-ba54-f5f966aaf3e3 | emtee40/ADB_Plugin_Extension | ADBPluginAPI.cpp | #if defined(OS_WIN)
#include <winsock2.h>
#elif defined(OS_POSIX)
#include <arpa/inet.h>
#include <errno.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <sys/types.h>
#endif
#include "JSObject.h"
#include "variant_list.h"
#include "DOM/Document.h"
#include "global/config.h"
#include "ADBPluginAPI.h"
#if ... | TOOL | 0.891317 | 5.66052 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.