akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
// #define int long long

template <class T>
bool INRANGE(T x, T a, T b) { return a <= x && x <= b; }
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return true;
    }
    return false;
}
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define RREP(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define RFOR(i, a, b) for (int i = (a); i >= (b); --i)
#define ALL(v) (v).begin(), (v).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
                      << " " << __FILE__ << endl;

typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vi> vvi;
typedef pair<int, int> pii;

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

    int N;
    string s;
    cin >> N >> s;

    vi r(N, 0), g(N, 0), b(N, 0);

    REP(i, N) {
        if (s[i] == 'R') r[i] += r[max(0, i-1)] + 1;
        else r[i] += r[max(0, i-1)];
        if (s[i] == 'B') b[i] += b[max(0, i-1)] + 1;
        else b[i] += b[max(0, i-1)];
        if (s[i] == 'G') g[i] += g[max(0, i-1)] + 1;
        else g[i] += g[max(0, i-1)];
    }

    ll ans = 0;
    REP(i, N) REP(j, N) {
        if (i == j or s[i] == s[j] or !(i<j)) continue;

        //cout << "i: " << i << " j: " << j << " ans=" << ans;

        if ((s[i] == 'R' and s[j] == 'B') or (s[i] == 'B' and s[j] == 'R')) { // G
            ans += g[N-1] - g[j];
            int k = j+abs(i-j);

            if (INRANGE(k, j+1, N-1)) {
                if (s[k] == 'G') ans --;
            }
        } else if ((s[i] == 'G' and s[j] == 'R') or (s[i] == 'R' and s[j] == 'G')) { // B
            ans += b[N-1] - b[j];
            int k = j+abs(i-j);
            //cout << " (k=" << k << ")";
            if (INRANGE(k, j+1, N-1)) {
                if (s[k] == 'B') ans --;
            }
        } else { // R
            ans += r[N-1] - r[j];
            int k = j+abs(i-j);
            if (INRANGE(k, j+1, N-1)) {
                if (s[k] == 'R') ans --;
            }
        }

        //cout << " -> " << ans << endl;
    } 

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


Measured memory_bytes: 3664
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
using P = pair<ll, ll>;
const ll MOD = 1000000007;

int main(){
    ll A, B, C, K;
    cin >> A >> B >> C >> K;
    cout << ((K % 2 == 0) ? A - B : B - A) << endl;
    return 0;
}

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

#define INF INT_MAX
#define UINF UINT_MAX
#define MOD 1000000007
#define REP(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()

typedef long long ll;
typedef std::pair<int,int> pii;

using namespace std;

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

    ll n,k;
    cin >> n >> k;
    vector<ll> h(n);
    REP(i,n)cin >> h[i];

    sort(all(h));

    ll ans = 0;

    for(int i = n-1 - k;i >= 0;i--){
        ans += h[i];
    }

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

Measured memory_bytes: 1792
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <bitset>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
#include <chrono>
#include <random>
#include <tuple>
#include <utility>
#include <fstream>
#include <complex>

const long INF = (1l << 30);
const long LINF = (1l << 60);

long a, b;

int main(){
    scanf("%ld%ld", &a, &b);
    printf("%ld\n", std::max(0l, a-2*b));
}


Measured memory_bytes: 256
a, b, c = map(int,input().split())
k = int(input())
 
for i in range(k):
  if b <= a:
    b *= 2
  elif c <= b:
    c *= 2
  else:
    break
    
if a >= b or b >= c:
  print('No')
else:
  print('Yes')

Measured memory_bytes: 9140
""" AtCoder """

N = int(input())
A = list(map(int, input().split()))

if N ==1:
    print(0)
    exit()

for i in range(N):
    A[i] -= i + 1

A.sort()

b = A[N//2]

ans = 0

for a in A:
    ans += abs(a - b)

print(ans)


Measured memory_bytes: 26832
import math

N = int(input())
A = list(map(int,input().split()))

for i in range(N):
    A[i] -= (i+1)

A.sort()

if N % 2 == 0:
    b = (A[N//2-1] + A[N//2]) / 2
    bfl = math.floor(b)
    bce = math.ceil(b)
    ansfl = 0
    ansce = 0

    for i in range(N):
        ansfl += abs(A[i] - bfl)
        ansce += abs(A[i] - bce)

    ans = min(ansfl, ansce)

else:
    ans = 0
    b = A[N//2]

    for i in range(N):
        ans += abs(A[i] - b)

print(ans)

Measured memory_bytes: 31900
j;M;m;main(N,q){int c[9]={};
for(scanf("%d",&N);N--;q<8?c[q]=1:M++)scanf("%d",&q),q/=400;
for(j=8;j--;m+=c[j])M+=c[j];
m?:m++;printf("%d %d",m,M);}

Measured memory_bytes: 1724
import java.util.Arrays;
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
		}
		Arrays.sort(a);
		int k = 0;
		int count = 0;
		int ans = 0;
		int f = a[a.length-1];
		for (int i = 0; i < n-1; i++) {
			if (a[i] == f) {
				k++;
			}
			if (a[i] == a[i+1]) {
				count++;
			} else {
				if (count % 2 == 0) {
					ans++;
				}
				count = 0;
			}
		}
		if (k % 2 == 0) {
			ans++;
		}
		System.out.println(ans);
	}
}

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

using namespace std;

const double PI = 3.14159265358979323846;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
//typedef pair<ll, ll> P;
typedef pair<double, double> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

double equal(double a, double b) {
    return fabs(a - b) < DBL_EPSILON;
}

std::istream &operator>>(std::istream &in, set<string> &o) {
    string a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
//const ll mod = 1e10;

typedef priority_queue<ll, vector<ll>, greater<ll> > PQ_ASK;


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

    if ((a - b) % 2 == 0) {
        cout << "Alice" << endl;
    } else {
        cout << "Borys" << endl;
    }
}


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

using namespace std;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;

void ABC126D()
{
	int N;
	cin >> N;
	vector<vector<set<int> > > graph(N);
	for (int i = 0; i < N-1; ++i)
	{
		int u, v, w;
		cin >> u >> v >> w;
		--u; --v;
		if (graph[u].empty())
			graph[u].resize(2);
		graph[u][w % 2].insert(v);
		if (graph[v].empty())
			graph[v].resize(2);
		graph[v][w % 2].insert(u);
	}

	vector<int> colour(N, -1);
	queue<pair<int, int> > qu;
	qu.push({ 0,0 });
	vector<int> checked(N);
	while (!qu.empty())
	{
		auto x = qu.front(); qu.pop();
		colour[x.first] = x.second;
		checked[x.first] = 1;
		for (auto& y : graph[x.first][0])
		{
			if (checked[y])
				continue;
			int dist = x.second == 0 ? 0 : 1;
			qu.push({ y, dist });
		}
		for (auto& y : graph[x.first][1])
		{
			if (checked[y])
				continue;
			int dist = x.second == 0 ? 1 : 0;
			qu.push({ y, dist });
		}
	}
	for (int i = 0; i < N; ++i)
	{
		cout << colour[i] << endl;
	}

}

int main()
{
	ABC126D();
	return 0;
}



Measured memory_bytes: 23936
/*
    author: Salam_35
    problem name:
*/

#include <bits/stdc++.h>
using namespace std;

#define ll long long int
#define pb push_back
#define sc(n) scanf("%d",&n)
#define Max 100005
#define scan(n) scanf("%lld",&n)
#define pi acos(-1.0)
#define _fastio  ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ALL(x) x.begin(),x.end()
#define sci(n) scanf("%d",&n);
#define scl(n) scanf("%lld",&n);
#define load(array,size)  for(ll i=0 ; i<size ; i++) cin>>array[i] ;
#define load1(array,size)  for(ll i=1 ; i<=size ; i++) cin>>array[i] ;
#define INF	1LL<<19
#define pll pair<ll,ll>
#define mst(arr,value) memset(arr,value,sizeof(arr));
ll mod= 1e9+7;

typedef vector<ll>vec;
typedef pair<ll,ll> pii;
typedef map<ll,ll>mpll;
typedef set<ll>seet;
vec primes;


int main()
{
    ll n;
    cin>> n;
    mpll mp;
    for(ll i=0;i<n;i++)
    {
        ll a;
        cin >> a;
        for(ll j=0;j<62;j++)
        {
            if(a&(1ll<<j))mp[j]++;
        }
    }
    ll ans=0;
    for(ll i=0;i<62;i++)
    {
        ans=(ans+((mp[i]*(n-mp[i]))%mod*((1ll<<i)%mod)%mod)%mod)%mod;
    }

    cout<<ans<<endl;

    return 0;
}



Measured memory_bytes: 256
import sys
import math

def main():
    N = int(input())
    xy=[]
    for _ in range(N):
        xy.append(list(map(int,input().split())))

    sqs=[]
    for i in range(0,len(xy)):
        for j in range(i+1,len(xy)):
            sqs.append(math.sqrt((xy[i][0]-xy[j][0])**2 + (xy[i][1]-xy[j][1])**2))

    print(sum(sqs) * 2 / N)

main()

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define all(v) (v).begin(), (v).end()
#define pb push_back
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template<class T>using numr=std::numeric_limits<T>;
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 int INF = 1e9;
const ll LLINF = 1e16;
const int MOD = 1000000007;
const int MOD2 = 998244353;

int main() {
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    int n;
    cin >> n;
    map<string, int> st;
    int res = 0;
    while(n--){
        string s;
        cin >> s;
        st[s]++;
        chmax(res, st[s]);
    }
    for(auto &p : st){
        if(p.second == res) cout << p.first << endl;
    }

}

Measured memory_bytes: 19252
#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 ll long long
#define lld long double
#define ALL(x) x.begin(), x.end()
using namespace std;

vector<lld> dp1(151010, 0);
vector<lld> dp2(151010, 0);

vector<int> childnum(151010, 0);
vector<int> parvec(151010, 0);
map<int, vector<int>> g;

void dfs1(int cur, int par)
{
    parvec[cur] = par;
    lld ret = 0;
    for (auto x : g[cur])
    {
        if (x != par)
        {
            dfs1(x, cur);
            ret += 1 + dp1[x];
            childnum[cur]++;
        }
    }
    if (childnum[cur] != 0)
    {
        dp1[cur] = ret / (lld)childnum[cur];
    }
    else
    {
        dp1[cur] = 0;
    }
}

void dfs2(int cur, int par)
{
    if (par == -1)
    {
        dp2[cur] = dp1[cur];
    }
    else
    {

        int pnum = g[par].size();
        lld parexp;
        if (pnum == 1)
        {
            parexp = (dp1[par] * (childnum[par]) - dp1[cur]) / ((childnum[par]));
        }
        else
        {
            parexp = 1 + (dp1[par] * (g[par].size()) - dp1[cur] - 1) / (pnum - 1);
        }
        //cerr << cur << " " << par << " " << parexp << " " << pnum << endl;
        dp1[cur] = (dp1[cur] * childnum[cur] + (parexp)) / (lld)(childnum[cur] + 1);
        //cerr << dp1[cur] << endl;
    }
    for (auto x : g[cur])
    {
        if (x != par)
            dfs2(x, cur);
    }
}

int main()
{
    int n;
    cin >> n;
    rep(i, n - 1)
    {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    dfs1(0, -1);

    /* rep(i, n)
    {
        cerr << fixed << setprecision(18) << dp1[i] << endl;
    }
    cerr << endl;
    */
    dfs2(0, -1);

    rep(i, n)
    {
        cout << fixed << setprecision(18) << dp1[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 33792
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<n; ++i)
#define rep1(i, n) for (int i=1; i<=n; ++i)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
constexpr ll  MOD = (1e9+7);
constexpr int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
constexpr int lcm(int a, int b) { return a / gcd(a, b) * b; }

template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
ll factorial(ll n, ll m=2) {
    // calculate n!
    m = max(2LL, m);
    ll rtn = 1;
    for (ll i=m; i<=n; i++) {
        rtn = (rtn * i) % MOD;
    }
    return rtn;
}
ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b;
        swap(a, b);
        u -= t * v;
        swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
ll modpow(ll a, ll n) {
    ll res = 1;
    while (n > 0) {
        if (n & 1)
            res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    string a, b; cin >> a >> b;
    if (a.size() > b.size()) {
        cout << "GREATER" << endl;
    } else if (a.size() < b.size()) {
        cout << "LESS" << endl;
    } else {
        rep(i, a.size()) {
            if (a[i] > b[i]) {puts("GREATER"); return 0;}
            else if (a[i] < b[i]) {puts("LESS"); return 0;}
        }
        puts("EQUAL");
    }
    return 0;
}

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

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

int main(){
    string s;
    cin >> s;
    int len = (int)s.size();
    int val = 0;
    rep(i, len){
        val += (s[i] - '0');
    }
    if(val % 9 == 0) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3644
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
#include<list>
#include<set>
#include<cstring>
using namespace std;
long long int mod = 1e9 + 7;
template <class T>
void inputV(vector<T> &x, int n){
  for(int i=0; i<n; i++) cin >> x[i];
}
int gcd(int a, int b){
  if( a == 0 || b == 0 ) return 0;
  int c;
  while( a != 0 ){
    c = a; a = b%a; b = c;
  }
  return b;
}
int main() {

  int n, p;
  cin >> n >> p;
  vector<int> x(n);
  vector<int> y(n);
  for(int i=0; i<n; i++){
    cin >> x[i];
    y[i] = abs(x[i]-p);
  }

  int ans = y[0];
  for(int i=1; i<n; i++){
    ans = gcd(ans, y[i]);
  }
  cout << ans << endl;

  return 0;
}



//


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0;i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
typedef vector<int> V;
typedef pair<int,int> P;
typedef vector<vector<int>> Graph;


const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

mint powg(mint a,ll b){
    if (b==0) return 1;
    else if (b==1) return a;
    else if (b%2==0) return powg(a*a,b/2);
    else return a*powg(a*a,(b-1)/2);
}

int main() {
    ll n;
    cin >> n;
    vector<map<ll,ll>> keta(60);
    rep(i,n){
        ll a;
        cin >> a;
        rep(j,60){
            if(a&(1LL<<j)) keta[j][1]++;
            else keta[j][0]++;
        }
    }
    mint ans = 0;
    rep(i,60){
        ans += powg(2,i)*keta[i][1]*keta[i][0];
    }
    cout << ans << endl;
}

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

public class Main implements Runnable {

    private void solve() throws IOException {

        int N = nextInt();
        ArrayList<Double> ar = new ArrayList<>();
        for(int i = 0; i < N; ++i) {
            ar.add(nextDouble());
        }
        Collections.sort(ar);

        while(ar.size() > 1) {
            double first = ar.get(0);
            double second = ar.get(1);
            ar.remove(0);
            ar.remove(0);
            ar.add((first+second)/2.0);
            Collections.sort(ar);
        }
        writer.println(ar.get(0));
    }

    public static void main(String[] args) {

        new Main().run();
    }

    BufferedReader reader;
    StringTokenizer tokenizer;
    PrintWriter writer;

    public void run() {
        try {
            reader = new BufferedReader(new InputStreamReader(System.in));
//            reader = new BufferedReader(new FileReader("a_1.txt"));
            tokenizer = null;
            writer = new PrintWriter(System.out);
//            writer = new PrintWriter("aa_1.txt");
            solve();
            reader.close();
            writer.close();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(1);
        }
    }

    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    String nextToken() throws IOException {
        while(tokenizer == null || !tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(reader.readLine());
        }

        return tokenizer.nextToken();
    }
}


Measured memory_bytes: 22996
#include <iostream>
#include <string>
#include <vector>

using namespace std;

enum Face
{
	TOP = 0,
	NORTH = 1,
	WEST = 2,
	EAST = 3,
	SOUTH = 4,
	BOTTOM = 5,
};
int main()
{
	string cmd;
	vector<int> f(6);
	int tmp;
	for (int i = 0; i < 6; i++)
	{
		cin >> f[i];
	}
	cin >> cmd;
	for (int i = 0; i < cmd.size(); i++)
	{
		switch (cmd[i])
		{
		case 'E':
			tmp = f[TOP];
			f[TOP] = f[EAST];
			f[EAST] = f[BOTTOM];
			f[BOTTOM] = f[WEST];
			f[WEST] = tmp;
			break;
		case 'N':
			tmp = f[TOP];
			f[TOP] = f[NORTH];
			f[NORTH] = f[BOTTOM];
			f[BOTTOM] = f[SOUTH];
			f[SOUTH] = tmp;
			break;
		case 'S':
			tmp = f[TOP];
			f[TOP] = f[SOUTH];
			f[SOUTH] = f[BOTTOM];
			f[BOTTOM] = f[NORTH];
			f[NORTH] = tmp;
			break;
		case 'W':
			tmp = f[TOP];
			f[TOP] = f[WEST];
			f[WEST] = f[BOTTOM];
			f[BOTTOM] = f[EAST];
			f[EAST] = tmp;
			break;
		default:
			break;
		}
	}
	cout << f[0] << endl;
}


Measured memory_bytes: 3224
#include <iostream>
#include <algorithm>
#include <string>

using namespace std;

int main()
{
    string s;
    cin >> s;

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

    bool x = true;
    for (int i = 1; i < s.size(); ++i) {
        if (s[i] == s[i-1]) {
            x = false;
            break;
        }
    }
    cout << (x ? "yes" : "no") << endl;
}

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

template<typename integer>
integer __lcm(integer a, integer b) {
    return (a * b) / __gcd(a, b);
}

int main() {
    int h, w;
    cin >> h >> w;

    vector<vector<char>> a(h);
    rep (i, h) {
        a[i].resize(w);
    }

    rep (i, h) {
        rep (j, w) {
            cin >> a[i][j];
        }
    }

    vector<vector<int>> b(h+1);
    rep(i, h+1) {
        b[i].resize(w+1);
        fill(b[i].begin(), b[i].end(), 0);
    }

    rep (i, h) {
        rep (j, w) {
            if (a[i][j] == '.') {
                b[i][w]++;
                b[h][j]++;
            }
        }
    }

    rep (i, h) {
        string row = "";
        rep (j, w) {
            if (b[i][w] >= w) continue;
            if (b[h][j] >= h) continue;
            row += a[i][j];
        }

        if (row == "") continue;
        cout << row << endl;
    }

    return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<algorithm>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
ll gcd(ll a, ll b) {
	return b ? gcd(b, a % b) : a;
}
int main() {
	int n;
	cin >> n;
	string s[105];
	for (int i = 0; i < n; i++) {
		cin >> s[i];
	}
	int m;
	cin >> m;
	string t[105];
	for (int i = 0; i < m; i++) {
		cin >> t[i];
	}
	ll count = 0,ans = 0;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			if (s[i] == s[j]) {
				count++;
			}
		}
		for (int k = 0; k < m; k++) {
			if (s[i] == t[k]) {
				count--;
			}
		}
		ans = max(ans, count);
		
		count = 0;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
//C - XYZ Triplets
//Hiia
#include <stdio.h>
#include <stdlib.h>//rannsuu, zettaichi(absolute)
#include <time.h>
//srand((unsigned int) time(0));
#include <math.h>//koudona keisann
#include <string.h>//hairetsu
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
typedef long long ll;
//#define N 998244353
#define pi 3.1415926535897932384626433832

int gcd(int m,int n){if((0==m)||(0==n))return 0;while(m!=n)if(m>n)m=m-n;else n=n-m;return m;}
int lcm(int m,int n){if((0==m)||(0==n))return 0;return(m*n/gcd(m, n));}
int fact(int x){if(x==1) return(x);else return(x*fact(x-1));}//Kaijou x!
int ruijou(int base,int exponent){int i,answer=1;i=exponent;while(i!=0){answer=answer*base;--i;}return answer;}//ruijou base^exponent

long long int llgcd(long long int m,long long int n){if((0==m)||(0==n))return 0;while(m!=n)if(m>n)m=m-n;else n=n-m;return m;}
long long int lllcm(long long int m,long long int n){if((0==m)||(0==n))return 0;return(m*n/llgcd(m, n));}
long long int llfact(long long int x){if(x==1) return(x);else return(x*llfact(x-1));}//Kaijou
int llruijou(long long int base,long long int exponent){long long int i,answer=1;i=exponent;while(i!=0){answer=answer*base;--i;}return answer;}//ruijou base^exponent

int main()
{
  int n,x,y,z;
  scanf("%d", &n);
  for(int i = 1; i <= n; i++) {
            int ans=0;
            for(z = 1; z < sqrt(i); z++) {
              for(y = 1; y < sqrt(i); y++) {
                for(x = 1; x < sqrt(i); x++) {
                  if(x*x+y*y+z*z+x*y+y*z+z*x==i){
                    ans++;
                    break;
                  }
                  if(x*x+y*y+z*z+x*y+y*z+z*x>i){
                    break;
                  }
                }
              }
            }
            printf("%d\n", ans);
  }
  return 0;
}


Measured memory_bytes: 2132
#include<algorithm>
#include<cstdio>

using namespace std;

int read()
{
    int x=0;        bool f=0;        char k=getchar();
    while(k< '0'||k> '9') (k=='-')&&(f=1),k=getchar();
    while(k>='0'&&k<='9') x=(x*10)+(k&15),k=getchar();
    return (f)?(-x):(x);
}

signed main()
{
    int n=read(),m=read(),ans=0;
    for(int i=1;i<=n;i++)
    {
        int x=read();
        if(x>=m)ans++;
    }
    printf("%d",ans);
}

Measured memory_bytes: 128
#include <cstdio>

typedef unsigned long long ull;

int main() {
	int n;
	int a[100001];
	int b[100001];

	scanf("%d", &n);
	for(int i = 0; i <= n; i++) {
		scanf("%d", &a[i]);
	}
	for(int i = 0; i < n; i++) {
		scanf("%d", &b[i]);
	}

	ull result = 0;
	for(int i = 0; i < n; i++) {
		if(a[i] >= b[i]) {
			result += b[i];
			continue;
		}

		if(a[i] + a[i + 1] >= b[i]) {
			result += b[i];
			b[i] -= a[i];
			a[i + 1] -= b[i];
		} else {
			result += a[i] + a[i + 1];
			b[i] -= a[i];
			a[i + 1] = 0;
		}
	}

	printf("%llu\n", result);

	return 0;
}

Measured memory_bytes: 896
a = []
for i in range(5):
    a.append(int(input()))
p = 10
for i in range(5):
    if a[i] % 10 != 0:
        p = min(p,a[i]%10)
ans = 0
for i in range(5):
    if a[i] % 10 != 0:
        if a[i] % 10 == p:
            ans += a[i]
            p = 10
        else:
            ans += a[i] - a[i] % 10 + 10
    else:
        ans += a[i]
print(ans)

Measured memory_bytes: 9112
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    int k = s.length();
    int cnt = 0;
    for(int i = 0;i < k;i++)if(s.charAt(i)=='x')cnt++;
    System.out.println((cnt<=7)?"YES":"NO");
  }
}

Measured memory_bytes: 21204
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <math.h>
#include <list>
#include <stack>
#include <queue>
#include <utility>

using namespace std;


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



int main()
{
    string s;
    string t;
    cin >> s>> t;
    int ans = 0;
    rep(i,3)
    {
        if (s[i] == t[i])
        {
            ans++;
        }
        
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
#define int long long
int MOD = 1000000007;
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, M;
	char s, t;
	cin >> N >> M >> s >> t;
	vector<string> S(N);
	for (int i = 0; i < N; i++) {
		cin >> S[i];
	}
	vector<vector<int> > ed;
	map<char, int> mp;
	vector<pair<char, char> > vp;
	int c = 0;
	char e[2] = { '-', '|' };
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < M; j++) {
			if ((int)(S[i][j] - 'A') >= 0 && (int)(S[i][j] - 'A') < 26) {
				mp[S[i][j]] = c;
				c++;
				for (int k = 0; k < 2; k++) {
					int dx = k;
					int dy = 1 - k;
					if (i + 2 * dx < N && j + 2 * dy < M) {
						if (S[i + 2 * dx][j + 2 * dy] == e[k]) {
							int nx = i + 2 * dx;
							int ny = j + 2 * dy;
							while (true) {
								if ((int)(S[nx][ny] - 'A') >= 0 && (int)(S[nx][ny] - 'A') < 26) {
									break;
								}
								nx += dx;
								ny += dy;
							}
							vp.push_back(make_pair(S[i][j], S[nx][ny]));
						}
					}
				}
			}
		}
	}
	ed.resize(mp.size());
	for (int i = 0; i < vp.size(); i++) {
		//cerr << vp[i].first << " " << vp[i].second << endl;
		ed[mp[vp[i].first]].push_back(mp[vp[i].second]);
		ed[mp[vp[i].second]].push_back(mp[vp[i].first]);
	}
	vector<int> dist(ed.size(), (int)1 << 60);
	dist[mp[s]] = 0;
	queue<int> qu;
	qu.push(mp[s]);
	int a;
	while ((int)qu.size() > 0) {
		a = qu.front(); qu.pop();
		for (int i = 0; i < ed[a].size(); i++) {
			if (dist[ed[a][i]] > dist[a] + 1) {
				dist[ed[a][i]] = dist[a] + 1;
				qu.push(ed[a][i]);
			}
		}
	}
	cout << dist[mp[t]] << endl;
}


Measured memory_bytes: 3236
#include <bits/stdc++.h>
#include <iomanip>
#include <unordered_map>

using namespace std;

using LL = long long;
using ULL = unsigned long long;
using PII = pair<int, int>;
using PIL = pair<int, LL>;
using PLL = pair<LL, LL>;
// const int mod = 1e9 + 7;

#define mem(a, b) memset(a, b, sizeof(a))
#define REP(i, a) for (int i = 0; i < a; ++i)
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define ALL(a) a.begin(), a.end()

inline void quickread() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
}

inline void print_vector(vector<int> &A){
    for (auto&& x : A){
        cout << x << " ";
    }
    cout << endl;
}

inline void print_array(const int A[], int n) {
    REP(i, n) {
        cout << A[i] << " ";
    }
    cout << endl;
}

bool is_prime(int n) {
    if (n == 2) return true;
    for (int i = 2; i < sqrt(n) + 1; ++i) {
        if (n % i == 0) {
            return false;
        }
    }

    return true;
}

inline void solve() {
    int n;
    cin >> n;

    string s;
    cin >> s;

    int r_num = count(s.begin(), s.end(), 'R');

    int res = 0;

    REP(i, r_num) {
        if (s[i] == 'W') {
            res++;
        }
    }

    cout << res << endl;
}


int main() {
    // freopen("input.txt", "r", stdin);
    quickread();
    int t;
    t = 1;
    // cin >> t;

    for (int _ = 0; _ < t; _++) {
        solve();
    }

    return 0;
}


Measured memory_bytes: 3752
#include <bits/stdc++.h>
 
using namespace std;
 
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define all(a) a.begin(), a.end()
#define rep(i, st, n) for (int i = (st); i < (n); ++i)
 
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef long double ld;
 
template <typename T1, typename T2> bool chkmin(T1 &x, T2 y) { return y < x ? (x = y, true) : false; }
template <typename T1, typename T2> bool chkmax(T1 &x, T2 y) { return y > x ? (x = y, true) : false; }

struct Hash
{
    static const int MA = 998244353, MB = 1000000007;

    int a, b;
    Hash(): a(0), b(0)
    {
    }
    Hash(int _a): a(_a % MA), b(_a % MB)
    {
    }
    Hash(int _a, int _b): a(_a % MA), b(_b % MB)
    {
    }

    Hash operator + (const Hash &x) const
    {
        return Hash((a + x.a) % MA, (b + x.b) % MB);
    }
    Hash operator + (int x) const
    {
        return Hash((a + x) % MA, (b + x) % MB);
    }
    Hash operator - (const Hash &x) const
    {
        return Hash((a - x.a + MA) % MA, (b - x.b + MB) % MB);
    }
    Hash operator - (int x) const
    {
        return Hash((a - x + MA) % MA, (b - x + MB) % MB);
    }
    Hash operator * (const Hash &x) const
    {
        return Hash((a * (ll)x.a) % MA, (b * (ll)x.b) % MB);
    }
    Hash operator * (int x) const
    {
        return Hash((a * (ll)x) % MA, (b * (ll)x) % MB);
    }
    bool operator < (const Hash &x) const
    {
        if (a != x.a)
            return a < x.a;
        return b < x.b;
    }
    bool operator == (const Hash &x) const
    {
        return a == x.a && b == x.b;
    }
};
const Hash BASE = Hash(31);
Hash pw[100005];

Hash append(Hash x, char c)
{
    return x * BASE + (c - 'a');
}

signed main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
#ifdef DEBUG
    freopen("in", "r", stdin);
#endif
    
    pw[0] = Hash(1);
    pw[1] = BASE;
    for (int i = 2; i < 100005; ++i)
    {
        pw[i] = pw[i - 1] * BASE;
    }

    int n;
    cin >> n;
    string s;
    cin >> s;
    vector<Hash> H(n + 1, 0);
    for (int i = 1; i <= n; ++i)
    {
        H[i] = append(H[i - 1], s[i - 1]);
    }
    auto gt = [&](int l, int r) -> Hash
    {
        return H[r + 1] - H[l] * pw[r - l + 1];
    };
    int vl = 0;
    int vr = n + 1;
    int ans;
    while (vr - vl > 1)
    {
        int len = (vl + vr) >> 1;
        map<Hash, int> mn, mx;
        for (int i = 0; i + len - 1 < n; ++i)
        {
            Hash h = gt(i, i + len - 1);
            if (!mn.count(h))
                mn[h] = i;
            mx[h] = i;
        }
        int found = -1;
        for (auto y : mn)
        {
            Hash h = y.fi;
            int i = y.se;
            int j = mx[h];
            if (i + len <= j)
            {
                found = i;
                break;
            }
        }
        if (found != -1)
        {
            vl = len;
            ans = found;
        }
        else
            vr = len;
    }
    cout << vl << '\n';

    return 0;
}

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

namespace d
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = long.Parse(Console.ReadLine());

            var a = Console.ReadLine().Split().Select(i => long.Parse(i)).ToList();
            var d = new Dictionary<long, long>();
            foreach(var i in a){
                if(d.ContainsKey(i)){
                    d[i] += 1;
                }else{
                    d.Add(i, 1);
                }
            }

            var total = 0L;
            foreach(var i in d.Values){
                total += (i * (i - 1)) / 2;
            }

            for(var i = 0; i < n; i++){
                var val = d[a[i]];
                var count = total;
                count -= (val * (val - 1)) / 2;
                count += ((val - 1) * (val - 2)) / 2;
                Console.WriteLine(count);
            }

        }
    }
}


