akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
int a,b,c,d;
int main(){
    cin>>a>>b;
    if(a==1)a=14;
    if(b==1)b=14;
    if(a>b)printf("Alice");
    if(a==b)printf("Draw");
    if(a<b)printf("Bob");
}


Measured memory_bytes: 256
n = int(input())
x = input()
pop = x.count("1")
lst1 = [1]
for i in range(n-1):
    lst1.append(lst1[-1] * 2 % (pop + 1))
lst1.reverse()
num1 = 0
for i in range(n):
    if x[i] == "1":
        num1 += lst1[i]
        num1 %= (pop + 1)
if pop == 1 or pop == 2:
    lst2 = [0] * n
else:
    lst2 = [1]
    for i in range(n-1):
        lst2.append(lst2[-1] * 2 % (pop - 1))
    lst2.reverse()
    num2 = 0
    for i in range(n):
        if x[i] == "1":
            num2 += lst2[i]
            num2 %= (pop - 1)
x2 = int(x, 2)
for i in range(n):
    if x[i] == "1":
        if pop == 1:
            print(0)
            continue
        elif pop == 2:
            print(1)
            continue
        else:
            num = num2 - lst2[i]
            num %= (pop - 1)
    else:
        num = num1 + lst1[i]
        num %= (pop + 1)
    count = 1
    while num:
        num %= bin(num).count("1")
        count += 1
    print(count)

Measured memory_bytes: 25456
#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
#include<set>
#include<cstring>

using namespace std;
typedef long long int lli;

#define all(arr) arr.begin(),arr.end()
#define f first
#define s second
#define debug1(x) cout<<x<<"\n"
#define debug2(x,y) cout<<x<<" "<<y<<"\n"
#define debug3(x,y,z) cout<<x<<" "<<y<<" "<<z<<"\n"
#define nl cout<<"\n";
#define pq priority_queue
#define inf 0x3f3f3f3f
#define test cout<<"abcd\n";
#define pi pair<int,int>
#define pii pair<int,pi>
#define pb push_back
#define gc getchar_unlocked
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define ll long long
#define si(x)	scanf("%d",&x)
#define sl(x)	scanf("%lld",&x)
#define ss(s)	scanf("%s",s)
#define pl(x)	printf("%lld\n",x)
#define ps(s)	printf("%s\n",s)
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
#define MOD 1000000007
#define space ' '
#define kick(t) cout << "Case #" << t << ":" << endl;
#define sub(a, b) (MOD+a%MOD-b%MOD)%MOD
#define add(a, b) (MOD+a%MOD+b%MOD)%MOD
typedef pair<ll, ll>	pl;
typedef vector<int>		vi;
typedef vector<ll>		vl;
typedef vector<pii>		vpii;
typedef vector<pl>		vpl;
typedef vector<vi>		vvi;
typedef vector<vl>		vvl;

template <typename T>
void input(vector<T> &arr,lli n) {
  T temp;
  for(lli i=0;i<n;i++) cin>>temp, arr.push_back(temp);
}

template <typename T>
void output(vector<T> arr) {
  for(auto x:arr) cout<<x<<" ";
  cout<<endl;
}


template <typename T>
void input_set(set<T> &arr,lli n) {
  T temp;
  for(lli i=0;i<n;i++) cin>>temp, arr.insert(temp);
}

lli mul(lli a, lli b) {
  return (a%MOD*b%MOD)%MOD;
}

lli power(lli a,lli b) {
  lli ans = 1;
  while(b > 0) {
    if(b&1)
      ans = mul(ans, a);
    a = mul(a,a);;
    b >>= 1;
  }
  return ans;
}


void solve() {
  lli n;
  cin >> n;
  lli ans=power(10, n);
  ans=sub(ans, mul(2, power(9, n)));
  ans=add(ans, power(8, n));
  cout << ans << endl;
}

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

  lli testcases;
  testcases=1;
  while(testcases--) {
    solve();
  }
}



Measured memory_bytes: 3652
#include <iostream>
#include <cstdio>
#include <queue>

#define REP(i, N) for(int i = 0; i< N; i++)
using namespace std;

int main(int argc, const char * argv[]) {
    char acrostic[1000];
    int k = 0;
    while((acrostic[k] = getchar())!= '\n'){k++;}
    int a;
    cin >> a;
    int stringsize = strlen(acrostic);
    REP(i, k){
        if(i % a == 0){
            printf("%c", acrostic[i]);
        }
    }
}

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

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


int main() {

    string S;

    cin >> S ;

    if( isKaibun(S) 
        && isKaibun(S.substr(0,(S.size())/2)) 
        && isKaibun(S.substr((S.size()-1)/2+1))
        ){
            cout << "Yes" << endl;
    } else {
            cout << "No" << endl;

    }

    return 0;
}


Measured memory_bytes: 256
#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(){
    int n;
    cin >> n;
    rep(i,10)rep(j,10){
        if(n==i*j) {
            cout<<"Yes"<<endl;
            return 0;
        } 
    }
    cout << "No" << endl;
}

Measured memory_bytes: 3596
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <string>
#include <map>
#include <vector>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)

int main(void)
{
    int a, b, c, rec = 0, rho = 0;
    
    while (~scanf("%d,%d,%d", &a, &b, &c)) {
        if (hypot(a, b) == c)
            rec++;
        else if (a == b)
            rho++;
    }
    
    cout << rec << endl << rho << endl;

    return 0;
}

Measured memory_bytes: 1220
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <vector>
#define Rep(i, n) for(int i=0;i<n;++i)
#define rep(i, n) for(int i=1;i<=n;++i)
#define ll long long int
#define INF 1e9
#define LINF 1e18
#define MOD 1000000007
#define PI 3.14159265359
#define EPS 1e-10
#define All(a) (a).begin(), (a).end()

using namespace std;
using P = pair<ll, ll>;
 
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};

/**
 * Usage:
 * 
 * G[from].push_back(Edge(to, weight));
 * using Graph = vector<vector<Edge>>;
 * 
 */ 
