akhauriyash/Code-Regression huggingface dataset:
from bisect import *
a,b,q=map(int,input().split())
s,t=[],[]
for i in range(a):
    s.append(int(input()))
for i in range(b):
    t.append(int(input()))
for i in range(q):
    x=int(input())
    bs=bisect_left(s,x)
    if bs!=0:
        sl=x-s[bs-1]
    else:
        sl=float("inf")
    if bs!=a:
        sr=s[bs]-x
    else:
        sr=float("inf")
    bt=bisect_left(t,x)
    if bt!=0:
        tl=x-t[bt-1]
    else:
        tl=float("inf")
    if bt!=b:
        tr=t[bt]-x
    else:
        tr=float("inf")
    print(min(max(sl,tl),max(sr,tr),2*sl+tr,2*tl+sr,sl+tr*2,tl+sr*2))


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

int main() {
  
  int y, m, d;

  scanf("%d/%d/%d",&y,&m,&d);

  if (y > 2019) {
    cout << "TBD";
    return 0;
  }
  else if (m > 4) {
    cout << "TBD";
    return 0;
  }
  else if (d > 30) {
    cout << "TBD";
    return 0;
  }
  else {
    cout << "Heisei";
  }

  return 0;
}

Measured memory_bytes: 256
import math
s=int(input())

mazu=[0,0]
heho=math.ceil(math.sqrt(s))
#print(heho)
sa=heho**2-s
tugi=[heho,1]
san=[sa,heho]
subete=mazu+tugi+san
for sbt in subete:
    print(sbt, end=" ")

Measured memory_bytes: 3060
/// Bismillahir Rahmanir Rahim
//Author: Tanvir Hussain
//ICE,NSTU
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

using namespace std;

const long long MOD = 1000000007;
#define SET(x) memset(x, 0, sizeof(x))
#define SET2d(x,m,n) memset(x, 0, sizeof(x[0][0]) * m * n)
#define SETBOOL(x) memset(x,false,sizeof(x))
#define CLR(x) memset(x, -1, sizeof(x))
#define mp make_pair
#define PII pair<int, int>
#define pf printf

#define sf scanf

#define ALL(x) x.begin(),x.end()
#define pb push_back

#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define np std::string::npos
#define highest(x) numeric_limits<x>::max()
#define lowest(x) numeric_limits<x>::min()
#define Inf INFINITY
#define minv(v) *min_element(v.begin(),v.end())
#define maxv(v) *max_element(v.begin(),v.end())
#define cases(cs,t) for(int cs=1;cs<=t;cs++)
#define PI acos(-1)
#define no1 __builtin_popcount
#define BOUNDARY(i, j) ((i >= 0 && i < row) && (j >= 0 && j < column))
#define uniq(vec) vec.resize(distance(vec.begin(),unique(vec.begin(),vec.end())))
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define sz(a) int(a.size())
#define ff first
#define ss second
#define endl "\n"
#define forch(it,s) for(auto it:s)
#define each(it,s) for(auto it = s.begin(); it != s.end(); ++it)
#define rep(i,a) for(int i=0; i<a;i++)
#define rep1(i,a,b) for(int i=(a);i<=(b);++i)
#define irep(i,b,a) for(int i=(b);i>=(a);--i)
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef tree<pair<int, int>,null_type,less<pair<int, int>>,rb_tree_tag,tree_order_statistics_node_update> ordered_multiset;
int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};
int dx4[] = {0, 0, 1, -1};
int dy4[] = {1, -1, 0, 0};
const int maxx=100005;

//this fuction sorts vector pair according to first element in descending order.
bool sortinrev(const pair<int,int> &a,const pair<int,int> &b)
{
    return a.first>b.first;
}

template<typename T>inline T Bigmod(T base, T power, T MOD){
    T ret=1;
    while(power)
    {
        if(power & 1)ret=(ret*base)%MOD;
        base=(base*base)%MOD;
        power>>=1;
    }
    return ret;
}
double sq(double x) {return x*x;}
int ext_gcd(int a, int b, int & x, int & y) {
    //for finding modular inverse
    //if its return 1 ,then a has a mod inverse x mod b.
    if (a == 0) {
        x = 0;
        y = 1;
        return b;
    }
    int x1, y1;
    int d = ext_gcd(b % a, a, x1, y1);
    x = y1 - (b / a) * x1;
    y = x1;
    return d;
}

int main()

{
    IOS;
    //freopen("input.txt", "r", stdin);
     //freopen("output.txt", "w", stdout);
     double r;
     cin>>r;
     cout<<(2*PI*r)<<endl;

     return 0;

}
///Alhamdulillah


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

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define each(i, mp) for (auto &i : mp)

int main()
{
  int N, M;
  cin >> N >> M;
  vector<vector<int>> s(M);
  for (int i = 0; i < M; ++i)
  {
    int k;
    cin >> k;
    for (int j = 0; j < k; ++j)
    {
      int a;
      cin >> a;
      --a;
      s[i].push_back(a);
    }
  }
  vector<int> p(M);
  for (int i = 0; i < M; ++i)
    cin >> p[i];

  long long res = 0;
  for (int bit = 0; bit < (1 << N); ++bit)
  {
    bool ok = true;
    for (int i = 0; i < M; ++i)
    {
      int con = 0;
      for (auto v : s[i])
      {
        if (bit & (1 << v))
          ++con;
      }
      if (con % 2 != p[i])
        ok = false;
    }
    if (ok)
      ++res;
  }
  cout << res << endl;
}

Measured memory_bytes: 384
import sys

def setLine(tempH, line):
    for i in range(0, len(line)):
        geo[tempH][i] = line[i:i+1]

def solve():
    person = 0
    for i in range(0,H):
        for j in range(0,W):
            if geo[i][j] is not "_":
                search(i,j)
                person += 1
    print(person)

def search(i,j):
    temp = geo[i][j]
    geo[i][j] = "_"
    dx = [-1,0,1,0]
    dy = [0,-1,0,1]
    for a in range(0,4):
        idx = i + dx[a]
        jdy = j + dy[a]
        if(isOnMap(idx, jdy)):
            if(isNeededToSolve(temp, idx, jdy)):
                search(idx,jdy)

def isOnMap(i,j):
    return (0<=i and 0<=j and i<H and j<W)

def isNeededToSolve(temp,i,j):
    target = geo[i][j]
    return (target is not "_" and temp is target)

limit = 10**7
sys.setrecursionlimit(limit)

