akhauriyash/Code-Regression huggingface dataset:
n, s = map(int, input().split())
a = list(map(int, input().split()))

MOD = 998244353


dp = [[0 for i in range(s + 1)] for j in range(n + 1)]

dp[0][0] = 1

for i in range(n):
    for j in range(s + 1):
        dp[i + 1][j] += dp[i][j] * 2
        dp[i + 1][j] %= MOD
        if j + a[i] <= s:
            dp[i + 1][j + a[i]] += dp[i][j]
            dp[i + 1][j + a[i]] %= MOD


print(dp[-1][-1])

Measured memory_bytes: 147536
# -*- coding: utf-8 -*-

"""
参考：http://arc061.contest.atcoder.jp/data/arc/061/editorial.pdf
・各点が影響を与える9か所の正方形をメモしておく。
"""

import sys, re
from collections import deque, defaultdict, Counter
from math import sqrt, hypot, factorial, pi, sin, cos, radians
from heapq import heappop, heappush, heapify, heappushpop
from bisect import bisect_left, bisect_right
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from functools import reduce, partial
from fractions import Fraction
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

H, W, N = MAP()
# その黒い点が含まれる正方形の左上座標を持っておく
xy = []
for i in range(N):
    a, b = MAP()
    a -= 1
    b -= 1
    for j in range(3):
        for k in range(3):
            # 3*3の正方形を作れない座標は除く
            if 0 <= a-j < H-2 and 0 <= b-k < W-2:
                xy.append((a-j, b-k))
# 各座標の出現数を集計
c = Counter(xy)
# 0以外はこの集計結果から集められる
ans = [0] * 10
for k, v in c.items():
    ans[v] += 1
# 黒い点が0個の正方形の数 = 候補となりうる全正方形の数 - 黒い点が1個でも出現した正方形の数
ans[0] = (H-2)*(W-2) - len(c)

for num in ans:
    print(num)


Measured memory_bytes: 200212
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner in=new Scanner(System.in);
		int a=in.nextInt(),b=in.nextInt();
		int c=in.nextInt(),d=in.nextInt(),e=in.nextInt();
		int time=0;
		
		while(a<0){
			a++;
			time+=c;
		}
		
		if(a==0)time+=d;
		
		while(a<b){
			a++;
			time+=e;
		}
		
		System.out.println(time);
	}

}



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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}


int main(void){
	string s;
	while(getline(cin, s) && s != "."){
		string t = "";
		REP(i, s.size()){
			if(string("()[]").find(s[i]) != string::npos){
				t += s[i];
			}
		}
		while(1){
			int32 l = 0;
			int32 cnt = 0;
			REP(i, t.size()){
				if(t[l] == '(' && t[i] == ')'){
					t[l] = t[i] = '.';
					cnt++;
				}else if(t[l] == '[' && t[i] == ']'){
					t[l] = t[i] = '.';
					cnt++;
				}
				if(t[i] != '.')
					l = i;
			}
			if(cnt == 0)
				break;
		}
		int32 cnt = 0;
		REP(i, t.size())
			if(t[i] == '.') cnt++;

		if(cnt == t.size())
			cout << "yes" << endl;
		else
			cout << "no" << endl;
	}
}


Measured memory_bytes: 3160
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define FORR(i, a, b) for (int i = b - 1; i >= a; --i)
#define SORT(v) sort(v.begin(), v.end())
#define SORTR(v) sort(v.rbegin(), v.rend())
#define REV(v) reverse(v.begin(), v.end())
#define ITER(v) for (auto itr = v.begin(), itr != v.end(); ++itr)
#define LB(v, x) lower_bound(v.begin(), v.end(), x) - v.begin()
#define UB(v, x) upper_bound(v.begin(), v.end(), x) - v.begin()
#define SZ(v) (int)v.size()
using namespace std;
using ll = long long;
using P = pair<int, int>;

