akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll p = 1000000007;
int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll h,w;
    cin >> h >> w;
    char a[h][w];
    for(ll i = 0;i < h;i++){
    	for(ll j = 0;j < w;j++){
    		cin >> a[i][j];
    	}
    }
    ll dp[h][w];
    memset(dp,0,h*w*sizeof(ll));
    dp[0][0] = 1;
    for(ll i = 1;i < w;i++){
    	if(a[0][i] == '.'){
    		dp[0][i] = dp[0][i-1];
    	}
    }
    for(ll i = 1;i < h;i++){
    	if(a[i][0] == '.'){
    		dp[i][0] = dp[i-1][0];
    	}
    }
    for(ll i = 1;i < h;i++){
    	for(ll j = 1;j < w;j++){
    		if(a[i][j] == '.'){
    			dp[i][j] = (dp[i-1][j]+dp[i][j-1])%p;
    		}
    	}
    }
    cout << dp[h-1][w-1] << endl;
}


Measured memory_bytes: 9088
#include <bits/stdc++.h>
#define ll long long int

using namespace std;

int main(){
	cin.tie(0); ios::sync_with_stdio(0);
	
	string a, b;
	cin >> a >> b;
	int ans = 0;
	for(int i = 0; i < 3; i++){
		ans += a[i] == b[i];
	}
	cout << ans << endl;
}

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

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

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

double now(double a[], int  n){
	double cnt = a[0];
	for(int i=1;i<n;i++){
		a[i] = (a[i-1]+a[i])/2.00;
		cnt = a[i];
	}
	return cnt;
}

int solve() 
{
  //happy coding

  int  n;
  cin>>n;
  double a[n];
  for(int i=0;i<n;i++){
  	cin>>a[i];
  }
  sort(a,a+n);
  double sum = 0;
  do{
  	sum = max(sum,now(a,n));
  	///cout<<"ok"<<endl;
  }while(next_permutation(a,a+n));
  cout<<sum<<endl;
  
  return 0;
}
int main(){
  int test = 1;
  //scanf("%d", &test);
  while (test--)solve();return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
	long long int N,i,j,yaku;
	while(scanf("%lld",&N)){
		if(N==0)break;
		yaku=0;
		for(i=1;i*i<=N;i++){
			if(N%i==0){
				yaku+=i+N/i;
			}
			if(N==i*i){
				yaku-=i;
			}
			if(yaku>2*N)break;
		}
		//printf("%d\n",yaku);
		if(yaku>2*N){
			puts("abundant number");
		}else if(yaku==2*N){
			puts("perfect number");
		}else{
			puts("deficient number");
		}
	}
	return 0;
}

Measured memory_bytes: 0
#pragma GCC optimize("O3")
#include<iostream>
#include<algorithm>
#include<string>
#include<cmath>
#include<set>
#include<vector>
#include<sstream>
#include<queue>
#include <iomanip>
#include <fstream>
#include<unordered_set>
#include<stack>
#include <map>
#include<time.h>
#include <chrono>
constexpr auto INF = 9223372036854775807;
typedef long long int ll;
typedef unsigned long long int ull;
typedef unsigned long int ul;
#define f(i,a,b) for(ll i=(ll)a;i<(ll)b;i+=1)
#define rf(i,a,b) for(ll i=(ll)a;i>=(ll)b;i-=1)
#define endl '\n'
#define N 1000000007 // prime modulo value 
#define all(x) x.begin(),x.end()
using namespace std;
#define MAX 1000001 
#define M 998244353
ll inverse(ll n)
{
	ll modu = M;
	ll m = modu;
	ll a = 0, b = 1;
	if (modu == 1)
		return 0;
	while (n > 1)
	{
		ll quo = n / modu;
		ll temp = modu;
		modu = n % modu, n = temp;
		temp = a; 
		a = b - (quo * a);
		b = temp;
	}
	if (b < 0)
		b += m;
	return b;
}
int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	ll h, n;
	cin >> h >> n;
	f(i, 0, n)
	{
		ll temp = 0;
		cin >> temp;
		h -= temp;
	}
	if (h <= 0)
		cout << "Yes";
	else
		cout << "No";
	return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC114 {
	class ABC114_C {
		static void Main(string[] args) {
			var line = Console.ReadLine();
			var list = new List<string>();
			var temp = new List<string>();
			var array = new string[3] {"3", "5", "7", };

			for(int i = 0; i < array.Length; i++)
				for(int j =0; j < array.Length; j++)
					for(int k = 0; k < array.Length; k++)
							list.Add(array[i] + array[j] + array[k]);
			list = list.Distinct().ToList();
			for(int i = array.Length+1; i <= line.Length; i++) {
				foreach (var item in list)
					foreach (var next in array)
						temp.Add(item + next);
				list = list.Concat(temp.Distinct()).Distinct().ToList();
			}

			Console.WriteLine(
				list.Where(s => s.Contains("3") && s.Contains("5") && s.Contains("7"))
				.Select(s => int.Parse(s)).Count(n => n <= int.Parse(line)));

		}
	}
}


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

int main(){
    string s,t; cin >> s >> t;
    ll q; cin >> q;
    vector<ll> ssum(s.size() + 1), tsum(t.size() + 1);
    rep(i,s.size())ssum[i+1] = ssum[i] + (s[i] == 'A' ? 1 : 2);
    rep(i,t.size())tsum[i+1] = tsum[i] + (t[i] == 'A' ? 1 : 2);
    rep(i,q){
        ll a,b; cin >> a >> b;
        a--;
        ll c,d; cin >> c >> d;
        c--;
        if((ssum[b] - ssum[a]) % 3 == (tsum[d] - tsum[c]) % 3){
            cout << "YES" << "\n";
        }
        else {
            cout << "NO" << "\n";
        }
    }
}

Measured memory_bytes: 2432
use std::io::{stdin, Read};
use std::str::FromStr;
use std::collections::HashSet;

