akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define __ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long int
#define N 200005

using namespace std;

int main()
{
    __

    int n;
    string s;
    map < string,int> mp;

    cin >> n;

    for(int i=0;i<n;i++)
    {
        cin >> s;

        if(mp.find(s)==mp.end()) mp[s]=1;
        else{
            int val = mp[s];
            mp[s] = val+1;
        }
    }

    int max_val = 0;
    map < string,int> :: iterator it;

    for(it = mp.begin();it!=mp.end();it++)
    {
         if(max_val < (it->second)) max_val = it->second;
        //cout << it->first << ' ' << it->second << endl;
    }

    vector < string > vs;

    for(it = mp.begin();it!=mp.end();it++)
    {
         if(max_val == (it->second)) vs.emplace_back(it->first);
    }

    sort(vs.begin(),vs.end());

    for(int i=0;i<vs.size();i++)
    {
        cout << vs[i] << '\n';
    }

    return 0;
}


Measured memory_bytes: 25584
#include <stdio.h>

int main(void){
    char a[200001], b[200001];
    int s=0, i=0;
 
    scanf("%s",a);
    scanf("%s",b);
 
    while(a[i]!='\0'){
        if(a[i] != b[i]){
            a[i] = b[i];
            s++;
        }
        i++;
    }
    printf("%d",s);
  
    return 0;
}

Measured memory_bytes: 2044
<?php
fscanf(STDIN, "%d %d", $n,$d);
for($i=0; $i<$n; $i++){
    $arr[] = explode(" ", trim(fgets(STDIN)));
}
$arr_2 = [];
$result = [];
$count = 0;
$sum =0;

for($i=0; $i<$n; $i++){
    for($s=$i+1; $s<$n; $s++){
        for($j = 0; $j<$d; $j++){
            $arr_2[] = (abs(($arr[$i][$j]) - ($arr[$s][$j])))**2;
        }
    }
}

for($l=0; $l<(count($arr_2)/$d); $l++){
    $k = $l*$d;
    $sum = 0;
    for($i=0; $i<$d; $i++){
        $sum = $sum + $arr_2[$k+$i];
        $result[$l] = sqrt($sum);
    }
}

for($i=0; $i<count($result); $i++){
    if(preg_match('/^[0-9]+$/', $result[$i])){
        $count++;
    }
}

echo $count;
?>

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

int main(){

    int a, b;
    cin >> a >> b;
    if (a + b == 15) {
        cout << "+" << endl;
    } else if (a*b == 15) {
        cout << "*" << endl;
    } else {
        cout <<"x" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define sum accumulate
#define keta fixed<<setprecision
typedef long long ll;
const int INF = 100000000;
const long INF64 = 1000000000000000ll;
const ll MOD = 998244353LL;
int main(){
	std::vector<std::vector<bool> > aa(4,std::vector<bool> (13,1));
	int n;
	std::cin >> n;
	rep(i,n){
		char d;
		int a,b;
		std::cin >> d>>b;
		if(d=='S')a=0;
		if(d=='H')a=1;
		if(d=='C')a=2;
		if(d=='D')a=3;
		aa[a][b-1]=0;
	}
	rep(i,4){
		rep(j,13){
			if(aa[i][j]){
				if(i==0)std::cout << "S " <<j+1<< std::endl;
				if(i==1)std::cout << "H " <<j+1<< std::endl;
				if(i==2)std::cout << "C " <<j+1<< std::endl;
				if(i==3)std::cout << "D " <<j+1<< std::endl;
			}
		}
	}
}


Measured memory_bytes: 3096
let f a =
  Array.fold_left ( lor ) 0 @@ Array.init 48 @@ function
    | 0 -> (a + 1) lsr 1 land 1
    | i -> (max 0 (a land ((1 lsl (i + 1)) - 1) - (1 lsl i) + 1) land 1) lsl i

let () = Scanf.scanf "%d %d" @@ fun a b ->
  Printf.printf "%d\n" @@ f a lxor f b lxor a



Measured memory_bytes: 384
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
typedef long long ll;
const ll mod=1e9+7;
ll pow(ll x,ll y){
  if(y==0) return 1;
  ll res=pow(x,y/2);
  res*=res;
  res%=mod;
  if(y%2==1) res*=x;
  return res%mod;
}
ll ans[100005]={0};
int main(){
  ll n,k;
  cin>>n>>k;
  ll res=0;
  for(ll m=k;m>=1;m--){
    ll a1=pow(k/m,n);
    for(ll i=2*m;i<=k;i+=m){
      a1-=ans[i];
      a1+=mod;
      a1%=mod;
    }
    ans[m]=a1;
    res+=a1*m;
    res%=mod;
  }
  cout<<res<<endl;
}


Measured memory_bytes: 4404
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Vector;

public class Main {

	public static void main(String[] args) throws IOException {
		// TODO 自動生成されたメソッド・スタブ
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));


		int q = Integer.parseInt(br.readLine());

//		LinkedList<Integer> list = new LinkedList<Integer>();
		Vector<Integer> list = new Vector<Integer>();
		for(int i = 0; i < q; i++){
			String[] tmpArray = br.readLine().split(" ");

			if(tmpArray[0].equals("0")){
				list.add(Integer.parseInt(tmpArray[1]));
			}
			else if(tmpArray[0].equals("1")){
				System.out.println(list.get(Integer.parseInt(tmpArray[1])));
			}
			else {
//				list.removeLast();
				list.remove(list.size() - 1);
			}
		}
    }
}



Measured memory_bytes: 80380
#include <cstdio>
#include <cctype>
#include <utility>
#include <string>
#include <vector>
using namespace std;

#define gcu getchar_unlocked
#define ii inline int in
ii(int c) {
	int n = 0;
	bool minus = false; if (c == '-') minus = true, c = gcu();
	do {n = 10 * n + (c - '0'), c = gcu();} while (c >= '0');
	//return n; }
	return minus ? -n : n; }
ii() {return in(gcu());}
inline bool scan(int &n) {int c=gcu();return c==EOF?false:(n=in(c),true);}
void scan(string &s) {for (char c; !isspace(c = gcu()); s += c);}
#undef ii
#define pcu putchar_unlocked
template <typename T>
void out(T n) {
	static char buf[20];
	char *p = buf;
	if(n < 0) pcu('-'), n *= -1;
	if (!n) *p++ = '0';
	else while (n) *p++ = n % 10 + '0', n /= 10;
	while (p != buf) pcu(*--p); }
