akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <queue>
#include <stack>
#include <utility>
#include <vector>
using std::cerr;
using std::cin;
using std::cout;
using std::endl;

// Manages Union-Find Forest.
class UnionFindForest {
  std::vector<int> parent_;
  std::vector<int> rank_;
  std::vector<int> size_;

 public:
  // Initialize forest.
  // parent_[i]=i, rank_[i]=0, size_[i]=1.
  UnionFindForest(const int &n);
  // Get the number of the root of the node q.
  int Root(const int &q);
  // Return true if the roots of x and y is same.
  bool IsSame(const int &x, const int &y);
  // Unite the tree x and tree y.
  void Unite(const int &rx, const int &ry);
  // Get the number of nodes which are the same group as node q.
  int Size(const int &q);
};
UnionFindForest::UnionFindForest(const int &n) {
  parent_.resize(n);
  rank_.resize(n);
  size_.resize(n);
  for (int i = 0; i < n; i++) {
    parent_[i] = i;
    rank_[i]   = 0;
    size_[i]   = 1;
  }
}
int UnionFindForest::Size(const int &q) {
  return size_[Root(q)];
}

int UnionFindForest::Root(const int &q) {
  if (parent_[q] == q) {
    return q;
  } else {
    return parent_[q] = Root(parent_[q]);
  }
}

bool UnionFindForest::IsSame(const int &x, const int &y) {
  return Root(x) == Root(y);
}

void UnionFindForest::Unite(const int &rx, const int &ry) {
  const int x = Root(rx);
  const int y = Root(ry);
  if (x == y) return;
  if (rank_[x] < rank_[y]) {
    parent_[x] = y;
    size_[y] += size_[x];
    size_[x] = 0;

  } else {
    parent_[y] = x;
    size_[x] += size_[y];
    size_[y] = 0;
    if (rank_[x] == rank_[y]) rank_[x]++;
  }
}

struct Queue {
  int a, b;
  Queue(int x, int y) {
    a = x;
    b = y;
  }
};

int main(void) {
  cout << std::fixed << std::setprecision(10);
  cin.tie(0);
  std::ios::sync_with_stdio(false);
  int64_t n, m;
  cin >> n >> m;
  UnionFindForest UFF(n + 1);
  std::vector<Queue> q;
  std::vector<int64_t> result;
  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    q.push_back(Queue(x, y));
  }
  int64_t answer = n * (n - 1) / 2;
  result.push_back(answer);
  for (int i = m - 1; i >= 0; i--) {
    int a = q[i].a;
    int b = q[i].b;
    // cout << a << " " << b << endl;
    if (UFF.IsSame(a, b)) {
      result.push_back(answer);
    } else {
      // cerr << UFF.Size(a) << "\t" << UFF.Size(b) << endl;
      answer -= UFF.Size(a) * UFF.Size(b);
      result.push_back(answer);
      UFF.Unite(a, b);
    }
  }

  for (int i = m - 1; i >= 0; i--) {
    cout << result[i] << endl;
  }

  return 0;
}


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

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


const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
const int T[] = {3, 5, 6, 9, 10, 12};

int h, w;
int c[9][9];
int can[9][9];
int need[9][9];
int ban[9][9];
int ch[9][9];

int pack(int x, int y)
{
	return (x - 1) * w + (y - 1);
}

bool check()
{
	UnionFind uf(h * w);
	int last = -1;
	int cnt = 0;
	for (int pos = 0; pos < h * w; pos++){
		int x = pos / w + 1;
		int y = pos % w + 1;
		if (c[x][y]) continue;
		last = pos;
		cnt++;
		for (int i = 0; i < 4; i++){
			int nx = x + dx[i];
			int ny = y + dy[i];
			if (ch[x][y] & (1 << i)){
				uf.unite(pos, pack(nx, ny));
			}
		}
	}
	if (last == -1) return false;
	return uf.size(last) == cnt;
}

bool dfs(int pos)
{
	int x = pos / w + 1;
	int y = pos % w + 1;
	if (pos == h * w) return check();
	if (c[x][y]) return dfs(pos + 1);
	
	for (int i = 0; i < 6; i++){
		if ((can[x][y] & T[i]) != T[i]) continue;
		if ((T[i] & need[x][y]) != need[x][y]) continue;
		if (T[i] & ban[x][y]) continue;
		ch[x][y] = T[i];
		
		for (int j = 0; j < 4; j++){
			int nx = x + dx[j];
			int ny = y + dy[j];
			if (T[i] & (1 << j)){
				need[nx][ny] ^= 1 << (j ^ 2);
			}
			else {
				ban[nx][ny] ^= 1 << (j ^ 2);
			}
		}
		
		if (dfs(pos + 1)) return true;
		
		for (int j = 0; j < 4; j++){
			int nx = x + dx[j];
			int ny = y + dy[j];
			if (T[i] & (1 << j)){
				need[nx][ny] ^= 1 << (j ^ 2);
			}
			else {
				ban[nx][ny] ^= 1 << (j ^ 2);
			}
		}
	}
	
	return false;
}

bool solve()
{	
	fill_n(*can, 81, 0);
	fill_n(*need, 81, 0);
	fill_n(*ban, 81, 0);
	
	for (int i = 1; i <= h; i++){
		for (int j = 1; j <= w; j++){
			if (c[i][j]){
				for (int k = 0; k < 4; k++){
					int nx = i + dx[k];
					int ny = j + dy[k];
					ban[nx][ny] |= 1 << (k ^ 2);
				}
			}
			else {
				for (int k = 0; k < 4; k++){
					int nx = i + dx[k];
					int ny = j + dy[k];
					if (!c[nx][ny]){
						can[i][j] |= 1 << k;
					}
				}
			}
		}
	}
	
	return dfs(0);
}

int main()
{
	while (scanf("%d %d", &w, &h), w){
		fill_n(*c, 81, 1);
		for (int i = 1; i <= h; i++){
			for (int j = 1; j <= w; j++){
				scanf("%d", &c[i][j]);
			}
		}
		puts(solve() ? "Yes" : "No");
	}
}

