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

using namespace std;
typedef long long ll;
typedef double ld;

ll n;
ll x[200010];
ll a[1000010];
ll np[200010];
ll nm[200010];
ll o;

int main(void)
{
	for(ll i = 1 ; i < 1000010 ; i++)
	{
		ll cou = 0;
		ll gap = i;
		
		while(gap > 0)
		{
			cou += gap % 2;
			gap /= 2;
		}
		
		a[i] = a[i % cou] + 1;
	}
	
	scanf("%lld", &n);
	
	for(ll i = 0 ; i < n ; i++)
	{
		scanf("%1lld", &x[i]);
		o += x[i];
	}
	
	ll p = o + 1;
	ll m = o - 1;
	ll P = 0;
	ll M = 0;
	ll ff = 0;
	
	if(m <= 0)
	{
		ff = 1;
		m = 19876543210;
	}
	
	np[0] = 1;
	nm[0] = 1;
	
	for(ll i = 1 ; i <= n ; i++)
	{
		np[i] = np[i - 1] * 2 % p;
		nm[i] = nm[i - 1] * 2 % m;
	}
	
	for(ll i = 0 ; i < n ; i++)
	{
		P = (P + x[i] * np[n - 1 - i]) % p;
		M = (M + x[i] * nm[n - 1 - i]) % m;
	}
	
	for(ll i = 0 ; i < n ; i++)
	{
		if(x[i] == 0)
		{
			//p
			
			ll pp = (P + np[n - 1 - i]) % p;
			
			if(pp < 0)
				pp += p;
			
			printf("%lld\n", a[pp] + 1);
		}
		
		else
		{
			//m
			
			if(ff == 1)
			{
				printf("0\n");
				continue;
			}
			
			ll mm = (M - nm[n - 1 - i]) % m;
			
			if(mm < 0)
				mm += m;
			
			printf("%lld\n", a[mm] + 1);
		}
	}
	
	return 0;
}

Measured memory_bytes: 16224
#include <stdio.h>
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <stack>
#include <algorithm>
#include <iomanip>
#include <map>
#include <queue>
#include <functional>
#include <numeric>
#include <chrono>
#include <cstdlib>
using ll = long long;
using namespace std;

const ll MOD = 1e9 + 7;
#define REP(i, n) for (int(i) = 0; (i) < (n); ++(i))
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
// bool operator<(const pair<int, int> &a, const pair<int, int> &b)
// {
//     if (a.first == b.first)
//         return a.second < b.second;
//     return a.first < b.first;
// };

/*unsigned int xor128(void)
{
    static unsigned int x = 123456789, y = 362436069, z = 521288629, w = 88675123;
    unsigned int t = (x ^ (x << 11));
    x = y;
    y = z;
    z = w;
    return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}
unsigned int xor128rnd(unsigned int m)
{
    return xor128() % m;
}*/

/*bool operator<(const pair<int, int> &a, const pair<int, int> &b)
{
    if (a.first == b.first)
    {
        return a.second < b.second;
    }
    return a.first < b.first;
}*/
int dp[100010];
int h[100010];
int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    int N, K;
    cin >> N >> K;
    for (int i = 0; i < N; ++i)
    {
        dp[i] = 1e9;
        cin >> h[i];
    }
    dp[0] = 0;
    for (int i = 0; i < N; ++i)
    {
        for (int j = 1; j <= K; ++j)
        {
            if (i + j < N)
                dp[i + j] = min(dp[i + j], dp[i] + abs(h[i] - h[i + j]));
        }
    }
    cout << dp[N - 1] << endl;
    return 0;
}

Measured memory_bytes: 1024
#include<iostream>

using namespace std;

int main()
{

	int n;
	int oHouses[5][4][11];
	int b,f,r,v;

	for( int i=0; i<4; i++ ) {
		for( int j=0; j<3; j++ ) {
			for( int k=0; k<10; k++ ) {
				oHouses[i][j][k]=0;			
			}
		}
	}

	cin>>n;	
	for( int i=0; i<n; i++ ) {
		cin>>b>>f>>r>>v;		
		oHouses[b-1][f-1][r-1] += v;
	}
	for( int i=0; i<4; i++ ) {
		for( int j=0; j<3; j++ ) {
			for( int k=0; k<10; k++ ) {
				cout<<" "<<oHouses[i][j][k];
			}
			cout<<endl;	
		}
		if( i < 3 ) { cout<<"####################"<<endl; }
	}
	
    return 0;
}

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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define int long long
#define pb push_back
using ll = long long;
using namespace std;
int gcd(int a,int b){return b?gcd(b,a%b):a;}

signed main(void){
    int N,M;
    int temp;
    int sum=0;
    cin >> N >> M;
    for(int i=0;i<M;i++){
        cin >> temp;
        sum += temp;
    }
    if(sum>N){
        cout <<"-1" << endl;
    }else{
        cout << N-sum << endl;
    }
    return 0;
}

Measured memory_bytes: 3636
#include <iostream>

int main(){
	int N,M,L,R,l,r;
	std::cin>>N;
	std::cin>>M;
	l=1;r=N;
	for(int i=0;i<M;i++){
		std::cin>>L;
		std::cin>>R;
		if(l<L){
			l=L;
		}
		if(r>R){
			r=R;
		}
	}
	if(l<=r){
		std::cout<<r-l+1<<std::endl;
	}else{
		std::cout<<0<<std::endl;
	}
	return 0;
}


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

// boost
#include <boost/multiprecision/cpp_int.hpp>
using boost::multiprecision::cpp_int;

using ll = long long;
using ld = long double;

using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vs = vector<string>;
using vld = vector<ld>;
using vvld = vector<vld>;

typedef pair<ll, ll> P;

#define bit(n) (1LL << (n))

//#define int long long

#define all(v) v.begin(), v.end()

#define rep(i, n) for (ll i = 0; i < n; i++)
#define REP(i, n) for (ll i = 1; i < n; i++)

#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define FORm(i, m) for (auto i = m.begin(); i != m.end(); i++)

template <class T>
inline void chmax(T& a, T b) {
  a = std::max(a, b);
}
template <class T>
inline void chmin(T& a, T b) {
  a = std::min(a, b);
}

#define mod (ll)(1e9 + 7)
// #define mod (998244353ll)

const long long INF = 1LL << 60;

pair<ll, ll> calc2(vll& v) {
  ll cnt = -1;
  ll val = 0;

  for (auto it : v) {
    val += it;
    cnt++;

    if (val >= 10) {
      val = val / 10 + (val % 10);
      cnt++;
    }
  }
  return make_pair(cnt, val);
}

