akhauriyash/Code-Regression huggingface dataset:
import sys
# import math, string, itertools, fractions, heapq, collections, re, array, bisect, copy, functools, random
# from collections import deque, defaultdict, Counter; from heapq import heappush, heappop
# from itertools import permutations, combinations, product, accumulate, groupby
# from bisect import bisect_left, bisect_right, insort_left, insort_right
# from operator import itemgetter as ig
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20; INF = float("INF"); ans = 0; tmp = 0; ansli = []; tmpli = []; candili = []; mod = 10 ** 9 + 7
# dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]; ddn = dd + [(-1, 1), (1, 1), (1, -1), (-1, -1)]; ddn9 = ddn + [(0, 0)]
"""for dx, dy in dd:
        nx = j + dx; ny = i + dy
            if 0 <= nx < w and 0 <= ny < h:"""
def wi(): return list(map(int, sys.stdin.readline().split()))
def wip(): return [int(x) - 1 for x in sys.stdin.readline().split()]#WideIntPoint
def ws(): return sys.stdin.readline().split()
def i(): return int(sys.stdin.readline())
def s(): return input()
def hi(n): return [i() for _ in range(n)]
def hs(n): return [s() for _ in range(n)]#HeightString
def mi(n): return [wi() for _ in range(n)]#MatrixInt
def mip(n): return [wip() for _ in range(n)]
def ms(n): return [ws() for _ in range(n)]

n = i()
a = wi()

value = [] # ノードの値を持つ配列
N = 0 # 葉の数

def gcd(a,b):
    if b == 0:
        return a
    return gcd(b, a % b)

def update(i, x):
    # i番目の葉の値をxに変える
    i += N - 1  # i番目の葉のノード番号
    value[i] = x
    while i > 0:
        i = (i - 1) / 2  # ノード i の親ノードの番号に変える
        value[i] = min(value[i * 2 + 1], value[i * 2 + 2])  # 左右の子の min を計算しなおす


#define INF 2147483647 // 2^31-1
INF = float("INF")
def query(a, b, k, l, r) :
    # [a, b) の区間に対するクエリについて
    # ノード k （区間 [l, r) 担当）が答える
    if r <= a or b <= l:
        # 区間が被らない場合は INF を返す
        return 0
    if a <= l and r <= b:
        # ノード k の担当範囲がクエリ区間 [a, b) に完全に含まれる
        return value[k]
    else:
        # 一部だけ範囲が被る場合は左右の子に委託する
        c1 = query(a, b, 2 * k + 1, l, (l + r) // 2)  # 左の子に値を聞く
        c2 = query(a, b, 2 * k + 2, (l + r) // 2, r)  # 右の子に値を聞く
        # 左右の子の値の min を取る
        return gcd(c1, c2)



value = [] # ノードの値を持つ配列
N = 0 # 葉の数

if __name__ == '__main__':
    N = 1
    while N < n:
        N *= 2  # 葉の数を計算（n以上の最小の2冪数）

    value = [0] * (2 * N - 1)
    for i in reversed(range(2 * N - 1)):
        if N - 1 <= i < 2 * N - 1:
            if N - 1 <= i < N - 1 + n:
                value[i] = a[i - (N - 1)]
            else:
                value[i] = 0
        else:
            value[i] = gcd(value[2 * i + 1], value[2 * i + 2])

    for i in range(n):#query(,,0,0,N)
        if i == 0:
            ansli.append(query(1, n, 0, 0, N))
        elif i == n - 1:
            ansli.append(query(0, n - 1, 0, 0, N))
        else:
            ansli.append(gcd(query(0, i, 0, 0, N), query(i + 1, n, 0, 0, N)))
print(max(ansli))

Measured memory_bytes: 119404
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using uint = unsigned int;
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include"rprint2.hpp"
#else
#define FUNC(name) template <ostream& out = cout, class... T> void name(T&&...){ }
FUNC(prints) FUNC(printe) FUNC(printw) FUNC(printew) FUNC(printb) FUNC(printd); FUNC(printde);
#endif

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int h, w, d;
    cin >> h >> w >> d;
    vector<vector<char>> cs(h, vector<char> (w, 'x'));
    if(d & 1){
        for(int i = 0; i < h; i++){
            for(int j = 0; j < w; j++){
                cs[i][j] = (i + j) % 2 ? 'R' : 'Y';
            }
        }
    }else{
        auto f = [&](int y, int x, char c){
            if(0 <= y && y < h && 0 <= x && x < w){
                cs[y][x] = c;
            }
        };
        char colors1[] = {'R', 'Y'};
        char colors2[] = {'G', 'B'};
        for(int y = - d / 2; y < h + d; y += d){
            for(int x = d / 2; x < w + d; x += d){
                // char c = colors[(y / d % 2 * 2 + x / d % 2 + 2) % 4];
                // char c = colors[((y + d) / d % 2 * 2 + (x + d) / d % 2) % 4];
                char c = colors1[((y + d / 2) / d + (x + d / 2) / d) % 2];
                for(int i = 0; i < d; i++){
                    int width = min(i, d - i - 1);
                    for(int j = - width; j <= width; j++){
                        if(i + abs(j) > d){ continue; }
                        f(y + i, x + j, c);
                    }
                }
            }
        }
        for(int y = 0; y < h + d; y += d){
            for(int x = 0; x < w + d; x += d){
                // char c = colors[y / d % 2 * 2 + x / d % 2];
                char c = colors2[(y / d + x / d) % 2];
                for(int i = 0; i < d; i++){
                    int width = min(i, d - i - 1);
                    for(int j = - width; j <= width; j++){
                        if(i + abs(j) > d){ continue; }
                        f(y + i, x + j, c);
                    }
                }
            }
        }
    }
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            cout << cs[i][j];
        }
        cout << '\n';
    }
    // queue<pair<int, int>> q;
    // q.emplace(0, 0);
    // while(q.size()){
    //     auto e = q.front(); q.pop();
    //     if(visited.count(e)){ continue; }
    //     visited.insert(e);
    // }
    // int wid, len = 2 * (wid - 1);
}


Measured memory_bytes: 768
import sys
import numpy as np
input = sys.stdin.readline

D = int(input())
C = np.array(list(map(int,input().split())),dtype=np.int)
S = np.array([list(map(int,input().split())) for i in range(D)],dtype=np.int)