Measured memory_bytes: 1172
#include<cstdio>
#include<algorithm>
typedef long long ll;
ll a, maxa = -114514, ans;
int n;
int main() {
    scanf("%d", &n);
    for(int i=1; i<=n; i++) {
        scanf("%lld", &a);
        maxa = std::max(a, maxa);
        if(maxa > a)
            ans += maxa - a;
    }
    printf("%lld", ans);
    return 0;
}

Measured memory_bytes: 1724
import sys
from collections import deque
import copy
import bisect
import math
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline

def power_func(a,b,p):
  if b==0: return 1
  if b%2==0:
    d=power_func(a,b//2,p)
    return d*d %p
  if b%2==1:
    return (a*power_func(a,b-1,p ))%p

class comb_calclator():
    def __init__(self, N, p):
        self.N = N
        self.p = p
        self.frac_N = [0 for i in range(N + 1)]
        self.frac_N[0] = 1L
        self.comb_N = {}
        for i in range(1, N + 1):
            self.frac_N[i] = (self.frac_N[i - 1] * i ) % p

    def comb(self, n, r):
        if n<0 or r<0 or n<r: return 0
        if n==0 or r==0: return 1
        if (n, r) in self.comb_N:
            return self.comb_N[(n, r)]
        a = self.frac_N[n]
        b = self.frac_N[r]
        c = self.frac_N[n - r]
        self.comb_N[(n, r)] = (a*power_func(b,self.p-2,self.p)*power_func(c,self.p-2, self.p))% self.p
        self.comb_N[(n, n - r)] = self.comb_N[(n, r)]
        return self.comb_N[(n, r)]


def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [H, W, A, B] = [int(input_raw[0]), int(input_raw[1]), int(input_raw[2]), int(input_raw[3])]
    p = 1000000007
    cmb = comb_calclator(H + W, p)
    count = 0L
    for i in range(H - A):
        count = (count + cmb.comb(B - 1 + i, i) * cmb.comb((W - B - 1) + (H - 1) - i, (H - 1) - i)) % 1000000007

    print count

if __name__ == '__main__':
    main()


Measured memory_bytes: 138652
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
typedef long long ll;
using namespace std;

int main() {
	map<ll,ll> mp;
	ll n;
	cin >> n;
	for (ll i = 0; i < n; i++) {
		ll a;
		cin >> a;
		mp[a]++;
	}
	ll ans = 0, size = 0;
	for (auto itr = mp.begin(); itr != mp.end(); ++itr) {
			if (size * 2 < itr->first) {
				ans = itr->second;
			}
			else {
				ans = itr->second + ans;
			}
			size += itr->first*itr->second;
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 6528
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String b = scan.next();
		if(b.equals("A")) System.out.println("T");
		else if(b.equals("T")) System.out.println("A");
		else if(b.equals("C")) System.out.println("G");
		else System.out.println("C");

	}
}

Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std::literals::string_literals;
using i64 = long long;
using std::cout;
using std::endl;
using std::cin;

int main() {
	int a, b, c; scanf("%d%d%d", &a, &b, &c);
	
	printf("%d\n", std::min(b / a, c)); 
	return 0;
}


Measured memory_bytes: 256
import std;

alias sread = () => readln.chomp();
alias lread = () => readln.chomp.to!long();
alias aryread(T = long) = () => readln.split.to!(T[]);
//aryread!string();
void main()
{
    long r, g, b, n;
    scan(r, g, b, n);
    // writeln(r, g, b, n);
    long cnt;
    foreach (i; 0 .. 3001)
    {
        foreach (j; 0 .. 3001)
        {
            long tmp;
            if (r * i + g * j <= n)
            {
                tmp = n - (r * i + g * j);
                if (tmp % b == 0)
                {
                    cnt += 1;
                }
            }
        }
    }
    writeln(cnt);
}

void scan(L...)(ref L A)
{
    auto l = readln.split;
    foreach (i, T; L)
    {
        A[i] = l[i].to!T;
    }
}

void arywrite(T)(T a)
{
    a.map!text.join(' ').writeln;
}


Measured memory_bytes: 3672
/**
 🍪 the_hyp0cr1t3
 🍪 29.08.2020 12:45:27
**/
#ifdef W
#include "k_II.h"
#else
#include <bits/stdc++.h>
using namespace std;
#define aylmao cin.tie(nullptr)->sync_with_stdio(false);
#endif
#define endl '\n'
#define pb emplace_back
// #define int long long
#define sz(x) (int)((x).size())
#define all(x) x.begin(), x.end()
#define Luv(...) [&](auto&& u, auto&& v) { return __VA_ARGS__; }
auto chmax = [](auto& A, auto&& B) { return B > A? A = B, true : false; };
auto chmin = [](auto& A, auto&& B) { return B < A? A = B, true : false; };

using ll = long long;
using pii = pair<int, int>;
const ll DESPACITO = 2e18;
const int INF = 2e9, MOD = 1e9+7;

template<class T> class Y {
    T f;
public:
    template<class U> explicit Y(U&& f): f(forward<U>(f)) {}
    template<class... Args> decltype(auto) operator()(Args&&... args) {
        return f(ref(*this), forward<Args>(args)...);
    }
}; template<class T> Y(T) -> Y<T>;

const int N = 2e5+5;
int a[N], cache[N][2];

int32_t main() {
    aylmao
    int n, K;
    cin >> n >> K;
    for(int i = 0; i < n; i++) 
        cin >> a[i];
    memset(cache, -1, sizeof(cache));

    cout << (Y([&](auto dp, int k, bool who) -> int {
        if(k < 0) return who;
        auto& ans = cache[k][who];
        if(~ans) return ans;
        ans = who^1;
        for(int i = 0; i < n; i++)
            if(dp(k-a[i], who^1) == who) ans = who;
        return ans;
    })(K, 1)? "First" : "Second");
    
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;

#define fi first
#define se second
#define mp make_pair
#define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

int main(){
  fastIO;
  int n;
  cin >> n;
  vector<pii> sg(n);
  int l, r;
  int x, ln;
  for(int i = 0 ; i < n ; i ++ ){
    cin >> x >> ln;
    sg[i] = mp(x+ln,x-ln);
  }
  sort(sg.begin(),sg.end());
  for(int i = 0 ; i < n ; i ++ )
    swap(sg[i].fi,sg[i].se);
  int res = 0;
  int cur = -(int)2e9;
  for(int i = 0 ; i < n ; i ++ ){
    if(sg[i].fi >= cur){
      cur = sg[i].se;
      res ++ ;
    }
  }
  cout << res << "\n";
  return 0;
}

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

int main()
{
    int a, b;
    cin >> a >> b;
    
    if(a > b){
        swap(a, b);
    }
    
    if(a == 1 && b == 2){
        cout << 3 << "\n";
    }
    else if(a == 1 && b == 3){
        cout << 2 << "\n";
    }
    else if(a == 2 && b == 3){
        cout << 1 << "\n";
    }

}


Measured memory_bytes: 256
# numpyが使えると聞いて
import numpy as np

n = int(input())
p = enumerate(map(int, input().split()))
next(p)
a = np.arange(1, n + 1)
b = np.arange(n, 0, -1)
for c, i in p:
    i -= 1
    a[i:] += c
    b[:i + 1] += c
print(*a)
print(*b)


Measured memory_bytes: 15548
#include<stdio.h>
#include<stdbool.h>

int main(void){
    int N,M,i,ans=0,pena=0,pena_cnt[100000];
    scanf("%d %d",&N,&M);
    bool is_accepted[100000];
    for(i=0;i<N;i++){
        is_accepted[i]=false;
        pena_cnt[i]=0;
    }
    for(i=0;i<M;i++){
        int num;
        char s[3];
        scanf("%d %s",&num,s);
        if(strcmp(s,"AC")==0){
            if(is_accepted[num-1]==false){
                is_accepted[num-1]=true;
                ans++;
            }
        }else{
            if(is_accepted[num-1]==false){
                pena_cnt[num-1]++;
            }
        }
    }
    for(i=0;i<N;i++){
        if(is_accepted[i]==true){
            pena+=pena_cnt[i];
        }
    }
    printf("%d %d",ans,pena);

    return 0;
}

Measured memory_bytes: 768
import math

N, M = [int(i) for i in input().split()]
MOD = 10**9+7

if max(N, M) > min(N, M) + 1:
  answer = 0
elif N == M: 
  answer = math.factorial(N) * math.factorial(M) * 2
elif max(N, M) == min(N, M) + 1:
  answer = math.factorial(N) * math.factorial(M)

print(answer % MOD)

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

#define ld long double
#define ll long long
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define MP make_pair
ll MOD = 1e9+7;
//ll MOD = 998244353;
ll INF = 1e18;
void chmin(ll &a,ll b){if(a>b)a=b;}
void chmax(ll &a,ll b){if(a<b)a=b;}
void pmod(ll &a,ll b){a=(a+b)%MOD;}
void qmod(ll &a,ll b){a=(a*b)%MOD;}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
void ans(bool x,ll y,ll z){if(x)cout<<y<<endl;else cout<<z<<endl;}
void anss(bool x,string y,string z){if(x)cout<<y<<endl;else cout<<z<<endl;}   
ll gcd(ll x,ll y){ll r;while((r=x%y)!=0){x=y;y=r;}return y;}

int main(){
  ll i,j,o;
  ll res=0,res1=0,res2=INF,buf=0,buf1=0,buf2=0,buf3=0,buf4=0,sum=0;
  ll l,r;
  bool judge = true;
  string t,e;cin>>t>>e;
  string s;
  for(i=0;i<t.size();i++){
    s+=t[i];
    if(i!=e.size())
    s+=e[i];
  }
  cout<<s<<endl;

  return 0;
}

Measured memory_bytes: 256
n, m = map(int, input().split())
g = [[] for _ in range(n)]
for i in range(m):
    a, b = map(int, input().split())
    g[a - 1].append(b - 1)
    g[b - 1].append(a - 1)
for i in range(1, n - 1):
    ma = 0
    mi = n
    for node in g[i]:
        ma = max(ma, node)
        mi = min(mi, node)
    if ma == n - 1 and mi == 0:
        print('POSSIBLE')
        break
else:
    print('IMPOSSIBLE')


Measured memory_bytes: 82252
INF = float('inf')
n, ma, mb = map(int, input().split())
t = [[INF] * 401 for _ in range(401)]
t[0][0] = 0
for _ in range(n):
  a, b, c = map(int, input().split())
  for aa in range(400, -1, -1):
    for bb in range(400, -1, -1):
      if t[aa][bb] == INF:
        continue
      if t[a + aa][b + bb] > t[aa][bb] + c:
        t[a + aa][b + bb] = t[aa][bb] + c
result = INF
for a in range(400, 0, -1):
  for b in range(400, 0, -1):
    if a * mb == b * ma and t[a][b] < result:
      result = t[a][b]
if result == INF:
  result = -1
print(result)


Measured memory_bytes: 4844
#include <stdio.h>
#include <math.h>
int main() {
 double x1,x2,y1,y2;
 double x,y,z;

 scanf("%lf %lf %lf %lf",&x1,&y1,&x2,&y2);

 x = (x2-x1) * (x2-x1);
 y = (y2-y1) * (y2-y1);
 printf("%.11lf",sqrt(x+y));

 return 0;
}


Measured memory_bytes: 2044
#include <stdio.h>
int main(){
  int a, b, c, d, p, x, y;
  scanf("%d %d %d %d %d", &a, &b, &c, &d, &p);
  x = a*p;
  if(p<=c){
    y = b;
  }else{
     y = (p - c)*d + b;
  }
  if(x<=y){
    printf("%d\n", x);
  }else{
     printf("%d\n", y);
  }
  return 0;
}

Measured memory_bytes: 1024
def maybe_prime(d,s,n):
    for a in (2,3,5,7):
        p = False
        x = pow(a,d,n)
        if x==1 or x==n-1:
            continue
        for i in range(1,s):
            x = x*x%n
            if x==1: return False
            elif x == n-1:
                p = True
                break
        if not p: return False
    return True

def is_prime(n):
    if n in (2,3,5,7): return True
    elif 0 in (n%2,n%3,n%5,n%7): return False
    elif 0 in [ n%i for i in range(11,min(n-1,100),2) ]:return False
    else:
        d,s = n-1, 0
        while not d%2:
            d,s = d>>1,s+1
        return maybe_prime(d,s,n)
cnt = 0
n = int(input())
for i in range(n):
  n = int(input())
  if is_prime(n): cnt+=1

print(cnt)

Measured memory_bytes: 7712
#include<bits/stdc++.h>
using namespace std;
int main ()
{
	int l,k,n,m,c;
	cin>>n;
	k=n/500;
	m=n%500;
	l=m/5;
	c=k*1000+ l*5;
	cout<<c;
	return 0;
	
}


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 ld long double
#define fi first
#define se second
#define pb push_back
#define all(v) v.begin(),v.end()
#define repf(i,a,b) for(ll i=a;i<b;i++)
#define repb(i,a,b) for(ll i=a;i>=b;i--)
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define mod 1000000007
#define MOD 998244353 

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>;

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

ll power(ll a, ll n, ll m)
{
    ll ans=1;
    while(n)
    {
        if(n&1) ans=(ans*a)%m;
        n>>=1;
        a=(a*a)%m;
    }
    return ans;
}

int main()
{
    IOS;
    ll a,b;
    cin>>a>>b;
    cout<<(a*b)/(__gcd(a,b))<<endl;
}  

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

def p(n):
    return 2**(n+1)-1

def a(n):
    return 2**(n+2)-3

def f(n, x):
    if n==0:
        return 0 if x<=0 else 1
    elif x<=1+a(n-1):
        return f(n-1, x-1)
    else:
        return p(n-1)+1+f(n-1, x-2-a(n-1))

print(f(n, x))


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
const ll mod = 1000000007;
const ll INF = 1001001001;
const ll LINF = 1001001001001001001;

void prvec(vector<ll> vec){ //for debug
    ll n = vec.size();
    cout << "------------------------------------\n" ;
    rep(i,n) cout << i << " " << vec.at(i) << "\n";
    cout << "------------------------------------\n" ;
}

void pr2d(vector<vector<ll>> vec){ // for debug
    ll h = vec.size();
    ll w = vec.at(0).size();
    cout << "------------------------------------\n" ;
    rep(i,h){
        rep(j,w){
            cout << vec.at(i).at(j) << " ";
        }
        cout << "\n";
    }
    cout << "------------------------------------\n" ;
}

int main(){
    ll n ; cin >> n;
    vector<ll> w(n);
    rep(i,n) cin >> w.at(i);
    ll ans = INF;
    for(int i=0;i<n-1;i++){
        ll s1 = 0, s2 = 0;
        for(int j=0;j<n;j++){
            if(j<=i) s1+=w.at(j); else s2+=w.at(j);
        }
        ans = min(ans,abs(s1-s2));
    }
    cout << ans << endl;
}

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

namespace ConsoleApp15
{
    class Class32
    {
        static void Main()
        {
            int N = int.Parse(ReadLine());
            int[] S = new int[3];
            int count = 0;
            for(int i = 0; i < N; i++)
            {
                var r = ReadLine();
                for (int j = 0; j < r.Length - 1; j++)
                    if (r.Substring(j, 2) == "AB") count++;

                if (r.First() == 'B' && r.Last() == 'A')
                    S[0]++;
                else if (r.First() == 'B')
                    S[1]++;
                else if (r.Last() == 'A')
                    S[2]++;
            }
            if (S[0] == 0) count += Math.Min(S[1], S[2]);
            else
            {
                if (Math.Max(S[1], S[2]) > 0) count += S[0] + Math.Min(S[1], S[2]);
                else count += S[0] - 1;
            }

            WriteLine(count);
        }
    }
}


Measured memory_bytes: 15316
#include <iostream>

using namespace std;

int main(){
    int N;
    cin>>N;
    if(N%10==0||N%10==1||N%10==6||N%10==8){
        cout<<"pon"<<endl;
    }else if(N%10==3){
        cout<<"bon"<<endl;
    }else{
        cout<<"hon"<<endl;
    }
}

Measured memory_bytes: 3632
#include<stdio.h>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;
int main()
{
int a, b, x, y;
scanf("%d%d%d%d", &a, &b, &x, &y);
printf("%lf %d\n", double(a)*double(b) / 2, x + x == a
&&y + y == b);
}

Measured memory_bytes: 1732
import math
from functools import reduce

K = int(input())

def gcd(*numbers):
    return reduce(math.gcd, numbers)

GCDD = 0
for i in range(1,K+1):
    for j in range(1,K+1):
        for k in range(1,K+1):
            GCDD += gcd(i,j,k)
print(GCDD)

Measured memory_bytes: 69572
#include<iostream>
#include<cmath>
#include<vector>
#include<iomanip>

int main(){
    int n;
    
    while(1){
        std::cin>>n;
        if(n==0){
            break;
        }
        std::vector<int> s(n);
        
        double ave=0;
        double sum=0;
        for(int i=0; i<n; i++){
            std::cin>>s[i];
            sum+= s[i];
        }
    
        ave=sum/n;
        
        double sum2=0;
        for(int i=0; i<n; i++){
            sum2+=std::pow(s[i]-ave, 2.0);
        }
        
        std::cout<<std::fixed<<std::setprecision(6)<< std::sqrt(sum2/n) <<std::endl;
    }
    return 0;
}


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



int main() {
  string s;
  cin >> s;
  sort(s.begin(), s.end());
  if (s == "abc") cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, x;
  cin >> n >> x;
  int a;
  long long cnt = 0;
  int lim = x;
  for (int i = 0; i < n; i++) {
    cin >> a;
    if (a > lim) {
      cnt += a - lim;
      lim = x - lim;
    } else {
      lim = x - a;
    }
  }
  cout << cnt << '\n';
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
///////////////////////////////////////////
const long long int INF = 1LL<<60;
const long long int Mod = 1000000007;
using ll = long long int; using ci = const int;
using vi = vector<int>;  using Vi = vector<long long int>;
using P = pair<int, int>;  using PLL = pair<ll, ll>;
using matrix = vector<vector<ll>>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define rp(i,N) for(ll i = 0; i < (ll)N; i++)
#define repi(i,a,b) for(ll i = ll(a); i < ll(b); ++i)
template<class T>bool chmax(T &former, const T &b) { if (former<b) { former=b; return true; } return false; }
template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
#define p_queue(v) priority_queue<v, vector<v>, greater<v> >
template<class T> inline void princ(T x){cout<<x<<" ";}; 
template<class T> inline void print(T x){cout<<x<<"\n";};
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
///////////////////////////////////////////////////////////////////////////////////

void solve(){
    int a,b;
    cin >> a >> b;
    print(a*b);
    return;
}
int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    std::cout<<std::fixed<<std::setprecision(30);
    solve();
    return 0;
}

Measured memory_bytes: 3652
#include "bits/stdc++.h"
using namespace std;
#ifdef ONLINE_JUDGE
#define trace(...)
#endif

using LL = long long;

int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL);

	int n; cin >> n;
	for (int a = 1; a <= 9; a++) {
		if (n % a == 0 && n / a <= 9) {
			cout << "Yes\n";
			return 0;
		}
	}
	cout << "No\n";

	return 0;
}


