akhauriyash/Code-Regression huggingface dataset:
/*######################################################
#########~~~~~####~~~~###~~##~~##~~##~~##~~##~~#########
#########~~##~~##~~##~~##~~~#~~##~~~#~~##~~##~~#########
#~~~~~~##~~~~~###~~~~~~##~~#~~~##~~#~~~##~~##~~##~~~~~~#
#########~~######~~##~~##~~##~~##~~##~~##~~##~~#########
#########~~######~~##~~##~~##~~##~~##~~###~~~~##########
######################################################*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

using namespace __gnu_pbds;
using namespace std;

#pragma GCC optimize("O3")
#define rtn return
#define endl "\n"
#define F first
#define S second
#define pb push_back
#define MOD 1000000007
#define INF 1e18
#define EPS 1e-15
#define int long long
#define value_at find_by_order
#define index_of order_of_key
#define fill(a,v) memset(a,v,sizeof(a))
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define REP(i,n) for(int i=0;i<(int)n;++i)
#define PER(i,n) for(int i=(int)n-1;i>=0;--i)
#define REP1(i,n) for(int i=1;i<=(int)n;++i)
#define LOOP(i,begin,end) for (int i=(begin)-((begin)>(end));i!=(end)-((begin)>(end));i+=1-2*((begin)>(end)))
#define FAST_IO std::ios_base::sync_with_stdio(false);std::cin.tie(NULL);std::cout.tie(NULL)

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " = " << arg1 << '\n';
}
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

typedef long long ll;
typedef string str;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpii;
typedef long double db;

template<class T, class V> void remin(T &a, V b) { a > b ? a = b : a = a; }
template<class T, class V> void remax(T &a, V b) { a < b ? a = b : a = a; }
template<class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

#define N 100005

//

int32_t main() {
  FAST_IO;

  int a, b, ans;
  cin >> a >> b;
  if (a < b) ans = 0;
  else ans = 10;
  cout << ans;
  rtn 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("O3,inline,unroll-loops")
#include <iostream>
#include <algorithm>
#include <cstdio>
#define N 10000020
using namespace std;

int p[N], c;
bool u[N];
int f[N], g[N], h[N];

int main(void)
{
    int n;
    int i, j;
    long long o;

    f[1] = 1;
    cin >> n;
    for(i = 2; i <= n; i ++)
    {
        if(!u[i])
        {
            p[c ++] = i;
            f[i] = 2;
            g[i] = 1;
            h[i] = i;
        }
        for(j = 0; j < c && i * p[j] <= n; j ++)
        {
            u[i * p[j]] = true;
            if(!(i % p[j]))
            {
                g[i * p[j]] = g[i] + 1;
                h[i * p[j]] = h[i] * p[j];
                f[i * p[j]] = f[i / h[i]] * (g[i * p[j]] + 1);
                break;
            }
            g[i * p[j]] = 1;
            h[i * p[j]] = p[j];
            f[i * p[j]] = f[i] * 2;
        }
    }

    // for(i=1;i<=n;i++)cout<<f[i]<<' ';cout<<endl;
    for(i = 1, o = 0; i <= n; i ++)
        o += (long long)i * f[i];
    cout << o << endl;

    return 0;
}


Measured memory_bytes: 133176
#include<bits/stdc++.h>
using namespace std;
int main(){
int a,b;
  cin >> a >> b;
  if(a == 1)
    a = 14;
  if(b == 1)
    b = 14;
  if(a > b)
    cout << "Alice" << endl;
  else if(a == b)
    cout << "Draw" << endl;
  else 
    cout << "Bob" << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using Map = map<ll,ll>;
using T = tuple<ll,ll,ll>;
using vvl = vector<vector<ll>>;
const ll INF=1LL<<60;
const ll MOD=1000000007;


int main(){
    string s;
    cin >> s;
    string t;
    cin >> t;
    if(t.substr(0,s.size())!=s){
        cout<<"No"<<endl;
    }
    else cout<<"Yes"<<endl;
    
    return 0;
}


Measured memory_bytes: 3632
#include<stdio.h>
int main()
{
    int k,s,i,count=0,z=0;
    scanf("%d%d",&k,&s);
    for(int x=0;x<=k;x++){
        for(int y=0;y<=k;y++){
            z=s-x-y;
            if(z>=0&&z<=k&&(z+y+x)==s){
                count++;
            }
            z=0;
        }
    }
    printf("%d",count);
}


Measured memory_bytes: 128
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdio>
#include <iomanip>
#include <cmath>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <stdlib.h>
#include <set>
typedef long long ll;
using namespace std;

int main() {
	int x,a;
	cin>>x>>a;
	if(x<a){
		cout<<0<<endl;
	}else{
		cout<<10<<endl;
	}
	return 0;

}


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

using namespace std;

int n;
int a[4010];
bool c[4010];

//cost(amt, pos)
int costB[2100][4100], costW[2100][4100];
int dp[4010][2010];

int idxB[4010], idxW[4010];

int main(){
    scanf("%d", &n);

    for(int i = 1; i <= (n << 1); i++){
        char code;
        scanf(" %c%d", &code, &a[i]);

        c[i] = (code == 'B');

        (code == 'B') ? idxB[a[i]] = i : idxW[a[i]] = i;
    }

    for(int i = 0; i <= n; i++){
        for(int j = 1; j <= (n << 1); j++){
            costB[i][j] = costB[i][j - 1];
            costW[i][j] = costW[i][j - 1];

            if(c[j] && a[j] > i) costB[i][j]++;
            if(!c[j] && a[j] > i) costW[i][j]++;
        }
    }

    for(int i = 0; i <= (n << 1); i++)
        for(int j = 0; j <= n; j++)
            dp[i][j] = 1e8;

    dp[0][0] = 0;

    for(int i = 1; i <= (n << 1); i++){
        for(int j = 0; j <= i && j <= n; j++){
            if(i - j > n) continue;

            if(j) dp[i][j] = min(dp[i][j], dp[i - 1][j - 1] + costB[j][idxB[j]] + costW[i - j][idxB[j]]);
            if(i - j) dp[i][j] = min(dp[i][j], dp[i - 1][j] + costW[i - j][idxW[i - j]] + costB[j][idxW[i - j]]);
        }
    }

    printf("%d\n", dp[n << 1][n]);

    return 0;
}

Measured memory_bytes: 98560
import scipy.fftpack as F
from numpy import *
m=200003
n=int(input())
a=[0]*m
b=[0]*(m-1)
ans=0
for i in range(m-1):
    a[pow(2,i,m)]=i
for i in map(int,input().split()):
    if i:
        b[a[i]]+=1
        ans-=i*i%m
b=array(b,dtype=float64)
b=F.fft(b)
b=b*b
b=F.ifft(b)
for i,j in enumerate(b):
    ans+=int(round(j.real))*pow(2,i,m)
print(ans//2)

Measured memory_bytes: 90232
def bubble(b,p):
    for i in range(0,p):
        for j in reversed(range(i+1,n)):
            if int(b[j][1]) < int(b[j-1][1]):
                b[j],b[j-1] = b[j-1],b[j]
    return b

def selection(A,N):
    for i in range(0,N):
        minj = i
        for j in range(i,N):
            if int(A[j][1]) < int(A[minj][1]):
                minj = j
        if i != minj:
            A[i],A[minj] = A[minj],A[i]

    return A

n = int(input())
a = [s for s in input().split()]
c = a.copy()
print(" ".join(map(str,bubble(a,n))))
print("Stable")
d = selection(c,n)
print(" ".join(map(str,d)))
if a == d:
    print("Stable")
else:
    print("Not stable")


Measured memory_bytes: 5616
k,n = map(int,input().split()) 
a =list(map(int,input().split()))
s =[a[i]-a[i-1] for i in range (1,n)] #2点距離をリストに格納(北端は越さない)  
s.append(k-a[n-1]+a[0]) #北端を超える2点距離をリストに格納
print(k-max(s))   #最長距離となる２点を見つける→一周から引けば良い


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

#define FOR0(i,n) for (int i = 0; i < n; i++)
#define FOR(i,j, n) for (int i = j; i < n; i++)
// bool isEven(ll n) {return (n%2!=0)?false:true;};
#define INF 1000000000 // 1 billion, safer than 2B for Floyd Warshall’s

#define f(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define vl vector< ll >
#define ss second
#define ff first
#define ll long long
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sz(a) a.size()
#define inf (1000*1000*1000+5)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define mod (1000*1000*1000+7)
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >
// #define int ll


using namespace std;
typedef pair<int, pair<int, int> > ppp;

//leetcode

int main()
{
	int m, n;
  cin>>m>>n;
  if(m==n)
    cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  long n;
  cin >> n;
  long ans = 1, mod = 1e9+7;
  vector<int> v(1001);
  for(int i = 1; i <= n; i++){
    int tmp = i;
    for(int j = 2; j <= 1000; j++){
      int cnt = 1;
      while(tmp%j == 0){
        v[j]++;
        tmp /= j;
      }
    }
  }
  for(int i = 2; i < 1001; i++){
    ans *= v[i]+1;
    ans %= mod;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
import math

A, B = map(int, input().split())
ans = -1
a1 = math.ceil(A*12.5)
a2 = (A+1)*12.5

a = [i for i in range(a1, int(a2)) if i < a2]

b1 = B*10
b2 = (B+1)*10

b = list(range(b1, b2))

for i in a:
    if i in b:
        ans = i
        break

print(ans)




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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int n,h; cin>>n>>h;
	vector<int>b(n);
	int amx=0;
	for(auto&i:b){
		int a; cin>>a>>i;
		amx=max(amx,a);
	}
	sort(b.begin(),b.end(),greater<int>());
	int ans=0;
	for(auto&i:b){
		if(i<=amx||h<=0)break;
		h-=i,++ans;
	}
	if(h>0)ans+=(h+amx-1)/amx;
	cout<<ans<<"\n"s;
}

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

using namespace std;
typedef long long ll;

#define REP(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, m, n) for (ll i = m; i < n; i++)

int main(int argc, char const *argv[])
{
    ll n, k;
    cin >> n >> k;
    vector<ll> x(n);
    REP(i, n)
    {
        cin >> x[i];
    }
    ll res = 1e9;
    REP(i, n - k + 1)
    {
        ll xl = x[i];
        ll xr = x[i + k - 1];
        ll t1 = abs(xl) + abs(xl - xr);
        ll t2 = abs(xr) + abs(xl - xr);
        res = min({res, t1, t2});
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 1024
n,m = map(int,input().split())
list = [int(x) for x in input().split()]
sum=0
for i in list:
    sum+=i
resultList = []
for i in list:
    if(sum/4/m <= i):
        resultList.append(i)
if(len(resultList)>=m):
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
n,k = map(int,input().split())
a = list(map(int,input().split()))
f = list(map(int,input().split()))
a.sort()
f.sort(reverse=True)
#print(a)
#print(f)
scale = 42
aim = 2 ** scale -1
gap = 2 ** (scale-1)
while True:
  train = 0
  for i in range(n):
    train += max(0, a[i] - aim//f[i])
  if gap == 0:
    if train <= k:
      print(aim)
    else:
      print(aim+1)
    break
  #print(aim,gap,train)
  if train <= k:
    aim -= gap
    gap //= 2
  else:
    aim += gap
    gap //= 2

Measured memory_bytes: 119500
import math

S = input()
N = len(S) # N is odd from 3 to 99

subS1 = S[:int((N-1)/2)]
subS2 = S[int((N+3)/2-1):]

def is_kaibun(string):
  kaibun = True
  if len(string)%2==0:
    # if even,
    for i in range(int(len(string)/2)):
      kaibun = kaibun and string[i]==string[-(i+1)]
  else:
    # if odd,
    for i in range(int((len(string)-1)/2)):
      kaibun = kaibun and string[i]==string[-(i+1)]
  return kaibun

answer = is_kaibun(S) and is_kaibun(subS1) and is_kaibun(subS2)

if answer:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<ll>;
using VS = vector<string>;
template<class T> using PQ = priority_queue<T, vector<T>, greater<T>>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);--(i))
#define each(i, a) for(auto &i : a)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
#define out(y,x) ((y) < 0 || h <= (y) || (x) < 0 || w <= (x))
#define line cout << "-----------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
constexpr ld eps = 1e-10;
constexpr ld pi = 3.1415926535897932;
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; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& is, vector<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
template<class T>inline istream& operator>>(istream& is, deque<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template<class T>inline vector<T> vec(size_t a) { return vector<T>(a); }
template<class T>inline vector<T> defvec(T def, size_t a) { return vector<T>(a, def); }
template<class T, class... Ts>inline auto vec(size_t a, Ts... ts) { return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...)); }
template<class T, class... Ts>inline auto defvec(T def, size_t a, Ts... ts) { return vector<decltype(defvec<T>(def, ts...))>(a, defvec<T>(def, ts...)); }

int main() {
    init();

    int n; cin >> n;
    int ans = -INF;
    int l; cin >> l;
    FOR(i, 1, n) {
        int a; cin >> a;
        chmax(ans, a - l);
        chmin(l, a);
    }
    cout << ans << "\n";
}


Measured memory_bytes: 3224
def divisor(n):
  list1 = []
  for i in range(1, int(n ** (0.5)) + 1):
    if n % i == 0:
      list1.append(i)
      list1.append(int(n / i))
  list1 = list(set(list1))
  return len(list1) - 1

def function(n):
  ans = 0
  if n >= 2:
    ans += 1
  for i in range(2, int(n ** (0.5)) + 1):
    m = n
    if m % i == 0:
      while m % i == 0:
        m = int(m / i)
      if m % i == 1:
        ans += 1
  ans += divisor(n - 1)
  return ans
n = int(input())
print(function(n))

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

int main()
{
    string s;
    cin >> s;
    int q;
    cin >> q;
    int l = q * 2 + s.length();
    char *ans = new char[l];
    rep(i,s.length()) ans[q+i] = s[i];
    int d = 1;
    int starti = q;
    int endi = q + s.length();
    rep(t, q)
    {
        int code;
        cin >> code;
        if( code == 1 )
        {
            d = -d;
        }
        else
        {
            int f;
            char c;
            cin >> f >> c;
            int dt = ( f == 1) ? -1 : 1;
            dt *= d;
            if( dt < 0 )
            {
                ans[starti - 1] = c;
                starti--;
            }
            else
            {
                ans[endi] = c;
                endi++;
            }
        }
    }
    if( d > 0 )
    {
        rep(i, endi - starti) cout << ans[starti + i];
    }
    else
    {
        rep(i, endi - starti) cout << ans[endi - 1 - i];        
    }
}

Measured memory_bytes: 4060
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
 
using namespace std;
 
#define rep(i,n) for(int i=0; i<(n); i++)
#define repc(i,s,e) for(int i=(s); i<(e); i++)
#define pb(n) push_back((n))
#define mp(n,m) make_pair((n),(m))
#define all(r) r.begin(),r.end()
#define fi first
#define se second
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
 
const int INF = 10000000;
const int MOD = 1e9 + 7;
 

int main(){
	int d, n, m;
	while(cin>>d && d > 0){
		cin>>n>>m;
		vi v(n, 0); vi u(m, 0);
		v[0] = 0;
		rep(i, n-1) cin>>v[i+1];
		rep(i, m) cin>>u[i];
		sort(all(v));
		rep(i, n) v.pb(v[i] + d);
		
		ll ans = 0LL, tmp;
		int t;
		vi::iterator it;
		rep(i, m){
			//tmp = INF;
			it = upper_bound(all(v), u[i]);
			tmp = *it - u[i];
			if(it !=  v.begin()){
				tmp = min((int)tmp, abs(u[i] - *(it-1)));
			}
			//cout<<"  "<<tmp<<endl;
			ans += tmp % d;
		}
		cout<<ans<<endl;
	}
}

Measured memory_bytes: 2060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
struct edge
{
	int to,cap,rev;
};
vector<edge>G[305];
bool used[305];

void add_edge(int from,int to,int cap)
{
	G[from].push_back((edge){to,cap,G[to].size()});
	G[to].push_back((edge){from,0,G[from].size()-1});
}
int dfs(int v,int t,int f)
{ 
	if(v==t) return f;
	used[v]=true;
	for(int i=0;i<G[v].size();i++)
	{
		edge &e=G[v][i];
		if(!used[e.to] && e.cap>0)
		{ 
			int d=dfs(e.to,t,min(f,e.cap));
			if(d>0) 
			{ 
				e.cap-=d;
				G[e.to][e.rev].cap+=d;
				return d;
			}
		}
	}
	return 0;
}
int max_flow(int s,int t)
{ 
	int flow=0;
	while(1)
	{ 
		memset(used,0,sizeof(used));
		int f=dfs(s,t,INF);
		if(!f) return flow;
		flow+=f;
	}
}
int n,a[105],b[105],c[105],d[105];
int main(){
	cin>>n;
	repn(i,n){
		cin>>a[i]>>b[i];
		add_edge(250,i,1);
	}
	repn(i,n){
		cin>>c[i]>>d[i];
		add_edge(i+105,255,1);
	}
	repn(i,n) repn(j,n){
		if(a[i]<c[j]&&b[i]<d[j]){
			add_edge(i,j+105,1);
		}
	}
	cout<<max_flow(250,255)<<endl;
}

Measured memory_bytes: 384
use std::io;

fn main() {
    let mut buffer = String::new();
    io::stdin().read_line(&mut buffer).unwrap();
    let input_vec: Vec<char> = buffer.chars().collect();

    if input_vec[2] == input_vec[3] && input_vec[4] == input_vec[5] {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 4352
#include <iostream>
#include <cstring>
#include <string>
int a[10];
bool huiwen(int n)
{
    int t=0;
    while(n)a[++t]=n%10,n/=10;
    for(int i=1;i<=t/2;i++)if(a[i]!=a[t-i+1])return 0;
    return 1;
}
int main()
{
    int x,y,t=0;
    std::cin>>x>>y;
    for(int i=x;i<=y;i++)
    {
        if(huiwen(i))t++;
    }
    std::cout<<t<<std::endl;
}

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

struct circle{
  int x, y, r;
  circle(int a, int b, int c){ x=a, y=b, r=c; }
  bool operator<(const circle right)const{
    return r<right.r;
  }
};

double get_dis_PP(int x1, int y1, int x2, int y2){
  return sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
}

int n, dp[1005], xs, ys, xt, yt;
vector<circle> c;

signed main(){

  while(1){
  
    cin>>n;
    if(!n) break;
    cin>>xs>>ys>>xt>>yt;

    c.clear();
  
    for(int i=0;i<n;i++){
      int x, y, r;
      cin>>x>>y>>r;
      int flag=0;
      if(get_dis_PP(xs,ys,x,y)<r) flag++;
      if(get_dis_PP(xt,yt,x,y)<r) flag++;
      if(flag==1) c.push_back(circle(x,y,r));
    }
  
    sort(c.begin(),c.end());
  
    for(int i=0;i<c.size();i++) dp[i]=1;
        
    for(int i=0;i<c.size();i++)
      for(int j=i+1;j<c.size();j++){
	circle A=c[j], B=c[i];
	double d=get_dis_PP(A.x,A.y,B.x,B.y);
	if(d+B.r<A.r) dp[j]=max(dp[j],dp[i]+1);
      }
    
    int ans=0;
    
    for(int i=0;i<c.size();i++){
      ans=max(ans,dp[i]);
      for(int j=i+1;j<c.size();j++){
	circle A=c[j], B=c[i];
	double d=get_dis_PP(A.x,A.y,B.x,B.y);
	if(d>A.r+B.r) ans=max(ans,dp[i]+dp[j]);
      }
    }
    
    cout<<ans<<endl;
  
  }
  
  return 0;
}

Measured memory_bytes: 3076
#include <stdio.h>
main(){
	char str[21],stra[21];
	int i=0,k,a;
	scanf("%s",str);
	while(str[i]!='\0'){
		i++;
	}
	i--;
	a=0;
	for(k=i;k>=0;k--){
		stra[k]=str[a];
		a++;
	}
	stra[i+1]='\0';
	printf("%s\n",stra);
	return 0;
}

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

int main(){
	/*#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif*/
 	int a,b;
 	cin>>a>>b;
 	if(a>=13){
 		cout<<b;
 	}   
 	else if(a>=6&&a<=12){
 		cout<<b/2;
 	}
 	else{
 		cout<<"0";
 	}
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<cstdio>
#include<sstream>
#include<iomanip>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef pair<int,pii> pip;
typedef vector<pip>vip;
const double PI=acos(-1);
const double EPS=1e-8;
const int inf=1e8;
int main(){
	int n;
	while(cin>>n,n){
		vi dp(310,1);
		int nu=2;
		while(nu*nu<=n){
			loop(i,nu*nu,n+1)dp[i]+=dp[i-nu*nu];
			nu++;
		}
		cout<<dp[n]<<endl;
	}
}