sumC = sum(C)
def score(strategy):
    sat = 0
    last = np.zeros(26).astype(np.int)
    for i,ind in enumerate(strategy):
        last += 1
        last[ind] = 0
        sat -= np.sum(C * last)
        sat += S[i][ind]
    return sat

#first = [np.argmax(ds) for ds in S]
first = [i % 26 for i in range(D)]

ans = first
now_score = score(ans)

for i in range(1):
    samples = np.random.randint(0,26,size=D).tolist()
    for d in range(D):
        temp = ans[:]
        temp[d] = samples[d]
        if score(temp) > now_score:
            ans = temp

for a in ans:
    print(a+1)



Measured memory_bytes: 27536
from functools import reduce

if __name__ == "__main__":
    n = int(input())
    a = [int(x) for x in input().split()]
    x = [0]*n
    """if n % 2 == 0:
        for i in a:
            if i % 2 != 1:
                print(0)
                exit()
    else:
        for i in a:
            if i % 2 != 0:
                print(0)
                exit()"""
    for i in a:
        if i == 0 and x[i] == 1:
            print(0)
            exit()
        elif x[i] == 2:
            print(0)
            exit()
        else:
            x[i] += 1
    print(reduce(lambda x, y: x * y if y != 0 else x, x, 1) % (10 ** 9 + 7))

Measured memory_bytes: 14308
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
#define rep(i,x) for(ll i = 0; i < (ll)(x); i++)
#define pb push_back
#define eb emplace_back
#define debug(x) cerr << #x << ": " << (x) << "\n";
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<ll>>> vvvl;
const ll INF = numeric_limits<ll>::max()/4;
const int n_max = 1e5+10;