Measured memory_bytes: 256
(defun distinct-or-not ()
  (let* ((n (read))
        (a (make-array n)) 
        (ans "YES"))
    (dotimes (i n) 
      (setf (aref a i) (read))) 
    (setf a (sort a #'<)) 
    (dotimes (i (1- n)) 
      (if (= (aref a i) (aref a (1+ i))) 
          (setf ans "NO")))
    ans)) 

(format t "~A~%" (distinct-or-not))


Measured memory_bytes: 59752
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author KharYusuf
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        AFerrisWheel solver = new AFerrisWheel();
        solver.solve(1, in, out);
        out.close();
    }

    static class AFerrisWheel {
        public void solve(int testNumber, FastReader s, PrintWriter w) {
            int a = s.nextInt(), b = s.nextInt();
            if (a > 12) w.println(b);
            else if (a > 5) w.println(b >> 1);
            else w.println(0);
        }

    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private FastReader.SpaceCharFilter filter;

        public FastReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {

            if (numChars == -1)
                throw new InputMismatchException();

            if (curChar >= numChars) {

                curChar = 0;

                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (numChars <= 0)
                    return -1;
            }

            return buf[curChar++];
        }

        public int nextInt() {

            int c = read();

            while (isSpaceChar(c))
                c = read();

            int sgn = 1;

            if (c == '-') {
                sgn = -1;
                c = read();
            }

            int res = 0;

            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();

                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));

            return res * sgn;
        }

        public boolean isSpaceChar(int c) {

            if (filter != null)
                return filter.isSpaceChar(c);

            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}



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

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

