akhauriyash/Code-Regression huggingface dataset:
/* imports all std modules {{{*/
import
  std.algorithm,
  std.array,
  std.ascii,
  std.base64,
  std.bigint,
  std.bitmanip,
  std.compiler,
  std.complex,
  std.concurrency,
  std.container,
  std.conv,
  std.csv,
  std.datetime,
  std.demangle,
  std.encoding,
  std.exception,
  std.file,
  std.format,
  std.functional,
  std.getopt,
  std.json,
  std.math,
  std.mathspecial,
  std.meta,
  std.mmfile,
  std.net.curl,
  std.net.isemail,
  std.numeric,
  std.parallelism,
  std.path,
  std.process,
  std.random,
  std.range,
  std.regex,
  std.signals,
  std.socket,
  std.stdint,
  std.stdio,
  std.string,
  std.system,
  std.traits,
  std.typecons,
  std.uni,
  std.uri,
  std.utf,
  std.uuid,
  std.variant,
  std.zip,
  std.zlib;
/*}}}*/

/+---test
1
3 7
---+/
/+---test
4
13 13
7 11
7 11
2017 2017
---+/

void main(string[] args) {
  enum N = 100000;
  const Q = readln.chomp.to!long;

  auto thieve = new bool[](N+1);
  thieve[] = true;
  thieve[0..2] = false;
  foreach (i; 2..N+1) {
    for (long j = i*2; j < thieve.length; j+=i) {
      thieve[j] = false;
    }
  }

  auto thieve2 = new bool[](N+1);
  foreach (i; 1..N/2+1) {
    thieve2[2*i-1] = thieve[i] && thieve[2*i-1];
  }

  auto pcnt = new long[](100001);
  foreach (i, ref c; pcnt) {
    if (i) c = pcnt[i-1] + thieve2[i];
  }

  foreach (q; 0..Q) {
    long l, r;
    readf(" %d %d ", &l, &r);
    (pcnt[r] - pcnt[l-1]).writeln;
  }
}


Measured memory_bytes: 2940
s = input()

a=[]
for i in range(len(s)):
    if((i+1)%2!=0):
        a += s[i]

#list内の結合にはjoin関数を用いる。.の前で結合するときに、間に何を入れるか指定できる。
moziretu = "".join(a)

print(moziretu)


Measured memory_bytes: 3572
import bisect
n,m,k = map(int,input().split())
a = [0]+list(map(int,input().split()))
b = list(map(int,input().split()))
for i in range(1,n+1):
  a[i] += a[i-1]
for j in range(1,m):
  b[j] += b[j-1]
ans = 0
for i in range(n+1):
  x = k-a[i]
  if x < 0:
    break
  ptr = bisect.bisect_right(b,x)
  ans = max(ans,ptr+i)
print(ans)

Measured memory_bytes: 120468
#include<bits/stdc++.h>
#define ft(i,l,r) for(register int i=l;i<=r;i++)
#define fd(i,r,l) for(register int i=r;i>=l;i--)
using namespace std;
long long a;
int main()
{
	cin>>a;
	cout<<a+a*a+a*a*a;
	return 0;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n;
bool ok[101];
int main()
{
	for(int i=1;i<=9;++i)for(int j=1;j<=9;++j)ok[i*j]=1;
	scanf("%d",&n);
	puts(ok[n]?"Yes":"No");
	return 0;
}


Measured memory_bytes: 256
import sys
import math
import collections
import itertools
import array
import inspect

# Set max recursion limit
sys.setrecursionlimit(10000)

# Debug output
def chkprint(*args):
    names = {id(v):k for k,v in inspect.currentframe().f_back.f_locals.items()}
    print(', '.join(names.get(id(arg),'???')+' = '+repr(arg) for arg in args))

# Binary converter
def to_bin(x):
    return bin(x)[2:]

# --------------------------------------------

dp = None

def main():
    N = int(input())
    name_list = [input() for i in range(N)]
    first_letter_dict = collections.defaultdict(lambda: 0)

    for name in name_list:
        first_letter_dict[name[0]] += 1

    first_letter_combination = [
        "MAR", "MAC", "MAH", "MRC", "MRH", "MCH", "ARC", "ARH", "ACH", "RCH"
    ]

    combinations = 0

    for f_comb in first_letter_combination:
        combinations += first_letter_dict[f_comb[0]] * first_letter_dict[f_comb[1]] * first_letter_dict[f_comb[2]]

    print(combinations)


main()


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

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    int s = 0;
    rep(i,n) s^= a[i];
    rep(i,n) a[i] ^= s;
    rep(i,n) cout << a[i] << endl;
    return 0;
}

Measured memory_bytes: 3920
import sys
import numpy as np
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import floyd_warshall

def main():
    H, W = map(int, sys.stdin.readline().split())
    cost = np.array([sys.stdin.readline().split() for _ in range(10)], dtype=np.int64)
    A = np.array(sys.stdin.read().split(), dtype=np.int64)
    
    graph = csr_matrix(cost)
    dist = floyd_warshall(csgraph=graph, directed=True)

    ans = dist[np.absolute(A)].T[1].astype(np.int64).sum()
    print(ans)

if __name__ == "__main__":
    main()


Measured memory_bytes: 27752
#include<bits/stdc++.h>
using namespace std;
typedef long long ll ;
const ll MOD = 1e9 + 7;
const ll dx[4] = { -1,1,0,0 };
const ll dy[4] = { 0,0,-1,1 };
const ll MAX = 1e5 + 50 ;
const ll oo = 1e16;
#define pb push_back
#define f first
#define s second
#define all(v) v.begin(),v.end()
long long gcd(long long  a, long long  b) { return (b == 0 ? a : gcd(b, a % b)); }
int n , m , ans , k ; string s ;


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

    vector < long long > v ;
    for(int i = 0 ; i < 5 ; ++i){
        ll x ;
        cin >> x ;
        v.pb(x);
    }

    cin >> k ;


    if(v[4] - v[0] > k)
        cout << ":(" << '\n';
    else
        cout << "Yay!" << '\n';


     return 0;
}




