akhauriyash/Code-Regression huggingface dataset:
# def function(n)
# 	if n < 2
# 		1
# 	else
# 		n * function(n - 2)
# 	end
# end

def number_of_zero_for_f(n)
	# n が奇数なら必ず 0.
	return 0 if n.odd?

	number_of_five = 0
	# n が偶数の場合, 2, 4, ..., n の中の約数5の個数を数える.
	number_to_divide = 5
	while (number_to_divide * 2 <= n)
		number_of_five += n / 2 / number_to_divide
		number_to_divide *= 5
	end
	number_of_five
end

n = gets.chomp.to_i
puts number_of_zero_for_f(n)


Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pi pair<int,int>
#define ff first
#define ss second
#define boost ios::sync_with_stdio(false);cin.tie(nullptr)
#define endl "\n"
#include "string"

int32_t main() {
	boost;
	int x, k, d;
	cin >> x >> k >> d;
	x = abs(x);
	int ans = x % d;
	int cur = x / d;
	k -= cur;
	if(k < 0) {
		cout << x - (k + cur) * d << endl;
		return 0;
	}
	if(k % 2)
		ans = min(ans + d,  d - ans);
	cout << ans << endl;
}

Measured memory_bytes: 3644
def main():
    from heapq import heapify, heappushpop
    _, M = (int(i) for i in input().split())
    A = ([int(i) for i in input().split()])
    BC = [[int(i) for i in input().split()] for j in range(M)]

    heapify(A)
    BC.sort(lambda p: p[1], reverse=True)
    for b, c in BC:
        if A[0] >= c:
            break
        for _ in range(b):
            if A[0] >= c:
                break
            heappushpop(A, c)
    print(sum(A))


if __name__ == '__main__':
    main()


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

int main() {
	// your code goes here
	int x;
	cin >> x;
	int add = x;
	int count = 0;
	while (x % 360 != 0) {
	    x += add;
	    //cout << x << endl;
	    count++;
	}
	cout << count + 1 <<  endl;
}


Measured memory_bytes: 3584
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <functional>

using namespace std;

#define fst first
#define scd second
#define PB push_back
#define MP make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define omajinai ios::sync_with_stdio(false);cin.tie(0)
#define rep(i,x) for(int i=0;i<(int)(x);++i)
#define rep1(i,x) for(int i=1;i<=(int)(x);++i)
#define rrep(i,x) for(int i=(int)x-1;i>=0;--i)
#define rrep1(i,x) for(int i=(int)x;i>=1;--i)

using ll=long long;
using ld=long double;
using vi=vector<int>;
using vvi=vector<vi>;
using pii=pair<int, int>;
using vpii=vector<pii>;

template<class T,class U>ostream&operator<<(ostream&os,const pair<T,U>p){os<<"("<<p.fst<<", "<<p.scd<<")";return os;}
template<class T>ostream&operator<<(ostream&os,const vector<T>v){rep(i,v.size()){if(i)os<<", ";os<<v[i];}return os;}
template<typename T>T&max(T&a,T&b){if(a>=b)return a;return b;}
template<typename T>T&min(T&a,T&b){if(a < b)return a;return b;}
template<typename T>bool chmax(T&a,T b){if(a < b){a=b;return true;}return false;}
template<typename T>bool chmin(T&a,T b){if(a > b){a=b;return true;}return false;}
constexpr ll TEN(ll n){return n==0?1:10ll*TEN(n-1);}

constexpr ll inf = TEN(9)+5;
constexpr ll linf = 3*TEN(18);

signed main()
{
    int A, B, T; cin >> A >> B >> T;
    cout << T / A * B << endl;
}


Measured memory_bytes: 3624
import numpy as np
import scipy.sparse as sps
import scipy.misc as spm
import collections as col
import functools as func
import itertools as ite
import fractions as frac
import math as ma
from math import cos,sin,tan
import cmath as cma
import copy as cp
import sys
def sinput(): return sys.stdin.readline().strip()
def iinput(): return int(sinput())
def imap(): return map(int, sinput().split())
def fmap(): return map(float, sinput().split())
def iarr(n=0):
    if n: return [0 for _ in range(n)]
    else: return list(imap())
def farr(): return list(fmap())
def sarr(n=0):
    if n: return ["" for _ in range(n)]
    else: return sinput().split()
def barr(n): return [False for _ in range(n)]
sys.setrecursionlimit(10**7)
MOD = 10**9 + 7; EPS = sys.float_info.epsilon
PI = np.pi; EXP = np.e; INF = np.inf

a,b,h,m = imap()

r1 = 2*PI * (h/12 + m/60/12)
r2 = 2*PI * (m/60)

z1 = a * complex(cos(r1), sin(r1))
z2 = b * complex(cos(r2), sin(r2))

ans = abs(z1 - z2)
print(ans)


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

string solve(int a, int b, int c, int k){
    if(c > b and b > a)
        return "Yes";
    
    while(b <= a and k > 0){
        b *= 2;
        k--;
    }
    while(c <= b and k > 0) {
        c *= 2;
        k--;
    }
    if(c > b and b > a)
        return "Yes";
    return "No";
}
int main(){
    int a,b,c,k;
    cin>>a>>b>>c>>k;
    cout<<solve(a,b,c,k)<<"\n";
    return 0;
}

Measured memory_bytes: 3596
import sys
input = sys.stdin.readline


def main():
    MOD = 10 ** 9 + 7
    N = int(input())
    A = [int(x) for x in input().split()]

    x = [0] * 61
    for i in range(N):
        for j in range(61):
            if A[i] >> j & 1:
                x[j] += 1
    ans = sum(A) * (N - 1)
    for i, v in enumerate(x):
        if v == 0 or v == 1:
            continue
        else:
            z = (2 ** i) * (v * (v - 1))
            ans = ans - z

    print(ans % MOD)







if __name__ == '__main__':
    main()



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

const int INF = 1e9;

