akhauriyash/Code-Regression huggingface dataset:
#ifdef LOCAL
#include <cstdio>
#include <vector>
#include <algorithm>
#include <iostream>
#include <cstring>
#else
#include <bits/stdc++.h>
#endif
using namespace std ;

typedef long long ll ;
#define rep(i , n ) for ( int i =0; i < n ; i++)
#define _sort(arg) sort(begin(arg), end(arg))
#define MOD 1000000007
#define pb push_back
#define DEBUG(x) cout << #x << ": " << x << endl;

class UnionFind {
private:
	unsigned size_; 
	std::vector<unsigned> par, rank;
public:
	UnionFind() : size_(0), par(std::vector<unsigned>()), rank(std::vector<unsigned>()) {};
	UnionFind(unsigned size__) : size_(size__) {
		par.resize(size_); rank.resize(size_);
		for (unsigned i = 0; i < size_; i++) par[i] = i, rank[i] = 0;
	}
	unsigned size() { return size_; }
	//unsigned root(unsigned x) { return par[x] == x ? x : par[x] = root(par[x]); }
	unsigned root(unsigned x)
	{
		while(par[x] != x)
		{
			par[x] = par[par[x]];
			x = par[x];
		}
		return x;
	}
	bool same(unsigned x, unsigned y) { return root(x) == root(y); }
	void unite(unsigned x, unsigned y) {
		x = root(x), y = root(y);
		if (x == y) return;
		if (rank[x] < rank[y]) par[x] = y;
		else if (rank[x] == rank[y]) par[y] = x, rank[x]++;
		else par[y] = x;
	}
	bool operator==(const UnionFind &u) { return par == u.par; }
	bool operator!=(const UnionFind &u) { return par != u.par; }
};

/*
__attribute__((constructor))
void initial()
{
	cin.tie(NULL);
	ios::sync_with_stdio(false);
}
*/

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

	int N;
	
	cin >> N;

	string s[N];
	int ab=0,a=0,b=0,abb=0;

	rep(i, N)
	{
		cin >> s[i];
		rep(j, s[i].size())
		{
			if(j > 0 && (s[i][j-1] == 'A') &&(s[i][j] == 'B'))
			{
				ab++;
			}
			

		}
		/*
		if (s[i][0] == 'B')
		{
			b++;
			if (s[i][s[i].size() -1 ]== 'A')
			{
				abb++;
			}
		}
		if (s[i][s[i].size()-1] == 'A')
		{
			a++;
		}
		*/
		if (s[i][0] == 'B' && (s[i][s[i].size()-1] == 'A'))
		{
			abb++;
		}
		else if (s[i][0] == 'B')
		{
			b++;
		}
		else if (s[i][s[i].size()-1] == 'A')
		{
			a++;
		}
	}

	int cnn = 0;
	/*
	if (a > b)
	{
		//int tmp = a-b-abb+1;
		int tmp = (abb > 0) ? -1 : 0;
		int mm = (a-b>0) ? 1 : 0; 
		cnn = tmp + b + mm;
	}
	else
	{
		//int tmp = b-a-abb+1;
		int tmp = (abb > 0) ? -1 : 0;
		int mm = (b-a>0) ? 1 : 0;
		cnn = tmp + a + mm;
	}

	cout << ab + cnn << endl;
	*/
	int m = min(a,b);
	if (abb == 0)
	{
		cout << ab + m << endl;
	}
	else
	{
		if (a+b == 0)
		{
			cout << ab + abb - 1 << endl;
		}
		else
		{
			cout << ab + m + abb << endl;
		}
		
	}
	

	
	return 0;
}


Measured memory_bytes: 768
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		int N = sc.nextInt();
		String S = sc.next();

		sc.close();

		int ans = 0;
		int idx = 0;

		while ((idx = S.indexOf("ABC", idx)) != -1) {
			ans++;
			idx++;
		}

		out.println(ans);
	}

	public static void main(String[] args) {
		new Main()._main(args);
	}
}


Measured memory_bytes: 23892
/* 
			BURN OUT
		*/	  

#include <bits/stdc++.h>
using namespace std;
	     
#define ll long long int
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
	     
#define mp make_pair
#define pb push_back
#define ld long double
#define F first
#define S second
const ll N =(1e6);  
const ll mod = (1e9+7);
	
int main(){
	fast;	
	double n , h;
	cin >> n >> h ;
	cout<<ceil(n / h);
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val number = readLine()!!

    val StrToNum = hashMapOf("hon" to "24579", "pon" to "0168", "bon" to "3")

    fun matchDigit(num: Char, strMap: HashMap<String, String>): String = strMap.filter { it.value.contains(num) }.keys.first()

    val matchedKey = matchDigit(number.last(), StrToNum)
    println(matchedKey)
}


Measured memory_bytes: 36312
#include <bits/stdc++.h> 
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define all(vec) vec.begin(), vec.end()
#define tmax(x,y,z) max((x),max((y),(z)))
#define tmin(x,y,z) min((x),min((y),(z)))
typedef long long ll;ll MM = 1000000000;ll mod = MM + 7; ll MMM=9223372036854775807;//2^63 -1
ll GCD(ll x, ll y) {if (y == 0) return x;else return GCD(y, x % y);}
ll LCM(ll x, ll y) { return x / GCD(x, y) * y;}
//cout << fixed << setprecision(10);

