akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long

const int N=2e5+5;
const int MOD=1e9+7;

int n;
int a[N], first[N], last[N];
int fact[N], invfact[N];

int pow(int a, int b, int m)
{
	int ans=1;
	while(b)
	{
		if(b&1)
			ans=(ans*a)%m;
		b/=2;
		a=(a*a)%m;
	}
	return ans;
}


int modinv(int k)
{
	return pow(k, MOD-2, MOD);
}

void precompute()
{
	fact[0]=fact[1]=1;
	for(int i=2;i<N;i++)
	{
		fact[i]=fact[i-1]*i;
		fact[i]%=MOD;
	}
	invfact[N-1]=modinv(fact[N-1]);
	for(int i=N-2;i>=0;i--)
	{
		invfact[i]=invfact[i+1]*(i+1);
		invfact[i]%=MOD;
	}
}

int nCr(int x, int y)
{
	if(y>x)
		return 0;
	if(x==0)
		return 0;
	int num=fact[x];
	num*=invfact[y];
	num%=MOD;
	num*=invfact[x-y];
	num%=MOD;
	return num;
}

int32_t main()
{
	IOS;
	precompute();
	cin>>n;
	for(int i=1;i<=n+1;i++)
	{
		cin>>a[i];
		if(!first[a[i]])
			first[a[i]]=i;
		last[a[i]]=i;
	}
	int x, y;
	for(int i=1;i<=n;i++)
	{
		if(first[i]!=last[i])
			x=first[i]-1, y=n+1-last[i];
	}
	for(int i=1;i<=n+1;i++)
	{
		int ans=nCr(n+1, i);
		ans-=nCr(x+y, i-1);
		ans+=MOD;
		ans%=MOD;
		if(i==1)
			ans=n;
		cout<<ans<<endl;
	}
	return 0;
}


Measured memory_bytes: 8192
import java.util.Scanner;

public class Main {
    static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) {
        double r = sc.nextDouble();
        double rr = 2 * r * Math.PI;
        double rrr = r * r * Math.PI;

        System.out.printf("%.10f %.10f\n",rrr,rr);

    }
}



Measured memory_bytes: 28268
n, k = map(int, input().split())
sum_b = 0
ab_list = []

for i in range(n):
    ab_list.append(list(map(int, input().split())))

ab_list.sort()
for i in range(n):
    a, b = ab_list[i]
    sum_b += b
    if sum_b >= k:
        print(a)
        break


Measured memory_bytes: 27612
#include<iostream> 
#include<string> 
#include<vector>  
#include<algorithm> 
#include<cmath>
using namespace std; 
int main() {
	int n; 
	cin >> n; 
	if (n==3||n==5||n==7)
	{
		cout << "YES\n";
	} 
	else
	{
		cout << "NO\n";
	}


}

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

int main(void)
{
    std::string a, b;
    std::cin >> a >> b;
    int n = std::stoi(a + b);
    bool flag = false;
    for (int i = 0; (i * i) <= n; ++i)
    {
        if (i * i == n)
        {
            flag = true;
        }
    }
    std::cout << (flag ? "Yes" : "No") << std::endl;
}


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

int main(int argc, char const *argv[])
{
	string s;
	int k;
	cin>>s>>k;
	set<char> memo;
	for (int i = 0; i < s.size(); ++i)
	{
		memo.insert(s[i]);
	}
	set<string> ans;
	for (auto i = memo.begin(); i != memo.end(); ++i)
	{
		for (int j = 0; j < s.size(); ++j)
		{
			if (s[j]==*i)
			{
				for (int l = 1; l <= k; ++l)
				{
					if (j+l-1==s.size())
					{
						break;
					}
					ans.insert(s.substr(j,l));
				}
			}
		}
		if (ans.size()>=k)
		{
			auto itr=ans.begin();
			for (int i = 0; i < k-1; ++i)
			{
				++itr;
			}
			cout<<*itr<<endl;
			return 0;
		}
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = int(A); I < int(B); ++I)
#define FORR(I,A,B) for(ll I = int((B)-1); I >= int(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //xi>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //xi>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd(ll a,ll b){if(a<b)swap(a,b);if(a%b==0)return b;return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}//saisyo kobaisu
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=1e18+7;
const ll MOD=1e9+7;



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

	string s;
	ll ans1=0,ans2=0;
	cin >> s;
	FOR(i,0,s.size()){
		if((i&1) && s[i]=='1')ans1++;
		if(!(i&1) && s[i]=='0')ans1++;
	}
	FOR(i,0,s.size()){
		if((i&1) && s[i]=='0')ans2++;
		if(!(i&1) && s[i]=='1')ans2++;
	}
	cout << min(ans2,ans1) << endl;
}

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

int main(){
    int N;
    scanf("%d",&N);
    pair<int,int> p[N];
    pair<int,int> q[N];
    for(int i=0;i<N;i++){
        scanf("%d",&p[i].first);
        p[i].second=i;
    }
    sort(p,p+N);
    for(int i=0;i<N;i++){
        if(N/2-i>0){
            q[i].first=p[i].second;
            q[i].second=p[N/2].first; 
        }
        else{
            q[i].first=p[i].second;
            q[i].second=p[N/2-1].first;
        }
    } 
    sort(q,q+N);
    for(int i=0;i<N;i++){
        printf("%d\n",q[i].second);
    }
    return 0;
}


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

using namespace std;
using ll = long long;

template <class T> ostream &operator<<(ostream &os, vector<T> &v) {
  for (auto i = v.begin(); i != v.end(); i++) {
    os << *i << " ";
  }
  return os;
}


void solve(long long N, std::string S){
  char left = S[0];
  ll ans=1;
  for(int i=1; i<N; i++) {
    if(left!=S[i]) {
      ans++;
      left = S[i];
    }
  }
  std::cout << ans << std::endl;
}

int main(){
  long long N;
  scanf("%lld",&N);
  std::string S;
  std::cin >> S;
  solve(N, S);
  return 0;
}


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

