uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
6dda555e-6cc5-458b-a489-e0436b5ff1d2 | KevinIsYi/100-Days-Of-Code | CP/Codeforces/1400/1375C.cpp | #include <bits/stdc++.h>
using namespace std;
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define pb(x) push_back(x)
#define mp(x, y) make_pair(x, y)
template <typename T>
T ceil(T a, T b) {
return (a + b - 1) / b;
}
template <typename T>
T gcd(T a, T b) {
return b ? gcd(b, a % b) : a;
... | ALGO | 0.999799 | 4.469703 |
6ea8a312-69ce-4e7c-9363-9f0e5bfdc795 | luliyucoordinate/Leetcode | src/1441-Build-an-Array-With-Stack-Operations/1441.cpp | class Solution {
public:
vector<string> buildArray(vector<int>& target, int n) {
vector<string> res;
int k = 1;
for (int i = 0; i < target.size(); i++, k++) {
if (target[i] == k) {
res.emplace_back("Push");
} else {
i--;
... | ALGO | 0.999851 | 6.496194 |
833b0482-4fd9-4a75-99be-d701b37ffdeb | manankhaldwa/Leetcode_Questions | 198-house-robber/house-robber.cpp | class Solution {
public:
int rob(vector<int>& nums) {
int len = nums.size();
if(len == 0) return 0;
if(len == 1) return nums[0];
int prev1 = max(nums[0], nums[1]);
int prev2 = nums[0];
int maxloot = prev1;
for(int i = 2; i < len; i++){
maxloot = m... | ALGO | 0.999813 | 5.849546 |
4cc36559-b8f4-4753-8e75-8c3a337b6d9b | RealIlya/LabsS2 | lab_itiop1/linked_list.cpp | #include <ostream>
#include "proto/linked_list.h"
list::list()
{
value = NULL;
next = NULL;
}
list::list(char *value)
{
this->value = value;
next = NULL;
}
list *list::find(char *value)
{
list *l = this;
while (l->next != NULL && *l->next->value != *value)
l = l->next;
return l->... | TOOL | 0.951686 | 4.338029 |
b416ed1a-b2cf-459c-b37e-a6c7d4943bc4 | BEIWG/Depth3D-PCL-trunk | surface/src/3rdparty/opennurbs/opennurbs_brep_extrude.cpp | /* $NoKeywords: $ */
#include "pcl/surface/3rdparty/opennurbs/opennurbs.h"
static
void ON_BrepExtrudeHelper_ReserveSpace(
ON_Brep& brep,
int extruded_trim_count,
int cap_count
)
{
if ( extruded_trim_count >= 0 && cap_count >= 0 )
{
const int vertex_count0 = brep.m_... | ALGO | 0.995012 | 6.714595 |
bb28befc-c3c1-4d09-a6d7-9087128e945e | Solcito25/Algebra-Abstracta-SolMoreliaVelasquezRodriguez- | Algoritmos Tradicionales Trabajo/HillCode V2/Matriz.cpp | #include "Matriz.h"
#include <iostream>
bool Matriz::isInvertible()
{
if (filas != columnas)
return false;
if (det == 0)
return false;
return true;
}
template <class T>
int Matriz::cofactor(vector<vector<T>> aux, int row, int col)
{
int val;
if (aux[0].size() == 1) {
val = aux[0][0];
}
else {
int x = 0,... | ALGO | 0.988074 | 4.702405 |
e009d489-4ca9-4378-9704-18fa9fca2acb | OpenCAXPlus/OpenCAXPlus | OpenDigitalTwin-main/tools/cgal/examples/Alpha_shapes_3/ex_weighted_periodic_alpha_shapes_3.cpp | #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Alpha_shape_3.h>
#include <CGAL/Alpha_shape_cell_base_3.h>
#include <CGAL/Alpha_shape_vertex_base_3.h>
#include <CGAL/Periodic_3_regular_triangulation_traits_3.h>
#include <CGAL/Periodic_3_regular_triangulation_3.h>
#include <CGAL/Random.h... | ALGO | 0.999342 | 7.735491 |
8fba33d3-0407-46cd-93b6-9d558a96f815 | limgyeonghun/PX4-Autopilot | src/lib/l1/ECL_L1_Pos_Controller.cpp | /**
* @file ECL_L1_Pos_Controller.cpp
* Implementation of L1 position control.
* Authors and acknowledgements in header.
*
*/
#include "ECL_L1_Pos_Controller.hpp"
#include <lib/geo/geo.h>
#include <px4_platform_common/defines.h>
#include <float.h>
using matrix::Vector2f;
void
ECL_L1_Pos_Controller::navigate_... | ALGO | 0.978933 | 4.307204 |
2c504263-bc88-4e7c-8218-cd689a0cb2cb | actuary/advent-of-code-2021 | Day10/10_1.cpp | #include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <array>
#include <map>
#include <algorithm>
#include <stack>
std::vector<std::string> getData(std::ifstream& in) {
std::string line;
std::vector<std::string> result;
while (std::getline(in, line)) {
result.push_back(line);
... | ALGO | 0.999095 | 5.982348 |
e195941b-6ee9-4d1c-879a-f764b1b02f3a | huzibo-yyds/algorithm | huawei/HJ3_2.cpp | //
// Created by 奉壹 on 2024/3/23.
// 使用数组实现|桶排序思想
#include <iostream>
using namespace std;
int main() {
int N,n;
while (cin>>N){
int a[1000]={0};
while (N--){
cin>>n;
a[n]=1;
}
for (int i = 0; i < 1000; ++i) {
if (a[i])
cout<<i... | ALGO | 0.999969 | 5.075487 |
5859c96a-6f88-44a8-84d0-842f632da6e3 | ishandutta2007/codeforces | stilwell/normal/338/D.cpp | #include <stdio.h>
#include <stdlib.h>
using namespace std;
long long n,m,a[10005],Lcm,g,tmp,t,rem,ans;
long long K,i,j,k;
long long gcd(long long a,long long b){if(!b)return a;return gcd(b,a%b);}
void ex_gcd(long long a, long long b, long long &x, long long &y)
{
if(!b)x=1,y=0;
else ex_gcd(b,a%b,y,x),y-=a/b*... | ALGO | 0.999956 | 3.347169 |
e1e03b75-b56c-45bb-af7e-4d0858b4d0de | brinikki/LCM-Proj-1 | .ccls-cache/@home@runner@LCM-Proj-1/main.cpp | #include <iostream>
using namespace std;
int main()
{
int num1;
int num2;
int lcm;
int i;
int multiple1;
int multiple2;
cout << endl;
cout << "What is the first number? ";
cin >> num1;
cout << "What is the second number? ";
cin >> num2;
cout << endl;
cout << "\033[93mFirst 10 factors of ... | ALGO | 0.998758 | 4.652706 |
89c1a4bd-6d04-4352-93bf-31858c4600d3 | NileshPandhare/ncoderepository | FriendMember.cpp | #include<iostream>
using namespace std;
class Marvellous
{
public:
void fun(); // Member function
};
class Demo
{
public:
int i;
private:
int j;
protected:
int k;
public:
Demo()
{
i = 10;
j = 20;
k = 30;
}
... | TOOL | 0.885614 | 4.908821 |
137c7fcc-760a-4a7c-8452-20ec5d0768f8 | shreyansh012/LeetCode | 0036-valid-sudoku/0036-valid-sudoku.cpp | class Solution {
public:
bool isValidSudoku(vector<vector<char>>& board) {
int n=board.size();
//to check all rows for repetition
for(int i=0;i<n;i++){
unordered_map<char,int> umap;
for(int j=0;j<n;j++){
if(board[i][j]!='.')
umap[board[... | ALGO | 0.999668 | 6.587739 |
90ff14a6-e8b1-49f7-bf3d-13caca21d0ca | 1119-2916/competitive-programming | codeforces/425/dd.cpp | #include <bits/stdc++.h>
using namespace std;
#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb ... | ALGO | 0.999992 | 4.252884 |
2c88b3fe-1856-474b-b8d0-867bb372ba9c | pixeloverflow/OpenCVTest | OpenCvTest/cvFindContoursTest2.cpp | #include <stdio.h>
/************************************************************************/
/* 提取轮廓两种方法对比及绘制轮廓'最大等级'分析 */
/************************************************************************/
#include <opencv2/opencv.hpp>
#include <opencv2/core/core.hpp>//OpenCV包含头文件
#include <opencv2/hi... | ALGO | 0.98272 | 3.30283 |
d5d32835-b9cd-4430-a5a3-a27a67078669 | shyamal2411/DSA-Practice | LinkedList/RemoveDuplicate.cpp | /* C++ Program to remove duplicates from a sorted linked list */
#include <bits/stdc++.h>
using namespace std;
class Node {
public:
int data;
Node* next;
};
/* The function removes duplicates from a sorted list */
void removeDuplicates(Node* head) {
/* Pointer to traverse the linked list */
Node* current = h... | ALGO | 0.999857 | 6.247113 |
d05285a1-5492-4d01-9821-4a6ff4339633 | raincross7/code-similarity | codes/train_code/problem035/problem035_267.cpp | #include <iostream>
using namespace std;
int solve(int n){
int ans=0;
for(int i=0;i<10;i++){
for(int j=0;j<10;j++){
for(int k=0;k<10;k++){
if(n-i-j-k>-1&&n-i-j-k<10)ans++;
}
}
}
return ans;
}
int main(){
int n;
while(cin>>n){
cout<<... | ALGO | 0.999127 | 4.222181 |
556f4636-f654-45d3-9a5c-b5b8348d4e97 | CharlieScarver/Alexandar_Apostolov_tues | Oject-Oriented Programming/Homework 2/Stack_Reverse_a_String.cpp | #include <iostream>
//#include <string>
#include <cstring>
using namespace std;
#define SIZE 6
class Stack{
char data_[SIZE];
char top_;
public:
Stack() {
top_=0;
}
bool empty() {
return top_==0;
}
bool full(){
return top_==SIZE;
}
void push(int val){
if(full()){
cout << "Error : Stack Full.." ... | ALGO | 0.909975 | 3.779938 |
a5d9e858-ab60-48d5-b978-c82dd341aa39 | HuanYin94/map_compression | src/comparisons/selectBySaliency.cpp | #include "ros/ros.h"
#include "ros/console.h"
#include "pointmatcher/PointMatcher.h"
#include "pointmatcher/Timer.h"
#include "pointmatcher_ros/point_cloud.h"
#include "pointmatcher_ros/transform.h"
#include "nabo/nabo.h"
#include "eigen_conversions/eigen_msg.h"
#include "pointmatcher_ros/get_params_from_server.h"
#i... | TOOL | 0.937772 | 4.648479 |
02bac22f-2d10-4d61-8f60-2b9ea14d4d12 | NotTahaAli/LeetCode | 1604-least-number-of-unique-integers-after-k-removals/least-number-of-unique-integers-after-k-removals.cpp | class Solution {
public:
int findLeastNumOfUniqueInts(vector<int>& arr, int k) {
unordered_map<int, int> count;
for (auto c: arr) {
count[c]++;
}
vector<int> counts;
counts.reserve(count.size());
for (auto c: count) {
counts.push_back(c.second)... | ALGO | 0.999916 | 6.067696 |
1a1ed701-f4af-4b7e-8857-45135400f018 | malvinval/leetcode-answers | easy/52-palindrome-linked-list/app.cpp | #include <iostream>
#include <algorithm>
/**
* Given the head of a singly linked list.
* Return true if it is a palindrome or false otherwise.
*
* Input: head = [1,2,2,1]
* Output: true
*/
struct ListNode {
int val;
ListNode *next;
ListNode() : val(0), next(nullptr) {}
ListNode(int x) : val(x), ... | ALGO | 0.999837 | 6.38491 |
59439d5f-573d-4eb5-98c0-a780f7df639a | ravenxrz/MyLeetCode | 4.CodingInterviews/NewVersion/6. 排序数组中两个数字之和.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution {
public:
vector<int> twoSum(vector<int>& numbers, int target) {
int left = 0;
int right = numbers.size() - 1;
while (left < right) {
if (numbers[left] + numbers[right] == target) {
return {left, rig... | ALGO | 0.999905 | 5.87158 |
18508949-ec4d-4c89-9a8d-b2d14cecc751 | alluharini/complierdesign-192224032 | 17.Elimination of dead code.cpp | #include <stdio.h>
int main() {
int x = 10;
int y = 5;
int result;
// Live code: This block will be executed
if (x > y) {
result = x + y;
}
// Dead code: This block will never be executed
if (y > x) {
result = y - x;
}
printf("Result: %d\n", result);
retu... | ALGO | 0.932321 | 3.734641 |
2e6d609f-3c9f-407a-a7f0-38e2d4cb3c47 | Jun0se7en/Practice-Algorithms-Analysis-and-Design | Tim_phan_tu_k_lon_nhat_trong_mang.cpp | #include <iostream>
#include <vector>
using namespace std;
int vach(vector<int> &mang, int &trai, int &phai){
int p=trai-1;
int truc=mang[phai];
for(int i=trai; i<phai; i++)
if(mang[i]<truc){
p=p+1;
swap(mang[p], mang[i]);
}
swap(mang[p+1], mang[phai]);
retu... | ALGO | 0.999989 | 4.463659 |
e94b2253-3ed3-45ff-ae84-8f1c81e8e1ac | PriyanshK09/Leetcode-Discord-Bot | solutions/minimum-deletions-to-make-array-beautiful.cpp | // Time: O(n)
// Space: O(1)
// greedy
class Solution {
public:
int minDeletion(vector<int>& nums) {
int result = 0;
for (int i = 0; i + 1 < size(nums); ++i) {
if (i % 2 == result % 2 && nums[i] == nums[i + 1]) {
++result;
}
}
return result +... | ALGO | 0.999976 | 6.06984 |
fa9c0637-11db-4acb-8a6d-aee02137c0db | en30/online-judge | atcoder/abc122_b.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, N) for (int i = 0; i < (int)N; i++)
bool isACGT(char c) {
return c == 'A' || c == 'C' || c == 'G' || c == 'T';
}
int main () {
string s;
cin >> s;
int cnt = 0;
int ans = 0;
for(int i = 0, l = s.size(); i < l;) {
cnt = ... | ALGO | 0.999723 | 3.951099 |
898dbef8-d7a5-4c7a-8cdd-4d1de70c58ee | ninjaasmoke/learn-cpp | next_steps/exercises/ex1.cpp | // ex1.cpp : Nithin
// Desc : a program to find numbers that are perfect squares but also the sum of digits
/*
Exercise 1
The integer 36 has a peculiar property: it is a perfect square, and is also the sum of the integers from 1 through 8.
The next such number is 1225 which is 352, and the sum of the integers from 1 t... | ALGO | 0.997681 | 4.696177 |
db6f22c6-222f-4d75-8891-e87d436ca313 | AhmadHoumani/LAU-CP-23 | References/Graph/Geometry_real.cpp | #include <complex>
typedef complex<double> point;
#define X real()
#define Y imag()
#define polar(r, t) (r * exp(point(0, t)))
#define length(a) hypot(a.X, a.Y)
#define angle(a) atan2(a.Y, a.X)
#define vec(a, b) (b - a)
#define dot(a, b) ((conj(a) * b).X)
#define cross(a, b) ((conj(a) * b).Y)
#define lengthsqr(a) dot... | ALGO | 0.999793 | 4.143047 |
23940fb1-d1f4-4161-a14e-c523dcee0230 | wavyeon/Problem-Solving | Baekjoon/15666.cpp | #include <iostream>
#include <set>
using namespace std;
int n, m, x;
const int MAX = 9;
set<int> arr;
int output[MAX];
void init() {
cin.tie(0);
cout.tie(0);
ios::sync_with_stdio(false);
cin >> n >> m;
for(int i = 0; i < n; i++) {
cin >> x;
arr.insert(x);
}
}
void solve(int d... | ALGO | 0.999935 | 3.842469 |
c41693f7-1568-4d79-a977-ef4712f7b659 | GitHub-LYY/interestingresources | datastructure/array/495.cpp | /*
** Author: Yangyang Liu
** Date: 2022-09-24
** Description: 495. 提莫攻击
** link: https://leetcode.cn/problems/teemo-attacking/
** reference: 题解区,搜索,【宫水三叶】简单模拟题
*/
#include <iostream>
#include <vector>
using namespace std;
class Solution {
public:
int findPoisonedDuration(vector<int>& timeSeries, int duration) {... | ALGO | 0.999736 | 6.245841 |
aa921311-6f8c-45a5-9c9f-9d98cac9b2fd | vlsi1217/aoapc-book | BeginningAlgorithmContests/exercises/ch10/UVa10820.cpp | // UVa10820 Send a Table
// Rujia Liu
// ⣺һĿx, y1<=x,y<=nijf(x,y)ij뽻DZ̫Ҫ
// ֪f(x,y)f(x*k, y*k)˺߾ͲҪˡnĴС
// nжٶ(x,y)1<=x,y<=n, gcd(x,y)=1
// 㷨x<yĸf(n)ô𰸾2f(n)+1ѷf(n)=phi(2)+phi(3)+...+phi(n)
#include<cstdio>
#include<cmath>
const int maxn = 50000;
int phi[maxn+1], phi_psum[maxn+1];
void phi_table(int n) {
phi[1] = 0;... | ALGO | 0.999664 | 3.935392 |
8aa63671-34e9-4e0a-9467-ceb4f94c891e | ThongVoHien/algorithm | bellmanford.cpp | #include <cstdio>
#include <cstring>
#include <cctype>
#include <cmath>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <functional>
#include <algorithm>
#include <climits>
#include <string>
#include <vector>
#include <utility>
#include <map>
#include <bitset>
#include <stack>
#include <queue>
#inclu... | ALGO | 0.999807 | 3.902842 |
9f861ae0-8b6c-4e4b-aa1f-e4dfe4862340 | Kzrqirtf/Striver-sSDESheet | Arrays/485-max-consecutive-ones/max-consecutive-ones.cpp | class Solution {
public:
int findMaxConsecutiveOnes(vector<int>& nums){
int ans=INT_MIN;
int count=0;
for(auto i : nums)
{
if(i==0)
{
ans=max(ans,count);
count=0;
}
else
count++;
}... | ALGO | 0.999941 | 5.848079 |
14ea805f-73a7-42c0-b8f5-738f29bb89ab | CrookedAndroid/frameworks_av | media/libeffects/hapticgenerator/Processors.cpp | #define LOG_TAG "EffectHG_Processors"
//#define LOG_NDEBUG 0
#include <utils/Log.h>
#include <assert.h>
#include <cmath>
#include "Processors.h"
#if defined(__aarch64__) || defined(__ARM_NEON__)
#ifndef USE_NEON
#define USE_NEON (true)
#endif
#else
#define USE_NEON (false)
#endif
#if USE_NEON
#include <arm_neon.h>
... | ALGO | 0.996293 | 5.614126 |
f4045f91-eb70-47d3-a027-c7d08b079f3d | Rijul1204/Algorithm_ACM | Source_Code/DAG/10000 Longest Path.cpp | #include<stdio.h>
#include<vector>
using namespace std;
int d[10000],col[10000];
vector<int>v[1000];
vector<int>topo;
void dfs(int s);
int main(){
int i,j,k,l,dis,e,c,t=1,n;
// freopen("in.txt","r",stdin);
while(scanf("%d",&n)==1){
if(!n) break;
for(i=0;i<=n;i++){
d[i]=-1;
col[i]=0;
v[i].clear()... | ALGO | 0.99878 | 3.651244 |
64304f9d-ffc8-44b6-a25e-0636e0b9e096 | OscarJin/leetcode-cpp | 64.minimum-path-sum.cpp | /*
* @lc app=leetcode id=64 lang=cpp
*
* [64] Minimum Path Sum
*/
// @lc code=start
class Solution {
public:
int minPathSum(vector<vector<int>>& grid) {
int m = grid.size();
int n = grid[0].size();
for (int i = 1; i < m; i++)
{
grid[i][0] += grid[i - 1][0];
}... | ALGO | 0.999897 | 6.409594 |
1083b686-da2e-4487-bf1a-e649d4e88dc7 | Aecotyle/GIKI-TASKS-2021664 | fast_assign/(b).cpp | #include<iostream>
using namespace std;
int main(){
int n;
cout<<"enter a number"<<endl;
cin>>n;
int space=1;
for(int i=0;i<=n;i++){
for(int j=0; j<n-i;j++){
cout<<"*";
}
for(int j=0;j<space;j++){
cout<<" ";
}
for(int j=0;j<2*n-2*i;j++){
cout<<"/";
}
for(int j=-2;j... | ALGO | 0.999338 | 3.322648 |
8e7e6788-b4f8-4bc2-ad1b-681077361a25 | ishandutta2007/codeforces | yhx-12243/normal/1528/B.cpp | #include <bits/stdc++.h>
using std::cin;
using std::cout;
const int N = 1000054, mod = 998244353;
int n;
int pn = 0, c[N], p[78540];
int f[N], fd[N];
inline void add(int &x, const int y) {x += y - mod, x += x >> 31 & mod;}
void sieve(int n) {
int i, j, v; f[1] = fd[1] = 1;
memset(c, -1, sizeof c);
for (i = 2; i ... | ALGO | 0.999984 | 4.960011 |
66cdb15b-abe6-4046-b7b3-436fee397a62 | vbonnici/grafe-sim | analysis/data/p01140/s502113356.cpp | #include <iostream>
#include <algorithm>
#include <map>
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef pair<int,int> pii;
typedef pair<int,pii> ipii;
int main()
{
while(1){
int N, M;
cin >> N >> M;
if(N == 0 && M == 0) break;
int h[N], w[M];
REP(i,N)
cin >> h[i]... | ALGO | 0.999675 | 3.051722 |
fcd3df4c-183d-42ef-8103-1753d7f740dd | RishabhSinghal04/C_Plus_Plus | 2 Control Statements/Other Patterns/StarCount1.cpp |
#include <iostream>
#include <conio.h>
using namespace std;
int main()
{
unsigned short nRows;
cout << "Enter number of rows: ";
cin >> nRows;
for (int i = 1; i <= nRows + 1; ++i)
{
for (int j = 1; j <= i; ++j)
{
(j < i) ? cout << "*" : cout << i - 1;
}
... | ALGO | 0.969018 | 3.92679 |
83cf0057-7acb-48a4-831b-73665b5420ee | seonyoung169/Algorithm | BOJ/21317_DP.cpp | #include <iostream>
#include <vector>
// BOJ 21317 징검다리 건너기, DP, 실버 1
using namespace std;
int getMinEnergy(vector<pair<int, int>> energy, int N, int K){
vector<vector<int>> dp(N+1, vector<int>(2, 2147483647));
dp[1][0] = 0;
dp[1][1] = 0;
for (int i = 1; i<=N-1 ; ++i) {
if (i + 1 <= N) {
... | ALGO | 0.999856 | 4.210403 |
7035cd2b-88a8-4c21-bef5-177b43e74d06 | ArjunTa1war/codeforces | 1325b.cpp | #include <iostream>
#include <algorithm>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t;
cin>>t;
for (int i = 0; i < t; i++)
{
int n;
cin>>n;
int arr[n];
for (int i = 0; i < n; i++)
{
cin>>arr[i];
... | ALGO | 0.999767 | 4.204238 |
366e4632-0421-43c9-9b22-8fc948eb9b07 | bananadroid/android_external_cronet | buildtools/third_party/libc++/trunk/test/std/algorithms/alg.modifying.operations/alg.copy/ranges.copy.pass.cpp | // <algorithm>
// UNSUPPORTED: c++03, c++11, c++14, c++17
// template<input_iterator I, sentinel_for<I> S, weakly_incrementable O>
// requires indirectly_copyable<I, O>
// constexpr ranges::copy_result<I, O> ranges::copy(I first, S last, O result);
// template<input_range R, weakly_incrementable O>
// requires ... | TEST | 0.90557 | 7.58441 |
ca5d69ca-cd25-4d34-a290-198badf49ad3 | Lnrivas/CPSC350_FA21_ASSIGNMENT5_RIVAS | Stats.cpp | /*
* Name: Luis Rivas
* ID: 2365948
* email: <EMAIL>
* CPSC-350-03
* Assignment 5 - Registrar’s Office Simulation
* This is the implementation .cpp file for the Stats class.
*/
#include "Stats.h"
Stats::Stats() {
}
Stats::~Stats() {
}
void Stats::printStats(int waitTimes[], int numStudents, int idleTimes[], ... | ALGO | 0.951692 | 5.580256 |
fb5d01ea-0e6d-4bb3-a6ca-5d0797b16e9e | Siddsharma2002/C- | dummy2.cpp | #include<bits/stdc++.h>
using namespace std;
vector<int> read(int n, vector<int> book, int target){
map<int,int> mpp;
for (int i = 0; i < n; i++)
{
int a=book[i];
int more=target-a;
if (mpp.find(more)!=mpp.end())
{
return {mpp[more],i};//this use of curly br... | ALGO | 0.999936 | 5.128663 |
306e488e-c6a2-443c-a9a8-2250939c6337 | Arceus-sj/CP-Challenges | CodeChef_Submission/Basic_Practice/reverseStarPattern.cpp | #include<iostream>
using namespace std;
int main() {
int n;
cin >> n;
for(int i = 0; i < n; i++) {
for(int j = i; j < n - 1; j++)
cout << " ";
for(int k = 0; k <= i; k++)
cout << "*";
cout << endl;
}
return 0;
} | ALGO | 0.99996 | 3.670087 |
ee3895ce-8333-4455-abfb-ec323ee1c7f8 | Daek-You/Algorithm | C++/BOJ/단계별로 풀어보기/17. 심화2/[BOJ_1037] 약수.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
/*
1 2 5 10 20 25 50 100
- 주어진 약수 리스트들 중, 중앙값의 제곱이 바로 찾는 수가 된다.
*/
int main() {
cout.tie(NULL);
cin.tie(NULL);
ios::sync_with_stdio(false);
int N;
cin >> N;
vector<int> divisors(N);
for (int i = 0; i < N; i++)
{
int data;
... | ALGO | 0.999914 | 5.664903 |
89387f71-ce3d-4726-9e1c-8b6f396a1014 | Anshul407/LeetCode | 0236-lowest-common-ancestor-of-a-binary-tree/0236-lowest-common-ancestor-of-a-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:
TreeNode* lowestCommonAncestor(TreeNode* root, TreeNode* p, TreeNode* q) {
if(root==NUL... | ALGO | 0.999982 | 5.845994 |
3011c3e6-0a4e-4e19-bc12-2dbdd4d17d93 | furokl/BlackJack | black_jack.cpp | #include <iostream>
#include "black_jack.h"
#include "game_rule.h"
void playBlackJack() {
do
{
std::vector<Card> deck;
deck.resize(game_rule::length_deck);
size_t card{};
for (int rank{}; rank < MAX_RANKS; rank++)
for (int suit{}; suit < MAX_SUITS; suit++)
{
deck[card].rank = static_cast<Card_Ran... | TOOL | 0.892486 | 5.653783 |
05334f08-762b-4d94-a489-76e7106bc4cd | wfxedu/CRF-BLSTMParser | eigen/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_colwise.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
int main()
{
Eigen::MatrixXf mat(2,4);
mat << 1, 2, 6, 9,
3, 1, 7, 2;
std::cout << "Column's maximum: " << std::endl
<< mat.colwise().maxCoeff() << std::endl;
}
| ALGO | 0.999763 | 3.779679 |
065589c5-0f69-4e3d-ab8e-42636110fc6d | rootid/fft | backtrack/cs-II.cpp | //## Combination Sum III
//### Find all possible combinations of k numbers that add up to a number n, given that only numbers from 1 to 9 can be used and each combination should be a unique set of numbers.
//Example 1:
//Input: k = 3, n = 7
//Output:
//[[1,2,4]]
//Example 2:
//Input: k = 3, n = 9
//Output:
//[[1,2,6], ... | ALGO | 0.999941 | 5.331375 |
dd7f4110-aa63-45fb-9e63-24b2bd09397a | daeunchung/cplusplus | Q_DP4.cpp | /*
ִκ
1迭 -> python 1 Ʈ
Ǯ : arr[i] غ.
dy[i] ǹ : arr[i] ϴ κ
߿
dy[i] ִ
*/
#include<bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
freopen("input.txt", "rt", stdin);
int n, res=0;
cin>>n;
vector<int> arr(n+1), dy(n+1); // 0 ʱȭ
for(int i = 1; i<=n; i... | ALGO | 0.999948 | 4.183897 |
8a5e8274-9db6-4e21-97a5-bf49aa4ec2f1 | sarvex/leetcode-shakespeare | solution/0600-0699/0682.Baseball Game/Solution.cpp | class Solution {
public:
int calPoints(vector<string>& ops) {
vector<int> stk;
for (auto& op : ops) {
int n = stk.size();
if (op == "+") {
int a = stk[n - 1];
int b = stk[n - 2];
stk.push_back(a + b);
} else if (op =... | ALGO | 0.999904 | 6.507763 |
aa5e2c2c-b78e-4765-8156-c44501e74cec | truonghuy1011/AdvancedProgramming | Dequy_bai3.cpp | #include<iostream>
using namespace std;
#define Max 100
int n;
int Min(int a[Max],int n){
if (n == 0)
return -1;
if (n == 1)
return a[0];
else{
if (a[n - 1] < Min(a, n - 1))
return a[n - 1];
else
return Min(a, n - 1);
}
}
int main(){
int a[Max];
cout<<"Nhap Vao n: ";
cin>>n;
for(int i=0;i... | ALGO | 0.998775 | 3.571657 |
a6704939-b497-4e74-914c-118e43a5df3b | ChameleonOS/android_external_skia | src/utils/SkParse.cpp | #include "SkParse.h"
static inline bool is_between(int c, int min, int max)
{
return (unsigned)(c - min) <= (unsigned)(max - min);
}
static inline bool is_ws(int c)
{
return is_between(c, 1, 32);
}
static inline bool is_digit(int c)
{
return is_between(c, '0', '9');
}
static inline bool is_sep(int c)
{
... | TOOL | 0.869478 | 5.845361 |
aba75e17-e2e1-4c7f-aec7-20796b7df5ed | tasddc1226/Algorithms | 백준/입출력과_사칙연산/10869.cpp | /*
date : 2021.09.13
problom : 10869
title : 사칙연산
discribe : 모든 연산 문제
*/
#include <iostream>
using namespace std;
int main() {
int a,b;
cin >> a >> b;
cout << a+b << "\n";
cout << a-b << "\n";
cout << a*b << "\n";
cout << a/b << "\n";
cout << a%b;
return 0;
} | ALGO | 0.998836 | 3.670552 |
b8d05b6c-d5dd-4d44-9530-f346ef45cfc5 | Euijune/2021_C-Study | C++_STUDY/BAEKJOON/Q_1629.cpp | #include <iostream>
using namespace std;
int pow2(int A, int B, int C) {
if (B == 1)
return A % C;
long long k = pow2(A, B / 2, C);
if (B % 2 == 0)
return (k * k) % C;
else
return ((k * k) % C * (A % C)) % C;
}
int main() {
int A, B, C;
cin >> A >> B >> C;
cout<<pow2(A, B, C);
return 0;
} | ALGO | 0.999975 | 4.49935 |
4af599e8-328b-4395-8860-937062289b38 | ishandutta2007/codeforces | skywalkert/normal/1030/A.cpp | #include <bits/stdc++.h>
int n, x;
int main() {
scanf("%d", &n);
while(n--) {
scanf("%d", &x);
if(x) {
puts("HARD");
return 0;
}
}
puts("EASY");
return 0;
} | ALGO | 0.998573 | 3.672837 |
91b8cbeb-51e6-400b-bbc3-517b9221f83b | ishandutta2007/codeforces | ehnryx/normal/1342/E.cpp | //#pragma GCC optimize("O3")
//#pragma GCC target("sse4,avx2,abm,fma,tune=native")
#include <bits/stdc++.h>
using namespace std;
#define _USE_MATH_DEFINES
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template <typename T>
using ordered_set = tree<T, null_typ... | ALGO | 0.999992 | 5.069675 |
8d6d68e3-d618-48dc-80c8-a9e1043f8ddb | busebd12/InterviewPreparation | LeetCode/C++/General/Easy/ReadNCharactersGivenRead4/solution.cpp | /*
Time complexity: O(n)
Space complexity: O(n)
*/
class Solution
{
public:
/**
* @param buf Destination buffer
* @param n Number of characters to read
* @return The number of actual characters read
*/
int read(char *buf, int n)
{
//Buffer us... | ALGO | 0.887454 | 5.898892 |
7e86e0ee-8fc2-4594-8c44-7de06dae3c13 | ishandutta2007/codeforces | fuppy/normal/1344/B.cpp | #include <bits/stdc++.h>
using namespace std;
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl;
#define DEBUG_MAT(v) cerr<<#v<<endl;for(int i=0;i<v.size();i++){for(int j=0;j<v[i].size();j++) {cerr<<v[i][j]<<" ";}cerr<<endl;}
typedef... | ALGO | 0.99981 | 4.212475 |
1905152b-02f9-4eea-b0df-3389d78ea1e6 | aldodell/primos | primeGenerator.cpp | #include "primeGenerator.h"
/**
* First version program wich build prime data base
* */
primeGenerator::primeGenerator()
{
this->index = 0;
this->_last = 0;
}
void primeGenerator::generate(int64 max)
{
this->maximum = max;
/*
Size memory: (2/5) * max... then /8 (to bits)
For each number to evaluate, only sa... | ALGO | 0.989795 | 3.42135 |
cdfcf64b-2285-4e51-ae9f-4643ffff753b | KwanWaiPang/DBA-Fusion_comment | thirdparty/gtsam/gtsam/3rdparty/Eigen/bench/bench_gemm.cpp |
// g++-4.4 bench_gemm.cpp -I .. -O2 -DNDEBUG -lrt -fopenmp && OMP_NUM_THREADS=2 ./a.out
// icpc bench_gemm.cpp -I .. -O3 -DNDEBUG -lrt -openmp && OMP_NUM_THREADS=2 ./a.out
// Compilation options:
//
// -DSCALAR=std::complex<double>
// -DSCALARA=double or -DSCALARB=double
// -DHAVE_BLAS
// -DDECOUPLED
//
#include... | TOOL | 0.991196 | 5.857575 |
af5cb8e3-d5c5-4949-8240-7501d61b3ebe | muhammadhasan01/cp | Online Judge/Codeforces/Contests/DIV1+DIV2/DIV1+DIV2-733/E.cpp | #include <bits/stdc++.h>
using namespace std;
const int K = 26;
char get_alphabet(int x) {
return char(x + int('a'));
}
void solve() {
string str;
cin >> str;
int n = str.size();
vector<int> freq(K);
for (char cc : str) {
freq[(int) (cc - 'a')]++;
}
auto output_remainders = [... | ALGO | 0.999981 | 5.376353 |
b124a246-ce85-4147-be9c-715b8c5e2346 | andrewzolotukhin/leetcode | P02962CountSubarrays/solution.cpp | class Solution {
public:
long long countSubarrays(vector<int> &nums, int k) {
vector<int> maxIndexes;
int m = INT_MIN;
for (auto v : nums)
if (v > m)
m = v;
long long ans = 0;
for (int i = 0; i < nums.size(); i++) {
if (nums[i] == m)
maxIndexes.push_back(i);
if (... | ALGO | 0.999987 | 5.86508 |
25395e69-8af2-4d26-bda5-3756b032da20 | ishandutta2007/codeforces | rafi22/normal/1654/E.cpp | #include <bits/stdc++.h>
#pragma GCC target ("avx2,fma")
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
//#define int long long
#define ll long long
#define ld long double
#define endl '\n'
#define st first
#define nd second
#define pb push_back
#define sz(x) (int)(x).size()
#define all(x) (x).begin... | ALGO | 0.999851 | 4.681053 |
5ce2f3da-d85a-43a6-ad41-6ef8bb45598b | raktimdey15/1st-Year-Projects | Loops/forloop3.cpp | //Write and run a C++ program to find the sum = 1 − 3^2 + 5^2 − .... using the for loop.
#include <iostream>
using namespace std;
int main() {
int n;
cout << "Enter the number of terms in the series: ";
cin >> n;
int sum = 0;
int sign = 1;
for (int i = 1; i <= n; ++i) {
sum += sign * ... | ALGO | 0.999984 | 4.168453 |
e1c0797c-2433-470d-8682-c52090e9eaf4 | kunalpro379/DSA_leetcode_300__2024 | L861_Score_After_Flipping_Matrix.cpp | class Solution {
public:
int matrixScore(vector<vector<int>>& grid) {
int m =grid.size();
int n=grid[0].size();
//ensuring leftmost digit of each row is 1
for(int i=0;i<m;i++){
if(grid[i][0]==0){//if leftmost digit is 0,flip
for(int j=0;j<n;j++){
... | ALGO | 0.999969 | 6.459671 |
0fa2f288-40a5-4a87-9787-756a73a89408 | tmittal98/CPP-codes | HashTable-Hashing/unordered-map-STL.cpp | #include <iostream>
#include <unordered_map>
#include <vector>
#include <string>
using namespace std;
int main() {
unordered_map<string, vector<string> > phonebook;
phonebook["Mini"].push_back("9339116843");
phonebook["Papa"].push_back("9831844984");
phonebook["Papa"].push_back("9831XXXXXX");
phonebook["Mini"]... | TOOL | 0.913101 | 3.693412 |
561a10d4-e8ae-44b1-b0b6-0867524cb14c | marco-park/problemSolving | CODEFORECES/Codeforces Round #630 (Div. 2)/C.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <cstring>
#include <string>
using namespace std;
int cnt[200001][26];
int ret[200001];
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t;
cin >> t;
while(t--){
int n,k;
cin >> n >> k;
... | ALGO | 0.999946 | 4.25172 |
dde9536c-8d0e-4763-864c-0646e592ae68 | triSYCL/sycl | llvm/lib/Transforms/Scalar/LoopInstSimplify.cpp | #include "llvm/Transforms/Scalar/LoopInstSimplify.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/AssumptionCache.h"
#include "llvm/Analysis/InstructionSimplify.h"
#include "llvm/Analysis/LoopInfo.h"
#include ... | ALGO | 0.987569 | 4.494008 |
ad6cafa0-e402-4d1c-89dd-6d58cfea218f | lucianmot/codechef-problems | 936 - C++ - Two vs Ten.cpp | // C++ - Two vs Ten
// Rating - 936
// https://www.codechef.com/problems/TWOVSTEN
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int t, x;
cin >> t;
while(t--) {
cin >> x;
if(x % 10 == 0) cout << 0 << "\n";
else if(x % 5 == 0) co... | ALGO | 0.999378 | 5.062294 |
e0a39d79-8a60-4001-8892-b5bc66431821 | Vega47/Code-Forces | D. Difference/index.cpp | #include<iostream>
using namespace std;
int main(){
long long a,b,c,d;
cin>>a>>b>>c>>d;
cout<<"Difference = "<<(a*b)-(c*d);
} | ALGO | 0.999515 | 3.984178 |
fea6c818-49b2-41b3-842e-ebcbbdc1cdc0 | ultmitelin/c | Grade1/diamond666.cpp | #include <algorithm>
#include <cmath>
#include <iostream>
using namespace std;
int main() {
int a;
while (cin >> a) {
for (int i = 1; i <= 2 * a + 1; i++) {
if (i <= a + 1) {
string s(a - i + 1, ' ');
cout << s;
string s1(2 * i - 1, '*');
cout << s1 << endl;
} else {
... | ALGO | 0.999946 | 3.261816 |
de35b742-1057-4c04-9af4-c636b2766f36 | yanncalec/XrayCT | src/BlobInterpl.cpp | #include "BlobInterpl.hpp"
// Member functions for BlobInterpl
void BlobInterpl::BlobInterpl_init()
{
this->d_X.resize(nbScale);
this->d_Y.resize(nbScale);
this->memsize_X.setZero(nbScale);
switch (linoptype) {
case _Img_ :
this->set_shapeY(igrid->nbNode, 1);
this->memsize_Y = igrid->nbNode * sizeo... | ALGO | 0.94808 | 5.968229 |
8301e894-d393-4842-8b54-ce5a0f4b3ce4 | luobuyu/Code-test-daily | written_test/tme/tengxunyinyue0418/1.cpp | #include <bits/stdc++.h>
using namespace std;
struct ListNode {
int val;
struct ListNode *next;
ListNode(int x) : val(x), next(nullptr) {}
};
class Solution
{
public:
/**
* 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
*
*
* @param head ListNode类
* @return ListNode类
*/
ListNode *in... | ALGO | 0.994291 | 3.920362 |
5c2fd736-3939-42d8-b4ac-d46c4a1a6334 | KNN-07/CodeforcesSubmissions | codeforces/1017/B.cpp | /*
Templete by norman/KNN-07
*/
#include <bits/stdc++.h>
using namespace std;
#define el '\n'
#define mp make_pair
#define pb push_back
#define ppb pop_back
#define pf push_front
#define fi first
#define nd second
#define forinc(i, a, b) for (int i = a; i <= b; i++)
#define fordec(i, a, b) for (int i = a; i >= b; i--)
... | ALGO | 0.999935 | 4.044765 |
02ba68cf-c85a-40ee-8cd1-f80aeb558fb2 | Twilight-Dream-Of-Magic/Algorithm_OaldresPuzzleCryptic | OOP/BlockCipher/ExtraIncludes/eigen/doc/snippets/Cwise_array_atan2_array.cpp | Array<double,1,3> x(8,-25,3),
y(1./3.,0.5,-2.);
cout << "atan2([" << x << "], [" << y << "]) = " << x.atan2(y) << endl; // using ArrayBase::pow
cout << "atan2([" << x << "], [" << y << "] = " << atan2(x,y) << endl; // using Eigen::pow
| TOOL | 0.955735 | 3.496417 |
b6cc1101-5b4c-443f-81f0-0c472c77e9a2 | psj98/sds_alg | baekjoon/1차시 - 알고리즘 기초/1차시 연습/1039.cpp | #include <iostream>
#include <queue>
#include <set>
using namespace std;
queue<string> q;
int n;
void swap(string& s, int a, int b){
char temp = s[a];
s[a] = s[b];
s[b] = temp;
}
int main(){
string str, answer = "0";
cin >> str >> n;
q.push(str); // queue ߰
for(int i = 0; i < n; i++) {... | ALGO | 0.999977 | 4.573849 |
6093017a-c39d-4549-8e9e-2bccb2a2c351 | MariaChrysafis/CompetitiveProgramming | AtCoder/abc236_d.cpp | #include <iostream>
#include <vector>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <map>
#include <algorithm>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <cstring>
using namespace std;
typedef long long ll;
void print (vector<int> v) {
for (int i: v) {
cout <... | ALGO | 0.999954 | 4.011717 |
78117c38-a0b1-4d0c-b253-2009c0496fda | konadevel/KONA | src/addrman.cpp | #include "addrman.h"
#include "hash.h"
#include "serialize.h"
#include "streams.h"
using namespace std;
int CAddrInfo::GetTriedBucket(const uint256& nKey) const
{
uint64_t hash1 = (CHashWriter(SER_GETHASH, 0) << nKey << GetKey()).GetHash().GetLow64();
uint64_t hash2 = (CHashWriter(SER_GETHASH, 0) << nKey << ... | TOOL | 0.92554 | 6.605265 |
f8d3eb00-6b73-4aba-a2d2-2ec957fad49a | chojpsh1/OnedayAlgorithm | 1224.cpp | #include <iostream>
#include <string>
#include <stack>
using namespace std;
string Formula;
stack<char> S;
stack<int> NumS;
void init()
{
Formula.clear();
cin >> Formula;
}
bool IsNum(char aChar)
{
return ('0' <= aChar && aChar <= '9');
}
int GetPrior(char aChar)
{
if (aChar == '(')
{
r... | ALGO | 0.999819 | 4.061939 |
9c419481-00c4-423a-96e3-a807d0d0250e | ysw-hello/Demo_iOS_Book | iOS疯狂讲义代码/codes下/14/14.8/HelloBox2D/HelloBox2D/libs/Box2D/Collision/b2CollidePolygon.cpp | #include <Box2D/Collision/b2Collision.h>
#include <Box2D/Collision/Shapes/b2PolygonShape.h>
// Find the separation between poly1 and poly2 for a give edge normal on poly1.
static float32 b2EdgeSeparation(const b2PolygonShape* poly1, const b2Transform& xf1, int32 edge1,
const b2PolygonShape* poly2, const b2Tra... | ALGO | 0.999789 | 6.904894 |
4cd994ac-eee0-4221-a141-c261e6b9c046 | jasfin/CPP-Programming | coin/coin_change.cpp | #include<iostream>
#include<vector>
using namespace std;
int main()
{
int n,ele;
vector<int> v;
cout<<"enter n";
cin>>n;
for(int i=0;i<n;i++)
{
cin>>ele;
v.push_back(ele);
}
// 1,2,5
char f1='y',f2='y',f5='y';
int large,idiff1,idiff2,idiff5,diff1=0,diff2=0,diff5=0... | ALGO | 0.99995 | 3.079012 |
f295d55e-8b15-4f79-bcc1-c1141cc44ff0 | huiseon37/PS | BOJ/C++/1000-10000/9093.cpp | //9093
#include <iostream>
#include <string>
using namespace std;
int main() {
int n;
char arr[1001];
string str;
cin >> n;
for (int i = 0; i < n; i++) {
if (i == 0) getline(cin, str);
getline(cin, str);
int len = str.length();
int pass = 0;
int anum = 0;
for (int j = 0; j <=len; j++) {
if (st... | ALGO | 0.999917 | 3.255695 |
a8147653-ad5e-44e5-b58a-dfca70e31855 | kysMIRACLE/PP1_MUKHSIMBAYEV | lab9/O.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
using namespace std;
int main() {
int n;
cin >> n;
map <string, string> accounts;
map <string, int> exist;
for (int i = 0; i < n; i++)
{
string login, password;
cin >> login >> password;
... | ALGO | 0.996403 | 4.052101 |
c18a0099-1abd-470e-b466-159dfa238b8d | wogud3649/Jaehyung | Practice/Practice/Solved/MultiplyingString.cpp | #include <iostream>
#include <vector>
#include <string>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <list>
#include <string>
#include <vector>
#include <stack>
#include <algorithm>
using namespace std;
string solution(string my_string, int k) {
string answer = "";
for (int i = 0; i < k; i... | ALGO | 0.999044 | 3.515462 |
8480eae2-ae37-41bd-80f0-7c5e8dc4f52c | AshkenSC/Programming-Practice | LeetCode/0118. Pascal's Triangle.cpp | /*
0118. Pascal's Triangle
给定正整数n,生成杨辉三角的前n行。
*/
#include <vector>
using namespace std;
class Solution {
public:
vector<vector<int>> generate(int numRows) {
vector<vector<int>> result;
if (numRows == 0)
return result;
result.push_back(vector<int>(1, 1));
for (int i... | ALGO | 0.999961 | 6.399071 |
dbeecff6-22a1-452a-adc5-7f1c4230d3a1 | 21111019Harry/CPP-Problems | Problems on array/45.cpp | #include<iostream>
#include<bits/stdc++.h>
using namespace std;
void uniquetotalfind(vector<int> &v);
int main()
{
int size = 0, n = 0;
cout<< "Enter the size:-";
cin>>size;
vector<int> v;
for(int i = 0; i < size; i++)
{
cout<< "Enter the element:-";
cin>>n;
v.push_b... | ALGO | 0.998815 | 4.188401 |
07e44087-679b-4604-9592-3e6391448f88 | hjiang13/LLMs-in-IR | POJ-104/74/298.cpp | #include <iostream>
using namespace std;
int su(int m)
{
int p,i;
if(m==2)
{
p=1;
}
else if (m==1)
{
p=0;
}
else
{
for(i=2; i<m; i++)
{
if(m%i==0)
{
p=0;
break;
}
}
if(i==m)
{
p=1;
}
}
return (p);
}
int hui(int m)
{
int i=m,j=0,p;
while(m>0)
{
j=j*10+m%10;
m/=10;
}
if(i==j)
{
p=1;
}
else
{
p=0;
}
return(p);
}
int main(... | ALGO | 0.999972 | 3.111075 |
ebf4d266-6887-4b9e-98c2-adb54a86ab22 | chaeyeon-yang/Algorithm | 프로그래머스/0/120860. 직사각형 넓이 구하기/직사각형 넓이 구하기.cpp | #include <string>
#include <vector>
#include <cmath>
using namespace std;
int solution(vector<vector<int>> dots) {
int garo1 = -300;
int garo2 = -300;
int sero1 = -300;
int sero2 = -300;
for(int i=0; i<dots.size(); i++) {
if (garo1 == -300) garo1 = dots[i][0];
if (garo1 != -300 && ... | ALGO | 0.999886 | 4.980083 |
b28bd8b6-ceed-42c0-b288-419c0ad4dcbe | AkifAzwad/cp_repo | uva/10469 - To Carry or not to Carry2.cpp | #include<bits/stdc++.h>
using namespace std;
const double PI=acos(-1.0);
int main()
{
int a,b;
while(cin>>a>>b)
{
printf("%d\n",a^b);
}
return 0;
}
| ALGO | 0.999847 | 3.556992 |
b9a19ab3-1749-426b-9c2e-09ec018f0b32 | alexandraback/datacollection | solutions_1674486_0/C++/HuZhongXian/main.cpp | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <queue>
using namespace std;
#define MAX_STR_NUM 256
int main(int argc, char* argv[])
{
char filename[2][MAX_STR_NUM];
sprintf(filename[0], "%s", "A-small-attempt0.in");
sprintf(filename[1], "%s.out", filename[0]);
FILE* input = fopen(filename[... | ALGO | 0.99977 | 4.772711 |
61a6b885-9de8-4edb-ac2c-233489e0ed5c | VictorRoF11/problemas-COJ | 1028-allInAll.cpp | #include <bits/stdc++.h>
using namespace std;
char s[32];
char t[32];
int ini;
int main(){
while(cin>>s>>t){
int j=0;
int ban=0;
for (int i = 0; i < strlen(t); ++i){
if(s[j] == t[i]){
ban++;
j++;
}
}
if(ban == strlen(s))cout<<"Yes\n";
else cout<<"No\n";
}
return 0;
} | ALGO | 0.999938 | 3.912125 |
ab333cc3-392d-4e49-8856-774d93ffb9d6 | Toshiyana/leetcode-cpp | Heap_PriorityQueue/medium/347_Map_Queue.cpp | #include <bits/stdc++.h>
#include "./../../Utils/Utils.h"
using namespace std;
// https://leetcode.com/problems/top-k-frequent-elements/discuss/81624/C%2B%2B-O(n-log(n-k))-unordered_map-and-priority_queue(maxheap)-solution
// C++ O(n log(n-k)) unordered_map and priority_queue(maxheap) solution
class Solution
{
publi... | ALGO | 0.999983 | 5.782049 |
6c492399-1ccc-4d75-8384-5fa50af42e1b | i-rony18/leetcode | my-folder/problems/longest_arithmetic_subsequence/solution.cpp | class Solution {
public:
int longestArithSeqLength(vector<int>& arr) {
int res = 2,n = arr.size();
for(int j=-500;j<=500;j++)
{
vector<int> mp(1501,-1);
int result = INT_MIN;
for(int i=0;i<n;i++)
{
if(mp[arr[i]-j+500] == -... | ALGO | 0.999948 | 5.45791 |
3fb9cc13-d697-4e19-a057-08046e30bd7d | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_6509_31.cpp | #include <bits/stdc++.h>
using namespace std;
const double inf = 1e12;
int N, K;
vector<int> T;
vector<double> psum;
vector<double> invs, tt;
void prec() {
psum.resize(N);
for (int i = 0; i < N; i++) {
psum[i] = (double)T[i];
if (i != 0) psum[i] += psum[i - 1];
}
invs.resize(N);
for (int i = 0; i < N;... | ALGO | 0.999948 | 3.558623 |
960bbb68-69ad-4c3a-9c3f-f102bc322f0b | Daksh374/Cpp | Recursion Basics/Q1.cpp | // PRINT NAME N TIMES USING RECURSION
#include <iostream>
using namespace std;
void name(int i, int n) {
if (i > n) {
return;
}
cout << "Daksh" << endl;
name(i + 1, n);
}
int main() {
int n;
cout << "Enter value of n -> ";
cin >> n;
name(1, n);
return 0;
} | ALGO | 0.988465 | 5.584839 |
811268ed-cb45-4ffb-876d-04d58607f399 | SAGGSOC/CodeChef-Programs | permutation.cpp | #include <bits/stdc++.h>
using namespace std;
// Function to generate permutations
void permute(string input)
{
int n = input.length();
// Number of permutations is 2^n
int max = 1 << n;
// Using all subsequences and permuting them
for (int i = 0; i < max; i++) {
// Converting string... | ALGO | 0.999746 | 5.821102 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.