pair<ll, ll> calc(ll d, ll c) {
  ll cnt = 0;
  vll v;
  while (c > 1) {
    if (c % 2)
      v.push_back(d);

    cnt += c / 2;
    d *= 2;
    if (d >= 10) {
      d = d / 10 + (d % 10);
      cnt += c / 2;
    }
    c /= 2;
  }
  v.push_back(d);

  auto [cnt2, val] = calc2(v);
  cnt += cnt2;

  return make_pair(cnt, val);
}

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);

  ll m;
  cin >> m;
  vll d(m), c(m);
  rep(i, m) {
    cin >> d[i] >> c[i];
  }

  ll ans = 0;
  vll v;
  rep(i, m) {
    auto [cnt, val] = calc(d[i], c[i]);
    ans += cnt;
    v.push_back(val);
  }

  auto [cnt, vec] = calc2(v);
  ans += cnt;

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 8340
#pragma GCC optimize "trapv"
#include<bits/stdc++.h>

#define ll long long int
#define pb push_back
#define ppb pop_back
#define ff first
#define ss second
#define sz(s) (ll)(s.size())
#define vvi vector<vector<ll>>
#define vi vector<ll>
#define all(a) (a).begin(),(a).end()
#define pii pair<ll,ll>
#define dbg(x,y) cout<<x<<" "<<y<<endl
#define endl '\n'
#define M 1000000007
const ll INF = 1ll<<60;

using namespace std;
//-----------------------------------------//


void solve(){
	ll n;
	cin>>n;
	cout<<(n>=30 ? "Yes" : "No")<<endl;
}



int main(){

	// #ifndef ONLINE_JUDGE
 //    freopen("input.txt", "r", stdin);
 //    freopen("output.txt", "w", stdout);
	// #endif
	
	int t=1;
	// cin>>t;
	while(t--){
        solve();
	}
}


Measured memory_bytes: 3652
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#include <cstdlib>
typedef long long int ll;
using namespace std;
const ll MOD = 1e9+7;

static long gcd(long a, long b) {
    if (b == 0) {
        return a;
    }
    return gcd(b, a % b);
}
/*
long long int facctorialMethod(int k){//階乗
    int sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}*/

long long int tousasum(long long int n){//等差数列
    return n*(n+1)/2;
}

unsigned GetDigit(unsigned num){//桁数
    unsigned digit=0;
    while(num!=0){
        num /= 10;
        digit++;
    }
    return digit;
}

bool IsPrime(int num)//素数判定
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}

map< ll, ll > prime_factor(ll n) {//素因数分解
    map< ll, ll > ret;
    for(ll i = 2; i * i <= n; i++) {
        while(n % i == 0) {
            ret[i]++;
            n /= i;
        }
    }
    if(n != 1) ret[n] = 1;
    return ret;
}

ll calcNumOfCombination(ll n, ll r){
    ll num = 1;
    for(ll i = 1; i <= r; i++){
        num = num * (n - i + 1) / i;
    }
    return num;
}

int bubblesort(vector<int> array,int size){//バブルソート　転倒数
    int kaisu = 0;
    for(int i = 0; i < size; i++){
        for(int j = i + 1; j < size; j++){
            if(array[i] > array[j]){
                int number = array[i];
                array[i] = array[j];
                array[j] = number;
                kaisu++;
            }
        }
    }
    return kaisu;
}

ll facctorialMethod(ll k){
    ll sum = 1;
    for (ll i = 1; i <= k; ++i)
    {
        sum = (sum * i)%MOD;
    }
    return sum;
}

int main() {

    ll N;
    ll sum = 0;
    cin >> N;
    ll A[N];
    for(int i=0;i<N;i++){
        cin >> A[i];
        sum += A[i];
    }
    ll x1=sum;
    for(int i=1;i<N;i+=2){
        x1-=2*A[i];
    }
    cout << x1 << endl;

    for(int i=0;i<N-1;i++){
        cout <<2*A[i] - x1 << endl;
        x1 = 2*A[i] - x1;
    }



}

Measured memory_bytes: 2048
import sys
s = input()
q = int(input())
a = ['', '']
r = 0
for i in range(q):
    l = sys.stdin.readline()
    if l[0] == '1':
        r ^= 1
    else:
        t, f, c = l.split()
        a[0 if f == '21'[r] else 1] += c 
if r:
    print(a[0][::-1] + s[::-1] + a[1])
else:
    print(a[1][::-1] + s + a[0])

Measured memory_bytes: 4536
#include <cstdio>
#define MAXN 55
int a[MAXN];
int main() {
	int n, m, x, y;
	scanf("%d%d", &n, &m);
	for(int i = 1; i <= m; i++) {
		scanf("%d%d", &x, &y);
		a[x]++, a[y]++;
	} 
	for(int i = 1; i <= n ;i++) 
		printf("%d\n", a[i]);
	return 0;
}

Measured memory_bytes: 128
# https://atcoder.jp/contests/abc138/submissions/6992193
from collections import deque
 
N, Q = map(int, input().split())
to = [[] for _ in range(N)]

# to: つながっているノード番号を保持
for _ in range(N - 1):
    a, b = map(int, input().split())
    to[a - 1].append(b - 1)
    to[b - 1].append(a - 1)

# P: 各ノード番号にxの和を保持（後に累積和をとる準備）
P = [0] * N
for _ in range(Q):
    p, x = map(int, input().split())
    P[p - 1] += x

# cnt: 累積和の計算用 
cnt = [0] * N

# rootから順に累積和をとっていく
q = deque()
q.append((0, 0, -1))  # ダミーの値で初期化
while len(q):
    p, x, prev = q.pop()  # スタックとして使用
    x += P[p]
    cnt[p] = x
    for b in to[p]:  # つながっているノードにもxを加算
        if b != prev:
            q.append((b, x, p))  # b: xを加算するノード, p: xが親（本ループですでに加算したノード）に波及して来ないようにするための制御用の値
print(*cnt)

Measured memory_bytes: 66044
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <bitset>
#include <cmath>
#include <string>
#define FI first
#define SE second
#define VE vector<int>
#define PB push_back
#define PA pair<int,int>
#define MA make_pair
#define LL long long
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ROF(i,a,b) for(int i=b-1;i>=a;i--)
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
using namespace std;
//
const int INF=1e9+7;
//
int main(){
  int N;
  int A[100];
  cin>>N;
  FOR(i,0,N){
    cin>>A[i];
  }
  int ans=0;
  FOR(i,0,N){
    int cnt=0;
    while(i<N&&A[i]==1){
      i++;
      cnt++;
    }
    ans=max(ans,cnt);
  }
  cout<<ans+1<<endl;
  return 0;
}


Measured memory_bytes: 3092
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;
using static AtCoderTemplate.MyLibrary;

namespace AtCoderTemplate
{
    class Program
    {
        static long i;
        static long N, M;
        static List<List<int>> connect;