int main()
{
    int k, n;
    cin >> k >> n;
    vector<long long> a(n, 0);
    rep(i, n) cin >> a[i];
    long long res = LLONG_MAX;
    rep(i, n)
    {
        res = min(res, a[(i + n - 1) % n] + ((i + n - 1) / n == 0 ? 0 : k) - a[i]);
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 1792
#include <cmath>
#include <string>
#include <vector>
#include <numeric> /* gcd, lcm, partial_sum, reduce*/
#include <iostream>
#include <algorithm>

using namespace std;

int main(){
  string S;
  cin >> S;
  int count = 0;
  int rs = S.size();
  for(int i=0; i<rs/2; i++){
    if (S[i]!=S[rs-i-1])count++;
  }
  cout << count << endl;
    return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline

#input
N, M = map(int, input().split())
u = [[] for i in range(N-1)]
#（便宜的に地点から-1としておく）
for i in range(M):
    s, t = map(int, input().split())
    u[s-1].append(t-1)

#output
#地点vにたどり着く確率をp[v]とする。
p = [0] * N
p[0] = 1
for x, y in enumerate(u):
    for z in y:
        p[z] += p[x]/len(y)

#期待値をゴールから逆順に求めていく。点vからゴールまでの移動距離の期待値をq[v]とする。
q = [0] * N
q[N-1] = 0
for x, y in list(enumerate(u))[::-1]:
    q[x] = sum(q[z] for z in y)/len(y) + 1

v = [0] * N
for i in range(N-1):
    a = len(u[i])
    if a > 1:
        b = max(q[c] for c in u[i])
        v[i] = p[i]*(q[i] - (1+b))/(a-1)

print(q[0]+min(v))

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

def main():
     k = int(input())
     a, b = map(int, input().split())

     ans = k
     while(True):
          # print(ans)
          if ans >= a and ans <= b:
               print('OK')
               break
          elif ans > b:
               print('NG')
               break
          else:
               ans = ans + k

if __name__ == "__main__":
    main()


Measured memory_bytes: 9168
#include<iostream>
#include<algorithm>
#include<string>
#include<map>
#include<list>
#include<vector>
#include<stdio.h>
#include<iomanip>
#include<cmath>
using namespace std;

int main(){
	long long int N,M,ans=1;
	cin >> N >> M;
	if((N-M)==1||(N-M)==-1){
		for(int i=1;i<=M;i++){
			ans = ans * i;
			ans = ans % 1000000007;
		}
		for(int i=1;i<=N;i++){
			ans = ans * i;
			ans = ans % 1000000007;
		}
		cout << ans << endl;

	}else if((N-M)==0){
		for(int i=1;i<=M;i++){
			ans = ans * i;
			ans = ans % 1000000007;
		}
		for(int i=1;i<=N;i++){
			ans = ans * i;
			ans = ans % 1000000007;
		}
		cout << (2*ans)%1000000007 << endl;
	}else{
		cout << "0" << endl;
	}

	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
// #include <atcoder/all>
#define ll long long int
#define ld long double
#define yorn(f) std::cout<<((f)?"Yes":"No")<<endl;
#define YORN(f) std::cout<<((f)?"YES":"NO")<<endl;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repi(i, n) for (ll i = 1; i < (ll)(n); i++)
#define all(x) (x).begin(), (x).end()
#define put(x) std::cout << x << endl;
#define println(x) std::cout << x << endl;
using namespace std;
// using namespace atcoder;
void Main()
{
    ll n;
    cin >> n;

    ll res = 0;
    ll dup = 0;
    for (ll A = 1; A <= n; A++) {
        for (ll B = 1; A * B <= n; B++) {
            ll C = n - A * B;
            if (1 <= C) {
                res++;
                if (A == B) {
                    dup++;
                }
            }
        }
    }

   // res -= dup;
    put(res);
}
signed main(){ Main();return 0;}

Measured memory_bytes: 3632
s = input()
mod = 2019

temp = [1]
for i in range(len(s) - 1):
    temp.append(temp[-1] * 10 % mod)
temp.reverse()
temp2 = []
for i in range(len(s)):
    temp2.append(int(s[i]) * temp[i])
temp3 = [0]
for i in range(len(s)):
    temp3.append((temp3[-1] + temp2[i]) % mod)
temp4 = {}
for i in temp3:
    temp4.setdefault(i, 0)
    temp4[i] += 1
ans = 0
for i in temp4.values():
    ans += (i * (i - 1) // 2)
print(ans)

Measured memory_bytes: 31264
#include <bits/stdc++.h>
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define all(x) x.begin(), x.end()

using namespace std;

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

template <typename T> void max_self(T& a, T b){
  a = max(a,b);
}

template <typename T> void min_self(T& a, T b){
  a = min(a,b);
}

void solve(){	
  ll x,k,d;
  cin>>x>>k>>d;
  x = abs(x);
  ll extra = x%d;
  ll moves = x/d;
  if( moves >= k ){
    ll ans = x-(d*k);
    cout<<abs(ans)<<endl;
  }else{
    k -= moves;
    x = x%d;
    ll ans;
    if(k & 1){
      ans = abs(x-d);
    }else{
      ans = x;
    }
    cout<<abs(ans)<<endl;
  }
}

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


Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a[60];
	int n;
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];	
	}
	int sum=0;
	for(int i=1;i<=n;i++)
	{
		for(int j=i+1;j<=n;j++)
		{
			sum=sum+a[i]*a[j];	
		}	
	}
	cout<<sum;	
} 

Measured memory_bytes: 256
#include <stdio.h>
int n;
int ten[10]={1,10,100,1000,10000,100000,1000000,10000000,100000000};
int aaa[4]={3,5,7};
int result=0;
int check(int num);
int xxx(int i,int j){
	for(int k=0;k<3;k++)
	{
		if(check(10*j+aaa[k])==1&&10*j+aaa[k]<=n)
		{
			result++;
		}
		if(10*j+aaa[k]>n)
		{
			return 0;
		}
		if(i<9)
		{
			xxx(i+1,10*j+aaa[k]);
			
		}
	}
	return 0;
}

int check(int num){
	int three=0,five=0,seven=0;
	for(int i=0;i<9;i++)
	{
		if((num/ten[i])%10==3)three=1;
		if((num/ten[i])%10==5)five=1;
		if((num/ten[i])%10==7)seven=1;
	}
	
	if(seven==1&&five==1&&three==1)
	{
		return 1;
	}
	return 0;
	}


int main(){
	
	
	scanf("%d",&n);
	
	xxx(0,0);
	printf("%d",result);
	}

Measured memory_bytes: 128
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());

		ArrayList<Integer> ans = new ArrayList<>();

		if (n==0){
			ans.add(0);
		}
		while (n != 0){
			int b = Math.abs(n%2);
			ans.add(b);
			n = (n-b)/-2;
		}
		Collections.reverse(ans);

		for (int degit : ans){
			System.out.print(degit);
		}
		System.out.println();
	}
}