class Main{
	static int n,mat[][];
	static long ans;
	static StringBuilder allset;
	static long dp[][];
	public static void main(String[] args) throws IOException{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		int t=1;
//		Integer.parseInt(br.readLine().trim());
		OutputStream outputStream =System.out;
        PrintWriter out =new PrintWriter(outputStream);
		StringBuilder printans=new StringBuilder();
		while(t-->0)
		{
			StringTokenizer tok=new StringTokenizer(br.readLine()," ");
			n=Integer.parseInt(tok.nextToken());
			
			mat=new int[n][n];
			for(int i=0;i<n;i++) {
				tok=new StringTokenizer(br.readLine()," ");
				for(int j=0;j<n;j++)
					mat[i][j]=Integer.parseInt(tok.nextToken());
			}
			dp=new long[n+1][1<<n];
			memset();
			System.out.println(call(0,0));
		}
		
	}
	static long call(int i,int mask) {
		
		if(i==n) {
			
			if((mask&1<<n+1)==0)return 1;
			
			
			return 0;
		}
		if(dp[i][mask]!=-1)return dp[i][mask];
		long ans=0;
		for(int j=0;j<n;j++) {
			if((mask & (1<<j))==0 && mat[i][j]==1) {
				mask|=(1<<j);
				ans+=call(i+1,mask);
				mask^=(1<<j);
			}
			
			
		}
		dp[i][mask]=ans%mod;
		return ans%mod;
	}
	static void memset() {
		for(int i=0;i<dp.length;i++) {
			Arrays.fill(dp[i], -1);
		}
	}
	static int mod=(int)1e9+7;
}

Measured memory_bytes: 384468
from collections import deque
(d,), cc, *ss = [list(map(int, s.split())) for s in open(0)]

ss = deque(ss)

acc = [0]*len(cc)

while d:
    acc = [sum(x) for x in zip(acc, cc)]
    gain = [sum(x) for x in zip(acc, ss.popleft())]
    m = max(gain)
    for i, g in enumerate(gain):
        if m == g:
            cur = i
            break
    print(cur+1)
    acc[cur] = 0
    d -= 1

Measured memory_bytes: 9520
import sys
MOD = 998244353


def main():
    input = sys.stdin.buffer.readline
    n, s = map(int, input().split())
    a = list(map(int, input().split()))
    dp = [[None] * (s + 1) for _ in range(n + 1)]
#     dp[i][j]:=集合{1..i}の空でない部分集合T全てについて,和がjとなる部分集合の個数の和
    for i in range(n + 1):
        for j in range(s + 1):
            if i == 0 or j == 0:
                dp[i][j] = 0
                continue
            if j > a[i - 1]:
                dp[i][j] = dp[i - 1][j] * 2 + dp[i - 1][j - a[i - 1]]
            elif j == a[i - 1]:
                dp[i][j] = dp[i - 1][j] * 2 + pow(2, i - 1, MOD)
            else:
                dp[i][j] = dp[i - 1][j] * 2
            dp[i][j] %= MOD
    print(dp[n][s])


if __name__ == '__main__':
    main()


Measured memory_bytes: 278892
import sys

input = sys.stdin.readline
N = int(input())
d = {}
for _ in range(N):
    s = input().replace('\n', '')
    d[s] = d.get(s, 0) + 1
max_count = 0
for count in d.values():
    max_count = max(max_count, count)

ans = sorted([k for k, v in d.items() if v == max_count])
print('\n'.join(ans))


Measured memory_bytes: 127740
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <functional>
#include <string>
#include <map>//map<int, int> x;
#include <numeric>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))

using ll = long long;
using namespace std;
 int main(){
 ll aaaaa;
 int n,k,d,count=0,tmp=0;
  cin>>n>>k;
  vector<int>a(n);
 rep(i,k){
   cin>>d;
 rep(j,d){
   cin>>tmp;
   a[tmp-1]=1;
 }
 }
 rep(i,n){
 if(a[i]==0)count++;
 }

cout<<count<<endl;
}

Measured memory_bytes: 3624
//
//  main.cpp
//

#include <algorithm>
#include <array>
#include <assert.h>
#include <iostream>
#include <limits>
#include <math.h>
#include <memory>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

using ll = long long;
using ull = unsigned long long;

template <typename T>
vector<vector<T>> alloc_double_vec(size_t rows, size_t cols, T init) {
    vector<vector<T>> ret;
    vector<T> ret_elem;
    ret_elem.resize(cols, init);
    ret.resize(rows, ret_elem);
    return ret;
}

int main() {
    int N, M;
    cin >> N >> M;
    struct Box {
        bool has_red;
        int count;
    };
    vector<Box> boxes(N, Box{false, 1});
    boxes[0].has_red = true;
    for (int i = 0; i < M; i++) {
        int x, y;
        cin >> x >> y;
        x--;
        y--;
        boxes[y].has_red |= boxes[x].has_red;
        boxes[x].count--;
        if (boxes[x].count == 0) {
            boxes[x].has_red = false;
        }
        boxes[y].count++;
    }
    int ans = 0;
    for (int i = 0; i < boxes.size(); i++) {
        ans += boxes[i].has_red;
    }
    cout << ans << endl;
}


Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include<vector>
#include<map>

using namespace std;

int dt[24][60] = {};
int n, m;
bool first = true;

int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		int hour, min;
		cin >> hour >> min;
		dt[hour][min] = 1;
	}
	cin >> m;
	for (int i = 0; i < m; i++) {
		int hour, min;
		cin >> hour >> min;
		dt[hour][min] = 1;
	}
	for (int i = 0; i < 24; i++) {
		for (int j = 0; j <60; j++) {
			if (dt[i][j] == 1) {
				if (!first)
					cout << " ";
				if (j < 10)
					cout << i << ":0" << j;
				else
					cout << i << ":" << j;
				first = false;
			}
		}
	}
	cout << endl;
	//cin >> n;
	return 0;
}

Measured memory_bytes: 3100
<?php
while (true) {
    list($a, $op, $b) = sscanf(trim(fgets(STDIN)), "%d %s %d");
    if ($op == "+") {
        echo $a + $b.PHP_EOL;
    } elseif ($op == "-") {
        echo $a - $b.PHP_EOL;
    } elseif ($op == "*") {
        echo $a * $b.PHP_EOL;
    } elseif ($op == "/") {
        echo floor($a / $b).PHP_EOL;
    } elseif ($op == "?") {
        break;
    }
}


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