class SegmentTree {
    int n;
    const int e = INT_MAX;
    vector<int> node, lazy, lazy_flg;
    void eval(int k, int l, int r) {
        if (lazy_flg[k]) {
            lazy_flg[k] = false;
            node[k] = lazy[k];
            if (r - l > 1) {
                lazy_flg[2 * k] = lazy_flg[2 * k + 1] = true;
                lazy[2 * k] = lazy[2 * k + 1] = lazy[k];
            }
        }
    }

public:
    SegmentTree(const vector<int> &v) {
        int N = SZ(v);
        n = 1;
        while (n < N) n <<= 1;
        node.resize(2 * n, e);
        lazy.resize(2 * n);
        lazy_flg.resize(2 * n);
        REP(i, N) node[n + i] = v[i];
        for (int k = n - 1; k > 0; --k)
            node[k] = min(node[2 * k], node[2 * k + 1]);
    }
    void update(int a, int b, int x, int k = 1, int l = 0, int r = -1) {
        if (r < 0) r = n;
        eval(k, l, r);
        if (b <= l || r <= a) return;
        if (a <= l && r <= b) {
            lazy[k] = x;
            lazy_flg[k] = true;
            eval(k, l, r);
            return;
        }
        update(a, b, x, 2 * k, l, (l + r) / 2);
        update(a, b, x, 2 * k + 1, (l + r) / 2, r);
        node[k] = min(node[2 * k], node[2 * k + 1]);
    }
    int get(int a, int b, int k = 1, int l = 0, int r = -1) {
        if (r < 0) r = n;
        eval(k, l, r);
        if (b <= l || r <= a) return e;
        if (a <= l && r <= b) return node[k];
        return min(get(a, b, 2 * k, l, (l + r) / 2),
                   get(a, b, 2 * k + 1, (l + r) / 2, r));
    }
};

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

    int n, q;
    cin >> n >> q;
    vector<int> a(n, INT_MAX);
    SegmentTree seg(a);
    REP(i, q) {
        int query;
        cin >> query;
        if (query == 0) {
            int i, x;
            cin >> i >> x;
            seg.update(i, i + 1, x);
        } else {
            int s, t;
            cin >> s >> t;
            cout << seg.get(s, t + 1) << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 6128
#include <iostream>

int main() {
  int h;
  int w;

  while(std::cin >> h >> w) {
    if(h == 0 && w == 0) {
      break;
    }

    for(int i = 0; i < h; ++i) {
      for(int j = 0; j < w; ++j) {
        if(i == 0 || i == h - 1 || j == 0 || j == w - 1) {
          std::cout << '#';
        }
        else {
          std::cout << '.';
        }
      }
      std::cout << std::endl;
    }
    std::cout << std::endl;
  }

  return 0;
}

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

using ll = long long;
using P = pair<ll, ll>;

const ll MOD = 1e9+7;
// const ll MOD = 998244353;
const ll INF = 1ll<<60;

#define FOR(i,a,b) for (ll i=(a);i<(ll)(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define DEBUG(x) ;
#define DEBUG(x) std::cerr << #x << " : " << (x) << std::endl;

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

int main(int argc, char **argv)
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll D, N; cin >> D >> N;

	auto f = [&](ll n)
			 {
				 ll cnt{0};
				 while (n)
				 {
					 if (n % 100 != 0) break;
					 n /= 100;
					 ++cnt;
				 }
				 return cnt;
			 };

	ll cnt{0};
	ll res{0};
	for (ll i = 1; i < 100*100*200; ++i)
	{
		if (f(i) == D)
		{
			++cnt;
			if (cnt == N)
			{
				std::cout << i << std::endl;
				return 0;
			}
		}
	}
	return 0;
}


Measured memory_bytes: 3612
#include <stdio.h>
int main(void) {
	int N, K;
	int i, k = 1;
	scanf("%d", &N);
	scanf("%d", &K);
	k *= K;
	for (i = 1; i < N; i++) {
		k *= (K - 1);
	}
	printf("%d\n", k);
	return 0;
}

Measured memory_bytes: 128
{
  const main = (input: string) => {
    const r = reader(input)
    const N = r.n()
    const xys = r.lines.map(line => line.split(' ').map(Number))

    const patterns = permutation(_range(N))

    let sum = 0

    patterns.forEach(ns => {
      let sumi = 0

      for (let i = 0; i < N - 1; i++) {
        const p1 = ns[i]
        const p2 = ns[i + 1]

        const [x1, y1] = xys[p1]
        const [x2, y2] = xys[p2]

        sumi += _distance(x1, y1, x2, y2)
      }
      sum += sumi
    })

    console.log(sum / patterns.length)
  }
  const _range = (n: number) => Array.from(Array(n).keys())
  const _distance = (x1, y1, x2, y2) =>
    Math.sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2)

  const permutation = <T>(
    post: T[],
    result: T[][] = [],
    pre: T[] = [],
    n: number = post.length
  ) => {
    if (n > 0) {
      post.forEach((_, i) => {
        const rest = [...post]
        const elem = rest.splice(i, 1)

        permutation(rest, result, [...pre, ...elem], n - 1)
      })
    } else {
      result.push(pre)
    }
    return result
  }

  const reader = (str: string) => {
    const lines = str.trim().split('\n')
    const s = () => lines.shift() || ''
    const n = () => Number(s())

    const ss = () => s().split(' ')
    const ns = () => ss().map(Number)
    const nls = () => lines.map(Number)

    return { lines, s, n, ss, ns, nls }
  }

  const getInput = () => require('fs').readFileSync('/dev/stdin', 'utf8')

  main(getInput())
}


Measured memory_bytes: 26168
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>
#include <queue>
#include <random>
#include <cstdint>
#include <bitset>
#include <iomanip>
#include <utility>
#include<map>
#include<functional>
#include<climits>
using namespace std;
using ll = long long;
const int mod = 1000000007;

int main() {
	int n[4];
	cin >> n[0] >> n[1] >> n[2] >> n[3];
	sort(n, n + 4);
	if (n[0] == 1 && n[1] == 4 && n[2] == 7 && n[3] == 9)cout << "YES" << endl;
	else cout << "NO" << endl;
}


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

int main() {
    for(int H, W; cin >> H >> W, !(H == 0 && W == 0);) {
        for (int i = 0; i < H; i++) {
            for (int j = 0; j < W; j++) {
                if ((i + j) % 2 == 0)
                    cout << '#';
                else
                    cout << '.';
            }
            cout << '\n';
        }
        cout << '\n';
    }
    return 0;
}



Measured memory_bytes: 2992
#include<iostream>
#include<algorithm>
using namespace std;

int main()
{
   int a, b, k;
   cin >> a >> b >> k;
   int cnt = 0;
   int M = min(a, b);
   int ans = 0;
   for(int i = M; i >= 1; i--)
   {
      if(a % i == 0 && b % i == 0)
      {
         cnt++;
      }
      if(cnt == k)
      {
         ans = i;
         break;
      }
   }
   cout << ans << endl;
   return 0;
}


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

struct CompleteBinaryTree {
    vector < int > data;
    int size;

    CompleteBinaryTree(const vector < int >& data) : size(data.size()), data(data) {}
    
    void print()
    {
        for ( int i = 0; i < size; i++ ) {
            cout << "node " << i + 1 << ": key = " << data[i] << ", ";
            if ( i > 0 ) cout << "parent key = " << data[(i - 1) / 2] << ", ";
            if ( i * 2 + 1 < size ) {
                cout << "left key = " << data[i * 2 + 1] << ", ";
                if ( i * 2 + 2 < size ) {
                    cout << "right key = " << data[i * 2 + 2] << ", ";
                }
            }
            cout << endl;
        }
    }
};

int main()
{
    int H;
    cin >> H;

    vector < int > data(H);
    
    for ( int i = 0; i < H; i++ ) {
        cin >> data[i];
    }

    CompleteBinaryTree tree(data);

    tree.print();
    
    return ( 0 );
}



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

int main()
{
  int N, K;
  cin >> N >> K;
  
  vector<int> l;
  
  rep(i, N)
  {
    int tmp;
	cin >> tmp;
    l.push_back(tmp);
  }
  
  sort(l.begin(), l.end(), greater<int>());
  
  int sum = 0;
  rep(i, K)
  {
    sum += l[i];
  }
  
  cout << sum << endl;

  return 0;
}

Measured memory_bytes: 256
#include"bits/stdc++.h"

using namespace std;