fn read<T: FromStr>() -> Option<T> {
    let stdin = stdin();
    let s = stdin
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect::<String>();
    s.parse::<T>().ok()
}
 
fn main() {
    let n: usize = read().unwrap();
    let mut d: Vec<u64> = Vec::new();
 
    for _i in 0..n {
        let x: u64 = read().unwrap();
        d.push(x);
    }
    d.sort();

    let m: usize = read().unwrap();
    let mut t: Vec<u64> = Vec::new();
 
    for _i in 0..m {
        let x: u64 = read().unwrap();
        t.push(x);
    }
    t.sort();

    let mut used_d: HashSet<usize> = HashSet::new();

    let mut i: usize = 0;
    for x in &t {
        while i < n && d[i] < *x {
            i += 1;
        }
        if i < n && d[i] == *x {
            used_d.insert(i);
            i += 1;
            continue;
        } else { // i >= n or x < d[i]
            break;
        }
    }
    if used_d.len() == m {
        println!("YES");
    } else {
        println!("NO");
    }
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<vii> vvii;

#define fastIO ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
#define forw(i,l,r) for(int i=(l);i<(r);i++)
#define forb(i,r,l) for(int i=(r);i>(l);i--)
#define log2i(x) 32 - __builtin_clz((x)) - 1
#define log2ll(x) 64 - __builtin_clzll((x)) - 1
#define Pi acos(-1.0)
#define sz(x) (int)x.size()
#define pw(x,y) trunc(exp(log((x))*(y)))
#define mt make_tuple
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

string st;

int main() {
#ifndef ONLINE_JUDGE
    //freopen("test.inp","r",stdin);
    //freopen("test.out","w",stdout);
#endif
    fastIO;
    cin >> st;
    if(count(all(st),'A')==2||count(all(st),'B')==2) cout << "Yes";
    else cout << "No";
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=110,M=1e5+10,MOD=1e9+7;
int a[N],dp[2][M],sum[2][M];
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<<1)+(x<<3)+(ch&15),ch=getchar();
	return x*f;
}
int main()
{
	int n=read(),K=read();
	for (register int i=1;i<=n;++i) a[i]=read();
	dp[0][0]=1;for (register int i=0;i<=K;++i) sum[0][i]=1;
	int d=1;
	for (register int i=1;i<=n;++i)
	{
		dp[d][0]=1;sum[d][0]=1;
		for (register int j=1;j<=K;++j)
		{
			dp[d][j]=sum[d^1][j];if (j-a[i]>0) dp[d][j]=(dp[d][j]-sum[d^1][j-a[i]-1]+MOD)%MOD;
			sum[d][j]=(sum[d][j-1]+dp[d][j])%MOD;
		}
		d^=1;
	}
	printf("%d\n",dp[d^1][K]);
	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)a;i<(int)b;++i)
int main(){
    int a,b,c;cin>>a>>b>>c;
    int cnt=0;
    repi(i,a,b+1)if(c%i==0)cnt++;
    cout<<cnt<<endl;
    return 0;
}


Measured memory_bytes: 3092
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

#define pb push_back
#define all(v) begin(v), end(v)
#define debug(x) cerr<< #x <<": "<<x<<endl
#define debug2(x,y) cerr<< #x <<": "<< x <<", "<< #y <<": "<< y <<endl

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<i_i, int> p_i;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
template<class T> using vv=vector<vector< T > >;
typedef deque<int> di;
typedef deque<deque<int> > ddi;

int main() {
  while(true) {
    int n;
    cin >> n;
    if (n == 0) { break; }
    priority_queue<char> pq;
    map<char, char> map;
    for (int i = 0; i < n; ++i) {
      char tmp1, tmp2;
      cin >> tmp1 >> tmp2;
      pq.push(tmp1);
      map[tmp1] = tmp2;
    }
    deque<char> set;
    for (int i = 0; i < n; ++i) {
      set.push_front(pq.top());
      pq.pop();
    }

    int m;
    cin >> m;
    string str;
    for (int i = 0; i < m; ++i) {
      char tmp;
      cin >> tmp;
      if (lower_bound(all(set), tmp) == upper_bound(all(set), tmp)) {
      } else {
        tmp = map[tmp];
      }
      str += tmp;
    }
    str += "\n";
    cout << str;
  }

  return 0;
}

Measured memory_bytes: 3144
#pragma GCC optimize(3, "Ofast", "inline")

#include <bits/stdc++.h>

#define start ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long
#define int ll
#define ls st<<1
#define rs st<<1|1
#define pii pair<int,int>
#define rep(z, x, y) for(int z=x;z<=y;++z)
#define com bool operator<(const node &b)
using namespace std;
const int maxn = (ll) 3e5 + 5;
const int mod = 1e9 + 7;
const int inf = 0x3f3f3f3f;
int T = 1;
int cntb, cnta, cntab;
int fac[maxn];

void solve() {
    fac[0] = 1;
    rep(i, 1, maxn - 1)fac[i] = fac[i - 1] * 2 % mod;
    map<pii, int> mp;
    int n;
    cin >> n;
    rep(i, 1, n) {
        int a, b;
        cin >> a >> b;
        if (a * b == 0) {
            if (a == 0 && b == 0)
                ++cntab;
            else if (a == 0)
                ++cnta;
            else if (b == 0)
                ++cntb;
            continue;
        }
        int d = __gcd(a, b);
        a /= d, b /= d;
        if (a * b < 0)
            a = -abs(a), b = abs(b);
        else
            a = abs(a), b = abs(b);
        mp[pii(a, b)]++;
    }
    int ans = ((fac[cnta] + fac[cntb] - 1) % mod + mod) % mod;
    for (auto &to:mp) {
        if (to.second == 0)
            continue;
        int a = to.first.first, b = to.first.second;
        int num = to.second;
        pii j = a > 0 ? pii(-b, a) : pii(b, -a);
        ans = ans * ((fac[num] + fac[mp[j]] - 1 + mod) % mod) % mod;
        mp[j] = 0;
    }
    cout << (ans - 1 + cntab + mod) % mod;
}