//{ START
using namespace std;
#define int int64_t
#define rep(i, a, n) for (int i = (a); i < (n); ++i)
#define reps(i, a, n) for (int i = (a); i > (n); --i)
#define arep(i, x) for (auto &&i : (x))
#define irep(i, x) for (auto i = (x).begin(); i != (x).end(); ++i)
#define rirep(i, x) for (auto i = (x).rbegin(); i != (x).rend(); ++i)
//降順はgreater<T>()
#define all(x) (x).begin(), (x).end()
#define rv(s) reverse((s).begin(), (s).end())
// gcd lcmはそのままok
#define gcd(a, b) __gcd(a, b)
#define bits(n) (1LL << (n))
#define pcnt(x) __builtin_popcountll(x)
//配列内等要素削除
#define unique(x) (x).erase(unique((x).begin(), (x).end()), (x).end())
#define Fixed(n) fixed << setprecision(n)
//総和
#define sowa(n) (((n) * ((n) + 1)) / 2)
#define pb(x, a) (x).push_back(a)
#define fb(x, a) (x).push_front(a)
#define eb(x, a) (x).emplace_back(a)
#define cauto const auto &
using P = pair<int, int>;
using Graph = vector<vector<P>>;
template <class T>  //昇順
using min_heap = priority_queue<T, vector<T>, greater<T>>;
template <class T>  //降順
using max_heap = priority_queue<T>;
template <class A, class B>
using umap = unordered_map<A, B>;
template <class A>
using uset = unordered_set<A>;
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {  //多次元初期化
  std::fill((T *)array, (T *)(array + N), val);
}
template <class A, class B>
bool chmax(A &a, const B &b) {  //最大値更新 返り値はbool
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class A, class B>
bool chmin(A &a, const B &b) {  //最小値更新 返り値はbool
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
constexpr int INF = 0x3f3f3f3f;
constexpr int LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod1 = 1e9 + 7;
constexpr int mod2 = 998244353;
//} END

signed main(void) {
  ios_base::sync_with_stdio(false);

  int n, m;
  cin >> n >> m;
  vector<P> x, y;

  rep(i, 0, n) {
    int a, b;
    cin >> a >> b;
    x.emplace_back(a, b);
  }

  rep(i, 0, m) {
    int a, b;
    cin >> a >> b;
    y.emplace_back(a, b);
  }

  rep(i, 0, n) {
    int cost = INF, ans = 0;
    rep(j, 0, m) {
      if (chmin(cost,
                abs(x[i].first - y[j].first) + abs(x[i].second - y[j].second)))
        ans = j;
    }
    cout << ans + 1 << '\n';
  }

  return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<int> d(n);
  for(int i=0 ; i<n ; i++){
    cin >> d[i];
  }
  sort(d.begin(), d.end());
  cout << d[n/2] - d[n/2-1] << endl;
  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define ll long long
#define sz(x) (int)(x).size()
using namespace std;

int index(int numToFind, std::vector<int> vectorToFindIn) {int len = vectorToFindIn.size();for (int i = 0; i < len; i++){if (vectorToFindIn[i] == numToFind){return i;}}return -1;}

ll gcd(ll a,ll b)
{
	if (b==0) return a;
	return gcd(b,a%b);
}
string to_upper(string a)
{
	for (int i=0;i<(int)a.size();++i) if (a[i]>='a' && a[i]<='z') a[i]-='a'-'A';
	return a;
}
 
string to_lower(string a)
{
	for (int i=0;i<(int)a.size();++i) if (a[i]>='A' && a[i]<='Z') a[i]+='a'-'A';
	return a;
}

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	string s,t;
	cin>>s;
	int ans=0;
	cin>>t;
	for (int i=0;i<3;++i)
	{
		if (s[i]==t[i])
		{
			++ans;
		}
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define de(x) cout << #x << "=" << x << endl
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define lb(x) (x&-(x))
const int N = 101010;

int main(){

	set<int> s1;
	multiset<int> s2;
	multiset<int>::iterator it;
	int n,tmp;
	cin>>n;
	for(int i=0;i<n;i++)
	{
	scanf("%d",&tmp);
	if(s1.find(tmp)!=s1.end())
	s2.insert(tmp);
	else
	s1.insert(tmp);
	}
	
	long long ans=0;
	long long a,b;
	if(s2.size()<2) cout<<"0"<<endl;
	else
	{
		it=s2.end();
		it--;
		a=*it;
		it--;
		if(*it==a)
		it--;
		b=*it;
		ans=a*b;
		cout<<ans<<endl;
	}


    return 0;
}


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

int main() {
	int N;
	cin >> N;
	if (N == 1) {
		cout << "Hello World" << endl;
	}
	if (N == 2) {
		int A, B;
		cin >> A >> B;
		cout << A + B << endl;
	}

	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String[] args) {
        // write your code here
        Scanner sc = new Scanner(System.in);

        int h = sc.nextInt();
        int w = sc.nextInt();
        String[][] list = new String[h][w];

        for (int i = 0; i < h; i++) {
            list[i] = sc.next().split("");
        }

        String ans = "Yes";

        parent : for (int i = 0; i < h ; i++) {
            String[] target = list[i];
            for (int j = 0; j < w; j++) {
                if (target[j].equals("#")) {
                    // 上
                    if (i > 0 && list[i - 1][j].equals("#")) {
                        continue;
                    }
                    // 左
                    if (j > 0 && target[j - 1].equals("#")) {
                        continue;
                    }
                    // 右
                    if (j < w - 1 && target[j + 1].equals("#")) {
                        continue;
                    }
                    // 下
                    if (i < h - 1 && list[i + 1][j].equals("#")) {
                        continue;
                    }
                    ans = "No";
                    break parent;
                }
            }
        }

        System.out.println(ans);
    }
}

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

#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define abs(a) max((a),-(a))
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repe(i,n) rep(i,(n)+1)
#define per(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define pere(i,n) rep(i,(n)+1)
#define all(x) (x).begin(),(x).end()
#define SP <<" "<<
#define RET return 0
#define MOD 1000000007
#define INF 1000000000000000000

typedef long long LL;
typedef long double LD;

int main(){
  int n;
  cin >> n;
  if(n==2){
    cout << 1 SP 2 << endl;
  }
  vector<vector<int>> e(n);
  vector<int> deg(n,0);
  int v,w;
  for(int i=0;i<n-1;i++){
    cin >> v >> w;
    v--,w--;
    e[v].push_back(w);
    e[w].push_back(v);
    deg[v]++;
    deg[w]++;
  }
  vector<int> c(n,0);
  int lg=0,st;
  for(int i=0;i<n;i++){
    if(deg[i]==1){
      c[e[i][0]]++;
    }else{
      int now=0;
      for(int j=0;j<deg[i];j++){
        if(deg[e[i][j]]>1){
          e[i][now]=e[i][j];
          now++;
        }
      }
      if(now>2){
        cout << -1 << endl;
        return 0;
      }else if(now<2){
        st=i;
      }
      e[i].resize(now);
      lg++;
    }
  }
  int now,idx=1;
  lg+=2;
  vector<int> src(n,0),nc(lg,0);
  queue<int> que;
  que.push(st);
  src[st]=1;
  while(!que.empty()){
    now=que.front();
    que.pop();
    nc[idx]=c[now];
    idx++;
    for(auto i:e[now]){
      if(!src[i]){
        que.push(i);
        src[i]=1;
      }
    }
  }
  nc[1]--,nc[lg-2]--;
  vector<int> ans1,ans2;
  now=1;
  for(int i=0;i<lg;i++){
    for(int j=0;j<nc[i];j++){
      ans1.push_back(now+1);
      now++;
    }
    ans1.push_back(now-nc[i]);
    now++;
  }
  now=1;
  for(int i=lg-1;i>=0;i--){
    for(int j=0;j<nc[i];j++){
      ans2.push_back(now+1);
      now++;
    }
    ans2.push_back(now-nc[i]);
    now++;
  }
  for(int i=0;i<n;i++){
    if(ans1[i]<ans2[i]){
      for(int j=0;j<n-1;j++){
        cout << ans1[j] << " ";
      }
      cout << ans1[n-1] << endl;
      return 0;
    }else if(ans1[i]>ans2[i]){
      for(int j=0;j<n-1;j++){
        cout << ans2[j] << " ";
      }
      cout << ans2[n-1] << endl;
      return 0;
    }
  }
  for(int j=0;j<n-1;j++){
    cout << ans1[j] << " ";
  }
  cout << ans1[n-1] << endl;
  return 0;
}


Measured memory_bytes: 8824
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <complex>
#include <string>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#ifndef LOCAL
#define debug(x) ;
#else
#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

template <typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &p) {
  out << "{" << p.first << ", " << p.second << "}";
  return out;
}

template <typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 200010

ll TEST_ANS;

bool compare(ll A, ll B) {
  string Astr = to_string(A);
  string Bstr = to_string(B);

  return (A <= B) == (Astr <= Bstr);
}

int query(ll X) {
  printf("? %lld\n", X);
  fflush(stdout);

#ifndef LOCAL
  char res[10];
  scanf("%s", res);
  return res[0] == 'Y';
#else
  return compare(X, TEST_ANS);
#endif
}

void answer(ll X) {
  printf("! %lld\n", X);
  fflush(stdout);
#ifdef LOCAL
  puts(TEST_ANS == X ? "AC!" : "WA.");
#endif
}

int main() {
  ll MAX_N = 1000000000;

#ifdef LOCAL
  scanf("%lld", &TEST_ANS);
#endif

  bool onezero = query(MAX_N * 10);

  if (onezero) {
    ll ans = 1;
    while(1) {
      bool p = query(ans * 10 - 1);
      if (p) {
        answer(ans);
        return 0;
      }
      ans *= 10;
    }
  } else {
    ll digits = 0, ans = 1;

    while(1) {
      bool p = query(ans * 10);
      if (!p) {
        break;
      }
      digits++;
      ans *= 10;
    }

    ll l = ans, r = ans * 10 -1;

    while(l < r) {
      ll mid = (l + r) /2;

      if (query(mid * 10)) {
        r = mid;
      } else {
        l = mid + 1;
      }
    }

    answer(l);
  }

  return 0;
}


Measured memory_bytes: 596
#include <bits/stdc++.h>
using namespace std;
int n,m,b[5010][210],sta[5010],l[5010],r[5010];
long long a[5010],mat[5010][5010],ans=0;
int main()
{
	scanf("%d%d",&n,&m);
	for (int i=1;i<n;i++) {
		int x;
		a[i]+=a[i-1];
		scanf("%d",&x);
		a[i+1]+=x;
	}
	a[n]+=a[n-1];
	for (int i=1;i<=n;i++)
	  for (int j=1;j<=m;j++)
	    scanf("%d",&b[i][j]);
	for (int i=1;i<=m;i++) {
		int top=0;
		for (int j=1;j<=n;j++) {
			while (top&&b[j][i]>b[sta[top]][i]) r[sta[top--]]=j-1;
			sta[++top]=j;
		}
		while (top) r[sta[top--]]=n;
		top=0;
		for (int j=n;j;j--) {
			while (top&&b[j][i]>=b[sta[top]][i]) l[sta[top--]]=j+1;
			sta[++top]=j;
		}
		while (top) l[sta[top--]]=1;
		for (int j=1;j<=n;j++) {
		    mat[l[j]][j]+=b[j][i];
		    mat[j+1][j]-=b[j][i];
		    mat[l[j]][r[j]+1]-=b[j][i];
		    mat[j+1][r[j]+1]+=b[j][i];
		}
	}
	for (int i=1;i<=n;i++)
	  for (int j=1;j<=n;j++) {
	  	  mat[i][j]+=mat[i][j-1]+mat[i-1][j]-mat[i-1][j-1];
	      if (i<=j) ans=max(ans,mat[i][j]-(a[j]-a[i]));
	  }
	cout<<ans;
	return 0;
}

Measured memory_bytes: 200448
#include <bits/stdc++.h>
using namespace std;
using ll = unsigned long long;

int main() {
  int N, D, X;
  cin >> N >> D >> X;
  --D;
  int result = N + X;
  for (int i = 0; i < N; ++i) {
    int ai;
    cin >> ai;
    result += D / ai;
  }
  cout << result << endl;
}


Measured memory_bytes: 256
#B問題
N,M=map(int,input().split())
ab=[list(map(int,input().split())) for i in range(M)]
ans=[0 for i in range(N)]
for i in range(M):
    A=ab[i][0]-1
    B=ab[i][1]-1
    ans[A]+=1
    ans[B]+=1
for i in range(N):
    print(ans[i])

Measured memory_bytes: 3064
n = int(input())
al = []
if n == 0:
  print("0")
else:
  while n:
    if n % 2 != 0:
      n -= 1
      al.append("1")
    else:
      al.append("0")
    n /= -2
  al.reverse()
  print("".join(al))

Measured memory_bytes: 3060
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<complex>
#include<cmath>
#include<vector>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define all(v) v.begin(),v.end()
using namespace std;
typedef complex<double> Point;

double cross(Point a,Point b){
	return real(a)*imag(b)-imag(a)*real(b);
}

int main(){
	int n;
	while(cin>>n,n){
		Point dt[n],alt;
		vector<Point> p;
		rep(i,n)scanf("%lf,%lf",&dt[i].real(),&dt[i].imag());
		for(int i=n-1;i>0;i--){
			if(dt[i-1].real()>dt[i].real()){
				alt=dt[i];
				dt[i]=dt[i-1];
				dt[i-1]=alt;
			}
		}
		p.pb(dt[0]);
		while(1){
			alt=p[p.size()-1];
			bool yon=true;
			rep(i,n){
				if(dt[i]==alt)continue;
				bool check=true;
				rep(j,n){
					Point a=dt[i]-alt,b=dt[j]-dt[i];
					if(i==j || dt[j]==alt)continue;
					if(cross(dt[i]-alt,dt[j]-dt[i])>0){
						check=false;
						break;
					}
				}
				if(check){
					p.pb(dt[i]);
					yon=false;
					break;
				}
			}
			if(yon)break;
			if(p[p.size()-1]==p[0]){
				p.erase(p.end()-1);
				break;
			}
		}
		cout<<n-p.size()<<endl;
	}
	return 0;
}

Measured memory_bytes: 1272
#include <bits/stdc++.h>
typedef long long LL;
#define SORT(c) sort((c).begin(),(c).end())

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

using namespace std;
int main(void)
{
  for(;;){
    int n;
    cin >> n;
    if(!n) return 0;
    vector<pair<string,int> > train;
    // begin+1 end-1;
    REP(i,n){
      string b,e;
      cin >> b >> e;
      train.push_back(make_pair(b,1));
      train.push_back(make_pair(e,-1));
    }
    SORT(train);
    int tmp=0,answer=0;
    REP(i,train.size()){
      tmp+=train[i].second;
      answer=max(answer,tmp);
    }
    cout << answer << endl;
  }
}

Measured memory_bytes: 2396
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
typedef long long int ll;

#define BIG_NUM 2000000000

using namespace std;

bool isAizuNyan(int table[128]){
	if(table['A'] == 2 && table['I'] == 1 && table['D'] == 1 && table['U'] == 1
			&&table['N'] == 2 && table['Y'] == 1)return true;
	else{
		return false;
	}
}

int main(){

	int length;
	char buf[1001];

	scanf("%s",buf);

	for(length = 0; buf[length] != '\0';length++);

	if(length < 8){
		printf("%s\n",buf);
		return 0;
	}

	int work[128],limit;
	bool changed;
	for(int i = 0; i < 128; i++)work[i] = 0;

	limit = length-8;
	for(int right = 0; right < 8; right++){
		work[buf[right]]++;
	}
	if(isAizuNyan(work)){
		buf[0] = 'A',buf[1] = 'I',buf[2] = 'Z',buf[3] = 'U',buf[4] = 'N',
				buf[5] = 'Y',buf[6] = 'A',buf[7] = 'N';
		changed = true;
 	}else{
 		changed = false;
 	}

	for(int left = (changed == true)?8:1; left <= limit; ){
		if(changed){
			changed = false;
			work['A'] = work['I'] = work['D'] = work['U'] = work['N'] = work['Y'] = 0;
			for(int right = 0; right < 8;right++){
				work[buf[left+right]]++;
			}
			if(isAizuNyan(work)){
				buf[left+0] = 'A',buf[left+1] = 'I',buf[left+2] = 'Z',buf[left+3] = 'U',
						buf[left+4] = 'N',buf[left+5] = 'Y',buf[left+6] = 'A',buf[left+7] = 'N';
				changed = true;
				left += 8;
			}else{
				left++;
			}

		}else{
			work[buf[left-1]]--;
			work[buf[left+7]]++;
			if(isAizuNyan(work)){
				buf[left+0] = 'A',buf[left+1] = 'I',buf[left+2] = 'Z',buf[left+3] = 'U',
						buf[left+4] = 'N',buf[left+5] = 'Y',buf[left+6] = 'A',buf[left+7] = 'N';
				changed = true;
				left += 8;
			}else{
				left++;
			}
		}
	}

	printf("%s\n",buf);

	return 0;
}

Measured memory_bytes: 2688
A=int(input())

answer=0
if A<=104:
  print(0)
  exit()
else:
  for i in range(105,A+1,2):
    count=0
    for j in range(1,i+1):
      if i%j==0:
        count+=1
    if count==8:
      answer+=1
print(answer)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
using ll =long long;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define all(i) i.begin(),i.end()
template<typename T=ll> using v =vector<T>;
template<typename T=ll> using vv = vector<v<T>>;
template<typename T=ll,typename U=ll> using p = pair<T,U>;
const ll INF = (ll)1e9;
template<typename T> T chmin(T &a,T b){a=min(a,b);}
template<typename T> T chmax(T &a,T b){a=max(a,b);}

int main(){
    ll n;
    cin >> n;
    string s,t;
    cin >> s >> t;
    for(ll i=0;i<n;i++){
        bool f=true;
        for(ll j=0;j<n-i;j++){
            if(s[j+i]!=t[j]){
                f=false;
                break;
            }
        }
        if(f){
            cout << i+n <<endl;
            return 0;
        }
    }
    cout << n*2<< endl;
}

Measured memory_bytes: 256
#pragma GCC optimize(2)
#include<bits/stdc++.h>
using namespace std;
#define IOS std::ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define FRE freopen("in.txt", "r", stdin);
#define endl "\n"
#define PI acos(-1.0)
typedef long long LL;
typedef pair<int, int> PII;
const double eps = 1e-8;
const int inf = 0x3f3f3f3f;
const int N = 110, M = 1010;

void solve() {
    string s;
    cin >> s;
    if(s == "ABC") cout << "ARC";
    else cout << "ABC";
}

int main() {
	//FRE;
	int t;
	solve();
	return 0;
}


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

public class Main {
	private static void solve(){
		//Implement solution here.
		double n = nd();
		double k = nd();
		double result = 0D;
		double c = 0D;
		while(Math.pow(2D, c) < k) {
			c++;
		}
		
		for(int i = 1; i <= n; i++) {
			while(c > 0 && (double)i * Math.pow(2D, c - 1) >= k) {
				c--;
			}
			result += Math.pow(0.5D, c) / n;
		}
		System.out.println(result);
	}

	//Switch input source (stdin/file)
	private static BufferedReader br  = new BufferedReader(new InputStreamReader(System.in));
	public static void main(String[] args){
		String debugDataPath = System.getenv("DD_PATH");        
		if(debugDataPath != null){
			try{
				br = new BufferedReader(new InputStreamReader(new FileInputStream(new File(debugDataPath))));
			}catch(Exception e){
				throw new RuntimeException(e);
			}
		}
		solve();
	}

	//Input read utility
	private static StringTokenizer tokenizer = null;
	public static String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(br.readLine());
			} catch (Exception e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}
	//Get next single int
	private static int ni() {
		return Integer.parseInt(next());
	}
	//Get next single long
	private static long nl() {
		return Long.parseLong(next());
	}
	//Get next single double
	private static double nd() {
		return Double.parseDouble(next());
	}
	//Get next int array from one line
	private static int[] na(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}
	//Get next char array from one line
	private static char[] ns() {
		return next().toCharArray();
	}
	//Get next long array from one line
	private static long[] nal(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nl();
		return a;
	}
}

Measured memory_bytes: 21332
//保留所有权利。
#include<iostream>
#include<stdio.h>//printするよ
#include<vector>
#include<algorithm>//辞書順はnext_permutationだよ
#include<set>
#include<string>
#include<sstream>
#include<string.h>
#include<time.h>
#include<random>
#include<cmath>
#include<math.h>
#include<queue>
#include<time.h>
#include<iomanip>
#include<utility>//swapで数値交換するよ
//END OF LIBRARIES.
#define rt "\n"//改行を最速化させるよ
#define rep(i,n) for(int i=0;i<n;i++)
#define rop(i,n) for(int i=1;i<=n;i++)
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define drop(i,n) for(int i=n;0<i;i--)
#define yes(ans) if(ans)cout<<"yes"<<rt;else cout<<"no"<<rt;
#define Yes(ans) if(ans)cout<<"Yes"<<rt;else cout<<"No"<<rt;
#define YES(ans) if(ans)cout<<"YES"<<rt;else cout<<"NO"<<rt;
#define sec(a,b,ans) if(ans)cout<<a<<rt;else cout<<b<<rt;
#define vcin(v) for (int i = 0; i < (v).size(); i++) { cin >> (v)[i]; }
#define sort(s) sort(s.begin(),s.end())
#define reve(s) reverse(s.begin(),s.end())
#define asas int ans=0
#define llcncn llint cnt=0
#define llasas llint ans=0
#define cncn int cnt=0
#define smsm int sum=0
#define str srting
#define v vector
#define please return
#define AC 0//おまじないだよ
#define Rapid cin.tie(0);ios::sync_with_stdio(false)
//END OF DEFINE.
using namespace std;
typedef vector<int> vint;
typedef vector<string> vstr;
typedef vector<char> vcha;
typedef vector<double> vdou;
typedef long long int llint;
typedef pair<int, int> pint;
typedef pair<llint, llint> pllint;
typedef vector<llint> vllint;
typedef vector<pint> vpint;
typedef vector<pair<llint, llint>> vpllint;
typedef vector<vector<int>> vvint;
typedef vector<vector<llint>> vvllint;
typedef vector<vector<string>> vvstr;
typedef vector<vector<pint>> vvpint;
typedef vector<bool> vbool;
//printf("%02d:%02d:%02d\n", h, m, s);・・・2文字は埋める・h、m、ｓ
//END OF TYPEDEF.

//最大公約数（GCD）を求めるよ
//最小公倍数（LCM）は＜＜　A × B ÷ GCD　 ＞＞で求まるよ

long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}
long long LCM(long long a, long long b) {
	return a * b / GCD(a, b);
}

