text
stringlengths
59
71.4k
#include <bits/stdc++.h> using namespace std; inline int in() { int32_t x; scanf( %d , &x); return x; } inline long long lin() { long long x; scanf( %lld , &x); return x; } const int maxn = 2e5 + 10; const int mod = 1e9 + 7; const long long infll = 1e18; const int inf = 1e9; ...
#include <bits/stdc++.h> using namespace std; const long long int N = 1e6 + 3; signed main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); long long int t; cin >> t; while (t--) { long long int n, m; cin >> n; long long int a[n + 1]; long long int i =...
#include <bits/stdc++.h> const int long long N = 10e8 + 7; using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int t; cin >> t; while (t--) { int n; cin >> n; int arr[n]; vector<int> odd, even; for (int i = 0; i < n; i+...
#include <bits/stdc++.h> using namespace std; using ll = long long; using vi = vector<int>; using vvi = vector<vi>; using pii = pair<int, int>; constexpr auto MOD = 1000000007LL; constexpr auto LINF = (1LL << 60); constexpr auto INF = 2147483647LL; constexpr auto PI = 3.1415926535897932384626433; co...
// (C) 2001-2016 Altera Corporation. All rights reserved. // Your use of Altera Corporation's design tools, logic functions and other // software and tools, and its AMPP partner logic functions, and any output // files any of the foregoing (including device programming or simulation // files), and any associated doc...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; const int P = 998244353; int add(int a, int b) { if ((a += b) >= P) a -= P; return a < 0 ? a + P : a; } int mul(int a, int b) { return 1ll * a * b % P; } int kpow(int a, int b) { int r = 1; for (; b; b >>= 1, a = mul(a, a)) { if (b & 1) r =...
/* * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law...
#include <bits/stdc++.h> using namespace std; long long n, m, ans, u, v, start; string opz; int vis[2][200005]; vector<int> grafo[2][200005]; void dfs(int nodo, int mode) { vis[mode][nodo] = 1; for (auto i : grafo[mode][nodo]) { if (vis[mode][i] == 1) { cout << -1 n ; exit(0);...
`timescale 1ns/1ns module mii_mgmt #(parameter CLK_MHZ=0, parameter MDC_KHZ=2500) (input clk, input [0:4] phyad, input [0:4] addr, input [15:0] wdata, output [15:0] rdata, input req, input we, output ack, output mdc, inout mdio); // IEEE 802.3-2008 section 22.2.2.11 says mdc mu...
/*============================================================================ This Verilog source file is part of the Berkeley HardFloat IEEE Floating-Point Arithmetic Package, Release 1, by John R. Hauser. Copyright 2019 The Regents of the University of California. All rights reserved. Redistribution an...
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; const double esp = 1e-8; const int msz = 100000; const int mod = 2015; struct Child { int v, d; long long p; }; Child c[4444]; bool vis[4444]; queue<int> q; int n; void cut(int id) { long long v = c[id].v + 1; ...
#include <bits/stdc++.h> using namespace std; template <class T> inline bool read(T &x) { int c = getchar(); int sgn = 1; while (~c && c< 0 | c> 9 ) { if (c == - ) sgn = -1; c = getchar(); } for (x = 0; ~c && 0 <= c && c <= 9 ; c = getchar()) x = x * 10 + c - 0 ; x *= sg...
// bug981 module a( parameter AUM=80; parameter BUM=70; parameter VUM=1; parameter V2=2; input my_data_z; input my_data_v[VUM]; input my_data_vv[VUM][V2]; input [AUM-1:0] my_data_av...
// Issue-Execute Pipeline Register module ex_pipe_reg ( input wire clk, input wire reset, input wire clr, input wire valid_ex_pipe_reg_i, input wire[5:0] op_ex_pipe_reg_i, input wire jump_ex_pipe_reg_i, input ...
#include <bits/stdc++.h> using namespace std; mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count()); const long long inf = 1e15 + 7; bool check(long long n) { return __builtin_popcount(n + 1) == 1; } vector<long long> res; bool solve(long long n, long long k, long long par) { if (...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); int t; cin >> t; for (int tc=1; tc<=t; tc++) { int n, x; cin >> n >> x; vector<int> v(n); for (int i=0; i<n; i++) { cin >> v[i]; } ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; void solve() { int a, b, k; cin >> a >> b >> k; vector<int> A(k); vector<int> B(k); vector<int> cA(a + 1); vector<int> cB(b + 1); ll ans = 0; for (int i = 0; i < k; i++) { cin >> A[i]; ...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; long long dp[100000 + 25]; struct node { int iz, der; long long tiempo; node() {} node(long long t, int i, int d) { tiempo = t; iz = i; der = d; } }; struct otro { int proct, pos; long long tiemp; otro() {} otr...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; bitset<20> a; vector<int> w; int sol = 0; void verific(int &l, int &r, int &x) { int sum = 0, i, minim = INT_MAX, maxim = INT_MIN; for (i = 0; i < w.size(); ++i) { if (a[i]) { sum += w[i]; minim = min(minim, w[i]); maxim = max...
/* * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law...
#include <bits/stdc++.h> using namespace std; int row[] = {0, 1, 0, -1, -1, -1, 1, 1}; int col[] = {1, 0, -1, 0, 1, -1, -1, 1}; const long long N = 2e5 + 10; const long long M = 1e18 + 7; const long long H = 1e9 + 7; const long long base = 131; long long logx(long long a, long long bs) { return log(a) /...
/*------------------------------------------------------------------------------ * This code was generated by Spiral Multiplier Block Generator, www.spiral.net * Copyright (c) 2006, Carnegie Mellon University * All rights reserved. * The code is distributed under a BSD style license * (see http://www.opensource.or...
/* * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law...
// (c) Copyright 1995-2014 Xilinx, Inc. All rights reserved. // // This file contains confidential and proprietary information // of Xilinx, Inc. and is protected under U.S. and // international copyright and other intellectual property // laws. // // DISCLAIMER // This disclaimer is not a license and does not grant ...
// ========== Copyright Header Begin ========================================== // // OpenSPARC T1 Processor File: bw_io_dtl_bscl2.v // Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved. // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES. // // The above named program is free software; you can redistribute it a...
#include <bits/stdc++.h> using namespace std; int main() { int n, i, s = 0, s2 = 0; cin >> n; char a[n]; cin >> a; for (i = 0; i < n; i++) { if (a[i] == 0 ) s++; else s2++; } if (s2 > 0) cout << 1 ; while (s--) cout << 0 ; return 0; }
// DESCRIPTION: Verilator: System Verilog test of a complete CPU // // This code instantiates and runs a simple CPU written in System Verilog. // // This file ONLY is placed into the Public Domain, for any use, without // warranty. // Contributed 2012 by M W Lund, Atmel Corporation and Jeremy Bennett, Embecosm. modu...
// +---------------------------------------------------------------------------- // GNU General Public License // ----------------------------------------------------------------------------- // This file is part of uDLX (micro-DeLuX) soft IP-core. // // uDLX is free soft IP-core: you can redistribute it and/or modify ...
`timescale 1 ns / 1 ps module sample_generator_v1_0 # ( // Users to add parameters here // User parameters ends // Do not modify the parameters beyond this line // Parameters of Axi Slave Bus Interface S_AXIS parameter integer C_S_AXIS_TDATA_WIDTH = 32, // Parameters of Axi Master Bus Interface M_AX...
`ifndef _control `define _control `define BRANCH_BEQ 0 `define BRANCH_BNE 1 module control( input wire [5:0] opcode, output wire regdst, memread, memtoreg, output wire [1:0] branch, output wire [1:0] aluop, output wire memwrite, alusrc, regwrite); reg oc_lw, oc_addi, oc_beq, oc_sw, oc_bne, oc_add; a...
#include <bits/stdc++.h> using namespace std; vector<vector<int>> segT; vector<int> lazy; long long n, m, l, r; string s; void buildT(int ss, int se, int si) { if (ss == se) { if (s[ss] == 4 ) segT[si][0] = 1; else segT[si][1] = 1; segT[si][2] = 1; segT[si][3] = ...
#include <bits/stdc++.h> using namespace std; const int V = 100100; int l[V], r[V], a[V], ret, n; int main() { while (~scanf( %d , &n)) { ret = 0; for (int i = 1; i <= n; i++) scanf( %d , &a[i]); for (int i = 1; i <= n; i++) l[i] = r[i] = i; for (int i = 1; i <= n; i++) { whi...
// This file has been automatically generated by goFB and should not be edited by hand // Compiler written by Hammond Pearce and available at github.com/kiwih/goFB // Verilog support is EXPERIMENTAL ONLY // This file represents the Basic Function Block for BfbSetterResetter //defines for state names used internally `...
// ------------------------------------------------------------- // // File Name: hdl_prj\hdlsrc\controllerPeripheralHdlAdi\controllerHdl\controllerHdl_Rotor_To_Electical_Velocity.v // Created: 2014-09-08 14:12:04 // // Generated by MATLAB 8.2 and HDL Coder 3.3 // // -------------------------------------------------...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { long long a, b, c; cin >> a >> b >> c; if (a < c) cout << 1 << ; else cout << -1 << ; if (c < a * b) cout << b << endl; else cout << -1 << e...
#include <bits/stdc++.h> using namespace std; string ar; string br; int n = 0, lst = 0, lstmin = 0, lp = 0, lpc = 0; int gzg = 0, rzg = 0, gzy2 = 0, rzy2 = 0; int gzf = 0, gzc = 0, rzf = 0, rzc = 0; int gzcc = 0, rzff = 0; int main() { int f = 0; cin >> n; ar.reserve(n + 1); br.reserve(n...
// (C) 2001-2013 Altera Corporation. All rights reserved. // Your use of Altera Corporation's design tools, logic functions and other // software and tools, and its AMPP partner logic functions, and any output // files any of the foregoing (including device programming or simulation // files), and any associated doc...
#include <bits/stdc++.h> using namespace std; const int maxn = 59; const long long mod = 998244353; int add[maxn]; long long w[maxn]; long long dp[52][52][52]; long long val[52][52][52]; bool vis[52][52][52]; long long Pow(long long a, long long b) { long long res = 1; a %= mod; while (b) ...
// Accellera Standard V2.5 Open Verification Library (OVL). // Accellera Copyright (c) 2005-2010. All rights reserved. `include "std_ovl_defines.h" `module ovl_quiescent_state (clock, reset, enable, state_expr, check_value, sample_event, fire); parameter severity_level = `OVL_SEVERITY_DEFAULT; parameter width ...
module test (); parameter param = 3; reg [2:0] dummy; initial dummy = block.f(0); generate case (param) 1, 2: if (param==1) begin : block function [2:0] f; input i; begin $display ("if param==1"); f = param; ...
#include <bits/stdc++.h> using namespace std; using ll = long long; template <class t, class u> void chmax(t& first, u second) { if (first < second) first = second; } template <class t, class u> void chmin(t& first, u second) { if (second < first) first = second; } template <class t> using v...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; int x[55][55], a, b, n, m; int solve() { int res = 1000000000; for (int _n((n - a + 1) - 1), i(0); i <= _n; i++) for (int _n((m - b + 1) - 1), j(0); j <= _n; j++) { int cnt = 0; for (int _n((a)-1), k(0); k <= _n; k++) for (int _...
/* * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law...
#include <bits/stdc++.h> using namespace std; const double PI = 3.141592653589793238; long long powmod(long long a, long long b) { long long res = 1; a %= 1000000007; for (; b; b >>= 1) { if (b & 1) res = res * a % 1000000007; a = a * a % 1000000007; } return res; } char str[20...
#include <bits/stdc++.h> using namespace std; const int maxn = (int)(2e6 + 123); const int R = (int)(2e6); const long long inf = (long long)(1e12 + 7); long long pn, p[maxn], lp[maxn], b[maxn]; bool u[maxn]; void resheto(long long n) { for (long long i = 3; i * i <= n; i += 2) if (!u[i]) ...
#include <bits/stdc++.h> using namespace std; int a[20002][11] = {0}; int b[20002] = {0}; int c[11] = {0}; int main() { int n, m, k; cin >> n >> m >> k; for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) scanf( %d , &a[i][j]); for (int i = 0; i < k; i++) { int x, y; cin ...
#include <bits/stdc++.h> using namespace std; const int inf = 2000000000; int H, T, R, m, hi[205], ti[205], n, hj[205], tj[205], h[205][205], t[3000000][3], w, d[205][205]; void adde(int x, int y, int X, int Y) { t[w][0] = X; t[w][1] = Y; t[w][2] = h[x][y]; h[x][y] = w++; } struct node...
// (C) 2001-2017 Intel Corporation. All rights reserved. // Your use of Intel Corporation's design tools, logic functions and other // software and tools, and its AMPP partner logic functions, and any output // files from any of the foregoing (including device programming or simulation // files), and any associated ...
/////////////////////////////////////////////////////////////////////////////// // Copyright (c) 1995/2009 Xilinx, Inc. // All Right Reserved. /////////////////////////////////////////////////////////////////////////////// // ____ ____ // / /\/ / // /___/ \ / Vendor : Xilinx // \ \ \/ Version : 11....
#include <bits/stdc++.h> const long long mod = 1e9 + 7; using namespace std; long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); } long long n, m; vector<long long> a, b, v, pat; long long cal() { v.clear(); for (long long i = 1; i < m; i++) v.push_back(a[i]); v.push_bac...
#include <bits/stdc++.h> using namespace std; const int mxN = 1e5; int n; string ans; int kmp(string s) { vector<int> pf(s.size()); for (int j = 1; j < s.size(); ++j) { int k = pf[j - 1]; while (s[k] != s[j]) { if (!k) { k = -1; break; } k = pf[k...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 21:01:56 04/23/2017 // Design Name: decrypt // Module Name: C:/Users/vkoro/Final_Project/project/des/DES/decrypt_tb.v // Project Name: DES // Target Device: // Too...
#include <bits/stdc++.h> using namespace std; vector<long long int> vec; bool sortbysec(const pair<int, int> &a, const pair<int, int> &b) { return (a.second < b.second); } long long int mark[123]; int main() { std::ios::sync_with_stdio(false); string str; cin >> str; long long int n; ...
/* * Milkymist SoC * Copyright (C) 2007, 2008, 2009, 2010 Sebastien Bourdeauducq * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, version 3 of the License. * * This program is distribut...
#include <bits/stdc++.h> using namespace std; int main() { int n, a, b, x, res = 0, c = 0; cin >> n >> a >> b; for (int i = 0; i < n; i++) { cin >> x; if (x == 1) { if (a > 0) a--; else if (b > 0) { c++; b--; } else if (c > 0) c...
/* * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law...
#include <bits/stdc++.h> using namespace std; const int MAXN = 1000000 + 10; long long a[MAXN]; long long b[MAXN]; void add(long long k, long long val, int start, int end) { if (start > end) return; a[start] += k; a[end + 1] -= k; long long bias = val - start * k; b[start] += bias; b[e...
#include <bits/stdc++.h> using namespace std; int main() { long k, m; string s; vector<int> rooms; cin >> k >> m; cin >> s; for (int i = 0; i < s.length(); i++) { if (s[i] == 0 ) { rooms.push_back(i); } } long select = k; k = 0; while (k + m < rooms.size(...
/* Copyright 2015 TREVOR DAVID BLACK * buffer.v * buffer is designed to take the nibbles being sent from hf_decompression * taking these nibbles and valids, it will then construct a buffer * This buffer will shift out one bit at a time * The problem with this implementation is that the buffer can fill up * T...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
/* * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law...
`define STATE_INIT 2'b00 `define STATE_W_FETCH 2'b01 `define STATE_END 2'b10 module FETCH( input clk, input f_enable, input write_mode, input [31:0] addr, input [31:0] data_i, input [1:0] thread, output reg [31:0] data_o, output reg ack, input W_CLK, input W_ACK, input [31:0] W_DATA_I, outpu...
#include <bits/stdc++.h> using namespace std; int main() { long int n, a, b, i = 0, cnt = 0, y; cin >> n >> a >> b; while (n >= 0) { if (i == 0) { n = n; } else { n = n - a; } if (n % b == 0 && n >= 0) { y = n / b; cnt++; break; } ...
#include <bits/stdc++.h> using namespace std; const int N = 2000100; const int inf = 1000000007; int dp[N][2], n, m[2], t, tot = 0, g[N][2], path[N], ans[N]; struct nd { int d, id; } a[N][2]; struct element { int d, id[2]; } b[N]; struct point { int x, y; } po[N]; inline int read() { ...
#include <bits/stdc++.h> using namespace std; class qry { public: int l, r, idx; qry(int l, int r, int idx) : l(l), r(r), idx(idx) {} }; int a[500001], n, m, res[500001]; vector<qry> q; int getans(vector<int> b) { int res = 0; for (int i = 0; i < b.size(); i++) { if ((res ^ b[i]) > ...
#include <bits/stdc++.h> using namespace std; constexpr int maxn = 2e5 + 100; int n, val[maxn]; void solve() { scanf( %d , &n); for (int i = 0; i < n; i++) scanf( %d , val + i); set<int> s; for (int i = 0; i < n; i++) s.insert((((i + val[i]) % n) + n) % n); puts((s.size() == n) ? YES : NO...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int n, k; cin >> n >> k; set<long long> myset; for (int i = 0; i < n; i++) { int c; cin >> c; myset.insert(c); } auto it = myset.begin(); int ans = 0; ...
#include <bits/stdc++.h> int max(int x, int y) { return (x > y ? x : y); } int geGcd(int a, int b) { if (a == 0 || b == 0) return 0; for (int i = max(a, b); i >= 1; i--) if (a % i == 0 && b % i == 0) return i; } using namespace std; int main() { int a, b, n; cin >> a >> b >> n; int c...
module demo_sound1( input clock, output [7:0]key_code, input k_tr ); reg [15:0]tmp; wire[15:0]tmpa; reg tr; reg [15:0]step; wire[15:0]step_r; reg [15:0]TT; reg[5:0]st; reg go_end; ////////Music-processing//////// always @(negedge k_tr or posedge clock) begin if (!k_tr) begin step=0; st=0; ...
#include <bits/stdc++.h> using namespace std; const int N = 25; int main() { int n, m, l, r, t, c; cin >> n >> m; pair<int, int> s[n + 1]; for (int i = (1), _b = (n + 1); i < (_b); ++i) s[i] = make_pair(0, 0); for (int i = (0), _b = (m); i < (_b); ++i) { cin >> l >> r >> t >> c; fo...
// This file is part of www.nand2tetris.org // and the book "The Elements of Computing Systems" // by Nisan and Schocken, MIT Press. // File name: projects/05/Memory.hdl /** * The complete address space of the Hack computer's memory, * including RAM and memory-mapped I/O. * The chip facilitates read and wr...
//Legal Notice: (C)2011 Altera Corporation. All rights reserved. Your //use of Altera Corporation's design tools, logic functions and other //software and tools, and its AMPP partner logic functions, and any //output files any of the foregoing (including device programming or //simulation files), and any associated do...
// // Copyright (c) 1999 Steven Wilson () // // This source code is free software; you can redistribute it // and/or modify it in source code form under the terms of the GNU // General Public License as published by the Free Software // Foundation; either version 2 of the License, or (at your option) // ...
#include <bits/stdc++.h> using namespace std; const int NUM = 2e5 + 10; struct node { int index, q; bool operator<(const node &a) const { return index + q < a.index + a.q; } } no[NUM]; int main() { int n; scanf( %d , &n); for (int i = 0; i < n; i++) scanf( %d%d , &no[i].index, &no[i].q); ...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 2014/05/23 15:11:30 // Design Name: // Module Name: ov7725_capture // Project Name: // Target Devices: // Tool Versions: // Description: // // Dependencies: // /...
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; const double PI = acos(-1.0); const double E = exp(1); const int N = 1e5 + 5; int n; map<long long, long long> m; int main(void) { ios_base::sync_with_stdio(false); cin >> n; for (int i = 0; i < n; i++) { long lo...
#include <bits/stdc++.h> using namespace std; map<long long int, vector<long long int>> v; map<long long int, long long int> vis; void dfs(long long int n) { long long int i; cout << n << ; vis[n] = 1; for (i = 0; i < v[n].size(); i++) { if (!vis[v[n][i]]) { vis[v[n][i]] = 1; ...
/****************************************************************************** Online C++ Compiler. Code, Compile, Run and Debug C++ program online. Write your code in this editor and press Run button to compile and execute it. ******************************...
//----------------------------------------------------------------------------- // The way that we connect things in low-frequency read mode. In this case // we are generating the unmodulated low frequency carrier. // The A/D samples at that same rate and the result is serialized. // // Jonathan Westhues, April 2006 //...
#include <bits/stdc++.h> using namespace std; vector<pair<int, int> > changes; vector<int> norm(vector<int> x) { int i = -1; for (int bit = 30; bit >= 0; bit--) { for (int pos = i + 1; pos < x.size(); pos++) if (x[pos] & (1 << bit)) { if (pos != ++i) { changes.push_back...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 08/27/2016 10:10:41 PM // Design Name: // Module Name: KOA // Project Name: // Target Devices: // Tool Versions: // Description: // // Dependencies: // // Revisi...
#include <bits/stdc++.h> using namespace std; map<pair<long long, long long>, long long> ma; void put(long long u, long long v, long long w) { while (v != u) { long long par; if (v > u) { par = v / 2; ma[make_pair(par, v)] += w; ma[make_pair(v, par)] += w; v /= 2; ...
// ============================================================== // File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC // Version: 2017.4 // Copyright (C) 1986-2017 Xilinx, Inc. All Rights Reserved. // // ============================================================== `timescale 1ns/1ps m...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
module rc_pcs_pipe_top ( input wire refclkp, input wire refclkn, input wire RESET_n, input wire ffc_quad_rst, input wire [1:0] PowerDown, input wire TxDetectRx_Loopback, output wire PCLK, output wire PCLK_by_2, output reg PhyStatus, output w...
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; vector<int> balance(n, 0); for (int i = 0; i < m; i++) { int a, b, c; cin >> a >> b >> c; balance[a - 1] -= c; balance[b - 1] += c; } int total = 0; for (int i = 0; i < n; i++) { ...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: Adam LLC // Engineer: Adam Michael // Date: October 15, 2015 // Summary: The top level module for Phase 1 ////////////////////////////////////////////////////////////////////////////////// module la...
#include <bits/stdc++.h> long long MOD = 1000000007; long long C[2000 + 200][2000 + 200]; int pos = 0; bool notfree[2000 + 200]; int n; void combin() { C[0][0] = 1; for (int i = 1; i <= 2000; i++) { C[0][i] = 1; C[i][i] = 1; for (int j = 1; j < i; j++) C[j][i] = (C[j][i - 1] + C[j ...
//############################################################################# //# Function: Dual Ported Memory # //############################################################################# //# Author: Andreas Olofsson # ...
/*------------------------------------------------------------------------------ * This code was generated by Spiral Multiplier Block Generator, www.spiral.net * Copyright (c) 2006, Carnegie Mellon University * All rights reserved. * The code is distributed under a BSD style license * (see http://www.opensource.or...
#include <bits/stdc++.h> using namespace std; bool is[1000001 + 1]; long long int g1(long long int x, long long int y) { long long int res = 1; x = x; while (y > 0) { if (y & 1) res = (res * x); y = y >> 1; x = (x * x); } return res; } long long int g(long long int x, lon...
#include <bits/stdc++.h> struct val { long long x; int y, d; val *p, *l, *r; } g1[100001], g2[100001], *rt1[100001], *rt2[100001], *nil = g1; struct node { long long x; int y; bool operator<(const node &b) const { return x < b.x; } } a[100001]; struct vale { long long x; int y;...
#include <bits/stdc++.h> using namespace std; int n; long long a[30]; int main() { cin >> n; for (int i = 0; i < n; i++) { cin >> a[i]; } sort(a, a + n); long long now = a[n - 1]; long long ans = 0; for (int i = n - 1; i >= 0; i--) { now = min(now, a[i]); ans += now...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; int v[112345]; int main() { int n; scanf( %d , &n); for (int i = 0; i < n; i++) scanf( %d , &v[i]); sort(v, v + n); int res = 1; for (int i = 0; i < n; i++) { if (v[i] >= res) { v[i] = res; res++; } } printf(...