akhauriyash/Code-Regression huggingface dataset:
//
// Created by 27420 on 2020/8/22.
//

#include <stdio.h>
#include<iostream>
using namespace std;
int main(){
    int n,x,t;
    scanf("%d %d %d",&n,&x,&t);
    int k=1,m;
    while((x*k)<n){

        k++;

    }
    printf("%d\n",t*k);

}


Measured memory_bytes: 3756
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		List<Integer> list = new ArrayList<>();

		for (int i = 0; i < 5; i++) {
			list.add(sc.nextInt());
		}

		int ans = 0;

		for (int i = 0; i < 5; i++) {
			if (list.get(i) != (i + 1)) {
				ans = (i + 1);
			}
		}

		System.out.println(ans);
	}

}


Measured memory_bytes: 35900
#include <iostream>
#include <string>

using namespace std;

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

	int ans = 0;
	for (int i = 0; i + 3 <= N; ++i) {
		if (S.substr(i, 3) == "ABC") {
			++ans;
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
// -----------------------------------------------
// Framework <https://github.com/vain0x/procon>
//
// See the bottom of file for solution.
// -----------------------------------------------

#![allow(unused_imports)]
#![allow(non_snake_case)]

use std::cell::RefCell;
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Display, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), stderr());
            writeln!(err, "\x1B[33m{}\x1B[0m = {:?}", e, $e).unwrap()
        })*
    };
}

#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

#[allow(dead_code)]
fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    buf.trim_right().to_owned()
}

// -----------------------------------------------
// Solution
// -----------------------------------------------

const P: i64 = 1_000_000_007;

struct Solver {
    N: usize,
    G: Vec<Vec<usize>>,
    done: Vec<bool>,
    dpw: Vec<i64>,
    dpb: Vec<i64>,
}

impl Solver {
    fn calc(&mut self, u: usize) {
        self.done[u] = true;

        let mut w = 1;
        let mut b = 1;

        for i in 0..self.G[u].len() {
            let v = self.G[u][i];

            if self.done[v] {
                continue;
            }

            self.calc(v);

            w *= (self.dpw[v] + self.dpb[v]) % P;
            w %= P;
            b *= self.dpw[v];
            b %= P;
        }

        self.dpw[u] = w;
        self.dpb[u] = b;
    }
}

fn main() {
    std::thread::Builder::new()
        .stack_size(16 * 1024 * 1024)
        .spawn(|| {
            let N = read!(usize);
            let T = read![usize, usize; N - 1];

            let mut G = vec![vec![]; N];
            for (u, v) in T {
                G[u - 1].push(v - 1);
                G[v - 1].push(u - 1);
            }

            let mut solver = Solver {
                N: N,
                G: G,
                done: vec![false; N],
                dpw: vec![0; N],
                dpb: vec![0; N],
            };
            solver.calc(0);

            println!("{}", (solver.dpw[0] + solver.dpb[0]) % P);
        })
        .unwrap()
        .join()
        .unwrap();
}


Measured memory_bytes: 24956
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


def lcm(a, b):
    return a * b // gcd(a, b)


A, B, C, D = map(int, input().split())

A -= 1

E = lcm(C, D)

CBdiv = B // C
DBdiv = B // D
EBdiv = B // E


CAdiv = A // C
DAdiv = A // D
EAdiv = A // E

ans = B - A - ((CBdiv - CAdiv) + (DBdiv - DAdiv) - (EBdiv - EAdiv))

print(ans)




Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include <complex>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <assert.h>
#include <numeric>
#include <iomanip>
#define rep(i, a, b) for (int(i) = (a); i < (b); i++)
using namespace std;

using ll = long long;

typedef pair<int, int> P;

const int INF = 100000000;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll MOD = 1000000007;

ll pow_mod(ll x, ll y, ll mod)
{
	ll ans=1;
	for(;y>0;y>>=1){
		if(y&1)(ans*=x)%=mod;
		(x*=x)%=mod;
	}
	return ans;
}

ll n, m;
ll s , t;
int d[300000];

vector<int> vv[300000];

void dijkstra(int s)
{
	priority_queue<P, vector<P>, greater<P>> que;
	fill(d, d + 3 * n, INF);
	d[s] = 0;
	que.push(P(0, s));

	while (!que.empty())
	{
		P p = que.top();
		que.pop();
		int v = p.second;
		if(d[v]<p.first){
			continue;
		}
		for (int i = 0; i < vv[v].size();i++){
			int u = vv[v][i];
			if(d[u]>d[v]+1){
				d[u] = d[v] + 1;
				que.push(P(d[u], u));
			}
		}
	}
}

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	//問題文中の添え字が0-indexか1-indexか確認!
	cin >> n >> m;

	rep(i,0,m){
		int a, b;
		cin >> a >> b;
		a--;
		b--;
		vv[a].push_back(n + b);
		vv[n + a].push_back(n * 2 + b);
		vv[n * 2 + a].push_back(b);
	}

	cin >> s >> t;
	s--;
	t--;

	dijkstra(s);
	if(d[t]!=INF){
		cout << d[t]/3;
	}else{
		cout << -1;
	}
	return 0;
}

Measured memory_bytes: 17792
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<n;i++)
#define ll long long
#define vec_rep(itr,v) for(auto itr = v.begin(); itr != v.end(); ++itr)

int main(void){
    int K,N;
    cin >> K >> N;
    int A[N];
    rep(i,N)cin >> A[i];
    int max_dis = 0;
    rep1(i,N)max_dis = max(A[i] - A[i-1], max_dis);
    max_dis = max(K-A[N-1]+A[0], max_dis);
    cout << K-max_dis << endl;
    return 0;
}

Measured memory_bytes: 1024
#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;

#ifndef bhartiya
    #pragma GCC optimize("Ofast")
    #pragma GCC optimize("unroll-loops")
    // #pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#endif

#define int long long
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef gp_hash_table<int, int> umap;
typedef tree<int, null_type, less<int>, rb_tree_tag,
		tree_order_statistics_node_update> oset;
// not that imp
typedef pair<pii, int> piii;
typedef vector<int> vi;
typedef vector<pii> vii;

#define inf 200000000000000
#define mod 1000000007
#define eps 1e-7
#define PI 3.1415926535897932385
// #define PI acos(-1)