Measured memory_bytes: 256
from sys import stdin

def bisearch(f, n):
    l = 0
    r = n
    fl = f(l)
    fr = f(r)
    while l <= r:
        m = (l + r) // 2
        fm = f(m)
        if fm == n:
            return True
        elif fm > n:
            r = m - 1
            fr = f(r)
        else:
            l = m + 1
            fl = f(l)
    return False

def is_sqrt(n):
    return bisearch(lambda m: m * m, n)

def main():
    N, D = map(int, input().split())
    X = [tuple(map(int, input().split())) for _ in [0] * N]

    ans = 0
    for i in range(N - 1):
        for j in range(i + 1, N):
            n = 0
            for d in range(D):
                n += (X[i][d] - X[j][d]) ** 2
            ans += is_sqrt(n)
    print(ans)

input = lambda: stdin.readline()
main()


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
using namespace std;
const int inf = 1e18 + 7;
const int N = 1e6 + 7;
const int md = 1e9 + 7;
void sol() {
  int a;
  long double b;
  cin >> a;
  cin >> b;
  long double k = 1.0 * a * b;
  int ans = k;
  cout << ans << '\n';
}

int32_t main() 
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int T = 1;
  //cin >> T; 
  for(int t = 1; t <= T; t++) {
    //cout << "Case #" << t << ": ";
    sol();
  }
  return 0;
}


Measured memory_bytes: 3696
#include <bits/stdc++.h>
using namespace std;
int main ()
{
    long long n, m, k, t;
    cin >> n >> m >> k;
    t=n/k*k;
    int i=0;
    if (n==t)
        i+=1;
    while (t+k<=m)
    {
        i+=1;
        t+=k;
    }
    cout << i << endl;
}


Measured memory_bytes: 3620
#include "bits/stdc++.h"
using namespace std;
///////////////////////////////////////////
const long long int INF = 1LL<<60;
const long long int Mod = 1000000007;
using ll = long long int; using ci = const int;
using vi = vector<int>;  using Vi = vector<long long int>;
using P = pair<int, int>;  using PLL = pair<ll, ll>;
using matrix = vector<vector<ll>>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define rep(i,N) for(ll i = 0; i < (ll)N; i++)
#define repi(i,a,b) for(ll i = ll(a); i < ll(b); ++i)
template<class T>bool chmax(T &former, const T &b) { if (former<b) { former=b; return true; } return false; }
template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
template<class T> inline void princ(T x){cout<<x<<" ";}; 
template<class T> inline void print(T x){cout<<x<<"\n";};
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
///////////////////////////////////////////////////////////////////////////////////

struct edge{/*重み付き,有向*/
    int to , cost;/*toは接続先*/
    edge(ll to_ ,ll cost_ = 1){ to=to_; cost=cost_; };/*全てのcost=1 <=> 無向グラフ*/
};
bool operator<(edge e1 ,edge e2){return e1.cost < e2.cost; }
bool operator>(edge e1 ,edge e2){return e1.cost > e2.cost; }
using graph =  vector< vector<edge> >;
graph g;
ll n,m;
ll _l,_r,_d;
ll cost[100001];
ll ck[100001];
bool ans;
void dfs(ll idx,ll co){
    if(ck[idx]){
        if(cost[idx] != co){
            ans = false;
        }
    }else{
        ck[idx] = true;
        cost[idx] = co;
        rep(i,g[idx].size()){
            dfs(g[idx][i].to,co + g[idx][i].cost);
        }
    }
}


int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    std::cout<<std::fixed<<std::setprecision(30);
    cin>>n>>m;
    g.resize(n+1);
    rep(i,100001)ck[i]==false; 
    ans = true;
    rep(i,m){
        cin>>_l>>_r>>_d;
        g[_l].pb(edge(_r,_d));
        g[_r].pb(edge(_l,-_d));
    }
    rep(i,n){
        if(!ck[i+1]){
            dfs(i+1,0);
        }
    }
    Yes(ans);
    return 0;
}

Measured memory_bytes: 12288
module IntMap = Map.Make (struct
  type t = int
  let compare = compare
end)

let () = Scanf.scanf "%d\n" @@ fun n ->
  let vs = Array.init n @@ fun _ -> Scanf.scanf "%d " @@ fun v -> v in
  let (odds, evens) =
    Array.fold_left (fun (odds, evens) v ->
      (evens, IntMap.add v (1 + try IntMap.find v odds with Not_found -> 0) odds))
    (IntMap.empty, IntMap.empty) vs in
  let u, x1, x2 =
    match 
      List.sort (fun (_, x) (_, y) -> compare y x) @@
      IntMap.bindings odds
    with
    | [(u, x1)] -> u, x1, 0
    | (u, x1) :: (_, x2) :: _ -> u, x1, x2
  and v, y1, y2 =
    match 
      List.sort (fun (_, x) (_, y) -> compare y x) @@
      IntMap.bindings evens
    with
    | [(v, y1)] -> v, y1, 0
    | (v, y1) :: (_, y2) :: _ -> v, y1, y2 in
  Printf.printf "%d\n" @@ n -
    if u <> v then x1 + y1 else max (x1 + y2) (x2 + y1)


Measured memory_bytes: 16640
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef vector<ll> VI;
typedef vector<VI> VVI;
const ll MOD = 1000000007;
const ll INF = 4611686018427387903;
#define REP(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()

int main(){
	ll n; cin >> n;
	ll ans=0;
	for(int i=1;i<=n;i++){
		ll p=n/i;
		ans+=((p+1)*p/2)*i;
	}
	cout << ans << endl;
	return 0;
}

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

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

