akhauriyash/Code-Regression huggingface dataset:
n = gets.chomp.to_i
arr = []
(0...n).each do |i|
  arr[i] = gets.chomp.to_i
end

@count = 0
@g_arr = []

def insertion_sort(arr, n, g)
  (g..n-1).each do |i|
    v = arr[i]
    j = i - g
    while j >= 0 && arr[j] > v
      arr[j + g] = arr[j]
      j -= g
      @count += 1
    end
    arr[j + g] = v
  end
end

def shell_sort(arr, n)
  h = 1
  while h <= n
    @g_arr.unshift(h)
    h = h * 3 + 1
  end

  @g_arr.each do |g|
    insertion_sort(arr, n, g)
  end
end

shell_sort(arr, n)
print "#{@g_arr.count}\n#{@g_arr.join(' ')}\n#{@count}\n"
arr.each do |obj|
  print "#{obj}\n"
end



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

int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;

  if (A+B > C+D) {
    cout << "Left" << endl;
  }
  else if (A+B == C+D) {
    cout << "Balanced" << endl;
  }
  else {
    cout << "Right" << endl;
  }
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func scanInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func intMax(x, y int) int {
	return int(math.Max(float64(x), float64(y)))
}

func main() {
	sc.Split(bufio.ScanWords)

	N := scanInt()
	F := make([][10]int, N)
	for i := 0; i < N; i++ {
		for j := 0; j < 10; j++ {
			F[i][j] = scanInt()
		}
	}
	P := make([][11]int, N)
	for i := 0; i < N; i++ {
		for j := 0; j <= 10; j++ {
			P[i][j] = scanInt()
		}
	}

	ans := -int(math.Pow10(9))
	for i := 1; i < (1 << 10); i++ {
		tmp := 0
		for j := 0; j < N; j++ {
			cnt := 0
			for k := 0; k < 10; k++ {
				if F[j][k] == 1 && i&(1<<k) > 0 {
					cnt++
				}
			}
			tmp += P[j][cnt]
		}
		ans = intMax(ans, tmp)
	}

	fmt.Println(ans)
}


Measured memory_bytes: 1808
#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

typedef long long ll;
//typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector<vector<int>> mat;
//typedef unsigned int uint;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;



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

	int A[3];
	rep(i, 0, 3)
	{
		cin >> A[i];
	}

	sort(A, A + 3);

	cout << A[0] + A[1] + 10 * A[2] << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define assem99 ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long
#define ld long double
#define endll '\n'
#define sz(a) (int)(a).size()
#define RWFile freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
int dx[] = { 0, -1, 0, 1, -1, 1, -1, 1 };
int dy[] = { -1, 0, 1, 0, 1, -1, -1, 1 };
const int MOD = 1e9 + 7, N = 2e6 + 5, oo = 1e9;
const double pi = acos(-1);
using namespace std;

int n;
ld arr[N], dp[3005][3005];
bool vis[3005][3005];
ld solve(int id, int cnt)
{
    if(id == n) return cnt == 0;
    if(vis[id][cnt]) return dp[id][cnt];
    ld ans = 0;
    ans += solve(id + 1, cnt - 1) * arr[id];
    ans += solve(id  + 1, cnt) * (1 - arr[id]);
    vis[id][cnt] = true;
    return dp[id][cnt] = ans;
}

int main()
{
    assem99
    cin>>n;
    ld ans = 0;
    for(int i = 0; i < n; i++) cin>>arr[i];
    for(int i = n / 2; i < n; i++) ans += solve(0, i + 1);
    cout<<fixed<<setprecision(10)<<ans;

    return 0;
}

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

using namespace std;

int main(){
	int N;
	
	cin >> N;
	
	string S[N];
	vector<int> P(N);
	string sbuf;
	int pbuf;
	
	for(int i=0; i<N; i++){
		cin >> S[i] >> P[i];
	}
	
	string cS[N](S);
	vector<int> cP(P);
	
	for(int i=0; i<N; i++){
		for(int j=0; j<N; j++){
			if(cS[i]==cS[j] && cP[i]>cP[j]){
				sbuf=cS[i];
				cS[i]=cS[j];
				cS[j]=sbuf;
				pbuf=cP[i];
				cP[i]=cP[j];
				cP[j]=pbuf;
			}else if(cS[i]<cS[j]){
				sbuf=cS[i];
				cS[i]=cS[j];
				cS[j]=sbuf;
				pbuf=cP[i];
				cP[i]=cP[j];
				cP[j]=pbuf;
			}
		}
	}
	
	for(int i=0; i<N; i++){
		for(int j=0; j<N; j++){
			if(cP[i]==P[j]){
				cout << j+1 << endl;
			}
		}
	}
	
	return 0;
}

Measured memory_bytes: 256
def resolve():
    n = int(input())
    A = list(map(int, input().split()))
    max_a = max(A)
    m = set()
    checked = set()
    duplicated = set()

    for a in A:
        if a in checked:
            duplicated.add(a)
            continue

        i = 2
        while a*i <= max_a:
            m.add(a*i)
            i += 1

        checked.add(a)

    ans = 0
    for a in A:
        if a in duplicated: continue

        if a not in m:
            ans += 1
    
    print(ans)
 
resolve()

