akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define fst first
#define snd second
#define pb push_back
#define ALL(x) x.begin(),x.end()
#define EPS (1e-9)
#define equals(a,b) (fabs((a)-(b))<EPS)

using namespace std;

bool LT(double a,double b) { return !equals(a,b) && a < b; }
bool LTE(double a,double b) { return equals(a,b) || a < b; }

const string YES = "";
const string NO  = "";

typedef long long ll;

void solve() {

}

int main() {
  string s;
  cin >> s;
  bool bad = false;
  rep(i,(int)s.size()) {
    if( i+1<(int)s.size()&&s[i]==s[i+1] ) { bad = true; break;}
  }
  if( bad ) puts("Bad");
  else puts("Good");

  return 0;
}


Measured memory_bytes: 256
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque
from copy import deepcopy
from functools import lru_cache, reduce
from math import ceil, floor

import heapq
import itertools
import operator


def get_int():
    return int(input())


def get_str():
    return input().strip()


def get_int_list():
    return [int(i) for i in input().split()]


def get_char_list():
    return list(input().strip())


def main():
    n = get_int()
    a = get_char_list()
    b = get_char_list()
    c = get_char_list()

    ret = 0
    for x, y, z in zip(a, b, c):
        if x == y == z:
            continue
        elif x == y or x == z or y == z:
            ret += 1
        else:
            ret += 2
    print(ret)


if __name__ == '__main__':
    main()


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

int main() {
  int N, ans=0;
  cin >> N;
  vector<int> list(N);
  
  for (int i = 0; i < N; i++) cin >> list.at(i);
  for (int j = 1; j < N-1; j++) {
    if (list.at(j-1) < list.at(j) && list.at(j) < list.at(j+1)) ans++;
    if (list.at(j+1) < list.at(j) && list.at(j) < list.at(j-1)) ans++;
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 3616
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#define _USE_MATH_DEFINES
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007; // 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
/*-------------------------------------------------*/
int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  // freopen("input.txt", "r", stdin);

  string s; cin >> s;
  int a = 0;
  long long ans = 0;
  REP(i, s.length()) {
    if (s[i] == 'A') {
      ++a;
      continue;
    } else if (s[i] == 'B') {
      if (i + 1 < s.length() && s[i + 1] == 'C') {
        ans += a;
        ++i;
        continue;
      }
    }
    a = 0;
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 720
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;


int main(){
	
	int a,b;
	cin >> a >> b;
	
	if (2*b >= a){
		cout<<"0\n";
	}
	
	else {
		cout << a - 2*b <<endl;
		
		
	}
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
using namespace __gnu_pbds; 
#define ll          long long int
#define ull         unsigned long long int
#define pb          push_back
#define pii         pair<int,int>
#define F           first
#define S           second
#define vi          vector<int>
#define vli          vector<ll>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define M_PI        3.14159265358979323846
#define mp          make_pair
#define sz(x)       (int)x.size()
#define matrix      vector<vector<ll>>
#define forn(i,a,b)  for(int i=a;i<b;i++)
#define eps 0.0000000001
#define all(a)      (a).begin(),(a).end()
#define ordered_set     tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> 

const long long INF = (long long) 1e11+1;
const long long mod = (long long) 100000000 ;
const long long hell = (long long) 1000000007;


ll power(ll x,ll y)
{
  ll res=1;
  while(y>0){
    if(y%2) res=(x*res);
    x=(x*x);    
    y=y/2;
  }
  return res;
}

ll modinv(ll x,ll m){
  return power(x,m-2);
}

void fastIO() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}

ll gcd(ll a,ll b)
{
    while( b != 0)
	{
		ll  t = b;
		b= a %t;
		a = t;
	}
	return a;
}


void solve(){
    double r;
    cin>>r;
    double c=2*M_PI*r;
    cout<<fixed<<setprecision(12)<<c;
}


int main(){
   fastIO();
   int test;
   //cin>>test;
   test=1;
  
   while(test--)
   solve();
}

///Before submit=>
///    *check for integer overflow,array bounds
///    *check for n=1

/*
  For freq or prime factors

for(auto pri:prime){
  while(k%pri==0){
    pcnt[pri]++;
    k/=pri;
  }
}*/

// gcd of strings
/*
string getgcd(string s1,string s2){
    
    while(true){
        if(s1.length()<s2.length()){
            swap(s1,s2);
            continue;
        }
        if(s2.empty())
        return s1;
        
        if(s1.substr(0,s2.length())!=s2)
        return "";
        
        s1=s1.substr(s2.length());
    }
}
*/
/*
// for user defined DS hashmap and set
 
struct hash_pair{
      size_t operator()(const pair<int,pair<int,int>>& p) const{
          auto hash1=hash<int>()(p.F) ;
          auto hash2=hash<int>()(p.S.F) ;
          auto hash3=hash<int>()(p.S.S) ;
          return (hash1^hash2)^hash3;
      }  
};
struct pair_hash
{
	template <class T1, class T2>
	std::size_t operator () (std::pair<T1, T2> const &pair) const
	{
		std::size_t h1 = std::hash<T1>()(pair.first);
		std::size_t h2 = std::hash<T2>()(pair.second);

		return h1 ^ h2;
	}
};
*/



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

struct RU {
	using t1 = int;
	using t2 = int;
	static t2 id2() { return -1; }
	static t1 op2(const t1& l, const t2& r) { return r == id2() ? l : r; }
	static t2 op3(const t2& l, const t2& r) { return r == id2() ? l : r; }
};

template <typename M>
class lazy_segment_tree {
	using T1 = typename M::t1;
	using T2 = typename M::t2;
	const int h, n;
	vector<T1> data;
	vector<T2> lazy;
	void push(int node) {
		if (lazy[node] == M::id2()) return;
		if (node < n) {
			lazy[node << 1] = M::op3(lazy[node << 1], lazy[node]);
			lazy[(node << 1) + 1] = M::op3(lazy[(node << 1) + 1], lazy[node]);
		}
		lazy[node] = M::id2();
	}
public:
	lazy_segment_tree(int n_, T1 v1)
		: h(ceil(log2(n_))), n(1 << h), data(n, v1), lazy(n << 1, M::id2()) {}
	lazy_segment_tree(const vector<T1>& data_)
		: h(ceil(log2(data_.size()))), n(1 << h), data(data_), lazy(n << 1, M::id2()) {}
	void update(int l, int r, T2 val) {
		l += n, r += n;
		for (int i = h; i > 0; i--) push(l >> i), push(r >> i);
		r++;
		while (l < r) {
			if (l & 1) lazy[l] = M::op3(lazy[l], val), l++;
			if (r & 1) r--, lazy[r] = M::op3(lazy[r], val);
			l >>= 1; r >>= 1;
		}
	}
	T1 find(int p) {
		T1 res = data[p]; p += n;
		while (p) res = M::op2(res, lazy[p]), p >>= 1;
		return res;
	}
};

int main()
{
	ios::sync_with_stdio(false), cin.tie(0);
	int n, q;
	cin >> n >> q;
	lazy_segment_tree<RU> lst(n, INT_MAX);
	while (q--) {
		int com;
		cin >> com;
		if (com == 0) {
			int s, t, x;
			cin >> s >> t >> x;
			lst.update(s, t, x);
		}
		else {
			int p;
			cin >> p;
			printf("%d\n", lst.find(p));
		}
	}
	return 0;
}



Measured memory_bytes: 4584
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();

		int ans = B/A;
		if(ans > C) {
			ans = C;
		}

		System.out.println(ans);


	}
}


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

int main()
{
  long long int min,max;
  cin >> min >> max;
  
  if(max<min){
    long long int t=min;
    min = max;
    max = t;}
  
  
  // 自分も含めた周りのカードが奇数枚；裏
  long long int ans;
  
  if (min == 1){
    if(max==1) ans = 1;
    else       ans = max -2 ;}
  else if (min == 2){ans = 0;}
  else ans = (min - 2)*(max -2);
    
  cout << ans;
}

Measured memory_bytes: 256
#include <iostream>      // cout, endl, cin
#include <string>        // string, to_string, stoi
#include <vector>        // vector
#include <algorithm>     // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility>       // pair, make_pair
#include <tuple>         // tuple, make_tuple
#include <cstdint>       // int64_t, int*_t
#include <cstdio>        // printf
#include <map>           // map
#include <queue>         // queue, priority_queue
#include <set>           // set
#include <stack>         // stack
#include <deque>         // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset>        // bitset
#include <cctype>        // isupper, islower, isdigit, toupper, tolower
#include <cmath>

using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()

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

        map<int, int> mp;

        int a;
        rep(i, N)
        {
                cin >> a;
                mp[a]++;
        }

        int ans = 0;
        for (auto itr = mp.begin(); itr != mp.end(); itr++)
        {
                if (itr->second % 2 == 1)
                {
                        ans++;
                }
        }

        cout << ans << endl;

        return 0;
}