void out(const char *s){while(*s)pcu(*s++);}
void out(char c){pcu(c);}
void out(string &s){for (char c: s) pcu(c);}
template <typename head, typename... tail>
void out(head&& h, tail&&... t){out(h);out(move(t)...);}
//template <typename T>
//void out(vector<T> &v){for(T &x:v)out(' '),out(x);out('\n');}
//void out(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);out('\n');}
#undef svo

typedef vector<string> maze;
int walk(int x, int y, maze &m) {
	static const int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
	if (x < 0 || x >= (int) m[0].size() ||
		y < 0 || y >= (int) m.size() ||
		m[y][x] == '#' || m[y][x] == 'X')
		return 0;
	m[y][x] = 'X';
	int c = 1;
	for (int i = 0; i < 4; i++)
		c += walk(x + dx[i], y + dy[i], m);
	return c;
}

int main() {
	int W, H;
	while(scan(W) && scan(H) && (W || H)) {
		maze m(H);
		int i = 0, x = 0, y = 0;
		for (auto &s: m) {
			for (int c; !isspace(c = gcu()); s += c)
				if (c == '@')
					y = i, x = s.size();
			i++;
		}
		out(walk(x, y, m), '\n');
	}
}


Measured memory_bytes: 2628
N, K = map(int, input().split())
MOD = 10**9 + 7

# n,k 小さい（1<=k<=n<=2000くらい）
MAX = 2005
com = [[0] * MAX for _ in range(MAX)]
com[0][0] = 1
for i in range(1, MAX):
    com[i][0] = 1
    for j in range(1, i+1):
        com[i][j] = (com[i-1][j-1] + com[i-1][j]) % MOD

for i in range(1, K+1):
    if i <= (N-K+1):
        ans = (com[N-K+1][i] * com[K-1][i-1]) % MOD
        print(ans)
    else:
        print(0)


Measured memory_bytes: 98676
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <list>


using namespace std;

#define FOR(x) for(int i = 0; i < x; i++)

stack<short> x, y;
short a[10], n, j, i;

bool solve(short c, bool judge){
	if(c == 10) return true;
	if(x.top() < a[c]){
		x.push(a[c]);
		if(solve(c + 1, true)) return true;
	}
	if(y.top() < a[c]){
		y.push(a[c]);
		if(solve(c + 1, false)) return true;
	}
	if(judge) x.pop();
	else y.pop();
	return false;
}

int main(){
	scanf("%d", &n);
	for(i = 0; i < n; i++){
		x.push(0);
		y.push(0);
		for(j = 0; j < 10; j++)
			scanf("%d", &a[j]);
		if(solve(0, true)) printf("YES\n");
		else printf("NO\n");
	}
	return 0;
}

Measured memory_bytes: 1016
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){return o<<"("<<p.fs<<","<<p.sc<<")";}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){o<<"sz = "<<vc.size()<<endl<<"[";for(const T& v:vc) o<<v<<",";o<<"]";return o;}
bool can(vector<bool>& d, int K){
	int N = d.size();
	rep(i,N){
		if(d[i] && i<K && N-1-i<K) return 0;
	}
	return 1;
}
int main(){
	string s;
	cin>>s;
	int N = s.size();
	s = '0' + s + '0';
	vector<bool> d(N+1);
	rep(i,N+1) d[i] = s[i]!=s[i+1];
	int ub = N+1, lb = 1;
	while(ub-lb>1){
		int m = (ub+lb)/2;
		if(can(d,m)) lb = m;
		else ub = m;
	}
	cout<<lb<<endl;
}


Measured memory_bytes: 512
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {

    static int N;
    static int[] A;

    public static void main(String[] args) {
        FastScanner fc = new FastScanner(System.in);
        N = fc.nextInt();
        A = fc.nextIntArray(N);
        System.out.println(solve() ? "Possible" : "Impossible");
    }

    static boolean solve() {
        Arrays.sort(A);
        int diameter = A[N-1];
        int center = A[0];
        int[] cnt = new int[diameter+1];
        for (int i = 0; i < N; i++) {
            cnt[A[i]]++;
        }

        if( diameter % 2 == 1 ) {
            // 5 - 4 - 3 - 3 - 4 - 5
            if( diameter/2 + 1 != center ) return false;
            if( cnt[center] != 2 ) return false;
            return validPath(cnt, center+1, diameter);

        } else {
            // 4 - 3 - 2 - 3 - 4
            if( diameter/2 != center ) return false;
            if( cnt[center] != 1 ) return false;
            return validPath(cnt, center+1, diameter);
        }
    }

    // [from, to]
    private static boolean validPath(int[] cnt, int from, int to) {
        for (int i = from; i <= to; i++) {
            if( cnt[i] < 2 ) return false;
        }
        return true;
    }

    @SuppressWarnings("unused")
    static class FastScanner {
        private BufferedReader reader;
        private StringTokenizer tokenizer;

        FastScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
            tokenizer = null;
        }

        String next() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        String nextLine() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    return reader.readLine();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken("\n");
        }

        long nextLong() {
            return Long.parseLong(next());
        }

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

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

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


Measured memory_bytes: 23252
#include <bits/stdc++.h>
using namespace std;
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;}
using Int = long long;
const char newl = '\n';


using i16 = int16_t;
using i32 = int32_t;
using i64 = int64_t;

using u16 = uint16_t;
using u32 = uint32_t;
using u64 = uint64_t;

// AtCoder
const i64 CYCLES_PER_SEC = 2800000000;

struct Timer {
	i64 start;
	Timer(){reset();}
	void reset(){start=getCycle();}
	inline double get(){return (double)(getCycle()-start)/CYCLES_PER_SEC;}
	inline i64 getCycle(){
		u32 low,high;
		__asm__ volatile ("rdtsc" : "=a" (low), "=d" (high));
		return ((i64)low)|((i64)high<<32);
	}
};

Timer timer;


uint32_t xor128(){
  static uint32_t x = 123456789;
  static uint32_t y = 362436069;
  static uint32_t z = 521288629;
  static uint32_t w = 88675123;
  uint32_t t = x ^ (x << 11);
  x = y; y = z; z = w;
  return w = (w ^ (w >> 19)) ^ (t ^ (t >> 8));
}