Measured memory_bytes: 172592
il = lambda: list(map(int, input().split()))
ils = lambda n, s="int(input())": [eval(s) for _ in range(n)]

n, m = il()
l = ils(m, "il()")
l.sort(key=lambda x: x[1])
ans = 0
cur = 0
for i in range(m):
    if l[i][0] >= cur:
        cur = l[i][1]
        ans += 1
print(ans)

Measured memory_bytes: 22892
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String o = sc.next();
		String e = sc.next();
		if(o.length()==e.length()) {
			for(int i = 0; i<o.length(); i++) {
				System.out.print(o.charAt(i));
				System.out.print(e.charAt(i));
			}
		}
		else {
			for(int i = 0; i < o.length(); i++) {
				if(i == o.length()-1) {
					System.out.print(o.charAt(i));
				}
				else {
				System.out.print(o.charAt(i));
				System.out.print(e.charAt(i));
				}
			}
		}
	}
}

Measured memory_bytes: 25172
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
#include<cassert>
#include<numeric>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
const int INF = 1001001001;
const long long LINF = 1001002003004005006ll;
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; }
typedef long long ll;
typedef pair<int,int> P;

int main(){
    int n;
    cin >> n;
    int a[n];
    rep(i,n)cin >> a[i];
    int s=0;
    rep(i,n)s^=a[i];
    rep(i,n){
        cout << (s^a[i]) << ' ';
    }
    cout << endl;
}

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