Measured memory_bytes: 21844
#pragma GCC optimize(3, "Ofast", "inline")
#include <bits/stdc++.h>
#if __cplusplus >= 201103L
#include <chrono>
using namespace std::chrono;
#endif
using namespace std;
#define ll long long
#define ull unsigned long long
#define pii pair<int, int>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#ifdef LOCAL
#define prln(x) (cout << #x << ' ' << x << endl)
#define pr(x) (cout << #x << ' ' << x << ' ' )
#define prv(x) (cout << x << ' ')
#else
#define prln(x) 
#define pr(x)
#define prv(x)
#endif
#define clr(x) memset((x), 0, sizeof((x)))
#define clr1(x) memset((x), -1, sizeof((x)))
#define endl "\n"
#define pi acos(-1)
#define rep(i, st, ed) for (int i = (st); i <= (ed); ++i)
#define rep0(i, st, ed) for (int i = (st); i < (ed); ++i)
#define per0(i, st, ed) for (int i = (st); i > ed; --i)
#define per(i, st, ed) for (int i = (st); i >= ed; --i)
#define chmin(a, b) (a = a > b ? b : a)
#define chmax(a, b) (a = a < b ? b : a)
template<class T> void _sf(T &x) {cin >> x;}
void _sf(int &x) {scanf("%d", &x);}
void _sf(ll &x) {scanf("%lld", &x);}
void _sf(double &x) {scanf("%lf", &x);}
void _sf(char &x) {scanf(" %c", &x);}
void _sf(char *x) {scanf("%s", x);}
void sf() {}
template <class T, class...U> void sf(T & head, U&... tail) { _sf(head); sf(tail...);}
template<class T> void _out(const T &x) { cout << x; }
void _out(const int &x) { printf("%d", x); }
void _out(const ll &x) { printf("%lld", x); }
void _out(const double &x) { printf("%.16f", x); }
void _out(const char &x) { putchar(x); }
void _out(const char *x) { printf("%s", x); }
template<class T,class U> void _out(const pair<T,U> &x) {_out(x.F); putchar(' '); _out(x.S);}
template<class T> void _out(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _out(*i++)) if (i != x.cbegin()) putchar(' '); }
void out() {}
template<class T, class... U> void out(const T &head, const U &... tail) { _out(head); putchar(sizeof...(tail) ? ' ' : '\n'); out(tail...); }
const int mod = 1e9 + 7;
const int INF = 0x3f3f3f3f;

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