struct Edge {
  int to;     
  ll weight; 
  Edge(int t, ll w) : to(t), weight(w) { }
};

/**
 * Usage:
 * 
 * chmin(old, new);
 * chmax(old, new);
 * 
 */ 
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;
}

template<typename T>
void printv(vector<T>& v) {
  if (v.size() == 0) {
    cout << "\n";
    return;
  }

  Rep(i, v.size()) {
    cout << v[i] << ((i + 1 < v.size()) ? ' ' : '\n');
  }
}




int N;
ll a[110000];

int main () {
  cin >> N;
  rep(i, N) cin >> a[i];

  ll tmp = a[1];
  bool inc = false;
  bool dec = false;

  int ans = 0;

  for (int k=2;k<=N;++k) {
    if (a[k] > tmp) {
      if (inc) {
      } else if (dec) {
        ans++;
        inc = false;
        dec = false;
      } else {
        inc = true;
      }
    } else if (a[k] < tmp) {
      if (dec) {
      } else if (inc) {
        ans++;
        inc = false;
        dec = false;
      } else {
        dec = true;
      }
    }

    tmp = a[k];
  }

  ans++;

  cout << ans << "\n";
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <utility>
#include <numeric>
#include <functional>
#include <stdio.h>
#include <math.h>
#include <string>
#include <algorithm>
#include <deque>
#include <queue>
#include <map>

#define rep(i, m, n) for (int (i)(m); (i)<(n); ++(i))
#define repr(i, m, n) for (int (i)(m - 1); (i)>=(n); --(i))
#define repv(i, v) for (unsigned (i)(0); (i)<(v.size()); ++(i))
#define all(v) (v).begin(), (v).end()
#define sortv(v) sort(all(v))
#define sortgi(v) sort(all(v), greater<int>())
#define sortgd(v) sort(all(v), greater<double>())
#define sortgll(v) sort(all(v), greater<ll>())
#define debug(x) cerr << #x << ": " << x << '\n'

using namespace std;
using pii = pair<int, int>;
using pss = pair<string, string>;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vd = vector<double>;
using vvd = vector<vd>;
using vs = vector<string>;
using ll = long long;
using pllll = pair<ll, ll>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvvb = vector<vvb>;
using vpii = vector<pii>;
using pqi = priority_queue<int>;
using pqd = priority_queue<double>;
using pqll = priority_queue<ll>;
using pqvi = priority_queue<vi>;
using pqvll = priority_queue<vll>;

int lr[1000][1000];

int main() {
	int N, M, Q;
	scanf("%d %d %d", &N, &M ,&Q);
	rep(i, 0, M) {
		int l, r;
		scanf("%d %d", &l, &r);
		++lr[l][r];
	}
	rep(i, 1, N + 1) {
		rep(j, 1, N + 1) {
			lr[i][j] += lr[i][j - 1]; 
		}
	}
	rep(i, 1, N + 1) {
		rep(j, 1, N + 1) {
			lr[j][i] += lr[j - 1][i]; 
		}
	}
	rep(i, 0, Q) {
		int p, q;
		scanf("%d %d", &p, &q);
		printf("%d\n", lr[q][q] - lr[p-1][q] - lr[q][p-1] + lr[p-1][p-1]);
	}
}


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

using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)

unsigned euclidean_gcd(unsigned a, unsigned b)
{
    if (a < b)
        return euclidean_gcd(b, a);
    unsigned r;
    while ((r = a % b))
    {
        a = b;
        b = r;
    }
    return b;
}

int main()
{
    lint n;cin >> n;
    lint ans;
    vector<int> a(n);
    REP(i, n)
    {
        cin >> a[i];
    }
    ans = euclidean_gcd(a[0], a[1]);
    FOR(i,1,n)
    {
        ans = euclidean_gcd(ans, a[i]);
    }

    cout << ans <<"\n";

    return 0;
}

Measured memory_bytes: 640
#!/usr/bin/env python3
# Generated by https://github.com/kyuridenamida/atcoder-tools
from typing import *
import itertools
import math
import sys

INF = float('inf')


def solve(X: int, N: int, p: "List[int]"):
    return min(set(p) ^ set(range(0, 101 + 1)), key=lambda v: abs(v-X))


def main():

    sys.setrecursionlimit(10 ** 6)

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  # type: int
    N = int(next(tokens))  # type: int
    p = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    print(solve(X, N, p))


if __name__ == '__main__':
    main()


Measured memory_bytes: 75156
//============================================================================
// Name        : JOI.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <math.h>
#include <stdio.h>
#include <vector>
using namespace std;
typedef long long ll;
int main() {

	ll n,t;
	ll s;
	ll x=0,r=0;
	cin>>n>>t;
	for(ll i=0;i<n;i++){
		cin>>s;
		if(s<r){
			x=x+t-r+s;
		}else{
			x+=t;
		}
		r=s+t;
	}
	cout<<x<<endl;


	return 0;
}


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

if (2*x-y) % 3 != 0 or (2*y-x) % 3 != 0 or 2*x-y < 0 or 2*y-x < 0:
	print(0)
	exit()

a,b = (2*x-y)//3, (2*y-x)//3

def cmb(n, r, mod):
	if (r < 0) or (n < r):
		return 0
	r = min(r, n-r)
	return fact[n]*factinv[r]*factinv[n-r]%mod


mod = 10**9+7
N = 10**6  # N は必要分だけ用意する
fact = [1, 1]  # fact[n] = (n! mod p)
factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1]  # factinv 計算用