Measured memory_bytes: 44608
#include <cmath>
#include <iostream>
#include <limits>
#include <vector>

template <class T>
void chmin(T& a, const T& b) {
    if (a > b) {
        a = b;
    }
}

int main() {
    int N;
    std::cin >> N;

    std::vector<long long> h;
    h.reserve(N);
    long long x;
    for (int i = 0; i < N; ++i) {
        std::cin >> x;
        h.push_back(x);
    }

    std::vector<long long> dp(N, std::numeric_limits<long long>::max());

    dp[0] = 0;

    for (int i = 0; i < N; ++i) {
        chmin(dp[i], dp[i - 1] + std::abs(h[i] - h[i - 1]));

        if (i > 1) {
            chmin(dp[i], dp[i - 2] + std::abs(h[i] - h[i - 2]));
        }
    }

    const auto ret = dp[N - 1];

    std::cout << ret << std::endl;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  int n, k;
  cin >> n >> k;
  vi x(n);
  rep(i, n) cin >> x[i];
  int ans = 1e9;
  rep(l, n - k + 1) {
    int r = l + k - 1;
    int d = min(abs(x[l]), abs(x[r])) + abs(x[r] - x[l]);
    ans = min(ans, d);
  }
  cout << ans << endl;
}

Measured memory_bytes: 640
module Main (main) where