Measured memory_bytes: 4864
import java.io.*;
import java.lang.StringBuilder;
public class Main {
	public static void main(String[] args) throws Exception{
		BufferedReader sc = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder bu = new StringBuilder();
		int[][][] t = new int[4][3][10];
		int n = Integer.parseInt(sc.readLine());
		for(int i=0;i<n;i++){
			String[] st= sc.readLine().split(" ");
			int b = Integer.parseInt(st[0]);
			int f = Integer.parseInt(st[1]);
			int r = Integer.parseInt(st[2]);
			int v = Integer.parseInt(st[3]);
			t[b-1][f-1][r-1] += v;
		}
		for(int b = 0;b < 4;b++){
			for(int f = 0;f < 3;f++){
				for(int r = 0;r < 10;r++){
					bu.append(" ").append(t[b][f][r]);
				}
				bu.append("\n");
			}
			bu.append("####################\n");
		}
		bu.delete(bu.lastIndexOf("#")-20,bu.lastIndexOf("\n"));
		System.out.print(bu);
	}
}

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

int N;
string s;
int main()
{
    cin >> N;
    int l = 0, r = N - 1;
    cout << 0 << endl;
    fflush(stdout);

    int sex;
    cin >> s;
    if(s == "Vacant")
        return 0;
    sex = (s == "Male" ? 0 : 1);

    while(l < r) {
        int m = (l + r + 1) / 2;
        cout << m << endl;
        fflush(stdout);
        cin >> s;
        if(s == "Vacant")
            return 0;
        int x = (s == "Male" ? 0 : 1);
        if((m - l) % 2 != abs(x - sex)) {
            r = m - 1;
        } else {
            l = m;
            sex = x; 
        }
    }
    cout << l << endl;
    fflush(stdout); 
    cin >> s; 
    return 0;
}


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

#define rep(i, n) REP(i, 0, n)
#define repr(i, n) for (int i = (n); i >= 0; i--)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;

int main()
{
    int n, t;
    cin >> n >> t;

    int a[n];
    rep(i, n) cin >> a[i];

    int b[n];
    int minv = a[0];
    b[0] = 0;
    int maxv = 0;
    for (int i = 1; i < n; i++)
    {
        minv = min(minv, a[i - 1]);
        b[i] = a[i] - minv;
        maxv = max(maxv, b[i]);
    }

    int cnt = 0;
    rep(i, n) if (b[i] == maxv) cnt++;
    OP(cnt);

    return 0;
}

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

int main() {
  int H, W;
  for (;;) {
    cin >> H >> W;
    if (H == 0 && W == 0)
      return 0;
    for (int h = 0; h < H; ++h) {
      for (int w = 0; w < W; ++w)
        cout << '#';
      cout << endl;
    }
    cout << endl;
  }
}


Measured memory_bytes: 3048
S=input()
List = list(S)
res=""

def responseB(moji):
  if moji == "":
    return moji
  else:
    moji = moji[0:len(moji)-1]
    return moji

for i in range(len(S)):
  if not List[i] == "B":
    res += List[i]
  else:
    res = responseB(res)
print(res)

Measured memory_bytes: 9056
import math
def main(n,m,a):
    hyou = sum(a)
    sikii = hyou / (4*m)
    count=0
    for i in range(len(a)):
        if a[i] >= sikii:
            count += 1
    return "Yes" if count >= m else "No"

n,m = map(int, input().split())
a = list(map(int, input().split()))
print(main(n,m,a))

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

using namespace std;

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