Measured memory_bytes: 1196
# coding: utf-8
# Your code here!

import math

n,k = map(int,input().split())

#コインを何度投げるかの配列
l = []
#少し足して切り上げの手助け
ln = n+0.5**9
#コインを0回投げて勝てるパターン数を記録
l.append(math.ceil(ln-k) if ln-k>=0 else 0)
#コインを0回投げて勝てるパターン数を減らす
ln -= math.ceil(ln-k) if ln-k>=0 else 0

for _ in range(1,k+1):
    k/=2
    #コインをi回投げて勝てるパターン数を記録
    l.append(math.ceil(ln-k) if n-k>0 else 0)
    #コインをi回投げて勝てるパターン数を減らす
    ln-=math.ceil(ln-k) if n-k>0 else 0
    #kが1より下になった場合終了
    if k<=1:
        break
ans = 0
for i in range(len(l)):
    #インデックス番号文2で割って合計を出す
    ans += l[i]/n/2**i
print(ans)


Measured memory_bytes: 3064
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::io::{stderr, stdin, stdout, BufRead, BufWriter, Read, StdoutLock, Write};
#[allow(unused_imports)]
use std::iter::FromIterator;
#[allow(unused_imports)]
use std::{i64, u64, usize};
#[allow(unused_macros)]
/// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules !input {(source =$s :expr ,$($r :tt ) *) =>{let mut iter =$s .split_whitespace () ;input_inner !{iter ,$($r ) *} } ;($($r :tt ) *) =>{let mut s ={use std ::io ::Read ;let mut s =String ::new () ;std ::io ::stdin () .read_to_string (&mut s ) .unwrap () ;s } ;let mut iter =s .split_whitespace () ;input_inner !{iter ,$($r ) *} } ;}
#[allow(unused_macros)]
macro_rules !input_inner {($iter :expr ) =>{} ;($iter :expr ,) =>{} ;($iter :expr ,$var :ident :$t :tt $($r :tt ) *) =>{let $var =read_value !($iter ,$t ) ;input_inner !{$iter $($r ) *} } ;}
#[allow(unused_macros)]
macro_rules !read_value {($iter :expr ,($($t :tt ) ,*) ) =>{($(read_value !($iter ,$t ) ) ,*) } ;($iter :expr ,[$t :tt ;$len :expr ] ) =>{(0 ..$len ) .map (|_ |read_value !($iter ,$t ) ) .collect ::<Vec <_ >>() } ;($iter :expr ,chars ) =>{read_value !($iter ,String ) .chars () .collect ::<Vec <char >>() } ;($iter :expr ,usize1 ) =>{read_value !($iter ,usize ) -1 } ;($iter :expr ,$t :ty ) =>{$iter .next () .unwrap () .parse ::<$t >() .expect ("Parse error" ) } ;}
#[allow(unused_macros)]
macro_rules !dbg {($($a :expr ) ,*) =>{writeln !(&mut stderr () ,concat !($(stringify !($a ) ," = {:?}, " ) ,*) ,$($a ) ,*) .unwrap () ;} }
#[allow(non_snake_case)]
#[allow(dead_code)]
fn main() {
    input! {
        h: usize,
        w: usize,
        s: [chars; h],
    }
    let next = vec![(1, 0), (0, 1)];
    let mut cost = vec![vec![1_000_000_000; w]; h];
    if s[0][0] == '.' { cost[0][0] = 0; }
    else { cost[0][0] = 1; }

    let mut q: VecDeque<(usize, usize)> = VecDeque::new();
    q.push_back((0, 0));
    while !q.is_empty() {
        let cur = q.pop_front().unwrap();
        let cx = cur.0;
        let cy = cur.1;
        for &(x, y) in &next {
            let nx = cx + x;
            let ny = cy + y;
            if h <= nx || w <= ny { continue; }
            let black = if s[cx][cy] == '.' && s[nx][ny] == '#' { 1 } else { 0 };
            if cost[nx][ny] > cost[cx][cy] + black {
                cost[nx][ny] = cost[cx][cy] + black;
                q.push_back((nx, ny));
            }
        }
    }
    println!("{}", cost[h - 1][w - 1]);
}