H = -1
W = -1
tempH = 0
geo = [[0 for i in range(1)]for j in range(1)]
repeat = True
while repeat:
    line = input()
    if H is -1 and W is -1:
        H = int(line.split(" ")[0])
        W = int(line.split(" ")[1])
        geo = [[0 for i in range(W)] for j in range(H)]
    else:
        setLine(tempH, line)
        tempH+=1

    #break
    if H is 0 and W is 0:
        break

    #solve
    if tempH is H:
        solve()
        H = -1
        W = -1
        tempH = 0

Measured memory_bytes: 18964
# C
N = int(input())

def dfs(s):
    if int(s) > N:
        return 0
    ret = 1 if all(s.count(c) > 0 for c in '753') else 0 # s 自体が七五三数なら +1
    for c in '753':
        ret += dfs(s + c)
    return ret

print(dfs('0'))

Measured memory_bytes: 3188
#pragma GCC optimize("Ofast") 
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define sz(a) a.size()
#define all(a) a.begin(),a.end()
#define lb lower_bound
#define ub upper_bound
#define owo ios_base::sync_with_stdio(0);cin.tie(0);
#define MOD (ll)(1e8)
#define INF (ll)(1e18)
#define debug(...) fprintf(stderr, __VA_ARGS__),fflush(stderr)
#define time__(d) for(long blockTime = 0; (blockTime == 0 ? (blockTime=clock()) != 0 : false);\
debug("%s time : %.4fs\n", d, (double)(clock() - blockTime) / CLOCKS_PER_SEC))
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> PII;
typedef pair<int,int> pii;
typedef vector<vector<int>> vii;
typedef vector<vector<ll>> VII;
ll gcd(ll a,ll b){if(!b)return a;else return gcd(b,a%b);}
int main()
{
 int n;
  cin>>n;
  map<string,vector<pii>>cnt;
  for(int i=1;i<=n;i++){
    string s;
    int a;
    cin>>s>>a;
    cnt[s].pb({a,i});
  }
  for(auto x:cnt){
   vector<pii>l = x.se;
    sort(all(l),greater<pii>());
    for(auto y:l)cout<<y.se<<'\n';
  }
}

Measured memory_bytes: 3608
#include<iostream>
#include<vector>
#include<string>
#define rep(i, start, end) for (int i = (int)start; i < (int)end; ++i)
#define rrep(i, start, end) for (int i = (int)start - 1; i >= end; --i)
#define iter(i, c) for (auto i = (c).begin(); i != (c).end(); ++i)
#define riter(i, c) for (auto i = (c).rbegin(); i != (c).rend(); ++i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
using namespace std;
using ll = long long;
template<typename T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return 0;}
template<typename T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return 0;}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S, T;
    int A, B;
    string U;
    cin >> S >> T >> A >> B >> U;
    int diff_a = 0, diff_b = 0;
    if (S == U) {
        --diff_a;
    }
    else if (T == U) {
        --diff_b;
    }
    cout << A + diff_a << ' ' << B + diff_b << endl;
    return 0;
}

Measured memory_bytes: 256
/**
  * http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_5_C
  * Structured Program I - Print a Chessboard
  */
object Main {
  def main(args: Array[String]): Unit = {
    Iterator.continually(io.StdIn.readLine()).takeWhile(_ != null).map(_.split(" ").map(_.toInt))
      .map { case Array(h, w) => (h, w) }
      .takeWhile(_ != (0, 0))
      .map { case (h, w) => createAChessBoard(h, w) }
      .foreach(_.foreach(println))
  }

  def createAChessBoard(h: Int, w: Int): Seq[String] = {
    (1 to h).map(
      y => (1 to w).foldLeft("") {
        (line, x) => line + (if (x % 2 == y % 2) "#" else ".")
      }
    ) :+ ""
  }
}

Measured memory_bytes: 76348
n = gets.to_i

cake = 4
donut = 7
(0..100).map{|c|
  (0..100).map{|d|
    if (cake * c) + (donut * d) == n
      puts "Yes"
      exit
    end
# p "c=#{c},d=#{d}"
  }
}
puts "No"
exit


Measured memory_bytes: 1916
#include <iostream>
#include <vector>
#include<list>
#include <algorithm>
#include <string>
#include <math.h>
#include<map>
#include <utility>

#include<queue>
using namespace std;
#define REP(i,k,n) for(int i=k;i<n;i++)
 
#define INF 1844674407370955161
typedef long long int ll;
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))
#define MOD 1000000007

template<typename T>
int vector_finder(std::vector<T> vec, T number) {
  auto itr = std::find(vec.begin(), vec.end(), number);
  size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return 1;
  }
  else { // 発見できなかったとき
    return 0;
  }
}

template<typename T>
T gcd(T a,T b){
	if(b>0){
		return gcd(b, a % b);
	}else{
		return a;
	}
}

template<typename T>
T lcm(T a,T b){
	T g = gcd(a, b);
	return a * b / g;
}

void clear( std::queue<pair<int,int> > &q )
{
   std::queue<pair<int,int> > empty;
   std::swap( q, empty );
}
bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}
template<typename T>
std::vector<T> enum_div(T n)//nの約数を列挙
{
	std::vector<T> ret;
	for(T i=1 ; i*i<=n ; ++i)
	{
		if(n%i == 0)
		{
			ret.push_back(i);
			if(i!=1 && i*i!=n)
			{
				ret.push_back(n/i);
			}
		}
	}
	return ret;
}


class DisjointSet{
    public:
        vector<int> rank, p;

        DisjointSet(){
        }

        DisjointSet(int size){
            rank.resize(size, 0);
            p.resize(size, 0);
            for (int i = 0; i < size;i++){
                makeSet(i);
            }
        }
        void makeSet(int x){
            p[x] = x;
            rank[x] = 0;
        }

        bool same(int x,int y){
            return findSet(x) == findSet(y);
        }
        void unite(int x,int y){
            link(findSet(x), findSet(y));
        }
        void link(int x,int y){
            if(rank[x]>rank[y]){
                p[y] = x;
            }else{
                p[x] = y;
                if(rank[x]==rank[y]){
                    rank[y]++;
                }
            }
        }
        int findSet(int x){
            if(x!=p[x]){
                p[x] = findSet(p[x]);
            }
            return p[x];
        }
};