int main(){
 ll  n,ans=0;  cin>>n ;
  string s; cin>>s;
  ll i=0;
  while(i<n-2){
  if(s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C')
  ans++;
    i++;
  }
cout<<ans<<endl;
}

Measured memory_bytes: 256
// https://beta.atcoder.jp/contests/abc115

#define SUBMIT

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

int main() {
#ifdef SUBMIT
    auto& in = cin;
#else
    stringstream in(R"(3
100000
30000
20000
)");
#endif
    int n;
    in >> n;
    vector<int> a(n);
    for (int i = 0; i < n; ++i) {
        in >> a[i];
    }

    int i = 0;
    while (true) {
        auto all_even = true;

        for (int j = 0; j < n; ++j) {
            if (a[j] % 2 == 1) {
                all_even = false;
                a[j]--;
            }
        }

        if (all_even) {
            if (i % 2 == 0) cout << "second" << endl;
            else cout << "first" << endl;
            break;
        }

        i++;
    }

    return 0;
}

Measured memory_bytes: 640
from collections import Counter,defaultdict,deque
import sys
import bisect
import math
import itertools
import string
import queue
import copy
from itertools import permutations, combinations
from heapq import heappop, heappush
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
 
def inp(): # n=1
    return int(input())
def inpm(): # x=1,y=2
    return map(int,input().split())
def inpl(): # a=[1,2,3,4,5,...,n]
    return list(map(int, input().split()))
def inpls(): # a=['1','2','3',...,'n']
    return list(input().split())
def inplm(n): # x=[] 複数行
    return list(int(input()) for _ in range(n))
def inpll(n): # [[1,1,1,1],[2,2,2,2],[3,3,3,3]]
    return [list(map(int, input().split())) for _ in range(n)]

def main():
    n,k,s = inpm()
    ans = []
    for i in range(n):
        if i < k:
            ans.append(str(s))
        else:
            if s == 10**9:
                ans.append(str(s-1))
            else:
                ans.append(str(s+1))
    print(' '.join(ans))

if __name__ == "__main__":
    main()

Measured memory_bytes: 57576
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define REP(i,x,n) for(int i = (x); i < (n); ++i)
#define ll long long
#define P pair<ll,ll>
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()

const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1);