//INSERT ABOVE HERE
const int A = 26;
const int MAX_D = 365;
int cs[A+1];
int s[MAX_D+1][A+1];
int ts[MAX_D+1];

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

  int D;
  cin>>D;

  for(int j=1;j<=A;j++) cin>>cs[j];

  for(int i=1;i<=D;i++)
    for(int j=1;j<=A;j++)
      cin>>s[i][j];

  {
    vector<int> ls(A+1,0);
    for(int i=1;i<=D;i++){
      vector<int> ss(A+1,0);
      for(int j=1;j<=A;j++)
        ss[j]=s[i][j]+cs[j]*(i-ls[j]);
      ts[i]=max_element(ss.begin()+1,ss.end())-ss.begin();

      ls[ts[i]]=i;
    }
  }

  auto calcScore=[&]()->int{
    int res=0;
    vector<int> ls(A+1,0);
    for(int i=1;i<=D;i++){
      res+=s[i][ts[i]];
      ls[ts[i]]=i;
      for(int j=1;j<=A;j++)
        res-=cs[j]*(i-ls[j]);
    }
    return res;
  };

  auto calcDiff=[&](int p,int q)->int{
    int res=0;
    vector<int> ls(A+1,0);
    for(int i=1;i<=D;i++){
      if(ts[i]==p or ts[i]==q){
        res+=s[i][ts[i]];
        ls[ts[i]]=i;
      }
      res-=cs[p]*(i-ls[p]);
      res-=cs[q]*(i-ls[q]);
    }
    return res;
  };

  int iter_num = 0;
  int tmpScore=calcScore();

  double start_temp = 1000, end_temp = 10;

  const double LIM = 2.0;
  while(timer.get()<LIM){
    iter_num++;
    int d=xor128()%D+1;
    int q=xor128()%A+1;

    int p=ts[d];
    if(p==q) continue;

    int nxtScore=tmpScore;
    nxtScore-=calcDiff(p,q);
    ts[d]=q;
    nxtScore+=calcDiff(p,q);

    // assert(nxtScore==calcScore());

    double temp = start_temp + (end_temp - start_temp) * timer.get() / LIM;
    double prob = exp((nxtScore-tmpScore)/temp);

    const int INF = 1<<30;
    if(prob > (xor128()%INF)/(double)INF){
      tmpScore=nxtScore;
    }else{
      ts[d]=p;
    }
  }

  cerr<<iter_num<<endl;
  cerr<<tmpScore<<":"<<calcScore()<<endl;
  for(int i=1;i<=D;i++) cout<<ts[i]<<newl;
  return 0;
}


Measured memory_bytes: 4308
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;

//#define int long long
//using ll = boost::multiprecision::cpp_int;
using ll = long long;
//const int INF = 2147483647;
const ll INF = 9223372036854775807LL;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
#ifdef LOCAL_ENV
	#define debug(var) std::cout<<#var" = "<<var<<std::endl
#else
	#define debug(var)
#endif
#define p(var)  std::cout<<var<<std::endl
#define PI (acos(-1))
#define rep(i, n)   for(int i=0, i##_length=(n); i< i##_length; ++i)
#define repeq(i, n) for(int i=1, i##_length=(n); i<=i##_length; ++i)
#define all(a) (a).begin(), (a).end()
#define pb push_back
inline bool isnatural(double a) { return a>=0 && ceil(a)==floor(a); }
template<typename T> inline T gcd(T a, T b) { return b ? gcd(b,a%b) : a; }
template<typename T> inline T lcm(T a, T b) { return a / gcd(a,  b) * b; }
template<typename T1, typename T2>inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template<typename T1, typename T2>inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << ", " << p.second << ")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
	for (int i = 0, len = v.size(); i < len; ++i){
		s << v[i]; if (i < len - 1) s << "\t";
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s, const vector< vector<T> >& vv) {
	for (int i = 0, len = vv.size(); i < len; ++i){
		s << vv[i] << endl;
	}
	return s;
}
template<typename T1, typename T2> ostream& operator<<(ostream& s, const map<T1, T2>& m) {
	s << "{" << endl;
	for (typeof(m.begin()) itr = m.begin(); itr != m.end(); ++itr){
		s << "\t" << (*itr).first << " : " << (*itr).second << endl;
	}
	s << "}" << endl;
	return s;
}

/*-----8<-----8<-----*/



signed main() {
	ll N;
	cin >> N;

	vector<ll> a(N,0);
	rep(i,N){
		cin >> a[i];
	}

	ll sum=accumulate(all(a),0LL);
	vector<ll> rui(N+1,0);
	ll minval=INF;
	rep(i,N)rui[i+1]=rui[i]+a[i];

	repeq(i,N-1){
		ll t=abs((sum-rui[i])-rui[i]);
		chmin(minval,t);
	}

	p(minval);

	return 0;
}



Measured memory_bytes: 3328
#include <stdio.h>

int main(int argc, char **argv)
{
	int a, b, c;
	scanf("%d %d %d", &a, &b, &c);
	if(a-b == 0) printf("%d\n",c);
	else if(b-c == 0) printf("%d\n",a);
	else printf("%d\n",b);
	
	return 0;
}



Measured memory_bytes: 128
S = input()
N = len(S)
flag = [0,0,0]


if S=="".join(reversed(list(S))):
    flag[0]=1
if S[:int((N-1)/2)]=="".join(reversed(list(S[:int((N-1)/2)]))):
    flag[1]=1
if S[int((N+3)/2)-1:]=="".join(reversed(list(S[int((N+3)/2)-1:]))):
    flag[2]=1
print("Yes" if flag==[1,1,1] else "No")


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

#define pb push_back
#define ss second
#define ff first
#define N 100005
#define inf 1000000009
#define ll long long
#define all(a) a.begin(),a.end()
#define mid(a,b) (a+b)/2
#define pii pair<int,int>

using namespace std;

ll n,x;

int main()
{
	cin >> n;
	x = n/500;
	n -= x*500;
	x *= 1000;
	n /= 5;
	cout << x + n * 5;
}

Measured memory_bytes: 256
f,p[5];main(i){for(;({for(i=f=0;i<5;f|=1<<p[i++])scanf("%d\n",p+i);*p;});)for(i=0;i<5;i++)puts(14^f&&f^(1<<p[i])?f%5-p[i]%3?"2":"1":"3");}

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


vector<int> get_cards(const int n) {
    vector<int> cards(n);
    for (int i = 0; i < n; ++i) cin >> cards.at(i);
    return cards;
}

