text
stringlengths
59
71.4k
#include <bits/stdc++.h> using namespace std; void fast() { ios_base::sync_with_stdio(false); cin.tie(NULL); } map<int, int> mpi; map<string, int> mps; map<int, vector<int> > path; map<int, int> visited; set<int> st; vector<int> v; map<int, int>::iterator iti; map<string, int>::iterator it...
module salu_tb(); reg clk; reg rst; reg issue_alu_select, exec_rd_scc_value; reg[5:0] issue_wfid; reg[11:0] issue_source_reg1, issue_source_reg2, issue_dest_reg; reg[15:0] issue_imm_value; reg[31:0] exec_rd_m0_value, issue_instr_pc, issue_opcode; reg[63:0] sgpr_source2_data, sgpr_source1_data, ex...
`timescale 1ns/1ns module sigma_delta (input c_mod, // modulation clock input mod_bit, // data bit from the modulator input c, // the clock for the rest of the chip input invert, output [15:0] raw_d, // raw ADC word output raw_dv, output [15:0] d, // filtered ADC word (dumb for now) output dv); w...
// megafunction wizard: %ROM: 1-PORT% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: altsyncram // ============================================================ // File Name: phd_new.v // Megafunction Name(s): // altsyncram // // Simulation Library Files(s): // altera_mf // ================================...
module nh_lcd_command ( input rst, input clk, output [31:0] debug, //Control Signals input i_cmd_write_stb, input i_cmd_read_stb, input [7:0] i_cmd_data, output reg [7:0] o_cmd_data, input i_enable, input ...
#include <bits/stdc++.h> using namespace std; const int N = 300010; int t, n, x[N], y[N]; long long a[N], val[N]; int main() { cin >> t; while (t--) { scanf( %d , &n); long long sum = 0; for (int i = 1; i <= n; ++i) { scanf( %lld , a + i); sum += a[i]; } i...
#include <bits/stdc++.h> using namespace std; const int N = 105; int v[N], ans[N]; int main() { cin.tie(0), ios_base::sync_with_stdio(false); int n, k, s = 0; cin >> n >> k; for (int i = 0; i < n; i++) cin >> v[i], s += v[i], ans[i % k] += v[i]; int tans = 0; for (int i = 0; i < k; i++) ...
// 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 : Wed May 31 20:15:04 2017 // Host : GILAMONSTER running 64-bit major release (...
#include <bits/stdc++.h> using namespace std; long long powmod(long long p, long long n) { if (n == 0) return 1; if (n % 2 == 1) return (p * powmod(p, n - 1)) % 1000000007; long long z = powmod(p, n / 2); return (z * z) % 1000000007; } int main() { ios_base::sync_with_stdio(false); cin.t...
#include <bits/stdc++.h> using namespace std; int n, m, k; long long num[5005], sum[5005], dp[5005][5005]; int main() { int i, j; while (scanf( %d%d%d , &n, &m, &k) != EOF) { for (i = 0; i < n; i++) { scanf( %I64d , &num[i]); } memset(sum, 0, sizeof(sum)); for (i = 0; i <...
`default_nettype none module main (input sysclk, input clk, input rst, output c0, output c1, output c2, output c3, output c4, output c5, output c6, output c7); //-- Configure the pull-up r...
#include <bits/stdc++.h> using namespace std; const int maxN = 1e5 + 9, maxV = 536, MOD = 1e9 + 7, AND = (1 << 20) - 1, lg = 21; vector<int> farg[maxN], adj[maxN], adjc[maxN], elems[maxN]; int incom[maxN], comp[maxN], idx; set<pair<int, int> > mys; stack<int> stc; bool vi[maxN]; void dfs(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...
/* * Front-end instruction pre-fetch unit with umi master interface * Copyright (C) 2013 Charley Picker <> * * This file is part of the Zet processor. This processor is free * hardware; you can redistribute it and/or modify it under the terms of * the GNU General Public License as published by the F...
#include <bits/stdc++.h> using namespace std; const int maxn = 55; const int maxm = 2e4 + 5; int a[maxn][maxm], dp[maxm], nxt[maxm], sum[maxn][maxm]; int pre[maxm], suff[maxm]; int n, m, k; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cin >> n >> m >> k; for (int i = 0; i <=...
// -*- Mode: Verilog -*- // Filename : wb_ram_xilinx_bank.v // Description : Bank of Xilinx BRAMs // Author : Philip Tracton // Created On : Tue Jan 3 15:24:54 2017 // Last Modified By: Philip Tracton // Last Modified On: Tue Jan 3 15:24:54 2017 // Update Count ...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(NULL); int n, k, p, x, y; cin >> n >> k >> p >> x >> y; vector<int> a(n); int sum = 0; for (int i = 0; i < k; i++) { cin >> a[i]; sum += a[i]; } if (sum + n - k > x) { ...
module dispatcher_wrapper (/*AUTOARG*/ // Outputs dispatch2cu_wf_dispatch, dispatch2cu_wg_wf_count, dispatch2cu_wf_size_dispatch, dispatch2cu_sgpr_base_dispatch, dispatch2cu_vgpr_base_dispatch, dispatch2cu_wf_tag_dispatch, dispatch2cu_lds_base_dispatch, dispatch2cu_start_pc_dispatch, ldssize_out, vreg...
/******************************************************************************* * 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 with non-Xilinx ...
#include <bits/stdc++.h> using namespace std; inline long long power(long long a, long long b) { long long x = 1; a = a % 1000000007ULL; while (b) { if (b & 1) x = (x * a) % 1000000007ULL; a = (a * a) % 1000000007ULL; b >>= 1; } return x; } inline long long inv(long long a)...
#include <bits/stdc++.h> using namespace std; void warp() { cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false); } long long get(vector<long long> &a, vector<long long> &b) { long long ans = 0; long long all = 0; long long n = a.size(); for (long long i = 0; i < n; i++) all += ...
#include <bits/stdc++.h> using namespace std; int arr[100005]; int reduce(int n) { while (n % 2 == 0) n /= 2; while (n % 3 == 0) n /= 3; return n; } int main() { int n; scanf( %d , &n); for (int i = 0; i < n; i++) { scanf( %d , &arr[i]); } int r = reduce(arr[0]); bool...
//***************************************************************************** // DISCLAIMER OF LIABILITY // // This file contains proprietary and confidential information of // Xilinx, Inc. ("Xilinx"), that is distributed under a license // from Xilinx, and may be used, copied and/or disclosed only // pursuant to the...
/* * 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...
#include <bits/stdc++.h> using namespace std; const long long linf = 1e18 + 5; const int mod = (int)1e9 + 7; const int logN = 17; const int inf = 1e9; const int N = 2e5 + 5; int temp[1 << 7][1 << 7], res[1 << 7][1 << 7], cur[1 << 7][1 << 7], x; void mul(int res[][1 << 7], int cur[][1 << 7], int t) { ...
/////////////////////////////////////////////////////// // Copyright (c) 2009 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 // // http://www.apache.org...
#include <bits/stdc++.h> using namespace std; int main() { int n; string s; cin >> n; cin >> s; int count = 0; for (int i = 0; i < n; i++) { if (s[i] == 8 ) { count++; } } int a = n / 11; if (count >= a) { cout << a; } else { cout << count; ...
/* Copyright (c) 2014-2018 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, distri...
/** * 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 = 500008; int n, m, cnt; int day[] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; int get(int x) { int ret = 0; for (int i = 0; i < x; ++i) ret += day[i]; return ret; } struct Node { int year, month, date; int hour, m...
#include <bits/stdc++.h> using namespace std; int N; int main() { cin >> N; int dec[2 * N]; int all_round_down = 0; int z = 0; for (int i = 0; i < 2 * N; i++) { double x; cin >> x; dec[i] = int((x + 0.0005 - int(x + 0.0005)) * 1000); all_round_down += dec[i]; if (...
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 11; const long long MOD0 = 1e9 + 7; const long long P0 = 37; const long long MOD1 = 1e9 + 9; const long long P1 = 49; long long a[N], b[N]; long long h1[2][N], h2[2][N], s[2][N]; long long m, n; map<int, bool> ans; int getnext(int p...
#include <bits/stdc++.h> using namespace std; struct sgmnt { long long L, R; int mxL, mxR, w; sgmnt() {} sgmnt(long long L, int mxL, long long R, int mxR, int w) : L(L), mxL(mxL), R(R), mxR(mxR), w(w) {} }; const int MAXN = 3 * 1000 * 100 + 10; long long arr[MAXN]; sgmnt seg[MAXN * 4...
#include <bits/stdc++.h> using namespace std; int main() { int n, h; cin >> n; int a[n]; cin >> a[0]; h = a[0]; for (int i = 1; i < n; i++) { cin >> a[i]; h = h + abs(a[i] - a[i - 1]) + 1; } cout << h + n; }
#include <bits/stdc++.h> #pragma GCC optimize( Ofast ) #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx ) using namespace std; bool is_prime(long long n) { for (long long i = 2; i * i <= n; ++i) { if (n % i == 0) { return false; } } return true; } vector<long long>...
/* * ALU. * * AI and BI are 8 bit inputs. Result in OUT. * CI is Carry In. * CO is Carry Out. * * op[3:0] is defined as follows: * * 0011 AI + BI * 0111 AI - BI * 1011 AI + AI * 1100 AI | BI * 1101 AI & BI * 1110 AI ^ BI * 1111 AI * */ `timescale 1ns / 1ps module ALU( clk, op, right, A...
#include <bits/stdc++.h> using namespace std; int n, m, x, y, z, k, w, ans; int A[400], B[400]; char c[2]; int main() { scanf( %d , &n); for (int i = (0); i < (n); i++) { scanf( %s%d%d , &c, &x, &y); if (c[0] == M ) { for (int j = (x); j <= (y); j++) A[j]++; } else { ...
module fifo_full_block (/*AUTOARG*/ // Outputs wr_fifo_full, wr_fifo_progfull, wr_addr, wr_gray_pointer, // Inputs reset, wr_clk, wr_rd_gray_pointer, wr_write ); parameter AW = 2; // Number of bits to access all the entries //########## //# INPUTS //########## input reset; ...
`include "project_defines.v" module seeed_tft #( parameter BUFFER_SIZE = 12 )( input rst, input clk, output [31:0] debug, input i_soft_tearing, input [7:0] i_tearing_r...
////////////////////////////////////////////////////////////////////// //// //// //// MAC_tx_addr_add.v //// //// //// //// This file is part of the Ether...
// megafunction wizard: %LPM_DIVIDE% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: LPM_DIVIDE // ============================================================ // File Name: usint_div.v // Megafunction Name(s): // LPM_DIVIDE // // Simulation Library Files(s): // lpm // =====================================...
/** * 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; mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count()); long long power(long long b, long long e, long long m) { if (e == 0) return 1; if (e & 1) return b * power(b * b % m, e / 2, m) % m; return power(b * b % m, e / 2, m); } long...
module test #( parameter integer i1 = 1.0, i2 = 2, parameter [7:0] v1 = 3.0, v2 = 4, parameter real r1 = 5.0, r2 = 6, parameter u1 = 7.0, u2 = 8'd8 )( ); parameter integer i3 = 1.0, i4 = 2; parameter [7:0] v3 = 3.0, v4 = 4; parameter real r3 = 5.0, r4 = 6; parameter u3 = 7.0, u4 =...
/*============================================================================ This Verilog source file is part of the Berkeley HardFloat IEEE Floating-Point Arithmetic Package, Release 1, by John R. Hauser. Copyright 2019 The Regents of the University of California. All rights reserved. Redistribution an...
`include "assert.vh" module cpu_tb(); reg clk = 0; // // ROM // localparam MEM_ADDR = 6; localparam MEM_EXTRA = 4; localparam STACK_DEPTH = 7; reg [ MEM_ADDR :0] mem_addr; reg [ MEM_EXTRA-1:0] mem_extra; reg [ MEM_ADDR :0] rom_lower_bound = 0; reg [ MEM_ADDR :...
// file: clk_wiz_v3_6_tb.v // // (c) Copyright 2008 - 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 // laws. // // DISCLAIMER // This disclaimer is ...
#include <bits/stdc++.h> using namespace std; const int maxn = 305; int n, m; inline int gi() { char c = getchar(); while (c < 0 || c > 9 ) c = getchar(); int sum = 0; while ( 0 <= c && c <= 9 ) sum = sum * 10 + c - 48, c = getchar(); return sum; } const int Maxn = 605, Maxm = Maxn ...
`timescale 1ns / 1ps `define intN 32 `define addrN 4 `include "primitives.v" `include "tests_stream_compute_fn.v" `include "array.v" module tests_stream_compute_fn_tb; localparam N = 16; `wire(Array, (`addrN, `intN), arr); wire `intT res; integer write_seed = 21; integer read_seed = 42; `reg...
module brush_motor_driver( // Qsys bus interface input rsi_MRST_reset, input csi_MCLK_clk, input [31:0] avs_ctrl_writedata, output [31:0] avs_ctrl_readdata, input [3:0] avs_ctrl_byteenable, input [2:0] avs_ctrl_address, input avs_ctrl_write, input avs_ctrl_read, output ...
#include <bits/stdc++.h> using namespace std; const int INF = 1e9 + 5; int n, m; vector<vector<pair<int, int>>> adj; vector<int> dist, color; void bfs(int v) { queue<int> q; q.push(v); while (!q.empty()) { int u = q.front(); q.pop(); for (auto it : adj[u]) { int to = it...
/** * 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...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2003 by Wilson Snyder. `timescale 1ns / 1ps module t_chg (/*AUTOARG*/ // Outputs passed, // Inputs clk, fastclk ); input clk; input fastclk; // surefire lint_off...
#include <bits/stdc++.h> using namespace std; using LL = long long; using LD = long double; using ULL = unsigned long long; template <class T1, class T2> using P = pair<T1, T2>; using PII = P<int, int>; using PLL = P<LL, LL>; using PLD = P<LD, LD>; template <class T> using V = vector<T>; using V...
`timescale 1ns / 1ps `default_nettype none ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 04:12:55 07/16/2013 // Design Name: // Module Name: fpga // Project Name: // Target Devices: // Tool versions: // Description: // // D...
module TOP(CLK, RST, IN, IN2, reg1, OUT); input CLK, RST, IN, IN2; reg reg1,reg2,reg3; output reg1,OUT; wire in1; wire OUT; wire IN; wire IN2; always @(posedge CLK or negedge RST) begin if(RST) begin reg1 <= 1'b0; end else begin reg1 <= IN; end end always @(posedge CLK or neged...
#include <bits/stdc++.h> using namespace std; int main() { long long k, b, n; long long z = 1, t; cin >> k >> b >> n >> t; for (int i = 0; i < n; i++) { if (z > t) { cout << n - i + 1 << endl; return 0; } z = z * k + b; } if (z <= t) cout << 0 << endl;...
/* * Copyright (c) 2000 Chris Lattner * * 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) * any...
#include <bits/stdc++.h> using namespace std; template <typename T1, typename T2> inline void chkmin(T1 &first, T2 second) { if (first > second) first = second; } template <typename T1, typename T2> inline void chkmax(T1 &first, T2 second) { if (first < second) first = second; } const string Fil...
#include <bits/stdc++.h> using namespace std; bool sortbysec(const pair<int, int> &a, const pair<int, int> &b) { return (a.second < b.second); } long long gcd(long long a, long long b) { if (b == 0) return a; return gcd(b, a % b); } long long lcm(long long a, long long b) { return (a * b) / gcd(...
//Legal Notice: (C)2017 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...
/* * 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 //////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 11.06.2015 12:30:30 // Design Name: // Module Name: testcase_basic // Project Name: // Target Devices: // Tool Versions: // Description: // // Dependencies: // // Revision...
#include <bits/stdc++.h> using namespace std; using namespace std::chrono; long long gcd(long long a, long long b) { if (b == 0) { return a; } else { return gcd(b, a % b); } } void change(map<long long, long long> &m, long long n) { long long i; for (long long i = 1; i < n + 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...
// -------------------------------------------------------------------- // -------------------------------------------------------------------- // Module: timer.v // Description: Wishbone based Timer // Phase accumulator clock: // Fo = Fc * N / 2^bits // here N: 12507 and bits: 33 // it gives a frequen...
#include <bits/stdc++.h> using namespace std; long long dp[100050][205]; int redpac[100050][4]; int e[100050]; bool cmp(int x, int y) { return redpac[x][0] < redpac[y][0]; } int main() { int n, m, k, cur = 0; long long ans = -1; priority_queue<pair<int, pair<int, int> > > availablepackets; s...
// (C) 2001-2011 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...
module stimulus (output reg A, B); initial begin {A, B} = 2'b00; #10 {A, B} = 2'b01; #10 {A, B} = 2'b10; #10 {A, B} = 2'b11; end endmodule module scoreboard (input Y, A, B); function truth_table (input a, b); reg [1:0] gate_operand; reg gate_output; begin gate_operand[1:0] = {a,...
#include <bits/stdc++.h> using namespace std; const long long mod = 1000000007; const long long inf = 1e14; long long gcd(long long a, long long b) { return (b == 0 ? a : gcd(b, a % b)); } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); long long n, ans = 0; c...
#include <bits/stdc++.h> using namespace std; vector<pair<int, int> > v; int main(void) { int n, m, a, b; scanf( %d%d , &n, &m); for (int i = 0; i < m; i++) { scanf( %d%d , &a, &b); v.push_back(make_pair(b, a)); } sort(v.rbegin(), v.rend()); long long ans = 0; int i = 0; ...
// // 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; template <class T> int getbit(T s, int i) { return (s >> i) & 1; } template <class T> T onbit(T s, int i) { return s | (T(1) << i); } template <class T> T offbit(T s, int i) { return s & (~(T(1) << i)); } template <class T> int cntbit(T s...
#include <bits/stdc++.h> using namespace std; int n, m; vector<int> edge[110000]; vector<pair<int, int> > R; set<int> N; int find(int rt, int to) { int i; for (i = 0; i < edge[rt].size(); i++) { if (edge[rt][i] == to) return 1; } return 0; } int dfs(int rt) { if (R.size() == m ...
module rf(clk,p0_addr,p1_addr,p0,p1,re0,re1,dst_addr,dst,we,hlt); ////////////////////////////////////////////////////////////////// // Triple ported register file. Two read ports (p0 & p1), and // // one write port (dst). Data is written on clock high, and // // read on clock low ///////////////////////////////...
module sm (/*AUTOARG*/); //==================== Constant declarations ============== `include "autoasciienum_param.v" //==================== Intermediate Variables ============= reg [3:0] /* synopsys enum En_C14ChipNum */ chip_r; //==================== DEBUG ASCII CODE =================...
/* * MBus Copyright 2015 Regents of the University of Michigan * * 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 ...
#include <bits/stdc++.h> using namespace std; const int maxn = 301; int main() { int n; scanf( %d , &n); vector<map<int, int> > rank(n); for (int i = 0; i < (n); ++i) { for (int j = 0; j < (n); ++j) { int a; scanf( %d , &a); --a; rank[i][a] = j; } } ...
#include <bits/stdc++.h> using namespace std; template <class _T> inline _T sqr(const _T &first) { return first * first; } template <class _T> inline string tostr(const _T &a) { ostringstream os( ); os << a; return os.str(); } const long double PI = 3.1415926535897932384626433832795L; ...
/* * 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 agr...
#include <bits/stdc++.h> using namespace std; string s; long long n; bool len(char x) { return x == a || x == e || x == i || x == o || x == u || x == y ; } int main() { cin >> n; cin >> s; cout << s[0]; for (int i = 1; i < n; i++) { if (len(s[i]) && len(s[i - 1])) contin...
#include <bits/stdc++.h> using namespace std; template <typename A, typename B> ostream &operator<<(ostream &os, const pair<A, B> &p) { return os << ( << p.first << , << p.second << ) ; } template <typename T_container, typename T = typename enable_if< !is_same<...
#include <bits/stdc++.h> using namespace std; long long power(long long x, long long y, long long p) { long long res = 1; x = x % p; while (y > 0) { if (y & 1) res = (res * x) % p; y = y >> 1; x = (x * x) % p; } return res; } const int N = 1e5 + 7; const int xinc[] = {0, ...
#include <bits/stdc++.h> using namespace std; const int mod = 1e9 + 7; const int nmax = 100005; const long long inf = 1e9; const double eps = 1e-6; long long dp[1005][1005]; long long gp[1005][1005]; long long a[1005][1005]; long long rdp[1005][1005]; long long rgp[1005][1005]; int main() { io...
/////////////////////////////////////////////////////////////////////////////// // Copyright (c) 1995/2016 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; bool check(int a, int b) { bool dig[10] = {0}; while (a > 0) { dig[a % 10] = true; a /= 10; } while (b > 0) { if (dig[b % 10]) { return true; } b /= 10; } return false; } int main() { int a; cin >...
// ========== Copyright Header Begin ========================================== // // OpenSPARC T1 Processor File: bw_clk_cclk_inv_64x.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 ...
#include <bits/stdc++.h> using namespace std; const int N = 1e3 + 5; const int M = 1e4 + 5; int n, m, w, vis[N], l[N], r[N]; long long a[N], ans[N], s; int main() { cin >> n >> s; long long sum = 0; for (int i = 1; i <= n; i++) { cin >> a[i]; sum += a[i]; } if (sum < s) { ...
`timescale 1ns/1ns /* * Trial test bench for clock switching between two asynchronous clocks * * Enable the `define STOP_IN_PHI1_D to stop the clocks low for the handover, and omit it to stop in PHI2. * * When stopping in PHI1 the clock selection signal must only change in PHI1. Similarly if stopping in PHI2 th...
#include <bits/stdc++.h> using namespace std; template <class T> T sqr(const T &a) { return a * a; } int x, k, timer, n[3], t[3], y[3], head[3], tail[3]; pair<int, int> z[3][100000]; int main() { scanf( %d%d%d%d%d%d%d , &k, &n[0], &n[1], &n[2], &t[0], &t[1], &t[2]); while (1) { timer++; ...
#include <bits/stdc++.h> using namespace std; long long int f1(long int x, long int a) { if ((x < 0 && x > (-1 * ((double)a) / 2)) || (x > 0 && x < ((double)a) / 2) || x == 0) return 1; else return 0; } long long int f2(long long int x, long long int a) { if ((x < 0 && x > (-1 * ...
#include <bits/stdc++.h> using namespace std; const int inf = 1e9 + 7; const int maxn = 1e6 + 100; const double EPS = 1e-12; struct point { double x, y; }; string a[11] = { zero , one , two , three , four , five , six , seven , eight , nine , ten }; string b[11] = {...
#include <bits/stdc++.h> using namespace std; int main() { string s; bool flag = 1; int c = 0, a[] = {5, 7, 5}, k = 0; map<char, bool> m{{ a , 1}, { e , 1}, { o , 1}, { u , 1}, { i , 1}}; while (getline(cin, s)) { c = 0; for (int i = 0; i < s.size(); i++) c += m[s[i]]; if (c !=...
#include <bits/stdc++.h> using namespace std; const int maxN = 100 * 1000 + 5; const int lim = 1000 * 1000 * 1000; const int inf = 1000 * 1000 * 1000 + 5; int f[3 * maxN]; vector<pair<int, string> > a[maxN]; string t; int ans; void dfs(int v, int F) { for (auto u : a[v]) { int tmp = F; ...
#include <bits/stdc++.h> using namespace std; pair<int, int> a[1000001]; int b[1000001], ans[1000001]; int main() { int n, h; cin >> n >> h; for (int i = 0; i < n; i++) { int c; cin >> c; a[i] = make_pair(c, i + 1); } sort(a, a + n); for (int i = 0; i < n; i++) b[i] = 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...
// ZX-Evo Base Configuration (c) NedoPC 2008,2009,2010,2011,2012,2013,2014 // // mix up border and pixels, add palette and blanks /* This file is part of ZX-Evo Base Configuration firmware. ZX-Evo Base Configuration firmware is free software: you can redistribute it and/or modify it under the terms of ...
#include <bits/stdc++.h> const int maxn = 1e6 + 20; const int maxm = 1e5 + 10; const long long int mod = 998244353; const long long int INF = 1e18 + 100; const int inf = 0x3f3f3f3f; const double pi = acos(-1.0); const double eps = 1e-8; using namespace std; int a[50][50]; int num[200], c[200]; int...
#include <bits/stdc++.h> using namespace std; void solve() { int i, ar[3]; cin >> ar[0] >> ar[1] >> ar[2]; int person = 0; for (i = 0; i < 3; i++) if (ar[i] > 0) { ar[i]--; person++; } sort(ar, ar + 3); if (ar[0] > 0 && ar[2] > 0) { person++; ar[0]--; ...