int main(){
    #ifdef LOCAL
        freopen("in.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
    #endif
    ll a;
    sf(a);
    ll ans = 0;
    ll t = a % 500;
    ans += 1000 * (a / 500);
    ans += 5 * (t / 5);
    out(ans);
    return 0;
}

Measured memory_bytes: 256
package main

import "fmt"


func main() {
	var a, b, c int
  	fmt.Scan(&a, &b, &c)
  
    if (a+b == 12 || a+b == 10) && a+b+c == 17 && a%2 != 0 && b%2 != 0 && c%2 != 0 {
      fmt.Println("YES")
    }else {
      fmt.Println("NO")
    }
}

Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <stack>
#include <algorithm>
#include <functional>

typedef std::vector<std::vector<int>> graph;

std::vector<int> makescc(const graph& g)
{
	const int n = g.size();
	std::vector<int> num(n), low(n), scc(n, -1);
	std::stack<int> s;
	int index = 0;

	std::function<void(int)> visit = [&](int v) -> void {
		s.push(v);
		num[v] = low[v] = ++index;
		for (const int u : g[v]) {
			if (scc[u] == -1) {
				if (num[u] == 0) {
					visit(u);
				}
				low[v] = std::min(low[v], low[u]);
			}
		}

		if (num[v] == low[v]) {
			int u;
			do {
				u = s.top();
				s.pop();
				scc[u] = v;
			} while (u != v);
		}
	};

	for (int v = 0; v < n; ++v) {
		if (num[v] == 0) {
			visit(v);
		}
	}

	return scc;
}

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

	int V, E;
	std::cin >> V >> E;
	graph g(V);
	for (int i = 0; i < E; ++i) {
		int s, t;
		std::cin >> s >> t;
		g[s].push_back(t);
	}
	auto scc = makescc(g);

	int Q;
	std::cin >> Q;
	for (int i = 0; i < Q; ++i) {
		int u, v;
		std::cin >> u >> v;
		std::cout << (scc[u] == scc[v]) << '\n';
	}
}

