text
stringlengths
59
71.4k
// ------------------------------------------------------------- // // File Name: hdl_prj\hdlsrc\controllerPeripheralHdlAdi\Select_AB.v // Created: 2014-09-08 14:12:09 // // Generated by MATLAB 8.2 and HDL Coder 3.3 // // ------------------------------------------------------------- // ----------------------------...
#include <bits/stdc++.h> const int maxn = 400010, maxq = 400010; int n, cnt[maxn], tmp[maxn], lg[maxn]; int min(int a, int b) { return a < b ? a : b; } int max(int a, int b) { return a > b ? a : b; } struct SA { char S[maxn]; int nxt[maxn], mn[maxn], sa[maxn], r[2][maxn], *rk, ht[20][maxn]; void m...
#include <bits/stdc++.h> using namespace std; long long i, j, n, c[223456], d[223456], a[456789], l, r, s, t, tt, k, x, y, z, m, b[1111111]; string p, q, du, qq; vector<long long> u[345678], uu, ui; multiset<long long> mm; int main() { cin >> n >> t; for (i = 0; i < n; i++) { cin >> a[i]...
#include <bits/stdc++.h> const long long MX = 2 * 100 * 1000 + 1000, inf = 3e18, mod = 1000 * 1000 * 1000 + 7; using namespace std; vector<long long> ans[MX]; int32_t main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); string s; cin >> s; long long n = s.size(); ...
#include <bits/stdc++.h> using namespace std; int main() { int a[1001], i, n, sum = 0, max = 0; int b[1001] = {0}; cin >> n; for (i = 0; i < n; i++) cin >> a[i]; for (i = 0; i < n; i++) { b[a[i]]++; } for (i = 0; i < 1001; i++) { if (b[i] > max) max = b[i]; if (b[i]) su...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 22:40:46 12/20/2010 // Design Name: // Module Name: clk_test // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencies: // // Revision:...
/* * 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 bigmod(long long b, long long p, long long n) { if (p == 0) return 1; else if (p % 2 == 0) { long long half1 = bigmod(b, p / 2, n); return ((half1 * half1) % n); } else if (p % 2 == 1) { long long p1 = b % n; long long...
/** * 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...
// This file has been automatically generated by goFB and should not be edited by hand // Compiler written by Hammond Pearce and available at github.com/kiwih/goFB // Verilog support is EXPERIMENTAL ONLY // This file represents the Top of the IEC61499 network module top ( input wire clk, //input events inp...
#include <bits/stdc++.h> using namespace std; int main() { int n, x; vector<pair<int, int>> v; cin >> n; for (int i = 1; i <= n && cin >> x; i++) v.push_back({x, i}); sort(v.begin(), v.end()); cout << v[n - 1].second << << v[n - 2].first; }
/* 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; const long long int MOD = 1e9 + 7; long long int ne; long long int go(long long int idx, long long int pre) { if (idx == ne) return 0; long long int ans = 1e15; if (idx == 0) ans = min(ans, 1 + go(idx + 1, 0)); else { if (idx == 3) { ...
// ------------------------------------------------------------- // // Generated Architecture Declaration for rtl of inst_4_e // // Generated // by: wig // on: Mon Jun 26 08:25:04 2006 // cmd: /cygdrive/h/work/eclipse/MIX/mix_0.pl ../../generic.xls // // !!! Do not edit this file! Autogenerated by MIX !!! // $Auth...
/****************************************************************************** * License Agreement * * * * Copyright (c) 1991-2012 Altera Corporation, San Jose, California, USA. * ...
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; const long long LINF = 0x3f3f3f3f3f3f3f3fLL; const double EPS = 1e-8; const int MOD = 1000000007; const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1}; int main() { cin.tie(0); ios::sync_with_stdio(false); int h, w; ...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; int n, k; long long sum, s[1000005], ans = -(1LL << 62); struct el { long long val; int poz; bool operator<(const el &A) const { return val < A.val; } }; el a[1000005]; int main() { int i, poz; cin.sync_with_stdio(0); cin >> n; for ...
/* * 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) * ...
/** * 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 dis_controller (/*AUTOARG*/ // Outputs dis_controller_start_alloc, dis_controller_alloc_ack, dis_controller_wg_alloc_valid, dis_controller_wg_dealloc_valid, dis_controller_wg_rejected_valid, dis_controller_cu_busy, // Inputs clk, rst, inflight_wg_buffer_alloc_valid, inflight_wg_buffer_alloc_...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; struct PR { int to; int ne; } Prise[200010]; bool compare(PR a, PR b) { return (a.to - a.ne) < (b.to - b.ne); } int main(int argc, char const *argv[]) { int n, k; cin >> n >> k; int i; for (i = 0; i < n; i++) { cin >> Prise[i].to; ...
#pragma GCC optimize( Ofast ) #include<bits/stdc++.h> #define int long long using namespace std; void fileio(const string &s) { freopen((s+ .in ).c_str(), r ,stdin); freopen((s+ .out ).c_str(), w ,stdout); } const int INF=4e18; inline int read() { int x=0; bool flag=1; char c=getchar();...
#include <bits/stdc++.h> using namespace std; const int N = 200005; int a[N]; int main() { int n; scanf( %d , &n); for (int i = 1; i <= n; i++) scanf( %d , &a[i]); sort(a + 1, a + n + 1); int lim = n / 2 - 1, res = 1e9 + 7; for (int i = 0; i <= lim; i++) { res = min(res, a[n - (lim...
#include <bits/stdc++.h> using namespace std; const int maxn = 3e5 + 100; int a[maxn]; long long dp[maxn][2]; int get1(long long n) { int sum = 0; while (n != 0) { if ((n & 1) == 1) sum += 1; n >>= 1; } return sum; } int main() { int N; cin >> N; for (int i = 1; i <...
#include <bits/stdc++.h> using namespace std; long long mo(long long a) { return a % (long long)(1e9 + 7); } long long po(long long x, long long y, long long p) { long long res = 1; x = x % p; while (y > 0) { if (y & 1) res = (res * x) % p; y >>= 1; x = (x * x) % p; } 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 la...
`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 17:38:39 08/19/2014 // Design Name: satadd // Module Name: C:/ece4743/projects/lab2_solution_part1/tb_satadd.v // Project Name: lab2_solution_part1 // Target Device:...
/* * 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> #pragma GCC optimize( Ofast ) #pragma GCC optimize( unroll-loops ) #pragma GCC target( sse2 ) using namespace std; template <typename Arg1> void __f(const char* name, Arg1&& arg1) { cout << name << : << arg1 << n ; } template <typename Arg1, typename... Args> void __...
#include <bits/stdc++.h> using namespace std; int main() { string str[101]; int n; cin >> n; for (int i = 0; i < n; ++i) cin >> str[i]; int maxi = 1; for (int i = 0; i < n - 1; ++i) { int m = 1; for (int j = i + 1; j < n; ++j) { if (str[i] == str[j]) ++m; } ma...
module Execute(p0, p1, pcNext, imm, shamt, aluOp, branchOp, aluSrc0, aluSrc1, regWe, memWe, addz, b, jal, jr, ov_EX_MEM, zr_EX_MEM, ne_EX_MEM, ov_EX, zr_EX, ne_EX, aluResult, branchAddr, branch, regWriteEnable, memoryWriteEnable); input[15:0] p0, p1, pcNext; input[11:0] imm; input [3:0] shamt; input [2:0] aluOp...
#include <bits/stdc++.h> using namespace std; const int MAX = 2e6 + 5; int ends_here[MAX]; int qs, qe; struct data { int child[26]; int score; bool leaf; int suf; int ends; }; data arr[MAX]; int que[MAX]; int cur; struct aho_corasick { int root; int size; void init() ...
`include "config.inc" module video2ram( input clock, input nreset, input [7:0] R, input [7:0] G, input [7:0] B, input [11:0] counterX, input [11:0] counterY, input line_doubler, input is_pal, output [23:0] wrdata, output [`RAM_WIDTH-1:0] wraddr, output wre...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 15:02:11 05/12/2016 // Design Name: // Module Name: fifo // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencies: // // Re...
#include <bits/stdc++.h> using namespace std; long long L[100005]; long long P[100005][40]; long long T[100005]; vector<long long> graph[100005]; long long mx = 0, hh; void dfs(long long src, long long par) { if (src == -1) L[par] = 0; else L[par] = L[src] + 1; if (mx < L[par]) { ...
#include <bits/stdc++.h> using namespace std; string s = What are you doing at the end of the world? Are you busy? Will you save us? ; string s1 = What are you doing while sending ; string s2 = ? Are you busy? Will you send ; string s3 = ? ; const int MAX_N = 1e5 + 10; const long ...
/** * 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 m, n, a[7][7] = {{0, 1, 2}, {1, 0, 2}, {1, 2, 0}, {2, 1, 0}, {2, 0, 1}, {0, 2, 1}, {0, 1, 2}}; int main() { cin >> n >> m; n %= 6; cout << a[n][m]; return 0; }
#include <bits/stdc++.h> using namespace std; const long long N = 105; struct Point { long long x, y; Point() { x = y = 0; } Point(long long _x, long long _y) { x = _x; y = _y; } void input() { cin >> x >> y; } Point operator+(const Point &a) const { return Point(x + a.x, y + 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; pair<int, pair<int, int> > a[200020]; int f[200020]; int v[200020]; int n, m; int F(int x) { if (f[x] == x) { return x; } f[x] = F(f[x]); v[f[x]] |= v[x]; return f[x]; } int main() { scanf( %d%d , &n, &m); for (int i = 1; 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 la...
#include <bits/stdc++.h> using namespace std; const int MX = 400000; long long l[500000], r[500000], k[500000], b[500000], a[500000], pref1[500000], pref2[500000], s = MX; long long f(long long b1, long long a1, long long b2, long long a2) { return (b1 - b2) / (a1 - a2); } void add(long long kx, l...
/* * 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) 1995/2014 Xilinx, 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 // //...
#include <bits/stdc++.h> const int MAXN = 1000 + 10; int n; std::set<int> g[MAXN]; std::vector<std::pair<int, int> > process(bool ty) { std::vector<std::pair<int, int> > ans; for (int i = 2; i < n; i++) { while (!g[1].count(i + 1)) { int k = *std::next(g[1].find(i)); assert(g[i].co...
#include <bits/stdc++.h> using namespace std; int main() { int i = 0, n; bool ok(false); cin >> n; while (i * (i + 1) / 2 <= n && ok == false) { if (i * (i + 1) / 2 == n) { ok = true; } i++; } (ok == true) ? cout << YES : cout << NO ; 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 law...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int a[n]; for (int i = 0; i < n; i++) cin >> a[i]; for (int i = 0; i < n; i++) if (a[i] % 2 == 0) a[i]--; for (int i = 0; i < n; i++) cout << a[i] << ; return 0; }
`include "sdio_defines.v" module sdio_device_phy ( input rst, input i_posedge_stb, //Configuration input i_ddr_en, input i_spi_phy, input i_sd1_phy, input i_sd4_phy, //Data Link Interface output o_cmd_p...
////////////////////////////////////////////////////////////////////// /// //// /// Wishbone arbiter, burst-compatible //// /// //// /// Simple round-robin arbiter for ...
#include <bits/stdc++.h> using namespace std; int a, b, c, d, e; int ar[200100]; int ar1[200100]; int main() { vector<int> arr(200100); string s, s1; cin >> s; cin >> s1; a = min(s.length(), s1.length()); b = a; c = 1; while ((c <= a) && (s[s.length() - c] == s1[s1.length() - c...
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2016.4 (win64) Build Mon Jan 23 19:11:23 MST 2017 // Date : Tue Apr 18 23:15:16 2017 // Host : DESKTOP-I9J3TQJ running 64-bit major re...
#include <bits/stdc++.h> using namespace std; const int oo = (int)1e9; const double PI = 2 * acos(0); const double eps = 1e-9; inline int comp(const double &a, const double &b) { if (fabs(a - b) < eps) return 0; return a > b ? 1 : -1; } int di[] = {1, -1, 0, 0, 1, -1, 1, -1}; int dj[] = {0, 0, 1...
/* * 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; bool isused[26]; string s, t; vector<pair<int, int> > v; int abs(int num) { if (num < 0) return -num; else return num; } int main(void) { cin >> s >> t; int slen = s.size(); for (int i = 0; i < slen; i++) isused[(s[i] - a )] = ...
`timescale 1ns/1ps /*************************************************************************** Name: Date: 7/11/2016 Founction: pwm capture deal Note: ****************************************************************************/ module led_capture( led_input,clk,rst_n,tx_start,tx_data ); input led_input; input clk; i...
#include <bits/stdc++.h> namespace IO { char buf[1000000], *p1, *p2; inline char getc() { if (p1 == p2) p2 = (p1 = buf) + fread(buf, 1, 1000000, stdin); return p1 == p2 ? EOF : *(p1++); } template <typename tp> inline void r(tp &n) { n = 0; char c = getc(); while (!isdigit(c)) c = getc()...
#include <bits/stdc++.h> using namespace std; int n; vector<pair<pair<int, int>, int> > v; signed main() { ios_base::sync_with_stdio(false); cin.tie(0); cin >> n; for (int i = 1; i <= n; i++) { int x, y; cin >> x >> y; v.push_back(pair<pair<int, int>, int>(pair<int, int>(x / 20...
#include <bits/stdc++.h> using namespace std; const int N = 55; int res[N][N][N][N]; int tmp[N][N], dat[N][N]; string s[N]; int n, m, q, a, b, c, d; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n >> m >> q; for (int i = 1; i <= n; i++) { cin >> s[i];...
module fsm_full( clock , // Clock reset , // Active high reset req_0 , // Active high request from agent 0 req_1 , // Active high request from agent 1 req_2 , // Active high request from agent 2 req_3 , // Active high request from agent 3 gnt_0 , // Active high grant to agent 0 gnt_1 , // Active high grant to agent 1 g...
#include <bits/stdc++.h> using namespace std; void solve() { long long i, j, k, l, n, m, a, b, u; cin >> n; vector<long long> v(n); map<long long, long long> mp; long long ans = 0LL; priority_queue<pair<long long, long long>> pq; for (i = 0; i < n; i++) { cin >> v[i]; mp[v[i]...
/* * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law...
// Copyright 1986-2015 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2015.4 (win64) Build Wed Nov 18 09:43:45 MST 2015 // Date : Wed Mar 02 15:28:43 2016 // Host : Dries007Laptop running 64-bit major release...
//------------------------------------------------------------------- //-- tristate1_tb.v //-- Banco de pruebas para la puerta tri-estado //------------------------------------------------------------------- //-- BQ November 2015. Written by Juan Gonzalez (Obijuan) //----------------------------------------------------...
// // Generated by Bluespec Compiler (build 0fccbb13) // // // Ports: // Name I/O size props // RDY_server_reset_request_put O 1 reg // RDY_server_reset_response_get O 1 // read_rs1 O 64 // read_rs1_port2 O 64 // read_rs2 ...
#include <bits/stdc++.h> using namespace std; bool a[2001][2001], w[2001][2001]; int n, fi, fj, si, sj, dist, s, clr = 4; inline bool val(int x, int y) { return (x > 0 && y > 0 && x < n && y < n); } inline void clear(int x, int y) { s = 0; for (int i = 0; i < clr; i++) for (int j = 0; j < clr; j...
#include <bits/stdc++.h> using namespace std; void sol_problem(const long *, long); int main() { long n, t, *matriz; cin >> n >> t; matriz = new long[n - 1]; for (int i = 0; i < n - 1; i++) cin >> matriz[i]; sol_problem(matriz, t); return 0; } void sol_problem(const long *matriz, long ...
module altera_edge_detector #( parameter PULSE_EXT = 0, // 0, 1 = edge detection generate single cycle pulse, >1 = pulse extended for specified clock cycle parameter EDGE_TYPE = 0, // 0 = falling edge, 1 or else = rising edge parameter IGNORE_RST_WHILE_BUSY = 0 // 0 = module internal reset will be default whenever rst...
#include <bits/stdc++.h> #pragma GCC optimize( Ofast , unroll-loops , no-stack-protector ) using namespace std; int32_t main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); long long test = 1; while (test--) { long long x, y; cin >> x >> y; long long n; 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 law...
// ********************************************************************/ // Actel Corporation Proprietary and Confidential // Copyright 2009 Actel Corporation. All rights reserved. // // ANY USE OR REDISTRIBUTION IN PART OR IN WHOLE MUST BE HANDLED IN // ACCORDANCE WITH THE ACTEL LICENSE AGREEMENT AND MUST BE APPROV...
`timescale 1ns / 1ps `default_nettype none ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 01:22:53 06/15/2015 // Design Name: // Module Name: scratch_register // Project Name: // Target Devices: // Tool versions: // Descript...
#include <bits/stdc++.h> using namespace std; int n, m; int price[101], fruit[101]; int main() { cin >> n >> m; for (int i = 0; i < n; i++) cin >> price[i]; map<string, int> fruits; for (int i = 0; i < m; i++) { char x[101]; cin >> x; if (fruits.find(x) != fruits.end()) ...
#include <bits/stdc++.h> using namespace std; int read() { int res = 0, f = 1; char c = getchar(); while (!isdigit(c) && c != - ) c = getchar(); if (c == - ) f = -1, c = getchar(); while (isdigit(c)) res = (res << 3) + (res << 1) + (c ^ 48), c = getchar(); return res * f; } const int m...
#include <bits/stdc++.h> using namespace std; int n, ds[3001], sz[3001], ot[3001], a, b, c, no, ans, sum; vector<pair<int, pair<int, int> > > v; int get(int x) { if (ds[x] == x) return x; else return ds[x] = get(ds[x]); } void merge(int x, int y) { sz[x] += sz[y]; ds[y] = x; ...
#include <bits/stdc++.h> int main(void) { int n; std::cin >> n; std::vector<std::string> a(n); for (int i = 0; i < n; ++i) { std::cin >> a[i]; } std::set<std::string> used; for (int i = n - 1; i >= 0; --i) { if (used.find(a[i]) == used.end()) { used.insert(a[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 la...
//====================================================================== // // sha256_axi4.v // ------------- // Top level wrapper for the SHA-256 hash function providing // an AXI4 Slave interface. // // // Author: Sanjay A Menon // Copyright (c) 2020. // All rights reserved. // // Redistribution and use in source an...
#include <bits/stdc++.h> using namespace std; bool has[200009]; int left[200009]; int main() { int Q; cin >> Q; for (int q = 0; q < Q; q++) { int N; cin >> N; vector<int> v; for (int i = 0; i < N; i++) { int a; cin >> a; v.push_back(a); } s...
// DESCRIPTION: Verilator: Verilog Test module for Issue#1631 // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2019 by Julien Margetts. // SPDX-License-Identifier: CC0-1.0 module t (/*AUTOARG*/ clk ); input clk; localparam N = 4; wire [7:0] cval1[0:N-1]; wire...
// $Revision: #70 $$Date: 2002/10/19 $$Author: wsnyder $ -*- Verilog -*- //==================================================================== module CmpEng (/*AUTOARG*/ // Inputs clk, reset_l ); input clk; input reset_l; // *******...
//----------------------------------------------------------------- // AltOR32 // Alternative Lightweight OpenRisc // V2.1 // Ultra-Embedded.com // Copyright 2011 - 2014 // // Email: // // ...
#include <bits/stdc++.h> using namespace std; template <class T> inline void amin(T &a, const T &b) { if (b < a) a = b; } template <class T> inline void amax(T &a, const T &b) { if (a < b) a = b; } struct Data { int sx, sy; int le, ri, to, bo; bool operator<(const Data &y) const { re...
/*------------------------------------------------------------------------------ * This code was generated by Spiral Multiplier Block Generator, www.spiral.net * Copyright (c) 2006, Carnegie Mellon University * All rights reserved. * The code is distributed under a BSD style license * (see http://www.opensource.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 law...
/* RC4 PRGA Testbench Copyright Groundworks Technologies 2012-2013 Author: Alfredo Ortega This library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, eith...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); long long int n, x, ans = 0, i; cin >> n; for (i = 0; i < n; i++) { cin >> x; ans += (i + 1) * x; } ans -= (((n - 1) * (n)) / 2); cout << ans << n ; }
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 10; int n; int L; int R; struct data { int u; int f; int dis; int dep; }; queue<data> q1, q2; struct ed { int v; int val; int siz; int ori; friend bool operator<(ed a, ed b) { return a.siz < b.siz; } ...
#include <bits/stdc++.h> using namespace std; const int INF = 2147483647; const double PI = 3.141592653589793; int n, k, l, a[105], used[105], suma, i, j, q, b; double maxx, minn; vector<int> wek; int main() { scanf( %d %d , &n, &k); l = n / k; for (i = 0; i < n; i++) { scanf( %d , &a[i]...
#include <bits/stdc++.h> using namespace std; void __print(int x) { cout << x; } void __print(long x) { cout << x; } void __print(long long x) { cout << x; } void __print(unsigned x) { cout << x; } void __print(unsigned long x) { cout << x; } void __print(unsigned long long x) { cout << x; } void __prin...
#include <bits/stdc++.h> using namespace std; const int maxN = 1e4; long long F[maxN + 1]; void fact() { F[0] = F[1] = 1; for (int i = 2; i <= maxN; i++) F[i] = (1LL * F[i - 1] * i) % 998244353; } long long power(long long a, long long b) { long long res = 1; while (b) { if (b & 1) { ...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); long long n, m, l = 0, p = 0, i, flag = 0, k, j, r = 0, q = 0, t, curr = 0, d, x; cin >> n >> x >> k; long long a[n]; for (long long i = 0; i < n; i++) { ...
module wb_ram #(//Wishbone parameters parameter dw = 32, //Memory parameters parameter depth = 256, parameter aw = $clog2(depth), parameter memfile = "") (input wb_clk_i, input wb_rst_i, input [aw-1:0] wb_adr_i, input [dw-1:0] wb_dat_i, input [3:0] wb_...
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 10; int mod = 1e9 + 7; int a, b, c, d, n, m, x, y, z; vector<int> v; int arr[3]; int main() { cin >> a >> b >> c; for (int i = 0; i <= a; i++) { x = c - i; y = b - (a - i); if (x >= 0 && y >= 0 && x == y) { ...
#include <bits/stdc++.h> using namespace std; const int N = 1e6; int n, k, a, b; vector<int> v; int ret(int lt, int rt) { int id2 = upper_bound(v.begin(), v.end(), rt) - v.begin(); int id1 = lower_bound(v.begin(), v.end(), lt) - v.begin(); return id2 - id1; } long long dfs(int lt, int rt) { ...
/* 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,...
#include <bits/stdc++.h> using namespace std; bool f = 0; const double eps = 1e-8; int n; struct point { double x, y; } p[100010]; inline int rd() { int x = 0; bool f = 0; char c = getchar(); while (!isdigit(c)) { if (c == - ) f = 1; c = getchar(); } while (isdigit...