text
stringlengths
59
71.4k
// (C) 2001-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 doc...
/* * 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 n, k, p; int dp[105][55]; int modd(int x) { if (x < 0) return x + p; else if (x >= p) return x - p; return x; } int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); cerr.tie(nullptr); ...
#include <bits/stdc++.h> using namespace std; void abc() { cout << endl; } template <typename T, typename... U> void abc(T a, U... b) { cout << a << , abc(b...); } template <typename T> void printv(T l, T r) { while (l != r) cout << *l << n [++l == r]; } template <typename A, typename B>...
#include <bits/stdc++.h> using namespace std; bool vis[305][305]; string s[305]; int len[305][305]; int d[305]; int hs[305][305]; int n; const int mod = 9e8 + 7; int qpow(int x, int y) { long long ret = 1; long long now = x; while (y) { if (y & 1) ret = ret * now % mod; now = n...
#include <bits/stdc++.h> using namespace std; int main(int argc, char const *argv[]) { int cases; cin >> cases; while (cases--) { int length, target; cin >> length >> target; vector<vector<int>> BGR(3, vector<int>(length, 0)); string inp; cin >> inp; for (size_t i = 0...
#include <bits/stdc++.h> using namespace std; struct rect { int x1, y1, x2, y2; }; struct rect a[40001], c[40001]; int b[40001]; int w, h, n, nr; void enter() { scanf( %d%d%d , &w, &h, &n); nr = 1; a[1].x1 = 0; a[1].y1 = 0; a[1].x2 = w; a[1].y2 = h; } void call1(int x1, int...
#include <bits/stdc++.h> using namespace std; int main() { int n, m, r; cin >> n >> m >> r; int s[n], b[m]; for (int i = 0; i < n; i++) cin >> s[i]; for (int i = 0; i < m; i++) cin >> b[i]; sort(s, s + n); sort(b, b + m); int x = r / s[0]; int remind = r % s[0]; int y = x * b...
/** * 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...
// megafunction wizard: %FIFO% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: scfifo // ============================================================ // File Name: altera_primitive_sync_fifo_showahead_97in_97out_32depth.v // Megafunction Name(s): // scfifo // // Simulation Library Files(s): // altera_mf //...
module radio_controller_TxTiming ( clk, reset, Tx_swEnable, TxGain_target, TxGain_rampGainStep, TxGain_rampTimeStep, dly_hwTxEn, dly_TxStart, dly_PowerAmpEn, dly_RampGain, hw_TxEn, hw_TxGain, hw_PAEn, hw_TxStart ); input clk; input reset; input Tx_swEnable; input [0:5] TxGain_target; ...
/** * 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 © 1998-2006 * Henk Barendregt * Luís Cruz-Filipe * Herman Geuvers * Mariusz Giero * Rik van Ginneken * Dimitri Hendriks * Sébastien Hinderer * Bart Kirkels * Pierre Letouzey * Iris Loeb * Lionel Mamane * Milad Niqui * Russell O’Connor * Randy Pollack * Nickolay V. Shmyrev * Bas Spitters * ...
// (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; int nor[200100 * 2], n, t, m, a[200100], b[200100], sola, solb, sol, pcta, pctb; int main() { cin >> n; nor[++t] = 0; for (int i = 1; i <= n; ++i) { cin >> a[i]; nor[++t] = a[i]; } cin >> m; for (int i = 1; i <= m; ++i) { cin ...
// // 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; const double PI = 3.14159265358979323846; const double EPS = 1e-15; const int INF = 1e9 + 7; const long long LINF = 8e18 + 7; const int N = 2e5 + 7; vector<long long> t[4 * N]; int a[N]; long long s[N]; void build(int v, int L, int R) { if (L + 1 == ...
#include <bits/stdc++.h> using namespace std; void solve() { string s, a = , b; cin >> s; unordered_map<string, int> m; m[s]++; for (int i = s.length() - 1; i >= 0; i--) { a += s[i]; b = a; reverse(b.begin(), b.end()); m[b + s.substr(0, i)]++; } cout << m.size()...
#include <bits/stdc++.h> #pragma GCC optimize(3) #pragma GCC optimize(2) using namespace std; const int maxn = 510; const int inf32 = 1e9 + 10; const long long inf64 = 1e18 + 10; const int mod = 998244353; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); 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 law...
#include <bits/stdc++.h> using namespace std; const int MAXN = 9e4; const int INF = 1 << 30; const long long mod = 1e9 + 7; const double eps = 1e-8; int main() { long long a[100] = {0, 4, 10, 20, 35, 56, 83, 116, 155, 198, 244, 292, 341, 390, 439}; long long n; wh...
//******************************************************************************************* //Author: Zhiyoong Foo, Yejoong Kim //Last Modified: Dec 16 2016 //Description: MBus CLK/DATA Swapper // - Generates Data & Clock Flip Interrupt; // - Maintains Last seen Clock...
#include <bits/stdc++.h> using namespace std; double Cnk(int n, int k) { double result = 1; for (int i = 1; i <= k; ++i) { result *= n - k + i; result /= i; } return result; } double Power(int n, int power) { double result = 1; for (int i = 0; i < power; ++i) { result *...
`timescale 1 ns / 1 ps `default_nettype none `define WIDTH 16 module SB_RAM2048x2( output [1:0] RDATA, input RCLK, RCLKE, RE, input [10:0] RADDR, input WCLK, WCLKE, WE, input [10:0] WADDR, input [1:0] MASK, WDATA ); parameter INIT_0 = 256'h00000000000000000000000000000000000000000000000000000...
// megafunction wizard: %RAM: 2-PORT%VBB% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: altsyncram // ============================================================ // File Name: ram_32_128x8_dp_be.v // Megafunction Name(s): // altsyncram // ===========================================================...
/** * 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 Pair { long long f, s; Pair() { f = s = 0; } Pair(long long f, long long s) { this->f = f; this->s = s; } }; const int maxn = 36 + 100; Pair d[maxn][maxn]; int pr[maxn][maxn]; long long _10(int); void print(int, int); int...
#include <bits/stdc++.h> using namespace std; template <class T> inline void cmn(T &a, const T &b) { if (b < a) a = b; } template <class T> inline void cmx(T &a, const T &b) { if (b > a) a = b; } const double eps = 1e-9; const long double leps = 1e-14; string inp; const int MN = 1000 + 100...
#include <bits/stdc++.h> using namespace std; int main() { int n = 0, m = 0, z = 0, res = 0; cin >> n >> m >> z; for (int i = 1; i <= z; i++) if (i % n == 0 && i % m == 0) res++; cout << res; return 0; }
#include <bits/stdc++.h> using namespace std; const int INF = 2147483647; const double PI = 3.141592653589793; const int N = 40005; map<pair<int, int>, int> mapa; int n, m, k, t, a, b, c, pocz[N], waste[N], r, i; int main() { scanf( %d %d %d %d , &n, &m, &k, &t); for (i = 0; i < n; i++) waste[i] =...
// generated by gen_VerilogEHR.py using VerilogEHR.mako // Copyright (c) 2019 Massachusetts Institute of Technology // 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...
#include <bits/stdc++.h> using namespace std; int mx1, my1, mx2, my2; string in; int main() { ios::sync_with_stdio(0); cin >> in; mx1 = in[0] - a + 1; my1 = in[1] - 0 ; cin >> in; mx2 = in[0] - a + 1; my2 = in[1] - 0 ; cout << max(abs(mx1 - mx2), abs(my1 - my2)) << endl; ...
#include <bits/stdc++.h> using namespace std; template <class T> T abs(T x) { return x > 0 ? x : (-x); } template <class T> T sqr(T x) { return x * x; } const int maxn = 1000 * 1000 * 2; const int BUBEN = 40; long long fib[BUBEN]; int a[maxn]; int n; long long X, Y; long long P; st...
#include <bits/stdc++.h> using namespace std; int main() { int n, m, k; string s; int x; cin >> n >> m >> k; int a[n][m]; int b[n][m]; int c[n][m]; for (int i = 0; i < n; i++) { cin >> s; for (int j = 0; j < m; j++) { cin >> x; a[i][j] = x; cin >> ...
#include <bits/stdc++.h> using namespace std; int n, mini = 0, maxi = 0; int x[200005]; bool o[200005]; int main() { cin >> n; for (int i = 0; i < (n); i++) { int a; cin >> a; x[a]++; } for (int i = 0; i < (n + 1); i++) { while (i < n + 1 && x[i] == 0) i++; if (i ...
#include <bits/stdc++.h> using namespace std; char s[100050]; bool vis; int main() { scanf( %s , s + 1); int len = strlen(s + 1); if (len <= 2) { printf( No n ); return 0; } for (int i = 1; i <= len - 2; i++) { if (s[i] != s[i + 1] && s[i + 1] != s[i + 2] && s[i] != s[i + 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...
#include <bits/stdc++.h> using namespace std; const int oo = (int)1e9; const double PI = 2 * acos(0.0); const double eps = 1e-9; int n, m; vector<int> len; vector<pair<int, int> > pos; deque<int> ans; vector<bool> vis; int find(int x) { for (int i = 0; i < (int)len.size(); ++i) { if (len[i...
#include <bits/stdc++.h> using namespace std; const double sn = 1e-6; int n, k; char arr[55][10]; string s[55]; string res[55]; int main() { scanf( %d%d , &n, &k); for (int i = 0; i < n - k + 1; i++) { scanf( %s , arr[i]); string st(arr[i]); s[i] = st; } string val = Aa ...
#include <bits/stdc++.h> using namespace std; const int N = 101000; int n, m, k[N], g[50][50], cnt[50], tmp[50]; vector<pair<int, int> > v[N]; inline int gcd(int first, int second) { return (!second) ? first : gcd(second, first % second); } inline void init() { int i, j; for (i = 1; i <= 40; +...
#include <bits/stdc++.h> using namespace std; template <typename T> inline void read(T &f) { f = 0; T fu = 1; char c = getchar(); while (c < 0 || c > 9 ) { if (c == - ) fu = -1; c = getchar(); } while (c >= 0 && c <= 9 ) { f = (f << 3) + (f << 1) + (c & 15); ...
/** * 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 a, b, c, d, e, i, j, ii, jj, zx, xc, p[10009], ji, F[10009], G[10009]; pair<int, int> k[10009]; vector<int> v; vector<int>::iterator it; int ask(int q, int w) { int qw = 0; cout << ? << q << << w << endl; cin >> qw; return qw; } in...
/** * ------------------------------------------------------------ * Copyright (c) All rights reserved * SiLab, Institute of Physics, University of Bonn * ------------------------------------------------------------ */ `timescale 1ps/1ps `default_nettype none module seq_gen #( parameter BASEADDR = 16'h0000, ...
`timescale 1ns / 1ns module udp_rxq (input clk, input [7:0] rxd, input rxdv, input rxlast, output [7:0] qrxd, output qrxdv, output qrxlast); // this module accepts the off-the-wire UDP payload and buffers it until // we can determine if this was a valid UDP payload or not. (i.e., if the // ethernet FCS matched, an...
/** * 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...
// niosii_nios2_gen2_0.v // This file was auto-generated from altera_nios2_hw.tcl. If you edit it your changes // will probably be lost. // // Generated using ACDS version 15.1 185 `timescale 1 ps / 1 ps module niosii_nios2_gen2_0 ( input wire clk, // ...
/* * 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...
module PushButton_Debouncer#(parameter COUNTER_WIDTH = 16) ( input wire clk, input wire PB, // "PB" is the glitchy, asynchronous to clk, active low push-button signal // from which we make three outputs, all synchronous to the clock output reg PB_state, // 1 as long as the push-button is active (down...
#include <bits/stdc++.h> using namespace std; priority_queue<int> a, b; int c = 0; int main() { int n; cin >> n; for (int i = 0; i < n; i++) { int x; cin >> x; a.push(x); } cin >> n; for (int i = 0; i < n; i++) { int x; cin >> x; b.push(x); } 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; const int mod = 1e9 + 7, maxn = 1e6 + 6; int n, m, k, x, res = 1, fact[maxn]; map<vector<int>, int> f; vector<int> a[maxn]; int main() { fact[0] = 1; for (int i = 1; i < maxn; ++i) fact[i] = 1LL * fact[i - 1] * i % mod; scanf( %d%d , &n, &m); for...
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, d, e, f, mn1, mn2, res, ans1, ans2; cin >> a >> b >> c >> d >> e >> f; res = d; mn2 = min(b, min(c, d)); d = abs(mn2 - d); mn1 = min(a, d); ans1 = (mn2 * f) + (mn1 * e); mn1 = min(a, res); res = abs(mn1 - res...
#include <bits/stdc++.h> using namespace std; const long long mod = 1e9 + 7; const long long N = 1e5 + 5; map<long long, long long> freq, freq2; void func1(long long a[], long long n) { int i = 0, j = 0; while (i < n) { if (a[i] == 0) { i++; continue; } j = i; w...
///////////////////////////////////////////////////////////// // Created by: Synopsys DC Expert(TM) in wire load mode // Version : L-2016.03-SP3 // Date : Mon Oct 17 14:00:22 2016 ///////////////////////////////////////////////////////////// module FSM_Add_Subtract ( clk, rst, rst_FSM, beg_FSM, zero_flag_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; int n; string name[1001]; int fen[1001]; vector<pair<string, int> > old; vector<pair<int, string> > xin; vector<int> ff; int main(int argc, char *argv[]) { cin >> n; for (int i = 0; i < n; i++) { cin >> name[i] >> fen[i]; old.push_back(ma...
#include <bits/stdc++.h> using namespace std; const int maxn = 2005, maxv = 4e6 + 5; long long a, b, c, X1, X2, Y1, Y2; pair<long double, long double> va[6], vb[6]; void exgcd(long long a, long long b, long long &x, long long &y) { if (!b) { x = 1, y = 0; return; } exgcd(b, a % b, y, x...
// ========== Copyright Header Begin ========================================== // // OpenSPARC T1 Processor File: sparc_tlu_dec64.v // Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved. // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES. // // The above named program is free software; you can redistribute it a...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n; cin >> n; vector<int> a(2 * n); for (auto &it : a) cin >> it; vector<int> kop(n); vector<int> ARR; for (int i = 0; i < 2 * n; ++i) { if (!kop[a[i] - 1]) { ...
#include <bits/stdc++.h> using namespace std; int a, b, xa, ya, xb, yb; int main() { scanf( %d%d%d%d%d%d , &a, &b, &xa, &ya, &xb, &yb); a <<= 1, b <<= 1; int x1 = (xa + ya), y1 = (xa - ya), x2 = (xb + yb), y2 = (xb - yb); int sector_1_x = (x1 / a) - (x1 < 0), sector_1_y = (y1 / b) - (y1 < 0); ...
#include <bits/stdc++.h> using namespace std; const int mod = 1000000007; const int maxn = 100010; const int INF = ~0U >> 1; const double eps = 1e-9; void getint(int &ret) { char ch; while (ch = getchar(), ch < 0 || ch > 9 ) ; ret = ch - 0 ; while (ch = getchar(), ch >= 0 && ch <...
// ------------------------------------------------------------- // // Generated Architecture Declaration for rtl of inst_ef_e // // Generated // by: wig // on: Mon Mar 22 13:27:59 2004 // cmd: H:\work\mix_new\mix\mix_0.pl -strip -nodelta ../../mde_tests.xls // // !!! Do not edit this file! Autogenerated by MIX !!...
//altpll bandwidth_type="AUTO" CBX_DECLARE_ALL_CONNECTED_PORTS="OFF" clk0_divide_by=5000 clk0_duty_cycle=50 clk0_multiply_by=1 clk0_phase_shift="0" compensate_clock="CLK0" device_family="Cyclone IV E" inclk0_input_frequency=20000 intended_device_family="Cyclone IV E" lpm_hint="CBX_MODULE_PREFIX=Display_PLL" operation_m...
#include <bits/stdc++.h> using namespace std; int main() { int n, l; cin >> n >> l; double a[n]; for (int i = 0; i < n; i++) cin >> a[i]; sort(&a[0], &a[n]); float x = a[0] - 0; float y = l - a[n - 1]; for (int i = 0; i < n - 1; i++) a[i] = (a[i + 1] - a[i]) / 2; if (x > y) ...
module Proc; // Declare global parameters parameter WIDTH = 32; parameter NUMREG = 16; parameter MEMSIZE = (1<<13); // Declare storage elements in ISA reg[7:0] MEM[0:MEMSIZE-1]; //main memory reg[WIDTH-1:0] R[0:NUMREG-1]; //General purpose registers reg[WIDTH-1:0] PC; //Program Counter reg[WIDTH-1:0] IR; //...
/** * 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; typedef long long ll; typedef pair<ll,ll> pi; typedef vector <ll> vi; typedef vector <pi> vpi; typedef pair<pi,ll> pii; typedef set <ll> si; typedef long double ld; #define f first #define s second #define FOR(i,s,e) for(ll i=s;i<=ll(e);++i) #defi...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(NULL); long long t; cin >> t; while (t--) { long long a; cin >> a; long long b; cin >> b; if (b >= a) { if (b % a == 0 && pow(2, (long long)log2(b / a)) == b / a...
/* * * Copyright (c) 2011 * * * * 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 the ...
// megafunction wizard: %ROM: 1-PORT% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: altsyncram // ============================================================ // File Name: sine.v // Megafunction Name(s): // altsyncram // // Simulation Library Files(s): // altera_mf // ===================================...
module xillyvga #( parameter C_S_AXI_DATA_WIDTH = 32, parameter C_S_AXI_ADDR_WIDTH = 32, parameter C_M_AXI_ADDR_WIDTH = 32, parameter C_M_AXI_DATA_WIDTH = 32, parameter C_S_AXI_MIN_SIZE = 32'h000001ff, parameter C_USE_WSTRB = 1, parameter C_DPHASE_TIMEOUT = 8, parameter C_BASEADDR = 32'...
///////////////////////////////////////////////////////////////////// //// //// //// WISHBONE revB.2 compliant I2C Master controller Top-level //// //// //// //// ...
#include <bits/stdc++.h> using namespace std; int main() { int h, w, x, y, star = 0, sum, flag; char arr[505][505]; cin >> h >> w; for (int i = 1; i <= h; i++) { for (int j = 1; j <= w; j++) { cin >> arr[i][j]; if (arr[i][j] == * ) { star++; if (arr[i][j - ...
#include <bits/stdc++.h> using namespace std; inline long long mod(long long n, long long m) { long long ret = n % m; if (ret < 0) ret += m; return ret; } long long gcd(long long a, long long b) { return (b == 0 ? a : gcd(b, a % b)); } long long exp(long long a, long long b, long long m) { if ...
`include "defines.v" // Do not touch these otherwise the implementation will break `define dir_east 1'b1 `define dir_west 1'b0 `define dir_north 1'b0 `define dir_south 1'b1 `define wrap_offset 1'b1 module RouteCompute( input `control_w control_in, input `addrx_w addrx, input ...
#include <bits/stdc++.h> int mod = 1000000007; const int M = INT_MAX; using namespace std; int powb(int x, int y) { int res = 1; x = x % M; while (y > 0) { if (y % 2) res = (res * x) % M; y /= 2; x = (x * x) % M; } return res; } int gcd(int a, int b) { if (b == 0) r...
#include <bits/stdc++.h> using namespace std; long long n, ara[500005], k, ara2[500005]; int32_t main() { ios_base::sync_with_stdio(false); cin.tie(0); long long l, h, i, j, m, z, t, o, a, b; cin >> n >> k; a = 0; for (i = 0; i < n; i++) cin >> ara[i]; l = 1; h = 10000000000; z...
// Code your design here module main(); reg [31:0] x, y, newx; reg real alpha [0:15]; reg real powers [0:16]; reg real currangle, x_out, y_out; integer i; reg real AG_CONST, AG; initial begin AG_CONST = 1.20;///0.; AG = 2458; x = AG; y = 0; alpha[0] = 0; alpha[1] = 31.4...
#include <bits/stdc++.h> using namespace std; long long int n, u, v; vector<int> arr[100001]; long double ans = 0.0; long long int siz[100001]{0}; void dfs(int to, int from, int val) { int ret = 1; ans += 1.0 / val; for (auto i : arr[to]) { if (i != from) { dfs(i, to, val + 1); ...
/*************************************************************************************************** ** fpga_nes/hw/src/cpu/apu/apu_envelope_generator.v * * Copyright (c) 2012, Brian Bennett * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are permitted * p...
// File: RAMConcur_TBV.v // Generated by MyHDL 0.10 // Date: Wed Jun 27 01:12:16 2018 `timescale 1ns/10ps module RAMConcur_TBV ( ); // Verilog Only Testbench for `RAMConcur` reg [3:0] addr = 0; wire [3:0] dout; reg clk = 0; reg [3:0] din = 0; reg writeE = 0; reg [3:0] RAMConcur0_0_1_2_memory [0:4-1]; initial be...
#include <bits/stdc++.h> using namespace std; bool prime(long long x) { if (x == 2) return 1; if (x % 2 == 0) return 0; for (long long j = 3; j * j <= x; j += 2) { if (x % j == 0) return 0; } return 1; } int main() { long long t; cin >> t; while (t--) { long long n, m...
#include <bits/stdc++.h> using namespace std; int main() { int n, a, b, m = 0, c = 0; scanf( %d , &n); while (n--) { scanf( %d%d , &a, &b); if (a > b) { m++; } else if (a < b) { c++; } } if (m > c) { printf( Mishka ); } else if (m < c) { pr...
#include <bits/stdc++.h> using namespace std; const long long INFLL = 2 * (long long)1e18 + 100; const long long INFINT = 2 * (long long)1e9 + 100; const double PI = atan(1) * 4; const double EPS = 1e-6; const long long SEED = (long long)1e3 + 7; const long long MOD = 998244353; const long long NMAX = (...
#include <bits/stdc++.h> using namespace std; long long n, m, x, y, a, b; int main() { cin >> n >> m >> x >> y >> a >> b; long long W = min(n, (m * a) / b); long long divA = a, divB = b; for (long long i = 2; i * i <= divB; i++) { while (divB % i == 0) { if (divA % i == 0) { ...
/* Title: Homework 1 * Description: Homework assignment #1 for EET-4020 * Author: Sergiy Kolodyazhnyy * Date: 2/23/2017 * */ /* #1: Create your own 2-input verilog gates * called my_or,my_and,and my_not from 2-input nand gates. */ module my_and(C,A,B); // Output definitions output C; input A,...
////////////////////////////////////////////////////////////////////// //// //// //// dbg_comm_vpi.v //// //// //// //// ...
#include <bits/stdc++.h> using namespace std; int main() { int n; scanf( %d , &n); vector<int> A(n); for (int& a : A) scanf( %d , &a); sort(A.begin(), A.end()); int m = A[n - 1]; vector<bool> B(m + 2); for (int a : A) { if (a > 1 && !B[a - 1]) B[a - 1] = true; els...
#include <bits/stdc++.h> using namespace std; int n, m; string s; string change(string s, int l, int r, char c1, char c2) { for (int i = l - 1; i < r; i++) { if (s[i] == c1) { s[i] = c2; } } return s; } int main() { cin >> n >> m; cin >> s; for (int i = 0; i < m; ...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; const int maxn = 1e3 + 20; bool A[maxn][maxn]; int d[maxn]; vector<pair<int, int> > ans; void solve(set<int> &a) { if ((int)a.size() == 1) { int k = *a.begin(); for (int i = 0; i < k + 1; i++) for (int j = i + 1; j < k + 1; j++) A[i][j] =...
#include <bits/stdc++.h> using namespace std; int sdf[30] = {4, 22, 27, 58, 85, 94, 121, 166, 202, 265, 274, 319, 346, 355, 378, 382, 391, 438, 454, 483, 517, 526, 535, 562, 576, 588, 627, 634, 636, 645}; long long int a[71720], b, c, d, n, m, i, j, k, sum, sumend; bool ...
/** * 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 top; reg pass; real rarr [1:0]; reg [2:0] arr [1:0]; integer index; integer base; reg [3*8:1] res; initial begin pass = 1'b1; rarr[0] = 1.0; rarr[1] = 2.0; arr[0] = 1; arr[1] = 2; base = 0; // Check an in range word select. index = 0; $sformat(res, "%3.1f", rar...
#include <bits/stdc++.h> using namespace std; int n; int n1, n2, n3, n4, n5, n6, n7; int a, b, c; void doA(int i) { if (n1 >= i) n1 -= i; else n1 = 0; } void doB(int i) { if (n2 >= i) n2 -= i; else { doA(i - n2); n2 = 0; } } void doC(int i) { if (n...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 18:34:18 10/12/2013 // Design Name: // Module Name: Logica_Bola // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencies: /...
#include <bits/stdc++.h> using namespace std; const int N = 10, M = 1e6 + 7, K = 200, p = 1e9 + 7; int n, e[N], s[M], wf[K], q[N][K], f[N][N], ans[N][M]; bitset<40> op, wq[N][M]; unordered_map<bitset<40>, int> rt[N]; inline int read() { int num = 0; char g = getchar(); while (g < 48 || 57 < g) g...
#include <bits/stdc++.h> const int maxn = 4e5 + 10; const int maxm = 2e5 + 10; const int inf = 0x3f3f3f3f; const long long mod = 1e9 + 7; const double eps = 1e-7; using namespace std; long long cnt[25][25], dp[1 << 21]; int n; vector<int> col[25]; int main() { ios::sync_with_stdio(false); ci...