int main()
{
    string s;
    cin >> s;
    int n = s.length();
    ll sum = 0;
    ll ans = 0;
    ll temp;
    for (int bit = 0; bit < (1<<(n-1)); bit++) {
        temp = s[0]-'0';
        sum = 0;
        for (int i = 0; i < (n-1); i++) {
            if (bit & (1<<i)) {
                sum += temp;
                temp = s[i + 1] - '0';
            } else {
                temp *= 10;
                temp += s[i + 1] - '0';
            }
        }
        sum += temp;
        ans += sum;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
# coding: utf-8
from decimal import Decimal, ROUND_DOWN, ROUND_UP


def solve(*args: str) -> str:
    n = Decimal(args[0])
    rate = Decimal(1.08)
    x_u = (n/rate).quantize(Decimal('0'), rounding=ROUND_UP)
    x_d = (n/rate).quantize(Decimal('0'), rounding=ROUND_DOWN)

    ret = ''
    if x_u == x_d:
        ret = str(x_u)
    elif (x_u*rate).quantize(Decimal('0'), rounding=ROUND_DOWN) == n:
        ret = str(x_u)
    elif (x_d*rate).quantize(Decimal('0'), rounding=ROUND_DOWN) == n:
        ret = str(x_d)
    else:
        ret = ':('

    return ret


if __name__ == "__main__":
    print(solve(*(open(0).read().splitlines())))


Measured memory_bytes: 5332
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <string>
#include <vector>
#include <cstdlib>
#include <utility>
#include <map>

using namespace std;

int main(){
    int n, k;
    cin >> n >> k;
    long long int ans = 0;
    if(k % 2 != 0){
        int a = n / k;
        ans = pow(a, 3);
    }else{
        long long int a = n / k;
        long long int b = (2 * n / k) -  a;
        ans = pow(a, 3) + pow(b, 3);
    }
    cout << ans;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class t>
using table = vector<vector<t>>;
const ld eps=1e-9;

//// < "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\a.txt" > "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\b.answer"
int main() {
	complex<ld>way(0,1);
	complex<ld>now(0, 0);
	while (1) {
		int a, b;
		scanf("%d,%d", &a, &b);
		if (!a&&!b)break;
		now += way*ld(a);
		ld theta = -ld(b) / 180 * acos(-1);
		way *=complex<ld>(cos(theta),sin(theta));

	}
	cout << int(now.real()) << endl << int(now.imag()) << endl;
	return 0;
}

Measured memory_bytes: 3428
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<map>
#include<cmath>
#include<iomanip>
#include<set>
#include<string>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rrep(i, st, n) for (int i = st; i < n; ++i)
using pii = pair<int, int>;
//const int inf = 1e9 + 7;

int main() {
    ll a, b, c, k; cin >> a >> b >> c >> k;
    if (k % 2 == 0) cout << a - b << endl;
    else cout << b - a << endl;
    
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <numeric>
#include <set>
#include <string>
#include <vector>

using namespace std;
using LLONG = long long;

int main()
{
    int N, M;
    cin >> N >> M;
    vector<pair<LLONG, LLONG>> datas;
    for (int i = 0; i < N; ++i)
    {
        int Ai, Bi;
        cin >> Ai >> Bi;
        datas.push_back({ Ai, Bi });
    }
    sort(datas.begin(), datas.end());
    int rem = M;
    LLONG cost = 0;
    for (const auto &data : datas)
    {
        if (rem == 0)
        {
            break;
        }
        if (data.second <= rem)
        {
            rem -= data.second;
            cost += data.first * data.second;
        }
        else
        {
            cost += data.first * rem;
            break;
        }
    }
    cout << cost << endl;
}


Measured memory_bytes: 2420
cards = []
i = 0
while True:
    a = input()
    if a == "-":
        break
    cards.append(a)
    m = int(input())
    h = []
    for j in range(m):
        h.append(int(input()))
    for j in h:
        cards[i] = cards[i][j:] + cards[i][:j]
    i += 1
for i in cards:
    print(i)


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

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
const int INF_N = 1e+9;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

//繰り返し二乗法
ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

//逆元(Eucledean algorithm)
ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };


vector<pair<char, int>> run_length_encoding(const string &s) {
    vector<pair<char, int>> ans;

    int num = 1;
    for (int i = 0; i < (int)s.size() - 1; ++i) {
        if (s[i] == s[i + 1]) {
            num++;
        }
        else {
            ans.emplace_back(make_pair(s[i], num));
            num = 1;
        }
    }
    ans.emplace_back(make_pair(s.back(), num));

    return ans;
}

void solve() {
    int N; cin >> N;
    string S; cin >> S;

    auto pv = run_length_encoding(S);

    cout << pv.size() << endl;
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout << fixed << setprecision(10);
  //init_f();
  //init();
  //int t; cin >> t; rep(i, t)solve();
  solve();
//   stop
    return 0;
}


Measured memory_bytes: 5576
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cassert>
#include <complex>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <sstream>
#include <ctime>
#include <cctype>
#include <set>
#include <map>
#include <queue>
#include <bitset>
#include <deque>
#include <stack>
#include <memory.h>
using namespace std;
typedef long long ll;
#define mp make_pair
string s;
int main(){
	cin>>s;
	cout<<s.substr(0,3);
	return 0;
}


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

#define endl '\n'
#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define F(i,j,k) fill(i[0],i[0]+j*j,k)
#define P(p) cout<<(p)<<endl;
#define SORT(v) sort(all(v))
#define SORTD(v) sort(all(v), greater<int>())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define INF 1<<30
#define v(T) vector<T>
#define vv(T) v(v(T))
#define print(x) cout<<x<<endl
#define printv(v) for(auto i : v){cout<<i<<" ";}cout<<endl
#define printu(v) for(auto i : v){print(i);}
#define readv(v, n) for (int i=0;i<n;i++)cin >> v[i]
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<double> vd;
typedef pair<int,int> pii;
typedef pair<long,long> pll;
typedef long long ll;

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

int i, j, k;
int dq[100][100];
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	int h, w;
	int n;
	cin >> h >> w;
	cin >> n;
	int h_index = 0;
	int w_index = 0;
	bool flg = true;
	rep(i, n) {
		int v;
		cin >> v;
		rep(j, v) {
			dq[h_index][w_index] = i + 1;
			if (flg) {
				w_index++;
				if (w_index >= w) {
					h_index++;
					w_index = w - 1;
					flg = false;
				}
			} else {
				w_index--;
				if (w_index < 0) {
					h_index++;
					w_index = 0;
					flg = true;
				}
			}
		}
	}
	rep(i, h) {
		rep(j,w) {
			cout << dq[i][j] << " ";
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

int main() {
    string s;
    cin >> s;
    int n = s.length();
    VI a(n);
    REP(i,n){
        if (s[i] == 'A' || s[i] == 'G' || s[i] == 'C' || s[i] == 'T') a[i] = 1;
    }

    int x = 0, ans = 0;
    REP(i,n){
        if (a[i]) x++;
        else x = 0;
        ans = max(ans, x);
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] $) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.nextLine());
        String in = sc.nextLine();
        StringBuilder builder = new StringBuilder();
        for(char c : in.toCharArray()){
            builder.append(Character.toChars(rot13(c,n)));
        }
        System.out.println(builder.toString());
    }

    private static int rot13(int c,int n){
        if ((c >= 'A') && (c <= 'Z'))
            c=(((c-'A') + n) % 26)+'A';
        if ((c >= 'a') && (c <= 'z') )
            c=(((c-'a') + n) % 26)+'a';
        return c;
    }
}

Measured memory_bytes: 23892
#include<bits/stdc++.h>
using namespace std;
int main(){
  int sx, sy, tx, ty; cin >> sx >> sy >> tx >> ty;
  int dx = tx - sx, dy = ty - sy;
  cout << string(dx, 'R') << string(dy, 'U');
  cout << string(dx, 'L') << string(dy, 'D');
  dx++; dy++;
  cout << 'D' << string(dx, 'R') << string(dy, 'U') << 'L';
  cout << 'U' << string(dx, 'L') << string(dy, 'D') << 'R';
}

Measured memory_bytes: 256
use std::collections::HashSet;
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!{
        x:usize,
        y:usize
    }
    let mut groupa : HashSet<_> = [1, 3, 5, 7, 8, 10, 12].iter().cloned().collect();
    let mut groupb : HashSet<_> = [4, 6, 9, 11].iter().cloned().collect();
    let mut groupc : HashSet<_> = [2].iter().cloned().collect();
    if (groupa.contains(&x) && groupa.contains(&y)) || (groupb.contains(&x) && groupb.contains(&y)) || (groupc.contains(&x) && groupc.contains(&y)) {
        println!("Yes");
    }else{
        println!("No");
    }
}


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

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
typedef pair<int, int> pii;
typedef vector<int> vi;
using ll = long long;

const int INF = (int) 1e9 + 9;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, k, sum = 0;
    cin >> n >> k;
    int h[n];
    rep(i,0,n) {
        cin >> h[i];
        if (h[i] >= k) sum++;
    }
    cout << sum << '\n';
    return 0;
}

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