int main(){
    int N;
    cin >> N;
    long long Ta=1,Aa=1;
    int T,A;
    rep(i,N){
        cin >> T >> A;
        long long x = Ta/T;
		long long y = Aa/A;
		if(Ta%T != 0) x++;
		if(Aa%A != 0) y++;
        long long c = max(x,y);
        Ta = c * T;
        Aa = c * A;
    }
    cout << Ta + Aa << endl;

    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 100000;
const int MAX_P = 100;

const int MAX_PNUM = MAX_N + MAX_P * 10;

/* typedef */

typedef vector<int> vi;

/* global variables */

bool primes[MAX_PNUM + 1];
vi pnums;

/* subroutines */

int calc_prime(int max_p) {
  memset(primes, true, sizeof(primes));
  primes[0] = primes[1] = false;

  for (int p = 2; p * p <= max_p; p++)
    if (primes[p])
      for (int q = p * p; q <= max_p; q += p) primes[q] = false;

  for (int p = 2; p <= max_p; p++)
    if (primes[p]) pnums.push_back(p);

  return pnums.size();
}

/* main */

int main() {
  calc_prime(MAX_PNUM);
  
  for (;;) {
    int n, p;
    cin >> n >> p;
    if (n < 0) break;

    vi::iterator pbgn = upper_bound(pnums.begin(), pnums.end(), n);
    vi::iterator pend = min(pbgn + 10 * p, pnums.end());
    
    vi sums;
    for (vi::iterator pit0 = pbgn; pit0 != pend; pit0++)
      for (vi::iterator pit1 = pit0; pit1 != pend; pit1++)
	sums.push_back(*pit0 + *pit1);
    sort(sums.begin(), sums.end());

    cout << sums[p - 1] << endl;
  }
  
  return 0;
}

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

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

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

//const value
//const ll MOD = 1e9 + 7;
//const int dx[] = {0,1,0,-1};//{0,0,1,1,1,-1,-1,-1};
//const int dy[] = {1,0,-1,0};//{1,-1,0,1,-1,0,1,-1};

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


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n, d, a;
  cin >> n >> d >> a;
  VLL h(n), x(n);
  vector<PLL> p;
  rep(i, n) { cin >> x[i] >> h[i];
    p.push_back(PLL(x[i], i));
  }
  sort(all(p));
  p.push_back(PLL(1e13, 0));
  VLL endDm(n + 1, 0);
  ll dm = 0;
  ll ans = 0;
  rep(i, n) {
    ll idx = p[i].second;
    dm -= endDm[i];
    h[idx] -= dm;
    if (h[idx] <= 0) continue;
    ll addTime = ((h[idx] + a - 1) / a);
    ans += addTime;
    // cout << "addStep: " << x[idx] << " " << addTime << endl;
    ll add = a * addTime;
    ll endIdx = upper_bound(all(p), PLL(x[idx] + 2LL * d,1e9)) - p.begin();
    endDm[endIdx] += add;
    dm += add;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 9456
#include <cassert>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
#include <random>
#include <memory>
#include <utility>
#include <limits>
 
#define rep(i, a, b) for (long long (i) = (a); i < (b); i++)
#define all(i) i.begin(), i.end()
#define debug(i) std::cerr << "debug " <<"LINE:"<<__LINE__<<"  "<< #i <<":"<< i << std::endl

 
template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, std::pair<T1, T2> pa) {
  return os << pa.first << " " << pa.second;
}
 
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (int i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}
 
template<typename T1,typename T2>
inline bool chmax(T1& a,T2 b){return a<b && (a=b,true);}
 
template<typename T1,typename T2>
inline bool chmin(T1& a,T2 b){return a>b && (a=b,true);}
 
long long pow_mod(long long a, long long b, long long mod=-1) {
  if ((a == 0)||(mod!=-1&&a%mod==0)) {
    return 0;
  }
 
  long long x = 1;
 
  while (b > 0) {
    if (b & 1) {
      x = (mod!=-1)?(x * a) % mod:x*a;
    }
    a = (mod!=-1)?(a * a) % mod:a*a;
    b >>= 1;
  }
  return x;
}
 
// const long long MOD = 998244353;
const long long MOD = 1e9 + 7;

using ll = long long;
using P = std::pair<ll, ll>;

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

  ll n,k;
  std::cin>>n>>k;

  std::vector<ll> a(n);
  rep(i,0,n)std::cin>>a[i];

  std::vector<bool> ans(k+1);

  ans[0]=false;

  rep(i,1,k+1){
    bool val=false;
    rep(j,0,n){
      if(i<a[j])break;
      if(!ans[i-a[j]]){
        val=true;
        break;
      }
    }
    ans[i]=val;
  } 

  if(ans[k])std::cout<<"First\n";
  else std::cout<<"Second\n";

  return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
H, N = map(int, input().split())
a = []
for _ in range(N):
  u, v = map(int, input().split())
  a.append((u, v))
dp = [float("inf")] * (H + 1)
dp[H] = 0
for i in range(N):
  for j in range(H, -1, -1):
    dp[max(j - a[i][0], 0)] = min(dp[max(j - a[i][0], 0)], dp[j] + a[i][1])
print(dp[0])

Measured memory_bytes: 50396
def main():
    h,a,*m=open(0)
    h,w,k,a,b,f,g=map(int,(h+a).split())
    I=h*w
    d=[I]*I
    a=~w+a*w+b
    d[a]=1
    q=[a]
    for s in q:
        for y,x in(1,0),(-1,0),(0,1),(0,-1):
            for z in range(k):
                i,j=s//w+y*~z,s%w+x*~z
                t=i*w+j
                if not h>i>-1<j<w or'.'<m[i][j]or d[t]<=d[s]:break
                if d[t]==I:
                    q+=t,
                    d[t]=d[s]+1
    print(d[~w+f*w+g]%I-1)
main()

Measured memory_bytes: 66388
import Control.Applicative

main = do
  (n:a:b:_) <- (map (read::String->Int)) . words <$> getLine
  xs <- (map (read::String->Int)) . words <$> getLine

  let
    func (x:[]) = []
    func (x:y:ys) = minimum [(y-x)*a, b] : (func (y:ys))

  print $ sum $ func xs


Measured memory_bytes: 36220
#include<cstdio>
const int N=1e5+10;
int n,a[N],k;
long long ans;
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n+1;i++)
		scanf("%d",&a[i]);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&k);
		if(a[i]<k)
		{
			k-=a[i];
			ans+=a[i];
			if(a[i+1]<k)
			{
				ans+=a[i+1];
				a[i+1]=0;
			}
			else
			{
				a[i+1]-=k;
				ans+=k;
			}
		}
		else ans+=k;
	}
	printf("%lld",ans);
	return 0;
}


