akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdio>
#include<cmath>
#include<string>
#include<cstdlib>
#include<utility>
using namespace std;

#define N 10000009
int ht[N];

void inserth(int x){
	int h = x%N;
	for(;;){
		if(ht[h]==-1){
			ht[h] = x;
			break;
		}else{
			h = (h+193)%N;
		}
	}
}

int find(int x){
	int h = x%N;
	for(;;){
		if(ht[h]==-1){
			return 0;
		}else if(ht[h]==x){
			return 1;
		}else{
			h = (h+193)%N;
		}
	}
}

int getint(string &s){
	int ret = 0;
	for(int i=0; i<s.length(); i++){
		if(s.at(i)=='A') ret += 1;
		if(s.at(i)=='T') ret += 2;
		if(s.at(i)=='G') ret += 3;
		if(s.at(i)=='C') ret += 4;
		ret *= 5;
	}
	return ret;
}

int main(){
	for(int i=0; i<N; i++) ht[i] = -1;
	int n;
	cin >> n;
	for(int i=0; i<n; i++){
		char s1_[10];
		char s2_[12];
		scanf("%s %s", s1_, s2_);
		string s1 = s1_;
		string s2 = s2_;
		if(s1=="insert") inserth(getint(s2));
		if(s1=="find"){
			if(find(getint(s2))){
				cout << "yes" << endl;
			}else{
				cout << "no" << endl;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 40296
// Try AtCoder
// author: Loenardone @ NEETSDKASU

fn main() {
    let mut stdin = String::new();
    std::io::Read::read_to_string(&mut std::io::stdin(), &mut stdin).unwrap();
    let mut stdin = stdin.split_whitespace();
    let mut get = || stdin.next().unwrap();
    macro_rules! get {
        ($t:ty) => (get().parse::<$t>().unwrap());
        () => (get!(i64));
    }
    
    let n = get!();
    for i in 1 .. 10 {
        let x = n / i;
        if x < 10 && i * x == n {
            println!("Yes");
            return;
        }
    }
    println!("No");
}

Measured memory_bytes: 4352
#include <stdio.h>
#include <iostream>
#include <string>
#include <map>

using namespace std;

int main() {
    string S, T;
    cin >> S;
    cin >> T;

    int l = S.length();

    map<char, pair<int, int> > m;
    m.insert(make_pair('a', make_pair(-1, -1)));
    m.insert(make_pair('b', make_pair(-1, -1)));
    m.insert(make_pair('c', make_pair(-1, -1)));
    m.insert(make_pair('d', make_pair(-1, -1)));
    m.insert(make_pair('e', make_pair(-1, -1)));
    m.insert(make_pair('f', make_pair(-1, -1)));
    m.insert(make_pair('g', make_pair(-1, -1)));
    m.insert(make_pair('h', make_pair(-1, -1)));
    m.insert(make_pair('i', make_pair(-1, -1)));
    m.insert(make_pair('j', make_pair(-1, -1)));
    m.insert(make_pair('k', make_pair(-1, -1)));
    m.insert(make_pair('l', make_pair(-1, -1)));
    m.insert(make_pair('m', make_pair(-1, -1)));
    m.insert(make_pair('n', make_pair(-1, -1)));
    m.insert(make_pair('o', make_pair(-1, -1)));
    m.insert(make_pair('p', make_pair(-1, -1)));
    m.insert(make_pair('q', make_pair(-1, -1)));
    m.insert(make_pair('r', make_pair(-1, -1)));
    m.insert(make_pair('s', make_pair(-1, -1)));
    m.insert(make_pair('t', make_pair(-1, -1)));
    m.insert(make_pair('u', make_pair(-1, -1)));
    m.insert(make_pair('v', make_pair(-1, -1)));
    m.insert(make_pair('w', make_pair(-1, -1)));
    m.insert(make_pair('x', make_pair(-1, -1)));
    m.insert(make_pair('y', make_pair(-1, -1)));
    m.insert(make_pair('z', make_pair(-1, -1)));

    bool ans = true;
    for (int i = 0; i < l; i++) {
        if (m[S[i]].first != m[T[i]].second) {
            ans = false;
            break;
        }
        m[S[i]].first = i;
        m[T[i]].second = i;
    }

    if (ans) {
        printf("Yes");
    } else {
        printf("No");
    }

    return 0;
}

Measured memory_bytes: 904
n = gets.to_i
buttons = readlines.map(&:to_i)
target = 0
count = 1
flag = false
while count <= n
  if buttons[target] == 2
    puts count
    flag = true
    break
  else
    target = buttons[target] - 1
    count += 1
  end
end
puts '-1' unless flag


Measured memory_bytes: 8316
def suma(arr)
  sum = 0
  arr.each do |val|
    sum += val
  end
  return sum
end

N,M = gets.chomp.split(" ").map(&:to_i)
a = gets.chomp.split(" ").map(&:to_i)
sum= suma(a)
a = a.sort.reverse
max=[]
SK = sum * (1/(4*M.to_f))
i = 0
a.each do |val|
  break if i >= M
  if val < SK
    break
  else
    max.push(val)
  end
  i+=1
end
if max.size == M
  puts "Yes"
else
  puts "No"
end

Measured memory_bytes: 14292
#include <bits/stdc++.h>
using namespace std;
//#pragma GCC optimize("Ofast")
#define rep(i,n) for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
#define pi M_PI
#define PQ(T) priority_queue<T>
#define SPQ(T) priority_queue<T,vector<T>,greater<T>>
using ll=long long;
using P=pair<ll,ll>;
using PP=tuple<ll,ll,ll>;
using S=multiset<ll>;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
const ll inf=1001001001001001;
const int INF=1001001001;
const int mod=1000000007;
const double eps=1e-10;
template<class T> bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<'\n';}
template<class T> void outvp(T v){rep(i,v.size())cout<<'('<<v[i].fi<<','<<v[i].se<<')';cout<<'\n';}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<'\n';}
template<class T> void outvv(T v){rep(i,v.size())outv(v[i]);}
template<class T> bool isin(T x,T l,T r){return (l)<=(x)&&(x)<=(r);}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
void decimal(int x){cout<<fixed<<setprecision(x);}
//ll GCD(ll a,ll b){if(b==0) return a; return GCD(b,a%b);}
//ll LCM(ll a,ll b){return(a/GCD(a,b))*(b/GCD(a,b))*GCD(a,b);}
ll POW(ll a,ll b){a%=mod;if(b==0)return 1;if(b&1)return a*POW(a,b-1)%mod;ll k=POW(a,b/2);return k*k%mod;}
vi calc(ll x){vi res;while(x>0){res.eb(x%10);x/=10;}reverse(all(res));return res;}

void solve(){
  ll x; cin>>x;
  ll ans=0;
  REP(i,1,x+1){
    ll p=x/i;
    ans+=i*p*(p+1)/2;
  }
  out(ans);
}

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
}


Measured memory_bytes: 3656
from collections import deque
H, W = list(map(int, input().split()))
A = []
for _ in range(H):
  A.append(input())
  
#blank count
bcount = 0
for i in range(H):
  for j in range(W):
    if A[i][j] == ".":
      bcount += 1
      
d = deque()
dist = [[-1 for j in range(W)] for i in range(H)]
visited = [[False for j in range(W)] for i in range(H)]
willsearch = [[False for j in range(W)] for i in range(H)]

d.append([0,0])
dist[0][0] = 0

while len(d) > 0:
  x,y = d.popleft()
  visited[x][y] = True
  for a,b in [[x+1,y], [x-1,y], [x,y+1], [x,y-1]]:
    if not (0 <= a and a < H and 0 <= b and b < W) :
      continue
    if A[a][b] == '#':
      continue
    if visited[a][b] or willsearch[a][b]:
      continue
    willsearch[a][b] = True
    d.append([a,b])
    dist[a][b] = dist[x][y] + 1
    
if not visited[H-1][W-1]:
  print(-1)
else:
  print(bcount - dist[H-1][W-1]-1)
  
#print(dist)

Measured memory_bytes: 3436
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(), (x).end())
#define ALL(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < n; i++)
#define reps(i, m, n) for (ll i = m; i < n; i++)
#define repr(i, m, n) for (ll i = m; i >= n; i--)
#define de(x) cout << #x << "=" << x << endl;
template <class T>
bool maxi(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool mini(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
#define INF2 1000000000000000037
#define INF  1000000007
#define MOD  1000000007
#define PI (acos(-1))
using namespace std;
using ll = long long;
using ld = long double;
using P  = pair<ld,ll>;
//--GLOBAL---------------------------------
ld EPS=0.0000000000000000001;
struct edge{ll to; ld cost;}; //edgeパラメータ
struct graph{
  ll N; //ノードの個数
  vector<vector<edge> > G; //G[辺の元]((.to辺の先,.costコスト),...)
  vector<ld> d; // dist[n] = ノードnまでのの重み
  vector<ll> parent;

  graph(ll n): N(n), G(N), d(n,INF2), parent(N) {}

  void add_edge(ll s, ll t, ld cost){
    G[s].emplace_back((edge){t, cost});
    G[t].emplace_back((edge){s, cost}); //無向ならON
  }

  void dijkstra(ll s){
    d[s] = (ld)0;
    priority_queue<P,vector<P>, greater<P> > que; //ansが小さい順に出る
    que.push(P((ld)0,s)); // P < ans , Node >
    while(!que.empty()){
      P p = que.top(); que.pop(); //pに <ans,Node> 入れる
      ll v = p.second; //vに Node 入れる
      if(d[v] < p.first) continue; //すでに良い数値が入っているならパス
      rep(i,G[v].size()){
        edge& E = G[v][i];
        if(d[E.to] > d[v] + E.cost){ //更新するなら
          d[E.to] = d[v]+ E.cost;
          parent[E.to] = v; //親を記録,goalから遡れば道順
          que.push(P(d[E.to], E.to));
        }
      }
    }
  }
};
//--MAIN-----------------------------------
void Main() {
    ll xs,ys,xg,yg; cin>>xs>>ys>>xg>>yg;
    ll N; cin>>N;
    graph g(N+2);
    vector<ll> x(N+2);
    vector<ll> y(N+2);
    vector<ld> r(N+2);
    x[0]=xs;
    y[0]=ys;
    r[0]=0;
    x[N+1]=xg;
    y[N+1]=yg;
    r[N+1]=0;
    reps(i,1,N+1){
        cin>>x[i]>>y[i]>>r[i];
    }
    rep(i,N+1){
        reps(j,i+1,N+2){
            ld kyori=sqrt((ld)((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j])));
            kyori=kyori-r[i]-r[j];
            g.add_edge(i,j,max(EPS,kyori));
        }
    }
    g.dijkstra(0);
    cout<< g.d[N+1] <<"\n";

}
//--START----------------------------------
int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
}
//-----------------------------------------