import qualified Data.ByteString.Char8 as C8
import Data.Bool
import Data.Maybe

main :: IO ()
main = do
  [a,b] <- readInts
  print . showAnswer $ solve (a,b)

type Input  = (Int, Int)
type Output = Int

solve :: Input -> Output
solve (a,b) = maximum [a+b, a-b, a*b]

showAnswer :: Output -> Answer
showAnswer = Number

-- utils
readInts :: IO [Int]
readInts = map (fst . fromJust . C8.readInt) . C8.words <$> C8.getLine

data Answer
  = YesNo Bool
  | YESNO Bool
  | AB Bool
  | Number Int
  | String String
  | Compare Ordering
  | Compare2 Ordering

instance Show Answer where
  show (YesNo b)    = bool "No" "Yes" b
  show (YESNO b)    = bool "NO" "YES" b
  show (AB b)       = bool "B"  "A" b
  show (Number i)   = show i
  show (String s)   = s
  show (Compare o)  = ordering "<" "=" ">" o
  show (Compare2 o) = ordering "Right" "Balanced" "Left" o

ordering :: a -> a -> a -> Ordering -> a
ordering lt eq gt o = case o of
  LT -> lt
  EQ -> eq
  GT -> gt

Measured memory_bytes: 380
#include <iostream>
using namespace std;
typedef long long int ll;
int main(){

    int n,m;
    cin >> n >> m;


    if(n == 1 && m == 1){
        cout << 1 << endl;
        return 0;
    }
    if(n == 1){
        cout << m-2 << endl;
        return 0;
    }
    if(m == 1){
        cout << n-2 << endl;
        return 0;
    }

    cout << (ll)m*n - (ll)2*m - (ll)2*n + 4 << endl;


    return 0;
}