Measured memory_bytes: 512
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <iostream>
#include <algorithm>

using namespace std;

#define MAX(x,y) (x>y?x:y)
#define MIN(x,y) (x<y?x:y)
#define ABS(x) (x>0?x:-(x))

#define INF 1000000000

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

int gcd(int a, int b)
{
	if (a < b)
		swap(&a, &b);

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

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

void bubble_sort(int* p, int n)
{
	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < n - i - 1; j++)
		{
			if (p[j] > p[j + 1])
				swap(&p[j], &p[j + 1]);
		}
	}
}

int array_max(int* p, int n)
{
	int max = 0;
	for (int i = 0; i < n; i++)
	{
		if (p[i] > max)
			max = p[i];
	}
	return max;
}

int binary_search(int* p, int key, int n)
{
	int low = 0, high = n - 1;
	int middle;

	while (low <= high)
	{
		middle = (low + high) / 2;

		if (key == p[middle])
			return key;
		else if (key < p[middle])
			high = middle - 1;
		else if (key > p[middle])
			low = middle + 1;
	}
	return -1;
}

int main()
{
	int N;
	int M;
	int K;
	int a[100];
	char s[100][1000];
	char tmp[1000];
	char X[1000];
	int ans = 0;

	scanf("%d", &N);

	
	for (int i = 0; i < N; i++)
	{
		scanf("%s%d",s[i],&a[i]);
		//printf("%s\n", s[i]);
	}
	scanf("%s", X);

	//for(int i = 0; i < N; i++)
		//printf("%s\n",X);

	int count = 0;
	int sum = 0;

	for (int i = 0; i < N; i++)
	{
		if (strcmp(s[i],X)==0)
		{
			//printf("hjlbl");
			break;
		}
		count++;
	}

	for (int i = count+1; i < N; i++)
		ans += a[i];

//	for(int i = 0; i < N; i++)
		printf("%d\n",ans);

	
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<P,int> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

bool f(int S,int t){
	t--;
	if(S&1<<t) return 1;
	return 0;
}

int n,x,y,z;

int main(){
	cin>>n>>x>>y>>z;
	ll res=1,N=x+y+z,S=1<<N;
	vl dp(S);
	dp[0]++;
	for(int i=0;i<n;i++){
		(res*=10)%=mod;
		vl DP(S);
		for(int j=0;j<S;j++) for(int k=1;k<=10;k++){
			ll I=((j<<k)+(1<<(k-1)))%S;
			(DP[I]+=dp[j])%=mod;
		}
		for(int j=0;j<S;j++) if(f(j,x+y+z)&&f(j,y+z)&&f(j,z)) DP[j]=0;
		dp=DP;
	}
	for(int i=0;i<S;i++) res=(res-dp[i]+mod)%mod;
	cout<<res<<endl;
}

Measured memory_bytes: 2304
#include <bits/stdc++.h>
#include <iostream>
#include<math.h>
using namespace std;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
int main()
{
    int D, T, S;
    cin >> D >> T >> S;
    int s = D / S;
    if (D % S != 0) {
        s += 1;
    }

    if (s > T) {
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;
    }
    return 0;
}

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

using namespace std;

#define ll long long
constexpr ll inf = 1e9+7;

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

    ll N;
    cin>>N;
    string S;
    cin>>S;

    string ans;
    ll height = 0;
    for (ll n = 0; n < N; n++) {
        if (S[n] == ')' && height == 0) ans = "(" + ans + ")";
        else {
            ans += S[n];
            height += S[n] == '(' ? 1 : -1;
        }
    }
    ans += string(height, ')');
    cout<<ans<<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);
    int S = sc.nextInt();
    int h = S/3600;
    int m = (S%3600)/60;
    int s = S%60;
    System.out.println(h + ":" + m + ":" + s);
  }
}

Measured memory_bytes: 26180
S = list(input())
count = 0
max_count =0
for i in S :
    if(i=='R'):
        count = count + 1
    else :
        if(max_count < count) :
            max_count = count
            count = 0
if(max_count < count) :
    max_count = count

print(max_count)
        

Measured memory_bytes: 61800
#include <iostream>
#include <cmath>
#include <limits>
#include <cstring>
 
using namespace std;
int main(){
  int N;
  cin >> N;
  int a[N];
  for(int i = 0; i < N; i ++){
    cin >> a[i];
  }
  int hit[N+1];
  memset(hit, 0, sizeof hit);
  hit[1] = 1;
  int pos = 1;
  int cnt = 0;
  for(int i = 0; i < N; i ++){
//    cout << a[pos-1] << endl;
    pos = a[pos-1];
    cnt++;
    if(pos ==2){
      cout << cnt << endl;
      return 0;
    } else if(hit[pos] == 1){
       break; 
    }else {
      hit[pos] = 1;
    }
  }
  cout << "-1" << endl;
  return 0;
}

Measured memory_bytes: 1024
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))
cand = 10**9
ans = 0
for i in range(N):
  temp = T - H[i] * 0.006
  if abs(A - temp) < cand:
    cand = abs(A - temp)
    ans = i + 1    
print(ans)

Measured memory_bytes: 3064
import sys
sys.setrecursionlimit(10 ** 7)

N, Q = [int(_) for _ in input().split()]
edge = [[] for _ in range(N)]

for i in range(N-1):
    a, b = [int(_) for _ in input().split()]
    a -= 1
    b -= 1
    edge[a].append(b)
    edge[b].append(a)


