text
stringlengths
59
71.4k
#include <bits/stdc++.h> using namespace std; vector<int> mat[100010]; int vis[100010], val[100010]; int dfs(int p, int pa) { if (vis[p]) return 1; int ret = 0; vis[p] = 1; if (p != pa) val[p] += val[pa]; for (auto x : mat[p]) ret = max(ret, dfs(x, p)); return ret; } int in[100010], ...
#include <bits/stdc++.h> using namespace std; int a[610000], i, j, k, l, n, m, p[610000], t, last, o, r, mid; char c[610000]; bool check(int mid) { int tmp = 1e9, res = 0; p[0] = mid; m = last; for (i = 1; i <= n; ++i) { p[i] = p[i - 1] + a[i]; if (p[i] == 0 && p[i - 1] == -1) m = ma...
#include <bits/stdc++.h> using namespace std; bool func(vector<pair<int, int> > vd, vector<pair<int, int> > vu) { for (int i = 0; i < vd.size(); i++) { if ((vd[i].first < vu[i].first && vd[i].second < vu[i].second) || (vd[i].first > vu[i].first && vd[i].second > vu[i].second)) { return t...
//----------------------------------------------------------------------------- // Jonathan Westhues, March 2006 // iZsh <izsh at fail0verflow.com>, June 2014 // Piwi, Feb 2019 // Anon, 2019 //----------------------------------------------------------------------------- // Defining commands, modes and options. This mus...
// (C) 2001-2015 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 law...
#include <bits/stdc++.h> using namespace std; long long gcd(long long x, long long y) { if (y == 0) return x; else return gcd(y, x % y); } long long expo(long long n, long long m) { long long r = 1; while (m > 0) { if (m % 2) r = (r * n) % 1000000009; n = (n * n) % 100000...
/** * 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 n, k; bool check(long long mid) { long long sum = (mid + k - 1) * (k - mid) / 2; return (sum >= n - 1); } int main() { scanf( %I64d%I64d , &n, &k); if (n == 1) { printf( 0 ); return 0; } long long l = 1, r = k - 1, mid...
/****************************************************************************** * License Agreement * * * * Copyright (c) 1991-2012 Altera Corporation, San Jose, California, USA. * ...
#include <bits/stdc++.h> using namespace std; int main() { long n, m, val, i, j = 0, sum = 0, k = 0; vector<long> toys; vector<long> selected; cin >> n >> m; for (i = 0; i < n; i++) { cin >> val; toys.push_back(val); } sort(toys.begin(), toys.end()); for (i = 0; i < 10000...
/** * $Id: red_pitaya_hk.v -01-21 11:40:39Z matej.oblak $ * * @brief Red Pitaya house keeping. * * @Author Matej Oblak * * (c) Red Pitaya http://www.redpitaya.com * * This part of code is written in Verilog hardware description language (HDL). * Please visit http://en.wikipedia.org/wiki/Verilog * for more d...
/** * 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 INF = 0x3f3f3f3f; const int mod = 1e9 + 7; const double eps = 1e-6; int x[8], y[8]; bool check(int a, int b) { return a >= min({x[0], x[1], x[2], x[3]}) && a <= max({x[0], x[1], x[2], x[3]}) && b >= min({y[0], y[1], y[2], y[3]...
#include <bits/stdc++.h> using namespace std; int n, x, b, k, v[100005], v2[100005], m; bool OK(int x) { int lst = -1e9, nr = 0; for (int i = 1; i <= n; i++) { if (v[i] - lst >= x) { nr++; lst = v[i]; } } return nr <= k; } int main() { ios::sync_with_stdio(false...
#include <bits/stdc++.h> int ar[100000]; int main() { int i, j, m, n, total = 0, a, b, c; scanf( %d %d , &n, &m); if (m == 0 || n == 1) printf( 0 ); else { for (j = 1; j <= m; j++) { scanf( %d %d %d , &a, &b, &c); ar[a] += c; ar[b] -= c; } for (i = 1; ...
// (C) 2001-2015 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...
`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 10:27:15 11/09/2016 // Design Name: Sprite_Controller // Module Name: C:/Users/yoe/Desktop/Experimento4/Monitor/testSprite.v // Project Name: Monitor // Ta...
module user_design(clk, rst, exception, input_rs232_rx, input_gps_rx, input_gps_count, input_rs232_rx_stb, input_gps_rx_stb, input_gps_count_stb, input_rs232_rx_ack, input_gps_rx_ack, input_gps_count_ack, output_tx_ctl, output_rs232_tx, output_leds, output_gps_tx, output_tx_freq, output_tx_am, output_tx_ctl_stb, output...
#include <bits/stdc++.h> using namespace std; const int MAXN = 500010, INF = MAXN + 1; struct Query { int pos, l, r; }; struct AddEvent { int pos, value, start_valid; }; int n, m; int as[MAXN]; int close[MAXN]; Query queries[MAXN]; AddEvent add_events[MAXN]; int results[MAXN]; int st[4...
#include <bits/stdc++.h> using namespace std; string s; int n; signed main() { ios_base ::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin >> n >> s; vector<pair<int, int>> a; vector<int> p(n, 0), nxt(n, 0); stack<pair<int, int>> S; S.push({0, -1}); for (int i = 0; i < n;...
/* * 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...
/* * comperator_2 module: * this module is combinatorical. it comperes 2 given inputs and returns * the one with greater or smaller value (c_data and corresponding index) accorging * to great_n_small signal. * comperation region is scalable and can be chosen using lo and hi parameters. * * PARAMETERS: * data...
//Legal Notice: (C)2010 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...
#include <bits/stdc++.h> using namespace std; class CElections { public: struct person { long long p, c; }; int n, m; person arr[3100]; vector<long long> parties[3100]; long long sol(int votes) { int total_votes_needed = votes - (int)parties[0].size(); vector<long long> ...
#include <bits/stdc++.h> using namespace std; long long int max(long long int a, long long int b) { if (a > b) { return a; } return b; } long long int gcd(long long int a, long long int b) { if (a == 0) { return b; } return gcd(b % a, a); } long long int min(long long int...
#include <bits/stdc++.h> using namespace std; const int MAXN = 2000005; char str[MAXN]; struct Palindromic_Tree { vector<pair<int, int>> next[MAXN]; int fail[MAXN]; int cnt[MAXN]; int num[MAXN]; int len[MAXN]; int S[MAXN]; int last; int n; int p; int newnode(int l) { ...
`timescale 1ns / 100ps `define EIC_DIRECT_CHANNELS 20 `define EIC_SENSE_CHANNELS 20 `include "mfp_eic_core.vh" module test_eicAhb; `include "ahb_lite.vh" reg [ `EIC_CHANNELS -1 : 0 ] signal; wire [ 17 : 1 ] EIC_Offset; wire [ 3 : 0 ] EIC_ShadowSet; wire ...
#include <bits/stdc++.h> using namespace std; string s; string rev(string s) { string p; for (auto i : s) p.insert(0, 1, i); return p; } int main() { cin >> s; int n = s.size(); for (int i = 0; i <= s.size(); i++) for (int j = 0; j < 26; j++) { string p = s; p.ins...
#include <bits/stdc++.h> using namespace std; const int N = 4e5 + 7; bool pri(int a) { if (a == 1) return 0; for (int i = 2; i * i <= a; i++) { if (a % i == 0) { return 0; } } return 1; } long long n, m, t, a[200000]; string s; int main() { cin >> t; while (t--)...
#include <bits/stdc++.h> const int maxn = 2e5 + 50; using namespace std; int n; long long a[maxn], dp[maxn], he[maxn]; vector<int> maps[maxn]; void dfs(int u, int fa) { he[u] = 0; for (int i = 0, len = maps[u].size(); i < len; i++) { int v = maps[u][i]; if (v != fa) { dfs(v, u); ...
module DM9000A_IF( // HOST Side iDATA, oDATA, iCMD, iRD_N, iWR_N, iCS_N, iRST_N, iCLK, iOSC_50, oINT, // DM9000A Side ENET_DATA, ENET_CMD, ENET_RD_N, ENET_WR_N, ENET_CS_N, ENET_RST_N, ENET_INT, ENET_CLK ); ...
`include "assert.vh" `include "SuperStack.vh" module SuperStack_tb(); parameter WIDTH = 8; parameter DEPTH = 1; // frames (exponential) localparam MAX_STACK = (1 << DEPTH+1) - 1; reg clk = 0; reg reset; reg [ 2:0] op; reg [WIDTH-1:0] data; reg [DEPTH :0] offset;...
#include <bits/stdc++.h> using namespace std; template <typename T, typename U> ostream &operator<<(ostream &out, const pair<T, U> &p) { out << ( << p.first << , << p.second << ) ; return out; } template <template <typename, typename...> class ContainerType, typename ValueType, typen...
// oversampling.v module oversampling ( input [7:0]sclk, input sdata, output [7:0]samples, output reg [7:0]trans ); reg [7:0]s1; // fixed position in FPGA always @(posedge sclk[0]) s1[0] <= sdata; always @(posedge sclk[1]) s1[1] <= sdata; always @(posedge sclk[2]) s1[2] <= sdata; always @(posedge sclk[3])...
// nios_system_mm_interconnect_0_avalon_st_adapter.v // This file was auto-generated from altera_avalon_st_adapter_hw.tcl. If you edit it your changes // will probably be lost. // // Generated using ACDS version 15.1 189 `timescale 1 ps / 1 ps module nios_system_mm_interconnect_0_avalon_st_adapter #( paramet...
#include <bits/stdc++.h> using namespace std; int main() { long long n, i = 0; cin >> n; for (i = n + 1; i <= (2 * n); i++) cout << i << ; return (0); }
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int t; cin >> t; while (t--) { int n; cin >> n; vector<string> v(n); for (auto& i : v) cin >> i; bool state = true; for (int i = n - 2; i >= 0...
#include <bits/stdc++.h> using namespace std; const int mod = 1000000007; int cnt[4]; int main() { int n; scanf( %d , &n); getchar(); for (int i = 0; i < n; ++i) { char ch = getchar(); if (ch == A ) { ++cnt[0]; } else if (ch == C ) { ++cnt[1]; } else if ...
#include <bits/stdc++.h> using namespace std; int main() { long long int t; cin >> t; while (t--) { long long int a, b, c, d, e, y = 0, x = 0, l = 0, z = 0, k = 0, m = 0; cin >> a >> b >> c >> d >> e; if (d > e) { while (a > 1 && b > 0) { y++; a = a - 2; ...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: Tecnológico de Costa Rica // Engineer: Mauricio Carvajal Delgado // // Create Date: 03.17.2013 10:36:22 // Design Name: // Module Name: Uart // Project Name: // Target Devices: // Tool versions: // ...
//***************************************************************************** // DISCLAIMER OF LIABILITY // // This file contains proprietary and confidential information of // Xilinx, Inc. ("Xilinx"), that is distributed under a license // from Xilinx, and may be used, copied and/or disclosed only // pursuant to the...
#include <bits/stdc++.h> using namespace std; const int inf = 0x3f3f3f3f; const int N = 1e6 + 100; int n, m, q; struct Qu { int op, x; } qu[N]; struct Edge { int u, v, w; bool operator<(const Edge& t) const { return w < t.w; } } edge[N]; struct Max { int val, pos; Max() {} Max(...
// $Id: vcr_routing_logic.v 2039 2010-05-19 06:51:53Z dub $ /* Copyright (c) 2007-2009, Trustees of The Leland Stanford Junior University All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions...
`timescale 1ns / 1ps /* * File : Hazard_Detection.v * Project : University of Utah, XUM Project MIPS32 core * Creator(s) : Grant Ayers () * * Modification History: * Rev Date Initials Description of Change * 1.0 23-Jul-2011 GEA Initial design. * 2.0 26-May-2012 GEA ...
#include <bits/stdc++.h> using namespace std; vector<int> thing[20005 * 4], query[20005 * 4]; struct Thing { int cost, happy; } d[20005]; int cost[20005], f[4005], tree[20005 * 4], tmp[16][4005], ans[20005]; int x, i, n, m, p, y; void build1(int k, int l, int r) { if (x <= l && r <= y) { thi...
module random_gen( input reset, input clock, input init, input [3:0] retry_count, output reg trigger ); reg [9:0] random_sequence; reg [9:0] random; reg [9:0] random_counter; reg [7:0] slot_time_counter; //256*2=512bit=1 slot time alw...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); long long n; long long m; long long k; cin >> n >> m >> k; vector<long long> p(m); for (long long i = 0; i < m; ++i) { cin >> p[i]; } long long i = 0; long long r = ((p[0] + k - 1) ...
/** * 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...
// -*- verilog -*- // Copyright (c) 2012 Ben Reynwar // Released under MIT License (see LICENSE.txt) // A qa_wrapper with only the message_stream_combiner. // The input stream and an empty stream go to the combiner. module qa_wrapper #( parameter WDTH = 32 ) ( input wire clk, input w...
#include <bits/stdc++.h> using namespace std; vector<string> ans; map<string, int> lo; string s[100], V[55]; long long int n, m, k, done[100], fyes = -1; void give() { string T = abcdef ; do { ans.push_back(T); } while (next_permutation(T.begin(), T.end())); for (int i = 0; i < ans.si...
#include <bits/stdc++.h> using namespace std; vector<int> adj[300007]; bool vis[300007]; int Time[300007], timeMin[300007], cnt = 0, res = 0; int dfs(int u, int p) { vis[u] = true; Time[u] = timeMin[u] = cnt++; int ret = 0; vector<int> childList; for (auto child : adj[u]) { if (child...
#include <bits/stdc++.h> using namespace std; char a[2000][1000]; int main() { int n, s; cin >> n; int nowx = 0, nowy = 1000; int miny = 1000, maxy = 1000; for (int i = 0; i < n; i++) { cin >> s; for (int j = nowx; j < nowx + s; j++) if (i % 2 == 0) a[nowy][j] = ...
////////////////////////////////////////////////////////////////////// //// //// //// OR1200's IC TAGs //// //// //// //// This file is part of the OpenR...
/** * 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 <vector> #include <array> #include <stack> #include <queue> #include <list> #include <bitset> #include <set> #include <map> #include <unordered_set> #include <unordered_map> #include <algorithm> #include <numeric> #include <iostream> #include <iomanip> #include <string> #include <...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 14:11:30 08/20/2015 // Design Name: // Module Name: Sixth_Phase // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencies: // // Revisi...
/** * 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 top ( output wire MOSI, output wire CSB, output wire DRCK1, input MISO ); wire CAPTURE; wire UPDATE; wire TDI; wire TDO1; reg [47:0] header; reg [15:0] len; reg have_header = 0; assign MOSI = TDI ; wire SEL1; wire SHIFT; wire...
/* * Copyright (C) 2014 Harmon Instruments, LLC * * 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, either version 3 of the License, or * (at your option) any later version. * * This progr...
/** * 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; vector<int> adjl[4009]; set<pair<int, int> > st; int main() { int n, m, a, b; cin >> n >> m; for (int i = 1; i <= m; i++) { cin >> a >> b; adjl[a].push_back(b); adjl[b].push_back(a); st.insert(pair<int, int>(a, b)); st.inser...
#include <bits/stdc++.h> using namespace std; const int mod = 1e9 + 7; const long double eps = 1e-6; const long double pi = acos(-1.0); long double sign(long double x) { return (x > 0) - (x < 0); } long long sign(long long x) { return (x > 0) - (x < 0); } int sign(int x) { return (x > 0) - (x < 0); } st...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); int n, k; cin >> n >> k; string s; cin >> s; string res = ; for (int i = 0; i < n; i++) { if ((s[i] - a ) >= ( z - s[i])) { if ((s[i] - a ) <= k) { k -= (s[i] - a );...
// *************************************************************************** // *************************************************************************** // Copyright 2014 - 2017 (c) Analog Devices, Inc. All rights reserved. // // In this HDL repository, there are many different and unique modules, consisting // of...
// *************************************************************************** // *************************************************************************** // Copyright 2013(c) Analog Devices, Inc. // // All rights reserved. // // Redistribution and use in source and binary forms, with or without modification, // are...
`timescale 1ns/10ps `include "pipeconnect.h" module dmem(input wire clk, input wire rst, input wire `REQ dmem_req, output wire `RES dmem_res, output wire `REQ dc_ctrl_req, input wire `RES dc_ctrl_res, output wire `REQ ...
#include <bits/stdc++.h> using namespace std; template <class T> inline T checkmin(T &a, T b) { return (a < b) ? a : a = b; } template <class T> inline T checkmax(T &a, T b) { return (a > b) ? a : a = b; } template <class T> T GCD(T a, T b) { if (a < 0) return GCD(-a, b); if (b < 0) re...
`define ADDER_WIDTH 009 `define DUMMY_WIDTH 128 `define 2_LEVEL_ADDER module adder_tree_top ( clk, isum0_0_0_0, isum0_0_0_1, isum0_0_1_0, isum0_0_1_1, isum0_1_0_0, isum0_1_0_1, isum0_1_1_0, isum0_1_1_1, sum, ); input clk; input [`ADDER_WIDTH+0-1:0] isum0_0_0_0, isum0_0_0_1, isum0_0_1_0, isum0_0_1_1, isum0_1_0_0,...
#include <bits/stdc++.h> using namespace std; const int maxn = 1000005; const int mod = 998244353; long long f[5009]; long long c[5009][5009]; long long ch(int a, int b) { long long sum = 0; for (int i = 0; i <= a && i <= b; i++) { sum += ((c[a][i] * c[b][i] % mod) * f[i] % mod); } ret...
#include <bits/stdc++.h> using namespace std; const double inf = 1e14; const double pi = acos(-1); const double eps = 1e-10; const int maxn = 25010; int n, x[maxn], y[maxn], dx[maxn], dy[maxn], s[maxn]; double ans = inf, ddx[maxn], ddy[maxn], K[maxn], B[maxn]; inline double solve(int a, int b) { dou...
`timescale 1ns / 1ps /* Group Members: Kevin Ingram and Warren Seto Lab Name: Traffic Light Controller (Lab 3) Project Name: eng312_proj3 Design Name: Traffic_Test_F_eng312_proj3.v Design Description: Verilog Test Bench to Implement Test F (2 PM) */ module Traffic_Test; // Inputs ...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 10/05/2016 08:56:02 PM // Design Name: // Module Name: hapara_axis_64timer // Project Name: // Target Devices: // Tool Versions: // Description: // // Dependencies...
`timescale 1 ns / 1 ps module lookup_table_behavioural # ( // signal width definitions parameter integer TDATA_WIDTH = 32, parameter integer ADDRESS_WIDTH = 8 ) ( // input data AXI bus input wire data_in_aclk, input wire data_in_aresetn,...
#include <bits/stdc++.h> using namespace std; long long N, P; long long L[100001]; long long R[100001]; long long getAc(long long l, long long r, long long p) { if ((l + p - 1) / p * p > r) return 0; return (r - (l + p - 1) / p * p) / p + 1; } int main() { scanf( %lld%lld , &N, &P); for (i...
#include <bits/stdc++.h> using namespace std; long long ctos, modd = 1000000007, dos = 2; long long P[4005], B[4005][4005], res; long long bi(int n, int k) { if (n == k) return 1; if (k == 0) return 1; if (k > n) return 0; if (k == 1) return n; if (B[n][k] > 0) return B[n][k]; B[n][k] = ...
#include <bits/stdc++.h> using namespace std; int flow, n, m, S, T, tot, x, y; int g[3000], dis[3000], pre[3000]; int Next[50000], adj[50000], f[50000], c[50000]; bool used[3000]; queue<int> q; int ans = 0; int calc[110][30]; string t, s; void add(int x, int y, int flow, int cost) { adj[tot] = y...
// module ddr3_s4_amphy_ex_lfsr8 ( clk, reset_n, enable, pause, load, data, ldata); parameter seed = 32; input clk; input reset_n; input enable; input pause; input load; output[8 - 1:0] data; wire[8 - 1:0] data; input[8 - 1:0] ldata; reg[8 - 1:0] lfsr_data; assign data = lfsr_data ;...
// ---------------------------------------------------------------------- // Copyright (c) 2015, The Regents of the University of California All // rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met:...
#include <bits/stdc++.h> using namespace std; const int N = (1 << 22) + 20; bool vis[2][N]; int a[N], n, m, ex[N]; int get_not(int x) { return (1 << n) - 1 - x; } void dfs(int type, int msk) { vis[type][msk] = true; if (type == 1) { if (!vis[0][get_not(msk)]) dfs(0, get_not(msk)); for (i...
//----------------------------------------------------------------------------- // // (c) Copyright 2010-2011 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 ...
//b12015 Rohit Patiyal `include "ALU/Arith/Signed/SSubtractor/mux32to16.v" //` `include "ALU/Arith/Signed/SSubtractor/mux48to16.v" //` `include "ALU/Arith/Signed/SAdder/SAdder.v" `include "ALU/Arith/Signed/SSubtractor/SSubtractor.v" `include "ALU/Arith/Signed/SDivider/SDivider.v" `include "ALU/Arith/Signed/SMultiplie...
#include <bits/stdc++.h> using namespace std; const double eps = 1e-8; const double pi = acos(-1.0); const int inf = 2147483647; int n, w; int a[1005]; bool first; int MIN; void output(int x) { if (first) first = false; else printf( ); if (x == MIN) x = 0; else if (...
#include <bits/stdc++.h> using namespace std; inline int lowbit(int x) { return x & -x; } int read() { int kkk = 0, x = 1; char c = getchar(); while ((c < 0 || c > 9 ) && c != - ) c = getchar(); if (c == - ) c = getchar(), x = -1; while (c >= 0 && c <= 9 ) kkk = kkk * 10 + (c - 0 ), c...
//----------------------------------------------------------------------------- // // (c) Copyright 2010-2011 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 ...
/******************************************************************************* * This file is owned and controlled by Xilinx and must be used solely * * for design, simulation, implementation and creation of design files * * limited to Xilinx devices or technologies. Use with non-Xilinx ...
#include <bits/stdc++.h> using namespace std; long long n, p[10]; map<long long, string> m; set<long long> s[10]; template <class T> string toString(T x) { ostringstream os; os << x; return os.str(); } int getlen(long long x) { int ans = 0; while (x) { ans++; x /= 10; ...
/* * 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 n, m, k, i, j, a; int c[11]; int main() { cin >> n >> m >> k; for (i = 1; i <= n; ++i) { for (j = 1; j <= m; ++j) { char x; cin >> x; c[j] += (x == Y ); } } for (i = 1; i <= m; ++i) a += (c[i] >= k); cout ...
#include <bits/stdc++.h> using namespace std; int main() { int x1, y1, x2, y2; while (scanf( %*d %*d %d %d %d %d , &x1, &y1, &x2, &y2) == 4) { int a = abs(x1 - x2), b = abs(y1 - y2); if (min(a, b) <= 2 && max(a, b) < 5) puts( First ); else if (max(a, b) < 4) puts( First );...
#include <bits/stdc++.h> using namespace std; int main() { int n, m, b, mod; cin >> n >> m >> b >> mod; int dp[502][502]; int bugs[n + 2]; for (int i = 0; i < n; i++) cin >> bugs[i]; memset(dp, 0, sizeof dp); dp[0][0] = 1; for (int k = 0; k < n; k++) { for (int j = 0; j <= b - ...
#include <bits/stdc++.h> using namespace std; int main() { long long n, d; cin >> n >> d; long long arr[n]; for (long long i = 0; i < n; i++) cin >> arr[i]; set<long long> s1; for (long long i = 0; i < n; i++) { long long pd = arr[i] - d; if (i == 0) s1.insert(pd); ...
#include <bits/stdc++.h> using namespace std; priority_queue<pair<int, int> > a; priority_queue<pair<int, int> > b; vector<pair<int, int> > A; vector<pair<int, int> > B; int main() { int n, x; scanf( %d%d , &n, &x); int x0 = x; for (int i = 0; i < n; i++) { int t; int h, m; ...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed under the Creative Commons Public Domain, for // any use, without warranty, 2013 by Wilson Snyder. // SPDX-License-Identifier: CC0-1.0 // Very simple test for interface pathclearing interface ifc; integer hidden_from_isub; integer val...
#include <bits/stdc++.h> using namespace std; const int MOD = 1e9 + 7; const int INF = 2e9 + 5; const int MAXN = 100010; int n; long long a, r, m, h[MAXN]; int main() { cin.sync_with_stdio(0); cin.tie(0); cin >> n >> a >> r >> m; for (int i = 0; i < n; i++) { cin >> h[i]; } m...
`timescale 1ns/10ps /** * `timescale time_unit base / precision base * * -Specifies the time units and precision for delays: * -time_unit is the amount of time a delay of 1 represents. * The time unit must be 1 10 or 100 * -base is the time base for each unit, ranging from seconds * to femtoseconds, and must be:...
//b12015 ROHIT PATIYAL `include "ALU/Arith/UnSigned/UDivider/BasicCell.v" `include "ALU/Arith/UnSigned/UDivider/stepof32.v" `include "ALU/Arith/UnSigned/UDivider/laststepof32.v" //`include "ALU/mux2to1.v" //` module UDivider(Quotient, Remainder, Dividend, Divisor); output [31:0] Quotient; output [31:0] Remaind...
/** * 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: 16:50:49 09/24/2013 // Design Name: Contador // Module Name: C:/Users/Fabian/Documents/GitHub/taller-diseno-digital/Lab3/laboratorio3/test_contador.v // Project Name:...
////////////////////////////////////////////////////////////////////////////////// // NPCG_Toggle_BNC_P_read_AW30h for Cosmos OpenSSD // Copyright (c) 2015 Hanyang University ENC Lab. // Contributed by Kibin Park <> // Ilyong Jung <> // Yong Ho Song <> // // This file is part of Cosmos Ope...