signed main() {
    start;
    while (T--)
        solve();
    return 0;
}

Measured memory_bytes: 30912
import bisect,collections,copy,itertools,math,string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def main():
    n,c,k = LI()
    ans = 0
    cnt = 0
    period = -1
    dps = [None for _ in range(n)]
    for i in range(n):
        dps[i] = I()
    dps.sort()
    
    for dp in dps:        
        if cnt == c or dp > period:
            ans += 1
            cnt = 1
            period = dp+k
        else:
            cnt += 1

    print(ans)
main()            


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

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,a,b,x;
    cin >> n >> a >> b;
    if(b==a && n==1){
        cout << 1 << "\n";
        return 0;
    }

    if(b>=a && n>1){

         x=(n-2)*(b-a);


        cout << x+1 << "\n";}

    else
        cout << 0 << "\n";
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdbool.h>
int main(void){
    int x,y;
    while(1){
        scanf("%d %d",&x,&y);
        if(x==0&&y==0)break;
        if(x<y){
            printf("%d %d\n",x,y);
        }
        else{
            printf("%d %d\n",y,x);
        }
    }
    return 0;
}


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

typedef long long ll;

ll mod;
vector<int> adj[100010];

ll in[100010], out[100010];
int l[100010], r[100010], cnt = 0;

void dfs_in(int u, int p) {
    in[u] = 1;
    l[u] = cnt++;
    for(int v : adj[u]) {
        if(v == p) continue;
        dfs_in(v, u);

        in[u] *= (in[v] + 1) % mod;
        in[u] %= mod;
    }
    r[u] = cnt++;

}

void dfs_out(int u, int p) {
//    cout << u << " " << p << endl;
    vector<int> children;
    for(int v : adj[u]) {
        if(v == p) continue;
        children.push_back(v);
//        cout << in[v] << " ";
    }
//    cout << endl;

    int m = children.size();

    vector<ll> prefix(m), suffix(m);
    for(int i = 0; i < m; i++) {
        int v = children[i];
        prefix[i] = ((in[v] + 1) * (i > 0 ? prefix[i - 1] : 1)) % mod;
        prefix[i] %= mod;
//        cout << prefix[i] << " ";
    }
//    cout << endl;
    for(int i = m - 1; i >= 0; i--) {
        int v = children[i];
        suffix[i] = ((in[v] + 1) * (i < m - 1 ? suffix[i + 1] : 1)) % mod;
        suffix[i] %= mod;
//        cout << suffix[i] << " ";
    }
//    cout << endl;


    for(int i = 0; i < m; i++) { //childs of u
        int v = children[i];

        ll brothers = ((i > 0 ? prefix[i - 1] : 1) * (i < m - 1 ? suffix[i + 1] : 1)) % mod;

        out[v] = 1 + (brothers * out[u]) % mod;
        out[v] %= mod;

//        cout << "out v " << v << " " << out[v] << endl;

        dfs_out(v, u);
    }
}

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

    int n;
    cin >> n >> mod;

    for(int i = 1; i < n; i++) {
        int u, v;
        cin >> u >> v;

        u--, v--;

        adj[u].push_back(v);
        adj[v].push_back(u);
    }

    dfs_in(0, -1);

    out[0] = 1;
    dfs_out(0, -1);

    for(int i = 0; i < n; i++) {
        //cout << in[i] << " " << out[i] << endl;
        cout << (in[i] * out[i]) % mod << endl;
    }
}


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

using namespace std;

//#define MD 10

int main(){
    int n;
    cin>>n;
    long int sum=0;
    vector<int> t(n+3);
    for(int i=0;i<n;i++){
        cin>>t[i];
        sum+=t[i];
    }
    int m;
    cin>>m;
    int p[200][3]={0};
    for(int i=0;i<m;i++){
        cin>>p[i][0]>>p[i][1];
    }
    
    for(int i=0;i<m;i++){
        sum-=t[p[i][0]-1];
        sum+=p[i][1];
        cout<<sum<<endl;
        sum+=t[p[i][0]-1];
        sum-=p[i][1];
    }
    
    return 0;
}

Measured memory_bytes: 256
import java.math.BigDecimal;
import java.util.Scanner;

public class Main {
	public static final int mod = 1000000007;
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt(),m = scanner.nextInt();
		if(Math.abs(n-m) > 1){
			System.out.println(0);
		}else{
			BigDecimal sum = new BigDecimal("0");
			n = fact(n);
			m = fact(m);
			BigDecimal N = new BigDecimal(String.valueOf(n));
			BigDecimal M = new BigDecimal(String.valueOf(m));
			sum = N.multiply(M);
			BigDecimal MOD = new BigDecimal("1000000007");
			sum = sum.remainder(MOD);
			if(Math.abs(n-m) > 0){
				System.out.println(sum);
			}else{
				BigDecimal two = new BigDecimal("2");
				sum = sum.multiply(two);
				sum = sum.remainder(MOD);
				System.out.println(sum);
			}
		}
	}
	public static int fact(int n){
		long fact = 1;
		if (n == 0){
			return  (int)fact;
		}else {
			for(int i=n;i>0;i--){
				fact *= i;
				fact %= mod;
			}
			return (int)fact;
		}
	}
}


Measured memory_bytes: 21332
#include <bits/stdc++.h>
#define repl(i, l, r) for (ll i = l; i < r; i++)
#define rep(i, n) repl(i, 0, n)
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<int, int>;

int main()
{
    int n;
    cin >> n;
    vector<int> t(n);
    rep(i, n) cin >> t[i];
    int sum = 0;
    rep(i, n) sum += t[i];
    int m;
    cin >> m;
    rep(i, m) {
        int p, x;
        cin >> p >> x;
        p--;
        cout << sum - (t[p] - x) << endl;
    }
    return 0;
}

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