int main() {
    int n;
    cin >> n;
    auto cards = get_cards(n);
    int alice = 0;
    int bob = 0;
    sort(cards.begin(), cards.end(), greater<int>());
    for (int i = 0; i < cards.size(); ++i) {
        if (i % 2 == 0) alice += cards.at(i);
        else bob += cards.at(i);
    }
    std::cout << alice - bob << std::endl;
}

Measured memory_bytes: 256
fn main() {
    static PLANE_MAX: i64 = 101;
    static PLANE_OFFSET: i64 = PLANE_MAX / 2;
    // 変数宣言
    let n: u64;
    let mut a_count: Vec<Vec<i64>>; // "約数" 中の "5" と "2" の数

    // 入力の処理
    let mut buf: String = String::new();
    std::io::stdin().read_line(&mut buf).ok();
    n = buf.trim().parse().ok().unwrap();
    a_count = Vec::<Vec<i64>>::with_capacity(n as usize);
    let mut plane: Vec<Vec<i64>>;
    plane = Vec::<Vec<i64>>::with_capacity(PLANE_MAX as usize);
    for _ in 0..PLANE_MAX {
        let mut zero_vec: Vec<i64> = Vec::with_capacity(PLANE_MAX as usize);
        for _ in 0..PLANE_MAX {
            zero_vec.push(0);
        }
        plane.push(zero_vec.clone());
    }
    for _ in 0..n {
        buf = String::new();
        std::io::stdin().read_line(&mut buf).ok();
        // 最大14桁
        let tmp: Vec<&str> = buf.trim().split('.').collect();
        let mut tmp_d: u64 = 0;
        if tmp.len() > 1 && tmp[1].len() > 0 {
            tmp_d = tmp[1].len() as u64;
        }
        let mut tmp_v: u64 = format!("{}{}", tmp[0], if tmp.len() > 1 { tmp[1] } else { "" })
            .trim()
            .parse()
            .ok()
            .unwrap();
        let mut tmp_5: u64 = 0;
        while tmp_v % 5 == 0 {
            tmp_v = tmp_v / 5;
            tmp_5 += 1;
        }
        let mut tmp_2: u64 = 0;
        while tmp_v % 2 == 0 {
            tmp_v = tmp_v / 2;
            tmp_2 += 1;
        }
        let tmp_vect: Vec<i64> = vec![tmp_5 as i64 - tmp_d as i64, tmp_2 as i64 - tmp_d as i64];
        a_count.push(tmp_vect)
    }
    // 平面上にマッピング
    for item in a_count.clone() {
        let vx1 = -item[0] as i64 + PLANE_OFFSET;
        let vx2 = -item[1] as i64 + PLANE_OFFSET;
        for i in vx1..PLANE_MAX {
            for j in vx2..PLANE_MAX {
                plane[i as usize][j as usize] += 1;
            }
        }
    }
    // カウント
    let mut counter: i64 = 0;
    for item in a_count.clone() {
        let vx1 = item[0] as i64 + PLANE_OFFSET;
        let vx2 = item[1] as i64 + PLANE_OFFSET;
        counter += plane[vx1 as usize][vx2 as usize];
        if item[0] >= 0 && item[1] >= 0 {
            counter -= 1;
        }
    }
    println!("{}", counter / 2);
}


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

int ri() {
	int n;
	scanf("%d", &n);
	return n;
}

int main() {
	int h = ri(), w = ri();
	std::string a[h];
	for (int i = 0; i < h; i++) std::cin >> a[i];
	
	bool red[h][w];
	memset(red, 0, sizeof(red));
	bool blue[h][w];
	memset(blue, 0, sizeof(blue));
	for (int i = 0; i < w; i++) red[0][i] = true, blue[h - 1][i] = true;
	for (int i = 0; i < w; i += 2) {
		for (int j = 0; j < h; j++) {
			if (j + 1 < h) red[j][i] = true;
			if (i + 1 < w && j) blue[j][i + 1] = true;
		}
	}
	for (int i = 1; i + 1 < h; i++)
		for (int j = 1; j + 1 < w; j++) {
			if (a[i][j] == '#') {
				if (j % 2) red[i][j] = true;
				else blue[i][j] = true;
			}
		}
	
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			putchar(red[i][j] ? '#' : '.');
		}
		puts("");
	}
	puts("");
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			putchar(blue[i][j] ? '#' : '.');
		}
		puts("");
	}
	
	
	return 0;
}



Measured memory_bytes: 1536
using System;
using static System.Console;
using static System.Math;

public class Hello{
    public static void Main(){
//        int kazu = int.Parse(ReadLine());
        string[] input = ReadLine().Split(' ');
        int maisu = int.Parse(input[0]);
        int kingaku = int.Parse(input[1]);
        int a=-1,b=-1,c=-1;
        for(int i=0;i<=maisu;i++){
            for(int j=0;j<=maisu;j++){
                int k = maisu -i -j;
                if(i*10000+j*5000+k*1000==kingaku && k>=0){
                    a=i;
                    b=j;
                    c=k;
                }
            }
        }
        WriteLine("{0} {1} {2}",a,b,c);
    }
}


Measured memory_bytes: 13140
import java.util.Scanner;

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

		int S = scan.nextInt();
		int W = scan.nextInt();

		if(S>W) {
			System.out.println("safe");
		}else {
			System.out.println("unsafe");
		}

		scan.close();
	}

}


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

// boost
#include <boost/multiprecision/cpp_int.hpp>
using boost::multiprecision::cpp_int;

using ll = long long;
using ld = long double;

using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vs = vector<string>;
using vld = vector<ld>;
using vvld = vector<vld>;

typedef pair<ll, ll> P;

#define bit(n) (1LL << (n))

//#define int long long

#define all(v) v.begin(), v.end()

#define rep(i, n) for (ll i = 0; i < n; i++)
#define REP(i, n) for (ll i = 1; i < n; i++)

#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define FORm(i, m) for (auto i = m.begin(); i != m.end(); i++)

template <class T>
inline void chmax(T& a, T b) {
  a = std::max(a, b);
}
template <class T>
inline void chmin(T& a, T b) {
  a = std::min(a, b);
}

#define mod (ll)(1e9 + 7)
// #define mod (998244353ll)

