akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <bits/stdc++.h>

using namespace std;


int main(void){
    int n, m;
    cin >> n >> m;
    
    vector<vector<int>> check(100010, vector<int>(2, 0));
    
    for(int i = 0; i < m; i++){
        int p;
        cin >> p;
        p--; //0-indexed
        
        string s;
        cin >> s;
        
        if(s == "WA"){
            if(check[p][0] == 0) check[p][1]++;
            else continue;
        }
        else{
            check[p][0] = 1;
        }
    }
    
    int number_of_ac = 0;
    int number_of_wa = 0;
    
    for(int i = 0; i < n; i++){
        if(check[i][0] == 0) continue;
        else{
            number_of_ac++;
            number_of_wa += check[i][1];
        }
    }
    
    cout << number_of_ac << " " <<  number_of_wa << endl;
    
}


Measured memory_bytes: 5760
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

ll f(ll n){
    return n*n*n*n*n;
}

int main(void)
{
    ll X;
    cin >> X;
    for(ll i=-300ll;i<300ll;i++){
        for(ll j=-300ll;j<300ll;j++){
            if(f(i) - f(j)==X){
                cout << i << " " << j << endl;
                return 0;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 3620
#include <iostream>
#include <algorithm>
using namespace std;
int a[101];

bool cmp(int x,int y)
{
	return x>y;
}

int main()
{
	int n;
	while(cin>>n){
		for(int i=0;i<n;i++){
			cin>>a[i];
		}
		sort(a,a+n,cmp);
		int sum1=0,sum2=0;
		for(int i=0;i<n;i++){
			if(i%2==0) sum1+=a[i];
			else sum2+=a[i];
		}
		cout<<sum1-sum2<<endl;
	}	
	return 0;
}


Measured memory_bytes: 256
/*
これを入れて実行
g++ code.cpp
./a.out
 */
 
#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <cstring>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
#include <bitset>
#include <functional>
#include <cassert>
#include <random>

#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
using namespace std;
typedef long long ll;
typedef long double ld;
 
int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
 
const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;
 
bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}
 
ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}
 
ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}

ll conbinationMemo[100][100];

void cmemoInit(){
    rep(i, 100){
        rep(j, 100){
            conbinationMemo[i][j] = -1;
        }
    }
}
 
ll nCr(ll n, ll r){
    if(conbinationMemo[n][r] != -1) return conbinationMemo[n][r];
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return conbinationMemo[n][r] = (nCr(n - 1, r) + nCr(n - 1, r - 1));
}
 
ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
//-----------------------ここから-----------
#include <atcoder/all>
int main(void){
    ll n, q;
    cin >> n >> q;
    atcoder::dsu uf(n);
    rep(i, q){
        ll t, a, b;
        cin >> t >> a >> b;
        if(t == 0){
            uf.merge(a, b);
        } else {
            cout << uf.same(a, b) << endl;
        }
    }
}



Measured memory_bytes: 3944
#include <iostream>
#include <string>
#include <fstream>
#include <vector>
#include <algorithm>
#include <utility>
#include <set>
#include <queue>
#include <map>
#include <cmath>
#include <numeric>
#include <tuple>
#include <iomanip>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

const long long mod = 1e9 + 7;


int main() {
    

    
    ll n, k;
    cin >> n >> k;
    
    vector<double> p(n);
    
    for (int i = 0; i < n; ++i)
    {
        cin >> p[i];
    }
    
    double ret = 0;
    
    for (int i = 0; i < k; ++i)
    {
        ret += ((1.0 + p[i]) / 2.0);
    }
    
    double next = ret;
    for (int i = k; i < n; ++i)
    {
        next = next + ((1.0 + p[i]) / 2.0) - ((1.0 + p[i - k]) / 2.0);
        ret = max(ret, next);
    }
    

    cout << fixed << setprecision(10) << ret << endl;
    
    return 0;
}

Measured memory_bytes: 1792
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.*;
public class Main{
	static long mod=1000000007;
	static int ans=0;
	static char[][] arr;
	static int n;
	static int m;
	static int rem;
	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		String[] cmd=br.readLine().split(" ");
		n=Integer.valueOf(cmd[0]);
		m=Integer.valueOf(cmd[1]);
		int k=Integer.valueOf(cmd[2]);
		arr=new char[n][m];
		for(int i=0;i<n;i++)
		{
			String s=br.readLine();
			for(int j=0;j<m;j++)
			{
				arr[i][j]=s.charAt(j);
			}
		}
		int cnt=0;
		int[] row=new int[n];
		int[] col=new int[m];
		for(int i=0;i<n;i++)
		{
			for(int j=0;j<m;j++)
			{
				if(arr[i][j]=='#')
				{	
					cnt++;
					row[i]++;
					col[j]++;
				}
			}
		}
		rem=cnt-k;
		ans=0;
//			System.out.println(ans);
			for(int i=0;i<=Math.pow(2, n)-1;i++)
			{
				int x=0;
				int y=0;
				for(int j=0;j<n;j++)
				{
					if((i&(1<<j))!=0)
						y=y+row[j];
				}
				for(int j=0;j<=Math.pow(2, m)-1;j++)
				{
					x=y;
					for(int l=0;l<m;l++)
					{
						if((j&(1<<l))!=0)
							x=x+col[l];
					}
					for(int l=0;l<n;l++)
					{
						if((i&(1<<l))!=0)
						{
						for(int a=0;a<m;a++)
						{
							if((j&(1<<a))!=0)
							{
								if(arr[l][a]=='#')
									x--;
							}
						}}
					}
					if(x==rem)
					{
//						System.out.println(i+" "+j);
						ans++;
					}
				}
			}
		System.out.println(ans);
	}
}


Measured memory_bytes: 33312
n,m=[int(i) for i in input().split()]

s=set()
for i in range(m):
    s.add(i+1)


for i in range(n):
    a= [int(j) for j in input().split()]
    a.pop(0)
    a=set(a)
    s=s & a