Measured memory_bytes: 4352
import numpy as np

n = int(input())
arr = list(map(float, input().split()))
dp = np.zeros(n + 1, dtype=float)
dp[0] = 1.0

for p in arr:
    tmp = dp * (1 - p)
    tmp[1:] += dp[:-1] * p
    dp = tmp

print(np.sum(dp[n // 2 + 1:]))


Measured memory_bytes: 14532
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System.Text.RegularExpressions;

class Program
{
    const string Yes = "Yes";
    const string No = "No";
    const long Mod = 1000000007;

    static void Main(string[] args) {
#if DEBUG
        MyDebugger.Test(process, "../TextFile1.txt");
#else
        object ret = process(new StreamReader(Console.OpenStandardInput()));
        Console.WriteLine(ret);
#endif
    }

    static object process(TextReader input) {
        var spl = input.ReadLine().Split(' ');
        var n = int.Parse(spl[0]);
        var x = int.Parse(spl[1]);

        var min = int.MaxValue;

        for(int i=0; i<n; i++) {
            var m = int.Parse(input.ReadLine());
            x -= m;
            min = Math.Min(min, m);
        }

        return n + x / min;
    }
}


Measured memory_bytes: 11092
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#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 pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
//#define int ll
typedef ll 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;
//#define mt make_tuple
//typedef tuple<int,int,int> tp;
//typedef vector<tp> vt;
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;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
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 n;
	cin>>n;
	vi a(n),b(n);
	rep(i,n)cin>>a[i]>>b[i];
	bool h=true;
	rep(i,n)if(a[i]!=b[i])h=false;
	if(h){
		cout<<0<<endl;
		return 0;
	}
	ll mi=inf,sum=0;
	rep(i,n)if(a[i]>b[i])mi=min(mi,b[i]);
	rep(i,n)sum+=a[i];
	cout<<sum-mi<<endl;
}



Measured memory_bytes: 512
#include <iostream>
#include <iomanip>
#include <map>
#include <set>
#include <vector>
#include <utility>
#include <algorithm>
#include <queue>
#include <cstdint>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <cmath>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

constexpr ll inf = INT64_MAX / 4;
constexpr ll mod = 1000000007;

constexpr int maxn = 100000;

int n, a[maxn], y[maxn + 1];

int ga(int i) {
    return a[(i + n) % n];
}

//y0 d0 y1 d1 y2 d2 y3
int main() {
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    for (int i = 1; i <= n; i++) {
        y[i] = a[i - 1] - y[i - 1];
    }
    y[0] = y[n] / 2;
    for (int i = 1; i <= n; i++) {
        y[i] = a[i - 1] - y[i - 1];
    }
    if (y[0] != y[n]) throw;
    for (int i = 0; i < n; i++) {
        cout << y[i] * 2 << endl;
    }
}

Measured memory_bytes: 2048
#define _USE_MATH_DEFINES
#include <math.h>
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
int main()
{
    int a[26] = {};
    string w;
    cin >> w;
    for(int i = 0;i < w.size();i++)
    {
        a[w[i] - 'a']++;
    }
    for(int i = 0;i < 26;i++)
    {
        if(a[i] % 2 != 0)
        {
            cout << "No\n";
            return 0;
        }
    }
    cout << "Yes\n";
    
    return 0;
}

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

int main() {
  int N, A, B; cin >> N >> A >> B;
  int a=0, ab=0, b=0;
  int tmp;
  for (int i=0; i<N; i++) {
    cin >> tmp;
    if (tmp <= A) a++;
    else if (tmp > B) b++;
    else ab++;
  }
  cout << min(a, min(ab, b)) << endl;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();

        String result = (a + b + c) == 17 ? "YES" : "NO";

        System.out.println(result);
    }
}

Measured memory_bytes: 22868
#include<bits/stdc++.h>
using namespace std;
int main(){
    string s,t;cin>>s>>t;
    int n=s.size(),m=t.size();
    int p=-1;
    for(int i=n-m;i>=0;i--){
        int cnt=0;
        for(int j=0;j<m;j++){
            if(s[i+j]==t[j] or s[i+j]=='?')cnt++;
            if(cnt==m){
                p=i,i=-1;
                break;
            }
        }
    }
    if(p==-1)puts("UNRESTORABLE");
    else{
        for(int i=0;i<n;i++){
            if(p<=i and i<=p+m-1){
                cout<<t[i-p];
            }
            else if(s[i]=='?')cout<<"a";
            else cout<<s[i];
        }
        cout<<"\n";
    }
    return 0;
}

Measured memory_bytes: 256
//https://atcoder.jp/contests/agc006/tasks/agc006_a
#include <bits/stdc++.h>
using namespace std;
using ll=int64_t;
#define FOR(i,a,b) for(int64_t i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
int main() {
#if LOCAL&01
    std::ifstream in("./test/sample-1.in"); //input.txt
    std::cin.rdbuf(in.rdbuf());
#endif
    ll N; cin>>N;
    string s,t; cin>>s>>t;
    ll cnt=0;
    for(;cnt<s.size();++cnt){
        if (strncmp(&s[cnt],&t[0],s.size()-cnt)==0){
            break;
        }
    }
    ll dup=s.size()-cnt;
    ll ans=(s.size()-dup)*2+dup;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
  let stdin = stdin();
  let stdin = stdin.lock();
  let token: String = stdin
    .bytes()
    .map(|c| c.expect("failed to read char") as char)
    .skip_while(|c| c.is_whitespace())
    .take_while(|c| !c.is_whitespace())
    .collect();
  token.parse().ok().expect("failed to parse token")
}

use std::cmp::{max, min};
use std::collections::HashMap;

fn main() {
  let n = read::<i64>();
  let k = read::<i64>();
  let mut ans = 1;

  for _ in 0..n {
    ans = min(ans + k, 2 * ans);
  }

  println!("{}", ans);
}



Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
long long a[4][100010],b[4][100010];
int n;
int main(){
	cin>>n;
	for(int i=1;i<=n;++i){
		for(int j=0;j<=2;++j){
			cin>>a[j][i];
		}
	}
	for(int i=0;i<=2;++i){
		b[i][1]=a[i][1];
	}
	for(int i=2;i<=n;++i){
		for(int j=0;j<=2;++j){
			b[j][i]=max(b[(j+1)%3][i-1],b[(j+2)%3][i-1])+a[j][i];
		}
	}
	cout<<max(b[0][n],max(b[1][n],b[2][n]))<<endl;
	return 0;
}


Measured memory_bytes: 6400
import sys

sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  #空白なし
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())  #空白あり
def LS2(): return list(sys.stdin.readline().rstrip())  #空白なし