int main() {
  int N;
  cin >> N;
  int x = 0, M = N;
  
  while (N > 0){
    x += N%10;
    N /= 10;
  }
  
  if (M % x == 0){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}



Measured memory_bytes: 3596
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<string>
#include<cstring>
#include<cmath>
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pi 2*acos(0.0)

vector<int>prime(1000005,0);
vector<int>prime1(1000005,0);
vector<int>mark(1000005,0);
int nprime;

void sieve(int n)
{
    int limit=sqrt(n*1.0)+1,s=0;nprime=0;
    mark[1]=1;///1 if not prime.
    mark[2]=0;prime[nprime++]=2;
    for(int i=4;i<=n;i+=2)mark[i]=1;
    for(int i=3;i<=n;i+=2){
        if(!mark[i]){prime[nprime++]=i;
        if(i<=limit){///karon limit er upor theke n porjonto not prime gula already cuta hoise.
            for(int j=i*i;j<=n;j+=i*2){
                mark[j]=1;
            }
        }}
    }
//    for(int x=2;x<=n;x++){
//        if(!mark[x]){s++;prime1[x]=s;}
//        else prime1[x]=s;
//    }
    //return nprime;
}

int main()
{
    ll t,t1,a,b,c,d,D,q,s=0,s1=0,s2=0,s3=0,x4;
    //ll n,k,m[100000],m1[100000],e,x,x1,x2,x3,x5;
    cin>>x4;
    sieve(100005);
    while(1){
        if(!mark[x4]){cout<<x4<<endl;break;}
        else x4++;
    }

    return 0;
}


Measured memory_bytes: 12032
#include <bits/stdc++.h>
#include <vector>
#include <numeric>
#define PI 3.14159265358979323846
#define MAXINF (1e18L)
#define INF (1e9L)
#define EPS (1e-9)
#define MOD (1e9+7)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define ALL(v) v.begin(),v.end()
#define FIND(v,x) (binary_search(ALL(v),(x)))
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v));reverse(ALL(v))
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define pb push_back
#define fi first
#define se second
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;