int main()
{
    int N, D;
    cin >> N >> D;
    int x[N][D];
    REP(i,0,N){
        REP(j,0,D){
            cin >> x[i][j];
        }
    }

    int ans = 0;

    REP(i,0,N){
        REP(j,i+1,N){
            int dist = 0;
            REP(k,0,D){
                dist += (x[i][k] - x[j][k]) * (x[i][k] - x[j][k]);
            }
            vector<int> t = enum_div(dist);
            int s = t[t.size()-1];
            if (s*s == dist)
            {
                ans++;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <climits>
#include <cassert>

using namespace std;

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

#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

int main()
{
	int n, w;
	cout.precision(16);
	while(cin >> n >> w, n | w) {
		vi vals(15, 0);
		REP(_, n) {
			int v; cin >> v;
			++vals[v / w];
		}
		int rightmost = 0;
		int max_v = 0;
		REP(i, vals.size()) {
			if(vals[i]) rightmost = i;
			max_v = max(max_v, vals[i]);
		}
		double ans = 0;
		REP(i, rightmost + 1) {
			ans += ((double)(rightmost - i) / (rightmost)) * vals[i];
		}
		ans = ans / (double)max_v + 0.01;
		cout << ans << endl;
	}
}

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



int main(){
    int N;
    cin >> N;
    std::vector<long> monster(N+1);
    std::vector<long> hero(N);
    for(int i=0; i < N+1; i++){
        cin >> monster.at(i);
    }
    for(int i=0; i < N; i++){
        cin >> hero.at(i);
    }
    int cnt = 0;
    long hit;
    long long total = 0;

    for(int i=0; i < N; i++){
        hit = min(monster.at(N-i), hero.at(N-1-i));

        monster.at(N-i) -= hit;
        hero.at(N-1-i) -= hit;
        total += hit;
        hit = min(monster.at(N-1-i), hero.at(N-1-i));

        monster.at(N-1-i) -= hit;
        hero.at(N-1-i) -= hit;
        total += hit;
    }
    cout << total << endl;

    return 0;


}


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

const int64_t MOD = 1e9+7;
void add(int64_t& a, int64_t b){
    a = (a+b) % MOD;
}
void mul(int64_t& a, int64_t b){
    a = a*b % MOD;
}

vector<int64_t> fact, seq_inv, fact_inv;

void create_fact_mod(int num){
    fact[0] = fact[1] = 1;
    for(int i=2; i<=num; i++) fact[i] = fact[i-1] * i % MOD;
}

void create_seq_inv_mod(int num){
    seq_inv[0] = seq_inv[1] = 1;
    for(int i=2; i<=num; i++) seq_inv[i] = (MOD - MOD/i) * seq_inv[MOD%i] % MOD;
}

void create_fact_inv_mod(int num){
    fact_inv[0] = fact_inv[1] = 1;
    for(int i=2; i<=num; i++) fact_inv[i] = fact_inv[i-1] * seq_inv[i] % MOD;
}

void create_mod_tables(int num){
    fact.resize(num+1);
    seq_inv.resize(num+1);
    fact_inv.resize(num+1);
    create_fact_mod(num);
    create_seq_inv_mod(num);
    create_fact_inv_mod(num);
}

int64_t comb_mod(int n, int k){
    return fact[n] * fact_inv[n-k] % MOD * fact_inv[k] % MOD;
}

int64_t perm_mod(int n, int k){
    return fact[n] * fact_inv[n-k] % MOD;
}

int64_t power_mod(int64_t num, int64_t power){
    int64_t prod = 1;
    num %= MOD;
    while(power > 0){
        if(power&1) prod = prod * num % MOD;
        num = num * num % MOD;
        power >>= 1;
    }
    return prod;
}

int64_t extgcd(int64_t a, int64_t b, int64_t& x, int64_t& y){
    int64_t d = a;
    if(b != 0){
        d = extgcd(b, a%b, y, x);
        y -= (a/b) * x;
    }else{
        x = 1; y = 0;
    }
    return d;
}

int64_t inv_mod(int64_t a){
    int64_t x, y;
    extgcd(a, MOD, x, y);
    return (MOD + x%MOD) % MOD;
}


int main(){
    int N, K;
    cin >> N >> K;
    vector<int64_t> A(N);
    for(int i=0; i<N; i++) cin >> A[i];
    sort(A.begin(), A.end());
    create_mod_tables(N);

    int64_t ans = 0;
    for(int i=0; i<N; i++){
        if(i>=K-1){
            int64_t res = comb_mod(i, K-1) * A[i] % MOD;
            add(ans, res);
        }
        if(N-1-i>=K-1){
            int64_t res = comb_mod(N-1-i, K-1) * A[i] % MOD;
            add(ans, MOD - res);
        }
    }
    cout << ans << endl;
    return 0;
}


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

int main()
{
	vector<int> data,test;
	int i,j,n,count=0;
	cin >> n;
	
	for(i=0;i<n;i++)
	{
		cin >> j;
		data.push_back(j);
		test.push_back(j);
	}
	
	sort(data.begin(),data.end());
	
     for(i=0;i<n;i++)
	{
		if(data[i]!=test[i]) count++;
	}
	
	if(count == 2 || data == test) cout << "YES";
	else cout << "NO";
}

Measured memory_bytes: 3612
#include<iostream>
#include<string.h>
#include<string>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<math.h>
#include<queue>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
typedef long double db;
typedef pair<int,int> pii;
const int N=900000;
const db pi=acos(-1.0);
#define lowbit(x) (x)&(-x)
#define sqr(x) (x)*(x)
#define rep(i,a,b) for (register int i=a;i<=b;i++)
#define per(i,a,b) for (register int i=a;i>=b;i--)
#define go(u,i) for (register int i=head[u];i;i=sq[i].nxt)
#define fir first
#define sec second
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define maxd 1000000007
#define eps 1e-8
int n,m,k;
ll fac[N+10],invfac[N+10];

int read()
{
    int x=0,f=1;char ch=getchar();
    while ((ch<'0') || (ch>'9')) {if (ch=='-') f=-1;ch=getchar();}
    while ((ch>='0') && (ch<='9')) {x=x*10+(ch-'0');ch=getchar();}
    return x*f;
}

ll qpow(ll x,int y)
{
	ll ans=1;
	while (y)
	{
		if (y&1) ans=ans*x%maxd;
		x=x*x%maxd;y>>=1;
	}
	return ans;
}

ll C(int n,int m)
{
	if ((n<m) || (n<0) || (m<0)) return 0;
	return fac[n]*invfac[m]%maxd*invfac[n-m]%maxd;
}

int main()
{
	fac[0]=invfac[0]=1;
	rep(i,1,N) fac[i]=fac[i-1]*i%maxd;
	invfac[N]=qpow(fac[N],maxd-2);
	per(i,N-1,1) invfac[i]=invfac[i+1]*(i+1)%maxd;
	n=read();m=read();k=read();
	if (m<k) swap(m,k);
	ll ans=0,sum=1;
	rep(i,0,m+k)
	{
		ans=(ans+qpow(3,m+k-i)*C(n+i-1,n-1)%maxd*sum)%maxd;
		sum=(sum*2-C(i,i-k)-C(i,m))%maxd;
		sum=(sum+maxd)%maxd;
	}
	printf("%lld",ans);
	return 0;
}


Measured memory_bytes: 14336
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define rep(i,N) for(ll i=0; i<N; i++)
const ll mod=1e9+7;

int main(){
	ll N,A,B;
	cin >> N >> A >> B;
	ll sum = A+B;
	ll ans;
	ans=min(N%sum,A) + A*(N/sum);
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
//import java.util.Arrays;
public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int k = scan.nextInt();
		String s = scan.next();
		if(s.length() > k){
			s = s.substring(0, k) + "...";
		}
		System.out.println(s);
	}
}


Measured memory_bytes: 38496
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int u, v; ll w; };

ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

struct flow_network {
	int n;
	struct edge { int v; ll c; int rev; };
	vector< vector<edge> > G;
	flow_network(int _n) : n(_n), G(_n) {}
	void add_edge(int u, int v, ll c) {
		edge e = {v, c, (int)G[v].size()}, _e = {u, 0, (int)G[u].size()};
		G[u].push_back(e); G[v].push_back(_e);
	}
	ll dfs(int u, int t, ll f, vector<bool>& vis) {
		if (u == t) return f;
		vis[u] = true;
		for (int i = 0; i < G[u].size(); i++) {
			edge& e = G[u][i];
			if (vis[e.v] || e.c == 0) continue;
			ll d = min(e.c, dfs(e.v, t, min(f, e.c), vis));
			if (d == 0) continue;
			e.c -= d;
			G[e.v][e.rev].c += d;
			return d;
		}
		return 0;
	}
	ll max_flow(int s, int t) {
		ll res = 0;
		for (;;) {
			vector<bool> vis(n);
			ll f = dfs(s, t, LLONG_MAX, vis);
			if (f == 0) return res;
			res += f;
		}
	}
};

int main() {
	for (;;) {
		int H, W; cin >> H >> W;
		if (!H && !W) break;
		vector<vector<bool> > a(H + 2, vector<bool>(W + 2));
		for (int y = 1; y <= H; y++) {
			string s; cin >> s;
			for (int x = 1; x <= W; x++)
				a[y][x] = (s[x - 1] == '#');
		}
		H += 2; W += 2;
		vector<vector<int > > b(H, vector<int>(W));
		for (int y = 1; y <= H - 1; y++)
			for (int x = 1; x <= W - 1; x++)
				b[y][x] = a[y - 1][x - 1] + a[y - 1][x] + a[y][x - 1] + a[y][x];
		int ans = 1, N = 0, M = 0;
		vector<vector<vector<int> > > unko(H, vector<vector<int> >(W));
		for (int y = 1; y <= H - 1; y++)
			for (int x = 1; x <= W - 1; x++) {
				if (b[y][x] != 3) continue;
				ans++;
				if (a[y][x - 1] && a[y][x]) {
					int _y;
					for (_y = y + 1; b[_y][x] == 4; _y++);
					if (b[_y][x] != 3) continue;
					for (int z = y; z <= _y; z++)
						unko[z][x].push_back(N);
					N++;
				}
			}
		for (int y = 1; y <= H - 1; y++)
			for (int x = 1; x <= W - 1; x++) {
				if (b[y][x] != 3) continue;
				if (a[y - 1][x] && a[y][x]) {
					int _x;
					for (_x = x + 1; b[y][_x] == 4; _x++);
					if (b[y][_x] != 3) continue;
					for (int z = x; z <= _x; z++)
						unko[y][z].push_back(M);
					M++;
				}
			}
		flow_network fn(N + M + 2);
		int s = N + M, t = N + M + 1;
		for (int u = 0; u < N; u++)
			fn.add_edge(s, u, 1);
		for (int v = 0; v < M; v++)
			fn.add_edge(N + v, t, 1);
		for (int y = 1; y <= H - 1; y++)
			for (int x = 1; x <= W - 1; x++) {
				if (unko[y][x].size() != 2) continue;
				int u = unko[y][x][0], v = unko[y][x][1];
				fn.add_edge(u, N + v, 100000);
			}
		cout << ans - N - M + fn.max_flow(s, t) << endl;
	}
}

Measured memory_bytes: 4196
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
using namespace std;
int main(){
    long A,V,B,W,T;
    cin >> A>>V>>B>>W>>T;
    if(abs(A-B)<=(V-W)*T){
        cout << "YES";
    }else{
        cout << "NO";
    }
}

Measured memory_bytes: 3584
#!/usr/bin/env python3

def solve(s,t):
    c = len(s)
    for i in range(len(s)):
        if s[i] == t[i]:
            c -= 1
    return c




def main():
    s = input()
    t = input()
    print(solve(s,t))
    return

if __name__ == '__main__':
    main()


Measured memory_bytes: 9352
#include<stdio.h>
#define MAX 100000+10
int A[MAX], n;
int partition(int p, int r) {
	int x, i, t;
	x = A[r];
	i = p - 1;
	for ( int j = p; j < r; j++ ) {
		if ( A[j] <= x ) {
			i++;
			t = A[i]; A[i] = A[j]; A[j] = t;
		}
	}
	t = A[i + 1]; A[i + 1] = A[r]; A[r] = t;
	return i + 1; 
}
int main() {
	int i, q;
	scanf("%d", &n);
	for ( i = 0; i < n; i++ ) scanf("%d", &A[i]);
	q = partition(0, n -1);
	for ( int i = 0; i < n; i++ ) {
		if ( i ) printf(" ");
		if  ( i == q ) printf("[");
		printf("%d",A[i]);
		if ( i == q ) printf("]");
	}
	printf("\n");
	return 0;
}


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(v) v.begin(), v.end()
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define Rep(n) for (ll _ = 0; _ < (ll)(n); _++)

template<class S>S sum(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
ll min(int a,ll b){return min((ll)a,b);} ll min(ll a,int b){return min(a,(ll)b);}
template <class S> void print(vector<S> &v){for(ll i=0; i<(ll)v.size(); i++){cerr << v[i] << ' ';}cerr << endl;}
template <class S> void print(vector<vector<S>> &v) {for (ll i = 0; i < (ll)v.size(); i++) {for (ll j = 0; j < (ll)v[i].size(); j++) {cerr << v[i][j] << ' ';}cerr << endl;}}

void Main();

int main(){
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(20);
	Main();
	return 0;
}

struct UnionFind {
  vector<int> d;
  UnionFind(int n=0): d(n,-1) {}
  int find(int x) {
    if (d[x] < 0) return x;
    return d[x] = find(d[x]);
  }
  bool unite(int x, int y) {
    x = find(x); y = find(y);
    if (x == y) return false;
    if (d[x] > d[y]) swap(x,y);
    d[x] += d[y];
    d[y] = x;
    return true;
  }
  bool same(int x, int y) { return find(x) == find(y);}
  int size(int x) { return -d[find(x)];}
};

using P = pair<int,int>;
vector<bool> color(100000, false);
vector<vector<P>> graph(100000, vector<P>());
void dfs(int node, int parent, int distance){
	color[node] = distance % 2;
	for(auto [v,w]: graph[node]){
		if(v == parent) continue;
		dfs(v, node, distance + w);
	}
}

void Main(){
	int n; cin >> n;
	int u,v,w;
	Rep(n-1){
		cin >> u >> v >> w;
		u--; v--;
		graph[u].push_back(P(v,w));
		graph[v].push_back(P(u,w));
	}
	dfs(0, -1, 0);
	rep(i,n){
		cout << (int)color[i] << endl;
	}
}

Measured memory_bytes: 10724
#include <stdio.h>
int main(void){
    
    int a, b;
    
    scanf("%d %d", &a , &b);
    
    if ( a < b )
        printf("a < b\n");
    
    if ( a > b )
        printf("a > b\n");
    
    if ( a == b )
        printf("a == b\n");
    
    return 0;
}

Measured memory_bytes: 580
a,b,c,d=map(int,input().split())
ans ='R'*(c-a)+'U'*(d-b)+'L'*(c-a)+'D'*(d-b+1)+'R'*(c-a+1)+'U'*(d-b+1)+'L'+'U'+'L'*(c-a+1)+'D'*(d-b+1)+'R'
print(ans)

Measured memory_bytes: 3060
#!/usr/bin/env ruby

require 'set'

class Hash
  def push(key, value)
    self[key] = [] if self[key] == nil
    self[key].push(value)
  end
end

class Array
  def lower_bound(value)
    left = -1;
    right = self.length;
    while left + 1 < right
      mid = left + (right - left) / 2;
      if self[mid] >= value
        right = mid
      else
        left = mid
      end
    end
    right
  end

  def unique
    res = [self.first]
    each_cons(2) do |a, b|
      if a != b
        res.push(b)
      end
    end
    res
  end
end

def get_ints
  gets.chomp.split.map(&:to_i)
end

def get_ints_minus_one
  get_ints.map { |x| x - 1 }
end

def get_int
  gets.chomp.to_i
end

r = get_int

puts r**2


Measured memory_bytes: 14388
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <array>
#include <queue>
#include <map>
#include <set>
#include <sstream>
#include <stdio.h>
#include <cstdio>
#include <cstring>

using namespace std;

#define Rep(i,a,b) for(int i = a; i < b; i++)
#define rep(i,b) Rep(i,0,b)
#define rrep(i,a) for(int i = a; i >= 0; i--)
#define allof(a) (a).begin(), (a).end()

typedef long long ll;
const int inf = 1e9 + 7;
const ll infll = 1ll << 60ll;
const ll mod = 1e9 + 7;
// 0~3までは右左下上 4~7までは斜め
constexpr int dx[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
constexpr int dy[] = { 0, -1, 0, 1, 1, -1, -1, 1 };

int h, w;
vector<vector<char>> s(51, vector<char>(51));
int blackCnt = 0;

void dfs(int x, int y) {
	rep(i, 4) {
		if (x + dx[i] >= 0 && x + dx[i] < w &&
			y + dy[i] >= 0 && y + dy[i] < h)
			if (s[x + dx[i]][y + dy[i]] == '#') {
				blackCnt--;
				s[x + dx[i]][y + dy[i]] = '.';
				dfs(x + dx[i], y + dy[i]);
			}
	}
}

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

	cin >> h >> w;

	rep(i, h) {
		rep(j, w) {
			cin >> s[j][i];
			if (s[j][i] == '#') {
				blackCnt++;
			}
		}
	}

	rep(i, w) {
		rep(j, h) {
			rep(k, 4) {
				if (s[i][j] == '#') {
					if (i + dx[k] >= 0 && i + dx[k] < w &&
						j + dy[k] >= 0 && j + dy[k] < h)
						if (s[i + dx[k]][j + dy[k]] == '#') {
							s[i][j] = '.';
							blackCnt--;
							dfs(i, j);
							break;
						}
				}
			}
		}
	}

	// dfsで全探索し、すべての黒の場所を塗り替えれて、
	// 消した黒の個数と与えられた黒の個数が一致すればよい
	(blackCnt) ? cout << "No" << endl : cout << "Yes" << endl;

	return 0;
}

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

int main() {

  int N,K;
  cin>>N>>K;
  string S;
  cin>>S;
  int answer=0;
  for(int i=0;i<N-1;i++){
    if(S.at(i) == S.at(i+1))
      answer++;
  }
  answer=min(answer+2*K,N-1);
  cout<<answer;
}

Measured memory_bytes: 512
S = gets.chomp

a = S.slice(0..1).to_i
b = S.slice(2..3).to_i
a_m = [*(1..12)].include?(a) ? true : false
b_m = [*(1..12)].include?(b) ? true : false

if a_m && b_m then
    puts 'AMBIGUOUS'
elsif !a_m && !b_m then
    puts 'NA'
elsif a_m then
    puts 'MMYY'
elsif b_m then
    puts 'YYMM'
else
    puts 'WA'
end

Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a,  b, ans=0;    
    string s;
    cin >> a>>b;
    s = to_string(a);

    for(int i=a; i<=b; i++){
	s = to_string(i);
	if(s[0]==s[4] && s[1]==s[3])
	    ans++;	
    }
        
    cout << ans << endl;    
}



Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys
from collections import deque, defaultdict
from math import sqrt, factorial, gcd, ceil, atan, pi
# def input(): return sys.stdin.readline()[:-1] # warning not \n
# def input(): return sys.stdin.buffer.readline().strip() # warning bytes
# def input(): return sys.stdin.buffer.readline().decode('utf-8')
import string
# string.ascii_lowercase
from bisect import bisect_left
MOD = int(1e9)+7
INF = float('inf')


def solve():
    # n, m = [int(x) for x in input().split()]
    n, m = [int(x) for x in input().split()]
    t = int(input())
    a = [int(x) for x in input().split()]
    k = 0
    for i in range(n):
        r = []
        while len(r) != m:
            if not a[k]:
                k += 1
            x = min(m - len(r), a[k])
            a[k] -= x
            r += [k+1] * x
        if i % 2:
            r.reverse()
        print(*r)  


t = 1
# t = int(input())
for case in range(1,t+1):
    ans = solve()


"""

azyxwvutsrqponmlkjihgfedcb

"""


Measured memory_bytes: 10120
#include <bits/stdc++.h>
#define all(v) (v).begin(),(v).end()
using namespace std;


int main(){
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    int n; cin >> n;
    int count = 0;
    bool ans = false;
    for(int i=0;i<n;++i){
        int a, b; cin >> a >> b;
        if(a == b){
            count++;
            if(count == 3)
                ans = true;
        }
        else count = 0;
    }    
    if(ans) cout << "Yes\n";
    else cout << "No\n";
    return 0;
}

Measured memory_bytes: 3592
#include <iostream>
#include <vector>
#include <cassert>
#include <limits>
#include <cmath>
#include <algorithm>

using namespace std;
using ll = long long;
template <typename T>
constexpr T INF = numeric_limits<T>::max() / 100;

class Flow
{
public:
    using T = ll;
    struct Edge {
        Edge(const int from_, const int to_, const int reverse_, const T capacity_, bool is_reverse = false) : from{from_}, to{to_}, reverse{reverse_}, capacity{capacity_}, flow{0}, is_reverse(is_reverse) {}
        int from;
        int to;
        int reverse;
        T capacity;
        T flow;
        bool is_reverse;
    };

    Flow(const int v) : V{v}
    {
        edge.resize(v);
    }
    void addEdge(const int from, const int to, const T capacity)
    {
        edge[from].push_back(Edge{from, to, (int)edge[to].size(), capacity, false});
        edge[to].push_back(Edge{to, from, (int)edge[from].size() - 1, 0, true});
    }

    T FordFulkerson(const int s, const int t)
    {
        vector<bool> checked(V);
        T flow = 0;
        while (true) {
            for (int i = 0; i < V; i++) {
                checked[i] = false;
            }
            const T f = dfs_ff(s, t, INF<T>, checked);
            if (f == 0) {
                break;
            }
            flow += f;
        }
        return flow;
    }

    const int V;
    vector<vector<Edge>> edge;

private:
    T dfs_ff(const int pos, const int t, const T flow, vector<bool>& checked)
    {
        if (pos == t) {
            return flow;
        }
        checked[pos] = true;
        for (auto& e : edge[pos]) {
            if (not checked[e.to]) {
                const T res = e.capacity - e.flow;
                if (res > 0) {
                    const T d = dfs_ff(e.to, t, min(flow, res), checked);
                    if (d > 0) {
                        e.flow += min(d, res);
                        edge[e.to][e.reverse].flow -= min(d, res);
                        return d;
                    }
                }
            }
        }
        return 0;
    }
};

template <typename T>
T gcd(const T a, const T b)
{
    return (b != 0) ? gcd(b, a % b) : a;
}


int main()
{
    while (true) {
        int m, n;
        cin >> m >> n;
        if (m == 0 and n == 0) {
            break;
        }
        Flow flow(m + n + 2);
        vector<ll> b(m);
        for (int i = 0; i < m; i++) {
            flow.addEdge(m + n, i, 1);
            cin >> b[i];
        }
        vector<ll> r(n);
        for (int i = 0; i < n; i++) {
            flow.addEdge(i + m, m + n + 1, 1);
            cin >> r[i];
        }

        for (int i = 0; i < m; i++) {
            for (int j = 0; j < n; j++) {
                if (gcd(b[i], r[j]) > 1) {
                    flow.addEdge(i, m + j, 1);
                }
            }
        }
        cout << flow.FordFulkerson(m + n, m + n + 1) << endl;
    }
    return 0;
}

Measured memory_bytes: 15712
#include <stdio.h>
 
int main(void){
 
    char str[21];
    int i;
    int flag = 0;
 
    scanf("%s",str);
 
 
    for(i=20;i>=0;i--){
        if(flag == 1){
            printf("%c",str[i]);
        }
        if(str[i] == '\0'){
            flag =1;
        }
    }
    printf("\n");
 
    return 0;
}

Measured memory_bytes: 524
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<random>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(long long i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) {rep(_,v.size())cout<<" "<<v[_];cout<<endl;}
#define show2d(v) {rep(__,v.size())show1d(v[__]);}
using namespace std;
//kaewasuretyuui
typedef long long ll;
#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int> tp;
typedef vector<tp> vt;
typedef vector<vt>vvt;
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;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={-1,0,1,0};
int dy[]={0,1,0,-1};
#define yes cout<<"Yes\n"
#define no cout<<"No\n"

int f(int n,int i){
	while(n%i==0)n/=i;
	return n%i==1;
}
signed main(){
	ios::sync_with_stdio(false);
	cin.tie(0);

	int n,out=1;
	cin>>n;
	for(int i=2;i*i<=n;i++)if(n%i==0){
		out+=f(n,i);
		if(i-n/i)out+=f(n,n/i);
	}
	n--;
	if(n-1)out++;
	for(int i=2;i*i<=n;i++)if(n%i==0){
		out++;
		if(i-n/i)out++;
	}
	cout<<out<<endl;

}


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

int main(){
  string S;
  S="abcdefghijklmnopqrstuvwxyz";
  char C;
  cin >> C;
  for(int i=0;i<25;i++){
    if(C==S.at(i)){
      cout << S.at(i+1);
      break;
    }
  }
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		long a = stdIn.nextInt();
		long b = stdIn.nextInt();
		
		long d = a / b;
		long r = a % b;
		double f = (double)a / (double)b;
		
		System.out.print(d + " " + r + " ");
		System.out.printf("%f\n", f);
	}
}

Measured memory_bytes: 17376
import sys

a, b, c = map(int, input().split())
k = int(input())


while a >= b:
  b *= 2
  k -= 1
  if k < 0:
    print('No')
    sys.exit()
while b >= c:
  c *= 2
  k -= 1
  if k < 0:
    print('No')
    sys.exit()
print('Yes')

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

int main(){

  int n;
  int sum[10];
  int ba;
  char c;
  int tmp;
  

  while(cin >> n){
    if(n==0){ break; }

    for(int i=0; i<n; i++){
      sum[i]=0;
    }
    ba = 0;

    for(int i=0; i<100; i++){
      cin >> c;
      if(c=='M'){ sum[i%n]++; }
      else if(c=='S'){ ba += sum[i%n]+1; sum[i%n]=0; }
      else{ sum[i%n]+=ba+1; ba=0; }
    }

    for(int i=0; i<n-1; i++){
      for(int j=i; j<n; j++){
	if(sum[i] > sum[j]){
	  tmp = sum[i];
	  sum[i] = sum[j];
	  sum[j] = tmp;
	}
      }	  
    }

    for(int i=0; i<n; i++)
      cout << sum[i] << ' ';

    cout << ba << endl;

  }

    

  return 0;
}

Measured memory_bytes: 1160
#include<stdio.h>
int main(void)
{
  int b,f,r,v,c,i,j,k,n,a[5][4][11];


  for(i=1;i<=4;i++)
  for(j=1;j<=3;j++)
  for(k=1;k<=10;k++)a[i][j][k]=0;

  scanf("%d",&n);

  for(i=1;i<=n;i++){
    scanf("%d %d %d %d",&b,&f,&r,&v);
    a[b][f][r]=a[b][f][r]+v;
  }

  for(i=1;i<=4;i++){
    for(j=1;j<=3;j++){
      for(k=1;k<=10;k++)printf(" %d",a[i][j][k]);
      printf("\n");
    }
    if(i!=4)printf("####################\n");
  }

  return 0;
}

Measured memory_bytes: 1748
#!/bin/bash
MOD=1000000007
ans=1
read N
N=$(echo $N | sed 's/\n//g')
flag=$(tr ' ' '\n' | awk -v N=$N '{a[$1]++;flag=1} END{for(i=0;i<N/2;i++)if(a[N-2*i-1]!=(2-!(N-2*i-1)))flag=0;print flag}')
if [ $flag -eq 0 ]; then
  echo 0
else
  for i in $(seq 1 $((N/2))); do
    ans=$((ans<<1))
    ans=$((ans%MOD))
  done
  echo $ans
fi


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

using namespace std;

typedef long long ll;
typedef vector<int> pi;
typedef pair<int,int> vi;

#define F first
#define S second
#define PB push_back
#define MK make_pair
#define REP(i, a, b) for (int i=a; i < b; i++)


int main() {
	int N;
	cin >> N;
	int a[N];
	REP(i, 0, N) cin >> a[i];
	
	sort(a, a+N);
	//REP(i, 0, N) cout << a[i] << " ";
	N /=2;
	cout<< a[N] - a[N-1] << "\n";
}


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

int main(){

  int a,b,c,tri=0,ei=0,ty=0,don=0,maxnum;

  while(1){

    cin >> a >> b >> c;

    maxnum = max(a,max(b,c));

    if(maxnum == b){
      b = a;
      a = maxnum;
    }
    else if(maxnum == c){
      c = a;
      a = maxnum;
    }

    if(a < (b + c) ){
      tri++;
      if(a*a > b*b + c*c){
        don++;
      }
      else if(a*a == b*b + c*c){
        ty++;
      }
      else{
        ei++;
      }
    }
    else{
      cout << tri << " " << ty << " " << ei << " " << don << endl;
      break;
    }
  }

  return 0;
}

Measured memory_bytes: 3104
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <bitset>
#include <random>
#include <complex>
#include <assert.h>

using namespace std;
typedef long long ll;
#define endl '\n'

template<typename T>
inline bool chmin(T& x, T a) {
	if (x >= a) { x = a; return true; }
	return false;
}

template<typename T>
inline bool chmax(T& x, T a) {
	if (x <= a) { x = a; return true; }
	return false;
}

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

	ll a;
	double _b;
	cin >> a >> _b;
	ll b = (ll)(_b * 100 + 0.5);

	a *= b;
	a /= 100;
	cout << a << endl;

	return 0;
}


