text
stringlengths
59
71.4k
#include <bits/stdc++.h> using namespace std; void A() { cout << tokitsukaze << endl; exit(0); } void B() { cout << quailty << endl; exit(0); } int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n, k; cin >> n >> k; string s; cin >> s; ...
#include <bits/stdc++.h> using namespace std; inline int read() { int x = 0; bool op = false; char c = getchar(); while (!isdigit(c)) op |= (c == - ), c = getchar(); while (isdigit(c)) x = (x << 1) + (x << 3) + (c ^ 48), c = getchar(); return op ? -x : x; } const int N = 2e5 + 10; int...
/* * Copyright 2013-2016 Colin Weltin-Wu () * UC San Diego Integrated Signal Processing Group * * Licensed under GNU General Public License 3.0 or later. * Some rights reserved. See LICENSE. * * negedge_sync.v * Used to synchronize a signal coming from an async domain. Signal is * sampled on the rising edge...
/** * 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-2018 Alex Forencich Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distri...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// module RAM1(CLK,RST,ED,START,DReal,DImag,RDY,DOReal,DOImag); parameter total_bits = 32; input CLK; input RST; input ED; input START; input [total_bits-1:0] DReal; input [total_bits-1:0] DImag; output reg RDY;...
#include <bits/stdc++.h> using namespace std; const int maxn = 1 << 21; int n, m; char s[maxn]; char cmd[maxn]; struct lucky { int c4, c7, c47, c74; lucky() { c4 = 0, c7 = 0, c47 = 0, c74 = 0; } void merge(lucky a, lucky b) { c4 = a.c4 + b.c4; c7 = a.c7 + b.c7; c47 = max(a.c47 ...
#include <bits/stdc++.h> using namespace std; const int MAXN = 1100; const long long MOD = 998244353; int N, K; int arr[MAXN]; int dp[MAXN][MAXN]; int ps[MAXN][MAXN]; long long figure(int k) { if (k * (K - 1) > arr[N - 1]) return 0; for (int i = 0; i <= N; i++) for (int j = 0; j <= K; j++)...
#include <bits/stdc++.h> using namespace std; vector<long long int> v; long long int a[120100], n, dd; map<int, int> mp; int main() { for (long long int i = 1; i <= 2000000000; i *= 2) { v.push_back(i); } cin >> n; for (int i = 0; i < n; i++) { scanf( %lld , &a[i]); mp[a[i]]+...
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 10; void print(int base) { if (base == 4) cout << 4 * 3 = 12 n12 * 2 = 24 n24 * 1 = 24 << endl; if (base == 5) cout << 5 * 4 = 20 n3 + 2 = 5 n5 - 1 = 4 n20 + 4 = 24 << endl; if (base == 6) cout << 4 * 3 = 12 n12 * 2 = 2...
#include <bits/stdc++.h> using namespace std; const int N = 100005; long long int ara[N]; int main() { long long int n, i, j, k, s = 0, ts; cin >> n; for (i = 1; i <= n; i++) cin >> ara[i]; for (i = 1; i < n; i++) { for (j = 30; ara[i] > 0 && j >= 0; j--) { if ((i + (1 << j)) > n) ...
#include <bits/stdc++.h> using namespace std; int main() { int n, c, b, ans = 0; cin >> n; int a[n + 1]; for (int i = 1; i <= n - 1; i++) cin >> a[i]; cin >> c >> b; for (int i = c; i <= b - 1; i++) ans += a[i]; cout << ans; }
#include <bits/stdc++.h> using namespace std; char a[55][55]; int n, m, x; int dist(int p, int q, int r, int s) { return (p - r) * (p - r) + (q - s) * (q - s); } int ok[128] = {}, appear[128] = {}; char s[1000000]; int main(void) { scanf( %d%d%d , &n, &m, &x); for (int i = 0; i < n; i++) sca...
#include <bits/stdc++.h> using namespace std; #pragma GCC optimize( Ofast,no-stack-protector ) #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native ) #pragma GCC optimize( unroll-loops ) int on_bit(int N, int pos) { return N = N | (1 << pos); } int off_bit(int N, int pos) { return 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 la...
#include <bits/stdc++.h> using namespace std; long long n, x, cnt; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(0); cin >> n >> x; for (int i = 1; i <= n; i++) { if (x % i == 0 && x / i <= n) { cnt++; } } cout << cnt; return 0; }
#include <bits/stdc++.h> using namespace std; int T, a, b, c, d, k; int main() { cin >> T; for (; T--;) { cin >> a >> b >> c >> d >> k; int sol1 = 0; int sol2 = 0; if (a % c == 0) sol1 = a / c; else sol1 = a / c + 1; if (b % d == 0) sol2 = b / d;...
// ------------------------------------------------------------- // // Generated Architecture Declaration for rtl of inst_t_e // // Generated // by: wig // on: Mon Apr 10 13:26:55 2006 // cmd: /cygdrive/h/work/eclipse/MIX/mix_0.pl -nodelta ../../bitsplice.xls // // !!! Do not edit this file! Autogenerated by MIX !...
module tiny1_core( input clk, // clock input rst, // reset (neg) input irq, // interrupt requested output reg irqack, // interrupt acknowledged // A single memory port for both reading and writing ...
/** * 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 = 32; int n, u, r, a[N][N], b[N], p[N], k[N]; long long ans = -1e18; void dfs(int x, bool z) { int i; if (x % 2 == u % 2) { long long t = 0; for (i = 1; i <= n; i = i + 1) t += (long long)a[i][x] * k[i]; ans = max(ans, t); ...
#include <bits/stdc++.h> using namespace std; int n, k; string s1, s2; vector<pair<string, string> > ans; map<string, int> u; int main() { cin >> n; for (int i = 1; i <= n; i++) { cin >> s1 >> s2; map<string, int>::iterator it = u.find(s1); if (it == u.end()) { u[s1] = k, u...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); long long t; cin >> t; while (t--) { int n; cin >> n; int a[n]; for (int i = 0; i < n; i++) cin >> a[i]; for (int i = n - 1; i >= 0; i--) ...
#include <bits/stdc++.h> using namespace std; const long long MOD = 1e9 + 7; const long long INF = 4e18; const int MAX_LOG = 21; const int MAX_N = (1 << 17); int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n, k, a, b, c, d; cin >> n >> k >> a >> b >> c >> d; if...
#include <bits/stdc++.h> using namespace std; int main() { vector<int> v, v1; int a, b, c, d, e, f, g, h, i, j, k, l; cin >> a; for (i = 0; i < a; i++) { v.clear(); v1.clear(); cin >> c >> d >> b; map<int, int> m; for (j = 0; j < b; j++) { cin >> e; m[e]...
/** * 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 mlvds_rx #(parameter VENDOR="LATTICE", parameter FILTER_ON_ADDR="YES") ( input c, input [4:0] mcb_addr, input [2:0] mlvds_ro, input tx_active, output [15:0] rxlen, output [7:0] rxd, output rxdv, output rx_active); wire [2:0] mlvds_ro_sync; sync #(.W(3), .S(3)) mlvds_ro_sync_r (.clk(c), .in(mlvds_r...
#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)); } static void redirect(int argc, const char **argv) { ios::sync_with_std...
module alt_vipvfr131_common_stream_output #(parameter DATA_WIDTH = 10) ( input wire rst, input wire clk, // dout input wire dout_ready, output wire dout_valid, output reg [DATA_WIDTH-1:0] dout_data, output reg ...
`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 10:37:12 05/18/2016 // Design Name: IF_M // Module Name: Y:/TEOCOA/EXPR8/TESTIFM.v // Project Name: EXPR8 // Target Device: // Tool versions: // Desc...
// -- (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 // -- laws. // -- // -- DISCLAIMER // -- This disclaimer is not 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 law...
#include <bits/stdc++.h> namespace _ { const int inf = 1e9 + 7; namespace _in { template <class T> inline T read() { char ch; bool flag = 0; T x = 0; while (ch = getchar(), !isdigit(ch)) if (ch == - ) flag = 1; while (isdigit(ch)) x = x * 10 + ch - 48, ch = getchar(); return fla...
#include <bits/stdc++.h> using namespace std; struct s { long long x; long long y; }; vector<s> v; bool cmp(s a, s b) { if (a.x == b.x) return a.y < b.y; return a.x > b.x; } int main() { long long a, b, c, d, e, i, j, k, xx, yy; s aa, bb; scanf( %lld %lld , &a, &b); for (i ...
/* Is not working :-( */ /* `include "DEF.v" module dcachel2(clock, address, data, read, write, rs_ex_ok, out_address, out_data, out_read, out_write, in_databus, out_databus, write_databus); input [31:0] address; inout [31:0] data, out_data; input read, write; input [63:0] in_databus; input clock; output ...
#include <bits/stdc++.h> using namespace std; vector<vector<int> > data; vector<bool> parallel; vector<int> father; vector<int> spec; vector<int> opt; vector<long long> ans; void dfs(int vertex) { if (parallel[vertex]) { int tot = 0; for (int i = 0; i < data[vertex].size(); ++i) { ...
#include <bits/stdc++.h> using namespace std; long long a, b, c, d, ans; char signs[3]; void r1(long long a) { ans = min(ans, a); } void r2(long long a, long long b) { if (signs[2] == * ) { r1(a * b); } else { r1(a + b); } } void r3(long long a, long long b, long long c) { if ...
#include <bits/stdc++.h> using namespace std; double pi = acos(-1); struct point { int x, y; } p[2005]; vector<double> v; int main() { int n; scanf( %d , &n); for (int i = 1; i <= n; i++) scanf( %d%d , &p[i].x, &p[i].y); long long ans = 0; for (int i = 1; i <= n; i++) { v.clear...
#include <bits/stdc++.h> using namespace std; long long int pwr(long long int base, long long int p) { long long int ans = 1; while (p) { if (p & 1) ans = (ans * base) % 1000000007; base = (base * base) % 1000000007; p /= 2; } return ans; } long long int gcd(long long int a, lo...
/** * 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...
//------------------------------------------------------------------------ // ok_wbm.v // // $Rev$ $Date$ //------------------------------------------------------------------------ `default_nettype none `timescale 1ns / 1ps module ok_wbm ( input wire [7:0] hi_in, output wire [1:0] hi_out, inout wire [15:0] hi_i...
#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 power(long long x, long long p) { if (p == 0) return 1; if (p == 1) return x; if (p % 2) return x * power(x, p - 1); long long y = power(x, p / 2); return y ...
#include <bits/stdc++.h> using namespace std; const int imax = 1e9 + 7; const long long lmax = 1e18; const int maxn = 2005; int P[maxn], C[maxn], A[maxn]; vector<int> adj[maxn]; vector<int> dfs(int cur) { vector<int> ans(0), v(0); for (int next : adj[cur]) { v = dfs(next); ans.insert(a...
// // Generated by Bluespec Compiler, version 2018.10.beta1 (build e1df8052c, 2018-10-17) // // // // // Ports: // Name I/O size props // RDY_server_reset_request_put O 1 reg // RDY_server_reset_response_get O 1 reg // valid O 1 // word_fst ...
// MBT 4/1/2014 // // 2 read-port, 1 write-port ram // // reads are asynchronous // `include "bsg_defines.v" module bsg_mem_2r1w #(parameter `BSG_INV_PARAM(width_p) , parameter `BSG_INV_PARAM(els_p) , parameter read_write_same_addr_p=0 , parameter addr...
/////////////////////////////////////////////////////////////////////////////// // Copyright (c) 2009 Xilinx, Inc. // This design is confidential and proprietary of Xilinx, All Rights Reserved. /////////////////////////////////////////////////////////////////////////////// // ____ ____ // / /\/ / // /___/ \ /...
#include <bits/stdc++.h> using namespace std; const int N = 2000005; int lp[N + 1]; vector<int> pr, adj[100005]; vector<int> v[N]; int a[N], ans[100005], depth[100005]; void seive() { for (int i = 2; i <= N; ++i) { if (lp[i] == 0) { lp[i] = i; pr.push_back(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...
#include <bits/stdc++.h> using namespace std; const long long mod = 1e9 + 7; long long a[2000], dp[2000]; long long qmod(long long y) { long long res = 1, two = (long long)2; for (; y; y >>= 1) { if (y & 1) res = res * two % mod; two = two * two % mod; } return res; } int main() ...
#include <bits/stdc++.h> using namespace std; int main() { vector<int> v; int n, a, b; while (scanf( %d , &n) != EOF) { v.assign(n, 0); for (int i = 0; i < n; i++) { scanf( %d , &v[i]); } sort(v.begin(), v.end()); a = 1; b = n - 1; while (a < n && v[a] =...
#include <bits/stdc++.h> using namespace std; int N, K; int T[200005]; vector<int> danger; vector<pair<int, int> > v; bool cf(pair<int, int> x, pair<int, int> y) { return x.second * y.first > y.second * x.first; } int main() { scanf( %d %d , &N, &K); for (int i = 0; i < N; i++) { scanf...
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; int mod = 1e6 + 3; string mm(char c) { if (c == > ) return 1000 ; if (c == < ) return 1001 ; if (c == + ) return 1010 ; if (c == - ) return 1011 ; if (c == . ) return 1100 ; if (c == , ) return 1101 ; ...
`include "macro.v" module mem_wb_buffer( input wire clock, input wire reset, input wire[`SIGNAL_BUS] stall, input wire mem_write_enable, input wire[`REGS_ADDR_BUS] mem_write_addr, input wire[`REG...
// (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; const int N = 1e5 + 5; string ans[N]; int len[N]; int dp[N]; string get_ans(const string &add) { if (add.size() <= 10) { auto res = add; reverse(res.begin(), res.end()); return res; } string res; int t = add.size(); for (int...
#include<bits/stdc++.h> using namespace std; #define FASTio ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); #define ll long long int #define all(v) (v).begin(), (v).end() #define mp make_pair #define pb push_back #define pf push_front #define ff first #define ss second #define lcm(a, b...
#include <bits/stdc++.h> using namespace std; int main() { list<int> L; int N, M; cin >> N >> M; set<pair<int, int> > S; for (int i = 0; i < M; ++i) { int u, v; cin >> u >> v; S.insert(pair<int, int>(u, v)); } L.push_back(1); for (int i = 2; i <= N; ++i) { lis...
#include <bits/stdc++.h> using namespace std; map<char, int> tile = { { + , 15}, { - , 8 + 2}, { | , 1 + 4}, { ^ , 1}, { v , 4}, { > , 2}, { < , 8}, { L , 15 - 8}, { R , 15 - 2}, { U , 15 - 1}, { D , 15 - 4}, { * , 0}, }; int n, m, xt, yt, xm, ym; vector<string> laby; ...
#include <bits/stdc++.h> using namespace std; void solve() { long long int i, j, n, m, k; cin >> n; long long int a[n]; for (i = 0; i < n; i++) { cin >> a[i]; } cin >> m; long long int b[m]; for (i = 0; i < m; i++) { cin >> b[i]; } sort(a, a + n); sort(b, b + ...
#include <bits/stdc++.h> using namespace std; vector<int> a[1000100], b[1000100], ans; stack<int> st; int n, m; bool del[1000100], used[1001000]; int main() { scanf( %d%d , &n, &m); int i; for (i = 1; i <= m; i++) { int u, v; scanf( %d%d , &u, &v); a[u].push_back(v); b[v]...
#include <bits/stdc++.h> using namespace std; const int maxN = 2e5 + 10; const long long oo = 1e18; char s[maxN]; long long cost[maxN][2]; int main() { int test; scanf( %d , &test); while (test--) { int n, a, b; scanf( %d%d%d%*c , &n, &a, &b); gets(s); cost[0][0] = b; ...
#include <bits/stdc++.h> using namespace std; char s[2505][5005]; int a[5000]; int c1[30], c2[30]; int dif[2505]; int main() { int k, n; scanf( %d%d , &k, &n); scanf( %s , s[0]); bool flag = false; for (int i = 0; i < n; ++i) { c1[s[0][i] - a ]++; if (c1[s[0][i] - a ] > 1) ...
/* Copyright (c) 2015 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,...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 20:44:25 01/22/2017 // Design Name: // Module Name: bi_directional_shift // Project Name: // Target Devices: // Tool versions: // Description: // // Depende...
#include <bits/stdc++.h> using namespace std; const int MAX = (1e6) + 5; const int IT_MAX = 1 << 20; const int INF = -1; int bit[IT_MAX + 10]; void update(int p, int dv) { for (; p <= IT_MAX; p += p & (-p)) bit[p] += dv; } int query(int p) { int rv = 0; for (; p; p -= p & (-p)) rv += bit[p];...
// megafunction wizard: %ROM: 1-PORT% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: altsyncram // ============================================================ // File Name: note2dds_rom.v // Megafunction Name(s): // altsyncram // // Simulation Library Files(s): // altera_mf // ===========================...
#include <bits/stdc++.h> using namespace std; const int maxn = 500010; int m, k, n, s, a[maxn], b[maxn], c[maxn], maxx, tong[maxn], ansl, ansr, vis[maxn]; bool check(int l, int r) { memcpy(c, tong, sizeof(c)); for (int i = l; i <= r; i++) c[a[i]]--; for (int i = 1; i <= maxx; i++) if (c[...
#include <bits/stdc++.h> using namespace std; const long long N = 5e3 + 5, mod = 1e9 + 7, mod1 = 998244353, mod2 = 1e9 + 9, inf = 1e18 + 7; const long long infll = 1e18 + 7; long long n, k, X, Y, Z; long long a[(long long)3e5 + 5]; long long dp[N][N]; signed main() { ios_base::sync_w...
#include <bits/stdc++.h> using namespace std; void fastInOut(); unsigned long long power(unsigned long long b, unsigned long long pow) { if (b == 0) return 0; else if (pow == 1) return b; else if (pow % 2 == 0) return power(b * b, pow / 2); else return b * power(b * b, pow ...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2018 by Rod Steward. module IOBUF ( input T, input I, output O, inout IO ); assign O = IO; assign IO = T ? 1'bz : I; endmodule module t ( input [7:0] inlines, output [...
/** * 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 digit_state_machine( input clk, input reset_n, input [3:0] units, input [3:0] tens, input [3:0] hundreds, input [3:0] thousands, output reg [2:0] digit_select, output reg [3:0] data, output reg decimal_point ); reg [1:0] state; reg [1:0] state_n; parameter S0 = 2'b00; parameter S1 = 2'b01; ...
// megafunction wizard: %FIFO% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: dcfifo // ============================================================ // File Name: fifo_70x256.v // Megafunction Name(s): // dcfifo // // Simulation Library Files(s): // altera_mf // ===========================================...
#include <bits/stdc++.h> using namespace std; signed main() { ios::sync_with_stdio(NULL); cin.tie(0); cout.tie(0); int a, b, c; cin >> a >> b >> c; c -= 2; b -= 1; int ans = min({a, b, c}); if (ans < 0) { cout << 0; } else { ans = ans * 3 + 3; cout << ans; ...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long int n, w, l; cin >> n >> l >> w; long double p[n + 1]; long long int b[n + 1]; for (long long int i = 1; i <= n; i++) { cin >> p[i]; p[i] /= 100; } fo...
#include <bits/stdc++.h> using namespace std; int n; long long ans, sum[300030], cnt[300030], tot[3]; int main() { scanf( %d , &n); tot[0] = 1; for (int i = 1; i <= n; i++) { long long x; scanf( %lld , &x); while (x) { cnt[i] += x % 2; x >>= 1; } sum[i] ...
// ============================================================== // File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC // Version: 2015.4 // Copyright (C) 2015 Xilinx Inc. All rights reserved. // // ============================================================== `timescale 1ns/1ps modul...
// // Copyright 2011 Ettus Research LLC // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is dis...
#include <bits/stdc++.h> using namespace std; int main() { long long n, m, k, minn = 10000, a[1000], temp = 0; cin >> n >> m >> k; for (long long i = 0; i < n; i++) { cin >> a[i]; if (a[i] <= k && a[i] != 0) { temp = abs(i + 1 - m) * 10; if (temp < minn) minn = temp; } ...
#include <bits/stdc++.h> using namespace std; #define int long long struct node{ int x, y, id; bool operator <(const node& W) const{ if (W.x != x) return x < W.x; else return y < W.y; } }; void work() { int n; cin >> n; vector<node> v(n); for (int i = 0; i < n; i++) { int x...
/******************************************************************************* * This file is owned and controlled by Xilinx and must be used solely * * for design, simulation, implementation and creation of design files * * limited to Xilinx devices or technologies. Use with non-Xilinx ...
#include <bits/stdc++.h> using namespace std; const int maxn = 4e6 + 10; const int p = 1009; int raw[maxn], cnt[maxn]; complex<double> F1[maxn], F2[maxn]; const double PI = acos(-1.0); int rev[maxn]; void init(vector<complex<double> >& A, int n) { A.clear(); A.shrink_to_fit(); int size = 1; ...
#include <bits/stdc++.h> using namespace std; const long long mod = 20071027; const double pi = acos(1.0 * (-1)); int p[1001111]; long long fun(long long x) { long long dt = 1 + 8 * x; long long t = sqrt(dt * 1.0) + 0.0000001; if (t * t != dt) return -1; return (1 + t) / 2; } int main() { ...
#include <bits/stdc++.h> int d[1000]; void Qsort(int, int); bool Checked(int, int); int main(int argc, char** argv) { char a[10000]; std ::cin >> a; int id = 0; int k = 0; while (a[k] != 0 ) { int num = 0; while ((a[k] != 0 ) && (a[k] != , )) { num = (num * 10) + (a[...
#include <bits/stdc++.h> using namespace std; int n; pair<long long, long long> P, d[100000]; double rm, rM; int main() { scanf( %d%I64d%I64d , &n, &P.first, &P.second); for (int i = 0; i < n; i++) { pair<long long, long long> Q; scanf( %I64d%I64d , &Q.first, &Q.second); double t = (...
// (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; const int n = 2; struct Matrix { long long matrix[5][5]; }; Matrix unit; int m; long long cnt[1000005], MOD; void initUnit() { memset(unit.matrix, 0, sizeof(unit.matrix)); int i; for (i = 1; i <= n; i++) unit.matrix[i][i] = 1; } Matrix ma...
#include <bits/stdc++.h> using namespace std; using ll = long long; ll cnt_inv[30][2]; void rec(vector<int>& a, int b) { if (b < 0 || a.empty()) return; vector<int> s, us; for (int& i : a) { int val = i & (1 << b); if (val) cnt_inv[b][1] += us.size(), s.push_back(i); else ...
#include <bits/stdc++.h> using namespace std; const long long INF = 2000000000000000000LL; const int inf = 0x3f3f3f3f; const long double EPS = 1e-9; string a, b; inline void solve() { vector<long long> mapa(26); for (long long i = 0; i < a.size(); i++) { mapa[a[i] - a ]++; } for (int ...
#include <bits/stdc++.h> using namespace std; const double pi = acos(-1.0); int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout << fixed; int a1, a2; cin >> a1 >> a2; int minutes = 0; while (a1 > 0 && a2 > 0) { if (a1 == 1 && a2 == 1) { break; } ...
// Quartus Prime Verilog Template // Single port RAM with single read/write address and initial contents // specified with an initial block module phyIniCommand0 #(parameter DATA_WIDTH=32, parameter ADDR_WIDTH=4) ( input [(DATA_WIDTH-1):0] data, input [(ADDR_WIDTH-1):0] addr, input we, clk, output [(DATA_...
#include <bits/stdc++.h> using namespace std; template <typename T> class graph { public: struct edge { int from; int to; T cost; }; vector<edge> edges; vector<vector<int>> g; int n; graph(int _n) : n(_n) { g.resize(n); } virtual int add(int from, int to, T cost) =...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 31.03.2016 12:23:12 // Design Name: // Module Name: sample_generator_testbench // Project Name: // Target Devices: // Tool Versions: // Description: // // Dependen...
#include <bits/stdc++.h> int main() { int n, t, i; scanf( %d%d , &n, &t); if (n == 1 && t == 10) printf( -1 ); else { if (t == 10) { printf( 1 ); for (i = 0; i < n - 1; i++) printf( 0 ); } else for (i = 0; i < n; i++) printf( %d , t); } return 0; } ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int cost; double amount; cin >> cost; string s[n]; for (int i = 0; i < n; i++) { cin >> s[i]; } int counter = 0; double sum = 0.0; for (int i = n - 1; i >= 0; i--) { if (s[i] == halfp...
#include <bits/stdc++.h> using namespace std; struct Edge { int64_t v, f, c; Edge(int64_t v, int64_t f, int64_t c) : v(v), f(f), c(c) {} int64_t get_capacity() { return c - f; } }; const int64_t INF = (int64_t)(1e9) + 666; const int64_t N = 10000; const int64_t S = N - 2; const int64_t T = 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...
#include <bits/stdc++.h> using namespace std; long long a, b, n, ret; long long retr(long long x) { long long t = 0; while (x > 0) { t = 10 * t + (x % 10); x /= 10; } return t; } int main() { int i; cin >> a >> b; ret = retr(b); ret += a; cout << ret; }
#include <bits/stdc++.h> using namespace std; using ll = long long; using uint = unsigned int; template <class T> using V = vector<T>; template <class T> using VV = vector<vector<T>>; template <class T, class U> void chmax(T& x, U y) { if (x < y) x = y; } template <class T, class U> void chm...