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

using namespace std;

#define gc getchar_unlocked
#define foi(i,n) for(int i=0;i<n;i++)
#define Foi(i,k,n) for(int i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define fol(i,n) for(ll i=0;i<n;i++)
#define Fol(i,k,n) for(ll i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define ll long long
#define si(x)   scanf("%d",&x)
#define sl(x)   scanf("%lld",&x)
#define ss(s)   scanf("%s",s)
#define pi(x)   printf("%d\n",x)
#define pl(x)   printf("%lld\n",x)
#define ps(s)   printf("%s\n",s)
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
typedef pair<int, int>  pii;
typedef pair<ll, ll>    pl;
typedef vector<int>     vi;
typedef vector<ll>      vl;
typedef vector<pii>     vpii;
typedef vector<pl>      vpl;
typedef vector<vi>      vvi;
typedef vector<vl>      vvl;
int mpow(int base, int exp); 
void ipgraph(int m);
void dfs(int u, int par);
const int mod = 1000000007;
const int N = 3e5, M = N;
//=======================

vi g[N];
int a[N];

int mpow(int base, int exp) {
    base %= mod;
    int result = 1;
    while (exp > 0) {
        if (exp & 1) result = ((ll)result * base) % mod;
        base = ((ll)base * base) % mod;
        exp >>= 1;
    }
    return result;
}

void ipgraph(int n, int m){
    int i, u, v;
    while(m--){
        cin>>u>>v;
        g[u-1].pb(v-1);
        g[v-1].pb(u-1);
    }
}

void dfs(int u, int par){
    for(int v:g[u]){
        if (v == par) continue;
        dfs(v, u);
    }
}


ll NcR(ll n,ll r)
{
    long long p = 1, k = 1; 
    if (n - r < r)
        r = n - r;
    if (r != 0) { 
        while (r) {
            p *= n;
            long long m = __gcd(p, k);
            p /= m;
            k /= m;
            n--;
            r--;
            k *= r; 
        }
    }
    else
        p = 1;
    return p;
}

  
ll gcdExtended(ll a, ll b, ll *x, ll *y) 
{ 
    if (a == 0) 
    { 
        *x = 0, *y = 1; 
        return b; 
    } 
  
    ll x1, y1; // To store results of recursive call 
    ll gcd = gcdExtended(b%a, a, &x1, &y1); 
  
    *x = y1 - (b/a) * x1; 
    *y = x1; 
  
    return gcd; 
}

ll modInv(ll a, ll m) 
{ 
    ll x, y; 
    ll g = gcdExtended(a, m, &x, &y); 
    if (g != 1) 
        return 0;
    else
    { 
        ll res = (x%m + m) % m; 
        return res;
    } 
} 



int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n;
    cin>>n;
    vector<ll> x(n);
    for(int i=0;i<n;i++)
        cin>>x[i];
    ll e = 0;
    for(int i=0;i<n;i++)
        e = (e + x[i]%mod)%mod;
    e = mpow(e,2);
    ll rest=0;
    for(int i=0;i<n;i++)
        rest = (rest + mpow(x[i]%mod,2))%mod;
    ll count = (e%mod - rest%mod + mod)%mod;
    count = (count * modInv(2,mod))%mod;
    cout<<count;
    return 0;
}

Measured memory_bytes: 11840
#include<stdio.h>
#include<stdlib.h>
#include <math.h>
#include<string.h>
#include<limits.h>

int main(){
	int i;
	double q,x[100000];
	
	while(1){
	scanf("%lf",&q);
		if(q==-1)break;
	x[0]=q/2;
	
	for(i=0;;i++){
		if(fabs(x[i]*x[i]*x[i]-q)<0.00001*q)break;
		x[i+1]=x[i]-(x[i]*x[i]*x[i]-q)/(3*x[i]*x[i]);
	}
	printf("%f\n",x[i]);
	}
return 0;
}

Measured memory_bytes: 648
#include <iostream>

using namespace std;

typedef unsigned long long ll;

ll gcd(ll x,ll y){
  if(x==0)return y;
  if(y==0)return x;
  ll shift = __builtin_ctzll(x|y);
  x>>=__builtin_ctzll(x);
  do { 
    y>>= __builtin_ctzll(y);
    if(y<x)
      swap(x,y);
    y = y-x;
  }while(y!=0);
  return x<<shift;
}

ll gcd1(ll x,ll y){
  if(y==0)return x;
  else return gcd1(y,x%y);
}

