text
stringlengths
59
71.4k
#include <bits/stdc++.h> using namespace std; const int INF = 1000000001; const long double EPS = 1e-9; const int MOD = 1000000007; const long long LLINF = 1000000000000000001; const int maxn = 350000; int n, k; int result[maxn]; int cost[maxn]; int main() { ios_base::sync_with_stdio(false); ...
/* * 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 gcd(long long a, long long b) { if (a > b) swap(a, b); if (a == 0) return b; return gcd(b % a, a); } signed main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); long long t, i; cin >> t; while (t--) { ...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 11:21:14 08/24/2011 // Design Name: // Module Name: q15_mult // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencies: // /...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty. // module some_module ( input [3:0] i_clks ); logic [ 1 : 0 ] some_state; logic [1:0] some_other_state; always @(posedge i_clks[3]) begin case (some_...
#include <bits/stdc++.h> using namespace std; int main() { int n; scanf( %d , &n); vector<int> v(n); for (auto &x : v) { scanf( %d , &x); } sort(v.begin(), v.end()); int pos = 0, cnt = 0; for (int x : v) { while (pos < n) { if (v[pos] > x) { pos++; ...
#include <bits/stdc++.h> using namespace std; bool checktwo(long long int n){if(n==0){return false;}else{return (ceil(log2(n)) == floor(log2(n)));}} long long int powerof2lte(long long int n){int p = (long long int)log2(n);return (long long int)pow(2, p);} long long int numdigits(long long int n){return...
#include <bits/stdc++.h> const int INF_INT = 0x3f3f3f3f; const long long INF_LL = 0x7f7f7f7f; const int MOD = 1e9 + 7; const double eps = 1e-10; const double pi = acos(-1); using namespace std; const int N = 200200; int n, m, q; int u[N], v[N]; struct Query { int l, r, s, t, id; Query(int 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 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; int main() { long long n, m, a, b; cin >> n >> m >> a >> b; long long cost = 0; if (m > n) m = n; if (m * a <= b) cost = n * a; else { cost = (n / m) * b; n = n % m; if (n > 0) { if ((n)*a <= b) cost += n...
module conware #( parameter DWIDTH = 32, parameter WIDTH = 4, parameter HEIGHT = 1 )( clk, rstn, // Color conversion signals alive_color, dead_color, // Input AXI stream ports S_AXIS_TVALID, S_AXIS_TREADY, S_AXIS_TDATA, S_AXIS_TLAST, ...
#include <bits/stdc++.h> using namespace std; class strocks { public: string strocksguy() {} }; int main() { strocks strocks; iostream::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long n, m; cin >> n >> m; string s, d; unordered_map<string, string> master; for (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...
#include <bits/stdc++.h> using namespace std; void printVector(vector<string> &v) { for (auto x : v) cout << x << n ; } void printVector(vector<int> &v) { for (auto x : v) cout << x << ; cout << n ; } int main() { cin.tie(0); cout.tie(0); ios::sync_with_stdio(0); int t; ...
/** * 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 DRAMReader( //AXI port input wire ACLK, input wire ARESETN, output reg [31:0] M_AXI_ARADDR, input wire M_AXI_ARREADY, output wire M_AXI_ARVALID, input wire [63:0] M_AXI_RDATA, output wire M_AXI_RREADY, input wire [1:0] M_AXI_RRESP, input wire M_AXI_RVALID, input wire ...
`timescale 1ns/100ps module Combiner( input clk, input signed [15:0] din, //input mode, input integ, input bypass, //input [9:0] gateEnd, //(* equivalent_register_removal = "no" *) output reg signed [15:0] dout = 16'h0000 output signed [15:0] dout ); `include "bits_to_fit.v" //parameter real CLK_FREQ = 192e6...
#include <bits/stdc++.h> using namespace std; int main() { list<unsigned long long int> blind; list<unsigned long long int>::iterator bite, tempite; unsigned long long int total, l, maxarea = 0, sum, i; cin >> total >> l; for (i = 0; i < total; ++i) { cin >> sum; if (sum >= l) blind....
#include <bits/stdc++.h> using namespace std; template <typename X, typename Y> static inline void xmin(X &x, Y y) { if (y < x) x = y; } template <typename X, typename Y> static inline void xmax(X &x, Y y) { if (x < y) x = y; } long long pw(long long x, long long y, long long md) { if (!y) r...
/* * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law...
#include <bits/stdc++.h> using namespace std; const int mod = 1e9 + 7; const long long int INF = 3e16; const int N = 200010; int n; int ask(vector<int> v) { printf( ? ); for (int i = 0; i < n; i++) printf( %d , v[i]); printf( n ); fflush(stdout); int ans; scanf( %d , &ans); ret...
/************************************************************************ dataGeneration.v Data generation module Domesday Duplicator - LaserDisc RF sampler Copyright (C) 2018 Simon Inns This file is part of Domesday Duplicator. Domesday Duplicator is free software: you can redistribute it and/or modify ...
#include <bits/stdc++.h> using namespace std; const int N = 1000006; const long long int M = 935172938408392767LL; vector<long long int> kub[N]; long long int kra[N]; long long int maska[N]; int deg[N]; int main() { int n, m, a, b; long long int wynik = 0; scanf( %d%d , &n, &m); kra[1] =...
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; int a[m], b[m]; for (int i = 0; i < m; i++) { cin >> a[i]; b[i] = a[i]; } int min = 0; for (int i = 0; i < n; i++) { int t1 = INT_MAX; int loc = -1; for (int j = 0; j < m; j+...
/* * 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() { int t = 1, i, j, n; long long int p, q, temp, arr[90]; for (j = 0; j < t; j++) { scanf( %lld %lld , &p, &q); scanf( %d , &n); for (i = 0; i < n; i++) scanf( %lld , &arr[i]); for (i = 0; i < n; i++) { if (p / q < arr[i]) { prin...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int t = 1; cin >> t; while (t--) { int n, m, i, x = 0, y, z; cin >> n; string s[n + 1]; for (int i = 0; i < n; i++) cin >> s[i]; vector<pa...
/** * 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...
// Automatically generated: write_netlist -wrapapp -verilog -module reconflogic-wrapslowadt7410.v module MyReconfigLogic ( input Reset_n_i, input Clk_i, input AdcConvComplete_i, output AdcDoConvert_o, input[9:0] AdcValue_i, input I2C_Busy_i, output[7:0] I2C_DataIn_o, input[7:0] I2C_DataOut_i, output[...
/////////////////////////////////////////////////////////////////////////////// // vim:set shiftwidth=3 softtabstop=3 expandtab: // // Module: cpu_dma_queue_regs.v // Project: NF2.1 // Description: Register module for the CPU DMA queue // //////////////////////////////////////////////////////////////////////////...
/* * 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; void my_dbg() { cout << endl; } template <typename Arg, typename... Args> void my_dbg(Arg A, Args... B) { cout << << A; my_dbg(B...); } using ll = long long; using vi = vector<int>; using vl = vector<ll>; using pii = pair<int, int>; const int...
#include <bits/stdc++.h> using namespace std; void bug() { cout << << endl; } template <class T> void bug(T a) { cout << a << ; } template <class T> void bug(T* a, int n) { for (int i = 0; i < (n); i++) bug(a[i]); } int n, m; vector<pair<pair<int, int>, bool> > e; int ans = 1000000...
#include <bits/stdc++.h> using namespace std; const int MAXN = 1000; int from[MAXN + 5]; void Gauss(int n, int d, double a[][MAXN + 5], double *Ans) { for (int i = 1; i <= n; i++) from[i] = i; for (int i = 1; i <= n; i++) { if (!a[i][i]) for (int j = i + 1; j <= min(n, i + d); j++) ...
#include <bits/stdc++.h> using namespace std; int main() { int n; string s, s1 = , s2 = ; cin >> n >> s; reverse(s.begin(), s.end()); for (int i = 0; i < s.size(); ++i) { if (i % 2 == 0) s1 += s[i]; else s2 += s[i]; } reverse(s1.begin(), s1.end()); cou...
#include <bits/stdc++.h> using namespace std; const int maxn = 2e5 + 50; const int inf = 0x3f3f3f3f; int n, mod; long long ans; int head[maxn], nxt[maxn << 1], to[maxn << 1], cost[maxn << 1], edge_tot; void add_edge(int u, int v, int c) { nxt[++edge_tot] = head[u]; head[u] = edge_tot; to[edge_...
#include <bits/stdc++.h> const double pi = acos(-1); const int MOD = 1e9 + 7; const int INF = 1e9 + 7; const int MAXN = 1e6 + 5; const double eps = 1e-9; using namespace std; int main() { for (int i = 0; i < 9; i++) printf( %d ? ?<>%d n , i, i + 1); printf( 9 ? ?>> ? ?0 n ? ?<>1 n ); for (int ...
#include <bits/stdc++.h> using namespace std; inline int ri() { int x; scanf( %d , &x); return x; } template <typename T> inline bool smax(T &a, T b) { if (a < b) { a = b; return true; } return false; } template <typename T> inline bool smin(T &a, T b) { if (a > b...
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 10; vector<long long> presum(maxn, 0); int main() { int last = 0; for (long long i = 1; i < maxn; ++i) { presum[i] = presum[i - 1] + min(i, 9LL); if (i >= 10 && i < 100) { presum[i] = presum[i] + (2LL * (i - 9LL)); ...
#include <bits/stdc++.h> using namespace std; const int inf = INT_MAX; int n; struct node { long double x, y; } a[100010]; bool check(long double xx) { long double l, r; l = -1e19, r = 1e19; for (int i = 0; i < n; ++i) { if (a[i].y >= xx * 2 || l > r) return false; l = max(l, a[i...
#include <bits/stdc++.h> using namespace std; const unsigned long long hash1 = 201326611; const unsigned long long hash2 = 50331653; const int N = 200000 + 10; const int M = 20; vector<int> g[N]; int n, vis[N]; int main() { ios::sync_with_stdio(false); cin.tie(0), cout.tie(0); cin >> n; ...
#include <bits/stdc++.h> using namespace std; map<int, string> mapa; int main() { mapa[0] = zero ; mapa[1] = one ; mapa[2] = two ; mapa[3] = three ; mapa[4] = four ; mapa[5] = five ; mapa[6] = six ; mapa[7] = seven ; mapa[8] = eight ; mapa[9] = nine ; mapa[10]...
#include <bits/stdc++.h> const int oo = 0x3f3f3f3f, mod = 1e9 + 7; using namespace std; int dx[]{1, -1, 0, 0, 1, 1, -1, -1}; int dy[]{0, 0, 1, -1, 1, -1, 1, -1}; long long OO = (1LL * oo * oo); void K_K() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); } int main() { K_K(); long ...
/** * $Id: red_pitaya_daisy_test.v -01-21 11:40:39Z matej.oblak $ * * @brief Red Pitaya daisy chain communication module. Testing module. * * @Author Matej Oblak * * (c) Red Pitaya http://www.redpitaya.com * * This part of code is written in Verilog hardware description language (HDL). * Please visit http://...
// sram_0.v // This file was auto-generated as part of a SOPC Builder generate operation. // If you edit it your changes will probably be lost. `timescale 1 ps / 1 ps module sram_0 ( input wire iCLK, // clk.clk inout wire [15:0] SRAM_DQ, // avalon_slave_0_export.export out...
#include <bits/stdc++.h> using namespace std; using ll = long long; using vll = vector<ll>; using vii = vector<int>; using pii = pair<int, int>; template <typename T = vii> using vec = vector<T>; const ll INF = 1e18, MOD = 998244353; const int MAX = 1e6; ll ft[MAX + 1]; void cf() { ft[0] = 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 law...
// test_pg.v `timescale 1ns / 1ps module test_pg; reg clk = 0; reg sync = 0; reg reset = 1; reg trigger = 0; wire [4:0]signal; // avalon interface reg write_data = 0; reg write_ctrl = 0; reg read_ctrl = 0; reg [7:0]address; reg [31:0]writedata; wire [31:0]readdata; reg [1:0]byteenable = 2'b11; task...
// // 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; int main(void) { int n; cin >> n; if (n > 2) cout << n - 2 << endl; else if (n <= 2) cout << n + 2 << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { long long k; cin >> k; getchar(); char s[1000001]; cin >> s; int a[strlen(s)]; long long sum = 0; for (int i = 0; i < strlen(s); i++) { sum += s[i] - 48; a[i] = s[i] - 48; } k = k - sum; sort(a, a + st...
////////////////////////////////////////////////////////////////////// //// //// //// ORPSoC Testbench UART Decoder //// //// //// //// Description ...
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 4; int n, k, b[N], vis[N]; long long l, dp[N], temp[N]; const long long mod = 1e9 + 7; struct node { friend bool operator<(node x, node y) { if (x.a == y.a) return x.pos < y.pos; return x.a < y.a; } int a, pos; }; ...
#include <bits/stdc++.h> using namespace std; int main() { int a; cin >> a; for (int i = 0; i < a; i++) { int c = 0; int j; cin >> j; int f = j % 10; if (j > 1) f = (f - 1) * 10; if (j > 1000) { f = f + 10; } else if (j > 100) { f = f + 6; ...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); ; long long i, j, k, l, n, m; long long t; cin >> t; while (t--) { cin >> n >> m; for (i = 1; i <= n; i++) { for (j = 1; j <= m; j++) { ...
#include <bits/stdc++.h> using namespace std; const long long e = 1e5 + 110; bool zs[e]; long long num[e]; void sai() { for (long long i = 2; i <= e - 99; i++) { if (zs[i]) continue; for (long long j = i + i; j <= e - 99; j += i) { zs[j] = true; } } for (long long tot = 0...
#include <bits/stdc++.h> using namespace std; int A[(1 << 20) + 4], n; long long store[21][2], INV = 0; long long query(int l, int r, int no) { return (A + r + 1 - upper_bound(A + l, A + r + 1, no)); } void gen(int de, int l, int r) { if (!de) return; gen(de - 1, l, (l + r) / 2); gen(de - 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...
#include <bits/stdc++.h> using namespace std; bool isprime(unsigned long long n) { if (n <= 1) return false; if (n <= 3) return true; if (n % 2 == 0 || n % 3 == 0) return false; for (unsigned long long i = 5; i * i <= n; i = i + 6) if (n % i == 0 || n % (i + 2) == 0) return false; return t...
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e6 + 1e3; long long all[MAXN]; struct node { node *child[2]; node() { child[0] = child[1] = NULL; } }; node *root; deque<short> binary(long long x) { deque<short> ans; while (x) { ans.push_front(x % 2); x /= 2; ...
module \$_DFF_N_ (input D, C, output Q); SB_DFFN _TECHMAP_REPLACE_ (.D(D), .Q(Q), .C(C)); endmodule module \$_DFF_P_ (input D, C, output Q); SB_DFF _TECHMAP_REPLACE_ (.D(D), .Q(Q), .C(C)); endmodule module \$_DFFE_NN_ (input D, C, E, output Q); SB_DFFNE _TECHMAP_REPLACE_ (.D(D), .Q(Q), .C(C), .E(!E)); endmodule mo...
/* * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law...
#include <bits/stdc++.h> using namespace std; const long long INF = 1e18; const long long MOD = 1e9 + 7; template <class T> inline void chmax(T &a, const T &b) { if ((a) < (b)) (a) = (b); } template <class T> inline void chmin(T &a, const T &b) { if ((a) > (b)) (a) = (b); } template <typenam...
#include <bits/stdc++.h> using namespace std; int main() { string num1, num2, num3; int i, j, k, l, m, n, last, flag = 0; cin >> num1; num2 = num1; num3 = num1; l = num1.length(); last = num1.at(l - 1) - 48; for (i = 0; i < l - 1; i++) { m = num2.at(i) - 48; if (m % 2 == ...
/** * 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...
// megafunction wizard: %FIFO% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: dcfifo // ============================================================ // File Name: audio_fifo.v // Megafunction Name(s): // dcfifo // // Simulation Library Files(s): // altera_mf // ============================================...
#include <bits/stdc++.h> #pragma GCC optimize( Ofast ) #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native ) #pragma GCC optimize( unroll-loops ) using namespace std; vector<string> vec[1003], v; bool mat[26][26], flag, ok[26], vis[26], run[26]; int ind[26]; inline bool func(int ...
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2016.4 (win64) Build Wed Dec 14 22:35:39 MST 2016 // Date : Mon Feb 13 12:45:44 2017 // Host : WK117 running 64-bit major release (build ...
#include <bits/stdc++.h> using namespace std; const int b[2] = {1, -1}; int n, m, f[105][55][205][2], ans; char a[200]; int main() { scanf( %s , a); scanf( %d , &n); f[0][0][0][0] = 1; m = strlen(a); for (int i = (0); i <= (m - 1); i++) for (int j = (0); j <= (n); j++) for (i...
#include <bits/stdc++.h> using namespace std; long long ceiling(long long a, long long b) { if (a % b != 0) { return (a / b) + 1; } else return (a / b); } void solve() { long long n, k; cin >> n >> k; long long a[n * k]; for (long long i = 0; i < n * k; i++) { cin >> a[...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
/** * Copyright 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...
//----------------------------------------------------------------------------- // // (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 ...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: AGH // Engineer: Tomasz Kryjak // // Create Date: 11:29:28 10/28/2013 // Design Name: // Module Name: tb_filter // Project Name: // Target Devices: // Tool versions: // Description...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; int main() { int a, b; cin >> a >> b; cout << a + b; 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 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; struct point { int x, y; } a[5], b[5]; int ans; int dis(int i, int j) { int res = (a[i].x - a[j].x) * (a[i].x - a[j].x); return res + (a[i].y - a[j].y) * (a[i].y - a[j].y); } int ok() { map<int, int> mp; for (int i = 1; i < 4; i++) fo...
#include <bits/stdc++.h> using namespace std; long long int det(long long int a, long long int b, int bit) { if (!bit) { if (a & 1) return a; if (b & 1) return b; return a; } if (a & (1ll << bit)) return det(a, b, bit - 1); if (!(b & (1ll << bit))) return det(a, b, bit - 1); if...
#include <bits/stdc++.h> using namespace std; int main() { long long int n; cin >> n; cout << n % 2; }
/* * 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> #pragma GCC diagnostic ignored -Wunused-result #pragma GCC diagnostic ignored -Wsign-compare using namespace std; void solve(); int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int test_case = 1; cin >> test_case; while (test_case--) { solve(...
#include <bits/stdc++.h> using namespace std; int main() { long long n, k = 0, c = -1, x, z; cin >> n; while (true) { c += 1; x = pow(10, c); z = 9 * x; if (n - z > 0) { n -= z; k += (z * (c + 1)); } else { n *= (c + 1); k += n; break...
#include <bits/stdc++.h> using namespace std; const int MAX = 1e5 + 3; struct node { int nonzero, val; void merge(node &n1, node &n2, int range) { if (val) nonzero = range; else nonzero = n1.nonzero + n2.nonzero; } void update(int x) { val += x; } } tree[7 * MAX]; v...
#include <bits/stdc++.h> using namespace std; int main() { double n, k, m, l, a, b, f, d; cin >> n >> k; long long kek = n; double cnt1 = 0, cnt2 = 0; while (kek % 2 == 0) { kek /= 2; cnt1++; } kek = n; while (kek % 5 == 0) { kek /= 5; cnt2++; } cout.p...
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2016.3 (win64) Build Mon Oct 10 19:07:27 MDT 2016 // Date : Wed Sep 27 18:05:24 2017 // Host : vldmr-PC running 64-bit Service Pack 1 ...
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 100; const long double INF = 2e30; struct node { int id; long double da, db, len; node(int _id = 0, long double _da = 0, long double _db = 0, long double _len = 0) { id = _id; da = _da; db = _db; le...
//Com2DocHDL /* :Project FPGA-Imaging-Library :Design MatchTemplateBin :Function Match a binary from template for binary images. It will give the first output after 1 cycle while in_enable enable. :Module Main module :Version 1.0 :Modified 2015-05-25 Copyright (C) 2015 Tianyu Dai (dtysky) <> This library is fr...
#include <bits/stdc++.h> using namespace std; int n, i; int a, b, c, d; vector<long long> v; long long ans; void add(int a, int b) { ans += a - b; v.push_back(a + b); } void add_stack() { if (a + b >= c + d) { add(a, b); add(c, d); return; } if (a > d) add(a - d, d ...
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5; const int mod = 1e9 + 7; long long a[N], n, mx, cnt; vector<int> v, e; long long ans = 1; long long pw(long long a, long long b) { if (b == 0) return 1; long long res = pw(a, b / 2); res = res * res % mod; if (b % 2) res ...
/////////////////////////////////////////////////////////////////////////////// // // Project: Aurora Module Generator version 2.8 // // Date: $Date: 2007/09/28 12:50:36 $ // Tag: $Name: i+HEAD+134158 $ // File: $RCSfile: sym_gen.ejava,v $ // Rev: $Revision: 1.2 $ // // ...
`timescale 1ns / 1ps module top ( // Inouts inout [63:0] ddr3_dq, inout [7:0] ddr3_dqs_n, inout [7:0] ddr3_dqs_p, // Outputs output [13:0] ddr3_addr, output [2:0] ddr3_ba, output ...
#include <bits/stdc++.h> const int M = 1000005; long long f[M]; int A[M]; int n; int Min(int a, int b) { return a < b ? a : b; } int Max(int a, int b) { return a < b ? b : a; } int main() { scanf( %d , &n); for (int i = 1; i <= n; ++i) scanf( %d , A + i); long long ans = 0; A[0] = 1; f...
// // Copyright (c) 2002 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) // ...
// -*- 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...
////////////////////////////////////////////////////////////////////// //// //// //// CLK_DIV2.v //// //// //// //// This file is part of the Ether...
#include <bits/stdc++.h> using namespace std; long long n, m, t[200100], ll, rr, sum; double inv, res, f[200100], g[200100]; inline double calc(long long l, long long r) { while (ll > l) { --ll; inv += 1.0 / t[ll]; sum += t[ll]; res += inv * t[ll]; } while (rr < r) { ++...