Measured memory_bytes: 3192
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
void fastio(){
	 ios_base::sync_with_stdio(false);
	 cin.tie(0);
	 cout.tie(0);
}
ll ar[100005],g[100005],g2[100005];
int main() {
	fastio();
	ll n,ans=0;
	cin>>n;
	
	for (int i = 1; i <= n; ++i)
	{
	        cin >> ar[i];
	        g[i] = __gcd(g[i - 1], ar[i]);
	        
          }
          for (int i = n; i > 0; --i) 
          {
	        g2[i] = __gcd(g2[i + 1], ar[i]);
	       
	       ans = max(ans, __gcd(g[i - 1], g2[i + 1]));
	       
          }
	cout<<ans;
	
	
	return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define ll long long int
#define ff first
#define pb push_back
#define ss second
#define debug 0
#define ff first
#define mp make_pair
 
using namespace std;
 
const ll MOD = 1000000007LL;
 


 
ll ar[2000056],arr[2000056];
ll br[2000056],brr[2000056];
ll cr[2000056],summ[2000056];


const long double pi=3.1415926535897;

 
vector<int> primes,pec,vec;

vector<pair<ll,ll> > vp;

set<ll> st;

map<ll,ll> has;
map<char,char> hav,first_occr,used;

 
 
 
ll powr (ll a, ll  b)
{
    if (b == 0)
        return 1;
    long long int x = powr(a, b/2);
    if (b % 2 == 0)
        return (x*x)%MOD;
    else
        return ((x*x)%MOD*a%MOD)%MOD;
}
 
inline ll inv(ll x) {
  return powr(x, MOD - 2);
}
 
inline ll mulMod(ll a, ll b) {
  return (a%MOD * b%MOD) % MOD;
 
}
 
/*inline void process() {
  fact[0] = 1;
  power2[0] = 1;
  for(int i = 1; i < 200003; i++) {
    fact[i] = mulMod(fact[i - 1], i);
    power2[i] = mulMod(power2[i - 1], 2);
  }
  ifact[200002] = inv(fact[200002]);
  for(int i = 200002 - 1; i >= 0; i--) {
    ifact[i] = mulMod(ifact[i + 1], i + 1);
  }
}
 
inline ll ncr(ll n, ll r) {
  if(n < r) return 0;
  return mulMod(fact[n], mulMod(ifact[r], ifact[(n - r)]));
}
 
 
 
void sieve()
{
    memset(prime,true,sizeof(prime));
    prime[0]=prime[1]=false;
    
    for(ll i=2;i*i<=1000006;i++)
    {
        if(prime[i])
        {
            for(ll j=i*2;j<=1000006;j+=i)
            {
                prime[j]=false;
            }
        }
    }
    
    for(int i=2;i<=100005;i++)
    {
    	if(prime[i])
    	primes.pb(i);
	}
}





void LeastPrimeFactor(){
	int tot=1000003;
	least_prime[1]=1;
	for (ll i = 2; i <tot; i += 2)	least_prime[i] = 2;
	for (ll i = 3; i < tot; i += 2){
		if (!visit[i]){
			least_prime[i] = i;
			for (ll j = i; (j*i) < tot; j += 2){
				if (!visit[j*i])
				{
					visit[j*i] = true;
					least_prime[j*i] = i;
				}
			}
		}
	}
}*/




string strng[100005];

 

int main() 
{
//	freopen("input4.in","r",stdin);
//	freopen("output4.out","w",stdout);
    ll m,n,t,p,q,s,c,d,e,f,g,h,res=0,u,v,i,j,l=0,k,len,tot=0,rad,w,pos=0,y,r=0,z,x,maxm=-1,mid;
	ll cycle,val,max1=0,max2=0,num=0,zero,ans=0,min1=INT_MAX,min2=INT_MAX,sum=0;
    bool flag=0;
    ll a,b,minm=INT_MAX;
    ll x1,x2;
    
    string str,ptr="",dstr,dptr;
    
    set<ll>::iterator it;
    
    cin>>n;
    
    for(i=0;i<n;i++)
    cin>>ar[i];
    
    for(i=0;i<n;i++)
    cin>>br[i];
    
    for(i=0;i<n;i++)
    cin>>cr[i];
    
    sort(ar,ar+n);
    sort(br,br+n);
    sort(cr,cr+n);
    
    for(i=0;i<n;i++)
    {
    	p=upper_bound(br,br+n,ar[i])-br;
    	//cout<<"p="<<p<<"\n";
    	
    
    	arr[i]=n-p;
    //	cout<<"arr="<<arr[i]<<"\n";
	}
	
	for(i=0;i<n;i++)
    {
    	p=upper_bound(cr,cr+n,br[i])-cr;
    	//cout<<"p="<<p<<"\n";
    	
    	
    	brr[i]=n-p;
    //	cout<<"brr="<<brr[i]<<"\n";
	}
	
	summ[-1]=0;
	
	for(i=0;i<n;i++)
	summ[i]=summ[i-1]+brr[i];
	
	for(i=0;i<n;i++)
	{
		ans+=(summ[n-1]-summ[n-1-arr[i]]);
	}
    
    cout<<ans;
 
	return 0;
    
}    

Measured memory_bytes: 16128
#include <bits/stdc++.h>
#include <cstdlib>
#include <cmath>
#include <algorithm>
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph= vector<vector<int>>; 
#define rep(i,n) for (ll i=0; i < (n); ++i)
#define rep2(i,n,m) for(ll i=n;i<=m;i++)
#define rep3(i,n,m) for(ll i=n;i>=m;i--)
#define pb push_back
#define eb emplace_back
#define ppb pop_back
const ll INF=1e18 ;
inline void chmax(ll& a,ll b){a=max(a,b);}
inline void chmin(ll& a,ll b){a=min(a,b);}
// ミント
const int mod = 1e9+7 ;
//998244353;

struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
//昆布
struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
}   ;
 