Measured memory_bytes: 256
o = b = c = 0;input()
for i, x in enumerate(input().split()):
    x = int(x)
    s = x - b if i else 0
    d = (s>0)-(s<0)
    if abs(d - o) > 1:
        c += 1
        o = 0
    else:
      o = d or o
    b = x
print(c+1)

Measured memory_bytes: 63088
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: usize,
        a: [i32; n],
    }

    let mut a = a;
    a.sort();
    
    let mut v = vec![];
    for x in a {
        match v.binary_search(&x) {
            Ok(_) => {
                println!("NO");
                std::process::exit(0);
            }
            Err(_) => v.push(x)
        }   
    }
    println!("YES");
}


Measured memory_bytes: 6396
s = list(map(int, input().split()))
sum_num = 0
sum_list = []
for r in range(1, s[0] + 1):
    l = []
    for r2 in str(r):
        l.append(int(r2))
    if (s[1] <= sum(l)) and (sum(l) <= s[2]):
        sum_list.append(r)

print(sum(sum_list))

Measured memory_bytes: 3296
mod io{
    use std::io::*;
    pub fn read<T: ::std::str::FromStr>()->T{
        let stdin=stdin();
        let ret=stdin.lock().bytes().map(|c|c.unwrap()as char)
        .skip_while(|c|c.is_whitespace())
        .take_while(|c|!c.is_whitespace())
        .collect::<String>().parse().ok().unwrap();
        ret
    }
}
use io::read;
fn main(){
    let a=read::<i32>();
    let b=read::<i32>();
    println!("{}",if a>b{a-1}else{a})
}