vertex = [0] * N
for i in range(Q):
    p, x = [int(_) for _ in input().split()]
    p -= 1
    vertex[p] += x


def dfs(n, parent):
    for to in edge[n]:
        if to == parent:
            continue
        vertex[to] += vertex[n]
        dfs(to, n)


dfs(0, -1)
print(*vertex)


Measured memory_bytes: 232960
#include "bits/stdc++.h"
using namespace std;
const int maxn = 55;
string res;
int M(){
    int x, y, z;
    if(!(cin >> x >> y >> z)) return 0;
    multiset<string> v;
    for(int e = 0; e < x; e++) v.insert("a");
    for(int e = 0; e < y; e++) v.insert("b");
    for(int e = 0; e < z; e++) v.insert("c");
    while(v.size() > 1){
        string fi = *(v.begin());
        string se = *(--v.end());
        v.erase(v.begin());
        v.erase(--v.end());
        v.insert(fi + se);
    }
    cout << *(v.begin()) << endl;
    return 1;
}
int main(){
    while(M());
    return 0;
}


Measured memory_bytes: 256
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<complex>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
typedef pair<double,ll> pdl;
#define F first
#define S second
const ll E=1e18+7;
const ll MOD=1000000007;



int main(){
    ll l,n;
    cin>>l>>n;
    vector<ll> a(n);
    for(auto &i:a){cin>>i;}
    ll ans=max(l-a[0],a.back());
    vector<ll> dp(n);
    vector<ll> dp2(n);
    ll sum=0;
    for(int i=0;i<n;i++){sum+=a[i]; dp[i]=sum;}
    sum=0;
    for(ll i=n-1;i>=0;i--){sum+=l-a[i]; dp2[i]=sum;}
    reverse(dp2.begin(),dp2.end());
    sum=0;
    for(int i=0;i+1<n;i++){
        ll ret=dp[i]*2+dp2[n-i-2]*2;
        if(i+1==n-i-1){ret-=min(a[i],l-a[i+1]);}
        else if(i+1<n-i-1){
            ret-=l-a[i+1];
            if(n-i-2-i-2>=0){
                ret-=dp2[n-i-2-i-2]*2;
            }
            ll ret2=dp[i]*2+dp2[n-i-2]*2;
            ret2-=a[i];
            if(n-i-2-i-1>=0){
                ret2-=dp2[n-i-2-i-1]*2;
            }
            ret=max(ret,ret2);
        }
        else{
            ret-=a[i];
            if(i-(n-i)>=0){
                ret-=dp[i-(n-i)]*2;
            }
            ll ret2=dp[i]*2+dp2[n-i-2]*2;
            ret2-=l-a[i+1];
            if(i-(n-i-1)>=0){
                ret2-=dp[i-(n-i-1)]*2;
            }
            ret=max(ret,ret2);
        }
        ans=max(ans,ret);
        //cout<<ret<<endl;
    }
    cout<<ans<<endl;
    
    
    
    return 0;
}


Measured memory_bytes: 5504
#include<iostream>
using namespace std;
int main()
{
	char str[19];
	cin>>str;
	int i;
	for(i=0;i<19;i++)
	{
		if(str[i]==',')
		{
			cout<<" ";
		}
		else
		{
			cout<<str[i];
		}
	}
	return 0;
}

Measured memory_bytes: 3588
import java.util.*;

public class Main{
    void solve(){
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int[] a = new int[n];
        int[] num = new int[100010];
        long sum = 0;
        for(int i = 0; i < n; i++){
            a[i] = scan.nextInt();
            num[a[i]]++;
            sum += a[i];
        }
        int q = scan.nextInt();
        for(int i = 0; i < q; i++){
            int b = scan.nextInt();
            int c = scan.nextInt();
            sum += num[b] * (c - b);
            num[c] += num[b];
            num[b] = 0;
            System.out.println(sum);
        }
    }

    public static void main(String[] args){
        new Main().solve();
    }
}


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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(x) (x).begin(),(x).end()
#define endl "\n"

using ll = long long;
using P = pair<int,int>;
using mp =  map<string,int>;

const int MOD = 1e9 + 7;

int main() {
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

    int a, b, c, d;
    cin >> a >> b >> c >> d;

    if(a + b > c + d) {
        cout << "Left" << endl;
    }else if(a + b == c + d){
        cout << "Balanced" << endl;
    }else{
        cout << "Right" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
def a_atcoder_contest_scheduling(CONTEST=26):
    D = int(input())
    Satisfaction_decreasing = [int(i) for i in input().split()]
    Satisfaction_difference = [[int(i) for i in input().split()] for j in range(D)]

    # とりあえず満足度の減少があまり大きくならないようにする
    # 現時点で満足度を大きく下げてしまうような、しばらく開催していないコンテストを開く
    ans = []
    last = {i: 0 for i in range(1, CONTEST + 1)}
    for day in range(1, D + 1):
        max_decreasing = -1
        max_contest_type = -1
        for type, d in last.items():
            decreasing = Satisfaction_decreasing[type - 1] * (day - last[type])
            if decreasing > max_decreasing:
                max_decreasing = decreasing
                max_contest_type = type

        last[max_contest_type] = day
        ans.append(max_contest_type)
    return '\n'.join(map(str, ans))

print(a_atcoder_contest_scheduling())

Measured memory_bytes: 68380
#include<iostream>

using namespace std;

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

int _convert(string str) {
  return str[0] * 600 + str[1] * 60 + str[3] * 10 + str[4];
}

int convert(string str) {
  return _convert(str) - _convert("00:00");
}

int main() {
  int n, t;
  cin >> n >> t;
  string a[n], b[n], name1[n], name2[n];
  rep (i, n) cin >> a[i] >> name1[i] >> b[i] >> name2[i];
  string res1[n];
  int res2[n];
  int m = 0;
  rep (i, n - 1) {
    if (convert(b[i]) + t <= convert(a[i + 1])) {
      res1[m] = name2[i];
      res2[m] = convert(a[i + 1]) - convert(b[i]);
      m++;
    }
  }
  cout << m << endl;
  rep (i, m) {
    cout << res1[i] << " " << res2[i] << endl;
  }
  return 0;
}

Measured memory_bytes: 1224
import java.util.Scanner;


public class Main {
    
    public static void main(String[] args) throws Exception {
        new Main().solve();
    }

    private void solve() throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] ds = new int[n];
        for (int i = 0; i < n; i++) {
            ds[i] = sc.nextInt();
        }
        
        int MAX = 100000;
        int MAX_D = 5;
        boolean[] occured = new boolean[MAX];
        for (int i = 0; i < n; i++) {
            int s = 0;
            for (int j = i; j < i + MAX_D && j < n; j++) {
                s *= 10;
                s += ds[j];
                if (s < MAX) {
//                    if (!occured[s])System.out.println("v: " + s);
                    occured[s] = true;
                }
            }
        }
        
        for (int i = 0; i < MAX; i++) {
            if (!occured[i]) {
                System.out.println(i);
                return;
            }
        }
    }

}

