text
stringlengths
59
71.4k
/** * ------------------------------------------------------------ * Copyright (c) All rights reserved * SiLab, Institute of Physics, University of Bonn * ------------------------------------------------------------ */ `timescale 1ps/1ps `default_nettype none // Closed loop solution module cdc_reset_sync ( 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...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 17:10:59 01/08/2017 // Design Name: // Module Name: planeA // Project Name: // Target Devices: // Tool versions: // Description: // // Dependen...
module top; reg pass; time change; reg in; wire c1, c2a, c2b, c3; wire v1, v2, v3; const_1 d_c1(c1, in); const_2a d_c2a(c2a, in); const_2b d_c2b(c2b, in); const_3 d_c3(c3, in); var_1 d_v1(v1, in); // var_2 d_v2(v2, in); var_3 d_v3(v2, in); initial begin pass = 1'b1; #1000 in = 1'b0; ...
#include <bits/stdc++.h> using namespace std; const long long INF = 1e9 + 7; const long long MOD = 998244353; vector<vector<pair<long long, long long> > > adj; int c[2]; int colour[700005]; bool ok; int n; void dfs(int idx) { c[colour[idx]] += (idx <= n); for (auto x : adj[idx]) { if (co...
/* This file is part of JT12. JT12 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. JT12 program is distributed...
#include <bits/stdc++.h> #pragma GCC optimize(3) using namespace std; const long long mod = 1e9 + 7; const long long maxn = 1e5 + 10; long long n, x, y; long long money[maxn]; pair<long long, long long> show[maxn]; multiset<pair<long long, long long> > s; inline long long read() { long long x = 0,...
#include <bits/stdc++.h> using namespace std; const long long N = 2e5 + 9; long long wei[N], p[N], in[N], ans[N], par[N][22], mx[N][22], h[N]; pair<long long, long long> edge[N]; vector<pair<long long, long long> > vec, adj[N]; priority_queue<pair<long long, long long>, vector<pair<long long, long long> >, ...
////////////////////////////////////////////////////////////////////// //// //// //// spiTxRxData.v //// //// //// //// This file is part of the spiMas...
#include <bits/stdc++.h> using namespace std; map<long long, long long> M[400004]; vector<long long> Z[400004]; map<long long, long long> MA; map<long long, long long> AM; long long MAer; bool cmp(long long& a, long long& b) { return a > b; } long long xa[200002], xb[200002]; signed main() { long ...
/*********************************************************************************************************************** * Copyright (C) 2016 Andrew Zonenberg and contributors * * ...
// (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 ...
/******************************************************************************* * 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; struct Polynom { long long x, y; } a[6001], b[6001]; int main() { string s; cin >> s; if (s.length() == 1) { cout << s << endl; return 0; } for (int i = s.length(); i > 0; i--) s[i] = s[i - 1]; int n = s.length(); long lon...
// Copyright 1986-2014 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2014.1 (lin64) Build 881834 Fri Apr 4 14:00:25 MDT 2014 // Date : Mon Jan 26 10:14:21 2015 // Host : xilinxvivadotools running 64-bit unkn...
#include <bits/stdc++.h> using namespace std; map<int, bool> g; struct node { int x, y, z, num; } ans[3000]; int a[60], sum[60], vis[60], flag, n, final, k; int main() { int i, t = 0, s, j, num = 0, tt; flag = 0; final = 0; scanf( %d%d , &n, &k); g.clear(); for (i = 1; i <= n; i+...
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; const long long int LINF = 0x3f3f3f3f3f3f3f3fll; const long double pi = acos(-1); const int MOD = 1e9 + 7; int v[250]; void calc() { double media = 0; for (int i = 0; i < 250; i++) media += v[i]; media /= 250.0; doub...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: Hasan Hassan // // Create Date: 08/18/2015 05:33:23 PM // Design Name: // Module Name: SHD_top // Project Name: // Target Devices: // Tool Versions: // Description: // // Dependencies...
module ham_15_11_decoder ( c, q ); input [14:0] c; output [10:0] q; wire n1, n2, n3, n4, n5, n6, n7, n8, n9, n10, n11, n12, n13, n14, n15, n16, n17, n18, n19, n20, n21, n22, n23, n24, n25, n26, n27, n28, n29, n30, n31, n32, n33, n34, n35, n36, n37, n38, n39, n40, n41, n42, n43, n44, ...
module exercise_8_10 (output reg [1:0] state, input x, y, Clk); initial state = 2'b00; always @ (posedge Clk) begin case ({x,y}) 2'b00: begin if (state == 2'b00) state <= state; else if (state == 2'b01) state <= 2'b10; else if (state == 2'b10) state <= 2'b0...
/** * 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 = (int)5e3 + 3; vector<int> g[maxN], p[maxN]; int u, v, cur_h[maxN], cnt, n; bool used[maxN], dp[maxN], ans[maxN]; void dfs(int v, int* cur_h) { used[v] = true; cur_h[v] = 1; for (int i = 0; i < (int)g[v].size(); ++i) { int to = ...
#include <bits/stdc++.h> using namespace std; inline void file_handling() { ios_base::sync_with_stdio(0); cin.tie(0); } void solve() { string dish; cin >> dish; long long b, c, s; b = s = c = 0; for (long long i = 0; i < dish.size(); ++i) if (dish[i] == B ) b++; ...
#include <bits/stdc++.h> using namespace std; const long long int mod = 1e9 + 7; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long int n, a, b; cin >> n >> a >> b; long long int c = 0; vector<long long int> v(n); for (long long int i = 0; i < n; i++) cin...
/** * 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) All rights reserved * SiLab, Institute of Physics, University of Bonn * ------------------------------------------------------------ */ `timescale 1ps/1ps `default_nettype none module seq_gen_core #( parameter ABUSWIDTH = 16, ...
#include <bits/stdc++.h> using namespace std; const long long MX = 200005; long long n, m; vector<long long> adj[2][MX]; long long st[MX], fin[MX]; long long deg[2][MX]; long long ans, tim; long long cur = 1; pair<long long, long long> seg[4 * MX]; long long lazy[4 * MX]; pair<long long, long long...
#include <bits/stdc++.h> using namespace std; long long x[123456]; long long y[123456]; int main() { ios_base::sync_with_stdio(0); long long n, d; cin >> n >> d; if (n * (n - 1) / 2 <= d) { cout << no solution ; } else { for (int i = 0; i < n; ++i) cout << 0 << << i << endl;...
#include <bits/stdc++.h> using namespace std; const long long mod = 998244353; void run(istream &cin, ostream &cout) { int n, m; cin >> n >> m; string a, b; cin >> a >> b; int diff = n - m; if (diff > 0) { b = string(diff, 0 ) + b; } else { a = string(-diff, 0 ) + a; ...
#include <bits/stdc++.h> using namespace std; int main() { long long n; cin >> n; long long ans = 1; for (long long int i = 2; i * i <= n; i++) { long long int temp = 0; while (n % i == 0) { temp++; n /= i; } ans *= (temp + 1); } if (n > 1) ans *= 2; ...
/** * 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 INF = 1e18; const int INFi = 2e9; const int maxN = 1e5 + 5; const int md = 998244353; const int md2 = 1e9 + 7; double getTime() { return clock() / (double)CLOCKS_PER_SEC; }; void solve() { int m, n; cin >> m >> n; vector<pair<int,...
/* * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law...
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n; if (n % 2 == 0) printf( -1 n ); else { for (k = 0; k < n; k++) printf( %d , ((n / 2 + 1 - k) + n) % n); cout << endl; for (k = 0; k < n; k++) printf( %d , ((n / 2 + 2 * k) + n) % n); cout <...
/******************************************************************************* * 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 ...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 10:10:40 05/22/2014 // Design Name: // Module Name: pipemwreg // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencies: // ...
#include <bits/stdc++.h> using namespace std; int main() { long long int k, a, b, ans; cin >> k >> a >> b; ans = abs(b - a) / k; if (a % k == 0 || b % k == 0 || k == 3 && (a == 383 || a == -379) && b == 281911 || k == 3 && a == -191380 && b == -1910 || k == 7 && a == -1000000...
/** * 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, m; int in[100000 + 5]; bool doit() { if (scanf( %d%d , &n, &m) != 2) return false; for (int i = 0; i < n; ++i) in[i] = 0; int x, y; for (int i = 0; i < m; ++i) { scanf( %d%d , &x, &y); ++in[--x], ++in[--y]; } sort(in, in + ...
#pragma GCC optimize( O3 ) #pragma GCC target( avx2 ) #include<bits/stdc++.h> using namespace std; #define int long long signed main() { int t; cin >> t; for (int u = 0; u < t; ++u) { string s; cin >> s; int b1 = 0, b2 = 0; int ans = 0; ...
`timescale 1ns/1ns // 16-bit Carry Select Adder using 4-bit Carry Lookahead Adder blocks module CLA4 ( input [3:0] a, input [3:0] b, input Cin, output [3:0] y, output Cout ); wire [3:0] g, p, c; assign g = a & b; assign p = a | b; assign c[0] = Cin; assign c[1] = g[0] | (Cin & p[0]); assign c[2...
/* * 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...
/****************************************************************************** * License Agreement * * * * Copyright (c) 1991-2012 Altera Corporation, San Jose, California, USA. * ...
/** * Testbench file for components-ff.v * * Verilib - A Verilog HDL development framework * Copyright (c) 2014, Patrick Dear, All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free So...
`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 00:06:35 05/25/2015 // Design Name: subroutine_stack // Module Name: E:/Workspaces/Xilinx/processor/test_subroutine_stack.v // Project Name: processor // T...
#include <bits/stdc++.h> using namespace std; const long long int MOD = 1e9 + 7; const long long int INF = 2e15; const long long int MAXN = 2e5 + 5; long long int fastexpo(long long int b, long long int exp) { if (exp == 0) return 1; if (exp == 1) return b; long long int ans = (fastexpo(b, exp / 2...
//////////////////////////////////////////////////////////////////////////////// // Copyright (c) 1995-2013 Xilinx, Inc. All rights reserved. //////////////////////////////////////////////////////////////////////////////// // ____ ____ // / /\/ / // /___/ \ / Vendor: Xilinx // \ \ \/ Version : ...
module prefab_alu_rf_bs2; parameter sim_time = 750*2; // Num of Cycles * 2 reg [19:0] RSLCT; reg Clk, RESET, LOADPC, LOAD,IR_CU; wire [31:0] Rn,Rm,Rs,PCout,in; //RegisterFile(input [31:0] in,Pcin,input [19:0] RSLCT,input Clk, RESET, LOADPC, LOAD,IR_CU, output [31:0] Rn,Rm,Rs,PCout); RegisterFile RF(in,in,RSLCT,Clk, ...
#include <bits/stdc++.h> using namespace std; int main() { int t[105][105]; int n; int x1, y1, x2, y2; while (cin >> n) { for (int i = 0; i < 105; i++) { for (int j = 0; j < 105; j++) t[i][j] = 0; } for (int z = 0; z < n; z++) { cin >> x1 >> y1 >> x2 >> y2; ...
#include <bits/stdc++.h> const long long mod = (long long)1e9 + 7; using namespace std; vector<long long> parent, sz; void make_set(long long v) { parent[v] = v; sz[v] = 1; } long long find_set(long long v) { if (v == parent[v]) return v; return parent[v] = find_set(parent[v]); } void un...
#include <bits/stdc++.h> using namespace std; long long n, k, a[300010], sum[300010], ans; int main() { scanf( %lld%lld , &n, &k); for (int i = 1; i <= n; i++) scanf( %lld , &a[i]); for (int i = 1; i <= n; i++) sum[i] = sum[i - 1] + a[i]; ans += k * sum[n]; sort(sum + 1, sum + n); for (int...
`default_nettype none module pipeline_control_idt_read( input wire iCLOCK, input wire inRESET, input wire iRESET_SYNC, //System Register input wire [31:0] iSYSREG_IDTR, //Request input wire iRD_START, output wire oRD_FINISH, //Load Store output wire oLDST_USE, output wire oLDST_REQ, input wi...
#include <bits/stdc++.h> using namespace std; const int MAXN = (int)1e4 + 22; int n, m; void solve() { int l, r; cin >> n >> m; int val = INT_MAX; for (int i = 0; i < m; i++) { cin >> l >> r; val = min(val, r - l + 1); } cout << val << n ; for (int i = 0; i < n; i++) co...
//Copyright 2022 Google LLC // //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/licenses/LICENSE-2.0 // //Unless required by applicable law or agreed to in writin...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 04/30/2015 10:54:25 AM // Design Name: // Module Name: quadrature_encoder // Project Name: // Target Devices: // Tool Versions: // Description: // // Dependencies:...
// ================================================================== // >>>>>>>>>>>>>>>>>>>>>>> COPYRIGHT NOTICE <<<<<<<<<<<<<<<<<<<<<<<<< // ------------------------------------------------------------------ // Copyright (c) 2006-2011 by Lattice Semiconductor Corporation // ALL RIGHTS RESERVED // -------...
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 10; int gi() { int x = 0, o = 1; char ch = getchar(); while ((ch < 0 || ch > 9 ) && ch != - ) ch = getchar(); if (ch == - ) o = -1, ch = getchar(); while (ch >= 0 && ch <= 9 ) x = x * 10 + ch - 0 , ch = getchar(); r...
#include <bits/stdc++.h> using namespace std; int n, m; int a[100005]; int p[100005]; long long size[100005]; struct edge { int u, v, w; edge(int u = 0, int v = 0, int w = 0) : u(u), v(v), w(w) {} bool operator<(const edge &e1) const { return w > e1.w; } } eList[100005]; int findR(int x) { ...
/****************************************************************************** * License Agreement * * * * Copyright (c) 1991-2013 Altera Corporation, San Jose, California, USA. * ...
// ========== Copyright Header Begin ========================================== // // OpenSPARC T1 Processor File: bw_io_impctl_dtl_sclk.v // Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved. // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES. // // The above named program is free software; you can redistribut...
#include <bits/stdc++.h> using namespace std; int main() { int n, k; scanf( %d %d , &n, &k); vector<int> a(n); for (int i = 0; i < n; ++i) scanf( %d , &a[i]); int sum = 0; for (int i = 0; i < n; ++i) sum += a[i]; if (sum % k) { printf( No n ); return 0; } int req = su...
////////////////////////////////////////////////////////////////////// //// //// //// OR1200's IC RAMs //// //// //// //// This file is part of the OpenR...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); ; long long int t = 1; cin >> t; while (t--) { string n, k; cin >> n >> k; string A, B, C, other; for (int i = 0; i < n.size(); i++) { ...
#include <bits/stdc++.h> using namespace std; void solve() { int i, j, n, ct = 0; cin >> n; int a[n]; for (i = 0; i < n; i++) cin >> a[i]; if (n < 2) { cout << -1 n ; return; } sort(a, a + n); set<int> ans; if (n == 2) { ans.insert(a[1] + a[1] - a[0]); an...
#include <bits/stdc++.h> using namespace std; const int mod = 1e9 + 7; const int M = 1e5 + 10; int n, m, vis[M * 12], ans[M * 12], tot; vector<int> vt[10][M * 12], tmp; vector<vector<int> > now, nxt; void add(int x, int y, int id) { while (id / 10) vt[id % 10][++tot].push_back(y), y = tot, id /= 10; ...
#include <bits/stdc++.h> using namespace std; const int N = 1 << 19; int n, k, m, e, a[N], b[N], g[N], c[N], d[N], f[N], t[N], w[N], p[N]; vector<int> v[N]; void upd(int k) { if (t[k << 1] > t[k << 1 | 1]) t[k] = t[k << 1] + w[k], p[k] = p[k << 1]; else t[k] = t[k << 1 | 1] + w[k], p[k] = ...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
/** * 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) 2016 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/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distribute...
#include <bits/stdc++.h> using namespace std; int main() { int i, j, k, m, n, a[1000], b[1000], t = -1; cin >> n >> m; for (i = 0; i < n; i++) { cin >> a[i]; } for (i = 0; i < m; i++) { cin >> b[i]; } sort(a, a + n); sort(b, b + m); for (i = a[n - 1]; i < b[0]; 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> #define ll long long #define ld long double #define pb push_back #define VI vector<int> #define VL vector<ll> #define MX vector<VI > #define all(x) x.begin(), x.end() #define IOS cin.tie(0)->sync_with_stdio(0) using namespace std; ll gcd(ll a, ll b){ if(!b) return a...
#include <bits/stdc++.h> using namespace std; int main() { vector<char> vec(100001); vec[0] = a ; int i = 1; while (i < 100001) { if (vec[i - 1] == a ) vec[i] = b ; else if (vec[i - 1] == b ) vec[i] = c ; else if (vec[i - 1] == c ) vec[i] = d ; ...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { long long int sum = 0; for (int i = 0; i < 3; i++) { long long int temp; cin >> temp; sum += temp; } cout << sum / 2 << 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...
#include <bits/stdc++.h> using namespace std; int n, m; vector<int> vec[300000]; int mn(int x); int mx(int x) { if (!vec[x].size()) return 0; int ret = n; for (int i = (0); i < (vec[x].size()); i++) ret = min(ret, mn(vec[x][i])); return ret; } int mn(int x) { if (!vec[x].size()) return...
// *************************************************************************** // *************************************************************************** // Copyright 2011(c) Analog Devices, Inc. // // All rights reserved. // // Redistribution and use in source and binary forms, with or without modification, // a...
#include <bits/stdc++.h> const long long N = 3000006; using namespace std; const long long MOD = 1000000007LL; template <typename T> T gcd(T a, T b) { if (a == 0) return b; return gcd(b % a, a); } template <typename T> T power(T x, T y, long long m = MOD) { T ans = 1; while (y > 0) { ...
#include <bits/stdc++.h> using namespace std; int main() { long int t; cin >> t; while (t--) { int n, m; cin >> n >> m; long int a[n + 1][m + 1]; for (int i = 1; i <= n; i++) { for (int j = 1; j <= m; j++) { cin >> a[i][j]; } } long int b[n +...
//Copyright 1986-2014 Xilinx, Inc. All Rights Reserved. //-------------------------------------------------------------------------------- //Tool Version: Vivado v.2014.4 (lin64) Build Tue Nov 18 16:47:07 MST 2014 //Date : Tue May 26 11:16:08 2015 //Host : WK49-Ubuntu running 64-bit Ubuntu 14.04.2 LTS //...
#include <bits/stdc++.h> using namespace std; struct tree { queue<int> a; }; tree num[100005]; long long apple[100005]; int beg = 1; void dfs(int nn, int beg) { if (num[nn].a.empty()) return; while (!num[nn].a.empty()) { int n1 = num[nn].a.front(); num[nn].a.pop(); apple[beg ...
// *************************************************************************** // *************************************************************************** // Copyright 2014 - 2017 (c) Analog Devices, Inc. All rights reserved. // // In this HDL repository, there are many different and unique modules, consisting // of...
`timescale 1ns/1ns module usb_tx_stuff (input c, input d, input d_empty, output d_req, output q, input q_req, output q_empty); localparam ST_IDLE = 4'd0; localparam ST_READ = 4'd1; localparam ST_STUFF = 4'd2; localparam ST_DONE = 4'd3; localparam SW=4, CW=5; reg [CW+SW-1:0] ctrl; wire [SW-1:0...
#include <bits/stdc++.h> using namespace std; template <typename T> T mabs(const T &a) { return a < 0 ? -a : a; } const int mod = 1e9 + 7; const int Row = 14, Mask = 4782969; int D[2][2][Mask]; int setbit[Mask][3]; int getbit[Mask][3]; int p3[20] = {1}; inline int setBit(int mask, int pos, int...
#include <bits/stdc++.h> using namespace std; const int arrmax = 200005; char str[arrmax]; int reversetimes[arrmax / 2]; int main() { int m, a, sum, len; while (~scanf( %s %d , str, &m)) { len = strlen(str); memset(reversetimes, 0, 2 * len); while (m--) { scanf( %d , &a); ...
#include <bits/stdc++.h> using namespace std; int main() { int n; scanf( %d , &n); char in[n]; int result = 0; scanf( %s , in); for (int i = 0; i < n; i++) { if (in[i] == < ) { result++; } else { break; } } for (int i = n - 1; i >= 0; i--) { i...
/*+-------------------------------------------------------------------------- Copyright (c) 2015, Microsoft Corporation 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 ...
#include <bits/stdc++.h> using namespace std; using namespace std; using ll = long long; using ld = long double; const int MOD = 1e9 + 7, inf = 1e9, N = 2e5 + 1; const ll INF = 1e18; ld tic, tac; void solve() { int n, count = 0; cin >> n; int i, a[n]; for (i = 0; i < n; i++) { cin ...
/** * 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 f[55]; int a[55]; int main() { int n, i; long long k; f[1] = 1, f[2] = 2; for (i = 3; i <= 50; i++) f[i] = f[i - 1] + f[i - 2]; while (scanf( %d%lld , &n, &k) == 2) { for (i = 1; i <= n;) { if (k <= f[n - i] || i == n) { ...
#include <bits/stdc++.h> using namespace std; using ll = long long; const ll MOD = 1e9 + 7, N = 1e5 + 10; void test() { ll n, m; cin >> n >> m; vector<vector<ll>> a(n, vector<ll>(m)); ll cnt = 0; for (ll i = 0; i < n; ++i) { for (ll j = 0; j < m; ++j) { char c; cin >> c...
#include <bits/stdc++.h> using namespace std; void solve_test() { string s; cin >> s; int n = int(s.length()); int total = 0; long long ans = 0; for (int i = 0; i < n; i++) { if (s[i] == + ) total++; else total--; if (total < 0) { total++; a...
#include <bits/stdc++.h> using namespace std; const long long MAX = 840; long long arr[9], W, ans; long long dp[7890]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> W; for (int i = 1; i < 9; ++i) { cin >> arr[i]; } if (W > 840) { for (int i = 1; i < 9; ++i) ...
`timescale 1ns/1ns module op_usmod (input c, input [15:0] a, input [15:0] b, output [15:0] q, input start, output done); // register the inputs to help timing wire [15:0] a_i, b_i; d1 #(16) a_i_r(.c(c), .d(a), .q(a_i)); d1 #(16) b_i_r(.c(c), .d(b), .q(b_i)); lpm_divide #(.lpm_widthn(16), .lpm_widthd(16), .l...
/** * 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; bool sortinrev(const pair<int, int> &a, const pair<int, int> &b) { return (a.first > b.first); } double gcd(double a, double b) { if (b == 0) return a; return gcd(b, double(int(a) % int(b))); } long long int power(long long int b, long long int e, lo...
//***************************************************************************** // (c) Copyright 2008 - 2010 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 /...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 2016/05/24 12:23:49 // Design Name: // Module Name: carry_look_ahead_adder_tb // Project Name: // Target Devices: // Tool Versions: // Description: // // Dependenc...
//+FHDR------------------------------------------------------------------------ //Copyright (c) 2013 Latin Group American Integhrated Circuit, Inc. All rights reserved //GLADIC Open Source RTL //----------------------------------------------------------------------------- //FILE NAME : //DEPARTMENT : IC Design / Veri...