Measured memory_bytes: 4600
N = int(input())
H = [int(h) for h in input().split()]
ans = 0

I = []
for _ in range(max(H)):
    I.append([1 if h > 0 else 0 for h in H])
    H = [h-1 if h > 0 else 0 for h in H]
    
for i in I:
    j = [l for l in ''.join([str(k) for k in i]).split('0') if l != '']
    ans += len(j)
    
print(ans)    

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <string>
#include <deque>
using namespace std;
using P = pair<int,int>;
typedef long long int ll;
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)

int main(){
    string s; cin  >> s;
    rep(i,s.size()-1){
        if(s[i]==s[i+1]){
            cout << "Bad" << endl;
            return 0;
        }
    }
    cout << "Good" << endl;
    return 0;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

using namespace std;
#define ll long long
#define rep(i,n) for (int i = 0; i < n; i++)
#define MOD (1000000007)
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()

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; }

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

const ll INF = 1LL << 60;

int main(){
  ll x,y; cin >> x >> y;
  ll ans;
  if(x <= y){
    ans = abs(abs(x)-abs(y));
    if(x*y < 0) ans++;
  }
  else{
    if(x*y > 0) ans = x - y + 2;
    else if(x*y < 0) ans = abs(abs(x)-abs(y)) + 1;
    else ans = x - y + 1;
  }

  std::cout << ans << '\n';
}


Measured memory_bytes: 256
#!/usr/bin/env python
#pyrival orz
import os
import sys
from io import BytesIO, IOBase

"""
    for _ in range(int(input())):
    n,m=map(int,input().split())
    n=int(input())
    a = [int(x) for x in input().split()]
"""