for i in range(2, N+1):
	fact.append((fact[-1]*i)%mod)
	inv.append((-inv[mod%i]*(mod//i))%mod)
	factinv.append((factinv[-1]*inv[-1])%mod)

print(cmb(a+b, b, mod))

Measured memory_bytes: 122064
//@source : 
//@create : 19:10:50 Saturday 27/06/2020
//@author : nghethuat102
//@status : 
#include <bits/stdc++.h>
using namespace std;

void solve() {
    string s, t;
    cin >> s >> t;
    int n = s.size();
    int cnt = 0;
    for (int i = 0; i < n; ++i) {
        cnt += (s[i] != t[i]);
    }
    cout << cnt << "\n";
}

int main() {
    ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    int t = 1;
    while (t--) {
        solve();
    }
    //cerr << fixed << setprecision(5) << double(clock()) * 1000 / CLOCKS_PER_SEC << " ms\n";
    return 0;
}

Measured memory_bytes: 3888
n = int(input())
A = [list(map(int, input().split())) for i in range(n)]
DP = []
for s in range(2**n):
    bit = bin(s)[2:].zfill(n)
    tmp = 0
    for i in range(n):
        for j in range(i + 1, n):
            if bit[i] == '1' and bit[j] == '1':
                tmp += A[i][j]
    DP.append(tmp)
    t = s
    while t:
        DP[s] = max(DP[s], DP[t] + DP[s - t])
        t = (t - 1) & s
print(DP[-1])


Measured memory_bytes: 47644
import java.util.*;
public class Main {

  public static void main(String[] args) { 
      Scanner sc = new Scanner(System.in);
      long x = sc.nextLong();

      long start = 100;
      long yrs = 0;
      while(start < x) {
        long unitInc = start / 100;
        start = start + unitInc;
        yrs++;

      }
      System.out.println(yrs);
  }
}

Measured memory_bytes: 27068
#include<stdio.h>
int main()
{
    int N,M,i,s=0,t;
    scanf("%d%d",&N,&M);
    int A[M];
    for(i=1;i<=M;i++)
    {
        scanf("%d",&A[i]);
    }
    for(i=1;i<=M;i++)
    {
        s=s+A[i];
    }
    t=N-s;
    if(t>0||t==0)
    {
        printf("%d\n",t);
    }
    else
    {
        printf("-1");
    }
}


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

using namespace std;
using ll = long long;
using pii = pair<int, int>;

int H, W, D;
int A[310][310];
int Q;
int L[100010], R[100010];
pii pos[90010];
int cost[90010];

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  cin >> H >> W >> D;
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      cin >> A[i][j];
      pos[A[i][j]] = pii(i, j);
    }
  }
  cin >> Q;
  for (int i = 0; i < Q; i++) {
    cin >> L[i] >> R[i];
  }
  for (int i = 1; i + D <= H * W; i++) {
    cost[i + D] = abs(pos[i + D].first - pos[i].first) + abs(pos[i + D].second - pos[i].second);
    cost[i + D] += cost[i];
  }
  for (int i = 0; i < Q; i++) {
    cout << cost[R[i]] - cost[L[i]] << endl;
  }

  return 0;
}

Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define sqr(x) ((x)*(x))
#define mp make_pair
#define uint unsigned
#define ld long double
#define PI pair<int,int>
inline char gc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
#define gc getchar
inline ll read(){
	ll x = 0; char ch = gc(); bool positive = 1;
	for (; !isdigit(ch); ch = gc())	if (ch == '-')	positive = 0;
	for (; isdigit(ch); ch = gc())	x = x * 10 + ch - '0';
	return positive ? x : -x;
}
inline void write(ll a){
    if(a<0){
    	a=-a; putchar('-');
	}
    if(a>=10)write(a/10);
    putchar('0'+a%10);
}
inline void writeln(ll a){write(a); puts("");}
inline void wri(ll a){write(a); putchar(' ');}
inline ull rnd(){
	return ((ull)rand()<<30^rand())<<4|rand()%4;
}
#define ld long double
const int N=200005;
int n,p[N],tong[N][2],father[N];
ll ans;
priority_queue<pair<ld,int> > q;
inline int gf(int x){
	return father[x]==x?x:father[x]=gf(father[x]);
}
void insert(int x){
	if(x!=1)q.push(mp((ld)tong[x][0]/(tong[x][0]+tong[x][1]),x));
}
void merge(int x,int y){
	father[y]=x; //cout<<x<<" "<<tong[x][1]<<" "<<tong[y][0]<<endl;
	ans+=(ll)tong[x][1]*tong[y][0];
	tong[x][0]+=tong[y][0]; tong[x][1]+=tong[y][1];
	if(x!=1)insert(x);
}
signed main(){
	n=read();
	for(int i=2;i<=n;i++)p[i]=read();
	for(int i=1;i<=n;i++){tong[i][read()]++; insert(i); father[i]=i;}
	while(q.size()){
		int t=q.top().second; q.pop();
		if(father[t]!=t)continue;
		int x=gf(p[t]);
		merge(x,t);
	}
	cout<<ans<<endl;
}
/*
x->y

*/

Measured memory_bytes: 12780
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,a[1000],b[1000],cnt=0;
	cin>>n;
	for(int i=0;i<n;i++)
	{
	cin>>a[i];
	b[i]=i+1;
	if(a[i]!=b[i])
		cnt++;
	}

	if(cnt==2||cnt==0)
	cout<<"YES"<<endl;
	else 
	cout<<"NO"<<endl;

	return 0;
	
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bits/stdc++.h>
#include<cmath>
#include<bitset>
#define ll long long
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,0,n)
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define INF ((1LL<<62)-(1LL<<31))
#define MOD 1000000007
using namespace std;

int main(){
  double N,k=2;
  cin>>N;
  vector<double> A;
  REP(i,N){
    double a;
    cin>>a;
    A.push_back(a);
  }
  SORT(A);
  REVERSE(A);
  
  double ans=0;
  REP(i,N){
    ans+=A[i]/k;
    if(i!=N-2) k*=2;
  }
  
  cout<<setprecision(5)<<ans<<endl;
}


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

