text
stringlengths
59
71.4k
// File: fifo_mem.v // Generated by MyHDL 0.10 // Date: Tue Aug 21 12:53:38 2018 `timescale 1ns/10ps module fifo_mem ( wr, rd, data_in, fifo_full, fifo_empty, fifo_threshold, fifo_overflow, fifo_underflow, data_out, clk, rst_n, clear ); // Input: // wr(bool):write ...
#pragma GCC optimize( Ofast ) #include bits/stdc++.h typedef long long ll; using namespace std; #define sim template < class c #define ris return * this #define dor > debug & operator << #define eni(x) sim > typename enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) { sim > stru...
#include <bits/stdc++.h> using namespace std; int main(int argc, char *argv[]) { int n, tmp = 1, res = 1; cin >> n; int A[n][2]; for (int i = 0; i < n; i++) cin >> A[i][0] >> A[i][1]; for (int i = 0; i < n - 1; i++) { if ((A[i][0] == A[i + 1][0]) && (A[i][1] == A[i + 1][1])) { tmp+...
#include <bits/stdc++.h> using namespace std; const long long inf = 707406378; const int maxn = 1.5e7 + 10; void read(long long &x) { char ch; bool flag = 0; for (ch = getchar(); !isdigit(ch) && ((flag |= (ch == - )) || 1); ch = getchar()) ; for (x = 0; isdigit(ch); x = (x << 1) ...
#include <bits/stdc++.h> using namespace std; long long a[345678], b[456111], c, n, i, l, s = 0, k = 0, m, j, t, x, y; string p, q, r, rr; int main() { cin >> n >> m; for (i = 0; i < m; i++) { a[i] = n / m; } for (i = 1; i <= n % m; i++) a[i]++; for (i = 0; i < m; i++) { for (j =...
#include <bits/stdc++.h> using namespace std; int AA[100010]; int BB[100010]; long long dp[100010]; int N; vector<long long> M; vector<long long> B; bool bad(long long l1, long long l2, long long l3) { long double XX1 = 1.00000 * (M[l1] - M[l2]) / (M[l1] - M[l3]); long double XX2 = 1.00000 * (B[...
#include <bits/stdc++.h> #pragma GCC optimize( Ofast ) using namespace std; long long n, m, cnt[55], used[55], add[55]; bool vis[55]; vector<long long> v[55], p; pair<long long, long long> it[55]; long long fa[55]; long long getfa(long long x) { if (x == fa[x]) return x; else return ...
//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...
/** * 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 Datapath( output [3:0] FLAG_out, // Flag Bus output [WORD_WIDTH-1:0] A_bus, // Address out Bus output [WORD_WIDTH-1:0] D_bus, // Data out Bus output [WORD_WIDTH-1:0] D_bus_internal, // Internal data bus output for monitoring input [WORD_WIDTH-1:0] D_in, // Data in bus input [CNTRL_WIDTH-1...
#include <bits/stdc++.h> using namespace std; int lim = 1e6; int inf = 1e9 + 7; bool ispal(string s) { int n = s.size(); bool ans = true; for (int i = 0; i < n / 2; i++) { if (s[i] != s[n - i - 1]) { ans = false; break; } } return ans; } int main() { ios_b...
#include <bits/stdc++.h> using namespace std; int main() { int n, count = 0; cin >> n; for (int i = 0; i < n; i++) { int x; scanf( %1d , &x); if (x) { count++; continue; } break; } cout << min(count + 1, n); return 0; }
#include <bits/stdc++.h> using namespace std; char mat[110][110]; int main() { int r, c; int cnt = 0; int status = 0; int i, j; scanf( %d%d , &r, &c); for (i = 0; i < r; i++) { for (j = 0; j < c; j++) { scanf( %c , &mat[i][j]); } getchar(); } for (i = 0; ...
#include <bits/stdc++.h> using namespace std; int inf = (1 << 30) - 1, n, X, x, y, z, f[510][510], c[510], R, g[510][510], size[510], h[2][510], H[2][510][510], q[510], L[510]; int Lng[510]; double a[510][510]; vector<int> E[510]; void read(int &x) { char ch = getchar(); int mark = 1; for ...
/** * 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 main() { long long int t, n, i, ans, arr[100005]; ans = 0; cin >> n; for (i = 0; i < n; i++) cin >> arr[i]; for (i = 1; i < n; i++) { if (arr[i] < arr[i - 1]) ans += arr[i - 1] - arr[i]; } cout << ans; return 0; }
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed under the Creative Commons Public Domain, for // any use, without warranty, 2019 by Wilson Snyder. // SPDX-License-Identifier: CC0-1.0 `define stop $stop `define checkh(gotv,expv) do if ((gotv) !== (expv)) begin $write("%%Error: %s:%0d: got...
// ------------------------------------------------------------- // // Generated Architecture Declaration for rtl of inst_ee_e // // Generated // by: wig // on: Mon Apr 10 13:27:22 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; class p1328D { public: void solve() { int q; cin >> q; while (q--) { int n; cin >> n; vector<int> t(n); for (int i = 0; i < n; i++) cin >> t[i]; int sum = 1; for (int i = 1; i < n; i++) { ...
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; int n = s.length(); s += s; int ans = -1; int len = 1; for (int i = 1; i < 2 * n; i++) { if (s[i] != s[i - 1]) len++; else { if (len <= n) ans = max(len, ans); len = 1; ...
/** * This is written by Zhiyang Ong * and Andrew Mattheisen * for EE577b Troy WideWord Processor Project */ `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...
#include <bits/stdc++.h> using namespace std; template <typename T> string tos(T a) { stringstream ss; string ret; ss << a; ss >> ret; return ret; } int n, a; vector<int> arr; int main() { while (cin >> n) { arr.clear(); for (int(i) = (0); (i) < (n); (i)++) { ci...
#include <bits/stdc++.h> using namespace std; const int K = 64, N = 3e5 + 7; int a[N]; int sum[N]; int main() { ios::sync_with_stdio(0); cin.tie(0); int n; cin >> n; for (int i = 1; i <= n; i++) { long long x; cin >> x; a[i] = __builtin_popcountll(x); sum[i] = sum[i...
#include <bits/stdc++.h> using namespace std; const int mxN = 210; int n, a[mxN], pos[mxN][3]; int next(int i) { if (pos[a[i]][0] == i) return pos[a[i]][1]; return pos[a[i]][0]; } void upd(int u, int v) { if (pos[a[u]][0] == u) pos[a[u]][0] = v; else pos[a[u]][1] = v; } bool ...
/* Copyright (c) 2021 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,...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: Adam LLC // Engineer: Adam Michael // // Create Date: 20:40:34 09/08/2015 // Design Name: SN74LS195A Gate Level Module // Module Name: SN74LS195Agates ////////////////////////////////////////...
#include <bits/stdc++.h> using namespace std; int main() { long long int t; cin >> t; while (t--) { long long int n, rock = 0, peper = 0, sec = 0, de = 0; cin >> n; cin >> rock >> peper >> sec; string s, ans; cin >> s; for (long long int i = 0; i < n; i++) { i...
#include <bits/stdc++.h> using namespace std; int main() { int n, t, k, d, t1, t2, kol; bool f; f = false; cin >> n; cin >> t; cin >> k; cin >> d; t1 = 0; t2 = 0; kol = 0; while (kol < n) { t1++; if (t1 % t == 0) { kol = kol + k; } } kol ...
/** * 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 int N = 2e5 + 5; template <typename Arg1> void __f(const char* name, Arg1&& arg1) { cout << name << : << arg1 << n ; } template <typename Arg1, typename... Args> void __f(const char* names, Arg1&& arg1, Args&&... args) { const cha...
/** * 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 1ps / 1ps module main; reg clk = 0; always #1400 clk = !clk; reg [35:0] in = "1111111111111111111111111111111111"; reg [6:0] out; reg [6:0] out_golden; integer seed = 1234; integer rvec_file; integer ret; integer soe0 = 0; integer soe1 = 0; intege...
/* * The MIT License (MIT) * * Copyright (c) 2015 Stefan Wendler * * 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 us...
// DESCRIPTION: Verilator: Dedupe optimization test. // // This file ONLY is placed into the Public Domain, for any use, // without warranty. // SPDX-License-Identifier: CC0-1.0 // Contributed 2012 by Varun Koyyalagunta, Centaur Technology. // // Test consists of the follow logic tree, which has many obvious // plac...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); long long n, m, k, i; bool t = 0; cin >> n >> m >> k; if ((2 * m * n) % k > 0) cout << NO ; else { if (k == 2) cout << YES n0 0 n << n << 0 n0 << m; else ...
// Verilog netlist generated by Workcraft 3 module VME (d, lds, dtack, dsr, dsw, ldtack); input dsr, dsw, ldtack; output d, lds, dtack; wire U1_ON, IN_BUBBLE3_ON, IN_BUBBLE5_ON, U7_ON, IN_BUBBLE10_ON, OUT_BUBBLE1_ON, U14_ON, IN_BUBBLE16_ON, IN_BUBBLE18_ON, U20_ON, IN_BUBBLE23_ON, IN_BUBBLE25_ON, IN_BUBBLE28...
`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 15:35:03 06/30/2013 // Design Name: qadd // Module Name: I:/Projects/xilinx/FPInterface/Tester/Tran3005/Tes_add.v // Project Name: Trancendental // Target ...
module SingleCycleProcessor ( output reg [31:0] PC, output reg [31:0] datain, output reg [31:0] address, output reg MW, input [31:0] instruction, input [31:0] dataout, input clk, input reset_n ); reg [31:0] nextPC, counter, nextReg, seIM, zfIM; reg [31:0] R[0:31]; reg RW; wire [14:0] IM;...
#include <bits/stdc++.h> using namespace std; int main() { int a, b; cin >> a >> b; int result = a; int temp = 0; while ((a + temp) >= b) { int t1 = temp; result += (a + temp) / b; temp = (a + temp) % b; a = (a + t1) / b; } cout << result << 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 la...
///////////////////////////////////////////////////////////// // Created by: Synopsys DC Ultra(TM) in wire load mode // Version : L-2016.03-SP3 // Date : Sun Nov 20 02:54:52 2016 ///////////////////////////////////////////////////////////// module GeAr_N8_R1_P5 ( in1, in2, res ); input [7:0] in1; input [7:...
#include <bits/stdc++.h> using namespace std; long long used[100001], last, a[100001]; vector<long long> v[1000001], verr[100001]; void build(long long tv, long long tl, long long tr) { if (tl == tr) v[tv].push_back(used[tl]); else { long long tm = (tl + tr) / 2; build(tv * 2, tl, tm);...
#include <bits/stdc++.h> using namespace std; vector<int> vec; int result[50000]; int MIN(int i, int j) { int ans = 1e9; for (int a = i; a <= j; a++) { ans = min(ans, vec[a]); } return ans; } int main() { int n, m; scanf( %d %d , &n, &m); for (int i = 0; i < (n); i++) vec.p...
#include <bits/stdc++.h> using namespace std; constexpr int N = 3e3 + 1; int a[N], nxt[N], prv[N], lst[N]; uint16_t dp[N][N]; int main() { cin.tie(0), ios::sync_with_stdio(0); int t, n; cin >> t; while (t--) { cin >> n; for (int i = 0; i < n; ++i) { cin >> a[i], --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; const int mv4[4][2] = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}}; const int mv8[8][2] = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}, {1, 1}, {1, -1}, {-1, 1}, {-1, -1}}; const int inf = (int)1e9; const char *boo[2] = { NO , YES }; const char *inv = Imp...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n, i; cin >> n; int la, ra; int cnt00 = 0, cnt01 = 0, cnt10 = 0, cnt11 = 0; for (i = 0; i < n; i++) { cin >> la >> ra; if (la == 1) { if (ra == 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...
#include <bits/stdc++.h> using namespace std; string s[11]; int a[11]; int n, k; int ans = 0x7fffffff; string t[11]; int num[11]; int main() { cin >> n >> k; for (int i = 0; i < n; i++) { cin >> s[i]; } for (int i = 0; i < k; i++) { a[i] = i; } do { for (int i =...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 00:38:56 06/14/2016 // Design Name: // Module Name: LZD_16bit // Project Name: // Target Devices: // Tool versions: // Description: // // Depen...
#include <bits/stdc++.h> using namespace std; long long gcd(long long a, long long b) { if (b == 0LL) return a; return gcd(b, a % b); } long long bigmod(long long a, long long b, long long mod) { if (b == 0LL) return 1LL; long long sq = bigmod(a, b / 2LL, mod); sq = (sq * sq) % mod; if (...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long int n; cin >> n; long long int arr[n], i, c = 0; for (i = 0; i < n; i++) { cin >> arr[i]; if (arr[i] == 1) c++; } if (c == n) { for (i = 0; i < n - ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; string s1, s2; cin >> s1 >> s2; int flag = 0; if (n % 2 != 0) flag = 1; int mid; if (flag) mid = (n + 1) / 2; else mid = n / 2; int cnt = 0; for (int i = 0; i < n / 2; i++) { int...
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 100, LEN = 21, M = 1 << LEN, inF = N * 30; int n, len, ps[N], dp0[N], dp1[N], mini[M][LEN]; string s[N]; void _min(int &a, int b) { a = min(a, b); } int same(string a, string b) { int A = 0, B = 0, res = 0; for (int i = 0; i < len; i+...
#include <bits/stdc++.h> using namespace std; int main() { int n, i, sum, sum1, count = 1; cin >> n; int arr[4 * n + 1]; arr[0] = 0; for (i = 1; i <= 4 * n - 3; i = i + 4) { cin >> arr[i] >> arr[i + 1] >> arr[i + 2] >> arr[i + 3]; if (i == 1) sum = arr[1] + arr[2] + arr[3] + ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; string s = ; vector<int> fib; fib.push_back(1); fib.push_back(1); for (int i = 2; i < 17; ++i) { fib.push_back(fib[i - 1] + fib[i - 2]); } for (int i = 1; i <= n; ++i) { if (binary_search(fi...
/** * 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 n; int k = 1; int r = 0; int index1, index2; cin >> n; vector<pair<pair<int, int>, pair<int, int>>> s(n); vector<int> t(3); for (int i = 0; i < n; i++) { scanf( %i%i%i , &t[0], &t[1], &t[2]); sort(t.begin(), 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...
#include <bits/stdc++.h> using namespace std; struct pvec { long long int x, y; pvec(long long int x = 0, long long int y = 0) : x(x), y(y) {} pvec operator-(pvec p) { return pvec(x - p.x, y - p.y); } bool operator==(pvec p) { return x == p.x and y == p.y; } long long int dot(pvec p) { return x ...
module piano(sound, t0,t1,t2,t3,t4,t5,t6,t7,clk); output wire[7:0] sound; input t0,t1,t2,t3,t4,t5,t6,t7,clk; wire [7:0] Chord; wire [7:0] freq; wire[3:0] sim,n; wire [7:0] wave1,wave2,wave3,wave4,wave5,wave6,wave0,wave7; wire ci0,ci1,ci2,ci3,ci4,ci5; wire [7:0]clks; wire [15:0]wavef; assign ...
#include <bits/stdc++.h> using namespace std; int main() { long long A, B; int N; long long l, r, t, tt, M; cin >> A >> B >> N; for (int i = 0; i < N; i++) { scanf( %I64d%I64d%I64d , &l, &t, &M); long long st = l, ed = l + 1000000; long long H = A + (l - 1) * B; long long...
#include <bits/stdc++.h> using namespace std; struct seg { int l, r, i; bool operator<(const seg& b) const { return l < b.l; } }; int n, k; seg a[200005]; bool u[400005]; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); cerr.tie(nullptr); cin ...
#include <bits/stdc++.h> using namespace std; int n, m, ans; vector<int> v[100010]; int main() { cin >> n >> m; for (int i = 1; i <= m; ++i) { int x, y; scanf( %d%d , &x, &y); v[x].push_back(y); v[y].push_back(x); } for (int i = 1; i <= n; ++i) ans += v[i].size() % 2; ...
#include <bits/stdc++.h> using namespace std; long long get(long long r) { return (r + 1) * r / 2; } long long sumto(long long r, int need) { long long pw = 1; long long sum = 0; long long add = 0; for (int len = 1;; ++len) { if (pw * 10 - 1 < r) { long long cnt = pw * 10 - pw; ...
#include <bits/stdc++.h> using namespace std; int main() { int n, i, j, line[35], column[35], var, count; cin >> n; for (i = 1; i <= n; ++i) line[i] = column[i] = 0; for (i = 1; i <= n; ++i) for (j = 1; j <= n; ++j) { cin >> var; line[i] += var; column[j] += var; ...
// ============================================================================= // 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 main() { int t; cin >> t; while (t--) { long long ans1, ans2; long long n, m; cin >> n >> m; ans1 = n * m / 2; ans2 = ans1; if (n * m % 2) ans1++; long long x1, y1, x2, y2; cin >> x1 >> y1 >> x2 >> y2; ...
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 5; const long long INF = 1e18; struct P { int id; long long dis; friend bool operator<(P a, P b) { return a.dis > b.dis; } }; int n, m, q, x[N], y[N], t[N], l[2][N], id[N], c; long long d[2][N], ans[N], pre[N]; vector<long lon...
#include <bits/stdc++.h> using namespace std; const int mod = 998244353; int sum(int a, int b) { int s = a + b; if (s >= mod) s -= mod; return s; } int sub(int a, int b) { int s = a - b; if (s < 0) s += mod; return s; } int mult(int a, int b) { return (1LL * a * b) % mod; } int 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 la...
/* ---------------------------------------------------------------------------------- Copyright (c) 2013-2014 Embedded and Network Computing Lab. Open SSD Project Hanyang University All rights reserved. ---------------------------------------------------------------------------------- Redistribution and use ...
// (c) Copyright 1995-2015 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 ...
// ------------------------------------------------------------- // // File Name: hdlsrc\qpskhdltest\QPSK_Demodulator_Baseband.v // Created: 2014-04-21 15:30:34 // // Generated by MATLAB 8.2 and HDL Coder 3.3 // // ------------------------------------------------------------- // -----------------------------------...
#include <bits/stdc++.h> using namespace std; int n; int a[1005]; int main() { cin >> n; int x; int ans = 0; if (n == 1) { cin >> x; if (x) cout << YES << endl; else cout << NO << endl; return 0; } for (int i = 0; i < n; i++) { cin >> x; ...
#include <bits/stdc++.h> using namespace std; int arr[200005]; int main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; for (int i = 0; i < n; i++) cin >> arr[i]; sort(arr, arr + n); int now = arr[0], cnt = 1; set<int> sup; stack<int> sdown; sup.insert(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...
/* * 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...
// Nonstop version of loop // Always keeps looping when increase == true // At end is a signal to indicate the next cycle is end // Use that to signal parent loop to advance. `define NONSTOP_LOOP(iter, width, init, ready, finish, min, extent)\ reg [width-1:0] iter;\ wire finish;\ always@(posedge clk) begin\...
/** * 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 MAXN = 100005; template <typename T> inline void read(T &AKNOI) { T x = 0, flag = 1; char ch = getchar(); while (!isdigit(ch)) { if (ch == - ) flag = -1; ch = getchar(); } while (isdigit(ch)) { x = x * 10 + ch - 0 ; ...
#include <bits/stdc++.h> using namespace std; const int B = 27397, MOD = 1e9 + 7; const int B1 = 33941, MOD1 = 1e9 + 9; int n, q; struct Node { int nxt[11]; long long sum[11]; Node() { for (int i = 0; i < 10; ++i) nxt[i] = i; memset(sum, 0, sizeof sum); } }; class Tournament { ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> ans(n); int a1, a2, a3; cout << ? 1 2 << endl; fflush(stdout); cin >> a1; cout << ? 1 3 << endl; fflush(stdout); cin >> a2; cout << ? 2 3 << endl; fflush(stdout); cin >> ...
// $Header: /devl/xcs/repo/env/Databases/CAEInterfaces/versclibs/data/rainier/LUT6_2.v,v 1.4 2007/06/19 19:47:31 yanx Exp $ /////////////////////////////////////////////////////////////////////////////// // Copyright (c) 1995/2004 Xilinx, Inc. // All Right Reserved. /////////////////////////////////////////////////////...
#include <bits/stdc++.h> using namespace std; int n, m, w, h; set<int> Set[2]; set<int>::iterator iter; priority_queue<int> qu[2]; int vis[2][200010], point[2][200010]; char s[10]; int main() { int i, j, k, l, r, p, a, b; long long ans; scanf( %d%d%d , &w, &h, &k); Set[0].insert(0); ...
// unsaved.v // Generated using ACDS version 17.0 595 `timescale 1 ps / 1 ps module unsaved ( input wire clk_clk, // clk.clk input wire [4:0] pc_address, // pc.address input wire pc_debugaccess, // .debugaccess input wire pc_clken, // .clken inpu...
/** * 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 a, b, c; int main() { scanf( %d %d %d n , &a, &b, &c); if (a == b && c == 0) printf( YES n ); else if ((a != b && c == 0) || (a > b && c > 0) || (a < b && c < 0)) printf( NO n ); else { if ((b - a) % c == 0) printf( YES n ...
// ---------------------------------------------------------------------- // HLS HDL: Verilog Netlister // HLS Version: 2011a.126 Production Release // HLS Date: Wed Aug 8 00:52:07 PDT 2012 // // Generated by: fyq14@EEWS104A-002 // Generated date: Tue Mar 03 15:18:49 2015 // -------------------...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; if (n < 3) cout << -1; else for (int i = n; i > 0; --i) { cout << i << ; } return 0; }
/*------------------------------------------------------------------------------ * 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; template <typename T> inline bool smin(T &a, const T &b) { return b < a ? a = b, 1 : 0; } template <typename T> inline bool smax(T &a, const T &b) { return a < b ? a = b, 1 : 0; } const long long N = 1e5 + 100, lg = 22; long long n, k, add[N], h[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...
#include <bits/stdc++.h> using namespace std; int a[100001]; stack<int> st; int main() { ios::sync_with_stdio(0); int n; cin >> n; long long int sum = 0; for (int i = 0; i < n; i++) cin >> a[i]; sum += a[0]; for (int i = 1; i < n; i++) sum += max(a[i] - a[i - 1], 0); cout << sum ...
module PLLE2_BASE (/*AUTOARG*/ // Outputs LOCKED, CLKOUT0, CLKOUT1, CLKOUT2, CLKOUT3, CLKOUT4, CLKOUT5, CLKFBOUT, // Inputs CLKIN1, RST, PWRDWN, CLKFBIN ); parameter BANDWIDTH = 0; parameter CLKFBOUT_MULT = 0; parameter CLKFBOUT_PHASE = 0; parameter CLKIN1_PERIOD = 0; parameter CLKOUT0...
/** * 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; const long long mod = 1e9 + 7; long long modpow(long long a, long long x) { long long tmp = x; long long val = a; long long ret = 1LL; while (tmp > 0) { if (tmp % 2 == 1) ret = ret * val % mod; val = val * val % mod; tmp /= 2; } ...
module control_div( clk , rst , start , MSB , z , INIT , SH , DEC , LDA , DONE, DV0 ); input clk; input rst; input start; input MSB; input z; output reg INIT; output reg DV0; output reg SH; output reg DEC; output reg LDA; output reg DONE; parameter START = 3'b000; parameter SHIFT_DEC = 3'b001; par...