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

using namespace std;

class ModInt{
private:
  long long number;

public:
  static constexpr long long mod = 1000000007;

  constexpr ModInt(const ModInt& x) : number(x.number){};

  constexpr ModInt(const long long number = 0) : number((mod + number) % mod){}

  constexpr long long get() const{
    return number;
  }

  constexpr ModInt& operator=(const ModInt& rhs) &{
    number = rhs.number;
    return *this;
  }

  constexpr ModInt operator+() const{
    return ModInt(*this);
  }

  constexpr ModInt operator-() const{
    return ModInt(mod - number);
  }

  constexpr ModInt& operator+=(const ModInt& rhs){
    number += rhs.number;
    if(number >= mod) number -= mod;
    return *this;
  }

  constexpr ModInt& operator-=(const ModInt& rhs){
    number -= rhs.number;
    if(number < 0) number += mod;
    return *this;
  }

  constexpr ModInt& operator*=(const ModInt& rhs){
    (number *= rhs.number) %= mod;
    return *this;
  }

  constexpr ModInt& operator/=(const ModInt& rhs){
    (*this) *= rhs.inverse();
    return *this;
  }

  constexpr ModInt inverse() const{
    long long a = number, m = mod, u = 1, v = 0;

    while(m){
      long long t = a / m;
      a -= t * m;
      u -= t * v;

      //swap a, m
      a ^= m; m ^= a; a ^= m;

      //swap u, v
      u ^= v; v ^= u; u ^= v;
    }

    return ModInt(u);
  }

  constexpr ModInt& operator++(){
    return *this += 1;
  }

  constexpr ModInt& operator--(){
    return *this -= 1;
  }

  constexpr ModInt operator++(int){
    ModInt ret = *this;
    ++(*this);
    return ret;
  }

  constexpr ModInt operator--(int){
    ModInt ret = *this;
    --(*this);
    return ret;
  }
};

constexpr ModInt operator+(const ModInt& lhs, const ModInt& rhs){
  return ModInt(lhs) += rhs;
}

constexpr ModInt operator-(const ModInt& lhs, const ModInt& rhs){
  return ModInt(lhs) -= rhs;
}

constexpr ModInt operator*(const ModInt& lhs, const ModInt& rhs){
  return ModInt(lhs) *= rhs;
}

constexpr ModInt operator/(const ModInt& lhs, const ModInt&rhs){
  return ModInt(lhs) /= rhs;
}

constexpr ModInt operator^(const ModInt& lhs, const int& rhs){
  long long b = lhs.get(), e = rhs, y = 1, mod = lhs.mod;
  bool inv = e < 0;
  if(inv) e = -e;

  while(e){
    if(e & 1) (y *= b) %= mod;

    (b *= b) %= mod;
    e >>= 1;
  }

  return (inv ? ModInt(y).inverse() : ModInt(y));
}

std::istream& operator>>(std::istream& is, ModInt& x){
  long long in;
  is >> in;
  x = in;
  return is;
}

std::ostream& operator<<(std::ostream& os, const ModInt& x){
  os << x.get();
  return os;
}

using namespace std;

int main(){
  int N;
  cin >> N;
  
  vector<int> x(N);
  for(int i = 0; i < N; i++) cin >> x[i];
  
  vector<ModInt> sum(N);
  sum[1] = 1;
  for(int i = 2; i < N; i++){
    sum[i] = sum[i - 1] + 1 / ModInt(i);
  }
  
  ModInt ans = 0;
  for(int i = 1; i < N; i++){
    ans += (x[i] - x[i - 1]) * sum[i];
  }
  
  for(int i = 1; i < N; i++){
    ans *= i;
  }
  
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <utility>
#include <queue>
#include <set>
#include <map>
#include <deque>
#include <iomanip>
#include <cstdio>
#include <stack>
#include <numeric>
#include <cassert>
using namespace std;
typedef  long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
#define  MP make_pair
#define  PB push_back
#define inf 1000000007
#define mod 1000000007
#define rep(i,n) for(int i=0;i<(int)(n);++i)

#define int long long
signed main(){
    ll L,R;
    cin >> L >> R;
    int a[60]={};
    int b[60]={};
    int pp = -1;
    int qq = -1;
    rep(i,60){
        if((L>>i)&1){
            a[i] = 1;
            pp = i;
        }
        if((R>>i)&1){
            b[i] = 1;
            qq = i;
        }
    }
    ll dp[61][2][2]={};
    for(int i=59;i>=0;i--){
        if(i>=pp&&i<=qq){
            bool p = i==pp;
            bool q = i==qq;
            dp[i][p][q]++;
            dp[i][p][q]%=mod;
            //cerr << i << " " << p << " " << q << endl;
        }
        if(a[i]==1&&b[i]==1){
            dp[i][1][1] += dp[i+1][1][1];
            dp[i][1][1] %= mod;
            dp[i][0][1] += dp[i+1][0][1]*2;
            dp[i][0][1] %= mod;
            dp[i][1][0] += dp[i+1][1][0];
            dp[i][1][0] %= mod;
            dp[i][0][0] += dp[i+1][0][0]*3+dp[i+1][0][1];
            dp[i][0][0] %= mod;
        }
        if(a[i]==1&&b[i]==0){
            dp[i][1][0] += dp[i+1][1][0];
            dp[i][1][0] %= mod;
            dp[i][0][1] += dp[i+1][0][1];
            dp[i][0][1] %= mod;
            dp[i][0][0] += dp[i+1][0][0]*3;
            dp[i][0][0] %= mod;
        }
        if(a[i]==0&&b[i]==1){
            dp[i][1][1] += dp[i+1][1][1];
            dp[i][1][1] %= mod;
            dp[i][0][1] += dp[i+1][1][1]+dp[i+1][0][1]*2;
            dp[i][0][1] %= mod;
            dp[i][1][0] += dp[i+1][1][0]*2+dp[i+1][1][1];
            dp[i][1][0] %= mod;
            dp[i][0][0] += dp[i+1][1][0] + dp[i+1][0][1] + dp[i+1][0][0]*3;
            dp[i][0][0] %= mod;
        }
        if(a[i]==0&&b[i]==0){
            dp[i][1][1] += dp[i+1][1][1];
            dp[i][1][1] %= mod;
            dp[i][0][1] += dp[i+1][0][1];
            dp[i][0][1] %= mod;
            dp[i][1][0] += dp[i+1][1][0]*2;
            dp[i][1][0] %= mod;
            dp[i][0][0] += dp[i+1][1][0] + dp[i+1][0][0]*3;
            dp[i][0][0] %= mod;
        }
    }
    // for(int i=7;i>=0;i--){
    //     cerr << dp[i][0][0] << " " << dp[i][0][1] << " " << dp[i][1][0] << " " << dp[i][1][1] << endl;
    // }
    cout << (dp[0][0][0]+dp[0][0][1]+dp[0][1][0]+dp[0][1][1])%mod << endl;
    return 0;
}

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

int main(){
  int n,t,a;
  cin >> n >> t >> a;
  double h;
  double mini = 10e4;
  int num;
  for(int i = 1; i <= n; i++){
    cin >> h;
    h = t - h*0.006;
    if(mini > abs(a-h)){
      mini = abs(a-h);
      num = i;
    }
  }
  cout << num << endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define pb push_back
#define COUT(x) cout << (x) << endl
#define COUTF(x) cout << setprecision(15) << (x) << endl
#define ENDL cout << endl
#define DF(x) x.erase(x.begin())  // 先頭文字削除
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define REVERSE(x) reverse(ALL(x))
#ifdef _DEBUG
#define debug(x) cout << "[debug] " << #x << ": " << x << endl
#else
#define debug(x)
#endif
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using P = pair<ll, ll>;
constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr double PI = 3.141592653589793238462643383279;
ll getDigit(ll x) {
  return x == 0 ? 1 : log10(x) + 1;
}

ll gcd(ll x, ll y) {
  return y ? gcd(y, x % y) : x;
}

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

vector<P> factorize(ll n) {
  vector<P> result;
  for (ll i = 2; i * i <= n; ++i) {
    if (n % i == 0) {
      result.pb({i, 0});
      while (n % i == 0) {
        n /= i;
        result.back().second++;
      }
    }
  }
  if (n != 1) {
    result.pb({n, 1});
  }
  return result;
}

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;
}

template <typename T>
void debugV(const vector<T> v) {
#ifdef _DEBUG
  rep(i, v.size()) {
    cout << i << ":" << v[i] << " ";
  }
  cout << endl;
#else
  (void)v;
#endif
}

signed main() {
  string N;
  cin >> N;
  rep(i, N.size()) {
    if (i == 0) {
      continue;
    }
    if (N[i] == N[i - 1]) {
      COUT("Bad");
      return 0;
    }
  }
  COUT("Good");
  return 0;
}

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

 using namespace std;
int main() {
    int N, T;
    cin >> N >> T;
    int ans = 1e9;
    for(int i = 0; i < N; ++i){
        int c, t; cin >> c >> t;
        if (c < ans && t <= T){
            ans = c;
        }
    }
    if (ans == 1e9){
        cout << "TLE" << endl;
    }
    else{
        cout << ans << endl;
    }
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int,input().split()))
mod = 10**9 + 7
r = 0
b = 0
g = 0
ans = 1
for i in range(n):
    p = 0
    if a[i] == r:
        p += 1
        r += 1
    if a[i] == b:
        p += 1
        if p == 1:
            b += 1
    if a[i] == g:
        p += 1
        if p == 1:
            g += 1
    ans *= p
    ans %= mod
