akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define fs first
#define sc second
using namespace std;
typedef long double D;
typedef complex<D> P;
typedef pair<P,D> C;

const D EPS = 1e-8;
int n;
D x[11],y[11],l[11];

inline P unit(P p){return p/abs(p);}
inline P rotate(P v, D s){
  return P(real(v)*cos(s) - imag(v)*sin(s), real(v)*sin(s) + imag(v)*cos(s));
}
inline D arg(D a, D b, D c){return acos( (b*b+c*c-a*a)/(2*b*c) );}

inline int cpr(C a, C b){
  D d = abs(a.fs - b.fs);
  if(a.sc+b.sc + EPS < d)return -1;
  if(b.sc+d + EPS < a.sc)return 1;
  if(a.sc+d + EPS < b.sc)return 2;
  if(abs(a.sc+b.sc - d) < EPS)return -3;
  if(abs(b.sc+d - a.sc) < EPS)return 3;
  if(abs(a.sc+d - b.sc) < EPS)return 4;
  return 0;
}

inline vector<P> cross_point(C a, C b){
  vector<P> v;
  int pos = cpr(a,b);
  if(pos==0){
    D s = arg(b.sc, abs(b.fs-a.fs), a.sc);
    P x = a.sc * unit(b.fs - a.fs);
    v.push_back(a.fs + rotate(x,s));
    v.push_back(a.fs + rotate(x,-s));
  }else if(abs(pos) >= 3){
    v.push_back(a.fs + a.sc * unit(b.fs-a.fs));
  }
  return v;
}

bool check(D hight){
  //cerr << hight << endl;
  for(int i=0;i<n;i++){
    if(l[i]+EPS<hight)return false;
  }

  C c[11];
  for(int i=0;i<n;i++){
    c[i] = C(P(x[i],y[i]),sqrt(l[i]*l[i]-hight*hight));
  }

  vector<P> vp;
  for(int i=0;i<n;i++){
    vp.push_back(c[i].fs);
    for(int j=i+1;j<n;j++){
      vector<P> cp = cross_point(c[i],c[j]);
      for(int k=0;k<(int)cp.size();k++)vp.push_back(cp[k]);
    }
  }

  for(int j=0;j<(int)vp.size();j++){
    bool f = true;
    for(int i=0;i<n;i++){
      D dis = abs(vp[j]-c[i].fs);
      if(dis*dis + hight*hight > l[i]*l[i] + EPS){
	f = false;
	break;
      }
    }
    if(f)return true;
  }
  return false;
}

int main(){
  while(cin >> n, n){
    for(int i=0;i<n;i++)cin >> x[i] >> y[i] >> l[i];

    D lb = 0, ub = 1000;
    for(int z=0;z<100;z++){
      D mid = (lb+ub)/2;
      if(check(mid))lb = mid;
      else ub = mid;
    }

    cout << fixed << setprecision(7) << lb << endl;
  }
}

Measured memory_bytes: 1332
#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 PB push_back
#define F first
#define S second
#define MP make_pair
#define READ cin >>
#define PRINT cout <<

using namespace std;
void debug_out(){ cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T){
  cout << H << " ";
  debug_out(T...);
}
// 効率的に累乗を求める
// O(log n)

#ifdef _DEBUG
#define debug(...) debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

typedef long long ll;
typedef unsigned long long ul;
typedef pair<ll, ll> P;
// 1s間で可能なループ回数2E+8回
// intの最大値2147483647~2E+9
// long longの最大値9223372036854775807〜9E+18
// 総和accumulate
// 単純リストvector<> push_back
// 連想配列map<key,value> insert,
// pair キーとバリューを格納 firstとsecondでアクセス
// 小数点指定 cout << fixed << setprecision(15) << endl;
// to_string<->stoi
// stoll(longlong)
// stod(double)
// 大文字65-90(-32)
// 小文字97-122(+32)
// 1E+9 +7
const ll mod = 1000000000+7;
ll e_gcd(ll a, ll b)
{
    return b != 0 ? e_gcd(b, a % b) : a;
} 
ll modpow(ll a, ll n){
  ll res=1;
  while(n>0){
    if(n & 1) res = res*a%mod;
    a=a*a%mod;
    n >>= 1;
  }
  return res;
}

int main(){
  // faster
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  int n; cin >> n;
  map<P, P> d;
  rep(i, n){
    bool f_or_s = false;
    ll a, b; cin >> a >> b;
    // debug_out(a,b);
    if((a>0 and b>0) or (a<0 and b<0)){
      f_or_s = false;
      a=abs(a);
      b=abs(b);
      ll gcd = e_gcd(a,b);
      a/=gcd;
      b/=gcd;
    }else if((a>0 and b<0) or (a<0 and b>0)){
      f_or_s = true;
      swap(a, b);
      a=abs(a);
      b=abs(b);
      ll gcd = e_gcd(a,b);
      a/=gcd;
      b/=gcd;
    }else if(a==0 and b==0){
      f_or_s = false;
    }else{
      f_or_s = a>0;
      a=1;b=0;
    }
    P p=P(a,b);
    if(d.count(p)==0) d[p] = P(0,0);
    if(f_or_s) d[p].F++;
    else d[p].S++;
  }
  ll res=1;
  ll z=0;
  for(pair<P,P> i:d){
    if(i.F.F==0 and i.F.S == 0){
      z=i.S.F + i.S.S;
      continue;
    }
    res*=modpow(2,i.S.F)+modpow(2,i.S.S)-1;
    res%=mod;
    // debug_out(res,mod);
    // debug_out(i.F.F, i.F.S, i.S.F, i.S.S);
  }
  cout << (res+z+mod-1)%mod << endl;
  
  return 0;
}


Measured memory_bytes: 19108
#include<bits/stdc++.h>
using namespace std;
#define next Next
#define last Last
const int N=1e5+5;
int n,ans,a[N];
/*char buf[1<<21],*p1=buf,*p2=buf;
inline int gc(){return p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++;}*/
#define gc getchar
inline int read()
{
	int ret=0,f=0;char c=gc();
	while(!isdigit(c)){if(c=='-')f=1;c=gc();}
	while(isdigit(c)){ret=ret*10+c-48;c=gc();}
	if(f)return -ret;return ret;
}
signed main()
{
	n=read();
	for(int i=1;i<=n;i++)
	{
		int x=read();
		a[x]++;
	}
	for(int i=1;i<=100000;i++)
		ans=max(ans,a[i-1]+a[i]+a[i+1]);
	cout<<ans;
}

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