const long long INF = 1LL << 60;

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);

  ll h, w;
  cin >> h >> w;
  ll ch, cw;
  cin >> ch >> cw;
  ll dh, dw;
  cin >> dh >> dw;

  ch--;
  cw--;
  dh--;
  dw--;

  vs s(h);
  rep(i, h) cin >> s[i];

  using tup = tuple<ll, int, int>;
  priority_queue<tup, vector<tup>, greater<tup>> q;
  q.emplace(0, ch, cw);

  vvll cost(h, vll(w, INF));
  cost[ch][cw] = 0;

  const vector<int> dy = {0, 0, -1, +1};
  const vector<int> dx = {-1, +1, 0, 0};

  while (!q.empty()) {
    auto t = q.top();
    q.pop();
    ll c = get<0>(t);
    int y = get<1>(t);
    int x = get<2>(t);

    rep(i, 4) {
      int ny = y + dy[i];
      int nx = x + dx[i];
      if (ny < 0 || ny >= h)
        continue;
      if (nx < 0 || nx >= w)
        continue;

      if (s[ny][nx] == '.') {
        if (cost[ny][nx] > c) {
          cost[ny][nx] = c;
          q.emplace(c, ny, nx);
        }
      }
    }

    for (int ny = y - 2; ny <= y + 2; ny++) {
      if (ny < 0 || ny >= h)
        continue;
      for (int nx = x - 2; nx <= x + 2; nx++) {
        if (nx < 0 || nx >= w)
          continue;
        if (s[ny][nx] == '.') {
          if (cost[ny][nx] > c + 1) {
            cost[ny][nx] = c + 1;
            q.emplace(c + 1, ny, nx);
          }
        }
      }
    }
  }

  if (cost[dh][dw] == INF)
    cost[dh][dw] = -1;
  cout << cost[dh][dw] << endl;

  return 0;
}


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

int main(){

int A, B; cin >> A >> B;
string S; cin >> S;

bool check1 = true, check2 = true, check3 = true;
for (int i = 0; i < A; i++) {
    if (!(S[i] >= '0' && S[i] <= '9')) {
        check1 = false;
    }
}
if (S[A] != '-') {
    check2 = false;
}
for (int i = A + 1; i < A + B; i++) {
    if (!(S[i] >= '0' && S[i] <= '9')) {
        check3 = false;
    }
}

if (check1 && check2 && check3) {
    cout << "Yes" << endl;
} else {
    cout << "No" << endl;
}

}



Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    while(true){
        
        int year=0,n;
        int a[50]={0};
        cin >> n;
        
        if(n==0)    break;
        
        a[1]=1;
        a[2]=2;
        a[3]=4;
        for(int i=4;i<=30;i++){
            a[i]=a[i-1]+a[i-2]+a[i-3];
        }
        
        year=a[n]/3650+1;
        cout << year << endl;
        
    }
}



Measured memory_bytes: 3072
#include <iostream>
#include <algorithm>
#include <iomanip>
#include"stdio.h"
#include <cstring>
#include<math.h>
#include<map>
#include<queue>
#include<stack>
#include"time.h"
#define MAX_INT  ((unsigned)(-1)>>1)
#define MIN_INT  (~MAX_INT)
#define db printf("where!\n");
#define pb push_back
using namespace std;
#define ll long long
ll gcd(ll x,ll y){return y ? gcd(y,x%y) : x;}
template<class T>inline void read(T &res){
char c;T flag=1;
while((c=getchar())<'0'||c>'9')if(c=='-')flag=-1;res=c-'0';
while((c=getchar())>='0'&&c<='9')res=res*10+c-'0';res*=flag;
}
double pi=3.1415926;

int main(){
	double r;cin>>r;
	printf("%.2f",r*2*pi);
	return 0;
}

Measured memory_bytes: 3788
#include<stdio.h>
#include<algorithm>

using namespace std;

int main(){
	int n,a,b,c;
	int m=0;
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		int a[3];
		for(int j=0;j<3;j++)scanf("%d",&a[j]);
		std::sort(a,a+3);
		
		int d = 30;
		if(a[0]>d || a[1]>d || a[2]>d)puts("hogehogehoge");
		
		if(a[0]*a[0]+a[1]*a[1] == a[2]*a[2]){
			puts("YES");
		}else{
			puts("NO");
		}
	}
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;
bool used[1005];
int main()
{
    int a, b;
    int c = 0;
    cin >> a >> b;
    if( a < b)
    {
        c = a;
        a = b;
        b = c;
    }
    while(a > b)
    {
        a --;
        b ++;
    }
    if(a == b)
    {
        cout << a;
    }
    else
    {
        cout << "IMPOSSIBLE";
    }
}


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

int main() {
  string s;
  cin >> s;

  bool f[256] = {};

  int minCnt = 100;
  for (int i = 0; i < s.size(); i++) {
    if (f[s[i]]) {
      continue;
    }

    int cnt = 0;
    int maxCnt = i;
    for (int j = i + 1; j < s.size(); j++) {
      if (s[j] == s[i]) {
	maxCnt = max(cnt, maxCnt);
	cnt = 0;
	continue;
      }

      cnt++;
    }
    minCnt = min(max(cnt, maxCnt), minCnt);
  }

  cout << minCnt << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int X;
    cin >> X;
    
    if(X%7 == 0) cout << "thu" << endl;
    else if(X%7 == 1) cout << "fri" << endl;
    else if(X%7 == 2) cout << "sat" << endl;
    else if(X%7 == 3) cout << "sun" << endl;
    else if(X%7 == 4) cout << "mon" << endl;
    else if(X%7 == 5) cout << "tue" << endl;
    else if(X%7 == 6) cout << "wed" << endl;
    
    return 0;
    
}



Measured memory_bytes: 3092
#include <iostream>
#include <vector>
#include <map>
using namespace std;

int main(){
  int N;
  string S;
  cin >> N >> S;
  vector<map<string,int>> mp(N+1);
  for(int i = 0; i < (1<<N); ++i){
    string A(N,'?');
    int a = 0, b = 0;
    for(int j = 0; j < N; ++j){
      if((i>>j)&1) A[a++] = S[j];
      else A[N-1-b++] = S[j];
    }
    ++mp[a][A];
  }
  long long ans = 0;
  for(int i = 0; i < (1<<N); ++i){
    string A(N,'?');
    int a = 0, b = 0;
    for(int j = 0; j < N; ++j){
      if((i>>j)&1) A[a++] = S[2*N-1-j];
      else A[N-1-b++] = S[2*N-1-j];
    }
    ans += mp[a][A];
  }
  cout << ans << endl;
}


