text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; string st[n]; int a[m]; for (int i = 0; i < n; i++) { cin >> st[i]; } for (int i = 0; i < m; i++) { cin >> a[i]; } int maxa = 0; int ca, cb, cc, cd, ce; for (int i = 0; i < 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... |
#include <bits/stdc++.h> using namespace std; void solve() { long long n; cin >> n; vector<long long> v(n + 1); long long s = 0; for (long long i = 1; i <= n; i++) { cin >> v[i]; s += v[i] - i, v[i] = i; } for (long long i = 1; i <= n; i++) v[i] += s / n; for (long long i... |
#include <bits/stdc++.h> using namespace std; long long a[200005]; long long k1[200005]; long long k2[200005]; string ss = first ; string sp = second ; int main() { int n; cin >> n; int r1 = 0; int r2 = 0; long long s1 = 0; long long s2 = 0; int l1 = 0; int l2 = 0; fo... |
/*
Copyright (c) 2014-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, distri... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2009 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
integer cyc = 0;
reg [63:0] cr... |
//==================================================================================================
// Filename : DECO_CORDIC_OP.v
// Created On : 2016-10-03 13:00:49
// Last Modified : 2016-10-28 23:06:30
// Revision :
// Author : Jorge Sequeira Rojas
// Company : Instituto Tecnologico... |
/*
* 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 long long mo = 1e9 + 7; char s[2010], ss[2010]; long long dp[2010][2010], a[2010]; long long m, d, jo; int len; long long dfs(int pos, long long sum, bool limit) { if (pos == len) return sum == 0; if (!limit && dp[pos][sum] != -1) return dp[pos][... |
/**
* 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... |
// Accellera Standard V2.5 Open Verification Library (OVL).
// Accellera Copyright (c) 2005-2010. All rights reserved.
`ifdef OVL_XCHECK_OFF
//Do nothing
`else
`ifdef OVL_IMPLICIT_XCHECK_OFF
//Do nothing
`else
wire valid_test_expr;
assign valid_test_expr = ~((^test_expr) ^ (^test_expr));
`endif // OVL_... |
// ==============================================================
// File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
// Version: 2016.1
// Copyright (C) 1986-2016 Xilinx, Inc. All Rights Reserved.
//
// ==============================================================
`timescale 1ns/1ps
... |
/*
* 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 t;
endmodule
class C;
function int f();
f = 17;
endfunction
extern function int g();
virtual function int f();
a;
endfunction // int
// pure virtual functions have no endfunction.
C a;
initial begin
$display("hello world");
$display("a of f is %d, g is %d", a.... |
module x;
always @(/*AUTOSENSE*/arb_select_f or octet_idx) begin
octet_flag[0] = |arb_select_f[ 7: 0];
octet_flag[1] = |arb_select_f[15: 8];
octet_flag[2] = |arb_select_f[23:16];
octet_flag[3] = |arb_select_f[31:24];
octet_flag[4] = |arb_select_f[39:32];
octet_flag[5... |
/**
* 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> char str[100005]; int main(void) { int n, m; int i; scanf( %d%d , &n, &m); scanf( %s , str); for (i = 0; i < n && m; i++) { if ((!(i & 1)) && str[i] == 4 ) { if ((str[i + 1] == 4 && str[i + 2] == 7 )) break; else if (str[i + 1] == 7 ... |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: bw_clk_cl_ctu_2xcmp_b.v
// Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
//
// The above named program is free software; you can redistribut... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 100007, INF = 1000000007; int main() { int n, m, k, cnt = 0; long long d[MAXN], d1[MAXN]; vector<pair<int, int> > G[MAXN]; pair<long long, int> used[MAXN]; set<pair<long long, int> > S; scanf( %d%d%d , &n, &m, &k); for (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 <bits/stdc++.h> using namespace std; char s[500010]; int n, m, ver[500010], hor[500010]; bool b; void calc(int i, int j, int k) { if (!b) return; int x = (k < 3) ? 1 : 2; if (j % 2) x = 3 - x; if (hor[i] == 0) hor[i] = x; else if (hor[i] != x) { b = false; return... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2012 by Wilson Snyder.
//bug591
module t (/*AUTOARG*/);
function real ABS (real num);
ABS = (num < 0) ? -num : num;
endfunction
function logic range_chk;
input... |
#include <bits/stdc++.h> using namespace std; int dx[] = {-1, 0, 1, 0, -1, 1, 1, -1}; int dy[] = {0, 1, 0, -1, 1, 1, -1, -1}; int n, m; bool dfs(pair<int, int> start, vector<string>& G, vector<vector<bool> >& odw, set<pair<int, int> >& jed) { stack<pair<int, int> > S; S.push(start); odw... |
#include <bits/stdc++.h> using namespace std; const long long N = 2e6 + 10; const long long mod = 998244353; double eps = 1e-10; void in(long long &x) { x = 0; char c = getchar(); long long y = 1; while (c < 0 || c > 9 ) { if (c == - ) y = -1; c = getchar(); } while (c ... |
// Copyright (c) 2014 Takashi Toyoshima <>.
// All rights reserved. Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
`timescale 100ps/100ps
module AccumulatorTest;
wire [7:0] w_a;
wire w_n;
wire w_z;
wire w_c;
wire w_v;
reg [7:... |
//wbs_spi.v
//////////////////////////////////////////////////////////////////////
//// ////
//// spi_top.v ////
//// ////
//// This file is part... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 5; int sub_tree[maxn], n, T[maxn], P[maxn][22], L[maxn], par[maxn], ans[maxn], nn; set<int> adj[maxn]; void lca_dfs(int u, int p) { T[u] = p; L[u] = (p > -1) ? L[p] + 1 : 0; for (int s : adj[u]) { if (s == p) continue; ... |
`default_nettype none
module square_root32_element #(
parameter P_IN_N = 4,
parameter P_DFF = 1
)(
input wire iCLOCK,
input wire inRESET,
//Input
input wire iDATA_REQ,
output wire oDATA_BUSY,
input wire [P_IN_N/2-1:0] iDATA_P,
input wire [31:0] iDATA_I,
//Output
output wire oDATA_VALID,
input... |
#include <bits/stdc++.h> using namespace std; const int N = 3e5 + 5; struct ACA { int pool[N], ptp; int stk[30], sz[N], rt[N], rtid, tp; int nxt[N][26], tran[N][26], fail[N], end[N], num[N], tot; inline int newnode() { return ++tot; } int merge(int x, int y) { if (!x || !y) return x | y;... |
// megafunction wizard: %FIFO%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: dcfifo
// ============================================================
// File Name: asyn_64_1.v
// Megafunction Name(s):
// dcfifo
//
// Simulation Library Files(s):
// altera_mf
// =================================... |
#include <bits/stdc++.h> using namespace std; int n, s[200003], m, cnt, ans[200003]; vector<pair<int, int> > v[200003], g[200003]; bool vis[200003]; int dfs(int x) { vis[x] = 1; int ret = 0, tmp; for (int i = 0; i < v[x].size(); i++) if (!vis[v[x][i].first]) { tmp = dfs(v[x][i].first... |
#include <bits/stdc++.h> using namespace std; const int sz = 501; const int sz2 = 16; int n, m; string a[sz]; bool dp[sz][sz][sz2][sz2]; void solve() { cin >> n >> m; for (int i = 0; i < n; i++) cin >> a[i]; long long ans = 0; for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++)... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 19:17:11 02/17/2016
// Design Name:
// Module Name: MainModule
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//... |
#include <bits/stdc++.h> #pragma comment(linker, /STACK:1024000000,1024000000 ) using namespace std; const int N = 1e5 + 15, M = 105, T = 1e7 + 5; long long maxi[N], l[N], r[N]; pair<long long, long long> f[N]; pair<long long, int> bsd(pair<long long, int> a, pair<long long, int> b) { if (a.first > b.f... |
#include <bits/stdc++.h> using namespace std; long long dp[1050000], k[25][25], a[1050000]; int main() { long long n, m; while (scanf( %lld%lld , &n, &m) == 2) { string s; cin >> s; memset(k, 0, sizeof(k)); for (int i = 1; i < s.length(); i++) { k[s[i - 1] - a ][s[i] - a ... |
/*
Module: snes_controller
Description: Fetches snes controller buttons
and returns them as an array of 12 stored in buttons.
A FSM is implemented to fetch data,
also taking into account the correct
clock speed by scaling down the clock
slow enough for the controller to read
... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 00:35:27 03/22/2014
// Design Name:
// Module Name: LC3_keyboard_reg
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencie... |
#include <bits/stdc++.h> using namespace std; namespace { using T = long long; constexpr char endl = n ; const int maxN = 205; const int maxM = 1e5 + 5; const T base = 100000; T Ceil(T x, T y) { return (x + y - 1) / y; } int n, m; T t[maxN], x[ma... |
#include <bits/stdc++.h> using namespace std; int n, m; int p[30]; char A[30], ch[205]; int d[405][405]; int now[205], minv[205], minc[205]; int fan(int x) { return (x > n) ? (x - n) : (x + n); } int main() { scanf( %s , A); int tot = strlen(A); for (int i = 0; i < tot; ++i) { p[i] = A... |
#include <bits/stdc++.h> using namespace std; const int maxn = 2e5 + 10, inf = 1e9 + 10, P = 53, MOD = 1e9 + 7; int n, a, b, k, q, seg1[4 * maxn], seg2[4 * maxn]; inline void update(int ind) { seg1[ind] = seg1[((ind) * (2))] + seg1[(((ind) * (2)) + 1)]; seg2[ind] = seg2[((ind) * (2))] + seg2[(((ind) * (... |
//==================================================================================================
// Filename : Mux_3x1_b.v
// Created On : 2016-10-03 16:53:16
// Last Modified : 2016-10-04 10:26:18
// Revision :
// Author : Jorge Sequeira Rojas
// Company : Instituto Tecnologico de C... |
`timescale 1ns / 1ps
`default_nettype none
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 20:16:31 12/26/2014
// Design Name:
// Module Name: ps2_port
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//... |
// -----------------------------------------------------------------------------
//
// Copyright 2013(c) Analog Devices, Inc.
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
// - Redistrib... |
// -------------------------------------------------------------
//
// Generated Architecture Declaration for rtl of ent_ad
//
// Generated
// by: wig
// on: Mon Oct 24 10:52:44 2005
// cmd: /cygdrive/h/work/eclipse/MIX/mix_0.pl -nodelta ../../verilog.xls
//
// !!! Do not edit this file! Autogenerated by MIX !!!
/... |
#include <bits/stdc++.h> using namespace std; const long long INF = 0x3f3f3f3f3f3f3f3f; const long long MAXN = 4e3 + 7; const long long MAXM = 1e6 + 7; const long long MOD = 1e9 + 7; const double eps = 1e-6; const double pi = acos(-1.0); long long quick_pow(long long a, long long b) { long long ans ... |
// (C) 2001-2017 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 from any of the foregoing (including device programming or simulation
// files), and any associated ... |
#include <bits/stdc++.h> using namespace std; int n; int l[1 << 12]; int in[1 << 12]; int sm[1 << 12]; void go(int now) { if (now * 2 > ((1 << n) - 1)) return; int a = now * 2; int b = now * 2 + 1; go(a); go(b); int al = l[a] + in[a]; int bl = l[b] + in[b]; l[now] = max(al, 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 law... |
#include <bits/stdc++.h> using namespace std; inline long long read() { char ch = getchar(); long long nega = 1; while (!isdigit(ch)) { if (ch == - ) nega = -1; ch = getchar(); } long long ans = 0; while (isdigit(ch)) { ans = ans * 10 + ch - 48; ch = getchar(); }... |
#include <bits/stdc++.h> using namespace std; void solve() { int n, m, k; cin >> n >> m >> k; vector<int> dp1(m, 0); vector<int> pref_max(m, 0); vector<int> suf_max(m, 0); vector<vector<int> > a(n); for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { int x; ... |
#include <bits/stdc++.h> using namespace std; class Graph { vector<int>* adjList; vector<bool> init; vector<bool> goal; bool* visited; int n; vector<int> operate; public: Graph(int n) { adjList = new vector<int>[n]; visited = new bool[n](); this->n = n; } ... |
#include <bits/stdc++.h> using namespace std; const int MAX_N = 3030; int head[MAX_N], current, n, siz[MAX_N][MAX_N], fa[MAX_N][MAX_N]; long long f[MAX_N][MAX_N]; struct edge { int to, nxt; } edges[MAX_N << 1]; void addpath(int src, int dst) { edges[current].to = dst, edges[current].nxt = head[src... |
#include <bits/stdc++.h> using namespace std; const int INF = (int)1e9; const int maxn = 100010; const int maxbit = 18; const int sz = 1500; inline int read() { int x = 0, f = 1; char ch = 0; for (; !isdigit(ch); ch = getchar()) if (ch == - ) f = -1; for (; isdigit(ch); ch = getchar()... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); int n; cin >> n; if (n / 36 + 1 == (n + 1) / 36) n++; cout << n / 36 << << round((n - (n / 36) * 36) * 1.0 / 3); return 0; } |
#include <bits/stdc++.h> #pragma GCC optimize( O3 ) #pragma GCC target( sse,sse2,sse3,sse4,fma4,ssse3,popcnt,abm,aes,pclmul,cld,inline-all-stringops ) #pragma comment(linker, /STACK:66777216 ) using namespace std; static unsigned rnd() { static int second = 124612741; second ^= second << 13; ... |
module x;
reg [31:0] mb_reg_output;
// 16 registers max, register 15 is always the version number, so 15 are useable
// NOTE: number_interface_regs must be the maximum (or 16 in this case) to get the version register
parameter NUMBER_INTERFACE_REGS = 16;
parameter MB_REG_START = 3; // start a... |
#include <bits/stdc++.h> using namespace std; long long gcd(long long a, long long b) { for (; b; a %= b, swap(a, b)) ; return a; } int n, m; int main() { ios::sync_with_stdio(0); cin.tie(0), cout.tie(0); cin >> n >> m; vector<vector<int> > board(n, vector<int>(m)); for (auto... |
/*
* RX (Receive)
*
* Including Frame-Sync Detector, CRC-5, CRC-16, Command Buffer
*
* The clock signal in RX is delayed PIE code from Analog front-end circuit
* so we can directly transfer to binary code by clocking PIE code without decoder
*/
`timescale 1us / 1ns
module rx
(
output [7:0]cmd,
... |
#include <bits/stdc++.h> using namespace std; int main(int argc, char const *argv[]) { int n, m; std::cin >> n >> m; if (n == 1 && m == 2) { std::cout << 0 << n ; std::cout << 1 1 << n ; std::cout << 1 2 << n ; std::cout << 1 1 << n ; return 0; } if ... |
`include "defines.v"
module xbar(
input [2:0] ctl0,
input [2:0] ctl1,
input [2:0] ctl2,
input [2:0] ctl3,
input [2:0] ctl4,
input `data_w di0,
input `data_w di1,
input `data_w di2,
input `data_w di3,
input `data_w di4,
output `data... |
#include <bits/stdc++.h> using namespace std; long long int temp; vector<long long int> v; long long int n; int32_t main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long int t = 1; cin >> t; while (t--) { long long int n, strt, cnst, lwr = 0, upr = 0, t, l, r, pt = 0, f... |
#include <bits/stdc++.h> using namespace std; void Test() { long long n; cin >> n; string s[n]; for (long long i = 0; i < n; i++) { cin >> s[i]; } long long ans = 0; for (char i = a ; i <= e ; i++) { vector<pair<long long, long long> > v; for (long long j = 0; j < n; ... |
#include <bits/stdc++.h> using namespace std; inline int read() { int s = 0, t = 1; char ch = getchar(); while (ch < 0 || ch > 9 ) { if (ch == - ) t = -1; ch = getchar(); } while (ch >= 0 && ch <= 9 ) s = (s << 3) + (s << 1) + (ch ^ 48), ch = getchar(); return s * t;... |
#include <bits/stdc++.h> using namespace std; const int inf = 1e09 + 5e3; const long long linf = 2e18 + 5e3; const int mxn = 5e2 + 5; void solve() { int n; cin >> n; vector<int> a(n), b(n); vector<pair<int, int> > as, bs; for (int i = 0; i < n; i++) { cin >> a[i]; } for (int ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 200200; int n; int a[maxn], b[maxn], c[3][maxn]; int sum[maxn]; int lowbit(int x) { return x & (-x); } void add(int p, int v = 1) { for (int i = p; i <= n; i += lowbit(i)) sum[i] += v; } int get(int p) { int ret = 0; for (int i... |
#include <bits/stdc++.h> using namespace std; int main() { string f, m, s; cin >> f >> m >> s; string answer = ? ; if (f == m && s != m) { if (s == paper && f == rock ) { answer = S ; } else if (s == scissors && f == paper ) { answer = S ; } else if (s == ... |
// ==============================================================
// File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
// Version: 2015.4
// Copyright (C) 2015 Xilinx Inc. All rights reserved.
//
// ==============================================================
`timescale 1ns/1ps
modul... |
module ID_01_Handler (ISin, CWout, literal);
input [13:0] ISin;
output reg [15:0] literal;
output reg [18:0] CWout;
always @(ISin) begin
case (ISin[13:9])
5'b10000: begin CWout = {6'b100001,ISin[8:6],ISin[5:3],7'b0000100}; //Increment
literal = 16'b1111111111111111; end
5'b10100: begin CWout = {6'b101001... |
#include <bits/stdc++.h> using namespace std; const int inv = 1000000000; const int minv = -inv; const int max_n = 100010; const int max_m = 100010; const int max_k = 110; const int modref = 1000000007; int n, m; int a[max_n]; int b[max_n][max_k + 1] = {0}; int c[max_k + 1] = {0}; int bin[max_n ... |
#include <bits/stdc++.h> using namespace std; int main() { vector<int> primes = {2, 4, 3, 9, 5, 25, 7, 49, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47}; int n = 0; for (int i = 0; i < primes.size(); i++) { cout << primes[i] << endl; string s; cin >> s; ... |
Require Import Coq.Arith.EqNat.
Require Import Coq.Strings.Ascii.
Require Import Coq.Strings.String.
Require Import Hapsl.Bool.Bool.
Require Import Hapsl.Ascii.Equality.
Import AsciiEqualityNotations.
(* Calculates the Hamming distance between two strings. *)
Fixpoint hamming_distance (a b : string) : option nat :=
... |
module sim_tb_ram (
// main clock
input CLOCk_50,
// Switches & keys
input [17:0] SW,
input [3:0] KEY,
output [17:0] LEDR,
// Hex displays (seven segment displays)
output [6:0] HEX0, HEX1, HEX2, HEX3, HEX4, HEX5, HEX6, HEX7,
// SRAM
inout [15:0] SRAM_DQ,
output [19:0] SRAM_ADDR,
output SRAM_CE_N, SRAM_... |
#include <bits/stdc++.h> using namespace std; struct point { double df, de; void init(double _df, double _de) { df = _df; de = _de; } } V[100]; int nf, ne, ns, rf, re, rs, df, de; int n, top, place[13]; double ans = 0, dp[21][21], lf, le, ls; bool cmp(const point &a, const point &b... |
#include <bits/stdc++.h> int a[100001], b[100000], map[100000], c[634][100001]; int main() { int n, q; std::cin >> n >> q; for (int i = 1; i <= n; ++i) std::cin >> a[i]; memcpy(b, &a[1], sizeof(b)); std::stable_sort(b, b + n); int N = 0, i = 0; while (i < n) { int r = std::upper_bo... |
//*****************************************************************************
// (c) Copyright 2008-2009 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
// ... |
/*
* 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... |
/**
* 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/1ns
module sram_if_tb;
reg clk, rst;
initial begin
clk <= 0;
rst <= 1;
#105;
rst <= 0;
#10000
$display("test_tb done");
$finish;
end
always begin
#10 clk = ~clk;
end
reg [3:0] addr;
reg wen;
reg [31:0] wdata;
wire [31:0]... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 100010; char str[MAXN]; int k1, k0, k2; int main() { scanf( %s , str); int n = strlen(str); k1 = k2 = k0 = 0; for (int i = 0; i < n; i++) { if (str[i] == 0 ) k0++; if (str[i] == 1 ) k1++; if (str[i] == ? ) k2++... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 22:03:45 06/11/2013
// Design Name:
// Module Name: ModmCountr
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//... |
//*****************************************************************************
// (c) Copyright 2008-2010 Xilinx, Inc. All rights reserved.
//
// This file contains confidential and proprietary information
// of Xilinx, Inc. and is protected under U.S. and
// international copyright and other intellectual property
// ... |
#include <bits/stdc++.h> using namespace std; struct node { long long int a; long long int b; }; node p[100005]; bool comp(node x, node y) { if (x.b < y.b) return true; return false; } int main() { long long int n, r, avg; cin >> n >> r >> avg; long long int s = 0; for (int... |
#include <bits/stdc++.h> using namespace std; struct IO { IO() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); } } _; long long n, m, len, k, t, a, b; long long c[101]; long long p[101][101]; long long dp[101][101][101]; long long rec(long long idx, long long col, long... |
#include <bits/stdc++.h> using namespace std; void ga(int N, int *A) { for (int i(0); i < N; i++) scanf( %d , A + i); } map<int, vector<pair<int, int> > > T[4]; int N, M, a, b, f[10], C[100005]; int main(void) { scanf( %d%d , &N, &M); for (int i(0); i < M; i++) scanf( %d%d , &a, &b), T[0][... |
/*
* Testbench for Zet-ng decoder
* Copyright (C) 2013 Charley Picker <>
*
* This file is part of the Zet processor. This processor is free
* hardware; 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 versio... |
#include <bits/stdc++.h> using namespace std; template <class T1, class T2> ostream& operator<<(ostream& o, pair<T1, T2> x) { return o << x.first << << x.second; } template <class T1, class T2> istream& operator>>(istream& o, pair<T1, T2>& x) { return o >> x.first >> x.second; } template <cl... |
#include <bits/stdc++.h> using namespace std; const int N = 100001; int n, m, ind[N], dpth[N], s[N], e[N], t, seg[4 * N], lazy[4 * N], a[N]; vector<vector<int> > g, gift; vector<pair<int, int> > anc; vector<int> ans, root; void dfs(int u) { s[u] = t++; for (int i = 0; i < g[u].size(); 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... |
/**
* 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 n, a = 0, b = 0, ans = 0, mid; cin >> n; for (int i = 0; i < n; i++) { cin >> mid; if (mid == 2) a++; else b++; } if (a > b) ans = b; else { ans = a; b = b - a; ans += b /... |
//****************************************************************************************************
//*---------------Copyright (c) 2016 C-L-G.FPGA1988.lichangbeiju. All rights reserved-----------------
//
// -- It to be define --
// -- ... |
#include <bits/stdc++.h> using namespace std; const int N = 111111; pair<char, string> ev[N]; int n; int solve(char le) { set<char> st; for (int i = ( a ); i <= ( z ); i++) { st.insert(i); } int need = 0, has = 0; bool found = false; for (int i = (1); i <= (n); i++) { if (e... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1000000 + 5; const int INF = (int)1e9 + 7; const double EPS = 1e-9; const int hh[4] = {1, -1, 0, 0}; const int hc[4] = {0, 0, 1, -1}; void nhap(); void process(); int n; int res; int f[1000006]; int main() { int nTest = 1; fo... |
#include <bits/stdc++.h> using namespace std; int main() { int n, a[4] = {}; cin >> n; for (int i = 0; i < n; i++) { char c; cin >> c; a[0] += c == U ; a[1] += c == D ; a[2] += c == L ; a[3] += c == R ; } long res = min(a[0], a[1]) * 2 + min(a[2], a[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> const long long N = 1e6 + 10; const long long mod = 1e9 + 7; long long dir[4][2] = {0, 1, 1, 0, 0, -1, -1, 0}; using namespace std; struct node { long long x, y, id; node() {} node(long long x, long long y, long long i) : x(x), y(y), id(i) {} }; long long ans[N]; sta... |
/*
* 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... |
/**
* 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.