int main(void)
{
    ll n,m;
    cin >> n >> m;
    ll s,t;
    cin >> s >> t;
    s--;t--;

    vector<vector<pair<ll, pll>>> d(n);
    REP(i, m){
        ll u,v;
        cin >> u >> v;
        ll a,b;
        cin >> a >> b;
        u--;v--;
        d[u].pb(make_pair(v, make_pair(a,b)));
        d[v].pb(make_pair(u, make_pair(a,b)));
    }

    vector<ll> yen(n, MAXINF);
    vector<ll> snk(n, MAXINF);

    priority_queue<pll, vector<pll>, greater<pll>> p;
    p.push(pll(s, 0));
    while(p.size()){
        pll f = p.top();p.pop();
        if(yen[f.fi] > f.se) yen[f.fi] = f.se;
        else continue;
        for(auto v : d[f.fi]){
            ll value = f.se + v.se.fi;
            if(value < yen[v.fi]) p.push(pll(v.fi, value));
        }
    }
    p = priority_queue<pll, vector<pll>, greater<pll>>();
    p.push(pll(t, 0));
    while(p.size()){
        pll f = p.top();p.pop();
        if(snk[f.fi] > f.se) snk[f.fi] = f.se;
        else continue;
        for(auto v : d[f.fi]){
            ll value = f.se + v.se.se;
            if(value < snk[v.fi]) p.push(pll(v.fi, value));
        }
    }
    vector<ll> ans(n+1,MAXINF);
    RREP(i, n){
        ans[i]=min(ans[i+1], yen[i] + snk[i]);
    }
    // REP(i, n){
    //     ans[i] = yen[i] + snk[i];
    // }
    // SORT(ans);
    REP(i, n){
        pr(1'000'000'000'000'000 - ans[i]);
    }
}

Measured memory_bytes: 24644
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<int,int>
#define pll pair<ll int,ll int>
#define pb push_back
#define vec vector <int>
#define ub upper_bound
#define lb lower_bound
#define bs binary_search
#define bg begin()
#define en end()
#define endl "\n"
#define ff first
#define ss second
#define all(x) x.bg,x.en
#define fill(a,b) memset(a,b,sizeof(a))
#define fr(i,n) for(int i=0;i<n;i++)
#define rp(i,a,b) for(int i=a;i<b;i++)
#define rr(i,a,b) for(int i=a;i>=b;i--)
#define ft(it,x) for(auto it : x)
#define dbg(x) cerr<<#x<<" "<<x<<endl;
#define dbga(arr,n) cerr<<#arr<<": "; rep(tt,0,n)cerr<<arr[tt]<<" "; cerr<<endl;
#define mapi map<int,int>
#define mapl map<ll int,ll int>
#define test(t) int t;cin>>t;while(t--)
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
const int mod=1e9+7;
const int mex=100005;
int main()
{
    fast
    ll int n,w;
    cin>>n>>w;
    ll int val[n],wt[n];
    fr(i,n) cin>>wt[i]>>val[i];
    ll int dp[mex][n];
    fr(i,n)
    {
        fr(j,mex) dp[j][i]=INT_MAX;
    }
    fr(i,n) dp[0][i]=0;
    dp[val[0]][0]=wt[0];
    rp(i,1,n)
    {
        rp(j,1,mex)
        {
            dp[j][i]=dp[j][i-1];
            if(j>=val[i])
            {
                dp[j][i]=min(dp[j][i],dp[j-val[i]][i-1]+wt[i]);
            }
           // cout<<dp[j][i]<<" ";
        }
    //    cout<<endl;
    }
    ll int ans=0;
    rr(i,100000,0)
    {
        if(dp[i][n-1]<=w)
        {
            ans=i;
            break;
        }
    }
    cout<<ans;
    return 0;
}

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

using namespace std;

typedef long long ll;

int main() {
    ll n; cin >> n;
    if (n % 7 == 0) n = n / 7;
    if (n == 1) {
        cout << 1; return 0;
    }
    ll sum = 1, bef_rem = 1;
    for (int i=2; i<n*2; i++) {
        bef_rem = (bef_rem*10)%n;
        sum+=bef_rem, sum%=n;
        if (sum == 0) {
            cout << i;
            return 0;
        }
    }
    cout << "-1";
    return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
const int N=1005;
int a[N][N];
int main()
{
	int n,m,A,B;
	scanf("%i %i %i %i",&n,&m,&A,&B);
	for(int i=1;i<=n;i++) for(int j=1;j<=m;j++)
	{
		a[i][j]=(i<=B)^(j<=A);
	}
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++) printf("%i",a[i][j]);
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 5120
#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


const long long INF = 1LL << 60;
vector<ll> a(100010), dp(100010);

int main(){
  vector<string> S(3);
  for(int i = 0; i < 3; i++){
    cin >> S.at(i);
  }
  vector<queue<int>> Q(3);
  for(int i = 0; i < 3; i++){
    int ssize = S.at(i).size();
    for(int j = 0; j < ssize; j++){
      Q.at(i).push(S.at(i).at(j) - 'a');
    }
  }
  int turn = 0;
  while(1){
    if(Q.at(turn).empty()){
      cout << (char)((char)turn + 'A') << endl;
      break;
    }
    else{
      int nextturn = Q.at(turn).front();
      Q.at(turn).pop();
      turn = nextturn;
    }
  }
}

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

int main(){
    long long int k;
    cin >> k;

    vector<long long int> d(50, 49 + k / 50);
    for(int i=0; i<50; i++){
        if(i <  k % 50) d[i] += 51 - k % 50;
        if(i >= k % 50) d[i] -= k % 50;
    }
    cout << 50 << endl;
    for(int i=0; i<50; i++) cout << d[i] << " ";
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  string s;
  cin>>s;
  int a=0;
  char z;
  if(s.length()%2==1)cout<<"No";
  else{
    for(int i=0;i<s.length();i++){
      z=s[i];
      if(i%2==0&&z!='h')a++;
      else if(i%2==1&&z!='i')a++;
    }
    if(a==0)  cout<<"Yes";
    else   cout<<"No";
  }
  return 0;
}

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

int main() {
  char c;
  cin >> c;
  if(c == 'a'||c == 'e'||c == 'i'||c == 'o'||c == 'u'){
  cout << "vowel" << endl;
  }
  else{
    cout << "consonant" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REV(c) reverse(ALL(c))
#define sz(v) (int)v.size()
#define endl '\n'
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
template<class T> inline void printv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << (i == n - 1 ? endl : ' ');}
template<class T> inline void printvv(vector<vector<T>>& v) {for (auto u : v) printv(u);}
template<class T> inline void printlnv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << endl;}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
 
void solve();
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

void solve() {
    int n;
    cin >> n;
    vvi g(n, vi());
    vector<pair<int, int>> p;
    int a, b;
    REP(i, n - 1) {
        cin >> a >> b;
        a--; b--;
        g[a].emplace_back(b);
        g[b].emplace_back(a);
        if (a > b) p.emplace_back(b, a); else p.emplace_back(a, b);
    }
    map<pair<int, int>, int> ans;

    function<void(int, int)> dfs = [&](int c, int p) {
        if (p != -1 && sz(g[c]) == 1) return;
        int nc = 1;
        for (auto e : g[c]) {
            if (e == p) continue;
            pair<int, int> key;
            key = p > c ? make_pair(c, p) : make_pair(p, c);
            if (nc == ans[key]) nc++;
            pair<int, int> key2;
            key2 = e > c ? make_pair(c, e) : make_pair(e, c);
            ans[key2] = nc++;
            dfs(e, c);
        }
    };

    dfs(0, -1);

    int mx = 1;
    for (auto q : ans) chmax(mx, q.second);
    cout << mx << endl;
    for (auto q : p) {
        cout << ans[q] << endl;
    }
}

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

int main() {
	int A, B, K;
	cin >> A >> B >> K;
	for (int i = 0; i < K; i++) {
		if (i % 2 == 0) {
			A -= A % 2;
			A /= 2;
			B += A;
		}
		else {
			B -= B % 2;
			B /= 2;
			A += B;
		}
	}
	cout << A << " " << B;
}

Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define endl "\n"
#define sz(x) ((ll)(x).size())
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define prt(x) cout << (x)
#define prtl(x) cout << (x) << endl
#define rep(i,a,b) for(ll i=a; i<b; i++)
#define rrep(i,a,b) for(ll i=a; i>b; i--)
#define mp(a, b) make_pair(a, b)
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;
using vi = vector<int>;
using vll = vector<long long int>;
using vb = vector<bool>;
using vvb = vector<vector<bool>>;
using vc = vector<char>;
using vvi = vector<vector<int>>;
using vvll = vector<vector<long long int>>;
using vvc = vector<vector<char>>;
using ll = long long int;
using P = pair<long long int, long long int>;
using Map = map<long long int, long long int>;
ll INF = 1LL<<60;
ll M = 1000000007;

int main(){
    ll x; cin >> x;
    ll t = 0;
    ll n = 1;
    while(t < x){
        t += n;
        n++;
    }
    prt(n-1);
}


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

int N;
int main(){
    cin.sync_with_stdio(0);
    cin.tie(0);
    cin >> N;
    ll ans = 0;
    for (ll i = 1; i <= N; i++) {
        ans += i*floor(N/(i+0.0))*(floor(N/(i+0.0))+1)/2;
    }
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 3524
#include <bits/stdc++.h>
using namespace std;
const int N = 1e6+ 5;
const int M = 1e7 + 5;
const int INF=1e9+7;
const int mod=1e9+7;
const double eps=1e-9;
typedef long long ll;
typedef pair<int,int>pi;

int divisible[1234567];

void pre(vector <int> vec){
     int n = vec.size();

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

         for(int j = 2*vec[i]; j <= vec[n-1]; j += vec[i]){
             divisible[j] = 1;
         }
     }
}


int main() {
    int n;
    cin >> n;
    vector <int> vec(n);
   map <int,int> mp;
    for(int i = 0; i < n; i++){
        cin >> vec[i];
        mp[vec[i]]++;
    }
    sort(vec.begin(), vec.end());
    pre(vec);
    int cnt = 0;
    for(auto x:vec){
        if(!divisible[x] && mp[x] < 2) cnt++;
    }
    cout << cnt;
}

Measured memory_bytes: 17248
// F - Intervals on Tree
#include <bits/stdc++.h>

using namespace std;

int main(int argc, char *argv[])
{
	ios::sync_with_stdio(false); cin.tie(0);
	long long n, x, y;
	cin >> n;
	long long ans = 0;
	for (long long i = 1; i <= n; i++) ans += (i + 1) * i / 2;

	for (int i = 0; i < n - 1; i++) {
		cin >> x >> y;
		x--; y--;
		if (x > y) swap(x, y);
		ans -= (x + 1) * (n - y);
	}

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


Measured memory_bytes: 3644
n = int(input())
t, a = [int(i) for i in input().split()]

array = [int(i) for i in input().split()]
ans = list(map(lambda x: t-x*0.006,array))
ans = list(map(lambda x: abs(x-a),ans))

minans = min(ans)
minidx = ans.index(minans)

print(minidx+1)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int flag=1;
char a[100];
char b[100],c[100];
bool judge(char s[])
{
    int l=0;
    int r=strlen(s)-1;
    while (s[l] == s[r])
        ++l, --r;
    return l < r;
}

int main()
{
    cin>>a;
    int len=strlen(a);
    int i;
    for(i=0; i<(len-1)/2; i++)
        b[i]=a[i];
    int k=0;
    for(i=(len+3)/2-1; i<len; i++)
    {
        c[++k]=a[i];
    }
    if(judge(a)||judge(b)||judge(c))
        flag=0;
    if(flag)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 256
N,K=map(int,input().split())
A=list(map(int,input().split()))
lity=[[0,0] for i in range(N)]
if N<K:
  hata=True
  i=0
  a=0
  j=0
  while hata:
    if lity[i][0]==1:
      a=j-lity[i][1]
      break
    lity[i][0]+=1
    lity[i][1]=j
    i=A[i]-1
    j+=1
  K-=j
  p=K%a
  while p>=1:
    i=A[i]-1
    p-=1
  print(i+1)
else:
  i=0
  for j in range(K):
    i=A[i]-1
  print(i+1)

Measured memory_bytes: 39072
abc = ['a','b','c','d','e','f','g','h','i','j','k',
'l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']

ans = []
def rec(n):
    #print(n,int(n/26),n%26,abc[n%26])
    n-=1
    ans.append(abc[n%26])
    #print(n)
    if n>=26:
        #ans.append(abc[int(n%26)-1])
        return rec(int(n/26))
        #ans.append(abc[int(n%26)])
        #print(n%26)
    else:
        pass
       #ans.append(abc[int(n)])
       #print(n%26)
N = int(input())
rec(N)
#i=N

for i in range(len(ans)-1,-1,-1):
    print(ans[i],end="")


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

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
  
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
 
#define FS              ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll              long long int
#define ld              long double
#define pb              push_back
#define bp              __builtin_popcount
#define sz              size()
#define ff              first
#define ss              second
#define vll             vector<ll>
#define vbool           vector<bool>
#define vpll            vector<pair<ll,ll>>
#define pll             pair<ll,ll>
#define vllv            vector<vector<ll>>
#define setpri(x)       cout<<setprecision(x)<<fixed;
#define all(v)          v.begin(),v.end()
#define allr(v)         v.rbegin(),v.rend()
#define yesr {cout<<"YES"<<endl;return;}
#define nor {cout<<"NO"<<endl;return;}
// getline (std::cin,name);
ll MOD=1e9+7;
ll ceil1(ll n,ll x){return (n-1)/x+(n>0);}

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

ll pow1(ll n,ll m ,ll mod=MOD );
ll pow2(ll n,ll k);

ll modinv(ll n,ll mod=MOD){  return pow1(n,mod-2,mod);}

bool func(pair<ll,ll> &a,pair<ll,ll> &b ){
        if(a.ff != b.ff)return a.ff < b.ff;
        return a.ss > b.ss;
}
ll const N=(ll)3e2+11;
ll const LG=(ll)log2(N)+1;


void solve(){
        ll i,j,k,l,n,m,x,y,z,r;
        
        ll a[3];
        cin>>a[0]>>a[1]>>a[2];
        sort(a,a+3);
        cout<<a[0]+a[1]<<endl;
        
        
        
        
}       
int main(){
        FS;
        
        ll i,j,k,n,m,x,y,z,q;
        q=1;
        // cin>>q;
        while(q--){
                solve();
        }
        return 0;
}


ll pow1(ll n,ll m,ll mod){
        if(m==0)return 1;
        
        if(m%2==0)return pow1((n*n)%mod,m/2,mod);
    	
    	return (pow1((n*n)%mod,m/2,mod)*n)%mod;
}

ll pow2(ll n,ll k){
        ll ans=1;
            while(k>0){
                if(k%2==1)ans=ans*n;
                n=n*n;
                k/=2;
            }
            return ans;
}

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

int main() {
  int n; cin>>n;
  ll ans=0;
  // 約数の個数
  vector<ll> numDiv(n+1,0);
  for(int i=1; i<=n; i++) {
    for(int j=1;;j++) {
      if(i*j<=n) numDiv[i*j]++;
      else break;
    }
  }
  for(ll i=1; i<=n; i++) ans+=i*numDiv[i];
  cout << ans << endl;
}


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

namespace AOJ
{
    class Program
    {
        static void Main(string[] args)
        {
            string res;
            while((res = Console.ReadLine()) != null)
            {
                Console.WriteLine(getUpper(res));
            }
        }

        static string getUpper(string resource)
        {
            var result = "";
            foreach(var v in resource)
            {
                result += isSmallLetter(v) ? (char)(v-'a'+'A') : v;
            }
            return result;
        }

        static bool isSmallLetter(char c)
        {
            return 'a' <= c && c <= 'z';
        }
    }
}

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

using namespace std;

typedef long long ll;

int main(int, char**)
{
	ll  r, d, x;
	cin >> r >> d >> x;
	for (int i = 0; i< 10; ++i) {
		x = r * x -d;
		cout << x << endl;
	}

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#define FOR(i, a, b) for(int i=(int)(a); i!=(int)(b); i++)
#define RFOR(i, a, b) for(int i=(int)(a); i!=(int)(b); i--)
#define REP(i, n) FOR(i, 0, n)
using namespace std;
using ll = long long;

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

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

int main(){
  ll n, m; cin >> n >> m;
  string s, t; cin >> s >> t;

  if(n > m){
    swap(n, m); 
    swap(s, t);
  }

  if(m % n == 0){
    for(int i=0, j=0; i<n; i++, j += m/n){
      if(s[i] != t[j]){
        cout << -1 << endl;
        return 0;
      }
    }
    cout << m << endl;
  }
  else{
    ll l = lcm(n, m); 
    for(int i=0, j=0; i<n && j<m; i += l/m, j += l/n){
      if(s[i] != t[j]){
        cout << -1 << endl;
        return 0;
      }
    }
    cout << l << endl;
  }

  return 0;
}


Measured memory_bytes: 512
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
namespace AtCoder
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }

        static readonly long Mod = 1000000000 + 7;

        static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });

            var NMX = Sarray();
            var N = NMX[0];
            var M = NMX[1];
            var X = NMX[2];
            var Ai = Sarray();
            var ans = 0L;
            for (var i = 0; i < M; ++i)
                if (X < Ai[i])
                {
                    ans = Min(i, M - i);
                    break;
                }
            Write(ans);

            //Out.Flush();
        }
    }
}