print(len(s))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define REPZ(i, z, n) for(decltype(n) i = (z); i < (n); i++)
#define rep(i, n) for(decltype(n) i = 0; i < (n); i++)
#define ALL(v) v.begin(), v.end()
#define SIZE(v) ((ll)(v).size())
#define MAX(v) (*max_element(all(v)))
#define MIN(v) (*min_element(all(v)))
#define INF 1000000000000 //1E+12
#define MOD 1000000007    //合同式の法

// 略
#define PB push_back
#define F first
#define S second
#define MP make_pair
#define READ cin >>
#define PRINT cout <<

typedef long long ll;
typedef unsigned long long ul;
// 1s間で可能なループ回数2E+8回
// intの最大値2147483647~2E+9
// long longの最大値9223372036854775807〜9E+18
// 総和accumulate
// 単純リストvector<> push_back
// 連想配列map<key,value> insert,
// pair キーとバリューを格納 firstとsecondでアクセス
// 小数点指定 setprecision()
// to_string<->stoi
// stoll(longlong)
// stod(double)
// 大文字65-90(-32)
// 小文字97-122(+32)
using namespace std;
int main(){
  // faster
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  string s; cin >> s;
  int q; cin >> q;
  vector<char> l,r;
  bool parity = false;
  rep(i, q){
    int mode; cin >> mode;
    if(mode==1){
      parity = !parity; 
    }else{
      int b_e;char c; cin >> b_e >> c;
      bool lr = (b_e==1);
      if(parity){
        // RL
        if(lr) r.push_back(c);
        else l.push_back(c);
      }else{
        if(!lr) r.push_back(c);
        else l.push_back(c);
      }
    }
  }
  if(parity){
      reverse(ALL(r)); reverse(ALL(s));
  }
  else reverse(ALL(l));
  
  if(parity) for(char i:r) cout << i;
  else for(char i:l) cout << i;
  cout << s;
  if(parity) for(char i:l) cout << i;
  else for(char i:r) cout << i;
  cout << endl;
  return 0;
}


Measured memory_bytes: 976
using System;
using System.Collections.Generic;
using System.Linq;

namespace ABC
{
    class Program
    {
        static void Main(string[] args)
        {
            ABC124_A();
        }

        static void ABC124_A()
        {
            var AB = Console.ReadLine().Split(' ').Select(int.Parse).ToList();
            if (AB[0] == AB[1])
            {
                Console.WriteLine(AB[0] + AB[1]);
                return;
            }
            var a = AB[0] > AB[1] ? AB[0] : AB[1];
            Console.WriteLine(a + (a-1));
        }
    }
}

Measured memory_bytes: 13268
#include <cstdio>
#include <algorithm>
using namespace std;
struct node
{
 int num,t;
}t1[100005],t2[100005];
int a[100005],n;
bool cmp(const node&a,const node&b)
{
 return a.t>b.t;
}
int main()
{
 scanf("%d",&n);
 for(int i=1;i<=100000;i++)
  t1[i].num=t2[i].num=i;
 for(int i=1;i<=n;i++)
 {
  scanf("%d",&a[i]);
  if(i%2)t1[a[i]].t++;
  else t2[a[i]].t++;
 }
 sort(t1+1,t1+100001,cmp);
 sort(t2+1,t2+100001,cmp);
 if(t1[1].num!=t2[1].num)printf("%d",(n/2-t1[1].t)+(n/2-t2[1].t));
 else printf("%d",min((n/2-t1[1].t)+(n/2-t2[2].t),(n/2-t1[2].t)+(n/2-t2[1].t)));
 return 0;
}

Measured memory_bytes: 2176
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>
#include <iomanip>
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
const ll MOD=1000000007;
const ll MAX_N=500010;
const ll INF=999999999999;

int main(){
    int n;
    cin>>n;
    vector<int> c(n),s(n),f(n);
    for(int i=0;i<n-1;i++){
        cin>>c[i]>>s[i]>>f[i];
    }
    vector<int> ans(n);
    for(int i=0;i<n-1;i++){
        for(int j=i;j<n-1;j++){
            if(ans[i]<=s[j]){
                ans[i]=s[j]+c[j];
            }else{
                int buf=ans[i];
                ans[i]=((ans[i]-s[j])/f[j]+1)*f[j]+s[j]+c[j];
                if((buf-s[j])%f[j]==0) ans[i]-=f[j];
            }
        }
    }
    for(int i=0;i<n;i++){
        cout<<ans[i]<<endl;
    }
}

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

int big(int a,int b){
  if (a>b){
    return a;
  }else{
    return b;
  }
}
int main(){
  int A,B,K;cin >> A >> B >>K;
  int count=0,ans=0;
  for (int i=big(A,B);ans == 0;i--){
    if (A%i == 0 && B%i == 0)count ++;
    if (count >= K)ans = i;
  }
  cout << ans <<endl;
}


Measured memory_bytes: 256
#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)
#define rrep(i, n) for(int i = ((int)n - 1); i >= 0; --i)

typedef long long ll;
typedef long double ld;

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



int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(0);
    int a, b, c, x, y;
    cin >> a >> b >> c >> x >> y;
    int res = Inf;
    rep (i, max(x, y) + 1) {
        int tmp = i * c * 2 + max(x - i, 0) * a + max(y - i, 0) * b;
        res = min(res, tmp); 
    }
    res = min(res, a * x + b * y);
    cout << res << endl;
    
    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define pb push_back
const int maxn = 10000;
const int INF32 = 1'050'000'000;
const long long INF64 = 4'000'000'000'000'000'000;
const int MOD7 = 1'000'000'007;
const int MOD9 = 1'000'000'009;

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
int dx[8]={-1,0,1,0,1,1,-1,-1};
int dy[8]={0,-1,0,1,1,-1,1,-1};

int N;
ll L, T;
vector<ll> X;
vector<int> W;

ll calc_count(ll x, ll y, ll l, ll t, int w){
	if(w==2) x+=l;
	if(t*2 < abs(x-y)) return 0;
	ll remain = t*2 - abs(x-y);
	return 1+remain/l;
}

