akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;
int Q;
typedef pair<i_i, int> iii;
vector<iii> V;

void f() {
    int l, p;
    cin >> p >> l;
    vector<iii> W;
    W.push_back({{-1, -1}, -1});
    for(int i = 1; i < V.size(); i++) {
        int delta = V[i].first.first - V[i-1].first.second - 1;
        chmin(delta, l);
        if(delta > 0) {
            l -= delta;
            W.push_back({{V[i-1].first.second + 1, V[i-1].first.second + delta}, p});
        }
        W.push_back(V[i]);
    }
    if(l != 0) {
        W.push_back({{V.back().first.second + 1, V.back().first.second + l}, p});
    }
    swap(W, V);
}

void g() {
    vector<iii> W;
    int idx;
    cin >> idx;
    for(auto tmp : V) {
        if(tmp.second != idx) {
            W.push_back(tmp);
        }
    }
    swap(W, V);
}

void h() {
    int ans = -1;
    int idx;
    cin >> idx;
    for(auto tmp : V) {
        if(tmp.first.first <= idx and idx <= tmp.first.second) {
            ans = tmp.second;
        }
    }
    cout << ans << endl;
}

int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    while(true) {
        V.clear();
        V.push_back({{-1, -1}, -1});
        cin >> Q;
        if(Q == 0) break;
        while(Q--) {
            char a;
            cin >> a;
            if(a == 'W') f();
            if(a == 'D') g();
            if(a == 'R') h();
            /*
            cerr << "---------" << endl;
            for(auto tmp : V) {
                cerr << tmp.second << "[" << tmp.first.first << ", " << tmp.first.second << "]" << endl;
            }
            */
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 3296
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n,q,a,t,x,s;
	cin >> n >> q;
	vector< list<int> > li(n+1);
	for(int i=0;i<q;i++){
		cin >> a;
		if(a==0){
			cin >> t >> x;
			li[t].push_back(x);
		}else if(a==1){
			cin >> t;
			x = 0;
			for(auto X:li[t]){
				if(x!=0)cout << " ";
				cout << X ;
				x++;
			}
			cout << endl;
		}else{
			cin >> s >> t;
			li[t].splice(li[t].end(), move(li[s]));
			li[s].clear();
		}
	}
}


Measured memory_bytes: 18632
#include<bits/stdc++.h>
#include<string>
#include<numeric>
#define int long long
#define all(x) x.begin(),x.end()
#define maxn 1000000
#define what_is(x) cerr << #x << " is " << x << endl;
const int MOD = 1e9 + 7;
using namespace std;
string abc="abcdefghijklmnopqrstuvwxyz";
int powmod(int a, int b, int MOD = MOD){
    if(!a and !b)    return 1ll;
    if(!a)    return a;
    int res = 1ll;
    b %= (MOD - 1ll), a %= MOD;
    while(b){
        if(b%2 == 1)    res = (res * a) % MOD;
        a = (a * a) % MOD;
        b /= 2;
    }
    return res;
}
int popcount(uint32_t n)
{
    n = n - ((n >> 1) & 0x55555555);
    n = (n & 0x33333333) + ((n >> 2) & 0x33333333);
    return ((n + (n >> 4) & 0xF0F0F0F) * 0x1010101) >> 24;
}
bool check(int n) {return (((double)sqrt(n)-floor((double)sqrt(n)))==0);}
vector<bool> sieve(maxn + 1, true);

void fillprime() {
    sieve[0] = sieve[1] = false;
    for (int i = 2; i <= maxn; ++i) {
        if (sieve[i] && (int) i * i <= maxn) {
            for (int j = i * i; j <= maxn; j += i) {
                sieve[j] = false;
            }
        }
    }
}
void solve() {
  int n;
  cin>>n;
  cout<<fixed<<setprecision(20)<<(long double)2*n*((long double)22/7);
}
int32_t main() {
    ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
    //cout<<"Hello World"<<"\n";
    //int t;cin>>t;while(t--)
    solve();

}

Measured memory_bytes: 3932
#include <bits/stdc++.h>
using namespace std;
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define in(x,y,h,w) x >= 0 && x < h && y >= 0 && y < w

#define int long long
//typedef    long long          ll;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      P;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
 
const int INF=1e+9;
const double EPS=1e-9;
const int MOD=1000000007;
 
const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};