int main(){
    ll s; cin >> s;
    ll ans;
    bitset<1100000> bs(0);
    ll cnt = 1;
    while(bs[s] == 0){
        bs[s] = 1;
        if(s % 2 == 0)s /= 2;
        else s = s*3 + 1;
        cnt++;
    }

    cout << cnt << endl;

}

Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main() {
    int a, b, cnt = 0;
    cin >> a >> b;
    for (int i = a; i <= b; ++i) {
        string s = to_string(i);
        reverse(s.begin(), s.end());
        if (s == to_string(i)) ++cnt;
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 256
# coding: utf-8
# Your code here!
x=int(input())
dp=[False for i in range(x+1)]
dp[0]=True

for i in range(x+1):
    if i+105<=x:
        if dp[i]:
            dp[i+105]=True
    if i+104<=x:
        if dp[i]:
            dp[i+104]=True
    if i+103<=x:
        if dp[i]:
            dp[i+103]=True
    if i+102<=x:
        if dp[i]:
            dp[i+102]=True
    if i+101<=x:
        if dp[i]:
            dp[i+101]=True
    if i+100<=x:
        if dp[i]:
            dp[i+100]=True

if dp[x]:
    print(1)
else:
    print(0)


Measured memory_bytes: 3864
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<numeric>
#include<utility>

using namespace std;

typedef long long int ll;
const int INF = 1<<30;
const long long LINF = 1LL<<60;

int main(){
    int n, ans = 0;
    cin >> n;
    for(int i = 1; i <= 500000; i++){
        if((int)(i * 1.08) == n){
            ans = i;
            break;
        }
    }
    if(ans > 0){
        cout << ans << endl;
    }else{
        cout << ":(" << endl;
    }
    return 0;
}


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

int main(){
    int n,a=0;
    cin>>n;
    string s;
    for(int i=0;i<n;i++)
    cin>>s[i];
    for(int i=0;i<n-2;i++){
    if(s[i]=='A'){
        if(s[i+1]=='B'){
            if(s[i+2]=='C'){
                a+=1;
            }
        }
    }
    }
    cout<<a<<endl;
    return 0;    
}

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

#define mod 1000000007
using ll = long long;

int main(){

  int n,k;
  cin >> n >> k;

  if(n==k){
    ll ans=1;
    ll num;
    for(int i=0;i<n;i++){
      cin >> num;
      ans=ans*num%mod;
    }
    cout << (ans+mod)%mod;
    return 0;
  }

  priority_queue<ll> pos;
  priority_queue<ll> neg;
  ll num;
  for(int i=0;i<n;i++){
    cin >> num;
    if(num>=0){
      pos.push(num);
    }else{
      neg.push(-num);
    }
  }

  if(k%2==1 && pos.size()==0){
    ll ans=1;
    ll num;
    for(int i=0;i<n;i++){
      num=-neg.top();
      neg.pop();
      if(i>=n-k){
        num=num%mod;
        ans=ans*num%mod;
      }
    }
    cout << (ans+mod)%mod << endl;
    return 0;
  }

  ll posnum=1;
  ll negnum=1;
  bool posErase=1;
  bool negErase=1;
  ll ans=1;
  int i=0;
  if(k%2==1){
    ans=pos.top();
    pos.pop();
    i++;
  }
  while(1){
    if(i==k){
      cout << (ans+mod)%mod << endl;
      return 0;
    }
    if(pos.size()>=2 && posErase==1){
      posnum=pos.top();
      pos.pop();
      posnum=posnum*pos.top();
      pos.pop();
      posErase=0;
    }

    if(neg.size()>=2 && negErase==1){
      negnum=neg.top();
      neg.pop();
      negnum=negnum*neg.top();
      neg.pop();
      negErase=0;
    }

    if(posnum>=negnum){
      posErase=1;
      //posnum=posnum%mod;
      ans=ans%mod*(posnum%mod)%mod;
      posnum=0;
    }else{
      negErase=1;
      //negnum=negnum%mod;
      ans=ans%mod*(negnum%mod)%mod;
      negnum=0;
    }
    i+=2;
  }

}

Measured memory_bytes: 5524
#include <bits/stdc++.h>
#define sz(arr) (int)arr.size()
#define all(arr) arr.begin(), arr.end()

using namespace std;
typedef long long ll;

void _cin() {}
template <class Head, class... Tail>
void _cin(Head&& head, Tail&&... tail) {
  cin >> head;
  _cin(forward<Tail>(tail)...);
}

#define Cin(T, ...) \
  T __VA_ARGS__;    \
  _cin(__VA_ARGS__)

int main() {
  Cin(string, o, e);

  for (int i = 0; i < sz(e); ++i) {
    cout << o[i] << e[i];
  }
  if (sz(o) - sz(e)) cout << o[sz(o) - 1];
  cout << endl;

  return 0;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int,input().split()))

tot = 0
sqr = 0
ind = 0
for i in range(n):
  tot += a[i]

sqr = tot*tot
for i in range(n):
  ind += a[i]*a[i]

print(((sqr-ind)//2)%1000000007)

Measured memory_bytes: 31696
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vpii = vector<pii>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvpii = vector<vpii>;
template<typename A> using fn = function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr bool even(const int &n) { return !odd(n); }
void solve();
main { solve(); return 0; }
// clang-format on

template<typename M>
void warshallFloyd(M &m, const int &n) {
  rep(k, n) rep(i, n) rep(j, n) cmin(m[i][j], m[i][k] + m[k][j]);
}

void solve() {
  int n;
  while (cin >> n, n) {
    vvi t(n, vi(n));
    int m;
    cin >> m;
    rep(i, n) rep(j, n) t[i][j] = i == j ? 0 : INF;
    while (m--) {
      int a, b;
      cin >> a >> b;
      a--, b--;
      t[a][b] = t[b][a] = 1;
    }
    warshallFloyd(t, n);
    int s = 0;
    rep(i, n) s += 1 <= t[0][i] && t[0][i] <= 2;
    cout << s << endl;
  }
}

Measured memory_bytes: 4828
S = input() 
is_yymm = 1 <= int(S[2:]) <= 12
is_mmyy = 1 <= int(S[:2]) <= 12

if is_mmyy and is_yymm:
    print('AMBIGUOUS') 
elif is_yymm:
    print('YYMM')
elif is_mmyy:
    print('MMYY')
else:
    print('NA')


Measured memory_bytes: 38384
// 2012/11/19 Tazoe

#include <iostream>
#include <algorithm>
using namespace std;

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

	int K;
	cin >> K;

	for(int i=0; i<K; i++){
		int a, b;
		cin >> a >> b;

		int d_min = min(min(a-1, N-a), min(b-1, N-b));

		int c = d_min%3+1;

		cout << c << '\n';
	}

	return 0;
}

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

typedef long long ll;

ll X, K, D;
ll solve() {
  X = abs(X);
  ll a = X / D;
  if (K <= a) return X - K * D;
  K -= a;
  X -= a * D;
  K %= 2;
  if (K == 1) X -= D;
  return abs(X);
}
int main() {
  cin >> X >> K >> D;
  cout << solve() << endl;
  return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#include <boost/range/irange.hpp>
#include <boost/range/algorithm.hpp>
using namespace std;
using namespace boost::range;
using boost::irange;

using ll = int64_t;
constexpr char LN = '\n';
template<class T> bool chmax(T& a, const T& b) {if(a<b){a=b;return true;}else{return false;}}
template<class T> bool chmin(T& a, const T& b) {if(b<a){a=b;return true;}else{return false;}}

#ifdef LOCAL
template<class H> void dump_(const char* s, H h) {cout<<s<<"="<<h<<LN; }
template<class H, class... T> void dump_(const char* s, H h, T... t) {for(;*s!=',';++s){cout<<*s;}cout<<"="<<h<<",";dump_(++s,t...);}
#define dump(...) dump_(#__VA_ARGS__, __VA_ARGS__)
#else
#define dump(...)
#endif

struct init_ {init_(){ 
    cin.tie(nullptr); ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
}} init_;

template<class C> C scan(size_t n) {C c(n);for(auto& v:c){cin>>v;}return c;}
template<class C> C scan(size_t n, size_t m) {C vss(n);for(auto& vs:vss){vs.resize(m);for(auto& v:vs){cin>>v;}}return vss;}

template<class R> struct Joined { const R& r; const char* s; };
template<class R> Joined<R> joined(const R& r, const char* s = " ") {return{r,s};}
template<class R> ostream& operator<<(ostream& out, Joined<R> j) {bool f=true;for(const auto& v:j.r){if(f){f=false;}else{out<<j.s;}out<<v;}return out;}

template<class T> using matrix = vector<vector<T>>;
template<class T> matrix<T> make_matrix(size_t n, size_t m, const T& init = T()) {matrix<T> vss(n);for(auto& vs:vss){vs.resize(m,init);}return vss;}
template<class T> ostream& operator<<(ostream& out, Joined<matrix<T>> j) {bool a=true;for(const auto& vs:j.r){if(a){a=false;}else{out<<LN;}bool f=true;for(const auto& v:vs){if(f){f=false;}else{out<<j.s;}out << v;}}return out;}

int main() {
    int K, X;
    cin >> K >> X;
    cout << (500 * K >= X ? "Yes" : "No") << LN;
}


Measured memory_bytes: 256
n = int(raw_input())
A = map(int, raw_input().split())

def calc(A):
    cnt = 0
    s = 0
    sig = -1
    for a in A:
        s += a
        if sig * s < 1:
            cnt += abs(sig - s)
            s = sig
        sig *= -1
    return cnt

v1 = calc(A)
v2 = calc(map(lambda n: -n, A))
print min(v1, v2)


Measured memory_bytes: 11248
import sys
from collections import deque
import numpy as np
stdin = sys.stdin
mod = 10**9 + 7

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
sa = lambda h: [list(map(int, stdin.readline().split())) for i in range(h)]
h, w = na()
g = [[1]*(w+2)]
for _ in range(h):
    g += [[1] + [1 if s=="#" else 0 for s in ns()] +[1]]
g += [[1]*(w+2)]
inf = 10**9
def bfs(sx, sy):
    dist = [[inf]*(w+2) for _ in range(h+2)] 
    dist[sx][sy] = 0
    que = deque([[sx, sy]])
    used = set([(sx, sy)])
    while que:
        x, y = que.popleft()
        for i, j in [(1, 0), (0, 1), (-1, 0), (0, -1)]:
            nx, ny = x+i, y+j
            if (nx, ny) in used:
                continue
            used.add((nx, ny))
            if g[nx][ny]==0:
                dist[nx][ny] = dist[x][y] + 1
                que.append([nx, ny])
    res = 0
    for i in range(h+2):
        for j in range(w+2):
            if g[i][j] == 1:
                dist[i][j] = 0
    return dist


ans = 0
for sx in range(1,h+1):
    for sy in range(1, w+1):
        if g[sx][sy]==0:
            #print(bfs(sx, sy))
            res = np.max(np.array(bfs(sx, sy)))
            ans = max(ans, res)
print(ans)

Measured memory_bytes: 21008
import sys
from collections import Counter
input = sys.stdin.readline

n,m = map(int,input().split())
a = []
b = []
for i in range(n):
    a.append(tuple(map(lambda x:int(x)-1,input().split())))
    b.append(a[i][0])

used = [False]*m
idx = [0]*n

res = n
for i in range(m-1):
    ctr = Counter(b)
    d = ctr.most_common()
    p,num = d[0]
    res = min(res,num)
    used[p] = True

    for j in range(n):
        while used[a[j][idx[j]]]:
            idx[j] = idx[j] + 1
        b[j] = a[j][idx[j]]

print(res)



Measured memory_bytes: 4588
#include <iostream>
#include <algorithm>
#include <vector>
#include <numeric>
#include <ctime>
#include <cmath>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;

#define sz(x) (int)(x.size())

typedef long long ll;
typedef tuple<int, int, int> tri;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<pi> vpi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vb> vvb;
typedef vector<vll> vvll;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef __gnu_pbds::tree<
    int,
    __gnu_pbds::null_type,
    less<int>,
    __gnu_pbds::rb_tree_tag,
    __gnu_pbds::tree_order_statistics_node_update>
    ordered_set;

const ll MODULO = 1000000007;

void ftime()
{
#ifndef ONLINE_JUDGE
    cout << "\nTime: " << 1.0 * clock() / CLOCKS_PER_SEC << "s\n";
#endif
}

static int speed_increase = []() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(NULL);
    return 0;
}();
vvll mat;
vector<vvll> dp;
int r, c, k;

ll fdp(int i, int j, int k)
{
    if (dp[i][j][k] != -1)
        return dp[i][j][k];
    if (i == r && j == c)
        return dp[i][j][k] = (k != 3) * mat[i][j];
    ll val = 0;
    if (i + 1 <= r)
    { // take value if possible while going down
        val = max(val,
                  (k != 3) * mat[i][j] + fdp(i + 1, j, 0));
    }
    if (j + 1 <= c)
    {
        val = max(val,
                  (k != 3) * mat[i][j] + fdp(i, j + 1, k + (k != 3)));
        val = max(val, fdp(i, j+1, k));
    }
    return dp[i][j][k] = val;
}

void solve()
{
    cin >> r >> c >> k;
    mat.resize(r + 1, vll(c + 1, 0));
    for (int i = 0; i < k; ++i)
    {
        int x, y, v;
        cin >> x >> y >> v;
        mat[x][y] = v;
    }
    dp.resize(r + 1, vvll(c + 1, vll(4, -1)));
    cout<<fdp(1, 1, 0);
}

int main()
{
    solve();
    // ftime();
    return 0;
}

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

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

    int n;
    cin>>n;

    for(int i=n;i>=0;i--)
    {
        int x=i*1.08;
        if(x==n)
        {
            cout<<i<<"\n";
            break;
        }
        else if(x<n)
        {
            cout<<":(\n";
            break;
        }
    }

    return 0;
}


Measured memory_bytes: 3692
#include <bits/stdc++.h>
using namespace std;
#define int long  long
#define N 100010
struct node{
	int x,id;
	bool operator<(const node &a) const{
		return x>a.x;
	}
}D[N];
int sz[N],fa[N];
map<int,int>mp;
signed main(){
	int n;
	scanf("%lld",&n);
	for (int i=1;i<=n;i++){
		scanf("%lld",&D[i].x);
		D[i].id=i;
		mp[D[i].x]=i;
	}
	sort(D+1,D+1+n);
	for (int i=1;i<=n;i++) sz[i]=1;
	for (int i=1;i<n;i++){
		int x=D[i].id;
		fa[x]=mp[D[i].x-n+2*sz[x]];
		if (!fa[x])  return puts("-1"),0;
		sz[fa[x]]+=sz[x];
	}
	for (int i=1;i<n;i++) D[n].x-=sz[D[i].id];
	if (D[n].x) return puts("-1"),0;
	for (int i=1;i<n;i++) printf("%lld %lld\n",fa[D[i].id],D[i].id);
	return 0;
}
	

Measured memory_bytes: 10752
import java.util.Scanner;

public class Main
{
    public static int N;
    public static int[] List=new int[100];
    public static int Count=0;
    public static int flag=0;


    public  static void main(String[] args)
    {
        Scanner scan=new Scanner(System.in);
        N=scan.nextInt();

        for(int k=0;k<N;k++)
        {
            List[k]=scan.nextInt();
        }

        for(int k=0;k<N;k++)
        {
            BubbleSort(k);
        }

        for(int n=0;n<N;n++)
        {
            if(n!=N-1)
                System.out.print(List[n]+" ");
            if(n==N-1)
                System.out.println(List[n]);
        }
        System.out.println(Count);

    }

    public static void BubbleSort(int j)
    {
            for(int k=N-1;k>=1;k--)
            {
                flag=0;
                if(List[k]<List[k-1])
                {
                    int tmp=List[k];
                    List[k]=List[k-1];
                    List[k-1]=tmp;
                    flag=1;
                }
                if(flag==1) Count++;
            }
    }
}

Measured memory_bytes: 26332
#include <stdio.h>
using namespace std;
int main(void){

int n,b,f,r,v;
    scanf("%d",&n);
   int a[4][3][10]= {{{0,0,},},};
   
   while(n>0){
       
       scanf("%d%d%d%d",&b,&f,&r,&v);
       a[b-1][f-1][r-1]=a[b-1][f-1][r-1]+v;
       n=n-1;
   }
   b=0;f=0;r=0;n=0;

while(b<4){

   while(f<3){
   
     while(r<10){
       printf(" %d",a[b][f][r]);
        r=r+1;
   }
     printf("\n");
   f=f+1;r=0;
   }
 
            if(b<3){
                    printf("####################\n");
                }
                b=b+1;
                f=0;
            }
} 





Measured memory_bytes: 2724
#include <bits/stdc++.h>
#define rep(i,n) for (double i = 0; i < n; ++i)
using namespace std;
typedef long long ll;
typedef pair<double,double> P;
const int INF=1001001001;


// Morris-Pratt
template<typename T>
struct MP {
  int n;
  T t;
  vector<int> a;
  MP() {}
  MP(const T& t): t(t) {
    n = t.size();
    a = vector<int>(n+1);//便宜上最初に-1を入れるため（1 indexにした方が良い)
    a[0] = -1;
    int j = -1;
    for (int i = 0; i < n; ++i) {
      while (j != -1 && t[j] != t[i]) j = a[j];//次の文字が一致するようなaを見つける
      j++;
      a[i+1] = j;
    }
  }
  int operator[](int i) { return a[i];}//添字アクセスできるように
  vector<int> findAll(const T& s) {
    vector<int> res;
    int j = 0;
    for (int i = 0; i < s.size(); ++i) {
      while (j != -1 && t[j] != s[i]) j = a[j];
      j++;
      if (j == n) {
        res.push_back(i-j+1);
        j = a[j];
      }
    }
    return res;
  }
};


int main(){
  int n;
  cin>>n;
  vector<int> a(n);
  vector<int> b(n);
  vector<int> a1(n);
  vector<int> b1(n);

  rep(i,n)cin>>a[i];
  rep(i,n)cin>>b[i];
  rep(i,n-1){
    a1[i+1]=a[i]^a[i+1];
  }
  rep(i,n-1){
    b1[i+1]=b[i]^b[i+1];
  }
  a1[0]=a[0]^a[n-1];
  b1[0]=b[0]^b[n-1];

  vector<int> A=a1;
  A.insert(A.end(), A.begin(), A.end());
//  rep(i,A.size())cout<<A[i];
  MP <vector<int>> mp(b1);


  vector<int> res=mp.findAll(A);
  rep(i,res.size()){
    if (res[i]>=n)continue;
    int now=res[i];
    int x=b[0]^a[now];
    cout<<res[i]<<" "<<x<<endl;
  }

}


Measured memory_bytes: 11504
def slove():
    import sys
    input = sys.stdin.readline
    n = int(input().rstrip('\n'))
    s = str(input().rstrip('\n'))
    cnt= 0
    for i in range(1, n):
        if s[i] != s[i-1]:
            cnt += 1
    print(cnt + 1)


if __name__ == '__main__':
    slove()


Measured memory_bytes: 39920
#include <bits/stdc++.h>
typedef long long ll;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)
	
