text stringlengths 59 71.4k |
|---|
/*
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> #pragma GCC optimize( Ofast ) const int N = 550; using namespace std; int n; int m; int k; long long d[N][N][2]; long long cost[N][N]; vector<pair<int, long long> > R[N][N]; vector<pair<int, long long> > D[N][N]; vector<pair<int, long long> > nv; void normal(vector<pair<... |
#include <bits/stdc++.h> using namespace std; const int oo = (int)1e9; const double PI = 2 * acos(0.0); const double eps = 1e-7; int dx[] = {1, -1, 0, 0}; int dy[] = {0, 0, 1, -1}; int main() { int n, m; cin >> n >> m; string s; int mx = 0; int c = 0; for (int i = 0; i < m; i++) { ... |
#include <bits/stdc++.h> using namespace std; int n, p[200005]; int ans[200005]; queue<int> q; int main() { int Q; cin >> Q; while (Q--) { memset(ans, 0, sizeof(ans)); cin >> n; for (int i = 1; i <= n; i++) cin >> p[i]; for (int i = 1; i <= n; i++) { if (ans[i]) con... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e6 + 2; const long long N = 1e6 + 1; long long n; set<int> Q; int main() { scanf( %d , &n); int ans = 1; while (n--) { int x; scanf( %d , &x); while (!Q.insert(x).second) { Q.erase(x); x++; } ... |
#include <bits/stdc++.h> int main(int agrc, char* argv[]) { int N, M; scanf( %d %d , &N, &M); char room[625]; for (int i = 0; i < N * M; i++) scanf( %c , room + i); int dp[625]; for (int i = 0; i < M * M; i++) dp[i] = 0; int best = 0; for (int r = 0; r < N; r++) { for (int pl = ... |
// Computer_System_System_PLL.v
// This file was auto-generated from altera_up_avalon_sys_sdram_pll_hw.tcl. If you edit it your changes
// will probably be lost.
//
// Generated using ACDS version 16.1 196
`timescale 1 ps / 1 ps
module Computer_System_System_PLL (
input wire ref_clk_clk, // ref_clk.... |
/*
* File: pippo_operandmuxes.v
* Project: pippo
* Designer: kiss@pwrsemi
* Mainteiner: kiss@pwrsemi
* Checker:
* Assigner:
* Description:
* Mux.A:
* input: rf_a, wb_fwd
* output: bus a (alu, mac, lsu)
* Mux.B:
* input: rf_b, imm, wb_fwd
* ... |
#include <bits/stdc++.h> using namespace std; int rev(int ans) { if (ans == 1) return 0; else return 1; } int main() { int arr[3][3], ans[3][3]; for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { cin >> arr[i][j]; ans[i][j] = 1; } } for (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 la... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e3 + 5; bool adj1[MAXN][MAXN], adj2[MAXN][MAXN]; vector<pair<int, int> > ans1, ans2; int n; void comp1(int a, int b) { if (b - a == 1) return; for (int i = a + 1; i < b; ++i) { if (adj1[1][i] == 1) { comp1(a, i); c... |
#include <bits/stdc++.h> using namespace std; const int maxn = 3e5 + 10; vector<int> G[maxn]; int p[maxn], d[maxn], vis[maxn], mx, rt; int find(int x) { if (p[x] != x) p[x] = find(p[x]); return p[x]; } void dfs(int u, int fa, int dep, int tp) { vis[u] = 1; if (dep > mx) { mx = dep; ... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 200010; int ans[MAXN]; void solve(int l, int r) { if (l > r) return; cout << ? << l + 1 << << r + 1 << endl; int x, f; cin >> x >> f; int st = r - f + 1; int en = l + f - 1; if (st <= en) { for (int i = st, 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 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; string n; int i, j, a[9][7], x, y; int main() { cin >> n; for (i = n.size() - 1; i >= 0; i--) { x = n[i] - 48; y = max(y, x); for (j = 0; j < x; j++) a[j][7 + i - n.size()] = 1; } cout << y << endl; for (i = 0; i < y; cout << ... |
#include <bits/stdc++.h> using namespace std; int64_t mod = 1e9 + 7; int64_t mod1 = 1e9 + 6; int64_t power(int64_t a, int64_t b) { if (b == 0) return 1; else if (b % 2 == 0) return power((((a % mod) * (a % mod)) % mod), b / 2) % mod; else return ((a % mod) * (power((((a % mod) * (a... |
`timescale 1 ns / 1 ps
module axi_sts_register #
(
parameter integer STS_DATA_WIDTH = 1024,
parameter integer AXI_DATA_WIDTH = 32,
parameter integer AXI_ADDR_WIDTH = 16
)
(
// System signals
input wire aclk,
input wire aresetn,
// Status bits
input wire [S... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 100 + 10; int n, m; int main() { cin >> n >> m; cout << n + m - 1 << endl; cout << 1 1 << endl; for (int i = 2; i <= n; ++i) cout << i << 1 << endl; for (int i = 2; i <= m; ++i) cout << 1 << i << endl; fclose(stdin); ... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; const long long N = 200411; vector<int> root; int now, n, s[N], p[N], toghe; void dfs(int v) { if (s[v]) { if (s[v] == now) root.push_back(v); return; } s[v] = now; dfs(p[v]); } int main() { scanf( %d , &n); for (int i = 1; ... |
// 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 : Thu Oct 26 22:45:02 2017
// Host : Juice-Laptop running 64-bit major relea... |
#include <bits/stdc++.h> using namespace std; struct edge { int u, v, l, id; edge() {} edge(int a, int b, int c, int d) { u = a, v = b, l = c, id = d; } bool operator<(const edge &p) const { return l < p.l || (l == p.l && id < p.id); } }; char *p1, *p2, buffer[10000009]; int n, m, cu... |
#include <bits/stdc++.h> using namespace std; long long int MOD = 1000000007; long long int power(long long int x, long long int y, long long int p) { long long int res = 1; x = x % p; if (x == 0) return 0; while (y > 0) { if (y & 1) res = (res * x) % p; y = y >> 1; x = (x * x) %... |
`timescale 1 ps / 1 ps
module onetswitch_top(
inout [14:0] DDR_addr,
inout [2:0] DDR_ba,
inout DDR_cas_n,
inout DDR_ck_n,
inout DDR_ck_p,
inout DDR_cke,
inout DDR_cs_n,
inout [3:0] DDR_dm,
in... |
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 10; const int T = 1 << 19; int n, q, a[N]; long long s[N]; int p, x; int tn = 1; long long mx[T], sum[T]; long long tmx[T], tsum[T]; inline void pushup(int x) { mx[x] = max(sum[x << 1] ? mx[x << 1] : -0x3f3f3f3f3f3f3f3f, ... |
/*
* 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() { int a; scanf( %d , &a); string ans = NO ; for (int i = 0; i < a; i++) { string name; int bef, aft; cin >> name; scanf( %d %d , &bef, &aft); if (bef >= 2400 && aft > bef) { ans = YES ; } } ... |
#include <bits/stdc++.h> int main(void) { int a[100][5], n, i, j, k = 0, min = 10000; scanf( %d , &n); for (i = 0; i < n; i++) { scanf( %d%d%d%d , &a[i][0], &a[i][1], &a[i][2], &a[i][3]); a[i][4] = i + 1; } for (i = 0; i < n; i++) { for (j = 0; j < n; j++) { if (a[j][0] >... |
//lpm_divide CBX_SINGLE_OUTPUT_FILE="ON" LPM_DREPRESENTATION="UNSIGNED" LPM_HINT="LPM_REMAINDERPOSITIVE=TRUE" LPM_NREPRESENTATION="UNSIGNED" LPM_TYPE="LPM_DIVIDE" LPM_WIDTHD=8 LPM_WIDTHN=64 denom numer quotient remain
//VERSION_BEGIN 16.0 cbx_mgl 2016:07:21:01:49:21:SJ cbx_stratixii 2016:07:21:01:48:16:SJ cbx_util_mgl ... |
#include <bits/stdc++.h> using namespace std; int main() { long n, d = 0, e = 0, a[10000] = {0}, c = 0; cin >> n; for (long i = 0; i < n; i++) { cin >> a[i]; c = c + a[i]; } for (long j = 0; j < n; j++) { d = c - a[j]; if ((d % 2) == 0) { e = e + 1; } } ... |
#include <bits/stdc++.h> using namespace std; int main() { int n; long long int d; cin >> n >> d; vector<int> check_days; int a[n]; long long int prefix_sum[n]; cin >> a[0]; if (a[0] == 0) check_days.push_back(0); prefix_sum[0] = a[0]; for (int i = 1; i < n; i++) { cin ... |
//Legal Notice: (C)2012 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 associate... |
#include <bits/stdc++.h> using namespace std; const int mx = 1e5 + 1; bool vis[mx]; vector<int> adj[mx]; int n; bool star() { bool ans; int count1 = 0; int other = 0; for (int i = 1; i <= n; i++) { if (adj[i].size() == 1) { count1++; } else if (adj[i].size() == n - 1) { ... |
/**
* 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 arr[300000]; int main() { long long n, m; scanf( %lld %lld , &n, &m); for (long long i = 1; i <= n; i++) { scanf( %lld , &arr[i]); } string s; cin >> s; long long len = s.size(); long long ans = 0; for (long long i =... |
//Legal Notice: (C)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 associate... |
// -- (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 property
// -- laws.
// --
// -- DISCLAIMER
// -- This disclaimer is not a... |
//////////////////////////////////////////////////////////////////////////////////
// V2DatapathClockConverter32 for Cosmos OpenSSD
// Copyright (c) 2015 Hanyang University ENC Lab.
// Contributed by Kibin Park <>
// Yong Ho Song <>
//
// This file is part of Cosmos OpenSSD.
//
// Cosmos OpenSSD is free ... |
`include "../network_params.h"
module nh_shift_reg(
input clock,
input reset,
input shift_in_rdy,
input [`NH_BITWIDTH:0] shift_in,
output dval,
output [`NH_BITWIDTH:0] nh_max
);
// wire declarations
//wire [`NH_BITWIDTH:0] shift_ins [`NH_DIM-1:0];
wire [(`NH_SIZE*2)-2:0] reg_valid;
wire [`NH_BITWIDT... |
#include <bits/stdc++.h> using namespace std; int main() { long long k, l, ans = 0; cin >> k >> l; while (l % k == 0) { l = l / k; if (l != 1) ans++; } if (l == 1) cout << YES << endl << ans; else cout << NO ; } |
#include <bits/stdc++.h> using namespace std; #pragma GCC optimize( Ofast ) #pragma GCC optimize( unroll-loops ) #pragma GCC optimize( -ffloat-store ) #pragma GCC optimize( -fno-defer-pop ) long long int power(long long int a, long long int b, long long int m) { if (b == 0) return 1; if (b == 1) ret... |
#include <bits/stdc++.h> using namespace std; int main() { long long n, t, cur = 1, pre, s; cin >> n >> pre; s = n; n--; for (int i = 0; i < (int)(n); ++i) { cin >> t; if (t == pre) cur++; else if (t != pre && cur > 1) { s += (cur * (cur - 1) / 2); cur =... |
//-----------------------------------------------------------------------------
//-- Secuenciador de 2 estados a partir de dos registros de 4 bits con
//-- inicialización de carga
//-- (C) BQ. August 2015. Written by Juan Gonzalez (obijuan)
//-----------------------------------------------------------------------------... |
#include <bits/stdc++.h> using namespace std; long long sum_prefix(vector<long long> &t, int len) { long long res = 0; int i = len; while (i >= 0) { res += t[i]; i &= (i + 1); i--; } return res; } long long sum_interval(vector<long long> &t, int l, int r) { return sum_p... |
module gates
(
output wire o_and,
output wire o_nand,
output wire o_or,
output wire o_nor,
output wire o_xor,
output wire o_xnor,
output wire o_not1,
output wire o_not2,
output wire o_dff,
output wire o_one,
output wire o_zero,
output wire o_cp_and,
output wire o_cp_or,
output wire o_cp_xor
);
function f... |
#include <bits/stdc++.h> using namespace std; bool check(string a) { bool flag = true; for (int i = 1; i <= a.size(); i++) if (abs(a[i] - a[i - 1]) == 1) flag = false; return flag; } int main() { int T; cin >> T; while (T--) { string s, one, two; cin >> s; for (in... |
#include <bits/stdc++.h> using namespace std; int main() { long long int i, j, k, n, m, a1 = 0, a0 = 0, a2 = 0, c = 0, d; vector<char> vc, s; char a; vector<long long int> vi; while (cin >> a) { s.push_back(a); } for (i = 0; i < s.size(); i++) { if (s[i] == ( ) a1++;... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int arr[n][n]; for (int i = 0; i < n; i++) { string s; cin >> s; for (int j = 0; j < n; j++) { arr[j][i] = s[j]; } } int cnt = 0; for (int i = 0; i < n; i++) { for (int j = 0... |
#include <bits/stdc++.h> using namespace std; char a[2000][2000]; const int dx[4] = {-1, 0, 1, 0}; const int dy[4] = {0, -1, 0, 1}; queue<pair<int, int> > que; int main() { int n, m; while (~scanf( %d %d , &n, &m)) { for (int i = 0; i < n; i++) { getchar(); for (int j = 0; j < ... |
#include <bits/stdc++.h> using namespace std; int n; int a[100]; int main() { int x = 1; scanf( %d , &n); for (int i = 1; i <= n; ++i) { scanf( %d , &a[i]); if (a[i] < a[x]) x = i; } if (n == 1 || (n == 2 && a[1] == a[2])) { puts( -1 ); } else { printf( 1 n%d n , ... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2005 by Wilson Snyder.
module t_case_huge_sub4 (/*AUTOARG*/
// Outputs
outq,
// Inputs
index
);
input [7:0] index;
output [9:0] outq;
// ====================... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); long long x, y, m; cin >> x >> y >> m; long long sol = 0ll; if (x >= m || y >= m) { cout << 0 n ; return 0; } if (x <= 0ll && y <= 0ll) { cout << -1 n ; return 0;... |
#include <bits/stdc++.h> using namespace std; class classcomp { public: bool operator()(const int &l, const int &r) const { return l < r; } }; long long mod = 1000000007; void matrixmul(int p, int q, int r, long long *a, long long *b, long long *c) { int i, j, k; for (i = 0; i < p; i++) { ... |
module top;
reg val1, val2;
reg res ;
reg pass;
initial begin
pass = 1'b1;
val1 = 1'b0;
val2 = 1'b0;
res = val1 -> val2;
if (res !== 1'b1) begin
$display("FAILED: 1'b0 -> 1'b0 returned %b not 1'b1", res);
pass = 1'b0;
end
val2 = 1'b1;
res = val1 -> val2;
if (res... |
(************************************************************************)
(* v * The Coq Proof Assistant / The Coq Development Team *)
(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2016 *)
(* \VV/ **************************************************************)
(* // * Th... |
#include <bits/stdc++.h> using namespace std; int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); } int lcm(int a, int b) { return a * (b / gcd(a, b)); } int cx[] = {-1, 1, 0, 0, 1, 1, -1, -1}; int cy[] = {0, 0, -1, 1, -1, 1, -1, 1}; bool is_possible(long long left, long long rigth) { if (left <=... |
/*
* 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... |
//-----------------------------------------------------------------------------
//
// (c) Copyright 2010-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 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... |
`include "mem_beh.v"
`include "regfile_beh.v"
`include "components.v"
`include "control_units.v"
`include "alu_beh.v"
`include "mux2to1_beh.v"
module kustar;
reg clock, clear;
wire [31:0] MuxtoPC, PCtoMux, MuxtoMem, MemtoInstReg, SigntoShift, ShifttoMux, MemdatatoMux, MuxtoWriteData;
wire [31:0] RegtoA, RegtoB, AtoMu... |
#include <bits/stdc++.h> using namespace std; int run(int n) { int i, a[n]; for (i = 0; i < n; i++) cin >> a[i]; sort(a, a + i); int ans = 0; int tempCount = 0; for (i = 0; i < n; i++) { tempCount++; if (a[i] == tempCount) { ans++; tempCount = 0; } } ... |
//======================================================================
//
// tb_uart.v
// ---------
// Testbench for the UART core.
//
//
// Author: Joachim Strombergson
// Copyright (c) 2014, Secworks Sweden AB
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or
// without modifi... |
#include <bits/stdc++.h> using namespace std; int main() { int n; std::cin >> n; bool letters[26]; bool d = false; int extra = 0; for (int i = 0; i < 26; i++) { letters[i] = true; } char action; string input = ; for (int i = 0; i < n; i++) { cin >> action; ... |
#include <bits/stdc++.h> using namespace std; const int mn = 1e6 + 10; int a[mn * 3]; int main() { int n; scanf( %d , &n); for (int i = 1; i <= n; i++) a[i] = i; for (int i = 2; i <= n; i++) { int v = a[i - 1]; for (int j = i - 1; j < n + i - 1; j += i) { swap(v, a[min(j + i,... |
#include <bits/stdc++.h> using namespace std; const long long maxn = 3e3 + 100; const long long mod = 1e9 + 7; const long long inf = 1e18; long long n, dsu[maxn], sz[maxn], t[maxn], a[maxn], mx, s, ans; pair<long long, pair<long long, long long> > e[maxn]; void init() { mx = 0; for (long long i = ... |
// -------------------------------------------------------------
//
// File Name: hdl_prj\hdlsrc\controllerPeripheralHdlAdi\velocityControlHdl\velocityControlHdl_MATLAB_Function.v
// Created: 2014-08-25 21:11:09
//
// Generated by MATLAB 8.2 and HDL Coder 3.3
//
// ---------------------------------------------------... |
//--------------------------------------------------------------------------------
// Project : SWITCH
// File : user_ddr_strm_arbitrator.v
// Version : 0.1
// Author : Vipin.K
//
// Description: Arbitrator for user DDR stream generator
//-----------------------------------------------------------------... |
/*------------------------------------------------------------------------------
* This code was generated by Spiral Multiplier Block Generator, www.spiral.net
* Copyright (c) 2006, Carnegie Mellon University
* All rights reserved.
* The code is distributed under a BSD style license
* (see http://www.opensource.or... |
#include <bits/stdc++.h> using namespace std; long long n, r1, r2, r3, d; const int N = 1e6 + 4; long long dp[N][2]; long long a[N]; void debug() { cout << -----debug----- << endl; for (int i = 1; i <= n; ++i) { printf( dp[%d][%d]=%lld dp[%d][%d]=%lld n , i, 0, dp[i][0], i, 1, dp[i][1]); ... |
#include <bits/stdc++.h> using namespace std; pair<int, int> a[107][107]; int b[107][107]; int main() { int m, p; scanf( %d %d , &m, &p); int i, j; for (i = 1; i <= m; i++) for (j = 1; j <= p; j++) a[i][j].first = i, a[i][j].second = j; int q; scanf( %d , &q); while (q--) { ... |
/**
* 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; bool debug = false; int n, m, k; long long ln, lk, lm; int b[5105], a[5105]; void update(int x) { for (int i = x; i <= n; i += i & -i) { b[i]++; } } int query(int x) { int ret = 0; for (; x > 0; ret += b[x], x -= x & -x) ; ret... |
/*
* 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 M = 500 + 5; int board[M][M], dp[M][M]; int main() { int n, m, k; cin >> n >> m >> k; for (int i = 0; i < n; i++) { string s; cin >> s; for (int j = 0; j < m; j++) { board[i + 1][j + 1] = s[j] - 0 + 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... |
module TERASIC_ADC_READ(
clk,
reset_n,
// avalon slave
s_chipselect,
s_read,
s_readdata,
s_write,
s_writedata,
// export interface
SPI_CLK,
SPI_CS_n,
SPI_IN,
SPI_OUT
);
input clk;
input reset_n;
input s_chipselect;
input s_read;
output reg [15:0] s_readdata... |
#include <bits/stdc++.h> using namespace std; int n; int bin[31]; int cnt; int ch[6000010][2]; void insert(int x) { for (int i = 30; i >= 0; --i) { bin[i] = x & 1; x >>= 1; } int now = 0; for (int i = 0; i <= 30; ++i) { if (!ch[now][bin[i]]) { ch[now][bin[i]] = ++cn... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 04/26/2016 07:00:53 AM
// Design Name:
// Module Name: Adder_Round
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
/... |
//
// Copyright (c) 2014 Jan Adelsbach <>.
// 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 Foundation, either version 3 of the License, or
// (at your optio... |
#include <bits/stdc++.h> using namespace std; int main() { int n, A[100000], count0 = 0, max = 0; scanf( %i , &n); for (int i = 0; i < n; i++) { scanf( %i , A + i); if (A[i] < 0) A[i] = -A[i] - 1; if (!A[i]) count0++; if (A[i] > max) max = A[i]; } if (count0 == n) { ... |
/***************************************************************************************************
** fpga_nes/hw/src/cmn/block_ram/block_ram.v
*
* Copyright (c) 2012, Brian Bennett
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided... |
/*
* 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... |
//Legal Notice: (C)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 do... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 100; int num; int sa[N], fir[N], sec[N], t[N]; int height[N], L[N], R[N], st[N]; char c[N]; inline long long SA(int len, char s[]) { num = 300; for (int i = 1; i <= num; i++) t[i] = 0; for (int i = 1; i <= len; i++) ++t[fir[i] =... |
#include <bits/stdc++.h> using namespace std; int n, k; string a; int b[10000]; int memo[2000][2000]; int dp(int i, int d) { if (abs(d) == k && i == a.length()) return 0; if (i == a.length() || abs(d) == k) return 1; if (memo[i][d] != -1) return memo[i][d]; int x; if (a[i] == L ) ... |
`timescale 1ns / 1ps
`define SIMULATION
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 00:55:11 12/07/2015
// Design Name: Peripheral_clk_generator
// Module Name: C:/WINDOWS/system32/Timer/Periph_gen_clk_tst.v
// Project Name: Timer... |
#include <bits/stdc++.h> using namespace std; class MinCostMaxFlowLongLong { public: class MinCostMaxFlowEdge { private: int destination_; long long capacity_; long long cost_; long long flow_; public: MinCostMaxFlowEdge(int destination, long long capacity, long lon... |
/**
* 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; const int maxn = 2e6 + 7; const int mod = 51123987; const int inv2 = mod + 1 >> 1; struct Edge { int to, last, v; } E[maxn]; int fa[maxn]; int len[maxn]; int dep[maxn]; int head[maxn]; int tot; int last; int cnt; int n; char s[maxn]; int ... |
#include <bits/stdc++.h> using namespace std; const int inf = 0x3f3f3f3f, mod = 998244353; const long long INF = 0x3f3f3f3f3f3f3f3fLL; const double pi = acosl(-1.), eps = 1e-9; inline void sum(int &a, int b) { a += b; if (a >= mod) a -= mod; } inline int power(int a, int b, int m = mod, int ans = ... |
#include <bits/stdc++.h> using namespace std; void read_file(bool outToFile = true) {} int n, K; const int MAXN = 200000 + 99; int A[MAXN]; set<int> X; int vis[MAXN]; bool check() { memset(vis, 0, sizeof vis); stack<int> s; int idx = 0; int cur = 1; while (true) { while (s.empt... |
#include <bits/stdc++.h> using namespace std; const int N = 2 * 1e5 + 10; long long t[2][4 * N], a, b; void update(int l, int r, int j, int pos, int val) { if (r < pos || pos < l) return; if (pos <= l && r <= pos) { t[0][j] = min(a, t[0][j] + val); t[1][j] = min(b, t[1][j] + val); retu... |
/**
* 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: asyn_1024_134.v
// Megafunction Name(s):
// dcfifo
//
// Simulation Library Files(s):
//
// ==================================================... |
#include <bits/stdc++.h> using namespace std; const int maxn = 2e5 + 5; int l[maxn], r[maxn], a[maxn], pos[40]; map<int, int> m; int main() { int n; scanf( %d , &n); long long ans = (long long)n * (n + 1) / 2; for (int i = 1; i <= n; i++) { scanf( %d , &a[i]); } for (int i = 1; i... |
`timescale 1ns / 1ps
/***********************************************************************************************************************
* *
* ANTIKERNEL v0.1 ... |
#include <bits/stdc++.h> #pragma GCC optimize( O2 ) using namespace std; int n, s; int frq[1002]; int t; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cin >> n >> s; for (int i = 1; i <= n; ++i) { int a, b; cin >> a >> b; frq[a] = max(frq... |
#include <bits/stdc++.h> using namespace std; int n, m, a, b; vector<pair<int, int> > des[110]; int dist(int i, int j) { if (i <= j) return j - i; return n - i + j; } bool cmp(pair<int, int> a, pair<int, int> b) { int i = a.second; int x = a.first, y = b.first; return dist(i, x) < dist(i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.