akhauriyash/Code-Regression huggingface dataset:
import math


a, b, x = map(int, input().split())

if x / a >= 1 / 2 * a * b:
    tan = (2 * b) / a - 2 * x / (a ** 3)
else:
    tan = (b ** 2) * a / (2 * x)

print(math.degrees(math.atan(tan)))


Measured memory_bytes: 3188
l,r=map(int,input().split())

if r//2019-l//2019:
    print(0)
    exit()

l=l%2019
r=r%2019

if l>r:
    tmp=r
    r=l
    l=tmp

ans=l*r%2019
for l1 in range(l,r):
    for r1 in range(l1+1,r+1):
        ans=min(ans,l1*r1%2019)

print(ans)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
const int INF = 1e9;


int main(){
  int N,M;
  cin>>N>>M;
  vector<int> k(M);
  vector<int> p(M);
  vector<vector<int>> s(M,vector<int>(10));
  for(int i=0;i<M;i++){
    cin>>k[i];
    for(int j=0;j<k[i];j++){
      cin>>s[i][j];
      s[i][j]--;
    }
  }
  for(int i=0;i<M;i++){
    cin>>p[i];
  }
  int ans=0;
  for(int i=0;i<(1<<N);i++){
    int cnt=0;
    bitset<10> biti(i);
    //cout<<"biti="<<biti<<endl;
    vector<int> sum(M,0);
    for(int i2=0;i2<M;i2++){
      for(int j2=0;j2<k[i2];j2++){
        if(biti[s[i2][j2]]){
          sum[i2]++;
        }
      }
      //printf("sum%%2=%d p[%d]=%d\n",sum[i2]%2,i2,p[i2]);
      if(sum[i2]%2==p[i2]){
        cnt++;
      }
    }
    if(cnt==M){
      ans++;
    }
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 3608
n=int(input())
lp=[]
lm=[]
for i in range(n):
    s=input()
    x,y=0,0
    for j in s:
        if j=="(":
            x+=1
        else:
            x-=1
        y=min(y,x)
    if x>0:
        lp.append((y,x))
    else:
        lm.append((y-x,-x))
lp.sort()
s=0
for i,j in lp[::-1]:
    if s+i<0:
        print("No")
        exit()
    s+=j
lm.sort()
t=0
for i,j in lm[::-1]:
    if t+i<0:
        print("No")
        exit()
    t+=j
if s==t:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 84316
#include<bits/stdc++.h>
using namespace std;

int main(){
  int N;
  cin >> N;
  vector<long long> A(N);
  for(int i=0;i<N;i++){
    cin >> A.at(i);
  }
  long long C1=0,C2=0;
  long long sum=0;
  
  for(int i=0;i<N;i++){
    sum+=A.at(i);
    if(i%2==0 && sum<=0){
      C1+=abs(sum)+1;
      sum=1;
    }
    else if(i%2==1 && sum>=0){
      C1+=abs(sum)+1;
      sum=-1;
    }
  }
  
  sum=0;
  for(int i=0;i<N;i++){
    sum+=A.at(i);
    if(i%2==0 && sum>=0){
      C2+=abs(sum)+1;
      sum=-1;
    }
    else if(i%2==1 && sum<=0){
      C2+=abs(sum)+1;
      sum=1;
    }
  }
  cout << min(C1,C2) << endl;
}

Measured memory_bytes: 1024
#include "bits/stdc++.h"
using namespace std;
using namespace std;

int main(){
double a,b;
while(1){
	cin>>a>>b;
	if(a==0&&b==0)break;
	printf("%.7f\n",a*a+sqrt((a/2.0)*(a/2.0)+b*b)*a/2.0*4.0);
}
}

Measured memory_bytes: 3140
#include <algorithm>
#include <iostream>
#include <map>
#include <string>

using namespace std;

int main(void) {
  int N;
  cin >> N;
  map<string, int> m;

  for (int i = 0; i < N; ++i) {
    string S;
    cin >> S;
    m[S]++;
  }
  int mx = 0;
  for (const auto &v : m) {
    mx = max(mx, v.second);
  }
  for (const auto &v : m) {
    if (v.second == mx) {
      cout << v.first << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 18724
#include <bits/stdc++.h>

using ll = long long;
using namespace std;
const int INFint = 1e9+1;
const ll INFll = (ll)1e18+1;
ll MOD=1e9+7;

int main(){
  string s;
  cin>>s;
  if(int(s.size()) == 2) cout << s << endl;
  else {
    reverse(s.begin(),s.end());
    cout << s << endl;
  }
  return 0;
}



Measured memory_bytes: 3592
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
const int INF = 987654321;
const int MOD = 1000000007;

int main(){
  int N,M;
  scanf("%d %d",&N,&M);
  vector<pii> v;
  for(int i=0;i<N;i++){
    int A,B;
    scanf("%d %d",&A,&B);
    v.push_back(mp(A,B));
  }
  sort(v.begin(),v.end());
  ll ans = 0;
  for(int i=0;i<N;i++){
    ll a = v[i].first;
    int b = v[i].second;
    ans += min(b,M) * a;
    M -= min(b,M);
  }
  printf("%lld\n",ans);
}

Measured memory_bytes: 1400
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(
            new InputStreamReader(System.in));
        String[] data = br.readLine().split(" ");
        int a = Integer.parseInt(data[0]);
        int b = Integer.parseInt(data[1]);
        int c = Integer.parseInt(data[2]);
        int count = 0;

        for (int i = a; i <= b; i++) {
            if ((c % i) == 0) {
                count++;
            }
        }
        System.out.println(count);
    }
}

Measured memory_bytes: 24248
/**
 *COYG, 14 FA Cups we are back baby
 */
#include <bits/stdc++.h>
using namespace std;
#define mod 		1000000007
#define ll 		long long
#define mp 		make_pair
#define pb 		push_back
#define forn(i,n) 	for(int i=0;i<n;i++)
#define for1(i,n) 	for(int i=1;i<n;i++)
#define ford(i,n) 	for(int i=n-1;i>=0;i--)
#define vi 		vector<int>
#define vl 		vector<ll>
#define pii 		pair<int,int>
#define pll 		pair<ll,ll>
#define vpi 		vector<pair<int,int> >
#define vpl		vector<pair<ll,ll> >
#define vvi 		vector<vector<int> >
#define vvl 		vector<vector<ll> >
#define ull 		unsigned long long
#define IOS 		ios_base::sync_with_stdio(false);
#define PI 		3.1415926535897932384626
#define ff 		first
#define ss 		second
#define char2Int(c) 	(c-'0')
#define FOREACH(i,t) 	for (auto i=t.begin(); i!=t.end(); i++)
#define clr(a,x) 	memset(a,x,sizeof(a)) //set elements of array to some value
#define all(x)		(x).begin(),(x).end()//cout<<"Case #"<<zzz<<": ";
#define plll pair<ll,pll >
ll n;vl a;ll flag;
ll dp[3001][3001];
ll getans(ll l,ll r)
{
    if(l>r)return 0;
    if(dp[l][r]!=-1)return dp[l][r];
    ll len=r-l+1;ll ret;
    if((len&1)^flag)
    {
        ret=max(a[l]+getans(l+1,r),a[r]+getans(l,r-1));
    }
    else
    {
        ret=min(-a[l]+getans(l+1,r),-a[r]+getans(l,r-1));
    }
    dp[l][r]=ret;
    return ret;
}
void solve()
{
    cin>>n;a.resize(n);forn(i,n)cin>>a[i];
    if(n&1)flag=0;else flag=1;
    for(int i=0;i<=n;i++)for(int j=0;j<=n;j++)dp[i][j]=-1;
    cout<<getans(0,n-1)<<endl;
}
int main()
{
    IOS;cin.tie(NULL);
    ll zz;zz=1;
    //cin>>zz;
    for(int zzz=1;zzz<=zz;zzz++)
    {
        solve();
    }
    return 0;
}


Measured memory_bytes: 74112
n = int(input())

num = [0] * (n + 1)
for i in range(1, n // 2 + 1):
    for j in range(i, n + 1, i):
        num[j] += 1
for i in range(n // 2 + 1, n + 1):
    num[i] += 1
    
ans = 0
for i in range(n + 1):
    ans += i * num[i]
print(ans)

Measured memory_bytes: 151320
#include<stdio.h>
#include<math.h>
int main(void){
    int y, m, d, D;
    while ( scanf("%d %d %d", &y, &m, &d) != EOF ) {
        D = 10000 * y + m * 100 + d;
        /*printf("D%d", D);*/
        if ( D < 18680908 ) printf("pre-meiji\n");
        else if ( 18680908 <= D && D <= 19120729 ) printf("meiji %d %d %d\n", y - 1867, m, d);
        else if ( 19120730 <= D && D <= 19261224 ) printf("taisho %d %d %d\n", y - 1911, m, d);
        else if ( 19261225 <= D && D <= 19890107 ) printf("showa %d %d %d\n", y - 1925, m, d);
        else if ( 19890108 <= D ) printf("heisei %d %d %d\n", y - 1988, m, d);
        /*printf("a");*/
    }
    return 0;
}

Measured memory_bytes: 1692
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <sstream>
#include <map>
#include <queue>
#include <set>
#define rep(i,n) for(int i = 0; i < n; i++)
#define rep1(i,n) for(int i = 1; i <= n; i++)
#define co(x) cout << x <<endl
#define cs(x) cout << x <<" "
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
using namespace std;
ll mod = 1e9 + 7;

int main()
{
	int a, b;
	cin >> a >> b;
	co(max(a - 2 * b, 0));
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define all(n) begin(n),end(n)
using ll = long long;
using P = pair<int,int>;
int mod = 1000000007;
int main() {
    int n;
    cin >> n;
    ll ans = 1;
    for(int i = 1; i <= n; ++i) {
        ans*=i%mod;
        ans%=mod;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
typedef int64_t ll;
struct Solution {
    void solve(std::istream& in, std::ostream& out) {
        ll a, b, c;
        in >> a >> b >> c;
        string ans = "NO";
        int sum = 0;
        for (int i = a; i <= 100 * b; i += a) {
            sum += i;
            if (sum % b == c || i % b == c) {
                ans = "YES";
                break;
            }
        }
        out << ans << '\n';
    }
};
void solve(std::istream& in, std::ostream& out) {
    out << std::setprecision(12);
    Solution solution;
    solution.solve(in, out);
}
#include <fstream>
#include <iostream>
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    istream& in = cin;
    ostream& out = cout;
    solve(in, out);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int AB, BC, CA;
  cin >> AB >> BC >> CA;
  vector<int> ABC(3);
  ABC.at(0) = AB + BC;
  ABC.at(1) = AB + CA;
  ABC.at(2) = BC + CA;
  sort(ABC.begin(), ABC.end());
  cout << ABC.at(0) << endl;
}

Measured memory_bytes: 3580
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main(){
    int n,ans=0; cin>>n;
    rep(i,n){
        int a; cin>>a;
        while(a%2==0){
            ans++;
            a/=2;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <map>
#include <set>
#include <bitset>
#include <sstream>
#include <cstdlib>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <climits>
using namespace std;

#define eps 1e-8
#define mod 1000000007
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define fi first
#define se second

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<vector<int>> vvi;

int main() {
    int n;
    cin >> n;
    vector<int> a(n), b(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    int j = 0;
    for (int i = n - 1; i >= 0; i -= 2) {
        b[j++] = a[i];
    }
    for (int i = n % 2 ? 1 : 0; i < n; i += 2) {
        b[j++] = a[i];
    }
    for (int i = 0; i < n; ++i) {
        if (i) cout << " ";
        cout << b[i];
    }

    return 0;
}

Measured memory_bytes: 3712
#include<bits/stdc++.h>
using namespace std;

typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
#define rrep(i, m, n) for(int (i)=(m); (i)<(n);  (i)++)
#define erep(i, m, n) for(int (i)=(m); (i)<=(n); (i)++)
#define  rep(i, n)    for(int (i)=0; (i)<(n);  (i)++)
#define rrev(i, m, n) for(int (i)=(n)-1; (i)>=(m); (i)--)
#define erev(i, m, n) for(int (i)=(n); (i)>=(m); (i)--)
#define  rev(i, n)    for(int (i)=(n)-1; (i)>=0; (i)--)
#define vrep(i, c)    for(__typeof((c).begin())i=(c).begin(); i!=(c).end(); i++)
#define  ALL(v)       (v).begin(), (v).end()
#define mp            make_pair
#define pb            push_back
template<class T, class S> inline bool minup(T& m, S x){ return m>(T)x ? (m=(T)x, true) : false; }
template<class T, class S> inline bool maxup(T& m, S x){ return m<(T)x ? (m=(T)x, true) : false; }

const int    INF = 1000000000;
const ll     MOD = 1000000007LL;
const double EPS = 1E-12;

struct Point : public complex<double>
{
public:
  Point() { this->real(0);  this->imag(0); }
  Point(const double& x, const double& y) { this->real(x);  this->imag(y); }
  Point(const complex<double> w)  { this->real(w.real());  this->imag(w.imag()); }
  inline double dot(Point p){ return (conj(*this) * p).real(); }  // ??????
  inline double det(Point p){ return (conj(*this) * p).imag(); }  // ??????
};

namespace std
{
  inline bool operator < (const Point& a, const Point& b)
  {
    return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
  }
}
typedef vector<Point> Polygon;
inline Point currPoint(vector<Point> P, int i){ return P[i]; }
inline Point nextPoint(vector<Point> P, int i){ return P[(i+1)%P.size()]; }
inline Point diffPoint(vector<Point> P, int i){ return nextPoint(P, i) - currPoint(P, i); }

// ?¬?????????¢??????A = 1/2 ?£a ?? b????????¨?????????????????????????????????????????????????????±??????
double AreaOfPolygon(const Polygon& P)
{
  double A = 0.0;
  for (int i = 0; i < P.size(); ++i)
    A += currPoint(P, i).det(nextPoint(P, i));
  return A;
}

int n;
double x, y;
int cnt;

int main()
{
  while((cin >> n) && n){
    Polygon P;
    rep(i, n){
      cin >> x >> y;
      P.pb(Point(x, y));
    }
    printf("%d %.1f\n", ++cnt, abs(AreaOfPolygon(P)) / 2.0);
  }


  return 0;
}

Measured memory_bytes: 1248
import heapq
INF = float('inf')


def dijkstra(s, n, edges, d):
    d = [INF] * n
    d[s] = 0
    pq = [(0, s)]
    while len(pq):
        c, v = heapq.heappop(pq)
        if d[v] < c:
            continue
        for v2nvcost, nv in edges[v]:
            if c + v2nvcost < d[nv]:
                d[nv] = c + v2nvcost
                heapq.heappush(pq, (d[nv], nv))
    return d


n, m, s, t = map(int, input().split())
s -= 1
t -= 1
edges_yen = [[] for _ in range(n)]
edges_snuuk = [[] for _ in range(n)]
for _ in range(m):
    u, v, a, b = map(int, input().split())
    u -= 1
    v -= 1
    edges_yen[u].append((a, v))
    edges_yen[v].append((a, u))
    edges_snuuk[u].append((b, v))
    edges_snuuk[v].append((b, u))
d = [INF] * n
d_yen = dijkstra(s, n, edges_yen, d)
d = [INF] * n
d_snuuk = dijkstra(t, n, edges_snuuk, d)
temp = [0] * n  # 場所iで両替した時の最終スヌーク
for i in range(n):
    temp[i] = 10**15 - (d_yen[i] + d_snuuk[i])

ans = [INF] * n
ans[-1] = temp[-1]
for i in range(n - 2, -1, -1):
    ans[i] = max(ans[i + 1], temp[i])
# print(d_yen)
# print(d_snuuk)
for i in range(n):
    print(ans[i])


Measured memory_bytes: 84496
#include<bits/stdc++.h>
using namespace std;

char s[15];

int main()
{
    scanf("%s",s);
    int len = strlen(s);
    int ok = 1;
    for(int i=0;i<len;i+=2){
        if(s[i]!='h'||s[i+1]!='i') ok = 0;
    }
    if(ok) puts("Yes");
    else puts("No"); 
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;

  
int main() {
  int N;
  cin >> N;
  vector<int> Q= {1,2,3,4,5,6,7,8,9,10,12,14,16,18,15,21,24,27,20,28,32,36,25,30,35,40,45,42,48,54,49,56,63,64,72,81};
   int s= Q.size();
  bool f=false;
  for(int i=0;i<s;i++){
    if(N == Q[i]) f = true;
  }
	if(f) puts("Yes");
  else puts("No");
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define ll long long
#define ld long double
#define mp make_pair
#define mt make_tuple
#define ff first
#define ss second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define for0(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define forr(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define forab(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
#define foriter(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define endl '\n'
#define INF (ll)(1e9)
#define EPS 1e-9
#define MOD (ll)(1e9+7)
#define PI 3.1415926535897932384626433832795
#define set set
#define mset multiset
#define uset unordered_set
#define umset unordered_multiset
#define map map
#define mmap multimap
#define umap unordered_map
#define ummap unordered_multimap

using namespace std;
 
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vll;
typedef vector<vll> vvll;
typedef pair<i64, i64> pll;

int inp(){
  int x; 
  cin>>x;
  return x;
}

//=============================================================================//

void solve() {
    ll n; cin>>n;
    string s; cin>>s;
    ll R=0, W=0;
    for0(i, n){
      if(s[i]=='R') R++;
      else W++;
    }
    ll RinLeft=0;
    for0(i, R){
      if(s[i]=='R') RinLeft++;
    }
    ll RinRight=R-RinLeft;
    cout<<RinRight;
}

int main() {
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif 
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.precision(10);

    int T=1;
    //cin >> T;
    while (T--) {
        solve();
        cout<<endl;
    }
    
    return 0;
}

Measured memory_bytes: 3744
#![allow(unused_mut)]
#![allow(non_snake_case)]
#![allow(unused_macros)]
#![allow(unused_variables)]
#![allow(unused_imports)]
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

macro_rules! max {
    ($x: expr) => ($x);
    ($x: expr, $($y: expr),+) => {
        ::std::cmp::max($x, max!($($y),+))
    };
}

macro_rules! min {
    ($x: expr) => ($x);
    ($x: expr, $($y: expr),+) => {
        ::std::cmp::min($x, max!($($y),+))
    };
}

use std::cmp;
use std::collections::{HashSet, BinaryHeap, VecDeque};
use std::iter::FromIterator;
fn main() {
    input!{
        X: usize
    }

    let mut n: usize = 1;
    while (n*(n+1))/2 < X { n += 1; }
    println!("{}", n);

}

Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;

struct point{
  double x,y;
};

void koch(int n,point a,point b){
  if(n==0)return;
  point s,t,u;
  double th = M_PI * 60.0 / 180.0;
  s.x = (2.0 * a.x + 1.0 * b.x) / 3.0;
  s.y = (2.0 * a.y + 1.0 * b.y) / 3.0;
  t.x = (1.0 * a.x + 2.0 * b.x) / 3.0;
  t.y = (1.0 * a.y + 2.0 * b.y) / 3.0;
  u.x = (t.x - s.x) * cos(th) -(t.y-s.y)*sin(th)+s.x;
  u.y = (t.x - s.x) * sin(th)+(t.y-s.y)*cos(th)+s.y;
  
  koch(n-1,a,s);
  printf("%.8f %.8f\n", s.x, s.y);
  koch(n-1,s,u);
  printf("%.8f %.8f\n", u.x, u.y);
  koch(n-1,u,t);
  printf("%.8f %.8f\n", t.x, t.y);
  koch(n-1,t,b);
}

int main(){
  point a,b;
  int n;
  scanf("%d", &n);
  a.x=0;
  a.y=0;
  b.x=100;
  b.y=0;
  
  printf("%.8f %.8f\n",a.x,a.y);
  koch(n,a,b);
  printf("%.8f %.8f\n",b.x,b.y);
  
  return(0);

}

Measured memory_bytes: 1228
#include <bits/stdc++.h>
#define reg register
#define ll long long
#define N 100005

using namespace std;

int n, h[N];

int main() {
    cin >> n;
	for (int i = 1; i <= n; i++) scanf("%d", h + i);
    int Ans = 0, res = 1;
    for (int i = 2; i <= n; i++) {
        if (h[i] <= h[i - 1]) res++;
        else Ans = max(Ans, res), res = 1;
    }
    Ans = max(Ans, res);
    cout << Ans - 1 << endl;
    return 0;
}



Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main() {
  long long int n,k;
  cin>>n>>k;
  long long int h[n];
  for(int i=0;i<n;i++){cin>>h[i];}
  if(n>k){long long sum=0;
    sort(h,h+n);
  for(int i=0;i<(n-k);i++){
    sum=sum+h[i];
    }
       cout<<sum;
  }
  else{cout<<"0";}
} 

Measured memory_bytes: 1792
#include<cstdio>

int main(){

  int a[3][6];

  for(int i=0;i<3;i++){
    for(int j=0;j<6;j++) scanf("%d", &a[i][j]);
  }

  for(int i=0;i<3;i++){
    int k = 0;
    k += (a[i][3]-a[i][0])*3600 + (a[i][4]-a[i][1])*60 + (a[i][5]-a[i][2]);
    printf("%d %d %d\n", k/3600, (k%3600)/60, (k%3600)%60);
  }

}

Measured memory_bytes: 1024
#include <iostream>
using namespace std;
int main()
{
    int a, b, temp, i;
    for(i=1; i<=3000; i++)
  {
     cin >> a >> b;
   
   
    if(a==0 && b==0)
       break;
   
   
    if(a > b)
    {
    temp = a;
    a = b;
    b = temp;
    }
   
    cout << a << " " << b << endl;
  }
}
 


Measured memory_bytes: 3076
//Author: Fuadul Hasan(fuadul202@gmail.com)
//BSMRSTU,Gopalganj
#include<bits/stdc++.h>
using namespace std;int tc = 1;
#define happy ios::sync_with_stdio(false);
#define coding  cin.tie(0);
#define F first
#define S second
#define mp make_pair
#define ll long long
#define Pi atan(1)*4
#define pb  push_back
#define vpr vector<pr> 
#define pr pair<int, int> 
#define vi std::vector<int>
#define vll std::vector<ll>
#define all(n) n.begin(),n.end()
#define point(x) setprecision(x)
#define Test printf("Case %d: ",tc++);
#define Unique(c) (c).resize(unique(all(c))-(c).begin())
#define vout(v) for (auto z: v) cout << z << " "; cout << endl;
int length(long long x){int l = 0;for(long long i=x;i;i/=10)l++;return l;}

#define error(args...) {vector<string>_v=split(#args,',');err(_v.begin(),args);cout<<endl;}
vector<string> split(const string &s, char c) {vector<string>v; stringstream ss(s); string x;
while (getline(ss, x, c))v.emplace_back(x); return move(v);} void err(vector<string>::iterator it) {}
template<typename T, typename... Args>void err(vector<string>::iterator it, T a, Args...args) {
cout << it->substr((*it)[0] == ' ', it->length()) << " = " << a << " "; err(++it, args...);}

const int M = 1e9 + 7;
const ll  Inf = (ll)2e18 + 5;
const int N   = 2e5 + 5;
ll vis[N],res[N];

int solve() 
{
	//happy coding

	ll n;
	cin>>n;
	std::vector<ll> dp(N,0);
	dp[0] = 1;
	for(ll i = 3;i<=n;i++){
		for(ll j = 0;j<=(i-3);j++){
			dp[i] = (dp[i]+dp[j])%M;
		}
	}

	cout<<dp[n]<<endl;
		
	return 0;
}
int main(){
	int test = 1;
  	//scanf("%d", &test);
  	while (test--)solve();return 0;
}

Measured memory_bytes: 4772
#include <iostream>
#include <vector>

using namespace std;

const long long INF = 1ULL << 60;

struct edge
{
	int src, dst;
	long long weight;
};

void bellman_ford(const vector<edge> &g, int s, vector<long long> &dist, vector<bool> &neg)
{
	int n = g.size();
	dist.assign(n, INF + INF);
	neg.assign(n, false);
	dist[s] = 0;
	bool negative_cycle = false;
	for (int k = 0; k < n; ++k) {
		for (auto &e : g) {
			if (dist[e.dst] > dist[e.src] + e.weight) {
				dist[e.dst] = dist[e.src] + e.weight;
				if (k == n - 1) {
					dist[e.dst] = -INF;
					neg[e.dst] = true;
				}
			}
		}
	}
}

int main()
{
	int N, M;
	cin >> N >> M;
	vector<edge> g(N);
	for (int i = 0; i < M; ++i) {
		int a, b, c;
		cin >> a >> b >> c;
		--a;
		--b;
		c *= -1;
		g.push_back(edge{ a, b, c });
	}
	vector<long long> dist;
	vector<bool> neg;
	bellman_ford(g, 0, dist, neg);

	if (neg[N - 1]) {
		cout << "inf" << endl;
	}
	else {
		cout << -dist[N - 1] << endl;
	}
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
#define rep(i, l, r) for(int i = (l), i##end = (r);i <= i##end;++i)
using std::cin; using std::cout;
const int maxn = 200200;
typedef long long ll;
const int mod = 998244353;
inline ll pow(ll a,int b,int ans = 1) {
	for(;b;b >>= 1,a = a * a % mod) if(b & 1)
		ans = ans * a % mod;
	return ans;
}
inline ll inverse(int x){ return pow(x, mod - 2); }
int n, a[maxn];
inline bool get() {
	int s = 0, one = 0;
	rep(i, 1, n) s += a[i] % 2, one = one || a[i] == 1;
	if(s != 1 || one) return n - s & 1;
	int gcd = 0;
	for(int i = 1;i <= n;++i) gcd = std::__gcd(gcd, a[i] -= a[i] % 2);
	for(int i = 1;i <= n;++i) a[i] /= gcd;
	return get() ^ 1;
}
int main() {
	std::ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	cin >> n;
	rep(i, 1, n) cin >> a[i];
	cout << (get() ? "First" : "Second") << '\n';
}


Measured memory_bytes: 640
import java.util.regex.Pattern;

public class Main {

	private static void solve() {
		int a = ni();
		int b = ni();
		String s = next();
		if (Pattern.matches("^\\d{" + a + "}\\-\\d{" + b + "}$", s)) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}

	public static void main(String[] args) {
		new Thread(null, new Runnable() {
			@Override
			public void run() {
				long start = System.currentTimeMillis();
				String debug = args.length > 0 ? args[0] : null;
				if (debug != null) {
					try {
						is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));
					} catch (Exception e) {
						throw new RuntimeException(e);
					}
				}
				reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);
				solve();
				out.flush();
				tr((System.currentTimeMillis() - start) + "ms");
			}
		}, "", 64000000).start();
	}

	private static java.io.InputStream is = System.in;
	private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);
	private static java.util.StringTokenizer tokenizer = null;
	private static java.io.BufferedReader reader;

	public static String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new java.util.StringTokenizer(reader.readLine());
			} catch (Exception e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}

	private static double nd() {
		return Double.parseDouble(next());
	}

	private static long nl() {
		return Long.parseLong(next());
	}

	private static int[] na(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}

	private static char[] ns() {
		return next().toCharArray();
	}

	private static long[] nal(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nl();
		return a;
	}

	private static int[][] ntable(int n, int m) {
		int[][] table = new int[n][m];
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				table[i][j] = ni();
			}
		}
		return table;
	}

	private static int[][] nlist(int n, int m) {
		int[][] table = new int[m][n];
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				table[j][i] = ni();
			}
		}
		return table;
	}

	private static int ni() {
		return Integer.parseInt(next());
	}

	private static void tr(Object... o) {
		if (is != System.in)
			System.out.println(java.util.Arrays.deepToString(o));
	}
}


Measured memory_bytes: 22996
#include <iostream>
#include <stdio.h>
using namespace std;
void kock(int n, float p[2], float q[2]){
    if(n == 0){
        return;
    }
    float san = 1.73205080757;
    float s[2] = {(2*p[0]+q[0])/3,(2*p[1]+q[1])/3}; 
    float t[2] = {(p[0]+2*q[0])/3,(p[1]+2*q[1])/3};
    float u[2] = {(t[0] - s[0])/2 - (t[1] - s[1])*san/2 + s[0],
                  (t[0] - s[0])*san/2 + (t[1] - s[1])/2 + s[1]};
    kock(n-1,p,s);
    printf("%f %f\n",s[0],s[1]);
    kock(n-1, s, u);
    printf("%f %f\n",u[0],u[1]);
    kock(n-1, u, t);
    printf("%f %f\n",t[0],t[1]);
    kock(n-1, t, q);
}

int main() {
    int n;
    cin >> n;
    float p[2] = {0.0, 0.0};
    float q[2] = {100.0, 0.0};
    printf("%f %f\n",p[0],p[1]);
    kock(n, p, q);
    printf("%f %f\n",q[0],q[1]);

    return 0;
}


Measured memory_bytes: 3140
#include <iostream>
#include <cmath>
using namespace std;

int main(void){
	double r;

	while(cin>>r,r!=0.0){
		for(int i=1;i<=10000000;i++){
			int tmp = i * M_PI;
			if(fabs((double)tmp/i - M_PI) <= r){
				cout<<tmp<<"/"<<i<<endl;
				break;
			}
			if(fabs((double)(tmp+1)/i - M_PI) <= r){
				cout<<tmp+1<<"/"<<i<<endl;
				break;
			}
		}
	}

	return 0;
}

Measured memory_bytes: 0
function Main(input){
	input=input.split(/\n|\s/);
	input.forEach(function(e,i,a){a[i]=Number(a[i]);});
	for(var i=3;i<3+input[0];i=(i+1)|0){
		input[2]+=Math.ceil(input[1]/input[i]);
	}
	console.log(input[2]);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 11468
#include <bits/stdc++.h>
using namespace std;
#define make_pair(a, b) mp(a, b)
typedef pair<int, int> pii; 
typedef long long ll;
const int maxn = 2e5 + 10;
typedef long long ll;
int lowbit(int x) { return x & (-x);}
int C[maxn][2];
int n, q;
ll ans;
void update(int x, int val, int k)
{
	for(int i = x; i; i -= lowbit(i))
		C[i][k] = min(C[i][k], val);
}
int query(int x, int k)
{
	int ret = n - 2;
	for(int i = x; i < maxn; i += lowbit(i))
		ret = min(ret, C[i][k]);
	return ret;
}
int main()
{
	scanf("%d%d", &n, &q);
	ans = 1ll * (n - 2) * (n - 2);
	for(int i = 1; i < maxn; ++i) C[i][0] = C[i][1] = n - 2;
	while(q--)
	{
		int op, x;
		scanf("%d%d", &op, &x);
		--op; --x;
		int pos = query(x, op ^ 1);
		//cout << pos << endl;
		ans -= pos;
		update(pos, x - 1, op);
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 5372
#include "bits/stdc++.h"
using namespace std;
typedef long long li;

int dx[2] = {1, 0};
int dy[2] = {0, 1};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    li h, w;
    cin >> h >> w;

    vector<string> f(h);
    for (int i = 0; i < h; ++i) {
        cin >> f[i];
    }

    deque<pair<li, pair<li, li>>> q;
    const li inf = 1LL << 60;
    vector<vector<li>> dist(h, vector<li>(w, inf));
    q.emplace_back(f[0][0] == '#' ? 1 : 0, make_pair(0, 0));

    while (!q.empty()) {
        auto fr = q.front();
        q.pop_front();
        li cost = fr.first;
        li r = fr.second.first;
        li c = fr.second.second;

        if (dist[r][c] <= cost) {
            continue;
        }
        dist[r][c] = cost;
        bool isw = f[r][c] == '.';

        for (int d = 0; d < 2; ++d) {
            li nr = r + dx[d];
            li nc = c + dy[d];
            if (nr < 0 || nc < 0 || nr >= h || nc >= w) {
                continue;
            }
            bool isnextb = f[nr][nc] == '#';
            if (isw and isnextb) {
                li ncost = cost + 1;
                q.emplace_back(ncost, make_pair(nr, nc));
            } else {
                li ncost = cost;
                q.emplace_front(ncost, make_pair(nr, nc));
            }
        }
    }
    cout << dist[h - 1][w - 1] << endl;
    return 0;
}

Measured memory_bytes: 384
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <cassert>

//std::cout << std::fixed << std::setprecision(10)
//std::ios::sync_with_stdio(false);
constexpr long long MOD = 1000000007;

int dx[] = { 0, 1, 0, -1};
int dy[] = {-1, 0, 1,  0};

int main()
{
  int H, W, K;
  std::cin >> H >> W >> K;
  std::vector<std::vector<bool>> S(H, std::vector<bool>(W, false));
  for(auto& v: S)
  {
    std::string str;
    std::cin >> str;
    for(int i=0; i<str.size(); ++i)
      v[i]=str[i]=='1';
  }

  long long ans = H-1+W-1;
  std::array<int, 10> sums, limits;
  for(int i = 0; i < (1 << (H-1)); ++i)
  {
    int n = 0, cnt = 0, x = i;
    sums.fill(0);
    while(x)
    {
      cnt++;
      if(x&1)
      {
        limits[n] = cnt;
        n++;
      }
      x=x>>1;
    }
    limits[n] = H;
    long long tmp = n;
    int beg = 0;
    bool fail = false;
    for(int j = 0; j < W; ++j)
    {
      if(fail)
        break;
      int start = 0;
      for(int k = 0; k <= n; ++k)
      {
        bool overflow = false;
        for(int l = start; l < limits[k]; ++l)
        {
          if(S[l][j])
          {
            if(++sums[k] > K)
            {
              overflow = true;
              break;
            }
          }
        }
        if(overflow)
        {
          ++tmp;
          sums.fill(0);
          if(j == beg)
          {
            fail = true;
          }
          beg = j;
          --j;
          break;
        }
        else
        {
          start = limits[k];
        }
      }
    }
    if(!fail)
      ans = std::min(ans, tmp);
  }
  std::cout << ans << std::endl;

  return 0;
}



Measured memory_bytes: 256
use std::io::*;
use std::str::*;

fn read<T: FromStr>(s: &mut StdinLock) -> Option<T> {
    let s = s.by_ref()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect::<String>();
    s.parse::<T>().ok()
}

fn is_dream(s: &str) -> bool {
    s.len() >= 5 && &s[..5] == "dream"
}

fn is_dreamer(s: &str) -> bool {
    s.len() >= 7 && &s[..7] == "dreamer"
}

fn is_erase(s: &str) -> bool {
    s.len() >= 5 && &s[..5] == "erase"
}

fn is_eraser(s: &str) -> bool {
    s.len() >= 6 && &s[..6] == "eraser"
}

fn is_good(s: &str) -> bool {
    let mut s = String::from(s);

    while s.len() > 0 {
        if is_dream(&s) {
            if is_dreamer(&s) {
                if is_erase(&s[5..]) {
                    s = s[5..].to_string();
                } else {
                    s = s[7..].to_string();
                }
            } else {
                s = s[5..].to_string();
            }
        } else if is_eraser(&s) {
            s = s[6..].to_string();
        } else if is_erase(&s) {
            s = s[5..].to_string();
        } else {
            return false;
        }
    }

    return true;
}

pub fn main() {
    let stdin = stdin();
    let mut stdin = stdin.lock();

    let s: String = read(&mut stdin).unwrap();

    if is_good(&s) {
        println!("YES");
    } else {
        println!("NO");
    }
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define sd(x) scanf("%d", &x)
#define sz(v) (int) v.size()
#define pr(v) For(i, 0, sz(v)) {cout<<v[i]<<" ";} cout<<endl;
#define slld(x) scanf("%lld", &x)
#define all(x) x.begin(), x.end()
#define For(i, st, en) for(ll i=st; i<en; i++)
#define tr(x) for(auto it=x.begin(); it!=x.end(); it++)
#define fast std::ios::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define ll long long
#define ld long double
#define int long long
#define double long double
#define mp make_pair
#define F first
#define S second
typedef pair<int, int> pii;
typedef vector<int> vi;
#define pi 3.141592653589793238
const int MOD = 1e9+7;
const int INF = 1LL<<60;


const int N = 5e5+5;

// it's swapnil07 ;)
 
#ifdef SWAPNIL07
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
int begtime = clock();
#define end_routine() cout << "\n\nTime elapsed: " << (clock() - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n";
#else
#define endl '\n'
#define trace(...)
#define end_routine()
#endif

int fact[N], ifact[N];

int powmod(int a, int b, int c = MOD){
    int ans = 1;
    while(b){
        if(b&1){
            ans = (ans*a)%c;
        }
        a = (a*a)%c;
        b >>= 1;
    }
    return ans;
}

int ncr(int n, int r){
    int v = fact[n]*ifact[n-r]%MOD;
    v = v*ifact[r]%MOD;
    return v;
}

int npr(int n, int r){
    int v = fact[n]*ifact[n-r]%MOD;
    return v;
}

void precompute(){
    fact[0]=1;
    ifact[0]=1;
    For(i, 1, N){
        fact[i]=fact[i-1]*i;
        fact[i]%=MOD;
        ifact[i]=powmod(fact[i],MOD-2);
    }
}

void solve(){
    int n, m; cin>>n>>m;
    int ans = 0;
    int f = 1;
    For(i, 0, n+1){
        int cur = ncr(n, i);
        cur = cur * npr(m, i) % MOD;
        cur = cur * npr(m-i, n-i) % MOD;
        cur = cur * npr(m-i, n-i) % MOD;
        cur = (cur * f + MOD) % MOD;
        ans = (ans + cur) % MOD;
        f = -f;
    }
    cout<<ans;
}



signed main()
{
    fast
    #ifdef SWAPNIL07
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif
    precompute();
    int t=1; 
    // cin>>t;
    while(t--){
        solve();
        cout<<"\n";
    }
    return 0;
}



Measured memory_bytes: 11452
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<n;i++)
#include <bits/stdc++.h>
#include <numeric>
using namespace std;
typedef long long ll;


int main() {
    int N; cin>>N;
    string S; cin>>S;
    int a=S.size();
    int cnt;
    int ans=-1;
   
    for(int j=1;j<a;j++){
         map<char,int>mp1;
         map<char,int>mp2;
         cnt=0;
        for(int i=0;i<j;i++){
            mp1[S[i]]++;
        }
        for(int k=j;k<a;k++){
            mp2[S[k]]++;
        }
        for(auto p:mp1){
            for(auto q:mp2){
                if(p.first ==q.first){
                    cnt++;
                }

            }
        }
        ans =max(cnt,ans);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
macro_rules! input {
    ($ttype:ty) => {
        {
            let mut input = String::new();
            let _= std::io::stdin().read_line(&mut input);
            input.trim().parse::<$ttype>().unwrap()
        }
    };

    ($($ttype:ty),*) => {
        {
            use std::io::BufRead;
            let mut input = String::new();
            let stdin = std::io::stdin();
            let _ = stdin.lock().read_line(&mut input);
            let mut iter = input.trim().split_whitespace();
            (
                $(iter.next().unwrap().parse::<$ttype>().unwrap(),)*
            )
        }
    };

    ($ttype:ty; $x:expr) => {
        {
            use std::io::BufRead;
            let mut input = String::new();
            let stdin = std::io::stdin();
            let _ = stdin.lock().read_line(&mut input);
            let v: Vec<$ttype> = input
                .trim()
                .split_whitespace()
                .map(|x| x.parse().unwrap())
                .collect();
            v
        }
    };

    ($ttype:ty; $x:expr; $y:expr) => {
        {
            use std::io::BufRead;
            let mut matrix = Vec::with_capacity($y);
            for _ in 0..$y {
                let mut input = String::new();
                let stdin = std::io::stdin();
                let _ = stdin.lock().read_line(&mut input);
                let v: Vec<$ttype> = input
                    .trim()
                    .split_whitespace()
                    .map(|x| x.parse().unwrap())
                    .collect();
                matrix.push(v);
            }
            matrix
        }
    };
}

fn main() {
    let (n, y) = input!(usize, usize);

    for i in 0..n+1 {
        for j in 0..n+1-i {
            let k = n - (i + j);
            if 10000 * i + 5000 * j + 1000 * k == y {
                println!("{} {} {}", i, j, k);
                return;
            }
        }
    }
    println!("-1 -1 -1");
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define reg register
#define ll long long
#define vi vector<int>
#define pb push_back
#define SZ(x) (int) x.size()
using namespace std;
const int MAXN = 310;
int n, m, l, q, dis[MAXN][MAXN], f[MAXN][MAXN];
void work() {
  scanf("%d%d%d", &n, &m, &l), memset(dis, 0x3f, sizeof(dis));
  for(reg int i = 1; i <= m; ++i) {
    int a, b, c;
    scanf("%d%d%d", &a, &b, &c), dis[a][b] = dis[b][a] = c;
  }
  for(reg int k = 1; k <= n; ++k) for(reg int i = 1; i <= n; ++i) for(reg int j = 1; j <= n; ++j) dis[i][j] = min(dis[i][j], dis[i][k] + dis[k][j]);
  for(reg int i = 1; i <= n; ++i) for(reg int j = 1; j <= n; ++j) {
    if(dis[i][j] <= l) f[i][j] = 1;
    else f[i][j] = 0x3f3f3f3f;
  }
  for(reg int k = 1; k <= n; ++k) for(reg int i = 1; i <= n; ++i) for(reg int j = 1; j <= n; ++j) f[i][j] = min(f[i][j], f[i][k] + f[k][j]);
  scanf("%d", &q);
  for(reg int i = 1; i <= q; ++i) {
    int s, t;
    scanf("%d%d", &s, &t);
    if(f[s][t] != 0x3f3f3f3f) printf("%d\n", f[s][t] - 1);
    else puts("-1");
  }
}
int main() {
  int _ = 1;
  // scanf("%d", &_);
  while(_--) work();
  return 0;
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>

using namespace std;

using int64 = long long;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);

  int h_total, w_total, h, w;
  cin >> h_total >> w_total >> h >> w;
  if (h_total % h == 0 && w_total % w == 0) {
    cout << "No" << endl;
    return 0;
  }

  cout << "Yes" << endl;
  for (int r = 0; r < h_total; r++) {
    for (int c = 0; c < w_total; c++) {
      int y = r % h;
      int x = c % w;
      if (y == 0 && x == 0) {
        cout << static_cast<int>(1e9) - 1 << " ";
      } else if (y == h - 1 && x == w - 1) {
        cout << static_cast<int>(-1e9) << " ";
      } else {
        cout << 0 << " ";
      }
    }
    cout << endl;
  }
}

Measured memory_bytes: 2944
{-# LANGUAGE BangPatterns #-}
import Control.Monad
import Data.Word
import qualified Data.ByteString as BSW
import qualified Data.ByteString.Char8 as BS
import Data.Array.Unboxed
import Data.Array.ST
--import qualified Data.Vector.Unboxed as U
--import qualified Data.Vector.Unboxed.Mutable as UM

-- Input: s t
-- Output: arr
--   arr ! (i,j) == length of lcs of (drop i s, drop j t)
lcsTable2 :: BS.ByteString -> BS.ByteString -> UArray (Int,Int) Word16
lcsTable2 s t = runSTUArray $ do
  let !m = BS.length s
      !n = BS.length t
      !n' = n+1
  arr <- newArray ((0,0),(m,n)) 0
  forM_ [m-1,m-2..0] $ \ !i -> do
    let !x = BSW.index s i
        loopY !j !v
          -- v = readArray arr (i,j+1)
          | j < 0 = return ()
          | otherwise = do
              let !y = BSW.index t j
              if x == y
                then do l2 <- readArray arr (i+1,j+1)
                        let !l = l2 + 1
                        writeArray arr (i,j) l
                        loopY (j-1) l
                else do l0 <- readArray arr (i+1,j)
                        let !l = max l0 v
                        writeArray arr (i,j) l
                        loopY (j-1) l
    loopY (n-1) 0
  return arr

main = do
  s <- BS.getLine
  t <- BS.getLine
  -- BS.length s <= 3000, BS.length t <= 3000, BS.all isAsciiLower s, BS.all isAsciiLower t
  let !table = lcsTable2 s t
      !m = BS.length s
      !n = BS.length t
      !n' = n+1
  let recon !i !j | x == y = let !i' = i+1 ; !j' = j+1
                             in Just (x, (i', j'))
                  | table ! (i+1,j) >= table ! (i,j+1) = recon (i+1) j
                  | otherwise = recon i (j+1)
        where x = BSW.index s i
              y = BSW.index t j
      (result, _) = BSW.unfoldrN (fromIntegral $ table ! (0,0)) (\(!i,!j) -> recon i j) (0,0)
  BS.putStrLn result


Measured memory_bytes: 19324
checkNum i = if i `mod` 3 == 0 then True
             else containsThree i
containsThree 0 = False
containsThree i = if i `mod` 10 == 3 then True
                  else containsThree $ i `div` 10
    

main = do
  ln <- getLine
  let n = read ln :: Int
  putStrLn (" " ++ (unwords . map show $ filter checkNum [1.. n]))

Measured memory_bytes: 4132
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b;
  cin >> a >> b;
  int A;
  if(b/100 == 1)
    A = 3;
  else if(b / 10 == 0)
    A = 1;
  else
    A = 2;
  for(int i = 0;i<A;i++){
    a *= 10;
  }
  int M = sqrt(a+b);
  if(M*M == a+b)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b;
  cin >> a >> b;
  int sum = 0;
  if(a < b){
    for(int i = 0;i<b;i++){
      sum += pow(10,i)*a;
    }
  }
  else{
    for(int i = 0;i<a;i++){
      sum += pow(10,i)*b;
    }
  }
  cout << sum << endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() 
{
    int a, b, c, x, count = 0;
    cin >> a >> b >> c;
    for (x = a; x <= b; x++) {
        if (c % x == 0) {
            count++;
        }
    }
    cout << count << endl;
    return 0;
}


Measured memory_bytes: 3108
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <stack>
#include <queue>
#include <string>
#include <utility>
#include <algorithm>
#include <functional>
#include <deque>
#define INF 1000000000
#define MOD 1000000007
#define mod(x) ((x % MOD) + MOD) % MOD
#define MAX_N 200001

using namespace std;

typedef long long ll;
typedef pair<int,int> P;
struct PairHash{
    size_t operator()(const P &p) const{return p.first * MAX_N + p.second;}
};

int par[2][MAX_N];
int myrank[2][MAX_N];

void init(int n)
{
  for (int i = 0; i < n; i++) {
    par[0][i] = i;
    par[1][i] = i;
    myrank[0][i] = 0;
    myrank[1][i] = 0;
  }
}

int find(int x, int i)
{
  if (par[i][x] == x) return x;
  return par[i][x] = find(par[i][x], i);
}

void unite(int x, int y, int i)
{
  x = find(x, i);
  y = find(y, i);
  if (x == y) return;
  if (myrank[i][x] < myrank[i][y]) {
    par[i][x] = y;
  } else {
    par[i][y] = x;
    if(myrank[i][x] == myrank[i][y]) myrank[i][x]++;
  }
}

bool same(int x, int y, int i)
{
  return find(x, i) == find(y, i);
}

int main()
{
  int N, K, L;
  cin >> N >> K >> L;
  init(N);
  int p, q;
  for (int i = 0; i < K; i++) {
    cin >> p >> q;
    p--; q--;
    unite(p, q, 0);
  }
  int r, s;
  for (int i = 0; i < L; i++) {
    cin >> r >> s;
    r--; s--;
    unite(r, s, 1);
  }

  P idx[MAX_N];
  for (int i = 0; i < N; i++) {
    idx[i] = P(find(i, 0), find(i, 1));
  }

  unordered_map<P, int, PairHash> num;
  for (int i = 0; i < N; i++) {
    num[idx[i]]++;
  }

  for (int i = 0; i < N; i++) {
    cout << num[idx[i]] << endl;
  }

  return 0;
}


Measured memory_bytes: 15816
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cstring>
#include<cmath>
#include<numeric>
#include<queue>
#include<climits>
#include<cstdio>
#include<map>


#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
//#define INF ((LLONG_MAX) / (2))
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
typedef long long int ll;
typedef pair<ll,int> LL_IP;
typedef pair<ll,ll> LL_LLP;
#define INF 1000000007
#define MAX_H 20000
#define MOD 1000000007

/*mod Mでの割り算は割る数aのM-2をかける*/
/*ここではaのb乗をpで割った余りを返す*/
ll calc(ll a,ll b,ll p){

   if(b == 0){
       return 1;
   }else if(b % 2 == 0){
       ll tmp = (calc(a,b/2,p)) % p;
       return ((tmp%p)*(tmp%p))%p;
   }else{
       return ((a%p)*(calc(a,b-1,p)%p)) % p;
   }
}


/*nCrの計算*/
ll nCr(ll n,ll r){

    if(n < r){
        return 0;
    }else if(n == r){
        return 1;
    }else{
        ll total = n,under1 = n-r,under2 = r;
        /*n!を求める*/
        for(ll i = n-1; i > 0;i--){
            total *= i;
            total %= MOD;
        }
        /*(n-r)!を求める*/
        for(ll i = n-r-1; i > 0;i--){
            under1 *= i;
            under1 %= MOD;
        }
        /*r!を求める*/
        for(ll i = r-1; i > 0;i--){
            under2 *= i;
            under2 %= MOD;
        }
        /*(n-r)! * r!を求める*/
        ll under = (under1*under2) % MOD;
        return ((total % MOD) * calc(under,MOD-2,MOD)) % MOD;
    }
}





int main(){

    ll n,r;
    cin >> n;
    vector<ll> a(n);
    REP(i,n){
        cin >> a[i];
    }
    sort(a.begin(),a.end(),greater<ll>());

    ll maxi = a[0];
    //cout << maxi << endl;

    ll middle = a[0]/2;
    ll tmp = INF;
    r = a[0];

    for(int i = 0;i < n;i++){

        if(a[i] == maxi){
            continue;
        }

        if(abs(middle-a[i]) < tmp){
            tmp = abs(middle-a[i]);
            r = a[i];
        }   
    }
    cout << maxi << " " << r << endl;





    
    return 0;
}

Measured memory_bytes: 1024