int main(){
	cin >> N >> L >> T;
	X.resize(N);  W.resize(N);
	rep(i,N) cin >> X[i] >> W[i];
//-------------------------------------------
	vector<ll> tmp(N);
	rep(i,N){
		if(W[i]==1) tmp[i] = (X[i]+T)%L;
		else tmp[i] = ((X[i]-T)%L+L)%L;
	}

	ll value = tmp[0];
	sort(tmp.begin(), tmp.end());
	int flag = 0;
	rep(i,N) if(tmp[i]==value) { flag = i; if(W[0]==2) break; }

	ll cnt = 0;
	rep(i,N){
		if(W[0]!=W[i])
			cnt += calc_count(X[0],X[i],L,T,W[0]);
	}

	vector<ll> ans(N);
	if(W[0]==1){
		rep(i,N) ans[(cnt+i)%N] = tmp[(flag+i)%N];
	}else{
		rep(i,N) ans[((-cnt+i)%N+N)%N] = tmp[(flag+i)%N];
	}
//-------------------------------------------
	rep(i,N) cout << ans[i] << endl;
}

Measured memory_bytes: 3968
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
using namespace std;
int a[105];
int main()
{
	int n,m,k,t,sum=0;
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
		sum=sum+a[i];
	}
	cin>>m;
	int ans;
	for(int j=1;j<=m;j++)
	{
		cin>>k>>t;
		if(a[k]>=t)
		ans=sum-(a[k]-t);
		else
		ans=sum+(t-a[k]);
		cout<<ans<<endl;
	}
return 0;
}

Measured memory_bytes: 256
package main

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

func main() {
	var wtr = bufio.NewWriter(os.Stdout)
	var s int
	fmt.Scan(&s)
	m := map[int]bool{}
	i := 1
	m[s] = true
	for {
		i++
		if s%2 == 1 {
			s = 3*s + 1
		} else {
			s = s / 2
		}
		_, ok := m[s]
		if ok {
			break
		}
		m[s] = true
		//fmt.Println(s)

	}

	fmt.Fprintln(wtr, i)
	_ = wtr.Flush()
}


Measured memory_bytes: 1864
#include <bits/stdc++.h>
using namespace std;
 
#define FASTIO  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define ll long long int
#define ld long double
#define vll vector<ll>
#define pll pair<ll,ll>
#define vl(p) vector<p>
#define W while
#define For(i,s,x) for(i=s;i<x;i++)
#define Fore(i,s,x) for(i=s;i<=x;i++)
#define FOR(i,x) for(i=0;i<x;i++)
#define Rof(i,s,x) for(i=s;i>=x;i--)
#define all(v) v.begin(),v.end()
#define it(r,v) for(auto r=v.begin();r!=v.end();r++)
#define pb push_back
#define in insert
#define sz size()
#define F first
#define S second
#define nl cout<<"\n"
#define pr(a) cout<<a<<" "
#define pr2(a,b) cout<<a<<" "<<b<<"\n"
#define pr3(a,b,c) cout<<a<<" "<<b<<" "<<c<<"\n"
#define mod 1000000007
#define mp make_pair

  int main()
  {
     ll a,b,c,k;
     cin>>a>>b>>c>>k;
     if(k<=a)
     cout<<k;
     else if(k>a&&k<=a+b)
     cout<<a;
     else if(k>a+b&&k<=a+b+c)
     cout<<a*1+b*0+(k-a-b)*-1;
        }

Measured memory_bytes: 3632
#ABC 127C
import sys
n, m = map(int, sys.stdin.readline().split())

L = 0
R = n
for _ in range(m):
    Li, Ri = map(int, sys.stdin.readline().split())
    if L < Li:
        L = Li
    if Ri < R:
        R = Ri

if R>=L:
    print(R- (L-1))
else:
    print(0)

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

using namespace std;

int main(void) {
  int n, m;
  cin >> n >> m;

  if (n == 1 && m == 0) {
    cout << 0 << endl;
    return 0;
  }
  
  vector<int> guess(n, 0);
  vector<bool> flag(n, false);
  int s, c;
  for (int i = 0;i < m;i++) {
    cin >> s >> c;
    
    if (flag[s-1] == true && guess[s-1] != c) {
      cout << -1 << endl;
      return 0;
    }
    
    flag[s-1] = true;
    guess[s-1] = c;
  }
  
  if (flag[0] == false) {
    guess[0] = 1;
  }
  
  if (guess[0] == 0 && n != 1) {
    cout << -1 << endl;
    return 0;
  }
  
  for (int i = 0;i < n;i++) {
    cout << guess[i];
  }
  
  
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
n, k = map(int,input().split())
r,s,p = map(int,input().split())
t = list(input())

ans = 0

for i in range(k):
    if t[i] == 'r':
        ans += p
    elif t[i] == 's':
        ans += r
    else:
        ans += s
        
for i in range(k,n):
    if t[i] == 'r':
        if t[i-k] != 'r':
            ans += p
        else:
            t[i] = '0'
    elif t[i] == 's':
        if t[i-k] != 's':
            ans += r
        else:
            t[i] = '0'
    else:
        if t[i-k] != 'p':
            ans += s
        else:
            t[i] = '0'
print(ans)

Measured memory_bytes: 4084
#include <stdio.h>
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>


using namespace std;
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define ll long long
int main() {

  int h1,h2,m1,m2,K;
  cin >> h1 >> m1 >> h2 >> m2 >> K;
  int result = h2*60+m2-h1*60-m1-K;
  cout << result << endl;

}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	string s,t;
	cin>>s>>t;
	string p;
	for(int i=0;i<n;i++)
	{
		cout<<s[i]<<t[i];
	}
	cout<<"\n";
}

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

using namespace std;

using ll = long long;

ll Solve() {
    ll n, m;
    cin >> n >> m;

    ll res = 0;
    for (ll f = 1; f * f <= m; ++f) {
        if (f * n <= m && (m - f * (n - 1)) % f == 0)
            res = max(res, f);
        if (m % f == 0) {
            ll f2 = m / f;
            if (f2 * n <= m && (m - f2 * (n - 1)) % f2 == 0)
                res = max(res, f2);
        }
    }

    return res;
}

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

    cout << Solve() << endl;

    return 0;
}


