text
stringlengths
59
71.4k
module foo(); initial begin a; end always @(a) begin b; end task a (a); begin a = f; a = f; d <= 89; sdf = sdf; adada = > asda; d ->> g; aasd <<<= 3; ccc %= 6; d *= b; ...
#include <bits/stdc++.h> using namespace std; long long n, k, i, j; int main() { cin >> n >> k; if (2 * k >= n) { cout << -1; return 0; } cout << n * k << endl; for (i = 1; i <= n; i++) for (j = 0; j < k; j++) cout << i << << (i + j) % n + 1 << n ; }
#include <bits/stdc++.h> using namespace std; int main() { long long al; cin >> al; while (al--) { long long b, c; cin >> b >> c; if ((abs(b - c)) % 10 == 0) cout << abs(b - c) / 10 << n ; else { b = abs(b - c); cout << b / 10 + 1 << n ; } } ...
// *************************************************************************** // *************************************************************************** // Copyright 2011(c) Analog Devices, Inc. // // All rights reserved. // // Redistribution and use in source and binary forms, with or without modification, // a...
#include <bits/stdc++.h> using namespace std; vector<bool> isthere(2000010, false); vector<int> nextmax(2000010); int main() { ios::sync_with_stdio(false); int n, i; cin >> n; vector<int> a(n); for (i = 0; i < n; i++) { cin >> a[i]; isthere[a[i]] = true; } sort(a.begin(),...
/* This file is part of JT51. JT51 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. JT51 is distributed in the hope tha...
#include <bits/stdc++.h> using namespace std; int main() { double d, h, v, e; while (~scanf( %lf%lf%lf%lf , &d, &h, &v, &e)) { double v1, v2; v1 = (d / 2) * (d / 2) * 3.1415927 * e; v2 = (d / 2) * (d / 2) * 3.1415927 * h; if (v1 >= v) printf( NO n ); else { doub...
/** * 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 getInt() { int x; scanf( %d , &x); return x; } long long getLongLong() { long long x; scanf( %I64d , &x); return x; } double getDouble() { double x; scanf( %lf , &x); return x; } char getChar() { char x; scanf(...
// Name: WcaWriteDwordReg.v // // Copyright(c) 2013 Loctronix Corporation // http://www.loctronix.com // // 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 2 // of the ...
module ram( input clock , input chip_enable , input read_enable , input [31:0] read_address , output reg [31:0] read_data , input write_enable , input [31:0] write_address, input [ 3:0] write_select , input ...
`define RegBankS8_NOP 4'h0 `define RegBankS8_RDO 4'h1 `define RegBankS8_LD0 4'h2 `define RegBankS8_LD1 4'h3 `define RegBankS8_LD2 4'h4 `define RegBankS8_LD3 4'h5 `define RegBankS8_LD4 4'h6 `define RegBankS8_LD5 4'h7 `define RegBankS8_LD6 4'h8 `define RegBankS8_LD7 4'h9 `define RegBankS8_State_Reset 2'h0 `define RegBan...
#include <bits/stdc++.h> using namespace std; const long long Mx = 512; long long D[Mx][Mx]; int32_t main() { long long n, m, mod, a = 0, b = 0; cin >> n >> m >> mod; vector<long long> C(n); for (long long i = 0; i < m; i++) for (long long j = 0; j < n; j++) { char c; cin >...
// ========== Copyright Header Begin ========================================== // // OpenSPARC T1 Processor File: mb2cpx.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 // ...
/*********************************************************************************************************************** * Copyright (C) 2016 Andrew Zonenberg and contributors * * ...
#include <bits/stdc++.h> using namespace std; template <class T> ostream &operator<<(ostream &os, const pair<T, T> &p) { return os << ( << p.first << , << p.second << ) ; } template <class T> ostream &operator<<(ostream &os, const pair<const T, T> &p) { return os << ( << p.first << , << p.s...
// megafunction wizard: %ALTSQRT% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: ALTSQRT // ============================================================ // File Name: sqrt_43.v // Megafunction Name(s): // ALTSQRT // // Simulation Library Files(s): // altera_mf // ==========================================...
///////////////////////////////////////////////////////////////////// //// //// //// WISHBONE AC 97 Controller //// //// Serial Input Block //// //// ...
#include <bits/stdc++.h> using namespace std; int n, m, k; struct Edge { int u; int v; } e[1000000]; int dp[3000][3000]; bool Judge1(int x, int y) { for (int i = 0; i < n; i++) if (!(x & (1 << i)) && (y & (1 << i))) return false; return true; } bool Judge2(int u, int v, int x, int ...
#include <bits/stdc++.h> using namespace std; inline long long int __gcd(long long int a, long long int b); void pdash(int n = 1); int bitcount(long long int u); long long int power(long long int x, long long int y); long long int power(long long int x, long long int y, long long int z); long long int mod...
#include <bits/stdc++.h> using namespace std; int n, m; const int MAXN = 200100; int win = 0, ti = 0; int vis[MAXN][2] = {0}; int vs[MAXN] = {0}; int path[MAXN], cnt; vector<int> g[MAXN]; bool dfsloop(int u) { vs[u] = 1; bool f = false; for (int i = 0; i < g[u].size(); i++) { int v =...
// Accellera Standard V2.5 Open Verification Library (OVL). // Accellera Copyright (c) 2005-2010. All rights reserved. parameter UNCHANGE_START = 1'b0; parameter UNCHANGE_CHECK = 1'b1; reg [width-1:0] r_test_expr; reg r_state; integer i; `ifdef OVL_XCHECK_OFF //Do nothing `else `ifdef OVL_IMPLICIT_XCH...
module var12_multi (A, B, C, D, E, F, G, H, I, J, K, L, valid); input A, B, C, D, E, F, G, H, I, J, K, L; output valid; wire [7:0] min_value = 8'd107; wire [7:0] max_weight = 8'd60; wire [7:0] max_volume = 8'd60; wire [7:0] total_value = A * 8'd4 + B * 8'd8 + C * 8'd0 +...
/* Copyright 2018 Nuclei System Technology, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except i...
#include <bits/stdc++.h> using namespace std; set<long long int> adj[3005]; map<long long int, long long int> mq; long long int done[3005][3005]; int main() { ios_base::sync_with_stdio(false); long long int n, m, i, ans = 0; cin >> n >> m; for (i = 0; i < m; i++) { long long int x, y; ...
#include <bits/stdc++.h> using namespace std; const int maxn = 2e5 + 10; int a[maxn]; queue<int> q; queue<int> m; int main() { int n; scanf( %d , &n); int fu = 0; int maxfu = -0x3f3f3f3f; int idfu; for (int i = 1; i <= n; i++) { scanf( %d , &a[i]); if (a[i] < 0) { ...
// DESCRIPTION: Verilator: SystemVerilog interface test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2012 by Iztok Jeras. module t (/*AUTOARG*/ // Inputs clk ); input clk; logic rst = 1'b1; // reset integer rst_cnt = 0; // reset is removed a...
/** * 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 = 1e6 + 10; int n, m, f[N], vis[N], cnt; int find(int x) { return x == f[x] ? x : f[x] = find(f[x]); } struct node { int x, y, w; } a[N]; bool cmp(node a, node b) { return a.w < b.w; } int main() { while (cin >> n >> m) { int ans = ...
#include <bits/stdc++.h> using namespace std; int len[55]; int n; struct node { int x, y, s; } arr[55 * 55]; int ans[55 * 55][2]; int main() { int i, j, tmp, k; while (scanf( %d , &n) != EOF) { for (i = 1; i <= n; i++) scanf( %d , &len[i]); k = 0; for (i = 1; i <= n; i++) ...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); string s; cin >> s; vector<string> splitted; stringstream ss(s); string item; while (getline(ss, item, , )) { splitted.push_back(item); } int MAX = 1001; vecto...
#include <bits/stdc++.h> using namespace std; void solve() { long long n, v; cin >> n >> v; if (n >= v) { long long t = (n - v) * (n - v + 1); t /= 2; t += v - 1; cout << t; } else { cout << n - 1; } } int32_t main() { ios_base::sync_with_stdio(false); c...
#include <bits/stdc++.h> using namespace std; const int N = 2e5; bool vis[N]; int n, m, ans; vector<int> top; vector<pair<int, int> > adj[N]; void dfs(int u) { vis[u] = 1; for (int i = 0; i < adj[u].size(); i++) { int v = adj[u][i].first; if (!vis[v]) dfs(v); } top.push_back(u)...
#include <bits/stdc++.h> using namespace std; long long d, k, a, b, t; void solve() { cin >> d >> k >> a >> b >> t; if (d <= k) { cout << d * a; return; } long long ans = k * a + d * b - k * b; long long mult = t + k * a - k * b; if (mult >= 0) { cerr << 1 << n ; ...
// Accellera Standard V2.5 Open Verification Library (OVL). // Accellera Copyright (c) 2005-2010. All rights reserved. // Parameters used for fsm states parameter WIN_UNCHANGE_START = 1'b0; parameter WIN_UNCHANGE_CHECK = 1'b1; //------------------------------------------------------------------------------ // ...
#include <bits/stdc++.h> using namespace std; template <typename T, typename U> using pr = pair<T, U>; template <typename T> using vt = vector<T>; template <class T> bool cmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; } template <class T> bool cmax(T& a, const T& b) { return a < b ? a...
#include <bits/stdc++.h> using namespace std; int main() { int n, m, k; cin >> n >> m >> k; deque<int> items; int tmp; for (int i = 0; i < k; i++) { cin >> tmp; items.push_back(tmp); } int ans = 0; for (int i = 0; i < n * m; i++) { cin >> tmp; for (int j = 0; ...
#include <bits/stdc++.h> using namespace std; const long long inf = 27; long long n, a[inf], b[inf], c[inf], ans = -1e9; vector<long long> res; map<pair<long long, long long>, pair<long long, vector<long long> > > mp; vector<long long> mask; void btadd(long long pos, long long sum1, long long sum2, long l...
#include <bits/stdc++.h> const int N = 502; void sw(float* x) { float tmp = *x; *x = *(x + 2); *(x + 2) = *(x + 1); *(x + 1) = tmp; } int main() { int _t; scanf( %d , &_t); while (_t--) { static float arr[N]; static int anss[N * N]; static int tm[N]; memset(tm...
#include <bits/stdc++.h> using namespace std; int n; int sz0[400000]; vector<int> g[400000]; vector<int> c0[400000]; int centroid; int sz[400000]; vector<int> cs[400000]; int ans[400000]; void dfs0(int x) { sz0[x] = 1; for (int y : g[x]) { if (sz0[y] == 0) { c0[x].push_back(y);...
/** * 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 MOD = 1e9 + 7; const long double E = 1e-9; unsigned char ccc; bool _minus = false; inline void read(int &n) { n = 0; _minus = false; while (true) { ccc = getchar(); if (ccc == || ccc == n ) break; if (ccc == - ) { ...
/** * 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 int MAXN = 3000 + 1000; int n, sum; int in[MAXN], out[MAXN]; struct Union_Find_Set { int f[MAXN]; void Init(int N) { for (int i = 1, _ = N; i <= _; i++) f[i] = i; } int Find(int x) { return x == f[x] ? x : f[x] = Find(f[x]); } bool Union(int x, int y) { ...
// (C) 1992-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 simulati...
#include <bits/stdc++.h> using namespace std; int main() { int n, k, five = 0, zero = 0; cin >> n; while (n--) { cin >> k; if (k == 5) five += 1; else zero += 1; } if (five >= 9 && zero > 0) { for (size_t i = 0; i < five / 9; i++) cout << 555555555 ; ...
#include <bits/stdc++.h> using namespace std; void solve(); string conc(long long int a, long long int b) { return to_string(a) + | + to_string(b); } long long int rev(long long int x) { long long int ans = 0; while (x != 0) { ans = ans * 10 + (x % 10); x /= 10; } return ans;...
#include <bits/stdc++.h> using namespace std; vector<vector<int> > vec1(312345), vec2(312346); int g[123456], p[123456], t[123456]; int cons; int h, w; int computeup(int i) { int val1, val; vector<int>::iterator it; val1 = t[i] - p[i] + cons; it = upper_bound(vec1[val1].begin(), vec1[val1].e...
#include <bits/stdc++.h> using namespace std; int nxt() { int x; cin >> x; return x; } int main() { int n = nxt(), k = nxt(); vector<int> a(n); generate(a.begin(), a.end(), nxt); int s = accumulate(a.begin(), a.end(), 0); int ans = 0; while ((s + k * ans) * 1.0 / (n + ans) < ...
/* * Copyright (c) 2008 Zeus Gomez Marmolejo <> * * 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 version 3, or (at your option) an...
#include <bits/stdc++.h> using namespace std; const long long int INF = 1e16; int a[2][111111]; int main(void) { int n; cin >> n; for (int e = 0; e < 2; e++) for (int p = 0; p < n; p++) cin >> a[e][p]; long long int tot = 0; for (int e = 0; e < n; e++) tot += a[0][e]; sort(a[1], a[...
/* * 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 (c) 2013, Andrew "bunnie" Huang // // See the NOTICE file distributed with this work for additional // information regarding copyright ownership. The copyright holder // licenses this file to you under the Apache License...
//Copyright (C) 1991-2013 Altera Corporation //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 from any of the foregoing //(including device programming or simulation files), and any //associated documentatio...
#include <bits/stdc++.h> using namespace std; const int mod = 1000000007; long long fac[2000001]; long long PowMod(long long a, long long b, long long mod) { long long ret = 1LL; while (b) { if (b & 1) ret = (ret * a) % mod; a = (a * a) % mod; b >>= 1; } return ret; } void ...
/* * 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 2013, Homer Hsing <> * * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to ...
#include <bits/stdc++.h> using namespace std; const long long MOD = 1e9 + 7; const long long N = 3e5 + 10; long long pow(long long a, long long b, long long m) { long long ans = 1; while (b) { if (b & 1) ans = (ans * a) % m; b /= 2; a = (a * a) % m; } return ans; } long lon...
//====================================== // // intra mode desicion top // luyanheng // //====================================== module md_top( clk, rstn, enable, sram_rdata, sram_read, sram_raddr, bestmode_o, bestmode16_o, bestmode32_o, finish ); parameter MODE=21; parameter ...
//Legal Notice: (C)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 do...
#include <bits/stdc++.h> using namespace std; int kbo[1001]; int main() { int s, k, i; scanf( %d%d , &s, &k); kbo[0] = 0; kbo[1] = 1; kbo[2] = 1; for (i = 3;; i++) { if (i - k - 1 > 0) kbo[i] = 2 * kbo[i - 1] - kbo[i - k - 1]; else kbo[i] = 2 * kbo[i - 1]; ...
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; long long p; cin >> p; long long keys[2001], people[1001]; for (int i = 0; i < n; i++) cin >> people[i]; for (int i = 0; i < k; i++) cin >> keys[i]; sort(keys, keys + k); sort(people, people + 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; void fastio() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout << fixed; } int main() { fastio(); int n; cin >> n; long long int a[n]; long long int totsum = 0; for (int i = 0; i < n; i++) { cin >> a[i]; ...
#include <bits/stdc++.h> using namespace std; int main() { int t, i; cin >> t; for (int i = 0; i < t; i++) { long long int n; cin >> n; if (n < 4) cout << 4 - n << endl; else { cout << n % 2 << endl; } } 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> using namespace std; using ll = long long; using PII = pair<int, int>; const int mod = 998244353; const int inf = 1 << 30; const int maxn = 100000 + 5; int n, k, alive[maxn]; int query(int x) { cout << ? << x << endl; string s; cin >> s; if (s == Y ) { ...
// ------------------------------------------------------------- // // Generated Architecture Declaration for rtl of ent_a // // Generated // by: wig // on: Thu Jun 22 05:51:07 2006 // cmd: /cygdrive/h/work/eclipse/MIX/mix_0.pl ../../highlow.xls // // !!! Do not edit this file! Autogenerated by MIX !!! // $Author:...
/* verilator lint_off STMTDLY */ /* verilator lint_off WIDTH */ module MMCME2_ADV # ( parameter BANDWIDTH = "OPTIMIZED", parameter real CLKFBOUT_MULT_F = 5.000, parameter real CLKFBOUT_PHASE = 0.000, parameter CLKFBOUT_USE_FINE_PS = "FALSE", parameter real CLKIN1_PERIOD = 10.000, ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> v; int max = 0; int mi = 0; for (int i = 0; i < n; ++i) { int temp; cin >> temp; v.push_back(temp); if (temp > max) { max = temp; mi = i; } } for (int...
#include <bits/stdc++.h> using namespace std; const int MAX_N = 210, MAX_K = 1010, MOD = 1e9 + 7; int N, K, arr[MAX_N], dp[MAX_N][MAX_N][MAX_K]; void add(int& a, long long b) { b %= MOD; a = (a + b) % MOD; } int solve() { sort(arr + 1, arr + N + 1); dp[0][0][0] = 1; for (int i = 1; i <= ...
#include <bits/stdc++.h> using namespace std; template <typename T> ostream& operator<<(ostream& os, vector<T> v) { os << [ ; string sep; for (const T& el : v) os << sep << el, sep = , ; return os << ] ; } void dbg_out() { cerr << endl; } template <typename Head, typename... Tail> void...
module var11_multi (A, B, C, D, E, F, G, H, I, J, K, valid); input A, B, C, D, E, F, G, H, I, J, K; output valid; wire [7:0] min_value = 8'd107; wire [7:0] max_weight = 8'd60; wire [7:0] max_volume = 8'd60; wire [7:0] total_value = A * 8'd4 + B * 8'd8 + C * 8'd0 + D * 8...
#include <bits/stdc++.h> using namespace std; int n, m, seed, vmax; const int mod = 1e9 + 7; int rnd() { int rlt = seed; seed = (1ll * seed * 7 + 13) % mod; return rlt; } int expmod(int a, int b, int P) { int rlt = 1; while (b) { if (b & 1) rlt = 1ll * a * rlt % P; a = 1ll * ...
/* * Copyright (C) 2009 Onno Kortmann <> * * 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 2 of the License, or * (at your option) any later version. * * This program ...
////////////////////////////////////////////////////////////////////// //// //// //// spi_clgen.v //// //// //// //// This file is part of the SPI I...
#include <bits/stdc++.h> using namespace std; int main() { int n, x, m, a[100005] = {}; cin >> n; m = n; while (n--) { cin >> x; a[x] = 1; while (a[m]) { cout << m << ; m--; } cout << endl; } return 0; }
// $Id: c_prefix_net.v 5188 2012-08-30 00:31:31Z dub $ /* Copyright (c) 2007-2012, 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: Redistributions...
#include <bits/stdc++.h> using namespace std; struct Trie { Trie *nx[2]; int cnt; Trie() { nx[0] = nx[1] = nullptr; cnt = 0; } }; Trie *root; void ins(long long x) { Trie *now = root; for (int bit = 45; bit >= 0; --bit) { int p = (x >> bit) & 1LL; if (now->nx[p]...
// megafunction wizard: %FIFO% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: scfifo // ============================================================ // File Name: sfifo_9x256.v // Megafunction Name(s): // scfifo // // Simulation Library Files(s): // altera_mf // ===========================================...
#include <bits/stdc++.h> using namespace std; const int N = 505, mod = 1e9 + 7; int n, m, e[N][N], f[N][N], g[N][N]; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin >> n; for (int i = (1); i <= (n); i++) for (int j = (1); j <= (n); j++) cin >> e[i][j]; for (i...
/* * 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; int n, m, q; const int max_w = 100; vector<pair<int, int>> cnt_sort(vector<pair<int, int>>& a) { vector<int> cnt(n * max_w + 5); for (int i = 0; i < a.size(); ++i) { ++cnt[a[i].first + 1]; } for (int i = 1; i < cnt.size(); ++i) { cnt[i] +...
// // scandoubler.v // // Copyright (c) 2015 Till Harbaum <> // Copyright (c) 2017 Sorgelig // // This source file 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 //...
/** * 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...
`define AND 4'b0000 `define OR 4'b0001 `define ADD 4'b0010 `define SUB 4'b0110 `define SLT 4'b0111 `define NOR 4'b1100 `include "../ALU/one_bit_alu.v" module alu ( input [3:0] op, input signed [31:0] a, b, output signed [31:0] z, output zero); wire set; wire [30:0] carry; one_bit_alu alu0 (.op(op), .r(z[...
////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 03.07.2016 12:04:13 // Design Name: // Module Name: pm1 // Project Name: // Target Devices: // Tool Versions: // Description: // // Dependencies: // // Revision: /...
`timescale 1ns / 1ps //************************************************************************* // > ÎļþÃû: regfile.v // > ÃèÊö £º¼Ä´æÆ÷¶ÑÄ£¿é£¬Í¬²½Ð´£¬Òì²½¶Á // > ×÷Õß : LOONGSON // > ÈÕÆÚ : 2016-04-14 //************************************************************************* module regfile( input ...
#include <bits/stdc++.h> int n, m, a, b, mna = 101, mnb = 101, mxa, mxb; void No() { printf( -1 ); } void Yes(int n) { printf( %d , n); } int main() { scanf( %d%d , &n, &m); for (int i = 0; i < n; i++, scanf( %d , &a), mna = std::min(mna, a), mxa = std::max(mxa, a)) ; for (int i = 0; ...
#include <bits/stdc++.h> using namespace std; const int N = 500050; const int inf = 0x3f3f3f3f; const long long llinf = 0x3f3f3f3f3f3f3f3f; const int mod = 998244353; const int MOD = 1e9 + 7; const double PI = acos(-1.0); clock_t TIME__START, TIME__END; void program_end() {} const int Gmod = 3, maxn...
// This VGA renderer is currently configured to display 800x640@65Hz, given a 32.4MHz pixel clock // These specs are, I think, good to drive the 5" display from Adafruit @ http://www.adafruit.com/products/2110 // Current DAC resistors are: 220+22, 510+22, 1K+68, 1.5K+680, 3.5K+560+100, 6.8K+1.5K+220, 15K+2.2K, 33K...
#include <bits/stdc++.h> using namespace std; long long x, maxi = 0, sum = 0; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(NULL); int x; cin >> x; int one = 0, zero = 0; string s; cin >> s; for (int i = 0; i < x; i++) { if (s[i] - 0 == 1) one++...
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 100; int n, h, l, r, dp[2222][2222], a[2222]; int main() { ios_base::sync_with_stdio(false); cin >> n >> h >> l >> r; for (int i = 0; i < n; i++) cin >> a[i]; for (int i = 0; i < h; i++) for (int j = 0; j <= n; j++) dp[j][i]...
#include <bits/stdc++.h> using namespace std; char arr[2][100010]; int vis[2][100010]; int k, n, curj1, curj2; bool valid(int i, int j) { if (i >= 0 && i < 2 && j >= 0 && j >= n) return true; if (i >= 0 && i < 2 && j >= 0 && j < n && arr[i][j] != X && vis[i][j] == 0) return true; return fa...
#include <bits/stdc++.h> using namespace std; bool isPal(string s) { for (long long i = 0, j = s.length() - 1; i < j; i++, j--) if (s[i] != s[j]) return 0; return 1; } string lts111(long long n) { string a = 00:00 ; long long hr = n / 60; long long min = n % 60; long long fh = hr ...
#include <bits/stdc++.h> using namespace std; int cur; bool c[1011][1011]; int x[33], y[33], z[33]; void connect(int target, int between) { for (int i = (1), _b = (between); i <= _b; i++) z[i] = ++cur; z[between + 1] = target; z[0] = 1; for (int i = (0), _b = (between); i <= _b; i++) c[z[i]][z...
/* * 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 d[66000], s[66000]; int que[66000]; bool f[66000]; int n, m; vector<pair<int, int> > res; int biton(int x, int k) { return (x | (1 << k)); } int Minus(int x, int y) { int z = 0; for (int i = 0; i < 17; i++) { int u = ((x >> i) & 1); i...
#include <bits/stdc++.h> using namespace std; int l[105], r[105]; int dp[105][100005]; int temp[100005]; int q[100005][2], cntl, cntr; int main() { int n, k; scanf( %d%d , &n, &k); for (int i = 1; i <= k; i++) scanf( %d%d , &l[i], &r[i]); k++; l[k] = r[k] = 2 * n; for (int i = 1; i <...
// Module VGA_SYNC // // Author: Goran Devic // https://baltazarstudios.com/poem-fpga/ // // Generates output sync signals to drive VGA display in 640x480 pixel mode: // // Refresh rate: 60 Hz // Vert. refresh: 31.46 kHz // Pixel frequency: 25.175 MHz // // Horizontal timing (pixels) Vertical timing (pixels) ...