//for A以上B未満でI探索 for (int I = A; i <= B; i++)
//string s = to_string(i);
int a = 0, b = 0, x = 0, y = 0, z = 0, n = 0, sum = 0;
string s = ""; asas; cncn;

int main(void) {
	cin >> n;
	vint t(n);
	rep(i, n) {
		cin >> t[i];
		sum += t[i];
	}
	int m = 0;
	cin >> m;
	vint p(m), x(m);
	rep(i, m) {
		cin >> p[i] >> x[i];
	}
	rep(i, m) {
		if (t[p[i]-1] <= x[i])cout << sum + (x[i] - t[p[i]-1]) << rt;
		else cout << sum - (t[p[i]-1]-x[i]) << rt;
	}
	please AC;
}

Measured memory_bytes: 256
#encoding:utf-8

import math
import itertools

n = int(input())
s = []
for i in range(n):
    s.append(str(input()))

chosen_names = {"m":0,"a":0,"r":0,"c":0,"h":0}

for name in s:
    if name[0] == "M":
        chosen_names["m"] += 1
    elif name[0] == "A":
        chosen_names["a"] += 1
    elif name[0] == "R":
        chosen_names["r"] += 1
    elif name[0] == "C":
        chosen_names["c"] += 1
    elif name[0] == "H":
        chosen_names["h"] += 1