using namespace std;

const int MAX_N=1e5;

int N,M;
vector<int> G[MAX_N];
bool used[MAX_N];

int main(){
	cin>>N>>M;
	REP(i,M){
		int a,b;
		cin>>a>>b;
		a--;
		b--;
		G[a].push_back(b);
		G[b].push_back(a);
	}
	deque<int> ans;
	ans.push_back(0);
	ans.push_back(G[0][0]);
	used[0]=used[G[0][0]]=true;
	while(1){
		int u=ans.front(),v=ans.back();
		bool f=true,f2;
		int w=0;
		for(auto i:G[u]){
			if (!used[i]){
				f=false;
				f2=true;
				w=i;
				break;
			}
		}
		for(auto i:G[v]){
			if (!used[i]){
				f=false;
				f2=false;
				w=i;
				break;
			}
		}
		if (f)
			break;
		if (f2){
			ans.push_front(w);
		}else{
			ans.push_back(w);
		}
		used[w]=true;
	}
	cout<<ans.size()<<endl;
	for(auto i:ans){
		if (i!=ans.front()){
			cout<<" ";
		}
		cout<<i+1;
	}
	cout<<endl;
	return 0;
}

Measured memory_bytes: 6784
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define erep(i,a,b) for(int i=a;i<=(int)(b);++i)
#define per(i,a,b) for(int i=(b);i>(a);--i)
#define eper(i,a,b) for(int i=((int)(a));i>=b;--i)
#define pb push_back
#define mp make_pair
#define INF (1<<28)-1
#define MOD 1000000007
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a, b)*b;}