Measured memory_bytes: 29884
N = int(input())
n_list_idx = [0 for _ in range(N + 1)]
for i in range(N):
    v = int(input())
    n_list_idx[v] = i

o_max = 1
o = 1
for i in range(2, len(n_list_idx)):
    if n_list_idx[i] > n_list_idx[i - 1]:
        o += 1
    else:
        if o > o_max:
            o_max = o
        o = 1
if o > o_max:
    o_max = o
print(N - o_max)


Measured memory_bytes: 11048
#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <set>
using namespace std;

#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl

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

#define INF 1000000000

int getSmall(int n, int d){
  int a[10];
  rep(i,10)a[i]=0;

  while(n>0){
    a[n%10]++;
    n/=10;
  }

  int res=0;
  repl(i,1,10){
    rep(j,a[i]){
      res = res*10 + i;
    }
  }
  return res;
}

int getLarge(int n, int d){
  int a[10];
  rep(i,10)a[i]=0;

  rep(i,d){
    a[n%10]++;
    n/=10;
  }

  int res=0;
  rep(i,10){
    rep(j,a[9-i]){
      res = res*10 + 9-i;
    }
  }
  return res;
}

int main(){
  while(true){
    int n,d;
    cin>>n>>d;
    if(n==0 && d==0) break;

    int a[100];
    a[0]=n;
    int idx=0;
    bool nxt=true;
    while(nxt){
      a[idx+1]=getLarge(a[idx],d) - getSmall(a[idx],d);
      idx++;
      rep(i,idx){
	if(a[i]==a[idx]){
	  printf("%d %d %d\n", i, a[idx], idx-i);
	  nxt=false;
	  break;
	}
      }
    }
  }
}

Measured memory_bytes: 1144
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

vector<int> d;
int k;

bool in(int n)
{
    int i = 1;
    while((n / i) > 0){
        int checker = n / i;
        checker = checker % 10;
        for(int j = 0; j < d.size(); j++){
            if(d[j] == checker){
                return true;
            }
        }
        i = i * 10;
    }
    return false;
}

int main() {
    int n;
    cin >> n >> k;
    for(int i = 1; i <= k; i++){
        int in;
        cin >> in;
        d.push_back(in);
    }
    while(in(n)){
        n++;
    }
    cout << n << endl;

        return 0;
}

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

using lli = long long int;

template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

template <class T>ostream &operator<<(ostream &o,const pair<T, T>&p)
{o<<"("<<p.first<<", "<<p.second<<")";return o;}