Measured memory_bytes: 65792
#include <stdio.h>
int main(void){
    // Your code here!
    int h,w;
    scanf("%d %d\n",&h,&w);
    
    int hh[100]={};
    int ww[100]={};
    
    char a[100][100]={};
    for(int i=0;i<h;i++){
        gets(a[i]);
        //printf("%s\n",a[i]);
        for(int j=0;j<w;j++){
            if(a[i][j]=='#')break;
            if(j==w-1 && a[i][j]=='.'){
                hh[i]=1;
                //printf("h:%d",i);
            }
        }
    }
    
    for(int k=0;k<w;k++){
        for(int l=0;l<h;l++){
            if(a[l][k]=='#')break;
            if(l==h-1 && a[l][k]=='.'){
                ww[k]=1;
                //printf("w:%d",k);
            }
        }
    }
    
    for(int m=0;m<h;m++){
        
        for(int p=0;p<w;p++){
            //printf("%c",a[m][p]);
            if(hh[m]+ww[p]==0){
                printf("%c",a[m][p]);
            }
            //printf("== %d %d\n",m,p);
        }
        hh[m]||printf("\n");
    }
}

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

int main() {
 vector<int> A(3);
  cin>>A[0]>>A[1]>>A[2];
  sort(A.begin(),A.end());
  int a,b,c;
  a=A[0];b=A[1];c=A[2];
  int count=0;
  if(a%2==b%2&&a%2!=c%2){ count++;a++;b++;}
  if(a%2==c%2&&a%2!=b%2){ count++;a++;c++;}
  if(b%2==c%2&&a%2!=b%2){ count++;b++;c++;}
    count+=(2*c-a-b)/2;
  cout<<count<<endl;
}

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