Measured memory_bytes: 256
import Foundation

var si: [String: Int] = [:]
var ti: [String: Int] = [:]
let n = Int(readLine()!)!
for _ in 0..<n {
  let s = readLine()!
  if si[s] != nil {
    si[s]! += 1
  } else {
    si[s] = 1
  }
}
let m = Int(readLine()!)!
for _ in 0..<m {
  let t = readLine()!
  if ti[t] != nil {
    ti[t]! += 1
  } else {
    ti[t] = 1
  }
}
var ans: [Int] = [0]
for k in si.keys {
  if ti[k] != nil {
    ans.append(si[k]! - ti[k]!)
  } else {
    ans.append(si[k]!)
  }
}
print(ans.max()!)

Measured memory_bytes: 13284
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
ll mod=1000000007;
int main()
{
    ll n;
    cin>>n;
    ll minSum=LLONG_MAX;
    for(ll i=1;i<=sqrt(n);i++)
    {
        if(n%i==0)
        {
            ll curSum=((n/i)+i)-2;
            minSum=min(minSum,curSum);
        }
    }
    cout<<minSum<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
int main() {
  int h, w, f, s, k, ans = 0;
  scanf("%d %d", &h, &w);
  char a[h][w];
  int b[h][w];
  fill((int*) b, (int*) b[h], 0);
  rep(i,h)
    scanf("%s", a[i]);
  rep(i,h)
  {
    f = -1;
    s = 0;
    rep(j,w)
      if (a[i][j] == '.') {
        if (b[i][j] == 0) {
          k = i;
          while (k < h && a[k][j] == '.')
            k++;
          for (int l = i; l < k; l++)
            b[l][j] = k - i;
        }
        if (f < j) {
          k = j;
          while (k < w && a[i][k] == '.')
            k++;
          f = k;
          s = k - j;
        }
        ans = max(ans, b[i][j] + s);
      }
  }
  cout << ans - 1;
}

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

typedef long long ll;

#define v(T) vector<T>
#define ttt(T) tuple<T, T, T>
#define pb push_back
#define mp make_pair
#define rep(i, s, n) for(int i=s;i<n;i++)
#define repeq(i,s,n) for(int i=s;i<=n;i++)
#define poiu(n) for(int i=0; i < n; i++)
#define MOD (int)10e9+7
#define endl '\n'

template<typename T>
void max_self(T& a, T b) { a=a>b?a:b; }
template<typename T>
void min_self(T& a, T b) { a=a<b?a:b; }

using namespace std;

int n;
string s;

bool ispal(int lo, int hi) {
    while(lo<hi) {
        if(s[lo]!=s[hi])
            return false;
        hi--,lo++;
    }
    return true;
}


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

    cin >> s;

    const int n = s.size();
    cout << ((ispal(1-1,(n-1)/2-1)&&ispal((n+3)/2-1,n-1)&&ispal(0,n-1))?"Yes":"No") << endl;
    


    return 0;

}



Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <set>
#include <cmath>
#define rep(i,n) for (int i = 0; i < n; ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  int R;
  cin >> R;
  cout << 2 * R * 3.141592 << endl;
  return 0;
}

Measured memory_bytes: 3196
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    System.out.println(solve(sc.next()));
  }
  static int solve(String s){
    if(s.contains("RRR")){
      return 3;
    } else if(s.contains("RR")){
      return 2;
    } else if(s.contains("R")){
      return 1;
    } else {
      return 0;
    }
  }
}


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

int prime(int N) {
  if(N<2) return 0;
  if(N == 2) return 1;
  if(N%2 == 0) return 0;
  int sq = int(sqrt(N))+1;
  for(int i=3; i<sq; i+=2) {
    if(N%i == 0) return 0;
  }
  return 1;
}

int main() {
  int X; cin >> X;
  
  while(1==1) {
    if(prime(X) == 1) {
      cout << X << endl;
      return 0;
    } else {
      X++;
    }
  }

}


Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
#include<math.h>
int m,k;
double F(int n,int sum)
{
	if(!n)return std::max(sum-k,1);
	double r=0;
	for(int i=1;i<=m;++i)
		r+=F(n-1,sum+i);
	return r;
}
int main()
{
	int n;
	while(scanf("%d%d%d",&n,&m,&k),n)
	{
		double x=pow(double(m),n);
		printf("%.8f\n",F(n,0)/x);
	}
	return 0;
}

Measured memory_bytes: 812
#include<bits/stdc++.h>
#define fo(i,a,b) for(int i=(a);i<=(b);++i)
#define rv(i,a,b) for(int i=(a);i>=(b);--i)
using namespace std;
const int M = 220000;
typedef long long ll;
int n,m;
ll k;
int a[M];
bool eq;
int st;
int cal(int l,int r,int i,ll x){
    if(l>r) return 0;
    int lo=l,hi=r+1;
    int ret=l-1;
    for(int mid=(lo+hi)>>1;lo<hi;mid=(lo+hi)>>1) {
        if(1ll*a[mid]*a[i]<=x) {
            lo=mid+1;
            ret=mid;
        }
        else hi=mid;
    }
    if(1ll*a[l]*a[i]>x) return 0;
    if(1ll*a[r]*a[i]<=x) return (r-l+1);
    return ret-l+1;
}
//return number of j that satisfy a[j]*a[i]<=x for j<i;
int cal(int i,ll x){
    return cal(1,min(i-1,st-1),i,x)+cal(st,i-1,i,x);
}
//偏少为ok
bool ok(ll x){
    ll cnt=0;
	if(st>2) reverse(a+1,a+st);
	fo(i,2,st-1) cnt+=cal(i,x);
	if(st>2) reverse(a+1,a+st);
    fo(i,max(2,st),n){
        cnt+=cal(i,x);
    }
    return cnt<k;
}
int main(){
    cin>>n>>k;
    fo(i,1,n) cin>>a[i];
    sort(a+1,a+n+1);
	st=n+1;
    rv(i,n,1) if(a[i]>=0) st=i;
    ll lo=-1e18,hi=1e18+1;
    for(ll mid=(lo+hi)>>1;lo<hi;mid=(lo+hi)>>1) {
        if(ok(mid)) lo=mid+1;
        else hi=mid;
    }
    cout<<lo<<endl;
    return 0;
}


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

