text
stringlengths
59
71.4k
/** * 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<char, char> > V; char R[18][18], S[18][18]; int main(void) { int n, m; cin >> n >> m; bool test1 = (n >= 6 && m >= 3) || (n >= 3 && m >= 6); if (test1 == false) { cout << No solution. << endl; return 0; } for (int i = 0...
#include <bits/stdc++.h> using namespace std; const int N = 1100; template <class nmsl> inline void read(nmsl &x) { x = 0; char ch = getchar(), w = 0; while (!isdigit(ch)) w = (ch == - ), ch = getchar(); while (isdigit(ch)) x = (x << 1) + (x << 3) + (ch ^ 48), ch = getchar(); x = w ? -x : x...
//====================================================================== // // hc.v // ---- // Top level wrapper for the HC stream cipher. // // // Author: Joachim Strombergson // Copyright (c) 2017, Assured AB // All rights reserved. // // Redistribution and use in source and binary forms, with or // without modificat...
#include <bits/stdc++.h> using namespace std; const int maxn = 2010; vector<int> G[maxn]; int n, m, d[maxn], par[maxn], a[maxn], vis[maxn], flag = 1; char s[1005][1005]; int find(int u) { if (par[u] != u) par[u] = find(par[u]); return par[u]; } struct node { int u, w; node(int a, int b) ...
// Copyright (c) 2012-2013 Ludvig Strigeus // This program is GPL Licensed. See COPYING for the full license. module LedDriver(input clk, input [31:0] value, input [7:0] enable, output reg [7:0] SSEG_CA, output reg [7:0] SSEG_AN); reg [2:0] state; ...
/**************************************************************************************** * * File Name: ddr2_mcp.v * * Dependencies: ddr2.v, ddr2_parameters.vh * * Description: Micron SDRAM DDR2 (Double Data Rate 2) multi-chip package model * * Disclaimer This software code and all associated documentation,...
#include <bits/stdc++.h> using namespace std; bool SR(int &_x) { return scanf( %d , &_x) == 1; } bool SR(long long &_x) { return scanf( %lld , &_x) == 1; } bool SR(double &_x) { return scanf( %lf , &_x) == 1; } bool SR(char *_s) { return scanf( %s , _s) == 1; } bool RI() { return true; } template <typenam...
`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; char s1[128]; int l1; char s2[128]; int l2; char virus[128]; int lv; int nxt[128][128]; vector<int> froms[128][128]; void calc_nxt() { char tmp[128]; strcpy(tmp, virus); for (int l = 0; l < lv; l++) { for (char ch = A ; ch <= Z ; ch++...
#include <bits/stdc++.h> using namespace std; int a[3005], b[3005], c[3005], vis[3005]; bool cmp(int i, int j) { return a[i] > a[j]; } int main() { vector<int> p, q; int T, i, j, k, ca = 0, n, m, K; int s, t; scanf( %d%d%d , &n, &s, &t); for (int i = 0; i < n; i++) { scanf( %d , &a[i])...
#include <bits/stdc++.h> using namespace std; long long int a[1000001], has[1000001]; int main() { long long int n, i; cin >> n; for (i = 0; i < n; i++) { cin >> a[i]; has[a[i]] = 1; } long long int c = 0; for (i = 1; i <= n; i++) if (has[i]) c++; cout << n - c; r...
/* * Copyright (c) 2015, Arch Laboratory * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this lis...
/* * Copyright 2018-2022 F4PGA 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in...
`timescale 1 ns/100 ps // Version: 9.0 SP1 9.0.2.9 module pmem_2kB(WD,RD,WEN,REN,WADDR,RADDR,RWCLK,RESET); input [7:0] WD; output [7:0] RD; input WEN, REN; input [10:0] WADDR, RADDR; input RWCLK; input RESET; wire VCC, GND; VCC VCC_1_net(.Y(VCC)); GND GND_1_net(.Y(GND)); RAM4K9 pmem_2kB_R0C0(.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...
/* * Copyright (c) 2015-2018 The Ultiparc Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 09:58:29 05/12/2015 // Design Name: // Module Name: sbox5 // Project Name: // Target Devices: // Tool versions: // Description: // // Dependenc...
// megafunction wizard: %FIFO% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: scfifo // ============================================================ // File Name: fifo_9x256.v // Megafunction Name(s): // scfifo // // Simulation Library Files(s): // altera_mf // ================================...
module KeyExpansionSeq ( key, counter, nextKey ); localparam NR = 10; input [127:0] key; input [3:0] counter; output [127:0] nextKey; wire [31:0] w[3:0]; wire [31:0] wNext[3:0]; wire [31:0] t; wir...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2009 by Wilson Snyder. module t (/*AUTOARG*/ // Inputs clk ); input clk; integer cyc=0; reg [63:0] crc; reg [63:0] sum; // Take CRC data and apply to test...
// RS-232 RX module // (c) fpga4fun.com KNJN LLC - 2003, 2004, 2005, 2006 module SerialRX(clk, RxD, RxD_data_ready, RxD_data, RxD_endofpacket, RxD_idle); input clk, RxD; output RxD_data_ready; // onc clock pulse when RxD_data is valid output [7:0] RxD_data; parameter ClkFrequency = 16000000; // 64MHz parameter Baud ...
(** * 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 ...
#include <bits/stdc++.h> using namespace std; using namespace std::chrono; using ll = long long; using ld = long double; using pt = complex<ld>; constexpr ld EPS = 1e-9; ld cross(pt a, pt b) { return imag(conj(a) * b); } ld cross(pt p, pt a, pt b) { return cross(a - p, b - p); } int orientation(pt a, ...
#include <bits/stdc++.h> const int mod = 1e9 + 7; int n, m; inline long long ksm(register int y, register int p) { long long x = y, now = 1; while (p) { if (p & 1) now = now * x % mod; x = x * x % mod, p >>= 1; } return now; } int main() { scanf( %d%d , &n, &m); printf( %ll...
#include <bits/stdc++.h> using namespace std; int main() { int arr[5][5]; int r, c, cnt = 0; for (int i = 0; i < 5; i++) { for (int j = 0; j < 5; j++) { cin >> arr[i][j]; if (arr[i][j] == 1) { r = i; c = j; } } } if (r != 2) { int tmp...
#include <bits/stdc++.h> using namespace std; using ll = long long; template <typename T> using v = vector<T>; const ll K = 1000; const ll N = 1e5; const ll B = N / K + 1; ll n; ll arr[N + 1]; ll cnt[N + 1]; ll bin[B + 1]; ll greedy(ll k) { fill(begin(cnt), end(cnt), 0); v<ll> dif; l...
// (c) Copyright 1995-2016 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 license and does not grant ...
#include <bits/stdc++.h> using namespace std; const long double eps = 1e-9; const long long INF = 1ll << 61, Mo = 1e9 + 7; int n, m, t, tu, tp, td; int h[400][400]; int s[400][400], x[400][400], z[400][400], y[400][400]; set<pair<int, int> >::iterator ii; inline int time(int h1, int h2) { if (h1 == ...
module General_Purpose_Regs( /*Data*/ input[31:0] d_in, //input data output[31:0] out_a, //register outputs output[31:0] out_b, /*Address*/ input[4:0] addr_a, input[4:0] addr_b, /*Control Lines*/ input[1:0] file_sel, //register file select lines input rw, //rw == 1, then read; rw == 0, write input clk //c...
#include <bits/stdc++.h> using namespace std; const double PI = 3.14159265359; double ans, x, y; int n, zeros, ones; int main() { scanf( %d , &n); for (int i = 0; i < 2 * n; ++i) { scanf( %lf , &y); x -= y - int(y); if (y == int(y)) ++zeros; else ++ones; } ...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 19:12:24 02/26/2015 // Design Name: // Module Name: headerDecode // Project Name: // Target Devices: // Tool versions: // Description: // // De...
#include <bits/stdc++.h> using namespace std; int main() { int t, n, a[100]; cin >> t; while (t--) { cin >> n; for (int i = 0; i < n; i++) { cin >> a[i]; } sort(a, a + n); vector<int> v; int dif = 0; for (int i = 1; i < n; i++) { dif = a[i] - a[i...
#include <bits/stdc++.h> using namespace std; long long int gcd(long long int n1, long long int n2) { if (n2 != 0) return gcd(n2, n1 % n2); else return n1; } long long int power(long long int a, long long int b) { if (b == 0) return 1; if (b == 1) return a; long long int x = powe...
#include <bits/stdc++.h> using namespace std; long long n, z = 1, x, c, zx; map<string, long long> m; string a[1001], s; int main() { while (getline(cin, s)) { a[n++] = s; zx = max(zx, (long long)s.size()); } for (int i = -2; i < zx; i++) cout << * ; cout << n ; for (int 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...
#include <bits/stdc++.h> using namespace std; long long dp[10001]; const long long INF = 1e60 + 7; long long binpow(long long a, long long b) { if (a == 0) { return 0; } if (b == 0) return 1; long long temp = binpow(a, b / 2); if (b & 1) { return temp * temp * a; } else ...
#include <bits/stdc++.h> #pragma comment(linker, /STACK:167772160 ) using namespace std; int n, i, j, a, b, x[100001], y[100001], v, k, uns[100001], p, q, w[6]; int findd(int l, int r, int xx) { int t; t = (l + r) / 2; if (l == r) { if (x[l] == xx) return l; else return ...
/* * 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 t; cin >> t; while (t--) { int n; cin >> n; int f = 1; int s = 0; vector<int> A; for (int i = 0; i < n; i++) { int a; cin >> a; A.push_back(a); } if (A.size() == 1) { ...
#include <bits/stdc++.h> using namespace std; int n, Q; const int md = 998244353; const int maxn = 200010; int t[4 * maxn], tmul[4 * maxn], tadd[4 * maxn]; inline int mod(long long x) { return (x % md + md) % md; } void build(int v, int vl, int vr) { tmul[v] = 1, tadd[v] = 0; if (vl == vr) return;...
#include <bits/stdc++.h> using namespace std; const double E = 1e-10; const int inf = (int)1e9; const int maxn = 1010; int LIM = 60 * 12; int a[maxn]; int b[maxn], bc = 0; int t[maxn]; int main() { int n; scanf( %d , &n); for (int i = 0; i < n; i++) scanf( %d , a + i); sort(a, a + n); ...
#include <bits/stdc++.h> using namespace std; int A[50][50]; int main() { long long int T; cin >> T; while (T--) { int n; cin >> n; for (int i = 0; i < n; i++) { string s; cin >> s; for (int j = 0; j < n; j++) { A[i][j] = s[j] - 0 ; } ...
#include <bits/stdc++.h> using namespace std; template <class T> void debug(T a, T b) { ; } template <class T> void chmin(T& a, const T& b) { if (a > b) a = b; } template <class T> void chmax(T& a, const T& b) { if (a < b) a = b; } namespace std { template <class S, class T> ostrea...
/** * 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 = 200009; const long long MOD = 119 << 23 | 1; class { public: struct N { N(int a, int b, int c, int d) { sta[0] = a; sta[1] = b; sta[2] = c; sta[3] = d; } int sta[4]; }; int f[1 << 18];...
using namespace std; #include <cstdio> #include <cstring> #include <algorithm> #include <ctime> #include <cstdlib> #include <set> #include <map> #define N 1005 #define ll long long ll mul(ll a,ll b,ll mo){ a%=mo,b%=mo; ll c=a*b-(ll)((long double)a*b/mo)*mo; if (c<0) c+=mo; if (c>=mo) c-=...
/** * 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> #define pb push_back using namespace std; typedef long long ll; const int maxn=1e6+100; const int M=1000000007; typedef array<int,41> A; struct hasher { size_t operator()(const A& p) const { size_t result = 0; for (int i=1;i<=40;i++) result = result * 1926...
#include <bits/stdc++.h> #define IOS ios::sync_with_stdio(false), cin.tie(0) #define debug(a) cout << #a : << a << endl using namespace std; typedef long long ll; const int N = 1010; int a[N][N], b[N][N], mov[3], loc[3]; int main(void){ IOS; int T; cin >> T; while (T--){ int...
#include <bits/stdc++.h> using namespace std; struct Dbg { template <typename T> Dbg& operator,(const T& v) { cerr << v << , ; return *this; } } Dbg; template <typename T> ostream& operator<<(ostream& _o_, const vector<T>& _v_) { if (!_v_.empty()) { _o_ << [ ; copy(_...
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; int a, b; int count = 0; for (int a = 0; a <= n + m; a++) for (int b = 0; b <= n + m; b++) { if (a * a + b == n && b * b + a == m) count++; } cout << count; return 0; }
#include <bits/stdc++.h> using namespace std; vector<string> vec_splitter(string s) { s += , ; vector<string> res; while (!s.empty()) { res.push_back(s.substr(0, s.find( , ))); s = s.substr(s.find( , ) + 1); } return res; } void debug_out(vector<string> __attribute__((unused)) a...
#include <bits/stdc++.h> using namespace std; using i64 = long long int; using ii = pair<int, int>; using ii64 = pair<i64, i64>; int main() { int n; scanf( %d , &n); string s; cin >> s; int maxPhone = n / 11; int eight = 0; for (auto& c : s) if (c == 8 ) eight++; printf(...
// -------------------------------------------------------------------- // Copyright (c) 2008 by Terasic Technologies Inc. // -------------------------------------------------------------------- // // Permission: // // Terasic grants permission to use and modify this code for use // in synthesis for all Terasic De...
// Copyright 1986-2014 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2014.3 (lin64) Build Fri Oct 3 16:31:15 MDT 2014 // Date : Sun Oct 25 15:42:23 2015 // Host : arthas-ubuntu running 64-bit Ubuntu 14.04.3...
#include <bits/stdc++.h> int main() { using namespace std; int num, t1, t2, k; cin >> num >> t1 >> t2 >> k; double ms[1000]; double ms2[1000]; for (int i = 0; i < 1000; i++) { ms[i] = 0; ms2[i] = 0; } for (int i = 0; i < num; i++) { int a, b; cin >> a >> b; ...
// hub /* ------------------------------------------------------------------------------- Copyright 2014 Parallax Inc. This file is part of the hardware description for the Propeller 1 Design. The Propeller 1 Design is free software: you can redistribute it and/or modify it under the terms of the GNU Genera...
#include <bits/stdc++.h> using namespace std; const long long Mod = 1000000007LL; const int N = 2e5 + 10; const long long Inf = 2242545357980376863LL; const long long Log = 30; struct node { int lz, mn, cnt; long long sum; node() { lz = 0, mn = 0, cnt = 0, sum = 0; } }; node base; node seg...
#include <bits/stdc++.h> using namespace std; const int max_n = 2000222, inf = 1000111222; int t, n, a[max_n], b[max_n]; long long sum[max_n]; int main() { scanf( %d , &t); while (t--) { scanf( %d , &n); for (int i = 0; i < n; ++i) { scanf( %d , &a[i]); } for (int i = 0...
#include <bits/stdc++.h> using namespace std; int main(int argc, char const *argv[]) { int x1, y1, x2, y2, res = 0; scanf( %d%d%d%d , &x1, &y1, &x2, &y2); int n; scanf( %d , &n); for (int i = 0; i < (int)(n); ++i) { long long a, b, c; scanf( %lld%lld%lld , &a, &b, &c); long lon...
#include <bits/stdc++.h> using namespace std; const int SIZE = 1000005; char sa[SIZE], sb[SIZE]; char rab[SIZE * 2], ba[SIZE * 2]; int f1[SIZE * 2]; int f2[SIZE * 2]; int main() { while (gets(sa) && gets(sb)) { int l1 = strlen(sa); int l2 = strlen(sb); if (l1 != l2) { printf(...
module check (input signed [22:0] a, b, c); wire signed [22:0] int_AB; assign int_AB = a + b; always @(a, b, int_AB, c) begin #1; if (int_AB !== c) begin $display("ERROR"); $finish; end end endmodule module stimulus (output reg signed [22:0] A, B); parameter MAX = 1 << 23; parameter S = 1000...
module top ( input wire clk, input wire rx, output wire tx, input wire [15:0] sw, output wire [15:0] led ); RAM32X1S #( .INIT(32'b00000000_00000000_00000000_00000010) ) ram7 ( .WCLK (clk), .A4 (sw[4]), .A3 (sw[3]), .A2 (sw[2]), ...
// // Copyright 2011 Ettus Research LLC // // 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 dis...
#include <bits/stdc++.h> typedef long long ll; typedef unsigned long long ull; typedef long double ld; using namespace std; const int INF = 1e9 + 5; void failure () { cout << 0 << endl; exit(0); } namespace Lib { #define ran(i, a, b) for (auto i = (a); i < (b); i++) str...
#include <bits/stdc++.h> using namespace std; const int maxN = 2000 * 100 + 10; map<int, int> val; int a[maxN]; int main() { int n; cin >> n; for (int i = 0; i < n; i++) { cin >> a[i]; val[a[i]]++; } sort(a, a + n); n = unique(a, a + n) - a; cout << a[n - 1] - a[0] << ...
/* Copyright (c) 2014 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 la...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); int t; cin >> t; while (t--) { int n; cin >> n; vector<int> a(n); for (int i = 0; i < n; ++i) cin >> a[i]; int m = a[n - 1], ans = 0; for (int i = n -...
// // Copyright (c) 2000 Stephen Williams ( // // This source code is free software; you can redistribute it // and/or modify it in source code form 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) // ...
#include <bits/stdc++.h> using namespace std; const int MAXN = 200050; int n, num[MAXN], pre[MAXN], g[MAXN], ans; int st[MAXN]; map<int, int> f; int main() { int u; ans = -1; st[0] = 0; scanf( %d , &n); for (int i = 1; i <= n; i++) { scanf( %d , &num[i]); if (!f.count(num[i] ...
//////////////////////////////////////////////////////////////////////////////////// // Copyright (c) 2014, University of British Columbia (UBC); All rights reserved. // // // // Redistribution and use in source and binary forms, 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 law...
#include <bits/stdc++.h> using namespace std; const int maxn = 2e5 + 5; int a[maxn]; int t[maxn], l[maxn], r[maxn]; int n, m, ans; void solve(int k) { int tot = 0; if (k == 1) { for (int i = 2; i <= n; i++) if (a[i] < a[i - 1]) tot++; } else { for (int i = 2; i <= n; i++) { ...
//----------------------------------------------------------------------------- // // (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 ...
#include <bits/stdc++.h> using namespace std; struct edge { short to, cap, rev; edge(int _a = 0, int _b = 0, int _c = 0) { to = _a; cap = _b; rev = _c; } }; int S, T; int dist[30010]; int cur[30010]; vector<edge> adj[30010]; int q[30010]; int hd, tl; inline void addedge...
// ============================================================== // File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC // Version: 2015.4 // Copyright (C) 2015 Xilinx Inc. All rights reserved. // // ============================================================== `timescale 1ns/1ps modul...
/** * 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...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2014 by Wilson Snyder. `define checkh(gotv,expv) do if ((gotv) !== (expv)) begin $write("%%Error: %s:%0d: got='h%x exp='h%x\n", `__FILE__,`__LINE__, (gotv), (expv)); $stop; end while...
`timescale 1 ns / 1 ps module window_broadcaster # ( parameter integer C_HBITS = 12, parameter integer C_WBITS = 12, parameter integer C_SBITS = 32, parameter integer C_MASTER_NUM = 1 ) ( input wire [C_WBITS-1 : 0] s_left, input wire [C_WBITS-1 : 0] s_width, input wire [C_HBITS-1 : 0] s_top, input wire [C_HB...
// Copyright 1986-2017 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2017.3 (lin64) Build Wed Oct 4 19:58:07 MDT 2017 // Date : Tue Oct 17 19:50:59 2017 // Host : TacitMonolith running 64-bit Ubuntu 16.04.3...
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 5; int n; long long k; long long a[maxn]; long long b[maxn], c[maxn], d[maxn]; int main() { scanf( %d%lld , &n, &k); for (int i = 1; i <= n; i++) scanf( %lld , a + i); sort(a + 1, a + n + 1); int m = 0; for (int i = 1...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 18:04:20 04/14/2015 // Design Name: // Module Name: toplevel_pl // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencies: /...
#include <bits/stdc++.h> using namespace std; const long long MAXn = 1e5 + 100; const long long INF = 1e9 + 100; long long l, r = -INF, n, k, a[MAXn], p, ans, dp[MAXn], anss; signed main() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cin >> n >> k; cin >> a[1]; for (lo...
#include <bits/stdc++.h> using namespace std; int n, nn[5], ma; string s; long long ans = 1; int main() { cin >> n >> s; for (int i = 0; i < n; i++) { if (s[i] == A ) nn[0]++; if (s[i] == C ) nn[1]++; if (s[i] == G ) nn[2]++; if (s[i] == T ) nn[3]++; } for (int i = ...
`ifdef __ICARUS__ `define SUPPORT_CONST_OUT_OF_RANGE_IN_IVTEST `endif module top(); reg pass = 1'b1; integer fp, i, n; reg [8:0] v; `ifndef SUPPORT_CONST_OUT_OF_RANGE_IN_IVTEST reg [11:-4] w; `endif initial begin fp = $fopen("work/temp.txt", "w"); for (i = 0; i < 4; i = i + 1) begin $fdispl...
#include <bits/stdc++.h> using namespace std; const long double PI = 3.141592653589793238462643383; struct Rcompare { bool operator()(pair<int, int> lhs, pair<int, int> rhs) { return lhs.first > rhs.first; } }; struct compare { bool operator()(pair<int, int> lhs, pair<int, int> rhs) { ...
#include <bits/stdc++.h> #pragma GCC optimize( O3,unroll-loops ) #pragma pack(0) using namespace std; vector<string> v[1000001]; string s; int ptr = 0, maxd = 0; void dfs(int dis) { maxd = max(maxd, dis); int k = 0, f = ptr; for (; ptr < s.length(); ptr++) if (s[ptr] == , ) break; s...
#include <bits/stdc++.h> using namespace std; const uint64_t seed = std::chrono::system_clock::now().time_since_epoch().count(); mt19937_64 rnd(seed); const int MOD = 998244353; struct Dinic { struct Edge { int from, to; long long cap, flow; Edge(int u, int v, long long c) : from(u...
#include <bits/stdc++.h> const int INF = 0x7fffffff; const long long int LNF = 0x7fffffffffffffff; using namespace std; int ac[26], az[26]; char aa[105], bb[105]; int main() { int i, k, nn, kk = 0, len1, len2, s; scanf( %d , &nn); getchar(); while (kk < nn) { gets(aa); gets(bb); ...
#include <bits/stdc++.h> #pragma comment(linker, /stack:16777216 ) using namespace std; const int INF = 1000000000; const int MAX = 1000006; const int MAX2 = 207; const int BASE = 1000000000; const int CNT = 500; const int MOD = 1000000007; vector<int> g[MAX]; int sz[MAX]; double ans[MAX]; void...
// megafunction wizard: %RAM: 2-PORT% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: altsyncram // ============================================================ // File Name: cx4_pgmrom.v // Megafunction Name(s): // altsyncram // // Simulation Library Files(s): // altera_mf // =============================...
/** * 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 modi = 1e9 + 7; unsigned long long gcd(unsigned long long a, unsigned long long b) { return !b ? a : gcd(b, a % b); } int main() { ios::sync_with_stdio(false); int n; cin >> n; for (int i = 0; i < n; i++) { int x; cin >> x; ...
#include <bits/stdc++.h> using namespace std; long long n, i, j, a[4][100001], dp[4][100001]; int main() { cin >> n; for (i = 0; i < 3; i++) for (j = 0; j < n; j++) cin >> a[i][j]; dp[2][n - 1] = a[2][n - 1]; dp[1][n - 1] = dp[2][n - 1] + a[1][n - 1]; dp[0][n - 1] = dp[1][n - 1] + a[0][n...
#include <bits/stdc++.h> #pragma GCC optimize( O3 ) #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native ) #pragma GCC optimize( unroll-loops ) #pragma comment(linker, /stack:200000000 ) using namespace std; const int GRANDOM = std::chrono::high_resolution_clock::now().time_sin...
/** * 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 = 1100; int N, M; int WX, WY, BX, BY; int wdist[MAXN][MAXN]; int wprev[MAXN][MAXN]; int bdist[MAXN][MAXN]; int bprev[MAXN][MAXN]; int xc[8] = {-2, 2, -1, 1, -2, 2, -1, 1}; int yc[8] = {-1, -1, -2, -2, 1, 1, 2, 2}; bool is_white; void a...
#include <bits/stdc++.h> using namespace std; template <class T> inline int cMin(T& a, T b) { return b < a ? a = b, 1 : 0; } template <class T> inline int cMax(T& a, T b) { return a < b ? a = b, 1 : 0; } template <class T> inline string to_str(T v) { ostringstream os; os << v; retu...