#define pb push_back
#define bitc  __builtin_popcountll
#define mp make_pair
#define ff first
#define ss second
#define all(ar) ar.begin(), ar.end()
#define sz(x) (int)(x).size()

#define fr(i,a,b) for (int i = (a), _b = (b); i <= _b; i++)
#define rep(i,n) for (int i = 0, _n = (n); i < _n; i++)
#define repr(i,n) for (int i = n - 1; i >= 0; i--)
#define frr(i,a,b) for (int i = (a), _b = (b); i >= _b; i--)
#define foreach(it,ar) for (auto it = ar.begin(); it != ar.end(); it++)
#define fil(ar,val) memset(ar, val, sizeof(ar))

#ifdef bhartiya
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
int begtime = clock();
#define end_routine() cout << "\n\nTime elapsed: " << (clock() - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n";
#else
#define endl '\n'
#define trace(...)
#define end_routine()
#endif

mt19937 rng32(chrono::steady_clock::now().time_since_epoch().count());
inline bool equals(double a, double b) {return fabs(a - b) < 1e-9;}
int gcd(int a, int b){ return b==0 ? a : gcd(b, a%b); }
ll modpow(ll b, ll e) {
	ll ans=1; for(;e;b=b*b%mod,e/=2) if(e&1) ans=ans*b%mod; return ans;}

const int maxn = 300005;
vi factors[maxn];
int cnt[maxn], a[maxn];
vi ans;

void solve(){
	fr(i,1,maxn-1){
		for(int j=i; j<maxn; j+=i){
			factors[j].pb(i);
		}
	}
	int n; cin>>n;
	fr(i,1,n) cin>>a[i];
	frr(i,n,1){
		if(cnt[i]%2 != a[i]){
			for(auto ch: factors[i]){
				cnt[ch]++;
			}
			ans.pb(i);
		}
		if(cnt[i]%2 != a[i]) {
			cout<<"-1";
			return;
		}
	}
	cout<<sz(ans)<<endl;
	for(auto ch: ans){
		cout<<ch<<" ";
	}
}

signed main() 
{ 
	ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0), cout.precision(10); //cout<<fixed;
    cin.exceptions(cin.failbit);
    #ifdef bhartiya
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    solve();
    end_routine();
}

Measured memory_bytes: 56952
local mod = 1000000007
local mfl = math.floor
local function bmul(x, y) return(x * y) % mod end

local function badd(x, y)
  return (x + y) % mod
end

local function bsub(x, y)
  return x < y and x - y + mod or x - y
end

local function modpow(src, pow)
  local res = 1
  while 0 < pow do
    if pow % 2 == 1 then
      res = bmul(res, src)
      pow = pow - 1
    end
    src = bmul(src, src)
    pow = mfl(pow / 2)
  end
  return res
end

local function modinv(src)
  return modpow(src, mod - 2)
end

local fact = {1}
local invs = {1}
local invfact = {1}
for i = 2, 100000 do
  fact[i] = bmul(fact[i - 1], i)
  invs[i] = bmul(mfl(mod / i), mod - invs[mod % i])
  invfact[i] = bmul(invfact[i - 1], invs[i])
end

local function getComb(n, k)
  if k == 0 or k == n then return 1 end
  return bmul(fact[n], bmul(invfact[k], invfact[n - k]))
end

local n = io.read("*n")
local t = {}
for i = 1, n + 1 do
  t[i] = io.read("*n")
end
local spos, epos = 0, 0
do
  local map = {}
  for i = 1, n + 1 do
    if not map[t[i]] then
      map[t[i]] = i
    else
      spos, epos = map[t[i]], i
      break
    end
  end
end
for k = 1, n + 1 do
  local use_zero = 0
  if k <= n - 1 then
    use_zero = getComb(n - 1, k)
  end
  local use_two = 0
  if 2 <= k then
    use_two = getComb(n - 1, k - 2)
  end
  local use_one = 0
  if k <= n then
    use_one = bmul(2, getComb(n - 1, k - 1))
  end
  local use_one_dup = 0
  local mid_range = epos - spos - 1
  if k - 1 <= n - 1 - mid_range then
    use_one_dup = getComb(n - 1 - mid_range, k - 1)
  end
  local ret = badd(use_zero, badd(use_two, bsub(use_one, use_one_dup)))
  print(ret)
end


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

ll gcd(ll a, ll b){
  return (b != 0) ? gcd(b, a%b) : a;
}

int main(){
  int n;
  cin >> n;
  vector<ll> x(n);
  rep(i, n){
    cin >> x[i];
  } 
  vector<ll> c = x;
  sort(x.begin(), x.end());
  rep(i, n){
    if(c[i] <= x[n/2-1]) cout << x[n/2] << endl;
    else  cout << x[n/2-1] << endl;
  }
}

Measured memory_bytes: 5376
#!/usr/bin/env python3
import sys
import math
sys.setrecursionlimit(10000)
INF = 1<<32


def solve(a: int, b: int, x: int):
    y = float(x)/float(a)
    ans = .0
    if (a**2 * b - x) == 0:
        ans = 0.0
    elif y >= a*b/2:
        bd = 2.0*(a*b-y)/a
        ans = 90.0-math.degrees(math.atan(a/bd))
    else:
        ad = 2.0*y/b
        ans = 90.0-math.degrees(math.atan(ad/b))

    print(ans)

    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    a = int(next(tokens))  # type: int
    b = int(next(tokens))  # type: int
    x = int(next(tokens))  # type: int
    solve(a, b, x)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
using System;
using System.Collections.Generic;
using System.Linq;
using static Input;
public class Hello
{
    public static void Main()
    {
        int R = NextInt();
        int G = NextInt();
        int B = NextInt();
        int N = NextInt();
        int ans = 0;
        //脳死
        for (int i = 0; i <= N / R + 1; i++)
            for (int j = 0; j <= N / G + 1; j++)
            {
                int cost = R * i + G * j;
                int b = N - cost;
                if (b < 0) break;
                if (b % B == 0)
                {
                    ans++;
                    
                }
            }
        Console.WriteLine(ans);
    }

}