int main(){
	char o1, o2;
	int a = 1, b = 0, c = 0;
	int i = 0;
	while(1){//scanf("%c,%c", &o1, &o2) != EOF){
		char q;
		if(!(cin >> o1 >> q >> o2)) break;
		int *p1, *p2;
		if(o1 == '0') break;
		else if(o1 == 'A') p1 = &a;
		else if(o1 == 'B') p1 = &b;
		else if(o1 == 'C') p1 = &c;

		if(o2 == 'A') p2 = &a;
		else if(o2 == 'B') p2 = &b;
		else if(o2 == 'C') p2 = &c;

		if(p1 != p2){
			int s = *p1;
			*p1 = *p2;
			*p2 = s;
		}
		//cout << i << '/'<< a <<  ' ' << b << ' ' << c << endl;
		i++;
	}

	if(a == 1) cout << 'A' << endl;
	if(b == 1) cout << 'B' << endl;
	if(c == 1) cout << 'C' << endl;

	return 0;
}

Measured memory_bytes: 1132
N = int(input())
S = [0,0,0]
for n in range(N):
    a,b,c = [int(i) for i in input().rstrip().split()]
    S = [max(S[1],S[2])+a,max(S[0],S[2])+b,max(S[1],S[0])+c]
    #print(S)
print(max(S))

Measured memory_bytes: 3060
import java.io.*;
import java.util.StringTokenizer;


public class Main {
    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        int n = sc.nextInt();
        int[] a = sc.nextIntArray(n + 1);
        int[] b = sc.nextIntArray(n);
        long ans = 0;
        for (int i = 0; i < n; i++) {
            int take = Math.min(b[i], a[i]);
            b[i] -= take;
            ans += take;
            take = Math.min(b[i], a[i + 1]);
            ans += take;
            a[i + 1] -= take;
        }
        out.println(ans);
        out.flush();
        out.close();
    }


    static class Scanner {

        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream system) {
            br = new BufferedReader(new InputStreamReader(system));
        }


        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        public String nextLine() throws IOException {
            return br.readLine();
        }

        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        public double nextDouble() throws IOException {
            return Double.parseDouble(next());
        }

        public char nextChar() throws IOException {
            return next().charAt(0);
        }

        public Long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        public boolean ready() throws IOException {
            return br.ready();
        }


        public int[] nextIntArray(int n) throws IOException {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        public long[] nextLongArray(int n) throws IOException {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        }


        public Integer[] nextIntegerArray(int n) throws IOException {
            Integer[] a = new Integer[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        public double[] nextDoubleArray(int n) throws IOException {
            double[] ans = new double[n];
            for (int i = 0; i < n; i++)
                ans[i] = nextDouble();
            return ans;
        }

        public short nextShort() throws IOException {
            return Short.parseShort(next());
        }

    }
}

Measured memory_bytes: 47784
#include <algorithm>
#include <bitset>
#include <cstdio>
#include <cassert>
#include <cmath>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

typedef long long LL;
typedef pair<int, int> P;
typedef pair<LL, LL> PLL;

bool solve() {
    constexpr int dx[12] = {2, 2, 1, 0, -1, -2, -2, -2, -1, 0, 1, 2};
    constexpr int dy[12] = {0, 1, 2, 2, 2, 1, 0, -1, -2, -2, -2, -1};

    int sx, sy;
    int N;
    int px[10], py[10];

    cin >> sx >> sy;
    if (sx == 0 && sy == 0) { 
        return false;
    }

    cin >> N;
    for (int j = 0; j < N; ++j) {
        cin >> px[j] >> py[j];
    }

    char alive[15][10][10];
    for (int j = 0; j <= N; ++j) {
        for (int k = 0; k < 10; ++k) {
            fill(alive[j][k], alive[j][k] + 10, 0);
        }
    }

    alive[0][sx][sy] = 1; // start position
    for (int j = 0; j < N; ++j) {
        for (int k = 0; k < 10; ++k) {
            for (int l = 0; l < 10; ++l) {
                if (alive[j][k][l] == 0) { continue; }
                int gx = px[j], gy = py[j];

                for (int m = 0; m < 12; ++m) {
                    int nx = k+dx[m], ny = l+dy[m];
                    if (nx < 0 || nx >= 10 || ny < 0 || ny >= 10) { continue; }
                    if (max(abs(gx-nx), abs(gy-ny)) <= 1) {
                        alive[j+1][nx][ny] = 1;
                    }
                }
            }
        }
    }

    for (int j = 0; j < 10; ++j) {
        for (int k = 0; k < 10; ++k) {
            if (alive[N][j][k] == 0) { continue; }
            if (max(abs(j-sx), abs(k-sy))) {
                cout << "OK" << endl;
                return true;
            }
        }
    }

    cout << "NA" << endl;
    return true;
}

int main() {
    while (solve());
    return 0;
}

Measured memory_bytes: 3000
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define pii pair<int,int>
#define pll pair<lli,lli>
#define vi  vector<int>
#define vii vector<pair<int,int>>
#define vll vector<lli>
#define pb  push_back
#define mpr  make_pair
#define ff  first
#define ss  second
#define mod 1000000007
#define pie 3.14159265358979323846264338327950L
#define all(x) x.begin(),x.end()
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define testcase() int t;cin>>t;while(t--)
#define clean(x) memset(x,0,sizeof(x))
#define FOR(x,y) for(int i=x;i<=y;i++)
const lli maxn = 2e5+9;
vector<lli> catlan(int n) {
    vector<lli> dp(n + 1, 0);
    dp[0] = 1;
    dp[1] = 1;
    for (int i = 2; i <= n; i ++) {
        for (int j = 0; j < i; ++ j) {
            dp[i] += dp[j] * dp[i - j - 1];
        }
    }
    return dp;
}
lli b_ex(lli n,lli a){lli res=1;while(n){if(n%2==1)res*=a;n>>=1;a=a*a;}return res;}
lli ncr(lli n,lli k){lli ans=1;if(k>n-k)k=n-k;for(lli i=1;i<=k;i++){ans*=(n-i+1),ans=ans/i;}return ans;}
lli power(lli a , lli n){lli ans = 1;while(n){if(n % 2)ans = (ans * a) % mod;n /= 2;a = (a * a) % mod;}return ans;}
lli lcm(lli a,lli b){lli ans=(a*b)/(__gcd(a,b));return ans;}
lli set_bits(lli n)
{
    int c=0;
    if(n==0)return 0;
    while(n)
    {
        if((n&1)==1)
        {
           cout<<c<<" ";
        }
        c++;
        n=n>>1;
    }
    return c;
}

string X="IF THE CONSTRAINTS ARE LOW JUST BRUTE FORCE IT!!!!!!!!!!!!!!!!!!!!!";
///------------------ALWAYS lli-----TEMP TSF99--------------------------------------------------------------------------------------///


void solve()
{
    int  n;cin>>n;
    int lol[n+1];
    lli sum=0;
    for(int i=1;i<=n;i++)
    {
        cin>>lol[i];
        sum+=lol[i];
    }
    int m;cin>>m;
    while(m--)
    {
        int p,x;cin>>p>>x;
        int temp=lol[p];
        sum-=temp;
        sum+=x;
        cout<<sum<<endl;
        sum-=x;sum+=temp;
    }

}
int main()
{
    solve();
}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define ll long long
#define _GLIBCXX_DEBUG
const ll MOD = 1000000007;
const ll Mod = 998244353;
const int MAX = 510000;
const double PI = 3.14159265358979323846;

// 素因数分解(素因数とその指数を返す)
map<ll, int> prime_factor(ll n) {
  map<ll, int> ret;
  for (ll i=2; i*i<=n; i++) {
    while (n%i==0) {
      ret[i]++;
      n /= i;
    }
  }
  if (n!=1) ret[n] = 1;
  return ret;
}

int main() {
  ll N;
  cin >> N;
  if (N==1) cout << 0 << endl;
  else {
    set<ll> rem; // 割っていい数
    map<ll, int> dict = prime_factor(N);
    for (auto p: dict) {
      auto key = p.first;
      auto value = p.second;
      for (int i=1; i<=value; i++) rem.insert((ll)pow(key, i));
    }
    ll res = 0;
    while (true) {
      for (auto value: rem) {
        if (N%value!=0) rem.erase(value);
        else {
          N /= value;
          rem.erase(value);
          res++;
          break;
        }
      }
      auto itr = rem.begin();
      if (*itr>N||rem.empty()) break;
    }
    cout << res << endl;
  }
}

Measured memory_bytes: 4112
from heapq import *
import sys
from collections import *
from itertools import *
from decimal import *
import copy
from bisect import *
import math
sys.setrecursionlimit(4100000)
def gcd(a,b):
    if(a%b==0):return(b)
    return (gcd(b,a%b))
input=lambda :sys.stdin.readline().rstrip()



X,K,D=map(int,input().split())

if X<0:
    X*=-1


k=X//D
if k>=K:
    print(X-K*D)
else:
    K-=k
    if K%2:
        print(-(X-(k+1)*D))
    else:
        print(X-k*D)


Measured memory_bytes: 77196
use std::io::*;
use std::str::FromStr;
 
/* 
The read function reads a string according to each one. 
*/
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}
 
