text
stringlengths
59
71.4k
#include <bits/stdc++.h> using namespace std; char c[100005]; int cut[100005], num[100005]; int f[100005], h[2][100005]; int main() { int n, m; cin >> n >> c + 1 >> m; for (int i = 1; i <= n; i++) { num[i] = num[i - 1]; if (c[i] == a ) h[0][i] = h[1][i - 1] + 1; else if ...
#include <bits/stdc++.h> using namespace std; int n; double p[100008]; struct Tprogram { void open() { freopen( 1.in , r , stdin); freopen( 1.out , w , stdout); } void close() {} void init() { scanf( %d , &n); for (int i = 0; i <= n; i++) scanf( %lf , &p[i]); } ...
#include <bits/stdc++.h> #pragma GCC optimize(2) #pragma G++ optimize(2) using namespace std; const int MAX_N = 2e3 + 5; char s[MAX_N], t[MAX_N]; int sufs[MAX_N][26], suft[MAX_N][26]; int dp[MAX_N][MAX_N]; int solve(int i, int j) { if (j == 0) return 0; if (~dp[i][j]) return dp[i][j]; int re...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 15:37:20 09/24/2014 // Design Name: // Module Name: SynchronizeClkDomains // Project Name: // Target Devices: // Tool versions: // Description: This module i...
// (C) 1992-2014 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 simulati...
#include <bits/stdc++.h> using namespace std; int o, e, oC, eC, n, en; int main() { cin >> n; for (int i = 1; i <= n; i++) { cin >> en; if (en % 2 == 0) { e = i; eC++; } else { o = i; oC++; } } if (oC == 1) cout << o; else cou...
///////////////////////////////////////////////////////////////////////// // Copyright (c) 2008 Xilinx, Inc. All rights reserved. // // XILINX CONFIDENTIAL PROPERTY // This document contains proprietary information which is // protected by copyright. All rights are reserved. This notice ...
/** * 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 (c) 2014 Takashi Toyoshima <>. // All rights reserved. Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. `timescale 1ns/100ps module RAM( i_addr, i_enable_x, i_write_x, i_data, o_data); parameter delay = 10; parameter depth = 16;...
#include <bits/stdc++.h> #pragma comment(linker, /STACK:268435456 ) using namespace std; template <typename T> T sqr(const T &x) { return x * x; } template <typename T> T my_abs(const T &x) { return x < 0 ? -x : x; } const int INF = (int)1e9; const long long LINF = (long long)6e18; const ...
#include <bits/stdc++.h> using namespace std; const int MAXN = 250 + 7; int a[MAXN][MAXN], ans[MAXN][MAXN]; bool rmax[MAXN * MAXN], cmax[MAXN * MAXN], vis[MAXN * MAXN]; bool canr[MAXN], canc[MAXN]; int main() { int n, m; scanf( %d %d , &n, &m); for (int i = 1; i <= n; i++) for (int j = 1; ...
//------------------------------------------------------------------- //-- counter4_tb.v //-- Banco de pruebas para el contador de 4 bits con prescaler //------------------------------------------------------------------- //-- BQ August 2015. Written by Juan Gonzalez (Obijuan) //----------------------------------------...
#include <bits/stdc++.h> int cmpfnc(const void* a, const void* b) { return (*(int*)a - *(int*)b); } int main() { int i, n; scanf( %d , &n); int arr[300005]; for (i = 0; i < n; i++) scanf( %d , &arr[i]); qsort(arr, n, sizeof(int), cmpfnc); long long int sum = arr[0]; long long int count =...
#include <bits/stdc++.h> #pragma GCC optimize( O3 ) #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx ) using namespace std; namespace SimplexMethod { const long double EPS = 1.0E-12; vector<vector<long double>> a; vector<long double> b, c, res; vector<int> N, kt; int m; void pivot(int k, ...
#include <bits/stdc++.h> using namespace std; int main() { int n, a, b, pos, cnt = 0; cin >> n >> a >> b; for (int pos = 1; pos <= n; pos++) { if (n - pos <= b && pos - 1 >= a) cnt++; } cout << cnt; return 0; }
#include <bits/stdc++.h> #pragma GCC optimize( Ofast ) using namespace std; mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count()); template <typename T> bool uax(T& a, T b) { if (a < b) { a = b; return true; } return false; } template <typename T> bool uin(...
#include <bits/stdc++.h> using namespace std; template <class T, class L> bool smax(T& x, L y) { return x < y ? (x = y, 1) : 0; } template <class T, class L> bool smin(T& x, L y) { return x > y ? (x = y, 1) : 0; } const int maxn = 16; int n, a[maxn], b[maxn][maxn], ex; bool mark[maxn]; vec...
/** * 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 usb_top( input I_sys_clk , input I_usb_clk , input I_sys_rst , input I_usb_rst , //===================System GPIF data in/out==================== ...
// DESCRIPTION: Verilator: Verilog Test module // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2019 by Todd Strader. module secret ( input [31:0] accum_in, output wire [31:0] accum_out, input accu...
#include <bits/stdc++.h> using namespace std; map<long long, long long> mp; long long ar[200005]; long long br[200005]; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int t; t = 1; while (t--) { int n; cin >> n; for (int i = 1; i <= n; i++) { cin >>...
#include <bits/stdc++.h> using namespace std; const int N = 2e6 + 10; int n, a[N], vis[N]; int main() { scanf( %d , &n); int64_t ans = 0; int f = 0, g = 1, pos = 0; for (int i = 1; i <= n; ++i) { scanf( %d , &a[i]); ans += abs(a[i] - i); if (a[i] == 1) continue; if (a[i] ...
#include <bits/stdc++.h> using namespace std; int main() { string a, b, c; cin >> a >> b; sort(a.begin(), a.end()); if (a.length() < b.length()) { reverse(a.begin(), a.end()); cout << a << endl; } else { for (int i = 0; i < a.length(); i++) { for (int j = a.length() - 1...
#include <bits/stdc++.h> using namespace std; int main() { int n, p; string s, number; cin >> n; string name[n]; int taxi[n], pizza[n], cg[n], tax, pizz, cgc, taxmax = -1, pizzmax = -1, cgcmax = -1; int taxifinal[n], pizzafinal[n], cgcfinal[n...
#include <bits/stdc++.h> using namespace std; const int MAXN = 1024; double p[MAXN][MAXN]; int a[MAXN]; int main() { int n, m; scanf( %d%d , &n, &m); for (int i = 0; i < n; ++i) { scanf( %d , a + i); for (int j = 0; j < i; ++j) p[i][j] = a[i] > a[j], p[j][i] = 1 - p[i][j]; } fo...
#include <bits/stdc++.h> using namespace std; vector<int> XandY, XXX, YYY; int NOseg; int query(int x, int y) { cout << 0 << << x << << y << endl; int ret; cin >> ret; return ret; } void SOLVE(int l, int r) { if (l > r) return; int mid = (l + r) / 2; int x = query(mid, mi...
/** * ------------------------------------------------------------ * Copyright (c) All rights reserved * SiLab, Institute of Physics, University of Bonn * ------------------------------------------------------------ */ `timescale 1ps/1ps `default_nettype none module bus_to_ip #( parameter BASEADDR = 0, p...
// // 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...
`timescale 1ns/10ps /** * `timescale time_unit base / precision base * * -Specifies the time units and precision for delays: * -time_unit is the amount of time a delay of 1 represents. * The time unit must be 1 10 or 100 * -base is the time base for each unit, ranging from seconds * to femtoseconds, and must be:...
/////////////////////////////////////////////////////////////////////////// // // To test: // (a) The use & representation of time variables // (b) The display of time variables // // Compile and run the program // iverilog tt_clean.v // vvp a.out // // VISUALLY INSPECT the displays. (There...
/* * 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> #define fi first #define se second #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define pb push_back #define len(x) (int)(x).size() typedef long long ll; typedef long double ld; using namespace std; const int N = 1001; const int 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 la...
#include <bits/stdc++.h> using namespace std; const int N = 4 * 1000 * 100 + 10; int n, c[N], st[N], en[N], who[N], TM; vector<int> adj[N]; void dfs(int root, int par = 0) { st[root] = TM++; who[st[root]] = root; for (auto u : adj[root]) if (u ^ par) dfs(u, root); en[root] = TM; } st...
#include <bits/stdc++.h> using namespace std; int a[1010][1010]; int p[1010][1010]; int w[1010]; int n, m; int ok(int d) { int cur, i, j, k; for (i = 0; i < m; i++) for (j = 0; j < m; j++) p[i][j] = 0; for (i = 0; i < n; i++) { cur = 0; for (j = 0; j < m; j++) if (a[i][...
#include <bits/stdc++.h> using namespace std; const int INF = (int)1e9 + 1; const int MAXN = (int)5001; int solve(vector<pair<int, int> > sg, int pos) { sg.erase(sg.begin() + pos); int mx = sg[0].first, mn = sg[0].second; for (int i = (1); i < (int)(sg.size()); i++) { if (sg[i].first > mn || s...
#include <bits/stdc++.h> using namespace std; void solve() { int n, m; cin >> n >> m; vector<vector<vector<int>>> dp(n + 1, vector<vector<int>>(m + 1, vector<int>(2, 0))); for (int i = 1; i <= n; i++) for (int j = 1; j <= m; j++) { dp[i][j][1] = dp[i]...
Require Bedrock.Word Crypto.Util.WordUtil. Require Coq.ZArith.Znumtheory Coq.ZArith.BinInt. Require Coq.Numbers.Natural.Peano.NPeano. Require Crypto.CompleteEdwardsCurve.CompleteEdwardsCurveTheorems. Require Import Omega. (* TODO: remove this import when we drop 8.4 *) Require Import Crypto.Spec.ModularArithmetic. (...
#include <bits/stdc++.h> using namespace std; bool comp(int x, int y) { return x > y; } int dx[] = {0, 0, 1, -1}; int dy[] = {1, -1, 0, 0}; long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; } int main() { int n; cin >> n; vector<pair<int, int> > a(n); for (int i = 0; i ...
#include <bits/stdc++.h> using namespace std; const int INF = 100000000; const double eps = 1e-10; const int MAXN = 110; set<int> sx, sy; int in[10][2]; set<int>::iterator it1, it2; int main() { int x, y; for (int i = 0; i < (8); ++i) { scanf( %d%d , &x, &y); in[i][0] = x; in[i...
// *************************************************************************** // *************************************************************************** // Copyright 2011(c) Analog Devices, Inc. // // All rights reserved. // // Redistribution and use in source and binary forms, with or without modification, // a...
#include <bits/stdc++.h> using namespace std; int main() { string s, hours, mins; cin >> s; int a = 1, b = 1, colon, i, radix = 0; for (i = 0; i < s.length(); i++) { if (s[i] == : ) { colon = i; break; } } for (i = 0; i < colon; i++) { if (s[i] != 0 ) { ...
// Copyright (C) 1991-2011 Altera Corporation // 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 from any of the foregoing // (including device programming or simulation files), and any // associated docume...
#include <bits/stdc++.h> const long long maxn = 8e9 + 5; long long v[10000000]; long long k[10000000]; long long n, sum; int judge(long long m) { long long i, sum1 = sum; for (i = 0; i < n; i++) { if (m * v[i] > k[i]) { if (k[i] + sum1 < m * v[i]) break; else if (k[i] +...
/* * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law...
// (C) 2001-2014 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 (C) 2000 Stephen G. Tell * * 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, or (at your option) * any later version. * * This program is distributed in the h...
#include <bits/stdc++.h> using namespace std; const long long maxS = 2e5 + 5; long long N, M; long long A[201], B[201]; long long DP[201][515]; long long go(long long pos, long long prev) { if (pos == N + 1) return 0; if (DP[pos][prev] != -1) return DP[pos][prev]; long long ans = INT_MAX; fo...
/* SPDX-License-Identifier: MIT */ /* (c) Copyright 2018 David M. Koltak, all rights reserved. */ /* * rcn bus master interface for tawas core. * Uses 8 master ids x 4 sequence ids to map to 32-threads. * */ module tawas_rcn_master ( input rst, input clk, input [68:0] rcn_in, output [68:0] rcn_ou...
#include <bits/stdc++.h> using namespace std; const int INF = 0x7f7f7f7f; char s[1005]; int dp[1005][2]; int main() { int n; scanf( %d , &n); scanf( %s , s); if (1 == n) { puts( 0 ); return 0; } memset(dp, 0x7f, sizeof(dp)); dp[0][s[0] - 0 ] = 0; dp[0][(s[0] - 0 )...
#include <bits/stdc++.h> using namespace std; int main() { int n, a, b, numa, numb, ans; bool f = 0; cin >> n >> a >> b; for (int i = 2, cnt = 1; i <= n; i *= 2) { numa = a / i; if (a % i != 0) numa++; numb = b / i; if (b % i != 0) numb++; if (numa == numb) { if...
//***************************************************************************** // 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 la...
module Lolhi( input A, input B, input C, input AnalogLDir, input AnalogRDir, output Len, output Ldir, output Ren, output Rdir ); wire Z_A; wire Z_B; wire Z_C; wire Ldir_int; wire Len_int; wire Rdir_int; wire Ren_int; wire Analog_select; supply0 GND; assign Analog_select = AnalogLDir & AnalogRDir...
#include <bits/stdc++.h> using namespace std; template <class T> void splitstr(const string &s, vector<T> &out) { istringstream in(s); out.clear(); copy(istream_iterator<T>(in), istream_iterator<T>(), back_inserter(out)); } template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; ...
#include <bits/stdc++.h> using namespace std; const int N = 3e5 + 7; const int MOD = 1e9 + 7; const int LEN = 8, MAGIC = 1e8; int a[N], b[N]; int n; char bignum[N]; long long m[N]; int tot; int f[N], g[N]; int add(int a, int b) { a += b; if (a < 0) a += MOD; if (a >= MOD) a -= MOD; ...
#include <bits/stdc++.h> using namespace std; #define sim template < class c #define ris return * this #define dor > debug & operator << #define eni(x) sim > typename enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) { sim > struct rge { c b, e; }; sim > rge<c> range(c i, c j) { return rg...
#include <bits/stdc++.h> using namespace std; struct node { int x, y; } fei1[60], fei2[60]; int _hash[5100]; int main() { int p, q, l, r, i, t, j, x, k; scanf( %d%d%d%d , &p, &q, &l, &r); for (i = 0; i < p; i++) { scanf( %d%d , &fei1[i].x, &fei1[i].y); } for (i = 0; i < q; i++) {...
// megafunction wizard: %ARM-Based Excalibur% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: ARM-Based Excalibur // PROJECT: excalibur // ============================================================ // File Name: h:\data\excalibur\excalibur.v // Megafunction Name(s): ARM-Based Excalibur // =======================...
/* * Copyright 2017 Google 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/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n, k; cin >> n >> k; char arr[] = { a , b , c , d , e , f , g , h , i , j , k , l , m , n , o , p , q , r , s , t , u , v , w , x...
#include <bits/stdc++.h> using namespace std; int b[4], c, n, l = 0, a, i; int main() { scanf( %d , &n); for (i = 0; i < n; i++) { scanf( %d , &a); b[a]++; } cout << n - max(b[1], max(b[2], b[3])) << endl; return 0; }
/*module MIPS_Single_Register(Rs_addr,Rt_addr,Rd_addr,Clk,Rd_write_byte_en,Rd_in,Rs_out,Rt_out); input Clk; input [4:0]Rs_addr,Rt_addr,Rd_addr; input [7:0]Rd_in; input Rd_write_byte_en; output [7:0]Rs_out,Rt_out; reg [7:0]register[31:0]; always @(negedge Clk) begin if(Rd_addr!=0 && Rd_write_byte_en) register[Rd_...
#include <bits/stdc++.h> using namespace std; template <typename A, typename B> inline void chmin(A &a, B b) { if (a > b) a = b; } template <typename A, typename B> inline void chmax(A &a, B b) { if (a < b) a = b; } template <class A, class B> ostream &operator<<(ostream &ost, const pair<A, 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 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 law...
#include <bits/stdc++.h> using namespace std; int v[1010][10], rez[1010]; int main() { int n, nr = 0, l = 0; scanf( %d , &n); for (int i = 1; i <= n; i++) { int p = 0; for (int j = 1; j <= 5; j++) scanf( %d , &v[i][j]); } if (n > 200) { printf( 0 ); return 0; } ...
timeunit 10us; timeprecision 10us; module fast_g (out); output out; reg out; initial begin #0 out = 0; #1 out = 1; // 10us end endmodule // fast_g `timescale 100us / 1us // These will be ignored since a `timescale was already given. timeunit 10us; timeprecision 10us; module slow (out); ...
#include <bits/stdc++.h> using namespace std; const int N = 510; int t, n, m, a, b, c; vector<pair<int, int> > g[N]; int dp[N][N], inDegree[N][N], source, ans[N][N]; bool vis[N]; void dfs(int u) { if (vis[u]) return; vis[u] = 1; for (int i = 0; i < g[u].size(); i++) { int v = g[u][i].fir...
#include <bits/stdc++.h> using namespace std; template <class T> inline T BM(T p, T e, T M) { long long int ret = 1; for (; e > 0; e >>= 1) { if (e & 1) ret = (ret * p) % M; p = (p * p) % M; } return (T)ret; } template <class T> inline T gcd(T a, T b) { if (b == 0) return a; ...
#include <bits/stdc++.h> using namespace std; vector<int> pat[100000]; int main() { int num, way; scanf( %d%d , &num, &way); set<pair<int, int> > se; for (int i = 0; i < way; i++) { int za, zb; scanf( %d%d , &za, &zb); za--; zb--; pat[za].push_back(zb); pat[zb]....
#include <bits/stdc++.h> using namespace std; string s; int len; set<string> v; bool check[111111][5]; void fuck(string father, int now) { if (now - 2 > 4) { string now1 = s.substr(now - 2, 2); if (now1 != father) { v.insert(now1); if (check[now - 2][2] == true) che...
#include <bits/stdc++.h> using namespace std; const int Mod = 1e9 + 7; const double pi = 2 * acos(0.0); const int N = 3e5 + 5; int main() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n, t; cin >> t; while (t--) { cin >> n; int x, z = 0, tot = 0; f...
#include <bits/stdc++.h> int cnt[1001][1001], que[1000001][2], head = -1, tail; char map[1001][1001]; int n, m; int main() { int i, j, a, go[4][2] = {1, 0, 0, 1, -1, 0, 0, -1}, print; scanf( %d %d , &n, &m); for (i = 0; i < n; i++) { scanf( %s , map[i]); for (j = 0; j < m; j++) { ...
#include <bits/stdc++.h> using namespace std; int kol[10], ans = -1, ans0 = 0; vector<int> a, b; int main() { memset(kol, 0, sizeof(kol)); char c; while (cin >> c) kol[c - 0 ]++; for (int i = 1; i < 10; i++) { vector<int> c, d; int K1[10], K2[10], res = 0, nul = 0; for (int j ...
`timescale 1ns / 1ps /* This file is part of JT51. JT51 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. JT51 program is di...
#include <bits/stdc++.h> using namespace std; long long cdiv(long long x, long long y) { return x / y + (x % y > 0); } long long w(long long a, long long b) { return cdiv(a, 2) * cdiv(b, 2) + (a / 2) * (b / 2); } long long W(long long x1, long long y1, long long x2, long long y2) { return w(x2, y2) - ...
#include <bits/stdc++.h> #pragma GCC optimize( Ofast ) using namespace std; void read(long long &x) { char ch = getchar(); x = 0; while (!isdigit(ch)) ch = getchar(); while (isdigit(ch)) x = x * 10 + ch - 48, ch = getchar(); } const long long N = 105, mod = 1e9 + 9; long long n, now, m, sz[N...
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 11; const long long oo = 1e17 + 123; int tcases = 1; int n, m = 0; long long a[N], b[N], s[N], res[N]; pair<int, int> q[N]; struct Point { double x, y; Point() { x = y = 0; } Point(double _x, double _y) : x(_x), y(y) {} }; ...
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2016.4 (lin64) Build Wed Dec 14 22:35:42 MST 2016 // Date : Sat Jan 21 14:43:33 2017 // Host : natu-OMEN-by-HP-Laptop running 64-bit Ubunt...
#include <bits/stdc++.h> const int md = 1e9 + 7; const long long hs = 199; using namespace std; int n, x; set<int> a; int main() { ios::sync_with_stdio(0), cin.tie(0), cout.tie(0); cin >> n; for (int i = 1; i <= n; i++) a.insert(i); cout << 1 ; while (--n) { cin >> x; a.era...
// 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 agreed...
/* * 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 = 310; int mod[3]; int n; string s[maxn]; long long ha[maxn][3]; int prel[maxn]; int main() { ios::sync_with_stdio(false); mod[0] = 1e9 + 7; mod[1] = 1e9 + 9; mod[2] = 19260817; cin >> n; int ans = 0; for (int i = 1...
#include <bits/stdc++.h> using namespace std; signed main() { long long int n, m, k; cin >> n >> m >> k; vector<long long int> ans; if (k > 1) { long long int last = 0; for (long long int i = 0; i < k; i++) { ans.push_back(0); } last = n - 1; for (long long int ...
module gost89_cfb( input clk, input reset, input mode, input load_data, input [511:0] sbox, input [255:0] key, input [63:0] in, output reg [63:0] out, output reg busy ); reg [63:0] gamma; reg [63:0] in_value; wire [63...
//////////////////////////////////////////////////////////////////////////////////////////////////// // Filename: counter_9bit.v // Author: T. Martin, Danny Dutton // Date: 09/07/04 // Version: 4 // Description: This module is a behavioral description of a nine-bit counter with enable and // ...
#include <bits/stdc++.h> using namespace std; const double eps = 1e-7; double dp[10050][1005]; int ans[1005]; int main() { int k, q, p, i, j; cin >> k >> q; memset(dp, 0, sizeof dp); dp[0][0] = 1; for (i = 1;; ++i) { for (j = 1; j <= k; ++j) { dp[i][j] += dp[i - 1][j] * j / k...
#include <bits/stdc++.h> using namespace std; long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); } long long lcm(long long a, long long b) { return a * (b / gcd(a, b)); } long long Max(long long a, long long b) { return a > b ? a : b; } long long Min(long long a, long long b) { retur...
// Accellera Standard V2.3 Open Verification Library (OVL). // Accellera Copyright (c) 2005-2008. All rights reserved. integer cnt; `ifdef OVL_SYNTHESIS `else initial begin cnt=0; end `endif `ifdef OVL_XCHECK_OFF //Do nothing `else `ifdef OVL_IMPLICIT_XCHECK_OFF //Do nothing `else wire valid_...
////////////////////////////////////////////////////////////////// // // // Arithmetic Logic Unit (ALU) for Amber 2 Core // // // // This file is part of the Amber project ...
/*------------------------------------------------------------------------------ * This code was generated by Spiral Multiplier Block Generator, www.spiral.net * Copyright (c) 2006, Carnegie Mellon University * All rights reserved. * The code is distributed under a BSD style license * (see http://www.opensource.or...
#include <bits/stdc++.h> using namespace std; int main() { int n, x, y, flag = 0; cin >> n >> x >> y; n /= 2; if ((n == x && n == y) || (n == (x - 1) && n == (y - 1)) || (n == (x) && n == (y - 1)) || (n == (x - 1) && n == (y))) flag = 1; if (flag) cout << NO << endl; el...
#include <bits/stdc++.h> using namespace std; int main() { long long n; vector<long long> v; cin >> n; long long a = 1; while (a * (a + 1) / 2 <= n) v.push_back(a * (a + 1) / 2), a++; for (long long i = 1; i * (i + 1) / 2 <= n; i++) { int cur = n - i * (i + 1) / 2; if (binary_sea...
//----------------------------------------------------------------------------- // // (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 ...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using pii = pair<int, int>; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n, m, k, t; cin >> n >> m >> k >> t; vector<pii> waste(k); for (int i = 0; i < k; ++i)...
#include <bits/stdc++.h> const long long N = 500005; const long long mod = 1e9 + 7; using namespace std; std::vector<long long> adj[N]; std::vector<bool> vis(N); void solve() { long long n, m, k, x = 0, y = 0, c = 0, q, ans = 0; cin >> n >> m; for (long long i = 0; i < m; ++i) { cin >> x >...
/* * 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...
/** \file "channel-source-sink.v" Chain a source and sink in prsim to verilog. $Id: channel-source-sink.v,v 1.4 2010/04/06 00:08:26 fang Exp $ */ `timescale 1ns/1ps `include "standard.v" `define inv_delay 0.020 module timeunit; initial $timeformat(-9,1," ns",9); endmodule module TOP; reg l0, l1, re; wire l...
#include <bits/stdc++.h> using namespace std; int getDaysOfMonth(int m) { if (m == 1 || m == 3 || m == 5 || m == 7 || m == 8 || m == 10 || m == 12) return 31; if (m == 2) return 28; return 30; } int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); ; int n; cin...