Measured memory_bytes: 4352
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <climits>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <fstream>

using namespace std;
#define SZ(x) (int)(x).size()
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REPR(i,n) for(int i=(n)-1;i>=0;i--)
#define ALL(s) (s).begin(), (s).end()
#define so(V) sort(ALL(V))
#define rev(V) reverse(ALL(V))
#define uni(v) v.erase( unique(ALL(v)) , v.end());

typedef long long unsigned int llu;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<bool> vb;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;
const int INF = (1 << 29);
const ll LINF = 1e18;
const double PI = acos(-1);

template<typename T>vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T, typename... Ts>auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...)); }
template<typename T, typename U, typename... V>
typename enable_if<is_same<T, U>::value != 0>::type
fill_v(U& u, const V... v) { u = U(v...); }
template<typename T, typename U, typename... V>
typename enable_if<is_same<T, U>::value == 0>::type
fill_v(U& u, const V... v) { for (auto& e : u) fill_v<T>(e, v...); }
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;
	vi A(N), B(N), C(N-1);
	REP(i, N){
		cin >> A[i];
		A[i]--;
	}
	REP(i, N)cin >> B[i];
	REP(i, N - 1)cin >> C[i];
	int ans = 0;

	REP(i, N) {
		ans += B[A[i]];
		if (i != 0 && A[i] - 1 == A[i - 1]) {
			ans += C[A[i - 1]];
		}
	}
	cout << ans << endl;
	return 0;
}


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

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  auto c2i = [](char c) {
    if (islower(c)) {
      return c - 'a';
    }
    return 26 + (c - 'A');
  };
  auto i2c = [](int i) -> char {
    if (i < 26) {
      return 'a' + i;
    }
    i -= 26;
    return 'A' + i;
  };
  int n;
  while (cin >> n, n) {
    vector<int> k(n);
    for (auto&& e : k) {
      cin >> e;
    }
    string s;
    cin >> s;
    for (int i = 0; i < (int)s.size(); ++i) {
      cout << i2c((c2i(s[i]) + 52 - k[i % n]) % 52);
    }
    cout << '\n';
  }
}