int main() {
 string S;
 int N,K;

 cin>>N>>K>>S;

 if (S.at(K-1)=='A'){S.at(K-1)='a';}
 else if(S.at(K-1)=='B'){S.at(K-1)='b';}
 else if(S.at(K-1)=='C'){S.at(K-1)='c';}

 cout << S <<endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	char buf;
	int buf_cnt = 0;
	int c[3];
	int my_cards;
	int ok = 0;
	int cnt = 0;
	double probability;
	for (int i = 0; i < 3; i++)
	{
		c[i] = 0;
	}
	
	while ((buf = getchar()) != EOF)
	{
		if (buf >= '0' && buf <= '9')
		{
			buf -= '0';
			c[buf_cnt] = c[buf_cnt] * 10 + buf;
			continue;
		}
		else if (buf != '\n')
		{
			if (c[buf_cnt] != 0)
			{
				buf_cnt++;
				continue;
			}
			else if (buf_cnt < 3)
			{
				continue;
			}
		}
		else
		{
			if (c[2] == 0)
			{
				for (int i = 0; i < 3; i++)
				{
					c[i] = 0;
				}
				continue;
			}
		}

		my_cards = c[0] + c[1];

		for (int i = 1; i <= 10; i++)
		{
			//c[0],2,c3??¨?¢??????´???????????????
			if (i == c[0] || i == c[1] || i == c[2])
			{
				continue;
			}

			if (my_cards + i <= 20)
			{
				ok++;
			}
			cnt++;
		}
		probability = (double)ok / (double)cnt;

		if (probability >= 0.5)
		{
			printf("YES\n");
		}
		else
		{
			printf("NO\n");
		}
		for (int i = 0; i < 3; i++)
		{
			c[i] = 0;
		}
		ok = 0;
		cnt = 0;
		buf_cnt = 0;
	}

	return 0;
}

Measured memory_bytes: 2452
#include<iostream>
#include<string>
#include<algorithm>
#include <stdio.h>
using namespace std;
int main() {
  string S;
  cin >>S;
  long long ans=0;
  int n=S.length()-1;
  for(int bit=0; bit<(1<<n);bit++)
  {
      long long sum=0;
      long long a=S[0]-'0';
      for(int i=0;i<n;i++){
        if(bit & (1<<i)){
          sum+=a;
          a=0;
        }
        a=a*10+S[i+1]-'0';
      }
      sum+=a;
      ans+=sum;

  }
  cout <<ans<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

int main() {
    ios_base::sync_with_stdio(0);
    int a, b; cin >> a >> b;

    for (int i=1;i<=1000;i++) {
        int x = i*0.08, y = i*0.1;
        if (x==a&&y==b) {
            cout << i << endl;
            return 0;
        }
    }
    cout << -1 << endl;
}


Measured memory_bytes: 3552
import java.util.Scanner;

public class Main {
    Scanner in = new Scanner(System.in);
    public static void main(String[] args) {
        new Main().solve();
    }

    void solve(){
        int w, s;
        s = in.nextInt();
        w = in.nextInt();

        System.out.println( (w >= s) ? "unsafe" : "safe" );

    }

}


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

int main(){
  int n, min;
  string st;
  cin >> n;
  cin >> st;
  min = n;
  vector<int> vw, ve;
  vw.resize(n);
  ve.resize(n);
  for(int i=0;i<n;i++){
    if(st[i]=='W'){
      vw[i] = 1;
      ve[i] = 0;
    }
    else{
      vw[i] = 0;
      ve[i] = 1;
    }
  }
  for(int i=1;i<n;i++){
    vw[i] = vw[i] + vw[i-1];
    ve[i] = ve[i] + ve[i-1];
  }
  for(int i=0;i<n;i++){
    if(i==0){
      if(min > ve[n-1] - ve[0])min = ve[n-1] - ve[0];
    }
    else if(i==n-1){
      if(min > vw[n-2])min = vw[n-2];
    }
    else{
      if(min > vw[i-1] + ve[n-1] - ve[i])min = vw[i-1] + ve[n-1] - ve[i];
    }
  }
  cout << min << endl;
  return 0;
}


Measured memory_bytes: 3076
#include <iostream>

using namespace std;

#define PRIMENUM 1000000

int isPrime[PRIMENUM];

void makePrimeNumber(){

	isPrime[2]=1;
	isPrime[3]=1;

	for(int i=4;i<PRIMENUM;i++){
		int flag=0;
		for(int j=2;j*j<=i;j++){
			if(i%j==0){
				flag=1;
				break;
			}
		}
		if(flag==0){
			isPrime[i]=1;
			//cout<<i<<endl;
		}	
	}

}


int main(){

	makePrimeNumber();

	int a,d,n;

	while(cin>>a>>d>>n){
		if(a==0 && d==0 && n==0)break;

		int cnt=0;
		while(1){
			if(isPrime[a]==1){
				cnt++;
			}
			if(cnt==n){
				break;
			}
			a+=d;
		}
		cout<<a<<endl;
	}

	return 0;
}

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

using ll = long long;
using ull = unsigned long long;
using st = string;
using ch = char;
using db = double;
using bl = bool;
using vll = vector<long long>;
using vdb = vector<db>;
using vst = vector<st>;
using vch = vector<char>;
using vbl = vector<bl>;
using vvll = vector<vll>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
using vvpll = vector<vpll>;
#define rep(i, m, n) for (ll i = (ll)(m); i < (ll)(n); i++)
#define vrep(i, vec) for(auto& i : vec)
#define vin(vec) for(auto& i : vec) cin >> i
#define all(v) v.begin(), v.end()
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;}
const ll mod = 1000000007;
const ll inf = 1LL << 60;
const db pi = acos(-1.0L);

int main(){
	st s, t;
	cin >> s >> t;
	st tt = t.substr(0, s.size());
	cout << (s == tt ? "Yes" : "No") << endl;
}

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

#define ll long long

