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...
/* * Milkymist SoC * Copyright (C) 2007, 2008, 2009, 2010, 2011 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 dis...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); string s; cin >> s; bool f = 0; long last = -1, c = 0; long ans = 0; for (register int i = 0; i < s.length(); i++) { if (s[i] == F ) { if (last == -1) { last = i; ...
// Copyright (c) 2003 Michael Ruff (mruff at chiaro.com) // // 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 yo...
#include <bits/stdc++.h> using namespace std; const int maxm = 3e6 + 7; const int maxn = 2e5 + 7; const int inf = 0x3f3f3f3f; const long long INF = 0x3f3f3f3f3f3f3f3f; deque<int> q; int n, ans = 0; bool judge[maxn]; int num[maxn], sum[maxn]; int main() { ios::sync_with_stdio(false); cin.tie(...
/** * 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 long double gr = (1 + sqrt(5)) / 2; long long n, k, c, res[107], mres; string s; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n >> k >> s; c = 1; for (int i = 0; i < n; i++) { if (i > 0) { if (s[...
#include <bits/stdc++.h> using namespace std; int main() { unsigned long long int counter = 0, a, b, t; cin >> a >> b; while (true) { if (b > a) { t = a; a = b; b = t; } counter = counter + (a / b); a = (a % b); if (a == 0) break; } cout << c...
#include <bits/stdc++.h> using namespace std; int dp[1005]; long long ncr[1005][1005]; int ones(int n); void calc_ncr(); int main() { string n; int k; cin >> n; cin >> k; calc_ncr(); dp[1] = 0; for (int i(2); i < (1001); i++) { dp[i] = dp[ones(i)] + 1; } long long r...
#include <bits/stdc++.h> using namespace std; long long a[1000000]; int main() { long long n, s; cin >> n >> s; for (long long i = 0; i < n; i++) { long long k, m; cin >> k >> m; a[k] = max(a[k], m); } long long ans = 0, last = s; for (long long i = s; i > 0; i--) { ...
// Taken from: // http://www.asic-world.com/code/hdl_models/arbiter.v //---------------------------------------------------- // A four level, round-robin arbiter. This was // orginally coded by WD Peterson in VHDL. //---------------------------------------------------- module arbiter ( clk, rst, req3, ...
/* * 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...
`timescale 1ns / 1ps /******************************************************************************* * Engineer: Robin zhang * Create Date: 2016.09.10 * Module Name: spi_slave *******************************************************************************/ module spi_slave_0_base( clk,sck,mosi,miso,ssel,rst_n,reciv...
`timescale 1ns / 1ps module ShiftRegisterI2C_tb; reg WriteLoad; reg [7:0] SentData; reg ShiftIn, ShiftorHold; reg Reset, CLOCK; wire [7:0] ReceivedData; wire ShiftOut; ShiftRegisterI2C2015fall uut (SentData,CLOCK,Reset,ShiftIn,ShiftorHold,WriteLoad,ReceivedData,ShiftOut,CLOCK); initial begin WriteLoad = 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> #pragma GCC optimize(2) using namespace std; const int N = 100010; char s[N]; int n, k; int main() { ios::sync_with_stdio(false); cin.tie(); cout.tie(0); int T = 1; cin >> T; while (T--) { cin >> n >> k; cin >> s + 1; priority_queue<int, vec...
#include <bits/stdc++.h> using namespace std; void sol() { long long int n, x; cin >> n >> x; if (n <= 2) cout << 1 n ; else { n = n - 2; long long int ans = 1; long long int z = n / x; if (n - z * x > 0) z++; ans += z; cout << ans << n ; } } int ...
/** * 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 2011(c) Analog Devices, Inc. // // All rights reserved. // // Redistribution and use in source and binary forms, with or without modification, // a...
//Copyright 1986-2014 Xilinx, Inc. All Rights Reserved. //-------------------------------------------------------------------------------- //Tool Version: Vivado v.2014.4 (lin64) Build Tue Nov 18 16:47:07 MST 2014 //Date : Sat Mar 12 20:35:14 2016 //Host : ubuntu-desktop running 64-bit Ubuntu 14.04.4 LTS...
#include <bits/stdc++.h> using namespace std; int main() { long long a1, a2, a3, a4; cin >> a1 >> a2 >> a3 >> a4; long long total = 0; long long minn = min(a1, a3); minn = min(minn, a4); total += 256 * minn; a1 -= minn; minn = min(a1, a2); total += 32 * minn; cout << total <<...
///////////////////////////////////////////////////////////////////// //// //// //// pfpu32_f2i //// //// 32-bit floating point to integer converter //// //// ...
`define MAX_SECTOR_COUNT 24'h10000 //`define MAX_SECTOR_COUNT 24'h00040 module sata_dma_interface ( input clk, input rst, input enable, //SATA Controller Interface output reg [7:0] sata_command, output reg sata_execute_command_stb, //Execute Command ...
// ============================================================== // File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC // Version: 2015.2 // Copyright (C) 2015 Xilinx Inc. All rights reserved. // // ============================================================== `timescale 1 ns / 1 ps mod...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; const int N = 5005; const int inf = 0x3f3f3f3f; int n, a[N], ma[N][N]; int main() { scanf( %d , &n); for (int i = 1; i <= n; i++) scanf( %d , &a[i]); int cnt = 0; for (int i = 1; i <= n; i++) for (int j = i + 1; j <= n; j++) if (a[i] ...
// Copyright 1986-2014 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2014.1 (lin64) Build 881834 Fri Apr 4 14:00:25 MDT 2014 // Date : Mon May 26 11:10:35 2014 // Host : macbook running 64-bit Arch Linux // ...
/* * Copyright (c) 2002 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; int ans[5001][5001]; int main() { memset((ans), 0, sizeof(ans)); int n, m, l, r; char s[5001]; cin >> n >> m; for (int i = 1; i <= n; i++) { l = r = 0; scanf( %s , s); for (int j = 0; j < m; j++) { if (s[j] == 0 ) { ...
//Legal Notice: (C)2016 Altera Corporation. All rights reserved. Your //use of Altera Corporation's design tools, logic functions and other //software and tools, and its AMPP partner logic functions, and any //output files any of the foregoing (including device programming or //simulation files), and any associated do...
#include <bits/stdc++.h> using namespace std; const int mod = 1000000007; int n, fa[1200000], sf[1200000], len[1200000], f[1200000], g[1200000], diff[1200000], c[1200000][30], p, np, cnt; char s[1200000], a[1200000]; void upd(int &x, int y) { x = (x + y) % mod; } int main() { scanf( %s , s + 1); ...
// (C) 2001-2017 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 sz = 1e5 + 100; const int INF = 1e9; const double eps = 1e-7; void solve() { int n; cin >> n; vector<long long> a(n + 1, 0); for (int i = 0; i < n; i++) { cin >> a[i]; } sort(a.begin(), a.begin() + n); for (int i = n - 1...
// // 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> using namespace std; #pragma GCC target( avx2 ) #pragma GCC optimization( O3 ) #pragma GCC optimization( unrolled-loops ) int n, m, b, w, color[200010], ok[200010]; vector<int> a[200010]; void dfs(int u, int c) { color[u] = c; ok[u] = 1; b += (c == 0); w += (c == 1...
// ============================================================== // 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 1 ns / 1 ps mod...
#include <bits/stdc++.h> using namespace std; int n, m, tot; long long ans; int main(int argc, char **argv) { scanf( %d%d , &n, &m); ++n; for (int i = m + 1; (i << 1) <= n && i < n - m; ++i) for (int j = m + 1; j < n - m; ++j) { tot = (-i * i * 2 + i * j + i * n * 2 - j * n - 1) / (i +...
#include <bits/stdc++.h> using namespace std; bool possible = 1; void change(char str[], char mask[]) { char best[6]; best[0] = 0 ; for (int i = 0; i < (4); ++i) { for (int d = 0; d < (10); ++d) if (!(i == 0 && d == 0)) { char temp = str[i]; str[i] = (d + 0 ); ...
#include <bits/stdc++.h> bool solve(int *c, int *ans) { if (c[5] || c[7]) return false; while (c[3] > 0) { c[3]--; if (!c[1] || !c[6]) return false; else { c[1]--, c[6]--; ans[2]++; } } while (c[1] > 0) { c[1]--; if (!c[2]) return fal...
#include <bits/stdc++.h> using namespace std; string dp[5001]; vector<int> win[2001]; int n; string pow2[2001]; void multi2(string &ress, const string &p) { int flag = 0; ress = ; for (int i = 0; i < p.size(); i++) { ress += ((p[i] - 0 ) * 2 + flag) % 10 + 0 ; flag = ((p[i] - 0 ...
`timescale 1ns/1ns module counter_4bit_2step(input clk, reset, output reg[3:0] out, output reg carry_out); reg [3:0]curr; reg should_add = 0, co = 0; //will reset if reset = 0 always @(posedge clk, negedge reset) begin //$display("counter ? carry[%b]", co); if (~reset) begin curr = 0; co = 0; should_add...
#include <bits/stdc++.h> using namespace std; int main() { long long int n, i, out = 0; cin >> n; for (i = 1; i <= n; i++) { out += pow(2, i); } cout << out; return 0; }
#include <bits/stdc++.h> using namespace std; int n; int a[200200]; void solve() { scanf( %d , &n); for (int i = 0; i < n; i++) { scanf( %d , &a[i]); } int pref = 0; for (int i = 0; i < n; i++) { if (a[i]) pref++; else break; } if (pref == n) { ...
module controlTransmitter (Complete, NullString, NullDataChar, Generated, LoadString, CompareString, LoadNextChar, GenerateData, SendData, Reset, clk); input Complete, NullString, NullDataChar, clk, Reset, Generated; output reg LoadString, CompareString, LoadNextChar, GenerateData, SendData; reg [2:0] current_stat...
#include <bits/stdc++.h> using namespace std; int a[20000], num[20000]; int dp[400]; int n, m, t, k, ans, maxm; int main() { scanf( %d%d , &n, &m); maxm = 0; ans = 0; for (int i = 1; i <= n; i++) { scanf( %d , &a[i]); num[a[i]]++; maxm = max(maxm, num[a[i]]); } t = mi...
// File: SISO_TBV.v // Generated by MyHDL 0.10 // Date: Wed Sep 5 07:52:33 2018 `timescale 1ns/10ps module SISO_TBV ( ); // myHDL -> Verilog Testbench for `SISO` module reg clk = 0; reg rst = 0; wire SerialOut; wire [19:0] SerialInTV; reg SerialIn = 0; reg [3:0] SISO0_0_Buffer = 0; assign SerialInTV = 20'd98933...
///////////////////////////////////////////////////////////// // Created by: Synopsys DC Ultra(TM) in wire load mode // Version : L-2016.03-SP3 // Date : Sun Nov 20 02:52:03 2016 ///////////////////////////////////////////////////////////// module GDA_St_N8_M8_P2 ( in1, in2, res ); input [7:0] in1; input [...
// // Copyright (C) 2009-2012 Chris McClelland // // This program 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, either version 3 of the License, or // (at your option) any later version. // // This ...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 10:25:14 02/11/2016 // Design Name: // Module Name: memorycontroller // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencie...
#include <bits/stdc++.h> using namespace std; bool kjg[100002]; int isi[100002]; long long dp[100002]; vector<int> adlis[100002], radlis[100002]; int rut, nvert, u, v; void ruted(int x) { kjg[x] = 1; for (int i = 0; i < adlis[x].size(); i++) { if (!kjg[adlis[x][i]]) { radlis[x].push_...
#include <bits/stdc++.h> int main() { int i, j, l, flag; char arr[1000100], arr2[1000100]; gets(arr); l = strlen(arr); for (flag = 0, j = 0, i = 0; i < l - 1; i++) { if (arr[i] == 0 && flag == 0) { flag = 1; continue; } else arr2[j++] = arr[i]; } if (f...
#include <bits/stdc++.h> int main() { long long int a, b; scanf( %lld%lld , &a, &b); if (a > b) { printf( %lld %lld , b, (a - b) / 2); } else { printf( %lld %lld , a, (b - a) / 2); } }
#include <bits/stdc++.h> int q[1000001] = {0}, p[1000001] = {0}; int main() { int n, i, a, b, j; scanf( %d , &n); for (i = 0; i < n; i++) { scanf( %d%d , &a, &b); q[a] = b; ++p[a]; --p[b]; } i = 0; while (p[++i] != 1) ; j = q[0]; while (j && i) { p...
#include <bits/stdc++.h> using namespace std; struct edge { int u; int v; int c; }; bool compare(edge e, edge u) { return e.c < u.c; } int findparent(int parent[], int u) { int p = parent[u]; if (p == u) { return p; } int fp = findparent(parent, p); if (p == fp) { r...
// megafunction wizard: %RAM: 1-PORT% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: altsyncram // ============================================================ // File Name: stratix2_dmem.v // Megafunction Name(s): // altsyncram // // Simulation Library Files(s): // altera_mf // ==========================...
// Copyright 2020-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...
#include <bits/stdc++.h> using namespace std; int main() { long long n; cin >> n; long long s = 1; for (long long i = 1; i <= n; i++) { s += (i - 1) * 4; } cout << s; }
#include <bits/stdc++.h> #pragma GCC optimize( O3 ) using namespace std; stringstream output; inline void eOP(); inline void solve() { int n, k; cin >> n >> k; string s; cin >> s; bool* letters = new bool[26](); for (int i = 0; i < n; ++i) { letters[s[i] - a ] = true; } ...
#include <bits/stdc++.h> using namespace std; int ansa, ansb; int mid[110], cnt; int yy; int cmp(int a, int b) { return a > b; } int main() { int n; scanf( %d , &n); for (int i = 0; i < n; ++i) { int s; scanf( %d , &s); int m = s / 2; int x; if (s & 1) { for...
module Conf #(parameter ADDR_BASE = 32'd0, parameter NREG = 4, parameter W = 32 )( input wire ACLK, input wire ARESETN, //AXI Inputs input wire [31:0] S_AXI_ARADDR, input wire [11:0] S_AXI_ARID, output wire S_AXI_ARREADY, input wire S_AXI_ARVALID, input wire ...
// Copyright (c) 2013 Andrew Downing // 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> char s[10010]; char s1[10010], s2[10010], s3[10010]; char ans[10010]; int main() { scanf( %s , s + 1); int n = strlen(s + 1); for (int i = 1; i <= n; i++) { int b1 = i / 26 / 26; int b2 = (i / 26) % 26; int b3 = i % 26; s1[i] = b1 + a ; s2[i] =...
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 5; const long long inf = 1e12; int n, h[N], w[N], u, v; long long ans, f[N][2]; vector<int> g[N]; void dfs(int u, int fa) { vector<long long> vec; long long sum = 0; for (auto v : g[u]) { if (v ^ fa) { dfs(v, u); ...
#include <bits/stdc++.h> using namespace std; int main() { int n, sti[101], i, x, ans; cin >> n; memset(sti, 0, sizeof(sti)); for (i = 1; i <= n; i++) { cin >> x; sti[x]++; } ans = 0; for (i = 1; i <= 100; i++) { ans += 2 * (sti[i] / 4); sti[i] %= 4; ans += ...
#include <bits/stdc++.h> using namespace std; long long modpow(long long base, long long exp, long long modulus) { base %= modulus; long long result = 1; while (exp > 0) { if (exp & 1) result = (result * base) % modulus; base = (base * base) % modulus; exp >>= 1; } return resul...
#include <bits/stdc++.h> using namespace std; int n, m, t[100010], nowt, pos, ans[100010]; pair<int, int> a[100010]; int main() { scanf( %d%d , &n, &m); for (int i = 1; i <= n; ++i) { scanf( %d%d , &t[i], &a[i].first); a[i].second = i; } for (int i = 1, j; i <= n; i = j + 1) { ...
/** * 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...
//Legal Notice: (C)2014 Altera Corporation. All rights reserved. Your //use of Altera Corporation's design tools, logic functions and other //software and tools, and its AMPP partner logic functions, and any //output files any of the foregoing (including device programming or //simulation files), and any associate...
//wb_i2c.v ///////////////////////////////////////////////////////////////////// //// //// //// WISHBONE revB.2 compliant I2C Master controller Top-level //// //// //// //// ...
#include <bits/stdc++.h> using namespace std; int main() { int n, k, x, i, p; char y; string ch = ; cin >> n >> k; for (i = 0; i < k; i++) { p = 97 + i; y = (char)p; ch += y; } if (n == k) cout << ch; else { x = n - k; i = 0; while (x--) { ...
module raw7seg(clk, segment, anode, word); // by teknohog at iki 0 fi // Display a word on a 7-segment display as raw bits. To display // legible text, use external modules/software to figure out the // mapping. // Size of 7-seg display to use, also determines the input word // size which must be 8...
#include <bits/stdc++.h> using namespace std; const int MAX = 18; const int MOD = 1000000007; char c[MAX]; int r[MAX], b[MAX]; int dp[1 << 16][125]; int red[1 << 16], blue[1 << 16]; void precalc(int n) { for (int i = 0; i < (1 << n); i++) { for (int j = 0; j < n; j++) { if (!(i & (1 <<...
#include <bits/stdc++.h> using namespace std; #pragma GCC push_options #pragma GCC optimize( unroll-loops ) int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); long long int INF = 10e18; long long t; cin >> t; while (t--) { long long n; cin >> n; ...
#include <bits/stdc++.h> using namespace std; const int MAXN = 1555; const int dx[4] = {0, 0, 1, -1}; const int dy[4] = {1, -1, 0, 0}; int n, m; template <typename T> inline T mod(const T& lhs, const T& rhs) { T _lhs = lhs; while (_lhs < 0) { _lhs += rhs; } return _lhs % rhs; } c...
/* Copyright 2018 Nuclei System Technology, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except i...
module valu ( alu_source1_data, alu_source2_data, alu_source3_data, alu_source_vcc_value, alu_source_exec_value, alu_control, alu_start, alu_vgpr_dest_data, alu_sgpr_dest_data, alu_dest_vcc_value, alu_dest_exec_value, valu_done, clk, rst ); parameter MODULE = `MODULE_S...
/* * These source files contain a hardware description of a network * automatically generated by CONNECT (CONfigurable NEtwork Creation Tool). * * This product includes a hardware design developed by Carnegie Mellon * University. * * Copyright (c) 2012 by Michael K. Papamichael, Carnegie Mellon University * * ...
#include <bits/stdc++.h> using namespace std; const double pi = acos(-1); int ans, pos[120000], fa[21][120000], tim, dep[120000], K, n, x, y; vector<int> E[120000]; struct wph { bool operator()(const int x, const int y) { return pos[x] < pos[y]; } }; set<int, wph> S; void prep(int x, int ff) { f...
/** * 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; long long int pwr(long long int base, long long int p, long long int mod) { long long int ans = 1; while (p) { if (p & 1) ans = (ans * base) % mod; base = (base * base) % mod; p /= 2; } return ans; } long long int gcd(long long int ...
#include <bits/stdc++.h> using namespace std; int N; int A[100005]; int G[100005]; int m; int main() { scanf( %d , &N); for (int i = 0; i < N; ++i) scanf( %d , &A[i]); for (int i = 0; i < N; ++i) { if (i < N / 2) { if (A[i] - i >= 1) ++G[A[i] - i]; } else { if (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 law...
/* * * Copyright (c) 2011-2012 * * * * 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 distributed in...
#include <bits/stdc++.h> using namespace std; int main() { long long n; cin >> n; if ((n * n) % 2 == 0) { cout << 2 n ; } else { cout << 1 n ; } return 0; }
// $Header: /devl/xcs/repo/env/Databases/CAEInterfaces/verunilibs/data/unisims/IOBUF.v,v 1.11 2009/08/21 23:55:43 harikr Exp $ /////////////////////////////////////////////////////////////////////////////// // Copyright (c) 1995/2004 Xilinx, Inc. // All Right Reserved. //////////////////////////////////////////////////...
#include <bits/stdc++.h> using namespace std; long long mod = 1e9 + 7; long long modpow(long long x, long long y, long long m) { long long z = 1; while (y) { if (y & 1) z = (z * x) % m; x = (x * x) % m; y >>= 1; } return z; } int egcd(int a, int b, int& x, int& y) { if (a...
#include <bits/stdc++.h> using namespace std; struct Point { long long x, y; }; const int N = 1000010; int n; long long a[N]; Point st[N]; int tp; bool cmp(long long x1, long long y1, long long x2, long long y2) { return x2 * y1 <= x1 * y2; } int main() { scanf( %d , &n); for (int ...
#include <bits/stdc++.h> using namespace std; int main() { int n, t, cont[8] = {0}, i; cin >> n; for (int i = 0; i < n && cin >> t; i++) cont[t]++; if (cont[1] != n / 3 || cont[5] + cont[7] || cont[4] > cont[2] || cont[3] > cont[6] || cont[2] + cont[3] != cont[4] + cont[6]) cout << -1;...
#include <bits/stdc++.h> using namespace std; string s; long long x; long long mp[1 << 20]; vector<long long> vec; long long trans[1 << 20][10]; long long dp[1005][12005]; int main(void) { ios::sync_with_stdio(0); cin.tie(0); cin >> s; long long n = s.size(); s = # + s; cin >> ...
#include <bits/stdc++.h> using namespace std; int s[105], d[105], c[105]; int ans[105] = {0}; vector<pair<int, int>> v; int main() { int tc; tc = 1; while (tc--) { int n, m; cin >> n >> m; int flag = 1; for (int i = 1; i <= m; i++) { cin >> s[i] >> d[i] >> c[i]; ...
// Copyright 1986-2014 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2014.3.1 (lin64) Build Thu Oct 30 16:30:39 MDT 2014 // Date : Wed Apr 8 16:47:47 2015 // Host : parallella running 64-bit Ubuntu 14.04.2 ...
#include <bits/stdc++.h> #pragma GCC optimize( Ofast ) #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native ) using namespace std; long long n, m, a, b, c, k, temp, x, y; const int MAXN = 100000 + 11; inline long long max(long long a, long long b) { return ((a > b) ? a : b); } inlin...
/** * 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 vis[500500]; int a[500500]; int b[500500]; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; for (int i = 0; i < n; i++) cin >> a[i]; for (int j = 0; j < n; j++) cin >> b[j]; int ans = 0; int j ...
/////////////////////////////////////////////////////////////////////////////// // (c) Copyright 2008 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 //...
//----------------------------------------------------------------------------- // Title : 2-1 multiplexer // Project : ECE 313 - Computer Organization //----------------------------------------------------------------------------- // File : mux2.v // Author : John Nestor <> // Orga...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 19:31:36 10/21/2015 // Design Name: // Module Name: uart_test // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencies: // ...
`timescale 1ns/1ps `define wbclk_period 100 `define async_clk_period 63 `include "output/vlog_constants.v" `include "../common/wishbone_test_master.v" module RAM_TEST_MASTER (input wb_clk_i, input wb_rst_n_i); parameter RAM_WIDTH = 32; parameter RAM_ASYNC_CLOCK = 0; parameter MAX_BLOCK_SIZE = 1024; ...
#include <bits/stdc++.h> using namespace std; set<long long int> s; int main() { long long int n, m, i, ans = 0; cin >> n >> m; long long int a[n], c[200005] = {0}; for (i = 0; i < m; i++) s.insert(i); for (i = 0; i < n; i++) { long long int d, x; cin >> a[i]; d = a[i] % m; ...