Measured memory_bytes: 13396
#include <iostream>
#include <array>
#include <algorithm>
#include <map>
#include <vector>
#include <list>
#include <cmath>
#include <stack>
#include <queue>

#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using namespace std;

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 {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint a) const {
		mint res(*this);
		return res *= 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 {
		mint res(*this);
		return res /= a;
	}
};

struct combination {
	vector<mint> fact, ifact;
	combination(int n) :fact(n + 1), ifact(n + 1) {
		fact[0] = 1;
		for (int i = 1; i <= n; ++i) fact[i] = fact[i - 1] * i;
		ifact[n] = fact[n].inv();
		for (int i = n; i >= 1; --i) ifact[i - 1] = ifact[i] * i;
	}
	mint operator()(int n, int k) {
		if (k < 0 || k > n) return 0;
		return fact[n] * ifact[k] * ifact[n - k];
	}
} comb(2000005);

mint g(int r, int c) {
	return comb(r + c + 2, r + 1) - 1;
}

int main()
{
	priority_queue<long double, vector<long double>, less <long double>> v;
	int n, m;

	cin >> n >> m;

	for (int i = 0; i < n; i++)
	{
		int tmp;
		cin >> tmp;
		v.push(tmp);
	}

	for (int i = 0; i < m; i++)
	{
		long double h = v.top();
		v.pop();
		h = h / 2;
		v.push(h);
	}

	long long sum = 0;
	for (int i = 0; i < n; i++)
	{
		sum += (int)v.top();
		v.pop();
	}
	cout << sum;
}


