text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; int n, m, k, u, v, a[200005], el, ans; vector<int> adj[200005]; queue<int> q; bool vis[200005]; int depth[200005], depthn[200005]; int main() { ios_base::sync_with_stdio(NULL); cin.tie(0); cout.tie(0); cin >> n >> m >> k; for (int i = 1; i ... |
#include <bits/stdc++.h> int f[1000001]; int main() { int n; scanf( %d , &n); f[0] = 0; f[1] = 1; f[2] = 1; int i, j, k; for (i = 3;; i++) { f[i] = f[i - 1] + f[i - 2]; if (f[i] > 1000000000) break; } int idx = i; int no = 0; for (i = 0; i < idx; i++) { ... |
#include <bits/stdc++.h> using namespace std; void solve() { int n; cin >> n; string s; cin >> s; map<char, vector<int>> ma; for (int i = 0; i < n; i++) { ma[s[i]].push_back(i + 1); } int m; cin >> m; vector<int> ans; while (m--) { string s1; cin >> s1; ... |
// -------------------------------------------------------------
//
// Generated Architecture Declaration for rtl of rs_fe1_pre_dec
//
// Generated
// by: lutscher
// on: Tue Jun 23 11:51:21 2009
// cmd: /home/lutscher/work/MIX/mix_1.pl rs_test.xls
//
// !!! Do not edit this file! Autogenerated by MIX !!!
// $Auth... |
#include <bits/stdc++.h> using namespace std; char ch[6700][3000]; char c[3000]; int vis[2000]; vector<int> ans; int len; void shift(int x, int k) { int num = 0; for (int i = len - 1; i > len - 1 - x; i--) { ch[k][num++] = ch[k - 1][i]; } for (int i = 0; i < len - x; i++) { ch[... |
#include <bits/stdc++.h> using namespace std; int a[505], b[505], n, t; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> t; while (t--) { cin >> n; bool ok = 1; for (int i = 0; i < n; i++) cin >> a[i]; for (int i = 0; i < n; i++) { cin >> b[i]; } ... |
//-----------------------------------------------------------------------------
//
// Jonathan Westhues, April 2006
//-----------------------------------------------------------------------------
module hi_read_rx_xcorr(
pck0, ck_1356meg, ck_1356megb,
pwr_lo, pwr_hi, pwr_oe1, pwr_oe2, pwr_oe3, pwr_oe4,
adc... |
`include "register_set.v"
`include "remap.v"
module register_block(
input logic clk,
input logic reset,
input logic wnr,
input logic [1:0] req,
input logic [7:0] address,
... |
#include <bits/stdc++.h> using namespace std; using i128 = __int128_t; using u128 = __uint128_t; const long long MOD = 998244353; const long double PI = 3.141592653589793238; const long long pi = 31415926; const long long inf = 1000000000000000000; const long long small_inf = INT_MAX; long long int mo... |
// -----------------------------------------------------------------------
module uart(
input clk,
input send,
input [7:0] tx_byte,
output [7:0] rx_byte,
output tx_ready,
output rx_ready,
output txd,
input rxd
);
parameter baud;
parameter clk_speed;
localparam prescale = clk_speed/baud;
localparam width ... |
#include <bits/stdc++.h> using namespace std; int main() { int n, k; int i, ans, j, t; int num[2005]; while (scanf( %d%d , &n, &k) != EOF) { ans = 0; for (i = 0; i < n; i++) scanf( %d , &num[i]); for (i = 0; i < n; i++) for (j = 0; j < n - i - 1; j++) if (num[j] >... |
#include <bits/stdc++.h> using namespace std; void logf(istream_iterator<string> it) {} template <typename T, typename... Args> void logf(istream_iterator<string> it, T a, Args... args) { cout << *it << = << a << ; logf(++it, args...); } const double PI = acos(-1); void solve() { string s... |
//
// Copyright (c) 2002 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)
// ... |
/*******************************************************************************
* 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 ... |
/*
* 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> const int INF = 0x3f3f3f3f; using namespace std; void file(bool opt) { if (opt && fopen( in.txt , r )) freopen( in.txt , r , stdin), freopen( out.txt , w , stdout); } struct node { double x, y; } point[100000 + 5], tu[100000 + 5]; int tot = 0; int n; double mu... |
#include <bits/stdc++.h> using namespace std; const int maxn = 3e5 + 5, Lim = 18; int tr[maxn * 19][2], nowxor, cnt = 1, siz[maxn * 19], n, m; template <typename T> inline void read(T &x) { char c; int f = 1; while (!isdigit(c = getchar())) (c == - ) && (f = -1); x = c ^ 48; while (isdigi... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 1100000; int n, m; char a[MAXN], b[MAXN]; int s[MAXN], t[MAXN]; inline int id(int x, int y) { if (x < 1 || x > n || y < 1 || y > m) return 0; return (x - 1) * m + y; } bool check(int k) { for (int i = 1; i <= n; i++) { for ... |
#include <bits/stdc++.h> using namespace std; int main() { int n, a[101]; scanf( %d , &n); for (int i = 0; i < n; i++) scanf( %d , &a[i]); sort(a, a + n); int i = 1; while (a[i] == a[i - 1] && i < n) i++; if (i == n) printf( NO n ); else printf( %d n , a[i]); return 0... |
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 10; char s[N], t[N]; int vis[N], vs[N]; int main() { cin >> s + 1 >> t + 1; int j = 1; int n = strlen(s + 1); int m = strlen(t + 1); for (int i = 1; i <= n && j <= m; ++i) { if (s[i] == t[j]) { vis[j] = i; ... |
#include <bits/stdc++.h> using namespace std; const int N = 1e3 + 3, M = 3e4 + 4, inf = 2e9 + 1; int m, n, s, t, cur, tim, mn; int low[N], dfn[N], vis[N], cst[M]; vector<pair<int, int> > vt[N]; vector<int> pat, rut, ans; bool dfs(int u) { vis[u] = 1; if (u == t) return 1; for (int i = 0; i < v... |
#include <bits/stdc++.h> using namespace std; int u = 1, i = 0, q1, q2, a[100001], s[200002], d[100000], f[100001]; void k(int w) { q2 = w / 2; while (a[s[q2]] > a[q1]) { s[w] = s[q2]; w = q2; q2 /= 2; } s[w] = q1; } void l() { if (i) { i--; k(d[i]); } els... |
/* Module from the schematic_gui program written by Andreas Ehliar <>
This Verilog file is licensed under the CC0 license. */
module mux6 #(parameter WIREWIDTH = 1) (input wire [2:0] s,
input wire [WIREWIDTH:0] d0, d1, d2,d3, d4,d5,
output reg [WIREWIDTH:0] o);
initial begin
$schematic_boundingbo... |
#include <bits/stdc++.h> using namespace std; const double PI = 3.141592653589793238; long long powmod(long long a, long long b) { long long res = 1; a %= 1000000007; for (; b; b >>= 1) { if (b & 1) res = res * a % 1000000007; a = a * a % 1000000007; } return res; } long long f... |
#include <bits/stdc++.h> using namespace std; int main() { int n, arr[200005]; string swaps; cin >> n; for (int i = 1; i <= n; i++) cin >> arr[i]; cin >> swaps; int m = 0, flag = 0; for (int i = 1; i < n; i++) { m = max(m, arr[i]); if (swaps[i - 1] == 0 && m > i) { ... |
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; int main() { ios_base::sync_with_stdio(0); cout.tie(0); cin.tie(0); int q; cin >> q; for (int i = 0; i < q; i++) { ll k, n, a, b; cin >> k >> n >> a >> b; if (k - n * b <= 0) { ... |
#include <bits/stdc++.h> using namespace std; const double eps = 1e-9; const int INF = 1e9; using ll = long long; using ull = unsigned long long; using vi = vector<int>; using vl = vector<ll>; using vb = vector<bool>; using vc = vector<char>; using vii = vector<vi>; using vll = vector<vl>; using... |
#include <bits/stdc++.h> #pragma comment(linker, /stack:225450978 ) #pragma GCC optimize( Ofast ) #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native ) using namespace std; const long long Mod = 1000000007LL, INF = 1e9, LINF = 1e18; const long double Pi = 3.141592653589793116, EPS =... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 20:07:28 11/07/2013
// Design Name:
// Module Name: and_or_array
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// De... |
#include <bits/stdc++.h> using namespace std; int main() { int d, n, a, s = 0, k; scanf( %d , &d); scanf( %d , &n); scanf( %d , &a); for (k = 1; k < n; k++) { s += d - a; scanf( %d , &a); } printf( %d n , s); return 0; } |
#include <bits/stdc++.h> using namespace std; long long int n, m, sx, sy, vx, vy; inline long long int extgcd(long long int a, long long int b, long long int &x, long long int &y) { if (!b) { x = 1; y = 0; return a; } long long int d = extgcd(b, a % b, x... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company: Burke
// Engineer: Tom Burke
//
// Create Date: 19:39:14 08/24/2011
// Design Name:
// Module Name: qdiv.v
// Project Name: Fixed-point Math Library (Verilog)
// Target Devices:
//... |
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { string s, s1, s2; cin >> s >> s1 >> s2; bool lock = false; for (int i = 0; i < s.length(); i++) { if (s[i] == s2[i]) { swap(s1[i], s2[i]); } else { if (s1... |
//Legal Notice: (C)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 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 la... |
#include <bits/stdc++.h> using namespace std; const double EPS = 1e-9; const double PI = acos(-1.0); const int MOD = 1000 * 1000 * 1000 + 7; const int INF = 2000 * 1000 * 1000; const int MAXN = 200010; template <typename T> inline T sqr(T n) { return n * n; } int n, k; vector<int> g[MAXN]; l... |
#include <bits/stdc++.h> using namespace std; int f(string s) { int ans = 0; for (int i = 0; i < s.length(); i++) { if (s[i] == 1 ) { ans++; } } return ans; } int main() { string a, b; cin >> a >> b; int c1 = f(a); if (c1 % 2 != 0) { c1++; } if ... |
#include <bits/stdc++.h> using namespace std; int32_t main() { long long n, k; cin >> n >> k; vector<long long> occ(255); string s; cin >> s; long long streak = 0; char curr = s[0]; for (long long i = 0; i < n; i++) { if (s[i] == curr) { streak++; if (streak == ... |
#include <bits/stdc++.h> using namespace std; int main() { int n, r; long long a; map<int, long long> d; int ans[300010]; int k = 0; ans[0] = 1; cin >> n; for (int i = 1; i <= n; ++i) { scanf( %I64d , &a); if (d[a] > r) { ans[++k] = i; r = i; } else ... |
#include <bits/stdc++.h> using namespace std; template <class T> inline T sqr(T x) { return x * x; } template <class T> inline T parse(const string &s) { T x; stringstream ss(s); ss >> x; return x; } const double EPS = 1e-12; const int INF = 1000 * 1000 * 1000; const long long LI... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; int n, m, k; pair<string, int> A[11]; int main() { scanf( %i , &n); for (int i = 0; i < 7; i++) A[i].second = 2e7; for (int i = 0; i < n; i++) { string s; int p; cin >> p >> s; sort(s.begin(), s.end()); if (s == ABC ) ... |
#include <bits/stdc++.h> using namespace std; int n, c; int a[1 << 20], b[1 << 20]; char tp[1 << 20]; int hs[128][128]; int ne[128][128]; int li[128]; bool getDP(int l, int r) { if (hs[l][r] != -1) return hs[l][r]; if (l >= r) { return (hs[l][r] = 1); } hs[l][r] = 0; for (int k... |
#include <bits/stdc++.h> const int LG = 21; const int N = 500005; const long long MOD = 1e9 + 7; const long long INF = 1e9; const long long INFLL = 1e18; using namespace std; void dfs(int v, int paint, vector<int> &col, vector<vector<pair<int, int> > > &graph, vector<int> &need, int &cnt0, ... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> v(n); int ans = 0, cnt = 0; for (int i = 0; i < n; i++) { cin >> v[i]; } for (int i = 0; i < n; i++) { if (v[i] == i) ans++; else if (v[v[i]] == i) { cnt = 1; }... |
#include <bits/stdc++.h> using namespace std; const int LN = 18, maxn = (1 << LN); const long long mod = (long long)(998244353); int fact[maxn], inv_fact[maxn], poww_r[maxn], poww_inv_r[maxn]; int mul(long long a, long long b) { long long ret = (a * b) % mod; return (int)(ret); } int add(int a, in... |
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 1995/2005 Xilinx, Inc.
// All Right Reserved.
///////////////////////////////////////////////////////////////////////////////
// Modified for HPDMC simulation, based on Xilinx 05/29/07 revision
/////////////////////////////... |
#include <bits/stdc++.h> using namespace std; int main() { int n; while (scanf( %d , &n) == 1) { if (n == 1) printf( -1 n ); else if (n == 2) { printf( 2 2 n ); } else if (n == 4) printf( 4 2 n ); else { int a, b; if (n % 2 == 0) { 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... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; int n, res[300010], c[300010], trie[300010][30], dif[300010], ans, cans; vector<vector<int> > gr; string s; void merge(int big, int small) { dif[big] = 1; for (int i = 0; i < 26; ++i) { if (trie[small][i] and trie[big][i]) { merge(trie[big][i... |
/*
* 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... |
// This module generate M single 2*HW-1 bit vector each T time steps
module stimulus #(parameter W = 8, M = 200, MAX = 256) (
input bit clk, reset,
output reg [W-1:0] x
);
int i;
initial begin
@(negedge reset);
for (i = 0; i < M; i=i+1) begin
@(negedge clk)... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, d; cin >> a >> b >> c >> d; int e = max(c, d); if (e > 2 * c || e > 2 * d || e >= b) { cout << -1; return 0; } cout << 2 * a << endl << 2 * b << endl << e; return 0; } |
module tb_sync_merge;
/*AUTOREG*/
/*AUTOWIRE*/
// Beginning of automatic wires (for undeclared instantiated-module outputs)
wire a1; // From U_SYNC_MERGE of sync_merge.v
wire a2; // From U_SYNC_MERGE of sync_merge.v
wi... |
#include <bits/stdc++.h> int n, m, c[256]; int main() { int a, j; scanf( %d%d , &n, &m); memset(c, -1, sizeof(c)); for (int i = 0; i < n; ++i) { scanf( %d , &a); if (~c[a]) printf( %d , c[a]); else { j = a; while (j && !~c[j - 1] && j > a - m + 1) --j; ... |
#include <bits/stdc++.h> using namespace std; int Ans[1001], A[1001], B[1001], C[1001], D[1001], E[1001]; int value(int Arr[], int i, int j, int k) { return (Arr[j] - Arr[i]) * (Arr[k] - Arr[i]); } int main() { int n; cin >> n; for (int i = 0; i < n; i++) { cin >> A[i] >> B[i] >> C[i] >>... |
/*******************************************************************************
* 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 ... |
#include <bits/stdc++.h> using namespace std; void debug_out() { cerr << endl; } template <class T> ostream& prnt(ostream& out, T v) { out << v.size() << n ; for (auto e : v) out << e << ; return out; } template <class T> ostream& operator<<(ostream& out, vector<T> v) { return prnt(ou... |
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 1995/2011 Xilinx, Inc.
// All Right Reserved.
///////////////////////////////////////////////////////////////////////////////
// ____ ____
// / /\/ /
// /___/ \ / Vendor : Xilinx
// \ \ \/ Version : 13.... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; int a, b, c, x, y, z, st; int proc(int l, int r) { if (l > r) return (l - r) / 2; return l - r; } int main() { scanf( %d%d%d , &a, &b, &c); scanf( %d%d%d , &x, &y, &z); st = 0; st += proc(a, x); st += proc(b, y); st += proc(c, z); ... |
// Fetch-Issue Pipeline Register
module iss_pipe_reg
(
input wire clk,
input wire reset,
input wire clr,
input wire enable,
// PC related inputs from fetch stage
input wire[31:0] next_pc_iss_pipe_reg_i,
input wire[31:0... |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: sparc_exu_aluaddsub.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 TAM = 100000 + 15; const long long MOD = 1000000007LL; const double PI = 3.14159265359; long long add(long long x, long long y) { return (x + y + 2 * MOD) % MOD; } long long mult(long long x, long long y) { return (add(x, 0) * add(y, 0)) % MOD; }... |
/**
* 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 main() { double t, n, i, x, mx, mn, f, j, s, r, y, c, m, k = 0, W, H, x1, y1, w, h, w1, h1, l, u, d, sw, sh, X, Y, X1, X2, R; cin >> t; while (t--) { cin >> W >> H; cin >> x >> y >> x1 >> y1; cin >> w >> h; w1 = abs(x - x1... |
/* This file is part of JT12.
JT12 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.
JT12 is distributed in the hope tha... |
// megafunction wizard: %RAM: 2-PORT%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: msu_databuf.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// ============================... |
#include <bits/stdc++.h> using namespace std; int n, a, b, k, q; int added[200055]; struct BIT { int dat[200055]; void add(int id, int val) { while (id < n) { dat[id] += val; id |= (id + 1); } } int sum(int id) { int ret = 0; while (id >= 0) { ret ... |
/*
Copyright (c) 2014 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, distribute,... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; int arr[1003][1003]; int n, m; int dp[1003][1003]; int vis[1003][1003]; int dx[4] = {0, 1, 0, -1}; int dy[4] = {1, 0, -1, 0}; int dfs(int i, int j, int x) { if (vis[i][j] == 2) { printf( Poor Inna! n ); exit(0); } if (dp[i][j] != -1) ... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); long long n, i, j, x, k; cin >> n >> k; string s, t; cin >> s; t = s; for (i = 0; i < n; i++) { if (i - k >= 0) t[i] = t[i - k]; } if (t > s) { cout << n << n <<... |
#include <bits/stdc++.h> using namespace std; int cp(int a, int b) { return a > b; } int main() { int a[55], i, j, k, l, coun, flag; int n; scanf( %d%d , &n, &k); for (i = 1; i <= n; i++) { scanf( %d , &a[i]); } sort(a + 1, a + n + 1, cp); if (k <= n) { for (i = 1; i <= k; ... |
#include<bits/stdc++.h> #define ll long long #define ii pair<ll,ll> #define x first #define y second using namespace std; const long o=200005; ll n,it[2][4*o]; ii a[o]; vector<ii>p[2]; void build(long db,long x,long l,long r) { if(l==r) { it[db][x]=p[db][l].y; retur... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; struct Tpoint { double x, y; Tpoint() {} Tpoint(double _x, double _y) { x = _x; y = _y; } inline void read() { scanf( %lf%lf , &x, &y); } inline void show() { printf( %lf %lf n , x, y); } inline double norm() { return sqrt(((x) * ... |
#include <bits/stdc++.h> using namespace std; inline int read(void) { int sum = 0, sign = 1; char ch = getchar(); while (ch > 9 || ch < 0 ) { if (ch == - ) sign = -1; ch = getchar(); } while (ch >= 0 && ch <= 9 ) { sum = ... |
//-----------------------------------------------------------------
// AltOR32
// Alternative Lightweight OpenRisc
// V2.0
// Ultra-Embedded.com
// Copyright 2011 - 2013
//
// Email:
//
// ... |
#include <bits/stdc++.h> using namespace std; const int days[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; struct date { int arr[3]; void read() { string s; cin >> s; for (int i = 0; i < 3; i++) { arr[i] = (s[i * 3] - 0 ) * 10 + (s[i * 3 + 1] - 0 ); } } ... |
#include <bits/stdc++.h> using namespace std; long long mod = 1e9 + 7; int main() { ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL); int test = 1; cin >> test; while (test--) { string s; cin >> s; int a = -1, b = -1, c = -1; int ans = s.size(); for... |
#include <bits/stdc++.h> using namespace std; char a[1001][1001]; int main() { long long n, m, i, j, s = 0; cin >> n >> m; for (i = 1; i <= n; i++) for (j = 1; j <= m; j++) cin >> a[i][j]; for (i = 1; i <= n; i++) for (j = 1; j <= m; j++) { if (a[i][j] == f && a[i + 1][j] == ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 05/22/2015 09:35:04 AM
// Design Name:
// Module Name: pwm
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
// Revisi... |
#include <bits/stdc++.h> using namespace std; const int MOD = 1e9 + 7; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int t; cin >> t; while (t--) { int n; cin >> n; for (int i = 0; i < n; i++) { cout << 1 ; } cout << endl; } retur... |
#include <bits/stdc++.h> using namespace std; const int INF = INT_MAX; const double EPS = 1e-10; inline double SQR(double x) { return x * x; } inline long long SQR(long long x) { return x * x; } inline int SQR(int x) { return x * x; } inline double SQR3(double x) { return x * x * x; } inline void DEBUG(... |
#include <bits/stdc++.h> inline int Get() { char ch; while ((ch = getchar()) < 0 || ch > 9 ) ; int Num = ch - 0 ; while ((ch = getchar()) >= 0 && ch <= 9 ) Num = (Num << 3) + (Num << 1) + ch - 0 ; return Num; } const int M = 3e3 + 5; const int m = 3000; int n, a[M][M], ... |
//date:2016/3/13
//engineer:ZhaiShaoMin
//module name: pipeline register between id and ex
module core_id_ex(//input
clk,
rst,
// inst_lo,
wb_reg_write,
wb_memtoreg,
mem_memread,
... |
#include <bits/stdc++.h> using namespace std; template <class T> inline bool read(T &ret) { char c; int sgn; if (c = getchar(), c == EOF) return false; while (c != - && (c < 0 || c > 9 )) c = getchar(); sgn = (c == - ) ? -1 : 1; ret = (c == - ) ? 0 : (c - 0 ); while (c = getcha... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 18:36:43 03/19/2015
// Design Name:
// Module Name: fsm2
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
// Re... |
#include <bits/stdc++.h> using namespace std; inline bool isPowerOfTwo(int x) { return (x != 0 && (x & (x - 1)) == 0); } double pi = 3.141592653589793238462643; int month[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1}; int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1}; ... |
#include <bits/stdc++.h> using namespace std; int main() { int n, s; scanf( %d%d , &n, &s); int a, max, sum = 0; scanf( %d , &a); max = a; sum += a; for (int i = 1; i < n; i++) { scanf( %d , &a); if (a > max) max = a; sum += a; } sum -= max; if (sum <= s) ... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int n, m, count = 0; cin >> n >> m; int x = min(n, m); n = n - x; m = m - x; int rest = (n / 2) + (m / 2); cout << x << << rest << endl; return 0; } |
// lint_checking MODLNM OFF
module autoasciienum_onehot (
input clk,
input rst_n,
output ack
);
localparam // synopsys enum state_info
IDLE = 0,
S1 = 1,
S2 = 2,
S3 ... |
#include <bits/stdc++.h> const long long INF = 0x3f3f3f3f3f3f3f3fLL; const int inf = 0x3f3f3f3f; const int mod = 1e9 + 7; const double eps = 1e-6; template <class T> inline void read(T& x) { int sign = 1; char c = getchar(); x = 0; while (c > 9 || c < 0 ) { if (c == - ) sign = -1; ... |
#include <bits/stdc++.h> using namespace std; int MAX = 1000000; int MIN = -1000000; int INF = 1000000000; int x4[4] = {0, 1, 0, -1}; int y4[4] = {1, 0, -1, 0}; int x8[8] = {0, 1, 1, 1, 0, -1, -1, -1}; int y8[8] = {1, 1, 0, -1, -1, -1, 0, 1}; int i, j, k; int main() { string str; cin >> str;... |
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int a, b, c, min_cost, min_a, min_b, min_c; cin >> a >> b >> c; if (b % a == 0 && c % b == 0) { cout << 0 << endl; cout << a << << b << << c << endl; } else { ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.