        static Queue<int> q;
        static int[] parent;
        static void Main (string[] args)
        {
            string[] str = Console.ReadLine ().Split (' ');
            N = long.Parse (str[0]);
            M = long.Parse (str[1]);

            connect = new List<List<int>> ();
            for (int i = 0; i < N; i++) connect.Add (new List<int> ());

            parent = new int[N];
            for (i = 0; i < N; i++) parent[i] = -1;
            for (i = 0; i < M; i++)
            {
                str = Console.ReadLine ().Split (' ');
                int A = int.Parse (str[0]) - 1;
                int B = int.Parse (str[1]) - 1;

                connect[A].Add (B);
                connect[B].Add (A);

            }

            q = new Queue<int> ();
            q.Enqueue (0);

            parent[0] = 0;
            while (q.Count > 0)
            {
                int temp = q.Dequeue ();
                Search (temp);
            }

            Console.WriteLine ("Yes");
            for (i = 1; i < N; i++)
            {
                Console.WriteLine (parent[i] + 1);
            }

        }

        static void Search (int n)
        {
            foreach (int k in connect[n])
            {
                if (parent[k] == -1)
                {
                    parent[k] = n;
                    q.Enqueue (k);
                }
            }
        }
    }

    class MyLibrary
    {

        // 自作の関数
        public static int MyFunction (int n)
        {
            return 0;
        }
    }
}

Measured memory_bytes: 51332
#include "bits/stdc++.h"
#ifndef err
#define err(...)(void)0
#endif
using namespace std;
using ll = long long;
using ull = decltype(1ull);
template<class T>int size(T&&a) { return a.size(); }
#define REP(t,a)for(typename make_signed<decltype(a.second)>::type t=a.first,_l##t=a.second;t<_l##t;t++)
#define RREP(t,a)for(typename make_signed<decltype(a.second)>::type t=a.second-1,_l##t=a.first;t>=_l##t;t--)
template<class B>pair<int, B>make_pair(B b) { return{ 0,b }; }
#define rep(t,...)REP(t,make_pair(__VA_ARGS__))
#define rrep(t,...)RREP(t,make_pair(__VA_ARGS__))
#define all(a)begin(a),end(a)
#define rall(a)a.rbegin(),a.rend()
#define var(t,a, ...) t a,##__VA_ARGS__;auto a##_in = [&]() { return in, a, ##__VA_ARGS__, 0; }();
#define In(a, ...) auto k##a##_in = [&]() { __VA_ARGS__; return 0; }();

void Calc();
int main() {
  ios::sync_with_stdio(false); cin.tie(nullptr);
  cin.exceptions(istream::failbit | istream::badbit);
  cout << fixed << setprecision(15); Calc(); cout.flush(); return 0;
}
template<class A>void amax(A&a, A b) { a = max(a, b); }
template<class A>void amin(A&a, A b) { a = min(a, b); }
template<class A>int comp(A a, A b) { return a < b ? 1 : b < a ? -1 : 0; }
struct Scanner {
  template<class A = string>A Next() { A a; cin >> a; return a; }
  template<class A = int>vector<A>Array(int n) { vector<A>a(n); for (A&i : a) cin >> i; return a; }
  string Line() const { string s; getline(cin, s); return s; }
  template<class A>Scanner&operator,(A&a) { a = Next<A>(); return *this; }
  template<class A>operator A() { return Next<A>(); }
}in;

/*---------------------------------------------------------------------*/

void Calc() {

  int N = in;
  rep(h, 1, 3510)rep(n, 1, 3510) {
    ll x = (ll)N * h * n;
    ll y = (ll)(4 * h - N) * n - N * h;
    if (x <= 0 || y <= 0)continue;
    if (x % y == 0) {
      ll w = x / y;
      cout << (h) << ' ' << n << ' ' << x / y << endl;
      return;
    }
  }
}


Measured memory_bytes: 256
from collections import deque

N, M = map(int, input().split())
X = [list(map(int, input().split())) for _ in range(M)]

graph = [[] for _ in range(N + 1)]
for a, b in X:
    graph[a].append(b)
    graph[b].append(a)

prevs = [-1] * (N + 1)
prevs[1] = 0
q = deque([1])

while q:
    u = q.popleft()
    for v in graph[u]:
        if prevs[v] < 0:
            prevs[v] = u
            q.append(v)
            
print("Yes")
print(*prevs[2:], sep="\n")


Measured memory_bytes: 129224
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>

using namespace std;

#define forn(i, n) for (long long i = 0; i < (long long) (n); ++i)
#define pb emplace_back
#define endl '\n'

template<typename T> void _dbg(const char*_s,T _h) { cerr<<_s<<" = "<<_h<<"\n"; }

template<typename T, typename... Ts> void _dbg(const char*_s,T _h,Ts... _t) {
    for(int _b=0;((_b+=*_s=='(')-=*_s==')')!=0||*_s!=',';)cerr<<*_s++;
    cerr<<" = "<<_h<<",";_dbg(_s+1,_t...);
}

#define int long long

#ifdef LOCAL
    #define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
    #define dbg(...)
#endif

const int N = 500 * 1000 + 17;
const int MOD = 1000 * 1000 * 1000 + 7;

int k;

bool read() {
    if (!(cin >> k))
        return false;

    return true;
}

int kek(int x) {
    int prev = x % 10;
    int ten = 1;
    int xx = x;

    while (x > 0) {
        if (abs(x % 10 - prev) > 1) {
            return ten / 10;
        }

        prev = x % 10;
        x /= 10;
        ten *= 10;
    }

    return 0;
}

void solve(int id = 0) {
    for (int i = 1; ; ) {
        int lol = kek(i);

        if (lol == 0)
            --k;

        if (k == 0) {
            cout << i << endl;
            return ;
        }

        if (lol == 0)
            ++i;
        else
            ((i /= lol) *= lol) += lol;
    }
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    srand(time(nullptr));

    int T;
    T = 1;

    while (read())
        solve(T++);

    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define endl '\n'
#define all(x) (x).begin(),(x).end()
const int INF=1e9+5;
const int N=2e5+5;
const int mod=1e9+7;

int x,y,a,b,c;

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin>>x>>y>>a>>b>>c;
	vector<int> p(a);
	vector<int> q(b);
	vector<int> r(c);
	for(int& x:p) cin>>x;
	for(int& x:q) cin>>x;
	for(int& x:r) cin>>x;
	auto cmp=[&](int a,int b){
		return a>b;
	};
	sort(all(p),cmp);
	sort(all(q),cmp);
	sort(all(r),cmp);
	//~ for(int i=0;i<a;++i) cout<<p[i]<<" ";
	//~ cout<<endl;
	//~ for(int i=0;i<b;++i) cout<<q[i]<<" ";
	//~ cout<<endl;
	//~ for(int i=0;i<c;++i) cout<<r[i]<<" ";
	//~ cout<<endl;
	priority_queue<int,vector<int>,greater<int>> pq;
	for(int i=0;i<x;++i) pq.push(p[i]);
	for(int i=0;i<y;++i) pq.push(q[i]);
	//~ priority_queue<int,vector<int>,greater<int>> pq1=pq;
	//~ while(!pq1.empty()){
		//~ cout<<"pq1 top : "<<pq1.top()<<endl;
		//~ pq1.pop();
	//~ }
	for(int i=0;i<c;++i){
		//~ cout<<"r["<<i<<"] = "<<r[i]<<endl;
		if(r[i]>pq.top()){
			pq.pop();
			pq.push(r[i]);
		}
	}
	ll sum=0;
	while(!pq.empty()){
		//~ cout<<"top : "<<pq.top()<<endl;
		sum+=pq.top();
		pq.pop();
	}
	cout<<sum;
	return 0;
}