signed main() {
	long long ans = 0;
	int k, s;
	cin >> k >> s;
	for (int x = 0; x <= k; ++x) {
		for (int y = 0; y <= k; ++y) {
			int z = s - x - y;
			if (0 <= z && z <= k)++ans;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
// {{{
#include <algorithm>
#include <array>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
// }}}

using namespace std;

using ll [[maybe_unused]] = long long;
using ull [[maybe_unused]] = unsigned long long;
using ld [[maybe_unused]] = long double;

[[maybe_unused]] static constexpr int mod = (int)1e9 + 7;
[[maybe_unused]] static constexpr int inf = 100100100;
[[maybe_unused]] static constexpr ll linf = 1e18;
[[maybe_unused]] static constexpr double eps = 1e-9;
[[maybe_unused]] static constexpr double pi = 3.14159265359;

#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rrep(i, a) for (ll i = a; i >= 0; --i)
#define all(obj) begin(obj), end(obj)
#define rall(obj) rbegin(obj), rend(obj)
#define pb push_back
#define fst first
#define snd second


int main() {
    // cin.tie(0);
    // ios_base::sync_with_stdio(false);
    ll A, B, X;
    cin >> A >> B >> X;
    if (X - A > B || A > X) {
        cout << "NO" << endl;
    } else {
        cout << "YES" << endl;
    }
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
 
int main()
{
    int array[3][3];
    int n; 
    int add;
    int check[3][3]={0};
    int count;
 
    for(int i = 0; i < 3; i++){
        for(int j = 0; j < 3; j++){
            scanf("%d", &array[i][j]);
        }
    }
    scanf("%d",&n);

    for(int k = 0; k < n; k++){
        scanf("%d",&add);
        for(int i = 0; i < 3; i++){
            for(int j = 0; j < 3; j++){
                if(array[i][j] == add)//jika dalam array dan add sama, makan check == 1
                {
                    check[i][j] = 1;
                }
            }
        }
    }
 
    if(check[0][0] + check[1][1] + check[2][2] == 3 || check[0][2] + check[1][1] + check[2][0] == 3){
        //jika check == 3, maka ada yang bingo
        //diagonal kanan dan diagonal kiri
        printf("Yes\n");
        return 0;
    }
 
    for(int i = 0; i < 3; i++){
        if(check[i][0] + check[i][1] + check[i][2] == 3 || check[0][i] + check[1][i] + check[2][i] == 3){
            //sebaris ada yang bingo atau sekolom ada yang bingo
            printf("Yes\n");
            return 0;
        }
    }
 
    printf("No\n");
 
    return 0;
}

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

namespace ABC147A
{
    class Program
    {
        static void Main(string[] args)
        {
            int a,b, c;
            var word = Console.ReadLine().Split(' ');
            a = int.Parse(word[0]);
            b = int.Parse(word[1]);
            c = int.Parse(word[2]);
            if (a+b+c>=22)
                Console.Write("bust");
            else
                Console.WriteLine("win");
            Console.ReadKey();
        }
    }
}


Measured memory_bytes: 13140
//Robs Code
/***********HEADER***************/
#include<bits/stdc++.h>
/***********MACROS***************/
#define ll long long int
#define fri(l,k) for (i=l;i<=k;i++)
#define frj(l,k) for (j=l;j>=k;j--)
#define fij(a,b,l,k) for(i=a;i<=b;i++) for(j=l;j<=k;j++)
#define all(x) x.begin(),x.end()
#define allr(x) x.rbegin(),x.rend()
#define endl "\n"
#define pb push_back
#define _1 first
#define _2 second
#define mxsz 10000007
#define mxval 1e9
#define grt [](auto x,auto y){return x>y;}
#define pii pair<ll,ll>
/*********VARIABLE****************/
using namespace std;
ll i,j,n,m,k,l,q,t,a,b,sum[3],tot[3],cnt[3];
/***********MAIN******************/
ll val(ll n){
    if(n%2==1){
        if((n-1)%4==0){
            return 1;
        }else return 0;
    }else {
        if(n%4==0){
            return n;
        }else return n+1;
    }
}
int main()
{
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	cin>>a>>b;
    a--;
    cout<<(val(a)^val(b));
	return 0;
}
//.........

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <algorithm>
#include <queue>
#include <vector>
using namespace std;
int main(){
  int N;
  cin>>N;
  vector<int> path[100000];
  int ver[100000][2];
  vector<int> aro[100001];
  for(int i=1;i<N;i++){
    int a,b;
    cin>>a>>b;
    ver[i][0]=a;
    ver[i][1]=b;
    aro[a].push_back(i);
    aro[b].push_back(i);
  }
  int num=0;
  for(int i=1;i<=N;i++) if(num<aro[i].size()) num=aro[i].size();
  cout<<num<<endl;
  int color[100000];
  for(int i=1;i<N;i++) color[i]=0;
  queue<int> que;
  que.push(1);
  color[1]=1;
  while(!que.empty()){
    int n=que.front();
    que.pop();
    int a=ver[n][0];
    int b=ver[n][1];
    int j=1;
    int k=1;
    for(int i=0;i<aro[a].size();i++){
      if(j==color[n]) j++;
      if(aro[a][i]!=n&&color[aro[a][i]]==0){
        color[aro[a][i]]=j;
        que.push(aro[a][i]);
        j++;
      }
    }
    for(int i=0;i<aro[b].size();i++){
      if(k==color[n]) k++;
      if(aro[b][i]!=n&&color[aro[b][i]]==0){
        color[aro[b][i]]=k;
        que.push(aro[b][i]);
        k++;
      }
    }
  }
  for(int i=1;i<N;i++) cout<<color[i]<<endl;
  
  return 0;
}

Measured memory_bytes: 12200
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;
int main()
{
    ll cnt = 0;
    string s, s1;
    cin >> s >> s1;
    for(ll i = 0; i < s.size(); i ++)
    {
        if(s[i] == s1[i])
        {
            cnt ++;
        }
    }
    cout << cnt;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, m, n) for (ll i = m; i < n; ++i)
#define FORR(i, m, n) for (ll i = m; i >= n; --i)
#define ALL(v) (v).begin(),(v).end()
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF=1LL<<60;
const int inf=(1<<30)-1;
const int mod=1e9+7;
int dx[8]={1,0,-1,0,-1,-1,1,1};
int dy[8]={0,1,0,-1,-1,1,-1,1};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;cin >> n;
    set<string> st;
    REP(i,n){
        string s;cin >> s;
        st.insert(s);
    }
    cout << st.size() << endl;
}

Measured memory_bytes: 19204
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <vector>
#include <limits>
#include <algorithm>
#include <utility>
#include <sstream>
#include <numeric>
#include <iterator>

using namespace std;

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
// #define ll long long
typedef long long ll;
typedef pair<int, int> P;


int main(int argc, const char * argv[]) {

    int n;
    cin >> n;
    vector<int> p;
    rep(i,n){
      int d;
      cin >> d;
      p.push_back(d);
    }
    sort(p.begin(), p.end());
    cout << p[n/2] - p[(n/2)-1] << endl;

    return 0;
}


Measured memory_bytes: 892
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        long l = sc.nextLong();
        long r = sc.nextLong();
        long tmp = 2018;

        if(r-l >= 2019){
            tmp = 0;
        }else{
            for(long i = l;i < r;++i){
                for(long j = i+1;j <= r;++j){
                    tmp = Math.min(tmp,(i*j)%2019);
                }
            }
            
        }
        System.out.println(tmp);
        }
    }


Measured memory_bytes: 25044
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;
using ll = long long;
using P = pair<int, int>;
#define rep(i,n) for(int i = 0; i < n; i++)
const int INF = 1001001001;

int main() {
    string s;
    cin >> s;
    int n = s.size();
    deque<int> a; deque<int> z;
    rep(i, n) {
        if (s[i] == 'A') a.push_back(i);
        if (s[i] == 'Z') z.push_back(i);
    }
    cout << z.back() - a.front() + 1 << endl;
 	return 0;
}

Measured memory_bytes: 1284
// 2019.9.15 bal4u
// Template for Online Contest

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>

typedef long long ll;

#define gc() getchar()
#define pc(c) putchar(c)

int in() {  // 整数の入力
	int n = 0, c = gc();
	if (c == '-') {	c = gc();
		do n = 10*n + (c & 0xf), c = gc(); while (c >= '0');
		return -n;
	}
	do n = 10*n + (c & 0xf), c = gc(); while (c >= '0');
	return n;
}

ll inL() {  // long long 整数の入力
	ll n = 0; int c = gc();
	if (c == '-') {	c = gc();
		do n = 10*n + (c & 0xf), c = gc(); while (c >= '0');
		return -n;
	}
	do n = 10*n + (c & 0xf), c = gc(); while (c >= '0');
	return n;
}

void out(int n) { // 整数の表示
	int i; char b[30];
	if (!n) pc('0');
	else {
		if (n < 0) pc('-'), n = -n;
		i = 0; while (n) b[i++] = n % 10 + '0', n /= 10;
		while (i--) pc(b[i]);
	}
	pc('\n');
}

void outL(ll n) { // 整数の表示
	int i; char b[30];
	if (!n) pc('0');
	else {
		if (n < 0) pc('-'), n = -n;
		i = 0; while (n) b[i++] = n % 10 + '0', n /= 10;
		while (i--) pc(b[i]);
	}
	pc('\n');
}

int ins(char *s) { // 文字列の入力
	char *p = s--;
	do *++s = gc();
	while (*s > ' ');
	*s = 0;
	return s - p;
}

void outs(char *s) {  // 文字列の表示
	while (*s) pc(*s++); pc('\n');
}

#define MIN(a,b)  ((a)<=(b)?(a):(b))
#define MAX(a,b)  ((a)>=(b)?(a):(b))
#define ABS(a)    ((a)>=0?(a):-(a))
inline static int chmax(int *a, int b) { if (*a < b) *a = b; }
inline static ll  chmaxL(ll *a, int b) { if (*a < b) *a = b; }
inline static int chmin(int *a, int b) { if (*a > b) *a = b; }
inline static ll  chminL(ll *a, int b) { if (*a > b) *a = b; }

int cmp_int(const void *u, const void *v) { return *(int *)u - *(int *)v; }
#if 0
int cmp_T(const void *u, const void *v) {
	int t; 
	if (t = ((T *)u)->a - ((T *)v)->a) return t;
	return ((T *)u)->b - ((T *)v)->b;
}
#endif

char T[6][10] = { "Sunny", "Cloudy", "Rainy", "Sunny", "Cloudy", "Rainy" };
char S[10];
int main()
{
	int i, j, k, a, b, c;
	int ans;
	
	ins(S);
	for (i = 0; ; i++) if (strcmp(S, T[i]) == 0) {
		puts(T[i+1]); return 0;
	}
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)

int main(){
    ll n;
    cin >> n;
    vector<pair<ll,ll>> pr(n);
    rep(i, 0, n){
        cin >> pr[i].first;
        pr[i].second = i+1;
    }
    sort(pr.begin(), pr.end());
    pr.push_back({-1,-1});
    ll ans = 0, tmp = 1;
    rep(i, 0, n) {
        if(pr[i].second < pr[i+1].second) {
            tmp++;
        }else{
            ans = max(ans, tmp);
            tmp = 1;
        }
    }
    cout << n - ans << endl;
    return 0;
}

Measured memory_bytes: 9584
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
// using namespace __gnu_pbds;
using namespace std;

#define ff first
#define ss second
#define int long long
#define pb push_back
#define mp make_pair
#define pii pair<int, int>
#define vi vector<int>
#define mii map<int, int>
#define pqb priority_queue<int>
#define pqs priority_queue<int, vi, greater<int> >
#define setbits(x) __builtin_popcountll(x)
#define zrobits(x) __builtin_ctzll(x)
#define mod 1000000007
#define inf 1e18
#define ps(x, y) fixed << setprecision(y) << x
#define mk(arr, n, type) type* arr = new type[n];
#define forn(i, n) for (int i = 1; i <= n; i++)
#define me0(x) memset(x, 0, sizeof(x))
#define me1(x) memset(x, -1, sizeof(x))
#define tests(x) \
    int x;       \
    cin >> x;    \
    while (x--)
// mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

// typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
const int N = 2e5 + 2;
void run() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}
int solve() {
    int a; double b;
    cin>>a>>b;
    b*=100;
    int c = llround(b);
    a*=c;
    a/=100;
    return a;
}
int32_t main() {
    run();
    cout << solve();
    return 0;
}

