text
stringlengths
59
71.4k
#include <bits/stdc++.h> using namespace std; const long long oo = 0x3f3f3f3f3f3f3f3fLL; struct Edge { int u, v; long long cap[2], flow; }; vector<int> d, act; bool bfs(int s, int t, vector<vector<int>>& adj, vector<Edge>& E, long long lim = 1) { queue<int> Q; d = vector<int>(adj....
// megafunction wizard: %Shift register (RAM-based)% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: ALTSHIFT_TAPS // ============================================================ // File Name: delay.v // Megafunction Name(s): // ALTSHIFT_TAPS // // Simulation Library Files(s): // altera_mf // =============...
#include <bits/stdc++.h> using namespace std; int n; int main() { multiset<int> Q; cin >> n; long long ans = 0; long long times = 0; bool b = false; int count = 0; for (int i = 0; i < n; i++) { int x; cin >> x; if (Q.size() == 0 || (*Q.begin()) > x) { Q.insert...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 15:12:18 11/19/2016 // Design Name: // Module Name: bmod // Project Name: // Target Devices: // Tool versions: // Description: // // Dependenci...
/* * 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 nodistinct(string s, string a) { int counter = 0; for (int i = 0; i < a.size(); i++) { for (int j = 0; j < s.size(); j++) { if (a[i] == s[j]) { counter++; break; } } } return counter; } int main() {...
#include <bits/stdc++.h> #pragma GCC optimize( Ofast ) using namespace std; clock_t clk = clock(); long long int i, j, k; void solve(void); int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); ; int t = 1; while (t--) solve(); return 0; } void solve() { long long 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...
`include "top.vh" module clks( input clk_i, output clk_o ); parameter PLL_EN = 0; parameter GBUFF_EN = 0; // PLL params // Settings below default to clk_o = (clk_i / 8) parameter DIVR = 4'b0000; parameter DIVF = 7'b0111111; parameter DIVQ = 3'b011; // Non-PLL params p...
`timescale 1 ns / 1 ps module axis_counter # ( parameter integer AXIS_TDATA_WIDTH = 32, parameter integer CNTR_WIDTH = 32 ) ( // System signals input wire aclk, input wire aresetn, input wire [CNTR_WIDTH-1:0] cfg_data, // Master side output wire...
/** * 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 maxn = (1 << 18) - 1; int main() { int k; scanf( %d , &k); int b = maxn, cnt = 0; for (int i = 0; i <= 20; ++i) { if ((k >> i) & 1) { b ^= (1 << i); } } int cc = maxn >> 1; printf( %d %d n , 3, 3); printf( %d %d ...
#include <bits/stdc++.h> using namespace std; const int OO = 1e9 + 9; const int MAX = 1e5 + 9; int n, m, freq[MAX], dp[2][MAX]; vector<int> adj[MAX]; vector<pair<int, int> > a; bool vis[MAX]; template <typename T> void Minimize(T& a, T b) { a = min(a, b); } void Add(int cnt, int x) { int p...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); const int maxN = 2 * 1e5; int answers[maxN]; int n, m, x, neg = 0, pos = 0; cin >> n >> m; for (int i = 0; i < n; i++) { cin >> x; if (x == -1) neg++; else po...
#include <bits/stdc++.h> using namespace std; int n, m, q, res[111][111]; pair<int, int> pos[111][111]; int type, r, c, x; int main() { scanf( %d %d %d , &n, &m, &q); for (int i = 1; i <= n; ++i) for (int j = 1; j <= m; ++j) pos[i][j] = pair<int, int>(i, j); while (q--) { scanf( %d , &...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; vector<vector<vector<ll>>> v; vector<vector<ll>> mat; vector<vector<ll>> matMal(vector<vector<ll>> mat1, vector<vector<ll>> mat2) { vector<vector<ll>> mat3((int)(mat1).size(), vector<ll>((int)(mat1).size())); ...
/** * 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 a1, a2, a3, a4, c = 0; cin >> a1 >> a2 >> a3 >> a4; string s; cin >> s; for (int i = 0; i < s.size(); i++) { if (s[i] == 1 ) c += a1; else if (s[i] == 2 ) c += a2; else if (s[i] == 3 ) ...
#include <bits/stdc++.h> using namespace std; int f[4005][4005]; int a[4005]; int main() { int i, j, k, n, m = 0; memset(f, 0, sizeof(f)); cin >> n; for (i = 1; i <= n; i++) { cin >> a[i]; k = 0; for (j = 0; j < i; j++) { f[i][j] = f[j][k] + 1; if (a[j] == a[i])...
#include <bits/stdc++.h> using namespace std; int l, r, a, b, dif, t, x, lit, poz; bool uz[27]; char s[1001]; int main() { cin >> a >> b >> l >> r; dif = min(500, r - l); l = l % (a + b); if (l == 0) l = a + b; r = l + dif; if (l <= a) { for (int i = l; i <= min(a, r); i++) s[++p...
////////////////////////////////////////////////////////////////////// //// //// //// Copyright (C) 2014 //// //// //// //// This source file may be used and distributed 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 law...
#include <bits/stdc++.h> using namespace std; int n, k; string s; pair<int, int> fff(const string &s, char x) { pair<int, int> res; int cc = 0; for (int i = 0; i < s.length(); i++) if (s[i] == x) cc++; if (cc >= k) { res.first = 0; res.second = 0; return res; } in...
/*------------------------------------------------------------------------------ * 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; int main() { int t, n, a, b; cin >> t; for (int i = 0; i < t; ++i) { bool res = true; cin >> n; cin >> a; for (int i = 1; i < n; ++i) { cin >> b; if (a < b && b - a > 1) res = false; a = b; } cout <...
#include <bits/stdc++.h> using namespace std; template <typename T> inline void read(T &x) { x = 0; char c = getchar(); bool flag = false; while (!isdigit(c)) { if (c == - ) flag = true; c = getchar(); } while (isdigit(c)) { x = (x << 1) + (x << 3) + (c ^ 48); c = ...
#include <bits/stdc++.h> using namespace std; template <class T> bool checkmax(T &a, T b) { return a < b ? a = b, true : false; } template <class T> bool checkmin(T &a, T b) { return a > b ? a = b, true : false; } template <class T> void string_reader(string s, vector<T> &vec) { istringstr...
// (C) 2001-2016 Intel Corporation. All rights reserved. // Your use of Intel 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 docum...
#include <bits/stdc++.h> using namespace std; const double eps = 1e-6; const double INF = DBL_MAX; bool iszero(const double a) { return fabs(a) <= eps; } double sqr(const double a) { return a * a; } int sgn(const double a) { if (a < -eps) return -1; return (a > eps); } int cmp(const double a, co...
#include <bits/stdc++.h> #pragma comment(linker, /STACK:67108864 ) const int MOD = 1000000007; const long long INF = 3000000000000000001; const double EPS = 1e-6; const int HASH_POW = 29; const double PI = acos(-1.0); using namespace std; double workTime() { return double(clock()) / CLOCKS_PER_SEC; } ...
// ============================================================== // File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC // Version: 2014.4 // Copyright (C) 2014 Xilinx Inc. All rights reserved. // // ============================================================== `timescale 1ns/1p...
#include <bits/stdc++.h> using namespace std; const int MOD = 1e9 + 7; const int inf = 0x3f3f3f3f; const long long Inf = 0x3f3f3f3f3f3f3f3f; const int maxn = 1e3 + 4; const int maxm = 1e5 + 4; vector<int> v; int n, k, b[maxn]; int main() { ios::sync_with_stdio(false); int i, j, kase; cin >...
module simpleCPU (clk, rst, IMR, instr2load, loadAdx); // ALU control input input clk, rst, IMR; // connect to system 50 MHz clock input [31:0] instr2load; input [6:0] loadAdx; wire MemWrEn, regWR, zero, overflow, carryout, negative, Mem2Reg, ALUop, ALUsrc, writeSel; wire [10:0] adxData; wire [31:0] imd; ...
module flash_default_tester ( //CONTROL// input iBUSSW , input iTRIKEY , input iDEFAULT, input iCLK_28, //FL inout [14:0] FLASH_DQ, inout FLASH_DQ15_AM1, output [25:0] oFLASH_A, output oFLASH_WE_N, output oFLASH_RST_N, output oFLASH_WP_N, input iFLASH_RY_N, output oFLASH_...
#include <bits/stdc++.h> using namespace std; int n, ans; int a[200][10]; int p[10]; struct Node { double l, r; int w; } c[10]; struct Point { int S, T; } u[10], v[10]; void Op() { c[1].l = -(1e-7); c[1].r = 1.00 / 32.00; c[1].w = 3000; c[2].l = 1.00 / 32.00; c[2].r = 1...
#include <bits/stdc++.h> using namespace std; int main() { int t; long long n; cin >> t; for (int i = 0; i < t; i++) { cin >> n; if (n < 6) { cout << 15 << endl; } else if (n % 2 == 0) { cout << n / 2 * 5 << endl; } else { n++; cout << n / 2 * ...
#include <bits/stdc++.h> using namespace std; int n, u[6], v[6], x; int main() { scanf( %d , &n); for (int i = (1); i <= (n); i++) { scanf( %d , &x); u[x]++; } for (int i = (1); i <= (n); i++) { scanf( %d , &x); v[x]++; } int dif = 0; for (int i = (1); i <= (5);...
// testbench for the freecell player. // This simple testbench presents one move to the freecell player at each // clock cycle. The task "doMove" allows the user to specify the moves in // standard notation. // // Each move consists of two characters: the first designates the source; // the second designates the destin...
/* * PicoSoC - A simple example SoC using PicoRV32 * * This is a modified PicoSoC example which has removed the requirement * for an external SPI flash. The PicoRV32 program is stored in ROM implemented * as a number of case statements. The ROM file is generated using an external * script. * * * Copyrigh...
#include <bits/stdc++.h> using namespace std; int n, k, cnt[1010], ans; int main() { cin >> n >> k; for (int i = 1; i <= n; i++) { int x; cin >> x; cnt[x]++; } for (int i = 1; i <= (n + 1) / 2; i++) { int idx = -1, mx = -1; for (int j = 1; j <= k; j++) { if (c...
#include <bits/stdc++.h> using namespace std; const int INF = 1000 * 1000 * 1000; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n; cin >> n; pair<int, int> minp1(INF, INF), minp2(INF, INF); for (int i = 0; i < n; i++) { int x, y; cin >> x >> y;...
// DSP48E1 // [1] 7 Series DSP48E1 User Guide UG479 (v1.9) September 27, 2016 `include "amux/areg_mux.sim.v" `include "dmux/dreg_mux.sim.v" `include "ain_mux/ain_mux.sim.v" `include "acout_mux/acout_mux.sim.v" `include "amult_mux/amult_mux.sim.v" `include "a_adder_mux/a_adder_mux.sim.v" `include "../nreg/nreg.sim.v" ...
#include <bits/stdc++.h> using namespace std; long long a, b, p, q, ay, by, tx, g, l, ty, x, y, n = 15, d, m, tot, last, lst2; map<int, int> wow; long long shob[104]; vector<int> all; char c; int setbit(int n, int pos) { return n | (1 << (pos)); } int isbit(int n, int pos) { return n & (1 << (pos)); } ...
#include <bits/stdc++.h> using namespace std; long long n, k, m; long long t[300005]; long long a[300005]; long long s; long long res[300005], ans[300005]; long long cnt[300005]; long long pre[300005], p[300005], pp[300005]; struct query { long long l; long long r; long long id; } q[3000...
/////////////////////////////////////////////////////////////////////////////// // Copyright (c) 1995/2004 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 // //...
/** * 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...
// megafunction wizard: %FIFO% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: scfifo // ============================================================ // File Name: ff_40x32_fwft.v // Megafunction Name(s): // scfifo // // Simulation Library Files(s): // altera_mf // =========================================...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n; cin >> n; vector<long long int> a(n), b(n); map<long long int, bool> mp; bool ok = false; for (int i = 0; i < n; i++) { cin >> a[i]; b[i] = a[i]; i...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 06.10.2017 08:53:47 // Design Name: // Module Name: pc // Project Name: // Target Devices: // Tool Versions: // Description: // // Dependencies: // // Revision: // Revision...
//====================================================================== // // gcm.v // ----- // Top level wrapper for the AES-GCM block cipher mode core. // // // Author: Joachim Strombergson // Copyright (c) 2016, Secworks Sweden AB // All rights reserved. // // Redistribution and use in source and binary forms, with...
module array_assign(); parameter MSB = 1; integer ii; reg signed [2:0] ar_reg[0:MSB]; wire signed [4:0] as_wr; // compiled with "-g2 -g2x" // FAILED at this line assign as_wr = {{2{ar_reg[0][2]}},ar_reg[1]}; always @(as_wr) for(ii=0; ii<(MSB+1); ii=ii+1) ...
`timescale 1ns / 1ps /* Copyright 2015, Google 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/licenses/LICENSE-2.0 Unless required by applicable l...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); int n, u, v, c, a, b, t; cin >> n; long long w[n], A, B, Su[n], SMax = 0; int g[n], S[n], Pa[n]; vector<pair<int, long long>> D[n]; vector<int> T, P; for (int i = 0; i < n; i++) { cin >> w[i...
//############################################################################# //# Function: Maps Packet to Emesh Signals # //############################################################################# //# Author: Andreas Olofsson # ...
//-------------------------------------------------------------------------------- // // sram_interface.v // Copyright (C) 2011 Ian Davis // // 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 Founda...
#include <bits/stdc++.h> using namespace std; int dis[75][1 << 18]; bool mark[75][1 << 18]; int n, m, A, B; vector<pair<int, int> > ve[75]; struct zzt { pair<int, int> to; int di; }; bool operator<(zzt aa, zzt bb) { return aa.di > bb.di; } priority_queue<zzt> q; int fa[75]; int gf(int x) {...
#include <bits/stdc++.h> using namespace std; inline long long max(long long a, long long b) { return ((a > b) ? a : b); } inline long long min(long long a, long long b) { return ((a > b) ? b : a); } inline long long gcd(long long a, long long b) { if (b == 0) return a; a %= b; return gcd(b, a); }...
package t; class c; virtual function create (string name=""); return null; // Error: logic returning a null endfunction endclass : c endpackage module m; import t::*; int idx, idx2; c carr [0:1][0:3]; class c2; static c sval; c val; c arr [0:1]; task check; if (sval ...
#include <bits/stdc++.h> using namespace std; const long long max_sz = 1e5 + 1; const long long mod = 1e9 + 7; const long long MAXN = 4e18 + 1; char flip(char k) { if (k == 0 ) return 1 ; return 0 ; } long long sum_digit(long long n) { long long a = 0, i; for (i = n; i > 0; i = i / 10) ...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); int n; cin >> n; int a[n], g[n]; int sa = 0, sg = 0; char ans[n]; for (int i = 0; i < n; ++i) { cin >> a[i] >> g[i]; } for (int i = 0; i < n; ++i) { sa += a[i]; if (sa <...
`timescale 1ns / 1ps module DisplayCtrl(Clk, reset, memoryData, An0, An1, An2, An3, Ca, Cb, Cc, Cd, Ce, Cf, Cg, Dp ); input [26:0] Clk; input reset; input [15:0] memoryData; output An0, An1, An2, An3, Ca, Cb, Cc, Cd, Ce, Cf, Cg, Dp; reg [6:0] SSD_CATHODES; wire [26:0] DIV_CLK; reg [3:0] SSD; wire [3: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; int a[100010]; long long ans = 0; int main() { scanf( %d%d , &n, &m); for (int i = 1; i <= n; i++) scanf( %d , &a[i]); for (int Q = 0; Q < 20; Q++) { for (int j = 1; j <= n; j++) if (a[j] & (1 << Q)) { int k = 0; ...
#include <bits/stdc++.h> const double eps = 1e-9; const int int_inf = 2000000000; const long long i64_inf = 1000000000000000000LL; const double pi = acos(-1.0); using namespace std; int wa[1000010]; int wb[1000010]; int a[1000100]; int b[1000100]; int la, lb; int res = 0; int main() { memset...
#include <bits/stdc++.h> using namespace std; using ll = long long; const ll MOD = 1e9 + 7; const int N = 2000; int board[N][N]; bool flip_row[N]; bool flip_col[N]; int bar[N]; int main() { ios_base::sync_with_stdio(false); cin.tie(0); int n; cin >> n; for (int y = 0; y < n; ++y) {...
#include <bits/stdc++.h> #pragma GCC optimize( O3 ) using namespace std; const long long INF = (long long)1e18 + 100; long long safe_sum(long long a, long long b) { long long s = (a + b); s = min(s, INF); return s; } long long safe_mult(long long a, long long b) { if (a == 0 || b == 0) retur...
#include <bits/stdc++.h> using namespace std; const int N = 205; int read() { int x = 0, f = 1; char ch; while (!isdigit(ch = getchar())) (ch == - ) && (f = -f); for (x = ch ^ 48; isdigit(ch = getchar()); x = (x << 3) + (x << 1) + (ch ^ 48)) ; return x * f; } vector<int> ve...
module autoinst_vertrees (/*AUTOARG*/ // Outputs slv_b_put, slv_b_bit_st, slv_a_put, slv_a_bit_st, i2c_b_strobe, i2c_b_start, i2c_b_spc_stop, i2c_b_spc_start, i2c_b_spc_sda_state, i2c_b_spc_scl_state, i2c_b_spc_scl_fall, i2c_b_slv_sda_out, i2c_b_slv_scl_out, i2c_b_read, i2c_b_mst_data, i2c_a_strobe, i2c_a...
/* * 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; const int MOD = 1000000007; const int MAXN = 305; const int MAXT = 100005; int a[MAXN], e[MAXN], d[MAXN]; long long dp[MAXT]; long long t, cnt; void dfs(int u, int acc) { if (t < 0) { return; } ++cnt; a[u] += acc; if (e[u] != 0) { ...
#include <bits/stdc++.h> #pragma warning(disable : 4996) #pragma GCC optimize(3) template <typename T> T min(T x, T y) { return x < y ? x : y; } template <typename T> T max(T x, T y) { return x > y ? x : y; }; const int INF = 1000000000; const int MAXN = 100005; const int B = 500; int N,...
/** * This is written by Zhiyang Ong * and Andrew Mattheisen * for EE577b Troy WideWord Processor Project */ /** * Reference: * Nestoras Tzartzanis, EE 577B Verilog Example, Jan 25, 1996 * http://www-scf.usc.edu/~ee577/tutorial/verilog/counter.v */ // Behavioral model for the 32-bit program counter module pr...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
// -*- verilog -*- // Copyright (c) 2012 Ben Reynwar // Released under MIT License (see LICENSE.txt) // A qa_wrapper with a splitter and message_stream_combiner module qa_wrapper #( parameter WDTH = 32 ) ( input wire clk, input wire reset, input wire [WDTH-1:0] in_data,...
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; const int MAXN = 3005; const int MOD = 1000000007; const double eps = 1e-8; const double PI = acos(-1.0); long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; } long long qpow(long long a, long long n, long long...
#include <bits/stdc++.h> using namespace std; const int N = 301; string s[N][N]; vector<pair<pair<int, int>, pair<int, int> > > f(int n, int k) { vector<pair<pair<int, int>, pair<int, int> > > ans; pair<int, int> f0 = {1, 0}, f1 = {0, 1}; int i, j, l; for (i = 0; i < s[0][0].size(); ++i) i...
#include <bits/stdc++.h> using namespace std; const long long md = 1e9 + 7; const long long arr = 2e5; long long a[arr], aa[arr]; long long n, d, b; bool check(long long u) { for (long long i = 1; i <= n; i++) a[i] = aa[i]; long long pluss = 0; long long uu = u; long long start = 1; long...
//====================================================================== // // mkmif.v // ------- // Top level wrapper for the Master Key Memory (MKM) interface. // The interface is implemented to use the Microchip 23K640 serial // sram as external storage. The core acts as a SPI Master for the // external memory inclu...
#include <bits/stdc++.h> using namespace std; #define send {ios_base::sync_with_stdio(false);} #define help {cin.tie(NULL);} #define f first #define s second #define pb push_back #define vi vector<long long> #define vii vector<pair<long long,long long>> #define dict unordered_map<long long, long 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; const long long M = 1000000000000000003LL; int n, m; long long pow2[262144]; char S[262144]; char T[262144]; long long hS[262144][26]; long long hT[262144][26]; long long curh[26]; vector<int> ans; bool v[26]; inline long long mulmod(long long x, lon...
#include <bits/stdc++.h> using namespace std; int a[123456]; int main() { int n, ans = 0; cin >> n; for (int i = 1; i <= n; i++) cin >> a[i]; a[n + 1] = a[0] = 0; for (int i = 1; i <= n; i++) a[i] = min(a[i], min(a[i - 1] + 1, a[i + 1] + 1)); for (int i = n; i > 0; i--) { a[i] ...
#include <bits/stdc++.h> using namespace std; const int maxn = 100010; vector<int> v[5 * maxn]; int t[5 * maxn]; int comp[5 * maxn]; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n = 0, m = 0, x = 0, y = 0; cin >> n >> m; for (int i = 0; i < m; ++i) { cin >> x >...
module dut(/*AUTOARG*/ // Outputs dut_active, clkout, wait_out, access_out, packet_out, // Inputs hw_en, clk1, clk2, nreset, vdd, vss, access_in, packet_in, wait_in ); parameter UREGS = 13; parameter AW = 32; parameter DW = 32; parameter CW = 2; parameter IDW = 12; param...
// (C) 2001-2016 Intel Corporation. All rights reserved. // Your use of Intel 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 docum...
#include <bits/stdc++.h> using namespace std; vector<int> a[4]; vector<long long> sum[4]; int hasha[200050], hashb[200050]; int c[200050]; int main() { ios::sync_with_stdio(false); cin.tie(0); int n, m, k, t; cin >> n >> m >> k; memset(hasha, 0, sizeof(hasha)); memset(hashb, 0, sizeo...
// *************************************************************************** // *************************************************************************** // 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> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin.clear(); fflush(stdin); int n; cin >> n; while (n--) { string s; cin >> s; int year = stoi(s.substr(4, s.size() - 4)), p = 1, x = 1989; for (i...
#include <bits/stdc++.h> using namespace std; int main() { long long n, i, j, a[100100], p = 1; scanf( %lld , &n); for (i = 0; i < n; i++) scanf( %lld , &a[i]); sort(a, a + n); for (i = 0; i < n; i++) { if (a[i] >= p) p++; } printf( %lld n , p); return 0; }
#include <bits/stdc++.h> using namespace std; void aayush() { ios_base::sync_with_stdio(false); cin.tie(NULL); } int main() { aayush(); long long int t; cin >> t; while (t--) { long long int n; cin >> n; if (n % 4 == 0) { cout << YES << endl; } else { ...
// ============================================================== // File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC // Version: 2014.4 // Copyright (C) 2014 Xilinx Inc. All rights reserved. // // ============================================================== `timescale 1ns/1ps modul...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Rose-Hulman Institute of Technology // Tom D'Agostino // ECE398 CAN Controller Design // // Create Date: 23:00 03/26/2015 // Module Name: main // Project Name: CAN_Controller // Target Devices: Nexys 3 ru...
#include <bits/stdc++.h> using namespace std; int main() { int t; t = 1; while (t--) { int n, m, i, j; cin >> n >> m; int a[n + 2][m + 2]; int ii = -1, jj = -1; for (i = 0; i < n; i++) { for (j = 0; j < m; j++) { cin >> a[i][j]; if (a[i][j] > 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> template <class T> inline void read(T &x) { x = 0; register char c = getchar(); register bool f = 0; while (!isdigit(c)) f ^= c == - , c = getchar(); while (isdigit(c)) x = x * 10 + c - 0 , c = getchar(); if (f) x = -x; } template <class T> inline void print(...
#include <bits/stdc++.h> using namespace std; const long long N = 5003, mod = 1e9 + 7; long long n, k, S[N][N], ans; inline long long kasumi(long long a, long long b) { long long res = 1; while (b) { if (b & 1) res = (long long)res * a % mod; a = (long long)a * a % mod; b >>= 1; } ...
#include <bits/stdc++.h> using namespace std; int main() { long long int n, i, j, z, x = 10, k = 0, year = 0, l = 0, f = 0; string s; cin >> n; while (n--) { cin >> s; x = 10; f = 0; year = 0; k = s.length() - 4; for (i = 1; i < k; i++) { f += x; x...
// Note: when __ICARUS_UNSIZED__ is not defined, this test assumes integers // are 32 bits wide. module main(); reg [34:0] my_reg; reg error; reg [34:0] ref_val; reg [34:0] ref_val2; reg [7:0] count; initial begin error = 0; // Create reference value that is bigger than 32 bits......
/** * 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 N = 1000100, M = 100100, K = 1000100, mod = 1000000007; int n, m, k, l = N, r = 0, tot = 0, p[K] = {1}; int main() { scanf( %d%d%d , &n, &m, &k); for (int i = 1, u, v; i <= m; ++i) { scanf( %d%d , &u, &v); if (v - u > 1) { if (v...