public class Input
{
    private static Queue<string> queue = new Queue<string>();
    private static void Confirm() { if (queue.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) queue.Enqueue(s); }
    public static int NextInt() { Confirm(); return int.Parse(queue.Dequeue()); }
    public static long NextLong() { Confirm(); return long.Parse(queue.Dequeue()); }
    public static string NextString() { Confirm(); return queue.Dequeue(); }
    public static double NextDouble() { Confirm(); return double.Parse(queue.Dequeue()); }
    public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); }
    public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
}


Measured memory_bytes: 11220
n = int(input())
a = [int(b) for b in input().split()]
ans = 0
cnt = 0
prv = -1
for i in a:
    if i == prv:
        cnt += 1
    else:
        ans += int(cnt // 2)
        cnt =1
        prv = i
ans += int(cnt // 2)
print(ans)


Measured memory_bytes: 3316
n, m = gets.split.map(&:to_i)

a = n.times.map{gets.chomp}.join		#改行有りの入力を一行に直す
b = m.times.map{gets.chomp}.join

trial = n-m+1		#縦横の試行回数

trial.times do |h|		# h = 縦座標
	trial.times do |w|	# w = 横座標
		part_a = m.times.map { |i|
			a[w + h*n + i*n .. w+m-1 + h*n + i*n]	# m×mのブロックを切り出す
		}.join

		if part_a == b
			puts 'Yes'
			exit
		end
	end
end

puts 'No'

Measured memory_bytes: 1916
#define $ for(i=j=0;j<n?:(j=0,++i<n);j++)
#define _(a,b)$ for(b=l=0;l<n;)b=(b+a[i][l]*p[l++][j])%m;$ a[i][j]=b;
long m=1e9+7,p[50][50],a[50][50],b[50][50],k,s;i,j,l;main(n){scanf("%d%ld",&n,&k);$ a[i][i]=scanf("%d",p[i]+j);for(;k;k/=2){if(k&1){_(a,b[i][j])}_(p,b[i][j])}$ s+=a[i][j];printf("%d",s%m);}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for(int (i)=0 ;i <(n); ++(i))
#define REP(i,m,n) for(int (i) = (m); (i) <= (n); ++(i))
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)? "YES":"NO")
typedef long long ll;
using namespace std;

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  yorn(a<=c && c<=b);
  return 0;
}

Measured memory_bytes: 256
import sys

def insertionSort(A,N,g):
    cnt = 0
    for i in range(g,len(A)):
        v = A[i]
        j = i - g
       
        while j >= 0 and A[j] > v:
            A[j+g] = A[j]
            j -= g
            cnt += 1
        A[j+g] = v
    return cnt