Measured memory_bytes: 3116
#include <iostream>
void compareNum(int a,int b,int c);
using namespace std;
int main(int argc, const char * argv[]) {
    int a,b,c;
    cin >> a >> b >> c;
    compareNum(a, b, c);
    return 0;
}
void compareNum(int a,int b,int c){
    int x;
    if (a > b) {
        x = b;
        b = a;
        a = x;
    }
    if (b > c) {
        x = c;
        c = b;
        b = x;
    }
    if (a > b) {
        x = b;
        b = a;
        a = x;
    }
    cout << a <<" "<< b <<" "<< c <<endl;
}


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

def chk(a,t):
    ans=0
    x=0
    for i in a:
        x+=i
        if t==True and x<1:
            ans+=1-x
            x=1
        elif t==False and x>-1:
            ans+=x+1
            x=-1
        t=not t
    return ans    
print(min(chk(A,True),chk(A,False)))

Measured memory_bytes: 14212
import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
        
        Scanner scan = new Scanner(System.in);
        long a = scan.nextLong();
        long b = scan.nextLong();
        long x = scan.nextLong();
        long count  = b / x - a / x;
        if (a%x == 0 ) count++;

        System.out.println(count);

        scan.close();
    }
}

Measured memory_bytes: 24020
// AOJ 0562: Shopping in JOI Kingdom
// 2017.12.3 bal4u@uu

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define MAX 100005
typedef struct { int t, node; } QUE;
QUE que[MAX]; int qsize;