int main(void)
{
    ll n, cnt=0;
    cin >> n;
    vector<ll> a(n), b(n);
    rep(i,n) cin >> a[i] >> b[i];
    reverse(all(a));
    reverse(all(b));
    rep(i,n){
        if(a[i]%b[i]) cnt += b[i] - a[i]%b[i];
        if(i != n-1) a[i+1] += cnt;
    }
    cout << cnt << endl;
    return 0;
}


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

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<=(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define Eunique(v) v.erase(unique(all(v)),v.end())
#define Eback(s) s.erase(s.end()-1,s.end())
#define rev(v) reverse(all(v))
#define minvec(v) *min_element(all(v))
#define maxvec(v) *max_element(all(v))
#define sumvec(v) accumulate(all(v),0)
#define mapmax(v) v.rbegin()->first
#define mapmin(v) v.begin()->first
#define pb push_back
#define pf push_front
#define mod 1000000007
#define m_p make_pair
#define DOUBLE fixed << setprecision(15)
#define OK puts("OK")
#define OK1 puts("OK1")
#define OK2 puts("OK2")
#define SIZE(s) (int)s.size()
#define INF ((1LL<<62)-(1LL<<31))
#define zero(x,n) setw(x) << setfill('0') << n

typedef long long ll;

typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<double> vd;
typedef vector<char> vc;
typedef vector<string> vs;

typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<pair<int,int>> vpii;
typedef vector<pair<ll,ll>> vpll;

const double pi = acos(-1.0);

template<class A, class B>
ostream& operator<<(ostream& ost, const pair<A, B>&p) {
	ost << "{" << p.first << ", " << p.second << "} ";
	return ost;
}

template<class T>
ostream& operator<<(ostream& ost, const vector<T>&v) {
	ost << "{";
	for (int i = 0; i<(int)v.size(); i++) {
		if (i)ost << " ";
		ost << v[i];
	}
	ost << "} \n";
	return ost;
}

template<class A, class B>
ostream& operator<<(ostream& ost, const map<A, B>&v) {
	ost << "{";
	for (auto p:v) {
		ost << "{" << p.first << ", " << p.second << "} ";
	}
	ost << "} ";
	return ost;
}

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 gcd(ll x, ll y) {return __gcd(x,y);}
ll lcm(ll x, ll y) {return x/__gcd(x,y)*y;}

bool match(string s,string t){
	bool b=true;
	rep(i,SIZE(s)){
		if(s[i]!=t[i] && s[i]!='?') b=false;
	}
	return b;
}

int main()
{
	string s,t;
	vs ans;
	cin >> s >> t;
	if(SIZE(s)<SIZE(t)) cout << "UNRESTORABLE\n";
	else{
		for(ll i=SIZE(s)-SIZE(t);i>=0;i--){
			string tmp="";
			rep(j,SIZE(t)) tmp+=s[i+j];
			if(match(tmp,t)){
				string x=s;
				rep(j,SIZE(t)) x[i+j]=t[j];
				rep(j,SIZE(s)){
					if(x[j]=='?') x[j]='a';
				}
				ans.pb(x);
			}
		}
		if(SIZE(ans)){
			sort(all(ans));
			cout << ans[0] << endl;
		}
		else cout << "UNRESTORABLE\n";
	}
	return 0;
}

Measured memory_bytes: 256
#![allow(unused)]

use std::io::{Read, StdinLock};
use std::iter::{FromIterator, Iterator};
use std::str::{FromStr};
use std::string::String;

macro_rules! debug {
    ($($a:expr),*) => {
        println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

pub fn read_bytes<T: FromIterator<char>>(s: &mut StdinLock) -> T {
    s.bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect::<T>()
}

pub fn reads(s: &mut StdinLock) -> String {
    read_bytes::<String>(s)
}

pub fn read<T: FromStr>(s: &mut StdinLock) -> T {
    reads(s).parse().ok().unwrap()
}

//==============================================================================
//
// Problem specific code
//
//==============================================================================

fn main() {
    let sin = std::io::stdin();
    let mut sin = sin.lock();

    let x: usize = read(&mut sin);
    let y: usize = read(&mut sin);
    let a: usize = read(&mut sin);
    let b: usize = read(&mut sin);
    let c: usize = read(&mut sin);
    let mut ps: Vec<i64> = (0..a).map(|_| read(&mut sin)).collect();
    let mut qs: Vec<i64> = (0..b).map(|_| read(&mut sin)).collect();
    let mut rs: Vec<i64> = (0..c).map(|_| read(&mut sin)).collect();

    ps.sort_by(|s, t| t.cmp(s));
    qs.sort_by(|s, t| t.cmp(s));
    rs.sort();

    let mut bests = ps.into_iter().take(x)
        .chain(qs.into_iter().take(y))
        .collect::<Vec<i64>>();
    bests.sort();

    let mut tot: i64 = bests.iter().sum();
    for d in bests {
        if rs.len() == 0 || d >= *rs.last().unwrap() {
            break;
        }
        tot = tot - d + rs.pop().unwrap();
    }

    println!("{}", tot);
}

Measured memory_bytes: 10492
#include <functional>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <sstream>
#include <numeric>
#include <string>
#include <vector>
#include <cstdio>
#include <bitset>
#include <cmath>
#include <ctime>
#include <queue>
#include <stack>
#include <map>
#include <set>

using namespace std;

#define forit(it, s) for(__typeof(s.begin()) it = s.begin(); it != s.end(); it++)
#define np(v) next_permutation(v.begin(), v.end())
#define pll pair < long long, long long>
#define all(a) a.begin(), a.end()
#define ull unsigned long long
#define pii pair < int, int >
#define sz(a) (int)a.size()
#define sqr(x) ((x) * (x))
#define y1 stupid_cmath
#define vi vector <int>
#define pb push_back
#define mp make_pair
#define ll long long
#define f first
#define s second

const int inf = (int)3e6;
const int mod = inf + 7;
const double eps = 1e-9;
const double pi = acos(-1.0);

int a, b, c, d;

int main(){
    ios_base::sync_with_stdio(0), cin.tie(0);
    cin >> a >> b >> c >> d;
    if(a + b == c + d){
        cout << "Balanced" << endl;
        return 0;
    }
    if(a + b < c + d){
        cout << "Right" << endl;
        return 0;
    }
    cout << "Left" << endl;
}


Measured memory_bytes: 256
from collections import defaultdict
n = int(input())
v = list(map(int,input().split()))
odd,eve = defaultdict(int),defaultdict(int)
for i in range(n):
    if i%2==0:
        eve[v[i]] += 1
    else:
        odd[v[i]] += 1
se = sorted(eve.items(),key=lambda x:x[1],reverse=True)
so = sorted(odd.items(),key=lambda x:x[1],reverse=True)
ans = 0
if se[0][0]==so[0][0]:
    if se[0][1]==so[0][1]:
        if len(se)==1 and len(so)==1:
            ans += n//2
        else:
            if se[1][1]<so[1][1]:
                ans = n-se[0][1]-so[1][1]
            else:
                ans = n-se[1][1]-so[0][1]
    elif se[0][1]<so[0][1]:
        ans = n-so[0][1]-se[1][1]
    else:
        ans = n-so[1][1]-se[0][1]
else:
    ans = n-se[0][1]-so[0][1]
print(ans)


Measured memory_bytes: 65772
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <tuple>
#include <vector>

using namespace std;
typedef long long int ll;

#define INF (1e9)

int N, K;

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

    vector<int> A(N);
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }

    sort(A.begin(), A.end());
    int ans = INF;
    for (int i = 0; i < N - K + 1; i++) {
        ans = min(ans, A[i + K - 1] - A[i]);
    }

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


Measured memory_bytes: 640
/*
メモ化再帰
*/


# include <iostream>
# include <algorithm>

using namespace std;

int N, K;
long long dp[100010], height[100010];
const long long INF = 1LL << 60;

long long rec (int i) {
  // メモしてあるなら、そのまま値をそのまま返す
  if (dp[i] < INF) return dp[i];
  if (i == 0) return 0;
  
  long long res = INF;
  
  int repeat = 0;
  if (i < K) repeat = i;
  else repeat = K;
  
  for (int j = 1; j <= repeat; j++) res = min(res, rec(i - j) + abs(height[i] - height[i - j]));
  
  return dp[i] = res;
}

int main() {
  cin >> N >> K;
  for (int i = 0; i < N; i++) cin >> height[i];
  for (int i = 0; i < N; i++) dp[i] = INF;
  
  cout << rec(N - 1) << endl;
  
  return 0;
}

Measured memory_bytes: 8064
n = int(input())
lrl = []

for _ in range(n):
    x,l = map(int,input().split())
    lrl.append((x-l, x+l))


lrl = sorted(lrl, key=lambda x:x[1])
ans = 0
now = -float("inf")

for l,r in lrl:
    if now <= l:
        ans += 1
        now = r

print(ans)

Measured memory_bytes: 57816
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  int A, B;
  cin>>A>>B;
  if(A>=13) cout<<B<<endl;
  else if(A>=6) cout<<B/2<<endl;
  else cout<<0<<endl;
}



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

int dir[200001];

int main()
{
	long long N,K;cin>>N>>K;
	vector<int>A(N);
	for(int i=0;i<N;i++)cin>>A[i];

	for (int i = 0; i < 200001; i++)dir[i] = -1;
	vector<int>D(N);
	for (int i = 0; i <2*N; i++)
	{
		D[i%N] = dir[A[i%N]];
		dir[A[i % N]] = i%N;
	}
	for (int i = 0; i < 200001; i++)dir[i] = -1;
	vector<int>revD(N);
	for (int i = 2*N-1; i >= 0; i--)
	{
		revD[i % N] = dir[A[i % N]];
		dir[A[i % N]] = i % N;
	}


	int T=0;

	vector<int>B(N);
	int pos = N-1;
	int t=0;
	while (1)
	{
		B[pos] = t;

		if(D[pos] >= pos)t++;

		pos = D[pos];

		if (pos == 0)break;

		pos = pos-1;
		if (pos < 0)
		{
			pos+=N;
			t++;
		}
	}

	T = t+1;
	for(int i=0;i<N;i++)B[i] = (T-B[i])%T;

	//cerr<<T<<endl;

	K%=T;

	//cerr<<K<<endl;

	/*for (int i = 0; i < N; i++)
	{
		cerr<<B[i]<<" ";
	}
	cerr<<endl;*/

	
	int s = 0;
	for(int i=N-1;i>=0;i--)
	{
		if (B[i] == K)
		{
			s = i+1;
			break;
		}
	}
	
	vector<int>ans;
	for (int i = s; i < N; i++)
	{
		if (revD[i] > i)
		{
			i = revD[i];
			continue;
		}

		ans.push_back(A[i]);
	}

	for (int i = 0; i < ans.size(); i++)
	{
		if(i)cout<<" ";
		cout<<ans[i];
	}
	cout<<endl;

	return 0;
}

Measured memory_bytes: 6388
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin >> n;
  for(int i=1;i<=9;i++)
  {
    if(n%i==0 && (n/i)<=9)
    {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
N, K, Q = list(map(int, input().split()))

A = [K-Q] * (N+1)

for i in range(Q):
    Ai = int(input())
    A[Ai] += 1

for i in range(1, N+1):
    if A[i] > 0:
        print('Yes')
    else:
        print('No')



Measured memory_bytes: 6580
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
#include <assert.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> P;
typedef vector<P> vpl;
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int MAX = 510000;
ll dy[8] = {0,1,0,-1,1,-1,1,-1};
ll dx[8] = {1,0,-1,0,1,-1,-1,1};
const double pi = acos(-1);
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << endl;}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){
	cout << a << " " << b << " " << c << endl;
}
const int mod = 1e9 + 7;

int main(){
	ll h,w,n; cin >> h >> w >> n;
	ll mx = max(h,w);
	cout << (mx+n-1)/mx << endl;
}

Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <utility>

using namespace std;

typedef pair<double, double> point;

double th = M_PI * 60.0 / 180.0;

void koch(int n, point p1, point p2) {
    if (n == 0) return;
    double s_x = (p1.first * 2 + p2.first) / 3;
    double s_y = (p1.second * 2 + p2.second) / 3;
    double t_x = (p1.first + p2.first * 2) / 3;
    double t_y = (p1.second + p2.second * 2) / 3;
    double u_x = (t_x - s_x) * cos(th) - (t_y - s_y) * sin(th) + s_x;
    double u_y = (t_x - s_x) * sin(th) + (t_y - s_y) * cos(th) + s_y;
    
    point s = make_pair(s_x, s_y);
    point t = make_pair(t_x, t_y);
    point u = make_pair(u_x, u_y);

    koch(n - 1, p1, s);
    printf("%.8f %.8f\n", s.first, s.second);
    koch(n - 1, s, u);
    printf("%.8f %.8f\n", u.first, u.second);
    koch(n - 1, u, t);
    printf("%.8f %.8f\n", t.first, t.second);
    koch(n - 1, t, p2);
}

int main() {
    int n;
    scanf("%d", &n);
    printf("%.8f %.8f\n", 0.0, 0.0);
    koch(n, make_pair(0.0,0.0), make_pair(100.0, 0.0));
    printf("%.8f %.8f\n", 100.0, 0.0);
}



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

signed main(){
  int N;
  cin>>N;
  int M=N,P=1;
  int S=sqrt(N);
  for(int i=2;i<S+1;i++){
    if(N%i==0)P=i;
  }
  M=N/P;
  cout<<P+M-2<<endl;
}

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

long long n, dp[2005], mod=1e9+7;

int main(){
	cin>>n;
	
	dp[3]=1;
	dp[4]=1;
	dp[5]=1;
	for(int i=6; i<=n; i++){
		dp[i]=1;
		for(int j=3; j<=i-3; j++){
			dp[i]=(dp[i]+dp[j])%mod;
		}
	}
	cout<<(dp[n]+mod)%mod<<endl;
}


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

public class Main {
    public static void main(String[] args) {
        FastScanner scanner = new FastScanner();
        PrintWriter out = new PrintWriter(System.out, false);
        int r = scanner.nextInt();
        out.println((r * r));
        out.flush();
    }
    
    public static class FastScanner {
        BufferedReader br;
        StringTokenizer st;
        
        public FastScanner(Reader in) {
            br = new BufferedReader(in);
        }
        
        public FastScanner() {
            this(new InputStreamReader(System.in));
        }
        
        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
        
        int nextInt() {
            return Integer.parseInt(next());
        }
        
        long nextLong() {
            return Long.parseLong(next());
        }
        
        double nextDouble() {
            return Double.parseDouble(next());
        }
        
        String readNextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}


Measured memory_bytes: 21204
#include <bits/stdc++.h>
using namespace std;
#define  rep(i, n) for(int i = 0; i < n; i++) 
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  INF 1LL << 60
typedef long long int LL;
typedef long long int ll;
#define pll pair<ll, ll>
#define F first
#define S second
const int MOD = 1000000007;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }
//sort(all(x))とするとソートできるよ
// 10^x は pow(10,(x)) 
// 任意のlogは　対数の底の変換を使う    log(N) / log(任意の底)

int main(){
    string S;cin >> S;
    LL K;cin >> K;
    LL ct = 1;
    LL ans = 0;
    LL lim = S.size();

if(S[0] == S[lim - 1]){
    LL tcl = 1;
        rep(i,lim){
            if(S[0] == S[tcl]){
                tcl++;
            }
            else break;
        }
      //  cout << tcl << endl;
    LL tcr = 1;
        rep(i,lim){
            if(S[lim-1] == S[lim-1-tcr]){
                tcr++;
            }
            else break;
        }
    if(lim == 1){
        LL an = K/2;
        cout << an  << endl;
    }
    else if(tcl == 1 && tcr == 1){
        ans += K-1;
        char tmp = S[0];
        LL ctem = 0;
    rep(i,lim){
        if(i == 0)continue;
        if(S[i] == S[i-1]){
            ct++;
            if(i == lim){
                ctem += ct/2;
            }
        }
        else{
            ctem += ct/2;
            ct = 1;
        }
    }
    ctem *= K;
    ans += ctem;

   cout << ans << endl;
    }
    else if(tcl == lim){
        cout << (lim*K)/2 << endl;
    }
    else{
        ans += tcl/2 + tcr/2 + (K-1)*((tcl+tcr)/2);
  //    cout << ans << endl;
        char tmp = S[tcl];
        LL ctem = 0;
    for(int i = tcl;i<lim-tcr;i++){
        if(i == 0)continue;
        if(S[i] == S[i-1]){
            ct++;
            if(i == lim-tcr-1){
                ctem += ct/2;
            }
        }
        else{
            ctem += ct/2;
            ct = 1;
        }
    }
    ctem *= K;
    ans += ctem;

    cout << ans << endl;
    }

//cout << tcl << " " << tcr << endl;
}
else{

    char tmp = S[0];
    LL ctem = 0;
    rep(i,lim){
        if(i == 0)continue;
        if(S[i] == S[i-1]){
            ct++;
            if(i == lim-1){
                ctem += ct/2;
            }
        }
        else{
            ctem += ct/2;
            ct = 1;
        }
    }
    ctem *= K;
    ans += ctem;
    cout << ans << endl;
}

}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> P;
typedef priority_queue<P,vector<P>,greater<P>> P_queue;

#define REP(i,a,b) for(int i=(int)a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define mp make_pair
#define ALL(a) a.begin(),a.end()
#define SORT(a) sort(ALL(a))
#define U_ERASE(V) V.erase(unique(ALL(V)), V.end());

const ll MOD=998244353;
const ll mod=1000000007;
const ll INF=1e15;
vec dx={1,0,-1,0};
vec dy={0,1,0,-1};

int main(){
    ll N; cin>>N;
    vec d(N);
    rep(i,N) cin>>d.at(i);
    ll ans=1;
    ll memory=d[0], keikou=0;
    if(N>1) REP(i,1,N){
        if((d[i]-memory)*keikou>=0) {
            if(d[i]-memory>0) keikou=1;
            if(d[i]-memory<0) keikou=-1;
            memory=d[i];
        }
        else{
            ans++;
            memory=d[i];
            keikou=0;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 1024
x,k,d = map(int, input().split())
x = abs(x)
ans = abs(x+k*d)

ok = 0
ng = k+1
while abs(ok-ng)>1:
    m = (ok+ng)//2
    if x-m*d+(k-m)*d>=0:
        ok = m
    else:
        ng = m
ans = min(ans, abs(x-ok*d+(k-ok)*d))
if ok<k:
    ok += 1
    ans = min(ans, abs(x-ok*d+(k-ok)*d))
print(ans)

Measured memory_bytes: 61824
import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
   
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


n,m,*A=map(int,read().split())

A=sorted(A,reverse=True)

sum=sum(A)

if A[m-1]*4*m >= sum:
	print("Yes")
else:
	print("No")
	

Measured memory_bytes: 2940
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)

template<class T, class E>
struct SegTree{
  typedef function<T(T,T)> F;
  typedef function<T(T,E)> G;
  typedef function<E(E,E)> H;
  typedef function<E(E,int)> P;
  int n;
  F f;
  G g;
  H h;
  P p;
  T d1;
  E d0;
  vector<T> dat;
  vector<E> lazy;
  SegTree(int n_, F f, G g, H h, T d1, E d0, P p=[](E a, int b){ return a; })
    : f(f), g(g), h(h), d1(d1), d0(d0), p(p) {
    n = 1;
    while (n < n_) n *= 2;
    dat.resize(2 * n - 1, d1);
    lazy.resize(2 * n - 1, d0);
  }
  void eval(int k, int l, int r) {
    if (lazy[k] == d0) return;
    dat[k] = g(dat[k], p(lazy[k], r - l));
    if (k < n - 1) {
      lazy[2 * k + 1] = h(lazy[2 * k + 1], lazy[k]);
      lazy[2 * k + 2] = h(lazy[2 * k + 2], lazy[k]);
    }
    lazy[k] = d0;
  }
  void update(int a, int b, E x, int k = 0, int l = 0, int r = -1) {
    if (r == -1) r = n;
    eval(k, l, r);
    if (b <= l || r <= a) return;
    if (a <= l && r <= b) {
      lazy[k] = h(lazy[k], x);
      eval(k, l, r);
    }
    else {
      update(a, b, x, 2 * k + 1, l, (l + r) / 2);
      update(a, b, x, 2 * k + 2, (l + r) / 2, r);
      dat[k] = f(dat[2 * k + 1], dat[2 * k + 2]);
    }
  }
  // return op[a..b)
  // k: node id, [l, r): node interval
  E query(int a, int b, int k = 0, int l = 0, int r = -1) {
    if (r == -1) r = n;
    eval(k, l, r);
    if (r <= a || b <= l) return d1;
    if (a <= l && r <= b) return dat[k];
    E vl = query(a, b, 2 * k + 1, l, (l + r) / 2);
    E vr = query(a, b, 2 * k + 2, (l + r) / 2, r);
    return f(vl, vr);
  }
};

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

  int n, q;
  cin >> n >> q;
  SegTree<int, int> seg(
    n,
    [](int a, int b){ return a + b; },
    [](int a, int b){ return a + b; },
    [](int a, int b){ return a + b; },
    0,
    0);

  rep(i, q) {
    int t, x, y;
    cin >> t >> x >> y;
    x--;
    if (t == 0) {
      seg.update(x, x + 1, y);
    }
    else {
      cout << seg.query(x, y) << endl;
    }
  }

  return 0;
}



Measured memory_bytes: 4956
import numpy as np


def solve(a_list):
    negative_flag = False
    for a in a_list:
        if a < 0:
            negative_flag = not negative_flag

    # time O(N log(N))
    sorted_list = sorted(np.abs(a_list), key=abs)
    if negative_flag:
        sorted_list[0] = -sorted_list[0]
    return sum(sorted_list)


def main():
    n = int(input())
    a_list = list(map(int, input().split()))

    ans = solve(a_list)
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 25868
// Sky's the limit :)
#include <bits/stdc++.h>
using namespace std;
#define int long long

const int INF = 1e10 + 5;

int calc(string s) {
    int open = 0, close = 0;
    for(auto  c : s) {
        if(c == '(')
            open++;
        else
            close++;
    }

    if(open == s.size())
        return INF;
    if(close == s.size())
        return -INF;
    return open - close;
}

bool comp(const pair<string, int> &a, const pair<string, int> &b) {
    return a.second > b.second;
}

signed main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    
    int T = 1; 
    // cin >> T; 
    while (T--) {
        int n;
        cin >> n;
        vector<pair<string, int>> v(n);
        for(int i = 0; i < n; i++) {
            cin >> v[i].first;
            v[i].second = calc(v[i].first);
        }

        sort(v.begin(), v.end(), comp);

        // for(auto p : v) {
        //     cout << p.first << ' ' << p.second << '\n';
        // }

        string s;
        for(auto p : v)
            s += p.first;

        stack<int> st;
        for(int i = 0; i < s.size(); i++) {
            if(st.empty())
                st.push(s[i]);
            else {
                if(st.top() == '(' && s[i] == ')')
                    st.pop();
                else
                    st.push(s[i]);
            }
        }

        if(st.empty())
            cout << "Yes\n";
        else
            cout << "No\n";
        
    }
    
    return 0;
}



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

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

    ll n,k,a,b;

    while(cin>>n>>k){
        // cin>>n>>k;
        ll v[100010];
        int l=-1;
        for(int i=1;i<=100005;i++) v[i]=0;
        
        for(int i=0;i<n;i++){
            cin>>a>>b;
            v[a] += b;
            if(l<=a)l=a;
        }

        ll count = 0;
        int ans;
        for(int i=1;i<=l;i++){
            count += v[i];
            if(count >= k){
                ans = i;
                break;
            }
        }
        cout<<ans<<endl;
    }

    return 0;
 
}

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (sc.hasNext()) {
			int a = sc.nextInt();
			String op = sc.next();
			int b = sc.nextInt();
			if (op.equals("+")) {
				System.out.println(a + b);
			} else if (op.equals("-")) {
				System.out.println(a - b);
			} else if (op.equals("*")) {
				System.out.println(a * b);
			} else if (op.equals("/")) {
				System.out.println(a / b);
			} else if (op.equals("?")) {
				sc.close();
				break;
			}
		}
	}
}