def main():
    n,m=input().split()
    n=int(n)
    m=int(m[:-3])*100+int(m[-2:])
    print(n*m//100)


# region fastio

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    main()

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


void solve(long long N, std::vector<long long> x, std::vector<long long> y){
  long double acc = 0;
  for(long long i = 0; i < N; i++){
    for(long long j = i; j < N; j++){
      acc += sqrt(pow(x[i] - x[j], 2) + pow(y[i] - y[j], 2));
    }
  }

  cout << std::setprecision(20) << (acc/N)*2 << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
  scanf("%lld",&N);
  std::vector<long long> x(N);
  std::vector<long long> y(N);
  for(int i = 0 ; i < N ; i++){
    scanf("%lld",&x[i]);
    scanf("%lld",&y[i]);
  }
    solve(N, std::move(x), std::move(y));
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <tuple>
#include <memory>
#include <cmath>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <cfloat>
#include <cassert>
#include <random>


int main() {
	double a, b, p, q, r; std::cin >> a >> b >> p >> q >> r;
	auto dist = a * p - (b - a) * (q - p);
	std::cout << std::setprecision(10) << std::fixed << dist / (q + r) + b << std::endl;
}


Measured memory_bytes: 3296
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(input())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())

N = inp()
tmp = INF
S = 0
for i in range(N):
	A,B = inpl()
	S += A
	if A > B:
		tmp = min(B,tmp)

if tmp == INF:
	print(0)
else:
	print(S-tmp)


Measured memory_bytes: 4460
#include<stdio.h>

#define LEN 2<<24
int dic[LEN];

int hash(char *str){
    char *p = str;
    int ans = 0;
    int mul = 1;
    while(*p != '\0'){
        if(*p == 'A'){
            ans = ans + mul*1;
        }
        else if(*p == 'C'){
            ans = ans + mul*2;
        }
        else if(*p == 'G'){
            ans = ans + mul*3;
        }
        else{
            ans = ans + mul*4;
        }
        mul *= 4;
        p++;
    }
    return ans;
}

void insert(char* str){
    dic[hash(str)] = 1;
}

int find(char* str){
    if(dic[hash(str)] == 1) return 1;
    return 0;
}

int main(void){
    int n;
    int i;
    char operand[13];
    char operator[10];
    
    scanf("%d", &n);
    
    for(i=0; i<n; i++){
        scanf("%s %s", operator, operand);
        if(operator[0] =='i'){
            insert(operand);
        }
        else if(operator[0] =='f'){
            printf("%s\n", 1 == find(operand)?"yes":"no");
        }
    }
    return 0;
}

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

bool findPalindrome(string s) {
	for (int i = 0; i < s.size() / 2; i++) {
		if (s[i] != s[s.size() - i - 1]) return false;
	}
	return true;
}

int main() {
	string s;
	int c = 0;
	while (cin >> s) {
		if (findPalindrome(s)) {
			c++;
		}
	}
	cout << c << endl;
	return 0;
}

Measured memory_bytes: 3184
#include <cstdio>
#include <functional>
#include <algorithm>
#include <vector>
#include <limits>
#include <numeric>
#include <type_traits>
#include <iostream>
#include <queue>
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
#define rep(i, n, s) for (int i = s; i < (int)(n); i++)

ll calcNumOfCombination(ll n, ll r) {
    ll num = 1;
    for (ll i = 1; i <= r; i++) {
        num = num * (n - i + 1) / i;
    }
    return num;
}

int gcd(int x, int y) { return (x % y) ? gcd(y, x % y) : y; }

int findSumDigits(int s) {
    int num = 0;
    int temp = 0;
    while (s) {
        temp = s % 10;
        num += temp;
        s = s / 10;
    }
    return num;
}

int countDivisorNum(int n) {
    int count = 0;
    for (int i = 1; i <= n; i++) {
        if (n % i == 0) {
            count++;
        }
    }
    return count;
}

int main() {
    int n;
    cin >> n;
    string s[n];
    rep(i, n, 0) cin >> s[i];
    int ans = 0;
    unordered_set<string> set;
    set.insert(s[0]);
    auto ite=set.begin();

    rep(j, n, 1) {
        ite = set.find(s[j]);
        if (ite != set.end()) {

        } else {
            set.insert(s[j]);
        }
    }

    cout << set.size() << endl;

    return 0;
}

Measured memory_bytes: 23976
#include<stdio.h>
#include<string.h>
int B[1000005],i,j,N;

int ch()
{
	int i;
	if(N==1||B[0]!=1)return 0;
	for(i=1;i<N;i++)
		if(B[i]-1!=B[i-1])
			return 0;
	return 1;
}

int main() 
{
	for(;scanf("%d",&N),N;)
	{
		for(i=0;i<N;i++)scanf("%d",B+i);
		for(i=0;i<=10000;i++)
		{
			if(ch())break;
			for(j=0;j<N;j++)
				B[j]--;
			B[N]=N;
			N++;
			for(j=0;j<N;)
			{
				if(B[j]==0)
				{
					memmove(B+j,B+j+1,4*(N-j));
					N--;
				}
				else
					j++;
			}
		}
		printf("%d\n",i<10000?i:-1);
	}
	return 0;
}

Measured memory_bytes: 628
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e16;
const ll mod = 1000000007;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  ll n;
  cin >> n;
  vector <ll> v(n);
  ll res = 0;
  rep(i, n) {
    cin >> v.at(i);
    res += v.at(i);
  }
  sort(v.begin(), v.end());
  cout << res - v.at(n-1)/2 << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] A1 = new int[N + 1];
		int[] A2 = new int[N + 1];
		for (int i = 1; i <= N; i++) {
			A1[i] = sc.nextInt();
		}
		for (int i = 1; i <= N; i++) {
			A2[i] = sc.nextInt();
		}
		int[] s1 = new int[N + 1];
		int[] s2 = new int[N + 1];
		for (int i = 1; i <= N; i++) {
			int j = N - i + 1;
			if (i == 1) {
				s1[i] = A1[i];
				s2[j] = A2[j];
			} else {
				s1[i] = A1[i] + s1[i - 1];
				s2[j] = A2[j] + s2[j + 1];
			}
		}
		int max = 0;
		for (int i = 1; i <= N; i++) {
			if (i == 1 || max < s1[i] + s2[i]) {
				max = s1[i] + s2[i];
			}
		}
		System.out.println(max);
	}

}


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

int main() {
  string S, T;
  cin >> S >> T;

  for (int i=0; i<S.size(); i++) {
    if (S.at(i) != T.at(i)) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
}

Measured memory_bytes: 3616
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<iomanip>
#include<set>
#include<queue>

using namespace std;

int main()
{
	int n;
	cin >> n;
	vector<int> h(n);
	for(int i=0;i<n;i++)
		cin >> h[i];
	int best_ans=0;
	int ans=0;
	int now=0;
	for(int i=0;i<n;i++)
	{
		if(now>=h[i])
		{
			ans++;
		}
		else
		{
			ans=0;
		}
		now=h[i];
		if(ans>best_ans)
			best_ans=ans;

	}
	cout << best_ans << endl;
		




}

Measured memory_bytes: 640