Measured memory_bytes: 2552
N = gets.to_i
as = gets.split.map(&:to_i)

a_min = as.min
a_max = as.max

ans = 10000000
for i in a_min..a_max do
  temp = 0
  as.each do |a|
    temp += (a-i) ** 2
  end
  ans = temp if temp < ans
end

puts ans

Measured memory_bytes: 1788
/*
 * ARC097_C.cpp
 *
 *  Created on: May 18, 2018
 *      Author: 13743
 */
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<string>
#include<cstring>
using namespace std;
typedef long long lng;
typedef unsigned long long ulng;

#define pb push_back
#define SZ(a) int((a).size())
#define ALL(a) (a).begin(), (a).end
#define FOR(i,a,b) for(int i=(a); i<=(b); ++i)
#define FORD(i,b,a) for(int i=(b); i>=(a); --i)
#define REP(i,n) FOR(i,0,n-1)
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())

lng power(lng b, lng e) {lng sol=1; while(e>0) {if(e&1) {sol=sol*b;} e>>=1; b*= b;} return sol;}

int x[200001];
int order[200001];

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

	REP(i, N) {
		cin >> x[i];
		order[i] = x[i];
	}
	sort(order, order+N);

	int mid = N / 2;
	REP(i, N) {
		int xx = x[i];
		int piv = lower_bound(order, order+N, xx) - order;
		if(piv >= mid) {
			cout << order[mid-1] << "\n";
		}
		else {
			cout << order[mid] << "\n";
		}
	}

	cout << flush;
}






Measured memory_bytes: 3712
#include <iostream>
#include <vector>
#include <functional>
#include <algorithm>
#include <string>
#include <map>
#include <cmath>

using namespace std;

string find(string s, string s12, int N)
{
    string ans = s12;
    for (int i = 1; i <= N; i++)
    {
        if ((s[i % N] == 'o' && ans[i] == 'S') || (s[i % N] == 'x' && ans[i] == 'W'))
        {
            ans += ans[i - 1];
        }
        else if ((s[i % N] == 'o' && ans[i] == 'W') || (s[i % N] == 'x' && ans[i] == 'S'))
        {
            ans += ans[i - 1] == 'S' ? 'W' : 'S';
        }
    }

    if(s12 == ans.substr(N, 2))
    {
        return ans.substr(0, N);
    }
    else
    {
        return "-1";
    }
}

int main()
{
    int N;
    string s;
    string ret;

    cin >> N;
    cin >> s;

    string s12;

    s12 = "SS";
    ret = find(s, s12, N);
    if(ret != "-1")
    {
        cout << ret << endl;
        return 0;
    }
    s12 = "SW";
    ret = find(s, s12, N);
    if (ret != "-1")
    {
        cout << ret << endl;
        return 0;
    }

    s12 = "WS";
    ret = find(s, s12, N);
    if (ret != "-1")
    {
        cout << ret << endl;
        return 0;
    }

    s12 = "WW";
    ret = find(s, s12, N);
    cout << ret << endl;

    return 0;
}


Measured memory_bytes: 772
<?php
  fscanf(STDIN, "%d", $n);
  $x = explode(" ", fgets(STDIN));
  
  $ans = 999999999;
  for ($i=0; $i<=100; $i++) {
    $dist = 0;
    for ($j=0; $j<$n; $j++) {
      $dist += ($i - $x[$j])*($i - $x[$j]);
    }
    $ans = min($ans, $dist);
  }
  echo $ans;
?>


Measured memory_bytes: 4604
//#include <bits/stdc++.h>
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>

using namespace std;

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

    int N;

    cin >> N;

    vector<int> A(N);
    vector<int> B(N);
    vector<int> C(N - 1);

    int count = 0;

    for(int i = 0; i < N; i++) {
        int a;
        cin >> a;
        A[i] = a - 1;
    }
    for(int i = 0; i < N; i++) {
        cin >> B[i];
    }
    for(int i = 0; i < N - 1; i++) {
        cin >> C[i];
    }

    count += B[A[0]];
    int last = A[0];

    for(int i = 1; i < N; i++) {
        count += B[A[i]];
        if(A[i] == last + 1) {
            count += C[A[i - 1]];
        }
        last = A[i];
    }

    cout << count << endl;

}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    int a = Character.getNumericValue(s.charAt(0));
    int b = Character.getNumericValue(s.charAt(1));
    int c = Character.getNumericValue(s.charAt(2));
    int d = Character.getNumericValue(s.charAt(3));
    char[] op = { '+', '-' };
    for (int i = 0; i < 2; i++) {
      for (int j = 0; j < 2; j++) {
        for (int k = 0; k < 2; k++) {
          int tmp = a;
          if (i == 0) {
            tmp += b;
          } else {
            tmp -= b;
          }
          if (j == 0) {
            tmp += c;
          } else {
            tmp -= c;
          }
          if (k == 0) {
            tmp += d;
          } else {
            tmp -= d;
          }
          if (tmp == 7) {
            System.out.println(a + "" + op[i] + "" + b + "" + op[j] + "" + c + "" + op[k] + "" + d + '=' + 7);
            return;
          }
        }
      }
    }

  }
}

Measured memory_bytes: 41204
import sys
import math

def factorization(n):
    arr = []
    temp = n
    for i in range(2, math.ceil(math.sqrt(n))):
        if temp % i == 0:
            count = 0
            while temp % i == 0:
                count += 1
                temp //= i
            arr.append((i, count))

    if temp != 1:
        arr.append((temp, 1))

    if arr == []:
        arr.append((n, 1))

    return arr
        
n = int(sys.stdin.readline().strip())

factors = factorization(n)
ans = str(n) + ":"
for factor, count in factors:
    for i in range(count):
        ans += " " + str(factor)

print(ans)