S = LS2()
print(S.count('+')-S.count('-'))


Measured memory_bytes: 61912
n, m, l = map(int, input().split())
arrA = [[0 for i in range(m)] for j in range(n)]
arrB = [[0 for i in range(l)] for i in range(m)]
arrC = [[0 for i in range(l)] for j in range(n)]

for i in range(n):
    arrA[i] = list(map(int, input().split()))

for i in range(m):
    arrB[i] = list(map(int, input().split()))

for i in range(n):
    for j in range(l):
        c = 0
        for k in range(m):
            c += arrA[i][k] * arrB[k][j]
        arrC[i][j] = c

for i in range(n):
    print(' '.join(map(str, arrC[i])))



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

int main()
{
    string s, t;
    int a, b;
    string u;
    cin >> s >> t;
    cin >> a >> b;
    cin >> u;
    if(u == s){
        a-=1;
    }else
    {
        b-=1;
    }
    cout << a << " " << b << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (true) {
            int[] a = new int[]{sc.nextInt(), sc.nextInt()};
            if (a[0] == 0 && a[1] == 0) {
                break;
            }
            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < a[0]; i++) {
                for (int j = 0; j < a[1]; j++) {
                    if (i != 0 && i != a[0] - 1 && j != 0 && j != a[1] - 1) {
                        sb.append(".");
                    } else {
                        sb.append("#");
                    }
                }
                sb.append("\n");
            }
            System.out.println(sb.toString());
        }
    }
}

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

