uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
f95dbd11-49cb-44e9-8c9f-3a3adf1344cd | Zahraa-HM/Sorting. | ConsoleApplication1/ConsoleApplication1.cpp |
#include <iostream>
using namespace std;
int main()
{
int i, j, temp;
int array[10];
cout << "Enter 10 numbers to order:\n";
for (i = 0; i < 10; i++)
{
cin >> array[i];
}
for (i = 0; i < 10 - 1; ++i)
{
for (j = 0; j < 10 - i - 1; ++j)
if (array[j] > array[j + 1])
{
temp = array[j];
array[j] ... | ALGO | 0.999654 | 4.07608 |
b442547e-5429-4e9d-b7c7-08e0a2450652 | shutch42/Advent-of-Code-2021 | 04/pt1.cpp | #include <iostream>
#include <fstream>
#include <sstream>
#include <string>
using namespace std;
struct node {
int num;
node* next;
};
struct board {
int nums[5][5];
bool mark[5][5];
board* next;
};
void printNodes(node* head) {
node* curr = head;
while(curr != nullptr) {
cout << curr->num << endl;
curr = ... | ALGO | 0.999947 | 3.770795 |
0cfbb682-5465-4149-8ceb-c96ce694aa82 | viviansh/234313 | ArduSub/control_auto.cpp | #include "Sub.h"
/*
* control_auto.cpp
* Contains the mission, waypoint navigation and NAV_CMD item implementation
*
* While in the auto flight mode, navigation or do/now commands can be run.
* Code in this file implements the navigation commands
*/
// auto_init - initialise auto controller
bool Sub::auto_in... | TOOL | 0.851745 | 4.029672 |
76e9e682-d753-49ae-abd4-8b7fe922f009 | Jinyon92/SW_Expert_Academy | sw_expert_academy2805/sw_expert_academy2805/main.cpp | #include<iostream>
using namespace std;
int map[50][50];
int main()
{
int T;
cin>>T;
int n;
for(int test_case = 1; test_case <= T; test_case++){
cin>>n;
for(int y=0; y<n; y++){
for(int x=0; x<n; x++){
scanf("%1d", &map[y][x]);
}
}
... | ALGO | 0.999623 | 3.213873 |
5bcc3f43-5932-48fc-bb8a-214125d33336 | SuryaCodez/DAA-programs | quick sort with time complexity.cpp | #include<iostream>
#include<ctime>
#define MAX 20
using namespace std;
int partition(int arr[], int low, int high, int pivot)
{
int i = low;
int j = low;
while(i<=high)
{
if(arr[i]>pivot)
i++;
else
{
int temp = arr[j];
arr[j] = arr[i];
... | ALGO | 0.998874 | 4.717324 |
f3d38c7f-74e3-4957-8efa-cb093d348666 | amankbps/Competititve-Programming | A_Ilya_and_Bank_Account.cpp | #include <bits/stdc++.h>
using namespace std;
#define REP(i,x,y) for(long long i=x;i<y;i++)
#define F first
#define S second
#define pb push_back
#define eb emplace_back
#define MOD 1000000007
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef pair<int,int> pii;
typ... | ALGO | 0.999537 | 3.88423 |
821496c6-20e8-4b87-a57a-312ba7f6322a | xiaotiger/sometest | sort.cpp | #include <stdio.h>
#include <algorithm>
const int MAX_NUM = 1024;
class InPut {
private:
int* data_;
bool have_;
int curr_;
int num_;
int size_;
public:
InPut(int size):data_(NULL), have_(false), curr_(0), num_(0), size_(size) {
data_ = (int*) malloc... | ALGO | 0.999765 | 4.238245 |
03024b7b-64fa-4473-a165-c29f186bec96 | yutzuhsuan/problem-solving | UVa/11547 - Automatic Answer.cpp | #include <stdio.h>
#include <stdlib.h>
int main(void)
{
int t, n;
scanf("%d", &t);
while(t--) {
scanf("%d", &n);
printf("%d\n", abs(((n*567/9+7492)*235/47-498)/10%10));
}
return 0;
} | ALGO | 0.999256 | 3.318132 |
db197657-888c-4908-ac50-0f72ed307ef7 | Lihoubrak/THUC_HANH_KTLT_BK_K65 | Brak_Lihou_20200836_715026_2/bai1.cpp | #include <stdio.h>
#include <math.h>
float get_hypotenuse(float x, float y) {
/****************
Ho va ten : Brak Lihou
MSSV : 20200836
*/
float z = sqrt(x*x + y*y);
return z;
/*****************/
}
int main(){
float x, y;
scanf("%f%f", &x, &y);
float z = get_hypotenuse(x... | ALGO | 0.998742 | 4.26712 |
04a5490c-cd29-4965-bb3b-5f37d88257de | phoenix29122003/Leetcode_questions | 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.999411 | 5.563321 |
d0d78baa-9068-4826-a716-6f6f37a564b6 | SSAFY-BLUE/BOJ | week2/승록/10597.cpp | // 백트래킹을 이용해 가능한 경우를 탐색
// 최대 범위가 50까지이므로 비트마스킹으로 가능한 범위만 탐색하도록 할 수 있다
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
// idx: 현재 탐색 위치, mask: 사용한 숫자 비트마스크
void solve(const string &S, vector<int> &ans, int idx, ll mask) {
// 수열의 끝에 도달했을때 처리
if (idx == S.length()) {
// 현재 길이는 9 이상인 경... | ALGO | 0.999818 | 4.983684 |
7c75d0a7-8a93-4a81-895c-c418e1bae7b5 | tman689/ss9-c | bt2.cpp | #include <stdio.h>
int main() {
int arr[100];
int n, i, value, position;
printf("Nhap so phan tu muon nhap (toi da 100): ");
scanf("%d", &n);
if (n < 1 || n > 100) {
printf("So phan tu khong hop le!\n");
return 1;
}
printf("Nhap %d phan tu:\n", n);
for (i = 0; i < n; i... | ALGO | 0.996116 | 3.444082 |
3f0e36eb-8a91-444d-93df-fd63f1d763c1 | nicocvn/emDNA | emDNA/cli/optbinding/RampMinimizer.cpp | // RampMinimizer class
// Nicolas Clauvelin
#include <ProteinBindingRamp.h>
#include <RampMinimizer.h>
// constants
#define CONFS_FILE "emDNA_pb_confs.txt"
#define STATS_FILE "emDNA_pb_stats.txt"
#define FINAL_FILE "emDNA_pb_final.txt"
// initial bp collection accessor/modifier
const BpCollection& RampMinimizer::ini... | TOOL | 0.989722 | 6.23947 |
37a4f625-4321-4b5d-8303-3e28849475ef | fantik86/box2d-hotline-agony | src/dynamics/b2_polygon_circle_contact.cpp | #include "b2_polygon_circle_contact.h"
#include "box2d/b2_block_allocator.h"
#include "box2d/b2_fixture.h"
#include <new>
b2Contact* b2PolygonAndCircleContact::Create(b2Fixture* fixtureA, int32, b2Fixture* fixtureB, int32, b2BlockAllocator* allocator)
{
void* mem = allocator->Allocate(sizeof(b2PolygonAndCircleConta... | ALGO | 0.973559 | 6.977354 |
3b0bfdee-fee1-4ca0-a617-cf9860652895 | michalber/ANC-Headphones-repository- | modules/juce_cryptography/hashing/juce_MD5.cpp | namespace juce
{
class MD5Generator
{
public:
MD5Generator() noexcept
{
state[0] = 0x67452301;
state[1] = 0xefcdab89;
state[2] = 0x98badcfe;
state[3] = 0x10325476;
count[0] = 0;
count[1] = 0;
}
void processBlock (const void* data, size_t dataSize) noexc... | ALGO | 0.994728 | 7.220518 |
da3bd36d-e8c5-4854-b2f7-67a6c240763b | filipeabelha/gym-solutions | codechef/PSHTBRTH.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 1e5+5;
int st[4*N], v[N], memo[N];
void build(int p, int l, int r){
if(l == r) {st[p] = v[l]; return;}
build(2*p, l, (l+r)/2);
build(2*p+1, (l+r)/2+1,r);
st[p] = st[2*p] ^ st[2*p+1];
}
int query(int p, int l, int r, int i, int j){
if(... | ALGO | 0.999924 | 4.6916 |
58d1007a-2c27-40f2-82b0-e752eecba629 | ancy0/KMU-snake | result/Gate.cpp | #include <ncurses.h>
#include <cstdlib>
#include "Gate.h"
#include "Map.h"
extern vector<array<int, 2>> wall;
Gate::Gate(Head &head, Body &body) : hd(&head), bd(&body) {}
Gate& Gate::operator=(const Gate& g){
hd = g.hd; bd = g.bd;
init();
return *this;
}
void Gate::init() {
srand(time(NULL));
int i = rand()%... | ALGO | 0.993694 | 4.250926 |
0027ba8c-aac7-4e95-84f0-319eb9f7d007 | iynewz/suanfajingsai | luogu/P7074.cpp | #include <iostream>
#include <algorithm>
using namespace std;
int n, m;
const int N = 1005;
const int inf = 1e9;
long long grid[N][N];
long long f[N][N][3]; // f[i][j] 表示取数到 (i,j) 时的最大值,k=0 表示从左来的,k=1 表示从上来的,k=2 表示从下来的
void init()
{
cin >> n >> m;
for (int i = 1; i <= n; i++)
{
for (int j = 1; j <... | ALGO | 0.999992 | 3.940174 |
d652fa72-2d61-4619-b472-55620babcfbb | ishandutta2007/codeforces | emthrm/normal/1213/G.cpp | #include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#define _USE_MATH_DEFINES
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>... | ALGO | 0.999996 | 4.392335 |
d3178fa2-c041-4882-814d-e471265925fb | MinhTuan2405/DSA_ | SPOJ PTIT/BCBEADS.cpp | // https://www.spoj.com/PTIT/problems/BCBEADS/
// BCBEADS - Đếm hạt
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin >> n;
vector<int> v(n);
for (int i = 0; i < n; i++)
{
cin >> v[i];
}
int count = 0;
for (int i = 1; i < n; i++)
{
if (v[i] != v[... | ALGO | 0.999964 | 4.039684 |
46322733-ca5c-4f02-b957-8fe706cd58d3 | RennyLi/pp24fall_project4 | src/ops_openacc_fusion.cpp | #include "ops.hpp"
#include <cmath>
const float epsilon = 1e-20;
void gemm(const float* A, const float* B, float* Out, size_t batch, size_t mn, size_t k)
{
#pragma acc parallel loop collapse(2) present(A,B,Out)
for (size_t b = 0; b < batch; b++) {
for (size_t i = 0; i < k; i++) {
float tmp ... | ALGO | 0.965635 | 6.733558 |
9fbb148c-01f6-40d1-81f8-4a40d602515f | D1shi/competitive-programming-problem-solutions | ACSL/NextBaseASCL.cpp | #include <bits/stdc++.h>
using namespace std;
// returns digit sum and -1 if invalid for base
int check(int N, int B) {
int out = 0; digits.clear();
while (N > 0) {
if (N % 10 >= B) return -1;
out += N % 10;
N /= 10;
}
return out;
}
int main() {
int N, B, S; cin >> N >> B... | ALGO | 0.997358 | 3.08099 |
f4c9ac11-0d46-4a4c-bbdd-f279b8f24746 | heeba-khan/Leetcode-Solutions | 0104-maximum-depth-of-binary-tree/0104-maximum-depth-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.999688 | 6.578863 |
50c18bc9-d227-4dd7-b28a-65ae88c643cf | ishandutta2007/codeforces | geothermal/normal/574/C.cpp | #pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
typedef pair<int, int> pi;
typedef... | ALGO | 0.999979 | 4.244981 |
4c1e4001-b9f5-4353-b501-e824785682af | raincross7/code-similarity | codes/train_code/problem329/problem329_401.cpp | #include<bits/stdc++.h>
using namespace std;
#define ld long double
#define ll long long
#define ALL(a) (a).begin(),(a).end()
#define ALLR(a) (a).rbegin(),(a).rend()
#define spa << " " <<
#define MP make_pair
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
ll INF = 1e18;
void chmin(ll &a,ll b){if(a>b)a=b;}
void ch... | ALGO | 0.999987 | 3.663808 |
97a318d4-123a-44b8-b7b9-5d3ed09d3571 | zwshen/notes-learning | skills/Acm/zwsoj/V10000/10063.cpp | /* @JUDGE_ID: 13160EW 10063 C++ */
// 06/15/03 22:20:27
// 0.9 jjLAuI...
//@BEGIN_OF_SOURCE_CODE
#include <iostream>
#include <string>
using namespace std;
int len;
string str;
void rec( int index , string answer)
{
int ans_len = answer.length();
int i,j;
if( index < len && ans_len == len-1 ) {
for( j = 0 ; j... | ALGO | 0.999969 | 4.532973 |
9af681c8-914b-4cd8-9f3a-9de430bc6f43 | sinian666/codes_41_2 | cpp_副本12/chapter_backtracking/preorder_traversal_iii_compact.cpp | /**
* File: preorder_traversal_iii_compact.cpp
* Created Time: 2023-04-16
* Author: Krahets (<EMAIL>)
*/
#include "../utils/common.hpp"
vector<TreeNode *> path;
vector<vector<TreeNode *>> res;
/* 前序遍历:例题三 */
static void preOrder(TreeNode *root) {
// 剪枝
if (root == nullptr || root->val == 3) {
ret... | ALGO | 0.999927 | 5.617129 |
06a92591-c934-4b82-ab05-5c91b3110193 | GeeTansher/VisualStudioCodePrograms | CandC++Programs/labOrCollegeQuestions/Other/practice_1.cpp | #include<stdio.h>
#include<conio.h>
int main()
{
int a ,b,c;
printf("Enter three numbers:");
scanf("%d%d%d",&a,&b,&c);
if(a<b)
{
if(a<c)
printf("%d is the smallest number.",a);
else
printf("%d is the smallest number.",c);
}
if(b<a)
{
if(b<c... | ALGO | 0.999708 | 3.030493 |
45597070-2c10-4235-b212-05f8179ebe69 | shikhak101/leetcode | SingleNumber2.cpp | class Solution {
public:
int singleNumber(vector<int>& nums) {
int firstseen = 0;
int secondseen = 0;
for(auto x:nums) {
firstseen = ~secondseen & (firstseen ^ x);
secondseen = ~firstseen & (secondseen ^ x);
}
return firstseen;
}
}; | ALGO | 0.999969 | 5.704242 |
46800c92-2552-468e-9754-973a876fb05e | Yukikaze030/LeetCode | top-100-liked/146.cpp | #include <list>
#include <algorithm>
#include <map>
#include <iostream>
using namespace std;
class Node
{
public:
Node();
Node(int t_key, int t_val)
{
key = t_key;
val = t_val;
}
Node(int t_key, int t_val, Node *next, Node *last)
{
key = t_key;
val = t_val;
... | ALGO | 0.999399 | 5.336227 |
7d58ccf1-19f8-405c-be1c-2e0af45a5cc4 | create-dan/CP-DSA__Templates_Level3 | 30Day_Challenge/Mircosoft/Q9)Number of Pairs Satisfying Inequality.cpp | // https: // leetcode.com/problems/number-of-pairs-satisfying-inequality/
// 0 <= i < j <= n - 1 and
// nums1[i] - nums1[j] <= nums2[i] - nums2[j] + diff.
// Step 1::
// Rewriting the inequality--
// (nums1[i] - nums2[i]) <= (nums1[j] - nums2[j]) + diff
// Step 2::
// Make a new array/vector c which stores nums1[i]-... | ALGO | 0.999977 | 6.020297 |
45ff3f0d-604b-4e71-b114-3b5969fc735e | yash3001/Competitve-Programming | Codechef/12) May Long Challenge/tic_tac_toe.cpp | /* @author -> gamma30 */
#include <bits/stdc++.h>
#define pb push_back
#define eb emplace_back
#define ff first
#define ss second
#define endl "\n"
#define EPS 1e-9
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forf(t,i,n) for(t i=0;i<n;i++)
#define forr(t,i,n) for(t i=n-1;i>=0... | ALGO | 0.999976 | 4.851699 |
fc5385a4-6f54-4617-9975-30ad1a24e2c6 | joshualass/CP | Solutions/Contests/Special/USACO/16/countinghaybales.cpp | #include <bits/stdc++.h>
using namespace std;
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
freopen("haybales.in","r",stdin);
freopen("haybales.out","w",stdout);
int n, q; cin >> n >> q;
vector<int> v(n);
for(int i = 0; i < n; i++) {
int num; cin >> num;
... | ALGO | 0.999981 | 4.821612 |
4afccb17-1c73-40ba-b2de-6053b3014ec4 | eburg118/CPP_Programs | CPPprogs/Calc.cpp | #include <iostream>
using namespace std;
void getNumbers(float &x, float &y);
float calcSum(float x, float y);
float calcDifference(float x, float y);
float calcMult(float x, float y);
float calcDiv(float x, float y);
void displayAnswers(float x, float y, float sum, float diff, float multi, float divv);
void getNumber... | TOOL | 0.961131 | 3.611768 |
c576bd6e-0152-4586-b8dc-8f6cc5e38ed8 | openjdk/jdk25u | src/hotspot/share/opto/constantTable.cpp | #include "asm/codeBuffer.hpp"
#include "asm/macroAssembler.hpp"
#include "opto/block.hpp"
#include "opto/constantTable.hpp"
#include "opto/machnode.hpp"
#include "opto/output.hpp"
//=============================================================================
// Two Constant's are equal when the type and the value are... | TOOL | 0.903822 | 7.618562 |
f1381762-345b-414c-839a-6f343a5d2913 | johannesgerer/jburkardt-cpp | kronrod/kronrod_prb.cpp | # include <cstdlib>
# include <iostream>
# include <iomanip>
# include <cmath>
using namespace std;
# include "kronrod.hpp"
int main ( );
void test01 ( );
void test02 ( );
void test03 ( );
double f ( double x );
//****************************************************************************80
int main ( )
{
time... | ALGO | 0.99923 | 6.45702 |
95d325fc-6365-4459-9670-e7b553965bfc | Alanhou1222/leetcode | 22-generate-parentheses/22-generate-parentheses.cpp | class Solution {
public:
vector<string> generateParenthesis(int n) {
vector<string> ans;
solve(0,0,n,"",ans);
return ans;
}
void solve(int starts, int ends, int n, string s, vector<string> &ans){
if(starts + ends == 2*n){
ans.push_back(move(s));
re... | ALGO | 0.99989 | 6.63912 |
412501aa-4b97-47c6-b29c-b6e88c9160b6 | Priyankar96/face_recognize | opencv-master/opencv-master/3rdparty/carotene/src/warp_affine.cpp | #include "remap.hpp"
namespace CAROTENE_NS {
bool isWarpAffineNearestNeighborSupported(const Size2D &ssize)
{
#if SIZE_MAX > UINT32_MAX
return !(ssize.width > 0xffffFFFF || ssize.height > 0xffffFFFF) && // Restrict image size since internal index evaluation
... | ALGO | 0.996781 | 6.963443 |
4976ce34-0e5f-4ddc-8b26-16445d52a15f | Mikhail-F/F_clock_painter | 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 |
692265b3-893a-4ae3-8fb9-3e9dc4db5d91 | Ishikajain02/DS-Algo | 984-most-stones-removed-with-same-row-or-column/most-stones-removed-with-same-row-or-column.cpp | class Solution {
public:
void travel(vector<bool>&visited,vector<vector<int>>&adj,int s){
visited[s]=true;
for(int i=0;i<adj[s].size();i++){
if(!visited[adj[s][i]]){
travel(visited,adj,adj[s][i]);
}
}
}
int removeStones(vector<vector<int>>& stones) {
//count no of... | ALGO | 0.999751 | 5.64282 |
2d071a6e-6877-4c14-9d5c-3065430a31f1 | wugy11/openjdk1.7 | hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp | #include "precompiled.hpp"
#include "gc_implementation/concurrentMarkSweep/cmsLockVerifier.hpp"
#include "gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp"
#include "gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.inline.hpp"
#include "gc_implementation/concurrentMarkSweep/concurre... | TOOL | 0.947063 | 3.786595 |
59a54fbb-22b9-45c4-8ca2-ac4101ea51c4 | minukk/Algo | PSALGO/DataStructure/Graph/DFS.cpp | #include <iostream>
#include <vector>
using namespace std;
using Graph = vector<vector<int> >;
vector<bool> seen;
void dfs(const Graph& G, int v) {
seen[v] = true;
for (auto next_v : G[v]) {
if (seen[next_v]) continue;
dfs(G, next_v);
}
}
int main() {
int N, M;
cin >> N >> M;
Graph G(N);
for ... | ALGO | 0.999635 | 4.703798 |
51e68d46-f661-4e91-9d52-07dc65583c89 | shimwoojin/WoojinCpp | Baekjoon/Class/Class_4/14502.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;
int Solution(vector<vector<int>>& room, int zero_size)
{
int answer = 0;
int dirty_zero = 0;
vector<vector<bool>> visits(room.size(), vector<bool>(room[0].size(), false));
for (int i = 0; i < room.size(); i++)
{
fo... | ALGO | 0.999705 | 4.333002 |
140e9fac-783d-4efa-a754-d7fc093966a9 | amd/vaip | vaip/src/guess_reshape.cpp | #include "vaip/guess_reshape.hpp"
#include "vitis/ai/env_config.hpp"
#include <algorithm>
#include <cassert>
#include <cstdlib>
#include <glog/logging.h>
#include <vector>
DEF_ENV_PARAM(DEBUG_GUESS_RESHAPE, "0")
#define MY_LOG(n) LOG_IF(INFO, ENV_PARAM(DEBUG_GUESS_RESHAPE) >= n)
namespace vaip_core {
struct ShapeCons... | ALGO | 0.94295 | 6.185733 |
093e6882-e4c2-4e4e-b828-922cc63eedde | dharmayudha03/algo | pert9/tugas.cpp | #include <iostream>
#include <stack>
using namespace std;
string DecimalToBinary(int decimal) {
stack<int> binaryStack;
// Konversi desimal ke biner menggunakan stack
while (decimal > 0) {
int remainder = decimal % 2;
binaryStack.push(remainder);
decimal /= 2;
}
// Membang... | ALGO | 0.988822 | 6.778309 |
5b46a8e8-4026-43d6-a61e-a3c7707d2194 | WWWWWWen123456/DataStruct | 堆排序的第一次实现/HeapSort.cpp | #define _CRT_SECURE_NO_WARNINGS 1
#include"HeapSort.h"
void Swap(int* a, int* b) {
int tmp = *a;
*a = *b;
*b = tmp;
}
void AdjustDown(int* a, int n, int parent) {
//ȼΪ
int child = 2 * parent + 1;
//ȡҺнСĽ
while(child<n){
if (child + 1 < n && a[child + 1] < a[child]) {
child += 1;
}
if (a[child] < a[pare... | ALGO | 0.999976 | 4.434257 |
3869a581-8a64-4564-a2d5-38b25189bbf3 | imovishek/coding-practice | UVa_Online_Judge_Problem_Solutions/796 Critical Links.cpp | #include<bits/stdc++.h>
#define pii pair<int,int>
#define mkp make_pair
#define fs first
#define sc second
#define pb push_back
#define ppb pop_back()
#define pf printf
#define pf1(a) printf("%d\n",a);
#define hi printf("hi!\n");
#define sf scanf
#define sf1(a) scanf("%d",&a)
#define sf2(a,b) scanf("%d %d",&a,&b)
#defi... | ALGO | 0.999561 | 4.026597 |
2af14334-ca4a-47c8-bb40-93a212c55229 | squaresLab/BatFix | results/transcoder/translations/java/TRIANGULAR_NUMBERS.cpp | bool isTriangular ( int num ) {
if ( num < 0 ) return false ;
int sum = 0 ;
for ( int n = 1 ;
sum <= num ;
n ++ ) {
sum = sum + n ;
if ( sum == num ) return true ;
}
return false ;
}
| ALGO | 0.996033 | 4.183327 |
5de4d498-c581-4c0f-9a29-fcfd1c7732ad | Aviral-Dwivedi-0/Leetcode | 1548-check-if-all-1s-are-at-least-length-k-places-away/check-if-all-1s-are-at-least-length-k-places-away.cpp | class Solution {
public:
bool kLengthApart(vector<int>& nums, int k) {
int counter=0;
bool first=true;
for(int i=0;i<nums.size();i++){
if(nums[i]==1){
if(first){
first=false;
counter=0;
continue;
... | ALGO | 0.999782 | 5.63842 |
ddf87502-8d8c-49c4-8147-2ccd59ca78d9 | WayneWei228/Algorithm | AdventOfCode/2017/MySoluiton/1715.cpp | #include <cstdio>
using namespace std;
typedef unsigned long long uint64;
struct GenA;
struct GenB;
struct Gen {
virtual ~Gen() = default;
virtual void Next() = 0;
};
struct GenA : public Gen {
uint64 value;
void Next() { value = (value * 16807) % 2147483647; }
};
struct GenB : public Gen {
ui... | ALGO | 0.999671 | 3.677927 |
bd1fd2d7-b5ae-4cc2-9390-9770ab6c4595 | kimdg1105/Algorithm_Solving | BOJ/4948.cpp | #include <iostream>
#include <cmath>
#include <array>
using namespace std;
void tos(long int* arr){
// int len = (sizeof(arr)/sizeof(int));
for(int i=2;i<=250000;i++){
if(arr[i]==0){
continue;
}
for(int j=i+i;j<=250000;j+=i){
arr[j] = 0;
}
}
}
int co... | ALGO | 0.999805 | 4.068841 |
63a75206-b45a-4853-be9a-6cecfbd62beb | NoN4meSmile/flutter_application_1 | 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 |
44168a0f-e412-411f-80c8-501baaae0fa6 | trinhminhtriet/leetcode | solutions/1200-1299/1210.minimum-moves-to-reach-target-with-rotations/Solution.cpp | class Solution {
public:
int minimumMoves(vector<vector<int>>& grid) {
int n = grid.size();
auto target = make_pair(n * n - 2, n * n - 1);
queue<pair<int, int>> q;
q.emplace(0, 1);
bool vis[n * n][2];
memset(vis, 0, sizeof vis);
vis[0][0] = true;
auto... | ALGO | 0.999981 | 6.118129 |
90411dba-2125-4a63-a482-d86dcf077b09 | akouryy/kyopro-2020 | 202004/gcj2020q/v.gen.cpp | #define GCJ_CASE 1
#line 1 "base.hpp"//v
#ifndef __clang__
#pragma GCC optimize ("O3")
#endif
void solve(
#ifdef GCJ_CASE
long long case_id
#endif
);
#if defined(EBUG) && !defined(ONLINE_JUDGE)
#define debug true
#define _GLIBCXX_DEBUG
// #define _LIBCPP_DEBUG 0
#define _LIBCPP_DEBUG2 0
#else
#define NDEBUG
#define deb... | ALGO | 0.999932 | 3.882612 |
7dff0aa3-9ac7-480e-a3bd-67c860e61b0b | rohitsonwane191/C_programs | c++.cpp/t.cpp | #include <iostream>
using namespace std;
class unit
{
private:
int units, charges, charges1, charges2;
public:
void read()
{
cout << "enter units";
cin >> units;
}
public:
void print()
{
{
if (units >= 0 && units <= 100)
{
charge... | TOOL | 0.965261 | 3.780106 |
6f476d0e-d242-4c40-9435-95fecabaf927 | KoDaHyeon/Algorithm | AI_homework/2018920002.cpp | #include <iostream>
#include <vector>
#include <cmath>
#include <random>
using namespace std;
const double C = 0.1; //learning rate
random_device rng;
uniform_real_distribution<double> dist2(-2.0, 2.0); // [-2.0, 2.0) 범위 내의 실수
vector<vector<int>> input;
class Perceptron
{
private:
int dimension;
vector<dou... | ALGO | 0.999886 | 4.187852 |
be632b61-fd26-4d3d-9252-35acd2d5b139 | Rishita1304/Leetcode | 1715-split-a-string-into-the-max-number-of-unique-substrings/split-a-string-into-the-max-number-of-unique-substrings.cpp | class Solution {
public:
int backtrack(int start, string s, unordered_set<string> st){
if(start == s.size()) return 0;
int maxSplit = 0;
for(int end = start+1; end <= s.size(); end++){
string substring = s.substr(start, end - start);
if(st.find(substring) == st.end())... | ALGO | 0.999984 | 5.803905 |
6ea09521-5137-44c7-99bf-f695ece227a3 | monman53/online_judge | AOJ/2657.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;
struct Book{
string title, author, date;
};
int main(){
int n, q;
cin >> n;
vector<Book> book(n);
for(int i=0;i<n;i++){
cin >> book[i].title >> book[i].author >> book[i].date;
}
cin >> q;
string q_ti... | ALGO | 0.999566 | 4.015591 |
432fd48a-fe5a-4de1-8a4d-df7751b34aca | jaitl/cloud-computing-coursera | mp2/MP2Node.cpp | /**********************************
* FILE NAME: MP2Node.cpp
*
* DESCRIPTION: MP2Node class definition
**********************************/
#include "MP2Node.h"
/**
* constructor
*/
MP2Node::MP2Node(Member *memberNode, Params *par, EmulNet * emulNet, Log * log, Address * address) {
this->memberNode = memberNode;... | ALGO | 0.997076 | 4.929439 |
53fe96ee-a24c-4712-acb9-0dab49160707 | arduinocc04/Algorithm | BOJ/C++/11908-카드.cpp | #include <cstdio>
int n, c[2'230], max;
long long sum;
int main() {
scanf("%d", &n);
for(int i = 0; i < n; i++) scanf("%d", &c[i]);
for(int i = 0; i < n; i++) sum += c[i];
max = c[0];
for(int i = 0; i < n; i++) {
if(c[i] > max) max = c[i];
}
printf("%d", sum - max);
} | ALGO | 0.999922 | 3.534789 |
ecc03aa5-e171-44e7-9382-202671cbc2f9 | Adicodeshank/quant-practise | 3stl.cpp | #include<iostream>
#include<numeric>
#include<vector>
#include <functional> // for multiplies
#include <iomanip> // for std::setprecision
class ReturnTracker {
public:
std::vector<double> daily_returns; // e.g., +0.01, -0.02 for +1%, -2%
void add_return(double r) {
daily_returns.push_back(r);
... | ALGO | 0.99965 | 5.792021 |
9988efe6-10a3-4ec8-8705-194df720fd4c | rayko04/EveythingCpp | PF/simple programs/comp interest.cpp | /* 23. Write a program that inputs principal amount, rate of interest and total time. It calculates the compound interest and displays
*/
#include<iostream>
#include<math.h>
using namespace std;
int main()
{
float P, R, T;
cout<<"Principle Amount: ";
cin>>P;
cout<<"Rate of Interest: ";
cin>>R;
cout<<"Time... | ALGO | 0.994755 | 3.31139 |
011331f1-8489-411e-a2eb-187fb17352e9 | MathewRo/miniSTL | algorithm/sort/source/QuickSort.cpp | #include <algorithm>
#include "QuickSort.hpp"
#include <stack>
/**
* Helper partition function
* @param arr
* @param low
* @param high
* @return
*/
static int64_t Partition(std::vector<size_t> & arr, const int64_t & low, const int64_t & high) {
int64_t i = low - 1;
size_t pivot = arr[high];
// This ... | ALGO | 0.999984 | 5.742933 |
b9f5420e-4466-48ab-8857-db587795e6e5 | adsinghnet/CodeQuotient-Solutions-2021 | UCA/Programming Abstractions/Section 3/3_Maximum element in an Array.cpp | #include<iostream>
#include<cstdio>
#include<cmath>
// Include headers as needed
using namespace std;
int main()
{
int n=5;
int a[n];
for(int i=0;i<n;i++)
{
cin>>a[i];
}
int max=a[0];
for(int i=0;i<n;i++)
{
if(a[i]>max)
{
max=a[i];
}
}
cout<<max;
return 0;
} | ALGO | 0.998852 | 3.236991 |
6a9d20e4-f072-4609-bec6-df9123518864 | hieupm123/again | code/C++/CSES-Solutions/Graph Algorithms/Download Speed (1694)/Benq.cpp | /*
ID: bqi3431
PROG: ~
LANG: C++11
*/
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/rope>
using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;
typedef long long l... | ALGO | 0.999844 | 4.45608 |
e78a4f4a-01ea-473c-8491-0ffa0610c5c5 | Shaun1280/Program | cpp/ModernCpp/test.cpp | #include <bits/stdc++.h>
using namespace std;
#define debug(x) cerr << #x << " = " << x << endl
#define boost ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#define error(args...) \
{ \
string _s = #args; \
... | ALGO | 0.999943 | 4.632101 |
36bcba0d-ce0b-4a8e-8050-d1e7542ba327 | 2023-MindSpore-1/ms-code-222 | pointRCNN/src/pointnet2_lib/src/pointnet2_cuda/ball_query.cpp | #include <c10/cuda/CUDAStream.h>
#include <cuda.h>
#include <cuda_runtime_api.h>
#include <torch/serialize/tensor.h>
#include <vector>
#include "./ball_query_gpu.h"
#include "./ms_ext.h"
#define CHECK_CUDA(x) \
AT_ASSERTM(x.type().is_cuda(), #x " must be a CUDA tensor")
#define CHECK_CONTIGUOUS(x) \
AT_ASSERTM(x... | ALGO | 0.87402 | 6.229226 |
49765a5e-616c-4971-b3fe-680e7b7a2492 | triakshgupta/Leet_fun | 0120-triangle/0120-triangle.cpp | class Solution {
public:
int minsum(int i,int j,vector<vector<int>>& triangle,vector<vector<int>>& dp){
if(i==triangle.size()-1){
return triangle[i][j];
}
if(dp[i][j]!=-1) return dp[i][j];
int ind=triangle[i][j]+minsum(i+1,j,triangle,dp);
int indn=triangle[i][j]+m... | ALGO | 0.999977 | 6.316937 |
9d29d63c-5cd1-45da-b072-b6470cfde14e | rajyan/AtCoder | ABC/ABC185/F.cpp |
#ifdef _DEBUG
#include "../../../library/src/debug_template.hpp"
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else
#define DMP(...) ((void)0)
#endif
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <set>
#include <map>
#incl... | ALGO | 0.999785 | 4.893029 |
e40e7139-649b-4931-9801-b398da6eee59 | lammps/lammps | src/REAXFF/reaxff_nonbonded.cpp | // clang-format off
#include "reaxff_api.h"
#include "pair.h"
#include <cmath>
namespace ReaxFF {
void Compute_Polarization_Energy(reax_system *system, simulation_data *data, storage *workspace)
{
int i, type_i;
double q, en_tmp;
data->my_en.e_pol = 0.0;
for (i = 0; i < system->n; i++) {
... | ALGO | 0.99864 | 6.053331 |
af751850-5b21-453b-8caf-ed966d9af444 | ishandutta2007/codeforces | cookiedoth/normal/1254/B1.cpp | /*
Code for problem B by cookiedoth
Generated 19 Nov 2019 at 05.53 P
10%
30%
50%
70%
100%
>_<
o_O
^_^
*/
#include <iostream>
#include <fstream>
#include <vector>
#include <set>
#include <map>
#include <bitset>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <ctime>
#include <functional>
#incl... | ALGO | 0.999974 | 3.818003 |
10525345-9390-4474-af0a-febf4bff9e0a | toproof25/OK-problem-solving | 프로그래머스/0/120894. 영어가 싫어요/영어가 싫어요.cpp | #include <string>
#include <vector>
#include <iostream>
using namespace std;
static const vector<string> number_in_english = {
"zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"
};
long long solution(string numbers) {
long long answer = 0;
string num_str = "";
for ... | ALGO | 0.999566 | 5.517472 |
1248ff35-c56f-4375-96c8-a8d09a8f0728 | hjiang13/LLMs-in-IR | processed_data/decompilation_result/GPT40_mini/CameraPurchase.cpp | #include <iostream>
#include <vector>
#include <string>
#include <stdexcept>
std::vector<int> brand(100005);
std::vector<int> price(100005);
int n = 0;
void go(int index) {
int bit = 1;
while (bit <= index) bit <<= 1;
bit >>= 1;
for (int i = 0; i < n; ++i) {
if ((i & bit) == 0) {
... | ALGO | 0.999901 | 4.223843 |
7689e714-29dd-4f71-9c89-7ce9a3f368a5 | zee-bit/Competitive-Programming-codes-CPP | EVENTUAL.cpp | #include <bits/stdc++.h>
using namespace std;
using namespace std::chrono;
typedef long long ll;
typedef long double ld;
struct custom_hash;
#define ff first
#define I insert
#define ss second
#define maxN 300002
#define inf INT_MAX
#define ninf INT_MIN
#define pb push_back
#define popb pop_back
#define pf push_front
#... | ALGO | 0.999984 | 4.724235 |
822390b4-3257-49b5-98bd-5ee690d177a6 | Lord-Lava/Codechef-Contests | 43 CodeChef Starters 13 Division 2 (Rated)/Maximum_Light_Up.cpp | #include <bits/stdc++.h>
using namespace std;
#define boost ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define int long long
const int mod = 1e9 + 7;
#define f(i,n) for(int i=0;i<n;i++)
#define rep(i,s,n) for(int i=s;i<n;i++)
#define fm(it,mp) for(auto it=mp.begin();it!=mp.end();it++)
#define pb... | ALGO | 0.999299 | 3.612907 |
9dee5e09-3bd8-4519-b34a-5773de66f99e | Pedro8016bit/Atividade-em-C-internet-das-coisas-parte-2 | Atividade 4-17.cpp | #include <stdio.h>
int calcularMDC(int a, int b) {
while (b != 0) {
int resto = a % b;
a = b;
b = resto;
}
return a;
}
int main() {
int numero1, numero2;
printf("Digite o primeiro numero: ");
scanf("%d", &numero1);
printf("Digite o segundo numero: ");
scanf("%d... | ALGO | 0.999818 | 5.9389 |
03bdf553-6a6f-4777-a24d-1f8c2be650b7 | cwang588/algorithms | Codeforces Global Round 11/stack.cpp | #include<bits/stdc++.h>
using namespace std;
int a[1000005],cnt;
void push(int x){
a[++cnt]=x;
int now=cnt;
while(now!=1&&a[now]<a[now/2]){
swap(a[now],a[now/2]);
now/=2;
}
}
int top(){
return a[1];
}
void pop(){
a[1]=a[cnt--];
int now=1;
while((a[now]>a[now<<1]&&now*2<=cnt)||(a[now]>a[now<<1|1]&&now*2+1<=c... | ALGO | 0.99973 | 4.247088 |
6201234b-7357-4da0-a3be-e94370d95518 | sumit-gade/DSA-Problem-Solving-Repository | ARRAY/MinSwapReq.cpp | #include<iostream>
using namespace std;
int minSwap(int arr[], int n, int k) {
int cnt=0;
for(int i=0;i<n;i++)
{
if(arr[i]<=k)
{
cnt++; // kitne less then or equal hai sabko count kr liya array me
}
}
int ... | ALGO | 0.999992 | 5.537158 |
f20d27b3-1675-49dd-929e-b8c5cb174ec9 | pch6828/HYU_ITE4065 | lab04/prime_cond.cpp | #include <stdio.h>
#include <pthread.h>
#include <math.h>
#define NUM_THREAD 10
int thread_ret[NUM_THREAD];
int done = 0;
bool is_done = false;
int range_start;
int range_end;
pthread_mutex_t mtx_for_workers = PTHREAD_MUTEX_INITIALIZER;
pthread_cond_t cv_for_workers = PTHREAD_COND_INITIALIZER;
pthread_mutex_t mtx_... | ALGO | 0.999793 | 4.157329 |
259fa84a-58de-474c-aa50-4541bd0218e2 | YoniKazovsky/CPSC-298 | tictactoe.cpp | #include <iostream>
#include <tuple>
using namespace std;
class TicTacToeGame {
public:
TicTacToeGame();
virtual ~TicTacToeGame();
void Play();
private:
void initializeGrid();
void displayGrid();
tuple<int, int> findFirstUnoccupiedGridSquare();
tuple<int, int> promptForGridCoordinates();
... | ALGO | 0.965395 | 7.196195 |
4883f72b-8172-4604-bde9-0ffee779f4b2 | gmelossc/algorithms | graph/lca.cpp | #include <bits/stdc++.h>
using namespace std;
const int MAX = 1e6;
const int LOG = 20;
int parent[MAX][LOG];
int depth[MAX];
vector<int> adj[MAX];
void dfs(int start){
stack<int> s;
s.push(start);
while(!s.empty()){
int u = s.top();
s.pop();
for(int v: adj[u]){
if(depth[v] == -1){
parent[v][0] = u... | ALGO | 0.999871 | 4.27533 |
aafec37e-b058-454a-a8f5-bb1a6dc2d713 | COPEL-BigData/opencv | samples/cpp/tutorial_code/core/discrete_fourier_transform/discrete_fourier_transform.cpp | #include "opencv2/core.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/imgcodecs.hpp"
#include "opencv2/highgui.hpp"
#include <iostream>
using namespace cv;
using namespace std;
static void help(char ** argv)
{
cout << endl
<< "This program demonstrated the use of the discrete Fourier transform (D... | ALGO | 0.991257 | 6.214012 |
d3564fc9-c397-480b-8cd1-0ab7bff97a05 | 1s0n/AIO | Training/StarterSet1/Ninjas/ninjas.cpp | #include <iostream>
using namespace std;
int main()
{
freopen("ninjain.txt", "r", stdin);
freopen("ninjaout.txt", "w", stdout);
int N, K;
cin >> N >> K;
int i = 1;
int ans = 0;
while (i <= N)
{
ans++;
i += K + 1;
}
cout << N - ans;
} | ALGO | 0.999795 | 3.236508 |
48da1a4d-192b-4a16-b12c-5d6616dad73d | xukeawsl/mqtt-server | third-party/yaml-cpp/src/binary.cpp | #include "yaml-cpp/binary.h"
#include <cctype>
namespace YAML {
static const char encoding[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
std::string EncodeBase64(const unsigned char *data, std::size_t size) {
const char PAD = '=';
std::string ret;
ret.resize(4 * size / 3 + 3);
... | TOOL | 0.86435 | 7.225646 |
32f11c6d-c28b-43d5-a675-21a36eb70895 | krithiva/node-rx-demo | deps/icu-small/source/common/ucharstriebuilder.cpp | #include "unicode/utypes.h"
#include "unicode/ucharstrie.h"
#include "unicode/ucharstriebuilder.h"
#include "unicode/unistr.h"
#include "unicode/ustring.h"
#include "cmemory.h"
#include "uarrsort.h"
#include "uassert.h"
#include "uhash.h"
#include "ustr_imp.h"
U_NAMESPACE_BEGIN
/*
* Note: This builder implementation... | TOOL | 0.923146 | 7.364531 |
75cbf9bf-6df1-4e03-b00a-9f621931a822 | arthurdamm/algorithms-practice | leet/0142_linked_list_cycle_2/0142_linked_list_cycle_2.cpp | // LeetCode 142. Linked List Cycle II
// https://leetcode.com/problems/linked-list-cycle-ii/
// O(n) time, O(1) space
class Solution {
public:
ListNode *detectCycle(ListNode *head) {
ListNode *slow = head, *fast = head;
while (fast && fast->next) {
fast = fast->next->next;
sl... | ALGO | 0.999985 | 5.964788 |
f3d07e42-ec5b-428d-ad01-e1bf0f525825 | advsinha17/DISCO_Graph_Assignment | p5.cpp | #include <iostream>
#include <queue>
using namespace std;
class Graph {
public:
vector<vector<int> > adjList;
vector<int> color;
int v;
Graph(int v) {
this->v = v;
adjList.resize(v);
color.resize(v);
for (int i = 0; i < v; i++) {
color[i] = -1;
}
... | ALGO | 0.999978 | 5.173204 |
098f114a-6e5e-440c-bac5-89a2827ada97 | ishandutta2007/codeforces | smax/normal/906/D.cpp | #include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#define DEBUG(...) debug(#__VA_ARGS__, __VA_ARGS__)
#else
#define DEBUG(...) 6
#endif
template<typename T, typename S> ostream& operator << (ostream &os, const pair<T, S> &p) {return os << "(" << p.first << ", " << p.second << ")";}
template<typename C, typen... | ALGO | 0.999983 | 4.160572 |
7cc06b5b-e4f9-4efe-b3e5-3bcc2607ff5e | ShravanJagadam/DSA | LinkedList/RotateLL.cpp | /*InterviewBit : https://www.interviewbit.com/problems/rotate-list/
Rotate List
Problem Description
Given a list, rotate the list to the right by k places, where k is non-negative.
Problem Constraints
1 <= B <= 109
Input Format
The first argument is ListNode A, pointing to the head of the list.
The second argument... | ALGO | 0.999966 | 5.344764 |
75b09f8e-5e0d-4c4d-b091-08a84654ebda | hajime-f/atcoder_cpp | 20221019_ABC210_A.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, A, X, Y;
cin >> N >> A >> X >> Y;
int m = 0;
if (N <= A) {
m = N * X;
} else {
m = A * X + (N - A) * Y;
}
cout << m << endl;
return 0;
}
// cin >> N >> X;
// for (int i = 1; i <= N; i++) cin >> A[i];
// int pos =... | ALGO | 0.999263 | 3.425063 |
fbb7aead-697f-402c-933b-b111d4aaa832 | Alinnus1/Data-Structures-Problems | maxitate/main.cpp | #include <iostream>
#include <fstream>
#include <vector>
#include <string.h>
#define NMAX 630
std::vector<int> v[5+NMAX];
int N,M,K,L;
long long int sol=1LL;
long long int findMissingPositive(int arr[], int size){
for (int i = 0; i < size; i++)
{
if (abs(arr[i]) - 1 < size && arr[abs(arr[i]) - 1] > 0)... | ALGO | 0.999941 | 3.555783 |
f904a513-65fa-444e-a734-9fad4f0b6255 | wisdompeak/LeetCode | LCCUP/2020Fall/LCP24.数字游戏/code.cpp | class Solution {
public:
vector<int> numsGame(vector<int>& nums)
{
for (int i=0; i<nums.size(); i++)
nums[i] -= i;
vector<int>rets;
multiset<long>Set;
long M = 1e9+7;
Set.insert(nums[0]);
auto iter = Set.begin();
long medium = nums[0... | ALGO | 0.999989 | 5.35858 |
a747559c-b8f1-4656-a101-981d089812ad | 000linx/LeetCode | 2656.cpp | #include <iostream>
#include <vector>
#include <algorithm>
class Solution
{
public:
int maximizeSum(std::vector<int> &nums, int k)
{
int ans = 0;
int n = nums.size();
while(k--)
{
sort(nums.begin(), nums.end());
ans += nums[n - 1];
nums[n - 1]... | ALGO | 0.999915 | 5.090942 |
79c7b811-e16b-4c1e-b62b-e6fd133b38a2 | raincross7/code-similarity | codes/train_code/problem342/problem342_472.cpp | #include"bits/stdc++.h"
using namespace std;
typedef long long ll;
#define int ll
int32_t main()
{
#ifndef ONLINE_JUDGE
freopen("in","r",stdin);
freopen("out","w",stdout);
#endif
string s;
cin>>s;
int n=s.length();
for(int i=0;i<n-1;i++)
{
if(s[i]==s[i+1])
{cout<<i+1<<" "<<i+2<<"\n";return 0;}
}
for(int ... | ALGO | 0.999826 | 3.729149 |
0dd4f026-de1e-4840-be3c-af8e0f86d262 | A-magic/MyClock | M2t/libraries/Robot_Motor/src/lineFollow.cpp | //#include <ArduinoRobotMotorBoard.h>
#include "LineFollow.h"
//#define KP 19 //0.1 units
//#define KD 14
//#define ROBOT_SPEED 100 //percentage
//#define KP 11
//#define KD 5
//#define ROBOT_SPEED 50
//#define INTEGRATION_TIME 10 //En ms
/*uint8_t KP=11;
uint8_t KD=5;
uint8_t robotSpeed=50; //percentage
uint8_t in... | CONFIG | 0.954874 | 3.9728 |
728a251a-bf5e-45cd-aa58-bfe16ad68e41 | Sakshibhokare/DSA_Questions | 1RotateLL.cpp | class Solution {
public:
ListNode* rotateRight(ListNode* head, int k) {
if(head==NULL || k==0)return head;
int cnt=0;
ListNode* temp=head;
while(temp->next!=NULL){
temp=temp->next;
cnt++;
}
k=k%(cnt+1);//to handle the case where the size of ll ... | ALGO | 0.999986 | 5.794806 |
b8eec6dd-0e7d-4b50-bde2-7c0a0683d58d | ishandutta2007/codeforces | psaily/normal/1662/I.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=(a);i<(n);i++)
#define per(i,a,n) for (int i=(a)-1;i>=(n);i--)
#define SZ(x) ((int)x.size())
#define pb push_back
#define all(x) x.begin(),x.end()
#define bug(x) cerr<<#x<<'='<<x<<' '
#define debug(x) cerr<<#x<<'='<<x<<endl
typedef long long L... | ALGO | 0.999913 | 3.259432 |
68e8f0ec-10b7-40a8-b391-9323a7cf75b8 | Suprio-Das/Previous-C_Practices | Conditional Statements (if-else) Practice Problem/problem-11.cpp | //Write a program to input the month number and print the number of days in that month.
#include<iostream>
using namespace std;
int main()
{
int month_number;
//taking month number
cout << "Enter the number: ";
cin >> month_number;
cout << endl;
//Output
if(month_number == 1)
c... | ALGO | 0.991096 | 4.559303 |
b80d16fd-3a44-4ebb-bc06-ee15dfb1b9d1 | azwadkm22/CSE-4139-Computer_Graphics_2023 | Projection.cpp | #include <bits/stdc++.h>
#include <GL/glut.h>
#include <ctime>
using namespace std;
#define Pi acos(-1)
#define Width 1000
#define Height 1000
static void drawAxis(void)
{
glColor3ub(255, 255, 255);
glPushMatrix();
glBegin(GL_LINES);
glVertex2i(-Width/2, 0);
glVertex2i(Width/2, 0);
glVertex2i... | ALGO | 0.971843 | 3.65745 |
df177e4f-ead7-421d-bd0e-2300046db52e | FireSquid6/csi-1430 | programming-assignments/program-18/cstring.cpp | /*
* Author: Jonathan Deiss
* Assignment Title: C-style String
* Assignment Description: C-style string functions
* Due Date: 10/25/2024
* Date Created: 10/21/2024
* Date Last Modified: 10/21/2024
*/
int Strlen(const char s1[]) {
int i = 0;
// this will not work if there is no null terminator!
// scary!
... | TOOL | 0.878467 | 5.162052 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.