Measured memory_bytes: 5672
//not acc
#include<bits/stdc++.h>
using namespace std;
#define OUT printf
#define IN scanf
#define i64 long long int//%lld
#define INlld(d) scanf("%lld",&d);
#define OUTlldn(d) printf("%lld\n",d);
#define OUTlld(d) printf("%lld ",d);
#define RT return
int main()
{
    i64 x,c500,c5,h=0;
    INlld(x);
    //cout<<x<<endl;
    if(x ==0)
    {
        OUTlldn(x);
        RT 0;
    }
    c500 = x/500;
    h += (1000*c500);
    x -= c500*500;
    //cout<<c500<<" "<<x<<" "<<h<<endl;
    c5 = x/5;
    h += 5*c5;
    OUTlldn(h);
    RT 0;
}


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

using namespace std;

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

	int summ = 0;
	for (int i = 0; i < s.size(); i++) {
		if (s[i] == '+') { summ++; }
		else {
			summ--;
		}
	}
	cout << summ << endl;
}

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

#define fast                     \
    ios::sync_with_stdio(false); \
    cin.tie(NULL);               \
    cout.tie(NULL)
#define int long long
#define endl '\n'
#define all(a)                   (a).begin(),(a).end()

#define Unique(A)                (A).resize(distance((A).begin(),unique(all((A)))))

using namespace std;

const int N = 2e5 + 77;

vector<int> P[N];
int A[N],B[N];
map<int,string> M;

string Make(int n){
    string s = to_string(n);
    int x = 6-s.length();
    s = string(x,'0') + s;
    return s;
}

int32_t main()
{
    fast;
    int n , m ;cin >> n >> m ;
    for(int i = 0 ; i < m ; ++i){
        int a , b ; cin >> a >> b;
        P[a].push_back(b);
        A[i] = a;
        B[i] = b;
    }

    for(int i=1;i<=n;++i){
        sort(P[i].begin(),P[i].end());
        for(int j = 0 ; j < P[i].size() ; ++j){
            string s = Make(j+1);
            M[P[i][j]] = s;
        }
    }

    for(int i = 0 ;  i < m ; ++i){
        cout << Make(A[i]) << M[B[i]] << endl;
    }
    return 0;
}

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

using namespace std;

int QueryAns, N, K, answer[500009], P[500009], arr[500009], aint[2000017];
bool in_q[500009];
priority_queue < int > PQ;

void Update (int nod, int st, int dr, int pos, int val)
{
    if (st == dr)
    {
        arr[pos] = val, aint[nod] = pos;
        return ;
    }
    int mij = (st + dr) >> 1, f1 = nod << 1, f2 = f1 | 1;
    if (pos <= mij) Update (f1, st, mij, pos, val);
    else Update (f2, mij + 1, dr, pos, val);
    int p1 = aint[f1], p2 = aint[f2];
    if (arr[p1] > arr[p2]) aint[nod] = p1;
    else aint[nod] = p2;
}

void Query (int nod, int st, int dr, int x, int y)
{
    if (x <= st && dr <= y)
    {
        if (x == st) QueryAns = aint[nod];
        else
        if (arr[aint[nod]] > arr[QueryAns]) QueryAns = aint[nod];
        return ;
    }
    int mij = (st + dr) >> 1, f1 = nod << 1, f2 = f1 | 1;
    if (x <= mij) Query (f1, st, mij, x, y);
    if (mij < y) Query (f2, mij + 1, dr, x, y);
}

void Refresh (int i)
{
    int st = max (i * K, 1), dr = min ((i + 1) * K - 1, N);
    if (st > dr) return ;
    Query (1, 1, N, st, dr);
    int pos = QueryAns;
    if (in_q[pos]) return ;
    st = max (pos - K + 1, 1), dr = min (pos + K - 1, N);
    Query (1, 1, N, st, dr);
    if (pos == QueryAns)
    {
        in_q[pos] = 1;
        PQ.push (pos);
    }
}

int main ()
{
//freopen ("input", "r", stdin);
//freopen ("output", "w", stdout);

scanf ("%d %d", &N, &K);
for (int i=1; i<=N; i++)
    scanf ("%d", &P[i]);
for (int i=1; i<=N; i++)
    Update (1, 1, N, i, P[i]);
for (int i=0; i * K <= N; i++)
    Refresh (i);
for (int curr_pos = N; curr_pos >= 1; curr_pos --)
{
    int val = PQ.top ();
    PQ.pop ();
    answer[val] = curr_pos;
    Update (1, 1, N, val, 0);
    Refresh (val / K - 1), Refresh (val / K), Refresh (val / K + 1);
}
for (int i=1; i<=N; i++)
    printf ("%d\n", answer[i]);
return 0;
}