int main(void){
    int a[3][3];
    int n;
    for(int i = 0; i < 3; i++){
        for(int j = 0; j < 3; j++){
            cin >> a[i][j];
        }
    }
    cin >> n;
    vector<int> b(n);
    for(auto &i : b) cin >> i;
    bool bingo[3][3];
    for(int i = 0; i < 3; i++){
        for(int j = 0; j < 3; j++){
            bingo[i][j] = false;
        }
    }
    for(auto i : b){
        for(int s = 0; s < 3; s++){
            for(int t = 0; t < 3; t++){
                if(a[s][t] == i){
                    bingo[s][t] = true;
                }
            }
        }
    }

    if(bingo[0][0] == true && bingo[0][1] == true && bingo[0][2] == true) cout << "Yes" << endl;
    else if(bingo[1][0] == true && bingo[1][1] == true && bingo[1][2] == true) cout << "Yes" << endl;
    else if(bingo[2][0] == true && bingo[2][1] == true && bingo[2][2] == true) cout << "Yes" << endl;
    else if(bingo[0][0] == true && bingo[1][0] == true && bingo[2][0] == true) cout << "Yes" << endl;
    else if(bingo[0][1] == true && bingo[1][1] == true && bingo[2][1] == true) cout << "Yes" << endl;
    else if(bingo[0][2] == true && bingo[1][2] == true && bingo[2][2] == true) cout << "Yes" << endl;
    else if(bingo[0][0] == true && bingo[1][1] == true && bingo[2][2] == true) cout << "Yes" << endl;
    else if(bingo[0][2] == true && bingo[1][1] == true && bingo[2][0] == true) cout << "Yes" << endl;
    else cout << "No" << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

long long n,m,ans;

int main(void){
	scanf("%lld%lld",&n,&m);
	ans=m-(n<<1);
	if(ans<0)
		printf("%lld\n",m>>1);
	else
		printf("%lld\n",n+(ans>>2));
	return 0;
}

Measured memory_bytes: 128
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <stack>
#include <set>
#include <algorithm>
#include <utility>
#include <iomanip>

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

using namespace std;

typedef pair<int, int> P;

const int INF = 1e15;
const int MOD = 1e9+7;

vector<int> prime(int n){
    vector<int> t;
    vector<bool> x(n+1, true);
    t.push_back(2);

    int i;
    for(i = 3; i * i <= n; i += 2){
        if(!x[i]){
            continue;
        }
        t.push_back(i);
        for(int j = i; j <= n; j += i){
            x[j] = false;
        }
    }
    for(; i <= n; i += 2){
        if(x[i]){
            t.push_back(i);
        }
    }
    return t;
}

signed main(){
    int n;
    cin >> n;

    vector<int> t = prime(55555);

    vector<int> ans;
    int i = 0;
    while((int)ans.size() != n){
        if(t[i] % 5 == 1){
            ans.push_back(t[i]);
        }
        i++;
    }
    for(int i = 0; i < (int)ans.size()-1; i++){
        cout << ans[i] << " ";
    }
    cout << ans[ans.size()-1] << endl;

    return 0;
}


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

int main() {
	int h,w;
	
	while(1) {
		cin >> h >> w;	
		if (h==0 && w==0) break;
		
		for (int j=0;j<h;j++){
			for (int i=0;i<w;i++){
				cout << "#";
			}
			cout << endl;
		}
		cout << endl;
	}
	return 0;
}


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

/* 大文字を小文字に変換 */
char tolower(char c) {return (c + 0x20);}
/* 小文字を大文字に変換 */
char toupr(char c) {return (c - 0x20);}

// if('A'<=s[i] && s[i]<='Z') s[i] += 'a'-'A';

/*
string s = "abcdefg"
s.substr(4) "efg"
s.substr(0,3) "abc"
s.substr(2,4) "cdef"

// イテレータ要素のインデックス
distance(A.begin(), itr);
*/

int main()
{
    int a; cin >> a;
    int ans = a+a*a+a*a*a;
    cout << ans << endl;
}

Measured memory_bytes: 3628
class Car
  num = 1
  
  define_method(:initialize) do |wait_time:|
    @num = num
    num += 1
    @wait_time = wait_time
  end
  attr_reader :num, :wait_time
  
  def next_minute
    @wait_time -= 1
  end
  
  define_singleton_method(:clear) {num = 1}
end

class ParkingLot
  Space = Struct.new(:upper, :lower)
  
  def initialize(num)
    @spaces = num.times.map {|i| Space.new}
  end
  attr_reader :spaces
  
  def add_car(new_car)
    idx = @spaces.index {|sp| sp.lower.nil?}
    if idx
      @spaces[idx].lower = new_car   #下のスペースが空いている
    else
      return false if @spaces.all?(&:upper)    #満車
      
      #下は空いていないが満車でない場合
      idxs = @spaces.map.with_index {|sp, i| sp.upper ? nil : i}.compact
      idx = idxs.map {|i|
        diff = @spaces[i].lower.wait_time - new_car.wait_time
        diff >= 0 ? [diff, i] : nil
      }.compact.sort.first&.last
      unless idx
        idx = idxs.map {|i| [new_car.wait_time - @spaces[i].lower.wait_time, i]}
                  .sort.first.last
      end
      
      @spaces[idx].upper = @spaces[idx].lower
      @spaces[idx].lower = new_car
    end
    true
  end
  
  def cars_go_out
    out = []
    
    2.times do
      @spaces.each do |sp|
        if sp.lower && sp.lower.wait_time <= 0
          out << sp.lower.num
          sp.lower = sp.upper
          sp.upper = nil
        end
      end
    end
    
    out
  end
  
  #車庫が空か
  def empty?
    @spaces.all? {|sp| sp.lower.nil?}
  end
end

class TimeManegement
  def initialize(cars, pl)
    @time = 0
    @from_somewhere = cars
    @pl = pl
    @entrance = []
    
    class << @from_somewhere
      def car_comes
        shift
      end
    end
    
    class << @entrance
      def car_enters
        shift
      end
      
      def restore(car)
        unshift(car)
      end
    end
  end
  
  def next_minute
    @time += 1
    
    #駐車スペースにある車の残りの駐車時間を一分減らす
    @pl.spaces.each do |sp|
      sp.lower&.next_minute
      sp.upper&.next_minute
    end
  end
  
  def cars_go_out
    @pl.cars_go_out
  end
  
  def car_comes
    @entrance << @from_somewhere.car_comes if next_car_comes?
    
    while (new_car = @entrance.car_enters)
      unless @pl.add_car(new_car)
        @entrance.restore(new_car)    #満車の場合
        break
      end
    end
  end
  
  def end?
    @pl.empty?
  end
  
  private
  
  def next_car_comes?
    (@time % 10).zero? && !@from_somewhere.empty?
  end
end


until (given = gets.split.map(&:to_i)) == [0, 0]
  Car.clear
  
  m, n = given
  cars = n.times.map {Car.new(wait_time: gets.to_i)}
  
  pl = ParkingLot.new(m)
  tm = TimeManegement.new(cars, pl)
  
  result = []
  
  loop do
    result += tm.cars_go_out
    tm.car_comes
    break if tm.end?
    tm.next_minute
  end
  
  puts result.join(" ")
end


Measured memory_bytes: 6912
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String[] str = in.readLine().split(" ");
    int x = Integer.parseInt(str[0]);
    int y = Integer.parseInt(str[1]);
    int z = Integer.parseInt(str[2]);
    System.out.println((x-z)/(y+z));
  }
}

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

using namespace std;



int main () {

	int H, N;
	scanf("%d %d", &H, &N);

	vector<int> A(N);
	for (int &x : A) scanf("%d", &x);

	long long total = 0;
	for (int x : A) {
		total += x;
		if (total >= H) {
			printf("Yes\n");
			return 0;
		}
	}

	if (total >= H) {
		printf("Yes\n");
		return 0;
	}

	printf("No\n");

	return 0;
}
 

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
 
#define FAST ios_base::sync_with_stdio(0); cin.tie(); cout.tie();
 
#define MAXX 100005
 
#define PI   3.14159265358979323846264338327950

#define PB push_back 
#define F first
#define S second
 
#define ll 	 long long int

#define mod  1000000007




int main()
{
	FAST;
	ll a, b;
	cin >> a >> b;
	if(b == 100){
		b  = 101;
	} cout << b;
	for(ll i = 1; i <= a; i ++){
		cout << "00";
	}
	return 0;
}