double f(double x){
  if(x < 0){x *= (-1);}
  return x;
}

int main(){
  int n;
  cin >> n;
  vector<int> v(n, 0);
  vector<int> cnt(100010, 0);
  for(int i = 0; i < n; i++){
    cin >> v[i];
    cnt[v[i]]++;  
  }
  int res = 0;
  if(n == 1){cout << 1 << endl;}
  else{
  for(int i = 1; i < 100010; i++){
    int k = cnt[i-1] + cnt[i] + cnt[i+1];
    if(k > res){res = k;}
  }

  cout << res << endl;
  }
}       

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define pil pair<int, long long>
using namespace std;
int read();
int n;
vector<int> e[200005];
int deg[200005];
void add(int f, int t) {
    e[f].push_back(t), e[t].push_back(f), ++deg[f], ++deg[t];
}

int mxdeg[200005], dep[200005];

void chmax(int &x, int y) { x < y ? x = y : x; }

queue<int> q;

int bfs(int u, int v) {
    int rt = 0;
    for (int i = 1; i <= n; ++i) dep[i] = 0;
    q.push(u), dep[u] = 1;
    if (v) q.push(v), dep[v] = 1;
    while (!q.empty()) {
        int u = q.front();
        q.pop(), chmax(mxdeg[dep[u]], deg[u]), chmax(rt, dep[u]);
        for (int i = 0, v; i < e[u].size(); ++i)
            if (!dep[v = e[u][i]]) dep[v] = dep[u] + 1, q.push(v);
    }
    return rt;
}
pil res;
pil work(int u, int v) {
    pil rt;
    for (int i = 1; i <= n; ++i) mxdeg[i] = 0;
    rt = (pil){bfs(u, v), mxdeg[1] - (v != 0)};
    for (int i = 2; i <= n; ++i) {
        if (mxdeg[i] == 1) break;
        rt.second *= (mxdeg[i] - 1);
    }
    if (v) rt.second *= 2;
    return rt;
}

int main() {
    n = read();
    if (n == 2) return puts("1 2"), 0;
    for (int i = 1; i < n; ++i) add(read(), read());
    res.first = 200000;
    for (int i = 1; i <= n; ++i) {
        res = min(res, work(i, 0));
        for (int j = 0; j < e[i].size(); ++j) res = min(res, work(i, e[i][j]));
    }
    printf("%d %d", res.first, res.second);
    return 0;
}
const int _SIZE = 1 << 22;
char ibuf[_SIZE], *iS = ibuf, *iT = ibuf;
#define gc                                                         \
    (iS == iT ? iT = ((iS = ibuf) + fread(ibuf, 1, _SIZE, stdin)), \
     (iS == iT ? EOF : *iS++) : *iS++)
int read() {
    int x = 0, f = 1;
    char c = gc;
    while (!isdigit(c)) f = (c == '-') ? -1 : f, c = gc;
    while (isdigit(c)) x = x * 10 + c - '0', c = gc;
    return x * f;
}

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