Measured memory_bytes: 42476
use std::io;
use std::io::Read;

fn main() {
    // inputs
    let mut stdin = io::stdin();
    let mut lines_str = String::new();
    let _ = stdin.read_to_string(&mut lines_str);
    let mut lines = lines_str.lines();
    let mut l1 = lines.next().expect("").split_whitespace();
    let n :usize = l1.next().expect("").trim().parse().unwrap();
    let m :usize = l1.next().expect("").trim().parse().unwrap();
    let s :Vec<char> = lines.next().expect("").trim().to_string().chars().collect();
    let t :Vec<char> = lines.next().expect("").trim().to_string().chars().collect();

    let d = gcd(n,m);
    let l = n * (m / d);
    //check
    for i in 0..d {
        if s[i * (n / d)] != t[i * (m / d)] {
            println!("-1");
            return;
        }
    }

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

fn gcd(x :usize, y :usize) -> usize {
    if x == 0 {
        return y;
    }
    if y == 0 {
        return x;
    }
    if x > y {
        return gcd(y, x-y);
    } else {
        return gcd(x, y-x);
    }
}


Measured memory_bytes: 4352
// Author: getharshkumar

#include <bits/stdc++.h>
using namespace std;
#define ll int64_t
const ll N = 1e6 + 6, M = 1e9 + 7;
int main()
{
    ios::sync_with_stdio(false), cin.tie(nullptr);
    ll n;
    cin >> n;
    cout << 3 * n * n;
    return 0;
}

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

int main() {
  int A, B, M;
  cin >> A >> B >> M;

  vector<int> Va;
  vector<int> Vb;
  int minA = 100000;
  int minB = 100000;
  for(int i = 0; i < A; i++) {
    int a;
    cin >> a;
    minA = min(minA, a);
    Va.push_back(a);
  }
  for(int i = 0; i < B; i++) {
    int b;
    cin >> b;
    minB = min(minB, b);
    Vb.push_back(b);
  }

  int ans = minA + minB;
  for(int i = 0; i < M; i++) {
    int x, y, c;
    cin >> x >> y >> c;

    ans = min(ans, Va.at(x-1) + Vb.at(y-1) - c);
  }

  cout << ans << endl;
}


Measured memory_bytes: 1400
import sys

s = 'a' + input()

for i in range(3,len(s)):
  if s[i] != s[i-1] and s[i] != s[i-2]:
    continue
  elif s[i] == s[i-1]:
    print(i-1,i)
    sys.exit(0)
  elif s[i] == s[i-2]:
    print(i-2,i)
    sys.exit(0)

if s[1] == s[2]:
  print(1,2)
  sys.exit(0)
print(-1,-1)

Measured memory_bytes: 3188
s = input()
if len(s)%2 == 0:
    s = s[:-2]
else:
    s = s[:-1]

for i in range(len(s)//2):
    if s[:len(s)//2] == s[len(s)//2:]:
        print(len(s))
        break
    else:
        s = s[:-2]


Measured memory_bytes: 2940
# 入力
H,W=map(int,input().split())

l=[]
for i in range(H):
  x=input()
  # 白いマスのみからなる場合は追加しない
  if x!='.'*W:
    l.append(x)

rm=[]
for i in range(W):
  # フラグ
  f=True
  for j in range(len(l)):
    if l[j][i]=='#':
      f=False

  # 取り除く列の添字を保存しておく
  if f:
    rm.append(i)

a=[]
for x in l:
  for i in rm[::-1]:
    x=x[:i]+x[i+1:]
  a.append(''.join(x))

# 出力
for i in range(len(a)):
  print(''.join(a[i]))

Measured memory_bytes: 38768
#include <bits/stdc++.h>
#define INF 2e9
#define MOD 1000000007
#define MOD9 998244353
#define intMAX 51000;
#define PI 3.14159265359
using namespace std;
typedef long long llong;
// typedef long double ldouble;

using Graph = vector<vector<int>>;

// int ctoi(const char c){
//   if('0' <= c && c <= '9') return (c-'0');
//   return -1;
// }

// int gcd(int a, int b){
//   int ma = max(a,b);
//   int mi = min(a,b);
//   if(mi == 0) return ma;

//   return gcd(mi, ma%mi);
// }

// llong POW(llong a, llong b){
//   if(b == 0) return 1;
//   else{
//     if(b%2 == 0) return POW(a * a % MOD, b / 2) % MOD;
//     else return a * POW(a * a % MOD, b / 2) % MOD;
//   }
// }

int main(){
  int A, B, C;
  cin >> A >> B >> C;
  if(A+B>=C) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <iomanip>
#include <bitset>
#include <stack>
#include <memory.h>
#include <list>
#include <numeric>
#include <functional>
#include <complex>
#include <unordered_set>
#include <cctype>
#include <cassert>


using namespace std;

typedef long long ll;
typedef long double ld;

const int nax = (int)1e5 + 5;

int dp[nax][3];

int main() {
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#else
	//freopen("angle2.in", "r", stdin);
	//freopen("angle2.out", "w", stdout);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
#endif
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < 3; j++) {
			int x;
			cin >> x;
			for (int k = 0; k < 3; k++) {
				if (j == k) continue;
				dp[i + 1][k] = max(dp[i + 1][k], dp[i][j] + x);
			}
		}
	}

	cout << *max_element(begin(dp[n]), end(dp[n]));
 	return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    ごちゃごちゃ場合分けを考える前に全探索は考えましたか？
    詰まった時に、別の分野の問題として考え直す（これdpでは？、グラフとしてみればいいのでは？）
    多くの問題はパターンマッチだが、パターンに落とし込むまでが難しく、そのための訓練としてわからない問題をあれこれ色々な角度から考察してみるのではないか
*/

const ll mod = 1e9+7;

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

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

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

ll power(ll x, ll n){
    if(n == 0) return 1;

    ll res = power(x, n/2);
    if(n%2 == 0) return res*res;
    else return res*res*x;
}

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

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

typedef tuple<ll, ll, ll> T;


// 有向グラフでの閉路検出
// O(V+E)
const int NMAX = 1e6+5;
vector<int> G[NMAX];
vector<int> status(NMAX, 0);
// 0:New, 1:Active, 2:Finished
// Activeは行きがけ順序、Finishedは帰り掛け順序

bool IsAcyclicDFS(int v){
    status[v] = 1;
    for(auto to:G[v]){
        if(status[to] == 1) return false;
        else if(status[to] == 0){
            if(IsAcyclicDFS(to) == false) return false;
        }
    }
    status[v] = 2;
    return true;
}

bool IsAcyclic(){
    for(int i=0; i<NMAX; ++i) status[i] = 0;
    for(int i=0; i<NMAX; ++i){
        if(status[i] == 0){
            if(IsAcyclicDFS(i) == false) return false; 
        }
    }
    return true;
}

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

    int V,E; cin >> V >> E;
    for(int i=0; i<E; ++i){
        int s,t; cin >> s >> t;
        G[s].push_back(t);
    }

    if(IsAcyclic() == false) cout << 1 << endl;
    else cout << 0 << endl;
    
    return 0;
}


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

#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define int long long
#define rep(i,a,b)    for(int i=a;i<b;i++)
#define repn(i,a,b)   for(int i=a;i>=b;i--)
#define ff first
#define ss second
#define lb lower_bound
#define ub upper_bound
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define vvi vector<vector<int>>;
#define mi  map<int,int>
#define mii map<pii,int>
#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define sz(x) (int)x.size()
#define all(v) (v).begin(), (v).end()
#define ret(x) return cout<<x,0;
#define rety return cout<<"YES",0;
#define retn return cout<<"NO",0;
#define fl fflush(stdout)   
#define hell 1000000007  
#define hell2 998244353 
#define pi 3.14159265358979323846

int solve(){
    int n,ans=0;
    cin>>n;
    int a[n],b[n],c[n],d[n];
    rep(i,0,n)cin>>a[i],c[i]=a[i];
    rep(i,0,n)cin>>b[i],d[i]=b[i];
    rep(i,1,n)c[i]+=c[i-1];
    repn(i,n-2,0)d[i]+=d[i+1];
    rep(i,0,n)ans=max(ans,c[i]+d[i]);
    cout<<ans;
    return 0;
}

signed main(){
    auto start = high_resolution_clock::now();
    IOS;
    int t=1;
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r" , stdin);
    freopen("output.txt", "w", stdout);
    #endif
   // cin>>t;
    while(t--){
        solve();
        cout<<"\n";
    }
    auto stop = high_resolution_clock::now();
    auto duration = duration_cast<microseconds>(stop - start);
    cerr<<"Time taken:"<<duration.count()/1000000.0<<"seconds"<<"\n";
    return 0;
} 

Measured memory_bytes: 3792
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<cstring>
#include<functional>
#include<stack>
#include<queue>
#include <iomanip>
#include<map>
#include<limits>
#include<cmath>
#include<algorithm>
#include<bitset>
#include<utility>
#include<complex>
#include<cstdlib>
#include<set>
#include<cctype>

#define DBG cerr << '!' << endl;
#define REP(i,n) for(int (i) = (0);(i) < (n);++i)
#define rep(i,s,g) for(int (i) = (s);(i) < (g);++i)
#define rrep(i,s,g) for(int (i) = (s);i >= (g);--(i))
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int W = 0;W < (n);W++)cerr << v[W] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(10)

using namespace std;

typedef long long ll;
typedef vector<int> iv;
typedef vector<iv> iiv;
typedef vector<string> sv;

int n,k;

int main()
{
	cin >> n >> k;
	vector<ll> v;
	set<ll> s;
	
	REP(i,n)
	{
		int tmp;cin >> tmp;
		v.PB(tmp);
		s.insert(tmp);
	}
	
//	cout << s.size() << endl;
	
	if(s.size() <= k)
	{
		cout << 0 << endl;
		return 0;
	}

	sort(ALL(v));
	
//	SHOW1d(v,v.size());
	
	vector<int> cou;
	
	int num = 0;
	REP(i,n)
	{
		num = 0;
		while(i < n && v[i] == v[i+1])
		{
			num++;
			i++;
		}
		cou.PB(num+1);
	}
	
	int ans = 0;
	
	sort(ALL(cou));
	
//	SHOW1d(cou,cou.size());
	
	REP(i,s.size()-k)
	{
		ans += cou[i];
	}
	
	cout << ans << endl;
	
	
	
	return 0;
}

Measured memory_bytes: 13040
#include <bits/stdc++.h>
using namespace std;
#define int ll
#define ll long long
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
// #define MOD 998244353
#define MEM_SIZE 101010
#define DEBUG_OUT true
#define ALL(x) (x).begin(), (x).end()

template <typename T>
void DEBUG(T e)
{
  if (DEBUG_OUT == false)
    return;
  std::cout << e << " ";
}
template <typename T>
void DEBUG(const std::vector<T> &v)
{
  if (DEBUG_OUT == false)
    return;
  for (const auto &e : v)
  {
    std::cout << e << " ";
  }
  std::cout << std::endl;
}
template <typename T>
void DEBUG(const std::vector<std::vector<T>> &vv)
{
  if (DEBUG_OUT == false)
    return;
  for (const auto &v : vv)
  {
    DEBUG(v);
  }
}
template <class T, class... Ts>
void DEBUG(T d, Ts... e)
{
  if (DEBUG_OUT == false)
    return;
  DEBUG(d);
  DEBUG(e...);
}
template <class T>
void corner(bool flg, T hoge)
{
  if (flg)
  {
    cout << hoge << endl;
    abort();
  }
}
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); }