int main(){
  
  ll n, a, b;
  cin >> n >> a >> b;
  
  ll diff = (b - a);
  ll par = diff & 1;
  
  ll res;
  
  if(par){
    ll meet_at_1 = (a - 1) + 1 + (b - (a - 1) - 1) / 2;
    ll meet_at_n = (n - b) + 1 + (n - (a + (n - b))) / 2;
    res = min(meet_at_1, meet_at_n);
  }
  else{
    res = diff / 2;
  }
  
  cout << res << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdint>
#include <cstdio>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

using i64 = int64_t;

const string YES = "yes";
const string NO  = "no";

string T, P;
int N, M;

int main() {
    cin >> T >> P;
    N = T.size(); M = P.size();

    int pi = M;
    bool flag = true;
    for (int j = N-1; j >= 0; --j) {
        if (pi > 0 && T[j] == P[pi-1]) {
            --pi;
        } else if (pi < M && T[j] == P[pi]) {
            flag = false;
        }
    }
    cout << (pi == 0 && flag ? YES : NO) << endl;
    return 0;
}

Measured memory_bytes: 4236
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<string>
#include<iostream>
#include<iostream>
#include<cctype>
#include<cstdio>
#include<vector>
#include<stack>
#include<queue>
#include <algorithm>
#include<math.h>
#include<set>
#include<map>
#include <sstream>
#include<iomanip>
#include <ctype.h>
using namespace std;

//#include<bits/stdc++.h>

int main() {

	int n;
	cin >> n;
	bool f[110] = {};
	f[0] = 1;
	for (int i = 0; i <= n; i++) {
		if (f[i]) {
			f[i + 4] = 1;
			f[i + 7] = 1;
		}
	}
	if (f[n])cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 256
def update_queue(n, queue):
    out = queue[n]
    mod10 = out % 10
    if mod10 != 0:
        queue.append(10 * out + mod10 - 1)
    queue.append(10 * out + mod10)
    if mod10 != 9:
        queue.append(10 * out + mod10 + 1)

    return out, queue

N = int(input())
Q = [1,2,3,4,5,6,7,8,9]

for i in range(N):
    out, Q = update_queue(i, Q)

print(out)

Measured memory_bytes: 88028
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)

using namespace std;

int main() {
   int a,b,c,d,e,k;
   cin >> a >> b >> c >> d >> e >> k;
   cout << (e-a<=k ? "Yay!" : ":(") << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
    int tmp,h,m,s;

    scanf("%d",&tmp);

    h=tmp/3600;
    tmp=tmp%3600;

    m=tmp/60;
    tmp=tmp%60;

    s=tmp;

    printf("%d:%d:%d\n",h,m,s);

    return 0;
}

Measured memory_bytes: 592
//
// Created by yamunaku on 2019/09/21.
//

#include <bits/stdc++.h>

using namespace std;

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repl(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perl(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD9 998244353
#define MOD1 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define CFS cin.tie(0);ios::sync_with_stdio(false)
#define CST(x) cout<<fixed<<setprecision(x)

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<int>> mti;
typedef vector<ll> vl;
typedef vector<vector<ll>> mtl;

class unionFind{
    vi node;
public:
    unionFind(int n){
        node = vi(n);
        iota(all(node), 0);
    }

    int root(int x){
        if(node[x] == x)return x;
        return node[x] = root(node[x]);
    }

    void uni(int x, int y){
        x = root(x);
        y = root(y);
        if(x != y) node[x] = y;
    }

    int ans(){
        set<int> st;
        rep(i, node.size() - 1){
            st.insert(root(i));
        }
        return st.size();
    }
};

int main(){
    int n, k;
    cin >> n >> k;
    vi p(n);
    rep(i, n) cin >> p[i];
    unionFind uf(n - k + 2);
    priority_queue<pair<int, int>> q1, q2;
    int pre = -1, count = 1;
    rep(i, k){
        if(p[i] > pre) count++;
        else count = 1;
        pre = p[i];
        q1.push({-p[i], -i});
        q2.push({p[i], -i});
    }
    if(count >= k){
        uf.uni(0, n - k + 1);
    }
    repl(i, k, n){
        if(p[i] > pre) count++;
        else count = 1;
        pre = p[i];
        if(count >= k){
            uf.uni(i - k + 1, n - k + 1);
        }
        int a = q1.top().second;
        while(-q1.top().second <= i - k) q1.pop();
        while(-q2.top().second <= i - k) q2.pop();
        q1.push({-p[i], -i});
        q2.push({p[i], -i});
        int b = q2.top().second;
        if(-a == i - k && -b == i){
            uf.uni(i - k, i - k + 1);
        }
    }
    cout << uf.ans() << endl;
    return 0;
}


Measured memory_bytes: 14124
using System;

using static System.Console;

class Program {
    static void Main(string[] args) {
        int i;
        int len;
        int ans = 0;
        string s;

        var n = int.Parse(ReadLine());

        for (i = 1; i < n + 1; i++) {
                s = i.ToString();
                len = s.Length;
                if(len % 2 == 1) {
                    ans += 1; 
                }
            }
            WriteLine(ans);
        }
    }

Measured memory_bytes: 13140
#include <bits/stdc++.h>
using i64 = long long;

std::vector<std::vector<int>> g;

int dfs(int v, int p) {
    std::vector<int> a;
    for (int to : g[v]) {
        if (to == p) continue;
        a.push_back(dfs(to, v));
    }
    if (a.empty()) return 0;
    std::sort(a.begin(), a.end(), std::greater<>());
    for (int i = 0; i < a.size(); i++) a[i] += i + 1;

    return *std::max_element(a.begin(), a.end());
}

int main() {
    int n;
    std::cin >> n;
    g.resize(n);
    for (int i = 1; i < n; i++) {
        int p;
        std::cin >> p;
        --p;
        g[i].push_back(p);
        g[p].push_back(i);
    }

    std::cout << dfs(0, -1) << std::endl;

    return 0;
}


Measured memory_bytes: 15104
N = int(input())
A = list(map(int,input().split()))
Q = int(input())

ans = 0
li = [0 for _ in range(10**6)]
for i in A:
    li[i] += 1
    ans += i


for i in range(Q):
    b,c = map(int,input().split())
    ans -= li[b]*b
    ans += li[b]*c
    li[c] += li[b]
    li[b] = 0
    print(ans)





Measured memory_bytes: 148444
#include <algorithm>
#include <iostream>
#include <vector>
 
#define REP(i, n) for(int i = 0; i < n; i++)
using namespace std;
 
int main(){
    int n,k;
    cin>>n>>k;
    
    vector<int> v(n);
    REP(i,n){
        cin>>v[i];
    }
    sort(v.rbegin(),v.rend());
    int ans=0;
    REP(i, k){
        ans+=v[i];
    }
    cout<<ans<<endl;
 
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define ll                 long long
#define pb                 push_back
#define ppb                pop_back
#define endl               '\n'
#define mii                map<ll, ll>
#define pii                pair<ll, ll>
#define vi                 vector<ll>
#define all(a)             (a).begin(), (a).end()
#define mem0(x)            memset(x, 0, sizeof(x))
#define mem1(x)            memset(x, -1, sizeof(x))
#define F                  first
#define S                  second
#define sz(x)              ((ll)x.size())
#define DECIMAL(n)         cout<<fixed<<setprecision(n);
#define rep(i, a, b)       for (ll i=a; i<b; i++)
#define repr(i, a, b)      for (ll i=a-1; i>=b; i--)
#define bitcount(a)        (ll)__builtin_popcount(a)
#define lbnd               lower_bound
#define ubnd               upper_bound
#define ios                ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define trace(...)         __f(#__VA_ARGS__, __VA_ARGS__)

using namespace std;
using namespace __gnu_pbds;

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
// find_by_order(k) returns iterator to kth element starting from 0
// order_of_key(k) returns count of elements strictly smaller than k

template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
    std::cerr<<name<<" : "<<arg1<<endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names+1, ','); std::cerr.write(names, comma-names)<<" : "<<arg1<<" | "; 
    __f(comma+1, args...);
}

const long double PI=3.14159265358979323846264338;
const double eps=1e-10;
ll hell=1e9+7;
ll inf=((ll)5e18+5);

void solve() {
    ll n;
    cin>>n;
    string s;
    rep(i, 0, n) {
        s.pb('A');
        s.pb('C');
        s.pb('L');
    }
    cout<<s<<endl;
}

signed main() {
    ios
    ll test=1;
    // cin>>test;
    while (test--) solve();
    return 0;
}

Measured memory_bytes: 3644
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <math.h>
#include <stdio.h>
#include <ctype.h>
#include <ios> 
#include <iomanip>
using namespace std;

#define N_MAX   (100000)
#define LL_MAX_NUM (1LL<<60)
#define INF 1e7

typedef long long ll;
typedef long long int lli;

int main() {
	int n;
	string s;
	cin >> n >> s;
	int ans = 0;
	for (int i = 0; i < n; ++i) {
		set<char> x, y;
		for (int j = 0; j <= i; ++j) {
			x.insert(s[j]);
		}
		for (int j = i + 1; j < n; ++j) {
			y.insert(s[j]);
		}
		set<char> v;
		set_intersection(x.begin(), x.end(), y.begin(), y.end(), inserter(v, v.begin()));
		ans = max(ans, (int)v.size());
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.*;
import java.math.*;
import java.io.*;
import java.lang.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        if(Algo.isEven(n+m)){
            // possible
            System.out.println((n+m)/2);
        }else{
            System.out.println("IMPOSSIBLE");
        }
    }
}

class io{
    public static void YesNo(boolean f) {
        System.out.println(f?"Yes":"No");
    }
    public static void YESNO(boolean f) {
        System.out.println(f?"YES":"NO");
    }
}

class Algo{
    public static boolean isOdd(int n){
        return n % 2 == 1;
    }
    public static boolean isEven(int n){
        return n % 2 == 0;
    }


}



Measured memory_bytes: 21844
import os,io
input=io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
n=int(input())
graph=[]
for _ in range(n+1):
  graph.append([])
for i in range(n-1):
  u,v=map(int,input().split())
  graph[u].append(v)
  graph[v].append(u)
dp=[1]
dpsum=[1]
for i in range(2,n+1):
  a=i+dp[-1]
  t=0
  for j in graph[i]:
    if j<i:
      t+=j
  dp.append(a-t)
  dpsum.append(dp[-1]+dpsum[-1])
print(dpsum[-1])

Measured memory_bytes: 128064
#include<stdio.h>
#include<math.h>

int main(void){
  double x[3],y[3];
  scanf("%lf %lf %lf %lf",&x[0],&y[0],&x[1],&y[1]);
  x[2] = pow(x[0]-x[1],2);
  y[2] = pow(y[0]-y[1],2);
  printf("%.4f\n",sqrt(x[2]+y[2]));
  return 0;
}

Measured memory_bytes: 1852
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c;    
    cin >> a >> b >> c;
    int k;
    cin >> k;
    
    int d = max(a,max(b,c));
    int e;
    if(d == a){
        e = b + c;
    }else if(d == b){
        e = a + c;
    }else{
        e = a + b;
    }
    
    cout << max(a,max(b,c))* pow(2,k) + e << endl;
    
    return 0;
}

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

using namespace std;

int main(int argc, char **argv)
{
        int N;
        cin >> N;
        vector<int> A(N);
        for (int i = 0; i < N; i++)
                cin >> A[i];
        for (int i = 1; i <= N; i++) {
                for (int j = 0; j < N; j++)
                        cout << A[j] << (j == N - 1 ? '\n' : ' ');
                if (i == N)
                        break;
                int v = A[i], j;
                for (j = i - 1; j >= 0 && A[j] > v; j--)
                        A[j+1] = A[j];
                A[j+1] = v;
        }
        return 0;
}

Measured memory_bytes: 1196
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    String str = sc.next();
    int count = 0;
    int max = 0;
    boolean xmap[] = new boolean[26];
    boolean ymap[] = new boolean[26];
    
    for (int i=1; i<n; i++) {
      count = 0;
      for (int j=0; j<i; j++) {
        put(str.charAt(j), xmap);
      }
      for (int j=i;j<n;j++) {
        put(str.charAt(j), ymap);
      }
      for (int k=0; k<26; k++) {
        if (xmap[k] && ymap[k]) {
          count++;
        }
        // reset
        xmap[k] = false;
        ymap[k] = false;
      }
      if (count > max) {
        max = count;
      }
      
    }
    System.out.println(max);
  }
  private static void put(char x, boolean map[]) {
    if (x == 'a') {
      map[0] = true;
    } else if (x == 'b') {
      map[1] = true;
    } else if (x == 'c') {
      map[2] = true;
    } else if (x == 'd') {
      map[3] = true;
    } else if (x == 'e') {
      map[4] = true;
    } else if (x == 'f') {
      map[5] = true;
    } else if (x == 'g') {
      map[6] = true;
    } else if (x == 'h') {
      map[7] = true;
    } else if (x == 'i') {
      map[8] = true;
    } else if (x == 'j') {
      map[9] = true;
    } else if (x == 'k') {
      map[10] = true;
    } else if (x == 'l') {
      map[11] = true;
    } else if (x == 'm') {
      map[12] = true;
    } else if (x == 'n') {
      map[13] = true;
    } else if (x == 'o') {
      map[14] = true;
    } else if (x == 'p') {
      map[15] = true;
    } else if (x == 'q') {
      map[16] = true;
    } else if (x == 'r') {
      map[17] = true;
    } else if (x == 's') {
      map[18] = true;
    } else if (x == 't') {
      map[19] = true;
    } else if (x == 'u') {
      map[20] = true;
    } else if (x == 'v') {
      map[21] = true;
    } else if (x == 'w') {
      map[22] = true;
    } else if (x == 'x') {
      map[23] = true;
    } else if (x == 'y') {
      map[24] = true;
    } else if (x == 'z') {
      map[25] = true;
    }
  }
}


