uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
157f9f0f-14c4-459b-b789-bbdec6c20a50 | nagasai1155/dsacpp | queue/usingll.cpp | #include<iostream>
using namespace std;
// Define Node structure
struct Node {
int data;
Node* next;
};
class Queue {
private:
Node *front, *rear;
public:
// Constructor
Queue() {
front = rear = NULL;
}
// Function to add an item to the queue
void enqueue(int data) {
N... | ALGO | 0.974166 | 5.484109 |
76b7beef-54ce-42e0-8809-092787539dac | KhaiJP/AtCoder | ABC/<300/290/C++/C.cpp | #include<iostream>
#include<set>
using namespace std;
#define rep(i, s, t) for(int i = (s); i < (t); ++i)
int main(){
set<int> S;
int N, K; cin >> N >> K;
rep(i, 0, N){
int a; cin >> a;
if( a < K ) S.insert(a);
}
int answer = 0;
auto itr = S.begin();
while( itr != S.end() ){
if(*itr == answer... | ALGO | 0.999869 | 3.698476 |
4b542133-0144-4c2b-8503-54e63849c336 | debojyoti-majumder/CompCoding | yearEnd2018/aoc_day3.cpp | // Problem URL: http://adventofcode.com/2017/day/3
#include "stdafx.h"
#include <iostream>
#include <vector>
#include <iomanip>
using namespace std;
class SprialHelper {
private:
unsigned int _x, _y, _cellsLeft;
unsigned int _direction;
vector<vector<int>> _matrix;
bool allocateIfNeeded() {
if (_cellsLeft ==... | ALGO | 0.999744 | 5.552765 |
6c3a67b8-e71d-4d40-84ad-29fe310c4462 | Jimmy-Sim/Competitive-Programming | Codechef/diff750-validTriangles.cpp | #include <iostream>
using namespace std;
int main() {
int t;
cin >> t;
while (t--) {
int a, b, c;
cin >> a >> b >> c;
if (a + b + c == 180) cout << "YES\n";
else cout << "NO\n";
}
return 0;
} | ALGO | 0.999612 | 4.286154 |
62965262-6dd8-4218-8a15-95a71e46904e | otavioon/COLA-2022-Tools | datasets/src/optz/codenet/1/p02917_s357420544.cpp | #include<bits/stdc++.h>
using namespace std;
int min(int,int);
int main()
{
int n,i;
cin>>n;
int p=n-1;
int a[p];
for(i=0; i<p; i++)
cin>>a[i];
if(p==1)
cout<<a[0]*2;
if(p==2)
cout<<a[0]*2+a[1];
if(p>2)
{
int s=0;
s+=a[0]*2;
for(i=1; i<p-1; i++)
s+=min(a[i],a[i+1]);
s+=a[p-1];
cout<<s;
}
}
i... | ALGO | 0.99969 | 3.350098 |
a6771f00-3603-4144-916b-af5bd9b28111 | madebytachi/2023aaib3 | week11/week11-1.cpp |
#include <iostream>
#include <unordered_map>
using namespace std;
int main()
{
unordered_map<int,int> table;
table[9977341] = 9;
table[4433997] = 4;
cout << table[9977341] << "\n";
cout << table[4433997] << "\n";
}
| ALGO | 0.999003 | 3.586805 |
91c29604-171a-4752-b724-6606a1100715 | naminamina/mimibase_ros | 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 |
2f61e561-ec33-408c-b8ac-f6577eb36c8c | cpe102/lab4-2562-2-ultramanbabe | lab4_3.cpp | #include<iostream>
using namespace std;
int findDivisor(int x){
for(int i = 2; i < x ; i++){
if(x%i==0){
return i;
}else{
;
}
}
}
int main(){
int x;
cout<<"Find Divisor : Please Input : ";
cin>>x;
cout<<"Output = "<<findDivisor(x);
return 0;... | ALGO | 0.999004 | 3.75284 |
c6a86fc1-8d81-4793-9c02-ffc0fd023ba4 | john4477/masterDegree | ext/systemc/src/sysc/utils/sc_pq.cpp | /*****************************************************************************
sc_pq.cpp - Simple heap implementation of priority queue.
Original Author: Stan Y. Liao, Synopsys, Inc.
CHANGE LOG AT END OF FILE
*****************************************************************************/
// $Log: sc_pq.cpp,v ... | ALGO | 0.999159 | 6.188192 |
75d10491-bb99-4152-b983-257c0b7d8e05 | JustAG7/Competitive_Programming | Codeforces/Rounds/883/E2.cpp | #include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);cout.tie(NULL);cin.tie(NULL);
#define ll long long
#define pb push_back
#define pf push_front
#define db double
#define X first
#define Y second
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define... | ALGO | 0.999247 | 4.393604 |
362af50f-586f-4446-b04c-b42c5775a930 | ShujianDou/CppTicTacToe | lua/lstrlib.cpp | #include <ctype.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define lstrlib_c
#define LUA_LIB
#include "lua.h"
#include "lauxlib.h"
#include "lualib.h"
/* macro to `unsign' a character */
#define uchar(c) ((unsigned char)(c))
static int str_len (lua_State *L) {
size_t... | TOOL | 0.954284 | 5.75457 |
5e5373e5-9e69-4192-986c-9847ee81154d | SeeRipStar/DAA- | Knapsack.cpp | #include <iostream>
#include <vector>
using namespace std;
int knapsack(int W, vector<int>& wt, vector<int>& val, int n) {
vector<vector<int>> dp(n + 1, vector<int>(W + 1, 0));
for (int i = 0; i <= n; i++) {
for (int w = 0; w <= W; w++) {
if (i == 0 || w == 0) {
dp[i][w] =... | ALGO | 0.999996 | 5.694027 |
4ef41573-b5a1-4a26-9209-e6557258f65e | shaukat01/MyDailyProblemSolved | 12b.cpp | #include <bits/stdc++.h>
using namespace std;
// template <class t>
int main()
{
vector<int> v;
int sum = 0;
srand(time(0));
for (int i = 0; i < 10; i++)
{
int k = rand() % 100+1;
v.push_back(k);
sum = sum + k;
}
sort(v.begin(),v.end(),greater<int>());
for (int ... | ALGO | 0.99084 | 4.121149 |
52897a9e-e667-4c1f-948a-2b09e0f610cb | yujin-hong/algorithm_study | 13023/main.cpp | #include <iostream>
#include <cstring>
#include <vector>
using namespace std;
vector<int> v[2001];
bool visited[2001];
int fl=0;
void dfs(int start, int depth) {
// cout<<start<<" "<<depth<<'\n';
if(fl==1) return;
if(depth==4) fl=1;
visited[start] = true;
vector<int> tmp = v[start];
for(int i... | ALGO | 0.998129 | 3.878576 |
98427a4c-4d81-43dd-ab83-bc375670a346 | imnooy/algorithm | BOJ/Bipartite Matching/Bipartite Matching/[2414번] 게시판 구멍 막기.cpp | #include <bits/stdc++.h>
using namespace std;
int n, m;
vector<int> adj[502]; //
int aMatch[502];
int bMatch[502]; // ȣ
bool visited[502];
char arr[51][51];
int col[51][51];
int row[51][51];
bool chk[502];
int num;
bool dfs(int a) {
if (visited[a]) return false;
visited[a] = true;
for (int i = 0; i < adj[a... | ALGO | 0.999819 | 3.716392 |
454f5fa8-8fb5-45b4-8c66-eb08c7c7c1bd | krtchnt/psolve67 | week_1/ku01_thief.cpp | #include <cstdint>
#include <iostream>
void eea(const uint32_t a, const uint32_t b, uint32_t &g, int64_t &x,
int64_t &y);
int main() {
uint32_t n, k, _t;
std::cin >> n >> k >> _t;
const auto t = _t - 1;
uint32_t g;
int64_t _x, _y;
eea(k, n, g, _x, _y);
const auto x_1 = n / g;
uint32_t x_;
... | ALGO | 0.999956 | 4.390593 |
686c14d1-838b-48c6-857b-64ad282260a3 | RickAlter/CWork | 1.算法/3.算法课/4.动态规划/1.动态规划.cpp | /*************************************************************************
> File Name: 4.动态规划.cpp
> Author:
> Mail:
> Created Time: 2020年11月16日 星期一 15时52分18秒
************************************************************************/
#include<iostream>
#include "3.LCSLength.h"
using namespace std;
#define ans 7
... | ALGO | 0.999766 | 4.142843 |
0f1d4c8c-7a77-4301-abac-3f3fbd4659cc | jimmycao/heet | cpp/leet/00_carl/05_binary_tree/carl05_04_111.cpp | #include "../../utils/print_tools.h"
#include "../../utils/tree.h"
class Solution {
public:
int minDepth(TreeNode *root) {
if (!root) {
return 0;
}
queue<TreeNode*> myQueue;
myQueue.push(root);
int step = 1;
while (!myQueue.empty()) {
size_... | ALGO | 0.99994 | 6.536872 |
6f69896f-5a86-4e32-94ff-376f6f182953 | jovanayc/tandon-bridge-2023-jovanayc | tandon_HW7/N11316951_hw7_q2.cpp | // Jovanay Carter, NetID N113169951, Bridge Winter 2023,
// Homework 7, Question 1, Feb 19, 20233
/* "Write a program that reads from the user two positive integers n, k, (assuming >=k),
and prints the value of n choose k."
*/
//formula: n! / (n-k)!*(k)!
#include <iostream>
using namespace std;
//create nFactorial ... | ALGO | 0.999809 | 5.88074 |
21648f62-2cd7-4744-95d4-63145bbb9249 | wangqiim/polardb-final | third_party/oneTBB/examples/parallel_for/tachyon/src/apigeom.cpp | /*
* api.cpp - This file contains all of the API calls that are defined for
* external driver code to use.
*/
#include "machine.hpp"
#include "types.hpp"
#include "api.hpp"
#include "macros.hpp"
#include "vector.hpp"
#define MyVNorm(a) VNorm((vector *)a)
void rt_polycylinder(void *tex, vector *points, i... | TOOL | 0.928539 | 4.539184 |
0a69d559-3c3e-4fe3-9fbc-1176888ad2bb | pranavjawale01/cp.exe | CodeForces/0339-B-Xenia and Ringroad/0339-B-Xenia and Ringroad.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define ull unsigned long long
#define vi vector<int>
#define vll vector<long long>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define all(x) x.begin(), x.end()
#define pb push_back
#define ff first
#define ... | ALGO | 0.999962 | 4.77683 |
cb3f48ab-bba7-41da-bd4d-6bb62866e4bc | Hafiz-Sakib/Competetive-Programming | Trie/(LEETCODE) Word Break.cpp | bool wordBreak(string s, unordered_set<string> &dict) {
if(dict.size()==0) return false;
vector<bool> dp(s.size()+1,false);
dp[0]=true;
for(int i=1;i<=s.size();i++)
{
for(int j=i-1;j>=0;j--)
{
if(dp[j])
{
... | ALGO | 0.999556 | 5.153256 |
2e1f37d8-f61c-4ac8-a075-bdae36740a0d | RakibAkram5/C_Language | Problem NO.10.cpp | #include <stdio.h>
int main() {
float radius;
float area;
// Prompt the user for the radius
printf("Enter the radius: ");
// Use "%f" to read a float, not "2.%f"
scanf("%f", &radius);
// Calculate the area of the circle using the formula: area = p * radius^2
area = 3.14 * radi... | ALGO | 0.938963 | 4.503153 |
5e57ce16-5a50-40ac-b727-ded8f1f0249d | MrFrenik/gs_core | third_party/include/bullet/BulletCollision/NarrowPhaseCollision/btRaycastCallback.cpp | //#include <stdio.h>
#include "BulletCollision/CollisionShapes/btConvexShape.h"
#include "BulletCollision/CollisionShapes/btTriangleShape.h"
#include "BulletCollision/NarrowPhaseCollision/btSubSimplexConvexCast.h"
#include "BulletCollision/NarrowPhaseCollision/btGjkConvexCast.h"
#include "BulletCollision/NarrowPhaseCo... | ALGO | 0.972831 | 5.766356 |
929d2d94-a258-49b5-9334-11408e175dcd | Mahudesh/Data-Structures-And-Algorithms | Binary Trees/Check For Balanced Binary Tree.cpp | class Solution{
public:
//Function to check whether a binary tree is balanced or not.
int findHeight(Node* root)
{
if(!root)
return 0;
int lh=findHeight(root->left);
int rh=findHeight(root->right);
return 1+max(lh,rh);
}
bool isBalanced(Node *root... | ALGO | 0.999969 | 6.494438 |
c68316d4-f1a9-49b7-a331-209612225e43 | ishaan0013/DSA_CPP | LeetCode/Transpose_of_matrix.cpp | #include <iostream>
#include <vector>
using namespace std;
void Transpose(vector<vector<int>> arr)
{
vector<vector<int>> ans(arr[0].size(), (vector<int>(arr.size())));
for (int i = 0; i < arr.size(); i++)
{
for (int j = 0; j < arr[0].size(); j++)
{
ans[j][i] = arr[i][j];
... | ALGO | 0.999974 | 4.694791 |
683269b3-2f17-44f1-8b1a-8650634355b7 | Cristiancj99/Cplusplus | Programacion c++/Tema 4/Factorial.cpp | #include <iostream>
#define NORMAL "\033[1;0m"
#define CYAN "\033[1;36m"
#define DEBUG "\033[1;31m"
#define YELLOW "\033[1;33m"
#define SOLUCION "\033[1;32m"
using namespace std;
/**
@brief modulo que sirve para pedir un número a un usuario y lo filtra para que sea mayor que 0
@param int n (por referencia) variable ... | ALGO | 0.999621 | 4.694845 |
85e1e75b-6698-4ffc-a262-444306697605 | Bamtau/frameworks_av | media/libstagefright/codecs/amrnb/enc/src/q_gain_p.cpp | /*
------------------------------------------------------------------------------
Pathname: ./audio/gsm-amr/c/src/q_gain_p.c
Functions: q_gain_pitch
Date: 02/04/2002
------------------------------------------------------------------------------
REVISION HISTORY
Description: Updated template used to PV codi... | ALGO | 0.998885 | 6.453278 |
f68cb412-216f-43e1-aad3-d276acd5bad3 | WilderStill/C-Programs | 洛谷/主题库/P2865 [USACO06NOV] Roadblocks G.cpp | #include<bits/stdc++.h>
#define ll long long
#define INF 0x3f3f3f3f
#define pii pair<long long,long long>
using namespace std;
struct Node
{
ll x,y;
ll pre;
}node[11451411];
struct Edge
{
ll nxt,to;
ll len;
}edge[11451411];
ll n,m,tot,ans=INF<<1,hd[11451411],dis1[11451411],dis2[11451411];
void addEdge(ll u,ll v,ll... | ALGO | 0.999945 | 4.079793 |
b3ec743d-ad03-42d2-bb97-decbb8abd9d0 | Vadenimo2k21/VicVacVoe_TicTacToe | main/main.cpp | #include <iostream>
#include <stdlib.h>
#include <time.h>
#include "cpu.h"
char field[10];
void consoleClear() {
system("cls");
//system("clear");
}
void fieldReset() {
for (int i = 0; i < 10; i++) {
field[i] = ' ';
}
}
void fieldDraw() {
consoleClear();
std::cout << "\n\n\n";
st... | TOOL | 0.882261 | 4.151011 |
df4cac4d-b339-4feb-a202-19b9e7bc7a38 | Kuldeep-Padshala/DSA | Concept030_GraphAdvanced/02-FloodFill.cpp | // LC:733 e
class Solution {
void dfs(int row, int col, vector<vector<int>>& grid, int oldColor, int newColor){
int m=grid.size();
int n=grid[0].size();
// base case: for invalid condition or
if(row<0 || col<0 || row>=m || col>=n || grid[row][col] != oldColor){
return;
}
grid[row]... | ALGO | 0.99804 | 6.442926 |
088243d3-beb4-4b38-98b2-091de2b32537 | CMPT-7ARCH-SFU/gem5-baseline | src/systemc/tests/systemc/misc/unit/data/datawidth_bool_to_signed/promote/datawidth.cpp | /*****************************************************************************
datawidth.cpp --
Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
*****************************************************************************/
/**************************************************************************... | ALGO | 0.954099 | 5.659448 |
fa30399f-34c7-449e-a71e-f37e020f341f | jmanday/Master | TFM/library/opencv-3.2.0/modules/core/src/conjugate_gradient.cpp | #include "precomp.hpp"
#define dprintf(x)
#define print_matrix(x)
namespace cv
{
double MinProblemSolver::Function::getGradientEps() const { return 1e-3; }
void MinProblemSolver::Function::getGradient(const double* x, double* grad)
{
double eps = getGradientEps();
int i, n = getDims();
... | ALGO | 0.999977 | 6.217717 |
a57df7d0-eba7-42d0-8ef0-77aeb6b5e635 | vinhhung053/UIT-ALGO-BOOTCAMP | 734/B.cpp | #include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define SET(a,x) memset((a),x,sizeof(a))
#define mod 998244353LL
#define base 311LL
#define big 500000
#define fi first
#define se second
#define mp make_pair
#define all(a) a.begin(),a.end()
#define getbit(n, i... | ALGO | 0.999961 | 4.324862 |
e373bc4f-38f4-41c6-8c75-675bfc35c67a | Prathamesh-chougale-17/Leetcode-solutions | 0783-search-in-a-binary-search-tree/0783-search-in-a-binary-search-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.999992 | 5.981719 |
e00afa74-bdb3-49c3-ba87-8f04c7150553 | p1mple07/RubiksCubeSolver | Solver.cpp | #include "CubeClass.h"
#include "Visualize.h"
#include "Scramble.h"
#include "Solve.h"
#include "readInput.h"
#include <bits/stdc++.h>
using namespace std;
int main(int argc, char* argv[]){
cube C;
// C.scramble();
C.read_input(argv[1]);
// C.visualize();
// C.L_prime();
// C.U();
// C.L(... | ALGO | 0.999787 | 4.101947 |
b4ebe636-1d3e-4a66-a0d4-5a4a2eafdae4 | pranavgurditta/Data_structures_in_C_plus_plus | scan_and_add_two_polynomials.cpp |
#include<iostream.h>
#include<conio.h>
#include<stdlib.h>
class poly
{
int exp;
int coeff;
poly *next;
public:
void input1();
void input2();
void display();
void add();
};
poly *head1,*head2,*head3;
void poly::input1() //Input for Polynomial 1
{
int degree;
cout<<endl<<"degree of d polynomial : ";
cin>>degree;
int... | ALGO | 0.980998 | 3.343857 |
9dd1208f-d7e2-4a6f-b870-1513a8c1b5ea | Joychong/CSC-514 | challenge_5.cpp | //Challenge 5
#include <iostream>
#include <string>
#include <vector>
#include <iomanip>
#include <sstream>
using namespace std;
// Convert a string to a vector of bytes
vector<uint8_t> string_to_bytes(const string& str) {
return vector<uint8_t>(str.begin(), str.end());
}
// XOR the plaintext with the repeating... | ALGO | 0.999405 | 5.20102 |
19f3429a-db0d-40ba-aff4-b96e85fb2495 | adithyay328/LeetcodeOld | 53MaxSubarray/solOne.cpp | class Solution {
public:
int maxSubArray(vector<int>& nums) {
int bestVectorSum = nums[0];
int startIndexOfCurrentVector = 0;
int endIndexOfCurrentVector = 1;
int currentVectorSum = nums[0];
for(int i = 1; i < nums.size(); i++) {
//Calculates the sum with the next element, and witho... | ALGO | 0.999931 | 6.183315 |
000f52aa-4e3a-4ffc-b1a2-278a40f33c22 | garbear/xbmc-retroplayer | lib/UnrarXLib/rijndael.cpp | /**************************************************************************
* This code is based on Szymon Stefanek AES implementation: *
* http://www.esat.kuleuven.ac.be/~rijmen/rijndael/rijndael-cpplib.tar.gz *
* *
* Dynamic table... | ALGO | 0.996469 | 4.451836 |
e25bb208-0a28-4724-a30e-ffda99a4e4cd | Zhang10000/Clearning | 借教室.cpp | 输入格式
第一行包含两个正整数n,mn,m,表示天数和订单的数量。
第二行包含nn个正整数,其中第ii个数为r_ir
i
,表示第ii天可用于租借的教室数量。
接下来有mm行,每行包含三个正整数d_j,s_j,t_jd
j
,s
j
,t
j
,表示租借的数量,租借开始、结束分别在第几天。
每行相邻的两个数之间均用一个空格隔开。天数与订单均用从11开始的整数编号。
输出格式
如果所有订单均可满足,则输出只有一行,包含一个整数00。否则(订单无法完全满足)
输出两行,第一行输出一个负整数-1−1,第二行输出需要修改订单的申请人编号。
#include<iostream>
#include<c... | ALGO | 0.999916 | 3.843638 |
ffff3168-fe6d-435c-9f30-c147b0c9b7ba | ishandutta2007/codeforces | jerry/normal/611/E.cpp | #include <bits/stdc++.h>
using namespace std;
#define ever (;;)
multiset<long long> x; long long n, a[3], _;
int main()
{
cin >> n >> a[0] >> a[1] >> a[2]; sort(a, a+3);
while (n--) { cin >> _; x.insert(_); }
if (*x.rbegin() > a[0]+a[1]+a[2]) { printf("-1\n"); return 0; }
_ = 0;
while (x.size() && *x.rbegin() > ... | ALGO | 0.999972 | 3.473301 |
e7fd95c3-2a1a-4e66-b811-779be3aceec2 | OscarOu0421/leetcode | 416.cpp | // Time Complexity: O(n * target) — where n is the number of elements, and target = total_sum / 2
// Space Complexity: O(target) — using 1D DP array to optimize space
class Solution {
public:
bool canPartition(vector<int>& nums) {
int total = 0;
// Step 1: Calculate total sum of all elements
... | ALGO | 0.999994 | 6.862864 |
025ac266-c342-4367-89f7-5438dce66783 | Janhavitripathi/c-by-codivas | recursion1.cpp | #include<bits/stdc++.h>
using namespace std;
void fun(int i,int j);
void fun (int i,int n)
{
if(i>n)
return;
cout<<i<<" ";
fun(i+1,n);
}
int main()
{ int n;
cin>>n;
fun(1,n);
return 0;
} | ALGO | 0.999747 | 3.747627 |
dd0fad76-56c9-4617-b240-fa609e19014d | SenseLogic/MYST | BOOST/boost_1_76_0/libs/geometry/doc/index/src/examples/rtree/interprocess.cpp | //[rtree_interprocess
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/point.hpp>
#include <boost/geometry/geometries/box.hpp>
#include <boost/geometry/index/rtree.hpp>
#include <boost/foreach.hpp>
#include <boost/interprocess/managed_shared_memory.hpp>
#include <boost/interprocess/allocators/alloc... | TOOL | 0.991685 | 3.959213 |
192d0c9d-b910-44e0-aaac-f407d14c28c6 | ZhiganovD/Modeling | term1/harmonic_solver.cpp | #include <iostream>
#include <vector>
double const pi = 3.14;
// Parametr of differential equation
double const omega2 = 1.0;
bool const DEBUG = 0;
struct State {
double x;
double v;
State(): x(0.0), v(0.0) {}
State(double x_, double v_) : x(x_), v(v_) {}
void set_state(double x_, double v_) {
... | ALGO | 0.999989 | 4.59824 |
56097da4-c99a-4daf-87b1-073759ce4502 | VadimDobrynin/otus-cpp-basic-05homework- | statistics/Statistics.cpp | //
// Created by vadim on 13.06.2024.
//
#include "Statistics.h"
///---------------------------------------------------------------------------------------------------------------------
void Min::update(double next){
(min_val >= next) ? min_val = next : min_val;
}
const char* Min::name() const{
return "Min... | ALGO | 0.988803 | 4.134084 |
c065325f-dd57-4f5a-92cc-da2132dda20c | 239yash/Data-Structures-And-Algos | Tree/Deserialize_binary_tree.cpp | # include<bits/stdc++.h>
using namespace std;
// Function declaration line, just below this comment.
struct node{
int key;
node * left;
node * right;
node(int x)
{
key = x;
left = NULL;
right = NULL;
}
};
const int empty = -1;
int index1 = 0;
node * de_serialize(vector... | ALGO | 0.99997 | 4.676847 |
8d8cc6af-707d-48fe-a7a5-6a43c96136e7 | DanielBrMz/TC1031 | C++/1.2/ordenamiento/OrdenaBurbuja.cpp | #include "OrdenaBurbuja.h"
#include <vector>
/* Este algoritmo tiene una complejidad de O(n^2) en tiempo y O(1) en espacio.
*
* Complejidad temporal:
* - Mejor caso: O(n)
* - Caso promedio: O(n^2)
* - Peor caso: O(n^2)
*
* Complejidad espacial:
* - Mejor caso: O(1)
* - Caso promedio: O(1)
* - Peor caso: O(... | ALGO | 0.999831 | 5.374032 |
f74d6831-c028-4209-8236-f20ad7af333e | ishandutta2007/codeforces | wenhao801/normal/949/C.cpp | #include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <vector>
using namespace std;
inline int read () {
int ret = 0, t = 1;
char c = getchar();
while ((c < '0' || c > '9') && c != '-') c = getchar();
if (c == '-') t = -1, c = getchar();
while (c >= '0' && c <= '9') ret = ret * 1... | ALGO | 0.999991 | 3.284168 |
f86b2864-f8d8-48f4-9d91-bcbec32e9a96 | gehad-Ahmed30/sheet1-alazhar-1-15 | project2/main.cpp | #include <iostream>
#include <math.h>
#include <iomanip>
using namespace std;
int main()
{
double pi= 3.141592653;
double r;
cin>>r;
cout << fixed << setprecision(9)<<pi*pow(r,2);
return 0;
}
| ALGO | 0.990928 | 3.974494 |
f208cdf8-6ae8-4e8b-a39c-1f26e4deb26d | whynesspower/leetcode | 8-string-to-integer-atoi/8-string-to-integer-atoi.cpp | class Solution {
public:
int myAtoi(string str) {
int sign = 1, base = 0, i = 0;
while (str[i] == ' ') { i++; }
if (str[i] == '-' || str[i] == '+') {
sign = 1 - 2 * (str[i++] == '-');
}
while (str[i] >= '0' && str[i] <= '9') {
if (base > INT_MAX / 10... | ALGO | 0.998134 | 5.290941 |
7b247f6f-163a-4438-b9f4-d1ed3ee1402c | kbm05/CPP202309 | challenge/midterm/tictactoe.cpp | #include <iostream>
using namespace std;
const int numCell = 3; //
char board[numCell][numCell]{}; // Ÿ 2 迭
bool isValid(int x, int y) {
bool valid = true;
if (x >= numCell || y >= numCell) {// ǥ
cout << x << "," << y << ": x y ϳ ĭ ϴ. " << endl;
valid = false;
}
else
if (board[x][y] != ' ') {// ǥ Է... | ALGO | 0.998841 | 4.311126 |
c3066561-78d6-4de7-abfc-00a4712f6f17 | amiralikaboli/Codeforces | 474D.cpp | #include <iostream>
using namespace std;
const int MOD=1000*1000*1000+7;
const int MaxN=1E5+10;
int dp[MaxN];
int main(){
int t,k;
cin >> t >> k;
for (int i=0;i<k;++i)
dp[i]=1;
for (int i=k;i<MaxN;++i){
dp[i]=dp[i-1]+dp[i-k];
dp[i]%=MOD;
}
for (int i=1;i<MaxN;++i){
dp[i]=dp[i]+dp[i-1];
dp[i]%=MOD;
}... | ALGO | 0.99993 | 4.162754 |
bce9a5a3-8a7c-4c80-8a16-65c2f6190c2c | ivangalbans/leetcode | src/0121.cpp | // https://leetcode.com/problems/best-time-to-buy-and-sell-stock/
class Solution {
public:
int maxProfit(vector<int> &prices) {
int m = prices[0];
int ans = 0;
for (int i = 1; i < prices.size(); ++i) {
ans = max(ans, prices[i] - m);
m = min(m, prices[i]);
}
return ans;
}
};
| ALGO | 0.999708 | 6.638879 |
7bdc492f-6929-4789-a33e-1705e4079c4b | LauZyHou/Algorithm-To-Practice | Utilities/Tree.cpp | //==================================================================
// ָOfferԹپͱ⡷
// ߣκ
//==================================================================
#include "Tree.h"
TreeNode* CreateTreeNode(int value) {
TreeNode* pNode = new TreeNode();
pNode->m_nValue = value;
return pNode;
}
void ConnectTreeNodes(Tr... | ALGO | 0.981739 | 4.065522 |
40fceb17-cebc-4224-8d53-307846294732 | r-karunathilake/DS_and_Algorithms | NeetCode/Blind_75/Bit_Manipulation/Q191_number_of_1_bits.cpp | /* Question 191: Number of 1 Bits
Description: Write a function that takes the binary representation of a positive integer and returns the number of
set bits it has (also known as the Hamming weight).
Constraints:
1 <= n <= 2^31 - 1
*/
#include <iostream>
#include <cassert>
clas... | ALGO | 0.999633 | 7.443315 |
123955b8-0d06-44b6-b4a8-231a6d9eb61f | ziqinXU/Leetcode | Medium/1277_Count_square_Submatrices_with_all_ones.cpp | class Solution {
public:
int countSquares(vector<vector<int>>& matrix) {
//当前为1时:边界上的为1,其余看上方和左边以及左上角dp最小值+1,所有dp相加。
vector<vector<int>> dp;
int res=0;
for(int i=0;i<matrix.size();i++)
{
vector<int> temp;
for(int j=0;j<matrix[0].size();j++)
... | ALGO | 0.999731 | 5.632399 |
4880e798-2c66-4de8-9993-898b1cd003c7 | AAlab1819/EugeneSebastian-01082170027 | Week7/file.cpp | #include <iostream>
using namespace std;
int main(){
int n,i,count=0,red=0;
cin>>n;
char x[n];
cin>>x;
for (i = 0 ; i < n ; i++){
if (x[i]=='x'){
count++;
}
else{
count = 0;
}
if (count >= 3 ) {
red++;
}
}
cout<<red;
} | ALGO | 0.999954 | 4.033779 |
9a38f439-6844-4f70-b120-692ba888cfac | GlenDC/StarEngine | StarEngine/jni/AI/Pathfinding/PathFindManager.cpp | #include "PathFindManager.h"
#include "../../Objects/Object.h"
#include "../../Components/AI/PathFindNodeComponent.h"
#include <algorithm>
namespace star
{
#ifdef STAR2D
const pos PathFindManager::NO_PATH_AVAILBLE = pos(-123456.0f, -123456.0f);
#else
const vec3 PathFindManager::NO_PATH_AVAILBLE = vec3(-123456.0f, -1... | ALGO | 0.955678 | 4.767913 |
d1c2c820-01df-411b-811a-62504923553e | Haoxiang-Hu/SortedList-LinkList | SortedList.cpp | #include "SortedList.h"
template<class T>
SortedList<T>::SortedList() {
head = nullptr;
currentPos = nullptr;
}
template<class T>
SortedList<T>::~SortedList() {
}
template<class T>
void SortedList<T>::MakeEmpty() {
NodeT* tmp = head;
while(head != nullptr) {
tmp = head;
head = head-... | TOOL | 0.991576 | 5.323577 |
680158ce-831b-4ebd-879d-1492f226a9df | PYIArun/MCA-I-SEM | C++/Assignment/Array2/TraverseMatrix.cpp | #include <iostream>
using namespace std;
// Function to traverse and print a 2-D matrix
// To: Print all elements of the given matrix
// Input:
// - int matrix[][]: 2-D matrix to be traversed
// - int rows: Number of rows in the matrix
// - int cols: Number of columns in the matrix
// Output:
// - None
// Appr... | ALGO | 0.99826 | 5.925145 |
99d8fcad-60c8-4964-9d54-0d5d27fae6dd | ishandutta2007/codeforces | zdolny_kaczor/normal/1406/B.cpp | //Konrad Paluszek,University of Warsaw(former XIV LO Staszic)
//#STAY AT HOME
#ifndef LOCAL
#pragma GCC optimize("O3")
#endif
#define TIME (chrono::steady_clock::now().time_since_epoch().count())
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define xfm(a,b)a##b
#de... | ALGO | 0.999994 | 5.19382 |
1de9d76b-32b9-4cb9-95e6-bc7e0923d6e8 | dsamot/ProjetProgMod | pricer-skel/src/pricer.cpp | #include <iostream>
#include <string>
#include <ctime>
#include "pnl/pnl_random.h"
#include "pnl/pnl_vector.h"
#include <time.h>
#include <string.h>
#include "BlackScholesModel.hpp"
#include "MonteCarlo.hpp"
#include "BasketOption.hpp"
#include "AsianOption.hpp"
#include "PerformanceOption.hpp"
#include "parser.hpp"
#... | ALGO | 0.965667 | 5.246251 |
4d22d2ff-6bac-4643-ac35-dd511c8a25db | ksungkeun84/datastructure | fds/c7/permute.cpp | #include <iostream.h>
#include <stdlib.h>
template <class KeyType>
class Element
{
public:
KeyType key;
int other;
Element(){other = 0;};
};
template <class KeyType>
void permute(Element<KeyType> *a, int n)
{
for (int i = n; i >=2; i--)
{
int j = rand() % i + 1; cout << j << endl;
Element<KeyType>... | ALGO | 0.999889 | 4.064395 |
afa8f43c-c5d6-4ce5-8785-2ed8424ccb34 | akamya997/PracticeCode | 201903_practice/2019_3/cf_544/temp.cpp | #include<bits/stdc++.h>
using namespace std;
#ifndef ONLINE_JUDGE
#define dbg(x...) do{cout << "\033[33;1m" << #x << "->" ; err(x);} while(0)
void err(){cout << "\033[39;0m" << endl;}
template<template<typename...> class T,typename t,typename... A>
void err(T<t> a,A... x){for (auto v:a) cout << v << ' '; err(x...);}
te... | ALGO | 0.999962 | 3.515192 |
d43f00a1-162a-48fc-8be9-47cd0949c22f | nikhilsourav/Data-Structures-and-Algorithms | 19. Graph/16. Feasible Relations/relations.cpp | /*
// incomplete
Question: https://urlzs.com/sDvgG
*/
#include <bits/stdc++.h>
using namespace std;
// fast io
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL)
// keywords
#define ll long long int
#define pb push_back
#define ff first
#define ss second
#define endl '\n'
// constants
#define IN... | ALGO | 0.99985 | 4.950247 |
8db5dae4-fdd0-4be8-a89f-cc1e2755a018 | nittdeniz/feynumeric | source/feynman_process.cpp | #include <omp.h>
#include <iomanip>
#include <iostream>
#include "dirac.hpp"
#include "feynman_process.hpp"
#include "feynman_diagram.hpp"
#include "format.hpp"
#include "four_vector.hpp"
#include "graph_edge.hpp"
#include "graph_vertex.hpp"
#include "integrate.hpp"
#include "particle.hpp"
#include "phase_space.hpp"
... | TOOL | 0.937776 | 5.430723 |
ec61dab9-dd24-40f0-a68a-3aa7766e4062 | RCMast3r/lab3_individual | top_optattempt.cpp | #include "dcl.h"
using A_data_stream_type = hls::stream<data_t, 1>;
using A_index_stream_type = hls::stream<index_t, 1>;
using A_ent_stream_type = hls::stream<A_entries, 1>;
using B_data_stream_type = hls::stream<data_t, 1>;
using B_index_stream_type = hls::stream<index_t, 1>;
template <typename stream_type, typena... | ALGO | 0.960592 | 3.936168 |
c41fd328-529b-4286-93e2-2d78bb9d72e8 | ThomasGysemans/adventofcode-2023 | cpp/challenge-4/main.cpp | #include <iostream>
#include <string>
#include <fstream>
#include <array>
#include <vector>
#include <regex>
#include <math.h>
#include <stdlib.h>
using namespace std;
#define N_WINNING_NUMBERS 10
#define N_PLAYER_NUMBERS 25
static const regex REGEX_CARD_NUMBERS("Card.*: (.*) \\| (.*)");
static const regex REGEX_CAR... | ALGO | 0.985424 | 4.926239 |
f5cc5fd0-9767-43aa-8a28-84ad83543d6e | armandok/pySLAM-D | Thirdparty/pyfbow/install/fbow/tests/dbow2/ScoringObject.cpp | #include <cfloat>
#include "TemplatedVocabulary.h"
#include "BowVector.h"
using namespace DBoW2;
// If you change the type of WordValue, make sure you change also the
// epsilon value (this is needed by the KL method)
const double GeneralScoring::LOG_EPS = log(DBL_EPSILON); // FLT_EPSILON
// ------------------------... | ALGO | 0.996826 | 5.906807 |
6ae6b201-e83c-40de-aed8-a1e1a5f7439a | ishandutta2007/codeforces | pyqe/normal/321/C.cpp | #include <bits/stdc++.h>
using namespace std;
long long n,rr=0,ctd,vi[100069],sbt[100069],dhh[100069],inf=1e18;
vector<long long> al[100069];
void bd(long long x)
{
long long i,sz=al[x].size(),l;
vi[x]=rr;
sbt[x]=1;
for(i=0;i<sz;i++)
{
l=al[x][i];
if(vi[l]<rr)
{
bd(l);
sbt[x]+=sbt[l];
}
}
}
vo... | ALGO | 0.999959 | 4.139623 |
bd7a08b5-6bc6-4331-9a81-469dfb2e40b4 | rmalkevy/Programming-Fundamentals | labs/2.2/main.cpp | #include <iostream>
#include <string>
enum Names { David, Tom, Andrew, Kate, Mary, Olga, Arthur};
struct Student
{
Names name;
int birthday;
int month;
};
int main() {
Student myStudent[7]{
{ David, 15, 7 },
{ Tom, 4, 1 },
{ Andrew, 19, 11},
{ Kate, 27, 4},
{ Mary, 8, 2},
{ Olga, 22, 12},
{ Arthur... | ALGO | 0.869625 | 4.066037 |
8efc99ec-4cfa-4886-8520-e99b655545d8 | GpsLypy/home | 自造轮子/sort/shell.cpp | #include <iostream>
#include <vector>
using namespace std;
void print(const vector<int>& nums){
for(auto &num : nums){
cout<<num<<" ";
}
cout<<endl;
}
/*
void shellSortCore(vector<int>& nums,int gap,int ii){
int inserted=nums[ii];
int jj;
for(jj=ii-gap;jj>=0&&nums[jj]>inserted;jj-=gap){... | ALGO | 0.999934 | 4.554237 |
2f5ec5cb-93f6-47ef-a3d1-a223fb706547 | Nerts07/IndeedGameEngine | thirdparty/glm/test/gtx/gtx_component_wise.cpp | #define GLM_ENABLE_EXPERIMENTAL
#include <glm/gtx/component_wise.hpp>
#include <glm/gtc/type_precision.hpp>
#include <glm/gtc/epsilon.hpp>
#include <glm/gtc/constants.hpp>
#include <glm/ext/scalar_relational.hpp>
#include <glm/ext/scalar_constants.hpp>
#include <limits>
namespace compNormalize
{
static int run()
{
... | TEST | 0.884653 | 5.233751 |
289e5a90-3702-40a9-9f7c-cb5bf15baf50 | F-0728/atcoder | tessoku/1/A68.cpp | #include <atcoder/all>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
using namespace std;
using namespace atcoder;
// using mint = modint1000000007;
using mint = modint998244353;
using ll = long long;
const ll inf = 1 << 30;
const ll INF = 1LL << 60;
#define rep(i, n) for (ll i ... | ALGO | 0.999958 | 5.114896 |
cb5ca52f-13bc-42c9-b608-744003b1793d | arandilme/Codeforces | 509A - Maximum in Table.cpp | /*
* 509A - Maximum in Table.cpp
* http://codeforces.com/problemset/problem/509/A
* Created on: Jan 26, 2018
* Author: athena
* 34558545 509A - 18 GNU C++14 Accepted 15 ms 1852 KB 2018-01-26 00:31:12 2018-01-26 00:31:12
*/
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
i... | ALGO | 0.999953 | 4.491745 |
aebf37fb-857e-4d51-b8a9-ae79c5e837b0 | arash16/prayers | UVA/vol-102/10219-memo.cpp | /*
>>~~ UVa Online Judge ACM Problem Solution ~~<<
ID: 10219
Name: Find the ways !
Problem: https://onlinejudge.org/external/102/10219.pdf
Language: C++
Author: Arash Shakery
Email: <EMAIL>
*/
#include <math.h>
#include <stdio.h>
#include <iostream>
using namespace std;
#define MAX 21000647
int l = 2;... | ALGO | 0.999738 | 4.063673 |
2197281d-1899-48dc-bb19-07fc35ddb46a | sogapalag/problems | atcoder/jsc2019qual_b.cpp | #include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007; // 998244353; // 998244853;
template <typename T>
struct modular {
constexpr modular() : val(0){}
constexpr modular(const modular<T>& _m) : val(_m.val) {}
template <typename U> constexpr modular(const U& _r = U()) {
val = -... | ALGO | 0.999966 | 5.092427 |
b6623bd8-73f8-4b37-933f-a735494a6331 | luckynoob/Leetcode | subset.cpp | #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
class Play {
public:
vector<vector<int> > subsets(vector<int> &S) {
sort(S.begin(), S.end());
vector<vector<int> > v(1);
for(int i = 0; i < S.size(); ++i) {
int j = v.size();
while(j-- > 0) ... | ALGO | 0.999986 | 4.833332 |
035774ef-ba3b-4841-9636-053f313014f1 | rohit02rsk/Leet-Codes | 2837-minimum-operations-to-make-the-integer-zero/2837-minimum-operations-to-make-the-integer-zero.cpp | class Solution {
public:
int countBits(long long num) {
int count = 0;
while (num > 0) {
count += num & 1;
num >>= 1;
}
return count;
}
int makeTheIntegerZero(int num1, int num2) {
if (num1 < num2) return -1;
for (int i=0; i<=100... | ALGO | 0.99996 | 5.066648 |
cebc3b07-d54b-4eba-b210-4a69a87e4400 | lutilipe/College | PDS2/OO/1/main.cpp | #include <iostream>
#include <string>
#include "ContadorDePalavras.hpp"
using std::cin;
using std::cin;
int main() {
ContadorDePalavras contador;
string s;
cin >> s;
while (s != ".") {
contador.Adicionar(s);
cin >> s;
}
contador.ImprimirOrdenado();
return 0;
} | ALGO | 0.943601 | 5.01889 |
2af8ad71-b903-44c5-b108-d78c44200b8e | palcu/algo | OldDrive/C\Users\Alex\Documents\Algoritm\Rosu\Struct Prop\39.CPP | #include <iostream.h>
#include <math.h>
void main()
{
int n,i=3,nr=1,d,rad,prim;
cin>>n;
cout<<"2 "; n--;
while (nr!=n)
{
rad=sqrt(i); prim=1;
for (d=3; d<=rad && i%d!=0; d+=2);
if (i%d==0)
prim=0;
if (prim==1)
{
cout<<i<<" ";
nr++;
}
i+=2;
}
} | ALGO | 0.999862 | 3.355144 |
96166aa6-0969-42ee-8917-f91d41983109 | BibhuDev/Cpp__DSA | cpp_basics/returnMax.cpp | #include<iostream>
using namespace std;
inline int findMax(int a, int b, int c){
int max;
if(a>b){
if(a>c)
max=a;
else
max=c;
}
else{
if(b>c)
max=b;
else
max=c;
}
return... | ALGO | 0.999367 | 4.172632 |
8c1ef8a6-0e0a-4e00-99bb-74167ae56636 | KirillBaboshko/Class-map | Class map/Class Map.cpp | #include <iostream>
#include <map>
#include <vector>
using namespace std;
//Библиотека map
//
//Класс map поддерживает поддерживает ассоциативный
//контейнер, в котором уникальным ключам соответствуют определённые значения.Спецификация его шаблона
//имеет следующий вид :
//
//template <class Key, class T, class Comp... | ALGO | 0.999022 | 4.828141 |
891beb68-af85-4b70-9260-d8b08dcc4550 | anushkajkale/ads | 18_19_20_21.cpp | // 18. Consider the page reference string as 7,1,0,2,0,3,0,4,2, 3, 0, 3, 2, 1, 2, 0, 1, 7, 0, 1 with 3-page frames. Find the total number of page faults using following page replacement algorithms:
// a. First In First Out
// b. Optimal
// c.lru
// d.clock
#include <iostream>
#include <vector>
#include <unordered_set... | ALGO | 0.999922 | 6.487957 |
1e200580-01c9-43ab-b971-1f750ee1b788 | Boganabi/CSE6400 | Lab2/Lab2.cpp |
// reads in file input and finds optimal move, then outputs to text file
#include <iostream>
#include <string>
#include <vector>
#include "Lab2FileManip.h"
#include "SearchAgents.h"
using namespace std;
int main(){
string mode; // either minimax or alpha/beta
char player; // either "x" or "o"
int depth;... | ALGO | 0.996566 | 5.185387 |
dfaa1790-9652-4721-9703-80551a6bc656 | jigjnasu/kattis | problems/register.cpp | /*
Kattis.com
Problem Primary Register.
Solution by Rakesh Kumar, cpp.rakesh(at)gmail.com
Date: 02/05/2017
*/
#include <cstdio>
#include <vector>
const std::vector<int> R = {2, 3, 5, 7, 11, 13, 17, 19};
int main() {
int t = 0;
int r = 1;
for (std::size_t i = 0; i < R.size(); ++i) {
int ... | ALGO | 0.999353 | 3.893149 |
634fc659-e3da-4551-8aa0-b1020133c125 | Ryuk0010/Pratice_problems | 65-valid-number/valid-number.cpp | class Solution {
public:
bool isNumber(string s) {
bool digit=false,dot=false,seene=false;
int count=0;
for(int i=0;i<s.size();i++){
char ch=s[i];
if(isdigit(ch)==true)digit=true;
else if(ch=='+' || ch=='-'){
if(count==2)return false;
... | ALGO | 0.998916 | 5.613106 |
309f83b3-f5d6-44dd-b600-b4da81aa21c1 | lugnitdgp/codecracker_sharif | assignments/assignment_6/p1/aayushagarwal/submission_12.cpp | /* Name- Aayush Agarwal
Language -C++
*/
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <climits>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <list>
#include <deque>
#include <stack>
#include <iterator>
#include ... | ALGO | 0.999156 | 3.283737 |
b16d5202-7761-4403-92f5-344abcbfb44f | esaule/proc_gen | proc.cpp | #include <iostream>
#include <cstdint>
#include <math.h>
#include <random>
std::default_random_engine generator;
void genblock(int64_t i, int64_t j, int64_t sx, int64_t sy, int64_t worldID) {
float dist_to_center = sqrt((i-sx/2.)/sx * (i-sx/2.)/sx + (j-sy/2.)/sy * (j-sy/2.)/sy);
float density = 0;
if (dist_to_c... | TOOL | 0.992794 | 3.621341 |
f2b38779-9710-49b4-a88e-9a925e151651 | danielnam0801/Algorithm | 100Joon/DP(Dynamic Programming)/DP(Dynamic Programming)/2747.cpp | #include<iostream>
using namespace std;
int arr[46] = { 1, 1};
void Fibonachi() {
for (int i = 2; i < 45; i++) {
arr[i] = arr[i - 1] + arr[i - 2];
}
}
int main() {
int i = 0;
cin >> i;
Fibonachi();
cout << arr[i-1];
} | ALGO | 0.999926 | 3.554638 |
657171c3-6f4f-491f-b0a0-844e5eca6ae5 | jain2308/SOC | soc cp/week2/ilyandmatrix.cpp | #include "bits/stdc++.h"
using namespace std;
// Typedefs and macros
#define ll long long
#define pb push_back
#define mp make_pair
#define all(v) v.begin(), v.end()
#define endl '\n'
#define rep(i, a, b) for (int i = a; i < b; ++i)
#define in(v,n) rep(i, 0, n) { cin >> v[i]; }
#define out(v,n) rep(i, 0, n) { cout << ... | ALGO | 0.999846 | 4.010623 |
ad5dc984-f52d-42e5-af91-8aa32958f167 | eumaludf/Programacao_Estruturada | Aula de Revisão - Estutos para a prova/Aula11Ex2/main.cpp | #include <iostream>
using namespace std;
int maior(int, int);
int main()
{
int a, b;
cout << "Digite o primeiro nmero: ";
cin >> a;
cout << "Digite o segundo nmero: ";
cin >> b;
cout << "O maior nmero : " << maior(a,b);
return 0;
}
maior(int y, int z){
int maior = 0;
if (y>z)... | ALGO | 0.990138 | 3.892777 |
87199e9b-b9fd-4d6a-8662-c5a240bde0c1 | Manoranjanhere/LEETCODE-PRACTICE | 1819-construct-the-lexicographically-largest-valid-sequence/1819-construct-the-lexicographically-largest-valid-sequence.cpp | class Solution {
public:
vector<int> constructDistancedSequence(int targetNumber) {
// Initialize the result sequence with size 2*n - 1 filled with 0s
vector<int> resultSequence(targetNumber * 2 - 1, 0);
// Keep track of which numbers are already placed in the sequence
vector<bool> ... | ALGO | 0.999993 | 6.321035 |
59c9758d-3bf0-4f02-88cb-40963fcd72fa | ishandutta2007/codeforces | maximumshot/normal/311/A.cpp | #include <bits/stdc++.h>
using namespace std;
#define vec vector
#define ALL(x) (x).begin(), (x).end()
#define mp make_pair
typedef pair< int , int > pii;
typedef long long ll;
int const inf = 1000 * 1000 * 1000;
ll const inf64 = 1ll * inf * inf;
bool solve() {
int n, k;
cin >> n >> k;
if(n * (n - 1... | ALGO | 0.999963 | 3.143038 |
45e6170b-c27b-4f06-9235-1bd71599d777 | AnkitRajCode/MyCodes | ApniKasha/Recursion/SubStringASCIInumber.cpp | //Generate substrings with ASCII code
#include<iostream>
using namespace std;
void subseq(string s, string ans){
if(s.length() == 0){ //base case
cout<<ans<<endl;
return;
}
char ch =s[0];
int code = ch;
string ros = s.substr(1);
subseq(ros,ans);
subseq(ros,ans+ch);
... | ALGO | 0.999914 | 4.164623 |
128c059f-052e-423d-8ba9-15f71bd1e7bf | saifulalam1324/CP | learning 66.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int t,x,y;
cin>>t;
while(t--)
{
cin>>x>>y;
if(x>y)
{
cout<<y<<" "<<x<<endl;
}
else if(y>x){
cout<<x<<" "<<y<<endl;
}
else if(x==y)
{
cout<<x<<" "<... | ALGO | 0.999873 | 3.894053 |
f57285a2-bd0d-46a1-b993-41bd314cc29d | MehrajShakil/Solving-problem-in-different-OJ | SPOJ/AMR11E - Distinct Primes.cpp |
// BISMILLAHIR RAHMANIR RAHEEM
// ALLAH IS WATCHING ME
// ALLAH save us from COVID-19.Amin.
//█▀█─█──█──█▀█─█─█
//█▄█─█──█──█▄█─█▄█
//█─█─█▄─█▄─█─█─█─█
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 1e5+1;
bitset<MAXN> bs;
vector<int> primediv(MAXN,0),lucky;
void sieve()
{
bs.set();
bs[0]=b... | ALGO | 0.999917 | 4.656018 |
37f3b42b-8ac4-4ac1-b25a-05bd75aa2f42 | mpzadmin/yuc | MPZ/Training/test41.cpp | #include <iostream>
#include <iomanip>
using namespace std;
int main()
{
float number = 100;
float average = number/3;
cout << average << endl;
cout << setprecision(3) << average << endl; // 33.3
cout << fixed;
cout << setprecision(3) << average << endl; // 33.333
cout << defaultf... | ALGO | 0.95069 | 3.845104 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.