akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
import java.io.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        FastScanner sc = new FastScanner(System.in);
        int n = sc.nextInt();
        long k = sc.nextLong();
        long[] a = sc.nextLongArray(n);
        long[] bits = new long[41];    
        for(long v : a){
            int i = 0;
            while(v > 0){
                bits[i] += v%2;
                v >>= 1;
                i++;
            }
        }
        long ln = n;
        long now = (long)Math.pow(2,40);
        long ans = 0;
        for(int i = 40; i >= 0; i--){
            if(now > k){
                ans += bits[i]*now;
            }else{
                if(ln-bits[i] > bits[i]){
                    k -= now;
                    ans += (ln-bits[i])*now;
                }else{
                    ans += bits[i]*now;
                }
            }
            now /= 2;
        }
        System.out.println(ans);
    }
}

class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;
    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

    public String next() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken("\n");
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public double nextDouble() {
         return Double.parseDouble(next());
    }
    
    public String[] nextArray(int n) {
        String[] a = new String[n];
        for (int i = 0; i < n; i++)
            a[i] = next();
        return a;
    }

    public int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = nextInt();
        return a;
    }

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
            a[i] = nextLong();
        return a;
    } 
}


Measured memory_bytes: 47936
#pragma region template 2.4
#include <bits/stdc++.h>
using namespace std;
template <typename T>
using pq_asc = priority_queue<T, vector<T>, greater<T>>;
typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> ii;
typedef vector<ii> vii;
typedef vector<string> vs;
#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define REP1(i, n) for (ll i = 1; i <= (n); ++i)
#define FOR(i, a) for (auto &i : a)
#define CH(f, x, y) x = f(x, y)
#define IN(T, x) \
    T x;         \
    cin >> x;
#define AIN(T, a, n) \
    vector<T> a(n);  \
    FOR(i, a)        \
    cin >> i;
#define A2IN(T1, a, T2, b, n) \
    vector<T1> a(n);          \
    vector<T2> b(n);          \
    REP(i, n)                 \
    cin >> a[i] >> b[i];
#define OUT(x) cout << (x) << endl;
#define FOUT(x) cout << fixed << setprecision(15) << (x) << endl;
#define ALL(a) (a).begin(), (a).end()
#define SORT(a) sort(ALL(a))
#define RSORT(a) \
    SORT(a);     \
    reverse(ALL(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define DUMPA(a)          \
    cout << #a << " = {"; \
    JOUT(ALL(a), ", ", cout) << "}" << endl;

template <typename T>
ostream &JOUT(T s, T e, string sep = " ", ostream &os = cout)
{
    if (s != e)
    {
        os << *s;
        ++s;
    }
    while (s != e)
    {
        os << sep << *s;
        ++s;
    }
    return os;
}

ostream &YES(bool cond, string yes = "Yes", string no = "No", ostream &os = cout)
{
    if (cond)
    {
        os << yes << endl;
    }
    else
    {
        os << no << endl;
    }
    return os;
}

template <typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p)
{
    os << '(' << p.first << ", " << p.second << ')';
    return os;
}

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v)
{
    os << '[';
    JOUT(ALL(v), ", ", os) << ']';
    return os;
}

const ll INF = 1e18;
const ll MOD = 1e9 + 7;
#pragma endregion template

int main()
{
    IN(ll, N);
    IN(ll, K);
    AIN(ll, A, N);
    const ll M = 100;
    vvi dp(M + 1, vi(N + 1));
    REP1(i, N)
    {
        dp[0][i] = A[i - 1];
    }
    ll ans = 1;
    REP(i, M)
    {
        if (K & 1)
        {
            ans = dp[i][ans];
        }
        K >>= 1;
        REP1(j, N)
        {
            dp[i + 1][j] = dp[i][dp[i][j]];
        }
    }
    OUT(ans);
}

Measured memory_bytes: 164252
//#typedef int ll
// include
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <tuple>
// namespace
using namespace std;
// typedef
typedef long long ll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef pair<int, int> pint;
// const
const int inf = 1e9;
const int mod = ((int)1e9 + 7);
// loop
#define rep(i, n) for(int i = 0, i##_mx = n; i < i##_mx; i++)
#define brep(i, b, e) for(int i = b; i < e; i++)
#define erep(i, b, e) for(int i = b; i <= e; i++)
#define rrep(i, b, e) for(int i = b; i >= e; i--)
// STL
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define all(x) (x).begin(), (x).end()
// function
int gcd(int a, int b){return b ? gcd(b, a % b) : a;}
void prime(vint& v, int n){brep(i, 2, n){bool fg = false; for(auto e : v){if(i % e == 0){fg = true;}} if(fg){continue;} v.pb(i);}}
void in(vint& v){for(auto& i : v){cin >> i;}}

signed main(){
    int n;
    cin >> n;
    
    vint w;
    w.resize(n);
    in(w);
    
    int all = 0;
    for(auto e : w){
        all += e;
    }
    
    int sum = 0;
    int dif = all;
    for(auto e : w){
        sum += e;
        if(abs(all - 2 * sum) < dif){
            dif = abs(all - 2 * sum);
        }
    }
    
    cout << dif << endl;
	
	return 0;
}

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

using namespace std;