void solve(void)
{
  int h, w;
  cin >> h >> w;
  vector<pair<int, int>> vp;
  for (int i = 0; i < h; i++)
  {
    int x;
    cin >> x;
    vp.emplace_back(x, 0);
  }
  for (int i = 0; i < w; i++)
  {
    int x;
    cin >> x;
    vp.emplace_back(x, 1);
  }
  sort(ALL(vp));
  int res = 0;
  w++;
  h++;
  for (auto &&i : vp)
  {
    if (i.second == 0)
      res += w * i.first, h--;
    else
      res += h * i.first, w--;
  }
  cout << res << endl;

  return;
}

int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(11);
  solve();

  return 0;
}


Measured memory_bytes: 7404
#include<iostream>
#include<cstdio>
#include<algorithm>

using namespace std;

/*


*/
int n;

int main(){
  cin >> n;

  int cnt = 0;
  while(n > 0){
    if(n % 10 == 2)
      cnt++;

    n /= 10;
  }

  cout << cnt << endl;

  return 0;
}



Measured memory_bytes: 256
import java.util.*;
public class Main{
  public static void main(String[] args){
  Scanner sc = new Scanner(System.in);
  int n = sc.nextInt();
  int x = 800*n;
  int y = 200*(n/15);
  
  int result = x - y;
  System.out.println(result);
  }
}