Measured memory_bytes: 18128
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


namespace 競プロCS {
    class ABC162A {
        static void Main() {
            string s = Console.ReadLine();
            foreach (var item in s) {
                if (item == '7') {
                    Console.WriteLine("Yes");
                    return;
                }
            }
            Console.WriteLine("No");

        }

    }
}


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

const int N = 1e6+7, M = 1000000007;
int cnt[N];

int main() {
    cnt[0] = 3;

    long long ways = 1;
    int n;
    cin>>n;


    for (int i=1; i<=n; i++) {
        int x;
        cin>>x;

        x++;
        int rem = cnt[x-1] - cnt[x];
        if (rem <= 0) {
            ways = 0;
            break;
        }
        cnt[x]++;
        ways = (ways*rem)%M;
    }
    cout<<ways<<endl;
}


Measured memory_bytes: 640
n = int(input())-1
a = list(map(int, input().split()))
b = list(map(int, input().split()))
count = 0
next = a[n+1]
for i in range(n,-1,-1):
    if b[i]>=(a[i] + next):
        count += a[i]+next
        next = 0
    else:
        if b[i]>= next:
            next = a[i]+next-b[i]
            count += b[i]
        else:
            next = a[i]
            count += b[i]
print(count)

Measured memory_bytes: 18624
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
      	int[] A = new int[N];
      	int[] B = new int[N];
        int[] C = new int[N - 1];
        for (int i = 0; i < N; i++) {
          A[i] = sc.nextInt();
        }
        for (int i = 0; i < N; i++) {
          B[i] = sc.nextInt();
        }
        for (int i = 0; i < N - 1; i++) {
          C[i] = sc.nextInt();
        }
        int s = 0;
        int bx = -2;
      	for (int i = 0; i < N; i++) {
          int x = A[i] - 1;
          s += B[x];
          if (bx == x - 1) {
            s += C[bx];
          }
          bx = x;
        }
     	System.out.println(s);
    }
}
      

