text
stringlengths
59
71.4k
module i2s_tx #(parameter DATA_WIDTH = 16 ) (clk, left_chan, right_chan, sdata, lrclk, mck, sck); input wire clk; //general clock of project (top level) 50 MHz input wire [DATA_WIDTH-1:0] left_chan; input wire [DATA_WIDTH-1:0] right_chan; output reg sdata; initial sdata <= 1'b0; //output reg mck; initial mck <= ...
#include <bits/stdc++.h> using namespace std; long long read() { char c; long long num, f = 1; while (c = (char)getchar(), !isdigit(c)) if (c == - ) f = -1; num = (long long)(c - 0 ); while (c = (char)getchar(), isdigit(c)) num = num * 10 + (long long)(c - 0 ); return num * f; } ...
#include <bits/stdc++.h> using namespace std; const long long mod = 1000000007; const int N = 5e5; int main() { long long n, a, b, c, t; cin >> n >> a >> b >> c >> t; long long arr[n + 1]; for (long long i = 1; i <= n; i++) { cin >> arr[i]; } long long s = n * a; if (b >= c) { ...
/* * yosys -- Yosys Open SYnthesis Suite * * Copyright (C) 2018 Miodrag Milanovic <> * Copyright (C) 2012 Claire Xenia Wolf <> * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this...
/************************************************************************* * * * Copyright (C) 2016,2017 Alves, Fredy. * * All rights reserved. Email: * * ...
module DC_8_databanks #(parameter Width = 36, Size =512, Forward=0, REQ_BITS=7) // 36 bit data per data bank= 32 bit data+4 bit valid bits //tag 10+counter 2[19,20]+states 3[21,22,23] =15 for tag bank //data bank gets pos+ data to write or output data from read ( input clk ,input ...
#include <bits/stdc++.h> int main(void) { int n, m; scanf( %d%d , &n, &m); char c; scanf( %c , &c); int i, j; char word[n + 2][m + 2]; for (i = 0; i < n + 2; i++) for (j = 0; j < m + 2; j++) word[i][j] = W ; int v[n + 1], h[m + 1]; for (i = 0; i <= n; i++) v[i] = 0; for ...
/*! * \file norm.v * \brief Hardware normalization core * \author Luca Maggiani, Cedric Bourrasset * * \version v0.1 (23Mar15) Initial release * \date Mar 2015 * \param[in] in_fv, in_dv, in_data * \param[out] out_fv, out_dv, out_data */ module norm( clk_proc, reset_n, in_fv, ...
/** * 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 "defines.v" `include "nodeRouter.v" `timescale 1ns/1ps /* input `control_w port0_ci, input `control_w port1_ci, input `control_w portl0_ci, input `control_w portl1_ci, output portl0_ack, output portl1_ack, input ...
/** * 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 main() { int i, n; cin >> n; int cnt = 0; int jump = 1; int arr[n]; for (int k = 1; k <= n; k++) { arr[k] = k; } for (i = 1; i <= n * n; i++) { jump += i; if (jump <= n) { cout << arr[jump] << ; } el...
/* * Simple 8-bit FPGA softcore CPU. * Copyright (C) 2015 P. Heinonen. * Licensed under the MIT License. For more details, read the LICENSE file. * * compiler: Icarus Verilog 0.9.7 * Timing analysis with GTKWave * */ module waterbear( input clk, input rst, output[7:0] PC); // Control Unit stages ...
// Copyright (c) 2013, Simon Que // 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 of source code must retain the above copyright notice, this // list of conditions and the...
//----------------------------------------------------------------------------- // system_top.v // Author: Thierry Moreau // Email: //----------------------------------------------------------------------------- module system_top ( processing_system7_0_MIO, processing_system7_0_PS_SRSTB, processing_syst...
#include <bits/stdc++.h> using namespace std; template <class T> void pv(vector<T> &vec) { for (int i = 0; i < (int)(vec).size(); i++) cout << vec[i] << (i == (int)(vec).size() - 1 ? n : ); } bool ok(int x) { return (x % 10 == 7); } int main() { ios_base::sync_with_stdio(false); cin....
// nios_mm_interconnect_0_avalon_st_adapter_003.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 185 `timescale 1 ps / 1 ps module nios_mm_interconnect_0_avalon_st_adapter_003 #( parameter inBitsPe...
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 100; int add[N << 6], num[N << 6], lazy[N << 6], ls[N << 6], rs[N << 6], total; int init() { num[total] = add[total] = lazy[total] = 0; ls[total] = rs[total] = -1; return total++; } void down(int l, int r, int o) { if (ls[o] =...
#include <bits/stdc++.h> using namespace std; template <class c> struct rge { c b, e; }; template <class c> rge<c> range(c i, c j) { return rge<c>{i, j}; } template <class c> auto dud(c* x) -> decltype(cerr << *x, 0); template <class c> char dud(...); struct debug { template <class c...
/* * Milkymist SoC * Copyright (C) 2007, 2008, 2009, 2010 Sebastien Bourdeauducq * Copyright (C) 2007 Das Labor * * 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....
// ------------------------------------------------------------- // // Generated Architecture Declaration for rtl of inst_eb_e // // Generated // by: wig // on: Mon Sep 25 09:53:03 2006 // cmd: /cygdrive/h/work/eclipse/MIX/mix_0.pl -nodelta ../../bitsplice.xls // // !!! Do not edit this file! Autogenerated by MIX ...
#include <bits/stdc++.h> using namespace std; const int MAXN = 100 + 5; const long long MOD = 1000000007; long long pow2[MAXN]; char x[MAXN]; int main() { scanf( %s , x); int n = strlen(x); pow2[0] = 1; for (int i = 1; i < n; i++) pow2[i] = (pow2[i - 1] * 2) % MOD; long long d = pow2[n -...
#include <bits/stdc++.h> using namespace std; int main() { long long int n, m, i, j, k, sum = 0, cnt = 0, a[101]; cin >> n >> m; vector<long long int> o; for (i = 0; i < n; i++) { cin >> a[i]; sum += a[i]; } for (i = 0; i < m; i++) { cin >> j; j--; sum -= a[j]; ...
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 10; const int SQRTN = 320; const int LOGN = 20; const double PI = acos(-1); int n, val; map<int, int> dp; int dp2[N]; int range[N]; bool en[N]; int grundy(long long n) { if (n < 1e6) return dp2[n]; if (dp.find(n) != dp.end()...
#include <bits/stdc++.h> using namespace std; int n, m, s1, s2, t1, t2, l1, l2; vector<int> adj[3333]; int dist[3333][3333]; void bfs(int index) { queue<int> q; q.push(index); dist[index][index] = 0; while (!q.empty()) { int cur = q.front(); q.pop(); for (int to : adj[cur]) {...
/** * 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 long long N = 2e6 + 5, inf = 1e9 + 7; long long n, k, cumm[N], m[26]; set<pair<long long, long long> > st; string s; signed main() { ios_base::sync_with_stdio(false); cin.tie(0); long long i, j, a, b, ans = 1; cin >> n >> k >> s; s = #...
#include <bits/stdc++.h> using namespace std; inline int max3(int a, int b, int c) { return max(a, max(b, c)); } inline int min3(int a, int b, int c) { return min(a, min(b, c)); } const int INF = 1e9; const long long LINF = 1e18; const double EPS = 1e-6; const double PI = acos(-1.0); const int maxn = 15...
// DESCRIPTION: Verilator: Interface parameter getter // // A test of the import parameter used with modport // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2015 by Todd Strader interface test_if #(parameter integer FOO = 1); // Interface variable logic data; // Mod...
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; const long long LINF = 0x3f3f3f3f3f3f3f3fLL; const double EPS = 1e-8; const int MOD = 998244353; const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1}; int mod = MOD; struct ModInt { unsigned val; ModInt() : val(0) {} M...
// Copyright 2007, Martin Whitaker // This file may be freely copied for any purpose. module macro_with_args(); `define forward_and_reverse(str1,str2,str3) /* comment */ \ $write("%0s", str1); /* comment */ \ $write(".."); /* comment */ \ $write("%0s", str3); /* comment */ \ $write("%0s", str2); /* comm...
#include <bits/stdc++.h> using namespace std; template <class T> inline void read(T &x) { x = 0; char c = getchar(); int f = 1; while (!isdigit(c)) { if (c == - ) f = -1; c = getchar(); } while (isdigit(c)) { x = x * 10 + c - 0 ; c = getchar(); } x *= f; ...
`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 19:34:23 02/26/2016 // Design Name: Alu // Module Name: C:/Users/Ranolazine/Desktop/Lab/lab3/test_for_Alu.v // Project Name: lab3 // Target Device: // T...
//------------------------------------------------------------------------------ // File : gmii_if.v // Author : Xilinx Inc. // ----------------------------------------------------------------------------- // (c) Copyright 2004-2009 Xilinx, Inc. All rights reserved. // // This file contains confidential and p...
#include <bits/stdc++.h> using namespace std; int main() { int n, m, k; while (scanf( %d%d%d , &n, &m, &k) != EOF) { if (n == m) { if (n == 2 && k == 1) { printf( 4 n ); printf( 1 2 3 4 n ); } else { printf( %d n , 2 * k + 1); printf( 1 ); ...
#include <bits/stdc++.h> using namespace std; inline long long read() { long long w = 0, x = 0; char c = getchar(); while (!isdigit(c)) w |= c == - , c = getchar(); while (isdigit(c)) x = (x << 3) + (x << 1) + (c ^ 48), c = getchar(); return w ? -x : x; } namespace star { const long long ...
module data_path(); wire[31:0] input_data_1; wire[31:0] input_data_2; wire[31:0] output_data; wire[31:0] memory_data; wire[31:0] alu_data_output; wire alu_carry_output; // instruction fetch stage program_counter_adder pcadder_0(clock, if_program_counter); instruction_memory ...
`timescale 1ns/1ps `define CLOG2(x) \ (x <= 2) ? 1 : \ (x <= 4) ? 2 : \ (x <= 8) ? 3 : \ (x <= 16) ? 4 : \ (x <= 32) ? 5 : \ (x <= 64) ? 6 : \ (x <= 128) ? 7 : \ (x <= 256) ? 8 : \ (x <= 512) ? 9 : \ (x <= 1024) ? 10 : \ (x <= 2048) ? 11 : \ (x ...
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 1020; int n, m, d, tmp; int h[maxn], dis1[maxn], dis2[maxn]; bool mark[maxn], isaffected[maxn]; vector<int> adj[maxn]; pair<int, int> temp; void dfsa(int v) { for (int i = 0; i < adj[v].size(); i++) { int u = adj[v][i]; ...
// ============================================================================= // COPYRIGHT NOTICE // Copyright 2006 (c) Lattice Semiconductor Corporation // ALL RIGHTS RESERVED // This confidential and proprietary software may be used only as authorised by // a licensing agreement from Latt...
#include <bits/stdc++.h> using namespace std; int n, a[100005] = {0}, b[100005] = {0}, t, j, i, rn = 0, r[100005] = {0}, dis[100005] = {0}; vector<int> v; vector<int> ht; int main() { scanf( %d , &n); for (i = 1; i <= n; i++) { scanf( %d , &a[i]); if (a[i] == 1) ht.push_back(i); ...
#include <bits/stdc++.h> using namespace std; int main() { long long int mod, h1, a1, x1, y1, h2, a2, x2, y2, c1, c2, i, ans = 0, temp, j, m1, m2, h11, h12; cin >> mod; cin >> h1 >> a1; cin >> x1 >> y1; cin >> h2 >> a2; cin >> x2 >> y2; temp = h2; ans = 0; h11 = h1; h...
#include <bits/stdc++.h> #pragma GCC optimize( O3 ) const long long INF = 0x3f3f3f3f3f3f3f3f; const long long llinf = (1LL << 61); const int inf = (1 << 30); const int nmax = 1e3 + 50; const int mod = 1e9 + 7; using namespace std; int n, m, i, j, a[nmax][nmax], aa[nmax][nmax], b[nmax][nmax], bb[nmax][nm...
#include <bits/stdc++.h> using namespace std; const int mod = 1e9 + 7; struct data { int t, g; }; int memo[250][4][66000]; int n, t; data in[20]; int f(int time, int genre, int bit) { if (memo[time][genre][bit] != -1) return memo[time][genre][bit]; if (time == t) return memo[time][genre][bit...
#include <bits/stdc++.h> using namespace std; const int N = 3003 * 6006; const int qwq = 303030; const int inf = 0x3f3f3f3f; int n, m, k; int f[N], fa[N], st[123], cnt; int ans; int ff[] = {1, 1, 1, 0, -1, -1, -1, 0}; int gg[] = {1, 0, -1, -1, -1, 0, 1, 1}; inline int read() { int sum = 0, f = 1...
// DESCRIPTION: Verilator: Verilog Test module // // Copyright 2011 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. `define is_near_real(a,b) (( ((a)<(...
#include <bits/stdc++.h> using namespace std; int dp[5050][5050], q[5050][5050]; int ans[5050], len; char s[5050]; void init() { for (int i = 0; i < len; i++) { int l = 0; while (i - l >= 0 && i + l < len && s[i - l] == s[i + l]) dp[i - l][i + l] = 1, l++; l = 0; while (i -...
// ============================================================== // File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC // Version: 2014.1 // Copyright (C) 2014 Xilinx Inc. All rights reserved. // // ============================================================== `timescale 1 ns / 1 ps m...
#include <bits/stdc++.h> using namespace std; int a[105][105], b, c, d, e, f, g, h, i, j, k, l, m, n; inline bool pd(int x, int y, int s) { return a[x - 1][y] == s || a[x + 1][y] == s || a[x][y - 1] == s || a[x][y + 1] == s; } int main() { scanf( %d%d , &n, &m); for (i = 1; i <= n; 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> long long arr[100005]; using namespace std; int main() { cin.tie(0); std::ios::sync_with_stdio(false); ; int n; cin >> n; for (int i = 0; i < n; cin >> arr[i++]) ; sort(arr, arr + n); cout << arr[n - 1] << ; for (int i = 1; i < n - 1; i++) { ...
// taken from the Apple II project by Alex Freed // and modified for own use module ramcard(mclk28,reset_in,addr,ram_addr, we, card_ram_we,card_ram_rd, bank1); input mclk28; input reset_in; input [15:0] addr; output [17:0] ram_addr; input we; output card_ram_we; output card_ram_rd; output bank1; r...
#include <bits/stdc++.h> using namespace std; const double PI = acos(-1.0); double fixAngle(double A) { return A > 1 ? 1 : (A < -1 ? -1 : A); } double dcmp(double a, double b) { return fabs(a - b) < 1e-6 ? 0 : a > b ? 1 : -1; } const int MAX_SIZE = 3e5 + 5; const int MOD = 1e9 + 7; int r = 0; long...
/* * 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() { ios_base::sync_with_stdio(false), cin.tie(0); int t; cin >> t; while (t--) { map<int, int>L, R; int bal = 0; string s; cin >> s; for (char &c : s) { if (c == 1 ) { R[bal]++; bal++; } else { L...
#include <bits/stdc++.h> using namespace std; const int N = 234567; int n; vector<int> e[N]; int f[N]; void dfs(int u, int p) { int go_before_parent = 0; int go_after_parent = 0; for (int i = 0; i < e[u].size(); ++i) { int v = e[u][i]; if (v == p) { continue; } df...
#include <bits/stdc++.h> using namespace std; int main() { int a, b; cin >> a >> b; if (b == 1 && a == 9) { cout << 9 10 << endl; } else if (b - a == 1) { cout << a << << b << endl; } else if (a == b) { cout << a << 1 << b << 2 << endl; } else { cout << -1...
#include <bits/stdc++.h> using namespace std; const long long MAXN = 100000; const long long oops = 1LL << 60; class Ball { public: long long value, color; } arr[MAXN + 5]; long long colorBest[MAXN + 5]; long long n; void addToTopTwo(vector<pair<long long, int> >& toptwo, long long best, ...
#include <bits/stdc++.h> using namespace std; string tos(int a) { ostringstream os( ); os << a; return os.str(); } const int MAXN = 1000000; bool isp[MAXN + 100]; int main() { ios_base::sync_with_stdio(0); for (int i = 0; i <= MAXN; ++i) isp[i] = 1; isp[0] = isp[1] = 1; for (int...
#include <bits/stdc++.h> using namespace std; bool debug = 0; long long a[26], dp[26][26]; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int tc = 1; while (tc--) { string s; cin >> s; int n = s.length(); long long mx = 0; for (int i = 0...
#include <bits/stdc++.h> using namespace std; template <class T> void smin(T& a, T val) { if (a > val) a = val; } template <class T> void smax(T& a, T val) { if (a < val) a = val; } template <typename T> inline std::ostream& operator<<(std::ostream& os, const std::vector<T>& v) { bool firs...
#include <bits/stdc++.h> using namespace std; vector<int> V; void dfs(long long x) { if (x < 1000000000) { V.push_back(x); dfs(x * 10 + 4); dfs(x * 10 + 7); } } int main() { dfs(0); V.push_back(INT_MAX); sort(V.begin(), V.end()); int pl, pr, vl, vr, k; cin >> pl >...
// ------------------------------------------------------------- // // Generated Architecture Declaration for rtl of inst_t_e // // Generated // by: wig // on: Mon Jun 26 16:49:02 2006 // cmd: /cygdrive/h/work/eclipse/MIX/mix_0.pl ../../open.xls // // !!! Do not edit this file! Autogenerated by MIX !!! // $Author:...
#include <bits/stdc++.h> using namespace std; int n, m; int a[500005], b[500005], reach[500005][19]; int tree[4 * 500005][19]; void build(int i, int layer, int low, int high) { if (low == high) { tree[i][layer] = reach[low][layer]; return; } int mid = (low + high) / 2; build(2 * i,...
#include <bits/stdc++.h> using namespace std; int main() { int n, k, sum = 0, s[100005], ans[100005], an = 0; scanf( %d%d , &n, &k); for (int i = 1; i <= n; i++) { scanf( %d , &s[i]); sum += s[i]; } if (sum % k) { printf( No ); return 0; } int m = sum / k; int...
#include <bits/stdc++.h> using namespace std; const int MaxN = 5e2 + 10; const int P = 239017; const int INF = 1e9; const int MOD = 1e9 + 7; int dp[MaxN][MaxN][2], n, m, q; char s[MaxN][MaxN]; int get(int xl, int yl, int xr, int yr, int c) { if (c == 0 && xl > xr) { return 0; } if (c =...
/////////////////////////////////////////////////////// // Copyright (c) 2011 Xilinx Inc. // // 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 // // http://www.apache.org...
`timescale 1 ns / 1 ps /*Copyright (c) 2015, EmbeddedCentric.com 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 of source code must retain the above copyright notice, this list of c...
#include <bits/stdc++.h> using namespace std; inline long long read() { long long sign = 1; long long x = 0; char ch; while (!isdigit(ch = getchar())) if (ch == - ) sign = -1; while (isdigit(ch)) x = x * 10 + ch - 0 , ch = getchar(); return x * sign; } inline void wonl() { putcha...
#include <bits/stdc++.h> using namespace std; void solve(priority_queue<pair<long long, int>, vector<pair<long long, int> >, greater<pair<long long, int> > > &P, priority_queue<pair<long long, int> > &N, vector<long long> &ans, int k, int x) { while (k > 0) ...
#include <bits/stdc++.h> using namespace std; int arr[100000]; int n; priority_queue<pair<int, int>, vector<pair<int, int> >, greater<pair<int, int> > > q; int rankHash[100000]; int indHash[100000]; vector<pair<int, int> > ans; int main(void) { scanf( %d , &n); for (int i ...
#include <bits/stdc++.h> using namespace std; struct TP {}; int ar[5][5]; int ans = 0; int nums[5]; bool used[10]; void cal(int pos) { if (pos == 5) { int tmp = 0; for (int x = 0; x < 5; x++) { for (int y = x; y < 4; y += 2) { tmp += ar[nums[y]][nums[y + 1]]; tm...
#include <bits/stdc++.h> using namespace std; int x[1000] = {4, 1, 1, 1, 2, 2, 2, 3, 3, 3}; int y[1000] = {2, 1, 2, 3, 1, 2, 3, 1, 2, 3}; int X[1005], Y[1005]; int main(int argc, char** argv) { int n; string a; cin >> n >> a; int mnx = 1e9, mny = 1e9, mxx = 0, mxy = 0; for (int i = 1; i < ...
#include <bits/stdc++.h> using namespace std; template <typename T> void read(T &t) { t = 0; char ch = getchar(); int f = 1; while ( 0 > ch || ch > 9 ) { if (ch == - ) f = -1; ch = getchar(); } do { (t *= 10) += ch - 0 ; ch = getchar(); } while ( 0 <= ch &&...
#include <bits/stdc++.h> using namespace std; const int N = 100; const int M = 2e6 + 7; const int inf = 1e9; int n, m, mx, p[N], minn[N], D[M][2], sum = 0; int a[N][N]; bool check() { for (int t = 0, tE = (1 << mx) - 1; t <= tE; t++) { int ds = 0, bs = 0; for (int i = 1, iE = mx; i <= iE; ...
/** * 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> char ansStr[1000000]; int nextInt() { char ch; int s, x; do { ch = getchar(); } while (ch <= 32); if (ch == - ) { s = -1; ch = getchar(); } else s = 1; x = 0; while (ch >= 0 && ch <= 9 ) { x = x * 10 + ch - 0 ; ch = ge...
// (c) Copyright 1995-2017 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 ...
#include <bits/stdc++.h> using namespace std; vector<long long int> g[100005]; long long int vis[100005]; vector<double> ans; int32_t main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long int t = 1; cin >> t; while (t--) { long long int a, b, c, d; cin >> a >> b >...
#include <bits/stdc++.h> using namespace std; int gi() { int x = 0, w = 1; char ch = getchar(); while ((ch < 0 || ch > 9 ) && ch != - ) ch = getchar(); if (ch == - ) w = 0, ch = getchar(); while (ch >= 0 && ch <= 9 ) x = (x << 3) + (x << 1) + ch - 0 , ch = getchar(); return w ...
#include <bits/stdc++.h> using namespace std; const int N = 55, M = 105, T = 20005, K = 20; const double S = 1e5, inf = 1e9, PI = acos(-1); template <class T> void read(T &x) { int sgn = 1; char ch; x = 0; for (ch = getchar(); (ch < 0 || ch > 9 ) && ch != - ; ch = getchar()) ; if...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 14:06:55 06/01/2016 // Design Name: // Module Name: MUX // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencies: // // Rev...
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 100, PI = 3.14159265359, M = 1e9 + 7; long long a[N], ans = 1; int main() { long long n; cin >> n; long long x = 0, y = 0; for (int i = 0; i < n; i++) { long long a, b; cin >> a >> b; long long t1 = a - x, t2 = b...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int temp; int a[6] = {0}; int i = 0; while (n > 0) { a[i] = n % 2; n = n / 2; i++; } temp = a[0]; a[0] = a[4]; a[4] = temp; temp = a[2]; a[2] = a[3]; a[3] = temp; 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 la...
//Legal Notice: (C)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 do...
#include <bits/stdc++.h> using namespace std; const long long N = 1e5 + 5; long long n; long long deg[N], ans[N]; vector<pair<long long, long long> > g[N]; int32_t main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); ; long long t = 1; while (t--) { long long x1, x2, y1, ...
`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////// // Engineer: // // Create Date: 03.06.2015 14:58:39 // Design Name: // Module Name: harness // Project Name: // Target Devices: // Tool Versions: // Description: // // Dependencies: // // Revision: // Revision 0.01 -...
module test(); localparam [7:0] dly1 = 1; wire [7:0] dly2 = 2; reg [7:0] dly3 = 3; reg i; wire [6:1] o; buf #(dly1, dly2) buf1(o[1], i); buf #(dly2, dly1) buf2(o[2], i); buf #(dly1, dly3) buf3(o[3], i); buf #(dly3, dly1) buf4(o[4], i); buf #(dly2, dly3+1) buf5(o[5], i); buf #(4, 2) ...
#include <bits/stdc++.h> using namespace std; int main() { long long n, m; cin >> n >> m; long long x; for (int i = 0; i < m; i++) { cin >> x; if (x > n) cout << 0 << endl; else { if (x % 2 == 1) cout << x / 2 + 1 << endl; else { long lon...
module wb_ppfifo_2_mem( input clk, input rst, output [31:0] debug, //Control input i_enable, input [31:0] i_memory_0_base, input [31:0] i_memory_0_size, output [31:0] o_memory_0_count, input i_memory_0_ready, outpu...
module top ( input wire clk, input wire rx, output wire tx, input wire [15:0] sw, output wire [15:0] led ); parameter SRL_COUNT = 4; parameter PRESCALER = 4; // UART loopback assign tx = rx; // ============================================================================ // Reset reg [...
#include <bits/stdc++.h> using namespace std; const int N = 500009; const int mod = 1000000007; int n, m, x, y; vector<int> v[N]; vector<bool> vis; bool is; void pre() { vis.assign(N, 0); } void dfs(int ver, int par) { vis[ver] = 1; for (auto &it : v[ver]) { if (it == par) continue; ...
// Test bench for our 6 bit shift register. module main; reg clk, rst_n; reg [(32*5-1):0] values; wire [31:0] rows; wire [4:0] n; shader sc (clk, rst_n, values, rows); always #10 clk = ~clk; task assert(input condition); if(!condition) $finish(2); endtask // asser...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout << fixed; int a, b, c, d, e, f; cin >> a >> b >> c >> d >> e >> f; int cost = 0; if (e > f) { int suits = min(a, d); cost += e * suits; a -= suits; d -= ...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int t; cin >> t; int a[t + 10]; for (int i = 0; i < t; i++) { long int b, p, f, c, h, c1 = 0, c2 = 0; cin >> b >> p >> f; cin >> h >> c; b = b / 2; if (b ...
#include <bits/stdc++.h> using namespace std; pair<long long int, long long int> p[300002]; int see(long long int a, long long int b, long long int c) { for (long long int i = 0; i < c; i++) { if (p[i].first == a || p[i].first == b || p[i].second == a || p[i].second == b) continue; ...
// 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 : Sun Jun 04 12:45:05 2017 // Host : GILAMONSTER running 64-bit major release (...
/* Copyright (c) 2014 Alex Forencich Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute,...
#include <bits/stdc++.h> using namespace std; int n, a[52][52], d[52], dd[52], c[52], b[52][52]; bool check(int pos) { int t[n + 2]; for (int i = 1; i <= n; i++) t[i] = d[i]; for (int i = 1; i <= n; i++) if (t[i] == n && i != pos) t[i] = n - 1; for (int i = 1; i <= n; i++) for (int j =...