Measured memory_bytes: 16112
/* 
chirag11032000
Chirag Thakur
*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

using ll = long long;
using db = double;
using pii = pair < int, int >;
using pll = pair < ll, ll >;

template < typename T > using OrderedSet = tree < T, null_type, less < T >, rb_tree_tag, tree_order_statistics_node_update >;
template < typename T > using MinPriorityQueue = priority_queue < T, vector < T >, greater < T > >;

#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template < typename Arg1 >
void __f(const char* name, Arg1&& arg1) {
	cerr << name << " : " << arg1 << std::endl;
}
template < typename Arg1, typename... Args >
void __f(const char* names, Arg1&& arg1, Args&&... args) {
	const char* comma = strchr(names + 1, ',');
	cerr.write(names, comma - names) << " : " << arg1 << " | ";
	__f(comma + 1, args...);
}
#else
#define trace(...)
#endif

#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define unique_sort(x) sort(all(x)), x.resize(distance(x.begin(), unique(all(x))))

const db PI = acos(-1);
const ll LINF = LLONG_MAX;
const int INF = INT_MAX, MOD = 1e9 + 7, N = 1e5 + 10;

void test_case();

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	test_case();
	cerr << "Time taken: " << int((clock() * 1000.) / CLOCKS_PER_SEC) << "ms\n";
	return 0;
}

void test_case() {
	int n;
	cin >> n;
	vector < int > v(n);
	int res = 0;
	for (auto &el: v) {
		cin >> el;
		res = __gcd(res, el);
	}
	cout << res << "\n";
}

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

const int MN = 2e5+5;
string s, t;
int h, w, n, i, j, x, y, c, mx;

int main(){
    scanf("%d%d%d%d%d",&h,&w,&n,&x,&y);
    cin >> s >> t;
    for(i=0;i<n;i++){
        if(s[i]=='L') c++;
        mx = max(mx, c);
        if(t[i]=='R'&&y-c+1<=w) c--;
    }
    if(y-mx<1){
        printf("NO\n");
        return 0;
    }
    mx = c = 0;
    for(i=0;i<n;i++){
        if(s[i]=='R') c++;
        mx = max(mx, c);
        if(t[i]=='L'&&y+c-1>0) c--;
    }
    if(y+mx>w){
        printf("NO\n");
        return 0;
    }
    mx = c = 0;
    for(i=0;i<n;i++){
        if(s[i]=='U') c++;
        mx = max(mx, c);
        if(t[i]=='D'&&x-c+1<=h) c--;
    }
    if(x-mx<1){
        printf("NO\n");
        return 0;
    }
    mx = c = 0;
    for(i=0;i<n;i++){
        if(s[i]=='D') c++;
        mx = max(mx, c);
        if(t[i]=='U'&&x+c-1>0) c--;
    }
    if(x+mx>h){
        printf("NO\n");
        return 0;
    }
    printf("YES\n");
    return 0;
}


Measured memory_bytes: 776
#include <iostream>
#include <queue>
#include <string>
#include <algorithm>
using namespace std;

int main()
{
	int n, q;
	cin >> n >> q;
	
	string name;
	int t;
	queue< pair<string,int> > Q;
	for (int i = 0; i < n; i++) {
		cin >> name >> t;
		Q.push(make_pair(name,t));
	}

	pair<string, int> u;
	int end = 0, a;

	while (!Q.empty()) {
		u = Q.front(); Q.pop();
		a = min(u.second, q);
		u.second -= a;
		end += a;
		if (u.second > 0) {
			Q.push(u);
		}
		else {
			cout << u.first << " " << end << endl;
		}
	}

    return 0;
}

Measured memory_bytes: 6284
#include<cstdio>
using namespace std;

int cnt1,cnt2;
int n;

int main(){
	scanf("%d",&n);
	int i;
	for(i=1;i<=n;i++){
		int x;
		scanf("%d",&x);
		if(x%2==1)
			cnt1++;
		if(x%4==0)
			cnt2++;
	}
	if(cnt1==cnt2+1 && n-cnt1-cnt2==0){
		puts("Yes");
		return 0;
	}
	if(cnt1==cnt2+1 && n-cnt1-cnt2!=0){
		puts("No");
		return 0;
	}
	if(cnt1<=cnt2)
		puts("Yes");
	else
		puts("No");
	return 0;
}

Measured memory_bytes: 128
/* *****fireice**** */

#include<bits/stdc++.h>

#define ll long long int
#define ld long double
#define vi vector<int>
#define vc vector<char>
#define vl vector<ll>
#define vii vector<pair<int,int>>
#define vll vector<pair<ll,ll>>
#define pii pair<int,int>
#define pb push_back
#define eb emplace_back
#define el '\n'
#define N 1000000007
#define re return
#define F first
#define S second
#define L length
#define deb(x) cout<<#x<<" "<<x<<el;
#define mp make_pair
#define PI 3.14159265
#define all(a) (a).begin(),(a).end()
#define forup(i,n) for(int i=0;i<n;i++)
#define forf(i,x,n) for(int i=x;i<n;i++)
#define ford(i,n) for(int (i)=(n)-1;i>=0;(i)--)
#define take(a,n) forup(i,n) cin>>a[i];
using namespace std;

int gcdExtended(int a, int b, int *x, int *y)
{
    // Base Case
    if (a == 0)
    {
        *x = 0, *y = 1;
        return b;
    }

    int x1, y1; // To store results of recursive call
    int gcd = gcdExtended(b%a, a, &x1, &y1);

    // Update x and y using results of recursive
    // call
    *x = y1 - (b/a) * x1;
    *y = x1;

    return gcd;
}

ll modInverse(int a, int m)
{
    int x, y;
    int g = gcdExtended(a, m, &x, &y);
        // m is added to handle negative x
    ll res = ((ll)x%m + (ll)m) % m;

    return res;
}

ll poww(ll x,ll n)
{
    if(n==0)
        return 1;
    else if(n==1) return x;
    else if(n%2 == 0)        //n is even
        return poww(x*x,n/2);
    else                              //n is odd
        return x*poww(x*x,(n-1)/2);
}

ll modularExponentiation(ll x,ll n,ll M)
{
    ll result=1;
    while(n>0)
    {
        if(n % 2 ==1)
            result=(result * x)%M;
        x=(x*x)%M;
        n=n/2;
    }
    return result;
}

template<typename T>
T maxx(T a,T b)
{
  if(a<b) re b;
  re b;
}
template<typename T, typename... Args>
T maxx(T a,T b, Args... args)
{
    re(maxx(maxx(a,b),args...));
}

template<typename T>
T minn(T a,T b)
{
  if(a<b) re a;
  re b;
}
template<typename T, typename... Args>
T minn(T a,T b, Args... args)
{
    re(minn(minn(a,b),args...));
}

template<typename T>
void read(T& a)
{
  cin>>a;
}
template<typename T, typename... Args>
void read(T& a,Args&... args)
{
  cin>>a; read(args...);
}

template<typename T>
void write(T a)
{
  cout<<a<<' ';
}
template<typename T, typename... Args>
void write(T a,Args... args)
{
  cout<<a<<' '; write(args...);
}

inline ll min(ll a,ll b)
{
  if(a<b) re a;
  else re b;
}
inline ll max(ll a,ll b)
{
  if(a<b) re b;
  else re a;
}

ll gcd(ll a, ll b)
{
    if (a == 0)
       return b;
    if (b == 0)
       return a;

    if (a == b)
        return a;

    if (a > b)
        return gcd(a-b, b);
    else return gcd(a, b-a);
}

ll ncr(int n,int r)
{
  ll ans=1;
  r=min(r,n-r);
  forup(i,r)
  {
    ans=((ans*((n-i)%N))%N*modInverse(i+1,N))%N;
  }
  re ans;
}

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

  int t=1;
  //cin>>t;
  while(t--)
  {
    ll n,m,k;
    cin>>n>>k;
    m=0;
    for(ll i=k;i<=n+1;i++)
    {
      m+=(i)*n-(i*(i-1)-1);
      m%=N;
    }


    cout<<m;

  }


  return 0;
}


Measured memory_bytes: 3612
def extract_6(x):
	strtemp=' '
	if(len(x)>=6):
		temp=[0]*6
		for i in range(6):
			temp[i]=x[len(x)-6+i]
	else:
		temp='false'
	strtemp=''.join(temp)
	return(strtemp)

def extract_5(x):
	strtemp=' '
	if(len(x)>=5):
		temp=[0]*5
		for i in range(5):
			temp[i]=x[len(x)-5+i]
	else:
		temp='false'
	strtemp=''.join(temp)
	return(strtemp)
	
def extract_7(x):
	strtemp=' '
	if(len(x)>=7):
		temp=[0]*7
		for i in range(7):
			temp[i]=x[len(x)-7+i]
	else:
		temp='false'
	strtemp=''.join(temp)
	return(strtemp)

