text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; const int MX = 200100; int N, M; char S[MX]; int A[MX]; struct Segment { int a, b, c, d, e; int z, l, r; void add(int x) { a += x, b += x, c -= x, d -= x, z += x; } } T[MX << 2]; inline void PushUp(int i) { Segment &t = T[i], &x = T[(i << 1)]... |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: bw_io_ddr_vref_logic.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... |
#include <bits/stdc++.h> int main() { int i, j, k, l; long long n, m, sum; while (scanf( %lld%lld , &n, &m) != EOF) { sum = 0; for (int i = 1; i <= n; i++) { if (m % i == 0 && m / i <= n) { ++sum; } } printf( %d n , sum); } return 0; } |
#include <bits/stdc++.h> const int a[250] = {0, 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51, 1, 2, 1, 14, 1, 2, 2, 14, 1, 6, 1, 4, 2, 2, 1, 52, 2, 5, 1, 5, 1, 15, 2, 13, 2, 2, ... |
#include <bits/stdc++.h> using namespace std; int len, pos; void insert(int x) { len++; if (x <= pos) pos++; } void erase(int x) { if (x >= pos) len = x; else len -= x, pos -= x; } int main() { int m, t; scanf( %d%d%d%d , &len, &pos, &m, &t); while (t--) { int... |
#include <bits/stdc++.h> using namespace std; int n, ans; int f[1000]; int main() { scanf( %d , &n); for (int i = 1; i <= n; i++) for (int j = 1; j <= n; j++) { if (i + j - 1 <= n) { for (int k = j; k <= i + j - 1; k++) f[k]++; } } for (int i = 1; i <= n; i++) a... |
// ***************************************************************************
// ***************************************************************************
// Copyright 2014 - 2017 (c) Analog Devices, Inc. All rights reserved.
//
// In this HDL repository, there are many different and unique modules, consisting
// of... |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: terminator.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/or... |
// (c) Copyright 1995-2017 Xilinx, Inc. All rights reserved.
//
// This file contains confidential and proprietary information
// of Xilinx, Inc. and is protected under U.S. and
// international copyright and other intellectual property
// laws.
//
// DISCLAIMER
// This disclaimer is not a license and does not grant ... |
/**
* 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) yyyy Ronan Barzic -
// Date : Fri Apr 22 13:25:26 2016
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published... |
#include <bits/stdc++.h> using namespace std; long long int binarySearch(long long int* arr, long long int l, long long int r, long long int x) { if (r >= l) { long long int mid = l + (r - l) / 2; if (arr[mid] == x) return mid; if (arr[mid] > x) return binarySearch... |
// ==============================================================
// 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 1 ns / 1 ps
m... |
#include <bits/stdc++.h> using namespace std; int main() { char str[999]; cin >> str; str[0] = toupper(str[0]); cout << str << endl; return 0; } |
///////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2014 Francis Bruno, All Rights Reserved
//
// 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... |
#include <bits/stdc++.h> using namespace std; const int N = (int)1e5 + 7; int n; int v[N], f[N]; bool e[N]; int st, dr; bool ok(int l, int r) { for (int i = 1; i <= n; i++) { e[i] = 0; f[i] = 0; } for (int i = l; i <= r; i++) { e[i] = 1; f[v[i]]++; } for (int i ... |
#include <bits/stdc++.h> using namespace std; const int INT_INF = 1e9; const long long LL_INF = 1e18; const int MAXN = 200003; int n, m; int A[MAXN]; long long calc(int m) { long long ret = 0; map<int, int> dp; int sum = 0; dp[sum] = 1; long long add = 0; for (int i = 1; i <= n; i+... |
#include <bits/stdc++.h> using namespace std; const int INF = 100 * 30; int main() { string A, B; cin >> A >> B; vector<vector<int> > v(26, vector<int>(26, INF)); for (int i = 0; i < 26; ++i) v[i][i] = 0; int N; cin >> N; while (N--) { char a, b; int cost; cin >> a >>... |
#include <bits/stdc++.h> using namespace std; int main() { long long t; cin >> t; while (t--) { long long n, k; cin >> n >> k; vector<long long> p; vector<long long> pre; for (long long i = 0; i < n; i++) { p.push_back(i + 1); } long long sum = 0; ... |
//`define ICDEBUG 1
`ifdef FPGA
// `define DUMMY_CACHE
`endif
// Number of cache lines
`define IC_WIDTH_BITS 4
`define IC_LINES_BITS 6
`define IC_WIDTH_ZERO 4'b0000
`define IC_WIDTH_ONES 4'b1111
`define IC_WIDTH (1<<`IC_WIDTH_BITS)
`define IC_LINES (1<<`IC_LINES_BITS)
`ifdef DUMMY_CACHE
module toy_icache(input clk,... |
/*
Copyright (c) 2018 Alex Forencich
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute,... |
#include <bits/stdc++.h> using namespace std; int read() { int x = 0, f = 1; char c = getchar(); while (c < 0 || c > 9 ) { if (c == - ) f = -1; c = getchar(); } while ( 0 <= c && c <= 9 ) { x = x * 10 + c - 0 ; c = getchar(); } return x * f; } int n, m,... |
// (C) 2001-2015 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 doc... |
// Accellera Standard V2.3 Open Verification Library (OVL).
// Accellera Copyright (c) 2005-2008. All rights reserved.
`ifdef OVL_SHARED_CODE
parameter NUM_CKS_1 = (num_cks-1);
parameter NUM_CKS_2 = (NUM_CKS_1 > 0) ? (NUM_CKS_1 - 1) : 0;
reg [NUM_CKS_1:0] seq_queue;
`ifdef OVL_SYNTHESIS
`else
initial 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 law... |
#include <bits/stdc++.h> using namespace std; int main() { long n; while (cin >> n) { long flag = 0, count = 0, a[100005] = {0}, i; for (i = 0; i < n; i++) cin >> a[i]; for (i = n - 1; i > 0; i--) { if (a[i - 1] > a[i]) break; else count++; } ... |
`timescale 1ns / 1ns
module meganode_tb();
wire clk_20;
sim_clk #(20) sim_clk_20_inst(.clk(clk_20));
wire clk_25;
sim_clk #(25) sim_clk_25_inst(.clk(clk_25));
wire clk_50;
sim_clk #(50) sim_clk_50_inst(.clk(clk_50));
wire clk_48;
sim_clk #(48) sim_clk_48_inst(.clk(clk_48));
wire clk_100;
sim_clk #(100) sim_clk_100... |
#include <bits/stdc++.h> using namespace std; long long min(long long a, long long b) { return (a < b) ? a : b; } int main() { long long n, m, b_max_1 = 0, b_max_2 = 0, g_min = 1e9; long long sum_b = 0, sum_g = 0; cin >> n >> m; long long b[n], g[m]; for (int i = 0; i < n; ++i) { cin >> ... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n; string s; cin >> s; set<char> S; int ans = 0; for (int i = 0; i <= s.size(); ++i) { if (i == s.size() || isupper(s[i])) { ans = max(ans, (int... |
// (C) 2001-2011 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 doc... |
`ifndef MEMORY_V
`define MEMORY_V
`define MEM_CMD_WIDTH 1
`define MEM_CMD_READ 1'b0
`define MEM_CMD_WRITE 1'b1
module memory#(
parameter ADDRESS_WIDTH=32,
parameter DATA_WIDTH=32,
parameter SIZE = 1024*1024,
parameter READ_DELAY = 22,
parameter WRITE_DELAY = 15
)(
input clk,
input reset,
input [A... |
#include <bits/stdc++.h> using namespace std; int ispalin(string a) { string b = a; reverse(b.begin(), b.end()); return a == b; } int main() { string str; cin >> str; int N = str.size(); for (int i = 0; i <= N; i++) { for (char xc = a ; xc <= z ; xc++) { string str1; ... |
/*******************************************************************************
* 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 ... |
// 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 : Fri Oct 27 10:21:12 2017
// Host : Juice-Laptop running 64-bit major relea... |
/*
* 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... |
// --------------------------------------------------------------------
// ng_ADR.v - Address decoding and Bank Register selection logic
// --------------------------------------------------------------------
`include "ControlPulses.h"
// --------------------------------------------------------------------
module ng_AD... |
#include <bits/stdc++.h> using namespace std; const long long MOD = 1e9 + 7; template <class T> void chmin(T &a, const T &b) { if (a > b) a = b; } template <class T> void chmax(T &a, const T &b) { if (a < b) a = b; } long long dp[200020]; const long long INF = 1e18; int main() { cin.ti... |
/*
* 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; long long t, d, ct, q, ans, l, m, r, n, mx, mn, i, j, k, x, y, z, s; char ch; string ss = , str = ; long long a[200003], b[200003]; long long pref[200003]; int main() { ios_base::sync_with_stdio(false), cin.tie(nullptr); s = k = d = l = mx = m = mn... |
#include <bits/stdc++.h> using namespace std; char t[200002]; struct node { int nt[5][5]; }; node st[4 * 200000 + 2]; node merge(node a, node b) { if (a.nt[0][0] == -1) return b; if (b.nt[0][0] == -1) return a; node ans; for (int i = 0; i <= 4; i++) for (int j = 0; j <= 4; j++) ans... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); long long n; cin >> n; unordered_map<long long, long long> mymap; long long maxval = INT_MIN, minval = INT_MAX; for (int i = 0; i < n; i++) { long long temp; cin >> temp; ... |
#include <bits/stdc++.h> using namespace std; template <typename T> vector<T> uniq(vector<T> v) { sort(v.begin(), v.end()); v.erase(unique(v.begin(), v.end()), v.end()); return v; } template <typename T> struct RMQ { using F = function<T(const T &, const T &)>; int n; vector<T> 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... |
/*
* Copyright (c) 2013, Quan Nguyen
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this
* list of conditi... |
/**
* 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: sun.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// ================================... |
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2016.4 (win64) Build Wed Dec 14 22:35:39 MST 2016
// Date : Mon May 08 23:35:07 2017
// Host : GILAMONSTER running 64-bit major release (... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2012 by Wilson Snyder.
/* Acceptable answer 1
created tag with scope = top.t.tag
created tag with scope = top.t.b.gen[0].tag
created tag with scope = top.t.b.gen[1].tag
mod a has scop... |
#include <bits/stdc++.h> int main() { long long int n; scanf( %lld , &n); printf( %lld n , n / 2 + 1); long long int count1 = 0; long long int count2 = 1; for (int i = 1; i <= n; i++) { if (i % 2 == 0) { count2++; } else { count1++; } printf( %lld %lld n... |
// megafunction wizard: %ROM: 1-PORT%VBB%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: stage3.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// =============================... |
/**
* 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: dcfifo
// ============================================================
// File Name: fifo_267x128.v
// Megafunction Name(s):
// dcfifo
//
// Simulation Library Files(s):
// altera_mf
// ==============================... |
//#############################################################################
//# Function: Generic RAM memory #
//#############################################################################
//# Author: Andreas Olofsson #
... |
#include <bits/stdc++.h> using namespace std; long long int INF = 1000000000; vector<vector<int> > v; int* dist; void bfs(int ver, int n) { bool vis[n]; for (int i = 0; i < n; i++) vis[i] = false; vis[ver] = true; queue<pair<int, int> > q; q.push(make_pair(ver, 0)); while (!q.empty()) ... |
#include <bits/stdc++.h> using namespace std; const int INF = 100005; const long long LL_INF = (long long)2e18 + 5; inline int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); } const long long mod = 1000000007; bool isprime(long long n) { for (long long i = 2; i * i <= n; ++i) { if (n % i =... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 16:40:26 10/09/2014
// Design Name: mojo_top
// Module Name: /home/bjones/src/fpga-tunes/test/mojo_top_tb.v
// Project Name: fpga-tunes
// Target Device:
// Tool v... |
// ***************************************************************************
// ***************************************************************************
// Copyright 2014 - 2017 (c) Analog Devices, Inc. All rights reserved.
//
// In this HDL repository, there are many different and unique modules, consisting
// of... |
#include <bits/stdc++.h> using namespace std; int n; char a[1 << 9][1 << 9]; void solve(int n) { if (n == 0) { a[0][0] = + ; return; } solve(n - 1); int mid = 1 << (n - 1); for (int i = (mid), _b = ((1 << n) - 1); i <= _b; ++i) for (int j = 0, _a = (mid); j < _a; ++j) a[i]... |
#include <bits/stdc++.h> using namespace std; int n, x, l, r, m; int main() { cin >> n; int endtime = 0; while (n--) { cin >> x; endtime += x; } cin >> m; while (m--) { cin >> l >> r; if (endtime <= l) { cout << l << endl; return 0; } else if (... |
// DESCRIPTION: Verilator: Test symbol table scope map and general public
// signal reflection
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2015 by Todd Strader.
// SPDX-License-Identifier: CC0-1.0
module t
(
input wire CLK
);
foo #(.WIDTH (1)) foo1 (.*);
foo ... |
#include <bits/stdc++.h> using namespace std; const int MAX_N = 1e6 + 5; int arr[MAX_N]; int vis[MAX_N]; void solve() { int n; scanf( %d , &n); for (int i = 1; i <= n; i++) { scanf( %d , &arr[i]); vis[i] = 0; } vector<int> stk; for (int i = 1; true; i = i - arr[i]) { ... |
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2016.4 (win64) Build Wed Dec 14 22:35:39 MST 2016
// Date : Sun Apr 09 08:38:15 2017
// Host : GILAMONSTER running 64-bit major release (... |
/**
* This is written by Zhiyang Ong
* and Andrew Mattheisen
*/
`timescale 1ns/100ps
/**
* `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 must be 1 10 or 100
* -base is the time base... |
#include <bits/stdc++.h> using namespace std; int a[200]; int main() { int n; scanf( %d , &n); for (int i = 1; i <= n; i++) scanf( %d , &a[i]); int res = 0, ans = 0; a[0] = -10; for (int i = 1; i <= n; i++) { if (a[i] == a[i - 1] + 1) res++; else res = 0; ... |
#include <bits/stdc++.h> using namespace std; const int maxv = 2045; const long long mod = 1e9 + 7; const int maxn = 1e6 + 40; long long fac[maxn], inv[maxn]; long long qpow(long long a, long long p) { long long ans = 1; long long xx = a; while (p > 0) { if (p & 1) ans = (xx * ans) % mod; ... |
#include <bits/stdc++.h> float a1(float x, float y, float z) { if (x >= 1.0) return z * log(y) + log(log(x)); else if (x < 1.0 && y < 1.0 && z < 1.0) return z * log(y) + log(log(1 / x)); else return 0.0 / 0.0; } float a2(float x, float y, float z) { if (x >= 1.0) return log... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m; scanf( %d %d , &n, &m); vector<string> s(n); for (string &e : s) cin >> e; vector<vector<int> > a(n, vector<int>(m, 0)); for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) scanf( %d , &a[i][j]); vector<int> d... |
#include <bits/stdc++.h> using namespace std; using ll = long long; ll min(ll a, ll b) { if (a < b) return a; return b; } void solve() { ll testCases; cin >> testCases; while (testCases--) { ll n; cin >> n; vector<ll> arr(n); vector<ll> res(n, 1); for (int 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 law... |
////////////////////////////////////////////////////////////////
// File: measure_position.v
// Author: T. Dotsikas, B. Brown
// About: Locate center (x,y) position of object
////////////////////////////////////////////////////////////////
`timescale 1ns/1ns
module measure_position #(
parameter INPUT_WIDTH = 11,... |
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2016.4 (win64) Build Wed Dec 14 22:35:39 MST 2016
// Date : Thu Feb 02 02:44:08 2017
// Host : TheMosass-PC running 64-bit major release ... |
/*
* 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; long long n, s, h; string s2, s1; long long gw(long long n, long long x) { long long rs = 0; for (__typeof(n) i = (0) - ((0) > (n)); i != (n) - ((0) > (n)); i += 1 - 2 * ((0) > (n))) { for (__typeof(n) j = (0) - ((0) > (n)); j != (n) - ((0) > ... |
#include <bits/stdc++.h> using namespace std; int n, m; char gride[5010]; vector<vector<char> > grid; vector<vector<int> > pesq, pesq2; vector<vector<int> > pdir, pdir2; vector<vector<int> > pcima, pcima2; vector<vector<int> > pbaxo, pbaxo2; void apaga(int i, int j) { if (pesq2[i][j] != -1) pdir2[... |
/**
* 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; #pragma GCC optimize( -O2 ) const int LIM = 5e5 + 5, MOD = 1e9 + 7; int t, n, m, k, x, y; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int tests; cin >> tests; cout << setprecision(10) << fixed; while (tests--) { ... |
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t > 0) { int n; cin >> n; while (n > 0) { cout << 1 << ; n--; } cout << n ; t--; } return 0; } |
`timescale 1ps / 1ps
module SEGMENT_interface_AXI_test (
);
// HELPER
function integer clogb2;
input integer value;
integer i;
begin
clogb2 = 0;
for(i = 0; 2**i < value; i = i + 1)
clogb2 = i + 1;
end
endfunction
localparam tries = 4;
localparam sword = 32;
localparam impl = 0;
localparam ... |
/*
* 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 MAX = 1000100; const int off = 1 << 19; const int inf = 1e9; int a[MAX], s[MAX], c[MAX]; pair<int, int> T[2 * off]; int n, k; pair<int, int> getmax(int i, int lo, int hi, int a, int b) { if (lo >= b || hi <= a) return {-inf, -1}; if (lo >= ... |
#include <bits/stdc++.h> using namespace std; int n; vector<pair<int, int> > v; vector<int> tail; int getIdx(int l, int r, int key) { while (l < r) { int mid = (l + r) / 2; if (tail[mid] < key) r = mid; else l = mid + 1; } return r; } int LIS() { int lengt... |
#include <bits/stdc++.h> using namespace std; int dp[(1 << 22)], a[1000000]; int main() { int N; while (scanf( %d , &N) != EOF) { memset(dp, -1, sizeof(dp)); for (int i = int(0); i < int(N); i++) { scanf( %d , a + i); dp[a[i]] = a[i]; } for (int i = int(0); i < int(... |
#include <bits/stdc++.h> using namespace std; inline long long read() { register long long x = 0, f = 1; char ch = getchar(); while (!isdigit(ch)) { if (ch == - ) f = -1; ch = getchar(); } while (isdigit(ch)) { x = (x << 1) + (x << 3) + (ch ^ 48); ch = getchar(); } ... |
#include <bits/stdc++.h> const long long mod = 1000000007; int n; long long x[1 << 20]; long long y[1 << 20]; long long d[1 << 20]; long long sx[1 << 20]; long long sy[1 << 20]; long long sd[1 << 20]; long long ssd[1 << 20]; long long cirsm(int s, int v, long long sa[] = sd) { long long ar = 0; ... |
module check (input unsigned [103:0] a, b, c);
wire [103:0] int_AB;
assign int_AB = ~(a ^ b);
always @(a, b, int_AB, c) begin
#1;
if (int_AB !== c) begin
$display("ERROR");
$finish;
end
end
endmodule
module stimulus (output reg unsigned [103:0] A, B);
parameter S = 2000;
int unsigned i;
... |
//`timescale 1 ms /1 us
`include "mux81a.v"
module chap4p32a_tb (S);
// module declaration
output [0:3] S;
reg [0:3] S;
//S[0]=A, S[1]=B, S[2]=C, S[3]=D
wire [0:7] I;
wire Y;
integer fp;
// program body
assign I[0]=~S[3];
assign I[1]=~S[3];
assign I[2]=S[3];
assign I[3]=S[3];
assign I[4]=... |
#include <bits/stdc++.h> using namespace std; const int mod = 1e9 + 7; const int nex = 2e5 + 5; void solve() { int a, b; cin >> a >> b; string s; cin >> s; int cnt = 0; vector<int> v; for (int i = 0; i < ((int)s.size()); i++) { if (s[i] == X ) { if (cnt) v.push_back(cn... |
module signed_multiplier_test;
reg failed_flag = 0;
reg signed [5:0] s_prod;
wire [2:0] u_pos_two = 3'b010;
wire signed [2:0] s_pos_two = 3'sb010;
wire signed [2:0] s_neg_two = 3'sb110;
wire s = 1'b1; // flag to indicate signed
wire u = 1'b0; // flag to indicate unsigned
initial begi... |
module testbench_BoothPPG_32R4_MSB();
reg[31:0] mulcand;
reg msb;
reg sign;
wire[31:0] pp;
BoothPPG_32R4_MSB ppg(.mulcand(mulcand), .msb(msb), .sign(sign), .pp(pp));
task check(input[31:0] cand);
reg[31:0] expectPP;
reg errorFlag;
begin
errorFlag = 0;
mulcand = cand;
sign... |
#include <bits/stdc++.h> using namespace std; const long long mod = 1e9 + 7; const long long N = 200; long long c[N][N], dp[N][N * N + N], g[N][N]; long long modp(long long a, long long b) { if (b == 0) return 1; long long u = modp(a, b / 2); u = (u * u) % mod; if (b & 1) return (a * u) % mod;... |
#include <bits/stdc++.h> using namespace std; const long long INF = 1e9 + 7; const int N = 2e2 + 10; vector<string> v[N]; int nex[N]; int flag[N]; int main() { int n; cin >> n; map<char, int> mc; memset((nex), (-1), sizeof(nex)); while (n--) { string str; cin >> str; ... |
#include <bits/stdc++.h> using namespace std; const long long MAXN = 5e5 + 5; bool vis[MAXN]; long long sp[MAXN]; long long f[MAXN]; bool is[MAXN]; long long ar[MAXN]; long long POWER[25]; long long F[25]; void sieve() { for (long long i = 0; i < MAXN; i++) vis[i] = false, sp[i] = 2; for (lo... |
`timescale 1ns / 1ps
/*
-- Module Name: Outport Scheduler Control Unit
-- Description: Maquina de control para las unidades perteneceientes al
planificador de salida. En general, el modulo espera
a recibir una peticion desde cualquier puerto
(any_request_din).
Al recibir peticiones, el modulo da la... |
/******************************************************************************
* File Name : ks58.v
* Package Module Name : Elliptic Curve Cryptoprocessor for GF(2^233)
* Author : Chester Rebeiro
* Date of Creation : 1/Apr/2008
* Type of file : Verilog source code
* Synopsis : Automatically gene... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); int a, b, t; cin >> t; int arr[t]; for (int i = 0; i < t; i++) { cin >> a >> b; arr[i] = a + b; } for (int i = 0; i < t; i++) { cout << arr[i] << 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... |
#include <bits/stdc++.h> using namespace std; const int N = 2111; const int mod = 1e9 + 7; int n; int pri[N], tot; long long a[N], b[N]; struct node { long long k, b; node(long long _k = 0, long long _b = 0) { k = _k; b = _b; } } f[N], g[N]; long long gcd(long long x, long long... |
#include <bits/stdc++.h> using namespace std; const int maxN = 1000 + 10; int n, flag, a[maxN], i, j, m; int main() { cin >> n; for (i = 2; i <= n; i++) { for (j = 2; j * j <= i; j++) { if (i != j && i % j == 0) flag = 1; } j = i; while (flag == 0 && j <= n) { a[m... |
/**
* 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: RIT
// Engineer: Cody Cziesler, Nick Desaulniers
//
// Create Date: 10:58:44 04/07/2011
// Design Name: data_path
// Module Name: data_path
// Project Name: Data Path for the Pipel... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.