def shellSort(A,N):
    cnt = 0
    G = [(3**i-1)//2 for i in range(1,17) if ((3**i-1)//2) <= N]
    m = len(G)
    for i in reversed(range(m)):
        cnt += insertionSort(A,N,G[i])

    print(len(G))
    print(" ".join(map(str,reversed(G))))
    print(cnt)
    print("\n".join(map(str,A)))


N = int(input())
#lst = list(map(int, [input() for i in range(N)]))
lst = [int(l) for l in sys.stdin.readlines()]
#lst = [i for i in range(100000)]
#reversed(lst)
shellSort(lst,N)



Measured memory_bytes: 126312
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
int main()
{
    //データ定義
    int student_cnt; //学生の数
    int i;
    
    //データ入力
    cin >> student_cnt;

    while( student_cnt != 0)
    {
        double score[1000] = {};
        double total_score = 0;
        double a = 0;

        for (i = 0; i < student_cnt; i++)
        {
            cin >> score[i];
            total_score += score[i];
        }

        for( i = 0; i < student_cnt; i++){
            a += ((total_score / student_cnt) - score[i]) * ((total_score/ student_cnt) - score[i])/student_cnt;
        }
        cout << fixed << setprecision(5) << sqrt(a) << endl;
        cin >> student_cnt;
    }
    return 0;
}


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

int main() {

  long long int d[10] = { -1, 0, 1, 2, 0, 1, 2, 0, 1, 2 };

  while( true ) {

    string in;
    cin >> in;
    if ( in == "#" ) break;

    if ( in.size() <= 2 ) {
      cout << 0 << endl;
      continue;
    }

    long long int ans[2];

    for ( long long int s = 0; s < 2; s++ ) {

      long long int p[2] = { 0, 0 };
      long long int k;

      if ( s == 0 ) {
	k = 0;
      }else {
	k = 1;
      }
      ans[s] = 0;

      for ( long long int i = 0; i < in.size(); i++ ) {

	long long int kr = 1 - k;
	long long int a = in[i] - '0';
	long long int kp = k;
	if ( p[kr] != 0 && ( ( d[a] - d[p[kr]] ) * ( k - kr ) < 0 ) ) {
	  ans[s]++;
	  kp = 1 - kp;
	}
	p[kp] = a;
	k = 1 - kp;

      }

    }

    cout << min( ans[0], ans[1] ) << endl;

  }

  return 0;

}

Measured memory_bytes: 1328
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long long> vll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef pair<int, int> pii;
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define vv(type, c, m, n, i) vector<vector<type>> c(m, vector<type>(n, i))
#define mat(type, c, m, n) vector<vector<type>> c(m, vector<type>(n));for(auto& r:c)for(auto& i:r)cin>>i;
#define rep(i,a,n) for(int i=(a), i##_len=(n); i<i##_len; ++i)
#define rrep(i,a,n) for(int i=(a), i##_len=(n); i>i##_len; --i)
#define each(x,y) for(auto &(x):(y))
#define var(type, ...)type __VA_ARGS__;Scan(__VA_ARGS__);
template<typename T> void Scan(T& t) { cin >> t; }
template<typename First, typename...Rest>void Scan(First& first, Rest&...rest) { cin >> first; Scan(rest...); }
#define vec(type, c, n) vector<type> c(n);for(auto& i:c) cin>>i;
#define len(x) ((int)(x).size())
#define mp make_pair
#define eb emplace_back
#define em emplace
#define pb pop_back
#define fi first
#define se second
#define get(a, i) get<i>(a)
#define bit_count __builtin_popcount
#define mt make_tuple
inline string zero(int a,string s,char c='0'){return string(a-len(s),c)+s;}
inline string zero(int a,int t,char c='0'){return zero(a, to_string(t), c);}
inline string zero(int a,ll t,char c='0'){return zero(a, to_string(t), c);}
#define mini min_element
#define maxi max_element
#define sum accumulate
#define chmax(a,b) if(a<b)a=b
#define chmin(a,b) if(a>b)a=b
template <class T> inline void print(T t){cout << t << '\n';}
template <class H, class... T> inline void print(H h, T... t){cout << h << " ";print(t...);}
ll solve() {
	var(ll, a, b, c, k);
	if (k & 1) {
		return b - a;
	} else {
		return a - b;
	}
}
int main() {
	print(solve());
	return 0;
}


Measured memory_bytes: 256
N=int(input())
A=list(map(int,input().split()))
goukei=sum(A)
num_dic={}
for i in A:
    if i not in num_dic:
        num_dic[i]=1
    else:
        num_dic[i]+=1
Q=int(input())
for i in range(Q):
    b,c=list(map(int,input().split()))
    if b in num_dic:
        count=num_dic[b]
        d=(c-b)*count
        print(goukei+d)
        goukei+=d
        if c in num_dic:
            num_dic[c]+=num_dic[b]
        else:
            num_dic[c]=num_dic[b]
        num_dic[b] = 0
    else:print(goukei)

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

int main(){
  vector<char> text(4);
  for(int i=0;i<4;i++){
    cin >> text.at(i);
  }
    
  sort(text.begin(),text.end());
  
    
  if(text.at(0)==text.at(1) && text.at(2)==text.at(3) && text.at(1) != text.at(2)){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
s = input()
t = input()
n = len(s)

alphabet = [chr(i) for i in range(97, 97+26)]
dict_alphabet = {}
for i, alphabet in enumerate(alphabet):
    dict_alphabet[alphabet] = i

ans = 'Yes'
# 同じsに同じtが対応しているか
alphabet_s2t = [0] * 26
for i in range(n):
    if not alphabet_s2t[dict_alphabet[s[i]]]:
        alphabet_s2t[dict_alphabet[s[i]]] = t[i]
    else:
        if alphabet_s2t[dict_alphabet[s[i]]] != t[i]:
            ans = 'No'

alphabet_t2s = [0] * 26
for i in range(n):
    if not alphabet_t2s[dict_alphabet[t[i]]]:
        alphabet_t2s[dict_alphabet[t[i]]] = s[i]
    else:
        if alphabet_t2s[dict_alphabet[t[i]]] != s[i]:
            ans = 'No'
print(ans)


    


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

bool match(char c1, char c2)
{
    return (c1 == '?' || c2 == '?' || c1 == c2 );
}

int main()
{
    string a, b, c;
    cin >> a >> b >> c;
    int la = a.size(), lb = b.size(), lc = c.size();
    const int L = 100000;
    const int M = L / 2;
    bool ab[L], ac[L], bc[L];
    for (int i = 0; i < L; ++i) ab[i] = false, ac[i] = false, bc[i] = false;
    for (int i = 0; i < la; ++i) 
    {
        for (int j = 0; j < lb; ++j)
        {
            // i , j の相対的な位置に関して情報を保持する
            if (!match(a[i], b[j])) ab[i - j + M] = true;
        }
    }
    for (int i = 0; i < la; ++i) 
    {
        for (int j = 0; j < lc; ++j)
        {
            // i , j の相対的な位置に関して情報を保持する
            if (!match(a[i], c[j])) ac[i - j + M] = true;
        }
    }
    for (int i = 0; i < lb; ++i) 
    {
        for (int j = 0; j < lc; ++j)
        {
            // i , j の相対的な位置に関して情報を保持する
            if (!match(b[i], c[j])) bc[i - j + M] = true;
        }
    }
    int maxstr = 2000;
    int ans = 3 * maxstr;
    for (int i = -2 * maxstr; i <= 2 * maxstr; ++i)
    {
        for (int j = -2 * maxstr; j <= 2 * maxstr; ++j)
        {
            if (!ab[i + M] && !ac[j + M] && !bc[j - i + M])
            {
                int L = min(0, min(i, j));
                int R = max(la, max(lb + i, lc + j));
                ans = min(ans, R - L);
            }
        }
    }
    cout << ans << endl;
    return 0;
}
 

Measured memory_bytes: 640
#include <iostream>
using namespace std;int main(){int n,s,j,k,a[11][46];for(int s=0;s<46;s++)for(int n=0;n<11;n++)a[n][s]=0;for(int i=0;i<1024;i++){for(j=i,n=0;j>0;j/=2)n+=j%2;for(j=i,s=0,k=0;j>0;j/=2,k++)s+=j%2*k;a[n][s]++;}for(cin>>n>>s;n||s;s<46?cout<<a[n][s]:cout<<0,cout<<endl,cin>>n>>s);}

Measured memory_bytes: 0
import java.util.*;

public class Main {
	private static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		int n = sc.nextInt();
		int[] a = new int[100010];
		a[0] = sc.nextInt();
		int c = 1;
		for (int i = 1;i < n;i++) {
			int tmp = sc.nextInt();
			if (a[c-1]==tmp) continue;
			a[c++] = tmp;
		}
		List<Integer> l = new ArrayList<>();
		c = 0;
		int ret = 0;
		while (true) {
			int tmp = a[c++];
			if (tmp==0) {
				ret++;
				break;
			}
			l.add(tmp);
			if (l.size()<=2) continue;
			if (i(l)||d(l)) {
				l.remove(0);
				continue;
			} else {
				l.clear();
				l.add(tmp);
				ret++;
			}
		}
		System.out.println(ret);
	}

	private static boolean i(List<Integer> l) {
		for (int i = 1;i < l.size();i++) {
			if (l.get(i-1)>l.get(i)) return false;
		}
		return true;
	}
	private static boolean d(List<Integer> l) {
		for (int i = 1;i < l.size();i++) {
			if (l.get(i-1)<l.get(i)) return false;
		}
		return true;
	}
}


Measured memory_bytes: 50888
/*Bismillahir Rahmanir Rahim*/


#include<bits/stdc++.h>
#include<cstring>
#include<vector>
#include<map>
#include<set>
#define ll long long int
#define dd double
using namespace std;

int main()
{
    ll t;
    cin>>t;
    ll ans=t+pow(t,2)+pow(t,3);
    cout<<ans<<endl;

}
//Apna Time Aayega :)

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

#define LOCAL 0

#define lli long long int
#define llu unsigned long long int
#define ld long double
#define all(v) v.begin(),v.end()
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define si(n) scanf("%d",&n)
#define slli(n) scanf("%lld",&n);
#define ss(n) scanf("%s",n);

const long double EPS = 1e-10;
const int MOD = 1000000007ll;
const int mod1 = 1000000009ll;
const int mod2 = 1100000009ll;
int INF = (int)1e9;
lli INFINF = (lli)1e18;
int debug = 0;
long double PI = acos(-1.0);

using namespace std;

int bit_count(lli _x){lli _ret=0;while(_x){if(_x%2==1)_ret++;_x/=2;}return _ret;}
int bit(lli _mask,int _i){return (_mask&(1ll<<_i))==0?0:1;}
int add(int a,int b,int m=MOD){int x=a+b;while(x>=m)x-=m;while(x<0)x+=m;return x;}
int sub(int a,int b,int m=MOD){int x=a-b;while(x<0)x+=m;while(x>=m)x-=m;return x;}
int mul(int a,int b,int m=MOD){lli x=a*1ll*b;x%=m;while(x<0)x+=m;return (int)x;}
int ldtoint(ld x){return (int)(x+0.5);}lli ldtolli(ld x){return (lli)(x+0.5);}
int powermod(lli _a,lli _b,int _m=MOD){lli _r=1;while(_b){if(_b%2==1)_r=mul(_r,_a,_m);_b>>=1;_a=mul(_a,_a,_m);}return _r;}

template<class T1,class T2>ostream&operator<<(ostream& os,const pair<T1,T2>&p){os<<"["<<p.first<<","<<p.second<<"]";return os;}
template<class T>ostream&operator<<(ostream& os,const vector<T>&v){os << "[";bool first=true;for (T it:v){if (!first)os<<", ";first = false;os<<it;}os<<"]";return os;}
template<class T>ostream&operator<<(ostream& os,set<T>&v){os<<"[";bool first=true;for (T it:v){if(!first)os<<", ";first=false;os<<it;}os<<"]";return os;}
template<class T1,class T2>ostream&operator<<(ostream& os,map<T1,T2>&v){os<<"[";bool first=true;for(pair<T1,T2> it:v){if(!first)os<<", ";first=false;os<<"("<<it.F<<","<<it.S<<")";}os<<"]";return os;}
template<class T>void parr(T a[],int s,int e){cout<<"[";for(int i=s;i<e;i++)cout<<a[i]<<", ";cout<<a[e]<<"]\n";}

int N;

int main()
{
if(LOCAL){
    freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    debug = 1;
}
    srand (time(NULL));
    //ios::sync_with_stdio(0);cin.tie(0);

    cin>>N;
    vector<int> ans;
    ans.resize(26,1000);
    for(int i=1;i<=N;i++){
        string s;
        cin>>s;
        vector<int> v;
        v.resize(26,0);
        for(char c : s)
            v[c-'a']++;
        for(int j=0;j<26;j++)
            ans[j] = min(ans[j],v[j]);
    }
    for(int j=0;j<26;j++)
        while(ans[j]--)
            cout<<(char)(j+'a');

    return 0;
}


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

int main() {
  int N,K; cin >> N >> K;
    if ( N < K  ) {
    cout << 1 << endl;
  } else {
      if ( N % K == 0 ) cout << 0 << endl;
      else cout << 1 << endl;
  }
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

/**
 * Created by labuser on 2016/04/20.
 */
public class Main {
    public static void main(String[] args) {
        new Main().run();

    }

    private void run() {

        int a, b, c;

        Scanner sc = new Scanner(System.in);
        String[] input = sc.nextLine().split(" ");
        a = Integer.parseInt(input[0]);
        b = Integer.parseInt(input[1]);
        c = Integer.parseInt(input[2]);
        int cnt = 0;
        for (int i = a; i <= b; i++) {
            if (c % i == 0) cnt++;
        }
        System.out.println(cnt);
    }
}

Measured memory_bytes: 26216
#include <stdio.h>
int main(void)
{
int a,b,c;

scanf("%d %d %d",&a,&b,&c);

if(a <= b && b <= c)
 printf("%d %d %d\n",a,b,c);

else if(a <= c && c <= b)
 printf("%d %d %d\n",a,c,b);

else if(b <= a && a <= c)
 printf("%d %d %d\n",b,a,c);

else if(b <= c && c <= a)
 printf("%d %d %d\n",b,c,a);

else if(c <= a && a <= b)
 printf("%d %d %d\n",c,a,b);

else if(c <= b && b <= a)
 printf("%d %d %d\n",c,b,a); 

return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
#include <cstdlib>
#include <cmath>
#include <algorithm>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using Graph= vector<vector<int>>; 
#define rep(i,n) for (ll i=0; i < (n); ++i)
#define rep2(i,n,m) for(ll i=n;i<=m;i++)
#define rep3(i,n,m) for(ll i=n;i>=m;i--)
#define pb push_back
#define eb emplace_back
#define ppb pop_back
#define mpa make_pair
#define fi first
#define se second 
#define set20 cout<<fixed<<setprecision(20) ;
const ll INF=1e18 ;
inline void chmax(ll& a,ll b){a=max(a,b);}
inline void chmin(ll& a,ll b){a=min(a,b);}
double pi=acos(-1) ;
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}


int main(){
 ll n ; cin>> n ;
 vector<ll> A(n) ; rep(i,n) cin>>A[i] ;
 ll sum= 0;
 rep(i,n){
     sum ^= A[i] ;
 }
 vector<ll> ord(n) ;
 rep(i,n){
     ll a= A[i] ;
     ll b= 0 ;
     while(a%2==0){
         a/=2  ;
         b++ ;
     }
     //cout<< b<<endl ;
     ord[i]= pow(2,b+1)-1 ;  // pow(2,b+1)-1
 
 }

 sort(ord.rbegin(),ord.rend()) ;
 ll ko  =INF ;
 vector<ll> po  ;
 rep(i,n){
   if(ord[i]!=ko){
       po.pb(ord[i]) ;
       ko= ord[i] ;
   }
 }
 // for(auto u :po) cout<<u<<endl ; 
 bool ok =0 ;ll ans=0 ;
 for( auto u: po){
      if( sum*2<u) continue ;
      if(sum<=u&& u<sum*2){
        ans++ ;
        sum = sum^ u ;
      }
      else {
          ok=1 ;
          break;
      }
 }
  if(sum!=0) ok=1 ;
  if(ok) cout<<-1<<endl ;
  else cout<< ans<<endl ;
 return 0 ; 
}



Measured memory_bytes: 4888
import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;

public class Main {
    static Input in = new Input(System.in);
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) {
        int N = in.nextInt();
        out.println(2 * Math.PI * N);
        out.flush();
    }

    static class Input {
        private BufferedReader br;
        private String[] buff;
        private int index = 0;

        Input(InputStream is) {
            br = new BufferedReader(new InputStreamReader(is));
        }
        String nextLine() {
            try {
                return br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return null;
        }
        String next() {
            while (buff == null || index >= buff.length) {
                buff = nextLine().split(" ");
                index = 0;
            }
            return buff[index++];
        }
        byte nextByte() {
            return Byte.parseByte(next());
        }
        short nextShort() {
            return Short.parseShort(next());
        }
        int nextInt() {
            return Integer.parseInt(next());
        }
        long nextLong() {
            return Long.parseLong(next());
        }
        float nextFloat() {
            return Float.parseFloat(next());
        }
        double nextDouble() {
            return Double.parseDouble(next());
        }
        BigInteger nextBigInteger() {
            return new BigInteger(next());
        }
        BigDecimal nextBigDecimal() {
            return new BigDecimal(next());
        }
    }
}

Measured memory_bytes: 33336
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i,n) for(ll i = 0; i<(ll)(n); i++)
#define REPS(i,n) for (ll i = 1; i<=(ll)(n); i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define pb push_back
#define MOD 1000000007
#define MOD2 998244353
#define PI 3.141592653
#define INF 100000000000000 //14

int main(){
	string s; cin >> s; string t=""; ll cntl = 0; ll cnto = 0; ll cnter = 0;
	REP(i,s.size()){
		if (i==0&&s[i]=='1') cnter++;
		else if (i==0&&s[i]=='0') t+='0';
		else if (i!=s.size()-1&&s[i]=='1') cnter++;
		else if (s[i-1]=='0'&&s[i]=='0') t+='0';
		else{
			if (i==s.size()-1&&s[i]=='1') cnter++;
			cntl+=(cnter/2)*2; cnto+=cnter;
			if (cnter%2) t+='1';
			if (s[i]!='1') t+='0';
			cnter = 0;
		}
	}
	ll x = cnto/2;
	ll ans =(s.size()-cnto+1)*cntl/2;
	if (cnto%2) ans+=x*x+x;
	else ans+=x*x;
	cnter=1;
	ll cnter2=0;
	REP(i,t.size()){
		if (t[i]=='1'){
			ans+=(i+1-cnter)/2+1;
			cnter+=2;
			cnter2++;
		}
		if (i!=t.size()-1&&t[i]=='0'&&t[i+1]=='0') ans+=cnter2;
		if (i==t.size()-1&&t[i]=='0') ans+=cnter2;
	}
	ll z = (cnter-1)/2;
	FOR(i,1,z-1) ans+=(i+(z-i)/2);
	if(s=="1") ans++;
	cout << ans << endl;
}

Measured memory_bytes: 3924
#include<bits/stdc++.h>
#include<atcoder/all>
using namespace std;
using namespace atcoder;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> 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; }
template<typename T> T gcd(T a,T b){return b?gcd(b,a%b):a;}
const ll MOD=998244353;
const ll LINF=1ll<<60;
const int INF=1<<30;
int dx[]={1,0,-1,0,1,-1,1,-1};
int dy[]={0,1,0,-1,1,-1,-1,1};




vector<ll> divi(ll K){
    vector<ll> v;
    for(ll i=1;i*i<=K;i++){
        if(K%i) continue;
        v.pb(i);
        v.pb(K/i);
    }
    sort(ALL(v));
    v.erase(unique(ALL(v)),v.end());
    return v;
}



int main(){
    ll n;cin >> n;
    auto p = divi(2 * n);
    ll ans = LINF;
    for (int i = 0; i < p.size(); i++) {
        vector<ll> r({0, -1});
        vector<ll> m({p[i], 2 * n / p[i]});
        auto x = crt(r, m);
        if(x.fs == 0) continue;
        chmin(ans, x.fs);
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 3736
# include "bits/stdc++.h"
using namespace std;
using LL = long long;
using ULL = unsigned long long;
const double PI = acos(-1);
template<class T>constexpr T INF() { return ::std::numeric_limits<T>::max(); }
template<class T>constexpr T HINF() { return INF<T>() / 2; }
template <typename T_char>T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char>T_char TU(T_char cX) { return toupper(cX); };
typedef pair<LL, LL> pii;
const int vy[] = { -1, -1, -1, 0, 1, 1, 1, 0 }, vx[] = { -1, 0, 1, 1, 1, 0, -1, -1 };
const int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
int popcnt(unsigned long long n) { int cnt = 0; for (int i = 0; i < 64; i++)if ((n >> i) & 1)cnt++; return cnt; }
int d_sum(LL n) { int ret = 0; while (n > 0) { ret += n % 10; n /= 10; }return ret; }
int d_cnt(LL n) { int ret = 0; while (n > 0) { ret++; n /= 10; }return ret; }
LL gcd(LL a, LL b) { if (b == 0)return a; return gcd(b, a%b); };
LL lcm(LL a, LL b) { LL g = gcd(a, b); return a / g*b; };
# define ALL(qpqpq)           (qpqpq).begin(),(qpqpq).end()
# define UNIQUE(wpwpw)        sort(ALL((wpwpw)));(wpwpw).erase(unique(ALL((wpwpw))),(wpwpw).end())
# define LOWER(epepe)         transform(ALL((epepe)),(epepe).begin(),TL<char>)
# define UPPER(rprpr)         transform(ALL((rprpr)),(rprpr).begin(),TU<char>)
# define FOR(i,tptpt,ypypy)   for(LL i=(tptpt);i<(ypypy);i++)
# define REP(i,upupu)         FOR(i,0,upupu)
# define INIT                 std::ios::sync_with_stdio(false);std::cin.tie(0)

int a, b, c;

int main(){
    INIT;
    cin >> a >> b >> c;
    cout << a*b/2 << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<map>
#include<stack>
#include<cmath>
#include<iomanip>
#include<set>
#include<numeric>
#include<sstream>
#include<random>
#include<cassert>
#include<complex>
#include<list>
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 dy[] = {0, 0, -1, 1, -1, 1, -1, 1};
int dx[] = {1, -1, 0, 0, -1, 1, 1, -1};
//#define ceil(a, b) a / b + !!(a % b)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)

int n, k;
double tmp(int i) {
    return max(0.0, n - ceil(k * pow(0.5, i)) + 1);
}
int main() {
	cin >> n >> k;
    double ans = max(0, n - k + 1);
    for (int i = 1; i < 30; ++i) {
        ans += tmp(i) * pow(0.5, i) - tmp(i - 1) * pow(0.5, i);
    }
    cout << fixed << setprecision(10);
    cout << ans / n << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
long long length[50],patty[50];

long long ans(int n,long long x){
    if(n==0&&x>=1) return 1;
    if(x<=1) return 0;
    long long ret=0;
    if(x<=length[n-1]+1) ret=ans(n-1,x-1);
    if(x>=length[n-1]+2) ret=patty[n-1]+1+ans(n-1,x-length[n-1]-2);
    return ret;
}

signed main(){
    int N;
    long long X;
    cin>>N>>X;
    length[0]=1;
    patty[0]=1;
    REP(i,N-1){ 
        length[i+1]=2*length[i]+3;
        patty[i+1]=2*patty[i]+1;
    }
    cout<<ans(N,X)<<endl;
}

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

using namespace std;

typedef long double ld;
typedef complex<ld> P;

const ld eps = 1e-12;

P input() {
	ld x1, y1, x2, y2; cin >> x1 >> y1 >> x2 >> y2;
	return P(x1-x2, y1-y2);
}
ld dot(P p1, P p2) {
	return p1.real()*p2.real() + p1.imag()*p2.imag();
}
int main() {
	int n; cin >> n;
	for (int i = 0; i < n; ++i) {
		P p1 = input();
		P p2 = input();
		ld d = dot( p1 * P(0, 1), p2 );
		if ( abs(d) < eps ) {
			cout << "YES" << endl;
		}
		else {
			cout << "NO" << endl;
		}
	}
}

Measured memory_bytes: 1232
#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 << "Right" << endl;
  }
  else {
    cout << "Balanced" << endl;
  }
}

Measured memory_bytes: 256
//  Created by conan1024hao in 2020.
//  Copyright © 2020 conan1024hao. All rights reserved.
//  専用ライブラリです、自由にコピーして構いません。
//  感谢看我的代码！Wechat:conan1024hao Twitter/QQ:810396815
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define IINF 10e8
#define INF 10e17
#define MOD 1000000007
#define mod 1000000007
#define rep(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define Endl endl
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
//using Int=int_fast64_t;
typedef long long int ll;
typedef long long int LL;
typedef pair<ll,ll>Pll;
typedef pair<int,int>Pin;
template<class T> using V=vector<T>;
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }
long long LCM(long long a, long long b)  {return a/GCD(a,b)*b;}
int dx[4]={-1,0,1,0};
int dy[4]={0,-1,0,1};
int ddx[8]={-1,0,1,0,1,1,-1,-1};
int ddy[8]={0,-1,0,1,1,-1,1,-1};
char dir[4]={'u','l','d','r'};
ll cmp1(pair<ll,string>a,pair<ll,string> b){
        if(a.fi!=b.fi)
        return a.fi<b.fi;
        else
        return a.se<b.se;
}

//---------------------------------------------------------------------------
ll n,a;vector<ll>x;
ll dp[55][55][2555]; // dp[インデックス][枚数][合計] = 総数

ll cal(ll idx,ll cnt,ll sum){
    if(idx>=n)
        return (cnt*a==sum&&sum!=0);
    
    if(dp[idx][cnt][sum]!=-1)
        return dp[idx][cnt][sum];
    
    ll yes= cal(idx+1,cnt+1,sum+x[idx]);
    ll no = cal(idx+1,cnt,sum);
    
    dp[idx][cnt][sum]=yes+no;
    return dp[idx][cnt][sum];
}
//---------------------------------------------------------------------------
int main(){//問題をちゃんと見ろ!!!!!!!!!!!!!!!!!      llか??????????统一类型        memset()!!!!!!!!!!!!       ペナを減らせ!!!!!!!!!!!!!
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------
    cin>>n>>a;
    x.resize(n);
    
    for(int i=0;i<n;i++)cin>>x[i];
    
    memset(dp,-1,sizeof(dp));
    
    ll ans=cal(0,0,0);
    
    cout<<ans<<endl;
    //-------------------------------
    return 0;
}
//---------------------------------------------------------------------------








Measured memory_bytes: 60672
let n, m = Scanf.scanf " %d %d" @@ fun a b -> a, b
let yps = Array.init m @@ fun i -> Scanf.scanf " %d %d" @@ fun a b -> b, a, i
let rs, ns = Array.make (n + 1) 1, Array.make m ""
let _ = Array.sort compare yps; Array.iter (fun (_, p, i) -> ns.(i) <- Printf.sprintf "%06d%06d" p rs.(p); rs.(p) <- rs.(p) + 1) yps; Array.iter print_endline ns

Measured memory_bytes: 12416
#include<stdio.h>
     
     
    void insertionSort(int a[],int n){
        int i,j,v;
        for(i=1;i<n;i++){
            v=a[i];          //v:未ソート部分の先頭
            j=i-1;
            while(j>=0&&a[j]>v){
                a[j+1]=a[j];    //vより大きい要素を後方へ移動
                j--;
            }
            a[j+1]=v;
        }
    }
     
    int main(void){
        int n,i,ans;
        scanf("%d",&n);
        int d[n];
        for(i=0;i<n;i++){
            scanf("%d",&d[i]);
        }
        insertionSort(d,n);
        ans=d[n/2]-d[n/2-1];
        printf("%d\n",ans);
        //printf("%d %d",d[n/2+1]);
        return 0;
    }

Measured memory_bytes: 512
class Railway
  def initialize
    results = []
    while input = $stdin.gets do
      @rails = input.chomp.split(',').map(&:to_f)
      @v2 = @rails.pop
      @v1 = @rails.pop
      results << cross_check
    end

    results.each do |point|
      puts point
    end
  end

  def cross_check
    rate = @rails.inject(:+) / (@v1+@v2)
    point = rate * @v1
    d = 0
    @rails.each_with_index do |dist, index|
      d += dist
      return index+1 if point <= d
    end
  end
end

r = Railway.new

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

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


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

int main(){
    int N;
    cin >> N;
    int judge = 1;
    for(int i =0; i < N; i++){
        int a;
        cin >> a;
        if(a == judge) judge ++; 
    }
    judge --;
    if(judge > 0)cout << N - judge << endl;
    else cout << -1 << endl;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include<bits/stdc++.h>//////////////////////////////////////////
#define deb(...)/////////////////////////////////////////////////
#define DBP(...)/////////////////////////////////////////////////
#ifdef LOC///////////////////////////////////////////////////////
#include"debuglib.h"/////////////////////////////////////////////
#endif///////////////////////////////////////////////////////////
#define x first//////////////////////////////////////////////////
#define y second/////////////////////////////////////////////////
#define pb push_back/////////////////////////////////////////////
#define sz(x)int((x).size())/////////////////////////////////////
#define each(a,x)for(auto&a:(x))/////////////////////////////////
#define all(x)(x).begin(),(x).end()//////////////////////////////
#define rep(i,b,e)for(int i=(b);i<(e);i++)///////////////////////
using namespace std;using ll=long long;using Pii=pair<int,int>;//
using Vi=vector<int>;void run();int main(){cin.sync_with_stdio///
(0);cin.tie(0);cout<<fixed<<setprecision(18);run();return 0;}////
//-------------------------------------------------------------//

vector<Vi> G;
Vi col;

void dfs(int v, int c) {
	if (col[v]) {
		if (col[v] != c) {
			cout << -1 << endl;
			exit(0);
		}
		return;
	}

	col[v] = c;
	each(e, G[v]) dfs(e, c == 1 ? 2 : 1);
}

int check(int root) {
	queue<int> que;
	Vi dists(sz(G), -1);

	que.push(root);
	dists[root] = 0;

	while (!que.empty()) {
		int v = que.front();
		que.pop();
		each(e, G[v]) {
			if (dists[e] == -1) {
				dists[e] = dists[v]+1;
				que.push(e);
			}
		}
	}

	int ret = 0;
	each(d, dists) ret = max(ret, d);
	return ret+1;
}

void run() {
	int n; cin >> n;
	G.resize(n);
	col.resize(n);

	rep(i, 0, n) {
		string s; cin >> s;
		rep(j, 0, n) {
			if (s[j] == '1') {
				G[i].pb(j);
			}
		}
	}

	dfs(0, 1);
	int ans = 0;
	rep(i, 0, n) ans = max(ans, check(i));
	cout << ans << endl;
}


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

bool Judge(const vector<int>& A) {
    for (auto x: A){
        if ((x % 2 == 0) && !((x % 3 == 0) || (x % 5 == 0))){
            return false;
        }
    }
    return true;
}

int main() {
    size_t N;
    cin >> N;
    vector<int> A(N);
    for (int i=0; i<N; i++) {
        cin >> A[i];
    }
    if (Judge(A)) cout << "APPROVED" << endl;
    else cout << "DENIED" << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long a = sc.nextInt();
        long b = sc.nextInt();
        long A = a;
        long B = b;
        for (int i=1;i<b;i++) A=A*10+a;
        for (int i=1;i<a;i++) B=B*10+b;
        if (a<=b) System.out.println(A);
        else System.out.println(B);
    }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
//#define ll long long
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
#define rep(i, n) REP(i, 0, n)
#define rep_rev(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
#define all(x) (x).begin(),(x).end()
ll t1,t2,t3;
const ll mod = 1000000007;
const int INF = 1e9;
const ll INFLONG = 1e18;
void swap(ll *x,ll *y) {
  ll tmp;
  tmp = *x;
  *x = *y;
  *y = tmp;
}
int main(){
  ll n;
  cin >> n;
  ll sum = 0;
  REP(i,1,n+1){
    if(i % 3 != 0 && i % 5 != 0){
      sum += i;
    }
  }
  cout << sum << endl;
}

Measured memory_bytes: 3624
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author champon
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 1e18
#define ceill(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
#define sp << " " <<
ll mod = 1e9+7;
void ans(bool b, ostream& out=cout){ out << (b ? "Yes" : "No") << endl; }
void ans2(bool b, ostream& out=cout){ out << (b ? "YES" : "NO") << endl; }
template<typename T> inline bool chmax(T &a, T b){ if(a<b) a=b; return a<b; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a) a=b; return b<a; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val){fill((T*)array, (T*)(array+N), val);}
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};

#ifndef INCLUDE_DEBUG_HPP
#define INCLUDE_DEBUG_HPP

class debug
{
public:
    template<typename T> void vdeb(T vec);
    template<typename T1, typename T2> void adeb(T1 *arr, T2 n);
    template<typename T> void mdeb(T mp);
};

#endif //INCLUDE_DEBUG_HPP

template<typename T> void debug::vdeb(T vec)
{
    cout << "#vector set debug" << endl;
    for(auto vv : vec) cout << vv << " ";
    cout << endl;
}

template<typename T1, typename T2> void debug::adeb(T1 *arr, T2 n)
{
    cout << "#adebug" << endl;
    for(int i=0; i<=n; i++) cout << arr[i] << " ";
    cout << endl;
}

template<typename T> void debug::mdeb(T mp)
{
    cout << "#map pair debug" << endl;
    for(auto const& m : mp) cout << m.first sp m.second << endl;
}
debug dbg;

class AAtCoderCrackers {
public:
	void solve(std::istream& in, std::ostream& out)
	{
	    int n, k;
	    in >> n >> k;
	    if(n%k == 0) out << 0 << endl;
	    else out << 1 << endl;
	}
};


int main() {
	AAtCoderCrackers solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256