text stringlengths 59 71.4k |
|---|
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2013 by Wilson Snyder.
// Very simple test for interface pathclearing
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
integer cyc=1;
ifc #(2) itopa();
ifc #(... |
/**
* 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 <cstdio> #include <cstring> #include <iostream> #include <vector> #include <cmath> #include <cstdlib> #include <ctime> #include <algorithm> #include <string> #include <map> #define ll long long #define ls id << 1 #define rs id << 1 | 1 #define mem(array, value, size, type) memset(arra... |
#include <bits/stdc++.h> using namespace std; void debug() {} int const N = 1e3 + 9, OO = 1e9; int main() { int n, q, type, a; char b; bool prd = 0; scanf( %d , &n); for (int i = 0; i < n; ++i) { for (int j = 0; j < n; ++j) { scanf( %c , &b); if (j == i && b == 1 ) pr... |
#include <bits/stdc++.h> using namespace std; inline long long read() { char ch = getchar(); long long p = 1, data = 0; while (ch < 0 || ch > 9 ) { if (ch == - ) p = -1; ch = getchar(); } while (ch >= 0 && ch <= 9 ) { data = data * 10 + (ch ^ 48); ch = getchar(); ... |
#include <bits/stdc++.h> using namespace std; const int MN = 2011; int n, a[MN]; vector<int> ls[MN]; void solve1(int u) { cout << YES << endl; for (int turn = 0, _a = (3); turn < _a; turn++) { for (int i = (1), _b = (2000); i <= _b; i++) { if (i != u) { for (int x = 0, _a = (... |
#include <bits/stdc++.h> using namespace std; int main() { int p, i, j; scanf( %d , &p); int n = 1 << (p + 1); vector<int> a(n); for (i = 2; i < n; i++) scanf( %d , &a[i]); vector<int> up(n), mx(n); for (i = 1; i < n; i++) { int sum = 0; for (j = i; j > 1; j /= 2) sum += a[j]... |
#include <bits/stdc++.h> using namespace std; long long mod = 1e9 + 7; const int N = 2e5 + 5; const double pi = acos(-1); int t; int main() { cin >> t; while (t--) { int n, m; cin >> n >> m; if (n % m == 0) cout << YES << n ; else cout << NO << n ; ... |
#include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<int, int>; using vi = vector<int>; using vll = vector<ll>; const string ALPHA = abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ; string NAME[3] = { Kuro , Shiro , Katie }; int main() { ios::sync_with_stdio(... |
#include <bits/stdc++.h> using namespace std; int n, kk, a, b; double dp[1123][111][111]; int arr[111]; void solve() { scanf( %d , &n); ; scanf( %d , &kk); ; kk = min(kk, 1000); double dd = n * (n + 1) / 2; double ans = 0.0; for (int i = 0; i < n; i++) { scanf( %d , &arr[... |
#include <bits/stdc++.h> int main() { const int N = 8; std::string pokemons[] = { vaporeon , jolteon , flareon , espeon , umbreon , leafeon , glaceon , sylveon }; int n; scanf( %d n , &n); std::string hidden; std::cin >> hidden; std::string 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... |
//==================================================================================================
// Filename : dimmer.v
// Created On : 2015-09-08 23:27:20
// Last Modified : 2015-09-08 23:41:34
// Revision : 1
// Author : Danny Dutton
// Class : ECE4514
//
// Description : This... |
/**
* 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) 2006 Rice University //
// All Rights Reserved //
// This code is covered by the Rice-WARP license //
// See http://warp.rice.edu/license/ for details //
//////////////////////////////////////////////////////////
module analog_bridge... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); int n; cin >> n; string s; cin >> s; set<int> col[26]; vector<int> ans; int cnt = 0; for (int i = 0; i < n; i++) { set<int> used; for (int j = s[i] - a ... |
// DESCRIPTION: Verilator: Simple test of unoptflat
//
// Demonstration of an UNOPTFLAT combinatorial loop using 3 bits and looping
// through 2 sub-modules.
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2013 by Jeremy Bennett.
module t (/*AUTOARG*/
// Inputs
clk
);
... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); string a; string b; cin >> a >> b; int order = 0; while (a[order] == 0 ) { order++; } a = a.substr(order); order = 0; while (b[orde... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 18:37:02 03/12/2015
// Design Name:
// Module Name: complex
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
//... |
#include <bits/stdc++.h> using namespace std; const int N = 333333; vector<pair<int, int> > graph[N]; int vis[N], d[N]; bool has[N]; int n, m; int dfs(int u) { vis[u] = true; int cnt = 0; for (auto e : graph[u]) { if (!vis[e.first]) { if (dfs(e.first)) { has[e.second] =... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 55, MAXM = 20020; int n, m, k, acc[MAXN][MAXM], dp[MAXN][MAXM], ans; struct no { int beg, end, mid, mx, lz; no *l, *r; no(int beg, int end) : beg(beg), end(end), mid((beg + end) >> 1), mx(0), lz(0) { if (beg != end) l = new... |
#include <bits/stdc++.h> using namespace std; long long int arr[10000]; int main() { std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); long long int a, b, c, i, j, k, n, m, state = 0; for (i = 0; i < 6; i++) cin >> arr[i]; sort(arr, arr + 6); for (i = 0; i < 3; i++) { ... |
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int a, b, c = 0, e, i, n; cin >> n; vector<char> v; char s[n + 1]; cin >> s; for (i = 0; i < n; i++) { if ((s[i] - 0 ) % 2 != 0) { c++; v.push_back(s... |
`timescale 1ns/1ps
//**********************************************************************
// File: i2c_slave.v
// Module:i2c_slave
// by Robin zhang
//**********************************************************************
module i2c_slave_reduced(
reset_n,
sda,
scl,
clock,
led
);
input reset_n... |
#include <bits/stdc++.h> using namespace std; int n, ji[300], k, qi, mz[400010]; char s[400010], tp[400010]; int main() { scanf( %d%s , &n, s + 1); for (int i = 1; i <= n; i++) { ji[s[i]]++; } for (int i = 0; i < 300; i++) if (ji[i] & 1) k++; qi = k; if (!qi) { for (k =... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2020 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
class Cls;
int value;
extern function int ext_f_np;
extern function int ext_f_p();
extern func... |
// (c) Copyright 1995-2015 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 license and does not grant ... |
//////////////////////////////////////////////////////////////////////
//// ////
//// fpu_addsub ////
//// ////
//// This file is part of the OpenR... |
/**
* 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... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2021 by Geza Lore.
// SPDX-License-Identifier: CC0-1.0
module t(/*AUTOARG*/
// Inputs
clk
);
input clk;
wire o0, o1;
sub #(1) a(.i(1'b0), .o(o0)... |
// ============================================================================
// Copyright (c) 2013 by Terasic Technologies Inc.
// ============================================================================
//
// Permission:
//
// Terasic grants permission to use and modify this code for use
// in synthesis ... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); string base, s; cin >> base >> s; int n = base.size(), m = s.size(); base = * + base; s = * + s; int f[m + 2][n + 2]; memset(f, 0, sizeof(f)); for (int 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 la... |
// -------------------------------------------------------------
//
// Generated Architecture Declaration for rtl of ent_a
//
// Generated
// by: wig
// on: Mon Jul 18 16:08:19 2005
// cmd: h:/work/eclipse/mix/mix_0.pl -sheet HIER=HIER_MIXED -strip -nodelta ../../verilog.xls
//
// !!! Do not edit this file! Autoge... |
#include <bits/stdc++.h> #pragma GCC optimize( Ofast ) using namespace std; namespace io { const int L = (1 << 20) + 1; char buf[L], *S, *T, c; char getchar() { if (__builtin_expect(S == T, 0)) { T = (S = buf) + fread(buf, 1, L, stdin); return (S == T ? EOF : *S++); } return *S++; ... |
#include <bits/stdc++.h> using namespace std; int a[500000 + 5], ans[500000 + 5]; int main() { int n, k, d; cin >> n >> k >> d; for (int i = 0; i < n; i++) { cin >> a[i]; } sort(a, a + n); ans[n + 1] = 0; ans[n] = 1; int lptr = n - 1, dptr = n - 1; for (int i = n - 1; i >... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 20:03:44 05/12/2015
// Design Name: organisation
// Module Name: /media/BELGELER/Workspaces/Xilinx/processor/test_organisation.v
// Project Name: processor
// Target... |
#include <bits/stdc++.h> const double pi = acos(-1.0); const int maxn = (5e2 + 10); const int inf = 0x3f3f3f3f; const long long mod = 1e9 + 7; using namespace std; map<long long, long long> ys; long long a[200010]; int main() { cin.tie(0); ios::sync_with_stdio(false); long long n; long d... |
//-------------------------------------------------------------------
//-- txtest_tb.v
//-- Banco de pruebas para la tranmision de datos
//-------------------------------------------------------------------
//-- BQ August 2015. Written by Juan Gonzalez (Obijuan)
//-------------------------------------------------------... |
#include<bits/stdc++.h> using namespace std; #define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0) #define f first #define s second #define for1(i,a,b) for (int i = a; i < b; i++) #define for2(i,a,b) for (int i = a; i > b; i--) #define arrin(a,n) for (int i = 0; i < n; i++) cin >> a[i]; ... |
// NeoGeo logic definition (simulation only)
// Copyright (C) 2018 Sean Gonsalves
//
// 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) an... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); long long int n, x, y, cn = 0, ans = 0; string s; cin >> n >> x >> y >> s; for (int i = 0; i < n; i++) { if (s[i] == 0 ) cn++; else { if (cn) ans++; cn = 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... |
/*
Copyright (c) 2015-2016 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... |
#include <bits/stdc++.h> using namespace std; int main() { long long aa[15]; long long bb[15]; for (int i = 0; i < 14; i++) { scanf( %lld , &aa[i]); bb[i] = aa[i]; } long long maxx = 0; for (int i = 0; i < 14; i++) { if (!aa[i]) continue; long long sum = 0; int ... |
#include <bits/stdc++.h> using namespace std; inline int ckmax(int &a, int b) { return a < b ? a = b, 1 : 0; } inline int ckmin(int &a, int b) { return a > b ? a = b, 1 : 0; } struct matrix { double x[128][128]; double *operator[](int a) { return x[a]; } void clear() { memset(x, 0, sizeof(x)); } ... |
#include <bits/stdc++.h> using namespace std; void fast() { std::ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL); } void file() {} int main() { fast(); file(); int n, idx = 0; cin >> n; vector<vector<int>> v(n, vector<int>(n)); vector<bool> ans(n, 1); for (i... |
#include <bits/stdc++.h> using namespace std; long long dx[8] = {0, 1, 0, -1, 1, 1, -1, -1}; long long dy[8] = {1, 0, -1, 0, -1, 1, 1, -1}; class pa3 { public: long long x; long long y, z; pa3(long long x = 0, long long y = 0, long long z = 0) : x(x), y(y), z(z) {} bool operator<(const pa3& p... |
/*
Test bench for Clock Divider
Project: Cloud Car
Author: Nathan Larson
Date: 10/22/2016
*/
`timescale 1 ns/ 1 ps
module clockDivider_testbench();
// test vector input registers
reg clk;
reg reset;
// wires
wire newClk;
clockDivider clkDiv (
.clk(clk),
.reset(re... |
/**
* bsg_parallel_in_serial_out_dynamic.v
*
* Paul Gao 06/2019
*
*/
`include "bsg_defines.v"
module bsg_parallel_in_serial_out_dynamic
#(parameter `BSG_INV_PARAM(width_p)
,parameter `BSG_INV_PARAM(max_els_p)
,parameter lg_max_els_lp = `BSG_SAFE_CLOG2(max_els_p)... |
#include <bits/stdc++.h> using namespace std; char a[1000][1001], s[] = DIMA ; bool b = 0, f[1000][1000]; int q, w, d[1000][1000]; void l(short int r, short int t, short int e) { int y = 0; if ((f[r][t]) || (b)) { b = 1; return; } f[r][t] = 1; e %= 4; if ((r) && (a[r - 1][... |
#include <bits/stdc++.h> using namespace std; int main() { char c; int blackweight = 0; int whiteweight = 0; int i = 0; while (cin >> c) { i++; switch (c) { case Q : whiteweight += 9; break; case R : whiteweight += 5; 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... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1 << 17; int MAX[maxn << 1], lazy[maxn << 1], e[maxn]; void push_up(int now) { MAX[now] = max(MAX[now << 1], MAX[now << 1 | 1]); } void push_down(int now) { lazy[now << 1] += lazy[now]; lazy[now << 1 | 1] += lazy[now]; MAX[now << 1] +=... |
#include <bits/stdc++.h> using namespace std; struct tree { tree() : par(NULL), val(0) { next.clear(); }; map<int, tree *> next; tree *par; int val; void setParent(tree *p) { par = p; } }; tree *moveDown(tree *root, int n) { tree *ret = NULL; if (root->next.count(n)) { ret = ro... |
// sonic_pma_v1_03
`timescale 1 ps / 1 ps
module sonic_pma_v1_05 (
input wire phy_mgmt_clk, // phy_mgmt_clk.clk
input wire phy_mgmt_clk_reset, // phy_mgmt_clk_reset.reset
input wire [8:0] phy_mgmt_address, // phy_mgmt.address
input wire phy_mgmt_read,... |
//*****************************************************************************
// (c) Copyright 2009 - 2013 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; vector<int> v[100009]; map<int, int> mp; int main() { int n, m, x, y, index = 1; scanf( %d%d , &n, &m); for (int i = 0; i < m; i++) { scanf( %d%d , &x, &y); if (mp[x] == 0) { mp[x] = index; v[index++].push_back(y); } els... |
#include <bits/stdc++.h> using namespace std; const int inf = (1 << 30) - 1; const long long linf = (1ll << 62) - 1; const int N = 200; const int M = 1e9 + 7; const long long M2 = 1ll * M * M; int n; long long a[N]; int mat[N][N]; int result[N][N]; void multiply(int a[N][N], int b[N][N]) { sta... |
/**
* 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 a[100010], b[100010]; map<string, bool> mark; bool word(char a) { if (a >= a and a <= z ) return true; if (a >= A and a <= Z ) return true; return false; } int main() { int n; cin >> n; string a; cin >> a; int ind = 0; ... |
#include <bits/stdc++.h> using namespace std; long long MOD = 1e9 + 7; long long arr[200005]; pair<long long, long long> pt[200005]; int main() { long long n, x, y, newX, newY, cnt = 0, ansX, ansY, val = 0; map<pair<long long, long long>, long long> mp1; cin >> n >> x >> y; for (int i = 0; i <... |
//
// 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)
// ... |
//==========================================
// Function : Code Gray counter.
// Coder : Alex Claros F.
// Date : 15/May/2005.
//=======================================
`timescale 1ns/1ps
module ac97_graycounter
#(parameter COUNTER_WIDTH = 2)
(output reg [COUNTER_WIDTH-1:0] GrayCount_out, //'... |
#include <iostream> #include <algorithm> #include <cassert> #include <fstream> using ll = long long; const int maxn = 5007; ll t, n, S[maxn], ans[maxn]; ll res; int main(int argc, char *argv[]) { std::ios::sync_with_stdio(false); std::cin.tie(0); std::cin >> t; while (t--) { res... |
/*
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... |
/**
* 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 Player { string name; long int points; map<int, int> places; }; Player compSecond(Player a, Player b) { if (a.points > b.points) { return a; } else if (a.points < b.points) { return b; } for (int i = 1; i < 70; i++) { ... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); int n, m = 0, sum = 0; cin >> n; string s; getline(cin, s); getline(cin, s); for (int i = 0; i < n; i++) { if (s[i] == ) { m = max(m, sum); sum = 0; } if (s[i... |
(* -*- coding: utf-8 -*- *)
(************************************************************************)
(* v * The Coq Proof Assistant / The Coq Development Team *)
(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2017 *)
(* \VV/ ********************************************************... |
#include <bits/stdc++.h> using namespace std; int t, n, m; int a[10][10]; int main() { cin >> t; while (t--) { cin >> n >> m; int ok = 0; for (int i = 1; i <= n; i++) { cin >> a[1][1] >> a[1][2] >> a[2][1] >> a[2][2]; if (a[1][2] == a[2][1]) { ok = 1; ... |
#include <bits/stdc++.h> using namespace std; const long long N = 998244353; struct mat { long long a[2][2]; }; mat mul(mat a, mat b) { mat c; for (int i = 0; i < 2; i++) { for (int j = 0; j < 2; j++) { c.a[i][j] = 0; for (int k = 0; k < 2; k++) c.a[i][j] += a.a[i][k] * b.a[k... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 11:58:36 04/14/2015
// Design Name: main
// Module Name: E:/Adventure/Adventure/MainTest.v
// Project Name: Adventure
// Target Device:
// Tool versions:
// Desc... |
//////////////////////////////////////////////////////////////////////
//// ////
//// eth_txcounters.v ////
//// ////
//// This file is part of the Ether... |
`timescale 1ns/1ns
// $ iverilog fp16bmul.v fp16bmul_test.v
module FP16BMul_Test;
reg clk, rst;
reg [15:0] s0_arg_0;
reg [15:0] s0_arg_1;
wire s0_ret_0;
wire [7:0] s0_ret_1;
wire [7:0] s0_ret_2;
wire [8:0] s0_ret_3;
reg s1_arg_0;
reg [7:0] s1_arg_1;
reg [7:0] s1_arg_2... |
/*
* LatticeMico32
* JTAG Test Access Port For Xilinx Sparan-6 Devices
*
* Copyright (C) 2010 Michael Walle
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of sour... |
/**
* 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() { char a[1000010], b[1000010]; while (scanf( %s%s , &a, &b) != EOF) { int len1 = strlen(a); int len2 = strlen(b); int ans = 0; if (len1 != len2) { ans = 1; } else { if (len1 == 1) { if (a[0] != b... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int tc; cin >> tc; while (tc--) { long long int n, k; cin >> n >> k; long long int a[n], m = INT_MIN; for (long long int i = 0; i < n; i++) { ... |
#include <bits/stdc++.h> using namespace std; int count1(int x) { int ans = 0; while (x) { ans += x & 1; x >>= 1; } return ans; } int main() { int n, p; cin >> n >> p; for (int x = 0; x * (p + 1) <= n; x++) if (count1(n - x * p) <= x) { cout << x; re... |
#include <bits/stdc++.h> using namespace std; const double EPS = 1e-9; bool operator<(const complex<double>& a, const complex<double>& b) { if (fabs(a.imag() - b.imag()) > EPS) return a.imag() < b.imag(); return a.real() + EPS < b.real(); } class cmp { public: bool operator()(const complex<doub... |
`timescale 1ns / 1ps
// pwm_ctl.v ver 1.0
// Kazushi Yamashina
//
//
// para_in <= 0 ~ 19999
// -Interval of asserting "en_out" will change
// depending on the value of the "para_in".
// -The more you increase the value the interval will increase.
//
// dir_in <= 1: positive rotate, 0: negative rotate
... |
#include <bits/stdc++.h> using namespace std; int blacks(int *pos, int n); int whites(int *pos, int n); int main() { int n; cin >> n; int board[100]; for (int i = 0; i < n; i++) { board[i] = 0; } for (int i = 0; i < n / 2; i++) { int temp; cin >> temp; board[temp ... |
#include <bits/stdc++.h> using namespace std; int d[4][2] = {{0, -1}, {1, 0}, {0, 1}, {-1, 0}}; int ans, k = 0; int egg[1000000]; int n, m, vis[1050][1050]{0}, ma[1050][1050]; void dfs(int x, int y) { for (int i = 0; i < 4; i++) { int xx = x + d[i][0]; int yy = y + d[i][1]; if ((ma[x][... |
#include <bits/stdc++.h> using namespace std; bool sortbysecdesc(const pair<long long, long long> &a, const pair<long long, long long> &b) { if (a.first == b.first) return a.second > b.second; else return 0; } const long long N = 100010; bool prime[N]; void SieveOfEr... |
#include <bits/stdc++.h> using namespace std; int main() { puts( INTERCAL ); } |
/*
* 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; char arr[108]; int main() { int i, j, k, t, n, m, a, b, c, x, y, z; cin >> n; int flag = 0; for (i = 1; i <= n; i++) { cin >> arr[i]; } int gap, cnt = 0; for (i = 1; i <= n; i++) { if (arr[i] == * ) { for (j = i + 1; j ... |
/**
* 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; vector<int> s[222222], ss[222222]; int n, m, cnt, cnt2, h; int up[222222][22], fa[222222], deep[211111], q[211111], dfn[211111], low[211111]; void tarjan(int x) { int c, i, y; dfn[x] = low[x] = ++cnt; q[h] = x; h++; c = s[x].size(); f... |
//Legal Notice: (C)2011 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... |
// ==============================================================
// 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 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 = 1005; int N, K; long long L[MAXN], R[MAXN]; double dp[MAXN][MAXN]; double calc(long long l, long long r) { long long ret = 0, cur = 1; for (; cur <= r; cur *= 10) { if (cur == 1e18) { ret++; break; } if ... |
#include <bits/stdc++.h> using namespace std; const long long INF = 1e18; int vis[10005]; int main() { int n; scanf( %d , &n); int maxn = -1; for (int i = 1; i <= n; i++) { int tmp; scanf( %d , &tmp); vis[tmp]++; maxn = max(maxn, tmp); } long long ans1 = -1, ans2 ... |
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 5; int n, m; vector<long long> b(N, 0); void add(int x, int k) { while (x < N) { b[x] += k; x += x & -x; } } long long sum(int x) { long long ret = 0; while (x) { ret += b[x]; x -= x & -x; } r... |
#include <bits/stdc++.h> using namespace std; int main() { long long n, m, i, j, k, x, y, z, t; long long hh, mm, h, d, c, N; cin >> hh >> mm; cin >> h >> d >> c >> N; if (hh >= 20) { double cc = 0.8 * c; k = (h + N - 1) / N; double ans = 1.0 * k * cc; cout << fixed << se... |
#include <bits/stdc++.h> using namespace std; const int Max = 1e3, Max_Q = 1e4; const int fx[8] = {0, 0, 1, 1, 1, -1, -1, -1}; const int fy[8] = {1, -1, 0, 1, -1, 0, 1, -1}; int h, w, Q, cnt, s, t, Top, siz, q[Max + 5], stk[Max + 5], Id[Max + 5][Max + 5], fa[Max * Max + 5], vis[Max * Max + 5]; char S[... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.