Measured memory_bytes: 21972
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const ll inf =1LL << 62;
const ll mod=1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b,const ll &mod) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b,const ll &mod) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b,const ll &mod) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b,const ll &mod) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
random_device rd;
mt19937 mt(rd());
uniform_int_distribution<int> dice(1,6);
uniform_real_distribution<double> score(0.0,10.0);

const int N = 'z' - 'a' + 1;

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

    int h, w; cin >> h >> w;
    vi hist(N);
    rep(y, h){
        rep(x, w){
            char c; cin >> c;
            hist[c - 'a']++;
        }
    }

    if(h % 2 == 0 and w % 2 == 1) swap(h, w);

    rep(i, N) hist[i] %= 4;
    int cnt2 = 0, cnt1 = 0;
    rep(i, N){
        int e = hist[i];
        if(e >= 2) cnt2++;
        if(e % 2 == 1) cnt1++;
    }

    bool ok = false;
    if(h % 2 == 0 and w % 2 == 0){
        if(cnt2 == 0 and cnt1 == 0){
            ok = true;
        }
    }
    else if(h % 2 == 1 and w % 2 == 0){
        if(cnt2 <= w / 2 and cnt1 == 0){
            ok = true;
        }
    }
    else {
        if(cnt2 <= w / 2 + h / 2 and cnt1 == 1){
            ok = true;
        }
    }

    cout << (ok ? "Yes":"No") << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define fi first