int main(){
    int n;
    cin>>n;
    vector <int> a(n);
    string ans="APPROVED";
    for(int i=0;i<n;i++){
        cin>>a[i];
        if(a[i]%2==0){
            if(!(a[i]%3==0||a[i]%5==0)){
                ans="DENIED";
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

const int sup = 1 << 30;
int dp[67108864];

int main()
{
	char s[200001];
	scanf("%s", s);
	
	int i, j, bit[27], tmp;
	for (i = 1, bit[0] = 1; i <= 26; i++) bit[i] = bit[i-1] * 2;
	for (i = 1, dp[0] = 0; i < bit[26]; i++) dp[i] = sup;
	for (i = 0, tmp = 0; s[i] != 0; i++) {
		tmp ^= bit[s[i] - 'a'];
		for (j = 0; j < 26; j++) if (dp[tmp ^ bit[j]] + 1 < dp[tmp]) dp[tmp] = dp[tmp ^ bit[j]] + 1;
	}
	if (tmp > 0) printf("%d\n", dp[tmp]);
	else printf("1\n");
	fflush(stdout);
	return 0;
}

Measured memory_bytes: 264048
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace mondai0052
{
	class Program
	{
		static void Main(string[] args)
		{
			long	n	= 0;
			while( (n = long.Parse( Console.ReadLine())) != 0 ) {
				long	a	= 0;
				while( n >= 5 ) {
					a	+= n / 5;
					n	/= 5;
				}
				Console.WriteLine( a );
			}
		}
	}
}

Measured memory_bytes: 5596
//
//AtCoder Beginner Contest 167
//B - Easy Linear Programming
//

#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()

using ll = long long;

const double PI = 3.14159265358979323846;
const int MOD = 1000000007;

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

int main()
{
    ll a, b, c, k;

    cin >> a >> b >> c >> k;

    ll ans = 0;

    if (k - a < 0){
        ans += k;
    }else{
        ans += a;
        k = k - a;

        k = k - b;
        if (k>0) {
            ans -= k;
        }
    }

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


Measured memory_bytes: 3636
program kadai
    implicit none
character(len=3)  ::  S,T
integer  ::  a,i


read(*,*) S
read(*,*) T
a=0
do i=1,3
if (S(i:i)==T(i:i)) then
    a=a+1
end if
end do

write(*,*) a


stop
contains



end program kadai


Measured memory_bytes: 768
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define vec_input(v) for(auto it=v.begin();it!=v.end();it++){cin>>*it;}
#define vec_output(v) for(auto it=v.begin();it!=v.end();it++){if(it!=v.begin())cout<<" ";cout<<*it;}cout<<endl;
#define vec_debug(v) for(auto it=v.begin();it!=v.end();it++){cerr<<*it<<" ";}cerr<<endl;
#define yn(ans) cout<<(ans?"Yes":"No")<<endl
#define YN(ans) cout<<(ans?"YES":"NO")<<endl
#define umap unordered_map
#define uset unordered_set
using namespace std;
using ll = long long;
template <typename T>T digitsum(T n);
template <typename T>bool isPrime(T n);
template <typename T>vector<pair<T, T>> prime_factor(T n);
long long int intpow(long long int,long long int);
template <typename T>T intlog(T);
long long int combination(long long int,long long int);
long long int arith_sum1(long long int,long long int,long long int);
long long int arith_sum2(long long int,long long int,long long int);
long long int series_sum(long long int);

int main(){
    int n,y;
    int k=0;
    cin>>n>>y;
    rep(i,2001){
        rep(j,2001){
            k=n-i-j;
            if(k>=0&&10000*i+5000*j+1000*k==y){
                printf("%d %d %d\n",i,j,k);
                return 0;
            }
        }
    }
    printf("-1 -1 -1\n");
}

Measured memory_bytes: 3764
import sys

p = 0
x1 = []
for line in sys.stdin:
    x = [int(i) for i in line.split()]
    if p == 0:
        r,c = x
        p = 1
    else:
        x1.append(x)

for i in range(r):
    x1[i].append(sum(x1[i]))
x=[]
for j in range(c+1):
    s = 0
    for i in range(r):
        s += x1[i][j]
    x.append(s)
x1.append(x)

for i in range(r+1):
    for j in range(c+1):
        print x1[i][j],
    print

Measured memory_bytes: 4332
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>

using namespace std;
#define int long long int
const int INF = 1001001001001001LL;
const int MOD = 1000000007;

int di[] = {-1, 0, 1, 0, -1, 1, 1, -1};
int dj[] = {0, 1, 0, -1, 1, 1, -1, -1};

signed main(){
    
    int n, k; cin >> n >> k;
    int num = (n - 1) * (n - 2) / 2;
    if(k > num){
        cout << -1 << endl;
        return 0;
    }
    int e = 0;
    vector<vector<int>> g(n, vector<int> (n, 0));
        for(int i = 1; i < n; i++){
            g[0][i] = 1;
            e++;
        }

        int add = num - k;
        for(int i = 1; i < n; i++){
            for(int j = i + 1; j < n; j++){
                if(add == 0){
                    i += n;
                    break;
                }

                g[i][j] = 1;
                e++;
                add--;
            }
        }

    cout << e << endl;
    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            if(g[i][j]) cout << i + 1 << " " << j + 1 << endl;
       }
    }

    return 0;
}


Measured memory_bytes: 384
package main

import "fmt"

func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

func isEven(n int) bool { return n%2 == 0 }

func main() {
	var a, b int
	fmt.Scan(&a, &b)

	countNega := 0
	if a < 0 && b < 0 {
		countNega = b - a + 1
	} else if a < 0 && b >= 0 {
		countNega = abs(a)
	}
	containZero := a <= 0 && 0 <= b

	if containZero {
		fmt.Println("Zero")
	} else if isEven(countNega) {
		fmt.Println("Positive")
	} else {
		fmt.Println("Negative")
	}
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF INT_MAX/3

ll n,q;
ll crt[101010];
bool used[101010];

int main(){
	cin>>n>>q;
  rep(i,n)crt[i]=i;
  used[0]=used[1]=true;
  ll crtpos=0;
  rep(i,q){
    ll a,b;
    cin>>a>>b;
    a--; b--;
    swap(crt[a],crt[b]);
    if(crt[a]==0)crtpos=a;
    if(crt[b]==0)crtpos=b;
    if(crtpos>0)used[crt[crtpos-1]]=true;
    if(crtpos<n-1)used[crt[crtpos+1]]=true;
  }
  ll res=0;
  rep(i,n)if(used[i])res++;
  cout<<res<<endl;
	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
  using namespace std;
#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define set0(k,n) for(int nn=0;nn<(n);nn++){ (k).push_back(0); }
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define vecsize(b,size) vector<int> (b)((size));
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsl(s) vector<pair<ll,ll>> (s);
#define pairss(s) vector<pair<string,string>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairspl(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsps(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsREV(s) (s).push_back(make_pair(bb,aa));
#define pairslREV(s) (s).push_back(make_pair(bb,aa));
#define pairssREV(s) (s).push_back(make_pair(bb,aa));
#define MOD 1000000007

int gcd(int x,int y){
	
	if(x%y==0){
		return y;
	}else{
		return gcd(y,x%y);
	}
	
}


int main() {
	
	int A,B,K;
	cin>>A>>B>>K;
	vec(X)
      int N=min(A,B)+1;
	fyg(N,1){
		if(A%y==0&&B%y==0){
			pb(X,y)
		}
	}
	
	sorts(X)
	reverses(X)
	ce(X.at(K-1))
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

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; }
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

int main(){
    ll n,m;
    cin>>n>>m;
    vector<ll> a(n);
    rep(i,n) cin>>a[i];
    sort(a.begin(),a.end());
    vector<pair<ll,ll>> cb(m);
    rep(i,m){
        ll b,c;
        cin>>b>>c;
        cb[i]=make_pair(c,b);
    }
    sort(cb.begin(),cb.end(),greater<pair<ll,ll>>());
    ll cur=0;
    rep(i,m){
        ll j=cb[i].second;
        while(j--){
            if(a[cur]>cb[i].first)break;
            if(cur>=n)break;
            a[cur]=cb[i].first;
            ++cur;
        }
    }
    ll ans=0;
    rep(i,n)ans+=a[i];
    cout<<ans<<endl;
}

Measured memory_bytes: 2560
d, goal = map(int, input().split())
pc = [0] + [list(map(int, input().split())) for _ in range(d)]

def solve(goal, d):
  if d == 0:
    return 10**9
  n = min(goal//(100*d), pc[d][0])
  t = n * d * 100
  if n == pc[d][0]:
    t += pc[d][1]
  if t < goal:
    n += solve(goal-t, d-1)
  return min(n, solve(goal,d-1))

print(solve(goal,d))


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

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;

using f32 = float;
using f64 = double;

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) for(i64 i = 1; i <= n; ++i)
#define RREP(i, n) for(i64 i = n - 1; i >= 0 ; --i)
#define RREPS(i, n) for(i64 i = n; i >= 1; --i)

#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define pb push_back
#define mp make_pair

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }

template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }


struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;


int main() {
    i64 N; cin >> N;
    vector<i64> A(N);
    REP(i, N) cin >> A[i];
    sort(A.begin(), A.end());

    i64 ans = 0;
    set<i64> se;
    for (i64 i = 0; i < N; i++) {
        bool ok = true;
        for (i64 j = 1; j * j <= A[i]; j++) {
            if (A[i] % j != 0) continue;
            if (se.count(j) > 0 || se.count(A[i] / j) > 0) {
                ok = false;
                break;
            }
        }
        if (i < N - 1 && A[i] == A[i + 1]) ok = false;
        if (ok) ans++;
        se.insert(A[i]);
    }
    cout << ans << endl;

    return 0;
}

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

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


int main() {
	int a, b,i=0,cnt=1;
	cin >> a >> b;
	if (b == 1)cout << 0 << endl;
	else {
		while (a + a * i - i < b) {
			i++;
			cnt++;
		}
		cout << cnt << endl;
	}
	return 0;
}


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

#define rep(i, N) for (int i = 0; i < N; i++)
#define pb push_back
typedef long long ll;
const int MOD = 1e9 + 7;
const int INF = INT_MAX / 2;

int main() {
	string s; cin >> s;
	string _s = s;
	reverse(_s.begin(), _s.end());
	cout << (s == _s ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>

typedef long long ll;
typedef long double ld;
#define FASTIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define PRECISION std::cout << std::fixed << std::setprecision(20);
  
using namespace std;
 
const ll inf = 1e18;
const ll N = 3e5;
const ll bits = 20;
const ld pi = 3.14159265358979323846;
const ll mod = 1e9+7;
const ll p = 29;


int main(){

    FASTIO;
    PRECISION; 

    string s;
    int n;
    set<string>st;

    cin>>n;

    while(n--){
        cin>>s;
        st.insert(s);
    }

    cout<<st.size()<<"\n";
}


Measured memory_bytes: 19088
while True:

    a, op, b = input().split()
    a = int(a)
    b = int(b)
    if op == "?":
        break
    elif op == "+":
        answer = a + b
    elif op =="-":
        answer = a - b
    elif op == "*":
        answer = a * b
    elif op == "/":
        answer = a // b
    print(answer)


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

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

int main()
{
    int A, B;
    cin >> A >> B;
    if(A == B){
        cout << A + B << endl;
    }else{
        cout << max(A, B) + max(A, B) - 1 << endl;
    }
}

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

int main() {
  int n;
  cin>>n;
  int a[100005],b[100005];
  rep(i,n) cin>>a[i];
  int l=100000,r=100001;
  b[l]=a[0];
  for (int i=1; i<n; i++) {
    int x=lower_bound(b+l,b+r,a[i])-b;
    if (x==l) l--;
    b[x-1]=a[i];
  }
  cout<<r-l<<endl;
  return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
using Graph = vector<vector<ll>>;
using P = pair<int,int>;
#define MOD 1000000007
#define INF 1000000
#define PI 3.14159265358979323846264338327950L
#define MAX_N 200010
#define lb lower_bound //[2,4)=lb(4)-lb(2);

/*
next_permutation
*/

int N;
int check(vector<int> P,vector<int> Q)
{
  for (int i=1;i<=N;i++)
  {
    if (P[i]==Q[i]) continue;
    if (P[i]<Q[i]) return (-1);
    if (P[i]>Q[i]) return (1);
  }
  return (0);
}

int main()
{
  cin>>N;
  vector<int> P(N+1),Q(N+1);
  for (int i=1;i<=N;i++)
    cin>>P[i];
  for (int i=1;i<=N;i++)
    cin>>Q[i];
  
  int count=0;
  
  if (check(P,Q)<0)
  {
    while (P!=Q)
    {
      next_permutation(P.begin(),P.end()); 
      count++;
    }
  }
  else
  {
     while (P!=Q)
    {
      next_permutation(Q.begin(),Q.end()); 
      count++;
    }
  }
  cout<<count<<endl;

}

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

using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
	REP(i, v.size()) { if (i)os << " "; os << v[i]; }return os;
}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
	REP(i, v.size()) { if (i)os << endl; os << v[i]; }return os;
}

const ll INF = 1LL << 60;
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

#define int long long

inline void my_io() {

	std::ios::sync_with_stdio(false);

	std::cin.tie(0);

	cout << fixed << setprecision(16);

	//cout << setprecision(10) << scientific << ans << endl;
}

signed main() {
	ll n, a, b;

	cin >> n;

	vector<pair<ll, ll>> v;

	REP(i, n) {
		cin >> a >> b;
		v.push_back(make_pair(b, a));
	}

	sort(v.begin(), v.end());

	ll now = 0;

	REP(i, n) {
		now += v[i].second;
		if (now > v[i].first) {
			cout << "No" << endl;
			return 0;
		}
	}

	cout << "Yes" << endl;
}

Measured memory_bytes: 6512
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
if sum(a)<sum(b):
    result = -1
else:
    count = 0
    over = [0]
    result = 0
    for i in range(n):
        if a[i]>b[i]:
            over.append(a[i]-b[i])
        elif a[i]<b[i]:
            count += b[i]-a[i]
            result += 1
    over.sort(reverse=True)
    i = 0
    while count > 0:
        result += 1
        count -= over[i]
        i += 1
print(result)

Measured memory_bytes: 19508
k = int(input())
list_ = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

print(list_[k-1])

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <limits>

#define rep(i,s,N) for(int i=s;i<N;i++)
using namespace std;
typedef long long int lli;

int main(void)
{
	int N; cin >> N;;
	lli maximum = 0;
	lli minimum = numeric_limits<lli>::max();
	rep(i, 0, N) {
		lli tmp; cin >> tmp;
		maximum = max(maximum, tmp);
		minimum = min(minimum, tmp);
	}

	lli ans = maximum - minimum;
	cout << ans << endl;

	return 0;
}

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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int x, y, z;
  cin >> x >> y >> z;
  set<int> s;
  s.insert(x);
  s.insert(y);
  s.insert(z);
  if ((int)s.size() == 2) {
    cout << "Yes\n";
  } else {
    cout << "No\n";
  }
  return 0;
}

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

int main() {
  int A, B, C, X, Y;
  cin >> A >> B >> C >> X >> Y;
  int ans{};
  if (A + B > C * 2) {
    int Z = min(X, Y);
    ans += C * Z * 2;
    X -= Z;
    Y -= Z;
  }
  if (X > 0) {
    if (A > C * 2) {
      ans += C * X * 2;
      Y -= X;
    } else {
      ans += A * X;
    }
  }
  if (Y > 0) {
    if (B > C * 2) {
      ans += C * Y * 2;
    } else {
      ans += B * Y;
    }
  }

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


Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n, m, a;
	cin>>n>>m;
	priority_queue<long long> q;
	for(int i = 0; i < n; ++i){
		cin>>a;
		q.push(a);
	}
	for(int i = 0; i < m; ++i){
		long long t = q.top();
		q.pop();
		t /= 2;
		q.push(t);
	}
	long long sum = 0;
	while(!q.empty()){
		long long t = q.top();
		q.pop();
		sum += t;
	}
	cout<<sum<<endl;	
	return 0;
}


Measured memory_bytes: 1400
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{
    ll N, M;
    cin >> N >> M;
    cout << (N == 1 or M == 1 ? N * M == 1 ? 1 : N * M - 2 : (N - 2) * (M - 2)) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
#define print(n) cout << n << endl
#define in(v) int v; cin >> v
#define vint vector<int>
#define pb push_back
typedef long long int ll;

int main(){
  int a,b,c,k;
  cin>>a>>b>>c>>k;
  if(k<=a){
    print(k);
    return 0;
  }else if(k<=a+b){
    print(a);
    return 0;
  }else{
    print(a-(k-a-b));
  }
  return 0;
}

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

int w, h;
string c;

int main(){
	cin >> w >> h >> c;
	for(int i=1;i<=h;i++){
		if(i==1||i==h){
			for(int j=1;j<=w;j++){
				if(j==1||j==w) cout << "+";
				else cout << "-";
			}
		}else{
			for(int j=1;j<=w;j++){
				if(j==1||j==w) cout << "|";
				else if(i*2-1==h&&j*2-1==w) cout << c;
				else cout << ".";
			}
		}
		cout << endl;
	}
	return 0;
}


Measured memory_bytes: 3164
#pragma GCC optimize "03"
#include <bits/stdc++.h>
using namespace std;
 
#define int long long int
#define ld long double
#define pi pair<int, int>
#define pb push_back
#define fi first
#define se second
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#ifndef LOCAL
#define endl '\n'
#endif

const int N = 1e5 + 5;
const int mod = 1e9 + 7;
const int inf = 1e9 + 9;

int dp[64][2][2][2];

signed main() {
	#ifdef LOCAL
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif
	IOS;
	int l, r;
	cin >> l >> r;
	dp[61][1][1][0] = 1;
	for(int i = 61; i >= 1; i--){
		for(int x = 0; x < 2; x++){
			for(int y = 0; y < 2; y++){
				for(int a = 0; a < 2; a++){
					if(dp[i][x][y][a] == 0)	continue;
					bool l1 = (l & (1LL << (i-1))), r1 = (r & (1LL << (i-1)));
					// cout << i << " " << x << " " << y << " " << a << " " << dp[i][x][y][a] << endl;
					for(int j = 0; j < 2; j++){
						for(int k = 0; k < 2; k++){
							if(j > k)	continue;
							if(x && j < l1)	continue;
							if(y && k > r1)	continue;
							if(!a && j != k)	continue;	
							bool xx = x & (j == l1);
							bool yy = y & (k == r1);
							bool aa = a | j;
							dp[i-1][xx][yy][aa] += dp[i][x][y][a];
							dp[i-1][xx][yy][aa] %= mod;
						}
					}
				}
			}
		}
	}
	int ans = 0;
	for(int i = 0; i < 2; i++)
		for(int j = 0; j < 2; j++)
			ans = (ans + dp[0][i][j][1]) % mod;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import Foundation

func readInts() -> [Int]{
    return readLine()!.split(separator: " ").map { Int($0)! }
}
func readInt() -> Int {
    return Int(readLine()!)!
}

func main() {
    let aryK = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
    
    print(aryK[readInt()-1])
}
main()


Measured memory_bytes: 13024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
const ll INF = 1e16;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}
//--------------------------------------------------------------------------------//
ll A[105][105], B[105][105], ans[105][105];
int main() {
    init();
    ll N, M, L;
    cin >> N >> M >> L;
    rep(i, N) rep(j, M) cin >> A[i][j];
    rep(i, M) rep(j, L) cin >> B[i][j];

    rep(i, N) rep(k, L) rep(j, M) ans[i][k] += A[i][j] * B[j][k];

    rep(i,N){
        rep(j,L){
            cout << ans[i][j];
            if (j < L - 1) cout << " ";
        }
        cout << endl;
    }
}


Measured memory_bytes: 3416
#include <cstring>
#include<cstdio>
#include<algorithm>
#include<cmath>
using namespace std;
int c(int n,int m)
{
    m=min(m,n-m);
    int i,ans=1;
    for(i=0;i<m;i++)
        ans*=n-i;
    for(i=0;i<m;i++)
        ans/=i+1;
    return ans;
}
int a[100005];
int main()
{
    int i,j,n,m,ans;
    double mi;
    scanf("%d",&n);
    for(i=0;i<n;i++)
        scanf("%d",&a[i]);
    sort(a,a+n);
    mi=1e9+1;
    for(i=0;i<n;i++)
    {
        if(fabs(a[n-1]/2.0-a[i])<mi)
            {mi=abs(a[n-1]/2-a[i]);ans=a[i];}
    }
    printf("%d %d",a[n-1],ans);
    return 0;
}


Measured memory_bytes: 512
#include <stdio.h>

int main(void){
    
    int i;
    char ch;
    
    for(i = 0; i<3; i++){
    ch = getchar();
        if(ch == '7'){
            printf("Yes\n");
            return 0;
        }
    }

    printf("No\n");

    return 0;

}

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

class Program
{
    static void Main(string[] args)
    {
        var X = sc.ReadLong();
        var Y = sc.ReadLong();
        long ans = 0;
        if (X < Y)
        {
            ans = Math.Abs(Math.Abs(Y) - Math.Abs(X));
            if (X * Y < -1) ans++;
        }
        else
        {
            ans = Math.Abs(Math.Abs(Y) - Math.Abs(X)) + 1;
            if (X * Y > 0) ans++;
        }
        Console.WriteLine(ans);
    }
    static Scanner sc = new Scanner();
}

class Scanner
{
    string[] S = new string[0];
    int Index = 0;
    char[] Separators = new char[] { ' ' };

    public string Next()
    {
        if (this.Index < this.S.Length) return this.S[this.Index++];
        var line = "";
        while (line == "") line = Console.ReadLine();
        this.S = line.Split(this.Separators, StringSplitOptions.RemoveEmptyEntries);
        if (this.S.Length == 0) return this.Next();
        this.Index = 0;
        return this.S[this.Index++];
    }
    public string ReadStr()
    {
        return this.Next();
    }
    public char ReadChar()
    {
        return this.Next()[0];
    }
    public int ReadInt()
    {
        return int.Parse(this.Next());
    }
    public uint ReadUInt()
    {
        return uint.Parse(this.Next());
    }
    public long ReadLong()
    {
        return long.Parse(this.Next());
    }
    public double ReadDouble()
    {
        return double.Parse(this.Next());
    }
    public int[] ReadIntArray(int n)
    {
        var array = new int[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadInt();
        }
        return array;
    }
    public long[] ReadLongArray(int n)
    {
        var array = new long[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadLong();
        }
        return array;
    }
    public double[] ReadDoubleArray(int n)
    {
        var array = new double[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadDouble();
        }
        return array;
    }
    public char[] ReadCharArray(int n)
    {
        var array = new char[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadChar();
        }
        return array;
    }
    public string[] ReadStrArray(int n)
    {
        var array = new string[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadStr();
        }
        return array;
    }
}


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

long long n,a,m,k,q,b,c=1;
float qq,ww,ff=2,qs;
string ss,s1,s2;
int main(){
    cin>>a>>b;
    if (a<6){
        cout<<0;
    }
    else if (a<13){
        cout<<b/2;
    }
    else{
        cout<<b;
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <unordered_map> //C++11
using namespace std;

typedef long long ll;

int main() {
	int n;
	string s[50];
	unordered_map<string, int> mp[50];
	string alp = "abcdefghijklmnopqrstuvwxyz";
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> s[i];
		for (int j = 0; j < alp.length(); j++) mp[i][alp.substr(j, 1)] = 0;
		for (int j = 0; j < s[i].length(); j++) {
			mp[i][s[i].substr(j, 1)] += 1;
		}
	}
	for (int i = 0; i < alp.length(); i++) {
		int min = 10000;
		for (int j = 0; j < n; j++) {
			if (mp[j][alp.substr(i, 1)] < min) min = mp[j][alp.substr(i, 1)];
		}
		for (int j = 0; j < min; j++) cout << alp.at(i);
	}
	cout << endl;
	return 0;
}


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

int main(){
    int l , r;
    cin >> l >> r;
    if (r - l >= 2019) {
        cout << 0 << endl;
        return 0;
    }
    int ans = 2019;
    bool hantei = false;
    for (int i = l; i < r; ++i) {
        for (int j = i+1; j < r + 1; ++j) {
            int a = i % 2019;
            int b = j % 2019;
            ans = min(ans, a * b % 2019);
            if (ans == 0) {
                hantei = true;
                break;
            }
        }
        if (hantei) break;
    }
    cout << ans << endl;
}


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

using namespace std;

int main() {

	string s;
	cin >> s;
	string ans;

	for (int i = 0; i < s.size(); i++) {
		if (s[i] == '0') {
			ans.push_back('0');
		}
		else if (s[i] == '1') {
			ans.push_back('1');
		}
		else {
			if (ans.size() != 0) {
				ans.pop_back();
			}
		}
	}
	cout << ans << endl;
}

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

namespace DP
{
    using static Ex;
    public class Solve
    {
        public static void Main(string[] args)
        {
            new DP_C();
        }
    }
    public class DP_C
    {
        public DP_C()
        {
            var n = ReadInt;

            var arr = new int[n][];
            for (int i = 0; i < n; i++)
            {
                arr[i] = ReadIntArray();
            }
            var dp = new long[n, 3];
            for (int j = 0; j < 3; j++)
            {
                dp[0, j] = arr[0][j];
            }

            for (int i = 1; i < n; i++)
            {
                for (int j = 0; j < 3; j++)
                {
                    for (int k = 0; k < 3; k++)
                    {
                        if (j != k) dp[i, j] = Math.Max(dp[i, j], dp[i - 1, k] + arr[i][j]);
                    }
                }
            }
            long ans = 0;
            for (int k = 0; k < 3; k++)
            {
                ans = Math.Max(ans, dp[n - 1, k]);
            }
            ans.Cw();
        }
    }

    public static class Ex
    {
        public static void Cw(this object s) { Console.WriteLine(s); }



        public static bool Mins<T>(ref T a, T b) where T : IComparable<T> { if (a.CompareTo(b) > 0) { a = b; return true; } return false; }
        public static bool Maxs<T>(ref T a, T b) where T : IComparable<T> { if (a.CompareTo(b) < 0) { a = b; return true; } return false; }
        public static void Swap<T>(ref T a, ref T b) { var t = b; b = a; a = t; }
        public static void Swap<T>(List<T> list, int i, int j) { T tmp = list[j]; list[j] = list[i]; list[i] = tmp; }


        static long Gcd(long m, long n) { if (n == 0) return m; return Gcd(n, m % n); }
        public static List<string> FastSort(this List<string> s) { s.Sort(StringComparer.Ordinal); return s.ToList(); }
        public static void yesno(this bool b) { (b ? "yes" : "no").Cw(); }
        public static void YesNo(this bool b) { (b ? "Yes" : "No").Cw(); }
        public static void YESNO(this bool b) { (b ? "YES" : "NO").Cw(); }

        public static string Read { get { return Console.ReadLine().Trim(); } }
        public static int ReadInt { get { return int.Parse(Read); } }
        public static long ReadLong { get { return long.Parse(Read); } }
        public static double ReadDouble { get { return double.Parse(Read); } }
        public static string[] ReadArray() { return Read.Split(' '); }
        public static int[] ReadIntArray() { return Read.Split(' ').Select(int.Parse).ToArray(); }
        public static long[] ReadLongArray() { return Read.Split(' ').Select(long.Parse).ToArray(); }
        public static string[] ReadArray(long N) { var v = new string[N]; for (long i = 0; i < N; ++i) v[i] = Read; return v; }
        public static int[] ReadIntArray(long N) { var v = new int[N]; for (long i = 0; i < N; ++i) v[i] = ReadInt; return v; }
        public static long[] ReadLongArray(long N) { var v = new long[N]; for (long i = 0; i < N; ++i) v[i] = ReadLong; return v; }

    }
}

Measured memory_bytes: 26804
#include <bits/stdc++.h>                                                                              
using namespace std;                                                                                  
using ll = long long;                                                                                 
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }               
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }               
                                                                                                      
int main() {                                                                                          
  int n;                                                                                              
  cin >> n;                                                                                           
  vector<int> a(n);                                                                                   
  int joushi;                                                                                         
  for (int i=0; i<n-1; i++) {                                                                         
    cin >> joushi;                                                                                    
    a[joushi-1]++;                                                                                    
  }                                                                                                   
  for (int i=0; i<n; i++) {                                                                           
    cout << a[i] << endl;                                                                             
  }                                                                                                   
                                                                                                      
  return 0;                                                                                           
} 

Measured memory_bytes: 4052
#include<stdio.h>
int main(void) {
	int a;
	int b;
	scanf("%d %d", &a,&b);
	if ((b + a) % 2 == 0) {
		printf("%d", (b + a) / 2);
	}
	else {
		printf("IMPOSSIBLE");
	}
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
char a[105][105];
int n,m,i,j,k,ans[105][105];
int main()
{
	cin>>n>>m;
	for (i=1;i<=100;i++)
	{
		for (j=1;j<=100;j++)
		{
			a[i][j]='.';
		}
	}
	for (i=1;i<=n;i++)
	{
		for (j=1;j<=m;j++)
		{
			cin>>a[i][j];
		}
	}
	for (i=1;i<=n;i++)
	{
		for (j=1;j<=m;j++)
		{
			if (a[i+1][j]=='#') ans[i][j]++;
			if (a[i-1][j]=='#') ans[i][j]++;
			if (a[i][j+1]=='#') ans[i][j]++;
			if (a[i][j-1]=='#') ans[i][j]++;
			if (a[i+1][j+1]=='#') ans[i][j]++;
			if (a[i-1][j-1]=='#') ans[i][j]++;
			if (a[i+1][j-1]=='#') ans[i][j]++;
			if (a[i-1][j+1]=='#') ans[i][j]++;
		}
	}
	for (i=1;i<=n;i++)
	{
		for (j=1;j<=m-1;j++)
		{
			if (a[i][j]=='#') cout<<"#";
			else cout<<ans[i][j];
		}
			if (a[i][j]=='#') cout<<"#"<<endl;
		    else cout<<ans[i][j]<<endl;
	}
return 0;
}




Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<climits>
#include<iostream>
#include<sstream>
#include<utility>
#include<map>
#include<vector>
#include<queue>
#include<algorithm>
#include<set>
#include<stack>
#include<functional>
using namespace std;
typedef long long ll;
typedef pair<int,int>P;
const ll MOD=1e9+7;


ll sum(ll f,ll t)
{
	ll res=0;
	return ((f+t)*(t-f+1))/2;
	return res;
}

int main()
{
	ll N,K;
	cin>>N>>K;
	//K~N
	ll bscnt=0;
	for(ll i=K-1;i<=N;i++){
		ll mm=sum(1,i);
		ll mx=sum(N-(i),N);
		bscnt=(bscnt+(mx-mm+1))%MOD;
	}
	cout<<bscnt<<endl;
}

Measured memory_bytes: 3564
#include <bits/stdc++.h>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long int;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF = 1e9;
const ll MOD = 1000000007;
typedef pair<ll,ll> P;
double dp[301][301][301];
bool flag[301][301][301] = {0};
int n;
double sushi(int a,int b,int c){
    if (flag[a][b][c]) return dp[a][b][c];
    if (a+b+c == 0) return 0;
    flag[a][b][c] = 1;
    double res = 1/(1-(double)(n-a-b-c)/n);
    if (a > 0) res += sushi(a-1,b,c)*((double)a/n)/(1-(double)(n-a-b-c)/n);
    if (b > 0) res += sushi(a+1,b-1,c)*((double)b/n)/(1-(double)(n-a-b-c)/n);
    if (c > 0) res += sushi(a,b+1,c-1)*((double)c/n)/(1-(double)(n-a-b-c)/n);
    return dp[a][b][c] = res;
}
int main(){
    cin >> n;
    int c[3] = {0},a;
    rep(i,n){
        cin >> a;
        c[a-1]++;
    }
    printf("%0.10f",sushi(c[0],c[1],c[2]));
}

Measured memory_bytes: 239872
s = list(map(int, list(input())))

a = [abs(s[i]-1) if i%2==0 else s[i] for i in range(len(s))]
b = [abs(s[i]-1) if i%2==1 else s[i] for i in range(len(s))]
print(min(sum(a),sum(b)))


Measured memory_bytes: 5404
use std::io::prelude::*;
use std::io::stdin;
use std::str::FromStr;

fn main() {
    let n: usize = read();
    let a: Vec<i64> = (0..n).map(|_| read()).collect();
    println!(
        "{}",
        a.iter()
            .map(|&x| {
                let mut count = 0;
                let mut x = x;
                while x % 2 == 0 {
                    x /= 2;
                    count += 1;
                }
                count
            })
            .sum::<i64>()
    )
}

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


Measured memory_bytes: 4352
#include <iostream>
#include <string>
#include <vector>
using namespace std;

struct TNode
{
	int Id;
	TNode* Parent;
	TNode* NextSibling;
	TNode* FirstChild;
};

enum TNodeType {Root, InternalNode, Leaf};

void Create(int Id, vector<TNode*>& Nodes)
{
	TNode* Node = new TNode;
	*Node = {Id, NULL, NULL, NULL};
	Nodes[Id] = Node;
}

void CreateRelationParent(TNode* &ParentNode, TNode* &ChildNode)
{
	ParentNode->FirstChild = ChildNode;
	ChildNode->Parent = ParentNode;
}

void CreateRelationLastChild(TNode* &CurrentLastChild, TNode* &ChildNode)
{
	CurrentLastChild->NextSibling = ChildNode;
	ChildNode->Parent = CurrentLastChild->Parent;
}

vector<TNode*> Input()
{
	int n;
	cin >> n;
	vector<TNode*> Nodes(n, NULL);
	for(int i = 0; i < n; i++){
		int Id;
		cin >> Id;
		if(Nodes[Id] == NULL){
			Create(Id, Nodes);
		}
		int ChildCount;
		cin >> ChildCount;
		TNode* CurrentLastChild;
		for(int j = 0; j < ChildCount; j++){
			int ChildId;
			cin >> ChildId;
			if(Nodes[ChildId] == NULL){
				Create(ChildId, Nodes);
			}
			if(Nodes[Id]->FirstChild == NULL){
				CreateRelationParent(Nodes[Id], Nodes[ChildId]);
			}else{
				CreateRelationLastChild(CurrentLastChild, Nodes[ChildId]);
			}
			CurrentLastChild = Nodes[ChildId];
		}
	}
	return Nodes;
}

int GetDepth(TNode* Node)
{
    int depth = 0;
    while(Node->Parent){
        depth++;
        Node = Node->Parent;
    }
    return depth;
}

TNodeType GetType(TNode* Node)
{
    if(Node->Parent == NULL){
        return Root;
    }else if(Node->FirstChild == NULL){
        return Leaf;
    }else{
        return InternalNode;
    }
}

void OutputChildren(TNode* Node)
{
    if(Node->FirstChild == NULL){
        return;
    }
    Node = Node->FirstChild;
    cout << Node->Id; 
    while(Node->NextSibling){
        Node = Node->NextSibling;
        cout << ", " << Node->Id;
    }
}

void Output(const vector<TNode*>& Nodes)
{
	for(unsigned int i = 0; i < Nodes.size(); i++){
		cout << "node " << Nodes[i]->Id << ": ";
		if(Nodes[i]->Parent){
		    cout << "parent = " << Nodes[i]->Parent->Id << ", ";
		}else{
		    cout << "parent = -1, ";
		}
		cout << "depth = " << GetDepth(Nodes[i]) << ", ";
		if(GetType(Nodes[i]) == Root){
		    cout << "root, "; 
		}else if(GetType(Nodes[i]) == InternalNode){
		    cout << "internal node, ";    
		}else{
		    cout << "leaf, ";
		}
		cout << "[";
		OutputChildren(Nodes[i]);
		cout << "]" << endl;
	}
}

int main()
{
	vector<TNode*> Nodes = Input();
	Output(Nodes);
    return 0;
}

Measured memory_bytes: 8304
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        String S =sc.next();
        for(int i=0;i<S.length();i++){
            char a = (char)(((S.charAt(i) - 'A') + N)%26 + 'A');   
            System.out.print(a);
        }
        System.out.println();
    }
}


Measured memory_bytes: 27376