public class Main {	

	private static void solve(){
		//Implement solution here.
		int A = ni();
		int B = ni();
		int C = ni();
		int D = ni();
		int turn_1 = C / B + (C % B != 0 ? 1 : 0);
		int turn_2 = A / D + (A % D != 0 ? 1 : 0);
		System.out.println(turn_1 <= turn_2 ? "Yes" : "No");
	}

	//Switch input source (stdin/file)
	private static BufferedReader br;
	public static void main(String[] args){
		br = new BufferedReader(new InputStreamReader(System.in));
		String debugDataPath = System.getenv("DD_PATH");        
		if(debugDataPath != null){
			try{
				br = new BufferedReader(new InputStreamReader(new FileInputStream(new File(debugDataPath))));
			}catch(Exception e){
				throw new RuntimeException(e);
			}
		}
		boolean hasNext = true;
		while(hasNext){
			solve();	
			try{
				br.mark(1);
				if(br.read() > 0){
					br.reset();			
					System.out.println("---");
				} else {
					hasNext = false;
				}
			}catch(Exception e){
				throw new RuntimeException(e);
			} 
		}
	}

	//Input read utility
	private static StringTokenizer tokenizer = null;
	public static String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(br.readLine());
			} catch (Exception e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}
	//Get next single int
	private static int ni() {
		return Integer.parseInt(next());
	}
	//Get next single long
	private static long nl() {
		return Long.parseLong(next());
	}
	//Get next single double
	private static double nd() {
		return Double.parseDouble(next());
	}
	//Get next int array from one line
	private static int[] na(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}
	//Get next char array from one line
	private static char[] ns() {
		return next().toCharArray();
	}
	//Get next long array from one line
	private static long[] nal(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nl();
		return a;
	}
}

