text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; int main() { int n, x, y; cin >> n >> x >> y; int z = n / 2; if (x >= z && x <= z + 1 && y >= z && y <= z + 1) cout << NO ; else cout << YES ; return 0; } |
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n; cin >> k; if (n < k) { cout << -1; return 0; } if (k == 1) { if (n == 1) cout << a ; else cout << -1; return 0; } if (k == 2) { for (int i = 0; i < n >>... |
/***********************************************************************************************************************
* Copyright (C) 2016 Andrew Zonenberg and contributors *
* ... |
#include <bits/stdc++.h> using namespace std; const int N = 110; int a[N], c[N][N]; int main() { int n, k; scanf( %d %d , &n, &k); for (int i = 0; i < n; ++i) { scanf( %d , a + i); } int mn = a[0], mx = a[0]; for (int i = 0; i < n; ++i) { if (a[i] < mn) mn = a[i]; if (a... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 14:51:49 01/30/2016
// Design Name:
// Module Name: alu
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencie... |
//Legal Notice: (C)2012 Altera Corporation. All rights reserved. Your
//use of Altera Corporation's design tools, logic functions and other
//software and tools, and its AMPP partner logic functions, and any
//output files any of the foregoing (including device programming or
//simulation files), and any associate... |
#include <bits/stdc++.h> using namespace std; long long n, m; void in() { cin >> n >> m; } void out() { int s = 0; if (n > m) { cout << n - m; return; } while (n < m) { s++; n <<= 1; } int diff = n - m; n >>= 1; long long x = 2; long long c = 0; wh... |
#include <bits/stdc++.h> using namespace std; int n, s1, s2; int x[100001]; bool C(int v) { if (abs(s1 - s2) > v) return false; set<int> st; st.insert(s1); int pos = s2; for (int i = 0; i < n; i++) { if (st.size()) { st.insert(pos); } while (st.size() && abs(*st.beg... |
/* SPDX-License-Identifier: MIT */
/* (c) Copyright 2018 David M. Koltak, all rights reserved. */
/*
* SGMII autonegotiation state machine
*/
module sgmii_autoneg
(
input rst,
input tbi_rx_clk,
input [7:0] rx_byte,
input rx_is_k,
input rx_disp_err,
output sgmii_autoneg_start,
output s... |
/******************************************************************************/
/* LCD Controller monotone-RK 2014.12.01 */
/******************************************************************************/
`default_nettype none
`include "define.v"
module LCDCON #(parameter ... |
#include <bits/stdc++.h> using namespace std; int main() { int x0, y0, x, y; cin >> x0 >> y0 >> x >> y; if (x0 != x && y != y0 && abs(x - x0) != abs(y - y0)) { cout << -1 << endl; return 0; } int dx = abs(y - y0); int dy = abs(x0 - x); if (x0 == x) cout << x0 + dx << ... |
#include <bits/stdc++.h> using namespace std; int n, a, b; int main() { cin >> n >> a >> b; long long chores[n]; for (int i = 0; i < n; i++) cin >> chores[i]; sort(chores, chores + n); cout << chores[b] - chores[b - 1] << endl; return 0; } |
#include <bits/stdc++.h> int main() { int m, n, i, j, k, p, l; scanf( %d %d , &m, &n); p = m + n; int a[m], b[n], c[p]; for (i = 0; i < m; i++) { scanf( %d , &a[i]); } for (i = 0; i < n; i++) { scanf( %d , &b[i]); } k = 0; for (i = 0; i < m; i++) { for (j = 0;... |
#include <bits/stdc++.h> using namespace std; int n; string t; map<string, int> mp; int solve(int l, int r) { int val = 0; for (int i = r - 1; i >= l; i--) { if (t[i] == ( ) val++; if (t[i] == ) ) val--; if (!val && (t[i] == + || t[i] == - )) { int L = solve(l, i); ... |
#include <bits/stdc++.h> using namespace std; int main() { int n, t, x, y, arr1[2] = {0, 0}, arr2[2] = {0, 0}; cin >> n; for (int i = 0; i < n; i++) { cin >> t >> x >> y; if (t == 1) { arr1[0] += x; arr1[1] += y; } if (t == 2) { arr2[0] += x; arr2[... |
#include <bits/stdc++.h> using namespace std; const long long int mxn = 2 * 1e5 + 5; long long int vis[mxn]; vector<vector<long long int>> ad(mxn); long long int leaf, ans = 0; void dfs(long long int n, long long int d) { vis[n] = 1; for (auto child : ad[n]) if (!vis[child]) dfs(child, d + 1);... |
#include <bits/stdc++.h> using namespace std; const int oo = 1e9; int n, q; int a[400005]; struct rmq { int tree[1050000], lim; void init(int n) { memset(tree, 0, sizeof(tree)); for (lim = 1; lim <= n; lim <<= 1) ; } void add(int x, int v) { x += lim; tree[x] = ... |
#include <bits/stdc++.h> using namespace std; vector<int> finger; int seq[100]; int main() { int n, m; cin >> n >> m; for (int i = 0; i < n; i++) cin >> seq[i]; for (int i = 0; i < m; i++) { int x; cin >> x; finger.push_back(x); } for (int i = 0; i < n; i++) { for... |
/**
* 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 wb_stream_writer_tb;
localparam FIFO_AW = 5;
localparam MAX_BURST_LEN = 32;
localparam WB_AW = 32;
localparam WB_DW = 32;
localparam WSB = WB_DW/8; //Word size in bytes
localparam MEM_SIZE = 128*WSB; //Memory size in bytes
localparam MAX_BUF_SIZE = 128; //Buffer size in bytes
l... |
#include <bits/stdc++.h> using namespace std; int o, trues, Bruh, YO; bool levls[696969]; int main() { int n, X; cin >> n; for (int a = 0; a < 2; a++) { cin >> Bruh; for (int AL = 0; AL < Bruh; AL++) { cin >> YO; levls[YO] = true; } } for (int x = 1; x <= n;... |
#include <bits/stdc++.h> using namespace std; const string problemName = ; const string inputFile = problemName + .in ; const string outputFile = problemName + .out ; const int INF = (1LL << 31) - 1; const long long int LINF = (1LL << 62) - 1; const int dx[] = {1, 0, -1, 0, 1, -1, 1, -1}; const 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... |
//Alan Achtenberg
//Lab 7
//Part 2
module Dlatch (q,qbar,clock,data);
output q, qbar;
input clock, data;
wire nand1, nand2;
wire databar;
not #1 (databar,data);
nand #1 (nand1,clock, data);
nand #1 (nand2,clock, databar);
nand #1 (qbar,nand2,q);
nand #1 (q,nand1,qbar);
endmodule
module m555(clock);
pa... |
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, j = 0; cin >> a >> b >> c; for (int i = 1; i <= a; i++) { if (b >= 2 * i && c >= 4 * i) j++; } cout << j + 2 * j + 4 * j; return 0; } |
#include <bits/stdc++.h> using namespace std; const double eps = (1e-8); int dcmp(double a, double b) { if (fabs(a - b) <= eps) return 0; return a < b ? -1 : 1; } int main() { ios::sync_with_stdio(false), cin.tie(0), cout.tie(0); int n, m; double w; cin >> n >> w >> m; double how =... |
`include "memory.v"
`include "register_file.v"
`include "sim.v"
`include "decoder.v"
`define ADDRESS_WIDTH 32
`define DATA_WIDTH 32
module decoder_test();
wire reset;
wire clk;
reg [`ADDRESS_WIDTH-1:0] mem_address = 0;
wire [`DATA_WIDTH-1:0] mem_data_out;
reg[31:0] decoder_inp;
reg[1:0] instr_size;
reg mem_cmd =... |
// ----------------------------------------------------------------------
// Copyright (c) 2016, The Regents of the University of California All
// rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:... |
#include <bits/stdc++.h> using namespace std; struct ant { int id; int novo_id; long long int p; int dir; }; struct rotate_edges { int id_ini; int id_fim; }; int compara_p(ant a, ant b) { return a.p < b.p || (a.p == b.p && a.dir < b.dir); } int compara_p_reverso(ant a, ant b)... |
#include <bits/stdc++.h> using namespace std; int main() { long long n, k; cin >> n >> k; long long a[k + 1]; for (long long i = 0; i < k; i++) { cin >> a[i]; } long long c4 = n, c2 = 2 * n; long long o1 = 0; for (long long i = 0; i < k; i++) { while (c4 > 0 && a[i] > 3) ... |
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, r; int y1, y2, yw, x, y; scanf( %d%d%d%d%d%d , &a, &b, &c, &x, &y, &r); y2 = b; if (b - a < r) { printf( -1 n ); return 0; } y1 = a + r; yw = c - r; y = 2 * yw - y; double k = (1.0) * (y - y1)... |
#include <bits/stdc++.h> using namespace std; const long long inf = 1e9 + 7; const long long INF = 1LL << 60; const long long mod = 1e9 + 7; const long double eps = 1e-8; const long double pi = acos(-1.0); template <class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 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... |
//======================================================================
//
// avalanche_entropy_core.v
// ------------------------
// Core functionality for the entropy provider core based on
// an external avalanche noise based source. (or any other source that
// can toggle a single bit input).
//
// Currently the d... |
`timescale 1ns / 1ps
module test_GPIA();
reg [15:0] story_o;
reg clk_o;
reg rst_o;
reg adr_o;
reg we_o;
reg cyc_o;
reg stb_o;
reg [15:0] dat_o;
reg [15:0] port_o;
wire [15:0] port_i;
wire [15:0] dat_i;
wire ack_i;
GPIA gpia(
.RST_I(rst_o),
.CLK_I(clk_o),
.PORT_O(port_i),
.... |
//////////////////////////////////////////////////////////////////////
//// ////
//// flow_ctrl.v ////
//// ////
//// This file is part of the Ether... |
//altclkctrl CBX_SINGLE_OUTPUT_FILE="ON" CLOCK_TYPE="AUTO" DEVICE_FAMILY="Cyclone V" ENA_REGISTER_MODE="falling edge" USE_GLITCH_FREE_SWITCH_OVER_IMPLEMENTATION="OFF" ena inclk outclk
//VERSION_BEGIN 14.0 cbx_altclkbuf 2014:06:05:09:45:41:SJ cbx_cycloneii 2014:06:05:09:45:41:SJ cbx_lpm_add_sub 2014:06:05:09:45:41:SJ cb... |
`include "brouter_3x3.v"
`include "defines.v"
module test_brouter_3x3();
reg `control_w b0_ci, b1_ci, b2_ci,
b4_ci, b5_ci, b6_ci,
b8_ci, b9_ci, ba_ci;
wire `control_w b0_co, b1_co, b2_co,
b4_co, b5_co, b6... |
// megafunction wizard: %LPM_FIFO+%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: dcfifo
// ============================================================
// File Name: Altera_UP_Video_In_Dual_Clock_FIFO.v
// Megafunction Name(s):
// dcfifo
//
// Simulation Library Files(s):
// altera_mf
// ===============... |
#include <bits/stdc++.h> using namespace std; const int c = 3002; int w, n, m, dif[c], rf[c]; long long sok = 1e15; pair<long long, long long> op[c][c], cl[c][c]; vector<int> sz[c]; bool v[c]; pair<long long, long long> add(pair<long long, long long> a, pair<long long, l... |
#include <bits/stdc++.h> using namespace std; const int inf = 1e9; void query() { int n, m; cin >> n >> m; vector<string> t(n); for (auto& i : t) cin >> i; vector<vector<int>> col(n, vector<int>(m, 0)); for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) col[i][j] = (i > ... |
/* This file is part of jt51.
jt51 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.
jt51 is distributed in the hope tha... |
// Copyright (c) 2015 CERN
// Maciej Suminski <>
//
// 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 late... |
`timescale 1ns/10ps
module vga_pll_0002(
// interface 'refclk'
input wire refclk,
// interface 'reset'
input wire rst,
// interface 'outclk0'
output wire outclk_0,
// interface 'locked'
output wire locked
);
altera_pll #(
.fractional_vco_multiplier("true"),
.reference_clock_frequenc... |
/**
* 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 law... |
#include <bits/stdc++.h> using namespace std; int in[2 * 100010], s[2 * 100010]; int n; int main() { scanf( %d , &n); memset(in, 0, sizeof(in)); memset(s, 0, sizeof(s)); for (int i = 0; i < n; i++) { int xx; scanf( %d , &xx); s[i] = xx; in[xx] = i + 1; } int t = 0... |
#include <bits/stdc++.h> using namespace std; long long cq, q, c[2000 + 10][2000 + 10], cg[2000 + 10][2000 + 10], pos[2000 + 10], n, m, k, bl[2000 + 10][2000 + 10][3], cnt[2000 + 10]; template <class T> bool Read(T &x) { char c; bool f = 0; while (c = getchar(), c != EOF) { if (c == - )... |
/*
* 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
`default_nettype none
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 10/12/2015 12:22:18 PM
// Design Name:
// Module Name: SerialHandler
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
// ... |
#include <bits/stdc++.h> using namespace std; long long f(int d) { long long res = 0; long long dp[100]; memset(dp, 0ll, sizeof(dp)); for (int k = 1; k < d; k++) if (d % k == 0) { res += ((1ll << (k - 1)) - dp[k]); int nk = k * 2; for (; nk <= d; nk += k) dp[nk] += ((1l... |
`timescale 1ns/1ps
module tb_multiplier (); /* this is automatically generated */
reg clk;
// clock
initial begin
clk = 0;
forever #5 clk = ~clk;
end
`ifdef SINGLE
parameter SW = 24;
`endif
`ifdef DOUBLE
parameter SW = 54;// */
`endif
// (*NOTE*) replace reset, clock
reg [SW-1:0] a;
reg [S... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; const int MOD = 998244353; double eps = 1e-8; vector<int> b, c; int vis[2100000], a[210000], ans[210000], x; int read() { int v = 0, f = 1; char c = getchar(); while (c < 48 || 57 < c) { if (c == - ) f = -1; c = getchar(); } whil... |
#include <bits/stdc++.h> using namespace std; using LL = long long; using PII = pair<int, int>; int main() { auto get_factors = [](int n) { vector<int> ret; for (int i = 1; i * i <= n; i++) { if (n % i == 0) { ret.push_back(i); if (i * i != n) ret.push_back(n / i); ... |
#include <bits/stdc++.h> using namespace std; int m, n, L, cnt, sum[1000005]; char s[1000005], x[1000005]; struct Node { Node *par, *go[26]; int val, sum, flag, num; void Clear(int _val) { par = NULL; for (int i = 0; i < 26; i++) go[i] = NULL; sum = flag = 0; val = _val; ... |
#include <bits/stdc++.h> using namespace std; const int M = 5e3 + 10; int a[M]; int dp[M][M]; int main() { int n; scanf( %d , &n); for (int i = 1; i <= n; i++) scanf( %d , a + i), dp[i][i] = a[i]; for (int d = 1; d < n; d++) { for (int i = 1; i + d <= n; i++) { int j = i + d; ... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
// ***************************************************************************
// ***************************************************************************
// Copyright 2011(c) Analog Devices, Inc.
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// a... |
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2016.4 (win64) Build Mon Jan 23 19:11:23 MST 2017
// Date : Fri Oct 27 00:02:33 2017
// Host : Juice-Laptop running 64-bit major release ... |
`timescale 1ns / 1ps
module Tic_tac_toe(
input iCLK_50,
input [3:0] iSW,
input BTN_WEST,
input BTN_EAST,
input BTN_NORTH,
input BTN_SOUTH,
output wire oVGA_R,
output wire oVGA_G,
output wire oVGA_B,
output oHS,
output oVS,
output [7:0] oLED
);
reg CLK_25;
wire reset;
wire start;
wire btn_player1;
wire btn_... |
/******************************************************************************/
/* DRAM Controller for VC707 Ryohei Kobayashi */
/* 2016-03-23 */
/****************************************************************************... |
#include <bits/stdc++.h> using namespace std; struct edge { long long int A; long long int B; }; bool edgecompare(edge lhs, edge rhs) { if (lhs.B != rhs.B) return lhs.B < rhs.B; else return lhs.A < rhs.A; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); ... |
//-------------------------------------------------------------------
//-- fsmtx_tb.v
//-- Banco de pruebas para la tranmision de datos
//-------------------------------------------------------------------
//-- BQ September 2015. Written by Juan Gonzalez (Obijuan)
//-----------------------------------------------------... |
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; string s = ; for (int i = 0; i < k; i++) s += char(i + 97); for (int i = 0; i < n - k; i++) { s += char(i % k + 97); } cout << s << endl; return 0; } |
#include <bits/stdc++.h> using namespace std; int sa[100005], s1[100005]; char s[100005]; int save[6]; int main() { int n; while (scanf( %d , &n) != EOF) { for (int a = 1; a <= n; a++) scanf( %d , &sa[a]); scanf( %s , s + 1); int l = -1000000000, r = 1000000000; for (int a = 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; const int INF = 1e9 + 1; const double pi = acos(-1); int dp[1001][2002][4]; int MOD = 998244353; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.precision(20); int n, k; cin >> n >> k; dp[0][0][0] = 1; dp[0][0][1] = 1; ... |
#include <bits/stdc++.h> using namespace std; bool f(int a, string s) { vector<char> v; int tmp; int ss = (s.size() - 1); while (a) { tmp = a % 10; if (tmp == 7) v.push_back( 7 ); if (tmp == 4) v.push_back( 4 ); a /= 10; } if (v.size() != s.size()) return false; f... |
#include <bits/stdc++.h> using namespace std; bool isPrime(int n) { if (n <= 1) return false; for (int i = 2; i < n; i++) if (n % i == 0) return false; return true; } int odd(int arr[], int n) { for (int i = 0; i < n; i++) { if (arr[i] % 2 != 0) { return i; } } } ... |
#include <bits/stdc++.h> #pragma comment(linker, /STACK:500000000 ) using namespace std; vector<int> A[2]; int main() { int n, i, j, t, w; cin >> n; for (i = 0; i < n; i++) { cin >> t >> w; A[t - 1].push_back(w); } for (i = 0; i < 2; i++) sort(A[i].begin(), A[i].end(), greater<i... |
/*
* yosys -- Yosys Open SYnthesis Suite
*
* Copyright (C) 2012 Claire Xenia Wolf <>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
... |
/*
* 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 n, m; long a[4], b[4], c[4]; int main() { cin >> n; for (int i = 1; i <= 3; i++) { cin >> a[i] >> b[i]; c[i] = a[i]; } m = a[1] + a[2] + a[3]; for (int i = 1; i <= 3; i++) { while (c[i] < b[i] && m < n) { c[i] += 1;... |
// vim: ts=4 sw=4 noexpandtab
/*
* Edge detection
*
* Copyright (c) 2019 Michael Buesch <>
*
* 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 License, or
... |
/* wb_arbiter. Part of wb_intercon
*
* ISC License
*
* Copyright (C) 2013-2019 Olof Kindgren <>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copie... |
#include <bits/stdc++.h> using namespace std; const long long mod = 1000000007; const long long inf = LLONG_MAX; void IO() { ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); cout.setf(ios::fixed); srand(chrono::high_resolution_clock::now().time_since_epoch().count()); } long long pw(long 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... |
#include <bits/stdc++.h> using namespace std; const int oo = 1 << 30; const double PI = M_PI; const double EPS = 1e-15; double w, h, u; double cross(const complex<double> &a, const complex<double> &b) { return imag(conj(a) * b); } complex<double> rotate_by(const complex<double> &p, ... |
`include "timescale.v"
`include "defines.v"
module clk_rst(
clk_sys_o,
clk_adc_o,
clk_adc2x_o,
clk_100mhz_o,
clk_200mhz_o,
rstn_o
);
// Defaults parameters
parameter CLK_SYS_PERIOD = `CLK_SYS_PERIOD;
parameter CLK_ADC_PERIOD = `CLK_ADC_PERIOD;
parameter CLK_ADC_2X_PERIOD = `CLK_ADC_2X_PERIOD;
... |
#include <bits/stdc++.h> using std::abs; using std::bitset; using std::cerr; using std::cin; using std::copy; using std::cout; using std::endl; using std::fill; using std::fixed; using std::greater; using std::lower_bound; using std::map; using std::max; using std::min; using std::next_per... |
#include <bits/stdc++.h> using namespace std; double ans = 0.0000; void bfs(); list<int> arr[100005]; int visited[100005], dep[100005]; int main() { int n, i, start, end; cin >> n; n--; while (n--) { cin >> start; cin >> end; arr[start].push_back(end); arr[end].push_b... |
// RS-232 TX module
// (c) fpga4fun.com KNJN LLC - 2003, 2004, 2005, 2006
module SerialTX(clk, TxD_start, TxD_data, TxD, TxD_busy);
input clk, TxD_start;
input [7:0] TxD_data;
output TxD, TxD_busy;
parameter ClkFrequency = 16000000; // 64MHz
parameter Baud = 115200;
parameter RegisterInputData = 1; // in RegisterInpu... |
#include <bits/stdc++.h> #pragma GCC optimize( Ofast ) #pragma GCC target( sse,sse2,sse3,sse3,sse4,popcnt,abm,mmx ) using namespace std; const double eps = 0.000001; const long double pi = acos(-1); const int maxn = 1e7 + 9; const int mod = 1e9 + 7; const long long MOD = 1e18 + 9; const long long INF ... |
#include <bits/stdc++.h> using namespace std; int segtree[4 * ((24 * 3600) + 100)], lazy[4 * ((24 * 3600) + 100)]; void propagate(int root, int l, int r) { segtree[root] += lazy[root]; if (l != r) { lazy[2 * root + 1] += lazy[root]; lazy[2 * root + 2] += lazy[root]; } lazy[root] = 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... |
#include <bits/stdc++.h> using namespace std; int a[1000006], BLOCK; long long ans[200005], answer = 0; int asdf[1000006]; struct Node { int L, R, ind; } q[200005]; bool cmp(Node x, Node y) { if (x.L / BLOCK != y.L / BLOCK) return x.L / BLOCK < y.L / BLOCK; else return x.R < y.R; ... |
#include <bits/stdc++.h> using namespace std; template <typename T, size_t N> long long SIZE(const T (&t)[N]) { return N; } template <typename T> long long SIZE(const T &t) { return t.size(); } string to_string(const string s, long long x1 = 0, long long x2 = 1e9) { return + ((x1 < s.siz... |
#include <bits/stdc++.h> using namespace std; int n; int cost[2005]; bool have[2005][3]; int dp[2003][10]; int solve(int i, int vits) { if (i >= n) { if (vits == 7) return 0; return 1e9; } int &ret = dp[i][vits]; if (ret + 1) return ret; int sol1 = 0, sol2 = 0; sol1 = sol... |
// -------------------------------------------------------------
//
// Generated Architecture Declaration for rtl of inst_a_e
//
// Generated
// by: wig
// on: Mon Oct 23 16:54:16 2006
// cmd: /cygdrive/h/work/eclipse/MIX/mix_0.pl -nodelta ../../bugver2006.xls
//
// !!! Do not edit this file! Autogenerated by MIX ... |
#include <bits/stdc++.h> using namespace std; int dp[141][141][12]; int peas[141][141]; char track[141][141][12]; int main() { int n, m, k; cin >> n >> m >> k; string str; for (int i = 0; i < 141; i++) for (int j = 0; j < 141; j++) for (int p = 0; p < 12; p++) dp[i][j][p] = -1111... |
#include <bits/stdc++.h> using namespace std; int a[3003]; int main() { int n, inv = 0; cin >> n; for (int i = 0; i < n; ++i) cin >> a[i]; for (int i = 0; i < n; ++i) for (int j = i + 1; j < n; ++j) if (a[i] > a[j]) ++inv; if (inv % 2 == 0) cout << fixed << setprecision(6) ... |
#include <bits/stdc++.h> using namespace std; int main() { long long int t; cin >> t; while (t--) { string s; cin >> s; int n = s.length(); if (n < 3) { cout << 0 << endl; continue; } if (n == 3) { if (s == 101 || s == 010 ) cout <... |
// 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 : Sun May 28 18:34:36 2017
// Host : GILAMONSTER running 64-bit major release (... |
#include <bits/stdc++.h> using namespace std; void my_functions() { return; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n; cin >> n; long long int a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; } string s; cin >> s; long l... |
// -------------------------------------------------------------
//
// Generated Architecture Declaration for rtl of m0
//
// Generated
// by: wig
// on: Tue Apr 1 13:31:51 2008
// cmd: /cygdrive/c/eclipse/MIX/mix_0.pl -strip -nodelta ../noassign.xls
//
// !!! Do not edit this file! Autogenerated by MIX !!!
// $A... |
// (C) 2001-2015 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... |
#include <bits/stdc++.h> using namespace std; int const maxn = 60, maxl = 10010; int f[maxn * maxl]; int n, d, c, sum; int main() { cin >> n >> d; f[0] = 1; for (int i = 0; i < n; i++) { cin >> c; for (int j = sum; j >= 0; j--) if (f[j]) f[j + c] = 1; sum += c; } ... |
/**
* 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 = 200010; long long a[N], f[N]; int main() { long long o, t, n = 1; long long s = 0; scanf( %I64d , &o); while (o--) { scanf( %I64d , &t); if (t == 2) { n++; scanf( %I64d , &a[n]); f[n] = 0; s +... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.