answer = 0
capitals = list("march")
capital_set = itertools.combinations(capitals,3)
for capital in capital_set:
    answer += chosen_names[capital[0]] * chosen_names[capital[1]] * chosen_names[capital[2]]


print(answer)



# def combinations_count(n,r):
#     return math.factorial(n) // (math.factorial(r) * math.factorial(n-r))


Measured memory_bytes: 9908
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();

long long int divide_mons(long long int h)
{
    if (h == 1) return 1;
    else{
        return 2 * divide_mons(h / 2) + 1;
    } 
}
int main()
{
    long long int H;
    cin >> H;
    long long int ans = divide_mons(H);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
// template {{{

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

#define loop(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) loop(i, 0, n)
#define rloop(i, a, b) for (int i = (int)(b) - 1; i >= (int)(a); i--)
#define rrep(i, n) rloop(i, 0, n)
#define eb emplace_back
#define ef emplace_front
#define pb pop_back
#define pf pop_front
#define all(c) std::begin(c), std::end(c)
#define mp std::make_pair
#define mt std::make_tuple
#define fi first
#define se second
#define popcnt __builtin_popcountll

using uint = unsigned;
using ll = long long;
using ull = unsigned long long;
using ld = long double;

template<typename T>
using max_pq = priority_queue<T, vector<T>, less<T>>;

template<typename T>
using min_pq = priority_queue<T, vector<T>, greater<T>>;

const int MOD = 1e9 + 7;
const int INF = 1e9 + 10;
const ll LLINF = 1e18 + 10;

const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
const int dx8[] = {-1, -1, 0, 1, 1, 1, 0, -1};
const int dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};