template<class T> void printvec(const vector<T>& v) {
  for (auto x : v) { cout << x << " "; }
  cout << endl;
}
template<class T> void printtree(const vector< vector<T> >& tree) {
  for (long long i = 0; i < tree.size(); ++i) {
    cout << i + 1 << ": "; printvec(tree[i]);
  }
}
template<class T, class U> void printmap(const map<T, U>& mp) {
  for (auto x : mp) { cout << x.first << "=>" << x.second << endl; }
}

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 rep(i, n) for(ll i = 0; i < n; ++i)
#define all(s) s.begin(), s.end()
#define sz(x) (ll)(x).size()
#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define eb emplace_back

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> triple;
typedef double D;
typedef vector<ll> vl;
typedef vector<P> vp;

const ll INF = 1e9;
const ll MOD = 1000000007;  // 1e9 + 7

int main(int argc, char** argv) {
  cin.tie(NULL);
  cout.tie(NULL);
  ios_base::sync_with_stdio(false);
  //cout << setprecision(10) << fixed;

  ll h1,m1,h2,m2,k;
  cin >> h1 >> m1 >> h2 >> m2 >> k;
  ll t1 = h1*60 + m1;
  ll t2 = h2*60 + m2;
  cout << (t2-t1-k) << endl;
}


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

using namespace std;

int main()
{
	string a,b;
	cin>>a>>b;
	
	int n = a.size()+1;
	int m = b.size()+1;
	
	int lcs[n][m];
	
	for(int i=0;i<n;i++)
	{
		for(int j = 0;j<m;j++)
		{
			if(i==0 or j==0)
			{
				lcs[i][j]=0;
			}
			else if(a[i-1]==b[j-1])
			{
				lcs[i][j] = lcs[i-1][j-1]+1;
			}
			else
			{
				lcs[i][j] = max(lcs[i][j-1],lcs[i-1][j]);
			}
		}
	}
	
	int i = n-1;
	int j = m-1;
	string ans = "";
	while(i!=0 and j!=0)
	{
		if(a[i-1]==b[j-1])
		{
			ans+=a[i-1];
			i--;j--;
		}
		else if( lcs[i][j-1]> lcs[i-1][j])
		{
			j--;
		}
		else
		{
			i--;
		}
	}
	reverse(ans.begin(),ans.end());
	cout<<ans;
}

Measured memory_bytes: 35456
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#define ll long long int
#define lim 100010
#define MIN(x,y) ((x)<(y)?(x):(y))
#define MAX(x,y) ((x)<(y)?(y):(x))
#define ABS(x) ((x)>0?(x):-(x))

int main(void){
	ll n,ans=0;
	scanf("%lld",&n);
	for(ll k=1;k*k<=n;k++){
		if(n%k==0){
			ll m = n/k;
			if(m-1>k)	ans+=m-1;
		}
	}
	printf("%lld",ans);
	
	return 0;
}

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

int main(){
    int N;
    long long A, ans = 0, N_ans, N_tmp = 0;
    long long tmp_A, tmp_num;
    long long n = 1, m = 0;

    std::cin >> N;
    vector<long long> numbers(N);

    for(long long i = 0; i < N; i++){
        std::cin >> numbers[i];
    }

    std::sort(numbers.begin(), numbers.end(), std::greater<long long>());

    ans = ans + numbers[0];
    n = 1;
    m = 1;

    while(n < N-1){
        if(n + 2 > N-1){
            ans = ans + numbers[m];
            n++;
            m++;
        }else{
            ans = ans + 2 * numbers[m];
            n = n + 2;
            m++;
        }
    }
 
    std::cout << ans;

}

Measured memory_bytes: 4816
import java.util.Scanner;

public class Main {

    public static void main(String[] args) throws Exception {
        try (Scanner sc = new Scanner(System.in)) {
            int X = sc.nextInt();
            int Y = sc.nextInt();

            if ((X + Y) % 3 != 0) {
                System.out.println(0);
                return;
            }

            int k = (X + Y) / 3;
            int i = 2 * k - X;
            int j = 2 * k - Y;

            if (i < 0 || j < 0) {
                System.out.println(0);
                return;
            }

            long kfac = 1;
            long ifac = 1;
            long jfac = 1;
            for (int n = 1; n <= k; n++) {
                kfac = kfac * n % 1000000007;
                if (n == i) {
                    ifac = kfac;
                }
                if (n == j) {
                    jfac = kfac;
                }
            }

            long ans = kfac;
            int m = 1000000007 - 2;
            while (m > 0) {
                if (m % 2 == 1) {
                    ans = ans * ifac % 1000000007;
                    ans = ans * jfac % 1000000007;
                    m--;
                }

                ifac = ifac * ifac % 1000000007;
                jfac = jfac * jfac % 1000000007;
                m = m / 2;
            }

            System.out.println(ans);
        }
    }

}


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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> pll;
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)

const ll MOD = 1000000007;
const ll INF = 1e18; //1*10^18
const double PI = 3.14159265;

int ctoi(char c)
{
  if (c >= '0' && c <= '9')
  {
    return c - '0';
  }
  return 0;
}

ll powll(ll a, ll n)
{ //O(log n)
  ll res = 1;
  while (n > 0)
  {
    if (n & 1) //(n & 1)=(n % 2 !=0)
    {
      res = res * a;
    }
    a = a * a;
    n >>= 1; //(n & 1)=(n % 2 !=0)
  }
  return res;
}

ll modpow(ll a, ll n, ll mod) //O(log n)
{
  ll res = 1;
  while (n > 0)
  {
    if (n & 1) //(n & 1)=(n % 2 !=0)
    {
      res = res * a % mod;
    }
    a = a * a % mod;
    n >>= 1; //(n>>=1)=(n/2)
  }
  return res;
}

int ReturnDigit(ll num)
{
  string number = to_string(num);
  return number.length();
}

const ll MAX = 1e4;
long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit()
{
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; i++)
  {
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}