int main(){
  int a,b;
  cin>>a>>b;
  if(a==1&&b==1){
    cout<<1000000<<endl;
    return 0;
  }
  int answer=0;
  if(a==1){
    answer+=300000;
  }
  if(a==2){
    answer+=200000;
  }
  if(a==3){
    answer+=100000;
  }
  if(b==1){
    answer+=300000;
  }
  if(b==2){
    answer+=200000;
  }
  if(b==3){
    answer+=100000;
  }
  cout<<answer<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cassert>
#include <climits>
#include <bitset>
#include <stack>
#include <queue>
#include <iomanip>
#include <limits>
#include <string>
#include <cmath>
#include <set>
#include <map>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string.h>

using namespace std;
typedef long long ll;

typedef pair<ll,ll> P;
long long int INF = 1e18;
double Pi = 3.1415926535897932384626;
long long int mod = 1000000007;

vector<ll> G[500005];
vector<P> tree[500010];
priority_queue <ll> pql;
priority_queue <P> pqp;
//big priority queue
priority_queue <ll,vector<ll>,greater<ll> > pqls;
priority_queue <P,vector<P>,greater<P> > pqps;
//small priority queue
//top pop

int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
char dir[] = "RULD";
//↓,→,↑,←

#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<x<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<x;
#define re(i,a,b) for(i=a;i<=b;i++);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define deba(x) cout<< #x << " = " << x <<endl

ll rui(ll abc,ll bed){
    //abcのbed乗を計算する
    if(bed==0){return 1;}
    else{
        ll ced = rui(abc,bed/2);
        ced *= ced;
        ced %= mod;
        if(bed%2==1){ced*=abc; ced%=mod;}
        return ced;
    }
}



ll i,j,k,ii,jj;
ll n,m,num;
ll a,b,c,e,f,g,h;
ll x[800005],y[800005],z[900005];
ll in[800005];
ll vnum = 0,sum,ans;
bool dame;
bool check[500005];


int main(){
    cin>>n>>m;
	for(i=1;i*i<=m;i++){
		if(m%i!=0)continue;
		if(i <= m/n){
			ans = max(ans,i);
		}
		if(m/i <= m/n){
			ans = max(ans,m/i);
		}
	}
	p(ans);

	return 0;

}


Measured memory_bytes: 25344
#include <iostream>
#include <algorithm>

using namespace std;

#define MAXN 100000

typedef long long ll;

ll A[MAXN+1], B[MAXN+1], C[MAXN+1];
int N;

ll sunuke ( void )
{
  ll ans = 0;

  for ( int i = 0; i < N; ++i ) {
    ll tmp1 = lower_bound(A,A+N, B[i])-A;
    ll tmp2 = N-(upper_bound(C,C+N, B[i])-C);

    ans += tmp1*tmp2;
  }

  return ans;
}

int main()
{
  cin >> N;

  for ( int i = 0; i < N; ++i ) scanf("%ld", &A[i]);
  for ( int i = 0; i < N; ++i ) scanf("%ld", &B[i]);
  for ( int i = 0; i < N; ++i ) scanf("%ld", &C[i]);

  sort(A, A+N);
  sort(B, B+N);
  sort(C, C+N);

  cout << sunuke() <<  "\n";
}


Measured memory_bytes: 2560
#include<stdio.h>
int main(void)
{
	int array[11][4][5]={0};
	int i,j,k,m,a,b;
	scanf("%d",&a);
	for(b=0;b<a;b++){
		scanf("%d %d %d %d",&i,&j,&k,&m);
		array[k][j][i]+=m;
	}
	for(i=1;i<5;i++){
		for(j=1;j<5;j++){
			for(k=1;k<11;k++){
				if(j==4&&i!=4){
					printf("##");
				}else if(j!=4){
					printf(" %d",array[k][j][i]);
				}
			}
			if(i==4&&j==4){
				break;
			}else{
				printf("\n");
			}
		}
	}
	return 0;
}

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

void exploreIsland( bool c[50][50], int h, int w, int y, int x )
{
    c[y][x] = 0;

    if( y - 1 >= 0 && c[y-1][x] == 1 )
        exploreIsland( c, h, w, y - 1, x ); 
    if( x - 1 >= 0 && y - 1 >= 0 && c[y-1][x-1] == 1 )
        exploreIsland( c, h, w, y - 1, x - 1 ); 
    if( x + 1 < w && y - 1 >= 0 && c[y-1][x+1] == 1 )
        exploreIsland( c, h, w, y - 1, x + 1 );
    if( x - 1 >= 0 && c[y][x-1] == 1 )
        exploreIsland( c, h, w, y, x - 1 ); 
    if( x + 1 < w && c[y][x+1] == 1 )
        exploreIsland( c, h, w, y, x + 1 );
    if( y + 1 < h && c[y+1][x] == 1 )
        exploreIsland( c, h, w, y + 1, x ); 
    if( x - 1 >= 0 && y + 1 < h && c[y+1][x-1] == 1 )
        exploreIsland( c, h, w, y + 1, x - 1 ); 
    if( x + 1 < w && y + 1 < h && c[y+1][x+1] == 1 )
        exploreIsland( c, h, w, y + 1, x + 1 ); 
}

int main()
{
    int h, w;
    bool c[50][50];

    while( cin >> w >> h )
    {
        if( h == 0 && w == 0 )
            break;
        
        for( int i = 0; i < h; i++ )
            for( int j = 0; j < w; j++ )
                cin >> c[i][j];
    
        int cnt = 0;
        for( int i = 0; i < h; i++ )
            for( int j = 0; j < w; j++ )
                if( c[i][j] == 1 )
                {
                    exploreIsland( c, h, w, i, j );
                    cnt++;
                }
        cout << cnt << endl;
    }
    return 0;
}



Measured memory_bytes: 3296
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <numeric>

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


int main() {
    int n, m; cin >> n >> m;
    vector<long long> a(n), b(m), c(m);
    rep(i, n) cin >> a[i];
    vector<pair<long long,long long> > BC(m);
    rep(i, m){
        cin >> b[i] >> c[i];
        BC[i] = make_pair(c[i], b[i]);
    } 
    sort(BC.rbegin(), BC.rend());
    sort(a.begin(), a.end());
    bool brk = false;
    int count = 0;
    rep(i,m){
        rep(k, BC[i].second){
            if (BC[i].first < a[count]){
                brk = true;
                break;
            }
            a[count] = BC[i].first;
            count++;
        }
        if (brk) {
            break;
        }
    }
    long long sum = 0;
    rep(i,n){
        sum += (long long)a[i];
        
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 4224
#include <bits/stdc++.h>
#include <boost/range/irange.hpp>

using namespace std;
using namespace boost;

struct Mod {
    static constexpr auto kMod = 1000000007L;
    static constexpr auto kIMod = 1000000005L;

    // can be implicitly converted
    Mod(int64_t n) : n(n) {}

    Mod operator*(Mod m) const {
        return (n * (m.n % kMod)) % kMod;
    }

    Mod& operator*=(Mod m) {
        *this = *this * m;
        return *this;
    }

    Mod pow(int64_t p) {
        if (p == 0) {
            return 1;
        }
        if (p == 1) {
            return n;
        }

        int64_t r = this->pow(p/2).n;
        if (p % 2 == 0) {
            return r * r % kMod;
        } else {
            return (r * r % kMod) * n % kMod;
        }
    }

    Mod operator/(Mod m) const {
        if (n == 0) {
            return 0;
        }

        return *this * m.pow(kIMod);
    }

    Mod& operator/=(Mod m) {
        *this = *this / m;
        return *this;
    }

    Mod operator+(Mod m) const {
        return (n + m.n) % kMod;
    }

    Mod& operator+=(Mod m) {
        *this = *this + m;
        return *this;
    }

    Mod operator-(Mod m) const {
        return (kMod + n - m.n) % kMod;
    }

    Mod& operator-=(Mod m) {
        *this = *this - m;
        return *this;
    }

    int64_t n;
};

Mod operator/(int64_t lhs, Mod rhs) {
    return Mod(lhs) / rhs;
}

Mod operator*(int64_t lhs, Mod rhs) {
    return Mod(lhs) * rhs;
}

Mod operator+(int64_t lhs, Mod rhs) {
    return Mod(lhs) + rhs;
}

Mod operator-(int64_t lhs, Mod rhs) {
    return Mod(lhs) - rhs;
}

Mod calc(int64_t n, int64_t a, int64_t b, int64_t c) {
    Mod ma = Mod(a) / 100;
    Mod mb = Mod(b) / 100;
    Mod mc = Mod(c) / 100;
    Mod md = 1 - Mod(c) / 100;

    Mod ma_n = 1;
    Mod mb_n = 1;
    Mod md_n = 1;
    for (auto _ : irange(0L, n)) {
        ma_n *= ma;
        mb_n *= mb;
        md_n *= md;
    }

    Mod fn_1 = 1;
    for (auto i : irange(1L, n)) {
        fn_1 *= i;
    }

    Mod fnm = fn_1;
    Mod fm = 1;

    Mod tv = ma_n / md_n / md;

    Mod ans = 0;
    ans += n * tv;
    for (auto m : irange(1L, n)) {
        fnm *= n - 1 + m;
        fm *= m;
        tv *= mb / md;
        ans += fnm / fn_1 / fm * (n + m) * tv;
    }

    return ans;
}

main() {
    int64_t n, a, b, c;
    cin >> n >> a >> b >> c;

    auto ans1 = calc(n, a, b, c);
    auto ans2 = calc(n, b, a, c);

    cerr << ans1.n << " " << ans2.n << endl;

    auto ans = ans1 + ans2;

    cout << ans.n << endl;
}

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

using namespace std;

using ll = long long;

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

    int n, k;
    cin >> n >> k;

    vector<int> a(n);
    for (auto &&x : a) cin >> x;

    vector<bool> dp(k, false);
    for (int i = 1; i <= k; ++i) {
        for (int j = 0; j < n; ++j) {
            if (i - a[j] < 0) break;
            dp[i] = dp[i] | !dp[i - a[j]];
        }
    }

    cout << (dp[k] ? "First" : "Second") << endl;

    return 0;
}


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

#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n) for (int i = 1; i <= (n); i++)
#define all(x) begin(x), end(x)
#define uniq(x) (x).erase(unique(all(x)), end(x))
#define bit(n) (1LL << (n))
#define cdiv(a, b) (((a) - 1) / (b) + 1)
#define dump(x) cerr << #x " = " << (x) << endl
using vint = vector<int>;
using vvint = vector<vint>;
using pint = pair<int, int>;
using vpint = vector<pint>;
template<typename T> using priority_queue_rev = priority_queue<T, vector<T>, greater<T>>;
constexpr long double PI = 3.1415926535897932384626433832795028L;
constexpr int DY[8] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr int DX[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int gcd(int a, int b) {
    while (b) { swap(a %= b, b); }
    return a;
}
int lcm(int a, int b) { return a / gcd(a, b) * b; }
template<typename T> void fin(T mes) {
    cout << mes << endl;
    exit(0);
}
template<typename T, typename U> bool chmax(T &a, const U &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> bool chmin(T &a, const U &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &rhs) {
    os << "(" << rhs.first << ", " << rhs.second << ")";
    return os;
}
template<typename T> ostream &operator<<(ostream &os, const vector<T> &rhs) {
    os << "{";
    for (auto itr = rhs.begin(); itr != rhs.end(); itr++) {
        os << *itr << (next(itr) != rhs.end() ? ", " : "");
    }
    os << "}";
    return os;
}
struct setup {
    static constexpr int PREC = 20;
    setup() {
        cout << fixed << setprecision(PREC);
        cerr << fixed << setprecision(PREC);
    };
} setup;

int N, A, B;
map<int, int> mp[55];
int pascal[55][55];
signed main() {
    cin >> N >> A >> B;
    vint v(N);
    rep(i, N) { cin >> v[i]; }
    sort(all(v));
    reverse(all(v));
    int X = 0;
    rep(i, A) { X += v[i]; }
    pascal[0][0] = 1;
    rep(i, 54) {
        for (int j = 0; j <= i; j++) {
            pascal[i + 1][j] += pascal[i][j];
            pascal[i + 1][j + 1] += pascal[i][j];
        }
    }
    int cnt = 0, kak = 0;
    rep(i, N) {
        if (v[i] > v[A - 1]) { kak++; }
        if (v[i] == v[A - 1]) { cnt++; }
    }
    int ans = pascal[cnt][A - kak];
    for (int i = A + 1; i <= B; i++) {
        if (v[0] == v[A - 1]) { ans += pascal[cnt][i - kak]; }
    }
    cout << (double) X / A << endl;
    cout << ans << endl;

}

Measured memory_bytes: 256
package main

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

// scanner
var sc = bufio.NewScanner(os.Stdin)

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

// math utils
func abs(a int) int {
	return int(math.Abs(float64(a)))
}

func pow(a, b int) int {
	return int(math.Pow(float64(a), float64(b)))
}

func squrt(b int) int {
	return int(math.Sqrt(float64(b)))
}

func max(a, b int) int {
	return int(math.Max(float64(a), float64(b)))
}

func min(a, b int) int {
	return int(math.Min(float64(a), float64(b)))
}

func largerNumOfDigit(a, b int) int {
	alen, blen := len(strconv.Itoa(a)), len(strconv.Itoa(b))
	if alen > blen {
		return alen
	}
	return blen
}

func main() {
	sc.Split(bufio.ScanWords)
	N := nextInt()
	min := math.MaxInt64

	for a := 1; a <= squrt(N); a++ {
		if N%a != 0 {
			continue
		}
		b := N / a
		if largerNumOfDigit(a, b) < min {
			min = largerNumOfDigit(a, b)
		}
	}

	fmt.Print(min)
}


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

class Main{
    public static void main(String[] args){
        FastScanner fs = new FastScanner();
        int a = fs.nextInt();
        int b = fs.nextInt();
        Set<Integer> set = new HashSet<>();
        set.add(a);
        set.add(b);
        for(int i=1;i<=3;i++){
            if(!set.contains(i)){
                System.out.println(i);
            }
        }
    }
    static class FastScanner{
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;

        private boolean hasNextByte(){
            if(ptr < buflen){
                return true;
            }else{
                ptr = 0;
                try{
                    buflen = in.read(buffer);
                }catch(IOException e){
                    e.printStackTrace();
                }
                if(buflen <= 0){
                    return false;
                }
            }
            return true;
        }

        private int readByte(){
            if(hasNextByte())return buffer[ptr++];
            else return -1;
        }

        private boolean isPrintableChar(int c){
            return 33<=c && c<=126;
        }

        public boolean hasNext(){
            while(hasNextByte() && !isPrintableChar(buffer[ptr]))ptr++;
            return hasNextByte();
        }

        public String next(){
            if(!hasNext()) throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while(isPrintableChar(b)){
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }

        public long nextLong(){
            if(!hasNext()) throw new NoSuchElementException();
            long n = 0;
            boolean minus = false;
            int b = readByte();
            if(b == '-'){
                minus = true;
                b = readByte();
            }
            if(b < '0' || '9' < b){
                throw new NumberFormatException();
            }
            while(true){
                if('0' <= b && b<='9'){
                    n*=10;
                    n+=b-'0';
                }else if(b==-1 || !isPrintableChar(b)){
                    return minus ? -n : n;
                }else{
                    throw new NumberFormatException();
                }
                b = readByte();
            }
        }
        public int nextInt(){
            long nl = nextLong();
            if(nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)throw new NumberFormatException();
            return (int)nl;
        }
        public double nextDouble(){return Double.parseDouble(next());}
    }
}

Measured memory_bytes: 20692
# C - Digits in Multiplication
def main():
    n = int(input())
    ans = []

    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            ans.append(max(len(str(i)), len(str(n//i))))
    else:
        print(min(ans))



        
if __name__ == '__main__':
    main()

Measured memory_bytes: 9440
/*
 * main.c
 *
 *  Created on: 2019/06/22
 *      Author: family
 */

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

int d[100001] = {0};

int sort_inc(const void *a, const void *b)
{
    return (*(int*)a - *(int*)b);
}

int main()
{
	int N = 0, i = 0;
	int ans = 0;
	scanf("%d", &N);
	for (i = 0; i < N; i++) {
		scanf("%d", &d[i]);
	}
	qsort(d, N, sizeof(int), sort_inc);
	ans = d[N/2] - d[(N/2) - 1];
	printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 892
#include<stdio.h>

int main(){
    int N, K;
    scanf("%d %d", &N, &K);
    int n[N];
    for(int i = 0; i<N; i++){
        scanf("%d", &n[i]);
    }
    for(int i = K; i<N; i++){
        if(n[i-K]<n[i]){
            printf("Yes\n");
        }else{
            printf("No\n");
        }
    }
}

Measured memory_bytes: 2400
#include <iostream>
#include <queue>
#include <stack>
#include <cmath>
#include <string>
#include <vector>
#include <utility>
#include <map>
using namespace std;

int main(){
  char grid[3][3];
  for(int i=0; i<3; i++){
    for(int j=0; j<3; j++){
      cin >> grid[i][j];
    }
  }

  for(int i=0; i<3; i++) cout << grid[i][i];
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _overload3(_1,_2,_3,_4,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,n) (int i=a;i<n;i++)
#define per(i,a,n,s) (int i=n-1;i>=a;i--)
#define range(...) _overload3(__VA_ARGS__,per,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define vecin(x) for(auto&youso_: (x) ) cin >>  youso_
#define vecout(x) for(auto&youso_: (x) ) cout << youso_ << " " ; cout << endl
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 int inf = 1e9+10;
const int mod = 1e9+7;
const long long llinf = 1e18;
#define _GLIBCXX_DEBUG
// head

int main(){
    int n;
    cin >> n;
    if (n==1) { cout << 1 << endl; return 0;}
    int ans=0,ansm=0;
    for range(ni,1,n+1){
        int copy = ni;
        int count=0;
        while (copy%2==0){
            copy/=2;
            count +=1;
        }
        if (chmax(ansm,count)){
            ans=ni;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>


using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define loop(n) FOR(i,0,n)
#define rrep(i,a,b) for(int i=(a);i>=(b);--i)
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

int main() {
	
	while (true) {
		int e; cin >> e;

		if (e == 0)return 0;

		//x+y*y+z*z*z=e;

		LL ans = INF;

		for (LL y = 0; y*y <= e; y++) {
			for (LL z = 0; z*z*z <= e; z++) {
				LL x = e - y * y - z*z*z;

				if (x >= 0) {
					ans = min(ans, x + y + z);
				}
			}
		}

		cout << ans << endl;
	}

	return 0;
}


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

int main() {
    int a[3], k;
    cin >> a[0] >> a[1] >> a[2] >> k;
    sort(a, a+3);
    cout << a[0]+a[1]+a[2]*pow(2,k) << endl;
    return 0;
}


Measured memory_bytes: 256
fn solve() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let n: i32 = sc.read();
    let m: i32 = sc.read();
    let result = n * (n - 1) + m * (m - 1);
    println!("{}", result / 2);
}

fn main() {
    std::thread::Builder::new()
        .stack_size(64 * 1024 * 1024) // 64MB
        .spawn(|| solve())
        .unwrap()
        .join()
        .unwrap();
}
pub mod utils {
    const DYX: [(isize, isize); 8] = [
        (0, 1),   //right
        (1, 0),   //down
        (0, -1),  //left
        (-1, 0),  //top
        (1, 1),   //down right
        (-1, 1),  //top right
        (1, -1),  //down left
        (-1, -1), //top left
    ];

    pub fn try_adj(y: usize, x: usize, dir: usize, h: usize, w: usize) -> Option<(usize, usize)> {
        let ny = y as isize + DYX[dir].0;
        let nx = x as isize + DYX[dir].1;
        if ny >= 0 && nx >= 0 {
            let ny = ny as usize;
            let nx = nx as usize;
            if ny < h && nx < w {
                Some((ny, nx))
            } else {
                None
            }
        } else {
            None
        }
    }
}

//snippet from kenkoooo
pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn read_line(&mut self) -> String {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b'\n' || b == b'\r')
            .take_while(|&b| b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 8572