template<typename T>
inline T sq(T x){ return x * x; }

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

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

template<typename T>
inline void sort(T &c){ std::sort(std::begin(c), std::end(c)); }

template<typename T>
inline void reverse(T &c){ std::reverse(std::begin(c), std::end(c)); }

template<typename T>
inline void unique(T &c){ std::sort(std::begin(c), std::end(c)); c.erase(std::unique(all(c)), std::end(c)); }

// }}}

using pr = pair<int, int>;

int n;
map<pr, int> g;

int main()
{
	cin >> n;
	vector<pr> ps;
	rep(i, n){
		int x, y, w;
		cin >> x >> y >> w;
		g[pr(x, y)] = w;
		rep(j, 2) rep(k, 2){
			ps.eb(x - j, y - k);
		}
	}

	int res = 0;
	for (pr p : ps){
		int s = 0;
		rep(i, 2) rep(j, 2){
			if (g.count(pr(p.fi + i, p.se + j))){
				s += g[pr(p.fi + i, p.se + j)];
			}
		}
		chmax(res, s);
	}

	cout << res << " / " << 1 << endl;
}

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

int data[51][26] = {};
const int INF = 1 << 29;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n;
    cin >> n;

    for(int i = 0; i < n; ++i){
        string s;
        cin >> s;
        for(size_t j = 0; j < s.size(); ++j){
            ++data[i][int(s[j] - 'a')];
        }
    }
    string ans = "";
    for(int i = 0; i < 26; ++i){
        int m = INF;
        for(int j = 0; j < n; ++j){
            m = min(m, data[j][i]);
        }
        ans += string(m, char('a' + i));
        /*cout << char('a' + i) << endl;
        cout << m << endl;*/
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i, a, b) for(int i=(a); i<(b); i++)
#define per(i, a, b) for(int i=(b)-1; i>=(a); i--)
#define sz(a) (int)a.size()
#define de(a) cout << #a << " = " << a << endl
#define dd(a) cout << #a << " = " << a << " "
#define all(a) a.begin(), a.end()
#define pw(x) (1ll<<(x))
#define endl "\n"
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef double db;

