text
stringlengths
59
71.4k
/* * 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 ...
/** * 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...
module brainfuck_top ( input clk, rst_n, output LCD_BLON, // LCD Back Light ON/OFF output LCD_RW, // LCD Read/Write Select, 0 = Write, 1 = Read output LCD_EN, // LCD Enable output LCD_RS, // LCD Command/Data Select, 0 = Command, 1 = Data inout [7:0] LCD_DATA, // LCD Data bus 8 bi...
`ifndef ALU_V `define ALU_V `define OP_NOP 2'h0 `define OP_ADD 2'h1 `define OP_SUB 2'h2 // Simple single cycle adder module alu( input clk, input reset, input [31:0] i_a, // 1st operand input [31:0] i_b, // 2nd operand input [1:0] i_cmd, // command output [31:0] o_result, output ...
// Module m_ckt_jno is the circuit which handles the JNO or // "jump if not overflow" instruction. When JNO is called, the // status register is checked for an overflow of the program // register. If the program register has not overflowed, the following // two bits in w_bus_data (the two least-significant bits) will /...
#include <bits/stdc++.h> using namespace std; int main() { int n, k; while (cin >> n >> k) { set<int> s; int l = 0, r = 0; int ans[200005]; int a; while (n--) { cin >> a; if (s.count(a)) { continue; } s.insert(a); ans[r++] = a; ...
#include <bits/stdc++.h> using namespace std; const int MAX_N = 100000; const long long INFLL = 1e15; int N, Q; long long a[MAX_N + 1], b[MAX_N + 1]; long long S = 0; long long zero(long long x) { return (x > 0) ? x : -x; } struct SEG1 { struct NODE { int l, r; bool b; }; vector<...
/* -- ============================================================================ -- FILE NAME : mem_ctrl.v -- DESCRIPTION : ¥á¥â¥ê¥¢¥¯¥»¥¹ÖÆÓù¥æ¥Ë¥Ã¥È -- ---------------------------------------------------------------------------- -- Revision Date Coding_by Comment -- 1.0.0 2011/06/27 suito ÐÂҎ×÷³É ...
/** * 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 RI() {} template <typename... T> void RI(int &head, T &...tail) { scanf( %d , &head); RI(tail...); } struct Maxflow { struct E { int to, cap, rev, rcap, ucap; E() {} E(int _to, int _cap, int _rev) : to(_to), cap(_cap)...
/* * 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 N = 400000 + 1000; struct node { int l, r, dir; long long w; } temp; vector<node> v; long long vis[N]; bool cmp(node a, node b) { if (a.l == b.l) return a.dir < b.dir; return a.l < b.l; } int main() { int n, x, i, l, w, r, tim...
#include <bits/stdc++.h> using namespace std; const int maxn = 1e6 + 5; const int MOD = 1e9 + 7; inline int read() { int s = 0, f = 1; char ch = getchar(); while (ch < 0 || ch > 9 ) { if (ch == - ) f = -1; ch = getchar(); } while (ch >= 0 && ch <= 9 ) { s = (s << 1) ...
#include <bits/stdc++.h> using namespace std; int main() { int n; scanf( %d , &n); int ans = -1; int sum = 7; int i = 1; while (sum <= n) { int y = n - sum; if (y % 4 == 0) ans = i; sum += 7; i++; } if (ans != -1) { int s = 7 * ans; int y = n - s; ...
// 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 SerialTransmitterTest; reg clk; reg rst_x; reg [7:0] r_data; reg r_valid; wire ...
/** * 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; int main() { long long int t, i, j, cnt, k, lo, hi, mid; cin >> t; while (t--) { string s, t; cin >> s >> t; vector<long long int> v[26]; for (i = 0; s[i]; i++) { v[s[i] - a ].push_back(i); } bool flag = true; ...
#include <bits/stdc++.h> using namespace std; struct nade { int pos, tag, sum, l, r; } tree[600005 * 2]; int n; void puup(int x) { if (tree[x * 2].sum > tree[x * 2 + 1].sum) { tree[x].pos = tree[x * 2].pos; tree[x].sum = tree[x * 2].sum; } else { tree[x].pos = tree[x * 2 + 1].pos...
#include <bits/stdc++.h> using namespace std; bool isvowel(char c) { return c == a || c == e || c == i || c == o || c == u ; } int main() { char arr[110]; scanf( %s , arr); int len = strlen(arr); bool check = true; for (int i = 0; i < len; i++) { if (isvowel(arr[i])) { ...
#include <bits/stdc++.h> using namespace std; template <class T> inline void read(T &x) { x = 0; register char c = getchar(); bool f = 0; while (c != - && (c < 0 || c > 9 )) c = getchar(); if (c == - ) c = getchar(), f = 1; while (c >= 0 && c <= 9 ) x = x * 10 + c - 48, c = getcha...
#include <bits/stdc++.h> using namespace std; long long n, mod, s, s1, s2; inline long long get(long long id, long long rem, long long l, long long r, long long b, long long e, long long x) { if (e < l || r < b) { return 0; } if (b <= l && r <= e) { if (x < rem) { ...
/** * 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...
/* Distributed under the MIT license. Copyright (c) 2016 Dave McCoy () Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, mo...
#include <bits/stdc++.h> using namespace std; struct node { int from, to, next, w, dir, id; } e[1500000]; int head[350000]; int in[350000]; int out[350000]; int ans[350000]; int n, m, cont; void add(int from, int to, int w, int dir, int id) { e[cont].from = from; e[cont].to = to; e[con...
/** * 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 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; set<pair<long long, long long> > s[17]; long long a[100002]; long long g[100002]; signed main() { ios ::sync_with_stdio(0), cin.tie(0), cout.tie(0); long long n, m; cin >> n >> m; for (long long i = 0; i <= n; i++) g[i] = (i * (i + 1)) / 2LL; l...
#include <bits/stdc++.h> int main() { int N, L, i, count = 0, vivos = 0; int vet[1000000]; scanf( %d , &N); for (i = N - 1; i >= 0; i--) { scanf( %d , &vet[i]); } for (i = 0; i < N; i++) { if (count == 0) { count = vet[i]; vivos++; } else { count--; ...
#include <bits/stdc++.h> using namespace std; const int INF = 2e9; const long long INFL = 1e18; const int N = 3e5; int n, m, R; vector<int> adj[N + 5]; pair<int, int> E[2 * N + 5]; long long d[N + 5]; struct cmp { bool operator()(pair<int, long long> x, pair<int, long long> y) { return (x.se...
#include <bits/stdc++.h> using namespace std; const int inf = 0x3f3f3f3f; const int N = 1e6 + 10; const int mod = 998244353; int m, n, k = 0, flag = 0, cnt = 0; int a[N], ans[N]; long long pow2[N]; bool did[N]; int main() { ios::sync_with_stdio(false); cin >> n >> k; ; for (int i = 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...
//----------------------------------------------------------------- // // Filename : synth_reg.v // // Date : 4/19/2005 // // Description : Verilog description of SRL16E based delay and // retiming register module. // This code is synthesizable. // // // Mod. Histo...
(** * ImpCEvalFun: Evaluation Function for Imp *) (* $Date: 2013-07-01 18:48:47 -0400 (Mon, 01 Jul 2013) $ *) (* #################################### *) (** ** Evaluation Function *) Require Import Imp. (** Here's a first try at an evaluation function for commands, omitting [WHILE]. *) Fixpoint ceval_step1 (st...
// megafunction wizard: %ROM: 1-PORT% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: altsyncram // ============================================================ // File Name: stage1.v // Megafunction Name(s): // altsyncram // // Simulation Library Files(s): // altera_mf // =================================...
#include <bits/stdc++.h> using namespace std; const signed int inf = (signed)((1u << 31) - 1); const signed long long llf = (signed long long)((1ull << 61) - 1); const double eps = 1e-6; const int binary_limit = 128; template <typename T> inline bool readInteger(T& u) { char x; int aFlag = 1; ...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: // Design Name: // Module Name: GDA_St_N16_M4_P4 // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencies: //...
#include <bits/stdc++.h> using namespace std; int main() { long long n, i, j = 0, r = 0, c = 1; cin >> n; long long matrix[n][n]; for (i = 0; i < n - 1; i++) { for (j = 0; j < n - 1; j++) { matrix[i][j] = (i + j) % (n - 1) + 1; } } for (i = 0; i < n - 1; i++) { matr...
#include <bits/stdc++.h> int main() { int n, i, sum = 0; scanf( %d , &n); if (n == 1) sum = 1; if (n == 2) sum = 5; if (n == 3) sum = 13; if (n >= 4) { for (i = 4; i <= n; i++) { sum = sum + i * i - (i - 2) * (i - 2); } sum = sum + 13; } printf( %d , sum); }...
(* Copyright © 1998-2006 * Henk Barendregt * Luís Cruz-Filipe * Herman Geuvers * Mariusz Giero * Rik van Ginneken * Dimitri Hendriks * Sébastien Hinderer * Bart Kirkels * Pierre Letouzey * Iris Loeb * Lionel Mamane * Milad Niqui * Russell O’Connor * Randy Pollack * Nickolay V. Shmyrev * Bas Spitters * ...
#include <bits/stdc++.h> using namespace std; void solve() { int n = 0; cin >> n; string s; vector<vector<int> > v(5, vector<int>(0)); for (int i = 0; i < n; i++) { cin >> s; vector<int> cnt(5, 0); int sum = 0; for (int j = 0; j < s.size(); j++) { cnt[s[j] - a ]+...
#include <bits/stdc++.h> namespace FASTIO { char buf[1 << 21]; char *p1, *p2; template <typename T> inline void wt(T x, char c = n ) { if (x < 0) { x = -x; putchar( - ); } static char sta[sizeof(T) * 8]; T top = 0; do { sta[top++] = x % 10; x /= 10; } while (x...
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ University of Illinois/NCSA Open Source License Copyright(C) 2004, The Board of Trustees of the University of Illinois. All rights reserved I...
#include <bits/stdc++.h> using namespace std; int main() { int n, y; cin >> n; set<int> t; for (int i = 0; i < n; i++) { cin >> y; if (y != 0) t.insert(y); } cout << t.size() << endl; }
`timescale 1 ns / 1 ps module asym_ram(clkW, clkR, we, re, wa, ra, wd, rd); parameter WR_DATA_WIDTH = 64; parameter WR_ADDR_WIDTH = 9; parameter RD_DATA_WIDTH = 8; parameter RD_ADDR_WIDTH = 12; input clkW; input we; input [WR_ADDR_WIDTH-1:0] wa; input [WR_DATA_WIDTH-1:0] wd; input clkR; input re; input [R...
/* * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law...
#include <bits/stdc++.h> using namespace std; long long T; void Read(long long &x) { char c; while (c = getchar(), c != EOF) if (c >= 0 && c <= 9 ) { x = c - 0 ; while (c = getchar(), c >= 0 && c <= 9 ) x = x * 10 + c - 0 ; ungetc(c, stdin); return; } ...
#include <bits/stdc++.h> using namespace std; const long long int INF = 1000000007; const int N = 100000 + 7; int power(int x, unsigned int y) { int res = 1; while (y > 0) { if (y & 1) res = res * x; y = y >> 1; x = x * x; } return res; } int GCD(int A, int B) { if (B =...
/* * This program tests that enumeration value first/last/next * methods work properly. The .next method requires some run-time * support for enumeration. */ module main; enum { RED, GREEN = 2, BLUE } color1; initial begin color1 = RED; $display("color1.first == %0d", color1.first); $displ...
#include <bits/stdc++.h> using namespace std; int n, m, as = 0; template <class T> void read(T &x) { char ch; bool ok; for (ok = 0, ch = getchar(); !isdigit(ch); ch = getchar()) if (ch == - ) ok = 1; for (x = 0; isdigit(ch); x = x * 10 + ch - 0 , ch = getchar()) ; if (ok) x = -...
#include <bits/stdc++.h> int main() { char ai[105]; while (~scanf( %s , ai)) { int t = 1, max = 1; for (int i = 0; ai[i] != 0 ; i++) { if (ai[i] != A && ai[i] != E && ai[i] != I && ai[i] != O && ai[i] != U && ai[i] != Y ) { t++; max = max > t ? ...
#include <bits/stdc++.h> using namespace std; int main() { int m, n; int i; cin >> m >> n; double p[m]; double pre[m]; p[0] = pow(1.0 / m, n); pre[0] = p[0]; for (i = 1; i < m; i++) { p[i] = pow(double(i + 1) / m, n) - pre[i - 1]; pre[i] = pre[i - 1] + p[i]; } dou...
#include <bits/stdc++.h> using namespace std; const int MOD = 1e9 + 7; const int MAXN = 1e5 + 3; const int inf = 2e9; int max(int a, int b) { if (a > b) return a; else return b; } int min(int a, int b) { if (a < b) return a; else return b; } bool cmp(pair<int, i...
#include <bits/stdc++.h> int n, C, orig[600010], top, stk[300010], all, Add[300010], One[300010], cost[600010], ctop; struct info { int mx, ord, skdmx; } c[3000010]; info merge(info a, info b) { info c; if (a.mx > b.mx) c = a, c.skdmx = std::max(c.skdmx, b.mx); else c = b, c.sk...
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 10; long long gcd(long long p, long long q) { return q == 0 ? p : gcd(q, p % q); } int to[4][2] = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}}; long long n, ans; long long qp(long long a, long long b) { long long s = 1; while (b) { if (b ...
// Notes to self: latency is parameterized by LATENCY_CYCLES // bandwidth is DATA_WIDTH / cycle // latency_cycles is minus one the true latency due to a reg needed to isolate RAM from the rest of the chip module wb_shift_ram #( parameter DATA_WIDTH = 32, parameter WORD_WIDTH = 8, p...
/* * Copyright (C)2005-2015 AQUAXIS TECHNOLOGY. * Don't remove this header. * When you use this source, there is a need to inherit this header. * * This software is released under the MIT License. * http://opensource.org/licenses/mit-license.php * * For further information please contact. * URI: http://ww...
#include <bits/stdc++.h> using namespace std; int main(int argc, char const *argv[]) { int n, x; while (cin >> n) { map<int, int> a; for (int i = 0; i < n; i++) { cin >> x; if (x != 0) a[x]++; } int ans = 0, ans1 = 0, ans2 = 0; for (map<int, int>::iterator it = ...
/** * 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...
// Zhiyang Ong // Andrew Mattheisen // EE577b Troy WideWord Processor Project // make module match terms in module defn' module pipe2(aluop_in, aluop_out, ww_in, ww_out, memEn_in, memEn_out, memWrEn_in, memWrEn_out, memAddr_in, memAddr_out, wbyteen_in, wbyteen_out, regwren_i...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2017 by Todd Strader. // SPDX-License-Identifier: CC0-1.0 module t; typedef struct packed { logic [ 31 : 0 ] b; logic [ 7 : 0 ] bar; } sub_params_t; typedef st...
/** * 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 = 1e4 + 10; int dp[maxn][40]; long long pw[maxn][40]; long long n; int dfs(int a, int b) { if (dp[a][b]) return dp[a][b]; if (pw[a][b] >= n) return dp[a][b] = 1; if (pw[a][2] >= n) { if ((n - a) % 2 == 0) return dp[a][b] ...
#include <bits/stdc++.h> using namespace std; const int Maxn = 102; int n, K; double dp[2][Maxn][Maxn]; int a[Maxn]; inline int c2(int x) { return x * (x - 1) / 2; } inline int max(int x, int y) { return x > y ? x : y; } inline int min(int x, int y) { return x < y ? x : y; } int main() { scanf( %d...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int a, b, c, d; cin >> a >> b >> c >> d; if (a < b) swap(a, b); if (c < d) swap(c, d); cout << ((a == c && b + d == a) ? Yes n : No n ); } }
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 01:55:26 03/14/2015 // Design Name: // Module Name: or_gate // Project Name: // Target Devices: // Tool versions: // Description: // // Depende...
/* * 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 N = 2e5 + 5; stack<pair<long long, long long> > q; long long n, a[N], go[N]; struct cell { long long max_l, max_r, or_l, or_r; }; bool d[N][35]; cell b[N]; signed main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0...
/* * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law...
#include <bits/stdc++.h> using namespace std; void readi(int &x) { int v = 0, f = 1; char c = getchar(); while (!isdigit(c) && c != - ) c = getchar(); if (c == - ) f = -1; else v = v * 10 + c - 0 ; while (isdigit(c = getchar())) v = v * 10 + c - 0 ; x = v * f; } void ...
/////////////////////////////////////////////////////////////////////////////// // // Silicon Spectrum Corporation - All Rights Reserved // Copyright (C) 2009 - All rights reserved // // This File is copyright Silicon Spectrum Corporation and is licensed for // use by Conexant Systems, Inc., hereafter the "li...
#include <bits/stdc++.h> using namespace std; vector<int> adj[300005]; vector<int> vec; int par[300005]; int vis1[300005]; int vis2[300005]; int vis3[300005]; int vis4[300005]; int dia[300005]; int root(int x) { return par[x] = ((par[x] == x) ? x : root(par[x])); } void unite(int x, int y) { par[r...
// (C) 1992-2014 Altera Corporation. All rights reserved. // Your use of Altera Corporation's design tools, logic functions and other // software and tools, and its AMPP partner logic functions, and any output // files any of the foregoing (including device programming or simulati...
#include <bits/stdc++.h> using namespace std; int main() { string s; bool neg = false; cin >> s; int n = s.length(); if (s[0] == - ) { neg = true; n--; } int cur = 0; if (n < 3) cur = 1; else if (n == 3) if ((!neg && s <= 127 ) || (neg && s <= -128 )) ...
#include <bits/stdc++.h> using namespace std; int main() { int n, x = 0; cin >> n; char ch[n]; for (int i = 0; i < n; i++) { cin >> ch[i]; } cout << n + 1 << endl; return 0; }
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2016.3 (win64) Build Mon Oct 10 19:07:27 MDT 2016 // Date : Wed Nov 01 14:23:49 2017 // Host : vldmr-PC running 64-bit Service Pack 1 ...
#include <bits/stdc++.h> using namespace std; void solve() { long long x, n; cin >> x >> n; int pp = n % 4; long long z; if (pp == 0) z = 0; else if (pp == 1) z = -n; else if (pp == 2) z = 1; else z = n + 1; long long dre = x % 2 == 0 ? 1 : -1; x += dr...
/******************************************************************************* * This file is owned and controlled by Xilinx and must be used solely * * for design, simulation, implementation and creation of design files * * limited to Xilinx devices or technologies. Use with non-Xilinx ...
#include <bits/stdc++.h> using namespace std; const long long inf = 2000000002; pair<long long, long long> p[100005]; long long minl[100005], maxl[100005], minr[100005], maxr[100005]; int main() { int i, j, n, a, b; while (~scanf( %d , &n)) { for (i = 0; i < n; i++) { scanf( %d%d , &a, &...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long t, n, m, i, j; cin >> n >> m; string a[n]; for (long long i = 0; i < n; i++) cin >> a[i]; long long f = 0; for (long long i = 0; i < n; i++) { for (long long j ...
`timescale 1ps/1ps module srio_gen2_0_srio_clk (// Clock in ports input sys_clkp, input sys_clkn, // Status and control signals input sys_rst, input mode_1x, // Clock out ports output log_clk, output phy_clk, output gt_pcs_clk, output gt...
/** * 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) All rights reserved * SiLab, Institute of Physics, University of Bonn * ------------------------------------------------------------ */ `timescale 1ps/1ps `default_nettype none module cdc_syncfifo #( parameter DSIZE = 34, ...
#include <bits/stdc++.h> using namespace std; long long a[1000001]; int nodeNumber[1000001], nodeStart[1000001], nodeEnd[1000001], leftStart[1000001], leftEnd[1000001], rightStart[1000001], rightEnd[1000001]; void Initialise(int n) { sort(a + 1, a + n + 1); for (int i = 0; i <= n; ++i) { ...
// megafunction wizard: %ALTPLL% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: altpll // ============================================================ // File Name: clk_doubler.v // Megafunction Name(s): // altpll // ============================================================ // ****************************...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 13:55:30 03/10/2014 // Design Name: // Module Name: Frequency // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencies: // ...
#include<bits/stdc++.h> #define pb push_back #define mk make_pair #define ll long long #define ss second #define ff first #define pll pair<ll,ll> #define vll vector<ll> #define mll map<ll,ll> #define mod 1000000007 #define w(x) ll x; cin>>x; while(x--) #define ps(x,y) fixed<<setprecision(y)<<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 law...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long n; cin >> n; vector<pair<long long, long long>> a(n); vector<long long> ord(n); for (long long i = 0; i < n; i++) { cin >> a[i].first; a[i].second =...
#include <bits/stdc++.h> #pragma GCC optimize(2) using namespace std; bool Finish_read; template <class T> inline void read(T &x) { Finish_read = 0; x = 0; int f = 1; char ch = getchar(); while (!isdigit(ch)) { if (ch == - ) f = -1; if (ch == EOF) return; ch = getchar();...
#include <bits/stdc++.h> using namespace std; using ui32 = unsigned; using ui64 = unsigned long long; using i64 = long long; using i32 = int; static constexpr bool debug = false; struct node { node *c[2] = {0, 0}; int cnt = 0; }; node *root = new node; void insert_rec(node *nd, ui32 number, ...
#include <bits/stdc++.h> using namespace std; const int M = 1e5, INF = 1e9; const double PI = 3.141592653589793238462643383279502884197, eps = 1e-9; int sum; void getstring(int st, int ed, int n, bool val) { string s; sum = 0; cout << ? ; for (int i = 0; i < st; i++) cout << 0; for (int ...
#include <bits/stdc++.h> char str[110]; int main() { int len, t, _max = 0; scanf( %s , str); len = strlen(str); for (int i = 0; i < len; i++) for (int j = i + 1; j < len; j++) { t = 0; while (str[i + t] == str[j + t]) t++; if (t > _max) _max = t; } printf( %d ...
#include <bits/stdc++.h> using namespace std; const long long mod = 998244353; pair<long long, long long> dp[20][1 << 10]; int a[20]; long long pw[20]; int change(long long n) { int cnt = 0; while (n) { if (n & 1) cnt++; n /= 2; } return cnt; } int k; long long pow(int e, i...
#include <bits/stdc++.h> using namespace std; long long a[100001], i, l, r, n, j, c44, c1, c4, c, x, ans, h, y, m, step[101], v, b[100500], d[100500]; string s; int main() { cin >> n; for (i = 1; i <= n; i++) { cin >> a[i]; b[i] = a[i]; } sort(b + 1, b + n + 1); for (i = 1;...
#include <bits/stdc++.h> using namespace std; const int maxn = 5e3 + 5; int readint() { int x = 0, f = 1; char s = getchar(); while (s < 0 || s > 9 ) { if (s == - ) f = -1; (s = getchar()); } while (s >= 0 && s <= 9 ) { x = (x << 3) + (x << 1) + (s ^ 48); (s = ge...