Measured memory_bytes: 33780
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e9;
typedef pair<ll, ll> P;

vector<ll> G[1000], Ginv[1000];
vector<P> ps;


int main() {
  ll N, M; cin >> N >> M;
  for (ll i = 0; i < M; i++) {
    ll a, b; cin >> a >> b; a--; b--;
    G[a].push_back(b); Ginv[b].push_back(a);
    ps.push_back(P(a,b));
  }
  ll shortest = INF;
  vector<ll> res;

  for (ll i = 0; i < M; i++) {
    ll s = ps[i].second; ll t = ps[i].first;
    ll d[N];
    for (ll j = 0; j < N; j++) {d[j] = INF;}
    d[s] = 0;
    
    queue<ll> que; que.push(s);
    while (!que.empty()) {
      ll p = que.front(); que.pop();
      if (p == t) break;
      for (ll j = 0; j < G[p].size(); j++) {
        ll to = G[p][j];
        if (d[to] == INF) {que.push(to); d[to] = d[p]+1;}
      }
    }
    
    if (d[t]+1 < shortest) {
      ll p = t; res.push_back(p);
      while (d[p] > 0) {
        for (ll j = 0; j < Ginv[p].size(); j++) {
          ll to = Ginv[p][j];
          if (d[to]+1 == d[p]) {
            p = to; res.push_back(p); break;
          }
        }
      }
    }
    shortest = min(d[t]+1, shortest);
  }
  if (shortest == INF) {cout << -1 << endl; return 0;}
  cout << shortest << endl;
  ll n = res.size();
  for (ll i = n-1; i >= n-shortest; i--) {
    cout << res[i]+1 << endl;
  }
}

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