int n, y;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
    cin >> n >> y;
    y /= 1000;
    erep(a, 0, 2 * 1000) {
        erep(b, 0, 4 * 1000) {
            int c = y - 10 * a - 5 * b;
            if (a + b + c == n && c >= 0) {
                printf("%d %d %d\n", a, b, c);
                return 0;
            }
        }
    }
    printf("-1 -1 -1\n");
    return 0;
}

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

int main() {
    int N;
    int a[110]; 
    cin >> N;
    for (int i = 0; i < N; ++i) cin >> a[i];
    sort(a, a + N, greater<int>());
    int difference = 0; 
    for (int i = 0; i < N; ++i)
    {if(i % 2 == 0) difference += a[i]; 
    if(i % 2 == 1) difference -= a[i];
    }
    cout << difference << endl;
}

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

int main(){
        int n;
        string s;
        cin>>n>>s;

        long long int r = 0,g = 0,b = 0;
        for (int i = 0;i < n ; i++){
                if (s[i] == 'R'){
                        r ++;
                }else if(s[i] == 'G'){
                        g ++;
                }else{
                        b ++;
                }
        }
        long long int ans = r * g * b;
        for (int i = 0; i < n ; i ++){
                for (int d = 0; d < n ; d ++){
                        int j = i + d;
                        int k = j + d;
                        if (k >= n)break;
                        if (s[i] != s[j] && s[j] != s[k]  && s[k] != s[i]){
                                ans --;
                        }
                }
        }
        cout<<ans<<endl;
}

Measured memory_bytes: 3628
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdlib>
#include<cstdio>
#include<cmath>
#define REG register
#define LLI long long
#define DBL double
#define CHR char 
#define BOL bool
const int MXN = 10010;

int n,
	a[MXN];

int main() {
	//freopen("template.in", "r", stdin);
	//freopen("template.out", "w", stdout);
	REG int i, ans1=0, ans2=0;
	
	scanf("%d", &n); n <<= 1;
	for(i = 1; i <= n; i++)
		scanf("%d", &a[i]);
	std::sort(a+1, a+n+1);
	for(i = 1; i <= n; i += 2)
	    ans1 += std::min(a[i], a[i+1]);
	for(i = 2; i < n; i += 2)
		ans2 += std::min(a[i], a[i+1]);
	ans2 += a[1];
	printf("%d\n", std::max(ans1, ans2));
	
	return 0;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**6)

