text
stringlengths
59
71.4k
#include <bits/stdc++.h> using namespace std; const int mod = (int)1e9 + 7; const int N_ = (int)2e6 + 2; long long n; char a[N_], b[N_]; double res; long long T; int main() { scanf( %lld , &n); scanf( %s , a + 1); scanf( %s , b + 1); for (char cur = A ; cur <= Z ; cur++) { long l...
// MBT 11/9/2014 // DWP 5/9/2020 // // 1 read-port, 1 write-port ram with a onehot address scheme // // reads are asynchronous // `include "bsg_defines.v" module bsg_mem_1r1w_one_hot #(parameter `BSG_INV_PARAM(width_p) , parameter `BSG_INV_PARAM(els_p) , parame...
// (C) 2001-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 simulation // files), and any associated doc...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> a(n); vector<int> b(n); string aans = string(n / 2, 1 ) + string((n + 1) / 2, 0 ); string bans = string(n / 2, 1 ) + string((n + 1) / 2, 0 ); for (int i = 0; i < n; i++) { cin >> a[i]; ...
#include <bits/stdc++.h> using namespace std; const int MAXN = 2005; struct Point { long long x, y; Point() {} Point(long long x, long long y) : x(x), y(y) {} bool operator<(const Point& rhs) const { if (y != rhs.y) return y < rhs.y; else return x < rhs.x; } }; ...
/** * 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> struct node { node() { zuo = you = he = 0; } int zuo, you, he; } a[1000002]; char s[1000002]; int sum(int l, int r) { int ans = 0, you = 0; while (r >= l) { while (r && r - l + 1 >= (r & -r)) { ans += a[r].he; if (a[r].zuo >= you) { ans +=...
// $Header: $ /////////////////////////////////////////////////////////////////////////////// // Copyright (c) 1995/2004 Xilinx, Inc. // All Right Reserved. /////////////////////////////////////////////////////////////////////////////// // ____ ____ // / /\/ / // /___/ \ / Vendor : Xilinx // \ \ \/ ...
/* * In The Name Of God * ======================================== * [] File Name : set.v * * [] Creation Date : 04-03-2015 * * [] Last Modified : Tue, Mar 31, 2015 11:00:04 PM * * [] Created By : Parham Alvani () * ======================================= */ module set (enable, word, comp, write, rst, tag_in...
#include <bits/stdc++.h> using namespace std; int a[100010], ar[100010]; int main() { int n, track = -100002, i; cin >> n; for (i = 1; i <= n; i++) { cin >> a[i]; ar[a[i]] = ar[a[i] - 1] + 1; track = max(ar[a[i]], track); } cout << n - track << endl; }
// ------------------------------------------------------------- // // Generated Architecture Declaration for rtl of ent_ad // // Generated // by: wig // on: Tue Jun 27 05:12:12 2006 // cmd: /cygdrive/h/work/eclipse/MIX/mix_0.pl ../verilog.xls // // !!! Do not edit this file! Autogenerated by MIX !!! // $Author: w...
/** * 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) 2015 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,...
/* * 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 a[100100]; char b[100100]; int na, nb; int main() { cin >> a >> b; na = 0; nb = 0; for (int i = 0; a[i]; i++) if (a[i] == 1 ) na++; for (int i = 0; b[i]; i++) if (b[i] == 1 ) nb++; if (na % 2) na++; if (na >= nb) { ...
#include <bits/stdc++.h> using namespace std; const long long MAXN = 3e5 + 10; const long long MAXE = 3e5 + 10; const long long INF = 2e18 + 3; long long n, m, k, ec; long long from[2 * MAXE], to[2 * MAXE], prv[2 * MAXE], w[2 * MAXE], head[MAXN], sec[2 * MAXE]; long long comp[MAXN], d[MAXN], ss[MAXN...
#include <bits/stdc++.h> using namespace std; set<int> se; struct zzz { int v, id; } zz[1000005]; bool cmp(const zzz &i, const zzz &j) { return i.v > j.v; } int N, M, K; char S[1000005], T[1000005], s[1000005]; int z[1000005], p[2][1000005]; void w(int td) { for (int i = 0; i < M; i++) s[i] = ...
#include <bits/stdc++.h> using namespace std; int treeNo[111111]; vector<vector<int> > BIT; vector<pair<int, int> > E[111111]; int in[111111]; int base[111111]; int P[111111], depth[111111]; void update(int x, int val, int id) { for (; x < BIT[id].size(); x += (x & -x)) BIT[id][x] += val; } int ...
#include <bits/stdc++.h> using namespace std; const long double eps = 1e-9; const int inf = (1 << 30) - 1; const long long inf64 = ((long long)1 << 62) - 1; const long double pi = 3.1415926535897932384626433832795; template <class T> T sqr(T x) { return x * x; } template <class T> T abs(T x) { ...
#include <bits/stdc++.h> using namespace std; const int size = 400007; const long long modulo = 1000000007; const int INF = 2e9; const double EPS = 1e-8; const double PI = acos(-1.0); int d[2][size]; char board[2][size]; int compo[size]; int l[size], r[size]; int main() { ios_base::sync_with_s...
// ========== Copyright Header Begin ========================================== // // OpenSPARC T1 Processor File: bw_r_efa.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 /...
`define ADDER_WIDTH 005 `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,...
// $Id: whr_la_routing_logic.v 1922 2010-04-15 03:47:49Z dub $ /* Copyright (c) 2007-2009, Trustees of The Leland Stanford Junior University All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributi...
//----------------------------------------------------------------------------- // // (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 ...
#include <bits/stdc++.h> using namespace std; int n; char a[105][3]; int main() { scanf( %s%d , a[0], &n); for (int i = 1; i <= n; ++i) { scanf( %s , a[i]); if (a[i][0] == a[0][0] && a[i][1] == a[0][1]) { printf( YES n ); return 0; } } for (int i = 1; i <= n; ++...
#include <bits/stdc++.h> #pragma GCC optimize( O2 ) using namespace std; long long n, x, y, nr; long long cx, cy; int ans[2000002]; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cin >> n >> x >> y; int xx = 0; while (xx <= x + y) { long long pa =...
/** * 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 = 1e3 + 3; int n, m, dp[N], vis[2][N]; vector<int> adj[2][N]; vector<pair<int, int>> e; void dfs(int u, int dir) { vis[dir][u] = 1; for (int v : adj[dir][u]) if (!vis[dir][v]) dfs(v, dir); } int main() { ios_base::sync_with_stdi...
#include <bits/stdc++.h> using namespace std; const int n = 100002; char h[n], h1[n]; int a[n]; bool check(int e, int r, int v1, int c1) { int c, v, c2, v2; while (e < r) { for (c = 0; c < 10; c++) for (v = 0; v < 10; v++) if (c + v == v1 + h[r]) { if ((c == 0) && (...
//+FHDR------------------------------------------------------------------------ //Copyright (c) 2013 Latin Group American Integhrated Circuit, Inc. All rights reserved //GLADIC Open Source RTL //----------------------------------------------------------------------------- //FILE NAME : //DEPARTMENT : IC Design / Veri...
#include <bits/stdc++.h> using namespace std; void solve() { int n, k; cin >> n >> k; vector<int> table(n), d = {119, 18, 93, 91, 58, 107, 111, 82, 127, 123}; for (int i = 0; i < n; ++i) { string tmp; cin >> tmp; reverse(tmp.begin(), tmp.end()); for (int j = 0; j < 7; ++j) { ...
#include <bits/stdc++.h> using namespace std; const int maxn = 100010; int p[maxn], w[maxn]; vector<pair<pair<int, int>, int>> a; int find(int x) { if (p[x] == x) return x; else { int ret = find(p[x]); w[x] ^= w[p[x]]; return p[x] = ret; } } int main() { int l, r, 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 law...
//====================================================================== // // shr32.v // ------- // 32bit right shift with carry in / carry out. // // // Author: Peter Magnusson // Copyright (c) 2015, NORDUnet A/S All rights reserved. // // Redistribution and use in source and binary forms, with or without // modifica...
// ==================================================================== // MAH PONK // // Copyright (C) 2007, Viacheslav Slavinsky // This design and core is distributed under modified BSD license. // For complete licensing information see LICENSE.TXT. // ----------------------------...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int arr[n]; for (int i = 0; i < n; i++) { cin >> arr[i]; } sort(arr, arr + n); cout << (arr[n - 1] - arr[0] + 1) - n << n ; }
#include <bits/stdc++.h> using namespace std; const int N = 500005; int n, k; char a[N], b[N]; int main() { scanf( %d%d%s%s , &n, &k, a, b); long long cur = 1, ans = 0; if (k == 1) { cout << n << endl; return 0; } for (int i = 0; i < n; i++) { cur *= 2; if (a[i] != ...
#include <bits/stdc++.h> #pragma GCC target( avx2 ) #pragma GCC optimization( O3 ) #pragma GCC optimization( unroll-loops ) #pragma GCC optimize( Ofast ) #pragma GCC target( avx,avx2,fma ) using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); ; ...
(************************************************************************) (* v * The Coq Proof Assistant / The Coq Development Team *) (* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2011 *) (* \VV/ **************************************************************) (* // * Th...
#include <bits/stdc++.h> using namespace std; int main() { int l; float p, q, t, res; cin >> l >> p >> q; t = l / (p + q); res = p * t; printf( %.4f , res); return 0; }
#include <bits/stdc++.h> using namespace std; const int maxn = 1e3 + 5; const int inf = 0x3f3f3f3f; const long long mod = 1e9 + 7; const double eps = 1e-6; vector<int> g[maxn]; vector<int> tree[maxn]; int deep[maxn], son[maxn]; int cnt, mx; void dfs(int x, int y) { int sz = g[x].size(); deep...
`timescale 1 ps / 1 ps module song_ip_v1_0 # ( // Users to add parameters here // User parameters ends // Do not modify the parameters beyond this line // Parameters of Axi Slave Bus Interface S00_AXI parameter integer C_S00_AXI_DATA_WIDTH = 32, parameter integer C_S00_AXI_ADDR_WIDTH = 4 ) ( // U...
#include <bits/stdc++.h> using namespace std; long long int bt[50 + 10]; map<int, int> MAP; int main() { long long int a, b, c, d, e, f, m, n, p, q, x, y, z, w, k; vector<long long int> v[2525], temp; cin >> n >> k; for (int i = 1; i <= n; i++) { cin >> x; bt[i] = x; temp.push_...
/* * Milkymist VJ SoC * Copyright (C) 2007, 2008, 2009 Sebastien Bourdeauducq * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, version 3 of the License. * * This program is distributed ...
/** * 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...
//---------------------------------------------------------------------------- // Copyright (C) 2001 Authors // // This source file may be used and distributed without restriction provided // that this copyright statement is not removed from the file and that any // derivative work contains the original copyright notic...
#include <bits/stdc++.h> using namespace std; const int N = 10005; int a[N], sorted[N], n, m, sum[20][N], tree[20][N]; inline void build(int deep, int l, int r) { int i, mid = (l + r) >> 1, lm = mid - l + 1, lp = l, rp = mid + 1; for (i = l; i <= mid; i++) if (sorted[i] > sorted[mid]) lm--; fo...
#include <bits/stdc++.h> using namespace std; bool diverse(string x) { sort(x.begin(), x.end()); for (int i = 1; i < x.size(); i++) if (x[i] - x[i - 1] != 1) return 0; return 1; } int main() { cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0); int n; cin >> n; cin.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 Header Begin ========================================== // // OpenSPARC T1 Processor File: sctag_tagl_dp.v // Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved. // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES. // // The above named program is free software; you can redistribute it and...
#include <bits/stdc++.h> using namespace std; int n, m; int an[333333]; int bit[333333]; void upd(int x, int v) { for (int i = x; i <= n; i += (i & -i)) { bit[i] += v; } } int get(int x) { int an = 0; for (int i = x; i > 0; i -= (i & -i)) an += bit[i]; return an; } int main()...
#include <bits/stdc++.h> using namespace std; int main() { string s1; string s2; while (cin >> s1 >> s2) { int n = s1.length(), m = s2.length(); int dp[n + 1][m + 1]; for (int i = 0; i < n + 1; i++) dp[i][0] = i; for (int i = 0; i < m + 1; i++) dp[0][i] = i; for (int i = 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 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; template <class T, class U> void ckmin(T &a, U b) { if (a > b) a = b; } template <class T, class U> void ckmax(T &a, U b) { if (a < b) a = b; } int N, M; bitset<1013> grid[1013]; int dn[1013][1013], rt[1013][1013]; int upd[1013][1013]; int x ...
#include <bits/stdc++.h> using namespace std; void ga(int N, int *A) { for (int i(0); i < N; i++) scanf( %d , A + i); } unordered_map<int, int> dp; int N, S[(4000)]; int dyn(int a, int b, int K, bool x) { if (b - a + 1 < K) return 0; if (b - a + 1 == K) return (S[b] - (a ? S[a - 1] : 0)); if...
#include <bits/stdc++.h> using namespace std; double dp[200]; int next1[200]; int cnt(int i, int j) { if ((11 - i) % 2 == 1) { return (10 - i) * 10 + j; } else { return (10 - i) * 10 + (11 - j); } } int main() { for (int i = (1); i < (11); i++) { for (int j = (1); j < (11);...
#include <bits/stdc++.h> int main() { int mem, arr[5001], i, tri = 0; scanf( %d , &mem); for (i = 1; i <= mem; i++) { scanf( %d , &arr[i]); } for (i = 1; i <= mem; i++) { if (i == arr[arr[arr[i]]]) { tri = 1; } } if (tri == 1) { printf( YES n ); } else {...
/** * 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 = 1e5 + 5; int main() { int n; cin >> n; string s; cin >> s; queue<int> D, R; for (int i = 0; i < n; i++) { if (s[i] == D ) D.push(i); if (s[i] == R ) R.push(i); } while (D.size() && R.size()) { if (D....
`timescale 1ns / 1ps module uart_test( input clk, input rst, input [7:0] sw, input rx, input write, input read, input speed_up, input speed_down, output tx, output rdy, output full, output [7:0]seg, output [3:0] an ); reg [3:0] baud; wire up, down, reset; wire up_pulse, down_puls...
#include <bits/stdc++.h> using namespace std; long long gcd(long long a, long long b) { return (b == 0 ? a : gcd(b, a % b)); } long long lcm(long long a, long long b) { return (a * (b / gcd(a, b))); } long long POWER(long long x, long long y, long long m) { if (y == 0) return 1; if (y % 2 == 0) { ...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int t = 1; while (t--) { int sum, limit; cin >> sum >> limit; vector<pair<int, int>> v; for (int i = 1; i <= limit; i++) { v.push_back({1 << __builtin_ctz(...
/** * 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 eth_grx (input c, input [3:0] phy_rxd, input phy_rxc, input phy_rxdv, output [7:0] d, output dv, output erx); // end of RX wire [7:0] int_d; wire int_dv; wire int_er; altddio_in #(.width(5)) phy_rx_ddr (.inclock(~phy_rxc), .datain({phy_rxdv, phy_rxd}), .dataout_h({int_er, int_d[...
`include "defs.v" // Bundling CPU and ICache together module toycpu( input clk, // clock input rst, // reset // Memory bus input [31:0] bus_data_in, // bus data in input bus_data_in_ready, // bus data ready in...
/* * 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...
`timescale 1ns / 1ps module regfile( input wire wclk, rclk, input wire[3:0] address, input wire[23:0] data_in, output wire[23:0] data_out); wire[15:0] Yi; wire[15:0] clk; assign clk[15:0] = {16{wclk}} & Yi; wire[23:0] regQ0, regQ1, regQ2, regQ3, regQ4, regQ5, regQ6, regQ7, regQ8, regQ9, regQ10, regQ11...
#include <bits/stdc++.h> using namespace std; struct Exam { int s, d, c, id; bool operator<(const Exam &e1) const { return d < e1.d; } }; const int N = 105; int n, m, to[N]; Exam e[N]; int main() { cin >> n >> m; for (int i = 1; i <= m; i++) { cin >> e[i].s >> e[i].d >> e[i].c; ...
#include <bits/stdc++.h> using namespace std; const int N = 100010; const int D = 10000010; const int MAXW = N + 1000; const int mod = 1e9 + 7; int n, m; int pw2[MAXW + 10]; struct edge { int to, nx, w; } ee[N * 2]; int eq[N], en = 1; int dn, flag; int l[D], r[D], hs[D]; int ans[N], root[N...
#include <bits/stdc++.h> using namespace std; int main(void) { int t; cin >> t; while (t--) { long long n, g, b; cin >> n >> g >> b; long long t = (n + 1) / 2; long long r = t / g * (g + b); if (t % g == 0) { r -= b; } else { r += t % g; } ...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { long long int n, flag = 0; cin >> n; long long int a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = 0; i < (n - 1); i++) { if (a[i] > a[i + 1]) { ...
#include <bits/stdc++.h> using namespace std; int main() { int n, m, a; scanf( %d%d , &n, &m); if (n == 1) a = 1; else if (m == 1) a = 2; else if (m == n) a = n - 1; else if (m - 1 < n - m) a = m + 1; else a = m - 1; printf( %d , a); return 0; }
module peripherals ( input clk, input nrst, output reg[31:0] data_out, input wire[31:0] data_in, input wire[5:0] addr, input cs, input oe, input[3:0] wstrb, // PORTA inout[7:0] porta, // PORTB inout[7:0] portb, ...
////////////////////////////////////////////////////////////////////// //// //// //// Wishbone Single-Port Synchronous RAM //// //// Memory Model //// //// ...
#include <bits/stdc++.h> using namespace std; inline bool equal(double _x, double _y) { return _x > _y - 1e-9 && _x < _y + 1e-9; } char s[300]; int mx, cnt, sum, ans; bool OK(char c) { if (c >= a && c <= z || c >= A && c <= Z ) return 1; return 0; } int main() { int n; scanf( ...
/* * Milkymist SoC * Copyright (C) 2007, 2008, 2009, 2010 Sebastien Bourdeauducq * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, version 3 of the License. * * This program is distribut...
#include <bits/stdc++.h> using namespace std; const int MX = 300003; int h[4][4]; bool res[4][MX]; int len; int calc(int i) { if (h[0][i] <= h[0][1]) { int x = h[0][1] - h[0][i]; if ((h[1][i] < x) || (h[1][i] - x) % 2) return -1; int k = (h[1][i] - x) / 2; if (k > h[0][i]) return...
#include <bits/stdc++.h> using namespace std; char str[100005]; int main() { cin.getline(str, 100005); int y = 0; int l = strlen(str); int has = 0; for (int i = 0; i < l; i++) { if (y == 1 && str[i] != ) { cout << str[i]; continue; } if (str[i] == ) { ...
/* * Linear mode graphics for VGA * Copyright (C) 2010 Zeus Gomez Marmolejo <> * * VGA FML support * 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...
`include "defines.v" module brouter #(parameter addr = 4'b0101) ( input `control_w port0_ci, input `control_w port1_ci, input `control_w port2_ci, input `control_w port3_ci, input `control_w port4_ci, input `data_w port0_di, input `d...
#include <bits/stdc++.h> using namespace std; const signed long long llf = (signed long long)(~0ull >> 1); const signed int inf = (signed)(~0u >> 1); template <typename T> T __abs(T x) { return (x < 0) ? (-x) : (x); } template <typename T> void pfill(T* pst, const T* ped, T val) { for (; pst != ...
/** * 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 Header Begin ========================================== // // OpenSPARC T1 Processor File: bw_r_rf16x128d.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 an...
module ghrd_10as066n2_avlmm_pr_freeze_bridge_0 ( input wire clock, // clock.clk input wire freeze_conduit_freeze, // freeze_conduit.freeze output wire freeze_conduit_illegal_request, // .illegal_request input w...
#include <bits/stdc++.h> using namespace std; long long mod = 1e9 + 7; long long INF = 1e7; double EPS = 1e-12; double tick() { static clock_t oldt; clock_t newt = clock(); double diff = 1.0 * (newt - oldt) / CLOCKS_PER_SEC; oldt = newt; return diff; } long long int powP(long long int ...
#include <bits/stdc++.h> using namespace std; int main() { long long n, p, num, mi = 1000000, ma = 0, ans = 1; cin >> n >> p; vector<long long> v, res; for (long long i = 0; i < n; i++) { cin >> num; v.push_back(num); mi = min(mi, num); ma = max(ma, num); } sort(v.beg...
/* * 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 arr[100000 + 1]; int n, a; set<int> s; cin >> n; vector<bool> vst(n, false); for (int i = 0; i < n; ++i) { cin >> a; arr[i] = a; s.insert(a); } int k = 1; if (n != 1) for (int i = 0; i < n; ++i...
`include "../include/tune.v" module resetter( clk, rst_in_n, rst_out_n ); parameter RST_CNT_SIZE = 4; input clk; input rst_in_n; // input of external asynchronous reset output rst_out_n; // output of end-synchronized reset (beginning is asynchronous to clock) reg rst_out_n; ...
//Legal Notice: (C)2010 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...
/** * 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; struct node { int a[2][2]; node() { a[0][0] = a[0][1] = a[1][0] = a[1][1] = 0; } int *operator[](const size_t &s) { return a[s]; } }; node segTree[400008], L[400008]; node id, M, zero; int a[100002]; int lazy[400008]; inline node operator+(node &...
`include "./logic_macro.sim.v" `include "./c_frag_modes.sim.v" `include "./q_frag_modes.sim.v" `include "./f_frag.sim.v" (* FASM_FEATURES="LOGIC.LOGIC.Ipwr_gates.J_pwr_st" *) (* MODES="MACRO;FRAGS" *) module LOGIC (QST, QDS, TBS, TAB, TSL, TA1, TA2, TB1, TB2, BAB, BSL, BA1, BA2, BB1, BB2, QDI, QEN, QCK, QRT, F1, F2, F...
/* Copyright (C) {2014} {Ganesh Ajjanagadde} <> 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 distributed i...
#include <bits/stdc++.h> using namespace std; int a[5010], n, s = 0, i; int main() { cin >> n >> i; for (i = 0; i < n; i++) cin >> a[i]; sort(a, a + n); for (i = 0; i < n; i++) s += a[i] != a[(i + n / 2) % n]; cout << s << endl; for (i = 0; i < n; i++) cout << a[i] << << a[(i + n / 2) ...
module etx_fifo(/*AUTOARG*/ // Outputs txrd_wait, txwr_wait, txrr_wait, etx_cfg_access, etx_cfg_packet, txrd_fifo_access, txrd_fifo_packet, txrr_fifo_access, txrr_fifo_packet, txwr_fifo_access, txwr_fifo_packet, // Inputs etx_reset, sys_reset, sys_clk, tx_lclk_div4, txrd_access, txrd_packet, txwr_a...
// memoria dual port - single clk que permite escrita e leitura // simultaneas em portas distintas module regs( clk, // clk en_write, // write enable data_write, // dados in addr_write, // endereco addr_read1, // endereco addr_read2, // endereco data_read1, // saida data_read2 ); // ...