uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
699b2348-a271-4ebd-bb93-b73efd4dac2d | thinkphp/computer-science-in-c | Gems /OOP /Encapsulation /class-set.cpp | #include <iostream>
using namespace std;
class Multime {
public:
//constructor of the class
Multime() {
for(int i = 0; i < 100; ++i) buffer[i] = 0;
}
int check(int n) {
int mask = 1;
int nr_byte, nr_bit;
nr_bit = 7 - n%8;
nr_byte = n/8;
mask = mask << nr_bit;
... | ALGO | 0.98611 | 3.652345 |
22e7f884-691a-4fa1-926d-9ea9c8e28011 | Ansh718/LeetCode | 2024/June 24/30-06-24.cpp | class UnionFind
{
public:
vector<int> parent, rank;
int count;
UnionFind(int n) : parent(n), rank(n, 1), count(n)
{
for (int i = 0; i < n; ++i)
{
parent[i] = i;
}
}
int find(int u)
{
if (parent[u] != u)
{
parent[u] = find(pare... | ALGO | 0.999895 | 5.740325 |
5521faea-a7e3-4152-ac9a-06ad1099b8b1 | VarunSAthreya/Interview-Preparation | Tree/Burning Tree/Solution.cpp | int minTime(Node *root, int target)
{
if (!root)
return 0;
map<Node *, Node *> parent;
queue<Node *> pq;
pq.push(root);
Node *start;
while (!pq.empty())
{
Node *node = pq.front();
pq.pop();
if (node->data == target)
start = node;
if (no... | ALGO | 0.999933 | 5.679971 |
aa13bb82-584e-415a-b66b-7336990d07e1 | NYN31/CompetitiveProgramming | CP/Codeforces/div3.667/B.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ff first
#define ss second
#define pb push_back
ll go(ll a, ll b, ll x, ll y, ll n) {
ll tm1 = max(x, a - n) ;
n = n - (a - tm1) ;
ll tm2 = max(y, b - n) ;
return tm1 * tm2 ;
}
void solve() {
ll a, b, x, y, n;
cin >> a >> b >> x >> y >... | ALGO | 0.999744 | 4.624531 |
09a48153-c5f0-4b29-82e2-77df7f0b31e3 | HongSon28/Training | General training/tim kiem nhi phan/Bai2.cpp | #include<bits/stdc++.h>
using namespace std;
int a[100000];
bool check(int b, int m) {
int lo=0,hi=m-1;
while(hi-lo>=0) {
int mid=lo+(hi-lo)/2;
if (a[mid]>b) {
hi=mid-1;
} else if (a[mid]<b) {
lo=mid+1;
} else {
return true;
}
}
... | ALGO | 0.999967 | 4.064209 |
3fb8ab76-f716-4f05-acad-7bda50e3128e | anupampadey71/60-days-DSA-Challenge-Striver | 53-maximum-subarray/53-maximum-subarray.cpp | class Solution {
public:
int maxSubArray(vector<int>& nums) {
int sum=0;
int maxi=INT_MIN;
for(auto it: nums){
sum+=it;
maxi=max(sum, maxi);
if(sum < 0) sum=0;
}
return maxi;
}
}; | ALGO | 0.999965 | 6.263041 |
1b997bd5-716c-455a-8d43-1d901a84845f | sahilchavhan/C-plus-plus | fibonacci and factorial/factorial_function.cpp | #include<iostream>
using namespace std;
int fact(int n)
{
int i,t1=0,t2=1,next;
for(i=1;i<=n;i=i+1){
t2=t2*i;
}
//cout<<t2<<endl;
return t2;
}
int main()
{
int i,j,n,r;
cout<<"in nCr"<<endl<<"enter the n";
cin>>n;
cout<<"enter the r";
cin>>r;
j=(fact(n))/(fact(n-... | ALGO | 0.999558 | 4.625071 |
2b725c33-0ec6-4f0a-bf2a-172b45fc6ae1 | vinitbolla10/Data-structures | RBT_project.cpp | #include<iostream>
#include<stdio.h>
#include<malloc.h>
#include<string.h>
using namespace std;
struct RBT
{
int key;
char name[100];
struct RBT* left;
struct RBT* right;
struct RBT* parent;
char color;
};
struct RBT* T=NULL;
void rotate_left(struct RBT *q) //Function to rotate left
{
struct RBT *k;
k=q... | ALGO | 0.999255 | 3.05947 |
02a92403-c0c9-4552-bdd8-ef007ca8e956 | JobHaver/leetCode | relative-sort-array.cpp | class Solution {
public:
vector<int> relativeSortArray(vector<int>& arr1, vector<int>& arr2) {
map<int, int> mp;
for(int i : arr1)
mp[i]++;
int j = 0;
for(int i = 0; i < arr2.size(); i++){
int &curr = mp[arr2[i]];
while(curr-- > 0)
... | ALGO | 0.999993 | 5.541708 |
7e4565e1-7f62-49e2-be4d-04c2d3a83b87 | YaeSaraki/OI | Algorithms/CodeForces/GYM/104081/I. 宠物对战.cpp | #include <iostream>
#include <algorithm>
#include <set>
using namespace std;
using ll = long long;
inline void solve() {
set<string> a, b;
int n; cin >> n;
string temp;
for (int i = 0; i < n; ++i) { cin >> temp; a.insert(temp); }
int m; cin >> m;
for (int i = 0; i < n; ++i) { cin >> temp; a.insert(temp); ... | ALGO | 0.999738 | 3.974439 |
32c3e037-58ef-48d2-b3fe-184196bb19e0 | akshaypandey28/LEETCODE-SOLUTION | 1751-slowest-key/slowest-key.cpp | class Solution {
public:
char slowestKey(vector<int>& releaseTimes, string keysPressed) {
char ans=keysPressed[0];
int maxi=releaseTimes[0];
for(int i=1; i<releaseTimes.size();i++){
int value=releaseTimes[i]-releaseTimes[i-1];
if(value>maxi){
maxi=valu... | ALGO | 0.999599 | 6.11645 |
1d52b065-424c-4e80-85eb-a5dfb0fc8a3c | ishandutta2007/codeforces | ronnie007/normal/1491/D.cpp | #include<bits/stdc++.h>
using namespace std ;
// mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
long long x , y ;
void input ( ) {
cin >> x >> y ;
}
void solve ( ) {
if ( x > y ) { cout << "NO\n" ; return ; }
int cnt = 0 ;
for ( int i = 0 ; i < 30 ; ++ i ) {
cn... | ALGO | 0.999932 | 4.20605 |
e35bd16d-0144-420d-b738-12845d6a0dcf | jacob-machado-bwtek/AdventOfCode2024 | day07/day07_01.cpp | #include <ranges>
#include "..\utils\utils.h"
auto ParseData(string path){
vector<string> data = aoc::read_lines(path);
vector<tuple<long long, vector<long>>> result;
//sample line:
//166170: 970 917 29 667 3
for (const string& line : data) {
size_t colon_pos = line.find(':'); // Find the... | ALGO | 0.994548 | 5.532896 |
0be7165d-4552-4a25-bda1-1d3acef8dff0 | hqdem/hlimds | src/gate/estimator/npn_estimator.cpp | #include "gate/estimator/npn_estimator.h"
#include "gate/model/subnetview.h"
#include "gate/optimizer/cut_extractor.h"
#include "gate/optimizer/safe_passer.h"
namespace eda::gate::estimator {
using CutExtractor = gate::optimizer::CutExtractor;
using SafePasser = gate::optimizer::SafePasser;
using SubnetView = gat... | ALGO | 0.997413 | 6.552148 |
79936049-4b03-4e83-b0e7-613541ae94c4 | govoyager/interview-preparation-material | CodeChef Questions/VACCINE1.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int d1,v1,d2,v2,p,day=1;
cin>>d1>>v1>>d2>>v2>>p;
while(p>0)
{
if(day < min({d1,d2}))
{
day = day +1;
}
else if(day<max({d1,d2}) && day >= min({d1,d2}))
{
day = day +1;
... | ALGO | 0.999711 | 3.397534 |
780f0211-67e8-4e19-bc55-b7be769e5cfb | raghuvanshraj/Competitive-Programming-Archive | Coding Ninjas/Assignment 1/uniqstr_1.cpp | #include <iostream>
#include <string.h>
#include <bits/stdc++.h>
using namespace std;
char* uniqueChar(char *str)
{
map<char,bool> isVisited;
for(int i = 0; i < strlen(str); i++)
isVisited[str[i]] = false;
string output;
for(int i = 0; i < strlen(str); i++)
{
if(isVisited[str[i]] == false)
{
is... | ALGO | 0.999701 | 4.492701 |
761e767c-3e2c-4d8e-80c8-ec3c6e53d307 | hieuhoangatm/DSA-PTIT | SapXepTimKiem/DSA06031-PhanTuLonNhatTrongDayCon.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int t; cin >> t;
while(t--){
int n,k; cin >> n >> k;
int a[n];
for(int i=0;i<n;i++) cin >> a[i];
for(int i=0;i<=n-k;i++){
int m=0;
for(int j=i;j<i+k;j++){
m= max(m,a[j]);
}
cout << m << " ";
}
cout << endl;
}
}
| ALGO | 0.999958 | 3.856272 |
d854020c-2477-4107-b552-cc8e74e7d5c1 | strw139/UTS-DASAR-PEMROGRAMAN | BAB 7/5_mengurutkan array.cpp | #include <iostream>
using namespace std;
int main()
{
int A[7];
int j, k, C, temp;
cout << "Masukan nilai pada elemen array : " << endl;
for (C=0; C<7; C++)
{
//menginput elemen array
cout << "A[" << C << "] = ";
cin >> A[C];
}
cout << "\nNilai elemen array sebelum ... | ALGO | 0.999938 | 3.486206 |
a00cce72-765f-4ee1-9fe4-082e9c40fc9b | KevinyWu/competitive-programming | cses-solutions/graph-algorithms/shortest-routes-II.cpp | #include <iostream>
#include <vector>
#define ll long long
using namespace std;
void solve() {
// This problem is solved using Floyd-Warshall algorithm
int n, m, q; cin >> n >> m >> q;
vector<vector<ll>> dists(n+1, vector<ll>(n+1, 1e18));
for (int i = 0; i < m; i++) {
ll a, b, c; cin >> a >> b ... | ALGO | 0.999975 | 5.001526 |
62b94b96-67b1-4a03-8bf6-c5e8c0c94cab | manikanta2901/ubuntu | .history/codingChallenges/cpp/Codechef/longChallenges/july/ChefinaAndSwaps_20200705195351.cpp | #include<bits/stdc++.h>
#include<vector>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<iterator>
#include<string>
#include<map>
#include<unordered_map>
#define F first
#define S second
#define MP make_pair
#define EXECUTE_FASTER ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define ... | ALGO | 0.999942 | 3.071699 |
abc2382e-3898-48ab-b070-a472721aded3 | ImaginationZ/code | OJ/1042.cpp | #include <iostream>
#include <fstream>
#include <string>
using namespace std;
const int MAX = 12346;
struct Tnode{
int num;
Tnode *former;
Tnode *lfson;
Tnode *rtbro;
} node[MAX];
class Tqueue{
struct Lnode{
Tnode *what;
Lnode *next;
}*head;
public:
Tqueue(){
head=new Lnode;
head->next=NULL;
}
voi... | ALGO | 0.999979 | 3.611586 |
9167553a-f570-4148-8753-e2c14a778455 | pavalucas/Competitive-Programming | Problems/VTEX_Training_Sessions/15_06/c.cpp | #include <bits/stdc++.h>
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define sz(x) int((x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rp(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep(i, x, n) for (int i = ... | ALGO | 0.999919 | 3.809373 |
c4dae74c-c10d-48d2-926c-6ddc1655a5ad | MrMagnifico/pixel-art-upscaling | framework/third_party/eigen-3.4.0/bench/sparse_dense_product.cpp |
//g++ -O3 -g0 -DNDEBUG sparse_product.cpp -I.. -I/home/gael/Coding/LinearAlgebra/mtl4/ -DDENSITY=0.005 -DSIZE=10000 && ./a.out
//g++ -O3 -g0 -DNDEBUG sparse_product.cpp -I.. -I/home/gael/Coding/LinearAlgebra/mtl4/ -DDENSITY=0.05 -DSIZE=2000 && ./a.out
// -DNOGMM -DNOMTL -DCSPARSE
// -I /home/gael/Coding/LinearAlgebr... | ALGO | 0.995792 | 4.386305 |
f1346a79-dee0-4fac-9b46-ae706ae5a03f | RinCloud/TrickCatcher | Datasets/TrickyBugs/GenProgs/dpp_generated_progs_cpp/p03296/p03296_num7_parsed.cpp | #include<bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<int> a(N);
for(int i = 0; i < N; i++) {
cin >> a[i];
}
int count = 0;
for(int i = 0; i < N-1; i++) {
if(a[i] == a[i+1]) {
count++;
i++;
}
}
cout << cou... | ALGO | 0.999905 | 4.318923 |
09372114-962b-4697-9e0e-5aab6ff2fbaf | Wangwenjing1996/Sirloin | faiss-main/faiss/invlists/BlockInvertedLists.cpp | #include <faiss/invlists/BlockInvertedLists.h>
#include <faiss/impl/CodePacker.h>
#include <faiss/impl/FaissAssert.h>
#include <faiss/impl/IDSelector.h>
#include <faiss/impl/io.h>
#include <faiss/impl/io_macros.h>
namespace faiss {
BlockInvertedLists::BlockInvertedLists(
size_t nlist,
size_t n_per_b... | TOOL | 0.851862 | 7.430548 |
1a8a6af9-59d9-4d9d-8e77-1c46ff609002 | wassimalharaki/Codeforces | 1100/MatrixofDifferences.cpp | #include <bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define int long long
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define nl << '\n'
#define pii pair<int, int>
#define v vector
#define vi v<int>
#define vvi v<vi>
#define vpii ... | ALGO | 0.999659 | 3.94135 |
dd6bd1e9-0731-4daf-85cd-e4bc61dba06c | nimishmedatwal/dsa | C++/recursion/towerofhanoi.cpp | #include <iostream>
using namespace std;
int num;
void tower(int n, char src, char dest, char helper){
if (n==0){
return;
}
tower(n-1,src ,helper, dest);
cout<<"Move from "<<src<<" to "<<dest<<endl;
num++;
cout<<num<<endl;
tower(n-1,helper,dest,src);
}
int main(){
tower(12,'A','C... | ALGO | 0.999746 | 4.632798 |
68a65e51-65aa-486c-a23b-bad4ec6b207b | ArchitKumar1/LeetCode-Submissions | binary-search/Accepted/4-5-2019, 3:21:54 AM/Solution.cpp | // https://leetcode.com/problems/binary-search
class Solution {
public:
int search(vector<int>& nums, int target) {
int l =0;
int r = nums.size() -1;
int index =-1;
while(l<=r){
int mid = l + (r-l)/2;
if(nums[mid] == target)
return ... | ALGO | 0.999991 | 6.73421 |
1324916b-b5de-4ad6-9ca0-b5fb0e312958 | MIhirDas10/Phitron | C++ for DS/Extra/extra extra/functions/L_GCD.cpp | #include<bits/stdc++.h>
using namespace std;
int gcd(int a,int b){
while(b != 0){
int temp = b;
b = a%b;
a = temp;
}
return a;
}
int main(){
int A, B;
cin>>A>>B;
cout<<gcd(A,B)<<endl;
return 0;
} | ALGO | 0.999945 | 5.062814 |
085ca1b1-87c0-4062-a5d9-435197ab5f33 | night0205/APCS | 10702_03.cpp | #include <iostream>
using namespace std;
unsigned long long city_sum(int p[], int s, int t, int k, int h){
if((h >= k) or (t-s < 2))
return 0;
int tmp = 0;
long long int cnt = 0, ans = -1, sum = 0;
for(int i = s; i <= t; i++)
sum += p[i];
for(int i = 0; i <= s-t; i++)
cnt += p[s+i] * i;
for(tmp = s-1; tmp... | ALGO | 0.999951 | 3.320819 |
cab482a7-3e2e-4acb-9391-d264b971a57c | kapil4457/Striver-A2Z-Sheet | 11. Heaps/11.2/Kth smallest element.cpp | //{ Driver Code Starts
//Initial function template for C++
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
//User function template for C++
class Solution{
public:
// arr : given array
// l : starting index of the array i.e 0
// r : ending index of the array i.e size-1
// k : f... | ALGO | 0.999892 | 5.325784 |
a5d4161c-2805-497a-af3d-7be6f808d111 | madlib/archived_madlib | src/modules/stats/robust_variance_coxph.cpp | /* ----------------------------------------------------------------------
Robust Variance estimator for CoxPH model
---------------------------------------------------------------------- */
#include <dbconnector/dbconnector.hpp>
#include <modules/shared/HandleTraits.hpp>
#include <modules/prob/boost.hpp>
#inclu... | ALGO | 0.998864 | 5.057568 |
a683292c-ee9a-4f9a-9060-7fdfddd88a32 | evialbert/LeetCode | 2386-find-the-k-sum-of-an-array/2386-find-the-k-sum-of-an-array.cpp | class Solution {
public:
long long kSum(vector<int>& nums, int k) {
long long sum = 0;
for(int i=0; i<nums.size(); ++i) {
if(nums[i]>=0) sum+=nums[i];
else nums[i]*=-1;
}
sort(nums.begin(), nums.end());
typedef pair<long long, int> p;
priority_... | ALGO | 0.99999 | 5.151992 |
fb6ac71e-7e72-4ec3-b6f3-fb04ed46e35b | JosuePerezValenzuela/Contest-geometria | The knights of the round table.cpp | #include <bits/stdc++.h>
using namespace std;
double calcRadio(double a, double b, double c) {
double s = (a + b + c) / 2.0;
double area = sqrt(s * (s - a) * (s - b) * (s - c));
double r = area / s;
return r;
}
int main() {
double a, b, c;
while (cin >> a >> b >> c) {
cout << "The rad... | ALGO | 0.999525 | 4.877793 |
6426f559-d20d-4852-9d90-8db217b7cad8 | kmzn128/atcoder_cpp | src/abc/138/a.cpp | #include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REP2(i, a, b) for (int i = (a); i < (int)(b); i++)
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef long long ll;
#define ALL(V) V.begin(), V.end()
template<class T,class U>bool c... | ALGO | 0.998876 | 3.786636 |
26fb861c-64fa-4a13-b588-1bae0b7e2f88 | satyamrs00/cses-problem-set-solutions | Dynamic Programming/12. Money Sums.cpp | #include "iostream"
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<ll> vl;
typedef vector<ld> vd;
typedef vector<string> vs;
typedef set<ll> sl;
typedef map<string, ll> msl;
typedef map<ll, ll> mll;
typedef unordered_map<ll, l... | ALGO | 0.999961 | 3.495025 |
c39fd773-9d0c-431d-a228-3b24ffbe6941 | utkarsh438-tech/codeforces_codes | A_Moving_Chips.cpp | #include <bits/stdc++.h>
using namespace std;
#define ar array
#define ll long long
#define ld long double
#define sza(x) ((int)x.size())
#define all(a) (a).begin(), (a).end()
#define vec vector<int>
#define vecp vector<pair<int,int>>
#define vecc vector<vector<int>>
#define pb push_back
#define fr first
#define sc sec... | ALGO | 0.999855 | 5.169368 |
169697c5-9e6f-48f5-85fb-78caea9df3b0 | UtopiaBeam/competitive | SPOJ/SAMER08A.cpp | #include <cstdio>
#include <queue>
#include <vector>
#define INF 1<<30
#define P pair<int, int>
#define F first
#define S second
using namespace std;
priority_queue<P> q;
vector<int> p[502];
int g[502][502], d[502];
int n, m;
int s, e, w;
int u, v;
void dijks() {
q.push( P(0, u) );
while( !q.empty() ) {
... | ALGO | 0.999972 | 4.141999 |
a48bb7c3-b1ce-458a-b3ca-931607a55e4f | maksym-ovcharenko/DKR | encryption.cpp | #include "encryption.h"
std::string Encryption::encrypt(const std::string& data) {
std::string encrypted = data;
for (char& c : encrypted) {
c = c + 1; // Simple Caesar cipher
}
return encrypted;
}
std::string Encryption::decrypt(const std::string& data) {
std::string decrypted = data;
... | TOOL | 0.860464 | 5.586865 |
630fd78f-c5a2-4877-b613-3a006cc46cba | JeroenSweerts/CarND-Path-Planning-Project | src/Eigen-3.3/bench/vdw_new.cpp | #include <iostream>
#include <Eigen/Core>
using namespace Eigen;
#ifndef SCALAR
#define SCALAR float
#endif
#ifndef SIZE
#define SIZE 10000
#endif
#ifndef REPEAT
#define REPEAT 10000
#endif
typedef Matrix<SCALAR, Eigen::Dynamic, 1> Vec;
using namespace std;
SCALAR E_VDW(const Vec &interactions1, const Vec &inter... | ALGO | 0.999479 | 3.52102 |
1957aae7-bd4b-4650-9686-f2e949acf7dc | Uzer447/Code | Codeforces/Don't Try to Count.cpp | #include <bits/stdc++.h>
#define rep(I, N) for (int I = 0; I < (N); ++I)
#define endl "\n"
#define ll long long
#define pb push_back
#define pii pair<int,int>
#define vall(X) (X).begin(), (X).end()
#define vi vector<int>
using namespace std;
const int MOD = 1e9+7;
const int SIZE = 1e6+10;
int isSubstring(string s1, str... | ALGO | 0.999923 | 4.139242 |
048c4380-b1fa-4ffc-b10e-cb2172c1dedb | claudiodepaula/expensesApp | 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 |
7d55daa3-8a9c-4877-abcf-5f771265b2e0 | porag525/XPSC | Week 10/Day 5/A_Life_of_a_Flower.cpp | /*
__________________________
| Author:Md.Moniruzzaman |
--------------------------
*/
#include <bits/stdc++.h>
#define ll long long int
#define all(v) v.begin(), v.end()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define f front
using namespace std;
void solve()
{
int n;
cin >... | ALGO | 0.999845 | 4.767457 |
537ee2c6-da5a-4eb8-93a1-be719403f900 | noobie7/CodeBank | Codeforces/1437/A.cpp | /*
"An anomaly, I'm Muhammad Ali
Cause I know one day I'm gonna be the"
- Greatest, Eminem
*/
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define ff first
#define Shazam ios_base::sync_with_stdio(false); cin.tie(NULL)... | ALGO | 0.999923 | 3.456515 |
c574ee87-7d00-4f48-ba84-45dbc1e2ec8d | Infinity2959N/LeetCode | 503-next-greater-element-ii/next-greater-element-ii.cpp | class Solution {
public:
vector<int> nextGreaterElements(vector<int>& nums) {
int n=nums.size();
vector<int> answer(n,-1);
stack<int> st;
for(int i=2*n-1;i>=0;i--){
while(!st.empty() && st.top()<=nums[i%n]) st.pop();
if(!st.empty() && i<n){
... | ALGO | 0.999887 | 5.488966 |
9cd7cec4-e5d8-46ca-8f90-0ffef462d928 | Leonardo-Miguel/beecrowd_URI_judge_solutions | 03_strings/1263.cpp | #include <bits/stdc++.h>
using namespace std;
vector<string> split_string(string str, char delimiter){
vector<string> sep_strings;
int first_non_delimiter_index = 0;
while(str[first_non_delimiter_index] == delimiter){
first_non_delimiter_index++;
}
int i = first_non_delimiter_index;
int first_char = first... | ALGO | 0.999738 | 4.38101 |
aedb99f5-42ff-4992-b76d-a8562681bad7 | Zlin0509/Zlin_ACM | _CF/CONTEST/1500-1999/1976/A.cpp | #include "bits/stdc++.h"
using namespace std;
using ll = long long;
using vi = vector<int>;
using vll = vector<long long>;
int n;
char x[30];
void solve()
{
bool check = false;
char m = '0';
cin >> n;
for (int i = 0; i < n; i++)
cin >> x[i];
for (int i = 0; i < n; i++)
{
if (x... | ALGO | 0.999512 | 5.322515 |
86f08220-dc13-4255-8b3b-2dc85001270a | QbitQuantum/Basics | Исходники/amici2.cpp | void apply_pi(vector<int> &vec) {
int N = temp.size();
for(int i = 0; i < N; i++) {
temp[ Pi[i]-1 ] = vec[i];
}
vec.swap(temp);
return;
} | ALGO | 0.999436 | 3.685248 |
79a408c1-88c7-43f7-8be5-d89338636449 | ChrisHargrove/RollerRacer | Uni_OpenGL/includes/BULLET/BulletCollision/NarrowPhaseCollision/btContinuousConvexCollision.cpp | #include "btContinuousConvexCollision.h"
#include "BulletCollision/CollisionShapes/btConvexShape.h"
#include "BulletCollision/NarrowPhaseCollision/btSimplexSolverInterface.h"
#include "LinearMath/btTransformUtil.h"
#include "BulletCollision/CollisionShapes/btSphereShape.h"
#include "btGjkPairDetector.h"
#include "btPo... | ALGO | 0.998538 | 5.229535 |
22723e9a-c545-40c7-8f48-455d0f91201a | argang05/CPP-ProblemSolving | Arrays/Longest_Consecutive_SubSequence.cpp | /*
Given an unsorted array of integers nums, return the length of the longest consecutive
elements sequence.
You must write an algorithm that runs in O(n) time.
Example 1:
Input: nums = [100,4,200,1,3,2]
Output: 4
Explanation: The longest consecutive elements sequence is [1, 2, 3, 4]. Therefore its length is 4.
Examp... | ALGO | 0.999877 | 5.509819 |
c18e01c0-86fe-484c-9cd7-2a9954fde011 | Mofazzal874/ObjectOrientedProgramming-CSE-2102 | Template/exampl3.cpp | //this is same as example 2 .But here we are declaring the function outside of class
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
template <typename T>
class math{
int val1 , val2;
public:
T addNumbers(T a , T b);
T multNumbers(T a , T b);
};
template <typename T>
T math<T>::addNu... | ALGO | 0.954162 | 4.33752 |
fb2fb2f4-091a-41d0-8a09-6100e83f3da2 | zzvalkatazz/week2 | NodeZero/Source.cpp | #include<iostream>
#include<stack>
using namespace std;
struct Node
{
Node* next;
int value;
Node(int value,Node* next) : value(value),next(next){}
};
Node* filterSumZero(Node* begin)
{
Node* iter = begin;
std::stack<Node*> st;
while (iter != nullptr)
{
stack<Node*> stCopy = st;
int currentSum = iter->value;... | ALGO | 0.999884 | 4.584273 |
3eedd9de-f59b-4d81-96a3-41e6ca4756dc | SuperIOyht/LeetcodeExe | regions-cut-by-slashes.cpp | #include"headfile.h"
using namespace std;
class union_find
{
public:
int setCount = 0;
vector<int> parent;
union_find(int n) {
setCount = n;
parent.resize(n);
for (int i = 0; i < n; i++)
{
parent[i] = i;
}
}
int find(int x) {
return x == parent[x] ? x : parent[x] = find(parent[x]);
}
void unionSe... | ALGO | 0.999483 | 4.702798 |
ee60f538-4dff-4bc5-bf48-f28bf5688755 | openjdk-mirror/jdk7u-hotspot | src/share/vm/code/compressedStream.cpp | #include "precompiled.hpp"
#include "code/compressedStream.hpp"
#include "utilities/ostream.hpp"
// 32-bit one-to-one sign encoding taken from Pack200
// converts leading sign bits into leading zeroes with trailing sign bit
inline juint CompressedStream::encode_sign(jint value) {
return (value << 1) ^ (value >> 31)... | TOOL | 0.935641 | 6.411739 |
dc918e7a-b366-449f-a6f9-82e2da87b6b2 | avisekpatra/DSA | 3.C++ /4.2 Advance Partern/palindromic_partern.cpp | /* 1
2 1 2
3 2 1 2 3
4 3 2 1 2 3 4
5 4 3 2 1 2 3 4 5
*/
#include<iostream>
using namespace std;
int main()
{
int n;
cin>>n;
for(int i=1;i<=n;i++)
{
for(int j=1;j<=n-i;j++)
cout<<" ";
for(int j=i;j>=1;j--)
cout<<j<<" ";
for(int j=2;j<=i;j++)
cout<<j<<" ";
... | ALGO | 0.999896 | 3.522986 |
9a2903cc-8e12-46e5-ab4a-f902c8ff1425 | cpitclaudel/verilator | src/V3Trace.cpp | #include "config_build.h"
#include "verilatedos.h"
#include "V3Global.h"
#include "V3Trace.h"
#include "V3EmitCBase.h"
#include "V3Graph.h"
#include "V3Hashed.h"
#include "V3Stats.h"
#include <cstdarg>
#include <map>
#include <set>
//######################################################################
// Graph ver... | TOOL | 0.943222 | 6.655136 |
49ca6b03-e81b-4bb3-988f-8100c54396dc | k-ranasinghe/Data-Structures-and-Algorithms | LAB 8/heapsort1.cpp | #include <iostream>
using namespace std;
void heapify(int arr[], int n, int root)
{
int l = root;
int left = 2*root + 1;
int right = 2*root + 2;
if (left < n && arr[left] > arr[l])
l = left;
if (right < n && arr[right] > arr[l])
l = right;
if (l != root)
{
swap(ar... | ALGO | 0.999831 | 4.807996 |
db132e4b-46e8-4c00-86c2-4a740118b7c5 | Jinansh28/C_Plus_Plus | Pattern Printing/upperTriangleRightAlphabet.cpp | #include<iostream>
using namespace std;
int main(){
int n;
cin>>n;
int a=n*n;
int b=1;
for(int i=1;i<=a;i++){
int j=i%n;
int k=(i/n)+1;
if(j==0){
j=n;
k--;
}
if(j<=k){
char a=k+64;
cout<<a;
}
if(j... | ALGO | 0.999768 | 3.145683 |
30c71104-2039-4c1f-8f2d-b74d0a082054 | Kaileshwaran13/CodeChef | 500 - 1000 difficulty rating/Hattrick.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin >> t;
while (t--) {
vector < char > v(6);
for (int i = 0; i < 6; i++) {
cin >> v[i];
}
string ans = "NO";
for (int i = 0; i < 6; i++) {
if (v[i] == 'W' && i + 2 < 6 && v[i ... | ALGO | 0.999164 | 4.086563 |
7b4a05ed-9b5f-40f7-ac00-a0dc68f90064 | SparseLinearAlgebra/cuBool | cubool/sources/sequential/sq_kronecker.cpp | /**********************************************************************************/
/* */
/* */
/* of this software and associated documentation files (the "S... | ALGO | 0.91545 | 4.67647 |
c3d06d50-44c8-4a48-9fd6-f359acbbc336 | ISP-SST/redux | src/dlm/libgrid.cpp | #include <cmath>
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <thread>
#include <vector>
#include "mathlib.hpp"
#include "idlutil.hpp"
#include "redux/util/arrayutil.hpp"
#include "redux/util/datautil.hpp"
using namespace redux::util;
using namespace redux;
using namespace std;
// ***********... | ALGO | 0.999626 | 4.492944 |
2b74fa17-ebc9-4eca-9b7b-3b7bd0891eea | aryanj0808/Codechef | STARTERS 50 D4/SUMPRODSEG.cpp | #include <bits/stdc++.h>
using namespace std;
vector<long long>vec;
void answer(long long n)
{
for (long long i = 1; i <= sqrt(n); i++)
if (n % i == 0)
{
if (n / i == i)
vec.push_back(i);
else
vec.push_back(i), vec.push_back(n / i);
}
... | ALGO | 0.999817 | 4.211539 |
4ea24656-d1c7-47ff-b7a7-ea12dbdc106f | ujjawalgupta29/Coding-Stuff | LeetCode/knight_dialer.cpp | static auto x = [](){
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
std::cout.tie(nullptr);
return nullptr;
}();
class Solution {
public:
int mod = 1e9 + 7;
int knightDialer(int N) {
vector<vector<int>> paths = {
{4,6}, {6,8}, {7,9}, {4,8},
{... | ALGO | 0.999967 | 6.317801 |
8e6b5669-ee2e-4680-9f97-f5e34b9ff34f | pengw0048/Ural--Timus--Solution | 1049/1049_2818121_WA_20091021162650.cpp | #include <stdio.h>
int main(){
int n,i,j,f[10001]={0};
for(i=0;i<10;i++){
scanf("%d",&n);
s:
for(j=2;j<=n;j++){
if(n%j==0){
n/=j;
f[j]++;
goto s;
}
}
}
short n1=1;
for(i=0;i<=10000;i++)
n1*=f[i]+1;
printf("%d",(int)n1%10);
}
| ALGO | 0.999872 | 3.776612 |
5e10e465-7283-48a5-b351-c8f134e1bbb3 | codeseker/DSA | Recursion/sayDigit.cpp | #include<iostream>
using namespace std;
int reverse(int n)
{
int rev = 0;
while(n != 0)
{
int last = n%10;
rev = rev*10 + last;
n = n/10;
}
return rev;
}
void sayDigit(int n)
{
string arr[] = {"zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine... | ALGO | 0.99967 | 5.660366 |
323871db-2f5d-44d5-8c8d-189c0fcc54b7 | ishandutta2007/codeforces | alireza_kaviani/normal/691/F.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
#define all(x) (x).begin(),(x).end()
#define X first
#define Y second
#define sep ' '
#define endl '\n'
#define SZ(x) ll(x.size())
const ll MAXN = 3e6 + 10;
const... | ALGO | 0.999656 | 4.799795 |
730e78a9-280d-4d7d-86ba-7b74ef45857a | Jesan-Sikder/GREEN-SHEET | 1042.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int n = 3;
int arr[n];
int jesan[n];
for (int i = 0; i < 3; i++)
{
cin >> arr[i];
jesan[i] = arr[i];
}
sort(arr, arr + n);
for (int i = 0; i < 3; i++)
{
cout << arr[i] << endl;
}
cout << endl;
... | ALGO | 0.999968 | 3.106634 |
2e049db8-f1f8-42a7-99ec-ce79ffa8bf56 | abdelrhmanghaly-whp/Problems-Solutions | Say No to Palindromes(1555D).cpp | #pragma GCC optimize("-O2")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template <typename T>
using ordered_set = tree<T, null_type, std::less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define lli long long int
#define all(x) std::sort(((x).begin()),((x).e... | ALGO | 0.999405 | 4.58636 |
1e1a83a8-56df-4e20-a14b-d0d01f253509 | andersonhusky/build_a_slamsystem | src/slam01/src/test.cpp | #include<torch/torch.h>
#include<torch/script.h>
#include <iostream>
#include<vector>
#include<opencv2/highgui.hpp>
#include<opencv2/core/core.hpp>
#include<opencv2/opencv.hpp>
#include"viosystem/Construct.h"
#include"viosystem/Camera.h"
using namespace std;
using namespace cv;
void find_feature_match(const cv::Mat &... | ALGO | 0.893764 | 4.210348 |
96fcda85-32b5-490f-bff5-e3cdb50e26b5 | ishandutta2007/codeforces | vepifanov/normal/47/B.cpp | #include <cstdio>
#include <iostream>
#include <vector>
#include <set>
#include <cstring>
#include <string>
#include <map>
#include <cmath>
#include <ctime>
#include <algorithm>
#include <bitset>
#include <queue>
#include <sstream>
using namespace std;
#define mp make_pair
#define pb push_back
#define rep(i,n) for(in... | ALGO | 0.999962 | 3.64107 |
cac24a4b-d718-4e0b-b80f-98052a27e88a | pingjuiliao/ardupilot_hack | llvm/libcxx/test/libcxx/fuzzing/unique_copy.pass.cpp | // UNSUPPORTED: c++03, c++11
#include <algorithm>
#include <cstddef>
#include <cstdint>
#include <iterator>
#include <vector>
#include "fuzz.h"
extern "C" int LLVMFuzzerTestOneInput(const std::uint8_t *data, std::size_t size) {
std::vector<std::uint8_t> working(data, data + size);
std::sort(working.begin(), ... | TEST | 0.981477 | 5.984567 |
c3ece3b1-a1db-494c-b09b-09df1072e9ac | prabhat706/450-C- | valueinBST.cpp | #include <bits/stdc++.h>
using namespace std;
class Node
{
public:
int data;
Node *left;
Node *right;
Node(int data)
{
this->data = data;
this->left = NULL;
this->right = NULL;
}
};
void levelorderTraversal(Node *root)
{
queue<Node *> q;
q.push(root);
q.push... | ALGO | 0.999989 | 5.242383 |
04cdc473-f824-4720-8377-82a820676595 | hichemaichour/ACM-ICPC | Contests/ACM Contests/Singapore 2006/Wordfish+.cpp | #include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <fstream>
using namespace std;
int main() {
ifstream cin("input.txt");
string str;
while(cin >> str){
int i,j,k;
vector<string> V(21);
V[10] = str;
for(i=11 ; i<21 ; i++){
... | ALGO | 0.999856 | 3.159808 |
ce6b8adb-2295-4a9a-9479-76b4bd7063d3 | YZsZY/OctreeGS-Ubuntu-Viewer | src/core/video/VideoUtils.cpp | #include "VideoUtils.hpp"
#include <core/graphics/Utils.hpp>
#include <algorithm>
#include <opencv2/ximgproc/edge_filter.hpp>
#include <opencv2/optflow.hpp>
namespace sibr {
std::vector<cv::Mat> cvSplitChannels(cv::Mat mat) {
std::vector<cv::Mat> out;
cv::split(mat, out);
return out;
}
Volume3u loadVideoVo... | TOOL | 0.96555 | 5.079663 |
90e836f8-3193-4c02-81ca-876ef6f1379a | ishandutta2007/codeforces | xuanquang1999/normal/802/J.cpp | //84104971101048411497 - Can you guess what does this mean?
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef complex<double> point;
#define mapii map<int, int>
#define debug(a) cout << #a << ": " << a << endl
#define debuga1(a, l, r) fto(i, l, r) cout << a[i] << " "; cout << endl
#define fd... | ALGO | 0.999939 | 4.2739 |
cdf32d90-5d9f-4bbe-b881-cd435b3da3b7 | Fezrew/AI | AI_Shared/SeekForce.cpp | #include "SeekBehaviour.h"
bool SeekBehaviour::Update(Agent* agent, float deltaTime)
{
Vector2 v = Vector2Subtract(m_destination, agent->GetPosition());
if (v.x == 0 && v.y == 0)
{
// if seeker on top of target, v is 0 so following calculations are not needed
return true;
}
Vector2 desiredVelocity = Vector2... | TOOL | 0.992891 | 5.664906 |
d3729282-774c-4421-bd3a-0c2a4a9ff97c | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_1370_4.cpp | #include <bits/stdc++.h>
using namespace std;
struct node {
int id;
int parent;
int minimum_root_distance;
int maximum_root_distance;
node(int _id, int _parent, int _minimum_root_distance,
int _maximum_root_distance) {
id = _id;
parent = _parent;
minimum_root_distance = _minimum_root_distan... | ALGO | 0.999934 | 3.698946 |
f86aca9f-f129-43d2-8468-d72c67d439ca | sahilduhan/coding-blocks | dynamic_memory_.cpp/sum_array.cpp | #include <bits/stdc++.h>
using namespace std;
int sum(int *arr, int size, int val = 0)
{
int sum = 0;
for (int i = val; i < size; i++)
{
sum += arr[i];
}
return sum;
}
int main()
{
int arr[] = {1, 2, 3, 4, 5, 6, 7, 8, 9};
int size = sizeof(arr) / sizeof(arr[0]);
int val = 5;
... | ALGO | 0.999676 | 3.753843 |
c119010d-e996-480e-8a07-4f4ac852e163 | parkchanghyup/algorithm | C++/N과 M(3).cpp | #include<iostream>
#include<vector>
using namespace std;
int N, M;
void print(vector<int> a) {
for (int i = 0; i < M; i++) {
cout << a[i] << " ";
}
cout << "\n";
}
void func(vector<int> a) {
if (a.size() == M) {
print(a);
return;
}
for (int i = 1; i <= N; i++) {
a.push_back(i);
func(a);
a.pop_back... | ALGO | 0.999771 | 4.402032 |
c5a04b09-b524-4b74-b09b-57ba8c76d8a9 | OpenCAXPlus/OpenCAXPlus | OpenDigitalTwin-main/tools/cgal/examples/AABB_tree/AABB_insertion_example.cpp | #include <iostream>
#include <CGAL/Simple_cartesian.h>
#include <CGAL/AABB_tree.h>
#include <CGAL/AABB_traits.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/AABB_face_graph_triangle_primitive.h>
typedef CGAL::Simple_cartesian<double> K;
typedef K::FT FT;
typedef K::Point_3 Point;
typedef K::Segment_3 Segment;
typed... | ALGO | 0.999326 | 7.185407 |
1b06067a-e7c0-45d5-a645-2c53224b89f2 | DaltonCole/ProgramingProblems | kattis/evenup/greedy.cpp | #include <iostream>
#include <vector>
using namespace std;
int main() {
int cards, temp;
vector<int> row;
bool had_removal = false;
cin >> cards;
for(int i = 0; i < cards; i++) {
cin >> temp;
row.push_back(temp);
}
while(true) {
for(int j = 0; j < row.size() - 1; j++) {
if((row[j] + row[j+1]) % 2 =... | ALGO | 0.99995 | 4.580518 |
b0332d4c-2c86-48dc-a5d2-a7672ff27cba | Cadip/flutter_uas_simple_recipe_keeper_c14220002 | 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 |
8f64a58b-cb7f-4af1-882f-a263f5042556 | ishandutta2007/codeforces | origenes/normal/1151/B.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define FOR(i, a, b) for (int (i) = (a); (i) <= (b); (i)++)
#define ROF(i, a, b) for (int (i) = (a); (i) >= (b); (i)--)
#define REP(i, n) FOR(i, 0, (n)-1)
#define sqr(x) ((x) * (x))
#define all(x) (x).begin(), (x).end()
#de... | ALGO | 0.999927 | 3.134759 |
c1a6136f-4a64-4ced-9c49-2dc62db25213 | KimJerry/PS | BOJ/2457.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef pair<int, int> pi;
int day[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int N;
vector<pi> flower;
int daySum(int month)
{
int res = 0;
for (int i = 0; i <= month; i++)
res += day[i];
return res;
}... | ALGO | 0.999948 | 4.669191 |
3301ddc0-7f44-4f7d-8383-5742aaefa51c | jaimjoy/Algorithms-Lab-05 | LAB-07 [DFS List].cpp | #include<bits/stdc++.h>
using namespace std;
void printGraph(vector<int> *adj, int n)
{
for(int i=0; i<n; i++)
{
cout<<i<<"--->";
for(int j=0; j<adj[i].size(); j++) cout<<adj[i][j]<<" ";
cout<<endl;
}
}
void DFS(const vector<int> *adj, int s, int n)
{
stack<int> St;
//int *... | ALGO | 0.999941 | 4.911071 |
e15c635c-1aff-4478-85b7-0127cdad9c26 | VinhTA-Computer-Master/CCF-20.04 | gem5/src/systemc/tests/systemc/misc/v1.0/dash9/dist.cpp | /*****************************************************************************
dist.cpp -- Implementation of the odometers.
Original Author: Ali Dasdan, Synopsys, Inc.
*****************************************************************************/
/************************************************************... | ALGO | 0.989776 | 6.558409 |
375d8f47-646e-4370-9f41-03ecf978f709 | Bharatbardiya/my-leetcode-solutions | 1437-minimum-insertion-steps-to-make-a-string-palindrome/1437-minimum-insertion-steps-to-make-a-string-palindrome.cpp | class Solution {
public:
int fun(string &s1, int i, int j, vector<vector<int>>&dp){
if(i>=j) return 0;
if(dp[i][j]!=-1) return dp[i][j];
if(s1[i]==s1[j]) return dp[i][j] = fun(s1, i+1, j-1, dp);
return dp[i][j] = 1+min(fun(s1, i+1, j, dp), fun(s1, i, j-1, dp));
}
int minIn... | ALGO | 0.999997 | 6.201731 |
c09a22fb-6f29-4c08-b81b-8dd4c36ca848 | Mauker1/Marlin_MegaX_SKR3_EZ | Marlin/src/feature/meatpack.cpp | /**
* MeatPack G-code Compression
*
* Algorithm & Implementation: Scott Mudge - <EMAIL>
* Date: Dec. 2020
*
* Character Frequencies from ~30 MB of comment-stripped G-code:
* '1' -> 4451136 '4' -> 1353273 '\n' -> 1087683 '-' -> 90242
* '0' -> 4253577 '9' -> 1352147 'G' -> 1075806 'Z' -> 34... | TOOL | 0.942691 | 5.874485 |
a2b5ed1b-9beb-433c-9680-e4f7a2be0a34 | Rohan-90/GFG_Solutions | Difficulty: Medium/K Sized Subarray Maximum/k-sized-subarray-maximum.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:
vector<int> max_of_subarrays(int k, vector<int> &arr) {
deque<int> dq;
vector<int> ans;
for (int i = 0; i <... | ALGO | 0.999583 | 6.036668 |
34755b01-2905-40f9-ae22-4c35e231d151 | rudrab06/Codechef-Solutions- | Chef Eren.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
// your code goes here
int t;
cin>>t;
while(t--){
int n,a,b;
cin>>n>>a>>b;
if(n%2==0){
cout<<a*(n/2)+b*(n/2)<<endl;
}
else{
cout<<a*(n/2) + b*(n/2 +1)<<endl;
}
}
return 0;
}
| ALGO | 0.999657 | 3.984308 |
e16aed24-c971-41d4-adc1-d8ddd85269d3 | Soumithra-DNS/Problem_Solving | Codeforces/1760G.cpp | #include <bits/stdc++.h>
using namespace std;
vector<pair<int, int>> graph[1000007];
map<int, bool> mp;
int n, a, b;
bool check;
void dfs0(int root, int par, int x)
{
if (root == b)
return;
mp[x] = true;
for (auto &child : graph[root])
{
if (child.first != par)
{
df... | ALGO | 0.999922 | 4.96178 |
f7c0c5f2-dcfd-4a0d-b60e-e3ee67d13f8b | JKLover0909/Code-C-Practice | tuyensinh.cpp | #include<bits/stdc++.h>
using namespace std;
struct thisinh{
string msv;
string ten;
float a,b,c,d;
};
int main(){
thisinh A;
cin >> A.msv;
cin.ignore();
getline(cin, A.ten);
A.d=0;
if (A.msv[2]=='1') A.d = 0.5;
if (A.msv[2]=='2') A.d = 1;
if (A.msv[2]=='3') A.d = 2.5;
cin >>A.a >>A.b >>A.c;
cout <<A.ms... | ALGO | 0.970835 | 3.085012 |
428b8621-811a-41a4-bad3-a447f626c343 | Sumitkk10/USACO-submissions | 2018/February/Bronze/teleport.cpp | #include <bits/stdc++.h>
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define ll long long int
#define ld long double
using namespace std;
const int N = 1e6 + 5;
const int MOD = 1e9 + 7;
void solve(){
int a, b, x, y;
cin >> a >> b >> x >> y;
if(a > b)
swap(a, b);
if(x > y)
swap(x, y);... | ALGO | 0.999694 | 3.78933 |
19035622-5437-42f3-875e-441869ad6f71 | pershoot/android_frameworks_base | media/libstagefright/codecs/amrnb/common/src/lsp.cpp | /*
Pathname: ./audio/gsm-amr/c/src/lsp.c
Functions:
------------------------------------------------------------------------------
REVISION HISTORY
Description: Updated template used to PV coding template.
Changed to accept the pOverflow flag for EPOC compatibility.
Description: Per review comments, added pOve... | ALGO | 0.902212 | 3.745082 |
1b4af67c-1cf1-4524-b327-8aef6ea59a6f | rifatr/Competitive-Programming | Old_items/CSES/1083-missing-number.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lop(b) for(int i = 0; i < b; i++)
#define loop(j, a, b) for(int j = a; j < b; j++)
#define yes cout << "yes\n"
#define no cout << "no\n"
int solve();
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
//freop... | ALGO | 0.999775 | 3.83636 |
4c205951-fa53-4ec3-8f8b-30cbcf3578fb | cowkjw/Algorithm | 프로그래머스/unrated/181912. 배열 만들기 5/배열 만들기 5.cpp | #include <string>
#include <vector>
using namespace std;
vector<int> solution(vector<string> intStrs, int k, int s, int l) {
vector<int> answer;
for(const auto& str : intStrs)
{
auto num = stoi(str.substr(s,l));
if(k<num)
{
answer.push_back(num);
}
}
return ... | ALGO | 0.998525 | 4.399298 |
a39e3aa2-c86a-412c-a0fb-2209c89467d0 | kaziabdullahfuad/Codeforces-Grind | leetcode/35searchposition.cpp | #include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
#include<set>
#include<unordered_set>
#include<unordered_map>
#include<map>
using namespace std;
#define ll long long
#define endl "\n"
#define debug(x) cout<<#x<<":"<<x<<endl;
#define all(x) (x).begin(),(x).end()
template<typename... | ALGO | 0.999934 | 5.455425 |
ed14478a-8ad0-46df-9b27-f0d0ffa39720 | Shyamji07/Leetcode-Solutions | 0404-sum-of-left-leaves/0404-sum-of-left-leaves.cpp | class Solution {
public:
int sum=0;
int sumOfLeftLeaves(TreeNode* root) {
if(!root)return sum;
if(root->left && !root->left->left && !root->left->right)
sum=sum+root->left->val;
sumOfLeftLeaves(root->left);
sumOfLeftLeaves(root->right);
return sum;
}
}; | ALGO | 0.999964 | 6.175548 |
aef5a5c3-2d94-4760-89a7-0c5003608616 | ishandutta2007/codeforces | ei133333/normal/1120/C.cpp | #include<bits/stdc++.h>
using namespace std;
const int INF = 1 << 30;
int lcp[5000][5000];
int dp[5001];
int main() {
int N, A, B;
cin >> N >> A >> B;
string S;
cin >> S;
for(int i = S.size() - 1; i >= 0; i--) {
for(int j = S.size() - 1; j >= 0; j--) {
lcp[i][j] = S[i] == S[j] ? lcp[i + 1][j + ... | ALGO | 0.999933 | 4.053313 |
000fda01-c257-480b-be0a-adbd70c483db | ManojKumarPatnaik/Sr.SoftwareEngineerInterviewPrep | LeetCode/C++/Climbing stairs.cpp | //LINK TO THE QUESTION: https://leetcode.com/problems/climbing-stairs/
/*
QUESTION STATEMENT:
You are climbing a staircase. It takes n steps to reach the top.
Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?
//AIM: To calculate the distinct ways can user climb to the top... | ALGO | 0.99993 | 4.997141 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.