text
stringlengths
59
71.4k
/** * 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 /* * Simple Brainfuck CPU in Verilog. * Copyright (C) 2011 Sergey Gridasov <> * * 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 *...
/** * 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> #pragma GCC optimize( Ofast ) using namespace std; int main() { int n; cin >> n; int x[n], y[n], dx[n], dy[n], s[n]; for (int i = 0; i < n; i++) { cin >> x[i] >> y[i] >> dx[i] >> dy[i] >> s[i]; } float ans = -1; int eff_s; float t1, t2; for (int i...
#include <bits/stdc++.h> using namespace std; #pragma GCC optimize( Ofast ) const long long maxn = 3000 + 10, N = 2e5 + 10, SQ = 320, base = 800287, mod = 1e9 + 7, INF = 1e18 + 10, lg = 22; const long double eps = 1e-4; long long n, m, q, dis[maxn][maxn], res[N]; long long V[N], U[N], r[N]...
#include <bits/stdc++.h> using namespace std; template <typename T> inline bool uax(T &x, T y) { return (y > x) ? x = y, true : false; } template <typename T> inline bool uin(T &x, T y) { return (y < x) ? x = y, true : false; } string to_string(char c) { return + string(1, c) + ; } stri...
// ============================================================== // File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC // Version: 2015.4 // Copyright (C) 2015 Xilinx Inc. All rights reserved. // // ============================================================== `timescale 1ns/1ps modul...
#include <bits/stdc++.h> using namespace std; const int N = 200010, M = 500010; int h[N], e[M * 2], nex[M * 2], idx, n, m, nodea, nodeb, sz; int col[N]; void add(int x, int y) { e[idx] = y; nex[idx] = h[x]; h[x] = idx++; } bool dfs1(int u) { col[u] = 1; sz++; for (int i = h[u]; ~i;...
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2016.3 (win64) Build Mon Oct 10 19:07:27 MDT 2016 // Date : Tue Sep 19 12:28:13 2017 // Host : vldmr-PC running 64-bit Service Pack 1 ...
#include <bits/stdc++.h> using namespace std; int main() { string s; long long int k, a[26], i, max = -1, l, sum = 0; cin >> s; cin >> k; l = s.length(); for (i = 0; i < 26; i++) { cin >> a[i]; if (max < a[i]) max = a[i]; } for (i = 0; i < l; i++) { sum = sum + (i +...
`timescale 1ps/1ps `default_nettype none (* DowngradeIPIdentifiedWarnings="yes" *) module axi_protocol_converter_v2_1_8_b2s_ar_channel # ( /////////////////////////////////////////////////////////////////////////////// // Parameter Definitions //////////////////////////////////////////////////////////////////////////...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2009 by Wilson Snyder. module t (/*AUTOARG*/ // Inputs clk ); input clk; logic use_AnB; logic [1:0] active_command [8:0]; logic [1:0] command_A [8:0]...
#include <bits/stdc++.h> using namespace std; long long t, n, a[100011], sum[100011], ans; map<long long, long long> mp; signed main() { scanf( %lld , &t); while (t--) { mp.clear(); scanf( %lld , &n); memset(a, 0, sizeof a); memset(sum, 0, sizeof sum); ans = 0; for (r...
#include <bits/stdc++.h> using namespace std; long long M = 1000000007; long long power(long long a, long long b) { long long res = 1; for (long long i = 0; i < b; i++) res = (res * a) % M; return res; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long t, n, m, k...
`timescale 1ns/1ns module arb_test(); reg clk, reset_n, wreq, fifo_full; reg [7:0] memadrs, memdata; wire [7:0] synth_ctrl, synth_data; reg [7:0] test_state; reg [7:0] wait_cnt; synth_arb arb1( .clk(clk), .reset_n(reset_n), .memadrs(memadrs), .memdata(memdata), ...
//////////////////////////////////////////////////////////////////////////////////////////////////// // 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 2 // of the License, or (at...
#include <bits/stdc++.h> using namespace std; int sum[200000 + 5]; int main() { int n; scanf( %d , &n); for (int i = 0; i < n; ++i) { scanf( %d , sum + i); sum[i] += i; } sort(sum, sum + n); for (int i = 1; i < n; ++i) { if (sum[i] == sum[i - 1]) { printf( :( n );...
#include <bits/stdc++.h> long long int mod = 1000000000 + 7; long long int inf = 1000000000000000000; using namespace std; int main() { iostream::sync_with_stdio(false); cin.tie(0); int t; cin >> t; while (t--) { int ans = 1, a; cin >> a; for (int i = 0; i < 31; i++) { ...
/* Copyright (C) 2013 Adapteva, Inc. Contributed by Andreas Olofsson, Roman Trogan <> 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) ...
#include <bits/stdc++.h> using namespace std; int n = 0, m = 0, k; vector<string> a; int CountSpiders(int j) { int sum = 0; int jR = j, jL = j; for (int i = 1; i < n; ++i) { if (!(i % 2) && a[i][j] == U ) ++sum; if (jR > 0) { --jR; if (a[i][jR] == R ) ++sum; } ...
// bsg_hash_bank_reverse // // See paired module bsg_hash_bank. // This module is the inverse; taking a bank number and an index, and producing the original address. // `include "bsg_defines.v" module bsg_hash_bank_reverse #(parameter `BSG_INV_PARAM(banks_p), parameter `BSG_INV_PARAM(width_p), index_width_lp=$clog2((...
/** * 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 la...
#include <bits/stdc++.h> using namespace std; int n, d, h; vector<pair<int, int> > ans; int main() { ios::sync_with_stdio(0); cin >> n >> d >> h; if (2 * h < d || (d == 1 && n > 2)) { cout << -1 << n ; return 0; } for (int i = 2; i <= h + 1; i++) ans.push_back(make_pair(i - 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...
module Control(clk,res,exp_diff,big_alu_result, fra_result,shift_right_bits, shift_left_bits,shift_right_en,shift_left_en,shift_right_bit, incre_bit,decre_bit,incre_en,decre_en,mux_1_en,mux_2_en,mux_3_en,mux_4_en,mux_5_en); integer i; reg [7:0] n=0; input clk,res; input [8:0] exp_diff; input [27:0] big_...
#include <bits/stdc++.h> using namespace std; const int INF = 1 << 29; struct abc { int left, right, capacity, cost; } edge[12345]; int n, k, x, e = 0, cost[50], p[50]; void addEdge(int a, int b, int c, int d) { edge[e].left = a; edge[e].right = b; edge[e].capacity = c; edge[e].cost = d;...
#include <bits/stdc++.h> using namespace std; template <typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; } template <typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; } const int oo = 0x3f3f3f3f; const int max0 = 50, maxn = 1000; i...
#include <bits/stdc++.h> long long int mod = 1000000007; using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); long long int n, k; cin >> n >> k; long long int p = k / n; if (k % n != 0) { p += 1; } cout << p; return 0; }...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: Digilent Inc. // Engineer: Thomas Kappenman // // Create Date: 03/03/2015 09:33:36 PM // Design Name: // Module Name: PS2Receiver // Project Name: Nexys4DDR Keyboard Demo // Target Devices: Nexys4DDR //...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 24.06.2017 01:05:36 // Design Name: // Module Name: PS2_y_display // Project Name: // Target Devices: // Tool Versions: // Description: // // Dependencies: // //...
/* Buffer module testbench */ `timescale 1ns/1ns module buffer_test(); localparam B = 1024; reg CLOCK_50, rst; reg [31:0] counter; reg new_sample_val; wire [31:0] pitch_shift_out; wire pitch_shift_val; // make reset initial begin CLOCK_50 = 1'b0; ...
#include <bits/stdc++.h> using namespace std; const int N = 100005; const int inf = ~0u >> 2; int numa[N], numb[N], pos[N]; struct node { int val, id; node(int _val, int _id) { val = _val, id = _id; } bool operator<(const node& A) const { return val > A.val; } }; int now[N], unuse[N]; priori...
/** * 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: 2016/05/25 08:26:12 // Design Name: // Module Name: Serial_in_parallel_out_enable_behavior_tb // Project Name: // Target Devices: // Tool Versions: // Description: ...
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 10; const long long MOD = 1e9 + 7; long long h[26][N], p[N]; int a[30], b[30]; char s[N + 10]; long long get(int i, int l, int r) { return (h[i][r] - h[i][l - 1] * p[r - l + 1]) % MOD; } int main() { int n, m, x, y, len; whi...
`timescale 1ns / 1ps module Microphone( output spi_clk, // SPI clock to ADC output spi_mosi, // Data to ADC output reg spi_cs, // Chip select for ADC input spi_miso, // Data from ADC input clk, input rst, input start_sample, // Set to 1 to sample the ADC output reg sample_done, // Latest sample is...
#include <bits/stdc++.h> using namespace std; vector<int> arr; int maxNum = -1; int n; bool vis[1000000 + 50]; int main() { memset(vis, false, sizeof(vis)); scanf( %d , &(n)); for (int i = 0; i < n; i++) { int tmp; scanf( %d , &(tmp)); if (!vis[tmp]) { arr.push_back(tmp...
#include <bits/stdc++.h> using namespace std; int main() { int num, i, count = 0, sum = 0, a; cin >> num; a = 1; while (1) { for (i = 1; i <= a; i++) { sum += i; } a++; if (sum > num) break; count++; } cout << count << endl; return 0; }
#include <bits/stdc++.h> using namespace std; void solve(); void precalc(); clock_t start; bool doing = true; int main() { int t = 1; cout.sync_with_stdio(0); cin.tie(0); precalc(); cout.precision(10); cout << fixed; start = clock(); int testNum = 1; while (t--) { s...
//***************************************************************************** // (c) Copyright 2009 - 2013 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 /...
#include <bits/stdc++.h> using namespace std; template <typename T> ostream &operator<<(ostream &os, const vector<T> &v) { os << { ; string sep; for (const auto &x : v) os << sep << x, sep = , ; return os << } ; } template <typename T, size_t size> ostream &operator<<(ostream &os, const ...
(* FASM_PARAMS="INV.TA1=TAS1;INV.TA2=TAS2;INV.TB1=TBS1;INV.TB2=TBS2;INV.BA1=BAS1;INV.BA2=BAS2;INV.BB1=BBS1;INV.BB2=BBS2;ZINV.QCK=Z_QCKS" *) (* whitebox *) module LOGIC_MACRO (QST, QDS, TBS, TAB, TSL, TA1, TA2, TB1, TB2, BAB, BSL, BA1, BA2, BB1, BB2, QDI, QEN, QCK, QRT, F1, F2, FS, TZ, CZ, QZ, FZ); // =============...
#include <bits/stdc++.h> using namespace std; const int MOD = 1e9 + 7; void add(int &a, int b) { a += b; if (a >= MOD) a -= MOD; } int n, K, C[1003][1003], fac[1003]; int dp[1003][1003][2][2], ans[1003]; int main() { scanf( %d%d , &n, &K); for (int i = 1; i <= n; i++) { C[i][0] = C[i...
#include <bits/stdc++.h> using namespace std; const int N = 123456; int s[N]; int main() { int n, k, ans = 0; scanf( %d%d , &n, &k); for (int i = 0; i < n; ++i) { scanf( %d , s + i); } for (int i = 0; i < n - k; ++i) { ans = max(ans, s[i] + s[(n - k) * 2 - i - 1]); } prin...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long int T = 1; while (T--) { string s1, s2; cin >> s1 >> s2; long long int ans = 0; long long int i, j, k; i = j = k = 0; long long int n = s2.si...
// these defines are only used for readability `define INTEGER_INPUT_WIDTH ((STAGE_NUMBER+1) * 2) `define INTEGER_OUTPUT_WIDTH `INTEGER_INPUT_WIDTH-2 `define REMAINDER_INPUT_WIDTH (((RADICAND_WIDTH/2) + 1) - STAGE_NUMBER) `define RESULT_INPUT_WIDTH ((RADICAND_WIDTH/2) - STAGE_NUMBER - 1) `define REMAINDER_OUTPUT_WIDTH ...
#include <bits/stdc++.h> using namespace std; int n; vector<int> a; vector<stack<int>> ids; vector<int> b; string answer; int segtree_size; template <typename T> struct segtree { int segtree_size; vector<T> segtree; T identity; T (*UpdateFn)(T, T); void InitSegtree(int main_size, T...
`define ROMMatrix_NOP 4'h0 `define ROMMatrix_LDR 4'h1 `define ROMMatrix_LDC 4'h2 `define ROMMatrix_State_Reset 2'h0 `define ROMMatrix_State_Ready 2'h1 `define ROMMatrix_State_Error 2'h2 module ROMMatrix(clock,reset,inst,inst_en,out,rom_addr,rom_data_o); parameter ROMRows = 8; parameter ...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int a, b; cin >> a; set<int> s; while (a--) { int b; cin >> b; s.insert(b); } cout << s.size() << endl; } return 0; }
/* * 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...
/* * 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 main() { int n; cin >> n; vector<int> a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } int q; cin >> q; vector<int> ta(n, -1); vector<int> payouts(q, 0); for (int i = 0; i < q; i++) { int k, p, x; cin >> k;...
#include <bits/stdc++.h> using namespace std; using namespace std; struct my { int a; double b; }; bool Cmp(my a, my b) { return a.b <= b.b; } int main() { int n, m; cin >> n >> m; my mine[n]; for (int i = 0; i < n; ++i) { int a; cin >> a; double b; cin >> b; ...
#include <bits/stdc++.h> using namespace std; int n; vector<int> v; vector<int> ans_lis; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); cin >> n; for (int i = 1; i <= n; i++) { int x; cin >> x; v.emplace_back(x); } sort(v.begin(), v...
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // This file is part of the M32632 project // http://opencores.org/project,m32632 // // Filename: example.v // Version: 1.0 // Date: 30 May 2015 // // Copyright (C) 2015 Udo Moeller // // This source...
#include <bits/stdc++.h> using namespace std; const int C = 20, A = 40; int n, liq; int dp[1 << C]; long long k[A]; int main() { scanf( %d %d , &n, &liq); for (int i = 0; i < n; i++) for (int j = 0, first; j < n; j++) cin >> first, k[i] |= (long long)(first || i == j) << j; for (i...
#include <bits/stdc++.h> using namespace std; vector<pair<long long, long long> > v; bool cmp(pair<long long, long long> &a, pair<long long, long long> &b) { if (a.first == b.first) return a.second < b.second; return b.first < a.first; } long long func(pair<long long, long long> &a, pair<long long, lo...
#include <bits/stdc++.h> using namespace std; int cnt(vector<vector<pair<int, int>>>& graph, int cur, int parent, int val) { int ans = 1; for (auto p : graph[cur]) { if (p.first == parent) continue; if (p.second == val) ans += cnt(graph, p.first, cur, val); } return ans; } void fill(...
#include <bits/stdc++.h> using namespace std; int n, m, adj[25], pode[1 << 23]; int main() { scanf( %d%d , &n, &m); if (m == n * (n - 1) / 2) { puts( 0 ); return 0; } for (__typeof(n) i = (0) - ((0) > (n)); i != (n) - ((0) > (n)); i += 1 - 2 * ((0) > (n))) adj[i] |= 1 <<...
#include <bits/stdc++.h> using namespace std; unordered_map<int, int> mp; int cnt[200005]; int a[200005]; int num[200005]; int l, r, t; int tot = 0; int lz[200005]; int ans[200005]; int A, B; int be[200005]; struct Query { int l, r, id, t; Query() {} Query(int _l, int _r, int _id, in...
`include "defines.v" `include "connectRouter_2SNoBuffer.v" `timescale 1ns/1ps module tb_connectRouters( ); reg clk, rst; reg `control_w port_in, inj; reg bfull; wire `control_w port_out, eject; wire accept, push; connectRouter_nobuffer r( .clk(clk), .rst(rst), ...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using ii = pair<ll, ll>; using vi = vector<ll>; using vb = vector<bool>; using vvi = vector<vi>; using vii = vector<ii>; using vvii = vector<vii>; const int INF = 2000000000; const ll LLINF = 90000000000000...
//----------------------------------------------------------------------------- // // (c) Copyright 2009-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 ...
// DESCRIPTION: Verilator: Verilog Test module // // Copyright 2010 by Wilson Snyder. This program is free software; you can // redistribute it and/or modify it under the terms of either the GNU // Lesser General Public License Version 3 or the Perl Artistic License // Version 2.0. `ifdef USE_VPI_NOT_DPI //We call it ...
<? if (elem.Label="") panic("err_romNeedsALabelToBeExported"); romMaxSize := 1 << elem.AddrBits; data:=elem.Data; if (elem.autoReload) { data=loadHex(elem.lastDataFile, elem.Bits); } romSize := sizeOf(data); moduleName = format("%s_%dX%d_%s", moduleName, romMaxSize, elem.Bit...
#include <bits/stdc++.h> using namespace std; const int N = 5e5 + 10; int m, k, n, s, tot, del, a[N], b[N], c[N], d[N]; int main() { scanf( %d%d%d%d , &m, &k, &n, &s); del = m - k * n; for (int i = 1; i <= m; i++) scanf( %d , &a[i]); for (int i = 1, x; i <= s; i++) { scanf( %d , &x); ...
/** * 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 2011 Ettus Research 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 program is di...
/* * bsg_mem_1rw_sync_mask_write_bit.v * * distributed synchronous 1-port ram for xilinx ultrascale or ultrascale plus FPGA * Write mode: No-change | Read mode: No-change * Note: * There are 2 basic BRAM library primitives, RAMB18E2 and RAMB36E2 in Vivado. * But none of them support bit-wise mask. They have Byte-wide w...
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, d; while (cin >> a >> b >> c >> d) { cout << (((a ^ b) & (c | d)) ^ ((b & c) | (a ^ d))) << endl; } return 0; }
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2016.4 (win64) Build Wed Dec 14 22:35:39 MST 2016 // Date : Mon Feb 13 12:45:31 2017 // Host : WK117 running 64-bit major release (build ...
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; int arr[n]; int ar[m]; for (int i = 0; i < n; i++) { cin >> arr[i]; } for (int j = 0; j < m; j++) { cin >> ar[j]; } for (int k = 0; k < n; k++) { for (int l = 0; l < m; l++) { ...
// $Id: rtr_route_filter.v 5188 2012-08-30 00:31:31Z dub $ /* Copyright (c) 2007-2012, 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: Redistribut...
//Legal Notice: (C)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 associate...
#include <bits/stdc++.h> using namespace std; int a[405][405]; int q[405 * 405], d[405], t, h, ans; bool vis[405]; int main() { int n, m; scanf( %d %d , &n, &m); while (m--) { int u, v; scanf( %d %d , &u, &v); a[u][v] = a[v][u] = 1; } t = h = 0; q[h++] = 1; vis[1]...
`timescale 1ns/100ps /** * `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...
#include<bits/stdc++.h> #define rep(i,a,b) for(int i=a;i<b;i++) #define ret(x) return cout<<x,0; #define rety return cout<< YES ,0; #define retn return cout<< NO ,0; typedef long long ll; typedef double db; typedef long double ld; #define stt string #define ve vector<ll> #define se set<ll> #def...
// // Copyright 2011-2012 Ettus Research 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 program i...
#include <bits/stdc++.h> using namespace std; const int maxn = 55; const int maxm = 5e3 + 110; double dp[maxn][maxm]; struct node { int f, s; double p; } a[maxn]; int main() { int n, R; scanf( %d %d , &n, &R); for (int i = 1; i <= n; i++) { scanf( %d %d %lf , &a[i].f, &a[i].s, &a...
#include <bits/stdc++.h> using namespace std; bool exceed(long long x, long long y, long long m) { return x >= m / y + 1; } long long n, k; string s; long long dp[1005][2005]; int zero = 1002; int main(void) { ios::sync_with_stdio(0); cin >> n >> k >> s; s = # + s; for (long long(i) = (0...
/** * 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 int GC(long long int a, long long int b) { if (b == 0) return a; else return GC(b, a % b); } long long int inv_gc(long long int a, long long int b) { return a / GC(a, b) * b; } long long int Ceil(long long int a, long long int b...
#include <bits/stdc++.h> using namespace std; int withoutzero(int x); int main() { int a, b, c, d, e, f; cin >> a >> b; d = withoutzero(a); e = withoutzero(b); c = a + b; f = withoutzero(c); if ((d + e) == f) { cout << YES ; } else { cout << NO ; } } int witho...
/** * 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 int modulo = 1000000009; int h; long long int expo2[31]; long long int expo3[31]; long long int expo4[31]; long long int memmaneres0[1001]; long long int maneres0(int n) { long long int &mem = memmaneres0[n]; if (mem != -1) return mem; ...
/* This program ties the state of the LED to the state of the RESET button */ module mojo_top( // 50MHz clock input input clk, // Input from reset button (active low) input rst_n, // cclk input from AVR, high when AVR is ready input cclk, // Outputs to the 8 onboard LEDs output[7:0]...
/** * 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...
// DESCRIPTION: Verilator: Verilog Test module // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2009 by Wilson Snyder. module t (/*AUTOARG*/ // Inputs clk ); input clk; integer cyc=0; reg [63:0] crc; reg [63:0] sum; // Take CRC data and apply to testblo...
#include <bits/stdc++.h> using namespace std; int n, p[1005]; vector<int> T; bool ok; inline void enter() { cin >> n; for (int i = 1; i <= n; i++) cin >> p[i]; } void dfs(int u) { while (T[u] != 1) { T[u]++; u = p[u]; } cout << u << ; } inline void solve() { for ...
#include <bits/stdc++.h> using namespace std; const int N = 5e5 + 10; unsigned long long x[N], y[N], f[N]; int a[N], cnt[N]; queue<int> g[N]; mt19937_64 rng(time(0)); char buf[1 << 23], *p1 = buf, *p2 = buf, obuf[1 << 23], *O = obuf; inline int rd() { int x = 0, f = 1; char ch = (p1 == p...
// *************************************************************************** // *************************************************************************** // Copyright 2014 - 2017 (c) Analog Devices, Inc. All rights reserved. // // In this HDL repository, there are many different and unique modules, consisting // of...
#include <bits/stdc++.h> using namespace std; const int N = 500010; int n, a[N], rt = 1, ba[30], sta[N], top = 0; vector<int> e[N]; long long ans; void dfs(int u, int ff) { sta[++top] = u; if (ff) { long long w = a[sta[top - 1]]; int i = 1; for (; top - ba[i] > 0; i++) if (...
#include <bits/stdc++.h> int main() { char c; std::set<char> s; while (std::cin >> c) { if ((c >= a ) && (c <= z )) { s.insert(c); } } std::cout << s.size() << n ; }
`timescale 1 ns / 1 ps module axi_traffic_controller_v1_0 # ( // Users to add parameters here parameter write_data_file = "wire_data_example", parameter write_addr_file = "write_addr_example", parameter read_data_file = "read_data_example", parameter read_addr_file = "read_addr_exa...
/* * lzw - Simple, Logarithmic Left Shift * Copyright (C) 2015 Sean Ryan Moore * * 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 you...
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2016.4 (win64) Build Wed Dec 14 22:35:39 MST 2016 // Date : Fri Jan 13 17:33:50 2017 // Host : KLight-PC running 64-bit major release (bu...
module ternOpInModul # ( parameter integer C_NUM_SLAVE_SLOTS = 1, parameter integer C_NUM_MASTER_SLOTS = 2, parameter integer C_AXI_ID_WIDTH = 1, parameter integer C_AXI_ADDR_WIDTH = 32, parameter integer C_AXI_DATA_WIDTH ...
`timescale 1ns / 1ps `include "asserts.vh" module queue_tb(); reg [11:0] story_to; reg clk_i, reset_i; reg [7:0] dat_i; reg push_i, pop_i, oe_i; wire [7:0] dat_o; wire full_o, empty_o; wire [2:0] rp_to; wire [2:0] wp_to; wire [3:0] room_to; queue #( .DEPTH_BITS(3), // 8-deep queue .DATA_BITS(8)...
#include <bits/stdc++.h> const double E = exp(1); const int maxn = 1e6 + 10; const int mod = 1e9 + 7; using namespace std; char ch[maxn]; int a[maxn]; bool cmp(int a, int b) { return a > b; } int main(int argc, char const *argv[]) { ios::sync_with_stdio(false); int n, k; cin >> n >> k; c...