#define PARENT(i) ((i)>>1)
#define LEFT(i)   ((i)<<1)
#define RIGHT(i)  (((i)<<1)+1)

void min_heapify(int i)
{
	int l, r, min;
	QUE qt;

	l = LEFT(i), r = RIGHT(i);
	if (l < qsize && que[l].t < que[i].t) min = l; else min = i;
	if (r < qsize && que[r].t < que[min].t) min = r;
	if (min != i) {
		qt = que[i], que[i] = que[min], que[min] = qt;
		min_heapify(min);
	}
}

void deq()
{
	que[0] = que[--qsize];
	min_heapify(0);
}

void enq(int n, int t)
{
	int i, min;
	QUE qt;

	i = qsize++;
	que[i].node = n, que[i].t = t;
	while (i > 0 && que[min = PARENT(i)].t > que[i].t) {
		qt = que[i], que[i] = que[min], que[min] = qt;
		i = min;
	}
}

typedef struct { int to[300], w[300]; } TBL;
TBL tbl[3002]; int len[3002];
int dist[3002];

char buf[40], *p;
int getint()
{
	int n = 0;
	while (*p >= '0') n = (n<<3) + (n<<1) + (*p++ & 0xf);
	p++;
	return n;
}

int main()
{
	int n, m, k, i, a, b, w, t, ans;

	fgets(p=buf, 40, stdin);
	n = getint(), m = getint(), k = getint();
	for (i = 0; i < m; i++) {
		fgets(p=buf, 40, stdin);
		a = getint()-1, b = getint()-1, w = getint();
		t = len[a], tbl[a].to[t] = b, tbl[a].w[t] = w, len[a]++;
		t = len[b], tbl[b].to[t] = a, tbl[b].w[t] = w, len[b]++;
	}

	memset(dist, 0x33, sizeof(dist));
	qsize = 0;
	while (k--) {
		fgets(p=buf, 40, stdin);
		a = getint()-1;
		dist[a] = 0;
		enq(a, 0);
	}
	while (qsize) {
		a = que[0].node, w = que[0].t, deq();
		for (i = 0; i < len[a]; i++) {
			b = tbl[a].to[i];
			w = dist[a] + tbl[a].w[i];
			if (w < dist[b]) dist[b] = w, enq(b, w);
		}
	}

	ans = 0;
	for (a = 0; a < n; a++) {
		for (i = 0; i < len[a]; i++) {
			b = tbl[a].to[i];
			t = (dist[a] + dist[b] + tbl[a].w[i] + 1) >> 1;
			if (t > ans) ans = t;
		}
	}
	printf("%d\n", ans);
	return 0;
}

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