int main() {
  // 入力
  int N, M, R;
  cin >> N >> M >> R;
  int r[R];
  for (int i = 0; i < R; i++) {
    cin >> r[i];
    r[i]--;
  }

  int dist[N][N]; // 最短距離を格納する二次元配列
  // 初期化
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      dist[i][j] = (i == j ? 0 : INF);
    }
  }

  int a[M], b[M], c[M];
  for (int i = 0; i < M; i++) {
    cin >> a[i] >> b[i] >> c[i];
    a[i]--; b[i]--;
    dist[a[i]][b[i]] = dist[b[i]][a[i]] = c[i];
  }

  // Nが最大200と小さいので、ワーシャルフロイドで全2頂点間の最短距離を求める
  for (int k = 0; k < N; k++) { // 経由頂点
    for (int i = 0; i < N; i++) { // 開始頂点
      for (int j = 0; j < N; j++) { // 終了頂点
        dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
      }
    }
  }

  // Rはmin(8, N)なので、順列を全て試せる
  sort(r, r + R);
  int ans = INF;
  do {
    int d = 0;
    for (int i = 0; i < R - 1; i++) {
      d += dist[r[i]][r[i+1]];
    }
    ans = min(ans, d);
  } while (next_permutation(r, r + R));

  // 解答
  cout << ans << endl;

  return 0;
}


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

int main(){
    int a,b,c;
    cin>>a>>b>>c;
    if(a==b&&b==c)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

#define REP(i, a, b) for ( int i = (a); i < (b); i++ )
#define REVREP(i, a, b) for ( int i = (a); i >= (b); i--)
#define DEBUG_INT(var) printf("the value of "#var" is %d\n", var)
#define PRINT_ARRAY(name, i) printf("the value of "#name"[%d] is %d\n", (i), name[(i)])
#define DEBUG_ARRAY(name, begin, end) REP(i, begin, end) PRINT_ARRAY(name, i)

#define YES puts("YES")
#define NO  puts("NO")
#define Yes puts("Yes")
#define No  puts("No")

using namespace std;

typedef long long ll;

int ans = 1, N, K;
// X X X

int main(void) {
    scanf("%d %d", &N, &K);
    int idx = -1;
    REP(i, 1, N+1) {
    	int a;
    	scanf("%d", &a);
    }
    for (int i = 0; i + K - 1 < N-1; i += K - 1) {
    	ans++;
    }

    printf("%d\n", ans);

	return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast,O3,unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>
using namespace __gnu_pbds;
using namespace std;

#define endl '\n'
#define hoise cerr<<"hoise - "<<__LINE__<<"\n";
#define tham getchar();
#define FASTIO ios::sync_with_stdio(false);cin.tie(nullptr);

using ll = long long;
using ii = pair <int, int>;
using vi = vector <int>;
using vl = vector <ll>;

const int MXN = (int)2e5+6;
const double PI = acos(-1.0);
const ll mod = 1e9 + 7;
const int INF = 1e9;

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << endl;
    err(++it, args...);
}

inline int Set(int N, int pos){return N=N | (1<<pos);}
inline int Reset(int N, int pos){return N=N & ~(1<<pos);}
inline bool Check(ll N, ll pos){return (bool)(N & (1LL<<pos));}

inline void normal(ll &a) { a %= mod; (a < 0) && (a += mod); }
inline ll modMul(ll a, ll b) { a %= mod, b %= mod; normal(a), normal(b); return (a * b) % mod; }
inline ll modAdd(ll a, ll b) { a %= mod, b %= mod; normal(a), normal(b); return (a + b) % mod; }
inline ll modSub(ll a, ll b) { a %= mod, b %= mod; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while (p) { if (p & 1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, mod - 2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }


template <typename T> using orderedSet = tree<T, null_type, greater<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename T> using orderedSet1 = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
/*--------------------------------------------------------------------------------------------------------------------------*/




int main(){
	FASTIO
	int k, a, b;
	cin >> k >> a >> b;
	int x = k;
	int cnt = 1;
	while (1) {
		if (x >= a && x <= b) {
			cout << "OK\n";
			return 0;
		}
		x = k * cnt;
		cnt++;
		if (x > b) {
			cout << "NG\n";
			break;
		}
	}
	
    return 0;
}

/*

*/


Measured memory_bytes: 3648
#include<cstdio>
//meet in the middle
int f[2048][100005];
int value[300005], weight[300005];
int vis[300005];
int stack[1024];

int max(int a,int b){ return a>b?a:b; }

void preWork(int u,int d,int n){
	vis[u] = 1;
	int p = u/2;
	for(int i = 0; i <= 100000; i++){
		f[u][i] = f[p][i];
		if(i-weight[u]>=0) f[u][i] = max(f[u][i],f[p][i-weight[u]]+value[u]);
		if(i!=0) f[u][i] = max(f[u][i],f[u][i-1]);
	}
	if(d+1<=10){
		if(2*u<=n) preWork(2*u,d+1,n);
		if(2*u+1<=n) preWork(2*u+1,d+1,n);
	}
}

int main(){
	int n;
	scanf("%d",&n);
	for(int i = 1; i <= n; i++){
		scanf("%d%d",&value[i],&weight[i]);
	}
	preWork(1,1,n);
	int q;
	scanf("%d",&q);
	while(q--){
		int p,l;
		scanf("%d%d",&p,&l);
		if(vis[p]) printf("%d\n",f[p][l]);
		else{
			int last = p, cnt = 0;
			while(vis[last]==0){ 
				stack[++cnt] = last;
				last /= 2;
			}
			int ans = f[last][l];
			for(int i = 0; i < (1<<cnt); i++){
				int totalW = 0, totalV = 0;
				int mask = i;
				for(int j = 1; j <= cnt; j++){
					if(mask%2) totalW += weight[stack[j]], totalV += value[stack[j]];
					mask /= 2;
				}
				if(totalW<=l) ans = max(ans,f[last][l-totalW]+totalV);
			}
			printf("%d\n",ans);
		}
	}
	
	return 0;
}


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

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 998244353

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

ll seica[111111];

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

	ll n;cin >> n;
	vector<pair<ll, P>> v;
	REP(i, n){
		ll x, l;cin >> x >> l;
		v.EB(x - l, MP(1, i));
		v.EB(x + l, MP(-1, i));
	}

	sort(ALL(v));
	ll ma = 0;
	REP(i, v.size()){
		auto now = v[i];
		ll id = now.SE.SE;
		if(now.SE.FI > 0){
			seica[id] = ma + 1;
		}
		else {
			ma = max(ma, seica[id]);
		}
	}

	ll ans = 0;
	REP(i, 111111)ans = max(ans, seica[i]);
	cout << ans << endl;

	return 0;
}


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

#define REP(i,n) for(int i=0;i<(n);i++)
#define REAP(i,a,n) for(int i=(a);i<(n);i++)
#define YES cout<<"Yes"<<endl
#define NO cout<<"No"<<endl
#define fr first
#define sc second
#define pb push_back
#define All(v) v.begin(),v.end()
typedef long long ll;

int main(){
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    if(n%2==0)cout << n << endl;
    else cout << n*2 << endl;
}


Measured memory_bytes: 256
def knapsack(items, budget)
    table = (0..1).map{ Array.new(budget+1, 0) }
    for i in 0..items.size-1
        c, v = items[i]
        for j in 0..budget
            x = table[0][j]
            y = (j >= c ? table[0][j-c] + v : 0)
            table[1][j] = x > y ? x : y 
        end
        table << table.shift
    end 
    table[0][budget]
end

loop do
    n = gets.to_i
    break if n == 0
    read_time, write_time = (1..n).map{gets.split.map(&:to_i)}.sort.transpose
    if n == 1
        p read_time[0] * 2 + write_time[0]
    elsif read_time[-1] * 2 > read_time.inject(:+)  
        t1 = read_time.pop
        t2 = read_time.inject(:+)
        space = t1 - t2
        t3 = knapsack(write_time[0..-2].map{|x| [x, x]}, space)
        p 2 * t1 + write_time.inject(:+) - t3
    else
        p read_time.inject(:+) + write_time.inject(:+)
    end 
end

Measured memory_bytes: 8996
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define INF 0x6fffffff
#define INFL 0x6fffffffffffffffLL

int main() {
	ll		a,b,c,h,i,j,k,l,m,n,x,y;
	ll		ans = 0;
	string	s;
	cin >> a >> b >> c;


	while((a%2)==0 && (b%2)==0 && (c%2)==0) {
		if (a==b && b==c) {
			cout << -1 << endl;
			return 0;
		}
		ans++;
		i = b/2 + c/2;
		j = a/2 + c/2;
		k = a/2 + b/2;
		a = i;
		b = j;
		c = k;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#[allow(dead_code)]
fn is_whitespace(c: &char) -> bool {
    c.is_whitespace()
}

#[allow(dead_code)]
fn is_eol(c: &char) -> bool {
    ['\r', '\n'].contains(c)
}

#[allow(unused_macros)]
macro_rules! input {
    ($var:ident, $($r:tt)*) => {
        input_inner!{$var, $($r)*}
    };

    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        #[allow(unused_mut, unused_variables, bare_trait_objects)]
        let mut next = move |f: &Fn(&char)->bool| -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|f(&c))
                .take_while(|c|!f(&c))
                .collect()
        };
        input_inner!{next, $($r)*};
    };
}

#[allow(unused_macros)]
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)*}
    };

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; eol ]) => {
        $next(&is_eol).split(' ').map(|x| x.parse::<$t>().unwrap()).collect::<Vec<_>>()
    };

    ($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, bytes) => {
        read_value!($next, String).into_bytes()
    };

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

    ($next:expr, parser) => {
        $next
    };

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