#define se second
#define mp make_pair
#define pii pair<int,int>
using namespace std;

void solve()
{
    int a;
    string b;
    cin>>a>>b;
    int cur=0;
    for(int i=0;i<b.size();i++)
    {
        if(b[i]!='.') cur=cur*10+b[i]-'0';
    }
    cout<<(a*cur)/100;
}


main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    //int t;
    //cin>>t;
    //while(t--)
        solve();
}


Measured memory_bytes: 3636
import math
import numpy as np
n,d=map(int,input().split())
c=0
p=[list(map(int,input().split())) for _ in range(n)]
for i in range(n):
  for j in range(n-i):
    j+=i
    d1=np.array(p[i])
    d2=np.array(p[j])
    if i==j:
        continue
    q=math.sqrt(sum((d2-d1)**2))
    if q==int(q):
      c+=1
print(c)

Measured memory_bytes: 12424
/*  -*- coding: utf-8 -*-
 *
 * b.cc: B: Tournament
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 100000;

/* typedef */

typedef queue<int> qi;
typedef multiset<int> msi;

/* global variables */

int ps[MAX_N], cns[MAX_N], ds[MAX_N];
msi cds[MAX_N];

/* subroutines */

/* main */

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

  ps[0] = -1;
  for (int i = 1; i < n; i++) {
    cin >> ps[i];
    ps[i]--;
    cns[ps[i]]++;
  }

  qi q;
  for (int i = 0; i < n; i++)
    if (! cns[i]) q.push(i);

  while (! q.empty()) {
    int u = q.front(); q.pop();

    int maxd = 0, k = 0;
    msi &cdu = cds[u];
    for (msi::reverse_iterator mit = cdu.rbegin();
	 mit != cdu.rend(); mit++, k++) {
      int d = *mit + k;
      if (maxd < d) maxd = d;
    }
    ds[u] = maxd;
    //printf("%d=%d\n", u, maxd);

    int &v = ps[u];
    if (v >= 0) {
      cds[v].insert(maxd + 1);
      if (cds[v].size() >= cns[v]) q.push(v);
    }
  }

  printf("%d\n", ds[0]);
  return 0;
}


Measured memory_bytes: 10752
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <queue>
#include <algorithm>
using namespace std;
typedef unsigned int uint;
typedef long long ll;
typedef pair<int, int> P;
const int c_INF = 111111111;
const int c_mINF = -111111111;
const int c_YET = -1;
const int c_Dx[4] = { 0,0,1,-1 };
const int c_Dy[4] = { 1,-1,0,0 };
const int c_div = 1000000007; //10^9 + 7


int myMax(int num[], int length);
int myMin(int num[], int length);