//main function
fn main() {
    let mut x: i64 = read();
    let mut sum: i64 = (x/500)*1000;
    x%=500;
    sum += (x/5)*5;
    println!("{}",sum);
}


Measured memory_bytes: 4352
#include <stdio.h>

 int main(void) {
 
long a, b;
 
while(scanf("%ld %ld", &a, &b) != EOF) { 

printf("%ld ", a / b); printf("%ld ", a % b);

printf("%.5lf\n", ((double)a / (double)b));

 }

 return 0;
 
}

Measured memory_bytes: 636
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
#include <algorithm> 
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i,n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<"\n"
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define mp make_pair
#define sz(x) (ll)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using vc = vector<char>;
using vvc = vector<vc>;
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; 
}
ll dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};
int main(){
  ll m,k;
  cin>>m>>k;
  if((1<<m)<=k){
    COUT(-1);
    return 0;
  }
  if(m==0){
    cout<<0<<" "<<0<<endl;
    return 0;
  }
  else if(m==1&&k==1){
    COUT(-1);
    return 0;
  }
  else if(m==1&&k==0){
    cout<<0<<" "<<0<<" "<<1<<" "<<1<<endl;
    return 0;
  }
  else{
    ll cu=0;
    vll a(1<<m);
    rep(i,sz(a)){
      a[i]=i;
    }
    rep(i,sz(a)){
      if(i==k) continue;
      cout<<a[i]<<" ";
    }
    cout<<k<<" ";
    for(int i=sz(a)-1;i>=0;i--){
      if(i==k) continue;
      cout<<a[i]<<" ";
    }
    cout<<k<<endl;
  }
}


Measured memory_bytes: 4268
n=int(input())
a=list(map(int,input().split()))
for i in range(n):
    a[i]-=(i+1)
