text
stringlengths
59
71.4k
// (c) Copyright 1995-2015 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; int main() { int n; char name[21]; int initials[26]; cin >> n; memset(initials, 0, 26 * sizeof(int)); for (int i = 0; i < n; ++i) { cin >> name; initials[name[0] - a ]++; } int total = 0; for (int i = 0; i < 26; ++i) { ...
`define DATA_BITS 8 // Setting 1: // (uncomment to implement a 2-FF synchronizer on the receiver's end) `define USE_RECEIVER_SYNCHRONIZER // Setting 2: // (uncomment to implement a 2-FF synchronizer on the sender's end) `define USE_SENDER_SYNCHRONIZER // Setting 3: // use multiple synchronizer points assuming t...
// ------------------------------------------------------------- // // File Name: hdl_prj\hdlsrc\controllerPeripheralHdlAdi\controllerHdl\controllerHdl_StandBy.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 main() { int n, x; scanf( %d%d n , &n, &x); if (n == 5) printf( >...v nv.<.. n..^.. n>.... n..^.< n1 1 n ); if (n == 3) printf( >vv n^<. n^.< n1 3 n ); if (n == 100) { for (int i = 0; i < 50; i++) { puts( v<.<.<.<.<.<.<...
`timescale 100ps / 10ps `define clkperiodby2 10 //////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 22:06:14 09/30/2013 // Design Name: dac // Module Name: F:/PROJECTS/SYSTEMS/V_CODES/DAC/tb_dac.v // Project Name: DAC // Target...
#include <bits/stdc++.h> using namespace std; struct node { long long mx, sm, idx; node() { mx = 0; sm = 0; idx = 0; } }; struct segTree { long long n; vector<node> st; segTree(long long n) { this->n = n; st.resize(4 * n + 5); } void combine(long lon...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2013 by Wilson Snyder. // bug789 generates module t (/*AUTOARG*/ // Inputs clk ); input clk; integer cyc=1; ifc #(1) itopa(); ifc #(2) itopb(); sub #(1) ca...
#include <bits/stdc++.h> using namespace std; double PI = acos(-1); struct point { long long x, y; point(long long x = 0, long long y = 0) { this->x = x; this->y = y; } bool operator==(point& p) { return p.x == x && p.y == y; } } a[100010], origin; struct vecto { long long x, y...
#include <bits/stdc++.h> using namespace std; template <typename T> void maxE(T& a, const T& b) { a = max(a, b); } template <typename T> void minE(T& a, const T& b) { a = min(a, b); } template <typename T> ostream& operator<<(ostream& out, const vector<T>& t_) { out << [ ; for (auto i...
// *************************************************************************** // *************************************************************************** // Copyright 2011(c) Analog Devices, Inc. // // All rights reserved. // // Redistribution and use in source and binary forms, with or without modification, // are...
/* * 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; vector<pair<int, int> > adj[100005]; int m, n, a, b, w; long long D[100005]; int Tr[100005]; void dijk(int x) { Tr[x] = 0; D[x] = 0; set<pair<long long, int> > s; s.insert({0, x}); while (s.size() > 0) { long long d = (*s.begin()).first...
#include <bits/stdc++.h> using namespace std; const int ans[] = {0, 4, 10, 20, 35, 56, 83, 350 - 234, 400 - 245, 450 - 252, 500 - 256}; int main() { int n; cin >> n; if (n <= 10) cout << ans[n] << endl; else cout << 1LL * n * 50 - n - 2...
// megafunction wizard: %ROM: 1-PORT%VBB% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: altsyncram // ============================================================ // File Name: frac_rom.v // Megafunction Name(s): // altsyncram // // Simulation Library Files(s): // altera_mf // ===========================...
#include <bits/stdc++.h> using namespace std; string f[300], t[300], e[300]; char s[20]; int n; bool cmp(string& a, string b) { if (a == ) return 1; return a.size() == b.size() ? a > b : a.size() > b.size(); } int main() { f[240] = x ; f[204] = y ; f[170] = z ; while (1) { ...
/* * This demonstrates a basic dynamic array */ module main; int foo[]; int idx; initial begin if (foo.size() != 0) begin $display("FAILED -- foo.size()=%0d, s.b. 0", foo.size()); $finish; end foo = new[10]; if (foo.size() != 10) begin $display("FAILED -- foo.size()=%0d, s.b....
#include <bits/stdc++.h> bool vis[100000 + 3]; int pr[20000]; int h; int a[300]; int n; int endp[200000], next[200000], cap[200000]; int gra[300], cur[300], dist[300], prev[300]; int cnt[300]; int ecnt; char buf[10000], *bend; char out[10000], *oend; void add_edge(int u, int v, int c) { endp...
// *************************************************************************** // *************************************************************************** // 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; const int maxn = 2e5 + 7; long long a[maxn]; int main() { int _; cin >> _; while (_--) { int n, k; cin >> n >> k; for (int i = 1; i <= n; i++) cin >> a[i]; sort(a + 1, a + 1 + n, greater<int>()); long long ans = 0; for...
/* Copyright (c) 2019 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; const long long MOD = 1e9 + 7; const long long MAXN = 1e5 + 3; const long long inf = 2e9; long long max(long long a, long long b) { if (a > b) return a; else return b; } long long min(long long a, long long b) { if (a < b) return ...
#include <bits/stdc++.h> using namespace std; const int A = 1e5 + 11; const int B = 1e6 + 11; const int mod = 1e9 + 7; const int inf = 0x3f3f3f3f; inline int read() { char c = getchar(); int x = 0, f = 1; for (; !isdigit(c); c = getchar()) if (c == - ) f = -1; for (; isdigit(c); c = g...
`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 17:42:36 12/10/2012 // Design Name: top // Module Name: C:/Documents and Settings/SPItoUART_Loopback/tb.v // Project Name: SPItoUART_Loopback // Target Device: // ...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0), cin.tie(0); long long n, k; cin >> n >> k; long long a[k]; map<long long, bool> m; for (long long i = 0; i < k; i++) { cin >> a[i]; m[a[i]] = true; } long long cnt = 1; for (long long ...
// Copyright 1986-2017 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2017.2.1 (win64) Build Wed Aug 9 16:32:24 MDT 2017 // Date : Fri Sep 22 17:40:40 2017 // Host : EffulgentTome running 64-bit major re...
#include <bits/stdc++.h> using namespace std; long long n, m, q, k, v[300050], ans, d; pair<long long, long long> w[300050]; string second; int32_t main() { ios::sync_with_stdio(false); cin.tie(0); cin >> q; while (q--) { cin >> d >> m; if (d <= 3) { if (d == 1) c...
`timescale 1ns / 1ps `include "../src/axis_blender.v" `include "../../axis_relay/src/axis_relay.v" module test_axis_blender_relay( ); parameter integer C_CHN_WIDTH = 8; parameter integer C_S0_CHN_NUM = 1; parameter integer C_S1_CHN_NUM = 1; parameter integer C_ALPHA_WIDTH = ...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; const double eps = 1e-8; double e[100010], r[100010], p[100010]; int main() { int n; { scanf( %d , &n); for (int i = 0; i < n; i++) { scanf( %lf , &p[i]); } e[0] = p[0]; r[0] = p[0]; for (int i = 1; i < n; 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 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 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; const int MAXN = 200002; double eps = 1e-9; int T, N, M, K, mx, sum, ans; int a, b, c; bool visit[MAXN], call[MAXN]; int color[MAXN]; vector<int> v[MAXN]; map<int, int> mp; void dfs(int n) { mp[color[n]]++; for (auto i : v[n]) if (!visit[i]...
#include <bits/stdc++.h> using namespace std; int main() { double x, y, z; cin >> x >> y >> z; double a[12] = {-200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200}; string b[12] = { x^y^z , x^z^y , (x^y)^z , (x^z)^y , y^x^z , y^z^x , (...
module MultiplyAccumulateMatrix #( parameter DATA_BITS = 8, parameter WEIGHT_BITS = 8, parameter ACCUMULATOR_BITS = 16, parameter MATRIX_SIZE = 256 ) ( input clock, input reset, input [DATA_BITS-1:0] data_in [0:MATRIX_SIZE-1], // Global inputs input ...
/////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2014 Francis Bruno, All Rights Reserved // // 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 Found...
#include <bits/stdc++.h> using namespace std; int T[2 * 10010]; vector<int> G[6010]; vector<int> S[6010]; int P[6010]; int C[6010]; map<int, int> M; bool V[6010]; int mx; int n = 6010; void modify(int p, int value) { for (T[p += n] = value; p > 1; p >>= 1) T[p >> 1] = max(T[p], T[p ^ 1]); } ...
////////////////////////////////////////////////////////////////////////////// // Copyright (c) 2006 Xilinx, Inc. // This design is confidential and proprietary of Xilinx, All Rights Reserved. ////////////////////////////////////////////////////////////////////////////// // ____ ____ // / /\/ / // /___/ \ / ...
#include <bits/stdc++.h> char g[64][64]; int h[64][64]; void conv(long long x, long long y, long long a, long long b, long long *dx, long long *dy) { long long k, l; k = x - y + b * 2000000000LL; l = x + y + a * 2000000000LL; *dx = k / (2 * b) - 1000000000LL; *dy = l / (2 * a) - 10...
#include <bits/stdc++.h> #pragma comment(linker, /STACK:64000000 ) using namespace std; const int MAXN = -1; const int MOD = 1; const long double EPS = 1e-11; long double sqr(long double x) { return x * x; } bool ok(long double x) { return x >= -EPS && x <= 1 + EPS; } void norm(long double &x) { if...
#include <bits/stdc++.h> using namespace std; int n; long long x[100010]; long long y[100010]; long long dispoint(long long x1, long long y1, long long x2, long long y2) { return (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2); } bool issame(long long x1, long long y1, long long x2, long long y2, ...
// // busctrl.v -- bus controller // module busctrl(cpu_en, cpu_wr, cpu_size, cpu_addr, cpu_data_out, cpu_data_in, cpu_wt, ram_en, ram_wr, ram_size, ram_addr, ram_data_in, ram_data_out, ram_wt, rom_en, rom_wr, rom_size, rom_addr, rom_data_out,...
#include <bits/stdc++.h> using namespace std; vector<pair<int, int> > vec[105]; int main() { int n, k; scanf( %d%d , &n, &k); for (int i = 1; i <= n; i++) vec[i].push_back(make_pair(i, i)); int ct = 101; int a, b; for (int i = 1; i <= k; i++) { scanf( %d%d , &a, &b); vec[a].pus...
`timescale 1ns/100ps // ----------------------------------------------------------------------------- // One-level up Hierarchical module // ----------------------------------------------------------------------------- module a_h // Verilog 2001 style #(parameter M=5, N=3) ( // Outputs output [N-1:0] [M...
#include <bits/stdc++.h> using namespace std; int const N = 1010; int const M = 1001000; int n, m; struct Graph { struct edges { int u, next; long long c; } e[M]; int p[N], idx; void addedge(int u, int v, long long c) { e[idx].u = v, e[idx].next = p[u], e[idx].c = c, p[u] = i...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 01/24/2016 03:17:47 PM // Design Name: // Module Name: Problem2 // Project Name: // Target Devices: // Tool Versions: // Description: // // Dependencies: // // R...
/*l Distributed under the MIT license. Copyright (c) 2016 Dave McCoy () Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, m...
#include <bits/stdc++.h> using namespace std; const int prime = 999983; const int INF = 0x7FFFFFFF; const long long INFF = 0x7FFFFFFFFFFFFFFF; const double pi = acos(-1.0); const double inf = 1e18; const double eps = 1e-6; const long long mod = 1e9 + 7; long long qpow(long long a, long long b) { l...
module interface_microfono(clk, reset, d_in, cs, addr, rd, wr, d_out, bclk, lrsel, mic_in); input wire clk; input wire reset; input wire [15:0] d_in; input wire cs; input wire [3:0] addr; input wire rd; input wire wr; output wire d_out; output wire bclk; output wire lrsel; input wire mic_in; DivFreq _Div...
/** * 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; const int N = 200005; const char c[3][4] = { RGB , GBR , BRG }; int sum[3][N]; char s[N]; int main() { int n, k, T; scanf( %d , &T); while (T--) { scanf( %d%d , &n, &k); sum[0][0] = sum[1][0] = sum[2][0] = 0; scanf( %s , s); ...
#include <bits/stdc++.h> using namespace std; long long int binExp(long long int a, long long int power, long long int m = 1000000007) { long long int res = 1; while (power) { if (power & 1) res = (res * a) % m; a = (a * a) % m; power >>= 1; } return res; }...
#include <bits/stdc++.h> #pragma comment(linker, /STACK:1024000000,1024000000 ) using namespace std; const int maxn = 1e6 + 7; const int INF = 1e9 + 7; int n, k; int a[maxn]; vector<int> fac[maxn]; int sum[maxn]; int L[maxn], R[maxn]; long long ans; void ini() { stack<int> st; a[n + 1] = ...
#include <bits/stdc++.h> using namespace std; inline int read() { int x = 0, f = 1; char ch = getchar(); while (ch < 0 || ch > 9 ) { if (ch == - ) f = -1; ch = getchar(); } while (ch >= 0 && ch <= 9 ) { x = x * 10 + ch - 0 ; ch = getchar(); } return x * f;...
`timescale 1ns / 1ps /* ** Basic vending machine testbench ** ** See doc/problem.pdf for further information. ** ** @author: Emre Can Kucukoglu ** @mail: */ module lab3_testbench; // Inputs. For regs, initial value reg [2:0] KeyPad; reg [1:0] Mode; reg CLK; reg RESET; // Outputs wire [7:...
#include <bits/stdc++.h> using namespace std; int main() { double d, h, v, e; cin >> d >> h >> v >> e; d /= 2; double vol = d * d * acos(-1) * h; double incre = e * d * d * acos(-1); if (incre >= v) { cout << NO ; return 0; } double ans = vol / (v - incre); if (ans >...
#include <bits/stdc++.h> using namespace std; int BIT[100005]; int v[100005], n, i, mayor, lol, cosaMenor = 1000005; int contMayor, numMenor; bool record[100005]; int buenos; void add(int pos) { while (pos > 0) { BIT[pos]++; pos -= pos & (-pos); } } int query(int pos) { int sum...
#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 ) int main() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n; cin >> n; ...
module butterfly3_16( enable, i_0, i_1, i_2, i_3, i_4, i_5, i_6, i_7, i_8, i_9, i_10, i_11, i_12, ...
#include <bits/stdc++.h> using namespace std; const int N = 3e5 + 2; const long long mod = 998244353; long long fpow(long long a, long long b) { if (b == 0) return 1; long long cur = fpow(a, b >> 1); cur *= cur; cur %= mod; if (b & 1) cur *= a; return cur % mod; } int main() { io...
#include <bits/stdc++.h> using namespace std; const int MOD = 1e9 + 7; const double PI = acos(-1.); const double eps = 1e-10; const int INF = 0x3f3f3f3f; const long long INFll = 0x3f3f3f3f3f3f3f3f; const int MAXN = 1e6 + 5; const int MX = 123456; const int inf = 0x3f3f3f3f; const int MXE = 1e7; st...
`include "defines.v" `include "mux4x2.v" `timescale 1ns/1ps /*module mux2x1 ( input `control_w port0_ci, input `control_w port1_ci, input sel, input clk, input rst, output `control_w port0_co )*/ module tb( ); reg `control_w port0, po...
#include <bits/stdc++.h> using namespace std; int main() { int h1, a1, c, h2, a2, h; cin >> h1 >> a1 >> c >> h2 >> a2; vector<string> v; h = h1; while (h2 > 0) { if ((a1 >= h2) || h1 > a2) { v.push_back( STRIKE ); h2 -= a1; } else { v.push_back( HEAL ); ...
#include <bits/stdc++.h> using namespace std; int main() { int n; scanf( %d , &n); int arr[101][101]; int row[101], col[101]; for (int i = 0; i <= n - 1; i++) { row[i] = col[i] = 0; } int temp; for (int i = 0; i <= n - 1; i++) { for (int j = 0; j <= n - 1; j++) { ...
#include <bits/stdc++.h> using namespace std; const int MOD = (int)1e9 + 7; const int INF = (int)1e9; const long long LINF = (long long)1e18; const long double PI = acos((long double)-1); const long double EPS = 1e-9; inline long long gcd(long long a, long long b) { long long r; while (b) { ...
#include <bits/stdc++.h> using namespace std; const long long maxsize = 100000 + 9; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int T; T = 1; while (T--) { long long i, j, k, m, n, flag = 0; vector<int> v; string s; cin >> n >> s; f...
/////////////////////////////////////////////////////////////////////////////// // Copyright (c) 1995/2015 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> using namespace std; const int maxn = 1e9; struct comparator { bool operator()(const pair<int, int> &a, const pair<int, int> &b) { return a.first > b.first; } } cmp; int main() { char in; vector<pair<int, int> > white, black; int board[8][8]; for (int i =...
#include <bits/stdc++.h> using namespace std; long long N; vector<int> E[100000]; bool visit[100000] = {0}; long long component[100000] = {0}; int cN = 0; stack<int> stk; void DFS(int s) { if (visit[s]) return; visit[s] = true; stk.push(s); while (!stk.empty()) { int v = stk.top();...
#include <bits/stdc++.h> using namespace std; int rev(int a) { int ans = 0; int shift = 0; while (shift <= 7) { ans |= (a & 1 << shift ? 1 : 0) << (7 - shift); shift++; } return ans; } int main() { string a; int prev = 0; getline(cin, a); for (int i = 0; i < a.len...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed under the Creative Commons Public Domain, for // any use, without warranty, 2011 by Wilson Snyder. // SPDX-License-Identifier: CC0-1.0 module t_embed1_wrap (/*AUTOARG*/ // Outputs bit_out, vec_out, wide_out, did_init_out, // Inputs ...
// // 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 ...
/* not_stable but Believer */ /* Practice for Expert */ #include<bits/stdc++.h> #define int long long #define io ios_base::sync_with_stdio(false),cin.tie(nullptr); #define ipair pair<int,char> #define pb push_back #define f(i, n) for(int i=0;i<n;i++) #define F(i, n) for(int i=0;i<n;i++) #define rep(i,...
/*********************************************************************** Capsense system controller This file is part FPGA Libre project http://fpgalibre.sf.net/ Description: Core used to periodically sample capsense buttons. This version includes the frequency dividers and the toggle logic. To Do: - ...
/*Joshua Torres Morales A76478 */ // MODE = 1 FIFO // MODE = 0 LIFO `include "ram.v" module DUT #(parameter MODE=1'b1, parameter dat_width=32, parameter L=6, parameter DEPTH=64) ( input [dat_width-1:0] Datain, input Wren, input Rden, input Wrclk, input Rdclk, input Rst, output reg Full, ...
module Microfono(RESET,CLK,ENABLE,D_IN,BCLK,WS,D_OUT,DONE, D_AMP); input wire RESET; input wire CLK; input wire ENABLE; input wire D_IN; output wire BCLK; output wire WS; output wire [17:0] D_OUT; output wire DONE; output wire D_AMP; wire COUNT18; wire COUNT32; wire RESET_INT; wire EN_BCLK; wire [5:0] C...
#include <bits/stdc++.h> using namespace std; int nA, nB, m, k, ans, x, y, c1, c2, cnt; int deg[1310 << 1], be[190010], w[1310], w2[1310]; int id[10005][1310], f[10005][1310]; void rv(int x, int c1, int c2) { swap(f[x][c1], f[x][c2]); swap(id[x][c1], id[x][c2]); be[id[x][c2]] = c2; if (f[x][c2...
// // 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; const double PI = acos(-1); int main() { long long m, n, i; while (cin >> n >> m) { long long a[n + 1], b; a[0] = 0; for (i = 0; i < n; i++) { cin >> a[i + 1]; a[i + 1] += a[i]; } for (i = 0; i < m; i++) { ...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ii = pair<int, int>; const int N = 200005; const int M = 300; const int OFF = N * M; int _cnt[N + N * M]; int *cnt = _cnt + OFF; int main() { char s[N]; scanf( %s , s); int n = strlen(s); int psum[N]; for (in...
#include <bits/stdc++.h> using namespace std; char s[2][100]; int fun(char a, char b) { if (a == 8 ) { if (b == [ ) return 1; else if (b == ( ) return -1; else return 0; } if (a == [ ) { if (b == 8 ) return -1; else if (b == ( ) ...
#include <bits/stdc++.h> using namespace std; int main() { int n, s, i, x, y; cin >> n >> s; int sol = 100; int f = 1; for (i = 0; i < n; i++) { cin >> x >> y; if (x < s) { if (y) { sol = min(sol, y); } } if (x < s || (x == s && y == 0)) { ...
#include <bits/stdc++.h> using namespace std; int n, m, q, k, a[110000], cnt, tmp[110000]; int edgenum = 1, vet[610000], val[610000], Next[610000], Head[110000]; double ang[610000]; bool vis[110000]; map<pair<int, int>, int> rnk; vector<long long> sum[110000]; struct node { int x, y; node() {} ...
/** * 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; const long long M = 1e9 + 7; const long long N = 5e5 + 1; bool prime[N]; void solve() { long long n, k; cin >> n >> k; string s; cin >> s; vector<vector<long long>> v(k); long long cnt = 0, c = 0; string t = s; bool f = 0; while...
#include <bits/stdc++.h> using namespace std; using lli = long long; using pii = pair<int, int>; using pll = pair<lli, lli>; template <typename T> using Vector = vector<vector<T>>; template <typename T> using Prior = priority_queue<T>; template <typename T> using prior = priority_queue<T, vector<T>,...
/////////////////////////////////////////////////////////////////////////////// // vim:set shiftwidth=3 softtabstop=3 expandtab: // $Id: output_port_lookup.v 5240 2009-03-14 01:50:42Z grg $ // // Module: switch_output_port.v // Project: NF2.1 // Description: reads incoming packets parses them and decides on the output ...
#include <bits/stdc++.h> const int MAXN = int(2e5); int n, k, cnt, A, tot[2 * MAXN + 5]; bool flag; long long ans; int read(int &x) { char c = getchar(); int a = 0, b = 1; while ( 0 > c || c > 9 ) b = c == - ? -1 : b, c = getchar(); while ( 0 <= c && c <= 9 ) a = a * 10 + c - 0 , c = ge...
#include <bits/stdc++.h> using namespace std; int main() { int i, j; long long n, a, b, ans; long long arr[50]; arr[0] = 1; for (i = 1; i < 40; i++) arr[i] = arr[i - 1] * 3; scanf( %I64d , &n); for (i = 0; i < 40; i++) { if (n == arr[i]) { printf( 1 n ); break; ...
// bsg_nonsynth_dpi_clock_gen is a drop-in replacement for // bsg_nonsynth_clock_gen when using verilator, where delay statements // (e.g. #1) are not valid. // // One of the frustrating parts of Verilator is that it "breaks" how // we normally build testbenches. Our traditional approach is to use // the bsg_nonsynth_c...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int t; cin >> t; while (t--) { long long n1, n2, n3; cin >> n1 >> n2 >> n3; vector<long long> a, b, c; for (long long i = (0); i < (n1); i++) { ...
/******************************************************************************* * This file is owned and controlled by Xilinx and must be used * * solely for design, simulation, implementation and creation of * * design files limited to Xilinx devices or technologies. Use ...
#include <bits/stdc++.h> int n, m; int main() { long long ans; int b, c, A, B, C, l; scanf( %d%d , &n, &m); n++; m++; ans = 0; for (c = m; c <= n - m; c++) { C = 2 * (n * n - n * c + c * c); for (b = n - m; b >= m; b--) { A = 2 * n - b - c; B = b * (n + c); ...
// // 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 2011(c) Analog Devices, Inc. // // All rights reserved. // // Redistribution and use in source and binary forms, with or without modification, // a...