#define FOR(i,b,e) for(int i=(b); i <= (e); ++i)
#define FORD(i,b,e) for(int i=(b); i >= (e); --i)
#define SIZE(c) (int) (c).size()
#define FORE(i,c) FOR(i,0,SIZE(c)-1)
#define FORDE(i,c) FORD(i,SIZE(c)-1,0)

#define pb push_back
#define mp make_pair
#define st first
#define nd second


using namespace std;

typedef long long ll;
typedef pair <int,int> pii;
typedef pair <ll,ll> pll;

typedef vector <int> VI;
typedef vector <bool> VB;
typedef vector <pii> VP;
typedef vector <ll> VL;
typedef vector <pll> VPL;

typedef vector <VI> VVI;
typedef vector <VL> VVL;
typedef vector <VB> VVB;
typedef vector <VP> VVP;

const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000000000000001LL;


/*************************************************************************/

int main() {
    ios_base::sync_with_stdio(0);
    
    int n;
    cin >> n;
    
    VVI tab(n, VI(n));
    FOR(i,0,n-1) FOR(j,0,n-1) {
        cin >> tab[i][j];
    }
    
    FOR(i,0,n-1) FOR(j,0,n-1) FOR(k,0,n-1) {
        if (tab[i][k] > tab[i][j] + tab[j][k]) {
            cout << -1;
            return 0;
        }
    }
    
    ll total = 0;
    FOR(i,0,n-1) FOR(k,0,n-1) {
        bool found = false;
        
        FOR(j,0,n-1) if (j != i && j != k && tab[i][k] == tab[i][j] + tab[j][k]) {
            found = true;
            break;
        }
        
        if (!found) {
            total += tab[i][k];
        }
    }
    
    cout << total / 2;

    return 0;
}

/*************************************************************************/


Measured memory_bytes: 640
#include <sstream>
#include <cstring>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iterator>
#include <numeric>
#include <functional>
#include <climits>



using namespace std;
typedef unsigned long long ull;
typedef long long ll;

int main(int argc, char *argv[]){
  string buf;
  deque<int> stack;
  while(cin >> buf){
    char c = buf[0];
    if(c == '+' || c == '-' || c == '*'){
      int a = stack.back(); stack.pop_back();
      int b = stack.back(); stack.pop_back();
      int x;
      switch(c){
      case '+': x = b + a; break;
      case '-': x = b - a; break;
      case '*': x = b * a; break;
      }
      stack.push_back(x);
    } else{
      stack.push_back(atoi(buf.c_str()));
    }
  }
  cout << stack.back() << endl;
  return 0;
}

Measured memory_bytes: 1192
#include <algorithm>
#include <deque>
#include <iostream>
#include <numeric>
#include <cmath>
using namespace std;

int main()
{

    long N;
    cin >> N;
    deque<long> emp(N);
    for (int i = 0; i < N-1; i++)
    {
        int tmp;
        cin >> tmp;
        emp[tmp - 1]++;
    }

    for (auto &x : emp)
    {
        cout << x << endl;
    }
}

Measured memory_bytes: 5196