Measured memory_bytes: 21844
a = [int(i) for i in input().split()]
A = a[0]
B = a[1]
K = a[2]

t = 0
while t < K:
    if A % 2 == 1:
        A -= 1
    A /= 2
    B += A
    t += 1

    if t < K:
        if B % 2 == 1:
            B -= 1
        B /= 2
        A += B
        t += 1

A = int(A)
B = int(B)

print(A,B)

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

const int maxn=13;
const int maxm=550005; 
int n,m;
char s[maxm];
int pw3[maxn],ans[maxm];

namespace Trie{
	const int maxv=maxm*2;
	int rt,tot;
	int nxt[maxv][3],leaf[maxv];
	bool rev[maxv];
	void build(){
		rt=++tot;
		for(int i=0;i<pw3[n];i++){
			int cur=rt;
			for(int j=0;j<n;j++){
				int c=i/pw3[j]%3;
				if(!nxt[cur][c])nxt[cur][c]=++tot;
				cur=nxt[cur][c];
			}
			leaf[cur]=i;
		}
	}
	void apply(int cur){
		swap(nxt[cur][1],nxt[cur][2]);
		rev[cur]^=1;
	}
	void pushdown(int cur){
		if(rev[cur]){
			apply(nxt[cur][0]);
			apply(nxt[cur][1]);
			apply(nxt[cur][2]);
			rev[cur]=0;
		}
	}
	void S(){
		apply(rt);
	} 
	void R(){
		int cur=rt;
		for(int j=0;j<n;j++){
			pushdown(cur);
			int tmp=nxt[cur][2];
			nxt[cur][2]=nxt[cur][1];
			nxt[cur][1]=nxt[cur][0];
			nxt[cur][0]=tmp;
			cur=nxt[cur][0];
		}
	}
	void getans(){
		for(int i=0;i<pw3[n];i++){
			int cur=rt;
			for(int j=0;j<n;j++){
				pushdown(cur);
				cur=nxt[cur][i/pw3[j]%3];
			}
			ans[leaf[cur]]=i;
		}
	}
}