Measured memory_bytes: 21716
#include <bits/stdc++.h>
#define rep(i,N) for (int i = 0; i < (N); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main(void){
  int a, b;
  cin >> a >> b;

  cout << a * b << endl;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define MOD			1000000007
#define FOR(i,l,r)	for(int i=l;i<=r;i++)
#define REP(i,n)	for(int i=1;i<=n;i++)
#define REP0(i,n)	for(int i=0;i<n;i++)
#define PB			push_back
#define MP			make_pair
#define PII			pair<int,int>
#define VI			vector<int>
#define ALL(x)		(x).begin(),(x).end()
int x;string s;
int main(){
	cin>>x>>s;
	if(x>=3200)	cout<<s<<endl;
	else		cout<<"red\n";
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define FAST_IO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define INF (1e10+5)
#define F first
#define S second
#define pb push_back
#define MP make_pair
#define FRL(i,a,n) for(i=a;i<n;i++)
#define FR(i,n) FRL(i,0,n)
#define RFRL(i,n) for(i=n;i>=0;i--)
#define MOD 1000000007
#define fill(a) memset(dp,a,sizeof(dp));

using namespace std;

typedef long long int  ll;

typedef vector<ll> vi;
typedef pair<ll,ll> pi;
typedef vector< pair<ll,ll> > vpi;
typedef set<ll> st;
typedef map<ll,ll> mp;
typedef unordered_map<ll,ll> ump;

template< class T>
T minn(T a,T b)
{
	return (a>b)?b:a;
}
template< class T>
T maxx(T a,T b)
{
	return (a>b)?a:b;
}


void FILE_OP()
{
	#ifndef ONLINE_JUDGE
        freopen("inputf.txt", "r", stdin);
        freopen("output2.txt", "w", stdout);
    #endif
}
ll binpow(ll a, ll b) {
    ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}
ll n,W;
ll v[100005],Wi[100005];
ll dp[105][100005];
/*ll frog(ll i,ll c)
{
	if(i>n)
		return 0;
	
	c=c+minn(frog(i+1,abs(v[i-1]-v[i])),frog(i+2,abs(v[i-2]-v[i])));
	return c;

}*/

ll findmax(ll i,ll w)
{
	if(w>W || i>n)
		return 0;
	
	//cout<<w<<"\n";
	if(dp[i][w]!=-1)
		return dp[i][w];
	if(w+Wi[i]>W)
		return dp[i][w]=findmax(i+1,w);
	return dp[i][w]=maxx(findmax(i+1,w),v[i]+findmax(i+1,w+Wi[i]));
		
	
}


void SOLVE()
{

	
	ll tt,m,i,j,k,a,b,c,d,l,r;
	//cin>>tt;
	tt=1;
	fill(-1)
	while(tt--)
	{
		cin>>n>>W;
		
		for(i=1;i<=n;i++)
			cin>>Wi[i]>>v[i];
		cout<<findmax(1,0);
		
		
	}


		
}

int main()
{
	FAST_IO
	//FILE_OP();
	SOLVE();
	
	return 0;
}


Measured memory_bytes: 82304
g=->k{k.times.map{gets.split.map &:to_i}}
N,C=g[1][0];D=g[C];M=g[N];T=3.times.map{[0]*C}
N.times{|y|N.times{|x|T[(y+x)%3][M[y][x]-1]+=1}}
p [*0...C].permutation(3).map{|e|r=0;3.times{|i|C.times{|c|r+=T[i][c]*D[c][e[i]]}};r}.min

Measured memory_bytes: 4604
N = int(input())

t = [0] * N
x = [0] * N
y = [0] * N

for i in range(N):
    t[i], x[i], y[i] = map(int, input().split())

judg = 0    

for i in range(N):
    if x[i]+y[i]<=t[i]:
        if t[i]%2==0 and (x[i]+y[i])%2==0:
            judg += 1
        elif t[i]%2!=0 and (x[i]+y[i])%2!=0:
            judg += 1

if judg == N:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 11636
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {
    public static void main(final String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int K = sc.nextInt();
        int[] d = new int[K];
        Set<String> A = new HashSet<>();
        for (int i = 0; i < K; i++) {
            d[i] = sc.nextInt();
            for (int j = 0; j < d[i]; j++) {
                A.add(sc.next());
            }
        }
        sc.close();

        System.out.println(N - A.size());
    }
}


Measured memory_bytes: 41660
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <cstring>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<long long, long long> P;
#define rep(i, n) for(long long i=0; i<n; i++)
#define reps(i, s, e) for(long long i=s; i<e; i++)
#define repr(i, n) for(long long i=n-1; i>=0; i--)
#define reprs(i, s, e) for(long long i=e-1; i>=s; i--)

int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    int n; cin >> n;
    double v[n];
    rep(i, n){
        cin >> v[i];
    }

    sort(v, v+n);

    double ans = (v[0] + v[1]) / 2.0;
    reps(i, 2, n){
        ans = (ans + v[i]) / 2.0;
    }

    cout << setprecision(10);
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
/*
URL: http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1160&lang=jp
?????????: How Many Islands?
?????°:
18:49 ?????????????????????????§£?????????
*/
#include <iostream>
using namespace std;

int dat[52][52]; // ??¨?????????1???????????£?????°

void delete_island_from(int i, int j)
{
	int dx[8] = {-1,-1,-1, 0,  0, 1, 1, 1};
	int dy[8] = {-1, 0, 1,-1,  1,-1, 0, 1};

	dat[i][j] = 0;
	for(int k=0;k<8;k++) {
		if(dat[i+dx[k]][j+dy[k]]) {
			delete_island_from(i+dx[k],j+dy[k]);
		}
	}
}


int main()
{
	while(true){ // data set
		//dat???0????????¢
		for(int i=0;i<52;i++){
			for(int j=0;j<52;j++){
				dat[i][j]=0;
			}
		}

		int w; int h;
		cin >> w >> h;
		if(w == 0 && h == 0) {break;}

		for(int i=0; i<h;i++) {
			for(int j=0;j<w;j++) {
				cin >> dat[i+1][j+1]; // ??¨?????????1???????????£?????°
			}
		}

		int ans = 0;
		while(true) {
			for(int i=0; i<h+2;i++) { // ????????£?????°??????
				for(int j=0;j<w+2;j++) {
					if(dat[i][j] == 1){
						delete_island_from(i,j);
						ans++;
						goto label1;
					}
				}
			} // all is ocean
			cout << ans << endl;
			break;


			label1: ;
		}
	}
}

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

int main(void) {
	int a, b, c, k, sum = 0;
	
	scanf("%d %d %d %d", &a, &b, &c, &k);
	
	for (int i = 0; i < k; i++) {
		if (a) {
			sum += 1;
			a--;
		} else if (b) {
			b--;
		} else if (c) {
			sum -= 1;
			c--;
		}
	}
	
	printf("%d\n", sum);
	
	return 0;
}

Measured memory_bytes: 1728
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>

using namespace std;
using ll = long long int;
#define rep(i,n) for(int i = 0; i < n; i++)
#define FOR(i, a, b)  for(int i = (a); i < (b) ; i++)
#define pb push_back
#define SORT(v,n) sort(v, v+n)
#define ALL(x) (x).begin(),(x).end()
#define debug(x) cerr << #x << ": " << x << '\n'
#define elif else if
#define itn ll
#define int ll
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
int dx[8] = { 1, 0, -1, 0, 1, -1, -1, 1 };
int dy[8] = { 0, 1, 0, -1, 1, 1, -1, -1 };
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;


int f(int mx) {
	int n = 0;
	while (mx > 0) {
		mx /= 10;
		n++;
	}
	return n;
}

int n;
int ans = INF;

signed main() {
	ios::sync_with_stdio(false);
	cin >> n;
	int ans = f(n);
	for (int a = 1; a * a <= n; a++) {
		if (n % a != 0) continue;
			const int b = n / a;
			ans = min(ans, max(f(a), f(b)));
	}
	cout << ans << '\n';
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <set>
using namespace std;
typedef unsigned long long ulli;

const int MAXH = 10;
const int MAXW = 20;
const ulli mod = 100000007ULL;

int H, W;
char G[MAXH][MAXW];
int cnt;
int vis[MAXH][MAXW];

int main() {
  while(cin >> H >> W && (H|W)) {
    for(int i = 0; i < H; ++i) {
      for(int j = 0; j < W; ++j) {
        cin >> G[i][j];
      }
    }
    string res = "";
    set<ulli> t;
    cnt = 0;
    fill(vis[0], vis[MAXH], 0);
    for(int i = 0; i < H; ++i) {
      for(int j = 0; j < W; ++j) {
        for(int di = -1; di <= 1; ++di) {
          for(int dj = -1; dj <= 1; ++dj) {
            if(di|dj); else continue;
            ++cnt;
            string s(1, G[i][j]);
            ulli h = G[i][j];
            int ni, nj;
            ni = i; nj = j;
            vis[ni][nj] = cnt;

            while(1) {
              ni = (ni+di+H)%H;
              nj = (nj+dj+W)%W;
              if(vis[ni][nj] == cnt) break;
              s += G[ni][nj];
              h = h * mod + G[ni][nj];

              vis[ni][nj] = cnt;
              if(t.count(h)) {
                if(s.size() > res.size() ||
                   s.size() == res.size() && s < res) {
                  res = s;
                }
              } else {
                t.insert(h);
              }
            }
          }
        }
      }
    }
    if(res == "") res = "0";
    cout << res << endl;
  }
  return 0;
}

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

int main() {
	int m, a;
	while (cin >> m >> m >> a && m) {
		vector<pair<int, pair<int, int> > > line(m);
		for (int i = 0; i < m; ++i) {
			int h, a, b;
			cin >> h >> a >> b;
			line[i] = pair<int, pair<int, int> >(1000 - h, pair<int, int>(a, b));
		}
		sort(line.begin(), line.end());
		for (int i = 0; i < m; ++i) {
			int d = line[i].second.first;
			int e = line[i].second.second;
			if (d == a) {
				a = e;
			}
			else if (e == a) {
				a = d;
			}
		}
		cout << a << endl;
	}
}


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


int N,M,p,d[10000],x[4],r,l;
int main(){
for(int i=0;i<10;i++){
cin>>d[i];
}
sort(d,d+10);
for(int i=9;i>6;i--){
cout<<d[i]<<endl;}
return 0;
}

Measured memory_bytes: 1176
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//conversion
//------------------------------------------
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();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned long long ULL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

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

int main() {
  int n;
  map<char, char> m;

  while(1) {
    cin >> n;
    if(!n) break;

    REP(i, n) {
      char c1, c2;
      cin >> c1 >> c2;
      m.insert(map<char, char>::value_type(c1, c2));
    }

    cin >> n;
    REP(i, n) {
      bool b = true;
      char c;
      cin >> c;
      map<char, char>::iterator it = m.begin();
      while(it != m.end()) {
	if(it->first == c) {
	  cout << it->second;
	  b = false;
	  break;
	}
	it++;
      }
      if(b)cout << c;
    }
    cout << endl;
    m.clear();
  }
}

Measured memory_bytes: 1188
#include <bits/stdc++.h>
#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n,s) for(int i=(s);i<(n);i++)
#define rrep(i,n) for(int i=(n-1);i>=0;i--)
#define rreps(i,n,s) for(int i=s;i>=n;i--)
#define MOD 1000000007
using ll = long long;
using namespace std;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

int main(){
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin >> n;
int ans;
rrep(i,n+1){
    double a = sqrt(i);
    if(floor(a)==a){
        ans = i;
        break;
    }
}
cout << ans << endl;
//system("pause");
return 0;
}

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

double times(double x, double k) {
  double ret = 0;
  while(x < k){
    x *= 2;
    ret++;
  }
  return ret;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  double n, k;
  cin >> n >> k;
  
  double ans = 0;
  for(int i = 1; i <= n; i++){
    ans += pow(0.5, times(i, k)) / n;
  }
  
  cout << fixed << setprecision(15) << ans << '\n';
}

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

using namespace std;

typedef long long llint;

int main() {
  llint x, y;
  cin >> x >> y;
  llint ans = 0, v = x;
  while (v <= y) {
    v += v;
    ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int a,b,c,d,e[10000],f[10000],h,g,i,j;
	a = b = 1;
	h = g = 0;
	
	while(a != 0 && b != 0){
		scanf("%d %d",&a,&b);
		
		e[h] = a;
		f[g] = b;
		
		++g;
		++h;
		j = h;
	}
	g = h = 0;
	
	for(i = 0;i < j;++i){
		for(c = 0;c < e[g-1];++c){
			for(d = 0;d < f[h-1];++d){
				printf("#");
			}
			printf("\n");
		}
		if(c != 0){
			printf("\n");
		}
		++g;
		++h;
	}
	
	return(0);
}

Measured memory_bytes: 2572
using System;
using System.Linq;
class Program
{
	static void Main(string[] args)
	{
		int numberCount = int.Parse(Console.ReadLine());
		int[] numbers = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
        int[] distinctNumbers = numbers.Distinct().ToArray();
      
        if (numbers.Length > distinctNumbers.Length) {
          Console.WriteLine("NO");
        }
        else {
          Console.WriteLine("YES");
        }
    }
}

Measured memory_bytes: 43316
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <queue>
#include <cmath>
using namespace std;

#define EPS (1e-10)
#define equals (fabs((a)-(b)<EPS)
int n;

struct Point
{
    double x, y;
    Point(){}
    Point(double x,double y):x(x),y(y){}
    Point operator +(Point a)
    {
        return Point(x+a.x,y+a.y);
    }
    Point operator -(Point a)
    {
        return Point(x-a.x,y-a.y);
    }
    Point operator *(double a)
    {
        return Point(x*a,y*a);
    }

    double norm()
    {
        return x*x+y*y;
    }
};
Point p1,p2,p3,p4;
double cross(Point a,Point b)
{
    return a.x*b.y-b.x*a.y;
}
double dot(Point a,Point b)
{
    return a.x*b.x+a.y*b.y;
}
void solve()
{
   Point a=p2-p1;
   Point b=p4-p3;
   Point c=p3-p1;
   Point d=p4-p1;
   double d1=fabs(cross(a,c));
   double d2=fabs(cross(a,d));
   double t=d1/(d1+d2);
   Point p=p3+b*t;
   printf("%.8lf %.8lf\n",p.x,p.y);
}

int main()
{
//    freopen("in.txt","r",stdin);
      scanf("%d",&n);
    while(n--)
    {
        scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&p1.x,&p1.y,&p2.x,&p2.y,&p3.x,&p3.y,&p4.x,&p4.y);
        solve();
    }
    return 0;
}

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

int main() {
  int N,K,A=1;
  cin >> N >> K;
  for(int i=0; i<N; i++){
    if(A<K)
      A*=2;
    else
      A+=K;
  }
  cout << A << endl;
}

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

int main(void){

	int n, m, k, i, j, flag = 0,keisan=0;
	
	cin >> n  >> m >> k;
	
	for(i = 0; i < n + 1 ; i++){
	    
	    for(j = 0; j < m + 1; j++){
	        keisan = i * m + j * n - 2 * i * j;
	        if(keisan == k){
	            flag = 1;
	            break;
	        }
	    }
	}

	if(flag == 0){
	    cout << "No" << endl;
	}
	if(flag == 1){
	    cout << "Yes" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
            using namespace std;
             
            int main(){
            int a,b;
            cin>>a>>b;
            if(a%3==0 || b%3==0 || (a+b)%3==0)
             return cout<<"Possible"<<endl,0;
            return cout<<"Impossible"<<endl,0;
             
             
            return 0;
            }

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

using namespace std;

int GCD(int a, int b) {if(b==0)return a; return GCD(b, a%b);}
int main() {
    string s; cin >> s;
    for (int i = 0; i < s.size(); i++) {
        if (s[i] == '1') s[i] = '9';
        else s[i] = '1';
    }
    cout << s << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, x) for(ll i = 0; i < x; i++)
#define rep2(i, x) for(ll i = 1; i <= x; i++)
#define all(a) (a).begin(),(a).end()
using ll = long long;
using ld = long double;
using namespace std;
const ll INF = 1000000000000000000;
const ll mod = 1000000007;
const ld pi = 3.141592653589793238;

ll a[102][102][2][2];//座標、turn、move on
//move on...right:1, down:0
signed main() {
    while (true) {
	ll n, m, ans = 0; cin >> n >> m;
	if (n == 0 && m == 0) { return 0; }
	rep2(h, n) {
		rep2(i, m) {
			if (h == 1 && i == 1) { continue; }
			if (h == 1) { a[h][i][0][1] = 1; }
			else if (i == 1) { a[h][i][0][0] = 1; }
			else {
				a[h][i][0][0] = (a[h - 1][i][0][0] + a[h - 1][i][1][0]) % 100000;
				a[h][i][0][1] = (a[h][i - 1][0][1] + a[h][i - 1][1][1]) % 100000;
				a[h][i][1][0] = (a[h - 1][i][0][1]) % 100000;
				a[h][i][1][1] = (a[h][i - 1][0][0]) % 100000;
			}
		}
	}
	rep(h, 2) {
		rep(i, 2) {
			ans += a[n][m][h][i]; ans %= 100000;
		}
	}
	cout << ans << endl;
    }
	return 0;
}


Measured memory_bytes: 3408
#include <stdio.h>
#include <string.h>

#define MAX_PRIME	(1000000)
#define IS_PRIME(n)	(prime[j]==0?1:0)

int prime[MAX_PRIME + 1];
int fare[MAX_PRIME + 1];

void make_prime(void)
{
    int i;
    int j;
    int n;
    int c;
    
    for (i = 2; i * i <= MAX_PRIME; i++){
        if (prime[i] == 0){
            for (j = i * 2; j <= MAX_PRIME; j += i){
				prime[j] = 1;
            }
        }
    }
}


int main(void)
{
	int n, x;
	int price[30];
	int i, j, k;
	
	make_prime();
	
	while (1){
		scanf("%d%d", &n, &x);
		if (n == 0 && x == 0){
			break;
		}
		
		for (i = 0; i < n; i++){
			scanf("%d", &price[i]);
		}
		
		memset(fare, 0, sizeof(fare));
		fare[0] = 1;
		for (i = 0; i < x; i++){
			if (fare[i] != 0){
			    for (j = 0; j < n; j++){
					if (i + price[j] <= x){
						fare[i + price[j]] = 1;
					}
				}
			}
		}
		
//for (i = 1; i <= x; i++){
//	printf("[%d=%d]", i, fare[i]);
//}

		for (i = x; i >= 1; i--){
			if (fare[i] != 0 && prime[i] == 0){
				printf("%d\n", i);
				break;
			}
		}
		if (i == 0){
			printf("NA\n");
		}
	}
	return (0);
}

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

int main() {
    int64_t N, K, ans;
    cin >> N >> K;
    ans = N;
    vector<int> sunuke(N);
    for (int i = 0; i < N; i++) {
        sunuke[i] = 1;
    }
    for (int i = 0; i < K; i++) {
        int d;
        cin >> d;
        for (int j = 0; j < d; j++) {
            int A;
            cin >> A;
            if (sunuke[A - 1] == 1) {
                sunuke[A - 1] = 0;
                ans--;
            }
        }
    }
    // for (int i = 0; i < N; i++) {
    //     if (sunuke[i] == 0) {
    //             cout << i << endl;
    //         }
    // }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3632
// by adiforluls
#pragma GCC optimize ("-O2")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define FAST            ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define ll              long long
#define ld              long double
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define all(a)          (a).begin(),(a).end()
#define clz(a)          __builtin_clz(a) // count leading zeroes
#define ctz(a)          __builtin_ctz(a) // count trailing zeroes
#define popc(a)         __builtin_popcount(a) // count set bits (for ints only diff for ll)
#define lul             1000000007
#define rep(i,a,b)      for(int i=a;i<b;i++)
#define rfor(i,a,b)     for(int i=a; i>=b; i--)
#define debug(x)        cerr << #x << " = " << x << endl;
#define F               first
#define S               second
#define lul2            998244353 
#define pll             pair<ll,ll>
#define endl            '\n'
#define SIZE            1000005
#define deci(n)         cout<<fixed<<setprecision(n)
#define ordered_set     tree<pll, null_type,less<pll>, rb_tree_tag,tree_order_statistics_node_update>
// order_of_key(k)
// find_by_order(k)
const ld PI = acos(-1.0);
const int INF = 0x3f3f3f3f;

unordered_set<int> frn[100005], block[100005], comp;
vector<int> vis(100005,0);

void mod(ll &x)
{
    if(x>=lul) x-=lul;
    if(x<0) x+=lul;
}
void dfs(int node)
{
    vis[node] = 1;
    for(int i:frn[node])
    {
        if(!vis[i]) dfs(i);
    }
    comp.insert(node);
}
void solve()
{
    int n,m,k; cin>>n>>m>>k;
    vector<int> ans(n+1);
    rep(i,0,m)
    {
        int x,y; cin>>x>>y;
        frn[x].insert(y);
        frn[y].insert(x);
    }
    rep(i,0,k)
    {
        int x,y; cin>>x>>y;
        block[x].insert(y);
        block[y].insert(x);
    }
    rep(i,1,n+1)
    {
        if(!vis[i])
        {
            dfs(i);
            for(int j:comp)
            {
                int cnt = (int)comp.size() - 1;
                for(int idx:block[j])
                {
                    if(comp.find(idx)!=comp.end()) cnt--;
                }
                for(int idx:frn[j])
                {
                    if(comp.find(idx)!=comp.end()) cnt--;
                }
                ans[j] = cnt;
            }
            comp.clear();
        }
    }
    rep(i,1,n+1) cout<<ans[i]<<" ";
}
int main()
{   
    FAST;
   //  #ifndef ONLINE_JUDGE
     // freopen("input.txt", "r", stdin);
     // freopen("output.txt", "w", stdout);
   //  #endif
    int t; /*cin>>t;*/ t=1;
    rep(i,1,t+1){
        solve();
    }
    return 0;
}

Measured memory_bytes: 37412
#include<iostream>
using namespace std;
int weights[10] = { 1,2,4,8,16,32,64,128,256,512 };
bool have[10] = { false,false,false,false,false,false,false,false,false,false };
int main() {
	int w;
	while (cin >> w) {
		int now = 0;
		int tmp = 0;
		for (int i = 0; i < 10; i++)have[i] = false;
		while (tmp < w) {
			tmp += weights[now];
			have[now] = true;
			now++;
		}
		while (tmp != w) {

			if (have[now]) {
				if (tmp - weights[now] >= w) {
					tmp -= weights[now];
					have[now] = false;
					now--;
				}
				else now--;
			}
			else {
				now--;
			}
		}
		int last;
		for (int i = 0; i < 10; i++)if (have[i])last = i;
		for (int i = 0; i < 10; i++) {
			if (have[i]) {
				if (i!=last)cout << weights[i] << ' ';
				else cout << weights[i];
			}
		}
		cout << endl;
	}
}

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

int32_t main(){
   ios::sync_with_stdio(false);
   cin.tie(NULL);
   char c;
   cin >> c;
   cout << char(c+1) << '\n';  
   return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define test int t; cin>>t; while(t--)
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define pb push_back
#define endl "\n"
typedef long long ll;
using namespace std;

int main()
{
 ll n,sum=0; cin>>n;
 ll a[n];
 ll s=0;
 vector<ll>v;
 for(ll i=0;i<n;i++)
 {
     cin>>a[i];
     s+=a[i];
     v.push_back(s);
 }
 ll k=v[n-1];
 ll ans=0;
 ll x;
 ll mod=1000000007;
 for(ll i=0;i<n;i++)
 {
     x=((a[i]%mod)*((k-v[i])%mod))%mod;
     ans=((ans%mod)+(x%mod))%mod;
}
cout<<ans<<endl;
}


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

#if MYDEBUG
#include "lib/cp_debug.hpp"
#else
#define DBG(...) ;
#endif
#if __cplusplus <= 201402L
template <typename T>
T gcd(T a, T b) { return ((a % b == 0) ? b : gcd(b, a % b)); }
template <typename T>
T lcm(T a, T b) { return a / gcd(a, b) * b; }
#endif
using LL = long long;
constexpr LL LINF = 334ll << 53;
constexpr int INF = 15 << 26;
constexpr LL MOD = 1E9 + 7;

namespace Problem {
using namespace std;

class Solver2 {
 public:
  int n, k;
  Solver2(LL n, LL k) : n(n), k(k){};

  void solve() {
    if (k == 1) {
      cout << 0 << endl;
    } else {
      cout << n - k << endl;
    }
  }
};
}  // namespace Problem

int main() {
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(false);
  // std::cout << std::fixed << std::setprecision(12);
  long long n = 0, k;
  std::cin >> n >> k;

  Problem::Solver2 sol(n, k);
  sol.solve();
  return 0;
}


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

int main() {
  int s;

  cin >> s;

  int s1 = s / 100, s2 = (s - s1 * 100) / 10, s3 = s - s1 * 100 - s2 * 10;

  cout << s1 + s2 + s3 << endl;
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i,n,k) for(ll i=(n);i<(k);i++)
void Main(){
    int n,q;cin>>n>>q;
    string S;cin>>S;
    vector<int> dp(n);
    dp.at(0)=0;
    For(i,1,n){
        if(S.at(i-1)=='A'&&S.at(i)=='C') dp.at(i)=dp.at(i-1)+1;
        else dp.at(i)=dp.at(i-1);
    }
    For(i,0,q){
        int l,r;cin>>l>>r;l--;r--;
        cout<<dp.at(r)-dp.at(l)<<endl;
    }
}
int main(){
    Main();
    return 0;
}

Measured memory_bytes: 1408
if __name__ == '__main__':
  n = int(input())
  s = list(input())
  ans = 0
  for i in range(0, len(s)):
    x = set(s[:i+1])
    y = set(s[i+1:])
    num = len(x & y)
    if ans <= num:
      ans = num
  print(ans)

Measured memory_bytes: 3060