int main() {
  ll N,g,ans,x;
  cin >> N >> g;
  ans = g;
  for(int i=1;i<N;i++){
    cin >> x;
    g = gcd(ans,x);
    ans = x/g * ans;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdlib>
#include <cstdio>
#include <queue>
#include <map>
#include <stack>
using namespace std;

int A[1010],C[1010];
int main(){
	int N,M;
	cin >> N >> M;
	for(int i = 0 ; i < N ; i++){
		cin >> A[i];
	}
	for(int i = 0 ; i < M ; i++){
		int budget;
		cin >> budget;
		for(int j = 0 ; j < N ; j++){
			if( A[j] <= budget ){
				C[j]++;
				break;
			}
		}
	}
	cout << (max_element(C,C+1010) - C) + 1 << endl;
}

Measured memory_bytes: 1168
#include <algorithm>
#include <cassert>
#include <cstring>
#include <cstdio>
#include <vector>

#define REDIRECT(x) freopen(x".in", "r", stdin), freopen(x".out", "w", stdout)
#define CLOSEALL() fclose(stdin), fclose(stdout)
#define eprintf(...) fprintf(stderr, ##__VA_ARGS__), fflush(stderr)

using namespace std;

const int MAXN = 2e5 + 10;
const long long MOD = 1e9 + 7;
typedef long long i64;

template<class T>
T modularExp(T base, T  exp)
{
	T answer(1);
	while (exp)
	{
		if (exp & 1)
			answer = answer * base % MOD;
		base = base * base % MOD;
		exp = exp >> 1;
	}
	return answer;
}

int N, X, Y;
vector<int> Adj[MAXN], finalBlk;

vector <pair<int, int> > col[MAXN], smallest;

int C[MAXN], W[MAXN];
bool vist[MAXN];

int totCnt, colCnt[MAXN];

i64 answer;
i64 fact[MAXN], inv[MAXN];

inline void addEdge(int u, int v)
{
	Adj[u].push_back(v);
	Adj[v].push_back(u);
}

void prepare()
{
	fact[0] = 1;
	for (int i = 1; i < MAXN; i++)
		fact[i] = fact[i - 1] * i % MOD;

	inv[MAXN - 1] = modularExp(fact[MAXN - 1], MOD - 2) % MOD;
	for (int i = MAXN - 2; i >= 0; i--)
		inv[i] = inv[i + 1] * (i + 1) % MOD;
	//assert(inv[1] == 2);
}

void DFS(int cur)
{
	vist[cur] = true;
	totCnt++, colCnt[C[cur]]++;
	finalBlk.push_back(C[cur]);

	for(int to : Adj[cur])
		if(!vist[to])
			DFS(to);

}

int main()
{
	//REDIRECT("colorball");
	prepare();

	scanf("%d%d%d", &N, &X, &Y);

	for (int i = 1; i <= N; i++)
		scanf("%d%d", &C[i], &W[i]),
		col[C[i]].emplace_back(W[i], i);

	for(int i = 1; i <= N; i++)
	{
		if(col[i].empty())
			continue;
		sort(col[i].begin(), col[i].end());
		smallest.push_back(col[i].front());

		for(auto x = col[i].begin() + 1; x != col[i].end(); ++x)
			if(x->first + col[i].front().first <= X)
				addEdge(x->second, col[i].front().second);
	}

	sort(smallest.begin(), smallest.end());
	if(smallest.size() > 0)
		for(int i = 1; i <= N; i++)
		{
			if(C[i] == C[smallest.front().second])
				continue;
			if(W[i] + W[smallest.front().second] > Y)
				continue;
			addEdge(i, smallest.front().second);
		}

	if(smallest.size() > 1)
		for(auto x : col[C[smallest[0].second]])
			if(x.first + W[smallest[1].second] <= Y)
				addEdge(x.second, smallest[1].second);

	DFS(smallest.front().second);

	answer = fact[totCnt];
	for(int x : finalBlk)
		answer = answer * inv[colCnt[x]] % MOD,
		colCnt[x] = 0;

	printf("%lld\n", answer);

	return 0;
}


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

int n;
ll a[110];

int chk[110];
ll ans;

void dfs(int x){
	if(x == n+1){
		ll c = 0;
		for(int i=1; i<=n; ++i) if(!chk[i]) c+=a[i];
		ans = max(ans, c);
		return;
	}
	if(x == 34){
		ll c = 0;
		for(int i=1; i<=n; ++i) if(!chk[i]) c+=a[i];
		for(int i=34; i<=n; ++i){
			if(chk[i]) continue;
			if(i%2 == 0 && i>=68 && !chk[i/2] && !chk[i]) continue;
			if(i*2<=n){
				if(!chk[i*2]) c = max(max(c, c-a[i]-a[i*2]), c-a[i*2]);
				else c = max(c, c-a[i]);
			} else {
				c = max(c, c-a[i]);
			}
		}
		ans = max(ans, c);
		return;
	}
	dfs(x+1);
	if(!chk[x]){
		for(int i=x; i<=n; i+=x) chk[i]++;
		dfs(x+1);
		for(int i=x; i<=n; i+=x) chk[i]--;
	}
}

int main(){
	cin >> n;
	for(int i=1; i<=n; ++i) cin >> a[i];
	dfs(1);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
 
namespace aizu
{
    class OnlineJudge
    {
        const string ope = "+-*/";
        static void Main()
        {
            string input;
            var stack = new Stack<double>();
            var operate = new Dictionary<string, Func<double, double, double>> {
                {"+", (v1, v2) => v2 + v1}, {"-", (v1, v2) => v2 - v1}, {"*", (v1, v2) => v2 * v1}, {"/", (v1, v2) => v2 / v1},
            };
            while((input = Console.ReadLine()) != null) {
                foreach(var val in input.Split()) {
                    double num;
                    if(double.TryParse(val, out num)) {
                        stack.Push(num);
                    }
                    else {
                        stack.Push(operate[val](stack.Pop(), stack.Pop()));
                    }
                }
                Console.WriteLine("{0:F6}", stack.Pop());
            }
        }
    }
}

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

std::vector<size_t> gaps = {1};

size_t insertion_sort(size_t a[], size_t n, size_t gap = 1){
  size_t count = 0;
  for(size_t i = gap; i < n; i++){
    size_t v = a[i];
    int j = i - gap;
    while(j >= 0 && a[j] > v){
      a[j+gap] = a[j];
      j -= gap;
      count++;
    }
    a[j+gap] = v;
  }
  return count;
}

void make_gap_table(size_t n){
  size_t h = 4;
  while(h < n){
    gaps.push_back(h);
    h = 3*h + 1;
  }
  std::reverse(gaps.begin(),gaps.end());
}

void shell_sort(size_t a[], size_t n){
  make_gap_table(n);
  size_t count = 0;
  for(auto const &v : gaps){
    count += insertion_sort(a,n,v);
  }

  std::cout << gaps.size() << '\n';

  for(int i=0;i<gaps.size()-1;i++){
    std::cout << gaps[i] << ' ';
  }
  std::cout << gaps[gaps.size()-1] << '\n';

  std::cout << count << '\n';
}

int main(){
  size_t n;
  size_t buf;
  std::vector<size_t> a;
  std::cin >> n;
  for(size_t i = 0; i < n; i++){
    std::cin >> buf;
    a.push_back(buf);
  }

  shell_sort(a.data(),a.size());
  for(auto &v : a){
    std::cout << v << '\n';
  }
}

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

int main() {
	int A, B, K;
	cin >> A >> B >> K;
	for (int i = 0; i < K; ++i) {
		if (i % 2) {
			A += B / 2;
			B /= 2;
		}
		else {
			B += A / 2;
			A /= 2;
		}
	}
	cout << A << " " << B;
}

Measured memory_bytes: 256
package main

import "fmt"

func ReadInt() int {
	var n int
	fmt.Scan(&n)
	return n
}

func main() {
	N := ReadInt()
	K := ReadInt()

	if (N-1)/2+1 >= K {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using pii=pair<int,int>;

void chmin(int &x, int y){x=min(x,y);}

#define int long long

main()
{
    int n,D,A; cin>>n>>D>>A;
    D*=2;
    vector<pii> mo(n);
    for(pii &x:mo) cin>>x.first>>x.second;
    sort(begin(mo),end(mo));
    long long ans{};

    vector<int> f(n),acc(n+1);
    for(int i=0,j=0; i<n; i++)
    {
        while(j!=n and mo[j].first<=mo[i].first+D)
        {
            f[j]=i;
            ++j;
        }
        int now=acc[i]-acc[f[i]];
        int k=max(0ll,(A-1+mo[i].second)/A-now);
        acc[i+1]=acc[i]+k;
        ans+=k;
    }

    cout << ans << "\n";
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
#define REP(i,n) for (long long i=0;i<(n);i++)
#define FOR(i,a,b) for (long long i=(a);i<(b);i++)
#define RREP(i,n) for(long long i=n;i>=0;i--)
#define RFOR(i,a,b) for(long long i=(a);i>(b);i--)
#define dump1d_arr(array) REP(i,array.size()) cerr << #array << "[" << (i) << "] ==> " << (array[i]) << endl
#define dump2d_arr(array) REP(i,array.size()) REP(j,array[i].size()) cerr << #array << "[" << (i) << "]" << "[" << (j) << "] ==> " << (array[i][j]) << endl
#define dump(x)  cerr << #x << " => " << (x) << endl
#define dumpP(p) cerr << "( " << p.first << " , " << p.second << " )" << ends
#define SORT(c) sort((c).begin(),(c).end())
#define MIN(vec) *min_element(vec.begin(), vec.end())
#define MAX(vec) *max_element(vec.begin(), vec.end())
#define UNIQ(vec) vec.erase(unique(vec.begin(), vec.end()),vec.end()) //ソートの必要あり
#define IN(n,m)  (!(m.find(n) == m.end()))
#define ENUM(m) for (auto itr = m.begin(); itr != m.end(); ++itr)
#define dump_MAP(m) for(auto itr = m.begin(); itr != m.end(); ++itr) { cerr << itr->first << " --> "  << itr->second << endl; }
#define FINDL(vec,x) (lower_bound(vec.begin(),vec.end(),x) - vec.begin())
#define FINDU(vec,x) (upper_bound(vec.begin(),vec.end(),x) - vec.begin())
#define ROUND(N) setprecision(N)
#define ROUND_PRINT(N,val) cout << fixed;cout << setprecision(N) << val << endl
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define INARR(h,w,x,y) (0 <= y && y < h && 0 <= x && x < w)
#define EQ(a,b) (abs(a - b) < 1e-10)
using namespace std;
constexpr int dx[4] = {0,1,0,-1};
constexpr int dy[4] = {1,0,-1,0};
constexpr long double pi = M_PI;
constexpr double EPS = 1e-10;
constexpr long MOD = 1000000007;
constexpr short shINF = 32767;
constexpr long loINF = 2147483647;
constexpr long long llINF = 9223372036854775807;
typedef long long LL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL,LL> pr;
typedef vector<bool> VB;
typedef vector<pr> VP;
typedef priority_queue<pr,vector<pr>,greater<pr>> pq;

int main(void) {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    long q;
    int cnt = 0;
    REP(i,N) {
        cin >> q;
        bool flg = true;
        for (long i = 2;i * i <= q ;i++) {
            if (q % i == 0) {
                flg = false;
                break;
            }
        }
        //dump(q);dump(flg);
        //dump(cnt);
        if (flg) cnt++;
    }
    cout << cnt << endl;
}


Measured memory_bytes: 3136
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <numeric>
 
using namespace std;
 
typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;
 
const double PI=3.14159265358979323846;
 
#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))
 
#define rep(i, N) for(int i = 0; i < N; ++i)
 
#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL
 
#define IN(l, r, x) ((l) <= (x) && (x) < (r))
 
s64 mygcd(s64 x, s64 y)
{
    if (y == 0) return x;
    return mygcd(y, x % y);
}
 
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
 
    // - 12:23
    // 16:12 -
 
    int n;
    cin >> n;
 
    vs64 a(n);
    rep (i, n) cin >> a[i];
 
    bool ans1 = true, ans2 = true;
 
    // check pairwise
    vector< bool > found(1000001, false);
    rep (i, n)
    {
        s64 x = a[i];
        for (s64 j = 2; j * j <= x; ++j)
        {
            if (x % j == 0)
            {
                if (found[j])
                {
                    ans1 = false;
                    break;
                }
                found[j] = true;
                while (x % j == 0)
                {
                    x /= j;
                }
            }
        }
        if (x != 1)
        {
            if (found[x]) ans1 = false;
            found[x] = true;
        }
        if (!ans1) break;
    }
 
    s64 g = 0;
    rep (i, n)
    {
        g = mygcd(g, a[i]);
    }
    ans2 = g == 1;
 
    if (ans1)
    {
        cout << "pairwise coprime" << "\n";
    }
    else if (ans2)
    {
        cout << "setwise coprime" << "\n";
    }
    else
    {
        cout << "not coprime" << "\n";
    }
 
    return 0;
}
 

Measured memory_bytes: 11352
fun main(array: Array<String>) {
    val s = readLine()!!
    val s1 = s.substring(0, (s.length - 1) / 2)
    val s2 = s.substring((s.length + 3) / 2 - 1, s.length)
    if (s == s.reversed() && s1 == s1.reversed() && s2 == s2.reversed()) {
        println("Yes")
    } else {
        println("No")
    }
}

Measured memory_bytes: 33780
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
using namespace std;
using namespace __gnu_pbds; 
#define     mod             1e9+7
#define     MOD             998244353
#define     ll              long long
#define     mp              make_pair
#define     F               first
#define     S               second
#define     t()             int test;cin>>test;while(test--)
#define     setbits(x)      __builtin_popcountll(x)
#define     ii              pair<int,int>
#define     que_max         priority_queue <int>
#define     IOS             ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define     endl            "\n"
typedef tree<ii, null_type, less<ii>, rb_tree_tag, tree_order_statistics_node_update> pbds;

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cout << name << " : " << arg1 << endl;
        //use cerr if u want to display at the bottom
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
#else
#define trace(...)
#endif



int32_t main()
 
{  
   #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    IOS;
  // t()
   {
      int x, n;
      cin>>x>>n;
      set<int> s;
      for(int i=0; i<n; i++)
      {
        int y;
        cin>>y;
        s.insert(y);

      }
      int mini=1e9, ans=0;
      for(int i = x-1; i>=0; i--)
      {
        if(s.find(i) == s.end())
        {
          mini=min(mini,abs( x-i));
          ans=i;
          break;
        }
      }

      for(int i=x+1; i<=101; i++)
      {
        if(s.find(i) == s.end())
        {
          if(mini>abs(x-i))
          {
            ans=i;
            break;
          }
        }
      }
      if(s.find(x) == s.end())
      {
        ans=x;
      }

      cout<<ans<<endl;
   }
    
}

Measured memory_bytes: 3652
//yukicoder@cpp14
//author:luckYrat(twitter:@luckYrat_)
//<ここに一言>

//せんげん！
#include <iostream>

#include <cmath>
#include <algorithm>
#include <iomanip>

#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <bitset>

#include <cctype>
#include <utility>
#include <climits>


//なまえくーかん！
using namespace std;
using ll = long long;
using P = pair<ll,ll>;

//てーすう！
const int mod = 1000000007;
const int inf = (1<<20)-1;
const ll linf = (1LL<<62LL)-1;
const double EPS = (1e-10);

//でふぁいん！
#define anyfill(n,s) setw(n) << setfill(s)
#define loop(s) for(int i = 0; s > i; i++)
#define rep(i,q) for(int i = 0; (q) > i; i++)
#define repp(i,n,q) for(int i = n; (q) > i; i++)
#define dep(i,q) for(int i = (q); 0 < i; i--)

//みじかく！
#define pb push_back
#define fir first
#define scn second
#define ednl endl

//いぇすのー！
#define YesNo(a) (a?"Yes":"No")
#define YESNO(a) (a?"YES":"NO")
#define yesno(a) (a?"yes":"no")

//きんぼーnほーこー！！
P ar4[4] = {{0,1},{0,-1},{1,0},{-1,0}};
P ar8[8] = {{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,-1},{1,0},{1,1}};
/*
確認ポイント
cout << fixed << setprecision(n) << 小数計算//n桁の小数表記になる

計算量は変わらないが楽できるシリーズ
min(max)_element(iter,iter)で一番小さい(大きい)値のポインタが帰ってくる
count(iter,iter,int)でintがiterからiterの間にいくつあったかを取得できる
*/
template <typename T>
T gcd(T a,T b){
  if(a%b==0)return b;
  else return gcd(b,a%b);
}
template <typename T>
T lcm(T a,T b){
  return a/gcd(a,b)*b;
}
__attribute__((constructor))
void initial() {
 cin.tie(0);
 ios::sync_with_stdio(false);
}
char mp[100][100];
int dp[100][100][2];//0#が繋がってるか1繋がってないか
int main(){
  int h,w;cin>>h>>w;
	
	for(int i = 0; h > i; i++){
		for(int j = 0; w > j; j++){
			cin>>mp[i][j];
			dp[i][j][0]=inf;
			dp[i][j][1]=inf;
		}
	}
	if(mp[0][0]=='#'){
		dp[0][0][1]=1;
	}else{
		dp[0][0][0]=0;
	}
	for(int i = 1; h > i; i++){
		if(mp[i][0]=='#'){
			dp[i][0][1]=min(dp[i-1][0][0]+1,dp[i-1][0][1]);
		}else{
			dp[i][0][0]=min(dp[i-1][0][0],dp[i-1][0][1]);
		}
	}
	for(int i = 1; w > i; i++){
		if(mp[0][i]=='#'){
			dp[0][i][1]=min(dp[0][i-1][0]+1,dp[0][i-1][1]);
		}else{
			dp[0][i][0]=min(dp[0][i-1][0],dp[0][i-1][1]);
		}
	}
	for(int i = 1; h > i; i++){
		for(int j = 1; w > j; j++){
			if(mp[i][j]=='#'){
				dp[i][j][1]=min({dp[i-1][j][0]+1,dp[i][j-1][0]+1,dp[i-1][j][1],dp[i][j-1][1]});
			}else{
				dp[i][j][0]=min({dp[i-1][j][0],dp[i][j-1][0],dp[i-1][j][1],dp[i][j-1][1]});
			}
		}
	}
	cout << min(dp[h-1][w-1][0],dp[h-1][w-1][1]) << endl;
}

Measured memory_bytes: 384
#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>
#include<string>
#include<utility>
#include<array>
#include<set>
#include <numeric>
#include <stdio.h>
//#include <boost/math/common_factor_rt.hpp>
#include<fstream>
#define EPS (1e-7)
using namespace std;
#define ll long long



std::vector<std::vector<long long>> comb(int n) {
	std::vector<std::vector<long long>> v(n + 1, std::vector<long long>(3, 0));

	for (int i = 0; i < v.size(); i++) {
		v[i][0] = 1;
		v[1][1] = 1;
		v[2][2] = 1;
	}
	for (int j = 1; j < v.size(); j++) {
		for (int k = 1; k < 3; k++) {
			v[j][k] = (v[j - 1][k - 1] + v[j - 1][k]);
		}
	}
	return v;
}

int main() {

	int N;
	cin >> N;
	string s;
	vector<int> nchar(26, 0);
	vector<vector<int>> ss(N);
	ll ans = 0;
	for (auto i = 0; i < N; i++)
	{
		cin >> s;
		vector<int> inner = nchar;
		for (auto j = 0; j < s.size(); j++)
		{
			inner[s[j] - 97] += 1;
		}
		ss[i] = inner;
	}

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

	int count = 0;
	vector<int> preans;
	int flag = 0;
	for (auto i = 0; i < N; i++)
	{
		if (flag == 0 && i != N - 1) {
			if (ss[i] == ss[i + 1]) {
				flag = 1;
				count += 2;
			}
			else {

			}
		}
		else if (i != N - 1) {
			if (ss[i] == ss[i + 1]) {
				count += 1;
			}
			else {
				preans.push_back(count);
				flag = 0;
				count = 0;
			}
		}
		if (i == N - 1 && count != 0) {
			preans.push_back(count);
		}

	}
	sort(preans.begin(), preans.end(), greater<int>());

	if (preans.size() != 0) {
		vector<vector<ll> > v = comb(preans[0]);


		for (auto i = 0; i < preans.size(); i++)
		{
			ans += v[preans[i]][2];
		}
	}
	cout << ans << endl;


	return 0;
}

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

int main(){
    using namespace std;
    unsigned long X;
    cin >> X;
    set<unsigned long> s;
    for(unsigned long i{0}; i < 400; ++i)s.insert(i);

    unsigned long N;
    cin >> N;
    for(unsigned long i{0}, p; i < N; ++i){
        cin >> p;
        s.erase(p);
    }
    unsigned long upp{*s.lower_bound(X)}, low{*prev(s.upper_bound(X))};
    cout << (upp + low < 2 * X ? upp : low) << endl;
    return 0;
}

Measured memory_bytes: 3652
#include <stdio.h>
#include <algorithm>
#include <queue>
#include <functional>
using namespace std;
using ll = long long;

int n, m, mask[10], p[10], pm, cnt = 0;
void rec(int bits, int d) {
	if (d < 0) {
		cnt += bits == pm;
		return;
	}
	rec(bits, d - 1);
	rec(bits ^ mask[d], d - 1);
}
int main() {
	scanf("%d %d", &n, &m);
	for (int i = 0; i < m; i++) {
		int k, s;
		scanf("%d", &k);
		for (int j = 0; j < k; j++) {
			scanf("%d", &s);
			mask[s - 1] ^= (1 << i);
		}
	}
	for (int i = 0; i < m; i++) {
		scanf("%d", p + i);
		pm ^= p[i] << i;
	}
	rec(0, n - 1);
	printf("%d\n", cnt);
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <ctype.h>

int main() {
    char W[10], T[2];
    int count = 0, i;
    scanf("%s", W);
    while (scanf("%s", T) && strcmp(T, "END_OF_TEXT")) {
        for (i = 0; T[i]; i++) {
            T[i] = tolower(T[i]);
        }
        if (!strcmp(W, T)) {
            count++;
        }
    }
    printf("%d\n", count);
    return 0;
}

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

int main(){

    int N;
    cin >> N;

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

    bool flg = true;
    int cnt = 0;
    while (flg){

        for (int i=0; i<N; i++){
            if ((A.at(i))%2 != 0) flg = false;
        }
        if (flg == false) break;

        for (int i=0; i<N; i++){
            A.at(i) = A.at(i) >> 1;
//            A.at(i) /= 2;
        }
        cnt++;
    }

    cout << cnt << endl;
    return 0;
}

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

int main() {
  int a,b,k,n,t = 0;
  cin >> a >> b >>k;
  if(a >= b){
    n = b;
    for(n;n > 0;n--){
      if(a%n == 0 && b%n == 0){
        t++;
      }
      if(t == k){
        cout << n << endl;
        break;
      }
    }
  }
  else{
    n = a;
    for(n;n > 0;n--){
      if(a%n == 0 && b%n == 0){
        t++;
      }
      if(t == k){
        cout  << n << endl;
        break;
      }
    }
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //GCC5.4.1で配列の範囲外アクセスをエラーにする

//cmdで g++ test.cpp とするとコンパイルできる
//制限1秒なら10^6は余裕 10^7は多分間に合う 10^8はよほど単純でないと厳しい
// https://github.com/atcoder/live_library
// cppdbg: test.exeのterminalに標準入力を打てる

#define ALL(x) x.begin(),x.end()
#define get_tp(t,i) get<i>(t)
#define len(x) (ll)(x.size())
#define ub(a,x) (upper_bound(ALL(a),x)-a.begin())
#define lb(a,x) (lower_bound(ALL(a),x)-a.begin())
typedef long long ll; //long long
typedef pair<int,int> pii; //pair<int,int>
typedef pair<long long,long long> pllll; //pair<ll,ll>
typedef vector<int> vi; //vector<int>
typedef vector<vector<int>> vvi; //vector<vector<int>>
typedef vector<ll> vll; //vector<long long>
typedef vector<vector<ll>> vvll; //vector<vector<long long>>
typedef priority_queue<ll, vector<ll>, greater<ll> > gpq; //逆順priority_queue
typedef priority_queue<ll> pq;

//const int MOD=998244353;
const int MOD=1000000007; //10^9+7
const long double PI=3.1415926535897932;

int main(){
    int a,b;cin>>a>>b;
    cout<<max(a+b,max(a-b,a*b))<<endl;
}

Measured memory_bytes: 3580
#include <bits/stdc++.h>
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define reprrev(i,a,b) for(int i=b-1;i>=a;i--) // [a, b)
#define reprev(i,n) reprrev(i,0,n)
typedef long long ll;
typedef unsigned long long ull;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    cin.tie(0);
    ios::sync_with_stdio(false);<- これら、printfとかと併用しない方が良さそう

*/

const ll mod = 1e9+7;

void chmod(ll &M){
    if(M >= mod) M %= mod;
    else if(M < 0){
        M += (abs(M)/mod + 1)*mod;
        M %= mod;
    }
}

ll modpow(ll x, ll n){
    if(n==0) return 1;
    ll res=modpow(x, n/2);

    if(n%2==0) return res*res%mod;
    else return res*res%mod*x%mod;
}

int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };


// 線分 ab の偏角 返り値は[-π, π]
double argument(const pair<double, double> &a, const pair<double, double> &b){
    double ax=a.first, ay=a.second, bx=b.first, by=b.second;
    return atan2(by-ay, bx-ax);
}

/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */

ll dp[55][55][2555];
const int VMAX = 2500;

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

    int N, A; cin >> N >> A;
    vector<int> x(N);
    rep(i, N) cin >> x[i];

    dp[0][0][0] = 1;

    rep(i, N) rep(j, N) rep(k, VMAX+1){
        dp[i+1][j][k] += dp[i][j][k];
        dp[i+1][j+1][k+x[i]] += dp[i][j][k];
    }

    ll ans = 0;
    repr(j, 1, N+1) ans += dp[N][j][j*A];
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 56448
use std::io::{stdin, Read, StdinLock};
use std::str::FromStr;

#[allow(dead_code)]
struct Scanner<'a> {
    cin: StdinLock<'a>,
}
#[allow(dead_code)]
impl<'a> Scanner<'a> {
    fn new(cin: StdinLock<'a>) -> Scanner<'a> {
        Scanner { cin: cin }
    }

    fn read<T: FromStr>(&mut self) -> Option<T> {
        let token = self.cin.by_ref().bytes().map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        token.parse::<T>().ok()
    }

    fn input<T: FromStr>(&mut self) -> T {
        self.read().unwrap()
    }
}

fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin);

    let s: String = sc.input();

    let patterns = ["eraser", "erase", "dreamer", "dream"];
    let s = patterns.iter().fold(s, |s, x| s.replace(x, ""));

    println!("{}", if s.is_empty() {"YES"} else {"NO"});
}


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

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
  
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
 
#define FS              ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll              long long int
#define ld              long double
#define pb              push_back
#define bp              __builtin_popcount
#define sz              size()
#define ff              first
#define ss              second
#define vll             vector<ll>
#define vbool           vector<bool>
#define vpll            vector<pair<ll,ll>>
#define pll             pair<ll,ll>
#define vllv            vector<vector<ll>>
#define setpri(x)       cout<<setprecision(x)<<fixed;
#define all(v)          v.begin(),v.end()
#define allr(v)         v.rbegin(),v.rend()
#define yesr {cout<<"YES"<<endl;return;}
#define nor {cout<<"NO"<<endl;return;}
// getline (std::cin,name);
ll MOD=1e9+7;
ll ceil1(ll n,ll x){return (n-1)/x+(n>0);}

ll gcd(ll a,ll b){return __gcd(a,b);}
ll lcm(ll a,ll b){return (max(a,b)/gcd(a,b))*min(a,b);}

ll pow1(ll n,ll m ,ll mod=MOD );
ll pow2(ll n,ll k);

ll modinv(ll n,ll mod=MOD){  return pow1(n,mod-2,mod);}

bool func(pair<ll,ll> &a,pair<ll,ll> &b ){
        if(a.ff != b.ff)return a.ff < b.ff;
        return a.ss > b.ss;
}

ll const N=(ll)2e6+11;
ll const LG=(ll)log2(N)+1;


void solve(){
        ll i,j,k,l,n,m,x,y,z,r;
        
        string s;
        cin>>s;
        
        ll ans=0;
        ll c=0;
        for(i=0;i<3;i++){
                if(s[i]=='R'){
                        c++;
                        ans=max(ans,c);
                }else{
                        c=0;
                }
        }
        cout<<ans<<endl;
        
        
        
}       
int main(){
        FS;
        
        ll i,j,k,n,m,x,y,z,q;
        q=1;
        // cin>>q;
        for(ll tc=1;tc<=q;tc++){
                // cout<<"Case #"<<tc<<": ";
                solve();
        }
        return 0;
}


ll pow1(ll n,ll m,ll mod){
        if(m==0)return 1;
        
        if(m%2==0)return pow1((n*n)%mod,m/2,mod);
    	
    	return (pow1((n*n)%mod,m/2,mod)*n)%mod;
}

ll pow2(ll n,ll k){
        ll ans=1;
            while(k>0){
                if(k%2==1)ans=ans*n;
                n=n*n;
                k/=2;
            }
            return ans;
}


Measured memory_bytes: 3620
#include<cstdio>
#include<cstring>

#define MAXN 1000000
#define MOD 1000000007
char str[MAXN+5];
long long Pow[MAXN+5];
long long A[MAXN+5],C[MAXN+5],M[MAXN+5],N[MAXN+5];

int main(){
    Pow[0]=1;
    for(int i=1;i<=MAXN;i++)//初始化3的幂
        Pow[i]=Pow[i-1]*3%MOD;
    scanf("%s",str+1);
    int len=strlen(str+1);
    for(int i=1;i<=len;i++){
        A[i]=A[i-1]+(str[i]=='A');
        M[i]=M[i-1]+(str[i]=='?');
    }
    for(int i=len;i>=1;i--){
        C[i]=C[i+1]+(str[i]=='C');
        N[i]=N[i+1]+(str[i]=='?');
    }//计算前后缀和
    long long Ans=0;
    for(int i=1;i<=len;i++){
        if(str[i]=='B'||str[i]=='?'){//问号当成B
            Ans=(Ans+
                 A[i]*C[i]*Pow[M[i-1]%MOD+N[i+1]]%MOD+
                 A[i]*N[i+1]%MOD*Pow[M[i-1]+N[i+1]-1]%MOD+
                 C[i]*M[i-1]%MOD*Pow[M[i-1]+N[i+1]-1]%MOD+
                 Pow[M[i-1]+N[i+1]-2]*M[i-1]%MOD*N[i+1])%MOD;
                 //几种情况
        }
    }
    printf("%lld",Ans);
}


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

ll modinv(ll a,ll m){
   ll b=m,u=1,v=0;
   while(b){
      ll t=a/b;
      a-=t*b; 
      swap(a,b);
      u-=t*v; 
      swap(u,v);
   }
   u%=m;
   if(u<0) u+=m;
   return u;
}

ll gcd(ll x,ll y){
   if(y==0) return x;
   else return gcd(y,x%y);
}
ll lcm(ll x,ll y){
   return x/gcd(x,y)*y;
}



int main(){
   int n;
   cin>>n;
   vector<tuple<string,int,int>> g;
   rep(i,n){
      string s;
      int x;
      cin>>s>>x;
      g.push_back(make_tuple(s,-x,i+1));
   }
   sort(g.begin(),g.end());

   rep(i,n){
      cout<<get<2>(g[i])<<endl;
      
   }


   return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using  namespace std;
typedef long long ll;
#define RAP(i, n) for(ll i=0;i<(n);i++)
#define FOR(i, a, b) for(ll i=(a);i<(b);i++)

#include <iostream>
#include <vector>
using namespace std;

//重複順列
vector<ll> buf;
void permutation(ll i, const ll size, const ll range_start, const ll range_end)
{
    if (i == size) {
      // ここで所望の作業を行う
      for(ll itr:buf){
        cout << itr;
      }
    }
    else{
        for(ll j = range_start; j <= range_end; ++j){
            buf[i] = j;
            permutation(i + 1, size, range_start, range_end);
        }
    }
}

int main(void)
{
   ll n, a, q, b, c, ans=0, changeB, changeC;
 unordered_map<ll, ll> mp;
 cin >> n;
 RAP(i,n){
   cin >> a;
   mp[a]++; 
 }
 cin >> q;
 for(auto itr = mp.begin(); itr != mp.end(); ++itr) {
        ans += itr->first * itr->second;
   } 
 RAP(i, q){
   cin >> b >> c;
   changeB = b * mp[b];
   changeC = c * mp[b];
   ans = ans-changeB+changeC;
   mp[c] += mp[b];
   mp[b] = 0;
   cout << ans << endl;
 }
 
 return 0;
}


Measured memory_bytes: 7056
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <math.h>
#include <time.h>
using namespace std;
int main() {
	long long int n, a[100], cnt = 0, yan = 0;
	long long int b[20] = {};
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		if (b[a[i] / 400] == 0&&a[i]<3200) {
			b[a[i] / 400] = 1;
		}
		if (a[i] >= 3200) {
			cnt++;
		}
	}
	for (int i = 0; i < 8; i++) {
		if (b[i] ==1 ){
			yan++;
		}
	}
	if (yan == 0) {
		cout << 1 << " " << yan + cnt << endl;
	}
	else {
		cout << yan << " " << yan + cnt << endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
const int mod = 1e9 + 7;

int main(){
	lint n;
	cin >> n;
	lint dap = n / 11;
	dap *= 2;
	if(n % 11 <= 0) dap += 0;
	else if(n % 11 <= 6) dap += 1;
	else dap += 2;
	cout << dap << endl;
}


Measured memory_bytes: 256
import sys
from collections import OrderedDict

data = OrderedDict()                                                              
for line in sys.stdin:                     
    lst = line.split(' ')
            
    if len( lst ) < 2:
        cnt = 0            
        for key, val in data.items():
            if val >= 1000000:
                print key
                cnt = cnt + 1
                                               
        if len( data ) != 0 and cnt == 0:
            print "NA"
                                               
        if lst[0] == 0:
            break
                                                         
        data = OrderedDict()
        continue
                                                  
    lst = map(int, lst)
    if lst[0] in data:
        data[ lst[0] ] = data[ lst[0] ] + lst[1]*lst[2]
    else:
        data[ lst[0] ] = lst[1]*lst[2]

sys.exit(0)

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

using namespace std;

map <string,int> mp;

long long power(long long n,long long m)
{
    long long tmp=1;
    long long bas=n;
    while(m)
    {
        if(m&1) tmp*=bas;
        bas*=bas;
        m=m>>1;
    }
    return tmp;
}

int main()
{
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    if(a+b>c+d) puts("Left");
    else if(a+b<c+d) puts("Right");
    else puts("Balanced");
    return 0;
}


Measured memory_bytes: 256
def printRectangle(h, w) : 
    for i in range(0, h) :  
        for j in range(0, w) : 
            if (i == 0 or i == h-1 or j== 0 or j == w-1) : 
                print("#",end="") 
            else : 
                print(".",end="") 
        print('')
    print('')
for j in range(30):
    h, w = map(int, input().split())
    if h == 0 and w == 0:
        break
    else:
        printRectangle(h, w)  


Measured memory_bytes: 7020
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define f(i,x,n) for(int i=x;i<n;i++)
#define all(c) c.begin(),c.end()
#define int ll
#define print(x) cerr << (#x) << "is "<< x << "\n"
using ll = long long;
using pii = pair<int,int>;
const int MOD = 1e9+7, N = 1e5 + 10; 

int32_t main(){
   ios::sync_with_stdio(false);
   cin.tie(NULL);
   int a,b,c;
   cin >> a >> b >> c;
   int ar = a*b;
   cout << ar/2 << '\n';
   return 0;
} 

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

#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

#define MAXX 200005


#define PI 3.14159265358979323846264338327950

#define ll  long long int
vector<ll> v;
multiset<ll> ms;
multiset<ll>::iterator it;
ll d[MAXX], b[MAXX];
ll mod = 1000000007;
char c[MAXX];

int main()
{
	FAST;
	ll  ans = 0, a1 = 0, a2 = 0;
	double n, m, lo;
	cin >> n >> m;
	lo = n/ m;
	cout << fixed << setprecision(10) << lo;
}

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

signed main() {
    string S;
    cin >> S;

    int cnt = 0, ans = 0;
    for (char c : S) {
        cnt++;
        cnt *= (c == 'A' || c == 'G' || c == 'C' || c == 'T');
        ans = max(ans, cnt);
    }
    cout << ans << endl;
}


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

all_ch = set(range(1, N+1))
have_snack = set()
for i in range(K):
    _ = input()
    kid_have_sn_arr = list(map(int, input().split(" ")))
    for id in kid_have_sn_arr:
        have_snack.add(id)

donthave = all_ch - have_snack
print(len(donthave))

Measured memory_bytes: 9220
a, b, k = map(int, input().split())

n_takahashi = a
n_aoki = b
for i in range(k):
    if i % 2 == 0:
        # Takahashi
        if n_takahashi % 2:
            n_takahashi -= 1
        n_aoki += n_takahashi / 2
        n_takahashi = n_takahashi / 2
    else:
        if n_aoki % 2:
            n_aoki -= 1
        n_takahashi += n_aoki / 2
        n_aoki = n_aoki / 2

print(int(n_takahashi), int(n_aoki))

Measured memory_bytes: 3060
import collections as cl

N = int(input())
sticks = [int(i) for i in input().split()]

sticks.sort(reverse=True)

w = 0
h = 0

for k,v in sorted(cl.Counter(sticks).items(), key=lambda x: x[0], reverse=True):
    if (v < 2) :
        continue
    
    if (v >= 4) :
        # 4本以上あれば正方形が作れる
        if (w == 0) :
            w = k
            h = k
        else :
            h = k
        break
    
    if (v >= 2) :
        if (w == 0) :
            w = k
        else :
            h = k
            break


print(w*h)

Measured memory_bytes: 22436
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pint;
const int dx[] = {-1, 0, 0, 1, -1, -1, 1, 1};
const int dy[] = {0, -1, 1, 0, -1, 1, -1, 1};
const ll mod = 1e9 + 7;
const int intmax = 0x7fffffff, intmin = ~intmax;
const ll llmax = 0x7fffffffffffffffll, llmin = ~llmax;

int main() {
  double r;
  cin >> r;
  cout << 3 * r * r << endl;
}


Measured memory_bytes: 764
#include<stdio.h>
int main()
{
  int n=0,y=0,sen=0,gosen=0,man=0,flag=0;
  scanf("%d %d",&n,&y);
  for(sen=0;sen<=n;sen++){
    for(gosen=0;gosen<=n;gosen++){
      man=n-(sen+gosen);
      if(sen*1000+gosen*5000+man*10000==y&&
         sen+gosen+man==n&&man>=0){        
  printf("%d %d %d",man,gosen,sen); return 0; }
    }    
  }
  printf("-1 -1 -1");
    return 0;
  }


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

#define ll long long
#define ii pair<int, int>
#define dd pair<double, double>
#define pb(i) push_back(i)
const double PI = 3.14159265359;
const int inf = 1e9+77;
const ll mod = 1e9+7;
const double eps = 1e-7;
//int dir1[8] = {0, 0, 1, -1, 1, -1, 1, -1};
//int dir2[8] = {1, -1, 0, 0, 1, 1, -1, -1};
int dir1[4] = {0, 0, 1, -1};
int dir2[4] = {1, -1, 0, 0};

int main()
{
	int i, j;

	int ind = 0;
	string s[2], mid;
	cin >> mid;
	s[0] = "", s[1] = "";

	int q; cin >> q;
	while(q--)
	{
		int a, b;
		char c;
		
		cin >> a;
		if(a == 1)
			ind = (ind+1)%2;
		else
		{
			cin >> b >> c;
			if(b == 1)
				s[ind] += c;
			else
				s[(ind+1)%2] += c;
		}
	}

	for(i = s[ind].size()-1; i > -1; i--)
		cout << s[ind][i];
	
	if(ind == 0)
		cout << mid;
	else
		for(i = mid.size()-1; i > -1; i--)
			cout << mid[i];
	
	cout << s[(ind+1)%2] << '\n';

}

Measured memory_bytes: 3952
#include <bits/stdc++.h>
using namespace std;
#define lp(i, x, n) for (int i = x; i < (int)n; ++i)
#define all(v) (v).begin(), (v).end()
#define sz(v) (int)(v).size()
#define ll unsigned long long
#define N 100001
#define mod 1000000007
int main() {
        int n;
        set<int> st;
        cin >> n;
        lp(i, 0, n) { int a; cin >> a; st.insert(a); }
        cout << sz(st);
        return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
string s;
int main(){
	int x=0,y=0;
	cin>>s;
	for(int i=0;i<s.size();i++)
	if(s[i]=='A'){
		x=i;
		break;
	}
	for(int i=s.size()-1;i>=0;i--)
	if(s[i]=='Z'){
		y=i;
		break;
	}
	cout<<y-x+1<<"\n";
	return 0;
}

Measured memory_bytes: 640
import java.io.IOException;

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws IOException {
        try (
            BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in))) {
            final String s = reader.readLine();

            final String sl[] = s.split(" ");
            int A = Integer.parseInt(sl[0]);
            int B = Integer.parseInt(sl[1]);
            int X = Integer.parseInt(sl[2]);


            System.out.println(A <= X && X <= A + B ? "YES" : "NO");
        }
    }
}


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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
	return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
	for(auto &e:u) fill_v<T>(e,v...);
}

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int64 N;
	string X;
	cin >> N >> X;

	int64 cnt = 0;
	REP(i, X.size()) cnt += X[i] == '1';
	if (cnt == 0) {
	  REP(i, N) {
	    cout << 1 << endl;
	  }
	  return 0;
	} else if (cnt == 1) {
	  REP(i, N) {
	    if (X[i] == '1') {
	      cout << 0 << endl;
	    } else {
	      cout << ((i == N-1) ? 2 : 1) << endl;
	    }
	  }
	  return 0;
	}

	vector<int64> l(N, 0), l0(N+1, 0);
	// l1はそのbitが1のときのそのbitの寄与 l0は逆
	int64 now[3] = {1 % (cnt - 1), 1, 1};
	REP(i, N) {
	  if (X[N - i - 1] == '1') {
	    l[N - i - 1] = now[0];
	    l0[i] = now[0];
	  } else {
	    l[N - i - 1] = now[2];
	    l0[i] = now[1];
	  }
	  REP(j, 3) {
	    now[j] = now[j] * 2 % (cnt + j - 1);
	  }
	}
	int64 def[3] = {0, 0, 0};
	REP(i, N) {
	  REP(j, 3) {
      def[j] = (def[j] * 2 + (X[i] - '0')) % (cnt + j - 1);
    }
	}
	REP(i, N) {
	  int64 num = 0;
	  if (X[i] == '0') {
	    num = (def[2] + l[i]) % (cnt + 1);
	  } else {
	    num = ((def[0] - l[i]) % (cnt - 1) + (cnt - 1)) % (cnt - 1);
	  }
	  int res = 1;
	  while (num != 0) {
	    num %= __builtin_popcountll(num);
	    res++;
	  }
	  cout << res << endl;
	}
}


Measured memory_bytes: 6752
n_in = int(input()) 
t = [int(input()) for i in range(n_in)] 

p = t[0]
for i in range(1, len(t)):
    q = t[i]

    if p >= q:
        m, n = p, q
    else:
        m, n = q, p

    while True:
        mod_value = m % n
        if mod_value  == 0:
            break

        m = n
        n = mod_value

    p = p//n * q

print(p)

Measured memory_bytes: 3064
#include <stdio.h> 
#include <limits.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#define n_max 1000000
#define c_max 2000000
    
 
int A[2000000]; 
int n; 

int p_9ar_k_in(int i) ;
int muki_bec_le_9(int i);
int muki_bec_ri_9(int i);
void o_check1_kaisuu();
void o_ch_kaisuu();
void k_hep_max_9(int i);
void k_hep_bui_9();
void k_hep_Inc_key_9(int i,int key) ;
void k_hep_ins_ma_9(int key) ;
int k_hep_ext_9() ;
void k_hep();
void ck();

int main() { 
  int t; 
  char s[10],oi[n_max],lo[n_max];
  for(int i=0;i<n_max;i++){
  k_hep();
  ck();
  }
  while(1){ 
    scanf("%s",s); 
    if(s[2]=='s') 
      { 
	scanf("%d",&t); 
	k_hep_ins_ma_9(t); 
      } 
    if(s[2]=='t') 
      { 
	printf("%d\n",k_hep_ext_9()); 
      } 
    if(s[2]=='d') 
      { 
	break; 
      } 
  } 
  return 0; 
} 


int p_9ar_k_in(int i){ 
  return i/2; 
}  
int muki_bec_le_9(int i) { 
  return 2*i; 
} 

int muki_bec_ri_9(int i) { 
  return 2*i+1; 
}  


void k_hep_max_9(int i) { 
  int l = muki_bec_le_9(i); 
  int r = muki_bec_ri_9(i); 
  int largest,temp; 
  if( l <= n && A[l] > A[i]) 
    { 
      largest = l; 
    } 
  else 
    { 
      largest = i; 
    } 
  if(r <= n && A[r] > A[largest]) 
    { 
      largest = r; 
    } 
  if (largest != i) 
    { 
      temp = A[i]; 
      A[i] = A[largest]; 
      A[largest] = temp; 
      k_hep_max_9(largest); 
    } 
} 

void k_hep_bui_9() { 
  int i; 
  for( i = n/2;i>0;i--) 
    { 
      k_hep_max_9(i); 
    } 
} 


void k_hep_Inc_key_9(int i,int key) { 
  int tmp; 
  if (key < A[i]) 
    { 
      return; 
    } 
  A[i] = key; 
  while (i > 1 && A[p_9ar_k_in(i)] < A[i]) 
    { 
      tmp = A[i]; 
      A[i] = A[p_9ar_k_in(i)]; 
      A[p_9ar_k_in(i)]= tmp; 
      i = p_9ar_k_in(i); 
    } 
} 


void k_hep_ins_ma_9(int key) { 
  n = n + 1; 
  A[n] = INT_MIN; 
  k_hep_Inc_key_9(n,key); 
} 



int k_hep_ext_9() { 
  int max; 
  if ( n < 1) 
    { 
      return 0; 
    } 
  max = A[1]; 
  A[1] = A[n]; 
  n = n - 1; 
  k_hep_max_9(1); 
  return max; 
}

void k_hep(){
  int i=100;
  int size=1000*1000*100;
  char *chek;
  for(int j=0;j<n_max;j++){
    chek=(char *)malloc(sizeof(char)*size);
    chek[j]='y';
  }
  
}


void o_check_kaisuu(void){
  int i=0;
  int m=9;
  int check[5000000000];
  for(i=0;i<9;i++){
    m=m*m;
  }
  for(i=0;i<m;i++){
    check[i]=m;
  }
}

void o_ch_kaisuu(void){
  int i=0;
  int m=8;
  int check[5000000000];
  for(i=0;i<8;i++){
    m=m*m;
  }
  for(i=0;i<m;i++){
    check[i]=m;
  }
}

void ck(){
  char gg[n_max],js[n_max];
  for(int i=0;i<n_max;i++){
    k_hep();
  }
}





Measured memory_bytes: 5704
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod = 1000000007;
ll modpow(ll n, int k) {
	ll r = 1;
	while (k > 0) {
		if (k&1) (r *= n) %= mod;
		(n *= n) %= mod;
		k >>= 1;
	}
	return r;
}
int main() {
	int K;
	cin >> K;
	int N = 3;
	vector<ll> a(K+1);
	ll res = 0;
	for (int k = K; k >= 1; -- k) {
		ll r = modpow(K/k, N);
		for (int i = 2*k; i <= K; i += k) {
			r = (r+mod-a[i])%mod;
		}
		a[k] = r;
		res = (res + r * k) % mod;
	}
	cout << res << endl;
}


Measured memory_bytes: 3628