int main(){
	scanf("%d%s",&n,s);
	m=strlen(s);
	pw3[0]=1;
	for(int i=1;i<=n;i++)pw3[i]=3*pw3[i-1];
	Trie::build();
	for(int i=0;i<m;i++){
		if(s[i]=='S')Trie::S();
		else Trie::R();
	}
	Trie::getans();
	for(int i=0;i<pw3[n];i++)printf("%d%c",ans[i],i==pw3[n]-1?'\n':' ');
	return 0;
}

Measured memory_bytes: 19520
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <functional>
#include <limits.h>
#include <set>
#include <map>
#include <tuple>
using namespace std;

#define ll long long
#define ull unsigned long long
#define rep(i,N) for (ll i=0;i<N;i++)
#define loop(i,N,M) for(ll i=N;i<M;i++)
#define MAX(v) *max_element(v.begin(),v.end())
#define MIN(v) *min_element(v.begin(),v.end())
#define SORTL2S(type,v) sort(v.begin(),v.end(),greater<type>())
#define SORTS2L(type,v) sort(v.begin(),v.end())
#define SORTMF(v,func) sort(v.begin(),v.end(),func)

template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T &val) {
	std::fill((T*)array, (T*)(array + N), val);
}

ll N;
vector<pair<ll, ll>> vec;