def main():
    input = sys.stdin.readline
    N, Q = map(int, input().split())
    G = [set() for _ in range(N)]
    for _ in range(N-1):
        a, b = map(int, input().split())
        G[a-1].add(b-1)
        G[b-1].add(a-1)

    weights = [0] * N
    for _ in range(Q):
        p, x = map(int, input().split())
        weights[p-1] += x

    ans = [0] * N
    ans[0] = weights[0]
    visited = [False] * N
    def f(a, node):
        visited[node] = True
        for nt in G[node]:
            if visited[nt]:
                continue
            b = a + weights[nt]
            ans[nt] = b
            f(b, nt)
        return  0

    f(weights[0], 0)
    return ' '.join(map(str, ans))


if __name__ == '__main__':
    print(main())


Measured memory_bytes: 316600
#include "bits/stdc++.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
#define int ll
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/2
#define all(x) (x).begin(),(x).end()
#define debug(x) cerr<<#x<<": "<<x<<endl
#define debug_vec(v) cerr<<#v<<":";rep(i,v.size())cerr<<" "<<v[i];cerr<<endl
/*----------------------------------------------------------------*/

// int MOD = 998244353;
int MOD = 1000000007;

/*----------------------------------------------------------------*/
signed main(){

	int n;
	string s, t;
	cin >> n >> s >> t;

	rep(i,n){
		cout << s[i] << t[i];
	}



	
   
	return 0;
}
/*----------------------------------------------------------------*/

// g++ -std=c++14 code1.cpp
// sudo pip3 install --upgrade online-judge-tools
// rm -r -f test;oj dl https://code-festival-2018-quala.contest.atcoder.jp/tasks/code_festival_2018_quala_c
// rm -r -f test;oj dl https://ddcc2020-qual.contest.atcoder.jp/tasks/ddcc2020_qual_b
// rm -r -f test;oj dl https://abc148.contest.atcoder.jp/tasks/abc148_b

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

int main(){

	string S, T;
	cin >> S >> T;
	int A, B;
	cin >> A >> B;
	string U;
	cin >> U;

	if(U == S){
		 A -= 1;
	}else if(U == T){
		 B -= 1;
	}else return 0;
	cout << A << " " << B << '\n';
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<math.h>
#include<stdlib.h>
#include<string>
#include<iostream>
#include<set>
#include<map>
#include<deque>
using namespace std;
typedef long long ll;
typedef pair<ll, ll>pii;
typedef pair<pii, ll>pi3;
ll mod = 1000000007;
int main()
{
	int a, b;
	cin >> a >> b;
	cout << (a - 1)*(b - 1) << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
  int a,b;
  scanf("%d%d",&a,&b);
  if(a==b)
    printf("Draw");
  else if(a==1)
    printf("Alice");
  else if(b==1)
    printf("Bob");
  else if(a>b)
    printf("Alice");
  else if(a<b)
    printf("Bob");
  return 0;
  }


Measured memory_bytes: 128
#include <iostream>
#define maxn 100000
#define INFTY 2000000000
using namespace std;

struct Card {
  char suit;
  int value;
};

struct Card L[maxn/2+2],R[maxn/2+2];

void merge(struct Card *Array,int left,int mid,int right) {
  int n1=mid-left;
  int n2=right-mid;
  for (int i=0; i<n1; i++) {
    L[i]=Array[left+i];
  }
  for (int i=0; i<n2; i++) {
    R[i]=Array[mid+i];
  }
  L[n1].value=R[n2].value=INFTY;
  int i=0,j=0;
  for (int k=left; k<right; k++) {
    if (L[i].value<=R[j].value) {
      Array[k]=L[i++];
    }
    else {
      Array[k]=R[j++];
    }
  }
}
void mergeSort(struct Card *Array,int left,int right) {
  if (left+1<right) {
    int mid=(left+right)/2;
    mergeSort(Array,left,mid);
    mergeSort(Array,mid,right);
    merge(Array,left,mid,right);
  }
}
int partition(struct Card *Array,int index,int p,int r) {
  int i,j;
  struct Card x=Array[r];
  i=p-1;
  for (j=p; j<r; j++) {
    if (Array[j].value<=x.value) {
      i++;
      swap(Array[i],Array[j]);
    }
  }
  swap(Array[i+1],Array[r]);
  return i+1;
}
void quickSort(struct Card *Array,int index,int p,int r) {
  int q;
  if (p<r) {
    q=partition(Array,index,p,r);
    quickSort(Array,index,p,q-1);
    quickSort(Array,index,q+1,r);
  }
}
int main() {
  int n,i,v;
  struct Card A[maxn],B[maxn];
  char S[10];
  bool stable=true;
  cin>>n;
  for (i=0; i<n; i++) {
    cin>>S>>v;
    A[i].suit=B[i].suit=S[0];
    A[i].value=B[i].value=v;
  }
  mergeSort(A,0,n);
  quickSort(B,n,0,n-1);
  for (i=0; i<n; i++) {
    if (A[i].suit!=B[i].suit) 
      stable=false;
    
  }
  if (stable) 
    cout<<"Stable"<<endl;
 else 
    cout<<"Not stable"<<endl;
  
  for (i=0; i<n; i++)  cout<<B[i].suit<<" "<<B[i].value<<endl;
  return 0;
}



Measured memory_bytes: 5340
import java.io.*;

/**
 * Created by Ayushi on 27/07/2019.
 */

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
        String[] temp = r.readLine().split(" ");
        int n = Integer.parseInt(temp[0]);
        temp = r.readLine().split(" ");
        long[] t = new long[n+1];
        for (int i = 0; i < n+1; i++) {
            t[i] = Long.parseLong(temp[i]);
        }
        temp = r.readLine().split(" ");
        long[] s = new long[n];
        for (int j = 0; j < n; j++) {
            s[j] = Long.parseLong(temp[j]);
        }
        r.close();

        long d = 0;
        long x;
        for (int k = 0; k < n; k++) {
            for (int l = 0; l < 2; l++) {
                x = Math.min(t[k + l], s[k]);
                t[k + l] = t[k + l] - x;
                s[k] = s[k] - x;
                d += x;
            }
        }
        System.out.println(d);
    }
}


Measured memory_bytes: 56544
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")

#include<bits/stdc++.h>
using namespace std;