int main() {
  ll x, k, d;
  cin >> x >> k >> d;

  while (k > 0) {
    if (x < 0) { x = x * -1; }

    if ((x-d) > 0) {
      ll a = x / d;
      ll b = min(a, k);

      k = k - b;
      x = x - (b*d);
    // (x-d) < 0
    } else {
      // 0 を挟んで、偶数回ループし、同じ地点に戻る
      ll c = k / 2;
      // 1回残っていれば、その分移動する
      ll e = k % 2;

      k = k - (c*2);
      x = x - (e*d);
      k = k - e;
    }
  }

  if (x > 0) {
    cout << x << endl;
  } else {
    cout << (x * -1) << endl;
  }
  return 0;
}

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

class Program {
    static void Main (string[] args) {
        var input = INP();
        int num = TOI(input[0]);
        int sousuu = TOI(input[1]);

        if(sousuu % 2 == 1) {
            CWL("No");
            return;
        }

        if(sousuu > num * 4) {
            CWL("No");
            return;
        }

        if(sousuu < num * 2) {
            CWL("No");
            return;
        }

        CWL("Yes");
    }

    public static List<int> PrimeFactors (int n) {
        var tmpList = new List<int>();
        int i = 2;
        int tmp = n;

        while(i * i <= n) {
            if(tmp % i == 0) {
                tmp /= i;
                tmpList.Add(i);
            } else {
                i++;
            }
        }

        if(tmp != 1) tmpList.Add(tmp);

        return tmpList;
    }

    static string[] INP () {
        return Console.ReadLine().Split(' ');
    }

    static void CWL (string value) {
        Console.WriteLine(value);
    }

    static void CWL (int value) {
        Console.WriteLine(value);
    }

    static void CWL (long value) {
        Console.WriteLine(value);
    }

    static void CWL (float value) {
        Console.WriteLine(value);
    }

    static void CWL (double value) {
        Console.WriteLine(value);
    }

    static int TOI (string str) {
        return int.Parse(str);
    }

    static long TOL (string str) {
        return long.Parse(str);
    }

    static float TOF (string str) {
        return float.Parse(str);
    }

    static double TOD (string str) {
        return double.Parse(str);
    }

    /*static void Main (string[] args) {
        var input = INP();
        var input2 = INP();
        var input3 = INP();

        CWL("dummy");
    }*/
}


Measured memory_bytes: 27516
#include "bits/stdc++.h"
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#ifdef PRINTERS
#include "printers.hpp"
using namespace printers;
#define tr(a)		cerr<<#a<<" : "<<a<<endl
#else
#define tr(a)    
#endif

#define ll          long long
#define pb          push_back
#define mp          make_pair
#define pii         pair<int,int>
#define vi          vector<int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (int)x.size()
#define hell        1000000007
#define endl        '\n'
#define rep(i,a,b)	for(int i=a;i<b;i++)
using namespace std;
using namespace __gnu_pbds;

template<typename T>
using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

int dp[2005][2005];
int psumb[2005*2][2005];
int psumw[2005*2][2005];
int posb[2005];
int posw[2005];

int getsumb(int x1,int y1,int x2,int y2){
	if(x1>x2)swap(x1,x2);
	if(y1>y2)swap(y1,y2);
	return psumb[x2][y2]+psumb[x1-1][y1-1]-psumb[x2][y1-1]-psumb[x1-1][y2];
}

int getsumw(int x1,int y1,int x2,int y2){
	if(x1>x2)swap(x1,x2);
	if(y1>y2)swap(y1,y2);
	return psumw[x2][y2]+psumw[x1-1][y1-1]-psumw[x2][y1-1]-psumw[x1-1][y2];
}

int get(int a,int b){
	if(dp[a][b]>=0)return dp[a][b];
	int ans=INT_MAX;
	if(a)ans=min(ans,getsumb(posb[a]+1,a,4003,1)+(b?getsumw(posb[a]+1,b,4003,1):0)+get(a-1,b));
	if(b)ans=min(ans,(a?getsumb(posw[b]+1,a,4003,1):0)+getsumw(posw[b]+1,b,4003,1)+get(a,b-1));
	return dp[a][b]=(ans==INT_MAX?0:ans);
}
void solve(){
	memset(dp,-1,sizeof dp);
	int N;
	cin>>N;
	rep(i,1,2*N+1){
		char ch;
		int num;
		cin>>ch>>num;
		if(ch=='B')psumb[i][num]++,posb[num]=i;
		else psumw[i][num]++,posw[num]=i;
	}
	rep(i,1,2005*2){
		rep(j,1,2005){
			psumb[i][j]+=psumb[i][j-1];
			psumw[i][j]+=psumw[i][j-1];
		}
		rep(j,1,2005){
			psumb[i][j]+=psumb[i-1][j];
			psumw[i][j]+=psumw[i-1][j];
		}
	}
	cout<<get(N,N)<<endl;
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int t=1;
	// cin>>t;
	while(t--){
		solve();
	}
	return 0;
}

Measured memory_bytes: 79104
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
using ll = long long;
using vi = vector<int>;
using pii = pair<int, int>;

int main()
{
    int n, m;
    cin >> n >> m;
    vector<vi> g(n, vi(n));
    rep(i, m)
    {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        g[a][b] = g[b][a] = 1;
    }
    vi p(n);
    rep(i, n)
    {
        p[i] = i + 1;
    }
    int ans = 0;
    do
    {
        if (p[0] != 1)
            break;
        bool flag = true;
        rep(i, n - 1)
        {
            if (g[p[i] - 1][p[i + 1] - 1] == 0)
                flag = false;
        }
        if (flag)
            ans++;
    } while (next_permutation(all(p)));
    cout << ans << endl;
}

Measured memory_bytes: 3636
#include <iostream>

using namespace std;
#define pi 3.14159265