Measured memory_bytes: 3764
// AOL Q.0061
// YAMADA Terushige 2013.4.3.
 
#include<iostream>
#include<set>
#include<map>
#include<vector>
#include<algorithm>
 
using namespace std;
 
int main(){
 
  int num,point;
  char c; 
  set<int,greater<int> > s;
  set<int,greater<int> >::iterator is;
  map<int,int> table;
  vector<int> data(100);

  while(cin >> num >> c >> point){
    if (num == 0 && point ==0) break;
    data[num]=point;
    s.insert(point);
  }

  int i = 0;
  for(is = s.begin();is != s.end();is++){
    table[*is] = ++i;
  }
 
  while(cin >> num){
    cout << table[ data[num] ] << endl;
  }
  return 0;
}


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

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

  int temp;
  vector<ll> num(110000, 0);
  rep(i, N) {
    cin >> temp;
    num[temp]++;
  }

  ll output = 0;
  rep(i, 100001) {
    output += i * num[i];
  }

  int Q;
  cin >> Q;

  vector<ll> B(Q, 0);
  vector<ll> C(Q, 0);
  rep(i, Q) {
    cin >> B[i] >> C[i];
  }
  rep(i, Q) {
    output -= B[i] * num[B[i]];
    output += C[i] * num[B[i]];
    num[C[i]] += num[B[i]];
    num[B[i]] = 0;

    cout << output << endl;
  }
}

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

struct UnionFind {
    //自身が親であれば、その集合に属する頂点数に-1を掛けたもの
    //そうでなければ親のid
    vector<int> r;
 
    UnionFind(int N) {
        r = vector<int>(N, -1);
    }
 
    int root(int x) {
        if (r[x] < 0) return x;
        return r[x] = root(r[x]);
    }
 
    bool unite(int x, int y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (r[x] > r[y]) swap(x, y);
        r[x] += r[y];
        r[y] = x;
        return true;
    }
 
    int size(int x) {
        return -r[root(x)];
    }
};

int main(){
    int N,M;
    cin >> N >> M;

    UnionFind uf(N);
    rep(i,M){
        int a,b;
        cin >> a >> b;
        --a; --b;
        uf.unite(a,b);
    }

    int ans = 0;
    rep(i, N){
        ans = max(ans, uf.size(i));
    }
    cout << ans << endl;

}

Measured memory_bytes: 4052
#!/usr/bin/env python3
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        if self.parents[x] > self.parents[y]:
            x, y = y, x
        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())
    
(n, m), *q = [[*map(int, o.split())] for o in open(0)]
UF = UnionFind(n + 1)
for a, b in q:
    UF.union(a, b)
print(max(UF.size(r) for r in UF.roots()))

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

int main() {
    long long N;
    cin >> N;
    long long a=1, b=N;
    long long M = a + b;
    for (long long i = 2; i * i <= N; i++) {
        if ((N % i == 0) && ((i + N/i) < M)) {
            a = i; b = N / i;
            M = a + b;
        }
    }
    if (a == 1 && b == 1) cout << "0" << endl;
    else cout << a + b - 2 << endl;
}

Measured memory_bytes: 256
#include <cstdio>

int main(void)
{
    int A,B,N;
    scanf("%d%d%d",&N,&A,&B);
    if(N==1)
    {
        if(A==B)
            printf("1\n");
        else
            printf("0\n");
    }
    else 
    {
        if(A>B)
            printf("0\n");
        else
            printf("%lld\n",(long long )(B-A)*(N-2)+1);
    }
    return 0;;;
}

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

int main () {
	
	int n=0, v=0, c=1, i=0;
	deque <int> dq;

	scanf("%d", &n);

	scanf("%d", &v);
	dq.push_back(v);

	
	for (i=1, c=1; i<n; i++, c++) {
		scanf("%d", &v);

		if (n%2 == 0) {
			if (c%2 == 1) dq.push_back(v);
			else dq.push_front(v);	
		}
		else {
			if (c%2 == 0) dq.push_back(v);
			else dq.push_front(v);
		}
		

	}

	printf("%d", dq.back());
	dq.pop_back();

	while(!dq.empty()) {
		printf(" %d", dq.back());
		dq.pop_back();
	}
	printf("\n");
}

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

int n,x;
int main(){
	while(cin >> n >> x && n>0){
		int count = 0;
		for(int i=1;i<=n;i++){
			for(int j=i+1;j<=n;j++){
				for(int k=j+1;k<=n;k++){
					if(x==i+j+k) count++;
				}
			}
		}
		cout << count << endl;
	}
}


Measured memory_bytes: 3104