print(ans)

Measured memory_bytes: 53044
import sys
s = input()
if len(s) == 2:
    if len(set(list(s))) == 1:
        print(1, 2)
    else:
        print(-1, -1)
    sys.exit()
flag = 0
for i in range(len(s)-2):
    if len(set(list(s[i:i+3]))) <= 2:
        print(i+1, i+3)
        flag = 1
        break

if flag == 0:
    print(-1, -1)


Measured memory_bytes: 3188
S = input()

L = len(S)
if S[0]=="0" or S[-1]=="1":
    print(-1)
    exit()
for i in range(L-2):
    if S[i] != S[L-2-i]:
        print(-1)
        exit()

pv = 1
for i in range(L-1):
    nv = i+2
    # 現頂点から次の頂点へ、長さを確保
    if S[i]=="1":
        print(pv,nv)
        pv = nv
    # 現頂点への葉とする
    else:
        print(pv,nv)



Measured memory_bytes: 4648
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main() {
  int a;
  cin >> a;
  string s;
  cin >> s;
  if (a >= 3200) {
    cout << s;
  } else {
    cout << "red";
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cctype>
#include <cstdio>
#include <string>
#include <algorithm>
#include <vector>
#include <complex>
#include <cstring>
using namespace std;
#define loop(i,a,b) for(int i=a; i<b; i++)
#define rep(i,a) loop(i,0,a)

int rx[4],ry[4],v[4][4];

inline bool valid(int x, int y){
    return 0<=x&&x<=3&&0<=y&&y<=3;
}

int dfs(){
    int xx=-1,yy=-1;
    rep(i,16){
        int tx = i&3;
        int ty = i>>2;
        if(!v[ty][tx]){
            xx = tx, yy = ty;
            break;
        }
    }
    if(xx < 0) return 1;
    v[yy][xx]=1;
    int ans=0;
    rep(i,4){
        int nx=xx+rx[i], ny=yy+ry[i];
        if(valid(nx,ny) && !v[ny][nx]){
            v[ny][nx] = 1;
            ans+=dfs();
            v[ny][nx] = 0;
        }
    }
    v[yy][xx]=0;
    return ans;
}

int main(){
    while(cin >> rx[0] >> ry[0]){
        loop(i,1,4) cin>>rx[i]>>ry[i];
        memset(v,0,sizeof(v));
        cout << dfs() << endl;
    }
}

Measured memory_bytes: 1160
N = int(input())
A = list(map(int,input().split()))

dp = [[0 for j in range(N+1)] for i in range(N+1)]

for t in range(1,N+1):
    for i in range(N-t+1):
        j = i+t
        if (N-t)%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])

print(dp[0][N])

Measured memory_bytes: 120156
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
 