void solve() {
	cin >> N;
	vec.resize(N);
	rep(i, N) cin >> vec[i].first >> vec[i].second;
	/*sort(vec.begin(), vec.end(), [](const pair<ll, ll>& x, const pair<ll, ll>& y) {
		return x.first + x.second < y.first + y.second;
	});*/

	if (N == 1) {
		cout << 1;
		return;
	}

	ll ans = 10000;

	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			if (i == j) continue;
			ll P = vec[j].first - vec[i].first;
			ll Q = vec[j].second - vec[i].second;

			ll sum = 0;

			for (int k = 0; k < N; k++) {

				bool flag = false;
				for (int m = 0; m < N; m++) {
					if (vec[m] == make_pair(vec[k].first - P, vec[k].second - Q)) {
						flag = true;
						break;
					}
				}
				if (flag == false) sum++;

			}

			ans = min(ans, sum);

		}
	}

	cout << ans;

}

int main() {
	solve();
	cout << endl;
	return 0;
}


Measured memory_bytes: 256
using System;

namespace abc086_b
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] x = Console.ReadLine().Split();
            int n = int.Parse(x[0] + x[1]);
            int a = (int)Math.Sqrt(n);
            Console.WriteLine(Math.Pow(a,2) == n ? "Yes" : "No");
        }
    }
}