void file_put() {
    freopen("filename.in", "r", stdin);
    freopen("filename.out", "w", stdout);
}

const int N=1e5+5;
int n; pii a[N]; ll ans=0;

int main() {
//    file_put();
    
    scanf("%d",&n);
    rep(i,1,n+1) scanf("%d",&a[i].fi),a[i].se=i&1;
    sort(a+1,a+n+1);
    rep(i,1,n+1) ans+=((i&1)^a[i].se);
    printf("%lld\n",ans>>1); 
    
	return 0;
}



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

#define fastio ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define lli long long int
#define rep(i,n,z) for(int i=z;i<n;i++)
#define rrep(i,z) for(int i=z;i>=0;i--)
#define nl cout<<endl
#define vi vector<int>
#define vlli vector<long long int>
#define umap unordered_map
#define pb push_back
#define mp make_pair
#define ss second
#define ff first
#define ipair pair <int,int>
#define llipair pair <lli,lli>
#define pq priority_queue
#define displaymatrix(a,m,n) for(int i=0;i<m;i++){for(int j=0;j<n;j++)cout<<a[i][j]<<" ";cout<<endl;}
#define printarray(a,n) for(int i=0;i<n;i++){cout<<a[i]<<" ";}nl;
#define vinput(a,n) vlli a(n);rep(i,n,0)cin>>a[i]
#define ainput(a,n) rep(i,n,0)cin>>a[i]
#define SO(a) sort(a.begin(),a.end())
#define all(x) (x).begin(),(x).end()
#define SOP(a,comp) sort(a.begin(),a.end(),comp)
#define inf INT_MAX
#define endl '\n'

int main()
{
    fastio;
    int r;
    cin>>r;
    cout<<setprecision(20)<<2*M_PI*r<<endl;
}

Measured memory_bytes: 3800
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const int MOD = 1000000007;
const char nl = '\n';
const int MX = 100001; //check the limits, dummy
 
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);    
	
    ll A, B; cin >> A >> B;
    char C; cin >> C;
    int D; cin >> D;
    B *= 100; B += D;
    ll X = A*B; X /= 100;
    cout << X << nl;
	
	return 0;
}