int main() {
	string t;
	cin >> t;
	
	for(int i=t.size()-1;i>=0;i--) {
		if (t.at(i)=='?') {
			t.at(i)='D';
		}
	}
	cout << t << endl;
	/*
	int score=0;
	int cnt_D=0;
	int cnt_PD=0;
	rep(i,t.size()){
		if (t.at(i)=='D') {
			cnt_D++;
			if (i!=0 && t.at(i-1)=='P') {
				cnt_PD++;
			}
		}
	}
	score=cnt_D+cnt_PD;
	*/

	return 0;
}

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

struct Dijkstra {
  Dijkstra(int V) : V(V), G(V) {}
  struct edge {
    edge(int to, long long cost) : to(to), cost(cost) {}
    int to;
    long long cost;
  };

  using P = pair<long long, int>;
  const long long inf = 1001001001001001001ll;

  int V;
  vector<vector<edge>> G;
  vector<long long> d;

  void init(int n) {
    V = n;
    G.resize(n);
  }

  void debug() {
    cerr << "edges : " << endl;
    for (int i = 0; i < V; ++i)
      for (auto e : G[i]) cerr << i << " -> " << e.to << " : " << e.cost << endl;
    cerr << endl << "dist : " << endl;
    for (int i = 0; i < V; ++i) cerr << i << " : " << d[i] << endl;
  }

  void add_edge(int u, int v, long long c) {
    G[u].push_back(edge(v, c));
  }

  void build(int s) {
    d.assign(V, inf);
    priority_queue<P, vector<P>, greater<P>> q;

    d[s] = 0;
    q.push(P(0ll, s));

    while (!q.empty()) {
      P p = q.top();
      q.pop();
      int v = p.second;
      if (d[v] < p.first) continue;
      for (auto &e : G[v])
        if (d[e.to] > p.first + e.cost) {
          d[e.to] = p.first + e.cost;
          q.push(P(d[e.to], e.to));
        }
    }
  }

  long long operator[](int v) {
    return d[v];
  }
};

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

  Dijkstra G(K);
  for (int i = 0; i < K; ++i) {
    if (i % 10 != 9) {
      G.add_edge(i, (i + 1) % K, 1);
    }
    G.add_edge(i, 10 * i % K, 0);
  }

  G.build(1);

  cout << G[0] + 1 << endl;
}


Measured memory_bytes: 9084
using System;
using System.Collections.Generic;

class Program
{
    static void Main(string[] args)
    {
        var ab = Console.ReadLine().Split();
        var a = int.Parse(ab[0]) - 1;
        var b = int.Parse(ab[1]) - 1;

        var ans = (b + a - 1) / a;
        Console.WriteLine(ans);
    }
}


Measured memory_bytes: 11092
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
using namespace std;
const int MOD = 1e9+7;
using ll = long long;
using vi = vector<int>;
#define rep(i, n) for (int i = 0; i < n; i++)
#define ALL(x) x.begin(), x.end()
int main() {
  int a,b,c;
  cin >> a >> b;
  vi ans(a,0);
  rep(i,b*2){
    cin >> c;
    c--;
    ans.at(c)++;
  }
  rep(i,a){
    cout << ans.at(i) << endl;
  }
}

Measured memory_bytes: 3584
# -*- coding:utf-8 -*-
a,b = map(int,input().split())

if  b==1:
    print(0)
elif a >= b:
    print(1)
else:
    SumPowerSocket = a
    NumUsePowerTap = 1
    while True:
        if b > SumPowerSocket:
            SumPowerSocket += a - 1
            NumUsePowerTap += 1
        else:
            print(NumUsePowerTap)
            break

Measured memory_bytes: 9128