Measured memory_bytes: 25436
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#define rep(i,l,r) for(int i=(l);i<=(r);++i)
#define per(i,r,l) for(int i=(r);i>=(l);--i)
using namespace std;
const int maxn=3010,P=1e9+7;
int n,m,dp[maxn][maxn][2],ans;
inline void upd(int &x,int y){x+=y;(x>=P)&&(x-=P);}
int main(){
	scanf("%d%d",&n,&m);
	rep(i,1,n) dp[0][i][0]=1;
	dp[0][0][1]=1;
	rep(i,0,m-1){
		rep(j,0,n){
			if(j){
				upd(dp[i+1][j-1][1],dp[i][j][1]);
				upd(dp[i+1][j][1],dp[i][j][1]);
				upd(dp[i+1][j-1][j==1],dp[i][j][0]);
				upd(dp[i+1][j][j==1],dp[i][j][0]);
			}
			if(j<n){
				upd(dp[i+1][j+1][1],dp[i][j][1]);
				upd(dp[i+1][j][1],dp[i][j][1]);
				upd(dp[i+1][j+1][0],dp[i][j][0]);
				upd(dp[i+1][j][0],dp[i][j][0]);
			}
		}
	}
	rep(i,0,n) upd(ans,dp[m][i][1]);
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 70912
n=gets.to_i
a,b=[],[]
n.times do
  aa,bb=gets.split.map(&:to_i)
  a << aa
  b << bb
end
a.sort!
b.sort!
if n.odd?
  puts b[n/2]-a[n/2]+1
else
  puts b[n/2-1]+b[n/2]-a[n/2-1]-a[n/2]+1
end


Measured memory_bytes: 20504
import java.util.*;

public class  Main 
{
   static  int n , arr[];
   static  long k;
    static boolean check(int x)
    {
        long tot= 0;
        
        for(int i = 0 ; i < n ; i++)
        {
            if(arr[i]%x == 0)
            tot += arr[i]/x - 1;
            
            else
            tot += arr[i]/x;
        }
        
        if(tot <= k)
        return true;
        
        return false;
    }
    
    public static void main(String []args)
    {
        Scanner sc = new Scanner(System.in);
         n = sc.nextInt();
          k = sc.nextLong();
        arr = new int[n];
        for(int i = 0 ;i  < n ; i++)
        {
            arr[i] = sc.nextInt();
        }
        
        int l = 1 , r = 1000000000;
        while(l < r)
        {
            int mid = (l+r)/2;
            if(check(mid))
            r = mid;
            
            else 
            l = mid+1;
        }
        System.out.println(l);
    }
}

Measured memory_bytes: 59572
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <queue>
#include <deque>
#include <set>
#include <stack>
 
using namespace std;
 
typedef long long ll;
const ll nmax = 1e9 + 7;
const ll mod = 998244353;
const double PI = 2 * asin(1);

int main() {
  string S;
  cin >> S;
  int cnt_0 = 0;
  int cnt_1 = 0;
  int N = S.size();
  for (int i = 0; i < N; i ++) {
    if (S.at(i) == '0') {
      cnt_0 ++;
    }
    else {
      cnt_1 ++;
    };
  };
  
  int ans = min(min(cnt_0, cnt_1) * 2, N);
  cout << ans << endl;
  return 0;
}

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

#define repd(i, a, b) for (ll i = (a); i < (b); i++)
#define repb(i, n) for (ll i = (n)-1; i >= 0; i--)
#define rep(i, n) repd(i, 0, n)

using namespace std;

using ll = long long;
using ul = unsigned long long;
ll mod = 1000000007;

int main() {
source:
    ll k;
    cin >> k;
    ll ans = 0;
    repd(l0, 1, k + 1) {
        repd(l1, 1, k + 1) {
            repd(l2, 1, k + 1) { ans += __gcd(l0, __gcd(l1, l2)); }
        }
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 3636
S = input()
N = int(S)

count = 0
exc = {1:0, 3:99, 5:9999}
full = {1:9, 3:900, 5:90000}

for x in range(1, len(S) + 1, 2):
    if x == len(S):
        count += N - exc[x]
    else:
        count += full[x]

print(count)

Measured memory_bytes: 3060
#include <iostream>

using namespace std;

typedef long long ll;

ll dp[3005][3005];

int main(int argc, char *argv[])
{
	int N, a[3005];

	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> a[i];
	}

	for (int len = 1; len <= N; len++) {
		for (int i = 0; i < N - len + 1; i++) {
			int j = i + len;
			if ((N - len) % 2 == 0) {
				dp[i][j] = max(dp[i + 1][j] + a[i], dp[i][j - 1] + a[j - 1]);
			} else {
				dp[i][j] = min(dp[i + 1][j] - a[i], dp[i][j - 1] - a[j - 1]);
			}
		}
	}

	cout << dp[0][N] << endl;

	return 0;
}


Measured memory_bytes: 70144
import numpy as np
D = int(input())
s = [input() for i in range(D+1)]
for i in range(0,D+1):
    s[i] = s[i].split()
    s[i] = [int(p) for p in s[i]]
a = []
b = [0]*len(s[0])
S = 0
for i in range (1,D+1):
    mx = np.argmax(s[i])
    for j in range(0,len(s[0])):
        if j == mx:
            b[j] = 0
        else:
            b[j] = b[j] + s[0][j]
    S = S + s[i][mx] - sum(b)
    a.append(mx+1)
for i in (a):
    print(i)

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

using namespace std;
using ll = long long int;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

#define rep(i, N) for (ll i = 0; i < (N); i++)
#define For(i, a, b) for (ll i = (a); i < (b); i++)
#define all(A) (A).begin(), (A).end()

int main(){
    ll Q, H, S, D;
    cin >> Q >> H >> S >> D;
    ll N;
    cin >> N;
    ll ans;
    ll q = Q * 4;
    ll h = H * 2;
    ll s = S * 1;
    ll tmp;
    tmp = min(min(q, h), s);
    
    if (tmp * 2 < D) {
        ans = N * tmp;
    }
    else {
        ans = (N / 2) * D;
        if (N % 2 == 1) ans += tmp;
    }

    cout << ans << endl;

    return 0;
}


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

int N,M,K,res[100000],T[100000];

int par(int x){
	if(T[x]<0)return x;
	else return T[x]=par(T[x]);
}

void uni(int x,int y){
	x=par(x);
	y=par(y);
	if(x!=y){
		T[x]+=T[y];
		T[y]=x;
	}
}

int main(){
	cin>>N>>M>>K;
	for(int i=0;i<N;i++){
		T[i]=-1;
	}
	for(int i=0;i<M;i++){
		int a,b;
		cin>>a>>b;
		a--;
		b--;
		uni(a,b);
		res[a]--;
		res[b]--;
	}
	for(int i=0;i<K;i++){
		int c,d;
		cin>>c>>d;
		c--;
		d--;
		if(par(c)==par(d)){
			res[c]--;
			res[d]--;
		}
	}
	for(int i=0;i<N;i++){
		cout<<res[i]-T[par(i)]-1;
		if(i!=N-1)cout<<' ';
		else cout<<endl;
	}
}


Measured memory_bytes: 2176
#include <iostream>
#include <stdio.h>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <cstring>
#include <string>
#include <time.h>
#include <algorithm>
using namespace std;
#define INF 2147483647


/********************************* Main *********************************/

// Sunny, Cloudy, Rainy, ...,
enum {Sunny, Cloudy, Rainy};
int main() {
	ios_base::sync_with_stdio(false); 

	string s; cin >> s;
	if (s == "Sunny") {
		cout << "Cloudy\n"; 
	}
	else if (s == "Cloudy") {
		cout << "Rainy\n";
	}
	else if (s == "Rainy") {
		cout << "Sunny\n";
	}

	return 0;
} 



Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <map>
#include <math.h>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <set>
#include <queue>
#include <sstream>
#include <stack>
#include <deque>
#include <memory.h>
#include <cassert>
#include <ctime>
#include <climits>
#include <list>
#include <time.h>
#include <unordered_map>
#include <bitset>
#include <exception>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef unsigned long long ull;
#define pb push_back
#define mp make_pair
#define INPUT "/Users/bekhzodsoliev/Desktop/C++/cp/cp/file.in"
#define OUTPUT "/Users/bekhzodsoliev/Desktop/C++/cp/cp/file.out"
#define lc v << 1
#define rc (v << 1) + 1
#define inf 1e+9
#define linf ll(1e+18)
#define dinf 1e+14

void solve()
{
    int n, k;
    cin >> n >> k;
    
    int res = 0;
    
    n--;
    while(n > 0)
    {
        n -= (k - 1);
        res++;
    }
    
    cout << res;
}

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0); cout.tie(0);
    //freopen(INPUT, "r", stdin);freopen(OUTPUT, "w", stdout);
    //freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
    int t = 1;
    //cin >> t;
    
    
    while(t--)
    {
        solve();
    }
    
    return 0;
}