int main() {
	string O, E;
	cin >> O >> E;

	for (int i = 0; i < O.length(); i++) {
		cout << O[i];

		if (i < E.length()) {
			cout << E[i];
		}
	}

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>
#include <iomanip>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;
struct INIT { INIT(){
  cin.tie(0); ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
}}INIT;

int N;
vector<int> A, sum;

signed main() {
  cin >> N;

  A.resize(N);
  REP(i, N) cin >> A[i];

  sum.resize(N+1, 0);
  REP(i, N) sum[i+1] += sum[i]+A[i];

  auto f = [&](int l, int m, int r){
    return abs((sum[m]-sum[l])-(sum[r+1]-sum[m]));
  };

  int ans = INF;
  int l = 1, r = 2;
  FOR(i, 1, N-1){
    while(l+1 <= i && f(0, l, i) > f(0, l+1, i)) l++;
    while(r+1 <= N && f(i+1, r, N-1) > f(i+1, r+1, N-1)) r++;

    int P = sum[l];
    int Q = sum[i+1]-sum[l];
    int R = sum[r]-sum[i+1];
    int S = sum[N]-sum[r];

    int MAX = max(max(P, Q), max(R, S));
    int MIN = min(min(P, Q), min(R, S));

    chmin(ans, MAX-MIN);
  }

  cout << ans << "\n";


  return 0;
}

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

using namespace std;
#define int long long
const int MOD = 1000000007;

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int H, A;
	cin >> H >> A;
	cout << ((H + A - 1) / A) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a[69],b[69];
int  main(){
	int n,m,cut=0;
	cin>>n>>m;
	for(int i=0;i<m;i++)cin>>a[i]>>b[i];
	for(int j=1;j<=n;j++){
		for(int i=0;i<m;i++){
			if(a[i]==j||b[i]==j){
				cut++;
			}
		}
		cout<<cut<<endl;
		cut=0;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#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 equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod2 = 998244353;
const ll INF = 1e18;
const long double EPS = 1e-10;

int main() {
  vector<vector<char>> c(2, vector<char>(3));
  rep(i, 2) {
    rep(j, 3) {
      cin >> c[i][j];
    }
  }

  cout << (c[0][0] == c[1][2] && c[0][2] == c[1][0] && c[0][1] == c[1][1] ? "YES" : "NO") << endl;


  
  return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

namespace AtCoderCs
{
    class Program
    {
        static void Main()
        {

            long[] Buffer = new long[5] { 0, 0, 0, 0, 0 };
            int Num = int.Parse(Console.ReadLine());
            long Result = 0;

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

                switch (Console.ReadLine().First())
                {

                    case 'M':
                        Buffer[0]++;
                        break;

                    case 'A':
                        Buffer[1]++;
                        break;

                    case 'R':
                        Buffer[2]++;
                        break;

                    case 'C':
                        Buffer[3]++;
                        break;

                    case 'H':
                        Buffer[4]++;
                        break;

                }

            }

            // 回数を数える
            for (int i = 0; i < 3; i++)
            {

                for (int j = i + 1; j < 4; j++)
                {

                    for (int k = j + 1; k < 5; k++)
                    {

                        Result += Buffer[i] * Buffer[j] * Buffer[k];

                    }

                }

            }

            Console.WriteLine(Result);

        }


    }
}


Measured memory_bytes: 15312
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
#define divup(a,b) ( ( (a) + ( (b) - 1u) ) / (b) ) // a/b の余り切り上げ
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
int mod = 1000000007;

int main(){
    ll r,d,x2,k;
    cin>>r>>d>>x2;
    rep(i,10){
        k= r* x2 -d;
        cout<<k<<endl;
        x2=k;
    }
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <vector>
using namespace std;

inline int readint(){
	int x; scanf("%d",&x); return x;
}

const int MaxN = 200005;
int h[MaxN]; bool bad[MaxN];

int main(){
	int n = readint(), m = readint();
	for(int i=1; i<=n; ++i)
		h[i] = readint();
	for(int x,y; m; --m){
		x = readint(), y = readint();
		if(h[x] <= h[y])
			bad[x] = true;
		if(h[x] >= h[y])
			bad[y] = true;
	}
	int ans = 0;
	for(int i=1; i<=n; ++i)
		if(not bad[i])
			++ ans;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 4308
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,n) for (int64_t i=0; i<(n); ++i)
#define P pair<int,int>
using ll=int64_t;
using namespace std;
#define ketasuu(n) fixed<<setprecision(n)
#define btoe(p) p.begin(),p.end()
#define etob(p) p.rbegin(),p.rend()
#define chmax(x,y) x=max(x,y)




int main(){
    int n; cin>>n;
    vector<int> d(n), f(n);
    rep(i,n) cin>>d[i]>>f[i];
    bool ok=false;
    rep(i,n-2){
        if(d[i]==f[i] && d[i+1]==f[i+1] && d[i+2]==f[i+2]){
            ok=true;
            break;
        }
    }
    cout<< (ok?"Yes": "No") <<endl;
    return 0;
}

Measured memory_bytes: 3624
// cities to vapori-
// corner cases // int vs ll // cin vs scanf // clear structures // statement // doublesz // math is your friend
#include <bits/stdc++.h>
#define pb push_back
#define fst first
#define snd second
#define sz(x) int(x.size())
#define fill(x,v) memset(x,v,sizeof(x))
#define REP(i,a,b) for(int i = int(a); i < int(b); ++i)
#define trace(x) cout << #x << " = " << x << endl
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;

bool validDiv(ll x, ll n){
	if(x == 1) return false;
	while(n % x == 0) n /= x;
	return n % x == 1;
}

int main(){

	fastio;
	ll n;
	cin >> n;
	ll ans = 0;
	for(ll i = 1; i*i <= n; ++i){
		if(n % i == 0){
			if(validDiv(i,n)) ans++;
			if(n/i != i && validDiv(n/i,n)) ans++;
		}
	}

	n--;
	for(ll i = 1; i*i <= n; ++i){
		if(n % i == 0){
			if(i > 1) ans++;
			if(n/i != i) ans++;
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<time.h>
#include<math.h>
#include<stdlib.h>
#include<iostream>
#include<iomanip>
#include<utility>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#define ll long long
#define fi first
#define sec second
#define mp make_pair
#define pb push_back
#define rep(a,b,c) for(int a=1;a<=b;a+=c)
#define repp(a,b,c,d) for(int a=b;a<=c;a+=d)

const double PI=acos(-1);
const double EPS=1e-12;
const int MOD=1e9+7;
const int INF=1<<30;


using namespace std;


int main(){
	ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	int a,b,c,d;
	cin>>a>>b;
	cin>>c>>d;
	if(a==1||a==3||a==5||a==7||a==8||a==10||a==12){
		if(b==31)cout<<1<<endl;
		else cout<<0<<endl;
	}
	else if(a==2){
		if(b==28)cout<<1<<endl;
		else cout<<0<<endl;
	}
	else{
		if(b==30)cout<<1<<endl;
		else cout<<0<<endl;
	}
	return 0;
}


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

int main(){
  vector<int> a(10001,0);
  int x,y,z;
  for(x=1;x<=100;x++){
    for(y=1;y<=100;y++){
      for(z=1;z<=100;z++){
        if(x*x+y*y+z*z+x*y+y*z+z*x<=10000){
          a.at(x*x+y*y+z*z+x*y+y*z+z*x)++;
        }
      }
    }
  }
  
  int n,i;
  cin >> n;
  for(i=1;i<=n;i++){
    cout << a.at(i) << endl;
  }
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)




string S;
int N;
//-----------------------------------------------------------------
string solve() {
	int ans;

	if (S[0] == S[N - 1]) {
		ans = N - 3;
	}
	else {
		int flag = 1;
		int cnt = 0;
		rep(i, 1, N - 1) {
			if (flag) {
				// S[N-1]を探す
				if (S[i] == S[N - 1]) {
					cnt++;
					flag = 1 - flag;
				}
			}
			else {
				// S[0]を探す
				if (S[i] == S[0]) {
					cnt++;
					flag = 1 - flag;
				}
			}
		}
		if (flag == 0) cnt--;
		ans = N - 2 - cnt;
	}

	if (ans % 2)
		return "First";
	else
		return "Second";
}
//-----------------------------------------------------------------
int main() {
	cin >> S;
	N = S.length();

	cout << solve() << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  int ans = 1000;
  for(int i = 1; i < n / 2 + 1; i++){
    int sum = 0;
    for(int j = i;j > 0;j /= 10){
      sum += j % 10;
    }
    for(int j = n - i;j > 0;j /= 10){
      sum += j % 10;
    }
    ans = min(ans, sum);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;
int main()
{
	long long n, a[5],time=0;
	cin >> n >> a[0] >> a[1] >> a[2] >> a[3] >> a[4];
	sort(a, a + 5);
	cout << (n-1)/a[0]+5;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,m,a,b,ans[100010],f;
vector<int> v[100010];
queue<pair<int,int> > q;
int main(){
	cin>>n>>m;
	for (int i=0;i<m;i++){
		cin>>a>>b;
		v[a].push_back(b);
		v[b].push_back(a);
	}
	for (int i=0;i<100010;i++) ans[i]=-1,sort(v[i].begin(),v[i].end());
	for (int i=2;i<=n;i++)
		if (v[i].size()>0&&v[i][0]==1){
			ans[i]=1;
			for (int j=1;j<v[i].size();j++) q.push(pair<int,int>(v[i][j],i));
		}
	while (!q.empty()){
		int x=q.front().first,y=q.front().second;q.pop();
		if (ans[x]!=-1) continue;
		ans[x]=y;
		for (int j=0;j<v[x].size();j++) q.push(pair<int,int>(v[x][j],x));
	}
	for (int i=2;i<=n;i++) if (ans[i]==-1) f=1;
	if (f==1)
		cout<<"No"<<endl;
	else{
		cout<<"Yes"<<endl;
		for (int i=2;i<=n;i++) cout<<ans[i]<<endl;
	}
	return 0;
}

Measured memory_bytes: 11812
#include<stdio.h>
int main(void)
{
    int n,x,m,i,j,a[100],c1=0,c2=0;
    scanf("%d%d%d",&n,&m,&x);
    for(i=0;i<m;i++)
        scanf("%d",&a[i]);
    for(i=x;i<n;i++){
        for(j=0;j<m;j++){
            if(a[j]==i)
                c1++;
        }
    }
    for(i=x;i>0;i--){
        for(j=0;j<m;j++){
            if(a[j]==i)
                c2++;
        }
    }
    if(c1<c2)
        printf("%d\n",c1);
    else 
        printf("%d\n",c2);
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) FOR(i,0,n)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define PB push_back
#define LB lower_bound
#define UB upper_bound
#define PQ priority_queue
#define UM unordered_map
#define ALL(a) (a).begin(),(a).end()
typedef vector<ll> vi;
typedef vector<vector<ll>> vvi;
const ll INF = (1ll << 60);
typedef pair<ll,ll> pii;
struct Edge{
  ll to,id;
};
typedef vector<vector<ll>> Graph;
typedef vector<pii> vpii;


int main() {
  ll a,b; cin>>a>>b;
  if(a*b<=0) {cout<<"Zero"<<endl; return 0;}
  if(b<0&&(a-b)%2==0) {cout<<"Negative"<<endl; return 0;}
  cout<<"Positive"<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main() {
  int a, b;
  scanf(" %d %d", &a, &b);
  if (b > a) {
    int holder = a;
    a = b;
    b = holder;
  }
  while (a % b) {
    int holder = a % b;
    a = b;
    b = holder;
  }
  printf("%d\n", b);
  return 0;
}


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

#define NREP() for(ll i = 0; i < n; i++)
#define MREP() for(ll j = 0; j < m; j++)
#define REP(i, n) for(ll i = 0; i < n; i++)
#define ALL(x) (x).begin(), (x).end()
#define MSG(x) cout << x << endl;
#define IPT(t, x) t ipt; cin >> ipt; x.push_back(ipt);
#define YN(x) x ? cout << "YES" << endl : cout << "NO" << endl;
#define Yn(x) x ? cout << "Yes" << endl : cout << "No" << endl;
#define yn(x) x ? cout << "yes" << endl : cout << "no" << endl;

using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;

const static ll MOD = 1e9 + 7;
ll n, cnt, ans, tmp, sum, a, b, c, d, k, m, h, w, q, x, y;
string s, t;

int main() {
    cin >> s;
    Yn(s.at(0) == '9' || s.at(1) == '9')
}


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

using namespace std;
using ll = long long;
using ull = unsigned long long;

#ifndef __MACRO_H__
#define __MACRO_H__

#define all(collection) (collection).begin(), (collection).end()  // begin to end
#define rep(i, begin, end) for (ll i = begin; i < end; i++)       // repeat
#define repr(i, begin, end) for (ll i = begin; end < i; i--)      // repeat reverse
#define size(collection) ((ll) (collection).size())               // collection size

#endif


int main(void)
{
	ll x, a, b; cin >> x >> a >> b;

	if (b <= a)
		cout << "delicious";
	else if (b <= a + x)
		cout << "safe";
	else
		cout << "dangerous";

	return 0;
}




Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<stdio.h>
using namespace std;
int main(){
    double a,b,c,l,h,s,r;
    cin >> a >> b >> c;
    double PI = acos(-1);
    r=c*PI/180;
    s=a*b*sin(r)/2;
    l=a+b+sqrt(a*a+b*b-2*a*b*cos(r));
    h=b*sin(r);
    printf("%.5f\n",s);
    printf("%.5f\n",l);
    printf("%.5f\n",h);
    
    
}



Measured memory_bytes: 3452
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))

diff=[[A[i]-B[i],i] for i in range(N)]
diff=sorted(diff,key=lambda x:x[0])

idx=-1
for i in range(N):
  while(diff[i][0]<0):
    if diff[idx][0]< 0:
      print("-1")
      exit(0)
    if abs(diff[i][0]) >= diff[idx][0]:
      diff[i][0]+=diff[idx][0]
      diff[idx][0]=0
      idx-=1
    else:
      diff[idx][0]+=diff[i][0]
      diff[i][0]=0
diff=sorted(diff,key=lambda x:x[1])
C=[B[i]+diff[i][0] for i in range(N)]
ans=0
for i in range(N):
  if A[i]!=C[i]:
    ans+=1
print(ans)


Measured memory_bytes: 32148
import java.util.*;

public class Main {
        public static void main(String args[]) {
                Scanner sc = new Scanner(System.in);
                String s = sc.nextLine();
                String t = sc.nextLine();
                char[] s2 = s.toCharArray();
                char[] t2 = t.toCharArray();

                Arrays.sort(s2);
                Arrays.sort(t2);
                for (int i = 0;;i++) {
                        if (i == t.length()) {
                                System.out.println("No");
                                break;
                        }
                        if (i == s.length()) {
                                System.out.println("Yes");
                                break;
                        }
                        if (s2[i] < t2[t.length() - i - 1]) {
                                System.out.println("Yes");
                                break;
                        } else if (s2[i] > t2[t.length() - i - 1]) {
                                System.out.println("No");
                                break;
                        }
                }
        }
}


Measured memory_bytes: 21972
N = int(input())

a = list(map(int,input().split()))


a.sort()

L2 = -2
L1 = -2
now = -2 #番号

N2 = 0
N1 = 0
N0 = 0 #個数

ans = 0


for i in a:

    if i != now:

        if now+1 == i:

            L2 = L1
            N2 = N1
            L1 = now
            N1 = N0

            now = i
            N0 = 1

        else:

            L2 = -2
            L1 = -2
            N2 = 0
            N1 = 0

            now = i
            N0 = 1

    else:

        N0 += 1

    ans = max(ans , N0 + N1 + N2)

print (ans)


Measured memory_bytes: 52804
n,*s=map(int,open(0).read().split());s,t,f,g=[s[i*n:i*n+n]for i in range(4)];r=range(n);a=[n*[0]for _ in r];e=enumerate
for b in range(64):
 y=1<<b;u=[k&y for k in f];v=[k&y for k in g];l=[0]*n;m=l[:]
 for i,k in e(u):
  for j,h in e(v):
   if(k&h)|((s[i]^1)*k)|((t[j]^1)*h):a[i][j]|=y;l[i]+=1;m[j]+=1
 for i in r:
  if(l[i]==0)*s[i]*u[i]:
   for j in r:
    if(t[j]^1)*(n-m[j]>1):a[i][j]|=y;m[j]+=1;break
  if(m[i]==0)*t[i]*v[i]:
   for j in r:
    if(s[j]^1)*(n-l[j]>1):a[j][i]|=y;l[j]+=1;break
h=a[0][:];w=[i[0]for i in a]
for i,k in e(a):
 for j,l in e(k):w[i]=(l|w[i]if s[i]else w[i]&l);h[j]=(l|h[j]if t[j]else h[j]&l)
if g+f!=h+w:exit(print(-1))
for i in a:print(*i)

Measured memory_bytes: 99500
#include <bits/stdc++.h>
using namespace std;
#define all(V) V.begin(),V.end()
#define ll long long
const ll MOD = 1000000007;
//const ll MOD = 998244353;

ll dp[1005][10005];

void chmin(ll& x, ll y) {
	x = min(x, y);
}

int main() {
	for (int i = 0;i < 1005;i++) {
		for (int j = 0;j < 10005;j++)
			dp[i][j] = LLONG_MAX / 100;
	}
	ll H, N, A, B;
	cin >> H >> N;
	dp[0][H] = 0;
	for (int i = 0;i < N;i++) {
		cin >> A >> B;
		for (int j = 10004;j >= 0;j--) {
			chmin(dp[i][max(j - A, 0LL)], dp[i][j] + B);
			chmin(dp[i + 1][j], dp[i][j]);
		}
	}
	cout << dp[N][0] << endl;
}

Measured memory_bytes: 78848
#include<iostream>
#include<vector>
#include<utility>
#include<algorithm>
using namespace std;
int main(){
  long long  n,h,a,b,max_a=0;
  long long sum=0,min_cnt=10000000000,tmp_cnt;
  vector<int> b_list;
  cin >> n >> h;
  for(int i=0;i<n;i++){
    cin >> a >> b;
    max_a=(max_a>a)?max_a:a;
    b_list.push_back(b);
  }
  sort(b_list.begin(),b_list.end(),greater<int>());
  for(int i=0;i<n;i++){
    sum+=b_list[i];
    tmp_cnt=(i+1);
    if(h-sum>0){
      tmp_cnt+=(h-sum)/max_a;
      if((h-sum)%max_a!=0) tmp_cnt++;
    }
    min_cnt=(min_cnt<tmp_cnt)?min_cnt:tmp_cnt;
  }
  cout << min_cnt<<endl;
}


Measured memory_bytes: 892
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <functional>
using namespace std;

#define Rep(b, e, i) for(int i = b; i <= e; i++)
#define rep(n, i) Rep(0, n-1, i)
#define MAX 200000
#define INF (ll)1e10
#define MOD 1000000007

typedef long long ll;
typedef pair<ll, ll> P;
typedef std::priority_queue<int> IntPrioQueue; //Z->A
typedef std::priority_queue<int, std::vector<int>, std::greater<int> > IntReversePrioQueue; //A->Z


int dx4[4]={1,0,-1,0};
int dy4[4]={0,1,0,-1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};

void solve(void){
    int ss[3][3];
    rep(3, i) rep(3, j) {
        scanf("%d", &ss[i][j]);
    }
    bool flag = true;
    rep(2, j) {
        rep(2, i){
            if (ss[i+1][j] - ss[i][j] != ss[i+1][j+1] - ss[i][j+1]) flag = false;
        }
    }
    rep(2, i) {
        rep(2, j){
            if (ss[i][j] - ss[i][j+1] != ss[i+1][j] - ss[i+1][j+1]) flag = false;
        }
    }
    if (flag) printf("Yes\n");
    else printf("No\n");
}

int main(void){
  solve();
  return 0;
}


Measured memory_bytes: 256
//  g++ -g -std=gnu++14 -I . main.cpp -o main
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define all(v)    (v).begin(), (v).end()
#define in        ([]{int n; cin>>n; return n;}())
using namespace std;
using lint = int64_t;
const char nl = '\n';


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

    vector<lint> A(N);
    rep( i, N ) A[i] = in;

    lint ans = 0;
    rep( i, N ) ans += abs(A[i]);

    rep( i, N ) {
        if( A[i] == 0 ) {
            cout << ans << "\n";
            return 0;
        }
    }

    int count_minus = 0;
    rep( i, N ) {
        if( A[i] < 0 ) {
            count_minus ++;
        }
    }

    if( count_minus %2 == 0 ) {
        cout << ans << "\n";
        return 0;
    }

    lint min_ = INT_MAX;
    rep( i, N ) {
        min_ = min( min_, abs(A[i]) );
    }

    cout << (ans - min_*2) << "\n";
}


Measured memory_bytes: 1024
#include <cstdio>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;
 
const double EPS = 1e-8;
struct P{
    double x, y;
    P(double x_, double y_){ x = x_; y = y_; }
    P(){}
    P operator-(const P& p){
        return P(x - p.x, y - p.y); 
    }
};
bool operator<(const P& a, const P& b){
    return ( a.x < b.x );
}
 
struct Segment{
    P a, b;
    Segment(P a_, P b_){
        if( b_ < a_ ) swap(a_, b_);
        a = a_; b = b_;
    }
    Segment(){}
};
bool operator<(const Segment& a, const Segment& b){
    return ( a.a < b.a );
}
 
double dot(P a, P b){
    return a.x * b.x + a.y * b.y;
}
double cross(P a, P b){
    return a.x * b.y - a.y * b.x;
}
double dist(P a){
    return sqrt(a.x * a.x + a.y * a.y);
}
double dist(P a, P b){
    return sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y));
}
double dist(P a, P b, P x){
    if( dot(b-a, x-a) < EPS ) return dist(x-a);
    if( dot(a-b, x-b) < EPS ) return dist(x-b);
    return abs(cross(b-a, x-a)) / dist(b-a);
}
double dist(Segment a, Segment b){
    return min( min(dist(a.a, a.b, b.a), dist(a.a, a.b, b.b)), min(dist(b.a, b.b, a.a), dist(b.a, b.b, a.b)));
}
bool is_intersect(P a1, P a2, P b1, P b2) {
  return ( cross(a2-a1, b1-a1) * cross(a2-a1, b2-a1) < EPS ) &&
         ( cross(b2-b1, a1-b1) * cross(b2-b1, a2-b1) < EPS );
}
bool is_parallel(P a1, P a2, P b1, P b2){
    return fabs(cross(a1-a2, b1-b2)) < EPS;
}
 
 
Segment v[5101];
 
int main(){
    int n, h[101][101] = {0};
     
    scanf("%d", &n);
    if( n > 5100 ){
        printf("%.8f\n", 0.0);
        return 0;
    }
     
    for(int i=0 ; i < n ; i++ ){
        int ax, ay, bx, by;
        scanf("%d %d %d %d", &ax, &ay, &bx, &by);
        h[ay][ax]++;
        h[by][bx]++;
        v[i] = Segment(P(ax,ay), P(bx,by));
    }
     
    bool flag = false;
    for(int y=0 ; y < 101 && !flag ; y++ ){
        for(int x=0 ; x < 101 && !flag ; x++ ){
            if( h[y][x] >= 2 ){
                printf("%.8f\n", 0.0);
                return 0;
            }
        }
    }
     
    double ans = 200;
    sort(v, v+n);
    for(int i=0 ; i < n ; i++ ){
        for(int j=i+1 ; j < n ; j++ ){
            double d = dist(v[i], v[j]);
            ans = min(ans, d);
            if( !is_parallel(v[i].a, v[i].b, v[j].a, v[j].b) && is_intersect(v[i].a, v[i].b, v[j].a, v[j].b) ){
                ans = 0.0;
                break;
            }
        }
    }
    printf("%.8f\n", ans);
}

Measured memory_bytes: 1272
x, n = map(int, input().split())
if n != 0:
    p = list(map(int, input().split()))
    if x in p:
        for i in range(-1000, 1001):
            if i == -1000:
                mini = i
            if i in p:
                pass
            else:
                if abs(x - mini) > abs(x - i):
                    mini = i
                elif abs(x - mini) == abs(x - i):
                    mini = min(mini, i)
        else:
            print(mini)
    else:
        print(x)
else:
    print(x)


Measured memory_bytes: 64832
A, B, Q = gets.split.map &:to_i
s = []
t = []
q = []
A.times{s << gets.to_i}
B.times{t << gets.to_i}
Q.times{q << gets.to_i}
def bin_search val,list
    if val < list[0]
        return [-10**11, list[0]]
    end
    if val > list[-1]
        return [list[-1], 10**11]
    end
    low = 0
    high = list.size-1
    while (high - low > 1)
        if val < list[(high + low) / 2]
            high = (high + low) / 2
        else
            low = (high + low)/ 2
        end
    end
    return [list[low], list[high]]
end
q.each{|x|
    # 頭が悪い

    a_l, a_h = bin_search x,s
    b_1_l, b_1_h = bin_search a_l, t
    b_2_l, b_2_h = bin_search a_h, t

    b_l, b_h = bin_search x,t
    a_1_l, a_1_h = bin_search b_l, s
    a_2_l, a_2_h = bin_search b_h, s

    puts [(x-a_l).abs +  (a_l - b_1_l).abs, (x-a_l).abs + (a_l - b_1_h).abs, (x-a_h).abs + (a_h - b_2_l).abs, (x-a_h).abs + (a_h - b_2_h).abs, (x-b_l).abs +  (b_l - a_1_l).abs, (x-b_l).abs + (b_l - a_1_h).abs, (x-b_h).abs + (b_h - a_2_l).abs, (x-b_h).abs + (b_h - a_2_h).abs ].min
}


Measured memory_bytes: 5684
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[8]={-1,0,1,0,-1,-1,1,1},dy[8]={0,1,0,-1,-1,1,1,-1};
typedef pair<ll,ll> P;

void Main() {
  string s;
  R s;
  ll c[2][2222];
  mem(c);
  ll ans=0;
  rep(i,s.size()) {
    int t=(i+1)%2,r=i%2;
    c[r][0]++;
    rep(j,2019) {
      int x=j*10+s[i]-'0';
      c[t][x%2019]+=c[r][j];
    }
    ans+=c[t][0];
    mem(c[r]);
  }
  pr(ans);
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


Measured memory_bytes: 3784
#include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>
using namespace std;

int64_t total_cake_quality(vector<int64_t> const& cake, int mask)
{
    int64_t result = 0;
    for (int i = 0; i < 3; ++i) {
        if ((mask >> i) & 1) {
            result += -cake[i];
        } else {
            result += +cake[i];
        }
    }
    return result;
}

int main()
{
    int n, m;
    cin >> n >> m;
    vector<vector<int64_t>> cakes(n, vector<int64_t>(3));
    for (int i = 0; i < n; ++i) {
        cin >> cakes[i][0] >> cakes[i][1] >> cakes[i][2];
    }
    vector<int> idx(n);
    int64_t result = 0;
    iota(idx.begin(), idx.end(), 0);
    for (int mask = 0; mask < (1 << 3); ++mask) {
        sort(idx.begin(), idx.end(), [&cakes, mask](int i1, int i2) {
            return total_cake_quality(cakes[i1], mask) > total_cake_quality(cakes[i2], mask);
        });
        int64_t res = 0;
        for (int i = 0; i < m; ++i) {
            for (int j = 0; j < 3; ++j) {
                res += ((mask >> j) & 1 ? -1 : +1) * cakes[idx[i]][j];
            }
        }
        result = max(result, res);
    }
    cout << result << endl;
}


Measured memory_bytes: 256
from math import factorial

n,k = map(int,input().split())
mod = 10**9+7

def combinations_count(n, r):
    return factorial(n) // (factorial(n - r) * factorial(r))#組み合わせ

for i in range(1,k+1):
    if n-k < i-1:
        print(0)
    else:
        iti = combinations_count(k-1,i-1)
        ni = combinations_count(n-k+1,i)
        iti%=mod;ni%=mod
        print(iti*ni%mod)

Measured memory_bytes: 3316
while True:
    H,W=input().split()
    H,W=[int(H),int(W)]
    if H==0 and W==0:
        break
    for i in range (0,H):
        if i==0 or i==H-1:
            a=""
            for j in range(0,W):
                a=a+"#"
            print (a)
        else :
            a=""
            for j in range(0,W):
                if j==0 or j==W-1:
                    a=a+"#"
                else :
                    a=a+"."
            print (a)
    print()


Measured memory_bytes: 5616
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <fstream>
#include <numeric>
using namespace std;
typedef long long int ll;

#define EPS (1e-7)
#define INF 1e18
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define PI (acos(-1))

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define rep(i, init, n) for(int i = init; i <(int)(n); i++)

int main() {

    ll N, M;
    cin >> N >> M;
    ll ans = 100 * (N - M) + 1900 * M;
    ll tmp = pow(2, M);
    ans *= tmp;
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

const (
	initialBufSize = 10000
	maxBufSize     = 1000000
	mod            = 1e9 + 7
)

var (
	sc *bufio.Scanner = func() *bufio.Scanner {
		sc := bufio.NewScanner(os.Stdin)
		buf := make([]byte, initialBufSize)
		sc.Buffer(buf, maxBufSize)
		sc.Split(bufio.ScanWords)
		return sc
	}()
)

func main() {
	N := getInt()
	A := make([]int, N)
	for i := 0; i < N; i++ {
		A[i] = getInt()
	}

	result := "YES"
	hash := make(map[int]int)
	for i := 0; i < N; i++ {
		hash[A[i]]++
		if hash[A[i]] != 1 {
			result = "NO"
			break
		}
	}

	fmt.Println(result)
}

type Graph struct {
	n     int
	edges [][]int
}

func NewGraph(n int) *Graph {
	g := &Graph{
		n:     n,
		edges: make([][]int, n),
	}
	return g
}

func (g *Graph) AddEdge(u, v int) {
	g.edges[v] = append(g.edges[v], u)
	g.edges[u] = append(g.edges[u], v)
}

func dfs(c int, edges [][]int, visited map[int]struct{}) {
	visited[c] = struct{}{}

	for _, v := range edges[c] {
		_, flag := visited[v]
		if flag {
			continue
		}
		dfs(v, edges, visited)
	}
}

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

func abs(a int) int {
	return int(math.Abs(float64(a)))
}

func pow(p, q int) int {
	return int(math.Pow(float64(p), float64(q)))
}

func powMod(n, p int) int {
	if p == 0 {
		return 1
	} else if p%2 == 0 {
		t := powMod(n, p/2)
		return calcMod(t * t)
	} else {
		return n * powMod(n, p-1)
	}
}

func min(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton min() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Min(float64(res), float64(nums[i])))
	}
	return res
}

func max(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton max() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Max(float64(res), float64(nums[i])))
	}
	return res
}

func strSearch(a []string, b string) bool {
	for i := 0; i < len(a); i++ {
		if a[i] == b {
			return true
		}
	}
	return false
}

func printIntArray(array []int) {
	strArray := fmt.Sprint(array)
	fmt.Println(strArray[1 : len(strArray)-1])
}

func calcMod(x int) int {
	return x % mod
}

func reverse(s string) string {
	runes := []rune(s)
	for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
		runes[i], runes[j] = runes[j], runes[i]
	}
	return string(runes)
}


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

int main(){
  
  int n;
  cin >> n;
  vector<int> p(n);
  int sum=0;
  for(int i=0; i<n; i++){
    cin >> p[i];
    sum+= p[i];
  }
  sort(p.begin(),p.end());
  sum-=(p[n-1]/2);
  
	cout << sum << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>


void swap (int *x, int *y) {
  int temp;

  temp = *x;
  *x = *y;
  *y = temp;

  return;
}

int gcd(int a,int b){
  if(a<b){
    swap(&a,&b);
  }

  if(b==0){
    return a;
  }

  int r=a%b;
  while(r!=0){
    a = b;
    b = r;
    r = (a%b);
  }

  return b;
}

/* クイックソート */
int dn(const void*a,const void*b){return*(int*)b-*(int*)a;}


int modpow(int a,int n,int mod){
  int ans=1;
  while(n>0){
    if(n & 1){
      ans=ans*a%mod;
    }
    a=a*a%mod;
    n/=2;
  }
  return ans;
}

int max(int a,int b){
  if(a<b){
    return b;
  }
  else{
    return a;
  }
}

int min(int a,int b){
  if(a<b){
    return a;
  }
  else{
    return b;
  }
}

void chmax(int *a,int b){
  if(*a < b){
    *a = b;
  }

  return;
}

void chmin(int *a,int b){
  if(*a > b){
    *a =b;
  }

  return;
}

/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/

int main(void){
  int x;
  scanf("%d",&x);

  if(x>=30){
    printf("Yes\n");
  }
  else{
    printf("No\n");
  }

  return 0;
}

Measured memory_bytes: 1660
N = int(input())
damu = list(map(int, input().split()))


x = 0
for i in range(N):
    if i % 2 == 0:
        x += damu[i]
    else:
        x -= damu[i]

x = x // 2

ans = []
maeno_x = 0
for i in range(N):
    if i == 0:
        ans.append(2*x)
    else:
        x = damu[i-1] - maeno_x
        ans.append(2*x)
    maeno_x = x

print(" ".join([str(i) for i in ans]))


Measured memory_bytes: 19144
#include <iostream>
#define int long long

using namespace std;

signed main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  string s;
  cin >> s;

  int i,c0=0,c1=0;
  for (i = 0; i < s.length(); i++) {
    if (s[i] == '0') {
      c0++;
    } else {
      c1++;
    }
  }
  
  if (c0 == 0 || c1 == 0) {
    cout << 0 << "\n";
  } else {
    cout << min(c0,c1) * 2 << "\n";
  }

  return 0;
}


Measured memory_bytes: 512
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;

public class Main {
	private static final Integer[] primeNumberArray = getPrimeNumberArray(110000);
	private static final int[] ansArray = getAnsArray(50000);

	public static void main(String[] args) throws IOException {
		try (BufferedReader input = new BufferedReader(new InputStreamReader(System.in))) {
			while (input.ready()) {
				final int dataset = Integer.valueOf(input.readLine());
				if (dataset == 0)
					break;
				System.out.println(ansArray[dataset]);
			}
		}
	}

	private static int[] getAnsArray(final int maxNumber) {
		int ansArray[] = new int[maxNumber + 1];
		int tmp = 0;
		for (int i = 0; i < primeNumberArray.length; i++) {
			for (int j = i; j < primeNumberArray.length / 2; j++) {
				tmp = primeNumberArray[i] + primeNumberArray[j];
				if (tmp > maxNumber) {
					break;
				}
				ansArray[tmp]++;
			}
		}
		return ansArray;
	}

	public static Integer[] getPrimeNumberArray(final int maxNumber) {
		ArrayList<Integer> primeNumberList = new ArrayList<>();
		primeNumberList.add(2);
		primeNumberList.add(3);
		primeNumberList.add(5);
		primeNumberList.add(7);

		final int[] oneDigitList = { 1, 3, 7, 9 };

		int tmp;
		int sqrtTmp;
		boolean addFlag;
		for (int i = 10; i <= maxNumber; i += 10) {
			for (int oneDigit : oneDigitList) {
				addFlag = true;
				tmp = i + oneDigit;
				sqrtTmp = (int) Math.sqrt(tmp);
				for (int primeNumber : primeNumberList) {
					if (tmp % primeNumber == 0) {
						addFlag = false;
						break;
					}
					if (sqrtTmp < primeNumber) {
						break;
					}
				}
				if (addFlag) {
					primeNumberList.add(tmp);
				}
			}
		}

		return primeNumberList.toArray(new Integer[0]);
	}
}

Measured memory_bytes: 33688
#include"bits/stdc++.h"
using namespace std;
typedef long long ll;
#define int ll 
int cost(int i,int j, int x, int y)
{return abs(i-x)+abs(j-y);}
#define x first
#define y second
int ans[90001];
pair<int,int> pos[90001];
int32_t main()
{
	
	#ifndef ONLINE_JUDGE
	freopen("in","r",stdin);
	freopen("out","w",stdout);
	#endif

	int n,m,D;
	cin>>n>>m>>D;int u;
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<m;j++)
			{cin>>u;pos[u]={i,j};}
	}
	for(int i=D+1;i<=n*m;i++)
	{
		ans[i]=ans[i-D]+cost(pos[i].x, pos[i].y, pos[i-D].x, pos[i-D].y);
	}
	int q;
	cin>>q;
	while(q--)
	{
		int l,r;
		cin>>l>>r;
		cout<<ans[r]-ans[l]<<"\n";
	}



	

}

Measured memory_bytes: 5720