text stringlengths 59 71.4k |
|---|
//-------------------------------------------------------------------
//-- baudtx2_tb.v
//-- Banco de pruebas para la tranmision de datos continua
//-------------------------------------------------------------------
//-- BQ August 2015. Written by Juan Gonzalez (Obijuan)
//---------------------------------------------... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long n; cin >> n; string s[n]; long long flg = 1; long long ar[n]; for (long long i = 0; i < n; i++) { cin >> s[i]; long long flag = 0; long long pos = -... |
#include <bits/stdc++.h> using namespace std; int n, seq[100005]; char s[2][55]; string a[100005], b[100005], cur; void solve() { scanf( %d , &n); for (int i = 0; i < n; i++) { scanf( %s %s , s[0], s[1]); a[i] = s[0]; b[i] = s[1]; } for (int i = 0; i < n; i++) { scanf( ... |
#include <bits/stdc++.h> using namespace std; int main() { long long i, j, k, l, m, n, t, x, y; cin >> n; if (n % 2 == 0) cout << n + 4 << << 4 << endl; else cout << n + 9 << << 9 << endl; return 0; } |
`timescale 1ns / 1ps
//__________________________________________________uart_rx
`define IDLE 1'd0
`define RECV_BIT 1'd1
//__________Test Bench
`define BIT_TMR_MAX 10'd869 // #10240 <-- 115200 : tb #1738
//`define BIT_TMR_MAX 14'd10417//14'b10100010110000 // 14'd10416 #10417
//________________... |
#include <bits/stdc++.h> using namespace std; int dx[] = {0, 0, 1, -1, -1, -1, 1, 1}; int dy[] = {1, -1, 0, 0, -1, 1, 1, -1}; template <class T> inline T biton(T n, T pos) { return n | ((T)1 << pos); } template <class T> inline T bitoff(T n, T pos) { return n & ~((T)1 << pos); } template <cl... |
#include<bits/stdc++.h> using namespace std; int t,f,i,j,p,q,x,y,dx[128],dy[128]; char s[5008]; int main() { for(dx[ L ]=-(dx[ R ]=1),dy[ D ]=-(dy[ U ]=1),scanf( %d ,&t); t--; f?0:printf( 0 0 n )) for(scanf( %s ,s),f=i=p=q=0; s[i]; x||y?++i: (printf( %d %d n ,p,q)... |
#include <bits/stdc++.h> using namespace std; const long long INF = 2e18; const long long INFINT = 2e9; const int N = 1000006; const int NN = 1006; const int MOD = 1000000007; int main() { ios_base::sync_with_stdio(0); long double n, h; cin >> n >> h; long double s = 1.0 * 1 * h / 2; l... |
#include <bits/stdc++.h> using namespace std; long long mod = 998244353; long long fast_exp(long long a, long long b) { if (b <= 0) return 1; else { long long res = 1; res = fast_exp(a, b / 2); res = (res * res) % mod; if (b % 2 == 1) res = (res * a) % mod; return res; ... |
#include <bits/stdc++.h> using namespace std; using std::bitset; const double Pi = acos(-1); inline long long read() { long long x = 0; bool fu = 0; char ch = 0; while (ch > 9 || ch < 0 ) { ch = getchar(); if (ch == - ) fu = 1; } while (ch <= 9 && ch >= 0 ) x = (x * 10... |
module main;
reg [2:0] Q;
reg clk, clr, up, down;
(*ivl_synthesis_off *)
initial begin
clk = 0;
up = 0;
down = 0;
clr = 1;
#1 clk = 1;
#1 clk = 0;
if (Q !== 0) begin
$display("FAILED");
$finish;
end
up = 1;
clr = 0;
#1 clk = 1;... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; int arr[n]; int freq[101] = {0}; for (int i = 0; i < n; i++) { cin >> arr[i]; freq[arr[i]]++; } sort(freq, freq + 101, greater<int>()); int max = freq[0]; int num = 0; for (int i =... |
#include <bits/stdc++.h> using namespace std; int main() { char a[1000000], b[1000000]; int n; cin >> n >> a; int l = strlen(a); for (int i = 1; i < n; i++) { cin >> b; for (int j = 0; j < l; j++) { if (a[j] == ? ) a[j] = b[j]; else if (b[j] == ? ) ... |
#include <bits/stdc++.h> using namespace std; long long n, i = 1; int main() { cin >> n; while ((n % i) == 0) i *= 3; cout << n / i + 1 << endl; return 0; } |
#include <bits/stdc++.h> using namespace std; map<string, int> Ts; string size[101] = { S , M , L , XL , XXL }; inline int to_size(string s) { for (int i = 0; i < 5; ++i) { if (s == size[i]) return i; } } int main() { int a[11], k; string pe[10010]; for (int i = 0; i < 5; ++i) ... |
#include <bits/stdc++.h> using namespace std; const int N = 201000; struct str { long long nr; char c; }; int n, m; str a[2 * N], b[N], l[N]; vector<int> poz; bool cmp(str a, str b) { return (a.nr == b.nr && a.c == b.c); } int z[2 * N]; void calcpot() { int i, j; for (i = 1; i <= n; ... |
#include <bits/stdc++.h> using namespace std; const int N = 300500; int T[N], L[N], C[N]; int m; int len = 0; const int inf = 100500; int A[N]; int fs = -1, pos = -1; void apply() { for (int i = 0; i < m; i++) { if (i == m - 1) { pos = len; fs = m - 1; goto end; ... |
#include <bits/stdc++.h> using namespace std; const long long md = 1e9 + 7; int main() { cout.precision(12); iostream::sync_with_stdio(0); cin.tie(0), cout.tie(0); const int MX = 1e6 + 1; vector<int> pr(MX, 1); vector<int> o; for (int i = 2; i < MX; i++) { if (!pr[i]) continue; ... |
//*****************************************************************************
// (c) Copyright 2009 - 2010 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
/... |
/**
* 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 MAXN = 2e5 + 7; const long long INF = 3e18 + 7; long long n, t; long long a[MAXN], p[MAXN], l[MAXN], r[MAXN]; long long ans[MAXN]; signed main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> n >> t; for (long long i = 0; i ... |
#include <bits/stdc++.h> using namespace std; long long n, mx[400000], mn[400000]; long long seg[400000 * 4]; vector<long long> compress(vector<long long> x) { vector<long long> ans = x; vector<pair<long long, long long>> p; p.push_back({0, 0}); for (long long i = 1; i < x.size(); i++) { p... |
#include <bits/stdc++.h> using namespace std; const long long BIG = 1000000000000000000LL; void solve(); signed main() { ios::sync_with_stdio(false); cin.tie(0); solve(); return 0; } const long long borne = 3 * (long long)(1e5) + 5; long long tab[borne]; long long som[borne]; long long... |
/*
* 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 forward_unit
* @author sabertazimi
* @email
* @brief data hazards detection and forward signals generation
* @input ID_rs rs value in ID stage
* @input ID_rt rt value in ID stage
* @input EX_rs rs value in EX stage
* @input EX_rt rt value in EX stage
* @input MEM_rt rt value in MEM stage
* @in... |
#include <bits/stdc++.h> using namespace std; const long long MAX = 2e6 + 99; const long long INF = 1e12; const long long mod = 1e9 + 7; set<pair<long long, long long>> dif; set<pair<long long, long long>>::iterator it; long long N, M, row[1000], col[1000], mark[500][500], imp[500][500], arr[500][50... |
#include <bits/stdc++.h> #define mp make_pair #define mt make_tuple #define fi first #define se second #define pb push_back #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define forn(i, n) for (int i = 0; i < (int)(n); ++i) #define for1(i, n) for (int i = 1; i <= (i... |
/*
* Copyright (c) 1998-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 int mod = 1e9 + 7; const int inf = 1e9 + 9; const long long MOD = 1e9 + 696969; const long long INF = 1e18; int n, m, k, a, b, c, w, h; char s[1000100]; int dp[1000100][26], last[1000100][26]; pair<int, int> SECOND, MIN; inline pair<int, int> minex... |
#include <bits/stdc++.h> using namespace std; const int INF = INT_MAX; const long long mod = 1e9 + 7; int main() { cin.tie(0); ios_base::sync_with_stdio(0); unsigned long long n; cin >> n; unsigned long long c = 2 * 3 * 4 * 5 * 7 * 3; if (c > n) { cout << 0 n ; return 0; ... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
#include <bits/stdc++.h> using namespace std; const int nm = 100002; int n, d; long long x; int a[nm], b[nm], vt[nm]; int c[nm]; int nc; int getNextX() { x = (x * 37 + 10007) % 1000000007; return x; } void init() { int i; for (i = 0; i < n; i = i + 1) { a[i] = i + 1; } ... |
`timescale 1ns/100ps
/**
* `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... |
/**
* 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 vector<int> vi; typedef vector<int> vll; typedef pair<int, int> pii; #define F first #define S second #define PB push_back #define MP make_pair #define ALL(v) v.begin(), v.end() #define rALL(v) v.rbegin(), v.rend() #defi... |
#include <bits/stdc++.h> using namespace std; int n; string s, ans; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> n; cin.ignore(numeric_limits<streamsize>::max(), n ); cin >> s; bool flag = true; int cnt = 0, max_cnt = 0; for (int i = 0; i < n - 1; ++i) { ... |
#include <bits/stdc++.h> using namespace std; int n, z, p, i, j, k, ans, t, a[105], b[105], d[105], f[105][10005]; bool cmp(int x, int y) { return x > y; } int main() { scanf( %d , &n); for (i = 1; i <= n; i++) scanf( %d , &a[i]), z += a[i]; for (i = 1; i <= n; i++) scanf( %d , &b[i]), d[i] = b[i]; ... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 7; int n, m, q[N], a[N]; int main() { scanf( %d , &m); for (int i = (0); i < (m); ++i) scanf( %d , &q[i]); int mn = *min_element(q, q + m); scanf( %d , &n); for (int i = (0); i < (n); ++i) scanf( %d , &a[i]); sort(a, a + n... |
/**
* 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 main() { long long int n, a, b, i, x, t, rem; cin >> n >> a >> b; for (i = 0; i < n; i++) { cin >> x; t = (x * a) % b; if (t / a >= 1) rem = t / a; else rem = 0; cout << rem << ; } return 0; } |
#include <bits/stdc++.h> int n; int main() { int i; long long ans, sumx, sumy, x, y; scanf( %d , &n); ans = sumx = sumy = 0; for (i = 0; i < n; i++) { scanf( %I64d%I64d , &x, &y); ans += (long long)x * x * n + y * y * n; sumx += x; sumy += y; } printf( %I64d , ans... |
/*
* 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... |
`default_nettype none
module pipeline_control_hundler_read(
input wire iCLOCK,
input wire inRESET,
input wire iRESET_SYNC,
//System Register
input wire [31:0] iSYSREG_IDTR,
//Request
input wire iRD_START,
input wire [6:0] iRD_IRQ_NUM,
output wire oRD_FINISH,
output wire [31:0] oRD_HUNDLER,
//L... |
// ==============================================================
// RTL generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
// Version: 2014.1
// Copyright (C) 2014 Xilinx Inc. All rights reserved.
//
// ===========================================================
`timescale 1 ns / 1 ps
modul... |
#include <bits/stdc++.h> using namespace std; int a[1000000], g[1000000], h[1000000]; int d[1000000]; int dp[1000000]; int up[1000000]; int h1[1000000]; int h2[1000000]; int t1[1000000]; int t2[1000000]; vector<int> v[1000000]; int x, y, n, m; int maxy, one_kek, two_kek; void dfs(int x, int pr... |
/**
* 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 "timescale.v"
`include "i2c_master_defines.v"
module opencores_i2c
(
wb_clk_i, wb_rst_i, wb_adr_i, wb_dat_i, wb_dat_o,
write_n, read_n, wb_cyc_i, wb_ack_o, wb_inta_o,
scl_pad_io, sda_pad_io
);
// Common bus signals
input wb_clk_i; // WISHBONE clock
input wb_rst_i; // WISHBONE reset
// S... |
Require Import Iron.Language.SystemF2Effect.Value.Relation.TyJudge.
(* Uniqueness of typing.
Checking an expression always returns a unique type an effect. *)
Lemma typex_unique
: forall ke te se sp x t1 e1 t2 e2
, TypeX ke te se sp x t1 e1
-> TypeX ke te se sp x t2 e2
-> t1 = t2 /\ e1 = e2.
Proof.
intro... |
#include <bits/stdc++.h> using namespace std; int main(int argc, char* argv[]) { cin.sync_with_stdio(0); cout.sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, r[100], b[100], sumr, sumb, ans = 1, check = 1; cin >> n; for (int i = 0; i < n; i++) cin >> r[i]; for (int i = 0; i < n; ... |
#include <bits/stdc++.h> using namespace std; int main() { int i; int n, m1; cin >> n >> m1; int a[n + 1]; for (i = 1; i <= n; i++) cin >> a[i]; int t, r; stack<pair<int, int> > s; pair<int, int> use; for (i = 1; i <= m1; i++) { cin >> t >> r; while (!s.empty() && (s.... |
#include <bits/stdc++.h> int sg[100010], f[100010], pre[100010]; int used[100010]; int n; int cal(int n) { for (int m = 2;; m++) { int tot = m * (m - 1) / 2; if (tot > n) break; tot = n - tot; if (tot % m) continue; int s = tot / m; int t = s + m - 1; int v = sg[t] ... |
#include <bits/stdc++.h> using namespace std; #define N 200020 int cnt, last[N], n, ans; struct edge { int to, next; } e[N << 1]; inline void add(int u, int v) { e[++cnt] = {v, last[u]}, last[u] = cnt; e[++cnt] = {u, last[v]}, last[v] = cnt; } int dfs(int x, int fa) { ve... |
#include <bits/stdc++.h> using namespace std; int main() { int n; string Decod, s; cin >> n >> s; int i = 0; while (n) { if (n % 2 != 0) { Decod += s[i]; } else { Decod = s[i] + Decod; } n = n - 1; i++; } cout << Decod << endl; } |
/**
* 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> #pragma warning(disable : 4786) #pragma comment(linker, /STACK:16777216 ) using namespace std; int A[100005]; int I[100005]; int D[100005]; int n; int max(int a, int b) { if (a > b) return a; return b; } int ABS(int a) { if (a < 0) return a = a * -1; return ... |
/*
* 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 (c) 2011 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; int main() { int m, n; cin >> n >> m; int flag = 0, j, i; for (i = n + 1; i <= m; i++) { flag = 0; for (j = 2; j * j <= i; j++) { if (i % j == 0) { flag = 1; break; } } if (flag == 0) { ... |
/*****************************************************************************
* File : processing_system7_bfm_v2_0_intr_rd_mem.v
*
* Date : 2012-11
*
* Description : Mimics interconnect for Reads between AFI and DDRC/OCM
*
*****************************************************************************/
module pr... |
#include <bits/stdc++.h> using namespace std; int h, w; int get(int x, int y) { if (!y) return x; if (x == h) return h + y; if (y == w) return h + w + (h - x); return h + w + h + (w - y); } vector<pair<long long, long long> > get(int h, int w, int x, int a, int b) { vector<pair<long long, ... |
/**
* 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... |
/*
* Milkymist SoC
* Copyright (C) 2007, 2008, 2009 Sebastien Bourdeauducq
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3 of the License.
*
* This program is distributed in ... |
`timescale 1ns/1ps
module SPIFSM #(
parameter SPPRWidth = 4,
parameter SPRWidth = 4,
parameter DataWidth = 8
) (
input Reset_n_i,
input Clk_i,
// FSM control
input Start_i,
output reg Done_o,
output reg [DataWidth-1:0] Byte0_o,
output ... |
#include <bits/stdc++.h> using namespace std; signed main() { long long n; cin >> n; char s; long long cnt = 0; while (cin >> s) { cnt += s == 8 ; } long long ans = 0; for (long long i = 0; i <= cnt; ++i) { if (min(i, (n - i) / 10) > ans) ans = min(i, (n - i) / 10); ... |
// megafunction wizard: %ROM: 1-PORT%VBB%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: Gameover.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// ===========================... |
#include <bits/stdc++.h> using namespace std; class fenwickTree { public: int* tree; int size; int prefixSum(int index) { index++; int ret = 0; while (index > 0) { ret += tree[index]; index -= (index & -index); } return ret; } void update(int inde... |
#include <bits/stdc++.h> using namespace std; const int N = 500005; int n, m[N], t[N]; struct People { int a, b, c, cnt; } p[N], ran[N]; int read() { int x = 0; char c = getchar(); while (!isdigit(c)) c = getchar(); while (isdigit(c)) x = x * 10 + c - 0 , c = getchar(); return x; ... |
/**
* ------------------------------------------------------------
* Copyright (c) All rights reserved
* SiLab, Institute of Physics, University of Bonn
* ------------------------------------------------------------
*/
module ramb_8_to_n (clkA,
clkB,
weA,
... |
//
// Copyright (c) 1999 Steven Wilson ()
//
// This source code is free software; you can redistribute it
// and/or modify it in source code form under the terms of the GNU
// General Public License as published by the Free Software
// Foundation; either version 2 of the License, or (at your option)
// ... |
#include <bits/stdc++.h> using namespace std; using ll = long long; vector<pair<int, int>> ans; int main() { cin.tie(0); ios::sync_with_stdio(false); int n; cin >> n; vector<int> a(n); for (int i = 0; i < n; i++) cin >> a[i]; reverse(a.begin(), a.end()); vector<pair<int, int>> an... |
#include <bits/stdc++.h> using namespace std; int main() { long long int n, a = 0, b = 0, c = 0, d = 0, i, e = 0, mine = 0, mn = 0; cin >> n; string s; cin >> s; for (i = 0; i < s.size(); i++) { if (s[i] == z ) a++; if (s[i] == e ) b++; if (s[i] == r ) c++; if (s[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) 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 main() { int x, y, z = 0, k, t = 0, e, g; vector<int> zero; vector<int> po; vector<int> ne; cin >> x; g = x; while (x--) { cin >> y; if (y < 0) { ne.push_back(y); k *= y; } if (y > 0) { po.p... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company: EasySoft Group
// Engineer: Ushakov M.V. (EvilLord666)
//
// Create Date: 04.10.2016 05:53:55
// Design Name:
// Module Name: clock_divider
// Project Name:
// Target Devices: Zynq-7k
// Tool Versions:... |
#include <bits/stdc++.h> using namespace std; const int MAXD = 60 + 5; const int MAXN = 2e3 * 60 + 5; const int mod = 1e9 + 7; inline long long pw(long long a, long long b) { long long res = 1; while (b) { if (b & 1) res = res * a % mod; a = a * a % mod; b >>= 1; } return res... |
/**
* 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 step_if(clk, rst_, ena_, rdy_, mem_re_, abus, dbus, pc_din, pc_dout, pc_we_, inst);
input clk;
input rst_;
input ena_;
output rdy_;
output mem_re_;
output[7:0] abus;
input[7:0] dbus;
output[7:0] pc_din;
input[7:0] pc_dout;
output pc_we_;
output[7:0] inst;
reg rdy_... |
#include <bits/stdc++.h> using namespace std; long long a[100010]; vector<pair<long long, long long> > people; long long Free[100010]; int main() { long long ts, tf, t; cin >> ts >> tf >> t; int n; scanf( %d , &n); if (n == 0) { cout << ts << endl; return 0; } for (int ... |
////////////////////////////////////////////////////////////////////////////////
//
// Filename: ../demo-out/iscachable.v
// {{{
// Project: AutoFPGA, a utility for composing FPGA designs from peripherals
//
// DO NOT EDIT THIS FILE!
// Computer Generated: This file is computer generated by AUTOFPGA. DO NOT EDIT.
// DO... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 4; vector<int> adj[N]; int deg[N]; int lv[N]; int decr[N]; int vis[N]; int main() { int n, k; scanf( %d%d , &n, &k); for (int i = 0; i < n - 1; i++) { int x, y; scanf( %d%d , &x, &y); adj[x].push_back(y); ... |
module DebugIR (
input wire clk,
input wire rst,
input wire ir,
output reg[3:0] mode,
output reg showName,
output reg err,
output wire stateOut,
output reg[1:0] cpuClkMode,
output reg[3:0] numberPressedData,
output reg numberPressed
);
reg[31:0] irRead; // For storing data r... |
#include <bits/stdc++.h> using namespace std; const long long int N = 1e5 + 5; const long long int M = 1e9 + 7; queue<pair<long long int, long long int> > pq; vector<long long int> v; map<long long int, long long int> mpp; set<pair<long long int, long long int> > st; long long int a[N], h[N], indx[N][2]... |
#include <bits/stdc++.h> using namespace std; inline long long read() { register long long x = 0, f = 1; char ch = getchar(); while (!isdigit(ch)) { if (ch == - ) f = -1; ch = getchar(); } while (isdigit(ch)) { x = (x << 3) + (x << 1) + ch - 0 ; ch = getchar(); } ... |
#include <bits/stdc++.h> using namespace std; int main() { int n; scanf( %d , &n); vector<int> piles(n); vector<pair<int, int>> cost(n); for (int i = 0; i < n; i++) { int tmp; scanf( %d , &tmp); piles[i] = tmp; int closest = int(sqrt(tmp) + 0.5f); cost[i] = pair<int... |
// This tests unalligned write/read access to packed structures
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2012 by Iztok Jeras.
module test;
typedef struct packed {
logic [7:0] high;
logic [7:0] low;
} word_t;
// Declare word* as a VARIABLE
word_t... |
#include <bits/stdc++.h> using namespace std; #pragma comment(linker, /stack:247474112 ) #pragma GCC optimize( O3 ) #pragma GCC optimize( Ofast ) #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native ) #pragma GCC optimize( unroll-loops ) long long mod = 1e9 + 7; void time() {} ... |
#include <bits/stdc++.h> using namespace std; int main() { int x[100005], y[100005]; int i, n, d = 0, k = 0, cnt = 0; cin >> n; cin >> x[0] >> y[0]; d = x[0]; k = y[0]; for (i = 1; i <= n; i++) { cin >> x[i] >> y[i]; if (y[i] > y[i - 1]) { k = y[i]; } } ... |
#include <bits/stdc++.h> using namespace std; inline int SG(double x) { return x > -1E-8 ? x < 1E-8 ? 0 : 1 : -1; } int c[1000000]; int main() { int n, m, r, i, j, k, d; long long md; scanf( %d %d %d , &n, &m, &r); for (i = 0; i < (n); i++) { scanf( %d , &c[i]); } if (n % 2 == 0) {... |
#include <bits/stdc++.h> using namespace std; char s[105][105]; int sz[105]; vector<int> g[105]; int usd[30]; int ord[30], szo = 0, din[30]; bool dfs(int v) { usd[v] = 1; for (int i = 0; i < g[v].size(); ++i) { int u = g[v][i]; if (usd[u] == 1) return false; else if (!usd... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 2001; const long long INF = 1e15; int DELTA = 2500; int n; long long price[MAXN], Time[MAXN]; long long dp[MAXN][3 * MAXN]; long long rec(int idx, int remTime) { if (remTime >= MAXN) remTime = MAXN - 1; if (idx == n) return remTime >... |
#include <bits/stdc++.h> using namespace std; int main() { int n, a[100], b[100], oa = 0, ob = 0, ore = 0; cin >> n; for (int i = 0; i < n; i++) { cin >> a[i] >> b[i]; if (a[i] % 2 == 1) oa++; if (b[i] % 2 == 1) ob++; if (a[i] % 2 == 1 && b[i] % 2 == 1) ore++; } if (oa % ... |
#include <bits/stdc++.h> using namespace std; int t, n, l, r, pos; char in[1000], ans[1000][10]; bool back; int main() { scanf( %d , &t); while (t--) { back = false; scanf( %s , in); n = strlen(in); for (int i = 1; i <= 8; i++) for (int j = 0; j <= 3; j++) ans[i][j] = ... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); string s; int n; cin >> n >> s; int res = 0; long long a = 0, b = 0; for (int i = 0; i < n; i++) { if (s[i] == s[0]) { a++; } else { break... |
/*
* 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 fifo # (parameter abits =6, dbits = 321)(
input reset, clock,
input rd, wr,
input [dbits-1:0] din,
output [dbits-1:0] dout,
output empty,
output full
//output reg ledres
);
wire db_wr, db_rd;
reg dffw1, dffw2, dffr1, dffr2;
reg [dbits-1:0] out;
//initial ledres = 0;
always ... |
#include <bits/stdc++.h> using namespace std; int a[300]; int main() { int n, k, cnt = 0; cin >> n >> k; for (int i = 0; i < 2 * n + 1; i++) cin >> a[i]; for (int i = 1; (i <= 2 * n - 1) && (cnt != k); i += 2) { if (a[i] - 1 > a[i - 1] && a[i] - 1 > a[i + 1]) { a[i]--; cnt++;... |
#include <bits/stdc++.h> using namespace std; const double eps = 1e-10; const double pi = 3.1415926535897932; const double eln = 2.718281828459045; vector<int> a[200005]; int p[200005], b[200005], od[200005]; void second(int m, int dah) { p[m] = dah; b[m] = 1; for (int i = 0; i < a[m].size(); ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.