// 二項係数計算
long long COM(int n, int k)
{
  if (n < k)
    return 0;
  if (n < 0 || k < 0)
    return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

struct UnionFind
{
  vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

  UnionFind(int N) : par(N)
  { //最初は全てが根であるとして初期化
    for (int i = 0; i < N; i++)
      par[i] = i;
  }

  int root(int x)
  { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
    if (par[x] == x)
      return x;
    return par[x] = root(par[x]);
  }

  void unite(int x, int y)
  {                   // xとyの木を併合
    int rx = root(x); //xの根をrx
    int ry = root(y); //yの根をry
    if (rx == ry)
      return;     //xとyの根が同じ(=同じ木にある)時はそのまま
    par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
  }

  bool same(int x, int y)
  { // 2つのデータx, yが属する木が同じならtrueを返す
    int rx = root(x);
    int ry = root(y);
    return rx == ry;
  }
};

int main()
{
  // srand((unsigned int)time(NULL));//--> rand()
  ll i, j, k, l, ans = 0;
  ll n;
  cin >> n;

  if (n != 1)
  {
    // ans += n - 1;
  }

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


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

int main(){
    int h, w;
    cin >> h >> w;
    string s[h];
    for(int i;i < h;i++) cin >> s[i];
    for(int i=0;i < h;i++){
        for(int j=0;j < w;j++){
            if(s[i][j] == '#') continue;
            if(s[i][j] == '.'){
                int counter = 0;
                if(j - 1 >= 0) if(s[i][j-1] == '#') counter++;
                if(j + 1 < w) if(s[i][j+1] == '#') counter++;
                if(i - 1 >= 0){
                    if(s[i-1][j] == '#') counter++;
                    if(j - 1 >= 0) if(s[i-1][j-1] == '#') counter++;
                    if(j + 1 < w) if(s[i-1][j+1] == '#') counter++;
                }
                if(i + 1 < h){
                    if(s[i+1][j] == '#') counter++;
                    if(j - 1 >= 0) if(s[i+1][j-1] == '#') counter++;
                    if(j + 1 < w) if(s[i+1][j+1] == '#') counter++;
                }
                s[i][j] = '0' + counter;
            }
        }
    }
    for(int i;i < h;i++) cout << s[i] << endl;
    return 0;
}


Measured memory_bytes: 256
// Code by Nguyen Huu Lam
#include<bits/stdc++.h>
using namespace std;

typedef long long LL;
typedef long double LD;

#define y0 Sword_Art_Online
#define y1 Your_lie_in_April
#define yn Darling_in_the_Franxx
#define tm Plastic_Memories
#define lr Charlotte
#define norm Weathering_with_you
#define left Violet_Evergarden
#define have Date_a_live
#define ends Your_name
#define prev Five_centimeters_per_second
#define hash Slient_voice

mt19937_64 rng(chrono::high_resolution_clock::now().time_since_epoch().count());

LL Rand(LL l, LL h){
    return uniform_int_distribution<LL>(l, h)(rng);
}

template <typename T> void read(T &t){
    t = 0; char ch = getchar(); int f = 1;
    while (!isdigit(ch)) { if (ch == '-') f = -1; ch = getchar(); }
    do { (t *= 10) += ch - '0'; ch = getchar(); } while (isdigit(ch)); t *= f;
}

const LL MaxN = 1 + 1e5;

LL n, d[MaxN];
LD kq;
pair<LD, LD> a[MaxN];
vector<LL> q;

void Caculate(){
    for(int i = 1 ; i < n ; ++i)
    kq += sqrt((a[q[i]].first - a[q[i - 1]].first) * (a[q[i]].first - a[q[i - 1]].first) + (a[q[i]].second - a[q[i - 1]].second) * (a[q[i]].second - a[q[i - 1]].second));
}

void Try(LL k){
    if(k == n){
        Caculate();
        return;
    }
    for(int i = 0 ; i < n ; ++i)
    if(!d[i]){
        d[i] = 1;
        q.push_back(i);
        Try(k + 1);
        q.pop_back();
        d[i] = 0;
    }
}

void InOut(){
    #define TASK "ABC"
    freopen(TASK".inp","r",stdin);
    freopen(TASK".out","w",stdout);
}

int main(){
    // InOut();
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin >> n;
    for(int i = 0 ; i < n ; ++i) cin >> a[i].first >> a[i].second;
    Try(0);
    LL gt = 1;
    for(int i = 2 ; i <= n ; ++i) gt *= i;
    cout << fixed << setprecision(6);
    cout << kq / gt << endl;

    return 0;
}

Measured memory_bytes: 384
#include<iostream>
using namespace std; // 575

int main() {
	int R, G, B, N, ans = 0;
	cin >> R >> G >> B >> N;
	for (int r = 0;r <= N;++ r) {
		for (int g = 0;g <= N;++ g) {
			if (r * R + g * G <= N && (N - r * R - g * G) % B == 0) ++ ans;
		}
	}
	cout << ans;
	return 0;
}
/*
31536000のコメント解説欄
ここテンプレで用意してるから、A問題とかだとこの先空欄の危険あり
また、コンテスト後に https://31536000.hatenablog.com/ で解説していると思うので、良かったら読んでねー

全部数え上げられるのでやるだけ
*/

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <random>
#include <cstdio>
#include <cstring>
#include <cmath>

// for i in f..<t { as swift
#define forin(i, f, t) for(auto i = f; i < t; i++)

using namespace std;
using ll = long long;
using XY = pair<int, int>;
//#include<bits/stdc++.h>

int main() {
    int q; cin >> q;
    vector<pair<ll, ll>> ab(q);
    for (auto &p : ab) cin >> p.first >> p.second;
    for (auto &p : ab) {
        ll a = p.first, b = p.second;
        if (a == b) {
            cout << min(a, b) * 2 - 2 << endl;
        } else if (abs(a - b) == 1) {
            cout << min(a, b) * 2 - 2 << endl;
        } else {
            auto c = ll(sqrt(a * b));
            if (c * c == a * b) {
                c--;
            }
            if (c * (c + 1) >= a * b) {
                cout << c * 2 - 2 << endl;
            } else {
                cout << c * 2 - 1 << endl;
            }
        }
    }
    
}



Measured memory_bytes: 256
def solve(n,m,c):
    INF=50001
    dp=[INF]*(n+1)
    dp[0]=0
    for i in range(m):
        v=c[i]
        for j in range(v,n+1):
            if dp[j-v]!=INF:
                dp[j]=min(dp[j-v]+1,dp[j])
    return dp[n]


n,m=map(int,input().split())
c=tuple(map(int,input().split()))
print(solve(n,m,c))


Measured memory_bytes: 7508
def get_gcd(elems)
  a = elems[-2]
  b = elems[-1]
  rest = a % b

  return b if rest.zero?
  return b if rest == b

  get_gcd([b, rest])
end

STDIN.read.chomp.split("\n").each do |list|
  elems = list.split.map(&:to_i).sort_by {|i| -i }
  gcd = get_gcd elems
  lcm = elems.inject(:*) / gcd

  puts "#{gcd} #{lcm}"
end

Measured memory_bytes: 8580
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;

int main() {
  string s;
  cin >> s;
  for (int i = 0; i < s.size(); i++) {
    cout << 'x';
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 256
# Amazing Maze
from collections import deque

while True:
    w, h = map(int, input().split())
    if w == 0:
        break
    lr_walls = []
    ud_walls = []
    for i in range(2 * h - 1):
        wall = list(map(int, input().split()))
        if i % 2 == 0:
            lr_walls.append(wall)
        else:
            ud_walls.append(wall)
    checked = [[False] * w for _ in range(h)]
    checked[0][0] = True
    que = deque()
    que.append((1, 0, 0))
    while que:
        score, x, y = que.popleft()
        if (x, y) == (w - 1, h - 1):
            print(score)
            break

        if x < w - 1 and lr_walls[y][x] == 0 and not checked[y][x + 1]:
            checked[y][x + 1] = True
            que.append((score + 1, x + 1, y))

        if x > 0 and lr_walls[y][x - 1] == 0 and not checked[y][x - 1]:
            checked[y][x - 1] = True
            que.append((score + 1, x - 1, y))

        if y < h - 1 and ud_walls[y][x] == 0 and not checked[y + 1][x]:
            checked[y + 1][x] = True
            que.append((score + 1, x, y + 1))

        if y > 0 and ud_walls[y - 1][x] == 0 and not checked[y - 1][x]:
            checked[y - 1][x] = True
            que.append((score + 1, x, y - 1))
    else:
        print(0)



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

typedef long long ll;
typedef unsigned long long ull;

ll gcd(ll x, ll y) {
  if (y == 0) return x;
  return gcd(y, x%y);
}

int main() {
  ll n;
  cin >> n;

  vector<ll> a(n);
  for (ll i = 0; i < n; ++i) {
    cin >> a[i];
  }

  vector<ll> l(n, 0);
  l[0] = a[0];
  for (ll i = 1; i < n; ++i) {
    l[i] = gcd(l[i-1], a[i]);
  }

  vector<ll> r(n, 0);
  r[n-1] = a[n-1];
  for (ll i = n-2; i >= 0; --i) {
    r[i] = gcd(r[i+1], a[i]);
  }

  ll ans = 0;
  for (ll i = 0; i < n; ++i) {
    if (i == 0) {
      ans = max(ans, r[1]);
    } else if (i == n-1) {
      ans = max(ans, l[n-2]);
    } else {
      ans = max(ans, gcd(l[i-1], r[i+1]));
    }
  }

  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 2560
#include <stdio.h>

int main(int argc,char *args[]){
    int i,j,h,w;

    while(1){
        scanf("%d %d",&h,&w);
        if(h==0 && w==0) break;
        for(i=0;i<h;i++){
            for(j=0;j<w;j++){
                printf((i+j)%2==0? "#":".");
            }
            printf("\n");
        }
        printf("\n");
    }
    return 0;
}




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

using namespace std;

const double EPS = 1e-9;

struct Point {
    double x, y, z;
    Point(double x, double y, double z) : x(x), y(y), z(z){
    }
    Point(){
    }
    
    Point operator - (const Point p){
        return (Point(x - p.x, y - p.y, z - p.z));
    }
};

typedef Point Vector;

Vector cross(Vector a, Vector b)
{
    return (Vector(a.y * b.z - a.z * b.y, a.z * b.x - a.x * b.z, a.x * b.y - a.y * b.x));
}

double dot(Vector a, Vector b)
{
    return (a.x * b.x + a.y * b.y + a.z * b.z);
}

double S(Point A, Point B, Point C)
{
    Vector R = cross(A - C, B - C);
    return (sqrt(dot(R, R)) / 2);
}

Point in()
{
    int x, y, z;
    scanf("%d %d %d", &x, &y, &z);
    return (Point(x, y, z));
}

int main()
{
    Point u, v;
    Point t[3];
    
    u = in(); v = in();
    for (int i = 0; i < 3; i++) t[i] = in();
    
    if (fabs(S(u, t[0], t[1]) + S(u, t[1], t[2]) + S(u, t[2], t[0]) - S(t[0], t[1], t[2])) <= EPS)
        return (!printf("MISS\n"));
    
    Point n = cross(t[0] - t[1], t[1] - t[2]);
    
    if (fabs(dot(v - u, n)) < EPS){
        if (fabs(dot(t[0] - u, n)) < EPS) return (!printf("MISS\n"));
        return (!printf("HIT\n"));
    }
    double m = dot(t[0] - u, n) * 1.0 / dot(v - u, n);
    
    Point P = v - u;
    P.x *= m; P.y *= m; P.z *= m;
    P.x += u.x; P.y += u.y; P.z += u.z;
    
    if (m <= -EPS) return (!printf("HIT\n"));
    
    if (fabs(S(P, t[0], t[1]) + S(P, t[1], t[2]) + S(P, t[2], t[0]) - S(t[0], t[1], t[2])) <= EPS && m <= 1)
        printf("MISS\n");
    else printf("HIT\n");
    
    return (0);
}

Measured memory_bytes: 1176
package main

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

func main() {
	sc := newScanner()
	var n = sc.readInt()
	var l = make([][]int, n)
	for i := 0; i < n; i++ {
		var a = make([]int, 2)
		for j := 0; j < 2; j++ {
			a[j] = sc.readInt()
		}
		l[i] = a
	}
	for i := 0; i < len(l)-2; i++ {
		if l[i][0] == l[i][1] && l[i+1][0] == l[i+1][1] && l[i+2][0] == l[i+2][1] {
			fmt.Println("Yes")
			return
		}
	}
	fmt.Println("No")

}

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

func abs(x int) int {
	if x >= 0 {
		return x
	}
	return -x
}

func min(values ...int) int {
	if len(values) == 0 {
		panic("no values")
	}

	min := values[0]
	for _, v := range values {
		if v < min {
			min = v
		}
	}
	return min
}

func max(values ...int) int {
	if len(values) == 0 {
		panic("no values")
	}

	max := values[0]
	for _, v := range values {
		if v > max {
			max = v
		}
	}
	return max
}

func pow(base, exponent int) int {
	if exponent < 0 {
		panic(fmt.Sprintf("exponent (%d) should not be a minus", exponent))
	}

	answer := 1
	for i := 0; i < exponent; i++ {
		answer *= base
	}
	return answer
}

func ceil(divident, dividor int) int {
	if dividor == 0 {
		panic("dividor should not be 0")
	}

	quo := divident / dividor
	rem := divident % dividor

	if rem != 0 {
		if (divident > 0 && dividor > 0) ||
			(divident < 0 && dividor < 0) {
			return quo + 1
		}
	}
	return quo
}

// -   sortutil

func reverseInts(a []int) {
	sort.Sort(sort.Reverse(sort.IntSlice(a)))
}

func reverseStrings(a []string) {
	sort.Sort(sort.Reverse(sort.StringSlice(a)))
}

// -   io

type scanner struct {
	bufScanner *bufio.Scanner
}

func newScanner() *scanner {
	bufSc := bufio.NewScanner(os.Stdin)
	bufSc.Split(bufio.ScanWords)
	bufSc.Buffer(nil, 100000000)
	return &scanner{bufSc}
}

func (sc *scanner) readString() string {
	bufSc := sc.bufScanner
	bufSc.Scan()
	return bufSc.Text()
}

func (sc *scanner) readInt() int {
	bufSc := sc.bufScanner
	bufSc.Scan()
	text := bufSc.Text()

	num, err := strconv.Atoi(text)
	if err != nil {
		panic(err)
	}
	return num
}

func (sc *scanner) readInt64() int64 {
	bufSc := sc.bufScanner
	bufSc.Scan()
	text := bufSc.Text()

	num, err := strconv.ParseInt(text, 10, 64)
	if err != nil {
		panic(err)
	}
	return num
}


Measured memory_bytes: 1776
#include<bits/stdc++.h>
using namespace std;
int main(){
  long long int n,d;
  cin>>n>>d;
  long long int x,y;
  long long int c=0;
  for(int i=0;i<n;i++){
      cin>>x>>y;
      if(sqrt(x*x+y*y)<=d)
        c++;
  }
  cout<<c<<"\n";
}

Measured memory_bytes: 3672
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstring>
#include <chrono>

using namespace std;

typedef long long ll;
typedef vector <int> vi;
typedef vector <vi> vvi;

const int mod = 1e9 + 7;

int add(int i, int j) {
    if((i += j) >= mod) i -= mod;
    return i;
}

int mult(int i, int j) { return (ll) i * j % mod; }

int dp[100000][2];
vvi vex;

int dfs(int i, int p, int c) {
    if(dp[i][c] != -1) return dp[i][c];
    int rx = 1;
    for(int& r : vex[i])
        if(r != p) {
            if(c) rx = mult(rx, dfs(r, i, 0));
            else rx = mult(rx, add(dfs(r, i, 0), dfs(r, i, 1)));
        }

    return dp[i][c] = rx;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    
    int n; cin >> n;
    int u, v;
    vex.resize(n);

    int root = chrono::high_resolution_clock::now().time_since_epoch().count() % n;
    while(--n) {
        cin >> u >> v;
        u -= 1; v -= 1;
        vex[u].push_back(v);
        vex[v].push_back(u);
    }
    
    memset(dp, -1, sizeof dp);
    cout << add(dfs(root, root, 0), dfs(root, root, 1));
    
    return 0;
}

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

using namespace std;
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

typedef long long ll;
typedef pair<ll, ll> P;
const ll INF = 1LL<<60;

ll gcd(ll a, ll b) {
  if(b == 0) return a;
  return gcd(b, a % b);
}

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

ll modpow(ll a, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}

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

  int N;
  cin >> N;
  vector<ll> a(N), b(N);
  rep(i, N){
    cin >> a[i];
  }

  rep(i, N){
    cin >> b[i];
  }

  ll sA = 0;
  ll sB = 0;
  ll sub = 0;
  ll cnt2 = 0;
  rep(i, N){
    sA += a[i];
    sB += b[i];
    if(b[i] < a[i]){
      sub += a[i]-b[i];
    }else{
      cnt2 += (b[i]-a[i]) / 2;
    }
  }

  if(sub <= sB - sA && sub <= cnt2){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }


  return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main() {
  int n,i;
  double s,m;
  cin>>n;
  vector<int> x(n);
  s=0;
  for(i=0;i<n;i++){
    cin>>x.at(i);
    s+=x.at(i);
  }
  m=s/n;
  if (m-int(m)<0.5) m=int(m);
  else m=int(m)+1;
  s=0;
  for(i=0;i<n;i++) s+=(x.at(i)-m)*(x.at(i)-m);
  cout<<s<<endl;
}

Measured memory_bytes: 256
/**
 *    author        : Saurav Paul 
 *    created       : August 02, 2020 6:04 PM
 *    Problem Name  : -X-
 *    Problem Limit : NULL , NULL
 *    Problem Url   : -X-
 *    @genarated by : ai-virtual-assistant
**/

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

int main(){
    ios_base::sync_with_stdio(false);

    long long n , d ;
    cin >> n >> d;

    long long cnt = 0 ;

    while(n--){
        double x , y ;
        cin >> x >> y ;

        long long t = ceil(sqrt(x*x+y*y)) ;
        if(t <= d) cnt ++  ;
    }

    cout << cnt << endl ;

    return 0 ;
}


Measured memory_bytes: 3916
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<queue>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep1(i, n) for (int i = 1; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1001001001;

int main() {
  int N, M;
  cin >> N >> M;
  int s[M], c[M];
  rep(i,M) cin >> s[i] >> c[i];

  int res[N];
  rep(i,N) res[i] = -1;
  rep(i,M) {
    int n = res[s[i]-1];
    if (n == -1) {
      res[s[i]-1] = c[i];
    } else {
      if (n != c[i]) {
        cout << -1 << endl;
        return 0;
      }
    }
  }
  int ans = 0;
  if (res[0] == -1 && (N != 1 || M != 0)) res[0] = 1;
  rep(i,N) {
    if (res[i] == -1) continue;
    else ans += res[i] * pow(10,N-1-i);
  }
  int len = to_string(ans).size();
  if (len != N) {
    cout << -1 << endl;
    return 0;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct Node
{
  int key;
  Node *parent, *left, *right;
};

Node *root, *NIL;

void insert(int k)
{
  Node *y = NIL;  // parent node of x
  Node *x = root; // root node of the tree
  Node *z;

  z = (Node *)malloc(sizeof(Node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while (x != NIL)
  {
    y = x;
    if (z->key < x->key)
    {
      x = x->left;
    }
    else
    {
      x = x->right;
    }
  }

  z->parent = y;
  if (y == NIL)
  {
    root = z;
  }
  else
  {
    if (z->key < y->key)
    {
      y->left = z;
    }
    else
    {
      y->right = z;
    }
  }
}

Node *find(Node *u, int k)
{
  while (u != NIL && k != u->key)
  {
    if (k < u->key)
      u = u->left;
    else
      u = u->right;
  }
  return u;
}

Node *treeMinimum(Node *x)
{
  while (x->left != NIL)
    x = x->left;
  return x;
}

Node *treeSuccessor(Node *x)
{
  if (x->right != NIL)
    return treeMinimum(x->right);
  Node *y = x->parent;
  while (y != NIL && x == y->right)
  {
    x = y;
    y = y->parent;
  }
  return y;
}

void treeDelete(Node *z)
{
  Node *y; // node to delete
  Node *x; // child of y

  // find node to delete
  if (z->left == NIL || z->right == NIL)
    y = z; // if z has no children or has only one child, delete z
  else
    y = treeSuccessor(z);

  if (y->left != NIL)
  {
    x = y->left;
  }
  else
  {
    x = y->right;
  }

  if (x != NIL)
  {
    x->parent = y->parent;
  }

  if (y->parent == NIL)
  {
    root = x;
  }
  else
  {
    if (y == y->parent->left)
    {
      y->parent->left = x;
    }
    else
    {
      y->parent->right = x;
    }
  }

  if (y != z)
  {
    z->key = y->key;
  }

  free(y);
}

void inorder(Node *u)
{
  if (u == NIL)
    return;
  inorder(u->left);
  cout << ' ' << u->key;
  inorder(u->right);
}

void preorder(Node *u)
{
  if (u == NIL)
    return;
  cout << ' ' << u->key;
  preorder(u->left);
  preorder(u->right);
}

int main()
{
  int N, x;
  string com;
  cin >> N;
  for (int i = 0; i < N; i++)
  {
    cin >> com;
    if (com == "insert")
    {
      cin >> x;
      insert(x);
    }
    else if (com == "find")
    {
      cin >> x;
      Node *t = find(root, x);
      if (t != NIL)
        cout << "yes" << endl;
      else
        cout << "no" << endl;
    }
    else if (com == "delete")
    {
      cin >> x;
      treeDelete(find(root, x));
    }
    else if (com == "print")
    {
      inorder(root);
      cout << endl;
      preorder(root);
      cout << endl;
    }
  }
}



Measured memory_bytes: 21872
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <algorithm>

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

using namespace std;

int main() {
  while(1){
    int t,p,r;
    cin>>t>>p>>r;
    if(!t)break;
    vector<vector<int>> v(t,vector<int>(p));
    REP(i,r){
      int tid,pid,time;
      string str;
      cin>>tid>>pid>>time>>str;
      --tid;--pid;
      if(str=="WRONG"){
        if(v[tid][pid]<=0)
          --v[tid][pid];
      }else{
        if(v[tid][pid]<=0){
          v[tid][pid] = time - v[tid][pid] * 1200;
        }
      }
    }
    vector<tuple<int,int,int>> sc;
    REP(i,t){
      int ac=0;
      int pen=0;
      REP(j,p){
        if(v[i][j]>0){
          ++ac;
          pen += v[i][j];
        }
      }
      sc.emplace_back(-ac,pen,i+1);
    }
    sort(begin(sc),end(sc));
    for(auto tp:sc){
      cout << get<2>(tp) << ' ' << -get<0>(tp) << ' ' << get<1>(tp) << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 1240
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<29;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-11;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

double d,sq=1.414213562373095048;

int main(){
	cin>>d;
	double res=d*sq;
	for(double t=1;t<d+eps;t+=1){
		double x=sqrt(d*d-t*t);
		if(x>=1) res=max(res,x+t);
		else res=max(res,t+1);
	}
	cout<<syosu(11)<<res<<endl;
}


Measured memory_bytes: 3272
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <queue>
#include <climits>
#include <set>
#include <map>
#include <stack>
#include <iomanip>
#include <tuple>
#define ll long long
using namespace std;
ll factorial(ll n){
    if(n==0){
        return 1;
    }
    else{
        return n*factorial(n-1);
    }
}

double dist(pair<double,double> a,pair<double,double> b){
	return sqrt(pow((a.first - b.first) ,2) + pow((a.second - b.second),2));
}
//繰り返し自乗法
double ism(double aa,ll p){
    double ap=aa;
    double ans=1;
    while(p>0){
        //cout<<"p="<<p<<",ap="<<ap<<endl;
        if(p&1){//奇数が真
            ans*=ap;
        }
        p/=2;
        ap=ap*ap;
    }
    return ans;

}
//繰り返し自乗法(アマリトリバージョン)
ll ismm(ll aa,ll p,ll m){
    ll ap=aa;
    ll ans=1;
    while(p>0){
        //cout<<"p="<<p<<",ap="<<ap<<endl;
        if(p&1){//奇数が真
            ans=(ans*ap)%m;    
        }
        p/=2;              
        ap=(ap*ap)%m;
    }
    return ans;

}

struct all_init
{
    all_init()
    {
        cout << fixed << setprecision(9);
    }
} All_init;


int main()
{
    ll n,b=-101,s=101;
    cin>>n;
    vector<ll>a(n);
    for(ll i=0;i<n;i++){
        cin>>a[i];
        b=max(b,a[i]);
        s=min(s,a[i]);
    }
    ll t=0;
    ll ans=LLONG_MAX;
    for(ll j=s;j<=b;j++){
        for(ll i=0;i<n;i++){
            t+=ism(j-a[i],2);
        }
        ans=min(t,ans);
        t=0;
    }
    cout<<ans<<endl;

    
    
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;
 
static const int INF = 1000000000;
  
int cntW[2005][4005];
int cntB[2005][4005];
int dp[4005][2005];
int baseW[4005];
int baseB[4005];
 
inline int calc(const vector<int>& A, const vector<string>& C, int j, int k, int p){
  if(p<0 || 4005<=p || j<0 || k<0 || 2005<=j || 2005<=k) return 0;
  return cntW[j][p] + cntB[k][p];
}
 
int main(){
  int N;
  cin >> N;
  vector<string> C;
  vector<int> A;
  vector<int> posW(2005,-1);
  vector<int> posB(2005,-1);
  rep(i,2*N){
    string c;
    int a;
    cin >> c >> a;
    C.push_back(c);
    A.push_back(a);
    if(c=="W") posW[a] = i+1;
    if(c=="B") posB[a] = i+1;
    
    if(c=="W"){
      cntW[a][i] = 1;
    }else{
      cntB[a][i] = 1;
    }
  }
 
  rep(i,2005){
    int cW = 0;
    int cB = 0;
    rep(j,4005){
      dp[j][i] = INF;
      
      cW += baseW[j];
      cB += baseB[j];
      cntW[i][j] = cW;
      cntB[i][j] = cB;
    }
    int pW = posW[i+1]-1;
    if(pW >= 0) baseW[pW] = 1;
    int pB = posB[i+1]-1;
    if(pB >= 0) baseB[pB] = 1;
  }
  
  dp[0][0] = 0;
  rep(i,2*N){
    rep(j,min(i+1,N+1)){
      if(dp[i][j] == INF) continue;
      int k = i-j;
      if(k < 0 || k > N) continue;
 
      {
        int p = posW[j+1];
        int add = calc(A, C, j, k, p-1);
        dp[i+1][j+1] = min(dp[i+1][j+1], dp[i][j] + p-add-1);
      }
      {
        int p = posB[k+1];
        int add = calc(A, C, j, k, p-1);
        dp[i+1][j] = min(dp[i+1][j], dp[i][j] + p-add-1);
      }
    }
  }
 
  cout << dp[2*N][N] << endl;
  
  return 0;
}




Measured memory_bytes: 94592
package main

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

func configure(scanner *bufio.Scanner) {
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
}
func getNextString(scanner *bufio.Scanner) string {
	scanned := scanner.Scan()
	if !scanned {
		panic("scan failed")
	}
	return scanner.Text()
}
func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}
func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}
func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}
func main() {
	fp := os.Stdin
	wfp := os.Stdout
	extra := 0
	if os.Getenv("I") == "IronMan" {
		fp, _ = os.Open(os.Getenv("END_GAME"))
		extra = 100
	}
	scanner := bufio.NewScanner(fp)
	configure(scanner)
	writer := bufio.NewWriter(wfp)
	defer func() {
		r := recover()
		if r != nil {
			fmt.Fprintln(writer, r)
		}
		writer.Flush()
	}()
	solve(scanner, writer)
	for i := 0; i < extra; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
}
func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	n := getNextInt(scanner)
	l := getNextInt(scanner)
	aa := make([]int, n)
	for i := 0; i < n; i++ {
		aa[i] = getNextInt(scanner)
	}
	deq := make([]int, n+1)
	s := 0
	t := 0
	ans := make([]int, n-l+1)
	for i := 0; i < n; i++ {
		for t >= 0 && aa[deq[t]] >= aa[i] {
			t--
		}
		t++
		deq[t] = i
		if s > t {
			s = t
		}
		for s < n+1 && deq[s] < i-l+1 {
			s++
		}
		if i-l+1 < 0 {
			continue
		}
		ans[i-l+1] = aa[deq[s]]
	}
	for i := 0; i < n-l+1; i++ {
		if i > 0 {
			fmt.Fprint(writer, " ")
		}
		fmt.Fprint(writer, ans[i])
	}
	fmt.Fprintln(writer, "")
}



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

using ll= long long;
const ll INF=1LL<<60;
const ll MOD=1e9+7;

int Count_div(int num){
    int cnt=0;
    for(int i=1; i*i<=num; i++){
        if(num%i == 0){
            if(i*i == num) cnt++;
            else cnt+=2;
        }
    }
    return cnt;
}

int main(){
    int N; cin >> N;
    int res=0;
    for(int num=1; num<=N; num+=2){
        if(Count_div(num) == 8) res++;
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>

int c[4];

int main()
{
  for (int i = 0; i < 3; ++i)
  {
    int a, b;
    scanf("%d%d", &a, &b);
    --a, --b;
    c[a]++; c[b]++;
    if (c[a] >= 3 || c[b] >= 3)
    {
      puts("NO");
      return 0;
    }
  }
  puts("YES");
  return 0;
}

Measured memory_bytes: 128
/*"Success isn't permanent, failure isn't fatal,
                                      it's the courage to continue that counts"*/
#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;
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
#define ll long long 
#define scn(n) scanf("%d",&n)
#define lscn(n) scanf("%lld",&n)
#define lpri(n) printf("%lld",n)
#define pri(n) printf("%d",n)
#define pln() printf("\n")
#define priln(n) printf("%d\n",n)
#define lpriln(n) printf("%lld\n",n)
#define rep(i,init,n) for(int i=init;i<n;i++)
#define pb push_back     
#define mp make_pair
#define F first
#define S second
#define gcd __gcd
#define inf INT_MAX
#define ninf INT_MIN
const int mod=1e9+7;         
const int N=1e5+4;

int main()
{
	int a,b,c,k;

	cin>>a>>b>>c>>k;

	int ans=0;

	if(k<=a+b)
	ans=min(k,a);
	else
	ans=a-(k-(a+b));

	pri(ans);

    return 0;
}


Measured memory_bytes: 3600
from decimal import Decimal
import math
a,b = list(map(float, input().split()))
b *= 1000
A = int(a)
B = int(b)
#print(a)
#print(b)

#ab = a*b
#print(ab)

#ac = Decimal(a*b)
print(A*B//1000)


 

Measured memory_bytes: 9864