Measured memory_bytes: 13140
#include<bits/stdc++.h>
#define ll long long
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define dump(a) (cerr << #a << "=" << (a) << endl)
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

using namespace std;

void yesno(bool b) {
    if (b) {
        cout << "Yes" << endl;
    }     else {
        cout << "No" << endl;
    }

}

int main() {
    int K;
    cin >> K;
    vector<ll> a;
    rep(i, 9) { a.push_back(i+1); }
    while(true) {
        if ( a.size() >= K ) {
            cout << a[K-1] << endl;
            break;
        }
        K -= a.size();
        vector<ll> t;
        swap(t, a);
        for (ll i: t) {
            for(ll j = -1; j <= 1; j++) {
                ll tmp = i % 10;
                if (tmp + j >= 0 && tmp + j <= 9) {
                    a.push_back(i*10 + tmp + j);
                }
            }
        }
    }

}

Measured memory_bytes: 1712
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;

int main(){
    ll H, N;
    ll A;
    ll sum = 0;

    cin >> H >> N;

    for(ll i = 0; i < N; i++){
        cin >> A;
        sum += A;
        if(sum >= H){
            cout << "Yes" << endl;
            return 0;
        }
    }

    cout << "No" << endl;

    return 0;
}


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

int main() {
    int n;
    cin >> n;
    int c[n - 1], s[n - 1], f[n - 1];
    for (int i = 0; i < n - 1; i++) {
        cin >> c[i] >> s[i] >> f[i];
    }

    for (int i = 0; i < n; i++) {
        if (i == n - 1) {
            cout << 0 << endl;
            break;
        }
        int sec = 0;
        for (int j = i; j < n - 1; j++) {
            if (sec <= s[j]) sec = s[j];
            else {
                sec = (sec + f[j] - 1) / f[j] * f[j];
            }
            sec += c[j];
        }
        cout << sec << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cmath>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <vector>

// Acknowledgement: Special thanks to kyomukyomupurin, who developed this
// template.
template <class T, class U>
std::ostream& operator<<(std::ostream& os, const std::pair<T, U>& p) {
  return os << '(' << p.first << ", " << p.second << ')';
}

template <class T>
std::ostream& operator<<(std::ostream& os, const std::vector<T>& vec) {
  int n = 0;
  for (auto e : vec) os << (n++ ? ", " : "{") << e;
  return os << (n ? "}" : "{}");
}

template <class T>
std::ostream& operator<<(std::ostream& os, const std::set<T>& st) {
  int n = 0;
  for (auto e : st) os << (n++ ? ", " : "{") << e;
  return os << (n ? "}" : "{}");
}

template <class T, class U>
std::ostream& operator<<(std::ostream& os, const std::map<T, U>& mp) {
  int n = 0;
  for (auto e : mp) os << (n++ ? ", " : "{") << e;
  return os << (n ? "}" : "{}");
}

template <class T>
std::istream& operator>>(std::istream& is, std::vector<T>& vec) {
  for (T& e : vec) is >> e;
  return is;
}

#ifdef LOCAL
#define debug(...) \
  std::cerr << "[" << #__VA_ARGS__ << "]: ", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

void debug_out() { std::cerr << '\n'; }

template <class Head, class... Tail>
void debug_out(Head&& head, Tail&&... tail) {
  std::cerr << head;
  if (sizeof...(Tail) != 0) std::cerr << ", ";
  debug_out(std::forward<Tail>(tail)...);
}
using namespace std;
using int64 = long long;

constexpr int64 inf = 1e18;

int main() {
  int64 A;
  string B;
  cin >> A >> B;
  string int_B_str = "";
  for (int i = 0; i < B.size(); i++) {
    if (B[i] != '.') {
      int_B_str.push_back(B[i]);
    }
  }
  int int_B = stoi(int_B_str);
  int64 result = A * int_B;
  int64 ans = result / 100;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3624
# include <iostream>
using namespace std;
int main(){
    int x=0;
    cin >> x;
    // hour:3600 second
    int hour = 0;
    hour = x/3600;
    x-=hour*3600;
    // minute: 60 second
    int minute = 0;
    minute = x/60;
    x-=minute*60;
    cout << hour << ':' << minute << ':' << x << '\n';
}


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

using ll = long long int;
const ll maxs = 1e5+5;

ll n;
ll arr[maxs],dp[maxs];

int main()
{
    cin >> n;

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

    dp[n-2] = abs(arr[n-2] - arr[n-1]);

    for(ll i=n-3;i>=0;i--) 
        dp[i] = min(dp[i+1] + abs(arr[i+1] - arr[i]) , dp[i+2] + abs(arr[i+2] - arr[i]));
    
    cout << dp[0];
    
    return 0;
}

Measured memory_bytes: 1792
n = int(input())
cnt = 0
lista = [0] * (n + 1)
# 奇数のみ
for i in range(1, n + 1, 2):
    # 3 * 1, 3 * 3, 3 * 5...
    for j in range(i, n + 1, 2 * i):
        lista[j] += 1
for i in range(n + 1):
    if lista[i] == 8:
        cnt += 1
print(cnt)


Measured memory_bytes: 38384
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    int n,al=0,b=0;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    sort(a,a+n,greater<int>());
    for(int j=0;j<n;j++)
    {
        if(j%2)
        al+=a[j];
        else
        b+=a[j];
    }
    cout<<abs(al-b)<<"\n";
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
typedef string::const_iterator State;
class ParseError {};
 
int term(State &begin);
int expression(State &begin);
int factor(State &begin);
int number(State &begin);
void consume(State &begin, char expected);
 
// 四則演算の式をパースして、その評価結果を返す。
// <四則演算の式> ::= <乗算除算の式> (+ or -) <乗算除算の式> (+ or -) ...
// <expr>   ::= <term> [ ('+'|'-') <term> ]*
int expression(State &begin){
    int ret = term(begin);
    for(;;){
        if(*begin == '+'){
            begin++;
            ret += term(begin);
        }else if(*begin == '-'){
            begin++;
            ret -= term(begin);
        }else{
            break;
        }
    }
    return ret;
}
 
// 乗算除算の式をパースして、その評価結果を返す。
// <乗算除算の式> ::= <括弧か数> (* or /) <括弧か数> (* or /) ...
// <term>   ::= <factor> [ ('*'|'/') <factor> ]*
int term(State &begin){
    int ret = factor(begin);
    for(;;){
        if(*begin == '*'){
            begin++;
            ret *= factor(begin);
        }else if(*begin == '/'){
            begin++;
            ret /= factor(begin);
        }else{
            break;
        }
    }
    return ret;
}

// 括弧か数をパースして、その評価結果を返す。 
// <括弧か数> ::= '(' <四則演算の式> ')' or <数>
// <factor> ::= <number> | '(' <expr> ')'
int factor(State &begin){
    if(*begin == '('){
        begin++;
        int ret = expression(begin);
        begin++;
        return ret;
    }else{
        return number(begin);
    }
}
 
// 数字の列をパースして、その数を返す。
// <数> ::= ...
// <number> :== 1つ以上の数字
int number(State &begin){
    int ret = 0;
    while(isdigit(*begin)){
        ret *= 10;
        ret += *begin - '0';
        begin++;
    }
    return ret;
}
 
int main(){
    int N;
    cin >> N;
    cin.ignore();
    for(int i = 0; i < N; i++){
        string s;
        getline(cin, s);
        State begin = s.begin();
        int ans = expression(begin);
        cout << ans << endl;
    }
}


Measured memory_bytes: 2968
package main

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

func main() {
	var n int
	fmt.Scan(&n)

	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	var s int64
	m := make(map[int64]int64)
	m[0] = 1
	for i := 0; i < n; i++ {
		sc.Scan()
		a, _ := strconv.ParseInt(sc.Text(), 10, 64)
		s += a
		m[s]++
	}
	var ans int64
	for _, v := range m {
		ans += v * (v - 1) / 2
	}
	fmt.Println(ans)
}


Measured memory_bytes: 12672
import java.io.*;

public class Main{
	public static void main(String[] argv) throws NumberFormatException, IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line;
		int lineNum = Integer.parseInt(br.readLine());
		for(int i=0; i<lineNum; i++){
			line = br.readLine();
			String[] sCoord = line.split(" ");
			float[] fCoord = new float[6];
			for(int j=0; j<6; j++){
				fCoord[j] = Float.parseFloat(sCoord[j]);
			}
			/*
			 * 違う
			 * float cenX = (fCoord[0] + fCoord[2] + fCoord[4])/3.0f;
			 * float cenY = (fCoord[1] + fCoord[3] + fCoord[5])/3.0f;
			 */
			
			float div = (fCoord[0]-fCoord[2])*(fCoord[3]-fCoord[5])-(fCoord[2]-fCoord[4])*(fCoord[1]-fCoord[3]);
			float m = fCoord[0]*fCoord[0] - fCoord[2]*fCoord[2] + fCoord[1]*fCoord[1] - fCoord[3]*fCoord[3];
			float n = fCoord[2]*fCoord[2] - fCoord[4]*fCoord[4] + fCoord[3]*fCoord[3] - fCoord[5]*fCoord[5];
			float a = fCoord[3]-fCoord[5];
			float b = fCoord[3]-fCoord[1];
			float c = fCoord[4]-fCoord[2];
			float d = fCoord[0]-fCoord[2];
			float cenX = (a*m + b*n)/div/2;
			float cenY = (c*m + d*n)/div/2;
			if(cenX == 0.0)cenX=0.0f;
			if(cenY == 0.0)cenY=0.0f;
			float dis = (float)Math.sqrt(Math.pow((double)cenX-fCoord[0], 2.0) + Math.pow((double)cenY-fCoord[1], 2.0));
			System.out.printf("%.3f %.3f %.3f\n", cenX, cenY, dis);
		}
	}
}

Measured memory_bytes: 16972
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define jizz ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define pb push_back
#define F first
#define S second
#define MEM(i,j) memset(i,j,sizeof i)
#define ALL(v) v.begin(),v.end()
#define MP make_pair
#define ET cout << "\n"
#define DB(a,s,e) {for(int i=s;i<e;i++) cout << a[i] << " ";ET;}
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

int cnt[3];

int main()
{jizz
	int n,a,b,x;
	cin >> n >> a >> b;
	for(int i=0;i<n;++i)
	{
		cin >> x;
		if(x<=a) ++cnt[0];
		else if(x<=b) ++cnt[1];
		else ++cnt[2];
	}
	cout << min({cnt[0],cnt[1],cnt[2]}) << "\n";
	
}

Measured memory_bytes: 256