int main()
{
	long long ans = 0, i = 0, j = 0, k = 0, l = 0;
	long long N, A[100000], B[100000];
	cin >> N;
	for (i; i < N; i++) {
		cin >> A[i] >> B[i];
	}

	for (i = N - 1; i >= 0; i--) {
		if ((A[i] + ans) % B[i] != 0)
			ans += B[i] - (A[i] + ans) % B[i];
	}

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

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
 
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3") 
#pragma GCC optimization ("unroll-loops")
 
// #include <ext/pb_ds/detail/standard_policies.hpp>
using namespace std;
using namespace __gnu_pbds;
// const ll RANDOM = chrono::high_resolution_clock::now().time_since_epoch().count();
// gp_hash_table<int, int> table;
 
#define ll  long long
#define vii vector< ll >
#define pb push_back
#define pii pair<ll,ll>
#define ppi pair<pii,ll>
#define all(x) x.begin(),x.end()
#define S second
#define F first
#define ins insert
#define ld long double
#define lp(l,r) for(i=l;i<=r;++i)
 
#define lpj(l,r) for(j=l;j<=r;++j)
#define lpr(l,r) for(i=r;i>=l;--i)
#define lprj(l,r) for(j=r;j>=l;--j)
 
#define swap(a,b){ auto _t=a;a=b,b=_t;}
#define flush() cout.flush()
#define popcount __builtin_popcount
#define die() return 0;
#define sz() size() 


 
 
#define TRACE
 
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
 
#define MD          1000000007
#define M 			    2011
#define N           14
#define fftmod      998244353
#define EPS         (double)1e-10
 
long long  md=MD;
ll inf=1e18;
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); 
 
 
inline ll exp(ll a,ll b){if(a==0&&b==0)return 1ll;if(a==0)return 0ll;ll r=1LL;while(b>0){if(b&1){r=(r%md)*(a%md);r=(r+md)%md;}b/=2;a=(a%md)*(a%md);a=(a+md)%md;}return (r+md)%md;}
ll gcd(ll a,ll b){if(b==0)return a;if(a==0)return b;return gcd(b,a%b);}
inline ll poww(ll a,ll b){ll r=1LL;while(b>0){if(b&1)r=r*a;b/=2;a=a*a;}return (ll)r;}
 
using cd=complex<double>;
const double PI=acos(-1);
 
inline ll rand(ll l,ll r){
    return l+rng()%(r-l+1);
}

ll a[M];

int main(){
 
     
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
 
 
   // ifstream fin("input.txt");ofstream fout("outut.txt");
    ll t,i,j,m,n,s,z,k,p;string s1,s2;ll q;ll x,y;
    cin>>n>>m;
    p=0;
    for(i=1;i<=m;++i){
      x=i%10;y=i/10;
      if(x>=2&&y>=2&&x*y<=n)++p;
    }
    cout<<p<<"\n";

}



Measured memory_bytes: 256
package main

import (
	"fmt"
)


func main() {
	var n int
	fmt.Scan(&n)
	a := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&a[i]) 
		if a[i] % 2 == 0 {
			if !(a[i] % 3 == 0 || a[i] % 5 == 0) {
				fmt.Println("DENIED")
				return 
			}
		}
	}
	fmt.Println("APPROVED")
}

Measured memory_bytes: 512
#include <stdio.h>

int main(){

int W,H;

while(scanf("%d %d\n", &H, &W)){

if(W == 0 && H == 0) return 0;

for (int i = 0 ; i < H; i++){
for (int j = 0; j < W; j++){
if (i == 0 || i == H-1 || j == 0|| j == W-1)
printf("#");
else printf(".");
}
printf("\n");

}
printf("\n");
}

}


Measured memory_bytes: 2008
import java.util.Scanner;

/**
 * Created by Santa on 2016/10/16.
 */
public class Main {

    static int A;

    static int B;
    static int C;
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        A = scanner.nextInt();
        B = scanner.nextInt();
        C = scanner.nextInt();

        int max = Math.max(A, Math.max(B, C));

        int saA = max - A;
        int saB = max - B;
        int saC = max - C;

        int to = saA + saB + saC;

        System.out.println((to / 2) + (to % 2 == 0 ? 0 : 2));

    }




}



Measured memory_bytes: 21716
def solve2():
    N = int(raw_input())
    xy = [None] * N
    for i in range(N):
        xi, yi = [int(_) for _ in raw_input().split()]
        xy[i] = (xi, yi)
    if N == 1:
        print N
        return
    xy.sort()
    dist = []
    for i in range(N):
        for j in range(i+1, N):
            p = xy[j][0] - xy[i][0]
            q = xy[j][1] - xy[i][1]
            dist.append((p,q))
    dist.sort()
    max_cnt = 0
    cnt = 1
    save = dist[0]
    for i in range(1, len(dist)):
        if dist[i] == save:
            cnt += 1
        else:
            max_cnt = max(cnt, max_cnt)
            cnt = 1
            save = dist[i]
    max_cnt = max(cnt, max_cnt)
    print N - max_cnt

if __name__ == '__main__':
    solve2()


Measured memory_bytes: 30956
#include <bits/stdc++.h>
using namespace std;
//unionfind
typedef pair<int, int> P;
const int MAX_N = 100010;
int m, n;
int par[MAX_N];    //親
int deapth[MAX_N]; //木の深さ
int cnt[MAX_N];
int num;

vector<int> vec[MAX_N];
//n要素で初期化
void init(int n)
{
    for (int i = 0; i < n; i++)
    {
        par[i] = i;
        deapth[i] = 0;
        cnt[i] = 1;
    }
}
//木の根を求める
int find(int x)
{
    if (par[x] == x)
    {
        return x;
    }
    else
    {
        return par[x] = find(par[x]);
    }
}

//xとyの属する集合を併合
void unite(int x, int y)
{
    x = find(x);
    y = find(y);
    if (x == y)
        return;
    if (deapth[x] < deapth[y])
    {
        par[x] = y;
        cnt[y] += cnt[x];
    }
    else
    {
        par[y] = x;
        cnt[x] += cnt[y];
        if (deapth[x] == deapth[y])
            deapth[x]++;
    }
}

bool same(int x, int y)
{
    return find(x) == find(y);
}