int main(){
  int N,M;
  cin >> N >> M;
  priority_queue<P> q;//firstは数字の大きさ,secondは枚数
  int A[N],B[M],C[M];
  rep(i,N){
    cin >> A[i];
  }
  rep(i,M){
    cin >> B[i] >> C[i];
  }
  rep(i,N) q.push(make_pair(A[i],1));
  rep(i,M) q.push(make_pair(C[i],B[i]));
 
  ll ans=0;
  rep(i,N){
    auto p = q.top();q.pop();
    ans += p.first;
    if(p.second>1){//1枚使ったので減らす
      p.second--;
      q.push(p);
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3572
// Problem : A - Repeat ACL
// Contest : AtCoder - ACL Beginner Contest
// URL : https://atcoder.jp/contests/abl/tasks/abl_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

// Delete the dynamically allocated memory

#include<bits/stdc++.h>
using namespace std;
 
#define ff              first
#define ss              second
#define pb              push_back
#define pr              pair<long long,long long>
#define mp(a,b)         make_pair(a,b)
#define vr              vector<long long>
#define mod1            1000000007
#define mod2            998244353
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define fill(a,b)       memset(a, b, sizeof(a))
#define mk(arr,n,type)  type *arr=new type[n];
#define ll              long long
#define ld	            long double
#define w(x)            int x; cin>>x; while(x--)

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ll n;
	cin>>n;
	string s="ACL";
	for(ll i=0;i<n;i++){
		cout<<s;
	}
	cout<<"\n";
	return 0;
	}

Measured memory_bytes: 3636
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<map>
using namespace std;
struct node
{
	string s;
	int t;
}w[200005];
bool cmp(node a,node b)
{
	if(a.t==b.t){
		return a.s<b.s;
	}
	return a.t>b.t;
}
string a[200005];
map<string,int> m;
int main()
{
	int n;
	cin>>n;
	int p=0;
	for(int i=0;i<n;i++){
		string ss;
		cin>>ss;
		if(!m[ss]){
			a[p++]=ss;
		}
		m[ss]=m[ss]+1;
	}
	for(int i=0;i<p;i++){
		w[i].s=a[i];
		w[i].t=m[a[i]];
	}
	sort(w,w+p,cmp);
	cout<<w[0].s<<endl;
	for(int i=1;i<p;i++){
		if(w[i].t==w[i-1].t){
			cout<<w[i].s<<endl;
		}else{
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 31872
#include <bits/stdc++.h>
 
using namespace std;
 
#define lli long long int
#define REP(i,s,l) for(lli i=s;i<l;i++)
#define DEBUG 0
#define INF (1LL<<50)

signed main(){

	lli n,x;
	cin>>n>>x;
	vector<lli> l(n);
	REP(i,0,n)cin>>l[i];

	vector<lli> d;
	d.push_back(0);
	lli ans = 0;
	REP(i,0,n){
		lli now = d[i];
		lli next = now+l[i];
		if(next > x){
			ans = i+1;
			cout<<ans<<endl;
			return 0;
		}
		d.push_back(now+l[i]);
	}
	cout<<n+1<<endl;

	return 0;
}


Measured memory_bytes: 256
N=map(int,input().split())
A=sorted(list(map(int,input().split())))
B=list(map(int,input().split()))
C=sorted(list(map(int,input().split())))
 
def countA(target,L):
  ok=-1
  ng=len(L)
  while abs(ok-ng)>1:
    mid=(ok+ng)//2
    if L[mid]<target:
      ok=mid
    else:
      ng=mid
  return (ok+1)
 
def countC(target,L):
  ok=len(L)
  ng=-1
  while abs(ok-ng)>1:
    mid=(ok+ng)//2
    if L[mid]>target:
      ok=mid
    else:
      ng=mid
  return len(L)-ok
 
ans=0
for i in range(len(B)):
  data=B[i]
  ans+=(countA(data,A)*countC(data,C))
  
print(ans)

Measured memory_bytes: 24052
import numpy as np
N = int(input())
a = list(map(int,input().split()))
x = np.array([0]*(N))
suma = sum(a)
for i in range(1,N):
    x[i] = x[i-1] + a[i-1]
y = np.array([suma]*(N))-x
ans = list(map(abs,x-y))
print(min(ans[1:]))

Measured memory_bytes: 34104
#include <bits/extc++.h>

#ifndef DUMP
#define DUMP(...) void(0)
#endif

using namespace std;

struct dsu {
  int cc;
  vector<int> p, sz;
  dsu(int n = 0) : cc(n), p(n, -1), sz(n, 1) {}
  int root(int v) {
    if (p[v] == -1) return v;
    return p[v] = root(p[v]);
  }
  bool unite(int u, int v) {
    u = root(u), v = root(v);
    if (u == v) return false;
    --cc;
    if (sz[u] < sz[v]) swap(u, v);
    p[v] = u;
    sz[u] += sz[v];
    return true;
  }
  bool same(int u, int v) { return root(u) == root(v); }
  int size(int v) { return sz[root(v)]; }
};

int main() {
  cin.tie(nullptr)->sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  dsu d(n);
  while (m--) {
    int a, b;
    cin >> a >> b;
    --a, --b;
    d.unite(a, b);
  }
  int res = 0;
  for (int i = 0; i < n; ++i) {
    res = max(res, d.size(i));
  }
  cout << res << '\n';
}


Measured memory_bytes: 4724
from fractions import gcd
n = int(input())
A = list(map(int, input().split()))
L = [1]*n
R = [1]*n
L[0] = A[0]
R[n-1] = A[n-1]
for i in range(1, n):
  L[i] = gcd(L[i-1], A[i])
  R[n-i-1] = gcd(R[n-i], A[n-i-1])
m = 1
for i in range(n-2):
  m = max(m, gcd(L[i], R[i+2]))
print(max(L[n-2], m, R[1]))

Measured memory_bytes: 16116
#include<bits/stdc++.h>
using namespace std;
int main(){
 long long n;
  cin>>n;
  string ans;
  while(n){
   n -= 1;
    ans += (char)('a'+ n%26);
    n/= 26;
  }
  reverse(ans.begin(),ans.end());
  cout<<ans;
}

Measured memory_bytes: 3532
import java.io.*;
import java.util.*;
import java.lang.*;

public class Main
{
	public static void main(String args[]) throws java.lang.Exception,FileNotFoundException
	{
		Scanner sc = new Scanner(System.in);


		int a = sc.nextInt();

		int res = a + a*a + a*a*a;

		System.out.println(res);

		sc.close();
		System.out.flush();
	}
}

Measured memory_bytes: 27040
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define ss second
#define ff first
#define pb push_back
#define mp make_pair

int main() {
    ios_base::sync_with_stdio();
    cin.tie(0);
    int n,d;
    cin>>n>>d;
    vector<int> v[100];
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<d;j++)
        {
            int a;
            cin>>a;
            v[i].pb(a);
        }
    }int s=0;
    for(int i=0;i<n;i++)
    {
        for(int j=i+1;j<n;j++)
        {   double ans=0;
            for(int k=0;k<d;k++)
            {
                ans+=(v[i][k]-v[j][k])*(v[i][k]-v[j][k]);
            }
            ans=sqrt(ans);
            ll p=ans;
            if(p==ans)
                s++;
        }
    }
    cout<<s;
    return 0;
}
// 1 3 6 9 15 16 20 25


Measured memory_bytes: 256
{-# LANGUAGE ScopedTypeVariables #-}
import qualified Data.Vector.Unboxed as VU
import qualified Data.Vector.Unboxed.Mutable as VUM
import qualified Data.ByteString.Char8 as B
import Control.Monad
import Data.Char

step :: (Int, Int) -> (Bool, Int) -> (Int, Int)
step (ac, wa) (isAC, n)
  | isAC = (ac+1, wa+n)
  | otherwise = (ac, wa)

main = do
  [n, m] <- map read . words <$> getLine :: IO [Int]

  (acs :: VUM.IOVector Bool) <- VUM.replicate n False
  (was :: VUM.IOVector Int) <- VUM.replicate n 0

  replicateM_ m $ do
    bs <- B.getLine
    let Just (i, j) = B.readInt bs
    let res = B.unpack $ B.dropWhile isSpace j
    prev <- VUM.read acs (i-1)
    when (not prev && res == "AC") $ do 
      VUM.write acs (i-1) True
    when (not prev && res == "WA") $ do
      VUM.modify was (+1) (i-1)

  acs' <- VU.freeze acs
  was' <- VU.freeze was
  let (a,b) = VU.foldl' step (0,0) $ VU.zip acs' was'
  putStr $ show a
  putStr " "
  putStrLn $ show b
    


Measured memory_bytes: 2812
n = gets.to_i
h = gets.split(' ').map(&:to_i)
 
min_hight = 0
before_hight = 0
result = 'Yes'
h.each do |hight|
  if before_hight <= hight
    before_hight = hight
  elsif before_hight - 1 == hight && before_hight - 1 >= min_hight
    min_hight = before_hight - 1
    before_hight = hight
  else
    result =  'No'
  end
end
 
puts result

Measured memory_bytes: 11012
# -*- coding: utf-8 -*-
"""
Bitset II - Enumeration of Subsets II
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP2_11_B&lang=jp

"""
n = int(input())
_, *B = map(int, input().split())
B = set(B)
for x in range(2**n):
    if all([x&1<<s for s in B]):
        if x == 0:
            print('0:')
        else:
            bits = [i for i, b in enumerate(f'{x:b}'[::-1]) if b == '1']
            print(f'{x}: {" ".join(map(str, bits))}')



Measured memory_bytes: 5724
n = int(input())
apple = []
for _ in range(n):
    a, b = map(int, input().split())
    apple.append([b, a])
apple = sorted(apple)
count = 0
s = 0
for i in apple:
    if count + i[1] <= i[0]:
        s += 1
        count += i[1]
    else:
        s = 0
        break
print("Yes" if s==n else "No")

Measured memory_bytes: 39708
n, k = map(int, input().split())

ans = 0
for i in range(1,n+1):
  s = i
  cnt = 0
  while ((k - 1) // s):
    s = s * 2
    cnt = cnt + 1
  ans = ans + (1/n * pow(1/2, cnt))

print(ans)

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

int main() {
  int n;
  cin >> n;
  vector<string> s(n);
  for(int i=0; i<n; i++)
    cin >> s.at(i);
  
  int m;
  cin >> m;
  vector<string> t(m);
  for(int i=0; i<m; i++)
    cin >> t.at(i);
  
  int answer = 0;
  for(int i=0; i<n; i++) {
    int count = 0;
    
    for(int j=0; j<n; j++) {
      if(s.at(i) == s.at(j)) {
        count ++;
      }
    }
    for(int k=0; k<m; k++) {
      if(s.at(i) == t.at(k)) {
        count--;
      }
    }
    if(count > answer) {
      answer = count;
    }
  }
  cout << answer << endl;
}

Measured memory_bytes: 256
import numpy as np
import sys
 
H, W = list(map(int, sys.stdin.readline().split()))
S = np.array([list(sys.stdin.readline().rstrip()) for _ in range(H)]) == '.'
ups = np.zeros((H, W), dtype=int)
downs = np.zeros((H, W), dtype=int)
rights = np.zeros((H, W), dtype=int)
lefts = np.zeros((H, W), dtype=int)
 
for h in range(1, H):
    ups[h] = (ups[h - 1] + 1) * S[h - 1] * S[h]
    downs[H - h - 1] = (downs[H - h] + 1) * S[H - h] * S[H - h-1]
for w in range(1, W):
    lefts[:, w] = (lefts[:, w - 1] + 1) * S[:, w - 1] * S[:, w]
    rights[:, W - w - 1] = (rights[:, W - w] + 1) * S[:, W - w] * S[:, W - w-1]
print(((ups + downs + lefts + rights) * S).max() + 1)

Measured memory_bytes: 219780
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
int main()
{
    int n, k; cin>>n>>k;
	if(k>(n-2)*(n-1)/2){
		cout<<-1<<endl; return 0;
	}
	vector<P> ans;
	for(int i=1; i<n; i++){
		ans.push_back({0, i});
	}
	bool ok=0;
	for(int i=1; i<n; i++){
		for(int j=i+1; j<n; j++){
          if(k==(n-2)*(n-1)/2) ok=1;
			if(!ok){
				k++;
				ans.push_back({i, j});
			}
			
		}
	}
	cout<<ans.size()<<endl;
	for(auto p:ans){
		cout<<p.first+1<<" "<<p.second+1<<endl;
	}
    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cstring>
#include <utility>
#include <stack>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef pair<int,int> pii;
int main(){
    int n;
    cin >> n;
    vector<int>a(n);
    rep(i,n)cin >> a[i];
    ll sum = 0;
    ll ans1 = 0;
    rep(i,n){
        if(i%2){
            if(sum + a[i] > 0){
                sum += a[i];
            }else{
                ans1 += 1-(sum+a[i]);
                sum = 1;
            }
        }else{
            if(sum + a[i] < 0){
                sum += a[i];
            }else{
                ans1 += sum+a[i]+1;
                sum = -1;
            }
        }
    }
    sum = 0;
    ll ans2 = 0;
    rep(i,n){
        if(i%2==0){
            if(sum + a[i] > 0){
                sum += a[i];
            }else{
                ans2 += 1-(sum+a[i]);
                sum = 1;
            }
        }else{
            if(sum + a[i] < 0){
                sum += a[i];
            }else{
                ans2 += sum+a[i]+1;
                sum = -1;
            }
        }
        cerr << ans2 << endl;
    }
    // cerr << ans1 << " " << ans2 << endl;
    cout << min(ans1, ans2) << endl;
}

Measured memory_bytes: 640
fun main(args:Array<String>){
  var s = readLine()!!.toInt()
  var a = s/100
  var b = s%100
  if(b<13 && 0<b){
    if(a<13 && 0<a){
      println("AMBIGUOUS")
    }
    else{
      println("YYMM")
    }
  }
  else{
    if(a<13 && 0<a ){
      println("MMYY")
    }
    else{
      println("NA")
    }
  }
}

Measured memory_bytes: 31516
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<iomanip>
#include<map>
#include<set>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
using namespace std;
#define DEBUG(x) cout<<#x<<"="<<x<<endl
#define DEBUG2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<endl
typedef long long ll;
class Solver{
public:
    static const int MAXN=1e5+10;
    ll gcd(ll a,ll b){
        if(b==0)return a;
        return gcd(b,a%b);
    }
    void solve(){
        ios::sync_with_stdio(false);
        cin.tie(0);
        int N;
        cin>>N;
        ll g;
        for(int u=0;u<N;u++){
            ll a;
            if(u==0)cin>>g;
            else {
                cin>>a;
                if(a<g)swap(a,g);
                g=gcd(a,g);
            }
        }
        cout<<g;
    }
};
int main()
{
    // freopen("in.txt","r",stdin);
    (new Solver())->solve();
}

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

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

int main() {
  int a;
  cin >> a;
  bool can = false;
  for(int i=1;i<=9;++i){
	  for(int j=1;j<=9;++j){
		  if(a==i*j){
			  can = true;
			  break;
		  }
	  }
  }	  
  if(can)  cout << "Yes" << endl;
  else cout << "No" << endl;

	return 0;		
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<map>
#include<cstdio>
#include<cstring>
#include<cmath>
#define ll long long
#define lson (rt<< 1)
#define rson (rt<< 1 | 1)
#define gmid ((l+r)>> 1 )
using namespace std;

const int p=1e9+7;

int f[2002];

int main()
{
	int n;
	cin>>n;  
    f[0]=1;
    for(int i=0;i<=n;++i)
      for(int j=3;j+i<=n;++j)
        f[i+j]=(f[i+j]+f[i])%p; 
	cout<<f[n]<<endl;   
}


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

using namespace std;

int main() {
	int r; cin >> r;

	if (r < 1200) {
		cout << "ABC" << endl;
	}
	else if (r < 2800) {
		cout << "ARC" << endl;
	}
	else {
		cout << "AGC" << endl;
	}
}

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

int main() {
  string s;
  int i, cntn = 0, cnts = 0, cnte = 0, cntw = 0;
  cin >> s;
  
  for(i = 0; i < s.size(); i++){
    if(s.at(i) == 'N') cntn++;
    else if(s.at(i) == 'S') cnts++;
    else if(s.at(i) == 'E') cnte++;
    else cntw++;
  }
  
  if((cntn == 0 && cnts != 0) || (cntn != 0 && cnts == 0) || 
      (cnte == 0 && cntw != 0) || (cnte != 0 && cntw == 0)){
    cout << "No" << endl;
  }
  else{
    cout << "Yes" << endl;
  }
}


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

#define db1(x) cout<<#x<<"="<<x<<'\n'
#define db2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<'\n'
#define db3(x,y,z) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<","<<#z<<"="<<z<<'\n'

#define vll vector< ll >
#define M 100000
#define MD 1000000007
#define pb push_back
#define rep(i,a,b) for(ll i = a; i <= b; ++i)
#define fo(i,a,b) for(int i = a; i<= b; ++i)
#define pii pair<ll,ll> 
#define vec(a) vector<a >
#define all(a) a.begin(),a.end()
#define se second
#define fi first
#define inf 0xffffffff
#define inchar getchar_unlocked
#define outchar(x) putchar_unlocked(x)
#define int long long
#define endl '\n'
#define IOS ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

using namespace std;
using ll = long long;
ll md=MD;

ll exp(ll a,ll b){ll r=1ll;while(b>0){if(b&1){r=r*(a%md);r=(r+md)%md;}b>>=1;a=(a%md)*(a%md);a=(a+md)%md;}return (r+md)%md;}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll Min(ll a,ll b){if(a<b)return a; return b;}
ll Max(ll a,ll b){if(a>b)return a; return b;}
int32_t main() {
    IOS;

        ll n,red=0,white=0;
        cin>>n;
       string s; cin>>s;
       rep(i,0,n-1)if(s[i]=='R')++red;
       int ans=red;
       rep(i,0,n-1){
       		if(s[i]=='W')++white;
       		if(s[i]=='R')--red;
       		ans=Min(ans,Max(white,red));
       }
       cout<<ans;


        cout<<'\n';
    return 0;
}

Measured memory_bytes: 3776
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <map>
#include <cstring>
#include <cmath>
using namespace std;
#define MAXH 1000000001
#define MAXW 101
#define INF 1000
#define MAXN 1001
#define MOD 1000000007
typedef long long ll;
typedef pair<ll, ll> P;


template<typename T>
T pow(T i, T n){
    T re;
    if(n == 0) return 1;
    re = pow(i, n / 2);
    if(n % 2 == 0){
        return re * re;
    }else{
        return i * re * re;
    }
}
ll gcd(ll a, ll b){
    if(b == 0) return a;
    return gcd(b, a % b);
}
ll solve(ll a, ll x){
    if(x % a == 0) return x;
    return (x / a + 1) * a;
}

ll N;
ll T[MAXN], A[MAXN];

int main(){
    string s;
    cin >> s;
    map<char, int> m;
    m['p'] = m['g'] = 0; 
    int win = 0, lose = 0;

    for(int i = 0;i < s.length();i++){
        if(s[i] == 'g'){
            if(m['p'] < m['g']){
                m['p']++;
                win++;
            }else{
                m['g']++;
            }
        }else{
            if(m['p'] < m['g']){
                m['p']++;
            }else{
                m['g']++;
                lose++;
            }
        }
    }

    printf("%d\n", win - lose);

    return 0;
}


        

Measured memory_bytes: 512
/*#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")*/
#include<bits/stdc++.h>
#define ll long long
#define inf 1000000005
#define put putchar('\n')
#define F(i,a,b) for (int i=(a);i<=(b);i++)
#define D(i,a,b) for (int i=(a);i>=(b);i--)
#define go(i,t) for (int i=head[t];i;i=Next[i])
#define sqr(x) ((x)*(x))
#define re register
#define mp make_pair
#define fi first
#define se second
#define pa pair<int,int>
#define pb push_back
#define be begin()
#define en end()
#define ret return puts("-1"),0;
#define mod 1000000007
#define N 500055
#define int ll
using namespace std;
inline char gc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
#define gc getchar
inline int read(){char c=getchar();int tot=1;while ((c<'0'|| c>'9')&&c!='-') c=getchar();if (c=='-'){tot=-1;c=getchar();}
int sum=0;while (c>='0'&&c<='9'){sum=sum*10+c-'0';c=getchar();}return sum*tot;}
inline void wr(int x){if (x<0) {putchar('-');wr(-x);return;}if(x>=10)wr(x/10);putchar(x%10+'0');}
inline void wrn(int x){wr(x);put;}inline void wri(int x){wr(x);putchar(' ');}
inline void wrn(int x,int y){wri(x);wrn(y);}inline void wrn(int a,int b,int c){wri(a);wrn(b,c);}
int n,m,a[N],num,tot,z[N],num1[N],vis[N];
signed main(){
	n=read();
	num1[0]=1;
	F(i,1,40) num1[i]=num1[i-1]*2;
	D(i,40,1) if (n&num1[i]) z[++tot]=i,vis[i]=tot;
	F(i,1,z[1]) a[i]=i;
	num=z[1];vis[z[1]]=0;
	D(i,tot,2) a[i-1+num]=i-1+z[1];
	num+=tot-1;
	F(i,1,z[1]){
		a[++num]=i;
		if (vis[i]) a[++num]=vis[i]-1+z[1];
	}
	a[++num]=99;a[++num]=99;
	if (n&1) a[++num]=100,a[++num]=100;
	wrn(num);
	F(i,1,num) wri(a[i]);
	return 0;
}

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

int in(void){
	int i;scanf("%d",&i);
	return i;
}
long long llin(void){
	long long i;scanf("%lld",&i);
	return i;
}
void print(int a){
	printf("%d\n",a);
}
void llprint(long long a){
	printf("%lld\n",a);
}
void print2(int a,int b){
	printf("%d %d\n",a,b);
}
long long max(long long a,long long b){
	return a>b?a:b;
}
long long min(long long a,long long b){
	return a<b?a:b;
}

void solve(int h[],int w,int l){
	int i;
	for(i=0;i<5;i++){
		if(h[i]==w){
			puts("1");
		}
		else{
			puts("2");
		}
	}
}

int calc(int x,int y,int b,int p){
	return x*b+y*p;
}
int dis(int x,int y,int b,int p){
	return 4*calc(x,y,b,p)/5;
}

int main(void){
	int n,x,y,b,p,tmp;
	n=in();
	while(n--){
		x=in();
		y=in();
		b=in();
		p=in();
		if(b>=5&&p>=2){
			print(dis(x,y,b,p));
		}
		else if(b<5&&p>=2){
			print(min(calc(x,y,b,p),dis(x,y,5,p)));
		}
		else if(b>=5&&p<2){
			print(min(calc(x,y,b,p),dis(x,y,b,2)));
		}
		else{
			print(min(calc(x,y,b,p),dis(x,y,5,2)));
		}
	}
	return 0;
}

Measured memory_bytes: 600
using System;

namespace ConsoleApplication17
{
    class Program
    {
        public static void Main()
        {
            var r = double.Parse(Console.ReadLine());
            Console.WriteLine("{0:f6} {1:f6}", r * r * System.Math.PI, r * 2 * System.Math.PI);
        }
    }
}
 

Measured memory_bytes: 9260
N = int(input())
A = list(map(int, input().split())) # <- note that this has (N - 1) elements
#print(A)
A_0 = [x - 1 for x in A]
#print(A_0)
ans = [0] * N # <- represents number of immediate subordinates of each person

for i in range(0, N - 1):
    ans[A_0[i]] += 1

for i in range(0, N):
    print(ans[i])


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

int main(){ 
int n,s=0;
cin>>n;
for(int i=1; i<10; i++){
if(n%i==0&&n/i<10){
  s++;
}
}
  if(s>0){
  cout<<"Yes"<<endl;
  }
  else{
  cout<<"No"<<endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
int main(){
    int n;
    cin>>n;
    vector<int> t(n);
    vector<int> x(n);
    vector<int> y(n);
    
    for(int i=0;i<n;i++){
        cin>>t[i]>>x[i]>>y[i];
    }
    
    for(int i=0;i<n;i++){
        if(!(t[i]%2==(x[i]+y[i])%2&(t[i]>=x[i]+y[i]))){
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
    return 0;
}

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

using namespace std;

int add (int a , int b , int mod) {
    a += b;
    while (a >= mod) a -= mod;
    while (a < 0) a += mod;
    return a;
}

int mul (int a , int b , int mod) {
    return a * 1ll * b % mod;
}

int main() {
    ios::sync_with_stdio(0) , cin.tie(0) , cout.tie(0);
#ifdef LOCAL
    freopen("input.in" , "r" , stdin);
#endif
    int n , p;
    string s;
    cin >> n >> p >> s;

    long long ans = 0;
    if (p == 2) {
        for (int i = 0 ; i < n ;i++) {
            int d = s[i] - '0';
            if (d % 2 == 0)
                ans += i + 1;
        }
    } else if (p == 5) {
        for (int i = 0 ; i < n ;i++) {
            int d = s[i] - '0';
            if (d == 5 || d == 0)
                ans += i + 1;
        }
    } else {
        reverse(s.begin() , s.end());

        vector<int> f(p);
        f[0]++;

        int power = 1 , h = 0;
        for (int i = 0 ;i < n ;i++) {
            int d = s[i] - '0';
            h = add(h , mul(power , d , p) , p);
            ans += f[h];
            f[h]++;
            power = mul(power , 10 , p);
        }
    }

    cout << ans;
}


Measured memory_bytes: 3768
<?php
while (true) {
    $input = trim(fgets(STDIN));
    $ary = sscanf($input, "%d %d");
    if ($ary[0] == 0 && $ary[1] == 0) {
        break;
    } else {
        asort($ary);
        echo implode(" ", $ary).PHP_EOL;
    }
}


Measured memory_bytes: 9248
n = int(input())
v = list(map(int,input().split()))
c = list(map(int,input().split()))
vc = [0]*n
for i in range(n):
    vc[i] = v[i] - c[i]
vc2 = sorted(vc)
import bisect
print(sum(vc2[bisect.bisect_left(vc2,0):]))

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

using namespace std;

pair<int,int> A[100005];
long long Fr[100005];

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

    int n;
    cin>>n;

    for(int i=1; i<=n; i++)
    {
        cin>>A[i].first;
        A[i].second=i;
    }

    sort(A+1,A+n+1);

    int ind=n+1;
    for(int i=n; i>=1; i--)
    {
        ind=min(ind,A[i].second);
        Fr[ind]=Fr[ind]+1LL*(n-i+1)*(A[i].first-A[i-1].first);
    }

    for(int i=1; i<=n; i++)
        cout<<Fr[i]<<"\n";
    return 0;
}


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

const int MAX = 1005;
const int MOD = 1e9 + 7;

int n_test;
int H, W;
char s[MAX][MAX];
long long dp[MAX][MAX] = {{0L}};
int dx[] = {1, 0};
int dy[] = {0, 1};

void input() {
    cin >> H >> W;
    for(int i = 0; i < H; ++i) for(int j = 0; j < W; ++j) {
        cin >> s[i][j];
    }

    for(int i = 0; i < H; ++i) for(int j = 0; j < W; ++j) {
        dp[i][j] = -1L;
    }
    dp[H - 1][W - 1] = 1L;
}

bool check(int x, int y) {
    return (x >= 0 && x < H && y >= 0 && y < W);
}

long long _solve(int x, int y) {
    if (dp[x][y] != -1) return dp[x][y];
    dp[x][y] = 0L;
    if (s[x][y] == '#') return 0;
    
    for(int i = 0; i < 2; ++i) {
        int nxt_x = x + dx[i];
        int nxt_y = y + dy[i];
        if (!(check(nxt_x, nxt_y))) continue;
        dp[x][y] += _solve(nxt_x, nxt_y);
    }
    return dp[x][y] % MOD;
}

void solve() {
    cout << _solve(0, 0) << '\n';
}

int main() {
    int n_test = 1;
    //scanf("%d", &n_test);
    for(int i = 0; i < n_test; ++i) {
        input();
        solve();
    }
}

Measured memory_bytes: 9216
#include <iostream>
#include <map>
#include <utility>
using namespace std;
using P = pair<int,int>;
map<P,int> m;

void add_entry(int a, int b, int h, int w){
// 	cout << "a:" << a << "," << "b:" << b << endl;
	for(int i = 0; i <= 2; i++){
		for(int j = 0; j <= 2; j++){
			int x = b - i;
			int y = a - j;
			if(x >= 0 && x <= w - 3 && y >= 0 && y <= h -3){
// 				cout << x << "," << y << endl;
				m[P(x,y)]++;
			}
			else
				continue;
		}
	}
}

int main(){
	long long h,w,n;
	cin >> h >> w >> n;
	for(int i = 0; i < n; i++){
		int a,b;
		cin >> a >> b;
		add_entry(a-1,b-1,h,w);
	}

	long long tally[10] = {0};
	for(auto& item: m){
		tally[item.second]++;
	}

	long long other = 0;
	for(int i = 1; i < 10;i ++){
		other += tally[i];
	}

	cout << (h-2) * (w-2) - other << endl;
	for(int i = 1; i < 10;i ++){
		cout << tally[i] << endl;
	}
}



Measured memory_bytes: 56448
#include<bits/stdc++.h>
using namespace std;
int main(){
	string s; cin >> s;
	if((s[0] == s[1] && s[1] == s[2]) || (s[1] == s[2] && s[2] == s[3])) cout << "Yes\n";
	else cout << "No\n";
	return 0;
}

Measured memory_bytes: 256
// finish date: 2018/07/25
#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)
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<double> vd;
typedef vector<vector<double>> vvd;
typedef vector<vector<vector<double>>> vvvd;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<string> vs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, pair<int, int>> plii;
const int bigmod = 1000000007;
const int INF = 1050000000;
const long long INFll = 100000000000000000;


int main() {
    int A, B, C;
    cin >> A >> B >> C;
    if (A == B &&B== C) {
        if (A & 1) cout << 0 << endl;
        else cout << -1 << endl;
        return 0;
    }
    int cnt = 0;
    while (!(A & 1 || B & 1 || C & 1)) {
        cnt++;
        int a = A, b = B, c = C;
        A = (b + c) / 2;
        B = (c + a) / 2;
        C = (a + b) / 2;
    }

    cout << cnt << endl;

    return 0;
}



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

int main(void) {
    int cnt=0,ans=0,max=0;
    long long int N;
    cin>>N;

    for (int i=0;i<4;i++){
    }

    if(N%2!=0){
      N = N*2;
    }

    cout<<N<<endl;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <vector>
#include <iostream>
#include <queue>
#include <bits/stdc++.h>
 
#define rep(i,n) for (int i=0;i<(n);++i)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<double> vd;
typedef pair<int, int> pi;


int main() {
  ll a, b, n;
  cin >> a >> b >> n;

  ll x = min(b - 1, n);
  ll ans = (a*x/b) - (a*(x/b));
  cout << ans << endl;
  return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define rep(i,N) for(ll i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1

ll mod_add(ll a, ll b) { return (a + b) % MOD; }
ll mod_sub(ll a, ll b) { return (a - b + MOD) % MOD; }
ll mod_mul(ll a, ll b) { return a*b % MOD; }

ll h,w,n;
vector<vector<ll>> ans(h,vector<ll>(w,0));

int main(){
    cin >> h >> w >> n;
    vector<ll> a(n);
    rep(i,n)cin >> a[i];
    ans.resize(h,vector<ll>(w,0));
    int col = 0;
    rep(i,h){
        if(i % 2 == 0){
            rep(j,w){
                if(a[col]){
                    ans[i][j] = col + 1; 
                    a[col]--;
                }
                if(a[col] == 0)col++;
            }
        }
        else {
            for(int j = w - 1;j >= 0;j--){
                if(a[col]){
                    ans[i][j] = col + 1; 
                    a[col]--;
                }
                if(a[col] == 0)col++;
            }
        }
    }
    rep(i,h){
        rep(j,w)cout << ans[i][j] << " ";
        cout << endl;
    }
}

Measured memory_bytes: 512
#include <stdio.h>
#include <math.h>

int main (){
	int i,n;
	float d=100;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		d=ceilf(d*1.05);
	}
	printf("%.0f000\n",d);
	return 0;
}

Measured memory_bytes: 628
#include <bits/stdc++.h>
#define err(args...) {}
#ifdef DEBUG
#include "_debug.cpp"
#endif
using namespace std;
using ll = long long;
using ld = long double;
template <typename T> using lim = numeric_limits<T>;
template <typename T> istream& operator>>(istream& is, vector<T>& a) { for(T& x : a) { is >> x; } return is; }
const int N = 1'000, W = N * 10'000;
int w[N], s[N], v[N];
ll opt[W+1];
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    for(int i = 0; i < n; i++) {
        cin >> w[i] >> s[i] >> v[i];
    }
    vector<int> I(n);
    iota(I.begin(), I.end(), 0);
    sort(I.begin(), I.end(), [&](int i, int j) { return s[i] + w[i] > s[j] + w[j]; });
    for(int i : I) {
        for(int ww = 0; ww <= s[i]; ww++) {
            opt[ww] = max(opt[ww], opt[min(ww + w[i], W)] + v[i]);
        }
    }
    cout << opt[0] << endl;
    return 0;
}

Measured memory_bytes: 384
#include <algorithm>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
// const int INF = (1 << 30) - 1;
// const ll LL_INF = (1LL << 62) - 1;
// const ll MOD = 1e9 + 7;

int N, K;

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

  if (K == 1) {
    cout << 0 << endl;
  } else {
    int ans = N - K;
    cout << ans << endl;
  }

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <math.h>
using namespace std;

int main(){
	
	int d[64];
	char c[64];
	
	while(1){
		int k=0;
		for(int i=0;i<64;i++){c[i]=0;d[i]=0;}
		for(int i=0;i<64;i++){cin>>c[i];
			if(c[i]=='1'){d[k]=i;k+=1;}}
		if(k!=4)return 0;
		if(d[1]==d[0]+1){
			if(d[2]==d[0]+2)cout<<"C"<<endl;
			else if(d[2]==d[0]+7)cout<<"G"<<endl;
			else if(d[2]==d[0]+8)cout<<"A"<<endl;
			else cout<<"E"<<endl;
		}
		else if(d[1]==d[0]+8){
			if(d[2]==d[0]+16)cout<<"B"<<endl;
			else cout<<"F"<<endl;
		}
		else cout<<"D"<<endl;
	}
}

Measured memory_bytes: 0
#include <iostream>
#include<cmath>
using namespace std;
int main()
{
    int n,a,cnt,min=1000;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>a;
        cnt=0;
        while(a%2==0)
        {
            a=a/2;
            cnt++;
        }
        if(cnt<min)min=cnt;
    }
    cout<<min<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string.h>
const int64_t MAX_S=2001;
const int64_t MAX_N=670;
const int64_t MOD=1000000007;

int64_t M[MAX_N][MAX_S];
int64_t P[MAX_S];

void Precompute(const int64_t S) {
  for(int s=0; s<=S; ++s) {
    M[1][s] = P[s] = (3 <= s);
    
  }
  for(int n = 2; 3*n <= S;++n) {
    int64_t cummulative = 0;
    for(int s=3; s<=S; ++s) {
      cummulative = (cummulative + M[n-1][s-3]) % MOD;
      M[n][s] = (M[n][s] + cummulative) % MOD;
      P[s] = (P[s] + M[n][s]) % MOD;
    }
  } 
}

int64_t Solve(const int64_t S) {
  if(S<=2) {
    return 0;
  }
  Precompute(S);
  return P[S];
  if(S<=5) {
    return 1;
  }
  Precompute((S+1)/2);
  int64_t sol = 1;
  for(int s=3; 2*s<=S; ++s) {
    sol = (sol + 2*P[s]*P[S-s]) % MOD;
  }
  return sol;
}
 
int main(){
  int64_t S;
  std::cin >> S;
  std::cout << Solve(S);
}

Measured memory_bytes: 13956
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using ld = long double;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQG = priority_queue<T, vector<T>, greater<T> >;
const int INF = 100010001;
const ll LINF = (ll)INF*INF*10;
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);}
template<typename T1, typename T2>
istream &operator>>(istream &is, pair<T1, T2> &p) { return is >> p.first >> p.second;}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) { return os << p.first << ' ' << p.second;}

struct BM {
  int V;
  vector<vector<int > > G;
  vector<int> match;
  vector<bool> used;
  BM(int n=0) : V(n), G(n), match(n, -1), used(n) {}
  inline void add(int u, int v) {
    G[u].emplace_back(v);
    G[v].emplace_back(u);
  }
  bool dfs(int v) {
    used[v] = true;
    for(int u:G[v]) {
      int w = match[u];
      if(w < 0 or (!used[w] and dfs(w))) {
        match[v] = u;
        match[u] = v;
        return true;
      }
    }
    return false;
  }
  int bipartite_matching() {
    int res = 0;
    for(int v = 0; v < V; v++) {
      if(match[v] < 0) {
        for(int i = 0; i < v; i++) used[i] = 0;
        if(dfs(v)) res++;
      }
    }
    return res;
  }
};

//head

int n, m;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m;
  BM bpm(n+m);
  rep(i, n) {
    int k;
    cin >> k;
    while(k--) {
      int b;
      cin >> b;
      b--;
      bpm.add(i, b+n);
    }
  }
  bpm.bipartite_matching();
  for(int i = n; i < n+m; i++) if(bpm.match[i] == -1) {
    cout << "Alice" << endl;
    return 0;
  }
  cout << "Bob" << endl;
}


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

using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef vector<int> Vi;
typedef tuple<int, int, int> T;
#define FOR(i,s,x) for(int i=s;i<(int)(x);i++)
#define REP(i,x) FOR(i,0,x)
#define ALL(c) c.begin(), c.end()
#define MP make_pair
#define DUMP( x ) cerr << #x << " = " << ( x ) << endl
#define fst first
#define snd second

const int INF = 2147483647;

/*
RangeMinimumQuery by Segment Tree
query:
    1. update(i, val): update i-th value to val(0-indexrd)
    2. query(low, high): find minimun value in [low, high)
time complexity: O(log n)
space complexity: O(2n) 
used in DSL2A(AOJ)
*/
template<typename T> struct RangeMinQuery {
  int N, _N;
  vector<T> dat;

  RangeMinQuery(int _N) : _N(_N) {
    assert(_N > 0);
    N = 1;
    while (N < _N)
      N <<= 1;
    dat.resize(2 * N - 1, INF);
  }

  void update(int k, T val) {
    assert(0 <= k && k < _N);
    k += N - 1;
    dat[k] = val;

    while (k > 0) {
      k = (k - 1) / 2;
      dat[k] = min(dat[2 * k + 1], dat[2 * k + 2]);
    }  
  }

  // [a, b)
  T query(int a, int b) {
    assert(0 <= a && a <= b && b <= _N);
    return query(a, b, 0, 0, N);
  }
  T query(int a, int b, int k, int l, int r) {
    if (r <= a || b <= l) return INF;
    if (a <= l && r <= b) return dat[k];

    int mid = (l + r) / 2;
    return min(query(a, b, 2 * k + 1, l, mid),
	       query(a, b, 2 * k + 2, mid, r));
  }
};

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, q;
  cin >> n >> q;
  RangeMinQuery<int> segtree(n);

  REP(i, q) {
    int com, x, y;
    cin >> com >> x >> y;
    if (com == 0) {
      segtree.update(x, y);
    } else if (com == 1) {
      cout << segtree.query(x, y+1) << endl;
    }
  }
  
  return 0;
}

Measured memory_bytes: 2052