text
stringlengths
59
71.4k
#include <bits/stdc++.h> using namespace std; const int N = (int)5e5 + 9; vector<int> T[N]; bool use[2 * N]; int p; int l[N], r[N]; void dfs(int u, int par) { if (par == -1) { l[u] = 1; r[u] = T[u].size() + 2; use[1] = true; use[T[u].size() + 2] = true; p = T[u].size() + ...
#include <bits/stdc++.h> using namespace std; const int Z = (int)2e5 + 111; const int inf = (int)1e9 + 111; const long long llinf = (long long)1e18 + 5; const int MOD = (int)1e9 + 7; vector<long long> pref[4 * Z]; vector<int> t[4 * Z]; int a[Z]; void build(int v, int vl, int vr) { if (vl == vr) { ...
/* * Milkymist VJ 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 Licen...
// megafunction wizard: %LPM_ABS%VBB% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: lpm_abs // ============================================================ // File Name: ABS.v // Megafunction Name(s): // lpm_abs // // Simulation Library Files(s): // lpm // ====================================...
#include <bits/stdc++.h> using namespace std; vector<int> cr1[27]; vector<int> cr2[27]; int s1[27]; int s2[27]; struct node { int x; int y; }; int main() { int n; cin >> n; char c; for (int i = 0; i < n; i++) { cin >> c; if (c == ? ) { s1[26]++; cr1[2...
#include <bits/stdc++.h> using namespace std; string CHECK(long long n) { long long t, temp = n, zero = 0, ans = 0, flag = 0; while (temp != 0) { t = temp % 10; if (t == 0 && flag == 0) zero++; else { flag = 1; ans *= 10; ans += t; } temp /= 10; ...
// ========== Copyright Header Begin ========================================== // // OpenSPARC T1 Processor File: pcx_dp_macb_l.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 redistribute it and...
#include <bits/stdc++.h> using namespace std; int main() { int f[10]; for (int i = 0; i < 10; i++) { f[i] = 0; } for (int i = 0; i < 6; i++) { int tem; cin >> tem; f[tem]++; } int leg; int flag = 0; for (int i = 0; i < 10; i++) { if (f[i] >= 4) { ...
// Copyright 1986-2018 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2018.2 (win64) Build Thu Jun 14 20:03:12 MDT 2018 // Date : Sun Sep 22 02:34:31 2019 // Host : varun-laptop running 64-bit Service Pac...
#include <bits/stdc++.h> using namespace std; int n, m, ar[11][100005]; int rev[11][100005]; long long mx(int start) { int val = ar[0][start]; for (int tmp = 0; tmp < n; ++tmp) { for (int row = 1; row < m; ++row) { int col = rev[row][val]; if (col + tmp >= n) { return tmp...
#include <bits/stdc++.h> using namespace std; const int Max = 50; int row[Max][Max] = {0}, dp[Max][Max][Max][Max] = {0}, a[Max][Max]; int main() { int n, m, q; cin >> n >> m >> q; for (int i = 1; i <= n; i++) { for (int j = 1; j <= m; j++) { scanf( %1d , &a[i][j]); row[i][j] = ...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 11:23:05 04/19/2017 // Design Name: // Module Name: decrypt // Project Name: // Target Devices: // Tool versions: // Description: // // Depende...
#include <bits/stdc++.h> using namespace std; int main() { int ans = -1; int n, dol, cent, s, i; cin >> n >> s; for (i = 0; i < n; i++) { cin >> dol >> cent; if (s > dol && cent != 0 && 100 - cent > ans) ans = 100 - cent; if (s >= dol && cent == 0 && ans == -1) ans = 0; } c...
#include <bits/stdc++.h> using namespace std; int main() { long long n, m; cin >> n >> m; long long a = n, b = m; while (1) { if (a <= 0 || b <= 0) break; if (a >= 2 * b) { a %= 2 * b; continue; } if (b >= 2 * a) { b %= 2 * a; continue; }...
// *************************************************************************** // *************************************************************************** // Copyright 2011(c) Analog Devices, Inc. // // All rights reserved. // // Redistribution and use in source and binary forms, with or without modification, // a...
//--------------------------------------------------------------------------- //-- (c) 2016 Alexey Spirkov //-- I am happy for anyone to use this for non-commercial use. //-- If my verilog/vhdl/c files are used commercially or otherwise sold, //-- please contact me for explicit permission at me _at_ alsp.net. //-- This...
/** * 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, h; pair<int, int> arr[100010]; int res[100010]; int ptr = -1; int cnt, bits; int main() { cin >> n >> h; for (int i = 0; i < n; i++) { scanf( %d , &arr[i].first); arr[i].second = i; res[i] = 1; } sort(arr, arr + n); ...
#include <bits/stdc++.h> using namespace std; const int maxn = 3e5 + 123, INF = 1e9, mod = 1e9 + 7, N = 2e5 + 123; struct btr { map<int, long long> dp; set<pair<long long, int> > st; long long mn, add; }; vector<int> g[maxn]; int n, m; btr a[maxn]; void Merge(btr &a, btr &b) { if (a.dp.s...
`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 09:33:06 03/03/2016 // Design Name: data_memory // Module Name: G:/ceshi/lab4.2/test_for_datamem.v // Project Name: lab4.2 // Target Device: // Tool ver...
/** * 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) 2005 by Terasic Technologies Inc. // -------------------------------------------------------------------- // // Permission: // // Terasic grants permission to use and modify this code for use // in synthesis for all Terasic Dev...
module buffer_copier( input wire clk, input wire vblank, output reg front_vram_wr_low, output reg back_vram_rd_low, output reg copy_in_progress, input wire [7:0] copy_enable, inout wire [7:0] front_vram_data, inout wire [7:0] back_vram_data, output wire [12:0] front_vram_addr, output wire [12:0] b...
/** * 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; int first[maxn]; int n; int main() { int num, i; while (scanf( %d , &n) != EOF) { memset(first, 0, sizeof(first)); for (i = 1; i <= n; i++) { scanf( %d , &num); if (i <= n / 2) { if (num - (i -...
module bluetooth_TB; reg rx=1; wire avail; reg clk_in; wire clk_div; reg reset=0; wire [7:0] dout; reg enable=0; wire busy; wire done; wire tx; bluetooth bt(.rx(rx),.clk_in(clk_in),.reset(reset),.dout(dout),.avail(avail),.clk_div(clk_div),.enable(enable),.busy(busy),.done(done),.tx(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; map<pair<long long, long long>, long long> O; map<pair<long long, long long>, long long>::iterator oit; map<long long, long long> X, Y; map<long long, long long>::iterator it; int main() { int n; cin >> n; for (int i = 0; i < n; ++i) { double x...
/******************************************************************************* * 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; vector<int> a; vector<pair<pair<int, int>, int> > b; vector<int> k; vector<int> ans; signed main() { ios_base::sync_with_stdio(0); int n, m; cin >> n; a.resize(n); b.resize(n); ans.resize(n); for (int i = 0; i < n; i++) { cin >>...
// -*- Mode: Verilog -*- // Filename : cpu.v // Description : Complete Picoblaze Design // Author : Philip Tracton // Created On : Thu May 21 22:33:37 2015 // Last Modified By: Philip Tracton // Last Modified On: Thu May 21 22:33:37 2015 // Update Count : 0 // St...
`include "serialClock.v" module finiteStateMachine(clk, sclkPosEdge, instr, cs, dc, delayEn, parallelData); input clk, sclkPosEdge; input[9:0] instr; output reg cs, dc, delayEn; output[7:0] parallelData; wire[1:0] code; assign code = instr[9:8]; // our makeshift opcodes assign parallelData = instr[7:0]; // what goes ...
//lpm_divide CBX_SINGLE_OUTPUT_FILE="ON" LPM_DREPRESENTATION="UNSIGNED" LPM_HINT="LPM_REMAINDERPOSITIVE=TRUE" LPM_NREPRESENTATION="UNSIGNED" LPM_PIPELINE=1 LPM_TYPE="LPM_DIVIDE" LPM_WIDTHD=64 LPM_WIDTHN=64 clken clock denom numer quotient remain //VERSION_BEGIN 16.0 cbx_mgl 2016:07:21:01:49:21:SJ cbx_stratixii 2016:07:...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); int tc; cin >> tc; while (tc--) { long long l, r; cin >> l >> r; long long i = 1; while ((l | i) <= r) { l |= i; i <<= 1; } cout << l ...
#include <bits/stdc++.h> using namespace std; string a, b; bool func(string s, long n) { if (s.size() % n) return false; for (long i = 0; i < s.size(); i++) if (s[i] != a[i % n]) return 0; return 1; } int main() { cin >> a >> b; long ans = 0, i = 1; string p = a, q = b; long ...
#include <bits/stdc++.h> #pragma warning(disable : 4996) FILE *in = stdin, *out = stdout; using namespace std; #pragma comment(linker, /stack:36777216 ) int n; char a[300005]; int D[300005]; void input() { fscanf(in, %d , &n); fscanf(in, %s , &a[1]); } bool isSame(int x) { if (x & 1) ...
////////////////////////////////////////////////////////////////////// //// //// //// RxfifoBI.v //// //// //// //// This file is part of the usbhos...
#include <bits/stdc++.h> using namespace std; void rc(char &a) { a = 0; register int x = getchar_unlocked(); while (x < a || x > z ) { if (x == n ) { a = 0 ; return; } x = getchar_unlocked(); } a = x; } const int maxn = 100100; int key; int main() ...
// (C) 1992-2014 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 simulati...
module adv3224 ( // avalon-bus input clk, input reset, input avs_slave_write, input avs_slave_read, input [7:0]avs_slave_writedata, output [7:0]avs_slave_readdata, input [2:0]avs_slave_address, // adv3224 output cps_reset_n, output cps_ce_n, outp...
/** * 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: %ROM: 1-PORT%VBB% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: altsyncram // ============================================================ // File Name: COCO3GEN.v // Megafunction Name(s): // altsyncram // // Simulation Library Files(s): // altera_mf // ===============...
#include <bits/stdc++.h> using namespace std; struct node { int left, right; int time[60]; node(int left = 0, int right = 0) : left(left), right(right) {} } arb[4 * 100000 + 5]; inline void unite(node &a, node b, node &c) { for (int i = 0; i < 60; i++) a.time[i] = b.time[i] + c.time[(i + b...
#include <bits/stdc++.h> using namespace std; int n, i, j, k, l, m, t; int a[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; int main() { cin >> m >> t; a[m] -= 7 - t + 1; if (a[m] % 7 == 0) { cout << a[m] / 7 + 1; } else { cout << a[m] / 7 + 2; } }
/* Usage: 3 slices, 13 regs, 8 LUTs, 4 LUTRAMs, for 16-deep 8-bit FIFO */ module Fifo #( parameter WIDTH = 8, ///< Width of data word parameter LOG2_DEPTH = 4 ///< log2(depth of FIFO). Must be an integer ) ( // Inputs input clk, ///< System clock input rst, ...
#include <bits/stdc++.h> using namespace std; long long dp[2][300000]; long long dfs(int previous,bool previousMax,int N, vector<vector<int> > & adj, vector<pair<long long,long long> > &vals) { if(dp[previousMax][N]!=-1) return dp[previousMax][N]; long long res1 = 0; long long res2 = 0; if(pr...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: Case Western Reserve University // Engineer: Matt McConnell // // Create Date: 09:32:00 01/19/2017 // Project Name: EECS301 Digital Design // Design Name: Lab #1 Demo // Module Name: TF...
`timescale 1 ns / 1 ps module BoardInit_AXI_v1_0 # ( // Users to add parameters here parameter integer im_bits_width = 9, parameter integer color_width = 8, parameter integer window_width = 8, // User parameters ends // Do not modify the parameters beyond this line // Width of S_AXI data bus paramet...
#include <bits/stdc++.h> using namespace std; const double eps = 1e-8; const int dx[] = {1, 0, -1, 0, -1, -1, 1, 1}; const int dy[] = {0, 1, 0, -1, -1, 1, -1, 1}; const int OO = INT_MAX; long long tolong(string s) { stringstream ss; ss << s; long long n; ss >> n; return n; } string t...
#include <bits/stdc++.h> using namespace std; int main() { int n, x, y; cin >> n >> x >> y; if ((x == n / 2 || x == n / 2 + 1) && (y == n / 2 || y == n / 2 + 1)) cout << NO << endl; else cout << YES << endl; }
/** * 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> #pragma GCC optimize( O3 ) #pragma GCC target( sse4 ) 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 ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; string s; cin >> s; for (int k = 0; k < n - 1; k++) { if (s[k] > s[k + 1]) { cout << YES << endl; cout << k + 1 << << k + 2; return 0; } } cout << NO ; return 0; }...
#include <bits/stdc++.h> #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native ) using namespace std; inline int read() { int f = 1, x = 0; char ch; do { ch = getchar(); if (ch == - ) f = -1LL; } while (ch < 0 || ch > 9 ); do { x = x * 10 + ch - 0 ;...
`timescale 1ns / 1ps /* -- Module Name: DES Sbox 4 -- Description: Sbox 4 del algoritmo DES -- Dependencies: -- none -- Parameters: -- none -- Original Author: Héctor Cabrera -- Current Author: -- Notas: -- History: -- Creacion 05 de Junio 2015 */ module des_sbox4 ...
#include <bits/stdc++.h> using namespace std; const int maxn = 2e5 + 50; const int mod = 1e9 + 7; const int inf = 0x3f3f3f3f; long long n, k; long long a[maxn]; int vis[maxn]; long long ans = 0; bool Overflow(long long x, long long y) { if (x > LLONG_MAX / y) return false; else ret...
#include <bits/stdc++.h> using namespace std; const long long N = 505, mod = 1e9 + 7; long long c[N][N], s[N][N], p[N], inv[N]; long long l, r; long long k, ans; long long add(long long a, long long b) { return a + b >= mod ? a + b - mod : a + b; } long long dec(long long a, long long b) { retur...
`include "divider.v" `include "sim.v" `define TESTS 5 module test; reg[`WIDTH-1:0] a, b; reg[`WIDTH-1:0] result, corr_result; wire[`WIDTH-1:0] out, remainder; reg start = 1'b0; reg next_reg = 1'b0; wire clk, reset, ready, next; assign next = next_reg; integer t; initial begi...
#include <bits/stdc++.h> using namespace std; const int maxN = 2000; int main() { ios_base::sync_with_stdio(0); int n; cin >> n; for (int i = 1; i <= n; i++) { long long l, r; cin >> l >> r; int ans = 0; long long mn = r; long long cur = 0; int cnt = 0; fo...
#include <bits/stdc++.h> using namespace std; const int N = 100010; int pre[N]; int find(int x) { if (!pre[x]) return x; return pre[x] = find(pre[x]); } int d[510][510]; struct point { int x, y, z; void read() { scanf( %d%d%d , &x, &y, &z); } } a[N]; int type[N]; int main() { int...
#include <bits/stdc++.h> using namespace std; void __print(int x) { cerr << x; } void __print(long x) { cerr << x; } void __print(long long x) { cerr << x; } void __print(unsigned x) { cerr << x; } void __print(unsigned long x) { cerr << x; } void __print(unsigned long long x) { cerr << x; } void __prin...
#include <bits/stdc++.h> using namespace std; int arr[300005]; map<int, int> mp; vector<int> opt; int main() { int n, lst = 0; cin >> n; for (int i = 1; i <= n; i++) { scanf( %d , &arr[i]); if (mp[arr[i]] && mp[arr[i]] > lst) { mp[arr[i]] = 0; opt.push_back(++lst); ...
module tx_DS_char( input TxReset, input TxClk, input valid_i, input [7:0] dat_i, input lchar_i, output Tx0, output Tx1, output ready_o ); reg ready; reg [3:0] chrLen; reg [1:0] icpLen; reg [7:0] shreg; reg lcharFlag; reg parity; reg Tx0, Tx1; wire isReady = (ready && (chrLen == 4'd0) && (ic...
#include <bits/stdc++.h> using namespace std; vector<int> odd, even; int main() { int cnt1 = 0, cnt2 = 0, tem = -1; int n, k, p, x; scanf( %d%d%d , &n, &k, &p); for (int i = 0; i < n; i++) { scanf( %d , &x); if (x % 2 == 0) { cnt2++; even.push_back(x); } else { ...
`default_nettype none module core_if #( parameter CORE_ID = 32'h0 )( /**************************************** System ****************************************/ input wire iCLOCK, input wire inRESET, /**************************************** Core ****************************************/ //oCORE_...
#include <bits/stdc++.h> using namespace std; const int INF = 1791791791; const long long INFLL = 1791791791791791791ll; template <int input_buf_size, int output_buf_size> class FastIO { char cbuf[input_buf_size + 1]; int icur = 0; inline bool go_to_next_token() { while (cbuf[icur] == ||...
#include <bits/stdc++.h> using namespace std; const int N = 500010; const int LOG = 20; const long long INF = (1ll << 60); int n; int a[N]; vector<int> adj[N]; int par[LOG][N]; void dfs(int u, int p) { par[0][u] = p; for (int i = 1; i < LOG; i++) { par[i][u] = par[i - 1][par[i - 1][u]]; ...
`default_nettype none `timescale 1ns/1ns module tb_membusif(); wire clk, reset; clock clock(clk, reset); // avalon reg a_write = 0; reg a_read = 0; reg [31:0] a_writedata = 0; reg [1:0] a_address; wire [31:0] a_readdata; wire a_waitrequest; // membus wire b_rq_cyc; wire b_rd_rq; wire b_wr_rq; wire [21...
#include <bits/stdc++.h> using namespace std; vector<int> g[100005]; int n, fa[100005], p[100005], size[100005], tsize[100005], q, d[100005]; long long ans = 0, sum[100005]; void dfs(int x, int f) { p[x] = f, fa[x] = x, size[x] = tsize[x] = 1, d[x] = d[f] + 1, ans += 1ll * (n - 2) * (n - 1); for (...
//======================================================= // ECE3400 Fall 2017 // Lab 3: Template top-level module // // Top-level skeleton from Terasic // Modified by Claire Chen for ECE3400 Fall 2017 //======================================================= `define ONE_SEC 25000000 module DE0_NANO( //...
/** * 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 = 300005; const int MD = 1000000007; int n, a[N]; long long s[N], k; int ft[N]; long long all[N]; int gt(int first) { int res = 0; for (int i = first; i >= 0; i &= i + 1, --i) res += ft[i]; return res; } void upd(int first, int v)...
/* * 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 i, j, k, l, n, m, s; int a[1000], b[1000]; int main() { cin >> n >> m; for (i = 1; i <= n; i++) { cin >> l; a[l]++; } for (i = 1; i <= 110; i++) { s = 0; for (j = i; j <= i + m; j++) s = s + a[j]; k = max(k, s); ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; if (n % 2 == 1) { cout << (n - 1) / 2 << endl; } else { long long x = 1; while (2 * x <= n) { x *= 2; } cout << (n - x) / 2 << endl; } return 0; }
#include <bits/stdc++.h> using namespace std; const int mod = 1000000007; inline int add(int a, int b) { if ((a += b) >= mod) a -= mod; return a; } inline int dec(int a, int b) { if ((a -= b) < 0) a += mod; return a; } inline void _add(int& a, int b) { if ((a += b) >= mod) a -= mod; ...
// Accellera Standard V2.3 Open Verification Library (OVL). // Accellera Copyright (c) 2005-2008. All rights reserved. reg sampling_event_prev; reg r_reset_n; `ifdef OVL_XCHECK_OFF //Do nothing `else `ifdef OVL_IMPLICIT_XCHECK_OFF //Do nothing `else wire valid_sampling_event; wire valid_test_expr; ...
#include <bits/stdc++.h> using namespace std; int n, m; vector<pair<pair<int, int>, pair<int, int> > > ans; bool invert; void print(vector<vector<string> > &mat) { for (auto vs : mat) { for (string s : vs) { printf( |%6s| , s.c_str()); } cout << endl; } } void move(int s...
// megafunction wizard: %ALTSYNCRAM% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: altsyncram // ============================================================ // File Name: altera_ram.v // Megafunction Name(s): // altsyncram // ============================================================ // *******...
#include<bits/stdc++.h> #include<algorithm> using namespace std; #define ll long long #define ld long double #define rep(i,a,b) for(ll i=a;i<b;i++) #define repb(i,a,b) for(ll i=a;i>=b;i--) #define err() cout<< ================================== <<endl; #define errA(A) for(auto i:A) cout<<i...
/** * bsg_nonsynth_mem_1r1w_sync_mask_write_byte_dma.v * * If a read and write are issued to the same address the new value is read back. * */ `include "bsg_defines.v" module bsg_nonsynth_mem_1r1w_sync_mask_write_byte_dma #(parameter `BSG_INV_PARAM(width_p) , parameter `BSG_INV_PARAM(els_p) , parame...
#include <bits/stdc++.h> using namespace std; long long int ar[500009], br[500009], cr[500009], tr[500009]; long long int fx[] = {-1, 1, 0, 0}; long long int fy[] = {0, 0, 1, -1}; map<long long int, long long int> mp; vector<long long int> v; string s; struct evan { long long int l, r, pos; } st[5...
#include <bits/stdc++.h> using namespace std; const int maxn = 3e5 + 5; unsigned long long bt[maxn]; unsigned long long d[maxn]; map<unsigned long long, int> has; pair<int, int> edg[maxn]; int f[maxn]; int id[maxn]; int lab[maxn]; vector<int> e[maxn]; int vis[maxn]; int getf(int x) { if (x =...
#include <bits/stdc++.h> using namespace std; long long v[3], l, ans, minusVal; long long accSum(long long limit) { return (limit + 1LL) * (limit + 2LL) / 2LL; } long long invalidCase(long long a, long long b, long long c) { long long ret = 0LL; for (long long i = 0LL; i <= l; i++) { long lo...
module peripheral_audio(clk , rst , d_in , cs , addr, d_out, mclk, ledres, micLRSel,micData,full,empty ); input clk; input rst; input [15:0]d_in; input cs; input [3:0]addr; // 4 LSB from j1_io_addr output [15:0]d_out; output ledres; output mclk; output micLRSel; input micData; output full; ...
// nios_system_nios2_qsys_0.v // This file was auto-generated from altera_nios2_hw.tcl. If you edit it your changes // will probably be lost. // // Generated using ACDS version 14.1 186 at 2016.05.03.15:20:15 `timescale 1 ps / 1 ps module nios_system_nios2_qsys_0 ( input wire clk, ...
#include <bits/stdc++.h> using namespace std; int fir = 0; char s[1100000]; int check() { for (int i = 0; s[i]; i++) { if (s[i] == ) continue; if (s[i] == # ) return 1; else return 0; } return 0; } int main() { while (gets(s)) { if (check()) { ...
/** * 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 logic_analyzer # ( parameter CAPTURE_WIDTH = 32, parameter CAPTURE_DEPTH = 10 ) ( input clk, input rst, input i_cap_clk, input i_cap_ext_trig, input ...
/* * Milkymist VJ SoC * Copyright (C) 2007, 2008, 2009, 2010 Sebastien Bourdeauducq * * 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. * * This program is distri...
#include <bits/stdc++.h> using namespace std; const long double eps = 1e-9; const long long MOD = 1e9 + 7; const int N = 2e6 + 10; const long double pi = 3.1415926535897932384650288; int n, m; string s, t; bool ok(int i, int j, int d) { if (j == m) return 1; if (i == n) return 0; if (i < 0) ...
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2016.4 (win64) Build Mon Jan 23 19:11:23 MST 2017 // Date : Tue Apr 18 23:15:12 2017 // Host : DESKTOP-I9J3TQJ running 64-bit major re...
#include <bits/stdc++.h> using namespace std; int main() { int a; cin >> a; string s; cin >> s; int x = 0; for (int i = 0; i < a - 1; i++) { if (s[i] > s[i + 1]) { cout << YES << endl; cout << i + 1 << << i + 2; return 0; } } cout << NO ; ...
#include <bits/stdc++.h> using namespace std; double p, f[220][220]; int x, k; int main() { scanf( %d%d%lf , &x, &k, &p); p /= 100; for (int i = 0; i <= k; i++) for (int j = x + i; j % 2 == 0; j /= 2) f[0][i]++; for (int i = 0; i < k; i++) { for (int j = 0; j <= k; j++) { if ...
#include <bits/stdc++.h> using namespace std; int n, A[200010], L[200010], R[200010], ans = 1; int main() { scanf( %d , &n); for (int i = 1; i <= n; i++) { scanf( %d , &A[i]); L[i] = R[i] = 1; } for (int i = 2; i <= n; i++) { if (A[i - 1] < A[i]) L[i] = L[i - 1] + 1; ans = ...
#include<bits/stdc++.h> #define rep(i,a,b) for(int i=(a);i<(b);++i) #define per(i,a,b) for(int i=(b)-1;i>=(a);--i) #define ll long long #define lb(x) ((x)&-(x)) #define pii pair<int,int> #define vi vector<int> #define pb push_back #define fi first #define se second #define de(x) cout<<#x<< x <<endl...
#include <bits/stdc++.h> using namespace std; long long sq(long long k) { return k * k; } long long knan(long long k, long long n) { if (n == 1) return k; else if (n == 0) return 1; else { if (n % 2 == 0) return sq(knan(k, n / 2)) % 1000000007; else return (k * ...
#include <bits/stdc++.h> using namespace std; string s; vector<char> v; int main() { ios_base::sync_with_stdio(false); getline(cin, s); int cnt = 0; bool mark; for (int i = 0; i < s.size(); i++) { if (s[i] == ) cnt++; else { v.push_back(s[i]); if (s[i] ...
#include <bits/stdc++.h> using namespace std; const long long mod = 1e9 + 7; inline long long quick(long long mul, long long b) { long long c = 1; while (b) { if (b & 1) { c = c * mul % mod; } mul = mul * mul % mod; b /= 2; } return c; } int main() { long lo...