int main() {

	int N;
	int A[1999];
	scanf("%d", &N);
	for (int i = 0; i < N; i++) {
		scanf("%d", &A[i]);
	}

	printf("%d", myMax(A, N) - myMin(A, N));








}

//---配列の最大値を求める---
int myMax(int num[], int length) {
	int temp = c_mINF;
	for (int i = 0; i < length; i++) {
		temp = max(temp, num[i]);
	}
	return temp;
}

//---配列の最小値を求める---
int myMin(int num[], int length) {
	int temp = c_INF;
	for (int i = 0; i < length; i++) {
		temp = min(temp, num[i]);
	}
	return temp;
}

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

using namespace std;

int main(void) {
    int64_t N, A, B;
    cin >> N >> A >> B;
    vector<int64_t> h(N);
    for(int64_t i=0; i<N; i++) {
        cin >> h[i];
    }

    int64_t ng = 0;
    int64_t ok = 1'000'000'000;
    while(ok > ng+1) {
        int64_t mid = (ok + ng) / 2;
        int64_t need = 0;
        for(int64_t i=0; i<N; i++) {
            need += (max(h[i] - B*mid, 0L) + (A-B-1)) / (A-B);
        }
        if(need > mid) {
            ng = mid;
        } else {
            ok = mid;
        }
    }
    cout << ok << endl;
    return 0;
}


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

int comp(const void *a, const void *b){return *(int*)b-*(int*)a;}

int main(void){
	int n, a, i, j, k;
	int x[50];
	scanf("%d%d", &n, &a);
	for(i=0; i<n; i++){
		int X;
		scanf("%d", &X);
		x[i]=X-a;
	}
	long D[2][10001];
	memset(D, 0, sizeof(D));
	D[0][5000]++;
	D[0][5000+x[0]]++;
	for(i=1; i<n; i++){
		long *d=D[i&1]+5000;
		long *e=D[(i+1)&1]+5000;
		for(j=-2500; j<=2500; j++){
			d[j]=e[j]+e[j-x[i]];
		}
	}
	long ans=D[(n-1)&1][5000]-1;
	printf("%ld\n", ans);
}



Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <regex>
#include <cstdio>
#include <cmath>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
#include <iomanip>
#include  <cassert>
#include <fstream>
#include <codecvt>

using namespace std;
using ll = long long int;
using ullong = unsigned long long;
#define rep(i,n) for(int i = 0; i < n; i++)
#define FOR(i, a, b)  for(int i = (a); i < (b) ; i++)
#define pb push_back
#define SORT(v,n) sort(v, v+n)
#define ALL(x) (x).begin(),(x).end()
#define debug(x) cerr << #x << ": " << x << '\n'
#define elif else if
#define int ll
const int INF = (1LL << 32);
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
int dx[8] = { 1, 0, -1, 0, 1, -1, -1, 1 };
int dy[8] = { 0, 1, 0, -1, 1, 1, -1, -1 };


static const int N = 3;
static const int N2 = 9;

struct Puzzle {
	int f[N2];
	int space;
	string path;

	bool operator <(const Puzzle& p) const {
		rep(i, N2) {
			if (p.f[i] == f[i]) continue;
			return f[i] > p.f [i];
		}
		return false;
	}
};

static const char dir[4] = { 'u','l','d','r' };


bool isTarget(Puzzle p) {
	for (int i = 0; i < N2; i++) 
		if (p.f[i] != i+1) return false;

	return true;
}

string bfs(Puzzle s) {

	string path = "";
	queue<Puzzle> Q;
	Q.push(s);
	map<Puzzle, bool> V; 
	V[s] = true;

	while (!Q.empty()) {
		auto p = Q.front();
		Q.pop();

		if (isTarget(p)) return p.path;
		
		int sx = p.space / N;
		int sy = p.space % N;

		rep(r, 4) {
			int tx = sx + dx[r];
			int ty = sy + dy[r];
			if (tx < 0 or ty < 0 or tx >= N or ty >= N) continue;
			auto v = p;
			swap(v.f[p.space], v.f[tx * N + ty]);
			v.space = tx * N + ty;
			if (V[v] == false) {
				V[v] = true;
				v.path += dir[r];
				Q.push(v);
			}
		}
	}

	return "";
}


signed main() {
	ios::sync_with_stdio(true);

	Puzzle in;

	rep(i, N2) {
		cin >> in.f[i];
		if (in.f[i] == 0) {
			in.space = i;
			in.f[i] = N2;
		}
	}

	cout << bfs(in).size() << endl;

	return 0;
}


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

int main() {
    while (true) {
        int cost; cin >> cost; if (cost == 0) break;

        int remain = 1000 - cost;
        const int n500 = remain / 500; remain -= 500 * n500;
        const int n100 = remain / 100; remain -= 100 * n100;
        const int n50  = remain / 50;  remain -= 50  * n50;
        const int n10  = remain / 10;  remain -= 10  * n10;
        const int n5   = remain / 5;   remain -= 5   * n5;
        const int n1   = remain;
        
        cout << n500 + n100 + n50 + n10 + n5 + n1 << endl;
    }
}


Measured memory_bytes: 3084
from sys import stdin
input = stdin.readline
from collections import Counter
def solve():
    N = int(input())
    a = list(map(int,input().split()))
    Q = int(input())
    query = [tuple(map(int,inp.split())) for inp in stdin.read().splitlines()]
    cnt = Counter(a)
    s = sum(a)
    res = []
    for b,c in query:
        if cnt[b] != 0:
            cnt[c] += cnt[b]
            s += (c-b)*cnt[b]
            res.append(s)
            del cnt[b]
        else:
            res.append(s)
    print('\n'.join(map(str,res)))






if __name__ == '__main__':
    solve()


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

int main(){
    int A, B, C, N, cnt = 0, res = 0;
    vector<int> V;
    string S;

    cin >> A >> B;


    cout << max(A+B, max(A-B, A*B)) << endl;

}

Measured memory_bytes: 764