#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{BinaryHeap, HashMap, HashSet};

#[allow(dead_code)]
struct Edge {
    from: usize,
    to: usize,
}

#[allow(dead_code)]
type Graph = Vec<Vec<usize>>;
#[allow(dead_code)]
const M: usize = 1_000_000_007;

fn main() {
    input! {
        n: usize,
        s: usize,
        a: [usize; n],
    }
    let mut dp = vec![vec![0; s + 1]; n + 1];
    dp[0][0] = 1usize;
    for i in 0..n {
        for j in 0..s + 1 {
            if j >= a[i] {
                dp[i + 1][j] = dp[i][j] * 2 + dp[i][j - a[i]];
            } else {
                dp[i + 1][j] = dp[i][j] * 2;
            }
            dp[i + 1][j] %= 998244353;
        }
    }
    println!("{}", dp[n][s]);
}


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

    public class Main {


        private void solve(InputReader in, PrintWriter out) {
            int[] arr = new int[3];
            for (int i = 0; i < 3; i++) {
                arr[i] = in.nextInt();
            }
            Arrays.sort(arr);
            int count = 0;
            for (int i = 0; i < arr.length - 1; i++) {
                count += Math.abs(arr[i] - arr[i + 1]);
            }
            out.println(count);
            
        }


        public static void main(String[] args) {
            new Main().run();
        }

        private void run() {
            try (
                    InputReader in = new InputReader(System.in);
                    PrintWriter out = new PrintWriter(System.out)) {
                solve(in, out);
            }
        }


        static class InputReader implements AutoCloseable {
            private BufferedReader reader;
            private StringTokenizer tokenizer;

            public InputReader(InputStream stream) {
                reader = new BufferedReader(new InputStreamReader(stream), 32768);
                tokenizer = null;
            }

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

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

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

            public double nextDouble() {
                return Double.parseDouble(next());
            }

            @Override
            public void close() {

            }
        }

    }


Measured memory_bytes: 22484
Module Module1
  Sub Main()
    Dim a As Integer() = ReadInts()
    If (a(0) * a(1)) Mod 2 = 0 Then
            Console.WriteLine("Even")
        Else
            Console.WriteLine("Odd")
    End If
  End Sub
  Function ReadInts()As Integer()
    Dim a As String() = Console.ReadLine().Split()
    Dim res(a.Length) As Integer
    For index As Integer = 0 To a.Length - 1
      res(index) = CInt(a(index))
    Next
    Return res
  End Function
End Module


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

int main() {
int d;
cin >> d;
if(d==25) cout << "Christmas" << endl;
else if(d==24)cout << "Christmas Eve " << endl;
else if(d==23)cout << "Christmas Eve Eve" << endl;
else cout << "Christmas Eve Eve Eve" << endl;
}
  


