text
stringlengths
59
71.4k
#include <bits/stdc++.h> const int M = 1 << 20, L = 100020; char s[L]; int n, m, g[M], f[M], i, j, k, x, y, D; void init() { scanf( %d%d%s , &n, &m, s + 1); D = (1 << m) - 1; for (i = 1; i < n; i++) { x = s[i] - 97; y = s[i + 1] - 97; if (x != y) g[1 << x | 1 << y]++; } for...
// Filename: keypressed.v // Author: Tom Martin, Jason Thweatt // Date: 10/24/2013 // Version: 2 // Description: This FSM generates an enable pulse that lasts for one clock period each time KEY1 is pressed and // released. // Updated on 18 March 2014 by J.S. Thweatt: Commented to descri...
#include <bits/stdc++.h> using namespace std; const int maxint = -1u >> 1; template <class T> bool get_max(T& a, const T& b) { return b > a ? a = b, 1 : 0; } template <class T> bool get_min(T& a, const T& b) { return b < a ? a = b, 1 : 0; } int k; int num[26]; string s; int main() { ...
#include <bits/stdc++.h> const int mx = 110; int a[mx]; bool ok(char ch) { if (ch == a || ch == e || ch == i || ch == o || ch == u || ch == y ) return true; return false; } int main() { int n; bool flag = 1; scanf( %d , &n); for (int i = 0; i < n; i++) scanf( %...
// mbt 11/26/2014 // // bsg_murn_converter // // // converts between bsg_comm_link interface to fsb nodes // and murn interface to fsb nodes // // // note: generally speaking, murn switch interfaces // are valid->retry (e.g switch->switch, switch->block. // However the path from block to switch // is retry->valid. // ...
#include <bits/stdc++.h> intmax_t f(intmax_t x) { intmax_t res = 0; intmax_t tenpow = 10; while (x / tenpow > 0) { res += x / tenpow * 9; tenpow *= 10; } return res; } int testcase_ends() { intmax_t n, s; scanf( %jd %jd , &n, &s); if (n == 0 && s == 0) return 1; int...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int T; cin >> T; while (T--) { int n; cin >> n; vector<int> arr(n); vector<pair<int, int>> vpr(n); for (long long i = 0; i <= n - 1; i++) { cin >> arr...
#include <bits/stdc++.h> using namespace std; int m, n, j, k, l, i, o, p, __t; int V[200][2000], tim[200][2000], T[200], cop[200][2000]; char ch; void read(int &a) { for (ch = getchar(); (ch < 0 || ch > 9 ) && (ch != - ); ch = getchar()) ; if (ch == - ) a = 0, __t = -1; 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; vector<pair<long long, long long> > a; vector<long long> bus; long long n, t, z; int main() { cin >> n >> t; for (int i = 0; i < n; i++) { cin >> z; t -= z; } if (t > n - 1 || t < n - 1) { cout << NO ; } else cout << Y...
#include <bits/stdc++.h> using namespace std; int main() { long long n, t; cin >> n; t = 2 * n; long long a[t], I; for (I = 0; I < t; I++) cin >> a[I]; sort(a, a + t); long long ans = (a[0] - a[n - 1]) * (a[n] - a[2 * n - 1]); for (I = 1; I < n; I++) ans = min(ans, (a[I] - a[I ...
#include <bits/stdc++.h> using namespace std; const int MOD = 1000000007; long long POW(long long a, long long b, long long MMM = MOD) { long long ret = 1; for (; b; b >>= 1, a = (a * a) % MMM) if (b & 1) ret = (ret * a) % MMM; return ret; } long long gcd(long long a, long long b) { return b...
#include<iostream> #include<cstdio> #include<cstring> #include<cmath> #include<algorithm> #include<vector> #include<stack> #include<queue> #include<set> #include<map> //#include<bits/stdc++.h> using namespace std; typedef long long ll; const int maxn = 1e5+5; const int inf = 0x3f3f3f3f; co...
#include <bits/stdc++.h> using namespace std; const unsigned long long INF = ~0ll; unsigned long long prime[16] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53}; int n; unsigned long long ans; void dfs(int deepth, unsigned long long v, unsigned long long n...
#include <bits/stdc++.h> using namespace std; const int mod = 1e9 + 7; const int maxn = 55; long long f[maxn][maxn][maxn][maxn]; long long pw[maxn]; int c[maxn]; void init() { f[0][0][0][0] = 1; pw[0] = 1; for (int i = 1; i < maxn; i++) pw[i] = (pw[i - 1] * 2ll) % mod; } long long cal(int ...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using uint = unsigned int; using ull = unsigned long long; using pii = pair<int, int>; int f[50], s[50], p[50]; ld dp[51][5000]; int main() { cin.tie(nullptr); cout.tie(nullptr); ios_base::sync_with...
// *************************************************************************** // *************************************************************************** // 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; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long n, i, j, k, l, m, b, t, sum, sum1, flag, max1, min1, tmp; cin >> n; long long a[n + 1]; vector<long long> v; queue<long long> q; for (i = 1; i <= n; i++) { cin ...
/** * 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> #pragma GCC optimize( Ofast,inline,unroll-loops,fast-math ) using namespace std; const bool d[3][2][2] = { { {false, true}, {true, false}, }, { {true, false}, {true, true}, }, { {true, true}, {false,...
//----------------------------------------------------------------------------- // // (c) Copyright 2010-2011 Xilinx, Inc. All rights reserved. // // This file contains confidential and proprietary information // of Xilinx, Inc. and is protected under U.S. and // international copyright and other intellectual property ...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
/* * Copyright 2015 Forest Crossman * * 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 ...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int t; cin >> t; for (int z = 0; z < t; z++) { int n, x, y; cin >> n; vector<vector<int>> v; for (int i = 0; i < n; i++) { cin >> x >> y; vector<int...
#include <bits/stdc++.h> using namespace std; int n, m; int main() { scanf( %d%d , &n, &m); if (n > m) swap(n, m); int ans; if (n == 1) ans = m; else if (n == 2) { if (m % 4 <= 2) ans = m + m % 4; else ans = m + 1; } else ans = (n * m + 1) / 2; p...
// $Id: c_fifo.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 of so...
// wasca_mm_interconnect_0_avalon_st_adapter.v // This file was auto-generated from altera_avalon_st_adapter_hw.tcl. If you edit it your changes // will probably be lost. // // Generated using ACDS version 15.0 145 `timescale 1 ps / 1 ps module wasca_mm_interconnect_0_avalon_st_adapter #( parameter inBitsPerSymbo...
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; const long long LINF = 0x3f3f3f3f3f3f3f3fll; const long double pi = acos(-1); const int MOD = 1e9 + 7; const int N = 2e5 + 100; int tr_min[4 * N][1 << 5]; int tr_max[4 * N][1 << 5]; vector<int> cara[N]; int n, k; void build(...
// DESCRIPTION: Verilator: System Verilog test of enumerated type methods // // This code exercises the various enumeration methods // // This file ONLY is placed into the Public Domain, for any use, without // warranty. // SPDX-License-Identifier: CC0-1.0 // Contributed 2012 by M W Lund, Atmel Corporation and Jeremy ...
/** * 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...
// ------------------------------------------------------------- // // File Name: hdl_prj\hdlsrc\controllerPeripheralHdlAdi\controllerHdl\controllerHdl_Reset_Delay.v // Created: 2014-09-08 14:12:04 // // Generated by MATLAB 8.2 and HDL Coder 3.3 // // ------------------------------------------------------------- /...
#include <bits/stdc++.h> using namespace std; int n, m, a; int tab[105]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> n >> m; for (int i = 1; i <= m; i++) { cin >> a; tab[a]--; } sort(tab + 1, tab + 1 + 100); {} for (int wynik = 1; wynik <= 101; wynik...
#include <bits/stdc++.h> using namespace std; const int N = 1002; int n, m, k; long long fact(int x) { if (x < 0) return 0; long long ret = 1; for (int i = 1; i <= x; i++) ret = ret * i % 1000000007; return ret; } long long power(int b, int p) { if (!p) return 1; long long ret = powe...
/** * 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...
// File: DEMUX1_4_B_TBV.v // Generated by MyHDL 0.10 // Date: Sun Sep 23 18:24:26 2018 `timescale 1ns/10ps module DEMUX1_4_B_TBV ( ); // myHDL -> testbench for module `DEMUX1_4_B` reg x = 0; reg y0 = 0; reg y1 = 0; reg s0 = 0; reg s1 = 0; reg y2 = 0; reg y3 = 0; wire [17:0] xTV; wire [17:0] s0TV; wire [17:0] s1TV...
#include <bits/stdc++.h> using namespace std; int main() { int c, d, n, m, k, needed; cin >> c >> d >> n >> m >> k; needed = n * m - k; cout << ((needed <= 0) ? 0 : min(needed * d, min(needed / n * c + needed % n * d, (int)(cei...
#include <bits/stdc++.h> using namespace std; int a[400006]; vector<int> dis; int main() { int i, j, m, n, c, x, l, y, t, bytes; cin >> n >> bytes; for (i = 0; i < n; i++) cin >> a[i]; sort(a, a + n); int total = 1; for (i = 1; i < n; i++) { while (i < n && a[i] == a[i - 1]) { ...
#include <bits/stdc++.h> using namespace std; const double eps = 0.5; const double pi = acos(-1.0); const long long INF = 2e18; const int maxn = 100005; int main() { int t; scanf( %d , &t); while (t--) { int n; scanf( %d , &n); n = n + n; double ans = cos(pi / (2.0 * 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; template <class T> T sqr(T x) { return x * x; } template <class T> T distsqr(T x, T y, T a, T b) { return sqr(x - a) + sqr(y - b); } double cosine_angle(double a, double b, double c) { return (double)(sqr(a) + sqr(b) - sqr(c)) / ((double)2.0 * a ...
#include <bits/stdc++.h> using namespace std; void solve() { int n; cin >> n; map<int,int> m; for(int i=0,x; i < n; ++i) { cin >> x; m[x]++; } map<int,int> m2; for(auto p : m) { m2[p.second]++; } int cnt,mn=n; for(auto p1 : m2) {...
//IS61WV102416BLL-10 Simulation Model // `define OEb `timescale 1ns/10ps module is61wv102416bll (A, IO, CE_, OE_, WE_, LB_, UB_); parameter SPEED_RANK = 10; /* generate if(SPEED_RANK == 8)begin localparam dqbits = 16; localparam memdepth = ; //1M bit localparam addbits = 20; localparam Taa = 8; local...
// -*- verilog -*- // // USRP - Universal Software Radio Peripheral // // Copyright (C) 2005,2006 Matt Ettus // // 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 Li...
// megafunction wizard: %ALTFP_ADD_SUB%VBB% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: altfp_add_sub // ============================================================ // File Name: altfp_add_sub0.v // Megafunction Name(s): // altfp_add_sub // // Simulation Library Files(s): // lpm // ===================...
////////////////////////////////////////////////////////////////////// //// //// //// OR1200's DC RAMs //// //// //// //// This file is part of the Open...
`timescale 1ns / 1ps /* Copyright 2015, Google Inc. 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 l...
#include <bits/stdc++.h> using namespace std; const int mod = 1e9 + 7; int n; char s[5001]; int dp[5001][5001]; int main() { scanf( %d , &n); for (int i = 1; i <= n; ++i) { scanf( n%c , &s[i]); } dp[1][0] = 1; for (int j = 1; j <= n; ++j) { dp[1][j] = 0; } for (int 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; vector<vector<int> > init(int n, int v) { vector<vector<int> > ret; for (int i = 0; i < (n); ++i) { vector<int> l; l.resize(n); for (int j = 0; j < (n); ++j) l[j] = v; ret.push_back(l); } return ret; } void dump(const vector<v...
#include <bits/stdc++.h> using namespace std; vector<int> v[26]; int A[26], m; void solve() { string s; cin >> s; for (int i = 0; i < s.length(); i++) v[s[i] - a ].push_back(i); for (int i = 0; i < 26; i++) { if (s.find(i + a ) != string::npos) { m = v[i][0] + 1; for (int...
#include <bits/stdc++.h> using namespace std; const int N = 1010; int d[N]; int a[N][N], b[N][N], c[N][N], row[N], col[N]; int main() { int n, m; scanf( %d%d , &n, &m); for (int i = 1; i <= n; i++) { for (int j = 1; j <= m; j++) { scanf( %d , &a[i][j]); } } for (int i =...
#include <bits/stdc++.h> using namespace std; void fastio() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); } const long long int N = 100010; long long int cnt[N], f[N]; int main() { fastio(); long long int n, temp; cin >> n; long long int ar[n]; memset(cnt, 0, s...
/** * 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 = 1e6 + 1; const int Mod = 1e9 + 7; const long long int MOD = 1000000007LL; const long long int MAX = 100010LL; template <typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); } template <typename T> T power(T x...
#include <bits/stdc++.h> using namespace std; vector<long long> v; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); ; long long t, n, x; cin >> t; while (t--) { cin >> n; long long m[n + 5]; bool flag[n + 5]; memset(m, 0, sizeof(m)); memset(f...
#include <bits/stdc++.h> using namespace std; const int SZ = 1e6 + 10; const int INF = 1e9 + 10; const int mod = 998244353; const long double eps = 1e-8; long long read() { long long n = 0; char a = getchar(); bool flag = 0; while (a > 9 || a < 0 ) { if (a == - ) flag = 1; a ...
#include <bits/stdc++.h> using namespace std; long long powmod(long long a, long long b) { long long res = 1; while (b > 0) { if (b & 1) res = res * a % 2; a = a * a % 2; b >>= 1; } return res; } int main() { ios_base::sync_with_stdio(false); long long b, k, sum = 0; ...
#include <bits/stdc++.h> #pragma GCC optimize( O3 ) #pragma GCC target( sse4 ) using namespace std; template <class T> T gcd(T a, T b) { return ((b == 0) ? a : gcd(b, a % b)); } int main() { ios_base::sync_with_stdio(false); cin.tie(0); int n, q; cin >> n >> q; vector<int> a(n); ...
/******************************************************* * File Name : hdl/ks8.v * Module Name : Karatsuba Multiplier * Author : Chester Rebeiro * Institute : Indian Institute of Technology, Madras * Creation Time : * Comment : Automatically generated from ks.c **********************************...
#include <bits/stdc++.h> using namespace std; int main() { cout << INTERCAL ; return 0; }
module serial_wb_parport( /*AUTOARG*/ // Outputs parport_o, data_o, parport_readstrobe_o,parport_writestrobe_o, // Inputs clk_i, rst_i, parport_i, writestrobe_i, readstrobe_i,data_i, address_i ); output [31:0] parport_o; output [7:0] data_o; input clk_i; input ...
/** \file "shoelace.v" Chain a bunch of inverters between VPI/VCS and prsim, shoelacing. $Id: shoelace.v,v 1.3 2010/04/06 00:08:37 fang Exp $ Thanks to Ilya Ganusov for contributing this test. */ `timescale 1ns/1ps `define inv_delay 0.010 `include "clkgen.v" /* the humble inverter */ module inverter (in, out);...
// Put your file header here // module stimulus; parameter period = 20; parameter delay = 2; // declare the signals here reg clk, rst_n, push, pop; reg [7:0] datain; wire empty, almost_empty, full, almost_full, error; wire [7:0] dataout; fifo fifo1 ( clk, rst_n, push, pop, datain, ...
/** * 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 / 1ps //////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 22:49:07 03/26/2015 // Design Name: lifo_top // Module Name: D:/Modelsim Projects/Xilinx/assignment5/lifo_top_tb.v // Project Name: assignment5 // Target Device: /...
`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 21:28:27 04/12/2016 // Design Name: MAIN // Module Name: Y:/TEOCOA/EXPR4_ALU_REGISTERS/TEST.v // Project Name: EXPR4_ALU_REGISTERS // Target Device: // ...
#include <bits/stdc++.h> using namespace std; const int N = 1000005; int n, a[N], b[N], lst[N], pre[N], suf[N], pr[N], sf[N], cn[N], sta[N], top, ans; long long s[N][4], tag[N][4]; inline long long S2(const int x) { return (x + 1ll) * x >> 1; } inline long long S(const int l, const int r) { return S2(...
/*************************************************************************************************** ** fpga_nes/hw/src/cmn/block_ram/block_ram.v * * Copyright (c) 2012, Brian Bennett * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are permitted * provided...
#include <bits/stdc++.h> using namespace std; void solve(){ int n;cin>>n; if(n <= 45){ int point = 9; string ans = ; int x = n; while(x > point){ ans += to_string(point); x -= point; point--; } if(x) ans += to_string(x); reverse(ans.begin(),ans.e...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int x = 0, y = 0, z = 0, a, b, c; for (int i = 0; i < n; i++) { cin >> a >> b >> c; x += a; y += b; z += c; } if (x == 0 and y == 0 and z == 0) cout << YES << endl; else cout...
/* * 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> int main() { char s1[3000][11], s2[3000][10], s3[3000][11]; int m, n, i, j, k; int len1, len2; scanf( %d %d , &m, &n); for (i = 0; i < n; i++) { scanf( %s , &s1[i]); gets(s2[i]); } for (i = 0; i < m - 1; i++) { scanf( %s , &s3[i]); } get...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); int a, b, i, cnt, x; cin >> a >> b; if (a < b) { cout << 0 n ; return 0; } if (a == b) { cout << infinity n ; return 0; } a = a - b; cnt = 0; for (i = 1; i <= sq...
// // Copyright (c) 1999 Steven Wilson () // // 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) // ...
/** * 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> T __sqr(const T x) { return x * x; } template <class T, class X> inline T __pow(T a, X y) { T z = 1; for (int i = 1; i <= y; i++) { z *= a; } return z; } template <class T> inline T gcd(T a, T b) { a = abs(a...
#include <bits/stdc++.h> using namespace std; const long long MOD = 1e9 + 7; const double err = 1e-12; const double PI = 3.141592653589793; const int N = 1e5 + 5; int n; vector<int> res; void solve() { cin >> n; if (n & 1) { cout << 1 << ; n--; for (int i = 2; i <= n; i += 2...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed under the Creative Commons Public Domain, for // any use, without warranty, 2004 by Wilson Snyder. // SPDX-License-Identifier: CC0-1.0 module t (/*AUTOARG*/ // Inputs clk ); input clk; integer cyc; initial cyc=1; reg [63:...
#include <bits/stdc++.h> using namespace std; int main() { int n; scanf( %d , &n); vector<pair<int, int>> a(n); vector<int> diff(n), dp(n + 1), take(n + 1); for (int i = 0; i < n; i++) scanf( %d , &a[i].first), a[i].second = i; sort(a.begin(), a.end()); if (n < 6) { cout << a[n - 1...
#include <bits/stdc++.h> using namespace std; template <typename T, typename U> std::pair<T, U> operator+(const std::pair<T, U>& l, const std::pair<T, U>& r) { return {l.first + r.first, l.second + r.second}; } typedef void (*callback_function)(void); const long long ZERO = 0LL; const long long INF64 ...
#include <bits/stdc++.h> using namespace std; char str[110]; void in(long long &x, long long &y) { scanf( %s , str); int len = strlen(str); int at; for (int i = 0; i < len; i++) if (str[i] == / ) at = i; x = 0; for (int i = 0; i < at; i++) x = x * 10 + (str[i] - 0 ); y = 0; ...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0), cout.tie(0); cout << fixed << setprecision(15); int N, M, S, K; cin >> N >> M >> S >> K; vector<int> type(N); for (int i = 0; i < N; i++) { cin >> type[i]; --type[i]; ...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 15:38:41 03/01/2016 // Design Name: // Module Name: Registro_universal // Project Name: // Target Devices: // Tool versions: // Description: // // Dependenc...
#include <bits/stdc++.h> using namespace std; long long fac[3000060]; void pre() { fac[0] = 1; for (int i = 1; i < 3000060; i++) fac[i] = fac[i - 1] * i % 1000000007; } long long powermod(long long x, long long y, long long p) { long long res = 1; x = x % p; if (x == 0) return 0; while...
#include <bits/stdc++.h> using namespace std; int n, m, p, q1, q2, t, a[300010], y[300010], w, u; long long x[300010]; map<long long, int> f, g; vector<int> r[300010]; inline bool cmp(int a, int b) { return x[a] < x[b]; } inline int power(int a, int b, int q) { if (!b) return 1; int c = power(a, b...
`timescale 1ns / 1ns module udp_rx (input c, input [7:0] eth_d, input eth_dv, input eth_stop, output [7:0] udp_d, output udp_dv, output udp_last, // only signaled for valid UDP packets output [15:0] udp_port ); localparam SW = 3, CW = 1; localparam ST_IDLE = 3'd0; localparam ST_ETH_HEADER = 3'd1; localp...
// Copyright (c) 2000-2012 Bluespec, Inc. // 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, pub...
/** * 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 Stephan Boettcher <> * * 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 N = 2005; const int M = 101; const double EPS = 1e-9; const int INF = 1e9; 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); } double getDist(complex<d...
// ============================================================== // File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC // Version: 2017.4 // Copyright (C) 1986-2017 Xilinx, Inc. All Rights Reserved. // // ============================================================== `timescale 1ns/1ps m...
#include <bits/stdc++.h> using namespace std; #pragma comment(linker, /stack:200000000 ) #pragma GCC optimize( Ofast ) #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native ) long long arr[100010], dpArr[100010], dpQuery[100010]; int main() { ios::sync_with_stdio(false); cin.t...
#include <bits/stdc++.h> using namespace std; int main() { int n, m, b[100] = {0}, g[100] = {0}, t, k, c = 0; cin >> n >> m; cin >> t; while (t--) { cin >> k; b[k] += 1; c += 1; } cin >> k; while (k--) { cin >> t; g[t] += 1; c += 1; } for (int ...
#include <bits/stdc++.h> using namespace std; const int64_t MAXN = 1000005; const int64_t MAXINT = 2147483098; const int64_t MAXLL = 9223372036854775258LL; const int64_t MOD = 1e9 + 7; void solve() { int64_t n; cin >> n; vector<int64_t> a(n + 2); for (int64_t i = 1; i < n + 1; ++i) cin >> a[...
// (C) 2001-2018 Intel Corporation. All rights reserved. // Your use of Intel 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 ...
#include <bits/stdc++.h> using namespace std; const int MX = 300005; int n, c[MX]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> n; for (int i = 0; i < n; i++) cin >> c[i]; int res = 0, i = n - 1; while (c[0] == c[i]) i--; res = i; i = 0; while (c[i] == c[n - ...
#include <bits/stdc++.h> using namespace std; bool v[5050]; int main() { ios::sync_with_stdio(0); int n; cin >> n; int x[n]; set<int> st; int r = 0; for (int i = 0; i < n; i++) { cin >> x[i]; if (x[i] > n) r++; else { st.insert(x[i]); } } ...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed under the Creative Commons Public Domain, for // any use, without warranty, 2021 by Udi Finkelstein. // SPDX-License-Identifier: CC0-1.0 /* verilator lint_off MULTITOP */ // First, test we haven't broken normal ports module t1(); endmodule ...
// ========== Copyright Header Begin ========================================== // // OpenSPARC T1 Processor File: sctag_retdp.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/o...
#include <bits/stdc++.h> using namespace std; int main() { long long n; cin >> n; long long a[n], b[n + 1]; vector<pair<int, int>> c; for (int i = 0; i < n; i++) cin >> a[i]; unordered_map<long long, long long> mp, mp1; vector<vector<int>> v; v.assign(n + 1, vector<int>()); for (...