akhauriyash/Code-Regression huggingface dataset:
package main

import "fmt"

func max(a, b int) int {
	if a < b {
		return b
	}
	return a
}

func main() {
	var n int
	fmt.Scan(&n)
	a := make([][]int, 2)
	a[0] = make([]int, n)
	a[1] = make([]int, n)
	s := make([][]int, 2)
	s[0] = make([]int, n+1)
	s[1] = make([]int, n+1)
	for i := range a[0] {
		fmt.Scan(&a[0][i])
		s[0][i+1] = s[0][i] + a[0][i]
	}
	for i := range a[1] {
		fmt.Scan(&a[1][i])
		s[1][i+1] = max(s[0][i+1], s[1][i]) + a[1][i]
	}
	fmt.Println(s[1][n])
}


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

ll INF = 1e+18;
int iINF = 1e9;
int MAXI = 1e8 + 1;
using vec = vector<int>;

int 
main()
{
  int N, M; cin >> N >> M;
  map<int, int> from;
  vec to(M);
  rep(i, 0, M){
    int a, b; cin >> a >> b;
    if(a == 1) from[b] += 1;
    if(b == N) to.push_back(a);
  }

  for(auto x: to){
    if(from[x] != 0){
      cout << "POSSIBLE" << endl;
      return 0;
    }
  }

  cout << "IMPOSSIBLE" << endl;

}

Measured memory_bytes: 13756
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define ld long double
#define mod 1000000007LL
#define eps 1e-13
// #define PI 3.141592653589793238L
#define INF 1000000011
#define INFLL 1000000000000000011LL
#define vi vector<int>
#define vll vector<long long>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define pil pair<int, long long>
#define pli pair<long long, int>
#define mp make_pair
#define F first
#define S second
#define pb push_back
#define fo(i,a,n) for(i = (a); i < (n); i++)
#define gtl(x) getline(cin, (x))
#define flsh fflush(stdout)
#define sws ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define gcd __gcd
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)((a).size())
#define io_file freopen("D:/Coding Problems/Contest/input_file.in", "r", stdin); freopen("D:/Coding Problems/Contest/output_file.out", "w", stdout)

ll modx(ll Base, ll exponent)
{
	ll ans = 1;
	if(Base == 1)
		return Base;
	while(exponent)
	{
		if(exponent & 1)
			ans = (ans * Base)%mod;
		Base = (Base * Base)%mod;
		exponent = exponent >> 1;
	}
	return ans;
}

ll inmodx(ll num)
{
	return (modx(num, mod-2LL));
}

bool cmp(pair < pii, int > a, pair < pii, int > b)//true for a before b
{
	if(a.F.F/300 < b.F.F/300)
		return 1;
	if(a.F.F/300 > b.F.F/300)
		return 0;
	if(a.F.S < b.F.S)
		return 1;
	if(a.F.S > b.F.S)
		return 0;
	if(a.F <= b.F)
		return 1;
	return 0;
}

const int N = (2e5) + 9;
const int M = (N<<2) + 9;
const int LOGN = ((int)log2(N)) + 3;
const int LOGM = ((int)log2(M)) + 3;
const int BUCK = 2*550;
const int SQRT = BUCK+9;

vll dig, temp;

ll digsum(ll n)
{
	ll ans = 0;
	while(n > 0LL)
	{
		ans += (n%10LL);
		dig.pb(n%10LL);
		n /= 10LL;
	}
	reverse(all(dig));
	return ans;
}

void solve()
{
	int i;
	ll n, ans, val;
	cin >> n;
	ans = digsum(n);
	temp = dig;
	temp[0]--;
	fo(i,1,sz(temp))
		temp[i] = 9LL;
	val = 0;
	for(auto x : temp)
		val += x;
	ans = max(ans, val);
	cout << ans << '\n';
	return;
}

int main()
{
	sws;
	clock_t clk;
	clk = clock();
	// io_file;
	// srand (time(NULL));

	//Code here
	int t = 1, cs;
	cout << fixed << setprecision(9);
	// cin >> t;
	fo(cs,1,t+1)
	{
		// cout << "Case #" << cs << ": ";
		solve();
	}
	// Code ends here

	clk = clock() - clk;
	cerr << fixed << setprecision(6) << "Time: " << ((double)clk)/CLOCKS_PER_SEC << "\n";
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Console = System.Console;

namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var ABC = Console.ReadLine().Split().Select(int.Parse).ToArray();
            Console.WriteLine(ABC[2] + " " + ABC[0] + " " + ABC[1]);
        }
    }
}

Measured memory_bytes: 11348
N, T = map(int, input().split())

ans_cost = 9999999
for i in range(N):
    c, t = map(int, input().split())
    if t <= T:
        ans_cost = min(ans_cost, c)

if ans_cost == 9999999:
    print('TLE')
else:
    print(ans_cost)

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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// グラフの辺表現
using Edge = map<pair<int,int>,int>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
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 gcd(ll a,ll b){
   if (a%b == 0) return(b);
   else return(gcd(b, a%b));
}

// 最小公倍数
ll lcm(ll a, ll b){
    return a*b/gcd(a, b);
}