Measured memory_bytes: 256
def main():
    N, M = map(int, input().split())
    A = list(map(int, input().split(' ')))
    homework_day = 0
    for i in range(len(A)):
        homework_day = homework_day + A[i]
    if homework_day > N:
        print(-1)
    else:
        print(N - homework_day)
main()

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

using namespace std;

int main() {
    string s; cin >> s;
    int total{0};

    for (char c : s) {
        total += c - '0';
        total %= 9;
    }

    cout << (total % 9 == 0 ? "Yes" : "No") << "\n";
}

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

int main() {
  int N, M;
  scanf("%d%d", &N, &M);

  vector<tuple<int, int, int>> pref_year_id(M);
  for (int i = 0; i < M; i++) {
    int pid, year;
    scanf("%d%d", &pid, &year);
    pref_year_id.at(i) = make_tuple(pid, year, i);
  }

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

  vector<int> pref_id(M), city_id(M), cnt(N + 1);
  for (auto &pyi : pref_year_id) {
    int pid, id;
    tie(pid, ignore, id) = pyi;
    pref_id.at(id) = pid;
    cnt[pid]++;
    city_id.at(id) = cnt[pid];
  }

  for (int i = 0; i < M; i++) {
    cout << setfill('0') << setw(6) << pref_id.at(i);
    cout << setfill('0') << setw(6) << city_id.at(i) << endl;
  }
  return 0;
}


Measured memory_bytes: 3840
import java.util.*;
import java.lang.*;
import java.io.*;


public class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner sc = new Scanner(System.in);
		String c = sc.next();
		if(Character.isUpperCase(c.charAt(0))) System.out.println("A");
		else System.out.println("a");
	}
}


Measured memory_bytes: 35692
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;
#define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i))
#define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d))
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset((m),(v),sizeof(m))
#define chmin(x,y) (x=min(x,y))
#define chmax(x,y) (x=max(x,y))
#define fst first
#define snd second
#define UNIQUE(x) (x).erase(unique(all(x)),(x).end())
template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;}

int main(){
	ll x;
	cin>>x;
	if(x%10==9||x/10==9) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}


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

int main() {
    int n;
    cin >> n;
    long double ans = 0.0;
    for (int i = 0; i < n; i++) {
        int tmp; cin >> tmp;
        ans += 1.0 / tmp;
    }
    printf("%.10Lf\n", 1.0 / ans);
 
    return 0;
}

Measured memory_bytes: 256
N = gets.chomp.to_i
A1 = gets.chomp.split(' ').map(&:to_i)
A2 = gets.chomp.split(' ').map(&:to_i)

sum1, sum2 = [0], [0]
(0..N-1).each do |n|
  sum1[n+1] = sum1[n] + A1[n]
  sum2[n+1] = sum2[n] + A2[n]
end
results = (1..N).map do |n|
  sum1[n-1] + A1[n-1] + sum2[N] - sum2[n-1]
end
puts results.max


Measured memory_bytes: 1916
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#pragma warning(disable : 4996)
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<time.h>
#include<random>
#include<array>


using namespace std;

#define REP(i, n) for(int i = 0;i < n;++i)
#define REPR(i, n) for(int i = n-1;i >= 0;--i)
#define FOR(i, m, n) for(int i = m;i < n;++i)
#define FORR(i, m, n) for(int i = m-1;i >= n;--i)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end())
#define ll long long
#define print(x) cout<<(x)<<'\n'
#define pe(x) cout<<(x)<<" "
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define lb(v,n) lower_bound(v.begin(), v.end(), (n))
#define ub(v,n) upper_bound(v.begin(), v.end(), (n))
#define int long long
//#define double long double
#define all(x) (x).begin(), (x).end()
#define print_space(v) REP(i,v.size())cout << v[i] << ((i == v.size() - 1) ? "\n" : " ")
template<typename T1, typename T2> inline void chmin(T1 & a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
typedef pair<int, int>P;
typedef array<int, 3> arr3;
std::random_device rd;
std::mt19937 mt(rd());
constexpr ll MOD = 998244353; constexpr int MAX = 2000020;
const double pi = acos(-1); constexpr double EPS = 1e-8;
constexpr ll INF = 1e18;

void y(bool c) {
	if (c)print("Yes");
	else print("No");
}
void solve() {
	int A, B, C; cin >> A >> B >> C;
	int rem = A - B;
	print(max(0LL, C - rem));
}



signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//int q; cin >> q;
	//while (q--)
	solve();
}



Measured memory_bytes: 256
import sys
from itertools import product
from copy import deepcopy

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n, k = map(int, input().split())
    A_init = list(map(int, input().split()))

    res = f_inf
    for pattern in product([0, 1], repeat=n - 1):
        A = deepcopy(A_init)
        cost = 0
        for idx, p in enumerate(pattern):
            if p == 1:
                prev = max([A[i] for i in range(idx + 1)])
                if A[idx + 1] > prev:
                    continue
                cost += prev + 1 - A[idx + 1]
                A[idx + 1] = prev + 1
        cnt = mi = 0
        for a in A:
            if mi < a:
                mi = a
                cnt += 1
        if cnt >= k:
            res = min(res, cost)
    print(res)


if __name__ == '__main__':
    resolve()


Measured memory_bytes: 9108
using System;
using System.IO;

class Solve
{
    static void Main(string[] args) {
        var arr = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
        int M = arr[1];
        var lMax = 0;
        var rMin = 100000;
        for (int i = 0; i < M; i++) {
            var L = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
            lMax = Math.Max(lMax, L[0]);
            rMin = Math.Min(rMin, L[1]);
            if (lMax > rMin) break;
        }
        var answer = lMax <= rMin ? rMin - lMax + 1 : 0;
        var writer = new StreamWriter(Console.OpenStandardOutput()) {AutoFlush = false};
        Console.SetOut(writer);
        Console.WriteLine(answer);
        Console.Out.Flush();
    }
}

Measured memory_bytes: 45968
import math

N = int(input())
pn = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97]

C3 = 0
C5 = 0
C15 = 0
C25 = 0
C75 = 0