Measured memory_bytes: 256
import std.stdio;
import std.string;
import std.format;
import std.conv;
import std.typecons;
import std.algorithm;
import std.functional;
import std.bigint;
import std.numeric;
import std.array;
import std.math;
import std.range;
import std.container;
import std.concurrency;
import std.traits;
import std.uni;
import std.regex;
import core.bitop : popcnt;
alias Generator = std.concurrency.Generator;

enum long INF = long.max/5;

void main() {
  readln.chomp.any!"a=='7'".pipe!"a?\"Yes\":\"No\"".writeln;
}

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


void times(alias fun)(long n) {
  // n.iota.each!(i => fun());
  foreach(i; 0..n) fun();
}
auto rep(alias fun, T = typeof(fun()))(long n) {
  // return n.iota.map!(i => fun()).array;
  T[] res = new T[n];
  foreach(ref e; res) e = fun();
  return res;
}

T ceil(T)(T x, T y) if (isIntegral!T || is(T == BigInt)) {
  // `(x+y-1)/y` will only work for positive numbers ...
  T t = x / y;
  if (y > 0 && t * y < x) t++;
  if (y < 0 && t * y > x) t++;
  return t;
}

T floor(T)(T x, T y) if (isIntegral!T || is(T == BigInt)) {
  T t = x / y;
  if (y > 0 && t * y > x) t--;
  if (y < 0 && t * y < x) t--;
  return t;
}