#define    boost        ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define    nl           "\n"
#define    ll           long long
#define    pb           push_back
#define    mpr          make_pair
#define    fr(i,a,n)   for(ll i=a;i<n;++i)
#define    fr0(i,n)     for(ll i=0;i<n;++i)
#define    pii          pair<ll, ll>
#define    mem(a)       memset(a,0,sizeof(a))
const ll mod = 1000000007;

void fio()
{
#ifndef ONLINE_JUDGE
    freopen("Input.txt", "r", stdin);
    freopen("Output.txt", "w", stdout);
#endif
}

template<typename T> void TIME(T start, T end)
{
#ifndef ONLINE_JUDGE
    double time_taken =  chrono::duration_cast<chrono::nanoseconds>(end - start).count();
    time_taken *= 1e-9;
    cout << "\nExecuted in: " << fixed
         << time_taken << setprecision(9);
    cout << " sec";
#endif
}



void solve(){

    // std::vector<int> v;
    // for(int i=0;i<1;i++)
    // {
    //     int x;
    //     cin>>x;
    //     v.push_back(x);

    // }

    string s,t;
    cin>>s>>t;
    int n=s.size();
    int m=t.size();

    int mn=INT_MAX;
    for(int i=0;i+m<=n; i++){
        int cur=0;
        for(int k=0;k<m;k++ ){
            if(s[i+k]!=t[k])
                cur++;
        }
        mn= min(mn, cur);
    }

    cout<<mn;





}

int main()
{
    //auto start = chrono::high_resolution_clock::now();
    boost;
    fio();
    ll t = 1;
    // cin >> t;
    while (t--) {
        solve();
    }
    //auto end = chrono::high_resolution_clock::now();
    //TIME(start, end);
    return 0;
}

Measured memory_bytes: 3660
#include <iostream>
#include <utility>
#include <string>
#include <algorithm>
#include <set>
#include <queue>
#include <vector>
#define MAX 10010
#define rep(i,p) for(int i=0;i<p;i++)
#define pb push_back
using namespace std;
int n,hoge,foo;
int graph[MAX][MAX] = {0};
int D[MAX] = {-1};
void bfs (int src) {
  queue<int> Q;
  Q.push(src);
  rep(i,MAX) D[i] = -1;
  D[src] = 0;
  while (! Q.empty()) {
    int cur = Q.front();
    Q.pop();
    // cout << "visiting " << cur << " " << D[cur] << endl;
    for (int dst = 1; dst <= n; dst++) {
      if (graph[cur][dst] == 1 && D[dst] == -1) {
        D[dst] = D[cur] + 1;
        Q.push(dst);
      }
    }
  }
}
int main(){
  cin >> n;
  rep(i,n) {
    cin >> hoge >> foo;
    rep(j,foo) {
      cin >> hoge;
      graph[i+1][hoge] = 1;
    }
  }
  bfs(1);
  rep(i,n) cout << i+1 << " " << D[i+1] << endl;
  return 0;
}

Measured memory_bytes: 3500
#include<bits/stdc++.h>
using namespace std;
int main(){
    while(true){
        int a,b;
        char op;
        cin>>a>>op>>b;
        if(op=='+')printf("%d\n",a+b);
        else if(op=='-')printf("%d\n",a-b);
        else if(op=='*')printf("%d\n",a*b);
        else if(op=='/')printf("%d\n",a/b);
        else break;
    }
}


Measured memory_bytes: 3196
n = int(input())
l=[]
for i in range(n):
    x, y = [int(i) for i in input().split()]
    l.append([x, y])
#print(l)

def kyori(a, b):
    return ((a[0]-b[0])**2 + (a[1]-b[1])**2)**0.5

soukyori = 0
for j in range(n):
    for k in range(n):
        soukyori = soukyori + kyori(l[j],l[k])
#print(soukyori)
print((soukyori * 2)/n/2)

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
int main(void) {
    vector<int> set;
    int n,a,q,k;
    cin >> n;
    for (int i=0;i<n;i++) {
        cin >> a;
        set.emplace_back(a);
    }
    auto begin = set.begin();
    auto end = set.end();
    cin >> q;
    for (int j=0;j<q;j++) {
        cin >> k;
        auto lower = lower_bound(begin,end,k);
        auto upper = upper_bound(begin,end,k);
        cout << lower-begin << " " <<  upper-begin << endl;
    }
}



Measured memory_bytes: 3464
N, M = map(int, input().split())
A = [int(input()) for _ in range(M)]
q = 1000000007

if N == 1:
    if M == 0:
        print(1)
    elif M == 1:
        print(0)
else:
    cost = [0 for _ in range(N + 1)]
    cost[0] = 1

    cnt = 0
    A.append([0])
    for i in range(1, N + 1):
        if i == A[cnt]:
            cost[i] = 0
            cnt += 1
        else:
            cost[i] = (cost[i - 1] + cost[i - 2]) % q

    print(cost[-1])


Measured memory_bytes: 58712
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#define ll long long
using namespace std;

const ll mod = 1e9 + 7;

ll C[2005][2005];
ll dp[100005][13];


int main(){
    string S;
    int N,M;
    cin >> S;
    vector<int>A(M+5);
    for(int i=0; i<S.size(); i++){
        cout  << "x";
    }
    cout << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++)
#define irep(i,a,b) for(ll i=ll(a);i>=ll(b);i--)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define pb push_back
#define mp make_pair
#define F .first
#define S .second 
#define pll pair<ll,ll>
using ll=long long;
using ld=long double;
const ll INF = 1LL<<60;
const ll mod=1e9+7;
using namespace std;
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }



ll a[210000];
int main(){
    ll n,ans=0;
    cin>>n;
    rep(i,0,n)cin>>a[i];
    ll p=a[0];
    rep(i,1,n)p^=a[i];
    rep(i,0,n)cout<<(p^a[i])<<endl;
}



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

#define sz(x) (int)x.size() 
#define pb push_back 
#define mp make_pair 
#define fi(a, b) for(int i=a; i<=b; i++) 
#define fj(a, b) for(int j=a; j<=b; j++) 
#define fo(a, b) for(int o=a; o<=b; o++) 
#define fdi(a, b) for(int i=a; i>=b; i--) 
#define fdj(a, b) for(int j=a; j>=b; j--) 
#define fdo(a, b) for(int o=a; o>=b; o--) 

#ifdef LOCAL
#define err(...) fprintf(stderr, __VA_ARGS__)
#else
#define err(...) while(false) {}
#endif