S=input()
flag=1
while(flag==1):
	if(extract_7(S)=='dreamer'):
		S=S[:-7]
	elif(extract_6(S)=='eraser'):
		S=S[:-6]
	elif(extract_5(S)=='dream'):
		S=S[:-5]
	elif(extract_5(S)=='erase'):
		S=S[:-5]
	else:
		flag=0
if len(S)!=0:
	print('NO')
else:
	print('YES')

Measured memory_bytes: 3316
// Create: 2018-03-24 09:13:28
#include <bits/stdc++.h>

using namespace std;

int n;

int query(int id)
{
	string s;
	cout << id << endl << flush;
	cin >> s;
	if(s == "Vacant") exit(0);
	return s == "Male";
}

int s;

bool normal(int i, int j)
{
	return (s != j) == (i&1);
}

void work()
{
	int l = 0, r = n - 1;

	s = query(0);

	while(l <= r)
	{
		int m = (l + r) / 2;
//		cout<<l<<" "<<r<<" "<<m<<endl;
		int res = query(m);
		if(normal(m, res)) {
			l = m + 1;
		} else {
			r = m - 1;
		}
	}
}

int main()
{
//	srand(time(NULL));
	cin >> n;

	work();

	return 0;
}


Measured memory_bytes: 852
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
  int s,tmp;
  vector<int> a;
  cin >> s;
  tmp = s;
  int cnt = 0;
  a.push_back(tmp);
  while(1){
    cnt++;

    if(s%2 == 0){
      s = s/2;
    }
    else{
      s = 3*s + 1;
    }
    if(a.end() != find(a.begin(), a.end(), s)){
      break;
    }
    else{
      tmp = s;
      a.push_back(tmp);
    }
  }

  cout << cnt+1 << endl;
  return 0;
}


Measured memory_bytes: 256
while True :
    m,f,r = map(int,input().split())
    if(m==-1 and f==-1 and r==-1): break
    if(m==-1 or f== -1):
        print("F")
    elif(m+f>=80):
        print("A")
    elif(m+f<80 and m+f>=65):
        print("B")
    elif(m+f<65 and m+f>=50):
        print("C")
    elif(m+f<50 and m+f>=30 and r>=50):
        print("C")
    elif(m+f<50 and m+f>=30 and r<50):
        print("D")
    else:
        print("F")



Measured memory_bytes: 5592
N=input()
S=raw_input()

l=[ 0 for i in range(N)]
r=[ 0 for i in range(N)]

for i in range(N-1):
	if S[i]=="W":
		l[i+1]=l[i]+1
	else:
		l[i+1]=l[i]

for i in range(N-1,0,-1):
	if S[i]=="E":
		r[i-1]=r[i]+1
	else:
		r[i-1]=r[i]


ans=float("inf")
for i,j in zip(l,r):
	ans=min(ans,i+j)
print ans

Measured memory_bytes: 45716
#include<iostream>
#include<string>
using namespace std;
int main()
{
    string s,t;
    cin >> s >> t;
    string temp;
    bool flag = false;
    int len = s.length();
    for(int i = len; i > 0; i--)
    {
        temp = s.substr(i, len-i) + s.substr(0,i);
        if(temp == t)
        {
            flag = true;
            break;
        }
    }
    if(flag == false)
        cout << "No" << endl;
    else
        cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int x1 = Integer.parseInt(scan.next());
        int x2 = Integer.parseInt(scan.next());
        int x3 = Integer.parseInt(scan.next());
        int x4 = Integer.parseInt(scan.next());
        int x5 = Integer.parseInt(scan.next());
        scan.close();

        if (x1 == 0) {
            System.out.println(1);
        } else if (x2 == 0) {
            System.out.println(2);
        } else if (x3 == 0) {
            System.out.println(3);
        } else if (x4 == 0) {
            System.out.println(4);
        } else {
            System.out.println(5);
        }

    }
}


Measured memory_bytes: 35640
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = [int(i) for i in list(input())]
length = len(N)

for l in N[1:]:
    if not l==9:
        ans = (length-1)*9+(N[0]-1)
        print(ans)
        break
else:
    print(sum(N))


Measured memory_bytes: 61816
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
typedef tuple<string,int,int> tup; 
int main(){
  int N;
  cin >> N;
  tup t[N];
  rep(i,N){
    string s;
    int a;
    cin >> s >> a;
    a=100-a;
    t[i]=tup(s,a,i);
  }
  sort(t,t+N);
  rep(i,N){
    cout << get<2>(t[i])+1 << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
    int n,y;
    while(cin>>n>>y)
    {
        int l1=(y-1000*n)/9000,l2=(y-1000*n)/4000,flag=1;
        for(int i=0;i<=l1;i++)
        {
            for(int j=0;j<=l2;j++)
            {
                if((9000*i+4000*j)==(y-1000*n)&&n-i-j>=0)
                {
                    flag=0;
                    cout<<i<<" "<<j<<" "<<n-i-j<<endl;
                    break;
                }
           }
           if(!flag)
            break;
        }
        if(flag)
            cout<<"-1 -1 -1\n";
    }
    return 0;
}


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

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

  int sum = 0;

  for (int n = 0; n < S.size(); n++){
    int d = (int)(S[n] - '0');
    sum += d;
  }

  cout << (sum % 9 == 0 ? "Yes" : "No") << endl;
  
  return 0;
}


Measured memory_bytes: 3748
#include<stdio.h>
 
int main(void)
{
 int i,j;
 for(i = 1; i <= 9; i++)
 {
  for(j = 1; j <= 9; j++)
   {
    printf("%dx%d=%d\n",i,j,i*j);
   }
 }
 return 0;
}

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

public class Main {

    public static void main(String[] args) {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

        try {
            int week = Integer.valueOf(in.readLine());
            int debt = 100000;

            for (int i = 0; i < week; i++) {

                debt = (int) (debt * 1.05);

                if (debt % 1000 > 0) {
                    debt = (debt / 1000 + 1) * 1000;
                }
            }

            System.out.println(debt);
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                in.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}

Measured memory_bytes: 16868
#include<cstdio>
#include<cstring>
#include<iostream>
const int MAXN=1010;
const int MOD=1e9+7;

bool p[MAXN][MAXN];
int n,m;
int f[MAXN][MAXN];

int main(){
	scanf("%d%d",&n,&m);
	f[1][1]=1;
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++){
			char c;std::cin>>c;
			p[i][j]=(c=='.');
			if(i==1&&j==1)
				continue;
			if(p[i][j])
				f[i][j]=(f[i-1][j]*p[i-1][j]+f[i][j-1]*p[i][j-1])%MOD;
		}
	printf("%d\n",f[n][m]);
	return 0;
}

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

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		while(true) {
			int n = sc.nextInt();
			if(n == 0) break;
			
			int[] score = new int[n];
			for(int i = 0; i < n; i++) score[i] = sc.nextInt();
			Arrays.sort(score);
			
			int min = 1000000;
			for(int i = 0; i < n - 1; i++) {
				int diff = score[i+1] - score[i];
				if(diff < min) min = diff;
			}
			System.out.println(min);
		}
	}

}