Measured memory_bytes: 3652
def main():
    from heapq import heappush, heappop

    INF = 1 << 60
    MX_AG = 2500

    N, M, S = map(int, input().split())
    S = min(S, MX_AG)  # それ以上のAgは不要

    g = tuple(set() for _ in range(N))
    for _ in range(M):
        u, v, a, b = map(int, input().split())
        u -= 1
        v -= 1
        g[u].add((v, a, b))
        g[v].add((u, a, b))

    exchange = []
    for _ in range(N):
        c, d = map(int, input().split())
        exchange.append((c, d))

    h = [(0, S, 0)]

    time = [[INF] * (MX_AG + 1) for _ in range(N)]
    time[0][S] = 0
    # time[location][r_Ag]:=minimum_time_to_reach

    while h:
        t, ag, loc = heappop(h)
        for to, fare, dt in g[loc]:
            n_Ag = ag - fare
            if n_Ag < 0: continue
            cf = time[to][n_Ag]
            n_time = t + dt
            if cf <= n_time: continue
            time[to][n_Ag] = n_time
            heappush(h, (n_time, n_Ag, to))

        e_time = t + exchange[loc][1]
        e_Ag = ag + exchange[loc][0]
        if e_Ag > MX_AG: continue
        cf = time[loc][e_Ag]
        if cf <= e_time: continue
        time[loc][e_Ag] = e_time
        heappush(h, (e_time, e_Ag, loc))

    ans = (min(time[to]) for to in range(1, N))

    print('\n'.join(map(str, ans)))


if __name__ == '__main__':
    main()


Measured memory_bytes: 24200
#include <stdio.h>
int main(void)
{
	int s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,sum;
	scanf("%d %d %d %d %d %d %d %d %d %d",&s1,&s2,&s3,&s4,&s5,&s6,&s7,&s8,&s9,&s10);
	sum=s1+s2+s3+s4+s5+s6+s7+s8+s9+s10;
	printf("%d\n",sum);
	return 0;
}

Measured memory_bytes: 596
#include <algorithm>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <list>
#define INF 10000000000ll
#define MOD 1000000007ll
#define EPS 1e-10
#define REP(i,m) for(long long i=0; i<m; i++)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define DUMP(a) for(long long dump=0; dump<(ll)a.size(); dump++) { cout<<a[dump]; if(dump!=(ll)a.size()-1) cout<<" "; else cout<<endl; }
#define ALL(v) v.begin(),v.end()
#define pb push_back
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef long double ld;
using namespace std;

int main(){
	int n;
	cin >> n;
	ll a[n];
	ll sum = 0;
	REP(i, n){
		cin >> a[i];
		sum += a[i];
	}
	ll min = 1000000000000000;
	ll tmp = 0;
	REP(i, n-1){
		tmp += a[i];
		if(min > abs(2 * tmp - sum)) min = abs(2 * tmp - sum);
	}
	cout << min << endl;
	return 0;
}


Measured memory_bytes: 1792
import itertools
import collections
N = int(input())
A = [int(_) for _ in input().split()]
c = sorted(collections.Counter(A).values())
acc = list(itertools.accumulate([0] + c))
n = len(acc) - 1
j = 0
for i in range(1, n + 1):
    r = 0
    while i - j > 0:
        if (i - j) * c[-1 - j] <= acc[-1 - j]:
            r = acc[-1 - j] // (i - j)
            break
        else:
            j += 1
    print(r)
for _ in range(N - n):
    print(0)


Measured memory_bytes: 38000
#%%
import sys
def input():
    return sys.stdin.readline().rstrip()

from collections import defaultdict

def main():
    N = int(input())
    d = defaultdict(int)
    As = list(map(int, input().split()))
    for i in range(N):
        d[As[i]] += 1
    
    ans = 0
    for k in d.keys():
        j = d[k]
        if j > 1:
            ans += j*(j-1)//2

    for i in range(N):
        j = d[As[i]]
        print(ans+1-j)

# %%
if __name__ == '__main__':
    main()

# %%
# from atcoder_test import doTest
# doTest("abc159","d",main)

Measured memory_bytes: 26772
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int mod=998244353;
#define mp make_pair
#define pb push_back
int main(){ 
	long long int t,n,m,b,c=0,d;
	cin>>n>>m;
	for(int i=0;i<m;i++){
		cin>>b;
		c+=b;
		}
		if(n-c<0){
			cout<<-1<<endl;}
			else{
		cout<<n-c<<endl;
	}
    return 0;
}


Measured memory_bytes: 3628
from sys import stdin
from collections import deque

def read_graph(n, k):
    A = [ [] for _ in range(n) ]
    for _ in range(k):
        line = stdin.readline().strip().split()
        A[int(line[0])].append(int(line[1]))
        A[int(line[1])].append(int(line[0]))
    return A

def art_points(n, A):
    S = deque([])
    color = ["WHITE"] * n
    time = 0
    prenum = [0] * n
    parent = [0] * n
    lowest = [0] * n
    ap = []

    def dfs(u):
        nonlocal S
        nonlocal color
        nonlocal time
        nonlocal prenum
        nonlocal parent
        nonlocal lowest
        S.appendleft(u)
        color[u] = "GRAY"
        prenum[u] = lowest[u] = time
        parent[u] = -1
        time += 1

        while S:
            try:
                w = S[1]
            except IndexError:
                w = -1
            u = S[0]
            colors = [color[v] for v in A[u]]
            if "WHITE" in colors:
                for v in A[u]:
                    if color[v] == "WHITE":
                        parent[v] = u
                        color[v] = "GRAY"
                        prenum[v] = lowest[v] = time
                        time += 1
                        S.appendleft(v)
                        break
            else:
                for v in A[u]:
                    if color[v] == "GRAY" and v != w:
                        # Backedge(u, v) の prenum[v] と比較
                        lowest[u] = min(lowest[u], prenum[v])
                if parent[u] != -1:
                    # 全ての子ノードのlowestと比較
                    lowest[parent[u]] = min(lowest[u], lowest[parent[u]])
                S.popleft()
                color[u] = "BLACK"
                time += 1

    def obtain_ap():
        np = 0
        for i in range(n):
            p = parent[i]
            if p == 0:
                np += 1
            elif prenum[p] <= lowest[i]:
                if p not in ap:
                    ap.append(p)
        if np > 1:
            ap.append(0)

    dfs(0)
    obtain_ap()

    return ap

n, k = [int(i) for i in input().split()]
A = read_graph(n, k)
ap = art_points(n, A)
for i in sorted(ap):
    if i != -1:
        print(i)



Measured memory_bytes: 11476