int main()
{
    cin >> n >> m;
    init(n + 1);
    vector<P> v;
    for (int i = 0; i < m; i++)
    {
        int x, y, z;
        cin >> x >> y >> z;
        unite(x, y);
    }
    int ans = 0;
    vector<bool> fl(n + 1, false);
    for (int i = 1; i <= n; i++)
    {
        if (fl[find(i)])
        {
            continue;
        }
        fl[find(i)] = true;
        ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3712
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
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; }
int main(){
    ios::sync_with_stdio(false);
    string s1,s2;
    cin >> s1 >> s2;
    if(s1 == s2.substr(0,s1.size()) && s1.size()+1 == s2.size()) {
        cout << "Yes" << endl;
    } else cout << "No" << endl;
}

Measured memory_bytes: 3652
#include <cstdio>
#include <iostream>

using ll = long long;
using namespace std;

int main(void){
    ll A, B, C, K;
    cin >> A >> B >> C >> K;
    if (K % 2 == 0){
        cout << A-B << endl;
    }
    else{
        cout << B-A << endl;
    }
    return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**7)
def input(): return sys.stdin.readline().rstrip()


def main():
    k = int(input())
    cur = 0

    for i in range(1, 10 ** 7):
        cur *= 10
        cur += 7
        cur %= k

        if cur == 0:
            print(i)
            return
    print(-1)


if __name__ == '__main__':
    main()

Measured memory_bytes: 62864
#include<iostream>
#include<vector>

using namespace std;

int n, m;
int s[15][15],k, p;



int main(){
  cin >> n >> m;
  vector<vector<int>> vec(m);
  for(int i = 0; i < m; ++i){
    cin >> k;
    vec[i].resize(k);

    for(int j = 0; j < k; ++j){
      cin >> vec[i][j];
      --vec[i][j];
    }
  }
  vector<int> p(m);
  for(int i = 0; i < m; ++i){
    cin >> p[i];
  }
  int ans = 0;
  for (int i = 0; i < (1 << n); ++i) {
    bool ok = true;
    for (int j = 0; j < m; ++j){
      int c = 0;
      for (int id : vec[j]) {
				if ((i >> id) & 1) {
					++c;
				}
			}
      c %= 2;
			if (c != p[j]) {
				ok = false;
			}
    }
    if (ok) {
			++ans;
		}
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,ll> Pll;
typedef pair<P,P> PP;
#define rep(i,a,n) for(int i = a;i < n;i++)
#define LINF (ll)1e17
#define INF 1e9
#define MOD 1e9+7
#define sMOD 1e5
#define fs first
#define sc second

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


vector<ll> yakusuu;

void yakusuurekkyo(ll num){
	

	rep(i,1,sqrt(num)+10){
		if(num % i == 0){
			yakusuu.push_back(i);
			yakusuu.push_back(num/i);
		}
		
	}

	return ;
}




signed main(){
	
	ll n;
	cin >> n;
	
	ll a[n] = {};
	
	
	rep(i,0,n) cin >> a[i];
	
	
	yakusuurekkyo(a[0]);
	yakusuurekkyo(a[1]);
	
	
	sort(yakusuu.begin(),yakusuu.end(),greater<ll>());
	
	/*
	rep(i,0,yakusuu.size()){
		cout << yakusuu[i] << endl;
	}
	*/
	
	rep(i,0,yakusuu.size()){
		ll cnt = 0;
		rep(j,0,n){
			if(a[j] % yakusuu[i]) cnt++;
			if(cnt >= 2) break;
			else if(j == n-1){
				cout << yakusuu[i] << endl;
				return 0;
			}
		}
	}
	
	
	return 0;

}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count __gcd reverse etc.
#include <cstdlib>	// require abs exit
#include <cstdio>	// require scanf printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream 
#include <cstring>	// require memset
#include <cctype>	// require tolower, toupper
#include <fstream>	// require freopen
#include <ctime>
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()
#define DEBUG 0

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
string FILE_NAME = "testcase.0094_";
string NAME;
string itos (int n )
{
	stringstream ss;
	ss << n;

	return ss.str();
}

int main()
{
//	cut here before submit 
#if DEBUG
	NAME = FILE_NAME;
	int CNT = 1;
	NAME += itos (CNT );
	while (freopen (NAME.c_str() , "r", stdin ) != NULL ) {
#endif
	ios_base::sync_with_stdio(0);
	int a, b; cin >> a >> b;
	double res = (double)a*b/3.305785;
	cout << fixed << setprecision(10) << res << endl;

#if DEBUG
	CNT++;	// cut here before submit
	NAME = FILE_NAME;
	NAME += itos (CNT );
	} // end loop; cut here before submit
#endif			
	return 0;
}

Measured memory_bytes: 1288
parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)
create(x::Int,y::Int)=lpad(string(x),6,'0')*lpad(string(y),6,'0')

function main()
	n,m = readline() |> split |> parseMap
	a = Tuple{Int,Int,Int}[]
	for i in 1:m
		p,y = readline() |> split |> parseMap
		push!(a,(i,p,y))
	end
	a = sort(a,by=x->(x[2],x[3]))
	g = String["" for i in 1:m]
	c = 1
	g[a[1][1]]=create(a[1][2],c)
	for i in 2:m
		if a[i][2]!=a[i-1][2]
			c = 1
		else
			c += 1
		end
		g[a[i][1]]=create(a[i][2],c)
	end
	map(println,g)
end

main()

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

int main() {
	long long int N, W;
	cin >> N >> W;
	vector<vector<long long int>>dp( N + 1, vector<long long int>( W + 1 ) );
	dp[0][0] = 1;
	for( size_t i = 0; i < N; i++ ) {
		long long int v, w;
		cin >> v >> w;
		for( size_t j = 0; j <= W; j++ ) {
			dp[i + 1][j] = max( dp[i + 1][j], dp[i][j] );
			if( j + w <= W&&dp[i][j] ) {
				dp[i + 1][j + w] = max( dp[i + 1][j + w], dp[i][j] + v );
				dp[i][j + w] = max( dp[i][j + w], dp[i][j] + v );
			}
		}
	}
	for( size_t i = 0; i < W; i++ ) {
		dp[N][i + 1] = max( dp[N][i], dp[N][i + 1] );
	}
	cout << max( dp[N][W] - 1, 0LL ) << endl;
}

Measured memory_bytes: 10716
# include <bits/stdc++.h>
# define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>0; --i)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define optimize_cin() cin.tie(0); ios::sync_with_stdio(false)
using namespace std;
using ll = long long;
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 long long INF = 1LL << 60;

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

uintmax_t combination(unsigned int n, unsigned int r) {
  if ( r * 2 > n ) r = n - r;
  uintmax_t dividend = 1;
  uintmax_t divisor  = 1;
  for ( unsigned int i = 1; i <= r; ++i ) {
    dividend *= (n-i+1);
    divisor  *= i;
  }
  return dividend / divisor;
}

int modPow(long long a, long long n, long long p) {
  if (n == 1) return a % p;
  if (n % 2 == 1) return (a * modPow(a, n - 1, p)) % p;
  long long t = modPow(a, n / 2, p);
  return (t * t) % p;
}

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

int main()
{
    double n,k;
    cin >> n >> k;

    double sans = 0;
    double ans;
    double count; 

    reps(i,n){
        double cnt = 1;
        double t = i;
        rep(j,k){
            if(t >= k){
                count = 1/cnt;
                sans+=count;
                break;
            }
            t*=2;
            cnt*=2;
        }
    }

    ans = sans/n;

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

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

Measured memory_bytes: 256
//Only the Creator has given me strength!

#include<cstdio>

#include<sstream>

#include<cstdlib>

#include<cctype>

#include<cmath>

#include<algorithm>

#include<set>

#include<queue>

#include<stack>

#include<list>

#include<iostream>

#include<fstream>

#include<numeric>

#include<string>

#include<vector>

#include<cstring>

#include<map>

#include<iterator>

#include<bitset>

typedef long long ll;

#define pi 3.1415926535897931159979635

#define pb push_back

#define vctr vector < int >

#define vvtr vector < vctr >

using namespace std;

void fastio() {

    ios::sync_with_stdio(0);

    cin.tie(0);

    cout.tie(0);

}

int main() {

    fastio();

    ll mod=1e9+7,n;

    cin>>n;

    ll num[n],sum[n];

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

        sum[i]=0;

        cin>>num[i];

        if(i!=0) sum[i]=sum[i-1]+num[i];

        else sum[i]=num[i];

    }

    ll ans=0;

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

        ans=(ans+num[i]*((sum[n-1]-sum[i])%mod))%mod;

    }

    cout<<ans<<"\n";

    return 0;

}

Measured memory_bytes: 6284
#include <cstdio>
#include <iostream>
#include <string.h> //for strlen
using namespace std;

int main(){
	int count [1000];
	for (int i = 0; i < 1000; i++) count[i] = 0;
	int n,m;
	cin >> n >> m;
	for(int i = 0; i < m; i++){
		int a,b;
		cin >> a >> b;
		count[a]++;
		count[b]++;
	}

	for(int i = 1; i <= n; i++){
		cout << count[i] << endl;
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
#define t97 1000000007

using namespace std;
typedef long long ll;

void dm(vector<vector<ll> >& m) {
    for(ll i = 0; i < m.size(); i++) {
        for(ll j = 0; j < m[i].size(); j++) {
            if(j != m[i].size()-1) {
                cout << m[i][j] << " ";
            } 
            else {
                cout << m[i][j] << endl;
            }
        }
    }
}

void dv(vector<ll>& v) {
    for(ll i = 0; i < v.size()-1; i++) {
        cout << v[i]<<" ";
    }
    cout << v[v.size()-1]<<endl;
}

void swap(ll& a, ll& b) {
    ll temp = a;
    a = b;
    b = temp;
}

ll minval(ll a, ll b) {
    if(a < b) {
        return a;
    }
    return b;
}

ll ans(vector<ll>& v, ll index, ll k, vector<ll>& dp) {
    if(dp[index] != -1) {
        return dp[index];
    }
    if(index == 0) {
        return 0;
    }
    ll sum = LONG_MAX;
    for(ll j = 1; j <= k; j++) {
        if( (index-j) < 0)  {
            break;
        }
        sum = minval(sum, abs(v[index-j]-v[index]) + ans(v, index-j, k, dp));
    }
    dp[index] = sum;
    return dp[index];
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n, k;
    scanf("%lld%lld", &n, &k);
    vector<ll> v(n), dp(n, -1);
    for(ll i= 0; i < n; i++) {
        scanf("%lld", &v[i]);
    }
    cout << ans(v, n-1, k, dp)<<endl;
    
    return 0;
}


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

typedef long long ll;


string a;
const ll INF = 1e18;
ll dp[1000005][2];
int main () {
  string n;
  cin >> n;
  for(int i = 0; i < n.size(); i++) dp[i][0] = dp[i][1] = INF;
  dp[0][0] = 11 - (n[0] - '0');
  dp[0][1] = (n[0] - '0');
  for(int i = 1; i < n.size(); i++) {
    dp[i][0] = min(dp[i-1][0] + (9 - (n[i] - '0')),dp[i-1][1] + (11-(n[i]-'0')));
    dp[i][1] = min(dp[i-1][0]+(n[i]-'0'),dp[i-1][1]+(n[i]-'0'));
  }

  cout << min(dp[n.size()-1][0],dp[n.size()-1][1]) << endl;
}
    

    


Measured memory_bytes: 17028
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a[13],x,y,i;
    for(i=1;i<=12;i++)
    {
        if (i==2) a[i]=28;
        else
            if (i<=7)
            {
                if (i & 1) a[i]=31;
                else a[i]=30;
            }
            else
            {
                if (i & 1) a[i]=30;
                else a[i]=31;
            }
    }
    cin>>x>>y;
    if (a[x]==a[y]) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

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

#define LL long long
#define LD long double
#define INF 1000000000
#define PR pair<int,int>
#define Min(a,b) a=min(a,b)
#define Max(a,b) a=max(a,b)
#define pb push_back
#define mp make_pair

LL N, W;
LL w[105];
LL v[105];
LL dp[105][100005];


int main() {
	cin >> N >> W;
	for (int i = 1; i <= N; i++) {
		cin >> w[i] >> v[i];
	}

	for (int i = 1; i <= N+1; i++) {
		for (int j = 0; j <= W; j++) {
			dp[i][j] = dp[i-1][j];
			if (w[i] <= j)
				dp[i][j] = max(dp[i-1][j], dp[i-1][j-w[i]] + v[i]);
		}
	}

	cout << dp[N][W] << endl;
}

Measured memory_bytes: 79360
from sys import stdin

S=input()
andbit = 2**10 -1
ans = 0
length = 2**(len(S) -1)
    
for i in range (length):
  bitup = andbit & i
  bitcheck = 1
  tmp=0
  for j in range(1,len(S),1):
    if bitup & bitcheck > 0:
      ans += int(S[tmp:j])
      tmp = j
    bitcheck = bitcheck << 1
  ans += int(S[tmp:len(S)])
print(ans)



Measured memory_bytes: 3064
from operator import itemgetter
n,m=map(int,input().split())
data=[]
for i in range(m):
    p_i,y_i=map(int,input().split())
    data.append([p_i,y_i,i])
data.sort()
data.append([n+1,0,m])
buf=1
for i in range(m):
    data[i].append(buf)
    if data[i][0]==data[i+1][0]:
        buf+=1
    else:
        buf=1
data.sort(key=itemgetter(2))
for i in range(m):
    ans_p=data[i][0]
    ans_y=data[i][3]
    ans_p=(str(ans_p)).zfill(6)
    ans_y=(str(ans_y)).zfill(6)
    print(ans_p+ans_y)

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

int main(){
    int s;
    cin >> s;
    set<int> st;
    int x = s;
    while(st.count(x) == 0){
        st.insert(x);
        if(x % 2 == 0){
            x /= 2;
        }else{
            x = x * 3 + 1;
        }
    }
    cout << (st.size()+1) << endl;

    return 0;
}

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

/*
j - i = A[i] + A[j]
j - A[j] = i + A[i]
*/

int main() {
  int n;
  std::cin >> n;
  std::vector<int> A(n);
  for (int i = 0; i < n; i++) std::cin >> A[i];

  std::unordered_map<int, int> M;
  for (int i = 0; i < n; i++) {
    M[i + 1 + A[i]]++;
  }
  ll res{0};
  for (int i = 0; i < n; i++) {
    res += M[(i + 1) - A[i]];
  }
  std::cout << res << std::endl;
  return 0;
}

Measured memory_bytes: 19272
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		int c = scan.nextInt();
		
		if (a == b + c || b == a + c || c == a + b) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 35656
#include<bits/stdc++.h>
using namespace std;
#define MAX 12


int main(){
  int Q, q, n, k;
  unsigned long long bit = 0, count, b, mask[MAX] = {};

  cin>>n;

  for(int i = 0; i < n; i++){
    cin>>k;
    for(int j = 0; j < k; j++){
      cin>>b;
      mask[i] |= 1ll<<b;
    }
  }
  
  cin>>Q;

  for(int j = 0, i; j < Q; j++){
    cin>>q;
    switch(q){
    case 0:
      cin>>i;
      cout<<!!((1ll<<i)&bit)<<endl;
      break;
    case 1:
      cin>>i;
      bit |= mask[i];
      break;
    case 2:
      cin>>i;
      bit &= ~mask[i];
      break;
    case 3:
      cin>>i;
      bit ^= mask[i];
      break;
    case 4:
      cin>>i;
      cout<<((bit&mask[i]) == mask[i])<<endl;
      break;
    case 5:
      cin>>i;
      cout<<(!!(bit&mask[i]))<<endl;
      break;
    case 6:
      cin>>i;
      cout<<(!(bit&mask[i]))<<endl;
      break;
    case 7:
      cin>>i;
      for(count = 0, b = mask[i]&bit; b;b &= b - 1) count++;
      cout<<count<<endl;
      break;
    case 8:
      cin>>i;
      cout<<(bit&mask[i])<<endl;
      break;
    }
  }

  return 0;
}



Measured memory_bytes: 3100
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int n, m;
vector<int> G[5005];
vector<int> topo;
bool used[5005];
int dp[5005];

void tpsort(int v)
{
	used[v] = true;
	for(int i = 0; i < G[v].size(); i++){
		if(!used[G[v][i]]) tpsort(G[v][i]);
	}
	topo.push_back(v);
}

int main(void)
{
	cin >> n >> m;
	int u, v;
	for(int i = 0; i < m; i++){
		cin >> u >> v;
		G[u].push_back(v);
	}
	
	for(int i = 1; i <= n; i++){
		if(!used[i]) tpsort(i);
	}
	reverse(topo.begin(), topo.end());
	
	for(int i = 0; i < topo.size(); i++){
		cout << topo[i] << endl;
	}
	
	for(int i = 0; i < topo.size(); i++){
		for(int j = 0; j < G[topo[i]].size(); j++){
			dp[G[topo[i]][j]] = max(dp[G[topo[i]][j]], dp[topo[i]] + 1);
		}
	}
	
	int ans = 0;
	for(int i = 0; i < topo.size(); i++){
		ans = max(ans, dp[topo[i]]);
	}
	cout << (ans < n-1) << endl;
	
	return 0;
}


Measured memory_bytes: 3844
/**
 * Dont raise your voice, improve your argument.
 * --Desmond Tutu
 */

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

#define DEBUG
#ifndef DEBUG
#define endl "\n"
#define log(args...)
#else
#define log(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); logf(_it, args); }
void logf(istream_iterator<string> it) {
}
template<typename T, typename ... Args>
void logf(istream_iterator<string> it, T a, Args ... args) {
	cout << *it << " = " << a << endl;
	logf(++it, args...);
}
#endif

#define forn(i,k,n) for(ll i=(k); i<(n); i++)

const double PI = acos(-1);
typedef long long ll;
#define fori(n) for(ll i=0; i<(n); i++)

#define cins(s) string s; cin>>s;
#define cini(i) int i; cin>>i;
#define cinll(l) ll l; cin>>l;
#define cind(d) double d; cin>>d;
#define cinai(a, n) vi a(n); fori(n) { cin>>a[i]; }
#define cinall(a, n) vll a(n); fori(n) { cin>>a[i]; }
#define cinas(s, n) vs s(n); fori(n) { cin>>s[i]; }
#define cinad(a, n) vd a(n); fori(n) { cin>>a[i]; }

typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef vector<double> vd;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<string> vs;
typedef vector<ll> vll;

void solve() {
	cins(s);
	string t = "hi";
	if (s.size() % t.size() != 0) {
		cout << "No" << endl;
		return;
	}

	for (int i = 0; i < s.size(); i++) {
		if (s[i] != t[i % t.size()]) {
			cout << "No" << endl;
			return;
		}
	}
	cout << "Yes" << endl;
}

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



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
struct node{
  int key;
  node *left,*right,*p;
  node(){}
  node(int key):key(key){left=right=p=NULL;};
};
node *root;
void insert(node z){
  node *y=NULL;
  node *x=root;
  while(x!=NULL){
    y=x;
    if(z.key<x->key) x=x->left;
    else x=x->right;
  }
  z.p=y;
  if(y==NULL) root=new node(z);
  else if(z.key<y->key) y->left=new node(z);
  else y->right=new node(z);
}
bool find(int z){
  node *x=root;
  while(x!=NULL){
    if(z==x->key) return true;
    if(z<x->key) x=x->left;
    else x=x->right;
  }
  return false;
}
void inorderTreeWalk(node *v){
  if(v==NULL) return;
  inorderTreeWalk(v->left);
  cout<<" "<<v->key;
  inorderTreeWalk(v->right);
}
void preorderTreeWalk(node *v){
  if(v==NULL) return;
  cout<<" "<<v->key;
  preorderTreeWalk(v->left);
  preorderTreeWalk(v->right);
}
signed main(){
  int n;
  cin>>n;
  root=NULL;
  for(int i=0;i<n;i++){
    string s;
    cin>>s;
    //cout<<(root==NULL?-1:root->key)<<endl;
    if(s=="print"){
      inorderTreeWalk(root);
      cout<<endl;
      preorderTreeWalk(root);
      cout<<endl;
      continue;
    }
    int x;
    cin>>x;
    if(s=="insert"){
      insert(node(x));
    }
    if(s=="find"){
      cout<<(find(x)?"yes":"no")<<endl;
    }
  }
  return 0;
}




Measured memory_bytes: 21948
import std.stdio;
import std.algorithm;
import core.stdc.stdio;

static immutable maxM = 5000;

struct t{
	int idx;
	int len;
}

class State{
	int[] sizes;
	t[][] data;
	this(){
		sizes = new int[3];
		data = new t[][3];
		t[] buf = new t[3*(maxM*2+1)];
		for(int i=0;i<3;i++){
			data[i] = buf[i*(maxM*2+1)..(i+1)*(maxM*2+1)];
		}
	}
	void Clear(){
		sizes[] = 0;
	}
}

void main(){
	State now = new State;
	State next = new State;
	
	while(true){
	
	int n,m,p,q,r;
	scanf("%d",&n);
	if(n==0)
		break;
	scanf("%d%d%d%d",&m,&p,&q,&r);
	p--;
	now.Clear;
	now.data[0][now.sizes[0]++] = t(1,n);
	for(int _=0;_<m;_++){
		next.Clear;
		int x,y;
		scanf("%d%d",&x,&y);
		int len=0;
		for(int i=0;i<3;i++){
			for(int j=0;j<now.sizes[i];j++){
				t a = now.data[i][j];
				t b;
				if(len < x){
					if(len+a.len > x){
						b.len = len+a.len-x;
						a.len -= b.len;
						b.idx = a.idx+a.len;
						now.data[i][j] = b;
						j--;
					}
					next.data[2][next.sizes[2]++] = a;
				}else if(len < y){
					if(len+a.len > y){
						b.len = len+a.len-y;
						a.len -= b.len;
						b.idx = a.idx+a.len;
						now.data[i][j] = b;
						j--;
					}
					next.data[1][next.sizes[1]++] = a;
				}else{
					next.data[0][next.sizes[0]++] = a;
				}
				len += a.len;
			}
		}
		swap(now,next);
	}
	int res=0;
	int len=0;
	for(int i=0;i<3;i++){
		for(int j=0;j<now.sizes[i];j++){
			t a = now.data[i][j];
			t b;
			if(len < p){
				if(len+a.len > p){
					b.len = len+a.len-p;
					a.len -= b.len;
					b.idx = a.idx+a.len;
					now.data[i][j] = b;
					j--;
				}
			}else if(len < q){
				if(len+a.len > q){
					a.len = q-len;
				}
				res += max(0,min(a.len,r+1-a.idx));
			}
			len += a.len;
		}
	}
	printf("%d\n",res);
	
	}
}

Measured memory_bytes: 2556
import java.lang.reflect.Array;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(), ret = 0;
        int l[] = new int[n];
        for(int i=0;i<n;i++){
            l[i]=sc.nextInt();
            ret += l[i];
        }
        int m = sc.nextInt();
        for(int i=0;i<m;i++){
            int p = sc.nextInt();
            int x = sc.nextInt();
            System.out.println(ret-l[p-1]+x);
        }
    }
}

Measured memory_bytes: 22100
// abc051_b
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) rep(i,v.size())cout<<" "<<v[i];cout<<endl<<endl;
#define show2d(v) rep(i,v.size()){rep(j,v[i].size())cout<<" "<<v[i][j];cout<<endl;}cout<<endl;
using namespace std;
typedef long long ll;
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int main(int argc, char *argv[])
{
  int k,s,z,cnt=0;
  cin >> k >> s;
  for (int x = 0; x <= k; ++x) {
    for (int y = 0; y <= k; ++y) {
      z=s-x-y;
      if(z<=k && z >= 0) {
        cnt++;
      }
    }
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
#define REP(i, n) for(ll (i) = 0; (i) < (n); (i)++)
#define REPR(i, n) for(ll (i)-1 = (n); (i) >= 0; (i)--)
#define FOR(i, m, n) for(ll (i) = (m); (i) < (n); (i)++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()
#define _GLIBCXX_DEBUG

template <uint MD> struct ModInt {
    using M = ModInt;
    const static M G;
    uint v;
    ModInt(ll _v = 0) { set_v(uint(_v % MD + MD)); }
    M& set_v(uint _v) {
        v = (_v < MD) ? _v : _v - MD;
        return *this;
    }
    explicit operator bool() const { return v != 0; }
    M operator-() const { return M() - *this; }
    M operator+(const M& r) const { return M().set_v(v + r.v); }
    M operator-(const M& r) const { return M().set_v(v + MD - r.v); }
    M operator*(const M& r) const { return M().set_v(uint(ull(v) * r.v % MD)); }
    M operator/(const M& r) const { return *this * r.inv(); }
    M& operator+=(const M& r) { return *this = *this + r; }
    M& operator-=(const M& r) { return *this = *this - r; }
    M& operator*=(const M& r) { return *this = *this * r; }
    M& operator/=(const M& r) { return *this = *this / r; }
    bool operator==(const M& r) const { return v == r.v; }
    M pow(ll n) const {
        M x = *this, r = 1;
        while (n) {
            if (n & 1) r *= x;
            x *= x;
            n >>= 1;
        }
        return r;
    }
    M inv() const { return pow(MD - 2); }
    friend ostream& operator<<(ostream& os, const M& r) { return os << r.v; }
};
using Mint = ModInt<1000000007>;

const double PI = 3.14159265358979323846;

bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}

bool is_prime(long long N) {
    if (N == 1) return false;
    for (long long i = 2; i * i <= N; ++i) {
        if (N % i == 0) return false;
    }
    return true;
}

int main()
{	
    ll a, b, c;
    ll k;
    cin >> a >> b >> c >> k;
    ll cnt = 0;
    bool ok = false;

    while(cnt < k){
        if(a >= b){
            b *= 2;
            cnt++;
            continue;
        }

        if(b >= c){
            c *= 2;
            cnt++;
            continue;
        }

        if(a < b && b < c){
            ok = true;
            break;
        }
    }
    if(a < b && b < c) ok = true;
    if(ok) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 3632
import sys
input = sys.stdin.readline
ri = lambda: int(input())
rl = lambda: [int(x) if x.isdecimal() else x for x in input().split()]
#rl = lambda: list(input().split()))
rr = lambda N: [list(l) for l in zip(*[rl() for _ in range(N)])]
YN = lambda b: print('YES') if b else print('NO')
yn = lambda b: print('Yes') if b else print('No')
OE = lambda x: print('Odd') if x%2 else print('Even')
INF = 10**18
MOD = 10**9+7


N,Q=rl()
TT = []
now = set()
for _ in range(N):
    s,t,x = rl()
    TT.append((s-x-0.5,1,x))
    TT.append((t-x-0.5,-1,x))
for i in range(Q):
    d = ri()
    TT.append((d,0,i))


TT.sort()
mx = INF
mx_f = False
ans = [-1]*Q
for st,w,x in TT:
    if w > 0:
        now.add(x)
        if mx > x:
            mx = x
            mx_f = True
    elif w < 0:
        now.remove(x)
        if mx == x:
            mx_f = False
    elif len(now) > 0:
        if not mx_f:
            mx = min(now)
            mx_f = True
        ans[x] = mx
print(*ans,sep='\n')

Measured memory_bytes: 93692
a=0
arr=[]
while s=gets
  arr[a]=s.split(",").map{|x|x.to_i}
  a+=1
end
#p arr
S=[]
S[0]=[arr[0][0]];
for i in 1..a do
	S[i]=[]
	if i<=a/2
		for j in 0..i do
			x=0;y=0
			if !(j-1<0) then x=S[i-1][j-1] end
			if j<i then y=S[i-1][j] end
			S[i][j]=([x,y].max)+arr[i][j]
			#p S
		end
	else
		for j in 0..a-i-1 do
			x=S[i-1][j+1]
			y=S[i-1][j]
			S[i][j]=([x,y].max)+arr[i][j]
			#p S
			end
		end
end

puts S[a-1]

Measured memory_bytes: 6120
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
#include <cmath>
#include <vector>
#include <queue>
typedef long long ll;
using namespace std;

int main(void){
  string s;
  int r=0,l=0,m,i,j;
  bool b=0;
  cin>>s;

  r=0;
  for(i=0;i<s.length();i++){
    if(b){
      if(s[i]=='R'){
        b=0;

        m=(r+l)/2;
        for(j=0;j<r-1;j++){
          printf("0 ");
        }
        if((r+l)%2==0){
          printf("%d %d ",m,m);
        }
        else if(r%2==0){
          printf("%d %d ",m,m+1);
        }
        else{
          printf("%d %d ",m+1,m);
        }
        for(j=0;j<l-1;j++){
          printf("0 ");
        }

        r=1;
        l=0;
      }
      else{
        l++;
      }
    }
    else{
      if(s[i]=='L'){
        b=1;
        l=1;
      }
      else{
        r++;
      }
    }
  }

  m=(r+l)/2;
  for(j=0;j<r-1;j++){
    printf("0 ");
  }
  if((r+l)%2==0){
    printf("%d %d ",m,m);
  }
  else if(r%2==0){
    printf("%d %d ",m,m+1);
  }
  else{
    printf("%d %d ",m+1,m);
  }
  for(j=0;j<l-1;j++){
    printf("0 ");
  }
  printf("\n");

  return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
long long int ar[1000999];
int main()
{ int a,b;
int cnt=0,k;
    cin>>a>>b;
   while(a>0)
   { k=a%b;
     a=a/b;
     cnt++;
   }
   cout<<cnt<<endl;

}



























Measured memory_bytes: 256
import numpy as np

n,m=map(int,input().split())
a=np.zeros(m,dtype=int)
b=np.zeros(m,dtype=int)
for i in range(m):
    a[i],b[i]=map(int,input().split())
dp=np.zeros(10001,dtype=int)
for i in range(1,10001):
    dp[i]=(dp[i-a]+b).min()
print(dp[n])

Measured memory_bytes: 14528
import sys

N = int(sys.stdin.readline().strip())
X = sys.stdin.readline().strip()

def popcount(n):
    cnt = 0
    while n > 0:
        cnt += n & 1
        n //= 2
    return cnt

def f(n):
    cnt = 0
    while n != 0:
        n = n % popcount(n)
        cnt += 1
    return cnt

#nX = int(X, 2)
pcnt = X.count('1')
MOD1 = pcnt + 1
MOD2 = pcnt - 1

nXp = 0
nXm = 0

pow1 = [1] * N
pow2 = [0] * N
for i in range(1, N):
    pow1[i] = (pow1[i-1] * 2) % MOD1
if MOD2 != 0:
    pow2[0] = 1
    for i in range(1, N):
        pow2[i] = (pow2[i-1] * 2) % MOD2

for i in range(N):
    if X[i] == '1':
        nXp += pow1[N-1-i]
nXp %= MOD1

if MOD2 != 0:
    for i in range(N):
        if X[i] == '1':
            nXm += pow2[N-1-i]

    nXm %= MOD2
    

for i in range(0, N):
    if X[i] == '0':
        k = (nXp + pow1[N-1-i]) % MOD1
        print(f(k) + 1)
    else:
        if MOD2 == 0:
            print(0)
        else:
            k = (nXm - pow2[N-1-i]) % MOD2
            print(f(k) + 1)

Measured memory_bytes: 25292
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <algorithm>
#include <string>
#include <sstream>
 
#define INPUT_FROM_FILE (0) 
#if INPUT_FROM_FILE
#include <fstream>
#endif

int main(int argc, char **argv){
	int n;

#if INPUT_FROM_FILE
	std::ifstream ifs("test.txt");
	std::cin.rdbuf(ifs.rdbuf());
#endif

	while(std::cin >> n){
		if(n == 0){ break; }
		int x = n / 2;
		int y = n / 2 + 1;
		int cn = 2;
		std::vector<std::vector<int> > ms(n, std::vector<int>(n, 0));

		ms[y][x] = 1;
		while(true){
			bool is_filled = true;
			for(int y = 0; y < n; y++){
				for(int x = 0; x < n; x++){
					if(ms[y][x] == 0){
						is_filled = false;
						y = n;
						break;
					}
				}
			}

			if(is_filled){
				break;
			}

			x++;
			y++;
			while(true){
				if(x > n - 1){
					x = 0;
					continue;
				}
				else if(x < 0){
					x = n - 1;
					continue;
				}
				else if(y > n - 1){
					y = 0;
					continue;
				}
				else if(ms[y][x] != 0){
					x--;
					y++;
					continue;
				}

				ms[y][x] = cn++;
				break;
			}
		}

		for(int y = 0; y < n; y++){
			for(int x = 0; x < n; x++){
				printf("%4d", ms[y][x]);
			}
			printf("\n");
		}
	}


#if INPUT_FROM_FILE
		//fclose(fp);
#endif
	return 0;
}



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

public class Main{
  
 public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        String S = scanner.next();
        String T = scanner.next();
        int len = S.length();
        boolean same = false;
        OUTER: for(int i = 0; i < len;i++){//roations
            same = true;
            for(int j = 0; j <len;j++){
                if(S.charAt((i+j)%len) != T.charAt(j)){
                    same = false; 
                    break;
                }

            }
            if(same)break;

        }


        System.out.println(same?"Yes":"No");
    } 
  
  
  
  
  
}

Measured memory_bytes: 21844