Measured memory_bytes: 47132
#include <bits/stdc++.h>
#define int long long
#define ld long double
#define endl '\n'
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define vpii vector<pii>
#define gr vector<vpii>
#define str string
#define mask vector<bool>
#define fi first
#define se second
#define sz(x) (int)((x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define GAME_OVER return 0
using namespace std;
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    int n;
    cin >> n;
    vi a(n);
    for (int& i : a)
        cin >> i;
    set<int> s(all(a));
    cout << (sz(s) == n ? "YES" : "NO") << endl;
    GAME_OVER;
}

Measured memory_bytes: 11264
#include <bits/stdc++.h>
#define int long long 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define re(x) cout<<(#x)<<" is "<<(x)<<"\n"; 
#define gif(a,b) ((a)/(b)+((a)%(b)?1:0))
using namespace std;

int32_t main()
{
	IOS
	int T = 1; 
	//cin >> T;  
	for (int t = 0; t < T; ++t)
	{
		int x, k, d;
		cin >> x >> k >> d;
		x = abs(x);
		int w = x/d;
		if(k >= w)
		{
			if((k % 2 )^ (w % 2 ))
				w++;
			x -= w*d;
		}
		else
		{
			x -= d*k;
		}
		cout << abs(x);
	}
	return 0;
}
//if not working? go ahead.

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

int main() {
  long long n, m;
  cin >> n >> m;
  
  if (n >= m/2) {
    cout << m/2 << endl;
  } else {
    long long i = (m/2 - n)/2;
    cout << n + i << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <time.h>
#define int long long int
#define pb push_back
#define mem(a, x) memset(a, x, sizeof a)
#define all(a) a.begin(), a.end()
#define scnarr(a, n) for (int i = 0; i < n; ++i) cin >> a[i]
#define vi vector<int>
#define si set<int>
#define pii pair <int, int>
#define sii set<pii>
#define vii vector<pii>
#define mii map <int, int>
#define faster ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
using namespace std;
using namespace chrono;
/*
	----------------------------------------------------------------------
	Things to remember : check for coners n = 1, pass references instead
*/
/* -------------------------------Solution Sarted--------------------------------------*/

//Constants
const int MOD = 1000000007; // 1e9 + 7
const int MAXN = 1000005; // 1e6 +5
const int INF = 100000000000005; // 1e15 +5

void solve(){
	int n;
	cin >> n;
	cout << !n << endl;
	
}

signed main()
{
	faster;
#ifndef ONLINE_JUDGE
	freopen("ip.txt", "r", stdin);
	freopen("op.txt", "w", stdout);
#endif
	// int t; cin >> t; while(t--)
		solve();
	return 0;
}


//Author : Ankit Raj
//Problem Link :

/*Snippets*/
/*
sieve - prime factorization using sieve and primes in range
zpower - pow with mod
plate - Initial template
bfs 
dfs
fenwik - BIT
binary_search
segment_tree
*/
	

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
const int N=5e5;

  int n,m,k;
  int a[N];
int main()
{
  cin>>n>>m;
  for (int i=0;++i<=n;)
    scanf("%d",a+i);
  for (int i=0;++i<n;)
    if (a[i]+a[i+1]>=m)
      k=i;
  if (!k)
	  puts("Impossible"),exit(0);
	else
	  puts("Possible");
  for (int i=0;++i<k;)
		printf("%d\n",i);
	for (int i=n;--i>k;)
	  printf("%d\n",i);
  cout<<k;
  exit(0);
}

Measured memory_bytes: 1152
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<cassert>
#include<cassert>
#include<unordered_map>
#include<unordered_set>
#include<functional>
#include<queue>
#include<stack>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<sstream>
#include<iomanip>
#include<cstdio>
#include<cstdlib>
#include<numeric>
#include<random>
#include<chrono>
#include<bitset>
using namespace std;

#define all(x) (x).begin(), (x).end()
#define pb push_back
#define xx first
#define yy second
#define sz(x) (int)(x).size()
#define gc getchar
#define IO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define mp make_pair

#ifndef ONLINE_JUDGE
#  define LOG(x) (cerr << #x << " = " << (x) << endl)
#else
#  define LOG(x) ((void)0)
#endif

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

const double PI=3.1415926535897932384626433832795;
const ll INF = 1LL<<62;
const ll MINF = -1LL<<62;

template<typename T> T getint() {
	T val=0;
	char c;
	
	bool neg=false;
	while((c=gc()) && !(c>='0' && c<='9')) {
		neg|=c=='-';
	}

	do {
		val=(val*10)+c-'0';
	} while((c=gc()) && (c>='0' && c<='9'));

	return val*(neg?-1:1);
}

//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); uniform_int_distribution<int>(0, n-1)(rng)

int n,m;
string t[101];

int dp[101][101];

int main() {
	IO;
	cin>>n>>m;
	for(int i=0;i<n;++i) cin>>t[i];
	dp[0][0]=t[0][0]=='#';
	for(int i=0;i<n;++i) {
		for(int j=0;j<m;++j) {
			if(i==0 && j==0) continue ;
			dp[i][j]=1e9;
			if(i>0) {
				dp[i][j]=min(dp[i][j], dp[i-1][j]+(t[i][j]=='#')-(t[i][j]=='#'&&t[i-1][j]=='#'));
			}
			if(j>0) {
				dp[i][j]=min(dp[i][j], dp[i][j-1]+(t[i][j]=='#')-(t[i][j]=='#'&&t[i][j-1]=='#'));
			}
		}
	}
	
	cout<<dp[n-1][m-1]<<"\n";
	return 0;
}


Measured memory_bytes: 384
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <iomanip>
#include <cassert>

using namespace std;
typedef long long ll;

int main(){
   int N;
   cin >> N;
   int A[N];
   for (int i = 0; i < N; i++)
   {
      cin >> A[i];
      A[i]--;
   }
   int arrived[N];
   memset(arrived,0,sizeof(arrived));
   int cur = 0;
   int ans = 0;
   while(cur!=1){
      if(arrived[cur]>0){
         cout << -1 << endl;
         return 0;
      }
      arrived[cur]++;
      ans++;
      cur = A[cur];
   }
   cout << ans << endl;

   return 0;
}


Measured memory_bytes: 4404
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

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

  if(a >= 3200){
    cout << s << endl;
  } else {
    cout << "red" << endl;
  }

  return 0;
}


Measured memory_bytes: 256