a.sort()
if n%2==1:
    median=a[(n-n%2)//2]
    ans=0
    for i in range(n):
        ans+=abs(a[i]-median)
else:
    median1=a[n//2-1]
    median2=a[n//2]
    ans1,ans2=0,0
    for i in range(n):
        ans1+=abs(a[i]-median1)
        ans2+=abs(a[i]-median2)
        ans=min(ans1,ans2)
print(ans)


Measured memory_bytes: 26016
# coding: utf-8
# Your code here!

n, k = map(int, input().rstrip().split())

p = []
for i in range(n):
    i = i+1
    if i>=k:
        p.append(1/n)
    else:
        # 何回2倍すればkを上回るか計算
        cnt = 0
        doubled_i = i
        while doubled_i<k:
            doubled_i *= 2
            cnt += 1
        p.append(1/n * 1/(2**cnt))

print(sum(p))

Measured memory_bytes: 6296
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

l = int(readline())
a = list(map(int,read().split()))

dp = [[0] * (l+1) for _ in range(5)]

for i in range(l):
    dp[0][i+1] = dp[0][i] + a[i]

for i in range(l):
    dp[1][i+1] = min(dp[0][i+1],
                    min(dp[0][i], dp[1][i]) + (a[i]%2 if a[i]!=0 else 2))

for i in range(l):
    dp[2][i+1] = min(dp[1][i+1],
                    min(dp[0][i], dp[1][i], dp[2][i]) + (a[i]-1)%2)

for i in range(l):
    dp[3][i+1] = min(dp[2][i+1],
                    min(dp[0][i], dp[1][i], dp[2][i], dp[3][i]) + (a[i]%2 if a[i]!=0 else 2))

for i in range(l):
    dp[4][i+1] = min(dp[3][i+1],
                    min(dp[0][i], dp[1][i], dp[2][i], dp[3][i], dp[4][i]) + a[i])

print(dp[-1][-1])

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

long long calc(int w, int h, int v, int t, int x, int y, int p, int q) {
  long long c = 0;
  long long d = v * t;
  for (int i = -d / w - 2; i < d / w + 2; ++i) {
    long long tx = i * w + (i % 2 ? w - p : p);
    if (abs(tx - x) > d) {
      continue;
    }
    double dy = sqrt(d * d - (tx - x) * (tx - x));
    if (abs(q - y) > dy) {
      continue;
    }
    int r[] = { (dy + y) / h, -(dy - y) / h - 1 };
    if (y > dy) r[1]--;
    if (r[0] == r[1]) {
      if ((tx - x) * (tx - x) + (q - y) * (q - y) <= d * d) c++;
    } else {
      c += r[0] - r[1] - 1;
      for (int k = 0; k < 2; ++k) {
        long long ty = r[k] * h + (r[k] % 2 ? h - q : q);
        if ((tx - x) * (tx - x) + (ty - y) * (ty - y) <= d * d) c++;
      }
    }
  }
  return c;
}

int main() {
  int w, h, v, t, x, y, p, q;
  cin >> w >> h >> v >> t >> x >> y >> p >> q;
  cout << calc(w, h, v, t, x, y, p, q) << endl;
}

Measured memory_bytes: 1160
n = int(input())
goukei = 1
ok = 0
arr = [int(x) for x in input().split()]
if 0 in arr:
    print(0)
else:
    for i in arr:
        goukei *= int(i)
        if goukei > 1000000000000000000:
            print(-1)
            ok = 1
            break
    if ok == 0:
        print(goukei)

Measured memory_bytes: 21648
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string>
#include <tuple>
#include <vector>
#include <map>
#include <unordered_map>
#include <list>
#include <set>
#include <stack>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <cassert>
#include <iomanip>
using namespace std;
#define LL long long
#define MP(a, b) make_pair(a, b)
#define MMP(a, b, c) make_pair(make_pair(a, b), c)
#define MAX 1000000000
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483648
#define INT_MAX 2147483647
#define LL_MIN -9223372036854775808
#define LL_MAX 9223372036854775807
#define PI 3.14159265359

int main(){
	ios::sync_with_stdio(false);
	
	int N;
	LL K;
	cin >> N >> K;
	int count[60] = {};
	for(int i=0; i<N; i++){
		LL A;
		cin >> A;
		for(int j=0; j<60; j++){
			count[j] += A%2;
			A = (A >> 1);
		}
	}

	LL X = 0;
	LL ans = 0;
	for(int i=59; i>=0; i--){
		if(X + ((LL)1<<i) <= K && count[i] < ceil((double)N/2)){
			X += ((LL)1<<i);
			ans += ((LL)1<<i) * (N-count[i]);
		}
		else{
			ans += ((LL)1<<i) * count[i];
		}
		//cout << ans << endl;
	}

	cout << ans << endl;

	return 0;
}

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



int main(){
	long long K,A,B;cin>>K>>A>>B;
	K += 1;
	if(B - A > 2 && K >= A){
		long long rem = K - A;
		cout<<A + (B-A)*(rem/2) + (rem%2)<<endl;
	}else{
		cout<<K<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <tuple>
#include <map>
#include <functional>
using namespace std;

using pii=pair<int64_t,int64_t>;
int main(){
    vector<int> isPrime(1000000,1);
    isPrime[0]=isPrime[1]=0;
    for(int i=2;i<1000000;i++){
        if(isPrime[i])
        for(int k=2;i*k<1000000;k++){
            isPrime[i*k]=0;
        }
    }
    vector<int64_t> P;
    for(int i=2;i<1000000;i++){
        if(isPrime[i])P.push_back(i);
    }
    int64_t N;
    cin>>N;
    map<int64_t,int64_t> M;
    int64_t temp=N;
    for(auto p:P){
        while(temp&&temp%p==0){
            M[p]++;
            temp/=p;
        }
    }
    if(temp!=1) M[temp]=1;
    vector<pii> V;
    for(auto p:M) V.push_back(p);
    int64_t ans=0;
    function<void(int,int64_t)> rec = [&](int i,int64_t num){
        if(i==V.size()){
            int64_t m=num-1,k=N/num;
            if(k<m) ans+=m;
        }else{
            for(int64_t j=0,k=1;j<=V[i].second;j++,k*=V[i].first) rec(i+1,num*k);
        }
    };
    rec(0,1);
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 5872
import java.io.*;
import java.util.*;

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

	int a = sc.nextInt();
	int b = sc.nextInt();
	int c = sc.nextInt();
	int tmp;

	if (a > b) {
	    tmp = a;
	    a = b;
	    b = tmp;
	}
	if (a > c) {
	    tmp = a;
	    a = c;
	    c = tmp;
	}
	if (b > c) {
	    tmp = b;
	    b = c;
	    c = tmp;
	}

	System.out.println(a + " " + b + " " + c);
    }
}


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

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

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

  int n; cin >> n;
  vector<int> A(n), B(n);
  REP(i, n) cin >> A[i];
  REP(i, n) cin >> B[i];
  int ans = 0;
  REP(j, 29) {
    vector<int> b(n);
    REP(i, n) b[i] = B[i] % (1 << (j + 1));
    sort(ALL(b));
    // REP(i, n) cout << b[i] << ' ';
    // cout << '\n';
    int cnt = 0;
    REP(i, n) {
      int a = A[i] % (1 << (j + 1));
      if (a <= (1 << j)) {
        int lb = lower_bound(ALL(b), (1 << j) - a) - b.begin();
        int ub = lower_bound(ALL(b), (1 << (j + 1)) - a) - b.begin();
        cnt += ub - lb;
      } else {
        int lb = 0;
        int ub = lower_bound(ALL(b), (1 << (j + 1)) - a) - b.begin();
        cnt += ub - lb;
        lb = lower_bound(ALL(b), (1 << (j + 1)) + (1 << j) - a) - b.begin();
        ub = n;
        cnt += ub - lb;
      }
    }
    if (cnt & 1) ans += 1 << j;
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 2672
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long int
#define rep(i, n) for(int i = 0; i < n; i++)
#define repp(i, n) for(int i = 1; i <= n; i++)
#define sort(v) sort((v).begin(), (v).end())
#define riverse(v) reverse((v).begin(), (v).end())
using vi = vector<int>;
using vs = vector<string>;
using vll = vector<ll>;
const int MOD = 1e9+7;

int main() {
    string S;
    cin >> S;
    int ans = 0;
    int n = S.size();
    for (int i = n - 1; i >= 1; i--) {
        string t;
        t = S.erase(i);
        string u = t;
        int tn = t.size();
        if (t.size() % 2 == 0) {
            if (u.substr(tn / 2) == t.erase(tn / 2)) {
                ans = tn;
                break;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
//package abc044a;

import java.util.*;
public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		int n, k, x, y, ans;
		
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		k = sc.nextInt();
		x = sc.nextInt();
		y = sc.nextInt();
		
		if(n > k)
		{
			ans = k * x + (n - k) * y;
			System.out.println(ans);
		}
		else
		{
			ans = n * x;
			System.out.println(ans);
		}
	}

}


Measured memory_bytes: 23124
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <queue>
#include <deque>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define rep(i, up) for (ll i = 0; i < up; ++i)
#define repp(i, up) for (ll i = 0; i <= up; ++i)
#define rrep(i, lo, up) for (ll i = lo; i < up; ++i)
#define rrepp(i, lo, up) for (ll i = lo; i <= up; ++i)

#define rdi(i) ll i; scanf("%lld", &i)
#define rds(s) string s; cin >> s
#define rdc(c) char c; cin >> c

#define INF 10000000000
#define MOD 1000000007

ll gcd(ll a, ll b)
{
    if (a < b) {
        return gcd(b, a);
    }
    ll r;
    while (r = a % b) {
        a = b;
        b = r;
    }
    return b;
}

int main()
{
    ll s, w;
    cin >> s >> w;
    if (s <= w) {
        cout << "unsafe" << endl;
    } else {
        cout << "safe" << endl;
    }
    return 0;
}

Measured memory_bytes: 3036
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);++i)
using namespace std;

int main(){
    int a,b,c,d;
    cin >> a >> b>>c>>d;
    while(true){
        c -= b;
        if(c <= 0){
            cout << "Yes" <<endl;
            break;
        }

        a -= d;
        if(a <= 0) {
            cout << "No" << endl;
            break;
        }
    }
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
const unsigned int MOD = 1000000007;
#define ll long long
#define PI 3.1416
string day[]={"SUN","MON","TUE","WED","THU","FRI","SAT"};
int main() {
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    string str;
    while(cin>>str){
        if(str=="Sunny")cout<<"Cloudy"<<endl;
        else if(str=="Cloudy")cout<<"Rainy"<<endl;
        else cout<<"Sunny"<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
# 2019/09/09

from collections import deque

h,w=map(int,input().split())
n=int(input())
a=list(map(int,input().split()))

res=[]
for i in range(n):
    res+=[i+1]*a[i]

res=deque(res)

for i in range(h):
    tmp=[]
    for j in range(w):
        tmp.append(res.popleft())
    if i%2:print(*tmp[::-1])
    else:print(*tmp)

Measured memory_bytes: 4212
function main(input) {
  input = input.split('\n');
  let line = input[0].split(' ');
  let a = BigInt(line[0]);
  let b = BigInt(line[1].replace('.', ''));
  let r = (a * b) / 100n;
  console.log(r + '');
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));


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

using namespace std;
typedef long long ll;

#define INF (long long)(1e9+7)
#define REP(i,n) for(ll i = 0; i < n; i++)
#define REP1(i,n) for(ll i = 1; i <= n; i++)

int main(void)
{
  ll r;
  cin >> r;
  printf("%.7f\n", r*2*3.1415926);
	return 0;
}


Measured memory_bytes: 3752
#include <iostream>

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

struct Card {
  char suit;
  int num;
};

void swapCard(Card *x, Card *y) {
  Card temp{x->suit, x->num};
  x->suit = y->suit;
  x->num = y->num;
  y->suit = temp.suit;
  y->num = temp.num;
}

int partition(Card *A, int p, int r) {
  int x = A[r].num;

  int i = p;
  for (int j = p; j < r; ++j) {
    if (A[j].num <= x) {
      swapCard(&A[i], &A[j]);
      i++;
    }
  }

  swapCard(&A[i], &A[r]);

  return i;
}

void quickSort(Card *A, int p, int r) {
  if (p < r) {
    int q = partition(A, p, r);
    quickSort(A, p, q - 1);
    quickSort(A, q + 1, r);
  }
}

void merge(Card *A, int n, int left, int mid, int right) {
  int n1 = mid - left;
  int n2 = right - mid;
  Card L[n1 + 1], R[n2 + 1];

  for (int i = left; i < mid; ++i) {
    L[i - left].suit = A[i].suit;
    L[i - left].num = A[i].num;
  }

  for (int i = mid; i < right; ++i) {
    R[i - mid].suit = A[i].suit;
    R[i - mid].num = A[i].num;
  }

  L[n1].num = R[n2].num = (1 << 30);

  int l = 0, r = 0;
  for (int i = left; i < right; ++i) {
    if (L[l].num <= R[r].num) {
      A[i] = L[l];
      l++;
    } else {
      A[i] = R[r];
      r++;
    }
  }
}

void mergeSort(Card *A, int n, int left, int right) {
  if (right - left <= 1)
    return;

  int mid = (left + right) / 2;
  mergeSort(A, n, left, mid);
  mergeSort(A, n, mid, right);
  merge(A, n, left, mid, right);
}

int main() {
  int n;
  std::cin >> n;
  Card A[n], B[n];
  rep(i, n) std::cin >> A[i].suit >> A[i].num;

  rep(i, n) {
    B[i].suit = A[i].suit;
    B[i].num = A[i].num;
  }

  quickSort(A, 0, n - 1);
  mergeSort(B, n, 0, n);

  bool isStable = true;
  rep(i, n) {
    if (A[i].suit != B[i].suit) {
      isStable = false;
      break;
    }
  }
  std::cout << (isStable ? "Stable" : "Not stable") << '\n';

  rep(i, n) { std::cout << A[i].suit << ' ' << A[i].num << '\n'; }

  return 0;
}



Measured memory_bytes: 5440
n,h = map(int,input().split())
a = []
b = []
res = 0
for i in range(n):
    a1,b1=[int(i) for i in input().split()]
    a.append(a1)
    b.append(b1)

amax = max(a)
bthrow = [bs for bs in b if bs >= amax ]
bthrow.sort(reverse=True)
damage = 0 
while damage < h and res < len(bthrow):
    damage += bthrow[res]
    res += 1

if damage < h:
    res += (h-damage+amax-1) // amax

print(res)

Measured memory_bytes: 12128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;

class UnionFind{
public:
    UnionFind(int n){
        size = n;
        parent = vector<int>(size,-1);
    }
    int getSize(){return size;}
    int getParentElement(int index){return parent[index];}
    void printParent(){
        for(auto v: parent) {cout << v << " ";}
        cout << endl;
    }
    int find(int x){
        int a = x;
        vector<int> children;
        while(parent[a]>=0){
            children.push_back(a);
            a = parent[a];
        }
        for(auto child: children){parent[child] = a;}
        return a;
    }
    int Union(int x,int y){
        int root_x = find(x);
        int root_y = find(y);
        if(root_x != root_y){
            if(parent[root_x]>=parent[root_y]){
                parent[root_x] += parent[root_y];
                parent[root_y] = root_x;
            }else{
                parent[root_y] += parent[root_x];
                parent[root_x] = root_y;
            }
        }
        return parent[root_x];
    }
private:
    int size;
    vector<int> parent;
};

int main(){
    int n, m;
    cin >> n >> m;
    vector<int> p(n);
    vector<pii> xy(m);
    UnionFind uf(n);
    for(int i = 0; i < n; i++){
        int a;
        cin >> a;
        a--;
        p[i] = a;
    }
    for(int i = 0; i < m; i++){
        int a, b;
        cin >> a >> b;
        a--; b--;
        uf.Union(a,b);
    }
    int ans = 0;
    for(int i = 0; i < n; i++){
        if(uf.find(i)==uf.find(p[i])){ans++;}
    }

    cout << ans << endl;



    return 0;

}


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

int N, A[3];
vector<int> l;
vector<int> p;

int dfs(int i = 0) {
    int ret = INT32_MAX;

    if (i == N) {
        // cout << "--------------------------" << endl;
        // for (auto q : p) cout << q;
        // cout << endl;

        int use = 0;
        int sm[3] = {0};

        rep(i, N) {
            if (p[i] != 3) {
                sm[p[i]] += l[i];
                use++;
            }
        }

        // printf("sm[0], sm[1], sm[2] = %d, %d, %d\n", sm[0], sm[1], sm[2]);

        // 合成魔法はMP10を消費
        ret = (use - 3) * 10;

        // あとはA, B, Cに延長 or 短縮を使って合わせる
        rep(i, 3) {
            if (sm[i] == 0) return INT32_MAX;
            ret += abs(sm[i] - A[i]);
        }

        return ret;
    }

    // i番目はA（0）に使う
    // p.push_back(0);
    p[i] = 0;
    ret = min(ret, dfs(i + 1));

    // i番目はB（1）に使う
    // p.pop_back();
    // p.push_back(1);
    p[i] = 1;
    ret = min(ret, dfs(i + 1));

    // i番目はB（2）に使う
    // p.pop_back();
    // p.push_back(2);
    p[i] = 2;
    ret = min(ret, dfs(i + 1));

    // i番目は最後まで使わない
    // p.pop_back();
    // p.push_back(3);
    p[i] = 3;
    ret = min(ret, dfs(i + 1));

    return ret;
}

int main() {
    cin >> N >> A[0] >> A[1] >> A[2];
    l.resize(N);
    rep(i, N) cin >> l[i];

    p.resize(N);
    cout << dfs(0) << endl;
    return 0;
}

Measured memory_bytes: 3584
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<iomanip>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
#define LINF (long long)4e18

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;



int main(){
   int N; cin >> N;
   vector<int> a(N);
   rep(i,N) cin >> a[i];
   vector<int> num(9);
   rep(i,N){
       if(a[i] < 400) num[0]++;
       else if(a[i] < 800) num[1]++;
       else if(a[i] < 1200) num[2]++;
       else if(a[i] < 1600) num[3]++;
       else if(a[i] < 2000) num[4]++;
       else if(a[i] < 2400) num[5]++;
       else if(a[i] < 2800) num[6]++;
       else if(a[i] < 3200) num[7]++;
       else num[8]++;
   }
   int m = 0;
   int M = 0;
   rep(i,8){
       if(num[i] > 0) m++;
   }
   M = m + num[8];
   if(m == 0) m++;
   cout << m << " " << M << endl;
}


Measured memory_bytes: 256
N = int(input())
S_dic = {}
for i in range(N):
  S = input()
  if S in S_dic.keys():
    S_dic[S] += 1
  else:
    S_dic[S] = 1
sort_dic = sorted(S_dic.items(), key=lambda x:x[1], reverse=True)
before = 0
ans = []
for i in sort_dic:
  if i[1] >= before:
    ans.append(i[0])
  else:
    break
  before = i[1]
ans.sort()
for i in ans:
  print(i)
  

Measured memory_bytes: 45788