for i in pn:
    if math.factorial(N) % pow(i,2) == 0:
        C3 += 1
    if math.factorial(N) % pow(i,4) == 0:
        C5 += 1
    if math.factorial(N) % pow(i,14) == 0:
        C15 += 1
    if math.factorial(N) % pow(i,24) == 0:
        C25 += 1
    if math.factorial(N) % pow(i,74) == 0:
        C75 += 1

ans = (C3-2)*C5*(C5-1)//2 + (C5-1)*C15 + (C3-1)*C25 + C75 
print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <iomanip>
#include <functional>
#include "math.h"
#include <set>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define VI vector<int>
#define debug(x) cout<<#x<<": "<<x<<endl
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define MB 1000000007
#define NB 1000000000

int N;
int A[10][10];

int main()
{

	ostringstream oss;
	cin >> N;
	REP(i,N){
		oss << i+1 << std::flush;
		string s = oss.str();
		int f = s[0] - '0';
		int l = s[s.length()-1] - '0';
		A[f][l]++;
		oss.str("");
	}
	int ans = 0;
	FOR(i,1,10){
		FOR(j,1,10){
/*			if(A[i][j]!=0&&A[j][i]!=0){
				cout << "(i,j)" << i << " " << j << endl;
				cout << A[i][j] << " "  << A[j][i] << endl;
			}*/
			ans += A[i][j] * A[j][i];
		}
	}
	cout << ans;

//	cout << fixed << setprecision(0) <<  N > M ? "No" : "Yes";


}






Measured memory_bytes: 256
import java.util.*;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();

		for (int i = 0; i < n; i++) {
			String str = sc.next();
			String str2 = sc.next();
			
			int str11=change(str);
		//	System.out.println(str11);
			int str22=change(str2);
		//	System.out.println(str22);
			int result=str11+str22;
			
			String re=remake(result);
			System.out.println(re);
		}

	}

	public static int change(String sss) {

	
		ArrayList<Integer> list2 = new ArrayList<Integer>();

		int sum = 0;

		for (int i = 0; i < sss.length(); i++) {
			try {
				int sub = Integer.parseInt(""+sss.charAt(i));
				list2.add(sub);
			} catch (Exception e) {
				//list.add("" + sss.charAt(i));
			//	System.out.println(sss.charAt(i));
				if (list2.isEmpty()) {
					sum+=mathda(1,""+sss.charAt(i));
				} else {
					sum+=mathda(list2.remove(0),""+sss.charAt(i));
				}
			}

		}
		return sum;
	}

	public static int mathda(int num, String strstr) {

		switch (strstr) {
		case "m":
			return num * 1000;
		case "c":
			return num * 100;
		case "x":
			return num * 10;
		case "i":
			return num;
		}
		return 0;

	}

	
	public static String remake(int sss) {


	String restr="";
	int sub;
	int now;
	if((sub=sss/1000)>0){
		
		if(sub!=1)restr+=""+sub;
		restr+="m";
		sss=sss%1000;
	}
	
	if((sub=sss/100)>0){
		if(sub!=1)restr+=""+sub;
		restr+="c";
		sss=sss%100;
	}
	
	if((sub=sss/10)>0){
		if(sub!=1)restr+=""+sub;
		restr+="x";
		sss=sss%10;
	}
	if(sss!=0){
		if(sss!=1)restr+=""+sss;
		restr+="i";
	}
	
	return restr;
	
		
	
	}
}

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