mint dp[2005][2005] ; //dp n m 
int main(){
 ll n ,m ; cin>>n>>m ;
 vector<ll> S(n) ,T(m) ;
 rep(i,n)  {cin>>S[i] ; dp[i+1][0]=1 ;}
 rep(i,m)  {cin>>T[i] ; dp[0][i+1]=1 ;}
 dp[0][0]=1 ;
 rep(i,n){
   rep(j,m){
     if(S[i]!=T[j]) dp[i+1][j+1]=dp[i][j+1]+dp[i+1][j]-dp[i][j] ;
     else dp[i+1][j+1]=dp[i+1][j]+dp[i][j+1] ;

     }
   }
   cout<<dp[n][m]<<endl ;
    return 0;
  }

Measured memory_bytes: 31744
#include <stdio.h>
#include <string.h>
 
#define MAX 36
 
int main(){
  char a[MAX][3],b[MAX][3],str[3];
  int n,i,j,c[MAX],d[MAX],tmp,mini,ok = 1;
 
  scanf("%d" ,&n);
  for(i = 0 ; i < n ; i++){
    scanf("%s" ,a[i]);
    strcpy(b[i],a[i]);
    c[i] = d[i] = a[i][1]-'0';
  }
 
  for(i = 0 ; i < n ; i++){
    for(j = n-1 ; j > i ; j--){
      if(c[j] < c[j-1]){
    tmp = c[j];
    c[j] = c[j-1];
    c[j-1] = tmp;
 
    strcpy(str,a[j]);
    strcpy(a[j],a[j-1]);
    strcpy(a[j-1],str);
      }
    }
  }  
 
  for(i = 0 ; i < n ; i++){
    if(i != n-1){
      printf("%s " ,a[i]);
    }else{
      printf("%s\n" ,a[i]);
      puts("Stable");
    }
  }
 
  for(i = 0 ; i < n-1 ; i++){
    mini = i;
    for(j = i+1 ; j < n ; j++){
      if(d[j] < d[mini]){
    mini = j;
      }
    }
     
    if(mini != i){
      tmp = d[i];
      d[i] = d[mini];
      d[mini] = tmp;
 
      strcpy(str,b[i]);
      strcpy(b[i],b[mini]);
      strcpy(b[mini],str);
    }
  }
 
  for(i = 0 ; i < n ; i++){
    if(strcmp(a[i],b[i])){
      ok = 0;
    }
    if(i != n-1){
      printf("%s " ,b[i]);
    }else{
      printf("%s\n" ,b[i]);
    }
  }
 
  if(ok){
    puts("Stable");
  }else{
    puts("Not stable");
  }
  return 0;
}
/*	scanf("%d",&n);
    
    for(i=0;i<n;i++){
    	scanf("",&);
    }
    
    printf("%d\n",s);
     if x < y
        swap(x, y)
    while y > 0
        r = x % y
        x = y
        y = r

    return x
    
    */