ref T ch(alias fun, T, S...)(ref T lhs, S rhs) {
  return lhs = fun(lhs, rhs);
}
unittest {
  long x = 1000;
  x.ch!min(2000);
  assert(x == 1000);
  x.ch!min(3, 2, 1);
  assert(x == 1);
  x.ch!max(100).ch!min(1000); // clamp
  assert(x == 100);
  x.ch!max(0).ch!min(10); // clamp
  assert(x == 10);
}

mixin template Constructor() {
  import std.traits : FieldNameTuple;
  this(Args...)(Args args) {
    // static foreach(i, v; args) {
    foreach(i, v; args) {
      mixin("this." ~ FieldNameTuple!(typeof(this))[i]) = v;
    }
  }
}

void scanln(Args...)(auto ref Args args) {
  enum sep = " ";
  enum n = Args.length;
  enum fmt = n.rep!(()=>"%s").join(sep);

  string line = readln.chomp;
  static if (__VERSION__ >= 2074) {
    line.formattedRead!fmt(args);
  } else {
    enum argsTemp = n.iota.map!(
      i => "&args[%d]".format(i)
    ).join(", ");
    mixin(
      "line.formattedRead(fmt, " ~ argsTemp ~ ");"
    );
  }
}

// fold was added in D 2.071.0
static if (__VERSION__ < 2071) {
  template fold(fun...) if (fun.length >= 1) {
    auto fold(R, S...)(R r, S seed) {
      static if (S.length < 2) {
        return reduce!fun(seed, r);
      } else {
        return reduce!fun(tuple(seed), r);
      }
    }
  }
}

// popcnt with ulongs was added in D 2.071.0
static if (__VERSION__ < 2071) {
  ulong popcnt(ulong x) {
    x = (x & 0x5555555555555555L) + (x>> 1 & 0x5555555555555555L);
    x = (x & 0x3333333333333333L) + (x>> 2 & 0x3333333333333333L);
    x = (x & 0x0f0f0f0f0f0f0f0fL) + (x>> 4 & 0x0f0f0f0f0f0f0f0fL);
    x = (x & 0x00ff00ff00ff00ffL) + (x>> 8 & 0x00ff00ff00ff00ffL);
    x = (x & 0x0000ffff0000ffffL) + (x>>16 & 0x0000ffff0000ffffL);
    x = (x & 0x00000000ffffffffL) + (x>>32 & 0x00000000ffffffffL);
    return x;
  }
}


Measured memory_bytes: 2892
#include<iostream>
#include<sstream>
#include<queue>
#include<cmath>
#define rep(i,n)  for(int i=0;i<n;i++)
#define INF 1<<30
using namespace std;
double c[1<<12][12],t,d[11][11]; int n,w,r[12];
int main(){
	string s; rep(i,11)rep(j,11)d[i][j]=j-i+2*sqrt(i*j);
	while(getline(cin,s)){
		stringstream ss; ss<<s; ss>>w;
		for(n=0;ss>>r[n];n++);
		queue<pair<int,int> > F;
		if(n==1){
			cout<<(r[0]<=w?"OK":"NA")<<endl;continue;
		}
		rep(i,1<<n)rep(j,n)c[i][j]=INF;
		rep(i,n)c[((1<<n)-1)^1<<i][i]=2*r[i],
		F.push(make_pair(((1<<n)-1)^1<<i,i));
		while(!F.empty()){
			int cs=F.front().first,k=F.front().second,ns; F.pop();
			rep(i,n)if(cs&1<<i){
				ns=cs^1<<i; t=c[cs][k]+d[r[k]][r[i]];
				if(c[ns][i]>t){
					c[ns][i]=t;
					if(ns==0&&t<=w){
						cout<<"OK"<<endl; goto END;
					}
					F.push(make_pair(ns,i));
				}
			}
		}
		cout<<"NA"<<endl;
		END:;
	}
	return 0;
}

Measured memory_bytes: 19000