typedef long long ll; 
typedef pair<int, int> pii; 
typedef pair<ll, ll> pll; 
typedef vector<int> vi; 
typedef vector<pii> vpii; 
typedef vector<pll> vpll; 
typedef long double ld;

/////////////////////////////////

int const MAX = 101;
int ans[MAX][MAX];
int a, b;

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

int getcol(int x, int y) {
	if (x < 1 || x > MAX - 1) return -1;
	if (y < 1 || y > MAX - 1) return -1;
	return ans[x][y];
}

void buildwhite() {
	while (a) {
		for(int i = 51; i < MAX; i += 2) {
			fj(1, MAX - 1) {
				if (getcol(i, j) == 0) continue;
				bool f = true;
				fo(0, 3) {
					int x = i + dx[o];
					int y = j + dy[o];
					if (getcol(x, y) == 0) f = false;
				}
				if (f) {
					a--;
					ans[i][j] = 0;
					if (a == 0) return;
				}
			}
		}
	}
}

void buildblack() {
	while (b) {
		for(int i = 1; i < 50; i += 2) {
			fj(1, MAX - 1) {
				if (getcol(i, j) == 1) continue;
				bool f = true;
				fo(0, 3) {
					int x = i + dx[o];
					int y = j + dy[o];
					if (getcol(x, y) == 1) f = false;
				}
				if (f) {
					b--;
					ans[i][j] = 1;
					if (b == 0) return;
				}
			}
		}
	}
}


void solve() {
	fi(51, MAX - 1) {
		fj(1, MAX - 1) {
			ans[i][j] = 1;
		}
	}
	a--;
	buildwhite();
	b--;
	buildblack();
	printf("%d %d\n", MAX - 1, MAX - 1);
	fi(1, MAX - 1) {
		fj(1, MAX - 1) {
			if (ans[i][j]) {
				printf("#");
			} else {
				printf(".");
			}
		}
		printf("\n");
	}	
}

int main() {
#ifdef LOCAL
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	scanf("%d %d", &a, &b);
	solve();		

	
#ifdef LOCAL
	err("ELAPSED TIME: %.3Lf\n", (ld) clock() / CLOCKS_PER_SEC);
#endif	
	
	return 0;
}

Measured memory_bytes: 256
N = int(input())
L = [0 for _ in range(10010)]
for x in range(1, 101):
  for y in range(1, 101):
    for z in range(1, 101):
      X = x * x + y * y + z * z + x * y + y * z + z * x
      if X <= N:
        L[X] += 1
for i in range(1, N+1):
  print(L[i])

Measured memory_bytes: 9300
#![allow(unused_imports)]
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(deprecated)]

use std::cell::RefCell;
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;
use std::usize;

const MOD_10_9_7: u64 = 1_000_000_007;
const INF: i64 = 1_000_000_000_000;
const MIN_INF: i64 = -1_000_000_000_000;

/// FYI: https://github.com/vain0x/scan-bench
#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($t:ty) =>
        (rl().parse::<$t>().unwrap());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    buf.trim_right().to_owned()
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn digits(x: u64) -> Vec<char> {
    x.to_string().chars().collect()
}

fn dfs(x: u64, upper: u64) -> u64 {
    if x > upper {
        return 0;
    }
    let mut count = 0;

    let d = digits(x);
    //    debug!(&d);
    if d.contains(&'3') && d.contains(&'5') && d.contains(&'7') {
        count += 1;
    }

    for i in &vec![3, 5, 7] {
        count += dfs(10 * x + *i, upper);
    }

    count
}

fn main() {
    let n = read!(u64);

    println!("{}", dfs(0, n));
}


Measured memory_bytes: 4352
#include <stdio.h>

void readInt(int *x) {
	scanf("%d", x);
	return;
}
void readInts(int n, int arr[]) {
	int i;
	for (i=0;i<n;i++) {
		readInt(&arr[i]);
	}
}
void readChar(char *x) {
	scanf("%c", x);
	return;
}
void readChars(int n, char x[]) {
	scanf("%s", x);
	return;
}
void printInts(int n, int *arr) {
	int i;
	for (i=0;i<n;i++) {
		printf("%d ", arr[i]);
	}
	printf("\n");
	return;
}

int main(int argc, char const *argv[])
{
	int n;
	int arr[256];
	readInt(&n);
	readInts(n,arr);
	int i;
	int boo = 1;
	for (i=0;i<n;i++) {
		if (arr[i]%2==0) {
			if (arr[i]%3==0 || arr[i]%5==0) {
				boo = 1;
			}else{
				boo = 0;
				break;
			}
		}
	}
	if (boo==1) {
		printf("APPROVED\n");
	}else{
		printf("DENIED\n");
	}

	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<iomanip>
#include<math.h>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<string>
#include<bitset>
#define INF 1000000000ll
#define MOD 1000000007ll
#define EPS 1e-10
#define REP(i,m) for(long long i=0; i<m; i++)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define DUMP(a) for(long long dump=0; dump<(ll)a.size(); dump++) { cout<<a[dump]; if(dump!=(ll)a.size()-1) cout<<" "; else cout<<endl; }
#define ALL(v) v.begin(),v.end()
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef long double ld;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n;
	cin>>n;
	vector<ll> a(n);
	REP(i,n) cin>>a[i];
	vector<P> b(n);
	REP(i,n) {
		b[i].first=a[i];
		b[i].second=i;
	}
	sort(ALL(b));
	if(b[0].first>=0) {
		cout<<n-1<<endl;
		REP(i,n-1) {
			cout<<i+1<<" "<<i+2<<endl;
		}
		return 0;
	} else {
		if(abs(b[n-1].first)<=abs(b[0].first)) {
			cout<<2*(n-1)<<endl;
			REP(i,n) {
				if(i==b[0].second) continue;
				else cout<<b[0].second+1<<" "<<i+1<<endl;
			}
			REP(i,n-1) {
				cout<<n-i<<" "<<n-1-i<<endl;
			}
		} else {
			cout<<2*(n-1)<<endl;
			REP(i,n) {
				if(i==b[n-1].second) continue;
				else cout<<b[n-1].second+1<<" "<<i+1<<endl;
			}
			REP(i,n-1) {
				cout<<i+1<<" "<<i+2<<endl;
			}
		}
	}
}


Measured memory_bytes: 256