int main()
{
    int H, A;
    cin >> H >> A;
    for (int i = 1; i; i++)
    {
        H -= A;
        if (H <= 0)
        {
            cout << i << endl;
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<queue>
#include<algorithm>
#include<map>
#include<set>
#include<cmath>
#include<iomanip>
#include<stack>
#include<string.h>
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define sz(a) (int)a.size()
using namespace std;

int main() {
	int a, b;
	cin >> a >> b;
	if (a % 3 == 0 || b % 3 == 0 || (a + b) % 3 == 0) cout << "Possible" << endl;
	else cout << "Impossible" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const long double PI = acos(-1);
typedef long long ll;
typedef pair<int64_t,int64_t> pll;
int dx[]={1,-1,0,0,1,-1,1,-1};
int dy[]={0,0,1,-1,1,-1,-1,1};
#define INF (2147483647)
#define mod (1000000007)
#define limit (7368791)
#define rep(i,a,b) for (int64_t i = (a); i < (b); i++)
#define REP(i,n) rep(i,0,n)
#define ALL(a) begin(a),end(a)
#define sz(s) (s).size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second


void solve()
{
     int a,b;cin>>a>>b;
     cout<< (a+b)%24<<endl; 
}

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

Measured memory_bytes: 256
#
# File    : B.rb
# Author  : Kazune Takahashi
# Created : 2018-7-21 21:16:31
# Powered by Visual Studio Code
#

s = gets.chomp
t = gets.chomp

10000.times{
  t = t[-1] + t[0..-2]
  if s == t
    puts "Yes"
    exit
  end
}

puts "No"


Measured memory_bytes: 2044
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <string>
#define REP(i,n) for(int i = 0; i < (int)n; i++)
using namespace std;

int main(){
  string s;
  cin >> s;
  if(s[0]=='9'||s[1]=='9'){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
n = int(input())
dp = [[0]*3 for i in range(n)]
for i in range(n):
    # print(i)
    tl = list(map(int,input().split()))
    if i == 0 :
        for j in range(3):
            dp[0][j]+=tl[j]
    else:
        for _ in range(3):
            dp[i][0] = max(dp[i-1][1],dp[i-1][2])+tl[0]
            dp[i][1] = max(dp[i-1][0],dp[i-1][2])+tl[1]
            dp[i][2] = max(dp[i-1][0],dp[i-1][1])+tl[2]
    # print(dp)
# print(dp)
print(max(dp[n-1]))

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

#define INF 100000000
#define ll long long
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,m,n) for(int i=m;i<n;i++)
#define ALL(a) (a.begin()),(a.end())
#define de cout << "debug" << endl;

int main(){
  int N;
  cin >> N;
  vector<int> V(N);
  REP(i,N) cin >> V[i];

  int cnt;
  vector<int> R;
  while (V.size() != 0) {
	REP(i,V.size()) {
	  if (V[i] == i + 1) {
		cnt = i+1;
	  }

	  if (V[i] > i + 1) {
		cout << -1 << endl;
		return 0;
	  }
	}
	R.push_back(cnt);
	V.erase(V.begin() + cnt - 1);
  }

  for (int i = R.size() - 1; i >= 0; i--) {
	cout << R[i] << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define lson i << 1
#define rson i << 1 | 1
#define mid ((l + r) >> 1)
using namespace std;
constexpr int N = 2e5 + 100;
constexpr int MOD = 998244353;
long long sum[N << 2], lazy[N << 2];
void build(int i, int l, int r) {
    if (l == r) {
        sum[i] = 0;
        return;
    }
    build(lson, l, mid);
    build(rson, mid + 1, r);
    sum[i] = sum[lson] + sum[rson];
}
void push_down_lazy(int i, int l, int r) {
    if (lazy[i] != 0) {
        (sum[lson] += lazy[i] * (mid - l + 1)) %= MOD;
        (sum[rson] += lazy[i] * (r - mid)) %= MOD;
        (lazy[lson] += lazy[i]) %= MOD;
        (lazy[rson] += lazy[i]) %= MOD;
        lazy[i] = 0;
    }
}
void update(int i, int l, int r, int L, int R, int val) {
    if (L <= l and r <= R) {
        (sum[i] += 1LL * val * (r - l + 1) % MOD) %= MOD;
        (lazy[i] += val) %= MOD;
        return;
    }
    push_down_lazy(i, l, r);
    if (L <= mid) update(lson, l, mid, L, R, val);
    if (R > mid) update(rson, mid + 1, r, L, R, val);
    sum[i] = (sum[lson] + sum[rson]) % MOD;
}
long long query(int i, int l, int r, int L, int R) {
    if (L <= l and r <= R) {
        return sum[i];
    }
    push_down_lazy(i, l, r);
    long long res = 0;
    if (L <= mid) res += query(lson, l, mid, L, R);
    if (R > mid) res += query(rson, mid + 1, r, L, R);
    return res % MOD;
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, k;
    cin >> n >> k;
    vector<int> l(k), r(k);
    for (int i = 0; i < k; i++)
        cin >> l[i] >> r[i];
    build(1, 1, n);
    update(1, 1, n, 1, 1, 1);
    for (int i = 1; i <= n; i++) {
        for (int j = 0; j < k; j++) {
            if (i + l[j] <= n) {
                update(1, 1, n, i + l[j], min(n, i + r[j]), query(1, 1, n, i, i));
            }
        }
    }
    cout << query(1, 1, n, n, n) << "\n";
    return 0;
}


Measured memory_bytes: 11820
#include <stdio.h>

int main (void){
    char ans[4];
    int a,b,c,d,e,k; 

    scanf("%d",&a);
    scanf("%d",&b);
    scanf("%d",&c);
    scanf("%d",&d);
    scanf("%d",&e);
    scanf("%d",&k);
  
    if(e-a>k){
        printf(":(\n");
    }
    else{
       printf("Yay!\n");
    }

    return 0;
}

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

int n, x, a[1234567];

void init(){
	int n, x;
	cin >> n >> x;
	vector<int> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	ll ans = 0;
	for (int i = 1; i < n; i++) {
		int can = a[i] + a[i - 1] - x;
		if (can <= 0) {
			continue;
		}
		ans += can;
		if (a[i] < can) {
			a[i - 1] -= can - a[i];
			a[i] = 0;
		} 
		else {
			a[i] -= can;
		}
	}
	cout << ans << endl;
}

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

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

int main() {
  int N,M;
  int count=0;
  
  cin >> N >> M;
  vector<int> size(N,0);
  vector<map<int,int>> vecnew(N);
  vector<int64_t> height(N,0);
  vector<vector<int>> vec2(M,vector<int>(2,0));
  for(int i=0;i<N;i++){
    cin >> height.at(i);
  }
  for(int i=0;i<M;i++){
    cin >> vec2.at(i).at(0) >> vec2.at(i).at(1);
  }
  for(vector<int> veci:vec2){
    vecnew.at(veci.at(0)-1)[veci.at(1)]=veci.at(1);
    vecnew.at(veci.at(1)-1)[veci.at(0)]=veci.at(0);
  }
  int i=0;

  for(map<int,int> veci:vecnew){
    int flag=0;
    for(auto iter = veci.begin(); iter != veci.end(); iter++){
      if(height.at(i)<=height.at((iter->second)-1))flag=1;
    }
    if(flag==0)count++;
    i++;
  }
  
  cout << count << endl;
}

Measured memory_bytes: 24056
#include <stdio.h>
#include <string.h>

int main(){
    int m, h;
    char cards[256], temp[256], result[256];
    int i, j=0, length;

    while(1){
        scanf("%s", cards);
        length=strlen(cards);
        if(strcmp(cards, "-")==0&&length==1)break;
        scanf("%d", &m);
        for(;m>0;m--){
            scanf("%d", &h);
            strcpy(temp, cards);
            for(i=0;i<h;i++){
                cards[length-h+i]=temp[i];
            }
            for(i=0;i<length-h;i++){
                cards[i]=temp[i+h];
            }
        }
        for(i=0;i<length;i++){
            result[j++]=cards[i];
        }
        result[j++]='\n';
    }
    result[j]='\0';
    printf("%s", result);

    return 0;
}


Measured memory_bytes: 2088
#include <bits/stdc++.h>
 
using namespace std;
 
int main() {
	string a, b;
	cin >> a >> b;
	if (a == b) cout << "EQUAL";
	if (a.size() > b.size()) {
		cout << "GREATER";
		return 0;
	}
	if (a.size() < b.size()) {
		cout << "LESS";
		return 0;
	}	
	if (a > b) {
		cout << "GREATER";
		return 0;
	}
	if (a < b) {
		cout << "LESS";
		return 0;
	}
	return 0;
}

Measured memory_bytes: 256
// Problem : C - Giant Graph
// Contest : AtCoder Grand Contest 043
// URL : https://atcoder.jp/contests/agc043/tasks/agc043_c
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)
// By zghtyarecrenj

#include <cstdio>
#include <cstring>

namespace io 
{
	const int MaxBuff = 1 << 15;
	const int MaxOut = 1 << 24;
	char b[MaxBuff], *S = b, *T = b;

	inline char getc() 
	{ 
		return S == T && (T = (S = b) + fread(b, 1, MaxBuff, stdin), S == T) ? 0 : *S++; 
	}
} // namespace io

inline void in(int &t)
{
	t = 0; register char ch = io::getc();
	while (ch < '0' || ch > '9') ch = io::getc();
	do t = t * 10 + ch - '0', ch = io::getc(); while (ch >= '0' && ch <= '9');
}

const int N = 1e5 + 5;
const int ix35 = 998244353;

struct modint { int a; modint(long long x = 0) { a = x; } };
const modint inv2((ix35 + 1) >> 1), base(1000000000000000000ll % ix35);
inline modint operator +(const modint& a, const modint& b) { return (a.a + b.a < ix35 ? a.a + b.a : a.a + b.a - ix35); }
inline modint operator -(const modint& a, const modint& b) { return (a.a >= b.a ? a.a - b.a : a.a - b.a + ix35); }
inline modint operator *(const modint& a, const modint& b) { return ((long long)a.a * b.a) % ix35; }

int n, len, tmp[N];

inline void fwt(modint *f) 
{
	for (int i = 1; i < len; i <<= 1)
		for (int j = 0; j < len; j += (i << 1))
			for (int k = 0; k < i; ++k) 
			{
				modint u = f[j + k], v = f[i + j + k];
				f[j + k] = u + v, f[i + j + k] = u - v;
			}
}

inline void ifwt(modint *f)
{
	modint inv = 1;
	for (int i = 1; i < len; i <<= 1) 
		inv = inv * inv2;
	for (int i = 0; i < len; ++i)
		f[i] = f[i] * inv;
}

struct graph
{
	int m, head[N], to[N], nxt[N], tot, f[N];
  	modint x[N * 2];
  		
	inline void addedge(int x, int y)
	{
		nxt[++tot] = head[x], head[x] = tot, to[tot] = y;
	}
	
	inline void read()
	{
		in(m);
		for (int i = 0; i < m; ++i)
		{
			int x, y;
			in(x), in(y);
			if (x < y)
				addedge(x, y);
			else
				addedge(y, x);
		}
	}
	
	inline void init()
	{
		for (int i = n; i; --i)
		{
			f[i] = 0;
			for (int j = head[i]; j; j = nxt[j]) tmp[f[to[j]]] = 1;
			while (tmp[f[i]]) ++f[i];
			for (int j = head[i]; j; j = nxt[j]) tmp[f[to[j]]] = 0;
		}
	}
	
	inline void prep()
	{
		modint tmp = 1;
		for (int i = 1; i <= n; ++i) 
			tmp = tmp * base, x[f[i]] = x[f[i]] + tmp;
	}
} g1, g2, g3;

int main()
{
	in(n);
	g1.read(), g2.read(), g3.read();
	g1.init(), g2.init(), g3.init();
	g1.prep(), g2.prep(), g3.prep();
	for (len = 1; len < n; len <<= 1) ;
	fwt(g1.x), fwt(g2.x), fwt(g3.x);
	for (int i = 0; i < len; ++i)
		g1.x[i] = g1.x[i] * g2.x[i] * g3.x[i];
	fwt(g1.x), ifwt(g1.x);
	printf("%d\n", g1.x[0].a);
	return 0;
}

Measured memory_bytes: 7168
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;

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

  ll x;
  cin >> x;
  cout << 10 - (x/200);
  return 0;
}

Measured memory_bytes: 3648
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <array>
#include <map>
#include <algorithm>
#include <queue>

using namespace std;
typedef long long int ll;

int main(int argc, char const *argv[])
{
    ll N;
    cin >> N;
    vector<ll> a(N);
    
    for(ll i = 0; i < N; i++)
    {
        cin >> a[i];
    }

    cout << abs(*max_element(a.begin(), a.end()) - *min_element(a.begin(), a.end())) << endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <ctype.h>
#include <math.h>
#include <stack>
#include <string>
#include <string.h>
using namespace std;
double PI = 3.1415926535897932;
long mod = 1000000007;

const long INF = 1e9 + 1;

int main() {
  long a;
  double b;
  cin >> a >> b;
  long c = b*100 + 0.001;
  cout << a * c / 100 << endl; 
}


Measured memory_bytes: 3716
#include<iostream>
#include<cstring>
#include<vector>
using namespace std;
typedef long long int LL;
int main(){
	LL a,b,c,d;
	cin>>a>>b>>c>>d;
	a-=b;
	if(d%2==1)a=-a;
	cout<<a<<endl;
	return 0;
}


Measured memory_bytes: 256
import math
n,d=map(int,input().split())
x=[list(map(int,input().split())) for i in range(n)]
ans=0
for i in range(1,n):
    for j in range(i):
        dis=0
        for k in range(d):
            dis+=(x[i][k]-x[j][k])**2
        dis=math.sqrt(dis)
        if dis-int(dis)==0:
            ans+=1
print(ans)

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

typedef long long int ll;
typedef pair<ll, ll> p_ll;
typedef vector<pair<ll, ll>> vec_p; //vector<pair<ll, ll>> pairs(n) ,pairs.at(i) = make_pair(i*i, i)

#define ture ture
#define flase false
#define falg flag

#define REP(i, x) for (ll i = 0; i < (ll)(x); i++)
#define REPS(i, x) for (ll i = 1; i <= (ll)(x); i++)
#define RREP(i, x) for (ll i = ((ll)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (ll i = ((ll)(x)); i > 0; i--)
#define all(x) (x).begin(), (x).end()

const ll MOD = pow(10, 9) + 7;
const ll LLINF = pow(2, 61) - 1;//llの最大9*10^18
const int INF = pow(2, 30) - 1;

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

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

    ll N;
    string S;
    cin >> N>>S;

    ll r_count = 0,w_count=0;

    REP(i,S.size()){
        if(S.at(i)=='R'){
            r_count++;
        }
        else{
            w_count++;
        }
    }

    //cout << r_count << " " << w_count << endl;

    ll ans = 0;

    if(r_count==N||w_count==N){
        cout << 0 << endl;
    }
    else{
        REP(i,r_count){
            if(S.at(i)=='W'){
                ans++;
            }
        }
        cout << ans << endl;
    }
    }


Measured memory_bytes: 3768
#include <stdio.h>
#include <algorithm>
#include <stdlib.h>
#include <string.h>
#include <queue>
#define rep(i,n) for(int i = 0; i < n; ++i)
#define rrep(i,n) for(int i = 1; i <= n; ++i)
using namespace std;
typedef pair<int,int> P;
const int INF = 1000000000;

int main(){
	char s[114514];
	scanf("%s",s);
	for(int i=0;s[i]!='\0';i+=2){
		int a = 0;
		switch (s[i]){
			case '1':
			break;
			case '2':
			printf("k");
			break;
			case '3':
			printf("s");
			break;
			case '4':
			printf("t");
			break;
			case '5':
			printf("n");
			break;
			case '6':
			printf("h");
			break;
			case '7':
			printf("m");
			break;
			case '8':
			printf("y");
			break;
			case '9':
			printf("r");
			break;
			case '0':
			a=1;
			break;
		}
		if(a==0)switch(s[i+1]){
			case 'T':
			printf("a");
			break;
			case 'L':
			printf("i");
			break;
			case 'U':
			printf("u");
			break;
			case 'R':
			printf("e");
			break;
			case 'D':
			printf("o");
			break;
		}
		if(a==1)switch(s[i+1]){
			case 'T':
			printf("wa");
			break;
			case 'L':
			printf("i");
			break;
			case 'U':
			printf("nn");
			break;
			case 'R':
			printf("e");
			break;
			case 'D':
			printf("wo");
			break;
		}
	}
	printf("\n");
	return 0;
}

Measured memory_bytes: 964
#include <iostream>
using namespace std;
int main()
{
    int a,b,c,d,e,f,A,B,n,cnt=0;
    cin>>n>>A>>B;
    
    for(int i=1;i<=n;i++)
    {
        a=i%10;
        b=(i/10)%10;
        c=(i/100)% 10;
        d=(i/1000)%10;
        e=(i/10000)%10;
        f=i/100000;
        if(A<=a+b+c+d+e+f&&a+b+c+d+e+f<=B)cnt+=i;
    }
    cout<<cnt<<endl;
    return 0;
}

Measured memory_bytes: 256
N, M = map(int, input().split())
H = list(map(int, input().split()))

all_tenbo = list(range(1, N+1))
not_good = []

for i in range(M):
    A, B = map(int, input().split())
    if H[A-1] <= H[B-1]:
        not_good.append(A)
    if H[B-1] <= H[A-1]:
        not_good.append(B)

print(len(list(set(all_tenbo)-set(not_good))))

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

#define FOR(i, a, b) for(int i = a; i < b; ++i)
#define REP(i, n) FOR(i, 0, n)
#define _ << " " <<
#define sz(x) ((int) x.size())

typedef long long ll;
typedef pair<int, int> point;

const int MAXN = 4e3 + 5, inf = 1e9;

int a[MAXN];
int c[MAXN];

int where[MAXN][2];
int dp[MAXN][MAXN];
int inv[2][MAXN];

int inv2[2][MAXN][MAXN];

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

  int n; cin >> n;

  REP(i, 2 * n) {
    char cc; cin >> cc;
    cin >> a[i];
    if(cc == 'B') {
      c[i] = 1;
    }
    where[a[i]][c[i]] = i + 1;
  }

  FOR(i, 1, n + 1) REP(k, 2) {
    FOR(j, 1, i) {
      if(where[j][k] > where[i][k]) {
        inv[k][i] ++;
      }
    }
  }

  FOR(i, 1, n + 1) REP(k, 2) {
    FOR(j, 1, n + 1) {
      inv2[k][i][j] += inv2[k][i][j - 1];
      if(where[j][k ^ 1] > where[i][k]) {
        inv2[k][i][j] ++;
      }
    }
  }

  FOR(i, 1, 2 * n + 1) FOR(j, 0, n + 1) {
    if(j > i) {
      dp[j][i] = inf;
      break;
    }
    int k = i - j;
    dp[j][i] = inf;

    if(j) {
      dp[j][i] = min(dp[j][i], abs(where[j][0] + inv[0][j] + inv2[0][j][k] - i) + dp[j - 1][i - 1]);
    }
    if(k) {
      dp[j][i] = min(dp[j][i], abs(where[k][1] + inv[1][k] + inv2[1][k][j] - i) + dp[j][i - 1]);
    }
  }

  cout << dp[n][2 * n] << endl;
}


Measured memory_bytes: 98048
#include<iostream>
#include<sstream>
#include<iomanip>
#include<bitset>
#include<map>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#define lli long long int
#define uli unsigned long long int
#define inf 999999999999999999
#define rep(i,n,m) for(lli i=(lli)(n);i<(lli)(m);++i)
#define reep(i,n,m) for(int i=(int)(n);i<=(int)(m);++i)
#define per(i,m,n) for(lli i=(int)(m)-1;i>=(int)(n);--i)
#define st(n) sort(n.begin(), n.end())
#define rev(n) reverse(n.begin(),n.end())
#define ou(S) cout << S << endl
#define pb(n) push_back(n)
#define ue(N) N.erase(unique(N.begin(),N.end()),N.end());
#define nou(S) cout << S
#define hou(S) cout << setprecision(30) << S << endl
#define vec(K,L,N,S) vector<L> K(N,S)
#define dv(K,L,N,M,S) vector<vector<L>> K(N,vector<L>(M,S))
#define tv(K,L,N,M,R,S) vector<vector<vector<L>>> K(N,vector<vector<L>>(M,vector<L>(R,S)))
#define pint pair<lli,lli>
#define paf(L,R) pair<L,R>
#define mod 1000000007
#define maxx 5100000
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
using namespace std;
int main(){
  int a,b;
  cin>>a>>b;
  if((a+b)%3==0||a%3==0||b%3==0)ou("Possible");
  else ou("Impossible");
}

Measured memory_bytes: 256