int main()
{
    cout << fixed << setprecision(15);
    ll N, M, X;
    cin >> N >> M >> X;

    vector<ll> A(M);

    REP(i, M){
        cin >> A[i];
    }

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

    vector<ll>::iterator iter_lower;
    iter_lower = lower_bound(A.begin(), A.end(),X);
    ll idx_lower = distance(A.begin(), iter_lower); 
    cout << min(idx_lower, M - idx_lower) << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
typedef long long LL;
int N;
int a[601][601];
vector<int>v;
//map<int,int>m;
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
int m[300000];

void bfs(int x,int y,int now,int p){
	REP(i,4){
		int xx=x+dx[i];
		int yy=y+dy[i];
		if(xx<0||xx>=N||yy<0||yy>=N)continue;
		int nxt=now;
		if(m[y*N+x]>m[p])nxt++;
		if(a[xx][yy]>nxt){
			a[xx][yy]=nxt;
			bfs(xx,yy,nxt,p);
			//a[xx][yy]=min(a[xx][yy],a[x][y]);
		}
	}
}

/*void output(){
	REP(i,N){
		REP(j,N){
			//a[i][j]=min(i,min(j,min(N-1-i,N-1-j)));
			cout<<a[i][j]<<" ";
		}
		cout<<endl;
	}
	cout<<endl;
}*/

int main(){
	cin>>N;
	REP(i,N*N){
		int aa;
		cin>>aa;
		aa--;
		v.push_back(aa);
		m[aa]=i;
		//mm[x][y]=i;
	}
	REP(i,N){
		REP(j,N){
			a[i][j]=min(i,min(j,min(N-1-i,N-1-j)));
		}
	}

	LL ans=0;
	REP(i,v.size()){
		int now=v[i];
		int x=now%N;
		int y=now/N;
		bfs(x,y,a[x][y],v[i]);
		ans+=a[x][y];
		//cout<<now<<" "<<a[x][y]<<endl;
		//output();
	}
	
	cout<<ans<<endl;
}


Measured memory_bytes: 25784
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <algorithm>

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

using namespace std;

class editor
{
private:
	vector<string> lines;
	int cur_line, cur_col;

	string buffer;
	bool buf_is_available;

public:
	editor()
		: cur_line(0), cur_col(0), buf_is_available(false)
	{
	}

	void add_line(const string &l) { lines.push_back(l); }

	int tail() { return lines[cur_line].length(); }

	bool is_first_line() { return cur_line == 0; }
	bool is_last_line() { return cur_line + 1 == lines.size(); }
	bool is_head_of_line() { return cur_col == 0; }
	bool is_tail_of_line() { return cur_col == tail(); }

	// a
	void move_to_head() { cur_col = 0; }

	// e
	void move_to_tail() { cur_col = tail(); }

	// p
	void move_up()
	{
		move_to_head();
		if (!is_first_line()) cur_line--;
	}

	// n
	void move_down()
	{
		move_to_head();
		if (!is_last_line()) cur_line++;
	}

	// f
	void forward()
	{
		if (is_tail_of_line())
		{
			if (!is_last_line())
			{
				cur_line++;
				cur_col = 0;
			}
		}
		else
		{
			cur_col++;
		}
	}

	// b
	void backward()
	{
		if (is_head_of_line())
		{
			if (!is_first_line())
			{
				cur_line--;
				cur_col = tail();
			}
		}
		else
		{
			cur_col--;
		}
	}

	// d
	void delete_char()
	{
		if (!is_tail_of_line())
		{
			lines[cur_line].erase(cur_col, 1);
		}
		else if (!is_last_line())
		{
			lines[cur_line] += lines[cur_line + 1];
			lines.erase(lines.begin() + cur_line + 1);
		}
	}

	// k
	void cut_tails()
	{
		buffer = lines[cur_line].substr(cur_col);
		buf_is_available = true;
		if (is_tail_of_line())
		{
			if (!is_last_line())
			{
				lines[cur_line] += lines[cur_line + 1];
				lines.erase(lines.begin() + cur_line + 1);
			}
		}
		else
		{
			lines[cur_line] = lines[cur_line].substr(0, cur_col);
		}
	}

	// y
	void paste()
	{
		if (!buf_is_available) return;

		if (buffer.empty())
		{
			lines.insert(lines.begin() + cur_line + 1, lines[cur_line].substr(cur_col));
			lines[cur_line] = lines[cur_line].substr(0, cur_col);
			cur_line++;
			cur_col = 0;
		}
		else
		{
			lines[cur_line].insert(cur_col, buffer);
			cur_col += buffer.length();
		}
	}

	void print_lines()
	{
		rep(i,lines.size())
		{
			cout << lines[i] << endl;
		}
	}
};

int main()
{
	editor edit;
	string line;
	while (getline(cin, line), line != "END_OF_TEXT") edit.add_line(line);

	char c;
	for(;cin>>c, c != '-';)
	{
		switch (c)
		{
		case 'a': edit.move_to_head(); break;
		case 'e': edit.move_to_tail(); break;
		case 'p': edit.move_up();      break;
		case 'n': edit.move_down();    break;
		case 'f': edit.forward();      break;
		case 'b': edit.backward();     break;
		case 'd': edit.delete_char();  break;
		case 'k': edit.cut_tails();    break;
		case 'y': edit.paste();        break;
		}
	}
	edit.print_lines();
	return 0;
}

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

const int MOD = (int)1e9+7;

int main(){
	int N,K;
	string S;
	cin >> N >> K >> S;

	vector<int> x;
	int ans=0;
	int count=1;
	for(int i=0;i<N-1;i++){
		if(S.at(i)==S.at(i+1))	count++;
		else{
			x.push_back(count);
			count=1;
		}
	}
	x.push_back(count);
	for(int i=0;i<x.size();i++){
		ans+=x.at(i)-1;
	}

	int si=x.size();
	if(si<=1);
	else if(si==2)	ans+=1;
	else if(si-2<=K)	ans+=si-2+1;
	else{
		if(K*2>=si-1)	ans+=si-2+1;
		else	ans+=K*2;
	}

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


Measured memory_bytes: 1020
#include <stdio.h>

typedef int keytype;

void inssort(int n, keytype a[])
{
    int i, j;
    keytype x;

    for (i = 1; i < n; i++) {
        x = a[i];
        for (j = i - 1; j >= 0 && a[j] < x; j--)
            a[j + 1] = a[j];
        a[j + 1] = x;
    }
}

#define THRESHOLD 10
#define STACKSIZE 32  /* たかだか int のビット数程度 */

void quicksort(int n, keytype a[])
{
    int i, j, left, right, p;
    int leftstack[STACKSIZE], rightstack[STACKSIZE];
    keytype x, t;

    left = 0;  right = n - 1;  p = 0;
    for ( ; ; ) {
        if (right - left <= THRESHOLD) {
            if (p == 0) break;
            p--;
            left = leftstack[p];
            right = rightstack[p];
        }
        x = a[(left + right) / 2];
        i = left;  j = right;
        for ( ; ; ) {
            while (a[i] > x) i++;
            while (x > a[j]) j--;
            if (i >= j) break;
            t = a[i];  a[i] = a[j];  a[j] = t;
            i++;  j--;
        }
        if (i - left > right - j) {
            if (i - left > THRESHOLD) {
                leftstack[p] = left;
                rightstack[p] = i - 1;
                p++;
            }
            left = j + 1;
        } else {
            if (right - j > THRESHOLD) {
                leftstack[p] = j + 1;
                rightstack[p] = right;
                p++;
            }
            right = i - 1;
        }
    }
    inssort(n, a);
}

/*
void quicksort(keytype a[], int first, int last)
{
    int i, j;
    keytype x, t;

    x = a[(first + last) / 2];
    i = first;  j = last;
    for ( ; ; ) {
        while (a[i] < x) i++;
        while (x < a[j]) j--;
        if (i >= j) break;
        t = a[i];  a[i] = a[j];  a[j] = t;
        i++;  j--;
    }
    if (first  < i - 1) quicksort(a, first , i - 1);
    if (j + 1 < last) quicksort(a, j + 1, last);
}
*/
void quicksort_des(keytype a[], int first, int last)
{
    int i, j;
    keytype x, t;

    x = a[(first + last) / 2];
    i = first;  j = last;
    for ( ; ; ) {
        while (a[i] > x) i++;
        while (x > a[j]) j--;
        if (i >= j) break;
        t = a[i];  a[i] = a[j];  a[j] = t;
        i++;  j--;
    }
    if (first  < i - 1) quicksort_des(a, first , i - 1);
    if (j + 1 < last) quicksort_des(a, j + 1, last);
}

int main(){
    int n;
    int a[200];

    scanf("%d", &n);
    for(int i = 0; i < n; ++i){
        scanf("%d", &a[i]);
    }
#if 0 
    quicksort(a, 0, n-1);
    int alice = 0, bob = 0;
    for(int i = n - 1; i >= 0; i -= 2){
        alice += a[i];
        if(i - 1 >= 0) bob += a[i-1];
    }
#endif

    quicksort_des(a, 0, n-1);
    int alice = 0, bob = 0;
    for(int i = 0; i < n; ++i){
        //printf("%d\n",a[i]);
        if((i % 2) == 0) alice += a[i];
        else bob += a[i];
    }

    printf("%d\n", alice - bob);

    return 0;
}

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

int selectionSort(int a[], int n) {
    int t, minj, count = 0;
    rep(i,n) {
        minj = i;
        for (int j = i; j < n; j++)
            if (a[j] < a[minj])  minj = j;
        t = a[i];  a[i] = a[minj];  a[minj] = t;
        if (i != minj)  count++;
    }
    return count;
}

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

    count = selectionSort(a,n);

    rep(i,n) {
        if (i < n-1)  cout << a[i] << ' ';
        else  cout << a[i] << endl;
    }
    cout << count << endl;
}


Measured memory_bytes: 3108
#include <bits/stdc++.h>
 
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pii;
typedef tuple<ll, ll, ll> ti;
ll mod=1E9+7;
 
#define REP(a,b,c) for(ll a=b;a<(c);a++)
#define PER(a,b,c) for(ll a=b;a>=(c);a--)
 
ll ii(){ ll x; cin >> x; return x; }
string is(){ string x; cin >> x; return x; }
ld id(){ ld x; cin >> x; return x; }
void oi(ll x){ cout << x; }
void od(ld x){ cout << fixed << setprecision(10) << x; }
void os(string x){ cout << x; }
void oe(){ cout << endl; }
void oie(ll x){ oi(x); oe(); }
void ode(ld x){ od(x); oe(); }
void ose(string x){ os(x); oe(); }

int main(){
    REP(i,0,5){
        ll N=ii();
        if(N==0){
            oie(i+1);
        }
    }
    return 0;
}

Measured memory_bytes: 3600
//                                      KiSmAt
#include "bits/stdc++.h"
using namespace std;
 
using ll = long long;
 
const ll inf = 1e18;
const int N = 2 * 1e5 + 10;

ll res;
ll a[N], b[N];
ll dp[100009][109];

void solve(){
	ll n, W;
	cin >> n >> W;
	for(int i = 1; i <= n; ++i){
		cin >> a[i] >> b[i];
	}
	for(int i = 1; i <= W; ++i){
		for(int j = 1; j <= n ; ++j){
			dp[i][j] = dp[i][j - 1];
			if(a[j] <= i)	dp[i][j] = max(b[j] + dp[i - a[j]][j - 1], dp[i][j]);	
		}
	}
	cout << dp[W][n];
}
 
int main(int argc, char const *argv[]){
	ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
    ll t = 1;
    //cin >> t;
    while(t--){
    	solve();
    }
}
// nEro

Measured memory_bytes: 88448
#include<iostream>
#include<algorithm>
#include<vector>
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
using namespace std;

int main(){
  int n;
  cin >> n;
  vector<int> a(n+1);
  rep(i,n) cin >> a[i+1];
  vector<int> b(n+1);
  for(int i=n;i>=1;i--){
    int s = 0;
    for(int j=i+i;j<=n;j+=i){
      s ^= b[j];
    }
    b[i] = s^a[i];
  }
  vector<int> ans;
  for(int i=1;i<=n;i++){
    if(b[i])ans.push_back(i);
  }
  cout << ans.size() << endl;
  rep(i,ans.size()){
    printf("%d%c",ans[i],i+1==ans.size() ? '\n' : ' ');
  }
}


Measured memory_bytes: 3064
#include <stdio.h>

void swap( int *a, int *b );

int main( void )
{
	int a, b, c;
	
	scanf("%d %d %d", &a, &b, &c);
	
	if( a > b )
		swap( &a, &b );
	if( b > c )
		swap( &b, &c );
	if( a > b )
		swap( &a, &b );
	
	printf("%d %d %d\n", a, b, c);
	
	return 0;
}

void swap( int *a, int *b )
{
	int temp;
	
	temp = *a;
	*a = *b;
	*b = temp;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6+10;

int vis[maxn], pre[maxn];
int head[maxn], tot;

struct Edge{
    int to, next;
}e[maxn<<1];

void addedge(int from, int to){
    e[tot].to = to;
    e[tot].next = head[from];
    head[from] = tot++;
}

void bfs(int u){
    memset(vis, 0, sizeof(vis));
    vis[u] = 1;
    queue <int> q;
    q.push(u);
    while(!q.empty()){
        u = q.front(); q.pop();
        for(int i = head[u]; i != -1; i = e[i].next){
            int v = e[i].to;
            if(!vis[v]){
                vis[v] = 1;
                pre[v] = u;
                q.push(v);
            }
        }
    }
}

int main(){
    memset(head, -1, sizeof(head));
    tot = 0;
    int n, m; cin >> n >> m;
    for(int i = 0; i < m; i++){
        int from, to; cin >> from >> to;
        addedge(from, to);
        addedge(to, from);
    }
    bfs(1);
    bool judge = true;
    for(int i = 2;i <= n; i++)
        if(!vis[i]) {judge = false; break; }
    if(judge){
        puts("Yes");
        for(int i = 2; i <= n; i++)
            cout << pre[i] << endl;
    }
    else puts("No");
    return  0;
}

Measured memory_bytes: 15088
'use strict'

function main(input) {
  input = input.trim().split('\n')
  const N = parseInt(input[0], 10)
  const nums = input[1]
    .split(' ')
    .map(v => parseInt(v, 10))
    .sort((a, b) => a - b)

  // let count = 0

  const mid = nums.length / 2

  const count = nums[mid] - nums[mid - 1] 
  console.log(count)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'))


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

#define INF 1 << 29
#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)

using namespace std;

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

void gen_sosuu(int sosuu[]){
  REP(i,100010){
    sosuu[i] = true;
  }
  sosuu[0] = false;
  sosuu[1] = false;
  sosuu[2] = true;
  FOR(i,2,sqrt(100000)+1){
    if(sosuu[i] == false) continue;
    for(int j = 2; i*j<=100000;j++){
      //printf("%d %d %d\n",i*j,i,j);
      sosuu[i*j] =false;
    }
  }
}

string n,m;

int main(){
  cin >> n >> m;
  if(n.size()>m.size()){
    printf("GREATER\n");
    return 0;
  }else if(n.size()<m.size()){
    printf("LESS\n");
    return 0;
  }
  if(n>m){
    printf("GREATER\n");
  }else if(n==m){
    printf("EQUAL\n");
  }else{
    printf("LESS\n");
  }
}


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

int main() {
  
  int N, M;
  cin >> N >> M;
  
  priority_queue<long long> pq;
  for (int i = 0; i < N; i++) {
    int A; cin >> A;
    pq.push(A);
  }
  
  for (int i = 0; i < M; i++) {
    int max = pq.top();
    pq.pop();
    pq.push(max / 2);
  }
  
  long long ans = 0;
  
  for (int i = 0; i < N; i++) {
    ans += pq.top();
    pq.pop();
  }
  
  cout << ans << endl;
  
}

Measured memory_bytes: 1400
package main

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

func main() {
	n := readInt()
	s := readBytes()

	ans := 0
	for i := range s {
		m := make(map[byte]int)
		for j := i + 1; j < n; j++ {
			m[s[j]]++
			if s[j] == s[i] {
				continue
			}
			if j+(j-i) > n-1 {
				continue
			}
			if s[j+j-i] != s[i] && s[j+j-i] != s[j] {
				ans--
			}
		}

		if len(m) < 2 {
			continue
		}
		if _, ok := m[s[i]]; len(m) == 2 && ok {
			continue
		}

		tmp := 1
		for k, v := range m {
			if k == s[i] {
				continue
			}
			tmp *= v
		}
		ans += tmp
	}

	fmt.Println(ans)
}

// sort ------------------------------------------------------------

type xxx struct {
	x int
}

type sortArray []xxx

func (s sortArray) Len() int           { return len(s) }
func (s sortArray) Swap(i, j int)      { s[i], s[j] = s[j], s[i] }
func (s sortArray) Less(i, j int) bool { return s[i].x < s[j].x }

// -----------------------------------------------------------------

var (
	readString func() string
	readBytes  func() []byte
)

func init() {
	log.SetFlags(log.Lshortfile)
	readString, readBytes = newReadString(os.Stdin)
}

func newReadString(ior io.Reader) (func() string, func() []byte) {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	f1 := func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
	f2 := func() []byte {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Bytes()
	}
	return f1, f2
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func sum(a []int) int {
	var ret int
	for i := range a {
		ret += a[i]
	}
	return ret
}

func sumFloat64(a []float64) float64 {
	var ret float64
	for i := range a {
		ret += a[i]
	}
	return ret
}

func gcd(m, n int) int {
	for m%n != 0 {
		m, n = n, m%n
	}
	return n
}

func lcm(m, n int) int {
	return m / gcd(m, n) * n
}


Measured memory_bytes: 2032
#include <iostream>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using z=long long;
int main(){z N,Q;cin>>N>>Q;fenwick_tree<z> b(N);for(z i=0;i<N;i++){z a;cin>>a;b.add(i,a);}for(z i=0;i<Q;i++){z w,e,r;cin>>w>>e>>r;if(w)cout<<b.sum(e,r)<<"\n";else b.add(e,r);}}

Measured memory_bytes: 8212
a,b,c,x,y = list(map(int,input().split()))

d = abs(x-y)
count=0
if (a+b) >= 2*c:
    count += 2*c*min(x,y)
else:
    count += (a+b)*min(x,y)

if x>=y:
    if a >= 2*c:
        count += 2*c*d
    else:
        count += a*d
else:
    if b >= 2*c:
        count += 2*c*d
    else:
        count += b*d

print(count)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
//#define inf 0x3f3f3f3f3f3f3f3f
#define inf 0x3f3f3f3f
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define inv(x) Power(x, mod - 2)
#define fi first
#define se second
#define MP make_pair
#define PB push_back

using namespace std;
typedef pair<int,int> Pair;
typedef long double ld;
typedef long long ll;

const int mod = 998244353, MAX = 1e5, N = 50005;
//template{{{
const long double Pi = 3.14159265358979323846l;
inline int add(int x, int y) { x += y; return x >= mod ? x - mod : x; };
inline void inc(int &x, int y) { x += y; x -= (x >= mod ? mod : 0); }
inline int mul(int x, int y) { return 1ll * x * y % mod; }
inline int Power(int x, int y) {
	int ans = 1;
	while (y) {
		if (y & 1) ans = mul(ans, x);
		x = mul(x, x), y >>= 1;
	} return ans;
}

/*char buf[1<<23],obuf[1<<23],*p1=buf,*p2=buf, *O = obuf;
#define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)
void print(int x) {
    if(x > 9) print(x / 10);
    *O++=x%10+'0';
} */

template <class T> inline T	input() {
	T x; char ch; bool flag = false;
	while (!isdigit(ch = getchar())) flag |= ch == '-';
	for (x = ch ^ 48; isdigit(ch = getchar()); x = x * 10 + (ch ^ 48));
	return flag ? -x : x;
}

template <class T> inline bool chkmin(T &x, T y) { x = x < y ? x : y; return x == y; }
template <class T> inline bool chkmax(T &x, T y) { x = x > y ? x : y; return x == y; }
template <class T> inline T gcd(T x, T y) { return !y ? x : gcd(y, x % y); }
template <class T> inline T sqrm(T x) { return (ll) x * x % mod; }
template <class T> inline T sqr(T x) { return x * x; }

struct {
	inline operator int () { return input<int>(); }
	inline operator long long () { return input<long long>(); }
	template <class T> inline void operator () (T &x) { x = *this; }
	template<class T, class ...A> inline void operator () (T &x, A &...a)
	{ x = *this; this -> operator ()(a...); }
} read; //}}}

long long A, B, n;

int main() {
#ifdef local
	freopen("in", "r", stdin);
	freopen("out", "w", stdout);
	freopen("log", "w", stderr);
#endif

	cin >> A >> B >> n;
	long long x = min(B - 1, n);
	cout << (A * x / B) - A * (x / B) << endl;
	return 0;
}


Measured memory_bytes: 3636
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<set>
#include<iomanip>
#define rep(i, a, n) for(int i = a; i < n; i++)
using namespace std;
int main(){
  int a, b, h;
  cin >> a >> b >> h;
  int s = (a + b) * h / 2;
  cout << s;
}

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

#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define ALL(v) v.begin(), v.end()
#define SZ(x) ((ll)(x).size())

const double PI  = acos(-1.0);
const double EPS = 1e-9;
const ll INF = 1e9+10;
const ll MOD = 998244353;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
#define print(x) cerr << #x << " is " << x << endl;

//ax + by = gcd(a, b) �𖞂��� x, y ��Ԃ�
ll extgcd (ll a, ll b, ll& x, ll& y){
    ll d = a;
    if (b != 0){
        d = extgcd(b, a % b, y, x);
        y -= (a/b) * x;
    } else {
        x = 1; y = 0;
    }
    return d;
}

// ax == 1 (mod m)�𖞂��� x
ll mod_inverse(ll a, ll m){
    ll x, y;
    extgcd(a, m, x, y);
    return (m + x % m) % m;
}

//#define print(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl; 
ll dp[3005][3005];
int main() {
    int N, S;
    int A[3005];
    cin >> N >> S;
    rep(i, N)cin >> A[i];
    dp[0][0] = 1;
    rep(i, N){
        (dp[0][0] *= 2 ) %= MOD;
    }
    
    rep(i, N)rep(s, S + 1){
        (dp[i + 1][s] += dp[i][s]) %= MOD;
        if (s + A[i] <= S){
            ll tmp = dp[i][s] * mod_inverse(2, MOD);
            (dp[i + 1][s + A[i]] += tmp) %=MOD;
            // ax == 1 (mod m)�𖞂��� x
            //(dp[i + 1][s + A[i]] += dp[i][s]/2) %=MOD;
        }
            
    }
    
    
    cout << dp[N][S];
        
    return 0;
}


Measured memory_bytes: 74040
import collections
N,K = map(int, input().split())
lst = list(map(int, input().split()))
c = dict(collections.Counter(lst))
sorted_c = sorted(c.items(), key=lambda x:x[1], reverse=True)
ans = 0
if (len(sorted_c) > K):
  for i in sorted_c[K:]:
    ans += i[1]
print(ans)

Measured memory_bytes: 115656
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
// #include<C:\Users\J\Desktop\AC\athead.h>
#define showa(v) for(int iii = 0; iii < v.size(); iii++){ cout << v[iii] << " ";} cout << endl;
#define show(iiii) cout << iiii << endl; 
#define shows(iiiii) cout << iiiii << " ";
#include<iostream>
#include<string>
#include<vector>
// #include<stdio.h>
#include <cmath>
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <set>
#include <deque>
#include <numeric>
#include<tuple>
#include <utility>
#include <map>
#include <cassert>
#include<unordered_set>
using namespace std;


int main(){
    int n;
    cin >> n;
    vector<long long int> a(n+1);
    rep(i,n+1){
        a[i] = 2*i;
    }
    for(int i=2; i<=(n/2)+1; i++){
        int k=i+i;
        while(k < n+1){
            a[k] += k;
            k = k+i;
        }
    }
    long long  int ret=0;
    for(int i=1; i<n+1; i++){
        ret += a[i];        
    }
    cout << ret-1 << endl;
}

Measured memory_bytes: 81396
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,k,s;scanf("%d%d%d",&n,&k,&s);
	if(s==1e9){
		for(int i=0;i<k;i++)printf("%d ",s);
		for(int i=k;i<n;i++)printf("%d ",s-1);
		return 0;
	}
	for(int i=0;i<k;i++)printf("%d ",s);
	for(int i=k;i<n;i++)printf("%d ",s+1);
	return 0;
} 

Measured memory_bytes: 1280
const main = (input) => {
  var inputs = input.trim().split(" ");
  var N = Number(inputs[0]), K=Number(inputs[1]);
  var ans = 0;
  var t = Math.log2(K);
  for(var i=N;i>0;i--){
    if(Math.ceil(t-Math.log2(i)) > 0)
      ans += Math.pow(0.5, Math.ceil(t-Math.log2(i)));
    else
      ans += 1;
  }
  console.log(ans/N);
}

main(require('fs').readFileSync('/dev/stdin', 'UTF-8'));


Measured memory_bytes: 10252
import itertools
import math
import numpy as np
import fractions
from collections import deque
from itertools import combinations
from functools import reduce
from functools import lru_cache
import sys
sys.setrecursionlimit(10**9)

def main():
    N, X, Y = map(int,input().split())

    ans = [0] * N
    for i in range(N):
        for j in range(i+1,N):
            k = min(abs(j-i),abs(X-i-1)+abs(Y-j-1)+1)
            # print(i,j,k)
            ans[k] += 1


    for k in range(1,N):
        print(ans[k])

    # print(ans)

if __name__ == "__main__":
  main()


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

using namespace std;

#define int long long
#define INT int
#define MOD 1000000007

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()
#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
template <typename T>
void print(T x)
{
    std::cout << x << '\n';
}
typedef long long ll;

signed main()
{
    string s, t;
    cin >> s >> t;

    if ((s.substr(0, s.size())) == t.substr(0, t.size() - 1))
    {

        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 3620
#include <stdio.h>

int main()
{
	int A, B;
	int count = 0;
	
	scanf("%d %d",&A,&B);
	for(int i=A; i<=B; i++){
		int a, b, c, d;
		
		a = i/10000;
		b = (i - a*10000)/1000;
		d = i%10;
		c = i%100/10;
		if(a == d && b == c) count++;
	}
		printf("%d",count);
		
		return 0;
	}

Measured memory_bytes: 128
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>

using namespace std;

int main(){

	int height,width,tmp;
	scanf("%d %d",&height,&width);

	int** table = new int*[height+1];
	table[0] = new int[width+1];
	for(int i=0; i < width+1; i++)table[0][i] = 0;

	int max_r = 0;

	for(int i=1; i <= height; i++){
		table[i] = new int[width+1];
		table[i][0] = 0;
		for(int k=1; k <= width; k++){
			scanf("%d",&tmp);
			table[i][k] = 1-tmp;
			if(tmp != 1){
				table[i][k] = min(table[i-1][k-1],min(table[i][k-1],table[i-1][k]))+1;
				max_r = max(max_r,table[i][k]);

			}

		}
	}

	printf("%d\n",max_r*max_r);

    return 0;
}



Measured memory_bytes: 10444
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
int a[1005][1005];
int main(){
    string s,t,u;
    int a,b;
    cin>>s>>t>>a>>b>>u;
    if(u==s)cout<<a-1<<" "<<b;
    else cout<<a<<" "<<b-1;

    return 0;
}


Measured memory_bytes: 256
import java.util.*;
 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long x = Long.parseLong(sc.next());
        long k = Long.parseLong(sc.next());
        long d = Long.parseLong(sc.next());
        long ans = 0;
        if(x < 0) {
            x = -x;
        }
        ans = x % d;
        if((k - x/d) < 0) {
            ans = x - d*k;
        }else if((k - x / d) % 2 == 1) {
            ans -= d;
        }
        
        if(ans < 0) ans = -ans;  
        System.out.println(ans);  
    }
}

Measured memory_bytes: 35436
#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
// #include<vor>
using namespace std;
typedef long long int ll;
#define pb push_back
ll mod = 1e9+7;

ll powm(ll a , ll b , ll mod)
{
  ll res = 1;
  while(b)
  {
    if(b & 1)
    res = (res *a)%mod;
    a = (a*a)%mod;
    b>>1;
  }
  return res;
}
ll gcd(ll a , ll b);
ll power(ll x , ll y , ll m);

ll modInverse(ll a , ll m)
{
  ll g = gcd(a,m);
  if(g != 1)
  return 1;
  else
  return power(a,m-2,m);

}

ll power(ll x , ll y , ll m)
{
  if(y == 0)
  return 1;
  ll p = power(x , y/2 , m)%m;
  p = (p*p)%m;

  return (y%2 == 0) ? p : (x *p) % m;
}

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

vector<int>adj[1000001] , ans;
int dis[1000001] , cnt[1000001];
bool vis[1000001];



int freq[1000001];
void solve()
{
    int n;
    cin>>n;
    int a[n] , freq[n+1] = {0};
    for(int i = 1 ; i<n;i++)
    {
      cin>>a[i];
      freq[a[i]]++;
    }
    for(int i = 1;i<=n;i++)
    cout<<freq[i]<<"\n";

}

int main()
{
  int tc;
  // cin>>tc;
  tc = 1;
  while(tc--)
  {
    solve();
  }
}


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

using namespace std;

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

typedef long long ll;

const int Inf = 1e9;
const double EPS = 1e-9;

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

int lcm(int a, int b) {
    return a * b / gcd(a, b);
}

int bitCount(long bits) {
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
    return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    n *= 2;
    vector<int> a(n);
    rep (i, n) cin >> a[i];
    sort(a.begin(), a.end()); 
    int ans = 0;
    for (int i = 0; i < n; i += 2) {
        ans += min(a[i], a[i + 1]);
    }
    cout << ans << endl;

    return 0;
}



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

#define int long long

#define inf (int)1000000007
#define mod (int)1000000007

#define rep(i, n) for(int i = 0; i < (n); i++)
#define trep(i, n) for(int i = 0; i <= (n); i++)
#define rrep(i, n) for(int i = (n) - 1; i >= 0; i--)
#define rtrep(i, n) for(int i = (n); i >= 0; i--)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define mfor(i, s, t) for(int i = (s); i < (t); i++)
#define tfor(i, s, t) for(int i = (s); i <= (t); i++)
#define rfor(i, s, t) for(int i = (t) - 1; i >= (s); i--)

string ds;

int dp[514514][27];

int solve(int p, int m) {
	if(dp[p][m] < -1) {
		int w = ds[p] - 'a';
		if(m == 26) {
			int now = p;
			bool ok = true;
			mfor(i, w, 26) {
				if(now >= ds.size() - 1) {
					dp[p][m] = -1;
					ok = false;
					break;
				}
				int t = solve(now + 1, i);
				if(t < 0) {
					dp[p][m] = -1;
					ok = false;
					break;
				}
				now = t;
			}
			if(ok) {
				dp[p][m] = now;
			}
		}
		else if(w == m) {
			dp[p][m] = p;
		}
		else if(w < m) {
			int t = solve(p, m - 1);
			if(t < 0 || t == ds.size() - 1) {
				dp[p][m] = -1;
			}
			else {
				int u = solve(t + 1, m - 1);
				if(u < 0) {
					dp[p][m] = -1;
				}
				else {
					dp[p][m] = u;
				}
			}
		}
		else {
			int t = solve(p, 26);
			if(t < 0 || t == ds.size() - 1) {
				dp[p][m] = -1;
			}
			else {
				int u = solve(t + 1, m);
				if(u < 0) {
					dp[p][m] = -1;
				}
				else {
					dp[p][m] = u;
				}
			}
		}
	}
	return dp[p][m];
}

bool trw[514514];
vector<int> tree[514514];

vector<pair<int, int>> ddq[514514];

bool ns[514514];
bool ans[114514];

void solve2(int p) {
	for(auto i : ddq[p]) {
		if(ns[i.first]) {
			ans[i.second] = true;
		}
		else {
			ans[i.second] = false;
		}
	}
	ns[p] = true;
	for(auto i : tree[p]) {
		solve2(i);
	}
	ns[p] = false;
}

signed main() {
	cin >> ds;
	int dn = ds.size();
	rep(i, dn) {
		rep(j, 27) {
			dp[i][j] = -2;
		}
	}
	rrep(i, dn) {
		rep(j, 27) {
			solve(i, j);
		}
	}
	trep(i, dn) {
		trw[i] = false;
		ns[i] = false;
	}
	rep(i, dn) {
		if(!trw[i]) {
			int a = i;
			while(a < dn && solve(a, 26) > 0 && !trw[a]) {
				trw[a] = true;
				tree[solve(a, 26) + 1].push_back(a);
				a = solve(a, 26) + 1;
			}
		}
	}
	int dq;
	cin >> dq;
	rep(i, dq) {
		int l, r;
		cin >> l >> r;
		l--;
		ddq[l].push_back(make_pair(r, i));
	}
	trep(i, dn) {
		if(!trw[i]) {
			solve2(i);
		}
	}
	rep(i, dq) {
		if(ans[i]) {
			cout << "Yes" << endl;
		}
		else {
			cout << "No" << endl;
		}
	}
}


Measured memory_bytes: 158596
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n,m;
    cin >> n >> m;
    vector<int> v;
    for(int i = 0;i < n;i++)
    {
        int k;
        cin >> k;
        for(int j = 0;j < k;j++)
        {
            int x;
            cin >> x;
            v.push_back(x);
        }
    }
    sort(v.begin(),v.end());
    int ans = 0;
    for(int i = 0;i < v.size();i++)
    {
        int count = 0;
        for(int j = i + 1;j < v.size();j++)
        {
            if(v.at(i) == v.at(j))
            {
                count++;
            }
            else
            {
                i = j - 1;
                break;
            }
        }
        if(count == n - 1)
        {
            ans++;
        }
    }
    cout << ans;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
using ll = long long;
using P = pair<int, int>;
#include<algorithm>
#include<math.h>
#include<map>
#include<queue>
#include<cstring>

int main() {
	string s;
	cin >> s;
	ll dp[13] = {};
	ll n = s.size();
	//cout << n;
	int mul = 1;
	ll mod = 1000000007;
	dp[0] = 1;
	for (int i = n - 1; i >= 0; --i) {
		ll ndp[13] = {};
		char c = s[i];
		if (c == '?') {
			for (int k = 0; k < 10; ++k) {
				for (int j = 0; j < 13; ++j) {
					ndp[(k * mul + j) % 13] += dp[j];//k*mulの余りだけ、dp[j]を平行移動する
					ndp[(k * mul + j) % 13] %= mod;
				}
			}
		}
		else {
			int k = (int)(s[i] - '0');
			//cout << k;
			for (int j = 0; j < 13; ++j) {
				ndp[(k * mul + j) % 13] += dp[j];//k*mulの余りだけ、dp[j]を平行移動する
				ndp[(k * mul + j) % 13] %= mod;
			}
		}
		mul *= 10;
		mul %= 13;
		//cout << endl;
		memcpy(dp, ndp, sizeof(dp));
		/*rep(i, 13) {
			cout << dp[i]<<" ";
		}
		cout << endl;
		*/
	}
	cout << dp[5];
	return 0;
}

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

using ll=long long;

int in(){
  int a;
  cin >> a;
  return a;
}//int型関数の受け取り

void forin(int* x,int y){
  for (int i=0;i<y;i++){
    cin >> x[i];
  }
}//(x,y) int型配列x[y]の受け取り

int fact(int x){
  if (x == 1) return 1;
  return x*fact(x-1);
}//(x) x!

int div1(ll x){
  return x%1000000007;
}

main(){
    int n=in(),dp[n+1];
    for (int i=0;i<n+1;i++) dp[i]=INT_MAX;
    dp[0]=0;
    for (int i=1;i<n+1;i++){
        dp[i]=min(dp[i],dp[i-1]+1);
        int x=6;
        while(i-x>=0){
            dp[i]=min(dp[i],dp[i-x]+1);
            x*=6;
        }
        x=9;
        while(i-x>=0){
            dp[i]=min(dp[i],dp[i-x]+1);
            x*=9;
        }
    }
    cout << dp[n] << endl;
}

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

using i64 = long long;
using P = pair<i64, i64>;

#define overload3(_1, _2, _3, name, ...) name
#define rep1(i, n) for(i64 i = 0LL; i < (n); ++i)
#define rep2(i, a, b) for(i64 i = (a); i < (b); ++i)
#define rep(...) overload3(__VA_ARGS__, rep2, rep1)(__VA_ARGS__)
#define all(v) v.begin(), v.end()


void solve(long long A, long double B){
    printf("%.0Lf\n", floor(A * B));
}

struct IoSetup {
    IoSetup() {
        // cin.tie(nullptr);
        // ios::sync_with_stdio(false);
        cout << fixed << setprecision(10);
        cerr << fixed << setprecision(10);
    }
} iosetup;

int main(){
    long long A;
    scanf("%lld",&A);
    long double B;
    scanf("%Lf",&B);
    solve(A, B);
    return 0;
}


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

using namespace std;
using ll = long long;
using ld = long double;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define reps(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
const ll mod = 1e9 + 7;
const int INF = 1e9;

int main() {
	cin.sync_with_stdio(false);
	int N;
	cin >> N;
	set<int>ans;
	rep(i, N) {
		int a;
		cin >> a;
		if (ans.count(a))ans.erase(a);
		else ans.insert(a);
	}
	cout << ans.size() << endl;
	return 0;
}

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

void solve(long long A, long long B, long long C)
{
    vector<int> a(0);
    a.push_back(A);
    a.push_back(B);
    a.push_back(C);
    sort(a.begin(), a.end());

    cout << a[2] * 10 + a[1] + a[0] << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main()
{
    long long A;
    scanf("%lld", &A);
    long long B;
    scanf("%lld", &B);
    long long C;
    scanf("%lld", &C);
    solve(A, B, C);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
string s;
int a,b,c,sum=0;
int main(){
    scanf("%d %d",&a,&b);
    for(int i=1;i<=a*b;i++){
        cin>>s;sum++;
        if(s=="snuke")break;
    }
    c=sum%b==0?b:sum%b;
    printf("%c%.0lf\n",64+c,ceil((sum+0.00)/b));
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<=int(b);++i)
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
int INF=numeric_limits<int>::max();
// for(int j=0;j<N;++j) {

int main(void) {
  int n;cin>>n;
  ll a[n+10];
  ll MOD=pow(10,9)+7;
  rep(i,0,n-1) {
    cin>>a[i];
  }

  ll ans = 0;

  ll two_digit = 1;
  rep(d,0,60) {
    ll one_cnt=0;
    ll zero_cnt=0;
    rep(i,0,n-1) {
      if(a[i] & (1LL << d)) one_cnt++;
      else zero_cnt++;
    }
    ll add = ((one_cnt * zero_cnt) % MOD) * two_digit % MOD;
    ans = (ans + add) % MOD;
    two_digit = (two_digit * 2) % MOD;
  }

  pr(ans);

  return 0;
}


Measured memory_bytes: 2560
let i=readLine()!.characters.split(" ").map{Int(String($0))!},N=i[0],M=i[1],K=i[2]
var ans="No"
for i in 0...N {
  for j in 0...M {
    if (N-i)*j+(M-j)*i==K {
      ans="Yes"
    }
  }
}
print(ans)

Measured memory_bytes: 4080
#include <iostream>

int main() {
  size_t R;
  std::cin >> R;

  if (R < 1200)
    std::cout << "ABC" << std::endl;
  else if (R < 2800)
    std::cout << "ARC" << std::endl;
  else
    std::cout << "AGC" << std::endl;

  return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <fstream>
#include <vector>
#include <queue>
#include <string>
#include <limits>

using namespace std;
int main()
{
  string s;
  cin >> s;
  bool ret = true;
  ret &= s[0] == 'A';
  bool hasC = false;
  for (auto i = 2; i < s.size()-1; i++) if (s[i] == 'C') hasC = true;
  ret &= hasC;
  hasC = false;
  for (auto i = 1; i < s.size(); i++) {
    if ('a' <= s[i] && s[i] <= 'z');
    else if (!hasC) hasC = true;
    else ret =false;
  }
  std::cout << (ret? "AC" : "WA") << std::endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int reach [10000001];
int main (){
        int n ; 
        cin>>n;long long int sum=1;
        for(int i =2;i<=n;i++){
                for(int j =i;j<=n;j+=i){
                        reach[j]++;
                }sum+=1ll*i*(reach[i]+1);
        }cout<<sum;
   }//838627288460105

Measured memory_bytes: 42608
#include<iostream>
#include<algorithm>
#include<vector>
#include<stdio.h>
#include<complex>
using namespace std;

int main(){
  double a,b,c,d; cin >> a >> b >> c >> d;
  double aa = abs(a-c), bb = abs(b-d);
  aa *= aa; bb *= bb;
  double ans = sqrt(aa + bb);
  printf("%.10f\n", ans);
  return 0;
}



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

#define rep(i,n) for(i = 0;i < n;++i)
#define all(v) v.begin(), v.end()
using ll = long long;

int main()
{
    ll i,j;
    ll n;
    cin >> n;
    if(n == 3){
        cout << 2 << " " << 5 << " " << 63 << endl;
        return 0;
    }else if(n == 4){
        cout << 2 << " " << 5 << " " << 20 << " " << 63 << endl;
        return 0;
    }else if(n == 6){
        cout << 2 << " " << 3 << " " << 4 << endl;
        cout << 8 << " " << 9 << " " << 10 << endl;
        return 0;
    }
    for(i = 0;8*(i+1) <= n;++i){
        rep(j,2){
            cout << 12*i + 6*j + 2 << endl;
            cout << 12*i + 6*j + 3 << endl;
            cout << 12*i + 6*j + 4 << endl;
            cout << 12*i + 6*j + 6 << endl;
        }
    }
    ll spare = n - 8*i;
    if(spare == 1){
        cout << 12*i + 6 << endl;
    }else if(spare == 2){
        cout << 12*i + 2 << endl;
        cout << 12*i + 4 << endl;
    }else if(spare == 3){
        cout << 12*i + 2 << endl;
        cout << 12*i + 4 << endl;
        cout << 12*i + 6 << endl;
    }else if(spare == 4){
        cout << 12*i + 2 << endl;
        cout << 12*i + 3 << endl;
        cout << 12*i + 4 << endl;
        cout << 12*i + 9 << endl;
    }else if(spare == 5){
        cout << 12*i + 2 << endl;
        cout << 12*i + 3 << endl;
        cout << 12*i + 4 << endl;
        cout << 12*i + 6 << endl;
        cout << 12*i + 9 << endl;
    }else if(spare == 6){
        cout << 12*i + 2 << endl;
        cout << 12*i + 3 << endl;
        cout << 12*i + 4 << endl;
        cout << 12*i + 6 << endl;
        cout << 12*i + 9 << endl;
        cout << 12*i + 12 << endl;
    }else if(spare == 7){
        cout << 12*i + 2 << endl;
        cout << 12*i + 3 << endl;
        cout << 12*i + 4 << endl;
        cout << 12*i + 6 << endl;
        cout << 12*i + 8 << endl;
        cout << 12*i + 9 << endl;
        cout << 12*i + 10 << endl;
    }

    return 0;
}

Measured memory_bytes: 3636
def fu(a,b):
  l=len(a)
  b=str(b)
  x=0;k=int(b[1:])-int(a[1:])
  if l<len(b) or a[0]<b[0]:
    return 10**(l-2)
  return (int('0'+b[1:l-1])+1-int(a[-1]>b[-1]))*(a[0]==b[0])

n = int(input())
b=str(n)
p = len(str(n))
x=min(9,n)
for i in range(10,n+1):
  l = len(str(i))
  k = str(i)[::-1]
  if k[0]!='0':
    x += fu(k,n)
    x += 2*(int('1'*max(l-2,1))+int(k[0]==k[-1])) if l>2 else 2*int(k[0]==k[-1])
print(x)

Measured memory_bytes: 3064
n,a,b,c,d = map(int,input().split())
s = input()
if d<c:
    if "##" not in s[a-1:d] and '...' in s[b-2:d+1]:
        print('Yes')
    else:
        print('No')
    
else:
    if "##" not in s[a-1:d]:
        print('Yes')
    else:
        print('No')


Measured memory_bytes: 3572
n=int(input())
s=input()
if(n%2!=0):
    print("No")
else:
    flag=1
    for i in range(0,int(n/2)):
        if(s[i]!=s[i+int(n/2)]):
            flag=0
    if(flag==1):
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 3060
class Node:
    def __init__(self, v):
        self.v = v
        self.p = None
        self.n = None

class LinkedList:
    def __init__(self, v):
        self.head = Node(v)
        self.tail = self.head
        self.d = 1

    def reverse(self):
        self.d = self.d * -1

    def insertTail(self, v):
        node = Node(v)
        if self.d == 1:
            self.tail.n = node
            node.p = self.tail
            self.tail = node
        else:
            self.head.p = node
            node.n = self.head
            self.head = node

    def insertHead(self, v):
        self.reverse()
        self.insertTail(v)
        self.reverse()

    def toString(self):
        res = ""
        if self.d == 1:
            pos = self.head
            while pos != None:
                res = res + pos.v
                pos = pos.n
        else:
            pos = self.tail
            while pos != None:
                res = res + pos.v
                pos = pos.p
        return res

S = input()
Q = int(input())

l = LinkedList(S[0])
for i in range(1,len(S)):
    l.insertTail(S[i])

for _ in range(Q):
    query = input()
    if query[0] == "1":
        l.reverse()
    else:
        T,F,C = query.split()
        if F=="1":
            l.insertHead(C)
        else:
            l.insertTail(C)
print(l.toString())


Measured memory_bytes: 53912
#include <bits/stdc++.h>
#include <chrono>
#include <regex>
using namespace std;
#define len(_x) (sizeof((_x)) / sizeof(_x)[0])
#define ll long long
#define fastIO  ios_base::sync_with_stdio(false); cin.tie(0); 
#define Ichar(_x) char _x;scanf("%c",&_x);
#define Iint(_x) int _x;scanf("%d",&_x); 
#define Ill(_x)  ll _x;scanf("%lld",&_x);
#define inc(a,b,x)(x)>a && (x)<b	
#define incE(a,b,x)(x)>=a && (x)<=b	
#define fileIO 	freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);


ll modo(ll a)
{
	return a % (int)(1e9+7);
}




int main()
{
	Iint(a1);
	Iint(a2);
	Iint(a3);
	Iint(a4);
	std::cout << (min(a1,a2)+min(a3,a4));

	return 0;

}





Measured memory_bytes: 256