Measured memory_bytes: 2052
#include<iostream>
#include<cmath>
#include<algorithm>
#include<vector>
#include<queue>

using namespace std;

int main(){

  int n;
  cin >> n;

  vector<vector<int>> G(n);

  for(int i=0;i<n;i++){
    int u,k;
    cin >> u >> k;
    for(int j=0;j<k;j++){
      int a;
      cin >> a;
      G[u-1].push_back(a-1);
    }
  }

  vector<int> d(n,-1);
  queue<int> que;

  que.push(0);
  d[0]=0;

  while(!que.empty()){
    int v=que.front();
    que.pop();

    for(int i=0;i<G[v].size();i++){
      if(d[G[v][i]]==-1){
        d[G[v][i]]=d[v]+1;
        que.push(G[v][i]);
      }
    }
  }

  for(int i=0;i<n;i++){
    cout << i+1 << " " << d[i] << endl;
  }


}


Measured memory_bytes: 3156
#include<cstdio>
#include<string>
#include<iostream>
#include <algorithm>
using namespace std;
int main(){
    int N,count[100000]={},a;
    cin>>N;
    for(int i=0;i<N;i++){
        cin>>a;
        count[a]++;
        count[a+1]++;
        count[a-1]++;
    }
    int maxc=0;
    for(int i=0;i<100000;i++)maxc=max(maxc,count[i]);
    cout<<maxc<<endl;

    return 0;
}

Measured memory_bytes: 640