text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; const int inf = (int)1e9; const double eps = (double)1e-8; const int mod = (int)1000000007; const int maxn = (int)2 * 1e5 + 5; int n, x, y, mx; int u[maxn], pr[maxn]; pair<int, int> t[maxn]; vector<pair<int, int> > a[maxn]; vector<int> ans; list<int> q... |
// tuner_slice.v - one leg of real->complex tuner
// 07-17-16 E. Brombaugh
module tuner_slice #(
parameter dsz = 10,
psz = 10
)
(
input clk, reset, shf_90,
input signed [dsz-1:0] in,
input [psz-1:0] phs,
output reg signed [dsz-1:0] out
);
// split acc into quadrant and address and... |
`timescale 1ns / 1ps
// @module
// display time on segment
// @input
// clk_src: clock source
// sec_data: raw seconds info
// min_data: raw minutes info
// hour_data: raw hours info
// @output
// anodes: bind to board for displaying time
// cnodes: bind to board for displaying time
module time_displayer
#(parameter W... |
// DESCRIPTION: Verilator: Verilog Test module
//
// A test case for parameterized module.
//
// When a module is instantiatied with parameter, there will be two modules in
// the tree and eventually one will be removed after param and deadifyModules.
//
// This test is to check that the removal of dead module will not... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; if (n == 2) { cout << 1 2 << endl; return 0; } bool usedN = false; for (int i = 0; i < n; i++) { int maxi = 0; for (int j = 0; j < n; j++) { int a; cin >> a; if (a > ... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int x, y = 0, z = 0; for (int i = 0; i < n; i++) { cin >> x; if (x != y) { z++; } y = x; } cout << z; 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 law... |
#include <bits/stdc++.h> using namespace std; int x1, x2, a, b; int main() { while (cin >> x1 >> x2 >> a >> b) { bool ch = false; if (x1 > x2) { swap(x1, x2); swap(a, b); a = -a; b = -b; ch = true; } int dif = abs(x1 - x2); if (a <= 0) { ... |
#include <bits/stdc++.h> using namespace std; const int N = 200005; int n, m, pos[N], ans[N]; vector<int> g[N]; map<int, int> tot; struct data { int a, i; } a[N]; bool cmp(data u, data v) { return u.a > v.a; } int main() { cin >> n >> m; for (int i = 1; i <= n; ++i) { scanf( %d , &a[... |
`timescale 1ns/1ps
module test;
reg pass;
reg c1reg,c2reg;
wire rla, rlc, rlo;
wire rha, rhc, rho;
wire c1 = c1reg;
wire c2 = c2reg;
// Pull the pins opposite to the arm.
pulldown pd1 (rla);
pullup (weak1) pu1 (rlc,rlo);
pulldown (weak0) pd2 (rhc,rho);
pullup pu2 (rha);
SPDT_RELAY rl (.COIL... |
// hps_design_mm_interconnect_0_avalon_st_adapter.v
// This file was auto-generated from altera_avalon_st_adapter_hw.tcl. If you edit it your changes
// will probably be lost.
//
// Generated using ACDS version 15.0 145
`timescale 1 ps / 1 ps
module hps_design_mm_interconnect_0_avalon_st_adapter #(
parameter inBi... |
#include <bits/stdc++.h> using namespace std; const int SQ = 350; const int MAX_N = 100000; deque<int> a[MAX_N / SQ + 10]; int num[MAX_N / SQ + 10][MAX_N + 10]; int N, Q, lastans = 0; void print() { for (int i = 0; i <= N / SQ; i++) { for (int j = 0; j < a[i].size(); j++) { cout << a[i][... |
#include <bits/stdc++.h> using namespace std; long long int modExp(long long int base, long long int power) { if (power == 0) { return 1; } else { long long int cur = modExp(base, power / 2); cur = cur * cur; cur = cur % 1000000007; if (power % 2 == 1) cur = cur * base; c... |
#include <bits/stdc++.h> const long long pinf = ((long long)2e18); const long long ninf = ((long long)-2e18); const long long mod = 1000000007; using namespace std; long long power(long long x, long long n, long long M) { if (n == 0) return 1; else if (n % 2 == 0) return power((x * x) % M,... |
//
// Paul Gao 06/2019
//
// This is an adapter from bsg_noc_ready_and_link to bsg_wormhole_link
// It assumes that wormhole link and bsg_noc link are in different clock regions, two
// asynchronous fifos are instantiated in this adapter to cross the clock domain.
//
// It also assumes that the ral (ready_and_link) pa... |
#include <bits/stdc++.h> using namespace std; template <class T> void read(vector<T> &a, long long n) { T x; a.clear(); for (long long i = 0; i < n; i++) { cin >> x; a.push_back(x); } } template <class T> void write(vector<T> &a) { for (T x : a) cout << x << ; cout << ... |
/*
* 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 = 998244353; const int MN = 1 << 8; int exp(int x, int n) { int ret = 1; while (n) { if (n & 1) ret = 1LL * ret * x % mod; x = 1LL * x * x % mod; n >>= 1; } return ret; } int inv(int x) { return exp(x, mod - 2); } ... |
#include <bits/stdc++.h> using namespace std; int n, ans, v[1009], m, c[1009]; vector<int> e; int main() { cin >> n; for (int i = 1; i <= n; i++) cin >> v[i]; for (int i = 2; i <= n; i++) { if (v[i] == 0 and v[i - 1] == 1 and v[i + 1] == 1) c[++m] = i + 1; } ans = m; for (int i = 1... |
#include <bits/stdc++.h> using namespace std; int main() { string pixels; getline(cin, pixels); getline(cin, pixels); int len = 0, flen = 0, last = pixels.at(0) - 0 ; bool first = false; for (int i = (0); i < (pixels.size()); i += (2)) { if ((pixels.at(i) == 0 && last == 0) || ... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
#include <bits/stdc++.h> using namespace std; long long MOD = 1e9 + 7; long long pow(long long x, long long v) { if (v == 0) return 1LL; if (v % 2) return (x % MOD) * pow(x % MOD, v - 1) % MOD; return pow((x * x) % MOD, v / 2) % MOD; } int main() { int n; long long x, sum = 0, v, mx = 0; ... |
#include <bits/stdc++.h> using namespace std; int n, m; int a[50]; double dp[51][51][51]; bool viz[51][51][51]; long long choose[51][51]; double go(int i, int j, int k) { if (i == m - 1) return j <= a[i] * k; double &d = dp[i][j][k]; if (viz[i][j][k]) return d; double res = 0; for (int... |
#include <bits/stdc++.h> using namespace std; int MOD = 1000000007; int dp[1001][1001]; int main() { int k; cin >> k; int balls[1000]; int n = 0; for (int i = 0; i < k; i++) { cin >> balls[i]; n += balls[i]; } long long l = 1; for (int i = 0; i <= n; i++) { dp[i... |
#include <bits/stdc++.h> int main() { long long n; scanf( %lld , &n); if (n <= 1) { printf( -1 ); } else { printf( %lld %lld %lld , n, n + 1, n * (n + 1)); } 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> #include<algorithm> #include<iostream> #include<cstdio> #include<cmath> #include<cstring> #include<stack> #include<queue> using namespace std; typedef long long ll; const ll INF=0x7f7f7f7f; const int maxn=2e5+7; const ll mod=1e9+7; ll read(){ ll f=0,x=0;char ch=ge... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
#include <bits/stdc++.h> using namespace std; char s[100001], a[5] = hard ; int x[100001]; long long d[5][100001]; const long long inf = 0x3f3f3f3f3f3f3f3f; int main() { int n; scanf( %d , &n); for (int i = 1; i <= n; i++) scanf( %c , &s[i]); for (int i = 1; i <= n; i++) scanf( %d , &x[i])... |
#include <bits/stdc++.h> using namespace std; long long g, x, y, z; int n, m; int nn, mm; deque<long long> q; long long a[3010][3010]; long long b[3010][3010]; long long c[3010][3010]; int main() { scanf( %d%d%d%d , &nn, &mm, &n, &m); scanf( %lld%lld%lld%lld , &g, &x, &y, &z); for (int i =... |
#include <bits/stdc++.h> using namespace std; int p[200010], q, l[200010], c[200010], par[20][200010]; stack<int> st; int main() { int j, i, q, u, v, n; scanf( %d , &n); for (i = 0; i < n; i++) { scanf( %d%d , &p[i], &l[i]); l[i] += p[i]; } scanf( %d , &q); memset(par, -1, si... |
#include <bits/stdc++.h> using namespace std; int n; int x[5001]; int ans[5001][5001]; int init() { int i, j; for (i = 1; i <= n; i++) ans[i][1] = x[i]; for (j = 2; j <= n; j++) { for (i = 1; i + j - 1 <= n; i++) ans[i][j] = ans[i][j - 1] ^ ans[i + 1][j - 1]; } for (j = 2; j ... |
#include <bits/stdc++.h> using namespace std; int main() { int a, b; cin >> a >> b; cout << min(a, b) << << (max(a, b) - min(a, b)) / 2; 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... |
// This counter will counter down from val_i to 0. When the counter
// hits 0, the output clk_r_o will invert. The number of bits wide
// the counter is can be set with the width_p parameter.
//
// Random ideas: could have a variant of this that takes two inputs
// one for the high duty cycle and one for the low duty c... |
#include <bits/stdc++.h> using namespace std; int main() { map<char, int> ma; char a; int b; cin >> b; for (int i = 0; i < b; i++) { cin >> a; ma[a]++; } for (auto i : ma) for (int j = 0; j < i.second; j++) cout << i.first; } |
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c; cin >> a; b = 1; while ((b * b + 1) / 2 < a) b += 2; cout << (a == 3 ? 5 : b); return 0; } |
#include <bits/stdc++.h> using namespace std; int main() { long int n, k, t; cin >> n >> k >> t; if (t < k) cout << t << endl; else if (t > n) cout << k - (t - n) << endl; else cout << k << endl; } |
/**
* ------------------------------------------------------------
* Copyright (c) All rights reserved
* SiLab, Institute of Physics, University of Bonn
* ------------------------------------------------------------
*/
`timescale 1ps/1ps
`default_nettype none
module seq_rec #(
parameter BASEADDR = 0,
para... |
/*
DCPU16 Verilog Implementation
Copyright (C) 2012 Shawn Tan <>
This program 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 Software Foundation, either version 3 of the
License, or (at your option) any later version. ... |
#include <bits/stdc++.h> using namespace std; const long int m = 1000000007; int prsb(long long int n) { int pos = 0; long long int m = 1; while (!(n & m)) { m = m << 1; pos++; } return pos; } int main() { int t; cin >> t; while (t--) { long long int a, b; ... |
#include <bits/stdc++.h> using namespace std; const long long mod = 1e9 + 7; const int N = 5 + 1e5; int main() { int a, b, c, m, ans = 0; ios::sync_with_stdio(0); cin.tie(); cin >> a >> b; c = a - b; if (c < 0) cout << 0; else if (c == 0) cout << infinity ; else { ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 300500; int n, m, q; vector<int> g[maxn]; bool used[maxn]; int p[maxn], sz[maxn], diameter[maxn]; int maxi, maxiV; void dfs(int v, int depth, int p) { if (depth > maxi) { maxi = depth; maxiV = v; } for (size_t i = 0; ... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int i, n, d, e; cin >> n >> d >> e; e *= 5; int min = n % e; for (i = 0; i <= n / d; i++) { if ((n - (i * d)) % e < min) min = (n - (i * d)) % e; } if ((n % e) % d < ... |
#include <bits/stdc++.h> using namespace std; const long long M = 1e9 + 7; const long long N = 60, K = 10000 + 5; long long dp[K][N]; long long prob[N][N]; long long n, k; long long inv[N]; long long power(long long a, long long k) { if (k == 0) return 1; long long ans = power(a, k / 2); ans... |
#include <bits/stdc++.h> using namespace std; int main() { bool tr = false; int n; cin >> n; for (int i = 0; i < n; i++) { int x, y; cin >> x >> y; if (x != y) tr = true; } if (tr) cout << Happy Alex n ; else cout << Poor Alex n ; return 0; } |
//-----------------------------------------------------------------------------
//
// (c) Copyright 2009-2011 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 propert... |
#include <bits/stdc++.h> using namespace std; void read(vector<long long> &v) { for (int i = 0; i < v.size(); i++) cin >> v[i]; } void print(vector<long long> v) { for (int i = 0; i < v.size(); i++) cout << v[i] << ; } long long n, m, a, b, temp, x, y; string str; set<string> strings; unord... |
module t_multiply;
wire Ready;
wire [15:0] PR;
reg [7:0] multiplier, multiplicand;
integer i, j;
reg start, clock, reset, passed;
multiply uut(clock, reset, start, multiplier, multiplicand, PR, Ready);
always #5 clock = ~clock;
initial
begin
passed = 1;
clock = 0;
start = 0;
reset = 0;
#100;
reset = 1;
#20;
... |
/**
* 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... |
// (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... |
// Interface control
module ifctl(
input clk_sys,
input clo,
input gotst1,
input zgi_j,
input zgi_set,
input ifhold_j,
input ifhold_reset,
input zw,
input ren,
input rok,
output reg ok$,
output zg,
output zwzg,
output talarm
);
parameter ALARM_DLY_TICKS;
parameter ALARM_TICKS;
// Cała obsługa interf... |
/* verilator lint_off STMTDLY */
module emesh_monitor(/*AUTOARG*/
// Inputs
clk, nreset, dut_access, dut_packet, wait_in, coreid
);
parameter PW = 104;
parameter IDW = 12;
parameter INDEX = 0;
parameter NAME = "not_declared";
//clock and reset
input clk;
input ... |
`include "example1.generated.vh"
`default_nettype none
module Example1 (input wire CLK, input wire nRST,
input wire request$say__ENA,
input wire [31:0]request$say$v,
output wire request$say__RDY,
output wire indication$heard__ENA,
output wire [31:0]indication$heard$v,
input wire indication$hear... |
#include <bits/stdc++.h> using namespace std; const int N = 105; char s[N], t[N]; int dis(char a, char b) { int t = abs(a - b); return min(t, 26 - t); } int main() { int n; scanf( %d , &n); scanf( %s , s + 1); t[1] = A , t[2] = C , t[3] = T , t[4] = G ; int ans = 1e9; for... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
module AUDIO_DAC_FIFO ( // FIFO Side
iDATA,iWR,iWR_CLK,
oDATA,
// Audio Side
oAUD_BCK,
oAUD_DATA,
oAUD_LRCK,
oAUD_XCK,
// Control Signals
iCLK_18_4,
iRST_N );
parameter REF_CLK = 18432000; // 18.432 MHz
parameter SAMPLE_RATE = 48000; /... |
#include <bits/stdc++.h> using namespace std; const long long N = 3e6; long long n, m; long long a[N]; long long read(void) { long long s = 0, w = 0; char c = getchar(); while (c < 0 || c > 9 ) w |= c == - , c = getchar(); while (c >= 0 && c <= 9 ) s = s * 10 + c - 48, c = getchar(); ... |
#include <bits/stdc++.h> using namespace std; long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; } long long n, m, a, b, x, y; int main() { cin >> n >> m >> x >> y >> a >> b; long long k = gcd(a, b); long long kk = min(n / (a / k), m / (b / k)); a = a * kk / k, b = b * kk / ... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
#include <bits/stdc++.h> using namespace std; int a[200]; int main() { int t; cin >> t; while (t--) { int m, n; cin >> m >> n; for (int i = 1; i <= m; i++) { cin >> a[i]; } map<int, int> mp; for (int i = 1; i <= n; i++) { int x; cin >> x; ... |
#include <bits/stdc++.h> using namespace std; int arr[60]; signed main() { ios::sync_with_stdio(0); cin.tie(0); int n; cin >> n; for (int i = 0; i < n; ++i) cin >> arr[i]; sort(arr, arr + n); bool aliceWins = (arr[0] < arr[n >> 1]); cout << (aliceWins ? Alice n : Bob n ); } |
typedef logic [3:0][1:0] sometype_t;
module top
#(parameter X=4,
parameter Y=1)
(input clk,
input rstb,
/*AUTOINPUT("^x.*\|v.*")*/
// Beginning of automatic inputs (from unused autoinst inputs)
input [X-1:0] xb, // To XX of xx.v, ...
// End of automatics
/*AU... |
//
// Copyright 2011 Ettus Research LLC
//
// 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, either version 3 of the License, or
// (at your option) any later version.
//
// This program is dis... |
/*
Distributed under the MIT license.
Copyright (c) 2015 Dave McCoy ()
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, mo... |
/**
* 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 = 1e5 + 7; int n, m, B, a[N], c[N], ans[N]; struct Node { int l, r, id; Node() {} Node(int _l, int _r, int _id) { l = _l, r = _r, id = _id; } bool operator<(const Node &p) const { return r < p.r; } } Q[N]; vector<int> V, q[400]; int... |
#include <bits/stdc++.h> using namespace std; struct rec { double x, y; } v, p, w1, w2, m1, m2, p_, m; double eps = 1e-10; inline rec operator+(rec a, rec b) { return (rec){a.x + b.x, a.y + b.y}; } inline rec operator-(rec a, rec b) { return (rec){a.x - b.x, a.y - b.y}; } double mul(rec a, rec b, rec ... |
#include <bits/stdc++.h> using namespace std; void Get(int &T) { char C; bool F = 0; for (; C = getchar(), C < 0 || C > 9 ;) if (C == - ) F = 1; for (T = C - 0 ; C = getchar(), C >= 0 && C <= 9 ; T = T * 10 + C - 0 ) ; F && (T = -T); } int N; void Init() { Get(N); } ... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; long long n, a[100100]; bool vis[100100]; vector<long long> v; int main() { long long n; cin >> n; for (int i = 0; i < n; i++) cin >> a[i]; sort(a, a + n); if (a[n - 1] >= a[n - 2] + a[n - 3]) { cout << NO << endl; return 0; }... |
#include <bits/stdc++.h> using namespace std; long long bigmod(long long p, long long e, long long M) { long long ret = 1; for (; e > 0; e >>= 1) { if (e & 1) ret = (ret * p) % M; p = (p * p) % M; } return ret; } long long extended(long long a, long long b, long long &x, long long &y... |
#include <bits/stdc++.h> using namespace std; int main() { long long a, b; scanf( %I64d %I64d , &a, &b); long long t = 0; while (b) { t *= 10; t += b % 10; b /= 10; } printf( %I64d n , a + t); return 0; } |
#include <bits/stdc++.h> #pragma GCC optimize( O3 ) using namespace std; int n, m, t, k; int d[((int)1e5 + 5)]; int countt[105]; int l = 1; int r = 100; void lbulma() { while (countt[l] == 0) l++; return; } void rbulma() { while (countt[r] == 0) r--; return; } int asal[4] = {2, 3... |
/**
* 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 = 1 << 16; int n, m; int d[2][N]; int get_n(int x, int n) { int tmp = 3 << (n * 2); tmp = x & tmp; tmp >>= n * 2; return tmp; } int set_n(int x, int n, int y) { int tmp = 3 << (n * 2); x = x & (~tmp); y <<= (n * 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> int main() { std::map<long, long> map; long q, id, leftMAX = 0, rightMAX = 0, firstTime = 0; char c; std::cin >> q; while (q--) { std::cin >> c >> id; if (!firstTime--) { map.insert(std::pair<long, long>(id, 0)); } else { if (c == ? ) ... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; int main() { int i, j; int n; cin >> n; long long int a[n + 1]; map<long long, long long> m; for (i = 1; i <= n; i++) { cin >> a[i]; m[a[i]]++; } long long ans = 0; multiset<long long> s; for (auto it = m.begin(); it !... |
`define ADDER_WIDTH 020
`define DUMMY_WIDTH 128
`define 2_LEVEL_ADDER
module adder_tree_top (
clk,
isum0_0_0_0, isum0_0_0_1, isum0_0_1_0, isum0_0_1_1, isum0_1_0_0, isum0_1_0_1, isum0_1_1_0, isum0_1_1_1,
sum,
);
input clk;
input [`ADDER_WIDTH+0-1:0] isum0_0_0_0, isum0_0_0_1, isum0_0_1_0, isum0_0_1_1, isum0_1_0_0,... |
/*******************************************************************************
* Module: fifo_same_clock
* Date:2014-05-20
* Author: Andrey Filippov
* Description: Configurable synchronous FIFO using the same clock for read and write
*
* Copyright (c) 2014 Elphel, Inc.
* fifo_same_clock.v is free software; y... |
module spi_rx(
clk,
reset_n,
sdi,
sck,
ss_n,
adrs,
data,
rx_valid);
input wire clk, reset_n, sdi, sck, ss_n;
output wire rx_valid;
output wire [7:0] adrs, data;
reg [15:0] shift_reg, rx_buf1, rx_buf2;
reg [3:0] rx_cnt;
reg [2:0] ... |
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2016.3 (win64) Build Mon Oct 10 19:07:27 MDT 2016
// Date : Mon Sep 18 12:05:38 2017
// Host : PC4719 running 64-bit Service Pack 1 (... |
#include <bits/stdc++.h> using namespace std; template <typename T> void pr(vector<T> &v) { for (int i = 0; i < (int)(v).size(); i++) cout << v[i] << ; cout << n ; ; } template <typename T> void pr(vector<vector<T>> &v) { for (int i = 0; i < (int)(v).size(); i++) { pr(v[i]); }... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 7; const long long MOD = 1e9 + 7; long long f[N << 2], lazy[N << 2], a[N], b[N], c[N]; void up(int x, int l, int r, long long y) { f[x] = (f[x] + y * (r - l + 1)) % MOD; lazy[x] = (lazy[x] + y) % MOD; } void push_down(int x, int l, ... |
module instruction_arbiter
(/*AUTOARG*/
// Outputs
simd0_alu_select, simd1_alu_select, simd2_alu_select,
simd3_alu_select, simf0_alu_select, simf1_alu_select,
simf2_alu_select, simf3_alu_select, lsu_lsu_select,
salu_alu_select, lsu_wfid, alu_wfid, issued_wfid, alu_valid,
lsu_valid, issued_valid,
... |
`include "assert.vh"
`include "cpu.vh"
module cpu_tb();
reg clk = 0;
//
// ROM
//
localparam MEM_ADDR = 4;
localparam MEM_EXTRA = 4;
reg [ MEM_ADDR :0] mem_addr;
reg [ MEM_EXTRA-1:0] mem_extra;
reg [ MEM_ADDR :0] rom_lower_bound = 0;
reg [ MEM_ADDR :0] rom_upper_bo... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); int n, m; cin >> n >> m; vector<int> cnt(n + 1, false), idx(n + 1), ans(m + 1), b(m + 1); for (int i = 1; i <= n; i++) { int x; cin >> x; cnt[x]++; idx[x] = i; } for (int ... |
#include <bits/stdc++.h> using namespace std; inline int read() { char c = getchar(); int x = 0; bool f = 0; for (; !isdigit(c); c = getchar()) f ^= !(c ^ 45); for (; isdigit(c); c = getchar()) x = (x << 1) + (x << 3) + (c ^ 48); if (f) x = -x; return x; } int n, m, k, s; vector<in... |
//Legal Notice: (C)2019 Altera Corporation. All rights reserved. Your
//use of Altera Corporation's design tools, logic functions and other
//software and tools, and its AMPP partner logic functions, and any
//output files any of the foregoing (including device programming or
//simulation files), and any associated do... |
#include <bits/stdc++.h> using namespace std; const int MOD = 1e9 + 7; int n, k; int A[25], B[2]; int fact[25]; int mod(long long int a) { return (a % MOD + MOD) % MOD; } int poww(int pw) { if (pw == 0) return 1; return 3 * poww(pw - 1); } int result = 0; int precompute(int U1) { int ret... |
#include <bits/stdc++.h> int x[2002], y[2002]; using namespace std; int main() { int n; cin >> n; set<int> S; for (int i = 1; i <= n; ++i) { cin >> x[i]; S.insert(x[i]); } for (int i = 1; i <= n; ++i) { cin >> y[i]; S.insert(y[i]); } int val = 0; for (in... |
#include <bits/stdc++.h> using namespace std; bool cmpDouble(const double& a, const double& b) { return std::fabs(a - b) < std::numeric_limits<double>::epsilon(); } int main() { int n, k; cin >> n >> k; int arr[5001]; int ans[5001]; for (int i = 0; i < n; ++i) { cin >> arr[i]; ... |
#include <bits/stdc++.h> using namespace std; int seq[100]; void display(const int n) { for (int i = 0; i < n; ++i) printf( %d , seq[i]); putchar( n ); } int compute_sum(const int n) { int sum = 0; for (int i = 0; i < n; ++i) { int x = seq[i]; for (int j = i; j < n; ++j) { ... |
// Check that packed arrays of all sorts get elaborated without an error and
// that the resulting type has the right packed width.
package p;
typedef logic [2:0] vector;
endpackage
module test;
typedef bit bit2;
typedef logic [1:0] vector;
bit2 [1:0] b;
vector [2:0] l;
p::vector [3:0] scoped_pa;
typedef enum lo... |
//////////////////////////////////////////////////////////////////////
//// ////
//// Top module for HIGHT Crypto Core ////
//// ////
//// This file is part of the HIGHT... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer: Juan Jos� Rojas Salazar
//
// Create Date: 08/01/2016 03:34:00 PM
// Design Name:
// Module Name: DESNORMALIZADOR_DESLINEALIZADOR
// Project Name:
// Target Devices:
// Tool Versions:
/... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 04/26/2016 08:42:14 AM
// Design Name:
// Module Name: ROM_test
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
// R... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.