signed main(){
	int n,sum[2][105] = {},ma = 0;
	cin >> n;
	for(int i = 0;i < n;i++){
		int a;
		cin >> a;
		sum[0][i + 1] = sum[0][i] + a;
	}
	for(int i = 0;i < n;i++) cin >> sum[1][i];
	for(int i = n - 1;i >= 0;i--){
		sum[1][i] += sum[1][i + 1];
	}
	for(int i = 0;i < n;i++){
		ma = max(ma,sum[0][i + 1] + sum[1][i]);
	}
	cout << ma << endl;
	return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
A - Restaurant
https://atcoder.jp/contests/abc055/tasks/abc055_a

"""
import sys


def solve(N):
    return N*800 - (N//15*200)


def main(args):
    N = int(input())
    ans = solve(N)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])

Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define turbo cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);
#define ll long long
#define pii pair<int,int>
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define inf 999999999999999

using namespace std;

ll tab[100009];

int main(){
    turbo
    ll n,w,v,k;
    cin >> n >> k;
    tab[0]=1;
    for(ll i=0;i<n;i++){
      cin >> w >> v;
      for(ll j = 100000;j>=0;j--){
        if(j-v>=0){
          if(tab[j-v]>0){
            if(tab[j]==0)
              tab[j]=tab[j-v]+w;
            tab[j] = min(tab[j],tab[j-v]+w);
            //cout << "UPDATUJE " << j << "\n";
          }
        }
      }
    }
    for(ll i=100000;i>=0;i--){
      if(tab[i]-1 <= k and tab[i]>0){
        cout << i << "\n";
        return 0;
      }
    }
    return 0;
}


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

using namespace std;

string s;

long long conv(string c){
    long long res = 0;
    for(auto x : c){
        res = 10 * res + (x - '0');
    }
    return res;
}

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

    cin >> s;
    int len = s.length();
    len--;
    long long tot = 0;
    for(int i = 0; i < (1 << len); i++){
        long long res = 0;
        string temp = "";
        vector<int> vc;
        for(int j = 0; j < len; j++){
            temp += s[j];
            if(i & (1 << j)){
                res += conv(temp);
                temp = "";
            }
        }
        temp += s[len];
        res += conv(temp);
        tot += (long long) res;
    }
    cout << tot << '\n';
    return 0;
}

Measured memory_bytes: 256
a,b,k = gets.split.map(&:to_i)

k.times do |i|
    if i % 2 == 0
        a -= 1 if a.odd?
        b += a / 2
        a /= 2
    else
        b -= 1 if b.odd?
        a += b / 2
        b /= 2
    end
end

puts "#{a} #{b}"

Measured memory_bytes: 1788
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct node{
  unsigned int key;
  struct node *next;
  struct node *prev;
};
typedef struct node * NodePointer;
NodePointer nil;
NodePointer listSearch(int key){
  NodePointer x = nil->next;
  while(x->key != key){
    if(x == nil) break;
    x = x->next; }
  return x; }
void init(){
  nil = malloc(sizeof(struct node));
  nil->next = nil;
  nil->prev = nil;
}
void printList(){
  NodePointer cr = nil->next;
  int isl = 1;
  while(1){
    if (cr == nil) {
      break;
    }
    if (isl == 0) {
      printf(" ");
    }
    printf("%d", cr->key);
    cr = cr->next;
    isl = 0;
  }
  printf("\n");
}
void deleteNode(NodePointer t){
  t->prev->next = t->next;
  t->next->prev = t->prev;
  free(t);
}
void deleteFirst(){
  NodePointer t = nil->next;
  if (t == nil) return;
  deleteNode(t);
}
void deleteLast(){
  NodePointer x = nil->prev;
  if(x == nil) return;
  deleteNode(x);
}
void delete(int key){
  NodePointer x;
  x = listSearch(key);
  if(x == nil) return;
  deleteNode(x);
}
void insert(int key){
  NodePointer x;
  x = malloc(sizeof(struct node));
  x->key = key;
  x->next = nil->next;
  x->prev = nil;
  nil->next = x;
  x->next->prev = x;
}
int main(){
  int key, n, i;
  int size = 0;
  char com[20];
  int nop = 0, nod = 0;
  scanf("%d", &n);
  init();
  for(i = 0; i < n; i++){
    scanf("%s%d", com, &key);
    if (com[0] == 'i') {
      insert(key);
      nop++;
      size++;
    } else if (com[0] == 'd') {
      if (strlen(com) > 6) {
        if (com[6] == 'F') deleteFirst();
        else if (com[6] == 'L') deleteLast();
      } else {
	delete(key); nod++;
      }
      size--; }
  }
  printList();
  return 0; }



Measured memory_bytes: 32932
b=[]
for i in range(3):
  a = input().split()
  b.append(a)
n = int(input())
c=[0]*n
for i in range(n):
  c[i]=input()
hantei = "No"
for i in range(n):
  for x in range(3):
    for y in range(3):
      if b[y][x] == c[i]:
        b[y][x] = 101
for i in range(3):
  if b[i][0] == 101 and b[i][1] == 101 and b[i][2] == 101:
    hantei = "Yes"
  elif b[0][i] == 101 and b[1][i] == 101 and b[2][i] == 101:
    hantei = "Yes"
  elif b[0][0] == 101 and b[1][1] == 101 and b[2][2] == 101:
    hantei = "Yes"
  elif b[0][2] == 101 and b[1][1] == 101 and b[2][0] == 101:
    hantei = "Yes"
print(hantei)

Measured memory_bytes: 3064
#include <math.h>
#include <stdio.h>

int
main()
{
	int pi, si;
	int n;
	double xs[1000] = {0};
	double ys[1000] = {0};
	double p[3] = {0};
	double pinf = 0;

	scanf("%d", &n);
	for (si = 0; si < n; si++)
	{
		scanf("%lf", &xs[si]);
	}
	for (si = 0; si < n; si++)
	{
		scanf("%lf", &ys[si]);
	}

	for (pi = 0; pi < 3; pi++)
	{
		p[pi] = 0;
		for (si = 0; si < n; si++)
		{
			p[pi] += pow(fabs(xs[si]-ys[si]), (pi+1));
		}
		p[pi] = pow(p[pi], 1.0 / (pi+1));
	}
	for (si = 0; si < n; si++)
	{
		if (fabs(xs[si]-ys[si]) > pinf)
		{
			pinf = fabs(xs[si]-ys[si]);
		}
	}

	for (pi = 0; pi < 3; pi++)
	{
		printf("%f\n", p[pi]);
	}
	printf("%f\n", pinf);

	return 0;
}

Measured memory_bytes: 728
#include <stdio.h>
#define MAX 86400
#define MIN 0

int main(void){

    int h, m, s, input;
    scanf("%d", &input);

    if(input >= MIN && input <= MAX){

        h = input / 3600;
        m = (input - h * 3600) / 60;
        s = input - h * 3600 - m * 60;
        printf("%d:%d:%d\n", h, m, s);

    }
    return 0;
}

Measured memory_bytes: 2728
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<bitset>
#define MAXN 400
#define MAXM 100000
using namespace std;
bitset<MAXN+5> vis[MAXN+5];
int n,m;
int a[MAXM+5],b[MAXM+5];
bool sp[MAXN+5];
int main()
{
	scanf("%d %d",&n,&m);
	for(int i=1;i<=m;i++)
		scanf("%d %d",&a[i],&b[i]);
	for(int i=1;i<=n;i++)
		for(int j=m;j>=1;j--)
		{
			vis[i][i]=1;
			if(vis[i][a[j]]==1&&vis[i][b[j]]==1)
			{
				sp[i]=true;
				break;
			}
			else if(vis[i][a[j]]==0&&vis[i][b[j]]==0)
				continue;
			else
				vis[i][a[j]]=vis[i][b[j]]=1;
		}
	int ans=0;
	for(int i=1;i<=n;i++)
		for(int j=i+1;j<=n;j++)
			if(sp[i]==false&&sp[j]==false&&(vis[i]&vis[j]).none())
				ans++;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 896
#include <stdio.h>
#include <math.h>
typedef long long ll;
using namespace std;

ll a[3] = {3, 5, 7}, now = 0, n, ans = 0, cnt[3] = {0, 0, 0};

void dfs() {
  ll i, j;
  now *= 10;
  for(i = 0; i < 3; ++i) {
    cnt[i]++;
    now += a[i];
    if(now > n) {
      now /= 10, cnt[i]--;
      return;
    }
    ++ans;
    for(j = 0; j < 3; ++j) if(!cnt[j]) {
      --ans;
      break;
    }
    dfs();
    now -= a[i], cnt[i]--;
  }
  now /= 10;
}

int main(void) {
  ll i, j, k, m, a, b;
  scanf("%lld", &n);
  dfs();
  printf("%lld", ans);
  return 0;
}

Measured memory_bytes: 128
function Main(s) {
  var s = s.split("\n");
  var nm = s[0].split(" ").map(e => e*1);
  var a = s.slice(1, s.length).map(e => e*1);
  var dp = new Array(nm[0] + 1).fill(0);
  dp[0] = 1;

  for(var i = 1; i <= nm[0]; i++) {
    if(i === a[0]) {
      a.shift();
      continue;
    } else {
      if (i === 1) {
        dp[i] = dp[0];
      } else {
        dp[i] = (dp[i - 2] + dp[i - 1]) % 1000000007;
      }
    }
  }
  console.log(dp[dp.length-1]);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

int main(){
    int h, m, s, sec;
    cin >> sec;
    
    s = sec%60;
    h = sec/3600;
    sec -= h * 3600;
    m = sec/60;
    cout << h << ":";
    cout << m << ":";
    cout << s << endl;
    
    return 0;
}


Measured memory_bytes: 3068
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template<typename Q_temp>
using smaller_queue = priority_queue <Q_temp, vector<Q_temp>, greater<Q_temp> >;

const int INF = (int) 1e9;
const ll LINF = (ll) 1e18;
const ll MOD = (ll) (1e9 + 7);
const double PI = acos(-1.0);
const int limit = 200010;

#define REP(i,m,n) for(ll i = m; i < (ll)(n); ++i)
#define rep(i,n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbg2(x_) for(auto a_ : x_) cerr << a_ << " "; cerr << endl;
#define dbg3(x_ , sx_) rep(i, sx_) cerr << x_[i] << " "; cerr << endl;
vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};

inline ll CEIL(ll a, ll b) {
    return (a + b - 1) / b;
}

//------------------------------------------------------

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> v;

    rep(i, n) {
        int a;
        cin >> a;
        v.push_back(a);
    }
    vector<int> ans;
    bool imp = false;
    while (!v.empty() && !imp) {
        for (int i = (int) v.size() - 1; i >= 0; i--) {
            if (i + 1 == v[i]) {
                ans.push_back(i + 1);
                v.erase(v.begin() + i);
                break;
            }
            if (i == 0) imp = true;
        }
    }
    if (imp) {
        cout << -1 << endl;
    } else {
        reverse(all(ans));
        for (auto a : ans) cout << a << endl;
    }

    return 0;
}

Measured memory_bytes: 256
module Main where

import Control.Applicative
import Numeric
import Data.List (transpose)


main :: IO ()
main = do
  {[r, c] <- getInts
  ; mat <- loop r
  ; mapM_ putInts (hoge mat)
  }

loop :: Int ->  IO [[Int]]
loop 0  = return []
loop r = do
  {xs <- getInts
  ; xss <- loop (r-1)
  ; return (xs : xss)
  }

hoge :: [[Int]] -> [[Int]]
hoge = transpose . map addSum. transpose . map addSum

addSum  :: [Int] -> [Int]
addSum xs = xs ++ [sum xs]
  
--
getInts :: IO [Int]
getInts = map read . words <$> getLine

putInts :: [Int] -> IO()
putInts = putStrLn . unwords . map show

getDoubles :: IO [Double]
getDoubles = map read . words  <$> getLine

putDoubles :: [Double] -> IO()
putDoubles = putStrLn . unwords . map showDouble

showDouble :: Double -> String
showDouble d = showFFloat Nothing d ""


Measured memory_bytes: 8340
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <set>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)

using namespace std;
typedef long long int lli;

int main(){
	int X,A,B;
	cin>>X>>A>>B;
	if(B-A<=0)cout<<"delicious";
	else if(B-A<=X)cout<<"safe";
	else cout<<"dangerous";
}

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

int main(){
    int H, W;
    
    while(1){
        cin >> H >> W;
        if(H == 0 && W == 0)break;
        
        for(int i = 0; i < H; i++){
            for(int j = 0; j < W; j++){
                if((i + j) % 2 == 0){
                    cout << "#";
                }else{
                    cout << ".";
                }
            }
            cout << "\n";
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 3092
#![allow(non_snake_case, unused)]
use std::cmp::*;
use std::collections::*;
use std::f64::consts::*;

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

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

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

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

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

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

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (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, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn solve(x: i64, y: i64) -> i64 {
    if x % 3 == 0 || y % 3 == 0 {
        0
    } else {
        let mut ans = std::i64::MAX;

        for h in 1..(x + 1) {
            let a: i64 = h * y;
            let h_ = x - h;
            let wb = y / 2;
            let wc = y - wb;

            let mut b = wb * h_;
            let mut c = wc * h_;

            let mut s_max = max(a, max(b, c));
            let mut s_min = min(a, min(b, c));
            ans = min(ans, s_max - s_min);

            let hb = h_ / 2;
            let hc = h_ - hb;
            b = y * hb;
            c = y * hc;
            s_max = max(a, max(b, c));
            s_min = min(a, min(b, c));
            ans = min(ans, s_max - s_min);
        }
        ans
    }
}

fn main() {
    input!{
        h: i64,
        w: i64,
    }

    let ans_h = solve(h, w);
    let ans_w = solve(w, h);

    println!("{}", min(ans_h, ans_w));
}


Measured memory_bytes: 4352
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<algorithm>
#include<math.h>
//#include<iostream>
using namespace std;

int n;
int a[55];
int main()
{
	scanf("%d",&n);
	int mm=1;
	for (int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		if (fabs(a[mm])<fabs(a[i])) mm=i;
	}
	printf("%d\n",2*n-2);
	if (a[mm]<0)
	{
		for (int i=1;i<=n;i++) if (i!=mm) printf("%d %d\n",mm,i);
		for (int i=n-1;i>=1;i--) printf("%d %d\n",i+1,i);
	}
	else
	{
		for (int i=1;i<=n;i++) if (i!=mm) printf("%d %d\n",mm,i);
		for (int i=2;i<=n;i++) printf("%d %d\n",i-1,i);
	}
	return 0;
}

Measured memory_bytes: 128
N, T = list(map(int, input().split()))
push_list = list(map(int, input().split()))


dabaaaaa = 0

for i in range(len(push_list)-1):
    if push_list[i + 1] - push_list[i] < T:
        dabaaaaa += push_list[i + 1] - push_list[i]
    else:
        dabaaaaa += T

    # 最後の人が押した後のT秒も加算

print(dabaaaaa+T)


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


int main(){
    int N;
    cin >> N;
    int A[110];
    for(int i = 0; i < N; i++) cin >> A[i];
    bool flag = 1;
    
    while(flag){
        flag = 0;
        for(int i = 1; i < N; i++ ){
            if(A[i-1] < A[i]){
                swap(A[i-1],A[i]);
                flag = 1;
            }
        }
    }
    int sumA = 0;
    int sumB = 0;
    if(N%2 == 0){
        for(int i = 0; i < N/2 ;i++){
            sumA += A[2*i];
            sumB += A[2*i+1];
        }
        cout << sumA - sumB << endl;
    }
    else{
        for(int i = 0; i < N/2 ;i++){
            sumA += A[2*i];
            sumB += A[2*i+1];
        }
        sumA += A[N-1];
        cout << sumA - sumB << endl;
    }
}



Measured memory_bytes: 256
#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 whole(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
using ll = long long;
using P = pair<int, int>;
const int mod = 1000000007;

ll data[100005];
ll dp[12][10];
vector<ll> num;

int main(){
    int k;
    cin >> k;
    for (int i=0; i<12; i++) {
        for (int j=0; j<10; j++) {
            if (i==0) {
                dp[i][j] = 1;
                continue;
            }
            for (int k=-1; k<=1; k++) {
                if (j+k>=0 && j+k<=9) {
                    dp[i][j] += dp[i-1][j+k];
                }
            }
        }
    }
    
    ll sum = 0;
    int keta;
    int head;
    bool flag_br = false;
    for (int i=0; i<12; i++) {
        for (int j=0; j<10; j++) {
            if (j==0) continue;
            sum += dp[i][j];
            if (sum>=k) {
                sum -= dp[i][j];
                keta = i+1;
                head = j;
                flag_br = true;
                break;
            }
        }
        if (flag_br) break;
    }
    
    vector<int> ans(keta);
    ans[0] = head;
    
    for (int i=1; i<keta; i++) {
        for (int j=0; j<=9; j++) {
            if (abs(j-ans[i-1])>1) continue;
            sum += dp[keta-i-1][j];
            if (sum>=k) {
                sum -= dp[keta-i-1][j];
                ans[i] = j;
                break;
            }
        }
    }
    rep(i, ans.size()) {
        cout << ans[i];
    }
    cout << endl;
    
    
    
    
    return 0;
}


Measured memory_bytes: 256
#include <stdlib.h>
#include <iostream>
#include <algorithm>
using namespace std;

struct node{
	int parent_id;
	int left_child_id;
	int right_child_id;
	int sibling_id;
};
void print_children(int *children, int size);
int get_depth(node* b, int id);
int get_degree(node* b, int id);
int get_height(node* b, int id);
const char* get_position_name(node* b, int id);
int main(){
	int n;
	cin >> n;
	node* b = (node*)calloc(n, sizeof(node));
	for(int i = 0; i < n; ++i){
		b[i].parent_id  = -1;
		b[i].sibling_id = -1;
	}
	//input data
	for(int i = 0; i < n; ++i){
		int id;
		int left_child_id;
		int right_child_id;
		cin >> id;
		cin >> left_child_id;
		cin >> right_child_id;
		b[id].left_child_id  = left_child_id;
		b[id].right_child_id = right_child_id;
		if(left_child_id  != -1) b[left_child_id].parent_id  = id;
		if(right_child_id != -1) b[right_child_id].parent_id = id;
		if(left_child_id  != -1 && right_child_id != -1){
			b[left_child_id].sibling_id  = right_child_id;
			b[right_child_id].sibling_id = left_child_id;
		}
	}
	for(int i = 0; i < n; ++i){
		int depth = get_depth(b, i);
		int height = get_height(b, i);
		int degree = get_degree(b, i);
		const char* position_name = get_position_name(b, i);
		cout
		<< "node " << i
		<< ": parent = " << b[i].parent_id
		<< ", sibling = " << b[i].sibling_id
		<< ", degree = " << degree
		<< ", depth = " << depth
		<< ", height = " << height 
		<< ", " << position_name 
		<< endl;
		}
	return 0;
}

int get_degree(node* b, int id){
	int degree = 0;
	if(b[id].left_child_id  != -1) ++degree;
	if(b[id].right_child_id != -1) ++degree;
	return degree;
}

int get_depth(node* b, int id){
	int depth = 0;
	int current_id = id;
	while(b[current_id].parent_id != -1){
		++depth;
		current_id = b[current_id].parent_id;
	}
	return depth;
}

int get_height(node* b, int id){
	int left_child_id  = b[id].left_child_id;
	int right_child_id = b[id].right_child_id;
	if(b[id].left_child_id != -1 || b[id].right_child_id != -1 ){
		if(b[id].right_child_id == -1) return get_height(b, left_child_id)+1;
		if(b[id].left_child_id  == -1) return get_height(b, right_child_id)+1;
		return max(get_height(b, left_child_id), get_height(b, right_child_id))+1;
	}
	return 0;
}
const char* get_position_name(node* b, int id){
	if(b[id].parent_id == -1) return "root";
	if(b[id].left_child_id == -1 && b[id].right_child_id == -1 ) return "leaf";
	return "internal node";
}

Measured memory_bytes: 1208
import java.util.*;

public class Main {

    public static void main(String[] args) {
        // write your code here
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int s = sc.nextInt();
        for (int i = 0; i < k; i++) {
            System.out.print(s + " ");
        }
        int v = s == 1 ? 2 : s - 1;
        for (int i = 0; i < n - k; i++) {
            System.out.print(v + " ");
        }
    }
}

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

vector<pair<ll, int>> factor(ll n) {
    vector<pair<ll, int>> res;
    for(ll i = 2; i * i <= n; i++) {
        if(n % i != 0) continue;
        int ex = 0;
        while(n % i == 0) {
            ex++;
            n /= i;
        }
        res.push_back({i, ex});
    }
    if(n != 1) res.push_back({n, 1});
    return res;
}

int main()
{
    ll n, p;
    cin >> n >> p;
    vector<pair<ll, int>> fs;
    fs = factor(p);
    ll ans = 1;
    for(auto t : fs) {
        ll k = 1;
        int x = t.second / n;
        rep(i, x) {
            k *= t.first;
        }
        ans *= k;
    }
    cout << ans << endl;
    return 0;
}


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

int main(){
	int N,M,X;
	cin>>N>>M>>X;
	vector<int>A(M);
	vector<int>board(N,0);
	rep(i,M){
		cin>>A.at(i);
		board.at(A.at(i))++;
	}
	int x=0,y=0;
	rep(i,N){
		if(i<=X){
			x+=board.at(i);
		}else{
			y+=board.at(i);
		}
	}
	cout<<min(x,y)<<endl;
return 0;}

/*compile
g++ code.cpp
./a.out
run*/

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

using namespace std;

typedef long long ll;

void solve(){
    ll n, m, s = 0;
    cin >> n >> m;
    for(int i=0, x; i<m; i++){
        cin >> x;
        s+=x;
    }
    cout << (n-s>=0?n-s:-1);
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int t =1, i = 1;
    //cin >> t;
    while(t--){
        solve();
        ++i;
    }
    return 0;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;

int main() {
  ll n, a, b;
  cin >> n >> a >> b;
  ll x = n / (a + b);
  ll ans = x * a + min(a, n % (a + b));
  cout << ans << endl;
  return 0;
}

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

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
const int MD = (int)1e9 + 7; typedef vector<ll> VL;
void dbg(){ cerr << "\n"; }  template <class T, class ...T2> void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }


int main() {
	//cin.tie(0); ios_base::sync_with_stdio(false);
	int x, y, ans =0;
	cin >>x >>y;
	int cx[] = {0, 300000, 200000, 100000};
	if(x<4) ans += cx[x];
	if(y<4) ans += cx[y];
	if(x==1 && y==1) ans += 400000;
	cout << ans <<"\n";
	return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
n,k = map(int,input().split())
s = input()

# 文字列sの幸福度をカウントする関数
def count_happy(s):
    count = 0
    for i in range(1,len(s)-1):
        if s[i]==s[i-1]:
            count += 1
    return count

# print(count_happy(s))
ans = count_happy(s) + 2*k
ans_final = min(n-1,ans)
print(ans_final)

Measured memory_bytes: 3188
n = int(input())

a = list(map(int, input().split()))

b = list(map(int, input().split()))

c = list(map(int, input().split()))

m = n-1
ans = 0
for i in range(n):
    ans += b[a[i]-1]
    if (i>0)and(a[i] == a[i-1]+1):
        ans += c[a[i-1]-1]

print(ans)


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

#define rep(i,n) for(int i=0 ; i<(n) ; i++)
#define repr(i,n) for(int i=(n) ; i>=0 ; i--)
#define ALL(x) (x).begin(),(x).end()

using ll = long long;
using ull = unsigned long long;
 
const ll INF = 1LL<<60;
const int MINF = 1e9;
const int MOD = 1e9+7;

using vi = vector<int>;
using vii = vector<vi>;

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

template<typename T>
T GCD(T a,T b){ return b ? GCD(b,a%b) : a ;}
template<typename T>
T LCM(T a,T b){ return a*b / GCD(a,b) ;}

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

    string s;cin >> s;
    int q;cin >> q;
    deque<char> deq(ALL(s));
    int flag = 1;
    rep(i,q){
        int n;cin >> n;
        if(n == 1){
            flag *= -1;
        }else{
            int a;char c;
            cin >> a >> c;
            if(a == 1){
                if(flag == 1)deq.push_front(c);
                else deq.push_back(c);
            }else{
                if(flag == 1)deq.push_back(c);
                else deq.push_front(c);
            }
        }
    }
    
    if(flag == -1)reverse(ALL(deq));

    for(auto i : deq){
        cout << i;
    }
    cout << endl;
    return 0;
}

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

//#define debug_mode

#ifdef debug_mode
std::ifstream cin("input.txt");
std::ofstream cout("output.txt");
using std::endl;
#endif

#ifndef debug_mode
using namespace std;
#endif

void func_to_be_create();

int main(){

    #ifdef debug_mode
    int TEST_NUM = 2;
    while( TEST_NUM --){
    #endif

        func_to_be_create();

    #ifdef debug_mode
    }
    #endif
    return 0;

}

void func_to_be_create(){
    unsigned int N;
    cin >> N;
    unsigned long  sum = 0;
    unsigned int index = 1;
    while(index <= N){
        if( index % 3){
            if (index % 5){
                sum += index;
            }
        }
        index ++;
    }
    cout << sum << endl;
}

Measured memory_bytes: 3632
import java.util.ArrayList;
import java.util.Collections;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {

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

		String[] lines = scanner.nextLine().split(" ");
		int N = Integer.parseInt(lines[0]);
		int M = Integer.parseInt(lines[1]);

		ArrayList<ArrayList<Integer>> arrays = new ArrayList<ArrayList<Integer>>();
		PriorityQueue<Integer> pq = new PriorityQueue<Integer>(Collections.reverseOrder());

		int answer = 0;

		for (int i = 0; i < M; i++) {
			ArrayList<Integer> array = new ArrayList<Integer>();
			arrays.add(array);
		}

		for (int i = 0; i < N; i++) {
			String[] line = scanner.nextLine().split(" ");
			int A = Integer.parseInt(line[0]);
			int B = Integer.parseInt(line[1]);
			if (A > M)
				continue;
			arrays.get(M - A).add(B);
		}

		for (int i = M - 1; i >= 0; --i) {
			for (int j : arrays.get(i)) {
				pq.add(j);
			}
			if (!pq.isEmpty()) {
				answer += pq.poll();
			}
		}

		System.out.println(answer);

	}
}

Measured memory_bytes: 128360
#include <iostream>

int main() {
	int n, m;
	std::cin >> n >> m;

	int sum = 0;
	for (int i = 0; i < m; ++i) {
		int a;
		std::cin >> a;

		sum += a;
	}

	std::cout << (sum > n ? -1 : n - sum) << std::endl;
}

Measured memory_bytes: 3636
// スタックサイズ: 100MB

#define _USE_MATH_DEFINES
#include <iostream>
#include <fstream>
#include <vector>
#include <map>
#include <unordered_map>
#include <string>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <functional>
#include <numeric>
#include <iomanip>
#include <queue>
#include <list>
#include <set>
using namespace std;

typedef int64_t ll;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
const ll INF = 1e18;
const double EPS = 1e-10;
const ll mod = 1e9 + 7;
#define fastio  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define fori(i, a, b) for (ll i = (a); i < (b); ++i)
#define ford(i, a, b) for (ll i = (b - 1); (a) <= i; --i)
#define rep(i, n) fori(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define fst first
#define snd second
ll pw(ll x, ll y) { ll r = 1;  rep(i, y) { r *= x; }; return r; }



int main() {
	fastio;

	ll N;
	cin >> N;
	vll a(100010, 0);
	rep(i, N) {
		ll tmp;
		cin >> tmp;
		if (0 < tmp) ++a[tmp - 1];
		++a[tmp], ++a[tmp + 1];
	}
	cout << *max_element(all(a)) << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define rrep(i,n) for(int i=(n)-1; i>=0; i--)

using namespace std;
typedef long long ll;

int main(){
	int N, M, A, B;
	int D[10005];
	
	cin >> N >> M >> A >> B;
	rep(i,N) cin >> D[i];

	int cnt = 0;
	rep(i,N){
		if( D[i] >= A ) cnt++;
		else break;
	}
	if( cnt > N-M ){
		rrep(j,cnt){
			if( D[j] <= B ) cnt--;
			else break;
		}
	}

	cout << cnt << endl;

	return 0;
}

Measured memory_bytes: 3096
#include<stdio.h>
int main()
{
  int  A,B;
  scanf("%d %d",&A,&B);
  if(B%A==0){
    A=A+B;
    printf("%d",A);
  }
  else {
    B=B-A;
    printf("%d",B);
  }

  return 0;
}


Measured memory_bytes: 128
#include<stdio.h>
int main(){
	int a[3],box,i,i2;
	scanf("%d %d %d",&a[0],&a[1],&a[2]);
	for(i=0;i<3;i++){
		for(i2=i;i2<3;i2++){
			if(a[i]>a[i2]){
				box=a[i];
				a[i]=a[i2];
				a[i2]=box;
			}
		}
	}
	printf("%d %d %d\n",a[0],a[1],a[2]);
	return 0;
}

Measured memory_bytes: 2676
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 100000000000000;

int n;
vector<ll> a(5000);
vector<vector<ll> > adj(5000, vector<ll>());
//vector<vector<vector<ll> > > dp(5000, vector<vector<ll> >(5000, vector<ll>(2, INF)));
ll dp[5000][5000][2];
vector<int> edges(5000, 0);
ll sub[5000][5000][2];

void chmin(ll& before, ll after) {
	if (before > after) before = after;
	return;
}

int dfs_pre(int x, int p) {
	if (x != 0 && adj[x].size() == 1) return 0;
	for (auto v : adj[x]) {
		if (v == p) continue;
		else edges[x] += dfs_pre(v, x) + 1;
	}
	return edges[x];
}

void dfs(int x, int p) {
	for (auto v : adj[x]) {
		if (v != p) dfs(v, x);
	}

	//vector<vector<vector<ll> > > sub(n, vector<vector<ll> >(n, vector<ll>(2, INF)));
	//ll sub[n][n][2];
	for (int i = 0; i < adj[x].size()+1; ++i)
	{
		for (int j = 0; j < edges[x]+1; ++j)
		{
			sub[i][j][0] = INF;
			sub[i][j][1] = INF;
		}
	}
	sub[0][0][1] = a[x];
	if (a[x] > 0) sub[0][0][0] = a[x];
	int i = 0;
	int e_cnt = 0;

	for (auto v : adj[x]) {
		if (v == p) continue;
		for (int j1 = 0; j1 < e_cnt+1; ++j1)
		{
			for (int j2 = 0; j2 < edges[v]+1; ++j2)
			{
				chmin(sub[i+1][j1+j2][1], sub[i][j1][0] + dp[v][j2][1]);
				chmin(sub[i+1][j1+j2][1], sub[i][j1][1] + dp[v][j2][0]);
				chmin(sub[i+1][j1+j2][1], sub[i][j1][1] + dp[v][j2][1]);
				if (a[x] > 0) chmin(sub[i+1][j1+j2][0], sub[i][j1][0] + dp[v][j2][0]);

				if (dp[v][j2][0] < INF/2 || dp[v][j2][1] < 0) {
					chmin(sub[i+1][j1+j2+1][1], sub[i][j1][1]);
					if (a[x] > 0) chmin(sub[i+1][j1+j2+1][0], sub[i][j1][0]);
				}
			}
		}
		e_cnt += edges[v] + 1;
		i++;
	}
	for (int j = 0; j < edges[x]+1; ++j)
	{
		dp[x][j][0] = sub[i][j][0];
		dp[x][j][1] = sub[i][j][1];
	}

	return;
}

int main() {
	for (int i = 0; i < 5000; ++i)
	{
		for (int j = 0; j < 5000; ++j)
		{
			for (int k = 0; k < 2; ++k)
			{
				dp[i][j][k] = INF;
			}
		}
	}

	cin >> n;
	for (int i = 0; i < n; ++i) cin >> a[i];
	for (int i = 0; i < n-1; ++i)
	{
		int u, v; cin >> u >> v;
		adj[u-1].push_back(v-1);
		adj[v-1].push_back(u-1);
	}

	dfs_pre(0, -1);

	dfs(0, -1);

	int ans;
	for (int j = 0; j < n; ++j)
	{
		if (dp[0][j][0] < INF/2 || dp[0][j][1] < 0) {
			ans = j;
			break;
		}
	}

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


Measured memory_bytes: 781824
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
template<typename T> using v2 = vector<vector<T>>;
template<typename T> inline v2<T> fill(int r, int c, T t){return v2<T>(r, vector<T>(c, t));}

int n;

const int mx = 1e7+5;
int spf[mx];
void seive(){
    spf[1] = 1;
    for(int i = 2; i <= n; i++) spf[i] = i;
    for(int i = 4; i <= n; i+=2) spf[i] = 2;
    for(int i = 3; i*i <= n; i++){
        if(spf[i]==i){
            for(int j = i*i; j <= n; j+=i){
                if(spf[j]==j){
                    spf[j] = i;
                }
            }
        }
    }
}

ll factor(int a){
    map<int, int> pf;
    while(a != 1){
        pf[spf[a]]++;
        a /= spf[a];
    }
    ll ans = 1;
    for(auto& p : pf){
        ans *= p.second+1;
    }
    return ans;
}

void solve(){
    cin >> n;
    seive();
    ll ans = 0;
    for(int i = 1; i <= n; i++){
        ans += i*factor(i);
    }
    cout << ans << '\n';
}

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


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

class Main {
	static PrintStream out = System.out;
	static Scanner in = new Scanner(System.in);

	public static void main(String[] args) {
		int n = in.nextInt();

		int i = 1;
		do {
			int x = i;
			if ( x % 3 == 0 ){
				out.print(" " + i);
			} else {
				do{
					if(x % 10 == 3){
						out.print(" " + i);
						break;
					}
					x /= 10;
				}while(x != 0);
			}
		}while( ++i <= n );

		out.println();
	}
}

Measured memory_bytes: 24312
#include<bits/stdc++.h> //Ithea Myse Valgulious
namespace chtholly{
typedef long long ll;
#define re0 register int
#define rec register char
#define rel register ll
#define gc getchar
#define pc putchar
#define p32 pc(' ')
#define pl puts("")
/*By Citrus*/
inline int read(){
  int x=0,f=1;char c=gc();
  for (;!isdigit(c);c=gc()) f^=c=='-';
  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');
  return f?x:-x;
  }
template <typename mitsuha>
inline bool read(mitsuha &x){
  x=0;int f=1;char c=gc();
  for (;!isdigit(c)&&~c;c=gc()) f^=c=='-';
  if (!~c) return 0;
  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');
  return x=f?x:-x,1;
  }
template <typename mitsuha>
inline int write(mitsuha x){
  if (!x) return 0&pc(48);
  if (x<0) x=-x,pc('-');
  int bit[20],i,p=0;
  for (;x;x/=10) bit[++p]=x%10;
  for (i=p;i;--i) pc(bit[i]+48);
  return 0;
  }
inline char fuhao(){
  char c=gc();
  for (;isspace(c);c=gc());
  return c;
  }
}using namespace chtholly;
using namespace std;
 
int main(){
string s;int w;
cin>>s>>w;
for (int i=0;i<s.size();i+=w) pc(s[i]);
}

Measured memory_bytes: 256
import java.util.*;
import java.io.PrintWriter;
public class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		TreeMap<String,Integer> map=new TreeMap<>();
		for(int i=0; i<n; i++){
			String s=sc.next();
			map.put(s,1);
		}
		System.out.println(map.size());
	}
}


Measured memory_bytes: 77684
#include <bits/stdc++.h>
using namespace std;
#define GET_MACRO(_1, _2, _3, NAME, ...) NAME
#define _repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define _rep(i,n) _repl(i,0,n)
#define rep(...) GET_MACRO(__VA_ARGS__, _repl, _rep)(__VA_ARGS__)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back((a))
#define all(x) (x).begin(),(x).end()
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#define fi first
#define se second
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
void _dbg(string){cout<<endl;}
template<class H,class... T> void _dbg(string s,H h,T... t){int l=s.find(',');cout<<s.substr(0,l)<<" = "<<h<<", ";_dbg(s.substr(l+1),t...);}
template<class T,class U> ostream& operator<<(ostream &o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream &o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

#define INF 1120000000
#define long long long // for codeforces

int main(){
  string s,t;
  cin>>s>>t;
  reverse(all(t));

  if(s==t) cout << "YES" << endl;
  else cout << "NO" << endl;

  return 0;
}


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

using namespace std;
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
constexpr int MOD = 1000000007;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
constexpr int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
constexpr int dy[] = {0, -1, 0, 1, 1, -1, -1, 1};

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){os << "["; for (const auto &v : vec) {os << v << ","; } os << "]"; return os; }

void solve() {
  string t = "AKIHABARA";
  string s;
  cin >> s;
  int N = s.size();
  int M = t.size();
  vector<vector<int>> dp(N + 1, vector<int>(M + 1));
  dp[0][0] = 1;
  for(int i = 0; i <= N; i++) {
    for (int j = 0; j < M; j++) {
      if (!dp[i][j]) continue;
      if (i != N && s[i] == t[j]) dp[i + 1][j + 1] = 1;
      if (t[j] == 'A') dp[i][j + 1] = 1;
    }
  }
  if (dp.back().back()) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
}

int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);
  cout.setf(ios::fixed);
  cout.precision(16);
  solve();
  return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;

namespace AtCorder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var l = Console.ReadLine()
               .Split(' ')
               .Select(int.Parse)
               .ToArray();
            Console.WriteLine((l[0] * 3 + l[1]) / 2);
        }
    }
}


Measured memory_bytes: 13396
#!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    n = II()
    a = [7,5,3]
    if n in a:
        print("YES")
    else:
        print("NO")
    return

#B
def B():
    s = S()
    ans = inf
    for i in range(len(s) - 2):
        ans = min(ans, abs(753-int("".join(s[i:i + 3]))))
    print(ans)
    return

#C
def C():
    s = II()
    n = len(str(s))
    ans = 0
    for i in range(3,n+1):
        c = itertools.product(["3", "5", "7"], repeat=i)
        for ci in c:
            if len(set(ci)) < 3:
                continue
            if int("".join(ci)) <= s:
                ans += 1
    print(ans)

        
    return

def primes(n):
    """ Input n>=6, Returns a list of primes, 2 <= p < n """
    """ 6以上の数であれば p (素数) <= n のlistを返す """
    n, correction = n - n % 6 + 6, 2 - (n % 6 > 1)
    sieve = [True] * (n // 3)
    for i in range(1, int(n ** 0.5) // 3 + 1):
        if sieve[i]:
            k = 3 * i + 1 | 1
            sieve[k * k                     // 3::2 * k] = [False] * ((n // 6 - k * k                     // 6 - 1) // k + 1)
            sieve[k * (k - 2 * (i & 1) + 4) // 3::2 * k] = [False] * ((n // 6 - k * (k - 2 * (i & 1) + 4) // 6 - 1) // k + 1)
    return [2, 3] + [3 * i + 1 | 1 for i in range(1, n // 3 - correction) if sieve[i]]
#D
def D():
    n = II()
    primelis = primes(100)
    d = {2: 0, 4: 0, 14: 0, 24: 0, 74: 0}
    for i in primelis:
        b = n
        tmp = 0
        while b // i:
            tmp += (b // i)
            b = (b // i)
        for x in d.keys():
            d[x] += (tmp >= x)
    ans = 0
    ans += (d[2] - 1) * d[24]
    ans += (d[4] - 1) * d[14]
    ans += d[74]
    ans += (d[2] - 2) * (d[4] - 1) * d[4] // 2
    print(ans)
    return

#Solve
if __name__ == '__main__':
    D()


Measured memory_bytes: 39920
#include <bits/stdc++.h>
#define rep(i,N) for (int i = 0; i < (N); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int inf{int(1e9)};
int main(void){
  int N;
  cin >> N;

  //iはケーキ、jはドーナツの個数
  string ans = "No";
  for (int i = 0; i <= N / 4; i++){
    if ((N - 4 * i) % 7 == 0) ans = "Yes";
  }
  cout << ans << endl;
}


Measured memory_bytes: 3596
while line = gets
ans =[]
line = line.chomp.to_i
break if line == 0
a = line/200
b = line/300
c = line/500
  for i in 0..a
    for j in 0..b
      for k in 0..c
        if 200 * i + 300 * j + 500 * k == line
          ans.push([i,j,k])
        end
      end
    end
  end
  price = Float::INFINITY
  p = [[1520,1870,2244],[380,550,850]]
  for i in 0..(ans.length-1)
    tp = 0
    for j in 0..2
    t = ans[i][j] / (5-j)
      tp += t * p[0][j] + (ans[i][j] - t * (5 - j)) * p[1][j]
    end
       if tp < price
      price = tp
       end
  end
  puts price
end


Measured memory_bytes: 6892
aizu q1 b c1 q2 =
  let q = min q1 q2
      g = if b >= q2 * c1
          then q2
          else b `div` c1
  in
    g
norm b c2 = b `div` c2

ans' q1 b c1 c2 a =
  if a <= 0
  then "NA"
  else
    let n = norm (b-a*c1) c2
    in
      if a + n >= q1
      then (show a) ++ " " ++ (show n)
      else ans' q1 b c1 c2 (a-1)

ans (q1:b:c1:c2:q2:_) =
  let a = aizu q1 b c1 q2
  in
    ans' q1 b c1 c2 a

main = do
  c <- getContents
  let i = takeWhile (/= [0]) $ map (map read) $ map words $ lines c :: [[Int]]
      o = map ans i
  mapM_ putStrLn o

Measured memory_bytes: 4084
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int[][] a = new int[3][3];
        for(int i=0; i<3; i++) {
            for(int j=0; j<3; j++) {
                a[i][j] = in.nextInt();
            }
        }
        int n = in.nextInt();
        Set<Integer> b = new HashSet<>(n);
        for(int i=0; i<n; i++) {
            b.add(in.nextInt());
        }
        boolean isBingo = false;

        // よこ
        for(int i=0; i<3; i++) {
            if(isBingo) {
                break;
            }
            boolean localBingo = true;
            for(int j=0; j<3; j++) {
                if(!b.contains(a[i][j])) {
                    localBingo = false;
                    break;
                }
            }
            if(localBingo) {
                isBingo = true;
            }
        }
        // たて
        for(int i=0; i<3; i++) {
            if(isBingo) {
                break;
            }
            boolean localBingo = true;
            for(int j=0; j<3; j++) {
                if(!b.contains(a[j][i])) {
                    localBingo = false;
                    break;
                }
            }
            if(localBingo) {
                isBingo = true;
            }
        }
        // ななめ
        if(
            (b.contains(a[0][0]) && b.contains(a[1][1]) && b.contains(a[2][2]))
            || (b.contains(a[0][2]) && b.contains(a[1][1]) && b.contains(a[2][0]))
        ) {
            isBingo = true;
        }
        System.out.println(isBingo?"Yes":"No");
    }
}


Measured memory_bytes: 22740