Measured memory_bytes: 3660
a, p = list(map(int, input().split()))
# a = list(map(int, input().split()))
#data = [list(map(int, input().split())) for i in range(n)]
# n = int(input())
# n, m = list(map(int, input().split()))
# ab_sorted = sorted(ab, key=lambda x: x[0])
total = a*3+p
ans = total/2
print(int(ans))


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

static int bitcount(int b)
{
    int c = 0;
    for (int i =0 ; i < 10; i++)
        if (1<<i & b) c++;
    return c;
}

int main()
{
    int n,m;
    std::cin >> n >> m;
    std::vector<int> k(m), p(m);
    for (int i = 0; i < m; i++) {
        int tmp;
        std::cin >> tmp;
        for (int j = 0; j < tmp; j++) {
            int s;
            std::cin >> s;
            k[i] |= (1 << (s-1));
        }
    }

    for (int i = 0; i < m; i++) {
        std::cin >> p[i];
    }

    int total = 0;
    for (int i = 0; i < (1 << n); i++) {
        int match = 1;
        for (int j = 0; j < m; j++) {
            int on = bitcount(i&k[j]);
            // std::cout << i << "," << on << "," << k[j] << std::endl;
            if (on % 2 != p[j]) {
                match = 0;
                break;
            }
        }
        total+=match;
    }

    std::cout << total << std::endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

static const int N = 1000;

void trace(int A[], int n){
  int i;
  for ( i = 1; i <= n; i++ ){
    if ( i > 1 ) printf(" ");
    printf("%d", A[i]);
  }
  printf("\n");
}

int main(){
  int n, i, j;
  int A[N+1];
  scanf("%d", &n);

  for ( i = 1; i <= n; i++ ) scanf("%d", &A[i]);
  
  trace(A, n);

  int v;

  for(i=2;i<=n;i++){
    v = A[i];
    j = i-1;
    while(j>=0 && A[j]>v){
      A[j+1] = A[j];
      j--;
    }
    A[j+1] = v;

    trace(A, n);

  }

  return 0;
}

Measured memory_bytes: 604
# わがらんぞー

def is_prime(q):
    q = abs(q)
    if q == 2: return True
    if q < 2 or q&1 == 0: return False
    return pow(2, q-1, q) == 1

N = int(input())

p = [0]*(N+1)

for i in range(2, N+1):
    for j in range(2, i+1):
        if is_prime(j) == False:
            continue
        while i%j==0:
            i //= j
            p[j] += 1
        if i == 1:
            break

r = 1
for q in p:
    r = r * (q+1)
print(r%(10**9+7))

Measured memory_bytes: 3188
getNumber :: String -> (Integer, Integer)
getNumber xs = (read $ fst h, read $ tail $ snd h)
  where h = break (== ' ') xs

reduceNums :: (Integer, Integer) -> Integer 
reduceNums (0,y) = y `div` 4
reduceNums (x,y) = if y `div` x >= 2
                     then x + (y - 2 * x) `div` 4
                     else y `div` 2
main :: IO ()
main = do
  nums <- fmap (reduceNums.getNumber) getLine
  putStrLn $ show nums



Measured memory_bytes: 508
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> pii;
const ll INF = 1ll<<30;
const ll longINF = 1ll<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;
const bool debug = 0;
//---------------------------------//

int main() {
	int N, K;
	cin >> N >> K;
	
	vector<pii> ans;
	REP(i, N - 1) ans.emplace_back(i, N - 1);
	
	int dif = (N - 1) * (N - 2) / 2 - K;
	REP(i, N - 1) FOR(j, i + 1, N - 1) if (dif > 0) {
		ans.emplace_back(i, j);
		dif--;
	}
	
	if (dif != 0) {
		puts("-1");
		return 0;
	}
	
	cout << ans.size() << endl;
	for (pii cur : ans) printf("%d %d\n", cur.fi + 1, cur.se + 1);
	
	return 0;
}


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

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

typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef tuple<int,int,int> tpl;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define LB(a,x) lower_bound((a).begin(), (a).end(), x) - (a).begin()
#define UB(a,x) upper_bound((a).begin(), (a).end(), x) - (a).begin()

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);--i)
#define RREP(i,n) RFOR(i,n,0)

#define en "\n"

const double EPS = 1e-9;
const double PI  = acos(-1.0);
const int INT_INF = 2147483647;
const long long LL_INF = 1LL<<60;
const long long MOD = 1000000007; // 998244353

#define CLR(a) memset((a), 0, sizeof(a))

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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(void){
    int N; cin >> N;
    VS W(N); REP(i,N) cin >> W[i];
    char last = W[0].back();
    map<string,int> m;
    m[W[0]] = 0;
    REP(i,N-1){
        if(last != W[i+1][0]){
            cout << "No" << endl;
            return 0;
        }
        if(m.find(W[i+1]) != m.end()){
            cout << "No" << endl;
            return 0;
        }
        last = W[i+1].back();
        m[W[i+1]] = 0;
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include <cassert>
#include <cmath>
#include<cstdint>

#define INF 1e9
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<int,int>;

vector<int>bitSearch(int bit,int n){
    vector<int>S;
    rep(i,n)if(bit&(1<<i))S.push_back(i);
    return S;
}


int d[3] = {-1,0,1};
int main(){
    char a,b;cin>>a>>b;
    if(a=='H')cout<<b;
    else {
        if(b=='H')cout<<'D';
        else cout<<'H';
    }
}



Measured memory_bytes: 256
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cfloat>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define int long long
#define ll long long
#define eps LDBL_EPSILON
#define mod (ll)1000000007
#define INF LLONG_MAX/10
#define P pair<int,int>
#define prique priority_queue
using namespace std;
signed main() {
	int n;
	cin >> n;
	if (n % 2 == 0)cout << 0.500000000 << endl;
	else cout << ((n + 1) / 2.0) / n << endl;
	return 0;
}

Measured memory_bytes: 256